diff --git a/terraform/providers/azurerm/go.mod b/terraform/providers/azurerm/go.mod index 000d8eae7f7..32b3f0dc3d9 100644 --- a/terraform/providers/azurerm/go.mod +++ b/terraform/providers/azurerm/go.mod @@ -2,7 +2,7 @@ module github.com/openshift/installer/terraform/providers/azurerm go 1.17 -require github.com/hashicorp/terraform-provider-azurerm v1.44.1-0.20220614054854-771c254f3b8b // v3.10.0 +require github.com/hashicorp/terraform-provider-azurerm v1.44.1-0.20220819162217-6be27548882d // v3.19.1 require ( github.com/Azure/azure-sdk-for-go v65.0.0+incompatible // indirect @@ -27,7 +27,8 @@ require ( github.com/google/go-cmp v0.5.8 // indirect github.com/google/uuid v1.3.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect - github.com/hashicorp/go-azure-helpers v0.33.0 // indirect + github.com/hashicorp/go-azure-helpers v0.39.1 // indirect + github.com/hashicorp/go-azure-sdk v0.20220815.1092453 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637 // indirect @@ -36,16 +37,16 @@ require ( github.com/hashicorp/go-plugin v1.4.4 // indirect github.com/hashicorp/go-retryablehttp v0.7.1 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect - github.com/hashicorp/go-version v1.5.0 // indirect - github.com/hashicorp/hc-install v0.3.2 // indirect - github.com/hashicorp/hcl/v2 v2.12.0 // indirect + github.com/hashicorp/go-version v1.6.0 // indirect + github.com/hashicorp/hc-install v0.4.0 // indirect + github.com/hashicorp/hcl/v2 v2.13.0 // indirect github.com/hashicorp/logutils v1.0.0 // indirect - github.com/hashicorp/terraform-exec v0.16.1 // indirect + github.com/hashicorp/terraform-exec v0.17.2 // indirect github.com/hashicorp/terraform-json v0.14.0 // indirect - github.com/hashicorp/terraform-plugin-go v0.9.1 // indirect + github.com/hashicorp/terraform-plugin-go v0.10.0 // indirect github.com/hashicorp/terraform-plugin-log v0.4.1 // indirect - github.com/hashicorp/terraform-plugin-sdk/v2 v2.17.0 // indirect - github.com/hashicorp/terraform-registry-address v0.0.0-20220510144317-d78f4a47ae27 // indirect + github.com/hashicorp/terraform-plugin-sdk/v2 v2.18.0 // indirect + github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c // indirect github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 // indirect github.com/manicminer/hamilton v0.46.0 // indirect diff --git a/terraform/providers/azurerm/go.sum b/terraform/providers/azurerm/go.sum index 8c28526a9af..9723c95dbb6 100644 --- a/terraform/providers/azurerm/go.sum +++ b/terraform/providers/azurerm/go.sum @@ -78,13 +78,11 @@ github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C6 github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= -github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apparentlymart/go-cidr v1.1.0 h1:2mAhrMoF+nhXqxTzSZMUzDHkLjmIHC+Zzn4tdgBZjnU= -github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= @@ -140,7 +138,6 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= -github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/gofrs/uuid v4.2.0+incompatible h1:yyYWMnhkhrKwwr8gAOcOCYxOOscHgDS9yZgBrnJfGa0= github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= @@ -210,8 +207,10 @@ github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= -github.com/hashicorp/go-azure-helpers v0.33.0 h1:ClAtKDk0g96eBv0PI/O/HkZXwLhaxSLtf9f3HqXRCtY= -github.com/hashicorp/go-azure-helpers v0.33.0/go.mod h1:gcutZ/Hf/O7YN9M3UIvyZ9l0Rxv7Yrc9x5sSfM9cuSw= +github.com/hashicorp/go-azure-helpers v0.39.1 h1:f5zkbJccz9Zbgx1qiI1ssMh8jpPubT3cyPRpKuM9WfQ= +github.com/hashicorp/go-azure-helpers v0.39.1/go.mod h1:gcutZ/Hf/O7YN9M3UIvyZ9l0Rxv7Yrc9x5sSfM9cuSw= +github.com/hashicorp/go-azure-sdk v0.20220815.1092453 h1:MfhuaqchMELBWNWmkJWnQHDF9wRQVf2VyL1gwaR90aI= +github.com/hashicorp/go-azure-sdk v0.20220815.1092453/go.mod h1:yjQPw8DCOtQR8E8+FNaTxF6yz+tyQGkDNiVAGCNoLOo= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= @@ -237,31 +236,31 @@ github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/C github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.4.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.5.0 h1:O293SZ2Eg+AAYijkVK3jR786Am1bhDEh2GHT0tIVE5E= github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= +github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hc-install v0.3.2 h1:oiQdJZvXmkNcRcEOOfM5n+VTsvNjWQeOjfAoO6dKSH8= -github.com/hashicorp/hc-install v0.3.2/go.mod h1:xMG6Tr8Fw1WFjlxH0A9v61cW15pFwgEGqEz0V4jisHs= -github.com/hashicorp/hcl/v2 v2.12.0 h1:PsYxySWpMD4KPaoJLnsHwtK5Qptvj/4Q6s0t4sUxZf4= -github.com/hashicorp/hcl/v2 v2.12.0/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg= +github.com/hashicorp/hc-install v0.4.0 h1:cZkRFr1WVa0Ty6x5fTvL1TuO1flul231rWkGH92oYYk= +github.com/hashicorp/hc-install v0.4.0/go.mod h1:5d155H8EC5ewegao9A4PUTMNPZaq+TbOzkJJZ4vrXeI= +github.com/hashicorp/hcl/v2 v2.13.0 h1:0Apadu1w6M11dyGFxWnmhhcMjkbAiKCv7G1r/2QgCNc= +github.com/hashicorp/hcl/v2 v2.13.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/terraform-exec v0.16.1 h1:NAwZFJW2L2SaCBVZoVaH8LPImLOGbPLkSHy0IYbs2uE= -github.com/hashicorp/terraform-exec v0.16.1/go.mod h1:aj0lVshy8l+MHhFNoijNHtqTJQI3Xlowv5EOsEaGO7M= +github.com/hashicorp/terraform-exec v0.17.2 h1:EU7i3Fh7vDUI9nNRdMATCEfnm9axzTnad8zszYZ73Go= +github.com/hashicorp/terraform-exec v0.17.2/go.mod h1:tuIbsL2l4MlwwIZx9HPM+LOV9vVyEfBYu2GsO1uH3/8= github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s= github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM= -github.com/hashicorp/terraform-plugin-go v0.9.1 h1:vXdHaQ6aqL+OF076nMSBV+JKPdmXlzG5mzVDD04WyPs= -github.com/hashicorp/terraform-plugin-go v0.9.1/go.mod h1:ItjVSlQs70otlzcCwlPcU8FRXLdO973oYFRZwAOxy8M= +github.com/hashicorp/terraform-plugin-go v0.10.0 h1:FIQDt/AZDSOXnN+znBnLLZA9aFk4/GwL40rwMLnvuTk= +github.com/hashicorp/terraform-plugin-go v0.10.0/go.mod h1:aphXBG8qtQH0yF1waMRlaw/3G+ZFlR/6Artnvt1QEDE= github.com/hashicorp/terraform-plugin-log v0.4.1 h1:xpbmVhvuU3mgHzLetOmx9pkOL2rmgpu302XxddON6eo= github.com/hashicorp/terraform-plugin-log v0.4.1/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.17.0 h1:Qr5fWNg1SPSfCRMtou67Y6Kcy9UnMYRNlIJTKRuUvXU= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.17.0/go.mod h1:b+LFg8WpYgFgvEBP/6Htk5H9/pJp1V1E8NJAekfH2Ws= -github.com/hashicorp/terraform-provider-azurerm v1.44.1-0.20220614054854-771c254f3b8b h1:Y5RAQ4NieI0fW1HxnS63Fn/8v1hTnEVaxiAaaOwEza0= -github.com/hashicorp/terraform-provider-azurerm v1.44.1-0.20220614054854-771c254f3b8b/go.mod h1:Bmg72R52oYYDuy6jziNUE4U5P7uCLEv2bZ8/EIzDsIg= -github.com/hashicorp/terraform-registry-address v0.0.0-20220510144317-d78f4a47ae27 h1:IOawOnLgKntezAV3oJs17rkhXha+h0EF5OMjb2KFlYc= -github.com/hashicorp/terraform-registry-address v0.0.0-20220510144317-d78f4a47ae27/go.mod h1:Wn3Na71knbXc1G8Lh+yu/dQWWJeFQEpDeJMtWMtlmNI= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.18.0 h1:/cdI5di5XA+N80gXzXF4YcHq36DprBskubk6Z8i26ZQ= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.18.0/go.mod h1:L3SHkD/Q8zPVgXviQmpVwy9nKwpXXZscVIpVEnQ/T50= +github.com/hashicorp/terraform-provider-azurerm v1.44.1-0.20220819162217-6be27548882d h1:S4mPYzqnWTfV7pIOE5uqDoVcORxhTfb1AlY2ByLW3I0= +github.com/hashicorp/terraform-provider-azurerm v1.44.1-0.20220819162217-6be27548882d/go.mod h1:f+RHPmAqkbz3ucVtw6yHYEYrbmOI5u7P631iBGKrFi0= +github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c h1:D8aRO6+mTqHfLsK/BC3j5OAoogv1WLRWzY1AaTo3rBg= +github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c/go.mod h1:Wn3Na71knbXc1G8Lh+yu/dQWWJeFQEpDeJMtWMtlmNI= github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0= github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 h1:xixZ2bWeofWV68J+x6AzmKuVM/JWCQwkWm6GW/MUR6I= @@ -306,7 +305,6 @@ github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= -github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -330,13 +328,11 @@ github.com/rickb777/plural v1.4.1/go.mod h1:kdmXUpmKBJTS0FtG/TFumd//VBWsNTD7zOw7 github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -363,7 +359,6 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= -github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= github.com/zclconf/go-cty v1.10.0 h1:mp9ZXQeIcN8kAwuqorjH+Q+njbJKjLrvB2yIh4q7U+0= github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= @@ -375,7 +370,6 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -478,7 +472,6 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/_meta.json deleted file mode 100644 index cb79c14a28d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/azurestackhci/resource-manager/readme.md", - "tag": "package-2020-10", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-10 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/azurestackhci/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/client.go deleted file mode 100644 index 0be2f1e0e05..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package azurestackhci implements the Azure ARM Azurestackhci service API version 2020-10-01. -// -// Azure Stack HCI management service -package azurestackhci - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Azurestackhci - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Azurestackhci. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/clusters.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/clusters.go deleted file mode 100644 index da08688084d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/clusters.go +++ /dev/null @@ -1,631 +0,0 @@ -package azurestackhci - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ClustersClient is the azure Stack HCI management service -type ClustersClient struct { - BaseClient -} - -// NewClustersClient creates an instance of the ClustersClient client. -func NewClustersClient(subscriptionID string) ClustersClient { - return NewClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClustersClientWithBaseURI creates an instance of the ClustersClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { - return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create an HCI cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the cluster. -// cluster - details of the HCI cluster. -func (client ClustersClient) Create(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster) (result Cluster, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: cluster, - Constraints: []validation.Constraint{{Target: "cluster.ClusterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "cluster.ClusterProperties.AadClientID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "cluster.ClusterProperties.AadTenantID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("azurestackhci.ClustersClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, clusterName, cluster) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ClustersClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", pathParameters), - autorest.WithJSON(cluster), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ClustersClient) CreateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an HCI cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the cluster. -func (client ClustersClient) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("azurestackhci.ClustersClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get HCI cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the cluster. -func (client ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string) (result Cluster, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("azurestackhci.ClustersClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ClustersClient) GetResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all HCI clusters in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ClusterListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.cl.Response.Response != nil { - sc = result.cl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("azurestackhci.ClustersClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.cl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.cl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.cl.hasNextLink() && result.cl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ClustersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ClustersClient) listByResourceGroupNextResults(ctx context.Context, lastResults ClusterList) (result ClusterList, err error) { - req, err := lastResults.clusterListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ClustersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ClusterListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription list all HCI clusters in a subscription. -func (client ClustersClient) ListBySubscription(ctx context.Context) (result ClusterListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListBySubscription") - defer func() { - sc := -1 - if result.cl.Response.Response != nil { - sc = result.cl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("azurestackhci.ClustersClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.cl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.cl, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.cl.hasNextLink() && result.cl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ClustersClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListBySubscriptionResponder(resp *http.Response) (result ClusterList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client ClustersClient) listBySubscriptionNextResults(ctx context.Context, lastResults ClusterList) (result ClusterList, err error) { - req, err := lastResults.clusterListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client ClustersClient) ListBySubscriptionComplete(ctx context.Context) (result ClusterListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// Update update an HCI cluster. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// clusterName - the name of the cluster. -// cluster - details of the HCI cluster. -func (client ClustersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, cluster ClusterUpdate) (result Cluster, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("azurestackhci.ClustersClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, cluster) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.ClustersClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, cluster ClusterUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}", pathParameters), - autorest.WithJSON(cluster), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/enums.go deleted file mode 100644 index 76d5de2164d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/enums.go +++ /dev/null @@ -1,49 +0,0 @@ -package azurestackhci - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Accepted ... - Accepted ProvisioningState = "Accepted" - // Canceled ... - Canceled ProvisioningState = "Canceled" - // Failed ... - Failed ProvisioningState = "Failed" - // Provisioning ... - Provisioning ProvisioningState = "Provisioning" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Accepted, Canceled, Failed, Provisioning, Succeeded} -} - -// Status enumerates the values for status. -type Status string - -const ( - // ConnectedRecently ... - ConnectedRecently Status = "ConnectedRecently" - // Disconnected ... - Disconnected Status = "Disconnected" - // Error ... - Error Status = "Error" - // NotConnectedRecently ... - NotConnectedRecently Status = "NotConnectedRecently" - // NotYetRegistered ... - NotYetRegistered Status = "NotYetRegistered" -) - -// PossibleStatusValues returns an array of possible values for the Status const type. -func PossibleStatusValues() []Status { - return []Status{ConnectedRecently, Disconnected, Error, NotConnectedRecently, NotYetRegistered} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/models.go deleted file mode 100644 index 02fcceff5bf..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/models.go +++ /dev/null @@ -1,547 +0,0 @@ -package azurestackhci - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci" - -// AvailableOperations available operations of the service -type AvailableOperations struct { - autorest.Response `json:"-"` - // Value - Collection of available operation details - Value *[]OperationDetail `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Cluster cluster details. -type Cluster struct { - autorest.Response `json:"-"` - // ClusterProperties - Cluster properties. - *ClusterProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Cluster. -func (c Cluster) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.ClusterProperties != nil { - objectMap["properties"] = c.ClusterProperties - } - if c.Tags != nil { - objectMap["tags"] = c.Tags - } - if c.Location != nil { - objectMap["location"] = c.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Cluster struct. -func (c *Cluster) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var clusterProperties ClusterProperties - err = json.Unmarshal(*v, &clusterProperties) - if err != nil { - return err - } - c.ClusterProperties = &clusterProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - c.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - c.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - c.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - c.Type = &typeVar - } - } - } - - return nil -} - -// ClusterList list of clusters. -type ClusterList struct { - autorest.Response `json:"-"` - // Value - List of clusters. - Value *[]Cluster `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterList. -func (cl ClusterList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cl.Value != nil { - objectMap["value"] = cl.Value - } - return json.Marshal(objectMap) -} - -// ClusterListIterator provides access to a complete listing of Cluster values. -type ClusterListIterator struct { - i int - page ClusterListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ClusterListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ClusterListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ClusterListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ClusterListIterator) Response() ClusterList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ClusterListIterator) Value() Cluster { - if !iter.page.NotDone() { - return Cluster{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ClusterListIterator type. -func NewClusterListIterator(page ClusterListPage) ClusterListIterator { - return ClusterListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cl ClusterList) IsEmpty() bool { - return cl.Value == nil || len(*cl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cl ClusterList) hasNextLink() bool { - return cl.NextLink != nil && len(*cl.NextLink) != 0 -} - -// clusterListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cl ClusterList) clusterListPreparer(ctx context.Context) (*http.Request, error) { - if !cl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cl.NextLink))) -} - -// ClusterListPage contains a page of Cluster values. -type ClusterListPage struct { - fn func(context.Context, ClusterList) (ClusterList, error) - cl ClusterList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ClusterListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cl) - if err != nil { - return err - } - page.cl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ClusterListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ClusterListPage) NotDone() bool { - return !page.cl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ClusterListPage) Response() ClusterList { - return page.cl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ClusterListPage) Values() []Cluster { - if page.cl.IsEmpty() { - return nil - } - return *page.cl.Value -} - -// Creates a new instance of the ClusterListPage type. -func NewClusterListPage(cur ClusterList, getNextPage func(context.Context, ClusterList) (ClusterList, error)) ClusterListPage { - return ClusterListPage{ - fn: getNextPage, - cl: cur, - } -} - -// ClusterNode cluster node details. -type ClusterNode struct { - // Name - READ-ONLY; Name of the cluster node. - Name *string `json:"name,omitempty"` - // ID - READ-ONLY; Id of the node in the cluster. - ID *float64 `json:"id,omitempty"` - // Manufacturer - READ-ONLY; Manufacturer of the cluster node hardware. - Manufacturer *string `json:"manufacturer,omitempty"` - // Model - READ-ONLY; Model name of the cluster node hardware. - Model *string `json:"model,omitempty"` - // OsName - READ-ONLY; Operating system running on the cluster node. - OsName *string `json:"osName,omitempty"` - // OsVersion - READ-ONLY; Version of the operating system running on the cluster node. - OsVersion *string `json:"osVersion,omitempty"` - // SerialNumber - READ-ONLY; Immutable id of the cluster node. - SerialNumber *string `json:"serialNumber,omitempty"` - // CoreCount - READ-ONLY; Number of physical cores on the cluster node. - CoreCount *float64 `json:"coreCount,omitempty"` - // MemoryInGiB - READ-ONLY; Total available memory on the cluster node (in GiB). - MemoryInGiB *float64 `json:"memoryInGiB,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterNode. -func (cn ClusterNode) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ClusterProperties cluster properties. -type ClusterProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state. Possible values include: 'Succeeded', 'Failed', 'Canceled', 'Accepted', 'Provisioning' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // Status - READ-ONLY; Status of the cluster agent. Possible values include: 'NotYetRegistered', 'ConnectedRecently', 'NotConnectedRecently', 'Disconnected', 'Error' - Status Status `json:"status,omitempty"` - // CloudID - READ-ONLY; Unique, immutable resource id. - CloudID *string `json:"cloudId,omitempty"` - // AadClientID - App id of cluster AAD identity. - AadClientID *string `json:"aadClientId,omitempty"` - // AadTenantID - Tenant id of cluster AAD identity. - AadTenantID *string `json:"aadTenantId,omitempty"` - // ReportedProperties - Properties reported by cluster agent. - ReportedProperties *ClusterReportedProperties `json:"reportedProperties,omitempty"` - // TrialDaysRemaining - READ-ONLY; Number of days remaining in the trial period. - TrialDaysRemaining *float64 `json:"trialDaysRemaining,omitempty"` - // BillingModel - READ-ONLY; Type of billing applied to the resource. - BillingModel *string `json:"billingModel,omitempty"` - // RegistrationTimestamp - READ-ONLY; First cluster sync timestamp. - RegistrationTimestamp *date.Time `json:"registrationTimestamp,omitempty"` - // LastSyncTimestamp - READ-ONLY; Most recent cluster sync timestamp. - LastSyncTimestamp *date.Time `json:"lastSyncTimestamp,omitempty"` - // LastBillingTimestamp - READ-ONLY; Most recent billing meter timestamp. - LastBillingTimestamp *date.Time `json:"lastBillingTimestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterProperties. -func (cp ClusterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.AadClientID != nil { - objectMap["aadClientId"] = cp.AadClientID - } - if cp.AadTenantID != nil { - objectMap["aadTenantId"] = cp.AadTenantID - } - if cp.ReportedProperties != nil { - objectMap["reportedProperties"] = cp.ReportedProperties - } - return json.Marshal(objectMap) -} - -// ClusterReportedProperties properties reported by cluster agent. -type ClusterReportedProperties struct { - // ClusterName - READ-ONLY; Name of the on-prem cluster connected to this resource. - ClusterName *string `json:"clusterName,omitempty"` - // ClusterID - READ-ONLY; Unique id generated by the on-prem cluster. - ClusterID *string `json:"clusterId,omitempty"` - // ClusterVersion - READ-ONLY; Version of the cluster software. - ClusterVersion *string `json:"clusterVersion,omitempty"` - // Nodes - READ-ONLY; List of nodes reported by the cluster. - Nodes *[]ClusterNode `json:"nodes,omitempty"` - // LastUpdated - READ-ONLY; Last time the cluster reported the data. - LastUpdated *date.Time `json:"lastUpdated,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterReportedProperties. -func (crp ClusterReportedProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ClusterUpdate cluster details to update. -type ClusterUpdate struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ClusterUpdate. -func (cu ClusterUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cu.Tags != nil { - objectMap["tags"] = cu.Tags - } - return json.Marshal(objectMap) -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorDetail the error detail. -type ErrorDetail struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]ErrorDetail `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorDetail. -func (ed ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for -// failed operations. (This also follows the OData error response format.). -type ErrorResponse struct { - // Error - The error object. - Error *ErrorDetail `json:"error,omitempty"` -} - -// OperationDetail operation detail payload -type OperationDetail struct { - // Name - Name of the operation - Name *string `json:"name,omitempty"` - // IsDataAction - Indicates whether the operation is a data action - IsDataAction *bool `json:"isDataAction,omitempty"` - // Display - Display of the operation - Display *OperationDisplay `json:"display,omitempty"` - // Origin - Origin of the operation - Origin *string `json:"origin,omitempty"` - // Properties - Properties of the operation - Properties interface{} `json:"properties,omitempty"` -} - -// OperationDisplay operation display payload -type OperationDisplay struct { - // Provider - Resource provider of the operation - Provider *string `json:"provider,omitempty"` - // Resource - Resource of the operation - Resource *string `json:"resource,omitempty"` - // Operation - Localized friendly name for the operation - Operation *string `json:"operation,omitempty"` - // Description - Localized friendly description for the operation - Description *string `json:"description,omitempty"` -} - -// ProxyResource the resource model definition for an Azure Resource Manager proxy resource. It will have -// everything other than required location and tags -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/operations.go deleted file mode 100644 index 0f4c3c24166..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package azurestackhci - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the azure Stack HCI management service -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list all available Microsoft.AzureStackHCI provider operations -func (client OperationsClient) List(ctx context.Context) (result AvailableOperations, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "azurestackhci.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "azurestackhci.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.AzureStackHCI/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result AvailableOperations, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/version.go deleted file mode 100644 index b5f6dabfc00..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package azurestackhci - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " azurestackhci/2020-10-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/_meta.json deleted file mode 100644 index efa70d40dca..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "8d3b22458da4bb9309c0207c2ebc1903de741249", - "readme": "/_/azure-rest-api-specs/specification/communication/resource-manager/readme.md", - "tag": "package-2020-08-20", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-08-20 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/communication/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/client.go deleted file mode 100644 index bf250f24984..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package communication implements the Azure ARM Communication service API version 2020-08-20. -// -// REST API for Azure Communication Services -package communication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Communication - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Communication. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/enums.go deleted file mode 100644 index 1620b902e4b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/enums.go +++ /dev/null @@ -1,123 +0,0 @@ -package communication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ActionType enumerates the values for action type. -type ActionType string - -const ( - // Internal ... - Internal ActionType = "Internal" -) - -// PossibleActionTypeValues returns an array of possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{Internal} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // Application ... - Application CreatedByType = "Application" - // Key ... - Key CreatedByType = "Key" - // ManagedIdentity ... - ManagedIdentity CreatedByType = "ManagedIdentity" - // User ... - User CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{Application, Key, ManagedIdentity, User} -} - -// KeyType enumerates the values for key type. -type KeyType string - -const ( - // Primary ... - Primary KeyType = "Primary" - // Secondary ... - Secondary KeyType = "Secondary" -) - -// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. -func PossibleKeyTypeValues() []KeyType { - return []KeyType{Primary, Secondary} -} - -// Origin enumerates the values for origin. -type Origin string - -const ( - // OriginSystem ... - OriginSystem Origin = "system" - // OriginUser ... - OriginUser Origin = "user" - // OriginUsersystem ... - OriginUsersystem Origin = "user,system" -) - -// PossibleOriginValues returns an array of possible values for the Origin const type. -func PossibleOriginValues() []Origin { - return []Origin{OriginSystem, OriginUser, OriginUsersystem} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Canceled ... - Canceled ProvisioningState = "Canceled" - // Creating ... - Creating ProvisioningState = "Creating" - // Deleting ... - Deleting ProvisioningState = "Deleting" - // Failed ... - Failed ProvisioningState = "Failed" - // Moving ... - Moving ProvisioningState = "Moving" - // Running ... - Running ProvisioningState = "Running" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" - // Unknown ... - Unknown ProvisioningState = "Unknown" - // Updating ... - Updating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Canceled, Creating, Deleting, Failed, Moving, Running, Succeeded, Unknown, Updating} -} - -// Status enumerates the values for status. -type Status string - -const ( - // StatusCanceled ... - StatusCanceled Status = "Canceled" - // StatusCreating ... - StatusCreating Status = "Creating" - // StatusDeleting ... - StatusDeleting Status = "Deleting" - // StatusFailed ... - StatusFailed Status = "Failed" - // StatusMoving ... - StatusMoving Status = "Moving" - // StatusSucceeded ... - StatusSucceeded Status = "Succeeded" -) - -// PossibleStatusValues returns an array of possible values for the Status const type. -func PossibleStatusValues() []Status { - return []Status{StatusCanceled, StatusCreating, StatusDeleting, StatusFailed, StatusMoving, StatusSucceeded} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/models.go deleted file mode 100644 index d2172cce650..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/models.go +++ /dev/null @@ -1,914 +0,0 @@ -package communication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication" - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorDetail the error detail. -type ErrorDetail struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]ErrorDetail `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorDetail. -func (ed ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for -// failed operations. (This also follows the OData error response format.). -type ErrorResponse struct { - // Error - The error object. - Error *ErrorDetail `json:"error,omitempty"` -} - -// LinkedNotificationHub a notification hub that has been linked to the communication service -type LinkedNotificationHub struct { - autorest.Response `json:"-"` - // ResourceID - The resource ID of the notification hub - ResourceID *string `json:"resourceId,omitempty"` -} - -// LinkNotificationHubParameters description of an Azure Notification Hub to link to the communication -// service -type LinkNotificationHubParameters struct { - // ResourceID - The resource ID of the notification hub - ResourceID *string `json:"resourceId,omitempty"` - // ConnectionString - Connection string for the notification hub - ConnectionString *string `json:"connectionString,omitempty"` -} - -// LocationResource an ARM resource with its own location (not a global or an inherited location). -type LocationResource struct { - // Location - The Azure location where the CommunicationService is running. - Location *string `json:"location,omitempty"` -} - -// NameAvailability result of the request to check name availability. It contains a flag and possible -// reason of failure. -type NameAvailability struct { - autorest.Response `json:"-"` - // NameAvailable - Indicates whether the name is available or not. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - The reason of the availability. Required if name is not available. - Reason *string `json:"reason,omitempty"` - // Message - The message of the operation. - Message *string `json:"message,omitempty"` -} - -// NameAvailabilityParameters data POST-ed to the nameAvailability action -type NameAvailabilityParameters struct { - // Type - The resource type. Should be always "Microsoft.Communication/CommunicationServices". - Type *string `json:"type,omitempty"` - // Name - The CommunicationService name to validate. e.g."my-CommunicationService-name-here" - Name *string `json:"name,omitempty"` -} - -// Operation details of a REST API operation, returned from the Resource Provider Operations API -type Operation struct { - // Name - READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" - Name *string `json:"name,omitempty"` - // IsDataAction - READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. - IsDataAction *bool `json:"isDataAction,omitempty"` - // Display - Localized display information for this particular operation. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". Possible values include: 'OriginUser', 'OriginSystem', 'OriginUsersystem' - Origin Origin `json:"origin,omitempty"` - // ActionType - READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: 'Internal' - ActionType ActionType `json:"actionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if o.Display != nil { - objectMap["display"] = o.Display - } - return json.Marshal(objectMap) -} - -// OperationDisplay localized display information for this particular operation. -type OperationDisplay struct { - // Provider - READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". - Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - Operation *string `json:"operation,omitempty"` - // Description - READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResult a list of REST API operations supported by an Azure Resource Provider. It contains -// an URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of operations supported by the resource provider - Value *[]Operation `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of operation list results (if there are any). - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// OperationStatus the current status of an async operation -type OperationStatus struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Fully qualified ID for the operation status. - ID *string `json:"id,omitempty"` - // Status - READ-ONLY; Provisioning state of the resource. Possible values include: 'StatusSucceeded', 'StatusFailed', 'StatusCanceled', 'StatusCreating', 'StatusDeleting', 'StatusMoving' - Status Status `json:"status,omitempty"` - // StartTime - READ-ONLY; The start time of the operation - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; The end time of the operation - EndTime *date.Time `json:"endTime,omitempty"` - // PercentComplete - READ-ONLY; Percent of the operation that is complete - PercentComplete *float64 `json:"percentComplete,omitempty"` - // ErrorResponse - Operation Error message - *ErrorResponse `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationStatus. -func (osVar OperationStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if osVar.ErrorResponse != nil { - objectMap["error"] = osVar.ErrorResponse - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationStatus struct. -func (osVar *OperationStatus) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - osVar.ID = &ID - } - case "status": - if v != nil { - var status Status - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - osVar.Status = status - } - case "startTime": - if v != nil { - var startTime date.Time - err = json.Unmarshal(*v, &startTime) - if err != nil { - return err - } - osVar.StartTime = &startTime - } - case "endTime": - if v != nil { - var endTime date.Time - err = json.Unmarshal(*v, &endTime) - if err != nil { - return err - } - osVar.EndTime = &endTime - } - case "percentComplete": - if v != nil { - var percentComplete float64 - err = json.Unmarshal(*v, &percentComplete) - if err != nil { - return err - } - osVar.PercentComplete = &percentComplete - } - case "error": - if v != nil { - var errorResponse ErrorResponse - err = json.Unmarshal(*v, &errorResponse) - if err != nil { - return err - } - osVar.ErrorResponse = &errorResponse - } - } - } - - return nil -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RegenerateKeyParameters parameters describes the request to regenerate access keys -type RegenerateKeyParameters struct { - // KeyType - The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary' - KeyType KeyType `json:"keyType,omitempty"` -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServiceCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceCreateOrUpdateFuture.Result. -func (future *ServiceCreateOrUpdateFuture) result(client ServiceClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("communication.ServiceCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.CreateOrUpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceDeleteFuture.Result. -func (future *ServiceDeleteFuture) result(client ServiceClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("communication.ServiceDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServiceKeys a class representing the access keys of a CommunicationService. -type ServiceKeys struct { - autorest.Response `json:"-"` - // PrimaryKey - The primary access key. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - The secondary access key. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // PrimaryConnectionString - CommunicationService connection string constructed via the primaryKey - PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` - // SecondaryConnectionString - CommunicationService connection string constructed via the secondaryKey - SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` -} - -// ServiceProperties a class that describes the properties of the CommunicationService. -type ServiceProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // HostName - READ-ONLY; FQDN of the CommunicationService instance. - HostName *string `json:"hostName,omitempty"` - // DataLocation - The location where the communication service stores its data at rest. - DataLocation *string `json:"dataLocation,omitempty"` - // NotificationHubID - READ-ONLY; Resource ID of an Azure Notification Hub linked to this resource. - NotificationHubID *string `json:"notificationHubId,omitempty"` - // Version - READ-ONLY; Version of the CommunicationService resource. Probably you need the same or higher version of client SDKs. - Version *string `json:"version,omitempty"` - // ImmutableResourceID - READ-ONLY; The immutable resource Id of the communication service. - ImmutableResourceID *string `json:"immutableResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceProperties. -func (sp ServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.DataLocation != nil { - objectMap["dataLocation"] = sp.DataLocation - } - return json.Marshal(objectMap) -} - -// ServiceResource a class representing a CommunicationService resource. -type ServiceResource struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` - // Location - The Azure location where the CommunicationService is running. - Location *string `json:"location,omitempty"` - // Tags - Tags of the service which is a list of key value pairs that describe the resource. - Tags map[string]*string `json:"tags"` - // ServiceProperties - The properties of the service. - *ServiceProperties `json:"properties,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceResource. -func (sr ServiceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Location != nil { - objectMap["location"] = sr.Location - } - if sr.Tags != nil { - objectMap["tags"] = sr.Tags - } - if sr.ServiceProperties != nil { - objectMap["properties"] = sr.ServiceProperties - } - if sr.SystemData != nil { - objectMap["systemData"] = sr.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServiceResource struct. -func (sr *ServiceResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sr.Tags = tags - } - case "properties": - if v != nil { - var serviceProperties ServiceProperties - err = json.Unmarshal(*v, &serviceProperties) - if err != nil { - return err - } - sr.ServiceProperties = &serviceProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sr.SystemData = &systemData - } - } - } - - return nil -} - -// ServiceResourceList object that includes an array of CommunicationServices and a possible link for next -// set. -type ServiceResourceList struct { - autorest.Response `json:"-"` - // Value - List of CommunicationService - Value *[]ServiceResource `json:"value,omitempty"` - // NextLink - The URL the client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// ServiceResourceListIterator provides access to a complete listing of ServiceResource values. -type ServiceResourceListIterator struct { - i int - page ServiceResourceListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServiceResourceListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServiceResourceListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServiceResourceListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServiceResourceListIterator) Response() ServiceResourceList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServiceResourceListIterator) Value() ServiceResource { - if !iter.page.NotDone() { - return ServiceResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServiceResourceListIterator type. -func NewServiceResourceListIterator(page ServiceResourceListPage) ServiceResourceListIterator { - return ServiceResourceListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (srl ServiceResourceList) IsEmpty() bool { - return srl.Value == nil || len(*srl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (srl ServiceResourceList) hasNextLink() bool { - return srl.NextLink != nil && len(*srl.NextLink) != 0 -} - -// serviceResourceListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (srl ServiceResourceList) serviceResourceListPreparer(ctx context.Context) (*http.Request, error) { - if !srl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(srl.NextLink))) -} - -// ServiceResourceListPage contains a page of ServiceResource values. -type ServiceResourceListPage struct { - fn func(context.Context, ServiceResourceList) (ServiceResourceList, error) - srl ServiceResourceList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServiceResourceListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.srl) - if err != nil { - return err - } - page.srl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServiceResourceListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServiceResourceListPage) NotDone() bool { - return !page.srl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServiceResourceListPage) Response() ServiceResourceList { - return page.srl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServiceResourceListPage) Values() []ServiceResource { - if page.srl.IsEmpty() { - return nil - } - return *page.srl.Value -} - -// Creates a new instance of the ServiceResourceListPage type. -func NewServiceResourceListPage(cur ServiceResourceList, getNextPage func(context.Context, ServiceResourceList) (ServiceResourceList, error)) ServiceResourceListPage { - return ServiceResourceListPage{ - fn: getNextPage, - srl: cur, - } -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TaggedResource an ARM resource with that can accept tags -type TaggedResource struct { - // Tags - Tags of the service which is a list of key value pairs that describe the resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TaggedResource. -func (tr TaggedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - return json.Marshal(objectMap) -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/operations.go deleted file mode 100644 index 6930a035b0d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package communication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the REST API for Azure Communication Services -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available REST API operations of the Microsoft.Communication provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "communication.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-08-20" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Communication/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "communication.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "communication.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/operationstatuses.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/operationstatuses.go deleted file mode 100644 index b824b918450..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/operationstatuses.go +++ /dev/null @@ -1,107 +0,0 @@ -package communication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationStatusesClient is the REST API for Azure Communication Services -type OperationStatusesClient struct { - BaseClient -} - -// NewOperationStatusesClient creates an instance of the OperationStatusesClient client. -func NewOperationStatusesClient(subscriptionID string) OperationStatusesClient { - return NewOperationStatusesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationStatusesClientWithBaseURI creates an instance of the OperationStatusesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewOperationStatusesClientWithBaseURI(baseURI string, subscriptionID string) OperationStatusesClient { - return OperationStatusesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the current status of an async operation. -// Parameters: -// location - the Azure region -// operationID - the ID of an ongoing async operation -func (client OperationStatusesClient) Get(ctx context.Context, location string, operationID string) (result OperationStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, location, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.OperationStatusesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "communication.OperationStatusesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.OperationStatusesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client OperationStatusesClient) GetPreparer(ctx context.Context, location string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "operationId": autorest.Encode("path", operationID), - } - - const APIVersion = "2020-08-20" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Communication/locations/{location}/operationStatuses/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client OperationStatusesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client OperationStatusesClient) GetResponder(resp *http.Response) (result OperationStatus, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/service.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/service.go deleted file mode 100644 index 228406ef801..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/service.go +++ /dev/null @@ -1,1039 +0,0 @@ -package communication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServiceClient is the REST API for Azure Communication Services -type ServiceClient struct { - BaseClient -} - -// NewServiceClient creates an instance of the ServiceClient client. -func NewServiceClient(subscriptionID string) ServiceClient { - return NewServiceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServiceClientWithBaseURI creates an instance of the ServiceClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewServiceClientWithBaseURI(baseURI string, subscriptionID string) ServiceClient { - return ServiceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks that the CommunicationService name is valid and is not already in use. -// Parameters: -// nameAvailabilityParameters - parameters supplied to the operation. -func (client ServiceClient) CheckNameAvailability(ctx context.Context, nameAvailabilityParameters *NameAvailabilityParameters) (result NameAvailability, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: nameAvailabilityParameters, - Constraints: []validation.Constraint{{Target: "nameAvailabilityParameters", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "nameAvailabilityParameters.Type", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "nameAvailabilityParameters.Name", Name: validation.Null, Rule: true, Chain: nil}, - }}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("communication.ServiceClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, nameAvailabilityParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ServiceClient) CheckNameAvailabilityPreparer(ctx context.Context, nameAvailabilityParameters *NameAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-08-20" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if nameAvailabilityParameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(nameAvailabilityParameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client ServiceClient) CheckNameAvailabilityResponder(resp *http.Response) (result NameAvailability, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate create a new CommunicationService or update an existing CommunicationService. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// communicationServiceName - the name of the CommunicationService resource. -// parameters - parameters for the create or update operation -func (client ServiceClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, communicationServiceName string, parameters *ServiceResource) (result ServiceCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.DataLocation", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: communicationServiceName, - Constraints: []validation.Constraint{{Target: "communicationServiceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "communicationServiceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "communicationServiceName", Name: validation.Pattern, Rule: `^[-\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("communication.ServiceClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, communicationServiceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServiceClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, communicationServiceName string, parameters *ServiceResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "communicationServiceName": autorest.Encode("path", communicationServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-08-20" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Name = nil - parameters.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) CreateOrUpdateSender(req *http.Request) (future ServiceCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServiceClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete operation to delete a CommunicationService. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// communicationServiceName - the name of the CommunicationService resource. -func (client ServiceClient) Delete(ctx context.Context, resourceGroupName string, communicationServiceName string) (result ServiceDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: communicationServiceName, - Constraints: []validation.Constraint{{Target: "communicationServiceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "communicationServiceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "communicationServiceName", Name: validation.Pattern, Rule: `^[-\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("communication.ServiceClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, communicationServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServiceClient) DeletePreparer(ctx context.Context, resourceGroupName string, communicationServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "communicationServiceName": autorest.Encode("path", communicationServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-08-20" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) DeleteSender(req *http.Request) (future ServiceDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServiceClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the CommunicationService and its properties. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// communicationServiceName - the name of the CommunicationService resource. -func (client ServiceClient) Get(ctx context.Context, resourceGroupName string, communicationServiceName string) (result ServiceResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: communicationServiceName, - Constraints: []validation.Constraint{{Target: "communicationServiceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "communicationServiceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "communicationServiceName", Name: validation.Pattern, Rule: `^[-\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("communication.ServiceClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, communicationServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServiceClient) GetPreparer(ctx context.Context, resourceGroupName string, communicationServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "communicationServiceName": autorest.Encode("path", communicationServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-08-20" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServiceClient) GetResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// LinkNotificationHub links an Azure Notification Hub to this communication service. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// communicationServiceName - the name of the CommunicationService resource. -// linkNotificationHubParameters - parameters supplied to the operation. -func (client ServiceClient) LinkNotificationHub(ctx context.Context, resourceGroupName string, communicationServiceName string, linkNotificationHubParameters *LinkNotificationHubParameters) (result LinkedNotificationHub, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.LinkNotificationHub") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: linkNotificationHubParameters, - Constraints: []validation.Constraint{{Target: "linkNotificationHubParameters", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "linkNotificationHubParameters.ResourceID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "linkNotificationHubParameters.ConnectionString", Name: validation.Null, Rule: true, Chain: nil}, - }}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: communicationServiceName, - Constraints: []validation.Constraint{{Target: "communicationServiceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "communicationServiceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "communicationServiceName", Name: validation.Pattern, Rule: `^[-\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("communication.ServiceClient", "LinkNotificationHub", err.Error()) - } - - req, err := client.LinkNotificationHubPreparer(ctx, resourceGroupName, communicationServiceName, linkNotificationHubParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "LinkNotificationHub", nil, "Failure preparing request") - return - } - - resp, err := client.LinkNotificationHubSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "LinkNotificationHub", resp, "Failure sending request") - return - } - - result, err = client.LinkNotificationHubResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "LinkNotificationHub", resp, "Failure responding to request") - return - } - - return -} - -// LinkNotificationHubPreparer prepares the LinkNotificationHub request. -func (client ServiceClient) LinkNotificationHubPreparer(ctx context.Context, resourceGroupName string, communicationServiceName string, linkNotificationHubParameters *LinkNotificationHubParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "communicationServiceName": autorest.Encode("path", communicationServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-08-20" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/linkNotificationHub", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if linkNotificationHubParameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(linkNotificationHubParameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// LinkNotificationHubSender sends the LinkNotificationHub request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) LinkNotificationHubSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// LinkNotificationHubResponder handles the response to the LinkNotificationHub request. The method always -// closes the http.Response Body. -func (client ServiceClient) LinkNotificationHubResponder(resp *http.Response) (result LinkedNotificationHub, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup handles requests to list all resources in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ServiceClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServiceResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.srl.Response.Response != nil { - sc = result.srl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("communication.ServiceClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.srl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.srl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.srl.hasNextLink() && result.srl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ServiceClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-08-20" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ServiceClient) ListByResourceGroupResponder(resp *http.Response) (result ServiceResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ServiceClient) listByResourceGroupNextResults(ctx context.Context, lastResults ServiceResourceList) (result ServiceResourceList, err error) { - req, err := lastResults.serviceResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "communication.ServiceClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "communication.ServiceClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServiceClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ServiceResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription handles requests to list all resources in a subscription. -func (client ServiceClient) ListBySubscription(ctx context.Context) (result ServiceResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ListBySubscription") - defer func() { - sc := -1 - if result.srl.Response.Response != nil { - sc = result.srl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("communication.ServiceClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.srl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.srl, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.srl.hasNextLink() && result.srl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ServiceClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-08-20" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Communication/communicationServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client ServiceClient) ListBySubscriptionResponder(resp *http.Response) (result ServiceResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client ServiceClient) listBySubscriptionNextResults(ctx context.Context, lastResults ServiceResourceList) (result ServiceResourceList, err error) { - req, err := lastResults.serviceResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "communication.ServiceClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "communication.ServiceClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServiceClient) ListBySubscriptionComplete(ctx context.Context) (result ServiceResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// ListKeys get the access keys of the CommunicationService resource. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// communicationServiceName - the name of the CommunicationService resource. -func (client ServiceClient) ListKeys(ctx context.Context, resourceGroupName string, communicationServiceName string) (result ServiceKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.ListKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: communicationServiceName, - Constraints: []validation.Constraint{{Target: "communicationServiceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "communicationServiceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "communicationServiceName", Name: validation.Pattern, Rule: `^[-\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("communication.ServiceClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, communicationServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client ServiceClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, communicationServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "communicationServiceName": autorest.Encode("path", communicationServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-08-20" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client ServiceClient) ListKeysResponder(resp *http.Response) (result ServiceKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the -// same time. -// Parameters: -// parameters - parameter that describes the Regenerate Key Operation. -// resourceGroupName - the name of the resource group. The name is case insensitive. -// communicationServiceName - the name of the CommunicationService resource. -func (client ServiceClient) RegenerateKey(ctx context.Context, parameters RegenerateKeyParameters, resourceGroupName string, communicationServiceName string) (result ServiceKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.RegenerateKey") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: communicationServiceName, - Constraints: []validation.Constraint{{Target: "communicationServiceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "communicationServiceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "communicationServiceName", Name: validation.Pattern, Rule: `^[-\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("communication.ServiceClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, parameters, resourceGroupName, communicationServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client ServiceClient) RegenerateKeyPreparer(ctx context.Context, parameters RegenerateKeyParameters, resourceGroupName string, communicationServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "communicationServiceName": autorest.Encode("path", communicationServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-08-20" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/regenerateKey", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateKeySender sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client ServiceClient) RegenerateKeyResponder(resp *http.Response) (result ServiceKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update operation to update an existing CommunicationService. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// communicationServiceName - the name of the CommunicationService resource. -// parameters - parameters for the update operation -func (client ServiceClient) Update(ctx context.Context, resourceGroupName string, communicationServiceName string, parameters *ServiceResource) (result ServiceResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: communicationServiceName, - Constraints: []validation.Constraint{{Target: "communicationServiceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "communicationServiceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "communicationServiceName", Name: validation.Pattern, Rule: `^[-\w]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("communication.ServiceClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, communicationServiceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "communication.ServiceClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServiceClient) UpdatePreparer(ctx context.Context, resourceGroupName string, communicationServiceName string, parameters *ServiceResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "communicationServiceName": autorest.Encode("path", communicationServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-08-20" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Name = nil - parameters.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ServiceClient) UpdateResponder(resp *http.Response) (result ServiceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/version.go deleted file mode 100644 index d5a271a9bef..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package communication - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " communication/2020-08-20" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/_meta.json deleted file mode 100644 index 5bf1ae599a3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "e9a6009d8f1a98656cf5b6f1fe5809251bfa0085", - "readme": "/_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", - "tag": "package-2021-03", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/containerinstance/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/client.go deleted file mode 100644 index 48ebb63f146..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package containerinstance implements the Azure ARM Containerinstance service API version 2021-03-01. -// -// -package containerinstance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Containerinstance - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Containerinstance. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/containergroups.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/containergroups.go deleted file mode 100644 index 24edd5e539a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/containergroups.go +++ /dev/null @@ -1,844 +0,0 @@ -package containerinstance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ContainerGroupsClient is the client for the ContainerGroups methods of the Containerinstance service. -type ContainerGroupsClient struct { - BaseClient -} - -// NewContainerGroupsClient creates an instance of the ContainerGroupsClient client. -func NewContainerGroupsClient(subscriptionID string) ContainerGroupsClient { - return NewContainerGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewContainerGroupsClientWithBaseURI creates an instance of the ContainerGroupsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewContainerGroupsClientWithBaseURI(baseURI string, subscriptionID string) ContainerGroupsClient { - return ContainerGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update container groups with specified configurations. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -// containerGroup - the properties of the container group to be created or updated. -func (client ContainerGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, containerGroupName string, containerGroup ContainerGroup) (result ContainerGroupsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: containerGroup, - Constraints: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.Containers", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "containerGroup.ContainerGroupProperties.IPAddress", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.IPAddress.Ports", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "containerGroup.ContainerGroupProperties.Diagnostics", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.Diagnostics.LogAnalytics", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.Diagnostics.LogAnalytics.WorkspaceID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "containerGroup.ContainerGroupProperties.Diagnostics.LogAnalytics.WorkspaceKey", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - {Target: "containerGroup.ContainerGroupProperties.NetworkProfile", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.NetworkProfile.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "containerGroup.ContainerGroupProperties.DNSConfig", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.DNSConfig.NameServers", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "containerGroup.ContainerGroupProperties.EncryptionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "containerGroup.ContainerGroupProperties.EncryptionProperties.VaultBaseURL", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "containerGroup.ContainerGroupProperties.EncryptionProperties.KeyName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "containerGroup.ContainerGroupProperties.EncryptionProperties.KeyVersion", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("containerinstance.ContainerGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, containerGroupName, containerGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ContainerGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, containerGroupName string, containerGroup ContainerGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}", pathParameters), - autorest.WithJSON(containerGroup), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerGroupsClient) CreateOrUpdateSender(req *http.Request) (future ContainerGroupsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ContainerGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ContainerGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the specified container group in the specified subscription and resource group. The operation does not -// delete other resources provided by the user, such as volumes. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -func (client ContainerGroupsClient) Delete(ctx context.Context, resourceGroupName string, containerGroupName string) (result ContainerGroupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, containerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ContainerGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerGroupsClient) DeleteSender(req *http.Request) (future ContainerGroupsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ContainerGroupsClient) DeleteResponder(resp *http.Response) (result ContainerGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the properties of the specified container group in the specified subscription and resource group. The -// operation returns the properties of each container group including containers, image registry credentials, restart -// policy, IP address type, OS type, state, and volumes. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -func (client ContainerGroupsClient) Get(ctx context.Context, resourceGroupName string, containerGroupName string) (result ContainerGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, containerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ContainerGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerGroupsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ContainerGroupsClient) GetResponder(resp *http.Response) (result ContainerGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get a list of container groups in the specified subscription. This operation returns properties of each -// container group including containers, image registry credentials, restart policy, IP address type, OS type, state, -// and volumes. -func (client ContainerGroupsClient) List(ctx context.Context) (result ContainerGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.List") - defer func() { - sc := -1 - if result.cglr.Response.Response != nil { - sc = result.cglr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.cglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "List", resp, "Failure sending request") - return - } - - result.cglr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "List", resp, "Failure responding to request") - return - } - if result.cglr.hasNextLink() && result.cglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ContainerGroupsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerGroupsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ContainerGroupsClient) ListResponder(resp *http.Response) (result ContainerGroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ContainerGroupsClient) listNextResults(ctx context.Context, lastResults ContainerGroupListResult) (result ContainerGroupListResult, err error) { - req, err := lastResults.containerGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ContainerGroupsClient) ListComplete(ctx context.Context) (result ContainerGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup get a list of container groups in a specified subscription and resource group. This operation -// returns properties of each container group including containers, image registry credentials, restart policy, IP -// address type, OS type, state, and volumes. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client ContainerGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ContainerGroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.cglr.Response.Response != nil { - sc = result.cglr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.cglr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.cglr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.cglr.hasNextLink() && result.cglr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ContainerGroupsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerGroupsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ContainerGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ContainerGroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ContainerGroupsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ContainerGroupListResult) (result ContainerGroupListResult, err error) { - req, err := lastResults.containerGroupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ContainerGroupsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ContainerGroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// Restart restarts all containers in a container group in place. If container image has updates, new image will be -// downloaded. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -func (client ContainerGroupsClient) Restart(ctx context.Context, resourceGroupName string, containerGroupName string) (result ContainerGroupsRestartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Restart") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RestartPreparer(ctx, resourceGroupName, containerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", nil, "Failure preparing request") - return - } - - result, err = client.RestartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Restart", result.Response(), "Failure sending request") - return - } - - return -} - -// RestartPreparer prepares the Restart request. -func (client ContainerGroupsClient) RestartPreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/restart", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RestartSender sends the Restart request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerGroupsClient) RestartSender(req *http.Request) (future ContainerGroupsRestartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RestartResponder handles the response to the Restart request. The method always -// closes the http.Response Body. -func (client ContainerGroupsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Start starts all containers in a container group. Compute resources will be allocated and billing will start. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -func (client ContainerGroupsClient) Start(ctx context.Context, resourceGroupName string, containerGroupName string) (result ContainerGroupsStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Start") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.StartPreparer(ctx, resourceGroupName, containerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client ContainerGroupsClient) StartPreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerGroupsClient) StartSender(req *http.Request) (future ContainerGroupsStartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client ContainerGroupsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stops all containers in a container group. Compute resources will be deallocated and billing will stop. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -func (client ContainerGroupsClient) Stop(ctx context.Context, resourceGroupName string, containerGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Stop") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.StopPreparer(ctx, resourceGroupName, containerGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Stop", nil, "Failure preparing request") - return - } - - resp, err := client.StopSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Stop", resp, "Failure sending request") - return - } - - result, err = client.StopResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Stop", resp, "Failure responding to request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client ContainerGroupsClient) StopPreparer(ctx context.Context, resourceGroupName string, containerGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerGroupsClient) StopSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client ContainerGroupsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates container group tags with specified values. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -// resource - the container group resource with just the tags to be updated. -func (client ContainerGroupsClient) Update(ctx context.Context, resourceGroupName string, containerGroupName string, resource Resource) (result ContainerGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, containerGroupName, resource) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ContainerGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, containerGroupName string, resource Resource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - resource.ID = nil - resource.Name = nil - resource.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}", pathParameters), - autorest.WithJSON(resource), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ContainerGroupsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ContainerGroupsClient) UpdateResponder(resp *http.Response) (result ContainerGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/containers.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/containers.go deleted file mode 100644 index 8fbdcba24fb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/containers.go +++ /dev/null @@ -1,280 +0,0 @@ -package containerinstance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ContainersClient is the client for the Containers methods of the Containerinstance service. -type ContainersClient struct { - BaseClient -} - -// NewContainersClient creates an instance of the ContainersClient client. -func NewContainersClient(subscriptionID string) ContainersClient { - return NewContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewContainersClientWithBaseURI creates an instance of the ContainersClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewContainersClientWithBaseURI(baseURI string, subscriptionID string) ContainersClient { - return ContainersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Attach attach to the output stream of a specific container instance in a specified resource group and container -// group. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -// containerName - the name of the container instance. -func (client ContainersClient) Attach(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string) (result ContainerAttachResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainersClient.Attach") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.AttachPreparer(ctx, resourceGroupName, containerGroupName, containerName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "Attach", nil, "Failure preparing request") - return - } - - resp, err := client.AttachSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "Attach", resp, "Failure sending request") - return - } - - result, err = client.AttachResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "Attach", resp, "Failure responding to request") - return - } - - return -} - -// AttachPreparer prepares the Attach request. -func (client ContainersClient) AttachPreparer(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "containerName": autorest.Encode("path", containerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/attach", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AttachSender sends the Attach request. The method will close the -// http.Response Body if it receives an error. -func (client ContainersClient) AttachSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// AttachResponder handles the response to the Attach request. The method always -// closes the http.Response Body. -func (client ContainersClient) AttachResponder(resp *http.Response) (result ContainerAttachResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ExecuteCommand executes a command for a specific container instance in a specified resource group and container -// group. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -// containerName - the name of the container instance. -// containerExecRequest - the request for the exec command. -func (client ContainersClient) ExecuteCommand(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string, containerExecRequest ContainerExecRequest) (result ContainerExecResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainersClient.ExecuteCommand") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ExecuteCommandPreparer(ctx, resourceGroupName, containerGroupName, containerName, containerExecRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ExecuteCommand", nil, "Failure preparing request") - return - } - - resp, err := client.ExecuteCommandSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ExecuteCommand", resp, "Failure sending request") - return - } - - result, err = client.ExecuteCommandResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ExecuteCommand", resp, "Failure responding to request") - return - } - - return -} - -// ExecuteCommandPreparer prepares the ExecuteCommand request. -func (client ContainersClient) ExecuteCommandPreparer(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string, containerExecRequest ContainerExecRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "containerName": autorest.Encode("path", containerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec", pathParameters), - autorest.WithJSON(containerExecRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExecuteCommandSender sends the ExecuteCommand request. The method will close the -// http.Response Body if it receives an error. -func (client ContainersClient) ExecuteCommandSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExecuteCommandResponder handles the response to the ExecuteCommand request. The method always -// closes the http.Response Body. -func (client ContainersClient) ExecuteCommandResponder(resp *http.Response) (result ContainerExecResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListLogs get the logs for a specified container instance in a specified resource group and container group. -// Parameters: -// resourceGroupName - the name of the resource group. -// containerGroupName - the name of the container group. -// containerName - the name of the container instance. -// tail - the number of lines to show from the tail of the container instance log. If not provided, all -// available logs are shown up to 4mb. -// timestamps - if true, adds a timestamp at the beginning of every line of log output. If not provided, -// defaults to false. -func (client ContainersClient) ListLogs(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string, tail *int32, timestamps *bool) (result Logs, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainersClient.ListLogs") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListLogsPreparer(ctx, resourceGroupName, containerGroupName, containerName, tail, timestamps) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ListLogs", nil, "Failure preparing request") - return - } - - resp, err := client.ListLogsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ListLogs", resp, "Failure sending request") - return - } - - result, err = client.ListLogsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainersClient", "ListLogs", resp, "Failure responding to request") - return - } - - return -} - -// ListLogsPreparer prepares the ListLogs request. -func (client ContainersClient) ListLogsPreparer(ctx context.Context, resourceGroupName string, containerGroupName string, containerName string, tail *int32, timestamps *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "containerGroupName": autorest.Encode("path", containerGroupName), - "containerName": autorest.Encode("path", containerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if tail != nil { - queryParameters["tail"] = autorest.Encode("query", *tail) - } - if timestamps != nil { - queryParameters["timestamps"] = autorest.Encode("query", *timestamps) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListLogsSender sends the ListLogs request. The method will close the -// http.Response Body if it receives an error. -func (client ContainersClient) ListLogsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListLogsResponder handles the response to the ListLogs request. The method always -// closes the http.Response Body. -func (client ContainersClient) ListLogsResponder(resp *http.Response) (result Logs, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/enums.go deleted file mode 100644 index 9396340601e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/enums.go +++ /dev/null @@ -1,180 +0,0 @@ -package containerinstance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ContainerGroupIPAddressType enumerates the values for container group ip address type. -type ContainerGroupIPAddressType string - -const ( - // ContainerGroupIPAddressTypePrivate ... - ContainerGroupIPAddressTypePrivate ContainerGroupIPAddressType = "Private" - // ContainerGroupIPAddressTypePublic ... - ContainerGroupIPAddressTypePublic ContainerGroupIPAddressType = "Public" -) - -// PossibleContainerGroupIPAddressTypeValues returns an array of possible values for the ContainerGroupIPAddressType const type. -func PossibleContainerGroupIPAddressTypeValues() []ContainerGroupIPAddressType { - return []ContainerGroupIPAddressType{ContainerGroupIPAddressTypePrivate, ContainerGroupIPAddressTypePublic} -} - -// ContainerGroupNetworkProtocol enumerates the values for container group network protocol. -type ContainerGroupNetworkProtocol string - -const ( - // ContainerGroupNetworkProtocolTCP ... - ContainerGroupNetworkProtocolTCP ContainerGroupNetworkProtocol = "TCP" - // ContainerGroupNetworkProtocolUDP ... - ContainerGroupNetworkProtocolUDP ContainerGroupNetworkProtocol = "UDP" -) - -// PossibleContainerGroupNetworkProtocolValues returns an array of possible values for the ContainerGroupNetworkProtocol const type. -func PossibleContainerGroupNetworkProtocolValues() []ContainerGroupNetworkProtocol { - return []ContainerGroupNetworkProtocol{ContainerGroupNetworkProtocolTCP, ContainerGroupNetworkProtocolUDP} -} - -// ContainerGroupRestartPolicy enumerates the values for container group restart policy. -type ContainerGroupRestartPolicy string - -const ( - // ContainerGroupRestartPolicyAlways ... - ContainerGroupRestartPolicyAlways ContainerGroupRestartPolicy = "Always" - // ContainerGroupRestartPolicyNever ... - ContainerGroupRestartPolicyNever ContainerGroupRestartPolicy = "Never" - // ContainerGroupRestartPolicyOnFailure ... - ContainerGroupRestartPolicyOnFailure ContainerGroupRestartPolicy = "OnFailure" -) - -// PossibleContainerGroupRestartPolicyValues returns an array of possible values for the ContainerGroupRestartPolicy const type. -func PossibleContainerGroupRestartPolicyValues() []ContainerGroupRestartPolicy { - return []ContainerGroupRestartPolicy{ContainerGroupRestartPolicyAlways, ContainerGroupRestartPolicyNever, ContainerGroupRestartPolicyOnFailure} -} - -// ContainerGroupSku enumerates the values for container group sku. -type ContainerGroupSku string - -const ( - // ContainerGroupSkuDedicated ... - ContainerGroupSkuDedicated ContainerGroupSku = "Dedicated" - // ContainerGroupSkuStandard ... - ContainerGroupSkuStandard ContainerGroupSku = "Standard" -) - -// PossibleContainerGroupSkuValues returns an array of possible values for the ContainerGroupSku const type. -func PossibleContainerGroupSkuValues() []ContainerGroupSku { - return []ContainerGroupSku{ContainerGroupSkuDedicated, ContainerGroupSkuStandard} -} - -// ContainerNetworkProtocol enumerates the values for container network protocol. -type ContainerNetworkProtocol string - -const ( - // ContainerNetworkProtocolTCP ... - ContainerNetworkProtocolTCP ContainerNetworkProtocol = "TCP" - // ContainerNetworkProtocolUDP ... - ContainerNetworkProtocolUDP ContainerNetworkProtocol = "UDP" -) - -// PossibleContainerNetworkProtocolValues returns an array of possible values for the ContainerNetworkProtocol const type. -func PossibleContainerNetworkProtocolValues() []ContainerNetworkProtocol { - return []ContainerNetworkProtocol{ContainerNetworkProtocolTCP, ContainerNetworkProtocolUDP} -} - -// GpuSku enumerates the values for gpu sku. -type GpuSku string - -const ( - // GpuSkuK80 ... - GpuSkuK80 GpuSku = "K80" - // GpuSkuP100 ... - GpuSkuP100 GpuSku = "P100" - // GpuSkuV100 ... - GpuSkuV100 GpuSku = "V100" -) - -// PossibleGpuSkuValues returns an array of possible values for the GpuSku const type. -func PossibleGpuSkuValues() []GpuSku { - return []GpuSku{GpuSkuK80, GpuSkuP100, GpuSkuV100} -} - -// LogAnalyticsLogType enumerates the values for log analytics log type. -type LogAnalyticsLogType string - -const ( - // LogAnalyticsLogTypeContainerInsights ... - LogAnalyticsLogTypeContainerInsights LogAnalyticsLogType = "ContainerInsights" - // LogAnalyticsLogTypeContainerInstanceLogs ... - LogAnalyticsLogTypeContainerInstanceLogs LogAnalyticsLogType = "ContainerInstanceLogs" -) - -// PossibleLogAnalyticsLogTypeValues returns an array of possible values for the LogAnalyticsLogType const type. -func PossibleLogAnalyticsLogTypeValues() []LogAnalyticsLogType { - return []LogAnalyticsLogType{LogAnalyticsLogTypeContainerInsights, LogAnalyticsLogTypeContainerInstanceLogs} -} - -// OperatingSystemTypes enumerates the values for operating system types. -type OperatingSystemTypes string - -const ( - // OperatingSystemTypesLinux ... - OperatingSystemTypesLinux OperatingSystemTypes = "Linux" - // OperatingSystemTypesWindows ... - OperatingSystemTypesWindows OperatingSystemTypes = "Windows" -) - -// PossibleOperatingSystemTypesValues returns an array of possible values for the OperatingSystemTypes const type. -func PossibleOperatingSystemTypesValues() []OperatingSystemTypes { - return []OperatingSystemTypes{OperatingSystemTypesLinux, OperatingSystemTypesWindows} -} - -// OperationsOrigin enumerates the values for operations origin. -type OperationsOrigin string - -const ( - // OperationsOriginSystem ... - OperationsOriginSystem OperationsOrigin = "System" - // OperationsOriginUser ... - OperationsOriginUser OperationsOrigin = "User" -) - -// PossibleOperationsOriginValues returns an array of possible values for the OperationsOrigin const type. -func PossibleOperationsOriginValues() []OperationsOrigin { - return []OperationsOrigin{OperationsOriginSystem, OperationsOriginUser} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone ... - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeSystemAssignedUserAssigned ... - ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" - // ResourceIdentityTypeUserAssigned ... - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} -} - -// Scheme enumerates the values for scheme. -type Scheme string - -const ( - // SchemeHTTP ... - SchemeHTTP Scheme = "http" - // SchemeHTTPS ... - SchemeHTTPS Scheme = "https" -) - -// PossibleSchemeValues returns an array of possible values for the Scheme const type. -func PossibleSchemeValues() []Scheme { - return []Scheme{SchemeHTTP, SchemeHTTPS} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/location.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/location.go deleted file mode 100644 index c9c64af27a6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/location.go +++ /dev/null @@ -1,337 +0,0 @@ -package containerinstance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LocationClient is the client for the Location methods of the Containerinstance service. -type LocationClient struct { - BaseClient -} - -// NewLocationClient creates an instance of the LocationClient client. -func NewLocationClient(subscriptionID string) LocationClient { - return NewLocationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLocationClientWithBaseURI creates an instance of the LocationClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewLocationClientWithBaseURI(baseURI string, subscriptionID string) LocationClient { - return LocationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListCachedImages get the list of cached images on specific OS type for a subscription in a region. -// Parameters: -// location - the identifier for the physical azure location. -func (client LocationClient) ListCachedImages(ctx context.Context, location string) (result CachedImagesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListCachedImages") - defer func() { - sc := -1 - if result.cilr.Response.Response != nil { - sc = result.cilr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listCachedImagesNextResults - req, err := client.ListCachedImagesPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCachedImages", nil, "Failure preparing request") - return - } - - resp, err := client.ListCachedImagesSender(req) - if err != nil { - result.cilr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCachedImages", resp, "Failure sending request") - return - } - - result.cilr, err = client.ListCachedImagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCachedImages", resp, "Failure responding to request") - return - } - if result.cilr.hasNextLink() && result.cilr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListCachedImagesPreparer prepares the ListCachedImages request. -func (client LocationClient) ListCachedImagesPreparer(ctx context.Context, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/cachedImages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCachedImagesSender sends the ListCachedImages request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) ListCachedImagesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCachedImagesResponder handles the response to the ListCachedImages request. The method always -// closes the http.Response Body. -func (client LocationClient) ListCachedImagesResponder(resp *http.Response) (result CachedImagesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listCachedImagesNextResults retrieves the next set of results, if any. -func (client LocationClient) listCachedImagesNextResults(ctx context.Context, lastResults CachedImagesListResult) (result CachedImagesListResult, err error) { - req, err := lastResults.cachedImagesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCachedImagesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListCachedImagesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCachedImagesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListCachedImagesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCachedImagesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListCachedImagesComplete enumerates all values, automatically crossing page boundaries as required. -func (client LocationClient) ListCachedImagesComplete(ctx context.Context, location string) (result CachedImagesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListCachedImages") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListCachedImages(ctx, location) - return -} - -// ListCapabilities get the list of CPU/memory/GPU capabilities of a region. -// Parameters: -// location - the identifier for the physical azure location. -func (client LocationClient) ListCapabilities(ctx context.Context, location string) (result CapabilitiesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListCapabilities") - defer func() { - sc := -1 - if result.clr.Response.Response != nil { - sc = result.clr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listCapabilitiesNextResults - req, err := client.ListCapabilitiesPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCapabilities", nil, "Failure preparing request") - return - } - - resp, err := client.ListCapabilitiesSender(req) - if err != nil { - result.clr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCapabilities", resp, "Failure sending request") - return - } - - result.clr, err = client.ListCapabilitiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListCapabilities", resp, "Failure responding to request") - return - } - if result.clr.hasNextLink() && result.clr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListCapabilitiesPreparer prepares the ListCapabilities request. -func (client LocationClient) ListCapabilitiesPreparer(ctx context.Context, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/capabilities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListCapabilitiesSender sends the ListCapabilities request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) ListCapabilitiesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListCapabilitiesResponder handles the response to the ListCapabilities request. The method always -// closes the http.Response Body. -func (client LocationClient) ListCapabilitiesResponder(resp *http.Response) (result CapabilitiesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listCapabilitiesNextResults retrieves the next set of results, if any. -func (client LocationClient) listCapabilitiesNextResults(ctx context.Context, lastResults CapabilitiesListResult) (result CapabilitiesListResult, err error) { - req, err := lastResults.capabilitiesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCapabilitiesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListCapabilitiesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCapabilitiesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListCapabilitiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "listCapabilitiesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListCapabilitiesComplete enumerates all values, automatically crossing page boundaries as required. -func (client LocationClient) ListCapabilitiesComplete(ctx context.Context, location string) (result CapabilitiesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListCapabilities") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListCapabilities(ctx, location) - return -} - -// ListUsage get the usage for a subscription -// Parameters: -// location - the identifier for the physical azure location. -func (client LocationClient) ListUsage(ctx context.Context, location string) (result UsageListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationClient.ListUsage") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListUsagePreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListUsage", nil, "Failure preparing request") - return - } - - resp, err := client.ListUsageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListUsage", resp, "Failure sending request") - return - } - - result, err = client.ListUsageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.LocationClient", "ListUsage", resp, "Failure responding to request") - return - } - - return -} - -// ListUsagePreparer prepares the ListUsage request. -func (client LocationClient) ListUsagePreparer(ctx context.Context, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/usages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUsageSender sends the ListUsage request. The method will close the -// http.Response Body if it receives an error. -func (client LocationClient) ListUsageSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListUsageResponder handles the response to the ListUsage request. The method always -// closes the http.Response Body. -func (client LocationClient) ListUsageResponder(resp *http.Response) (result UsageListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/models.go deleted file mode 100644 index 3943f3e6023..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/models.go +++ /dev/null @@ -1,1813 +0,0 @@ -package containerinstance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance" - -// AzureFileVolume the properties of the Azure File volume. Azure File shares are mounted as volumes. -type AzureFileVolume struct { - // ShareName - The name of the Azure File share to be mounted as a volume. - ShareName *string `json:"shareName,omitempty"` - // ReadOnly - The flag indicating whether the Azure File shared mounted as a volume is read-only. - ReadOnly *bool `json:"readOnly,omitempty"` - // StorageAccountName - The name of the storage account that contains the Azure File share. - StorageAccountName *string `json:"storageAccountName,omitempty"` - // StorageAccountKey - The storage account access key used to access the Azure File share. - StorageAccountKey *string `json:"storageAccountKey,omitempty"` -} - -// CachedImages the cached image and OS type. -type CachedImages struct { - // OsType - The OS type of the cached image. - OsType *string `json:"osType,omitempty"` - // Image - The cached image name. - Image *string `json:"image,omitempty"` -} - -// CachedImagesListResult the response containing cached images. -type CachedImagesListResult struct { - autorest.Response `json:"-"` - // Value - The list of cached images. - Value *[]CachedImages `json:"value,omitempty"` - // NextLink - The URI to fetch the next page of cached images. - NextLink *string `json:"nextLink,omitempty"` -} - -// CachedImagesListResultIterator provides access to a complete listing of CachedImages values. -type CachedImagesListResultIterator struct { - i int - page CachedImagesListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *CachedImagesListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CachedImagesListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *CachedImagesListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CachedImagesListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter CachedImagesListResultIterator) Response() CachedImagesListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter CachedImagesListResultIterator) Value() CachedImages { - if !iter.page.NotDone() { - return CachedImages{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CachedImagesListResultIterator type. -func NewCachedImagesListResultIterator(page CachedImagesListResultPage) CachedImagesListResultIterator { - return CachedImagesListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cilr CachedImagesListResult) IsEmpty() bool { - return cilr.Value == nil || len(*cilr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cilr CachedImagesListResult) hasNextLink() bool { - return cilr.NextLink != nil && len(*cilr.NextLink) != 0 -} - -// cachedImagesListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cilr CachedImagesListResult) cachedImagesListResultPreparer(ctx context.Context) (*http.Request, error) { - if !cilr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cilr.NextLink))) -} - -// CachedImagesListResultPage contains a page of CachedImages values. -type CachedImagesListResultPage struct { - fn func(context.Context, CachedImagesListResult) (CachedImagesListResult, error) - cilr CachedImagesListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *CachedImagesListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CachedImagesListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cilr) - if err != nil { - return err - } - page.cilr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *CachedImagesListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CachedImagesListResultPage) NotDone() bool { - return !page.cilr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CachedImagesListResultPage) Response() CachedImagesListResult { - return page.cilr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CachedImagesListResultPage) Values() []CachedImages { - if page.cilr.IsEmpty() { - return nil - } - return *page.cilr.Value -} - -// Creates a new instance of the CachedImagesListResultPage type. -func NewCachedImagesListResultPage(cur CachedImagesListResult, getNextPage func(context.Context, CachedImagesListResult) (CachedImagesListResult, error)) CachedImagesListResultPage { - return CachedImagesListResultPage{ - fn: getNextPage, - cilr: cur, - } -} - -// Capabilities the regional capabilities. -type Capabilities struct { - // ResourceType - READ-ONLY; The resource type that this capability describes. - ResourceType *string `json:"resourceType,omitempty"` - // OsType - READ-ONLY; The OS type that this capability describes. - OsType *string `json:"osType,omitempty"` - // Location - READ-ONLY; The resource location. - Location *string `json:"location,omitempty"` - // IPAddressType - READ-ONLY; The ip address type that this capability describes. - IPAddressType *string `json:"ipAddressType,omitempty"` - // Gpu - READ-ONLY; The GPU sku that this capability describes. - Gpu *string `json:"gpu,omitempty"` - // Capabilities - READ-ONLY; The supported capabilities. - Capabilities *CapabilitiesCapabilities `json:"capabilities,omitempty"` -} - -// MarshalJSON is the custom marshaler for Capabilities. -func (c Capabilities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CapabilitiesCapabilities the supported capabilities. -type CapabilitiesCapabilities struct { - // MaxMemoryInGB - READ-ONLY; The maximum allowed memory request in GB. - MaxMemoryInGB *float64 `json:"maxMemoryInGB,omitempty"` - // MaxCPU - READ-ONLY; The maximum allowed CPU request in cores. - MaxCPU *float64 `json:"maxCpu,omitempty"` - // MaxGpuCount - READ-ONLY; The maximum allowed GPU count. - MaxGpuCount *float64 `json:"maxGpuCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for CapabilitiesCapabilities. -func (c CapabilitiesCapabilities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CapabilitiesListResult the response containing list of capabilities. -type CapabilitiesListResult struct { - autorest.Response `json:"-"` - // Value - The list of capabilities. - Value *[]Capabilities `json:"value,omitempty"` - // NextLink - The URI to fetch the next page of capabilities. - NextLink *string `json:"nextLink,omitempty"` -} - -// CapabilitiesListResultIterator provides access to a complete listing of Capabilities values. -type CapabilitiesListResultIterator struct { - i int - page CapabilitiesListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *CapabilitiesListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *CapabilitiesListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CapabilitiesListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter CapabilitiesListResultIterator) Response() CapabilitiesListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter CapabilitiesListResultIterator) Value() Capabilities { - if !iter.page.NotDone() { - return Capabilities{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CapabilitiesListResultIterator type. -func NewCapabilitiesListResultIterator(page CapabilitiesListResultPage) CapabilitiesListResultIterator { - return CapabilitiesListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (clr CapabilitiesListResult) IsEmpty() bool { - return clr.Value == nil || len(*clr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (clr CapabilitiesListResult) hasNextLink() bool { - return clr.NextLink != nil && len(*clr.NextLink) != 0 -} - -// capabilitiesListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (clr CapabilitiesListResult) capabilitiesListResultPreparer(ctx context.Context) (*http.Request, error) { - if !clr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(clr.NextLink))) -} - -// CapabilitiesListResultPage contains a page of Capabilities values. -type CapabilitiesListResultPage struct { - fn func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error) - clr CapabilitiesListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *CapabilitiesListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.clr) - if err != nil { - return err - } - page.clr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *CapabilitiesListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CapabilitiesListResultPage) NotDone() bool { - return !page.clr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CapabilitiesListResultPage) Response() CapabilitiesListResult { - return page.clr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CapabilitiesListResultPage) Values() []Capabilities { - if page.clr.IsEmpty() { - return nil - } - return *page.clr.Value -} - -// Creates a new instance of the CapabilitiesListResultPage type. -func NewCapabilitiesListResultPage(cur CapabilitiesListResult, getNextPage func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error)) CapabilitiesListResultPage { - return CapabilitiesListResultPage{ - fn: getNextPage, - clr: cur, - } -} - -// CloudError an error response from the Container Instance service. -type CloudError struct { - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from the Container Instance service. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// Container a container instance. -type Container struct { - // Name - The user-provided name of the container instance. - Name *string `json:"name,omitempty"` - // ContainerProperties - The properties of the container instance. - *ContainerProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Container. -func (c Container) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.Name != nil { - objectMap["name"] = c.Name - } - if c.ContainerProperties != nil { - objectMap["properties"] = c.ContainerProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Container struct. -func (c *Container) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "properties": - if v != nil { - var containerProperties ContainerProperties - err = json.Unmarshal(*v, &containerProperties) - if err != nil { - return err - } - c.ContainerProperties = &containerProperties - } - } - } - - return nil -} - -// ContainerAttachResponse the information for the output stream from container attach. -type ContainerAttachResponse struct { - autorest.Response `json:"-"` - // WebSocketURI - The uri for the output stream from the attach. - WebSocketURI *string `json:"webSocketUri,omitempty"` - // Password - The password to the output stream from the attach. Send as an Authorization header value when connecting to the websocketUri. - Password *string `json:"password,omitempty"` -} - -// ContainerExec the container execution command, for liveness or readiness probe -type ContainerExec struct { - // Command - The commands to execute within the container. - Command *[]string `json:"command,omitempty"` -} - -// ContainerExecRequest the container exec request. -type ContainerExecRequest struct { - // Command - The command to be executed. - Command *string `json:"command,omitempty"` - // TerminalSize - The size of the terminal. - TerminalSize *ContainerExecRequestTerminalSize `json:"terminalSize,omitempty"` -} - -// ContainerExecRequestTerminalSize the size of the terminal. -type ContainerExecRequestTerminalSize struct { - // Rows - The row size of the terminal - Rows *int32 `json:"rows,omitempty"` - // Cols - The column size of the terminal - Cols *int32 `json:"cols,omitempty"` -} - -// ContainerExecResponse the information for the container exec command. -type ContainerExecResponse struct { - autorest.Response `json:"-"` - // WebSocketURI - The uri for the exec websocket. - WebSocketURI *string `json:"webSocketUri,omitempty"` - // Password - The password to start the exec command. - Password *string `json:"password,omitempty"` -} - -// ContainerGroup a container group. -type ContainerGroup struct { - autorest.Response `json:"-"` - // Identity - The identity of the container group, if configured. - Identity *ContainerGroupIdentity `json:"identity,omitempty"` - // ContainerGroupProperties - The container group properties - *ContainerGroupProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ContainerGroup. -func (cg ContainerGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cg.Identity != nil { - objectMap["identity"] = cg.Identity - } - if cg.ContainerGroupProperties != nil { - objectMap["properties"] = cg.ContainerGroupProperties - } - if cg.Location != nil { - objectMap["location"] = cg.Location - } - if cg.Tags != nil { - objectMap["tags"] = cg.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ContainerGroup struct. -func (cg *ContainerGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "identity": - if v != nil { - var identity ContainerGroupIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - cg.Identity = &identity - } - case "properties": - if v != nil { - var containerGroupProperties ContainerGroupProperties - err = json.Unmarshal(*v, &containerGroupProperties) - if err != nil { - return err - } - cg.ContainerGroupProperties = &containerGroupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cg.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - cg.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cg.Tags = tags - } - } - } - - return nil -} - -// ContainerGroupDiagnostics container group diagnostic information. -type ContainerGroupDiagnostics struct { - // LogAnalytics - Container group log analytics information. - LogAnalytics *LogAnalytics `json:"logAnalytics,omitempty"` -} - -// ContainerGroupIdentity identity for the container group. -type ContainerGroupIdentity struct { - // PrincipalID - READ-ONLY; The principal id of the container group identity. This property will only be provided for a system assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant id associated with the container group. This property will only be provided for a system assigned identity. - TenantID *string `json:"tenantId,omitempty"` - // Type - The type of identity used for the container group. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the container group. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the container group. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*ContainerGroupIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for ContainerGroupIdentity. -func (cgiVar ContainerGroupIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cgiVar.Type != "" { - objectMap["type"] = cgiVar.Type - } - if cgiVar.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = cgiVar.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// ContainerGroupIdentityUserAssignedIdentitiesValue ... -type ContainerGroupIdentityUserAssignedIdentitiesValue struct { - // PrincipalID - READ-ONLY; The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - READ-ONLY; The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerGroupIdentityUserAssignedIdentitiesValue. -func (cgiAiv ContainerGroupIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ContainerGroupListResult the container group list response that contains the container group properties. -type ContainerGroupListResult struct { - autorest.Response `json:"-"` - // Value - The list of container groups. - Value *[]ContainerGroup `json:"value,omitempty"` - // NextLink - The URI to fetch the next page of container groups. - NextLink *string `json:"nextLink,omitempty"` -} - -// ContainerGroupListResultIterator provides access to a complete listing of ContainerGroup values. -type ContainerGroupListResultIterator struct { - i int - page ContainerGroupListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ContainerGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ContainerGroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ContainerGroupListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ContainerGroupListResultIterator) Response() ContainerGroupListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ContainerGroupListResultIterator) Value() ContainerGroup { - if !iter.page.NotDone() { - return ContainerGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ContainerGroupListResultIterator type. -func NewContainerGroupListResultIterator(page ContainerGroupListResultPage) ContainerGroupListResultIterator { - return ContainerGroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cglr ContainerGroupListResult) IsEmpty() bool { - return cglr.Value == nil || len(*cglr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cglr ContainerGroupListResult) hasNextLink() bool { - return cglr.NextLink != nil && len(*cglr.NextLink) != 0 -} - -// containerGroupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cglr ContainerGroupListResult) containerGroupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !cglr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cglr.NextLink))) -} - -// ContainerGroupListResultPage contains a page of ContainerGroup values. -type ContainerGroupListResultPage struct { - fn func(context.Context, ContainerGroupListResult) (ContainerGroupListResult, error) - cglr ContainerGroupListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ContainerGroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContainerGroupListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cglr) - if err != nil { - return err - } - page.cglr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ContainerGroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ContainerGroupListResultPage) NotDone() bool { - return !page.cglr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ContainerGroupListResultPage) Response() ContainerGroupListResult { - return page.cglr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ContainerGroupListResultPage) Values() []ContainerGroup { - if page.cglr.IsEmpty() { - return nil - } - return *page.cglr.Value -} - -// Creates a new instance of the ContainerGroupListResultPage type. -func NewContainerGroupListResultPage(cur ContainerGroupListResult, getNextPage func(context.Context, ContainerGroupListResult) (ContainerGroupListResult, error)) ContainerGroupListResultPage { - return ContainerGroupListResultPage{ - fn: getNextPage, - cglr: cur, - } -} - -// ContainerGroupNetworkProfile container group network profile information. -type ContainerGroupNetworkProfile struct { - // ID - The identifier for a network profile. - ID *string `json:"id,omitempty"` -} - -// ContainerGroupProperties the container group properties -type ContainerGroupProperties struct { - // ProvisioningState - READ-ONLY; The provisioning state of the container group. This only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` - // Containers - The containers within the container group. - Containers *[]Container `json:"containers,omitempty"` - // ImageRegistryCredentials - The image registry credentials by which the container group is created from. - ImageRegistryCredentials *[]ImageRegistryCredential `json:"imageRegistryCredentials,omitempty"` - // RestartPolicy - Restart policy for all containers within the container group. - // - `Always` Always restart - // - `OnFailure` Restart on failure - // - `Never` Never restart - // . Possible values include: 'ContainerGroupRestartPolicyAlways', 'ContainerGroupRestartPolicyOnFailure', 'ContainerGroupRestartPolicyNever' - RestartPolicy ContainerGroupRestartPolicy `json:"restartPolicy,omitempty"` - // IPAddress - The IP address type of the container group. - IPAddress *IPAddress `json:"ipAddress,omitempty"` - // OsType - The operating system type required by the containers in the container group. Possible values include: 'OperatingSystemTypesWindows', 'OperatingSystemTypesLinux' - OsType OperatingSystemTypes `json:"osType,omitempty"` - // Volumes - The list of volumes that can be mounted by containers in this container group. - Volumes *[]Volume `json:"volumes,omitempty"` - // InstanceView - READ-ONLY; The instance view of the container group. Only valid in response. - InstanceView *ContainerGroupPropertiesInstanceView `json:"instanceView,omitempty"` - // Diagnostics - The diagnostic information for a container group. - Diagnostics *ContainerGroupDiagnostics `json:"diagnostics,omitempty"` - // NetworkProfile - The network profile information for a container group. - NetworkProfile *ContainerGroupNetworkProfile `json:"networkProfile,omitempty"` - // DNSConfig - The DNS config information for a container group. - DNSConfig *DNSConfiguration `json:"dnsConfig,omitempty"` - // Sku - The SKU for a container group. Possible values include: 'ContainerGroupSkuStandard', 'ContainerGroupSkuDedicated' - Sku ContainerGroupSku `json:"sku,omitempty"` - // EncryptionProperties - The encryption properties for a container group. - EncryptionProperties *EncryptionProperties `json:"encryptionProperties,omitempty"` - // InitContainers - The init containers for a container group. - InitContainers *[]InitContainerDefinition `json:"initContainers,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerGroupProperties. -func (cg ContainerGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cg.Containers != nil { - objectMap["containers"] = cg.Containers - } - if cg.ImageRegistryCredentials != nil { - objectMap["imageRegistryCredentials"] = cg.ImageRegistryCredentials - } - if cg.RestartPolicy != "" { - objectMap["restartPolicy"] = cg.RestartPolicy - } - if cg.IPAddress != nil { - objectMap["ipAddress"] = cg.IPAddress - } - if cg.OsType != "" { - objectMap["osType"] = cg.OsType - } - if cg.Volumes != nil { - objectMap["volumes"] = cg.Volumes - } - if cg.Diagnostics != nil { - objectMap["diagnostics"] = cg.Diagnostics - } - if cg.NetworkProfile != nil { - objectMap["networkProfile"] = cg.NetworkProfile - } - if cg.DNSConfig != nil { - objectMap["dnsConfig"] = cg.DNSConfig - } - if cg.Sku != "" { - objectMap["sku"] = cg.Sku - } - if cg.EncryptionProperties != nil { - objectMap["encryptionProperties"] = cg.EncryptionProperties - } - if cg.InitContainers != nil { - objectMap["initContainers"] = cg.InitContainers - } - return json.Marshal(objectMap) -} - -// ContainerGroupPropertiesInstanceView the instance view of the container group. Only valid in response. -type ContainerGroupPropertiesInstanceView struct { - // Events - READ-ONLY; The events of this container group. - Events *[]Event `json:"events,omitempty"` - // State - READ-ONLY; The state of the container group. Only valid in response. - State *string `json:"state,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerGroupPropertiesInstanceView. -func (cgV ContainerGroupPropertiesInstanceView) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ContainerGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ContainerGroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ContainerGroupsClient) (ContainerGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ContainerGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ContainerGroupsCreateOrUpdateFuture.Result. -func (future *ContainerGroupsCreateOrUpdateFuture) result(client ContainerGroupsClient) (cg ContainerGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerinstance.ContainerGroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cg.Response.Response, err = future.GetResult(sender); err == nil && cg.Response.Response.StatusCode != http.StatusNoContent { - cg, err = client.CreateOrUpdateResponder(cg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsCreateOrUpdateFuture", "Result", cg.Response.Response, "Failure responding to request") - } - } - return -} - -// ContainerGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ContainerGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ContainerGroupsClient) (ContainerGroup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ContainerGroupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ContainerGroupsDeleteFuture.Result. -func (future *ContainerGroupsDeleteFuture) result(client ContainerGroupsClient) (cg ContainerGroup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cg.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerinstance.ContainerGroupsDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cg.Response.Response, err = future.GetResult(sender); err == nil && cg.Response.Response.StatusCode != http.StatusNoContent { - cg, err = client.DeleteResponder(cg.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsDeleteFuture", "Result", cg.Response.Response, "Failure responding to request") - } - } - return -} - -// ContainerGroupsRestartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ContainerGroupsRestartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ContainerGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ContainerGroupsRestartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ContainerGroupsRestartFuture.Result. -func (future *ContainerGroupsRestartFuture) result(client ContainerGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsRestartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerinstance.ContainerGroupsRestartFuture") - return - } - ar.Response = future.Response() - return -} - -// ContainerGroupsStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ContainerGroupsStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ContainerGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ContainerGroupsStartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ContainerGroupsStartFuture.Result. -func (future *ContainerGroupsStartFuture) result(client ContainerGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.ContainerGroupsStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerinstance.ContainerGroupsStartFuture") - return - } - ar.Response = future.Response() - return -} - -// ContainerHTTPGet the container Http Get settings, for liveness or readiness probe -type ContainerHTTPGet struct { - // Path - The path to probe. - Path *string `json:"path,omitempty"` - // Port - The port number to probe. - Port *int32 `json:"port,omitempty"` - // Scheme - The scheme. Possible values include: 'SchemeHTTP', 'SchemeHTTPS' - Scheme Scheme `json:"scheme,omitempty"` - // HTTPHeaders - The HTTP headers. - HTTPHeaders *HTTPHeaders `json:"httpHeaders,omitempty"` -} - -// ContainerPort the port exposed on the container instance. -type ContainerPort struct { - // Protocol - The protocol associated with the port. Possible values include: 'ContainerNetworkProtocolTCP', 'ContainerNetworkProtocolUDP' - Protocol ContainerNetworkProtocol `json:"protocol,omitempty"` - // Port - The port number exposed within the container group. - Port *int32 `json:"port,omitempty"` -} - -// ContainerProbe the container probe, for liveness or readiness -type ContainerProbe struct { - // Exec - The execution command to probe - Exec *ContainerExec `json:"exec,omitempty"` - // HTTPGet - The Http Get settings to probe - HTTPGet *ContainerHTTPGet `json:"httpGet,omitempty"` - // InitialDelaySeconds - The initial delay seconds. - InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"` - // PeriodSeconds - The period seconds. - PeriodSeconds *int32 `json:"periodSeconds,omitempty"` - // FailureThreshold - The failure threshold. - FailureThreshold *int32 `json:"failureThreshold,omitempty"` - // SuccessThreshold - The success threshold. - SuccessThreshold *int32 `json:"successThreshold,omitempty"` - // TimeoutSeconds - The timeout seconds. - TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` -} - -// ContainerProperties the container instance properties. -type ContainerProperties struct { - // Image - The name of the image used to create the container instance. - Image *string `json:"image,omitempty"` - // Command - The commands to execute within the container instance in exec form. - Command *[]string `json:"command,omitempty"` - // Ports - The exposed ports on the container instance. - Ports *[]ContainerPort `json:"ports,omitempty"` - // EnvironmentVariables - The environment variables to set in the container instance. - EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` - // InstanceView - READ-ONLY; The instance view of the container instance. Only valid in response. - InstanceView *ContainerPropertiesInstanceView `json:"instanceView,omitempty"` - // Resources - The resource requirements of the container instance. - Resources *ResourceRequirements `json:"resources,omitempty"` - // VolumeMounts - The volume mounts available to the container instance. - VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"` - // LivenessProbe - The liveness probe. - LivenessProbe *ContainerProbe `json:"livenessProbe,omitempty"` - // ReadinessProbe - The readiness probe. - ReadinessProbe *ContainerProbe `json:"readinessProbe,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerProperties. -func (cp ContainerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Image != nil { - objectMap["image"] = cp.Image - } - if cp.Command != nil { - objectMap["command"] = cp.Command - } - if cp.Ports != nil { - objectMap["ports"] = cp.Ports - } - if cp.EnvironmentVariables != nil { - objectMap["environmentVariables"] = cp.EnvironmentVariables - } - if cp.Resources != nil { - objectMap["resources"] = cp.Resources - } - if cp.VolumeMounts != nil { - objectMap["volumeMounts"] = cp.VolumeMounts - } - if cp.LivenessProbe != nil { - objectMap["livenessProbe"] = cp.LivenessProbe - } - if cp.ReadinessProbe != nil { - objectMap["readinessProbe"] = cp.ReadinessProbe - } - return json.Marshal(objectMap) -} - -// ContainerPropertiesInstanceView the instance view of the container instance. Only valid in response. -type ContainerPropertiesInstanceView struct { - // RestartCount - READ-ONLY; The number of times that the container instance has been restarted. - RestartCount *int32 `json:"restartCount,omitempty"` - // CurrentState - READ-ONLY; Current container instance state. - CurrentState *ContainerState `json:"currentState,omitempty"` - // PreviousState - READ-ONLY; Previous container instance state. - PreviousState *ContainerState `json:"previousState,omitempty"` - // Events - READ-ONLY; The events of the container instance. - Events *[]Event `json:"events,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerPropertiesInstanceView. -func (cpV ContainerPropertiesInstanceView) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ContainerState the container instance state. -type ContainerState struct { - // State - READ-ONLY; The state of the container instance. - State *string `json:"state,omitempty"` - // StartTime - READ-ONLY; The date-time when the container instance state started. - StartTime *date.Time `json:"startTime,omitempty"` - // ExitCode - READ-ONLY; The container instance exit codes correspond to those from the `docker run` command. - ExitCode *int32 `json:"exitCode,omitempty"` - // FinishTime - READ-ONLY; The date-time when the container instance state finished. - FinishTime *date.Time `json:"finishTime,omitempty"` - // DetailStatus - READ-ONLY; The human-readable status of the container instance state. - DetailStatus *string `json:"detailStatus,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerState. -func (cs ContainerState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DNSConfiguration DNS configuration for the container group. -type DNSConfiguration struct { - // NameServers - The DNS servers for the container group. - NameServers *[]string `json:"nameServers,omitempty"` - // SearchDomains - The DNS search domains for hostname lookup in the container group. - SearchDomains *string `json:"searchDomains,omitempty"` - // Options - The DNS options for the container group. - Options *string `json:"options,omitempty"` -} - -// EncryptionProperties the container group encryption properties. -type EncryptionProperties struct { - // VaultBaseURL - The keyvault base url. - VaultBaseURL *string `json:"vaultBaseUrl,omitempty"` - // KeyName - The encryption key name. - KeyName *string `json:"keyName,omitempty"` - // KeyVersion - The encryption key version. - KeyVersion *string `json:"keyVersion,omitempty"` -} - -// EnvironmentVariable the environment variable to set within the container instance. -type EnvironmentVariable struct { - // Name - The name of the environment variable. - Name *string `json:"name,omitempty"` - // Value - The value of the environment variable. - Value *string `json:"value,omitempty"` - // SecureValue - The value of the secure environment variable. - SecureValue *string `json:"secureValue,omitempty"` -} - -// Event a container group or container instance event. -type Event struct { - // Count - READ-ONLY; The count of the event. - Count *int32 `json:"count,omitempty"` - // FirstTimestamp - READ-ONLY; The date-time of the earliest logged event. - FirstTimestamp *date.Time `json:"firstTimestamp,omitempty"` - // LastTimestamp - READ-ONLY; The date-time of the latest logged event. - LastTimestamp *date.Time `json:"lastTimestamp,omitempty"` - // Name - READ-ONLY; The event name. - Name *string `json:"name,omitempty"` - // Message - READ-ONLY; The event message. - Message *string `json:"message,omitempty"` - // Type - READ-ONLY; The event type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Event. -func (e Event) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GitRepoVolume represents a volume that is populated with the contents of a git repository -type GitRepoVolume struct { - // Directory - Target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name. - Directory *string `json:"directory,omitempty"` - // Repository - Repository URL - Repository *string `json:"repository,omitempty"` - // Revision - Commit hash for the specified revision. - Revision *string `json:"revision,omitempty"` -} - -// GpuResource the GPU resource. -type GpuResource struct { - // Count - The count of the GPU resource. - Count *int32 `json:"count,omitempty"` - // Sku - The SKU of the GPU resource. Possible values include: 'GpuSkuK80', 'GpuSkuP100', 'GpuSkuV100' - Sku GpuSku `json:"sku,omitempty"` -} - -// HTTPHeaders the HTTP headers. -type HTTPHeaders struct { - // Name - The header name. - Name *string `json:"name,omitempty"` - // Value - The header value. - Value *string `json:"value,omitempty"` -} - -// ImageRegistryCredential image registry credential. -type ImageRegistryCredential struct { - // Server - The Docker image registry server without a protocol such as "http" and "https". - Server *string `json:"server,omitempty"` - // Username - The username for the private registry. - Username *string `json:"username,omitempty"` - // Password - The password for the private registry. - Password *string `json:"password,omitempty"` -} - -// InitContainerDefinition the init container definition. -type InitContainerDefinition struct { - // Name - The name for the init container. - Name *string `json:"name,omitempty"` - // InitContainerPropertiesDefinition - The properties for the init container. - *InitContainerPropertiesDefinition `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for InitContainerDefinition. -func (icd InitContainerDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if icd.Name != nil { - objectMap["name"] = icd.Name - } - if icd.InitContainerPropertiesDefinition != nil { - objectMap["properties"] = icd.InitContainerPropertiesDefinition - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for InitContainerDefinition struct. -func (icd *InitContainerDefinition) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - icd.Name = &name - } - case "properties": - if v != nil { - var initContainerPropertiesDefinition InitContainerPropertiesDefinition - err = json.Unmarshal(*v, &initContainerPropertiesDefinition) - if err != nil { - return err - } - icd.InitContainerPropertiesDefinition = &initContainerPropertiesDefinition - } - } - } - - return nil -} - -// InitContainerPropertiesDefinition the init container definition properties. -type InitContainerPropertiesDefinition struct { - // Image - The image of the init container. - Image *string `json:"image,omitempty"` - // Command - The command to execute within the init container in exec form. - Command *[]string `json:"command,omitempty"` - // EnvironmentVariables - The environment variables to set in the init container. - EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` - // InstanceView - READ-ONLY; The instance view of the init container. Only valid in response. - InstanceView *InitContainerPropertiesDefinitionInstanceView `json:"instanceView,omitempty"` - // VolumeMounts - The volume mounts available to the init container. - VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"` -} - -// MarshalJSON is the custom marshaler for InitContainerPropertiesDefinition. -func (icpd InitContainerPropertiesDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if icpd.Image != nil { - objectMap["image"] = icpd.Image - } - if icpd.Command != nil { - objectMap["command"] = icpd.Command - } - if icpd.EnvironmentVariables != nil { - objectMap["environmentVariables"] = icpd.EnvironmentVariables - } - if icpd.VolumeMounts != nil { - objectMap["volumeMounts"] = icpd.VolumeMounts - } - return json.Marshal(objectMap) -} - -// InitContainerPropertiesDefinitionInstanceView the instance view of the init container. Only valid in -// response. -type InitContainerPropertiesDefinitionInstanceView struct { - // RestartCount - READ-ONLY; The number of times that the init container has been restarted. - RestartCount *int32 `json:"restartCount,omitempty"` - // CurrentState - READ-ONLY; The current state of the init container. - CurrentState *ContainerState `json:"currentState,omitempty"` - // PreviousState - READ-ONLY; The previous state of the init container. - PreviousState *ContainerState `json:"previousState,omitempty"` - // Events - READ-ONLY; The events of the init container. - Events *[]Event `json:"events,omitempty"` -} - -// MarshalJSON is the custom marshaler for InitContainerPropertiesDefinitionInstanceView. -func (icpdV InitContainerPropertiesDefinitionInstanceView) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IPAddress IP address for the container group. -type IPAddress struct { - // Ports - The list of ports exposed on the container group. - Ports *[]Port `json:"ports,omitempty"` - // Type - Specifies if the IP is exposed to the public internet or private VNET. Possible values include: 'ContainerGroupIPAddressTypePublic', 'ContainerGroupIPAddressTypePrivate' - Type ContainerGroupIPAddressType `json:"type,omitempty"` - // IP - The IP exposed to the public internet. - IP *string `json:"ip,omitempty"` - // DNSNameLabel - The Dns name label for the IP. - DNSNameLabel *string `json:"dnsNameLabel,omitempty"` - // Fqdn - READ-ONLY; The FQDN for the IP. - Fqdn *string `json:"fqdn,omitempty"` -} - -// MarshalJSON is the custom marshaler for IPAddress. -func (ia IPAddress) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ia.Ports != nil { - objectMap["ports"] = ia.Ports - } - if ia.Type != "" { - objectMap["type"] = ia.Type - } - if ia.IP != nil { - objectMap["ip"] = ia.IP - } - if ia.DNSNameLabel != nil { - objectMap["dnsNameLabel"] = ia.DNSNameLabel - } - return json.Marshal(objectMap) -} - -// LogAnalytics container group log analytics information. -type LogAnalytics struct { - // WorkspaceID - The workspace id for log analytics - WorkspaceID *string `json:"workspaceId,omitempty"` - // WorkspaceKey - The workspace key for log analytics - WorkspaceKey *string `json:"workspaceKey,omitempty"` - // LogType - The log type to be used. Possible values include: 'LogAnalyticsLogTypeContainerInsights', 'LogAnalyticsLogTypeContainerInstanceLogs' - LogType LogAnalyticsLogType `json:"logType,omitempty"` - // Metadata - Metadata for log analytics. - Metadata map[string]*string `json:"metadata"` - // WorkspaceResourceID - The workspace resource id for log analytics - WorkspaceResourceID map[string]*string `json:"workspaceResourceId"` -} - -// MarshalJSON is the custom marshaler for LogAnalytics. -func (la LogAnalytics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if la.WorkspaceID != nil { - objectMap["workspaceId"] = la.WorkspaceID - } - if la.WorkspaceKey != nil { - objectMap["workspaceKey"] = la.WorkspaceKey - } - if la.LogType != "" { - objectMap["logType"] = la.LogType - } - if la.Metadata != nil { - objectMap["metadata"] = la.Metadata - } - if la.WorkspaceResourceID != nil { - objectMap["workspaceResourceId"] = la.WorkspaceResourceID - } - return json.Marshal(objectMap) -} - -// Logs the logs. -type Logs struct { - autorest.Response `json:"-"` - // Content - The content of the log. - Content *string `json:"content,omitempty"` -} - -// Operation an operation for Azure Container Instance service. -type Operation struct { - // Name - The name of the operation. - Name *string `json:"name,omitempty"` - // Display - The display information of the operation. - Display *OperationDisplay `json:"display,omitempty"` - // Properties - The additional properties. - Properties interface{} `json:"properties,omitempty"` - // Origin - The intended executor of the operation. Possible values include: 'OperationsOriginUser', 'OperationsOriginSystem' - Origin OperationsOrigin `json:"origin,omitempty"` -} - -// OperationDisplay the display information of the operation. -type OperationDisplay struct { - // Provider - The name of the provider of the operation. - Provider *string `json:"provider,omitempty"` - // Resource - The name of the resource type of the operation. - Resource *string `json:"resource,omitempty"` - // Operation - The friendly name of the operation. - Operation *string `json:"operation,omitempty"` - // Description - The description of the operation. - Description *string `json:"description,omitempty"` -} - -// OperationListResult the operation list response that contains all operations for Azure Container -// Instance service. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - The list of operations. - Value *[]Operation `json:"value,omitempty"` - // NextLink - The URI to fetch the next page of operations. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// Port the port exposed on the container group. -type Port struct { - // Protocol - The protocol associated with the port. Possible values include: 'ContainerGroupNetworkProtocolTCP', 'ContainerGroupNetworkProtocolUDP' - Protocol ContainerGroupNetworkProtocol `json:"protocol,omitempty"` - // Port - The port number. - Port *int32 `json:"port,omitempty"` -} - -// Resource the Resource model definition. -type Resource struct { - // ID - READ-ONLY; The resource id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// ResourceLimits the resource limits. -type ResourceLimits struct { - // MemoryInGB - The memory limit in GB of this container instance. - MemoryInGB *float64 `json:"memoryInGB,omitempty"` - // CPU - The CPU limit of this container instance. - CPU *float64 `json:"cpu,omitempty"` - // Gpu - The GPU limit of this container instance. - Gpu *GpuResource `json:"gpu,omitempty"` -} - -// ResourceRequests the resource requests. -type ResourceRequests struct { - // MemoryInGB - The memory request in GB of this container instance. - MemoryInGB *float64 `json:"memoryInGB,omitempty"` - // CPU - The CPU request of this container instance. - CPU *float64 `json:"cpu,omitempty"` - // Gpu - The GPU request of this container instance. - Gpu *GpuResource `json:"gpu,omitempty"` -} - -// ResourceRequirements the resource requirements. -type ResourceRequirements struct { - // Requests - The resource requests of this container instance. - Requests *ResourceRequests `json:"requests,omitempty"` - // Limits - The resource limits of this container instance. - Limits *ResourceLimits `json:"limits,omitempty"` -} - -// Usage a single usage result -type Usage struct { - // Unit - READ-ONLY; Unit of the usage result - Unit *string `json:"unit,omitempty"` - // CurrentValue - READ-ONLY; The current usage of the resource - CurrentValue *int32 `json:"currentValue,omitempty"` - // Limit - READ-ONLY; The maximum permitted usage of the resource. - Limit *int32 `json:"limit,omitempty"` - // Name - READ-ONLY; The name object of the resource - Name *UsageName `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for Usage. -func (u Usage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UsageListResult the response containing the usage data -type UsageListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The usage data. - Value *[]Usage `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for UsageListResult. -func (ulr UsageListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UsageName the name object of the resource -type UsageName struct { - // Value - READ-ONLY; The name of the resource - Value *string `json:"value,omitempty"` - // LocalizedValue - READ-ONLY; The localized name of the resource - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for UsageName. -func (u UsageName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Volume the properties of the volume. -type Volume struct { - // Name - The name of the volume. - Name *string `json:"name,omitempty"` - // AzureFile - The Azure File volume. - AzureFile *AzureFileVolume `json:"azureFile,omitempty"` - // EmptyDir - The empty directory volume. - EmptyDir interface{} `json:"emptyDir,omitempty"` - // Secret - The secret volume. - Secret map[string]*string `json:"secret"` - // GitRepo - The git repo volume. - GitRepo *GitRepoVolume `json:"gitRepo,omitempty"` -} - -// MarshalJSON is the custom marshaler for Volume. -func (vVar Volume) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vVar.Name != nil { - objectMap["name"] = vVar.Name - } - if vVar.AzureFile != nil { - objectMap["azureFile"] = vVar.AzureFile - } - if vVar.EmptyDir != nil { - objectMap["emptyDir"] = vVar.EmptyDir - } - if vVar.Secret != nil { - objectMap["secret"] = vVar.Secret - } - if vVar.GitRepo != nil { - objectMap["gitRepo"] = vVar.GitRepo - } - return json.Marshal(objectMap) -} - -// VolumeMount the properties of the volume mount. -type VolumeMount struct { - // Name - The name of the volume mount. - Name *string `json:"name,omitempty"` - // MountPath - The path within the container where the volume should be mounted. Must not contain colon (:). - MountPath *string `json:"mountPath,omitempty"` - // ReadOnly - The flag indicating whether the volume mount is read-only. - ReadOnly *bool `json:"readOnly,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/operations.go deleted file mode 100644 index 8fc9d678e10..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package containerinstance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the client for the Operations methods of the Containerinstance service. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list the operations for Azure Container Instance service. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerinstance.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-03-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ContainerInstance/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerinstance.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerinstance.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerinstance.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/version.go deleted file mode 100644 index 4b1d585d377..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package containerinstance - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " containerinstance/2021-03-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/_meta.json deleted file mode 100644 index 9d744e74962..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "e0f8b9ab0f5fe5e71b7429ebfea8a33c19ec9d8d", - "readme": "/_/azure-rest-api-specs/specification/cost-management/resource-manager/readme.md", - "tag": "package-2020-06", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-06 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/cost-management/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/alerts.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/alerts.go deleted file mode 100644 index 38e55cab432..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/alerts.go +++ /dev/null @@ -1,374 +0,0 @@ -package costmanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AlertsClient is the client for the Alerts methods of the Costmanagement service. -type AlertsClient struct { - BaseClient -} - -// NewAlertsClient creates an instance of the AlertsClient client. -func NewAlertsClient(subscriptionID string) AlertsClient { - return NewAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAlertsClientWithBaseURI creates an instance of the AlertsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAlertsClientWithBaseURI(baseURI string, subscriptionID string) AlertsClient { - return AlertsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Dismiss dismisses the specified alert -// Parameters: -// scope - the scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for -// subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for -// Management Group scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// billingProfile scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for -// partners. -// alertID - alert ID -// parameters - parameters supplied to the Dismiss Alert operation. -func (client AlertsClient) Dismiss(ctx context.Context, scope string, alertID string, parameters DismissAlertPayload) (result Alert, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.Dismiss") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DismissPreparer(ctx, scope, alertID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.AlertsClient", "Dismiss", nil, "Failure preparing request") - return - } - - resp, err := client.DismissSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.AlertsClient", "Dismiss", resp, "Failure sending request") - return - } - - result, err = client.DismissResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.AlertsClient", "Dismiss", resp, "Failure responding to request") - return - } - - return -} - -// DismissPreparer prepares the Dismiss request. -func (client AlertsClient) DismissPreparer(ctx context.Context, scope string, alertID string, parameters DismissAlertPayload) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "alertId": alertID, - "scope": scope, - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DismissSender sends the Dismiss request. The method will close the -// http.Response Body if it receives an error. -func (client AlertsClient) DismissSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DismissResponder handles the response to the Dismiss request. The method always -// closes the http.Response Body. -func (client AlertsClient) DismissResponder(resp *http.Response) (result Alert, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets the alert for the scope by alert ID. -// Parameters: -// scope - the scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for -// subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for -// Management Group scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// billingProfile scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for -// partners. -// alertID - alert ID -func (client AlertsClient) Get(ctx context.Context, scope string, alertID string) (result Alert, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, scope, alertID) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.AlertsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.AlertsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.AlertsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AlertsClient) GetPreparer(ctx context.Context, scope string, alertID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "alertId": alertID, - "scope": scope, - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AlertsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AlertsClient) GetResponder(resp *http.Response) (result Alert, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the alerts for scope defined. -// Parameters: -// scope - the scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for -// subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for -// Management Group scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// billingProfile scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for -// partners. -func (client AlertsClient) List(ctx context.Context, scope string) (result AlertsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.AlertsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.AlertsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.AlertsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AlertsClient) ListPreparer(ctx context.Context, scope string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/alerts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AlertsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AlertsClient) ListResponder(resp *http.Response) (result AlertsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListExternal lists the Alerts for external cloud provider type defined. -// Parameters: -// externalCloudProviderType - the external cloud provider type associated with dimension/query operations. -// This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated -// account. -// externalCloudProviderID - this can be '{externalSubscriptionId}' for linked account or -// '{externalBillingAccountId}' for consolidated account used with dimension/query operations. -func (client AlertsClient) ListExternal(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string) (result AlertsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListExternal") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListExternalPreparer(ctx, externalCloudProviderType, externalCloudProviderID) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.AlertsClient", "ListExternal", nil, "Failure preparing request") - return - } - - resp, err := client.ListExternalSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.AlertsClient", "ListExternal", resp, "Failure sending request") - return - } - - result, err = client.ListExternalResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.AlertsClient", "ListExternal", resp, "Failure responding to request") - return - } - - return -} - -// ListExternalPreparer prepares the ListExternal request. -func (client AlertsClient) ListExternalPreparer(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "externalCloudProviderId": autorest.Encode("path", externalCloudProviderID), - "externalCloudProviderType": autorest.Encode("path", externalCloudProviderType), - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListExternalSender sends the ListExternal request. The method will close the -// http.Response Body if it receives an error. -func (client AlertsClient) ListExternalSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListExternalResponder handles the response to the ListExternal request. The method always -// closes the http.Response Body. -func (client AlertsClient) ListExternalResponder(resp *http.Response) (result AlertsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/client.go deleted file mode 100644 index b51618e0106..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package costmanagement implements the Azure ARM Costmanagement service API version 2020-06-01. -// -// -package costmanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Costmanagement - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Costmanagement. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/dimensions.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/dimensions.go deleted file mode 100644 index 3d08677933f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/dimensions.go +++ /dev/null @@ -1,254 +0,0 @@ -package costmanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DimensionsClient is the client for the Dimensions methods of the Costmanagement service. -type DimensionsClient struct { - BaseClient -} - -// NewDimensionsClient creates an instance of the DimensionsClient client. -func NewDimensionsClient(subscriptionID string) DimensionsClient { - return NewDimensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDimensionsClientWithBaseURI creates an instance of the DimensionsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDimensionsClientWithBaseURI(baseURI string, subscriptionID string) DimensionsClient { - return DimensionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ByExternalCloudProviderType lists the dimensions by the external cloud provider type. -// Parameters: -// externalCloudProviderType - the external cloud provider type associated with dimension/query operations. -// This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated -// account. -// externalCloudProviderID - this can be '{externalSubscriptionId}' for linked account or -// '{externalBillingAccountId}' for consolidated account used with dimension/query operations. -// filter - may be used to filter dimensions by properties/category, properties/usageStart, -// properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. -// expand - may be used to expand the properties/data within a dimension category. By default, data is not -// included when listing dimensions. -// skiptoken - skiptoken is only used if a previous operation returned a partial result. If a previous response -// contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that -// specifies a starting point to use for subsequent calls. -// top - may be used to limit the number of results to the most recent N dimension data. -func (client DimensionsClient) ByExternalCloudProviderType(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, filter string, expand string, skiptoken string, top *int32) (result DimensionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DimensionsClient.ByExternalCloudProviderType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("costmanagement.DimensionsClient", "ByExternalCloudProviderType", err.Error()) - } - - req, err := client.ByExternalCloudProviderTypePreparer(ctx, externalCloudProviderType, externalCloudProviderID, filter, expand, skiptoken, top) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.DimensionsClient", "ByExternalCloudProviderType", nil, "Failure preparing request") - return - } - - resp, err := client.ByExternalCloudProviderTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.DimensionsClient", "ByExternalCloudProviderType", resp, "Failure sending request") - return - } - - result, err = client.ByExternalCloudProviderTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.DimensionsClient", "ByExternalCloudProviderType", resp, "Failure responding to request") - return - } - - return -} - -// ByExternalCloudProviderTypePreparer prepares the ByExternalCloudProviderType request. -func (client DimensionsClient) ByExternalCloudProviderTypePreparer(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, filter string, expand string, skiptoken string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "externalCloudProviderId": autorest.Encode("path", externalCloudProviderID), - "externalCloudProviderType": autorest.Encode("path", externalCloudProviderType), - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(skiptoken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ByExternalCloudProviderTypeSender sends the ByExternalCloudProviderType request. The method will close the -// http.Response Body if it receives an error. -func (client DimensionsClient) ByExternalCloudProviderTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ByExternalCloudProviderTypeResponder handles the response to the ByExternalCloudProviderType request. The method always -// closes the http.Response Body. -func (client DimensionsClient) ByExternalCloudProviderTypeResponder(resp *http.Response) (result DimensionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the dimensions by the defined scope. -// Parameters: -// scope - the scope associated with dimension operations. This includes '/subscriptions/{subscriptionId}/' for -// subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for -// Management Group scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// billingProfile scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for -// partners. -// filter - may be used to filter dimensions by properties/category, properties/usageStart, -// properties/usageEnd. Supported operators are 'eq','lt', 'gt', 'le', 'ge'. -// expand - may be used to expand the properties/data within a dimension category. By default, data is not -// included when listing dimensions. -// skiptoken - skiptoken is only used if a previous operation returned a partial result. If a previous response -// contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that -// specifies a starting point to use for subsequent calls. -// top - may be used to limit the number of results to the most recent N dimension data. -func (client DimensionsClient) List(ctx context.Context, scope string, filter string, expand string, skiptoken string, top *int32) (result DimensionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DimensionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("costmanagement.DimensionsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, scope, filter, expand, skiptoken, top) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.DimensionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.DimensionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.DimensionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DimensionsClient) ListPreparer(ctx context.Context, scope string, filter string, expand string, skiptoken string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(skiptoken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/dimensions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DimensionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DimensionsClient) ListResponder(resp *http.Response) (result DimensionsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/enums.go deleted file mode 100644 index 605588d2729..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/enums.go +++ /dev/null @@ -1,546 +0,0 @@ -package costmanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AccumulatedType enumerates the values for accumulated type. -type AccumulatedType string - -const ( - // False ... - False AccumulatedType = "false" - // True ... - True AccumulatedType = "true" -) - -// PossibleAccumulatedTypeValues returns an array of possible values for the AccumulatedType const type. -func PossibleAccumulatedTypeValues() []AccumulatedType { - return []AccumulatedType{False, True} -} - -// AlertCategory enumerates the values for alert category. -type AlertCategory string - -const ( - // Billing ... - Billing AlertCategory = "Billing" - // Cost ... - Cost AlertCategory = "Cost" - // System ... - System AlertCategory = "System" - // Usage ... - Usage AlertCategory = "Usage" -) - -// PossibleAlertCategoryValues returns an array of possible values for the AlertCategory const type. -func PossibleAlertCategoryValues() []AlertCategory { - return []AlertCategory{Billing, Cost, System, Usage} -} - -// AlertCriteria enumerates the values for alert criteria. -type AlertCriteria string - -const ( - // CostThresholdExceeded ... - CostThresholdExceeded AlertCriteria = "CostThresholdExceeded" - // CreditThresholdApproaching ... - CreditThresholdApproaching AlertCriteria = "CreditThresholdApproaching" - // CreditThresholdReached ... - CreditThresholdReached AlertCriteria = "CreditThresholdReached" - // CrossCloudCollectionError ... - CrossCloudCollectionError AlertCriteria = "CrossCloudCollectionError" - // CrossCloudNewDataAvailable ... - CrossCloudNewDataAvailable AlertCriteria = "CrossCloudNewDataAvailable" - // ForecastCostThresholdExceeded ... - ForecastCostThresholdExceeded AlertCriteria = "ForecastCostThresholdExceeded" - // ForecastUsageThresholdExceeded ... - ForecastUsageThresholdExceeded AlertCriteria = "ForecastUsageThresholdExceeded" - // GeneralThresholdError ... - GeneralThresholdError AlertCriteria = "GeneralThresholdError" - // InvoiceDueDateApproaching ... - InvoiceDueDateApproaching AlertCriteria = "InvoiceDueDateApproaching" - // InvoiceDueDateReached ... - InvoiceDueDateReached AlertCriteria = "InvoiceDueDateReached" - // MultiCurrency ... - MultiCurrency AlertCriteria = "MultiCurrency" - // QuotaThresholdApproaching ... - QuotaThresholdApproaching AlertCriteria = "QuotaThresholdApproaching" - // QuotaThresholdReached ... - QuotaThresholdReached AlertCriteria = "QuotaThresholdReached" - // UsageThresholdExceeded ... - UsageThresholdExceeded AlertCriteria = "UsageThresholdExceeded" -) - -// PossibleAlertCriteriaValues returns an array of possible values for the AlertCriteria const type. -func PossibleAlertCriteriaValues() []AlertCriteria { - return []AlertCriteria{CostThresholdExceeded, CreditThresholdApproaching, CreditThresholdReached, CrossCloudCollectionError, CrossCloudNewDataAvailable, ForecastCostThresholdExceeded, ForecastUsageThresholdExceeded, GeneralThresholdError, InvoiceDueDateApproaching, InvoiceDueDateReached, MultiCurrency, QuotaThresholdApproaching, QuotaThresholdReached, UsageThresholdExceeded} -} - -// AlertOperator enumerates the values for alert operator. -type AlertOperator string - -const ( - // EqualTo ... - EqualTo AlertOperator = "EqualTo" - // GreaterThan ... - GreaterThan AlertOperator = "GreaterThan" - // GreaterThanOrEqualTo ... - GreaterThanOrEqualTo AlertOperator = "GreaterThanOrEqualTo" - // LessThan ... - LessThan AlertOperator = "LessThan" - // LessThanOrEqualTo ... - LessThanOrEqualTo AlertOperator = "LessThanOrEqualTo" - // None ... - None AlertOperator = "None" -) - -// PossibleAlertOperatorValues returns an array of possible values for the AlertOperator const type. -func PossibleAlertOperatorValues() []AlertOperator { - return []AlertOperator{EqualTo, GreaterThan, GreaterThanOrEqualTo, LessThan, LessThanOrEqualTo, None} -} - -// AlertSource enumerates the values for alert source. -type AlertSource string - -const ( - // Preset ... - Preset AlertSource = "Preset" - // User ... - User AlertSource = "User" -) - -// PossibleAlertSourceValues returns an array of possible values for the AlertSource const type. -func PossibleAlertSourceValues() []AlertSource { - return []AlertSource{Preset, User} -} - -// AlertStatus enumerates the values for alert status. -type AlertStatus string - -const ( - // AlertStatusActive ... - AlertStatusActive AlertStatus = "Active" - // AlertStatusDismissed ... - AlertStatusDismissed AlertStatus = "Dismissed" - // AlertStatusNone ... - AlertStatusNone AlertStatus = "None" - // AlertStatusOverridden ... - AlertStatusOverridden AlertStatus = "Overridden" - // AlertStatusResolved ... - AlertStatusResolved AlertStatus = "Resolved" -) - -// PossibleAlertStatusValues returns an array of possible values for the AlertStatus const type. -func PossibleAlertStatusValues() []AlertStatus { - return []AlertStatus{AlertStatusActive, AlertStatusDismissed, AlertStatusNone, AlertStatusOverridden, AlertStatusResolved} -} - -// AlertTimeGrainType enumerates the values for alert time grain type. -type AlertTimeGrainType string - -const ( - // AlertTimeGrainTypeAnnually ... - AlertTimeGrainTypeAnnually AlertTimeGrainType = "Annually" - // AlertTimeGrainTypeBillingAnnual ... - AlertTimeGrainTypeBillingAnnual AlertTimeGrainType = "BillingAnnual" - // AlertTimeGrainTypeBillingMonth ... - AlertTimeGrainTypeBillingMonth AlertTimeGrainType = "BillingMonth" - // AlertTimeGrainTypeBillingQuarter ... - AlertTimeGrainTypeBillingQuarter AlertTimeGrainType = "BillingQuarter" - // AlertTimeGrainTypeMonthly ... - AlertTimeGrainTypeMonthly AlertTimeGrainType = "Monthly" - // AlertTimeGrainTypeNone ... - AlertTimeGrainTypeNone AlertTimeGrainType = "None" - // AlertTimeGrainTypeQuarterly ... - AlertTimeGrainTypeQuarterly AlertTimeGrainType = "Quarterly" -) - -// PossibleAlertTimeGrainTypeValues returns an array of possible values for the AlertTimeGrainType const type. -func PossibleAlertTimeGrainTypeValues() []AlertTimeGrainType { - return []AlertTimeGrainType{AlertTimeGrainTypeAnnually, AlertTimeGrainTypeBillingAnnual, AlertTimeGrainTypeBillingMonth, AlertTimeGrainTypeBillingQuarter, AlertTimeGrainTypeMonthly, AlertTimeGrainTypeNone, AlertTimeGrainTypeQuarterly} -} - -// AlertType enumerates the values for alert type. -type AlertType string - -const ( - // Budget ... - Budget AlertType = "Budget" - // BudgetForecast ... - BudgetForecast AlertType = "BudgetForecast" - // Credit ... - Credit AlertType = "Credit" - // General ... - General AlertType = "General" - // Invoice ... - Invoice AlertType = "Invoice" - // Quota ... - Quota AlertType = "Quota" - // XCloud ... - XCloud AlertType = "xCloud" -) - -// PossibleAlertTypeValues returns an array of possible values for the AlertType const type. -func PossibleAlertTypeValues() []AlertType { - return []AlertType{Budget, BudgetForecast, Credit, General, Invoice, Quota, XCloud} -} - -// ChartType enumerates the values for chart type. -type ChartType string - -const ( - // Area ... - Area ChartType = "Area" - // GroupedColumn ... - GroupedColumn ChartType = "GroupedColumn" - // Line ... - Line ChartType = "Line" - // StackedColumn ... - StackedColumn ChartType = "StackedColumn" - // Table ... - Table ChartType = "Table" -) - -// PossibleChartTypeValues returns an array of possible values for the ChartType const type. -func PossibleChartTypeValues() []ChartType { - return []ChartType{Area, GroupedColumn, Line, StackedColumn, Table} -} - -// Direction enumerates the values for direction. -type Direction string - -const ( - // Ascending ... - Ascending Direction = "Ascending" - // Descending ... - Descending Direction = "Descending" -) - -// PossibleDirectionValues returns an array of possible values for the Direction const type. -func PossibleDirectionValues() []Direction { - return []Direction{Ascending, Descending} -} - -// ExecutionStatus enumerates the values for execution status. -type ExecutionStatus string - -const ( - // Completed ... - Completed ExecutionStatus = "Completed" - // DataNotAvailable ... - DataNotAvailable ExecutionStatus = "DataNotAvailable" - // Failed ... - Failed ExecutionStatus = "Failed" - // InProgress ... - InProgress ExecutionStatus = "InProgress" - // NewDataNotAvailable ... - NewDataNotAvailable ExecutionStatus = "NewDataNotAvailable" - // Queued ... - Queued ExecutionStatus = "Queued" - // Timeout ... - Timeout ExecutionStatus = "Timeout" -) - -// PossibleExecutionStatusValues returns an array of possible values for the ExecutionStatus const type. -func PossibleExecutionStatusValues() []ExecutionStatus { - return []ExecutionStatus{Completed, DataNotAvailable, Failed, InProgress, NewDataNotAvailable, Queued, Timeout} -} - -// ExecutionType enumerates the values for execution type. -type ExecutionType string - -const ( - // OnDemand ... - OnDemand ExecutionType = "OnDemand" - // Scheduled ... - Scheduled ExecutionType = "Scheduled" -) - -// PossibleExecutionTypeValues returns an array of possible values for the ExecutionType const type. -func PossibleExecutionTypeValues() []ExecutionType { - return []ExecutionType{OnDemand, Scheduled} -} - -// ExportType enumerates the values for export type. -type ExportType string - -const ( - // ExportTypeActualCost ... - ExportTypeActualCost ExportType = "ActualCost" - // ExportTypeAmortizedCost ... - ExportTypeAmortizedCost ExportType = "AmortizedCost" - // ExportTypeUsage ... - ExportTypeUsage ExportType = "Usage" -) - -// PossibleExportTypeValues returns an array of possible values for the ExportType const type. -func PossibleExportTypeValues() []ExportType { - return []ExportType{ExportTypeActualCost, ExportTypeAmortizedCost, ExportTypeUsage} -} - -// ExternalCloudProviderType enumerates the values for external cloud provider type. -type ExternalCloudProviderType string - -const ( - // ExternalBillingAccounts ... - ExternalBillingAccounts ExternalCloudProviderType = "externalBillingAccounts" - // ExternalSubscriptions ... - ExternalSubscriptions ExternalCloudProviderType = "externalSubscriptions" -) - -// PossibleExternalCloudProviderTypeValues returns an array of possible values for the ExternalCloudProviderType const type. -func PossibleExternalCloudProviderTypeValues() []ExternalCloudProviderType { - return []ExternalCloudProviderType{ExternalBillingAccounts, ExternalSubscriptions} -} - -// ForecastTimeframeType enumerates the values for forecast timeframe type. -type ForecastTimeframeType string - -const ( - // BillingMonthToDate ... - BillingMonthToDate ForecastTimeframeType = "BillingMonthToDate" - // Custom ... - Custom ForecastTimeframeType = "Custom" - // MonthToDate ... - MonthToDate ForecastTimeframeType = "MonthToDate" - // TheLastBillingMonth ... - TheLastBillingMonth ForecastTimeframeType = "TheLastBillingMonth" - // TheLastMonth ... - TheLastMonth ForecastTimeframeType = "TheLastMonth" - // WeekToDate ... - WeekToDate ForecastTimeframeType = "WeekToDate" -) - -// PossibleForecastTimeframeTypeValues returns an array of possible values for the ForecastTimeframeType const type. -func PossibleForecastTimeframeTypeValues() []ForecastTimeframeType { - return []ForecastTimeframeType{BillingMonthToDate, Custom, MonthToDate, TheLastBillingMonth, TheLastMonth, WeekToDate} -} - -// ForecastType enumerates the values for forecast type. -type ForecastType string - -const ( - // ForecastTypeActualCost ... - ForecastTypeActualCost ForecastType = "ActualCost" - // ForecastTypeAmortizedCost ... - ForecastTypeAmortizedCost ForecastType = "AmortizedCost" - // ForecastTypeUsage ... - ForecastTypeUsage ForecastType = "Usage" -) - -// PossibleForecastTypeValues returns an array of possible values for the ForecastType const type. -func PossibleForecastTypeValues() []ForecastType { - return []ForecastType{ForecastTypeActualCost, ForecastTypeAmortizedCost, ForecastTypeUsage} -} - -// FormatType enumerates the values for format type. -type FormatType string - -const ( - // Csv ... - Csv FormatType = "Csv" -) - -// PossibleFormatTypeValues returns an array of possible values for the FormatType const type. -func PossibleFormatTypeValues() []FormatType { - return []FormatType{Csv} -} - -// GranularityType enumerates the values for granularity type. -type GranularityType string - -const ( - // Daily ... - Daily GranularityType = "Daily" -) - -// PossibleGranularityTypeValues returns an array of possible values for the GranularityType const type. -func PossibleGranularityTypeValues() []GranularityType { - return []GranularityType{Daily} -} - -// KpiTypeType enumerates the values for kpi type type. -type KpiTypeType string - -const ( - // KpiTypeTypeBudget ... - KpiTypeTypeBudget KpiTypeType = "Budget" - // KpiTypeTypeForecast ... - KpiTypeTypeForecast KpiTypeType = "Forecast" -) - -// PossibleKpiTypeTypeValues returns an array of possible values for the KpiTypeType const type. -func PossibleKpiTypeTypeValues() []KpiTypeType { - return []KpiTypeType{KpiTypeTypeBudget, KpiTypeTypeForecast} -} - -// MetricType enumerates the values for metric type. -type MetricType string - -const ( - // ActualCost ... - ActualCost MetricType = "ActualCost" - // AHUB ... - AHUB MetricType = "AHUB" - // AmortizedCost ... - AmortizedCost MetricType = "AmortizedCost" -) - -// PossibleMetricTypeValues returns an array of possible values for the MetricType const type. -func PossibleMetricTypeValues() []MetricType { - return []MetricType{ActualCost, AHUB, AmortizedCost} -} - -// OperatorType enumerates the values for operator type. -type OperatorType string - -const ( - // Contains ... - Contains OperatorType = "Contains" - // In ... - In OperatorType = "In" -) - -// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. -func PossibleOperatorTypeValues() []OperatorType { - return []OperatorType{Contains, In} -} - -// PivotTypeType enumerates the values for pivot type type. -type PivotTypeType string - -const ( - // PivotTypeTypeDimension ... - PivotTypeTypeDimension PivotTypeType = "Dimension" - // PivotTypeTypeTagKey ... - PivotTypeTypeTagKey PivotTypeType = "TagKey" -) - -// PossiblePivotTypeTypeValues returns an array of possible values for the PivotTypeType const type. -func PossiblePivotTypeTypeValues() []PivotTypeType { - return []PivotTypeType{PivotTypeTypeDimension, PivotTypeTypeTagKey} -} - -// QueryColumnType enumerates the values for query column type. -type QueryColumnType string - -const ( - // QueryColumnTypeDimension ... - QueryColumnTypeDimension QueryColumnType = "Dimension" - // QueryColumnTypeTag ... - QueryColumnTypeTag QueryColumnType = "Tag" -) - -// PossibleQueryColumnTypeValues returns an array of possible values for the QueryColumnType const type. -func PossibleQueryColumnTypeValues() []QueryColumnType { - return []QueryColumnType{QueryColumnTypeDimension, QueryColumnTypeTag} -} - -// RecurrenceType enumerates the values for recurrence type. -type RecurrenceType string - -const ( - // RecurrenceTypeAnnually ... - RecurrenceTypeAnnually RecurrenceType = "Annually" - // RecurrenceTypeDaily ... - RecurrenceTypeDaily RecurrenceType = "Daily" - // RecurrenceTypeMonthly ... - RecurrenceTypeMonthly RecurrenceType = "Monthly" - // RecurrenceTypeWeekly ... - RecurrenceTypeWeekly RecurrenceType = "Weekly" -) - -// PossibleRecurrenceTypeValues returns an array of possible values for the RecurrenceType const type. -func PossibleRecurrenceTypeValues() []RecurrenceType { - return []RecurrenceType{RecurrenceTypeAnnually, RecurrenceTypeDaily, RecurrenceTypeMonthly, RecurrenceTypeWeekly} -} - -// ReportConfigColumnType enumerates the values for report config column type. -type ReportConfigColumnType string - -const ( - // ReportConfigColumnTypeDimension ... - ReportConfigColumnTypeDimension ReportConfigColumnType = "Dimension" - // ReportConfigColumnTypeTag ... - ReportConfigColumnTypeTag ReportConfigColumnType = "Tag" -) - -// PossibleReportConfigColumnTypeValues returns an array of possible values for the ReportConfigColumnType const type. -func PossibleReportConfigColumnTypeValues() []ReportConfigColumnType { - return []ReportConfigColumnType{ReportConfigColumnTypeDimension, ReportConfigColumnTypeTag} -} - -// ReportGranularityType enumerates the values for report granularity type. -type ReportGranularityType string - -const ( - // ReportGranularityTypeDaily ... - ReportGranularityTypeDaily ReportGranularityType = "Daily" - // ReportGranularityTypeMonthly ... - ReportGranularityTypeMonthly ReportGranularityType = "Monthly" -) - -// PossibleReportGranularityTypeValues returns an array of possible values for the ReportGranularityType const type. -func PossibleReportGranularityTypeValues() []ReportGranularityType { - return []ReportGranularityType{ReportGranularityTypeDaily, ReportGranularityTypeMonthly} -} - -// ReportTimeframeType enumerates the values for report timeframe type. -type ReportTimeframeType string - -const ( - // ReportTimeframeTypeCustom ... - ReportTimeframeTypeCustom ReportTimeframeType = "Custom" - // ReportTimeframeTypeMonthToDate ... - ReportTimeframeTypeMonthToDate ReportTimeframeType = "MonthToDate" - // ReportTimeframeTypeWeekToDate ... - ReportTimeframeTypeWeekToDate ReportTimeframeType = "WeekToDate" - // ReportTimeframeTypeYearToDate ... - ReportTimeframeTypeYearToDate ReportTimeframeType = "YearToDate" -) - -// PossibleReportTimeframeTypeValues returns an array of possible values for the ReportTimeframeType const type. -func PossibleReportTimeframeTypeValues() []ReportTimeframeType { - return []ReportTimeframeType{ReportTimeframeTypeCustom, ReportTimeframeTypeMonthToDate, ReportTimeframeTypeWeekToDate, ReportTimeframeTypeYearToDate} -} - -// StatusType enumerates the values for status type. -type StatusType string - -const ( - // Active ... - Active StatusType = "Active" - // Inactive ... - Inactive StatusType = "Inactive" -) - -// PossibleStatusTypeValues returns an array of possible values for the StatusType const type. -func PossibleStatusTypeValues() []StatusType { - return []StatusType{Active, Inactive} -} - -// TimeframeType enumerates the values for timeframe type. -type TimeframeType string - -const ( - // TimeframeTypeBillingMonthToDate ... - TimeframeTypeBillingMonthToDate TimeframeType = "BillingMonthToDate" - // TimeframeTypeCustom ... - TimeframeTypeCustom TimeframeType = "Custom" - // TimeframeTypeMonthToDate ... - TimeframeTypeMonthToDate TimeframeType = "MonthToDate" - // TimeframeTypeTheLastBillingMonth ... - TimeframeTypeTheLastBillingMonth TimeframeType = "TheLastBillingMonth" - // TimeframeTypeTheLastMonth ... - TimeframeTypeTheLastMonth TimeframeType = "TheLastMonth" - // TimeframeTypeWeekToDate ... - TimeframeTypeWeekToDate TimeframeType = "WeekToDate" -) - -// PossibleTimeframeTypeValues returns an array of possible values for the TimeframeType const type. -func PossibleTimeframeTypeValues() []TimeframeType { - return []TimeframeType{TimeframeTypeBillingMonthToDate, TimeframeTypeCustom, TimeframeTypeMonthToDate, TimeframeTypeTheLastBillingMonth, TimeframeTypeTheLastMonth, TimeframeTypeWeekToDate} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/exports.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/exports.go deleted file mode 100644 index 10febf8574d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/exports.go +++ /dev/null @@ -1,581 +0,0 @@ -package costmanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ExportsClient is the client for the Exports methods of the Costmanagement service. -type ExportsClient struct { - BaseClient -} - -// NewExportsClient creates an instance of the ExportsClient client. -func NewExportsClient(subscriptionID string) ExportsClient { - return NewExportsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExportsClientWithBaseURI creates an instance of the ExportsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewExportsClientWithBaseURI(baseURI string, subscriptionID string) ExportsClient { - return ExportsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate the operation to create or update a export. Update operation requires latest eTag to be set in the -// request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. -// Parameters: -// scope - the scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for -// subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for -// Management Group scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// billingProfile scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for -// partners. -// exportName - export Name. -// parameters - parameters supplied to the CreateOrUpdate Export operation. -func (client ExportsClient) CreateOrUpdate(ctx context.Context, scope string, exportName string, parameters Export) (result Export, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ExportProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ExportProperties.Schedule", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ExportProperties.Schedule.RecurrencePeriod", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ExportProperties.Schedule.RecurrencePeriod.From", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - }}}}}); err != nil { - return result, validation.NewError("costmanagement.ExportsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, scope, exportName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ExportsClient) CreateOrUpdatePreparer(ctx context.Context, scope string, exportName string, parameters Export) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportName": autorest.Encode("path", exportName), - "scope": scope, - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/exports/{exportName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ExportsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ExportsClient) CreateOrUpdateResponder(resp *http.Response) (result Export, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete the operation to delete a export. -// Parameters: -// scope - the scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for -// subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for -// Management Group scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// billingProfile scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for -// partners. -// exportName - export Name. -func (client ExportsClient) Delete(ctx context.Context, scope string, exportName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, scope, exportName) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ExportsClient) DeletePreparer(ctx context.Context, scope string, exportName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportName": autorest.Encode("path", exportName), - "scope": scope, - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/exports/{exportName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ExportsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ExportsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Execute the operation to execute an export. -// Parameters: -// scope - the scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for -// subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for -// Management Group scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// billingProfile scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for -// partners. -// exportName - export Name. -func (client ExportsClient) Execute(ctx context.Context, scope string, exportName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportsClient.Execute") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ExecutePreparer(ctx, scope, exportName) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "Execute", nil, "Failure preparing request") - return - } - - resp, err := client.ExecuteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "Execute", resp, "Failure sending request") - return - } - - result, err = client.ExecuteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "Execute", resp, "Failure responding to request") - return - } - - return -} - -// ExecutePreparer prepares the Execute request. -func (client ExportsClient) ExecutePreparer(ctx context.Context, scope string, exportName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportName": autorest.Encode("path", exportName), - "scope": scope, - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExecuteSender sends the Execute request. The method will close the -// http.Response Body if it receives an error. -func (client ExportsClient) ExecuteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ExecuteResponder handles the response to the Execute request. The method always -// closes the http.Response Body. -func (client ExportsClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get the operation to get the export for the defined scope by export name. -// Parameters: -// scope - the scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for -// subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for -// Management Group scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// billingProfile scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for -// partners. -// exportName - export Name. -// expand - may be used to expand the properties within an export. Currently only 'runHistory' is supported and -// will return information for the last 10 executions of the export. -func (client ExportsClient) Get(ctx context.Context, scope string, exportName string, expand string) (result Export, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, scope, exportName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExportsClient) GetPreparer(ctx context.Context, scope string, exportName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportName": autorest.Encode("path", exportName), - "scope": scope, - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/exports/{exportName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ExportsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ExportsClient) GetResponder(resp *http.Response) (result Export, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetExecutionHistory the operation to get the execution history of an export for the defined scope and export name. -// Parameters: -// scope - the scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for -// subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for -// Management Group scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// billingProfile scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for -// partners. -// exportName - export Name. -func (client ExportsClient) GetExecutionHistory(ctx context.Context, scope string, exportName string) (result ExportExecutionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportsClient.GetExecutionHistory") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetExecutionHistoryPreparer(ctx, scope, exportName) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "GetExecutionHistory", nil, "Failure preparing request") - return - } - - resp, err := client.GetExecutionHistorySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "GetExecutionHistory", resp, "Failure sending request") - return - } - - result, err = client.GetExecutionHistoryResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "GetExecutionHistory", resp, "Failure responding to request") - return - } - - return -} - -// GetExecutionHistoryPreparer prepares the GetExecutionHistory request. -func (client ExportsClient) GetExecutionHistoryPreparer(ctx context.Context, scope string, exportName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportName": autorest.Encode("path", exportName), - "scope": scope, - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetExecutionHistorySender sends the GetExecutionHistory request. The method will close the -// http.Response Body if it receives an error. -func (client ExportsClient) GetExecutionHistorySender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetExecutionHistoryResponder handles the response to the GetExecutionHistory request. The method always -// closes the http.Response Body. -func (client ExportsClient) GetExecutionHistoryResponder(resp *http.Response) (result ExportExecutionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List the operation to list all exports at the given scope. -// Parameters: -// scope - the scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for -// subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for -// Management Group scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// billingProfile scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for -// partners. -// expand - may be used to expand the properties within an export. Currently only 'runHistory' is supported and -// will return information for the last execution of each export. -func (client ExportsClient) List(ctx context.Context, scope string, expand string) (result ExportListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, scope, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ExportsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ExportsClient) ListPreparer(ctx context.Context, scope string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/exports", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ExportsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ExportsClient) ListResponder(resp *http.Response) (result ExportListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/forecast.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/forecast.go deleted file mode 100644 index fac797fa265..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/forecast.go +++ /dev/null @@ -1,274 +0,0 @@ -package costmanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ForecastClient is the client for the Forecast methods of the Costmanagement service. -type ForecastClient struct { - BaseClient -} - -// NewForecastClient creates an instance of the ForecastClient client. -func NewForecastClient(subscriptionID string) ForecastClient { - return NewForecastClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewForecastClientWithBaseURI creates an instance of the ForecastClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewForecastClientWithBaseURI(baseURI string, subscriptionID string) ForecastClient { - return ForecastClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ExternalCloudProviderUsage lists the forecast charges for external cloud provider type defined. -// Parameters: -// externalCloudProviderType - the external cloud provider type associated with dimension/query operations. -// This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated -// account. -// externalCloudProviderID - this can be '{externalSubscriptionId}' for linked account or -// '{externalBillingAccountId}' for consolidated account used with dimension/query operations. -// parameters - parameters supplied to the CreateOrUpdate Forecast Config operation. -// filter - may be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or -// properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support -// 'ne', 'or', or 'not'. -func (client ForecastClient) ExternalCloudProviderUsage(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, parameters ForecastDefinition, filter string) (result QueryResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ForecastClient.ExternalCloudProviderUsage") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TimePeriod", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TimePeriod.From", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TimePeriod.To", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.Dataset", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.And", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.And", Name: validation.MinItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.Dataset.Filter.Or", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Or", Name: validation.MinItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.Dataset.Filter.Not", Name: validation.Null, Rule: false, Chain: nil}, - {Target: "parameters.Dataset.Filter.Dimension", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Dimension.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Dimension.Operator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Dimension.Values", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Dimension.Values", Name: validation.MinItems, Rule: 1, Chain: nil}}}, - }}, - {Target: "parameters.Dataset.Filter.Tag", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Tag.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Tag.Operator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Tag.Values", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Tag.Values", Name: validation.MinItems, Rule: 1, Chain: nil}}}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("costmanagement.ForecastClient", "ExternalCloudProviderUsage", err.Error()) - } - - req, err := client.ExternalCloudProviderUsagePreparer(ctx, externalCloudProviderType, externalCloudProviderID, parameters, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ForecastClient", "ExternalCloudProviderUsage", nil, "Failure preparing request") - return - } - - resp, err := client.ExternalCloudProviderUsageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.ForecastClient", "ExternalCloudProviderUsage", resp, "Failure sending request") - return - } - - result, err = client.ExternalCloudProviderUsageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ForecastClient", "ExternalCloudProviderUsage", resp, "Failure responding to request") - return - } - - return -} - -// ExternalCloudProviderUsagePreparer prepares the ExternalCloudProviderUsage request. -func (client ForecastClient) ExternalCloudProviderUsagePreparer(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, parameters ForecastDefinition, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "externalCloudProviderId": autorest.Encode("path", externalCloudProviderID), - "externalCloudProviderType": autorest.Encode("path", externalCloudProviderType), - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExternalCloudProviderUsageSender sends the ExternalCloudProviderUsage request. The method will close the -// http.Response Body if it receives an error. -func (client ForecastClient) ExternalCloudProviderUsageSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ExternalCloudProviderUsageResponder handles the response to the ExternalCloudProviderUsage request. The method always -// closes the http.Response Body. -func (client ForecastClient) ExternalCloudProviderUsageResponder(resp *http.Response) (result QueryResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Usage lists the forecast charges for scope defined. -// Parameters: -// scope - the scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for -// subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for -// Management Group scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// billingProfile scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for -// partners. -// parameters - parameters supplied to the CreateOrUpdate Forecast Config operation. -// filter - may be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or -// properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support -// 'ne', 'or', or 'not'. -func (client ForecastClient) Usage(ctx context.Context, scope string, parameters ForecastDefinition, filter string) (result QueryResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ForecastClient.Usage") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TimePeriod", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TimePeriod.From", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TimePeriod.To", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.Dataset", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.And", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.And", Name: validation.MinItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.Dataset.Filter.Or", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Or", Name: validation.MinItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.Dataset.Filter.Not", Name: validation.Null, Rule: false, Chain: nil}, - {Target: "parameters.Dataset.Filter.Dimension", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Dimension.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Dimension.Operator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Dimension.Values", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Dimension.Values", Name: validation.MinItems, Rule: 1, Chain: nil}}}, - }}, - {Target: "parameters.Dataset.Filter.Tag", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Tag.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Tag.Operator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Tag.Values", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Tag.Values", Name: validation.MinItems, Rule: 1, Chain: nil}}}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("costmanagement.ForecastClient", "Usage", err.Error()) - } - - req, err := client.UsagePreparer(ctx, scope, parameters, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ForecastClient", "Usage", nil, "Failure preparing request") - return - } - - resp, err := client.UsageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.ForecastClient", "Usage", resp, "Failure sending request") - return - } - - result, err = client.UsageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ForecastClient", "Usage", resp, "Failure responding to request") - return - } - - return -} - -// UsagePreparer prepares the Usage request. -func (client ForecastClient) UsagePreparer(ctx context.Context, scope string, parameters ForecastDefinition, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/forecast", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UsageSender sends the Usage request. The method will close the -// http.Response Body if it receives an error. -func (client ForecastClient) UsageSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// UsageResponder handles the response to the Usage request. The method always -// closes the http.Response Body. -func (client ForecastClient) UsageResponder(resp *http.Response) (result QueryResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/models.go deleted file mode 100644 index c7d565ccb06..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/models.go +++ /dev/null @@ -1,1773 +0,0 @@ -package costmanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "github.com/shopspring/decimal" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement" - -// Alert an individual alert. -type Alert struct { - autorest.Response `json:"-"` - *AlertProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Tags - READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Alert. -func (a Alert) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.AlertProperties != nil { - objectMap["properties"] = a.AlertProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Alert struct. -func (a *Alert) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var alertProperties AlertProperties - err = json.Unmarshal(*v, &alertProperties) - if err != nil { - return err - } - a.AlertProperties = &alertProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - a.Tags = tags - } - } - } - - return nil -} - -// AlertProperties ... -type AlertProperties struct { - // Definition - defines the type of alert - Definition *AlertPropertiesDefinition `json:"definition,omitempty"` - // Description - Alert description - Description *string `json:"description,omitempty"` - // Source - Source of alert. Possible values include: 'Preset', 'User' - Source AlertSource `json:"source,omitempty"` - // Details - Alert details - Details *AlertPropertiesDetails `json:"details,omitempty"` - // CostEntityID - related budget - CostEntityID *string `json:"costEntityId,omitempty"` - // Status - alert status. Possible values include: 'AlertStatusNone', 'AlertStatusActive', 'AlertStatusOverridden', 'AlertStatusResolved', 'AlertStatusDismissed' - Status AlertStatus `json:"status,omitempty"` - // CreationTime - dateTime in which alert was created - CreationTime *string `json:"creationTime,omitempty"` - // CloseTime - dateTime in which alert was closed - CloseTime *string `json:"closeTime,omitempty"` - // ModificationTime - dateTime in which alert was last modified - ModificationTime *string `json:"modificationTime,omitempty"` - StatusModificationUserName *string `json:"statusModificationUserName,omitempty"` - // StatusModificationTime - dateTime in which the alert status was last modified - StatusModificationTime *string `json:"statusModificationTime,omitempty"` -} - -// AlertPropertiesDefinition defines the type of alert -type AlertPropertiesDefinition struct { - // Type - type of alert. Possible values include: 'Budget', 'Invoice', 'Credit', 'Quota', 'General', 'XCloud', 'BudgetForecast' - Type AlertType `json:"type,omitempty"` - // Category - Alert category. Possible values include: 'Cost', 'Usage', 'Billing', 'System' - Category AlertCategory `json:"category,omitempty"` - // Criteria - Criteria that triggered alert. Possible values include: 'CostThresholdExceeded', 'UsageThresholdExceeded', 'CreditThresholdApproaching', 'CreditThresholdReached', 'QuotaThresholdApproaching', 'QuotaThresholdReached', 'MultiCurrency', 'ForecastCostThresholdExceeded', 'ForecastUsageThresholdExceeded', 'InvoiceDueDateApproaching', 'InvoiceDueDateReached', 'CrossCloudNewDataAvailable', 'CrossCloudCollectionError', 'GeneralThresholdError' - Criteria AlertCriteria `json:"criteria,omitempty"` -} - -// AlertPropertiesDetails alert details -type AlertPropertiesDetails struct { - // TimeGrainType - Type of timegrain cadence. Possible values include: 'AlertTimeGrainTypeNone', 'AlertTimeGrainTypeMonthly', 'AlertTimeGrainTypeQuarterly', 'AlertTimeGrainTypeAnnually', 'AlertTimeGrainTypeBillingMonth', 'AlertTimeGrainTypeBillingQuarter', 'AlertTimeGrainTypeBillingAnnual' - TimeGrainType AlertTimeGrainType `json:"timeGrainType,omitempty"` - // PeriodStartDate - datetime of periodStartDate - PeriodStartDate *string `json:"periodStartDate,omitempty"` - // TriggeredBy - notificationId that triggered this alert - TriggeredBy *string `json:"triggeredBy,omitempty"` - // ResourceGroupFilter - array of resourceGroups to filter by - ResourceGroupFilter *[]interface{} `json:"resourceGroupFilter,omitempty"` - // ResourceFilter - array of resources to filter by - ResourceFilter *[]interface{} `json:"resourceFilter,omitempty"` - // MeterFilter - array of meters to filter by - MeterFilter *[]interface{} `json:"meterFilter,omitempty"` - // TagFilter - tags to filter by - TagFilter interface{} `json:"tagFilter,omitempty"` - // Threshold - notification threshold percentage as a decimal which activated this alert - Threshold *decimal.Decimal `json:"threshold,omitempty"` - // Operator - operator used to compare currentSpend with amount. Possible values include: 'None', 'EqualTo', 'GreaterThan', 'GreaterThanOrEqualTo', 'LessThan', 'LessThanOrEqualTo' - Operator AlertOperator `json:"operator,omitempty"` - // Amount - budget threshold amount - Amount *decimal.Decimal `json:"amount,omitempty"` - // Unit - unit of currency being used - Unit *string `json:"unit,omitempty"` - // CurrentSpend - current spend - CurrentSpend *decimal.Decimal `json:"currentSpend,omitempty"` - // ContactEmails - list of emails to contact - ContactEmails *[]string `json:"contactEmails,omitempty"` - // ContactGroups - list of action groups to broadcast to - ContactGroups *[]string `json:"contactGroups,omitempty"` - // ContactRoles - list of contact roles - ContactRoles *[]string `json:"contactRoles,omitempty"` - // OverridingAlert - overriding alert - OverridingAlert *string `json:"overridingAlert,omitempty"` -} - -// AlertsResult result of alerts. -type AlertsResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of alerts. - Value *[]Alert `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of alerts results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for AlertsResult. -func (ar AlertsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CommonExportProperties the common properties of the export. -type CommonExportProperties struct { - // Format - The format of the export being delivered. Currently only 'Csv' is supported. Possible values include: 'Csv' - Format FormatType `json:"format,omitempty"` - // DeliveryInfo - Has delivery information for the export. - DeliveryInfo *ExportDeliveryInfo `json:"deliveryInfo,omitempty"` - // Definition - Has the definition for the export. - Definition *ExportDefinition `json:"definition,omitempty"` - // RunHistory - If requested, has the most recent execution history for the export. - RunHistory *ExportExecutionListResult `json:"runHistory,omitempty"` - // NextRunTimeEstimate - READ-ONLY; If the export has an active schedule, provides an estimate of the next execution time. - NextRunTimeEstimate *date.Time `json:"nextRunTimeEstimate,omitempty"` -} - -// MarshalJSON is the custom marshaler for CommonExportProperties. -func (cep CommonExportProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cep.Format != "" { - objectMap["format"] = cep.Format - } - if cep.DeliveryInfo != nil { - objectMap["deliveryInfo"] = cep.DeliveryInfo - } - if cep.Definition != nil { - objectMap["definition"] = cep.Definition - } - if cep.RunHistory != nil { - objectMap["runHistory"] = cep.RunHistory - } - return json.Marshal(objectMap) -} - -// Dimension ... -type Dimension struct { - *DimensionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Tags - READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Dimension. -func (d Dimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.DimensionProperties != nil { - objectMap["properties"] = d.DimensionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Dimension struct. -func (d *Dimension) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var dimensionProperties DimensionProperties - err = json.Unmarshal(*v, &dimensionProperties) - if err != nil { - return err - } - d.DimensionProperties = &dimensionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - d.Tags = tags - } - } - } - - return nil -} - -// DimensionProperties ... -type DimensionProperties struct { - // Description - READ-ONLY; Dimension description. - Description *string `json:"description,omitempty"` - // FilterEnabled - READ-ONLY; Filter enabled. - FilterEnabled *bool `json:"filterEnabled,omitempty"` - // GroupingEnabled - READ-ONLY; Grouping enabled. - GroupingEnabled *bool `json:"groupingEnabled,omitempty"` - Data *[]string `json:"data,omitempty"` - // Total - READ-ONLY; Total number of data for the dimension. - Total *int32 `json:"total,omitempty"` - // Category - READ-ONLY; Dimension category. - Category *string `json:"category,omitempty"` - // UsageStart - READ-ONLY; Usage start. - UsageStart *date.Time `json:"usageStart,omitempty"` - // UsageEnd - READ-ONLY; Usage end. - UsageEnd *date.Time `json:"usageEnd,omitempty"` - // NextLink - READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DimensionProperties. -func (dp DimensionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.Data != nil { - objectMap["data"] = dp.Data - } - return json.Marshal(objectMap) -} - -// DimensionsListResult result of listing dimensions. It contains a list of available dimensions. -type DimensionsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of dimensions. - Value *[]Dimension `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for DimensionsListResult. -func (dlr DimensionsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DismissAlertPayload the request payload to update an alert -type DismissAlertPayload struct { - *AlertProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for DismissAlertPayload. -func (dap DismissAlertPayload) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dap.AlertProperties != nil { - objectMap["properties"] = dap.AlertProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DismissAlertPayload struct. -func (dap *DismissAlertPayload) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var alertProperties AlertProperties - err = json.Unmarshal(*v, &alertProperties) - if err != nil { - return err - } - dap.AlertProperties = &alertProperties - } - } - } - - return nil -} - -// ErrorDetails the details of the error. -type ErrorDetails struct { - // Code - READ-ONLY; Error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorDetails. -func (ed ErrorDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse error response indicates that the service is not able to process the incoming request. The -// reason is provided in the error message. -// -// Some Error responses: -// -// * 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the -// "x-ms-ratelimit-microsoft.consumption-retry-after" header. -// -// * 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time -// specified in the "Retry-After" header. -type ErrorResponse struct { - // Error - The details of the error. - Error *ErrorDetails `json:"error,omitempty"` -} - -// Export an export resource. -type Export struct { - autorest.Response `json:"-"` - *ExportProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ETag - eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. - ETag *string `json:"eTag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Export. -func (e Export) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if e.ExportProperties != nil { - objectMap["properties"] = e.ExportProperties - } - if e.ETag != nil { - objectMap["eTag"] = e.ETag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Export struct. -func (e *Export) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var exportProperties ExportProperties - err = json.Unmarshal(*v, &exportProperties) - if err != nil { - return err - } - e.ExportProperties = &exportProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - e.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - e.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - e.Type = &typeVar - } - case "eTag": - if v != nil { - var eTag string - err = json.Unmarshal(*v, &eTag) - if err != nil { - return err - } - e.ETag = &eTag - } - } - } - - return nil -} - -// ExportDataset the definition for data in the export. -type ExportDataset struct { - // Granularity - The granularity of rows in the export. Currently only 'Daily' is supported. Possible values include: 'Daily' - Granularity GranularityType `json:"granularity,omitempty"` - // Configuration - The export dataset configuration. - Configuration *ExportDatasetConfiguration `json:"configuration,omitempty"` -} - -// ExportDatasetConfiguration the export dataset configuration. Allows columns to be selected for the -// export. If not provided then the export will include all available columns. -type ExportDatasetConfiguration struct { - // Columns - Array of column names to be included in the export. If not provided then the export will include all available columns. The available columns can vary by customer channel (see examples). - Columns *[]string `json:"columns,omitempty"` -} - -// ExportDefinition the definition of an export. -type ExportDefinition struct { - // Type - The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service reservations. Possible values include: 'ExportTypeUsage', 'ExportTypeActualCost', 'ExportTypeAmortizedCost' - Type ExportType `json:"type,omitempty"` - // Timeframe - The time frame for pulling data for the export. If custom, then a specific time period must be provided. Possible values include: 'TimeframeTypeMonthToDate', 'TimeframeTypeBillingMonthToDate', 'TimeframeTypeTheLastMonth', 'TimeframeTypeTheLastBillingMonth', 'TimeframeTypeWeekToDate', 'TimeframeTypeCustom' - Timeframe TimeframeType `json:"timeframe,omitempty"` - // TimePeriod - Has time period for pulling data for the export. - TimePeriod *ExportTimePeriod `json:"timePeriod,omitempty"` - // DataSet - The definition for data in the export. - DataSet *ExportDataset `json:"dataSet,omitempty"` -} - -// ExportDeliveryDestination the destination information for the delivery of the export. To allow access to -// a storage account, you must register the account's subscription with the Microsoft.CostManagementExports -// resource provider. This is required once per subscription. When creating an export in the Azure portal, -// it is done automatically, however API users need to register the subscription. For more information see -// https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services . -type ExportDeliveryDestination struct { - // ResourceID - The resource id of the storage account where exports will be delivered. - ResourceID *string `json:"resourceId,omitempty"` - // Container - The name of the container where exports will be uploaded. - Container *string `json:"container,omitempty"` - // RootFolderPath - The name of the directory where exports will be uploaded. - RootFolderPath *string `json:"rootFolderPath,omitempty"` -} - -// ExportDeliveryInfo the delivery information associated with a export. -type ExportDeliveryInfo struct { - // Destination - Has destination for the export being delivered. - Destination *ExportDeliveryDestination `json:"destination,omitempty"` -} - -// ExportExecution an export execution. -type ExportExecution struct { - *ExportExecutionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ETag - eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. - ETag *string `json:"eTag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExportExecution. -func (ee ExportExecution) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ee.ExportExecutionProperties != nil { - objectMap["properties"] = ee.ExportExecutionProperties - } - if ee.ETag != nil { - objectMap["eTag"] = ee.ETag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExportExecution struct. -func (ee *ExportExecution) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var exportExecutionProperties ExportExecutionProperties - err = json.Unmarshal(*v, &exportExecutionProperties) - if err != nil { - return err - } - ee.ExportExecutionProperties = &exportExecutionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ee.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ee.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ee.Type = &typeVar - } - case "eTag": - if v != nil { - var eTag string - err = json.Unmarshal(*v, &eTag) - if err != nil { - return err - } - ee.ETag = &eTag - } - } - } - - return nil -} - -// ExportExecutionListResult result of listing the execution history of an export. -type ExportExecutionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; A list of export executions. - Value *[]ExportExecution `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExportExecutionListResult. -func (eelr ExportExecutionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ExportExecutionProperties the properties of the export execution. -type ExportExecutionProperties struct { - // ExecutionType - The type of the export execution. Possible values include: 'OnDemand', 'Scheduled' - ExecutionType ExecutionType `json:"executionType,omitempty"` - // Status - The last known status of the export execution. Possible values include: 'Queued', 'InProgress', 'Completed', 'Failed', 'Timeout', 'NewDataNotAvailable', 'DataNotAvailable' - Status ExecutionStatus `json:"status,omitempty"` - // SubmittedBy - The identifier for the entity that executed the export. For OnDemand executions it is the user email. For scheduled executions it is 'System'. - SubmittedBy *string `json:"submittedBy,omitempty"` - // SubmittedTime - The time when export was queued to be executed. - SubmittedTime *date.Time `json:"submittedTime,omitempty"` - // ProcessingStartTime - The time when export was picked up to be executed. - ProcessingStartTime *date.Time `json:"processingStartTime,omitempty"` - // ProcessingEndTime - The time when the export execution finished. - ProcessingEndTime *date.Time `json:"processingEndTime,omitempty"` - // FileName - The name of the exported file. - FileName *string `json:"fileName,omitempty"` - // RunSettings - The export settings that were in effect for this execution. - RunSettings *CommonExportProperties `json:"runSettings,omitempty"` - // Error - The details of any error. - Error *ErrorDetails `json:"error,omitempty"` -} - -// ExportListResult result of listing exports. It contains a list of available exports in the scope -// provided. -type ExportListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of exports. - Value *[]Export `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExportListResult. -func (elr ExportListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ExportProperties the properties of the export. -type ExportProperties struct { - // Schedule - Has schedule information for the export. - Schedule *ExportSchedule `json:"schedule,omitempty"` - // Format - The format of the export being delivered. Currently only 'Csv' is supported. Possible values include: 'Csv' - Format FormatType `json:"format,omitempty"` - // DeliveryInfo - Has delivery information for the export. - DeliveryInfo *ExportDeliveryInfo `json:"deliveryInfo,omitempty"` - // Definition - Has the definition for the export. - Definition *ExportDefinition `json:"definition,omitempty"` - // RunHistory - If requested, has the most recent execution history for the export. - RunHistory *ExportExecutionListResult `json:"runHistory,omitempty"` - // NextRunTimeEstimate - READ-ONLY; If the export has an active schedule, provides an estimate of the next execution time. - NextRunTimeEstimate *date.Time `json:"nextRunTimeEstimate,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExportProperties. -func (ep ExportProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ep.Schedule != nil { - objectMap["schedule"] = ep.Schedule - } - if ep.Format != "" { - objectMap["format"] = ep.Format - } - if ep.DeliveryInfo != nil { - objectMap["deliveryInfo"] = ep.DeliveryInfo - } - if ep.Definition != nil { - objectMap["definition"] = ep.Definition - } - if ep.RunHistory != nil { - objectMap["runHistory"] = ep.RunHistory - } - return json.Marshal(objectMap) -} - -// ExportRecurrencePeriod the start and end date for recurrence schedule. -type ExportRecurrencePeriod struct { - // From - The start date of recurrence. - From *date.Time `json:"from,omitempty"` - // To - The end date of recurrence. - To *date.Time `json:"to,omitempty"` -} - -// ExportSchedule the schedule associated with the export. -type ExportSchedule struct { - // Status - The status of the export's schedule. If 'Inactive', the export's schedule is paused. Possible values include: 'Active', 'Inactive' - Status StatusType `json:"status,omitempty"` - // Recurrence - The schedule recurrence. Possible values include: 'RecurrenceTypeDaily', 'RecurrenceTypeWeekly', 'RecurrenceTypeMonthly', 'RecurrenceTypeAnnually' - Recurrence RecurrenceType `json:"recurrence,omitempty"` - // RecurrencePeriod - Has start and end date of the recurrence. The start date must be in future. If present, the end date must be greater than start date. - RecurrencePeriod *ExportRecurrencePeriod `json:"recurrencePeriod,omitempty"` -} - -// ExportTimePeriod the date range for data in the export. This should only be specified with timeFrame set -// to 'Custom'. The maximum date range is 3 months. -type ExportTimePeriod struct { - // From - The start date for export data. - From *date.Time `json:"from,omitempty"` - // To - The end date for export data. - To *date.Time `json:"to,omitempty"` -} - -// ForecastDataset the definition of data present in the forecast. -type ForecastDataset struct { - // Granularity - The granularity of rows in the forecast. Possible values include: 'Daily' - Granularity GranularityType `json:"granularity,omitempty"` - // Configuration - Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided. - Configuration *QueryDatasetConfiguration `json:"configuration,omitempty"` - // Aggregation - Dictionary of aggregation expression to use in the forecast. The key of each item in the dictionary is the alias for the aggregated column. forecast can have up to 2 aggregation clauses. - Aggregation map[string]*QueryAggregation `json:"aggregation"` - // Filter - Has filter expression to use in the forecast. - Filter *QueryFilter `json:"filter,omitempty"` -} - -// MarshalJSON is the custom marshaler for ForecastDataset. -func (fd ForecastDataset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fd.Granularity != "" { - objectMap["granularity"] = fd.Granularity - } - if fd.Configuration != nil { - objectMap["configuration"] = fd.Configuration - } - if fd.Aggregation != nil { - objectMap["aggregation"] = fd.Aggregation - } - if fd.Filter != nil { - objectMap["filter"] = fd.Filter - } - return json.Marshal(objectMap) -} - -// ForecastDefinition the definition of a forecast. -type ForecastDefinition struct { - // Type - The type of the forecast. Possible values include: 'ForecastTypeUsage', 'ForecastTypeActualCost', 'ForecastTypeAmortizedCost' - Type ForecastType `json:"type,omitempty"` - // Timeframe - The time frame for pulling data for the forecast. If custom, then a specific time period must be provided. Possible values include: 'MonthToDate', 'BillingMonthToDate', 'TheLastMonth', 'TheLastBillingMonth', 'WeekToDate', 'Custom' - Timeframe ForecastTimeframeType `json:"timeframe,omitempty"` - // TimePeriod - Has time period for pulling data for the forecast. - TimePeriod *QueryTimePeriod `json:"timePeriod,omitempty"` - // Dataset - Has definition for data in this forecast. - Dataset *ForecastDataset `json:"dataset,omitempty"` - // IncludeActualCost - a boolean determining if actualCost will be included - IncludeActualCost *bool `json:"includeActualCost,omitempty"` - // IncludeFreshPartialCost - a boolean determining if FreshPartialCost will be included - IncludeFreshPartialCost *bool `json:"includeFreshPartialCost,omitempty"` -} - -// KpiProperties each KPI must contain a 'type' and 'enabled' key. -type KpiProperties struct { - // Type - KPI type (Forecast, Budget). Possible values include: 'KpiTypeTypeForecast', 'KpiTypeTypeBudget' - Type KpiTypeType `json:"type,omitempty"` - // ID - ID of resource related to metric (budget). - ID *string `json:"id,omitempty"` - // Enabled - show the KPI in the UI? - Enabled *bool `json:"enabled,omitempty"` -} - -// Operation a Cost management REST API operation. -type Operation struct { - // Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty"` - // Display - The object that represents the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if o.Display != nil { - objectMap["display"] = o.Display - } - return json.Marshal(objectMap) -} - -// OperationDisplay the object that represents the operation. -type OperationDisplay struct { - // Provider - READ-ONLY; Service provider: Microsoft.CostManagement. - Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; Resource on which the operation is performed: Dimensions, Query. - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResult result of listing cost management operations. It contains a list of operations and a -// URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of cost management operations supported by the Microsoft.CostManagement resource provider. - Value *[]Operation `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// PivotProperties each pivot must contain a 'type' and 'name'. -type PivotProperties struct { - // Type - Data type to show in view. Possible values include: 'PivotTypeTypeDimension', 'PivotTypeTypeTagKey' - Type PivotTypeType `json:"type,omitempty"` - // Name - Data field to show in view. - Name *string `json:"name,omitempty"` -} - -// ProxyResource the Resource model definition. -type ProxyResource struct { - // ID - READ-ONLY; Resource Id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ETag - eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. - ETag *string `json:"eTag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pr.ETag != nil { - objectMap["eTag"] = pr.ETag - } - return json.Marshal(objectMap) -} - -// QueryAggregation the aggregation expression to be used in the query. -type QueryAggregation struct { - // Name - The name of the column to aggregate. - Name *string `json:"name,omitempty"` - // Function - The name of the aggregation function to use. - Function *string `json:"function,omitempty"` -} - -// QueryColumn ... -type QueryColumn struct { - // Name - The name of column. - Name *string `json:"name,omitempty"` - // Type - The type of column. - Type *string `json:"type,omitempty"` -} - -// QueryComparisonExpression the comparison expression to be used in the query. -type QueryComparisonExpression struct { - // Name - The name of the column to use in comparison. - Name *string `json:"name,omitempty"` - // Operator - The operator to use for comparison. - Operator *string `json:"operator,omitempty"` - // Values - Array of values to use for comparison - Values *[]string `json:"values,omitempty"` -} - -// QueryDataset the definition of data present in the query. -type QueryDataset struct { - // Granularity - The granularity of rows in the query. Possible values include: 'Daily' - Granularity GranularityType `json:"granularity,omitempty"` - // Configuration - Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided. - Configuration *QueryDatasetConfiguration `json:"configuration,omitempty"` - // Aggregation - Dictionary of aggregation expression to use in the query. The key of each item in the dictionary is the alias for the aggregated column. Query can have up to 2 aggregation clauses. - Aggregation map[string]*QueryAggregation `json:"aggregation"` - // Grouping - Array of group by expression to use in the query. Query can have up to 2 group by clauses. - Grouping *[]QueryGrouping `json:"grouping,omitempty"` - // Filter - Has filter expression to use in the query. - Filter *QueryFilter `json:"filter,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryDataset. -func (qd QueryDataset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if qd.Granularity != "" { - objectMap["granularity"] = qd.Granularity - } - if qd.Configuration != nil { - objectMap["configuration"] = qd.Configuration - } - if qd.Aggregation != nil { - objectMap["aggregation"] = qd.Aggregation - } - if qd.Grouping != nil { - objectMap["grouping"] = qd.Grouping - } - if qd.Filter != nil { - objectMap["filter"] = qd.Filter - } - return json.Marshal(objectMap) -} - -// QueryDatasetConfiguration the configuration of dataset in the query. -type QueryDatasetConfiguration struct { - // Columns - Array of column names to be included in the query. Any valid query column name is allowed. If not provided, then query includes all columns. - Columns *[]string `json:"columns,omitempty"` -} - -// QueryDefinition the definition of a query. -type QueryDefinition struct { - // Type - The type of the query. Possible values include: 'ExportTypeUsage', 'ExportTypeActualCost', 'ExportTypeAmortizedCost' - Type ExportType `json:"type,omitempty"` - // Timeframe - The time frame for pulling data for the query. If custom, then a specific time period must be provided. Possible values include: 'TimeframeTypeMonthToDate', 'TimeframeTypeBillingMonthToDate', 'TimeframeTypeTheLastMonth', 'TimeframeTypeTheLastBillingMonth', 'TimeframeTypeWeekToDate', 'TimeframeTypeCustom' - Timeframe TimeframeType `json:"timeframe,omitempty"` - // TimePeriod - Has time period for pulling data for the query. - TimePeriod *QueryTimePeriod `json:"timePeriod,omitempty"` - // Dataset - Has definition for data in this query. - Dataset *QueryDataset `json:"dataset,omitempty"` -} - -// QueryFilter the filter expression to be used in the export. -type QueryFilter struct { - // And - The logical "AND" expression. Must have at least 2 items. - And *[]QueryFilter `json:"and,omitempty"` - // Or - The logical "OR" expression. Must have at least 2 items. - Or *[]QueryFilter `json:"or,omitempty"` - // Not - The logical "NOT" expression. - Not *QueryFilter `json:"not,omitempty"` - // Dimension - Has comparison expression for a dimension - Dimension *QueryComparisonExpression `json:"dimension,omitempty"` - // Tag - Has comparison expression for a tag - Tag *QueryComparisonExpression `json:"tag,omitempty"` -} - -// QueryGrouping the group by expression to be used in the query. -type QueryGrouping struct { - // Type - Has type of the column to group. Possible values include: 'QueryColumnTypeTag', 'QueryColumnTypeDimension' - Type QueryColumnType `json:"type,omitempty"` - // Name - The name of the column to group. - Name *string `json:"name,omitempty"` -} - -// QueryProperties ... -type QueryProperties struct { - // NextLink - The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty"` - // Columns - Array of columns - Columns *[]QueryColumn `json:"columns,omitempty"` - // Rows - Array of rows - Rows *[][]interface{} `json:"rows,omitempty"` -} - -// QueryResult result of query. It contains all columns listed under groupings and aggregation. -type QueryResult struct { - autorest.Response `json:"-"` - *QueryProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Tags - READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for QueryResult. -func (qr QueryResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if qr.QueryProperties != nil { - objectMap["properties"] = qr.QueryProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for QueryResult struct. -func (qr *QueryResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var queryProperties QueryProperties - err = json.Unmarshal(*v, &queryProperties) - if err != nil { - return err - } - qr.QueryProperties = &queryProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - qr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - qr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - qr.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - qr.Tags = tags - } - } - } - - return nil -} - -// QueryTimePeriod the start and end date for pulling data for the query. -type QueryTimePeriod struct { - // From - The start date to pull data from. - From *date.Time `json:"from,omitempty"` - // To - The end date to pull data to. - To *date.Time `json:"to,omitempty"` -} - -// ReportConfigAggregation the aggregation expression to be used in the report. -type ReportConfigAggregation struct { - // Name - The name of the column to aggregate. - Name *string `json:"name,omitempty"` - // Function - The name of the aggregation function to use. - Function *string `json:"function,omitempty"` -} - -// ReportConfigComparisonExpression the comparison expression to be used in the report. -type ReportConfigComparisonExpression struct { - // Name - The name of the column to use in comparison. - Name *string `json:"name,omitempty"` - // Operator - The operator to use for comparison. Possible values include: 'In', 'Contains' - Operator OperatorType `json:"operator,omitempty"` - // Values - Array of values to use for comparison - Values *[]string `json:"values,omitempty"` -} - -// ReportConfigDataset the definition of data present in the report. -type ReportConfigDataset struct { - // Granularity - The granularity of rows in the report. Possible values include: 'ReportGranularityTypeDaily', 'ReportGranularityTypeMonthly' - Granularity ReportGranularityType `json:"granularity,omitempty"` - // Configuration - Has configuration information for the data in the report. The configuration will be ignored if aggregation and grouping are provided. - Configuration *ReportConfigDatasetConfiguration `json:"configuration,omitempty"` - // Aggregation - Dictionary of aggregation expression to use in the report. The key of each item in the dictionary is the alias for the aggregated column. Report can have up to 2 aggregation clauses. - Aggregation map[string]*ReportConfigAggregation `json:"aggregation"` - // Grouping - Array of group by expression to use in the report. Report can have up to 2 group by clauses. - Grouping *[]ReportConfigGrouping `json:"grouping,omitempty"` - // Sorting - Array of order by expression to use in the report. - Sorting *[]ReportConfigSorting `json:"sorting,omitempty"` - // Filter - Has filter expression to use in the report. - Filter *ReportConfigFilter `json:"filter,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReportConfigDataset. -func (rcd ReportConfigDataset) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rcd.Granularity != "" { - objectMap["granularity"] = rcd.Granularity - } - if rcd.Configuration != nil { - objectMap["configuration"] = rcd.Configuration - } - if rcd.Aggregation != nil { - objectMap["aggregation"] = rcd.Aggregation - } - if rcd.Grouping != nil { - objectMap["grouping"] = rcd.Grouping - } - if rcd.Sorting != nil { - objectMap["sorting"] = rcd.Sorting - } - if rcd.Filter != nil { - objectMap["filter"] = rcd.Filter - } - return json.Marshal(objectMap) -} - -// ReportConfigDatasetConfiguration the configuration of dataset in the report. -type ReportConfigDatasetConfiguration struct { - // Columns - Array of column names to be included in the report. Any valid report column name is allowed. If not provided, then report includes all columns. - Columns *[]string `json:"columns,omitempty"` -} - -// ReportConfigDefinition the definition of a report config. -type ReportConfigDefinition struct { - // Type - The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast represents both usage and forecasted data. Actual usage and forecasted data can be differentiated based on dates. - Type *string `json:"type,omitempty"` - // Timeframe - The time frame for pulling data for the report. If custom, then a specific time period must be provided. Possible values include: 'ReportTimeframeTypeWeekToDate', 'ReportTimeframeTypeMonthToDate', 'ReportTimeframeTypeYearToDate', 'ReportTimeframeTypeCustom' - Timeframe ReportTimeframeType `json:"timeframe,omitempty"` - // TimePeriod - Has time period for pulling data for the report. - TimePeriod *ReportConfigTimePeriod `json:"timePeriod,omitempty"` - // Dataset - Has definition for data in this report config. - Dataset *ReportConfigDataset `json:"dataset,omitempty"` -} - -// ReportConfigFilter the filter expression to be used in the report. -type ReportConfigFilter struct { - // And - The logical "AND" expression. Must have at least 2 items. - And *[]ReportConfigFilter `json:"and,omitempty"` - // Or - The logical "OR" expression. Must have at least 2 items. - Or *[]ReportConfigFilter `json:"or,omitempty"` - // Not - The logical "NOT" expression. - Not *ReportConfigFilter `json:"not,omitempty"` - // Dimension - Has comparison expression for a dimension - Dimension *ReportConfigComparisonExpression `json:"dimension,omitempty"` - // Tag - Has comparison expression for a tag - Tag *ReportConfigComparisonExpression `json:"tag,omitempty"` -} - -// ReportConfigGrouping the group by expression to be used in the report. -type ReportConfigGrouping struct { - // Type - Has type of the column to group. Possible values include: 'ReportConfigColumnTypeTag', 'ReportConfigColumnTypeDimension' - Type ReportConfigColumnType `json:"type,omitempty"` - // Name - The name of the column to group. This version supports subscription lowest possible grain. - Name *string `json:"name,omitempty"` -} - -// ReportConfigSorting the order by expression to be used in the report. -type ReportConfigSorting struct { - // Direction - Direction of sort. Possible values include: 'Ascending', 'Descending' - Direction Direction `json:"direction,omitempty"` - // Name - The name of the column to sort. - Name *string `json:"name,omitempty"` -} - -// ReportConfigTimePeriod the start and end date for pulling data for the report. -type ReportConfigTimePeriod struct { - // From - The start date to pull data from. - From *date.Time `json:"from,omitempty"` - // To - The end date to pull data to. - To *date.Time `json:"to,omitempty"` -} - -// Resource the Resource model definition. -type Resource struct { - // ID - READ-ONLY; Resource Id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Tags - READ-ONLY; Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// View states and configurations of Cost Analysis. -type View struct { - autorest.Response `json:"-"` - *ViewProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // ETag - eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. - ETag *string `json:"eTag,omitempty"` -} - -// MarshalJSON is the custom marshaler for View. -func (vVar View) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vVar.ViewProperties != nil { - objectMap["properties"] = vVar.ViewProperties - } - if vVar.ETag != nil { - objectMap["eTag"] = vVar.ETag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for View struct. -func (vVar *View) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var viewProperties ViewProperties - err = json.Unmarshal(*v, &viewProperties) - if err != nil { - return err - } - vVar.ViewProperties = &viewProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vVar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vVar.Type = &typeVar - } - case "eTag": - if v != nil { - var eTag string - err = json.Unmarshal(*v, &eTag) - if err != nil { - return err - } - vVar.ETag = &eTag - } - } - } - - return nil -} - -// ViewListResult result of listing views. It contains a list of available views. -type ViewListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of views. - Value *[]View `json:"value,omitempty"` - // NextLink - READ-ONLY; The link (url) to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ViewListResult. -func (vlr ViewListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ViewListResultIterator provides access to a complete listing of View values. -type ViewListResultIterator struct { - i int - page ViewListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ViewListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ViewListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ViewListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ViewListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ViewListResultIterator) Response() ViewListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ViewListResultIterator) Value() View { - if !iter.page.NotDone() { - return View{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ViewListResultIterator type. -func NewViewListResultIterator(page ViewListResultPage) ViewListResultIterator { - return ViewListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vlr ViewListResult) IsEmpty() bool { - return vlr.Value == nil || len(*vlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vlr ViewListResult) hasNextLink() bool { - return vlr.NextLink != nil && len(*vlr.NextLink) != 0 -} - -// viewListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vlr ViewListResult) viewListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vlr.NextLink))) -} - -// ViewListResultPage contains a page of View values. -type ViewListResultPage struct { - fn func(context.Context, ViewListResult) (ViewListResult, error) - vlr ViewListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ViewListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ViewListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vlr) - if err != nil { - return err - } - page.vlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ViewListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ViewListResultPage) NotDone() bool { - return !page.vlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ViewListResultPage) Response() ViewListResult { - return page.vlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ViewListResultPage) Values() []View { - if page.vlr.IsEmpty() { - return nil - } - return *page.vlr.Value -} - -// Creates a new instance of the ViewListResultPage type. -func NewViewListResultPage(cur ViewListResult, getNextPage func(context.Context, ViewListResult) (ViewListResult, error)) ViewListResultPage { - return ViewListResultPage{ - fn: getNextPage, - vlr: cur, - } -} - -// ViewProperties the properties of the view. -type ViewProperties struct { - // DisplayName - User input name of the view. Required. - DisplayName *string `json:"displayName,omitempty"` - // Scope - Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. - Scope *string `json:"scope,omitempty"` - // CreatedOn - READ-ONLY; Date the user created this view. - CreatedOn *date.Time `json:"createdOn,omitempty"` - // ModifiedOn - READ-ONLY; Date when the user last modified this view. - ModifiedOn *date.Time `json:"modifiedOn,omitempty"` - // ReportConfigDefinition - Query body configuration. Required. - *ReportConfigDefinition `json:"query,omitempty"` - // Chart - Chart type of the main view in Cost Analysis. Required. Possible values include: 'Area', 'Line', 'StackedColumn', 'GroupedColumn', 'Table' - Chart ChartType `json:"chart,omitempty"` - // Accumulated - Show costs accumulated over time. Possible values include: 'True', 'False' - Accumulated AccumulatedType `json:"accumulated,omitempty"` - // Metric - Metric to use when displaying costs. Possible values include: 'ActualCost', 'AmortizedCost', 'AHUB' - Metric MetricType `json:"metric,omitempty"` - // Kpis - List of KPIs to show in Cost Analysis UI. - Kpis *[]KpiProperties `json:"kpis,omitempty"` - // Pivots - Configuration of 3 sub-views in the Cost Analysis UI. - Pivots *[]PivotProperties `json:"pivots,omitempty"` -} - -// MarshalJSON is the custom marshaler for ViewProperties. -func (vp ViewProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vp.DisplayName != nil { - objectMap["displayName"] = vp.DisplayName - } - if vp.Scope != nil { - objectMap["scope"] = vp.Scope - } - if vp.ReportConfigDefinition != nil { - objectMap["query"] = vp.ReportConfigDefinition - } - if vp.Chart != "" { - objectMap["chart"] = vp.Chart - } - if vp.Accumulated != "" { - objectMap["accumulated"] = vp.Accumulated - } - if vp.Metric != "" { - objectMap["metric"] = vp.Metric - } - if vp.Kpis != nil { - objectMap["kpis"] = vp.Kpis - } - if vp.Pivots != nil { - objectMap["pivots"] = vp.Pivots - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ViewProperties struct. -func (vp *ViewProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "displayName": - if v != nil { - var displayName string - err = json.Unmarshal(*v, &displayName) - if err != nil { - return err - } - vp.DisplayName = &displayName - } - case "scope": - if v != nil { - var scope string - err = json.Unmarshal(*v, &scope) - if err != nil { - return err - } - vp.Scope = &scope - } - case "createdOn": - if v != nil { - var createdOn date.Time - err = json.Unmarshal(*v, &createdOn) - if err != nil { - return err - } - vp.CreatedOn = &createdOn - } - case "modifiedOn": - if v != nil { - var modifiedOn date.Time - err = json.Unmarshal(*v, &modifiedOn) - if err != nil { - return err - } - vp.ModifiedOn = &modifiedOn - } - case "query": - if v != nil { - var reportConfigDefinition ReportConfigDefinition - err = json.Unmarshal(*v, &reportConfigDefinition) - if err != nil { - return err - } - vp.ReportConfigDefinition = &reportConfigDefinition - } - case "chart": - if v != nil { - var chart ChartType - err = json.Unmarshal(*v, &chart) - if err != nil { - return err - } - vp.Chart = chart - } - case "accumulated": - if v != nil { - var accumulated AccumulatedType - err = json.Unmarshal(*v, &accumulated) - if err != nil { - return err - } - vp.Accumulated = accumulated - } - case "metric": - if v != nil { - var metric MetricType - err = json.Unmarshal(*v, &metric) - if err != nil { - return err - } - vp.Metric = metric - } - case "kpis": - if v != nil { - var kpis []KpiProperties - err = json.Unmarshal(*v, &kpis) - if err != nil { - return err - } - vp.Kpis = &kpis - } - case "pivots": - if v != nil { - var pivots []PivotProperties - err = json.Unmarshal(*v, &pivots) - if err != nil { - return err - } - vp.Pivots = &pivots - } - } - } - - return nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/operations.go deleted file mode 100644 index c70a4aac3fd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package costmanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the client for the Operations methods of the Costmanagement service. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available cost management REST API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.CostManagement/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "costmanagement.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "costmanagement.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/query.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/query.go deleted file mode 100644 index 0b92b9093f7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/query.go +++ /dev/null @@ -1,267 +0,0 @@ -package costmanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// QueryClient is the client for the Query methods of the Costmanagement service. -type QueryClient struct { - BaseClient -} - -// NewQueryClient creates an instance of the QueryClient client. -func NewQueryClient(subscriptionID string) QueryClient { - return NewQueryClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewQueryClientWithBaseURI creates an instance of the QueryClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewQueryClientWithBaseURI(baseURI string, subscriptionID string) QueryClient { - return QueryClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Usage query the usage data for scope defined. -// Parameters: -// scope - the scope associated with query and export operations. This includes -// '/subscriptions/{subscriptionId}/' for subscription scope, -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, '/providers/Microsoft.Management/managementGroups/{managementGroupId} for -// Management Group scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// billingProfile scope, -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' -// for invoiceSection scope, and -// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' specific for -// partners. -// parameters - parameters supplied to the CreateOrUpdate Query Config operation. -func (client QueryClient) Usage(ctx context.Context, scope string, parameters QueryDefinition) (result QueryResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueryClient.Usage") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TimePeriod", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TimePeriod.From", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TimePeriod.To", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.Dataset", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Grouping", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Grouping", Name: validation.MaxItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.Dataset.Filter", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.And", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.And", Name: validation.MinItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.Dataset.Filter.Or", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Or", Name: validation.MinItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.Dataset.Filter.Not", Name: validation.Null, Rule: false, Chain: nil}, - {Target: "parameters.Dataset.Filter.Dimension", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Dimension.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Dimension.Operator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Dimension.Values", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Dimension.Values", Name: validation.MinItems, Rule: 1, Chain: nil}}}, - }}, - {Target: "parameters.Dataset.Filter.Tag", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Tag.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Tag.Operator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Tag.Values", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Tag.Values", Name: validation.MinItems, Rule: 1, Chain: nil}}}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("costmanagement.QueryClient", "Usage", err.Error()) - } - - req, err := client.UsagePreparer(ctx, scope, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.QueryClient", "Usage", nil, "Failure preparing request") - return - } - - resp, err := client.UsageSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.QueryClient", "Usage", resp, "Failure sending request") - return - } - - result, err = client.UsageResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.QueryClient", "Usage", resp, "Failure responding to request") - return - } - - return -} - -// UsagePreparer prepares the Usage request. -func (client QueryClient) UsagePreparer(ctx context.Context, scope string, parameters QueryDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/query", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UsageSender sends the Usage request. The method will close the -// http.Response Body if it receives an error. -func (client QueryClient) UsageSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// UsageResponder handles the response to the Usage request. The method always -// closes the http.Response Body. -func (client QueryClient) UsageResponder(resp *http.Response) (result QueryResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UsageByExternalCloudProviderType query the usage data for external cloud provider type defined. -// Parameters: -// externalCloudProviderType - the external cloud provider type associated with dimension/query operations. -// This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated -// account. -// externalCloudProviderID - this can be '{externalSubscriptionId}' for linked account or -// '{externalBillingAccountId}' for consolidated account used with dimension/query operations. -// parameters - parameters supplied to the CreateOrUpdate Query Config operation. -func (client QueryClient) UsageByExternalCloudProviderType(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, parameters QueryDefinition) (result QueryResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueryClient.UsageByExternalCloudProviderType") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TimePeriod", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.TimePeriod.From", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TimePeriod.To", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.Dataset", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Grouping", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Grouping", Name: validation.MaxItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.Dataset.Filter", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.And", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.And", Name: validation.MinItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.Dataset.Filter.Or", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Or", Name: validation.MinItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.Dataset.Filter.Not", Name: validation.Null, Rule: false, Chain: nil}, - {Target: "parameters.Dataset.Filter.Dimension", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Dimension.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Dimension.Operator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Dimension.Values", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Dimension.Values", Name: validation.MinItems, Rule: 1, Chain: nil}}}, - }}, - {Target: "parameters.Dataset.Filter.Tag", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Tag.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Tag.Operator", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Dataset.Filter.Tag.Values", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Dataset.Filter.Tag.Values", Name: validation.MinItems, Rule: 1, Chain: nil}}}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("costmanagement.QueryClient", "UsageByExternalCloudProviderType", err.Error()) - } - - req, err := client.UsageByExternalCloudProviderTypePreparer(ctx, externalCloudProviderType, externalCloudProviderID, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.QueryClient", "UsageByExternalCloudProviderType", nil, "Failure preparing request") - return - } - - resp, err := client.UsageByExternalCloudProviderTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.QueryClient", "UsageByExternalCloudProviderType", resp, "Failure sending request") - return - } - - result, err = client.UsageByExternalCloudProviderTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.QueryClient", "UsageByExternalCloudProviderType", resp, "Failure responding to request") - return - } - - return -} - -// UsageByExternalCloudProviderTypePreparer prepares the UsageByExternalCloudProviderType request. -func (client QueryClient) UsageByExternalCloudProviderTypePreparer(ctx context.Context, externalCloudProviderType ExternalCloudProviderType, externalCloudProviderID string, parameters QueryDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "externalCloudProviderId": autorest.Encode("path", externalCloudProviderID), - "externalCloudProviderType": autorest.Encode("path", externalCloudProviderType), - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UsageByExternalCloudProviderTypeSender sends the UsageByExternalCloudProviderType request. The method will close the -// http.Response Body if it receives an error. -func (client QueryClient) UsageByExternalCloudProviderTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// UsageByExternalCloudProviderTypeResponder handles the response to the UsageByExternalCloudProviderType request. The method always -// closes the http.Response Body. -func (client QueryClient) UsageByExternalCloudProviderTypeResponder(resp *http.Response) (result QueryResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/version.go deleted file mode 100644 index 73ddda88b11..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package costmanagement - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " costmanagement/2020-06-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/views.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/views.go deleted file mode 100644 index 0d02fc01e55..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/views.go +++ /dev/null @@ -1,832 +0,0 @@ -package costmanagement - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ViewsClient is the client for the Views methods of the Costmanagement service. -type ViewsClient struct { - BaseClient -} - -// NewViewsClient creates an instance of the ViewsClient client. -func NewViewsClient(subscriptionID string) ViewsClient { - return NewViewsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewViewsClientWithBaseURI creates an instance of the ViewsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewViewsClientWithBaseURI(baseURI string, subscriptionID string) ViewsClient { - return ViewsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate the operation to create or update a view. Update operation requires latest eTag to be set in the -// request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. -// Parameters: -// viewName - view name -// parameters - parameters supplied to the CreateOrUpdate View operation. -func (client ViewsClient) CreateOrUpdate(ctx context.Context, viewName string, parameters View) (result View, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ViewsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ViewProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Type", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.TimePeriod", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.TimePeriod.From", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.TimePeriod.To", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Grouping", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Grouping", Name: validation.MaxItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.And", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.And", Name: validation.MinItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Or", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Or", Name: validation.MinItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Not", Name: validation.Null, Rule: false, Chain: nil}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Dimension", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Dimension.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Dimension.Values", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Dimension.Values", Name: validation.MinItems, Rule: 1, Chain: nil}}}, - }}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Tag", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Tag.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Tag.Values", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Tag.Values", Name: validation.MinItems, Rule: 1, Chain: nil}}}, - }}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("costmanagement.ViewsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, viewName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ViewsClient) CreateOrUpdatePreparer(ctx context.Context, viewName string, parameters View) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "viewName": autorest.Encode("path", viewName), - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.CostManagement/views/{viewName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ViewsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ViewsClient) CreateOrUpdateResponder(resp *http.Response) (result View, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateByScope the operation to create or update a view. Update operation requires latest eTag to be set in -// the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. -// Parameters: -// scope - the scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for -// subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// BillingProfile scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for -// InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management -// Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for -// External Billing Account scope and -// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External -// Subscription scope. -// viewName - view name -// parameters - parameters supplied to the CreateOrUpdate View operation. -func (client ViewsClient) CreateOrUpdateByScope(ctx context.Context, scope string, viewName string, parameters View) (result View, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ViewsClient.CreateOrUpdateByScope") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ViewProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Type", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.TimePeriod", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.TimePeriod.From", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.TimePeriod.To", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Grouping", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Grouping", Name: validation.MaxItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.And", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.And", Name: validation.MinItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Or", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Or", Name: validation.MinItems, Rule: 2, Chain: nil}}}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Not", Name: validation.Null, Rule: false, Chain: nil}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Dimension", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Dimension.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Dimension.Values", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Dimension.Values", Name: validation.MinItems, Rule: 1, Chain: nil}}}, - }}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Tag", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Tag.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Tag.Values", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.ViewProperties.ReportConfigDefinition.Dataset.Filter.Tag.Values", Name: validation.MinItems, Rule: 1, Chain: nil}}}, - }}, - }}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("costmanagement.ViewsClient", "CreateOrUpdateByScope", err.Error()) - } - - req, err := client.CreateOrUpdateByScopePreparer(ctx, scope, viewName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "CreateOrUpdateByScope", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateByScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "CreateOrUpdateByScope", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateByScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "CreateOrUpdateByScope", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateByScopePreparer prepares the CreateOrUpdateByScope request. -func (client ViewsClient) CreateOrUpdateByScopePreparer(ctx context.Context, scope string, viewName string, parameters View) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": autorest.Encode("path", scope), - "viewName": autorest.Encode("path", viewName), - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/views/{viewName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateByScopeSender sends the CreateOrUpdateByScope request. The method will close the -// http.Response Body if it receives an error. -func (client ViewsClient) CreateOrUpdateByScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateByScopeResponder handles the response to the CreateOrUpdateByScope request. The method always -// closes the http.Response Body. -func (client ViewsClient) CreateOrUpdateByScopeResponder(resp *http.Response) (result View, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete the operation to delete a view. -// Parameters: -// viewName - view name -func (client ViewsClient) Delete(ctx context.Context, viewName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ViewsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, viewName) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ViewsClient) DeletePreparer(ctx context.Context, viewName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "viewName": autorest.Encode("path", viewName), - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.CostManagement/views/{viewName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ViewsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ViewsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteByScope the operation to delete a view. -// Parameters: -// scope - the scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for -// subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// BillingProfile scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for -// InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management -// Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for -// External Billing Account scope and -// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External -// Subscription scope. -// viewName - view name -func (client ViewsClient) DeleteByScope(ctx context.Context, scope string, viewName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ViewsClient.DeleteByScope") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteByScopePreparer(ctx, scope, viewName) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "DeleteByScope", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteByScopeSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "DeleteByScope", resp, "Failure sending request") - return - } - - result, err = client.DeleteByScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "DeleteByScope", resp, "Failure responding to request") - return - } - - return -} - -// DeleteByScopePreparer prepares the DeleteByScope request. -func (client ViewsClient) DeleteByScopePreparer(ctx context.Context, scope string, viewName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": autorest.Encode("path", scope), - "viewName": autorest.Encode("path", viewName), - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/views/{viewName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteByScopeSender sends the DeleteByScope request. The method will close the -// http.Response Body if it receives an error. -func (client ViewsClient) DeleteByScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteByScopeResponder handles the response to the DeleteByScope request. The method always -// closes the http.Response Body. -func (client ViewsClient) DeleteByScopeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the view by view name. -// Parameters: -// viewName - view name -func (client ViewsClient) Get(ctx context.Context, viewName string) (result View, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ViewsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, viewName) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ViewsClient) GetPreparer(ctx context.Context, viewName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "viewName": autorest.Encode("path", viewName), - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.CostManagement/views/{viewName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ViewsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ViewsClient) GetResponder(resp *http.Response) (result View, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByScope gets the view for the defined scope by view name. -// Parameters: -// scope - the scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for -// subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// BillingProfile scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for -// InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management -// Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for -// External Billing Account scope and -// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External -// Subscription scope. -// viewName - view name -func (client ViewsClient) GetByScope(ctx context.Context, scope string, viewName string) (result View, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ViewsClient.GetByScope") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByScopePreparer(ctx, scope, viewName) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "GetByScope", nil, "Failure preparing request") - return - } - - resp, err := client.GetByScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "GetByScope", resp, "Failure sending request") - return - } - - result, err = client.GetByScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "GetByScope", resp, "Failure responding to request") - return - } - - return -} - -// GetByScopePreparer prepares the GetByScope request. -func (client ViewsClient) GetByScopePreparer(ctx context.Context, scope string, viewName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": autorest.Encode("path", scope), - "viewName": autorest.Encode("path", viewName), - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/views/{viewName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByScopeSender sends the GetByScope request. The method will close the -// http.Response Body if it receives an error. -func (client ViewsClient) GetByScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetByScopeResponder handles the response to the GetByScope request. The method always -// closes the http.Response Body. -func (client ViewsClient) GetByScopeResponder(resp *http.Response) (result View, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all views by tenant and object. -func (client ViewsClient) List(ctx context.Context) (result ViewListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ViewsClient.List") - defer func() { - sc := -1 - if result.vlr.Response.Response != nil { - sc = result.vlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.vlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "List", resp, "Failure sending request") - return - } - - result.vlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "List", resp, "Failure responding to request") - return - } - if result.vlr.hasNextLink() && result.vlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ViewsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.CostManagement/views"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ViewsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ViewsClient) ListResponder(resp *http.Response) (result ViewListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ViewsClient) listNextResults(ctx context.Context, lastResults ViewListResult) (result ViewListResult, err error) { - req, err := lastResults.viewListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ViewsClient) ListComplete(ctx context.Context) (result ViewListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ViewsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByScope lists all views at the given scope. -// Parameters: -// scope - the scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for -// subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup -// scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department -// scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' -// for EnrollmentAccount scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for -// BillingProfile scope, -// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for -// InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management -// Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for -// External Billing Account scope and -// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External -// Subscription scope. -func (client ViewsClient) ListByScope(ctx context.Context, scope string) (result ViewListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ViewsClient.ListByScope") - defer func() { - sc := -1 - if result.vlr.Response.Response != nil { - sc = result.vlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByScopeNextResults - req, err := client.ListByScopePreparer(ctx, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "ListByScope", nil, "Failure preparing request") - return - } - - resp, err := client.ListByScopeSender(req) - if err != nil { - result.vlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "ListByScope", resp, "Failure sending request") - return - } - - result.vlr, err = client.ListByScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "ListByScope", resp, "Failure responding to request") - return - } - if result.vlr.hasNextLink() && result.vlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByScopePreparer prepares the ListByScope request. -func (client ViewsClient) ListByScopePreparer(ctx context.Context, scope string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": autorest.Encode("path", scope), - } - - const APIVersion = "2020-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.CostManagement/views", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByScopeSender sends the ListByScope request. The method will close the -// http.Response Body if it receives an error. -func (client ViewsClient) ListByScopeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListByScopeResponder handles the response to the ListByScope request. The method always -// closes the http.Response Body. -func (client ViewsClient) ListByScopeResponder(resp *http.Response) (result ViewListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByScopeNextResults retrieves the next set of results, if any. -func (client ViewsClient) listByScopeNextResults(ctx context.Context, lastResults ViewListResult) (result ViewListResult, err error) { - req, err := lastResults.viewListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "listByScopeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByScopeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "listByScopeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByScopeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "costmanagement.ViewsClient", "listByScopeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByScopeComplete enumerates all values, automatically crossing page boundaries as required. -func (client ViewsClient) ListByScopeComplete(ctx context.Context, scope string) (result ViewListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ViewsClient.ListByScope") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByScope(ctx, scope) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/CHANGELOG.md similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci/CHANGELOG.md rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/CHANGELOG.md diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/_meta.json new file mode 100644 index 00000000000..7f30d618a7c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "394395ed0bdc1c5c05cb37a031379ca03bfebbb5", + "readme": "/_/azure-rest-api-specs/specification/datadog/resource-manager/readme.md", + "tag": "package-2021-03", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/datadog/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/client.go new file mode 100644 index 00000000000..00cfdf66427 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/client.go @@ -0,0 +1,41 @@ +// Package datadog implements the Azure ARM Datadog service API version 2021-03-01. +// +// +package datadog + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Datadog + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Datadog. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/enums.go new file mode 100644 index 00000000000..5b11464d49b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/enums.go @@ -0,0 +1,153 @@ +package datadog + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// LiftrResourceCategories enumerates the values for liftr resource categories. +type LiftrResourceCategories string + +const ( + // LiftrResourceCategoriesMonitorLogs ... + LiftrResourceCategoriesMonitorLogs LiftrResourceCategories = "MonitorLogs" + // LiftrResourceCategoriesUnknown ... + LiftrResourceCategoriesUnknown LiftrResourceCategories = "Unknown" +) + +// PossibleLiftrResourceCategoriesValues returns an array of possible values for the LiftrResourceCategories const type. +func PossibleLiftrResourceCategoriesValues() []LiftrResourceCategories { + return []LiftrResourceCategories{LiftrResourceCategoriesMonitorLogs, LiftrResourceCategoriesUnknown} +} + +// ManagedIdentityTypes enumerates the values for managed identity types. +type ManagedIdentityTypes string + +const ( + // ManagedIdentityTypesSystemAssigned ... + ManagedIdentityTypesSystemAssigned ManagedIdentityTypes = "SystemAssigned" + // ManagedIdentityTypesUserAssigned ... + ManagedIdentityTypesUserAssigned ManagedIdentityTypes = "UserAssigned" +) + +// PossibleManagedIdentityTypesValues returns an array of possible values for the ManagedIdentityTypes const type. +func PossibleManagedIdentityTypesValues() []ManagedIdentityTypes { + return []ManagedIdentityTypes{ManagedIdentityTypesSystemAssigned, ManagedIdentityTypesUserAssigned} +} + +// MarketplaceSubscriptionStatus enumerates the values for marketplace subscription status. +type MarketplaceSubscriptionStatus string + +const ( + // MarketplaceSubscriptionStatusActive ... + MarketplaceSubscriptionStatusActive MarketplaceSubscriptionStatus = "Active" + // MarketplaceSubscriptionStatusProvisioning ... + MarketplaceSubscriptionStatusProvisioning MarketplaceSubscriptionStatus = "Provisioning" + // MarketplaceSubscriptionStatusSuspended ... + MarketplaceSubscriptionStatusSuspended MarketplaceSubscriptionStatus = "Suspended" + // MarketplaceSubscriptionStatusUnsubscribed ... + MarketplaceSubscriptionStatusUnsubscribed MarketplaceSubscriptionStatus = "Unsubscribed" +) + +// PossibleMarketplaceSubscriptionStatusValues returns an array of possible values for the MarketplaceSubscriptionStatus const type. +func PossibleMarketplaceSubscriptionStatusValues() []MarketplaceSubscriptionStatus { + return []MarketplaceSubscriptionStatus{MarketplaceSubscriptionStatusActive, MarketplaceSubscriptionStatusProvisioning, MarketplaceSubscriptionStatusSuspended, MarketplaceSubscriptionStatusUnsubscribed} +} + +// MonitoringStatus enumerates the values for monitoring status. +type MonitoringStatus string + +const ( + // MonitoringStatusDisabled ... + MonitoringStatusDisabled MonitoringStatus = "Disabled" + // MonitoringStatusEnabled ... + MonitoringStatusEnabled MonitoringStatus = "Enabled" +) + +// PossibleMonitoringStatusValues returns an array of possible values for the MonitoringStatus const type. +func PossibleMonitoringStatusValues() []MonitoringStatus { + return []MonitoringStatus{MonitoringStatusDisabled, MonitoringStatusEnabled} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted ... + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleted ... + ProvisioningStateDeleted ProvisioningState = "Deleted" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateNotSpecified ... + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateAccepted, ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateNotSpecified, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// SingleSignOnStates enumerates the values for single sign on states. +type SingleSignOnStates string + +const ( + // SingleSignOnStatesDisable ... + SingleSignOnStatesDisable SingleSignOnStates = "Disable" + // SingleSignOnStatesEnable ... + SingleSignOnStatesEnable SingleSignOnStates = "Enable" + // SingleSignOnStatesExisting ... + SingleSignOnStatesExisting SingleSignOnStates = "Existing" + // SingleSignOnStatesInitial ... + SingleSignOnStatesInitial SingleSignOnStates = "Initial" +) + +// PossibleSingleSignOnStatesValues returns an array of possible values for the SingleSignOnStates const type. +func PossibleSingleSignOnStatesValues() []SingleSignOnStates { + return []SingleSignOnStates{SingleSignOnStatesDisable, SingleSignOnStatesEnable, SingleSignOnStatesExisting, SingleSignOnStatesInitial} +} + +// TagAction enumerates the values for tag action. +type TagAction string + +const ( + // TagActionExclude ... + TagActionExclude TagAction = "Exclude" + // TagActionInclude ... + TagActionInclude TagAction = "Include" +) + +// PossibleTagActionValues returns an array of possible values for the TagAction const type. +func PossibleTagActionValues() []TagAction { + return []TagAction{TagActionExclude, TagActionInclude} +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/marketplaceagreements.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/marketplaceagreements.go new file mode 100644 index 00000000000..0f5053aaa3d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/marketplaceagreements.go @@ -0,0 +1,238 @@ +package datadog + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// MarketplaceAgreementsClient is the client for the MarketplaceAgreements methods of the Datadog service. +type MarketplaceAgreementsClient struct { + BaseClient +} + +// NewMarketplaceAgreementsClient creates an instance of the MarketplaceAgreementsClient client. +func NewMarketplaceAgreementsClient(subscriptionID string) MarketplaceAgreementsClient { + return NewMarketplaceAgreementsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMarketplaceAgreementsClientWithBaseURI creates an instance of the MarketplaceAgreementsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewMarketplaceAgreementsClientWithBaseURI(baseURI string, subscriptionID string) MarketplaceAgreementsClient { + return MarketplaceAgreementsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +func (client MarketplaceAgreementsClient) CreateOrUpdate(ctx context.Context, body *AgreementResource) (result AgreementResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MarketplaceAgreementsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.MarketplaceAgreementsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, body) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client MarketplaceAgreementsClient) CreateOrUpdatePreparer(ctx context.Context, body *AgreementResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client MarketplaceAgreementsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client MarketplaceAgreementsClient) CreateOrUpdateResponder(resp *http.Response) (result AgreementResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client MarketplaceAgreementsClient) List(ctx context.Context) (result AgreementResourceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MarketplaceAgreementsClient.List") + defer func() { + sc := -1 + if result.arlr.Response.Response != nil { + sc = result.arlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.MarketplaceAgreementsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.arlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "List", resp, "Failure sending request") + return + } + + result.arlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "List", resp, "Failure responding to request") + return + } + if result.arlr.hasNextLink() && result.arlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client MarketplaceAgreementsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client MarketplaceAgreementsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client MarketplaceAgreementsClient) ListResponder(resp *http.Response) (result AgreementResourceListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client MarketplaceAgreementsClient) listNextResults(ctx context.Context, lastResults AgreementResourceListResponse) (result AgreementResourceListResponse, err error) { + req, err := lastResults.agreementResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MarketplaceAgreementsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client MarketplaceAgreementsClient) ListComplete(ctx context.Context) (result AgreementResourceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MarketplaceAgreementsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/models.go new file mode 100644 index 00000000000..3f10e0dfcad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/models.go @@ -0,0 +1,2115 @@ +package datadog + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog" + +// AgreementProperties terms properties. +type AgreementProperties struct { + // Publisher - Publisher identifier string. + Publisher *string `json:"publisher,omitempty"` + // Product - Product identifier string. + Product *string `json:"product,omitempty"` + // Plan - Plan identifier string. + Plan *string `json:"plan,omitempty"` + // LicenseTextLink - Link to HTML with Microsoft and Publisher terms. + LicenseTextLink *string `json:"licenseTextLink,omitempty"` + // PrivacyPolicyLink - Link to the privacy policy of the publisher. + PrivacyPolicyLink *string `json:"privacyPolicyLink,omitempty"` + // RetrieveDatetime - Date and time in UTC of when the terms were accepted. This is empty if Accepted is false. + RetrieveDatetime *date.Time `json:"retrieveDatetime,omitempty"` + // Signature - Terms signature. + Signature *string `json:"signature,omitempty"` + // Accepted - If any version of the terms have been accepted, otherwise false. + Accepted *bool `json:"accepted,omitempty"` +} + +// AgreementResource ... +type AgreementResource struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; ARM id of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the agreement. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Properties - Represents the properties of the resource. + Properties *AgreementProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgreementResource. +func (ar AgreementResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.Properties != nil { + objectMap["properties"] = ar.Properties + } + return json.Marshal(objectMap) +} + +// AgreementResourceListResponse response of a list operation. +type AgreementResourceListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]AgreementResource `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// AgreementResourceListResponseIterator provides access to a complete listing of AgreementResource values. +type AgreementResourceListResponseIterator struct { + i int + page AgreementResourceListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AgreementResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgreementResourceListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AgreementResourceListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AgreementResourceListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AgreementResourceListResponseIterator) Response() AgreementResourceListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AgreementResourceListResponseIterator) Value() AgreementResource { + if !iter.page.NotDone() { + return AgreementResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AgreementResourceListResponseIterator type. +func NewAgreementResourceListResponseIterator(page AgreementResourceListResponsePage) AgreementResourceListResponseIterator { + return AgreementResourceListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arlr AgreementResourceListResponse) IsEmpty() bool { + return arlr.Value == nil || len(*arlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (arlr AgreementResourceListResponse) hasNextLink() bool { + return arlr.NextLink != nil && len(*arlr.NextLink) != 0 +} + +// agreementResourceListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arlr AgreementResourceListResponse) agreementResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !arlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arlr.NextLink))) +} + +// AgreementResourceListResponsePage contains a page of AgreementResource values. +type AgreementResourceListResponsePage struct { + fn func(context.Context, AgreementResourceListResponse) (AgreementResourceListResponse, error) + arlr AgreementResourceListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AgreementResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgreementResourceListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.arlr) + if err != nil { + return err + } + page.arlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AgreementResourceListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AgreementResourceListResponsePage) NotDone() bool { + return !page.arlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AgreementResourceListResponsePage) Response() AgreementResourceListResponse { + return page.arlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AgreementResourceListResponsePage) Values() []AgreementResource { + if page.arlr.IsEmpty() { + return nil + } + return *page.arlr.Value +} + +// Creates a new instance of the AgreementResourceListResponsePage type. +func NewAgreementResourceListResponsePage(cur AgreementResourceListResponse, getNextPage func(context.Context, AgreementResourceListResponse) (AgreementResourceListResponse, error)) AgreementResourceListResponsePage { + return AgreementResourceListResponsePage{ + fn: getNextPage, + arlr: cur, + } +} + +// APIKey ... +type APIKey struct { + autorest.Response `json:"-"` + // CreatedBy - The user that created the API key. + CreatedBy *string `json:"createdBy,omitempty"` + // Name - The name of the API key. + Name *string `json:"name,omitempty"` + // Key - The value of the API key. + Key *string `json:"key,omitempty"` + // Created - The time of creation of the API key. + Created *string `json:"created,omitempty"` +} + +// APIKeyListResponse response of a list operation. +type APIKeyListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]APIKey `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// APIKeyListResponseIterator provides access to a complete listing of APIKey values. +type APIKeyListResponseIterator struct { + i int + page APIKeyListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *APIKeyListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIKeyListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *APIKeyListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter APIKeyListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter APIKeyListResponseIterator) Response() APIKeyListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter APIKeyListResponseIterator) Value() APIKey { + if !iter.page.NotDone() { + return APIKey{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the APIKeyListResponseIterator type. +func NewAPIKeyListResponseIterator(page APIKeyListResponsePage) APIKeyListResponseIterator { + return APIKeyListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aklr APIKeyListResponse) IsEmpty() bool { + return aklr.Value == nil || len(*aklr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aklr APIKeyListResponse) hasNextLink() bool { + return aklr.NextLink != nil && len(*aklr.NextLink) != 0 +} + +// aPIKeyListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aklr APIKeyListResponse) aPIKeyListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !aklr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aklr.NextLink))) +} + +// APIKeyListResponsePage contains a page of APIKey values. +type APIKeyListResponsePage struct { + fn func(context.Context, APIKeyListResponse) (APIKeyListResponse, error) + aklr APIKeyListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *APIKeyListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIKeyListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aklr) + if err != nil { + return err + } + page.aklr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *APIKeyListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page APIKeyListResponsePage) NotDone() bool { + return !page.aklr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page APIKeyListResponsePage) Response() APIKeyListResponse { + return page.aklr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page APIKeyListResponsePage) Values() []APIKey { + if page.aklr.IsEmpty() { + return nil + } + return *page.aklr.Value +} + +// Creates a new instance of the APIKeyListResponsePage type. +func NewAPIKeyListResponsePage(cur APIKeyListResponse, getNextPage func(context.Context, APIKeyListResponse) (APIKeyListResponse, error)) APIKeyListResponsePage { + return APIKeyListResponsePage{ + fn: getNextPage, + aklr: cur, + } +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// FilteringTag the definition of a filtering tag. Filtering tags are used for capturing resources and +// include/exclude them from being monitored. +type FilteringTag struct { + // Name - The name (also known as the key) of the tag. + Name *string `json:"name,omitempty"` + // Value - The value of the tag. + Value *string `json:"value,omitempty"` + // Action - Possible values include: 'TagActionInclude', 'TagActionExclude' + Action TagAction `json:"action,omitempty"` +} + +// Host ... +type Host struct { + // Name - The name of the host. + Name *string `json:"name,omitempty"` + // Aliases - The aliases for the host. + Aliases *[]string `json:"aliases,omitempty"` + // Apps - The Datadog integrations reporting metrics for the host. + Apps *[]string `json:"apps,omitempty"` + Meta *HostMetadata `json:"meta,omitempty"` +} + +// HostListResponse response of a list operation. +type HostListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]Host `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// HostListResponseIterator provides access to a complete listing of Host values. +type HostListResponseIterator struct { + i int + page HostListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *HostListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HostListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *HostListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter HostListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter HostListResponseIterator) Response() HostListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter HostListResponseIterator) Value() Host { + if !iter.page.NotDone() { + return Host{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the HostListResponseIterator type. +func NewHostListResponseIterator(page HostListResponsePage) HostListResponseIterator { + return HostListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (hlr HostListResponse) IsEmpty() bool { + return hlr.Value == nil || len(*hlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (hlr HostListResponse) hasNextLink() bool { + return hlr.NextLink != nil && len(*hlr.NextLink) != 0 +} + +// hostListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (hlr HostListResponse) hostListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !hlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(hlr.NextLink))) +} + +// HostListResponsePage contains a page of Host values. +type HostListResponsePage struct { + fn func(context.Context, HostListResponse) (HostListResponse, error) + hlr HostListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *HostListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HostListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.hlr) + if err != nil { + return err + } + page.hlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *HostListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page HostListResponsePage) NotDone() bool { + return !page.hlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page HostListResponsePage) Response() HostListResponse { + return page.hlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page HostListResponsePage) Values() []Host { + if page.hlr.IsEmpty() { + return nil + } + return *page.hlr.Value +} + +// Creates a new instance of the HostListResponsePage type. +func NewHostListResponsePage(cur HostListResponse, getNextPage func(context.Context, HostListResponse) (HostListResponse, error)) HostListResponsePage { + return HostListResponsePage{ + fn: getNextPage, + hlr: cur, + } +} + +// HostMetadata ... +type HostMetadata struct { + // AgentVersion - The agent version. + AgentVersion *string `json:"agentVersion,omitempty"` + InstallMethod *InstallMethod `json:"installMethod,omitempty"` + LogsAgent *LogsAgent `json:"logsAgent,omitempty"` +} + +// IdentityProperties ... +type IdentityProperties struct { + // PrincipalID - READ-ONLY; The identity ID. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - Possible values include: 'ManagedIdentityTypesSystemAssigned', 'ManagedIdentityTypesUserAssigned' + Type ManagedIdentityTypes `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for IdentityProperties. +func (IP IdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if IP.Type != "" { + objectMap["type"] = IP.Type + } + return json.Marshal(objectMap) +} + +// InstallMethod ... +type InstallMethod struct { + // Tool - The tool. + Tool *string `json:"tool,omitempty"` + // ToolVersion - The tool version. + ToolVersion *string `json:"toolVersion,omitempty"` + // InstallerVersion - The installer version. + InstallerVersion *string `json:"installerVersion,omitempty"` +} + +// LinkedResource the definition of a linked resource. +type LinkedResource struct { + // ID - The ARM id of the linked resource. + ID *string `json:"id,omitempty"` +} + +// LinkedResourceListResponse response of a list operation. +type LinkedResourceListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]LinkedResource `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// LinkedResourceListResponseIterator provides access to a complete listing of LinkedResource values. +type LinkedResourceListResponseIterator struct { + i int + page LinkedResourceListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LinkedResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LinkedResourceListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LinkedResourceListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LinkedResourceListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LinkedResourceListResponseIterator) Response() LinkedResourceListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LinkedResourceListResponseIterator) Value() LinkedResource { + if !iter.page.NotDone() { + return LinkedResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LinkedResourceListResponseIterator type. +func NewLinkedResourceListResponseIterator(page LinkedResourceListResponsePage) LinkedResourceListResponseIterator { + return LinkedResourceListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lrlr LinkedResourceListResponse) IsEmpty() bool { + return lrlr.Value == nil || len(*lrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lrlr LinkedResourceListResponse) hasNextLink() bool { + return lrlr.NextLink != nil && len(*lrlr.NextLink) != 0 +} + +// linkedResourceListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lrlr LinkedResourceListResponse) linkedResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !lrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lrlr.NextLink))) +} + +// LinkedResourceListResponsePage contains a page of LinkedResource values. +type LinkedResourceListResponsePage struct { + fn func(context.Context, LinkedResourceListResponse) (LinkedResourceListResponse, error) + lrlr LinkedResourceListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LinkedResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LinkedResourceListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lrlr) + if err != nil { + return err + } + page.lrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LinkedResourceListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LinkedResourceListResponsePage) NotDone() bool { + return !page.lrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LinkedResourceListResponsePage) Response() LinkedResourceListResponse { + return page.lrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LinkedResourceListResponsePage) Values() []LinkedResource { + if page.lrlr.IsEmpty() { + return nil + } + return *page.lrlr.Value +} + +// Creates a new instance of the LinkedResourceListResponsePage type. +func NewLinkedResourceListResponsePage(cur LinkedResourceListResponse, getNextPage func(context.Context, LinkedResourceListResponse) (LinkedResourceListResponse, error)) LinkedResourceListResponsePage { + return LinkedResourceListResponsePage{ + fn: getNextPage, + lrlr: cur, + } +} + +// LogRules set of rules for sending logs for the Monitor resource. +type LogRules struct { + // SendAadLogs - Flag specifying if AAD logs should be sent for the Monitor resource. + SendAadLogs *bool `json:"sendAadLogs,omitempty"` + // SendSubscriptionLogs - Flag specifying if Azure subscription logs should be sent for the Monitor resource. + SendSubscriptionLogs *bool `json:"sendSubscriptionLogs,omitempty"` + // SendResourceLogs - Flag specifying if Azure resource logs should be sent for the Monitor resource. + SendResourceLogs *bool `json:"sendResourceLogs,omitempty"` + // FilteringTags - List of filtering tags to be used for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. + FilteringTags *[]FilteringTag `json:"filteringTags,omitempty"` +} + +// LogsAgent ... +type LogsAgent struct { + // Transport - The transport. + Transport *string `json:"transport,omitempty"` +} + +// MetricRules set of rules for sending metrics for the Monitor resource. +type MetricRules struct { + // FilteringTags - List of filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. + FilteringTags *[]FilteringTag `json:"filteringTags,omitempty"` +} + +// MonitoredResource the properties of a resource currently being monitored by the Datadog monitor +// resource. +type MonitoredResource struct { + // ID - The ARM id of the resource. + ID *string `json:"id,omitempty"` + // SendingMetrics - Flag indicating if resource is sending metrics to Datadog. + SendingMetrics *bool `json:"sendingMetrics,omitempty"` + // ReasonForMetricsStatus - Reason for why the resource is sending metrics (or why it is not sending). + ReasonForMetricsStatus *string `json:"reasonForMetricsStatus,omitempty"` + // SendingLogs - Flag indicating if resource is sending logs to Datadog. + SendingLogs *bool `json:"sendingLogs,omitempty"` + // ReasonForLogsStatus - Reason for why the resource is sending logs (or why it is not sending). + ReasonForLogsStatus *string `json:"reasonForLogsStatus,omitempty"` +} + +// MonitoredResourceListResponse response of a list operation. +type MonitoredResourceListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]MonitoredResource `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MonitoredResourceListResponseIterator provides access to a complete listing of MonitoredResource values. +type MonitoredResourceListResponseIterator struct { + i int + page MonitoredResourceListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MonitoredResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoredResourceListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *MonitoredResourceListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MonitoredResourceListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MonitoredResourceListResponseIterator) Response() MonitoredResourceListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MonitoredResourceListResponseIterator) Value() MonitoredResource { + if !iter.page.NotDone() { + return MonitoredResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MonitoredResourceListResponseIterator type. +func NewMonitoredResourceListResponseIterator(page MonitoredResourceListResponsePage) MonitoredResourceListResponseIterator { + return MonitoredResourceListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mrlr MonitoredResourceListResponse) IsEmpty() bool { + return mrlr.Value == nil || len(*mrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mrlr MonitoredResourceListResponse) hasNextLink() bool { + return mrlr.NextLink != nil && len(*mrlr.NextLink) != 0 +} + +// monitoredResourceListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mrlr MonitoredResourceListResponse) monitoredResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !mrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mrlr.NextLink))) +} + +// MonitoredResourceListResponsePage contains a page of MonitoredResource values. +type MonitoredResourceListResponsePage struct { + fn func(context.Context, MonitoredResourceListResponse) (MonitoredResourceListResponse, error) + mrlr MonitoredResourceListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MonitoredResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoredResourceListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mrlr) + if err != nil { + return err + } + page.mrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *MonitoredResourceListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MonitoredResourceListResponsePage) NotDone() bool { + return !page.mrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MonitoredResourceListResponsePage) Response() MonitoredResourceListResponse { + return page.mrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MonitoredResourceListResponsePage) Values() []MonitoredResource { + if page.mrlr.IsEmpty() { + return nil + } + return *page.mrlr.Value +} + +// Creates a new instance of the MonitoredResourceListResponsePage type. +func NewMonitoredResourceListResponsePage(cur MonitoredResourceListResponse, getNextPage func(context.Context, MonitoredResourceListResponse) (MonitoredResourceListResponse, error)) MonitoredResourceListResponsePage { + return MonitoredResourceListResponsePage{ + fn: getNextPage, + mrlr: cur, + } +} + +// MonitoringTagRules capture logs and metrics of Azure resources based on ARM tags. +type MonitoringTagRules struct { + autorest.Response `json:"-"` + // Name - READ-ONLY; Name of the rule set. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; The id of the rule set. + ID *string `json:"id,omitempty"` + // Type - READ-ONLY; The type of the rule set. + Type *string `json:"type,omitempty"` + Properties *MonitoringTagRulesProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitoringTagRules. +func (mtr MonitoringTagRules) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mtr.Properties != nil { + objectMap["properties"] = mtr.Properties + } + return json.Marshal(objectMap) +} + +// MonitoringTagRulesListResponse response of a list operation. +type MonitoringTagRulesListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]MonitoringTagRules `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MonitoringTagRulesListResponseIterator provides access to a complete listing of MonitoringTagRules +// values. +type MonitoringTagRulesListResponseIterator struct { + i int + page MonitoringTagRulesListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MonitoringTagRulesListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringTagRulesListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *MonitoringTagRulesListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MonitoringTagRulesListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MonitoringTagRulesListResponseIterator) Response() MonitoringTagRulesListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MonitoringTagRulesListResponseIterator) Value() MonitoringTagRules { + if !iter.page.NotDone() { + return MonitoringTagRules{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MonitoringTagRulesListResponseIterator type. +func NewMonitoringTagRulesListResponseIterator(page MonitoringTagRulesListResponsePage) MonitoringTagRulesListResponseIterator { + return MonitoringTagRulesListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mtrlr MonitoringTagRulesListResponse) IsEmpty() bool { + return mtrlr.Value == nil || len(*mtrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mtrlr MonitoringTagRulesListResponse) hasNextLink() bool { + return mtrlr.NextLink != nil && len(*mtrlr.NextLink) != 0 +} + +// monitoringTagRulesListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mtrlr MonitoringTagRulesListResponse) monitoringTagRulesListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !mtrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mtrlr.NextLink))) +} + +// MonitoringTagRulesListResponsePage contains a page of MonitoringTagRules values. +type MonitoringTagRulesListResponsePage struct { + fn func(context.Context, MonitoringTagRulesListResponse) (MonitoringTagRulesListResponse, error) + mtrlr MonitoringTagRulesListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MonitoringTagRulesListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringTagRulesListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mtrlr) + if err != nil { + return err + } + page.mtrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *MonitoringTagRulesListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MonitoringTagRulesListResponsePage) NotDone() bool { + return !page.mtrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MonitoringTagRulesListResponsePage) Response() MonitoringTagRulesListResponse { + return page.mtrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MonitoringTagRulesListResponsePage) Values() []MonitoringTagRules { + if page.mtrlr.IsEmpty() { + return nil + } + return *page.mtrlr.Value +} + +// Creates a new instance of the MonitoringTagRulesListResponsePage type. +func NewMonitoringTagRulesListResponsePage(cur MonitoringTagRulesListResponse, getNextPage func(context.Context, MonitoringTagRulesListResponse) (MonitoringTagRulesListResponse, error)) MonitoringTagRulesListResponsePage { + return MonitoringTagRulesListResponsePage{ + fn: getNextPage, + mtrlr: cur, + } +} + +// MonitoringTagRulesProperties definition of the properties for a TagRules resource. +type MonitoringTagRulesProperties struct { + // ProvisioningState - Possible values include: 'ProvisioningStateAccepted', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateDeleted', 'ProvisioningStateNotSpecified' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + LogRules *LogRules `json:"logRules,omitempty"` + MetricRules *MetricRules `json:"metricRules,omitempty"` +} + +// MonitorProperties properties specific to the monitor resource. +type MonitorProperties struct { + // ProvisioningState - Possible values include: 'ProvisioningStateAccepted', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateDeleted', 'ProvisioningStateNotSpecified' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // MonitoringStatus - Possible values include: 'MonitoringStatusEnabled', 'MonitoringStatusDisabled' + MonitoringStatus MonitoringStatus `json:"monitoringStatus,omitempty"` + // MarketplaceSubscriptionStatus - Possible values include: 'MarketplaceSubscriptionStatusProvisioning', 'MarketplaceSubscriptionStatusActive', 'MarketplaceSubscriptionStatusSuspended', 'MarketplaceSubscriptionStatusUnsubscribed' + MarketplaceSubscriptionStatus MarketplaceSubscriptionStatus `json:"marketplaceSubscriptionStatus,omitempty"` + DatadogOrganizationProperties *OrganizationProperties `json:"datadogOrganizationProperties,omitempty"` + UserInfo *UserInfo `json:"userInfo,omitempty"` + // LiftrResourceCategory - Possible values include: 'LiftrResourceCategoriesUnknown', 'LiftrResourceCategoriesMonitorLogs' + LiftrResourceCategory LiftrResourceCategories `json:"liftrResourceCategory,omitempty"` + // LiftrResourcePreference - READ-ONLY; The priority of the resource. + LiftrResourcePreference *int32 `json:"liftrResourcePreference,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitorProperties. +func (mp MonitorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mp.ProvisioningState != "" { + objectMap["provisioningState"] = mp.ProvisioningState + } + if mp.MonitoringStatus != "" { + objectMap["monitoringStatus"] = mp.MonitoringStatus + } + if mp.MarketplaceSubscriptionStatus != "" { + objectMap["marketplaceSubscriptionStatus"] = mp.MarketplaceSubscriptionStatus + } + if mp.DatadogOrganizationProperties != nil { + objectMap["datadogOrganizationProperties"] = mp.DatadogOrganizationProperties + } + if mp.UserInfo != nil { + objectMap["userInfo"] = mp.UserInfo + } + if mp.LiftrResourceCategory != "" { + objectMap["liftrResourceCategory"] = mp.LiftrResourceCategory + } + return json.Marshal(objectMap) +} + +// MonitorResource ... +type MonitorResource struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; ARM id of the monitor resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the monitor resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the monitor resource. + Type *string `json:"type,omitempty"` + Sku *ResourceSku `json:"sku,omitempty"` + Properties *MonitorProperties `json:"properties,omitempty"` + Identity *IdentityProperties `json:"identity,omitempty"` + Tags map[string]*string `json:"tags"` + Location *string `json:"location,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitorResource. +func (mr MonitorResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mr.Sku != nil { + objectMap["sku"] = mr.Sku + } + if mr.Properties != nil { + objectMap["properties"] = mr.Properties + } + if mr.Identity != nil { + objectMap["identity"] = mr.Identity + } + if mr.Tags != nil { + objectMap["tags"] = mr.Tags + } + if mr.Location != nil { + objectMap["location"] = mr.Location + } + return json.Marshal(objectMap) +} + +// MonitorResourceListResponse response of a list operation. +type MonitorResourceListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]MonitorResource `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MonitorResourceListResponseIterator provides access to a complete listing of MonitorResource values. +type MonitorResourceListResponseIterator struct { + i int + page MonitorResourceListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MonitorResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorResourceListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *MonitorResourceListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MonitorResourceListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MonitorResourceListResponseIterator) Response() MonitorResourceListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MonitorResourceListResponseIterator) Value() MonitorResource { + if !iter.page.NotDone() { + return MonitorResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MonitorResourceListResponseIterator type. +func NewMonitorResourceListResponseIterator(page MonitorResourceListResponsePage) MonitorResourceListResponseIterator { + return MonitorResourceListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mrlr MonitorResourceListResponse) IsEmpty() bool { + return mrlr.Value == nil || len(*mrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mrlr MonitorResourceListResponse) hasNextLink() bool { + return mrlr.NextLink != nil && len(*mrlr.NextLink) != 0 +} + +// monitorResourceListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mrlr MonitorResourceListResponse) monitorResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !mrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mrlr.NextLink))) +} + +// MonitorResourceListResponsePage contains a page of MonitorResource values. +type MonitorResourceListResponsePage struct { + fn func(context.Context, MonitorResourceListResponse) (MonitorResourceListResponse, error) + mrlr MonitorResourceListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MonitorResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorResourceListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mrlr) + if err != nil { + return err + } + page.mrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *MonitorResourceListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MonitorResourceListResponsePage) NotDone() bool { + return !page.mrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MonitorResourceListResponsePage) Response() MonitorResourceListResponse { + return page.mrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MonitorResourceListResponsePage) Values() []MonitorResource { + if page.mrlr.IsEmpty() { + return nil + } + return *page.mrlr.Value +} + +// Creates a new instance of the MonitorResourceListResponsePage type. +func NewMonitorResourceListResponsePage(cur MonitorResourceListResponse, getNextPage func(context.Context, MonitorResourceListResponse) (MonitorResourceListResponse, error)) MonitorResourceListResponsePage { + return MonitorResourceListResponsePage{ + fn: getNextPage, + mrlr: cur, + } +} + +// MonitorResourceUpdateParameters the parameters for a PATCH request to a monitor resource. +type MonitorResourceUpdateParameters struct { + Properties *MonitorUpdateProperties `json:"properties,omitempty"` + // Tags - The new tags of the monitor resource. + Tags map[string]*string `json:"tags"` + Sku *ResourceSku `json:"sku,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitorResourceUpdateParameters. +func (mrup MonitorResourceUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mrup.Properties != nil { + objectMap["properties"] = mrup.Properties + } + if mrup.Tags != nil { + objectMap["tags"] = mrup.Tags + } + if mrup.Sku != nil { + objectMap["sku"] = mrup.Sku + } + return json.Marshal(objectMap) +} + +// MonitorsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type MonitorsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitorsClient) (MonitorResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MonitorsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for MonitorsCreateFuture.Result. +func (future *MonitorsCreateFuture) result(client MonitorsClient) (mr MonitorResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("datadog.MonitorsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mr.Response.Response, err = future.GetResult(sender); err == nil && mr.Response.Response.StatusCode != http.StatusNoContent { + mr, err = client.CreateResponder(mr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsCreateFuture", "Result", mr.Response.Response, "Failure responding to request") + } + } + return +} + +// MonitorsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type MonitorsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitorsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MonitorsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for MonitorsDeleteFuture.Result. +func (future *MonitorsDeleteFuture) result(client MonitorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("datadog.MonitorsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// MonitorsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type MonitorsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitorsClient) (MonitorResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MonitorsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for MonitorsUpdateFuture.Result. +func (future *MonitorsUpdateFuture) result(client MonitorsClient) (mr MonitorResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("datadog.MonitorsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mr.Response.Response, err = future.GetResult(sender); err == nil && mr.Response.Response.StatusCode != http.StatusNoContent { + mr, err = client.UpdateResponder(mr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsUpdateFuture", "Result", mr.Response.Response, "Failure responding to request") + } + } + return +} + +// MonitorUpdateProperties the set of properties that can be update in a PATCH request to a monitor +// resource. +type MonitorUpdateProperties struct { + // MonitoringStatus - Possible values include: 'MonitoringStatusEnabled', 'MonitoringStatusDisabled' + MonitoringStatus MonitoringStatus `json:"monitoringStatus,omitempty"` +} + +// OperationDisplay the object that represents the operation. +type OperationDisplay struct { + // Provider - Service provider, i.e., Microsoft.Datadog. + Provider *string `json:"provider,omitempty"` + // Resource - Type on which the operation is performed, e.g., 'monitors'. + Resource *string `json:"resource,omitempty"` + // Operation - Operation type, e.g., read, write, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of the operation, e.g., 'Write monitors'. + Description *string `json:"description,omitempty"` +} + +// OperationListResult result of GET request to list the Microsoft.Datadog operations. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of operations supported by the Microsoft.Datadog provider. + Value *[]OperationResult `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of OperationResult values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() OperationResult { + if !iter.page.NotDone() { + return OperationResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of OperationResult values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []OperationResult { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// OperationResult a Microsoft.Datadog REST API operation. +type OperationResult struct { + // Name - Operation name, i.e., {provider}/{resource}/{operation}. + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` +} + +// OrganizationProperties datadog organization properties +type OrganizationProperties struct { + // Name - READ-ONLY; Name of the Datadog organization. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; Id of the Datadog organization. + ID *string `json:"id,omitempty"` + // LinkingAuthCode - The auth code used to linking to an existing datadog organization. + LinkingAuthCode *string `json:"linkingAuthCode,omitempty"` + // LinkingClientID - The client_id from an existing in exchange for an auth token to link organization. + LinkingClientID *string `json:"linkingClientId,omitempty"` + // RedirectURI - The redirect uri for linking. + RedirectURI *string `json:"redirectUri,omitempty"` + // APIKey - Api key associated to the Datadog organization. + APIKey *string `json:"apiKey,omitempty"` + // ApplicationKey - Application key associated to the Datadog organization. + ApplicationKey *string `json:"applicationKey,omitempty"` + // EnterpriseAppID - The Id of the Enterprise App used for Single sign on. + EnterpriseAppID *string `json:"enterpriseAppId,omitempty"` +} + +// MarshalJSON is the custom marshaler for OrganizationProperties. +func (op OrganizationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if op.LinkingAuthCode != nil { + objectMap["linkingAuthCode"] = op.LinkingAuthCode + } + if op.LinkingClientID != nil { + objectMap["linkingClientId"] = op.LinkingClientID + } + if op.RedirectURI != nil { + objectMap["redirectUri"] = op.RedirectURI + } + if op.APIKey != nil { + objectMap["apiKey"] = op.APIKey + } + if op.ApplicationKey != nil { + objectMap["applicationKey"] = op.ApplicationKey + } + if op.EnterpriseAppID != nil { + objectMap["enterpriseAppId"] = op.EnterpriseAppID + } + return json.Marshal(objectMap) +} + +// ResourceSku ... +type ResourceSku struct { + // Name - Name of the SKU. + Name *string `json:"name,omitempty"` +} + +// SetPasswordLink ... +type SetPasswordLink struct { + autorest.Response `json:"-"` + SetPasswordLink *string `json:"setPasswordLink,omitempty"` +} + +// SingleSignOnConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type SingleSignOnConfigurationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SingleSignOnConfigurationsClient) (SingleSignOnResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SingleSignOnConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SingleSignOnConfigurationsCreateOrUpdateFuture.Result. +func (future *SingleSignOnConfigurationsCreateOrUpdateFuture) result(client SingleSignOnConfigurationsClient) (ssor SingleSignOnResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ssor.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("datadog.SingleSignOnConfigurationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ssor.Response.Response, err = future.GetResult(sender); err == nil && ssor.Response.Response.StatusCode != http.StatusNoContent { + ssor, err = client.CreateOrUpdateResponder(ssor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsCreateOrUpdateFuture", "Result", ssor.Response.Response, "Failure responding to request") + } + } + return +} + +// SingleSignOnProperties ... +type SingleSignOnProperties struct { + // ProvisioningState - Possible values include: 'ProvisioningStateAccepted', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateDeleted', 'ProvisioningStateNotSpecified' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // SingleSignOnState - Possible values include: 'SingleSignOnStatesInitial', 'SingleSignOnStatesEnable', 'SingleSignOnStatesDisable', 'SingleSignOnStatesExisting' + SingleSignOnState SingleSignOnStates `json:"singleSignOnState,omitempty"` + // EnterpriseAppID - The Id of the Enterprise App used for Single sign-on. + EnterpriseAppID *string `json:"enterpriseAppId,omitempty"` + // SingleSignOnURL - READ-ONLY; The login URL specific to this Datadog Organization. + SingleSignOnURL *string `json:"singleSignOnUrl,omitempty"` +} + +// MarshalJSON is the custom marshaler for SingleSignOnProperties. +func (ssop SingleSignOnProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssop.ProvisioningState != "" { + objectMap["provisioningState"] = ssop.ProvisioningState + } + if ssop.SingleSignOnState != "" { + objectMap["singleSignOnState"] = ssop.SingleSignOnState + } + if ssop.EnterpriseAppID != nil { + objectMap["enterpriseAppId"] = ssop.EnterpriseAppID + } + return json.Marshal(objectMap) +} + +// SingleSignOnResource ... +type SingleSignOnResource struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; ARM id of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the configuration. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + Properties *SingleSignOnProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SingleSignOnResource. +func (ssor SingleSignOnResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssor.Properties != nil { + objectMap["properties"] = ssor.Properties + } + return json.Marshal(objectMap) +} + +// SingleSignOnResourceListResponse response of a list operation. +type SingleSignOnResourceListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]SingleSignOnResource `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// SingleSignOnResourceListResponseIterator provides access to a complete listing of SingleSignOnResource +// values. +type SingleSignOnResourceListResponseIterator struct { + i int + page SingleSignOnResourceListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SingleSignOnResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnResourceListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SingleSignOnResourceListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SingleSignOnResourceListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SingleSignOnResourceListResponseIterator) Response() SingleSignOnResourceListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SingleSignOnResourceListResponseIterator) Value() SingleSignOnResource { + if !iter.page.NotDone() { + return SingleSignOnResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SingleSignOnResourceListResponseIterator type. +func NewSingleSignOnResourceListResponseIterator(page SingleSignOnResourceListResponsePage) SingleSignOnResourceListResponseIterator { + return SingleSignOnResourceListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ssorlr SingleSignOnResourceListResponse) IsEmpty() bool { + return ssorlr.Value == nil || len(*ssorlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ssorlr SingleSignOnResourceListResponse) hasNextLink() bool { + return ssorlr.NextLink != nil && len(*ssorlr.NextLink) != 0 +} + +// singleSignOnResourceListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ssorlr SingleSignOnResourceListResponse) singleSignOnResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !ssorlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ssorlr.NextLink))) +} + +// SingleSignOnResourceListResponsePage contains a page of SingleSignOnResource values. +type SingleSignOnResourceListResponsePage struct { + fn func(context.Context, SingleSignOnResourceListResponse) (SingleSignOnResourceListResponse, error) + ssorlr SingleSignOnResourceListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SingleSignOnResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnResourceListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ssorlr) + if err != nil { + return err + } + page.ssorlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SingleSignOnResourceListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SingleSignOnResourceListResponsePage) NotDone() bool { + return !page.ssorlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SingleSignOnResourceListResponsePage) Response() SingleSignOnResourceListResponse { + return page.ssorlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SingleSignOnResourceListResponsePage) Values() []SingleSignOnResource { + if page.ssorlr.IsEmpty() { + return nil + } + return *page.ssorlr.Value +} + +// Creates a new instance of the SingleSignOnResourceListResponsePage type. +func NewSingleSignOnResourceListResponsePage(cur SingleSignOnResourceListResponse, getNextPage func(context.Context, SingleSignOnResourceListResponse) (SingleSignOnResourceListResponse, error)) SingleSignOnResourceListResponsePage { + return SingleSignOnResourceListResponsePage{ + fn: getNextPage, + ssorlr: cur, + } +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// UserInfo user info +type UserInfo struct { + // Name - Name of the user + Name *string `json:"name,omitempty"` + // EmailAddress - Email of the user used by Datadog for contacting them if needed + EmailAddress *string `json:"emailAddress,omitempty"` + // PhoneNumber - Phone number of the user used by Datadog for contacting them if needed + PhoneNumber *string `json:"phoneNumber,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/monitors.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/monitors.go new file mode 100644 index 00000000000..f89c95093f4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/monitors.go @@ -0,0 +1,1436 @@ +package datadog + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// MonitorsClient is the client for the Monitors methods of the Datadog service. +type MonitorsClient struct { + BaseClient +} + +// NewMonitorsClient creates an instance of the MonitorsClient client. +func NewMonitorsClient(subscriptionID string) MonitorsClient { + return NewMonitorsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMonitorsClientWithBaseURI creates an instance of the MonitorsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewMonitorsClientWithBaseURI(baseURI string, subscriptionID string) MonitorsClient { + return MonitorsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create sends the create request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) Create(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResource) (result MonitorsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "body.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.Name", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.Name", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.Properties.UserInfo.EmailAddress", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.EmailAddress", Name: validation.Pattern, Rule: `^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$`, Chain: nil}}}, + {Target: "body.Properties.UserInfo.PhoneNumber", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.PhoneNumber", Name: validation.MaxLength, Rule: 40, Chain: nil}}}, + }}, + }}, + {Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("datadog.MonitorsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, monitorName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client MonitorsClient) CreatePreparer(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) CreateSender(req *http.Request) (future MonitorsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client MonitorsClient) CreateResponder(resp *http.Response) (result MonitorResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) Delete(ctx context.Context, resourceGroupName string, monitorName string) (result MonitorsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.MonitorsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MonitorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) DeleteSender(req *http.Request) (future MonitorsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client MonitorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) Get(ctx context.Context, resourceGroupName string, monitorName string) (result MonitorResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.MonitorsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MonitorsClient) GetPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MonitorsClient) GetResponder(resp *http.Response) (result MonitorResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDefaultKey sends the get default key request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) GetDefaultKey(ctx context.Context, resourceGroupName string, monitorName string) (result APIKey, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.GetDefaultKey") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.MonitorsClient", "GetDefaultKey", err.Error()) + } + + req, err := client.GetDefaultKeyPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "GetDefaultKey", nil, "Failure preparing request") + return + } + + resp, err := client.GetDefaultKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "GetDefaultKey", resp, "Failure sending request") + return + } + + result, err = client.GetDefaultKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "GetDefaultKey", resp, "Failure responding to request") + return + } + + return +} + +// GetDefaultKeyPreparer prepares the GetDefaultKey request. +func (client MonitorsClient) GetDefaultKeyPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDefaultKeySender sends the GetDefaultKey request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) GetDefaultKeySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDefaultKeyResponder handles the response to the GetDefaultKey request. The method always +// closes the http.Response Body. +func (client MonitorsClient) GetDefaultKeyResponder(resp *http.Response) (result APIKey, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client MonitorsClient) List(ctx context.Context) (result MonitorResourceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.List") + defer func() { + sc := -1 + if result.mrlr.Response.Response != nil { + sc = result.mrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.MonitorsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "List", resp, "Failure sending request") + return + } + + result.mrlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "List", resp, "Failure responding to request") + return + } + if result.mrlr.hasNextLink() && result.mrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client MonitorsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client MonitorsClient) ListResponder(resp *http.Response) (result MonitorResourceListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listNextResults(ctx context.Context, lastResults MonitorResourceListResponse) (result MonitorResourceListResponse, err error) { + req, err := lastResults.monitorResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListComplete(ctx context.Context) (result MonitorResourceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListAPIKeys sends the list api keys request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) ListAPIKeys(ctx context.Context, resourceGroupName string, monitorName string) (result APIKeyListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListAPIKeys") + defer func() { + sc := -1 + if result.aklr.Response.Response != nil { + sc = result.aklr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.MonitorsClient", "ListAPIKeys", err.Error()) + } + + result.fn = client.listAPIKeysNextResults + req, err := client.ListAPIKeysPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListAPIKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListAPIKeysSender(req) + if err != nil { + result.aklr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListAPIKeys", resp, "Failure sending request") + return + } + + result.aklr, err = client.ListAPIKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListAPIKeys", resp, "Failure responding to request") + return + } + if result.aklr.hasNextLink() && result.aklr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAPIKeysPreparer prepares the ListAPIKeys request. +func (client MonitorsClient) ListAPIKeysPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAPIKeysSender sends the ListAPIKeys request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) ListAPIKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAPIKeysResponder handles the response to the ListAPIKeys request. The method always +// closes the http.Response Body. +func (client MonitorsClient) ListAPIKeysResponder(resp *http.Response) (result APIKeyListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAPIKeysNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listAPIKeysNextResults(ctx context.Context, lastResults APIKeyListResponse) (result APIKeyListResponse, err error) { + req, err := lastResults.aPIKeyListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listAPIKeysNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAPIKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listAPIKeysNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAPIKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listAPIKeysNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAPIKeysComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListAPIKeysComplete(ctx context.Context, resourceGroupName string, monitorName string) (result APIKeyListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListAPIKeys") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAPIKeys(ctx, resourceGroupName, monitorName) + return +} + +// ListByResourceGroup sends the list by resource group request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client MonitorsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MonitorResourceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.mrlr.Response.Response != nil { + sc = result.mrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.MonitorsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.mrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.mrlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.mrlr.hasNextLink() && result.mrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client MonitorsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client MonitorsClient) ListByResourceGroupResponder(resp *http.Response) (result MonitorResourceListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listByResourceGroupNextResults(ctx context.Context, lastResults MonitorResourceListResponse) (result MonitorResourceListResponse, err error) { + req, err := lastResults.monitorResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result MonitorResourceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListHosts sends the list hosts request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) ListHosts(ctx context.Context, resourceGroupName string, monitorName string) (result HostListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListHosts") + defer func() { + sc := -1 + if result.hlr.Response.Response != nil { + sc = result.hlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.MonitorsClient", "ListHosts", err.Error()) + } + + result.fn = client.listHostsNextResults + req, err := client.ListHostsPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListHosts", nil, "Failure preparing request") + return + } + + resp, err := client.ListHostsSender(req) + if err != nil { + result.hlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListHosts", resp, "Failure sending request") + return + } + + result.hlr, err = client.ListHostsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListHosts", resp, "Failure responding to request") + return + } + if result.hlr.hasNextLink() && result.hlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListHostsPreparer prepares the ListHosts request. +func (client MonitorsClient) ListHostsPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHostsSender sends the ListHosts request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) ListHostsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListHostsResponder handles the response to the ListHosts request. The method always +// closes the http.Response Body. +func (client MonitorsClient) ListHostsResponder(resp *http.Response) (result HostListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listHostsNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listHostsNextResults(ctx context.Context, lastResults HostListResponse) (result HostListResponse, err error) { + req, err := lastResults.hostListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listHostsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListHostsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listHostsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListHostsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listHostsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListHostsComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListHostsComplete(ctx context.Context, resourceGroupName string, monitorName string) (result HostListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListHosts") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListHosts(ctx, resourceGroupName, monitorName) + return +} + +// ListLinkedResources sends the list linked resources request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) ListLinkedResources(ctx context.Context, resourceGroupName string, monitorName string) (result LinkedResourceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListLinkedResources") + defer func() { + sc := -1 + if result.lrlr.Response.Response != nil { + sc = result.lrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.MonitorsClient", "ListLinkedResources", err.Error()) + } + + result.fn = client.listLinkedResourcesNextResults + req, err := client.ListLinkedResourcesPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListLinkedResources", nil, "Failure preparing request") + return + } + + resp, err := client.ListLinkedResourcesSender(req) + if err != nil { + result.lrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListLinkedResources", resp, "Failure sending request") + return + } + + result.lrlr, err = client.ListLinkedResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListLinkedResources", resp, "Failure responding to request") + return + } + if result.lrlr.hasNextLink() && result.lrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListLinkedResourcesPreparer prepares the ListLinkedResources request. +func (client MonitorsClient) ListLinkedResourcesPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListLinkedResourcesSender sends the ListLinkedResources request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) ListLinkedResourcesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListLinkedResourcesResponder handles the response to the ListLinkedResources request. The method always +// closes the http.Response Body. +func (client MonitorsClient) ListLinkedResourcesResponder(resp *http.Response) (result LinkedResourceListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listLinkedResourcesNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listLinkedResourcesNextResults(ctx context.Context, lastResults LinkedResourceListResponse) (result LinkedResourceListResponse, err error) { + req, err := lastResults.linkedResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listLinkedResourcesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListLinkedResourcesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listLinkedResourcesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListLinkedResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listLinkedResourcesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListLinkedResourcesComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListLinkedResourcesComplete(ctx context.Context, resourceGroupName string, monitorName string) (result LinkedResourceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListLinkedResources") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListLinkedResources(ctx, resourceGroupName, monitorName) + return +} + +// ListMonitoredResources sends the list monitored resources request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) ListMonitoredResources(ctx context.Context, resourceGroupName string, monitorName string) (result MonitoredResourceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListMonitoredResources") + defer func() { + sc := -1 + if result.mrlr.Response.Response != nil { + sc = result.mrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.MonitorsClient", "ListMonitoredResources", err.Error()) + } + + result.fn = client.listMonitoredResourcesNextResults + req, err := client.ListMonitoredResourcesPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListMonitoredResources", nil, "Failure preparing request") + return + } + + resp, err := client.ListMonitoredResourcesSender(req) + if err != nil { + result.mrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListMonitoredResources", resp, "Failure sending request") + return + } + + result.mrlr, err = client.ListMonitoredResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "ListMonitoredResources", resp, "Failure responding to request") + return + } + if result.mrlr.hasNextLink() && result.mrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListMonitoredResourcesPreparer prepares the ListMonitoredResources request. +func (client MonitorsClient) ListMonitoredResourcesPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListMonitoredResourcesSender sends the ListMonitoredResources request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) ListMonitoredResourcesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListMonitoredResourcesResponder handles the response to the ListMonitoredResources request. The method always +// closes the http.Response Body. +func (client MonitorsClient) ListMonitoredResourcesResponder(resp *http.Response) (result MonitoredResourceListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listMonitoredResourcesNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listMonitoredResourcesNextResults(ctx context.Context, lastResults MonitoredResourceListResponse) (result MonitoredResourceListResponse, err error) { + req, err := lastResults.monitoredResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listMonitoredResourcesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListMonitoredResourcesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listMonitoredResourcesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListMonitoredResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "listMonitoredResourcesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListMonitoredResourcesComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListMonitoredResourcesComplete(ctx context.Context, resourceGroupName string, monitorName string) (result MonitoredResourceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListMonitoredResources") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListMonitoredResources(ctx, resourceGroupName, monitorName) + return +} + +// RefreshSetPasswordLink sends the refresh set password link request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) RefreshSetPasswordLink(ctx context.Context, resourceGroupName string, monitorName string) (result SetPasswordLink, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.RefreshSetPasswordLink") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.MonitorsClient", "RefreshSetPasswordLink", err.Error()) + } + + req, err := client.RefreshSetPasswordLinkPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "RefreshSetPasswordLink", nil, "Failure preparing request") + return + } + + resp, err := client.RefreshSetPasswordLinkSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "RefreshSetPasswordLink", resp, "Failure sending request") + return + } + + result, err = client.RefreshSetPasswordLinkResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "RefreshSetPasswordLink", resp, "Failure responding to request") + return + } + + return +} + +// RefreshSetPasswordLinkPreparer prepares the RefreshSetPasswordLink request. +func (client MonitorsClient) RefreshSetPasswordLinkPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/refreshSetPasswordLink", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RefreshSetPasswordLinkSender sends the RefreshSetPasswordLink request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) RefreshSetPasswordLinkSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RefreshSetPasswordLinkResponder handles the response to the RefreshSetPasswordLink request. The method always +// closes the http.Response Body. +func (client MonitorsClient) RefreshSetPasswordLinkResponder(resp *http.Response) (result SetPasswordLink, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SetDefaultKey sends the set default key request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) SetDefaultKey(ctx context.Context, resourceGroupName string, monitorName string, body *APIKey) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.SetDefaultKey") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Key", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("datadog.MonitorsClient", "SetDefaultKey", err.Error()) + } + + req, err := client.SetDefaultKeyPreparer(ctx, resourceGroupName, monitorName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "SetDefaultKey", nil, "Failure preparing request") + return + } + + resp, err := client.SetDefaultKeySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "SetDefaultKey", resp, "Failure sending request") + return + } + + result, err = client.SetDefaultKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "SetDefaultKey", resp, "Failure responding to request") + return + } + + return +} + +// SetDefaultKeyPreparer prepares the SetDefaultKey request. +func (client MonitorsClient) SetDefaultKeyPreparer(ctx context.Context, resourceGroupName string, monitorName string, body *APIKey) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SetDefaultKeySender sends the SetDefaultKey request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) SetDefaultKeySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SetDefaultKeyResponder handles the response to the SetDefaultKey request. The method always +// closes the http.Response Body. +func (client MonitorsClient) SetDefaultKeyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) Update(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResourceUpdateParameters) (result MonitorsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.MonitorsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, monitorName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client MonitorsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResourceUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) UpdateSender(req *http.Request) (future MonitorsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client MonitorsClient) UpdateResponder(resp *http.Response) (result MonitorResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/operations.go new file mode 100644 index 00000000000..b55ea967799 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/operations.go @@ -0,0 +1,140 @@ +package datadog + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the client for the Operations methods of the Datadog service. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List sends the list request. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Datadog/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "datadog.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datadog.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/singlesignonconfigurations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/singlesignonconfigurations.go new file mode 100644 index 00000000000..e660f292e3f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/singlesignonconfigurations.go @@ -0,0 +1,349 @@ +package datadog + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SingleSignOnConfigurationsClient is the client for the SingleSignOnConfigurations methods of the Datadog service. +type SingleSignOnConfigurationsClient struct { + BaseClient +} + +// NewSingleSignOnConfigurationsClient creates an instance of the SingleSignOnConfigurationsClient client. +func NewSingleSignOnConfigurationsClient(subscriptionID string) SingleSignOnConfigurationsClient { + return NewSingleSignOnConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSingleSignOnConfigurationsClientWithBaseURI creates an instance of the SingleSignOnConfigurationsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewSingleSignOnConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SingleSignOnConfigurationsClient { + return SingleSignOnConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// configurationName - configuration name +func (client SingleSignOnConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, configurationName string, body *SingleSignOnResource) (result SingleSignOnConfigurationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.SingleSignOnConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, monitorName, configurationName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SingleSignOnConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, configurationName string, body *SingleSignOnResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationName": autorest.Encode("path", configurationName), + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SingleSignOnConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future SingleSignOnConfigurationsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SingleSignOnConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result SingleSignOnResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// configurationName - configuration name +func (client SingleSignOnConfigurationsClient) Get(ctx context.Context, resourceGroupName string, monitorName string, configurationName string) (result SingleSignOnResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.SingleSignOnConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, monitorName, configurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SingleSignOnConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, monitorName string, configurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationName": autorest.Encode("path", configurationName), + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SingleSignOnConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SingleSignOnConfigurationsClient) GetResponder(resp *http.Response) (result SingleSignOnResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client SingleSignOnConfigurationsClient) List(ctx context.Context, resourceGroupName string, monitorName string) (result SingleSignOnResourceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnConfigurationsClient.List") + defer func() { + sc := -1 + if result.ssorlr.Response.Response != nil { + sc = result.ssorlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.SingleSignOnConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ssorlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.ssorlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.ssorlr.hasNextLink() && result.ssorlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SingleSignOnConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/singleSignOnConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SingleSignOnConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SingleSignOnConfigurationsClient) ListResponder(resp *http.Response) (result SingleSignOnResourceListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SingleSignOnConfigurationsClient) listNextResults(ctx context.Context, lastResults SingleSignOnResourceListResponse) (result SingleSignOnResourceListResponse, err error) { + req, err := lastResults.singleSignOnResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.SingleSignOnConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SingleSignOnConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result SingleSignOnResourceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, monitorName) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/tagrules.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/tagrules.go new file mode 100644 index 00000000000..475a400f790 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/tagrules.go @@ -0,0 +1,345 @@ +package datadog + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// TagRulesClient is the client for the TagRules methods of the Datadog service. +type TagRulesClient struct { + BaseClient +} + +// NewTagRulesClient creates an instance of the TagRulesClient client. +func NewTagRulesClient(subscriptionID string) TagRulesClient { + return NewTagRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTagRulesClientWithBaseURI creates an instance of the TagRulesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewTagRulesClientWithBaseURI(baseURI string, subscriptionID string) TagRulesClient { + return TagRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// ruleSetName - rule set name +func (client TagRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, body *MonitoringTagRules) (result MonitoringTagRules, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.TagRulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, monitorName, ruleSetName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client TagRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, body *MonitoringTagRules) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.Name = nil + body.ID = nil + body.Type = nil + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client TagRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client TagRulesClient) CreateOrUpdateResponder(resp *http.Response) (result MonitoringTagRules, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// ruleSetName - rule set name +func (client TagRulesClient) Get(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (result MonitoringTagRules, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.TagRulesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, monitorName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client TagRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules/{ruleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TagRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TagRulesClient) GetResponder(resp *http.Response) (result MonitoringTagRules, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client TagRulesClient) List(ctx context.Context, resourceGroupName string, monitorName string) (result MonitoringTagRulesListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.List") + defer func() { + sc := -1 + if result.mtrlr.Response.Response != nil { + sc = result.mtrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datadog.TagRulesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mtrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "List", resp, "Failure sending request") + return + } + + result.mtrlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "List", resp, "Failure responding to request") + return + } + if result.mtrlr.hasNextLink() && result.mtrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client TagRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/tagRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client TagRulesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client TagRulesClient) ListResponder(resp *http.Response) (result MonitoringTagRulesListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client TagRulesClient) listNextResults(ctx context.Context, lastResults MonitoringTagRulesListResponse) (result MonitoringTagRulesListResponse, err error) { + req, err := lastResults.monitoringTagRulesListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "datadog.TagRulesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datadog.TagRulesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.TagRulesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TagRulesClient) ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result MonitoringTagRulesListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, monitorName) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/version.go new file mode 100644 index 00000000000..c14364a08c3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog/version.go @@ -0,0 +1,19 @@ +package datadog + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " datadog/2021-03-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/_meta.json deleted file mode 100644 index f3f56908137..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/dns/resource-manager/readme.md", - "tag": "package-2018-05", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2018-05 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/dns/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/client.go deleted file mode 100644 index 2acecfc15c6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package dns implements the Azure ARM Dns service API version 2018-05-01. -// -// The DNS Management Client. -package dns - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Dns - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Dns. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/enums.go deleted file mode 100644 index 90319affc9b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/enums.go +++ /dev/null @@ -1,53 +0,0 @@ -package dns - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// RecordType enumerates the values for record type. -type RecordType string - -const ( - // A ... - A RecordType = "A" - // AAAA ... - AAAA RecordType = "AAAA" - // CAA ... - CAA RecordType = "CAA" - // CNAME ... - CNAME RecordType = "CNAME" - // MX ... - MX RecordType = "MX" - // NS ... - NS RecordType = "NS" - // PTR ... - PTR RecordType = "PTR" - // SOA ... - SOA RecordType = "SOA" - // SRV ... - SRV RecordType = "SRV" - // TXT ... - TXT RecordType = "TXT" -) - -// PossibleRecordTypeValues returns an array of possible values for the RecordType const type. -func PossibleRecordTypeValues() []RecordType { - return []RecordType{A, AAAA, CAA, CNAME, MX, NS, PTR, SOA, SRV, TXT} -} - -// ZoneType enumerates the values for zone type. -type ZoneType string - -const ( - // Private ... - Private ZoneType = "Private" - // Public ... - Public ZoneType = "Public" -) - -// PossibleZoneTypeValues returns an array of possible values for the ZoneType const type. -func PossibleZoneTypeValues() []ZoneType { - return []ZoneType{Private, Public} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/models.go deleted file mode 100644 index 50355232b1b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/models.go +++ /dev/null @@ -1,961 +0,0 @@ -package dns - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" - -// AaaaRecord an AAAA record. -type AaaaRecord struct { - // Ipv6Address - The IPv6 address of this AAAA record. - Ipv6Address *string `json:"ipv6Address,omitempty"` -} - -// ARecord an A record. -type ARecord struct { - // Ipv4Address - The IPv4 address of this A record. - Ipv4Address *string `json:"ipv4Address,omitempty"` -} - -// CaaRecord a CAA record. -type CaaRecord struct { - // Flags - The flags for this CAA record as an integer between 0 and 255. - Flags *int32 `json:"flags,omitempty"` - // Tag - The tag for this CAA record. - Tag *string `json:"tag,omitempty"` - // Value - The value for this CAA record. - Value *string `json:"value,omitempty"` -} - -// CloudError an error response from the service. -type CloudError struct { - // Error - Cloud error body. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from the service. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// CnameRecord a CNAME record. -type CnameRecord struct { - // Cname - The canonical name for this CNAME record. - Cname *string `json:"cname,omitempty"` -} - -// MxRecord an MX record. -type MxRecord struct { - // Preference - The preference value for this MX record. - Preference *int32 `json:"preference,omitempty"` - // Exchange - The domain name of the mail host for this MX record. - Exchange *string `json:"exchange,omitempty"` -} - -// NsRecord an NS record. -type NsRecord struct { - // Nsdname - The name server name for this NS record. - Nsdname *string `json:"nsdname,omitempty"` -} - -// PtrRecord a PTR record. -type PtrRecord struct { - // Ptrdname - The PTR target domain name for this PTR record. - Ptrdname *string `json:"ptrdname,omitempty"` -} - -// RecordSet describes a DNS record set (a collection of DNS records with the same name and type). -type RecordSet struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The ID of the record set. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the record set. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the record set. - Type *string `json:"type,omitempty"` - // Etag - The etag of the record set. - Etag *string `json:"etag,omitempty"` - // RecordSetProperties - The properties of the record set. - *RecordSetProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecordSet. -func (rs RecordSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rs.Etag != nil { - objectMap["etag"] = rs.Etag - } - if rs.RecordSetProperties != nil { - objectMap["properties"] = rs.RecordSetProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecordSet struct. -func (rs *RecordSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rs.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rs.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rs.Type = &typeVar - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - rs.Etag = &etag - } - case "properties": - if v != nil { - var recordSetProperties RecordSetProperties - err = json.Unmarshal(*v, &recordSetProperties) - if err != nil { - return err - } - rs.RecordSetProperties = &recordSetProperties - } - } - } - - return nil -} - -// RecordSetListResult the response to a record set List operation. -type RecordSetListResult struct { - autorest.Response `json:"-"` - // Value - Information about the record sets in the response. - Value *[]RecordSet `json:"value,omitempty"` - // NextLink - READ-ONLY; The continuation token for the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecordSetListResult. -func (rslr RecordSetListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rslr.Value != nil { - objectMap["value"] = rslr.Value - } - return json.Marshal(objectMap) -} - -// RecordSetListResultIterator provides access to a complete listing of RecordSet values. -type RecordSetListResultIterator struct { - i int - page RecordSetListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RecordSetListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RecordSetListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RecordSetListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RecordSetListResultIterator) Response() RecordSetListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RecordSetListResultIterator) Value() RecordSet { - if !iter.page.NotDone() { - return RecordSet{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RecordSetListResultIterator type. -func NewRecordSetListResultIterator(page RecordSetListResultPage) RecordSetListResultIterator { - return RecordSetListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rslr RecordSetListResult) IsEmpty() bool { - return rslr.Value == nil || len(*rslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rslr RecordSetListResult) hasNextLink() bool { - return rslr.NextLink != nil && len(*rslr.NextLink) != 0 -} - -// recordSetListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rslr RecordSetListResult) recordSetListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rslr.NextLink))) -} - -// RecordSetListResultPage contains a page of RecordSet values. -type RecordSetListResultPage struct { - fn func(context.Context, RecordSetListResult) (RecordSetListResult, error) - rslr RecordSetListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RecordSetListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rslr) - if err != nil { - return err - } - page.rslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RecordSetListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RecordSetListResultPage) NotDone() bool { - return !page.rslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RecordSetListResultPage) Response() RecordSetListResult { - return page.rslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RecordSetListResultPage) Values() []RecordSet { - if page.rslr.IsEmpty() { - return nil - } - return *page.rslr.Value -} - -// Creates a new instance of the RecordSetListResultPage type. -func NewRecordSetListResultPage(cur RecordSetListResult, getNextPage func(context.Context, RecordSetListResult) (RecordSetListResult, error)) RecordSetListResultPage { - return RecordSetListResultPage{ - fn: getNextPage, - rslr: cur, - } -} - -// RecordSetProperties represents the properties of the records in the record set. -type RecordSetProperties struct { - // Metadata - The metadata attached to the record set. - Metadata map[string]*string `json:"metadata"` - // TTL - The TTL (time-to-live) of the records in the record set. - TTL *int64 `json:"TTL,omitempty"` - // Fqdn - READ-ONLY; Fully qualified domain name of the record set. - Fqdn *string `json:"fqdn,omitempty"` - // ProvisioningState - READ-ONLY; provisioning State of the record set. - ProvisioningState *string `json:"provisioningState,omitempty"` - // TargetResource - A reference to an azure resource from where the dns resource value is taken. - TargetResource *SubResource `json:"targetResource,omitempty"` - // ARecords - The list of A records in the record set. - ARecords *[]ARecord `json:"ARecords,omitempty"` - // AaaaRecords - The list of AAAA records in the record set. - AaaaRecords *[]AaaaRecord `json:"AAAARecords,omitempty"` - // MxRecords - The list of MX records in the record set. - MxRecords *[]MxRecord `json:"MXRecords,omitempty"` - // NsRecords - The list of NS records in the record set. - NsRecords *[]NsRecord `json:"NSRecords,omitempty"` - // PtrRecords - The list of PTR records in the record set. - PtrRecords *[]PtrRecord `json:"PTRRecords,omitempty"` - // SrvRecords - The list of SRV records in the record set. - SrvRecords *[]SrvRecord `json:"SRVRecords,omitempty"` - // TxtRecords - The list of TXT records in the record set. - TxtRecords *[]TxtRecord `json:"TXTRecords,omitempty"` - // CnameRecord - The CNAME record in the record set. - CnameRecord *CnameRecord `json:"CNAMERecord,omitempty"` - // SoaRecord - The SOA record in the record set. - SoaRecord *SoaRecord `json:"SOARecord,omitempty"` - // CaaRecords - The list of CAA records in the record set. - CaaRecords *[]CaaRecord `json:"caaRecords,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecordSetProperties. -func (rsp RecordSetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rsp.Metadata != nil { - objectMap["metadata"] = rsp.Metadata - } - if rsp.TTL != nil { - objectMap["TTL"] = rsp.TTL - } - if rsp.TargetResource != nil { - objectMap["targetResource"] = rsp.TargetResource - } - if rsp.ARecords != nil { - objectMap["ARecords"] = rsp.ARecords - } - if rsp.AaaaRecords != nil { - objectMap["AAAARecords"] = rsp.AaaaRecords - } - if rsp.MxRecords != nil { - objectMap["MXRecords"] = rsp.MxRecords - } - if rsp.NsRecords != nil { - objectMap["NSRecords"] = rsp.NsRecords - } - if rsp.PtrRecords != nil { - objectMap["PTRRecords"] = rsp.PtrRecords - } - if rsp.SrvRecords != nil { - objectMap["SRVRecords"] = rsp.SrvRecords - } - if rsp.TxtRecords != nil { - objectMap["TXTRecords"] = rsp.TxtRecords - } - if rsp.CnameRecord != nil { - objectMap["CNAMERecord"] = rsp.CnameRecord - } - if rsp.SoaRecord != nil { - objectMap["SOARecord"] = rsp.SoaRecord - } - if rsp.CaaRecords != nil { - objectMap["caaRecords"] = rsp.CaaRecords - } - return json.Marshal(objectMap) -} - -// RecordSetUpdateParameters parameters supplied to update a record set. -type RecordSetUpdateParameters struct { - // RecordSet - Specifies information about the record set being updated. - RecordSet *RecordSet `json:"RecordSet,omitempty"` -} - -// Resource common properties of an Azure Resource Manager resource -type Resource struct { - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// ResourceReference represents a single Azure resource and its referencing DNS records. -type ResourceReference struct { - // DNSResources - A list of dns Records - DNSResources *[]SubResource `json:"dnsResources,omitempty"` - // TargetResource - A reference to an azure resource from where the dns resource value is taken. - TargetResource *SubResource `json:"targetResource,omitempty"` -} - -// ResourceReferenceRequest represents the properties of the Dns Resource Reference Request. -type ResourceReferenceRequest struct { - // ResourceReferenceRequestProperties - The properties of the Resource Reference Request. - *ResourceReferenceRequestProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceReferenceRequest. -func (rrr ResourceReferenceRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rrr.ResourceReferenceRequestProperties != nil { - objectMap["properties"] = rrr.ResourceReferenceRequestProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ResourceReferenceRequest struct. -func (rrr *ResourceReferenceRequest) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var resourceReferenceRequestProperties ResourceReferenceRequestProperties - err = json.Unmarshal(*v, &resourceReferenceRequestProperties) - if err != nil { - return err - } - rrr.ResourceReferenceRequestProperties = &resourceReferenceRequestProperties - } - } - } - - return nil -} - -// ResourceReferenceRequestProperties represents the properties of the Dns Resource Reference Request. -type ResourceReferenceRequestProperties struct { - // TargetResources - A list of references to azure resources for which referencing dns records need to be queried. - TargetResources *[]SubResource `json:"targetResources,omitempty"` -} - -// ResourceReferenceResult represents the properties of the Dns Resource Reference Result. -type ResourceReferenceResult struct { - autorest.Response `json:"-"` - // ResourceReferenceResultProperties - The result of dns resource reference request. Returns a list of dns resource references for each of the azure resource in the request. - *ResourceReferenceResultProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceReferenceResult. -func (rrr ResourceReferenceResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rrr.ResourceReferenceResultProperties != nil { - objectMap["properties"] = rrr.ResourceReferenceResultProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ResourceReferenceResult struct. -func (rrr *ResourceReferenceResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var resourceReferenceResultProperties ResourceReferenceResultProperties - err = json.Unmarshal(*v, &resourceReferenceResultProperties) - if err != nil { - return err - } - rrr.ResourceReferenceResultProperties = &resourceReferenceResultProperties - } - } - } - - return nil -} - -// ResourceReferenceResultProperties the result of dns resource reference request. Returns a list of dns -// resource references for each of the azure resource in the request. -type ResourceReferenceResultProperties struct { - // DNSResourceReferences - The result of dns resource reference request. A list of dns resource references for each of the azure resource in the request - DNSResourceReferences *[]ResourceReference `json:"dnsResourceReferences,omitempty"` -} - -// SoaRecord an SOA record. -type SoaRecord struct { - // Host - The domain name of the authoritative name server for this SOA record. - Host *string `json:"host,omitempty"` - // Email - The email contact for this SOA record. - Email *string `json:"email,omitempty"` - // SerialNumber - The serial number for this SOA record. - SerialNumber *int64 `json:"serialNumber,omitempty"` - // RefreshTime - The refresh value for this SOA record. - RefreshTime *int64 `json:"refreshTime,omitempty"` - // RetryTime - The retry time for this SOA record. - RetryTime *int64 `json:"retryTime,omitempty"` - // ExpireTime - The expire time for this SOA record. - ExpireTime *int64 `json:"expireTime,omitempty"` - // MinimumTTL - The minimum value for this SOA record. By convention this is used to determine the negative caching duration. - MinimumTTL *int64 `json:"minimumTTL,omitempty"` -} - -// SrvRecord an SRV record. -type SrvRecord struct { - // Priority - The priority value for this SRV record. - Priority *int32 `json:"priority,omitempty"` - // Weight - The weight value for this SRV record. - Weight *int32 `json:"weight,omitempty"` - // Port - The port value for this SRV record. - Port *int32 `json:"port,omitempty"` - // Target - The target domain name for this SRV record. - Target *string `json:"target,omitempty"` -} - -// SubResource a reference to a another resource -type SubResource struct { - // ID - Resource Id. - ID *string `json:"id,omitempty"` -} - -// TxtRecord a TXT record. -type TxtRecord struct { - // Value - The text value of this TXT record. - Value *[]string `json:"value,omitempty"` -} - -// Zone describes a DNS zone. -type Zone struct { - autorest.Response `json:"-"` - // Etag - The etag of the zone. - Etag *string `json:"etag,omitempty"` - // ZoneProperties - The properties of the zone. - *ZoneProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Zone. -func (z Zone) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if z.Etag != nil { - objectMap["etag"] = z.Etag - } - if z.ZoneProperties != nil { - objectMap["properties"] = z.ZoneProperties - } - if z.Location != nil { - objectMap["location"] = z.Location - } - if z.Tags != nil { - objectMap["tags"] = z.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Zone struct. -func (z *Zone) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - z.Etag = &etag - } - case "properties": - if v != nil { - var zoneProperties ZoneProperties - err = json.Unmarshal(*v, &zoneProperties) - if err != nil { - return err - } - z.ZoneProperties = &zoneProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - z.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - z.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - z.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - z.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - z.Tags = tags - } - } - } - - return nil -} - -// ZoneListResult the response to a Zone List or ListAll operation. -type ZoneListResult struct { - autorest.Response `json:"-"` - // Value - Information about the DNS zones. - Value *[]Zone `json:"value,omitempty"` - // NextLink - READ-ONLY; The continuation token for the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ZoneListResult. -func (zlr ZoneListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if zlr.Value != nil { - objectMap["value"] = zlr.Value - } - return json.Marshal(objectMap) -} - -// ZoneListResultIterator provides access to a complete listing of Zone values. -type ZoneListResultIterator struct { - i int - page ZoneListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ZoneListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ZoneListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ZoneListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ZoneListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ZoneListResultIterator) Response() ZoneListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ZoneListResultIterator) Value() Zone { - if !iter.page.NotDone() { - return Zone{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ZoneListResultIterator type. -func NewZoneListResultIterator(page ZoneListResultPage) ZoneListResultIterator { - return ZoneListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (zlr ZoneListResult) IsEmpty() bool { - return zlr.Value == nil || len(*zlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (zlr ZoneListResult) hasNextLink() bool { - return zlr.NextLink != nil && len(*zlr.NextLink) != 0 -} - -// zoneListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (zlr ZoneListResult) zoneListResultPreparer(ctx context.Context) (*http.Request, error) { - if !zlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(zlr.NextLink))) -} - -// ZoneListResultPage contains a page of Zone values. -type ZoneListResultPage struct { - fn func(context.Context, ZoneListResult) (ZoneListResult, error) - zlr ZoneListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ZoneListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ZoneListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.zlr) - if err != nil { - return err - } - page.zlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ZoneListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ZoneListResultPage) NotDone() bool { - return !page.zlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ZoneListResultPage) Response() ZoneListResult { - return page.zlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ZoneListResultPage) Values() []Zone { - if page.zlr.IsEmpty() { - return nil - } - return *page.zlr.Value -} - -// Creates a new instance of the ZoneListResultPage type. -func NewZoneListResultPage(cur ZoneListResult, getNextPage func(context.Context, ZoneListResult) (ZoneListResult, error)) ZoneListResultPage { - return ZoneListResultPage{ - fn: getNextPage, - zlr: cur, - } -} - -// ZoneProperties represents the properties of the zone. -type ZoneProperties struct { - // MaxNumberOfRecordSets - READ-ONLY; The maximum number of record sets that can be created in this DNS zone. This is a read-only property and any attempt to set this value will be ignored. - MaxNumberOfRecordSets *int64 `json:"maxNumberOfRecordSets,omitempty"` - // MaxNumberOfRecordsPerRecordSet - READ-ONLY; The maximum number of records per record set that can be created in this DNS zone. This is a read-only property and any attempt to set this value will be ignored. - MaxNumberOfRecordsPerRecordSet *int64 `json:"maxNumberOfRecordsPerRecordSet,omitempty"` - // NumberOfRecordSets - READ-ONLY; The current number of record sets in this DNS zone. This is a read-only property and any attempt to set this value will be ignored. - NumberOfRecordSets *int64 `json:"numberOfRecordSets,omitempty"` - // NameServers - READ-ONLY; The name servers for this DNS zone. This is a read-only property and any attempt to set this value will be ignored. - NameServers *[]string `json:"nameServers,omitempty"` - // ZoneType - The type of this DNS zone (Public or Private). Possible values include: 'Public', 'Private' - ZoneType ZoneType `json:"zoneType,omitempty"` - // RegistrationVirtualNetworks - A list of references to virtual networks that register hostnames in this DNS zone. This is a only when ZoneType is Private. - RegistrationVirtualNetworks *[]SubResource `json:"registrationVirtualNetworks,omitempty"` - // ResolutionVirtualNetworks - A list of references to virtual networks that resolve records in this DNS zone. This is a only when ZoneType is Private. - ResolutionVirtualNetworks *[]SubResource `json:"resolutionVirtualNetworks,omitempty"` -} - -// MarshalJSON is the custom marshaler for ZoneProperties. -func (zp ZoneProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if zp.ZoneType != "" { - objectMap["zoneType"] = zp.ZoneType - } - if zp.RegistrationVirtualNetworks != nil { - objectMap["registrationVirtualNetworks"] = zp.RegistrationVirtualNetworks - } - if zp.ResolutionVirtualNetworks != nil { - objectMap["resolutionVirtualNetworks"] = zp.ResolutionVirtualNetworks - } - return json.Marshal(objectMap) -} - -// ZonesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type ZonesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ZonesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ZonesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ZonesDeleteFuture.Result. -func (future *ZonesDeleteFuture) result(client ZonesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dns.ZonesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ZoneUpdate describes a request to update a DNS zone. -type ZoneUpdate struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ZoneUpdate. -func (zu ZoneUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if zu.Tags != nil { - objectMap["tags"] = zu.Tags - } - return json.Marshal(objectMap) -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/recordsets.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/recordsets.go deleted file mode 100644 index d3aa10e26d2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/recordsets.go +++ /dev/null @@ -1,774 +0,0 @@ -package dns - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RecordSetsClient is the the DNS Management Client. -type RecordSetsClient struct { - BaseClient -} - -// NewRecordSetsClient creates an instance of the RecordSetsClient client. -func NewRecordSetsClient(subscriptionID string) RecordSetsClient { - return NewRecordSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecordSetsClientWithBaseURI creates an instance of the RecordSetsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewRecordSetsClientWithBaseURI(baseURI string, subscriptionID string) RecordSetsClient { - return RecordSetsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a record set within a DNS zone. -// Parameters: -// resourceGroupName - the name of the resource group. -// zoneName - the name of the DNS zone (without a terminating dot). -// relativeRecordSetName - the name of the record set, relative to the name of the zone. -// recordType - the type of DNS record in this record set. Record sets of type SOA can be updated but not -// created (they are created when the DNS zone is created). -// parameters - parameters supplied to the CreateOrUpdate operation. -// ifMatch - the etag of the record set. Omit this value to always overwrite the current record set. Specify -// the last-seen etag value to prevent accidentally overwriting any concurrent changes. -// ifNoneMatch - set to '*' to allow a new record set to be created, but to prevent updating an existing record -// set. Other values will be ignored. -func (client RecordSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (result RecordSet, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch, ifNoneMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RecordSetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recordType": autorest.Encode("path", recordType), - "relativeRecordSetName": relativeRecordSetName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Name = nil - parameters.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - if len(ifNoneMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RecordSetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RecordSetsClient) CreateOrUpdateResponder(resp *http.Response) (result RecordSet, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a record set from a DNS zone. This operation cannot be undone. -// Parameters: -// resourceGroupName - the name of the resource group. -// zoneName - the name of the DNS zone (without a terminating dot). -// relativeRecordSetName - the name of the record set, relative to the name of the zone. -// recordType - the type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are -// deleted when the DNS zone is deleted). -// ifMatch - the etag of the record set. Omit this value to always delete the current record set. Specify the -// last-seen etag value to prevent accidentally deleting any concurrent changes. -func (client RecordSetsClient) Delete(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RecordSetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recordType": autorest.Encode("path", recordType), - "relativeRecordSetName": relativeRecordSetName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RecordSetsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RecordSetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a record set. -// Parameters: -// resourceGroupName - the name of the resource group. -// zoneName - the name of the DNS zone (without a terminating dot). -// relativeRecordSetName - the name of the record set, relative to the name of the zone. -// recordType - the type of DNS record in this record set. -func (client RecordSetsClient) Get(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (result RecordSet, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RecordSetsClient) GetPreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recordType": autorest.Encode("path", recordType), - "relativeRecordSetName": relativeRecordSetName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RecordSetsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RecordSetsClient) GetResponder(resp *http.Response) (result RecordSet, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAllByDNSZone lists all record sets in a DNS zone. -// Parameters: -// resourceGroupName - the name of the resource group. -// zoneName - the name of the DNS zone (without a terminating dot). -// top - the maximum number of record sets to return. If not specified, returns up to 100 record sets. -// recordSetNameSuffix - the suffix label of the record set name that has to be used to filter the record set -// enumerations. If this parameter is specified, Enumeration will return only records that end with -// . -func (client RecordSetsClient) ListAllByDNSZone(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordSetNameSuffix string) (result RecordSetListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.ListAllByDNSZone") - defer func() { - sc := -1 - if result.rslr.Response.Response != nil { - sc = result.rslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listAllByDNSZoneNextResults - req, err := client.ListAllByDNSZonePreparer(ctx, resourceGroupName, zoneName, top, recordSetNameSuffix) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListAllByDNSZone", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllByDNSZoneSender(req) - if err != nil { - result.rslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListAllByDNSZone", resp, "Failure sending request") - return - } - - result.rslr, err = client.ListAllByDNSZoneResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListAllByDNSZone", resp, "Failure responding to request") - return - } - if result.rslr.hasNextLink() && result.rslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAllByDNSZonePreparer prepares the ListAllByDNSZone request. -func (client RecordSetsClient) ListAllByDNSZonePreparer(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordSetNameSuffix string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(recordSetNameSuffix) > 0 { - queryParameters["$recordsetnamesuffix"] = autorest.Encode("query", recordSetNameSuffix) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/all", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAllByDNSZoneSender sends the ListAllByDNSZone request. The method will close the -// http.Response Body if it receives an error. -func (client RecordSetsClient) ListAllByDNSZoneSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAllByDNSZoneResponder handles the response to the ListAllByDNSZone request. The method always -// closes the http.Response Body. -func (client RecordSetsClient) ListAllByDNSZoneResponder(resp *http.Response) (result RecordSetListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAllByDNSZoneNextResults retrieves the next set of results, if any. -func (client RecordSetsClient) listAllByDNSZoneNextResults(ctx context.Context, lastResults RecordSetListResult) (result RecordSetListResult, err error) { - req, err := lastResults.recordSetListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listAllByDNSZoneNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAllByDNSZoneSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listAllByDNSZoneNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAllByDNSZoneResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listAllByDNSZoneNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAllByDNSZoneComplete enumerates all values, automatically crossing page boundaries as required. -func (client RecordSetsClient) ListAllByDNSZoneComplete(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordSetNameSuffix string) (result RecordSetListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.ListAllByDNSZone") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAllByDNSZone(ctx, resourceGroupName, zoneName, top, recordSetNameSuffix) - return -} - -// ListByDNSZone lists all record sets in a DNS zone. -// Parameters: -// resourceGroupName - the name of the resource group. -// zoneName - the name of the DNS zone (without a terminating dot). -// top - the maximum number of record sets to return. If not specified, returns up to 100 record sets. -// recordsetnamesuffix - the suffix label of the record set name that has to be used to filter the record set -// enumerations. If this parameter is specified, Enumeration will return only records that end with -// . -func (client RecordSetsClient) ListByDNSZone(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (result RecordSetListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.ListByDNSZone") - defer func() { - sc := -1 - if result.rslr.Response.Response != nil { - sc = result.rslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByDNSZoneNextResults - req, err := client.ListByDNSZonePreparer(ctx, resourceGroupName, zoneName, top, recordsetnamesuffix) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDNSZoneSender(req) - if err != nil { - result.rslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure sending request") - return - } - - result.rslr, err = client.ListByDNSZoneResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure responding to request") - return - } - if result.rslr.hasNextLink() && result.rslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByDNSZonePreparer prepares the ListByDNSZone request. -func (client RecordSetsClient) ListByDNSZonePreparer(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(recordsetnamesuffix) > 0 { - queryParameters["$recordsetnamesuffix"] = autorest.Encode("query", recordsetnamesuffix) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/recordsets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDNSZoneSender sends the ListByDNSZone request. The method will close the -// http.Response Body if it receives an error. -func (client RecordSetsClient) ListByDNSZoneSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDNSZoneResponder handles the response to the ListByDNSZone request. The method always -// closes the http.Response Body. -func (client RecordSetsClient) ListByDNSZoneResponder(resp *http.Response) (result RecordSetListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByDNSZoneNextResults retrieves the next set of results, if any. -func (client RecordSetsClient) listByDNSZoneNextResults(ctx context.Context, lastResults RecordSetListResult) (result RecordSetListResult, err error) { - req, err := lastResults.recordSetListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByDNSZoneNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByDNSZoneSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByDNSZoneNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByDNSZoneResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByDNSZoneNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByDNSZoneComplete enumerates all values, automatically crossing page boundaries as required. -func (client RecordSetsClient) ListByDNSZoneComplete(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (result RecordSetListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.ListByDNSZone") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByDNSZone(ctx, resourceGroupName, zoneName, top, recordsetnamesuffix) - return -} - -// ListByType lists the record sets of a specified type in a DNS zone. -// Parameters: -// resourceGroupName - the name of the resource group. -// zoneName - the name of the DNS zone (without a terminating dot). -// recordType - the type of record sets to enumerate. -// top - the maximum number of record sets to return. If not specified, returns up to 100 record sets. -// recordsetnamesuffix - the suffix label of the record set name that has to be used to filter the record set -// enumerations. If this parameter is specified, Enumeration will return only records that end with -// . -func (client RecordSetsClient) ListByType(ctx context.Context, resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (result RecordSetListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.ListByType") - defer func() { - sc := -1 - if result.rslr.Response.Response != nil { - sc = result.rslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByTypeNextResults - req, err := client.ListByTypePreparer(ctx, resourceGroupName, zoneName, recordType, top, recordsetnamesuffix) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTypeSender(req) - if err != nil { - result.rslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure sending request") - return - } - - result.rslr, err = client.ListByTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure responding to request") - return - } - if result.rslr.hasNextLink() && result.rslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTypePreparer prepares the ListByType request. -func (client RecordSetsClient) ListByTypePreparer(ctx context.Context, resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recordType": autorest.Encode("path", recordType), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(recordsetnamesuffix) > 0 { - queryParameters["$recordsetnamesuffix"] = autorest.Encode("query", recordsetnamesuffix) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTypeSender sends the ListByType request. The method will close the -// http.Response Body if it receives an error. -func (client RecordSetsClient) ListByTypeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTypeResponder handles the response to the ListByType request. The method always -// closes the http.Response Body. -func (client RecordSetsClient) ListByTypeResponder(resp *http.Response) (result RecordSetListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTypeNextResults retrieves the next set of results, if any. -func (client RecordSetsClient) listByTypeNextResults(ctx context.Context, lastResults RecordSetListResult) (result RecordSetListResult, err error) { - req, err := lastResults.recordSetListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByTypeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTypeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByTypeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTypeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByTypeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTypeComplete enumerates all values, automatically crossing page boundaries as required. -func (client RecordSetsClient) ListByTypeComplete(ctx context.Context, resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (result RecordSetListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.ListByType") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByType(ctx, resourceGroupName, zoneName, recordType, top, recordsetnamesuffix) - return -} - -// Update updates a record set within a DNS zone. -// Parameters: -// resourceGroupName - the name of the resource group. -// zoneName - the name of the DNS zone (without a terminating dot). -// relativeRecordSetName - the name of the record set, relative to the name of the zone. -// recordType - the type of DNS record in this record set. -// parameters - parameters supplied to the Update operation. -// ifMatch - the etag of the record set. Omit this value to always overwrite the current record set. Specify -// the last-seen etag value to prevent accidentally overwriting concurrent changes. -func (client RecordSetsClient) Update(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (result RecordSet, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RecordSetsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "recordType": autorest.Encode("path", recordType), - "relativeRecordSetName": relativeRecordSetName, - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Name = nil - parameters.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client RecordSetsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client RecordSetsClient) UpdateResponder(resp *http.Response) (result RecordSet, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/resourcereference.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/resourcereference.go deleted file mode 100644 index 875735853f3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/resourcereference.go +++ /dev/null @@ -1,107 +0,0 @@ -package dns - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ResourceReferenceClient is the the DNS Management Client. -type ResourceReferenceClient struct { - BaseClient -} - -// NewResourceReferenceClient creates an instance of the ResourceReferenceClient client. -func NewResourceReferenceClient(subscriptionID string) ResourceReferenceClient { - return NewResourceReferenceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewResourceReferenceClientWithBaseURI creates an instance of the ResourceReferenceClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewResourceReferenceClientWithBaseURI(baseURI string, subscriptionID string) ResourceReferenceClient { - return ResourceReferenceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByTargetResources returns the DNS records specified by the referencing targetResourceIds. -// Parameters: -// parameters - properties for dns resource reference request. -func (client ResourceReferenceClient) GetByTargetResources(ctx context.Context, parameters ResourceReferenceRequest) (result ResourceReferenceResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceReferenceClient.GetByTargetResources") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByTargetResourcesPreparer(ctx, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ResourceReferenceClient", "GetByTargetResources", nil, "Failure preparing request") - return - } - - resp, err := client.GetByTargetResourcesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.ResourceReferenceClient", "GetByTargetResources", resp, "Failure sending request") - return - } - - result, err = client.GetByTargetResourcesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ResourceReferenceClient", "GetByTargetResources", resp, "Failure responding to request") - return - } - - return -} - -// GetByTargetResourcesPreparer prepares the GetByTargetResources request. -func (client ResourceReferenceClient) GetByTargetResourcesPreparer(ctx context.Context, parameters ResourceReferenceRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/getDnsResourceReference", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByTargetResourcesSender sends the GetByTargetResources request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceReferenceClient) GetByTargetResourcesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByTargetResourcesResponder handles the response to the GetByTargetResources request. The method always -// closes the http.Response Body. -func (client ResourceReferenceClient) GetByTargetResourcesResponder(resp *http.Response) (result ResourceReferenceResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/version.go deleted file mode 100644 index 940b45d22f9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package dns - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " dns/2018-05-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/zones.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/zones.go deleted file mode 100644 index e004a725354..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/zones.go +++ /dev/null @@ -1,606 +0,0 @@ -package dns - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ZonesClient is the the DNS Management Client. -type ZonesClient struct { - BaseClient -} - -// NewZonesClient creates an instance of the ZonesClient client. -func NewZonesClient(subscriptionID string) ZonesClient { - return NewZonesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewZonesClientWithBaseURI creates an instance of the ZonesClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewZonesClientWithBaseURI(baseURI string, subscriptionID string) ZonesClient { - return ZonesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a DNS zone. Does not modify DNS records within the zone. -// Parameters: -// resourceGroupName - the name of the resource group. -// zoneName - the name of the DNS zone (without a terminating dot). -// parameters - parameters supplied to the CreateOrUpdate operation. -// ifMatch - the etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the -// last-seen etag value to prevent accidentally overwriting any concurrent changes. -// ifNoneMatch - set to '*' to allow a new DNS zone to be created, but to prevent updating an existing zone. -// Other values will be ignored. -func (client ZonesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (result Zone, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ZonesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, zoneName, parameters, ifMatch, ifNoneMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ZonesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - if len(ifNoneMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ZonesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ZonesClient) CreateOrUpdateResponder(resp *http.Response) (result Zone, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be -// undone. -// Parameters: -// resourceGroupName - the name of the resource group. -// zoneName - the name of the DNS zone (without a terminating dot). -// ifMatch - the etag of the DNS zone. Omit this value to always delete the current zone. Specify the last-seen -// etag value to prevent accidentally deleting any concurrent changes. -func (client ZonesClient) Delete(ctx context.Context, resourceGroupName string, zoneName string, ifMatch string) (result ZonesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ZonesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, zoneName, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ZonesClient) DeletePreparer(ctx context.Context, resourceGroupName string, zoneName string, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ZonesClient) DeleteSender(req *http.Request) (future ZonesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ZonesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. -// Parameters: -// resourceGroupName - the name of the resource group. -// zoneName - the name of the DNS zone (without a terminating dot). -func (client ZonesClient) Get(ctx context.Context, resourceGroupName string, zoneName string) (result Zone, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ZonesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, zoneName) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ZonesClient) GetPreparer(ctx context.Context, resourceGroupName string, zoneName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ZonesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ZonesClient) GetResponder(resp *http.Response) (result Zone, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the DNS zones in all resource groups in a subscription. -// Parameters: -// top - the maximum number of DNS zones to return. If not specified, returns up to 100 zones. -func (client ZonesClient) List(ctx context.Context, top *int32) (result ZoneListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ZonesClient.List") - defer func() { - sc := -1 - if result.zlr.Response.Response != nil { - sc = result.zlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, top) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.zlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure sending request") - return - } - - result.zlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure responding to request") - return - } - if result.zlr.hasNextLink() && result.zlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ZonesClient) ListPreparer(ctx context.Context, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnszones", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ZonesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ZonesClient) ListResponder(resp *http.Response) (result ZoneListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ZonesClient) listNextResults(ctx context.Context, lastResults ZoneListResult) (result ZoneListResult, err error) { - req, err := lastResults.zoneListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ZonesClient) ListComplete(ctx context.Context, top *int32) (result ZoneListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ZonesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, top) - return -} - -// ListByResourceGroup lists the DNS zones within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -// top - the maximum number of record sets to return. If not specified, returns up to 100 record sets. -func (client ZonesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32) (result ZoneListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ZonesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.zlr.Response.Response != nil { - sc = result.zlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.zlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.zlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.zlr.hasNextLink() && result.zlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ZonesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ZonesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ZonesClient) ListByResourceGroupResponder(resp *http.Response) (result ZoneListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ZonesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ZoneListResult) (result ZoneListResult, err error) { - req, err := lastResults.zoneListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ZonesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, top *int32) (result ZoneListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ZonesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, top) - return -} - -// Update updates a DNS zone. Does not modify DNS records within the zone. -// Parameters: -// resourceGroupName - the name of the resource group. -// zoneName - the name of the DNS zone (without a terminating dot). -// parameters - parameters supplied to the Update operation. -// ifMatch - the etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the -// last-seen etag value to prevent accidentally overwriting any concurrent changes. -func (client ZonesClient) Update(ctx context.Context, resourceGroupName string, zoneName string, parameters ZoneUpdate, ifMatch string) (result Zone, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ZonesClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, zoneName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ZonesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, zoneName string, parameters ZoneUpdate, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "zoneName": autorest.Encode("path", zoneName), - } - - const APIVersion = "2018-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ZonesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ZonesClient) UpdateResponder(resp *http.Response) (result Zone, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/_meta.json deleted file mode 100644 index a747a6c64ba..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/domainservices/resource-manager/readme.md", - "tag": "package-2020-01", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/domainservices/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/client.go deleted file mode 100644 index 910b84b2297..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package aad implements the Azure ARM Aad service API version 2020-01-01. -// -// The AAD Domain Services API. -package aad - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Aad - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Aad. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/domainserviceoperations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/domainserviceoperations.go deleted file mode 100644 index d64ff6d3d9e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/domainserviceoperations.go +++ /dev/null @@ -1,141 +0,0 @@ -package aad - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DomainServiceOperationsClient is the the AAD Domain Services API. -type DomainServiceOperationsClient struct { - BaseClient -} - -// NewDomainServiceOperationsClient creates an instance of the DomainServiceOperationsClient client. -func NewDomainServiceOperationsClient(subscriptionID string) DomainServiceOperationsClient { - return NewDomainServiceOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDomainServiceOperationsClientWithBaseURI creates an instance of the DomainServiceOperationsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewDomainServiceOperationsClientWithBaseURI(baseURI string, subscriptionID string) DomainServiceOperationsClient { - return DomainServiceOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all the available Domain Services operations. -func (client DomainServiceOperationsClient) List(ctx context.Context) (result OperationEntityListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceOperationsClient.List") - defer func() { - sc := -1 - if result.oelr.Response.Response != nil { - sc = result.oelr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.oelr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "List", resp, "Failure sending request") - return - } - - result.oelr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "List", resp, "Failure responding to request") - return - } - if result.oelr.hasNextLink() && result.oelr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DomainServiceOperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.AAD/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DomainServiceOperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DomainServiceOperationsClient) ListResponder(resp *http.Response) (result OperationEntityListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client DomainServiceOperationsClient) listNextResults(ctx context.Context, lastResults OperationEntityListResult) (result OperationEntityListResult, err error) { - req, err := lastResults.operationEntityListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainServiceOperationsClient) ListComplete(ctx context.Context) (result OperationEntityListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceOperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/domainservices.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/domainservices.go deleted file mode 100644 index fd6c17a2b87..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/domainservices.go +++ /dev/null @@ -1,629 +0,0 @@ -package aad - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DomainServicesClient is the the AAD Domain Services API. -type DomainServicesClient struct { - BaseClient -} - -// NewDomainServicesClient creates an instance of the DomainServicesClient client. -func NewDomainServicesClient(subscriptionID string) DomainServicesClient { - return NewDomainServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDomainServicesClientWithBaseURI creates an instance of the DomainServicesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDomainServicesClientWithBaseURI(baseURI string, subscriptionID string) DomainServicesClient { - return DomainServicesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate the Create Domain Service operation creates a new domain service with the specified parameters. If -// the specific service already exists, then any patchable properties will be updated and any immutable properties will -// remain unchanged. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -// domainService - properties supplied to the Create or Update a Domain Service operation. -func (client DomainServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainServiceName string, domainService DomainService) (result DomainServicesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.DomainServicesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainServiceName, domainService) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DomainServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainServiceName string, domainService DomainService) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AAD/domainServices/{domainServiceName}", pathParameters), - autorest.WithJSON(domainService), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DomainServicesClient) CreateOrUpdateSender(req *http.Request) (future DomainServicesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DomainServicesClient) CreateOrUpdateResponder(resp *http.Response) (result DomainService, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete the Delete Domain Service operation deletes an existing Domain Service. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -func (client DomainServicesClient) Delete(ctx context.Context, resourceGroupName string, domainServiceName string) (result DomainServicesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.DomainServicesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, domainServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DomainServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AAD/domainServices/{domainServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DomainServicesClient) DeleteSender(req *http.Request) (future DomainServicesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DomainServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get the Get Domain Service operation retrieves a json representation of the Domain Service. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -func (client DomainServicesClient) Get(ctx context.Context, resourceGroupName string, domainServiceName string) (result DomainService, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.DomainServicesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, domainServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DomainServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, domainServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AAD/domainServices/{domainServiceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DomainServicesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DomainServicesClient) GetResponder(resp *http.Response) (result DomainService, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List the List Domain Services in Subscription operation lists all the domain services available under the given -// subscription (and across all resource groups within that subscription). -func (client DomainServicesClient) List(ctx context.Context) (result DomainServiceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.List") - defer func() { - sc := -1 - if result.dslr.Response.Response != nil { - sc = result.dslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.dslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "List", resp, "Failure sending request") - return - } - - result.dslr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "List", resp, "Failure responding to request") - return - } - if result.dslr.hasNextLink() && result.dslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DomainServicesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AAD/domainServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DomainServicesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DomainServicesClient) ListResponder(resp *http.Response) (result DomainServiceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client DomainServicesClient) listNextResults(ctx context.Context, lastResults DomainServiceListResult) (result DomainServiceListResult, err error) { - req, err := lastResults.domainServiceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainServicesClient) ListComplete(ctx context.Context) (result DomainServiceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup the List Domain Services in Resource Group operation lists all the domain services available -// under the given resource group. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -func (client DomainServicesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DomainServiceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.dslr.Response.Response != nil { - sc = result.dslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.DomainServicesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.dslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.dslr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.dslr.hasNextLink() && result.dslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DomainServicesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AAD/domainServices", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client DomainServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client DomainServicesClient) ListByResourceGroupResponder(resp *http.Response) (result DomainServiceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client DomainServicesClient) listByResourceGroupNextResults(ctx context.Context, lastResults DomainServiceListResult) (result DomainServiceListResult, err error) { - req, err := lastResults.domainServiceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client DomainServicesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DomainServiceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// Update the Update Domain Service operation can be used to update the existing deployment. The update call only -// supports the properties listed in the PATCH body. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -// domainService - properties supplied to the Update a Domain Service operation. -func (client DomainServicesClient) Update(ctx context.Context, resourceGroupName string, domainServiceName string, domainService DomainService) (result DomainServicesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.DomainServicesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, domainServiceName, domainService) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DomainServicesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, domainServiceName string, domainService DomainService) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AAD/domainServices/{domainServiceName}", pathParameters), - autorest.WithJSON(domainService), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DomainServicesClient) UpdateSender(req *http.Request) (future DomainServicesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client DomainServicesClient) UpdateResponder(resp *http.Response) (result DomainService, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/enums.go deleted file mode 100644 index 3c0900cccb8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/enums.go +++ /dev/null @@ -1,157 +0,0 @@ -package aad - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ExternalAccess enumerates the values for external access. -type ExternalAccess string - -const ( - // Disabled ... - Disabled ExternalAccess = "Disabled" - // Enabled ... - Enabled ExternalAccess = "Enabled" -) - -// PossibleExternalAccessValues returns an array of possible values for the ExternalAccess const type. -func PossibleExternalAccessValues() []ExternalAccess { - return []ExternalAccess{Disabled, Enabled} -} - -// FilteredSync enumerates the values for filtered sync. -type FilteredSync string - -const ( - // FilteredSyncDisabled ... - FilteredSyncDisabled FilteredSync = "Disabled" - // FilteredSyncEnabled ... - FilteredSyncEnabled FilteredSync = "Enabled" -) - -// PossibleFilteredSyncValues returns an array of possible values for the FilteredSync const type. -func PossibleFilteredSyncValues() []FilteredSync { - return []FilteredSync{FilteredSyncDisabled, FilteredSyncEnabled} -} - -// Ldaps enumerates the values for ldaps. -type Ldaps string - -const ( - // LdapsDisabled ... - LdapsDisabled Ldaps = "Disabled" - // LdapsEnabled ... - LdapsEnabled Ldaps = "Enabled" -) - -// PossibleLdapsValues returns an array of possible values for the Ldaps const type. -func PossibleLdapsValues() []Ldaps { - return []Ldaps{LdapsDisabled, LdapsEnabled} -} - -// NotifyDcAdmins enumerates the values for notify dc admins. -type NotifyDcAdmins string - -const ( - // NotifyDcAdminsDisabled ... - NotifyDcAdminsDisabled NotifyDcAdmins = "Disabled" - // NotifyDcAdminsEnabled ... - NotifyDcAdminsEnabled NotifyDcAdmins = "Enabled" -) - -// PossibleNotifyDcAdminsValues returns an array of possible values for the NotifyDcAdmins const type. -func PossibleNotifyDcAdminsValues() []NotifyDcAdmins { - return []NotifyDcAdmins{NotifyDcAdminsDisabled, NotifyDcAdminsEnabled} -} - -// NotifyGlobalAdmins enumerates the values for notify global admins. -type NotifyGlobalAdmins string - -const ( - // NotifyGlobalAdminsDisabled ... - NotifyGlobalAdminsDisabled NotifyGlobalAdmins = "Disabled" - // NotifyGlobalAdminsEnabled ... - NotifyGlobalAdminsEnabled NotifyGlobalAdmins = "Enabled" -) - -// PossibleNotifyGlobalAdminsValues returns an array of possible values for the NotifyGlobalAdmins const type. -func PossibleNotifyGlobalAdminsValues() []NotifyGlobalAdmins { - return []NotifyGlobalAdmins{NotifyGlobalAdminsDisabled, NotifyGlobalAdminsEnabled} -} - -// NtlmV1 enumerates the values for ntlm v1. -type NtlmV1 string - -const ( - // NtlmV1Disabled ... - NtlmV1Disabled NtlmV1 = "Disabled" - // NtlmV1Enabled ... - NtlmV1Enabled NtlmV1 = "Enabled" -) - -// PossibleNtlmV1Values returns an array of possible values for the NtlmV1 const type. -func PossibleNtlmV1Values() []NtlmV1 { - return []NtlmV1{NtlmV1Disabled, NtlmV1Enabled} -} - -// SyncKerberosPasswords enumerates the values for sync kerberos passwords. -type SyncKerberosPasswords string - -const ( - // SyncKerberosPasswordsDisabled ... - SyncKerberosPasswordsDisabled SyncKerberosPasswords = "Disabled" - // SyncKerberosPasswordsEnabled ... - SyncKerberosPasswordsEnabled SyncKerberosPasswords = "Enabled" -) - -// PossibleSyncKerberosPasswordsValues returns an array of possible values for the SyncKerberosPasswords const type. -func PossibleSyncKerberosPasswordsValues() []SyncKerberosPasswords { - return []SyncKerberosPasswords{SyncKerberosPasswordsDisabled, SyncKerberosPasswordsEnabled} -} - -// SyncNtlmPasswords enumerates the values for sync ntlm passwords. -type SyncNtlmPasswords string - -const ( - // SyncNtlmPasswordsDisabled ... - SyncNtlmPasswordsDisabled SyncNtlmPasswords = "Disabled" - // SyncNtlmPasswordsEnabled ... - SyncNtlmPasswordsEnabled SyncNtlmPasswords = "Enabled" -) - -// PossibleSyncNtlmPasswordsValues returns an array of possible values for the SyncNtlmPasswords const type. -func PossibleSyncNtlmPasswordsValues() []SyncNtlmPasswords { - return []SyncNtlmPasswords{SyncNtlmPasswordsDisabled, SyncNtlmPasswordsEnabled} -} - -// SyncOnPremPasswords enumerates the values for sync on prem passwords. -type SyncOnPremPasswords string - -const ( - // SyncOnPremPasswordsDisabled ... - SyncOnPremPasswordsDisabled SyncOnPremPasswords = "Disabled" - // SyncOnPremPasswordsEnabled ... - SyncOnPremPasswordsEnabled SyncOnPremPasswords = "Enabled" -) - -// PossibleSyncOnPremPasswordsValues returns an array of possible values for the SyncOnPremPasswords const type. -func PossibleSyncOnPremPasswordsValues() []SyncOnPremPasswords { - return []SyncOnPremPasswords{SyncOnPremPasswordsDisabled, SyncOnPremPasswordsEnabled} -} - -// TLSV1 enumerates the values for tlsv1. -type TLSV1 string - -const ( - // TLSV1Disabled ... - TLSV1Disabled TLSV1 = "Disabled" - // TLSV1Enabled ... - TLSV1Enabled TLSV1 = "Enabled" -) - -// PossibleTLSV1Values returns an array of possible values for the TLSV1 const type. -func PossibleTLSV1Values() []TLSV1 { - return []TLSV1{TLSV1Disabled, TLSV1Enabled} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/models.go deleted file mode 100644 index fe31df5f813..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/models.go +++ /dev/null @@ -1,1334 +0,0 @@ -package aad - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad" - -// CloudError an error response from the Domain Services. -type CloudError struct { - // Error - An error response from the Domain Services. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from the Domain Services. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// ContainerAccount container Account Description -type ContainerAccount struct { - // AccountName - The account name - AccountName *string `json:"accountName,omitempty"` - // Spn - The account spn - Spn *string `json:"spn,omitempty"` - // Password - The account password - Password *string `json:"password,omitempty"` -} - -// DomainSecuritySettings domain Security Settings -type DomainSecuritySettings struct { - // NtlmV1 - A flag to determine whether or not NtlmV1 is enabled or disabled. Possible values include: 'NtlmV1Enabled', 'NtlmV1Disabled' - NtlmV1 NtlmV1 `json:"ntlmV1,omitempty"` - // TLSV1 - A flag to determine whether or not TlsV1 is enabled or disabled. Possible values include: 'TLSV1Enabled', 'TLSV1Disabled' - TLSV1 TLSV1 `json:"tlsV1,omitempty"` - // SyncNtlmPasswords - A flag to determine whether or not SyncNtlmPasswords is enabled or disabled. Possible values include: 'SyncNtlmPasswordsEnabled', 'SyncNtlmPasswordsDisabled' - SyncNtlmPasswords SyncNtlmPasswords `json:"syncNtlmPasswords,omitempty"` - // SyncKerberosPasswords - A flag to determine whether or not SyncKerberosPasswords is enabled or disabled. Possible values include: 'SyncKerberosPasswordsEnabled', 'SyncKerberosPasswordsDisabled' - SyncKerberosPasswords SyncKerberosPasswords `json:"syncKerberosPasswords,omitempty"` - // SyncOnPremPasswords - A flag to determine whether or not SyncOnPremPasswords is enabled or disabled. Possible values include: 'SyncOnPremPasswordsEnabled', 'SyncOnPremPasswordsDisabled' - SyncOnPremPasswords SyncOnPremPasswords `json:"syncOnPremPasswords,omitempty"` -} - -// DomainService domain service. -type DomainService struct { - autorest.Response `json:"-"` - // DomainServiceProperties - Domain service properties - *DomainServiceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Etag - Resource etag - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainService. -func (ds DomainService) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ds.DomainServiceProperties != nil { - objectMap["properties"] = ds.DomainServiceProperties - } - if ds.Location != nil { - objectMap["location"] = ds.Location - } - if ds.Tags != nil { - objectMap["tags"] = ds.Tags - } - if ds.Etag != nil { - objectMap["etag"] = ds.Etag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DomainService struct. -func (ds *DomainService) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var domainServiceProperties DomainServiceProperties - err = json.Unmarshal(*v, &domainServiceProperties) - if err != nil { - return err - } - ds.DomainServiceProperties = &domainServiceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ds.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ds.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ds.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ds.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ds.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ds.Etag = &etag - } - } - } - - return nil -} - -// DomainServiceListResult the response from the List Domain Services operation. -type DomainServiceListResult struct { - autorest.Response `json:"-"` - // Value - the list of domain services. - Value *[]DomainService `json:"value,omitempty"` - // NextLink - READ-ONLY; The continuation token for the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainServiceListResult. -func (dslr DomainServiceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dslr.Value != nil { - objectMap["value"] = dslr.Value - } - return json.Marshal(objectMap) -} - -// DomainServiceListResultIterator provides access to a complete listing of DomainService values. -type DomainServiceListResultIterator struct { - i int - page DomainServiceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DomainServiceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DomainServiceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DomainServiceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DomainServiceListResultIterator) Response() DomainServiceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DomainServiceListResultIterator) Value() DomainService { - if !iter.page.NotDone() { - return DomainService{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DomainServiceListResultIterator type. -func NewDomainServiceListResultIterator(page DomainServiceListResultPage) DomainServiceListResultIterator { - return DomainServiceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dslr DomainServiceListResult) IsEmpty() bool { - return dslr.Value == nil || len(*dslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dslr DomainServiceListResult) hasNextLink() bool { - return dslr.NextLink != nil && len(*dslr.NextLink) != 0 -} - -// domainServiceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dslr DomainServiceListResult) domainServiceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dslr.NextLink))) -} - -// DomainServiceListResultPage contains a page of DomainService values. -type DomainServiceListResultPage struct { - fn func(context.Context, DomainServiceListResult) (DomainServiceListResult, error) - dslr DomainServiceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DomainServiceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dslr) - if err != nil { - return err - } - page.dslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DomainServiceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DomainServiceListResultPage) NotDone() bool { - return !page.dslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DomainServiceListResultPage) Response() DomainServiceListResult { - return page.dslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DomainServiceListResultPage) Values() []DomainService { - if page.dslr.IsEmpty() { - return nil - } - return *page.dslr.Value -} - -// Creates a new instance of the DomainServiceListResultPage type. -func NewDomainServiceListResultPage(cur DomainServiceListResult, getNextPage func(context.Context, DomainServiceListResult) (DomainServiceListResult, error)) DomainServiceListResultPage { - return DomainServiceListResultPage{ - fn: getNextPage, - dslr: cur, - } -} - -// DomainServiceProperties properties of the Domain Service. -type DomainServiceProperties struct { - // Version - READ-ONLY; Data Model Version - Version *int32 `json:"version,omitempty"` - // TenantID - READ-ONLY; Azure Active Directory Tenant Id - TenantID *string `json:"tenantId,omitempty"` - // DomainName - The name of the Azure domain that the user would like to deploy Domain Services to. - DomainName *string `json:"domainName,omitempty"` - // DeploymentID - READ-ONLY; Deployment Id - DeploymentID *string `json:"deploymentId,omitempty"` - // SyncOwner - READ-ONLY; SyncOwner ReplicaSet Id - SyncOwner *string `json:"syncOwner,omitempty"` - // ReplicaSets - List of ReplicaSets - ReplicaSets *[]ReplicaSet `json:"replicaSets,omitempty"` - // LdapsSettings - Secure LDAP Settings - LdapsSettings *LdapsSettings `json:"ldapsSettings,omitempty"` - // ResourceForestSettings - Resource Forest Settings - ResourceForestSettings *ResourceForestSettings `json:"resourceForestSettings,omitempty"` - // DomainSecuritySettings - DomainSecurity Settings - DomainSecuritySettings *DomainSecuritySettings `json:"domainSecuritySettings,omitempty"` - // DomainConfigurationType - Domain Configuration Type - DomainConfigurationType *string `json:"domainConfigurationType,omitempty"` - // Sku - Sku Type - Sku *string `json:"sku,omitempty"` - // FilteredSync - Enabled or Disabled flag to turn on Group-based filtered sync. Possible values include: 'FilteredSyncEnabled', 'FilteredSyncDisabled' - FilteredSync FilteredSync `json:"filteredSync,omitempty"` - // NotificationSettings - Notification Settings - NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` - // ProvisioningState - READ-ONLY; the current deployment or provisioning state, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DomainServiceProperties. -func (dsp DomainServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dsp.DomainName != nil { - objectMap["domainName"] = dsp.DomainName - } - if dsp.ReplicaSets != nil { - objectMap["replicaSets"] = dsp.ReplicaSets - } - if dsp.LdapsSettings != nil { - objectMap["ldapsSettings"] = dsp.LdapsSettings - } - if dsp.ResourceForestSettings != nil { - objectMap["resourceForestSettings"] = dsp.ResourceForestSettings - } - if dsp.DomainSecuritySettings != nil { - objectMap["domainSecuritySettings"] = dsp.DomainSecuritySettings - } - if dsp.DomainConfigurationType != nil { - objectMap["domainConfigurationType"] = dsp.DomainConfigurationType - } - if dsp.Sku != nil { - objectMap["sku"] = dsp.Sku - } - if dsp.FilteredSync != "" { - objectMap["filteredSync"] = dsp.FilteredSync - } - if dsp.NotificationSettings != nil { - objectMap["notificationSettings"] = dsp.NotificationSettings - } - return json.Marshal(objectMap) -} - -// DomainServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DomainServicesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainServicesClient) (DomainService, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DomainServicesCreateOrUpdateFuture.Result. -func (future *DomainServicesCreateOrUpdateFuture) result(client DomainServicesClient) (ds DomainService, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ds.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("aad.DomainServicesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ds.Response.Response, err = future.GetResult(sender); err == nil && ds.Response.Response.StatusCode != http.StatusNoContent { - ds, err = client.CreateOrUpdateResponder(ds.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesCreateOrUpdateFuture", "Result", ds.Response.Response, "Failure responding to request") - } - } - return -} - -// DomainServicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainServicesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainServicesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainServicesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DomainServicesDeleteFuture.Result. -func (future *DomainServicesDeleteFuture) result(client DomainServicesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("aad.DomainServicesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DomainServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DomainServicesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DomainServicesClient) (DomainService, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DomainServicesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DomainServicesUpdateFuture.Result. -func (future *DomainServicesUpdateFuture) result(client DomainServicesClient) (ds DomainService, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ds.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("aad.DomainServicesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ds.Response.Response, err = future.GetResult(sender); err == nil && ds.Response.Response.StatusCode != http.StatusNoContent { - ds, err = client.UpdateResponder(ds.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesUpdateFuture", "Result", ds.Response.Response, "Failure responding to request") - } - } - return -} - -// ForestTrust forest Trust Setting -type ForestTrust struct { - // TrustedDomainFqdn - Trusted Domain FQDN - TrustedDomainFqdn *string `json:"trustedDomainFqdn,omitempty"` - // TrustDirection - Trust Direction - TrustDirection *string `json:"trustDirection,omitempty"` - // FriendlyName - Friendly Name - FriendlyName *string `json:"friendlyName,omitempty"` - // RemoteDNSIps - Remote Dns ips - RemoteDNSIps *string `json:"remoteDnsIps,omitempty"` - // TrustPassword - Trust Password - TrustPassword *string `json:"trustPassword,omitempty"` -} - -// HealthAlert health Alert Description -type HealthAlert struct { - // ID - READ-ONLY; Health Alert Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Health Alert Name - Name *string `json:"name,omitempty"` - // Issue - READ-ONLY; Health Alert Issue - Issue *string `json:"issue,omitempty"` - // Severity - READ-ONLY; Health Alert Severity - Severity *string `json:"severity,omitempty"` - // Raised - READ-ONLY; Health Alert Raised DateTime - Raised *date.Time `json:"raised,omitempty"` - // LastDetected - READ-ONLY; Health Alert Last Detected DateTime - LastDetected *date.Time `json:"lastDetected,omitempty"` - // ResolutionURI - READ-ONLY; Health Alert TSG Link - ResolutionURI *string `json:"resolutionUri,omitempty"` -} - -// MarshalJSON is the custom marshaler for HealthAlert. -func (ha HealthAlert) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// HealthMonitor health Monitor Description -type HealthMonitor struct { - // ID - READ-ONLY; Health Monitor Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Health Monitor Name - Name *string `json:"name,omitempty"` - // Details - READ-ONLY; Health Monitor Details - Details *string `json:"details,omitempty"` -} - -// MarshalJSON is the custom marshaler for HealthMonitor. -func (hm HealthMonitor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// LdapsSettings secure LDAP Settings -type LdapsSettings struct { - // Ldaps - A flag to determine whether or not Secure LDAP is enabled or disabled. Possible values include: 'LdapsEnabled', 'LdapsDisabled' - Ldaps Ldaps `json:"ldaps,omitempty"` - // PfxCertificate - The certificate required to configure Secure LDAP. The parameter passed here should be a base64encoded representation of the certificate pfx file. - PfxCertificate *string `json:"pfxCertificate,omitempty"` - // PfxCertificatePassword - The password to decrypt the provided Secure LDAP certificate pfx file. - PfxCertificatePassword *string `json:"pfxCertificatePassword,omitempty"` - // PublicCertificate - READ-ONLY; Public certificate used to configure secure ldap. - PublicCertificate *string `json:"publicCertificate,omitempty"` - // CertificateThumbprint - READ-ONLY; Thumbprint of configure ldaps certificate. - CertificateThumbprint *string `json:"certificateThumbprint,omitempty"` - // CertificateNotAfter - READ-ONLY; NotAfter DateTime of configure ldaps certificate. - CertificateNotAfter *date.Time `json:"certificateNotAfter,omitempty"` - // ExternalAccess - A flag to determine whether or not Secure LDAP access over the internet is enabled or disabled. Possible values include: 'Enabled', 'Disabled' - ExternalAccess ExternalAccess `json:"externalAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for LdapsSettings. -func (ls LdapsSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ls.Ldaps != "" { - objectMap["ldaps"] = ls.Ldaps - } - if ls.PfxCertificate != nil { - objectMap["pfxCertificate"] = ls.PfxCertificate - } - if ls.PfxCertificatePassword != nil { - objectMap["pfxCertificatePassword"] = ls.PfxCertificatePassword - } - if ls.ExternalAccess != "" { - objectMap["externalAccess"] = ls.ExternalAccess - } - return json.Marshal(objectMap) -} - -// NotificationSettings settings for notification -type NotificationSettings struct { - // NotifyGlobalAdmins - Should global admins be notified. Possible values include: 'NotifyGlobalAdminsEnabled', 'NotifyGlobalAdminsDisabled' - NotifyGlobalAdmins NotifyGlobalAdmins `json:"notifyGlobalAdmins,omitempty"` - // NotifyDcAdmins - Should domain controller admins be notified. Possible values include: 'NotifyDcAdminsEnabled', 'NotifyDcAdminsDisabled' - NotifyDcAdmins NotifyDcAdmins `json:"notifyDcAdmins,omitempty"` - // AdditionalRecipients - The list of additional recipients - AdditionalRecipients *[]string `json:"additionalRecipients,omitempty"` -} - -// OperationDisplayInfo the operation supported by Domain Services. -type OperationDisplayInfo struct { - // Description - The description of the operation. - Description *string `json:"description,omitempty"` - // Operation - The action that users can perform, based on their permission level. - Operation *string `json:"operation,omitempty"` - // Provider - Service provider: Domain Services. - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` -} - -// OperationEntity the operation supported by Domain Services. -type OperationEntity struct { - // Name - Operation name: {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty"` - // Display - The operation supported by Domain Services. - Display *OperationDisplayInfo `json:"display,omitempty"` - // Origin - The origin of the operation. - Origin *string `json:"origin,omitempty"` -} - -// OperationEntityListResult the list of domain service operation response. -type OperationEntityListResult struct { - autorest.Response `json:"-"` - // Value - The list of operations. - Value *[]OperationEntity `json:"value,omitempty"` - // NextLink - READ-ONLY; The continuation token for the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationEntityListResult. -func (oelr OperationEntityListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oelr.Value != nil { - objectMap["value"] = oelr.Value - } - return json.Marshal(objectMap) -} - -// OperationEntityListResultIterator provides access to a complete listing of OperationEntity values. -type OperationEntityListResultIterator struct { - i int - page OperationEntityListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationEntityListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationEntityListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationEntityListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationEntityListResultIterator) Response() OperationEntityListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationEntityListResultIterator) Value() OperationEntity { - if !iter.page.NotDone() { - return OperationEntity{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationEntityListResultIterator type. -func NewOperationEntityListResultIterator(page OperationEntityListResultPage) OperationEntityListResultIterator { - return OperationEntityListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (oelr OperationEntityListResult) IsEmpty() bool { - return oelr.Value == nil || len(*oelr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (oelr OperationEntityListResult) hasNextLink() bool { - return oelr.NextLink != nil && len(*oelr.NextLink) != 0 -} - -// operationEntityListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (oelr OperationEntityListResult) operationEntityListResultPreparer(ctx context.Context) (*http.Request, error) { - if !oelr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(oelr.NextLink))) -} - -// OperationEntityListResultPage contains a page of OperationEntity values. -type OperationEntityListResultPage struct { - fn func(context.Context, OperationEntityListResult) (OperationEntityListResult, error) - oelr OperationEntityListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationEntityListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.oelr) - if err != nil { - return err - } - page.oelr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationEntityListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationEntityListResultPage) NotDone() bool { - return !page.oelr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationEntityListResultPage) Response() OperationEntityListResult { - return page.oelr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationEntityListResultPage) Values() []OperationEntity { - if page.oelr.IsEmpty() { - return nil - } - return *page.oelr.Value -} - -// Creates a new instance of the OperationEntityListResultPage type. -func NewOperationEntityListResultPage(cur OperationEntityListResult, getNextPage func(context.Context, OperationEntityListResult) (OperationEntityListResult, error)) OperationEntityListResultPage { - return OperationEntityListResultPage{ - fn: getNextPage, - oelr: cur, - } -} - -// OuContainer resource for OuContainer. -type OuContainer struct { - autorest.Response `json:"-"` - // OuContainerProperties - OuContainer properties - *OuContainerProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Etag - Resource etag - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for OuContainer. -func (oc OuContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oc.OuContainerProperties != nil { - objectMap["properties"] = oc.OuContainerProperties - } - if oc.Location != nil { - objectMap["location"] = oc.Location - } - if oc.Tags != nil { - objectMap["tags"] = oc.Tags - } - if oc.Etag != nil { - objectMap["etag"] = oc.Etag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OuContainer struct. -func (oc *OuContainer) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var ouContainerProperties OuContainerProperties - err = json.Unmarshal(*v, &ouContainerProperties) - if err != nil { - return err - } - oc.OuContainerProperties = &ouContainerProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - oc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - oc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - oc.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - oc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - oc.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - oc.Etag = &etag - } - } - } - - return nil -} - -// OuContainerCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type OuContainerCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(OuContainerClient) (OuContainer, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *OuContainerCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for OuContainerCreateFuture.Result. -func (future *OuContainerCreateFuture) result(client OuContainerClient) (oc OuContainer, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - oc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("aad.OuContainerCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if oc.Response.Response, err = future.GetResult(sender); err == nil && oc.Response.Response.StatusCode != http.StatusNoContent { - oc, err = client.CreateResponder(oc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerCreateFuture", "Result", oc.Response.Response, "Failure responding to request") - } - } - return -} - -// OuContainerDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type OuContainerDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(OuContainerClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *OuContainerDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for OuContainerDeleteFuture.Result. -func (future *OuContainerDeleteFuture) result(client OuContainerClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("aad.OuContainerDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// OuContainerListResult the response from the List OuContainer operation. -type OuContainerListResult struct { - autorest.Response `json:"-"` - // Value - The list of OuContainer. - Value *[]OuContainer `json:"value,omitempty"` - // NextLink - READ-ONLY; The continuation token for the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OuContainerListResult. -func (oclr OuContainerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oclr.Value != nil { - objectMap["value"] = oclr.Value - } - return json.Marshal(objectMap) -} - -// OuContainerListResultIterator provides access to a complete listing of OuContainer values. -type OuContainerListResultIterator struct { - i int - page OuContainerListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OuContainerListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OuContainerListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OuContainerListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OuContainerListResultIterator) Response() OuContainerListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OuContainerListResultIterator) Value() OuContainer { - if !iter.page.NotDone() { - return OuContainer{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OuContainerListResultIterator type. -func NewOuContainerListResultIterator(page OuContainerListResultPage) OuContainerListResultIterator { - return OuContainerListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (oclr OuContainerListResult) IsEmpty() bool { - return oclr.Value == nil || len(*oclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (oclr OuContainerListResult) hasNextLink() bool { - return oclr.NextLink != nil && len(*oclr.NextLink) != 0 -} - -// ouContainerListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (oclr OuContainerListResult) ouContainerListResultPreparer(ctx context.Context) (*http.Request, error) { - if !oclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(oclr.NextLink))) -} - -// OuContainerListResultPage contains a page of OuContainer values. -type OuContainerListResultPage struct { - fn func(context.Context, OuContainerListResult) (OuContainerListResult, error) - oclr OuContainerListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OuContainerListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.oclr) - if err != nil { - return err - } - page.oclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OuContainerListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OuContainerListResultPage) NotDone() bool { - return !page.oclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OuContainerListResultPage) Response() OuContainerListResult { - return page.oclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OuContainerListResultPage) Values() []OuContainer { - if page.oclr.IsEmpty() { - return nil - } - return *page.oclr.Value -} - -// Creates a new instance of the OuContainerListResultPage type. -func NewOuContainerListResultPage(cur OuContainerListResult, getNextPage func(context.Context, OuContainerListResult) (OuContainerListResult, error)) OuContainerListResultPage { - return OuContainerListResultPage{ - fn: getNextPage, - oclr: cur, - } -} - -// OuContainerProperties properties of the OuContainer. -type OuContainerProperties struct { - // TenantID - READ-ONLY; Azure Active Directory tenant id - TenantID *string `json:"tenantId,omitempty"` - // DomainName - READ-ONLY; The domain name of Domain Services. - DomainName *string `json:"domainName,omitempty"` - // DeploymentID - READ-ONLY; The Deployment id - DeploymentID *string `json:"deploymentId,omitempty"` - // ContainerID - READ-ONLY; The OuContainer name - ContainerID *string `json:"containerId,omitempty"` - // Accounts - The list of container accounts - Accounts *[]ContainerAccount `json:"accounts,omitempty"` - // ServiceStatus - READ-ONLY; Status of OuContainer instance - ServiceStatus *string `json:"serviceStatus,omitempty"` - // DistinguishedName - READ-ONLY; Distinguished Name of OuContainer instance - DistinguishedName *string `json:"distinguishedName,omitempty"` - // ProvisioningState - READ-ONLY; The current deployment or provisioning state, which only appears in the response. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for OuContainerProperties. -func (ocp OuContainerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ocp.Accounts != nil { - objectMap["accounts"] = ocp.Accounts - } - return json.Marshal(objectMap) -} - -// OuContainerUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type OuContainerUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(OuContainerClient) (OuContainer, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *OuContainerUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for OuContainerUpdateFuture.Result. -func (future *OuContainerUpdateFuture) result(client OuContainerClient) (oc OuContainer, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - oc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("aad.OuContainerUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if oc.Response.Response, err = future.GetResult(sender); err == nil && oc.Response.Response.StatusCode != http.StatusNoContent { - oc, err = client.UpdateResponder(oc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerUpdateFuture", "Result", oc.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicaSet replica Set Definition -type ReplicaSet struct { - // ReplicaSetID - READ-ONLY; ReplicaSet Id - ReplicaSetID *string `json:"replicaSetId,omitempty"` - // Location - Virtual network location - Location *string `json:"location,omitempty"` - // VnetSiteID - READ-ONLY; Virtual network site id - VnetSiteID *string `json:"vnetSiteId,omitempty"` - // SubnetID - The name of the virtual network that Domain Services will be deployed on. The id of the subnet that Domain Services will be deployed on. /virtualNetwork/vnetName/subnets/subnetName. - SubnetID *string `json:"subnetId,omitempty"` - // DomainControllerIPAddress - READ-ONLY; List of Domain Controller IP Address - DomainControllerIPAddress *[]string `json:"domainControllerIpAddress,omitempty"` - // ExternalAccessIPAddress - READ-ONLY; External access ip address. - ExternalAccessIPAddress *string `json:"externalAccessIpAddress,omitempty"` - // ServiceStatus - READ-ONLY; Status of Domain Service instance - ServiceStatus *string `json:"serviceStatus,omitempty"` - // HealthLastEvaluated - READ-ONLY; Last domain evaluation run DateTime - HealthLastEvaluated *date.TimeRFC1123 `json:"healthLastEvaluated,omitempty"` - // HealthMonitors - READ-ONLY; List of Domain Health Monitors - HealthMonitors *[]HealthMonitor `json:"healthMonitors,omitempty"` - // HealthAlerts - READ-ONLY; List of Domain Health Alerts - HealthAlerts *[]HealthAlert `json:"healthAlerts,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReplicaSet. -func (rs ReplicaSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rs.Location != nil { - objectMap["location"] = rs.Location - } - if rs.SubnetID != nil { - objectMap["subnetId"] = rs.SubnetID - } - return json.Marshal(objectMap) -} - -// Resource the Resource model definition. -type Resource struct { - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Etag - Resource etag - Etag *string `json:"etag,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - if r.Etag != nil { - objectMap["etag"] = r.Etag - } - return json.Marshal(objectMap) -} - -// ResourceForestSettings settings for Resource Forest -type ResourceForestSettings struct { - // Settings - List of settings for Resource Forest - Settings *[]ForestTrust `json:"settings,omitempty"` - // ResourceForest - Resource Forest - ResourceForest *string `json:"resourceForest,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/oucontainer.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/oucontainer.go deleted file mode 100644 index 9416da9675e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/oucontainer.go +++ /dev/null @@ -1,521 +0,0 @@ -package aad - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OuContainerClient is the the AAD Domain Services API. -type OuContainerClient struct { - BaseClient -} - -// NewOuContainerClient creates an instance of the OuContainerClient client. -func NewOuContainerClient(subscriptionID string) OuContainerClient { - return NewOuContainerClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOuContainerClientWithBaseURI creates an instance of the OuContainerClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOuContainerClientWithBaseURI(baseURI string, subscriptionID string) OuContainerClient { - return OuContainerClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create the Create OuContainer operation creates a new OuContainer under the specified Domain Service instance. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -// ouContainerName - the name of the OuContainer. -// containerAccount - container Account Description. -func (client OuContainerClient) Create(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string, containerAccount ContainerAccount) (result OuContainerCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.OuContainerClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, domainServiceName, ouContainerName, containerAccount) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client OuContainerClient) CreatePreparer(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string, containerAccount ContainerAccount) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "ouContainerName": autorest.Encode("path", ouContainerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Aad/domainServices/{domainServiceName}/ouContainer/{ouContainerName}", pathParameters), - autorest.WithJSON(containerAccount), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client OuContainerClient) CreateSender(req *http.Request) (future OuContainerCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client OuContainerClient) CreateResponder(resp *http.Response) (result OuContainer, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete the Delete OuContainer operation deletes specified OuContainer. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -// ouContainerName - the name of the OuContainer. -func (client OuContainerClient) Delete(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string) (result OuContainerDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.OuContainerClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, domainServiceName, ouContainerName) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client OuContainerClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "ouContainerName": autorest.Encode("path", ouContainerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Aad/domainServices/{domainServiceName}/ouContainer/{ouContainerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client OuContainerClient) DeleteSender(req *http.Request) (future OuContainerDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client OuContainerClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get OuContainer in DomainService instance. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -// ouContainerName - the name of the OuContainer. -func (client OuContainerClient) Get(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string) (result OuContainer, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.OuContainerClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, domainServiceName, ouContainerName) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client OuContainerClient) GetPreparer(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "ouContainerName": autorest.Encode("path", ouContainerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Aad/domainServices/{domainServiceName}/ouContainer/{ouContainerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client OuContainerClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client OuContainerClient) GetResponder(resp *http.Response) (result OuContainer, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List the List of OuContainers in DomainService instance. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -func (client OuContainerClient) List(ctx context.Context, resourceGroupName string, domainServiceName string) (result OuContainerListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerClient.List") - defer func() { - sc := -1 - if result.oclr.Response.Response != nil { - sc = result.oclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.OuContainerClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, domainServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.oclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "List", resp, "Failure sending request") - return - } - - result.oclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "List", resp, "Failure responding to request") - return - } - if result.oclr.hasNextLink() && result.oclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OuContainerClient) ListPreparer(ctx context.Context, resourceGroupName string, domainServiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Aad/domainServices/{domainServiceName}/ouContainer", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OuContainerClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OuContainerClient) ListResponder(resp *http.Response) (result OuContainerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OuContainerClient) listNextResults(ctx context.Context, lastResults OuContainerListResult) (result OuContainerListResult, err error) { - req, err := lastResults.ouContainerListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "aad.OuContainerClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "aad.OuContainerClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OuContainerClient) ListComplete(ctx context.Context, resourceGroupName string, domainServiceName string) (result OuContainerListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, domainServiceName) - return -} - -// Update the Update OuContainer operation can be used to update the existing OuContainers. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// domainServiceName - the name of the domain service. -// ouContainerName - the name of the OuContainer. -// containerAccount - container Account Description. -func (client OuContainerClient) Update(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string, containerAccount ContainerAccount) (result OuContainerUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("aad.OuContainerClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, domainServiceName, ouContainerName, containerAccount) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client OuContainerClient) UpdatePreparer(ctx context.Context, resourceGroupName string, domainServiceName string, ouContainerName string, containerAccount ContainerAccount) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "ouContainerName": autorest.Encode("path", ouContainerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Aad/domainServices/{domainServiceName}/ouContainer/{ouContainerName}", pathParameters), - autorest.WithJSON(containerAccount), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client OuContainerClient) UpdateSender(req *http.Request) (future OuContainerUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client OuContainerClient) UpdateResponder(resp *http.Response) (result OuContainer, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/oucontaineroperations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/oucontaineroperations.go deleted file mode 100644 index 7a362cc3a67..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/oucontaineroperations.go +++ /dev/null @@ -1,141 +0,0 @@ -package aad - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OuContainerOperationsClient is the the AAD Domain Services API. -type OuContainerOperationsClient struct { - BaseClient -} - -// NewOuContainerOperationsClient creates an instance of the OuContainerOperationsClient client. -func NewOuContainerOperationsClient(subscriptionID string) OuContainerOperationsClient { - return NewOuContainerOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOuContainerOperationsClientWithBaseURI creates an instance of the OuContainerOperationsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewOuContainerOperationsClientWithBaseURI(baseURI string, subscriptionID string) OuContainerOperationsClient { - return OuContainerOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all the available OuContainer operations. -func (client OuContainerOperationsClient) List(ctx context.Context) (result OperationEntityListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerOperationsClient.List") - defer func() { - sc := -1 - if result.oelr.Response.Response != nil { - sc = result.oelr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerOperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.oelr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "aad.OuContainerOperationsClient", "List", resp, "Failure sending request") - return - } - - result.oelr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerOperationsClient", "List", resp, "Failure responding to request") - return - } - if result.oelr.hasNextLink() && result.oelr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OuContainerOperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Aad/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OuContainerOperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OuContainerOperationsClient) ListResponder(resp *http.Response) (result OperationEntityListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OuContainerOperationsClient) listNextResults(ctx context.Context, lastResults OperationEntityListResult) (result OperationEntityListResult, err error) { - req, err := lastResults.operationEntityListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "aad.OuContainerOperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "aad.OuContainerOperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.OuContainerOperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OuContainerOperationsClient) ListComplete(ctx context.Context) (result OperationEntityListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OuContainerOperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/version.go deleted file mode 100644 index 69ad8c5ded2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package aad - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " aad/2020-01-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/_meta.json deleted file mode 100644 index 55a49977f57..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "a1eee0489c374782a934ec1f093abd16fa7718ca", - "readme": "/_/azure-rest-api-specs/specification/iotcentral/resource-manager/readme.md", - "tag": "package-2018-09-01", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2018-09-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/iotcentral/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go deleted file mode 100644 index 12d16f95555..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/apps.go +++ /dev/null @@ -1,864 +0,0 @@ -package iotcentral - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AppsClient is the use this API to manage IoT Central Applications in your Azure subscription. -type AppsClient struct { - BaseClient -} - -// NewAppsClient creates an instance of the AppsClient client. -func NewAppsClient(subscriptionID string) AppsClient { - return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAppsClientWithBaseURI creates an instance of the AppsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { - return AppsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability check if an IoT Central application name is available. -// Parameters: -// operationInputs - set the name parameter in the OperationInputs structure to the name of the IoT Central -// application to check. -func (client AppsClient) CheckNameAvailability(ctx context.Context, operationInputs OperationInputs) (result AppAvailabilityInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: operationInputs, - Constraints: []validation.Constraint{{Target: "operationInputs.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("iotcentral.AppsClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, operationInputs) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client AppsClient) CheckNameAvailabilityPreparer(ctx context.Context, operationInputs OperationInputs) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkNameAvailability", pathParameters), - autorest.WithJSON(operationInputs), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client AppsClient) CheckNameAvailabilityResponder(resp *http.Response) (result AppAvailabilityInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CheckSubdomainAvailability check if an IoT Central application subdomain is available. -// Parameters: -// operationInputs - set the name parameter in the OperationInputs structure to the subdomain of the IoT -// Central application to check. -func (client AppsClient) CheckSubdomainAvailability(ctx context.Context, operationInputs OperationInputs) (result AppAvailabilityInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CheckSubdomainAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: operationInputs, - Constraints: []validation.Constraint{{Target: "operationInputs.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("iotcentral.AppsClient", "CheckSubdomainAvailability", err.Error()) - } - - req, err := client.CheckSubdomainAvailabilityPreparer(ctx, operationInputs) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "CheckSubdomainAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckSubdomainAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "CheckSubdomainAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckSubdomainAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "CheckSubdomainAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckSubdomainAvailabilityPreparer prepares the CheckSubdomainAvailability request. -func (client AppsClient) CheckSubdomainAvailabilityPreparer(ctx context.Context, operationInputs OperationInputs) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkSubdomainAvailability", pathParameters), - autorest.WithJSON(operationInputs), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckSubdomainAvailabilitySender sends the CheckSubdomainAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CheckSubdomainAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckSubdomainAvailabilityResponder handles the response to the CheckSubdomainAvailability request. The method always -// closes the http.Response Body. -func (client AppsClient) CheckSubdomainAvailabilityResponder(resp *http.Response) (result AppAvailabilityInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate create or update the metadata of an IoT Central application. The usual pattern to modify a property -// is to retrieve the IoT Central application metadata and security metadata, and then combine them with the modified -// values in a new body to update the IoT Central application. -// Parameters: -// resourceGroupName - the name of the resource group that contains the IoT Central application. -// resourceName - the ARM resource name of the IoT Central application. -// app - the IoT Central application metadata and security metadata. -func (client AppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, app App) (result AppsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: app, - Constraints: []validation.Constraint{{Target: "app.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("iotcentral.AppsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, app) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AppsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, app App) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}", pathParameters), - autorest.WithJSON(app), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateSender(req *http.Request) (future AppsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateResponder(resp *http.Response) (result App, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an IoT Central application. -// Parameters: -// resourceGroupName - the name of the resource group that contains the IoT Central application. -// resourceName - the ARM resource name of the IoT Central application. -func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result AppsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AppsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteSender(req *http.Request) (future AppsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the metadata of an IoT Central application. -// Parameters: -// resourceGroupName - the name of the resource group that contains the IoT Central application. -// resourceName - the ARM resource name of the IoT Central application. -func (client AppsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result App, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AppsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AppsClient) GetResponder(resp *http.Response) (result App, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get all the IoT Central Applications in a resource group. -// Parameters: -// resourceGroupName - the name of the resource group that contains the IoT Central application. -func (client AppsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AppListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.alr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AppsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AppsClient) ListByResourceGroupResponder(resp *http.Response) (result AppListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client AppsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AppListResult) (result AppListResult, err error) { - req, err := lastResults.appListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "iotcentral.AppsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "iotcentral.AppsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AppsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AppListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription get all IoT Central Applications in a subscription. -func (client AppsClient) ListBySubscription(ctx context.Context) (result AppListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListBySubscription") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.alr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AppsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/iotApps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client AppsClient) ListBySubscriptionResponder(resp *http.Response) (result AppListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client AppsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AppListResult) (result AppListResult, err error) { - req, err := lastResults.appListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "iotcentral.AppsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "iotcentral.AppsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AppsClient) ListBySubscriptionComplete(ctx context.Context) (result AppListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// ListTemplates get all available application templates. -func (client AppsClient) ListTemplates(ctx context.Context) (result AppTemplatesResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListTemplates") - defer func() { - sc := -1 - if result.atr.Response.Response != nil { - sc = result.atr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listTemplatesNextResults - req, err := client.ListTemplatesPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "ListTemplates", nil, "Failure preparing request") - return - } - - resp, err := client.ListTemplatesSender(req) - if err != nil { - result.atr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "ListTemplates", resp, "Failure sending request") - return - } - - result.atr, err = client.ListTemplatesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "ListTemplates", resp, "Failure responding to request") - return - } - if result.atr.hasNextLink() && result.atr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListTemplatesPreparer prepares the ListTemplates request. -func (client AppsClient) ListTemplatesPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/appTemplates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListTemplatesSender sends the ListTemplates request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListTemplatesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListTemplatesResponder handles the response to the ListTemplates request. The method always -// closes the http.Response Body. -func (client AppsClient) ListTemplatesResponder(resp *http.Response) (result AppTemplatesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listTemplatesNextResults retrieves the next set of results, if any. -func (client AppsClient) listTemplatesNextResults(ctx context.Context, lastResults AppTemplatesResult) (result AppTemplatesResult, err error) { - req, err := lastResults.appTemplatesResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "iotcentral.AppsClient", "listTemplatesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListTemplatesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "iotcentral.AppsClient", "listTemplatesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListTemplatesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "listTemplatesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListTemplatesComplete enumerates all values, automatically crossing page boundaries as required. -func (client AppsClient) ListTemplatesComplete(ctx context.Context) (result AppTemplatesResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ListTemplates") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListTemplates(ctx) - return -} - -// Update update the metadata of an IoT Central application. -// Parameters: -// resourceGroupName - the name of the resource group that contains the IoT Central application. -// resourceName - the ARM resource name of the IoT Central application. -// appPatch - the IoT Central application metadata and security metadata. -func (client AppsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, appPatch AppPatch) (result AppsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, appPatch) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AppsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, appPatch AppPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}", pathParameters), - autorest.WithJSON(appPatch), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateSender(req *http.Request) (future AppsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateResponder(resp *http.Response) (result App, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/client.go deleted file mode 100644 index bf2ed0fc89f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package iotcentral implements the Azure ARM Iotcentral service API version 2018-09-01. -// -// Use this API to manage IoT Central Applications in your Azure subscription. -package iotcentral - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Iotcentral - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Iotcentral. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/enums.go deleted file mode 100644 index 464297e99d5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/enums.go +++ /dev/null @@ -1,28 +0,0 @@ -package iotcentral - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AppSku enumerates the values for app sku. -type AppSku string - -const ( - // F1 ... - F1 AppSku = "F1" - // S1 ... - S1 AppSku = "S1" - // ST0 ... - ST0 AppSku = "ST0" - // ST1 ... - ST1 AppSku = "ST1" - // ST2 ... - ST2 AppSku = "ST2" -) - -// PossibleAppSkuValues returns an array of possible values for the AppSku const type. -func PossibleAppSkuValues() []AppSku { - return []AppSku{F1, S1, ST0, ST1, ST2} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go deleted file mode 100644 index 6f2b6db0d59..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/models.go +++ /dev/null @@ -1,1043 +0,0 @@ -package iotcentral - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral" - -// App the IoT Central application. -type App struct { - autorest.Response `json:"-"` - // AppProperties - The common properties of an IoT Central application. - *AppProperties `json:"properties,omitempty"` - // Sku - A valid instance SKU. - Sku *AppSkuInfo `json:"sku,omitempty"` - // ID - READ-ONLY; The ARM resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The ARM resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for App. -func (a App) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.AppProperties != nil { - objectMap["properties"] = a.AppProperties - } - if a.Sku != nil { - objectMap["sku"] = a.Sku - } - if a.Location != nil { - objectMap["location"] = a.Location - } - if a.Tags != nil { - objectMap["tags"] = a.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for App struct. -func (a *App) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var appProperties AppProperties - err = json.Unmarshal(*v, &appProperties) - if err != nil { - return err - } - a.AppProperties = &appProperties - } - case "sku": - if v != nil { - var sku AppSkuInfo - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - a.Sku = &sku - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - a.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - a.Tags = tags - } - } - } - - return nil -} - -// AppAvailabilityInfo the properties indicating whether a given IoT Central application name or subdomain -// is available. -type AppAvailabilityInfo struct { - autorest.Response `json:"-"` - // NameAvailable - READ-ONLY; The value which indicates whether the provided name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - READ-ONLY; The reason for unavailability. - Reason *string `json:"reason,omitempty"` - // Message - READ-ONLY; The detailed reason message. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for AppAvailabilityInfo. -func (aai AppAvailabilityInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AppListResult a list of IoT Central Applications with a next link. -type AppListResult struct { - autorest.Response `json:"-"` - // NextLink - The link used to get the next page of IoT Central Applications. - NextLink *string `json:"nextLink,omitempty"` - // Value - A list of IoT Central Applications. - Value *[]App `json:"value,omitempty"` -} - -// AppListResultIterator provides access to a complete listing of App values. -type AppListResultIterator struct { - i int - page AppListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AppListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AppListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AppListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AppListResultIterator) Response() AppListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AppListResultIterator) Value() App { - if !iter.page.NotDone() { - return App{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AppListResultIterator type. -func NewAppListResultIterator(page AppListResultPage) AppListResultIterator { - return AppListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (alr AppListResult) IsEmpty() bool { - return alr.Value == nil || len(*alr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (alr AppListResult) hasNextLink() bool { - return alr.NextLink != nil && len(*alr.NextLink) != 0 -} - -// appListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (alr AppListResult) appListResultPreparer(ctx context.Context) (*http.Request, error) { - if !alr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(alr.NextLink))) -} - -// AppListResultPage contains a page of App values. -type AppListResultPage struct { - fn func(context.Context, AppListResult) (AppListResult, error) - alr AppListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AppListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.alr) - if err != nil { - return err - } - page.alr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AppListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AppListResultPage) NotDone() bool { - return !page.alr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AppListResultPage) Response() AppListResult { - return page.alr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AppListResultPage) Values() []App { - if page.alr.IsEmpty() { - return nil - } - return *page.alr.Value -} - -// Creates a new instance of the AppListResultPage type. -func NewAppListResultPage(cur AppListResult, getNextPage func(context.Context, AppListResult) (AppListResult, error)) AppListResultPage { - return AppListResultPage{ - fn: getNextPage, - alr: cur, - } -} - -// AppPatch the description of the IoT Central application. -type AppPatch struct { - // Tags - Instance tags - Tags map[string]*string `json:"tags"` - // Sku - A valid instance SKU. - Sku *AppSkuInfo `json:"sku,omitempty"` - // AppProperties - The common properties of an IoT Central application. - *AppProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AppPatch. -func (ap AppPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.Tags != nil { - objectMap["tags"] = ap.Tags - } - if ap.Sku != nil { - objectMap["sku"] = ap.Sku - } - if ap.AppProperties != nil { - objectMap["properties"] = ap.AppProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AppPatch struct. -func (ap *AppPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ap.Tags = tags - } - case "sku": - if v != nil { - var sku AppSkuInfo - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - ap.Sku = &sku - } - case "properties": - if v != nil { - var appProperties AppProperties - err = json.Unmarshal(*v, &appProperties) - if err != nil { - return err - } - ap.AppProperties = &appProperties - } - } - } - - return nil -} - -// AppProperties the properties of an IoT Central application. -type AppProperties struct { - // ApplicationID - READ-ONLY; The ID of the application. - ApplicationID *string `json:"applicationId,omitempty"` - // DisplayName - The display name of the application. - DisplayName *string `json:"displayName,omitempty"` - // Subdomain - The subdomain of the application. - Subdomain *string `json:"subdomain,omitempty"` - // Template - The ID of the application template, which is a blueprint that defines the characteristics and behaviors of an application. Optional; if not specified, defaults to a blank blueprint and allows the application to be defined from scratch. - Template *string `json:"template,omitempty"` -} - -// MarshalJSON is the custom marshaler for AppProperties. -func (ap AppProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.DisplayName != nil { - objectMap["displayName"] = ap.DisplayName - } - if ap.Subdomain != nil { - objectMap["subdomain"] = ap.Subdomain - } - if ap.Template != nil { - objectMap["template"] = ap.Template - } - return json.Marshal(objectMap) -} - -// AppsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AppsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AppsClient) (App, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AppsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AppsCreateOrUpdateFuture.Result. -func (future *AppsCreateOrUpdateFuture) result(client AppsClient) (a App, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - a.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("iotcentral.AppsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { - a, err = client.CreateOrUpdateResponder(a.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request") - } - } - return -} - -// AppsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type AppsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AppsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AppsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AppsDeleteFuture.Result. -func (future *AppsDeleteFuture) result(client AppsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("iotcentral.AppsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AppSkuInfo information about the SKU of the IoT Central application. -type AppSkuInfo struct { - // Name - The name of the SKU. Possible values include: 'F1', 'S1', 'ST0', 'ST1', 'ST2' - Name AppSku `json:"name,omitempty"` -} - -// AppsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type AppsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AppsClient) (App, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AppsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AppsUpdateFuture.Result. -func (future *AppsUpdateFuture) result(client AppsClient) (a App, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - a.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("iotcentral.AppsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { - a, err = client.UpdateResponder(a.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.AppsUpdateFuture", "Result", a.Response.Response, "Failure responding to request") - } - } - return -} - -// AppTemplate ioT Central Application Template. -type AppTemplate struct { - // ManifestID - READ-ONLY; The ID of the template. - ManifestID *string `json:"manifestId,omitempty"` - // ManifestVersion - READ-ONLY; The version of the template. - ManifestVersion *string `json:"manifestVersion,omitempty"` - // Name - READ-ONLY; The name of the template. - Name *string `json:"name,omitempty"` - // Title - READ-ONLY; The title of the template. - Title *string `json:"title,omitempty"` - // Order - READ-ONLY; The order of the template in the templates list. - Order *float64 `json:"order,omitempty"` - // Description - READ-ONLY; The description of the template. - Description *string `json:"description,omitempty"` - // Industry - READ-ONLY; The industry of the template. - Industry *string `json:"industry,omitempty"` - // Locations - READ-ONLY; A list of locations that support the template. - Locations *[]AppTemplateLocations `json:"locations,omitempty"` -} - -// MarshalJSON is the custom marshaler for AppTemplate. -func (at AppTemplate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AppTemplateLocations ioT Central Application Template Locations. -type AppTemplateLocations struct { - // ID - READ-ONLY; The ID of the location. - ID *string `json:"id,omitempty"` - // DisplayName - READ-ONLY; The display name of the location. - DisplayName *string `json:"displayName,omitempty"` -} - -// MarshalJSON is the custom marshaler for AppTemplateLocations. -func (atl AppTemplateLocations) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AppTemplatesResult a list of IoT Central Application Templates with a next link. -type AppTemplatesResult struct { - autorest.Response `json:"-"` - // NextLink - The link used to get the next page of IoT Central application templates. - NextLink *string `json:"nextLink,omitempty"` - // Value - READ-ONLY; A list of IoT Central Application Templates. - Value *[]AppTemplate `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for AppTemplatesResult. -func (atr AppTemplatesResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if atr.NextLink != nil { - objectMap["nextLink"] = atr.NextLink - } - return json.Marshal(objectMap) -} - -// AppTemplatesResultIterator provides access to a complete listing of AppTemplate values. -type AppTemplatesResultIterator struct { - i int - page AppTemplatesResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AppTemplatesResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppTemplatesResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AppTemplatesResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AppTemplatesResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AppTemplatesResultIterator) Response() AppTemplatesResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AppTemplatesResultIterator) Value() AppTemplate { - if !iter.page.NotDone() { - return AppTemplate{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AppTemplatesResultIterator type. -func NewAppTemplatesResultIterator(page AppTemplatesResultPage) AppTemplatesResultIterator { - return AppTemplatesResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (atr AppTemplatesResult) IsEmpty() bool { - return atr.Value == nil || len(*atr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (atr AppTemplatesResult) hasNextLink() bool { - return atr.NextLink != nil && len(*atr.NextLink) != 0 -} - -// appTemplatesResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (atr AppTemplatesResult) appTemplatesResultPreparer(ctx context.Context) (*http.Request, error) { - if !atr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(atr.NextLink))) -} - -// AppTemplatesResultPage contains a page of AppTemplate values. -type AppTemplatesResultPage struct { - fn func(context.Context, AppTemplatesResult) (AppTemplatesResult, error) - atr AppTemplatesResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AppTemplatesResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppTemplatesResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.atr) - if err != nil { - return err - } - page.atr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AppTemplatesResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AppTemplatesResultPage) NotDone() bool { - return !page.atr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AppTemplatesResultPage) Response() AppTemplatesResult { - return page.atr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AppTemplatesResultPage) Values() []AppTemplate { - if page.atr.IsEmpty() { - return nil - } - return *page.atr.Value -} - -// Creates a new instance of the AppTemplatesResultPage type. -func NewAppTemplatesResultPage(cur AppTemplatesResult, getNextPage func(context.Context, AppTemplatesResult) (AppTemplatesResult, error)) AppTemplatesResultPage { - return AppTemplatesResultPage{ - fn: getNextPage, - atr: cur, - } -} - -// CloudError error details. -type CloudError struct { - // CloudErrorBody - Error response body. - *CloudErrorBody `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for CloudError. -func (ce CloudError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ce.CloudErrorBody != nil { - objectMap["error"] = ce.CloudErrorBody - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CloudError struct. -func (ce *CloudError) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "error": - if v != nil { - var cloudErrorBody CloudErrorBody - err = json.Unmarshal(*v, &cloudErrorBody) - if err != nil { - return err - } - ce.CloudErrorBody = &cloudErrorBody - } - } - } - - return nil -} - -// CloudErrorBody details of error response. -type CloudErrorBody struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The target of the particular error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// MarshalJSON is the custom marshaler for CloudErrorBody. -func (ceb CloudErrorBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ceb.Details != nil { - objectMap["details"] = ceb.Details - } - return json.Marshal(objectMap) -} - -// Operation ioT Central REST API operation -type Operation struct { - // Name - READ-ONLY; Operation name: {provider}/{resource}/{read | write | action | delete} - Name *string `json:"name,omitempty"` - // Display - The object that represents the operation. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - READ-ONLY; The intended executor of the operation. - Origin *string `json:"origin,omitempty"` - // Properties - READ-ONLY; Additional descriptions for the operation. - Properties interface{} `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if o.Display != nil { - objectMap["display"] = o.Display - } - return json.Marshal(objectMap) -} - -// OperationDisplay the object that represents the operation. -type OperationDisplay struct { - // Provider - READ-ONLY; Service provider: Microsoft IoT Central - Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; Resource Type: IoT Central - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; Name of the operation - Operation *string `json:"operation,omitempty"` - // Description - READ-ONLY; Friendly description for the operation, - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDisplay. -func (od OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationInputs input values. -type OperationInputs struct { - // Name - The name of the IoT Central application instance to check. - Name *string `json:"name,omitempty"` - // Type - The type of the IoT Central resource to query. - Type *string `json:"type,omitempty"` -} - -// OperationListResult a list of IoT Central operations. It contains a list of operations and a URL link to -// get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // NextLink - The link used to get the next page of IoT Central description objects. - NextLink *string `json:"nextLink,omitempty"` - // Value - READ-ONLY; A list of operations supported by the Microsoft.IoTCentral resource provider. - Value *[]Operation `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if olr.NextLink != nil { - objectMap["nextLink"] = olr.NextLink - } - return json.Marshal(objectMap) -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// Resource the common properties of an ARM resource. -type Resource struct { - // ID - READ-ONLY; The ARM resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The ARM resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` - // Location - The resource location. - Location *string `json:"location,omitempty"` - // Tags - The resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/operations.go deleted file mode 100644 index e84fd4b4143..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package iotcentral - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the use this API to manage IoT Central Applications in your Azure subscription. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available IoT Central application REST API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "iotcentral.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2018-09-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.IoTCentral/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "iotcentral.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "iotcentral.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "iotcentral.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/version.go deleted file mode 100644 index 15e196e955a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package iotcentral - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " iotcentral/2018-09-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/_meta.json deleted file mode 100644 index 396dfe38552..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "a95079cdd7a60c5af0417360b1ee56c8ae845cc4", - "readme": "/_/azure-rest-api-specs/specification/azure-kusto/resource-manager/readme.md", - "tag": "package-2021-08-27", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-08-27 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/azure-kusto/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/client.go deleted file mode 100644 index 01afe576299..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/client.go +++ /dev/null @@ -1,42 +0,0 @@ -// Package kusto implements the Azure ARM Kusto service API version 2021-08-27. -// -// The Azure Kusto management API provides a RESTful set of web services that interact with Azure Kusto services to -// manage your clusters and databases. The API enables you to create, update, and delete clusters and databases. -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Kusto - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Kusto. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/clusters.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/clusters.go deleted file mode 100644 index bfc46d3fbfa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/clusters.go +++ /dev/null @@ -1,1525 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ClustersClient is the the Azure Kusto management API provides a RESTful set of web services that interact with Azure -// Kusto services to manage your clusters and databases. The API enables you to create, update, and delete clusters and -// databases. -type ClustersClient struct { - BaseClient -} - -// NewClustersClient creates an instance of the ClustersClient client. -func NewClustersClient(subscriptionID string) ClustersClient { - return NewClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClustersClientWithBaseURI creates an instance of the ClustersClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { - return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// AddLanguageExtensions add a list of language extensions that can run within KQL queries. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// languageExtensionsToAdd - the language extensions to add. -func (client ClustersClient) AddLanguageExtensions(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToAdd LanguageExtensionsList) (result ClustersAddLanguageExtensionsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.AddLanguageExtensions") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.AddLanguageExtensionsPreparer(ctx, resourceGroupName, clusterName, languageExtensionsToAdd) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "AddLanguageExtensions", nil, "Failure preparing request") - return - } - - result, err = client.AddLanguageExtensionsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "AddLanguageExtensions", result.Response(), "Failure sending request") - return - } - - return -} - -// AddLanguageExtensionsPreparer prepares the AddLanguageExtensions request. -func (client ClustersClient) AddLanguageExtensionsPreparer(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToAdd LanguageExtensionsList) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/addLanguageExtensions", pathParameters), - autorest.WithJSON(languageExtensionsToAdd), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AddLanguageExtensionsSender sends the AddLanguageExtensions request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) AddLanguageExtensionsSender(req *http.Request) (future ClustersAddLanguageExtensionsFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// AddLanguageExtensionsResponder handles the response to the AddLanguageExtensions request. The method always -// closes the http.Response Body. -func (client ClustersClient) AddLanguageExtensionsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CheckNameAvailability checks that the cluster name is valid and is not already in use. -// Parameters: -// location - azure location (region) name. -// clusterName - the name of the cluster. -func (client ClustersClient) CheckNameAvailability(ctx context.Context, location string, clusterName ClusterCheckNameRequest) (result CheckNameResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "clusterName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("kusto.ClustersClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, location, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ClustersClient) CheckNameAvailabilityPreparer(ctx context.Context, location string, clusterName ClusterCheckNameRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/checkNameAvailability", pathParameters), - autorest.WithJSON(clusterName), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client ClustersClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate create or update a Kusto cluster. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// parameters - the Kusto cluster parameters supplied to the CreateOrUpdate operation. -// ifMatch - the ETag of the cluster. Omit this value to always overwrite the current cluster. Specify the -// last-seen ETag value to prevent accidentally overwriting concurrent changes. -// ifNoneMatch - set to '*' to allow a new cluster to be created, but to prevent updating an existing cluster. -// Other values will result in a 412 Pre-condition Failed response. -func (client ClustersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, ifMatch string, ifNoneMatch string) (result ClustersCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.OptimizedAutoscale", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.OptimizedAutoscale.Version", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.OptimizedAutoscale.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.OptimizedAutoscale.Minimum", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.OptimizedAutoscale.Maximum", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.ClusterProperties.VirtualNetworkConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.VirtualNetworkConfiguration.SubnetID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.VirtualNetworkConfiguration.EnginePublicIPID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.VirtualNetworkConfiguration.DataManagementPublicIPID", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("kusto.ClustersClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, parameters, ifMatch, ifNoneMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, ifMatch string, ifNoneMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - parameters.Etag = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - if len(ifNoneMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) CreateOrUpdateSender(req *http.Request) (future ClustersCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ClustersClient) CreateOrUpdateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a Kusto cluster. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client ClustersClient) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result ClustersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) DeleteSender(req *http.Request) (future ClustersDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DetachFollowerDatabases detaches all followers of a database owned by this cluster. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// followerDatabaseToRemove - the follower databases properties to remove. -func (client ClustersClient) DetachFollowerDatabases(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove FollowerDatabaseDefinition) (result ClustersDetachFollowerDatabasesFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.DetachFollowerDatabases") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: followerDatabaseToRemove, - Constraints: []validation.Constraint{{Target: "followerDatabaseToRemove.ClusterResourceID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "followerDatabaseToRemove.AttachedDatabaseConfigurationName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("kusto.ClustersClient", "DetachFollowerDatabases", err.Error()) - } - - req, err := client.DetachFollowerDatabasesPreparer(ctx, resourceGroupName, clusterName, followerDatabaseToRemove) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DetachFollowerDatabases", nil, "Failure preparing request") - return - } - - result, err = client.DetachFollowerDatabasesSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DetachFollowerDatabases", result.Response(), "Failure sending request") - return - } - - return -} - -// DetachFollowerDatabasesPreparer prepares the DetachFollowerDatabases request. -func (client ClustersClient) DetachFollowerDatabasesPreparer(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove FollowerDatabaseDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - followerDatabaseToRemove.DatabaseName = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/detachFollowerDatabases", pathParameters), - autorest.WithJSON(followerDatabaseToRemove), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DetachFollowerDatabasesSender sends the DetachFollowerDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) DetachFollowerDatabasesSender(req *http.Request) (future ClustersDetachFollowerDatabasesFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DetachFollowerDatabasesResponder handles the response to the DetachFollowerDatabases request. The method always -// closes the http.Response Body. -func (client ClustersClient) DetachFollowerDatabasesResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// DiagnoseVirtualNetwork diagnoses network connectivity status for external resources on which the service is -// dependent on. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client ClustersClient) DiagnoseVirtualNetwork(ctx context.Context, resourceGroupName string, clusterName string) (result ClustersDiagnoseVirtualNetworkFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.DiagnoseVirtualNetwork") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DiagnoseVirtualNetworkPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DiagnoseVirtualNetwork", nil, "Failure preparing request") - return - } - - result, err = client.DiagnoseVirtualNetworkSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DiagnoseVirtualNetwork", result.Response(), "Failure sending request") - return - } - - return -} - -// DiagnoseVirtualNetworkPreparer prepares the DiagnoseVirtualNetwork request. -func (client ClustersClient) DiagnoseVirtualNetworkPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/diagnoseVirtualNetwork", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DiagnoseVirtualNetworkSender sends the DiagnoseVirtualNetwork request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) DiagnoseVirtualNetworkSender(req *http.Request) (future ClustersDiagnoseVirtualNetworkFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DiagnoseVirtualNetworkResponder handles the response to the DiagnoseVirtualNetwork request. The method always -// closes the http.Response Body. -func (client ClustersClient) DiagnoseVirtualNetworkResponder(resp *http.Response) (result DiagnoseVirtualNetworkResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets a Kusto cluster. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string) (result Cluster, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ClustersClient) GetResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all Kusto clusters within a subscription. -func (client ClustersClient) List(ctx context.Context) (result ClusterListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/clusters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListResponder(resp *http.Response) (result ClusterListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists all Kusto clusters within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -func (client ClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ClusterListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ClustersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListFollowerDatabases returns a list of databases that are owned by this cluster and were followed by another -// cluster. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client ClustersClient) ListFollowerDatabases(ctx context.Context, resourceGroupName string, clusterName string) (result FollowerDatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListFollowerDatabases") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListFollowerDatabasesPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListFollowerDatabases", nil, "Failure preparing request") - return - } - - resp, err := client.ListFollowerDatabasesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListFollowerDatabases", resp, "Failure sending request") - return - } - - result, err = client.ListFollowerDatabasesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListFollowerDatabases", resp, "Failure responding to request") - return - } - - return -} - -// ListFollowerDatabasesPreparer prepares the ListFollowerDatabases request. -func (client ClustersClient) ListFollowerDatabasesPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listFollowerDatabases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListFollowerDatabasesSender sends the ListFollowerDatabases request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListFollowerDatabasesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListFollowerDatabasesResponder handles the response to the ListFollowerDatabases request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListFollowerDatabasesResponder(resp *http.Response) (result FollowerDatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListLanguageExtensions returns a list of language extensions that can run within KQL queries. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client ClustersClient) ListLanguageExtensions(ctx context.Context, resourceGroupName string, clusterName string) (result LanguageExtensionsList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListLanguageExtensions") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListLanguageExtensionsPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListLanguageExtensions", nil, "Failure preparing request") - return - } - - resp, err := client.ListLanguageExtensionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListLanguageExtensions", resp, "Failure sending request") - return - } - - result, err = client.ListLanguageExtensionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListLanguageExtensions", resp, "Failure responding to request") - return - } - - return -} - -// ListLanguageExtensionsPreparer prepares the ListLanguageExtensions request. -func (client ClustersClient) ListLanguageExtensionsPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listLanguageExtensions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListLanguageExtensionsSender sends the ListLanguageExtensions request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListLanguageExtensionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListLanguageExtensionsResponder handles the response to the ListLanguageExtensions request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListLanguageExtensionsResponder(resp *http.Response) (result LanguageExtensionsList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListOutboundNetworkDependenciesEndpoints gets the network endpoints of all outbound dependencies of a Kusto cluster -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client ClustersClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, clusterName string) (result OutboundNetworkDependenciesEndpointListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListOutboundNetworkDependenciesEndpoints") - defer func() { - sc := -1 - if result.ondelr.Response.Response != nil { - sc = result.ondelr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listOutboundNetworkDependenciesEndpointsNextResults - req, err := client.ListOutboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") - return - } - - resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) - if err != nil { - result.ondelr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure sending request") - return - } - - result.ondelr, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure responding to request") - return - } - if result.ondelr.hasNextLink() && result.ondelr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListOutboundNetworkDependenciesEndpointsPreparer prepares the ListOutboundNetworkDependenciesEndpoints request. -func (client ClustersClient) ListOutboundNetworkDependenciesEndpointsPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/outboundNetworkDependenciesEndpoints", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListOutboundNetworkDependenciesEndpointsSender sends the ListOutboundNetworkDependenciesEndpoints request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListOutboundNetworkDependenciesEndpointsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListOutboundNetworkDependenciesEndpointsResponder handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListOutboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result OutboundNetworkDependenciesEndpointListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listOutboundNetworkDependenciesEndpointsNextResults retrieves the next set of results, if any. -func (client ClustersClient) listOutboundNetworkDependenciesEndpointsNextResults(ctx context.Context, lastResults OutboundNetworkDependenciesEndpointListResult) (result OutboundNetworkDependenciesEndpointListResult, err error) { - req, err := lastResults.outboundNetworkDependenciesEndpointListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "kusto.ClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "kusto.ClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListOutboundNetworkDependenciesEndpointsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ClustersClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, resourceGroupName string, clusterName string) (result OutboundNetworkDependenciesEndpointListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListOutboundNetworkDependenciesEndpoints") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListOutboundNetworkDependenciesEndpoints(ctx, resourceGroupName, clusterName) - return -} - -// ListSkus lists eligible SKUs for Kusto resource provider. -func (client ClustersClient) ListSkus(ctx context.Context) (result SkuDescriptionList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListSkus") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSkusPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkus", resp, "Failure sending request") - return - } - - result, err = client.ListSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkus", resp, "Failure responding to request") - return - } - - return -} - -// ListSkusPreparer prepares the ListSkus request. -func (client ClustersClient) ListSkusPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSkusSender sends the ListSkus request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListSkusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSkusResponder handles the response to the ListSkus request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListSkusResponder(resp *http.Response) (result SkuDescriptionList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSkusByResource returns the SKUs available for the provided resource. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client ClustersClient) ListSkusByResource(ctx context.Context, resourceGroupName string, clusterName string) (result ListResourceSkusResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListSkusByResource") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSkusByResourcePreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkusByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListSkusByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkusByResource", resp, "Failure sending request") - return - } - - result, err = client.ListSkusByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkusByResource", resp, "Failure responding to request") - return - } - - return -} - -// ListSkusByResourcePreparer prepares the ListSkusByResource request. -func (client ClustersClient) ListSkusByResourcePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSkusByResourceSender sends the ListSkusByResource request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListSkusByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSkusByResourceResponder handles the response to the ListSkusByResource request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListSkusByResourceResponder(resp *http.Response) (result ListResourceSkusResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RemoveLanguageExtensions remove a list of language extensions that can run within KQL queries. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// languageExtensionsToRemove - the language extensions to remove. -func (client ClustersClient) RemoveLanguageExtensions(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToRemove LanguageExtensionsList) (result ClustersRemoveLanguageExtensionsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.RemoveLanguageExtensions") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RemoveLanguageExtensionsPreparer(ctx, resourceGroupName, clusterName, languageExtensionsToRemove) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "RemoveLanguageExtensions", nil, "Failure preparing request") - return - } - - result, err = client.RemoveLanguageExtensionsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "RemoveLanguageExtensions", result.Response(), "Failure sending request") - return - } - - return -} - -// RemoveLanguageExtensionsPreparer prepares the RemoveLanguageExtensions request. -func (client ClustersClient) RemoveLanguageExtensionsPreparer(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToRemove LanguageExtensionsList) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/removeLanguageExtensions", pathParameters), - autorest.WithJSON(languageExtensionsToRemove), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RemoveLanguageExtensionsSender sends the RemoveLanguageExtensions request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) RemoveLanguageExtensionsSender(req *http.Request) (future ClustersRemoveLanguageExtensionsFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RemoveLanguageExtensionsResponder handles the response to the RemoveLanguageExtensions request. The method always -// closes the http.Response Body. -func (client ClustersClient) RemoveLanguageExtensionsResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Start starts a Kusto cluster. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client ClustersClient) Start(ctx context.Context, resourceGroupName string, clusterName string) (result ClustersStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Start") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.StartPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client ClustersClient) StartPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) StartSender(req *http.Request) (future ClustersStartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client ClustersClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stops a Kusto cluster. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client ClustersClient) Stop(ctx context.Context, resourceGroupName string, clusterName string) (result ClustersStopFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Stop") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.StopPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = client.StopSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Stop", result.Response(), "Failure sending request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client ClustersClient) StopPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) StopSender(req *http.Request) (future ClustersStopFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client ClustersClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update update a Kusto cluster. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// parameters - the Kusto cluster parameters supplied to the Update operation. -// ifMatch - the ETag of the cluster. Omit this value to always overwrite the current cluster. Specify the -// last-seen ETag value to prevent accidentally overwriting concurrent changes. -func (client ClustersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, ifMatch string) (result ClustersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, ifMatch string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) UpdateSender(req *http.Request) (future ClustersUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/databases.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/databases.go deleted file mode 100644 index 31f3dbe0bc5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/databases.go +++ /dev/null @@ -1,761 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DatabasesClient is the the Azure Kusto management API provides a RESTful set of web services that interact with -// Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and delete -// clusters and databases. -type DatabasesClient struct { - BaseClient -} - -// NewDatabasesClient creates an instance of the DatabasesClient client. -func NewDatabasesClient(subscriptionID string) DatabasesClient { - return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { - return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// AddPrincipals add Database principals permissions. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// databaseName - the name of the database in the Kusto cluster. -// databasePrincipalsToAdd - list of database principals to add. -func (client DatabasesClient) AddPrincipals(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToAdd DatabasePrincipalListRequest) (result DatabasePrincipalListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.AddPrincipals") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.AddPrincipalsPreparer(ctx, resourceGroupName, clusterName, databaseName, databasePrincipalsToAdd) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "AddPrincipals", nil, "Failure preparing request") - return - } - - resp, err := client.AddPrincipalsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "AddPrincipals", resp, "Failure sending request") - return - } - - result, err = client.AddPrincipalsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "AddPrincipals", resp, "Failure responding to request") - return - } - - return -} - -// AddPrincipalsPreparer prepares the AddPrincipals request. -func (client DatabasesClient) AddPrincipalsPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToAdd DatabasePrincipalListRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/addPrincipals", pathParameters), - autorest.WithJSON(databasePrincipalsToAdd), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AddPrincipalsSender sends the AddPrincipals request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) AddPrincipalsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// AddPrincipalsResponder handles the response to the AddPrincipals request. The method always -// closes the http.Response Body. -func (client DatabasesClient) AddPrincipalsResponder(resp *http.Response) (result DatabasePrincipalListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CheckNameAvailability checks that the databases resource name is valid and is not already in use. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// resourceName - the name of the resource. -func (client DatabasesClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, resourceName CheckNameRequest) (result CheckNameResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("kusto.DatabasesClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, clusterName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client DatabasesClient) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, clusterName string, resourceName CheckNameRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkNameAvailability", pathParameters), - autorest.WithJSON(resourceName), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client DatabasesClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a database. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// databaseName - the name of the database in the Kusto cluster. -// parameters - the database parameters supplied to the CreateOrUpdate operation. -func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (result DatabasesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) CreateOrUpdateSender(req *http.Request) (future DatabasesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the database with the given name. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// databaseName - the name of the database in the Kusto cluster. -func (client DatabasesClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result DatabasesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) DeleteSender(req *http.Request) (future DatabasesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns a database. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// databaseName - the name of the database in the Kusto cluster. -func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result DatabaseModel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DatabasesClient) GetResponder(resp *http.Response) (result DatabaseModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByCluster returns the list of databases of the given Kusto cluster. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client DatabasesClient) ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result DatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByCluster") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByClusterPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListByCluster", nil, "Failure preparing request") - return - } - - resp, err := client.ListByClusterSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListByCluster", resp, "Failure sending request") - return - } - - result, err = client.ListByClusterResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListByCluster", resp, "Failure responding to request") - return - } - - return -} - -// ListByClusterPreparer prepares the ListByCluster request. -func (client DatabasesClient) ListByClusterPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByClusterSender sends the ListByCluster request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListByClusterSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByClusterResponder handles the response to the ListByCluster request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListByClusterResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPrincipals returns a list of database principals of the given Kusto cluster and database. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// databaseName - the name of the database in the Kusto cluster. -func (client DatabasesClient) ListPrincipals(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result DatabasePrincipalListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListPrincipals") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPrincipalsPreparer(ctx, resourceGroupName, clusterName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListPrincipals", nil, "Failure preparing request") - return - } - - resp, err := client.ListPrincipalsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListPrincipals", resp, "Failure sending request") - return - } - - result, err = client.ListPrincipalsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListPrincipals", resp, "Failure responding to request") - return - } - - return -} - -// ListPrincipalsPreparer prepares the ListPrincipals request. -func (client DatabasesClient) ListPrincipalsPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/listPrincipals", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListPrincipalsSender sends the ListPrincipals request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListPrincipalsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListPrincipalsResponder handles the response to the ListPrincipals request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListPrincipalsResponder(resp *http.Response) (result DatabasePrincipalListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RemovePrincipals remove Database principals permissions. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// databaseName - the name of the database in the Kusto cluster. -// databasePrincipalsToRemove - list of database principals to remove. -func (client DatabasesClient) RemovePrincipals(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToRemove DatabasePrincipalListRequest) (result DatabasePrincipalListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.RemovePrincipals") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RemovePrincipalsPreparer(ctx, resourceGroupName, clusterName, databaseName, databasePrincipalsToRemove) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "RemovePrincipals", nil, "Failure preparing request") - return - } - - resp, err := client.RemovePrincipalsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "RemovePrincipals", resp, "Failure sending request") - return - } - - result, err = client.RemovePrincipalsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "RemovePrincipals", resp, "Failure responding to request") - return - } - - return -} - -// RemovePrincipalsPreparer prepares the RemovePrincipals request. -func (client DatabasesClient) RemovePrincipalsPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToRemove DatabasePrincipalListRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/removePrincipals", pathParameters), - autorest.WithJSON(databasePrincipalsToRemove), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RemovePrincipalsSender sends the RemovePrincipals request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) RemovePrincipalsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RemovePrincipalsResponder handles the response to the RemovePrincipals request. The method always -// closes the http.Response Body. -func (client DatabasesClient) RemovePrincipalsResponder(resp *http.Response) (result DatabasePrincipalListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a database. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// databaseName - the name of the database in the Kusto cluster. -// parameters - the database parameters supplied to the Update operation. -func (client DatabasesClient) Update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (result DatabasesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) UpdateSender(req *http.Request) (future DatabasesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client DatabasesClient) UpdateResponder(resp *http.Response) (result DatabaseModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/enums.go deleted file mode 100644 index 9c32a1042bf..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/enums.go +++ /dev/null @@ -1,600 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AzureScaleType enumerates the values for azure scale type. -type AzureScaleType string - -const ( - // AzureScaleTypeAutomatic ... - AzureScaleTypeAutomatic AzureScaleType = "automatic" - // AzureScaleTypeManual ... - AzureScaleTypeManual AzureScaleType = "manual" - // AzureScaleTypeNone ... - AzureScaleTypeNone AzureScaleType = "none" -) - -// PossibleAzureScaleTypeValues returns an array of possible values for the AzureScaleType const type. -func PossibleAzureScaleTypeValues() []AzureScaleType { - return []AzureScaleType{AzureScaleTypeAutomatic, AzureScaleTypeManual, AzureScaleTypeNone} -} - -// AzureSkuName enumerates the values for azure sku name. -type AzureSkuName string - -const ( - // AzureSkuNameDevNoSLAStandardD11V2 ... - AzureSkuNameDevNoSLAStandardD11V2 AzureSkuName = "Dev(No SLA)_Standard_D11_v2" - // AzureSkuNameDevNoSLAStandardE2aV4 ... - AzureSkuNameDevNoSLAStandardE2aV4 AzureSkuName = "Dev(No SLA)_Standard_E2a_v4" - // AzureSkuNameStandardD11V2 ... - AzureSkuNameStandardD11V2 AzureSkuName = "Standard_D11_v2" - // AzureSkuNameStandardD12V2 ... - AzureSkuNameStandardD12V2 AzureSkuName = "Standard_D12_v2" - // AzureSkuNameStandardD13V2 ... - AzureSkuNameStandardD13V2 AzureSkuName = "Standard_D13_v2" - // AzureSkuNameStandardD14V2 ... - AzureSkuNameStandardD14V2 AzureSkuName = "Standard_D14_v2" - // AzureSkuNameStandardDS13V21TBPS ... - AzureSkuNameStandardDS13V21TBPS AzureSkuName = "Standard_DS13_v2+1TB_PS" - // AzureSkuNameStandardDS13V22TBPS ... - AzureSkuNameStandardDS13V22TBPS AzureSkuName = "Standard_DS13_v2+2TB_PS" - // AzureSkuNameStandardDS14V23TBPS ... - AzureSkuNameStandardDS14V23TBPS AzureSkuName = "Standard_DS14_v2+3TB_PS" - // AzureSkuNameStandardDS14V24TBPS ... - AzureSkuNameStandardDS14V24TBPS AzureSkuName = "Standard_DS14_v2+4TB_PS" - // AzureSkuNameStandardE16asV43TBPS ... - AzureSkuNameStandardE16asV43TBPS AzureSkuName = "Standard_E16as_v4+3TB_PS" - // AzureSkuNameStandardE16asV44TBPS ... - AzureSkuNameStandardE16asV44TBPS AzureSkuName = "Standard_E16as_v4+4TB_PS" - // AzureSkuNameStandardE16aV4 ... - AzureSkuNameStandardE16aV4 AzureSkuName = "Standard_E16a_v4" - // AzureSkuNameStandardE2aV4 ... - AzureSkuNameStandardE2aV4 AzureSkuName = "Standard_E2a_v4" - // AzureSkuNameStandardE4aV4 ... - AzureSkuNameStandardE4aV4 AzureSkuName = "Standard_E4a_v4" - // AzureSkuNameStandardE64iV3 ... - AzureSkuNameStandardE64iV3 AzureSkuName = "Standard_E64i_v3" - // AzureSkuNameStandardE80idsV4 ... - AzureSkuNameStandardE80idsV4 AzureSkuName = "Standard_E80ids_v4" - // AzureSkuNameStandardE8asV41TBPS ... - AzureSkuNameStandardE8asV41TBPS AzureSkuName = "Standard_E8as_v4+1TB_PS" - // AzureSkuNameStandardE8asV42TBPS ... - AzureSkuNameStandardE8asV42TBPS AzureSkuName = "Standard_E8as_v4+2TB_PS" - // AzureSkuNameStandardE8aV4 ... - AzureSkuNameStandardE8aV4 AzureSkuName = "Standard_E8a_v4" - // AzureSkuNameStandardL16s ... - AzureSkuNameStandardL16s AzureSkuName = "Standard_L16s" - // AzureSkuNameStandardL16sV2 ... - AzureSkuNameStandardL16sV2 AzureSkuName = "Standard_L16s_v2" - // AzureSkuNameStandardL4s ... - AzureSkuNameStandardL4s AzureSkuName = "Standard_L4s" - // AzureSkuNameStandardL8s ... - AzureSkuNameStandardL8s AzureSkuName = "Standard_L8s" - // AzureSkuNameStandardL8sV2 ... - AzureSkuNameStandardL8sV2 AzureSkuName = "Standard_L8s_v2" -) - -// PossibleAzureSkuNameValues returns an array of possible values for the AzureSkuName const type. -func PossibleAzureSkuNameValues() []AzureSkuName { - return []AzureSkuName{AzureSkuNameDevNoSLAStandardD11V2, AzureSkuNameDevNoSLAStandardE2aV4, AzureSkuNameStandardD11V2, AzureSkuNameStandardD12V2, AzureSkuNameStandardD13V2, AzureSkuNameStandardD14V2, AzureSkuNameStandardDS13V21TBPS, AzureSkuNameStandardDS13V22TBPS, AzureSkuNameStandardDS14V23TBPS, AzureSkuNameStandardDS14V24TBPS, AzureSkuNameStandardE16asV43TBPS, AzureSkuNameStandardE16asV44TBPS, AzureSkuNameStandardE16aV4, AzureSkuNameStandardE2aV4, AzureSkuNameStandardE4aV4, AzureSkuNameStandardE64iV3, AzureSkuNameStandardE80idsV4, AzureSkuNameStandardE8asV41TBPS, AzureSkuNameStandardE8asV42TBPS, AzureSkuNameStandardE8aV4, AzureSkuNameStandardL16s, AzureSkuNameStandardL16sV2, AzureSkuNameStandardL4s, AzureSkuNameStandardL8s, AzureSkuNameStandardL8sV2} -} - -// AzureSkuTier enumerates the values for azure sku tier. -type AzureSkuTier string - -const ( - // AzureSkuTierBasic ... - AzureSkuTierBasic AzureSkuTier = "Basic" - // AzureSkuTierStandard ... - AzureSkuTierStandard AzureSkuTier = "Standard" -) - -// PossibleAzureSkuTierValues returns an array of possible values for the AzureSkuTier const type. -func PossibleAzureSkuTierValues() []AzureSkuTier { - return []AzureSkuTier{AzureSkuTierBasic, AzureSkuTierStandard} -} - -// BlobStorageEventType enumerates the values for blob storage event type. -type BlobStorageEventType string - -const ( - // BlobStorageEventTypeMicrosoftStorageBlobCreated ... - BlobStorageEventTypeMicrosoftStorageBlobCreated BlobStorageEventType = "Microsoft.Storage.BlobCreated" - // BlobStorageEventTypeMicrosoftStorageBlobRenamed ... - BlobStorageEventTypeMicrosoftStorageBlobRenamed BlobStorageEventType = "Microsoft.Storage.BlobRenamed" -) - -// PossibleBlobStorageEventTypeValues returns an array of possible values for the BlobStorageEventType const type. -func PossibleBlobStorageEventTypeValues() []BlobStorageEventType { - return []BlobStorageEventType{BlobStorageEventTypeMicrosoftStorageBlobCreated, BlobStorageEventTypeMicrosoftStorageBlobRenamed} -} - -// ClusterNetworkAccessFlag enumerates the values for cluster network access flag. -type ClusterNetworkAccessFlag string - -const ( - // ClusterNetworkAccessFlagDisabled ... - ClusterNetworkAccessFlagDisabled ClusterNetworkAccessFlag = "Disabled" - // ClusterNetworkAccessFlagEnabled ... - ClusterNetworkAccessFlagEnabled ClusterNetworkAccessFlag = "Enabled" -) - -// PossibleClusterNetworkAccessFlagValues returns an array of possible values for the ClusterNetworkAccessFlag const type. -func PossibleClusterNetworkAccessFlagValues() []ClusterNetworkAccessFlag { - return []ClusterNetworkAccessFlag{ClusterNetworkAccessFlagDisabled, ClusterNetworkAccessFlagEnabled} -} - -// ClusterPrincipalRole enumerates the values for cluster principal role. -type ClusterPrincipalRole string - -const ( - // ClusterPrincipalRoleAllDatabasesAdmin ... - ClusterPrincipalRoleAllDatabasesAdmin ClusterPrincipalRole = "AllDatabasesAdmin" - // ClusterPrincipalRoleAllDatabasesViewer ... - ClusterPrincipalRoleAllDatabasesViewer ClusterPrincipalRole = "AllDatabasesViewer" -) - -// PossibleClusterPrincipalRoleValues returns an array of possible values for the ClusterPrincipalRole const type. -func PossibleClusterPrincipalRoleValues() []ClusterPrincipalRole { - return []ClusterPrincipalRole{ClusterPrincipalRoleAllDatabasesAdmin, ClusterPrincipalRoleAllDatabasesViewer} -} - -// Compression enumerates the values for compression. -type Compression string - -const ( - // CompressionGZip ... - CompressionGZip Compression = "GZip" - // CompressionNone ... - CompressionNone Compression = "None" -) - -// PossibleCompressionValues returns an array of possible values for the Compression const type. -func PossibleCompressionValues() []Compression { - return []Compression{CompressionGZip, CompressionNone} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// DatabasePrincipalRole enumerates the values for database principal role. -type DatabasePrincipalRole string - -const ( - // DatabasePrincipalRoleAdmin ... - DatabasePrincipalRoleAdmin DatabasePrincipalRole = "Admin" - // DatabasePrincipalRoleIngestor ... - DatabasePrincipalRoleIngestor DatabasePrincipalRole = "Ingestor" - // DatabasePrincipalRoleMonitor ... - DatabasePrincipalRoleMonitor DatabasePrincipalRole = "Monitor" - // DatabasePrincipalRoleUnrestrictedViewer ... - DatabasePrincipalRoleUnrestrictedViewer DatabasePrincipalRole = "UnrestrictedViewer" - // DatabasePrincipalRoleUser ... - DatabasePrincipalRoleUser DatabasePrincipalRole = "User" - // DatabasePrincipalRoleViewer ... - DatabasePrincipalRoleViewer DatabasePrincipalRole = "Viewer" -) - -// PossibleDatabasePrincipalRoleValues returns an array of possible values for the DatabasePrincipalRole const type. -func PossibleDatabasePrincipalRoleValues() []DatabasePrincipalRole { - return []DatabasePrincipalRole{DatabasePrincipalRoleAdmin, DatabasePrincipalRoleIngestor, DatabasePrincipalRoleMonitor, DatabasePrincipalRoleUnrestrictedViewer, DatabasePrincipalRoleUser, DatabasePrincipalRoleViewer} -} - -// DatabasePrincipalType enumerates the values for database principal type. -type DatabasePrincipalType string - -const ( - // DatabasePrincipalTypeApp ... - DatabasePrincipalTypeApp DatabasePrincipalType = "App" - // DatabasePrincipalTypeGroup ... - DatabasePrincipalTypeGroup DatabasePrincipalType = "Group" - // DatabasePrincipalTypeUser ... - DatabasePrincipalTypeUser DatabasePrincipalType = "User" -) - -// PossibleDatabasePrincipalTypeValues returns an array of possible values for the DatabasePrincipalType const type. -func PossibleDatabasePrincipalTypeValues() []DatabasePrincipalType { - return []DatabasePrincipalType{DatabasePrincipalTypeApp, DatabasePrincipalTypeGroup, DatabasePrincipalTypeUser} -} - -// DefaultPrincipalsModificationKind enumerates the values for default principals modification kind. -type DefaultPrincipalsModificationKind string - -const ( - // DefaultPrincipalsModificationKindNone ... - DefaultPrincipalsModificationKindNone DefaultPrincipalsModificationKind = "None" - // DefaultPrincipalsModificationKindReplace ... - DefaultPrincipalsModificationKindReplace DefaultPrincipalsModificationKind = "Replace" - // DefaultPrincipalsModificationKindUnion ... - DefaultPrincipalsModificationKindUnion DefaultPrincipalsModificationKind = "Union" -) - -// PossibleDefaultPrincipalsModificationKindValues returns an array of possible values for the DefaultPrincipalsModificationKind const type. -func PossibleDefaultPrincipalsModificationKindValues() []DefaultPrincipalsModificationKind { - return []DefaultPrincipalsModificationKind{DefaultPrincipalsModificationKindNone, DefaultPrincipalsModificationKindReplace, DefaultPrincipalsModificationKindUnion} -} - -// EngineType enumerates the values for engine type. -type EngineType string - -const ( - // EngineTypeV2 ... - EngineTypeV2 EngineType = "V2" - // EngineTypeV3 ... - EngineTypeV3 EngineType = "V3" -) - -// PossibleEngineTypeValues returns an array of possible values for the EngineType const type. -func PossibleEngineTypeValues() []EngineType { - return []EngineType{EngineTypeV2, EngineTypeV3} -} - -// EventGridDataFormat enumerates the values for event grid data format. -type EventGridDataFormat string - -const ( - // EventGridDataFormatAPACHEAVRO ... - EventGridDataFormatAPACHEAVRO EventGridDataFormat = "APACHEAVRO" - // EventGridDataFormatAVRO ... - EventGridDataFormatAVRO EventGridDataFormat = "AVRO" - // EventGridDataFormatCSV ... - EventGridDataFormatCSV EventGridDataFormat = "CSV" - // EventGridDataFormatJSON ... - EventGridDataFormatJSON EventGridDataFormat = "JSON" - // EventGridDataFormatMULTIJSON ... - EventGridDataFormatMULTIJSON EventGridDataFormat = "MULTIJSON" - // EventGridDataFormatORC ... - EventGridDataFormatORC EventGridDataFormat = "ORC" - // EventGridDataFormatPARQUET ... - EventGridDataFormatPARQUET EventGridDataFormat = "PARQUET" - // EventGridDataFormatPSV ... - EventGridDataFormatPSV EventGridDataFormat = "PSV" - // EventGridDataFormatRAW ... - EventGridDataFormatRAW EventGridDataFormat = "RAW" - // EventGridDataFormatSCSV ... - EventGridDataFormatSCSV EventGridDataFormat = "SCSV" - // EventGridDataFormatSINGLEJSON ... - EventGridDataFormatSINGLEJSON EventGridDataFormat = "SINGLEJSON" - // EventGridDataFormatSOHSV ... - EventGridDataFormatSOHSV EventGridDataFormat = "SOHSV" - // EventGridDataFormatTSV ... - EventGridDataFormatTSV EventGridDataFormat = "TSV" - // EventGridDataFormatTSVE ... - EventGridDataFormatTSVE EventGridDataFormat = "TSVE" - // EventGridDataFormatTXT ... - EventGridDataFormatTXT EventGridDataFormat = "TXT" - // EventGridDataFormatW3CLOGFILE ... - EventGridDataFormatW3CLOGFILE EventGridDataFormat = "W3CLOGFILE" -) - -// PossibleEventGridDataFormatValues returns an array of possible values for the EventGridDataFormat const type. -func PossibleEventGridDataFormatValues() []EventGridDataFormat { - return []EventGridDataFormat{EventGridDataFormatAPACHEAVRO, EventGridDataFormatAVRO, EventGridDataFormatCSV, EventGridDataFormatJSON, EventGridDataFormatMULTIJSON, EventGridDataFormatORC, EventGridDataFormatPARQUET, EventGridDataFormatPSV, EventGridDataFormatRAW, EventGridDataFormatSCSV, EventGridDataFormatSINGLEJSON, EventGridDataFormatSOHSV, EventGridDataFormatTSV, EventGridDataFormatTSVE, EventGridDataFormatTXT, EventGridDataFormatW3CLOGFILE} -} - -// EventHubDataFormat enumerates the values for event hub data format. -type EventHubDataFormat string - -const ( - // EventHubDataFormatAPACHEAVRO ... - EventHubDataFormatAPACHEAVRO EventHubDataFormat = "APACHEAVRO" - // EventHubDataFormatAVRO ... - EventHubDataFormatAVRO EventHubDataFormat = "AVRO" - // EventHubDataFormatCSV ... - EventHubDataFormatCSV EventHubDataFormat = "CSV" - // EventHubDataFormatJSON ... - EventHubDataFormatJSON EventHubDataFormat = "JSON" - // EventHubDataFormatMULTIJSON ... - EventHubDataFormatMULTIJSON EventHubDataFormat = "MULTIJSON" - // EventHubDataFormatORC ... - EventHubDataFormatORC EventHubDataFormat = "ORC" - // EventHubDataFormatPARQUET ... - EventHubDataFormatPARQUET EventHubDataFormat = "PARQUET" - // EventHubDataFormatPSV ... - EventHubDataFormatPSV EventHubDataFormat = "PSV" - // EventHubDataFormatRAW ... - EventHubDataFormatRAW EventHubDataFormat = "RAW" - // EventHubDataFormatSCSV ... - EventHubDataFormatSCSV EventHubDataFormat = "SCSV" - // EventHubDataFormatSINGLEJSON ... - EventHubDataFormatSINGLEJSON EventHubDataFormat = "SINGLEJSON" - // EventHubDataFormatSOHSV ... - EventHubDataFormatSOHSV EventHubDataFormat = "SOHSV" - // EventHubDataFormatTSV ... - EventHubDataFormatTSV EventHubDataFormat = "TSV" - // EventHubDataFormatTSVE ... - EventHubDataFormatTSVE EventHubDataFormat = "TSVE" - // EventHubDataFormatTXT ... - EventHubDataFormatTXT EventHubDataFormat = "TXT" - // EventHubDataFormatW3CLOGFILE ... - EventHubDataFormatW3CLOGFILE EventHubDataFormat = "W3CLOGFILE" -) - -// PossibleEventHubDataFormatValues returns an array of possible values for the EventHubDataFormat const type. -func PossibleEventHubDataFormatValues() []EventHubDataFormat { - return []EventHubDataFormat{EventHubDataFormatAPACHEAVRO, EventHubDataFormatAVRO, EventHubDataFormatCSV, EventHubDataFormatJSON, EventHubDataFormatMULTIJSON, EventHubDataFormatORC, EventHubDataFormatPARQUET, EventHubDataFormatPSV, EventHubDataFormatRAW, EventHubDataFormatSCSV, EventHubDataFormatSINGLEJSON, EventHubDataFormatSOHSV, EventHubDataFormatTSV, EventHubDataFormatTSVE, EventHubDataFormatTXT, EventHubDataFormatW3CLOGFILE} -} - -// IdentityType enumerates the values for identity type. -type IdentityType string - -const ( - // IdentityTypeNone ... - IdentityTypeNone IdentityType = "None" - // IdentityTypeSystemAssigned ... - IdentityTypeSystemAssigned IdentityType = "SystemAssigned" - // IdentityTypeSystemAssignedUserAssigned ... - IdentityTypeSystemAssignedUserAssigned IdentityType = "SystemAssigned, UserAssigned" - // IdentityTypeUserAssigned ... - IdentityTypeUserAssigned IdentityType = "UserAssigned" -) - -// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. -func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{IdentityTypeNone, IdentityTypeSystemAssigned, IdentityTypeSystemAssignedUserAssigned, IdentityTypeUserAssigned} -} - -// IotHubDataFormat enumerates the values for iot hub data format. -type IotHubDataFormat string - -const ( - // IotHubDataFormatAPACHEAVRO ... - IotHubDataFormatAPACHEAVRO IotHubDataFormat = "APACHEAVRO" - // IotHubDataFormatAVRO ... - IotHubDataFormatAVRO IotHubDataFormat = "AVRO" - // IotHubDataFormatCSV ... - IotHubDataFormatCSV IotHubDataFormat = "CSV" - // IotHubDataFormatJSON ... - IotHubDataFormatJSON IotHubDataFormat = "JSON" - // IotHubDataFormatMULTIJSON ... - IotHubDataFormatMULTIJSON IotHubDataFormat = "MULTIJSON" - // IotHubDataFormatORC ... - IotHubDataFormatORC IotHubDataFormat = "ORC" - // IotHubDataFormatPARQUET ... - IotHubDataFormatPARQUET IotHubDataFormat = "PARQUET" - // IotHubDataFormatPSV ... - IotHubDataFormatPSV IotHubDataFormat = "PSV" - // IotHubDataFormatRAW ... - IotHubDataFormatRAW IotHubDataFormat = "RAW" - // IotHubDataFormatSCSV ... - IotHubDataFormatSCSV IotHubDataFormat = "SCSV" - // IotHubDataFormatSINGLEJSON ... - IotHubDataFormatSINGLEJSON IotHubDataFormat = "SINGLEJSON" - // IotHubDataFormatSOHSV ... - IotHubDataFormatSOHSV IotHubDataFormat = "SOHSV" - // IotHubDataFormatTSV ... - IotHubDataFormatTSV IotHubDataFormat = "TSV" - // IotHubDataFormatTSVE ... - IotHubDataFormatTSVE IotHubDataFormat = "TSVE" - // IotHubDataFormatTXT ... - IotHubDataFormatTXT IotHubDataFormat = "TXT" - // IotHubDataFormatW3CLOGFILE ... - IotHubDataFormatW3CLOGFILE IotHubDataFormat = "W3CLOGFILE" -) - -// PossibleIotHubDataFormatValues returns an array of possible values for the IotHubDataFormat const type. -func PossibleIotHubDataFormatValues() []IotHubDataFormat { - return []IotHubDataFormat{IotHubDataFormatAPACHEAVRO, IotHubDataFormatAVRO, IotHubDataFormatCSV, IotHubDataFormatJSON, IotHubDataFormatMULTIJSON, IotHubDataFormatORC, IotHubDataFormatPARQUET, IotHubDataFormatPSV, IotHubDataFormatRAW, IotHubDataFormatSCSV, IotHubDataFormatSINGLEJSON, IotHubDataFormatSOHSV, IotHubDataFormatTSV, IotHubDataFormatTSVE, IotHubDataFormatTXT, IotHubDataFormatW3CLOGFILE} -} - -// Kind enumerates the values for kind. -type Kind string - -const ( - // KindDatabase ... - KindDatabase Kind = "Database" - // KindReadOnlyFollowing ... - KindReadOnlyFollowing Kind = "ReadOnlyFollowing" - // KindReadWrite ... - KindReadWrite Kind = "ReadWrite" -) - -// PossibleKindValues returns an array of possible values for the Kind const type. -func PossibleKindValues() []Kind { - return []Kind{KindDatabase, KindReadOnlyFollowing, KindReadWrite} -} - -// KindBasicDataConnection enumerates the values for kind basic data connection. -type KindBasicDataConnection string - -const ( - // KindBasicDataConnectionKindDataConnection ... - KindBasicDataConnectionKindDataConnection KindBasicDataConnection = "DataConnection" - // KindBasicDataConnectionKindEventGrid ... - KindBasicDataConnectionKindEventGrid KindBasicDataConnection = "EventGrid" - // KindBasicDataConnectionKindEventHub ... - KindBasicDataConnectionKindEventHub KindBasicDataConnection = "EventHub" - // KindBasicDataConnectionKindIotHub ... - KindBasicDataConnectionKindIotHub KindBasicDataConnection = "IotHub" -) - -// PossibleKindBasicDataConnectionValues returns an array of possible values for the KindBasicDataConnection const type. -func PossibleKindBasicDataConnectionValues() []KindBasicDataConnection { - return []KindBasicDataConnection{KindBasicDataConnectionKindDataConnection, KindBasicDataConnectionKindEventGrid, KindBasicDataConnectionKindEventHub, KindBasicDataConnectionKindIotHub} -} - -// LanguageExtensionName enumerates the values for language extension name. -type LanguageExtensionName string - -const ( - // LanguageExtensionNamePYTHON ... - LanguageExtensionNamePYTHON LanguageExtensionName = "PYTHON" - // LanguageExtensionNameR ... - LanguageExtensionNameR LanguageExtensionName = "R" -) - -// PossibleLanguageExtensionNameValues returns an array of possible values for the LanguageExtensionName const type. -func PossibleLanguageExtensionNameValues() []LanguageExtensionName { - return []LanguageExtensionName{LanguageExtensionNamePYTHON, LanguageExtensionNameR} -} - -// PrincipalsModificationKind enumerates the values for principals modification kind. -type PrincipalsModificationKind string - -const ( - // PrincipalsModificationKindNone ... - PrincipalsModificationKindNone PrincipalsModificationKind = "None" - // PrincipalsModificationKindReplace ... - PrincipalsModificationKindReplace PrincipalsModificationKind = "Replace" - // PrincipalsModificationKindUnion ... - PrincipalsModificationKindUnion PrincipalsModificationKind = "Union" -) - -// PossiblePrincipalsModificationKindValues returns an array of possible values for the PrincipalsModificationKind const type. -func PossiblePrincipalsModificationKindValues() []PrincipalsModificationKind { - return []PrincipalsModificationKind{PrincipalsModificationKindNone, PrincipalsModificationKindReplace, PrincipalsModificationKindUnion} -} - -// PrincipalType enumerates the values for principal type. -type PrincipalType string - -const ( - // PrincipalTypeApp ... - PrincipalTypeApp PrincipalType = "App" - // PrincipalTypeGroup ... - PrincipalTypeGroup PrincipalType = "Group" - // PrincipalTypeUser ... - PrincipalTypeUser PrincipalType = "User" -) - -// PossiblePrincipalTypeValues returns an array of possible values for the PrincipalType const type. -func PossiblePrincipalTypeValues() []PrincipalType { - return []PrincipalType{PrincipalTypeApp, PrincipalTypeGroup, PrincipalTypeUser} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCreating ... - ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateMoving ... - ProvisioningStateMoving ProvisioningState = "Moving" - // ProvisioningStateRunning ... - ProvisioningStateRunning ProvisioningState = "Running" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoving, ProvisioningStateRunning, ProvisioningStateSucceeded} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // PublicNetworkAccessDisabled ... - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - // PublicNetworkAccessEnabled ... - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} -} - -// Reason enumerates the values for reason. -type Reason string - -const ( - // ReasonAlreadyExists ... - ReasonAlreadyExists Reason = "AlreadyExists" - // ReasonInvalid ... - ReasonInvalid Reason = "Invalid" -) - -// PossibleReasonValues returns an array of possible values for the Reason const type. -func PossibleReasonValues() []Reason { - return []Reason{ReasonAlreadyExists, ReasonInvalid} -} - -// State enumerates the values for state. -type State string - -const ( - // StateCreating ... - StateCreating State = "Creating" - // StateDeleted ... - StateDeleted State = "Deleted" - // StateDeleting ... - StateDeleting State = "Deleting" - // StateRunning ... - StateRunning State = "Running" - // StateStarting ... - StateStarting State = "Starting" - // StateStopped ... - StateStopped State = "Stopped" - // StateStopping ... - StateStopping State = "Stopping" - // StateUnavailable ... - StateUnavailable State = "Unavailable" - // StateUpdating ... - StateUpdating State = "Updating" -) - -// PossibleStateValues returns an array of possible values for the State const type. -func PossibleStateValues() []State { - return []State{StateCreating, StateDeleted, StateDeleting, StateRunning, StateStarting, StateStopped, StateStopping, StateUnavailable, StateUpdating} -} - -// Status enumerates the values for status. -type Status string - -const ( - // StatusCanceled ... - StatusCanceled Status = "Canceled" - // StatusFailed ... - StatusFailed Status = "Failed" - // StatusRunning ... - StatusRunning Status = "Running" - // StatusSucceeded ... - StatusSucceeded Status = "Succeeded" -) - -// PossibleStatusValues returns an array of possible values for the Status const type. -func PossibleStatusValues() []Status { - return []Status{StatusCanceled, StatusFailed, StatusRunning, StatusSucceeded} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeMicrosoftKustoclustersattachedDatabaseConfigurations ... - TypeMicrosoftKustoclustersattachedDatabaseConfigurations Type = "Microsoft.Kusto/clusters/attachedDatabaseConfigurations" - // TypeMicrosoftKustoclustersdatabases ... - TypeMicrosoftKustoclustersdatabases Type = "Microsoft.Kusto/clusters/databases" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeMicrosoftKustoclustersattachedDatabaseConfigurations, TypeMicrosoftKustoclustersdatabases} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/models.go deleted file mode 100644 index f6f5a028577..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/models.go +++ /dev/null @@ -1,4761 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto" - -// AcceptedAudiences represents an accepted audience trusted by the cluster. -type AcceptedAudiences struct { - // Value - GUID or valid URL representing an accepted audience. - Value *string `json:"value,omitempty"` -} - -// AttachedDatabaseConfiguration class representing an attached database configuration. -type AttachedDatabaseConfiguration struct { - autorest.Response `json:"-"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // AttachedDatabaseConfigurationProperties - The properties of the attached database configuration. - *AttachedDatabaseConfigurationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AttachedDatabaseConfiguration. -func (adc AttachedDatabaseConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if adc.Location != nil { - objectMap["location"] = adc.Location - } - if adc.AttachedDatabaseConfigurationProperties != nil { - objectMap["properties"] = adc.AttachedDatabaseConfigurationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AttachedDatabaseConfiguration struct. -func (adc *AttachedDatabaseConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - adc.Location = &location - } - case "properties": - if v != nil { - var attachedDatabaseConfigurationProperties AttachedDatabaseConfigurationProperties - err = json.Unmarshal(*v, &attachedDatabaseConfigurationProperties) - if err != nil { - return err - } - adc.AttachedDatabaseConfigurationProperties = &attachedDatabaseConfigurationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - adc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - adc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - adc.Type = &typeVar - } - } - } - - return nil -} - -// AttachedDatabaseConfigurationListResult the list attached database configurations operation response. -type AttachedDatabaseConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - The list of attached database configurations. - Value *[]AttachedDatabaseConfiguration `json:"value,omitempty"` -} - -// AttachedDatabaseConfigurationProperties class representing the an attached database configuration -// properties of kind specific. -type AttachedDatabaseConfigurationProperties struct { - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // DatabaseName - The name of the database which you would like to attach, use * if you want to follow all current and future databases. - DatabaseName *string `json:"databaseName,omitempty"` - // ClusterResourceID - The resource id of the cluster where the databases you would like to attach reside. - ClusterResourceID *string `json:"clusterResourceId,omitempty"` - // AttachedDatabaseNames - READ-ONLY; The list of databases from the clusterResourceId which are currently attached to the cluster. - AttachedDatabaseNames *[]string `json:"attachedDatabaseNames,omitempty"` - // DefaultPrincipalsModificationKind - The default principals modification kind. Possible values include: 'DefaultPrincipalsModificationKindUnion', 'DefaultPrincipalsModificationKindReplace', 'DefaultPrincipalsModificationKindNone' - DefaultPrincipalsModificationKind DefaultPrincipalsModificationKind `json:"defaultPrincipalsModificationKind,omitempty"` - // TableLevelSharingProperties - Table level sharing specifications - TableLevelSharingProperties *TableLevelSharingProperties `json:"tableLevelSharingProperties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AttachedDatabaseConfigurationProperties. -func (adcp AttachedDatabaseConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if adcp.DatabaseName != nil { - objectMap["databaseName"] = adcp.DatabaseName - } - if adcp.ClusterResourceID != nil { - objectMap["clusterResourceId"] = adcp.ClusterResourceID - } - if adcp.DefaultPrincipalsModificationKind != "" { - objectMap["defaultPrincipalsModificationKind"] = adcp.DefaultPrincipalsModificationKind - } - if adcp.TableLevelSharingProperties != nil { - objectMap["tableLevelSharingProperties"] = adcp.TableLevelSharingProperties - } - return json.Marshal(objectMap) -} - -// AttachedDatabaseConfigurationsCheckNameRequest the result returned from a AttachedDatabaseConfigurations -// check name availability request. -type AttachedDatabaseConfigurationsCheckNameRequest struct { - // Name - Attached database resource name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, for instance Microsoft.Kusto/clusters/attachedDatabaseConfigurations. - Type *string `json:"type,omitempty"` -} - -// AttachedDatabaseConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type AttachedDatabaseConfigurationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AttachedDatabaseConfigurationsClient) (AttachedDatabaseConfiguration, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AttachedDatabaseConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AttachedDatabaseConfigurationsCreateOrUpdateFuture.Result. -func (future *AttachedDatabaseConfigurationsCreateOrUpdateFuture) result(client AttachedDatabaseConfigurationsClient) (adc AttachedDatabaseConfiguration, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - adc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if adc.Response.Response, err = future.GetResult(sender); err == nil && adc.Response.Response.StatusCode != http.StatusNoContent { - adc, err = client.CreateOrUpdateResponder(adc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture", "Result", adc.Response.Response, "Failure responding to request") - } - } - return -} - -// AttachedDatabaseConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type AttachedDatabaseConfigurationsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AttachedDatabaseConfigurationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AttachedDatabaseConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AttachedDatabaseConfigurationsDeleteFuture.Result. -func (future *AttachedDatabaseConfigurationsDeleteFuture) result(client AttachedDatabaseConfigurationsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.AttachedDatabaseConfigurationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AzureCapacity azure capacity definition. -type AzureCapacity struct { - // ScaleType - Scale type. Possible values include: 'AzureScaleTypeAutomatic', 'AzureScaleTypeManual', 'AzureScaleTypeNone' - ScaleType AzureScaleType `json:"scaleType,omitempty"` - // Minimum - Minimum allowed capacity. - Minimum *int32 `json:"minimum,omitempty"` - // Maximum - Maximum allowed capacity. - Maximum *int32 `json:"maximum,omitempty"` - // Default - The default capacity that would be used. - Default *int32 `json:"default,omitempty"` -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AzureResourceSku azure resource SKU definition. -type AzureResourceSku struct { - // ResourceType - Resource Namespace and Type. - ResourceType *string `json:"resourceType,omitempty"` - // Sku - The SKU details. - Sku *AzureSku `json:"sku,omitempty"` - // Capacity - The number of instances of the cluster. - Capacity *AzureCapacity `json:"capacity,omitempty"` -} - -// AzureSku azure SKU definition. -type AzureSku struct { - // Name - SKU name. Possible values include: 'AzureSkuNameStandardDS13V21TBPS', 'AzureSkuNameStandardDS13V22TBPS', 'AzureSkuNameStandardDS14V23TBPS', 'AzureSkuNameStandardDS14V24TBPS', 'AzureSkuNameStandardD13V2', 'AzureSkuNameStandardD14V2', 'AzureSkuNameStandardL8s', 'AzureSkuNameStandardL16s', 'AzureSkuNameStandardL8sV2', 'AzureSkuNameStandardL16sV2', 'AzureSkuNameStandardD11V2', 'AzureSkuNameStandardD12V2', 'AzureSkuNameStandardL4s', 'AzureSkuNameDevNoSLAStandardD11V2', 'AzureSkuNameStandardE64iV3', 'AzureSkuNameStandardE80idsV4', 'AzureSkuNameStandardE2aV4', 'AzureSkuNameStandardE4aV4', 'AzureSkuNameStandardE8aV4', 'AzureSkuNameStandardE16aV4', 'AzureSkuNameStandardE8asV41TBPS', 'AzureSkuNameStandardE8asV42TBPS', 'AzureSkuNameStandardE16asV43TBPS', 'AzureSkuNameStandardE16asV44TBPS', 'AzureSkuNameDevNoSLAStandardE2aV4' - Name AzureSkuName `json:"name,omitempty"` - // Capacity - The number of instances of the cluster. - Capacity *int32 `json:"capacity,omitempty"` - // Tier - SKU tier. Possible values include: 'AzureSkuTierBasic', 'AzureSkuTierStandard' - Tier AzureSkuTier `json:"tier,omitempty"` -} - -// CheckNameRequest the result returned from a database check name availability request. -type CheckNameRequest struct { - // Name - Resource name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, for instance Microsoft.Kusto/clusters/databases. Possible values include: 'TypeMicrosoftKustoclustersdatabases', 'TypeMicrosoftKustoclustersattachedDatabaseConfigurations' - Type Type `json:"type,omitempty"` -} - -// CheckNameResult the result returned from a check name availability request. -type CheckNameResult struct { - autorest.Response `json:"-"` - // NameAvailable - Specifies a Boolean value that indicates if the name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Name - The name that was checked. - Name *string `json:"name,omitempty"` - // Message - Message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated. - Message *string `json:"message,omitempty"` - // Reason - Message providing the reason why the given name is invalid. Possible values include: 'ReasonInvalid', 'ReasonAlreadyExists' - Reason Reason `json:"reason,omitempty"` -} - -// CloudError an error response from Kusto. -type CloudError struct { - // Error - An error response from Kusto. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from Kusto. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for displaying in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// Cluster class representing a Kusto cluster. -type Cluster struct { - autorest.Response `json:"-"` - // Sku - The SKU of the cluster. - Sku *AzureSku `json:"sku,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,omitempty"` - // Zones - The availability zones of the cluster. - Zones *[]string `json:"zones,omitempty"` - // Identity - The identity of the cluster, if configured. - Identity *Identity `json:"identity,omitempty"` - // ClusterProperties - The cluster properties. - *ClusterProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Cluster. -func (c Cluster) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.Sku != nil { - objectMap["sku"] = c.Sku - } - if c.Zones != nil { - objectMap["zones"] = c.Zones - } - if c.Identity != nil { - objectMap["identity"] = c.Identity - } - if c.ClusterProperties != nil { - objectMap["properties"] = c.ClusterProperties - } - if c.Tags != nil { - objectMap["tags"] = c.Tags - } - if c.Location != nil { - objectMap["location"] = c.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Cluster struct. -func (c *Cluster) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku AzureSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - c.Sku = &sku - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - c.SystemData = &systemData - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - c.Zones = &zones - } - case "identity": - if v != nil { - var identity Identity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - c.Identity = &identity - } - case "properties": - if v != nil { - var clusterProperties ClusterProperties - err = json.Unmarshal(*v, &clusterProperties) - if err != nil { - return err - } - c.ClusterProperties = &clusterProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - c.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - c.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - c.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - c.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - c.Type = &typeVar - } - } - } - - return nil -} - -// ClusterCheckNameRequest the result returned from a cluster check name availability request. -type ClusterCheckNameRequest struct { - // Name - Cluster name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, Microsoft.Kusto/clusters. - Type *string `json:"type,omitempty"` -} - -// ClusterListResult the list Kusto clusters operation response. -type ClusterListResult struct { - autorest.Response `json:"-"` - // Value - The list of Kusto clusters. - Value *[]Cluster `json:"value,omitempty"` -} - -// ClusterPrincipalAssignment class representing a cluster principal assignment. -type ClusterPrincipalAssignment struct { - autorest.Response `json:"-"` - // ClusterPrincipalProperties - The cluster principal. - *ClusterPrincipalProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterPrincipalAssignment. -func (cpa ClusterPrincipalAssignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cpa.ClusterPrincipalProperties != nil { - objectMap["properties"] = cpa.ClusterPrincipalProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ClusterPrincipalAssignment struct. -func (cpa *ClusterPrincipalAssignment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var clusterPrincipalProperties ClusterPrincipalProperties - err = json.Unmarshal(*v, &clusterPrincipalProperties) - if err != nil { - return err - } - cpa.ClusterPrincipalProperties = &clusterPrincipalProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cpa.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cpa.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cpa.Type = &typeVar - } - } - } - - return nil -} - -// ClusterPrincipalAssignmentCheckNameRequest a principal assignment check name availability request. -type ClusterPrincipalAssignmentCheckNameRequest struct { - // Name - Principal Assignment resource name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, Microsoft.Kusto/clusters/principalAssignments. - Type *string `json:"type,omitempty"` -} - -// ClusterPrincipalAssignmentListResult the list Kusto cluster principal assignments operation response. -type ClusterPrincipalAssignmentListResult struct { - autorest.Response `json:"-"` - // Value - The list of Kusto cluster principal assignments. - Value *[]ClusterPrincipalAssignment `json:"value,omitempty"` -} - -// ClusterPrincipalAssignmentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ClusterPrincipalAssignmentsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClusterPrincipalAssignmentsClient) (ClusterPrincipalAssignment, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClusterPrincipalAssignmentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClusterPrincipalAssignmentsCreateOrUpdateFuture.Result. -func (future *ClusterPrincipalAssignmentsCreateOrUpdateFuture) result(client ClusterPrincipalAssignmentsClient) (cpa ClusterPrincipalAssignment, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cpa.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ClusterPrincipalAssignmentsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cpa.Response.Response, err = future.GetResult(sender); err == nil && cpa.Response.Response.StatusCode != http.StatusNoContent { - cpa, err = client.CreateOrUpdateResponder(cpa.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsCreateOrUpdateFuture", "Result", cpa.Response.Response, "Failure responding to request") - } - } - return -} - -// ClusterPrincipalAssignmentsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ClusterPrincipalAssignmentsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClusterPrincipalAssignmentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClusterPrincipalAssignmentsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClusterPrincipalAssignmentsDeleteFuture.Result. -func (future *ClusterPrincipalAssignmentsDeleteFuture) result(client ClusterPrincipalAssignmentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ClusterPrincipalAssignmentsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ClusterPrincipalProperties a class representing cluster principal property. -type ClusterPrincipalProperties struct { - // PrincipalID - The principal ID assigned to the cluster principal. It can be a user email, application ID, or security group name. - PrincipalID *string `json:"principalId,omitempty"` - // Role - Cluster principal role. Possible values include: 'ClusterPrincipalRoleAllDatabasesAdmin', 'ClusterPrincipalRoleAllDatabasesViewer' - Role ClusterPrincipalRole `json:"role,omitempty"` - // TenantID - The tenant id of the principal - TenantID *string `json:"tenantId,omitempty"` - // PrincipalType - Principal type. Possible values include: 'PrincipalTypeApp', 'PrincipalTypeGroup', 'PrincipalTypeUser' - PrincipalType PrincipalType `json:"principalType,omitempty"` - // TenantName - READ-ONLY; The tenant name of the principal - TenantName *string `json:"tenantName,omitempty"` - // PrincipalName - READ-ONLY; The principal name - PrincipalName *string `json:"principalName,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterPrincipalProperties. -func (cpp ClusterPrincipalProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cpp.PrincipalID != nil { - objectMap["principalId"] = cpp.PrincipalID - } - if cpp.Role != "" { - objectMap["role"] = cpp.Role - } - if cpp.TenantID != nil { - objectMap["tenantId"] = cpp.TenantID - } - if cpp.PrincipalType != "" { - objectMap["principalType"] = cpp.PrincipalType - } - return json.Marshal(objectMap) -} - -// ClusterProperties class representing the Kusto cluster properties. -type ClusterProperties struct { - // State - READ-ONLY; The state of the resource. Possible values include: 'StateCreating', 'StateUnavailable', 'StateRunning', 'StateDeleting', 'StateDeleted', 'StateStopping', 'StateStopped', 'StateStarting', 'StateUpdating' - State State `json:"state,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // URI - READ-ONLY; The cluster URI. - URI *string `json:"uri,omitempty"` - // DataIngestionURI - READ-ONLY; The cluster data ingestion URI. - DataIngestionURI *string `json:"dataIngestionUri,omitempty"` - // StateReason - READ-ONLY; The reason for the cluster's current state. - StateReason *string `json:"stateReason,omitempty"` - // TrustedExternalTenants - The cluster's external tenants. - TrustedExternalTenants *[]TrustedExternalTenant `json:"trustedExternalTenants,omitempty"` - // OptimizedAutoscale - Optimized auto scale definition. - OptimizedAutoscale *OptimizedAutoscale `json:"optimizedAutoscale,omitempty"` - // EnableDiskEncryption - A boolean value that indicates if the cluster's disks are encrypted. - EnableDiskEncryption *bool `json:"enableDiskEncryption,omitempty"` - // EnableStreamingIngest - A boolean value that indicates if the streaming ingest is enabled. - EnableStreamingIngest *bool `json:"enableStreamingIngest,omitempty"` - // VirtualNetworkConfiguration - Virtual network definition. - VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` - // KeyVaultProperties - KeyVault properties for the cluster encryption. - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` - // EnablePurge - A boolean value that indicates if the purge operations are enabled. - EnablePurge *bool `json:"enablePurge,omitempty"` - // LanguageExtensions - READ-ONLY; List of the cluster's language extensions. - LanguageExtensions *LanguageExtensionsList `json:"languageExtensions,omitempty"` - // EnableDoubleEncryption - A boolean value that indicates if double encryption is enabled. - EnableDoubleEncryption *bool `json:"enableDoubleEncryption,omitempty"` - // PublicNetworkAccess - Public network access to the cluster is enabled by default. When disabled, only private endpoint connection to the cluster is allowed. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // AllowedIPRangeList - The list of ips in the format of CIDR allowed to connect to the cluster. - AllowedIPRangeList *[]string `json:"allowedIpRangeList,omitempty"` - // EngineType - The engine type. Possible values include: 'EngineTypeV2', 'EngineTypeV3' - EngineType EngineType `json:"engineType,omitempty"` - // AcceptedAudiences - The cluster's accepted audiences. - AcceptedAudiences *[]AcceptedAudiences `json:"acceptedAudiences,omitempty"` - // EnableAutoStop - A boolean value that indicates if the cluster could be automatically stopped (due to lack of data or no activity for many days). - EnableAutoStop *bool `json:"enableAutoStop,omitempty"` - // RestrictOutboundNetworkAccess - Whether or not to restrict outbound network access. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'ClusterNetworkAccessFlagEnabled', 'ClusterNetworkAccessFlagDisabled' - RestrictOutboundNetworkAccess ClusterNetworkAccessFlag `json:"restrictOutboundNetworkAccess,omitempty"` - // AllowedFqdnList - List of allowed FQDNs(Fully Qualified Domain Name) for egress from Cluster. - AllowedFqdnList *[]string `json:"allowedFqdnList,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterProperties. -func (cp ClusterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.TrustedExternalTenants != nil { - objectMap["trustedExternalTenants"] = cp.TrustedExternalTenants - } - if cp.OptimizedAutoscale != nil { - objectMap["optimizedAutoscale"] = cp.OptimizedAutoscale - } - if cp.EnableDiskEncryption != nil { - objectMap["enableDiskEncryption"] = cp.EnableDiskEncryption - } - if cp.EnableStreamingIngest != nil { - objectMap["enableStreamingIngest"] = cp.EnableStreamingIngest - } - if cp.VirtualNetworkConfiguration != nil { - objectMap["virtualNetworkConfiguration"] = cp.VirtualNetworkConfiguration - } - if cp.KeyVaultProperties != nil { - objectMap["keyVaultProperties"] = cp.KeyVaultProperties - } - if cp.EnablePurge != nil { - objectMap["enablePurge"] = cp.EnablePurge - } - if cp.EnableDoubleEncryption != nil { - objectMap["enableDoubleEncryption"] = cp.EnableDoubleEncryption - } - if cp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = cp.PublicNetworkAccess - } - if cp.AllowedIPRangeList != nil { - objectMap["allowedIpRangeList"] = cp.AllowedIPRangeList - } - if cp.EngineType != "" { - objectMap["engineType"] = cp.EngineType - } - if cp.AcceptedAudiences != nil { - objectMap["acceptedAudiences"] = cp.AcceptedAudiences - } - if cp.EnableAutoStop != nil { - objectMap["enableAutoStop"] = cp.EnableAutoStop - } - if cp.RestrictOutboundNetworkAccess != "" { - objectMap["restrictOutboundNetworkAccess"] = cp.RestrictOutboundNetworkAccess - } - if cp.AllowedFqdnList != nil { - objectMap["allowedFqdnList"] = cp.AllowedFqdnList - } - return json.Marshal(objectMap) -} - -// ClustersAddLanguageExtensionsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ClustersAddLanguageExtensionsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersAddLanguageExtensionsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersAddLanguageExtensionsFuture.Result. -func (future *ClustersAddLanguageExtensionsFuture) result(client ClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersAddLanguageExtensionsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ClustersAddLanguageExtensionsFuture") - return - } - ar.Response = future.Response() - return -} - -// ClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ClustersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (Cluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersCreateOrUpdateFuture.Result. -func (future *ClustersCreateOrUpdateFuture) result(client ClustersClient) (c Cluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - c.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ClustersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { - c, err = client.CreateOrUpdateResponder(c.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") - } - } - return -} - -// ClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ClustersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersDeleteFuture.Result. -func (future *ClustersDeleteFuture) result(client ClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ClustersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ClustersDetachFollowerDatabasesFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ClustersDetachFollowerDatabasesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersDetachFollowerDatabasesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersDetachFollowerDatabasesFuture.Result. -func (future *ClustersDetachFollowerDatabasesFuture) result(client ClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersDetachFollowerDatabasesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ClustersDetachFollowerDatabasesFuture") - return - } - ar.Response = future.Response() - return -} - -// ClustersDiagnoseVirtualNetworkFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ClustersDiagnoseVirtualNetworkFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (DiagnoseVirtualNetworkResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersDiagnoseVirtualNetworkFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersDiagnoseVirtualNetworkFuture.Result. -func (future *ClustersDiagnoseVirtualNetworkFuture) result(client ClustersClient) (dvnr DiagnoseVirtualNetworkResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersDiagnoseVirtualNetworkFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dvnr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ClustersDiagnoseVirtualNetworkFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dvnr.Response.Response, err = future.GetResult(sender); err == nil && dvnr.Response.Response.StatusCode != http.StatusNoContent { - dvnr, err = client.DiagnoseVirtualNetworkResponder(dvnr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersDiagnoseVirtualNetworkFuture", "Result", dvnr.Response.Response, "Failure responding to request") - } - } - return -} - -// ClustersRemoveLanguageExtensionsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ClustersRemoveLanguageExtensionsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersRemoveLanguageExtensionsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersRemoveLanguageExtensionsFuture.Result. -func (future *ClustersRemoveLanguageExtensionsFuture) result(client ClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersRemoveLanguageExtensionsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ClustersRemoveLanguageExtensionsFuture") - return - } - ar.Response = future.Response() - return -} - -// ClustersStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ClustersStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersStartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersStartFuture.Result. -func (future *ClustersStartFuture) result(client ClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ClustersStartFuture") - return - } - ar.Response = future.Response() - return -} - -// ClustersStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type ClustersStopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersStopFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersStopFuture.Result. -func (future *ClustersStopFuture) result(client ClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersStopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ClustersStopFuture") - return - } - ar.Response = future.Response() - return -} - -// ClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ClustersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (Cluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersUpdateFuture.Result. -func (future *ClustersUpdateFuture) result(client ClustersClient) (c Cluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - c.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ClustersUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { - c, err = client.UpdateResponder(c.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersUpdateFuture", "Result", c.Response.Response, "Failure responding to request") - } - } - return -} - -// ClusterUpdate class representing an update to a Kusto cluster. -type ClusterUpdate struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Sku - The SKU of the cluster. - Sku *AzureSku `json:"sku,omitempty"` - // Identity - The identity of the cluster, if configured. - Identity *Identity `json:"identity,omitempty"` - // ClusterProperties - The cluster properties. - *ClusterProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterUpdate. -func (cu ClusterUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cu.Tags != nil { - objectMap["tags"] = cu.Tags - } - if cu.Location != nil { - objectMap["location"] = cu.Location - } - if cu.Sku != nil { - objectMap["sku"] = cu.Sku - } - if cu.Identity != nil { - objectMap["identity"] = cu.Identity - } - if cu.ClusterProperties != nil { - objectMap["properties"] = cu.ClusterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ClusterUpdate struct. -func (cu *ClusterUpdate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cu.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - cu.Location = &location - } - case "sku": - if v != nil { - var sku AzureSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - cu.Sku = &sku - } - case "identity": - if v != nil { - var identity Identity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - cu.Identity = &identity - } - case "properties": - if v != nil { - var clusterProperties ClusterProperties - err = json.Unmarshal(*v, &clusterProperties) - if err != nil { - return err - } - cu.ClusterProperties = &clusterProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cu.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cu.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cu.Type = &typeVar - } - } - } - - return nil -} - -// BasicDatabase class representing a Kusto database. -type BasicDatabase interface { - AsReadWriteDatabase() (*ReadWriteDatabase, bool) - AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) - AsDatabase() (*Database, bool) -} - -// Database class representing a Kusto database. -type Database struct { - autorest.Response `json:"-"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyFollowing' - Kind Kind `json:"kind,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -func unmarshalBasicDatabase(body []byte) (BasicDatabase, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["kind"] { - case string(KindReadWrite): - var rwd ReadWriteDatabase - err := json.Unmarshal(body, &rwd) - return rwd, err - case string(KindReadOnlyFollowing): - var rofd ReadOnlyFollowingDatabase - err := json.Unmarshal(body, &rofd) - return rofd, err - default: - var d Database - err := json.Unmarshal(body, &d) - return d, err - } -} -func unmarshalBasicDatabaseArray(body []byte) ([]BasicDatabase, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - dArray := make([]BasicDatabase, len(rawMessages)) - - for index, rawMessage := range rawMessages { - d, err := unmarshalBasicDatabase(*rawMessage) - if err != nil { - return nil, err - } - dArray[index] = d - } - return dArray, nil -} - -// MarshalJSON is the custom marshaler for Database. -func (d Database) MarshalJSON() ([]byte, error) { - d.Kind = KindDatabase - objectMap := make(map[string]interface{}) - if d.Location != nil { - objectMap["location"] = d.Location - } - if d.Kind != "" { - objectMap["kind"] = d.Kind - } - return json.Marshal(objectMap) -} - -// AsReadWriteDatabase is the BasicDatabase implementation for Database. -func (d Database) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { - return nil, false -} - -// AsReadOnlyFollowingDatabase is the BasicDatabase implementation for Database. -func (d Database) AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) { - return nil, false -} - -// AsDatabase is the BasicDatabase implementation for Database. -func (d Database) AsDatabase() (*Database, bool) { - return &d, true -} - -// AsBasicDatabase is the BasicDatabase implementation for Database. -func (d Database) AsBasicDatabase() (BasicDatabase, bool) { - return &d, true -} - -// DatabaseListResult the list Kusto databases operation response. -type DatabaseListResult struct { - autorest.Response `json:"-"` - // Value - The list of Kusto databases. - Value *[]BasicDatabase `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseListResult struct. -func (dlr *DatabaseListResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "value": - if v != nil { - value, err := unmarshalBasicDatabaseArray(*v) - if err != nil { - return err - } - dlr.Value = &value - } - } - } - - return nil -} - -// DatabaseModel ... -type DatabaseModel struct { - autorest.Response `json:"-"` - Value BasicDatabase `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseModel struct. -func (dm *DatabaseModel) UnmarshalJSON(body []byte) error { - d, err := unmarshalBasicDatabase(body) - if err != nil { - return err - } - dm.Value = d - - return nil -} - -// DatabasePrincipal a class representing database principal entity. -type DatabasePrincipal struct { - // Role - Database principal role. Possible values include: 'DatabasePrincipalRoleAdmin', 'DatabasePrincipalRoleIngestor', 'DatabasePrincipalRoleMonitor', 'DatabasePrincipalRoleUser', 'DatabasePrincipalRoleUnrestrictedViewer', 'DatabasePrincipalRoleViewer' - Role DatabasePrincipalRole `json:"role,omitempty"` - // Name - Database principal name. - Name *string `json:"name,omitempty"` - // Type - Database principal type. Possible values include: 'DatabasePrincipalTypeApp', 'DatabasePrincipalTypeGroup', 'DatabasePrincipalTypeUser' - Type DatabasePrincipalType `json:"type,omitempty"` - // Fqn - Database principal fully qualified name. - Fqn *string `json:"fqn,omitempty"` - // Email - Database principal email if exists. - Email *string `json:"email,omitempty"` - // AppID - Application id - relevant only for application principal type. - AppID *string `json:"appId,omitempty"` - // TenantName - READ-ONLY; The tenant name of the principal - TenantName *string `json:"tenantName,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabasePrincipal. -func (dp DatabasePrincipal) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.Role != "" { - objectMap["role"] = dp.Role - } - if dp.Name != nil { - objectMap["name"] = dp.Name - } - if dp.Type != "" { - objectMap["type"] = dp.Type - } - if dp.Fqn != nil { - objectMap["fqn"] = dp.Fqn - } - if dp.Email != nil { - objectMap["email"] = dp.Email - } - if dp.AppID != nil { - objectMap["appId"] = dp.AppID - } - return json.Marshal(objectMap) -} - -// DatabasePrincipalAssignment class representing a database principal assignment. -type DatabasePrincipalAssignment struct { - autorest.Response `json:"-"` - // DatabasePrincipalProperties - The database principal. - *DatabasePrincipalProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabasePrincipalAssignment. -func (dpa DatabasePrincipalAssignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dpa.DatabasePrincipalProperties != nil { - objectMap["properties"] = dpa.DatabasePrincipalProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabasePrincipalAssignment struct. -func (dpa *DatabasePrincipalAssignment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var databasePrincipalProperties DatabasePrincipalProperties - err = json.Unmarshal(*v, &databasePrincipalProperties) - if err != nil { - return err - } - dpa.DatabasePrincipalProperties = &databasePrincipalProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dpa.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dpa.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dpa.Type = &typeVar - } - } - } - - return nil -} - -// DatabasePrincipalAssignmentCheckNameRequest a principal assignment check name availability request. -type DatabasePrincipalAssignmentCheckNameRequest struct { - // Name - Principal Assignment resource name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, Microsoft.Kusto/clusters/databases/principalAssignments. - Type *string `json:"type,omitempty"` -} - -// DatabasePrincipalAssignmentListResult the list Kusto database principal assignments operation response. -type DatabasePrincipalAssignmentListResult struct { - autorest.Response `json:"-"` - // Value - The list of Kusto database principal assignments. - Value *[]DatabasePrincipalAssignment `json:"value,omitempty"` -} - -// DatabasePrincipalAssignmentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type DatabasePrincipalAssignmentsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasePrincipalAssignmentsClient) (DatabasePrincipalAssignment, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasePrincipalAssignmentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasePrincipalAssignmentsCreateOrUpdateFuture.Result. -func (future *DatabasePrincipalAssignmentsCreateOrUpdateFuture) result(client DatabasePrincipalAssignmentsClient) (dpa DatabasePrincipalAssignment, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dpa.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DatabasePrincipalAssignmentsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dpa.Response.Response, err = future.GetResult(sender); err == nil && dpa.Response.Response.StatusCode != http.StatusNoContent { - dpa, err = client.CreateOrUpdateResponder(dpa.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsCreateOrUpdateFuture", "Result", dpa.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasePrincipalAssignmentsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabasePrincipalAssignmentsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasePrincipalAssignmentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasePrincipalAssignmentsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasePrincipalAssignmentsDeleteFuture.Result. -func (future *DatabasePrincipalAssignmentsDeleteFuture) result(client DatabasePrincipalAssignmentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DatabasePrincipalAssignmentsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabasePrincipalListRequest the list Kusto database principals operation request. -type DatabasePrincipalListRequest struct { - // Value - The list of Kusto database principals. - Value *[]DatabasePrincipal `json:"value,omitempty"` -} - -// DatabasePrincipalListResult the list Kusto database principals operation response. -type DatabasePrincipalListResult struct { - autorest.Response `json:"-"` - // Value - The list of Kusto database principals. - Value *[]DatabasePrincipal `json:"value,omitempty"` -} - -// DatabasePrincipalProperties a class representing database principal property. -type DatabasePrincipalProperties struct { - // PrincipalID - The principal ID assigned to the database principal. It can be a user email, application ID, or security group name. - PrincipalID *string `json:"principalId,omitempty"` - // Role - Database principal role. Possible values include: 'DatabasePrincipalRoleAdmin', 'DatabasePrincipalRoleIngestor', 'DatabasePrincipalRoleMonitor', 'DatabasePrincipalRoleUser', 'DatabasePrincipalRoleUnrestrictedViewer', 'DatabasePrincipalRoleViewer' - Role DatabasePrincipalRole `json:"role,omitempty"` - // TenantID - The tenant id of the principal - TenantID *string `json:"tenantId,omitempty"` - // PrincipalType - Principal type. Possible values include: 'PrincipalTypeApp', 'PrincipalTypeGroup', 'PrincipalTypeUser' - PrincipalType PrincipalType `json:"principalType,omitempty"` - // TenantName - READ-ONLY; The tenant name of the principal - TenantName *string `json:"tenantName,omitempty"` - // PrincipalName - READ-ONLY; The principal name - PrincipalName *string `json:"principalName,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabasePrincipalProperties. -func (dpp DatabasePrincipalProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dpp.PrincipalID != nil { - objectMap["principalId"] = dpp.PrincipalID - } - if dpp.Role != "" { - objectMap["role"] = dpp.Role - } - if dpp.TenantID != nil { - objectMap["tenantId"] = dpp.TenantID - } - if dpp.PrincipalType != "" { - objectMap["principalType"] = dpp.PrincipalType - } - return json.Marshal(objectMap) -} - -// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (DatabaseModel, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesCreateOrUpdateFuture.Result. -func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (dm DatabaseModel, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DatabasesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dm.Response.Response, err = future.GetResult(sender); err == nil && dm.Response.Response.StatusCode != http.StatusNoContent { - dm, err = client.CreateOrUpdateResponder(dm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", dm.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesDeleteFuture.Result. -func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DatabasesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DatabaseStatistics a class that contains database statistics information. -type DatabaseStatistics struct { - // Size - The database size - the total size of compressed data and index in bytes. - Size *float64 `json:"size,omitempty"` -} - -// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (DatabaseModel, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesUpdateFuture.Result. -func (future *DatabasesUpdateFuture) result(client DatabasesClient) (dm DatabaseModel, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DatabasesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dm.Response.Response, err = future.GetResult(sender); err == nil && dm.Response.Response.StatusCode != http.StatusNoContent { - dm, err = client.UpdateResponder(dm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", dm.Response.Response, "Failure responding to request") - } - } - return -} - -// BasicDataConnection class representing an data connection. -type BasicDataConnection interface { - AsEventHubDataConnection() (*EventHubDataConnection, bool) - AsIotHubDataConnection() (*IotHubDataConnection, bool) - AsEventGridDataConnection() (*EventGridDataConnection, bool) - AsDataConnection() (*DataConnection, bool) -} - -// DataConnection class representing an data connection. -type DataConnection struct { - autorest.Response `json:"-"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Kind - Possible values include: 'KindBasicDataConnectionKindDataConnection', 'KindBasicDataConnectionKindEventHub', 'KindBasicDataConnectionKindIotHub', 'KindBasicDataConnectionKindEventGrid' - Kind KindBasicDataConnection `json:"kind,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -func unmarshalBasicDataConnection(body []byte) (BasicDataConnection, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["kind"] { - case string(KindBasicDataConnectionKindEventHub): - var ehdc EventHubDataConnection - err := json.Unmarshal(body, &ehdc) - return ehdc, err - case string(KindBasicDataConnectionKindIotHub): - var ihdc IotHubDataConnection - err := json.Unmarshal(body, &ihdc) - return ihdc, err - case string(KindBasicDataConnectionKindEventGrid): - var egdc EventGridDataConnection - err := json.Unmarshal(body, &egdc) - return egdc, err - default: - var dc DataConnection - err := json.Unmarshal(body, &dc) - return dc, err - } -} -func unmarshalBasicDataConnectionArray(body []byte) ([]BasicDataConnection, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - dcArray := make([]BasicDataConnection, len(rawMessages)) - - for index, rawMessage := range rawMessages { - dc, err := unmarshalBasicDataConnection(*rawMessage) - if err != nil { - return nil, err - } - dcArray[index] = dc - } - return dcArray, nil -} - -// MarshalJSON is the custom marshaler for DataConnection. -func (dc DataConnection) MarshalJSON() ([]byte, error) { - dc.Kind = KindBasicDataConnectionKindDataConnection - objectMap := make(map[string]interface{}) - if dc.Location != nil { - objectMap["location"] = dc.Location - } - if dc.Kind != "" { - objectMap["kind"] = dc.Kind - } - return json.Marshal(objectMap) -} - -// AsEventHubDataConnection is the BasicDataConnection implementation for DataConnection. -func (dc DataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { - return nil, false -} - -// AsIotHubDataConnection is the BasicDataConnection implementation for DataConnection. -func (dc DataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { - return nil, false -} - -// AsEventGridDataConnection is the BasicDataConnection implementation for DataConnection. -func (dc DataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { - return nil, false -} - -// AsDataConnection is the BasicDataConnection implementation for DataConnection. -func (dc DataConnection) AsDataConnection() (*DataConnection, bool) { - return &dc, true -} - -// AsBasicDataConnection is the BasicDataConnection implementation for DataConnection. -func (dc DataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { - return &dc, true -} - -// DataConnectionCheckNameRequest a data connection check name availability request. -type DataConnectionCheckNameRequest struct { - // Name - Data Connection name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, Microsoft.Kusto/clusters/databases/dataConnections. - Type *string `json:"type,omitempty"` -} - -// DataConnectionListResult the list Kusto data connections operation response. -type DataConnectionListResult struct { - autorest.Response `json:"-"` - // Value - The list of Kusto data connections. - Value *[]BasicDataConnection `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DataConnectionListResult struct. -func (dclr *DataConnectionListResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "value": - if v != nil { - value, err := unmarshalBasicDataConnectionArray(*v) - if err != nil { - return err - } - dclr.Value = &value - } - } - } - - return nil -} - -// DataConnectionModel ... -type DataConnectionModel struct { - autorest.Response `json:"-"` - Value BasicDataConnection `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DataConnectionModel struct. -func (dcm *DataConnectionModel) UnmarshalJSON(body []byte) error { - dc, err := unmarshalBasicDataConnection(body) - if err != nil { - return err - } - dcm.Value = dc - - return nil -} - -// DataConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DataConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DataConnectionsClient) (DataConnectionModel, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DataConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DataConnectionsCreateOrUpdateFuture.Result. -func (future *DataConnectionsCreateOrUpdateFuture) result(client DataConnectionsClient) (dcm DataConnectionModel, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dcm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dcm.Response.Response, err = future.GetResult(sender); err == nil && dcm.Response.Response.StatusCode != http.StatusNoContent { - dcm, err = client.CreateOrUpdateResponder(dcm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsCreateOrUpdateFuture", "Result", dcm.Response.Response, "Failure responding to request") - } - } - return -} - -// DataConnectionsDataConnectionValidationMethodFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type DataConnectionsDataConnectionValidationMethodFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DataConnectionsClient) (DataConnectionValidationListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DataConnectionsDataConnectionValidationMethodFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DataConnectionsDataConnectionValidationMethodFuture.Result. -func (future *DataConnectionsDataConnectionValidationMethodFuture) result(client DataConnectionsClient) (dcvlr DataConnectionValidationListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsDataConnectionValidationMethodFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dcvlr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsDataConnectionValidationMethodFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dcvlr.Response.Response, err = future.GetResult(sender); err == nil && dcvlr.Response.Response.StatusCode != http.StatusNoContent { - dcvlr, err = client.DataConnectionValidationMethodResponder(dcvlr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsDataConnectionValidationMethodFuture", "Result", dcvlr.Response.Response, "Failure responding to request") - } - } - return -} - -// DataConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DataConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DataConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DataConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DataConnectionsDeleteFuture.Result. -func (future *DataConnectionsDeleteFuture) result(client DataConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DataConnectionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DataConnectionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DataConnectionsClient) (DataConnectionModel, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DataConnectionsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DataConnectionsUpdateFuture.Result. -func (future *DataConnectionsUpdateFuture) result(client DataConnectionsClient) (dcm DataConnectionModel, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dcm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dcm.Response.Response, err = future.GetResult(sender); err == nil && dcm.Response.Response.StatusCode != http.StatusNoContent { - dcm, err = client.UpdateResponder(dcm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsUpdateFuture", "Result", dcm.Response.Response, "Failure responding to request") - } - } - return -} - -// DataConnectionValidation class representing an data connection validation. -type DataConnectionValidation struct { - // DataConnectionName - The name of the data connection. - DataConnectionName *string `json:"dataConnectionName,omitempty"` - // Properties - The data connection properties to validate. - Properties BasicDataConnection `json:"properties,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DataConnectionValidation struct. -func (dcv *DataConnectionValidation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "dataConnectionName": - if v != nil { - var dataConnectionName string - err = json.Unmarshal(*v, &dataConnectionName) - if err != nil { - return err - } - dcv.DataConnectionName = &dataConnectionName - } - case "properties": - if v != nil { - properties, err := unmarshalBasicDataConnection(*v) - if err != nil { - return err - } - dcv.Properties = properties - } - } - } - - return nil -} - -// DataConnectionValidationListResult the list Kusto data connection validation result. -type DataConnectionValidationListResult struct { - autorest.Response `json:"-"` - // Value - The list of Kusto data connection validation errors. - Value *[]DataConnectionValidationResult `json:"value,omitempty"` -} - -// DataConnectionValidationResult the result returned from a data connection validation request. -type DataConnectionValidationResult struct { - // ErrorMessage - A message which indicates a problem in data connection validation. - ErrorMessage *string `json:"errorMessage,omitempty"` -} - -// DiagnoseVirtualNetworkResult ... -type DiagnoseVirtualNetworkResult struct { - autorest.Response `json:"-"` - // Findings - The list of network connectivity diagnostic finding - Findings *[]string `json:"findings,omitempty"` -} - -// EndpointDependency a domain name that a service is reached at, including details of the current -// connection status. -type EndpointDependency struct { - // DomainName - The domain name of the dependency. - DomainName *string `json:"domainName,omitempty"` - // EndpointDetails - The ports used when connecting to DomainName. - EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` -} - -// EndpointDetail current TCP connectivity information from the Kusto cluster to a single endpoint. -type EndpointDetail struct { - // Port - The port an endpoint is connected to. - Port *int32 `json:"port,omitempty"` -} - -// EventGridConnectionProperties class representing the Kusto event grid connection properties. -type EventGridConnectionProperties struct { - // StorageAccountResourceID - The resource ID of the storage account where the data resides. - StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"` - // EventHubResourceID - The resource ID where the event grid is configured to send events. - EventHubResourceID *string `json:"eventHubResourceId,omitempty"` - // ConsumerGroup - The event hub consumer group. - ConsumerGroup *string `json:"consumerGroup,omitempty"` - // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. - TableName *string `json:"tableName,omitempty"` - // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. - MappingRuleName *string `json:"mappingRuleName,omitempty"` - // DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'EventGridDataFormatMULTIJSON', 'EventGridDataFormatJSON', 'EventGridDataFormatCSV', 'EventGridDataFormatTSV', 'EventGridDataFormatSCSV', 'EventGridDataFormatSOHSV', 'EventGridDataFormatPSV', 'EventGridDataFormatTXT', 'EventGridDataFormatRAW', 'EventGridDataFormatSINGLEJSON', 'EventGridDataFormatAVRO', 'EventGridDataFormatTSVE', 'EventGridDataFormatPARQUET', 'EventGridDataFormatORC', 'EventGridDataFormatAPACHEAVRO', 'EventGridDataFormatW3CLOGFILE' - DataFormat EventGridDataFormat `json:"dataFormat,omitempty"` - // IgnoreFirstRecord - A Boolean value that, if set to true, indicates that ingestion should ignore the first record of every file - IgnoreFirstRecord *bool `json:"ignoreFirstRecord,omitempty"` - // BlobStorageEventType - The name of blob storage event type to process. Possible values include: 'BlobStorageEventTypeMicrosoftStorageBlobCreated', 'BlobStorageEventTypeMicrosoftStorageBlobRenamed' - BlobStorageEventType BlobStorageEventType `json:"blobStorageEventType,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventGridConnectionProperties. -func (egcp EventGridConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if egcp.StorageAccountResourceID != nil { - objectMap["storageAccountResourceId"] = egcp.StorageAccountResourceID - } - if egcp.EventHubResourceID != nil { - objectMap["eventHubResourceId"] = egcp.EventHubResourceID - } - if egcp.ConsumerGroup != nil { - objectMap["consumerGroup"] = egcp.ConsumerGroup - } - if egcp.TableName != nil { - objectMap["tableName"] = egcp.TableName - } - if egcp.MappingRuleName != nil { - objectMap["mappingRuleName"] = egcp.MappingRuleName - } - if egcp.DataFormat != "" { - objectMap["dataFormat"] = egcp.DataFormat - } - if egcp.IgnoreFirstRecord != nil { - objectMap["ignoreFirstRecord"] = egcp.IgnoreFirstRecord - } - if egcp.BlobStorageEventType != "" { - objectMap["blobStorageEventType"] = egcp.BlobStorageEventType - } - return json.Marshal(objectMap) -} - -// EventGridDataConnection class representing an Event Grid data connection. -type EventGridDataConnection struct { - // EventGridConnectionProperties - The properties of the Event Grid data connection. - *EventGridConnectionProperties `json:"properties,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Kind - Possible values include: 'KindBasicDataConnectionKindDataConnection', 'KindBasicDataConnectionKindEventHub', 'KindBasicDataConnectionKindIotHub', 'KindBasicDataConnectionKindEventGrid' - Kind KindBasicDataConnection `json:"kind,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventGridDataConnection. -func (egdc EventGridDataConnection) MarshalJSON() ([]byte, error) { - egdc.Kind = KindBasicDataConnectionKindEventGrid - objectMap := make(map[string]interface{}) - if egdc.EventGridConnectionProperties != nil { - objectMap["properties"] = egdc.EventGridConnectionProperties - } - if egdc.Location != nil { - objectMap["location"] = egdc.Location - } - if egdc.Kind != "" { - objectMap["kind"] = egdc.Kind - } - return json.Marshal(objectMap) -} - -// AsEventHubDataConnection is the BasicDataConnection implementation for EventGridDataConnection. -func (egdc EventGridDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { - return nil, false -} - -// AsIotHubDataConnection is the BasicDataConnection implementation for EventGridDataConnection. -func (egdc EventGridDataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { - return nil, false -} - -// AsEventGridDataConnection is the BasicDataConnection implementation for EventGridDataConnection. -func (egdc EventGridDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { - return &egdc, true -} - -// AsDataConnection is the BasicDataConnection implementation for EventGridDataConnection. -func (egdc EventGridDataConnection) AsDataConnection() (*DataConnection, bool) { - return nil, false -} - -// AsBasicDataConnection is the BasicDataConnection implementation for EventGridDataConnection. -func (egdc EventGridDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { - return &egdc, true -} - -// UnmarshalJSON is the custom unmarshaler for EventGridDataConnection struct. -func (egdc *EventGridDataConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var eventGridConnectionProperties EventGridConnectionProperties - err = json.Unmarshal(*v, &eventGridConnectionProperties) - if err != nil { - return err - } - egdc.EventGridConnectionProperties = &eventGridConnectionProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - egdc.Location = &location - } - case "kind": - if v != nil { - var kind KindBasicDataConnection - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - egdc.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - egdc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - egdc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - egdc.Type = &typeVar - } - } - } - - return nil -} - -// EventHubConnectionProperties class representing the Kusto event hub connection properties. -type EventHubConnectionProperties struct { - // EventHubResourceID - The resource ID of the event hub to be used to create a data connection. - EventHubResourceID *string `json:"eventHubResourceId,omitempty"` - // ConsumerGroup - The event hub consumer group. - ConsumerGroup *string `json:"consumerGroup,omitempty"` - // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. - TableName *string `json:"tableName,omitempty"` - // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. - MappingRuleName *string `json:"mappingRuleName,omitempty"` - // DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'EventHubDataFormatMULTIJSON', 'EventHubDataFormatJSON', 'EventHubDataFormatCSV', 'EventHubDataFormatTSV', 'EventHubDataFormatSCSV', 'EventHubDataFormatSOHSV', 'EventHubDataFormatPSV', 'EventHubDataFormatTXT', 'EventHubDataFormatRAW', 'EventHubDataFormatSINGLEJSON', 'EventHubDataFormatAVRO', 'EventHubDataFormatTSVE', 'EventHubDataFormatPARQUET', 'EventHubDataFormatORC', 'EventHubDataFormatAPACHEAVRO', 'EventHubDataFormatW3CLOGFILE' - DataFormat EventHubDataFormat `json:"dataFormat,omitempty"` - // EventSystemProperties - System properties of the event hub - EventSystemProperties *[]string `json:"eventSystemProperties,omitempty"` - // Compression - The event hub messages compression type. Possible values include: 'CompressionNone', 'CompressionGZip' - Compression Compression `json:"compression,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ManagedIdentityResourceID - The resource ID of a managed identity (system or user assigned) to be used to authenticate with event hub. - ManagedIdentityResourceID *string `json:"managedIdentityResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventHubConnectionProperties. -func (ehcp EventHubConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ehcp.EventHubResourceID != nil { - objectMap["eventHubResourceId"] = ehcp.EventHubResourceID - } - if ehcp.ConsumerGroup != nil { - objectMap["consumerGroup"] = ehcp.ConsumerGroup - } - if ehcp.TableName != nil { - objectMap["tableName"] = ehcp.TableName - } - if ehcp.MappingRuleName != nil { - objectMap["mappingRuleName"] = ehcp.MappingRuleName - } - if ehcp.DataFormat != "" { - objectMap["dataFormat"] = ehcp.DataFormat - } - if ehcp.EventSystemProperties != nil { - objectMap["eventSystemProperties"] = ehcp.EventSystemProperties - } - if ehcp.Compression != "" { - objectMap["compression"] = ehcp.Compression - } - if ehcp.ManagedIdentityResourceID != nil { - objectMap["managedIdentityResourceId"] = ehcp.ManagedIdentityResourceID - } - return json.Marshal(objectMap) -} - -// EventHubDataConnection class representing an event hub data connection. -type EventHubDataConnection struct { - // EventHubConnectionProperties - The Event Hub data connection properties to validate. - *EventHubConnectionProperties `json:"properties,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Kind - Possible values include: 'KindBasicDataConnectionKindDataConnection', 'KindBasicDataConnectionKindEventHub', 'KindBasicDataConnectionKindIotHub', 'KindBasicDataConnectionKindEventGrid' - Kind KindBasicDataConnection `json:"kind,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventHubDataConnection. -func (ehdc EventHubDataConnection) MarshalJSON() ([]byte, error) { - ehdc.Kind = KindBasicDataConnectionKindEventHub - objectMap := make(map[string]interface{}) - if ehdc.EventHubConnectionProperties != nil { - objectMap["properties"] = ehdc.EventHubConnectionProperties - } - if ehdc.Location != nil { - objectMap["location"] = ehdc.Location - } - if ehdc.Kind != "" { - objectMap["kind"] = ehdc.Kind - } - return json.Marshal(objectMap) -} - -// AsEventHubDataConnection is the BasicDataConnection implementation for EventHubDataConnection. -func (ehdc EventHubDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { - return &ehdc, true -} - -// AsIotHubDataConnection is the BasicDataConnection implementation for EventHubDataConnection. -func (ehdc EventHubDataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { - return nil, false -} - -// AsEventGridDataConnection is the BasicDataConnection implementation for EventHubDataConnection. -func (ehdc EventHubDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { - return nil, false -} - -// AsDataConnection is the BasicDataConnection implementation for EventHubDataConnection. -func (ehdc EventHubDataConnection) AsDataConnection() (*DataConnection, bool) { - return nil, false -} - -// AsBasicDataConnection is the BasicDataConnection implementation for EventHubDataConnection. -func (ehdc EventHubDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { - return &ehdc, true -} - -// UnmarshalJSON is the custom unmarshaler for EventHubDataConnection struct. -func (ehdc *EventHubDataConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var eventHubConnectionProperties EventHubConnectionProperties - err = json.Unmarshal(*v, &eventHubConnectionProperties) - if err != nil { - return err - } - ehdc.EventHubConnectionProperties = &eventHubConnectionProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ehdc.Location = &location - } - case "kind": - if v != nil { - var kind KindBasicDataConnection - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ehdc.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ehdc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ehdc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ehdc.Type = &typeVar - } - } - } - - return nil -} - -// FollowerDatabaseDefinition a class representing follower database request. -type FollowerDatabaseDefinition struct { - // ClusterResourceID - Resource id of the cluster that follows a database owned by this cluster. - ClusterResourceID *string `json:"clusterResourceId,omitempty"` - // AttachedDatabaseConfigurationName - Resource name of the attached database configuration in the follower cluster. - AttachedDatabaseConfigurationName *string `json:"attachedDatabaseConfigurationName,omitempty"` - // DatabaseName - READ-ONLY; The database name owned by this cluster that was followed. * in case following all databases. - DatabaseName *string `json:"databaseName,omitempty"` -} - -// MarshalJSON is the custom marshaler for FollowerDatabaseDefinition. -func (fdd FollowerDatabaseDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fdd.ClusterResourceID != nil { - objectMap["clusterResourceId"] = fdd.ClusterResourceID - } - if fdd.AttachedDatabaseConfigurationName != nil { - objectMap["attachedDatabaseConfigurationName"] = fdd.AttachedDatabaseConfigurationName - } - return json.Marshal(objectMap) -} - -// FollowerDatabaseListResult the list Kusto database principals operation response. -type FollowerDatabaseListResult struct { - autorest.Response `json:"-"` - // Value - The list of follower database result. - Value *[]FollowerDatabaseDefinition `json:"value,omitempty"` -} - -// Identity identity for the resource. -type Identity struct { - // PrincipalID - READ-ONLY; The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove all identities. Possible values include: 'IdentityTypeNone', 'IdentityTypeSystemAssigned', 'IdentityTypeUserAssigned', 'IdentityTypeSystemAssignedUserAssigned' - Type IdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The list of user identities associated with the Kusto cluster. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*IdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if i.Type != "" { - objectMap["type"] = i.Type - } - if i.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = i.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// IdentityUserAssignedIdentitiesValue ... -type IdentityUserAssignedIdentitiesValue struct { - // PrincipalID - READ-ONLY; The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - READ-ONLY; The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for IdentityUserAssignedIdentitiesValue. -func (iAiv IdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IotHubConnectionProperties class representing the Kusto Iot hub connection properties. -type IotHubConnectionProperties struct { - // IotHubResourceID - The resource ID of the Iot hub to be used to create a data connection. - IotHubResourceID *string `json:"iotHubResourceId,omitempty"` - // ConsumerGroup - The iot hub consumer group. - ConsumerGroup *string `json:"consumerGroup,omitempty"` - // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. - TableName *string `json:"tableName,omitempty"` - // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. - MappingRuleName *string `json:"mappingRuleName,omitempty"` - // DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'IotHubDataFormatMULTIJSON', 'IotHubDataFormatJSON', 'IotHubDataFormatCSV', 'IotHubDataFormatTSV', 'IotHubDataFormatSCSV', 'IotHubDataFormatSOHSV', 'IotHubDataFormatPSV', 'IotHubDataFormatTXT', 'IotHubDataFormatRAW', 'IotHubDataFormatSINGLEJSON', 'IotHubDataFormatAVRO', 'IotHubDataFormatTSVE', 'IotHubDataFormatPARQUET', 'IotHubDataFormatORC', 'IotHubDataFormatAPACHEAVRO', 'IotHubDataFormatW3CLOGFILE' - DataFormat IotHubDataFormat `json:"dataFormat,omitempty"` - // EventSystemProperties - System properties of the iot hub - EventSystemProperties *[]string `json:"eventSystemProperties,omitempty"` - // SharedAccessPolicyName - The name of the share access policy - SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for IotHubConnectionProperties. -func (ihcp IotHubConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ihcp.IotHubResourceID != nil { - objectMap["iotHubResourceId"] = ihcp.IotHubResourceID - } - if ihcp.ConsumerGroup != nil { - objectMap["consumerGroup"] = ihcp.ConsumerGroup - } - if ihcp.TableName != nil { - objectMap["tableName"] = ihcp.TableName - } - if ihcp.MappingRuleName != nil { - objectMap["mappingRuleName"] = ihcp.MappingRuleName - } - if ihcp.DataFormat != "" { - objectMap["dataFormat"] = ihcp.DataFormat - } - if ihcp.EventSystemProperties != nil { - objectMap["eventSystemProperties"] = ihcp.EventSystemProperties - } - if ihcp.SharedAccessPolicyName != nil { - objectMap["sharedAccessPolicyName"] = ihcp.SharedAccessPolicyName - } - return json.Marshal(objectMap) -} - -// IotHubDataConnection class representing an iot hub data connection. -type IotHubDataConnection struct { - // IotHubConnectionProperties - The Iot Hub data connection properties. - *IotHubConnectionProperties `json:"properties,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Kind - Possible values include: 'KindBasicDataConnectionKindDataConnection', 'KindBasicDataConnectionKindEventHub', 'KindBasicDataConnectionKindIotHub', 'KindBasicDataConnectionKindEventGrid' - Kind KindBasicDataConnection `json:"kind,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IotHubDataConnection. -func (ihdc IotHubDataConnection) MarshalJSON() ([]byte, error) { - ihdc.Kind = KindBasicDataConnectionKindIotHub - objectMap := make(map[string]interface{}) - if ihdc.IotHubConnectionProperties != nil { - objectMap["properties"] = ihdc.IotHubConnectionProperties - } - if ihdc.Location != nil { - objectMap["location"] = ihdc.Location - } - if ihdc.Kind != "" { - objectMap["kind"] = ihdc.Kind - } - return json.Marshal(objectMap) -} - -// AsEventHubDataConnection is the BasicDataConnection implementation for IotHubDataConnection. -func (ihdc IotHubDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { - return nil, false -} - -// AsIotHubDataConnection is the BasicDataConnection implementation for IotHubDataConnection. -func (ihdc IotHubDataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { - return &ihdc, true -} - -// AsEventGridDataConnection is the BasicDataConnection implementation for IotHubDataConnection. -func (ihdc IotHubDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { - return nil, false -} - -// AsDataConnection is the BasicDataConnection implementation for IotHubDataConnection. -func (ihdc IotHubDataConnection) AsDataConnection() (*DataConnection, bool) { - return nil, false -} - -// AsBasicDataConnection is the BasicDataConnection implementation for IotHubDataConnection. -func (ihdc IotHubDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { - return &ihdc, true -} - -// UnmarshalJSON is the custom unmarshaler for IotHubDataConnection struct. -func (ihdc *IotHubDataConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var iotHubConnectionProperties IotHubConnectionProperties - err = json.Unmarshal(*v, &iotHubConnectionProperties) - if err != nil { - return err - } - ihdc.IotHubConnectionProperties = &iotHubConnectionProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ihdc.Location = &location - } - case "kind": - if v != nil { - var kind KindBasicDataConnection - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ihdc.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ihdc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ihdc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ihdc.Type = &typeVar - } - } - } - - return nil -} - -// KeyVaultProperties properties of the key vault. -type KeyVaultProperties struct { - // KeyName - The name of the key vault key. - KeyName *string `json:"keyName,omitempty"` - // KeyVersion - The version of the key vault key. - KeyVersion *string `json:"keyVersion,omitempty"` - // KeyVaultURI - The Uri of the key vault. - KeyVaultURI *string `json:"keyVaultUri,omitempty"` - // UserIdentity - The user assigned identity (ARM resource id) that has access to the key. - UserIdentity *string `json:"userIdentity,omitempty"` -} - -// LanguageExtension the language extension object. -type LanguageExtension struct { - // LanguageExtensionName - The language extension name. Possible values include: 'LanguageExtensionNamePYTHON', 'LanguageExtensionNameR' - LanguageExtensionName LanguageExtensionName `json:"languageExtensionName,omitempty"` -} - -// LanguageExtensionsList the list of language extension objects. -type LanguageExtensionsList struct { - autorest.Response `json:"-"` - // Value - The list of language extensions. - Value *[]LanguageExtension `json:"value,omitempty"` -} - -// ListResourceSkusResult list of available SKUs for a Kusto Cluster. -type ListResourceSkusResult struct { - autorest.Response `json:"-"` - // Value - The collection of available SKUs for an existing resource. - Value *[]AzureResourceSku `json:"value,omitempty"` -} - -// ManagedPrivateEndpoint class representing a managed private endpoint. -type ManagedPrivateEndpoint struct { - autorest.Response `json:"-"` - // ManagedPrivateEndpointProperties - A managed private endpoint. - *ManagedPrivateEndpointProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedPrivateEndpoint. -func (mpe ManagedPrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mpe.ManagedPrivateEndpointProperties != nil { - objectMap["properties"] = mpe.ManagedPrivateEndpointProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedPrivateEndpoint struct. -func (mpe *ManagedPrivateEndpoint) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var managedPrivateEndpointProperties ManagedPrivateEndpointProperties - err = json.Unmarshal(*v, &managedPrivateEndpointProperties) - if err != nil { - return err - } - mpe.ManagedPrivateEndpointProperties = &managedPrivateEndpointProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - mpe.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mpe.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mpe.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mpe.Type = &typeVar - } - } - } - - return nil -} - -// ManagedPrivateEndpointListResult the list managed private endpoints operation response. -type ManagedPrivateEndpointListResult struct { - autorest.Response `json:"-"` - // Value - The list of managed private endpoints. - Value *[]ManagedPrivateEndpoint `json:"value,omitempty"` -} - -// ManagedPrivateEndpointProperties a class representing the properties of a managed private endpoint -// object. -type ManagedPrivateEndpointProperties struct { - // PrivateLinkResourceID - The ARM resource ID of the resource for which the managed private endpoint is created. - PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` - // PrivateLinkResourceRegion - The region of the resource to which the managed private endpoint is created. - PrivateLinkResourceRegion *string `json:"privateLinkResourceRegion,omitempty"` - // GroupID - The groupId in which the managed private endpoint is created. - GroupID *string `json:"groupId,omitempty"` - // RequestMessage - The user request message. - RequestMessage *string `json:"requestMessage,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedPrivateEndpointProperties. -func (mpep ManagedPrivateEndpointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mpep.PrivateLinkResourceID != nil { - objectMap["privateLinkResourceId"] = mpep.PrivateLinkResourceID - } - if mpep.PrivateLinkResourceRegion != nil { - objectMap["privateLinkResourceRegion"] = mpep.PrivateLinkResourceRegion - } - if mpep.GroupID != nil { - objectMap["groupId"] = mpep.GroupID - } - if mpep.RequestMessage != nil { - objectMap["requestMessage"] = mpep.RequestMessage - } - return json.Marshal(objectMap) -} - -// ManagedPrivateEndpointsCheckNameRequest the result returned from a managedPrivateEndpoints check name -// availability request. -type ManagedPrivateEndpointsCheckNameRequest struct { - // Name - Managed private endpoint resource name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, for instance Microsoft.Kusto/clusters/managedPrivateEndpoints. - Type *string `json:"type,omitempty"` -} - -// ManagedPrivateEndpointsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type ManagedPrivateEndpointsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedPrivateEndpointsClient) (ManagedPrivateEndpoint, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedPrivateEndpointsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedPrivateEndpointsCreateOrUpdateFuture.Result. -func (future *ManagedPrivateEndpointsCreateOrUpdateFuture) result(client ManagedPrivateEndpointsClient) (mpe ManagedPrivateEndpoint, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mpe.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ManagedPrivateEndpointsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mpe.Response.Response, err = future.GetResult(sender); err == nil && mpe.Response.Response.StatusCode != http.StatusNoContent { - mpe, err = client.CreateOrUpdateResponder(mpe.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsCreateOrUpdateFuture", "Result", mpe.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedPrivateEndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedPrivateEndpointsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedPrivateEndpointsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedPrivateEndpointsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedPrivateEndpointsDeleteFuture.Result. -func (future *ManagedPrivateEndpointsDeleteFuture) result(client ManagedPrivateEndpointsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ManagedPrivateEndpointsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedPrivateEndpointsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedPrivateEndpointsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedPrivateEndpointsClient) (ManagedPrivateEndpoint, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedPrivateEndpointsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedPrivateEndpointsUpdateFuture.Result. -func (future *ManagedPrivateEndpointsUpdateFuture) result(client ManagedPrivateEndpointsClient) (mpe ManagedPrivateEndpoint, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mpe.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ManagedPrivateEndpointsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mpe.Response.Response, err = future.GetResult(sender); err == nil && mpe.Response.Response.StatusCode != http.StatusNoContent { - mpe, err = client.UpdateResponder(mpe.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsUpdateFuture", "Result", mpe.Response.Response, "Failure responding to request") - } - } - return -} - -// Operation ... -type Operation struct { - // Name - This is of the format {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` - Origin *string `json:"origin,omitempty"` - Properties interface{} `json:"properties,omitempty"` -} - -// OperationDisplay ... -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - // Operation - For example: read, write, delete. - Operation *string `json:"operation,omitempty"` - Resource *string `json:"resource,omitempty"` - Description *string `json:"description,omitempty"` -} - -// OperationListResult ... -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// OperationResult operation Result Entity. -type OperationResult struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Status - status of the Operation result. Possible values include: 'StatusSucceeded', 'StatusCanceled', 'StatusFailed', 'StatusRunning' - Status Status `json:"status,omitempty"` - // StartTime - The operation start time - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - The operation end time - EndTime *date.Time `json:"endTime,omitempty"` - // PercentComplete - Percentage completed. - PercentComplete *float64 `json:"percentComplete,omitempty"` - // OperationResultProperties - Properties of the operation results - *OperationResultProperties `json:"properties,omitempty"` - // OperationResultErrorProperties - Object that contains the error code and message if the operation failed. - *OperationResultErrorProperties `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationResult. -func (or OperationResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if or.Status != "" { - objectMap["status"] = or.Status - } - if or.StartTime != nil { - objectMap["startTime"] = or.StartTime - } - if or.EndTime != nil { - objectMap["endTime"] = or.EndTime - } - if or.PercentComplete != nil { - objectMap["percentComplete"] = or.PercentComplete - } - if or.OperationResultProperties != nil { - objectMap["properties"] = or.OperationResultProperties - } - if or.OperationResultErrorProperties != nil { - objectMap["error"] = or.OperationResultErrorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationResult struct. -func (or *OperationResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - or.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - or.Name = &name - } - case "status": - if v != nil { - var status Status - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - or.Status = status - } - case "startTime": - if v != nil { - var startTime date.Time - err = json.Unmarshal(*v, &startTime) - if err != nil { - return err - } - or.StartTime = &startTime - } - case "endTime": - if v != nil { - var endTime date.Time - err = json.Unmarshal(*v, &endTime) - if err != nil { - return err - } - or.EndTime = &endTime - } - case "percentComplete": - if v != nil { - var percentComplete float64 - err = json.Unmarshal(*v, &percentComplete) - if err != nil { - return err - } - or.PercentComplete = &percentComplete - } - case "properties": - if v != nil { - var operationResultProperties OperationResultProperties - err = json.Unmarshal(*v, &operationResultProperties) - if err != nil { - return err - } - or.OperationResultProperties = &operationResultProperties - } - case "error": - if v != nil { - var operationResultErrorProperties OperationResultErrorProperties - err = json.Unmarshal(*v, &operationResultErrorProperties) - if err != nil { - return err - } - or.OperationResultErrorProperties = &operationResultErrorProperties - } - } - } - - return nil -} - -// OperationResultErrorProperties operation result error properties -type OperationResultErrorProperties struct { - // Code - The code of the error. - Code *string `json:"code,omitempty"` - // Message - The error message. - Message *string `json:"message,omitempty"` -} - -// OperationResultProperties operation result properties -type OperationResultProperties struct { - // OperationKind - The kind of the operation. - OperationKind *string `json:"operationKind,omitempty"` - // OperationState - The state of the operation. - OperationState *string `json:"operationState,omitempty"` -} - -// OptimizedAutoscale a class that contains the optimized auto scale definition. -type OptimizedAutoscale struct { - // Version - The version of the template defined, for instance 1. - Version *int32 `json:"version,omitempty"` - // IsEnabled - A boolean value that indicate if the optimized autoscale feature is enabled or not. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Minimum - Minimum allowed instances count. - Minimum *int32 `json:"minimum,omitempty"` - // Maximum - Maximum allowed instances count. - Maximum *int32 `json:"maximum,omitempty"` -} - -// OutboundNetworkDependenciesEndpoint endpoints accessed for a common purpose that the Kusto Service -// Environment requires outbound network access to. -type OutboundNetworkDependenciesEndpoint struct { - // OutboundNetworkDependenciesEndpointProperties - The outbound environment endpoint properties. - *OutboundNetworkDependenciesEndpointProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for OutboundNetworkDependenciesEndpoint. -func (onde OutboundNetworkDependenciesEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if onde.OutboundNetworkDependenciesEndpointProperties != nil { - objectMap["properties"] = onde.OutboundNetworkDependenciesEndpointProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OutboundNetworkDependenciesEndpoint struct. -func (onde *OutboundNetworkDependenciesEndpoint) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var outboundNetworkDependenciesEndpointProperties OutboundNetworkDependenciesEndpointProperties - err = json.Unmarshal(*v, &outboundNetworkDependenciesEndpointProperties) - if err != nil { - return err - } - onde.OutboundNetworkDependenciesEndpointProperties = &outboundNetworkDependenciesEndpointProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - onde.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - onde.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - onde.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - onde.Type = &typeVar - } - } - } - - return nil -} - -// OutboundNetworkDependenciesEndpointListResult collection of Outbound Environment Endpoints -type OutboundNetworkDependenciesEndpointListResult struct { - autorest.Response `json:"-"` - // Value - Collection of resources. - Value *[]OutboundNetworkDependenciesEndpoint `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to next page of resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OutboundNetworkDependenciesEndpointListResult. -func (ondelr OutboundNetworkDependenciesEndpointListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ondelr.Value != nil { - objectMap["value"] = ondelr.Value - } - return json.Marshal(objectMap) -} - -// OutboundNetworkDependenciesEndpointListResultIterator provides access to a complete listing of -// OutboundNetworkDependenciesEndpoint values. -type OutboundNetworkDependenciesEndpointListResultIterator struct { - i int - page OutboundNetworkDependenciesEndpointListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OutboundNetworkDependenciesEndpointListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OutboundNetworkDependenciesEndpointListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OutboundNetworkDependenciesEndpointListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OutboundNetworkDependenciesEndpointListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OutboundNetworkDependenciesEndpointListResultIterator) Response() OutboundNetworkDependenciesEndpointListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OutboundNetworkDependenciesEndpointListResultIterator) Value() OutboundNetworkDependenciesEndpoint { - if !iter.page.NotDone() { - return OutboundNetworkDependenciesEndpoint{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OutboundNetworkDependenciesEndpointListResultIterator type. -func NewOutboundNetworkDependenciesEndpointListResultIterator(page OutboundNetworkDependenciesEndpointListResultPage) OutboundNetworkDependenciesEndpointListResultIterator { - return OutboundNetworkDependenciesEndpointListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ondelr OutboundNetworkDependenciesEndpointListResult) IsEmpty() bool { - return ondelr.Value == nil || len(*ondelr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ondelr OutboundNetworkDependenciesEndpointListResult) hasNextLink() bool { - return ondelr.NextLink != nil && len(*ondelr.NextLink) != 0 -} - -// outboundNetworkDependenciesEndpointListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ondelr OutboundNetworkDependenciesEndpointListResult) outboundNetworkDependenciesEndpointListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ondelr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ondelr.NextLink))) -} - -// OutboundNetworkDependenciesEndpointListResultPage contains a page of OutboundNetworkDependenciesEndpoint -// values. -type OutboundNetworkDependenciesEndpointListResultPage struct { - fn func(context.Context, OutboundNetworkDependenciesEndpointListResult) (OutboundNetworkDependenciesEndpointListResult, error) - ondelr OutboundNetworkDependenciesEndpointListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OutboundNetworkDependenciesEndpointListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OutboundNetworkDependenciesEndpointListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ondelr) - if err != nil { - return err - } - page.ondelr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OutboundNetworkDependenciesEndpointListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OutboundNetworkDependenciesEndpointListResultPage) NotDone() bool { - return !page.ondelr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OutboundNetworkDependenciesEndpointListResultPage) Response() OutboundNetworkDependenciesEndpointListResult { - return page.ondelr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OutboundNetworkDependenciesEndpointListResultPage) Values() []OutboundNetworkDependenciesEndpoint { - if page.ondelr.IsEmpty() { - return nil - } - return *page.ondelr.Value -} - -// Creates a new instance of the OutboundNetworkDependenciesEndpointListResultPage type. -func NewOutboundNetworkDependenciesEndpointListResultPage(cur OutboundNetworkDependenciesEndpointListResult, getNextPage func(context.Context, OutboundNetworkDependenciesEndpointListResult) (OutboundNetworkDependenciesEndpointListResult, error)) OutboundNetworkDependenciesEndpointListResultPage { - return OutboundNetworkDependenciesEndpointListResultPage{ - fn: getNextPage, - ondelr: cur, - } -} - -// OutboundNetworkDependenciesEndpointProperties endpoints accessed for a common purpose that the Kusto -// Service Environment requires outbound network access to. -type OutboundNetworkDependenciesEndpointProperties struct { - // Category - The type of service accessed by the Kusto Service Environment, e.g., Azure Storage, Azure SQL Database, and Azure Active Directory. - Category *string `json:"category,omitempty"` - // Endpoints - The endpoints that the Kusto Service Environment reaches the service at. - Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for OutboundNetworkDependenciesEndpointProperties. -func (ondep OutboundNetworkDependenciesEndpointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ondep.Category != nil { - objectMap["category"] = ondep.Category - } - if ondep.Endpoints != nil { - objectMap["endpoints"] = ondep.Endpoints - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - pec.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - READ-ONLY; Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // GroupID - READ-ONLY; Group id of the private endpoint. - GroupID *string `json:"groupId,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the private endpoint. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. -func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.PrivateEndpointConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointProperty private endpoint which the connection belongs to. -type PrivateEndpointProperty struct { - // ID - READ-ONLY; Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointProperty. -func (pep PrivateEndpointProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.PrivateLinkResourceProperties != nil { - objectMap["properties"] = plr.PrivateLinkResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. -func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - plr.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY; The private link resource required zone names. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionStateProperty connection State of the Private Endpoint Connection. -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; Any action that is required beyond basic workflow (approve/ reject/ disconnect) - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != nil { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ReadOnlyFollowingDatabase class representing a read only following database. -type ReadOnlyFollowingDatabase struct { - // ReadOnlyFollowingDatabaseProperties - The database properties. - *ReadOnlyFollowingDatabaseProperties `json:"properties,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyFollowing' - Kind Kind `json:"kind,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReadOnlyFollowingDatabase. -func (rofd ReadOnlyFollowingDatabase) MarshalJSON() ([]byte, error) { - rofd.Kind = KindReadOnlyFollowing - objectMap := make(map[string]interface{}) - if rofd.ReadOnlyFollowingDatabaseProperties != nil { - objectMap["properties"] = rofd.ReadOnlyFollowingDatabaseProperties - } - if rofd.Location != nil { - objectMap["location"] = rofd.Location - } - if rofd.Kind != "" { - objectMap["kind"] = rofd.Kind - } - return json.Marshal(objectMap) -} - -// AsReadWriteDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. -func (rofd ReadOnlyFollowingDatabase) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { - return nil, false -} - -// AsReadOnlyFollowingDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. -func (rofd ReadOnlyFollowingDatabase) AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) { - return &rofd, true -} - -// AsDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. -func (rofd ReadOnlyFollowingDatabase) AsDatabase() (*Database, bool) { - return nil, false -} - -// AsBasicDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. -func (rofd ReadOnlyFollowingDatabase) AsBasicDatabase() (BasicDatabase, bool) { - return &rofd, true -} - -// UnmarshalJSON is the custom unmarshaler for ReadOnlyFollowingDatabase struct. -func (rofd *ReadOnlyFollowingDatabase) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var readOnlyFollowingDatabaseProperties ReadOnlyFollowingDatabaseProperties - err = json.Unmarshal(*v, &readOnlyFollowingDatabaseProperties) - if err != nil { - return err - } - rofd.ReadOnlyFollowingDatabaseProperties = &readOnlyFollowingDatabaseProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rofd.Location = &location - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - rofd.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rofd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rofd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rofd.Type = &typeVar - } - } - } - - return nil -} - -// ReadOnlyFollowingDatabaseProperties class representing the Kusto database properties. -type ReadOnlyFollowingDatabaseProperties struct { - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // SoftDeletePeriod - READ-ONLY; The time the data should be kept before it stops being accessible to queries in TimeSpan. - SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` - // HotCachePeriod - The time the data should be kept in cache for fast queries in TimeSpan. - HotCachePeriod *string `json:"hotCachePeriod,omitempty"` - // Statistics - The statistics of the database. - Statistics *DatabaseStatistics `json:"statistics,omitempty"` - // LeaderClusterResourceID - READ-ONLY; The name of the leader cluster - LeaderClusterResourceID *string `json:"leaderClusterResourceId,omitempty"` - // AttachedDatabaseConfigurationName - READ-ONLY; The name of the attached database configuration cluster - AttachedDatabaseConfigurationName *string `json:"attachedDatabaseConfigurationName,omitempty"` - // PrincipalsModificationKind - READ-ONLY; The principals modification kind of the database. Possible values include: 'PrincipalsModificationKindUnion', 'PrincipalsModificationKindReplace', 'PrincipalsModificationKindNone' - PrincipalsModificationKind PrincipalsModificationKind `json:"principalsModificationKind,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReadOnlyFollowingDatabaseProperties. -func (rofdp ReadOnlyFollowingDatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rofdp.HotCachePeriod != nil { - objectMap["hotCachePeriod"] = rofdp.HotCachePeriod - } - if rofdp.Statistics != nil { - objectMap["statistics"] = rofdp.Statistics - } - return json.Marshal(objectMap) -} - -// ReadWriteDatabase class representing a read write database. -type ReadWriteDatabase struct { - // ReadWriteDatabaseProperties - The database properties. - *ReadWriteDatabaseProperties `json:"properties,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyFollowing' - Kind Kind `json:"kind,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReadWriteDatabase. -func (rwd ReadWriteDatabase) MarshalJSON() ([]byte, error) { - rwd.Kind = KindReadWrite - objectMap := make(map[string]interface{}) - if rwd.ReadWriteDatabaseProperties != nil { - objectMap["properties"] = rwd.ReadWriteDatabaseProperties - } - if rwd.Location != nil { - objectMap["location"] = rwd.Location - } - if rwd.Kind != "" { - objectMap["kind"] = rwd.Kind - } - return json.Marshal(objectMap) -} - -// AsReadWriteDatabase is the BasicDatabase implementation for ReadWriteDatabase. -func (rwd ReadWriteDatabase) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { - return &rwd, true -} - -// AsReadOnlyFollowingDatabase is the BasicDatabase implementation for ReadWriteDatabase. -func (rwd ReadWriteDatabase) AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) { - return nil, false -} - -// AsDatabase is the BasicDatabase implementation for ReadWriteDatabase. -func (rwd ReadWriteDatabase) AsDatabase() (*Database, bool) { - return nil, false -} - -// AsBasicDatabase is the BasicDatabase implementation for ReadWriteDatabase. -func (rwd ReadWriteDatabase) AsBasicDatabase() (BasicDatabase, bool) { - return &rwd, true -} - -// UnmarshalJSON is the custom unmarshaler for ReadWriteDatabase struct. -func (rwd *ReadWriteDatabase) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var readWriteDatabaseProperties ReadWriteDatabaseProperties - err = json.Unmarshal(*v, &readWriteDatabaseProperties) - if err != nil { - return err - } - rwd.ReadWriteDatabaseProperties = &readWriteDatabaseProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rwd.Location = &location - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - rwd.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rwd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rwd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rwd.Type = &typeVar - } - } - } - - return nil -} - -// ReadWriteDatabaseProperties class representing the Kusto database properties. -type ReadWriteDatabaseProperties struct { - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // SoftDeletePeriod - The time the data should be kept before it stops being accessible to queries in TimeSpan. - SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` - // HotCachePeriod - The time the data should be kept in cache for fast queries in TimeSpan. - HotCachePeriod *string `json:"hotCachePeriod,omitempty"` - // Statistics - The statistics of the database. - Statistics *DatabaseStatistics `json:"statistics,omitempty"` - // IsFollowed - READ-ONLY; Indicates whether the database is followed. - IsFollowed *bool `json:"isFollowed,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReadWriteDatabaseProperties. -func (rwdp ReadWriteDatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rwdp.SoftDeletePeriod != nil { - objectMap["softDeletePeriod"] = rwdp.SoftDeletePeriod - } - if rwdp.HotCachePeriod != nil { - objectMap["hotCachePeriod"] = rwdp.HotCachePeriod - } - if rwdp.Statistics != nil { - objectMap["statistics"] = rwdp.Statistics - } - return json.Marshal(objectMap) -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Script class representing a database script. -type Script struct { - autorest.Response `json:"-"` - // ScriptProperties - The database script. - *ScriptProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Script. -func (s Script) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.ScriptProperties != nil { - objectMap["properties"] = s.ScriptProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Script struct. -func (s *Script) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var scriptProperties ScriptProperties - err = json.Unmarshal(*v, &scriptProperties) - if err != nil { - return err - } - s.ScriptProperties = &scriptProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - s.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - s.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - s.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - s.Type = &typeVar - } - } - } - - return nil -} - -// ScriptCheckNameRequest a script name availability request. -type ScriptCheckNameRequest struct { - // Name - Script name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, Microsoft.Kusto/clusters/databases/scripts. - Type *string `json:"type,omitempty"` -} - -// ScriptListResult the list Kusto database script operation response. -type ScriptListResult struct { - autorest.Response `json:"-"` - // Value - The list of Kusto scripts. - Value *[]Script `json:"value,omitempty"` -} - -// ScriptProperties a class representing database script property. -type ScriptProperties struct { - // ScriptURL - The url to the KQL script blob file. - ScriptURL *string `json:"scriptUrl,omitempty"` - // ScriptURLSasToken - The SaS token. - ScriptURLSasToken *string `json:"scriptUrlSasToken,omitempty"` - // ForceUpdateTag - A unique string. If changed the script will be applied again. - ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` - // ContinueOnErrors - Flag that indicates whether to continue if one of the command fails. - ContinueOnErrors *bool `json:"continueOnErrors,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScriptProperties. -func (sp ScriptProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.ScriptURL != nil { - objectMap["scriptUrl"] = sp.ScriptURL - } - if sp.ScriptURLSasToken != nil { - objectMap["scriptUrlSasToken"] = sp.ScriptURLSasToken - } - if sp.ForceUpdateTag != nil { - objectMap["forceUpdateTag"] = sp.ForceUpdateTag - } - if sp.ContinueOnErrors != nil { - objectMap["continueOnErrors"] = sp.ContinueOnErrors - } - return json.Marshal(objectMap) -} - -// ScriptsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ScriptsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ScriptsClient) (Script, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ScriptsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ScriptsCreateOrUpdateFuture.Result. -func (future *ScriptsCreateOrUpdateFuture) result(client ScriptsClient) (s Script, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ScriptsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.CreateOrUpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ScriptsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ScriptsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ScriptsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ScriptsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ScriptsDeleteFuture.Result. -func (future *ScriptsDeleteFuture) result(client ScriptsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ScriptsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ScriptsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ScriptsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ScriptsClient) (Script, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ScriptsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ScriptsUpdateFuture.Result. -func (future *ScriptsUpdateFuture) result(client ScriptsClient) (s Script, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ScriptsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.UpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// SkuDescription the Kusto SKU description of given resource type -type SkuDescription struct { - // ResourceType - READ-ONLY; The resource type - ResourceType *string `json:"resourceType,omitempty"` - // Name - READ-ONLY; The name of the SKU - Name *string `json:"name,omitempty"` - // Tier - READ-ONLY; The tier of the SKU - Tier *string `json:"tier,omitempty"` - // Locations - READ-ONLY; The set of locations that the SKU is available - Locations *[]string `json:"locations,omitempty"` - // LocationInfo - READ-ONLY; Locations and zones - LocationInfo *[]SkuLocationInfoItem `json:"locationInfo,omitempty"` - // Restrictions - READ-ONLY; The restrictions because of which SKU cannot be used - Restrictions *[]interface{} `json:"restrictions,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkuDescription. -func (sd SkuDescription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SkuDescriptionList the list of the EngagementFabric SKU descriptions -type SkuDescriptionList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; SKU descriptions - Value *[]SkuDescription `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkuDescriptionList. -func (sdl SkuDescriptionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SkuLocationInfoItem the locations and zones info for SKU. -type SkuLocationInfoItem struct { - // Location - The available location of the SKU. - Location *string `json:"location,omitempty"` - // Zones - The available zone of the SKU. - Zones *[]string `json:"zones,omitempty"` -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TableLevelSharingProperties tables that will be included and excluded in the follower database -type TableLevelSharingProperties struct { - // TablesToInclude - List of tables to include in the follower database - TablesToInclude *[]string `json:"tablesToInclude,omitempty"` - // TablesToExclude - List of tables to exclude from the follower database - TablesToExclude *[]string `json:"tablesToExclude,omitempty"` - // ExternalTablesToInclude - List of external tables to include in the follower database - ExternalTablesToInclude *[]string `json:"externalTablesToInclude,omitempty"` - // ExternalTablesToExclude - List of external tables exclude from the follower database - ExternalTablesToExclude *[]string `json:"externalTablesToExclude,omitempty"` - // MaterializedViewsToInclude - List of materialized views to include in the follower database - MaterializedViewsToInclude *[]string `json:"materializedViewsToInclude,omitempty"` - // MaterializedViewsToExclude - List of materialized views exclude from the follower database - MaterializedViewsToExclude *[]string `json:"materializedViewsToExclude,omitempty"` -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// TrustedExternalTenant represents a tenant ID that is trusted by the cluster. -type TrustedExternalTenant struct { - // Value - GUID representing an external tenant. - Value *string `json:"value,omitempty"` -} - -// VirtualNetworkConfiguration a class that contains virtual network definition. -type VirtualNetworkConfiguration struct { - // SubnetID - The subnet resource id. - SubnetID *string `json:"subnetId,omitempty"` - // EnginePublicIPID - Engine service's public IP address resource id. - EnginePublicIPID *string `json:"enginePublicIpId,omitempty"` - // DataManagementPublicIPID - Data management's service public IP address resource id. - DataManagementPublicIPID *string `json:"dataManagementPublicIpId,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/operations.go deleted file mode 100644 index e174a83bd3c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/operations.go +++ /dev/null @@ -1,142 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the the Azure Kusto management API provides a RESTful set of web services that interact with -// Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and delete -// clusters and databases. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists available operations for the Microsoft.Kusto provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Kusto/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "kusto.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "kusto.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/privateendpointconnections.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/privateendpointconnections.go deleted file mode 100644 index ac2d90ac627..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/privateendpointconnections.go +++ /dev/null @@ -1,360 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionsClient is the the Azure Kusto management API provides a RESTful set of web services that -// interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and -// delete clusters and databases. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("kusto.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns the list of private endpoint connections. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/privatelinkresources.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/privatelinkresources.go deleted file mode 100644 index 887b2a4205a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/privatelinkresources.go +++ /dev/null @@ -1,188 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the the Azure Kusto management API provides a RESTful set of web services that -// interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and -// delete clusters and databases. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a private link resource. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// privateLinkResourceName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, privateLinkResourceName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, privateLinkResourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, privateLinkResourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "privateLinkResourceName": autorest.Encode("path", privateLinkResourceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) GetResponder(resp *http.Response) (result PrivateLinkResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns the list of private link resources. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result PrivateLinkResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.PrivateLinkResourcesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-08-27" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/version.go deleted file mode 100644 index cd02dad786e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package kusto - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " kusto/2021-08-27" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/CHANGELOG.md similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication/CHANGELOG.md rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/CHANGELOG.md diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/_meta.json new file mode 100644 index 00000000000..e28978dd44b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "bb4175d29020cfff55f1d9087c2a5a89765067dc", + "readme": "/_/azure-rest-api-specs/specification/azure-kusto/resource-manager/readme.md", + "tag": "package-2022-02", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2022-02 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/azure-kusto/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/attacheddatabaseconfigurations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/attacheddatabaseconfigurations.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/attacheddatabaseconfigurations.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/attacheddatabaseconfigurations.go index af9da01d788..68745276e27 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/attacheddatabaseconfigurations.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/attacheddatabaseconfigurations.go @@ -88,7 +88,7 @@ func (client AttachedDatabaseConfigurationsClient) CheckNameAvailabilityPreparer "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -171,7 +171,7 @@ func (client AttachedDatabaseConfigurationsClient) CreateOrUpdatePreparer(ctx co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -254,7 +254,7 @@ func (client AttachedDatabaseConfigurationsClient) DeletePreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -341,7 +341,7 @@ func (client AttachedDatabaseConfigurationsClient) GetPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -417,7 +417,7 @@ func (client AttachedDatabaseConfigurationsClient) ListByClusterPreparer(ctx con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/client.go new file mode 100644 index 00000000000..50a48b7ef37 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/client.go @@ -0,0 +1,42 @@ +// Package kusto implements the Azure ARM Kusto service API version 2022-02-01. +// +// The Azure Kusto management API provides a RESTful set of web services that interact with Azure Kusto services to +// manage your clusters and databases. The API enables you to create, update, and delete clusters and databases. +package kusto + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Kusto + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Kusto. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/clusterprincipalassignments.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/clusterprincipalassignments.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/clusterprincipalassignments.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/clusterprincipalassignments.go index 30661bbda56..e50bc79d604 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/clusterprincipalassignments.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/clusterprincipalassignments.go @@ -87,7 +87,7 @@ func (client ClusterPrincipalAssignmentsClient) CheckNameAvailabilityPreparer(ct "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -168,7 +168,7 @@ func (client ClusterPrincipalAssignmentsClient) CreateOrUpdatePreparer(ctx conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -251,7 +251,7 @@ func (client ClusterPrincipalAssignmentsClient) DeletePreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -338,7 +338,7 @@ func (client ClusterPrincipalAssignmentsClient) GetPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -414,7 +414,7 @@ func (client ClusterPrincipalAssignmentsClient) ListPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/clusters.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/clusters.go new file mode 100644 index 00000000000..6dcc304845c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/clusters.go @@ -0,0 +1,1525 @@ +package kusto + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ClustersClient is the the Azure Kusto management API provides a RESTful set of web services that interact with Azure +// Kusto services to manage your clusters and databases. The API enables you to create, update, and delete clusters and +// databases. +type ClustersClient struct { + BaseClient +} + +// NewClustersClient creates an instance of the ClustersClient client. +func NewClustersClient(subscriptionID string) ClustersClient { + return NewClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClustersClientWithBaseURI creates an instance of the ClustersClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { + return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// AddLanguageExtensions add a list of language extensions that can run within KQL queries. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// languageExtensionsToAdd - the language extensions to add. +func (client ClustersClient) AddLanguageExtensions(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToAdd LanguageExtensionsList) (result ClustersAddLanguageExtensionsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.AddLanguageExtensions") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddLanguageExtensionsPreparer(ctx, resourceGroupName, clusterName, languageExtensionsToAdd) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "AddLanguageExtensions", nil, "Failure preparing request") + return + } + + result, err = client.AddLanguageExtensionsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "AddLanguageExtensions", result.Response(), "Failure sending request") + return + } + + return +} + +// AddLanguageExtensionsPreparer prepares the AddLanguageExtensions request. +func (client ClustersClient) AddLanguageExtensionsPreparer(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToAdd LanguageExtensionsList) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/addLanguageExtensions", pathParameters), + autorest.WithJSON(languageExtensionsToAdd), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddLanguageExtensionsSender sends the AddLanguageExtensions request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) AddLanguageExtensionsSender(req *http.Request) (future ClustersAddLanguageExtensionsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// AddLanguageExtensionsResponder handles the response to the AddLanguageExtensions request. The method always +// closes the http.Response Body. +func (client ClustersClient) AddLanguageExtensionsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CheckNameAvailability checks that the cluster name is valid and is not already in use. +// Parameters: +// location - azure location (region) name. +// clusterName - the name of the cluster. +func (client ClustersClient) CheckNameAvailability(ctx context.Context, location string, clusterName ClusterCheckNameRequest) (result CheckNameResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: clusterName, + Constraints: []validation.Constraint{{Target: "clusterName.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "clusterName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("kusto.ClustersClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, location, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client ClustersClient) CheckNameAvailabilityPreparer(ctx context.Context, location string, clusterName ClusterCheckNameRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/checkNameAvailability", pathParameters), + autorest.WithJSON(clusterName), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client ClustersClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate create or update a Kusto cluster. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// parameters - the Kusto cluster parameters supplied to the CreateOrUpdate operation. +// ifMatch - the ETag of the cluster. Omit this value to always overwrite the current cluster. Specify the +// last-seen ETag value to prevent accidentally overwriting concurrent changes. +// ifNoneMatch - set to '*' to allow a new cluster to be created, but to prevent updating an existing cluster. +// Other values will result in a 412 Pre-condition Failed response. +func (client ClustersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, ifMatch string, ifNoneMatch string) (result ClustersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.OptimizedAutoscale", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.OptimizedAutoscale.Version", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.OptimizedAutoscale.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.OptimizedAutoscale.Minimum", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.OptimizedAutoscale.Maximum", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "parameters.ClusterProperties.VirtualNetworkConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.VirtualNetworkConfiguration.SubnetID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.VirtualNetworkConfiguration.EnginePublicIPID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.VirtualNetworkConfiguration.DataManagementPublicIPID", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("kusto.ClustersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, parameters, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) CreateOrUpdateSender(req *http.Request) (future ClustersCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ClustersClient) CreateOrUpdateResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a Kusto cluster. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client ClustersClient) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result ClustersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) DeleteSender(req *http.Request) (future ClustersDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DetachFollowerDatabases detaches all followers of a database owned by this cluster. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// followerDatabaseToRemove - the follower databases properties to remove. +func (client ClustersClient) DetachFollowerDatabases(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove FollowerDatabaseDefinition) (result ClustersDetachFollowerDatabasesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.DetachFollowerDatabases") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: followerDatabaseToRemove, + Constraints: []validation.Constraint{{Target: "followerDatabaseToRemove.ClusterResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "followerDatabaseToRemove.AttachedDatabaseConfigurationName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("kusto.ClustersClient", "DetachFollowerDatabases", err.Error()) + } + + req, err := client.DetachFollowerDatabasesPreparer(ctx, resourceGroupName, clusterName, followerDatabaseToRemove) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DetachFollowerDatabases", nil, "Failure preparing request") + return + } + + result, err = client.DetachFollowerDatabasesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DetachFollowerDatabases", result.Response(), "Failure sending request") + return + } + + return +} + +// DetachFollowerDatabasesPreparer prepares the DetachFollowerDatabases request. +func (client ClustersClient) DetachFollowerDatabasesPreparer(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove FollowerDatabaseDefinition) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + followerDatabaseToRemove.DatabaseName = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/detachFollowerDatabases", pathParameters), + autorest.WithJSON(followerDatabaseToRemove), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetachFollowerDatabasesSender sends the DetachFollowerDatabases request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) DetachFollowerDatabasesSender(req *http.Request) (future ClustersDetachFollowerDatabasesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DetachFollowerDatabasesResponder handles the response to the DetachFollowerDatabases request. The method always +// closes the http.Response Body. +func (client ClustersClient) DetachFollowerDatabasesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DiagnoseVirtualNetwork diagnoses network connectivity status for external resources on which the service is +// dependent on. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client ClustersClient) DiagnoseVirtualNetwork(ctx context.Context, resourceGroupName string, clusterName string) (result ClustersDiagnoseVirtualNetworkFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.DiagnoseVirtualNetwork") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DiagnoseVirtualNetworkPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DiagnoseVirtualNetwork", nil, "Failure preparing request") + return + } + + result, err = client.DiagnoseVirtualNetworkSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DiagnoseVirtualNetwork", result.Response(), "Failure sending request") + return + } + + return +} + +// DiagnoseVirtualNetworkPreparer prepares the DiagnoseVirtualNetwork request. +func (client ClustersClient) DiagnoseVirtualNetworkPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/diagnoseVirtualNetwork", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DiagnoseVirtualNetworkSender sends the DiagnoseVirtualNetwork request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) DiagnoseVirtualNetworkSender(req *http.Request) (future ClustersDiagnoseVirtualNetworkFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DiagnoseVirtualNetworkResponder handles the response to the DiagnoseVirtualNetwork request. The method always +// closes the http.Response Body. +func (client ClustersClient) DiagnoseVirtualNetworkResponder(resp *http.Response) (result DiagnoseVirtualNetworkResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a Kusto cluster. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string) (result Cluster, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ClustersClient) GetResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all Kusto clusters within a subscription. +func (client ClustersClient) List(ctx context.Context) (result ClusterListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/clusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListResponder(resp *http.Response) (result ClusterListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup lists all Kusto clusters within a resource group. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +func (client ClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ClusterListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ClustersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListFollowerDatabases returns a list of databases that are owned by this cluster and were followed by another +// cluster. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client ClustersClient) ListFollowerDatabases(ctx context.Context, resourceGroupName string, clusterName string) (result FollowerDatabaseListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListFollowerDatabases") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListFollowerDatabasesPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListFollowerDatabases", nil, "Failure preparing request") + return + } + + resp, err := client.ListFollowerDatabasesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListFollowerDatabases", resp, "Failure sending request") + return + } + + result, err = client.ListFollowerDatabasesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListFollowerDatabases", resp, "Failure responding to request") + return + } + + return +} + +// ListFollowerDatabasesPreparer prepares the ListFollowerDatabases request. +func (client ClustersClient) ListFollowerDatabasesPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listFollowerDatabases", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListFollowerDatabasesSender sends the ListFollowerDatabases request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListFollowerDatabasesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListFollowerDatabasesResponder handles the response to the ListFollowerDatabases request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListFollowerDatabasesResponder(resp *http.Response) (result FollowerDatabaseListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListLanguageExtensions returns a list of language extensions that can run within KQL queries. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client ClustersClient) ListLanguageExtensions(ctx context.Context, resourceGroupName string, clusterName string) (result LanguageExtensionsList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListLanguageExtensions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListLanguageExtensionsPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListLanguageExtensions", nil, "Failure preparing request") + return + } + + resp, err := client.ListLanguageExtensionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListLanguageExtensions", resp, "Failure sending request") + return + } + + result, err = client.ListLanguageExtensionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListLanguageExtensions", resp, "Failure responding to request") + return + } + + return +} + +// ListLanguageExtensionsPreparer prepares the ListLanguageExtensions request. +func (client ClustersClient) ListLanguageExtensionsPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listLanguageExtensions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListLanguageExtensionsSender sends the ListLanguageExtensions request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListLanguageExtensionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListLanguageExtensionsResponder handles the response to the ListLanguageExtensions request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListLanguageExtensionsResponder(resp *http.Response) (result LanguageExtensionsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListOutboundNetworkDependenciesEndpoints gets the network endpoints of all outbound dependencies of a Kusto cluster +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client ClustersClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, clusterName string) (result OutboundNetworkDependenciesEndpointListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListOutboundNetworkDependenciesEndpoints") + defer func() { + sc := -1 + if result.ondelr.Response.Response != nil { + sc = result.ondelr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listOutboundNetworkDependenciesEndpointsNextResults + req, err := client.ListOutboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.ondelr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure sending request") + return + } + + result.ondelr, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure responding to request") + return + } + if result.ondelr.hasNextLink() && result.ondelr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListOutboundNetworkDependenciesEndpointsPreparer prepares the ListOutboundNetworkDependenciesEndpoints request. +func (client ClustersClient) ListOutboundNetworkDependenciesEndpointsPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/outboundNetworkDependenciesEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListOutboundNetworkDependenciesEndpointsSender sends the ListOutboundNetworkDependenciesEndpoints request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListOutboundNetworkDependenciesEndpointsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListOutboundNetworkDependenciesEndpointsResponder handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListOutboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result OutboundNetworkDependenciesEndpointListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listOutboundNetworkDependenciesEndpointsNextResults retrieves the next set of results, if any. +func (client ClustersClient) listOutboundNetworkDependenciesEndpointsNextResults(ctx context.Context, lastResults OutboundNetworkDependenciesEndpointListResult) (result OutboundNetworkDependenciesEndpointListResult, err error) { + req, err := lastResults.outboundNetworkDependenciesEndpointListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kusto.ClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kusto.ClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListOutboundNetworkDependenciesEndpointsComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClustersClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, resourceGroupName string, clusterName string) (result OutboundNetworkDependenciesEndpointListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListOutboundNetworkDependenciesEndpoints") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListOutboundNetworkDependenciesEndpoints(ctx, resourceGroupName, clusterName) + return +} + +// ListSkus lists eligible SKUs for Kusto resource provider. +func (client ClustersClient) ListSkus(ctx context.Context) (result SkuDescriptionList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListSkus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSkusPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkus", resp, "Failure sending request") + return + } + + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkus", resp, "Failure responding to request") + return + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client ClustersClient) ListSkusPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSkusSender sends the ListSkus request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListSkusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSkusResponder handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListSkusResponder(resp *http.Response) (result SkuDescriptionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSkusByResource returns the SKUs available for the provided resource. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client ClustersClient) ListSkusByResource(ctx context.Context, resourceGroupName string, clusterName string) (result ListResourceSkusResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListSkusByResource") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSkusByResourcePreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkusByResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusByResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkusByResource", resp, "Failure sending request") + return + } + + result, err = client.ListSkusByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkusByResource", resp, "Failure responding to request") + return + } + + return +} + +// ListSkusByResourcePreparer prepares the ListSkusByResource request. +func (client ClustersClient) ListSkusByResourcePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSkusByResourceSender sends the ListSkusByResource request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListSkusByResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSkusByResourceResponder handles the response to the ListSkusByResource request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListSkusByResourceResponder(resp *http.Response) (result ListResourceSkusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RemoveLanguageExtensions remove a list of language extensions that can run within KQL queries. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// languageExtensionsToRemove - the language extensions to remove. +func (client ClustersClient) RemoveLanguageExtensions(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToRemove LanguageExtensionsList) (result ClustersRemoveLanguageExtensionsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.RemoveLanguageExtensions") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RemoveLanguageExtensionsPreparer(ctx, resourceGroupName, clusterName, languageExtensionsToRemove) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "RemoveLanguageExtensions", nil, "Failure preparing request") + return + } + + result, err = client.RemoveLanguageExtensionsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "RemoveLanguageExtensions", result.Response(), "Failure sending request") + return + } + + return +} + +// RemoveLanguageExtensionsPreparer prepares the RemoveLanguageExtensions request. +func (client ClustersClient) RemoveLanguageExtensionsPreparer(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToRemove LanguageExtensionsList) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/removeLanguageExtensions", pathParameters), + autorest.WithJSON(languageExtensionsToRemove), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RemoveLanguageExtensionsSender sends the RemoveLanguageExtensions request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) RemoveLanguageExtensionsSender(req *http.Request) (future ClustersRemoveLanguageExtensionsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RemoveLanguageExtensionsResponder handles the response to the RemoveLanguageExtensions request. The method always +// closes the http.Response Body. +func (client ClustersClient) RemoveLanguageExtensionsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Start starts a Kusto cluster. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client ClustersClient) Start(ctx context.Context, resourceGroupName string, clusterName string) (result ClustersStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Start") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client ClustersClient) StartPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) StartSender(req *http.Request) (future ClustersStartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client ClustersClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stops a Kusto cluster. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client ClustersClient) Stop(ctx context.Context, resourceGroupName string, clusterName string) (result ClustersStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Stop") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StopPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client ClustersClient) StopPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) StopSender(req *http.Request) (future ClustersStopFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client ClustersClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update update a Kusto cluster. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// parameters - the Kusto cluster parameters supplied to the Update operation. +// ifMatch - the ETag of the cluster. Omit this value to always overwrite the current cluster. Specify the +// last-seen ETag value to prevent accidentally overwriting concurrent changes. +func (client ClustersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, ifMatch string) (result ClustersUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, parameters, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) UpdateSender(req *http.Request) (future ClustersUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/databaseprincipalassignments.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/databaseprincipalassignments.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/databaseprincipalassignments.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/databaseprincipalassignments.go index c1371fcd4d6..c0dffb18354 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/databaseprincipalassignments.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/databaseprincipalassignments.go @@ -89,7 +89,7 @@ func (client DatabasePrincipalAssignmentsClient) CheckNameAvailabilityPreparer(c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -172,7 +172,7 @@ func (client DatabasePrincipalAssignmentsClient) CreateOrUpdatePreparer(ctx cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -257,7 +257,7 @@ func (client DatabasePrincipalAssignmentsClient) DeletePreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -346,7 +346,7 @@ func (client DatabasePrincipalAssignmentsClient) GetPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -424,7 +424,7 @@ func (client DatabasePrincipalAssignmentsClient) ListPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/databases.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/databases.go new file mode 100644 index 00000000000..c4aea594710 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/databases.go @@ -0,0 +1,761 @@ +package kusto + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DatabasesClient is the the Azure Kusto management API provides a RESTful set of web services that interact with +// Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and delete +// clusters and databases. +type DatabasesClient struct { + BaseClient +} + +// NewDatabasesClient creates an instance of the DatabasesClient client. +func NewDatabasesClient(subscriptionID string) DatabasesClient { + return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { + return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// AddPrincipals add Database principals permissions. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// databaseName - the name of the database in the Kusto cluster. +// databasePrincipalsToAdd - list of database principals to add. +func (client DatabasesClient) AddPrincipals(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToAdd DatabasePrincipalListRequest) (result DatabasePrincipalListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.AddPrincipals") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddPrincipalsPreparer(ctx, resourceGroupName, clusterName, databaseName, databasePrincipalsToAdd) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "AddPrincipals", nil, "Failure preparing request") + return + } + + resp, err := client.AddPrincipalsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "AddPrincipals", resp, "Failure sending request") + return + } + + result, err = client.AddPrincipalsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "AddPrincipals", resp, "Failure responding to request") + return + } + + return +} + +// AddPrincipalsPreparer prepares the AddPrincipals request. +func (client DatabasesClient) AddPrincipalsPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToAdd DatabasePrincipalListRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/addPrincipals", pathParameters), + autorest.WithJSON(databasePrincipalsToAdd), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddPrincipalsSender sends the AddPrincipals request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) AddPrincipalsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// AddPrincipalsResponder handles the response to the AddPrincipals request. The method always +// closes the http.Response Body. +func (client DatabasesClient) AddPrincipalsResponder(resp *http.Response) (result DatabasePrincipalListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CheckNameAvailability checks that the databases resource name is valid and is not already in use. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// resourceName - the name of the resource. +func (client DatabasesClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, resourceName CheckNameRequest) (result CheckNameResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("kusto.DatabasesClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, clusterName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client DatabasesClient) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, clusterName string, resourceName CheckNameRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkNameAvailability", pathParameters), + autorest.WithJSON(resourceName), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client DatabasesClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates a database. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// databaseName - the name of the database in the Kusto cluster. +// parameters - the database parameters supplied to the CreateOrUpdate operation. +func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (result DatabasesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, databaseName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) CreateOrUpdateSender(req *http.Request) (future DatabasesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the database with the given name. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// databaseName - the name of the database in the Kusto cluster. +func (client DatabasesClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result DatabasesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) DeleteSender(req *http.Request) (future DatabasesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns a database. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// databaseName - the name of the database in the Kusto cluster. +func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result DatabaseModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DatabasesClient) GetResponder(resp *http.Response) (result DatabaseModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByCluster returns the list of databases of the given Kusto cluster. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client DatabasesClient) ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result DatabaseListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByCluster") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByClusterPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListByCluster", nil, "Failure preparing request") + return + } + + resp, err := client.ListByClusterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListByCluster", resp, "Failure sending request") + return + } + + result, err = client.ListByClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListByCluster", resp, "Failure responding to request") + return + } + + return +} + +// ListByClusterPreparer prepares the ListByCluster request. +func (client DatabasesClient) ListByClusterPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByClusterSender sends the ListByCluster request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) ListByClusterSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByClusterResponder handles the response to the ListByCluster request. The method always +// closes the http.Response Body. +func (client DatabasesClient) ListByClusterResponder(resp *http.Response) (result DatabaseListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPrincipals returns a list of database principals of the given Kusto cluster and database. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// databaseName - the name of the database in the Kusto cluster. +func (client DatabasesClient) ListPrincipals(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result DatabasePrincipalListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListPrincipals") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPrincipalsPreparer(ctx, resourceGroupName, clusterName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListPrincipals", nil, "Failure preparing request") + return + } + + resp, err := client.ListPrincipalsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListPrincipals", resp, "Failure sending request") + return + } + + result, err = client.ListPrincipalsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListPrincipals", resp, "Failure responding to request") + return + } + + return +} + +// ListPrincipalsPreparer prepares the ListPrincipals request. +func (client DatabasesClient) ListPrincipalsPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/listPrincipals", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPrincipalsSender sends the ListPrincipals request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) ListPrincipalsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListPrincipalsResponder handles the response to the ListPrincipals request. The method always +// closes the http.Response Body. +func (client DatabasesClient) ListPrincipalsResponder(resp *http.Response) (result DatabasePrincipalListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RemovePrincipals remove Database principals permissions. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// databaseName - the name of the database in the Kusto cluster. +// databasePrincipalsToRemove - list of database principals to remove. +func (client DatabasesClient) RemovePrincipals(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToRemove DatabasePrincipalListRequest) (result DatabasePrincipalListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.RemovePrincipals") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RemovePrincipalsPreparer(ctx, resourceGroupName, clusterName, databaseName, databasePrincipalsToRemove) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "RemovePrincipals", nil, "Failure preparing request") + return + } + + resp, err := client.RemovePrincipalsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "RemovePrincipals", resp, "Failure sending request") + return + } + + result, err = client.RemovePrincipalsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "RemovePrincipals", resp, "Failure responding to request") + return + } + + return +} + +// RemovePrincipalsPreparer prepares the RemovePrincipals request. +func (client DatabasesClient) RemovePrincipalsPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToRemove DatabasePrincipalListRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/removePrincipals", pathParameters), + autorest.WithJSON(databasePrincipalsToRemove), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RemovePrincipalsSender sends the RemovePrincipals request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) RemovePrincipalsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RemovePrincipalsResponder handles the response to the RemovePrincipals request. The method always +// closes the http.Response Body. +func (client DatabasesClient) RemovePrincipalsResponder(resp *http.Response) (result DatabasePrincipalListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a database. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// databaseName - the name of the database in the Kusto cluster. +// parameters - the database parameters supplied to the Update operation. +func (client DatabasesClient) Update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (result DatabasesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, databaseName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasesClient) UpdateSender(req *http.Request) (future DatabasesUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DatabasesClient) UpdateResponder(resp *http.Response) (result DatabaseModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/dataconnections.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/dataconnections.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/dataconnections.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/dataconnections.go index eac77967d8f..eb2f1a06795 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/dataconnections.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/dataconnections.go @@ -88,7 +88,7 @@ func (client DataConnectionsClient) CheckNameAvailabilityPreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -164,7 +164,7 @@ func (client DataConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -248,7 +248,7 @@ func (client DataConnectionsClient) DataConnectionValidationMethodPreparer(ctx c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -333,7 +333,7 @@ func (client DataConnectionsClient) DeletePreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -422,7 +422,7 @@ func (client DataConnectionsClient) GetPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -500,7 +500,7 @@ func (client DataConnectionsClient) ListByDatabasePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -574,7 +574,7 @@ func (client DataConnectionsClient) UpdatePreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/enums.go new file mode 100644 index 00000000000..f746200224e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/enums.go @@ -0,0 +1,668 @@ +package kusto + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AzureScaleType enumerates the values for azure scale type. +type AzureScaleType string + +const ( + // AzureScaleTypeAutomatic ... + AzureScaleTypeAutomatic AzureScaleType = "automatic" + // AzureScaleTypeManual ... + AzureScaleTypeManual AzureScaleType = "manual" + // AzureScaleTypeNone ... + AzureScaleTypeNone AzureScaleType = "none" +) + +// PossibleAzureScaleTypeValues returns an array of possible values for the AzureScaleType const type. +func PossibleAzureScaleTypeValues() []AzureScaleType { + return []AzureScaleType{AzureScaleTypeAutomatic, AzureScaleTypeManual, AzureScaleTypeNone} +} + +// AzureSkuName enumerates the values for azure sku name. +type AzureSkuName string + +const ( + // AzureSkuNameDevNoSLAStandardD11V2 ... + AzureSkuNameDevNoSLAStandardD11V2 AzureSkuName = "Dev(No SLA)_Standard_D11_v2" + // AzureSkuNameDevNoSLAStandardE2aV4 ... + AzureSkuNameDevNoSLAStandardE2aV4 AzureSkuName = "Dev(No SLA)_Standard_E2a_v4" + // AzureSkuNameStandardD11V2 ... + AzureSkuNameStandardD11V2 AzureSkuName = "Standard_D11_v2" + // AzureSkuNameStandardD12V2 ... + AzureSkuNameStandardD12V2 AzureSkuName = "Standard_D12_v2" + // AzureSkuNameStandardD13V2 ... + AzureSkuNameStandardD13V2 AzureSkuName = "Standard_D13_v2" + // AzureSkuNameStandardD14V2 ... + AzureSkuNameStandardD14V2 AzureSkuName = "Standard_D14_v2" + // AzureSkuNameStandardD16dV5 ... + AzureSkuNameStandardD16dV5 AzureSkuName = "Standard_D16d_v5" + // AzureSkuNameStandardD32dV4 ... + AzureSkuNameStandardD32dV4 AzureSkuName = "Standard_D32d_v4" + // AzureSkuNameStandardD32dV5 ... + AzureSkuNameStandardD32dV5 AzureSkuName = "Standard_D32d_v5" + // AzureSkuNameStandardDS13V21TBPS ... + AzureSkuNameStandardDS13V21TBPS AzureSkuName = "Standard_DS13_v2+1TB_PS" + // AzureSkuNameStandardDS13V22TBPS ... + AzureSkuNameStandardDS13V22TBPS AzureSkuName = "Standard_DS13_v2+2TB_PS" + // AzureSkuNameStandardDS14V23TBPS ... + AzureSkuNameStandardDS14V23TBPS AzureSkuName = "Standard_DS14_v2+3TB_PS" + // AzureSkuNameStandardDS14V24TBPS ... + AzureSkuNameStandardDS14V24TBPS AzureSkuName = "Standard_DS14_v2+4TB_PS" + // AzureSkuNameStandardE16adsV5 ... + AzureSkuNameStandardE16adsV5 AzureSkuName = "Standard_E16ads_v5" + // AzureSkuNameStandardE16asV43TBPS ... + AzureSkuNameStandardE16asV43TBPS AzureSkuName = "Standard_E16as_v4+3TB_PS" + // AzureSkuNameStandardE16asV44TBPS ... + AzureSkuNameStandardE16asV44TBPS AzureSkuName = "Standard_E16as_v4+4TB_PS" + // AzureSkuNameStandardE16asV53TBPS ... + AzureSkuNameStandardE16asV53TBPS AzureSkuName = "Standard_E16as_v5+3TB_PS" + // AzureSkuNameStandardE16asV54TBPS ... + AzureSkuNameStandardE16asV54TBPS AzureSkuName = "Standard_E16as_v5+4TB_PS" + // AzureSkuNameStandardE16aV4 ... + AzureSkuNameStandardE16aV4 AzureSkuName = "Standard_E16a_v4" + // AzureSkuNameStandardE16sV43TBPS ... + AzureSkuNameStandardE16sV43TBPS AzureSkuName = "Standard_E16s_v4+3TB_PS" + // AzureSkuNameStandardE16sV44TBPS ... + AzureSkuNameStandardE16sV44TBPS AzureSkuName = "Standard_E16s_v4+4TB_PS" + // AzureSkuNameStandardE16sV53TBPS ... + AzureSkuNameStandardE16sV53TBPS AzureSkuName = "Standard_E16s_v5+3TB_PS" + // AzureSkuNameStandardE16sV54TBPS ... + AzureSkuNameStandardE16sV54TBPS AzureSkuName = "Standard_E16s_v5+4TB_PS" + // AzureSkuNameStandardE2adsV5 ... + AzureSkuNameStandardE2adsV5 AzureSkuName = "Standard_E2ads_v5" + // AzureSkuNameStandardE2aV4 ... + AzureSkuNameStandardE2aV4 AzureSkuName = "Standard_E2a_v4" + // AzureSkuNameStandardE4adsV5 ... + AzureSkuNameStandardE4adsV5 AzureSkuName = "Standard_E4ads_v5" + // AzureSkuNameStandardE4aV4 ... + AzureSkuNameStandardE4aV4 AzureSkuName = "Standard_E4a_v4" + // AzureSkuNameStandardE64iV3 ... + AzureSkuNameStandardE64iV3 AzureSkuName = "Standard_E64i_v3" + // AzureSkuNameStandardE80idsV4 ... + AzureSkuNameStandardE80idsV4 AzureSkuName = "Standard_E80ids_v4" + // AzureSkuNameStandardE8adsV5 ... + AzureSkuNameStandardE8adsV5 AzureSkuName = "Standard_E8ads_v5" + // AzureSkuNameStandardE8asV41TBPS ... + AzureSkuNameStandardE8asV41TBPS AzureSkuName = "Standard_E8as_v4+1TB_PS" + // AzureSkuNameStandardE8asV42TBPS ... + AzureSkuNameStandardE8asV42TBPS AzureSkuName = "Standard_E8as_v4+2TB_PS" + // AzureSkuNameStandardE8asV51TBPS ... + AzureSkuNameStandardE8asV51TBPS AzureSkuName = "Standard_E8as_v5+1TB_PS" + // AzureSkuNameStandardE8asV52TBPS ... + AzureSkuNameStandardE8asV52TBPS AzureSkuName = "Standard_E8as_v5+2TB_PS" + // AzureSkuNameStandardE8aV4 ... + AzureSkuNameStandardE8aV4 AzureSkuName = "Standard_E8a_v4" + // AzureSkuNameStandardE8sV41TBPS ... + AzureSkuNameStandardE8sV41TBPS AzureSkuName = "Standard_E8s_v4+1TB_PS" + // AzureSkuNameStandardE8sV42TBPS ... + AzureSkuNameStandardE8sV42TBPS AzureSkuName = "Standard_E8s_v4+2TB_PS" + // AzureSkuNameStandardE8sV51TBPS ... + AzureSkuNameStandardE8sV51TBPS AzureSkuName = "Standard_E8s_v5+1TB_PS" + // AzureSkuNameStandardE8sV52TBPS ... + AzureSkuNameStandardE8sV52TBPS AzureSkuName = "Standard_E8s_v5+2TB_PS" + // AzureSkuNameStandardL16s ... + AzureSkuNameStandardL16s AzureSkuName = "Standard_L16s" + // AzureSkuNameStandardL16sV2 ... + AzureSkuNameStandardL16sV2 AzureSkuName = "Standard_L16s_v2" + // AzureSkuNameStandardL4s ... + AzureSkuNameStandardL4s AzureSkuName = "Standard_L4s" + // AzureSkuNameStandardL8s ... + AzureSkuNameStandardL8s AzureSkuName = "Standard_L8s" + // AzureSkuNameStandardL8sV2 ... + AzureSkuNameStandardL8sV2 AzureSkuName = "Standard_L8s_v2" +) + +// PossibleAzureSkuNameValues returns an array of possible values for the AzureSkuName const type. +func PossibleAzureSkuNameValues() []AzureSkuName { + return []AzureSkuName{AzureSkuNameDevNoSLAStandardD11V2, AzureSkuNameDevNoSLAStandardE2aV4, AzureSkuNameStandardD11V2, AzureSkuNameStandardD12V2, AzureSkuNameStandardD13V2, AzureSkuNameStandardD14V2, AzureSkuNameStandardD16dV5, AzureSkuNameStandardD32dV4, AzureSkuNameStandardD32dV5, AzureSkuNameStandardDS13V21TBPS, AzureSkuNameStandardDS13V22TBPS, AzureSkuNameStandardDS14V23TBPS, AzureSkuNameStandardDS14V24TBPS, AzureSkuNameStandardE16adsV5, AzureSkuNameStandardE16asV43TBPS, AzureSkuNameStandardE16asV44TBPS, AzureSkuNameStandardE16asV53TBPS, AzureSkuNameStandardE16asV54TBPS, AzureSkuNameStandardE16aV4, AzureSkuNameStandardE16sV43TBPS, AzureSkuNameStandardE16sV44TBPS, AzureSkuNameStandardE16sV53TBPS, AzureSkuNameStandardE16sV54TBPS, AzureSkuNameStandardE2adsV5, AzureSkuNameStandardE2aV4, AzureSkuNameStandardE4adsV5, AzureSkuNameStandardE4aV4, AzureSkuNameStandardE64iV3, AzureSkuNameStandardE80idsV4, AzureSkuNameStandardE8adsV5, AzureSkuNameStandardE8asV41TBPS, AzureSkuNameStandardE8asV42TBPS, AzureSkuNameStandardE8asV51TBPS, AzureSkuNameStandardE8asV52TBPS, AzureSkuNameStandardE8aV4, AzureSkuNameStandardE8sV41TBPS, AzureSkuNameStandardE8sV42TBPS, AzureSkuNameStandardE8sV51TBPS, AzureSkuNameStandardE8sV52TBPS, AzureSkuNameStandardL16s, AzureSkuNameStandardL16sV2, AzureSkuNameStandardL4s, AzureSkuNameStandardL8s, AzureSkuNameStandardL8sV2} +} + +// AzureSkuTier enumerates the values for azure sku tier. +type AzureSkuTier string + +const ( + // AzureSkuTierBasic ... + AzureSkuTierBasic AzureSkuTier = "Basic" + // AzureSkuTierStandard ... + AzureSkuTierStandard AzureSkuTier = "Standard" +) + +// PossibleAzureSkuTierValues returns an array of possible values for the AzureSkuTier const type. +func PossibleAzureSkuTierValues() []AzureSkuTier { + return []AzureSkuTier{AzureSkuTierBasic, AzureSkuTierStandard} +} + +// BlobStorageEventType enumerates the values for blob storage event type. +type BlobStorageEventType string + +const ( + // BlobStorageEventTypeMicrosoftStorageBlobCreated ... + BlobStorageEventTypeMicrosoftStorageBlobCreated BlobStorageEventType = "Microsoft.Storage.BlobCreated" + // BlobStorageEventTypeMicrosoftStorageBlobRenamed ... + BlobStorageEventTypeMicrosoftStorageBlobRenamed BlobStorageEventType = "Microsoft.Storage.BlobRenamed" +) + +// PossibleBlobStorageEventTypeValues returns an array of possible values for the BlobStorageEventType const type. +func PossibleBlobStorageEventTypeValues() []BlobStorageEventType { + return []BlobStorageEventType{BlobStorageEventTypeMicrosoftStorageBlobCreated, BlobStorageEventTypeMicrosoftStorageBlobRenamed} +} + +// ClusterNetworkAccessFlag enumerates the values for cluster network access flag. +type ClusterNetworkAccessFlag string + +const ( + // ClusterNetworkAccessFlagDisabled ... + ClusterNetworkAccessFlagDisabled ClusterNetworkAccessFlag = "Disabled" + // ClusterNetworkAccessFlagEnabled ... + ClusterNetworkAccessFlagEnabled ClusterNetworkAccessFlag = "Enabled" +) + +// PossibleClusterNetworkAccessFlagValues returns an array of possible values for the ClusterNetworkAccessFlag const type. +func PossibleClusterNetworkAccessFlagValues() []ClusterNetworkAccessFlag { + return []ClusterNetworkAccessFlag{ClusterNetworkAccessFlagDisabled, ClusterNetworkAccessFlagEnabled} +} + +// ClusterPrincipalRole enumerates the values for cluster principal role. +type ClusterPrincipalRole string + +const ( + // ClusterPrincipalRoleAllDatabasesAdmin ... + ClusterPrincipalRoleAllDatabasesAdmin ClusterPrincipalRole = "AllDatabasesAdmin" + // ClusterPrincipalRoleAllDatabasesViewer ... + ClusterPrincipalRoleAllDatabasesViewer ClusterPrincipalRole = "AllDatabasesViewer" +) + +// PossibleClusterPrincipalRoleValues returns an array of possible values for the ClusterPrincipalRole const type. +func PossibleClusterPrincipalRoleValues() []ClusterPrincipalRole { + return []ClusterPrincipalRole{ClusterPrincipalRoleAllDatabasesAdmin, ClusterPrincipalRoleAllDatabasesViewer} +} + +// Compression enumerates the values for compression. +type Compression string + +const ( + // CompressionGZip ... + CompressionGZip Compression = "GZip" + // CompressionNone ... + CompressionNone Compression = "None" +) + +// PossibleCompressionValues returns an array of possible values for the Compression const type. +func PossibleCompressionValues() []Compression { + return []Compression{CompressionGZip, CompressionNone} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// DatabasePrincipalRole enumerates the values for database principal role. +type DatabasePrincipalRole string + +const ( + // DatabasePrincipalRoleAdmin ... + DatabasePrincipalRoleAdmin DatabasePrincipalRole = "Admin" + // DatabasePrincipalRoleIngestor ... + DatabasePrincipalRoleIngestor DatabasePrincipalRole = "Ingestor" + // DatabasePrincipalRoleMonitor ... + DatabasePrincipalRoleMonitor DatabasePrincipalRole = "Monitor" + // DatabasePrincipalRoleUnrestrictedViewer ... + DatabasePrincipalRoleUnrestrictedViewer DatabasePrincipalRole = "UnrestrictedViewer" + // DatabasePrincipalRoleUser ... + DatabasePrincipalRoleUser DatabasePrincipalRole = "User" + // DatabasePrincipalRoleViewer ... + DatabasePrincipalRoleViewer DatabasePrincipalRole = "Viewer" +) + +// PossibleDatabasePrincipalRoleValues returns an array of possible values for the DatabasePrincipalRole const type. +func PossibleDatabasePrincipalRoleValues() []DatabasePrincipalRole { + return []DatabasePrincipalRole{DatabasePrincipalRoleAdmin, DatabasePrincipalRoleIngestor, DatabasePrincipalRoleMonitor, DatabasePrincipalRoleUnrestrictedViewer, DatabasePrincipalRoleUser, DatabasePrincipalRoleViewer} +} + +// DatabasePrincipalType enumerates the values for database principal type. +type DatabasePrincipalType string + +const ( + // DatabasePrincipalTypeApp ... + DatabasePrincipalTypeApp DatabasePrincipalType = "App" + // DatabasePrincipalTypeGroup ... + DatabasePrincipalTypeGroup DatabasePrincipalType = "Group" + // DatabasePrincipalTypeUser ... + DatabasePrincipalTypeUser DatabasePrincipalType = "User" +) + +// PossibleDatabasePrincipalTypeValues returns an array of possible values for the DatabasePrincipalType const type. +func PossibleDatabasePrincipalTypeValues() []DatabasePrincipalType { + return []DatabasePrincipalType{DatabasePrincipalTypeApp, DatabasePrincipalTypeGroup, DatabasePrincipalTypeUser} +} + +// DatabaseRouting enumerates the values for database routing. +type DatabaseRouting string + +const ( + // DatabaseRoutingMulti ... + DatabaseRoutingMulti DatabaseRouting = "Multi" + // DatabaseRoutingSingle ... + DatabaseRoutingSingle DatabaseRouting = "Single" +) + +// PossibleDatabaseRoutingValues returns an array of possible values for the DatabaseRouting const type. +func PossibleDatabaseRoutingValues() []DatabaseRouting { + return []DatabaseRouting{DatabaseRoutingMulti, DatabaseRoutingSingle} +} + +// DefaultPrincipalsModificationKind enumerates the values for default principals modification kind. +type DefaultPrincipalsModificationKind string + +const ( + // DefaultPrincipalsModificationKindNone ... + DefaultPrincipalsModificationKindNone DefaultPrincipalsModificationKind = "None" + // DefaultPrincipalsModificationKindReplace ... + DefaultPrincipalsModificationKindReplace DefaultPrincipalsModificationKind = "Replace" + // DefaultPrincipalsModificationKindUnion ... + DefaultPrincipalsModificationKindUnion DefaultPrincipalsModificationKind = "Union" +) + +// PossibleDefaultPrincipalsModificationKindValues returns an array of possible values for the DefaultPrincipalsModificationKind const type. +func PossibleDefaultPrincipalsModificationKindValues() []DefaultPrincipalsModificationKind { + return []DefaultPrincipalsModificationKind{DefaultPrincipalsModificationKindNone, DefaultPrincipalsModificationKindReplace, DefaultPrincipalsModificationKindUnion} +} + +// EngineType enumerates the values for engine type. +type EngineType string + +const ( + // EngineTypeV2 ... + EngineTypeV2 EngineType = "V2" + // EngineTypeV3 ... + EngineTypeV3 EngineType = "V3" +) + +// PossibleEngineTypeValues returns an array of possible values for the EngineType const type. +func PossibleEngineTypeValues() []EngineType { + return []EngineType{EngineTypeV2, EngineTypeV3} +} + +// EventGridDataFormat enumerates the values for event grid data format. +type EventGridDataFormat string + +const ( + // EventGridDataFormatAPACHEAVRO ... + EventGridDataFormatAPACHEAVRO EventGridDataFormat = "APACHEAVRO" + // EventGridDataFormatAVRO ... + EventGridDataFormatAVRO EventGridDataFormat = "AVRO" + // EventGridDataFormatCSV ... + EventGridDataFormatCSV EventGridDataFormat = "CSV" + // EventGridDataFormatJSON ... + EventGridDataFormatJSON EventGridDataFormat = "JSON" + // EventGridDataFormatMULTIJSON ... + EventGridDataFormatMULTIJSON EventGridDataFormat = "MULTIJSON" + // EventGridDataFormatORC ... + EventGridDataFormatORC EventGridDataFormat = "ORC" + // EventGridDataFormatPARQUET ... + EventGridDataFormatPARQUET EventGridDataFormat = "PARQUET" + // EventGridDataFormatPSV ... + EventGridDataFormatPSV EventGridDataFormat = "PSV" + // EventGridDataFormatRAW ... + EventGridDataFormatRAW EventGridDataFormat = "RAW" + // EventGridDataFormatSCSV ... + EventGridDataFormatSCSV EventGridDataFormat = "SCSV" + // EventGridDataFormatSINGLEJSON ... + EventGridDataFormatSINGLEJSON EventGridDataFormat = "SINGLEJSON" + // EventGridDataFormatSOHSV ... + EventGridDataFormatSOHSV EventGridDataFormat = "SOHSV" + // EventGridDataFormatTSV ... + EventGridDataFormatTSV EventGridDataFormat = "TSV" + // EventGridDataFormatTSVE ... + EventGridDataFormatTSVE EventGridDataFormat = "TSVE" + // EventGridDataFormatTXT ... + EventGridDataFormatTXT EventGridDataFormat = "TXT" + // EventGridDataFormatW3CLOGFILE ... + EventGridDataFormatW3CLOGFILE EventGridDataFormat = "W3CLOGFILE" +) + +// PossibleEventGridDataFormatValues returns an array of possible values for the EventGridDataFormat const type. +func PossibleEventGridDataFormatValues() []EventGridDataFormat { + return []EventGridDataFormat{EventGridDataFormatAPACHEAVRO, EventGridDataFormatAVRO, EventGridDataFormatCSV, EventGridDataFormatJSON, EventGridDataFormatMULTIJSON, EventGridDataFormatORC, EventGridDataFormatPARQUET, EventGridDataFormatPSV, EventGridDataFormatRAW, EventGridDataFormatSCSV, EventGridDataFormatSINGLEJSON, EventGridDataFormatSOHSV, EventGridDataFormatTSV, EventGridDataFormatTSVE, EventGridDataFormatTXT, EventGridDataFormatW3CLOGFILE} +} + +// EventHubDataFormat enumerates the values for event hub data format. +type EventHubDataFormat string + +const ( + // EventHubDataFormatAPACHEAVRO ... + EventHubDataFormatAPACHEAVRO EventHubDataFormat = "APACHEAVRO" + // EventHubDataFormatAVRO ... + EventHubDataFormatAVRO EventHubDataFormat = "AVRO" + // EventHubDataFormatCSV ... + EventHubDataFormatCSV EventHubDataFormat = "CSV" + // EventHubDataFormatJSON ... + EventHubDataFormatJSON EventHubDataFormat = "JSON" + // EventHubDataFormatMULTIJSON ... + EventHubDataFormatMULTIJSON EventHubDataFormat = "MULTIJSON" + // EventHubDataFormatORC ... + EventHubDataFormatORC EventHubDataFormat = "ORC" + // EventHubDataFormatPARQUET ... + EventHubDataFormatPARQUET EventHubDataFormat = "PARQUET" + // EventHubDataFormatPSV ... + EventHubDataFormatPSV EventHubDataFormat = "PSV" + // EventHubDataFormatRAW ... + EventHubDataFormatRAW EventHubDataFormat = "RAW" + // EventHubDataFormatSCSV ... + EventHubDataFormatSCSV EventHubDataFormat = "SCSV" + // EventHubDataFormatSINGLEJSON ... + EventHubDataFormatSINGLEJSON EventHubDataFormat = "SINGLEJSON" + // EventHubDataFormatSOHSV ... + EventHubDataFormatSOHSV EventHubDataFormat = "SOHSV" + // EventHubDataFormatTSV ... + EventHubDataFormatTSV EventHubDataFormat = "TSV" + // EventHubDataFormatTSVE ... + EventHubDataFormatTSVE EventHubDataFormat = "TSVE" + // EventHubDataFormatTXT ... + EventHubDataFormatTXT EventHubDataFormat = "TXT" + // EventHubDataFormatW3CLOGFILE ... + EventHubDataFormatW3CLOGFILE EventHubDataFormat = "W3CLOGFILE" +) + +// PossibleEventHubDataFormatValues returns an array of possible values for the EventHubDataFormat const type. +func PossibleEventHubDataFormatValues() []EventHubDataFormat { + return []EventHubDataFormat{EventHubDataFormatAPACHEAVRO, EventHubDataFormatAVRO, EventHubDataFormatCSV, EventHubDataFormatJSON, EventHubDataFormatMULTIJSON, EventHubDataFormatORC, EventHubDataFormatPARQUET, EventHubDataFormatPSV, EventHubDataFormatRAW, EventHubDataFormatSCSV, EventHubDataFormatSINGLEJSON, EventHubDataFormatSOHSV, EventHubDataFormatTSV, EventHubDataFormatTSVE, EventHubDataFormatTXT, EventHubDataFormatW3CLOGFILE} +} + +// IdentityType enumerates the values for identity type. +type IdentityType string + +const ( + // IdentityTypeNone ... + IdentityTypeNone IdentityType = "None" + // IdentityTypeSystemAssigned ... + IdentityTypeSystemAssigned IdentityType = "SystemAssigned" + // IdentityTypeSystemAssignedUserAssigned ... + IdentityTypeSystemAssignedUserAssigned IdentityType = "SystemAssigned, UserAssigned" + // IdentityTypeUserAssigned ... + IdentityTypeUserAssigned IdentityType = "UserAssigned" +) + +// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{IdentityTypeNone, IdentityTypeSystemAssigned, IdentityTypeSystemAssignedUserAssigned, IdentityTypeUserAssigned} +} + +// IotHubDataFormat enumerates the values for iot hub data format. +type IotHubDataFormat string + +const ( + // IotHubDataFormatAPACHEAVRO ... + IotHubDataFormatAPACHEAVRO IotHubDataFormat = "APACHEAVRO" + // IotHubDataFormatAVRO ... + IotHubDataFormatAVRO IotHubDataFormat = "AVRO" + // IotHubDataFormatCSV ... + IotHubDataFormatCSV IotHubDataFormat = "CSV" + // IotHubDataFormatJSON ... + IotHubDataFormatJSON IotHubDataFormat = "JSON" + // IotHubDataFormatMULTIJSON ... + IotHubDataFormatMULTIJSON IotHubDataFormat = "MULTIJSON" + // IotHubDataFormatORC ... + IotHubDataFormatORC IotHubDataFormat = "ORC" + // IotHubDataFormatPARQUET ... + IotHubDataFormatPARQUET IotHubDataFormat = "PARQUET" + // IotHubDataFormatPSV ... + IotHubDataFormatPSV IotHubDataFormat = "PSV" + // IotHubDataFormatRAW ... + IotHubDataFormatRAW IotHubDataFormat = "RAW" + // IotHubDataFormatSCSV ... + IotHubDataFormatSCSV IotHubDataFormat = "SCSV" + // IotHubDataFormatSINGLEJSON ... + IotHubDataFormatSINGLEJSON IotHubDataFormat = "SINGLEJSON" + // IotHubDataFormatSOHSV ... + IotHubDataFormatSOHSV IotHubDataFormat = "SOHSV" + // IotHubDataFormatTSV ... + IotHubDataFormatTSV IotHubDataFormat = "TSV" + // IotHubDataFormatTSVE ... + IotHubDataFormatTSVE IotHubDataFormat = "TSVE" + // IotHubDataFormatTXT ... + IotHubDataFormatTXT IotHubDataFormat = "TXT" + // IotHubDataFormatW3CLOGFILE ... + IotHubDataFormatW3CLOGFILE IotHubDataFormat = "W3CLOGFILE" +) + +// PossibleIotHubDataFormatValues returns an array of possible values for the IotHubDataFormat const type. +func PossibleIotHubDataFormatValues() []IotHubDataFormat { + return []IotHubDataFormat{IotHubDataFormatAPACHEAVRO, IotHubDataFormatAVRO, IotHubDataFormatCSV, IotHubDataFormatJSON, IotHubDataFormatMULTIJSON, IotHubDataFormatORC, IotHubDataFormatPARQUET, IotHubDataFormatPSV, IotHubDataFormatRAW, IotHubDataFormatSCSV, IotHubDataFormatSINGLEJSON, IotHubDataFormatSOHSV, IotHubDataFormatTSV, IotHubDataFormatTSVE, IotHubDataFormatTXT, IotHubDataFormatW3CLOGFILE} +} + +// Kind enumerates the values for kind. +type Kind string + +const ( + // KindDatabase ... + KindDatabase Kind = "Database" + // KindReadOnlyFollowing ... + KindReadOnlyFollowing Kind = "ReadOnlyFollowing" + // KindReadWrite ... + KindReadWrite Kind = "ReadWrite" +) + +// PossibleKindValues returns an array of possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{KindDatabase, KindReadOnlyFollowing, KindReadWrite} +} + +// KindBasicDataConnection enumerates the values for kind basic data connection. +type KindBasicDataConnection string + +const ( + // KindBasicDataConnectionKindDataConnection ... + KindBasicDataConnectionKindDataConnection KindBasicDataConnection = "DataConnection" + // KindBasicDataConnectionKindEventGrid ... + KindBasicDataConnectionKindEventGrid KindBasicDataConnection = "EventGrid" + // KindBasicDataConnectionKindEventHub ... + KindBasicDataConnectionKindEventHub KindBasicDataConnection = "EventHub" + // KindBasicDataConnectionKindIotHub ... + KindBasicDataConnectionKindIotHub KindBasicDataConnection = "IotHub" +) + +// PossibleKindBasicDataConnectionValues returns an array of possible values for the KindBasicDataConnection const type. +func PossibleKindBasicDataConnectionValues() []KindBasicDataConnection { + return []KindBasicDataConnection{KindBasicDataConnectionKindDataConnection, KindBasicDataConnectionKindEventGrid, KindBasicDataConnectionKindEventHub, KindBasicDataConnectionKindIotHub} +} + +// LanguageExtensionName enumerates the values for language extension name. +type LanguageExtensionName string + +const ( + // LanguageExtensionNamePYTHON ... + LanguageExtensionNamePYTHON LanguageExtensionName = "PYTHON" + // LanguageExtensionNameR ... + LanguageExtensionNameR LanguageExtensionName = "R" +) + +// PossibleLanguageExtensionNameValues returns an array of possible values for the LanguageExtensionName const type. +func PossibleLanguageExtensionNameValues() []LanguageExtensionName { + return []LanguageExtensionName{LanguageExtensionNamePYTHON, LanguageExtensionNameR} +} + +// PrincipalsModificationKind enumerates the values for principals modification kind. +type PrincipalsModificationKind string + +const ( + // PrincipalsModificationKindNone ... + PrincipalsModificationKindNone PrincipalsModificationKind = "None" + // PrincipalsModificationKindReplace ... + PrincipalsModificationKindReplace PrincipalsModificationKind = "Replace" + // PrincipalsModificationKindUnion ... + PrincipalsModificationKindUnion PrincipalsModificationKind = "Union" +) + +// PossiblePrincipalsModificationKindValues returns an array of possible values for the PrincipalsModificationKind const type. +func PossiblePrincipalsModificationKindValues() []PrincipalsModificationKind { + return []PrincipalsModificationKind{PrincipalsModificationKindNone, PrincipalsModificationKindReplace, PrincipalsModificationKindUnion} +} + +// PrincipalType enumerates the values for principal type. +type PrincipalType string + +const ( + // PrincipalTypeApp ... + PrincipalTypeApp PrincipalType = "App" + // PrincipalTypeGroup ... + PrincipalTypeGroup PrincipalType = "Group" + // PrincipalTypeUser ... + PrincipalTypeUser PrincipalType = "User" +) + +// PossiblePrincipalTypeValues returns an array of possible values for the PrincipalType const type. +func PossiblePrincipalTypeValues() []PrincipalType { + return []PrincipalType{PrincipalTypeApp, PrincipalTypeGroup, PrincipalTypeUser} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateMoving ... + ProvisioningStateMoving ProvisioningState = "Moving" + // ProvisioningStateRunning ... + ProvisioningStateRunning ProvisioningState = "Running" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoving, ProvisioningStateRunning, ProvisioningStateSucceeded} +} + +// PublicIPType enumerates the values for public ip type. +type PublicIPType string + +const ( + // PublicIPTypeDualStack ... + PublicIPTypeDualStack PublicIPType = "DualStack" + // PublicIPTypeIPv4 ... + PublicIPTypeIPv4 PublicIPType = "IPv4" +) + +// PossiblePublicIPTypeValues returns an array of possible values for the PublicIPType const type. +func PossiblePublicIPTypeValues() []PublicIPType { + return []PublicIPType{PublicIPTypeDualStack, PublicIPTypeIPv4} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled ... + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled ... + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} +} + +// Reason enumerates the values for reason. +type Reason string + +const ( + // ReasonAlreadyExists ... + ReasonAlreadyExists Reason = "AlreadyExists" + // ReasonInvalid ... + ReasonInvalid Reason = "Invalid" +) + +// PossibleReasonValues returns an array of possible values for the Reason const type. +func PossibleReasonValues() []Reason { + return []Reason{ReasonAlreadyExists, ReasonInvalid} +} + +// State enumerates the values for state. +type State string + +const ( + // StateCreating ... + StateCreating State = "Creating" + // StateDeleted ... + StateDeleted State = "Deleted" + // StateDeleting ... + StateDeleting State = "Deleting" + // StateRunning ... + StateRunning State = "Running" + // StateStarting ... + StateStarting State = "Starting" + // StateStopped ... + StateStopped State = "Stopped" + // StateStopping ... + StateStopping State = "Stopping" + // StateUnavailable ... + StateUnavailable State = "Unavailable" + // StateUpdating ... + StateUpdating State = "Updating" +) + +// PossibleStateValues returns an array of possible values for the State const type. +func PossibleStateValues() []State { + return []State{StateCreating, StateDeleted, StateDeleting, StateRunning, StateStarting, StateStopped, StateStopping, StateUnavailable, StateUpdating} +} + +// Status enumerates the values for status. +type Status string + +const ( + // StatusCanceled ... + StatusCanceled Status = "Canceled" + // StatusFailed ... + StatusFailed Status = "Failed" + // StatusRunning ... + StatusRunning Status = "Running" + // StatusSucceeded ... + StatusSucceeded Status = "Succeeded" +) + +// PossibleStatusValues returns an array of possible values for the Status const type. +func PossibleStatusValues() []Status { + return []Status{StatusCanceled, StatusFailed, StatusRunning, StatusSucceeded} +} + +// Type enumerates the values for type. +type Type string + +const ( + // TypeMicrosoftKustoclustersattachedDatabaseConfigurations ... + TypeMicrosoftKustoclustersattachedDatabaseConfigurations Type = "Microsoft.Kusto/clusters/attachedDatabaseConfigurations" + // TypeMicrosoftKustoclustersdatabases ... + TypeMicrosoftKustoclustersdatabases Type = "Microsoft.Kusto/clusters/databases" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{TypeMicrosoftKustoclustersattachedDatabaseConfigurations, TypeMicrosoftKustoclustersdatabases} +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/managedprivateendpoints.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/managedprivateendpoints.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/managedprivateendpoints.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/managedprivateendpoints.go index 323b6a05744..e86c8b18378 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/managedprivateendpoints.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/managedprivateendpoints.go @@ -87,7 +87,7 @@ func (client ManagedPrivateEndpointsClient) CheckNameAvailabilityPreparer(ctx co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -170,7 +170,7 @@ func (client ManagedPrivateEndpointsClient) CreateOrUpdatePreparer(ctx context.C "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -254,7 +254,7 @@ func (client ManagedPrivateEndpointsClient) DeletePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -341,7 +341,7 @@ func (client ManagedPrivateEndpointsClient) GetPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -417,7 +417,7 @@ func (client ManagedPrivateEndpointsClient) ListPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -489,7 +489,7 @@ func (client ManagedPrivateEndpointsClient) UpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/models.go new file mode 100644 index 00000000000..10de556bd41 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/models.go @@ -0,0 +1,4819 @@ +package kusto + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" + +// AcceptedAudiences represents an accepted audience trusted by the cluster. +type AcceptedAudiences struct { + // Value - GUID or valid URL representing an accepted audience. + Value *string `json:"value,omitempty"` +} + +// AttachedDatabaseConfiguration class representing an attached database configuration. +type AttachedDatabaseConfiguration struct { + autorest.Response `json:"-"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // AttachedDatabaseConfigurationProperties - The properties of the attached database configuration. + *AttachedDatabaseConfigurationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AttachedDatabaseConfiguration. +func (adc AttachedDatabaseConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adc.Location != nil { + objectMap["location"] = adc.Location + } + if adc.AttachedDatabaseConfigurationProperties != nil { + objectMap["properties"] = adc.AttachedDatabaseConfigurationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AttachedDatabaseConfiguration struct. +func (adc *AttachedDatabaseConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + adc.Location = &location + } + case "properties": + if v != nil { + var attachedDatabaseConfigurationProperties AttachedDatabaseConfigurationProperties + err = json.Unmarshal(*v, &attachedDatabaseConfigurationProperties) + if err != nil { + return err + } + adc.AttachedDatabaseConfigurationProperties = &attachedDatabaseConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + adc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + adc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + adc.Type = &typeVar + } + } + } + + return nil +} + +// AttachedDatabaseConfigurationListResult the list attached database configurations operation response. +type AttachedDatabaseConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - The list of attached database configurations. + Value *[]AttachedDatabaseConfiguration `json:"value,omitempty"` +} + +// AttachedDatabaseConfigurationProperties class representing the an attached database configuration +// properties of kind specific. +type AttachedDatabaseConfigurationProperties struct { + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // DatabaseName - The name of the database which you would like to attach, use * if you want to follow all current and future databases. + DatabaseName *string `json:"databaseName,omitempty"` + // ClusterResourceID - The resource id of the cluster where the databases you would like to attach reside. + ClusterResourceID *string `json:"clusterResourceId,omitempty"` + // AttachedDatabaseNames - READ-ONLY; The list of databases from the clusterResourceId which are currently attached to the cluster. + AttachedDatabaseNames *[]string `json:"attachedDatabaseNames,omitempty"` + // DefaultPrincipalsModificationKind - The default principals modification kind. Possible values include: 'DefaultPrincipalsModificationKindUnion', 'DefaultPrincipalsModificationKindReplace', 'DefaultPrincipalsModificationKindNone' + DefaultPrincipalsModificationKind DefaultPrincipalsModificationKind `json:"defaultPrincipalsModificationKind,omitempty"` + // TableLevelSharingProperties - Table level sharing specifications + TableLevelSharingProperties *TableLevelSharingProperties `json:"tableLevelSharingProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AttachedDatabaseConfigurationProperties. +func (adcp AttachedDatabaseConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adcp.DatabaseName != nil { + objectMap["databaseName"] = adcp.DatabaseName + } + if adcp.ClusterResourceID != nil { + objectMap["clusterResourceId"] = adcp.ClusterResourceID + } + if adcp.DefaultPrincipalsModificationKind != "" { + objectMap["defaultPrincipalsModificationKind"] = adcp.DefaultPrincipalsModificationKind + } + if adcp.TableLevelSharingProperties != nil { + objectMap["tableLevelSharingProperties"] = adcp.TableLevelSharingProperties + } + return json.Marshal(objectMap) +} + +// AttachedDatabaseConfigurationsCheckNameRequest the result returned from a AttachedDatabaseConfigurations +// check name availability request. +type AttachedDatabaseConfigurationsCheckNameRequest struct { + // Name - Attached database resource name. + Name *string `json:"name,omitempty"` + // Type - The type of resource, for instance Microsoft.Kusto/clusters/attachedDatabaseConfigurations. + Type *string `json:"type,omitempty"` +} + +// AttachedDatabaseConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type AttachedDatabaseConfigurationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AttachedDatabaseConfigurationsClient) (AttachedDatabaseConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AttachedDatabaseConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AttachedDatabaseConfigurationsCreateOrUpdateFuture.Result. +func (future *AttachedDatabaseConfigurationsCreateOrUpdateFuture) result(client AttachedDatabaseConfigurationsClient) (adc AttachedDatabaseConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + adc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if adc.Response.Response, err = future.GetResult(sender); err == nil && adc.Response.Response.StatusCode != http.StatusNoContent { + adc, err = client.CreateOrUpdateResponder(adc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture", "Result", adc.Response.Response, "Failure responding to request") + } + } + return +} + +// AttachedDatabaseConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AttachedDatabaseConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AttachedDatabaseConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AttachedDatabaseConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AttachedDatabaseConfigurationsDeleteFuture.Result. +func (future *AttachedDatabaseConfigurationsDeleteFuture) result(client AttachedDatabaseConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.AttachedDatabaseConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AzureCapacity azure capacity definition. +type AzureCapacity struct { + // ScaleType - Scale type. Possible values include: 'AzureScaleTypeAutomatic', 'AzureScaleTypeManual', 'AzureScaleTypeNone' + ScaleType AzureScaleType `json:"scaleType,omitempty"` + // Minimum - Minimum allowed capacity. + Minimum *int32 `json:"minimum,omitempty"` + // Maximum - Maximum allowed capacity. + Maximum *int32 `json:"maximum,omitempty"` + // Default - The default capacity that would be used. + Default *int32 `json:"default,omitempty"` +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureResourceSku azure resource SKU definition. +type AzureResourceSku struct { + // ResourceType - Resource Namespace and Type. + ResourceType *string `json:"resourceType,omitempty"` + // Sku - The SKU details. + Sku *AzureSku `json:"sku,omitempty"` + // Capacity - The number of instances of the cluster. + Capacity *AzureCapacity `json:"capacity,omitempty"` +} + +// AzureSku azure SKU definition. +type AzureSku struct { + // Name - SKU name. Possible values include: 'AzureSkuNameDevNoSLAStandardD11V2', 'AzureSkuNameDevNoSLAStandardE2aV4', 'AzureSkuNameStandardD11V2', 'AzureSkuNameStandardD12V2', 'AzureSkuNameStandardD13V2', 'AzureSkuNameStandardD14V2', 'AzureSkuNameStandardD32dV4', 'AzureSkuNameStandardD16dV5', 'AzureSkuNameStandardD32dV5', 'AzureSkuNameStandardDS13V21TBPS', 'AzureSkuNameStandardDS13V22TBPS', 'AzureSkuNameStandardDS14V23TBPS', 'AzureSkuNameStandardDS14V24TBPS', 'AzureSkuNameStandardL4s', 'AzureSkuNameStandardL8s', 'AzureSkuNameStandardL16s', 'AzureSkuNameStandardL8sV2', 'AzureSkuNameStandardL16sV2', 'AzureSkuNameStandardE64iV3', 'AzureSkuNameStandardE80idsV4', 'AzureSkuNameStandardE2aV4', 'AzureSkuNameStandardE4aV4', 'AzureSkuNameStandardE8aV4', 'AzureSkuNameStandardE16aV4', 'AzureSkuNameStandardE8asV41TBPS', 'AzureSkuNameStandardE8asV42TBPS', 'AzureSkuNameStandardE16asV43TBPS', 'AzureSkuNameStandardE16asV44TBPS', 'AzureSkuNameStandardE8asV51TBPS', 'AzureSkuNameStandardE8asV52TBPS', 'AzureSkuNameStandardE16asV53TBPS', 'AzureSkuNameStandardE16asV54TBPS', 'AzureSkuNameStandardE2adsV5', 'AzureSkuNameStandardE4adsV5', 'AzureSkuNameStandardE8adsV5', 'AzureSkuNameStandardE16adsV5', 'AzureSkuNameStandardE8sV41TBPS', 'AzureSkuNameStandardE8sV42TBPS', 'AzureSkuNameStandardE16sV43TBPS', 'AzureSkuNameStandardE16sV44TBPS', 'AzureSkuNameStandardE8sV51TBPS', 'AzureSkuNameStandardE8sV52TBPS', 'AzureSkuNameStandardE16sV53TBPS', 'AzureSkuNameStandardE16sV54TBPS' + Name AzureSkuName `json:"name,omitempty"` + // Capacity - The number of instances of the cluster. + Capacity *int32 `json:"capacity,omitempty"` + // Tier - SKU tier. Possible values include: 'AzureSkuTierBasic', 'AzureSkuTierStandard' + Tier AzureSkuTier `json:"tier,omitempty"` +} + +// CheckNameRequest the result returned from a database check name availability request. +type CheckNameRequest struct { + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - The type of resource, for instance Microsoft.Kusto/clusters/databases. Possible values include: 'TypeMicrosoftKustoclustersdatabases', 'TypeMicrosoftKustoclustersattachedDatabaseConfigurations' + Type Type `json:"type,omitempty"` +} + +// CheckNameResult the result returned from a check name availability request. +type CheckNameResult struct { + autorest.Response `json:"-"` + // NameAvailable - Specifies a Boolean value that indicates if the name is available. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Name - The name that was checked. + Name *string `json:"name,omitempty"` + // Message - Message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated. + Message *string `json:"message,omitempty"` + // Reason - Message providing the reason why the given name is invalid. Possible values include: 'ReasonInvalid', 'ReasonAlreadyExists' + Reason Reason `json:"reason,omitempty"` +} + +// CloudError an error response from Kusto. +type CloudError struct { + // Error - An error response from Kusto. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from Kusto. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for displaying in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// Cluster class representing a Kusto cluster. +type Cluster struct { + autorest.Response `json:"-"` + // Sku - The SKU of the cluster. + Sku *AzureSku `json:"sku,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` + // Zones - The availability zones of the cluster. + Zones *[]string `json:"zones,omitempty"` + // Identity - The identity of the cluster, if configured. + Identity *Identity `json:"identity,omitempty"` + // ClusterProperties - The cluster properties. + *ClusterProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Cluster. +func (c Cluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.Sku != nil { + objectMap["sku"] = c.Sku + } + if c.Zones != nil { + objectMap["zones"] = c.Zones + } + if c.Identity != nil { + objectMap["identity"] = c.Identity + } + if c.ClusterProperties != nil { + objectMap["properties"] = c.ClusterProperties + } + if c.Tags != nil { + objectMap["tags"] = c.Tags + } + if c.Location != nil { + objectMap["location"] = c.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Cluster struct. +func (c *Cluster) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku AzureSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + c.Sku = &sku + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + c.SystemData = &systemData + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + c.Zones = &zones + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + c.Identity = &identity + } + case "properties": + if v != nil { + var clusterProperties ClusterProperties + err = json.Unmarshal(*v, &clusterProperties) + if err != nil { + return err + } + c.ClusterProperties = &clusterProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + c.Etag = &etag + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + c.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + c.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + c.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + c.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + c.Type = &typeVar + } + } + } + + return nil +} + +// ClusterCheckNameRequest the result returned from a cluster check name availability request. +type ClusterCheckNameRequest struct { + // Name - Cluster name. + Name *string `json:"name,omitempty"` + // Type - The type of resource, Microsoft.Kusto/clusters. + Type *string `json:"type,omitempty"` +} + +// ClusterListResult the list Kusto clusters operation response. +type ClusterListResult struct { + autorest.Response `json:"-"` + // Value - The list of Kusto clusters. + Value *[]Cluster `json:"value,omitempty"` +} + +// ClusterPrincipalAssignment class representing a cluster principal assignment. +type ClusterPrincipalAssignment struct { + autorest.Response `json:"-"` + // ClusterPrincipalProperties - The cluster principal. + *ClusterPrincipalProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterPrincipalAssignment. +func (cpa ClusterPrincipalAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cpa.ClusterPrincipalProperties != nil { + objectMap["properties"] = cpa.ClusterPrincipalProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ClusterPrincipalAssignment struct. +func (cpa *ClusterPrincipalAssignment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var clusterPrincipalProperties ClusterPrincipalProperties + err = json.Unmarshal(*v, &clusterPrincipalProperties) + if err != nil { + return err + } + cpa.ClusterPrincipalProperties = &clusterPrincipalProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cpa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cpa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cpa.Type = &typeVar + } + } + } + + return nil +} + +// ClusterPrincipalAssignmentCheckNameRequest a principal assignment check name availability request. +type ClusterPrincipalAssignmentCheckNameRequest struct { + // Name - Principal Assignment resource name. + Name *string `json:"name,omitempty"` + // Type - The type of resource, Microsoft.Kusto/clusters/principalAssignments. + Type *string `json:"type,omitempty"` +} + +// ClusterPrincipalAssignmentListResult the list Kusto cluster principal assignments operation response. +type ClusterPrincipalAssignmentListResult struct { + autorest.Response `json:"-"` + // Value - The list of Kusto cluster principal assignments. + Value *[]ClusterPrincipalAssignment `json:"value,omitempty"` +} + +// ClusterPrincipalAssignmentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ClusterPrincipalAssignmentsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ClusterPrincipalAssignmentsClient) (ClusterPrincipalAssignment, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ClusterPrincipalAssignmentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ClusterPrincipalAssignmentsCreateOrUpdateFuture.Result. +func (future *ClusterPrincipalAssignmentsCreateOrUpdateFuture) result(client ClusterPrincipalAssignmentsClient) (cpa ClusterPrincipalAssignment, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cpa.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ClusterPrincipalAssignmentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cpa.Response.Response, err = future.GetResult(sender); err == nil && cpa.Response.Response.StatusCode != http.StatusNoContent { + cpa, err = client.CreateOrUpdateResponder(cpa.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsCreateOrUpdateFuture", "Result", cpa.Response.Response, "Failure responding to request") + } + } + return +} + +// ClusterPrincipalAssignmentsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClusterPrincipalAssignmentsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ClusterPrincipalAssignmentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ClusterPrincipalAssignmentsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ClusterPrincipalAssignmentsDeleteFuture.Result. +func (future *ClusterPrincipalAssignmentsDeleteFuture) result(client ClusterPrincipalAssignmentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ClusterPrincipalAssignmentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ClusterPrincipalProperties a class representing cluster principal property. +type ClusterPrincipalProperties struct { + // PrincipalID - The principal ID assigned to the cluster principal. It can be a user email, application ID, or security group name. + PrincipalID *string `json:"principalId,omitempty"` + // Role - Cluster principal role. Possible values include: 'ClusterPrincipalRoleAllDatabasesAdmin', 'ClusterPrincipalRoleAllDatabasesViewer' + Role ClusterPrincipalRole `json:"role,omitempty"` + // TenantID - The tenant id of the principal + TenantID *string `json:"tenantId,omitempty"` + // PrincipalType - Principal type. Possible values include: 'PrincipalTypeApp', 'PrincipalTypeGroup', 'PrincipalTypeUser' + PrincipalType PrincipalType `json:"principalType,omitempty"` + // TenantName - READ-ONLY; The tenant name of the principal + TenantName *string `json:"tenantName,omitempty"` + // PrincipalName - READ-ONLY; The principal name + PrincipalName *string `json:"principalName,omitempty"` + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // AadObjectID - READ-ONLY; The service principal object id in AAD (Azure active directory) + AadObjectID *string `json:"aadObjectId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterPrincipalProperties. +func (cpp ClusterPrincipalProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cpp.PrincipalID != nil { + objectMap["principalId"] = cpp.PrincipalID + } + if cpp.Role != "" { + objectMap["role"] = cpp.Role + } + if cpp.TenantID != nil { + objectMap["tenantId"] = cpp.TenantID + } + if cpp.PrincipalType != "" { + objectMap["principalType"] = cpp.PrincipalType + } + return json.Marshal(objectMap) +} + +// ClusterProperties class representing the Kusto cluster properties. +type ClusterProperties struct { + // State - READ-ONLY; The state of the resource. Possible values include: 'StateCreating', 'StateUnavailable', 'StateRunning', 'StateDeleting', 'StateDeleted', 'StateStopping', 'StateStopped', 'StateStarting', 'StateUpdating' + State State `json:"state,omitempty"` + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // URI - READ-ONLY; The cluster URI. + URI *string `json:"uri,omitempty"` + // DataIngestionURI - READ-ONLY; The cluster data ingestion URI. + DataIngestionURI *string `json:"dataIngestionUri,omitempty"` + // StateReason - READ-ONLY; The reason for the cluster's current state. + StateReason *string `json:"stateReason,omitempty"` + // TrustedExternalTenants - The cluster's external tenants. + TrustedExternalTenants *[]TrustedExternalTenant `json:"trustedExternalTenants,omitempty"` + // OptimizedAutoscale - Optimized auto scale definition. + OptimizedAutoscale *OptimizedAutoscale `json:"optimizedAutoscale,omitempty"` + // EnableDiskEncryption - A boolean value that indicates if the cluster's disks are encrypted. + EnableDiskEncryption *bool `json:"enableDiskEncryption,omitempty"` + // EnableStreamingIngest - A boolean value that indicates if the streaming ingest is enabled. + EnableStreamingIngest *bool `json:"enableStreamingIngest,omitempty"` + // VirtualNetworkConfiguration - Virtual network definition. + VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` + // KeyVaultProperties - KeyVault properties for the cluster encryption. + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` + // EnablePurge - A boolean value that indicates if the purge operations are enabled. + EnablePurge *bool `json:"enablePurge,omitempty"` + // LanguageExtensions - READ-ONLY; List of the cluster's language extensions. + LanguageExtensions *LanguageExtensionsList `json:"languageExtensions,omitempty"` + // EnableDoubleEncryption - A boolean value that indicates if double encryption is enabled. + EnableDoubleEncryption *bool `json:"enableDoubleEncryption,omitempty"` + // PublicNetworkAccess - Public network access to the cluster is enabled by default. When disabled, only private endpoint connection to the cluster is allowed. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // AllowedIPRangeList - The list of ips in the format of CIDR allowed to connect to the cluster. + AllowedIPRangeList *[]string `json:"allowedIpRangeList,omitempty"` + // EngineType - The engine type. Possible values include: 'EngineTypeV2', 'EngineTypeV3' + EngineType EngineType `json:"engineType,omitempty"` + // AcceptedAudiences - The cluster's accepted audiences. + AcceptedAudiences *[]AcceptedAudiences `json:"acceptedAudiences,omitempty"` + // EnableAutoStop - A boolean value that indicates if the cluster could be automatically stopped (due to lack of data or no activity for many days). + EnableAutoStop *bool `json:"enableAutoStop,omitempty"` + // RestrictOutboundNetworkAccess - Whether or not to restrict outbound network access. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'ClusterNetworkAccessFlagEnabled', 'ClusterNetworkAccessFlagDisabled' + RestrictOutboundNetworkAccess ClusterNetworkAccessFlag `json:"restrictOutboundNetworkAccess,omitempty"` + // AllowedFqdnList - List of allowed FQDNs(Fully Qualified Domain Name) for egress from Cluster. + AllowedFqdnList *[]string `json:"allowedFqdnList,omitempty"` + // PublicIPType - Indicates what public IP type to create - IPv4 (default), or DualStack (both IPv4 and IPv6). Possible values include: 'PublicIPTypeIPv4', 'PublicIPTypeDualStack' + PublicIPType PublicIPType `json:"publicIPType,omitempty"` + // VirtualClusterGraduationProperties - Virtual Cluster graduation properties + VirtualClusterGraduationProperties *string `json:"virtualClusterGraduationProperties,omitempty"` + // PrivateEndpointConnections - READ-ONLY; A list of private endpoint connections. + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterProperties. +func (cp ClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.TrustedExternalTenants != nil { + objectMap["trustedExternalTenants"] = cp.TrustedExternalTenants + } + if cp.OptimizedAutoscale != nil { + objectMap["optimizedAutoscale"] = cp.OptimizedAutoscale + } + if cp.EnableDiskEncryption != nil { + objectMap["enableDiskEncryption"] = cp.EnableDiskEncryption + } + if cp.EnableStreamingIngest != nil { + objectMap["enableStreamingIngest"] = cp.EnableStreamingIngest + } + if cp.VirtualNetworkConfiguration != nil { + objectMap["virtualNetworkConfiguration"] = cp.VirtualNetworkConfiguration + } + if cp.KeyVaultProperties != nil { + objectMap["keyVaultProperties"] = cp.KeyVaultProperties + } + if cp.EnablePurge != nil { + objectMap["enablePurge"] = cp.EnablePurge + } + if cp.EnableDoubleEncryption != nil { + objectMap["enableDoubleEncryption"] = cp.EnableDoubleEncryption + } + if cp.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = cp.PublicNetworkAccess + } + if cp.AllowedIPRangeList != nil { + objectMap["allowedIpRangeList"] = cp.AllowedIPRangeList + } + if cp.EngineType != "" { + objectMap["engineType"] = cp.EngineType + } + if cp.AcceptedAudiences != nil { + objectMap["acceptedAudiences"] = cp.AcceptedAudiences + } + if cp.EnableAutoStop != nil { + objectMap["enableAutoStop"] = cp.EnableAutoStop + } + if cp.RestrictOutboundNetworkAccess != "" { + objectMap["restrictOutboundNetworkAccess"] = cp.RestrictOutboundNetworkAccess + } + if cp.AllowedFqdnList != nil { + objectMap["allowedFqdnList"] = cp.AllowedFqdnList + } + if cp.PublicIPType != "" { + objectMap["publicIPType"] = cp.PublicIPType + } + if cp.VirtualClusterGraduationProperties != nil { + objectMap["virtualClusterGraduationProperties"] = cp.VirtualClusterGraduationProperties + } + return json.Marshal(objectMap) +} + +// ClustersAddLanguageExtensionsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClustersAddLanguageExtensionsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ClustersAddLanguageExtensionsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ClustersAddLanguageExtensionsFuture.Result. +func (future *ClustersAddLanguageExtensionsFuture) result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersAddLanguageExtensionsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ClustersAddLanguageExtensionsFuture") + return + } + ar.Response = future.Response() + return +} + +// ClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ClustersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ClustersClient) (Cluster, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ClustersCreateOrUpdateFuture.Result. +func (future *ClustersCreateOrUpdateFuture) result(client ClustersClient) (c Cluster, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + c.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ClustersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { + c, err = client.CreateOrUpdateResponder(c.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") + } + } + return +} + +// ClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ClustersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ClustersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ClustersDeleteFuture.Result. +func (future *ClustersDeleteFuture) result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ClustersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ClustersDetachFollowerDatabasesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClustersDetachFollowerDatabasesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ClustersDetachFollowerDatabasesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ClustersDetachFollowerDatabasesFuture.Result. +func (future *ClustersDetachFollowerDatabasesFuture) result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersDetachFollowerDatabasesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ClustersDetachFollowerDatabasesFuture") + return + } + ar.Response = future.Response() + return +} + +// ClustersDiagnoseVirtualNetworkFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClustersDiagnoseVirtualNetworkFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ClustersClient) (DiagnoseVirtualNetworkResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ClustersDiagnoseVirtualNetworkFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ClustersDiagnoseVirtualNetworkFuture.Result. +func (future *ClustersDiagnoseVirtualNetworkFuture) result(client ClustersClient) (dvnr DiagnoseVirtualNetworkResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersDiagnoseVirtualNetworkFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dvnr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ClustersDiagnoseVirtualNetworkFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dvnr.Response.Response, err = future.GetResult(sender); err == nil && dvnr.Response.Response.StatusCode != http.StatusNoContent { + dvnr, err = client.DiagnoseVirtualNetworkResponder(dvnr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersDiagnoseVirtualNetworkFuture", "Result", dvnr.Response.Response, "Failure responding to request") + } + } + return +} + +// ClustersRemoveLanguageExtensionsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClustersRemoveLanguageExtensionsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ClustersRemoveLanguageExtensionsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ClustersRemoveLanguageExtensionsFuture.Result. +func (future *ClustersRemoveLanguageExtensionsFuture) result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersRemoveLanguageExtensionsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ClustersRemoveLanguageExtensionsFuture") + return + } + ar.Response = future.Response() + return +} + +// ClustersStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ClustersStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ClustersStartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ClustersStartFuture.Result. +func (future *ClustersStartFuture) result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ClustersStartFuture") + return + } + ar.Response = future.Response() + return +} + +// ClustersStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ClustersStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ClustersStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ClustersStopFuture.Result. +func (future *ClustersStopFuture) result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ClustersStopFuture") + return + } + ar.Response = future.Response() + return +} + +// ClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ClustersUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ClustersClient) (Cluster, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ClustersUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ClustersUpdateFuture.Result. +func (future *ClustersUpdateFuture) result(client ClustersClient) (c Cluster, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + c.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ClustersUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { + c, err = client.UpdateResponder(c.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersUpdateFuture", "Result", c.Response.Response, "Failure responding to request") + } + } + return +} + +// ClusterUpdate class representing an update to a Kusto cluster. +type ClusterUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Sku - The SKU of the cluster. + Sku *AzureSku `json:"sku,omitempty"` + // Identity - The identity of the cluster, if configured. + Identity *Identity `json:"identity,omitempty"` + // ClusterProperties - The cluster properties. + *ClusterProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterUpdate. +func (cu ClusterUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cu.Tags != nil { + objectMap["tags"] = cu.Tags + } + if cu.Location != nil { + objectMap["location"] = cu.Location + } + if cu.Sku != nil { + objectMap["sku"] = cu.Sku + } + if cu.Identity != nil { + objectMap["identity"] = cu.Identity + } + if cu.ClusterProperties != nil { + objectMap["properties"] = cu.ClusterProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ClusterUpdate struct. +func (cu *ClusterUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cu.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + cu.Location = &location + } + case "sku": + if v != nil { + var sku AzureSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + cu.Sku = &sku + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + cu.Identity = &identity + } + case "properties": + if v != nil { + var clusterProperties ClusterProperties + err = json.Unmarshal(*v, &clusterProperties) + if err != nil { + return err + } + cu.ClusterProperties = &clusterProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cu.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cu.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cu.Type = &typeVar + } + } + } + + return nil +} + +// BasicDatabase class representing a Kusto database. +type BasicDatabase interface { + AsReadWriteDatabase() (*ReadWriteDatabase, bool) + AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) + AsDatabase() (*Database, bool) +} + +// Database class representing a Kusto database. +type Database struct { + autorest.Response `json:"-"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyFollowing' + Kind Kind `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +func unmarshalBasicDatabase(body []byte) (BasicDatabase, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindReadWrite): + var rwd ReadWriteDatabase + err := json.Unmarshal(body, &rwd) + return rwd, err + case string(KindReadOnlyFollowing): + var rofd ReadOnlyFollowingDatabase + err := json.Unmarshal(body, &rofd) + return rofd, err + default: + var d Database + err := json.Unmarshal(body, &d) + return d, err + } +} +func unmarshalBasicDatabaseArray(body []byte) ([]BasicDatabase, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dArray := make([]BasicDatabase, len(rawMessages)) + + for index, rawMessage := range rawMessages { + d, err := unmarshalBasicDatabase(*rawMessage) + if err != nil { + return nil, err + } + dArray[index] = d + } + return dArray, nil +} + +// MarshalJSON is the custom marshaler for Database. +func (d Database) MarshalJSON() ([]byte, error) { + d.Kind = KindDatabase + objectMap := make(map[string]interface{}) + if d.Location != nil { + objectMap["location"] = d.Location + } + if d.Kind != "" { + objectMap["kind"] = d.Kind + } + return json.Marshal(objectMap) +} + +// AsReadWriteDatabase is the BasicDatabase implementation for Database. +func (d Database) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { + return nil, false +} + +// AsReadOnlyFollowingDatabase is the BasicDatabase implementation for Database. +func (d Database) AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) { + return nil, false +} + +// AsDatabase is the BasicDatabase implementation for Database. +func (d Database) AsDatabase() (*Database, bool) { + return &d, true +} + +// AsBasicDatabase is the BasicDatabase implementation for Database. +func (d Database) AsBasicDatabase() (BasicDatabase, bool) { + return &d, true +} + +// DatabaseListResult the list Kusto databases operation response. +type DatabaseListResult struct { + autorest.Response `json:"-"` + // Value - The list of Kusto databases. + Value *[]BasicDatabase `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DatabaseListResult struct. +func (dlr *DatabaseListResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "value": + if v != nil { + value, err := unmarshalBasicDatabaseArray(*v) + if err != nil { + return err + } + dlr.Value = &value + } + } + } + + return nil +} + +// DatabaseModel ... +type DatabaseModel struct { + autorest.Response `json:"-"` + Value BasicDatabase `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DatabaseModel struct. +func (dm *DatabaseModel) UnmarshalJSON(body []byte) error { + d, err := unmarshalBasicDatabase(body) + if err != nil { + return err + } + dm.Value = d + + return nil +} + +// DatabasePrincipal a class representing database principal entity. +type DatabasePrincipal struct { + // Role - Database principal role. Possible values include: 'DatabasePrincipalRoleAdmin', 'DatabasePrincipalRoleIngestor', 'DatabasePrincipalRoleMonitor', 'DatabasePrincipalRoleUser', 'DatabasePrincipalRoleUnrestrictedViewer', 'DatabasePrincipalRoleViewer' + Role DatabasePrincipalRole `json:"role,omitempty"` + // Name - Database principal name. + Name *string `json:"name,omitempty"` + // Type - Database principal type. Possible values include: 'DatabasePrincipalTypeApp', 'DatabasePrincipalTypeGroup', 'DatabasePrincipalTypeUser' + Type DatabasePrincipalType `json:"type,omitempty"` + // Fqn - Database principal fully qualified name. + Fqn *string `json:"fqn,omitempty"` + // Email - Database principal email if exists. + Email *string `json:"email,omitempty"` + // AppID - Application id - relevant only for application principal type. + AppID *string `json:"appId,omitempty"` + // TenantName - READ-ONLY; The tenant name of the principal + TenantName *string `json:"tenantName,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatabasePrincipal. +func (dp DatabasePrincipal) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dp.Role != "" { + objectMap["role"] = dp.Role + } + if dp.Name != nil { + objectMap["name"] = dp.Name + } + if dp.Type != "" { + objectMap["type"] = dp.Type + } + if dp.Fqn != nil { + objectMap["fqn"] = dp.Fqn + } + if dp.Email != nil { + objectMap["email"] = dp.Email + } + if dp.AppID != nil { + objectMap["appId"] = dp.AppID + } + return json.Marshal(objectMap) +} + +// DatabasePrincipalAssignment class representing a database principal assignment. +type DatabasePrincipalAssignment struct { + autorest.Response `json:"-"` + // DatabasePrincipalProperties - The database principal. + *DatabasePrincipalProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatabasePrincipalAssignment. +func (dpa DatabasePrincipalAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dpa.DatabasePrincipalProperties != nil { + objectMap["properties"] = dpa.DatabasePrincipalProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DatabasePrincipalAssignment struct. +func (dpa *DatabasePrincipalAssignment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var databasePrincipalProperties DatabasePrincipalProperties + err = json.Unmarshal(*v, &databasePrincipalProperties) + if err != nil { + return err + } + dpa.DatabasePrincipalProperties = &databasePrincipalProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dpa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dpa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dpa.Type = &typeVar + } + } + } + + return nil +} + +// DatabasePrincipalAssignmentCheckNameRequest a principal assignment check name availability request. +type DatabasePrincipalAssignmentCheckNameRequest struct { + // Name - Principal Assignment resource name. + Name *string `json:"name,omitempty"` + // Type - The type of resource, Microsoft.Kusto/clusters/databases/principalAssignments. + Type *string `json:"type,omitempty"` +} + +// DatabasePrincipalAssignmentListResult the list Kusto database principal assignments operation response. +type DatabasePrincipalAssignmentListResult struct { + autorest.Response `json:"-"` + // Value - The list of Kusto database principal assignments. + Value *[]DatabasePrincipalAssignment `json:"value,omitempty"` +} + +// DatabasePrincipalAssignmentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type DatabasePrincipalAssignmentsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DatabasePrincipalAssignmentsClient) (DatabasePrincipalAssignment, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DatabasePrincipalAssignmentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DatabasePrincipalAssignmentsCreateOrUpdateFuture.Result. +func (future *DatabasePrincipalAssignmentsCreateOrUpdateFuture) result(client DatabasePrincipalAssignmentsClient) (dpa DatabasePrincipalAssignment, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dpa.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.DatabasePrincipalAssignmentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dpa.Response.Response, err = future.GetResult(sender); err == nil && dpa.Response.Response.StatusCode != http.StatusNoContent { + dpa, err = client.CreateOrUpdateResponder(dpa.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsCreateOrUpdateFuture", "Result", dpa.Response.Response, "Failure responding to request") + } + } + return +} + +// DatabasePrincipalAssignmentsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DatabasePrincipalAssignmentsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DatabasePrincipalAssignmentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DatabasePrincipalAssignmentsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DatabasePrincipalAssignmentsDeleteFuture.Result. +func (future *DatabasePrincipalAssignmentsDeleteFuture) result(client DatabasePrincipalAssignmentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.DatabasePrincipalAssignmentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DatabasePrincipalListRequest the list Kusto database principals operation request. +type DatabasePrincipalListRequest struct { + // Value - The list of Kusto database principals. + Value *[]DatabasePrincipal `json:"value,omitempty"` +} + +// DatabasePrincipalListResult the list Kusto database principals operation response. +type DatabasePrincipalListResult struct { + autorest.Response `json:"-"` + // Value - The list of Kusto database principals. + Value *[]DatabasePrincipal `json:"value,omitempty"` +} + +// DatabasePrincipalProperties a class representing database principal property. +type DatabasePrincipalProperties struct { + // PrincipalID - The principal ID assigned to the database principal. It can be a user email, application ID, or security group name. + PrincipalID *string `json:"principalId,omitempty"` + // Role - Database principal role. Possible values include: 'DatabasePrincipalRoleAdmin', 'DatabasePrincipalRoleIngestor', 'DatabasePrincipalRoleMonitor', 'DatabasePrincipalRoleUser', 'DatabasePrincipalRoleUnrestrictedViewer', 'DatabasePrincipalRoleViewer' + Role DatabasePrincipalRole `json:"role,omitempty"` + // TenantID - The tenant id of the principal + TenantID *string `json:"tenantId,omitempty"` + // PrincipalType - Principal type. Possible values include: 'PrincipalTypeApp', 'PrincipalTypeGroup', 'PrincipalTypeUser' + PrincipalType PrincipalType `json:"principalType,omitempty"` + // TenantName - READ-ONLY; The tenant name of the principal + TenantName *string `json:"tenantName,omitempty"` + // PrincipalName - READ-ONLY; The principal name + PrincipalName *string `json:"principalName,omitempty"` + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // AadObjectID - READ-ONLY; The service principal object id in AAD (Azure active directory) + AadObjectID *string `json:"aadObjectId,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatabasePrincipalProperties. +func (dpp DatabasePrincipalProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dpp.PrincipalID != nil { + objectMap["principalId"] = dpp.PrincipalID + } + if dpp.Role != "" { + objectMap["role"] = dpp.Role + } + if dpp.TenantID != nil { + objectMap["tenantId"] = dpp.TenantID + } + if dpp.PrincipalType != "" { + objectMap["principalType"] = dpp.PrincipalType + } + return json.Marshal(objectMap) +} + +// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DatabasesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DatabasesClient) (DatabaseModel, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DatabasesCreateOrUpdateFuture.Result. +func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (dm DatabaseModel, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dm.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.DatabasesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dm.Response.Response, err = future.GetResult(sender); err == nil && dm.Response.Response.StatusCode != http.StatusNoContent { + dm, err = client.CreateOrUpdateResponder(dm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", dm.Response.Response, "Failure responding to request") + } + } + return +} + +// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DatabasesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DatabasesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DatabasesDeleteFuture.Result. +func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.DatabasesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DatabaseStatistics a class that contains database statistics information. +type DatabaseStatistics struct { + // Size - The database size - the total size of compressed data and index in bytes. + Size *float64 `json:"size,omitempty"` +} + +// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DatabasesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DatabasesClient) (DatabaseModel, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DatabasesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DatabasesUpdateFuture.Result. +func (future *DatabasesUpdateFuture) result(client DatabasesClient) (dm DatabaseModel, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dm.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.DatabasesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dm.Response.Response, err = future.GetResult(sender); err == nil && dm.Response.Response.StatusCode != http.StatusNoContent { + dm, err = client.UpdateResponder(dm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", dm.Response.Response, "Failure responding to request") + } + } + return +} + +// BasicDataConnection class representing an data connection. +type BasicDataConnection interface { + AsEventHubDataConnection() (*EventHubDataConnection, bool) + AsIotHubDataConnection() (*IotHubDataConnection, bool) + AsEventGridDataConnection() (*EventGridDataConnection, bool) + AsDataConnection() (*DataConnection, bool) +} + +// DataConnection class representing an data connection. +type DataConnection struct { + autorest.Response `json:"-"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectionKindDataConnection', 'KindBasicDataConnectionKindEventHub', 'KindBasicDataConnectionKindIotHub', 'KindBasicDataConnectionKindEventGrid' + Kind KindBasicDataConnection `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +func unmarshalBasicDataConnection(body []byte) (BasicDataConnection, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBasicDataConnectionKindEventHub): + var ehdc EventHubDataConnection + err := json.Unmarshal(body, &ehdc) + return ehdc, err + case string(KindBasicDataConnectionKindIotHub): + var ihdc IotHubDataConnection + err := json.Unmarshal(body, &ihdc) + return ihdc, err + case string(KindBasicDataConnectionKindEventGrid): + var egdc EventGridDataConnection + err := json.Unmarshal(body, &egdc) + return egdc, err + default: + var dc DataConnection + err := json.Unmarshal(body, &dc) + return dc, err + } +} +func unmarshalBasicDataConnectionArray(body []byte) ([]BasicDataConnection, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dcArray := make([]BasicDataConnection, len(rawMessages)) + + for index, rawMessage := range rawMessages { + dc, err := unmarshalBasicDataConnection(*rawMessage) + if err != nil { + return nil, err + } + dcArray[index] = dc + } + return dcArray, nil +} + +// MarshalJSON is the custom marshaler for DataConnection. +func (dc DataConnection) MarshalJSON() ([]byte, error) { + dc.Kind = KindBasicDataConnectionKindDataConnection + objectMap := make(map[string]interface{}) + if dc.Location != nil { + objectMap["location"] = dc.Location + } + if dc.Kind != "" { + objectMap["kind"] = dc.Kind + } + return json.Marshal(objectMap) +} + +// AsEventHubDataConnection is the BasicDataConnection implementation for DataConnection. +func (dc DataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { + return nil, false +} + +// AsIotHubDataConnection is the BasicDataConnection implementation for DataConnection. +func (dc DataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { + return nil, false +} + +// AsEventGridDataConnection is the BasicDataConnection implementation for DataConnection. +func (dc DataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { + return nil, false +} + +// AsDataConnection is the BasicDataConnection implementation for DataConnection. +func (dc DataConnection) AsDataConnection() (*DataConnection, bool) { + return &dc, true +} + +// AsBasicDataConnection is the BasicDataConnection implementation for DataConnection. +func (dc DataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { + return &dc, true +} + +// DataConnectionCheckNameRequest a data connection check name availability request. +type DataConnectionCheckNameRequest struct { + // Name - Data Connection name. + Name *string `json:"name,omitempty"` + // Type - The type of resource, Microsoft.Kusto/clusters/databases/dataConnections. + Type *string `json:"type,omitempty"` +} + +// DataConnectionListResult the list Kusto data connections operation response. +type DataConnectionListResult struct { + autorest.Response `json:"-"` + // Value - The list of Kusto data connections. + Value *[]BasicDataConnection `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DataConnectionListResult struct. +func (dclr *DataConnectionListResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "value": + if v != nil { + value, err := unmarshalBasicDataConnectionArray(*v) + if err != nil { + return err + } + dclr.Value = &value + } + } + } + + return nil +} + +// DataConnectionModel ... +type DataConnectionModel struct { + autorest.Response `json:"-"` + Value BasicDataConnection `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DataConnectionModel struct. +func (dcm *DataConnectionModel) UnmarshalJSON(body []byte) error { + dc, err := unmarshalBasicDataConnection(body) + if err != nil { + return err + } + dcm.Value = dc + + return nil +} + +// DataConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DataConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DataConnectionsClient) (DataConnectionModel, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DataConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DataConnectionsCreateOrUpdateFuture.Result. +func (future *DataConnectionsCreateOrUpdateFuture) result(client DataConnectionsClient) (dcm DataConnectionModel, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DataConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dcm.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dcm.Response.Response, err = future.GetResult(sender); err == nil && dcm.Response.Response.StatusCode != http.StatusNoContent { + dcm, err = client.CreateOrUpdateResponder(dcm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DataConnectionsCreateOrUpdateFuture", "Result", dcm.Response.Response, "Failure responding to request") + } + } + return +} + +// DataConnectionsDataConnectionValidationMethodFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type DataConnectionsDataConnectionValidationMethodFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DataConnectionsClient) (DataConnectionValidationListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DataConnectionsDataConnectionValidationMethodFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DataConnectionsDataConnectionValidationMethodFuture.Result. +func (future *DataConnectionsDataConnectionValidationMethodFuture) result(client DataConnectionsClient) (dcvlr DataConnectionValidationListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DataConnectionsDataConnectionValidationMethodFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dcvlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsDataConnectionValidationMethodFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dcvlr.Response.Response, err = future.GetResult(sender); err == nil && dcvlr.Response.Response.StatusCode != http.StatusNoContent { + dcvlr, err = client.DataConnectionValidationMethodResponder(dcvlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DataConnectionsDataConnectionValidationMethodFuture", "Result", dcvlr.Response.Response, "Failure responding to request") + } + } + return +} + +// DataConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DataConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DataConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DataConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DataConnectionsDeleteFuture.Result. +func (future *DataConnectionsDeleteFuture) result(client DataConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DataConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DataConnectionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DataConnectionsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DataConnectionsClient) (DataConnectionModel, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DataConnectionsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DataConnectionsUpdateFuture.Result. +func (future *DataConnectionsUpdateFuture) result(client DataConnectionsClient) (dcm DataConnectionModel, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DataConnectionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dcm.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dcm.Response.Response, err = future.GetResult(sender); err == nil && dcm.Response.Response.StatusCode != http.StatusNoContent { + dcm, err = client.UpdateResponder(dcm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DataConnectionsUpdateFuture", "Result", dcm.Response.Response, "Failure responding to request") + } + } + return +} + +// DataConnectionValidation class representing an data connection validation. +type DataConnectionValidation struct { + // DataConnectionName - The name of the data connection. + DataConnectionName *string `json:"dataConnectionName,omitempty"` + // Properties - The data connection properties to validate. + Properties BasicDataConnection `json:"properties,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DataConnectionValidation struct. +func (dcv *DataConnectionValidation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "dataConnectionName": + if v != nil { + var dataConnectionName string + err = json.Unmarshal(*v, &dataConnectionName) + if err != nil { + return err + } + dcv.DataConnectionName = &dataConnectionName + } + case "properties": + if v != nil { + properties, err := unmarshalBasicDataConnection(*v) + if err != nil { + return err + } + dcv.Properties = properties + } + } + } + + return nil +} + +// DataConnectionValidationListResult the list Kusto data connection validation result. +type DataConnectionValidationListResult struct { + autorest.Response `json:"-"` + // Value - The list of Kusto data connection validation errors. + Value *[]DataConnectionValidationResult `json:"value,omitempty"` +} + +// DataConnectionValidationResult the result returned from a data connection validation request. +type DataConnectionValidationResult struct { + // ErrorMessage - A message which indicates a problem in data connection validation. + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// DiagnoseVirtualNetworkResult ... +type DiagnoseVirtualNetworkResult struct { + autorest.Response `json:"-"` + // Findings - The list of network connectivity diagnostic finding + Findings *[]string `json:"findings,omitempty"` +} + +// EndpointDependency a domain name that a service is reached at, including details of the current +// connection status. +type EndpointDependency struct { + // DomainName - The domain name of the dependency. + DomainName *string `json:"domainName,omitempty"` + // EndpointDetails - The ports used when connecting to DomainName. + EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` +} + +// EndpointDetail current TCP connectivity information from the Kusto cluster to a single endpoint. +type EndpointDetail struct { + // Port - The port an endpoint is connected to. + Port *int32 `json:"port,omitempty"` +} + +// EventGridConnectionProperties class representing the Kusto event grid connection properties. +type EventGridConnectionProperties struct { + // StorageAccountResourceID - The resource ID of the storage account where the data resides. + StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"` + // EventGridResourceID - The resource ID of the event grid that is subscribed to the storage account events. + EventGridResourceID *string `json:"eventGridResourceId,omitempty"` + // EventHubResourceID - The resource ID where the event grid is configured to send events. + EventHubResourceID *string `json:"eventHubResourceId,omitempty"` + // ConsumerGroup - The event hub consumer group. + ConsumerGroup *string `json:"consumerGroup,omitempty"` + // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. + TableName *string `json:"tableName,omitempty"` + // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. + MappingRuleName *string `json:"mappingRuleName,omitempty"` + // DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'EventGridDataFormatMULTIJSON', 'EventGridDataFormatJSON', 'EventGridDataFormatCSV', 'EventGridDataFormatTSV', 'EventGridDataFormatSCSV', 'EventGridDataFormatSOHSV', 'EventGridDataFormatPSV', 'EventGridDataFormatTXT', 'EventGridDataFormatRAW', 'EventGridDataFormatSINGLEJSON', 'EventGridDataFormatAVRO', 'EventGridDataFormatTSVE', 'EventGridDataFormatPARQUET', 'EventGridDataFormatORC', 'EventGridDataFormatAPACHEAVRO', 'EventGridDataFormatW3CLOGFILE' + DataFormat EventGridDataFormat `json:"dataFormat,omitempty"` + // IgnoreFirstRecord - A Boolean value that, if set to true, indicates that ingestion should ignore the first record of every file + IgnoreFirstRecord *bool `json:"ignoreFirstRecord,omitempty"` + // BlobStorageEventType - The name of blob storage event type to process. Possible values include: 'BlobStorageEventTypeMicrosoftStorageBlobCreated', 'BlobStorageEventTypeMicrosoftStorageBlobRenamed' + BlobStorageEventType BlobStorageEventType `json:"blobStorageEventType,omitempty"` + // ManagedIdentityResourceID - The resource ID of a managed identity (system or user assigned) to be used to authenticate with event hub and storage account. + ManagedIdentityResourceID *string `json:"managedIdentityResourceId,omitempty"` + // ManagedIdentityObjectID - READ-ONLY; The object ID of managedIdentityResourceId + ManagedIdentityObjectID *string `json:"managedIdentityObjectId,omitempty"` + // DatabaseRouting - Indication for database routing information from the data connection, by default only database routing information is allowed. Possible values include: 'DatabaseRoutingSingle', 'DatabaseRoutingMulti' + DatabaseRouting DatabaseRouting `json:"databaseRouting,omitempty"` + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventGridConnectionProperties. +func (egcp EventGridConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if egcp.StorageAccountResourceID != nil { + objectMap["storageAccountResourceId"] = egcp.StorageAccountResourceID + } + if egcp.EventGridResourceID != nil { + objectMap["eventGridResourceId"] = egcp.EventGridResourceID + } + if egcp.EventHubResourceID != nil { + objectMap["eventHubResourceId"] = egcp.EventHubResourceID + } + if egcp.ConsumerGroup != nil { + objectMap["consumerGroup"] = egcp.ConsumerGroup + } + if egcp.TableName != nil { + objectMap["tableName"] = egcp.TableName + } + if egcp.MappingRuleName != nil { + objectMap["mappingRuleName"] = egcp.MappingRuleName + } + if egcp.DataFormat != "" { + objectMap["dataFormat"] = egcp.DataFormat + } + if egcp.IgnoreFirstRecord != nil { + objectMap["ignoreFirstRecord"] = egcp.IgnoreFirstRecord + } + if egcp.BlobStorageEventType != "" { + objectMap["blobStorageEventType"] = egcp.BlobStorageEventType + } + if egcp.ManagedIdentityResourceID != nil { + objectMap["managedIdentityResourceId"] = egcp.ManagedIdentityResourceID + } + if egcp.DatabaseRouting != "" { + objectMap["databaseRouting"] = egcp.DatabaseRouting + } + return json.Marshal(objectMap) +} + +// EventGridDataConnection class representing an Event Grid data connection. +type EventGridDataConnection struct { + // EventGridConnectionProperties - The properties of the Event Grid data connection. + *EventGridConnectionProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectionKindDataConnection', 'KindBasicDataConnectionKindEventHub', 'KindBasicDataConnectionKindIotHub', 'KindBasicDataConnectionKindEventGrid' + Kind KindBasicDataConnection `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventGridDataConnection. +func (egdc EventGridDataConnection) MarshalJSON() ([]byte, error) { + egdc.Kind = KindBasicDataConnectionKindEventGrid + objectMap := make(map[string]interface{}) + if egdc.EventGridConnectionProperties != nil { + objectMap["properties"] = egdc.EventGridConnectionProperties + } + if egdc.Location != nil { + objectMap["location"] = egdc.Location + } + if egdc.Kind != "" { + objectMap["kind"] = egdc.Kind + } + return json.Marshal(objectMap) +} + +// AsEventHubDataConnection is the BasicDataConnection implementation for EventGridDataConnection. +func (egdc EventGridDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { + return nil, false +} + +// AsIotHubDataConnection is the BasicDataConnection implementation for EventGridDataConnection. +func (egdc EventGridDataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { + return nil, false +} + +// AsEventGridDataConnection is the BasicDataConnection implementation for EventGridDataConnection. +func (egdc EventGridDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { + return &egdc, true +} + +// AsDataConnection is the BasicDataConnection implementation for EventGridDataConnection. +func (egdc EventGridDataConnection) AsDataConnection() (*DataConnection, bool) { + return nil, false +} + +// AsBasicDataConnection is the BasicDataConnection implementation for EventGridDataConnection. +func (egdc EventGridDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { + return &egdc, true +} + +// UnmarshalJSON is the custom unmarshaler for EventGridDataConnection struct. +func (egdc *EventGridDataConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var eventGridConnectionProperties EventGridConnectionProperties + err = json.Unmarshal(*v, &eventGridConnectionProperties) + if err != nil { + return err + } + egdc.EventGridConnectionProperties = &eventGridConnectionProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + egdc.Location = &location + } + case "kind": + if v != nil { + var kind KindBasicDataConnection + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + egdc.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + egdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + egdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + egdc.Type = &typeVar + } + } + } + + return nil +} + +// EventHubConnectionProperties class representing the Kusto event hub connection properties. +type EventHubConnectionProperties struct { + // EventHubResourceID - The resource ID of the event hub to be used to create a data connection. + EventHubResourceID *string `json:"eventHubResourceId,omitempty"` + // ConsumerGroup - The event hub consumer group. + ConsumerGroup *string `json:"consumerGroup,omitempty"` + // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. + TableName *string `json:"tableName,omitempty"` + // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. + MappingRuleName *string `json:"mappingRuleName,omitempty"` + // DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'EventHubDataFormatMULTIJSON', 'EventHubDataFormatJSON', 'EventHubDataFormatCSV', 'EventHubDataFormatTSV', 'EventHubDataFormatSCSV', 'EventHubDataFormatSOHSV', 'EventHubDataFormatPSV', 'EventHubDataFormatTXT', 'EventHubDataFormatRAW', 'EventHubDataFormatSINGLEJSON', 'EventHubDataFormatAVRO', 'EventHubDataFormatTSVE', 'EventHubDataFormatPARQUET', 'EventHubDataFormatORC', 'EventHubDataFormatAPACHEAVRO', 'EventHubDataFormatW3CLOGFILE' + DataFormat EventHubDataFormat `json:"dataFormat,omitempty"` + // EventSystemProperties - System properties of the event hub + EventSystemProperties *[]string `json:"eventSystemProperties,omitempty"` + // Compression - The event hub messages compression type. Possible values include: 'CompressionNone', 'CompressionGZip' + Compression Compression `json:"compression,omitempty"` + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ManagedIdentityResourceID - Empty for non-managed identity based data connection. For system assigned identity, provide cluster resource Id. For user assigned identity (UAI) provide the UAI resource Id. + ManagedIdentityResourceID *string `json:"managedIdentityResourceId,omitempty"` + // ManagedIdentityObjectID - READ-ONLY; The object ID of the managedIdentityResourceId + ManagedIdentityObjectID *string `json:"managedIdentityObjectId,omitempty"` + // DatabaseRouting - Indication for database routing information from the data connection, by default only database routing information is allowed. Possible values include: 'DatabaseRoutingSingle', 'DatabaseRoutingMulti' + DatabaseRouting DatabaseRouting `json:"databaseRouting,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventHubConnectionProperties. +func (ehcp EventHubConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ehcp.EventHubResourceID != nil { + objectMap["eventHubResourceId"] = ehcp.EventHubResourceID + } + if ehcp.ConsumerGroup != nil { + objectMap["consumerGroup"] = ehcp.ConsumerGroup + } + if ehcp.TableName != nil { + objectMap["tableName"] = ehcp.TableName + } + if ehcp.MappingRuleName != nil { + objectMap["mappingRuleName"] = ehcp.MappingRuleName + } + if ehcp.DataFormat != "" { + objectMap["dataFormat"] = ehcp.DataFormat + } + if ehcp.EventSystemProperties != nil { + objectMap["eventSystemProperties"] = ehcp.EventSystemProperties + } + if ehcp.Compression != "" { + objectMap["compression"] = ehcp.Compression + } + if ehcp.ManagedIdentityResourceID != nil { + objectMap["managedIdentityResourceId"] = ehcp.ManagedIdentityResourceID + } + if ehcp.DatabaseRouting != "" { + objectMap["databaseRouting"] = ehcp.DatabaseRouting + } + return json.Marshal(objectMap) +} + +// EventHubDataConnection class representing an event hub data connection. +type EventHubDataConnection struct { + // EventHubConnectionProperties - The Event Hub data connection properties to validate. + *EventHubConnectionProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectionKindDataConnection', 'KindBasicDataConnectionKindEventHub', 'KindBasicDataConnectionKindIotHub', 'KindBasicDataConnectionKindEventGrid' + Kind KindBasicDataConnection `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventHubDataConnection. +func (ehdc EventHubDataConnection) MarshalJSON() ([]byte, error) { + ehdc.Kind = KindBasicDataConnectionKindEventHub + objectMap := make(map[string]interface{}) + if ehdc.EventHubConnectionProperties != nil { + objectMap["properties"] = ehdc.EventHubConnectionProperties + } + if ehdc.Location != nil { + objectMap["location"] = ehdc.Location + } + if ehdc.Kind != "" { + objectMap["kind"] = ehdc.Kind + } + return json.Marshal(objectMap) +} + +// AsEventHubDataConnection is the BasicDataConnection implementation for EventHubDataConnection. +func (ehdc EventHubDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { + return &ehdc, true +} + +// AsIotHubDataConnection is the BasicDataConnection implementation for EventHubDataConnection. +func (ehdc EventHubDataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { + return nil, false +} + +// AsEventGridDataConnection is the BasicDataConnection implementation for EventHubDataConnection. +func (ehdc EventHubDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { + return nil, false +} + +// AsDataConnection is the BasicDataConnection implementation for EventHubDataConnection. +func (ehdc EventHubDataConnection) AsDataConnection() (*DataConnection, bool) { + return nil, false +} + +// AsBasicDataConnection is the BasicDataConnection implementation for EventHubDataConnection. +func (ehdc EventHubDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { + return &ehdc, true +} + +// UnmarshalJSON is the custom unmarshaler for EventHubDataConnection struct. +func (ehdc *EventHubDataConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var eventHubConnectionProperties EventHubConnectionProperties + err = json.Unmarshal(*v, &eventHubConnectionProperties) + if err != nil { + return err + } + ehdc.EventHubConnectionProperties = &eventHubConnectionProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ehdc.Location = &location + } + case "kind": + if v != nil { + var kind KindBasicDataConnection + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ehdc.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ehdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ehdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ehdc.Type = &typeVar + } + } + } + + return nil +} + +// FollowerDatabaseDefinition a class representing follower database request. +type FollowerDatabaseDefinition struct { + // ClusterResourceID - Resource id of the cluster that follows a database owned by this cluster. + ClusterResourceID *string `json:"clusterResourceId,omitempty"` + // AttachedDatabaseConfigurationName - Resource name of the attached database configuration in the follower cluster. + AttachedDatabaseConfigurationName *string `json:"attachedDatabaseConfigurationName,omitempty"` + // DatabaseName - READ-ONLY; The database name owned by this cluster that was followed. * in case following all databases. + DatabaseName *string `json:"databaseName,omitempty"` +} + +// MarshalJSON is the custom marshaler for FollowerDatabaseDefinition. +func (fdd FollowerDatabaseDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fdd.ClusterResourceID != nil { + objectMap["clusterResourceId"] = fdd.ClusterResourceID + } + if fdd.AttachedDatabaseConfigurationName != nil { + objectMap["attachedDatabaseConfigurationName"] = fdd.AttachedDatabaseConfigurationName + } + return json.Marshal(objectMap) +} + +// FollowerDatabaseListResult the list Kusto database principals operation response. +type FollowerDatabaseListResult struct { + autorest.Response `json:"-"` + // Value - The list of follower database result. + Value *[]FollowerDatabaseDefinition `json:"value,omitempty"` +} + +// Identity identity for the resource. +type Identity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove all identities. Possible values include: 'IdentityTypeNone', 'IdentityTypeSystemAssigned', 'IdentityTypeUserAssigned', 'IdentityTypeSystemAssignedUserAssigned' + Type IdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with the Kusto cluster. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*IdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + if i.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = i.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// IdentityUserAssignedIdentitiesValue ... +type IdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for IdentityUserAssignedIdentitiesValue. +func (iAiv IdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// IotHubConnectionProperties class representing the Kusto Iot hub connection properties. +type IotHubConnectionProperties struct { + // IotHubResourceID - The resource ID of the Iot hub to be used to create a data connection. + IotHubResourceID *string `json:"iotHubResourceId,omitempty"` + // ConsumerGroup - The iot hub consumer group. + ConsumerGroup *string `json:"consumerGroup,omitempty"` + // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. + TableName *string `json:"tableName,omitempty"` + // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. + MappingRuleName *string `json:"mappingRuleName,omitempty"` + // DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'IotHubDataFormatMULTIJSON', 'IotHubDataFormatJSON', 'IotHubDataFormatCSV', 'IotHubDataFormatTSV', 'IotHubDataFormatSCSV', 'IotHubDataFormatSOHSV', 'IotHubDataFormatPSV', 'IotHubDataFormatTXT', 'IotHubDataFormatRAW', 'IotHubDataFormatSINGLEJSON', 'IotHubDataFormatAVRO', 'IotHubDataFormatTSVE', 'IotHubDataFormatPARQUET', 'IotHubDataFormatORC', 'IotHubDataFormatAPACHEAVRO', 'IotHubDataFormatW3CLOGFILE' + DataFormat IotHubDataFormat `json:"dataFormat,omitempty"` + // EventSystemProperties - System properties of the iot hub + EventSystemProperties *[]string `json:"eventSystemProperties,omitempty"` + // SharedAccessPolicyName - The name of the share access policy + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` + // DatabaseRouting - Indication for database routing information from the data connection, by default only database routing information is allowed. Possible values include: 'DatabaseRoutingSingle', 'DatabaseRoutingMulti' + DatabaseRouting DatabaseRouting `json:"databaseRouting,omitempty"` + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for IotHubConnectionProperties. +func (ihcp IotHubConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ihcp.IotHubResourceID != nil { + objectMap["iotHubResourceId"] = ihcp.IotHubResourceID + } + if ihcp.ConsumerGroup != nil { + objectMap["consumerGroup"] = ihcp.ConsumerGroup + } + if ihcp.TableName != nil { + objectMap["tableName"] = ihcp.TableName + } + if ihcp.MappingRuleName != nil { + objectMap["mappingRuleName"] = ihcp.MappingRuleName + } + if ihcp.DataFormat != "" { + objectMap["dataFormat"] = ihcp.DataFormat + } + if ihcp.EventSystemProperties != nil { + objectMap["eventSystemProperties"] = ihcp.EventSystemProperties + } + if ihcp.SharedAccessPolicyName != nil { + objectMap["sharedAccessPolicyName"] = ihcp.SharedAccessPolicyName + } + if ihcp.DatabaseRouting != "" { + objectMap["databaseRouting"] = ihcp.DatabaseRouting + } + return json.Marshal(objectMap) +} + +// IotHubDataConnection class representing an iot hub data connection. +type IotHubDataConnection struct { + // IotHubConnectionProperties - The Iot Hub data connection properties. + *IotHubConnectionProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Kind - Possible values include: 'KindBasicDataConnectionKindDataConnection', 'KindBasicDataConnectionKindEventHub', 'KindBasicDataConnectionKindIotHub', 'KindBasicDataConnectionKindEventGrid' + Kind KindBasicDataConnection `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for IotHubDataConnection. +func (ihdc IotHubDataConnection) MarshalJSON() ([]byte, error) { + ihdc.Kind = KindBasicDataConnectionKindIotHub + objectMap := make(map[string]interface{}) + if ihdc.IotHubConnectionProperties != nil { + objectMap["properties"] = ihdc.IotHubConnectionProperties + } + if ihdc.Location != nil { + objectMap["location"] = ihdc.Location + } + if ihdc.Kind != "" { + objectMap["kind"] = ihdc.Kind + } + return json.Marshal(objectMap) +} + +// AsEventHubDataConnection is the BasicDataConnection implementation for IotHubDataConnection. +func (ihdc IotHubDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { + return nil, false +} + +// AsIotHubDataConnection is the BasicDataConnection implementation for IotHubDataConnection. +func (ihdc IotHubDataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { + return &ihdc, true +} + +// AsEventGridDataConnection is the BasicDataConnection implementation for IotHubDataConnection. +func (ihdc IotHubDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { + return nil, false +} + +// AsDataConnection is the BasicDataConnection implementation for IotHubDataConnection. +func (ihdc IotHubDataConnection) AsDataConnection() (*DataConnection, bool) { + return nil, false +} + +// AsBasicDataConnection is the BasicDataConnection implementation for IotHubDataConnection. +func (ihdc IotHubDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { + return &ihdc, true +} + +// UnmarshalJSON is the custom unmarshaler for IotHubDataConnection struct. +func (ihdc *IotHubDataConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var iotHubConnectionProperties IotHubConnectionProperties + err = json.Unmarshal(*v, &iotHubConnectionProperties) + if err != nil { + return err + } + ihdc.IotHubConnectionProperties = &iotHubConnectionProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ihdc.Location = &location + } + case "kind": + if v != nil { + var kind KindBasicDataConnection + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ihdc.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ihdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ihdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ihdc.Type = &typeVar + } + } + } + + return nil +} + +// KeyVaultProperties properties of the key vault. +type KeyVaultProperties struct { + // KeyName - The name of the key vault key. + KeyName *string `json:"keyName,omitempty"` + // KeyVersion - The version of the key vault key. + KeyVersion *string `json:"keyVersion,omitempty"` + // KeyVaultURI - The Uri of the key vault. + KeyVaultURI *string `json:"keyVaultUri,omitempty"` + // UserIdentity - The user assigned identity (ARM resource id) that has access to the key. + UserIdentity *string `json:"userIdentity,omitempty"` +} + +// LanguageExtension the language extension object. +type LanguageExtension struct { + // LanguageExtensionName - The language extension name. Possible values include: 'LanguageExtensionNamePYTHON', 'LanguageExtensionNameR' + LanguageExtensionName LanguageExtensionName `json:"languageExtensionName,omitempty"` +} + +// LanguageExtensionsList the list of language extension objects. +type LanguageExtensionsList struct { + autorest.Response `json:"-"` + // Value - The list of language extensions. + Value *[]LanguageExtension `json:"value,omitempty"` +} + +// ListResourceSkusResult list of available SKUs for a Kusto Cluster. +type ListResourceSkusResult struct { + autorest.Response `json:"-"` + // Value - The collection of available SKUs for an existing resource. + Value *[]AzureResourceSku `json:"value,omitempty"` +} + +// ManagedPrivateEndpoint class representing a managed private endpoint. +type ManagedPrivateEndpoint struct { + autorest.Response `json:"-"` + // ManagedPrivateEndpointProperties - A managed private endpoint. + *ManagedPrivateEndpointProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedPrivateEndpoint. +func (mpe ManagedPrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mpe.ManagedPrivateEndpointProperties != nil { + objectMap["properties"] = mpe.ManagedPrivateEndpointProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedPrivateEndpoint struct. +func (mpe *ManagedPrivateEndpoint) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managedPrivateEndpointProperties ManagedPrivateEndpointProperties + err = json.Unmarshal(*v, &managedPrivateEndpointProperties) + if err != nil { + return err + } + mpe.ManagedPrivateEndpointProperties = &managedPrivateEndpointProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mpe.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mpe.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mpe.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mpe.Type = &typeVar + } + } + } + + return nil +} + +// ManagedPrivateEndpointListResult the list managed private endpoints operation response. +type ManagedPrivateEndpointListResult struct { + autorest.Response `json:"-"` + // Value - The list of managed private endpoints. + Value *[]ManagedPrivateEndpoint `json:"value,omitempty"` +} + +// ManagedPrivateEndpointProperties a class representing the properties of a managed private endpoint +// object. +type ManagedPrivateEndpointProperties struct { + // PrivateLinkResourceID - The ARM resource ID of the resource for which the managed private endpoint is created. + PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` + // PrivateLinkResourceRegion - The region of the resource to which the managed private endpoint is created. + PrivateLinkResourceRegion *string `json:"privateLinkResourceRegion,omitempty"` + // GroupID - The groupId in which the managed private endpoint is created. + GroupID *string `json:"groupId,omitempty"` + // RequestMessage - The user request message. + RequestMessage *string `json:"requestMessage,omitempty"` + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedPrivateEndpointProperties. +func (mpep ManagedPrivateEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mpep.PrivateLinkResourceID != nil { + objectMap["privateLinkResourceId"] = mpep.PrivateLinkResourceID + } + if mpep.PrivateLinkResourceRegion != nil { + objectMap["privateLinkResourceRegion"] = mpep.PrivateLinkResourceRegion + } + if mpep.GroupID != nil { + objectMap["groupId"] = mpep.GroupID + } + if mpep.RequestMessage != nil { + objectMap["requestMessage"] = mpep.RequestMessage + } + return json.Marshal(objectMap) +} + +// ManagedPrivateEndpointsCheckNameRequest the result returned from a managedPrivateEndpoints check name +// availability request. +type ManagedPrivateEndpointsCheckNameRequest struct { + // Name - Managed private endpoint resource name. + Name *string `json:"name,omitempty"` + // Type - The type of resource, for instance Microsoft.Kusto/clusters/managedPrivateEndpoints. + Type *string `json:"type,omitempty"` +} + +// ManagedPrivateEndpointsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type ManagedPrivateEndpointsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedPrivateEndpointsClient) (ManagedPrivateEndpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedPrivateEndpointsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedPrivateEndpointsCreateOrUpdateFuture.Result. +func (future *ManagedPrivateEndpointsCreateOrUpdateFuture) result(client ManagedPrivateEndpointsClient) (mpe ManagedPrivateEndpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mpe.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ManagedPrivateEndpointsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mpe.Response.Response, err = future.GetResult(sender); err == nil && mpe.Response.Response.StatusCode != http.StatusNoContent { + mpe, err = client.CreateOrUpdateResponder(mpe.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsCreateOrUpdateFuture", "Result", mpe.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedPrivateEndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedPrivateEndpointsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedPrivateEndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedPrivateEndpointsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedPrivateEndpointsDeleteFuture.Result. +func (future *ManagedPrivateEndpointsDeleteFuture) result(client ManagedPrivateEndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ManagedPrivateEndpointsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedPrivateEndpointsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedPrivateEndpointsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedPrivateEndpointsClient) (ManagedPrivateEndpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedPrivateEndpointsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedPrivateEndpointsUpdateFuture.Result. +func (future *ManagedPrivateEndpointsUpdateFuture) result(client ManagedPrivateEndpointsClient) (mpe ManagedPrivateEndpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mpe.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ManagedPrivateEndpointsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mpe.Response.Response, err = future.GetResult(sender); err == nil && mpe.Response.Response.StatusCode != http.StatusNoContent { + mpe, err = client.UpdateResponder(mpe.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsUpdateFuture", "Result", mpe.Response.Response, "Failure responding to request") + } + } + return +} + +// Operation ... +type Operation struct { + // Name - This is of the format {provider}/{resource}/{operation}. + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` + Origin *string `json:"origin,omitempty"` + Properties interface{} `json:"properties,omitempty"` +} + +// OperationDisplay ... +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + // Operation - For example: read, write, delete. + Operation *string `json:"operation,omitempty"` + Resource *string `json:"resource,omitempty"` + Description *string `json:"description,omitempty"` +} + +// OperationListResult ... +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// OperationResult operation Result Entity. +type OperationResult struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Status - status of the Operation result. Possible values include: 'StatusSucceeded', 'StatusCanceled', 'StatusFailed', 'StatusRunning' + Status Status `json:"status,omitempty"` + // StartTime - The operation start time + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - The operation end time + EndTime *date.Time `json:"endTime,omitempty"` + // PercentComplete - Percentage completed. + PercentComplete *float64 `json:"percentComplete,omitempty"` + // OperationResultProperties - Properties of the operation results + *OperationResultProperties `json:"properties,omitempty"` + // OperationResultErrorProperties - Object that contains the error code and message if the operation failed. + *OperationResultErrorProperties `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationResult. +func (or OperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if or.Status != "" { + objectMap["status"] = or.Status + } + if or.StartTime != nil { + objectMap["startTime"] = or.StartTime + } + if or.EndTime != nil { + objectMap["endTime"] = or.EndTime + } + if or.PercentComplete != nil { + objectMap["percentComplete"] = or.PercentComplete + } + if or.OperationResultProperties != nil { + objectMap["properties"] = or.OperationResultProperties + } + if or.OperationResultErrorProperties != nil { + objectMap["error"] = or.OperationResultErrorProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OperationResult struct. +func (or *OperationResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + or.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + or.Name = &name + } + case "status": + if v != nil { + var status Status + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + or.Status = status + } + case "startTime": + if v != nil { + var startTime date.Time + err = json.Unmarshal(*v, &startTime) + if err != nil { + return err + } + or.StartTime = &startTime + } + case "endTime": + if v != nil { + var endTime date.Time + err = json.Unmarshal(*v, &endTime) + if err != nil { + return err + } + or.EndTime = &endTime + } + case "percentComplete": + if v != nil { + var percentComplete float64 + err = json.Unmarshal(*v, &percentComplete) + if err != nil { + return err + } + or.PercentComplete = &percentComplete + } + case "properties": + if v != nil { + var operationResultProperties OperationResultProperties + err = json.Unmarshal(*v, &operationResultProperties) + if err != nil { + return err + } + or.OperationResultProperties = &operationResultProperties + } + case "error": + if v != nil { + var operationResultErrorProperties OperationResultErrorProperties + err = json.Unmarshal(*v, &operationResultErrorProperties) + if err != nil { + return err + } + or.OperationResultErrorProperties = &operationResultErrorProperties + } + } + } + + return nil +} + +// OperationResultErrorProperties operation result error properties +type OperationResultErrorProperties struct { + // Code - The code of the error. + Code *string `json:"code,omitempty"` + // Message - The error message. + Message *string `json:"message,omitempty"` +} + +// OperationResultProperties operation result properties +type OperationResultProperties struct { + // OperationKind - The kind of the operation. + OperationKind *string `json:"operationKind,omitempty"` + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // OperationState - The state of the operation. + OperationState *string `json:"operationState,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationResultProperties. +func (orp OperationResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if orp.OperationKind != nil { + objectMap["operationKind"] = orp.OperationKind + } + if orp.OperationState != nil { + objectMap["operationState"] = orp.OperationState + } + return json.Marshal(objectMap) +} + +// OptimizedAutoscale a class that contains the optimized auto scale definition. +type OptimizedAutoscale struct { + // Version - The version of the template defined, for instance 1. + Version *int32 `json:"version,omitempty"` + // IsEnabled - A boolean value that indicate if the optimized autoscale feature is enabled or not. + IsEnabled *bool `json:"isEnabled,omitempty"` + // Minimum - Minimum allowed instances count. + Minimum *int32 `json:"minimum,omitempty"` + // Maximum - Maximum allowed instances count. + Maximum *int32 `json:"maximum,omitempty"` +} + +// OutboundNetworkDependenciesEndpoint endpoints accessed for a common purpose that the Kusto Service +// Environment requires outbound network access to. +type OutboundNetworkDependenciesEndpoint struct { + // OutboundNetworkDependenciesEndpointProperties - The outbound environment endpoint properties. + *OutboundNetworkDependenciesEndpointProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutboundNetworkDependenciesEndpoint. +func (onde OutboundNetworkDependenciesEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if onde.OutboundNetworkDependenciesEndpointProperties != nil { + objectMap["properties"] = onde.OutboundNetworkDependenciesEndpointProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OutboundNetworkDependenciesEndpoint struct. +func (onde *OutboundNetworkDependenciesEndpoint) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var outboundNetworkDependenciesEndpointProperties OutboundNetworkDependenciesEndpointProperties + err = json.Unmarshal(*v, &outboundNetworkDependenciesEndpointProperties) + if err != nil { + return err + } + onde.OutboundNetworkDependenciesEndpointProperties = &outboundNetworkDependenciesEndpointProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + onde.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + onde.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + onde.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + onde.Type = &typeVar + } + } + } + + return nil +} + +// OutboundNetworkDependenciesEndpointListResult collection of Outbound Environment Endpoints +type OutboundNetworkDependenciesEndpointListResult struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]OutboundNetworkDependenciesEndpoint `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutboundNetworkDependenciesEndpointListResult. +func (ondelr OutboundNetworkDependenciesEndpointListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ondelr.Value != nil { + objectMap["value"] = ondelr.Value + } + return json.Marshal(objectMap) +} + +// OutboundNetworkDependenciesEndpointListResultIterator provides access to a complete listing of +// OutboundNetworkDependenciesEndpoint values. +type OutboundNetworkDependenciesEndpointListResultIterator struct { + i int + page OutboundNetworkDependenciesEndpointListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OutboundNetworkDependenciesEndpointListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutboundNetworkDependenciesEndpointListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OutboundNetworkDependenciesEndpointListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OutboundNetworkDependenciesEndpointListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OutboundNetworkDependenciesEndpointListResultIterator) Response() OutboundNetworkDependenciesEndpointListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OutboundNetworkDependenciesEndpointListResultIterator) Value() OutboundNetworkDependenciesEndpoint { + if !iter.page.NotDone() { + return OutboundNetworkDependenciesEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OutboundNetworkDependenciesEndpointListResultIterator type. +func NewOutboundNetworkDependenciesEndpointListResultIterator(page OutboundNetworkDependenciesEndpointListResultPage) OutboundNetworkDependenciesEndpointListResultIterator { + return OutboundNetworkDependenciesEndpointListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ondelr OutboundNetworkDependenciesEndpointListResult) IsEmpty() bool { + return ondelr.Value == nil || len(*ondelr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ondelr OutboundNetworkDependenciesEndpointListResult) hasNextLink() bool { + return ondelr.NextLink != nil && len(*ondelr.NextLink) != 0 +} + +// outboundNetworkDependenciesEndpointListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ondelr OutboundNetworkDependenciesEndpointListResult) outboundNetworkDependenciesEndpointListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ondelr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ondelr.NextLink))) +} + +// OutboundNetworkDependenciesEndpointListResultPage contains a page of OutboundNetworkDependenciesEndpoint +// values. +type OutboundNetworkDependenciesEndpointListResultPage struct { + fn func(context.Context, OutboundNetworkDependenciesEndpointListResult) (OutboundNetworkDependenciesEndpointListResult, error) + ondelr OutboundNetworkDependenciesEndpointListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OutboundNetworkDependenciesEndpointListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutboundNetworkDependenciesEndpointListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ondelr) + if err != nil { + return err + } + page.ondelr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OutboundNetworkDependenciesEndpointListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OutboundNetworkDependenciesEndpointListResultPage) NotDone() bool { + return !page.ondelr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OutboundNetworkDependenciesEndpointListResultPage) Response() OutboundNetworkDependenciesEndpointListResult { + return page.ondelr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OutboundNetworkDependenciesEndpointListResultPage) Values() []OutboundNetworkDependenciesEndpoint { + if page.ondelr.IsEmpty() { + return nil + } + return *page.ondelr.Value +} + +// Creates a new instance of the OutboundNetworkDependenciesEndpointListResultPage type. +func NewOutboundNetworkDependenciesEndpointListResultPage(cur OutboundNetworkDependenciesEndpointListResult, getNextPage func(context.Context, OutboundNetworkDependenciesEndpointListResult) (OutboundNetworkDependenciesEndpointListResult, error)) OutboundNetworkDependenciesEndpointListResultPage { + return OutboundNetworkDependenciesEndpointListResultPage{ + fn: getNextPage, + ondelr: cur, + } +} + +// OutboundNetworkDependenciesEndpointProperties endpoints accessed for a common purpose that the Kusto +// Service Environment requires outbound network access to. +type OutboundNetworkDependenciesEndpointProperties struct { + // Category - The type of service accessed by the Kusto Service Environment, e.g., Azure Storage, Azure SQL Database, and Azure Active Directory. + Category *string `json:"category,omitempty"` + // Endpoints - The endpoints that the Kusto Service Environment reaches the service at. + Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutboundNetworkDependenciesEndpointProperties. +func (ondep OutboundNetworkDependenciesEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ondep.Category != nil { + objectMap["category"] = ondep.Category + } + if ondep.Endpoints != nil { + objectMap["endpoints"] = ondep.Endpoints + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnection a private endpoint connection +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // PrivateEndpointConnectionProperties - Resource properties. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + pec.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + } + } + + return nil +} + +// PrivateEndpointConnectionListResult a list of private endpoint connections +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - Array of private endpoint connections + Value *[]PrivateEndpointConnection `json:"value,omitempty"` +} + +// PrivateEndpointConnectionProperties properties of a private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - READ-ONLY; Private endpoint which the connection belongs to. + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + // GroupID - READ-ONLY; Group id of the private endpoint. + GroupID *string `json:"groupId,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the private endpoint. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. +func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type PrivateEndpointConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. +func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.PrivateEndpointConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { + pec, err = client.CreateOrUpdateResponder(pec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. +func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateEndpointProperty private endpoint which the connection belongs to. +type PrivateEndpointProperty struct { + // ID - READ-ONLY; Resource id of the private endpoint. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointProperty. +func (pep PrivateEndpointProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateLinkResource a private link resource +type PrivateLinkResource struct { + autorest.Response `json:"-"` + // PrivateLinkResourceProperties - Resource properties. + *PrivateLinkResourceProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.PrivateLinkResourceProperties != nil { + objectMap["properties"] = plr.PrivateLinkResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. +func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkResourceProperties PrivateLinkResourceProperties + err = json.Unmarshal(*v, &privateLinkResourceProperties) + if err != nil { + return err + } + plr.PrivateLinkResourceProperties = &privateLinkResourceProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + plr.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plr.Type = &typeVar + } + } + } + + return nil +} + +// PrivateLinkResourceListResult a list of private link resources +type PrivateLinkResourceListResult struct { + autorest.Response `json:"-"` + // Value - Array of private link resources + Value *[]PrivateLinkResource `json:"value,omitempty"` +} + +// PrivateLinkResourceProperties properties of a private link resource. +type PrivateLinkResourceProperties struct { + // GroupID - READ-ONLY; The private link resource group id. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - READ-ONLY; The private link resource required member names. + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - READ-ONLY; The private link resource required zone names. + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. +func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateLinkServiceConnectionStateProperty connection State of the Private Endpoint Connection. +type PrivateLinkServiceConnectionStateProperty struct { + // Status - The private link service connection status. + Status *string `json:"status,omitempty"` + // Description - The private link service connection description. + Description *string `json:"description,omitempty"` + // ActionsRequired - READ-ONLY; Any action that is required beyond basic workflow (approve/ reject/ disconnect) + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. +func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plscsp.Status != nil { + objectMap["status"] = plscsp.Status + } + if plscsp.Description != nil { + objectMap["description"] = plscsp.Description + } + return json.Marshal(objectMap) +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ReadOnlyFollowingDatabase class representing a read only following database. +type ReadOnlyFollowingDatabase struct { + // ReadOnlyFollowingDatabaseProperties - The database properties. + *ReadOnlyFollowingDatabaseProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyFollowing' + Kind Kind `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ReadOnlyFollowingDatabase. +func (rofd ReadOnlyFollowingDatabase) MarshalJSON() ([]byte, error) { + rofd.Kind = KindReadOnlyFollowing + objectMap := make(map[string]interface{}) + if rofd.ReadOnlyFollowingDatabaseProperties != nil { + objectMap["properties"] = rofd.ReadOnlyFollowingDatabaseProperties + } + if rofd.Location != nil { + objectMap["location"] = rofd.Location + } + if rofd.Kind != "" { + objectMap["kind"] = rofd.Kind + } + return json.Marshal(objectMap) +} + +// AsReadWriteDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. +func (rofd ReadOnlyFollowingDatabase) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { + return nil, false +} + +// AsReadOnlyFollowingDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. +func (rofd ReadOnlyFollowingDatabase) AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) { + return &rofd, true +} + +// AsDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. +func (rofd ReadOnlyFollowingDatabase) AsDatabase() (*Database, bool) { + return nil, false +} + +// AsBasicDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. +func (rofd ReadOnlyFollowingDatabase) AsBasicDatabase() (BasicDatabase, bool) { + return &rofd, true +} + +// UnmarshalJSON is the custom unmarshaler for ReadOnlyFollowingDatabase struct. +func (rofd *ReadOnlyFollowingDatabase) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var readOnlyFollowingDatabaseProperties ReadOnlyFollowingDatabaseProperties + err = json.Unmarshal(*v, &readOnlyFollowingDatabaseProperties) + if err != nil { + return err + } + rofd.ReadOnlyFollowingDatabaseProperties = &readOnlyFollowingDatabaseProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rofd.Location = &location + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rofd.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rofd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rofd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rofd.Type = &typeVar + } + } + } + + return nil +} + +// ReadOnlyFollowingDatabaseProperties class representing the Kusto database properties. +type ReadOnlyFollowingDatabaseProperties struct { + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // SoftDeletePeriod - READ-ONLY; The time the data should be kept before it stops being accessible to queries in TimeSpan. + SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` + // HotCachePeriod - The time the data should be kept in cache for fast queries in TimeSpan. + HotCachePeriod *string `json:"hotCachePeriod,omitempty"` + // Statistics - READ-ONLY; The statistics of the database. + Statistics *DatabaseStatistics `json:"statistics,omitempty"` + // LeaderClusterResourceID - READ-ONLY; The name of the leader cluster + LeaderClusterResourceID *string `json:"leaderClusterResourceId,omitempty"` + // AttachedDatabaseConfigurationName - READ-ONLY; The name of the attached database configuration cluster + AttachedDatabaseConfigurationName *string `json:"attachedDatabaseConfigurationName,omitempty"` + // PrincipalsModificationKind - READ-ONLY; The principals modification kind of the database. Possible values include: 'PrincipalsModificationKindUnion', 'PrincipalsModificationKindReplace', 'PrincipalsModificationKindNone' + PrincipalsModificationKind PrincipalsModificationKind `json:"principalsModificationKind,omitempty"` +} + +// MarshalJSON is the custom marshaler for ReadOnlyFollowingDatabaseProperties. +func (rofdp ReadOnlyFollowingDatabaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rofdp.HotCachePeriod != nil { + objectMap["hotCachePeriod"] = rofdp.HotCachePeriod + } + return json.Marshal(objectMap) +} + +// ReadWriteDatabase class representing a read write database. +type ReadWriteDatabase struct { + // ReadWriteDatabaseProperties - The database properties. + *ReadWriteDatabaseProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyFollowing' + Kind Kind `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ReadWriteDatabase. +func (rwd ReadWriteDatabase) MarshalJSON() ([]byte, error) { + rwd.Kind = KindReadWrite + objectMap := make(map[string]interface{}) + if rwd.ReadWriteDatabaseProperties != nil { + objectMap["properties"] = rwd.ReadWriteDatabaseProperties + } + if rwd.Location != nil { + objectMap["location"] = rwd.Location + } + if rwd.Kind != "" { + objectMap["kind"] = rwd.Kind + } + return json.Marshal(objectMap) +} + +// AsReadWriteDatabase is the BasicDatabase implementation for ReadWriteDatabase. +func (rwd ReadWriteDatabase) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { + return &rwd, true +} + +// AsReadOnlyFollowingDatabase is the BasicDatabase implementation for ReadWriteDatabase. +func (rwd ReadWriteDatabase) AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) { + return nil, false +} + +// AsDatabase is the BasicDatabase implementation for ReadWriteDatabase. +func (rwd ReadWriteDatabase) AsDatabase() (*Database, bool) { + return nil, false +} + +// AsBasicDatabase is the BasicDatabase implementation for ReadWriteDatabase. +func (rwd ReadWriteDatabase) AsBasicDatabase() (BasicDatabase, bool) { + return &rwd, true +} + +// UnmarshalJSON is the custom unmarshaler for ReadWriteDatabase struct. +func (rwd *ReadWriteDatabase) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var readWriteDatabaseProperties ReadWriteDatabaseProperties + err = json.Unmarshal(*v, &readWriteDatabaseProperties) + if err != nil { + return err + } + rwd.ReadWriteDatabaseProperties = &readWriteDatabaseProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rwd.Location = &location + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rwd.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rwd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rwd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rwd.Type = &typeVar + } + } + } + + return nil +} + +// ReadWriteDatabaseProperties class representing the Kusto database properties. +type ReadWriteDatabaseProperties struct { + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // SoftDeletePeriod - The time the data should be kept before it stops being accessible to queries in TimeSpan. + SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` + // HotCachePeriod - The time the data should be kept in cache for fast queries in TimeSpan. + HotCachePeriod *string `json:"hotCachePeriod,omitempty"` + // Statistics - READ-ONLY; The statistics of the database. + Statistics *DatabaseStatistics `json:"statistics,omitempty"` + // IsFollowed - READ-ONLY; Indicates whether the database is followed. + IsFollowed *bool `json:"isFollowed,omitempty"` +} + +// MarshalJSON is the custom marshaler for ReadWriteDatabaseProperties. +func (rwdp ReadWriteDatabaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rwdp.SoftDeletePeriod != nil { + objectMap["softDeletePeriod"] = rwdp.SoftDeletePeriod + } + if rwdp.HotCachePeriod != nil { + objectMap["hotCachePeriod"] = rwdp.HotCachePeriod + } + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Script class representing a database script. +type Script struct { + autorest.Response `json:"-"` + // ScriptProperties - The database script. + *ScriptProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Script. +func (s Script) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.ScriptProperties != nil { + objectMap["properties"] = s.ScriptProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Script struct. +func (s *Script) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var scriptProperties ScriptProperties + err = json.Unmarshal(*v, &scriptProperties) + if err != nil { + return err + } + s.ScriptProperties = &scriptProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + s.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + } + } + + return nil +} + +// ScriptCheckNameRequest a script name availability request. +type ScriptCheckNameRequest struct { + // Name - Script name. + Name *string `json:"name,omitempty"` + // Type - The type of resource, Microsoft.Kusto/clusters/databases/scripts. + Type *string `json:"type,omitempty"` +} + +// ScriptListResult the list Kusto database script operation response. +type ScriptListResult struct { + autorest.Response `json:"-"` + // Value - The list of Kusto scripts. + Value *[]Script `json:"value,omitempty"` +} + +// ScriptProperties a class representing database script property. +type ScriptProperties struct { + // ScriptURL - The url to the KQL script blob file. Must not be used together with scriptContent property + ScriptURL *string `json:"scriptUrl,omitempty"` + // ScriptURLSasToken - The SaS token that provide read access to the file which contain the script. Must be provided when using scriptUrl property. + ScriptURLSasToken *string `json:"scriptUrlSasToken,omitempty"` + // ScriptContent - The script content. This property should be used when the script is provide inline and not through file in a SA. Must not be used together with scriptUrl and scriptUrlSasToken properties. + ScriptContent *string `json:"scriptContent,omitempty"` + // ForceUpdateTag - A unique string. If changed the script will be applied again. + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + // ContinueOnErrors - Flag that indicates whether to continue if one of the command fails. + ContinueOnErrors *bool `json:"continueOnErrors,omitempty"` + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScriptProperties. +func (sp ScriptProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.ScriptURL != nil { + objectMap["scriptUrl"] = sp.ScriptURL + } + if sp.ScriptURLSasToken != nil { + objectMap["scriptUrlSasToken"] = sp.ScriptURLSasToken + } + if sp.ScriptContent != nil { + objectMap["scriptContent"] = sp.ScriptContent + } + if sp.ForceUpdateTag != nil { + objectMap["forceUpdateTag"] = sp.ForceUpdateTag + } + if sp.ContinueOnErrors != nil { + objectMap["continueOnErrors"] = sp.ContinueOnErrors + } + return json.Marshal(objectMap) +} + +// ScriptsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ScriptsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ScriptsClient) (Script, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ScriptsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ScriptsCreateOrUpdateFuture.Result. +func (future *ScriptsCreateOrUpdateFuture) result(client ScriptsClient) (s Script, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ScriptsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ScriptsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.CreateOrUpdateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ScriptsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// ScriptsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ScriptsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ScriptsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ScriptsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ScriptsDeleteFuture.Result. +func (future *ScriptsDeleteFuture) result(client ScriptsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ScriptsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ScriptsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ScriptsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ScriptsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ScriptsClient) (Script, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ScriptsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ScriptsUpdateFuture.Result. +func (future *ScriptsUpdateFuture) result(client ScriptsClient) (s Script, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ScriptsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kusto.ScriptsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.UpdateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ScriptsUpdateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// SkuDescription the Kusto SKU description of given resource type +type SkuDescription struct { + // ResourceType - READ-ONLY; The resource type + ResourceType *string `json:"resourceType,omitempty"` + // Name - READ-ONLY; The name of the SKU + Name *string `json:"name,omitempty"` + // Tier - READ-ONLY; The tier of the SKU + Tier *string `json:"tier,omitempty"` + // Locations - READ-ONLY; The set of locations that the SKU is available + Locations *[]string `json:"locations,omitempty"` + // LocationInfo - READ-ONLY; Locations and zones + LocationInfo *[]SkuLocationInfoItem `json:"locationInfo,omitempty"` + // Restrictions - READ-ONLY; The restrictions because of which SKU cannot be used + Restrictions *[]interface{} `json:"restrictions,omitempty"` +} + +// MarshalJSON is the custom marshaler for SkuDescription. +func (sd SkuDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SkuDescriptionList the list of the EngagementFabric SKU descriptions +type SkuDescriptionList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; SKU descriptions + Value *[]SkuDescription `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for SkuDescriptionList. +func (sdl SkuDescriptionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SkuLocationInfoItem the locations and zones info for SKU. +type SkuLocationInfoItem struct { + // Location - The available location of the SKU. + Location *string `json:"location,omitempty"` + // Zones - The available zone of the SKU. + Zones *[]string `json:"zones,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TableLevelSharingProperties tables that will be included and excluded in the follower database +type TableLevelSharingProperties struct { + // TablesToInclude - List of tables to include in the follower database + TablesToInclude *[]string `json:"tablesToInclude,omitempty"` + // TablesToExclude - List of tables to exclude from the follower database + TablesToExclude *[]string `json:"tablesToExclude,omitempty"` + // ExternalTablesToInclude - List of external tables to include in the follower database + ExternalTablesToInclude *[]string `json:"externalTablesToInclude,omitempty"` + // ExternalTablesToExclude - List of external tables exclude from the follower database + ExternalTablesToExclude *[]string `json:"externalTablesToExclude,omitempty"` + // MaterializedViewsToInclude - List of materialized views to include in the follower database + MaterializedViewsToInclude *[]string `json:"materializedViewsToInclude,omitempty"` + // MaterializedViewsToExclude - List of materialized views exclude from the follower database + MaterializedViewsToExclude *[]string `json:"materializedViewsToExclude,omitempty"` +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// TrustedExternalTenant represents a tenant ID that is trusted by the cluster. +type TrustedExternalTenant struct { + // Value - GUID representing an external tenant. + Value *string `json:"value,omitempty"` +} + +// VirtualNetworkConfiguration a class that contains virtual network definition. +type VirtualNetworkConfiguration struct { + // SubnetID - The subnet resource id. + SubnetID *string `json:"subnetId,omitempty"` + // EnginePublicIPID - Engine service's public IP address resource id. + EnginePublicIPID *string `json:"enginePublicIpId,omitempty"` + // DataManagementPublicIPID - Data management's service public IP address resource id. + DataManagementPublicIPID *string `json:"dataManagementPublicIpId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operations.go new file mode 100644 index 00000000000..5b278fc1914 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operations.go @@ -0,0 +1,142 @@ +package kusto + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the the Azure Kusto management API provides a RESTful set of web services that interact with +// Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and delete +// clusters and databases. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists available operations for the Microsoft.Kusto provider. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Kusto/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kusto.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kusto.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/operationsresults.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operationsresults.go similarity index 97% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/operationsresults.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operationsresults.go index 3e472a315ae..7c02aa4dfe5 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/operationsresults.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operationsresults.go @@ -78,7 +78,7 @@ func (client OperationsResultsClient) GetPreparer(ctx context.Context, location "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -86,7 +86,7 @@ func (client OperationsResultsClient) GetPreparer(ctx context.Context, location preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/operationresults/{operationId}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/operationResults/{operationId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operationsresultslocation.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operationsresultslocation.go new file mode 100644 index 00000000000..5e116cbeb48 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operationsresultslocation.go @@ -0,0 +1,109 @@ +package kusto + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsResultsLocationClient is the the Azure Kusto management API provides a RESTful set of web services that +// interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and +// delete clusters and databases. +type OperationsResultsLocationClient struct { + BaseClient +} + +// NewOperationsResultsLocationClient creates an instance of the OperationsResultsLocationClient client. +func NewOperationsResultsLocationClient(subscriptionID string) OperationsResultsLocationClient { + return NewOperationsResultsLocationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsResultsLocationClientWithBaseURI creates an instance of the OperationsResultsLocationClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewOperationsResultsLocationClientWithBaseURI(baseURI string, subscriptionID string) OperationsResultsLocationClient { + return OperationsResultsLocationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get returns operation results. +// Parameters: +// location - azure location (region) name. +// operationID - the Guid of the operation ID +func (client OperationsResultsLocationClient) Get(ctx context.Context, location string, operationID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsResultsLocationClient.Get") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, location, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.OperationsResultsLocationClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "kusto.OperationsResultsLocationClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.OperationsResultsLocationClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OperationsResultsLocationClient) GetPreparer(ctx context.Context, location string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "operationId": autorest.Encode("path", operationID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/operationResults/{operationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsResultsLocationClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OperationsResultsLocationClient) GetResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/privateendpointconnections.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/privateendpointconnections.go new file mode 100644 index 00000000000..33f54414b23 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/privateendpointconnections.go @@ -0,0 +1,360 @@ +package kusto + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateEndpointConnectionsClient is the the Azure Kusto management API provides a RESTful set of web services that +// interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and +// delete clusters and databases. +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate approve or reject a private endpoint connection with a given name. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("kusto.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a private endpoint connection with a given name. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a private endpoint connection. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List returns the list of private endpoint connections. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result PrivateEndpointConnectionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/privatelinkresources.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/privatelinkresources.go new file mode 100644 index 00000000000..d964b03a46c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/privatelinkresources.go @@ -0,0 +1,188 @@ +package kusto + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateLinkResourcesClient is the the Azure Kusto management API provides a RESTful set of web services that +// interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and +// delete clusters and databases. +type PrivateLinkResourcesClient struct { + BaseClient +} + +// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets a private link resource. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// privateLinkResourceName - the name of the private link resource. +func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, privateLinkResourceName string) (result PrivateLinkResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, privateLinkResourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, privateLinkResourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "privateLinkResourceName": autorest.Encode("path", privateLinkResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) GetResponder(resp *http.Response) (result PrivateLinkResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List returns the list of private link resources. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result PrivateLinkResourceListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.PrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/scripts.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/scripts.go similarity index 96% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/scripts.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/scripts.go index 81d3ef9e314..d9589145b4b 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto/scripts.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/scripts.go @@ -88,7 +88,7 @@ func (client ScriptsClient) CheckNameAvailabilityPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -139,15 +139,6 @@ func (client ScriptsClient) CreateOrUpdate(ctx context.Context, resourceGroupNam tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ScriptProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ScriptProperties.ScriptURL", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ScriptProperties.ScriptURLSasToken", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("kusto.ScriptsClient", "CreateOrUpdate", err.Error()) - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, databaseName, scriptName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "kusto.ScriptsClient", "CreateOrUpdate", nil, "Failure preparing request") @@ -173,7 +164,7 @@ func (client ScriptsClient) CreateOrUpdatePreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -259,7 +250,7 @@ func (client ScriptsClient) DeletePreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -348,7 +339,7 @@ func (client ScriptsClient) GetPreparer(ctx context.Context, resourceGroupName s "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -426,7 +417,7 @@ func (client ScriptsClient) ListByDatabasePreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -500,7 +491,7 @@ func (client ScriptsClient) UpdatePreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-08-27" + const APIVersion = "2022-02-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/version.go new file mode 100644 index 00000000000..a436f90cb24 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/version.go @@ -0,0 +1,19 @@ +package kusto + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " kusto/2022-02-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/_meta.json deleted file mode 100644 index 5eb39b64408..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "6300f518091891b00c993e538dc2d282c9b814de", - "readme": "/_/azure-rest-api-specs/specification/maintenance/resource-manager/readme.md", - "tag": "package-2021-05", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-05 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/maintenance/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/applyupdateforresourcegroup.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/applyupdateforresourcegroup.go deleted file mode 100644 index 017c538d6c8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/applyupdateforresourcegroup.go +++ /dev/null @@ -1,106 +0,0 @@ -package maintenance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ApplyUpdateForResourceGroupClient is the azure Maintenance Management Client -type ApplyUpdateForResourceGroupClient struct { - BaseClient -} - -// NewApplyUpdateForResourceGroupClient creates an instance of the ApplyUpdateForResourceGroupClient client. -func NewApplyUpdateForResourceGroupClient(subscriptionID string) ApplyUpdateForResourceGroupClient { - return NewApplyUpdateForResourceGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplyUpdateForResourceGroupClientWithBaseURI creates an instance of the ApplyUpdateForResourceGroupClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewApplyUpdateForResourceGroupClientWithBaseURI(baseURI string, subscriptionID string) ApplyUpdateForResourceGroupClient { - return ApplyUpdateForResourceGroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List sends the list request. -// Parameters: -// resourceGroupName - resource Group Name -func (client ApplyUpdateForResourceGroupClient) List(ctx context.Context, resourceGroupName string) (result ListApplyUpdate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplyUpdateForResourceGroupClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdateForResourceGroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdateForResourceGroupClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdateForResourceGroupClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplyUpdateForResourceGroupClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maintenance/applyUpdates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplyUpdateForResourceGroupClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplyUpdateForResourceGroupClient) ListResponder(resp *http.Response) (result ListApplyUpdate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/applyupdates.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/applyupdates.go deleted file mode 100644 index b199ca4a79b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/applyupdates.go +++ /dev/null @@ -1,434 +0,0 @@ -package maintenance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ApplyUpdatesClient is the azure Maintenance Management Client -type ApplyUpdatesClient struct { - BaseClient -} - -// NewApplyUpdatesClient creates an instance of the ApplyUpdatesClient client. -func NewApplyUpdatesClient(subscriptionID string) ApplyUpdatesClient { - return NewApplyUpdatesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplyUpdatesClientWithBaseURI creates an instance of the ApplyUpdatesClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewApplyUpdatesClientWithBaseURI(baseURI string, subscriptionID string) ApplyUpdatesClient { - return ApplyUpdatesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate apply maintenance updates to resource -// Parameters: -// resourceGroupName - resource group name -// providerName - resource provider name -// resourceType - resource type -// resourceName - resource identifier -func (client ApplyUpdatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string) (result ApplyUpdate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplyUpdatesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, providerName, resourceType, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdatesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdatesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdatesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ApplyUpdatesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerName": autorest.Encode("path", providerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceType": autorest.Encode("path", resourceType), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplyUpdatesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ApplyUpdatesClient) CreateOrUpdateResponder(resp *http.Response) (result ApplyUpdate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateParent apply maintenance updates to resource with parent -// Parameters: -// resourceGroupName - resource group name -// providerName - resource provider name -// resourceParentType - resource parent type -// resourceParentName - resource parent identifier -// resourceType - resource type -// resourceName - resource identifier -func (client ApplyUpdatesClient) CreateOrUpdateParent(ctx context.Context, resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string) (result ApplyUpdate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplyUpdatesClient.CreateOrUpdateParent") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdateParentPreparer(ctx, resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdatesClient", "CreateOrUpdateParent", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateParentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdatesClient", "CreateOrUpdateParent", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateParentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdatesClient", "CreateOrUpdateParent", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateParentPreparer prepares the CreateOrUpdateParent request. -func (client ApplyUpdatesClient) CreateOrUpdateParentPreparer(ctx context.Context, resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerName": autorest.Encode("path", providerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceParentName": autorest.Encode("path", resourceParentName), - "resourceParentType": autorest.Encode("path", resourceParentType), - "resourceType": autorest.Encode("path", resourceType), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateParentSender sends the CreateOrUpdateParent request. The method will close the -// http.Response Body if it receives an error. -func (client ApplyUpdatesClient) CreateOrUpdateParentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateParentResponder handles the response to the CreateOrUpdateParent request. The method always -// closes the http.Response Body. -func (client ApplyUpdatesClient) CreateOrUpdateParentResponder(resp *http.Response) (result ApplyUpdate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get track maintenance updates to resource -// Parameters: -// resourceGroupName - resource group name -// providerName - resource provider name -// resourceType - resource type -// resourceName - resource identifier -// applyUpdateName - applyUpdate Id -func (client ApplyUpdatesClient) Get(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string, applyUpdateName string) (result ApplyUpdate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplyUpdatesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, providerName, resourceType, resourceName, applyUpdateName) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdatesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdatesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdatesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplyUpdatesClient) GetPreparer(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string, applyUpdateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applyUpdateName": autorest.Encode("path", applyUpdateName), - "providerName": autorest.Encode("path", providerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceType": autorest.Encode("path", resourceType), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplyUpdatesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplyUpdatesClient) GetResponder(resp *http.Response) (result ApplyUpdate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetParent track maintenance updates to resource with parent -// Parameters: -// resourceGroupName - resource group name -// resourceParentType - resource parent type -// resourceParentName - resource parent identifier -// providerName - resource provider name -// resourceType - resource type -// resourceName - resource identifier -// applyUpdateName - applyUpdate Id -func (client ApplyUpdatesClient) GetParent(ctx context.Context, resourceGroupName string, resourceParentType string, resourceParentName string, providerName string, resourceType string, resourceName string, applyUpdateName string) (result ApplyUpdate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplyUpdatesClient.GetParent") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetParentPreparer(ctx, resourceGroupName, resourceParentType, resourceParentName, providerName, resourceType, resourceName, applyUpdateName) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdatesClient", "GetParent", nil, "Failure preparing request") - return - } - - resp, err := client.GetParentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdatesClient", "GetParent", resp, "Failure sending request") - return - } - - result, err = client.GetParentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdatesClient", "GetParent", resp, "Failure responding to request") - return - } - - return -} - -// GetParentPreparer prepares the GetParent request. -func (client ApplyUpdatesClient) GetParentPreparer(ctx context.Context, resourceGroupName string, resourceParentType string, resourceParentName string, providerName string, resourceType string, resourceName string, applyUpdateName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applyUpdateName": autorest.Encode("path", applyUpdateName), - "providerName": autorest.Encode("path", providerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceParentName": autorest.Encode("path", resourceParentName), - "resourceParentType": autorest.Encode("path", resourceParentType), - "resourceType": autorest.Encode("path", resourceType), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetParentSender sends the GetParent request. The method will close the -// http.Response Body if it receives an error. -func (client ApplyUpdatesClient) GetParentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetParentResponder handles the response to the GetParent request. The method always -// closes the http.Response Body. -func (client ApplyUpdatesClient) GetParentResponder(resp *http.Response) (result ApplyUpdate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List sends the list request. -func (client ApplyUpdatesClient) List(ctx context.Context) (result ListApplyUpdate, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplyUpdatesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdatesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdatesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ApplyUpdatesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplyUpdatesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/applyUpdates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplyUpdatesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplyUpdatesClient) ListResponder(resp *http.Response) (result ListApplyUpdate, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/client.go deleted file mode 100644 index 9075519dce0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package maintenance implements the Azure ARM Maintenance service API version 2021-05-01. -// -// Azure Maintenance Management Client -package maintenance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Maintenance - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Maintenance. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/configurationassignments.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/configurationassignments.go deleted file mode 100644 index 0e83f34c421..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/configurationassignments.go +++ /dev/null @@ -1,538 +0,0 @@ -package maintenance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ConfigurationAssignmentsClient is the azure Maintenance Management Client -type ConfigurationAssignmentsClient struct { - BaseClient -} - -// NewConfigurationAssignmentsClient creates an instance of the ConfigurationAssignmentsClient client. -func NewConfigurationAssignmentsClient(subscriptionID string) ConfigurationAssignmentsClient { - return NewConfigurationAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConfigurationAssignmentsClientWithBaseURI creates an instance of the ConfigurationAssignmentsClient client using -// a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewConfigurationAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationAssignmentsClient { - return ConfigurationAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate register configuration for resource. -// Parameters: -// resourceGroupName - resource group name -// providerName - resource provider name -// resourceType - resource type -// resourceName - resource identifier -// configurationAssignmentName - configuration assignment name -// configurationAssignment - the configurationAssignment -func (client ConfigurationAssignmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string, configurationAssignmentName string, configurationAssignment ConfigurationAssignment) (result ConfigurationAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationAssignmentsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, configurationAssignment) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConfigurationAssignmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string, configurationAssignmentName string, configurationAssignment ConfigurationAssignment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationAssignmentName": autorest.Encode("path", configurationAssignmentName), - "providerName": autorest.Encode("path", providerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceType": autorest.Encode("path", resourceType), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", pathParameters), - autorest.WithJSON(configurationAssignment), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationAssignmentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ConfigurationAssignmentsClient) CreateOrUpdateResponder(resp *http.Response) (result ConfigurationAssignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateParent register configuration for resource. -// Parameters: -// resourceGroupName - resource group name -// providerName - resource provider name -// resourceParentType - resource parent type -// resourceParentName - resource parent identifier -// resourceType - resource type -// resourceName - resource identifier -// configurationAssignmentName - configuration assignment name -// configurationAssignment - the configurationAssignment -func (client ConfigurationAssignmentsClient) CreateOrUpdateParent(ctx context.Context, resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string, configurationAssignmentName string, configurationAssignment ConfigurationAssignment) (result ConfigurationAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationAssignmentsClient.CreateOrUpdateParent") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdateParentPreparer(ctx, resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, configurationAssignment) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "CreateOrUpdateParent", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateParentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "CreateOrUpdateParent", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateParentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "CreateOrUpdateParent", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateParentPreparer prepares the CreateOrUpdateParent request. -func (client ConfigurationAssignmentsClient) CreateOrUpdateParentPreparer(ctx context.Context, resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string, configurationAssignmentName string, configurationAssignment ConfigurationAssignment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationAssignmentName": autorest.Encode("path", configurationAssignmentName), - "providerName": autorest.Encode("path", providerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceParentName": autorest.Encode("path", resourceParentName), - "resourceParentType": autorest.Encode("path", resourceParentType), - "resourceType": autorest.Encode("path", resourceType), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", pathParameters), - autorest.WithJSON(configurationAssignment), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateParentSender sends the CreateOrUpdateParent request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationAssignmentsClient) CreateOrUpdateParentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateParentResponder handles the response to the CreateOrUpdateParent request. The method always -// closes the http.Response Body. -func (client ConfigurationAssignmentsClient) CreateOrUpdateParentResponder(resp *http.Response) (result ConfigurationAssignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete unregister configuration for resource. -// Parameters: -// resourceGroupName - resource group name -// providerName - resource provider name -// resourceType - resource type -// resourceName - resource identifier -// configurationAssignmentName - unique configuration assignment name -func (client ConfigurationAssignmentsClient) Delete(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string, configurationAssignmentName string) (result ConfigurationAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationAssignmentsClient.Delete") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ConfigurationAssignmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string, configurationAssignmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationAssignmentName": autorest.Encode("path", configurationAssignmentName), - "providerName": autorest.Encode("path", providerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceType": autorest.Encode("path", resourceType), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationAssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ConfigurationAssignmentsClient) DeleteResponder(resp *http.Response) (result ConfigurationAssignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteParent unregister configuration for resource. -// Parameters: -// resourceGroupName - resource group name -// providerName - resource provider name -// resourceParentType - resource parent type -// resourceParentName - resource parent identifier -// resourceType - resource type -// resourceName - resource identifier -// configurationAssignmentName - unique configuration assignment name -func (client ConfigurationAssignmentsClient) DeleteParent(ctx context.Context, resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string, configurationAssignmentName string) (result ConfigurationAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationAssignmentsClient.DeleteParent") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteParentPreparer(ctx, resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "DeleteParent", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteParentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "DeleteParent", resp, "Failure sending request") - return - } - - result, err = client.DeleteParentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "DeleteParent", resp, "Failure responding to request") - return - } - - return -} - -// DeleteParentPreparer prepares the DeleteParent request. -func (client ConfigurationAssignmentsClient) DeleteParentPreparer(ctx context.Context, resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string, configurationAssignmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationAssignmentName": autorest.Encode("path", configurationAssignmentName), - "providerName": autorest.Encode("path", providerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceParentName": autorest.Encode("path", resourceParentName), - "resourceParentType": autorest.Encode("path", resourceParentType), - "resourceType": autorest.Encode("path", resourceType), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteParentSender sends the DeleteParent request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationAssignmentsClient) DeleteParentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteParentResponder handles the response to the DeleteParent request. The method always -// closes the http.Response Body. -func (client ConfigurationAssignmentsClient) DeleteParentResponder(resp *http.Response) (result ConfigurationAssignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list configurationAssignments for resource. -// Parameters: -// resourceGroupName - resource group name -// providerName - resource provider name -// resourceType - resource type -// resourceName - resource identifier -func (client ConfigurationAssignmentsClient) List(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string) (result ListConfigurationAssignmentsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationAssignmentsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, providerName, resourceType, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ConfigurationAssignmentsClient) ListPreparer(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerName": autorest.Encode("path", providerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceType": autorest.Encode("path", resourceType), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationAssignmentsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ConfigurationAssignmentsClient) ListResponder(resp *http.Response) (result ListConfigurationAssignmentsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListParent list configurationAssignments for resource. -// Parameters: -// resourceGroupName - resource group name -// providerName - resource provider name -// resourceParentType - resource parent type -// resourceParentName - resource parent identifier -// resourceType - resource type -// resourceName - resource identifier -func (client ConfigurationAssignmentsClient) ListParent(ctx context.Context, resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string) (result ListConfigurationAssignmentsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationAssignmentsClient.ListParent") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListParentPreparer(ctx, resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "ListParent", nil, "Failure preparing request") - return - } - - resp, err := client.ListParentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "ListParent", resp, "Failure sending request") - return - } - - result, err = client.ListParentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationAssignmentsClient", "ListParent", resp, "Failure responding to request") - return - } - - return -} - -// ListParentPreparer prepares the ListParent request. -func (client ConfigurationAssignmentsClient) ListParentPreparer(ctx context.Context, resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerName": autorest.Encode("path", providerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceParentName": autorest.Encode("path", resourceParentName), - "resourceParentType": autorest.Encode("path", resourceParentType), - "resourceType": autorest.Encode("path", resourceType), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListParentSender sends the ListParent request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationAssignmentsClient) ListParentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListParentResponder handles the response to the ListParent request. The method always -// closes the http.Response Body. -func (client ConfigurationAssignmentsClient) ListParentResponder(resp *http.Response) (result ListConfigurationAssignmentsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/configurations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/configurations.go deleted file mode 100644 index db6bc2c210d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/configurations.go +++ /dev/null @@ -1,412 +0,0 @@ -package maintenance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ConfigurationsClient is the azure Maintenance Management Client -type ConfigurationsClient struct { - BaseClient -} - -// NewConfigurationsClient creates an instance of the ConfigurationsClient client. -func NewConfigurationsClient(subscriptionID string) ConfigurationsClient { - return NewConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConfigurationsClientWithBaseURI creates an instance of the ConfigurationsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationsClient { - return ConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate sends the create or update request. -// Parameters: -// resourceGroupName - resource Group Name -// resourceName - maintenance Configuration Name -// configuration - the configuration -func (client ConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, configuration Configuration) (result Configuration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, configuration) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, configuration Configuration) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}", pathParameters), - autorest.WithJSON(configuration), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete sends the delete request. -// Parameters: -// resourceGroupName - resource Group Name -// resourceName - maintenance Configuration Name -func (client ConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result Configuration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.Delete") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) DeleteResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get sends the get request. -// Parameters: -// resourceGroupName - resource Group Name -// resourceName - maintenance Configuration Name -func (client ConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Configuration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) GetResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List sends the list request. -func (client ConfigurationsClient) List(ctx context.Context) (result ListMaintenanceConfigurationsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ConfigurationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/maintenanceConfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) ListResponder(resp *http.Response) (result ListMaintenanceConfigurationsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateMethod sends the update method request. -// Parameters: -// resourceGroupName - resource Group Name -// resourceName - maintenance Configuration Name -// configuration - the configuration -func (client ConfigurationsClient) UpdateMethod(ctx context.Context, resourceGroupName string, resourceName string, configuration Configuration) (result Configuration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.UpdateMethod") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdateMethodPreparer(ctx, resourceGroupName, resourceName, configuration) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsClient", "UpdateMethod", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateMethodSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsClient", "UpdateMethod", resp, "Failure sending request") - return - } - - result, err = client.UpdateMethodResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsClient", "UpdateMethod", resp, "Failure responding to request") - return - } - - return -} - -// UpdateMethodPreparer prepares the UpdateMethod request. -func (client ConfigurationsClient) UpdateMethodPreparer(ctx context.Context, resourceGroupName string, resourceName string, configuration Configuration) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations/{resourceName}", pathParameters), - autorest.WithJSON(configuration), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateMethodSender sends the UpdateMethod request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) UpdateMethodSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateMethodResponder handles the response to the UpdateMethod request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) UpdateMethodResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/configurationsforresourcegroup.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/configurationsforresourcegroup.go deleted file mode 100644 index 22690c5e89b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/configurationsforresourcegroup.go +++ /dev/null @@ -1,106 +0,0 @@ -package maintenance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ConfigurationsForResourceGroupClient is the azure Maintenance Management Client -type ConfigurationsForResourceGroupClient struct { - BaseClient -} - -// NewConfigurationsForResourceGroupClient creates an instance of the ConfigurationsForResourceGroupClient client. -func NewConfigurationsForResourceGroupClient(subscriptionID string) ConfigurationsForResourceGroupClient { - return NewConfigurationsForResourceGroupClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConfigurationsForResourceGroupClientWithBaseURI creates an instance of the ConfigurationsForResourceGroupClient -// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI -// (sovereign clouds, Azure stack). -func NewConfigurationsForResourceGroupClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationsForResourceGroupClient { - return ConfigurationsForResourceGroupClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List sends the list request. -// Parameters: -// resourceGroupName - resource Group Name -func (client ConfigurationsForResourceGroupClient) List(ctx context.Context, resourceGroupName string) (result ListMaintenanceConfigurationsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsForResourceGroupClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsForResourceGroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsForResourceGroupClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.ConfigurationsForResourceGroupClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ConfigurationsForResourceGroupClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maintenance/maintenanceConfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsForResourceGroupClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ConfigurationsForResourceGroupClient) ListResponder(resp *http.Response) (result ListMaintenanceConfigurationsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/enums.go deleted file mode 100644 index 16db38f148e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/enums.go +++ /dev/null @@ -1,106 +0,0 @@ -package maintenance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// ImpactType enumerates the values for impact type. -type ImpactType string - -const ( - // ImpactTypeFreeze Pending updates can freeze network or disk io operation on resource. - ImpactTypeFreeze ImpactType = "Freeze" - // ImpactTypeNone Pending updates has no impact on resource. - ImpactTypeNone ImpactType = "None" - // ImpactTypeRedeploy Pending updates can redeploy resource. - ImpactTypeRedeploy ImpactType = "Redeploy" - // ImpactTypeRestart Pending updates can cause resource to restart. - ImpactTypeRestart ImpactType = "Restart" -) - -// PossibleImpactTypeValues returns an array of possible values for the ImpactType const type. -func PossibleImpactTypeValues() []ImpactType { - return []ImpactType{ImpactTypeFreeze, ImpactTypeNone, ImpactTypeRedeploy, ImpactTypeRestart} -} - -// Scope enumerates the values for scope. -type Scope string - -const ( - // ScopeExtension This maintenance scope controls extension installation on VM/VMSS - ScopeExtension Scope = "Extension" - // ScopeHost This maintenance scope controls installation of azure platform updates i.e. services on - // physical nodes hosting customer VMs. - ScopeHost Scope = "Host" - // ScopeInGuestPatch This maintenance scope controls installation of windows and linux packages on VM/VMSS - ScopeInGuestPatch Scope = "InGuestPatch" - // ScopeOSImage This maintenance scope controls os image installation on VM/VMSS - ScopeOSImage Scope = "OSImage" - // ScopeSQLDB This maintenance scope controls installation of SQL server platform updates. - ScopeSQLDB Scope = "SQLDB" - // ScopeSQLManagedInstance This maintenance scope controls installation of SQL managed instance platform - // update. - ScopeSQLManagedInstance Scope = "SQLManagedInstance" -) - -// PossibleScopeValues returns an array of possible values for the Scope const type. -func PossibleScopeValues() []Scope { - return []Scope{ScopeExtension, ScopeHost, ScopeInGuestPatch, ScopeOSImage, ScopeSQLDB, ScopeSQLManagedInstance} -} - -// UpdateStatus enumerates the values for update status. -type UpdateStatus string - -const ( - // UpdateStatusCompleted All updates are successfully applied. - UpdateStatusCompleted UpdateStatus = "Completed" - // UpdateStatusInProgress Updates installation are in progress. - UpdateStatusInProgress UpdateStatus = "InProgress" - // UpdateStatusPending There are pending updates to be installed. - UpdateStatusPending UpdateStatus = "Pending" - // UpdateStatusRetryLater Updates installation failed and should be retried later. - UpdateStatusRetryLater UpdateStatus = "RetryLater" - // UpdateStatusRetryNow Updates installation failed but are ready to retry again. - UpdateStatusRetryNow UpdateStatus = "RetryNow" -) - -// PossibleUpdateStatusValues returns an array of possible values for the UpdateStatus const type. -func PossibleUpdateStatusValues() []UpdateStatus { - return []UpdateStatus{UpdateStatusCompleted, UpdateStatusInProgress, UpdateStatusPending, UpdateStatusRetryLater, UpdateStatusRetryNow} -} - -// Visibility enumerates the values for visibility. -type Visibility string - -const ( - // VisibilityCustom Only visible to users with permissions. - VisibilityCustom Visibility = "Custom" - // VisibilityPublic Visible to all users. - VisibilityPublic Visibility = "Public" -) - -// PossibleVisibilityValues returns an array of possible values for the Visibility const type. -func PossibleVisibilityValues() []Visibility { - return []Visibility{VisibilityCustom, VisibilityPublic} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/models.go deleted file mode 100644 index 4a543561180..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/models.go +++ /dev/null @@ -1,661 +0,0 @@ -package maintenance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance" - -// ApplyUpdate apply Update request -type ApplyUpdate struct { - autorest.Response `json:"-"` - // ApplyUpdateProperties - Properties of the apply update - *ApplyUpdateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` - // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplyUpdate. -func (au ApplyUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if au.ApplyUpdateProperties != nil { - objectMap["properties"] = au.ApplyUpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplyUpdate struct. -func (au *ApplyUpdate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var applyUpdateProperties ApplyUpdateProperties - err = json.Unmarshal(*v, &applyUpdateProperties) - if err != nil { - return err - } - au.ApplyUpdateProperties = &applyUpdateProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - au.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - au.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - au.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - au.SystemData = &systemData - } - } - } - - return nil -} - -// ApplyUpdateProperties properties for apply update -type ApplyUpdateProperties struct { - // Status - The status. Possible values include: 'UpdateStatusPending', 'UpdateStatusInProgress', 'UpdateStatusCompleted', 'UpdateStatusRetryNow', 'UpdateStatusRetryLater' - Status UpdateStatus `json:"status,omitempty"` - // ResourceID - The resourceId - ResourceID *string `json:"resourceId,omitempty"` - // LastUpdateTime - Last Update time - LastUpdateTime *date.Time `json:"lastUpdateTime,omitempty"` -} - -// Configuration maintenance configuration record type -type Configuration struct { - autorest.Response `json:"-"` - // Location - Gets or sets location of the resource - Location *string `json:"location,omitempty"` - // Tags - Gets or sets tags of the resource - Tags map[string]*string `json:"tags"` - // ConfigurationProperties - Gets or sets properties of the resource - *ConfigurationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` - // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Configuration. -func (c Configuration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.Location != nil { - objectMap["location"] = c.Location - } - if c.Tags != nil { - objectMap["tags"] = c.Tags - } - if c.ConfigurationProperties != nil { - objectMap["properties"] = c.ConfigurationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Configuration struct. -func (c *Configuration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - c.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - c.Tags = tags - } - case "properties": - if v != nil { - var configurationProperties ConfigurationProperties - err = json.Unmarshal(*v, &configurationProperties) - if err != nil { - return err - } - c.ConfigurationProperties = &configurationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - c.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - c.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - c.SystemData = &systemData - } - } - } - - return nil -} - -// ConfigurationAssignment configuration Assignment -type ConfigurationAssignment struct { - autorest.Response `json:"-"` - // Location - Location of the resource - Location *string `json:"location,omitempty"` - // ConfigurationAssignmentProperties - Properties of the configuration assignment - *ConfigurationAssignmentProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` - // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigurationAssignment. -func (ca ConfigurationAssignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ca.Location != nil { - objectMap["location"] = ca.Location - } - if ca.ConfigurationAssignmentProperties != nil { - objectMap["properties"] = ca.ConfigurationAssignmentProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConfigurationAssignment struct. -func (ca *ConfigurationAssignment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ca.Location = &location - } - case "properties": - if v != nil { - var configurationAssignmentProperties ConfigurationAssignmentProperties - err = json.Unmarshal(*v, &configurationAssignmentProperties) - if err != nil { - return err - } - ca.ConfigurationAssignmentProperties = &configurationAssignmentProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ca.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ca.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ca.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ca.SystemData = &systemData - } - } - } - - return nil -} - -// ConfigurationAssignmentProperties properties for configuration assignment -type ConfigurationAssignmentProperties struct { - // MaintenanceConfigurationID - The maintenance configuration Id - MaintenanceConfigurationID *string `json:"maintenanceConfigurationId,omitempty"` - // ResourceID - The unique resourceId - ResourceID *string `json:"resourceId,omitempty"` -} - -// ConfigurationProperties properties for maintenance configuration -type ConfigurationProperties struct { - // Namespace - Gets or sets namespace of the resource - Namespace *string `json:"namespace,omitempty"` - // ExtensionProperties - Gets or sets extensionProperties of the maintenanceConfiguration - ExtensionProperties map[string]*string `json:"extensionProperties"` - // MaintenanceScope - Gets or sets maintenanceScope of the configuration. Possible values include: 'ScopeHost', 'ScopeOSImage', 'ScopeExtension', 'ScopeInGuestPatch', 'ScopeSQLDB', 'ScopeSQLManagedInstance' - MaintenanceScope Scope `json:"maintenanceScope,omitempty"` - // Window - Definition of a MaintenanceWindow - *Window `json:"maintenanceWindow,omitempty"` - // Visibility - Gets or sets the visibility of the configuration. The default value is 'Custom'. Possible values include: 'VisibilityCustom', 'VisibilityPublic' - Visibility Visibility `json:"visibility,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigurationProperties. -func (cp ConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Namespace != nil { - objectMap["namespace"] = cp.Namespace - } - if cp.ExtensionProperties != nil { - objectMap["extensionProperties"] = cp.ExtensionProperties - } - if cp.MaintenanceScope != "" { - objectMap["maintenanceScope"] = cp.MaintenanceScope - } - if cp.Window != nil { - objectMap["maintenanceWindow"] = cp.Window - } - if cp.Visibility != "" { - objectMap["visibility"] = cp.Visibility - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ConfigurationProperties struct. -func (cp *ConfigurationProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "namespace": - if v != nil { - var namespace string - err = json.Unmarshal(*v, &namespace) - if err != nil { - return err - } - cp.Namespace = &namespace - } - case "extensionProperties": - if v != nil { - var extensionProperties map[string]*string - err = json.Unmarshal(*v, &extensionProperties) - if err != nil { - return err - } - cp.ExtensionProperties = extensionProperties - } - case "maintenanceScope": - if v != nil { - var maintenanceScope Scope - err = json.Unmarshal(*v, &maintenanceScope) - if err != nil { - return err - } - cp.MaintenanceScope = maintenanceScope - } - case "maintenanceWindow": - if v != nil { - var window Window - err = json.Unmarshal(*v, &window) - if err != nil { - return err - } - cp.Window = &window - } - case "visibility": - if v != nil { - var visibility Visibility - err = json.Unmarshal(*v, &visibility) - if err != nil { - return err - } - cp.Visibility = visibility - } - } - } - - return nil -} - -// Error an error response received from the Azure Maintenance service. -type Error struct { - // Error - Details of the error - Error *ErrorDetails `json:"error,omitempty"` -} - -// ErrorDetails an error response details received from the Azure Maintenance service. -type ErrorDetails struct { - // Code - Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. - Code *string `json:"code,omitempty"` - // Message - Human-readable representation of the error. - Message *string `json:"message,omitempty"` -} - -// ListApplyUpdate response for ApplyUpdate list -type ListApplyUpdate struct { - autorest.Response `json:"-"` - // Value - The list of apply updates - Value *[]ApplyUpdate `json:"value,omitempty"` -} - -// ListConfigurationAssignmentsResult response for ConfigurationAssignments list -type ListConfigurationAssignmentsResult struct { - autorest.Response `json:"-"` - // Value - The list of configuration Assignments - Value *[]ConfigurationAssignment `json:"value,omitempty"` -} - -// ListMaintenanceConfigurationsResult response for MaintenanceConfigurations list -type ListMaintenanceConfigurationsResult struct { - autorest.Response `json:"-"` - // Value - The list of maintenance Configurations - Value *[]Configuration `json:"value,omitempty"` -} - -// ListUpdatesResult response for Updates list -type ListUpdatesResult struct { - autorest.Response `json:"-"` - // Value - The pending updates - Value *[]Update `json:"value,omitempty"` -} - -// Operation represents an operation returned by the GetOperations request -type Operation struct { - // Name - Name of the operation - Name *string `json:"name,omitempty"` - // Display - Display name of the operation - Display *OperationInfo `json:"display,omitempty"` - // Origin - Origin of the operation - Origin *string `json:"origin,omitempty"` - // Properties - Properties of the operation - Properties interface{} `json:"properties,omitempty"` - // IsDataAction - Indicates whether the operation is a data action - IsDataAction *bool `json:"isDataAction,omitempty"` -} - -// OperationInfo information about an operation -type OperationInfo struct { - // Provider - Name of the provider - Provider *string `json:"provider,omitempty"` - // Resource - Name of the resource type - Resource *string `json:"resource,omitempty"` - // Operation - Name of the operation - Operation *string `json:"operation,omitempty"` - // Description - Description of the operation - Description *string `json:"description,omitempty"` -} - -// OperationsListResult result of the List Operations operation -type OperationsListResult struct { - autorest.Response `json:"-"` - // Value - A collection of operations - Value *[]Operation `json:"value,omitempty"` -} - -// Resource definition of a Resource -type Resource struct { - // ID - READ-ONLY; Fully qualified identifier of the resource - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the resource - Type *string `json:"type,omitempty"` - // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// Update maintenance update on a resource -type Update struct { - // MaintenanceScope - The impact area. Possible values include: 'ScopeHost', 'ScopeOSImage', 'ScopeExtension', 'ScopeInGuestPatch', 'ScopeSQLDB', 'ScopeSQLManagedInstance' - MaintenanceScope Scope `json:"maintenanceScope,omitempty"` - // ImpactType - The impact type. Possible values include: 'ImpactTypeNone', 'ImpactTypeFreeze', 'ImpactTypeRestart', 'ImpactTypeRedeploy' - ImpactType ImpactType `json:"impactType,omitempty"` - // Status - The status. Possible values include: 'UpdateStatusPending', 'UpdateStatusInProgress', 'UpdateStatusCompleted', 'UpdateStatusRetryNow', 'UpdateStatusRetryLater' - Status UpdateStatus `json:"status,omitempty"` - // ImpactDurationInSec - Duration of impact in seconds - ImpactDurationInSec *int32 `json:"impactDurationInSec,omitempty"` - // NotBefore - Time when Azure will start force updates if not self-updated by customer before this time - NotBefore *date.Time `json:"notBefore,omitempty"` - // UpdateProperties - Properties of the apply update - *UpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Update. -func (u Update) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if u.MaintenanceScope != "" { - objectMap["maintenanceScope"] = u.MaintenanceScope - } - if u.ImpactType != "" { - objectMap["impactType"] = u.ImpactType - } - if u.Status != "" { - objectMap["status"] = u.Status - } - if u.ImpactDurationInSec != nil { - objectMap["impactDurationInSec"] = u.ImpactDurationInSec - } - if u.NotBefore != nil { - objectMap["notBefore"] = u.NotBefore - } - if u.UpdateProperties != nil { - objectMap["properties"] = u.UpdateProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Update struct. -func (u *Update) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "maintenanceScope": - if v != nil { - var maintenanceScope Scope - err = json.Unmarshal(*v, &maintenanceScope) - if err != nil { - return err - } - u.MaintenanceScope = maintenanceScope - } - case "impactType": - if v != nil { - var impactType ImpactType - err = json.Unmarshal(*v, &impactType) - if err != nil { - return err - } - u.ImpactType = impactType - } - case "status": - if v != nil { - var status UpdateStatus - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - u.Status = status - } - case "impactDurationInSec": - if v != nil { - var impactDurationInSec int32 - err = json.Unmarshal(*v, &impactDurationInSec) - if err != nil { - return err - } - u.ImpactDurationInSec = &impactDurationInSec - } - case "notBefore": - if v != nil { - var notBefore date.Time - err = json.Unmarshal(*v, ¬Before) - if err != nil { - return err - } - u.NotBefore = ¬Before - } - case "properties": - if v != nil { - var updateProperties UpdateProperties - err = json.Unmarshal(*v, &updateProperties) - if err != nil { - return err - } - u.UpdateProperties = &updateProperties - } - } - } - - return nil -} - -// UpdateProperties properties for update -type UpdateProperties struct { - // ResourceID - The resourceId - ResourceID *string `json:"resourceId,omitempty"` -} - -// Window definition of a MaintenanceWindow -type Window struct { - // StartDateTime - Effective start date of the maintenance window in YYYY-MM-DD hh:mm format. The start date can be set to either the current date or future date. The window will be created in the time zone provided and adjusted to daylight savings according to that time zone. - StartDateTime *string `json:"startDateTime,omitempty"` - // ExpirationDateTime - Effective expiration date of the maintenance window in YYYY-MM-DD hh:mm format. The window will be created in the time zone provided and adjusted to daylight savings according to that time zone. Expiration date must be set to a future date. If not provided, it will be set to the maximum datetime 9999-12-31 23:59:59. - ExpirationDateTime *string `json:"expirationDateTime,omitempty"` - // Duration - Duration of the maintenance window in HH:mm format. If not provided, default value will be used based on maintenance scope provided. Example: 05:00. - Duration *string `json:"duration,omitempty"` - // TimeZone - Name of the timezone. List of timezones can be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. Example: Pacific Standard Time, UTC, W. Europe Standard Time, Korea Standard Time, Cen. Australia Standard Time. - TimeZone *string `json:"timeZone,omitempty"` - // RecurEvery - Rate at which a Maintenance window is expected to recur. The rate can be expressed as daily, weekly, or monthly schedules. Daily schedule are formatted as recurEvery: [Frequency as integer]['Day(s)']. If no frequency is provided, the default frequency is 1. Daily schedule examples are recurEvery: Day, recurEvery: 3Days. Weekly schedule are formatted as recurEvery: [Frequency as integer]['Week(s)'] [Optional comma separated list of weekdays Monday-Sunday]. Weekly schedule examples are recurEvery: 3Weeks, recurEvery: Week Saturday,Sunday. Monthly schedules are formatted as [Frequency as integer]['Month(s)'] [Comma separated list of month days] or [Frequency as integer]['Month(s)'] [Week of Month (First, Second, Third, Fourth, Last)] [Weekday Monday-Sunday]. Monthly schedule examples are recurEvery: Month, recurEvery: 2Months, recurEvery: Month day23,day24, recurEvery: Month Last Sunday, recurEvery: Month Fourth Monday. - RecurEvery *string `json:"recurEvery,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/operations.go deleted file mode 100644 index 1629e0692e8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package maintenance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the azure Maintenance Management Client -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list the available operations supported by the Microsoft.Maintenance resource provider -func (client OperationsClient) List(ctx context.Context) (result OperationsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Maintenance/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/publicmaintenanceconfigurations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/publicmaintenanceconfigurations.go deleted file mode 100644 index 501afcf9b24..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/publicmaintenanceconfigurations.go +++ /dev/null @@ -1,177 +0,0 @@ -package maintenance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PublicMaintenanceConfigurationsClient is the azure Maintenance Management Client -type PublicMaintenanceConfigurationsClient struct { - BaseClient -} - -// NewPublicMaintenanceConfigurationsClient creates an instance of the PublicMaintenanceConfigurationsClient client. -func NewPublicMaintenanceConfigurationsClient(subscriptionID string) PublicMaintenanceConfigurationsClient { - return NewPublicMaintenanceConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPublicMaintenanceConfigurationsClientWithBaseURI creates an instance of the PublicMaintenanceConfigurationsClient -// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI -// (sovereign clouds, Azure stack). -func NewPublicMaintenanceConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) PublicMaintenanceConfigurationsClient { - return PublicMaintenanceConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get sends the get request. -// Parameters: -// resourceName - maintenance Configuration Name -func (client PublicMaintenanceConfigurationsClient) Get(ctx context.Context, resourceName string) (result Configuration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PublicMaintenanceConfigurationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.PublicMaintenanceConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.PublicMaintenanceConfigurationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.PublicMaintenanceConfigurationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PublicMaintenanceConfigurationsClient) GetPreparer(ctx context.Context, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PublicMaintenanceConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PublicMaintenanceConfigurationsClient) GetResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List sends the list request. -func (client PublicMaintenanceConfigurationsClient) List(ctx context.Context) (result ListMaintenanceConfigurationsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PublicMaintenanceConfigurationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.PublicMaintenanceConfigurationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.PublicMaintenanceConfigurationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.PublicMaintenanceConfigurationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PublicMaintenanceConfigurationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/publicMaintenanceConfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PublicMaintenanceConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PublicMaintenanceConfigurationsClient) ListResponder(resp *http.Response) (result ListMaintenanceConfigurationsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/updates.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/updates.go deleted file mode 100644 index b1da16bb27a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/updates.go +++ /dev/null @@ -1,195 +0,0 @@ -package maintenance - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// UpdatesClient is the azure Maintenance Management Client -type UpdatesClient struct { - BaseClient -} - -// NewUpdatesClient creates an instance of the UpdatesClient client. -func NewUpdatesClient(subscriptionID string) UpdatesClient { - return NewUpdatesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUpdatesClientWithBaseURI creates an instance of the UpdatesClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewUpdatesClientWithBaseURI(baseURI string, subscriptionID string) UpdatesClient { - return UpdatesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get updates to resources. -// Parameters: -// resourceGroupName - resource group name -// providerName - resource provider name -// resourceType - resource type -// resourceName - resource identifier -func (client UpdatesClient) List(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string) (result ListUpdatesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UpdatesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, resourceGroupName, providerName, resourceType, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.UpdatesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.UpdatesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.UpdatesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UpdatesClient) ListPreparer(ctx context.Context, resourceGroupName string, providerName string, resourceType string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerName": autorest.Encode("path", providerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceType": autorest.Encode("path", resourceType), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UpdatesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UpdatesClient) ListResponder(resp *http.Response) (result ListUpdatesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListParent get updates to resources. -// Parameters: -// resourceGroupName - resource group name -// providerName - resource provider name -// resourceParentType - resource parent type -// resourceParentName - resource parent identifier -// resourceType - resource type -// resourceName - resource identifier -func (client UpdatesClient) ListParent(ctx context.Context, resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string) (result ListUpdatesResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UpdatesClient.ListParent") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListParentPreparer(ctx, resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.UpdatesClient", "ListParent", nil, "Failure preparing request") - return - } - - resp, err := client.ListParentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maintenance.UpdatesClient", "ListParent", resp, "Failure sending request") - return - } - - result, err = client.ListParentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maintenance.UpdatesClient", "ListParent", resp, "Failure responding to request") - return - } - - return -} - -// ListParentPreparer prepares the ListParent request. -func (client UpdatesClient) ListParentPreparer(ctx context.Context, resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "providerName": autorest.Encode("path", providerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "resourceParentName": autorest.Encode("path", resourceParentName), - "resourceParentType": autorest.Encode("path", resourceParentType), - "resourceType": autorest.Encode("path", resourceType), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/updates", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListParentSender sends the ListParent request. The method will close the -// http.Response Body if it receives an error. -func (client UpdatesClient) ListParentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListParentResponder handles the response to the ListParent request. The method always -// closes the http.Response Body. -func (client UpdatesClient) ListParentResponder(resp *http.Response) (result ListUpdatesResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/version.go deleted file mode 100644 index b99cdb890e5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package maintenance - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " maintenance/2021-05-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/_meta.json deleted file mode 100644 index 58571b36d63..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/managedservices/resource-manager/readme.md", - "tag": "package-2019-06", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2019-06 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/managedservices/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/client.go deleted file mode 100644 index 377df1ada7a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/client.go +++ /dev/null @@ -1,39 +0,0 @@ -// Package managedservices implements the Azure ARM Managedservices service API version 2019-06-01. -// -// Specification for ManagedServices. -package managedservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Managedservices - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Managedservices. -type BaseClient struct { - autorest.Client - BaseURI string -} - -// New creates an instance of the BaseClient client. -func New() BaseClient { - return NewWithBaseURI(DefaultBaseURI) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/enums.go deleted file mode 100644 index 4626725b551..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/enums.go +++ /dev/null @@ -1,42 +0,0 @@ -package managedservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // Accepted ... - Accepted ProvisioningState = "Accepted" - // Canceled ... - Canceled ProvisioningState = "Canceled" - // Created ... - Created ProvisioningState = "Created" - // Creating ... - Creating ProvisioningState = "Creating" - // Deleted ... - Deleted ProvisioningState = "Deleted" - // Deleting ... - Deleting ProvisioningState = "Deleting" - // Failed ... - Failed ProvisioningState = "Failed" - // NotSpecified ... - NotSpecified ProvisioningState = "NotSpecified" - // Ready ... - Ready ProvisioningState = "Ready" - // Running ... - Running ProvisioningState = "Running" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" - // Updating ... - Updating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Accepted, Canceled, Created, Creating, Deleted, Deleting, Failed, NotSpecified, Ready, Running, Succeeded, Updating} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/models.go deleted file mode 100644 index b7aa52dcdd6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/models.go +++ /dev/null @@ -1,707 +0,0 @@ -package managedservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "github.com/gofrs/uuid" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices" - -// Authorization authorization tuple containing principal Id (of user/service principal/security group) and -// role definition id. -type Authorization struct { - // PrincipalID - Principal Id of the security group/service principal/user that would be assigned permissions to the projected subscription - PrincipalID *string `json:"principalId,omitempty"` - // PrincipalIDDisplayName - Display name of the principal Id. - PrincipalIDDisplayName *string `json:"principalIdDisplayName,omitempty"` - // RoleDefinitionID - The role definition identifier. This role will define all the permissions that the security group/service principal/user must have on the projected subscription. This role cannot be an owner role. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - // DelegatedRoleDefinitionIds - The delegatedRoleDefinitionIds field is required when the roleDefinitionId refers to the User Access Administrator Role. It is the list of role definition ids which define all the permissions that the user in the authorization can assign to other security groups/service principals/users. - DelegatedRoleDefinitionIds *[]uuid.UUID `json:"delegatedRoleDefinitionIds,omitempty"` -} - -// ErrorDefinition error response indicates Azure Resource Manager is not able to process the incoming -// request. The reason is provided in the error message. -type ErrorDefinition struct { - // Code - Error code. - Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` - // Details - Internal error details. - Details *[]ErrorDefinition `json:"details,omitempty"` -} - -// ErrorResponse error response. -type ErrorResponse struct { - // Error - The error details. - Error *ErrorDefinition `json:"error,omitempty"` -} - -// Operation object that describes a single Microsoft.ManagedServices operation. -type Operation struct { - // Name - READ-ONLY; Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - READ-ONLY; The object that represents the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationDisplay the object that represents the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.ManagedServices - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: Registration definition, registration assignment etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - Description of the operation. - Description *string `json:"description,omitempty"` -} - -// OperationList list of the operations. -type OperationList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of Microsoft.ManagedServices operations. - Value *[]Operation `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationList. -func (ol OperationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Plan plan details for the managed services. -type Plan struct { - // Name - The plan name. - Name *string `json:"name,omitempty"` - // Publisher - The publisher ID. - Publisher *string `json:"publisher,omitempty"` - // Product - The product code. - Product *string `json:"product,omitempty"` - // Version - The plan's version. - Version *string `json:"version,omitempty"` -} - -// RegistrationAssignment registration assignment. -type RegistrationAssignment struct { - autorest.Response `json:"-"` - // Properties - Properties of a registration assignment. - Properties *RegistrationAssignmentProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The fully qualified path of the registration assignment. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; Name of the registration assignment. - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistrationAssignment. -func (ra RegistrationAssignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ra.Properties != nil { - objectMap["properties"] = ra.Properties - } - return json.Marshal(objectMap) -} - -// RegistrationAssignmentList list of registration assignments. -type RegistrationAssignmentList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of registration assignments. - Value *[]RegistrationAssignment `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to next page of registration assignments. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistrationAssignmentList. -func (ral RegistrationAssignmentList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RegistrationAssignmentListIterator provides access to a complete listing of RegistrationAssignment -// values. -type RegistrationAssignmentListIterator struct { - i int - page RegistrationAssignmentListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RegistrationAssignmentListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistrationAssignmentListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RegistrationAssignmentListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegistrationAssignmentListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RegistrationAssignmentListIterator) Response() RegistrationAssignmentList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RegistrationAssignmentListIterator) Value() RegistrationAssignment { - if !iter.page.NotDone() { - return RegistrationAssignment{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RegistrationAssignmentListIterator type. -func NewRegistrationAssignmentListIterator(page RegistrationAssignmentListPage) RegistrationAssignmentListIterator { - return RegistrationAssignmentListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ral RegistrationAssignmentList) IsEmpty() bool { - return ral.Value == nil || len(*ral.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ral RegistrationAssignmentList) hasNextLink() bool { - return ral.NextLink != nil && len(*ral.NextLink) != 0 -} - -// registrationAssignmentListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ral RegistrationAssignmentList) registrationAssignmentListPreparer(ctx context.Context) (*http.Request, error) { - if !ral.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ral.NextLink))) -} - -// RegistrationAssignmentListPage contains a page of RegistrationAssignment values. -type RegistrationAssignmentListPage struct { - fn func(context.Context, RegistrationAssignmentList) (RegistrationAssignmentList, error) - ral RegistrationAssignmentList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RegistrationAssignmentListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistrationAssignmentListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ral) - if err != nil { - return err - } - page.ral = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RegistrationAssignmentListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RegistrationAssignmentListPage) NotDone() bool { - return !page.ral.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RegistrationAssignmentListPage) Response() RegistrationAssignmentList { - return page.ral -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RegistrationAssignmentListPage) Values() []RegistrationAssignment { - if page.ral.IsEmpty() { - return nil - } - return *page.ral.Value -} - -// Creates a new instance of the RegistrationAssignmentListPage type. -func NewRegistrationAssignmentListPage(cur RegistrationAssignmentList, getNextPage func(context.Context, RegistrationAssignmentList) (RegistrationAssignmentList, error)) RegistrationAssignmentListPage { - return RegistrationAssignmentListPage{ - fn: getNextPage, - ral: cur, - } -} - -// RegistrationAssignmentProperties properties of a registration assignment. -type RegistrationAssignmentProperties struct { - // RegistrationDefinitionID - Fully qualified path of the registration definition. - RegistrationDefinitionID *string `json:"registrationDefinitionId,omitempty"` - // ProvisioningState - READ-ONLY; Current state of the registration assignment. Possible values include: 'NotSpecified', 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // RegistrationDefinition - READ-ONLY; Registration definition inside registration assignment. - RegistrationDefinition *RegistrationAssignmentPropertiesRegistrationDefinition `json:"registrationDefinition,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistrationAssignmentProperties. -func (rap RegistrationAssignmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rap.RegistrationDefinitionID != nil { - objectMap["registrationDefinitionId"] = rap.RegistrationDefinitionID - } - return json.Marshal(objectMap) -} - -// RegistrationAssignmentPropertiesRegistrationDefinition registration definition inside registration -// assignment. -type RegistrationAssignmentPropertiesRegistrationDefinition struct { - // Properties - Properties of registration definition inside registration assignment. - Properties *RegistrationAssignmentPropertiesRegistrationDefinitionProperties `json:"properties,omitempty"` - // Plan - Plan details for the managed services. - Plan *Plan `json:"plan,omitempty"` - // ID - READ-ONLY; Fully qualified path of the registration definition. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; Type of the resource (Microsoft.ManagedServices/registrationDefinitions). - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; Name of the registration definition. - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistrationAssignmentPropertiesRegistrationDefinition. -func (rapD RegistrationAssignmentPropertiesRegistrationDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rapD.Properties != nil { - objectMap["properties"] = rapD.Properties - } - if rapD.Plan != nil { - objectMap["plan"] = rapD.Plan - } - return json.Marshal(objectMap) -} - -// RegistrationAssignmentPropertiesRegistrationDefinitionProperties properties of registration definition -// inside registration assignment. -type RegistrationAssignmentPropertiesRegistrationDefinitionProperties struct { - // Description - Description of the registration definition. - Description *string `json:"description,omitempty"` - // Authorizations - Authorization tuple containing principal id of the user/security group or service principal and id of the build-in role. - Authorizations *[]Authorization `json:"authorizations,omitempty"` - // RegistrationDefinitionName - Name of the registration definition. - RegistrationDefinitionName *string `json:"registrationDefinitionName,omitempty"` - // ProvisioningState - Current state of the registration definition. Possible values include: 'NotSpecified', 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ManageeTenantID - Id of the home tenant. - ManageeTenantID *string `json:"manageeTenantId,omitempty"` - // ManageeTenantName - Name of the home tenant. - ManageeTenantName *string `json:"manageeTenantName,omitempty"` - // ManagedByTenantID - Id of the managedBy tenant. - ManagedByTenantID *string `json:"managedByTenantId,omitempty"` - // ManagedByTenantName - Name of the managedBy tenant. - ManagedByTenantName *string `json:"managedByTenantName,omitempty"` -} - -// RegistrationAssignmentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type RegistrationAssignmentsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistrationAssignmentsClient) (RegistrationAssignment, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistrationAssignmentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RegistrationAssignmentsCreateOrUpdateFuture.Result. -func (future *RegistrationAssignmentsCreateOrUpdateFuture) result(client RegistrationAssignmentsClient) (ra RegistrationAssignment, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ra.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("managedservices.RegistrationAssignmentsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ra.Response.Response, err = future.GetResult(sender); err == nil && ra.Response.Response.StatusCode != http.StatusNoContent { - ra, err = client.CreateOrUpdateResponder(ra.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsCreateOrUpdateFuture", "Result", ra.Response.Response, "Failure responding to request") - } - } - return -} - -// RegistrationAssignmentsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type RegistrationAssignmentsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistrationAssignmentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistrationAssignmentsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RegistrationAssignmentsDeleteFuture.Result. -func (future *RegistrationAssignmentsDeleteFuture) result(client RegistrationAssignmentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("managedservices.RegistrationAssignmentsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// RegistrationDefinition registration definition. -type RegistrationDefinition struct { - autorest.Response `json:"-"` - // Properties - Properties of a registration definition. - Properties *RegistrationDefinitionProperties `json:"properties,omitempty"` - // Plan - Plan details for the managed services. - Plan *Plan `json:"plan,omitempty"` - // ID - READ-ONLY; Fully qualified path of the registration definition. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; Type of the resource. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; Name of the registration definition. - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistrationDefinition. -func (rd RegistrationDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rd.Properties != nil { - objectMap["properties"] = rd.Properties - } - if rd.Plan != nil { - objectMap["plan"] = rd.Plan - } - return json.Marshal(objectMap) -} - -// RegistrationDefinitionList list of registration definitions. -type RegistrationDefinitionList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of registration definitions. - Value *[]RegistrationDefinition `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to next page of registration definitions. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistrationDefinitionList. -func (rdl RegistrationDefinitionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RegistrationDefinitionListIterator provides access to a complete listing of RegistrationDefinition -// values. -type RegistrationDefinitionListIterator struct { - i int - page RegistrationDefinitionListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RegistrationDefinitionListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistrationDefinitionListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RegistrationDefinitionListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegistrationDefinitionListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RegistrationDefinitionListIterator) Response() RegistrationDefinitionList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RegistrationDefinitionListIterator) Value() RegistrationDefinition { - if !iter.page.NotDone() { - return RegistrationDefinition{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RegistrationDefinitionListIterator type. -func NewRegistrationDefinitionListIterator(page RegistrationDefinitionListPage) RegistrationDefinitionListIterator { - return RegistrationDefinitionListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rdl RegistrationDefinitionList) IsEmpty() bool { - return rdl.Value == nil || len(*rdl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rdl RegistrationDefinitionList) hasNextLink() bool { - return rdl.NextLink != nil && len(*rdl.NextLink) != 0 -} - -// registrationDefinitionListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rdl RegistrationDefinitionList) registrationDefinitionListPreparer(ctx context.Context) (*http.Request, error) { - if !rdl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rdl.NextLink))) -} - -// RegistrationDefinitionListPage contains a page of RegistrationDefinition values. -type RegistrationDefinitionListPage struct { - fn func(context.Context, RegistrationDefinitionList) (RegistrationDefinitionList, error) - rdl RegistrationDefinitionList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RegistrationDefinitionListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistrationDefinitionListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rdl) - if err != nil { - return err - } - page.rdl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RegistrationDefinitionListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RegistrationDefinitionListPage) NotDone() bool { - return !page.rdl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RegistrationDefinitionListPage) Response() RegistrationDefinitionList { - return page.rdl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RegistrationDefinitionListPage) Values() []RegistrationDefinition { - if page.rdl.IsEmpty() { - return nil - } - return *page.rdl.Value -} - -// Creates a new instance of the RegistrationDefinitionListPage type. -func NewRegistrationDefinitionListPage(cur RegistrationDefinitionList, getNextPage func(context.Context, RegistrationDefinitionList) (RegistrationDefinitionList, error)) RegistrationDefinitionListPage { - return RegistrationDefinitionListPage{ - fn: getNextPage, - rdl: cur, - } -} - -// RegistrationDefinitionProperties properties of a registration definition. -type RegistrationDefinitionProperties struct { - // Description - Description of the registration definition. - Description *string `json:"description,omitempty"` - // Authorizations - Authorization tuple containing principal id of the user/security group or service principal and id of the build-in role. - Authorizations *[]Authorization `json:"authorizations,omitempty"` - // RegistrationDefinitionName - Name of the registration definition. - RegistrationDefinitionName *string `json:"registrationDefinitionName,omitempty"` - // ManagedByTenantID - Id of the managedBy tenant. - ManagedByTenantID *string `json:"managedByTenantId,omitempty"` - // ProvisioningState - READ-ONLY; Current state of the registration definition. Possible values include: 'NotSpecified', 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ManagedByTenantName - READ-ONLY; Name of the managedBy tenant. - ManagedByTenantName *string `json:"managedByTenantName,omitempty"` -} - -// MarshalJSON is the custom marshaler for RegistrationDefinitionProperties. -func (rdp RegistrationDefinitionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rdp.Description != nil { - objectMap["description"] = rdp.Description - } - if rdp.Authorizations != nil { - objectMap["authorizations"] = rdp.Authorizations - } - if rdp.RegistrationDefinitionName != nil { - objectMap["registrationDefinitionName"] = rdp.RegistrationDefinitionName - } - if rdp.ManagedByTenantID != nil { - objectMap["managedByTenantId"] = rdp.ManagedByTenantID - } - return json.Marshal(objectMap) -} - -// RegistrationDefinitionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type RegistrationDefinitionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(RegistrationDefinitionsClient) (RegistrationDefinition, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *RegistrationDefinitionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for RegistrationDefinitionsCreateOrUpdateFuture.Result. -func (future *RegistrationDefinitionsCreateOrUpdateFuture) result(client RegistrationDefinitionsClient) (rd RegistrationDefinition, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rd.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("managedservices.RegistrationDefinitionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rd.Response.Response, err = future.GetResult(sender); err == nil && rd.Response.Response.StatusCode != http.StatusNoContent { - rd, err = client.CreateOrUpdateResponder(rd.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsCreateOrUpdateFuture", "Result", rd.Response.Response, "Failure responding to request") - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/operations.go deleted file mode 100644 index 3a2a2593b96..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package managedservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the specification for ManagedServices. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient() OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI)} -} - -// List gets a list of the operations. -func (client OperationsClient) List(ctx context.Context) (result OperationList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedservices.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2019-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ManagedServices/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/registrationassignments.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/registrationassignments.go deleted file mode 100644 index 008e6ef7bf6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/registrationassignments.go +++ /dev/null @@ -1,410 +0,0 @@ -package managedservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RegistrationAssignmentsClient is the specification for ManagedServices. -type RegistrationAssignmentsClient struct { - BaseClient -} - -// NewRegistrationAssignmentsClient creates an instance of the RegistrationAssignmentsClient client. -func NewRegistrationAssignmentsClient() RegistrationAssignmentsClient { - return NewRegistrationAssignmentsClientWithBaseURI(DefaultBaseURI) -} - -// NewRegistrationAssignmentsClientWithBaseURI creates an instance of the RegistrationAssignmentsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewRegistrationAssignmentsClientWithBaseURI(baseURI string) RegistrationAssignmentsClient { - return RegistrationAssignmentsClient{NewWithBaseURI(baseURI)} -} - -// CreateOrUpdate creates or updates a registration assignment. -// Parameters: -// scope - scope of the resource. -// registrationAssignmentID - guid of the registration assignment. -// requestBody - the parameters required to create new registration assignment. -func (client RegistrationAssignmentsClient) CreateOrUpdate(ctx context.Context, scope string, registrationAssignmentID string, requestBody RegistrationAssignment) (result RegistrationAssignmentsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistrationAssignmentsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: requestBody, - Constraints: []validation.Constraint{{Target: "requestBody.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "requestBody.Properties.RegistrationDefinitionID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "requestBody.Properties.RegistrationDefinition", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "requestBody.Properties.RegistrationDefinition.Plan", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "requestBody.Properties.RegistrationDefinition.Plan.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "requestBody.Properties.RegistrationDefinition.Plan.Publisher", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "requestBody.Properties.RegistrationDefinition.Plan.Product", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "requestBody.Properties.RegistrationDefinition.Plan.Version", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("managedservices.RegistrationAssignmentsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, scope, registrationAssignmentID, requestBody) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RegistrationAssignmentsClient) CreateOrUpdatePreparer(ctx context.Context, scope string, registrationAssignmentID string, requestBody RegistrationAssignment) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registrationAssignmentId": autorest.Encode("path", registrationAssignmentID), - "scope": scope, - } - - const APIVersion = "2019-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - requestBody.ID = nil - requestBody.Type = nil - requestBody.Name = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}", pathParameters), - autorest.WithJSON(requestBody), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RegistrationAssignmentsClient) CreateOrUpdateSender(req *http.Request) (future RegistrationAssignmentsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RegistrationAssignmentsClient) CreateOrUpdateResponder(resp *http.Response) (result RegistrationAssignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified registration assignment. -// Parameters: -// scope - scope of the resource. -// registrationAssignmentID - guid of the registration assignment. -func (client RegistrationAssignmentsClient) Delete(ctx context.Context, scope string, registrationAssignmentID string) (result RegistrationAssignmentsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistrationAssignmentsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, scope, registrationAssignmentID) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RegistrationAssignmentsClient) DeletePreparer(ctx context.Context, scope string, registrationAssignmentID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registrationAssignmentId": autorest.Encode("path", registrationAssignmentID), - "scope": scope, - } - - const APIVersion = "2019-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RegistrationAssignmentsClient) DeleteSender(req *http.Request) (future RegistrationAssignmentsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RegistrationAssignmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the details of specified registration assignment. -// Parameters: -// scope - scope of the resource. -// registrationAssignmentID - guid of the registration assignment. -// expandRegistrationDefinition - tells whether to return registration definition details also along with -// registration assignment details. -func (client RegistrationAssignmentsClient) Get(ctx context.Context, scope string, registrationAssignmentID string, expandRegistrationDefinition *bool) (result RegistrationAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistrationAssignmentsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, scope, registrationAssignmentID, expandRegistrationDefinition) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RegistrationAssignmentsClient) GetPreparer(ctx context.Context, scope string, registrationAssignmentID string, expandRegistrationDefinition *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registrationAssignmentId": autorest.Encode("path", registrationAssignmentID), - "scope": scope, - } - - const APIVersion = "2019-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if expandRegistrationDefinition != nil { - queryParameters["$expandRegistrationDefinition"] = autorest.Encode("query", *expandRegistrationDefinition) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RegistrationAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RegistrationAssignmentsClient) GetResponder(resp *http.Response) (result RegistrationAssignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of the registration assignments. -// Parameters: -// scope - scope of the resource. -// expandRegistrationDefinition - tells whether to return registration definition details also along with -// registration assignment details. -func (client RegistrationAssignmentsClient) List(ctx context.Context, scope string, expandRegistrationDefinition *bool) (result RegistrationAssignmentListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistrationAssignmentsClient.List") - defer func() { - sc := -1 - if result.ral.Response.Response != nil { - sc = result.ral.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, scope, expandRegistrationDefinition) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.ral.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsClient", "List", resp, "Failure sending request") - return - } - - result.ral, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsClient", "List", resp, "Failure responding to request") - return - } - if result.ral.hasNextLink() && result.ral.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RegistrationAssignmentsClient) ListPreparer(ctx context.Context, scope string, expandRegistrationDefinition *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2019-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if expandRegistrationDefinition != nil { - queryParameters["$expandRegistrationDefinition"] = autorest.Encode("query", *expandRegistrationDefinition) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.ManagedServices/registrationAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client RegistrationAssignmentsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client RegistrationAssignmentsClient) ListResponder(resp *http.Response) (result RegistrationAssignmentList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client RegistrationAssignmentsClient) listNextResults(ctx context.Context, lastResults RegistrationAssignmentList) (result RegistrationAssignmentList, err error) { - req, err := lastResults.registrationAssignmentListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationAssignmentsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistrationAssignmentsClient) ListComplete(ctx context.Context, scope string, expandRegistrationDefinition *bool) (result RegistrationAssignmentListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistrationAssignmentsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, scope, expandRegistrationDefinition) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/registrationdefinitions.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/registrationdefinitions.go deleted file mode 100644 index a7bec2abc15..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/registrationdefinitions.go +++ /dev/null @@ -1,396 +0,0 @@ -package managedservices - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RegistrationDefinitionsClient is the specification for ManagedServices. -type RegistrationDefinitionsClient struct { - BaseClient -} - -// NewRegistrationDefinitionsClient creates an instance of the RegistrationDefinitionsClient client. -func NewRegistrationDefinitionsClient() RegistrationDefinitionsClient { - return NewRegistrationDefinitionsClientWithBaseURI(DefaultBaseURI) -} - -// NewRegistrationDefinitionsClientWithBaseURI creates an instance of the RegistrationDefinitionsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewRegistrationDefinitionsClientWithBaseURI(baseURI string) RegistrationDefinitionsClient { - return RegistrationDefinitionsClient{NewWithBaseURI(baseURI)} -} - -// CreateOrUpdate creates or updates a registration definition. -// Parameters: -// registrationDefinitionID - guid of the registration definition. -// scope - scope of the resource. -// requestBody - the parameters required to create new registration definition. -func (client RegistrationDefinitionsClient) CreateOrUpdate(ctx context.Context, registrationDefinitionID string, scope string, requestBody RegistrationDefinition) (result RegistrationDefinitionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistrationDefinitionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: requestBody, - Constraints: []validation.Constraint{{Target: "requestBody.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "requestBody.Properties.Authorizations", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "requestBody.Properties.ManagedByTenantID", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "requestBody.Plan", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "requestBody.Plan.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "requestBody.Plan.Publisher", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "requestBody.Plan.Product", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "requestBody.Plan.Version", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("managedservices.RegistrationDefinitionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, registrationDefinitionID, scope, requestBody) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RegistrationDefinitionsClient) CreateOrUpdatePreparer(ctx context.Context, registrationDefinitionID string, scope string, requestBody RegistrationDefinition) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registrationDefinitionId": autorest.Encode("path", registrationDefinitionID), - "scope": scope, - } - - const APIVersion = "2019-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - requestBody.ID = nil - requestBody.Type = nil - requestBody.Name = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}", pathParameters), - autorest.WithJSON(requestBody), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RegistrationDefinitionsClient) CreateOrUpdateSender(req *http.Request) (future RegistrationDefinitionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RegistrationDefinitionsClient) CreateOrUpdateResponder(resp *http.Response) (result RegistrationDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the registration definition. -// Parameters: -// registrationDefinitionID - guid of the registration definition. -// scope - scope of the resource. -func (client RegistrationDefinitionsClient) Delete(ctx context.Context, registrationDefinitionID string, scope string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistrationDefinitionsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, registrationDefinitionID, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RegistrationDefinitionsClient) DeletePreparer(ctx context.Context, registrationDefinitionID string, scope string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registrationDefinitionId": autorest.Encode("path", registrationDefinitionID), - "scope": scope, - } - - const APIVersion = "2019-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RegistrationDefinitionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RegistrationDefinitionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the registration definition details. -// Parameters: -// scope - scope of the resource. -// registrationDefinitionID - guid of the registration definition. -func (client RegistrationDefinitionsClient) Get(ctx context.Context, scope string, registrationDefinitionID string) (result RegistrationDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistrationDefinitionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, scope, registrationDefinitionID) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RegistrationDefinitionsClient) GetPreparer(ctx context.Context, scope string, registrationDefinitionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "registrationDefinitionId": autorest.Encode("path", registrationDefinitionID), - "scope": scope, - } - - const APIVersion = "2019-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RegistrationDefinitionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RegistrationDefinitionsClient) GetResponder(resp *http.Response) (result RegistrationDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of the registration definitions. -// Parameters: -// scope - scope of the resource. -func (client RegistrationDefinitionsClient) List(ctx context.Context, scope string) (result RegistrationDefinitionListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistrationDefinitionsClient.List") - defer func() { - sc := -1 - if result.rdl.Response.Response != nil { - sc = result.rdl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rdl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsClient", "List", resp, "Failure sending request") - return - } - - result.rdl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsClient", "List", resp, "Failure responding to request") - return - } - if result.rdl.hasNextLink() && result.rdl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RegistrationDefinitionsClient) ListPreparer(ctx context.Context, scope string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2019-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client RegistrationDefinitionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client RegistrationDefinitionsClient) ListResponder(resp *http.Response) (result RegistrationDefinitionList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client RegistrationDefinitionsClient) listNextResults(ctx context.Context, lastResults RegistrationDefinitionList) (result RegistrationDefinitionList, err error) { - req, err := lastResults.registrationDefinitionListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "managedservices.RegistrationDefinitionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RegistrationDefinitionsClient) ListComplete(ctx context.Context, scope string) (result RegistrationDefinitionListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegistrationDefinitionsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, scope) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/version.go deleted file mode 100644 index 4004dbdd42b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package managedservices - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " managedservices/2019-06-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/_meta.json deleted file mode 100644 index aded6d82464..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "c2ea3a3ccd14293b4bd1d17e684ef9129f0dc604", - "readme": "/_/azure-rest-api-specs/specification/maps/resource-manager/readme.md", - "tag": "package-2021-02", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-02 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/maps/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/accounts.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/accounts.go deleted file mode 100644 index ddf78f1bf02..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/accounts.go +++ /dev/null @@ -1,808 +0,0 @@ -package maps - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AccountsClient is the azure Maps -type AccountsClient struct { - BaseClient -} - -// NewAccountsClient creates an instance of the AccountsClient client. -func NewAccountsClient(subscriptionID string) AccountsClient { - return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountsClientWithBaseURI creates an instance of the AccountsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { - return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a Maps Account. A Maps Account holds the keys which allow access to the Maps REST -// APIs. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - the name of the Maps Account. -// mapsAccount - the new or updated parameters for the Maps Account. -func (client AccountsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, mapsAccount Account) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: mapsAccount, - Constraints: []validation.Constraint{{Target: "mapsAccount.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("maps.AccountsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, mapsAccount) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AccountsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, mapsAccount Account) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - mapsAccount.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}", pathParameters), - autorest.WithJSON(mapsAccount), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AccountsClient) CreateOrUpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Maps Account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - the name of the Maps Account. -func (client AccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("maps.AccountsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a Maps Account. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - the name of the Maps Account. -func (client AccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("maps.AccountsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AccountsClient) GetResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get all Maps Accounts in a Resource Group -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client AccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AccountsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.a.Response.Response != nil { - sc = result.a.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("maps.AccountsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.a.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.a, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.a.hasNextLink() && result.a.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AccountsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) (result Accounts, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client AccountsClient) listByResourceGroupNextResults(ctx context.Context, lastResults Accounts) (result Accounts, err error) { - req, err := lastResults.accountsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "maps.AccountsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "maps.AccountsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AccountsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription get all Maps Accounts in a Subscription -func (client AccountsClient) ListBySubscription(ctx context.Context) (result AccountsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.a.Response.Response != nil { - sc = result.a.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("maps.AccountsClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.a.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.a, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.a.hasNextLink() && result.a.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AccountsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Maps/accounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListBySubscriptionResponder(resp *http.Response) (result Accounts, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client AccountsClient) listBySubscriptionNextResults(ctx context.Context, lastResults Accounts) (result Accounts, err error) { - req, err := lastResults.accountsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "maps.AccountsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "maps.AccountsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountsClient) ListBySubscriptionComplete(ctx context.Context) (result AccountsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// ListKeys get the keys to use with the Maps APIs. A key is used to authenticate and authorize access to the Maps REST -// APIs. Only one key is needed at a time; two are given to provide seamless key regeneration. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - the name of the Maps Account. -func (client AccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result AccountKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("maps.AccountsClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client AccountsClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListKeysResponder(resp *http.Response) (result AccountKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerate either the primary or secondary key for use with the Maps APIs. The old key will stop -// working immediately. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - the name of the Maps Account. -// keySpecification - which key to regenerate: primary or secondary. -func (client AccountsClient) RegenerateKeys(ctx context.Context, resourceGroupName string, accountName string, keySpecification KeySpecification) (result AccountKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.RegenerateKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("maps.AccountsClient", "RegenerateKeys", err.Error()) - } - - req, err := client.RegenerateKeysPreparer(ctx, resourceGroupName, accountName, keySpecification) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "RegenerateKeys", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client AccountsClient) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, accountName string, keySpecification KeySpecification) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}/regenerateKey", pathParameters), - autorest.WithJSON(keySpecification), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client AccountsClient) RegenerateKeysResponder(resp *http.Response) (result AccountKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a Maps Account. Only a subset of the parameters may be updated after creation, such as Sku, Tags, -// Properties. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - the name of the Maps Account. -// mapsAccountUpdateParameters - the updated parameters for the Maps Account. -func (client AccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, mapsAccountUpdateParameters AccountUpdateParameters) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("maps.AccountsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, mapsAccountUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.AccountsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, mapsAccountUpdateParameters AccountUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}", pathParameters), - autorest.WithJSON(mapsAccountUpdateParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/client.go deleted file mode 100644 index c452debd4ec..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package maps implements the Azure ARM Maps service API version 2021-02-01. -// -// Azure Maps -package maps - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Maps - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Maps. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/creators.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/creators.go deleted file mode 100644 index 77a7d495dd2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/creators.go +++ /dev/null @@ -1,526 +0,0 @@ -package maps - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// CreatorsClient is the azure Maps -type CreatorsClient struct { - BaseClient -} - -// NewCreatorsClient creates an instance of the CreatorsClient client. -func NewCreatorsClient(subscriptionID string) CreatorsClient { - return NewCreatorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCreatorsClientWithBaseURI creates an instance of the CreatorsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewCreatorsClientWithBaseURI(baseURI string, subscriptionID string) CreatorsClient { - return CreatorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a Maps Creator resource. Creator resource will manage Azure resources required to -// populate a custom set of mapping data. It requires an account to exist before it can be created. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - the name of the Maps Account. -// creatorName - the name of the Maps Creator instance. -// creatorResource - the new or updated parameters for the Creator resource. -func (client CreatorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, creatorName string, creatorResource Creator) (result Creator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CreatorsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: creatorResource, - Constraints: []validation.Constraint{{Target: "creatorResource.Properties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "creatorResource.Properties.StorageUnits", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "creatorResource.Properties.StorageUnits", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, - {Target: "creatorResource.Properties.StorageUnits", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("maps.CreatorsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, creatorName, creatorResource) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client CreatorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, creatorName string, creatorResource Creator) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "creatorName": autorest.Encode("path", creatorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}/creators/{creatorName}", pathParameters), - autorest.WithJSON(creatorResource), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client CreatorsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client CreatorsClient) CreateOrUpdateResponder(resp *http.Response) (result Creator, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Maps Creator resource. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - the name of the Maps Account. -// creatorName - the name of the Maps Creator instance. -func (client CreatorsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, creatorName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CreatorsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("maps.CreatorsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, creatorName) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client CreatorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, creatorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "creatorName": autorest.Encode("path", creatorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}/creators/{creatorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client CreatorsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client CreatorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a Maps Creator resource. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - the name of the Maps Account. -// creatorName - the name of the Maps Creator instance. -func (client CreatorsClient) Get(ctx context.Context, resourceGroupName string, accountName string, creatorName string) (result Creator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CreatorsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("maps.CreatorsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, creatorName) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client CreatorsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, creatorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "creatorName": autorest.Encode("path", creatorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}/creators/{creatorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client CreatorsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client CreatorsClient) GetResponder(resp *http.Response) (result Creator, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAccount get all Creator instances for an Azure Maps Account -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - the name of the Maps Account. -func (client CreatorsClient) ListByAccount(ctx context.Context, resourceGroupName string, accountName string) (result CreatorListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CreatorsClient.ListByAccount") - defer func() { - sc := -1 - if result.cl.Response.Response != nil { - sc = result.cl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("maps.CreatorsClient", "ListByAccount", err.Error()) - } - - result.fn = client.listByAccountNextResults - req, err := client.ListByAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "ListByAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAccountSender(req) - if err != nil { - result.cl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "ListByAccount", resp, "Failure sending request") - return - } - - result.cl, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "ListByAccount", resp, "Failure responding to request") - return - } - if result.cl.hasNextLink() && result.cl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAccountPreparer prepares the ListByAccount request. -func (client CreatorsClient) ListByAccountPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}/creators", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAccountSender sends the ListByAccount request. The method will close the -// http.Response Body if it receives an error. -func (client CreatorsClient) ListByAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAccountResponder handles the response to the ListByAccount request. The method always -// closes the http.Response Body. -func (client CreatorsClient) ListByAccountResponder(resp *http.Response) (result CreatorList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAccountNextResults retrieves the next set of results, if any. -func (client CreatorsClient) listByAccountNextResults(ctx context.Context, lastResults CreatorList) (result CreatorList, err error) { - req, err := lastResults.creatorListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "maps.CreatorsClient", "listByAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "maps.CreatorsClient", "listByAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "listByAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client CreatorsClient) ListByAccountComplete(ctx context.Context, resourceGroupName string, accountName string) (result CreatorListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CreatorsClient.ListByAccount") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByAccount(ctx, resourceGroupName, accountName) - return -} - -// Update updates the Maps Creator resource. Only a subset of the parameters may be updated after creation, such as -// Tags. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// accountName - the name of the Maps Account. -// creatorName - the name of the Maps Creator instance. -// creatorUpdateParameters - the update parameters for Maps Creator. -func (client CreatorsClient) Update(ctx context.Context, resourceGroupName string, accountName string, creatorName string, creatorUpdateParameters CreatorUpdateParameters) (result Creator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CreatorsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("maps.CreatorsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, creatorName, creatorUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.CreatorsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client CreatorsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, creatorName string, creatorUpdateParameters CreatorUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "creatorName": autorest.Encode("path", creatorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Maps/accounts/{accountName}/creators/{creatorName}", pathParameters), - autorest.WithJSON(creatorUpdateParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client CreatorsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client CreatorsClient) UpdateResponder(resp *http.Response) (result Creator, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/enums.go deleted file mode 100644 index d1a4911414e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/enums.go +++ /dev/null @@ -1,73 +0,0 @@ -package maps - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// KeyType enumerates the values for key type. -type KeyType string - -const ( - // KeyTypePrimary ... - KeyTypePrimary KeyType = "primary" - // KeyTypeSecondary ... - KeyTypeSecondary KeyType = "secondary" -) - -// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. -func PossibleKeyTypeValues() []KeyType { - return []KeyType{KeyTypePrimary, KeyTypeSecondary} -} - -// Kind enumerates the values for kind. -type Kind string - -const ( - // KindGen1 ... - KindGen1 Kind = "Gen1" - // KindGen2 ... - KindGen2 Kind = "Gen2" -) - -// PossibleKindValues returns an array of possible values for the Kind const type. -func PossibleKindValues() []Kind { - return []Kind{KindGen1, KindGen2} -} - -// Name enumerates the values for name. -type Name string - -const ( - // NameG2 ... - NameG2 Name = "G2" - // NameS0 ... - NameS0 Name = "S0" - // NameS1 ... - NameS1 Name = "S1" -) - -// PossibleNameValues returns an array of possible values for the Name const type. -func PossibleNameValues() []Name { - return []Name{NameG2, NameS0, NameS1} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/maps.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/maps.go deleted file mode 100644 index b21469c5c48..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/maps.go +++ /dev/null @@ -1,140 +0,0 @@ -package maps - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// Client is the azure Maps -type Client struct { - BaseClient -} - -// NewClient creates an instance of the Client client. -func NewClient(subscriptionID string) Client { - return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting -// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { - return Client{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListOperations list operations available for the Maps Resource Provider -func (client Client) ListOperations(ctx context.Context) (result OperationsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListOperations") - defer func() { - sc := -1 - if result.o.Response.Response != nil { - sc = result.o.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listOperationsNextResults - req, err := client.ListOperationsPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.Client", "ListOperations", nil, "Failure preparing request") - return - } - - resp, err := client.ListOperationsSender(req) - if err != nil { - result.o.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "maps.Client", "ListOperations", resp, "Failure sending request") - return - } - - result.o, err = client.ListOperationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.Client", "ListOperations", resp, "Failure responding to request") - return - } - if result.o.hasNextLink() && result.o.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListOperationsPreparer prepares the ListOperations request. -func (client Client) ListOperationsPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Maps/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListOperationsSender sends the ListOperations request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListOperationsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListOperationsResponder handles the response to the ListOperations request. The method always -// closes the http.Response Body. -func (client Client) ListOperationsResponder(resp *http.Response) (result Operations, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listOperationsNextResults retrieves the next set of results, if any. -func (client Client) listOperationsNextResults(ctx context.Context, lastResults Operations) (result Operations, err error) { - req, err := lastResults.operationsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "maps.Client", "listOperationsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListOperationsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "maps.Client", "listOperationsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListOperationsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "maps.Client", "listOperationsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListOperationsComplete enumerates all values, automatically crossing page boundaries as required. -func (client Client) ListOperationsComplete(ctx context.Context) (result OperationsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListOperations") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListOperations(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/models.go deleted file mode 100644 index 4d46e3d3594..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/models.go +++ /dev/null @@ -1,1101 +0,0 @@ -package maps - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps" - -// Account an Azure resource which represents access to a suite of Maps REST APIs. -type Account struct { - autorest.Response `json:"-"` - // Sku - The SKU of this account. - Sku *Sku `json:"sku,omitempty"` - // Kind - Get or Set Kind property. Possible values include: 'KindGen1', 'KindGen2' - Kind Kind `json:"kind,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // Properties - The map account properties. - Properties *AccountProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Account. -func (a Account) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.Sku != nil { - objectMap["sku"] = a.Sku - } - if a.Kind != "" { - objectMap["kind"] = a.Kind - } - if a.Properties != nil { - objectMap["properties"] = a.Properties - } - if a.Tags != nil { - objectMap["tags"] = a.Tags - } - if a.Location != nil { - objectMap["location"] = a.Location - } - return json.Marshal(objectMap) -} - -// AccountKeys the set of keys which can be used to access the Maps REST APIs. Two keys are provided for -// key rotation without interruption. -type AccountKeys struct { - autorest.Response `json:"-"` - // PrimaryKeyLastUpdated - READ-ONLY; The last updated date and time of the primary key. - PrimaryKeyLastUpdated *string `json:"primaryKeyLastUpdated,omitempty"` - // PrimaryKey - READ-ONLY; The primary key for accessing the Maps REST APIs. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - READ-ONLY; The secondary key for accessing the Maps REST APIs. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // SecondaryKeyLastUpdated - READ-ONLY; The last updated date and time of the secondary key. - SecondaryKeyLastUpdated *string `json:"secondaryKeyLastUpdated,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountKeys. -func (ak AccountKeys) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AccountProperties additional Map account properties -type AccountProperties struct { - // UniqueID - READ-ONLY; A unique identifier for the maps account - UniqueID *string `json:"uniqueId,omitempty"` - // DisableLocalAuth - Allows toggle functionality on Azure Policy to disable Azure Maps local authentication support. This will disable Shared Keys authentication from any usage. - DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` - // ProvisioningState - READ-ONLY; the state of the provisioning. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountProperties. -func (ap AccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.DisableLocalAuth != nil { - objectMap["disableLocalAuth"] = ap.DisableLocalAuth - } - return json.Marshal(objectMap) -} - -// Accounts a list of Maps Accounts. -type Accounts struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; a Maps Account. - Value *[]Account `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for Accounts. -func (a Accounts) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.NextLink != nil { - objectMap["nextLink"] = a.NextLink - } - return json.Marshal(objectMap) -} - -// AccountsIterator provides access to a complete listing of Account values. -type AccountsIterator struct { - i int - page AccountsPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AccountsIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AccountsIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AccountsIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AccountsIterator) Response() Accounts { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AccountsIterator) Value() Account { - if !iter.page.NotDone() { - return Account{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AccountsIterator type. -func NewAccountsIterator(page AccountsPage) AccountsIterator { - return AccountsIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (a Accounts) IsEmpty() bool { - return a.Value == nil || len(*a.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (a Accounts) hasNextLink() bool { - return a.NextLink != nil && len(*a.NextLink) != 0 -} - -// accountsPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (a Accounts) accountsPreparer(ctx context.Context) (*http.Request, error) { - if !a.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(a.NextLink))) -} - -// AccountsPage contains a page of Account values. -type AccountsPage struct { - fn func(context.Context, Accounts) (Accounts, error) - a Accounts -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AccountsPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.a) - if err != nil { - return err - } - page.a = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AccountsPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AccountsPage) NotDone() bool { - return !page.a.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AccountsPage) Response() Accounts { - return page.a -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AccountsPage) Values() []Account { - if page.a.IsEmpty() { - return nil - } - return *page.a.Value -} - -// Creates a new instance of the AccountsPage type. -func NewAccountsPage(cur Accounts, getNextPage func(context.Context, Accounts) (Accounts, error)) AccountsPage { - return AccountsPage{ - fn: getNextPage, - a: cur, - } -} - -// AccountUpdateParameters parameters used to update an existing Maps Account. -type AccountUpdateParameters struct { - // Tags - Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. - Tags map[string]*string `json:"tags"` - // Kind - Get or Set Kind property. Possible values include: 'KindGen1', 'KindGen2' - Kind Kind `json:"kind,omitempty"` - // Sku - The SKU of this account. - Sku *Sku `json:"sku,omitempty"` - // AccountProperties - The map account properties. - *AccountProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountUpdateParameters. -func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aup.Tags != nil { - objectMap["tags"] = aup.Tags - } - if aup.Kind != "" { - objectMap["kind"] = aup.Kind - } - if aup.Sku != nil { - objectMap["sku"] = aup.Sku - } - if aup.AccountProperties != nil { - objectMap["properties"] = aup.AccountProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccountUpdateParameters struct. -func (aup *AccountUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - aup.Tags = tags - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - aup.Kind = kind - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - aup.Sku = &sku - } - case "properties": - if v != nil { - var accountProperties AccountProperties - err = json.Unmarshal(*v, &accountProperties) - if err != nil { - return err - } - aup.AccountProperties = &accountProperties - } - } - } - - return nil -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Creator an Azure resource which represents Maps Creator product and provides ability to manage private -// location data. -type Creator struct { - autorest.Response `json:"-"` - // Properties - The Creator resource properties. - Properties *CreatorProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Creator. -func (c Creator) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.Properties != nil { - objectMap["properties"] = c.Properties - } - if c.Tags != nil { - objectMap["tags"] = c.Tags - } - if c.Location != nil { - objectMap["location"] = c.Location - } - return json.Marshal(objectMap) -} - -// CreatorList a list of Creator resources. -type CreatorList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; a Creator account. - Value *[]Creator `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for CreatorList. -func (cl CreatorList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cl.NextLink != nil { - objectMap["nextLink"] = cl.NextLink - } - return json.Marshal(objectMap) -} - -// CreatorListIterator provides access to a complete listing of Creator values. -type CreatorListIterator struct { - i int - page CreatorListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *CreatorListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CreatorListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *CreatorListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CreatorListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter CreatorListIterator) Response() CreatorList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter CreatorListIterator) Value() Creator { - if !iter.page.NotDone() { - return Creator{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CreatorListIterator type. -func NewCreatorListIterator(page CreatorListPage) CreatorListIterator { - return CreatorListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cl CreatorList) IsEmpty() bool { - return cl.Value == nil || len(*cl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cl CreatorList) hasNextLink() bool { - return cl.NextLink != nil && len(*cl.NextLink) != 0 -} - -// creatorListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cl CreatorList) creatorListPreparer(ctx context.Context) (*http.Request, error) { - if !cl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cl.NextLink))) -} - -// CreatorListPage contains a page of Creator values. -type CreatorListPage struct { - fn func(context.Context, CreatorList) (CreatorList, error) - cl CreatorList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *CreatorListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CreatorListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cl) - if err != nil { - return err - } - page.cl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *CreatorListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CreatorListPage) NotDone() bool { - return !page.cl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CreatorListPage) Response() CreatorList { - return page.cl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CreatorListPage) Values() []Creator { - if page.cl.IsEmpty() { - return nil - } - return *page.cl.Value -} - -// Creates a new instance of the CreatorListPage type. -func NewCreatorListPage(cur CreatorList, getNextPage func(context.Context, CreatorList) (CreatorList, error)) CreatorListPage { - return CreatorListPage{ - fn: getNextPage, - cl: cur, - } -} - -// CreatorProperties creator resource properties -type CreatorProperties struct { - // ProvisioningState - READ-ONLY; The state of the resource provisioning, terminal states: Succeeded, Failed, Canceled - ProvisioningState *string `json:"provisioningState,omitempty"` - // StorageUnits - The storage units to be allocated. Integer values from 1 to 100, inclusive. - StorageUnits *int32 `json:"storageUnits,omitempty"` -} - -// MarshalJSON is the custom marshaler for CreatorProperties. -func (cp CreatorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.StorageUnits != nil { - objectMap["storageUnits"] = cp.StorageUnits - } - return json.Marshal(objectMap) -} - -// CreatorUpdateParameters parameters used to update an existing Creator resource. -type CreatorUpdateParameters struct { - // Tags - Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. - Tags map[string]*string `json:"tags"` - // CreatorProperties - Creator resource properties. - *CreatorProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CreatorUpdateParameters. -func (cup CreatorUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cup.Tags != nil { - objectMap["tags"] = cup.Tags - } - if cup.CreatorProperties != nil { - objectMap["properties"] = cup.CreatorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CreatorUpdateParameters struct. -func (cup *CreatorUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cup.Tags = tags - } - case "properties": - if v != nil { - var creatorProperties CreatorProperties - err = json.Unmarshal(*v, &creatorProperties) - if err != nil { - return err - } - cup.CreatorProperties = &creatorProperties - } - } - } - - return nil -} - -// Dimension dimension of map account, for example API Category, Api Name, Result Type, and Response Code. -type Dimension struct { - // Name - Display name of dimension. - Name *string `json:"name,omitempty"` - // DisplayName - Display name of dimension. - DisplayName *string `json:"displayName,omitempty"` -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorDetail the error detail. -type ErrorDetail struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]ErrorDetail `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorDetail. -func (ed ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for -// failed operations. (This also follows the OData error response format.). -type ErrorResponse struct { - // Error - The error object. - Error *ErrorDetail `json:"error,omitempty"` -} - -// KeySpecification whether the operation refers to the primary or secondary key. -type KeySpecification struct { - // KeyType - Whether the operation refers to the primary or secondary key. Possible values include: 'KeyTypePrimary', 'KeyTypeSecondary' - KeyType KeyType `json:"keyType,omitempty"` -} - -// MetricSpecification metric specification of operation. -type MetricSpecification struct { - // Name - Name of metric specification. - Name *string `json:"name,omitempty"` - // DisplayName - Display name of metric specification. - DisplayName *string `json:"displayName,omitempty"` - // DisplayDescription - Display description of metric specification. - DisplayDescription *string `json:"displayDescription,omitempty"` - // Unit - Unit could be Count. - Unit *string `json:"unit,omitempty"` - // Dimensions - Dimensions of map account. - Dimensions *[]Dimension `json:"dimensions,omitempty"` - // AggregationType - Aggregation type could be Average. - AggregationType *string `json:"aggregationType,omitempty"` - // FillGapWithZero - The property to decide fill gap with zero or not. - FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` - // Category - The category this metric specification belong to, could be Capacity. - Category *string `json:"category,omitempty"` - // ResourceIDDimensionNameOverride - Account Resource Id. - ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` -} - -// OperationDetail operation detail payload -type OperationDetail struct { - // Name - Name of the operation - Name *string `json:"name,omitempty"` - // IsDataAction - Indicates whether the operation is a data action - IsDataAction *bool `json:"isDataAction,omitempty"` - // Display - Display of the operation - Display *OperationDisplay `json:"display,omitempty"` - // Origin - Origin of the operation - Origin *string `json:"origin,omitempty"` - // OperationProperties - Properties of the operation - *OperationProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDetail. -func (od OperationDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if od.Name != nil { - objectMap["name"] = od.Name - } - if od.IsDataAction != nil { - objectMap["isDataAction"] = od.IsDataAction - } - if od.Display != nil { - objectMap["display"] = od.Display - } - if od.Origin != nil { - objectMap["origin"] = od.Origin - } - if od.OperationProperties != nil { - objectMap["properties"] = od.OperationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationDetail struct. -func (od *OperationDetail) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - od.Name = &name - } - case "isDataAction": - if v != nil { - var isDataAction bool - err = json.Unmarshal(*v, &isDataAction) - if err != nil { - return err - } - od.IsDataAction = &isDataAction - } - case "display": - if v != nil { - var display OperationDisplay - err = json.Unmarshal(*v, &display) - if err != nil { - return err - } - od.Display = &display - } - case "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - od.Origin = &origin - } - case "properties": - if v != nil { - var operationProperties OperationProperties - err = json.Unmarshal(*v, &operationProperties) - if err != nil { - return err - } - od.OperationProperties = &operationProperties - } - } - } - - return nil -} - -// OperationDisplay operation display payload -type OperationDisplay struct { - // Provider - Resource provider of the operation - Provider *string `json:"provider,omitempty"` - // Resource - Resource of the operation - Resource *string `json:"resource,omitempty"` - // Operation - Localized friendly name for the operation - Operation *string `json:"operation,omitempty"` - // Description - Localized friendly description for the operation - Description *string `json:"description,omitempty"` -} - -// OperationProperties properties of operation, include metric specifications. -type OperationProperties struct { - // ServiceSpecification - One property of operation, include metric specifications. - ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// Operations the set of operations available for Maps. -type Operations struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; An operation available for Maps. - Value *[]OperationDetail `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for Operations. -func (o Operations) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if o.NextLink != nil { - objectMap["nextLink"] = o.NextLink - } - return json.Marshal(objectMap) -} - -// OperationsIterator provides access to a complete listing of OperationDetail values. -type OperationsIterator struct { - i int - page OperationsPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationsIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationsIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationsIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationsIterator) Response() Operations { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationsIterator) Value() OperationDetail { - if !iter.page.NotDone() { - return OperationDetail{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationsIterator type. -func NewOperationsIterator(page OperationsPage) OperationsIterator { - return OperationsIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (o Operations) IsEmpty() bool { - return o.Value == nil || len(*o.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (o Operations) hasNextLink() bool { - return o.NextLink != nil && len(*o.NextLink) != 0 -} - -// operationsPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (o Operations) operationsPreparer(ctx context.Context) (*http.Request, error) { - if !o.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(o.NextLink))) -} - -// OperationsPage contains a page of OperationDetail values. -type OperationsPage struct { - fn func(context.Context, Operations) (Operations, error) - o Operations -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationsPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.o) - if err != nil { - return err - } - page.o = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationsPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationsPage) NotDone() bool { - return !page.o.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationsPage) Response() Operations { - return page.o -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationsPage) Values() []OperationDetail { - if page.o.IsEmpty() { - return nil - } - return *page.o.Value -} - -// Creates a new instance of the OperationsPage type. -func NewOperationsPage(cur Operations, getNextPage func(context.Context, Operations) (Operations, error)) OperationsPage { - return OperationsPage{ - fn: getNextPage, - o: cur, - } -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServiceSpecification one property of operation, include metric specifications. -type ServiceSpecification struct { - // MetricSpecifications - Metric specifications of operation. - MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` -} - -// Sku the SKU of the Maps Account. -type Sku struct { - // Name - The name of the SKU, in standard format (such as S0). Possible values include: 'NameS0', 'NameS1', 'NameG2' - Name Name `json:"name,omitempty"` - // Tier - READ-ONLY; Gets the sku tier. This is based on the SKU name. - Tier *string `json:"tier,omitempty"` -} - -// MarshalJSON is the custom marshaler for Sku. -func (s Sku) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Name != "" { - objectMap["name"] = s.Name - } - return json.Marshal(objectMap) -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/version.go deleted file mode 100644 index 50d028e3f1e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package maps - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " maps/2021-02-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/_meta.json deleted file mode 100644 index d12ba48ee26..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/mariadb/resource-manager/readme.md", - "tag": "package-2018-06-01", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2018-06-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/mariadb/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/advisors.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/advisors.go deleted file mode 100644 index 16f9345aa28..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/advisors.go +++ /dev/null @@ -1,250 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AdvisorsClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and configurations with -// new business model. -type AdvisorsClient struct { - BaseClient -} - -// NewAdvisorsClient creates an instance of the AdvisorsClient client. -func NewAdvisorsClient(subscriptionID string) AdvisorsClient { - return NewAdvisorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAdvisorsClientWithBaseURI creates an instance of the AdvisorsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAdvisorsClientWithBaseURI(baseURI string, subscriptionID string) AdvisorsClient { - return AdvisorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get a recommendation action advisor. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// advisorName - the advisor name for recommendation action. -func (client AdvisorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, advisorName string) (result Advisor, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.AdvisorsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, advisorName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.AdvisorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.AdvisorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.AdvisorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AdvisorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, advisorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "advisorName": autorest.Encode("path", advisorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors/{advisorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AdvisorsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AdvisorsClient) GetResponder(resp *http.Response) (result Advisor, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer list recommendation action advisors. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client AdvisorsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result AdvisorsResultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsClient.ListByServer") - defer func() { - sc := -1 - if result.arl.Response.Response != nil { - sc = result.arl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.AdvisorsClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.AdvisorsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.arl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.AdvisorsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.arl, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.AdvisorsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.arl.hasNextLink() && result.arl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client AdvisorsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client AdvisorsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client AdvisorsClient) ListByServerResponder(resp *http.Response) (result AdvisorsResultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client AdvisorsClient) listByServerNextResults(ctx context.Context, lastResults AdvisorsResultList) (result AdvisorsResultList, err error) { - req, err := lastResults.advisorsResultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mariadb.AdvisorsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mariadb.AdvisorsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.AdvisorsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client AdvisorsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result AdvisorsResultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/checknameavailability.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/checknameavailability.go deleted file mode 100644 index ad221798616..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/checknameavailability.go +++ /dev/null @@ -1,118 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// CheckNameAvailabilityClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type CheckNameAvailabilityClient struct { - BaseClient -} - -// NewCheckNameAvailabilityClient creates an instance of the CheckNameAvailabilityClient client. -func NewCheckNameAvailabilityClient(subscriptionID string) CheckNameAvailabilityClient { - return NewCheckNameAvailabilityClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCheckNameAvailabilityClientWithBaseURI creates an instance of the CheckNameAvailabilityClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewCheckNameAvailabilityClientWithBaseURI(baseURI string, subscriptionID string) CheckNameAvailabilityClient { - return CheckNameAvailabilityClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Execute check the availability of name for resource -// Parameters: -// nameAvailabilityRequest - the required parameters for checking if resource name is available. -func (client CheckNameAvailabilityClient) Execute(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest) (result NameAvailability, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CheckNameAvailabilityClient.Execute") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: nameAvailabilityRequest, - Constraints: []validation.Constraint{{Target: "nameAvailabilityRequest.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.CheckNameAvailabilityClient", "Execute", err.Error()) - } - - req, err := client.ExecutePreparer(ctx, nameAvailabilityRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.CheckNameAvailabilityClient", "Execute", nil, "Failure preparing request") - return - } - - resp, err := client.ExecuteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.CheckNameAvailabilityClient", "Execute", resp, "Failure sending request") - return - } - - result, err = client.ExecuteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.CheckNameAvailabilityClient", "Execute", resp, "Failure responding to request") - return - } - - return -} - -// ExecutePreparer prepares the Execute request. -func (client CheckNameAvailabilityClient) ExecutePreparer(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBForMariaDB/checkNameAvailability", pathParameters), - autorest.WithJSON(nameAvailabilityRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExecuteSender sends the Execute request. The method will close the -// http.Response Body if it receives an error. -func (client CheckNameAvailabilityClient) ExecuteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExecuteResponder handles the response to the Execute request. The method always -// closes the http.Response Body. -func (client CheckNameAvailabilityClient) ExecuteResponder(resp *http.Response) (result NameAvailability, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/client.go deleted file mode 100644 index b4d263e8cfc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/client.go +++ /dev/null @@ -1,140 +0,0 @@ -// Package mariadb implements the Azure ARM Mariadb service API version 2018-06-01. -// -// The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MariaDB -// resources including servers, databases, firewall rules, VNET rules, log files and configurations with new business -// model. -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -const ( - // DefaultBaseURI is the default URI used for the service Mariadb - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Mariadb. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} - -// CreateRecommendedActionSession create recommendation action session for the advisor. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// advisorName - the advisor name for recommendation action. -// databaseName - the name of the database. -func (client BaseClient) CreateRecommendedActionSession(ctx context.Context, resourceGroupName string, serverName string, advisorName string, databaseName string) (result CreateRecommendedActionSessionFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CreateRecommendedActionSession") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.BaseClient", "CreateRecommendedActionSession", err.Error()) - } - - req, err := client.CreateRecommendedActionSessionPreparer(ctx, resourceGroupName, serverName, advisorName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.BaseClient", "CreateRecommendedActionSession", nil, "Failure preparing request") - return - } - - result, err = client.CreateRecommendedActionSessionSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.BaseClient", "CreateRecommendedActionSession", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateRecommendedActionSessionPreparer prepares the CreateRecommendedActionSession request. -func (client BaseClient) CreateRecommendedActionSessionPreparer(ctx context.Context, resourceGroupName string, serverName string, advisorName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "advisorName": autorest.Encode("path", advisorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "databaseName": autorest.Encode("query", databaseName), - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors/{advisorName}/createRecommendedActionSession", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateRecommendedActionSessionSender sends the CreateRecommendedActionSession request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) CreateRecommendedActionSessionSender(req *http.Request) (future CreateRecommendedActionSessionFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateRecommendedActionSessionResponder handles the response to the CreateRecommendedActionSession request. The method always -// closes the http.Response Body. -func (client BaseClient) CreateRecommendedActionSessionResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/configurations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/configurations.go deleted file mode 100644 index b694af5930f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/configurations.go +++ /dev/null @@ -1,302 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ConfigurationsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type ConfigurationsClient struct { - BaseClient -} - -// NewConfigurationsClient creates an instance of the ConfigurationsClient client. -func NewConfigurationsClient(subscriptionID string) ConfigurationsClient { - return NewConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConfigurationsClientWithBaseURI creates an instance of the ConfigurationsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationsClient { - return ConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates a configuration of a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// configurationName - the name of the server configuration. -// parameters - the required parameters for updating a server configuration. -func (client ConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration) (result ConfigurationsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.ConfigurationsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, configurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/configurations/{configurationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future ConfigurationsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets information about a configuration of server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// configurationName - the name of the server configuration. -func (client ConfigurationsClient) Get(ctx context.Context, resourceGroupName string, serverName string, configurationName string) (result Configuration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.ConfigurationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.ConfigurationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ConfigurationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/configurations/{configurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) GetResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer list all the configurations in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ConfigurationsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ConfigurationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.ConfigurationsClient", "ListByServer", err.Error()) - } - - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ConfigurationsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.ConfigurationsClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ConfigurationsClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ConfigurationsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/configurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) ListByServerResponder(resp *http.Response) (result ConfigurationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/databases.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/databases.go deleted file mode 100644 index a913836a847..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/databases.go +++ /dev/null @@ -1,392 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DatabasesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and configurations -// with new business model. -type DatabasesClient struct { - BaseClient -} - -// NewDatabasesClient creates an instance of the DatabasesClient client. -func NewDatabasesClient(subscriptionID string) DatabasesClient { - return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { - return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new database or updates an existing database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the required parameters for creating or updating a database. -func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (result DatabasesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.DatabasesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.DatabasesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/databases/{databaseName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) CreateOrUpdateSender(req *http.Request) (future DatabasesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabasesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.DatabasesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.DatabasesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.DatabasesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) DeleteSender(req *http.Request) (future DatabasesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about a database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result Database, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.DatabasesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.DatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.DatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.DatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DatabasesClient) GetResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer list all the databases in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client DatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.DatabasesClient", "ListByServer", err.Error()) - } - - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.DatabasesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.DatabasesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.DatabasesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client DatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListByServerResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/enums.go deleted file mode 100644 index e7858d2d7c9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/enums.go +++ /dev/null @@ -1,245 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CreateMode enumerates the values for create mode. -type CreateMode string - -const ( - // CreateModeDefault ... - CreateModeDefault CreateMode = "Default" - // CreateModeGeoRestore ... - CreateModeGeoRestore CreateMode = "GeoRestore" - // CreateModePointInTimeRestore ... - CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" - // CreateModeReplica ... - CreateModeReplica CreateMode = "Replica" - // CreateModeServerPropertiesForCreate ... - CreateModeServerPropertiesForCreate CreateMode = "ServerPropertiesForCreate" -) - -// PossibleCreateModeValues returns an array of possible values for the CreateMode const type. -func PossibleCreateModeValues() []CreateMode { - return []CreateMode{CreateModeDefault, CreateModeGeoRestore, CreateModePointInTimeRestore, CreateModeReplica, CreateModeServerPropertiesForCreate} -} - -// GeoRedundantBackup enumerates the values for geo redundant backup. -type GeoRedundantBackup string - -const ( - // Disabled ... - Disabled GeoRedundantBackup = "Disabled" - // Enabled ... - Enabled GeoRedundantBackup = "Enabled" -) - -// PossibleGeoRedundantBackupValues returns an array of possible values for the GeoRedundantBackup const type. -func PossibleGeoRedundantBackupValues() []GeoRedundantBackup { - return []GeoRedundantBackup{Disabled, Enabled} -} - -// OperationOrigin enumerates the values for operation origin. -type OperationOrigin string - -const ( - // NotSpecified ... - NotSpecified OperationOrigin = "NotSpecified" - // System ... - System OperationOrigin = "system" - // User ... - User OperationOrigin = "user" -) - -// PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. -func PossibleOperationOriginValues() []OperationOrigin { - return []OperationOrigin{NotSpecified, System, User} -} - -// PrivateEndpointProvisioningState enumerates the values for private endpoint provisioning state. -type PrivateEndpointProvisioningState string - -const ( - // Approving ... - Approving PrivateEndpointProvisioningState = "Approving" - // Dropping ... - Dropping PrivateEndpointProvisioningState = "Dropping" - // Failed ... - Failed PrivateEndpointProvisioningState = "Failed" - // Ready ... - Ready PrivateEndpointProvisioningState = "Ready" - // Rejecting ... - Rejecting PrivateEndpointProvisioningState = "Rejecting" -) - -// PossiblePrivateEndpointProvisioningStateValues returns an array of possible values for the PrivateEndpointProvisioningState const type. -func PossiblePrivateEndpointProvisioningStateValues() []PrivateEndpointProvisioningState { - return []PrivateEndpointProvisioningState{Approving, Dropping, Failed, Ready, Rejecting} -} - -// PrivateLinkServiceConnectionStateActionsRequire enumerates the values for private link service connection -// state actions require. -type PrivateLinkServiceConnectionStateActionsRequire string - -const ( - // None ... - None PrivateLinkServiceConnectionStateActionsRequire = "None" -) - -// PossiblePrivateLinkServiceConnectionStateActionsRequireValues returns an array of possible values for the PrivateLinkServiceConnectionStateActionsRequire const type. -func PossiblePrivateLinkServiceConnectionStateActionsRequireValues() []PrivateLinkServiceConnectionStateActionsRequire { - return []PrivateLinkServiceConnectionStateActionsRequire{None} -} - -// PrivateLinkServiceConnectionStateStatus enumerates the values for private link service connection state -// status. -type PrivateLinkServiceConnectionStateStatus string - -const ( - // Approved ... - Approved PrivateLinkServiceConnectionStateStatus = "Approved" - // Disconnected ... - Disconnected PrivateLinkServiceConnectionStateStatus = "Disconnected" - // Pending ... - Pending PrivateLinkServiceConnectionStateStatus = "Pending" - // Rejected ... - Rejected PrivateLinkServiceConnectionStateStatus = "Rejected" -) - -// PossiblePrivateLinkServiceConnectionStateStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStateStatus const type. -func PossiblePrivateLinkServiceConnectionStateStatusValues() []PrivateLinkServiceConnectionStateStatus { - return []PrivateLinkServiceConnectionStateStatus{Approved, Disconnected, Pending, Rejected} -} - -// PublicNetworkAccessEnum enumerates the values for public network access enum. -type PublicNetworkAccessEnum string - -const ( - // PublicNetworkAccessEnumDisabled ... - PublicNetworkAccessEnumDisabled PublicNetworkAccessEnum = "Disabled" - // PublicNetworkAccessEnumEnabled ... - PublicNetworkAccessEnumEnabled PublicNetworkAccessEnum = "Enabled" -) - -// PossiblePublicNetworkAccessEnumValues returns an array of possible values for the PublicNetworkAccessEnum const type. -func PossiblePublicNetworkAccessEnumValues() []PublicNetworkAccessEnum { - return []PublicNetworkAccessEnum{PublicNetworkAccessEnumDisabled, PublicNetworkAccessEnumEnabled} -} - -// ServerSecurityAlertPolicyState enumerates the values for server security alert policy state. -type ServerSecurityAlertPolicyState string - -const ( - // ServerSecurityAlertPolicyStateDisabled ... - ServerSecurityAlertPolicyStateDisabled ServerSecurityAlertPolicyState = "Disabled" - // ServerSecurityAlertPolicyStateEnabled ... - ServerSecurityAlertPolicyStateEnabled ServerSecurityAlertPolicyState = "Enabled" -) - -// PossibleServerSecurityAlertPolicyStateValues returns an array of possible values for the ServerSecurityAlertPolicyState const type. -func PossibleServerSecurityAlertPolicyStateValues() []ServerSecurityAlertPolicyState { - return []ServerSecurityAlertPolicyState{ServerSecurityAlertPolicyStateDisabled, ServerSecurityAlertPolicyStateEnabled} -} - -// ServerState enumerates the values for server state. -type ServerState string - -const ( - // ServerStateDisabled ... - ServerStateDisabled ServerState = "Disabled" - // ServerStateDropping ... - ServerStateDropping ServerState = "Dropping" - // ServerStateReady ... - ServerStateReady ServerState = "Ready" -) - -// PossibleServerStateValues returns an array of possible values for the ServerState const type. -func PossibleServerStateValues() []ServerState { - return []ServerState{ServerStateDisabled, ServerStateDropping, ServerStateReady} -} - -// ServerVersion enumerates the values for server version. -type ServerVersion string - -const ( - // FiveFullStopSeven ... - FiveFullStopSeven ServerVersion = "5.7" - // FiveFullStopSix ... - FiveFullStopSix ServerVersion = "5.6" -) - -// PossibleServerVersionValues returns an array of possible values for the ServerVersion const type. -func PossibleServerVersionValues() []ServerVersion { - return []ServerVersion{FiveFullStopSeven, FiveFullStopSix} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // Basic ... - Basic SkuTier = "Basic" - // GeneralPurpose ... - GeneralPurpose SkuTier = "GeneralPurpose" - // MemoryOptimized ... - MemoryOptimized SkuTier = "MemoryOptimized" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{Basic, GeneralPurpose, MemoryOptimized} -} - -// SslEnforcementEnum enumerates the values for ssl enforcement enum. -type SslEnforcementEnum string - -const ( - // SslEnforcementEnumDisabled ... - SslEnforcementEnumDisabled SslEnforcementEnum = "Disabled" - // SslEnforcementEnumEnabled ... - SslEnforcementEnumEnabled SslEnforcementEnum = "Enabled" -) - -// PossibleSslEnforcementEnumValues returns an array of possible values for the SslEnforcementEnum const type. -func PossibleSslEnforcementEnumValues() []SslEnforcementEnum { - return []SslEnforcementEnum{SslEnforcementEnumDisabled, SslEnforcementEnumEnabled} -} - -// StorageAutogrow enumerates the values for storage autogrow. -type StorageAutogrow string - -const ( - // StorageAutogrowDisabled ... - StorageAutogrowDisabled StorageAutogrow = "Disabled" - // StorageAutogrowEnabled ... - StorageAutogrowEnabled StorageAutogrow = "Enabled" -) - -// PossibleStorageAutogrowValues returns an array of possible values for the StorageAutogrow const type. -func PossibleStorageAutogrowValues() []StorageAutogrow { - return []StorageAutogrow{StorageAutogrowDisabled, StorageAutogrowEnabled} -} - -// VirtualNetworkRuleState enumerates the values for virtual network rule state. -type VirtualNetworkRuleState string - -const ( - // VirtualNetworkRuleStateDeleting ... - VirtualNetworkRuleStateDeleting VirtualNetworkRuleState = "Deleting" - // VirtualNetworkRuleStateInitializing ... - VirtualNetworkRuleStateInitializing VirtualNetworkRuleState = "Initializing" - // VirtualNetworkRuleStateInProgress ... - VirtualNetworkRuleStateInProgress VirtualNetworkRuleState = "InProgress" - // VirtualNetworkRuleStateReady ... - VirtualNetworkRuleStateReady VirtualNetworkRuleState = "Ready" - // VirtualNetworkRuleStateUnknown ... - VirtualNetworkRuleStateUnknown VirtualNetworkRuleState = "Unknown" -) - -// PossibleVirtualNetworkRuleStateValues returns an array of possible values for the VirtualNetworkRuleState const type. -func PossibleVirtualNetworkRuleStateValues() []VirtualNetworkRuleState { - return []VirtualNetworkRuleState{VirtualNetworkRuleStateDeleting, VirtualNetworkRuleStateInitializing, VirtualNetworkRuleStateInProgress, VirtualNetworkRuleStateReady, VirtualNetworkRuleStateUnknown} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/firewallrules.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/firewallrules.go deleted file mode 100644 index b8fe7610802..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/firewallrules.go +++ /dev/null @@ -1,399 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// FirewallRulesClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type FirewallRulesClient struct { - BaseClient -} - -// NewFirewallRulesClient creates an instance of the FirewallRulesClient client. -func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { - return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFirewallRulesClientWithBaseURI creates an instance of the FirewallRulesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { - return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new firewall rule or updates an existing firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// firewallRuleName - the name of the server firewall rule. -// parameters - the required parameters for creating or updating a firewall rule. -func (client FirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (result FirewallRulesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Pattern, Rule: `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`, Chain: nil}}}, - {Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Pattern, Rule: `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("mariadb.FirewallRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, firewallRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) CreateOrUpdateSender(req *http.Request) (future FirewallRulesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a server firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// firewallRuleName - the name of the server firewall rule. -func (client FirewallRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRulesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.FirewallRulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FirewallRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) DeleteSender(req *http.Request) (future FirewallRulesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about a server firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// firewallRuleName - the name of the server firewall rule. -func (client FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.FirewallRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client FirewallRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer list all the firewall rules in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client FirewallRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result FirewallRuleListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.FirewallRulesClient", "ListByServer", err.Error()) - } - - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client FirewallRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/firewallRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) ListByServerResponder(resp *http.Response) (result FirewallRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/locationbasedperformancetier.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/locationbasedperformancetier.go deleted file mode 100644 index 34482155401..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/locationbasedperformancetier.go +++ /dev/null @@ -1,115 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LocationBasedPerformanceTierClient is the the Microsoft Azure management API provides create, read, update, and -// delete functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files -// and configurations with new business model. -type LocationBasedPerformanceTierClient struct { - BaseClient -} - -// NewLocationBasedPerformanceTierClient creates an instance of the LocationBasedPerformanceTierClient client. -func NewLocationBasedPerformanceTierClient(subscriptionID string) LocationBasedPerformanceTierClient { - return NewLocationBasedPerformanceTierClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLocationBasedPerformanceTierClientWithBaseURI creates an instance of the LocationBasedPerformanceTierClient -// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI -// (sovereign clouds, Azure stack). -func NewLocationBasedPerformanceTierClientWithBaseURI(baseURI string, subscriptionID string) LocationBasedPerformanceTierClient { - return LocationBasedPerformanceTierClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list all the performance tiers at specified location in a given subscription. -// Parameters: -// locationName - the name of the location. -func (client LocationBasedPerformanceTierClient) List(ctx context.Context, locationName string) (result PerformanceTierListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationBasedPerformanceTierClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.LocationBasedPerformanceTierClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.LocationBasedPerformanceTierClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.LocationBasedPerformanceTierClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.LocationBasedPerformanceTierClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client LocationBasedPerformanceTierClient) ListPreparer(ctx context.Context, locationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBForMariaDB/locations/{locationName}/performanceTiers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client LocationBasedPerformanceTierClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client LocationBasedPerformanceTierClient) ListResponder(resp *http.Response) (result PerformanceTierListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/locationbasedrecommendedactionsessionsoperationstatus.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/locationbasedrecommendedactionsessionsoperationstatus.go deleted file mode 100644 index b1ad76e2719..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/locationbasedrecommendedactionsessionsoperationstatus.go +++ /dev/null @@ -1,118 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LocationBasedRecommendedActionSessionsOperationStatusClient is the the Microsoft Azure management API provides -// create, read, update, and delete functionality for Azure MariaDB resources including servers, databases, firewall -// rules, VNET rules, log files and configurations with new business model. -type LocationBasedRecommendedActionSessionsOperationStatusClient struct { - BaseClient -} - -// NewLocationBasedRecommendedActionSessionsOperationStatusClient creates an instance of the -// LocationBasedRecommendedActionSessionsOperationStatusClient client. -func NewLocationBasedRecommendedActionSessionsOperationStatusClient(subscriptionID string) LocationBasedRecommendedActionSessionsOperationStatusClient { - return NewLocationBasedRecommendedActionSessionsOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLocationBasedRecommendedActionSessionsOperationStatusClientWithBaseURI creates an instance of the -// LocationBasedRecommendedActionSessionsOperationStatusClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewLocationBasedRecommendedActionSessionsOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) LocationBasedRecommendedActionSessionsOperationStatusClient { - return LocationBasedRecommendedActionSessionsOperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get recommendation action session operation status. -// Parameters: -// locationName - the name of the location. -// operationID - the operation identifier. -func (client LocationBasedRecommendedActionSessionsOperationStatusClient) Get(ctx context.Context, locationName string, operationID string) (result RecommendedActionSessionsOperationStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationBasedRecommendedActionSessionsOperationStatusClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.LocationBasedRecommendedActionSessionsOperationStatusClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, locationName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.LocationBasedRecommendedActionSessionsOperationStatusClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.LocationBasedRecommendedActionSessionsOperationStatusClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.LocationBasedRecommendedActionSessionsOperationStatusClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client LocationBasedRecommendedActionSessionsOperationStatusClient) GetPreparer(ctx context.Context, locationName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "operationId": autorest.Encode("path", operationID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/locations/{locationName}/recommendedActionSessionsAzureAsyncOperation/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client LocationBasedRecommendedActionSessionsOperationStatusClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client LocationBasedRecommendedActionSessionsOperationStatusClient) GetResponder(resp *http.Response) (result RecommendedActionSessionsOperationStatus, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/locationbasedrecommendedactionsessionsresult.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/locationbasedrecommendedactionsessionsresult.go deleted file mode 100644 index ed1f515670c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/locationbasedrecommendedactionsessionsresult.go +++ /dev/null @@ -1,160 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LocationBasedRecommendedActionSessionsResultClient is the the Microsoft Azure management API provides create, read, -// update, and delete functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET -// rules, log files and configurations with new business model. -type LocationBasedRecommendedActionSessionsResultClient struct { - BaseClient -} - -// NewLocationBasedRecommendedActionSessionsResultClient creates an instance of the -// LocationBasedRecommendedActionSessionsResultClient client. -func NewLocationBasedRecommendedActionSessionsResultClient(subscriptionID string) LocationBasedRecommendedActionSessionsResultClient { - return NewLocationBasedRecommendedActionSessionsResultClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLocationBasedRecommendedActionSessionsResultClientWithBaseURI creates an instance of the -// LocationBasedRecommendedActionSessionsResultClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewLocationBasedRecommendedActionSessionsResultClientWithBaseURI(baseURI string, subscriptionID string) LocationBasedRecommendedActionSessionsResultClient { - return LocationBasedRecommendedActionSessionsResultClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List recommendation action session operation result. -// Parameters: -// locationName - the name of the location. -// operationID - the operation identifier. -func (client LocationBasedRecommendedActionSessionsResultClient) List(ctx context.Context, locationName string, operationID string) (result RecommendationActionsResultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationBasedRecommendedActionSessionsResultClient.List") - defer func() { - sc := -1 - if result.rarl.Response.Response != nil { - sc = result.rarl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.LocationBasedRecommendedActionSessionsResultClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, locationName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.LocationBasedRecommendedActionSessionsResultClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rarl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.LocationBasedRecommendedActionSessionsResultClient", "List", resp, "Failure sending request") - return - } - - result.rarl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.LocationBasedRecommendedActionSessionsResultClient", "List", resp, "Failure responding to request") - return - } - if result.rarl.hasNextLink() && result.rarl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client LocationBasedRecommendedActionSessionsResultClient) ListPreparer(ctx context.Context, locationName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "operationId": autorest.Encode("path", operationID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/locations/{locationName}/recommendedActionSessionsOperationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client LocationBasedRecommendedActionSessionsResultClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client LocationBasedRecommendedActionSessionsResultClient) ListResponder(resp *http.Response) (result RecommendationActionsResultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client LocationBasedRecommendedActionSessionsResultClient) listNextResults(ctx context.Context, lastResults RecommendationActionsResultList) (result RecommendationActionsResultList, err error) { - req, err := lastResults.recommendationActionsResultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mariadb.LocationBasedRecommendedActionSessionsResultClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mariadb.LocationBasedRecommendedActionSessionsResultClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.LocationBasedRecommendedActionSessionsResultClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client LocationBasedRecommendedActionSessionsResultClient) ListComplete(ctx context.Context, locationName string, operationID string) (result RecommendationActionsResultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationBasedRecommendedActionSessionsResultClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, locationName, operationID) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/logfiles.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/logfiles.go deleted file mode 100644 index d4bace6ef78..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/logfiles.go +++ /dev/null @@ -1,120 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LogFilesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and configurations with -// new business model. -type LogFilesClient struct { - BaseClient -} - -// NewLogFilesClient creates an instance of the LogFilesClient client. -func NewLogFilesClient(subscriptionID string) LogFilesClient { - return NewLogFilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLogFilesClientWithBaseURI creates an instance of the LogFilesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewLogFilesClientWithBaseURI(baseURI string, subscriptionID string) LogFilesClient { - return LogFilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByServer list all the log files in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client LogFilesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result LogFileListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogFilesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.LogFilesClient", "ListByServer", err.Error()) - } - - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.LogFilesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.LogFilesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.LogFilesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client LogFilesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/logFiles", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client LogFilesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client LogFilesClient) ListByServerResponder(resp *http.Response) (result LogFileListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/models.go deleted file mode 100644 index 6f7ac5dd7f2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/models.go +++ /dev/null @@ -1,4337 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb" - -// Advisor represents a recommendation action advisor. -type Advisor struct { - autorest.Response `json:"-"` - // Properties - The properties of a recommendation action advisor. - Properties interface{} `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Advisor. -func (a Advisor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.Properties != nil { - objectMap["properties"] = a.Properties - } - return json.Marshal(objectMap) -} - -// AdvisorsResultList a list of query statistics. -type AdvisorsResultList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of recommendation action advisors. - Value *[]Advisor `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for AdvisorsResultList. -func (arl AdvisorsResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AdvisorsResultListIterator provides access to a complete listing of Advisor values. -type AdvisorsResultListIterator struct { - i int - page AdvisorsResultListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AdvisorsResultListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsResultListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AdvisorsResultListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AdvisorsResultListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AdvisorsResultListIterator) Response() AdvisorsResultList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AdvisorsResultListIterator) Value() Advisor { - if !iter.page.NotDone() { - return Advisor{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AdvisorsResultListIterator type. -func NewAdvisorsResultListIterator(page AdvisorsResultListPage) AdvisorsResultListIterator { - return AdvisorsResultListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (arl AdvisorsResultList) IsEmpty() bool { - return arl.Value == nil || len(*arl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (arl AdvisorsResultList) hasNextLink() bool { - return arl.NextLink != nil && len(*arl.NextLink) != 0 -} - -// advisorsResultListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (arl AdvisorsResultList) advisorsResultListPreparer(ctx context.Context) (*http.Request, error) { - if !arl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(arl.NextLink))) -} - -// AdvisorsResultListPage contains a page of Advisor values. -type AdvisorsResultListPage struct { - fn func(context.Context, AdvisorsResultList) (AdvisorsResultList, error) - arl AdvisorsResultList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AdvisorsResultListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AdvisorsResultListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.arl) - if err != nil { - return err - } - page.arl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AdvisorsResultListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AdvisorsResultListPage) NotDone() bool { - return !page.arl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AdvisorsResultListPage) Response() AdvisorsResultList { - return page.arl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AdvisorsResultListPage) Values() []Advisor { - if page.arl.IsEmpty() { - return nil - } - return *page.arl.Value -} - -// Creates a new instance of the AdvisorsResultListPage type. -func NewAdvisorsResultListPage(cur AdvisorsResultList, getNextPage func(context.Context, AdvisorsResultList) (AdvisorsResultList, error)) AdvisorsResultListPage { - return AdvisorsResultListPage{ - fn: getNextPage, - arl: cur, - } -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CloudError an error response from the Batch service. -type CloudError struct { - Error *ErrorResponse `json:"error,omitempty"` -} - -// Configuration represents a Configuration. -type Configuration struct { - autorest.Response `json:"-"` - // ConfigurationProperties - The properties of a configuration. - *ConfigurationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Configuration. -func (c Configuration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.ConfigurationProperties != nil { - objectMap["properties"] = c.ConfigurationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Configuration struct. -func (c *Configuration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var configurationProperties ConfigurationProperties - err = json.Unmarshal(*v, &configurationProperties) - if err != nil { - return err - } - c.ConfigurationProperties = &configurationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - c.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - c.Type = &typeVar - } - } - } - - return nil -} - -// ConfigurationListResult a list of server configurations. -type ConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - The list of server configurations. - Value *[]Configuration `json:"value,omitempty"` -} - -// ConfigurationProperties the properties of a configuration. -type ConfigurationProperties struct { - // Value - Value of the configuration. - Value *string `json:"value,omitempty"` - // Description - READ-ONLY; Description of the configuration. - Description *string `json:"description,omitempty"` - // DefaultValue - READ-ONLY; Default value of the configuration. - DefaultValue *string `json:"defaultValue,omitempty"` - // DataType - READ-ONLY; Data type of the configuration. - DataType *string `json:"dataType,omitempty"` - // AllowedValues - READ-ONLY; Allowed values of the configuration. - AllowedValues *string `json:"allowedValues,omitempty"` - // Source - Source of the configuration. - Source *string `json:"source,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigurationProperties. -func (cp ConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Value != nil { - objectMap["value"] = cp.Value - } - if cp.Source != nil { - objectMap["source"] = cp.Source - } - return json.Marshal(objectMap) -} - -// ConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConfigurationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConfigurationsClient) (Configuration, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConfigurationsCreateOrUpdateFuture.Result. -func (future *ConfigurationsCreateOrUpdateFuture) result(client ConfigurationsClient) (c Configuration, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - c.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.ConfigurationsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { - c, err = client.CreateOrUpdateResponder(c.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ConfigurationsCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") - } - } - return -} - -// CreateRecommendedActionSessionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type CreateRecommendedActionSessionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BaseClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CreateRecommendedActionSessionFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CreateRecommendedActionSessionFuture.Result. -func (future *CreateRecommendedActionSessionFuture) result(client BaseClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.CreateRecommendedActionSessionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.CreateRecommendedActionSessionFuture") - return - } - ar.Response = future.Response() - return -} - -// Database represents a Database. -type Database struct { - autorest.Response `json:"-"` - // DatabaseProperties - The properties of a database. - *DatabaseProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Database. -func (d Database) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.DatabaseProperties != nil { - objectMap["properties"] = d.DatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Database struct. -func (d *Database) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - d.DatabaseProperties = &databaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseListResult a List of databases. -type DatabaseListResult struct { - autorest.Response `json:"-"` - // Value - The list of databases housed in a server - Value *[]Database `json:"value,omitempty"` -} - -// DatabaseProperties the properties of a database. -type DatabaseProperties struct { - // Charset - The charset of the database. - Charset *string `json:"charset,omitempty"` - // Collation - The collation of the database. - Collation *string `json:"collation,omitempty"` -} - -// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesCreateOrUpdateFuture.Result. -func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.DatabasesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesDeleteFuture.Result. -func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.DatabasesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for -// failed operations. (This also follows the OData error response format.) -type ErrorResponse struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]ErrorResponse `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponse. -func (er ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FirewallRule represents a server firewall rule. -type FirewallRule struct { - autorest.Response `json:"-"` - // FirewallRuleProperties - The properties of a firewall rule. - *FirewallRuleProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FirewallRule. -func (fr FirewallRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fr.FirewallRuleProperties != nil { - objectMap["properties"] = fr.FirewallRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FirewallRule struct. -func (fr *FirewallRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var firewallRuleProperties FirewallRuleProperties - err = json.Unmarshal(*v, &firewallRuleProperties) - if err != nil { - return err - } - fr.FirewallRuleProperties = &firewallRuleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fr.Type = &typeVar - } - } - } - - return nil -} - -// FirewallRuleListResult a list of firewall rules. -type FirewallRuleListResult struct { - autorest.Response `json:"-"` - // Value - The list of firewall rules in a server. - Value *[]FirewallRule `json:"value,omitempty"` -} - -// FirewallRuleProperties the properties of a server firewall rule. -type FirewallRuleProperties struct { - // StartIPAddress - The start IP address of the server firewall rule. Must be IPv4 format. - StartIPAddress *string `json:"startIpAddress,omitempty"` - // EndIPAddress - The end IP address of the server firewall rule. Must be IPv4 format. - EndIPAddress *string `json:"endIpAddress,omitempty"` -} - -// FirewallRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type FirewallRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FirewallRulesClient) (FirewallRule, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FirewallRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FirewallRulesCreateOrUpdateFuture.Result. -func (future *FirewallRulesCreateOrUpdateFuture) result(client FirewallRulesClient) (fr FirewallRule, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.FirewallRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent { - fr, err = client.CreateOrUpdateResponder(fr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request") - } - } - return -} - -// FirewallRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FirewallRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FirewallRulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FirewallRulesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FirewallRulesDeleteFuture.Result. -func (future *FirewallRulesDeleteFuture) result(client FirewallRulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.FirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.FirewallRulesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// LogFile represents a log file. -type LogFile struct { - // LogFileProperties - The properties of the log file. - *LogFileProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogFile. -func (lf LogFile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lf.LogFileProperties != nil { - objectMap["properties"] = lf.LogFileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogFile struct. -func (lf *LogFile) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var logFileProperties LogFileProperties - err = json.Unmarshal(*v, &logFileProperties) - if err != nil { - return err - } - lf.LogFileProperties = &logFileProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lf.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lf.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lf.Type = &typeVar - } - } - } - - return nil -} - -// LogFileListResult a list of log files. -type LogFileListResult struct { - autorest.Response `json:"-"` - // Value - The list of log files. - Value *[]LogFile `json:"value,omitempty"` -} - -// LogFileProperties the properties of a log file. -type LogFileProperties struct { - // SizeInKB - Size of the log file. - SizeInKB *int64 `json:"sizeInKB,omitempty"` - // CreatedTime - READ-ONLY; Creation timestamp of the log file. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // LastModifiedTime - READ-ONLY; Last modified timestamp of the log file. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Type - Type of the log file. - Type *string `json:"type,omitempty"` - // URL - READ-ONLY; The url to download the log file from. - URL *string `json:"url,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogFileProperties. -func (lfp LogFileProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lfp.SizeInKB != nil { - objectMap["sizeInKB"] = lfp.SizeInKB - } - if lfp.Type != nil { - objectMap["type"] = lfp.Type - } - return json.Marshal(objectMap) -} - -// NameAvailability represents a resource name availability. -type NameAvailability struct { - autorest.Response `json:"-"` - // Message - Error Message. - Message *string `json:"message,omitempty"` - // NameAvailable - Indicates whether the resource name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - Reason for name being unavailable. - Reason *string `json:"reason,omitempty"` -} - -// NameAvailabilityRequest request from client to check resource name availability. -type NameAvailabilityRequest struct { - // Name - Resource name to verify. - Name *string `json:"name,omitempty"` - // Type - Resource type used for verification. - Type *string `json:"type,omitempty"` -} - -// Operation REST API operation definition. -type Operation struct { - // Name - READ-ONLY; The name of the operation being performed on this particular object. - Name *string `json:"name,omitempty"` - // Display - READ-ONLY; The localized display information for this particular operation or action. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'NotSpecified', 'User', 'System' - Origin OperationOrigin `json:"origin,omitempty"` - // Properties - READ-ONLY; Additional descriptions for the operation. - Properties map[string]interface{} `json:"properties"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - READ-ONLY; Operation resource provider name. - Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; Localized friendly name for the operation. - Operation *string `json:"operation,omitempty"` - // Description - READ-ONLY; Operation description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDisplay. -func (od OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResult a list of resource provider operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - The list of resource provider operations. - Value *[]Operation `json:"value,omitempty"` -} - -// PerformanceTierListResult a list of performance tiers. -type PerformanceTierListResult struct { - autorest.Response `json:"-"` - // Value - The list of performance tiers - Value *[]PerformanceTierProperties `json:"value,omitempty"` -} - -// PerformanceTierProperties performance tier properties -type PerformanceTierProperties struct { - // ID - ID of the performance tier. - ID *string `json:"id,omitempty"` - // ServiceLevelObjectives - Service level objectives associated with the performance tier - ServiceLevelObjectives *[]PerformanceTierServiceLevelObjectives `json:"serviceLevelObjectives,omitempty"` -} - -// PerformanceTierServiceLevelObjectives service level objectives for performance tier. -type PerformanceTierServiceLevelObjectives struct { - // ID - ID for the service level objective. - ID *string `json:"id,omitempty"` - // Edition - Edition of the performance tier. - Edition *string `json:"edition,omitempty"` - // VCore - vCore associated with the service level objective - VCore *int32 `json:"vCore,omitempty"` - // HardwareGeneration - Hardware generation associated with the service level objective - HardwareGeneration *string `json:"hardwareGeneration,omitempty"` - // MaxBackupRetentionDays - Maximum Backup retention in days for the performance tier edition - MaxBackupRetentionDays *int32 `json:"maxBackupRetentionDays,omitempty"` - // MinBackupRetentionDays - Minimum Backup retention in days for the performance tier edition - MinBackupRetentionDays *int32 `json:"minBackupRetentionDays,omitempty"` - // MaxStorageMB - Max storage allowed for a server. - MaxStorageMB *int32 `json:"maxStorageMB,omitempty"` - // MinStorageMB - Max storage allowed for a server. - MinStorageMB *int32 `json:"minStorageMB,omitempty"` -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections. -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. -func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionListResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultIterator struct { - i int - page PrivateEndpointConnectionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. -func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { - return PrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { - return peclr.Value == nil || len(*peclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { - return peclr.NextLink != nil && len(*peclr.NextLink) != 0 -} - -// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !peclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclr.NextLink))) -} - -// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultPage struct { - fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) - peclr PrivateEndpointConnectionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.peclr) - if err != nil { - return err - } - page.peclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.peclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { - return page.peclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { - if page.peclr.IsEmpty() { - return nil - } - return *page.peclr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultPage type. -func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { - return PrivateEndpointConnectionListResultPage{ - fn: getNextPage, - peclr: cur, - } -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; State of the private endpoint connection. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. -func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecp.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = pecp.PrivateEndpoint - } - if pecp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.PrivateEndpointConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointConnectionsUpdateTagsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsUpdateTagsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsUpdateTagsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsUpdateTagsFuture.Result. -func (future *PrivateEndpointConnectionsUpdateTagsFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsUpdateTagsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.PrivateEndpointConnectionsUpdateTagsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.UpdateTagsResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsUpdateTagsFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointProperty ... -type PrivateEndpointProperty struct { - // ID - Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // Properties - READ-ONLY; The private link resource group id. - Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult. -func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourceListResultIterator struct { - i int - page PrivateLinkResourceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListResultIterator type. -func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { - return PrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListResultPage struct { - fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) - plrlr PrivateLinkResourceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.plrlr) - if err != nil { - return err - } - page.plrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourceListResultPage type. -func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { - return PrivateLinkResourceListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionStateProperty ... -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; The actions required for private link service connection. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != nil { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// QueryStatistic represents a Query Statistic. -type QueryStatistic struct { - autorest.Response `json:"-"` - // QueryStatisticProperties - The properties of a query statistic. - *QueryStatisticProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryStatistic. -func (qs QueryStatistic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if qs.QueryStatisticProperties != nil { - objectMap["properties"] = qs.QueryStatisticProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for QueryStatistic struct. -func (qs *QueryStatistic) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var queryStatisticProperties QueryStatisticProperties - err = json.Unmarshal(*v, &queryStatisticProperties) - if err != nil { - return err - } - qs.QueryStatisticProperties = &queryStatisticProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - qs.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - qs.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - qs.Type = &typeVar - } - } - } - - return nil -} - -// QueryStatisticProperties the properties of a query statistic. -type QueryStatisticProperties struct { - // QueryID - Database query identifier. - QueryID *string `json:"queryId,omitempty"` - // StartTime - Observation start time. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - Observation end time. - EndTime *date.Time `json:"endTime,omitempty"` - // AggregationFunction - Aggregation function name. - AggregationFunction *string `json:"aggregationFunction,omitempty"` - // DatabaseNames - The list of database names. - DatabaseNames *[]string `json:"databaseNames,omitempty"` - // QueryExecutionCount - Number of query executions in this time interval. - QueryExecutionCount *int64 `json:"queryExecutionCount,omitempty"` - // MetricName - Metric name. - MetricName *string `json:"metricName,omitempty"` - // MetricDisplayName - Metric display name. - MetricDisplayName *string `json:"metricDisplayName,omitempty"` - // MetricValue - Metric value. - MetricValue *float64 `json:"metricValue,omitempty"` - // MetricValueUnit - Metric value unit. - MetricValueUnit *string `json:"metricValueUnit,omitempty"` -} - -// QueryText represents a Query Text. -type QueryText struct { - autorest.Response `json:"-"` - // QueryTextProperties - The properties of a query text. - *QueryTextProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryText. -func (qt QueryText) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if qt.QueryTextProperties != nil { - objectMap["properties"] = qt.QueryTextProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for QueryText struct. -func (qt *QueryText) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var queryTextProperties QueryTextProperties - err = json.Unmarshal(*v, &queryTextProperties) - if err != nil { - return err - } - qt.QueryTextProperties = &queryTextProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - qt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - qt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - qt.Type = &typeVar - } - } - } - - return nil -} - -// QueryTextProperties the properties of a query text. -type QueryTextProperties struct { - // QueryID - Query identifier unique to the server. - QueryID *string `json:"queryId,omitempty"` - // QueryText - Query text. - QueryText *string `json:"queryText,omitempty"` -} - -// QueryTextsResultList a list of query texts. -type QueryTextsResultList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of query texts. - Value *[]QueryText `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryTextsResultList. -func (qtrl QueryTextsResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// QueryTextsResultListIterator provides access to a complete listing of QueryText values. -type QueryTextsResultListIterator struct { - i int - page QueryTextsResultListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *QueryTextsResultListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsResultListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *QueryTextsResultListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter QueryTextsResultListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter QueryTextsResultListIterator) Response() QueryTextsResultList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter QueryTextsResultListIterator) Value() QueryText { - if !iter.page.NotDone() { - return QueryText{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the QueryTextsResultListIterator type. -func NewQueryTextsResultListIterator(page QueryTextsResultListPage) QueryTextsResultListIterator { - return QueryTextsResultListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (qtrl QueryTextsResultList) IsEmpty() bool { - return qtrl.Value == nil || len(*qtrl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (qtrl QueryTextsResultList) hasNextLink() bool { - return qtrl.NextLink != nil && len(*qtrl.NextLink) != 0 -} - -// queryTextsResultListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (qtrl QueryTextsResultList) queryTextsResultListPreparer(ctx context.Context) (*http.Request, error) { - if !qtrl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(qtrl.NextLink))) -} - -// QueryTextsResultListPage contains a page of QueryText values. -type QueryTextsResultListPage struct { - fn func(context.Context, QueryTextsResultList) (QueryTextsResultList, error) - qtrl QueryTextsResultList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *QueryTextsResultListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsResultListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.qtrl) - if err != nil { - return err - } - page.qtrl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *QueryTextsResultListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page QueryTextsResultListPage) NotDone() bool { - return !page.qtrl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page QueryTextsResultListPage) Response() QueryTextsResultList { - return page.qtrl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page QueryTextsResultListPage) Values() []QueryText { - if page.qtrl.IsEmpty() { - return nil - } - return *page.qtrl.Value -} - -// Creates a new instance of the QueryTextsResultListPage type. -func NewQueryTextsResultListPage(cur QueryTextsResultList, getNextPage func(context.Context, QueryTextsResultList) (QueryTextsResultList, error)) QueryTextsResultListPage { - return QueryTextsResultListPage{ - fn: getNextPage, - qtrl: cur, - } -} - -// RecommendationAction represents a Recommendation Action. -type RecommendationAction struct { - autorest.Response `json:"-"` - // RecommendationActionProperties - The properties of a recommendation action. - *RecommendationActionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecommendationAction. -func (ra RecommendationAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ra.RecommendationActionProperties != nil { - objectMap["properties"] = ra.RecommendationActionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecommendationAction struct. -func (ra *RecommendationAction) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var recommendationActionProperties RecommendationActionProperties - err = json.Unmarshal(*v, &recommendationActionProperties) - if err != nil { - return err - } - ra.RecommendationActionProperties = &recommendationActionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ra.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ra.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ra.Type = &typeVar - } - } - } - - return nil -} - -// RecommendationActionProperties the properties of a recommendation action. -type RecommendationActionProperties struct { - // AdvisorName - Advisor name. - AdvisorName *string `json:"advisorName,omitempty"` - // SessionID - Recommendation action session identifier. - SessionID *string `json:"sessionId,omitempty"` - // ActionID - Recommendation action identifier. - ActionID *int32 `json:"actionId,omitempty"` - // CreatedTime - Recommendation action creation time. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // ExpirationTime - Recommendation action expiration time. - ExpirationTime *date.Time `json:"expirationTime,omitempty"` - // Reason - Recommendation action reason. - Reason *string `json:"reason,omitempty"` - // RecommendationType - Recommendation action type. - RecommendationType *string `json:"recommendationType,omitempty"` - // Details - Recommendation action details. - Details map[string]*string `json:"details"` -} - -// MarshalJSON is the custom marshaler for RecommendationActionProperties. -func (rap RecommendationActionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rap.AdvisorName != nil { - objectMap["advisorName"] = rap.AdvisorName - } - if rap.SessionID != nil { - objectMap["sessionId"] = rap.SessionID - } - if rap.ActionID != nil { - objectMap["actionId"] = rap.ActionID - } - if rap.CreatedTime != nil { - objectMap["createdTime"] = rap.CreatedTime - } - if rap.ExpirationTime != nil { - objectMap["expirationTime"] = rap.ExpirationTime - } - if rap.Reason != nil { - objectMap["reason"] = rap.Reason - } - if rap.RecommendationType != nil { - objectMap["recommendationType"] = rap.RecommendationType - } - if rap.Details != nil { - objectMap["details"] = rap.Details - } - return json.Marshal(objectMap) -} - -// RecommendationActionsResultList a list of recommendation actions. -type RecommendationActionsResultList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of recommendation action advisors. - Value *[]RecommendationAction `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecommendationActionsResultList. -func (rarl RecommendationActionsResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecommendationActionsResultListIterator provides access to a complete listing of RecommendationAction -// values. -type RecommendationActionsResultListIterator struct { - i int - page RecommendationActionsResultListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RecommendationActionsResultListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationActionsResultListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RecommendationActionsResultListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RecommendationActionsResultListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RecommendationActionsResultListIterator) Response() RecommendationActionsResultList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RecommendationActionsResultListIterator) Value() RecommendationAction { - if !iter.page.NotDone() { - return RecommendationAction{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RecommendationActionsResultListIterator type. -func NewRecommendationActionsResultListIterator(page RecommendationActionsResultListPage) RecommendationActionsResultListIterator { - return RecommendationActionsResultListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rarl RecommendationActionsResultList) IsEmpty() bool { - return rarl.Value == nil || len(*rarl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rarl RecommendationActionsResultList) hasNextLink() bool { - return rarl.NextLink != nil && len(*rarl.NextLink) != 0 -} - -// recommendationActionsResultListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rarl RecommendationActionsResultList) recommendationActionsResultListPreparer(ctx context.Context) (*http.Request, error) { - if !rarl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rarl.NextLink))) -} - -// RecommendationActionsResultListPage contains a page of RecommendationAction values. -type RecommendationActionsResultListPage struct { - fn func(context.Context, RecommendationActionsResultList) (RecommendationActionsResultList, error) - rarl RecommendationActionsResultList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RecommendationActionsResultListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecommendationActionsResultListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rarl) - if err != nil { - return err - } - page.rarl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RecommendationActionsResultListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RecommendationActionsResultListPage) NotDone() bool { - return !page.rarl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RecommendationActionsResultListPage) Response() RecommendationActionsResultList { - return page.rarl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RecommendationActionsResultListPage) Values() []RecommendationAction { - if page.rarl.IsEmpty() { - return nil - } - return *page.rarl.Value -} - -// Creates a new instance of the RecommendationActionsResultListPage type. -func NewRecommendationActionsResultListPage(cur RecommendationActionsResultList, getNextPage func(context.Context, RecommendationActionsResultList) (RecommendationActionsResultList, error)) RecommendationActionsResultListPage { - return RecommendationActionsResultListPage{ - fn: getNextPage, - rarl: cur, - } -} - -// RecommendedActionSessionsOperationStatus recommendation action session operation status. -type RecommendedActionSessionsOperationStatus struct { - autorest.Response `json:"-"` - // Name - Operation identifier. - Name *string `json:"name,omitempty"` - // StartTime - Operation start time. - StartTime *date.Time `json:"startTime,omitempty"` - // Status - Operation status. - Status *string `json:"status,omitempty"` -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SecurityAlertPolicyProperties properties of a security alert policy. -type SecurityAlertPolicyProperties struct { - // State - Specifies the state of the policy, whether it is enabled or disabled. Possible values include: 'ServerSecurityAlertPolicyStateEnabled', 'ServerSecurityAlertPolicyStateDisabled' - State ServerSecurityAlertPolicyState `json:"state,omitempty"` - // DisabledAlerts - Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly - DisabledAlerts *[]string `json:"disabledAlerts,omitempty"` - // EmailAddresses - Specifies an array of e-mail addresses to which the alert is sent. - EmailAddresses *[]string `json:"emailAddresses,omitempty"` - // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. - EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. - RetentionDays *int32 `json:"retentionDays,omitempty"` -} - -// Server represents a server. -type Server struct { - autorest.Response `json:"-"` - // Sku - The SKU (pricing tier) of the server. - Sku *Sku `json:"sku,omitempty"` - // ServerProperties - Properties of the server. - *ServerProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Server. -func (s Server) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Sku != nil { - objectMap["sku"] = s.Sku - } - if s.ServerProperties != nil { - objectMap["properties"] = s.ServerProperties - } - if s.Tags != nil { - objectMap["tags"] = s.Tags - } - if s.Location != nil { - objectMap["location"] = s.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Server struct. -func (s *Server) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - s.Sku = &sku - } - case "properties": - if v != nil { - var serverProperties ServerProperties - err = json.Unmarshal(*v, &serverProperties) - if err != nil { - return err - } - s.ServerProperties = &serverProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - s.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - s.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - s.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - s.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - s.Type = &typeVar - } - } - } - - return nil -} - -// ServerForCreate represents a server to be created. -type ServerForCreate struct { - // Sku - The SKU (pricing tier) of the server. - Sku *Sku `json:"sku,omitempty"` - // Properties - Properties of the server. - Properties BasicServerPropertiesForCreate `json:"properties,omitempty"` - // Location - The location the resource resides in. - Location *string `json:"location,omitempty"` - // Tags - Application-specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServerForCreate. -func (sfc ServerForCreate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sfc.Sku != nil { - objectMap["sku"] = sfc.Sku - } - objectMap["properties"] = sfc.Properties - if sfc.Location != nil { - objectMap["location"] = sfc.Location - } - if sfc.Tags != nil { - objectMap["tags"] = sfc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerForCreate struct. -func (sfc *ServerForCreate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sfc.Sku = &sku - } - case "properties": - if v != nil { - properties, err := unmarshalBasicServerPropertiesForCreate(*v) - if err != nil { - return err - } - sfc.Properties = properties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sfc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sfc.Tags = tags - } - } - } - - return nil -} - -// ServerListResult a list of servers. -type ServerListResult struct { - autorest.Response `json:"-"` - // Value - The list of servers - Value *[]Server `json:"value,omitempty"` -} - -// ServerPrivateEndpointConnection a private endpoint connection under a server -type ServerPrivateEndpointConnection struct { - // ID - READ-ONLY; Resource Id of the private endpoint connection. - ID *string `json:"id,omitempty"` - // Properties - READ-ONLY; Private endpoint connection properties - Properties *ServerPrivateEndpointConnectionProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPrivateEndpointConnection. -func (spec ServerPrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerPrivateEndpointConnectionProperties properties of a private endpoint connection. -type ServerPrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. - PrivateLinkServiceConnectionState *ServerPrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; State of the private endpoint connection. Possible values include: 'Approving', 'Ready', 'Dropping', 'Failed', 'Rejecting' - ProvisioningState PrivateEndpointProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPrivateEndpointConnectionProperties. -func (specp ServerPrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if specp.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = specp.PrivateEndpoint - } - if specp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = specp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// ServerPrivateLinkServiceConnectionStateProperty ... -type ServerPrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. Possible values include: 'Approved', 'Pending', 'Rejected', 'Disconnected' - Status PrivateLinkServiceConnectionStateStatus `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; The actions required for private link service connection. Possible values include: 'None' - ActionsRequired PrivateLinkServiceConnectionStateActionsRequire `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPrivateLinkServiceConnectionStateProperty. -func (splscsp ServerPrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if splscsp.Status != "" { - objectMap["status"] = splscsp.Status - } - if splscsp.Description != nil { - objectMap["description"] = splscsp.Description - } - return json.Marshal(objectMap) -} - -// ServerProperties the properties of a server. -type ServerProperties struct { - // AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // UserVisibleState - A state of a server that is visible to user. Possible values include: 'ServerStateReady', 'ServerStateDropping', 'ServerStateDisabled' - UserVisibleState ServerState `json:"userVisibleState,omitempty"` - // FullyQualifiedDomainName - The fully qualified domain name of a server. - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` - // EarliestRestoreDate - Earliest restore point creation time (ISO8601 format) - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // ReplicationRole - The replication role of the server. - ReplicationRole *string `json:"replicationRole,omitempty"` - // MasterServerID - The master server id of a replica server. - MasterServerID *string `json:"masterServerId,omitempty"` - // ReplicaCapacity - The maximum number of replicas that a master server can have. - ReplicaCapacity *int32 `json:"replicaCapacity,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections on a server - PrivateEndpointConnections *[]ServerPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerProperties. -func (sp ServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.AdministratorLogin != nil { - objectMap["administratorLogin"] = sp.AdministratorLogin - } - if sp.Version != "" { - objectMap["version"] = sp.Version - } - if sp.SslEnforcement != "" { - objectMap["sslEnforcement"] = sp.SslEnforcement - } - if sp.UserVisibleState != "" { - objectMap["userVisibleState"] = sp.UserVisibleState - } - if sp.FullyQualifiedDomainName != nil { - objectMap["fullyQualifiedDomainName"] = sp.FullyQualifiedDomainName - } - if sp.EarliestRestoreDate != nil { - objectMap["earliestRestoreDate"] = sp.EarliestRestoreDate - } - if sp.StorageProfile != nil { - objectMap["storageProfile"] = sp.StorageProfile - } - if sp.ReplicationRole != nil { - objectMap["replicationRole"] = sp.ReplicationRole - } - if sp.MasterServerID != nil { - objectMap["masterServerId"] = sp.MasterServerID - } - if sp.ReplicaCapacity != nil { - objectMap["replicaCapacity"] = sp.ReplicaCapacity - } - if sp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = sp.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// BasicServerPropertiesForCreate the properties used to create a new server. -type BasicServerPropertiesForCreate interface { - AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) - AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) - AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) - AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) - AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) -} - -// ServerPropertiesForCreate the properties used to create a new server. -type ServerPropertiesForCreate struct { - // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' - CreateMode CreateMode `json:"createMode,omitempty"` -} - -func unmarshalBasicServerPropertiesForCreate(body []byte) (BasicServerPropertiesForCreate, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["createMode"] { - case string(CreateModeDefault): - var spfdc ServerPropertiesForDefaultCreate - err := json.Unmarshal(body, &spfdc) - return spfdc, err - case string(CreateModePointInTimeRestore): - var spfr ServerPropertiesForRestore - err := json.Unmarshal(body, &spfr) - return spfr, err - case string(CreateModeGeoRestore): - var spfgr ServerPropertiesForGeoRestore - err := json.Unmarshal(body, &spfgr) - return spfgr, err - case string(CreateModeReplica): - var spfr ServerPropertiesForReplica - err := json.Unmarshal(body, &spfr) - return spfr, err - default: - var spfc ServerPropertiesForCreate - err := json.Unmarshal(body, &spfc) - return spfc, err - } -} -func unmarshalBasicServerPropertiesForCreateArray(body []byte) ([]BasicServerPropertiesForCreate, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - spfcArray := make([]BasicServerPropertiesForCreate, len(rawMessages)) - - for index, rawMessage := range rawMessages { - spfc, err := unmarshalBasicServerPropertiesForCreate(*rawMessage) - if err != nil { - return nil, err - } - spfcArray[index] = spfc - } - return spfcArray, nil -} - -// MarshalJSON is the custom marshaler for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) MarshalJSON() ([]byte, error) { - spfc.CreateMode = CreateModeServerPropertiesForCreate - objectMap := make(map[string]interface{}) - if spfc.Version != "" { - objectMap["version"] = spfc.Version - } - if spfc.SslEnforcement != "" { - objectMap["sslEnforcement"] = spfc.SslEnforcement - } - if spfc.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = spfc.PublicNetworkAccess - } - if spfc.StorageProfile != nil { - objectMap["storageProfile"] = spfc.StorageProfile - } - if spfc.CreateMode != "" { - objectMap["createMode"] = spfc.CreateMode - } - return json.Marshal(objectMap) -} - -// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { - return nil, false -} - -// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { - return nil, false -} - -// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { - return nil, false -} - -// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { - return nil, false -} - -// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { - return &spfc, true -} - -// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { - return &spfc, true -} - -// ServerPropertiesForDefaultCreate the properties used to create a new server. -type ServerPropertiesForDefaultCreate struct { - // AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The password of the administrator login. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' - CreateMode CreateMode `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) { - spfdc.CreateMode = CreateModeDefault - objectMap := make(map[string]interface{}) - if spfdc.AdministratorLogin != nil { - objectMap["administratorLogin"] = spfdc.AdministratorLogin - } - if spfdc.AdministratorLoginPassword != nil { - objectMap["administratorLoginPassword"] = spfdc.AdministratorLoginPassword - } - if spfdc.Version != "" { - objectMap["version"] = spfdc.Version - } - if spfdc.SslEnforcement != "" { - objectMap["sslEnforcement"] = spfdc.SslEnforcement - } - if spfdc.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = spfdc.PublicNetworkAccess - } - if spfdc.StorageProfile != nil { - objectMap["storageProfile"] = spfdc.StorageProfile - } - if spfdc.CreateMode != "" { - objectMap["createMode"] = spfdc.CreateMode - } - return json.Marshal(objectMap) -} - -// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { - return &spfdc, true -} - -// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { - return nil, false -} - -// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { - return nil, false -} - -// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { - return nil, false -} - -// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { - return nil, false -} - -// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { - return &spfdc, true -} - -// ServerPropertiesForGeoRestore the properties used to create a new server by restoring to a different -// region from a geo replicated backup. -type ServerPropertiesForGeoRestore struct { - // SourceServerID - The source server id to restore from. - SourceServerID *string `json:"sourceServerId,omitempty"` - // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' - CreateMode CreateMode `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) { - spfgr.CreateMode = CreateModeGeoRestore - objectMap := make(map[string]interface{}) - if spfgr.SourceServerID != nil { - objectMap["sourceServerId"] = spfgr.SourceServerID - } - if spfgr.Version != "" { - objectMap["version"] = spfgr.Version - } - if spfgr.SslEnforcement != "" { - objectMap["sslEnforcement"] = spfgr.SslEnforcement - } - if spfgr.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = spfgr.PublicNetworkAccess - } - if spfgr.StorageProfile != nil { - objectMap["storageProfile"] = spfgr.StorageProfile - } - if spfgr.CreateMode != "" { - objectMap["createMode"] = spfgr.CreateMode - } - return json.Marshal(objectMap) -} - -// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { - return nil, false -} - -// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { - return nil, false -} - -// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { - return &spfgr, true -} - -// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { - return nil, false -} - -// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { - return nil, false -} - -// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { - return &spfgr, true -} - -// ServerPropertiesForReplica the properties to create a new replica. -type ServerPropertiesForReplica struct { - // SourceServerID - The master server id to create replica from. - SourceServerID *string `json:"sourceServerId,omitempty"` - // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' - CreateMode CreateMode `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) MarshalJSON() ([]byte, error) { - spfr.CreateMode = CreateModeReplica - objectMap := make(map[string]interface{}) - if spfr.SourceServerID != nil { - objectMap["sourceServerId"] = spfr.SourceServerID - } - if spfr.Version != "" { - objectMap["version"] = spfr.Version - } - if spfr.SslEnforcement != "" { - objectMap["sslEnforcement"] = spfr.SslEnforcement - } - if spfr.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = spfr.PublicNetworkAccess - } - if spfr.StorageProfile != nil { - objectMap["storageProfile"] = spfr.StorageProfile - } - if spfr.CreateMode != "" { - objectMap["createMode"] = spfr.CreateMode - } - return json.Marshal(objectMap) -} - -// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { - return nil, false -} - -// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { - return nil, false -} - -// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { - return nil, false -} - -// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { - return &spfr, true -} - -// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { - return nil, false -} - -// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { - return &spfr, true -} - -// ServerPropertiesForRestore the properties used to create a new server by restoring from a backup. -type ServerPropertiesForRestore struct { - // SourceServerID - The source server id to restore from. - SourceServerID *string `json:"sourceServerId,omitempty"` - // RestorePointInTime - Restore point creation time (ISO8601 format), specifying the time to restore from. - RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` - // Version - Server version. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' - CreateMode CreateMode `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { - spfr.CreateMode = CreateModePointInTimeRestore - objectMap := make(map[string]interface{}) - if spfr.SourceServerID != nil { - objectMap["sourceServerId"] = spfr.SourceServerID - } - if spfr.RestorePointInTime != nil { - objectMap["restorePointInTime"] = spfr.RestorePointInTime - } - if spfr.Version != "" { - objectMap["version"] = spfr.Version - } - if spfr.SslEnforcement != "" { - objectMap["sslEnforcement"] = spfr.SslEnforcement - } - if spfr.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = spfr.PublicNetworkAccess - } - if spfr.StorageProfile != nil { - objectMap["storageProfile"] = spfr.StorageProfile - } - if spfr.CreateMode != "" { - objectMap["createMode"] = spfr.CreateMode - } - return json.Marshal(objectMap) -} - -// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { - return nil, false -} - -// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { - return &spfr, true -} - -// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { - return nil, false -} - -// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { - return nil, false -} - -// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { - return nil, false -} - -// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { - return &spfr, true -} - -// ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (Server, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersCreateFuture.Result. -func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.ServersCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.CreateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersDeleteFuture.Result. -func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.ServersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerSecurityAlertPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ServerSecurityAlertPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerSecurityAlertPoliciesClient) (ServerSecurityAlertPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServerSecurityAlertPoliciesCreateOrUpdateFuture.Result. -func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) result(client ServerSecurityAlertPoliciesClient) (ssap ServerSecurityAlertPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ssap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.ServerSecurityAlertPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ssap.Response.Response, err = future.GetResult(sender); err == nil && ssap.Response.Response.StatusCode != http.StatusNoContent { - ssap, err = client.CreateOrUpdateResponder(ssap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", ssap.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerSecurityAlertPolicy a server security alert policy. -type ServerSecurityAlertPolicy struct { - autorest.Response `json:"-"` - // SecurityAlertPolicyProperties - Resource properties. - *SecurityAlertPolicyProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicy. -func (ssap ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ssap.SecurityAlertPolicyProperties != nil { - objectMap["properties"] = ssap.SecurityAlertPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerSecurityAlertPolicy struct. -func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var securityAlertPolicyProperties SecurityAlertPolicyProperties - err = json.Unmarshal(*v, &securityAlertPolicyProperties) - if err != nil { - return err - } - ssap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ssap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ssap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ssap.Type = &typeVar - } - } - } - - return nil -} - -// ServersRestartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersRestartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersRestartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersRestartFuture.Result. -func (future *ServersRestartFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersRestartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.ServersRestartFuture") - return - } - ar.Response = future.Response() - return -} - -// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (Server, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersUpdateFuture.Result. -func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.ServersUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.UpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerUpdateParameters parameters allowed to update for a server. -type ServerUpdateParameters struct { - // Sku - The SKU (pricing tier) of the server. - Sku *Sku `json:"sku,omitempty"` - // ServerUpdateParametersProperties - The properties that can be updated for a server. - *ServerUpdateParametersProperties `json:"properties,omitempty"` - // Tags - Application-specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServerUpdateParameters. -func (sup ServerUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.Sku != nil { - objectMap["sku"] = sup.Sku - } - if sup.ServerUpdateParametersProperties != nil { - objectMap["properties"] = sup.ServerUpdateParametersProperties - } - if sup.Tags != nil { - objectMap["tags"] = sup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerUpdateParameters struct. -func (sup *ServerUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sup.Sku = &sku - } - case "properties": - if v != nil { - var serverUpdateParametersProperties ServerUpdateParametersProperties - err = json.Unmarshal(*v, &serverUpdateParametersProperties) - if err != nil { - return err - } - sup.ServerUpdateParametersProperties = &serverUpdateParametersProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sup.Tags = tags - } - } - } - - return nil -} - -// ServerUpdateParametersProperties the properties that can be updated for a server. -type ServerUpdateParametersProperties struct { - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // AdministratorLoginPassword - The password of the administrator login. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // Version - The version of a server. Possible values include: 'FiveFullStopSix', 'FiveFullStopSeven' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // ReplicationRole - The replication role of the server. - ReplicationRole *string `json:"replicationRole,omitempty"` -} - -// Sku billing information related properties of a server. -type Sku struct { - // Name - The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8. - Name *string `json:"name,omitempty"` - // Tier - The tier of the particular SKU, e.g. Basic. Possible values include: 'Basic', 'GeneralPurpose', 'MemoryOptimized' - Tier SkuTier `json:"tier,omitempty"` - // Capacity - The scale up/out capacity, representing server's compute units. - Capacity *int32 `json:"capacity,omitempty"` - // Size - The size code, to be interpreted by resource as appropriate. - Size *string `json:"size,omitempty"` - // Family - The family of hardware. - Family *string `json:"family,omitempty"` -} - -// StorageProfile storage Profile properties of a server -type StorageProfile struct { - // BackupRetentionDays - Backup retention days for the server. - BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"` - // GeoRedundantBackup - Enable Geo-redundant or not for server backup. Possible values include: 'Enabled', 'Disabled' - GeoRedundantBackup GeoRedundantBackup `json:"geoRedundantBackup,omitempty"` - // StorageMB - Max storage allowed for a server. - StorageMB *int32 `json:"storageMB,omitempty"` - // StorageAutogrow - Enable Storage Auto Grow. Possible values include: 'StorageAutogrowEnabled', 'StorageAutogrowDisabled' - StorageAutogrow StorageAutogrow `json:"storageAutogrow,omitempty"` -} - -// TagsObject tags object for patch operations. -type TagsObject struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TagsObject. -func (toVar TagsObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if toVar.Tags != nil { - objectMap["tags"] = toVar.Tags - } - return json.Marshal(objectMap) -} - -// TopQueryStatisticsInput input to get top query statistics -type TopQueryStatisticsInput struct { - // TopQueryStatisticsInputProperties - The properties of a wait statistics input. - *TopQueryStatisticsInputProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopQueryStatisticsInput. -func (tqsi TopQueryStatisticsInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tqsi.TopQueryStatisticsInputProperties != nil { - objectMap["properties"] = tqsi.TopQueryStatisticsInputProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TopQueryStatisticsInput struct. -func (tqsi *TopQueryStatisticsInput) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var topQueryStatisticsInputProperties TopQueryStatisticsInputProperties - err = json.Unmarshal(*v, &topQueryStatisticsInputProperties) - if err != nil { - return err - } - tqsi.TopQueryStatisticsInputProperties = &topQueryStatisticsInputProperties - } - } - } - - return nil -} - -// TopQueryStatisticsInputProperties the properties for input to get top query statistics -type TopQueryStatisticsInputProperties struct { - // NumberOfTopQueries - Max number of top queries to return. - NumberOfTopQueries *int32 `json:"numberOfTopQueries,omitempty"` - // AggregationFunction - Aggregation function name. - AggregationFunction *string `json:"aggregationFunction,omitempty"` - // ObservedMetric - Observed metric name. - ObservedMetric *string `json:"observedMetric,omitempty"` - // ObservationStartTime - Observation start time. - ObservationStartTime *date.Time `json:"observationStartTime,omitempty"` - // ObservationEndTime - Observation end time. - ObservationEndTime *date.Time `json:"observationEndTime,omitempty"` - // AggregationWindow - Aggregation interval type in ISO 8601 format. - AggregationWindow *string `json:"aggregationWindow,omitempty"` -} - -// TopQueryStatisticsResultList a list of query statistics. -type TopQueryStatisticsResultList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of top query statistics. - Value *[]QueryStatistic `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for TopQueryStatisticsResultList. -func (tqsrl TopQueryStatisticsResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TopQueryStatisticsResultListIterator provides access to a complete listing of QueryStatistic values. -type TopQueryStatisticsResultListIterator struct { - i int - page TopQueryStatisticsResultListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *TopQueryStatisticsResultListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsResultListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *TopQueryStatisticsResultListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter TopQueryStatisticsResultListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter TopQueryStatisticsResultListIterator) Response() TopQueryStatisticsResultList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter TopQueryStatisticsResultListIterator) Value() QueryStatistic { - if !iter.page.NotDone() { - return QueryStatistic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the TopQueryStatisticsResultListIterator type. -func NewTopQueryStatisticsResultListIterator(page TopQueryStatisticsResultListPage) TopQueryStatisticsResultListIterator { - return TopQueryStatisticsResultListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (tqsrl TopQueryStatisticsResultList) IsEmpty() bool { - return tqsrl.Value == nil || len(*tqsrl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (tqsrl TopQueryStatisticsResultList) hasNextLink() bool { - return tqsrl.NextLink != nil && len(*tqsrl.NextLink) != 0 -} - -// topQueryStatisticsResultListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (tqsrl TopQueryStatisticsResultList) topQueryStatisticsResultListPreparer(ctx context.Context) (*http.Request, error) { - if !tqsrl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(tqsrl.NextLink))) -} - -// TopQueryStatisticsResultListPage contains a page of QueryStatistic values. -type TopQueryStatisticsResultListPage struct { - fn func(context.Context, TopQueryStatisticsResultList) (TopQueryStatisticsResultList, error) - tqsrl TopQueryStatisticsResultList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *TopQueryStatisticsResultListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsResultListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.tqsrl) - if err != nil { - return err - } - page.tqsrl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *TopQueryStatisticsResultListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page TopQueryStatisticsResultListPage) NotDone() bool { - return !page.tqsrl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page TopQueryStatisticsResultListPage) Response() TopQueryStatisticsResultList { - return page.tqsrl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page TopQueryStatisticsResultListPage) Values() []QueryStatistic { - if page.tqsrl.IsEmpty() { - return nil - } - return *page.tqsrl.Value -} - -// Creates a new instance of the TopQueryStatisticsResultListPage type. -func NewTopQueryStatisticsResultListPage(cur TopQueryStatisticsResultList, getNextPage func(context.Context, TopQueryStatisticsResultList) (TopQueryStatisticsResultList, error)) TopQueryStatisticsResultListPage { - return TopQueryStatisticsResultListPage{ - fn: getNextPage, - tqsrl: cur, - } -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// VirtualNetworkRule a virtual network rule. -type VirtualNetworkRule struct { - autorest.Response `json:"-"` - // VirtualNetworkRuleProperties - Resource properties. - *VirtualNetworkRuleProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkRule. -func (vnr VirtualNetworkRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnr.VirtualNetworkRuleProperties != nil { - objectMap["properties"] = vnr.VirtualNetworkRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetworkRule struct. -func (vnr *VirtualNetworkRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualNetworkRuleProperties VirtualNetworkRuleProperties - err = json.Unmarshal(*v, &virtualNetworkRuleProperties) - if err != nil { - return err - } - vnr.VirtualNetworkRuleProperties = &virtualNetworkRuleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vnr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vnr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vnr.Type = &typeVar - } - } - } - - return nil -} - -// VirtualNetworkRuleListResult a list of virtual network rules. -type VirtualNetworkRuleListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]VirtualNetworkRule `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkRuleListResult. -func (vnrlr VirtualNetworkRuleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkRuleListResultIterator provides access to a complete listing of VirtualNetworkRule values. -type VirtualNetworkRuleListResultIterator struct { - i int - page VirtualNetworkRuleListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualNetworkRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualNetworkRuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualNetworkRuleListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualNetworkRuleListResultIterator) Response() VirtualNetworkRuleListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualNetworkRuleListResultIterator) Value() VirtualNetworkRule { - if !iter.page.NotDone() { - return VirtualNetworkRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualNetworkRuleListResultIterator type. -func NewVirtualNetworkRuleListResultIterator(page VirtualNetworkRuleListResultPage) VirtualNetworkRuleListResultIterator { - return VirtualNetworkRuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vnrlr VirtualNetworkRuleListResult) IsEmpty() bool { - return vnrlr.Value == nil || len(*vnrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vnrlr VirtualNetworkRuleListResult) hasNextLink() bool { - return vnrlr.NextLink != nil && len(*vnrlr.NextLink) != 0 -} - -// virtualNetworkRuleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vnrlr VirtualNetworkRuleListResult) virtualNetworkRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vnrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vnrlr.NextLink))) -} - -// VirtualNetworkRuleListResultPage contains a page of VirtualNetworkRule values. -type VirtualNetworkRuleListResultPage struct { - fn func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error) - vnrlr VirtualNetworkRuleListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualNetworkRuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vnrlr) - if err != nil { - return err - } - page.vnrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualNetworkRuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualNetworkRuleListResultPage) NotDone() bool { - return !page.vnrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualNetworkRuleListResultPage) Response() VirtualNetworkRuleListResult { - return page.vnrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualNetworkRuleListResultPage) Values() []VirtualNetworkRule { - if page.vnrlr.IsEmpty() { - return nil - } - return *page.vnrlr.Value -} - -// Creates a new instance of the VirtualNetworkRuleListResultPage type. -func NewVirtualNetworkRuleListResultPage(cur VirtualNetworkRuleListResult, getNextPage func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error)) VirtualNetworkRuleListResultPage { - return VirtualNetworkRuleListResultPage{ - fn: getNextPage, - vnrlr: cur, - } -} - -// VirtualNetworkRuleProperties properties of a virtual network rule. -type VirtualNetworkRuleProperties struct { - // VirtualNetworkSubnetID - The ARM resource id of the virtual network subnet. - VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"` - // IgnoreMissingVnetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. - IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` - // State - READ-ONLY; Virtual Network Rule State. Possible values include: 'VirtualNetworkRuleStateInitializing', 'VirtualNetworkRuleStateInProgress', 'VirtualNetworkRuleStateReady', 'VirtualNetworkRuleStateDeleting', 'VirtualNetworkRuleStateUnknown' - State VirtualNetworkRuleState `json:"state,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkRuleProperties. -func (vnrp VirtualNetworkRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnrp.VirtualNetworkSubnetID != nil { - objectMap["virtualNetworkSubnetId"] = vnrp.VirtualNetworkSubnetID - } - if vnrp.IgnoreMissingVnetServiceEndpoint != nil { - objectMap["ignoreMissingVnetServiceEndpoint"] = vnrp.IgnoreMissingVnetServiceEndpoint - } - return json.Marshal(objectMap) -} - -// VirtualNetworkRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkRulesClient) (VirtualNetworkRule, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkRulesCreateOrUpdateFuture.Result. -func (future *VirtualNetworkRulesCreateOrUpdateFuture) result(client VirtualNetworkRulesClient) (vnr VirtualNetworkRule, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vnr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.VirtualNetworkRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vnr.Response.Response, err = future.GetResult(sender); err == nil && vnr.Response.Response.StatusCode != http.StatusNoContent { - vnr, err = client.CreateOrUpdateResponder(vnr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesCreateOrUpdateFuture", "Result", vnr.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkRulesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkRulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkRulesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkRulesDeleteFuture.Result. -func (future *VirtualNetworkRulesDeleteFuture) result(client VirtualNetworkRulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("mariadb.VirtualNetworkRulesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// WaitStatistic represents a Wait Statistic. -type WaitStatistic struct { - autorest.Response `json:"-"` - // WaitStatisticProperties - The properties of a wait statistic. - *WaitStatisticProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for WaitStatistic. -func (ws WaitStatistic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ws.WaitStatisticProperties != nil { - objectMap["properties"] = ws.WaitStatisticProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WaitStatistic struct. -func (ws *WaitStatistic) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var waitStatisticProperties WaitStatisticProperties - err = json.Unmarshal(*v, &waitStatisticProperties) - if err != nil { - return err - } - ws.WaitStatisticProperties = &waitStatisticProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ws.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ws.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ws.Type = &typeVar - } - } - } - - return nil -} - -// WaitStatisticProperties the properties of a wait statistic. -type WaitStatisticProperties struct { - // StartTime - Observation start time. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - Observation end time. - EndTime *date.Time `json:"endTime,omitempty"` - // EventName - Wait event name. - EventName *string `json:"eventName,omitempty"` - // EventTypeName - Wait event type name. - EventTypeName *string `json:"eventTypeName,omitempty"` - // QueryID - Database query identifier. - QueryID *int64 `json:"queryId,omitempty"` - // DatabaseName - Database Name. - DatabaseName *string `json:"databaseName,omitempty"` - // UserID - Database user identifier. - UserID *int64 `json:"userId,omitempty"` - // Count - Wait event count observed in this time interval. - Count *int64 `json:"count,omitempty"` - // TotalTimeInMs - Total time of wait in milliseconds in this time interval. - TotalTimeInMs *float64 `json:"totalTimeInMs,omitempty"` -} - -// WaitStatisticsInput input to get wait statistics -type WaitStatisticsInput struct { - // WaitStatisticsInputProperties - The properties of a wait statistics input. - *WaitStatisticsInputProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WaitStatisticsInput. -func (wsi WaitStatisticsInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wsi.WaitStatisticsInputProperties != nil { - objectMap["properties"] = wsi.WaitStatisticsInputProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WaitStatisticsInput struct. -func (wsi *WaitStatisticsInput) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var waitStatisticsInputProperties WaitStatisticsInputProperties - err = json.Unmarshal(*v, &waitStatisticsInputProperties) - if err != nil { - return err - } - wsi.WaitStatisticsInputProperties = &waitStatisticsInputProperties - } - } - } - - return nil -} - -// WaitStatisticsInputProperties the properties for input to get wait statistics -type WaitStatisticsInputProperties struct { - // ObservationStartTime - Observation start time. - ObservationStartTime *date.Time `json:"observationStartTime,omitempty"` - // ObservationEndTime - Observation end time. - ObservationEndTime *date.Time `json:"observationEndTime,omitempty"` - // AggregationWindow - Aggregation interval type in ISO 8601 format. - AggregationWindow *string `json:"aggregationWindow,omitempty"` -} - -// WaitStatisticsResultList a list of wait statistics. -type WaitStatisticsResultList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of wait statistics. - Value *[]WaitStatistic `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for WaitStatisticsResultList. -func (wsrl WaitStatisticsResultList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WaitStatisticsResultListIterator provides access to a complete listing of WaitStatistic values. -type WaitStatisticsResultListIterator struct { - i int - page WaitStatisticsResultListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *WaitStatisticsResultListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsResultListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *WaitStatisticsResultListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WaitStatisticsResultListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter WaitStatisticsResultListIterator) Response() WaitStatisticsResultList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter WaitStatisticsResultListIterator) Value() WaitStatistic { - if !iter.page.NotDone() { - return WaitStatistic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WaitStatisticsResultListIterator type. -func NewWaitStatisticsResultListIterator(page WaitStatisticsResultListPage) WaitStatisticsResultListIterator { - return WaitStatisticsResultListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wsrl WaitStatisticsResultList) IsEmpty() bool { - return wsrl.Value == nil || len(*wsrl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wsrl WaitStatisticsResultList) hasNextLink() bool { - return wsrl.NextLink != nil && len(*wsrl.NextLink) != 0 -} - -// waitStatisticsResultListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wsrl WaitStatisticsResultList) waitStatisticsResultListPreparer(ctx context.Context) (*http.Request, error) { - if !wsrl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wsrl.NextLink))) -} - -// WaitStatisticsResultListPage contains a page of WaitStatistic values. -type WaitStatisticsResultListPage struct { - fn func(context.Context, WaitStatisticsResultList) (WaitStatisticsResultList, error) - wsrl WaitStatisticsResultList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *WaitStatisticsResultListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsResultListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.wsrl) - if err != nil { - return err - } - page.wsrl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *WaitStatisticsResultListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WaitStatisticsResultListPage) NotDone() bool { - return !page.wsrl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WaitStatisticsResultListPage) Response() WaitStatisticsResultList { - return page.wsrl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WaitStatisticsResultListPage) Values() []WaitStatistic { - if page.wsrl.IsEmpty() { - return nil - } - return *page.wsrl.Value -} - -// Creates a new instance of the WaitStatisticsResultListPage type. -func NewWaitStatisticsResultListPage(cur WaitStatisticsResultList, getNextPage func(context.Context, WaitStatisticsResultList) (WaitStatisticsResultList, error)) WaitStatisticsResultListPage { - return WaitStatisticsResultListPage{ - fn: getNextPage, - wsrl: cur, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/operations.go deleted file mode 100644 index 46b3fc07f95..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/operations.go +++ /dev/null @@ -1,100 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and configurations -// with new business model. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available REST API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DBForMariaDB/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/privateendpointconnections.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/privateendpointconnections.go deleted file mode 100644 index c3b83dc4828..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/privateendpointconnections.go +++ /dev/null @@ -1,532 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState.Status", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState.Description", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets all private endpoint connections on a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client PrivateEndpointConnectionsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result PrivateEndpointConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByServer") - defer func() { - sc := -1 - if result.peclr.Response.Response != nil { - sc = result.peclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.PrivateEndpointConnectionsClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.peclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.peclr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.peclr.hasNextLink() && result.peclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client PrivateEndpointConnectionsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByServerResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionsClient) listByServerNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { - req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result PrivateEndpointConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} - -// UpdateTags updates private endpoint connection with the specified tags. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - parameters supplied to the Update private endpoint connection Tags operation. -func (client PrivateEndpointConnectionsClient) UpdateTags(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters TagsObject) (result PrivateEndpointConnectionsUpdateTagsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.UpdateTags") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.PrivateEndpointConnectionsClient", "UpdateTags", err.Error()) - } - - req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, serverName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsClient", "UpdateTags", nil, "Failure preparing request") - return - } - - result, err = client.UpdateTagsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateEndpointConnectionsClient", "UpdateTags", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateTagsPreparer prepares the UpdateTags request. -func (client PrivateEndpointConnectionsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters TagsObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTagsSender sends the UpdateTags request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) UpdateTagsSender(req *http.Request) (future PrivateEndpointConnectionsUpdateTagsFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateTagsResponder handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) UpdateTagsResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/privatelinkresources.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/privatelinkresources.go deleted file mode 100644 index 64801789e0c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/privatelinkresources.go +++ /dev/null @@ -1,251 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a private link resource for MariaDB server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// groupName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, serverName string, groupName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateLinkResources/{groupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) GetResponder(resp *http.Response) (result PrivateLinkResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets the private link resources for MariaDB server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client PrivateLinkResourcesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByServer") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.PrivateLinkResourcesClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateLinkResourcesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.PrivateLinkResourcesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateLinkResourcesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client PrivateLinkResourcesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByServerResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listByServerNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mariadb.PrivateLinkResourcesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mariadb.PrivateLinkResourcesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.PrivateLinkResourcesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/querytexts.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/querytexts.go deleted file mode 100644 index a627580963b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/querytexts.go +++ /dev/null @@ -1,254 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// QueryTextsClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and configurations -// with new business model. -type QueryTextsClient struct { - BaseClient -} - -// NewQueryTextsClient creates an instance of the QueryTextsClient client. -func NewQueryTextsClient(subscriptionID string) QueryTextsClient { - return NewQueryTextsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewQueryTextsClientWithBaseURI creates an instance of the QueryTextsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewQueryTextsClientWithBaseURI(baseURI string, subscriptionID string) QueryTextsClient { - return QueryTextsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the Query-Store query texts for the queryId. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// queryID - the Query-Store query identifier. -func (client QueryTextsClient) Get(ctx context.Context, resourceGroupName string, serverName string, queryID string) (result QueryText, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.QueryTextsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, queryID) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.QueryTextsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.QueryTextsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.QueryTextsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client QueryTextsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, queryID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "queryId": autorest.Encode("path", queryID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/queryTexts/{queryId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client QueryTextsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client QueryTextsClient) GetResponder(resp *http.Response) (result QueryText, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer retrieve the Query-Store query texts for specified queryIds. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// queryIds - the query identifiers -func (client QueryTextsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, queryIds []string) (result QueryTextsResultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsClient.ListByServer") - defer func() { - sc := -1 - if result.qtrl.Response.Response != nil { - sc = result.qtrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: queryIds, - Constraints: []validation.Constraint{{Target: "queryIds", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.QueryTextsClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName, queryIds) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.QueryTextsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.qtrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.QueryTextsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.qtrl, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.QueryTextsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.qtrl.hasNextLink() && result.qtrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client QueryTextsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string, queryIds []string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "queryIds": queryIds, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/queryTexts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client QueryTextsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client QueryTextsClient) ListByServerResponder(resp *http.Response) (result QueryTextsResultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client QueryTextsClient) listByServerNextResults(ctx context.Context, lastResults QueryTextsResultList) (result QueryTextsResultList, err error) { - req, err := lastResults.queryTextsResultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mariadb.QueryTextsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mariadb.QueryTextsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.QueryTextsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client QueryTextsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, queryIds []string) (result QueryTextsResultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueryTextsClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName, queryIds) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/recommendedactions.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/recommendedactions.go deleted file mode 100644 index cfbd8f46bfa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/recommendedactions.go +++ /dev/null @@ -1,259 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RecommendedActionsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type RecommendedActionsClient struct { - BaseClient -} - -// NewRecommendedActionsClient creates an instance of the RecommendedActionsClient client. -func NewRecommendedActionsClient(subscriptionID string) RecommendedActionsClient { - return NewRecommendedActionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecommendedActionsClientWithBaseURI creates an instance of the RecommendedActionsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewRecommendedActionsClientWithBaseURI(baseURI string, subscriptionID string) RecommendedActionsClient { - return RecommendedActionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve recommended actions from the advisor. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// advisorName - the advisor name for recommendation action. -// recommendedActionName - the recommended action name. -func (client RecommendedActionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, advisorName string, recommendedActionName string) (result RecommendationAction, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecommendedActionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.RecommendedActionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, advisorName, recommendedActionName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.RecommendedActionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.RecommendedActionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.RecommendedActionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RecommendedActionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, advisorName string, recommendedActionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "advisorName": autorest.Encode("path", advisorName), - "recommendedActionName": autorest.Encode("path", recommendedActionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedActionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RecommendedActionsClient) GetResponder(resp *http.Response) (result RecommendationAction, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer retrieve recommended actions from the advisor. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// advisorName - the advisor name for recommendation action. -// sessionID - the recommendation action session identifier. -func (client RecommendedActionsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, advisorName string, sessionID string) (result RecommendationActionsResultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecommendedActionsClient.ListByServer") - defer func() { - sc := -1 - if result.rarl.Response.Response != nil { - sc = result.rarl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.RecommendedActionsClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName, advisorName, sessionID) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.RecommendedActionsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.rarl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.RecommendedActionsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.rarl, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.RecommendedActionsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.rarl.hasNextLink() && result.rarl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client RecommendedActionsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string, advisorName string, sessionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "advisorName": autorest.Encode("path", advisorName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(sessionID) > 0 { - queryParameters["sessionId"] = autorest.Encode("query", sessionID) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/advisors/{advisorName}/recommendedActions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client RecommendedActionsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client RecommendedActionsClient) ListByServerResponder(resp *http.Response) (result RecommendationActionsResultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client RecommendedActionsClient) listByServerNextResults(ctx context.Context, lastResults RecommendationActionsResultList) (result RecommendationActionsResultList, err error) { - req, err := lastResults.recommendationActionsResultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mariadb.RecommendedActionsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mariadb.RecommendedActionsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.RecommendedActionsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client RecommendedActionsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, advisorName string, sessionID string) (result RecommendationActionsResultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecommendedActionsClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName, advisorName, sessionID) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/replicas.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/replicas.go deleted file mode 100644 index 93ce74925a1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/replicas.go +++ /dev/null @@ -1,120 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ReplicasClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and configurations with -// new business model. -type ReplicasClient struct { - BaseClient -} - -// NewReplicasClient creates an instance of the ReplicasClient client. -func NewReplicasClient(subscriptionID string) ReplicasClient { - return NewReplicasClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReplicasClientWithBaseURI creates an instance of the ReplicasClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewReplicasClientWithBaseURI(baseURI string, subscriptionID string) ReplicasClient { - return ReplicasClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByServer list all the replicas for a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ReplicasClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicasClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.ReplicasClient", "ListByServer", err.Error()) - } - - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ReplicasClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.ReplicasClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ReplicasClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ReplicasClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/replicas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicasClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ReplicasClient) ListByServerResponder(resp *http.Response) (result ServerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/servers.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/servers.go deleted file mode 100644 index b13535358ce..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/servers.go +++ /dev/null @@ -1,649 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServersClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and configurations with -// new business model. -type ServersClient struct { - BaseClient -} - -// NewServersClient creates an instance of the ServersClient client. -func NewServersClient(subscriptionID string) ServersClient { - return NewServersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServersClientWithBaseURI creates an instance of the ServersClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient { - return ServersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new server or updates an existing server. The update action will overwrite the existing server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the required parameters for creating or updating a server. -func (client ServersClient) Create(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForCreate) (result ServersCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Sku.Capacity", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Capacity", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, - }}, - {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.ServersClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ServersClient) CreatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForCreate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) CreateSender(req *http.Request) (future ServersCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ServersClient) CreateResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServersClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.ServersClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) DeleteSender(req *http.Request) (future ServersDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServersClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result Server, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.ServersClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServersClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServersClient) GetResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all the servers in a given subscription. -func (client ServersClient) List(ctx context.Context) (result ServerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.ServersClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBForMariaDB/servers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServersClient) ListResponder(resp *http.Response) (result ServerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the servers in a given resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ServersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.ServersClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ServersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (result ServerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Restart restarts a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServersClient) Restart(ctx context.Context, resourceGroupName string, serverName string) (result ServersRestartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Restart") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.ServersClient", "Restart", err.Error()) - } - - req, err := client.RestartPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "Restart", nil, "Failure preparing request") - return - } - - result, err = client.RestartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "Restart", result.Response(), "Failure sending request") - return - } - - return -} - -// RestartPreparer prepares the Restart request. -func (client ServersClient) RestartPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/restart", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RestartSender sends the Restart request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) RestartSender(req *http.Request) (future ServersRestartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RestartResponder handles the response to the Restart request. The method always -// closes the http.Response Body. -func (client ServersClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates an existing server. The request body can contain one to many of the properties present in the normal -// server definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the required parameters for updating a server. -func (client ServersClient) Update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdateParameters) (result ServersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.ServersClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) UpdateSender(req *http.Request) (future ServersUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ServersClient) UpdateResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/serversecurityalertpolicies.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/serversecurityalertpolicies.go deleted file mode 100644 index 8d934a4e58b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/serversecurityalertpolicies.go +++ /dev/null @@ -1,215 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServerSecurityAlertPoliciesClient is the the Microsoft Azure management API provides create, read, update, and -// delete functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files -// and configurations with new business model. -type ServerSecurityAlertPoliciesClient struct { - BaseClient -} - -// NewServerSecurityAlertPoliciesClient creates an instance of the ServerSecurityAlertPoliciesClient client. -func NewServerSecurityAlertPoliciesClient(subscriptionID string) ServerSecurityAlertPoliciesClient { - return NewServerSecurityAlertPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerSecurityAlertPoliciesClientWithBaseURI creates an instance of the ServerSecurityAlertPoliciesClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewServerSecurityAlertPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServerSecurityAlertPoliciesClient { - return ServerSecurityAlertPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a threat detection policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the server security alert policy. -func (client ServerSecurityAlertPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerSecurityAlertPolicy) (result ServerSecurityAlertPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.ServerSecurityAlertPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServerSecurityAlertPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServerSecurityAlertPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerSecurityAlertPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerSecurityAlertPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "Default"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServerSecurityAlertPoliciesClient) CreateOrUpdateSender(req *http.Request) (future ServerSecurityAlertPoliciesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServerSecurityAlertPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a server's security alert policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServerSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPoliciesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.ServerSecurityAlertPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServerSecurityAlertPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.ServerSecurityAlertPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.ServerSecurityAlertPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerSecurityAlertPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "Default"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServerSecurityAlertPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServerSecurityAlertPoliciesClient) GetResponder(resp *http.Response) (result ServerSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/topquerystatistics.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/topquerystatistics.go deleted file mode 100644 index 01fbea398d8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/topquerystatistics.go +++ /dev/null @@ -1,263 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// TopQueryStatisticsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type TopQueryStatisticsClient struct { - BaseClient -} - -// NewTopQueryStatisticsClient creates an instance of the TopQueryStatisticsClient client. -func NewTopQueryStatisticsClient(subscriptionID string) TopQueryStatisticsClient { - return NewTopQueryStatisticsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopQueryStatisticsClientWithBaseURI creates an instance of the TopQueryStatisticsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewTopQueryStatisticsClientWithBaseURI(baseURI string, subscriptionID string) TopQueryStatisticsClient { - return TopQueryStatisticsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve the query statistic for specified identifier. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// queryStatisticID - the Query Statistic identifier. -func (client TopQueryStatisticsClient) Get(ctx context.Context, resourceGroupName string, serverName string, queryStatisticID string) (result QueryStatistic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.TopQueryStatisticsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, queryStatisticID) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.TopQueryStatisticsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.TopQueryStatisticsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.TopQueryStatisticsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopQueryStatisticsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, queryStatisticID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "queryStatisticId": autorest.Encode("path", queryStatisticID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/topQueryStatistics/{queryStatisticId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TopQueryStatisticsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TopQueryStatisticsClient) GetResponder(resp *http.Response) (result QueryStatistic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer retrieve the Query-Store top queries for specified metric and aggregation. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the required parameters for retrieving top query statistics. -func (client TopQueryStatisticsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, parameters TopQueryStatisticsInput) (result TopQueryStatisticsResultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsClient.ListByServer") - defer func() { - sc := -1 - if result.tqsrl.Response.Response != nil { - sc = result.tqsrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TopQueryStatisticsInputProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.TopQueryStatisticsInputProperties.NumberOfTopQueries", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TopQueryStatisticsInputProperties.AggregationFunction", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TopQueryStatisticsInputProperties.ObservedMetric", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TopQueryStatisticsInputProperties.ObservationStartTime", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TopQueryStatisticsInputProperties.ObservationEndTime", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.TopQueryStatisticsInputProperties.AggregationWindow", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("mariadb.TopQueryStatisticsClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.TopQueryStatisticsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.tqsrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.TopQueryStatisticsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.tqsrl, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.TopQueryStatisticsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.tqsrl.hasNextLink() && result.tqsrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client TopQueryStatisticsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string, parameters TopQueryStatisticsInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/topQueryStatistics", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client TopQueryStatisticsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client TopQueryStatisticsClient) ListByServerResponder(resp *http.Response) (result TopQueryStatisticsResultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client TopQueryStatisticsClient) listByServerNextResults(ctx context.Context, lastResults TopQueryStatisticsResultList) (result TopQueryStatisticsResultList, err error) { - req, err := lastResults.topQueryStatisticsResultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mariadb.TopQueryStatisticsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mariadb.TopQueryStatisticsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.TopQueryStatisticsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client TopQueryStatisticsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, parameters TopQueryStatisticsInput) (result TopQueryStatisticsResultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopQueryStatisticsClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName, parameters) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/version.go deleted file mode 100644 index 6490eb48c93..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package mariadb - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " mariadb/2018-06-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/virtualnetworkrules.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/virtualnetworkrules.go deleted file mode 100644 index aa9dfb2aa1c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/virtualnetworkrules.go +++ /dev/null @@ -1,438 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VirtualNetworkRulesClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type VirtualNetworkRulesClient struct { - BaseClient -} - -// NewVirtualNetworkRulesClient creates an instance of the VirtualNetworkRulesClient client. -func NewVirtualNetworkRulesClient(subscriptionID string) VirtualNetworkRulesClient { - return NewVirtualNetworkRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualNetworkRulesClientWithBaseURI creates an instance of the VirtualNetworkRulesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewVirtualNetworkRulesClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkRulesClient { - return VirtualNetworkRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an existing virtual network rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// virtualNetworkRuleName - the name of the virtual network rule. -// parameters - the requested virtual Network Rule Resource state. -func (client VirtualNetworkRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (result VirtualNetworkRulesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkRuleProperties.VirtualNetworkSubnetID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("mariadb.VirtualNetworkRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualNetworkRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkRulesClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkRulesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualNetworkRulesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the virtual network rule with the given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// virtualNetworkRuleName - the name of the virtual network rule. -func (client VirtualNetworkRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRulesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.VirtualNetworkRulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VirtualNetworkRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkRulesClient) DeleteSender(req *http.Request) (future VirtualNetworkRulesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualNetworkRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a virtual network rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// virtualNetworkRuleName - the name of the virtual network rule. -func (client VirtualNetworkRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.VirtualNetworkRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualNetworkRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualNetworkRulesClient) GetResponder(resp *http.Response) (result VirtualNetworkRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of virtual network rules in a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client VirtualNetworkRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.ListByServer") - defer func() { - sc := -1 - if result.vnrlr.Response.Response != nil { - sc = result.vnrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.VirtualNetworkRulesClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.vnrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.vnrlr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.vnrlr.hasNextLink() && result.vnrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client VirtualNetworkRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB/servers/{serverName}/virtualNetworkRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client VirtualNetworkRulesClient) ListByServerResponder(resp *http.Response) (result VirtualNetworkRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client VirtualNetworkRulesClient) listByServerNextResults(ctx context.Context, lastResults VirtualNetworkRuleListResult) (result VirtualNetworkRuleListResult, err error) { - req, err := lastResults.virtualNetworkRuleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.VirtualNetworkRulesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualNetworkRulesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/waitstatistics.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/waitstatistics.go deleted file mode 100644 index dea80dafff8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb/waitstatistics.go +++ /dev/null @@ -1,259 +0,0 @@ -package mariadb - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WaitStatisticsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and -// configurations with new business model. -type WaitStatisticsClient struct { - BaseClient -} - -// NewWaitStatisticsClient creates an instance of the WaitStatisticsClient client. -func NewWaitStatisticsClient(subscriptionID string) WaitStatisticsClient { - return NewWaitStatisticsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWaitStatisticsClientWithBaseURI creates an instance of the WaitStatisticsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWaitStatisticsClientWithBaseURI(baseURI string, subscriptionID string) WaitStatisticsClient { - return WaitStatisticsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get retrieve wait statistics for specified identifier. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// waitStatisticsID - the Wait Statistic identifier. -func (client WaitStatisticsClient) Get(ctx context.Context, resourceGroupName string, serverName string, waitStatisticsID string) (result WaitStatistic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mariadb.WaitStatisticsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, waitStatisticsID) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.WaitStatisticsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.WaitStatisticsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.WaitStatisticsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WaitStatisticsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, waitStatisticsID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "waitStatisticsId": autorest.Encode("path", waitStatisticsID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/waitStatistics/{waitStatisticsId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WaitStatisticsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WaitStatisticsClient) GetResponder(resp *http.Response) (result WaitStatistic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer retrieve wait statistics for specified aggregation window. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the required parameters for retrieving wait statistics. -func (client WaitStatisticsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string, parameters WaitStatisticsInput) (result WaitStatisticsResultListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsClient.ListByServer") - defer func() { - sc := -1 - if result.wsrl.Response.Response != nil { - sc = result.wsrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.WaitStatisticsInputProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.WaitStatisticsInputProperties.ObservationStartTime", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.WaitStatisticsInputProperties.ObservationEndTime", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.WaitStatisticsInputProperties.AggregationWindow", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("mariadb.WaitStatisticsClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.WaitStatisticsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.wsrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mariadb.WaitStatisticsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.wsrl, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.WaitStatisticsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.wsrl.hasNextLink() && result.wsrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client WaitStatisticsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string, parameters WaitStatisticsInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB/servers/{serverName}/waitStatistics", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client WaitStatisticsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client WaitStatisticsClient) ListByServerResponder(resp *http.Response) (result WaitStatisticsResultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client WaitStatisticsClient) listByServerNextResults(ctx context.Context, lastResults WaitStatisticsResultList) (result WaitStatisticsResultList, err error) { - req, err := lastResults.waitStatisticsResultListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mariadb.WaitStatisticsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mariadb.WaitStatisticsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mariadb.WaitStatisticsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client WaitStatisticsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string, parameters WaitStatisticsInput) (result WaitStatisticsResultListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WaitStatisticsClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName, parameters) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/_meta.json deleted file mode 100644 index 63be1242809..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "0b17e6a5e811fd7b122d383b4942441d95e5e8cf", - "readme": "/_/azure-rest-api-specs/specification/mixedreality/resource-manager/readme.md", - "tag": "package-2021-01", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/mixedreality/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/client.go deleted file mode 100644 index 0add6ec7d2e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/client.go +++ /dev/null @@ -1,134 +0,0 @@ -// Package mixedreality implements the Azure ARM Mixedreality service API version 2021-01-01. -// -// Mixed Reality Client -package mixedreality - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -const ( - // DefaultBaseURI is the default URI used for the service Mixedreality - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Mixedreality. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} - -// CheckNameAvailabilityLocal check Name Availability for local uniqueness -// Parameters: -// location - the location in which uniqueness will be verified. -// checkNameAvailability - check Name Availability Request. -func (client BaseClient) CheckNameAvailabilityLocal(ctx context.Context, location string, checkNameAvailability CheckNameAvailabilityRequest) (result CheckNameAvailabilityResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckNameAvailabilityLocal") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: location, - Constraints: []validation.Constraint{{Target: "location", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "location", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "location", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: checkNameAvailability, - Constraints: []validation.Constraint{{Target: "checkNameAvailability.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "checkNameAvailability.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("mixedreality.BaseClient", "CheckNameAvailabilityLocal", err.Error()) - } - - req, err := client.CheckNameAvailabilityLocalPreparer(ctx, location, checkNameAvailability) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.BaseClient", "CheckNameAvailabilityLocal", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilityLocalSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.BaseClient", "CheckNameAvailabilityLocal", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityLocalResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.BaseClient", "CheckNameAvailabilityLocal", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityLocalPreparer prepares the CheckNameAvailabilityLocal request. -func (client BaseClient) CheckNameAvailabilityLocalPreparer(ctx context.Context, location string, checkNameAvailability CheckNameAvailabilityRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/locations/{location}/checkNameAvailability", pathParameters), - autorest.WithJSON(checkNameAvailability), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilityLocalSender sends the CheckNameAvailabilityLocal request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) CheckNameAvailabilityLocalSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityLocalResponder handles the response to the CheckNameAvailabilityLocal request. The method always -// closes the http.Response Body. -func (client BaseClient) CheckNameAvailabilityLocalResponder(resp *http.Response) (result CheckNameAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/enums.go deleted file mode 100644 index 78c8ae2e216..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/enums.go +++ /dev/null @@ -1,73 +0,0 @@ -package mixedreality - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // Application ... - Application CreatedByType = "Application" - // Key ... - Key CreatedByType = "Key" - // ManagedIdentity ... - ManagedIdentity CreatedByType = "ManagedIdentity" - // User ... - User CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{Application, Key, ManagedIdentity, User} -} - -// NameUnavailableReason enumerates the values for name unavailable reason. -type NameUnavailableReason string - -const ( - // AlreadyExists ... - AlreadyExists NameUnavailableReason = "AlreadyExists" - // Invalid ... - Invalid NameUnavailableReason = "Invalid" -) - -// PossibleNameUnavailableReasonValues returns an array of possible values for the NameUnavailableReason const type. -func PossibleNameUnavailableReasonValues() []NameUnavailableReason { - return []NameUnavailableReason{AlreadyExists, Invalid} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // SystemAssigned ... - SystemAssigned ResourceIdentityType = "SystemAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{SystemAssigned} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // Basic ... - Basic SkuTier = "Basic" - // Free ... - Free SkuTier = "Free" - // Premium ... - Premium SkuTier = "Premium" - // Standard ... - Standard SkuTier = "Standard" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{Basic, Free, Premium, Standard} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/models.go deleted file mode 100644 index 40ce7a3cae9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/models.go +++ /dev/null @@ -1,1238 +0,0 @@ -package mixedreality - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality" - -// AccountKeyRegenerateRequest request for account key regeneration -type AccountKeyRegenerateRequest struct { - // Serial - serial of key to be regenerated - Serial *int32 `json:"serial,omitempty"` -} - -// AccountKeys developer Keys of account -type AccountKeys struct { - autorest.Response `json:"-"` - // PrimaryKey - READ-ONLY; value of primary key. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - READ-ONLY; value of secondary key. - SecondaryKey *string `json:"secondaryKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountKeys. -func (ak AccountKeys) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AccountProperties common Properties shared by Mixed Reality Accounts -type AccountProperties struct { - // StorageAccountName - The name of the storage account associated with this accountId - StorageAccountName *string `json:"storageAccountName,omitempty"` - // AccountID - READ-ONLY; unique id of certain account. - AccountID *string `json:"accountId,omitempty"` - // AccountDomain - READ-ONLY; Correspond domain name of certain Spatial Anchors Account - AccountDomain *string `json:"accountDomain,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountProperties. -func (ap AccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.StorageAccountName != nil { - objectMap["storageAccountName"] = ap.StorageAccountName - } - return json.Marshal(objectMap) -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CheckNameAvailabilityRequest check Name Availability Request -type CheckNameAvailabilityRequest struct { - // Name - Resource Name To Verify - Name *string `json:"name,omitempty"` - // Type - Fully qualified resource type which includes provider namespace - Type *string `json:"type,omitempty"` -} - -// CheckNameAvailabilityResponse check Name Availability Response -type CheckNameAvailabilityResponse struct { - autorest.Response `json:"-"` - // NameAvailable - if name Available - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - Resource Name To Verify. Possible values include: 'Invalid', 'AlreadyExists' - Reason NameUnavailableReason `json:"reason,omitempty"` - // Message - detail message - Message *string `json:"message,omitempty"` -} - -// CloudError an Error response. -type CloudError struct { - // Error - An Error response. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from Azure. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for displaying in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// Identity identity for the resource. -type Identity struct { - // PrincipalID - READ-ONLY; The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - The identity type. Possible values include: 'SystemAssigned' - Type ResourceIdentityType `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if i.Type != "" { - objectMap["type"] = i.Type - } - return json.Marshal(objectMap) -} - -// LogSpecification specifications of the Log for Azure Monitoring -type LogSpecification struct { - // Name - Name of the log - Name *string `json:"name,omitempty"` - // DisplayName - Localized friendly display name of the log - DisplayName *string `json:"displayName,omitempty"` - // BlobDuration - Blob duration of the log - BlobDuration *string `json:"blobDuration,omitempty"` -} - -// MetricDimension specifications of the Dimension of metrics -type MetricDimension struct { - // Name - Name of the dimension - Name *string `json:"name,omitempty"` - // DisplayName - Localized friendly display name of the dimension - DisplayName *string `json:"displayName,omitempty"` - // InternalName - Internal name of the dimension. - InternalName *string `json:"internalName,omitempty"` -} - -// MetricSpecification specifications of the Metrics for Azure Monitoring -type MetricSpecification struct { - // Name - Name of the metric - Name *string `json:"name,omitempty"` - // DisplayName - Localized friendly display name of the metric - DisplayName *string `json:"displayName,omitempty"` - // DisplayDescription - Localized friendly description of the metric - DisplayDescription *string `json:"displayDescription,omitempty"` - // Unit - Unit that makes sense for the metric - Unit *string `json:"unit,omitempty"` - // AggregationType - Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. - AggregationType *string `json:"aggregationType,omitempty"` - // InternalMetricName - Internal metric name. - InternalMetricName *string `json:"internalMetricName,omitempty"` - // Dimensions - Dimensions of the metric - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` -} - -// Operation REST API operation -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - The object that represents the operation. - Display *OperationDisplay `json:"display,omitempty"` - // IsDataAction - Whether or not this is a data plane operation - IsDataAction *bool `json:"isDataAction,omitempty"` - // Origin - The origin - Origin *string `json:"origin,omitempty"` - // Properties - Properties of the operation - Properties *OperationProperties `json:"properties,omitempty"` -} - -// OperationDisplay the object that represents the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.ResourceProvider - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: Profile, endpoint, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - Description of operation - Description *string `json:"description,omitempty"` -} - -// OperationPage result of the request to list Resource Provider operations. It contains a list of -// operations and a URL link to get the next set of results. -type OperationPage struct { - autorest.Response `json:"-"` - // Value - List of operations supported by the Resource Provider. - Value *[]Operation `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationPageIterator provides access to a complete listing of Operation values. -type OperationPageIterator struct { - i int - page OperationPagePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationPageIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationPageIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationPageIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationPageIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationPageIterator) Response() OperationPage { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationPageIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationPageIterator type. -func NewOperationPageIterator(page OperationPagePage) OperationPageIterator { - return OperationPageIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (op OperationPage) IsEmpty() bool { - return op.Value == nil || len(*op.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (op OperationPage) hasNextLink() bool { - return op.NextLink != nil && len(*op.NextLink) != 0 -} - -// operationPagePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (op OperationPage) operationPagePreparer(ctx context.Context) (*http.Request, error) { - if !op.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(op.NextLink))) -} - -// OperationPagePage contains a page of Operation values. -type OperationPagePage struct { - fn func(context.Context, OperationPage) (OperationPage, error) - op OperationPage -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationPagePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationPagePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.op) - if err != nil { - return err - } - page.op = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationPagePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationPagePage) NotDone() bool { - return !page.op.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationPagePage) Response() OperationPage { - return page.op -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationPagePage) Values() []Operation { - if page.op.IsEmpty() { - return nil - } - return *page.op.Value -} - -// Creates a new instance of the OperationPagePage type. -func NewOperationPagePage(cur OperationPage, getNextPage func(context.Context, OperationPage) (OperationPage, error)) OperationPagePage { - return OperationPagePage{ - fn: getNextPage, - op: cur, - } -} - -// OperationProperties operation properties. -type OperationProperties struct { - // ServiceSpecification - Service specification. - ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// Plan plan for the resource. -type Plan struct { - // Name - A user defined name of the 3rd Party Artifact that is being procured. - Name *string `json:"name,omitempty"` - // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic - Publisher *string `json:"publisher,omitempty"` - // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. - Product *string `json:"product,omitempty"` - // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. - PromotionCode *string `json:"promotionCode,omitempty"` - // Version - The version of the desired product/artifact. - Version *string `json:"version,omitempty"` -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RemoteRenderingAccount remoteRenderingAccount Response. -type RemoteRenderingAccount struct { - autorest.Response `json:"-"` - // AccountProperties - Property bag. - *AccountProperties `json:"properties,omitempty"` - // Identity - The identity associated with this account - Identity *Identity `json:"identity,omitempty"` - // Plan - The plan associated with this account - Plan *Identity `json:"plan,omitempty"` - // Sku - The sku associated with this account - Sku *Sku `json:"sku,omitempty"` - // Kind - The kind of account, if supported - Kind *Sku `json:"kind,omitempty"` - // SystemData - System metadata for this account - SystemData *SystemData `json:"systemData,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RemoteRenderingAccount. -func (rra RemoteRenderingAccount) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rra.AccountProperties != nil { - objectMap["properties"] = rra.AccountProperties - } - if rra.Identity != nil { - objectMap["identity"] = rra.Identity - } - if rra.Plan != nil { - objectMap["plan"] = rra.Plan - } - if rra.Sku != nil { - objectMap["sku"] = rra.Sku - } - if rra.Kind != nil { - objectMap["kind"] = rra.Kind - } - if rra.SystemData != nil { - objectMap["systemData"] = rra.SystemData - } - if rra.Tags != nil { - objectMap["tags"] = rra.Tags - } - if rra.Location != nil { - objectMap["location"] = rra.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RemoteRenderingAccount struct. -func (rra *RemoteRenderingAccount) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var accountProperties AccountProperties - err = json.Unmarshal(*v, &accountProperties) - if err != nil { - return err - } - rra.AccountProperties = &accountProperties - } - case "identity": - if v != nil { - var identity Identity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - rra.Identity = &identity - } - case "plan": - if v != nil { - var plan Identity - err = json.Unmarshal(*v, &plan) - if err != nil { - return err - } - rra.Plan = &plan - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - rra.Sku = &sku - } - case "kind": - if v != nil { - var kind Sku - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - rra.Kind = &kind - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - rra.SystemData = &systemData - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rra.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rra.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rra.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rra.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rra.Type = &typeVar - } - } - } - - return nil -} - -// RemoteRenderingAccountPage result of the request to get resource collection. It contains a list of -// resources and a URL link to get the next set of results. -type RemoteRenderingAccountPage struct { - autorest.Response `json:"-"` - // Value - List of resources supported by the Resource Provider. - Value *[]RemoteRenderingAccount `json:"value,omitempty"` - // NextLink - URL to get the next set of resource list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// RemoteRenderingAccountPageIterator provides access to a complete listing of RemoteRenderingAccount -// values. -type RemoteRenderingAccountPageIterator struct { - i int - page RemoteRenderingAccountPagePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RemoteRenderingAccountPageIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemoteRenderingAccountPageIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RemoteRenderingAccountPageIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RemoteRenderingAccountPageIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RemoteRenderingAccountPageIterator) Response() RemoteRenderingAccountPage { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RemoteRenderingAccountPageIterator) Value() RemoteRenderingAccount { - if !iter.page.NotDone() { - return RemoteRenderingAccount{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RemoteRenderingAccountPageIterator type. -func NewRemoteRenderingAccountPageIterator(page RemoteRenderingAccountPagePage) RemoteRenderingAccountPageIterator { - return RemoteRenderingAccountPageIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rrap RemoteRenderingAccountPage) IsEmpty() bool { - return rrap.Value == nil || len(*rrap.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rrap RemoteRenderingAccountPage) hasNextLink() bool { - return rrap.NextLink != nil && len(*rrap.NextLink) != 0 -} - -// remoteRenderingAccountPagePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rrap RemoteRenderingAccountPage) remoteRenderingAccountPagePreparer(ctx context.Context) (*http.Request, error) { - if !rrap.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rrap.NextLink))) -} - -// RemoteRenderingAccountPagePage contains a page of RemoteRenderingAccount values. -type RemoteRenderingAccountPagePage struct { - fn func(context.Context, RemoteRenderingAccountPage) (RemoteRenderingAccountPage, error) - rrap RemoteRenderingAccountPage -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RemoteRenderingAccountPagePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemoteRenderingAccountPagePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rrap) - if err != nil { - return err - } - page.rrap = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RemoteRenderingAccountPagePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RemoteRenderingAccountPagePage) NotDone() bool { - return !page.rrap.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RemoteRenderingAccountPagePage) Response() RemoteRenderingAccountPage { - return page.rrap -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RemoteRenderingAccountPagePage) Values() []RemoteRenderingAccount { - if page.rrap.IsEmpty() { - return nil - } - return *page.rrap.Value -} - -// Creates a new instance of the RemoteRenderingAccountPagePage type. -func NewRemoteRenderingAccountPagePage(cur RemoteRenderingAccountPage, getNextPage func(context.Context, RemoteRenderingAccountPage) (RemoteRenderingAccountPage, error)) RemoteRenderingAccountPagePage { - return RemoteRenderingAccountPagePage{ - fn: getNextPage, - rrap: cur, - } -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed -// properties for a resource. Except properties bag, there cannot be a top level property outside of this -// set. -type ResourceModelWithAllowedPropertySet struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. - ManagedBy *string `json:"managedBy,omitempty"` - // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` - Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. -func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rmwaps.Location != nil { - objectMap["location"] = rmwaps.Location - } - if rmwaps.ManagedBy != nil { - objectMap["managedBy"] = rmwaps.ManagedBy - } - if rmwaps.Kind != nil { - objectMap["kind"] = rmwaps.Kind - } - if rmwaps.Tags != nil { - objectMap["tags"] = rmwaps.Tags - } - if rmwaps.Identity != nil { - objectMap["identity"] = rmwaps.Identity - } - if rmwaps.Sku != nil { - objectMap["sku"] = rmwaps.Sku - } - if rmwaps.Plan != nil { - objectMap["plan"] = rmwaps.Plan - } - return json.Marshal(objectMap) -} - -// ResourceModelWithAllowedPropertySetIdentity ... -type ResourceModelWithAllowedPropertySetIdentity struct { - // PrincipalID - READ-ONLY; The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - The identity type. Possible values include: 'SystemAssigned' - Type ResourceIdentityType `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity. -func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rmwaps.Type != "" { - objectMap["type"] = rmwaps.Type - } - return json.Marshal(objectMap) -} - -// ResourceModelWithAllowedPropertySetPlan ... -type ResourceModelWithAllowedPropertySetPlan struct { - // Name - A user defined name of the 3rd Party Artifact that is being procured. - Name *string `json:"name,omitempty"` - // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic - Publisher *string `json:"publisher,omitempty"` - // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. - Product *string `json:"product,omitempty"` - // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. - PromotionCode *string `json:"promotionCode,omitempty"` - // Version - The version of the desired product/artifact. - Version *string `json:"version,omitempty"` -} - -// ResourceModelWithAllowedPropertySetSku ... -type ResourceModelWithAllowedPropertySetSku struct { - // Name - The name of the SKU. Ex - P3. It is typically a letter+number code - Name *string `json:"name,omitempty"` - // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' - Tier SkuTier `json:"tier,omitempty"` - // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. - Size *string `json:"size,omitempty"` - // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. - Family *string `json:"family,omitempty"` - // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. - Capacity *int32 `json:"capacity,omitempty"` -} - -// ServiceSpecification service specification payload -type ServiceSpecification struct { - // LogSpecifications - Specifications of the Log for Azure Monitoring - LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` - // MetricSpecifications - Specifications of the Metrics for Azure Monitoring - MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` -} - -// Sku the resource model definition representing SKU -type Sku struct { - // Name - The name of the SKU. Ex - P3. It is typically a letter+number code - Name *string `json:"name,omitempty"` - // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' - Tier SkuTier `json:"tier,omitempty"` - // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. - Size *string `json:"size,omitempty"` - // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. - Family *string `json:"family,omitempty"` - // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. - Capacity *int32 `json:"capacity,omitempty"` -} - -// SpatialAnchorsAccount spatialAnchorsAccount Response. -type SpatialAnchorsAccount struct { - autorest.Response `json:"-"` - // AccountProperties - Property bag. - *AccountProperties `json:"properties,omitempty"` - // Identity - The identity associated with this account - Identity *Identity `json:"identity,omitempty"` - // Plan - The plan associated with this account - Plan *Identity `json:"plan,omitempty"` - // Sku - The sku associated with this account - Sku *Sku `json:"sku,omitempty"` - // Kind - The kind of account, if supported - Kind *Sku `json:"kind,omitempty"` - // SystemData - System metadata for this account - SystemData *SystemData `json:"systemData,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SpatialAnchorsAccount. -func (saa SpatialAnchorsAccount) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if saa.AccountProperties != nil { - objectMap["properties"] = saa.AccountProperties - } - if saa.Identity != nil { - objectMap["identity"] = saa.Identity - } - if saa.Plan != nil { - objectMap["plan"] = saa.Plan - } - if saa.Sku != nil { - objectMap["sku"] = saa.Sku - } - if saa.Kind != nil { - objectMap["kind"] = saa.Kind - } - if saa.SystemData != nil { - objectMap["systemData"] = saa.SystemData - } - if saa.Tags != nil { - objectMap["tags"] = saa.Tags - } - if saa.Location != nil { - objectMap["location"] = saa.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SpatialAnchorsAccount struct. -func (saa *SpatialAnchorsAccount) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var accountProperties AccountProperties - err = json.Unmarshal(*v, &accountProperties) - if err != nil { - return err - } - saa.AccountProperties = &accountProperties - } - case "identity": - if v != nil { - var identity Identity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - saa.Identity = &identity - } - case "plan": - if v != nil { - var plan Identity - err = json.Unmarshal(*v, &plan) - if err != nil { - return err - } - saa.Plan = &plan - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - saa.Sku = &sku - } - case "kind": - if v != nil { - var kind Sku - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - saa.Kind = &kind - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - saa.SystemData = &systemData - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - saa.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - saa.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - saa.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - saa.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - saa.Type = &typeVar - } - } - } - - return nil -} - -// SpatialAnchorsAccountPage result of the request to get resource collection. It contains a list of -// resources and a URL link to get the next set of results. -type SpatialAnchorsAccountPage struct { - autorest.Response `json:"-"` - // Value - List of resources supported by the Resource Provider. - Value *[]SpatialAnchorsAccount `json:"value,omitempty"` - // NextLink - URL to get the next set of resource list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// SpatialAnchorsAccountPageIterator provides access to a complete listing of SpatialAnchorsAccount values. -type SpatialAnchorsAccountPageIterator struct { - i int - page SpatialAnchorsAccountPagePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SpatialAnchorsAccountPageIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SpatialAnchorsAccountPageIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SpatialAnchorsAccountPageIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SpatialAnchorsAccountPageIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SpatialAnchorsAccountPageIterator) Response() SpatialAnchorsAccountPage { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SpatialAnchorsAccountPageIterator) Value() SpatialAnchorsAccount { - if !iter.page.NotDone() { - return SpatialAnchorsAccount{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SpatialAnchorsAccountPageIterator type. -func NewSpatialAnchorsAccountPageIterator(page SpatialAnchorsAccountPagePage) SpatialAnchorsAccountPageIterator { - return SpatialAnchorsAccountPageIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (saap SpatialAnchorsAccountPage) IsEmpty() bool { - return saap.Value == nil || len(*saap.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (saap SpatialAnchorsAccountPage) hasNextLink() bool { - return saap.NextLink != nil && len(*saap.NextLink) != 0 -} - -// spatialAnchorsAccountPagePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (saap SpatialAnchorsAccountPage) spatialAnchorsAccountPagePreparer(ctx context.Context) (*http.Request, error) { - if !saap.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(saap.NextLink))) -} - -// SpatialAnchorsAccountPagePage contains a page of SpatialAnchorsAccount values. -type SpatialAnchorsAccountPagePage struct { - fn func(context.Context, SpatialAnchorsAccountPage) (SpatialAnchorsAccountPage, error) - saap SpatialAnchorsAccountPage -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SpatialAnchorsAccountPagePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SpatialAnchorsAccountPagePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.saap) - if err != nil { - return err - } - page.saap = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SpatialAnchorsAccountPagePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SpatialAnchorsAccountPagePage) NotDone() bool { - return !page.saap.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SpatialAnchorsAccountPagePage) Response() SpatialAnchorsAccountPage { - return page.saap -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SpatialAnchorsAccountPagePage) Values() []SpatialAnchorsAccount { - if page.saap.IsEmpty() { - return nil - } - return *page.saap.Value -} - -// Creates a new instance of the SpatialAnchorsAccountPagePage type. -func NewSpatialAnchorsAccountPagePage(cur SpatialAnchorsAccountPage, getNextPage func(context.Context, SpatialAnchorsAccountPage) (SpatialAnchorsAccountPage, error)) SpatialAnchorsAccountPagePage { - return SpatialAnchorsAccountPagePage{ - fn: getNextPage, - saap: cur, - } -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The type of identity that last modified the resource. - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/operations.go deleted file mode 100644 index 6ccc2a97150..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package mixedreality - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the mixed Reality Client -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List exposing Available Operations -func (client OperationsClient) List(ctx context.Context) (result OperationPagePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.op.Response.Response != nil { - sc = result.op.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.op.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.op, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.op.hasNextLink() && result.op.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.MixedReality/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationPage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationPage) (result OperationPage, err error) { - req, err := lastResults.operationPagePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mixedreality.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mixedreality.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationPageIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/remoterenderingaccounts.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/remoterenderingaccounts.go deleted file mode 100644 index 4166384209c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/remoterenderingaccounts.go +++ /dev/null @@ -1,811 +0,0 @@ -package mixedreality - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RemoteRenderingAccountsClient is the mixed Reality Client -type RemoteRenderingAccountsClient struct { - BaseClient -} - -// NewRemoteRenderingAccountsClient creates an instance of the RemoteRenderingAccountsClient client. -func NewRemoteRenderingAccountsClient(subscriptionID string) RemoteRenderingAccountsClient { - return NewRemoteRenderingAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRemoteRenderingAccountsClientWithBaseURI creates an instance of the RemoteRenderingAccountsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewRemoteRenderingAccountsClientWithBaseURI(baseURI string, subscriptionID string) RemoteRenderingAccountsClient { - return RemoteRenderingAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creating or Updating a Remote Rendering Account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - name of an Mixed Reality Account. -// remoteRenderingAccount - remote Rendering Account parameter. -func (client RemoteRenderingAccountsClient) Create(ctx context.Context, resourceGroupName string, accountName string, remoteRenderingAccount RemoteRenderingAccount) (result RemoteRenderingAccount, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemoteRenderingAccountsClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: remoteRenderingAccount, - Constraints: []validation.Constraint{{Target: "remoteRenderingAccount.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "remoteRenderingAccount.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "remoteRenderingAccount.Kind", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "remoteRenderingAccount.Kind.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("mixedreality.RemoteRenderingAccountsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, remoteRenderingAccount) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client RemoteRenderingAccountsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, remoteRenderingAccount RemoteRenderingAccount) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}", pathParameters), - autorest.WithJSON(remoteRenderingAccount), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client RemoteRenderingAccountsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client RemoteRenderingAccountsClient) CreateResponder(resp *http.Response) (result RemoteRenderingAccount, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Remote Rendering Account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - name of an Mixed Reality Account. -func (client RemoteRenderingAccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemoteRenderingAccountsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mixedreality.RemoteRenderingAccountsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RemoteRenderingAccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RemoteRenderingAccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RemoteRenderingAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve a Remote Rendering Account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - name of an Mixed Reality Account. -func (client RemoteRenderingAccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result RemoteRenderingAccount, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemoteRenderingAccountsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mixedreality.RemoteRenderingAccountsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RemoteRenderingAccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RemoteRenderingAccountsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RemoteRenderingAccountsClient) GetResponder(resp *http.Response) (result RemoteRenderingAccount, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list Resources by Resource Group -// Parameters: -// resourceGroupName - name of an Azure resource group. -func (client RemoteRenderingAccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result RemoteRenderingAccountPagePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemoteRenderingAccountsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.rrap.Response.Response != nil { - sc = result.rrap.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mixedreality.RemoteRenderingAccountsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.rrap.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.rrap, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.rrap.hasNextLink() && result.rrap.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client RemoteRenderingAccountsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RemoteRenderingAccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client RemoteRenderingAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result RemoteRenderingAccountPage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client RemoteRenderingAccountsClient) listByResourceGroupNextResults(ctx context.Context, lastResults RemoteRenderingAccountPage) (result RemoteRenderingAccountPage, err error) { - req, err := lastResults.remoteRenderingAccountPagePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client RemoteRenderingAccountsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result RemoteRenderingAccountPageIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemoteRenderingAccountsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription list Remote Rendering Accounts by Subscription -func (client RemoteRenderingAccountsClient) ListBySubscription(ctx context.Context) (result RemoteRenderingAccountPagePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemoteRenderingAccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.rrap.Response.Response != nil { - sc = result.rrap.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.rrap.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.rrap, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.rrap.hasNextLink() && result.rrap.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client RemoteRenderingAccountsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/remoteRenderingAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client RemoteRenderingAccountsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client RemoteRenderingAccountsClient) ListBySubscriptionResponder(resp *http.Response) (result RemoteRenderingAccountPage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client RemoteRenderingAccountsClient) listBySubscriptionNextResults(ctx context.Context, lastResults RemoteRenderingAccountPage) (result RemoteRenderingAccountPage, err error) { - req, err := lastResults.remoteRenderingAccountPagePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client RemoteRenderingAccountsClient) ListBySubscriptionComplete(ctx context.Context) (result RemoteRenderingAccountPageIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemoteRenderingAccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// ListKeys list Both of the 2 Keys of a Remote Rendering Account -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - name of an Mixed Reality Account. -func (client RemoteRenderingAccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result AccountKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemoteRenderingAccountsClient.ListKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mixedreality.RemoteRenderingAccountsClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client RemoteRenderingAccountsClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client RemoteRenderingAccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client RemoteRenderingAccountsClient) ListKeysResponder(resp *http.Response) (result AccountKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerate specified Key of a Remote Rendering Account -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - name of an Mixed Reality Account. -// regenerate - required information for key regeneration. -func (client RemoteRenderingAccountsClient) RegenerateKeys(ctx context.Context, resourceGroupName string, accountName string, regenerate AccountKeyRegenerateRequest) (result AccountKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemoteRenderingAccountsClient.RegenerateKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mixedreality.RemoteRenderingAccountsClient", "RegenerateKeys", err.Error()) - } - - req, err := client.RegenerateKeysPreparer(ctx, resourceGroupName, accountName, regenerate) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "RegenerateKeys", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client RemoteRenderingAccountsClient) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, accountName string, regenerate AccountKeyRegenerateRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}/regenerateKeys", pathParameters), - autorest.WithJSON(regenerate), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client RemoteRenderingAccountsClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client RemoteRenderingAccountsClient) RegenerateKeysResponder(resp *http.Response) (result AccountKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updating a Remote Rendering Account -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - name of an Mixed Reality Account. -// remoteRenderingAccount - remote Rendering Account parameter. -func (client RemoteRenderingAccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, remoteRenderingAccount RemoteRenderingAccount) (result RemoteRenderingAccount, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemoteRenderingAccountsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mixedreality.RemoteRenderingAccountsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, remoteRenderingAccount) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.RemoteRenderingAccountsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client RemoteRenderingAccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, remoteRenderingAccount RemoteRenderingAccount) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/remoteRenderingAccounts/{accountName}", pathParameters), - autorest.WithJSON(remoteRenderingAccount), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client RemoteRenderingAccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client RemoteRenderingAccountsClient) UpdateResponder(resp *http.Response) (result RemoteRenderingAccount, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/spatialanchorsaccounts.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/spatialanchorsaccounts.go deleted file mode 100644 index 92c2ce01a57..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/spatialanchorsaccounts.go +++ /dev/null @@ -1,811 +0,0 @@ -package mixedreality - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SpatialAnchorsAccountsClient is the mixed Reality Client -type SpatialAnchorsAccountsClient struct { - BaseClient -} - -// NewSpatialAnchorsAccountsClient creates an instance of the SpatialAnchorsAccountsClient client. -func NewSpatialAnchorsAccountsClient(subscriptionID string) SpatialAnchorsAccountsClient { - return NewSpatialAnchorsAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSpatialAnchorsAccountsClientWithBaseURI creates an instance of the SpatialAnchorsAccountsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewSpatialAnchorsAccountsClientWithBaseURI(baseURI string, subscriptionID string) SpatialAnchorsAccountsClient { - return SpatialAnchorsAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creating or Updating a Spatial Anchors Account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - name of an Mixed Reality Account. -// spatialAnchorsAccount - spatial Anchors Account parameter. -func (client SpatialAnchorsAccountsClient) Create(ctx context.Context, resourceGroupName string, accountName string, spatialAnchorsAccount SpatialAnchorsAccount) (result SpatialAnchorsAccount, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SpatialAnchorsAccountsClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: spatialAnchorsAccount, - Constraints: []validation.Constraint{{Target: "spatialAnchorsAccount.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "spatialAnchorsAccount.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "spatialAnchorsAccount.Kind", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "spatialAnchorsAccount.Kind.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("mixedreality.SpatialAnchorsAccountsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, spatialAnchorsAccount) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SpatialAnchorsAccountsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, spatialAnchorsAccount SpatialAnchorsAccount) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}", pathParameters), - autorest.WithJSON(spatialAnchorsAccount), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client SpatialAnchorsAccountsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client SpatialAnchorsAccountsClient) CreateResponder(resp *http.Response) (result SpatialAnchorsAccount, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Spatial Anchors Account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - name of an Mixed Reality Account. -func (client SpatialAnchorsAccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SpatialAnchorsAccountsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mixedreality.SpatialAnchorsAccountsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SpatialAnchorsAccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SpatialAnchorsAccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SpatialAnchorsAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieve a Spatial Anchors Account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - name of an Mixed Reality Account. -func (client SpatialAnchorsAccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result SpatialAnchorsAccount, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SpatialAnchorsAccountsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mixedreality.SpatialAnchorsAccountsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SpatialAnchorsAccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SpatialAnchorsAccountsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SpatialAnchorsAccountsClient) GetResponder(resp *http.Response) (result SpatialAnchorsAccount, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list Resources by Resource Group -// Parameters: -// resourceGroupName - name of an Azure resource group. -func (client SpatialAnchorsAccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SpatialAnchorsAccountPagePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SpatialAnchorsAccountsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.saap.Response.Response != nil { - sc = result.saap.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mixedreality.SpatialAnchorsAccountsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.saap.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.saap, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.saap.hasNextLink() && result.saap.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client SpatialAnchorsAccountsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client SpatialAnchorsAccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client SpatialAnchorsAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result SpatialAnchorsAccountPage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client SpatialAnchorsAccountsClient) listByResourceGroupNextResults(ctx context.Context, lastResults SpatialAnchorsAccountPage) (result SpatialAnchorsAccountPage, err error) { - req, err := lastResults.spatialAnchorsAccountPagePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client SpatialAnchorsAccountsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SpatialAnchorsAccountPageIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SpatialAnchorsAccountsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription list Spatial Anchors Accounts by Subscription -func (client SpatialAnchorsAccountsClient) ListBySubscription(ctx context.Context) (result SpatialAnchorsAccountPagePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SpatialAnchorsAccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.saap.Response.Response != nil { - sc = result.saap.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.saap.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.saap, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.saap.hasNextLink() && result.saap.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client SpatialAnchorsAccountsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MixedReality/spatialAnchorsAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client SpatialAnchorsAccountsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client SpatialAnchorsAccountsClient) ListBySubscriptionResponder(resp *http.Response) (result SpatialAnchorsAccountPage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client SpatialAnchorsAccountsClient) listBySubscriptionNextResults(ctx context.Context, lastResults SpatialAnchorsAccountPage) (result SpatialAnchorsAccountPage, err error) { - req, err := lastResults.spatialAnchorsAccountPagePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client SpatialAnchorsAccountsClient) ListBySubscriptionComplete(ctx context.Context) (result SpatialAnchorsAccountPageIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SpatialAnchorsAccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// ListKeys list Both of the 2 Keys of a Spatial Anchors Account -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - name of an Mixed Reality Account. -func (client SpatialAnchorsAccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result AccountKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SpatialAnchorsAccountsClient.ListKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mixedreality.SpatialAnchorsAccountsClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client SpatialAnchorsAccountsClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client SpatialAnchorsAccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client SpatialAnchorsAccountsClient) ListKeysResponder(resp *http.Response) (result AccountKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerate specified Key of a Spatial Anchors Account -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - name of an Mixed Reality Account. -// regenerate - required information for key regeneration. -func (client SpatialAnchorsAccountsClient) RegenerateKeys(ctx context.Context, resourceGroupName string, accountName string, regenerate AccountKeyRegenerateRequest) (result AccountKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SpatialAnchorsAccountsClient.RegenerateKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mixedreality.SpatialAnchorsAccountsClient", "RegenerateKeys", err.Error()) - } - - req, err := client.RegenerateKeysPreparer(ctx, resourceGroupName, accountName, regenerate) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "RegenerateKeys", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client SpatialAnchorsAccountsClient) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, accountName string, regenerate AccountKeyRegenerateRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}/regenerateKeys", pathParameters), - autorest.WithJSON(regenerate), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client SpatialAnchorsAccountsClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client SpatialAnchorsAccountsClient) RegenerateKeysResponder(resp *http.Response) (result AccountKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updating a Spatial Anchors Account -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - name of an Mixed Reality Account. -// spatialAnchorsAccount - spatial Anchors Account parameter. -func (client SpatialAnchorsAccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, spatialAnchorsAccount SpatialAnchorsAccount) (result SpatialAnchorsAccount, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SpatialAnchorsAccountsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "accountName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("mixedreality.SpatialAnchorsAccountsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, spatialAnchorsAccount) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "mixedreality.SpatialAnchorsAccountsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SpatialAnchorsAccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, spatialAnchorsAccount SpatialAnchorsAccount) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MixedReality/spatialAnchorsAccounts/{accountName}", pathParameters), - autorest.WithJSON(spatialAnchorsAccount), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SpatialAnchorsAccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SpatialAnchorsAccountsClient) UpdateResponder(resp *http.Response) (result SpatialAnchorsAccount, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/version.go deleted file mode 100644 index 0edbef2b1b7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package mixedreality - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " mixedreality/2021-01-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/_meta.json deleted file mode 100644 index 85e4ce68e84..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "bb9f1204f9a337404ff7e7b73b4c7b4ddde7f8f1", - "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", - "tag": "package-netapp-2021-10-01", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-netapp-2021-10-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/accountbackups.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/accountbackups.go deleted file mode 100644 index 0c1f8bb6327..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/accountbackups.go +++ /dev/null @@ -1,290 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AccountBackupsClient is the microsoft NetApp Files Azure Resource Provider specification -type AccountBackupsClient struct { - BaseClient -} - -// NewAccountBackupsClient creates an instance of the AccountBackupsClient client. -func NewAccountBackupsClient(subscriptionID string) AccountBackupsClient { - return NewAccountBackupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountBackupsClientWithBaseURI creates an instance of the AccountBackupsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAccountBackupsClientWithBaseURI(baseURI string, subscriptionID string) AccountBackupsClient { - return AccountBackupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete delete the specified Backup for a Netapp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// backupName - the name of the backup -func (client AccountBackupsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, backupName string) (result AccountBackupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountBackupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.AccountBackupsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountBackupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupName": autorest.Encode("path", backupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AccountBackupsClient) DeleteSender(req *http.Request) (future AccountBackupsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AccountBackupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified backup for a Netapp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// backupName - the name of the backup -func (client AccountBackupsClient) Get(ctx context.Context, resourceGroupName string, accountName string, backupName string) (result Backup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountBackupsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.AccountBackupsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountBackupsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupName": autorest.Encode("path", backupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AccountBackupsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AccountBackupsClient) GetResponder(resp *http.Response) (result Backup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all Backups for a Netapp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client AccountBackupsClient) List(ctx context.Context, resourceGroupName string, accountName string) (result BackupsList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountBackupsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.AccountBackupsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AccountBackupsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AccountBackupsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AccountBackupsClient) ListResponder(resp *http.Response) (result BackupsList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/accounts.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/accounts.go deleted file mode 100644 index 2e1934acc51..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/accounts.go +++ /dev/null @@ -1,629 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification -type AccountsClient struct { - BaseClient -} - -// NewAccountsClient creates an instance of the AccountsClient client. -func NewAccountsClient(subscriptionID string) AccountsClient { - return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountsClientWithBaseURI creates an instance of the AccountsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { - return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update the specified NetApp account within the resource group -// Parameters: -// body - netApp Account object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client AccountsClient) CreateOrUpdate(ctx context.Context, body Account, resourceGroupName string, accountName string) (result AccountsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.AccountsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, body, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AccountsClient) CreateOrUpdatePreparer(ctx context.Context, body Account, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Etag = nil - body.Type = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) CreateOrUpdateSender(req *http.Request) (future AccountsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AccountsClient) CreateOrUpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the specified NetApp account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client AccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result AccountsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.AccountsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) DeleteSender(req *http.Request) (future AccountsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the NetApp account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client AccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.AccountsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AccountsClient) GetResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list and describe all NetApp accounts in the resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client AccountsClient) List(ctx context.Context, resourceGroupName string) (result AccountListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.List") - defer func() { - sc := -1 - if result.al.Response.Response != nil { - sc = result.al.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.AccountsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.al.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "List", resp, "Failure sending request") - return - } - - result.al, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "List", resp, "Failure responding to request") - return - } - if result.al.hasNextLink() && result.al.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AccountsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListResponder(resp *http.Response) (result AccountList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client AccountsClient) listNextResults(ctx context.Context, lastResults AccountList) (result AccountList, err error) { - req, err := lastResults.accountListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "netapp.AccountsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "netapp.AccountsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountsClient) ListComplete(ctx context.Context, resourceGroupName string) (result AccountListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName) - return -} - -// ListBySubscription list and describe all NetApp accounts in the subscription. -func (client AccountsClient) ListBySubscription(ctx context.Context) (result AccountListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.al.Response.Response != nil { - sc = result.al.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.al.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.al, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.al.hasNextLink() && result.al.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AccountsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListBySubscriptionResponder(resp *http.Response) (result AccountList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client AccountsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AccountList) (result AccountList, err error) { - req, err := lastResults.accountListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "netapp.AccountsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "netapp.AccountsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountsClient) ListBySubscriptionComplete(ctx context.Context) (result AccountListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// Update patch the specified NetApp account -// Parameters: -// body - netApp Account object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client AccountsClient) Update(ctx context.Context, body AccountPatch, resourceGroupName string, accountName string) (result AccountsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.AccountsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AccountsClient) UpdatePreparer(ctx context.Context, body AccountPatch, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) UpdateSender(req *http.Request) (future AccountsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/backuppolicies.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/backuppolicies.go deleted file mode 100644 index 2073c2dd3d4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/backuppolicies.go +++ /dev/null @@ -1,485 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// BackupPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification -type BackupPoliciesClient struct { - BaseClient -} - -// NewBackupPoliciesClient creates an instance of the BackupPoliciesClient client. -func NewBackupPoliciesClient(subscriptionID string) BackupPoliciesClient { - return NewBackupPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupPoliciesClientWithBaseURI creates an instance of the BackupPoliciesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupPoliciesClient { - return BackupPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a backup policy for Netapp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// backupPolicyName - backup policy Name which uniquely identify backup policy. -// body - backup policy object supplied in the body of the operation. -func (client BackupPoliciesClient) Create(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicy) (result BackupPoliciesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.BackupPolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupPoliciesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, backupPolicyName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client BackupPoliciesClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupPolicyName": autorest.Encode("path", backupPolicyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Etag = nil - body.Type = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client BackupPoliciesClient) CreateSender(req *http.Request) (future BackupPoliciesCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client BackupPoliciesClient) CreateResponder(resp *http.Response) (result BackupPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete backup policy -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// backupPolicyName - backup policy Name which uniquely identify backup policy. -func (client BackupPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (result BackupPoliciesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupPoliciesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, backupPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client BackupPoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupPolicyName": autorest.Encode("path", backupPolicyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client BackupPoliciesClient) DeleteSender(req *http.Request) (future BackupPoliciesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client BackupPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a particular backup Policy -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// backupPolicyName - backup policy Name which uniquely identify backup policy. -func (client BackupPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (result BackupPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, backupPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupPolicyName": autorest.Encode("path", backupPolicyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client BackupPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client BackupPoliciesClient) GetResponder(resp *http.Response) (result BackupPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list backup policies for Netapp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client BackupPoliciesClient) List(ctx context.Context, resourceGroupName string, accountName string) (result BackupPoliciesList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupPoliciesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client BackupPoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client BackupPoliciesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client BackupPoliciesClient) ListResponder(resp *http.Response) (result BackupPoliciesList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update patch a backup policy for Netapp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// backupPolicyName - backup policy Name which uniquely identify backup policy. -// body - backup policy object supplied in the body of the operation. -func (client BackupPoliciesClient) Update(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicyPatch) (result BackupPoliciesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupPoliciesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, backupPolicyName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BackupPoliciesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicyPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupPolicyName": autorest.Encode("path", backupPolicyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client BackupPoliciesClient) UpdateSender(req *http.Request) (future BackupPoliciesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client BackupPoliciesClient) UpdateResponder(resp *http.Response) (result BackupPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/backups.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/backups.go deleted file mode 100644 index e430721365d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/backups.go +++ /dev/null @@ -1,741 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// BackupsClient is the microsoft NetApp Files Azure Resource Provider specification -type BackupsClient struct { - BaseClient -} - -// NewBackupsClient creates an instance of the BackupsClient client. -func NewBackupsClient(subscriptionID string) BackupsClient { - return NewBackupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupsClientWithBaseURI creates an instance of the BackupsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewBackupsClientWithBaseURI(baseURI string, subscriptionID string) BackupsClient { - return BackupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a backup for the volume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// backupName - the name of the backup -// body - backup object supplied in the body of the operation. -func (client BackupsClient) Create(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body Backup) (result BackupsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.BackupProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "body.BackupProperties.BackupID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.BackupProperties.BackupID", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "body.BackupProperties.BackupID", Name: validation.MinLength, Rule: 36, Chain: nil}, - {Target: "body.BackupProperties.BackupID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("netapp.BackupsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client BackupsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body Backup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupName": autorest.Encode("path", backupName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client BackupsClient) CreateSender(req *http.Request) (future BackupsCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client BackupsClient) CreateResponder(resp *http.Response) (result Backup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a backup of the volume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// backupName - the name of the backup -func (client BackupsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (result BackupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client BackupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupName": autorest.Encode("path", backupName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client BackupsClient) DeleteSender(req *http.Request) (future BackupsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client BackupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified backup of the volume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// backupName - the name of the backup -func (client BackupsClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (result Backup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupName": autorest.Encode("path", backupName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client BackupsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client BackupsClient) GetResponder(resp *http.Response) (result Backup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetStatus get the status of the backup for a volume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -func (client BackupsClient) GetStatus(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result BackupStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.GetStatus") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupsClient", "GetStatus", err.Error()) - } - - req, err := client.GetStatusPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetStatus", resp, "Failure sending request") - return - } - - result, err = client.GetStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetStatusPreparer prepares the GetStatus request. -func (client BackupsClient) GetStatusPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backupStatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetStatusSender sends the GetStatus request. The method will close the -// http.Response Body if it receives an error. -func (client BackupsClient) GetStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetStatusResponder handles the response to the GetStatus request. The method always -// closes the http.Response Body. -func (client BackupsClient) GetStatusResponder(resp *http.Response) (result BackupStatus, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetVolumeRestoreStatus get the status of the restore for a volume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -func (client BackupsClient) GetVolumeRestoreStatus(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result RestoreStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.GetVolumeRestoreStatus") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupsClient", "GetVolumeRestoreStatus", err.Error()) - } - - req, err := client.GetVolumeRestoreStatusPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetVolumeRestoreStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetVolumeRestoreStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetVolumeRestoreStatus", resp, "Failure sending request") - return - } - - result, err = client.GetVolumeRestoreStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetVolumeRestoreStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetVolumeRestoreStatusPreparer prepares the GetVolumeRestoreStatus request. -func (client BackupsClient) GetVolumeRestoreStatusPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/restoreStatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetVolumeRestoreStatusSender sends the GetVolumeRestoreStatus request. The method will close the -// http.Response Body if it receives an error. -func (client BackupsClient) GetVolumeRestoreStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetVolumeRestoreStatusResponder handles the response to the GetVolumeRestoreStatus request. The method always -// closes the http.Response Body. -func (client BackupsClient) GetVolumeRestoreStatusResponder(resp *http.Response) (result RestoreStatus, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all backups for a volume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -func (client BackupsClient) List(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result BackupsList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client BackupsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client BackupsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client BackupsClient) ListResponder(resp *http.Response) (result BackupsList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update patch a backup for the volume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// backupName - the name of the backup -// body - backup object supplied in the body of the operation. -func (client BackupsClient) Update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body *BackupPatch) (result BackupsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BackupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body *BackupPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupName": autorest.Encode("path", backupName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client BackupsClient) UpdateSender(req *http.Request) (future BackupsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client BackupsClient) UpdateResponder(resp *http.Response) (result Backup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/client.go deleted file mode 100644 index 780c3590d75..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package netapp implements the Azure ARM Netapp service API version 2021-10-01. -// -// Microsoft NetApp Files Azure Resource Provider specification -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Netapp - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Netapp. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/enums.go deleted file mode 100644 index 8fa945a3125..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/enums.go +++ /dev/null @@ -1,346 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ActiveDirectoryStatus enumerates the values for active directory status. -type ActiveDirectoryStatus string - -const ( - // ActiveDirectoryStatusCreated Active Directory created but not in use - ActiveDirectoryStatusCreated ActiveDirectoryStatus = "Created" - // ActiveDirectoryStatusDeleted Active Directory Deleted - ActiveDirectoryStatusDeleted ActiveDirectoryStatus = "Deleted" - // ActiveDirectoryStatusError Error with the Active Directory - ActiveDirectoryStatusError ActiveDirectoryStatus = "Error" - // ActiveDirectoryStatusInUse Active Directory in use by SMB Volume - ActiveDirectoryStatusInUse ActiveDirectoryStatus = "InUse" - // ActiveDirectoryStatusUpdating Active Directory Updating - ActiveDirectoryStatusUpdating ActiveDirectoryStatus = "Updating" -) - -// PossibleActiveDirectoryStatusValues returns an array of possible values for the ActiveDirectoryStatus const type. -func PossibleActiveDirectoryStatusValues() []ActiveDirectoryStatus { - return []ActiveDirectoryStatus{ActiveDirectoryStatusCreated, ActiveDirectoryStatusDeleted, ActiveDirectoryStatusError, ActiveDirectoryStatusInUse, ActiveDirectoryStatusUpdating} -} - -// ApplicationType enumerates the values for application type. -type ApplicationType string - -const ( - // ApplicationTypeSAPHANA ... - ApplicationTypeSAPHANA ApplicationType = "SAP-HANA" -) - -// PossibleApplicationTypeValues returns an array of possible values for the ApplicationType const type. -func PossibleApplicationTypeValues() []ApplicationType { - return []ApplicationType{ApplicationTypeSAPHANA} -} - -// AvsDataStore enumerates the values for avs data store. -type AvsDataStore string - -const ( - // AvsDataStoreDisabled avsDataStore is disabled - AvsDataStoreDisabled AvsDataStore = "Disabled" - // AvsDataStoreEnabled avsDataStore is enabled - AvsDataStoreEnabled AvsDataStore = "Enabled" -) - -// PossibleAvsDataStoreValues returns an array of possible values for the AvsDataStore const type. -func PossibleAvsDataStoreValues() []AvsDataStore { - return []AvsDataStore{AvsDataStoreDisabled, AvsDataStoreEnabled} -} - -// BackupType enumerates the values for backup type. -type BackupType string - -const ( - // BackupTypeManual Manual backup - BackupTypeManual BackupType = "Manual" - // BackupTypeScheduled Scheduled backup - BackupTypeScheduled BackupType = "Scheduled" -) - -// PossibleBackupTypeValues returns an array of possible values for the BackupType const type. -func PossibleBackupTypeValues() []BackupType { - return []BackupType{BackupTypeManual, BackupTypeScheduled} -} - -// CheckNameResourceTypes enumerates the values for check name resource types. -type CheckNameResourceTypes string - -const ( - // CheckNameResourceTypesMicrosoftNetAppnetAppAccounts ... - CheckNameResourceTypesMicrosoftNetAppnetAppAccounts CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts" - // CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools ... - CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" - // CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes ... - CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" - // CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots ... - CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" -) - -// PossibleCheckNameResourceTypesValues returns an array of possible values for the CheckNameResourceTypes const type. -func PossibleCheckNameResourceTypesValues() []CheckNameResourceTypes { - return []CheckNameResourceTypes{CheckNameResourceTypesMicrosoftNetAppnetAppAccounts, CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools, CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes, CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots} -} - -// CheckQuotaNameResourceTypes enumerates the values for check quota name resource types. -type CheckQuotaNameResourceTypes string - -const ( - // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts ... - CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts" - // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools ... - CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" - // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes ... - CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" - // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots ... - CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" -) - -// PossibleCheckQuotaNameResourceTypesValues returns an array of possible values for the CheckQuotaNameResourceTypes const type. -func PossibleCheckQuotaNameResourceTypesValues() []CheckQuotaNameResourceTypes { - return []CheckQuotaNameResourceTypes{CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts, CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools, CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes, CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots} -} - -// ChownMode enumerates the values for chown mode. -type ChownMode string - -const ( - // ChownModeRestricted ... - ChownModeRestricted ChownMode = "Restricted" - // ChownModeUnrestricted ... - ChownModeUnrestricted ChownMode = "Unrestricted" -) - -// PossibleChownModeValues returns an array of possible values for the ChownMode const type. -func PossibleChownModeValues() []ChownMode { - return []ChownMode{ChownModeRestricted, ChownModeUnrestricted} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// EnableSubvolumes enumerates the values for enable subvolumes. -type EnableSubvolumes string - -const ( - // EnableSubvolumesDisabled subvolumes are not enabled - EnableSubvolumesDisabled EnableSubvolumes = "Disabled" - // EnableSubvolumesEnabled subvolumes are enabled - EnableSubvolumesEnabled EnableSubvolumes = "Enabled" -) - -// PossibleEnableSubvolumesValues returns an array of possible values for the EnableSubvolumes const type. -func PossibleEnableSubvolumesValues() []EnableSubvolumes { - return []EnableSubvolumes{EnableSubvolumesDisabled, EnableSubvolumesEnabled} -} - -// EncryptionType enumerates the values for encryption type. -type EncryptionType string - -const ( - // EncryptionTypeDouble EncryptionType Double, volumes will use double encryption at rest - EncryptionTypeDouble EncryptionType = "Double" - // EncryptionTypeSingle EncryptionType Single, volumes will use single encryption at rest - EncryptionTypeSingle EncryptionType = "Single" -) - -// PossibleEncryptionTypeValues returns an array of possible values for the EncryptionType const type. -func PossibleEncryptionTypeValues() []EncryptionType { - return []EncryptionType{EncryptionTypeDouble, EncryptionTypeSingle} -} - -// EndpointType enumerates the values for endpoint type. -type EndpointType string - -const ( - // EndpointTypeDst ... - EndpointTypeDst EndpointType = "dst" - // EndpointTypeSrc ... - EndpointTypeSrc EndpointType = "src" -) - -// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. -func PossibleEndpointTypeValues() []EndpointType { - return []EndpointType{EndpointTypeDst, EndpointTypeSrc} -} - -// InAvailabilityReasonType enumerates the values for in availability reason type. -type InAvailabilityReasonType string - -const ( - // InAvailabilityReasonTypeAlreadyExists ... - InAvailabilityReasonTypeAlreadyExists InAvailabilityReasonType = "AlreadyExists" - // InAvailabilityReasonTypeInvalid ... - InAvailabilityReasonTypeInvalid InAvailabilityReasonType = "Invalid" -) - -// PossibleInAvailabilityReasonTypeValues returns an array of possible values for the InAvailabilityReasonType const type. -func PossibleInAvailabilityReasonTypeValues() []InAvailabilityReasonType { - return []InAvailabilityReasonType{InAvailabilityReasonTypeAlreadyExists, InAvailabilityReasonTypeInvalid} -} - -// MetricAggregationType enumerates the values for metric aggregation type. -type MetricAggregationType string - -const ( - // MetricAggregationTypeAverage ... - MetricAggregationTypeAverage MetricAggregationType = "Average" -) - -// PossibleMetricAggregationTypeValues returns an array of possible values for the MetricAggregationType const type. -func PossibleMetricAggregationTypeValues() []MetricAggregationType { - return []MetricAggregationType{MetricAggregationTypeAverage} -} - -// MirrorState enumerates the values for mirror state. -type MirrorState string - -const ( - // MirrorStateBroken ... - MirrorStateBroken MirrorState = "Broken" - // MirrorStateMirrored ... - MirrorStateMirrored MirrorState = "Mirrored" - // MirrorStateUninitialized ... - MirrorStateUninitialized MirrorState = "Uninitialized" -) - -// PossibleMirrorStateValues returns an array of possible values for the MirrorState const type. -func PossibleMirrorStateValues() []MirrorState { - return []MirrorState{MirrorStateBroken, MirrorStateMirrored, MirrorStateUninitialized} -} - -// NetworkFeatures enumerates the values for network features. -type NetworkFeatures string - -const ( - // NetworkFeaturesBasic Basic network feature. - NetworkFeaturesBasic NetworkFeatures = "Basic" - // NetworkFeaturesStandard Standard network feature. - NetworkFeaturesStandard NetworkFeatures = "Standard" -) - -// PossibleNetworkFeaturesValues returns an array of possible values for the NetworkFeatures const type. -func PossibleNetworkFeaturesValues() []NetworkFeatures { - return []NetworkFeatures{NetworkFeaturesBasic, NetworkFeaturesStandard} -} - -// QosType enumerates the values for qos type. -type QosType string - -const ( - // QosTypeAuto qos type Auto - QosTypeAuto QosType = "Auto" - // QosTypeManual qos type Manual - QosTypeManual QosType = "Manual" -) - -// PossibleQosTypeValues returns an array of possible values for the QosType const type. -func PossibleQosTypeValues() []QosType { - return []QosType{QosTypeAuto, QosTypeManual} -} - -// RelationshipStatus enumerates the values for relationship status. -type RelationshipStatus string - -const ( - // RelationshipStatusIdle ... - RelationshipStatusIdle RelationshipStatus = "Idle" - // RelationshipStatusTransferring ... - RelationshipStatusTransferring RelationshipStatus = "Transferring" -) - -// PossibleRelationshipStatusValues returns an array of possible values for the RelationshipStatus const type. -func PossibleRelationshipStatusValues() []RelationshipStatus { - return []RelationshipStatus{RelationshipStatusIdle, RelationshipStatusTransferring} -} - -// ReplicationSchedule enumerates the values for replication schedule. -type ReplicationSchedule string - -const ( - // ReplicationSchedule10minutely ... - ReplicationSchedule10minutely ReplicationSchedule = "_10minutely" - // ReplicationScheduleDaily ... - ReplicationScheduleDaily ReplicationSchedule = "daily" - // ReplicationScheduleHourly ... - ReplicationScheduleHourly ReplicationSchedule = "hourly" -) - -// PossibleReplicationScheduleValues returns an array of possible values for the ReplicationSchedule const type. -func PossibleReplicationScheduleValues() []ReplicationSchedule { - return []ReplicationSchedule{ReplicationSchedule10minutely, ReplicationScheduleDaily, ReplicationScheduleHourly} -} - -// SecurityStyle enumerates the values for security style. -type SecurityStyle string - -const ( - // SecurityStyleNtfs ... - SecurityStyleNtfs SecurityStyle = "ntfs" - // SecurityStyleUnix ... - SecurityStyleUnix SecurityStyle = "unix" -) - -// PossibleSecurityStyleValues returns an array of possible values for the SecurityStyle const type. -func PossibleSecurityStyleValues() []SecurityStyle { - return []SecurityStyle{SecurityStyleNtfs, SecurityStyleUnix} -} - -// ServiceLevel enumerates the values for service level. -type ServiceLevel string - -const ( - // ServiceLevelPremium Premium service level - ServiceLevelPremium ServiceLevel = "Premium" - // ServiceLevelStandard Standard service level - ServiceLevelStandard ServiceLevel = "Standard" - // ServiceLevelStandardZRS Zone redundant storage service level - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - // ServiceLevelUltra Ultra service level - ServiceLevelUltra ServiceLevel = "Ultra" -) - -// PossibleServiceLevelValues returns an array of possible values for the ServiceLevel const type. -func PossibleServiceLevelValues() []ServiceLevel { - return []ServiceLevel{ServiceLevelPremium, ServiceLevelStandard, ServiceLevelStandardZRS, ServiceLevelUltra} -} - -// VolumeStorageToNetworkProximity enumerates the values for volume storage to network proximity. -type VolumeStorageToNetworkProximity string - -const ( - // VolumeStorageToNetworkProximityDefault Basic storage to network connectivity. - VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" - // VolumeStorageToNetworkProximityT1 Standard T1 storage to network connectivity. - VolumeStorageToNetworkProximityT1 VolumeStorageToNetworkProximity = "T1" - // VolumeStorageToNetworkProximityT2 Standard T2 storage to network connectivity. - VolumeStorageToNetworkProximityT2 VolumeStorageToNetworkProximity = "T2" -) - -// PossibleVolumeStorageToNetworkProximityValues returns an array of possible values for the VolumeStorageToNetworkProximity const type. -func PossibleVolumeStorageToNetworkProximityValues() []VolumeStorageToNetworkProximity { - return []VolumeStorageToNetworkProximity{VolumeStorageToNetworkProximityDefault, VolumeStorageToNetworkProximityT1, VolumeStorageToNetworkProximityT2} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/models.go deleted file mode 100644 index 81c786643da..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/models.go +++ /dev/null @@ -1,5721 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp" - -// Account netApp account resource -type Account struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AccountProperties - NetApp Account properties - *AccountProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Account. -func (a Account) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.Location != nil { - objectMap["location"] = a.Location - } - if a.Tags != nil { - objectMap["tags"] = a.Tags - } - if a.AccountProperties != nil { - objectMap["properties"] = a.AccountProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Account struct. -func (a *Account) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - a.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - a.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - a.Tags = tags - } - case "properties": - if v != nil { - var accountProperties AccountProperties - err = json.Unmarshal(*v, &accountProperties) - if err != nil { - return err - } - a.AccountProperties = &accountProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - a.SystemData = &systemData - } - } - } - - return nil -} - -// AccountBackupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountBackupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountBackupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountBackupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountBackupsDeleteFuture.Result. -func (future *AccountBackupsDeleteFuture) result(client AccountBackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.AccountBackupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AccountEncryption encryption settings -type AccountEncryption struct { - // KeySource - Encryption Key Source. Possible values are: 'Microsoft.NetApp'. - KeySource *string `json:"keySource,omitempty"` -} - -// AccountList list of NetApp account resources -type AccountList struct { - autorest.Response `json:"-"` - // Value - Multiple NetApp accounts - Value *[]Account `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AccountListIterator provides access to a complete listing of Account values. -type AccountListIterator struct { - i int - page AccountListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AccountListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AccountListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AccountListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AccountListIterator) Response() AccountList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AccountListIterator) Value() Account { - if !iter.page.NotDone() { - return Account{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AccountListIterator type. -func NewAccountListIterator(page AccountListPage) AccountListIterator { - return AccountListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (al AccountList) IsEmpty() bool { - return al.Value == nil || len(*al.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (al AccountList) hasNextLink() bool { - return al.NextLink != nil && len(*al.NextLink) != 0 -} - -// accountListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (al AccountList) accountListPreparer(ctx context.Context) (*http.Request, error) { - if !al.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(al.NextLink))) -} - -// AccountListPage contains a page of Account values. -type AccountListPage struct { - fn func(context.Context, AccountList) (AccountList, error) - al AccountList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AccountListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.al) - if err != nil { - return err - } - page.al = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AccountListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AccountListPage) NotDone() bool { - return !page.al.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AccountListPage) Response() AccountList { - return page.al -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AccountListPage) Values() []Account { - if page.al.IsEmpty() { - return nil - } - return *page.al.Value -} - -// Creates a new instance of the AccountListPage type. -func NewAccountListPage(cur AccountList, getNextPage func(context.Context, AccountList) (AccountList, error)) AccountListPage { - return AccountListPage{ - fn: getNextPage, - al: cur, - } -} - -// AccountPatch netApp account patch resource -type AccountPatch struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AccountProperties - NetApp Account properties - *AccountProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountPatch. -func (ap AccountPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.Location != nil { - objectMap["location"] = ap.Location - } - if ap.Tags != nil { - objectMap["tags"] = ap.Tags - } - if ap.AccountProperties != nil { - objectMap["properties"] = ap.AccountProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccountPatch struct. -func (ap *AccountPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ap.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ap.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ap.Tags = tags - } - case "properties": - if v != nil { - var accountProperties AccountProperties - err = json.Unmarshal(*v, &accountProperties) - if err != nil { - return err - } - ap.AccountProperties = &accountProperties - } - } - } - - return nil -} - -// AccountProperties netApp account properties -type AccountProperties struct { - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` - // ActiveDirectories - Active Directories - ActiveDirectories *[]ActiveDirectory `json:"activeDirectories,omitempty"` - // Encryption - Encryption settings - Encryption *AccountEncryption `json:"encryption,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountProperties. -func (ap AccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.ActiveDirectories != nil { - objectMap["activeDirectories"] = ap.ActiveDirectories - } - if ap.Encryption != nil { - objectMap["encryption"] = ap.Encryption - } - return json.Marshal(objectMap) -} - -// AccountsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountsClient) (Account, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountsCreateOrUpdateFuture.Result. -func (future *AccountsCreateOrUpdateFuture) result(client AccountsClient) (a Account, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - a.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.AccountsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { - a, err = client.CreateOrUpdateResponder(a.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request") - } - } - return -} - -// AccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountsDeleteFuture.Result. -func (future *AccountsDeleteFuture) result(client AccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.AccountsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AccountsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountsClient) (Account, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountsUpdateFuture.Result. -func (future *AccountsUpdateFuture) result(client AccountsClient) (a Account, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - a.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.AccountsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { - a, err = client.UpdateResponder(a.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsUpdateFuture", "Result", a.Response.Response, "Failure responding to request") - } - } - return -} - -// ActiveDirectory active Directory -type ActiveDirectory struct { - // ActiveDirectoryID - Id of the Active Directory - ActiveDirectoryID *string `json:"activeDirectoryId,omitempty"` - // Username - Username of Active Directory domain administrator - Username *string `json:"username,omitempty"` - // Password - Plain text password of Active Directory domain administrator, value is masked in the response - Password *string `json:"password,omitempty"` - // Domain - Name of the Active Directory domain - Domain *string `json:"domain,omitempty"` - // DNS - Comma separated list of DNS server IP addresses (IPv4 only) for the Active Directory domain - DNS *string `json:"dns,omitempty"` - // Status - READ-ONLY; Status of the Active Directory. Possible values include: 'ActiveDirectoryStatusCreated', 'ActiveDirectoryStatusInUse', 'ActiveDirectoryStatusDeleted', 'ActiveDirectoryStatusError', 'ActiveDirectoryStatusUpdating' - Status ActiveDirectoryStatus `json:"status,omitempty"` - // StatusDetails - READ-ONLY; Any details in regards to the Status of the Active Directory - StatusDetails *string `json:"statusDetails,omitempty"` - // SmbServerName - NetBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes - SmbServerName *string `json:"smbServerName,omitempty"` - // OrganizationalUnit - The Organizational Unit (OU) within the Windows Active Directory - OrganizationalUnit *string `json:"organizationalUnit,omitempty"` - // Site - The Active Directory site the service will limit Domain Controller discovery to - Site *string `json:"site,omitempty"` - // BackupOperators - Users to be added to the Built-in Backup Operator active directory group. A list of unique usernames without domain specifier - BackupOperators *[]string `json:"backupOperators,omitempty"` - // Administrators - Users to be added to the Built-in Administrators active directory group. A list of unique usernames without domain specifier - Administrators *[]string `json:"administrators,omitempty"` - // KdcIP - kdc server IP addresses for the active directory machine. This optional parameter is used only while creating kerberos volume. - KdcIP *string `json:"kdcIP,omitempty"` - // AdName - Name of the active directory machine. This optional parameter is used only while creating kerberos volume - AdName *string `json:"adName,omitempty"` - // ServerRootCACertificate - When LDAP over SSL/TLS is enabled, the LDAP client is required to have base64 encoded Active Directory Certificate Service's self-signed root CA certificate, this optional parameter is used only for dual protocol with LDAP user-mapping volumes. - ServerRootCACertificate *string `json:"serverRootCACertificate,omitempty"` - // AesEncryption - If enabled, AES encryption will be enabled for SMB communication. - AesEncryption *bool `json:"aesEncryption,omitempty"` - // LdapSigning - Specifies whether or not the LDAP traffic needs to be signed. - LdapSigning *bool `json:"ldapSigning,omitempty"` - // SecurityOperators - Domain Users in the Active directory to be given SeSecurityPrivilege privilege (Needed for SMB Continuously available shares for SQL). A list of unique usernames without domain specifier - SecurityOperators *[]string `json:"securityOperators,omitempty"` - // LdapOverTLS - Specifies whether or not the LDAP traffic needs to be secured via TLS. - LdapOverTLS *bool `json:"ldapOverTLS,omitempty"` - // AllowLocalNfsUsersWithLdap - If enabled, NFS client local users can also (in addition to LDAP users) access the NFS volumes. - AllowLocalNfsUsersWithLdap *bool `json:"allowLocalNfsUsersWithLdap,omitempty"` - // EncryptDCConnections - If enabled, Traffic between the SMB server to Domain Controller (DC) will be encrypted. - EncryptDCConnections *bool `json:"encryptDCConnections,omitempty"` - // LdapSearchScope - LDAP Search scope options - LdapSearchScope *LdapSearchScopeOpt `json:"ldapSearchScope,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActiveDirectory. -func (ad ActiveDirectory) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ad.ActiveDirectoryID != nil { - objectMap["activeDirectoryId"] = ad.ActiveDirectoryID - } - if ad.Username != nil { - objectMap["username"] = ad.Username - } - if ad.Password != nil { - objectMap["password"] = ad.Password - } - if ad.Domain != nil { - objectMap["domain"] = ad.Domain - } - if ad.DNS != nil { - objectMap["dns"] = ad.DNS - } - if ad.SmbServerName != nil { - objectMap["smbServerName"] = ad.SmbServerName - } - if ad.OrganizationalUnit != nil { - objectMap["organizationalUnit"] = ad.OrganizationalUnit - } - if ad.Site != nil { - objectMap["site"] = ad.Site - } - if ad.BackupOperators != nil { - objectMap["backupOperators"] = ad.BackupOperators - } - if ad.Administrators != nil { - objectMap["administrators"] = ad.Administrators - } - if ad.KdcIP != nil { - objectMap["kdcIP"] = ad.KdcIP - } - if ad.AdName != nil { - objectMap["adName"] = ad.AdName - } - if ad.ServerRootCACertificate != nil { - objectMap["serverRootCACertificate"] = ad.ServerRootCACertificate - } - if ad.AesEncryption != nil { - objectMap["aesEncryption"] = ad.AesEncryption - } - if ad.LdapSigning != nil { - objectMap["ldapSigning"] = ad.LdapSigning - } - if ad.SecurityOperators != nil { - objectMap["securityOperators"] = ad.SecurityOperators - } - if ad.LdapOverTLS != nil { - objectMap["ldapOverTLS"] = ad.LdapOverTLS - } - if ad.AllowLocalNfsUsersWithLdap != nil { - objectMap["allowLocalNfsUsersWithLdap"] = ad.AllowLocalNfsUsersWithLdap - } - if ad.EncryptDCConnections != nil { - objectMap["encryptDCConnections"] = ad.EncryptDCConnections - } - if ad.LdapSearchScope != nil { - objectMap["ldapSearchScope"] = ad.LdapSearchScope - } - return json.Marshal(objectMap) -} - -// AuthorizeRequest authorize request -type AuthorizeRequest struct { - // RemoteVolumeResourceID - Resource id of the remote volume - RemoteVolumeResourceID *string `json:"remoteVolumeResourceId,omitempty"` -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Backup backup of a Volume -type Backup struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // BackupProperties - Backup Properties - *BackupProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Backup. -func (b Backup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if b.Location != nil { - objectMap["location"] = b.Location - } - if b.BackupProperties != nil { - objectMap["properties"] = b.BackupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Backup struct. -func (b *Backup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - b.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - b.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - b.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - b.Type = &typeVar - } - case "properties": - if v != nil { - var backupProperties BackupProperties - err = json.Unmarshal(*v, &backupProperties) - if err != nil { - return err - } - b.BackupProperties = &backupProperties - } - } - } - - return nil -} - -// BackupPatch backup patch -type BackupPatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // BackupProperties - Backup Properties - *BackupProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupPatch. -func (bp BackupPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bp.Tags != nil { - objectMap["tags"] = bp.Tags - } - if bp.BackupProperties != nil { - objectMap["properties"] = bp.BackupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackupPatch struct. -func (bp *BackupPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - bp.Tags = tags - } - case "properties": - if v != nil { - var backupProperties BackupProperties - err = json.Unmarshal(*v, &backupProperties) - if err != nil { - return err - } - bp.BackupProperties = &backupProperties - } - } - } - - return nil -} - -// BackupPoliciesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BackupPoliciesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupPoliciesClient) (BackupPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupPoliciesCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupPoliciesCreateFuture.Result. -func (future *BackupPoliciesCreateFuture) result(client BackupPoliciesClient) (bp BackupPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.BackupPoliciesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bp.Response.Response, err = future.GetResult(sender); err == nil && bp.Response.Response.StatusCode != http.StatusNoContent { - bp, err = client.CreateResponder(bp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesCreateFuture", "Result", bp.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BackupPoliciesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupPoliciesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupPoliciesDeleteFuture.Result. -func (future *BackupPoliciesDeleteFuture) result(client BackupPoliciesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.BackupPoliciesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// BackupPoliciesList list of Backup Policies -type BackupPoliciesList struct { - autorest.Response `json:"-"` - // Value - A list of backup policies - Value *[]BackupPolicy `json:"value,omitempty"` -} - -// BackupPoliciesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BackupPoliciesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupPoliciesClient) (BackupPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupPoliciesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupPoliciesUpdateFuture.Result. -func (future *BackupPoliciesUpdateFuture) result(client BackupPoliciesClient) (bp BackupPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.BackupPoliciesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bp.Response.Response, err = future.GetResult(sender); err == nil && bp.Response.Response.StatusCode != http.StatusNoContent { - bp, err = client.UpdateResponder(bp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesUpdateFuture", "Result", bp.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupPolicy backup policy information -type BackupPolicy struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // BackupPolicyProperties - Backup policy Properties - *BackupPolicyProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupPolicy. -func (bp BackupPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bp.Location != nil { - objectMap["location"] = bp.Location - } - if bp.Tags != nil { - objectMap["tags"] = bp.Tags - } - if bp.BackupPolicyProperties != nil { - objectMap["properties"] = bp.BackupPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackupPolicy struct. -func (bp *BackupPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - bp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bp.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - bp.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - bp.Tags = tags - } - case "properties": - if v != nil { - var backupPolicyProperties BackupPolicyProperties - err = json.Unmarshal(*v, &backupPolicyProperties) - if err != nil { - return err - } - bp.BackupPolicyProperties = &backupPolicyProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - bp.SystemData = &systemData - } - } - } - - return nil -} - -// BackupPolicyDetails backup policy properties -type BackupPolicyDetails struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // BackupPolicyProperties - Backup policy Properties - *BackupPolicyProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupPolicyDetails. -func (bpd BackupPolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bpd.Location != nil { - objectMap["location"] = bpd.Location - } - if bpd.Tags != nil { - objectMap["tags"] = bpd.Tags - } - if bpd.BackupPolicyProperties != nil { - objectMap["properties"] = bpd.BackupPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackupPolicyDetails struct. -func (bpd *BackupPolicyDetails) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - bpd.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bpd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bpd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bpd.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - bpd.Tags = tags - } - case "properties": - if v != nil { - var backupPolicyProperties BackupPolicyProperties - err = json.Unmarshal(*v, &backupPolicyProperties) - if err != nil { - return err - } - bpd.BackupPolicyProperties = &backupPolicyProperties - } - } - } - - return nil -} - -// BackupPolicyPatch backup policy Details for create and update -type BackupPolicyPatch struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // BackupPolicyProperties - Backup policy Properties - *BackupPolicyProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupPolicyPatch. -func (bpp BackupPolicyPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bpp.Location != nil { - objectMap["location"] = bpp.Location - } - if bpp.Tags != nil { - objectMap["tags"] = bpp.Tags - } - if bpp.BackupPolicyProperties != nil { - objectMap["properties"] = bpp.BackupPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackupPolicyPatch struct. -func (bpp *BackupPolicyPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - bpp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bpp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bpp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bpp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - bpp.Tags = tags - } - case "properties": - if v != nil { - var backupPolicyProperties BackupPolicyProperties - err = json.Unmarshal(*v, &backupPolicyProperties) - if err != nil { - return err - } - bpp.BackupPolicyProperties = &backupPolicyProperties - } - } - } - - return nil -} - -// BackupPolicyProperties backup policy properties -type BackupPolicyProperties struct { - // BackupPolicyID - READ-ONLY; Backup Policy Resource ID - BackupPolicyID *string `json:"backupPolicyId,omitempty"` - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` - // DailyBackupsToKeep - Daily backups count to keep - DailyBackupsToKeep *int32 `json:"dailyBackupsToKeep,omitempty"` - // WeeklyBackupsToKeep - Weekly backups count to keep - WeeklyBackupsToKeep *int32 `json:"weeklyBackupsToKeep,omitempty"` - // MonthlyBackupsToKeep - Monthly backups count to keep - MonthlyBackupsToKeep *int32 `json:"monthlyBackupsToKeep,omitempty"` - // VolumesAssigned - READ-ONLY; Volumes using current backup policy - VolumesAssigned *int32 `json:"volumesAssigned,omitempty"` - // Enabled - The property to decide policy is enabled or not - Enabled *bool `json:"enabled,omitempty"` - // VolumeBackups - READ-ONLY; A list of volumes assigned to this policy - VolumeBackups *[]VolumeBackups `json:"volumeBackups,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupPolicyProperties. -func (bpp BackupPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bpp.DailyBackupsToKeep != nil { - objectMap["dailyBackupsToKeep"] = bpp.DailyBackupsToKeep - } - if bpp.WeeklyBackupsToKeep != nil { - objectMap["weeklyBackupsToKeep"] = bpp.WeeklyBackupsToKeep - } - if bpp.MonthlyBackupsToKeep != nil { - objectMap["monthlyBackupsToKeep"] = bpp.MonthlyBackupsToKeep - } - if bpp.Enabled != nil { - objectMap["enabled"] = bpp.Enabled - } - return json.Marshal(objectMap) -} - -// BackupProperties backup properties -type BackupProperties struct { - // BackupID - READ-ONLY; UUID v4 used to identify the Backup - BackupID *string `json:"backupId,omitempty"` - // CreationDate - READ-ONLY; The creation date of the backup - CreationDate *date.Time `json:"creationDate,omitempty"` - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` - // Size - READ-ONLY; Size of backup - Size *int64 `json:"size,omitempty"` - // Label - Label for backup - Label *string `json:"label,omitempty"` - // BackupType - READ-ONLY; Type of backup Manual or Scheduled. Possible values include: 'BackupTypeManual', 'BackupTypeScheduled' - BackupType BackupType `json:"backupType,omitempty"` - // FailureReason - READ-ONLY; Failure reason - FailureReason *string `json:"failureReason,omitempty"` - // VolumeName - READ-ONLY; Volume name - VolumeName *string `json:"volumeName,omitempty"` - // UseExistingSnapshot - Manual backup an already existing snapshot. This will always be false for scheduled backups and true/false for manual backups - UseExistingSnapshot *bool `json:"useExistingSnapshot,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupProperties. -func (bp BackupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bp.Label != nil { - objectMap["label"] = bp.Label - } - if bp.UseExistingSnapshot != nil { - objectMap["useExistingSnapshot"] = bp.UseExistingSnapshot - } - return json.Marshal(objectMap) -} - -// BackupsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BackupsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupsClient) (Backup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupsCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupsCreateFuture.Result. -func (future *BackupsCreateFuture) result(client BackupsClient) (b Backup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - b.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.BackupsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if b.Response.Response, err = future.GetResult(sender); err == nil && b.Response.Response.StatusCode != http.StatusNoContent { - b, err = client.CreateResponder(b.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsCreateFuture", "Result", b.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BackupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupsDeleteFuture.Result. -func (future *BackupsDeleteFuture) result(client BackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.BackupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// BackupsList list of Backups -type BackupsList struct { - autorest.Response `json:"-"` - // Value - A list of Backups - Value *[]Backup `json:"value,omitempty"` -} - -// BackupStatus backup status -type BackupStatus struct { - autorest.Response `json:"-"` - // Healthy - READ-ONLY; Backup health status - Healthy *bool `json:"healthy,omitempty"` - // RelationshipStatus - READ-ONLY; Status of the backup mirror relationship. Possible values include: 'RelationshipStatusIdle', 'RelationshipStatusTransferring' - RelationshipStatus RelationshipStatus `json:"relationshipStatus,omitempty"` - // MirrorState - READ-ONLY; The status of the backup. Possible values include: 'MirrorStateUninitialized', 'MirrorStateMirrored', 'MirrorStateBroken' - MirrorState MirrorState `json:"mirrorState,omitempty"` - // UnhealthyReason - READ-ONLY; Reason for the unhealthy backup relationship - UnhealthyReason *string `json:"unhealthyReason,omitempty"` - // ErrorMessage - READ-ONLY; Displays error message if the backup is in an error state - ErrorMessage *string `json:"errorMessage,omitempty"` - // LastTransferSize - READ-ONLY; Displays the last transfer size - LastTransferSize *int64 `json:"lastTransferSize,omitempty"` - // LastTransferType - READ-ONLY; Displays the last transfer type - LastTransferType *string `json:"lastTransferType,omitempty"` - // TotalTransferBytes - READ-ONLY; Displays the total bytes transferred - TotalTransferBytes *int64 `json:"totalTransferBytes,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupStatus. -func (bs BackupStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BackupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BackupsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupsClient) (Backup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupsUpdateFuture.Result. -func (future *BackupsUpdateFuture) result(client BackupsClient) (b Backup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - b.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.BackupsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if b.Response.Response, err = future.GetResult(sender); err == nil && b.Response.Response.StatusCode != http.StatusNoContent { - b, err = client.UpdateResponder(b.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsUpdateFuture", "Result", b.Response.Response, "Failure responding to request") - } - } - return -} - -// BreakReplicationRequest break replication request -type BreakReplicationRequest struct { - // ForceBreakReplication - If replication is in status transferring and you want to force break the replication, set to true - ForceBreakReplication *bool `json:"forceBreakReplication,omitempty"` -} - -// CapacityPool capacity pool resource -type CapacityPool struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // PoolProperties - Capacity pool properties - *PoolProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for CapacityPool. -func (cp CapacityPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Location != nil { - objectMap["location"] = cp.Location - } - if cp.Tags != nil { - objectMap["tags"] = cp.Tags - } - if cp.PoolProperties != nil { - objectMap["properties"] = cp.PoolProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CapacityPool struct. -func (cp *CapacityPool) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - cp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cp.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - cp.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cp.Tags = tags - } - case "properties": - if v != nil { - var poolProperties PoolProperties - err = json.Unmarshal(*v, &poolProperties) - if err != nil { - return err - } - cp.PoolProperties = &poolProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - cp.SystemData = &systemData - } - } - } - - return nil -} - -// CapacityPoolList list of capacity pool resources -type CapacityPoolList struct { - autorest.Response `json:"-"` - // Value - List of Capacity pools - Value *[]CapacityPool `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// CapacityPoolListIterator provides access to a complete listing of CapacityPool values. -type CapacityPoolListIterator struct { - i int - page CapacityPoolListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *CapacityPoolListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CapacityPoolListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *CapacityPoolListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CapacityPoolListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter CapacityPoolListIterator) Response() CapacityPoolList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter CapacityPoolListIterator) Value() CapacityPool { - if !iter.page.NotDone() { - return CapacityPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CapacityPoolListIterator type. -func NewCapacityPoolListIterator(page CapacityPoolListPage) CapacityPoolListIterator { - return CapacityPoolListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cpl CapacityPoolList) IsEmpty() bool { - return cpl.Value == nil || len(*cpl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cpl CapacityPoolList) hasNextLink() bool { - return cpl.NextLink != nil && len(*cpl.NextLink) != 0 -} - -// capacityPoolListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cpl CapacityPoolList) capacityPoolListPreparer(ctx context.Context) (*http.Request, error) { - if !cpl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cpl.NextLink))) -} - -// CapacityPoolListPage contains a page of CapacityPool values. -type CapacityPoolListPage struct { - fn func(context.Context, CapacityPoolList) (CapacityPoolList, error) - cpl CapacityPoolList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *CapacityPoolListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CapacityPoolListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cpl) - if err != nil { - return err - } - page.cpl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *CapacityPoolListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CapacityPoolListPage) NotDone() bool { - return !page.cpl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CapacityPoolListPage) Response() CapacityPoolList { - return page.cpl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CapacityPoolListPage) Values() []CapacityPool { - if page.cpl.IsEmpty() { - return nil - } - return *page.cpl.Value -} - -// Creates a new instance of the CapacityPoolListPage type. -func NewCapacityPoolListPage(cur CapacityPoolList, getNextPage func(context.Context, CapacityPoolList) (CapacityPoolList, error)) CapacityPoolListPage { - return CapacityPoolListPage{ - fn: getNextPage, - cpl: cur, - } -} - -// CapacityPoolPatch capacity pool patch resource -type CapacityPoolPatch struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // PoolPatchProperties - Capacity pool properties - *PoolPatchProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CapacityPoolPatch. -func (cpp CapacityPoolPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cpp.Location != nil { - objectMap["location"] = cpp.Location - } - if cpp.Tags != nil { - objectMap["tags"] = cpp.Tags - } - if cpp.PoolPatchProperties != nil { - objectMap["properties"] = cpp.PoolPatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CapacityPoolPatch struct. -func (cpp *CapacityPoolPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - cpp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cpp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cpp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cpp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cpp.Tags = tags - } - case "properties": - if v != nil { - var poolPatchProperties PoolPatchProperties - err = json.Unmarshal(*v, &poolPatchProperties) - if err != nil { - return err - } - cpp.PoolPatchProperties = &poolPatchProperties - } - } - } - - return nil -} - -// CheckAvailabilityResponse information regarding availability of a resource. -type CheckAvailabilityResponse struct { - autorest.Response `json:"-"` - // IsAvailable - true indicates name is valid and available. false indicates the name is invalid, unavailable, or both. - IsAvailable *bool `json:"isAvailable,omitempty"` - // Reason - Invalid indicates the name provided does not match Azure App Service naming requirements. AlreadyExists indicates that the name is already in use and is therefore unavailable. Possible values include: 'InAvailabilityReasonTypeInvalid', 'InAvailabilityReasonTypeAlreadyExists' - Reason InAvailabilityReasonType `json:"reason,omitempty"` - // Message - If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that resource name is already in use, and direct them to select a different name. - Message *string `json:"message,omitempty"` -} - -// CloudError an error response from the service. -type CloudError struct { - // Error - Cloud error body. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from the service. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` -} - -// DailySchedule daily Schedule properties -type DailySchedule struct { - // SnapshotsToKeep - Daily snapshot count to keep - SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` - // Hour - Indicates which hour in UTC timezone a snapshot should be taken - Hour *int32 `json:"hour,omitempty"` - // Minute - Indicates which minute snapshot should be taken - Minute *int32 `json:"minute,omitempty"` - // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes - UsedBytes *int64 `json:"usedBytes,omitempty"` -} - -// Dimension dimension of blobs, possibly be blob type or access tier. -type Dimension struct { - // Name - Display name of dimension. - Name *string `json:"name,omitempty"` - // DisplayName - Display name of dimension. - DisplayName *string `json:"displayName,omitempty"` -} - -// ExportPolicyRule volume Export Policy Rule -type ExportPolicyRule struct { - // RuleIndex - Order index - RuleIndex *int32 `json:"ruleIndex,omitempty"` - // UnixReadOnly - Read only access - UnixReadOnly *bool `json:"unixReadOnly,omitempty"` - // UnixReadWrite - Read and write access - UnixReadWrite *bool `json:"unixReadWrite,omitempty"` - // Kerberos5ReadOnly - Kerberos5 Read only access. To be use with swagger version 2020-05-01 or later - Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` - // Kerberos5ReadWrite - Kerberos5 Read and write access. To be use with swagger version 2020-05-01 or later - Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` - // Kerberos5iReadOnly - Kerberos5i Read only access. To be use with swagger version 2020-05-01 or later - Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` - // Kerberos5iReadWrite - Kerberos5i Read and write access. To be use with swagger version 2020-05-01 or later - Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` - // Kerberos5pReadOnly - Kerberos5p Read only access. To be use with swagger version 2020-05-01 or later - Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` - // Kerberos5pReadWrite - Kerberos5p Read and write access. To be use with swagger version 2020-05-01 or later - Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` - // Cifs - Allows CIFS protocol - Cifs *bool `json:"cifs,omitempty"` - // Nfsv3 - Allows NFSv3 protocol. Enable only for NFSv3 type volumes - Nfsv3 *bool `json:"nfsv3,omitempty"` - // Nfsv41 - Allows NFSv4.1 protocol. Enable only for NFSv4.1 type volumes - Nfsv41 *bool `json:"nfsv41,omitempty"` - // AllowedClients - Client ingress specification as comma separated string with IPv4 CIDRs, IPv4 host addresses and host names - AllowedClients *string `json:"allowedClients,omitempty"` - // HasRootAccess - Has root access to volume - HasRootAccess *bool `json:"hasRootAccess,omitempty"` - // ChownMode - This parameter specifies who is authorized to change the ownership of a file. restricted - Only root user can change the ownership of the file. unrestricted - Non-root users can change ownership of files that they own. Possible values include: 'ChownModeRestricted', 'ChownModeUnrestricted' - ChownMode ChownMode `json:"chownMode,omitempty"` -} - -// FilePathAvailabilityRequest file path availability request content - availability is based on the name -// and the subnetId. -type FilePathAvailabilityRequest struct { - // Name - File path to verify. - Name *string `json:"name,omitempty"` - // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes - SubnetID *string `json:"subnetId,omitempty"` -} - -// HourlySchedule hourly Schedule properties -type HourlySchedule struct { - // SnapshotsToKeep - Hourly snapshot count to keep - SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` - // Minute - Indicates which minute snapshot should be taken - Minute *int32 `json:"minute,omitempty"` - // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes - UsedBytes *int64 `json:"usedBytes,omitempty"` -} - -// LdapSearchScopeOpt LDAP search scope -type LdapSearchScopeOpt struct { - // UserDN - This specifies the user DN, which overrides the base DN for user lookups. - UserDN *string `json:"userDN,omitempty"` - // GroupDN - This specifies the group DN, which overrides the base DN for group lookups. - GroupDN *string `json:"groupDN,omitempty"` - // GroupMembershipFilter - This specifies the custom LDAP search filter to be used when looking up group membership from LDAP server. - GroupMembershipFilter *string `json:"groupMembershipFilter,omitempty"` -} - -// LogSpecification log Definition of a single resource metric. -type LogSpecification struct { - // Name - Name of log specification. - Name *string `json:"name,omitempty"` - // DisplayName - Display name of log specification. - DisplayName *string `json:"displayName,omitempty"` -} - -// MetricSpecification metric specification of operation. -type MetricSpecification struct { - // Name - Name of metric specification. - Name *string `json:"name,omitempty"` - // DisplayName - Display name of metric specification. - DisplayName *string `json:"displayName,omitempty"` - // DisplayDescription - Display description of metric specification. - DisplayDescription *string `json:"displayDescription,omitempty"` - // Unit - Unit could be Bytes or Count. - Unit *string `json:"unit,omitempty"` - // SupportedAggregationTypes - Support metric aggregation type. - SupportedAggregationTypes *[]MetricAggregationType `json:"supportedAggregationTypes,omitempty"` - // SupportedTimeGrainTypes - The supported time grain types for the metrics. - SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` - // InternalMetricName - The internal metric name. - InternalMetricName *string `json:"internalMetricName,omitempty"` - // EnableRegionalMdmAccount - Whether or not the service is using regional MDM accounts. - EnableRegionalMdmAccount *bool `json:"enableRegionalMdmAccount,omitempty"` - // SourceMdmAccount - The source MDM account. - SourceMdmAccount *string `json:"sourceMdmAccount,omitempty"` - // SourceMdmNamespace - The source MDM namespace. - SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` - // Dimensions - Dimensions of blobs, including blob type and access tier. - Dimensions *[]Dimension `json:"dimensions,omitempty"` - // AggregationType - Aggregation type could be Average. - AggregationType *string `json:"aggregationType,omitempty"` - // FillGapWithZero - The property to decide fill gap with zero or not. - FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` - // Category - The category this metric specification belong to, could be Capacity. - Category *string `json:"category,omitempty"` - // ResourceIDDimensionNameOverride - Account Resource Id. - ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` - // IsInternal - Whether the metric is internal. - IsInternal *bool `json:"isInternal,omitempty"` -} - -// MonthlySchedule monthly Schedule properties -type MonthlySchedule struct { - // SnapshotsToKeep - Monthly snapshot count to keep - SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` - // DaysOfMonth - Indicates which days of the month snapshot should be taken. A comma delimited string. - DaysOfMonth *string `json:"daysOfMonth,omitempty"` - // Hour - Indicates which hour in UTC timezone a snapshot should be taken - Hour *int32 `json:"hour,omitempty"` - // Minute - Indicates which minute snapshot should be taken - Minute *int32 `json:"minute,omitempty"` - // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes - UsedBytes *int64 `json:"usedBytes,omitempty"` -} - -// MountTarget mount Target -type MountTarget struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // MountTargetProperties - Mount Target Properties - *MountTargetProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for MountTarget. -func (mt MountTarget) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mt.Location != nil { - objectMap["location"] = mt.Location - } - if mt.Tags != nil { - objectMap["tags"] = mt.Tags - } - if mt.MountTargetProperties != nil { - objectMap["properties"] = mt.MountTargetProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MountTarget struct. -func (mt *MountTarget) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mt.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mt.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mt.Tags = tags - } - case "properties": - if v != nil { - var mountTargetProperties MountTargetProperties - err = json.Unmarshal(*v, &mountTargetProperties) - if err != nil { - return err - } - mt.MountTargetProperties = &mountTargetProperties - } - } - } - - return nil -} - -// MountTargetProperties mount target properties -type MountTargetProperties struct { - // MountTargetID - READ-ONLY; UUID v4 used to identify the MountTarget - MountTargetID *string `json:"mountTargetId,omitempty"` - // FileSystemID - UUID v4 used to identify the MountTarget - FileSystemID *string `json:"fileSystemId,omitempty"` - // IPAddress - READ-ONLY; The mount target's IPv4 address - IPAddress *string `json:"ipAddress,omitempty"` - // SmbServerFqdn - The SMB server's Fully Qualified Domain Name, FQDN - SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` -} - -// MarshalJSON is the custom marshaler for MountTargetProperties. -func (mtp MountTargetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mtp.FileSystemID != nil { - objectMap["fileSystemId"] = mtp.FileSystemID - } - if mtp.SmbServerFqdn != nil { - objectMap["smbServerFqdn"] = mtp.SmbServerFqdn - } - return json.Marshal(objectMap) -} - -// Operation microsoft.NetApp REST API operation definition. -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - The origin of operations. - Origin *string `json:"origin,omitempty"` - // OperationProperties - Properties of operation, include metric specifications. - *OperationProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if o.Name != nil { - objectMap["name"] = o.Name - } - if o.Display != nil { - objectMap["display"] = o.Display - } - if o.Origin != nil { - objectMap["origin"] = o.Origin - } - if o.OperationProperties != nil { - objectMap["properties"] = o.OperationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Operation struct. -func (o *Operation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - o.Name = &name - } - case "display": - if v != nil { - var display OperationDisplay - err = json.Unmarshal(*v, &display) - if err != nil { - return err - } - o.Display = &display - } - case "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - o.Origin = &origin - } - case "properties": - if v != nil { - var operationProperties OperationProperties - err = json.Unmarshal(*v, &operationProperties) - if err != nil { - return err - } - o.OperationProperties = &operationProperties - } - } - } - - return nil -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft NetApp. - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed etc. - Resource *string `json:"resource,omitempty"` - // Operation - Type of operation: get, read, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - Operation description. - Description *string `json:"description,omitempty"` -} - -// OperationListResult result of the request to list Cloud Volume operations. It contains a list of -// operations and a URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of Storage operations supported by the Storage resource provider. - Value *[]Operation `json:"value,omitempty"` -} - -// OperationProperties properties of operation, include metric specifications. -type OperationProperties struct { - // ServiceSpecification - One property of operation, include metric specifications. - ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// PlacementKeyValuePairs application specific parameters for the placement of volumes in the volume group -type PlacementKeyValuePairs struct { - // Key - Key for an application specific parameter for the placement of volumes in the volume group - Key *string `json:"key,omitempty"` - // Value - Value for an application specific parameter for the placement of volumes in the volume group - Value *string `json:"value,omitempty"` -} - -// PoolChangeRequest pool change request -type PoolChangeRequest struct { - // NewPoolResourceID - Resource id of the pool to move volume to - NewPoolResourceID *string `json:"newPoolResourceId,omitempty"` -} - -// PoolPatchProperties patchable pool properties -type PoolPatchProperties struct { - // Size - Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiply of 4398046511104). - Size *int64 `json:"size,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' - QosType QosType `json:"qosType,omitempty"` -} - -// PoolProperties pool properties -type PoolProperties struct { - // PoolID - READ-ONLY; UUID v4 used to identify the Pool - PoolID *string `json:"poolId,omitempty"` - // Size - Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiply of 4398046511104). - Size *int64 `json:"size,omitempty"` - // ServiceLevel - Possible values include: 'ServiceLevelStandard', 'ServiceLevelPremium', 'ServiceLevelUltra', 'ServiceLevelStandardZRS' - ServiceLevel ServiceLevel `json:"serviceLevel,omitempty"` - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` - // TotalThroughputMibps - READ-ONLY; Total throughput of pool in Mibps - TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` - // UtilizedThroughputMibps - READ-ONLY; Utilized throughput of pool in Mibps - UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' - QosType QosType `json:"qosType,omitempty"` - // CoolAccess - If enabled (true) the pool can contain cool Access enabled volumes. - CoolAccess *bool `json:"coolAccess,omitempty"` - // EncryptionType - Encryption type of the capacity pool, set encryption type for data at rest for this pool and all volumes in it. This value can only be set when creating new pool. Possible values include: 'EncryptionTypeSingle', 'EncryptionTypeDouble' - EncryptionType EncryptionType `json:"encryptionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for PoolProperties. -func (pp PoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pp.Size != nil { - objectMap["size"] = pp.Size - } - if pp.ServiceLevel != "" { - objectMap["serviceLevel"] = pp.ServiceLevel - } - if pp.QosType != "" { - objectMap["qosType"] = pp.QosType - } - if pp.CoolAccess != nil { - objectMap["coolAccess"] = pp.CoolAccess - } - if pp.EncryptionType != "" { - objectMap["encryptionType"] = pp.EncryptionType - } - return json.Marshal(objectMap) -} - -// PoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PoolsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PoolsClient) (CapacityPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PoolsCreateOrUpdateFuture.Result. -func (future *PoolsCreateOrUpdateFuture) result(client PoolsClient) (cp CapacityPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.PoolsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cp.Response.Response, err = future.GetResult(sender); err == nil && cp.Response.Response.StatusCode != http.StatusNoContent { - cp, err = client.CreateOrUpdateResponder(cp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsCreateOrUpdateFuture", "Result", cp.Response.Response, "Failure responding to request") - } - } - return -} - -// PoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type PoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PoolsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PoolsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PoolsDeleteFuture.Result. -func (future *PoolsDeleteFuture) result(client PoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.PoolsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type PoolsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PoolsClient) (CapacityPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PoolsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PoolsUpdateFuture.Result. -func (future *PoolsUpdateFuture) result(client PoolsClient) (cp CapacityPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.PoolsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cp.Response.Response, err = future.GetResult(sender); err == nil && cp.Response.Response.StatusCode != http.StatusNoContent { - cp, err = client.UpdateResponder(cp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsUpdateFuture", "Result", cp.Response.Response, "Failure responding to request") - } - } - return -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// QuotaAvailabilityRequest quota availability request content. -type QuotaAvailabilityRequest struct { - // Name - Name of the resource to verify. - Name *string `json:"name,omitempty"` - // Type - Resource type used for verification. Possible values include: 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts', 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools', 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes', 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots' - Type CheckQuotaNameResourceTypes `json:"type,omitempty"` - // ResourceGroup - Resource group name. - ResourceGroup *string `json:"resourceGroup,omitempty"` -} - -// ReplicationObject replication properties -type ReplicationObject struct { - // ReplicationID - Id - ReplicationID *string `json:"replicationId,omitempty"` - // EndpointType - Indicates whether the local volume is the source or destination for the Volume Replication. Possible values include: 'EndpointTypeSrc', 'EndpointTypeDst' - EndpointType EndpointType `json:"endpointType,omitempty"` - // ReplicationSchedule - Schedule. Possible values include: 'ReplicationSchedule10minutely', 'ReplicationScheduleHourly', 'ReplicationScheduleDaily' - ReplicationSchedule ReplicationSchedule `json:"replicationSchedule,omitempty"` - // RemoteVolumeResourceID - The resource ID of the remote volume. - RemoteVolumeResourceID *string `json:"remoteVolumeResourceId,omitempty"` - // RemoteVolumeRegion - The remote region for the other end of the Volume Replication. - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` -} - -// ReplicationStatus replication status -type ReplicationStatus struct { - autorest.Response `json:"-"` - // Healthy - Replication health check - Healthy *bool `json:"healthy,omitempty"` - // RelationshipStatus - Status of the mirror relationship. Possible values include: 'RelationshipStatusIdle', 'RelationshipStatusTransferring' - RelationshipStatus RelationshipStatus `json:"relationshipStatus,omitempty"` - // MirrorState - The status of the replication. Possible values include: 'MirrorStateUninitialized', 'MirrorStateMirrored', 'MirrorStateBroken' - MirrorState MirrorState `json:"mirrorState,omitempty"` - // TotalProgress - The progress of the replication - TotalProgress *string `json:"totalProgress,omitempty"` - // ErrorMessage - Displays error message if the replication is in an error state - ErrorMessage *string `json:"errorMessage,omitempty"` -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceIdentity identity for the resource. -type ResourceIdentity struct { - // PrincipalID - READ-ONLY; Object id of the identity resource - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant id of the resource - TenantID *string `json:"tenantId,omitempty"` - // Type - Type of Identity. Supported values are: 'None', 'SystemAssigned' - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceIdentity. -func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ri.Type != nil { - objectMap["type"] = ri.Type - } - return json.Marshal(objectMap) -} - -// ResourceNameAvailabilityRequest resource name availability request content. -type ResourceNameAvailabilityRequest struct { - // Name - Resource name to verify. - Name *string `json:"name,omitempty"` - // Type - Resource type used for verification. Possible values include: 'CheckNameResourceTypesMicrosoftNetAppnetAppAccounts', 'CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools', 'CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes', 'CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots' - Type CheckNameResourceTypes `json:"type,omitempty"` - // ResourceGroup - Resource group name. - ResourceGroup *string `json:"resourceGroup,omitempty"` -} - -// RestoreStatus restore status -type RestoreStatus struct { - autorest.Response `json:"-"` - // Healthy - READ-ONLY; Restore health status - Healthy *bool `json:"healthy,omitempty"` - // RelationshipStatus - READ-ONLY; Status of the restore SnapMirror relationship. Possible values include: 'RelationshipStatusIdle', 'RelationshipStatusTransferring' - RelationshipStatus RelationshipStatus `json:"relationshipStatus,omitempty"` - // MirrorState - READ-ONLY; The status of the restore. Possible values include: 'MirrorStateUninitialized', 'MirrorStateMirrored', 'MirrorStateBroken' - MirrorState MirrorState `json:"mirrorState,omitempty"` - // UnhealthyReason - READ-ONLY; Reason for the unhealthy restore relationship - UnhealthyReason *string `json:"unhealthyReason,omitempty"` - // ErrorMessage - READ-ONLY; Displays error message if the restore is in an error state - ErrorMessage *string `json:"errorMessage,omitempty"` - // TotalTransferBytes - READ-ONLY; Displays the total bytes transferred - TotalTransferBytes *int64 `json:"totalTransferBytes,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestoreStatus. -func (rs RestoreStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServiceSpecification one property of operation, include metric specifications. -type ServiceSpecification struct { - // MetricSpecifications - Metric specifications of operation. - MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` - // LogSpecifications - Log specification of operation. - LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` -} - -// Snapshot snapshot of a Volume -type Snapshot struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // SnapshotProperties - Snapshot Properties - *SnapshotProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Snapshot. -func (s Snapshot) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Location != nil { - objectMap["location"] = s.Location - } - if s.SnapshotProperties != nil { - objectMap["properties"] = s.SnapshotProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Snapshot struct. -func (s *Snapshot) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - s.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - s.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - s.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - s.Type = &typeVar - } - case "properties": - if v != nil { - var snapshotProperties SnapshotProperties - err = json.Unmarshal(*v, &snapshotProperties) - if err != nil { - return err - } - s.SnapshotProperties = &snapshotProperties - } - } - } - - return nil -} - -// SnapshotPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SnapshotPoliciesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SnapshotPoliciesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SnapshotPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SnapshotPoliciesDeleteFuture.Result. -func (future *SnapshotPoliciesDeleteFuture) result(client SnapshotPoliciesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SnapshotPoliciesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SnapshotPoliciesList list of Snapshot Policies -type SnapshotPoliciesList struct { - autorest.Response `json:"-"` - // Value - A list of snapshot policies - Value *[]SnapshotPolicy `json:"value,omitempty"` -} - -// SnapshotPoliciesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SnapshotPoliciesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SnapshotPoliciesClient) (SnapshotPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SnapshotPoliciesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SnapshotPoliciesUpdateFuture.Result. -func (future *SnapshotPoliciesUpdateFuture) result(client SnapshotPoliciesClient) (sp SnapshotPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SnapshotPoliciesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sp.Response.Response, err = future.GetResult(sender); err == nil && sp.Response.Response.StatusCode != http.StatusNoContent { - sp, err = client.UpdateResponder(sp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesUpdateFuture", "Result", sp.Response.Response, "Failure responding to request") - } - } - return -} - -// SnapshotPolicy snapshot policy information -type SnapshotPolicy struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // SnapshotPolicyProperties - Snapshot policy Properties - *SnapshotPolicyProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for SnapshotPolicy. -func (sp SnapshotPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.Location != nil { - objectMap["location"] = sp.Location - } - if sp.Tags != nil { - objectMap["tags"] = sp.Tags - } - if sp.SnapshotPolicyProperties != nil { - objectMap["properties"] = sp.SnapshotPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SnapshotPolicy struct. -func (sp *SnapshotPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sp.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sp.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sp.Tags = tags - } - case "properties": - if v != nil { - var snapshotPolicyProperties SnapshotPolicyProperties - err = json.Unmarshal(*v, &snapshotPolicyProperties) - if err != nil { - return err - } - sp.SnapshotPolicyProperties = &snapshotPolicyProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sp.SystemData = &systemData - } - } - } - - return nil -} - -// SnapshotPolicyDetails snapshot policy properties -type SnapshotPolicyDetails struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // SnapshotPolicyProperties - Snapshot policy Properties - *SnapshotPolicyProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SnapshotPolicyDetails. -func (spd SnapshotPolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spd.Location != nil { - objectMap["location"] = spd.Location - } - if spd.Tags != nil { - objectMap["tags"] = spd.Tags - } - if spd.SnapshotPolicyProperties != nil { - objectMap["properties"] = spd.SnapshotPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SnapshotPolicyDetails struct. -func (spd *SnapshotPolicyDetails) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - spd.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spd.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - spd.Tags = tags - } - case "properties": - if v != nil { - var snapshotPolicyProperties SnapshotPolicyProperties - err = json.Unmarshal(*v, &snapshotPolicyProperties) - if err != nil { - return err - } - spd.SnapshotPolicyProperties = &snapshotPolicyProperties - } - } - } - - return nil -} - -// SnapshotPolicyPatch snapshot policy Details for create and update -type SnapshotPolicyPatch struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // SnapshotPolicyProperties - Snapshot Policy properties - *SnapshotPolicyProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SnapshotPolicyPatch. -func (spp SnapshotPolicyPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spp.Location != nil { - objectMap["location"] = spp.Location - } - if spp.Tags != nil { - objectMap["tags"] = spp.Tags - } - if spp.SnapshotPolicyProperties != nil { - objectMap["properties"] = spp.SnapshotPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SnapshotPolicyPatch struct. -func (spp *SnapshotPolicyPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - spp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - spp.Tags = tags - } - case "properties": - if v != nil { - var snapshotPolicyProperties SnapshotPolicyProperties - err = json.Unmarshal(*v, &snapshotPolicyProperties) - if err != nil { - return err - } - spp.SnapshotPolicyProperties = &snapshotPolicyProperties - } - } - } - - return nil -} - -// SnapshotPolicyProperties snapshot policy properties -type SnapshotPolicyProperties struct { - // HourlySchedule - Schedule for hourly snapshots - HourlySchedule *HourlySchedule `json:"hourlySchedule,omitempty"` - // DailySchedule - Schedule for daily snapshots - DailySchedule *DailySchedule `json:"dailySchedule,omitempty"` - // WeeklySchedule - Schedule for weekly snapshots - WeeklySchedule *WeeklySchedule `json:"weeklySchedule,omitempty"` - // MonthlySchedule - Schedule for monthly snapshots - MonthlySchedule *MonthlySchedule `json:"monthlySchedule,omitempty"` - // Enabled - The property to decide policy is enabled or not - Enabled *bool `json:"enabled,omitempty"` - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for SnapshotPolicyProperties. -func (spp SnapshotPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spp.HourlySchedule != nil { - objectMap["hourlySchedule"] = spp.HourlySchedule - } - if spp.DailySchedule != nil { - objectMap["dailySchedule"] = spp.DailySchedule - } - if spp.WeeklySchedule != nil { - objectMap["weeklySchedule"] = spp.WeeklySchedule - } - if spp.MonthlySchedule != nil { - objectMap["monthlySchedule"] = spp.MonthlySchedule - } - if spp.Enabled != nil { - objectMap["enabled"] = spp.Enabled - } - return json.Marshal(objectMap) -} - -// SnapshotPolicyVolumeList volumes associated with snapshot policy -type SnapshotPolicyVolumeList struct { - autorest.Response `json:"-"` - // Value - List of volumes - Value *[]Volume `json:"value,omitempty"` -} - -// SnapshotProperties snapshot properties -type SnapshotProperties struct { - // SnapshotID - READ-ONLY; UUID v4 used to identify the Snapshot - SnapshotID *string `json:"snapshotId,omitempty"` - // Created - READ-ONLY; The creation date of the snapshot - Created *date.Time `json:"created,omitempty"` - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for SnapshotProperties. -func (sp SnapshotProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SnapshotRestoreFiles restore payload for Single File Snapshot Restore -type SnapshotRestoreFiles struct { - // FilePaths - List of files to be restored - FilePaths *[]string `json:"filePaths,omitempty"` - // DestinationPath - Destination folder where the files will be restored - DestinationPath *string `json:"destinationPath,omitempty"` -} - -// SnapshotsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SnapshotsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SnapshotsClient) (Snapshot, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SnapshotsCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SnapshotsCreateFuture.Result. -func (future *SnapshotsCreateFuture) result(client SnapshotsClient) (s Snapshot, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SnapshotsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.CreateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsCreateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// SnapshotsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SnapshotsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SnapshotsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SnapshotsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SnapshotsDeleteFuture.Result. -func (future *SnapshotsDeleteFuture) result(client SnapshotsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SnapshotsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SnapshotsList list of Snapshots -type SnapshotsList struct { - autorest.Response `json:"-"` - // Value - A list of Snapshots - Value *[]Snapshot `json:"value,omitempty"` -} - -// SnapshotsRestoreFilesFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SnapshotsRestoreFilesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SnapshotsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SnapshotsRestoreFilesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SnapshotsRestoreFilesFuture.Result. -func (future *SnapshotsRestoreFilesFuture) result(client SnapshotsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsRestoreFilesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SnapshotsRestoreFilesFuture") - return - } - ar.Response = future.Response() - return -} - -// SnapshotsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SnapshotsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SnapshotsClient) (Snapshot, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SnapshotsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SnapshotsUpdateFuture.Result. -func (future *SnapshotsUpdateFuture) result(client SnapshotsClient) (s Snapshot, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SnapshotsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.UpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// SubscriptionQuotaItem information regarding Subscription Quota Item. -type SubscriptionQuotaItem struct { - autorest.Response `json:"-"` - // SubscriptionQuotaItemProperties - SubscriptionQuotaItem properties - *SubscriptionQuotaItemProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionQuotaItem. -func (sqi SubscriptionQuotaItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sqi.SubscriptionQuotaItemProperties != nil { - objectMap["properties"] = sqi.SubscriptionQuotaItemProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubscriptionQuotaItem struct. -func (sqi *SubscriptionQuotaItem) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var subscriptionQuotaItemProperties SubscriptionQuotaItemProperties - err = json.Unmarshal(*v, &subscriptionQuotaItemProperties) - if err != nil { - return err - } - sqi.SubscriptionQuotaItemProperties = &subscriptionQuotaItemProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sqi.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sqi.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sqi.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sqi.Type = &typeVar - } - } - } - - return nil -} - -// SubscriptionQuotaItemList list of Subscription Quota Items -type SubscriptionQuotaItemList struct { - autorest.Response `json:"-"` - // Value - A list of SubscriptionQuotaItems - Value *[]SubscriptionQuotaItem `json:"value,omitempty"` -} - -// SubscriptionQuotaItemProperties subscriptionQuotaItem Properties -type SubscriptionQuotaItemProperties struct { - // Current - READ-ONLY; The current quota value. - Current *int32 `json:"current,omitempty"` - // Default - READ-ONLY; The default quota value. - Default *int32 `json:"default,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionQuotaItemProperties. -func (sqip SubscriptionQuotaItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SubvolumeInfo subvolume Information properties -type SubvolumeInfo struct { - autorest.Response `json:"-"` - // SubvolumeProperties - Subvolume Properties - *SubvolumeProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubvolumeInfo. -func (si SubvolumeInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if si.SubvolumeProperties != nil { - objectMap["properties"] = si.SubvolumeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubvolumeInfo struct. -func (si *SubvolumeInfo) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var subvolumeProperties SubvolumeProperties - err = json.Unmarshal(*v, &subvolumeProperties) - if err != nil { - return err - } - si.SubvolumeProperties = &subvolumeProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - si.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - si.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - si.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - si.Type = &typeVar - } - } - } - - return nil -} - -// SubvolumeModel result of the post subvolume and action is to get metadata of the subvolume. -type SubvolumeModel struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // SubvolumeModelProperties - It represents the minimal properties of the subvolume. - *SubvolumeModelProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubvolumeModel. -func (sm SubvolumeModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sm.SubvolumeModelProperties != nil { - objectMap["properties"] = sm.SubvolumeModelProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubvolumeModel struct. -func (sm *SubvolumeModel) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sm.Type = &typeVar - } - case "properties": - if v != nil { - var subvolumeModelProperties SubvolumeModelProperties - err = json.Unmarshal(*v, &subvolumeModelProperties) - if err != nil { - return err - } - sm.SubvolumeModelProperties = &subvolumeModelProperties - } - } - } - - return nil -} - -// SubvolumeModelProperties properties which represents actual subvolume model which is stored as a file in -// the system. -type SubvolumeModelProperties struct { - // Path - Path to the subvolume - Path *string `json:"path,omitempty"` - // ParentPath - Path to the parent subvolume - ParentPath *string `json:"parentPath,omitempty"` - // Size - Size of subvolume - Size *int64 `json:"size,omitempty"` - // BytesUsed - Bytes used - BytesUsed *int64 `json:"bytesUsed,omitempty"` - // Permissions - Permissions of the subvolume - Permissions *string `json:"permissions,omitempty"` - // CreationTimeStamp - Creation time and date - CreationTimeStamp *date.Time `json:"creationTimeStamp,omitempty"` - // AccessedTimeStamp - Most recent access time and date - AccessedTimeStamp *date.Time `json:"accessedTimeStamp,omitempty"` - // ModifiedTimeStamp - Most recent modification time and date - ModifiedTimeStamp *date.Time `json:"modifiedTimeStamp,omitempty"` - // ChangedTimeStamp - Most recent change time and date - ChangedTimeStamp *date.Time `json:"changedTimeStamp,omitempty"` - // ProvisioningState - Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// SubvolumePatchParams parameters with which a subvolume can be updated -type SubvolumePatchParams struct { - // Size - Truncate subvolume to the provided size in bytes - Size *int64 `json:"size,omitempty"` - // Path - path to the subvolume - Path *string `json:"path,omitempty"` -} - -// SubvolumePatchRequest subvolume Patch Request properties -type SubvolumePatchRequest struct { - // SubvolumePatchParams - Subvolume Properties - *SubvolumePatchParams `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubvolumePatchRequest. -func (spr SubvolumePatchRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spr.SubvolumePatchParams != nil { - objectMap["properties"] = spr.SubvolumePatchParams - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubvolumePatchRequest struct. -func (spr *SubvolumePatchRequest) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var subvolumePatchParams SubvolumePatchParams - err = json.Unmarshal(*v, &subvolumePatchParams) - if err != nil { - return err - } - spr.SubvolumePatchParams = &subvolumePatchParams - } - } - } - - return nil -} - -// SubvolumeProperties this represents path associated with the subvolume -type SubvolumeProperties struct { - // Path - Path to the subvolume - Path *string `json:"path,omitempty"` - // Size - Truncate subvolume to the provided size in bytes - Size *int64 `json:"size,omitempty"` - // ParentPath - parent path to the subvolume - ParentPath *string `json:"parentPath,omitempty"` - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubvolumeProperties. -func (sp SubvolumeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.Path != nil { - objectMap["path"] = sp.Path - } - if sp.Size != nil { - objectMap["size"] = sp.Size - } - if sp.ParentPath != nil { - objectMap["parentPath"] = sp.ParentPath - } - return json.Marshal(objectMap) -} - -// SubvolumesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SubvolumesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SubvolumesClient) (SubvolumeInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SubvolumesCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SubvolumesCreateFuture.Result. -func (future *SubvolumesCreateFuture) result(client SubvolumesClient) (si SubvolumeInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - si.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SubvolumesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if si.Response.Response, err = future.GetResult(sender); err == nil && si.Response.Response.StatusCode != http.StatusNoContent { - si, err = client.CreateResponder(si.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesCreateFuture", "Result", si.Response.Response, "Failure responding to request") - } - } - return -} - -// SubvolumesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SubvolumesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SubvolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SubvolumesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SubvolumesDeleteFuture.Result. -func (future *SubvolumesDeleteFuture) result(client SubvolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SubvolumesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SubvolumesGetMetadataFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SubvolumesGetMetadataFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SubvolumesClient) (SubvolumeModel, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SubvolumesGetMetadataFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SubvolumesGetMetadataFuture.Result. -func (future *SubvolumesGetMetadataFuture) result(client SubvolumesClient) (sm SubvolumeModel, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesGetMetadataFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SubvolumesGetMetadataFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { - sm, err = client.GetMetadataResponder(sm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesGetMetadataFuture", "Result", sm.Response.Response, "Failure responding to request") - } - } - return -} - -// SubvolumesList list of Subvolumes -type SubvolumesList struct { - autorest.Response `json:"-"` - // Value - A list of Subvolumes - Value *[]SubvolumeInfo `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// SubvolumesListIterator provides access to a complete listing of SubvolumeInfo values. -type SubvolumesListIterator struct { - i int - page SubvolumesListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SubvolumesListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SubvolumesListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SubvolumesListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SubvolumesListIterator) Response() SubvolumesList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SubvolumesListIterator) Value() SubvolumeInfo { - if !iter.page.NotDone() { - return SubvolumeInfo{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SubvolumesListIterator type. -func NewSubvolumesListIterator(page SubvolumesListPage) SubvolumesListIterator { - return SubvolumesListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sl SubvolumesList) IsEmpty() bool { - return sl.Value == nil || len(*sl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sl SubvolumesList) hasNextLink() bool { - return sl.NextLink != nil && len(*sl.NextLink) != 0 -} - -// subvolumesListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sl SubvolumesList) subvolumesListPreparer(ctx context.Context) (*http.Request, error) { - if !sl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sl.NextLink))) -} - -// SubvolumesListPage contains a page of SubvolumeInfo values. -type SubvolumesListPage struct { - fn func(context.Context, SubvolumesList) (SubvolumesList, error) - sl SubvolumesList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SubvolumesListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sl) - if err != nil { - return err - } - page.sl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SubvolumesListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SubvolumesListPage) NotDone() bool { - return !page.sl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SubvolumesListPage) Response() SubvolumesList { - return page.sl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SubvolumesListPage) Values() []SubvolumeInfo { - if page.sl.IsEmpty() { - return nil - } - return *page.sl.Value -} - -// Creates a new instance of the SubvolumesListPage type. -func NewSubvolumesListPage(cur SubvolumesList, getNextPage func(context.Context, SubvolumesList) (SubvolumesList, error)) SubvolumesListPage { - return SubvolumesListPage{ - fn: getNextPage, - sl: cur, - } -} - -// SubvolumesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SubvolumesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SubvolumesClient) (SubvolumeInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SubvolumesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SubvolumesUpdateFuture.Result. -func (future *SubvolumesUpdateFuture) result(client SubvolumesClient) (si SubvolumeInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - si.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SubvolumesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if si.Response.Response, err = future.GetResult(sender); err == nil && si.Response.Response.StatusCode != http.StatusNoContent { - si, err = client.UpdateResponder(si.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesUpdateFuture", "Result", si.Response.Response, "Failure responding to request") - } - } - return -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// Vault vault information -type Vault struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // VaultProperties - Vault Properties - *VaultProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Vault. -func (vVar Vault) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vVar.Location != nil { - objectMap["location"] = vVar.Location - } - if vVar.VaultProperties != nil { - objectMap["properties"] = vVar.VaultProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Vault struct. -func (vVar *Vault) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vVar.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vVar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vVar.Type = &typeVar - } - case "properties": - if v != nil { - var vaultProperties VaultProperties - err = json.Unmarshal(*v, &vaultProperties) - if err != nil { - return err - } - vVar.VaultProperties = &vaultProperties - } - } - } - - return nil -} - -// VaultList list of Vaults -type VaultList struct { - autorest.Response `json:"-"` - // Value - A list of vaults - Value *[]Vault `json:"value,omitempty"` -} - -// VaultProperties vault properties -type VaultProperties struct { - // VaultName - Vault Name - VaultName *string `json:"vaultName,omitempty"` -} - -// Volume volume resource -type Volume struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // VolumeProperties - Volume properties - *VolumeProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Volume. -func (vVar Volume) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vVar.Location != nil { - objectMap["location"] = vVar.Location - } - if vVar.Tags != nil { - objectMap["tags"] = vVar.Tags - } - if vVar.VolumeProperties != nil { - objectMap["properties"] = vVar.VolumeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Volume struct. -func (vVar *Volume) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vVar.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vVar.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vVar.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vVar.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vVar.Tags = tags - } - case "properties": - if v != nil { - var volumeProperties VolumeProperties - err = json.Unmarshal(*v, &volumeProperties) - if err != nil { - return err - } - vVar.VolumeProperties = &volumeProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - vVar.SystemData = &systemData - } - } - } - - return nil -} - -// VolumeBackupProperties volume Backup Properties -type VolumeBackupProperties struct { - // BackupPolicyID - Backup Policy Resource ID - BackupPolicyID *string `json:"backupPolicyId,omitempty"` - // PolicyEnforced - Policy Enforced - PolicyEnforced *bool `json:"policyEnforced,omitempty"` - // VaultID - Vault Resource ID - VaultID *string `json:"vaultId,omitempty"` - // BackupEnabled - Backup Enabled - BackupEnabled *bool `json:"backupEnabled,omitempty"` -} - -// VolumeBackups volume details using the backup policy -type VolumeBackups struct { - // VolumeName - Volume name - VolumeName *string `json:"volumeName,omitempty"` - // BackupsCount - Total count of backups for volume - BackupsCount *int32 `json:"backupsCount,omitempty"` - // PolicyEnabled - Policy enabled - PolicyEnabled *bool `json:"policyEnabled,omitempty"` -} - -// VolumeGroup volume group resource -type VolumeGroup struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // VolumeGroupListProperties - Volume group properties - *VolumeGroupListProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumeGroup. -func (vg VolumeGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vg.Location != nil { - objectMap["location"] = vg.Location - } - if vg.Tags != nil { - objectMap["tags"] = vg.Tags - } - if vg.VolumeGroupListProperties != nil { - objectMap["properties"] = vg.VolumeGroupListProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VolumeGroup struct. -func (vg *VolumeGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vg.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vg.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vg.Tags = tags - } - case "properties": - if v != nil { - var volumeGroupListProperties VolumeGroupListProperties - err = json.Unmarshal(*v, &volumeGroupListProperties) - if err != nil { - return err - } - vg.VolumeGroupListProperties = &volumeGroupListProperties - } - } - } - - return nil -} - -// VolumeGroupDetails volume group resource for create -type VolumeGroupDetails struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // VolumeGroupProperties - Volume group properties - *VolumeGroupProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumeGroupDetails. -func (vgd VolumeGroupDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vgd.Location != nil { - objectMap["location"] = vgd.Location - } - if vgd.Tags != nil { - objectMap["tags"] = vgd.Tags - } - if vgd.VolumeGroupProperties != nil { - objectMap["properties"] = vgd.VolumeGroupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VolumeGroupDetails struct. -func (vgd *VolumeGroupDetails) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vgd.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vgd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vgd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vgd.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vgd.Tags = tags - } - case "properties": - if v != nil { - var volumeGroupProperties VolumeGroupProperties - err = json.Unmarshal(*v, &volumeGroupProperties) - if err != nil { - return err - } - vgd.VolumeGroupProperties = &volumeGroupProperties - } - } - } - - return nil -} - -// VolumeGroupList list of volume group resources -type VolumeGroupList struct { - autorest.Response `json:"-"` - // Value - List of volume Groups - Value *[]VolumeGroup `json:"value,omitempty"` -} - -// VolumeGroupListProperties volume group properties -type VolumeGroupListProperties struct { - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` - // GroupMetaData - Volume group details - GroupMetaData *VolumeGroupMetaData `json:"groupMetaData,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumeGroupListProperties. -func (vglp VolumeGroupListProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vglp.GroupMetaData != nil { - objectMap["groupMetaData"] = vglp.GroupMetaData - } - return json.Marshal(objectMap) -} - -// VolumeGroupMetaData volume group properties -type VolumeGroupMetaData struct { - // GroupDescription - Group Description - GroupDescription *string `json:"groupDescription,omitempty"` - // ApplicationType - Application Type. Possible values include: 'ApplicationTypeSAPHANA' - ApplicationType ApplicationType `json:"applicationType,omitempty"` - // ApplicationIdentifier - Application specific identifier - ApplicationIdentifier *string `json:"applicationIdentifier,omitempty"` - // GlobalPlacementRules - Application specific placement rules for the volume group - GlobalPlacementRules *[]PlacementKeyValuePairs `json:"globalPlacementRules,omitempty"` - // DeploymentSpecID - Application specific identifier of deployment rules for the volume group - DeploymentSpecID *string `json:"deploymentSpecId,omitempty"` - // VolumesCount - READ-ONLY; Number of volumes in volume group - VolumesCount *int64 `json:"volumesCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumeGroupMetaData. -func (vgmd VolumeGroupMetaData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vgmd.GroupDescription != nil { - objectMap["groupDescription"] = vgmd.GroupDescription - } - if vgmd.ApplicationType != "" { - objectMap["applicationType"] = vgmd.ApplicationType - } - if vgmd.ApplicationIdentifier != nil { - objectMap["applicationIdentifier"] = vgmd.ApplicationIdentifier - } - if vgmd.GlobalPlacementRules != nil { - objectMap["globalPlacementRules"] = vgmd.GlobalPlacementRules - } - if vgmd.DeploymentSpecID != nil { - objectMap["deploymentSpecId"] = vgmd.DeploymentSpecID - } - return json.Marshal(objectMap) -} - -// VolumeGroupProperties volume group properties -type VolumeGroupProperties struct { - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` - // GroupMetaData - Volume group details - GroupMetaData *VolumeGroupMetaData `json:"groupMetaData,omitempty"` - // Volumes - List of volumes from group - Volumes *[]VolumeGroupVolumeProperties `json:"volumes,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumeGroupProperties. -func (vgp VolumeGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vgp.GroupMetaData != nil { - objectMap["groupMetaData"] = vgp.GroupMetaData - } - if vgp.Volumes != nil { - objectMap["volumes"] = vgp.Volumes - } - return json.Marshal(objectMap) -} - -// VolumeGroupsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumeGroupsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumeGroupsClient) (VolumeGroupDetails, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumeGroupsCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumeGroupsCreateFuture.Result. -func (future *VolumeGroupsCreateFuture) result(client VolumeGroupsClient) (vgd VolumeGroupDetails, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vgd.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumeGroupsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vgd.Response.Response, err = future.GetResult(sender); err == nil && vgd.Response.Response.StatusCode != http.StatusNoContent { - vgd, err = client.CreateResponder(vgd.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsCreateFuture", "Result", vgd.Response.Response, "Failure responding to request") - } - } - return -} - -// VolumeGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumeGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumeGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumeGroupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumeGroupsDeleteFuture.Result. -func (future *VolumeGroupsDeleteFuture) result(client VolumeGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumeGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumeGroupVolumeProperties volume resource -type VolumeGroupVolumeProperties struct { - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // VolumeProperties - Volume properties - *VolumeProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumeGroupVolumeProperties. -func (vgvp VolumeGroupVolumeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vgvp.Name != nil { - objectMap["name"] = vgvp.Name - } - if vgvp.Tags != nil { - objectMap["tags"] = vgvp.Tags - } - if vgvp.VolumeProperties != nil { - objectMap["properties"] = vgvp.VolumeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VolumeGroupVolumeProperties struct. -func (vgvp *VolumeGroupVolumeProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vgvp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vgvp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vgvp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vgvp.Tags = tags - } - case "properties": - if v != nil { - var volumeProperties VolumeProperties - err = json.Unmarshal(*v, &volumeProperties) - if err != nil { - return err - } - vgvp.VolumeProperties = &volumeProperties - } - } - } - - return nil -} - -// VolumeList list of volume resources -type VolumeList struct { - autorest.Response `json:"-"` - // Value - List of volumes - Value *[]Volume `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// VolumeListIterator provides access to a complete listing of Volume values. -type VolumeListIterator struct { - i int - page VolumeListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VolumeListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumeListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VolumeListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VolumeListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VolumeListIterator) Response() VolumeList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VolumeListIterator) Value() Volume { - if !iter.page.NotDone() { - return Volume{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VolumeListIterator type. -func NewVolumeListIterator(page VolumeListPage) VolumeListIterator { - return VolumeListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vl VolumeList) IsEmpty() bool { - return vl.Value == nil || len(*vl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vl VolumeList) hasNextLink() bool { - return vl.NextLink != nil && len(*vl.NextLink) != 0 -} - -// volumeListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vl VolumeList) volumeListPreparer(ctx context.Context) (*http.Request, error) { - if !vl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vl.NextLink))) -} - -// VolumeListPage contains a page of Volume values. -type VolumeListPage struct { - fn func(context.Context, VolumeList) (VolumeList, error) - vl VolumeList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VolumeListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumeListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vl) - if err != nil { - return err - } - page.vl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VolumeListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VolumeListPage) NotDone() bool { - return !page.vl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VolumeListPage) Response() VolumeList { - return page.vl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VolumeListPage) Values() []Volume { - if page.vl.IsEmpty() { - return nil - } - return *page.vl.Value -} - -// Creates a new instance of the VolumeListPage type. -func NewVolumeListPage(cur VolumeList, getNextPage func(context.Context, VolumeList) (VolumeList, error)) VolumeListPage { - return VolumeListPage{ - fn: getNextPage, - vl: cur, - } -} - -// VolumePatch volume patch resource -type VolumePatch struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // VolumePatchProperties - Patchable volume properties - *VolumePatchProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumePatch. -func (vp VolumePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vp.Location != nil { - objectMap["location"] = vp.Location - } - if vp.Tags != nil { - objectMap["tags"] = vp.Tags - } - if vp.VolumePatchProperties != nil { - objectMap["properties"] = vp.VolumePatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VolumePatch struct. -func (vp *VolumePatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vp.Tags = tags - } - case "properties": - if v != nil { - var volumePatchProperties VolumePatchProperties - err = json.Unmarshal(*v, &volumePatchProperties) - if err != nil { - return err - } - vp.VolumePatchProperties = &volumePatchProperties - } - } - } - - return nil -} - -// VolumePatchProperties patchable volume properties -type VolumePatchProperties struct { - // ServiceLevel - Possible values include: 'ServiceLevelStandard', 'ServiceLevelPremium', 'ServiceLevelUltra', 'ServiceLevelStandardZRS' - ServiceLevel ServiceLevel `json:"serviceLevel,omitempty"` - // UsageThreshold - Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. Specified in bytes. - UsageThreshold *int64 `json:"usageThreshold,omitempty"` - // ExportPolicy - Set of export policy rules - ExportPolicy *VolumePatchPropertiesExportPolicy `json:"exportPolicy,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - // DataProtection - DataProtection type volumes include an object containing details of the replication - DataProtection *VolumePatchPropertiesDataProtection `json:"dataProtection,omitempty"` - // IsDefaultQuotaEnabled - Specifies if default quota is enabled for the volume. - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - // DefaultUserQuotaInKiBs - Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - // DefaultGroupQuotaInKiBs - Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - // UnixPermissions - UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - UnixPermissions *string `json:"unixPermissions,omitempty"` -} - -// VolumePatchPropertiesDataProtection dataProtection type volumes include an object containing details of -// the replication -type VolumePatchPropertiesDataProtection struct { - // Backup - Backup Properties - Backup *VolumeBackupProperties `json:"backup,omitempty"` - // Snapshot - Snapshot properties. - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` -} - -// VolumePatchPropertiesExportPolicy set of export policy rules -type VolumePatchPropertiesExportPolicy struct { - // Rules - Export policy rule - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} - -// VolumeProperties volume properties -type VolumeProperties struct { - // FileSystemID - READ-ONLY; Unique FileSystem Identifier. - FileSystemID *string `json:"fileSystemId,omitempty"` - // CreationToken - A unique file path for the volume. Used when creating mount targets - CreationToken *string `json:"creationToken,omitempty"` - // ServiceLevel - Possible values include: 'ServiceLevelStandard', 'ServiceLevelPremium', 'ServiceLevelUltra', 'ServiceLevelStandardZRS' - ServiceLevel ServiceLevel `json:"serviceLevel,omitempty"` - // UsageThreshold - Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. Specified in bytes. - UsageThreshold *int64 `json:"usageThreshold,omitempty"` - // ExportPolicy - Set of export policy rules - ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - // ProtocolTypes - Set of protocol types, default NFSv3, CIFS for SMB protocol - ProtocolTypes *[]string `json:"protocolTypes,omitempty"` - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` - // SnapshotID - UUID v4 or resource identifier used to identify the Snapshot. - SnapshotID *string `json:"snapshotId,omitempty"` - // BackupID - UUID v4 or resource identifier used to identify the Backup. - BackupID *string `json:"backupId,omitempty"` - // BaremetalTenantID - READ-ONLY; Unique Baremetal Tenant Identifier. - BaremetalTenantID *string `json:"baremetalTenantId,omitempty"` - // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes - SubnetID *string `json:"subnetId,omitempty"` - // NetworkFeatures - Basic network, or Standard features available to the volume. Possible values include: 'NetworkFeaturesBasic', 'NetworkFeaturesStandard' - NetworkFeatures NetworkFeatures `json:"networkFeatures,omitempty"` - // NetworkSiblingSetID - READ-ONLY; Network Sibling Set ID for the the group of volumes sharing networking resources. - NetworkSiblingSetID *string `json:"networkSiblingSetId,omitempty"` - // StorageToNetworkProximity - READ-ONLY; Provides storage to network proximity information for the volume. Possible values include: 'VolumeStorageToNetworkProximityDefault', 'VolumeStorageToNetworkProximityT1', 'VolumeStorageToNetworkProximityT2' - StorageToNetworkProximity VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` - // MountTargets - READ-ONLY; List of mount targets - MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` - // VolumeType - What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection - VolumeType *string `json:"volumeType,omitempty"` - // DataProtection - DataProtection type volumes include an object containing details of the replication - DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` - // IsRestoring - Restoring - IsRestoring *bool `json:"isRestoring,omitempty"` - // SnapshotDirectoryVisible - If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (default to true). - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - // KerberosEnabled - Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later - KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - // SecurityStyle - The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. Possible values include: 'SecurityStyleNtfs', 'SecurityStyleUnix' - SecurityStyle SecurityStyle `json:"securityStyle,omitempty"` - // SmbEncryption - Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later - SmbEncryption *bool `json:"smbEncryption,omitempty"` - // SmbContinuouslyAvailable - Enables continuously available share property for smb volume. Only applicable for SMB volume - SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - // EncryptionKeySource - Encryption Key Source. Possible values are: 'Microsoft.NetApp' - EncryptionKeySource *string `json:"encryptionKeySource,omitempty"` - // LdapEnabled - Specifies whether LDAP is enabled or not for a given NFS volume. - LdapEnabled *bool `json:"ldapEnabled,omitempty"` - // CoolAccess - Specifies whether Cool Access(tiering) is enabled for the volume. - CoolAccess *bool `json:"coolAccess,omitempty"` - // CoolnessPeriod - Specifies the number of days after which data that is not accessed by clients will be tiered. - CoolnessPeriod *int32 `json:"coolnessPeriod,omitempty"` - // UnixPermissions - UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - UnixPermissions *string `json:"unixPermissions,omitempty"` - // CloneProgress - READ-ONLY; When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. - CloneProgress *int32 `json:"cloneProgress,omitempty"` - // AvsDataStore - Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. Possible values include: 'AvsDataStoreEnabled', 'AvsDataStoreDisabled' - AvsDataStore AvsDataStore `json:"avsDataStore,omitempty"` - // IsDefaultQuotaEnabled - Specifies if default quota is enabled for the volume. - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - // DefaultUserQuotaInKiBs - Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - // DefaultGroupQuotaInKiBs - Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - // MaximumNumberOfFiles - READ-ONLY; Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. - MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` - // VolumeGroupName - READ-ONLY; Volume Group Name - VolumeGroupName *string `json:"volumeGroupName,omitempty"` - // CapacityPoolResourceID - Pool Resource Id used in case of creating a volume through volume group - CapacityPoolResourceID *string `json:"capacityPoolResourceId,omitempty"` - // ProximityPlacementGroup - Proximity placement group associated with the volume - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` - // T2Network - READ-ONLY; T2 network information - T2Network *string `json:"t2Network,omitempty"` - // VolumeSpecName - Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log - VolumeSpecName *string `json:"volumeSpecName,omitempty"` - // PlacementRules - Application specific placement rules for the particular volume - PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` - // EnableSubvolumes - Flag indicating whether subvolume operations are enabled on the volume. Possible values include: 'EnableSubvolumesEnabled', 'EnableSubvolumesDisabled' - EnableSubvolumes EnableSubvolumes `json:"enableSubvolumes,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumeProperties. -func (vp VolumeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vp.CreationToken != nil { - objectMap["creationToken"] = vp.CreationToken - } - if vp.ServiceLevel != "" { - objectMap["serviceLevel"] = vp.ServiceLevel - } - if vp.UsageThreshold != nil { - objectMap["usageThreshold"] = vp.UsageThreshold - } - if vp.ExportPolicy != nil { - objectMap["exportPolicy"] = vp.ExportPolicy - } - if vp.ProtocolTypes != nil { - objectMap["protocolTypes"] = vp.ProtocolTypes - } - if vp.SnapshotID != nil { - objectMap["snapshotId"] = vp.SnapshotID - } - if vp.BackupID != nil { - objectMap["backupId"] = vp.BackupID - } - if vp.SubnetID != nil { - objectMap["subnetId"] = vp.SubnetID - } - if vp.NetworkFeatures != "" { - objectMap["networkFeatures"] = vp.NetworkFeatures - } - if vp.VolumeType != nil { - objectMap["volumeType"] = vp.VolumeType - } - if vp.DataProtection != nil { - objectMap["dataProtection"] = vp.DataProtection - } - if vp.IsRestoring != nil { - objectMap["isRestoring"] = vp.IsRestoring - } - if vp.SnapshotDirectoryVisible != nil { - objectMap["snapshotDirectoryVisible"] = vp.SnapshotDirectoryVisible - } - if vp.KerberosEnabled != nil { - objectMap["kerberosEnabled"] = vp.KerberosEnabled - } - if vp.SecurityStyle != "" { - objectMap["securityStyle"] = vp.SecurityStyle - } - if vp.SmbEncryption != nil { - objectMap["smbEncryption"] = vp.SmbEncryption - } - if vp.SmbContinuouslyAvailable != nil { - objectMap["smbContinuouslyAvailable"] = vp.SmbContinuouslyAvailable - } - if vp.ThroughputMibps != nil { - objectMap["throughputMibps"] = vp.ThroughputMibps - } - if vp.EncryptionKeySource != nil { - objectMap["encryptionKeySource"] = vp.EncryptionKeySource - } - if vp.LdapEnabled != nil { - objectMap["ldapEnabled"] = vp.LdapEnabled - } - if vp.CoolAccess != nil { - objectMap["coolAccess"] = vp.CoolAccess - } - if vp.CoolnessPeriod != nil { - objectMap["coolnessPeriod"] = vp.CoolnessPeriod - } - if vp.UnixPermissions != nil { - objectMap["unixPermissions"] = vp.UnixPermissions - } - if vp.AvsDataStore != "" { - objectMap["avsDataStore"] = vp.AvsDataStore - } - if vp.IsDefaultQuotaEnabled != nil { - objectMap["isDefaultQuotaEnabled"] = vp.IsDefaultQuotaEnabled - } - if vp.DefaultUserQuotaInKiBs != nil { - objectMap["defaultUserQuotaInKiBs"] = vp.DefaultUserQuotaInKiBs - } - if vp.DefaultGroupQuotaInKiBs != nil { - objectMap["defaultGroupQuotaInKiBs"] = vp.DefaultGroupQuotaInKiBs - } - if vp.CapacityPoolResourceID != nil { - objectMap["capacityPoolResourceId"] = vp.CapacityPoolResourceID - } - if vp.ProximityPlacementGroup != nil { - objectMap["proximityPlacementGroup"] = vp.ProximityPlacementGroup - } - if vp.VolumeSpecName != nil { - objectMap["volumeSpecName"] = vp.VolumeSpecName - } - if vp.PlacementRules != nil { - objectMap["placementRules"] = vp.PlacementRules - } - if vp.EnableSubvolumes != "" { - objectMap["enableSubvolumes"] = vp.EnableSubvolumes - } - return json.Marshal(objectMap) -} - -// VolumePropertiesDataProtection dataProtection type volumes include an object containing details of the -// replication -type VolumePropertiesDataProtection struct { - // Backup - Backup Properties - Backup *VolumeBackupProperties `json:"backup,omitempty"` - // Replication - Replication properties - Replication *ReplicationObject `json:"replication,omitempty"` - // Snapshot - Snapshot properties. - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` -} - -// VolumePropertiesExportPolicy set of export policy rules -type VolumePropertiesExportPolicy struct { - // Rules - Export policy rule - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} - -// VolumeRevert revert a volume to the snapshot -type VolumeRevert struct { - // SnapshotID - Resource id of the snapshot - SnapshotID *string `json:"snapshotId,omitempty"` -} - -// VolumesAuthorizeReplicationFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VolumesAuthorizeReplicationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesAuthorizeReplicationFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesAuthorizeReplicationFuture.Result. -func (future *VolumesAuthorizeReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesAuthorizeReplicationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesAuthorizeReplicationFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumesBreakReplicationFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumesBreakReplicationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesBreakReplicationFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesBreakReplicationFuture.Result. -func (future *VolumesBreakReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesBreakReplicationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesBreakReplicationFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (Volume, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesCreateOrUpdateFuture.Result. -func (future *VolumesCreateOrUpdateFuture) result(client VolumesClient) (vVar Volume, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vVar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent { - vVar, err = client.CreateOrUpdateResponder(vVar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesCreateOrUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request") - } - } - return -} - -// VolumesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesDeleteFuture.Result. -func (future *VolumesDeleteFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumesDeleteReplicationFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VolumesDeleteReplicationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesDeleteReplicationFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesDeleteReplicationFuture.Result. -func (future *VolumesDeleteReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesDeleteReplicationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesDeleteReplicationFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumeSnapshotProperties volume Snapshot Properties -type VolumeSnapshotProperties struct { - // SnapshotPolicyID - Snapshot Policy ResourceId - SnapshotPolicyID *string `json:"snapshotPolicyId,omitempty"` -} - -// VolumesPoolChangeFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumesPoolChangeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesPoolChangeFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesPoolChangeFuture.Result. -func (future *VolumesPoolChangeFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesPoolChangeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesPoolChangeFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumesReInitializeReplicationFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VolumesReInitializeReplicationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesReInitializeReplicationFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesReInitializeReplicationFuture.Result. -func (future *VolumesReInitializeReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesReInitializeReplicationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesReInitializeReplicationFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumesResyncReplicationFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VolumesResyncReplicationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesResyncReplicationFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesResyncReplicationFuture.Result. -func (future *VolumesResyncReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesResyncReplicationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesResyncReplicationFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumesRevertFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumesRevertFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesRevertFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesRevertFuture.Result. -func (future *VolumesRevertFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesRevertFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesRevertFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (Volume, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesUpdateFuture.Result. -func (future *VolumesUpdateFuture) result(client VolumesClient) (vVar Volume, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vVar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent { - vVar, err = client.UpdateResponder(vVar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request") - } - } - return -} - -// WeeklySchedule weekly Schedule properties, make a snapshot every week at a specific day or days -type WeeklySchedule struct { - // SnapshotsToKeep - Weekly snapshot count to keep - SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` - // Day - Indicates which weekdays snapshot should be taken, accepts a comma separated list of week day names in english - Day *string `json:"day,omitempty"` - // Hour - Indicates which hour in UTC timezone a snapshot should be taken - Hour *int32 `json:"hour,omitempty"` - // Minute - Indicates which minute snapshot should be taken - Minute *int32 `json:"minute,omitempty"` - // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/operations.go deleted file mode 100644 index d903fa2473a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available Microsoft.NetApp Rest API operations -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.NetApp/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/pools.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/pools.go deleted file mode 100644 index 67284b542df..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/pools.go +++ /dev/null @@ -1,550 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification -type PoolsClient struct { - BaseClient -} - -// NewPoolsClient creates an instance of the PoolsClient client. -func NewPoolsClient(subscriptionID string) PoolsClient { - return NewPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPoolsClientWithBaseURI creates an instance of the PoolsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewPoolsClientWithBaseURI(baseURI string, subscriptionID string) PoolsClient { - return PoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update a capacity pool -// Parameters: -// body - capacity pool object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -func (client PoolsClient) CreateOrUpdate(ctx context.Context, body CapacityPool, resourceGroupName string, accountName string, poolName string) (result PoolsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.PoolProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "body.PoolProperties.PoolID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.PoolProperties.PoolID", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "body.PoolProperties.PoolID", Name: validation.MinLength, Rule: 36, Chain: nil}, - {Target: "body.PoolProperties.PoolID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil}, - }}, - {Target: "body.PoolProperties.Size", Name: validation.Null, Rule: true, Chain: nil}, - }}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.PoolsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, body, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PoolsClient) CreateOrUpdatePreparer(ctx context.Context, body CapacityPool, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Etag = nil - body.Type = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PoolsClient) CreateOrUpdateSender(req *http.Request) (future PoolsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PoolsClient) CreateOrUpdateResponder(resp *http.Response) (result CapacityPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the specified capacity pool -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -func (client PoolsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result PoolsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.PoolsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PoolsClient) DeleteSender(req *http.Request) (future PoolsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get details of the specified capacity pool -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -func (client PoolsClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result CapacityPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.PoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PoolsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PoolsClient) GetResponder(resp *http.Response) (result CapacityPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all capacity pools in the NetApp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client PoolsClient) List(ctx context.Context, resourceGroupName string, accountName string) (result CapacityPoolListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.List") - defer func() { - sc := -1 - if result.cpl.Response.Response != nil { - sc = result.cpl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.PoolsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.cpl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "List", resp, "Failure sending request") - return - } - - result.cpl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "List", resp, "Failure responding to request") - return - } - if result.cpl.hasNextLink() && result.cpl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PoolsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PoolsClient) ListResponder(resp *http.Response) (result CapacityPoolList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client PoolsClient) listNextResults(ctx context.Context, lastResults CapacityPoolList) (result CapacityPoolList, err error) { - req, err := lastResults.capacityPoolListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "netapp.PoolsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "netapp.PoolsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PoolsClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string) (result CapacityPoolListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, accountName) - return -} - -// Update patch the specified capacity pool -// Parameters: -// body - capacity pool object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -func (client PoolsClient) Update(ctx context.Context, body CapacityPoolPatch, resourceGroupName string, accountName string, poolName string) (result PoolsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.PoolsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PoolsClient) UpdatePreparer(ctx context.Context, body CapacityPoolPatch, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client PoolsClient) UpdateSender(req *http.Request) (future PoolsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client PoolsClient) UpdateResponder(resp *http.Response) (result CapacityPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/resource.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/resource.go deleted file mode 100644 index c2e42cc2ad2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/resource.go +++ /dev/null @@ -1,284 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ResourceClient is the microsoft NetApp Files Azure Resource Provider specification -type ResourceClient struct { - BaseClient -} - -// NewResourceClient creates an instance of the ResourceClient client. -func NewResourceClient(subscriptionID string) ResourceClient { - return NewResourceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewResourceClientWithBaseURI creates an instance of the ResourceClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewResourceClientWithBaseURI(baseURI string, subscriptionID string) ResourceClient { - return ResourceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckFilePathAvailability check if a file path is available. -// Parameters: -// body - file path availability request. -// location - the location -func (client ResourceClient) CheckFilePathAvailability(ctx context.Context, body FilePathAvailabilityRequest, location string) (result CheckAvailabilityResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceClient.CheckFilePathAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.SubnetID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.ResourceClient", "CheckFilePathAvailability", err.Error()) - } - - req, err := client.CheckFilePathAvailabilityPreparer(ctx, body, location) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckFilePathAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckFilePathAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckFilePathAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckFilePathAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckFilePathAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckFilePathAvailabilityPreparer prepares the CheckFilePathAvailability request. -func (client ResourceClient) CheckFilePathAvailabilityPreparer(ctx context.Context, body FilePathAvailabilityRequest, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckFilePathAvailabilitySender sends the CheckFilePathAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) CheckFilePathAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckFilePathAvailabilityResponder handles the response to the CheckFilePathAvailability request. The method always -// closes the http.Response Body. -func (client ResourceClient) CheckFilePathAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CheckNameAvailability check if a resource name is available. -// Parameters: -// body - name availability request. -// location - the location -func (client ResourceClient) CheckNameAvailability(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (result CheckAvailabilityResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceClient.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.ResourceGroup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.ResourceClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, body, location) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ResourceClient) CheckNameAvailabilityPreparer(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client ResourceClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CheckQuotaAvailability check if a quota is available. -// Parameters: -// body - quota availability request. -// location - the location -func (client ResourceClient) CheckQuotaAvailability(ctx context.Context, body QuotaAvailabilityRequest, location string) (result CheckAvailabilityResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceClient.CheckQuotaAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.ResourceGroup", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.ResourceClient", "CheckQuotaAvailability", err.Error()) - } - - req, err := client.CheckQuotaAvailabilityPreparer(ctx, body, location) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckQuotaAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckQuotaAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckQuotaAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckQuotaAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckQuotaAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckQuotaAvailabilityPreparer prepares the CheckQuotaAvailability request. -func (client ResourceClient) CheckQuotaAvailabilityPreparer(ctx context.Context, body QuotaAvailabilityRequest, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckQuotaAvailabilitySender sends the CheckQuotaAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) CheckQuotaAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckQuotaAvailabilityResponder handles the response to the CheckQuotaAvailability request. The method always -// closes the http.Response Body. -func (client ResourceClient) CheckQuotaAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/resourcequotalimits.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/resourcequotalimits.go deleted file mode 100644 index 0cd8f587e0b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/resourcequotalimits.go +++ /dev/null @@ -1,182 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ResourceQuotaLimitsClient is the microsoft NetApp Files Azure Resource Provider specification -type ResourceQuotaLimitsClient struct { - BaseClient -} - -// NewResourceQuotaLimitsClient creates an instance of the ResourceQuotaLimitsClient client. -func NewResourceQuotaLimitsClient(subscriptionID string) ResourceQuotaLimitsClient { - return NewResourceQuotaLimitsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewResourceQuotaLimitsClientWithBaseURI creates an instance of the ResourceQuotaLimitsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewResourceQuotaLimitsClientWithBaseURI(baseURI string, subscriptionID string) ResourceQuotaLimitsClient { - return ResourceQuotaLimitsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the default and current subscription quota limit -// Parameters: -// location - the location -// quotaLimitName - the name of the Quota Limit -func (client ResourceQuotaLimitsClient) Get(ctx context.Context, location string, quotaLimitName string) (result SubscriptionQuotaItem, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceQuotaLimitsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, location, quotaLimitName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceQuotaLimitsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.ResourceQuotaLimitsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceQuotaLimitsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ResourceQuotaLimitsClient) GetPreparer(ctx context.Context, location string, quotaLimitName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "quotaLimitName": autorest.Encode("path", quotaLimitName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceQuotaLimitsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ResourceQuotaLimitsClient) GetResponder(resp *http.Response) (result SubscriptionQuotaItem, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get the default and current limits for quotas -// Parameters: -// location - the location -func (client ResourceQuotaLimitsClient) List(ctx context.Context, location string) (result SubscriptionQuotaItemList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceQuotaLimitsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceQuotaLimitsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.ResourceQuotaLimitsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceQuotaLimitsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ResourceQuotaLimitsClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceQuotaLimitsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ResourceQuotaLimitsClient) ListResponder(resp *http.Response) (result SubscriptionQuotaItemList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/snapshotpolicies.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/snapshotpolicies.go deleted file mode 100644 index 365057c6955..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/snapshotpolicies.go +++ /dev/null @@ -1,569 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SnapshotPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification -type SnapshotPoliciesClient struct { - BaseClient -} - -// NewSnapshotPoliciesClient creates an instance of the SnapshotPoliciesClient client. -func NewSnapshotPoliciesClient(subscriptionID string) SnapshotPoliciesClient { - return NewSnapshotPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSnapshotPoliciesClientWithBaseURI creates an instance of the SnapshotPoliciesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewSnapshotPoliciesClientWithBaseURI(baseURI string, subscriptionID string) SnapshotPoliciesClient { - return SnapshotPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a snapshot policy -// Parameters: -// body - snapshot policy object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// snapshotPolicyName - the name of the snapshot policy -func (client SnapshotPoliciesClient) Create(ctx context.Context, body SnapshotPolicy, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.SnapshotPolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotPoliciesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, body, resourceGroupName, accountName, snapshotPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SnapshotPoliciesClient) CreatePreparer(ctx context.Context, body SnapshotPolicy, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Etag = nil - body.Type = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotPoliciesClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client SnapshotPoliciesClient) CreateResponder(resp *http.Response) (result SnapshotPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete snapshot policy -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// snapshotPolicyName - the name of the snapshot policy -func (client SnapshotPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPoliciesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotPoliciesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, snapshotPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SnapshotPoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotPoliciesClient) DeleteSender(req *http.Request) (future SnapshotPoliciesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SnapshotPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a snapshot Policy -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// snapshotPolicyName - the name of the snapshot policy -func (client SnapshotPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, snapshotPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SnapshotPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SnapshotPoliciesClient) GetResponder(resp *http.Response) (result SnapshotPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list snapshot policy -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client SnapshotPoliciesClient) List(ctx context.Context, resourceGroupName string, accountName string) (result SnapshotPoliciesList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotPoliciesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SnapshotPoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotPoliciesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SnapshotPoliciesClient) ListResponder(resp *http.Response) (result SnapshotPoliciesList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListVolumes get volumes associated with snapshot policy -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// snapshotPolicyName - the name of the snapshot policy -func (client SnapshotPoliciesClient) ListVolumes(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPolicyVolumeList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.ListVolumes") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotPoliciesClient", "ListVolumes", err.Error()) - } - - req, err := client.ListVolumesPreparer(ctx, resourceGroupName, accountName, snapshotPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "ListVolumes", nil, "Failure preparing request") - return - } - - resp, err := client.ListVolumesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "ListVolumes", resp, "Failure sending request") - return - } - - result, err = client.ListVolumesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "ListVolumes", resp, "Failure responding to request") - return - } - - return -} - -// ListVolumesPreparer prepares the ListVolumes request. -func (client SnapshotPoliciesClient) ListVolumesPreparer(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListVolumesSender sends the ListVolumes request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotPoliciesClient) ListVolumesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListVolumesResponder handles the response to the ListVolumes request. The method always -// closes the http.Response Body. -func (client SnapshotPoliciesClient) ListVolumesResponder(resp *http.Response) (result SnapshotPolicyVolumeList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update patch a snapshot policy -// Parameters: -// body - snapshot policy object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// snapshotPolicyName - the name of the snapshot policy -func (client SnapshotPoliciesClient) Update(ctx context.Context, body SnapshotPolicyPatch, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPoliciesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotPoliciesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, snapshotPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SnapshotPoliciesClient) UpdatePreparer(ctx context.Context, body SnapshotPolicyPatch, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotPoliciesClient) UpdateSender(req *http.Request) (future SnapshotPoliciesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SnapshotPoliciesClient) UpdateResponder(resp *http.Response) (result SnapshotPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/snapshots.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/snapshots.go deleted file mode 100644 index d225f05633b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/snapshots.go +++ /dev/null @@ -1,654 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification -type SnapshotsClient struct { - BaseClient -} - -// NewSnapshotsClient creates an instance of the SnapshotsClient client. -func NewSnapshotsClient(subscriptionID string) SnapshotsClient { - return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient { - return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create the specified snapshot within the given volume -// Parameters: -// body - snapshot object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// snapshotName - the name of the snapshot -func (client SnapshotsClient) Create(ctx context.Context, body Snapshot, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result SnapshotsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.SnapshotProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.SnapshotProperties.SnapshotID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.SnapshotProperties.SnapshotID", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "body.SnapshotProperties.SnapshotID", Name: validation.MinLength, Rule: 36, Chain: nil}, - {Target: "body.SnapshotProperties.SnapshotID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil}, - }}, - }}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName, snapshotName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SnapshotsClient) CreatePreparer(ctx context.Context, body Snapshot, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) CreateSender(req *http.Request) (future SnapshotsCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) CreateResponder(resp *http.Response) (result Snapshot, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete snapshot -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// snapshotName - the name of the snapshot -func (client SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result SnapshotsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) DeleteSender(req *http.Request) (future SnapshotsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get details of the specified snapshot -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// snapshotName - the name of the snapshot -func (client SnapshotsClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result Snapshot, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all snapshots associated with the volume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -func (client SnapshotsClient) List(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result SnapshotsList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SnapshotsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotsList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RestoreFiles restore the specified files from the specified snapshot to the active filesystem -// Parameters: -// body - restore payload supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// snapshotName - the name of the snapshot -func (client SnapshotsClient) RestoreFiles(ctx context.Context, body SnapshotRestoreFiles, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result SnapshotsRestoreFilesFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.RestoreFiles") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.FilePaths", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "body.FilePaths", Name: validation.MaxItems, Rule: 10, Chain: nil}, - {Target: "body.FilePaths", Name: validation.MinItems, Rule: 1, Chain: nil}, - }}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotsClient", "RestoreFiles", err.Error()) - } - - req, err := client.RestoreFilesPreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName, snapshotName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "RestoreFiles", nil, "Failure preparing request") - return - } - - result, err = client.RestoreFilesSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "RestoreFiles", result.Response(), "Failure sending request") - return - } - - return -} - -// RestoreFilesPreparer prepares the RestoreFiles request. -func (client SnapshotsClient) RestoreFilesPreparer(ctx context.Context, body SnapshotRestoreFiles, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RestoreFilesSender sends the RestoreFiles request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) RestoreFilesSender(req *http.Request) (future SnapshotsRestoreFilesFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RestoreFilesResponder handles the response to the RestoreFiles request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) RestoreFilesResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update patch a snapshot -// Parameters: -// body - snapshot object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// snapshotName - the name of the snapshot -func (client SnapshotsClient) Update(ctx context.Context, body interface{}, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result SnapshotsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName, snapshotName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SnapshotsClient) UpdatePreparer(ctx context.Context, body interface{}, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) UpdateSender(req *http.Request) (future SnapshotsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) UpdateResponder(resp *http.Response) (result Snapshot, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/subvolumes.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/subvolumes.go deleted file mode 100644 index 54cec7e712e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/subvolumes.go +++ /dev/null @@ -1,698 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SubvolumesClient is the microsoft NetApp Files Azure Resource Provider specification -type SubvolumesClient struct { - BaseClient -} - -// NewSubvolumesClient creates an instance of the SubvolumesClient client. -func NewSubvolumesClient(subscriptionID string) SubvolumesClient { - return NewSubvolumesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubvolumesClientWithBaseURI creates an instance of the SubvolumesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSubvolumesClientWithBaseURI(baseURI string, subscriptionID string) SubvolumesClient { - return SubvolumesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a subvolume in the path or clones the subvolume mentioned in the parentPath -// Parameters: -// body - subvolume object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// subvolumeName - the name of the subvolume. -func (client SubvolumesClient) Create(ctx context.Context, body SubvolumeInfo, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string) (result SubvolumesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: subvolumeName, - Constraints: []validation.Constraint{{Target: "subvolumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "subvolumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "subvolumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SubvolumesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName, subvolumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SubvolumesClient) CreatePreparer(ctx context.Context, body SubvolumeInfo, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "subvolumeName": autorest.Encode("path", subvolumeName), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client SubvolumesClient) CreateSender(req *http.Request) (future SubvolumesCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client SubvolumesClient) CreateResponder(resp *http.Response) (result SubvolumeInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete subvolume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// subvolumeName - the name of the subvolume. -func (client SubvolumesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string) (result SubvolumesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: subvolumeName, - Constraints: []validation.Constraint{{Target: "subvolumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "subvolumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "subvolumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SubvolumesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, subvolumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SubvolumesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "subvolumeName": autorest.Encode("path", subvolumeName), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SubvolumesClient) DeleteSender(req *http.Request) (future SubvolumesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SubvolumesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns the path associated with the subvolumeName provided -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// subvolumeName - the name of the subvolume. -func (client SubvolumesClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string) (result SubvolumeInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: subvolumeName, - Constraints: []validation.Constraint{{Target: "subvolumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "subvolumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "subvolumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SubvolumesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, subvolumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SubvolumesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "subvolumeName": autorest.Encode("path", subvolumeName), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SubvolumesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SubvolumesClient) GetResponder(resp *http.Response) (result SubvolumeInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMetadata get details of the specified subvolume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// subvolumeName - the name of the subvolume. -func (client SubvolumesClient) GetMetadata(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string) (result SubvolumesGetMetadataFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesClient.GetMetadata") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: subvolumeName, - Constraints: []validation.Constraint{{Target: "subvolumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "subvolumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "subvolumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SubvolumesClient", "GetMetadata", err.Error()) - } - - req, err := client.GetMetadataPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, subvolumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "GetMetadata", nil, "Failure preparing request") - return - } - - result, err = client.GetMetadataSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "GetMetadata", result.Response(), "Failure sending request") - return - } - - return -} - -// GetMetadataPreparer prepares the GetMetadata request. -func (client SubvolumesClient) GetMetadataPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "subvolumeName": autorest.Encode("path", subvolumeName), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}/getMetadata", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMetadataSender sends the GetMetadata request. The method will close the -// http.Response Body if it receives an error. -func (client SubvolumesClient) GetMetadataSender(req *http.Request) (future SubvolumesGetMetadataFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// GetMetadataResponder handles the response to the GetMetadata request. The method always -// closes the http.Response Body. -func (client SubvolumesClient) GetMetadataResponder(resp *http.Response) (result SubvolumeModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByVolume returns a list of the subvolumes in the volume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -func (client SubvolumesClient) ListByVolume(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result SubvolumesListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesClient.ListByVolume") - defer func() { - sc := -1 - if result.sl.Response.Response != nil { - sc = result.sl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SubvolumesClient", "ListByVolume", err.Error()) - } - - result.fn = client.listByVolumeNextResults - req, err := client.ListByVolumePreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "ListByVolume", nil, "Failure preparing request") - return - } - - resp, err := client.ListByVolumeSender(req) - if err != nil { - result.sl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "ListByVolume", resp, "Failure sending request") - return - } - - result.sl, err = client.ListByVolumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "ListByVolume", resp, "Failure responding to request") - return - } - if result.sl.hasNextLink() && result.sl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByVolumePreparer prepares the ListByVolume request. -func (client SubvolumesClient) ListByVolumePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByVolumeSender sends the ListByVolume request. The method will close the -// http.Response Body if it receives an error. -func (client SubvolumesClient) ListByVolumeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByVolumeResponder handles the response to the ListByVolume request. The method always -// closes the http.Response Body. -func (client SubvolumesClient) ListByVolumeResponder(resp *http.Response) (result SubvolumesList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByVolumeNextResults retrieves the next set of results, if any. -func (client SubvolumesClient) listByVolumeNextResults(ctx context.Context, lastResults SubvolumesList) (result SubvolumesList, err error) { - req, err := lastResults.subvolumesListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "listByVolumeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByVolumeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "listByVolumeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByVolumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "listByVolumeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByVolumeComplete enumerates all values, automatically crossing page boundaries as required. -func (client SubvolumesClient) ListByVolumeComplete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result SubvolumesListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesClient.ListByVolume") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByVolume(ctx, resourceGroupName, accountName, poolName, volumeName) - return -} - -// Update patch a subvolume -// Parameters: -// body - subvolume object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// subvolumeName - the name of the subvolume. -func (client SubvolumesClient) Update(ctx context.Context, body SubvolumePatchRequest, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string) (result SubvolumesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: subvolumeName, - Constraints: []validation.Constraint{{Target: "subvolumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "subvolumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "subvolumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SubvolumesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName, subvolumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SubvolumesClient) UpdatePreparer(ctx context.Context, body SubvolumePatchRequest, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "subvolumeName": autorest.Encode("path", subvolumeName), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SubvolumesClient) UpdateSender(req *http.Request) (future SubvolumesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SubvolumesClient) UpdateResponder(resp *http.Response) (result SubvolumeInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/vaults.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/vaults.go deleted file mode 100644 index ee3222d1744..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/vaults.go +++ /dev/null @@ -1,116 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VaultsClient is the microsoft NetApp Files Azure Resource Provider specification -type VaultsClient struct { - BaseClient -} - -// NewVaultsClient creates an instance of the VaultsClient client. -func NewVaultsClient(subscriptionID string) VaultsClient { - return NewVaultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVaultsClientWithBaseURI creates an instance of the VaultsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewVaultsClientWithBaseURI(baseURI string, subscriptionID string) VaultsClient { - return VaultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list vaults for a Netapp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client VaultsClient) List(ctx context.Context, resourceGroupName string, accountName string) (result VaultList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VaultsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VaultsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.VaultsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VaultsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client VaultsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/vaults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VaultsClient) ListResponder(resp *http.Response) (result VaultList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/version.go deleted file mode 100644 index d254f8bece8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package netapp - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " netapp/2021-10-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/volumegroups.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/volumegroups.go deleted file mode 100644 index 65bc0539bda..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/volumegroups.go +++ /dev/null @@ -1,397 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VolumeGroupsClient is the microsoft NetApp Files Azure Resource Provider specification -type VolumeGroupsClient struct { - BaseClient -} - -// NewVolumeGroupsClient creates an instance of the VolumeGroupsClient client. -func NewVolumeGroupsClient(subscriptionID string) VolumeGroupsClient { - return NewVolumeGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVolumeGroupsClientWithBaseURI creates an instance of the VolumeGroupsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewVolumeGroupsClientWithBaseURI(baseURI string, subscriptionID string) VolumeGroupsClient { - return VolumeGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a volume group along with specified volumes -// Parameters: -// body - volume Group object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// volumeGroupName - the name of the volumeGroup -func (client VolumeGroupsClient) Create(ctx context.Context, body VolumeGroupDetails, resourceGroupName string, accountName string, volumeGroupName string) (result VolumeGroupsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumeGroupsClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: volumeGroupName, - Constraints: []validation.Constraint{{Target: "volumeGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumeGroupsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, body, resourceGroupName, accountName, volumeGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client VolumeGroupsClient) CreatePreparer(ctx context.Context, body VolumeGroupDetails, resourceGroupName string, accountName string, volumeGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeGroupName": autorest.Encode("path", volumeGroupName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client VolumeGroupsClient) CreateSender(req *http.Request) (future VolumeGroupsCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client VolumeGroupsClient) CreateResponder(resp *http.Response) (result VolumeGroupDetails, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the specified volume group only if there are no volumes under volume group. -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// volumeGroupName - the name of the volumeGroup -func (client VolumeGroupsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string) (result VolumeGroupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumeGroupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: volumeGroupName, - Constraints: []validation.Constraint{{Target: "volumeGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumeGroupsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, volumeGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VolumeGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeGroupName": autorest.Encode("path", volumeGroupName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VolumeGroupsClient) DeleteSender(req *http.Request) (future VolumeGroupsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VolumeGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get details of the specified volume group -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// volumeGroupName - the name of the volumeGroup -func (client VolumeGroupsClient) Get(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string) (result VolumeGroupDetails, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumeGroupsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: volumeGroupName, - Constraints: []validation.Constraint{{Target: "volumeGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumeGroupsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, volumeGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VolumeGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeGroupName": autorest.Encode("path", volumeGroupName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VolumeGroupsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VolumeGroupsClient) GetResponder(resp *http.Response) (result VolumeGroupDetails, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByNetAppAccount list all volume groups for given account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client VolumeGroupsClient) ListByNetAppAccount(ctx context.Context, resourceGroupName string, accountName string) (result VolumeGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumeGroupsClient.ListByNetAppAccount") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumeGroupsClient", "ListByNetAppAccount", err.Error()) - } - - req, err := client.ListByNetAppAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "ListByNetAppAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNetAppAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "ListByNetAppAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByNetAppAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "ListByNetAppAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByNetAppAccountPreparer prepares the ListByNetAppAccount request. -func (client VolumeGroupsClient) ListByNetAppAccountPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNetAppAccountSender sends the ListByNetAppAccount request. The method will close the -// http.Response Body if it receives an error. -func (client VolumeGroupsClient) ListByNetAppAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNetAppAccountResponder handles the response to the ListByNetAppAccount request. The method always -// closes the http.Response Body. -func (client VolumeGroupsClient) ListByNetAppAccountResponder(resp *http.Response) (result VolumeGroupList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/volumes.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/volumes.go deleted file mode 100644 index 11016cd3a95..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/volumes.go +++ /dev/null @@ -1,1422 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification -type VolumesClient struct { - BaseClient -} - -// NewVolumesClient creates an instance of the VolumesClient client. -func NewVolumesClient(subscriptionID string) VolumesClient { - return NewVolumesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVolumesClientWithBaseURI creates an instance of the VolumesClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewVolumesClientWithBaseURI(baseURI string, subscriptionID string) VolumesClient { - return VolumesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// AuthorizeReplication authorize the replication connection on the source volume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// body - authorize request object supplied in the body of the operation. -func (client VolumesClient) AuthorizeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body AuthorizeRequest) (result VolumesAuthorizeReplicationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.AuthorizeReplication") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "AuthorizeReplication", err.Error()) - } - - req, err := client.AuthorizeReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "AuthorizeReplication", nil, "Failure preparing request") - return - } - - result, err = client.AuthorizeReplicationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "AuthorizeReplication", result.Response(), "Failure sending request") - return - } - - return -} - -// AuthorizeReplicationPreparer prepares the AuthorizeReplication request. -func (client VolumesClient) AuthorizeReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body AuthorizeRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AuthorizeReplicationSender sends the AuthorizeReplication request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) AuthorizeReplicationSender(req *http.Request) (future VolumesAuthorizeReplicationFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// AuthorizeReplicationResponder handles the response to the AuthorizeReplication request. The method always -// closes the http.Response Body. -func (client VolumesClient) AuthorizeReplicationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// BreakReplication break the replication connection on the destination volume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// body - optional body to force break the replication. -func (client VolumesClient) BreakReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body *BreakReplicationRequest) (result VolumesBreakReplicationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.BreakReplication") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "BreakReplication", err.Error()) - } - - req, err := client.BreakReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "BreakReplication", nil, "Failure preparing request") - return - } - - result, err = client.BreakReplicationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "BreakReplication", result.Response(), "Failure sending request") - return - } - - return -} - -// BreakReplicationPreparer prepares the BreakReplication request. -func (client VolumesClient) BreakReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body *BreakReplicationRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// BreakReplicationSender sends the BreakReplication request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) BreakReplicationSender(req *http.Request) (future VolumesBreakReplicationFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// BreakReplicationResponder handles the response to the BreakReplication request. The method always -// closes the http.Response Body. -func (client VolumesClient) BreakReplicationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateOrUpdate create or update the specified volume within the capacity pool -// Parameters: -// body - volume object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -func (client VolumesClient) CreateOrUpdate(ctx context.Context, body Volume, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.VolumeProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.FileSystemID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.FileSystemID", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.FileSystemID", Name: validation.MinLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.FileSystemID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil}, - }}, - {Target: "body.VolumeProperties.CreationToken", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.CreationToken", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "body.VolumeProperties.CreationToken", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "body.VolumeProperties.CreationToken", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-]{0,79}$`, Chain: nil}, - }}, - {Target: "body.VolumeProperties.UsageThreshold", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.UsageThreshold", Name: validation.InclusiveMaximum, Rule: int64(109951162777600), Chain: nil}, - {Target: "body.VolumeProperties.UsageThreshold", Name: validation.InclusiveMinimum, Rule: int64(107374182400), Chain: nil}, - }}, - {Target: "body.VolumeProperties.SnapshotID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.SnapshotID", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.SnapshotID", Name: validation.MinLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.SnapshotID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}|(\\?([^\/]*[\/])*)([^\/]+)$`, Chain: nil}, - }}, - {Target: "body.VolumeProperties.BackupID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.BackupID", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.BackupID", Name: validation.MinLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.BackupID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}|(\\?([^\/]*[\/])*)([^\/]+)$`, Chain: nil}, - }}, - {Target: "body.VolumeProperties.SubnetID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.VolumeProperties.NetworkSiblingSetID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.NetworkSiblingSetID", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.NetworkSiblingSetID", Name: validation.MinLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.NetworkSiblingSetID", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$`, Chain: nil}, - }}, - {Target: "body.VolumeProperties.DataProtection", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.DataProtection.Replication", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.DataProtection.Replication.RemoteVolumeResourceID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}, - {Target: "body.VolumeProperties.CoolnessPeriod", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.CoolnessPeriod", Name: validation.InclusiveMaximum, Rule: int64(63), Chain: nil}, - {Target: "body.VolumeProperties.CoolnessPeriod", Name: validation.InclusiveMinimum, Rule: int64(7), Chain: nil}, - }}, - {Target: "body.VolumeProperties.UnixPermissions", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.UnixPermissions", Name: validation.MaxLength, Rule: 4, Chain: nil}, - {Target: "body.VolumeProperties.UnixPermissions", Name: validation.MinLength, Rule: 4, Chain: nil}, - }}, - }}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VolumesClient) CreateOrUpdatePreparer(ctx context.Context, body Volume, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Etag = nil - body.Type = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) CreateOrUpdateSender(req *http.Request) (future VolumesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VolumesClient) CreateOrUpdateResponder(resp *http.Response) (result Volume, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the specified volume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// forceDelete - an option to force delete the volume. Will cleanup resources connected to the particular -// volume -func (client VolumesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, forceDelete *bool) (result VolumesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, forceDelete) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VolumesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, forceDelete *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if forceDelete != nil { - queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) DeleteSender(req *http.Request) (future VolumesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VolumesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteReplication delete the replication connection on the destination volume, and send release to the source -// replication -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -func (client VolumesClient) DeleteReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesDeleteReplicationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.DeleteReplication") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "DeleteReplication", err.Error()) - } - - req, err := client.DeleteReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "DeleteReplication", nil, "Failure preparing request") - return - } - - result, err = client.DeleteReplicationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "DeleteReplication", result.Response(), "Failure sending request") - return - } - - return -} - -// DeleteReplicationPreparer prepares the DeleteReplication request. -func (client VolumesClient) DeleteReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteReplicationSender sends the DeleteReplication request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) DeleteReplicationSender(req *http.Request) (future VolumesDeleteReplicationFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteReplicationResponder handles the response to the DeleteReplication request. The method always -// closes the http.Response Body. -func (client VolumesClient) DeleteReplicationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the details of the specified volume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -func (client VolumesClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result Volume, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VolumesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VolumesClient) GetResponder(resp *http.Response) (result Volume, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all volumes within the capacity pool -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -func (client VolumesClient) List(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result VolumeListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.List") - defer func() { - sc := -1 - if result.vl.Response.Response != nil { - sc = result.vl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.vl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "List", resp, "Failure sending request") - return - } - - result.vl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "List", resp, "Failure responding to request") - return - } - if result.vl.hasNextLink() && result.vl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client VolumesClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VolumesClient) ListResponder(resp *http.Response) (result VolumeList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client VolumesClient) listNextResults(ctx context.Context, lastResults VolumeList) (result VolumeList, err error) { - req, err := lastResults.volumeListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "netapp.VolumesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "netapp.VolumesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client VolumesClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result VolumeListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, accountName, poolName) - return -} - -// PoolChange moves volume to another pool -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// body - move volume to the pool supplied in the body of the operation. -func (client VolumesClient) PoolChange(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body PoolChangeRequest) (result VolumesPoolChangeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.PoolChange") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.NewPoolResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "PoolChange", err.Error()) - } - - req, err := client.PoolChangePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "PoolChange", nil, "Failure preparing request") - return - } - - result, err = client.PoolChangeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "PoolChange", result.Response(), "Failure sending request") - return - } - - return -} - -// PoolChangePreparer prepares the PoolChange request. -func (client VolumesClient) PoolChangePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body PoolChangeRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PoolChangeSender sends the PoolChange request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) PoolChangeSender(req *http.Request) (future VolumesPoolChangeFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// PoolChangeResponder handles the response to the PoolChange request. The method always -// closes the http.Response Body. -func (client VolumesClient) PoolChangeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ReInitializeReplication re-Initializes the replication connection on the destination volume -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -func (client VolumesClient) ReInitializeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesReInitializeReplicationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ReInitializeReplication") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "ReInitializeReplication", err.Error()) - } - - req, err := client.ReInitializeReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReInitializeReplication", nil, "Failure preparing request") - return - } - - result, err = client.ReInitializeReplicationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReInitializeReplication", result.Response(), "Failure sending request") - return - } - - return -} - -// ReInitializeReplicationPreparer prepares the ReInitializeReplication request. -func (client VolumesClient) ReInitializeReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ReInitializeReplicationSender sends the ReInitializeReplication request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) ReInitializeReplicationSender(req *http.Request) (future VolumesReInitializeReplicationFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ReInitializeReplicationResponder handles the response to the ReInitializeReplication request. The method always -// closes the http.Response Body. -func (client VolumesClient) ReInitializeReplicationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ReplicationStatusMethod get the status of the replication -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -func (client VolumesClient) ReplicationStatusMethod(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result ReplicationStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ReplicationStatusMethod") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "ReplicationStatusMethod", err.Error()) - } - - req, err := client.ReplicationStatusMethodPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReplicationStatusMethod", nil, "Failure preparing request") - return - } - - resp, err := client.ReplicationStatusMethodSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReplicationStatusMethod", resp, "Failure sending request") - return - } - - result, err = client.ReplicationStatusMethodResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReplicationStatusMethod", resp, "Failure responding to request") - return - } - - return -} - -// ReplicationStatusMethodPreparer prepares the ReplicationStatusMethod request. -func (client VolumesClient) ReplicationStatusMethodPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ReplicationStatusMethodSender sends the ReplicationStatusMethod request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) ReplicationStatusMethodSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ReplicationStatusMethodResponder handles the response to the ReplicationStatusMethod request. The method always -// closes the http.Response Body. -func (client VolumesClient) ReplicationStatusMethodResponder(resp *http.Response) (result ReplicationStatus, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ResyncReplication resync the connection on the destination volume. If the operation is ran on the source volume it -// will reverse-resync the connection and sync from destination to source. -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -func (client VolumesClient) ResyncReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesResyncReplicationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ResyncReplication") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "ResyncReplication", err.Error()) - } - - req, err := client.ResyncReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ResyncReplication", nil, "Failure preparing request") - return - } - - result, err = client.ResyncReplicationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ResyncReplication", result.Response(), "Failure sending request") - return - } - - return -} - -// ResyncReplicationPreparer prepares the ResyncReplication request. -func (client VolumesClient) ResyncReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ResyncReplicationSender sends the ResyncReplication request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) ResyncReplicationSender(req *http.Request) (future VolumesResyncReplicationFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ResyncReplicationResponder handles the response to the ResyncReplication request. The method always -// closes the http.Response Body. -func (client VolumesClient) ResyncReplicationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Revert revert a volume to the snapshot specified in the body -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -// body - object for snapshot to revert supplied in the body of the operation. -func (client VolumesClient) Revert(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumeRevert) (result VolumesRevertFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Revert") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "Revert", err.Error()) - } - - req, err := client.RevertPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Revert", nil, "Failure preparing request") - return - } - - result, err = client.RevertSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Revert", result.Response(), "Failure sending request") - return - } - - return -} - -// RevertPreparer prepares the Revert request. -func (client VolumesClient) RevertPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumeRevert) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RevertSender sends the Revert request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) RevertSender(req *http.Request) (future VolumesRevertFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RevertResponder handles the response to the Revert request. The method always -// closes the http.Response Body. -func (client VolumesClient) RevertResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update patch the specified volume -// Parameters: -// body - volume object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -func (client VolumesClient) Update(ctx context.Context, body VolumePatch, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VolumesClient) UpdatePreparer(ctx context.Context, body VolumePatch, resourceGroupName string, accountName string, poolName string, volumeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) UpdateSender(req *http.Request) (future VolumesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client VolumesClient) UpdateResponder(resp *http.Response) (result Volume, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/CHANGELOG.md deleted file mode 100644 index 082db3aba3b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/CHANGELOG.md +++ /dev/null @@ -1,40 +0,0 @@ -# Change History - -## Breaking Changes - -### Removed Constants - -1. AccessRights.Listen -1. AccessRights.Manage -1. AccessRights.SendEnumValue -1. NamespaceType.Messaging -1. NamespaceType.NotificationHub -1. SkuName.Basic -1. SkuName.Free -1. SkuName.Standard - -### Signature Changes - -#### Funcs - -1. NamespacesClient.ListKeys - - Returns - - From: SharedAccessAuthorizationRuleListResult, error - - To: ResourceListKeys, error -1. NamespacesClient.ListKeysResponder - - Returns - - From: SharedAccessAuthorizationRuleListResult, error - - To: ResourceListKeys, error - -## Additive Changes - -### New Constants - -1. AccessRights.AccessRightsListen -1. AccessRights.AccessRightsManage -1. AccessRights.AccessRightsSend -1. NamespaceType.NamespaceTypeMessaging -1. NamespaceType.NamespaceTypeNotificationHub -1. SkuName.SkuNameBasic -1. SkuName.SkuNameFree -1. SkuName.SkuNameStandard diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/_meta.json deleted file mode 100644 index 74286a9a4c2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "81ab10cd9d46a85258b710c6150ec48021c6d202", - "readme": "/_/azure-rest-api-specs/specification/notificationhubs/resource-manager/readme.md", - "tag": "package-2017-04", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2017-04 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/notificationhubs/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/client.go deleted file mode 100644 index 6ba01a65abd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package notificationhubs implements the Azure ARM Notificationhubs service API version 2017-04-01. -// -// Azure NotificationHub client -package notificationhubs - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Notificationhubs - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Notificationhubs. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/enums.go deleted file mode 100644 index 883ea250dd5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/enums.go +++ /dev/null @@ -1,56 +0,0 @@ -package notificationhubs - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AccessRights enumerates the values for access rights. -type AccessRights string - -const ( - // AccessRightsListen ... - AccessRightsListen AccessRights = "Listen" - // AccessRightsManage ... - AccessRightsManage AccessRights = "Manage" - // AccessRightsSend ... - AccessRightsSend AccessRights = "Send" -) - -// PossibleAccessRightsValues returns an array of possible values for the AccessRights const type. -func PossibleAccessRightsValues() []AccessRights { - return []AccessRights{AccessRightsListen, AccessRightsManage, AccessRightsSend} -} - -// NamespaceType enumerates the values for namespace type. -type NamespaceType string - -const ( - // NamespaceTypeMessaging ... - NamespaceTypeMessaging NamespaceType = "Messaging" - // NamespaceTypeNotificationHub ... - NamespaceTypeNotificationHub NamespaceType = "NotificationHub" -) - -// PossibleNamespaceTypeValues returns an array of possible values for the NamespaceType const type. -func PossibleNamespaceTypeValues() []NamespaceType { - return []NamespaceType{NamespaceTypeMessaging, NamespaceTypeNotificationHub} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // SkuNameBasic ... - SkuNameBasic SkuName = "Basic" - // SkuNameFree ... - SkuNameFree SkuName = "Free" - // SkuNameStandard ... - SkuNameStandard SkuName = "Standard" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{SkuNameBasic, SkuNameFree, SkuNameStandard} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/models.go deleted file mode 100644 index 76d0e1dc36a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/models.go +++ /dev/null @@ -1,2298 +0,0 @@ -package notificationhubs - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs" - -// AdmCredential description of a NotificationHub AdmCredential. -type AdmCredential struct { - // AdmCredentialProperties - Properties of NotificationHub AdmCredential. - *AdmCredentialProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AdmCredential. -func (ac AdmCredential) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ac.AdmCredentialProperties != nil { - objectMap["properties"] = ac.AdmCredentialProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AdmCredential struct. -func (ac *AdmCredential) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var admCredentialProperties AdmCredentialProperties - err = json.Unmarshal(*v, &admCredentialProperties) - if err != nil { - return err - } - ac.AdmCredentialProperties = &admCredentialProperties - } - } - } - - return nil -} - -// AdmCredentialProperties description of a NotificationHub AdmCredential. -type AdmCredentialProperties struct { - // ClientID - The client identifier. - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - The credential secret access key. - ClientSecret *string `json:"clientSecret,omitempty"` - // AuthTokenURL - The URL of the authorization token. - AuthTokenURL *string `json:"authTokenUrl,omitempty"` -} - -// ApnsCredential description of a NotificationHub ApnsCredential. -type ApnsCredential struct { - // ApnsCredentialProperties - Properties of NotificationHub ApnsCredential. - *ApnsCredentialProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApnsCredential. -func (ac ApnsCredential) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ac.ApnsCredentialProperties != nil { - objectMap["properties"] = ac.ApnsCredentialProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApnsCredential struct. -func (ac *ApnsCredential) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var apnsCredentialProperties ApnsCredentialProperties - err = json.Unmarshal(*v, &apnsCredentialProperties) - if err != nil { - return err - } - ac.ApnsCredentialProperties = &apnsCredentialProperties - } - } - } - - return nil -} - -// ApnsCredentialProperties description of a NotificationHub ApnsCredential. Note that there is no explicit -// switch between Certificate and Token Authentication Modes. The mode is determined based on the -// properties passed in. -type ApnsCredentialProperties struct { - // ApnsCertificate - The APNS certificate. Specify if using Certificate Authentication Mode. - ApnsCertificate *string `json:"apnsCertificate,omitempty"` - // CertificateKey - The APNS certificate password if it exists. - CertificateKey *string `json:"certificateKey,omitempty"` - // Endpoint - The APNS endpoint of this credential. If using Certificate Authentication Mode and Sandbox specify 'gateway.sandbox.push.apple.com'. If using Certificate Authentication Mode and Production specify 'gateway.push.apple.com'. If using Token Authentication Mode and Sandbox specify 'https://api.development.push.apple.com:443/3/device'. If using Token Authentication Mode and Production specify 'https://api.push.apple.com:443/3/device'. - Endpoint *string `json:"endpoint,omitempty"` - // Thumbprint - The APNS certificate thumbprint. Specify if using Certificate Authentication Mode. - Thumbprint *string `json:"thumbprint,omitempty"` - // KeyID - A 10-character key identifier (kid) key, obtained from your developer account. Specify if using Token Authentication Mode. - KeyID *string `json:"keyId,omitempty"` - // AppName - The name of the application or BundleId. Specify if using Token Authentication Mode. - AppName *string `json:"appName,omitempty"` - // AppID - The issuer (iss) registered claim key. The value is a 10-character TeamId, obtained from your developer account. Specify if using Token Authentication Mode. - AppID *string `json:"appId,omitempty"` - // Token - Provider Authentication Token, obtained through your developer account. Specify if using Token Authentication Mode. - Token *string `json:"token,omitempty"` -} - -// BaiduCredential description of a NotificationHub BaiduCredential. -type BaiduCredential struct { - // BaiduCredentialProperties - Properties of NotificationHub BaiduCredential. - *BaiduCredentialProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BaiduCredential. -func (bc BaiduCredential) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bc.BaiduCredentialProperties != nil { - objectMap["properties"] = bc.BaiduCredentialProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaiduCredential struct. -func (bc *BaiduCredential) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var baiduCredentialProperties BaiduCredentialProperties - err = json.Unmarshal(*v, &baiduCredentialProperties) - if err != nil { - return err - } - bc.BaiduCredentialProperties = &baiduCredentialProperties - } - } - } - - return nil -} - -// BaiduCredentialProperties description of a NotificationHub BaiduCredential. -type BaiduCredentialProperties struct { - // BaiduAPIKey - Baidu Api Key. - BaiduAPIKey *string `json:"baiduApiKey,omitempty"` - // BaiduEndPoint - Baidu Endpoint. - BaiduEndPoint *string `json:"baiduEndPoint,omitempty"` - // BaiduSecretKey - Baidu Secret Key - BaiduSecretKey *string `json:"baiduSecretKey,omitempty"` -} - -// CheckAvailabilityParameters parameters supplied to the Check Name Availability for Namespace and -// NotificationHubs. -type CheckAvailabilityParameters struct { - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Sku - The sku of the created namespace - Sku *Sku `json:"sku,omitempty"` - // IsAvailiable - True if the name is available and can be used to create new Namespace/NotificationHub. Otherwise false. - IsAvailiable *bool `json:"isAvailiable,omitempty"` -} - -// MarshalJSON is the custom marshaler for CheckAvailabilityParameters. -func (capVar CheckAvailabilityParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if capVar.Name != nil { - objectMap["name"] = capVar.Name - } - if capVar.Location != nil { - objectMap["location"] = capVar.Location - } - if capVar.Tags != nil { - objectMap["tags"] = capVar.Tags - } - if capVar.Sku != nil { - objectMap["sku"] = capVar.Sku - } - if capVar.IsAvailiable != nil { - objectMap["isAvailiable"] = capVar.IsAvailiable - } - return json.Marshal(objectMap) -} - -// CheckAvailabilityResult description of a CheckAvailability resource. -type CheckAvailabilityResult struct { - autorest.Response `json:"-"` - // IsAvailiable - True if the name is available and can be used to create new Namespace/NotificationHub. Otherwise false. - IsAvailiable *bool `json:"isAvailiable,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Sku - The sku of the created namespace - Sku *Sku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for CheckAvailabilityResult. -func (car CheckAvailabilityResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if car.IsAvailiable != nil { - objectMap["isAvailiable"] = car.IsAvailiable - } - if car.Location != nil { - objectMap["location"] = car.Location - } - if car.Tags != nil { - objectMap["tags"] = car.Tags - } - if car.Sku != nil { - objectMap["sku"] = car.Sku - } - return json.Marshal(objectMap) -} - -// CreateOrUpdateParameters parameters supplied to the CreateOrUpdate NotificationHub operation. -type CreateOrUpdateParameters struct { - // Properties - Properties of the NotificationHub. - *Properties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Sku - The sku of the created namespace - Sku *Sku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for CreateOrUpdateParameters. -func (coup CreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if coup.Properties != nil { - objectMap["properties"] = coup.Properties - } - if coup.Location != nil { - objectMap["location"] = coup.Location - } - if coup.Tags != nil { - objectMap["tags"] = coup.Tags - } - if coup.Sku != nil { - objectMap["sku"] = coup.Sku - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CreateOrUpdateParameters struct. -func (coup *CreateOrUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var properties Properties - err = json.Unmarshal(*v, &properties) - if err != nil { - return err - } - coup.Properties = &properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - coup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - coup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - coup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - coup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - coup.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - coup.Sku = &sku - } - } - } - - return nil -} - -// DebugSendResponse description of a NotificationHub Resource. -type DebugSendResponse struct { - autorest.Response `json:"-"` - // DebugSendResult - Properties of the NotificationHub. - *DebugSendResult `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Sku - The sku of the created namespace - Sku *Sku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for DebugSendResponse. -func (dsr DebugSendResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dsr.DebugSendResult != nil { - objectMap["properties"] = dsr.DebugSendResult - } - if dsr.Location != nil { - objectMap["location"] = dsr.Location - } - if dsr.Tags != nil { - objectMap["tags"] = dsr.Tags - } - if dsr.Sku != nil { - objectMap["sku"] = dsr.Sku - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DebugSendResponse struct. -func (dsr *DebugSendResponse) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var debugSendResult DebugSendResult - err = json.Unmarshal(*v, &debugSendResult) - if err != nil { - return err - } - dsr.DebugSendResult = &debugSendResult - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dsr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dsr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dsr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dsr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dsr.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - dsr.Sku = &sku - } - } - } - - return nil -} - -// DebugSendResult ... -type DebugSendResult struct { - // Success - successful send - Success *float64 `json:"success,omitempty"` - // Failure - send failure - Failure *float64 `json:"failure,omitempty"` - // Results - actual failure description - Results interface{} `json:"results,omitempty"` -} - -// ErrorResponse error response indicates NotificationHubs service is not able to process the incoming -// request. The reason is provided in the error message. -type ErrorResponse struct { - // Code - Error code. - Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// GcmCredential description of a NotificationHub GcmCredential. -type GcmCredential struct { - // GcmCredentialProperties - Properties of NotificationHub GcmCredential. - *GcmCredentialProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for GcmCredential. -func (gc GcmCredential) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gc.GcmCredentialProperties != nil { - objectMap["properties"] = gc.GcmCredentialProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for GcmCredential struct. -func (gc *GcmCredential) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var gcmCredentialProperties GcmCredentialProperties - err = json.Unmarshal(*v, &gcmCredentialProperties) - if err != nil { - return err - } - gc.GcmCredentialProperties = &gcmCredentialProperties - } - } - } - - return nil -} - -// GcmCredentialProperties description of a NotificationHub GcmCredential. -type GcmCredentialProperties struct { - // GcmEndpoint - The FCM legacy endpoint. Default value is 'https://fcm.googleapis.com/fcm/send' - GcmEndpoint *string `json:"gcmEndpoint,omitempty"` - // GoogleAPIKey - The Google API key. - GoogleAPIKey *string `json:"googleApiKey,omitempty"` -} - -// ListResult the response of the List NotificationHub operation. -type ListResult struct { - autorest.Response `json:"-"` - // Value - Result of the List NotificationHub operation. - Value *[]ResourceType `json:"value,omitempty"` - // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of NotificationHub - NextLink *string `json:"nextLink,omitempty"` -} - -// ListResultIterator provides access to a complete listing of ResourceType values. -type ListResultIterator struct { - i int - page ListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListResultIterator) Response() ListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListResultIterator) Value() ResourceType { - if !iter.page.NotDone() { - return ResourceType{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListResultIterator type. -func NewListResultIterator(page ListResultPage) ListResultIterator { - return ListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lr ListResult) IsEmpty() bool { - return lr.Value == nil || len(*lr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lr ListResult) hasNextLink() bool { - return lr.NextLink != nil && len(*lr.NextLink) != 0 -} - -// listResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { - if !lr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lr.NextLink))) -} - -// ListResultPage contains a page of ResourceType values. -type ListResultPage struct { - fn func(context.Context, ListResult) (ListResult, error) - lr ListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lr) - if err != nil { - return err - } - page.lr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListResultPage) NotDone() bool { - return !page.lr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListResultPage) Response() ListResult { - return page.lr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListResultPage) Values() []ResourceType { - if page.lr.IsEmpty() { - return nil - } - return *page.lr.Value -} - -// Creates a new instance of the ListResultPage type. -func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { - return ListResultPage{ - fn: getNextPage, - lr: cur, - } -} - -// MpnsCredential description of a NotificationHub MpnsCredential. -type MpnsCredential struct { - // MpnsCredentialProperties - Properties of NotificationHub MpnsCredential. - *MpnsCredentialProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for MpnsCredential. -func (mc MpnsCredential) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mc.MpnsCredentialProperties != nil { - objectMap["properties"] = mc.MpnsCredentialProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MpnsCredential struct. -func (mc *MpnsCredential) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var mpnsCredentialProperties MpnsCredentialProperties - err = json.Unmarshal(*v, &mpnsCredentialProperties) - if err != nil { - return err - } - mc.MpnsCredentialProperties = &mpnsCredentialProperties - } - } - } - - return nil -} - -// MpnsCredentialProperties description of a NotificationHub MpnsCredential. -type MpnsCredentialProperties struct { - // MpnsCertificate - The MPNS certificate. - MpnsCertificate *string `json:"mpnsCertificate,omitempty"` - // CertificateKey - The certificate key for this credential. - CertificateKey *string `json:"certificateKey,omitempty"` - // Thumbprint - The MPNS certificate Thumbprint - Thumbprint *string `json:"thumbprint,omitempty"` -} - -// NamespaceCreateOrUpdateParameters parameters supplied to the CreateOrUpdate Namespace operation. -type NamespaceCreateOrUpdateParameters struct { - // NamespaceProperties - Properties of the Namespace. - *NamespaceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Sku - The sku of the created namespace - Sku *Sku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for NamespaceCreateOrUpdateParameters. -func (ncoup NamespaceCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ncoup.NamespaceProperties != nil { - objectMap["properties"] = ncoup.NamespaceProperties - } - if ncoup.Location != nil { - objectMap["location"] = ncoup.Location - } - if ncoup.Tags != nil { - objectMap["tags"] = ncoup.Tags - } - if ncoup.Sku != nil { - objectMap["sku"] = ncoup.Sku - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NamespaceCreateOrUpdateParameters struct. -func (ncoup *NamespaceCreateOrUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var namespaceProperties NamespaceProperties - err = json.Unmarshal(*v, &namespaceProperties) - if err != nil { - return err - } - ncoup.NamespaceProperties = &namespaceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ncoup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ncoup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ncoup.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ncoup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ncoup.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - ncoup.Sku = &sku - } - } - } - - return nil -} - -// NamespaceListResult the response of the List Namespace operation. -type NamespaceListResult struct { - autorest.Response `json:"-"` - // Value - Result of the List Namespace operation. - Value *[]NamespaceResource `json:"value,omitempty"` - // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of Namespaces - NextLink *string `json:"nextLink,omitempty"` -} - -// NamespaceListResultIterator provides access to a complete listing of NamespaceResource values. -type NamespaceListResultIterator struct { - i int - page NamespaceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *NamespaceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespaceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *NamespaceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter NamespaceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter NamespaceListResultIterator) Response() NamespaceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter NamespaceListResultIterator) Value() NamespaceResource { - if !iter.page.NotDone() { - return NamespaceResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the NamespaceListResultIterator type. -func NewNamespaceListResultIterator(page NamespaceListResultPage) NamespaceListResultIterator { - return NamespaceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (nlr NamespaceListResult) IsEmpty() bool { - return nlr.Value == nil || len(*nlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (nlr NamespaceListResult) hasNextLink() bool { - return nlr.NextLink != nil && len(*nlr.NextLink) != 0 -} - -// namespaceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (nlr NamespaceListResult) namespaceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !nlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(nlr.NextLink))) -} - -// NamespaceListResultPage contains a page of NamespaceResource values. -type NamespaceListResultPage struct { - fn func(context.Context, NamespaceListResult) (NamespaceListResult, error) - nlr NamespaceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *NamespaceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespaceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.nlr) - if err != nil { - return err - } - page.nlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *NamespaceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page NamespaceListResultPage) NotDone() bool { - return !page.nlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page NamespaceListResultPage) Response() NamespaceListResult { - return page.nlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page NamespaceListResultPage) Values() []NamespaceResource { - if page.nlr.IsEmpty() { - return nil - } - return *page.nlr.Value -} - -// Creates a new instance of the NamespaceListResultPage type. -func NewNamespaceListResultPage(cur NamespaceListResult, getNextPage func(context.Context, NamespaceListResult) (NamespaceListResult, error)) NamespaceListResultPage { - return NamespaceListResultPage{ - fn: getNextPage, - nlr: cur, - } -} - -// NamespacePatchParameters parameters supplied to the Patch Namespace operation. -type NamespacePatchParameters struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Sku - The sku of the created namespace - Sku *Sku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for NamespacePatchParameters. -func (npp NamespacePatchParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if npp.Tags != nil { - objectMap["tags"] = npp.Tags - } - if npp.Sku != nil { - objectMap["sku"] = npp.Sku - } - return json.Marshal(objectMap) -} - -// NamespaceProperties namespace properties. -type NamespaceProperties struct { - // Name - The name of the namespace. - Name *string `json:"name,omitempty"` - // ProvisioningState - Provisioning state of the Namespace. - ProvisioningState *string `json:"provisioningState,omitempty"` - // Region - Specifies the targeted region in which the namespace should be created. It can be any of the following values: Australia East, Australia Southeast, Central US, East US, East US 2, West US, North Central US, South Central US, East Asia, Southeast Asia, Brazil South, Japan East, Japan West, North Europe, West Europe - Region *string `json:"region,omitempty"` - // MetricID - READ-ONLY; Identifier for Azure Insights metrics - MetricID *string `json:"metricId,omitempty"` - // Status - Status of the namespace. It can be any of these values:1 = Created/Active2 = Creating3 = Suspended4 = Deleting - Status *string `json:"status,omitempty"` - // CreatedAt - The time the namespace was created. - CreatedAt *date.Time `json:"createdAt,omitempty"` - // UpdatedAt - The time the namespace was updated. - UpdatedAt *date.Time `json:"updatedAt,omitempty"` - // ServiceBusEndpoint - Endpoint you can use to perform NotificationHub operations. - ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` - // SubscriptionID - The Id of the Azure subscription associated with the namespace. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // ScaleUnit - ScaleUnit where the namespace gets created - ScaleUnit *string `json:"scaleUnit,omitempty"` - // Enabled - Whether or not the namespace is currently enabled. - Enabled *bool `json:"enabled,omitempty"` - // Critical - Whether or not the namespace is set as Critical. - Critical *bool `json:"critical,omitempty"` - // DataCenter - Data center for the namespace - DataCenter *string `json:"dataCenter,omitempty"` - // NamespaceType - The namespace type. Possible values include: 'NamespaceTypeMessaging', 'NamespaceTypeNotificationHub' - NamespaceType NamespaceType `json:"namespaceType,omitempty"` -} - -// MarshalJSON is the custom marshaler for NamespaceProperties. -func (np NamespaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if np.Name != nil { - objectMap["name"] = np.Name - } - if np.ProvisioningState != nil { - objectMap["provisioningState"] = np.ProvisioningState - } - if np.Region != nil { - objectMap["region"] = np.Region - } - if np.Status != nil { - objectMap["status"] = np.Status - } - if np.CreatedAt != nil { - objectMap["createdAt"] = np.CreatedAt - } - if np.UpdatedAt != nil { - objectMap["updatedAt"] = np.UpdatedAt - } - if np.ServiceBusEndpoint != nil { - objectMap["serviceBusEndpoint"] = np.ServiceBusEndpoint - } - if np.SubscriptionID != nil { - objectMap["subscriptionId"] = np.SubscriptionID - } - if np.ScaleUnit != nil { - objectMap["scaleUnit"] = np.ScaleUnit - } - if np.Enabled != nil { - objectMap["enabled"] = np.Enabled - } - if np.Critical != nil { - objectMap["critical"] = np.Critical - } - if np.DataCenter != nil { - objectMap["dataCenter"] = np.DataCenter - } - if np.NamespaceType != "" { - objectMap["namespaceType"] = np.NamespaceType - } - return json.Marshal(objectMap) -} - -// NamespaceResource description of a Namespace resource. -type NamespaceResource struct { - autorest.Response `json:"-"` - // NamespaceProperties - Properties of the Namespace. - *NamespaceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Sku - The sku of the created namespace - Sku *Sku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for NamespaceResource. -func (nr NamespaceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nr.NamespaceProperties != nil { - objectMap["properties"] = nr.NamespaceProperties - } - if nr.Location != nil { - objectMap["location"] = nr.Location - } - if nr.Tags != nil { - objectMap["tags"] = nr.Tags - } - if nr.Sku != nil { - objectMap["sku"] = nr.Sku - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NamespaceResource struct. -func (nr *NamespaceResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var namespaceProperties NamespaceProperties - err = json.Unmarshal(*v, &namespaceProperties) - if err != nil { - return err - } - nr.NamespaceProperties = &namespaceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - nr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - nr.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - nr.Sku = &sku - } - } - } - - return nil -} - -// NamespacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NamespacesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NamespacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NamespacesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for NamespacesDeleteFuture.Result. -func (future *NamespacesDeleteFuture) result(client NamespacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("notificationhubs.NamespacesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// Operation a NotificationHubs REST API operation -type Operation struct { - // Name - READ-ONLY; Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - The object that represents the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if o.Display != nil { - objectMap["display"] = o.Display - } - return json.Marshal(objectMap) -} - -// OperationDisplay the object that represents the operation. -type OperationDisplay struct { - // Provider - READ-ONLY; Service provider: Microsoft.NotificationHubs - Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; Resource on which the operation is performed: Invoice, etc. - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResult result of the request to list NotificationHubs operations. It contains a list of -// operations and a URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of NotificationHubs operations supported by the Microsoft.NotificationHubs resource provider. - Value *[]Operation `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// PatchParameters parameters supplied to the patch NotificationHub operation. -type PatchParameters struct { - // Properties - Properties of the NotificationHub. - *Properties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Sku - The sku of the created namespace - Sku *Sku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for PatchParameters. -func (pp PatchParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pp.Properties != nil { - objectMap["properties"] = pp.Properties - } - if pp.Location != nil { - objectMap["location"] = pp.Location - } - if pp.Tags != nil { - objectMap["tags"] = pp.Tags - } - if pp.Sku != nil { - objectMap["sku"] = pp.Sku - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PatchParameters struct. -func (pp *PatchParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var properties Properties - err = json.Unmarshal(*v, &properties) - if err != nil { - return err - } - pp.Properties = &properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pp.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - pp.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - pp.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - pp.Sku = &sku - } - } - } - - return nil -} - -// PnsCredentialsProperties description of a NotificationHub PNS Credentials. -type PnsCredentialsProperties struct { - // ApnsCredential - The ApnsCredential of the created NotificationHub - ApnsCredential *ApnsCredential `json:"apnsCredential,omitempty"` - // WnsCredential - The WnsCredential of the created NotificationHub - WnsCredential *WnsCredential `json:"wnsCredential,omitempty"` - // GcmCredential - The GcmCredential of the created NotificationHub - GcmCredential *GcmCredential `json:"gcmCredential,omitempty"` - // MpnsCredential - The MpnsCredential of the created NotificationHub - MpnsCredential *MpnsCredential `json:"mpnsCredential,omitempty"` - // AdmCredential - The AdmCredential of the created NotificationHub - AdmCredential *AdmCredential `json:"admCredential,omitempty"` - // BaiduCredential - The BaiduCredential of the created NotificationHub - BaiduCredential *BaiduCredential `json:"baiduCredential,omitempty"` -} - -// PnsCredentialsResource description of a NotificationHub PNS Credentials. -type PnsCredentialsResource struct { - autorest.Response `json:"-"` - // PnsCredentialsProperties - NotificationHub PNS Credentials. - *PnsCredentialsProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Sku - The sku of the created namespace - Sku *Sku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for PnsCredentialsResource. -func (pcr PnsCredentialsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pcr.PnsCredentialsProperties != nil { - objectMap["properties"] = pcr.PnsCredentialsProperties - } - if pcr.Location != nil { - objectMap["location"] = pcr.Location - } - if pcr.Tags != nil { - objectMap["tags"] = pcr.Tags - } - if pcr.Sku != nil { - objectMap["sku"] = pcr.Sku - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PnsCredentialsResource struct. -func (pcr *PnsCredentialsResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var pnsCredentialsProperties PnsCredentialsProperties - err = json.Unmarshal(*v, &pnsCredentialsProperties) - if err != nil { - return err - } - pcr.PnsCredentialsProperties = &pnsCredentialsProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pcr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pcr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pcr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - pcr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - pcr.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - pcr.Sku = &sku - } - } - } - - return nil -} - -// PolicykeyResource namespace/NotificationHub Regenerate Keys -type PolicykeyResource struct { - // PolicyKey - Name of the key that has to be regenerated for the Namespace/Notification Hub Authorization Rule. The value can be Primary Key/Secondary Key. - PolicyKey *string `json:"policyKey,omitempty"` -} - -// Properties notificationHub properties. -type Properties struct { - // Name - The NotificationHub name. - Name *string `json:"name,omitempty"` - // RegistrationTTL - The RegistrationTtl of the created NotificationHub - RegistrationTTL *string `json:"registrationTtl,omitempty"` - // AuthorizationRules - The AuthorizationRules of the created NotificationHub - AuthorizationRules *[]SharedAccessAuthorizationRuleProperties `json:"authorizationRules,omitempty"` - // ApnsCredential - The ApnsCredential of the created NotificationHub - ApnsCredential *ApnsCredential `json:"apnsCredential,omitempty"` - // WnsCredential - The WnsCredential of the created NotificationHub - WnsCredential *WnsCredential `json:"wnsCredential,omitempty"` - // GcmCredential - The GcmCredential of the created NotificationHub - GcmCredential *GcmCredential `json:"gcmCredential,omitempty"` - // MpnsCredential - The MpnsCredential of the created NotificationHub - MpnsCredential *MpnsCredential `json:"mpnsCredential,omitempty"` - // AdmCredential - The AdmCredential of the created NotificationHub - AdmCredential *AdmCredential `json:"admCredential,omitempty"` - // BaiduCredential - The BaiduCredential of the created NotificationHub - BaiduCredential *BaiduCredential `json:"baiduCredential,omitempty"` -} - -// Resource ... -type Resource struct { - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Sku - The sku of the created namespace - Sku *Sku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - if r.Sku != nil { - objectMap["sku"] = r.Sku - } - return json.Marshal(objectMap) -} - -// ResourceListKeys namespace/NotificationHub Connection String -type ResourceListKeys struct { - autorest.Response `json:"-"` - // PrimaryConnectionString - PrimaryConnectionString of the AuthorizationRule. - PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` - // SecondaryConnectionString - SecondaryConnectionString of the created AuthorizationRule - SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` - // PrimaryKey - PrimaryKey of the created AuthorizationRule. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - SecondaryKey of the created AuthorizationRule - SecondaryKey *string `json:"secondaryKey,omitempty"` - // KeyName - KeyName of the created AuthorizationRule - KeyName *string `json:"keyName,omitempty"` -} - -// ResourceType description of a NotificationHub Resource. -type ResourceType struct { - autorest.Response `json:"-"` - // Properties - Properties of the NotificationHub. - *Properties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Sku - The sku of the created namespace - Sku *Sku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceType. -func (rt ResourceType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rt.Properties != nil { - objectMap["properties"] = rt.Properties - } - if rt.Location != nil { - objectMap["location"] = rt.Location - } - if rt.Tags != nil { - objectMap["tags"] = rt.Tags - } - if rt.Sku != nil { - objectMap["sku"] = rt.Sku - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ResourceType struct. -func (rt *ResourceType) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var properties Properties - err = json.Unmarshal(*v, &properties) - if err != nil { - return err - } - rt.Properties = &properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rt.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rt.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rt.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - rt.Sku = &sku - } - } - } - - return nil -} - -// SharedAccessAuthorizationRuleCreateOrUpdateParameters parameters supplied to the CreateOrUpdate -// Namespace AuthorizationRules. -type SharedAccessAuthorizationRuleCreateOrUpdateParameters struct { - // Properties - Properties of the Namespace AuthorizationRules. - Properties *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` -} - -// SharedAccessAuthorizationRuleListResult the response of the List Namespace operation. -type SharedAccessAuthorizationRuleListResult struct { - autorest.Response `json:"-"` - // Value - Result of the List AuthorizationRules operation. - Value *[]SharedAccessAuthorizationRuleResource `json:"value,omitempty"` - // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of AuthorizationRules - NextLink *string `json:"nextLink,omitempty"` -} - -// SharedAccessAuthorizationRuleListResultIterator provides access to a complete listing of -// SharedAccessAuthorizationRuleResource values. -type SharedAccessAuthorizationRuleListResultIterator struct { - i int - page SharedAccessAuthorizationRuleListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SharedAccessAuthorizationRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessAuthorizationRuleListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SharedAccessAuthorizationRuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SharedAccessAuthorizationRuleListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SharedAccessAuthorizationRuleListResultIterator) Response() SharedAccessAuthorizationRuleListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SharedAccessAuthorizationRuleListResultIterator) Value() SharedAccessAuthorizationRuleResource { - if !iter.page.NotDone() { - return SharedAccessAuthorizationRuleResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SharedAccessAuthorizationRuleListResultIterator type. -func NewSharedAccessAuthorizationRuleListResultIterator(page SharedAccessAuthorizationRuleListResultPage) SharedAccessAuthorizationRuleListResultIterator { - return SharedAccessAuthorizationRuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (saarlr SharedAccessAuthorizationRuleListResult) IsEmpty() bool { - return saarlr.Value == nil || len(*saarlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (saarlr SharedAccessAuthorizationRuleListResult) hasNextLink() bool { - return saarlr.NextLink != nil && len(*saarlr.NextLink) != 0 -} - -// sharedAccessAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (saarlr SharedAccessAuthorizationRuleListResult) sharedAccessAuthorizationRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !saarlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(saarlr.NextLink))) -} - -// SharedAccessAuthorizationRuleListResultPage contains a page of SharedAccessAuthorizationRuleResource -// values. -type SharedAccessAuthorizationRuleListResultPage struct { - fn func(context.Context, SharedAccessAuthorizationRuleListResult) (SharedAccessAuthorizationRuleListResult, error) - saarlr SharedAccessAuthorizationRuleListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SharedAccessAuthorizationRuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SharedAccessAuthorizationRuleListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.saarlr) - if err != nil { - return err - } - page.saarlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SharedAccessAuthorizationRuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SharedAccessAuthorizationRuleListResultPage) NotDone() bool { - return !page.saarlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SharedAccessAuthorizationRuleListResultPage) Response() SharedAccessAuthorizationRuleListResult { - return page.saarlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SharedAccessAuthorizationRuleListResultPage) Values() []SharedAccessAuthorizationRuleResource { - if page.saarlr.IsEmpty() { - return nil - } - return *page.saarlr.Value -} - -// Creates a new instance of the SharedAccessAuthorizationRuleListResultPage type. -func NewSharedAccessAuthorizationRuleListResultPage(cur SharedAccessAuthorizationRuleListResult, getNextPage func(context.Context, SharedAccessAuthorizationRuleListResult) (SharedAccessAuthorizationRuleListResult, error)) SharedAccessAuthorizationRuleListResultPage { - return SharedAccessAuthorizationRuleListResultPage{ - fn: getNextPage, - saarlr: cur, - } -} - -// SharedAccessAuthorizationRuleProperties sharedAccessAuthorizationRule properties. -type SharedAccessAuthorizationRuleProperties struct { - // Rights - The rights associated with the rule. - Rights *[]AccessRights `json:"rights,omitempty"` - // PrimaryKey - READ-ONLY; A base64-encoded 256-bit primary key for signing and validating the SAS token. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - READ-ONLY; A base64-encoded 256-bit primary key for signing and validating the SAS token. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // KeyName - READ-ONLY; A string that describes the authorization rule. - KeyName *string `json:"keyName,omitempty"` - // ClaimType - READ-ONLY; A string that describes the claim type - ClaimType *string `json:"claimType,omitempty"` - // ClaimValue - READ-ONLY; A string that describes the claim value - ClaimValue *string `json:"claimValue,omitempty"` - // ModifiedTime - READ-ONLY; The last modified time for this rule - ModifiedTime *string `json:"modifiedTime,omitempty"` - // CreatedTime - READ-ONLY; The created time for this rule - CreatedTime *string `json:"createdTime,omitempty"` - // Revision - READ-ONLY; The revision number for the rule - Revision *int32 `json:"revision,omitempty"` -} - -// MarshalJSON is the custom marshaler for SharedAccessAuthorizationRuleProperties. -func (saarp SharedAccessAuthorizationRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if saarp.Rights != nil { - objectMap["rights"] = saarp.Rights - } - return json.Marshal(objectMap) -} - -// SharedAccessAuthorizationRuleResource description of a Namespace AuthorizationRules. -type SharedAccessAuthorizationRuleResource struct { - autorest.Response `json:"-"` - // SharedAccessAuthorizationRuleProperties - Properties of the Namespace AuthorizationRule. - *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // Sku - The sku of the created namespace - Sku *Sku `json:"sku,omitempty"` -} - -// MarshalJSON is the custom marshaler for SharedAccessAuthorizationRuleResource. -func (saarr SharedAccessAuthorizationRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if saarr.SharedAccessAuthorizationRuleProperties != nil { - objectMap["properties"] = saarr.SharedAccessAuthorizationRuleProperties - } - if saarr.Location != nil { - objectMap["location"] = saarr.Location - } - if saarr.Tags != nil { - objectMap["tags"] = saarr.Tags - } - if saarr.Sku != nil { - objectMap["sku"] = saarr.Sku - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SharedAccessAuthorizationRuleResource struct. -func (saarr *SharedAccessAuthorizationRuleResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var sharedAccessAuthorizationRuleProperties SharedAccessAuthorizationRuleProperties - err = json.Unmarshal(*v, &sharedAccessAuthorizationRuleProperties) - if err != nil { - return err - } - saarr.SharedAccessAuthorizationRuleProperties = &sharedAccessAuthorizationRuleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - saarr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - saarr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - saarr.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - saarr.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - saarr.Tags = tags - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - saarr.Sku = &sku - } - } - } - - return nil -} - -// Sku the Sku description for a namespace -type Sku struct { - // Name - Name of the notification hub sku. Possible values include: 'SkuNameFree', 'SkuNameBasic', 'SkuNameStandard' - Name SkuName `json:"name,omitempty"` - // Tier - The tier of particular sku - Tier *string `json:"tier,omitempty"` - // Size - The Sku size - Size *string `json:"size,omitempty"` - // Family - The Sku Family - Family *string `json:"family,omitempty"` - // Capacity - The capacity of the resource - Capacity *int32 `json:"capacity,omitempty"` -} - -// SubResource ... -type SubResource struct { - // ID - Resource Id - ID *string `json:"id,omitempty"` -} - -// WnsCredential description of a NotificationHub WnsCredential. -type WnsCredential struct { - // WnsCredentialProperties - Properties of NotificationHub WnsCredential. - *WnsCredentialProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WnsCredential. -func (wc WnsCredential) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wc.WnsCredentialProperties != nil { - objectMap["properties"] = wc.WnsCredentialProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WnsCredential struct. -func (wc *WnsCredential) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var wnsCredentialProperties WnsCredentialProperties - err = json.Unmarshal(*v, &wnsCredentialProperties) - if err != nil { - return err - } - wc.WnsCredentialProperties = &wnsCredentialProperties - } - } - } - - return nil -} - -// WnsCredentialProperties description of a NotificationHub WnsCredential. -type WnsCredentialProperties struct { - // PackageSid - The package ID for this credential. - PackageSid *string `json:"packageSid,omitempty"` - // SecretKey - The secret key. - SecretKey *string `json:"secretKey,omitempty"` - // WindowsLiveEndpoint - The Windows Live endpoint. - WindowsLiveEndpoint *string `json:"windowsLiveEndpoint,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/namespaces.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/namespaces.go deleted file mode 100644 index 96e740dcb7b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/namespaces.go +++ /dev/null @@ -1,1179 +0,0 @@ -package notificationhubs - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// NamespacesClient is the azure NotificationHub client -type NamespacesClient struct { - BaseClient -} - -// NewNamespacesClient creates an instance of the NamespacesClient client. -func NewNamespacesClient(subscriptionID string) NamespacesClient { - return NewNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNamespacesClientWithBaseURI creates an instance of the NamespacesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) NamespacesClient { - return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckAvailability checks the availability of the given service namespace across all Azure subscriptions. This is -// useful because the domain name is created based on the service namespace name. -// Parameters: -// parameters - the namespace name. -func (client NamespacesClient) CheckAvailability(ctx context.Context, parameters CheckAvailabilityParameters) (result CheckAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.CheckAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("notificationhubs.NamespacesClient", "CheckAvailability", err.Error()) - } - - req, err := client.CheckAvailabilityPreparer(ctx, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CheckAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CheckAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CheckAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckAvailabilityPreparer prepares the CheckAvailability request. -func (client NamespacesClient) CheckAvailabilityPreparer(ctx context.Context, parameters CheckAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/checkNamespaceAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckAvailabilitySender sends the CheckAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CheckAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckAvailabilityResponder handles the response to the CheckAvailability request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CheckAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates/Updates a service namespace. Once created, this namespace's resource manifest is immutable. -// This operation is idempotent. -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// parameters - parameters supplied to create a Namespace Resource. -func (client NamespacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters) (result NamespaceResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NamespacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, parameters NamespaceCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (result NamespaceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAuthorizationRule creates an authorization rule for a namespace -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// authorizationRuleName - authorization Rule Name. -// parameters - the shared access authorization rule. -func (client NamespacesClient) CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.CreateOrUpdateAuthorizationRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("notificationhubs.NamespacesClient", "CreateOrUpdateAuthorizationRule", err.Error()) - } - - req, err := client.CreateOrUpdateAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing namespace. This operation also removes all associated notificationHubs under the -// namespace. -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -func (client NamespacesClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string) (result NamespacesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NamespacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) DeleteSender(req *http.Request) (future NamespacesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client NamespacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAuthorizationRule deletes a namespace authorization rule -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// authorizationRuleName - authorization Rule Name. -func (client NamespacesClient) DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.DeleteAuthorizationRule") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAuthorizationRuleSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.DeleteAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client NamespacesClient) DeleteAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns the description for the specified namespace. -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -func (client NamespacesClient) Get(ctx context.Context, resourceGroupName string, namespaceName string) (result NamespaceResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NamespacesClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client NamespacesClient) GetResponder(resp *http.Response) (result NamespaceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule gets an authorization rule for a namespace by name. -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name -// authorizationRuleName - authorization rule name. -func (client NamespacesClient) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.GetAuthorizationRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "GetAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client NamespacesClient) GetAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the available namespaces within a resourceGroup. -// Parameters: -// resourceGroupName - the name of the resource group. If resourceGroupName value is null the method lists all -// the namespaces within subscription -func (client NamespacesClient) List(ctx context.Context, resourceGroupName string) (result NamespaceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.List") - defer func() { - sc := -1 - if result.nlr.Response.Response != nil { - sc = result.nlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.nlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "List", resp, "Failure sending request") - return - } - - result.nlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "List", resp, "Failure responding to request") - return - } - if result.nlr.hasNextLink() && result.nlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client NamespacesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListResponder(resp *http.Response) (result NamespaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client NamespacesClient) listNextResults(ctx context.Context, lastResults NamespaceListResult) (result NamespaceListResult, err error) { - req, err := lastResults.namespaceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client NamespacesClient) ListComplete(ctx context.Context, resourceGroupName string) (result NamespaceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName) - return -} - -// ListAll lists all the available namespaces within the subscription irrespective of the resourceGroups. -func (client NamespacesClient) ListAll(ctx context.Context) (result NamespaceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListAll") - defer func() { - sc := -1 - if result.nlr.Response.Response != nil { - sc = result.nlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listAllNextResults - req, err := client.ListAllPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAll", nil, "Failure preparing request") - return - } - - resp, err := client.ListAllSender(req) - if err != nil { - result.nlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAll", resp, "Failure sending request") - return - } - - result.nlr, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAll", resp, "Failure responding to request") - return - } - if result.nlr.hasNextLink() && result.nlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAllPreparer prepares the ListAll request. -func (client NamespacesClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NotificationHubs/namespaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAllSender sends the ListAll request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListAllSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAllResponder handles the response to the ListAll request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListAllResponder(resp *http.Response) (result NamespaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAllNextResults retrieves the next set of results, if any. -func (client NamespacesClient) listAllNextResults(ctx context.Context, lastResults NamespaceListResult) (result NamespaceListResult, err error) { - req, err := lastResults.namespaceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "listAllNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAllSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "listAllNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAllResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "listAllNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAllComplete enumerates all values, automatically crossing page boundaries as required. -func (client NamespacesClient) ListAllComplete(ctx context.Context) (result NamespaceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListAll") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAll(ctx) - return -} - -// ListAuthorizationRules gets the authorization rules for a namespace. -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name -func (client NamespacesClient) ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string) (result SharedAccessAuthorizationRuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListAuthorizationRules") - defer func() { - sc := -1 - if result.saarlr.Response.Response != nil { - sc = result.saarlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listAuthorizationRulesNextResults - req, err := client.ListAuthorizationRulesPreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.saarlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result.saarlr, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to request") - return - } - if result.saarlr.hasNextLink() && result.saarlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client NamespacesClient) ListAuthorizationRulesPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client NamespacesClient) listAuthorizationRulesNextResults(ctx context.Context, lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { - req, err := lastResults.sharedAccessAuthorizationRuleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "listAuthorizationRulesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "listAuthorizationRulesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "listAuthorizationRulesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAuthorizationRulesComplete enumerates all values, automatically crossing page boundaries as required. -func (client NamespacesClient) ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result SharedAccessAuthorizationRuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListAuthorizationRules") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAuthorizationRules(ctx, resourceGroupName, namespaceName) - return -} - -// ListKeys gets the Primary and Secondary ConnectionStrings to the namespace -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// authorizationRuleName - the connection string of the namespace for the specified authorizationRule. -func (client NamespacesClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result ResourceListKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListKeysPreparer(ctx, resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client NamespacesClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Patch patches the existing namespace -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// parameters - parameters supplied to patch a Namespace Resource. -func (client NamespacesClient) Patch(ctx context.Context, resourceGroupName string, namespaceName string, parameters NamespacePatchParameters) (result NamespaceResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.Patch") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.PatchPreparer(ctx, resourceGroupName, namespaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Patch", nil, "Failure preparing request") - return - } - - resp, err := client.PatchSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Patch", resp, "Failure sending request") - return - } - - result, err = client.PatchResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "Patch", resp, "Failure responding to request") - return - } - - return -} - -// PatchPreparer prepares the Patch request. -func (client NamespacesClient) PatchPreparer(ctx context.Context, resourceGroupName string, namespaceName string, parameters NamespacePatchParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PatchSender sends the Patch request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) PatchSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// PatchResponder handles the response to the Patch request. The method always -// closes the http.Response Body. -func (client NamespacesClient) PatchResponder(resp *http.Response) (result NamespaceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerates the Primary/Secondary Keys to the Namespace Authorization Rule -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// authorizationRuleName - the connection string of the namespace for the specified authorizationRule. -// parameters - parameters supplied to regenerate the Namespace Authorization Rule Key. -func (client NamespacesClient) RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters PolicykeyResource) (result ResourceListKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.RegenerateKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RegenerateKeysPreparer(ctx, resourceGroupName, namespaceName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.NamespacesClient", "RegenerateKeys", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client NamespacesClient) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters PolicykeyResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client NamespacesClient) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/notificationhubs.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/notificationhubs.go deleted file mode 100644 index 2166341e1b2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/notificationhubs.go +++ /dev/null @@ -1,1256 +0,0 @@ -package notificationhubs - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// Client is the azure NotificationHub client -type Client struct { - BaseClient -} - -// NewClient creates an instance of the Client client. -func NewClient(subscriptionID string) Client { - return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting -// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { - return Client{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNotificationHubAvailability checks the availability of the given notificationHub in a namespace. -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// parameters - the notificationHub name. -func (client Client) CheckNotificationHubAvailability(ctx context.Context, resourceGroupName string, namespaceName string, parameters CheckAvailabilityParameters) (result CheckAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckNotificationHubAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("notificationhubs.Client", "CheckNotificationHubAvailability", err.Error()) - } - - req, err := client.CheckNotificationHubAvailabilityPreparer(ctx, resourceGroupName, namespaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CheckNotificationHubAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNotificationHubAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CheckNotificationHubAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNotificationHubAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CheckNotificationHubAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNotificationHubAvailabilityPreparer prepares the CheckNotificationHubAvailability request. -func (client Client) CheckNotificationHubAvailabilityPreparer(ctx context.Context, resourceGroupName string, namespaceName string, parameters CheckAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/checkNotificationHubAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNotificationHubAvailabilitySender sends the CheckNotificationHubAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CheckNotificationHubAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNotificationHubAvailabilityResponder handles the response to the CheckNotificationHubAvailability request. The method always -// closes the http.Response Body. -func (client Client) CheckNotificationHubAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates/Update a NotificationHub in a namespace. -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// notificationHubName - the notification hub name. -// parameters - parameters supplied to the create/update a NotificationHub Resource. -func (client Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, parameters CreateOrUpdateParameters) (result ResourceType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("notificationhubs.Client", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, notificationHubName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client Client) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, parameters CreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client Client) CreateOrUpdateResponder(resp *http.Response) (result ResourceType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAuthorizationRule creates/Updates an authorization rule for a NotificationHub -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// notificationHubName - the notification hub name. -// authorizationRuleName - authorization Rule Name. -// parameters - the shared access authorization rule. -func (client Client) CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result SharedAccessAuthorizationRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateOrUpdateAuthorizationRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("notificationhubs.Client", "CreateOrUpdateAuthorizationRule", err.Error()) - } - - req, err := client.CreateOrUpdateAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client Client) CreateOrUpdateAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (client Client) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DebugSend test send a push notification -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// notificationHubName - the notification hub name. -// parameters - debug send parameters -func (client Client) DebugSend(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, parameters *interface{}) (result DebugSendResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.DebugSend") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DebugSendPreparer(ctx, resourceGroupName, namespaceName, notificationHubName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "DebugSend", nil, "Failure preparing request") - return - } - - resp, err := client.DebugSendSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "DebugSend", resp, "Failure sending request") - return - } - - result, err = client.DebugSendResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "DebugSend", resp, "Failure responding to request") - return - } - - return -} - -// DebugSendPreparer prepares the DebugSend request. -func (client Client) DebugSendPreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, parameters *interface{}) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/debugsend", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DebugSendSender sends the DebugSend request. The method will close the -// http.Response Body if it receives an error. -func (client Client) DebugSendSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DebugSendResponder handles the response to the DebugSend request. The method always -// closes the http.Response Body. -func (client Client) DebugSendResponder(resp *http.Response) (result DebugSendResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a notification hub associated with a namespace. -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// notificationHubName - the notification hub name. -func (client Client) Delete(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, notificationHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client Client) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client Client) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAuthorizationRule deletes a notificationHub authorization rule -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// notificationHubName - the notification hub name. -// authorizationRuleName - authorization Rule Name. -func (client Client) DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.DeleteAuthorizationRule") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAuthorizationRuleSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "DeleteAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.DeleteAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "DeleteAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client Client) DeleteAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client Client) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (client Client) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get lists the notification hubs associated with a namespace. -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// notificationHubName - the notification hub name. -func (client Client) Get(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (result ResourceType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, notificationHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client Client) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client Client) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client Client) GetResponder(resp *http.Response) (result ResourceType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule gets an authorization rule for a NotificationHub by name. -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name -// notificationHubName - the notification hub name. -// authorizationRuleName - authorization rule name. -func (client Client) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetAuthorizationRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "GetAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client Client) GetAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client Client) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client Client) GetAuthorizationRuleResponder(resp *http.Response) (result SharedAccessAuthorizationRuleResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetPnsCredentials lists the PNS Credentials associated with a notification hub . -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// notificationHubName - the notification hub name. -func (client Client) GetPnsCredentials(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (result PnsCredentialsResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetPnsCredentials") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPnsCredentialsPreparer(ctx, resourceGroupName, namespaceName, notificationHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "GetPnsCredentials", nil, "Failure preparing request") - return - } - - resp, err := client.GetPnsCredentialsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "GetPnsCredentials", resp, "Failure sending request") - return - } - - result, err = client.GetPnsCredentialsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "GetPnsCredentials", resp, "Failure responding to request") - return - } - - return -} - -// GetPnsCredentialsPreparer prepares the GetPnsCredentials request. -func (client Client) GetPnsCredentialsPreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/pnsCredentials", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetPnsCredentialsSender sends the GetPnsCredentials request. The method will close the -// http.Response Body if it receives an error. -func (client Client) GetPnsCredentialsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetPnsCredentialsResponder handles the response to the GetPnsCredentials request. The method always -// closes the http.Response Body. -func (client Client) GetPnsCredentialsResponder(resp *http.Response) (result PnsCredentialsResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists the notification hubs associated with a namespace. -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -func (client Client) List(ctx context.Context, resourceGroupName string, namespaceName string) (result ListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") - defer func() { - sc := -1 - if result.lr.Response.Response != nil { - sc = result.lr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.lr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "List", resp, "Failure sending request") - return - } - - result.lr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "List", resp, "Failure responding to request") - return - } - if result.lr.hasNextLink() && result.lr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client Client) ListPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client Client) ListResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client Client) listNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.listResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client Client) ListComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result ListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, namespaceName) - return -} - -// ListAuthorizationRules gets the authorization rules for a NotificationHub. -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name -// notificationHubName - the notification hub name. -func (client Client) ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (result SharedAccessAuthorizationRuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListAuthorizationRules") - defer func() { - sc := -1 - if result.saarlr.Response.Response != nil { - sc = result.saarlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listAuthorizationRulesNextResults - req, err := client.ListAuthorizationRulesPreparer(ctx, resourceGroupName, namespaceName, notificationHubName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.saarlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result.saarlr, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "ListAuthorizationRules", resp, "Failure responding to request") - return - } - if result.saarlr.hasNextLink() && result.saarlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client Client) ListAuthorizationRulesPreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client Client) ListAuthorizationRulesResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client Client) listAuthorizationRulesNextResults(ctx context.Context, lastResults SharedAccessAuthorizationRuleListResult) (result SharedAccessAuthorizationRuleListResult, err error) { - req, err := lastResults.sharedAccessAuthorizationRuleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "listAuthorizationRulesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.Client", "listAuthorizationRulesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "listAuthorizationRulesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAuthorizationRulesComplete enumerates all values, automatically crossing page boundaries as required. -func (client Client) ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string) (result SharedAccessAuthorizationRuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListAuthorizationRules") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAuthorizationRules(ctx, resourceGroupName, namespaceName, notificationHubName) - return -} - -// ListKeys gets the Primary and Secondary ConnectionStrings to the NotificationHub -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// notificationHubName - the notification hub name. -// authorizationRuleName - the connection string of the NotificationHub for the specified authorizationRule. -func (client Client) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (result ResourceListKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListKeysPreparer(ctx, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client Client) ListKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client Client) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client Client) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Patch patch a NotificationHub in a namespace. -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// notificationHubName - the notification hub name. -// parameters - parameters supplied to patch a NotificationHub Resource. -func (client Client) Patch(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, parameters *PatchParameters) (result ResourceType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.Patch") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.PatchPreparer(ctx, resourceGroupName, namespaceName, notificationHubName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Patch", nil, "Failure preparing request") - return - } - - resp, err := client.PatchSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Patch", resp, "Failure sending request") - return - } - - result, err = client.PatchResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "Patch", resp, "Failure responding to request") - return - } - - return -} - -// PatchPreparer prepares the Patch request. -func (client Client) PatchPreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, parameters *PatchParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PatchSender sends the Patch request. The method will close the -// http.Response Body if it receives an error. -func (client Client) PatchSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// PatchResponder handles the response to the Patch request. The method always -// closes the http.Response Body. -func (client Client) PatchResponder(resp *http.Response) (result ResourceType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerates the Primary/Secondary Keys to the NotificationHub Authorization Rule -// Parameters: -// resourceGroupName - the name of the resource group. -// namespaceName - the namespace name. -// notificationHubName - the notification hub name. -// authorizationRuleName - the connection string of the NotificationHub for the specified authorizationRule. -// parameters - parameters supplied to regenerate the NotificationHub Authorization Rule Key. -func (client Client) RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters PolicykeyResource) (result ResourceListKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.RegenerateKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RegenerateKeysPreparer(ctx, resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.Client", "RegenerateKeys", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client Client) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string, parameters PolicykeyResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "notificationHubName": autorest.Encode("path", notificationHubName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NotificationHubs/namespaces/{namespaceName}/notificationHubs/{notificationHubName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client Client) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client Client) RegenerateKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/operations.go deleted file mode 100644 index 3c9bef34936..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package notificationhubs - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the azure NotificationHub client -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available NotificationHubs REST API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "notificationhubs.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2017-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.NotificationHubs/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "notificationhubs.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "notificationhubs.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "notificationhubs.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/version.go deleted file mode 100644 index 1b88e8d2335..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package notificationhubs - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " notificationhubs/2017-04-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/_meta.json deleted file mode 100644 index edc647b79a3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "e3980786418c280ecd7ed2e141407ed0f63cd493", - "readme": "/_/azure-rest-api-specs/specification/postgresql/resource-manager/readme.md", - "tag": "package-2020-01-01", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-01-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/postgresql/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/checknameavailability.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/checknameavailability.go deleted file mode 100644 index 12b36c0e367..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/checknameavailability.go +++ /dev/null @@ -1,118 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// CheckNameAvailabilityClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type CheckNameAvailabilityClient struct { - BaseClient -} - -// NewCheckNameAvailabilityClient creates an instance of the CheckNameAvailabilityClient client. -func NewCheckNameAvailabilityClient(subscriptionID string) CheckNameAvailabilityClient { - return NewCheckNameAvailabilityClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCheckNameAvailabilityClientWithBaseURI creates an instance of the CheckNameAvailabilityClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewCheckNameAvailabilityClientWithBaseURI(baseURI string, subscriptionID string) CheckNameAvailabilityClient { - return CheckNameAvailabilityClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Execute check the availability of name for resource -// Parameters: -// nameAvailabilityRequest - the required parameters for checking if resource name is available. -func (client CheckNameAvailabilityClient) Execute(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest) (result NameAvailability, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CheckNameAvailabilityClient.Execute") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: nameAvailabilityRequest, - Constraints: []validation.Constraint{{Target: "nameAvailabilityRequest.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.CheckNameAvailabilityClient", "Execute", err.Error()) - } - - req, err := client.ExecutePreparer(ctx, nameAvailabilityRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.CheckNameAvailabilityClient", "Execute", nil, "Failure preparing request") - return - } - - resp, err := client.ExecuteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.CheckNameAvailabilityClient", "Execute", resp, "Failure sending request") - return - } - - result, err = client.ExecuteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.CheckNameAvailabilityClient", "Execute", resp, "Failure responding to request") - return - } - - return -} - -// ExecutePreparer prepares the Execute request. -func (client CheckNameAvailabilityClient) ExecutePreparer(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability", pathParameters), - autorest.WithJSON(nameAvailabilityRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExecuteSender sends the Execute request. The method will close the -// http.Response Body if it receives an error. -func (client CheckNameAvailabilityClient) ExecuteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExecuteResponder handles the response to the Execute request. The method always -// closes the http.Response Body. -func (client CheckNameAvailabilityClient) ExecuteResponder(resp *http.Response) (result NameAvailability, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/client.go deleted file mode 100644 index 0b8d0c3abae..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Package postgresql implements the Azure ARM Postgresql service API version . -// -// The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL -// resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and -// configurations with new business model. -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Postgresql - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Postgresql. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/configurations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/configurations.go deleted file mode 100644 index c3bcfb0c4a6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/configurations.go +++ /dev/null @@ -1,299 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ConfigurationsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type ConfigurationsClient struct { - BaseClient -} - -// NewConfigurationsClient creates an instance of the ConfigurationsClient client. -func NewConfigurationsClient(subscriptionID string) ConfigurationsClient { - return NewConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConfigurationsClientWithBaseURI creates an instance of the ConfigurationsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationsClient { - return ConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate updates a configuration of a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// configurationName - the name of the server configuration. -// parameters - the required parameters for updating a server configuration. -func (client ConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration) (result ConfigurationsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ConfigurationsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, configurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future ConfigurationsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get gets information about a configuration of server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// configurationName - the name of the server configuration. -func (client ConfigurationsClient) Get(ctx context.Context, resourceGroupName string, serverName string, configurationName string) (result Configuration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ConfigurationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) GetResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer list all the configurations in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ConfigurationsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ConfigurationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ConfigurationsClient", "ListByServer", err.Error()) - } - - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ConfigurationsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) ListByServerResponder(resp *http.Response) (result ConfigurationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/databases.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/databases.go deleted file mode 100644 index be505fa3867..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/databases.go +++ /dev/null @@ -1,388 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DatabasesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, -// log files and configurations with new business model. -type DatabasesClient struct { - BaseClient -} - -// NewDatabasesClient creates an instance of the DatabasesClient client. -func NewDatabasesClient(subscriptionID string) DatabasesClient { - return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { - return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new database or updates an existing database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the required parameters for creating or updating a database. -func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (result DatabasesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.DatabasesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) CreateOrUpdateSender(req *http.Request) (future DatabasesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabasesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.DatabasesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) DeleteSender(req *http.Request) (future DatabasesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about a database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result Database, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.DatabasesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.DatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DatabasesClient) GetResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer list all the databases in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client DatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.DatabasesClient", "ListByServer", err.Error()) - } - - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.DatabasesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client DatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListByServerResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/enums.go deleted file mode 100644 index 2de8debb71b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/enums.go +++ /dev/null @@ -1,302 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CreateMode enumerates the values for create mode. -type CreateMode string - -const ( - // CreateModeDefault ... - CreateModeDefault CreateMode = "Default" - // CreateModeGeoRestore ... - CreateModeGeoRestore CreateMode = "GeoRestore" - // CreateModePointInTimeRestore ... - CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" - // CreateModeReplica ... - CreateModeReplica CreateMode = "Replica" - // CreateModeServerPropertiesForCreate ... - CreateModeServerPropertiesForCreate CreateMode = "ServerPropertiesForCreate" -) - -// PossibleCreateModeValues returns an array of possible values for the CreateMode const type. -func PossibleCreateModeValues() []CreateMode { - return []CreateMode{CreateModeDefault, CreateModeGeoRestore, CreateModePointInTimeRestore, CreateModeReplica, CreateModeServerPropertiesForCreate} -} - -// GeoRedundantBackup enumerates the values for geo redundant backup. -type GeoRedundantBackup string - -const ( - // Disabled ... - Disabled GeoRedundantBackup = "Disabled" - // Enabled ... - Enabled GeoRedundantBackup = "Enabled" -) - -// PossibleGeoRedundantBackupValues returns an array of possible values for the GeoRedundantBackup const type. -func PossibleGeoRedundantBackupValues() []GeoRedundantBackup { - return []GeoRedundantBackup{Disabled, Enabled} -} - -// IdentityType enumerates the values for identity type. -type IdentityType string - -const ( - // SystemAssigned ... - SystemAssigned IdentityType = "SystemAssigned" -) - -// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. -func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{SystemAssigned} -} - -// InfrastructureEncryption enumerates the values for infrastructure encryption. -type InfrastructureEncryption string - -const ( - // InfrastructureEncryptionDisabled Additional (2nd) layer of encryption for data at rest - InfrastructureEncryptionDisabled InfrastructureEncryption = "Disabled" - // InfrastructureEncryptionEnabled Default value for single layer of encryption for data at rest. - InfrastructureEncryptionEnabled InfrastructureEncryption = "Enabled" -) - -// PossibleInfrastructureEncryptionValues returns an array of possible values for the InfrastructureEncryption const type. -func PossibleInfrastructureEncryptionValues() []InfrastructureEncryption { - return []InfrastructureEncryption{InfrastructureEncryptionDisabled, InfrastructureEncryptionEnabled} -} - -// MinimalTLSVersionEnum enumerates the values for minimal tls version enum. -type MinimalTLSVersionEnum string - -const ( - // TLS10 ... - TLS10 MinimalTLSVersionEnum = "TLS1_0" - // TLS11 ... - TLS11 MinimalTLSVersionEnum = "TLS1_1" - // TLS12 ... - TLS12 MinimalTLSVersionEnum = "TLS1_2" - // TLSEnforcementDisabled ... - TLSEnforcementDisabled MinimalTLSVersionEnum = "TLSEnforcementDisabled" -) - -// PossibleMinimalTLSVersionEnumValues returns an array of possible values for the MinimalTLSVersionEnum const type. -func PossibleMinimalTLSVersionEnumValues() []MinimalTLSVersionEnum { - return []MinimalTLSVersionEnum{TLS10, TLS11, TLS12, TLSEnforcementDisabled} -} - -// OperationOrigin enumerates the values for operation origin. -type OperationOrigin string - -const ( - // NotSpecified ... - NotSpecified OperationOrigin = "NotSpecified" - // System ... - System OperationOrigin = "system" - // User ... - User OperationOrigin = "user" -) - -// PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. -func PossibleOperationOriginValues() []OperationOrigin { - return []OperationOrigin{NotSpecified, System, User} -} - -// PrivateEndpointProvisioningState enumerates the values for private endpoint provisioning state. -type PrivateEndpointProvisioningState string - -const ( - // Approving ... - Approving PrivateEndpointProvisioningState = "Approving" - // Dropping ... - Dropping PrivateEndpointProvisioningState = "Dropping" - // Failed ... - Failed PrivateEndpointProvisioningState = "Failed" - // Ready ... - Ready PrivateEndpointProvisioningState = "Ready" - // Rejecting ... - Rejecting PrivateEndpointProvisioningState = "Rejecting" -) - -// PossiblePrivateEndpointProvisioningStateValues returns an array of possible values for the PrivateEndpointProvisioningState const type. -func PossiblePrivateEndpointProvisioningStateValues() []PrivateEndpointProvisioningState { - return []PrivateEndpointProvisioningState{Approving, Dropping, Failed, Ready, Rejecting} -} - -// PrivateLinkServiceConnectionStateActionsRequire enumerates the values for private link service connection -// state actions require. -type PrivateLinkServiceConnectionStateActionsRequire string - -const ( - // None ... - None PrivateLinkServiceConnectionStateActionsRequire = "None" -) - -// PossiblePrivateLinkServiceConnectionStateActionsRequireValues returns an array of possible values for the PrivateLinkServiceConnectionStateActionsRequire const type. -func PossiblePrivateLinkServiceConnectionStateActionsRequireValues() []PrivateLinkServiceConnectionStateActionsRequire { - return []PrivateLinkServiceConnectionStateActionsRequire{None} -} - -// PrivateLinkServiceConnectionStateStatus enumerates the values for private link service connection state -// status. -type PrivateLinkServiceConnectionStateStatus string - -const ( - // Approved ... - Approved PrivateLinkServiceConnectionStateStatus = "Approved" - // Disconnected ... - Disconnected PrivateLinkServiceConnectionStateStatus = "Disconnected" - // Pending ... - Pending PrivateLinkServiceConnectionStateStatus = "Pending" - // Rejected ... - Rejected PrivateLinkServiceConnectionStateStatus = "Rejected" -) - -// PossiblePrivateLinkServiceConnectionStateStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStateStatus const type. -func PossiblePrivateLinkServiceConnectionStateStatusValues() []PrivateLinkServiceConnectionStateStatus { - return []PrivateLinkServiceConnectionStateStatus{Approved, Disconnected, Pending, Rejected} -} - -// PublicNetworkAccessEnum enumerates the values for public network access enum. -type PublicNetworkAccessEnum string - -const ( - // PublicNetworkAccessEnumDisabled ... - PublicNetworkAccessEnumDisabled PublicNetworkAccessEnum = "Disabled" - // PublicNetworkAccessEnumEnabled ... - PublicNetworkAccessEnumEnabled PublicNetworkAccessEnum = "Enabled" -) - -// PossiblePublicNetworkAccessEnumValues returns an array of possible values for the PublicNetworkAccessEnum const type. -func PossiblePublicNetworkAccessEnumValues() []PublicNetworkAccessEnum { - return []PublicNetworkAccessEnum{PublicNetworkAccessEnumDisabled, PublicNetworkAccessEnumEnabled} -} - -// ServerSecurityAlertPolicyState enumerates the values for server security alert policy state. -type ServerSecurityAlertPolicyState string - -const ( - // ServerSecurityAlertPolicyStateDisabled ... - ServerSecurityAlertPolicyStateDisabled ServerSecurityAlertPolicyState = "Disabled" - // ServerSecurityAlertPolicyStateEnabled ... - ServerSecurityAlertPolicyStateEnabled ServerSecurityAlertPolicyState = "Enabled" -) - -// PossibleServerSecurityAlertPolicyStateValues returns an array of possible values for the ServerSecurityAlertPolicyState const type. -func PossibleServerSecurityAlertPolicyStateValues() []ServerSecurityAlertPolicyState { - return []ServerSecurityAlertPolicyState{ServerSecurityAlertPolicyStateDisabled, ServerSecurityAlertPolicyStateEnabled} -} - -// ServerState enumerates the values for server state. -type ServerState string - -const ( - // ServerStateDisabled ... - ServerStateDisabled ServerState = "Disabled" - // ServerStateDropping ... - ServerStateDropping ServerState = "Dropping" - // ServerStateInaccessible ... - ServerStateInaccessible ServerState = "Inaccessible" - // ServerStateReady ... - ServerStateReady ServerState = "Ready" -) - -// PossibleServerStateValues returns an array of possible values for the ServerState const type. -func PossibleServerStateValues() []ServerState { - return []ServerState{ServerStateDisabled, ServerStateDropping, ServerStateInaccessible, ServerStateReady} -} - -// ServerVersion enumerates the values for server version. -type ServerVersion string - -const ( - // NineFullStopFive ... - NineFullStopFive ServerVersion = "9.5" - // NineFullStopSix ... - NineFullStopSix ServerVersion = "9.6" - // OneOne ... - OneOne ServerVersion = "11" - // OneZero ... - OneZero ServerVersion = "10" - // OneZeroFullStopTwo ... - OneZeroFullStopTwo ServerVersion = "10.2" - // OneZeroFullStopZero ... - OneZeroFullStopZero ServerVersion = "10.0" -) - -// PossibleServerVersionValues returns an array of possible values for the ServerVersion const type. -func PossibleServerVersionValues() []ServerVersion { - return []ServerVersion{NineFullStopFive, NineFullStopSix, OneOne, OneZero, OneZeroFullStopTwo, OneZeroFullStopZero} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // Basic ... - Basic SkuTier = "Basic" - // GeneralPurpose ... - GeneralPurpose SkuTier = "GeneralPurpose" - // MemoryOptimized ... - MemoryOptimized SkuTier = "MemoryOptimized" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{Basic, GeneralPurpose, MemoryOptimized} -} - -// SslEnforcementEnum enumerates the values for ssl enforcement enum. -type SslEnforcementEnum string - -const ( - // SslEnforcementEnumDisabled ... - SslEnforcementEnumDisabled SslEnforcementEnum = "Disabled" - // SslEnforcementEnumEnabled ... - SslEnforcementEnumEnabled SslEnforcementEnum = "Enabled" -) - -// PossibleSslEnforcementEnumValues returns an array of possible values for the SslEnforcementEnum const type. -func PossibleSslEnforcementEnumValues() []SslEnforcementEnum { - return []SslEnforcementEnum{SslEnforcementEnumDisabled, SslEnforcementEnumEnabled} -} - -// StorageAutogrow enumerates the values for storage autogrow. -type StorageAutogrow string - -const ( - // StorageAutogrowDisabled ... - StorageAutogrowDisabled StorageAutogrow = "Disabled" - // StorageAutogrowEnabled ... - StorageAutogrowEnabled StorageAutogrow = "Enabled" -) - -// PossibleStorageAutogrowValues returns an array of possible values for the StorageAutogrow const type. -func PossibleStorageAutogrowValues() []StorageAutogrow { - return []StorageAutogrow{StorageAutogrowDisabled, StorageAutogrowEnabled} -} - -// VirtualNetworkRuleState enumerates the values for virtual network rule state. -type VirtualNetworkRuleState string - -const ( - // VirtualNetworkRuleStateDeleting ... - VirtualNetworkRuleStateDeleting VirtualNetworkRuleState = "Deleting" - // VirtualNetworkRuleStateInitializing ... - VirtualNetworkRuleStateInitializing VirtualNetworkRuleState = "Initializing" - // VirtualNetworkRuleStateInProgress ... - VirtualNetworkRuleStateInProgress VirtualNetworkRuleState = "InProgress" - // VirtualNetworkRuleStateReady ... - VirtualNetworkRuleStateReady VirtualNetworkRuleState = "Ready" - // VirtualNetworkRuleStateUnknown ... - VirtualNetworkRuleStateUnknown VirtualNetworkRuleState = "Unknown" -) - -// PossibleVirtualNetworkRuleStateValues returns an array of possible values for the VirtualNetworkRuleState const type. -func PossibleVirtualNetworkRuleStateValues() []VirtualNetworkRuleState { - return []VirtualNetworkRuleState{VirtualNetworkRuleStateDeleting, VirtualNetworkRuleStateInitializing, VirtualNetworkRuleStateInProgress, VirtualNetworkRuleStateReady, VirtualNetworkRuleStateUnknown} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/firewallrules.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/firewallrules.go deleted file mode 100644 index 750207cdf00..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/firewallrules.go +++ /dev/null @@ -1,395 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// FirewallRulesClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type FirewallRulesClient struct { - BaseClient -} - -// NewFirewallRulesClient creates an instance of the FirewallRulesClient client. -func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { - return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFirewallRulesClientWithBaseURI creates an instance of the FirewallRulesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { - return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new firewall rule or updates an existing firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// firewallRuleName - the name of the server firewall rule. -// parameters - the required parameters for creating or updating a firewall rule. -func (client FirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (result FirewallRulesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Pattern, Rule: `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`, Chain: nil}}}, - {Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Pattern, Rule: `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("postgresql.FirewallRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, firewallRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) CreateOrUpdateSender(req *http.Request) (future FirewallRulesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a server firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// firewallRuleName - the name of the server firewall rule. -func (client FirewallRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRulesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.FirewallRulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FirewallRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) DeleteSender(req *http.Request) (future FirewallRulesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about a server firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// firewallRuleName - the name of the server firewall rule. -func (client FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.FirewallRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client FirewallRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer list all the firewall rules in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client FirewallRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result FirewallRuleListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.FirewallRulesClient", "ListByServer", err.Error()) - } - - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client FirewallRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) ListByServerResponder(resp *http.Response) (result FirewallRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/locationbasedperformancetier.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/locationbasedperformancetier.go deleted file mode 100644 index d09c4a70f47..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/locationbasedperformancetier.go +++ /dev/null @@ -1,115 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LocationBasedPerformanceTierClient is the the Microsoft Azure management API provides create, read, update, and -// delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, -// security alert policies, log files and configurations with new business model. -type LocationBasedPerformanceTierClient struct { - BaseClient -} - -// NewLocationBasedPerformanceTierClient creates an instance of the LocationBasedPerformanceTierClient client. -func NewLocationBasedPerformanceTierClient(subscriptionID string) LocationBasedPerformanceTierClient { - return NewLocationBasedPerformanceTierClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLocationBasedPerformanceTierClientWithBaseURI creates an instance of the LocationBasedPerformanceTierClient -// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI -// (sovereign clouds, Azure stack). -func NewLocationBasedPerformanceTierClientWithBaseURI(baseURI string, subscriptionID string) LocationBasedPerformanceTierClient { - return LocationBasedPerformanceTierClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list all the performance tiers at specified location in a given subscription. -// Parameters: -// locationName - the name of the location. -func (client LocationBasedPerformanceTierClient) List(ctx context.Context, locationName string) (result PerformanceTierListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationBasedPerformanceTierClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.LocationBasedPerformanceTierClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.LocationBasedPerformanceTierClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.LocationBasedPerformanceTierClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.LocationBasedPerformanceTierClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client LocationBasedPerformanceTierClient) ListPreparer(ctx context.Context, locationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/performanceTiers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client LocationBasedPerformanceTierClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client LocationBasedPerformanceTierClient) ListResponder(resp *http.Response) (result PerformanceTierListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/logfiles.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/logfiles.go deleted file mode 100644 index 9de9f62b6f9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/logfiles.go +++ /dev/null @@ -1,119 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LogFilesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log -// files and configurations with new business model. -type LogFilesClient struct { - BaseClient -} - -// NewLogFilesClient creates an instance of the LogFilesClient client. -func NewLogFilesClient(subscriptionID string) LogFilesClient { - return NewLogFilesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLogFilesClientWithBaseURI creates an instance of the LogFilesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewLogFilesClientWithBaseURI(baseURI string, subscriptionID string) LogFilesClient { - return LogFilesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByServer list all the log files in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client LogFilesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result LogFileListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LogFilesClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.LogFilesClient", "ListByServer", err.Error()) - } - - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.LogFilesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.LogFilesClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.LogFilesClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client LogFilesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/logFiles", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client LogFilesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client LogFilesClient) ListByServerResponder(resp *http.Response) (result LogFileListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/models.go deleted file mode 100644 index a1369bec68e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/models.go +++ /dev/null @@ -1,3909 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "github.com/gofrs/uuid" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql" - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CloudError an error response from the Batch service. -type CloudError struct { - Error *ErrorResponse `json:"error,omitempty"` -} - -// Configuration represents a Configuration. -type Configuration struct { - autorest.Response `json:"-"` - // ConfigurationProperties - The properties of a configuration. - *ConfigurationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Configuration. -func (c Configuration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.ConfigurationProperties != nil { - objectMap["properties"] = c.ConfigurationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Configuration struct. -func (c *Configuration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var configurationProperties ConfigurationProperties - err = json.Unmarshal(*v, &configurationProperties) - if err != nil { - return err - } - c.ConfigurationProperties = &configurationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - c.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - c.Type = &typeVar - } - } - } - - return nil -} - -// ConfigurationListResult a list of server configurations. -type ConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - The list of server configurations. - Value *[]Configuration `json:"value,omitempty"` -} - -// ConfigurationProperties the properties of a configuration. -type ConfigurationProperties struct { - // Value - Value of the configuration. - Value *string `json:"value,omitempty"` - // Description - READ-ONLY; Description of the configuration. - Description *string `json:"description,omitempty"` - // DefaultValue - READ-ONLY; Default value of the configuration. - DefaultValue *string `json:"defaultValue,omitempty"` - // DataType - READ-ONLY; Data type of the configuration. - DataType *string `json:"dataType,omitempty"` - // AllowedValues - READ-ONLY; Allowed values of the configuration. - AllowedValues *string `json:"allowedValues,omitempty"` - // Source - Source of the configuration. - Source *string `json:"source,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigurationProperties. -func (cp ConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Value != nil { - objectMap["value"] = cp.Value - } - if cp.Source != nil { - objectMap["source"] = cp.Source - } - return json.Marshal(objectMap) -} - -// ConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConfigurationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConfigurationsClient) (Configuration, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConfigurationsCreateOrUpdateFuture.Result. -func (future *ConfigurationsCreateOrUpdateFuture) result(client ConfigurationsClient) (c Configuration, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - c.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.ConfigurationsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { - c, err = client.CreateOrUpdateResponder(c.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ConfigurationsCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") - } - } - return -} - -// Database represents a Database. -type Database struct { - autorest.Response `json:"-"` - // DatabaseProperties - The properties of a database. - *DatabaseProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Database. -func (d Database) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.DatabaseProperties != nil { - objectMap["properties"] = d.DatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Database struct. -func (d *Database) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - d.DatabaseProperties = &databaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseListResult a List of databases. -type DatabaseListResult struct { - autorest.Response `json:"-"` - // Value - The list of databases housed in a server - Value *[]Database `json:"value,omitempty"` -} - -// DatabaseProperties the properties of a database. -type DatabaseProperties struct { - // Charset - The charset of the database. - Charset *string `json:"charset,omitempty"` - // Collation - The collation of the database. - Collation *string `json:"collation,omitempty"` -} - -// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesCreateOrUpdateFuture.Result. -func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.DatabasesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesDeleteFuture.Result. -func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.DatabasesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for -// failed operations. (This also follows the OData error response format.) -type ErrorResponse struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]ErrorResponse `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponse. -func (er ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FirewallRule represents a server firewall rule. -type FirewallRule struct { - autorest.Response `json:"-"` - // FirewallRuleProperties - The properties of a firewall rule. - *FirewallRuleProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FirewallRule. -func (fr FirewallRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fr.FirewallRuleProperties != nil { - objectMap["properties"] = fr.FirewallRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FirewallRule struct. -func (fr *FirewallRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var firewallRuleProperties FirewallRuleProperties - err = json.Unmarshal(*v, &firewallRuleProperties) - if err != nil { - return err - } - fr.FirewallRuleProperties = &firewallRuleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fr.Type = &typeVar - } - } - } - - return nil -} - -// FirewallRuleListResult a list of firewall rules. -type FirewallRuleListResult struct { - autorest.Response `json:"-"` - // Value - The list of firewall rules in a server. - Value *[]FirewallRule `json:"value,omitempty"` -} - -// FirewallRuleProperties the properties of a server firewall rule. -type FirewallRuleProperties struct { - // StartIPAddress - The start IP address of the server firewall rule. Must be IPv4 format. - StartIPAddress *string `json:"startIpAddress,omitempty"` - // EndIPAddress - The end IP address of the server firewall rule. Must be IPv4 format. - EndIPAddress *string `json:"endIpAddress,omitempty"` -} - -// FirewallRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type FirewallRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FirewallRulesClient) (FirewallRule, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FirewallRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FirewallRulesCreateOrUpdateFuture.Result. -func (future *FirewallRulesCreateOrUpdateFuture) result(client FirewallRulesClient) (fr FirewallRule, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.FirewallRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent { - fr, err = client.CreateOrUpdateResponder(fr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request") - } - } - return -} - -// FirewallRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FirewallRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FirewallRulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FirewallRulesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FirewallRulesDeleteFuture.Result. -func (future *FirewallRulesDeleteFuture) result(client FirewallRulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.FirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.FirewallRulesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// LogFile represents a log file. -type LogFile struct { - // LogFileProperties - The properties of the log file. - *LogFileProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogFile. -func (lf LogFile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lf.LogFileProperties != nil { - objectMap["properties"] = lf.LogFileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for LogFile struct. -func (lf *LogFile) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var logFileProperties LogFileProperties - err = json.Unmarshal(*v, &logFileProperties) - if err != nil { - return err - } - lf.LogFileProperties = &logFileProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lf.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lf.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lf.Type = &typeVar - } - } - } - - return nil -} - -// LogFileListResult a list of log files. -type LogFileListResult struct { - autorest.Response `json:"-"` - // Value - The list of log files. - Value *[]LogFile `json:"value,omitempty"` -} - -// LogFileProperties the properties of a log file. -type LogFileProperties struct { - // SizeInKB - Size of the log file. - SizeInKB *int64 `json:"sizeInKB,omitempty"` - // CreatedTime - READ-ONLY; Creation timestamp of the log file. - CreatedTime *date.Time `json:"createdTime,omitempty"` - // LastModifiedTime - READ-ONLY; Last modified timestamp of the log file. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Type - Type of the log file. - Type *string `json:"type,omitempty"` - // URL - The url to download the log file from. - URL *string `json:"url,omitempty"` -} - -// MarshalJSON is the custom marshaler for LogFileProperties. -func (lfp LogFileProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lfp.SizeInKB != nil { - objectMap["sizeInKB"] = lfp.SizeInKB - } - if lfp.Type != nil { - objectMap["type"] = lfp.Type - } - if lfp.URL != nil { - objectMap["url"] = lfp.URL - } - return json.Marshal(objectMap) -} - -// NameAvailability represents a resource name availability. -type NameAvailability struct { - autorest.Response `json:"-"` - // Message - Error Message. - Message *string `json:"message,omitempty"` - // NameAvailable - Indicates whether the resource name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - Reason for name being unavailable. - Reason *string `json:"reason,omitempty"` -} - -// NameAvailabilityRequest request from client to check resource name availability. -type NameAvailabilityRequest struct { - // Name - Resource name to verify. - Name *string `json:"name,omitempty"` - // Type - Resource type used for verification. - Type *string `json:"type,omitempty"` -} - -// Operation REST API operation definition. -type Operation struct { - // Name - READ-ONLY; The name of the operation being performed on this particular object. - Name *string `json:"name,omitempty"` - // Display - READ-ONLY; The localized display information for this particular operation or action. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'NotSpecified', 'User', 'System' - Origin OperationOrigin `json:"origin,omitempty"` - // Properties - READ-ONLY; Additional descriptions for the operation. - Properties map[string]interface{} `json:"properties"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - READ-ONLY; Operation resource provider name. - Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; Localized friendly name for the operation. - Operation *string `json:"operation,omitempty"` - // Description - READ-ONLY; Operation description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDisplay. -func (od OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResult a list of resource provider operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - The list of resource provider operations. - Value *[]Operation `json:"value,omitempty"` -} - -// PerformanceTierListResult a list of performance tiers. -type PerformanceTierListResult struct { - autorest.Response `json:"-"` - // Value - The list of performance tiers - Value *[]PerformanceTierProperties `json:"value,omitempty"` -} - -// PerformanceTierProperties performance tier properties -type PerformanceTierProperties struct { - // ID - ID of the performance tier. - ID *string `json:"id,omitempty"` - // MaxBackupRetentionDays - Maximum Backup retention in days for the performance tier edition - MaxBackupRetentionDays *int32 `json:"maxBackupRetentionDays,omitempty"` - // MinBackupRetentionDays - Minimum Backup retention in days for the performance tier edition - MinBackupRetentionDays *int32 `json:"minBackupRetentionDays,omitempty"` - // MaxStorageMB - Max storage allowed for a server. - MaxStorageMB *int32 `json:"maxStorageMB,omitempty"` - // MinLargeStorageMB - Max storage allowed for a server. - MinLargeStorageMB *int32 `json:"minLargeStorageMB,omitempty"` - // MaxLargeStorageMB - Max storage allowed for a server. - MaxLargeStorageMB *int32 `json:"maxLargeStorageMB,omitempty"` - // MinStorageMB - Max storage allowed for a server. - MinStorageMB *int32 `json:"minStorageMB,omitempty"` - // ServiceLevelObjectives - Service level objectives associated with the performance tier - ServiceLevelObjectives *[]PerformanceTierServiceLevelObjectives `json:"serviceLevelObjectives,omitempty"` -} - -// PerformanceTierServiceLevelObjectives service level objectives for performance tier. -type PerformanceTierServiceLevelObjectives struct { - // ID - ID for the service level objective. - ID *string `json:"id,omitempty"` - // Edition - Edition of the performance tier. - Edition *string `json:"edition,omitempty"` - // VCore - vCore associated with the service level objective - VCore *int32 `json:"vCore,omitempty"` - // HardwareGeneration - Hardware generation associated with the service level objective - HardwareGeneration *string `json:"hardwareGeneration,omitempty"` - // MaxBackupRetentionDays - Maximum Backup retention in days for the performance tier edition - MaxBackupRetentionDays *int32 `json:"maxBackupRetentionDays,omitempty"` - // MinBackupRetentionDays - Minimum Backup retention in days for the performance tier edition - MinBackupRetentionDays *int32 `json:"minBackupRetentionDays,omitempty"` - // MaxStorageMB - Max storage allowed for a server. - MaxStorageMB *int32 `json:"maxStorageMB,omitempty"` - // MinStorageMB - Max storage allowed for a server. - MinStorageMB *int32 `json:"minStorageMB,omitempty"` -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections. -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. -func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionListResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultIterator struct { - i int - page PrivateEndpointConnectionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. -func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { - return PrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { - return peclr.Value == nil || len(*peclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { - return peclr.NextLink != nil && len(*peclr.NextLink) != 0 -} - -// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !peclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclr.NextLink))) -} - -// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultPage struct { - fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) - peclr PrivateEndpointConnectionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.peclr) - if err != nil { - return err - } - page.peclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.peclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { - return page.peclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { - if page.peclr.IsEmpty() { - return nil - } - return *page.peclr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultPage type. -func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { - return PrivateEndpointConnectionListResultPage{ - fn: getNextPage, - peclr: cur, - } -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; State of the private endpoint connection. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. -func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecp.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = pecp.PrivateEndpoint - } - if pecp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.PrivateEndpointConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointConnectionsUpdateTagsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsUpdateTagsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsUpdateTagsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsUpdateTagsFuture.Result. -func (future *PrivateEndpointConnectionsUpdateTagsFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsUpdateTagsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.PrivateEndpointConnectionsUpdateTagsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.UpdateTagsResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsUpdateTagsFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointProperty ... -type PrivateEndpointProperty struct { - // ID - Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // Properties - READ-ONLY; The private link resource group id. - Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult. -func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourceListResultIterator struct { - i int - page PrivateLinkResourceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListResultIterator type. -func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { - return PrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListResultPage struct { - fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) - plrlr PrivateLinkResourceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.plrlr) - if err != nil { - return err - } - page.plrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourceListResultPage type. -func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { - return PrivateLinkResourceListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionStateProperty ... -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; The actions required for private link service connection. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != nil { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecoverableServerProperties the recoverable server's properties. -type RecoverableServerProperties struct { - // LastAvailableBackupDateTime - READ-ONLY; The last available backup date time. - LastAvailableBackupDateTime *string `json:"lastAvailableBackupDateTime,omitempty"` - // ServiceLevelObjective - READ-ONLY; The service level objective - ServiceLevelObjective *string `json:"serviceLevelObjective,omitempty"` - // Edition - READ-ONLY; Edition of the performance tier. - Edition *string `json:"edition,omitempty"` - // VCore - READ-ONLY; vCore associated with the service level objective - VCore *int32 `json:"vCore,omitempty"` - // HardwareGeneration - READ-ONLY; Hardware generation associated with the service level objective - HardwareGeneration *string `json:"hardwareGeneration,omitempty"` - // Version - READ-ONLY; The PostgreSQL version - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecoverableServerProperties. -func (rsp RecoverableServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RecoverableServerResource a recoverable server resource. -type RecoverableServerResource struct { - autorest.Response `json:"-"` - // RecoverableServerProperties - Resource properties. - *RecoverableServerProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecoverableServerResource. -func (rsr RecoverableServerResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rsr.RecoverableServerProperties != nil { - objectMap["properties"] = rsr.RecoverableServerProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RecoverableServerResource struct. -func (rsr *RecoverableServerResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var recoverableServerProperties RecoverableServerProperties - err = json.Unmarshal(*v, &recoverableServerProperties) - if err != nil { - return err - } - rsr.RecoverableServerProperties = &recoverableServerProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rsr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rsr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rsr.Type = &typeVar - } - } - } - - return nil -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceIdentity azure Active Directory identity configuration for a resource. -type ResourceIdentity struct { - // PrincipalID - READ-ONLY; The Azure Active Directory principal id. - PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // Type - The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. Possible values include: 'SystemAssigned' - Type IdentityType `json:"type,omitempty"` - // TenantID - READ-ONLY; The Azure Active Directory tenant id. - TenantID *uuid.UUID `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceIdentity. -func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ri.Type != "" { - objectMap["type"] = ri.Type - } - return json.Marshal(objectMap) -} - -// SecurityAlertPolicyProperties properties of a security alert policy. -type SecurityAlertPolicyProperties struct { - // State - Specifies the state of the policy, whether it is enabled or disabled. Possible values include: 'ServerSecurityAlertPolicyStateEnabled', 'ServerSecurityAlertPolicyStateDisabled' - State ServerSecurityAlertPolicyState `json:"state,omitempty"` - // DisabledAlerts - Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly - DisabledAlerts *[]string `json:"disabledAlerts,omitempty"` - // EmailAddresses - Specifies an array of e-mail addresses to which the alert is sent. - EmailAddresses *[]string `json:"emailAddresses,omitempty"` - // EmailAccountAdmins - Specifies that the alert is sent to the account administrators. - EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` - // StorageEndpoint - Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. - StorageEndpoint *string `json:"storageEndpoint,omitempty"` - // StorageAccountAccessKey - Specifies the identifier key of the Threat Detection audit storage account. - StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` - // RetentionDays - Specifies the number of days to keep in the Threat Detection audit logs. - RetentionDays *int32 `json:"retentionDays,omitempty"` -} - -// Server represents a server. -type Server struct { - autorest.Response `json:"-"` - // Identity - The Azure Active Directory identity of the server. - Identity *ResourceIdentity `json:"identity,omitempty"` - // Sku - The SKU (pricing tier) of the server. - Sku *Sku `json:"sku,omitempty"` - // ServerProperties - Properties of the server. - *ServerProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Server. -func (s Server) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Identity != nil { - objectMap["identity"] = s.Identity - } - if s.Sku != nil { - objectMap["sku"] = s.Sku - } - if s.ServerProperties != nil { - objectMap["properties"] = s.ServerProperties - } - if s.Tags != nil { - objectMap["tags"] = s.Tags - } - if s.Location != nil { - objectMap["location"] = s.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Server struct. -func (s *Server) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "identity": - if v != nil { - var identity ResourceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - s.Identity = &identity - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - s.Sku = &sku - } - case "properties": - if v != nil { - var serverProperties ServerProperties - err = json.Unmarshal(*v, &serverProperties) - if err != nil { - return err - } - s.ServerProperties = &serverProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - s.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - s.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - s.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - s.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - s.Type = &typeVar - } - } - } - - return nil -} - -// ServerAdministratorProperties the properties of an server Administrator. -type ServerAdministratorProperties struct { - // AdministratorType - The type of administrator. - AdministratorType *string `json:"administratorType,omitempty"` - // Login - The server administrator login account name. - Login *string `json:"login,omitempty"` - // Sid - The server administrator Sid (Secure ID). - Sid *uuid.UUID `json:"sid,omitempty"` - // TenantID - The server Active Directory Administrator tenant id. - TenantID *uuid.UUID `json:"tenantId,omitempty"` -} - -// ServerAdministratorResource represents a and external administrator to be created. -type ServerAdministratorResource struct { - autorest.Response `json:"-"` - // ServerAdministratorProperties - Properties of the server AAD administrator. - *ServerAdministratorProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerAdministratorResource. -func (sar ServerAdministratorResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sar.ServerAdministratorProperties != nil { - objectMap["properties"] = sar.ServerAdministratorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerAdministratorResource struct. -func (sar *ServerAdministratorResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var serverAdministratorProperties ServerAdministratorProperties - err = json.Unmarshal(*v, &serverAdministratorProperties) - if err != nil { - return err - } - sar.ServerAdministratorProperties = &serverAdministratorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sar.Type = &typeVar - } - } - } - - return nil -} - -// ServerAdministratorResourceListResult the response to a list Active Directory Administrators request. -type ServerAdministratorResourceListResult struct { - autorest.Response `json:"-"` - // Value - The list of server Active Directory Administrators for the server. - Value *[]ServerAdministratorResource `json:"value,omitempty"` -} - -// ServerAdministratorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServerAdministratorsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerAdministratorsClient) (ServerAdministratorResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerAdministratorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServerAdministratorsCreateOrUpdateFuture.Result. -func (future *ServerAdministratorsCreateOrUpdateFuture) result(client ServerAdministratorsClient) (sar ServerAdministratorResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerAdministratorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.ServerAdministratorsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sar.Response.Response, err = future.GetResult(sender); err == nil && sar.Response.Response.StatusCode != http.StatusNoContent { - sar, err = client.CreateOrUpdateResponder(sar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerAdministratorsCreateOrUpdateFuture", "Result", sar.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerAdministratorsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServerAdministratorsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerAdministratorsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerAdministratorsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServerAdministratorsDeleteFuture.Result. -func (future *ServerAdministratorsDeleteFuture) result(client ServerAdministratorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerAdministratorsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.ServerAdministratorsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerForCreate represents a server to be created. -type ServerForCreate struct { - // Identity - The Azure Active Directory identity of the server. - Identity *ResourceIdentity `json:"identity,omitempty"` - // Sku - The SKU (pricing tier) of the server. - Sku *Sku `json:"sku,omitempty"` - // Properties - Properties of the server. - Properties BasicServerPropertiesForCreate `json:"properties,omitempty"` - // Location - The location the resource resides in. - Location *string `json:"location,omitempty"` - // Tags - Application-specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServerForCreate. -func (sfc ServerForCreate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sfc.Identity != nil { - objectMap["identity"] = sfc.Identity - } - if sfc.Sku != nil { - objectMap["sku"] = sfc.Sku - } - objectMap["properties"] = sfc.Properties - if sfc.Location != nil { - objectMap["location"] = sfc.Location - } - if sfc.Tags != nil { - objectMap["tags"] = sfc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerForCreate struct. -func (sfc *ServerForCreate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "identity": - if v != nil { - var identity ResourceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sfc.Identity = &identity - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sfc.Sku = &sku - } - case "properties": - if v != nil { - properties, err := unmarshalBasicServerPropertiesForCreate(*v) - if err != nil { - return err - } - sfc.Properties = properties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sfc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sfc.Tags = tags - } - } - } - - return nil -} - -// ServerKey a PostgreSQL Server key. -type ServerKey struct { - autorest.Response `json:"-"` - // Kind - READ-ONLY; Kind of encryption protector used to protect the key. - Kind *string `json:"kind,omitempty"` - // ServerKeyProperties - Properties of the ServerKey Resource. - *ServerKeyProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerKey. -func (sk ServerKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sk.ServerKeyProperties != nil { - objectMap["properties"] = sk.ServerKeyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerKey struct. -func (sk *ServerKey) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - sk.Kind = &kind - } - case "properties": - if v != nil { - var serverKeyProperties ServerKeyProperties - err = json.Unmarshal(*v, &serverKeyProperties) - if err != nil { - return err - } - sk.ServerKeyProperties = &serverKeyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sk.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sk.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sk.Type = &typeVar - } - } - } - - return nil -} - -// ServerKeyListResult a list of PostgreSQL Server keys. -type ServerKeyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; A list of PostgreSQL Server keys. - Value *[]ServerKey `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerKeyListResult. -func (sklr ServerKeyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerKeyListResultIterator provides access to a complete listing of ServerKey values. -type ServerKeyListResultIterator struct { - i int - page ServerKeyListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServerKeyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeyListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServerKeyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerKeyListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServerKeyListResultIterator) Response() ServerKeyListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServerKeyListResultIterator) Value() ServerKey { - if !iter.page.NotDone() { - return ServerKey{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerKeyListResultIterator type. -func NewServerKeyListResultIterator(page ServerKeyListResultPage) ServerKeyListResultIterator { - return ServerKeyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sklr ServerKeyListResult) IsEmpty() bool { - return sklr.Value == nil || len(*sklr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sklr ServerKeyListResult) hasNextLink() bool { - return sklr.NextLink != nil && len(*sklr.NextLink) != 0 -} - -// serverKeyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sklr ServerKeyListResult) serverKeyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sklr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sklr.NextLink))) -} - -// ServerKeyListResultPage contains a page of ServerKey values. -type ServerKeyListResultPage struct { - fn func(context.Context, ServerKeyListResult) (ServerKeyListResult, error) - sklr ServerKeyListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServerKeyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeyListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sklr) - if err != nil { - return err - } - page.sklr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServerKeyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerKeyListResultPage) NotDone() bool { - return !page.sklr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerKeyListResultPage) Response() ServerKeyListResult { - return page.sklr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerKeyListResultPage) Values() []ServerKey { - if page.sklr.IsEmpty() { - return nil - } - return *page.sklr.Value -} - -// Creates a new instance of the ServerKeyListResultPage type. -func NewServerKeyListResultPage(cur ServerKeyListResult, getNextPage func(context.Context, ServerKeyListResult) (ServerKeyListResult, error)) ServerKeyListResultPage { - return ServerKeyListResultPage{ - fn: getNextPage, - sklr: cur, - } -} - -// ServerKeyProperties properties for a key execution. -type ServerKeyProperties struct { - // ServerKeyType - The key type like 'AzureKeyVault'. - ServerKeyType *string `json:"serverKeyType,omitempty"` - // URI - The URI of the key. - URI *string `json:"uri,omitempty"` - // CreationDate - READ-ONLY; The key creation date. - CreationDate *date.Time `json:"creationDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerKeyProperties. -func (skp ServerKeyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if skp.ServerKeyType != nil { - objectMap["serverKeyType"] = skp.ServerKeyType - } - if skp.URI != nil { - objectMap["uri"] = skp.URI - } - return json.Marshal(objectMap) -} - -// ServerKeysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServerKeysCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerKeysClient) (ServerKey, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerKeysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServerKeysCreateOrUpdateFuture.Result. -func (future *ServerKeysCreateOrUpdateFuture) result(client ServerKeysClient) (sk ServerKey, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerKeysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sk.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.ServerKeysCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sk.Response.Response, err = future.GetResult(sender); err == nil && sk.Response.Response.StatusCode != http.StatusNoContent { - sk, err = client.CreateOrUpdateResponder(sk.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerKeysCreateOrUpdateFuture", "Result", sk.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerKeysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServerKeysDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerKeysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerKeysDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServerKeysDeleteFuture.Result. -func (future *ServerKeysDeleteFuture) result(client ServerKeysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerKeysDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.ServerKeysDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerListResult a list of servers. -type ServerListResult struct { - autorest.Response `json:"-"` - // Value - The list of servers - Value *[]Server `json:"value,omitempty"` -} - -// ServerParametersListUpdateConfigurationsFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ServerParametersListUpdateConfigurationsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerParametersClient) (ConfigurationListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerParametersListUpdateConfigurationsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServerParametersListUpdateConfigurationsFuture.Result. -func (future *ServerParametersListUpdateConfigurationsFuture) result(client ServerParametersClient) (clr ConfigurationListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerParametersListUpdateConfigurationsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - clr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.ServerParametersListUpdateConfigurationsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if clr.Response.Response, err = future.GetResult(sender); err == nil && clr.Response.Response.StatusCode != http.StatusNoContent { - clr, err = client.ListUpdateConfigurationsResponder(clr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerParametersListUpdateConfigurationsFuture", "Result", clr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerPrivateEndpointConnection a private endpoint connection under a server -type ServerPrivateEndpointConnection struct { - // ID - READ-ONLY; Resource ID of the Private Endpoint Connection. - ID *string `json:"id,omitempty"` - // Properties - READ-ONLY; Private endpoint connection properties - Properties *ServerPrivateEndpointConnectionProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPrivateEndpointConnection. -func (spec ServerPrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerPrivateEndpointConnectionProperties properties of a private endpoint connection. -type ServerPrivateEndpointConnectionProperties struct { - // PrivateEndpoint - Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. - PrivateLinkServiceConnectionState *ServerPrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; State of the private endpoint connection. Possible values include: 'Approving', 'Ready', 'Dropping', 'Failed', 'Rejecting' - ProvisioningState PrivateEndpointProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPrivateEndpointConnectionProperties. -func (specp ServerPrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if specp.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = specp.PrivateEndpoint - } - if specp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = specp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// ServerPrivateLinkServiceConnectionStateProperty ... -type ServerPrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. Possible values include: 'Approved', 'Pending', 'Rejected', 'Disconnected' - Status PrivateLinkServiceConnectionStateStatus `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; The actions required for private link service connection. Possible values include: 'None' - ActionsRequired PrivateLinkServiceConnectionStateActionsRequire `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPrivateLinkServiceConnectionStateProperty. -func (splscsp ServerPrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if splscsp.Status != "" { - objectMap["status"] = splscsp.Status - } - if splscsp.Description != nil { - objectMap["description"] = splscsp.Description - } - return json.Marshal(objectMap) -} - -// ServerProperties the properties of a server. -type ServerProperties struct { - // AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix', 'OneZero', 'OneZeroFullStopZero', 'OneZeroFullStopTwo', 'OneOne' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' - MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` - // ByokEnforcement - READ-ONLY; Status showing whether the server data encryption is enabled with customer-managed keys. - ByokEnforcement *string `json:"byokEnforcement,omitempty"` - // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' - InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` - // UserVisibleState - A state of a server that is visible to user. Possible values include: 'ServerStateReady', 'ServerStateDropping', 'ServerStateDisabled', 'ServerStateInaccessible' - UserVisibleState ServerState `json:"userVisibleState,omitempty"` - // FullyQualifiedDomainName - The fully qualified domain name of a server. - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` - // EarliestRestoreDate - Earliest restore point creation time (ISO8601 format) - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // ReplicationRole - The replication role of the server. - ReplicationRole *string `json:"replicationRole,omitempty"` - // MasterServerID - The master server id of a replica server. - MasterServerID *string `json:"masterServerId,omitempty"` - // ReplicaCapacity - The maximum number of replicas that a master server can have. - ReplicaCapacity *int32 `json:"replicaCapacity,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections on a server - PrivateEndpointConnections *[]ServerPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerProperties. -func (sp ServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.AdministratorLogin != nil { - objectMap["administratorLogin"] = sp.AdministratorLogin - } - if sp.Version != "" { - objectMap["version"] = sp.Version - } - if sp.SslEnforcement != "" { - objectMap["sslEnforcement"] = sp.SslEnforcement - } - if sp.MinimalTLSVersion != "" { - objectMap["minimalTlsVersion"] = sp.MinimalTLSVersion - } - if sp.InfrastructureEncryption != "" { - objectMap["infrastructureEncryption"] = sp.InfrastructureEncryption - } - if sp.UserVisibleState != "" { - objectMap["userVisibleState"] = sp.UserVisibleState - } - if sp.FullyQualifiedDomainName != nil { - objectMap["fullyQualifiedDomainName"] = sp.FullyQualifiedDomainName - } - if sp.EarliestRestoreDate != nil { - objectMap["earliestRestoreDate"] = sp.EarliestRestoreDate - } - if sp.StorageProfile != nil { - objectMap["storageProfile"] = sp.StorageProfile - } - if sp.ReplicationRole != nil { - objectMap["replicationRole"] = sp.ReplicationRole - } - if sp.MasterServerID != nil { - objectMap["masterServerId"] = sp.MasterServerID - } - if sp.ReplicaCapacity != nil { - objectMap["replicaCapacity"] = sp.ReplicaCapacity - } - if sp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = sp.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// BasicServerPropertiesForCreate the properties used to create a new server. -type BasicServerPropertiesForCreate interface { - AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) - AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) - AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) - AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) - AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) -} - -// ServerPropertiesForCreate the properties used to create a new server. -type ServerPropertiesForCreate struct { - // Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix', 'OneZero', 'OneZeroFullStopZero', 'OneZeroFullStopTwo', 'OneOne' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' - MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` - // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' - InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' - CreateMode CreateMode `json:"createMode,omitempty"` -} - -func unmarshalBasicServerPropertiesForCreate(body []byte) (BasicServerPropertiesForCreate, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["createMode"] { - case string(CreateModeDefault): - var spfdc ServerPropertiesForDefaultCreate - err := json.Unmarshal(body, &spfdc) - return spfdc, err - case string(CreateModePointInTimeRestore): - var spfr ServerPropertiesForRestore - err := json.Unmarshal(body, &spfr) - return spfr, err - case string(CreateModeGeoRestore): - var spfgr ServerPropertiesForGeoRestore - err := json.Unmarshal(body, &spfgr) - return spfgr, err - case string(CreateModeReplica): - var spfr ServerPropertiesForReplica - err := json.Unmarshal(body, &spfr) - return spfr, err - default: - var spfc ServerPropertiesForCreate - err := json.Unmarshal(body, &spfc) - return spfc, err - } -} -func unmarshalBasicServerPropertiesForCreateArray(body []byte) ([]BasicServerPropertiesForCreate, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - spfcArray := make([]BasicServerPropertiesForCreate, len(rawMessages)) - - for index, rawMessage := range rawMessages { - spfc, err := unmarshalBasicServerPropertiesForCreate(*rawMessage) - if err != nil { - return nil, err - } - spfcArray[index] = spfc - } - return spfcArray, nil -} - -// MarshalJSON is the custom marshaler for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) MarshalJSON() ([]byte, error) { - spfc.CreateMode = CreateModeServerPropertiesForCreate - objectMap := make(map[string]interface{}) - if spfc.Version != "" { - objectMap["version"] = spfc.Version - } - if spfc.SslEnforcement != "" { - objectMap["sslEnforcement"] = spfc.SslEnforcement - } - if spfc.MinimalTLSVersion != "" { - objectMap["minimalTlsVersion"] = spfc.MinimalTLSVersion - } - if spfc.InfrastructureEncryption != "" { - objectMap["infrastructureEncryption"] = spfc.InfrastructureEncryption - } - if spfc.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = spfc.PublicNetworkAccess - } - if spfc.StorageProfile != nil { - objectMap["storageProfile"] = spfc.StorageProfile - } - if spfc.CreateMode != "" { - objectMap["createMode"] = spfc.CreateMode - } - return json.Marshal(objectMap) -} - -// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { - return nil, false -} - -// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { - return nil, false -} - -// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { - return nil, false -} - -// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { - return nil, false -} - -// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { - return &spfc, true -} - -// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForCreate. -func (spfc ServerPropertiesForCreate) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { - return &spfc, true -} - -// ServerPropertiesForDefaultCreate the properties used to create a new server. -type ServerPropertiesForDefaultCreate struct { - // AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The password of the administrator login. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix', 'OneZero', 'OneZeroFullStopZero', 'OneZeroFullStopTwo', 'OneOne' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' - MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` - // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' - InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' - CreateMode CreateMode `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) { - spfdc.CreateMode = CreateModeDefault - objectMap := make(map[string]interface{}) - if spfdc.AdministratorLogin != nil { - objectMap["administratorLogin"] = spfdc.AdministratorLogin - } - if spfdc.AdministratorLoginPassword != nil { - objectMap["administratorLoginPassword"] = spfdc.AdministratorLoginPassword - } - if spfdc.Version != "" { - objectMap["version"] = spfdc.Version - } - if spfdc.SslEnforcement != "" { - objectMap["sslEnforcement"] = spfdc.SslEnforcement - } - if spfdc.MinimalTLSVersion != "" { - objectMap["minimalTlsVersion"] = spfdc.MinimalTLSVersion - } - if spfdc.InfrastructureEncryption != "" { - objectMap["infrastructureEncryption"] = spfdc.InfrastructureEncryption - } - if spfdc.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = spfdc.PublicNetworkAccess - } - if spfdc.StorageProfile != nil { - objectMap["storageProfile"] = spfdc.StorageProfile - } - if spfdc.CreateMode != "" { - objectMap["createMode"] = spfdc.CreateMode - } - return json.Marshal(objectMap) -} - -// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { - return &spfdc, true -} - -// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { - return nil, false -} - -// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { - return nil, false -} - -// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { - return nil, false -} - -// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { - return nil, false -} - -// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForDefaultCreate. -func (spfdc ServerPropertiesForDefaultCreate) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { - return &spfdc, true -} - -// ServerPropertiesForGeoRestore the properties used to create a new server by restoring to a different -// region from a geo replicated backup. -type ServerPropertiesForGeoRestore struct { - // SourceServerID - The source server id to restore from. - SourceServerID *string `json:"sourceServerId,omitempty"` - // Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix', 'OneZero', 'OneZeroFullStopZero', 'OneZeroFullStopTwo', 'OneOne' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' - MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` - // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' - InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' - CreateMode CreateMode `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) { - spfgr.CreateMode = CreateModeGeoRestore - objectMap := make(map[string]interface{}) - if spfgr.SourceServerID != nil { - objectMap["sourceServerId"] = spfgr.SourceServerID - } - if spfgr.Version != "" { - objectMap["version"] = spfgr.Version - } - if spfgr.SslEnforcement != "" { - objectMap["sslEnforcement"] = spfgr.SslEnforcement - } - if spfgr.MinimalTLSVersion != "" { - objectMap["minimalTlsVersion"] = spfgr.MinimalTLSVersion - } - if spfgr.InfrastructureEncryption != "" { - objectMap["infrastructureEncryption"] = spfgr.InfrastructureEncryption - } - if spfgr.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = spfgr.PublicNetworkAccess - } - if spfgr.StorageProfile != nil { - objectMap["storageProfile"] = spfgr.StorageProfile - } - if spfgr.CreateMode != "" { - objectMap["createMode"] = spfgr.CreateMode - } - return json.Marshal(objectMap) -} - -// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { - return nil, false -} - -// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { - return nil, false -} - -// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { - return &spfgr, true -} - -// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { - return nil, false -} - -// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { - return nil, false -} - -// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForGeoRestore. -func (spfgr ServerPropertiesForGeoRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { - return &spfgr, true -} - -// ServerPropertiesForReplica the properties to create a new replica. -type ServerPropertiesForReplica struct { - // SourceServerID - The master server id to create replica from. - SourceServerID *string `json:"sourceServerId,omitempty"` - // Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix', 'OneZero', 'OneZeroFullStopZero', 'OneZeroFullStopTwo', 'OneOne' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' - MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` - // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' - InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' - CreateMode CreateMode `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) MarshalJSON() ([]byte, error) { - spfr.CreateMode = CreateModeReplica - objectMap := make(map[string]interface{}) - if spfr.SourceServerID != nil { - objectMap["sourceServerId"] = spfr.SourceServerID - } - if spfr.Version != "" { - objectMap["version"] = spfr.Version - } - if spfr.SslEnforcement != "" { - objectMap["sslEnforcement"] = spfr.SslEnforcement - } - if spfr.MinimalTLSVersion != "" { - objectMap["minimalTlsVersion"] = spfr.MinimalTLSVersion - } - if spfr.InfrastructureEncryption != "" { - objectMap["infrastructureEncryption"] = spfr.InfrastructureEncryption - } - if spfr.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = spfr.PublicNetworkAccess - } - if spfr.StorageProfile != nil { - objectMap["storageProfile"] = spfr.StorageProfile - } - if spfr.CreateMode != "" { - objectMap["createMode"] = spfr.CreateMode - } - return json.Marshal(objectMap) -} - -// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { - return nil, false -} - -// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { - return nil, false -} - -// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { - return nil, false -} - -// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { - return &spfr, true -} - -// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { - return nil, false -} - -// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForReplica. -func (spfr ServerPropertiesForReplica) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { - return &spfr, true -} - -// ServerPropertiesForRestore the properties used to create a new server by restoring from a backup. -type ServerPropertiesForRestore struct { - // SourceServerID - The source server id to restore from. - SourceServerID *string `json:"sourceServerId,omitempty"` - // RestorePointInTime - Restore point creation time (ISO8601 format), specifying the time to restore from. - RestorePointInTime *date.Time `json:"restorePointInTime,omitempty"` - // Version - Server version. Possible values include: 'NineFullStopFive', 'NineFullStopSix', 'OneZero', 'OneZeroFullStopZero', 'OneZeroFullStopTwo', 'OneOne' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' - MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` - // InfrastructureEncryption - Status showing whether the server enabled infrastructure encryption. Possible values include: 'InfrastructureEncryptionEnabled', 'InfrastructureEncryptionDisabled' - InfrastructureEncryption InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // CreateMode - Possible values include: 'CreateModeServerPropertiesForCreate', 'CreateModeDefault', 'CreateModePointInTimeRestore', 'CreateModeGeoRestore', 'CreateModeReplica' - CreateMode CreateMode `json:"createMode,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { - spfr.CreateMode = CreateModePointInTimeRestore - objectMap := make(map[string]interface{}) - if spfr.SourceServerID != nil { - objectMap["sourceServerId"] = spfr.SourceServerID - } - if spfr.RestorePointInTime != nil { - objectMap["restorePointInTime"] = spfr.RestorePointInTime - } - if spfr.Version != "" { - objectMap["version"] = spfr.Version - } - if spfr.SslEnforcement != "" { - objectMap["sslEnforcement"] = spfr.SslEnforcement - } - if spfr.MinimalTLSVersion != "" { - objectMap["minimalTlsVersion"] = spfr.MinimalTLSVersion - } - if spfr.InfrastructureEncryption != "" { - objectMap["infrastructureEncryption"] = spfr.InfrastructureEncryption - } - if spfr.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = spfr.PublicNetworkAccess - } - if spfr.StorageProfile != nil { - objectMap["storageProfile"] = spfr.StorageProfile - } - if spfr.CreateMode != "" { - objectMap["createMode"] = spfr.CreateMode - } - return json.Marshal(objectMap) -} - -// AsServerPropertiesForDefaultCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsServerPropertiesForDefaultCreate() (*ServerPropertiesForDefaultCreate, bool) { - return nil, false -} - -// AsServerPropertiesForRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsServerPropertiesForRestore() (*ServerPropertiesForRestore, bool) { - return &spfr, true -} - -// AsServerPropertiesForGeoRestore is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsServerPropertiesForGeoRestore() (*ServerPropertiesForGeoRestore, bool) { - return nil, false -} - -// AsServerPropertiesForReplica is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsServerPropertiesForReplica() (*ServerPropertiesForReplica, bool) { - return nil, false -} - -// AsServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsServerPropertiesForCreate() (*ServerPropertiesForCreate, bool) { - return nil, false -} - -// AsBasicServerPropertiesForCreate is the BasicServerPropertiesForCreate implementation for ServerPropertiesForRestore. -func (spfr ServerPropertiesForRestore) AsBasicServerPropertiesForCreate() (BasicServerPropertiesForCreate, bool) { - return &spfr, true -} - -// ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (Server, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersCreateFuture.Result. -func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.ServersCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.CreateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersDeleteFuture.Result. -func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.ServersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServerSecurityAlertPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ServerSecurityAlertPoliciesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServerSecurityAlertPoliciesClient) (ServerSecurityAlertPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServerSecurityAlertPoliciesCreateOrUpdateFuture.Result. -func (future *ServerSecurityAlertPoliciesCreateOrUpdateFuture) result(client ServerSecurityAlertPoliciesClient) (ssap ServerSecurityAlertPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ssap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.ServerSecurityAlertPoliciesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ssap.Response.Response, err = future.GetResult(sender); err == nil && ssap.Response.Response.StatusCode != http.StatusNoContent { - ssap, err = client.CreateOrUpdateResponder(ssap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesCreateOrUpdateFuture", "Result", ssap.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerSecurityAlertPolicy a server security alert policy. -type ServerSecurityAlertPolicy struct { - autorest.Response `json:"-"` - // SecurityAlertPolicyProperties - Resource properties. - *SecurityAlertPolicyProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicy. -func (ssap ServerSecurityAlertPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ssap.SecurityAlertPolicyProperties != nil { - objectMap["properties"] = ssap.SecurityAlertPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerSecurityAlertPolicy struct. -func (ssap *ServerSecurityAlertPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var securityAlertPolicyProperties SecurityAlertPolicyProperties - err = json.Unmarshal(*v, &securityAlertPolicyProperties) - if err != nil { - return err - } - ssap.SecurityAlertPolicyProperties = &securityAlertPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ssap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ssap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ssap.Type = &typeVar - } - } - } - - return nil -} - -// ServerSecurityAlertPolicyListResult a list of the server's security alert policies. -type ServerSecurityAlertPolicyListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]ServerSecurityAlertPolicy `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerSecurityAlertPolicyListResult. -func (ssaplr ServerSecurityAlertPolicyListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServerSecurityAlertPolicyListResultIterator provides access to a complete listing of -// ServerSecurityAlertPolicy values. -type ServerSecurityAlertPolicyListResultIterator struct { - i int - page ServerSecurityAlertPolicyListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServerSecurityAlertPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPolicyListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServerSecurityAlertPolicyListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerSecurityAlertPolicyListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServerSecurityAlertPolicyListResultIterator) Response() ServerSecurityAlertPolicyListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServerSecurityAlertPolicyListResultIterator) Value() ServerSecurityAlertPolicy { - if !iter.page.NotDone() { - return ServerSecurityAlertPolicy{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerSecurityAlertPolicyListResultIterator type. -func NewServerSecurityAlertPolicyListResultIterator(page ServerSecurityAlertPolicyListResultPage) ServerSecurityAlertPolicyListResultIterator { - return ServerSecurityAlertPolicyListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ssaplr ServerSecurityAlertPolicyListResult) IsEmpty() bool { - return ssaplr.Value == nil || len(*ssaplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ssaplr ServerSecurityAlertPolicyListResult) hasNextLink() bool { - return ssaplr.NextLink != nil && len(*ssaplr.NextLink) != 0 -} - -// serverSecurityAlertPolicyListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ssaplr ServerSecurityAlertPolicyListResult) serverSecurityAlertPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ssaplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ssaplr.NextLink))) -} - -// ServerSecurityAlertPolicyListResultPage contains a page of ServerSecurityAlertPolicy values. -type ServerSecurityAlertPolicyListResultPage struct { - fn func(context.Context, ServerSecurityAlertPolicyListResult) (ServerSecurityAlertPolicyListResult, error) - ssaplr ServerSecurityAlertPolicyListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServerSecurityAlertPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPolicyListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ssaplr) - if err != nil { - return err - } - page.ssaplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServerSecurityAlertPolicyListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerSecurityAlertPolicyListResultPage) NotDone() bool { - return !page.ssaplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerSecurityAlertPolicyListResultPage) Response() ServerSecurityAlertPolicyListResult { - return page.ssaplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerSecurityAlertPolicyListResultPage) Values() []ServerSecurityAlertPolicy { - if page.ssaplr.IsEmpty() { - return nil - } - return *page.ssaplr.Value -} - -// Creates a new instance of the ServerSecurityAlertPolicyListResultPage type. -func NewServerSecurityAlertPolicyListResultPage(cur ServerSecurityAlertPolicyListResult, getNextPage func(context.Context, ServerSecurityAlertPolicyListResult) (ServerSecurityAlertPolicyListResult, error)) ServerSecurityAlertPolicyListResultPage { - return ServerSecurityAlertPolicyListResultPage{ - fn: getNextPage, - ssaplr: cur, - } -} - -// ServersRestartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersRestartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersRestartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersRestartFuture.Result. -func (future *ServersRestartFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersRestartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.ServersRestartFuture") - return - } - ar.Response = future.Response() - return -} - -// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (Server, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersUpdateFuture.Result. -func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.ServersUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.UpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerUpdateParameters parameters allowed to update for a server. -type ServerUpdateParameters struct { - // Identity - The Azure Active Directory identity of the server. - Identity *ResourceIdentity `json:"identity,omitempty"` - // Sku - The SKU (pricing tier) of the server. - Sku *Sku `json:"sku,omitempty"` - // ServerUpdateParametersProperties - The properties that can be updated for a server. - *ServerUpdateParametersProperties `json:"properties,omitempty"` - // Tags - Application-specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServerUpdateParameters. -func (sup ServerUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sup.Identity != nil { - objectMap["identity"] = sup.Identity - } - if sup.Sku != nil { - objectMap["sku"] = sup.Sku - } - if sup.ServerUpdateParametersProperties != nil { - objectMap["properties"] = sup.ServerUpdateParametersProperties - } - if sup.Tags != nil { - objectMap["tags"] = sup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerUpdateParameters struct. -func (sup *ServerUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "identity": - if v != nil { - var identity ResourceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sup.Identity = &identity - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sup.Sku = &sku - } - case "properties": - if v != nil { - var serverUpdateParametersProperties ServerUpdateParametersProperties - err = json.Unmarshal(*v, &serverUpdateParametersProperties) - if err != nil { - return err - } - sup.ServerUpdateParametersProperties = &serverUpdateParametersProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sup.Tags = tags - } - } - } - - return nil -} - -// ServerUpdateParametersProperties the properties that can be updated for a server. -type ServerUpdateParametersProperties struct { - // StorageProfile - Storage profile of a server. - StorageProfile *StorageProfile `json:"storageProfile,omitempty"` - // AdministratorLoginPassword - The password of the administrator login. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // Version - The version of a server. Possible values include: 'NineFullStopFive', 'NineFullStopSix', 'OneZero', 'OneZeroFullStopZero', 'OneZeroFullStopTwo', 'OneOne' - Version ServerVersion `json:"version,omitempty"` - // SslEnforcement - Enable ssl enforcement or not when connect to server. Possible values include: 'SslEnforcementEnumEnabled', 'SslEnforcementEnumDisabled' - SslEnforcement SslEnforcementEnum `json:"sslEnforcement,omitempty"` - // MinimalTLSVersion - Enforce a minimal Tls version for the server. Possible values include: 'TLS10', 'TLS11', 'TLS12', 'TLSEnforcementDisabled' - MinimalTLSVersion MinimalTLSVersionEnum `json:"minimalTlsVersion,omitempty"` - // PublicNetworkAccess - Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnumEnabled', 'PublicNetworkAccessEnumDisabled' - PublicNetworkAccess PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` - // ReplicationRole - The replication role of the server. - ReplicationRole *string `json:"replicationRole,omitempty"` -} - -// Sku billing information related properties of a server. -type Sku struct { - // Name - The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8. - Name *string `json:"name,omitempty"` - // Tier - The tier of the particular SKU, e.g. Basic. Possible values include: 'Basic', 'GeneralPurpose', 'MemoryOptimized' - Tier SkuTier `json:"tier,omitempty"` - // Capacity - The scale up/out capacity, representing server's compute units. - Capacity *int32 `json:"capacity,omitempty"` - // Size - The size code, to be interpreted by resource as appropriate. - Size *string `json:"size,omitempty"` - // Family - The family of hardware. - Family *string `json:"family,omitempty"` -} - -// StorageProfile storage Profile properties of a server -type StorageProfile struct { - // BackupRetentionDays - Backup retention days for the server. - BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"` - // GeoRedundantBackup - Enable Geo-redundant or not for server backup. Possible values include: 'Enabled', 'Disabled' - GeoRedundantBackup GeoRedundantBackup `json:"geoRedundantBackup,omitempty"` - // StorageMB - Max storage allowed for a server. - StorageMB *int32 `json:"storageMB,omitempty"` - // StorageAutogrow - Enable Storage Auto Grow. Possible values include: 'StorageAutogrowEnabled', 'StorageAutogrowDisabled' - StorageAutogrow StorageAutogrow `json:"storageAutogrow,omitempty"` -} - -// TagsObject tags object for patch operations. -type TagsObject struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TagsObject. -func (toVar TagsObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if toVar.Tags != nil { - objectMap["tags"] = toVar.Tags - } - return json.Marshal(objectMap) -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// VirtualNetworkRule a virtual network rule. -type VirtualNetworkRule struct { - autorest.Response `json:"-"` - // VirtualNetworkRuleProperties - Resource properties. - *VirtualNetworkRuleProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkRule. -func (vnr VirtualNetworkRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnr.VirtualNetworkRuleProperties != nil { - objectMap["properties"] = vnr.VirtualNetworkRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VirtualNetworkRule struct. -func (vnr *VirtualNetworkRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var virtualNetworkRuleProperties VirtualNetworkRuleProperties - err = json.Unmarshal(*v, &virtualNetworkRuleProperties) - if err != nil { - return err - } - vnr.VirtualNetworkRuleProperties = &virtualNetworkRuleProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vnr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vnr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vnr.Type = &typeVar - } - } - } - - return nil -} - -// VirtualNetworkRuleListResult a list of virtual network rules. -type VirtualNetworkRuleListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]VirtualNetworkRule `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkRuleListResult. -func (vnrlr VirtualNetworkRuleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkRuleListResultIterator provides access to a complete listing of VirtualNetworkRule values. -type VirtualNetworkRuleListResultIterator struct { - i int - page VirtualNetworkRuleListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VirtualNetworkRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VirtualNetworkRuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VirtualNetworkRuleListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VirtualNetworkRuleListResultIterator) Response() VirtualNetworkRuleListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VirtualNetworkRuleListResultIterator) Value() VirtualNetworkRule { - if !iter.page.NotDone() { - return VirtualNetworkRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VirtualNetworkRuleListResultIterator type. -func NewVirtualNetworkRuleListResultIterator(page VirtualNetworkRuleListResultPage) VirtualNetworkRuleListResultIterator { - return VirtualNetworkRuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vnrlr VirtualNetworkRuleListResult) IsEmpty() bool { - return vnrlr.Value == nil || len(*vnrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vnrlr VirtualNetworkRuleListResult) hasNextLink() bool { - return vnrlr.NextLink != nil && len(*vnrlr.NextLink) != 0 -} - -// virtualNetworkRuleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vnrlr VirtualNetworkRuleListResult) virtualNetworkRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !vnrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vnrlr.NextLink))) -} - -// VirtualNetworkRuleListResultPage contains a page of VirtualNetworkRule values. -type VirtualNetworkRuleListResultPage struct { - fn func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error) - vnrlr VirtualNetworkRuleListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VirtualNetworkRuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRuleListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vnrlr) - if err != nil { - return err - } - page.vnrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VirtualNetworkRuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VirtualNetworkRuleListResultPage) NotDone() bool { - return !page.vnrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VirtualNetworkRuleListResultPage) Response() VirtualNetworkRuleListResult { - return page.vnrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VirtualNetworkRuleListResultPage) Values() []VirtualNetworkRule { - if page.vnrlr.IsEmpty() { - return nil - } - return *page.vnrlr.Value -} - -// Creates a new instance of the VirtualNetworkRuleListResultPage type. -func NewVirtualNetworkRuleListResultPage(cur VirtualNetworkRuleListResult, getNextPage func(context.Context, VirtualNetworkRuleListResult) (VirtualNetworkRuleListResult, error)) VirtualNetworkRuleListResultPage { - return VirtualNetworkRuleListResultPage{ - fn: getNextPage, - vnrlr: cur, - } -} - -// VirtualNetworkRuleProperties properties of a virtual network rule. -type VirtualNetworkRuleProperties struct { - // VirtualNetworkSubnetID - The ARM resource id of the virtual network subnet. - VirtualNetworkSubnetID *string `json:"virtualNetworkSubnetId,omitempty"` - // IgnoreMissingVnetServiceEndpoint - Create firewall rule before the virtual network has vnet service endpoint enabled. - IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` - // State - READ-ONLY; Virtual Network Rule State. Possible values include: 'VirtualNetworkRuleStateInitializing', 'VirtualNetworkRuleStateInProgress', 'VirtualNetworkRuleStateReady', 'VirtualNetworkRuleStateDeleting', 'VirtualNetworkRuleStateUnknown' - State VirtualNetworkRuleState `json:"state,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkRuleProperties. -func (vnrp VirtualNetworkRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vnrp.VirtualNetworkSubnetID != nil { - objectMap["virtualNetworkSubnetId"] = vnrp.VirtualNetworkSubnetID - } - if vnrp.IgnoreMissingVnetServiceEndpoint != nil { - objectMap["ignoreMissingVnetServiceEndpoint"] = vnrp.IgnoreMissingVnetServiceEndpoint - } - return json.Marshal(objectMap) -} - -// VirtualNetworkRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkRulesClient) (VirtualNetworkRule, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkRulesCreateOrUpdateFuture.Result. -func (future *VirtualNetworkRulesCreateOrUpdateFuture) result(client VirtualNetworkRulesClient) (vnr VirtualNetworkRule, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vnr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.VirtualNetworkRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vnr.Response.Response, err = future.GetResult(sender); err == nil && vnr.Response.Response.StatusCode != http.StatusNoContent { - vnr, err = client.CreateOrUpdateResponder(vnr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesCreateOrUpdateFuture", "Result", vnr.Response.Response, "Failure responding to request") - } - } - return -} - -// VirtualNetworkRulesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VirtualNetworkRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VirtualNetworkRulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VirtualNetworkRulesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VirtualNetworkRulesDeleteFuture.Result. -func (future *VirtualNetworkRulesDeleteFuture) result(client VirtualNetworkRulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresql.VirtualNetworkRulesDeleteFuture") - return - } - ar.Response = future.Response() - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/operations.go deleted file mode 100644 index 624b7c44f63..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/operations.go +++ /dev/null @@ -1,100 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, -// log files and configurations with new business model. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available REST API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DBforPostgreSQL/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/privateendpointconnections.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/privateendpointconnections.go deleted file mode 100644 index 75acf5af0a6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/privateendpointconnections.go +++ /dev/null @@ -1,527 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState.Status", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState.Description", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets all private endpoint connections on a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client PrivateEndpointConnectionsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result PrivateEndpointConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByServer") - defer func() { - sc := -1 - if result.peclr.Response.Response != nil { - sc = result.peclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.PrivateEndpointConnectionsClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.peclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.peclr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.peclr.hasNextLink() && result.peclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client PrivateEndpointConnectionsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByServerResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionsClient) listByServerNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { - req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result PrivateEndpointConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} - -// UpdateTags updates private endpoint connection with the specified tags. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - parameters supplied to the Update private endpoint connection Tags operation. -func (client PrivateEndpointConnectionsClient) UpdateTags(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters TagsObject) (result PrivateEndpointConnectionsUpdateTagsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.UpdateTags") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.PrivateEndpointConnectionsClient", "UpdateTags", err.Error()) - } - - req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, serverName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsClient", "UpdateTags", nil, "Failure preparing request") - return - } - - result, err = client.UpdateTagsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateEndpointConnectionsClient", "UpdateTags", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdateTagsPreparer prepares the UpdateTags request. -func (client PrivateEndpointConnectionsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters TagsObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTagsSender sends the UpdateTags request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) UpdateTagsSender(req *http.Request) (future PrivateEndpointConnectionsUpdateTagsFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateTagsResponder handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) UpdateTagsResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/privatelinkresources.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/privatelinkresources.go deleted file mode 100644 index 821ea3e43a0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/privatelinkresources.go +++ /dev/null @@ -1,249 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a private link resource for PostgreSQL server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// groupName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, serverName string, groupName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, groupName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, groupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources/{groupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) GetResponder(resp *http.Response) (result PrivateLinkResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets the private link resources for PostgreSQL server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client PrivateLinkResourcesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByServer") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.PrivateLinkResourcesClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateLinkResourcesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.PrivateLinkResourcesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateLinkResourcesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client PrivateLinkResourcesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByServerResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listByServerNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "postgresql.PrivateLinkResourcesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "postgresql.PrivateLinkResourcesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.PrivateLinkResourcesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/recoverableservers.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/recoverableservers.go deleted file mode 100644 index 351fec57c7d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/recoverableservers.go +++ /dev/null @@ -1,120 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RecoverableServersClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type RecoverableServersClient struct { - BaseClient -} - -// NewRecoverableServersClient creates an instance of the RecoverableServersClient client. -func NewRecoverableServersClient(subscriptionID string) RecoverableServersClient { - return NewRecoverableServersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecoverableServersClientWithBaseURI creates an instance of the RecoverableServersClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewRecoverableServersClientWithBaseURI(baseURI string, subscriptionID string) RecoverableServersClient { - return RecoverableServersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a recoverable PostgreSQL Server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client RecoverableServersClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result RecoverableServerResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoverableServersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.RecoverableServersClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.RecoverableServersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.RecoverableServersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.RecoverableServersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RecoverableServersClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/recoverableServers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RecoverableServersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RecoverableServersClient) GetResponder(resp *http.Response) (result RecoverableServerResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/replicas.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/replicas.go deleted file mode 100644 index e4b456911e5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/replicas.go +++ /dev/null @@ -1,119 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ReplicasClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log -// files and configurations with new business model. -type ReplicasClient struct { - BaseClient -} - -// NewReplicasClient creates an instance of the ReplicasClient client. -func NewReplicasClient(subscriptionID string) ReplicasClient { - return NewReplicasClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReplicasClientWithBaseURI creates an instance of the ReplicasClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewReplicasClientWithBaseURI(baseURI string, subscriptionID string) ReplicasClient { - return ReplicasClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByServer list all the replicas for a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ReplicasClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicasClient.ListByServer") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ReplicasClient", "ListByServer", err.Error()) - } - - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ReplicasClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.ReplicasClient", "ListByServer", resp, "Failure sending request") - return - } - - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ReplicasClient", "ListByServer", resp, "Failure responding to request") - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ReplicasClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/replicas", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ReplicasClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ReplicasClient) ListByServerResponder(resp *http.Response) (result ServerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/serveradministrators.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/serveradministrators.go deleted file mode 100644 index 5c5f88df296..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/serveradministrators.go +++ /dev/null @@ -1,391 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServerAdministratorsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type ServerAdministratorsClient struct { - BaseClient -} - -// NewServerAdministratorsClient creates an instance of the ServerAdministratorsClient client. -func NewServerAdministratorsClient(subscriptionID string) ServerAdministratorsClient { - return NewServerAdministratorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerAdministratorsClientWithBaseURI creates an instance of the ServerAdministratorsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewServerAdministratorsClientWithBaseURI(baseURI string, subscriptionID string) ServerAdministratorsClient { - return ServerAdministratorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or update active directory administrator on an existing server. The update action will -// overwrite the existing administrator. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// properties - the required parameters for creating or updating an AAD server administrator. -func (client ServerAdministratorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, properties ServerAdministratorResource) (result ServerAdministratorsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdministratorsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: properties, - Constraints: []validation.Constraint{{Target: "properties.ServerAdministratorProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "properties.ServerAdministratorProperties.AdministratorType", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "properties.ServerAdministratorProperties.Login", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "properties.ServerAdministratorProperties.Sid", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "properties.ServerAdministratorProperties.TenantID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("postgresql.ServerAdministratorsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, properties) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerAdministratorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerAdministratorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerAdministratorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, properties ServerAdministratorResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory", pathParameters), - autorest.WithJSON(properties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServerAdministratorsClient) CreateOrUpdateSender(req *http.Request) (future ServerAdministratorsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServerAdministratorsClient) CreateOrUpdateResponder(resp *http.Response) (result ServerAdministratorResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes server active directory administrator. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServerAdministratorsClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServerAdministratorsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdministratorsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServerAdministratorsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerAdministratorsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerAdministratorsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServerAdministratorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServerAdministratorsClient) DeleteSender(req *http.Request) (future ServerAdministratorsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServerAdministratorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about a AAD server administrator. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServerAdministratorsClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerAdministratorResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdministratorsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServerAdministratorsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerAdministratorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.ServerAdministratorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerAdministratorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerAdministratorsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServerAdministratorsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServerAdministratorsClient) GetResponder(resp *http.Response) (result ServerAdministratorResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns a list of server Administrators. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServerAdministratorsClient) List(ctx context.Context, resourceGroupName string, serverName string) (result ServerAdministratorResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerAdministratorsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServerAdministratorsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerAdministratorsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.ServerAdministratorsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerAdministratorsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServerAdministratorsClient) ListPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServerAdministratorsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServerAdministratorsClient) ListResponder(resp *http.Response) (result ServerAdministratorResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/serverbasedperformancetier.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/serverbasedperformancetier.go deleted file mode 100644 index 637a995396d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/serverbasedperformancetier.go +++ /dev/null @@ -1,120 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServerBasedPerformanceTierClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type ServerBasedPerformanceTierClient struct { - BaseClient -} - -// NewServerBasedPerformanceTierClient creates an instance of the ServerBasedPerformanceTierClient client. -func NewServerBasedPerformanceTierClient(subscriptionID string) ServerBasedPerformanceTierClient { - return NewServerBasedPerformanceTierClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerBasedPerformanceTierClientWithBaseURI creates an instance of the ServerBasedPerformanceTierClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewServerBasedPerformanceTierClientWithBaseURI(baseURI string, subscriptionID string) ServerBasedPerformanceTierClient { - return ServerBasedPerformanceTierClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list all the performance tiers for a PostgreSQL server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServerBasedPerformanceTierClient) List(ctx context.Context, resourceGroupName string, serverName string) (result PerformanceTierListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerBasedPerformanceTierClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServerBasedPerformanceTierClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerBasedPerformanceTierClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.ServerBasedPerformanceTierClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerBasedPerformanceTierClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServerBasedPerformanceTierClient) ListPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/performanceTiers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServerBasedPerformanceTierClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServerBasedPerformanceTierClient) ListResponder(resp *http.Response) (result PerformanceTierListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/serverkeys.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/serverkeys.go deleted file mode 100644 index d95c8a3592b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/serverkeys.go +++ /dev/null @@ -1,434 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServerKeysClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, -// log files and configurations with new business model. -type ServerKeysClient struct { - BaseClient -} - -// NewServerKeysClient creates an instance of the ServerKeysClient client. -func NewServerKeysClient(subscriptionID string) ServerKeysClient { - return NewServerKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerKeysClientWithBaseURI creates an instance of the ServerKeysClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewServerKeysClientWithBaseURI(baseURI string, subscriptionID string) ServerKeysClient { - return ServerKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a PostgreSQL Server key. -// Parameters: -// serverName - the name of the server. -// keyName - the name of the PostgreSQL Server key to be operated on (updated or created). -// parameters - the requested PostgreSQL Server key resource state. -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ServerKeysClient) CreateOrUpdate(ctx context.Context, serverName string, keyName string, parameters ServerKey, resourceGroupName string) (result ServerKeysCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ServerKeyProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ServerKeyProperties.ServerKeyType", Name: validation.Null, Rule: true, Chain: nil}}}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServerKeysClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, serverName, keyName, parameters, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerKeysClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerKeysClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerKeysClient) CreateOrUpdatePreparer(ctx context.Context, serverName string, keyName string, parameters ServerKey, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.Kind = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServerKeysClient) CreateOrUpdateSender(req *http.Request) (future ServerKeysCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServerKeysClient) CreateOrUpdateResponder(resp *http.Response) (result ServerKey, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the PostgreSQL Server key with the given name. -// Parameters: -// serverName - the name of the server. -// keyName - the name of the PostgreSQL Server key to be deleted. -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ServerKeysClient) Delete(ctx context.Context, serverName string, keyName string, resourceGroupName string) (result ServerKeysDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServerKeysClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, serverName, keyName, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerKeysClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerKeysClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServerKeysClient) DeletePreparer(ctx context.Context, serverName string, keyName string, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServerKeysClient) DeleteSender(req *http.Request) (future ServerKeysDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServerKeysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a PostgreSQL Server key. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// keyName - the name of the PostgreSQL Server key to be retrieved. -func (client ServerKeysClient) Get(ctx context.Context, resourceGroupName string, serverName string, keyName string) (result ServerKey, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServerKeysClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, keyName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerKeysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.ServerKeysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerKeysClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerKeysClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, keyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyName": autorest.Encode("path", keyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServerKeysClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServerKeysClient) GetResponder(resp *http.Response) (result ServerKey, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of Server keys. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServerKeysClient) List(ctx context.Context, resourceGroupName string, serverName string) (result ServerKeyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.List") - defer func() { - sc := -1 - if result.sklr.Response.Response != nil { - sc = result.sklr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServerKeysClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerKeysClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.sklr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.ServerKeysClient", "List", resp, "Failure sending request") - return - } - - result.sklr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerKeysClient", "List", resp, "Failure responding to request") - return - } - if result.sklr.hasNextLink() && result.sklr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServerKeysClient) ListPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServerKeysClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServerKeysClient) ListResponder(resp *http.Response) (result ServerKeyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ServerKeysClient) listNextResults(ctx context.Context, lastResults ServerKeyListResult) (result ServerKeyListResult, err error) { - req, err := lastResults.serverKeyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "postgresql.ServerKeysClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "postgresql.ServerKeysClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerKeysClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServerKeysClient) ListComplete(ctx context.Context, resourceGroupName string, serverName string) (result ServerKeyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerKeysClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, serverName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/serverparameters.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/serverparameters.go deleted file mode 100644 index e5a71886987..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/serverparameters.go +++ /dev/null @@ -1,126 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServerParametersClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type ServerParametersClient struct { - BaseClient -} - -// NewServerParametersClient creates an instance of the ServerParametersClient client. -func NewServerParametersClient(subscriptionID string) ServerParametersClient { - return NewServerParametersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerParametersClientWithBaseURI creates an instance of the ServerParametersClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewServerParametersClientWithBaseURI(baseURI string, subscriptionID string) ServerParametersClient { - return ServerParametersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListUpdateConfigurations update a list of configurations in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// value - the parameters for updating a list of server configuration. -func (client ServerParametersClient) ListUpdateConfigurations(ctx context.Context, resourceGroupName string, serverName string, value ConfigurationListResult) (result ServerParametersListUpdateConfigurationsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerParametersClient.ListUpdateConfigurations") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServerParametersClient", "ListUpdateConfigurations", err.Error()) - } - - req, err := client.ListUpdateConfigurationsPreparer(ctx, resourceGroupName, serverName, value) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerParametersClient", "ListUpdateConfigurations", nil, "Failure preparing request") - return - } - - result, err = client.ListUpdateConfigurationsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerParametersClient", "ListUpdateConfigurations", result.Response(), "Failure sending request") - return - } - - return -} - -// ListUpdateConfigurationsPreparer prepares the ListUpdateConfigurations request. -func (client ServerParametersClient) ListUpdateConfigurationsPreparer(ctx context.Context, resourceGroupName string, serverName string, value ConfigurationListResult) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/updateConfigurations", pathParameters), - autorest.WithJSON(value), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListUpdateConfigurationsSender sends the ListUpdateConfigurations request. The method will close the -// http.Response Body if it receives an error. -func (client ServerParametersClient) ListUpdateConfigurationsSender(req *http.Request) (future ServerParametersListUpdateConfigurationsFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ListUpdateConfigurationsResponder handles the response to the ListUpdateConfigurations request. The method always -// closes the http.Response Body. -func (client ServerParametersClient) ListUpdateConfigurationsResponder(resp *http.Response) (result ConfigurationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/servers.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/servers.go deleted file mode 100644 index 481183ec9ca..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/servers.go +++ /dev/null @@ -1,643 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServersClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log -// files and configurations with new business model. -type ServersClient struct { - BaseClient -} - -// NewServersClient creates an instance of the ServersClient client. -func NewServersClient(subscriptionID string) ServersClient { - return NewServersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServersClientWithBaseURI creates an instance of the ServersClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient { - return ServersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new server, or will overwrite an existing server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the required parameters for creating or updating a server. -func (client ServersClient) Create(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForCreate) (result ServersCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Sku.Capacity", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Capacity", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, - }}, - {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServersClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ServersClient) CreatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForCreate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) CreateSender(req *http.Request) (future ServersCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ServersClient) CreateResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServersClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServersClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) DeleteSender(req *http.Request) (future ServersDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServersClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result Server, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServersClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServersClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServersClient) GetResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all the servers in a given subscription. -func (client ServersClient) List(ctx context.Context) (result ServerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServersClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServersClient) ListResponder(resp *http.Response) (result ServerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list all the servers in a given resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ServersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServerListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServersClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ServersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (result ServerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Restart restarts a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServersClient) Restart(ctx context.Context, resourceGroupName string, serverName string) (result ServersRestartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Restart") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServersClient", "Restart", err.Error()) - } - - req, err := client.RestartPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "Restart", nil, "Failure preparing request") - return - } - - result, err = client.RestartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "Restart", result.Response(), "Failure sending request") - return - } - - return -} - -// RestartPreparer prepares the Restart request. -func (client ServersClient) RestartPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RestartSender sends the Restart request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) RestartSender(req *http.Request) (future ServersRestartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RestartResponder handles the response to the Restart request. The method always -// closes the http.Response Body. -func (client ServersClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates an existing server. The request body can contain one to many of the properties present in the normal -// server definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the required parameters for updating a server. -func (client ServersClient) Update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdateParameters) (result ServersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServersClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) UpdateSender(req *http.Request) (future ServersUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ServersClient) UpdateResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/serversecurityalertpolicies.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/serversecurityalertpolicies.go deleted file mode 100644 index 4864f47ffa5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/serversecurityalertpolicies.go +++ /dev/null @@ -1,340 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServerSecurityAlertPoliciesClient is the the Microsoft Azure management API provides create, read, update, and -// delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, -// security alert policies, log files and configurations with new business model. -type ServerSecurityAlertPoliciesClient struct { - BaseClient -} - -// NewServerSecurityAlertPoliciesClient creates an instance of the ServerSecurityAlertPoliciesClient client. -func NewServerSecurityAlertPoliciesClient(subscriptionID string) ServerSecurityAlertPoliciesClient { - return NewServerSecurityAlertPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServerSecurityAlertPoliciesClientWithBaseURI creates an instance of the ServerSecurityAlertPoliciesClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewServerSecurityAlertPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServerSecurityAlertPoliciesClient { - return ServerSecurityAlertPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a threat detection policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the server security alert policy. -func (client ServerSecurityAlertPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, parameters ServerSecurityAlertPolicy) (result ServerSecurityAlertPoliciesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServerSecurityAlertPoliciesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ServerSecurityAlertPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerSecurityAlertPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "Default"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ServerSecurityAlertPoliciesClient) CreateOrUpdateSender(req *http.Request) (future ServerSecurityAlertPoliciesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ServerSecurityAlertPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServerSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get a server's security alert policy. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServerSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result ServerSecurityAlertPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPoliciesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServerSecurityAlertPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServerSecurityAlertPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "securityAlertPolicyName": autorest.Encode("path", "Default"), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServerSecurityAlertPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServerSecurityAlertPoliciesClient) GetResponder(resp *http.Response) (result ServerSecurityAlertPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer get the server's threat detection policies. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServerSecurityAlertPoliciesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ServerSecurityAlertPolicyListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPoliciesClient.ListByServer") - defer func() { - sc := -1 - if result.ssaplr.Response.Response != nil { - sc = result.ssaplr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.ServerSecurityAlertPoliciesClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.ssaplr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.ssaplr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.ssaplr.hasNextLink() && result.ssaplr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ServerSecurityAlertPoliciesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ServerSecurityAlertPoliciesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ServerSecurityAlertPoliciesClient) ListByServerResponder(resp *http.Response) (result ServerSecurityAlertPolicyListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client ServerSecurityAlertPoliciesClient) listByServerNextResults(ctx context.Context, lastResults ServerSecurityAlertPolicyListResult) (result ServerSecurityAlertPolicyListResult, err error) { - req, err := lastResults.serverSecurityAlertPolicyListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.ServerSecurityAlertPoliciesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServerSecurityAlertPoliciesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result ServerSecurityAlertPolicyListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerSecurityAlertPoliciesClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/version.go deleted file mode 100644 index ab908e1a0d8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package postgresql - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " postgresql/2020-01-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/virtualnetworkrules.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/virtualnetworkrules.go deleted file mode 100644 index 3912bf87eca..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql/virtualnetworkrules.go +++ /dev/null @@ -1,434 +0,0 @@ -package postgresql - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VirtualNetworkRulesClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type VirtualNetworkRulesClient struct { - BaseClient -} - -// NewVirtualNetworkRulesClient creates an instance of the VirtualNetworkRulesClient client. -func NewVirtualNetworkRulesClient(subscriptionID string) VirtualNetworkRulesClient { - return NewVirtualNetworkRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualNetworkRulesClientWithBaseURI creates an instance of the VirtualNetworkRulesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewVirtualNetworkRulesClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkRulesClient { - return VirtualNetworkRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an existing virtual network rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// virtualNetworkRuleName - the name of the virtual network rule. -// parameters - the requested virtual Network Rule Resource state. -func (client VirtualNetworkRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (result VirtualNetworkRulesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkRuleProperties.VirtualNetworkSubnetID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("postgresql.VirtualNetworkRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VirtualNetworkRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkRulesClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkRulesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VirtualNetworkRulesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the virtual network rule with the given name. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// virtualNetworkRuleName - the name of the virtual network rule. -func (client VirtualNetworkRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRulesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.VirtualNetworkRulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VirtualNetworkRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkRulesClient) DeleteSender(req *http.Request) (future VirtualNetworkRulesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VirtualNetworkRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a virtual network rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// virtualNetworkRuleName - the name of the virtual network rule. -func (client VirtualNetworkRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (result VirtualNetworkRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.VirtualNetworkRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, virtualNetworkRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VirtualNetworkRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "virtualNetworkRuleName": autorest.Encode("path", virtualNetworkRuleName), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client VirtualNetworkRulesClient) GetResponder(resp *http.Response) (result VirtualNetworkRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer gets a list of virtual network rules in a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client VirtualNetworkRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.ListByServer") - defer func() { - sc := -1 - if result.vnrlr.Response.Response != nil { - sc = result.vnrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresql.VirtualNetworkRulesClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.vnrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.vnrlr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.vnrlr.hasNextLink() && result.vnrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client VirtualNetworkRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-12-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client VirtualNetworkRulesClient) ListByServerResponder(resp *http.Response) (result VirtualNetworkRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client VirtualNetworkRulesClient) listByServerNextResults(ctx context.Context, lastResults VirtualNetworkRuleListResult) (result VirtualNetworkRuleListResult, err error) { - req, err := lastResults.virtualNetworkRuleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresql.VirtualNetworkRulesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client VirtualNetworkRulesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result VirtualNetworkRuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkRulesClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/_meta.json deleted file mode 100644 index 438d6fc7b62..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "daf57304e06ef0369f7d5d8104ae03ae78d13ca9", - "readme": "/_/azure-rest-api-specs/specification/postgresql/resource-manager/readme.md", - "tag": "package-flexibleserver-2021-06", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-flexibleserver-2021-06 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/postgresql/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/checknameavailability.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/checknameavailability.go deleted file mode 100644 index c4542f0ec14..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/checknameavailability.go +++ /dev/null @@ -1,118 +0,0 @@ -package postgresqlflexibleservers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// CheckNameAvailabilityClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type CheckNameAvailabilityClient struct { - BaseClient -} - -// NewCheckNameAvailabilityClient creates an instance of the CheckNameAvailabilityClient client. -func NewCheckNameAvailabilityClient(subscriptionID string) CheckNameAvailabilityClient { - return NewCheckNameAvailabilityClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewCheckNameAvailabilityClientWithBaseURI creates an instance of the CheckNameAvailabilityClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewCheckNameAvailabilityClientWithBaseURI(baseURI string, subscriptionID string) CheckNameAvailabilityClient { - return CheckNameAvailabilityClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Execute check the availability of name for resource -// Parameters: -// nameAvailabilityRequest - the required parameters for checking if resource name is available. -func (client CheckNameAvailabilityClient) Execute(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest) (result NameAvailability, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CheckNameAvailabilityClient.Execute") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: nameAvailabilityRequest, - Constraints: []validation.Constraint{{Target: "nameAvailabilityRequest.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.CheckNameAvailabilityClient", "Execute", err.Error()) - } - - req, err := client.ExecutePreparer(ctx, nameAvailabilityRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.CheckNameAvailabilityClient", "Execute", nil, "Failure preparing request") - return - } - - resp, err := client.ExecuteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.CheckNameAvailabilityClient", "Execute", resp, "Failure sending request") - return - } - - result, err = client.ExecuteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.CheckNameAvailabilityClient", "Execute", resp, "Failure responding to request") - return - } - - return -} - -// ExecutePreparer prepares the Execute request. -func (client CheckNameAvailabilityClient) ExecutePreparer(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability", pathParameters), - autorest.WithJSON(nameAvailabilityRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExecuteSender sends the Execute request. The method will close the -// http.Response Body if it receives an error. -func (client CheckNameAvailabilityClient) ExecuteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExecuteResponder handles the response to the Execute request. The method always -// closes the http.Response Body. -func (client CheckNameAvailabilityClient) ExecuteResponder(resp *http.Response) (result NameAvailability, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/client.go deleted file mode 100644 index a3b40a7fc77..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Package postgresqlflexibleservers implements the Azure ARM Postgresqlflexibleservers service API version 2021-06-01. -// -// The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL -// resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and -// configurations with new business model. -package postgresqlflexibleservers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Postgresqlflexibleservers - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Postgresqlflexibleservers. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/configurations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/configurations.go deleted file mode 100644 index dd4cd49fb26..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/configurations.go +++ /dev/null @@ -1,436 +0,0 @@ -package postgresqlflexibleservers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ConfigurationsClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type ConfigurationsClient struct { - BaseClient -} - -// NewConfigurationsClient creates an instance of the ConfigurationsClient client. -func NewConfigurationsClient(subscriptionID string) ConfigurationsClient { - return NewConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewConfigurationsClientWithBaseURI creates an instance of the ConfigurationsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationsClient { - return ConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets information about a configuration of server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// configurationName - the name of the server configuration. -func (client ConfigurationsClient) Get(ctx context.Context, resourceGroupName string, serverName string, configurationName string) (result Configuration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.ConfigurationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, configurationName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, configurationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) GetResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer list all the configurations in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ConfigurationsClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result ConfigurationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.ListByServer") - defer func() { - sc := -1 - if result.clr.Response.Response != nil { - sc = result.clr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.ConfigurationsClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.clr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsClient", "ListByServer", resp, "Failure sending request") - return - } - - result.clr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.clr.hasNextLink() && result.clr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client ConfigurationsClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) ListByServerResponder(resp *http.Response) (result ConfigurationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client ConfigurationsClient) listByServerNextResults(ctx context.Context, lastResults ConfigurationListResult) (result ConfigurationListResult, err error) { - req, err := lastResults.configurationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client ConfigurationsClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result ConfigurationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} - -// Put updates a configuration of a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// configurationName - the name of the server configuration. -// parameters - the required parameters for updating a server configuration. -func (client ConfigurationsClient) Put(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration) (result ConfigurationsPutFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.Put") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.ConfigurationsClient", "Put", err.Error()) - } - - req, err := client.PutPreparer(ctx, resourceGroupName, serverName, configurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsClient", "Put", nil, "Failure preparing request") - return - } - - result, err = client.PutSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsClient", "Put", result.Response(), "Failure sending request") - return - } - - return -} - -// PutPreparer prepares the Put request. -func (client ConfigurationsClient) PutPreparer(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PutSender sends the Put request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) PutSender(req *http.Request) (future ConfigurationsPutFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// PutResponder handles the response to the Put request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) PutResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a configuration of a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// configurationName - the name of the server configuration. -// parameters - the required parameters for updating a server configuration. -func (client ConfigurationsClient) Update(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration) (result ConfigurationsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.ConfigurationsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, configurationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ConfigurationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", configurationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/configurations/{configurationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ConfigurationsClient) UpdateSender(req *http.Request) (future ConfigurationsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ConfigurationsClient) UpdateResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/databases.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/databases.go deleted file mode 100644 index d60537c1f34..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/databases.go +++ /dev/null @@ -1,431 +0,0 @@ -package postgresqlflexibleservers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DatabasesClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, -// log files and configurations with new business model. -type DatabasesClient struct { - BaseClient -} - -// NewDatabasesClient creates an instance of the DatabasesClient client. -func NewDatabasesClient(subscriptionID string) DatabasesClient { - return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { - return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new database or updates an existing database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// databaseName - the name of the database. -// parameters - the required parameters for creating or updating a database. -func (client DatabasesClient) Create(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (result DatabasesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.DatabasesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, serverName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client DatabasesClient) CreatePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) CreateSender(req *http.Request) (future DatabasesCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client DatabasesClient) CreateResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabasesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result DatabasesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.DatabasesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) DeleteSender(req *http.Request) (future DatabasesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about a database. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// databaseName - the name of the database. -func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (result Database, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.DatabasesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases/{databaseName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DatabasesClient) GetResponder(resp *http.Response) (result Database, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer list all the databases in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client DatabasesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByServer") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.DatabasesClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client DatabasesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/databases", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListByServerResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client DatabasesClient) listByServerNextResults(ctx context.Context, lastResults DatabaseListResult) (result DatabaseListResult, err error) { - req, err := lastResults.databaseListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client DatabasesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result DatabaseListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/enums.go deleted file mode 100644 index 964ca84583d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/enums.go +++ /dev/null @@ -1,242 +0,0 @@ -package postgresqlflexibleservers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ConfigurationDataType enumerates the values for configuration data type. -type ConfigurationDataType string - -const ( - // ConfigurationDataTypeBoolean ... - ConfigurationDataTypeBoolean ConfigurationDataType = "Boolean" - // ConfigurationDataTypeEnumeration ... - ConfigurationDataTypeEnumeration ConfigurationDataType = "Enumeration" - // ConfigurationDataTypeInteger ... - ConfigurationDataTypeInteger ConfigurationDataType = "Integer" - // ConfigurationDataTypeNumeric ... - ConfigurationDataTypeNumeric ConfigurationDataType = "Numeric" -) - -// PossibleConfigurationDataTypeValues returns an array of possible values for the ConfigurationDataType const type. -func PossibleConfigurationDataTypeValues() []ConfigurationDataType { - return []ConfigurationDataType{ConfigurationDataTypeBoolean, ConfigurationDataTypeEnumeration, ConfigurationDataTypeInteger, ConfigurationDataTypeNumeric} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// CreateMode enumerates the values for create mode. -type CreateMode string - -const ( - // CreateModeCreate ... - CreateModeCreate CreateMode = "Create" - // CreateModeDefault ... - CreateModeDefault CreateMode = "Default" - // CreateModePointInTimeRestore ... - CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" - // CreateModeUpdate ... - CreateModeUpdate CreateMode = "Update" -) - -// PossibleCreateModeValues returns an array of possible values for the CreateMode const type. -func PossibleCreateModeValues() []CreateMode { - return []CreateMode{CreateModeCreate, CreateModeDefault, CreateModePointInTimeRestore, CreateModeUpdate} -} - -// CreateModeForUpdate enumerates the values for create mode for update. -type CreateModeForUpdate string - -const ( - // CreateModeForUpdateDefault ... - CreateModeForUpdateDefault CreateModeForUpdate = "Default" - // CreateModeForUpdateUpdate ... - CreateModeForUpdateUpdate CreateModeForUpdate = "Update" -) - -// PossibleCreateModeForUpdateValues returns an array of possible values for the CreateModeForUpdate const type. -func PossibleCreateModeForUpdateValues() []CreateModeForUpdate { - return []CreateModeForUpdate{CreateModeForUpdateDefault, CreateModeForUpdateUpdate} -} - -// FailoverMode enumerates the values for failover mode. -type FailoverMode string - -const ( - // FailoverModeForcedFailover ... - FailoverModeForcedFailover FailoverMode = "ForcedFailover" - // FailoverModeForcedSwitchover ... - FailoverModeForcedSwitchover FailoverMode = "ForcedSwitchover" - // FailoverModePlannedFailover ... - FailoverModePlannedFailover FailoverMode = "PlannedFailover" - // FailoverModePlannedSwitchover ... - FailoverModePlannedSwitchover FailoverMode = "PlannedSwitchover" -) - -// PossibleFailoverModeValues returns an array of possible values for the FailoverMode const type. -func PossibleFailoverModeValues() []FailoverMode { - return []FailoverMode{FailoverModeForcedFailover, FailoverModeForcedSwitchover, FailoverModePlannedFailover, FailoverModePlannedSwitchover} -} - -// GeoRedundantBackupEnum enumerates the values for geo redundant backup enum. -type GeoRedundantBackupEnum string - -const ( - // GeoRedundantBackupEnumDisabled ... - GeoRedundantBackupEnumDisabled GeoRedundantBackupEnum = "Disabled" - // GeoRedundantBackupEnumEnabled ... - GeoRedundantBackupEnumEnabled GeoRedundantBackupEnum = "Enabled" -) - -// PossibleGeoRedundantBackupEnumValues returns an array of possible values for the GeoRedundantBackupEnum const type. -func PossibleGeoRedundantBackupEnumValues() []GeoRedundantBackupEnum { - return []GeoRedundantBackupEnum{GeoRedundantBackupEnumDisabled, GeoRedundantBackupEnumEnabled} -} - -// HighAvailabilityMode enumerates the values for high availability mode. -type HighAvailabilityMode string - -const ( - // HighAvailabilityModeDisabled ... - HighAvailabilityModeDisabled HighAvailabilityMode = "Disabled" - // HighAvailabilityModeZoneRedundant ... - HighAvailabilityModeZoneRedundant HighAvailabilityMode = "ZoneRedundant" -) - -// PossibleHighAvailabilityModeValues returns an array of possible values for the HighAvailabilityMode const type. -func PossibleHighAvailabilityModeValues() []HighAvailabilityMode { - return []HighAvailabilityMode{HighAvailabilityModeDisabled, HighAvailabilityModeZoneRedundant} -} - -// OperationOrigin enumerates the values for operation origin. -type OperationOrigin string - -const ( - // OperationOriginNotSpecified ... - OperationOriginNotSpecified OperationOrigin = "NotSpecified" - // OperationOriginSystem ... - OperationOriginSystem OperationOrigin = "system" - // OperationOriginUser ... - OperationOriginUser OperationOrigin = "user" -) - -// PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. -func PossibleOperationOriginValues() []OperationOrigin { - return []OperationOrigin{OperationOriginNotSpecified, OperationOriginSystem, OperationOriginUser} -} - -// ServerHAState enumerates the values for server ha state. -type ServerHAState string - -const ( - // ServerHAStateCreatingStandby ... - ServerHAStateCreatingStandby ServerHAState = "CreatingStandby" - // ServerHAStateFailingOver ... - ServerHAStateFailingOver ServerHAState = "FailingOver" - // ServerHAStateHealthy ... - ServerHAStateHealthy ServerHAState = "Healthy" - // ServerHAStateNotEnabled ... - ServerHAStateNotEnabled ServerHAState = "NotEnabled" - // ServerHAStateRemovingStandby ... - ServerHAStateRemovingStandby ServerHAState = "RemovingStandby" - // ServerHAStateReplicatingData ... - ServerHAStateReplicatingData ServerHAState = "ReplicatingData" -) - -// PossibleServerHAStateValues returns an array of possible values for the ServerHAState const type. -func PossibleServerHAStateValues() []ServerHAState { - return []ServerHAState{ServerHAStateCreatingStandby, ServerHAStateFailingOver, ServerHAStateHealthy, ServerHAStateNotEnabled, ServerHAStateRemovingStandby, ServerHAStateReplicatingData} -} - -// ServerPublicNetworkAccessState enumerates the values for server public network access state. -type ServerPublicNetworkAccessState string - -const ( - // ServerPublicNetworkAccessStateDisabled ... - ServerPublicNetworkAccessStateDisabled ServerPublicNetworkAccessState = "Disabled" - // ServerPublicNetworkAccessStateEnabled ... - ServerPublicNetworkAccessStateEnabled ServerPublicNetworkAccessState = "Enabled" -) - -// PossibleServerPublicNetworkAccessStateValues returns an array of possible values for the ServerPublicNetworkAccessState const type. -func PossibleServerPublicNetworkAccessStateValues() []ServerPublicNetworkAccessState { - return []ServerPublicNetworkAccessState{ServerPublicNetworkAccessStateDisabled, ServerPublicNetworkAccessStateEnabled} -} - -// ServerState enumerates the values for server state. -type ServerState string - -const ( - // ServerStateDisabled ... - ServerStateDisabled ServerState = "Disabled" - // ServerStateDropping ... - ServerStateDropping ServerState = "Dropping" - // ServerStateReady ... - ServerStateReady ServerState = "Ready" - // ServerStateStarting ... - ServerStateStarting ServerState = "Starting" - // ServerStateStopped ... - ServerStateStopped ServerState = "Stopped" - // ServerStateStopping ... - ServerStateStopping ServerState = "Stopping" - // ServerStateUpdating ... - ServerStateUpdating ServerState = "Updating" -) - -// PossibleServerStateValues returns an array of possible values for the ServerState const type. -func PossibleServerStateValues() []ServerState { - return []ServerState{ServerStateDisabled, ServerStateDropping, ServerStateReady, ServerStateStarting, ServerStateStopped, ServerStateStopping, ServerStateUpdating} -} - -// ServerVersion enumerates the values for server version. -type ServerVersion string - -const ( - // ServerVersionOneOne ... - ServerVersionOneOne ServerVersion = "11" - // ServerVersionOneThree ... - ServerVersionOneThree ServerVersion = "13" - // ServerVersionOneTwo ... - ServerVersionOneTwo ServerVersion = "12" -) - -// PossibleServerVersionValues returns an array of possible values for the ServerVersion const type. -func PossibleServerVersionValues() []ServerVersion { - return []ServerVersion{ServerVersionOneOne, ServerVersionOneThree, ServerVersionOneTwo} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // SkuTierBurstable ... - SkuTierBurstable SkuTier = "Burstable" - // SkuTierGeneralPurpose ... - SkuTierGeneralPurpose SkuTier = "GeneralPurpose" - // SkuTierMemoryOptimized ... - SkuTierMemoryOptimized SkuTier = "MemoryOptimized" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{SkuTierBurstable, SkuTierGeneralPurpose, SkuTierMemoryOptimized} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/firewallrules.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/firewallrules.go deleted file mode 100644 index 274fef083ae..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/firewallrules.go +++ /dev/null @@ -1,438 +0,0 @@ -package postgresqlflexibleservers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// FirewallRulesClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type FirewallRulesClient struct { - BaseClient -} - -// NewFirewallRulesClient creates an instance of the FirewallRulesClient client. -func NewFirewallRulesClient(subscriptionID string) FirewallRulesClient { - return NewFirewallRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFirewallRulesClientWithBaseURI creates an instance of the FirewallRulesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewFirewallRulesClientWithBaseURI(baseURI string, subscriptionID string) FirewallRulesClient { - return FirewallRulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new firewall rule or updates an existing firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// firewallRuleName - the name of the server firewall rule. -// parameters - the required parameters for creating or updating a firewall rule. -func (client FirewallRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (result FirewallRulesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.FirewallRuleProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.StartIPAddress", Name: validation.Pattern, Rule: `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`, Chain: nil}}}, - {Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.FirewallRuleProperties.EndIPAddress", Name: validation.Pattern, Rule: `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`, Chain: nil}}}, - }}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.FirewallRulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serverName, firewallRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client FirewallRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) CreateOrUpdateSender(req *http.Request) (future FirewallRulesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a PostgreSQL server firewall rule. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// firewallRuleName - the name of the server firewall rule. -func (client FirewallRulesClient) Delete(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRulesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.FirewallRulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FirewallRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) DeleteSender(req *http.Request) (future FirewallRulesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get list all the firewall rules in a given server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// firewallRuleName - the name of the server firewall rule. -func (client FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (result FirewallRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.FirewallRulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName, firewallRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client FirewallRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "firewallRuleName": autorest.Encode("path", firewallRuleName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules/{firewallRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) GetResponder(resp *http.Response) (result FirewallRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByServer list all the firewall rules in a given PostgreSQL server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client FirewallRulesClient) ListByServer(ctx context.Context, resourceGroupName string, serverName string) (result FirewallRuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.ListByServer") - defer func() { - sc := -1 - if result.frlr.Response.Response != nil { - sc = result.frlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.FirewallRulesClient", "ListByServer", err.Error()) - } - - result.fn = client.listByServerNextResults - req, err := client.ListByServerPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesClient", "ListByServer", nil, "Failure preparing request") - return - } - - resp, err := client.ListByServerSender(req) - if err != nil { - result.frlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesClient", "ListByServer", resp, "Failure sending request") - return - } - - result.frlr, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesClient", "ListByServer", resp, "Failure responding to request") - return - } - if result.frlr.hasNextLink() && result.frlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByServerPreparer prepares the ListByServer request. -func (client FirewallRulesClient) ListByServerPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/firewallRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByServerSender sends the ListByServer request. The method will close the -// http.Response Body if it receives an error. -func (client FirewallRulesClient) ListByServerSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByServerResponder handles the response to the ListByServer request. The method always -// closes the http.Response Body. -func (client FirewallRulesClient) ListByServerResponder(resp *http.Response) (result FirewallRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByServerNextResults retrieves the next set of results, if any. -func (client FirewallRulesClient) listByServerNextResults(ctx context.Context, lastResults FirewallRuleListResult) (result FirewallRuleListResult, err error) { - req, err := lastResults.firewallRuleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesClient", "listByServerNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByServerSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesClient", "listByServerNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByServerResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesClient", "listByServerNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByServerComplete enumerates all values, automatically crossing page boundaries as required. -func (client FirewallRulesClient) ListByServerComplete(ctx context.Context, resourceGroupName string, serverName string) (result FirewallRuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRulesClient.ListByServer") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByServer(ctx, resourceGroupName, serverName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/getprivatednszonesuffix.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/getprivatednszonesuffix.go deleted file mode 100644 index ebba41f9c1c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/getprivatednszonesuffix.go +++ /dev/null @@ -1,101 +0,0 @@ -package postgresqlflexibleservers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// GetPrivateDNSZoneSuffixClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type GetPrivateDNSZoneSuffixClient struct { - BaseClient -} - -// NewGetPrivateDNSZoneSuffixClient creates an instance of the GetPrivateDNSZoneSuffixClient client. -func NewGetPrivateDNSZoneSuffixClient(subscriptionID string) GetPrivateDNSZoneSuffixClient { - return NewGetPrivateDNSZoneSuffixClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGetPrivateDNSZoneSuffixClientWithBaseURI creates an instance of the GetPrivateDNSZoneSuffixClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewGetPrivateDNSZoneSuffixClientWithBaseURI(baseURI string, subscriptionID string) GetPrivateDNSZoneSuffixClient { - return GetPrivateDNSZoneSuffixClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Execute get private DNS zone suffix in the cloud -func (client GetPrivateDNSZoneSuffixClient) Execute(ctx context.Context) (result String, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GetPrivateDNSZoneSuffixClient.Execute") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ExecutePreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.GetPrivateDNSZoneSuffixClient", "Execute", nil, "Failure preparing request") - return - } - - resp, err := client.ExecuteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.GetPrivateDNSZoneSuffixClient", "Execute", resp, "Failure sending request") - return - } - - result, err = client.ExecuteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.GetPrivateDNSZoneSuffixClient", "Execute", resp, "Failure responding to request") - return - } - - return -} - -// ExecutePreparer prepares the Execute request. -func (client GetPrivateDNSZoneSuffixClient) ExecutePreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DBforPostgreSQL/getPrivateDnsZoneSuffix"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExecuteSender sends the Execute request. The method will close the -// http.Response Body if it receives an error. -func (client GetPrivateDNSZoneSuffixClient) ExecuteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ExecuteResponder handles the response to the Execute request. The method always -// closes the http.Response Body. -func (client GetPrivateDNSZoneSuffixClient) ExecuteResponder(resp *http.Response) (result String, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/locationbasedcapabilities.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/locationbasedcapabilities.go deleted file mode 100644 index d36b620b904..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/locationbasedcapabilities.go +++ /dev/null @@ -1,157 +0,0 @@ -package postgresqlflexibleservers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// LocationBasedCapabilitiesClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type LocationBasedCapabilitiesClient struct { - BaseClient -} - -// NewLocationBasedCapabilitiesClient creates an instance of the LocationBasedCapabilitiesClient client. -func NewLocationBasedCapabilitiesClient(subscriptionID string) LocationBasedCapabilitiesClient { - return NewLocationBasedCapabilitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewLocationBasedCapabilitiesClientWithBaseURI creates an instance of the LocationBasedCapabilitiesClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewLocationBasedCapabilitiesClientWithBaseURI(baseURI string, subscriptionID string) LocationBasedCapabilitiesClient { - return LocationBasedCapabilitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Execute get capabilities at specified location in a given subscription. -// Parameters: -// locationName - the name of the location. -func (client LocationBasedCapabilitiesClient) Execute(ctx context.Context, locationName string) (result CapabilitiesListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationBasedCapabilitiesClient.Execute") - defer func() { - sc := -1 - if result.clr.Response.Response != nil { - sc = result.clr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.LocationBasedCapabilitiesClient", "Execute", err.Error()) - } - - result.fn = client.executeNextResults - req, err := client.ExecutePreparer(ctx, locationName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.LocationBasedCapabilitiesClient", "Execute", nil, "Failure preparing request") - return - } - - resp, err := client.ExecuteSender(req) - if err != nil { - result.clr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.LocationBasedCapabilitiesClient", "Execute", resp, "Failure sending request") - return - } - - result.clr, err = client.ExecuteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.LocationBasedCapabilitiesClient", "Execute", resp, "Failure responding to request") - return - } - if result.clr.hasNextLink() && result.clr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ExecutePreparer prepares the Execute request. -func (client LocationBasedCapabilitiesClient) ExecutePreparer(ctx context.Context, locationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/capabilities", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExecuteSender sends the Execute request. The method will close the -// http.Response Body if it receives an error. -func (client LocationBasedCapabilitiesClient) ExecuteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExecuteResponder handles the response to the Execute request. The method always -// closes the http.Response Body. -func (client LocationBasedCapabilitiesClient) ExecuteResponder(resp *http.Response) (result CapabilitiesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// executeNextResults retrieves the next set of results, if any. -func (client LocationBasedCapabilitiesClient) executeNextResults(ctx context.Context, lastResults CapabilitiesListResult) (result CapabilitiesListResult, err error) { - req, err := lastResults.capabilitiesListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "postgresqlflexibleservers.LocationBasedCapabilitiesClient", "executeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ExecuteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "postgresqlflexibleservers.LocationBasedCapabilitiesClient", "executeNextResults", resp, "Failure sending next results request") - } - result, err = client.ExecuteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.LocationBasedCapabilitiesClient", "executeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ExecuteComplete enumerates all values, automatically crossing page boundaries as required. -func (client LocationBasedCapabilitiesClient) ExecuteComplete(ctx context.Context, locationName string) (result CapabilitiesListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/LocationBasedCapabilitiesClient.Execute") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.Execute(ctx, locationName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/models.go deleted file mode 100644 index 17a84ee01da..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/models.go +++ /dev/null @@ -1,2393 +0,0 @@ -package postgresqlflexibleservers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers" - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Backup backup properties of a server -type Backup struct { - // BackupRetentionDays - Backup retention days for the server. - BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"` - // GeoRedundantBackup - A value indicating whether Geo-Redundant backup is enabled on the server. Possible values include: 'GeoRedundantBackupEnumEnabled', 'GeoRedundantBackupEnumDisabled' - GeoRedundantBackup GeoRedundantBackupEnum `json:"geoRedundantBackup,omitempty"` - // EarliestRestoreDate - READ-ONLY; The earliest restore point time (ISO8601 format) for server. - EarliestRestoreDate *date.Time `json:"earliestRestoreDate,omitempty"` -} - -// MarshalJSON is the custom marshaler for Backup. -func (b Backup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if b.BackupRetentionDays != nil { - objectMap["backupRetentionDays"] = b.BackupRetentionDays - } - if b.GeoRedundantBackup != "" { - objectMap["geoRedundantBackup"] = b.GeoRedundantBackup - } - return json.Marshal(objectMap) -} - -// CapabilitiesListResult location capability -type CapabilitiesListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; A list of supported capabilities. - Value *[]CapabilityProperties `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for CapabilitiesListResult. -func (clr CapabilitiesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CapabilitiesListResultIterator provides access to a complete listing of CapabilityProperties values. -type CapabilitiesListResultIterator struct { - i int - page CapabilitiesListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *CapabilitiesListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *CapabilitiesListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CapabilitiesListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter CapabilitiesListResultIterator) Response() CapabilitiesListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter CapabilitiesListResultIterator) Value() CapabilityProperties { - if !iter.page.NotDone() { - return CapabilityProperties{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CapabilitiesListResultIterator type. -func NewCapabilitiesListResultIterator(page CapabilitiesListResultPage) CapabilitiesListResultIterator { - return CapabilitiesListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (clr CapabilitiesListResult) IsEmpty() bool { - return clr.Value == nil || len(*clr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (clr CapabilitiesListResult) hasNextLink() bool { - return clr.NextLink != nil && len(*clr.NextLink) != 0 -} - -// capabilitiesListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (clr CapabilitiesListResult) capabilitiesListResultPreparer(ctx context.Context) (*http.Request, error) { - if !clr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(clr.NextLink))) -} - -// CapabilitiesListResultPage contains a page of CapabilityProperties values. -type CapabilitiesListResultPage struct { - fn func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error) - clr CapabilitiesListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *CapabilitiesListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CapabilitiesListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.clr) - if err != nil { - return err - } - page.clr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *CapabilitiesListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CapabilitiesListResultPage) NotDone() bool { - return !page.clr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CapabilitiesListResultPage) Response() CapabilitiesListResult { - return page.clr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CapabilitiesListResultPage) Values() []CapabilityProperties { - if page.clr.IsEmpty() { - return nil - } - return *page.clr.Value -} - -// Creates a new instance of the CapabilitiesListResultPage type. -func NewCapabilitiesListResultPage(cur CapabilitiesListResult, getNextPage func(context.Context, CapabilitiesListResult) (CapabilitiesListResult, error)) CapabilitiesListResultPage { - return CapabilitiesListResultPage{ - fn: getNextPage, - clr: cur, - } -} - -// CapabilityProperties location capabilities. -type CapabilityProperties struct { - // Zone - READ-ONLY; zone name - Zone *string `json:"zone,omitempty"` - // GeoBackupSupported - READ-ONLY; A value indicating whether a new server in this region can have geo-backups to paired region. - GeoBackupSupported *bool `json:"geoBackupSupported,omitempty"` - // ZoneRedundantHaSupported - READ-ONLY; A value indicating whether a new server in this region can support multi zone HA. - ZoneRedundantHaSupported *bool `json:"zoneRedundantHaSupported,omitempty"` - // ZoneRedundantHaAndGeoBackupSupported - READ-ONLY; A value indicating whether a new server in this region can have geo-backups to paired region. - ZoneRedundantHaAndGeoBackupSupported *bool `json:"zoneRedundantHaAndGeoBackupSupported,omitempty"` - // SupportedFlexibleServerEditions - READ-ONLY - SupportedFlexibleServerEditions *[]FlexibleServerEditionCapability `json:"supportedFlexibleServerEditions,omitempty"` - // SupportedHyperscaleNodeEditions - READ-ONLY - SupportedHyperscaleNodeEditions *[]HyperscaleNodeEditionCapability `json:"supportedHyperscaleNodeEditions,omitempty"` - // Status - READ-ONLY; The status - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for CapabilityProperties. -func (cp CapabilityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CloudError an error response from the Batch service. -type CloudError struct { - Error *ErrorResponse `json:"error,omitempty"` -} - -// Configuration represents a Configuration. -type Configuration struct { - autorest.Response `json:"-"` - // ConfigurationProperties - The properties of a configuration. - *ConfigurationProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Configuration. -func (c Configuration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.ConfigurationProperties != nil { - objectMap["properties"] = c.ConfigurationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Configuration struct. -func (c *Configuration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var configurationProperties ConfigurationProperties - err = json.Unmarshal(*v, &configurationProperties) - if err != nil { - return err - } - c.ConfigurationProperties = &configurationProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - c.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - c.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - c.Type = &typeVar - } - } - } - - return nil -} - -// ConfigurationListResult a list of server configurations. -type ConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - The list of server configurations. - Value *[]Configuration `json:"value,omitempty"` - // NextLink - The link used to get the next page of operations. - NextLink *string `json:"nextLink,omitempty"` -} - -// ConfigurationListResultIterator provides access to a complete listing of Configuration values. -type ConfigurationListResultIterator struct { - i int - page ConfigurationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ConfigurationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ConfigurationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ConfigurationListResultIterator) Response() ConfigurationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ConfigurationListResultIterator) Value() Configuration { - if !iter.page.NotDone() { - return Configuration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ConfigurationListResultIterator type. -func NewConfigurationListResultIterator(page ConfigurationListResultPage) ConfigurationListResultIterator { - return ConfigurationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (clr ConfigurationListResult) IsEmpty() bool { - return clr.Value == nil || len(*clr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (clr ConfigurationListResult) hasNextLink() bool { - return clr.NextLink != nil && len(*clr.NextLink) != 0 -} - -// configurationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (clr ConfigurationListResult) configurationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !clr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(clr.NextLink))) -} - -// ConfigurationListResultPage contains a page of Configuration values. -type ConfigurationListResultPage struct { - fn func(context.Context, ConfigurationListResult) (ConfigurationListResult, error) - clr ConfigurationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.clr) - if err != nil { - return err - } - page.clr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ConfigurationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ConfigurationListResultPage) NotDone() bool { - return !page.clr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ConfigurationListResultPage) Response() ConfigurationListResult { - return page.clr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ConfigurationListResultPage) Values() []Configuration { - if page.clr.IsEmpty() { - return nil - } - return *page.clr.Value -} - -// Creates a new instance of the ConfigurationListResultPage type. -func NewConfigurationListResultPage(cur ConfigurationListResult, getNextPage func(context.Context, ConfigurationListResult) (ConfigurationListResult, error)) ConfigurationListResultPage { - return ConfigurationListResultPage{ - fn: getNextPage, - clr: cur, - } -} - -// ConfigurationProperties the properties of a configuration. -type ConfigurationProperties struct { - // Value - Value of the configuration. - Value *string `json:"value,omitempty"` - // Description - READ-ONLY; Description of the configuration. - Description *string `json:"description,omitempty"` - // DefaultValue - READ-ONLY; Default value of the configuration. - DefaultValue *string `json:"defaultValue,omitempty"` - // DataType - READ-ONLY; Data type of the configuration. Possible values include: 'ConfigurationDataTypeBoolean', 'ConfigurationDataTypeNumeric', 'ConfigurationDataTypeInteger', 'ConfigurationDataTypeEnumeration' - DataType ConfigurationDataType `json:"dataType,omitempty"` - // AllowedValues - READ-ONLY; Allowed values of the configuration. - AllowedValues *string `json:"allowedValues,omitempty"` - // Source - Source of the configuration. - Source *string `json:"source,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigurationProperties. -func (cp ConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Value != nil { - objectMap["value"] = cp.Value - } - if cp.Source != nil { - objectMap["source"] = cp.Source - } - return json.Marshal(objectMap) -} - -// ConfigurationsPutFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ConfigurationsPutFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConfigurationsClient) (Configuration, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConfigurationsPutFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConfigurationsPutFuture.Result. -func (future *ConfigurationsPutFuture) result(client ConfigurationsClient) (c Configuration, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsPutFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - c.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ConfigurationsPutFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { - c, err = client.PutResponder(c.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsPutFuture", "Result", c.Response.Response, "Failure responding to request") - } - } - return -} - -// ConfigurationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ConfigurationsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConfigurationsClient) (Configuration, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConfigurationsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConfigurationsUpdateFuture.Result. -func (future *ConfigurationsUpdateFuture) result(client ConfigurationsClient) (c Configuration, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - c.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ConfigurationsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { - c, err = client.UpdateResponder(c.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ConfigurationsUpdateFuture", "Result", c.Response.Response, "Failure responding to request") - } - } - return -} - -// Database represents a Database. -type Database struct { - autorest.Response `json:"-"` - // DatabaseProperties - The properties of a database. - *DatabaseProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Database. -func (d Database) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.DatabaseProperties != nil { - objectMap["properties"] = d.DatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Database struct. -func (d *Database) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - d.DatabaseProperties = &databaseProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - d.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - } - } - - return nil -} - -// DatabaseListResult a List of databases. -type DatabaseListResult struct { - autorest.Response `json:"-"` - // Value - The list of databases housed in a server - Value *[]Database `json:"value,omitempty"` - // NextLink - The link used to get the next page of databases. - NextLink *string `json:"nextLink,omitempty"` -} - -// DatabaseListResultIterator provides access to a complete listing of Database values. -type DatabaseListResultIterator struct { - i int - page DatabaseListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DatabaseListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DatabaseListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DatabaseListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DatabaseListResultIterator) Response() DatabaseListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DatabaseListResultIterator) Value() Database { - if !iter.page.NotDone() { - return Database{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DatabaseListResultIterator type. -func NewDatabaseListResultIterator(page DatabaseListResultPage) DatabaseListResultIterator { - return DatabaseListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dlr DatabaseListResult) IsEmpty() bool { - return dlr.Value == nil || len(*dlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dlr DatabaseListResult) hasNextLink() bool { - return dlr.NextLink != nil && len(*dlr.NextLink) != 0 -} - -// databaseListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dlr DatabaseListResult) databaseListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dlr.NextLink))) -} - -// DatabaseListResultPage contains a page of Database values. -type DatabaseListResultPage struct { - fn func(context.Context, DatabaseListResult) (DatabaseListResult, error) - dlr DatabaseListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DatabaseListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabaseListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dlr) - if err != nil { - return err - } - page.dlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DatabaseListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DatabaseListResultPage) NotDone() bool { - return !page.dlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DatabaseListResultPage) Response() DatabaseListResult { - return page.dlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DatabaseListResultPage) Values() []Database { - if page.dlr.IsEmpty() { - return nil - } - return *page.dlr.Value -} - -// Creates a new instance of the DatabaseListResultPage type. -func NewDatabaseListResultPage(cur DatabaseListResult, getNextPage func(context.Context, DatabaseListResult) (DatabaseListResult, error)) DatabaseListResultPage { - return DatabaseListResultPage{ - fn: getNextPage, - dlr: cur, - } -} - -// DatabaseProperties the properties of a database. -type DatabaseProperties struct { - // Charset - The charset of the database. - Charset *string `json:"charset,omitempty"` - // Collation - The collation of the database. - Collation *string `json:"collation,omitempty"` -} - -// DatabasesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (Database, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesCreateFuture.Result. -func (future *DatabasesCreateFuture) result(client DatabasesClient) (d Database, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - d.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.DatabasesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateResponder(d.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesCreateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesDeleteFuture.Result. -func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.DatabasesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DelegatedSubnetUsage delegated subnet usage data. -type DelegatedSubnetUsage struct { - // SubnetName - READ-ONLY; name of the subnet - SubnetName *string `json:"subnetName,omitempty"` - // Usage - READ-ONLY; Number of used delegated subnets - Usage *int64 `json:"usage,omitempty"` -} - -// MarshalJSON is the custom marshaler for DelegatedSubnetUsage. -func (dsu DelegatedSubnetUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for -// failed operations. (This also follows the OData error response format.) -type ErrorResponse struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]ErrorResponse `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponse. -func (er ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FirewallRule represents a server firewall rule. -type FirewallRule struct { - autorest.Response `json:"-"` - // FirewallRuleProperties - The properties of a firewall rule. - *FirewallRuleProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FirewallRule. -func (fr FirewallRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fr.FirewallRuleProperties != nil { - objectMap["properties"] = fr.FirewallRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FirewallRule struct. -func (fr *FirewallRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var firewallRuleProperties FirewallRuleProperties - err = json.Unmarshal(*v, &firewallRuleProperties) - if err != nil { - return err - } - fr.FirewallRuleProperties = &firewallRuleProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - fr.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fr.Type = &typeVar - } - } - } - - return nil -} - -// FirewallRuleListResult a list of firewall rules. -type FirewallRuleListResult struct { - autorest.Response `json:"-"` - // Value - The list of firewall rules in a server. - Value *[]FirewallRule `json:"value,omitempty"` - // NextLink - The link used to get the next page of operations. - NextLink *string `json:"nextLink,omitempty"` -} - -// FirewallRuleListResultIterator provides access to a complete listing of FirewallRule values. -type FirewallRuleListResultIterator struct { - i int - page FirewallRuleListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *FirewallRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *FirewallRuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter FirewallRuleListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter FirewallRuleListResultIterator) Response() FirewallRuleListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter FirewallRuleListResultIterator) Value() FirewallRule { - if !iter.page.NotDone() { - return FirewallRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the FirewallRuleListResultIterator type. -func NewFirewallRuleListResultIterator(page FirewallRuleListResultPage) FirewallRuleListResultIterator { - return FirewallRuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (frlr FirewallRuleListResult) IsEmpty() bool { - return frlr.Value == nil || len(*frlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (frlr FirewallRuleListResult) hasNextLink() bool { - return frlr.NextLink != nil && len(*frlr.NextLink) != 0 -} - -// firewallRuleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (frlr FirewallRuleListResult) firewallRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !frlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(frlr.NextLink))) -} - -// FirewallRuleListResultPage contains a page of FirewallRule values. -type FirewallRuleListResultPage struct { - fn func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error) - frlr FirewallRuleListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *FirewallRuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FirewallRuleListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.frlr) - if err != nil { - return err - } - page.frlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *FirewallRuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page FirewallRuleListResultPage) NotDone() bool { - return !page.frlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page FirewallRuleListResultPage) Response() FirewallRuleListResult { - return page.frlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page FirewallRuleListResultPage) Values() []FirewallRule { - if page.frlr.IsEmpty() { - return nil - } - return *page.frlr.Value -} - -// Creates a new instance of the FirewallRuleListResultPage type. -func NewFirewallRuleListResultPage(cur FirewallRuleListResult, getNextPage func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)) FirewallRuleListResultPage { - return FirewallRuleListResultPage{ - fn: getNextPage, - frlr: cur, - } -} - -// FirewallRuleProperties the properties of a server firewall rule. -type FirewallRuleProperties struct { - // StartIPAddress - The start IP address of the server firewall rule. Must be IPv4 format. - StartIPAddress *string `json:"startIpAddress,omitempty"` - // EndIPAddress - The end IP address of the server firewall rule. Must be IPv4 format. - EndIPAddress *string `json:"endIpAddress,omitempty"` -} - -// FirewallRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type FirewallRulesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FirewallRulesClient) (FirewallRule, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FirewallRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FirewallRulesCreateOrUpdateFuture.Result. -func (future *FirewallRulesCreateOrUpdateFuture) result(client FirewallRulesClient) (fr FirewallRule, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - fr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.FirewallRulesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if fr.Response.Response, err = future.GetResult(sender); err == nil && fr.Response.Response.StatusCode != http.StatusNoContent { - fr, err = client.CreateOrUpdateResponder(fr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesCreateOrUpdateFuture", "Result", fr.Response.Response, "Failure responding to request") - } - } - return -} - -// FirewallRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type FirewallRulesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(FirewallRulesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *FirewallRulesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for FirewallRulesDeleteFuture.Result. -func (future *FirewallRulesDeleteFuture) result(client FirewallRulesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.FirewallRulesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.FirewallRulesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// FlexibleServerEditionCapability flexible server edition capabilities. -type FlexibleServerEditionCapability struct { - // Name - READ-ONLY; Server edition name - Name *string `json:"name,omitempty"` - // SupportedStorageEditions - READ-ONLY; The list of editions supported by this server edition. - SupportedStorageEditions *[]StorageEditionCapability `json:"supportedStorageEditions,omitempty"` - // SupportedServerVersions - READ-ONLY; The list of server versions supported by this server edition. - SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"` - // Status - READ-ONLY; The status - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for FlexibleServerEditionCapability. -func (fsec FlexibleServerEditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// HighAvailability high availability properties of a server -type HighAvailability struct { - // Mode - The HA mode for the server. Possible values include: 'HighAvailabilityModeDisabled', 'HighAvailabilityModeZoneRedundant' - Mode HighAvailabilityMode `json:"mode,omitempty"` - // State - READ-ONLY; A state of a HA server that is visible to user. Possible values include: 'ServerHAStateNotEnabled', 'ServerHAStateCreatingStandby', 'ServerHAStateReplicatingData', 'ServerHAStateFailingOver', 'ServerHAStateHealthy', 'ServerHAStateRemovingStandby' - State ServerHAState `json:"state,omitempty"` - // StandbyAvailabilityZone - availability zone information of the standby. - StandbyAvailabilityZone *string `json:"standbyAvailabilityZone,omitempty"` -} - -// MarshalJSON is the custom marshaler for HighAvailability. -func (ha HighAvailability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ha.Mode != "" { - objectMap["mode"] = ha.Mode - } - if ha.StandbyAvailabilityZone != nil { - objectMap["standbyAvailabilityZone"] = ha.StandbyAvailabilityZone - } - return json.Marshal(objectMap) -} - -// HyperscaleNodeEditionCapability hyperscale node edition capabilities. -type HyperscaleNodeEditionCapability struct { - // Name - READ-ONLY; Server edition name - Name *string `json:"name,omitempty"` - // SupportedStorageEditions - READ-ONLY; The list of editions supported by this server edition. - SupportedStorageEditions *[]StorageEditionCapability `json:"supportedStorageEditions,omitempty"` - // SupportedServerVersions - READ-ONLY; The list of server versions supported by this server edition. - SupportedServerVersions *[]ServerVersionCapability `json:"supportedServerVersions,omitempty"` - // SupportedNodeTypes - READ-ONLY; The list of Node Types supported by this server edition. - SupportedNodeTypes *[]NodeTypeCapability `json:"supportedNodeTypes,omitempty"` - // Status - READ-ONLY; The status - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for HyperscaleNodeEditionCapability. -func (hnec HyperscaleNodeEditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MaintenanceWindow maintenance window properties of a server. -type MaintenanceWindow struct { - // CustomWindow - indicates whether custom window is enabled or disabled - CustomWindow *string `json:"customWindow,omitempty"` - // StartHour - start hour for maintenance window - StartHour *int32 `json:"startHour,omitempty"` - // StartMinute - start minute for maintenance window - StartMinute *int32 `json:"startMinute,omitempty"` - // DayOfWeek - day of week for maintenance window - DayOfWeek *int32 `json:"dayOfWeek,omitempty"` -} - -// NameAvailability represents a resource name availability. -type NameAvailability struct { - autorest.Response `json:"-"` - // Message - Error Message. - Message *string `json:"message,omitempty"` - // NameAvailable - Indicates whether the resource name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Name - name of the PostgreSQL server. - Name *string `json:"name,omitempty"` - // Type - type of the server - Type *string `json:"type,omitempty"` -} - -// NameAvailabilityRequest request from client to check resource name availability. -type NameAvailabilityRequest struct { - // Name - Resource name to verify. - Name *string `json:"name,omitempty"` - // Type - Resource type used for verification. - Type *string `json:"type,omitempty"` -} - -// Network network properties of a server -type Network struct { - // PublicNetworkAccess - READ-ONLY; public network access is enabled or not. Possible values include: 'ServerPublicNetworkAccessStateEnabled', 'ServerPublicNetworkAccessStateDisabled' - PublicNetworkAccess ServerPublicNetworkAccessState `json:"publicNetworkAccess,omitempty"` - // DelegatedSubnetResourceID - delegated subnet arm resource id. - DelegatedSubnetResourceID *string `json:"delegatedSubnetResourceId,omitempty"` - // PrivateDNSZoneArmResourceID - private dns zone arm resource id. - PrivateDNSZoneArmResourceID *string `json:"privateDnsZoneArmResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for Network. -func (n Network) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if n.DelegatedSubnetResourceID != nil { - objectMap["delegatedSubnetResourceId"] = n.DelegatedSubnetResourceID - } - if n.PrivateDNSZoneArmResourceID != nil { - objectMap["privateDnsZoneArmResourceId"] = n.PrivateDNSZoneArmResourceID - } - return json.Marshal(objectMap) -} - -// NodeTypeCapability node type capability -type NodeTypeCapability struct { - // Name - READ-ONLY; note type name - Name *string `json:"name,omitempty"` - // NodeType - READ-ONLY; note type - NodeType *string `json:"nodeType,omitempty"` - // Status - READ-ONLY; The status - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for NodeTypeCapability. -func (ntc NodeTypeCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Operation REST API operation definition. -type Operation struct { - // Name - READ-ONLY; The name of the operation being performed on this particular object. - Name *string `json:"name,omitempty"` - // Display - READ-ONLY; The localized display information for this particular operation or action. - Display *OperationDisplay `json:"display,omitempty"` - // IsDataAction - Indicates whether the operation is a data action - IsDataAction *bool `json:"isDataAction,omitempty"` - // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'OperationOriginNotSpecified', 'OperationOriginUser', 'OperationOriginSystem' - Origin OperationOrigin `json:"origin,omitempty"` - // Properties - READ-ONLY; Additional descriptions for the operation. - Properties map[string]interface{} `json:"properties"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if o.IsDataAction != nil { - objectMap["isDataAction"] = o.IsDataAction - } - return json.Marshal(objectMap) -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - READ-ONLY; Operation resource provider name. - Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; Localized friendly name for the operation. - Operation *string `json:"operation,omitempty"` - // Description - READ-ONLY; Operation description. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDisplay. -func (od OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResult a list of resource provider operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - Collection of available operation details - Value *[]Operation `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RestartParameter represents server restart parameters. -type RestartParameter struct { - // RestartWithFailover - Indicates whether to restart the server with failover. - RestartWithFailover *bool `json:"restartWithFailover,omitempty"` - // FailoverMode - Failover mode. Possible values include: 'FailoverModePlannedFailover', 'FailoverModeForcedFailover', 'FailoverModePlannedSwitchover', 'FailoverModeForcedSwitchover' - FailoverMode FailoverMode `json:"failoverMode,omitempty"` -} - -// Server represents a server. -type Server struct { - autorest.Response `json:"-"` - // Sku - The SKU (pricing tier) of the server. - Sku *Sku `json:"sku,omitempty"` - // ServerProperties - Properties of the server. - *ServerProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system metadata relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Server. -func (s Server) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Sku != nil { - objectMap["sku"] = s.Sku - } - if s.ServerProperties != nil { - objectMap["properties"] = s.ServerProperties - } - if s.Tags != nil { - objectMap["tags"] = s.Tags - } - if s.Location != nil { - objectMap["location"] = s.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Server struct. -func (s *Server) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - s.Sku = &sku - } - case "properties": - if v != nil { - var serverProperties ServerProperties - err = json.Unmarshal(*v, &serverProperties) - if err != nil { - return err - } - s.ServerProperties = &serverProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - s.SystemData = &systemData - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - s.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - s.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - s.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - s.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - s.Type = &typeVar - } - } - } - - return nil -} - -// ServerForUpdate represents a server to be updated. -type ServerForUpdate struct { - // Location - The location the resource resides in. - Location *string `json:"location,omitempty"` - // Sku - The SKU (pricing tier) of the server. - Sku *Sku `json:"sku,omitempty"` - // ServerPropertiesForUpdate - Properties of the server. - *ServerPropertiesForUpdate `json:"properties,omitempty"` - // Tags - Application-specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServerForUpdate. -func (sfu ServerForUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sfu.Location != nil { - objectMap["location"] = sfu.Location - } - if sfu.Sku != nil { - objectMap["sku"] = sfu.Sku - } - if sfu.ServerPropertiesForUpdate != nil { - objectMap["properties"] = sfu.ServerPropertiesForUpdate - } - if sfu.Tags != nil { - objectMap["tags"] = sfu.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ServerForUpdate struct. -func (sfu *ServerForUpdate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sfu.Location = &location - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sfu.Sku = &sku - } - case "properties": - if v != nil { - var serverPropertiesForUpdate ServerPropertiesForUpdate - err = json.Unmarshal(*v, &serverPropertiesForUpdate) - if err != nil { - return err - } - sfu.ServerPropertiesForUpdate = &serverPropertiesForUpdate - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sfu.Tags = tags - } - } - } - - return nil -} - -// ServerListResult a list of servers. -type ServerListResult struct { - autorest.Response `json:"-"` - // Value - The list of flexible servers - Value *[]Server `json:"value,omitempty"` - // NextLink - The link used to get the next page of operations. - NextLink *string `json:"nextLink,omitempty"` -} - -// ServerListResultIterator provides access to a complete listing of Server values. -type ServerListResultIterator struct { - i int - page ServerListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServerListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServerListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServerListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServerListResultIterator) Response() ServerListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServerListResultIterator) Value() Server { - if !iter.page.NotDone() { - return Server{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServerListResultIterator type. -func NewServerListResultIterator(page ServerListResultPage) ServerListResultIterator { - return ServerListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (slr ServerListResult) IsEmpty() bool { - return slr.Value == nil || len(*slr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (slr ServerListResult) hasNextLink() bool { - return slr.NextLink != nil && len(*slr.NextLink) != 0 -} - -// serverListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (slr ServerListResult) serverListResultPreparer(ctx context.Context) (*http.Request, error) { - if !slr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(slr.NextLink))) -} - -// ServerListResultPage contains a page of Server values. -type ServerListResultPage struct { - fn func(context.Context, ServerListResult) (ServerListResult, error) - slr ServerListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServerListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServerListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.slr) - if err != nil { - return err - } - page.slr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServerListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServerListResultPage) NotDone() bool { - return !page.slr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServerListResultPage) Response() ServerListResult { - return page.slr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServerListResultPage) Values() []Server { - if page.slr.IsEmpty() { - return nil - } - return *page.slr.Value -} - -// Creates a new instance of the ServerListResultPage type. -func NewServerListResultPage(cur ServerListResult, getNextPage func(context.Context, ServerListResult) (ServerListResult, error)) ServerListResultPage { - return ServerListResultPage{ - fn: getNextPage, - slr: cur, - } -} - -// ServerProperties the properties of a server. -type ServerProperties struct { - // AdministratorLogin - The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). - AdministratorLogin *string `json:"administratorLogin,omitempty"` - // AdministratorLoginPassword - The administrator login password (required for server creation). - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // Version - PostgreSQL Server version. Possible values include: 'ServerVersionOneThree', 'ServerVersionOneTwo', 'ServerVersionOneOne' - Version ServerVersion `json:"version,omitempty"` - // MinorVersion - READ-ONLY; The minor version of the server. - MinorVersion *string `json:"minorVersion,omitempty"` - // State - READ-ONLY; A state of a server that is visible to user. Possible values include: 'ServerStateReady', 'ServerStateDropping', 'ServerStateDisabled', 'ServerStateStarting', 'ServerStateStopping', 'ServerStateStopped', 'ServerStateUpdating' - State ServerState `json:"state,omitempty"` - // FullyQualifiedDomainName - READ-ONLY; The fully qualified domain name of a server. - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` - // Storage - Storage properties of a server. - Storage *Storage `json:"storage,omitempty"` - // Backup - Backup properties of a server. - Backup *Backup `json:"backup,omitempty"` - // Network - Network properties of a server. - Network *Network `json:"network,omitempty"` - // HighAvailability - High availability properties of a server. - HighAvailability *HighAvailability `json:"highAvailability,omitempty"` - // MaintenanceWindow - Maintenance window properties of a server. - MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` - // SourceServerResourceID - The source server resource ID to restore from. It's required when 'createMode' is 'PointInTimeRestore'. - SourceServerResourceID *string `json:"sourceServerResourceId,omitempty"` - // PointInTimeUTC - Restore point creation time (ISO8601 format), specifying the time to restore from. It's required when 'createMode' is 'PointInTimeRestore'. - PointInTimeUTC *date.Time `json:"pointInTimeUTC,omitempty"` - // AvailabilityZone - availability zone information of the server. - AvailabilityZone *string `json:"availabilityZone,omitempty"` - // CreateMode - The mode to create a new PostgreSQL server. Possible values include: 'CreateModeDefault', 'CreateModeCreate', 'CreateModeUpdate', 'CreateModePointInTimeRestore' - CreateMode CreateMode `json:"createMode,omitempty"` - // Tags - Application-specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ServerProperties. -func (sp ServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.AdministratorLogin != nil { - objectMap["administratorLogin"] = sp.AdministratorLogin - } - if sp.AdministratorLoginPassword != nil { - objectMap["administratorLoginPassword"] = sp.AdministratorLoginPassword - } - if sp.Version != "" { - objectMap["version"] = sp.Version - } - if sp.Storage != nil { - objectMap["storage"] = sp.Storage - } - if sp.Backup != nil { - objectMap["backup"] = sp.Backup - } - if sp.Network != nil { - objectMap["network"] = sp.Network - } - if sp.HighAvailability != nil { - objectMap["highAvailability"] = sp.HighAvailability - } - if sp.MaintenanceWindow != nil { - objectMap["maintenanceWindow"] = sp.MaintenanceWindow - } - if sp.SourceServerResourceID != nil { - objectMap["sourceServerResourceId"] = sp.SourceServerResourceID - } - if sp.PointInTimeUTC != nil { - objectMap["pointInTimeUTC"] = sp.PointInTimeUTC - } - if sp.AvailabilityZone != nil { - objectMap["availabilityZone"] = sp.AvailabilityZone - } - if sp.CreateMode != "" { - objectMap["createMode"] = sp.CreateMode - } - if sp.Tags != nil { - objectMap["tags"] = sp.Tags - } - return json.Marshal(objectMap) -} - -// ServerPropertiesForUpdate ... -type ServerPropertiesForUpdate struct { - // AdministratorLoginPassword - The password of the administrator login. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - // Storage - Storage properties of a server. - Storage *Storage `json:"storage,omitempty"` - // Backup - Backup properties of a server. - Backup *Backup `json:"backup,omitempty"` - // HighAvailability - High availability properties of a server. - HighAvailability *HighAvailability `json:"highAvailability,omitempty"` - // MaintenanceWindow - Maintenance window properties of a server. - MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` - // CreateMode - The mode to update a new PostgreSQL server. Possible values include: 'CreateModeForUpdateDefault', 'CreateModeForUpdateUpdate' - CreateMode CreateModeForUpdate `json:"createMode,omitempty"` -} - -// ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (Server, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersCreateFuture.Result. -func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.CreateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersDeleteFuture.Result. -func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServersRestartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersRestartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersRestartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersRestartFuture.Result. -func (future *ServersRestartFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersRestartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersRestartFuture") - return - } - ar.Response = future.Response() - return -} - -// ServersStartFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type ServersStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersStartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersStartFuture.Result. -func (future *ServersStartFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersStartFuture") - return - } - ar.Response = future.Response() - return -} - -// ServersStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type ServersStopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersStopFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersStopFuture.Result. -func (future *ServersStopFuture) result(client ServersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersStopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersStopFuture") - return - } - ar.Response = future.Response() - return -} - -// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServersClient) (Server, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServersUpdateFuture.Result. -func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("postgresqlflexibleservers.ServersUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.UpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ServerVersionCapability server version capabilities. -type ServerVersionCapability struct { - // Name - READ-ONLY; server version - Name *string `json:"name,omitempty"` - // SupportedVcores - READ-ONLY - SupportedVcores *[]VcoreCapability `json:"supportedVcores,omitempty"` - // Status - READ-ONLY; The status - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServerVersionCapability. -func (svc ServerVersionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Sku sku information related properties of a server. -type Sku struct { - // Name - The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. - Name *string `json:"name,omitempty"` - // Tier - The tier of the particular SKU, e.g. Burstable. Possible values include: 'SkuTierBurstable', 'SkuTierGeneralPurpose', 'SkuTierMemoryOptimized' - Tier SkuTier `json:"tier,omitempty"` -} - -// Storage storage properties of a server -type Storage struct { - // StorageSizeGB - Max storage allowed for a server. - StorageSizeGB *int32 `json:"storageSizeGB,omitempty"` -} - -// StorageEditionCapability storage edition capability -type StorageEditionCapability struct { - // Name - READ-ONLY; storage edition name - Name *string `json:"name,omitempty"` - // SupportedStorageMB - READ-ONLY - SupportedStorageMB *[]StorageMBCapability `json:"supportedStorageMB,omitempty"` - // Status - READ-ONLY; The status - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageEditionCapability. -func (sec StorageEditionCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// StorageMBCapability storage size in MB capability -type StorageMBCapability struct { - // Name - READ-ONLY; storage MB name - Name *string `json:"name,omitempty"` - // SupportedIops - READ-ONLY; supported IOPS - SupportedIops *int64 `json:"supportedIops,omitempty"` - // StorageSizeMB - READ-ONLY; storage size in MB - StorageSizeMB *int64 `json:"storageSizeMB,omitempty"` - // Status - READ-ONLY; The status - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageMBCapability. -func (smc StorageMBCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// String ... -type String struct { - autorest.Response `json:"-"` - Value *string `json:"value,omitempty"` -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// VcoreCapability vcores capability -type VcoreCapability struct { - // Name - READ-ONLY; vCore name - Name *string `json:"name,omitempty"` - // VCores - READ-ONLY; supported vCores - VCores *int64 `json:"vCores,omitempty"` - // SupportedIops - READ-ONLY; supported IOPS - SupportedIops *int64 `json:"supportedIops,omitempty"` - // SupportedMemoryPerVcoreMB - READ-ONLY; supported memory per vCore in MB - SupportedMemoryPerVcoreMB *int64 `json:"supportedMemoryPerVcoreMB,omitempty"` - // Status - READ-ONLY; The status - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for VcoreCapability. -func (vc VcoreCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkSubnetUsageParameter virtual network subnet usage parameter -type VirtualNetworkSubnetUsageParameter struct { - // VirtualNetworkArmResourceID - Virtual network resource id. - VirtualNetworkArmResourceID *string `json:"virtualNetworkArmResourceId,omitempty"` -} - -// VirtualNetworkSubnetUsageResult virtual network subnet usage data. -type VirtualNetworkSubnetUsageResult struct { - autorest.Response `json:"-"` - // DelegatedSubnetsUsage - READ-ONLY - DelegatedSubnetsUsage *[]DelegatedSubnetUsage `json:"delegatedSubnetsUsage,omitempty"` -} - -// MarshalJSON is the custom marshaler for VirtualNetworkSubnetUsageResult. -func (vnsur VirtualNetworkSubnetUsageResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/operations.go deleted file mode 100644 index 394ba340c73..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/operations.go +++ /dev/null @@ -1,100 +0,0 @@ -package postgresqlflexibleservers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the the Microsoft Azure management API provides create, read, update, and delete functionality -// for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, -// log files and configurations with new business model. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available REST API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DBforPostgreSQL/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/servers.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/servers.go deleted file mode 100644 index 4454b4f3be1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/servers.go +++ /dev/null @@ -1,904 +0,0 @@ -package postgresqlflexibleservers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ServersClient is the the Microsoft Azure management API provides create, read, update, and delete functionality for -// Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log -// files and configurations with new business model. -type ServersClient struct { - BaseClient -} - -// NewServersClient creates an instance of the ServersClient client. -func NewServersClient(subscriptionID string) ServersClient { - return NewServersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewServersClientWithBaseURI creates an instance of the ServersClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient { - return ServersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the required parameters for creating or updating a server. -func (client ServersClient) Create(ctx context.Context, resourceGroupName string, serverName string, parameters Server) (result ServersCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.ServersClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ServersClient) CreatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters Server) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) CreateSender(req *http.Request) (future ServersCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ServersClient) CreateResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServersClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.ServersClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) DeleteSender(req *http.Request) (future ServersDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets information about a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServersClient) Get(ctx context.Context, resourceGroupName string, serverName string) (result Server, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.ServersClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ServersClient) GetPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ServersClient) GetResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all the servers in a given subscription. -func (client ServersClient) List(ctx context.Context) (result ServerListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.List") - defer func() { - sc := -1 - if result.slr.Response.Response != nil { - sc = result.slr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.ServersClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "List", resp, "Failure sending request") - return - } - - result.slr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "List", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ServersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/flexibleServers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ServersClient) ListResponder(resp *http.Response) (result ServerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ServersClient) listNextResults(ctx context.Context, lastResults ServerListResult) (result ServerListResult, err error) { - req, err := lastResults.serverListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServersClient) ListComplete(ctx context.Context) (result ServerListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup list all the servers in a given resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ServersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServerListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.slr.Response.Response != nil { - sc = result.slr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.ServersClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.slr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ServersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (result ServerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ServersClient) listByResourceGroupNextResults(ctx context.Context, lastResults ServerListResult) (result ServerListResult, err error) { - req, err := lastResults.serverListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ServersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ServerListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// Restart restarts a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the parameters for restarting a server. -func (client ServersClient) Restart(ctx context.Context, resourceGroupName string, serverName string, parameters *RestartParameter) (result ServersRestartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Restart") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.ServersClient", "Restart", err.Error()) - } - - req, err := client.RestartPreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Restart", nil, "Failure preparing request") - return - } - - result, err = client.RestartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Restart", result.Response(), "Failure sending request") - return - } - - return -} - -// RestartPreparer prepares the Restart request. -func (client ServersClient) RestartPreparer(ctx context.Context, resourceGroupName string, serverName string, parameters *RestartParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/restart", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RestartSender sends the Restart request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) RestartSender(req *http.Request) (future ServersRestartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RestartResponder handles the response to the Restart request. The method always -// closes the http.Response Body. -func (client ServersClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Start starts a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServersClient) Start(ctx context.Context, resourceGroupName string, serverName string) (result ServersStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Start") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.ServersClient", "Start", err.Error()) - } - - req, err := client.StartPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client ServersClient) StartPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) StartSender(req *http.Request) (future ServersStartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client ServersClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stops a server. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -func (client ServersClient) Stop(ctx context.Context, resourceGroupName string, serverName string) (result ServersStopFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Stop") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.ServersClient", "Stop", err.Error()) - } - - req, err := client.StopPreparer(ctx, resourceGroupName, serverName) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = client.StopSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Stop", result.Response(), "Failure sending request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client ServersClient) StopPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) StopSender(req *http.Request) (future ServersStopFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client ServersClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates an existing server. The request body can contain one to many of the properties present in the normal -// server definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// serverName - the name of the server. -// parameters - the required parameters for updating a server. -func (client ServersClient) Update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForUpdate) (result ServersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServersClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.ServersClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.ServersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serverName": autorest.Encode("path", serverName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ServersClient) UpdateSender(req *http.Request) (future ServersUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ServersClient) UpdateResponder(resp *http.Response) (result Server, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/version.go deleted file mode 100644 index e13132f4b75..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package postgresqlflexibleservers - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " postgresqlflexibleservers/2021-06-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/virtualnetworksubnetusage.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/virtualnetworksubnetusage.go deleted file mode 100644 index 1e409c8d49c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers/virtualnetworksubnetusage.go +++ /dev/null @@ -1,118 +0,0 @@ -package postgresqlflexibleservers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VirtualNetworkSubnetUsageClient is the the Microsoft Azure management API provides create, read, update, and delete -// functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security -// alert policies, log files and configurations with new business model. -type VirtualNetworkSubnetUsageClient struct { - BaseClient -} - -// NewVirtualNetworkSubnetUsageClient creates an instance of the VirtualNetworkSubnetUsageClient client. -func NewVirtualNetworkSubnetUsageClient(subscriptionID string) VirtualNetworkSubnetUsageClient { - return NewVirtualNetworkSubnetUsageClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVirtualNetworkSubnetUsageClientWithBaseURI creates an instance of the VirtualNetworkSubnetUsageClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewVirtualNetworkSubnetUsageClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkSubnetUsageClient { - return VirtualNetworkSubnetUsageClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Execute get virtual network subnet usage for a given vNet resource id. -// Parameters: -// locationName - the name of the location. -// parameters - the required parameters for creating or updating a server. -func (client VirtualNetworkSubnetUsageClient) Execute(ctx context.Context, locationName string, parameters VirtualNetworkSubnetUsageParameter) (result VirtualNetworkSubnetUsageResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkSubnetUsageClient.Execute") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("postgresqlflexibleservers.VirtualNetworkSubnetUsageClient", "Execute", err.Error()) - } - - req, err := client.ExecutePreparer(ctx, locationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.VirtualNetworkSubnetUsageClient", "Execute", nil, "Failure preparing request") - return - } - - resp, err := client.ExecuteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.VirtualNetworkSubnetUsageClient", "Execute", resp, "Failure sending request") - return - } - - result, err = client.ExecuteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "postgresqlflexibleservers.VirtualNetworkSubnetUsageClient", "Execute", resp, "Failure responding to request") - return - } - - return -} - -// ExecutePreparer prepares the Execute request. -func (client VirtualNetworkSubnetUsageClient) ExecutePreparer(ctx context.Context, locationName string, parameters VirtualNetworkSubnetUsageParameter) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "locationName": autorest.Encode("path", locationName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkVirtualNetworkSubnetUsage", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExecuteSender sends the Execute request. The method will close the -// http.Response Body if it receives an error. -func (client VirtualNetworkSubnetUsageClient) ExecuteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExecuteResponder handles the response to the Execute request. The method always -// closes the http.Response Body. -func (client VirtualNetworkSubnetUsageClient) ExecuteResponder(resp *http.Response) (result VirtualNetworkSubnetUsageResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/_meta.json deleted file mode 100644 index 78913da4cb5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "f7f8f5bd19939b4a11ea626f266a362b4dd5b626", - "readme": "/_/azure-rest-api-specs/specification/appplatform/resource-manager/readme.md", - "tag": "package-preview-2022-03", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2022-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/appplatform/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/apps.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/apps.go deleted file mode 100644 index 4a18015bb30..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/apps.go +++ /dev/null @@ -1,760 +0,0 @@ -package appplatform - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AppsClient is the REST API for Azure Spring Cloud -type AppsClient struct { - BaseClient -} - -// NewAppsClient creates an instance of the AppsClient client. -func NewAppsClient(subscriptionID string) AppsClient { - return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAppsClientWithBaseURI creates an instance of the AppsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { - return AppsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new App or update an exiting App. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serviceName - the name of the Service resource. -// appName - the name of the App resource. -// appResource - parameters for the create or update operation -func (client AppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (result AppsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: appResource, - Constraints: []validation.Constraint{{Target: "appResource.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "appResource.Properties.TemporaryDisk", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "appResource.Properties.TemporaryDisk.SizeInGB", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "appResource.Properties.TemporaryDisk.SizeInGB", Name: validation.InclusiveMaximum, Rule: int64(5), Chain: nil}, - {Target: "appResource.Properties.TemporaryDisk.SizeInGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}, - }}, - {Target: "appResource.Properties.PersistentDisk", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "appResource.Properties.PersistentDisk.SizeInGB", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "appResource.Properties.PersistentDisk.SizeInGB", Name: validation.InclusiveMaximum, Rule: int64(50), Chain: nil}, - {Target: "appResource.Properties.PersistentDisk.SizeInGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}, - {Target: "appResource.Properties.PersistentDisk.UsedInGB", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "appResource.Properties.PersistentDisk.UsedInGB", Name: validation.InclusiveMaximum, Rule: int64(50), Chain: nil}, - {Target: "appResource.Properties.PersistentDisk.UsedInGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}, - }}, - }}}}}); err != nil { - return result, validation.NewError("appplatform.AppsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, appResource) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AppsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), - autorest.WithJSON(appResource), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) CreateOrUpdateSender(req *http.Request) (future AppsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AppsClient) CreateOrUpdateResponder(resp *http.Response) (result AppResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete operation to delete an App. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serviceName - the name of the Service resource. -// appName - the name of the App resource. -func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result AppsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, appName) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AppsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) DeleteSender(req *http.Request) (future AppsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AppsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an App and its properties. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serviceName - the name of the Service resource. -// appName - the name of the App resource. -// syncStatus - indicates whether sync status -func (client AppsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, syncStatus string) (result AppResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, appName, syncStatus) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AppsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, syncStatus string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(syncStatus) > 0 { - queryParameters["syncStatus"] = autorest.Encode("query", syncStatus) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AppsClient) GetResponder(resp *http.Response) (result AppResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetResourceUploadURL get an resource upload URL for an App, which may be artifacts or source archive. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serviceName - the name of the Service resource. -// appName - the name of the App resource. -func (client AppsClient) GetResourceUploadURL(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result ResourceUploadDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetResourceUploadURL") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetResourceUploadURLPreparer(ctx, resourceGroupName, serviceName, appName) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "GetResourceUploadURL", nil, "Failure preparing request") - return - } - - resp, err := client.GetResourceUploadURLSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "GetResourceUploadURL", resp, "Failure sending request") - return - } - - result, err = client.GetResourceUploadURLResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "GetResourceUploadURL", resp, "Failure responding to request") - return - } - - return -} - -// GetResourceUploadURLPreparer prepares the GetResourceUploadURL request. -func (client AppsClient) GetResourceUploadURLPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetResourceUploadURLSender sends the GetResourceUploadURL request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) GetResourceUploadURLSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResourceUploadURLResponder handles the response to the GetResourceUploadURL request. The method always -// closes the http.Response Body. -func (client AppsClient) GetResourceUploadURLResponder(resp *http.Response) (result ResourceUploadDefinition, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List handles requests to list all resources in a Service. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serviceName - the name of the Service resource. -func (client AppsClient) List(ctx context.Context, resourceGroupName string, serviceName string) (result AppResourceCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.List") - defer func() { - sc := -1 - if result.arc.Response.Response != nil { - sc = result.arc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.arc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", resp, "Failure sending request") - return - } - - result.arc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", resp, "Failure responding to request") - return - } - if result.arc.hasNextLink() && result.arc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AppsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AppsClient) ListResponder(resp *http.Response) (result AppResourceCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client AppsClient) listNextResults(ctx context.Context, lastResults AppResourceCollection) (result AppResourceCollection, err error) { - req, err := lastResults.appResourceCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "appplatform.AppsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "appplatform.AppsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AppsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result AppResourceCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, serviceName) - return -} - -// SetActiveDeployments set existing Deployment under the app as active -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serviceName - the name of the Service resource. -// appName - the name of the App resource. -// activeDeploymentCollection - a list of Deployment name to be active. -func (client AppsClient) SetActiveDeployments(ctx context.Context, resourceGroupName string, serviceName string, appName string, activeDeploymentCollection ActiveDeploymentCollection) (result AppsSetActiveDeploymentsFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.SetActiveDeployments") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.SetActiveDeploymentsPreparer(ctx, resourceGroupName, serviceName, appName, activeDeploymentCollection) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "SetActiveDeployments", nil, "Failure preparing request") - return - } - - result, err = client.SetActiveDeploymentsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "SetActiveDeployments", result.Response(), "Failure sending request") - return - } - - return -} - -// SetActiveDeploymentsPreparer prepares the SetActiveDeployments request. -func (client AppsClient) SetActiveDeploymentsPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, activeDeploymentCollection ActiveDeploymentCollection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", pathParameters), - autorest.WithJSON(activeDeploymentCollection), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SetActiveDeploymentsSender sends the SetActiveDeployments request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) SetActiveDeploymentsSender(req *http.Request) (future AppsSetActiveDeploymentsFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// SetActiveDeploymentsResponder handles the response to the SetActiveDeployments request. The method always -// closes the http.Response Body. -func (client AppsClient) SetActiveDeploymentsResponder(resp *http.Response) (result AppResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update operation to update an exiting App. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serviceName - the name of the Service resource. -// appName - the name of the App resource. -// appResource - parameters for the update operation -func (client AppsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (result AppsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, appName, appResource) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AppsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), - autorest.WithJSON(appResource), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) UpdateSender(req *http.Request) (future AppsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AppsClient) UpdateResponder(resp *http.Response) (result AppResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ValidateDomain check the resource name is valid as well as not in use. -// Parameters: -// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value -// from the Azure Resource Manager API or the portal. -// serviceName - the name of the Service resource. -// appName - the name of the App resource. -// validatePayload - custom domain payload to be validated -func (client AppsClient) ValidateDomain(ctx context.Context, resourceGroupName string, serviceName string, appName string, validatePayload CustomDomainValidatePayload) (result CustomDomainValidateResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ValidateDomain") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: validatePayload, - Constraints: []validation.Constraint{{Target: "validatePayload.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("appplatform.AppsClient", "ValidateDomain", err.Error()) - } - - req, err := client.ValidateDomainPreparer(ctx, resourceGroupName, serviceName, appName, validatePayload) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "ValidateDomain", nil, "Failure preparing request") - return - } - - resp, err := client.ValidateDomainSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "ValidateDomain", resp, "Failure sending request") - return - } - - result, err = client.ValidateDomainResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "ValidateDomain", resp, "Failure responding to request") - return - } - - return -} - -// ValidateDomainPreparer prepares the ValidateDomain request. -func (client AppsClient) ValidateDomainPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, validatePayload CustomDomainValidatePayload) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "appName": autorest.Encode("path", appName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "serviceName": autorest.Encode("path", serviceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", pathParameters), - autorest.WithJSON(validatePayload), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ValidateDomainSender sends the ValidateDomain request. The method will close the -// http.Response Body if it receives an error. -func (client AppsClient) ValidateDomainSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ValidateDomainResponder handles the response to the ValidateDomain request. The method always -// closes the http.Response Body. -func (client AppsClient) ValidateDomainResponder(resp *http.Response) (result CustomDomainValidateResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/client.go deleted file mode 100644 index 61b86478046..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package appplatform implements the Azure ARM Appplatform service API version 2022-03-01-preview. -// -// REST API for Azure Spring Cloud -package appplatform - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Appplatform - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Appplatform. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/enums.go deleted file mode 100644 index 2b7bdae0196..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/enums.go +++ /dev/null @@ -1,634 +0,0 @@ -package appplatform - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ActionType enumerates the values for action type. -type ActionType string - -const ( - // ActionTypeInternal ... - ActionTypeInternal ActionType = "Internal" -) - -// PossibleActionTypeValues returns an array of possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{ActionTypeInternal} -} - -// APIPortalProvisioningState enumerates the values for api portal provisioning state. -type APIPortalProvisioningState string - -const ( - // APIPortalProvisioningStateCreating ... - APIPortalProvisioningStateCreating APIPortalProvisioningState = "Creating" - // APIPortalProvisioningStateDeleting ... - APIPortalProvisioningStateDeleting APIPortalProvisioningState = "Deleting" - // APIPortalProvisioningStateFailed ... - APIPortalProvisioningStateFailed APIPortalProvisioningState = "Failed" - // APIPortalProvisioningStateSucceeded ... - APIPortalProvisioningStateSucceeded APIPortalProvisioningState = "Succeeded" - // APIPortalProvisioningStateUpdating ... - APIPortalProvisioningStateUpdating APIPortalProvisioningState = "Updating" -) - -// PossibleAPIPortalProvisioningStateValues returns an array of possible values for the APIPortalProvisioningState const type. -func PossibleAPIPortalProvisioningStateValues() []APIPortalProvisioningState { - return []APIPortalProvisioningState{APIPortalProvisioningStateCreating, APIPortalProvisioningStateDeleting, APIPortalProvisioningStateFailed, APIPortalProvisioningStateSucceeded, APIPortalProvisioningStateUpdating} -} - -// AppResourceProvisioningState enumerates the values for app resource provisioning state. -type AppResourceProvisioningState string - -const ( - // AppResourceProvisioningStateCreating ... - AppResourceProvisioningStateCreating AppResourceProvisioningState = "Creating" - // AppResourceProvisioningStateDeleting ... - AppResourceProvisioningStateDeleting AppResourceProvisioningState = "Deleting" - // AppResourceProvisioningStateFailed ... - AppResourceProvisioningStateFailed AppResourceProvisioningState = "Failed" - // AppResourceProvisioningStateSucceeded ... - AppResourceProvisioningStateSucceeded AppResourceProvisioningState = "Succeeded" - // AppResourceProvisioningStateUpdating ... - AppResourceProvisioningStateUpdating AppResourceProvisioningState = "Updating" -) - -// PossibleAppResourceProvisioningStateValues returns an array of possible values for the AppResourceProvisioningState const type. -func PossibleAppResourceProvisioningStateValues() []AppResourceProvisioningState { - return []AppResourceProvisioningState{AppResourceProvisioningStateCreating, AppResourceProvisioningStateDeleting, AppResourceProvisioningStateFailed, AppResourceProvisioningStateSucceeded, AppResourceProvisioningStateUpdating} -} - -// BindingType enumerates the values for binding type. -type BindingType string - -const ( - // BindingTypeApacheSkyWalking ... - BindingTypeApacheSkyWalking BindingType = "ApacheSkyWalking" - // BindingTypeAppDynamics ... - BindingTypeAppDynamics BindingType = "AppDynamics" - // BindingTypeApplicationInsights ... - BindingTypeApplicationInsights BindingType = "ApplicationInsights" - // BindingTypeDynatrace ... - BindingTypeDynatrace BindingType = "Dynatrace" - // BindingTypeElasticAPM ... - BindingTypeElasticAPM BindingType = "ElasticAPM" - // BindingTypeNewRelic ... - BindingTypeNewRelic BindingType = "NewRelic" -) - -// PossibleBindingTypeValues returns an array of possible values for the BindingType const type. -func PossibleBindingTypeValues() []BindingType { - return []BindingType{BindingTypeApacheSkyWalking, BindingTypeAppDynamics, BindingTypeApplicationInsights, BindingTypeDynatrace, BindingTypeElasticAPM, BindingTypeNewRelic} -} - -// BuilderProvisioningState enumerates the values for builder provisioning state. -type BuilderProvisioningState string - -const ( - // BuilderProvisioningStateCreating ... - BuilderProvisioningStateCreating BuilderProvisioningState = "Creating" - // BuilderProvisioningStateDeleting ... - BuilderProvisioningStateDeleting BuilderProvisioningState = "Deleting" - // BuilderProvisioningStateFailed ... - BuilderProvisioningStateFailed BuilderProvisioningState = "Failed" - // BuilderProvisioningStateSucceeded ... - BuilderProvisioningStateSucceeded BuilderProvisioningState = "Succeeded" - // BuilderProvisioningStateUpdating ... - BuilderProvisioningStateUpdating BuilderProvisioningState = "Updating" -) - -// PossibleBuilderProvisioningStateValues returns an array of possible values for the BuilderProvisioningState const type. -func PossibleBuilderProvisioningStateValues() []BuilderProvisioningState { - return []BuilderProvisioningState{BuilderProvisioningStateCreating, BuilderProvisioningStateDeleting, BuilderProvisioningStateFailed, BuilderProvisioningStateSucceeded, BuilderProvisioningStateUpdating} -} - -// BuildpackBindingProvisioningState enumerates the values for buildpack binding provisioning state. -type BuildpackBindingProvisioningState string - -const ( - // BuildpackBindingProvisioningStateCreating ... - BuildpackBindingProvisioningStateCreating BuildpackBindingProvisioningState = "Creating" - // BuildpackBindingProvisioningStateDeleting ... - BuildpackBindingProvisioningStateDeleting BuildpackBindingProvisioningState = "Deleting" - // BuildpackBindingProvisioningStateFailed ... - BuildpackBindingProvisioningStateFailed BuildpackBindingProvisioningState = "Failed" - // BuildpackBindingProvisioningStateSucceeded ... - BuildpackBindingProvisioningStateSucceeded BuildpackBindingProvisioningState = "Succeeded" - // BuildpackBindingProvisioningStateUpdating ... - BuildpackBindingProvisioningStateUpdating BuildpackBindingProvisioningState = "Updating" -) - -// PossibleBuildpackBindingProvisioningStateValues returns an array of possible values for the BuildpackBindingProvisioningState const type. -func PossibleBuildpackBindingProvisioningStateValues() []BuildpackBindingProvisioningState { - return []BuildpackBindingProvisioningState{BuildpackBindingProvisioningStateCreating, BuildpackBindingProvisioningStateDeleting, BuildpackBindingProvisioningStateFailed, BuildpackBindingProvisioningStateSucceeded, BuildpackBindingProvisioningStateUpdating} -} - -// BuildProvisioningState enumerates the values for build provisioning state. -type BuildProvisioningState string - -const ( - // BuildProvisioningStateCreating ... - BuildProvisioningStateCreating BuildProvisioningState = "Creating" - // BuildProvisioningStateDeleting ... - BuildProvisioningStateDeleting BuildProvisioningState = "Deleting" - // BuildProvisioningStateFailed ... - BuildProvisioningStateFailed BuildProvisioningState = "Failed" - // BuildProvisioningStateSucceeded ... - BuildProvisioningStateSucceeded BuildProvisioningState = "Succeeded" - // BuildProvisioningStateUpdating ... - BuildProvisioningStateUpdating BuildProvisioningState = "Updating" -) - -// PossibleBuildProvisioningStateValues returns an array of possible values for the BuildProvisioningState const type. -func PossibleBuildProvisioningStateValues() []BuildProvisioningState { - return []BuildProvisioningState{BuildProvisioningStateCreating, BuildProvisioningStateDeleting, BuildProvisioningStateFailed, BuildProvisioningStateSucceeded, BuildProvisioningStateUpdating} -} - -// BuildResultProvisioningState enumerates the values for build result provisioning state. -type BuildResultProvisioningState string - -const ( - // BuildResultProvisioningStateBuilding ... - BuildResultProvisioningStateBuilding BuildResultProvisioningState = "Building" - // BuildResultProvisioningStateDeleting ... - BuildResultProvisioningStateDeleting BuildResultProvisioningState = "Deleting" - // BuildResultProvisioningStateFailed ... - BuildResultProvisioningStateFailed BuildResultProvisioningState = "Failed" - // BuildResultProvisioningStateQueuing ... - BuildResultProvisioningStateQueuing BuildResultProvisioningState = "Queuing" - // BuildResultProvisioningStateSucceeded ... - BuildResultProvisioningStateSucceeded BuildResultProvisioningState = "Succeeded" -) - -// PossibleBuildResultProvisioningStateValues returns an array of possible values for the BuildResultProvisioningState const type. -func PossibleBuildResultProvisioningStateValues() []BuildResultProvisioningState { - return []BuildResultProvisioningState{BuildResultProvisioningStateBuilding, BuildResultProvisioningStateDeleting, BuildResultProvisioningStateFailed, BuildResultProvisioningStateQueuing, BuildResultProvisioningStateSucceeded} -} - -// BuildServiceProvisioningState enumerates the values for build service provisioning state. -type BuildServiceProvisioningState string - -const ( - // BuildServiceProvisioningStateCreating ... - BuildServiceProvisioningStateCreating BuildServiceProvisioningState = "Creating" - // BuildServiceProvisioningStateDeleting ... - BuildServiceProvisioningStateDeleting BuildServiceProvisioningState = "Deleting" - // BuildServiceProvisioningStateFailed ... - BuildServiceProvisioningStateFailed BuildServiceProvisioningState = "Failed" - // BuildServiceProvisioningStateSucceeded ... - BuildServiceProvisioningStateSucceeded BuildServiceProvisioningState = "Succeeded" - // BuildServiceProvisioningStateUpdating ... - BuildServiceProvisioningStateUpdating BuildServiceProvisioningState = "Updating" -) - -// PossibleBuildServiceProvisioningStateValues returns an array of possible values for the BuildServiceProvisioningState const type. -func PossibleBuildServiceProvisioningStateValues() []BuildServiceProvisioningState { - return []BuildServiceProvisioningState{BuildServiceProvisioningStateCreating, BuildServiceProvisioningStateDeleting, BuildServiceProvisioningStateFailed, BuildServiceProvisioningStateSucceeded, BuildServiceProvisioningStateUpdating} -} - -// ConfigServerState enumerates the values for config server state. -type ConfigServerState string - -const ( - // ConfigServerStateDeleted ... - ConfigServerStateDeleted ConfigServerState = "Deleted" - // ConfigServerStateFailed ... - ConfigServerStateFailed ConfigServerState = "Failed" - // ConfigServerStateNotAvailable ... - ConfigServerStateNotAvailable ConfigServerState = "NotAvailable" - // ConfigServerStateSucceeded ... - ConfigServerStateSucceeded ConfigServerState = "Succeeded" - // ConfigServerStateUpdating ... - ConfigServerStateUpdating ConfigServerState = "Updating" -) - -// PossibleConfigServerStateValues returns an array of possible values for the ConfigServerState const type. -func PossibleConfigServerStateValues() []ConfigServerState { - return []ConfigServerState{ConfigServerStateDeleted, ConfigServerStateFailed, ConfigServerStateNotAvailable, ConfigServerStateSucceeded, ConfigServerStateUpdating} -} - -// ConfigurationServiceProvisioningState enumerates the values for configuration service provisioning state. -type ConfigurationServiceProvisioningState string - -const ( - // ConfigurationServiceProvisioningStateCreating ... - ConfigurationServiceProvisioningStateCreating ConfigurationServiceProvisioningState = "Creating" - // ConfigurationServiceProvisioningStateDeleting ... - ConfigurationServiceProvisioningStateDeleting ConfigurationServiceProvisioningState = "Deleting" - // ConfigurationServiceProvisioningStateFailed ... - ConfigurationServiceProvisioningStateFailed ConfigurationServiceProvisioningState = "Failed" - // ConfigurationServiceProvisioningStateSucceeded ... - ConfigurationServiceProvisioningStateSucceeded ConfigurationServiceProvisioningState = "Succeeded" - // ConfigurationServiceProvisioningStateUpdating ... - ConfigurationServiceProvisioningStateUpdating ConfigurationServiceProvisioningState = "Updating" -) - -// PossibleConfigurationServiceProvisioningStateValues returns an array of possible values for the ConfigurationServiceProvisioningState const type. -func PossibleConfigurationServiceProvisioningStateValues() []ConfigurationServiceProvisioningState { - return []ConfigurationServiceProvisioningState{ConfigurationServiceProvisioningStateCreating, ConfigurationServiceProvisioningStateDeleting, ConfigurationServiceProvisioningStateFailed, ConfigurationServiceProvisioningStateSucceeded, ConfigurationServiceProvisioningStateUpdating} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// DeploymentResourceProvisioningState enumerates the values for deployment resource provisioning state. -type DeploymentResourceProvisioningState string - -const ( - // DeploymentResourceProvisioningStateCreating ... - DeploymentResourceProvisioningStateCreating DeploymentResourceProvisioningState = "Creating" - // DeploymentResourceProvisioningStateFailed ... - DeploymentResourceProvisioningStateFailed DeploymentResourceProvisioningState = "Failed" - // DeploymentResourceProvisioningStateSucceeded ... - DeploymentResourceProvisioningStateSucceeded DeploymentResourceProvisioningState = "Succeeded" - // DeploymentResourceProvisioningStateUpdating ... - DeploymentResourceProvisioningStateUpdating DeploymentResourceProvisioningState = "Updating" -) - -// PossibleDeploymentResourceProvisioningStateValues returns an array of possible values for the DeploymentResourceProvisioningState const type. -func PossibleDeploymentResourceProvisioningStateValues() []DeploymentResourceProvisioningState { - return []DeploymentResourceProvisioningState{DeploymentResourceProvisioningStateCreating, DeploymentResourceProvisioningStateFailed, DeploymentResourceProvisioningStateSucceeded, DeploymentResourceProvisioningStateUpdating} -} - -// DeploymentResourceStatus enumerates the values for deployment resource status. -type DeploymentResourceStatus string - -const ( - // DeploymentResourceStatusRunning ... - DeploymentResourceStatusRunning DeploymentResourceStatus = "Running" - // DeploymentResourceStatusStopped ... - DeploymentResourceStatusStopped DeploymentResourceStatus = "Stopped" -) - -// PossibleDeploymentResourceStatusValues returns an array of possible values for the DeploymentResourceStatus const type. -func PossibleDeploymentResourceStatusValues() []DeploymentResourceStatus { - return []DeploymentResourceStatus{DeploymentResourceStatusRunning, DeploymentResourceStatusStopped} -} - -// GatewayProvisioningState enumerates the values for gateway provisioning state. -type GatewayProvisioningState string - -const ( - // GatewayProvisioningStateCreating ... - GatewayProvisioningStateCreating GatewayProvisioningState = "Creating" - // GatewayProvisioningStateDeleting ... - GatewayProvisioningStateDeleting GatewayProvisioningState = "Deleting" - // GatewayProvisioningStateFailed ... - GatewayProvisioningStateFailed GatewayProvisioningState = "Failed" - // GatewayProvisioningStateSucceeded ... - GatewayProvisioningStateSucceeded GatewayProvisioningState = "Succeeded" - // GatewayProvisioningStateUpdating ... - GatewayProvisioningStateUpdating GatewayProvisioningState = "Updating" -) - -// PossibleGatewayProvisioningStateValues returns an array of possible values for the GatewayProvisioningState const type. -func PossibleGatewayProvisioningStateValues() []GatewayProvisioningState { - return []GatewayProvisioningState{GatewayProvisioningStateCreating, GatewayProvisioningStateDeleting, GatewayProvisioningStateFailed, GatewayProvisioningStateSucceeded, GatewayProvisioningStateUpdating} -} - -// KPackBuildStageProvisioningState enumerates the values for k pack build stage provisioning state. -type KPackBuildStageProvisioningState string - -const ( - // KPackBuildStageProvisioningStateFailed ... - KPackBuildStageProvisioningStateFailed KPackBuildStageProvisioningState = "Failed" - // KPackBuildStageProvisioningStateNotStarted ... - KPackBuildStageProvisioningStateNotStarted KPackBuildStageProvisioningState = "NotStarted" - // KPackBuildStageProvisioningStateRunning ... - KPackBuildStageProvisioningStateRunning KPackBuildStageProvisioningState = "Running" - // KPackBuildStageProvisioningStateSucceeded ... - KPackBuildStageProvisioningStateSucceeded KPackBuildStageProvisioningState = "Succeeded" -) - -// PossibleKPackBuildStageProvisioningStateValues returns an array of possible values for the KPackBuildStageProvisioningState const type. -func PossibleKPackBuildStageProvisioningStateValues() []KPackBuildStageProvisioningState { - return []KPackBuildStageProvisioningState{KPackBuildStageProvisioningStateFailed, KPackBuildStageProvisioningStateNotStarted, KPackBuildStageProvisioningStateRunning, KPackBuildStageProvisioningStateSucceeded} -} - -// LastModifiedByType enumerates the values for last modified by type. -type LastModifiedByType string - -const ( - // LastModifiedByTypeApplication ... - LastModifiedByTypeApplication LastModifiedByType = "Application" - // LastModifiedByTypeKey ... - LastModifiedByTypeKey LastModifiedByType = "Key" - // LastModifiedByTypeManagedIdentity ... - LastModifiedByTypeManagedIdentity LastModifiedByType = "ManagedIdentity" - // LastModifiedByTypeUser ... - LastModifiedByTypeUser LastModifiedByType = "User" -) - -// PossibleLastModifiedByTypeValues returns an array of possible values for the LastModifiedByType const type. -func PossibleLastModifiedByTypeValues() []LastModifiedByType { - return []LastModifiedByType{LastModifiedByTypeApplication, LastModifiedByTypeKey, LastModifiedByTypeManagedIdentity, LastModifiedByTypeUser} -} - -// ManagedIdentityType enumerates the values for managed identity type. -type ManagedIdentityType string - -const ( - // ManagedIdentityTypeNone ... - ManagedIdentityTypeNone ManagedIdentityType = "None" - // ManagedIdentityTypeSystemAssigned ... - ManagedIdentityTypeSystemAssigned ManagedIdentityType = "SystemAssigned" - // ManagedIdentityTypeSystemAssignedUserAssigned ... - ManagedIdentityTypeSystemAssignedUserAssigned ManagedIdentityType = "SystemAssigned,UserAssigned" - // ManagedIdentityTypeUserAssigned ... - ManagedIdentityTypeUserAssigned ManagedIdentityType = "UserAssigned" -) - -// PossibleManagedIdentityTypeValues returns an array of possible values for the ManagedIdentityType const type. -func PossibleManagedIdentityTypeValues() []ManagedIdentityType { - return []ManagedIdentityType{ManagedIdentityTypeNone, ManagedIdentityTypeSystemAssigned, ManagedIdentityTypeSystemAssignedUserAssigned, ManagedIdentityTypeUserAssigned} -} - -// MonitoringSettingState enumerates the values for monitoring setting state. -type MonitoringSettingState string - -const ( - // MonitoringSettingStateFailed ... - MonitoringSettingStateFailed MonitoringSettingState = "Failed" - // MonitoringSettingStateNotAvailable ... - MonitoringSettingStateNotAvailable MonitoringSettingState = "NotAvailable" - // MonitoringSettingStateSucceeded ... - MonitoringSettingStateSucceeded MonitoringSettingState = "Succeeded" - // MonitoringSettingStateUpdating ... - MonitoringSettingStateUpdating MonitoringSettingState = "Updating" -) - -// PossibleMonitoringSettingStateValues returns an array of possible values for the MonitoringSettingState const type. -func PossibleMonitoringSettingStateValues() []MonitoringSettingState { - return []MonitoringSettingState{MonitoringSettingStateFailed, MonitoringSettingStateNotAvailable, MonitoringSettingStateSucceeded, MonitoringSettingStateUpdating} -} - -// PowerState enumerates the values for power state. -type PowerState string - -const ( - // PowerStateRunning ... - PowerStateRunning PowerState = "Running" - // PowerStateStopped ... - PowerStateStopped PowerState = "Stopped" -) - -// PossiblePowerStateValues returns an array of possible values for the PowerState const type. -func PossiblePowerStateValues() []PowerState { - return []PowerState{PowerStateRunning, PowerStateStopped} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCreating ... - ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleted ... - ProvisioningStateDeleted ProvisioningState = "Deleted" - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateMoved ... - ProvisioningStateMoved ProvisioningState = "Moved" - // ProvisioningStateMoveFailed ... - ProvisioningStateMoveFailed ProvisioningState = "MoveFailed" - // ProvisioningStateMoving ... - ProvisioningStateMoving ProvisioningState = "Moving" - // ProvisioningStateStarting ... - ProvisioningStateStarting ProvisioningState = "Starting" - // ProvisioningStateStopping ... - ProvisioningStateStopping ProvisioningState = "Stopping" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating ... - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoved, ProvisioningStateMoveFailed, ProvisioningStateMoving, ProvisioningStateStarting, ProvisioningStateStopping, ProvisioningStateSucceeded, ProvisioningStateUpdating} -} - -// ResourceSkuRestrictionsReasonCode enumerates the values for resource sku restrictions reason code. -type ResourceSkuRestrictionsReasonCode string - -const ( - // ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription ... - ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription ResourceSkuRestrictionsReasonCode = "NotAvailableForSubscription" - // ResourceSkuRestrictionsReasonCodeQuotaID ... - ResourceSkuRestrictionsReasonCodeQuotaID ResourceSkuRestrictionsReasonCode = "QuotaId" -) - -// PossibleResourceSkuRestrictionsReasonCodeValues returns an array of possible values for the ResourceSkuRestrictionsReasonCode const type. -func PossibleResourceSkuRestrictionsReasonCodeValues() []ResourceSkuRestrictionsReasonCode { - return []ResourceSkuRestrictionsReasonCode{ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription, ResourceSkuRestrictionsReasonCodeQuotaID} -} - -// ResourceSkuRestrictionsType enumerates the values for resource sku restrictions type. -type ResourceSkuRestrictionsType string - -const ( - // ResourceSkuRestrictionsTypeLocation ... - ResourceSkuRestrictionsTypeLocation ResourceSkuRestrictionsType = "Location" - // ResourceSkuRestrictionsTypeZone ... - ResourceSkuRestrictionsTypeZone ResourceSkuRestrictionsType = "Zone" -) - -// PossibleResourceSkuRestrictionsTypeValues returns an array of possible values for the ResourceSkuRestrictionsType const type. -func PossibleResourceSkuRestrictionsTypeValues() []ResourceSkuRestrictionsType { - return []ResourceSkuRestrictionsType{ResourceSkuRestrictionsTypeLocation, ResourceSkuRestrictionsTypeZone} -} - -// ServiceRegistryProvisioningState enumerates the values for service registry provisioning state. -type ServiceRegistryProvisioningState string - -const ( - // ServiceRegistryProvisioningStateCreating ... - ServiceRegistryProvisioningStateCreating ServiceRegistryProvisioningState = "Creating" - // ServiceRegistryProvisioningStateDeleting ... - ServiceRegistryProvisioningStateDeleting ServiceRegistryProvisioningState = "Deleting" - // ServiceRegistryProvisioningStateFailed ... - ServiceRegistryProvisioningStateFailed ServiceRegistryProvisioningState = "Failed" - // ServiceRegistryProvisioningStateSucceeded ... - ServiceRegistryProvisioningStateSucceeded ServiceRegistryProvisioningState = "Succeeded" - // ServiceRegistryProvisioningStateUpdating ... - ServiceRegistryProvisioningStateUpdating ServiceRegistryProvisioningState = "Updating" -) - -// PossibleServiceRegistryProvisioningStateValues returns an array of possible values for the ServiceRegistryProvisioningState const type. -func PossibleServiceRegistryProvisioningStateValues() []ServiceRegistryProvisioningState { - return []ServiceRegistryProvisioningState{ServiceRegistryProvisioningStateCreating, ServiceRegistryProvisioningStateDeleting, ServiceRegistryProvisioningStateFailed, ServiceRegistryProvisioningStateSucceeded, ServiceRegistryProvisioningStateUpdating} -} - -// SkuScaleType enumerates the values for sku scale type. -type SkuScaleType string - -const ( - // SkuScaleTypeAutomatic ... - SkuScaleTypeAutomatic SkuScaleType = "Automatic" - // SkuScaleTypeManual ... - SkuScaleTypeManual SkuScaleType = "Manual" - // SkuScaleTypeNone ... - SkuScaleTypeNone SkuScaleType = "None" -) - -// PossibleSkuScaleTypeValues returns an array of possible values for the SkuScaleType const type. -func PossibleSkuScaleTypeValues() []SkuScaleType { - return []SkuScaleType{SkuScaleTypeAutomatic, SkuScaleTypeManual, SkuScaleTypeNone} -} - -// StorageType enumerates the values for storage type. -type StorageType string - -const ( - // StorageTypeStorageAccount ... - StorageTypeStorageAccount StorageType = "StorageAccount" - // StorageTypeStorageProperties ... - StorageTypeStorageProperties StorageType = "StorageProperties" -) - -// PossibleStorageTypeValues returns an array of possible values for the StorageType const type. -func PossibleStorageTypeValues() []StorageType { - return []StorageType{StorageTypeStorageAccount, StorageTypeStorageProperties} -} - -// SupportedRuntimePlatform enumerates the values for supported runtime platform. -type SupportedRuntimePlatform string - -const ( - // SupportedRuntimePlatformJava ... - SupportedRuntimePlatformJava SupportedRuntimePlatform = "Java" - // SupportedRuntimePlatformNETCore ... - SupportedRuntimePlatformNETCore SupportedRuntimePlatform = ".NET Core" -) - -// PossibleSupportedRuntimePlatformValues returns an array of possible values for the SupportedRuntimePlatform const type. -func PossibleSupportedRuntimePlatformValues() []SupportedRuntimePlatform { - return []SupportedRuntimePlatform{SupportedRuntimePlatformJava, SupportedRuntimePlatformNETCore} -} - -// SupportedRuntimeValue enumerates the values for supported runtime value. -type SupportedRuntimeValue string - -const ( - // SupportedRuntimeValueJava11 ... - SupportedRuntimeValueJava11 SupportedRuntimeValue = "Java_11" - // SupportedRuntimeValueJava17 ... - SupportedRuntimeValueJava17 SupportedRuntimeValue = "Java_17" - // SupportedRuntimeValueJava8 ... - SupportedRuntimeValueJava8 SupportedRuntimeValue = "Java_8" - // SupportedRuntimeValueNetCore31 ... - SupportedRuntimeValueNetCore31 SupportedRuntimeValue = "NetCore_31" -) - -// PossibleSupportedRuntimeValueValues returns an array of possible values for the SupportedRuntimeValue const type. -func PossibleSupportedRuntimeValueValues() []SupportedRuntimeValue { - return []SupportedRuntimeValue{SupportedRuntimeValueJava11, SupportedRuntimeValueJava17, SupportedRuntimeValueJava8, SupportedRuntimeValueNetCore31} -} - -// TestKeyType enumerates the values for test key type. -type TestKeyType string - -const ( - // TestKeyTypePrimary ... - TestKeyTypePrimary TestKeyType = "Primary" - // TestKeyTypeSecondary ... - TestKeyTypeSecondary TestKeyType = "Secondary" -) - -// PossibleTestKeyTypeValues returns an array of possible values for the TestKeyType const type. -func PossibleTestKeyTypeValues() []TestKeyType { - return []TestKeyType{TestKeyTypePrimary, TestKeyTypeSecondary} -} - -// TrafficDirection enumerates the values for traffic direction. -type TrafficDirection string - -const ( - // TrafficDirectionInbound ... - TrafficDirectionInbound TrafficDirection = "Inbound" - // TrafficDirectionOutbound ... - TrafficDirectionOutbound TrafficDirection = "Outbound" -) - -// PossibleTrafficDirectionValues returns an array of possible values for the TrafficDirection const type. -func PossibleTrafficDirectionValues() []TrafficDirection { - return []TrafficDirection{TrafficDirectionInbound, TrafficDirectionOutbound} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeAzureFileVolume ... - TypeAzureFileVolume Type = "AzureFileVolume" - // TypeCustomPersistentDiskProperties ... - TypeCustomPersistentDiskProperties Type = "CustomPersistentDiskProperties" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeAzureFileVolume, TypeCustomPersistentDiskProperties} -} - -// TypeBasicCertificateProperties enumerates the values for type basic certificate properties. -type TypeBasicCertificateProperties string - -const ( - // TypeBasicCertificatePropertiesTypeCertificateProperties ... - TypeBasicCertificatePropertiesTypeCertificateProperties TypeBasicCertificateProperties = "CertificateProperties" - // TypeBasicCertificatePropertiesTypeContentCertificate ... - TypeBasicCertificatePropertiesTypeContentCertificate TypeBasicCertificateProperties = "ContentCertificate" - // TypeBasicCertificatePropertiesTypeKeyVaultCertificate ... - TypeBasicCertificatePropertiesTypeKeyVaultCertificate TypeBasicCertificateProperties = "KeyVaultCertificate" -) - -// PossibleTypeBasicCertificatePropertiesValues returns an array of possible values for the TypeBasicCertificateProperties const type. -func PossibleTypeBasicCertificatePropertiesValues() []TypeBasicCertificateProperties { - return []TypeBasicCertificateProperties{TypeBasicCertificatePropertiesTypeCertificateProperties, TypeBasicCertificatePropertiesTypeContentCertificate, TypeBasicCertificatePropertiesTypeKeyVaultCertificate} -} - -// TypeBasicUserSourceInfo enumerates the values for type basic user source info. -type TypeBasicUserSourceInfo string - -const ( - // TypeBasicUserSourceInfoTypeBuildResult ... - TypeBasicUserSourceInfoTypeBuildResult TypeBasicUserSourceInfo = "BuildResult" - // TypeBasicUserSourceInfoTypeContainer ... - TypeBasicUserSourceInfoTypeContainer TypeBasicUserSourceInfo = "Container" - // TypeBasicUserSourceInfoTypeJar ... - TypeBasicUserSourceInfoTypeJar TypeBasicUserSourceInfo = "Jar" - // TypeBasicUserSourceInfoTypeNetCoreZip ... - TypeBasicUserSourceInfoTypeNetCoreZip TypeBasicUserSourceInfo = "NetCoreZip" - // TypeBasicUserSourceInfoTypeSource ... - TypeBasicUserSourceInfoTypeSource TypeBasicUserSourceInfo = "Source" - // TypeBasicUserSourceInfoTypeUploadedUserSourceInfo ... - TypeBasicUserSourceInfoTypeUploadedUserSourceInfo TypeBasicUserSourceInfo = "UploadedUserSourceInfo" - // TypeBasicUserSourceInfoTypeUserSourceInfo ... - TypeBasicUserSourceInfoTypeUserSourceInfo TypeBasicUserSourceInfo = "UserSourceInfo" -) - -// PossibleTypeBasicUserSourceInfoValues returns an array of possible values for the TypeBasicUserSourceInfo const type. -func PossibleTypeBasicUserSourceInfoValues() []TypeBasicUserSourceInfo { - return []TypeBasicUserSourceInfo{TypeBasicUserSourceInfoTypeBuildResult, TypeBasicUserSourceInfoTypeContainer, TypeBasicUserSourceInfoTypeJar, TypeBasicUserSourceInfoTypeNetCoreZip, TypeBasicUserSourceInfoTypeSource, TypeBasicUserSourceInfoTypeUploadedUserSourceInfo, TypeBasicUserSourceInfoTypeUserSourceInfo} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/models.go deleted file mode 100644 index 071b9dbb6b5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/models.go +++ /dev/null @@ -1,9391 +0,0 @@ -package appplatform - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" - -// ActiveDeploymentCollection object that includes an array of Deployment resource name and set them as -// active. -type ActiveDeploymentCollection struct { - // ActiveDeploymentNames - Collection of Deployment name. - ActiveDeploymentNames *[]string `json:"activeDeploymentNames,omitempty"` -} - -// APIPortalCustomDomainProperties the properties of custom domain for API portal -type APIPortalCustomDomainProperties struct { - // Thumbprint - The thumbprint of bound certificate. - Thumbprint *string `json:"thumbprint,omitempty"` -} - -// APIPortalCustomDomainResource custom domain of the API portal -type APIPortalCustomDomainResource struct { - autorest.Response `json:"-"` - Properties *APIPortalCustomDomainProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIPortalCustomDomainResource. -func (apcdr APIPortalCustomDomainResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if apcdr.Properties != nil { - objectMap["properties"] = apcdr.Properties - } - if apcdr.SystemData != nil { - objectMap["systemData"] = apcdr.SystemData - } - return json.Marshal(objectMap) -} - -// APIPortalCustomDomainResourceCollection object that includes an array of API portal custom domain -// resources and a possible link for next set -type APIPortalCustomDomainResourceCollection struct { - autorest.Response `json:"-"` - // Value - Collection of API portal custom domain resources - Value *[]APIPortalCustomDomainResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// APIPortalCustomDomainResourceCollectionIterator provides access to a complete listing of -// APIPortalCustomDomainResource values. -type APIPortalCustomDomainResourceCollectionIterator struct { - i int - page APIPortalCustomDomainResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *APIPortalCustomDomainResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalCustomDomainResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *APIPortalCustomDomainResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APIPortalCustomDomainResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter APIPortalCustomDomainResourceCollectionIterator) Response() APIPortalCustomDomainResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter APIPortalCustomDomainResourceCollectionIterator) Value() APIPortalCustomDomainResource { - if !iter.page.NotDone() { - return APIPortalCustomDomainResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APIPortalCustomDomainResourceCollectionIterator type. -func NewAPIPortalCustomDomainResourceCollectionIterator(page APIPortalCustomDomainResourceCollectionPage) APIPortalCustomDomainResourceCollectionIterator { - return APIPortalCustomDomainResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (apcdrc APIPortalCustomDomainResourceCollection) IsEmpty() bool { - return apcdrc.Value == nil || len(*apcdrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (apcdrc APIPortalCustomDomainResourceCollection) hasNextLink() bool { - return apcdrc.NextLink != nil && len(*apcdrc.NextLink) != 0 -} - -// aPIPortalCustomDomainResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (apcdrc APIPortalCustomDomainResourceCollection) aPIPortalCustomDomainResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !apcdrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(apcdrc.NextLink))) -} - -// APIPortalCustomDomainResourceCollectionPage contains a page of APIPortalCustomDomainResource values. -type APIPortalCustomDomainResourceCollectionPage struct { - fn func(context.Context, APIPortalCustomDomainResourceCollection) (APIPortalCustomDomainResourceCollection, error) - apcdrc APIPortalCustomDomainResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *APIPortalCustomDomainResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalCustomDomainResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.apcdrc) - if err != nil { - return err - } - page.apcdrc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *APIPortalCustomDomainResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APIPortalCustomDomainResourceCollectionPage) NotDone() bool { - return !page.apcdrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APIPortalCustomDomainResourceCollectionPage) Response() APIPortalCustomDomainResourceCollection { - return page.apcdrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APIPortalCustomDomainResourceCollectionPage) Values() []APIPortalCustomDomainResource { - if page.apcdrc.IsEmpty() { - return nil - } - return *page.apcdrc.Value -} - -// Creates a new instance of the APIPortalCustomDomainResourceCollectionPage type. -func NewAPIPortalCustomDomainResourceCollectionPage(cur APIPortalCustomDomainResourceCollection, getNextPage func(context.Context, APIPortalCustomDomainResourceCollection) (APIPortalCustomDomainResourceCollection, error)) APIPortalCustomDomainResourceCollectionPage { - return APIPortalCustomDomainResourceCollectionPage{ - fn: getNextPage, - apcdrc: cur, - } -} - -// APIPortalCustomDomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type APIPortalCustomDomainsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(APIPortalCustomDomainsClient) (APIPortalCustomDomainResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *APIPortalCustomDomainsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for APIPortalCustomDomainsCreateOrUpdateFuture.Result. -func (future *APIPortalCustomDomainsCreateOrUpdateFuture) result(client APIPortalCustomDomainsClient) (apcdr APIPortalCustomDomainResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - apcdr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.APIPortalCustomDomainsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if apcdr.Response.Response, err = future.GetResult(sender); err == nil && apcdr.Response.Response.StatusCode != http.StatusNoContent { - apcdr, err = client.CreateOrUpdateResponder(apcdr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsCreateOrUpdateFuture", "Result", apcdr.Response.Response, "Failure responding to request") - } - } - return -} - -// APIPortalCustomDomainsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type APIPortalCustomDomainsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(APIPortalCustomDomainsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *APIPortalCustomDomainsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for APIPortalCustomDomainsDeleteFuture.Result. -func (future *APIPortalCustomDomainsDeleteFuture) result(client APIPortalCustomDomainsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.APIPortalCustomDomainsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// APIPortalInstance collection of instances belong to the API portal -type APIPortalInstance struct { - // Name - READ-ONLY; Name of the API portal instance - Name *string `json:"name,omitempty"` - // Status - READ-ONLY; Status of the API portal instance - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIPortalInstance. -func (API APIPortalInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// APIPortalProperties API portal properties payload -type APIPortalProperties struct { - // ProvisioningState - READ-ONLY; State of the API portal. Possible values include: 'APIPortalProvisioningStateCreating', 'APIPortalProvisioningStateUpdating', 'APIPortalProvisioningStateSucceeded', 'APIPortalProvisioningStateFailed', 'APIPortalProvisioningStateDeleting' - ProvisioningState APIPortalProvisioningState `json:"provisioningState,omitempty"` - // Public - Indicates whether the API portal exposes endpoint. - Public *bool `json:"public,omitempty"` - // URL - READ-ONLY; URL of the API portal, exposed when 'public' is true. - URL *string `json:"url,omitempty"` - // HTTPSOnly - Indicate if only https is allowed. - HTTPSOnly *bool `json:"httpsOnly,omitempty"` - // GatewayIds - The array of resource Ids of gateway to integrate with API portal. - GatewayIds *[]string `json:"gatewayIds,omitempty"` - // SourceUrls - Collection of OpenAPI source URL locations. - SourceUrls *[]string `json:"sourceUrls,omitempty"` - SsoProperties *SsoProperties `json:"ssoProperties,omitempty"` - // ResourceRequests - READ-ONLY; The requested resource quantity for required CPU and Memory. - ResourceRequests *APIPortalResourceRequests `json:"resourceRequests,omitempty"` - // Instances - READ-ONLY; Collection of instances belong to API portal. - Instances *[]APIPortalInstance `json:"instances,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIPortalProperties. -func (app APIPortalProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if app.Public != nil { - objectMap["public"] = app.Public - } - if app.HTTPSOnly != nil { - objectMap["httpsOnly"] = app.HTTPSOnly - } - if app.GatewayIds != nil { - objectMap["gatewayIds"] = app.GatewayIds - } - if app.SourceUrls != nil { - objectMap["sourceUrls"] = app.SourceUrls - } - if app.SsoProperties != nil { - objectMap["ssoProperties"] = app.SsoProperties - } - return json.Marshal(objectMap) -} - -// APIPortalResource API portal resource -type APIPortalResource struct { - autorest.Response `json:"-"` - Properties *APIPortalProperties `json:"properties,omitempty"` - // Sku - Sku of the API portal resource - Sku *Sku `json:"sku,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIPortalResource. -func (apr APIPortalResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if apr.Properties != nil { - objectMap["properties"] = apr.Properties - } - if apr.Sku != nil { - objectMap["sku"] = apr.Sku - } - if apr.SystemData != nil { - objectMap["systemData"] = apr.SystemData - } - return json.Marshal(objectMap) -} - -// APIPortalResourceCollection object that includes an array of API portal resources and a possible link -// for next set -type APIPortalResourceCollection struct { - autorest.Response `json:"-"` - // Value - Collection of API portal resources - Value *[]APIPortalResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// APIPortalResourceCollectionIterator provides access to a complete listing of APIPortalResource values. -type APIPortalResourceCollectionIterator struct { - i int - page APIPortalResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *APIPortalResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *APIPortalResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter APIPortalResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter APIPortalResourceCollectionIterator) Response() APIPortalResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter APIPortalResourceCollectionIterator) Value() APIPortalResource { - if !iter.page.NotDone() { - return APIPortalResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the APIPortalResourceCollectionIterator type. -func NewAPIPortalResourceCollectionIterator(page APIPortalResourceCollectionPage) APIPortalResourceCollectionIterator { - return APIPortalResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aprc APIPortalResourceCollection) IsEmpty() bool { - return aprc.Value == nil || len(*aprc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aprc APIPortalResourceCollection) hasNextLink() bool { - return aprc.NextLink != nil && len(*aprc.NextLink) != 0 -} - -// aPIPortalResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aprc APIPortalResourceCollection) aPIPortalResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !aprc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aprc.NextLink))) -} - -// APIPortalResourceCollectionPage contains a page of APIPortalResource values. -type APIPortalResourceCollectionPage struct { - fn func(context.Context, APIPortalResourceCollection) (APIPortalResourceCollection, error) - aprc APIPortalResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *APIPortalResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.aprc) - if err != nil { - return err - } - page.aprc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *APIPortalResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page APIPortalResourceCollectionPage) NotDone() bool { - return !page.aprc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page APIPortalResourceCollectionPage) Response() APIPortalResourceCollection { - return page.aprc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page APIPortalResourceCollectionPage) Values() []APIPortalResource { - if page.aprc.IsEmpty() { - return nil - } - return *page.aprc.Value -} - -// Creates a new instance of the APIPortalResourceCollectionPage type. -func NewAPIPortalResourceCollectionPage(cur APIPortalResourceCollection, getNextPage func(context.Context, APIPortalResourceCollection) (APIPortalResourceCollection, error)) APIPortalResourceCollectionPage { - return APIPortalResourceCollectionPage{ - fn: getNextPage, - aprc: cur, - } -} - -// APIPortalResourceRequests resource requests of the API portal -type APIPortalResourceRequests struct { - // CPU - READ-ONLY; Cpu allocated to each API portal instance - CPU *string `json:"cpu,omitempty"` - // Memory - READ-ONLY; Memory allocated to each API portal instance - Memory *string `json:"memory,omitempty"` -} - -// MarshalJSON is the custom marshaler for APIPortalResourceRequests. -func (aprr APIPortalResourceRequests) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// APIPortalsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type APIPortalsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(APIPortalsClient) (APIPortalResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *APIPortalsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for APIPortalsCreateOrUpdateFuture.Result. -func (future *APIPortalsCreateOrUpdateFuture) result(client APIPortalsClient) (apr APIPortalResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.APIPortalsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - apr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.APIPortalsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if apr.Response.Response, err = future.GetResult(sender); err == nil && apr.Response.Response.StatusCode != http.StatusNoContent { - apr, err = client.CreateOrUpdateResponder(apr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.APIPortalsCreateOrUpdateFuture", "Result", apr.Response.Response, "Failure responding to request") - } - } - return -} - -// APIPortalsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type APIPortalsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(APIPortalsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *APIPortalsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for APIPortalsDeleteFuture.Result. -func (future *APIPortalsDeleteFuture) result(client APIPortalsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.APIPortalsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.APIPortalsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ApplicationInsightsAgentVersions application Insights agent versions properties payload -type ApplicationInsightsAgentVersions struct { - // Java - READ-ONLY; Indicates the version of application insight java agent - Java *string `json:"java,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationInsightsAgentVersions. -func (aiav ApplicationInsightsAgentVersions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AppResource app resource payload -type AppResource struct { - autorest.Response `json:"-"` - // Properties - Properties of the App resource - Properties *AppResourceProperties `json:"properties,omitempty"` - // Identity - The Managed Identity type of the app resource - Identity *ManagedIdentityProperties `json:"identity,omitempty"` - // Location - The GEO location of the application, always the same with its parent resource - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for AppResource. -func (ar AppResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Properties != nil { - objectMap["properties"] = ar.Properties - } - if ar.Identity != nil { - objectMap["identity"] = ar.Identity - } - if ar.Location != nil { - objectMap["location"] = ar.Location - } - if ar.SystemData != nil { - objectMap["systemData"] = ar.SystemData - } - return json.Marshal(objectMap) -} - -// AppResourceCollection object that includes an array of App resources and a possible link for next set -type AppResourceCollection struct { - autorest.Response `json:"-"` - // Value - Collection of App resources - Value *[]AppResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// AppResourceCollectionIterator provides access to a complete listing of AppResource values. -type AppResourceCollectionIterator struct { - i int - page AppResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AppResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AppResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AppResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AppResourceCollectionIterator) Response() AppResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AppResourceCollectionIterator) Value() AppResource { - if !iter.page.NotDone() { - return AppResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AppResourceCollectionIterator type. -func NewAppResourceCollectionIterator(page AppResourceCollectionPage) AppResourceCollectionIterator { - return AppResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (arc AppResourceCollection) IsEmpty() bool { - return arc.Value == nil || len(*arc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (arc AppResourceCollection) hasNextLink() bool { - return arc.NextLink != nil && len(*arc.NextLink) != 0 -} - -// appResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (arc AppResourceCollection) appResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !arc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(arc.NextLink))) -} - -// AppResourceCollectionPage contains a page of AppResource values. -type AppResourceCollectionPage struct { - fn func(context.Context, AppResourceCollection) (AppResourceCollection, error) - arc AppResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AppResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AppResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.arc) - if err != nil { - return err - } - page.arc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AppResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AppResourceCollectionPage) NotDone() bool { - return !page.arc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AppResourceCollectionPage) Response() AppResourceCollection { - return page.arc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AppResourceCollectionPage) Values() []AppResource { - if page.arc.IsEmpty() { - return nil - } - return *page.arc.Value -} - -// Creates a new instance of the AppResourceCollectionPage type. -func NewAppResourceCollectionPage(cur AppResourceCollection, getNextPage func(context.Context, AppResourceCollection) (AppResourceCollection, error)) AppResourceCollectionPage { - return AppResourceCollectionPage{ - fn: getNextPage, - arc: cur, - } -} - -// AppResourceProperties app resource properties payload -type AppResourceProperties struct { - // Public - Indicates whether the App exposes public endpoint - Public *bool `json:"public,omitempty"` - // URL - READ-ONLY; URL of the App - URL *string `json:"url,omitempty"` - // AddonConfigs - Collection of addons - AddonConfigs map[string]map[string]interface{} `json:"addonConfigs"` - // ProvisioningState - READ-ONLY; Provisioning state of the App. Possible values include: 'AppResourceProvisioningStateSucceeded', 'AppResourceProvisioningStateFailed', 'AppResourceProvisioningStateCreating', 'AppResourceProvisioningStateUpdating', 'AppResourceProvisioningStateDeleting' - ProvisioningState AppResourceProvisioningState `json:"provisioningState,omitempty"` - // Fqdn - Fully qualified dns Name. - Fqdn *string `json:"fqdn,omitempty"` - // HTTPSOnly - Indicate if only https is allowed. - HTTPSOnly *bool `json:"httpsOnly,omitempty"` - // TemporaryDisk - Temporary disk settings - TemporaryDisk *TemporaryDisk `json:"temporaryDisk,omitempty"` - // PersistentDisk - Persistent disk settings - PersistentDisk *PersistentDisk `json:"persistentDisk,omitempty"` - // CustomPersistentDisks - List of custom persistent disks - CustomPersistentDisks *[]CustomPersistentDiskResource `json:"customPersistentDisks,omitempty"` - // EnableEndToEndTLS - Indicate if end to end TLS is enabled. - EnableEndToEndTLS *bool `json:"enableEndToEndTLS,omitempty"` - // LoadedCertificates - Collection of loaded certificates - LoadedCertificates *[]LoadedCertificate `json:"loadedCertificates,omitempty"` -} - -// MarshalJSON is the custom marshaler for AppResourceProperties. -func (arp AppResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arp.Public != nil { - objectMap["public"] = arp.Public - } - if arp.AddonConfigs != nil { - objectMap["addonConfigs"] = arp.AddonConfigs - } - if arp.Fqdn != nil { - objectMap["fqdn"] = arp.Fqdn - } - if arp.HTTPSOnly != nil { - objectMap["httpsOnly"] = arp.HTTPSOnly - } - if arp.TemporaryDisk != nil { - objectMap["temporaryDisk"] = arp.TemporaryDisk - } - if arp.PersistentDisk != nil { - objectMap["persistentDisk"] = arp.PersistentDisk - } - if arp.CustomPersistentDisks != nil { - objectMap["customPersistentDisks"] = arp.CustomPersistentDisks - } - if arp.EnableEndToEndTLS != nil { - objectMap["enableEndToEndTLS"] = arp.EnableEndToEndTLS - } - if arp.LoadedCertificates != nil { - objectMap["loadedCertificates"] = arp.LoadedCertificates - } - return json.Marshal(objectMap) -} - -// AppsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AppsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AppsClient) (AppResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AppsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AppsCreateOrUpdateFuture.Result. -func (future *AppsCreateOrUpdateFuture) result(client AppsClient) (ar AppResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.AppsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { - ar, err = client.CreateOrUpdateResponder(ar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsCreateOrUpdateFuture", "Result", ar.Response.Response, "Failure responding to request") - } - } - return -} - -// AppsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type AppsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AppsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AppsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AppsDeleteFuture.Result. -func (future *AppsDeleteFuture) result(client AppsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.AppsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AppsSetActiveDeploymentsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type AppsSetActiveDeploymentsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AppsClient) (AppResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AppsSetActiveDeploymentsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AppsSetActiveDeploymentsFuture.Result. -func (future *AppsSetActiveDeploymentsFuture) result(client AppsClient) (ar AppResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsSetActiveDeploymentsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.AppsSetActiveDeploymentsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { - ar, err = client.SetActiveDeploymentsResponder(ar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsSetActiveDeploymentsFuture", "Result", ar.Response.Response, "Failure responding to request") - } - } - return -} - -// AppsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type AppsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AppsClient) (AppResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AppsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AppsUpdateFuture.Result. -func (future *AppsUpdateFuture) result(client AppsClient) (ar AppResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.AppsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { - ar, err = client.UpdateResponder(ar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.AppsUpdateFuture", "Result", ar.Response.Response, "Failure responding to request") - } - } - return -} - -// AvailableOperations available operations of the service -type AvailableOperations struct { - autorest.Response `json:"-"` - // Value - Collection of available operation details - Value *[]OperationDetail `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// AvailableOperationsIterator provides access to a complete listing of OperationDetail values. -type AvailableOperationsIterator struct { - i int - page AvailableOperationsPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AvailableOperationsIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AvailableOperationsIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AvailableOperationsIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AvailableOperationsIterator) Response() AvailableOperations { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AvailableOperationsIterator) Value() OperationDetail { - if !iter.page.NotDone() { - return OperationDetail{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AvailableOperationsIterator type. -func NewAvailableOperationsIterator(page AvailableOperationsPage) AvailableOperationsIterator { - return AvailableOperationsIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ao AvailableOperations) IsEmpty() bool { - return ao.Value == nil || len(*ao.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ao AvailableOperations) hasNextLink() bool { - return ao.NextLink != nil && len(*ao.NextLink) != 0 -} - -// availableOperationsPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ao AvailableOperations) availableOperationsPreparer(ctx context.Context) (*http.Request, error) { - if !ao.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ao.NextLink))) -} - -// AvailableOperationsPage contains a page of OperationDetail values. -type AvailableOperationsPage struct { - fn func(context.Context, AvailableOperations) (AvailableOperations, error) - ao AvailableOperations -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AvailableOperationsPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ao) - if err != nil { - return err - } - page.ao = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AvailableOperationsPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AvailableOperationsPage) NotDone() bool { - return !page.ao.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AvailableOperationsPage) Response() AvailableOperations { - return page.ao -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AvailableOperationsPage) Values() []OperationDetail { - if page.ao.IsEmpty() { - return nil - } - return *page.ao.Value -} - -// Creates a new instance of the AvailableOperationsPage type. -func NewAvailableOperationsPage(cur AvailableOperations, getNextPage func(context.Context, AvailableOperations) (AvailableOperations, error)) AvailableOperationsPage { - return AvailableOperationsPage{ - fn: getNextPage, - ao: cur, - } -} - -// AvailableRuntimeVersions ... -type AvailableRuntimeVersions struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; A list of all supported runtime versions. - Value *[]SupportedRuntimeVersion `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for AvailableRuntimeVersions. -func (arv AvailableRuntimeVersions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AzureFileVolume the properties of the Azure File volume. Azure File shares are mounted as volumes. -type AzureFileVolume struct { - // ShareName - The share name of the Azure File share. - ShareName *string `json:"shareName,omitempty"` - // MountPath - The mount path of the persistent disk. - MountPath *string `json:"mountPath,omitempty"` - // ReadOnly - Indicates whether the persistent disk is a readOnly one. - ReadOnly *bool `json:"readOnly,omitempty"` - // MountOptions - These are the mount options for a persistent disk. - MountOptions *[]string `json:"mountOptions,omitempty"` - // Type - Possible values include: 'TypeCustomPersistentDiskProperties', 'TypeAzureFileVolume' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureFileVolume. -func (afv AzureFileVolume) MarshalJSON() ([]byte, error) { - afv.Type = TypeAzureFileVolume - objectMap := make(map[string]interface{}) - if afv.ShareName != nil { - objectMap["shareName"] = afv.ShareName - } - if afv.MountPath != nil { - objectMap["mountPath"] = afv.MountPath - } - if afv.ReadOnly != nil { - objectMap["readOnly"] = afv.ReadOnly - } - if afv.MountOptions != nil { - objectMap["mountOptions"] = afv.MountOptions - } - if afv.Type != "" { - objectMap["type"] = afv.Type - } - return json.Marshal(objectMap) -} - -// AsAzureFileVolume is the BasicCustomPersistentDiskProperties implementation for AzureFileVolume. -func (afv AzureFileVolume) AsAzureFileVolume() (*AzureFileVolume, bool) { - return &afv, true -} - -// AsCustomPersistentDiskProperties is the BasicCustomPersistentDiskProperties implementation for AzureFileVolume. -func (afv AzureFileVolume) AsCustomPersistentDiskProperties() (*CustomPersistentDiskProperties, bool) { - return nil, false -} - -// AsBasicCustomPersistentDiskProperties is the BasicCustomPersistentDiskProperties implementation for AzureFileVolume. -func (afv AzureFileVolume) AsBasicCustomPersistentDiskProperties() (BasicCustomPersistentDiskProperties, bool) { - return &afv, true -} - -// BindingResource binding resource payload -type BindingResource struct { - autorest.Response `json:"-"` - // Properties - Properties of the Binding resource - Properties *BindingResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for BindingResource. -func (br BindingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if br.Properties != nil { - objectMap["properties"] = br.Properties - } - if br.SystemData != nil { - objectMap["systemData"] = br.SystemData - } - return json.Marshal(objectMap) -} - -// BindingResourceCollection object that includes an array of Binding resources and a possible link for -// next set -type BindingResourceCollection struct { - autorest.Response `json:"-"` - // Value - Collection of Binding resources - Value *[]BindingResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// BindingResourceCollectionIterator provides access to a complete listing of BindingResource values. -type BindingResourceCollectionIterator struct { - i int - page BindingResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BindingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BindingResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BindingResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BindingResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BindingResourceCollectionIterator) Response() BindingResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BindingResourceCollectionIterator) Value() BindingResource { - if !iter.page.NotDone() { - return BindingResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BindingResourceCollectionIterator type. -func NewBindingResourceCollectionIterator(page BindingResourceCollectionPage) BindingResourceCollectionIterator { - return BindingResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (brc BindingResourceCollection) IsEmpty() bool { - return brc.Value == nil || len(*brc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (brc BindingResourceCollection) hasNextLink() bool { - return brc.NextLink != nil && len(*brc.NextLink) != 0 -} - -// bindingResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (brc BindingResourceCollection) bindingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !brc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(brc.NextLink))) -} - -// BindingResourceCollectionPage contains a page of BindingResource values. -type BindingResourceCollectionPage struct { - fn func(context.Context, BindingResourceCollection) (BindingResourceCollection, error) - brc BindingResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BindingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BindingResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.brc) - if err != nil { - return err - } - page.brc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BindingResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BindingResourceCollectionPage) NotDone() bool { - return !page.brc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BindingResourceCollectionPage) Response() BindingResourceCollection { - return page.brc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BindingResourceCollectionPage) Values() []BindingResource { - if page.brc.IsEmpty() { - return nil - } - return *page.brc.Value -} - -// Creates a new instance of the BindingResourceCollectionPage type. -func NewBindingResourceCollectionPage(cur BindingResourceCollection, getNextPage func(context.Context, BindingResourceCollection) (BindingResourceCollection, error)) BindingResourceCollectionPage { - return BindingResourceCollectionPage{ - fn: getNextPage, - brc: cur, - } -} - -// BindingResourceProperties binding resource properties payload -type BindingResourceProperties struct { - // ResourceName - READ-ONLY; The name of the bound resource - ResourceName *string `json:"resourceName,omitempty"` - // ResourceType - READ-ONLY; The standard Azure resource type of the bound resource - ResourceType *string `json:"resourceType,omitempty"` - // ResourceID - The Azure resource id of the bound resource - ResourceID *string `json:"resourceId,omitempty"` - // Key - The key of the bound resource - Key *string `json:"key,omitempty"` - // BindingParameters - Binding parameters of the Binding resource - BindingParameters map[string]interface{} `json:"bindingParameters"` - // GeneratedProperties - READ-ONLY; The generated Spring Boot property file for this binding. The secret will be deducted. - GeneratedProperties *string `json:"generatedProperties,omitempty"` - // CreatedAt - READ-ONLY; Creation time of the Binding resource - CreatedAt *string `json:"createdAt,omitempty"` - // UpdatedAt - READ-ONLY; Update time of the Binding resource - UpdatedAt *string `json:"updatedAt,omitempty"` -} - -// MarshalJSON is the custom marshaler for BindingResourceProperties. -func (brp BindingResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if brp.ResourceID != nil { - objectMap["resourceId"] = brp.ResourceID - } - if brp.Key != nil { - objectMap["key"] = brp.Key - } - if brp.BindingParameters != nil { - objectMap["bindingParameters"] = brp.BindingParameters - } - return json.Marshal(objectMap) -} - -// BindingsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BindingsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BindingsClient) (BindingResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BindingsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BindingsCreateOrUpdateFuture.Result. -func (future *BindingsCreateOrUpdateFuture) result(client BindingsClient) (br BindingResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.BindingsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - br.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.BindingsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if br.Response.Response, err = future.GetResult(sender); err == nil && br.Response.Response.StatusCode != http.StatusNoContent { - br, err = client.CreateOrUpdateResponder(br.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.BindingsCreateOrUpdateFuture", "Result", br.Response.Response, "Failure responding to request") - } - } - return -} - -// BindingsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BindingsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BindingsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BindingsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BindingsDeleteFuture.Result. -func (future *BindingsDeleteFuture) result(client BindingsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.BindingsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.BindingsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// BindingsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BindingsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BindingsClient) (BindingResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BindingsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BindingsUpdateFuture.Result. -func (future *BindingsUpdateFuture) result(client BindingsClient) (br BindingResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.BindingsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - br.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.BindingsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if br.Response.Response, err = future.GetResult(sender); err == nil && br.Response.Response.StatusCode != http.StatusNoContent { - br, err = client.UpdateResponder(br.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.BindingsUpdateFuture", "Result", br.Response.Response, "Failure responding to request") - } - } - return -} - -// Build build resource payload -type Build struct { - autorest.Response `json:"-"` - // Properties - Properties of the build resource - Properties *BuildProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Build. -func (b Build) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if b.Properties != nil { - objectMap["properties"] = b.Properties - } - if b.SystemData != nil { - objectMap["systemData"] = b.SystemData - } - return json.Marshal(objectMap) -} - -// BuildCollection object that includes an array of Build resources and a possible link for next set -type BuildCollection struct { - autorest.Response `json:"-"` - // Value - Collection of Build resources - Value *[]Build `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// BuildCollectionIterator provides access to a complete listing of Build values. -type BuildCollectionIterator struct { - i int - page BuildCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BuildCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BuildCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BuildCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BuildCollectionIterator) Response() BuildCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BuildCollectionIterator) Value() Build { - if !iter.page.NotDone() { - return Build{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BuildCollectionIterator type. -func NewBuildCollectionIterator(page BuildCollectionPage) BuildCollectionIterator { - return BuildCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bc BuildCollection) IsEmpty() bool { - return bc.Value == nil || len(*bc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bc BuildCollection) hasNextLink() bool { - return bc.NextLink != nil && len(*bc.NextLink) != 0 -} - -// buildCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bc BuildCollection) buildCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !bc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bc.NextLink))) -} - -// BuildCollectionPage contains a page of Build values. -type BuildCollectionPage struct { - fn func(context.Context, BuildCollection) (BuildCollection, error) - bc BuildCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BuildCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.bc) - if err != nil { - return err - } - page.bc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BuildCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BuildCollectionPage) NotDone() bool { - return !page.bc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BuildCollectionPage) Response() BuildCollection { - return page.bc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BuildCollectionPage) Values() []Build { - if page.bc.IsEmpty() { - return nil - } - return *page.bc.Value -} - -// Creates a new instance of the BuildCollectionPage type. -func NewBuildCollectionPage(cur BuildCollection, getNextPage func(context.Context, BuildCollection) (BuildCollection, error)) BuildCollectionPage { - return BuildCollectionPage{ - fn: getNextPage, - bc: cur, - } -} - -// BuilderProperties kPack Builder properties payload -type BuilderProperties struct { - // ProvisioningState - READ-ONLY; Builder provision status. Possible values include: 'BuilderProvisioningStateCreating', 'BuilderProvisioningStateUpdating', 'BuilderProvisioningStateSucceeded', 'BuilderProvisioningStateFailed', 'BuilderProvisioningStateDeleting' - ProvisioningState BuilderProvisioningState `json:"provisioningState,omitempty"` - // Stack - Builder cluster stack property. - Stack *StackProperties `json:"stack,omitempty"` - // BuildpackGroups - Builder buildpack groups. - BuildpackGroups *[]BuildpacksGroupProperties `json:"buildpackGroups,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuilderProperties. -func (bp BuilderProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bp.Stack != nil { - objectMap["stack"] = bp.Stack - } - if bp.BuildpackGroups != nil { - objectMap["buildpackGroups"] = bp.BuildpackGroups - } - return json.Marshal(objectMap) -} - -// BuilderResource kPack Builder resource -type BuilderResource struct { - autorest.Response `json:"-"` - // Properties - Property of the Builder resource. - Properties *BuilderProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuilderResource. -func (br BuilderResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if br.Properties != nil { - objectMap["properties"] = br.Properties - } - if br.SystemData != nil { - objectMap["systemData"] = br.SystemData - } - return json.Marshal(objectMap) -} - -// BuilderResourceCollection object that includes an array of Builder resources and a possible link for -// next set -type BuilderResourceCollection struct { - autorest.Response `json:"-"` - // Value - Collection of Builder resources - Value *[]BuilderResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// BuilderResourceCollectionIterator provides access to a complete listing of BuilderResource values. -type BuilderResourceCollectionIterator struct { - i int - page BuilderResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BuilderResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuilderResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BuilderResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BuilderResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BuilderResourceCollectionIterator) Response() BuilderResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BuilderResourceCollectionIterator) Value() BuilderResource { - if !iter.page.NotDone() { - return BuilderResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BuilderResourceCollectionIterator type. -func NewBuilderResourceCollectionIterator(page BuilderResourceCollectionPage) BuilderResourceCollectionIterator { - return BuilderResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (brc BuilderResourceCollection) IsEmpty() bool { - return brc.Value == nil || len(*brc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (brc BuilderResourceCollection) hasNextLink() bool { - return brc.NextLink != nil && len(*brc.NextLink) != 0 -} - -// builderResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (brc BuilderResourceCollection) builderResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !brc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(brc.NextLink))) -} - -// BuilderResourceCollectionPage contains a page of BuilderResource values. -type BuilderResourceCollectionPage struct { - fn func(context.Context, BuilderResourceCollection) (BuilderResourceCollection, error) - brc BuilderResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BuilderResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuilderResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.brc) - if err != nil { - return err - } - page.brc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BuilderResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BuilderResourceCollectionPage) NotDone() bool { - return !page.brc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BuilderResourceCollectionPage) Response() BuilderResourceCollection { - return page.brc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BuilderResourceCollectionPage) Values() []BuilderResource { - if page.brc.IsEmpty() { - return nil - } - return *page.brc.Value -} - -// Creates a new instance of the BuilderResourceCollectionPage type. -func NewBuilderResourceCollectionPage(cur BuilderResourceCollection, getNextPage func(context.Context, BuilderResourceCollection) (BuilderResourceCollection, error)) BuilderResourceCollectionPage { - return BuilderResourceCollectionPage{ - fn: getNextPage, - brc: cur, - } -} - -// BuildpackBindingCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type BuildpackBindingCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BuildpackBindingClient) (BuildpackBindingResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BuildpackBindingCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BuildpackBindingCreateOrUpdateFuture.Result. -func (future *BuildpackBindingCreateOrUpdateFuture) result(client BuildpackBindingClient) (bbr BuildpackBindingResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bbr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.BuildpackBindingCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bbr.Response.Response, err = future.GetResult(sender); err == nil && bbr.Response.Response.StatusCode != http.StatusNoContent { - bbr, err = client.CreateOrUpdateResponder(bbr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingCreateOrUpdateFuture", "Result", bbr.Response.Response, "Failure responding to request") - } - } - return -} - -// BuildpackBindingDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BuildpackBindingDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BuildpackBindingClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BuildpackBindingDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BuildpackBindingDeleteFuture.Result. -func (future *BuildpackBindingDeleteFuture) result(client BuildpackBindingClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.BuildpackBindingDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// BuildpackBindingLaunchProperties buildpack Binding Launch Properties -type BuildpackBindingLaunchProperties struct { - // Properties - Non-sensitive properties for launchProperties - Properties map[string]*string `json:"properties"` - // Secrets - Sensitive properties for launchProperties - Secrets map[string]*string `json:"secrets"` -} - -// MarshalJSON is the custom marshaler for BuildpackBindingLaunchProperties. -func (bblp BuildpackBindingLaunchProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bblp.Properties != nil { - objectMap["properties"] = bblp.Properties - } - if bblp.Secrets != nil { - objectMap["secrets"] = bblp.Secrets - } - return json.Marshal(objectMap) -} - -// BuildpackBindingProperties properties of a buildpack binding -type BuildpackBindingProperties struct { - // BindingType - Buildpack Binding Type. Possible values include: 'BindingTypeApplicationInsights', 'BindingTypeApacheSkyWalking', 'BindingTypeAppDynamics', 'BindingTypeDynatrace', 'BindingTypeNewRelic', 'BindingTypeElasticAPM' - BindingType BindingType `json:"bindingType,omitempty"` - // ProvisioningState - READ-ONLY; State of the Buildpack Binding. Possible values include: 'BuildpackBindingProvisioningStateCreating', 'BuildpackBindingProvisioningStateUpdating', 'BuildpackBindingProvisioningStateSucceeded', 'BuildpackBindingProvisioningStateFailed', 'BuildpackBindingProvisioningStateDeleting' - ProvisioningState BuildpackBindingProvisioningState `json:"provisioningState,omitempty"` - // LaunchProperties - The object describes the buildpack binding launch properties - LaunchProperties *BuildpackBindingLaunchProperties `json:"launchProperties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuildpackBindingProperties. -func (bbp BuildpackBindingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bbp.BindingType != "" { - objectMap["bindingType"] = bbp.BindingType - } - if bbp.LaunchProperties != nil { - objectMap["launchProperties"] = bbp.LaunchProperties - } - return json.Marshal(objectMap) -} - -// BuildpackBindingResource buildpack Binding Resource object -type BuildpackBindingResource struct { - autorest.Response `json:"-"` - // Properties - Properties of a buildpack binding - Properties *BuildpackBindingProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuildpackBindingResource. -func (bbr BuildpackBindingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bbr.Properties != nil { - objectMap["properties"] = bbr.Properties - } - if bbr.SystemData != nil { - objectMap["systemData"] = bbr.SystemData - } - return json.Marshal(objectMap) -} - -// BuildpackBindingResourceCollection object that includes an array of BuildpackBinding resources and a -// possible link for next set -type BuildpackBindingResourceCollection struct { - autorest.Response `json:"-"` - // Value - Collection of BuildpackBinding resources - Value *[]BuildpackBindingResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// BuildpackBindingResourceCollectionIterator provides access to a complete listing of -// BuildpackBindingResource values. -type BuildpackBindingResourceCollectionIterator struct { - i int - page BuildpackBindingResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BuildpackBindingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BuildpackBindingResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BuildpackBindingResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BuildpackBindingResourceCollectionIterator) Response() BuildpackBindingResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BuildpackBindingResourceCollectionIterator) Value() BuildpackBindingResource { - if !iter.page.NotDone() { - return BuildpackBindingResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BuildpackBindingResourceCollectionIterator type. -func NewBuildpackBindingResourceCollectionIterator(page BuildpackBindingResourceCollectionPage) BuildpackBindingResourceCollectionIterator { - return BuildpackBindingResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bbrc BuildpackBindingResourceCollection) IsEmpty() bool { - return bbrc.Value == nil || len(*bbrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bbrc BuildpackBindingResourceCollection) hasNextLink() bool { - return bbrc.NextLink != nil && len(*bbrc.NextLink) != 0 -} - -// buildpackBindingResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bbrc BuildpackBindingResourceCollection) buildpackBindingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !bbrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bbrc.NextLink))) -} - -// BuildpackBindingResourceCollectionPage contains a page of BuildpackBindingResource values. -type BuildpackBindingResourceCollectionPage struct { - fn func(context.Context, BuildpackBindingResourceCollection) (BuildpackBindingResourceCollection, error) - bbrc BuildpackBindingResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BuildpackBindingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.bbrc) - if err != nil { - return err - } - page.bbrc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BuildpackBindingResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BuildpackBindingResourceCollectionPage) NotDone() bool { - return !page.bbrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BuildpackBindingResourceCollectionPage) Response() BuildpackBindingResourceCollection { - return page.bbrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BuildpackBindingResourceCollectionPage) Values() []BuildpackBindingResource { - if page.bbrc.IsEmpty() { - return nil - } - return *page.bbrc.Value -} - -// Creates a new instance of the BuildpackBindingResourceCollectionPage type. -func NewBuildpackBindingResourceCollectionPage(cur BuildpackBindingResourceCollection, getNextPage func(context.Context, BuildpackBindingResourceCollection) (BuildpackBindingResourceCollection, error)) BuildpackBindingResourceCollectionPage { - return BuildpackBindingResourceCollectionPage{ - fn: getNextPage, - bbrc: cur, - } -} - -// BuildpackProperties buildpack properties payload -type BuildpackProperties struct { - // ID - Id of the buildpack - ID *string `json:"id,omitempty"` -} - -// BuildpacksGroupProperties buildpack group properties of the Builder -type BuildpacksGroupProperties struct { - // Name - Buildpack group name - Name *string `json:"name,omitempty"` - // Buildpacks - Buildpacks in the buildpack group - Buildpacks *[]BuildpackProperties `json:"buildpacks,omitempty"` -} - -// BuildProperties build resource properties payload -type BuildProperties struct { - // RelativePath - The relative path of source code - RelativePath *string `json:"relativePath,omitempty"` - // Builder - The resource id of builder to build the source code - Builder *string `json:"builder,omitempty"` - // AgentPool - The resource id of agent pool - AgentPool *string `json:"agentPool,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the KPack build result. Possible values include: 'BuildProvisioningStateCreating', 'BuildProvisioningStateUpdating', 'BuildProvisioningStateSucceeded', 'BuildProvisioningStateFailed', 'BuildProvisioningStateDeleting' - ProvisioningState BuildProvisioningState `json:"provisioningState,omitempty"` - // Env - The environment variables for this build - Env map[string]*string `json:"env"` - // TriggeredBuildResult - The build result triggered by this build - TriggeredBuildResult *TriggeredBuildResult `json:"triggeredBuildResult,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuildProperties. -func (bp BuildProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bp.RelativePath != nil { - objectMap["relativePath"] = bp.RelativePath - } - if bp.Builder != nil { - objectMap["builder"] = bp.Builder - } - if bp.AgentPool != nil { - objectMap["agentPool"] = bp.AgentPool - } - if bp.Env != nil { - objectMap["env"] = bp.Env - } - if bp.TriggeredBuildResult != nil { - objectMap["triggeredBuildResult"] = bp.TriggeredBuildResult - } - return json.Marshal(objectMap) -} - -// BuildResult build result resource payload -type BuildResult struct { - autorest.Response `json:"-"` - // Properties - Properties of the build result resource - Properties *BuildResultProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuildResult. -func (br BuildResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if br.Properties != nil { - objectMap["properties"] = br.Properties - } - if br.SystemData != nil { - objectMap["systemData"] = br.SystemData - } - return json.Marshal(objectMap) -} - -// BuildResultCollection object that includes an array of Build result resources and a possible link for -// next set -type BuildResultCollection struct { - autorest.Response `json:"-"` - // Value - Collection of Build result resources - Value *[]BuildResult `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// BuildResultCollectionIterator provides access to a complete listing of BuildResult values. -type BuildResultCollectionIterator struct { - i int - page BuildResultCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BuildResultCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildResultCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BuildResultCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BuildResultCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BuildResultCollectionIterator) Response() BuildResultCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BuildResultCollectionIterator) Value() BuildResult { - if !iter.page.NotDone() { - return BuildResult{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BuildResultCollectionIterator type. -func NewBuildResultCollectionIterator(page BuildResultCollectionPage) BuildResultCollectionIterator { - return BuildResultCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (brc BuildResultCollection) IsEmpty() bool { - return brc.Value == nil || len(*brc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (brc BuildResultCollection) hasNextLink() bool { - return brc.NextLink != nil && len(*brc.NextLink) != 0 -} - -// buildResultCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (brc BuildResultCollection) buildResultCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !brc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(brc.NextLink))) -} - -// BuildResultCollectionPage contains a page of BuildResult values. -type BuildResultCollectionPage struct { - fn func(context.Context, BuildResultCollection) (BuildResultCollection, error) - brc BuildResultCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BuildResultCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildResultCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.brc) - if err != nil { - return err - } - page.brc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BuildResultCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BuildResultCollectionPage) NotDone() bool { - return !page.brc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BuildResultCollectionPage) Response() BuildResultCollection { - return page.brc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BuildResultCollectionPage) Values() []BuildResult { - if page.brc.IsEmpty() { - return nil - } - return *page.brc.Value -} - -// Creates a new instance of the BuildResultCollectionPage type. -func NewBuildResultCollectionPage(cur BuildResultCollection, getNextPage func(context.Context, BuildResultCollection) (BuildResultCollection, error)) BuildResultCollectionPage { - return BuildResultCollectionPage{ - fn: getNextPage, - brc: cur, - } -} - -// BuildResultLog build result log resource properties payload -type BuildResultLog struct { - autorest.Response `json:"-"` - // BlobURL - The public download URL of this build result log - BlobURL *string `json:"blobUrl,omitempty"` -} - -// BuildResultProperties build result resource properties payload -type BuildResultProperties struct { - // Name - The name of this build result - Name *string `json:"name,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the KPack build result. Possible values include: 'BuildResultProvisioningStateQueuing', 'BuildResultProvisioningStateBuilding', 'BuildResultProvisioningStateSucceeded', 'BuildResultProvisioningStateFailed', 'BuildResultProvisioningStateDeleting' - ProvisioningState BuildResultProvisioningState `json:"provisioningState,omitempty"` - // BuildPodName - The build pod name which can be used to get the build log streaming. - BuildPodName *string `json:"buildPodName,omitempty"` - // BuildStages - READ-ONLY; All of the build stage (init-container and container) resources in build pod. - BuildStages *[]BuildStageProperties `json:"buildStages,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuildResultProperties. -func (brp BuildResultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if brp.Name != nil { - objectMap["name"] = brp.Name - } - if brp.BuildPodName != nil { - objectMap["buildPodName"] = brp.BuildPodName - } - return json.Marshal(objectMap) -} - -// BuildResultUserSourceInfo reference to a build result -type BuildResultUserSourceInfo struct { - // BuildResultID - Resource id of an existing succeeded build result under the same Spring instance. - BuildResultID *string `json:"buildResultId,omitempty"` - // Version - Version of the source - Version *string `json:"version,omitempty"` - // Type - Possible values include: 'TypeBasicUserSourceInfoTypeUserSourceInfo', 'TypeBasicUserSourceInfoTypeUploadedUserSourceInfo', 'TypeBasicUserSourceInfoTypeJar', 'TypeBasicUserSourceInfoTypeSource', 'TypeBasicUserSourceInfoTypeNetCoreZip', 'TypeBasicUserSourceInfoTypeBuildResult', 'TypeBasicUserSourceInfoTypeContainer' - Type TypeBasicUserSourceInfo `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuildResultUserSourceInfo. -func (brusi BuildResultUserSourceInfo) MarshalJSON() ([]byte, error) { - brusi.Type = TypeBasicUserSourceInfoTypeBuildResult - objectMap := make(map[string]interface{}) - if brusi.BuildResultID != nil { - objectMap["buildResultId"] = brusi.BuildResultID - } - if brusi.Version != nil { - objectMap["version"] = brusi.Version - } - if brusi.Type != "" { - objectMap["type"] = brusi.Type - } - return json.Marshal(objectMap) -} - -// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. -func (brusi BuildResultUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { - return nil, false -} - -// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. -func (brusi BuildResultUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. -func (brusi BuildResultUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. -func (brusi BuildResultUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. -func (brusi BuildResultUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. -func (brusi BuildResultUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { - return &brusi, true -} - -// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. -func (brusi BuildResultUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { - return nil, false -} - -// AsUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. -func (brusi BuildResultUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { - return nil, false -} - -// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. -func (brusi BuildResultUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { - return &brusi, true -} - -// BuildService build service resource payload -type BuildService struct { - autorest.Response `json:"-"` - // Properties - Properties of the build resource - Properties *BuildServiceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuildService. -func (bs BuildService) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bs.Properties != nil { - objectMap["properties"] = bs.Properties - } - if bs.SystemData != nil { - objectMap["systemData"] = bs.SystemData - } - return json.Marshal(objectMap) -} - -// BuildServiceAgentPoolProperties build service agent pool properties -type BuildServiceAgentPoolProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the build service agent pool - ProvisioningState *string `json:"provisioningState,omitempty"` - // PoolSize - build service agent pool size properties - PoolSize *BuildServiceAgentPoolSizeProperties `json:"poolSize,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuildServiceAgentPoolProperties. -func (bsapp BuildServiceAgentPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bsapp.PoolSize != nil { - objectMap["poolSize"] = bsapp.PoolSize - } - return json.Marshal(objectMap) -} - -// BuildServiceAgentPoolResource the build service agent pool resource -type BuildServiceAgentPoolResource struct { - autorest.Response `json:"-"` - // Properties - build service agent pool properties - Properties *BuildServiceAgentPoolProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuildServiceAgentPoolResource. -func (bsapr BuildServiceAgentPoolResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bsapr.Properties != nil { - objectMap["properties"] = bsapr.Properties - } - if bsapr.SystemData != nil { - objectMap["systemData"] = bsapr.SystemData - } - return json.Marshal(objectMap) -} - -// BuildServiceAgentPoolResourceCollection object that includes an array of build service agent pool -// resources and a possible link for next set -type BuildServiceAgentPoolResourceCollection struct { - autorest.Response `json:"-"` - // Value - Collection of build service agent pool resource - Value *[]BuildServiceAgentPoolResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// BuildServiceAgentPoolResourceCollectionIterator provides access to a complete listing of -// BuildServiceAgentPoolResource values. -type BuildServiceAgentPoolResourceCollectionIterator struct { - i int - page BuildServiceAgentPoolResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BuildServiceAgentPoolResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BuildServiceAgentPoolResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BuildServiceAgentPoolResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BuildServiceAgentPoolResourceCollectionIterator) Response() BuildServiceAgentPoolResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BuildServiceAgentPoolResourceCollectionIterator) Value() BuildServiceAgentPoolResource { - if !iter.page.NotDone() { - return BuildServiceAgentPoolResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BuildServiceAgentPoolResourceCollectionIterator type. -func NewBuildServiceAgentPoolResourceCollectionIterator(page BuildServiceAgentPoolResourceCollectionPage) BuildServiceAgentPoolResourceCollectionIterator { - return BuildServiceAgentPoolResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bsaprc BuildServiceAgentPoolResourceCollection) IsEmpty() bool { - return bsaprc.Value == nil || len(*bsaprc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bsaprc BuildServiceAgentPoolResourceCollection) hasNextLink() bool { - return bsaprc.NextLink != nil && len(*bsaprc.NextLink) != 0 -} - -// buildServiceAgentPoolResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bsaprc BuildServiceAgentPoolResourceCollection) buildServiceAgentPoolResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !bsaprc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bsaprc.NextLink))) -} - -// BuildServiceAgentPoolResourceCollectionPage contains a page of BuildServiceAgentPoolResource values. -type BuildServiceAgentPoolResourceCollectionPage struct { - fn func(context.Context, BuildServiceAgentPoolResourceCollection) (BuildServiceAgentPoolResourceCollection, error) - bsaprc BuildServiceAgentPoolResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BuildServiceAgentPoolResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.bsaprc) - if err != nil { - return err - } - page.bsaprc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BuildServiceAgentPoolResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BuildServiceAgentPoolResourceCollectionPage) NotDone() bool { - return !page.bsaprc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BuildServiceAgentPoolResourceCollectionPage) Response() BuildServiceAgentPoolResourceCollection { - return page.bsaprc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BuildServiceAgentPoolResourceCollectionPage) Values() []BuildServiceAgentPoolResource { - if page.bsaprc.IsEmpty() { - return nil - } - return *page.bsaprc.Value -} - -// Creates a new instance of the BuildServiceAgentPoolResourceCollectionPage type. -func NewBuildServiceAgentPoolResourceCollectionPage(cur BuildServiceAgentPoolResourceCollection, getNextPage func(context.Context, BuildServiceAgentPoolResourceCollection) (BuildServiceAgentPoolResourceCollection, error)) BuildServiceAgentPoolResourceCollectionPage { - return BuildServiceAgentPoolResourceCollectionPage{ - fn: getNextPage, - bsaprc: cur, - } -} - -// BuildServiceAgentPoolSizeProperties build service agent pool size properties -type BuildServiceAgentPoolSizeProperties struct { - // Name - The name of build service agent pool size - Name *string `json:"name,omitempty"` - // CPU - READ-ONLY; The cpu property of build service agent pool size - CPU *string `json:"cpu,omitempty"` - // Memory - READ-ONLY; The memory property of build service agent pool size - Memory *string `json:"memory,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuildServiceAgentPoolSizeProperties. -func (bsapsp BuildServiceAgentPoolSizeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bsapsp.Name != nil { - objectMap["name"] = bsapsp.Name - } - return json.Marshal(objectMap) -} - -// BuildServiceAgentPoolUpdatePutFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type BuildServiceAgentPoolUpdatePutFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BuildServiceAgentPoolClient) (BuildServiceAgentPoolResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BuildServiceAgentPoolUpdatePutFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BuildServiceAgentPoolUpdatePutFuture.Result. -func (future *BuildServiceAgentPoolUpdatePutFuture) result(client BuildServiceAgentPoolClient) (bsapr BuildServiceAgentPoolResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolUpdatePutFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bsapr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.BuildServiceAgentPoolUpdatePutFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bsapr.Response.Response, err = future.GetResult(sender); err == nil && bsapr.Response.Response.StatusCode != http.StatusNoContent { - bsapr, err = client.UpdatePutResponder(bsapr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolUpdatePutFuture", "Result", bsapr.Response.Response, "Failure responding to request") - } - } - return -} - -// BuildServiceBuilderCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type BuildServiceBuilderCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BuildServiceBuilderClient) (BuilderResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BuildServiceBuilderCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BuildServiceBuilderCreateOrUpdateFuture.Result. -func (future *BuildServiceBuilderCreateOrUpdateFuture) result(client BuildServiceBuilderClient) (br BuilderResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - br.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.BuildServiceBuilderCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if br.Response.Response, err = future.GetResult(sender); err == nil && br.Response.Response.StatusCode != http.StatusNoContent { - br, err = client.CreateOrUpdateResponder(br.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderCreateOrUpdateFuture", "Result", br.Response.Response, "Failure responding to request") - } - } - return -} - -// BuildServiceBuilderDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type BuildServiceBuilderDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BuildServiceBuilderClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BuildServiceBuilderDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BuildServiceBuilderDeleteFuture.Result. -func (future *BuildServiceBuilderDeleteFuture) result(client BuildServiceBuilderClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.BuildServiceBuilderDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// BuildServiceCollection object that includes an array of Build service resources and a possible link for -// next set -type BuildServiceCollection struct { - autorest.Response `json:"-"` - // Value - Collection of Build service resources - Value *[]BuildService `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// BuildServiceCollectionIterator provides access to a complete listing of BuildService values. -type BuildServiceCollectionIterator struct { - i int - page BuildServiceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BuildServiceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BuildServiceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BuildServiceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BuildServiceCollectionIterator) Response() BuildServiceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BuildServiceCollectionIterator) Value() BuildService { - if !iter.page.NotDone() { - return BuildService{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BuildServiceCollectionIterator type. -func NewBuildServiceCollectionIterator(page BuildServiceCollectionPage) BuildServiceCollectionIterator { - return BuildServiceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bsc BuildServiceCollection) IsEmpty() bool { - return bsc.Value == nil || len(*bsc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bsc BuildServiceCollection) hasNextLink() bool { - return bsc.NextLink != nil && len(*bsc.NextLink) != 0 -} - -// buildServiceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bsc BuildServiceCollection) buildServiceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !bsc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bsc.NextLink))) -} - -// BuildServiceCollectionPage contains a page of BuildService values. -type BuildServiceCollectionPage struct { - fn func(context.Context, BuildServiceCollection) (BuildServiceCollection, error) - bsc BuildServiceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BuildServiceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.bsc) - if err != nil { - return err - } - page.bsc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BuildServiceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BuildServiceCollectionPage) NotDone() bool { - return !page.bsc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BuildServiceCollectionPage) Response() BuildServiceCollection { - return page.bsc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BuildServiceCollectionPage) Values() []BuildService { - if page.bsc.IsEmpty() { - return nil - } - return *page.bsc.Value -} - -// Creates a new instance of the BuildServiceCollectionPage type. -func NewBuildServiceCollectionPage(cur BuildServiceCollection, getNextPage func(context.Context, BuildServiceCollection) (BuildServiceCollection, error)) BuildServiceCollectionPage { - return BuildServiceCollectionPage{ - fn: getNextPage, - bsc: cur, - } -} - -// BuildServiceProperties build service resource properties payload -type BuildServiceProperties struct { - // KPackVersion - The installed KPack version in this build service. - KPackVersion *string `json:"kPackVersion,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the KPack build result. Possible values include: 'BuildServiceProvisioningStateCreating', 'BuildServiceProvisioningStateUpdating', 'BuildServiceProvisioningStateSucceeded', 'BuildServiceProvisioningStateFailed', 'BuildServiceProvisioningStateDeleting' - ProvisioningState BuildServiceProvisioningState `json:"provisioningState,omitempty"` - // ResourceRequests - The runtime resource configuration of this build service. - ResourceRequests *BuildServicePropertiesResourceRequests `json:"resourceRequests,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuildServiceProperties. -func (bsp BuildServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bsp.KPackVersion != nil { - objectMap["kPackVersion"] = bsp.KPackVersion - } - if bsp.ResourceRequests != nil { - objectMap["resourceRequests"] = bsp.ResourceRequests - } - return json.Marshal(objectMap) -} - -// BuildServicePropertiesResourceRequests the runtime resource configuration of this build service. -type BuildServicePropertiesResourceRequests struct { - // CPU - READ-ONLY; vCPU allocated to the entire build service node pool. - CPU *string `json:"cpu,omitempty"` - // Memory - READ-ONLY; Memory allocated to the entire build service node pool. - Memory *string `json:"memory,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuildServicePropertiesResourceRequests. -func (bspR BuildServicePropertiesResourceRequests) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BuildStageProperties the build stage (init-container and container) resources in build pod. -type BuildStageProperties struct { - // Name - READ-ONLY; The name of this build stage resource. - Name *string `json:"name,omitempty"` - // Status - READ-ONLY; The provisioning state of this build stage resource. Possible values include: 'KPackBuildStageProvisioningStateNotStarted', 'KPackBuildStageProvisioningStateRunning', 'KPackBuildStageProvisioningStateSucceeded', 'KPackBuildStageProvisioningStateFailed' - Status KPackBuildStageProvisioningState `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for BuildStageProperties. -func (bsp BuildStageProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BasicCertificateProperties certificate resource payload. -type BasicCertificateProperties interface { - AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) - AsContentCertificateProperties() (*ContentCertificateProperties, bool) - AsCertificateProperties() (*CertificateProperties, bool) -} - -// CertificateProperties certificate resource payload. -type CertificateProperties struct { - // Thumbprint - READ-ONLY; The thumbprint of certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // Issuer - READ-ONLY; The issuer of certificate. - Issuer *string `json:"issuer,omitempty"` - // IssuedDate - READ-ONLY; The issue date of certificate. - IssuedDate *string `json:"issuedDate,omitempty"` - // ExpirationDate - READ-ONLY; The expiration date of certificate. - ExpirationDate *string `json:"expirationDate,omitempty"` - // ActivateDate - READ-ONLY; The activate date of certificate. - ActivateDate *string `json:"activateDate,omitempty"` - // SubjectName - READ-ONLY; The subject name of certificate. - SubjectName *string `json:"subjectName,omitempty"` - // DNSNames - READ-ONLY; The domain list of certificate. - DNSNames *[]string `json:"dnsNames,omitempty"` - // Type - Possible values include: 'TypeBasicCertificatePropertiesTypeCertificateProperties', 'TypeBasicCertificatePropertiesTypeKeyVaultCertificate', 'TypeBasicCertificatePropertiesTypeContentCertificate' - Type TypeBasicCertificateProperties `json:"type,omitempty"` -} - -func unmarshalBasicCertificateProperties(body []byte) (BasicCertificateProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBasicCertificatePropertiesTypeKeyVaultCertificate): - var kvcp KeyVaultCertificateProperties - err := json.Unmarshal(body, &kvcp) - return kvcp, err - case string(TypeBasicCertificatePropertiesTypeContentCertificate): - var ccp ContentCertificateProperties - err := json.Unmarshal(body, &ccp) - return ccp, err - default: - var cp CertificateProperties - err := json.Unmarshal(body, &cp) - return cp, err - } -} -func unmarshalBasicCertificatePropertiesArray(body []byte) ([]BasicCertificateProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - cpArray := make([]BasicCertificateProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - cp, err := unmarshalBasicCertificateProperties(*rawMessage) - if err != nil { - return nil, err - } - cpArray[index] = cp - } - return cpArray, nil -} - -// MarshalJSON is the custom marshaler for CertificateProperties. -func (cp CertificateProperties) MarshalJSON() ([]byte, error) { - cp.Type = TypeBasicCertificatePropertiesTypeCertificateProperties - objectMap := make(map[string]interface{}) - if cp.Type != "" { - objectMap["type"] = cp.Type - } - return json.Marshal(objectMap) -} - -// AsKeyVaultCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. -func (cp CertificateProperties) AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) { - return nil, false -} - -// AsContentCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. -func (cp CertificateProperties) AsContentCertificateProperties() (*ContentCertificateProperties, bool) { - return nil, false -} - -// AsCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. -func (cp CertificateProperties) AsCertificateProperties() (*CertificateProperties, bool) { - return &cp, true -} - -// AsBasicCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. -func (cp CertificateProperties) AsBasicCertificateProperties() (BasicCertificateProperties, bool) { - return &cp, true -} - -// CertificateResource certificate resource payload. -type CertificateResource struct { - autorest.Response `json:"-"` - // Properties - Properties of the certificate resource payload. - Properties BasicCertificateProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for CertificateResource. -func (cr CertificateResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = cr.Properties - if cr.SystemData != nil { - objectMap["systemData"] = cr.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CertificateResource struct. -func (cr *CertificateResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - properties, err := unmarshalBasicCertificateProperties(*v) - if err != nil { - return err - } - cr.Properties = properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cr.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - cr.SystemData = &systemData - } - } - } - - return nil -} - -// CertificateResourceCollection collection compose of certificate resources list and a possible link for -// next page. -type CertificateResourceCollection struct { - autorest.Response `json:"-"` - // Value - The certificate resources list. - Value *[]CertificateResource `json:"value,omitempty"` - // NextLink - The link to next page of certificate list. - NextLink *string `json:"nextLink,omitempty"` -} - -// CertificateResourceCollectionIterator provides access to a complete listing of CertificateResource -// values. -type CertificateResourceCollectionIterator struct { - i int - page CertificateResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *CertificateResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *CertificateResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CertificateResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter CertificateResourceCollectionIterator) Response() CertificateResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter CertificateResourceCollectionIterator) Value() CertificateResource { - if !iter.page.NotDone() { - return CertificateResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CertificateResourceCollectionIterator type. -func NewCertificateResourceCollectionIterator(page CertificateResourceCollectionPage) CertificateResourceCollectionIterator { - return CertificateResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (crc CertificateResourceCollection) IsEmpty() bool { - return crc.Value == nil || len(*crc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (crc CertificateResourceCollection) hasNextLink() bool { - return crc.NextLink != nil && len(*crc.NextLink) != 0 -} - -// certificateResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (crc CertificateResourceCollection) certificateResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !crc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(crc.NextLink))) -} - -// CertificateResourceCollectionPage contains a page of CertificateResource values. -type CertificateResourceCollectionPage struct { - fn func(context.Context, CertificateResourceCollection) (CertificateResourceCollection, error) - crc CertificateResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *CertificateResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CertificateResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.crc) - if err != nil { - return err - } - page.crc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *CertificateResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CertificateResourceCollectionPage) NotDone() bool { - return !page.crc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CertificateResourceCollectionPage) Response() CertificateResourceCollection { - return page.crc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CertificateResourceCollectionPage) Values() []CertificateResource { - if page.crc.IsEmpty() { - return nil - } - return *page.crc.Value -} - -// Creates a new instance of the CertificateResourceCollectionPage type. -func NewCertificateResourceCollectionPage(cur CertificateResourceCollection, getNextPage func(context.Context, CertificateResourceCollection) (CertificateResourceCollection, error)) CertificateResourceCollectionPage { - return CertificateResourceCollectionPage{ - fn: getNextPage, - crc: cur, - } -} - -// CertificatesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type CertificatesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CertificatesClient) (CertificateResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CertificatesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CertificatesCreateOrUpdateFuture.Result. -func (future *CertificatesCreateOrUpdateFuture) result(client CertificatesClient) (cr CertificateResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.CertificatesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.CertificatesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { - cr, err = client.CreateOrUpdateResponder(cr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.CertificatesCreateOrUpdateFuture", "Result", cr.Response.Response, "Failure responding to request") - } - } - return -} - -// CertificatesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type CertificatesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CertificatesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CertificatesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CertificatesDeleteFuture.Result. -func (future *CertificatesDeleteFuture) result(client CertificatesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.CertificatesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.CertificatesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// CloudError an error response from the service. -type CloudError struct { - // Error - An error response from the service. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from the service. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// ClusterResourceProperties service properties payload -type ClusterResourceProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the Service. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateStarting', 'ProvisioningStateStopping', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving', 'ProvisioningStateMoved', 'ProvisioningStateMoveFailed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // NetworkProfile - Network profile of the Service - NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` - // Version - READ-ONLY; Version of the Service - Version *int32 `json:"version,omitempty"` - // ServiceID - READ-ONLY; ServiceInstanceEntity GUID which uniquely identifies a created resource - ServiceID *string `json:"serviceId,omitempty"` - // PowerState - READ-ONLY; Power state of the Service. Possible values include: 'PowerStateRunning', 'PowerStateStopped' - PowerState PowerState `json:"powerState,omitempty"` - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // Fqdn - READ-ONLY; Fully qualified dns name of the service instance - Fqdn *string `json:"fqdn,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterResourceProperties. -func (crp ClusterResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if crp.NetworkProfile != nil { - objectMap["networkProfile"] = crp.NetworkProfile - } - if crp.ZoneRedundant != nil { - objectMap["zoneRedundant"] = crp.ZoneRedundant - } - return json.Marshal(objectMap) -} - -// ConfigServerGitProperty property of git. -type ConfigServerGitProperty struct { - // Repositories - Repositories of git. - Repositories *[]GitPatternRepository `json:"repositories,omitempty"` - // URI - URI of the repository - URI *string `json:"uri,omitempty"` - // Label - Label of the repository - Label *string `json:"label,omitempty"` - // SearchPaths - Searching path of the repository - SearchPaths *[]string `json:"searchPaths,omitempty"` - // Username - Username of git repository basic auth. - Username *string `json:"username,omitempty"` - // Password - Password of git repository basic auth. - Password *string `json:"password,omitempty"` - // HostKey - Public sshKey of git repository. - HostKey *string `json:"hostKey,omitempty"` - // HostKeyAlgorithm - SshKey algorithm of git repository. - HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` - // PrivateKey - Private sshKey algorithm of git repository. - PrivateKey *string `json:"privateKey,omitempty"` - // StrictHostKeyChecking - Strict host key checking or not. - StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` -} - -// ConfigServerProperties config server git properties payload -type ConfigServerProperties struct { - // ProvisioningState - READ-ONLY; State of the config server. Possible values include: 'ConfigServerStateNotAvailable', 'ConfigServerStateDeleted', 'ConfigServerStateFailed', 'ConfigServerStateSucceeded', 'ConfigServerStateUpdating' - ProvisioningState ConfigServerState `json:"provisioningState,omitempty"` - // Error - Error when apply config server settings. - Error *Error `json:"error,omitempty"` - // ConfigServer - Settings of config server. - ConfigServer *ConfigServerSettings `json:"configServer,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigServerProperties. -func (csp ConfigServerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if csp.Error != nil { - objectMap["error"] = csp.Error - } - if csp.ConfigServer != nil { - objectMap["configServer"] = csp.ConfigServer - } - return json.Marshal(objectMap) -} - -// ConfigServerResource config Server resource -type ConfigServerResource struct { - autorest.Response `json:"-"` - // Properties - Properties of the Config Server resource - Properties *ConfigServerProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigServerResource. -func (csr ConfigServerResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if csr.Properties != nil { - objectMap["properties"] = csr.Properties - } - if csr.SystemData != nil { - objectMap["systemData"] = csr.SystemData - } - return json.Marshal(objectMap) -} - -// ConfigServerSettings the settings of config server. -type ConfigServerSettings struct { - // GitProperty - Property of git environment. - GitProperty *ConfigServerGitProperty `json:"gitProperty,omitempty"` -} - -// ConfigServerSettingsErrorRecord error record of the config server settings -type ConfigServerSettingsErrorRecord struct { - // Name - The name of the config server settings error record - Name *string `json:"name,omitempty"` - // URI - The uri of the config server settings error record - URI *string `json:"uri,omitempty"` - // Messages - The detail error messages of the record - Messages *[]string `json:"messages,omitempty"` -} - -// ConfigServerSettingsValidateResult validation result for config server settings -type ConfigServerSettingsValidateResult struct { - autorest.Response `json:"-"` - // IsValid - Indicate if the config server settings are valid - IsValid *bool `json:"isValid,omitempty"` - // Details - The detail validation results - Details *[]ConfigServerSettingsErrorRecord `json:"details,omitempty"` -} - -// ConfigServersUpdatePatchFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConfigServersUpdatePatchFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConfigServersClient) (ConfigServerResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConfigServersUpdatePatchFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConfigServersUpdatePatchFuture.Result. -func (future *ConfigServersUpdatePatchFuture) result(client ConfigServersClient) (csr ConfigServerResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePatchFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - csr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.ConfigServersUpdatePatchFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if csr.Response.Response, err = future.GetResult(sender); err == nil && csr.Response.Response.StatusCode != http.StatusNoContent { - csr, err = client.UpdatePatchResponder(csr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePatchFuture", "Result", csr.Response.Response, "Failure responding to request") - } - } - return -} - -// ConfigServersUpdatePutFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ConfigServersUpdatePutFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConfigServersClient) (ConfigServerResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConfigServersUpdatePutFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConfigServersUpdatePutFuture.Result. -func (future *ConfigServersUpdatePutFuture) result(client ConfigServersClient) (csr ConfigServerResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePutFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - csr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.ConfigServersUpdatePutFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if csr.Response.Response, err = future.GetResult(sender); err == nil && csr.Response.Response.StatusCode != http.StatusNoContent { - csr, err = client.UpdatePutResponder(csr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePutFuture", "Result", csr.Response.Response, "Failure responding to request") - } - } - return -} - -// ConfigServersValidateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ConfigServersValidateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConfigServersClient) (ConfigServerSettingsValidateResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConfigServersValidateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConfigServersValidateFuture.Result. -func (future *ConfigServersValidateFuture) result(client ConfigServersClient) (cssvr ConfigServerSettingsValidateResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ConfigServersValidateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cssvr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.ConfigServersValidateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cssvr.Response.Response, err = future.GetResult(sender); err == nil && cssvr.Response.Response.StatusCode != http.StatusNoContent { - cssvr, err = client.ValidateResponder(cssvr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ConfigServersValidateFuture", "Result", cssvr.Response.Response, "Failure responding to request") - } - } - return -} - -// ConfigurationServiceGitProperty property of git environment. -type ConfigurationServiceGitProperty struct { - Repositories *[]ConfigurationServiceGitRepository `json:"repositories,omitempty"` -} - -// ConfigurationServiceGitPropertyValidateResult validation result for configuration service settings -type ConfigurationServiceGitPropertyValidateResult struct { - // IsValid - Indicate if the configuration service settings are valid - IsValid *bool `json:"isValid,omitempty"` - // GitReposValidationResult - The detail validation results - GitReposValidationResult *[]ValidationMessages `json:"gitReposValidationResult,omitempty"` -} - -// ConfigurationServiceGitRepository git repository property payload for Application Configuration Service -type ConfigurationServiceGitRepository struct { - // Name - Name of the repository - Name *string `json:"name,omitempty"` - // Patterns - Collection of patterns of the repository - Patterns *[]string `json:"patterns,omitempty"` - // URI - URI of the repository - URI *string `json:"uri,omitempty"` - // Label - Label of the repository - Label *string `json:"label,omitempty"` - // SearchPaths - Searching path of the repository - SearchPaths *[]string `json:"searchPaths,omitempty"` - // Username - Username of git repository basic auth. - Username *string `json:"username,omitempty"` - // Password - Password of git repository basic auth. - Password *string `json:"password,omitempty"` - // HostKey - Public sshKey of git repository. - HostKey *string `json:"hostKey,omitempty"` - // HostKeyAlgorithm - SshKey algorithm of git repository. - HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` - // PrivateKey - Private sshKey algorithm of git repository. - PrivateKey *string `json:"privateKey,omitempty"` - // StrictHostKeyChecking - Strict host key checking or not. - StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` -} - -// ConfigurationServiceInstance collection of instances belong to the Application Configuration Service -type ConfigurationServiceInstance struct { - // Name - READ-ONLY; Name of the Application Configuration Service instance - Name *string `json:"name,omitempty"` - // Status - READ-ONLY; Status of the Application Configuration Service instance - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigurationServiceInstance. -func (csi ConfigurationServiceInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConfigurationServiceProperties application Configuration Service properties payload -type ConfigurationServiceProperties struct { - // ProvisioningState - READ-ONLY; State of the Application Configuration Service. Possible values include: 'ConfigurationServiceProvisioningStateCreating', 'ConfigurationServiceProvisioningStateUpdating', 'ConfigurationServiceProvisioningStateSucceeded', 'ConfigurationServiceProvisioningStateFailed', 'ConfigurationServiceProvisioningStateDeleting' - ProvisioningState ConfigurationServiceProvisioningState `json:"provisioningState,omitempty"` - // ResourceRequests - The requested resource quantity for required CPU and Memory. - ResourceRequests *ConfigurationServiceResourceRequests `json:"resourceRequests,omitempty"` - // Instances - READ-ONLY; Collection of instances belong to Application Configuration Service. - Instances *[]ConfigurationServiceInstance `json:"instances,omitempty"` - Settings *ConfigurationServiceSettings `json:"settings,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigurationServiceProperties. -func (csp ConfigurationServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if csp.ResourceRequests != nil { - objectMap["resourceRequests"] = csp.ResourceRequests - } - if csp.Settings != nil { - objectMap["settings"] = csp.Settings - } - return json.Marshal(objectMap) -} - -// ConfigurationServiceResource application Configuration Service resource -type ConfigurationServiceResource struct { - autorest.Response `json:"-"` - Properties *ConfigurationServiceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigurationServiceResource. -func (csr ConfigurationServiceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if csr.Properties != nil { - objectMap["properties"] = csr.Properties - } - if csr.SystemData != nil { - objectMap["systemData"] = csr.SystemData - } - return json.Marshal(objectMap) -} - -// ConfigurationServiceResourceCollection object that includes an array of configuration service resources -// and a possible link for next set -type ConfigurationServiceResourceCollection struct { - autorest.Response `json:"-"` - // Value - Collection of configuration service resources - Value *[]ConfigurationServiceResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// ConfigurationServiceResourceCollectionIterator provides access to a complete listing of -// ConfigurationServiceResource values. -type ConfigurationServiceResourceCollectionIterator struct { - i int - page ConfigurationServiceResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ConfigurationServiceResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServiceResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ConfigurationServiceResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ConfigurationServiceResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ConfigurationServiceResourceCollectionIterator) Response() ConfigurationServiceResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ConfigurationServiceResourceCollectionIterator) Value() ConfigurationServiceResource { - if !iter.page.NotDone() { - return ConfigurationServiceResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ConfigurationServiceResourceCollectionIterator type. -func NewConfigurationServiceResourceCollectionIterator(page ConfigurationServiceResourceCollectionPage) ConfigurationServiceResourceCollectionIterator { - return ConfigurationServiceResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (csrc ConfigurationServiceResourceCollection) IsEmpty() bool { - return csrc.Value == nil || len(*csrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (csrc ConfigurationServiceResourceCollection) hasNextLink() bool { - return csrc.NextLink != nil && len(*csrc.NextLink) != 0 -} - -// configurationServiceResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (csrc ConfigurationServiceResourceCollection) configurationServiceResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !csrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(csrc.NextLink))) -} - -// ConfigurationServiceResourceCollectionPage contains a page of ConfigurationServiceResource values. -type ConfigurationServiceResourceCollectionPage struct { - fn func(context.Context, ConfigurationServiceResourceCollection) (ConfigurationServiceResourceCollection, error) - csrc ConfigurationServiceResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ConfigurationServiceResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServiceResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.csrc) - if err != nil { - return err - } - page.csrc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ConfigurationServiceResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ConfigurationServiceResourceCollectionPage) NotDone() bool { - return !page.csrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ConfigurationServiceResourceCollectionPage) Response() ConfigurationServiceResourceCollection { - return page.csrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ConfigurationServiceResourceCollectionPage) Values() []ConfigurationServiceResource { - if page.csrc.IsEmpty() { - return nil - } - return *page.csrc.Value -} - -// Creates a new instance of the ConfigurationServiceResourceCollectionPage type. -func NewConfigurationServiceResourceCollectionPage(cur ConfigurationServiceResourceCollection, getNextPage func(context.Context, ConfigurationServiceResourceCollection) (ConfigurationServiceResourceCollection, error)) ConfigurationServiceResourceCollectionPage { - return ConfigurationServiceResourceCollectionPage{ - fn: getNextPage, - csrc: cur, - } -} - -// ConfigurationServiceResourceRequests resource request payload of Application Configuration Service -type ConfigurationServiceResourceRequests struct { - // CPU - READ-ONLY; Cpu allocated to each Application Configuration Service instance - CPU *string `json:"cpu,omitempty"` - // Memory - READ-ONLY; Memory allocated to each Application Configuration Service instance - Memory *string `json:"memory,omitempty"` - // InstanceCount - READ-ONLY; Instance count of the Application Configuration Service - InstanceCount *int32 `json:"instanceCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigurationServiceResourceRequests. -func (csrr ConfigurationServiceResourceRequests) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConfigurationServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConfigurationServicesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConfigurationServicesClient) (ConfigurationServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConfigurationServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConfigurationServicesCreateOrUpdateFuture.Result. -func (future *ConfigurationServicesCreateOrUpdateFuture) result(client ConfigurationServicesClient) (csr ConfigurationServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - csr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.ConfigurationServicesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if csr.Response.Response, err = future.GetResult(sender); err == nil && csr.Response.Response.StatusCode != http.StatusNoContent { - csr, err = client.CreateOrUpdateResponder(csr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesCreateOrUpdateFuture", "Result", csr.Response.Response, "Failure responding to request") - } - } - return -} - -// ConfigurationServicesDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConfigurationServicesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConfigurationServicesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConfigurationServicesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConfigurationServicesDeleteFuture.Result. -func (future *ConfigurationServicesDeleteFuture) result(client ConfigurationServicesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.ConfigurationServicesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ConfigurationServiceSettings the settings of Application Configuration Service. -type ConfigurationServiceSettings struct { - GitProperty *ConfigurationServiceGitProperty `json:"gitProperty,omitempty"` -} - -// ConfigurationServiceSettingsValidateResult validation result for configuration service settings -type ConfigurationServiceSettingsValidateResult struct { - autorest.Response `json:"-"` - GitPropertyValidationResult *ConfigurationServiceGitPropertyValidateResult `json:"gitPropertyValidationResult,omitempty"` -} - -// ConfigurationServicesValidateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ConfigurationServicesValidateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ConfigurationServicesClient) (ConfigurationServiceSettingsValidateResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ConfigurationServicesValidateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ConfigurationServicesValidateFuture.Result. -func (future *ConfigurationServicesValidateFuture) result(client ConfigurationServicesClient) (cssvr ConfigurationServiceSettingsValidateResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesValidateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cssvr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.ConfigurationServicesValidateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cssvr.Response.Response, err = future.GetResult(sender); err == nil && cssvr.Response.Response.StatusCode != http.StatusNoContent { - cssvr, err = client.ValidateResponder(cssvr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesValidateFuture", "Result", cssvr.Response.Response, "Failure responding to request") - } - } - return -} - -// ContainerProbeSettings container liveness and readiness probe settings -type ContainerProbeSettings struct { - // DisableProbe - Indicates whether disable the liveness and readiness probe - DisableProbe *bool `json:"disableProbe,omitempty"` -} - -// ContentCertificateProperties properties of certificate imported from key vault. -type ContentCertificateProperties struct { - // Content - The content of uploaded certificate. - Content *string `json:"content,omitempty"` - // Thumbprint - READ-ONLY; The thumbprint of certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // Issuer - READ-ONLY; The issuer of certificate. - Issuer *string `json:"issuer,omitempty"` - // IssuedDate - READ-ONLY; The issue date of certificate. - IssuedDate *string `json:"issuedDate,omitempty"` - // ExpirationDate - READ-ONLY; The expiration date of certificate. - ExpirationDate *string `json:"expirationDate,omitempty"` - // ActivateDate - READ-ONLY; The activate date of certificate. - ActivateDate *string `json:"activateDate,omitempty"` - // SubjectName - READ-ONLY; The subject name of certificate. - SubjectName *string `json:"subjectName,omitempty"` - // DNSNames - READ-ONLY; The domain list of certificate. - DNSNames *[]string `json:"dnsNames,omitempty"` - // Type - Possible values include: 'TypeBasicCertificatePropertiesTypeCertificateProperties', 'TypeBasicCertificatePropertiesTypeKeyVaultCertificate', 'TypeBasicCertificatePropertiesTypeContentCertificate' - Type TypeBasicCertificateProperties `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContentCertificateProperties. -func (ccp ContentCertificateProperties) MarshalJSON() ([]byte, error) { - ccp.Type = TypeBasicCertificatePropertiesTypeContentCertificate - objectMap := make(map[string]interface{}) - if ccp.Content != nil { - objectMap["content"] = ccp.Content - } - if ccp.Type != "" { - objectMap["type"] = ccp.Type - } - return json.Marshal(objectMap) -} - -// AsKeyVaultCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. -func (ccp ContentCertificateProperties) AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) { - return nil, false -} - -// AsContentCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. -func (ccp ContentCertificateProperties) AsContentCertificateProperties() (*ContentCertificateProperties, bool) { - return &ccp, true -} - -// AsCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. -func (ccp ContentCertificateProperties) AsCertificateProperties() (*CertificateProperties, bool) { - return nil, false -} - -// AsBasicCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. -func (ccp ContentCertificateProperties) AsBasicCertificateProperties() (BasicCertificateProperties, bool) { - return &ccp, true -} - -// CustomContainer custom container payload -type CustomContainer struct { - // Server - The name of the registry that contains the container image - Server *string `json:"server,omitempty"` - // ContainerImage - Container image of the custom container. This should be in the form of : without the server name of the registry - ContainerImage *string `json:"containerImage,omitempty"` - // Command - Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. - Command *[]string `json:"command,omitempty"` - // Args - Arguments to the entrypoint. The docker image's CMD is used if this is not provided. - Args *[]string `json:"args,omitempty"` - // ImageRegistryCredential - Credential of the image registry - ImageRegistryCredential *ImageRegistryCredential `json:"imageRegistryCredential,omitempty"` - // LanguageFramework - Language framework of the container image uploaded - LanguageFramework *string `json:"languageFramework,omitempty"` -} - -// CustomContainerUserSourceInfo custom container user source info -type CustomContainerUserSourceInfo struct { - CustomContainer *CustomContainer `json:"customContainer,omitempty"` - // Version - Version of the source - Version *string `json:"version,omitempty"` - // Type - Possible values include: 'TypeBasicUserSourceInfoTypeUserSourceInfo', 'TypeBasicUserSourceInfoTypeUploadedUserSourceInfo', 'TypeBasicUserSourceInfoTypeJar', 'TypeBasicUserSourceInfoTypeSource', 'TypeBasicUserSourceInfoTypeNetCoreZip', 'TypeBasicUserSourceInfoTypeBuildResult', 'TypeBasicUserSourceInfoTypeContainer' - Type TypeBasicUserSourceInfo `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for CustomContainerUserSourceInfo. -func (ccusi CustomContainerUserSourceInfo) MarshalJSON() ([]byte, error) { - ccusi.Type = TypeBasicUserSourceInfoTypeContainer - objectMap := make(map[string]interface{}) - if ccusi.CustomContainer != nil { - objectMap["customContainer"] = ccusi.CustomContainer - } - if ccusi.Version != nil { - objectMap["version"] = ccusi.Version - } - if ccusi.Type != "" { - objectMap["type"] = ccusi.Type - } - return json.Marshal(objectMap) -} - -// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. -func (ccusi CustomContainerUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { - return nil, false -} - -// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. -func (ccusi CustomContainerUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. -func (ccusi CustomContainerUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. -func (ccusi CustomContainerUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. -func (ccusi CustomContainerUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. -func (ccusi CustomContainerUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { - return nil, false -} - -// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. -func (ccusi CustomContainerUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { - return &ccusi, true -} - -// AsUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. -func (ccusi CustomContainerUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { - return nil, false -} - -// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. -func (ccusi CustomContainerUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { - return &ccusi, true -} - -// CustomDomainProperties custom domain of app resource payload. -type CustomDomainProperties struct { - // Thumbprint - The thumbprint of bound certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // AppName - READ-ONLY; The app name of domain. - AppName *string `json:"appName,omitempty"` - // CertName - The bound certificate name of domain. - CertName *string `json:"certName,omitempty"` -} - -// MarshalJSON is the custom marshaler for CustomDomainProperties. -func (cdp CustomDomainProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cdp.Thumbprint != nil { - objectMap["thumbprint"] = cdp.Thumbprint - } - if cdp.CertName != nil { - objectMap["certName"] = cdp.CertName - } - return json.Marshal(objectMap) -} - -// CustomDomainResource custom domain resource payload. -type CustomDomainResource struct { - autorest.Response `json:"-"` - // Properties - Properties of the custom domain resource. - Properties *CustomDomainProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for CustomDomainResource. -func (cdr CustomDomainResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cdr.Properties != nil { - objectMap["properties"] = cdr.Properties - } - if cdr.SystemData != nil { - objectMap["systemData"] = cdr.SystemData - } - return json.Marshal(objectMap) -} - -// CustomDomainResourceCollection collection compose of a custom domain resources list and a possible link -// for next page. -type CustomDomainResourceCollection struct { - autorest.Response `json:"-"` - // Value - The custom domain resources list. - Value *[]CustomDomainResource `json:"value,omitempty"` - // NextLink - The link to next page of custom domain list. - NextLink *string `json:"nextLink,omitempty"` -} - -// CustomDomainResourceCollectionIterator provides access to a complete listing of CustomDomainResource -// values. -type CustomDomainResourceCollectionIterator struct { - i int - page CustomDomainResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *CustomDomainResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *CustomDomainResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CustomDomainResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter CustomDomainResourceCollectionIterator) Response() CustomDomainResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter CustomDomainResourceCollectionIterator) Value() CustomDomainResource { - if !iter.page.NotDone() { - return CustomDomainResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CustomDomainResourceCollectionIterator type. -func NewCustomDomainResourceCollectionIterator(page CustomDomainResourceCollectionPage) CustomDomainResourceCollectionIterator { - return CustomDomainResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cdrc CustomDomainResourceCollection) IsEmpty() bool { - return cdrc.Value == nil || len(*cdrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cdrc CustomDomainResourceCollection) hasNextLink() bool { - return cdrc.NextLink != nil && len(*cdrc.NextLink) != 0 -} - -// customDomainResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cdrc CustomDomainResourceCollection) customDomainResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !cdrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cdrc.NextLink))) -} - -// CustomDomainResourceCollectionPage contains a page of CustomDomainResource values. -type CustomDomainResourceCollectionPage struct { - fn func(context.Context, CustomDomainResourceCollection) (CustomDomainResourceCollection, error) - cdrc CustomDomainResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *CustomDomainResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cdrc) - if err != nil { - return err - } - page.cdrc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *CustomDomainResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CustomDomainResourceCollectionPage) NotDone() bool { - return !page.cdrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CustomDomainResourceCollectionPage) Response() CustomDomainResourceCollection { - return page.cdrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CustomDomainResourceCollectionPage) Values() []CustomDomainResource { - if page.cdrc.IsEmpty() { - return nil - } - return *page.cdrc.Value -} - -// Creates a new instance of the CustomDomainResourceCollectionPage type. -func NewCustomDomainResourceCollectionPage(cur CustomDomainResourceCollection, getNextPage func(context.Context, CustomDomainResourceCollection) (CustomDomainResourceCollection, error)) CustomDomainResourceCollectionPage { - return CustomDomainResourceCollectionPage{ - fn: getNextPage, - cdrc: cur, - } -} - -// CustomDomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type CustomDomainsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CustomDomainsClient) (CustomDomainResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CustomDomainsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CustomDomainsCreateOrUpdateFuture.Result. -func (future *CustomDomainsCreateOrUpdateFuture) result(client CustomDomainsClient) (cdr CustomDomainResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cdr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.CustomDomainsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cdr.Response.Response, err = future.GetResult(sender); err == nil && cdr.Response.Response.StatusCode != http.StatusNoContent { - cdr, err = client.CreateOrUpdateResponder(cdr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsCreateOrUpdateFuture", "Result", cdr.Response.Response, "Failure responding to request") - } - } - return -} - -// CustomDomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type CustomDomainsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CustomDomainsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CustomDomainsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CustomDomainsDeleteFuture.Result. -func (future *CustomDomainsDeleteFuture) result(client CustomDomainsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.CustomDomainsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// CustomDomainsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type CustomDomainsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(CustomDomainsClient) (CustomDomainResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *CustomDomainsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for CustomDomainsUpdateFuture.Result. -func (future *CustomDomainsUpdateFuture) result(client CustomDomainsClient) (cdr CustomDomainResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cdr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.CustomDomainsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cdr.Response.Response, err = future.GetResult(sender); err == nil && cdr.Response.Response.StatusCode != http.StatusNoContent { - cdr, err = client.UpdateResponder(cdr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsUpdateFuture", "Result", cdr.Response.Response, "Failure responding to request") - } - } - return -} - -// CustomDomainValidatePayload custom domain validate payload. -type CustomDomainValidatePayload struct { - // Name - Name to be validated - Name *string `json:"name,omitempty"` -} - -// CustomDomainValidateResult validation result for custom domain. -type CustomDomainValidateResult struct { - autorest.Response `json:"-"` - // IsValid - Indicates if domain name is valid. - IsValid *bool `json:"isValid,omitempty"` - // Message - Message of why domain name is invalid. - Message *string `json:"message,omitempty"` -} - -// BasicCustomPersistentDiskProperties custom persistent disk resource payload. -type BasicCustomPersistentDiskProperties interface { - AsAzureFileVolume() (*AzureFileVolume, bool) - AsCustomPersistentDiskProperties() (*CustomPersistentDiskProperties, bool) -} - -// CustomPersistentDiskProperties custom persistent disk resource payload. -type CustomPersistentDiskProperties struct { - // MountPath - The mount path of the persistent disk. - MountPath *string `json:"mountPath,omitempty"` - // ReadOnly - Indicates whether the persistent disk is a readOnly one. - ReadOnly *bool `json:"readOnly,omitempty"` - // MountOptions - These are the mount options for a persistent disk. - MountOptions *[]string `json:"mountOptions,omitempty"` - // Type - Possible values include: 'TypeCustomPersistentDiskProperties', 'TypeAzureFileVolume' - Type Type `json:"type,omitempty"` -} - -func unmarshalBasicCustomPersistentDiskProperties(body []byte) (BasicCustomPersistentDiskProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeAzureFileVolume): - var afv AzureFileVolume - err := json.Unmarshal(body, &afv) - return afv, err - default: - var cpdp CustomPersistentDiskProperties - err := json.Unmarshal(body, &cpdp) - return cpdp, err - } -} -func unmarshalBasicCustomPersistentDiskPropertiesArray(body []byte) ([]BasicCustomPersistentDiskProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - cpdpArray := make([]BasicCustomPersistentDiskProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - cpdp, err := unmarshalBasicCustomPersistentDiskProperties(*rawMessage) - if err != nil { - return nil, err - } - cpdpArray[index] = cpdp - } - return cpdpArray, nil -} - -// MarshalJSON is the custom marshaler for CustomPersistentDiskProperties. -func (cpdp CustomPersistentDiskProperties) MarshalJSON() ([]byte, error) { - cpdp.Type = TypeCustomPersistentDiskProperties - objectMap := make(map[string]interface{}) - if cpdp.MountPath != nil { - objectMap["mountPath"] = cpdp.MountPath - } - if cpdp.ReadOnly != nil { - objectMap["readOnly"] = cpdp.ReadOnly - } - if cpdp.MountOptions != nil { - objectMap["mountOptions"] = cpdp.MountOptions - } - if cpdp.Type != "" { - objectMap["type"] = cpdp.Type - } - return json.Marshal(objectMap) -} - -// AsAzureFileVolume is the BasicCustomPersistentDiskProperties implementation for CustomPersistentDiskProperties. -func (cpdp CustomPersistentDiskProperties) AsAzureFileVolume() (*AzureFileVolume, bool) { - return nil, false -} - -// AsCustomPersistentDiskProperties is the BasicCustomPersistentDiskProperties implementation for CustomPersistentDiskProperties. -func (cpdp CustomPersistentDiskProperties) AsCustomPersistentDiskProperties() (*CustomPersistentDiskProperties, bool) { - return &cpdp, true -} - -// AsBasicCustomPersistentDiskProperties is the BasicCustomPersistentDiskProperties implementation for CustomPersistentDiskProperties. -func (cpdp CustomPersistentDiskProperties) AsBasicCustomPersistentDiskProperties() (BasicCustomPersistentDiskProperties, bool) { - return &cpdp, true -} - -// CustomPersistentDiskResource custom persistent disk resource payload. -type CustomPersistentDiskResource struct { - // CustomPersistentDiskProperties - Properties of the custom persistent disk resource payload. - CustomPersistentDiskProperties BasicCustomPersistentDiskProperties `json:"customPersistentDiskProperties,omitempty"` - // StorageID - The resource id of Azure Spring Cloud Storage resource. - StorageID *string `json:"storageId,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for CustomPersistentDiskResource struct. -func (cpdr *CustomPersistentDiskResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "customPersistentDiskProperties": - if v != nil { - customPersistentDiskProperties, err := unmarshalBasicCustomPersistentDiskProperties(*v) - if err != nil { - return err - } - cpdr.CustomPersistentDiskProperties = customPersistentDiskProperties - } - case "storageId": - if v != nil { - var storageID string - err = json.Unmarshal(*v, &storageID) - if err != nil { - return err - } - cpdr.StorageID = &storageID - } - } - } - - return nil -} - -// DeploymentInstance deployment instance payload -type DeploymentInstance struct { - // Name - READ-ONLY; Name of the deployment instance - Name *string `json:"name,omitempty"` - // Status - READ-ONLY; Status of the deployment instance - Status *string `json:"status,omitempty"` - // Reason - READ-ONLY; Failed reason of the deployment instance - Reason *string `json:"reason,omitempty"` - // DiscoveryStatus - READ-ONLY; Discovery status of the deployment instance - DiscoveryStatus *string `json:"discoveryStatus,omitempty"` - // StartTime - READ-ONLY; Start time of the deployment instance - StartTime *string `json:"startTime,omitempty"` - // Zone - READ-ONLY; Availability zone information of the deployment instance - Zone *string `json:"zone,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeploymentInstance. -func (di DeploymentInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DeploymentResource deployment resource payload -type DeploymentResource struct { - autorest.Response `json:"-"` - // Properties - Properties of the Deployment resource - Properties *DeploymentResourceProperties `json:"properties,omitempty"` - // Sku - Sku of the Deployment resource - Sku *Sku `json:"sku,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeploymentResource. -func (dr DeploymentResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dr.Properties != nil { - objectMap["properties"] = dr.Properties - } - if dr.Sku != nil { - objectMap["sku"] = dr.Sku - } - if dr.SystemData != nil { - objectMap["systemData"] = dr.SystemData - } - return json.Marshal(objectMap) -} - -// DeploymentResourceCollection object that includes an array of App resources and a possible link for next -// set -type DeploymentResourceCollection struct { - autorest.Response `json:"-"` - // Value - Collection of Deployment resources - Value *[]DeploymentResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// DeploymentResourceCollectionIterator provides access to a complete listing of DeploymentResource values. -type DeploymentResourceCollectionIterator struct { - i int - page DeploymentResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DeploymentResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DeploymentResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DeploymentResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DeploymentResourceCollectionIterator) Response() DeploymentResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DeploymentResourceCollectionIterator) Value() DeploymentResource { - if !iter.page.NotDone() { - return DeploymentResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DeploymentResourceCollectionIterator type. -func NewDeploymentResourceCollectionIterator(page DeploymentResourceCollectionPage) DeploymentResourceCollectionIterator { - return DeploymentResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (drc DeploymentResourceCollection) IsEmpty() bool { - return drc.Value == nil || len(*drc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (drc DeploymentResourceCollection) hasNextLink() bool { - return drc.NextLink != nil && len(*drc.NextLink) != 0 -} - -// deploymentResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (drc DeploymentResourceCollection) deploymentResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !drc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(drc.NextLink))) -} - -// DeploymentResourceCollectionPage contains a page of DeploymentResource values. -type DeploymentResourceCollectionPage struct { - fn func(context.Context, DeploymentResourceCollection) (DeploymentResourceCollection, error) - drc DeploymentResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DeploymentResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.drc) - if err != nil { - return err - } - page.drc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DeploymentResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DeploymentResourceCollectionPage) NotDone() bool { - return !page.drc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DeploymentResourceCollectionPage) Response() DeploymentResourceCollection { - return page.drc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DeploymentResourceCollectionPage) Values() []DeploymentResource { - if page.drc.IsEmpty() { - return nil - } - return *page.drc.Value -} - -// Creates a new instance of the DeploymentResourceCollectionPage type. -func NewDeploymentResourceCollectionPage(cur DeploymentResourceCollection, getNextPage func(context.Context, DeploymentResourceCollection) (DeploymentResourceCollection, error)) DeploymentResourceCollectionPage { - return DeploymentResourceCollectionPage{ - fn: getNextPage, - drc: cur, - } -} - -// DeploymentResourceProperties deployment resource properties payload -type DeploymentResourceProperties struct { - // Source - Uploaded source information of the deployment. - Source BasicUserSourceInfo `json:"source,omitempty"` - // DeploymentSettings - Deployment settings of the Deployment - DeploymentSettings *DeploymentSettings `json:"deploymentSettings,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the Deployment. Possible values include: 'DeploymentResourceProvisioningStateCreating', 'DeploymentResourceProvisioningStateUpdating', 'DeploymentResourceProvisioningStateSucceeded', 'DeploymentResourceProvisioningStateFailed' - ProvisioningState DeploymentResourceProvisioningState `json:"provisioningState,omitempty"` - // Status - READ-ONLY; Status of the Deployment. Possible values include: 'DeploymentResourceStatusStopped', 'DeploymentResourceStatusRunning' - Status DeploymentResourceStatus `json:"status,omitempty"` - // Active - Indicates whether the Deployment is active - Active *bool `json:"active,omitempty"` - // Instances - READ-ONLY; Collection of instances belong to the Deployment - Instances *[]DeploymentInstance `json:"instances,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeploymentResourceProperties. -func (drp DeploymentResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["source"] = drp.Source - if drp.DeploymentSettings != nil { - objectMap["deploymentSettings"] = drp.DeploymentSettings - } - if drp.Active != nil { - objectMap["active"] = drp.Active - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DeploymentResourceProperties struct. -func (drp *DeploymentResourceProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "source": - if v != nil { - source, err := unmarshalBasicUserSourceInfo(*v) - if err != nil { - return err - } - drp.Source = source - } - case "deploymentSettings": - if v != nil { - var deploymentSettings DeploymentSettings - err = json.Unmarshal(*v, &deploymentSettings) - if err != nil { - return err - } - drp.DeploymentSettings = &deploymentSettings - } - case "provisioningState": - if v != nil { - var provisioningState DeploymentResourceProvisioningState - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - drp.ProvisioningState = provisioningState - } - case "status": - if v != nil { - var status DeploymentResourceStatus - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - drp.Status = status - } - case "active": - if v != nil { - var active bool - err = json.Unmarshal(*v, &active) - if err != nil { - return err - } - drp.Active = &active - } - case "instances": - if v != nil { - var instances []DeploymentInstance - err = json.Unmarshal(*v, &instances) - if err != nil { - return err - } - drp.Instances = &instances - } - } - } - - return nil -} - -// DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DeploymentsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DeploymentsClient) (DeploymentResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeploymentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeploymentsCreateOrUpdateFuture.Result. -func (future *DeploymentsCreateOrUpdateFuture) result(client DeploymentsClient) (dr DeploymentResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.DeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dr.Response.Response, err = future.GetResult(sender); err == nil && dr.Response.Response.StatusCode != http.StatusNoContent { - dr, err = client.CreateOrUpdateResponder(dr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.DeploymentsCreateOrUpdateFuture", "Result", dr.Response.Response, "Failure responding to request") - } - } - return -} - -// DeploymentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DeploymentsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DeploymentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeploymentsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeploymentsDeleteFuture.Result. -func (future *DeploymentsDeleteFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.DeploymentsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DeploymentSettings deployment settings payload -type DeploymentSettings struct { - // ResourceRequests - The requested resource quantity for required CPU and Memory. It is recommended that using this field to represent the required CPU and Memory, the old field cpu and memoryInGB will be deprecated later. - ResourceRequests *ResourceRequests `json:"resourceRequests,omitempty"` - // EnvironmentVariables - Collection of environment variables - EnvironmentVariables map[string]*string `json:"environmentVariables"` - // AddonConfigs - Collection of addons - AddonConfigs map[string]map[string]interface{} `json:"addonConfigs"` - ContainerProbeSettings *ContainerProbeSettings `json:"containerProbeSettings,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeploymentSettings. -func (ds DeploymentSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ds.ResourceRequests != nil { - objectMap["resourceRequests"] = ds.ResourceRequests - } - if ds.EnvironmentVariables != nil { - objectMap["environmentVariables"] = ds.EnvironmentVariables - } - if ds.AddonConfigs != nil { - objectMap["addonConfigs"] = ds.AddonConfigs - } - if ds.ContainerProbeSettings != nil { - objectMap["containerProbeSettings"] = ds.ContainerProbeSettings - } - return json.Marshal(objectMap) -} - -// DeploymentsGenerateHeapDumpFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DeploymentsGenerateHeapDumpFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DeploymentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeploymentsGenerateHeapDumpFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeploymentsGenerateHeapDumpFuture.Result. -func (future *DeploymentsGenerateHeapDumpFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.DeploymentsGenerateHeapDumpFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsGenerateHeapDumpFuture") - return - } - ar.Response = future.Response() - return -} - -// DeploymentsGenerateThreadDumpFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DeploymentsGenerateThreadDumpFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DeploymentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeploymentsGenerateThreadDumpFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeploymentsGenerateThreadDumpFuture.Result. -func (future *DeploymentsGenerateThreadDumpFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.DeploymentsGenerateThreadDumpFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsGenerateThreadDumpFuture") - return - } - ar.Response = future.Response() - return -} - -// DeploymentsRestartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DeploymentsRestartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DeploymentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeploymentsRestartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeploymentsRestartFuture.Result. -func (future *DeploymentsRestartFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.DeploymentsRestartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsRestartFuture") - return - } - ar.Response = future.Response() - return -} - -// DeploymentsStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DeploymentsStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DeploymentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeploymentsStartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeploymentsStartFuture.Result. -func (future *DeploymentsStartFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.DeploymentsStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsStartFuture") - return - } - ar.Response = future.Response() - return -} - -// DeploymentsStartJFRFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DeploymentsStartJFRFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DeploymentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeploymentsStartJFRFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeploymentsStartJFRFuture.Result. -func (future *DeploymentsStartJFRFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.DeploymentsStartJFRFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsStartJFRFuture") - return - } - ar.Response = future.Response() - return -} - -// DeploymentsStopFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DeploymentsStopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DeploymentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeploymentsStopFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeploymentsStopFuture.Result. -func (future *DeploymentsStopFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.DeploymentsStopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsStopFuture") - return - } - ar.Response = future.Response() - return -} - -// DeploymentsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DeploymentsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DeploymentsClient) (DeploymentResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DeploymentsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DeploymentsUpdateFuture.Result. -func (future *DeploymentsUpdateFuture) result(client DeploymentsClient) (dr DeploymentResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.DeploymentsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dr.Response.Response, err = future.GetResult(sender); err == nil && dr.Response.Response.StatusCode != http.StatusNoContent { - dr, err = client.UpdateResponder(dr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.DeploymentsUpdateFuture", "Result", dr.Response.Response, "Failure responding to request") - } - } - return -} - -// DiagnosticParameters diagnostic parameters of diagnostic operations -type DiagnosticParameters struct { - // AppInstance - App instance name - AppInstance *string `json:"appInstance,omitempty"` - // FilePath - Your target file path in your own BYOS - FilePath *string `json:"filePath,omitempty"` - // Duration - Duration of your JFR. 1 min can be represented by 1m or 60s. - Duration *string `json:"duration,omitempty"` -} - -// Error the error code compose of code and message. -type Error struct { - // Code - The code of error. - Code *string `json:"code,omitempty"` - // Message - The message of error. - Message *string `json:"message,omitempty"` -} - -// GatewayAPIMetadataProperties API metadata property for Spring Cloud Gateway -type GatewayAPIMetadataProperties struct { - // Title - Title describing the context of the APIs available on the Gateway instance (default: `Spring Cloud Gateway for K8S`) - Title *string `json:"title,omitempty"` - // Description - Detailed description of the APIs available on the Gateway instance (default: `Generated OpenAPI 3 document that describes the API routes configured.`) - Description *string `json:"description,omitempty"` - // Documentation - Location of additional documentation for the APIs available on the Gateway instance - Documentation *string `json:"documentation,omitempty"` - // Version - Version of APIs available on this Gateway instance (default: `unspecified`). - Version *string `json:"version,omitempty"` - // ServerURL - Base URL that API consumers will use to access APIs on the Gateway instance. - ServerURL *string `json:"serverUrl,omitempty"` -} - -// GatewayAPIRoute API route config of the Spring Cloud Gateway -type GatewayAPIRoute struct { - // Title - A title, will be applied to methods in the generated OpenAPI documentation. - Title *string `json:"title,omitempty"` - // Description - A description, will be applied to methods in the generated OpenAPI documentation. - Description *string `json:"description,omitempty"` - // URI - Full uri, will override `appName`. - URI *string `json:"uri,omitempty"` - // SsoEnabled - Enable sso validation. - SsoEnabled *bool `json:"ssoEnabled,omitempty"` - // TokenRelay - Pass currently-authenticated user's identity token to application service, default is 'false' - TokenRelay *bool `json:"tokenRelay,omitempty"` - // Predicates - A number of conditions to evaluate a route for each request. Each predicate may be evaluated against request headers and parameter values. All of the predicates associated with a route must evaluate to true for the route to be matched to the request. - Predicates *[]string `json:"predicates,omitempty"` - // Filters - To modify the request before sending it to the target endpoint, or the received response. - Filters *[]string `json:"filters,omitempty"` - // Order - Route processing order. - Order *int32 `json:"order,omitempty"` - // Tags - Classification tags, will be applied to methods in the generated OpenAPI documentation. - Tags *[]string `json:"tags,omitempty"` -} - -// GatewayCorsProperties cross-Origin Resource Sharing property -type GatewayCorsProperties struct { - // AllowedOrigins - Allowed origins to make cross-site requests. The special value `*` allows all domains. - AllowedOrigins *[]string `json:"allowedOrigins,omitempty"` - // AllowedMethods - Allowed HTTP methods on cross-site requests. The special value `*` allows all methods. If not set, `GET` and `HEAD` are allowed by default. - AllowedMethods *[]string `json:"allowedMethods,omitempty"` - // AllowedHeaders - Allowed headers in cross-site requests. The special value `*` allows actual requests to send any header. - AllowedHeaders *[]string `json:"allowedHeaders,omitempty"` - // MaxAge - How long, in seconds, the response from a pre-flight request can be cached by clients. - MaxAge *int32 `json:"maxAge,omitempty"` - // AllowCredentials - Whether user credentials are supported on cross-site requests. Valid values: `true`, `false`. - AllowCredentials *bool `json:"allowCredentials,omitempty"` - // ExposedHeaders - HTTP response headers to expose for cross-site requests. - ExposedHeaders *[]string `json:"exposedHeaders,omitempty"` -} - -// GatewayCustomDomainProperties the properties of custom domain for Spring Cloud Gateway -type GatewayCustomDomainProperties struct { - // Thumbprint - The thumbprint of bound certificate. - Thumbprint *string `json:"thumbprint,omitempty"` -} - -// GatewayCustomDomainResource custom domain of the Spring Cloud Gateway -type GatewayCustomDomainResource struct { - autorest.Response `json:"-"` - Properties *GatewayCustomDomainProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayCustomDomainResource. -func (gcdr GatewayCustomDomainResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gcdr.Properties != nil { - objectMap["properties"] = gcdr.Properties - } - if gcdr.SystemData != nil { - objectMap["systemData"] = gcdr.SystemData - } - return json.Marshal(objectMap) -} - -// GatewayCustomDomainResourceCollection object that includes an array of Spring Cloud Gateway custom -// domain resources and a possible link for next set -type GatewayCustomDomainResourceCollection struct { - autorest.Response `json:"-"` - // Value - Collection of Spring Cloud Gateway custom domain resources - Value *[]GatewayCustomDomainResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// GatewayCustomDomainResourceCollectionIterator provides access to a complete listing of -// GatewayCustomDomainResource values. -type GatewayCustomDomainResourceCollectionIterator struct { - i int - page GatewayCustomDomainResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *GatewayCustomDomainResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCustomDomainResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *GatewayCustomDomainResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GatewayCustomDomainResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter GatewayCustomDomainResourceCollectionIterator) Response() GatewayCustomDomainResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter GatewayCustomDomainResourceCollectionIterator) Value() GatewayCustomDomainResource { - if !iter.page.NotDone() { - return GatewayCustomDomainResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GatewayCustomDomainResourceCollectionIterator type. -func NewGatewayCustomDomainResourceCollectionIterator(page GatewayCustomDomainResourceCollectionPage) GatewayCustomDomainResourceCollectionIterator { - return GatewayCustomDomainResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (gcdrc GatewayCustomDomainResourceCollection) IsEmpty() bool { - return gcdrc.Value == nil || len(*gcdrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (gcdrc GatewayCustomDomainResourceCollection) hasNextLink() bool { - return gcdrc.NextLink != nil && len(*gcdrc.NextLink) != 0 -} - -// gatewayCustomDomainResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (gcdrc GatewayCustomDomainResourceCollection) gatewayCustomDomainResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !gcdrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(gcdrc.NextLink))) -} - -// GatewayCustomDomainResourceCollectionPage contains a page of GatewayCustomDomainResource values. -type GatewayCustomDomainResourceCollectionPage struct { - fn func(context.Context, GatewayCustomDomainResourceCollection) (GatewayCustomDomainResourceCollection, error) - gcdrc GatewayCustomDomainResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *GatewayCustomDomainResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCustomDomainResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.gcdrc) - if err != nil { - return err - } - page.gcdrc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *GatewayCustomDomainResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GatewayCustomDomainResourceCollectionPage) NotDone() bool { - return !page.gcdrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GatewayCustomDomainResourceCollectionPage) Response() GatewayCustomDomainResourceCollection { - return page.gcdrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GatewayCustomDomainResourceCollectionPage) Values() []GatewayCustomDomainResource { - if page.gcdrc.IsEmpty() { - return nil - } - return *page.gcdrc.Value -} - -// Creates a new instance of the GatewayCustomDomainResourceCollectionPage type. -func NewGatewayCustomDomainResourceCollectionPage(cur GatewayCustomDomainResourceCollection, getNextPage func(context.Context, GatewayCustomDomainResourceCollection) (GatewayCustomDomainResourceCollection, error)) GatewayCustomDomainResourceCollectionPage { - return GatewayCustomDomainResourceCollectionPage{ - fn: getNextPage, - gcdrc: cur, - } -} - -// GatewayCustomDomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type GatewayCustomDomainsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GatewayCustomDomainsClient) (GatewayCustomDomainResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GatewayCustomDomainsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GatewayCustomDomainsCreateOrUpdateFuture.Result. -func (future *GatewayCustomDomainsCreateOrUpdateFuture) result(client GatewayCustomDomainsClient) (gcdr GatewayCustomDomainResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gcdr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.GatewayCustomDomainsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gcdr.Response.Response, err = future.GetResult(sender); err == nil && gcdr.Response.Response.StatusCode != http.StatusNoContent { - gcdr, err = client.CreateOrUpdateResponder(gcdr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsCreateOrUpdateFuture", "Result", gcdr.Response.Response, "Failure responding to request") - } - } - return -} - -// GatewayCustomDomainsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type GatewayCustomDomainsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GatewayCustomDomainsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GatewayCustomDomainsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GatewayCustomDomainsDeleteFuture.Result. -func (future *GatewayCustomDomainsDeleteFuture) result(client GatewayCustomDomainsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.GatewayCustomDomainsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// GatewayInstance collection of instances belong to the Spring Cloud Gateway -type GatewayInstance struct { - // Name - READ-ONLY; Name of the Spring Cloud Gateway instance - Name *string `json:"name,omitempty"` - // Status - READ-ONLY; Status of the Spring Cloud Gateway instance - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayInstance. -func (gi GatewayInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GatewayOperatorProperties properties of the Spring Cloud Gateway Operator. -type GatewayOperatorProperties struct { - // ResourceRequests - The requested resource quantity for required CPU and Memory. - ResourceRequests *GatewayOperatorResourceRequests `json:"resourceRequests,omitempty"` - // Instances - READ-ONLY; Collection of instances belong to Spring Cloud Gateway operator. - Instances *[]GatewayInstance `json:"instances,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayOperatorProperties. -func (gop GatewayOperatorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gop.ResourceRequests != nil { - objectMap["resourceRequests"] = gop.ResourceRequests - } - return json.Marshal(objectMap) -} - -// GatewayOperatorResourceRequests properties of the Spring Cloud Gateway Operator. -type GatewayOperatorResourceRequests struct { - // CPU - READ-ONLY; Cpu allocated to each Spring Cloud Gateway Operator instance. - CPU *string `json:"cpu,omitempty"` - // Memory - READ-ONLY; Memory allocated to each Spring Cloud Gateway Operator instance. - Memory *string `json:"memory,omitempty"` - // InstanceCount - READ-ONLY; Instance count of the Spring Cloud Gateway Operator. - InstanceCount *int32 `json:"instanceCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayOperatorResourceRequests. -func (gorr GatewayOperatorResourceRequests) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GatewayProperties spring Cloud Gateway properties payload -type GatewayProperties struct { - // ProvisioningState - READ-ONLY; State of the Spring Cloud Gateway. Possible values include: 'GatewayProvisioningStateCreating', 'GatewayProvisioningStateUpdating', 'GatewayProvisioningStateSucceeded', 'GatewayProvisioningStateFailed', 'GatewayProvisioningStateDeleting' - ProvisioningState GatewayProvisioningState `json:"provisioningState,omitempty"` - // Public - Indicates whether the Spring Cloud Gateway exposes endpoint. - Public *bool `json:"public,omitempty"` - // URL - READ-ONLY; URL of the Spring Cloud Gateway, exposed when 'public' is true. - URL *string `json:"url,omitempty"` - // HTTPSOnly - Indicate if only https is allowed. - HTTPSOnly *bool `json:"httpsOnly,omitempty"` - SsoProperties *SsoProperties `json:"ssoProperties,omitempty"` - APIMetadataProperties *GatewayAPIMetadataProperties `json:"apiMetadataProperties,omitempty"` - CorsProperties *GatewayCorsProperties `json:"corsProperties,omitempty"` - // ResourceRequests - The requested resource quantity for required CPU and Memory. - ResourceRequests *GatewayResourceRequests `json:"resourceRequests,omitempty"` - // Instances - READ-ONLY; Collection of instances belong to Spring Cloud Gateway. - Instances *[]GatewayInstance `json:"instances,omitempty"` - // OperatorProperties - READ-ONLY - OperatorProperties *GatewayOperatorProperties `json:"operatorProperties,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayProperties. -func (gp GatewayProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gp.Public != nil { - objectMap["public"] = gp.Public - } - if gp.HTTPSOnly != nil { - objectMap["httpsOnly"] = gp.HTTPSOnly - } - if gp.SsoProperties != nil { - objectMap["ssoProperties"] = gp.SsoProperties - } - if gp.APIMetadataProperties != nil { - objectMap["apiMetadataProperties"] = gp.APIMetadataProperties - } - if gp.CorsProperties != nil { - objectMap["corsProperties"] = gp.CorsProperties - } - if gp.ResourceRequests != nil { - objectMap["resourceRequests"] = gp.ResourceRequests - } - return json.Marshal(objectMap) -} - -// GatewayResource spring Cloud Gateway resource -type GatewayResource struct { - autorest.Response `json:"-"` - Properties *GatewayProperties `json:"properties,omitempty"` - // Sku - Sku of the Spring Cloud Gateway resource - Sku *Sku `json:"sku,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayResource. -func (gr GatewayResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gr.Properties != nil { - objectMap["properties"] = gr.Properties - } - if gr.Sku != nil { - objectMap["sku"] = gr.Sku - } - if gr.SystemData != nil { - objectMap["systemData"] = gr.SystemData - } - return json.Marshal(objectMap) -} - -// GatewayResourceCollection object that includes an array of gateway resources and a possible link for -// next set -type GatewayResourceCollection struct { - autorest.Response `json:"-"` - // Value - Collection of gateway resources - Value *[]GatewayResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// GatewayResourceCollectionIterator provides access to a complete listing of GatewayResource values. -type GatewayResourceCollectionIterator struct { - i int - page GatewayResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *GatewayResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *GatewayResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GatewayResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter GatewayResourceCollectionIterator) Response() GatewayResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter GatewayResourceCollectionIterator) Value() GatewayResource { - if !iter.page.NotDone() { - return GatewayResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GatewayResourceCollectionIterator type. -func NewGatewayResourceCollectionIterator(page GatewayResourceCollectionPage) GatewayResourceCollectionIterator { - return GatewayResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (grc GatewayResourceCollection) IsEmpty() bool { - return grc.Value == nil || len(*grc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (grc GatewayResourceCollection) hasNextLink() bool { - return grc.NextLink != nil && len(*grc.NextLink) != 0 -} - -// gatewayResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (grc GatewayResourceCollection) gatewayResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !grc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(grc.NextLink))) -} - -// GatewayResourceCollectionPage contains a page of GatewayResource values. -type GatewayResourceCollectionPage struct { - fn func(context.Context, GatewayResourceCollection) (GatewayResourceCollection, error) - grc GatewayResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *GatewayResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.grc) - if err != nil { - return err - } - page.grc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *GatewayResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GatewayResourceCollectionPage) NotDone() bool { - return !page.grc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GatewayResourceCollectionPage) Response() GatewayResourceCollection { - return page.grc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GatewayResourceCollectionPage) Values() []GatewayResource { - if page.grc.IsEmpty() { - return nil - } - return *page.grc.Value -} - -// Creates a new instance of the GatewayResourceCollectionPage type. -func NewGatewayResourceCollectionPage(cur GatewayResourceCollection, getNextPage func(context.Context, GatewayResourceCollection) (GatewayResourceCollection, error)) GatewayResourceCollectionPage { - return GatewayResourceCollectionPage{ - fn: getNextPage, - grc: cur, - } -} - -// GatewayResourceRequests resource request payload of Spring Cloud Gateway. -type GatewayResourceRequests struct { - // CPU - Cpu allocated to each Spring Cloud Gateway instance. - CPU *string `json:"cpu,omitempty"` - // Memory - Memory allocated to each Spring Cloud Gateway instance. - Memory *string `json:"memory,omitempty"` -} - -// GatewayRouteConfigProperties API route config of the Spring Cloud Gateway -type GatewayRouteConfigProperties struct { - // ProvisioningState - READ-ONLY; State of the Spring Cloud Gateway route config. Possible values include: 'GatewayProvisioningStateCreating', 'GatewayProvisioningStateUpdating', 'GatewayProvisioningStateSucceeded', 'GatewayProvisioningStateFailed', 'GatewayProvisioningStateDeleting' - ProvisioningState GatewayProvisioningState `json:"provisioningState,omitempty"` - // AppResourceID - The resource Id of the Azure Spring Cloud app, required unless route defines `uri`. - AppResourceID *string `json:"appResourceId,omitempty"` - // Routes - Array of API routes, each route contains properties such as `title`, `uri`, `ssoEnabled`, `predicates`, `filters`. - Routes *[]GatewayAPIRoute `json:"routes,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayRouteConfigProperties. -func (grcp GatewayRouteConfigProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if grcp.AppResourceID != nil { - objectMap["appResourceId"] = grcp.AppResourceID - } - if grcp.Routes != nil { - objectMap["routes"] = grcp.Routes - } - return json.Marshal(objectMap) -} - -// GatewayRouteConfigResource spring Cloud Gateway route config resource -type GatewayRouteConfigResource struct { - autorest.Response `json:"-"` - Properties *GatewayRouteConfigProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for GatewayRouteConfigResource. -func (grcr GatewayRouteConfigResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if grcr.Properties != nil { - objectMap["properties"] = grcr.Properties - } - if grcr.SystemData != nil { - objectMap["systemData"] = grcr.SystemData - } - return json.Marshal(objectMap) -} - -// GatewayRouteConfigResourceCollection object that includes an array of Spring Cloud Gateway route config -// resources and a possible link for next set -type GatewayRouteConfigResourceCollection struct { - autorest.Response `json:"-"` - // Value - Collection of Spring Cloud Gateway route config resources - Value *[]GatewayRouteConfigResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// GatewayRouteConfigResourceCollectionIterator provides access to a complete listing of -// GatewayRouteConfigResource values. -type GatewayRouteConfigResourceCollectionIterator struct { - i int - page GatewayRouteConfigResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *GatewayRouteConfigResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayRouteConfigResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *GatewayRouteConfigResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GatewayRouteConfigResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter GatewayRouteConfigResourceCollectionIterator) Response() GatewayRouteConfigResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter GatewayRouteConfigResourceCollectionIterator) Value() GatewayRouteConfigResource { - if !iter.page.NotDone() { - return GatewayRouteConfigResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GatewayRouteConfigResourceCollectionIterator type. -func NewGatewayRouteConfigResourceCollectionIterator(page GatewayRouteConfigResourceCollectionPage) GatewayRouteConfigResourceCollectionIterator { - return GatewayRouteConfigResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (grcrc GatewayRouteConfigResourceCollection) IsEmpty() bool { - return grcrc.Value == nil || len(*grcrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (grcrc GatewayRouteConfigResourceCollection) hasNextLink() bool { - return grcrc.NextLink != nil && len(*grcrc.NextLink) != 0 -} - -// gatewayRouteConfigResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (grcrc GatewayRouteConfigResourceCollection) gatewayRouteConfigResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !grcrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(grcrc.NextLink))) -} - -// GatewayRouteConfigResourceCollectionPage contains a page of GatewayRouteConfigResource values. -type GatewayRouteConfigResourceCollectionPage struct { - fn func(context.Context, GatewayRouteConfigResourceCollection) (GatewayRouteConfigResourceCollection, error) - grcrc GatewayRouteConfigResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *GatewayRouteConfigResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GatewayRouteConfigResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.grcrc) - if err != nil { - return err - } - page.grcrc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *GatewayRouteConfigResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GatewayRouteConfigResourceCollectionPage) NotDone() bool { - return !page.grcrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GatewayRouteConfigResourceCollectionPage) Response() GatewayRouteConfigResourceCollection { - return page.grcrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GatewayRouteConfigResourceCollectionPage) Values() []GatewayRouteConfigResource { - if page.grcrc.IsEmpty() { - return nil - } - return *page.grcrc.Value -} - -// Creates a new instance of the GatewayRouteConfigResourceCollectionPage type. -func NewGatewayRouteConfigResourceCollectionPage(cur GatewayRouteConfigResourceCollection, getNextPage func(context.Context, GatewayRouteConfigResourceCollection) (GatewayRouteConfigResourceCollection, error)) GatewayRouteConfigResourceCollectionPage { - return GatewayRouteConfigResourceCollectionPage{ - fn: getNextPage, - grcrc: cur, - } -} - -// GatewayRouteConfigsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type GatewayRouteConfigsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GatewayRouteConfigsClient) (GatewayRouteConfigResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GatewayRouteConfigsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GatewayRouteConfigsCreateOrUpdateFuture.Result. -func (future *GatewayRouteConfigsCreateOrUpdateFuture) result(client GatewayRouteConfigsClient) (grcr GatewayRouteConfigResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - grcr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.GatewayRouteConfigsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if grcr.Response.Response, err = future.GetResult(sender); err == nil && grcr.Response.Response.StatusCode != http.StatusNoContent { - grcr, err = client.CreateOrUpdateResponder(grcr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsCreateOrUpdateFuture", "Result", grcr.Response.Response, "Failure responding to request") - } - } - return -} - -// GatewayRouteConfigsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type GatewayRouteConfigsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GatewayRouteConfigsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GatewayRouteConfigsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GatewayRouteConfigsDeleteFuture.Result. -func (future *GatewayRouteConfigsDeleteFuture) result(client GatewayRouteConfigsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.GatewayRouteConfigsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// GatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type GatewaysCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GatewaysClient) (GatewayResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GatewaysCreateOrUpdateFuture.Result. -func (future *GatewaysCreateOrUpdateFuture) result(client GatewaysClient) (gr GatewayResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.GatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - gr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.GatewaysCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { - gr, err = client.CreateOrUpdateResponder(gr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.GatewaysCreateOrUpdateFuture", "Result", gr.Response.Response, "Failure responding to request") - } - } - return -} - -// GatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type GatewaysDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GatewaysClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GatewaysDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GatewaysDeleteFuture.Result. -func (future *GatewaysDeleteFuture) result(client GatewaysClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.GatewaysDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.GatewaysDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// GitPatternRepository git repository property payload for config server -type GitPatternRepository struct { - // Name - Name of the repository - Name *string `json:"name,omitempty"` - // Pattern - Collection of pattern of the repository - Pattern *[]string `json:"pattern,omitempty"` - // URI - URI of the repository - URI *string `json:"uri,omitempty"` - // Label - Label of the repository - Label *string `json:"label,omitempty"` - // SearchPaths - Searching path of the repository - SearchPaths *[]string `json:"searchPaths,omitempty"` - // Username - Username of git repository basic auth. - Username *string `json:"username,omitempty"` - // Password - Password of git repository basic auth. - Password *string `json:"password,omitempty"` - // HostKey - Public sshKey of git repository. - HostKey *string `json:"hostKey,omitempty"` - // HostKeyAlgorithm - SshKey algorithm of git repository. - HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` - // PrivateKey - Private sshKey algorithm of git repository. - PrivateKey *string `json:"privateKey,omitempty"` - // StrictHostKeyChecking - Strict host key checking or not. - StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` -} - -// ImageRegistryCredential credential of the image registry -type ImageRegistryCredential struct { - // Username - The username of the image registry credential - Username *string `json:"username,omitempty"` - // Password - The password of the image registry credential - Password *string `json:"password,omitempty"` -} - -// JarUploadedUserSourceInfo uploaded Jar binary for a deployment -type JarUploadedUserSourceInfo struct { - // RuntimeVersion - Runtime version of the Jar file - RuntimeVersion *string `json:"runtimeVersion,omitempty"` - // JvmOptions - JVM parameter - JvmOptions *string `json:"jvmOptions,omitempty"` - // RelativePath - Relative path of the storage which stores the source - RelativePath *string `json:"relativePath,omitempty"` - // Version - Version of the source - Version *string `json:"version,omitempty"` - // Type - Possible values include: 'TypeBasicUserSourceInfoTypeUserSourceInfo', 'TypeBasicUserSourceInfoTypeUploadedUserSourceInfo', 'TypeBasicUserSourceInfoTypeJar', 'TypeBasicUserSourceInfoTypeSource', 'TypeBasicUserSourceInfoTypeNetCoreZip', 'TypeBasicUserSourceInfoTypeBuildResult', 'TypeBasicUserSourceInfoTypeContainer' - Type TypeBasicUserSourceInfo `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for JarUploadedUserSourceInfo. -func (juusi JarUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { - juusi.Type = TypeBasicUserSourceInfoTypeJar - objectMap := make(map[string]interface{}) - if juusi.RuntimeVersion != nil { - objectMap["runtimeVersion"] = juusi.RuntimeVersion - } - if juusi.JvmOptions != nil { - objectMap["jvmOptions"] = juusi.JvmOptions - } - if juusi.RelativePath != nil { - objectMap["relativePath"] = juusi.RelativePath - } - if juusi.Version != nil { - objectMap["version"] = juusi.Version - } - if juusi.Type != "" { - objectMap["type"] = juusi.Type - } - return json.Marshal(objectMap) -} - -// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. -func (juusi JarUploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { - return nil, false -} - -// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. -func (juusi JarUploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { - return &juusi, true -} - -// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. -func (juusi JarUploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { - return &juusi, true -} - -// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. -func (juusi JarUploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. -func (juusi JarUploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. -func (juusi JarUploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { - return nil, false -} - -// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. -func (juusi JarUploadedUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { - return nil, false -} - -// AsUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. -func (juusi JarUploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { - return nil, false -} - -// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. -func (juusi JarUploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { - return &juusi, true -} - -// KeyVaultCertificateProperties properties of certificate imported from key vault. -type KeyVaultCertificateProperties struct { - // VaultURI - The vault uri of user key vault. - VaultURI *string `json:"vaultUri,omitempty"` - // KeyVaultCertName - The certificate name of key vault. - KeyVaultCertName *string `json:"keyVaultCertName,omitempty"` - // CertVersion - The certificate version of key vault. - CertVersion *string `json:"certVersion,omitempty"` - // ExcludePrivateKey - Optional. If set to true, it will not import private key from key vault. - ExcludePrivateKey *bool `json:"excludePrivateKey,omitempty"` - // Thumbprint - READ-ONLY; The thumbprint of certificate. - Thumbprint *string `json:"thumbprint,omitempty"` - // Issuer - READ-ONLY; The issuer of certificate. - Issuer *string `json:"issuer,omitempty"` - // IssuedDate - READ-ONLY; The issue date of certificate. - IssuedDate *string `json:"issuedDate,omitempty"` - // ExpirationDate - READ-ONLY; The expiration date of certificate. - ExpirationDate *string `json:"expirationDate,omitempty"` - // ActivateDate - READ-ONLY; The activate date of certificate. - ActivateDate *string `json:"activateDate,omitempty"` - // SubjectName - READ-ONLY; The subject name of certificate. - SubjectName *string `json:"subjectName,omitempty"` - // DNSNames - READ-ONLY; The domain list of certificate. - DNSNames *[]string `json:"dnsNames,omitempty"` - // Type - Possible values include: 'TypeBasicCertificatePropertiesTypeCertificateProperties', 'TypeBasicCertificatePropertiesTypeKeyVaultCertificate', 'TypeBasicCertificatePropertiesTypeContentCertificate' - Type TypeBasicCertificateProperties `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for KeyVaultCertificateProperties. -func (kvcp KeyVaultCertificateProperties) MarshalJSON() ([]byte, error) { - kvcp.Type = TypeBasicCertificatePropertiesTypeKeyVaultCertificate - objectMap := make(map[string]interface{}) - if kvcp.VaultURI != nil { - objectMap["vaultUri"] = kvcp.VaultURI - } - if kvcp.KeyVaultCertName != nil { - objectMap["keyVaultCertName"] = kvcp.KeyVaultCertName - } - if kvcp.CertVersion != nil { - objectMap["certVersion"] = kvcp.CertVersion - } - if kvcp.ExcludePrivateKey != nil { - objectMap["excludePrivateKey"] = kvcp.ExcludePrivateKey - } - if kvcp.Type != "" { - objectMap["type"] = kvcp.Type - } - return json.Marshal(objectMap) -} - -// AsKeyVaultCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. -func (kvcp KeyVaultCertificateProperties) AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) { - return &kvcp, true -} - -// AsContentCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. -func (kvcp KeyVaultCertificateProperties) AsContentCertificateProperties() (*ContentCertificateProperties, bool) { - return nil, false -} - -// AsCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. -func (kvcp KeyVaultCertificateProperties) AsCertificateProperties() (*CertificateProperties, bool) { - return nil, false -} - -// AsBasicCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. -func (kvcp KeyVaultCertificateProperties) AsBasicCertificateProperties() (BasicCertificateProperties, bool) { - return &kvcp, true -} - -// LoadedCertificate loaded certificate payload -type LoadedCertificate struct { - // ResourceID - Resource Id of loaded certificate - ResourceID *string `json:"resourceId,omitempty"` - // LoadTrustStore - Indicate whether the certificate will be loaded into default trust store, only work for Java runtime. - LoadTrustStore *bool `json:"loadTrustStore,omitempty"` -} - -// LogFileURLResponse log file URL payload -type LogFileURLResponse struct { - autorest.Response `json:"-"` - // URL - URL of the log file - URL *string `json:"url,omitempty"` -} - -// LogSpecification specifications of the Log for Azure Monitoring -type LogSpecification struct { - // Name - Name of the log - Name *string `json:"name,omitempty"` - // DisplayName - Localized friendly display name of the log - DisplayName *string `json:"displayName,omitempty"` - // BlobDuration - Blob duration of the log - BlobDuration *string `json:"blobDuration,omitempty"` -} - -// ManagedIdentityProperties managed identity properties retrieved from ARM request headers. -type ManagedIdentityProperties struct { - // Type - Type of the managed identity. Possible values include: 'ManagedIdentityTypeNone', 'ManagedIdentityTypeSystemAssigned', 'ManagedIdentityTypeUserAssigned', 'ManagedIdentityTypeSystemAssignedUserAssigned' - Type ManagedIdentityType `json:"type,omitempty"` - // PrincipalID - Principal Id of system-assigned managed identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - Tenant Id of system-assigned managed identity. - TenantID *string `json:"tenantId,omitempty"` - // UserAssignedIdentities - Properties of user-assigned managed identities - UserAssignedIdentities map[string]*UserAssignedManagedIdentity `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for ManagedIdentityProperties. -func (mip ManagedIdentityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mip.Type != "" { - objectMap["type"] = mip.Type - } - if mip.PrincipalID != nil { - objectMap["principalId"] = mip.PrincipalID - } - if mip.TenantID != nil { - objectMap["tenantId"] = mip.TenantID - } - if mip.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = mip.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// MetricDimension specifications of the Dimension of metrics -type MetricDimension struct { - // Name - Name of the dimension - Name *string `json:"name,omitempty"` - // DisplayName - Localized friendly display name of the dimension - DisplayName *string `json:"displayName,omitempty"` - // ToBeExportedForShoebox - Whether this dimension should be included for the Shoebox export scenario - ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` -} - -// MetricSpecification specifications of the Metrics for Azure Monitoring -type MetricSpecification struct { - // Name - Name of the metric - Name *string `json:"name,omitempty"` - // DisplayName - Localized friendly display name of the metric - DisplayName *string `json:"displayName,omitempty"` - // DisplayDescription - Localized friendly description of the metric - DisplayDescription *string `json:"displayDescription,omitempty"` - // Unit - Unit that makes sense for the metric - Unit *string `json:"unit,omitempty"` - // Category - Name of the metric category that the metric belongs to. A metric can only belong to a single category. - Category *string `json:"category,omitempty"` - // AggregationType - Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. - AggregationType *string `json:"aggregationType,omitempty"` - // SupportedAggregationTypes - Supported aggregation types - SupportedAggregationTypes *[]string `json:"supportedAggregationTypes,omitempty"` - // SupportedTimeGrainTypes - Supported time grain types - SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` - // FillGapWithZero - Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. - FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` - // Dimensions - Dimensions of the metric - Dimensions *[]MetricDimension `json:"dimensions,omitempty"` - // SourceMdmNamespace - Name of the MDM namespace. Optional. - SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` -} - -// MonitoringSettingProperties monitoring Setting properties payload -type MonitoringSettingProperties struct { - // ProvisioningState - READ-ONLY; State of the Monitoring Setting. Possible values include: 'MonitoringSettingStateNotAvailable', 'MonitoringSettingStateFailed', 'MonitoringSettingStateSucceeded', 'MonitoringSettingStateUpdating' - ProvisioningState MonitoringSettingState `json:"provisioningState,omitempty"` - // Error - Error when apply Monitoring Setting changes. - Error *Error `json:"error,omitempty"` - // TraceEnabled - Indicates whether enable the trace functionality, which will be deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate if monitoringSettings enabled or not - TraceEnabled *bool `json:"traceEnabled,omitempty"` - // AppInsightsInstrumentationKey - Target application insight instrumentation key, null or whitespace include empty will disable monitoringSettings - AppInsightsInstrumentationKey *string `json:"appInsightsInstrumentationKey,omitempty"` - // AppInsightsSamplingRate - Indicates the sampling rate of application insight agent, should be in range [0.0, 100.0] - AppInsightsSamplingRate *float64 `json:"appInsightsSamplingRate,omitempty"` - // AppInsightsAgentVersions - Indicates the versions of application insight agent - AppInsightsAgentVersions *ApplicationInsightsAgentVersions `json:"appInsightsAgentVersions,omitempty"` -} - -// MarshalJSON is the custom marshaler for MonitoringSettingProperties. -func (msp MonitoringSettingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if msp.Error != nil { - objectMap["error"] = msp.Error - } - if msp.TraceEnabled != nil { - objectMap["traceEnabled"] = msp.TraceEnabled - } - if msp.AppInsightsInstrumentationKey != nil { - objectMap["appInsightsInstrumentationKey"] = msp.AppInsightsInstrumentationKey - } - if msp.AppInsightsSamplingRate != nil { - objectMap["appInsightsSamplingRate"] = msp.AppInsightsSamplingRate - } - if msp.AppInsightsAgentVersions != nil { - objectMap["appInsightsAgentVersions"] = msp.AppInsightsAgentVersions - } - return json.Marshal(objectMap) -} - -// MonitoringSettingResource monitoring Setting resource -type MonitoringSettingResource struct { - autorest.Response `json:"-"` - // Properties - Properties of the Monitoring Setting resource - Properties *MonitoringSettingProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for MonitoringSettingResource. -func (msr MonitoringSettingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if msr.Properties != nil { - objectMap["properties"] = msr.Properties - } - if msr.SystemData != nil { - objectMap["systemData"] = msr.SystemData - } - return json.Marshal(objectMap) -} - -// MonitoringSettingsUpdatePatchFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type MonitoringSettingsUpdatePatchFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MonitoringSettingsClient) (MonitoringSettingResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MonitoringSettingsUpdatePatchFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for MonitoringSettingsUpdatePatchFuture.Result. -func (future *MonitoringSettingsUpdatePatchFuture) result(client MonitoringSettingsClient) (msr MonitoringSettingResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePatchFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - msr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.MonitoringSettingsUpdatePatchFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if msr.Response.Response, err = future.GetResult(sender); err == nil && msr.Response.Response.StatusCode != http.StatusNoContent { - msr, err = client.UpdatePatchResponder(msr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePatchFuture", "Result", msr.Response.Response, "Failure responding to request") - } - } - return -} - -// MonitoringSettingsUpdatePutFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type MonitoringSettingsUpdatePutFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MonitoringSettingsClient) (MonitoringSettingResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MonitoringSettingsUpdatePutFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for MonitoringSettingsUpdatePutFuture.Result. -func (future *MonitoringSettingsUpdatePutFuture) result(client MonitoringSettingsClient) (msr MonitoringSettingResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePutFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - msr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.MonitoringSettingsUpdatePutFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if msr.Response.Response, err = future.GetResult(sender); err == nil && msr.Response.Response.StatusCode != http.StatusNoContent { - msr, err = client.UpdatePutResponder(msr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePutFuture", "Result", msr.Response.Response, "Failure responding to request") - } - } - return -} - -// NameAvailability name availability result payload -type NameAvailability struct { - autorest.Response `json:"-"` - // NameAvailable - Indicates whether the name is available - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - Reason why the name is not available - Reason *string `json:"reason,omitempty"` - // Message - Message why the name is not available - Message *string `json:"message,omitempty"` -} - -// NameAvailabilityParameters name availability parameters payload -type NameAvailabilityParameters struct { - // Type - Type of the resource to check name availability - Type *string `json:"type,omitempty"` - // Name - Name to be checked - Name *string `json:"name,omitempty"` -} - -// NetCoreZipUploadedUserSourceInfo uploaded Jar binary for a deployment -type NetCoreZipUploadedUserSourceInfo struct { - // NetCoreMainEntryPath - The path to the .NET executable relative to zip root - NetCoreMainEntryPath *string `json:"netCoreMainEntryPath,omitempty"` - // RuntimeVersion - Runtime version of the .Net file - RuntimeVersion *string `json:"runtimeVersion,omitempty"` - // RelativePath - Relative path of the storage which stores the source - RelativePath *string `json:"relativePath,omitempty"` - // Version - Version of the source - Version *string `json:"version,omitempty"` - // Type - Possible values include: 'TypeBasicUserSourceInfoTypeUserSourceInfo', 'TypeBasicUserSourceInfoTypeUploadedUserSourceInfo', 'TypeBasicUserSourceInfoTypeJar', 'TypeBasicUserSourceInfoTypeSource', 'TypeBasicUserSourceInfoTypeNetCoreZip', 'TypeBasicUserSourceInfoTypeBuildResult', 'TypeBasicUserSourceInfoTypeContainer' - Type TypeBasicUserSourceInfo `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NetCoreZipUploadedUserSourceInfo. -func (nczuusi NetCoreZipUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { - nczuusi.Type = TypeBasicUserSourceInfoTypeNetCoreZip - objectMap := make(map[string]interface{}) - if nczuusi.NetCoreMainEntryPath != nil { - objectMap["netCoreMainEntryPath"] = nczuusi.NetCoreMainEntryPath - } - if nczuusi.RuntimeVersion != nil { - objectMap["runtimeVersion"] = nczuusi.RuntimeVersion - } - if nczuusi.RelativePath != nil { - objectMap["relativePath"] = nczuusi.RelativePath - } - if nczuusi.Version != nil { - objectMap["version"] = nczuusi.Version - } - if nczuusi.Type != "" { - objectMap["type"] = nczuusi.Type - } - return json.Marshal(objectMap) -} - -// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. -func (nczuusi NetCoreZipUploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { - return nil, false -} - -// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. -func (nczuusi NetCoreZipUploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { - return &nczuusi, true -} - -// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. -func (nczuusi NetCoreZipUploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. -func (nczuusi NetCoreZipUploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. -func (nczuusi NetCoreZipUploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { - return &nczuusi, true -} - -// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. -func (nczuusi NetCoreZipUploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { - return nil, false -} - -// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. -func (nczuusi NetCoreZipUploadedUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { - return nil, false -} - -// AsUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. -func (nczuusi NetCoreZipUploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { - return nil, false -} - -// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. -func (nczuusi NetCoreZipUploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { - return &nczuusi, true -} - -// NetworkProfile service network profile payload -type NetworkProfile struct { - // ServiceRuntimeSubnetID - Fully qualified resource Id of the subnet to host Azure Spring Cloud Service Runtime - ServiceRuntimeSubnetID *string `json:"serviceRuntimeSubnetId,omitempty"` - // AppSubnetID - Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps - AppSubnetID *string `json:"appSubnetId,omitempty"` - // ServiceCidr - Azure Spring Cloud service reserved CIDR - ServiceCidr *string `json:"serviceCidr,omitempty"` - // ServiceRuntimeNetworkResourceGroup - Name of the resource group containing network resources of Azure Spring Cloud Service Runtime - ServiceRuntimeNetworkResourceGroup *string `json:"serviceRuntimeNetworkResourceGroup,omitempty"` - // AppNetworkResourceGroup - Name of the resource group containing network resources of Azure Spring Cloud Apps - AppNetworkResourceGroup *string `json:"appNetworkResourceGroup,omitempty"` - // OutboundIPs - READ-ONLY; Desired outbound IP resources for Azure Spring Cloud instance. - OutboundIPs *NetworkProfileOutboundIPs `json:"outboundIPs,omitempty"` - // RequiredTraffics - READ-ONLY; Required inbound or outbound traffics for Azure Spring Cloud instance. - RequiredTraffics *[]RequiredTraffic `json:"requiredTraffics,omitempty"` -} - -// MarshalJSON is the custom marshaler for NetworkProfile. -func (np NetworkProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if np.ServiceRuntimeSubnetID != nil { - objectMap["serviceRuntimeSubnetId"] = np.ServiceRuntimeSubnetID - } - if np.AppSubnetID != nil { - objectMap["appSubnetId"] = np.AppSubnetID - } - if np.ServiceCidr != nil { - objectMap["serviceCidr"] = np.ServiceCidr - } - if np.ServiceRuntimeNetworkResourceGroup != nil { - objectMap["serviceRuntimeNetworkResourceGroup"] = np.ServiceRuntimeNetworkResourceGroup - } - if np.AppNetworkResourceGroup != nil { - objectMap["appNetworkResourceGroup"] = np.AppNetworkResourceGroup - } - return json.Marshal(objectMap) -} - -// NetworkProfileOutboundIPs desired outbound IP resources for Azure Spring Cloud instance. -type NetworkProfileOutboundIPs struct { - // PublicIPs - READ-ONLY; A list of public IP addresses. - PublicIPs *[]string `json:"publicIPs,omitempty"` -} - -// MarshalJSON is the custom marshaler for NetworkProfileOutboundIPs. -func (npP NetworkProfileOutboundIPs) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationDetail operation detail payload -type OperationDetail struct { - // Name - Name of the operation - Name *string `json:"name,omitempty"` - // IsDataAction - Indicates whether the operation is a data action - IsDataAction *bool `json:"isDataAction,omitempty"` - // Display - Display of the operation - Display *OperationDisplay `json:"display,omitempty"` - // ActionType - READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: 'ActionTypeInternal' - ActionType ActionType `json:"actionType,omitempty"` - // Origin - Origin of the operation - Origin *string `json:"origin,omitempty"` - // Properties - Properties of the operation - Properties *OperationProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDetail. -func (od OperationDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if od.Name != nil { - objectMap["name"] = od.Name - } - if od.IsDataAction != nil { - objectMap["isDataAction"] = od.IsDataAction - } - if od.Display != nil { - objectMap["display"] = od.Display - } - if od.Origin != nil { - objectMap["origin"] = od.Origin - } - if od.Properties != nil { - objectMap["properties"] = od.Properties - } - return json.Marshal(objectMap) -} - -// OperationDisplay operation display payload -type OperationDisplay struct { - // Provider - Resource provider of the operation - Provider *string `json:"provider,omitempty"` - // Resource - Resource of the operation - Resource *string `json:"resource,omitempty"` - // Operation - Localized friendly name for the operation - Operation *string `json:"operation,omitempty"` - // Description - Localized friendly description for the operation - Description *string `json:"description,omitempty"` -} - -// OperationProperties extra Operation properties -type OperationProperties struct { - // ServiceSpecification - Service specifications of the operation - ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// PersistentDisk persistent disk payload -type PersistentDisk struct { - // SizeInGB - Size of the persistent disk in GB - SizeInGB *int32 `json:"sizeInGB,omitempty"` - // UsedInGB - READ-ONLY; Size of the used persistent disk in GB - UsedInGB *int32 `json:"usedInGB,omitempty"` - // MountPath - Mount path of the persistent disk - MountPath *string `json:"mountPath,omitempty"` -} - -// MarshalJSON is the custom marshaler for PersistentDisk. -func (pd PersistentDisk) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pd.SizeInGB != nil { - objectMap["sizeInGB"] = pd.SizeInGB - } - if pd.MountPath != nil { - objectMap["mountPath"] = pd.MountPath - } - return json.Marshal(objectMap) -} - -// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than -// required location and tags. -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pr.SystemData != nil { - objectMap["systemData"] = pr.SystemData - } - return json.Marshal(objectMap) -} - -// RegenerateTestKeyRequestPayload regenerate test key request payload -type RegenerateTestKeyRequestPayload struct { - // KeyType - Type of the test key. Possible values include: 'TestKeyTypePrimary', 'TestKeyTypeSecondary' - KeyType TestKeyType `json:"keyType,omitempty"` -} - -// RequiredTraffic required inbound or outbound traffic for Azure Spring Cloud instance. -type RequiredTraffic struct { - // Protocol - READ-ONLY; The protocol of required traffic - Protocol *string `json:"protocol,omitempty"` - // Port - READ-ONLY; The port of required traffic - Port *int32 `json:"port,omitempty"` - // Ips - READ-ONLY; The ip list of required traffic - Ips *[]string `json:"ips,omitempty"` - // Fqdns - READ-ONLY; The FQDN list of required traffic - Fqdns *[]string `json:"fqdns,omitempty"` - // Direction - READ-ONLY; The direction of required traffic. Possible values include: 'TrafficDirectionInbound', 'TrafficDirectionOutbound' - Direction TrafficDirection `json:"direction,omitempty"` -} - -// MarshalJSON is the custom marshaler for RequiredTraffic. -func (rt RequiredTraffic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Resource the core properties of ARM resources. -type Resource struct { - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.SystemData != nil { - objectMap["systemData"] = r.SystemData - } - return json.Marshal(objectMap) -} - -// ResourceRequests deployment resource request payload -type ResourceRequests struct { - // CPU - Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. - CPU *string `json:"cpu,omitempty"` - // Memory - Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - Memory *string `json:"memory,omitempty"` -} - -// ResourceSku describes an available Azure Spring Cloud SKU. -type ResourceSku struct { - // ResourceType - Gets the type of resource the SKU applies to. - ResourceType *string `json:"resourceType,omitempty"` - // Name - Gets the name of SKU. - Name *string `json:"name,omitempty"` - // Tier - Gets the tier of SKU. - Tier *string `json:"tier,omitempty"` - // Capacity - Gets the capacity of SKU. - Capacity *SkuCapacity `json:"capacity,omitempty"` - // Locations - Gets the set of locations that the SKU is available. - Locations *[]string `json:"locations,omitempty"` - // LocationInfo - Gets a list of locations and availability zones in those locations where the SKU is available. - LocationInfo *[]ResourceSkuLocationInfo `json:"locationInfo,omitempty"` - // Restrictions - Gets the restrictions because of which SKU cannot be used. This is - // empty if there are no restrictions. - Restrictions *[]ResourceSkuRestrictions `json:"restrictions,omitempty"` -} - -// ResourceSkuCapabilities ... -type ResourceSkuCapabilities struct { - // Name - Gets an invariant to describe the feature. - Name *string `json:"name,omitempty"` - // Value - Gets an invariant if the feature is measured by quantity. - Value *string `json:"value,omitempty"` -} - -// ResourceSkuCollection object that includes an array of Azure Spring Cloud SKU and a possible link for -// next set -type ResourceSkuCollection struct { - autorest.Response `json:"-"` - // Value - Collection of resource SKU - Value *[]ResourceSku `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// ResourceSkuCollectionIterator provides access to a complete listing of ResourceSku values. -type ResourceSkuCollectionIterator struct { - i int - page ResourceSkuCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ResourceSkuCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ResourceSkuCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ResourceSkuCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ResourceSkuCollectionIterator) Response() ResourceSkuCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ResourceSkuCollectionIterator) Value() ResourceSku { - if !iter.page.NotDone() { - return ResourceSku{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ResourceSkuCollectionIterator type. -func NewResourceSkuCollectionIterator(page ResourceSkuCollectionPage) ResourceSkuCollectionIterator { - return ResourceSkuCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rsc ResourceSkuCollection) IsEmpty() bool { - return rsc.Value == nil || len(*rsc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rsc ResourceSkuCollection) hasNextLink() bool { - return rsc.NextLink != nil && len(*rsc.NextLink) != 0 -} - -// resourceSkuCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rsc ResourceSkuCollection) resourceSkuCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !rsc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rsc.NextLink))) -} - -// ResourceSkuCollectionPage contains a page of ResourceSku values. -type ResourceSkuCollectionPage struct { - fn func(context.Context, ResourceSkuCollection) (ResourceSkuCollection, error) - rsc ResourceSkuCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ResourceSkuCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rsc) - if err != nil { - return err - } - page.rsc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ResourceSkuCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ResourceSkuCollectionPage) NotDone() bool { - return !page.rsc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ResourceSkuCollectionPage) Response() ResourceSkuCollection { - return page.rsc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ResourceSkuCollectionPage) Values() []ResourceSku { - if page.rsc.IsEmpty() { - return nil - } - return *page.rsc.Value -} - -// Creates a new instance of the ResourceSkuCollectionPage type. -func NewResourceSkuCollectionPage(cur ResourceSkuCollection, getNextPage func(context.Context, ResourceSkuCollection) (ResourceSkuCollection, error)) ResourceSkuCollectionPage { - return ResourceSkuCollectionPage{ - fn: getNextPage, - rsc: cur, - } -} - -// ResourceSkuLocationInfo locations and availability zones where the SKU is available -type ResourceSkuLocationInfo struct { - // Location - Gets location of the SKU - Location *string `json:"location,omitempty"` - // Zones - Gets list of availability zones where the SKU is supported. - Zones *[]string `json:"zones,omitempty"` - // ZoneDetails - Gets details of capabilities available to a SKU in specific zones. - ZoneDetails *[]ResourceSkuZoneDetails `json:"zoneDetails,omitempty"` -} - -// ResourceSkuRestrictionInfo information about the restriction where the SKU cannot be used -type ResourceSkuRestrictionInfo struct { - // Locations - Gets locations where the SKU is restricted - Locations *[]string `json:"locations,omitempty"` - // Zones - Gets list of availability zones where the SKU is restricted. - Zones *[]string `json:"zones,omitempty"` -} - -// ResourceSkuRestrictions restrictions where the SKU cannot be used -type ResourceSkuRestrictions struct { - // Type - Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: 'ResourceSkuRestrictionsTypeLocation', 'ResourceSkuRestrictionsTypeZone' - Type ResourceSkuRestrictionsType `json:"type,omitempty"` - // Values - Gets the value of restrictions. If the restriction type is set to - // location. This would be different locations where the SKU is restricted. - Values *[]string `json:"values,omitempty"` - // RestrictionInfo - Gets the information about the restriction where the SKU cannot be used. - RestrictionInfo *ResourceSkuRestrictionInfo `json:"restrictionInfo,omitempty"` - // ReasonCode - Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: 'ResourceSkuRestrictionsReasonCodeQuotaID', 'ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription' - ReasonCode ResourceSkuRestrictionsReasonCode `json:"reasonCode,omitempty"` -} - -// ResourceSkuZoneDetails details of capabilities available to a SKU in specific zones -type ResourceSkuZoneDetails struct { - // Name - Gets the set of zones that the SKU is available in with the - // specified capabilities. - Name *[]string `json:"name,omitempty"` - // Capabilities - Gets a list of capabilities that are available for the SKU in the - // specified list of zones. - Capabilities *[]ResourceSkuCapabilities `json:"capabilities,omitempty"` -} - -// ResourceUploadDefinition resource upload definition payload -type ResourceUploadDefinition struct { - autorest.Response `json:"-"` - // RelativePath - Source relative path - RelativePath *string `json:"relativePath,omitempty"` - // UploadURL - Upload URL - UploadURL *string `json:"uploadUrl,omitempty"` -} - -// ServiceRegistriesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ServiceRegistriesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceRegistriesClient) (ServiceRegistryResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceRegistriesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceRegistriesCreateOrUpdateFuture.Result. -func (future *ServiceRegistriesCreateOrUpdateFuture) result(client ServiceRegistriesClient) (srr ServiceRegistryResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - srr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.ServiceRegistriesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if srr.Response.Response, err = future.GetResult(sender); err == nil && srr.Response.Response.StatusCode != http.StatusNoContent { - srr, err = client.CreateOrUpdateResponder(srr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesCreateOrUpdateFuture", "Result", srr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServiceRegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServiceRegistriesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServiceRegistriesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServiceRegistriesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServiceRegistriesDeleteFuture.Result. -func (future *ServiceRegistriesDeleteFuture) result(client ServiceRegistriesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.ServiceRegistriesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServiceRegistryInstance collection of instances belong to the Service Registry -type ServiceRegistryInstance struct { - // Name - READ-ONLY; Name of the Service Registry instance - Name *string `json:"name,omitempty"` - // Status - READ-ONLY; Status of the Service Registry instance - Status *string `json:"status,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceRegistryInstance. -func (sri ServiceRegistryInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServiceRegistryProperties service Registry properties payload -type ServiceRegistryProperties struct { - // ProvisioningState - READ-ONLY; State of the Service Registry. Possible values include: 'ServiceRegistryProvisioningStateCreating', 'ServiceRegistryProvisioningStateUpdating', 'ServiceRegistryProvisioningStateSucceeded', 'ServiceRegistryProvisioningStateFailed', 'ServiceRegistryProvisioningStateDeleting' - ProvisioningState ServiceRegistryProvisioningState `json:"provisioningState,omitempty"` - // ResourceRequests - The requested resource quantity for required CPU and Memory. - ResourceRequests *ServiceRegistryResourceRequests `json:"resourceRequests,omitempty"` - // Instances - READ-ONLY; Collection of instances belong to Service Registry. - Instances *[]ServiceRegistryInstance `json:"instances,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceRegistryProperties. -func (srp ServiceRegistryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if srp.ResourceRequests != nil { - objectMap["resourceRequests"] = srp.ResourceRequests - } - return json.Marshal(objectMap) -} - -// ServiceRegistryResource service Registry resource -type ServiceRegistryResource struct { - autorest.Response `json:"-"` - Properties *ServiceRegistryProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceRegistryResource. -func (srr ServiceRegistryResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if srr.Properties != nil { - objectMap["properties"] = srr.Properties - } - if srr.SystemData != nil { - objectMap["systemData"] = srr.SystemData - } - return json.Marshal(objectMap) -} - -// ServiceRegistryResourceCollection object that includes an array of Service Registry resources and a -// possible link for next set -type ServiceRegistryResourceCollection struct { - autorest.Response `json:"-"` - // Value - Collection of Service Registry resources - Value *[]ServiceRegistryResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// ServiceRegistryResourceCollectionIterator provides access to a complete listing of -// ServiceRegistryResource values. -type ServiceRegistryResourceCollectionIterator struct { - i int - page ServiceRegistryResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServiceRegistryResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistryResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServiceRegistryResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServiceRegistryResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServiceRegistryResourceCollectionIterator) Response() ServiceRegistryResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServiceRegistryResourceCollectionIterator) Value() ServiceRegistryResource { - if !iter.page.NotDone() { - return ServiceRegistryResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServiceRegistryResourceCollectionIterator type. -func NewServiceRegistryResourceCollectionIterator(page ServiceRegistryResourceCollectionPage) ServiceRegistryResourceCollectionIterator { - return ServiceRegistryResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (srrc ServiceRegistryResourceCollection) IsEmpty() bool { - return srrc.Value == nil || len(*srrc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (srrc ServiceRegistryResourceCollection) hasNextLink() bool { - return srrc.NextLink != nil && len(*srrc.NextLink) != 0 -} - -// serviceRegistryResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (srrc ServiceRegistryResourceCollection) serviceRegistryResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !srrc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(srrc.NextLink))) -} - -// ServiceRegistryResourceCollectionPage contains a page of ServiceRegistryResource values. -type ServiceRegistryResourceCollectionPage struct { - fn func(context.Context, ServiceRegistryResourceCollection) (ServiceRegistryResourceCollection, error) - srrc ServiceRegistryResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServiceRegistryResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistryResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.srrc) - if err != nil { - return err - } - page.srrc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServiceRegistryResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServiceRegistryResourceCollectionPage) NotDone() bool { - return !page.srrc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServiceRegistryResourceCollectionPage) Response() ServiceRegistryResourceCollection { - return page.srrc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServiceRegistryResourceCollectionPage) Values() []ServiceRegistryResource { - if page.srrc.IsEmpty() { - return nil - } - return *page.srrc.Value -} - -// Creates a new instance of the ServiceRegistryResourceCollectionPage type. -func NewServiceRegistryResourceCollectionPage(cur ServiceRegistryResourceCollection, getNextPage func(context.Context, ServiceRegistryResourceCollection) (ServiceRegistryResourceCollection, error)) ServiceRegistryResourceCollectionPage { - return ServiceRegistryResourceCollectionPage{ - fn: getNextPage, - srrc: cur, - } -} - -// ServiceRegistryResourceRequests resource request payload of Service Registry -type ServiceRegistryResourceRequests struct { - // CPU - READ-ONLY; Cpu allocated to each Service Registry instance - CPU *string `json:"cpu,omitempty"` - // Memory - READ-ONLY; Memory allocated to each Service Registry instance - Memory *string `json:"memory,omitempty"` - // InstanceCount - READ-ONLY; Instance count of the Service Registry - InstanceCount *int32 `json:"instanceCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceRegistryResourceRequests. -func (srrr ServiceRegistryResourceRequests) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServiceResource service resource -type ServiceResource struct { - autorest.Response `json:"-"` - // Properties - Properties of the Service resource - Properties *ClusterResourceProperties `json:"properties,omitempty"` - // Sku - Sku of the Service resource - Sku *Sku `json:"sku,omitempty"` - // Location - The GEO location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the service which is a list of key value pairs that describe the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ServiceResource. -func (sr ServiceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Properties != nil { - objectMap["properties"] = sr.Properties - } - if sr.Sku != nil { - objectMap["sku"] = sr.Sku - } - if sr.Location != nil { - objectMap["location"] = sr.Location - } - if sr.Tags != nil { - objectMap["tags"] = sr.Tags - } - if sr.SystemData != nil { - objectMap["systemData"] = sr.SystemData - } - return json.Marshal(objectMap) -} - -// ServiceResourceList object that includes an array of Service resources and a possible link for next set -type ServiceResourceList struct { - autorest.Response `json:"-"` - // Value - Collection of Service resources - Value *[]ServiceResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// ServiceResourceListIterator provides access to a complete listing of ServiceResource values. -type ServiceResourceListIterator struct { - i int - page ServiceResourceListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ServiceResourceListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ServiceResourceListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ServiceResourceListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ServiceResourceListIterator) Response() ServiceResourceList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ServiceResourceListIterator) Value() ServiceResource { - if !iter.page.NotDone() { - return ServiceResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ServiceResourceListIterator type. -func NewServiceResourceListIterator(page ServiceResourceListPage) ServiceResourceListIterator { - return ServiceResourceListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (srl ServiceResourceList) IsEmpty() bool { - return srl.Value == nil || len(*srl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (srl ServiceResourceList) hasNextLink() bool { - return srl.NextLink != nil && len(*srl.NextLink) != 0 -} - -// serviceResourceListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (srl ServiceResourceList) serviceResourceListPreparer(ctx context.Context) (*http.Request, error) { - if !srl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(srl.NextLink))) -} - -// ServiceResourceListPage contains a page of ServiceResource values. -type ServiceResourceListPage struct { - fn func(context.Context, ServiceResourceList) (ServiceResourceList, error) - srl ServiceResourceList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ServiceResourceListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.srl) - if err != nil { - return err - } - page.srl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ServiceResourceListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ServiceResourceListPage) NotDone() bool { - return !page.srl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ServiceResourceListPage) Response() ServiceResourceList { - return page.srl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ServiceResourceListPage) Values() []ServiceResource { - if page.srl.IsEmpty() { - return nil - } - return *page.srl.Value -} - -// Creates a new instance of the ServiceResourceListPage type. -func NewServiceResourceListPage(cur ServiceResourceList, getNextPage func(context.Context, ServiceResourceList) (ServiceResourceList, error)) ServiceResourceListPage { - return ServiceResourceListPage{ - fn: getNextPage, - srl: cur, - } -} - -// ServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServicesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesCreateOrUpdateFuture.Result. -func (future *ServicesCreateOrUpdateFuture) result(client ServicesClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.ServicesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.CreateOrUpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ServicesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// ServicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServicesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesDeleteFuture.Result. -func (future *ServicesDeleteFuture) result(client ServicesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ServicesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.ServicesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ServiceSpecification service specification payload -type ServiceSpecification struct { - // LogSpecifications - Specifications of the Log for Azure Monitoring - LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` - // MetricSpecifications - Specifications of the Metrics for Azure Monitoring - MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` -} - -// ServicesStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServicesStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesStartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesStartFuture.Result. -func (future *ServicesStartFuture) result(client ServicesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ServicesStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.ServicesStartFuture") - return - } - ar.Response = future.Response() - return -} - -// ServicesStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type ServicesStopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesStopFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesStopFuture.Result. -func (future *ServicesStopFuture) result(client ServicesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ServicesStopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.ServicesStopFuture") - return - } - ar.Response = future.Response() - return -} - -// ServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ServicesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ServicesClient) (ServiceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ServicesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ServicesUpdateFuture.Result. -func (future *ServicesUpdateFuture) result(client ServicesClient) (sr ServiceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ServicesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.ServicesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.UpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.ServicesUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// Sku sku of Azure Spring Cloud -type Sku struct { - // Name - Name of the Sku - Name *string `json:"name,omitempty"` - // Tier - Tier of the Sku - Tier *string `json:"tier,omitempty"` - // Capacity - Current capacity of the target resource - Capacity *int32 `json:"capacity,omitempty"` -} - -// SkuCapacity the SKU capacity -type SkuCapacity struct { - // Minimum - Gets or sets the minimum. - Minimum *int32 `json:"minimum,omitempty"` - // Maximum - Gets or sets the maximum. - Maximum *int32 `json:"maximum,omitempty"` - // Default - Gets or sets the default. - Default *int32 `json:"default,omitempty"` - // ScaleType - Gets or sets the type of the scale. Possible values include: 'SkuScaleTypeNone', 'SkuScaleTypeManual', 'SkuScaleTypeAutomatic' - ScaleType SkuScaleType `json:"scaleType,omitempty"` -} - -// SourceUploadedUserSourceInfo uploaded Java source code binary for a deployment -type SourceUploadedUserSourceInfo struct { - // ArtifactSelector - Selector for the artifact to be used for the deployment for multi-module projects. This should be - // the relative path to the target module/project. - ArtifactSelector *string `json:"artifactSelector,omitempty"` - // RuntimeVersion - Runtime version of the source file - RuntimeVersion *string `json:"runtimeVersion,omitempty"` - // RelativePath - Relative path of the storage which stores the source - RelativePath *string `json:"relativePath,omitempty"` - // Version - Version of the source - Version *string `json:"version,omitempty"` - // Type - Possible values include: 'TypeBasicUserSourceInfoTypeUserSourceInfo', 'TypeBasicUserSourceInfoTypeUploadedUserSourceInfo', 'TypeBasicUserSourceInfoTypeJar', 'TypeBasicUserSourceInfoTypeSource', 'TypeBasicUserSourceInfoTypeNetCoreZip', 'TypeBasicUserSourceInfoTypeBuildResult', 'TypeBasicUserSourceInfoTypeContainer' - Type TypeBasicUserSourceInfo `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SourceUploadedUserSourceInfo. -func (suusi SourceUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { - suusi.Type = TypeBasicUserSourceInfoTypeSource - objectMap := make(map[string]interface{}) - if suusi.ArtifactSelector != nil { - objectMap["artifactSelector"] = suusi.ArtifactSelector - } - if suusi.RuntimeVersion != nil { - objectMap["runtimeVersion"] = suusi.RuntimeVersion - } - if suusi.RelativePath != nil { - objectMap["relativePath"] = suusi.RelativePath - } - if suusi.Version != nil { - objectMap["version"] = suusi.Version - } - if suusi.Type != "" { - objectMap["type"] = suusi.Type - } - return json.Marshal(objectMap) -} - -// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. -func (suusi SourceUploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { - return nil, false -} - -// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. -func (suusi SourceUploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { - return &suusi, true -} - -// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. -func (suusi SourceUploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. -func (suusi SourceUploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { - return &suusi, true -} - -// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. -func (suusi SourceUploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. -func (suusi SourceUploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { - return nil, false -} - -// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. -func (suusi SourceUploadedUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { - return nil, false -} - -// AsUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. -func (suusi SourceUploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { - return nil, false -} - -// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. -func (suusi SourceUploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { - return &suusi, true -} - -// SsoProperties single sign-on related configuration -type SsoProperties struct { - // Scope - It defines the specific actions applications can be allowed to do on a user's behalf - Scope *[]string `json:"scope,omitempty"` - // ClientID - The public identifier for the application - ClientID *string `json:"clientId,omitempty"` - // ClientSecret - The secret known only to the application and the authorization server - ClientSecret *string `json:"clientSecret,omitempty"` - // IssuerURI - The URI of Issuer Identifier - IssuerURI *string `json:"issuerUri,omitempty"` -} - -// StackProperties kPack ClusterStack properties payload -type StackProperties struct { - // ID - Id of the ClusterStack. - ID *string `json:"id,omitempty"` - // Version - Version of the ClusterStack - Version *string `json:"version,omitempty"` -} - -// StorageAccount storage resource of type Azure Storage Account. -type StorageAccount struct { - // AccountName - The account name of the Azure Storage Account. - AccountName *string `json:"accountName,omitempty"` - // AccountKey - The account key of the Azure Storage Account. - AccountKey *string `json:"accountKey,omitempty"` - // StorageType - Possible values include: 'StorageTypeStorageProperties', 'StorageTypeStorageAccount' - StorageType StorageType `json:"storageType,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageAccount. -func (sa StorageAccount) MarshalJSON() ([]byte, error) { - sa.StorageType = StorageTypeStorageAccount - objectMap := make(map[string]interface{}) - if sa.AccountName != nil { - objectMap["accountName"] = sa.AccountName - } - if sa.AccountKey != nil { - objectMap["accountKey"] = sa.AccountKey - } - if sa.StorageType != "" { - objectMap["storageType"] = sa.StorageType - } - return json.Marshal(objectMap) -} - -// AsStorageAccount is the BasicStorageProperties implementation for StorageAccount. -func (sa StorageAccount) AsStorageAccount() (*StorageAccount, bool) { - return &sa, true -} - -// AsStorageProperties is the BasicStorageProperties implementation for StorageAccount. -func (sa StorageAccount) AsStorageProperties() (*StorageProperties, bool) { - return nil, false -} - -// AsBasicStorageProperties is the BasicStorageProperties implementation for StorageAccount. -func (sa StorageAccount) AsBasicStorageProperties() (BasicStorageProperties, bool) { - return &sa, true -} - -// BasicStorageProperties storage resource payload. -type BasicStorageProperties interface { - AsStorageAccount() (*StorageAccount, bool) - AsStorageProperties() (*StorageProperties, bool) -} - -// StorageProperties storage resource payload. -type StorageProperties struct { - // StorageType - Possible values include: 'StorageTypeStorageProperties', 'StorageTypeStorageAccount' - StorageType StorageType `json:"storageType,omitempty"` -} - -func unmarshalBasicStorageProperties(body []byte) (BasicStorageProperties, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["storageType"] { - case string(StorageTypeStorageAccount): - var sa StorageAccount - err := json.Unmarshal(body, &sa) - return sa, err - default: - var sp StorageProperties - err := json.Unmarshal(body, &sp) - return sp, err - } -} -func unmarshalBasicStoragePropertiesArray(body []byte) ([]BasicStorageProperties, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - spArray := make([]BasicStorageProperties, len(rawMessages)) - - for index, rawMessage := range rawMessages { - sp, err := unmarshalBasicStorageProperties(*rawMessage) - if err != nil { - return nil, err - } - spArray[index] = sp - } - return spArray, nil -} - -// MarshalJSON is the custom marshaler for StorageProperties. -func (sp StorageProperties) MarshalJSON() ([]byte, error) { - sp.StorageType = StorageTypeStorageProperties - objectMap := make(map[string]interface{}) - if sp.StorageType != "" { - objectMap["storageType"] = sp.StorageType - } - return json.Marshal(objectMap) -} - -// AsStorageAccount is the BasicStorageProperties implementation for StorageProperties. -func (sp StorageProperties) AsStorageAccount() (*StorageAccount, bool) { - return nil, false -} - -// AsStorageProperties is the BasicStorageProperties implementation for StorageProperties. -func (sp StorageProperties) AsStorageProperties() (*StorageProperties, bool) { - return &sp, true -} - -// AsBasicStorageProperties is the BasicStorageProperties implementation for StorageProperties. -func (sp StorageProperties) AsBasicStorageProperties() (BasicStorageProperties, bool) { - return &sp, true -} - -// StorageResource storage resource payload. -type StorageResource struct { - autorest.Response `json:"-"` - // Properties - Properties of the storage resource payload. - Properties BasicStorageProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageResource. -func (sr StorageResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = sr.Properties - if sr.SystemData != nil { - objectMap["systemData"] = sr.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for StorageResource struct. -func (sr *StorageResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - properties, err := unmarshalBasicStorageProperties(*v) - if err != nil { - return err - } - sr.Properties = properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sr.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sr.SystemData = &systemData - } - } - } - - return nil -} - -// StorageResourceCollection collection compose of storage resources list and a possible link for next -// page. -type StorageResourceCollection struct { - autorest.Response `json:"-"` - // Value - The storage resources list. - Value *[]StorageResource `json:"value,omitempty"` - // NextLink - The link to next page of storage list. - NextLink *string `json:"nextLink,omitempty"` -} - -// StorageResourceCollectionIterator provides access to a complete listing of StorageResource values. -type StorageResourceCollectionIterator struct { - i int - page StorageResourceCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *StorageResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/StorageResourceCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *StorageResourceCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter StorageResourceCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter StorageResourceCollectionIterator) Response() StorageResourceCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter StorageResourceCollectionIterator) Value() StorageResource { - if !iter.page.NotDone() { - return StorageResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the StorageResourceCollectionIterator type. -func NewStorageResourceCollectionIterator(page StorageResourceCollectionPage) StorageResourceCollectionIterator { - return StorageResourceCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (src StorageResourceCollection) IsEmpty() bool { - return src.Value == nil || len(*src.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (src StorageResourceCollection) hasNextLink() bool { - return src.NextLink != nil && len(*src.NextLink) != 0 -} - -// storageResourceCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (src StorageResourceCollection) storageResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !src.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(src.NextLink))) -} - -// StorageResourceCollectionPage contains a page of StorageResource values. -type StorageResourceCollectionPage struct { - fn func(context.Context, StorageResourceCollection) (StorageResourceCollection, error) - src StorageResourceCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *StorageResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/StorageResourceCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.src) - if err != nil { - return err - } - page.src = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *StorageResourceCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page StorageResourceCollectionPage) NotDone() bool { - return !page.src.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page StorageResourceCollectionPage) Response() StorageResourceCollection { - return page.src -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page StorageResourceCollectionPage) Values() []StorageResource { - if page.src.IsEmpty() { - return nil - } - return *page.src.Value -} - -// Creates a new instance of the StorageResourceCollectionPage type. -func NewStorageResourceCollectionPage(cur StorageResourceCollection, getNextPage func(context.Context, StorageResourceCollection) (StorageResourceCollection, error)) StorageResourceCollectionPage { - return StorageResourceCollectionPage{ - fn: getNextPage, - src: cur, - } -} - -// StoragesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type StoragesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(StoragesClient) (StorageResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *StoragesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for StoragesCreateOrUpdateFuture.Result. -func (future *StoragesCreateOrUpdateFuture) result(client StoragesClient) (sr StorageResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.StoragesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.StoragesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { - sr, err = client.CreateOrUpdateResponder(sr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.StoragesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") - } - } - return -} - -// StoragesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type StoragesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(StoragesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *StoragesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for StoragesDeleteFuture.Result. -func (future *StoragesDeleteFuture) result(client StoragesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.StoragesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("appplatform.StoragesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SupportedBuildpackResource supported buildpack resource payload -type SupportedBuildpackResource struct { - autorest.Response `json:"-"` - Properties *SupportedBuildpackResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for SupportedBuildpackResource. -func (sbr SupportedBuildpackResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sbr.Properties != nil { - objectMap["properties"] = sbr.Properties - } - if sbr.SystemData != nil { - objectMap["systemData"] = sbr.SystemData - } - return json.Marshal(objectMap) -} - -// SupportedBuildpackResourceProperties supported buildpack resource properties -type SupportedBuildpackResourceProperties struct { - // BuildpackID - The id of supported buildpack - BuildpackID *string `json:"buildpackId,omitempty"` -} - -// SupportedBuildpacksCollection object that includes an array of supported buildpacks resources and a -// possible link for next set -type SupportedBuildpacksCollection struct { - autorest.Response `json:"-"` - // Value - Collection of supported buildpacks resources - Value *[]SupportedBuildpackResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// SupportedRuntimeVersion supported deployment runtime version descriptor. -type SupportedRuntimeVersion struct { - // Value - The raw value which could be passed to deployment CRUD operations. Possible values include: 'SupportedRuntimeValueJava8', 'SupportedRuntimeValueJava11', 'SupportedRuntimeValueJava17', 'SupportedRuntimeValueNetCore31' - Value SupportedRuntimeValue `json:"value,omitempty"` - // Platform - The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: 'SupportedRuntimePlatformJava', 'SupportedRuntimePlatformNETCore' - Platform SupportedRuntimePlatform `json:"platform,omitempty"` - // Version - The detailed version (major.minor) of the platform. - Version *string `json:"version,omitempty"` -} - -// SupportedStackResource supported stack resource payload -type SupportedStackResource struct { - autorest.Response `json:"-"` - Properties *SupportedStackResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for SupportedStackResource. -func (ssr SupportedStackResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ssr.Properties != nil { - objectMap["properties"] = ssr.Properties - } - if ssr.SystemData != nil { - objectMap["systemData"] = ssr.SystemData - } - return json.Marshal(objectMap) -} - -// SupportedStackResourceProperties supported stack resource properties -type SupportedStackResourceProperties struct { - // StackID - The id of supported stack - StackID *string `json:"stackId,omitempty"` - // Version - The version of supported stack - Version *string `json:"version,omitempty"` -} - -// SupportedStacksCollection object that includes an array of supported stacks resources and a possible -// link for next set -type SupportedStacksCollection struct { - autorest.Response `json:"-"` - // Value - Collection of supported stacks resources - Value *[]SupportedStackResource `json:"value,omitempty"` - // NextLink - URL client should use to fetch the next page (per server side paging). - // It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'LastModifiedByTypeUser', 'LastModifiedByTypeApplication', 'LastModifiedByTypeManagedIdentity', 'LastModifiedByTypeKey' - LastModifiedByType LastModifiedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource modification (UTC). - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TemporaryDisk temporary disk payload -type TemporaryDisk struct { - // SizeInGB - Size of the temporary disk in GB - SizeInGB *int32 `json:"sizeInGB,omitempty"` - // MountPath - Mount path of the temporary disk - MountPath *string `json:"mountPath,omitempty"` -} - -// TestKeys test keys payload -type TestKeys struct { - autorest.Response `json:"-"` - // PrimaryKey - Primary key - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - Secondary key - SecondaryKey *string `json:"secondaryKey,omitempty"` - // PrimaryTestEndpoint - Primary test endpoint - PrimaryTestEndpoint *string `json:"primaryTestEndpoint,omitempty"` - // SecondaryTestEndpoint - Secondary test endpoint - SecondaryTestEndpoint *string `json:"secondaryTestEndpoint,omitempty"` - // Enabled - Indicates whether the test endpoint feature enabled or not - Enabled *bool `json:"enabled,omitempty"` -} - -// TrackedResource the resource model definition for a ARM tracked top level resource. -type TrackedResource struct { - // Location - The GEO location of the resource. - Location *string `json:"location,omitempty"` - // Tags - Tags of the service which is a list of key value pairs that describe the resource. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Location != nil { - objectMap["location"] = tr.Location - } - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.SystemData != nil { - objectMap["systemData"] = tr.SystemData - } - return json.Marshal(objectMap) -} - -// TriggeredBuildResult the build result triggered by a build -type TriggeredBuildResult struct { - // ID - The unique build id of this build result - ID *string `json:"id,omitempty"` -} - -// BasicUploadedUserSourceInfo source with uploaded location -type BasicUploadedUserSourceInfo interface { - AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) - AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) - AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) - AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) -} - -// UploadedUserSourceInfo source with uploaded location -type UploadedUserSourceInfo struct { - // RelativePath - Relative path of the storage which stores the source - RelativePath *string `json:"relativePath,omitempty"` - // Version - Version of the source - Version *string `json:"version,omitempty"` - // Type - Possible values include: 'TypeBasicUserSourceInfoTypeUserSourceInfo', 'TypeBasicUserSourceInfoTypeUploadedUserSourceInfo', 'TypeBasicUserSourceInfoTypeJar', 'TypeBasicUserSourceInfoTypeSource', 'TypeBasicUserSourceInfoTypeNetCoreZip', 'TypeBasicUserSourceInfoTypeBuildResult', 'TypeBasicUserSourceInfoTypeContainer' - Type TypeBasicUserSourceInfo `json:"type,omitempty"` -} - -func unmarshalBasicUploadedUserSourceInfo(body []byte) (BasicUploadedUserSourceInfo, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBasicUserSourceInfoTypeJar): - var juusi JarUploadedUserSourceInfo - err := json.Unmarshal(body, &juusi) - return juusi, err - case string(TypeBasicUserSourceInfoTypeSource): - var suusi SourceUploadedUserSourceInfo - err := json.Unmarshal(body, &suusi) - return suusi, err - case string(TypeBasicUserSourceInfoTypeNetCoreZip): - var nczuusi NetCoreZipUploadedUserSourceInfo - err := json.Unmarshal(body, &nczuusi) - return nczuusi, err - default: - var uusi UploadedUserSourceInfo - err := json.Unmarshal(body, &uusi) - return uusi, err - } -} -func unmarshalBasicUploadedUserSourceInfoArray(body []byte) ([]BasicUploadedUserSourceInfo, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - uusiArray := make([]BasicUploadedUserSourceInfo, len(rawMessages)) - - for index, rawMessage := range rawMessages { - uusi, err := unmarshalBasicUploadedUserSourceInfo(*rawMessage) - if err != nil { - return nil, err - } - uusiArray[index] = uusi - } - return uusiArray, nil -} - -// MarshalJSON is the custom marshaler for UploadedUserSourceInfo. -func (uusi UploadedUserSourceInfo) MarshalJSON() ([]byte, error) { - uusi.Type = TypeBasicUserSourceInfoTypeUploadedUserSourceInfo - objectMap := make(map[string]interface{}) - if uusi.RelativePath != nil { - objectMap["relativePath"] = uusi.RelativePath - } - if uusi.Version != nil { - objectMap["version"] = uusi.Version - } - if uusi.Type != "" { - objectMap["type"] = uusi.Type - } - return json.Marshal(objectMap) -} - -// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. -func (uusi UploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { - return &uusi, true -} - -// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. -func (uusi UploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { - return &uusi, true -} - -// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. -func (uusi UploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. -func (uusi UploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. -func (uusi UploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. -func (uusi UploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { - return nil, false -} - -// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. -func (uusi UploadedUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { - return nil, false -} - -// AsUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. -func (uusi UploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { - return nil, false -} - -// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. -func (uusi UploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { - return &uusi, true -} - -// UserAssignedManagedIdentity the details of the user-assigned managed identity assigned to an App. -type UserAssignedManagedIdentity struct { - // PrincipalID - READ-ONLY; Principal Id of user-assigned managed identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - READ-ONLY; Client Id of user-assigned managed identity. - ClientID *string `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserAssignedManagedIdentity. -func (uami UserAssignedManagedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BasicUserSourceInfo source information for a deployment -type BasicUserSourceInfo interface { - AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) - AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) - AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) - AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) - AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) - AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) - AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) - AsUserSourceInfo() (*UserSourceInfo, bool) -} - -// UserSourceInfo source information for a deployment -type UserSourceInfo struct { - // Version - Version of the source - Version *string `json:"version,omitempty"` - // Type - Possible values include: 'TypeBasicUserSourceInfoTypeUserSourceInfo', 'TypeBasicUserSourceInfoTypeUploadedUserSourceInfo', 'TypeBasicUserSourceInfoTypeJar', 'TypeBasicUserSourceInfoTypeSource', 'TypeBasicUserSourceInfoTypeNetCoreZip', 'TypeBasicUserSourceInfoTypeBuildResult', 'TypeBasicUserSourceInfoTypeContainer' - Type TypeBasicUserSourceInfo `json:"type,omitempty"` -} - -func unmarshalBasicUserSourceInfo(body []byte) (BasicUserSourceInfo, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["type"] { - case string(TypeBasicUserSourceInfoTypeUploadedUserSourceInfo): - var uusi UploadedUserSourceInfo - err := json.Unmarshal(body, &uusi) - return uusi, err - case string(TypeBasicUserSourceInfoTypeJar): - var juusi JarUploadedUserSourceInfo - err := json.Unmarshal(body, &juusi) - return juusi, err - case string(TypeBasicUserSourceInfoTypeSource): - var suusi SourceUploadedUserSourceInfo - err := json.Unmarshal(body, &suusi) - return suusi, err - case string(TypeBasicUserSourceInfoTypeNetCoreZip): - var nczuusi NetCoreZipUploadedUserSourceInfo - err := json.Unmarshal(body, &nczuusi) - return nczuusi, err - case string(TypeBasicUserSourceInfoTypeBuildResult): - var brusi BuildResultUserSourceInfo - err := json.Unmarshal(body, &brusi) - return brusi, err - case string(TypeBasicUserSourceInfoTypeContainer): - var ccusi CustomContainerUserSourceInfo - err := json.Unmarshal(body, &ccusi) - return ccusi, err - default: - var usi UserSourceInfo - err := json.Unmarshal(body, &usi) - return usi, err - } -} -func unmarshalBasicUserSourceInfoArray(body []byte) ([]BasicUserSourceInfo, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - usiArray := make([]BasicUserSourceInfo, len(rawMessages)) - - for index, rawMessage := range rawMessages { - usi, err := unmarshalBasicUserSourceInfo(*rawMessage) - if err != nil { - return nil, err - } - usiArray[index] = usi - } - return usiArray, nil -} - -// MarshalJSON is the custom marshaler for UserSourceInfo. -func (usi UserSourceInfo) MarshalJSON() ([]byte, error) { - usi.Type = TypeBasicUserSourceInfoTypeUserSourceInfo - objectMap := make(map[string]interface{}) - if usi.Version != nil { - objectMap["version"] = usi.Version - } - if usi.Type != "" { - objectMap["type"] = usi.Type - } - return json.Marshal(objectMap) -} - -// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. -func (usi UserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { - return nil, false -} - -// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. -func (usi UserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. -func (usi UserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. -func (usi UserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. -func (usi UserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { - return nil, false -} - -// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. -func (usi UserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { - return nil, false -} - -// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. -func (usi UserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { - return nil, false -} - -// AsUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. -func (usi UserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { - return &usi, true -} - -// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. -func (usi UserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { - return &usi, true -} - -// ValidationMessages validate messages of the configuration service git repositories -type ValidationMessages struct { - // Name - The name of the configuration service git repository. - Name *string `json:"name,omitempty"` - // Messages - Detailed validation messages. - Messages *[]string `json:"messages,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/operations.go deleted file mode 100644 index 58e54b8446c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package appplatform - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the REST API for Azure Spring Cloud -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available REST API operations of the Microsoft.AppPlatform provider. -func (client OperationsClient) List(ctx context.Context) (result AvailableOperationsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.ao.Response.Response != nil { - sc = result.ao.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.ao.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.ao, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.ao.hasNextLink() && result.ao.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2022-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.AppPlatform/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result AvailableOperations, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults AvailableOperations) (result AvailableOperations, err error) { - req, err := lastResults.availableOperationsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "appplatform.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "appplatform.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result AvailableOperationsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/skus.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/skus.go deleted file mode 100644 index 042d265e2a4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/skus.go +++ /dev/null @@ -1,144 +0,0 @@ -package appplatform - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SkusClient is the REST API for Azure Spring Cloud -type SkusClient struct { - BaseClient -} - -// NewSkusClient creates an instance of the SkusClient client. -func NewSkusClient(subscriptionID string) SkusClient { - return NewSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSkusClientWithBaseURI creates an instance of the SkusClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSkusClientWithBaseURI(baseURI string, subscriptionID string) SkusClient { - return SkusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available skus of the Microsoft.AppPlatform provider. -func (client SkusClient) List(ctx context.Context) (result ResourceSkuCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SkusClient.List") - defer func() { - sc := -1 - if result.rsc.Response.Response != nil { - sc = result.rsc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rsc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "List", resp, "Failure sending request") - return - } - - result.rsc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "List", resp, "Failure responding to request") - return - } - if result.rsc.hasNextLink() && result.rsc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SkusClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SkusClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SkusClient) ListResponder(resp *http.Response) (result ResourceSkuCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client SkusClient) listNextResults(ctx context.Context, lastResults ResourceSkuCollection) (result ResourceSkuCollection, err error) { - req, err := lastResults.resourceSkuCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "appplatform.SkusClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "appplatform.SkusClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SkusClient) ListComplete(ctx context.Context) (result ResourceSkuCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SkusClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/version.go deleted file mode 100644 index deea37d5b5d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package appplatform - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " appplatform/2022-03-01-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/CHANGELOG.md similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance/CHANGELOG.md rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/CHANGELOG.md diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/_meta.json new file mode 100644 index 00000000000..179e834e916 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "a8a52b9e6c305f03c3a4c5411d59fc4454b5b372", + "readme": "/_/azure-rest-api-specs/specification/appplatform/resource-manager/readme.md", + "tag": "package-preview-2022-05", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2022-05 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/appplatform/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/apiportalcustomdomains.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apiportalcustomdomains.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/apiportalcustomdomains.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apiportalcustomdomains.go index 9d3e2c18616..7db1905ef2e 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/apiportalcustomdomains.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apiportalcustomdomains.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// APIPortalCustomDomainsClient is the REST API for Azure Spring Cloud +// APIPortalCustomDomainsClient is the REST API for Azure Spring Apps type APIPortalCustomDomainsClient struct { BaseClient } @@ -75,7 +75,7 @@ func (client APIPortalCustomDomainsClient) CreateOrUpdatePreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -161,7 +161,7 @@ func (client APIPortalCustomDomainsClient) DeletePreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -251,7 +251,7 @@ func (client APIPortalCustomDomainsClient) GetPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -335,7 +335,7 @@ func (client APIPortalCustomDomainsClient) ListPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/apiportals.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apiportals.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/apiportals.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apiportals.go index a222b672f6f..95fc3eda6bf 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/apiportals.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apiportals.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// APIPortalsClient is the REST API for Azure Spring Cloud +// APIPortalsClient is the REST API for Azure Spring Apps type APIPortalsClient struct { BaseClient } @@ -73,7 +73,7 @@ func (client APIPortalsClient) CreateOrUpdatePreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -157,7 +157,7 @@ func (client APIPortalsClient) DeletePreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -245,7 +245,7 @@ func (client APIPortalsClient) GetPreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -327,7 +327,7 @@ func (client APIPortalsClient) ListPreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -450,7 +450,7 @@ func (client APIPortalsClient) ValidateDomainPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apps.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apps.go new file mode 100644 index 00000000000..a0340125bae --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apps.go @@ -0,0 +1,760 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AppsClient is the REST API for Azure Spring Apps +type AppsClient struct { + BaseClient +} + +// NewAppsClient creates an instance of the AppsClient client. +func NewAppsClient(subscriptionID string) AppsClient { + return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppsClientWithBaseURI creates an instance of the AppsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { + return AppsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new App or update an exiting App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// appResource - parameters for the create or update operation +func (client AppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (result AppsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: appResource, + Constraints: []validation.Constraint{{Target: "appResource.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.TemporaryDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.TemporaryDisk.SizeInGB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.TemporaryDisk.SizeInGB", Name: validation.InclusiveMaximum, Rule: int64(5), Chain: nil}, + {Target: "appResource.Properties.TemporaryDisk.SizeInGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + {Target: "appResource.Properties.PersistentDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.PersistentDisk.SizeInGB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.PersistentDisk.SizeInGB", Name: validation.InclusiveMaximum, Rule: int64(50), Chain: nil}, + {Target: "appResource.Properties.PersistentDisk.SizeInGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "appResource.Properties.PersistentDisk.UsedInGB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.PersistentDisk.UsedInGB", Name: validation.InclusiveMaximum, Rule: int64(50), Chain: nil}, + {Target: "appResource.Properties.PersistentDisk.UsedInGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("appplatform.AppsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, appResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), + autorest.WithJSON(appResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) CreateOrUpdateSender(req *http.Request) (future AppsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AppsClient) CreateOrUpdateResponder(resp *http.Response) (result AppResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete operation to delete an App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result AppsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) DeleteSender(req *http.Request) (future AppsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AppsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get an App and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// syncStatus - indicates whether sync status +func (client AppsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, syncStatus string) (result AppResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, appName, syncStatus) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, syncStatus string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(syncStatus) > 0 { + queryParameters["syncStatus"] = autorest.Encode("query", syncStatus) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AppsClient) GetResponder(resp *http.Response) (result AppResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetResourceUploadURL get an resource upload URL for an App, which may be artifacts or source archive. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +func (client AppsClient) GetResourceUploadURL(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result ResourceUploadDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetResourceUploadURL") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetResourceUploadURLPreparer(ctx, resourceGroupName, serviceName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "GetResourceUploadURL", nil, "Failure preparing request") + return + } + + resp, err := client.GetResourceUploadURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "GetResourceUploadURL", resp, "Failure sending request") + return + } + + result, err = client.GetResourceUploadURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "GetResourceUploadURL", resp, "Failure responding to request") + return + } + + return +} + +// GetResourceUploadURLPreparer prepares the GetResourceUploadURL request. +func (client AppsClient) GetResourceUploadURLPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetResourceUploadURLSender sends the GetResourceUploadURL request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetResourceUploadURLSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResourceUploadURLResponder handles the response to the GetResourceUploadURL request. The method always +// closes the http.Response Body. +func (client AppsClient) GetResourceUploadURLResponder(resp *http.Response) (result ResourceUploadDefinition, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client AppsClient) List(ctx context.Context, resourceGroupName string, serviceName string) (result AppResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.List") + defer func() { + sc := -1 + if result.arc.Response.Response != nil { + sc = result.arc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.arc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", resp, "Failure sending request") + return + } + + result.arc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", resp, "Failure responding to request") + return + } + if result.arc.hasNextLink() && result.arc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AppsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AppsClient) ListResponder(resp *http.Response) (result AppResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AppsClient) listNextResults(ctx context.Context, lastResults AppResourceCollection) (result AppResourceCollection, err error) { + req, err := lastResults.appResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.AppsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.AppsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result AppResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, serviceName) + return +} + +// SetActiveDeployments set existing Deployment under the app as active +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// activeDeploymentCollection - a list of Deployment name to be active. +func (client AppsClient) SetActiveDeployments(ctx context.Context, resourceGroupName string, serviceName string, appName string, activeDeploymentCollection ActiveDeploymentCollection) (result AppsSetActiveDeploymentsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.SetActiveDeployments") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.SetActiveDeploymentsPreparer(ctx, resourceGroupName, serviceName, appName, activeDeploymentCollection) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "SetActiveDeployments", nil, "Failure preparing request") + return + } + + result, err = client.SetActiveDeploymentsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "SetActiveDeployments", result.Response(), "Failure sending request") + return + } + + return +} + +// SetActiveDeploymentsPreparer prepares the SetActiveDeployments request. +func (client AppsClient) SetActiveDeploymentsPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, activeDeploymentCollection ActiveDeploymentCollection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", pathParameters), + autorest.WithJSON(activeDeploymentCollection), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SetActiveDeploymentsSender sends the SetActiveDeployments request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SetActiveDeploymentsSender(req *http.Request) (future AppsSetActiveDeploymentsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// SetActiveDeploymentsResponder handles the response to the SetActiveDeployments request. The method always +// closes the http.Response Body. +func (client AppsClient) SetActiveDeploymentsResponder(resp *http.Response) (result AppResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update operation to update an exiting App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// appResource - parameters for the update operation +func (client AppsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (result AppsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, appName, appResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AppsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), + autorest.WithJSON(appResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) UpdateSender(req *http.Request) (future AppsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AppsClient) UpdateResponder(resp *http.Response) (result AppResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateDomain check the resource name is valid as well as not in use. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// validatePayload - custom domain payload to be validated +func (client AppsClient) ValidateDomain(ctx context.Context, resourceGroupName string, serviceName string, appName string, validatePayload CustomDomainValidatePayload) (result CustomDomainValidateResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ValidateDomain") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: validatePayload, + Constraints: []validation.Constraint{{Target: "validatePayload.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("appplatform.AppsClient", "ValidateDomain", err.Error()) + } + + req, err := client.ValidateDomainPreparer(ctx, resourceGroupName, serviceName, appName, validatePayload) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "ValidateDomain", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "ValidateDomain", resp, "Failure sending request") + return + } + + result, err = client.ValidateDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "ValidateDomain", resp, "Failure responding to request") + return + } + + return +} + +// ValidateDomainPreparer prepares the ValidateDomain request. +func (client AppsClient) ValidateDomainPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, validatePayload CustomDomainValidatePayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", pathParameters), + autorest.WithJSON(validatePayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateDomainSender sends the ValidateDomain request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ValidateDomainSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateDomainResponder handles the response to the ValidateDomain request. The method always +// closes the http.Response Body. +func (client AppsClient) ValidateDomainResponder(resp *http.Response) (result CustomDomainValidateResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/bindings.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/bindings.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/bindings.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/bindings.go index 295d7db312b..9b96c17bf86 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/bindings.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/bindings.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// BindingsClient is the REST API for Azure Spring Cloud +// BindingsClient is the REST API for Azure Spring Apps type BindingsClient struct { BaseClient } @@ -74,7 +74,7 @@ func (client BindingsClient) CreateOrUpdatePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -160,7 +160,7 @@ func (client BindingsClient) DeletePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -250,7 +250,7 @@ func (client BindingsClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -334,7 +334,7 @@ func (client BindingsClient) ListPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -446,7 +446,7 @@ func (client BindingsClient) UpdatePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/buildpackbinding.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildpackbinding.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/buildpackbinding.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildpackbinding.go index ef012ede250..3ec8827e1ce 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/buildpackbinding.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildpackbinding.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// BuildpackBindingClient is the REST API for Azure Spring Cloud +// BuildpackBindingClient is the REST API for Azure Spring Apps type BuildpackBindingClient struct { BaseClient } @@ -77,7 +77,7 @@ func (client BuildpackBindingClient) CreateOrUpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -165,7 +165,7 @@ func (client BuildpackBindingClient) DeletePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -257,7 +257,7 @@ func (client BuildpackBindingClient) GetPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -343,7 +343,7 @@ func (client BuildpackBindingClient) ListPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/buildservice.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildservice.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/buildservice.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildservice.go index 60108e5e3d7..9df212a46cc 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/buildservice.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildservice.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// BuildServiceClient is the REST API for Azure Spring Cloud +// BuildServiceClient is the REST API for Azure Spring Apps type BuildServiceClient struct { BaseClient } @@ -81,7 +81,7 @@ func (client BuildServiceClient) CreateOrUpdateBuildPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -164,7 +164,7 @@ func (client BuildServiceClient) GetBuildPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -247,7 +247,7 @@ func (client BuildServiceClient) GetBuildResultPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -330,7 +330,7 @@ func (client BuildServiceClient) GetBuildResultLogPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -409,7 +409,7 @@ func (client BuildServiceClient) GetBuildServicePreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -488,7 +488,7 @@ func (client BuildServiceClient) GetResourceUploadURLPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -569,7 +569,7 @@ func (client BuildServiceClient) GetSupportedBuildpackPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -650,7 +650,7 @@ func (client BuildServiceClient) GetSupportedStackPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -736,7 +736,7 @@ func (client BuildServiceClient) ListBuildResultsPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -857,7 +857,7 @@ func (client BuildServiceClient) ListBuildsPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -976,7 +976,7 @@ func (client BuildServiceClient) ListBuildServicesPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1092,7 +1092,7 @@ func (client BuildServiceClient) ListSupportedBuildpacksPreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1171,7 +1171,7 @@ func (client BuildServiceClient) ListSupportedStacksPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/buildserviceagentpool.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildserviceagentpool.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/buildserviceagentpool.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildserviceagentpool.go index 9128a9bae2b..e9ff5644599 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/buildserviceagentpool.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildserviceagentpool.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// BuildServiceAgentPoolClient is the REST API for Azure Spring Cloud +// BuildServiceAgentPoolClient is the REST API for Azure Spring Apps type BuildServiceAgentPoolClient struct { BaseClient } @@ -81,7 +81,7 @@ func (client BuildServiceAgentPoolClient) GetPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -165,7 +165,7 @@ func (client BuildServiceAgentPoolClient) ListPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -277,7 +277,7 @@ func (client BuildServiceAgentPoolClient) UpdatePutPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/buildservicebuilder.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildservicebuilder.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/buildservicebuilder.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildservicebuilder.go index 072806cc59d..0af93994c57 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/buildservicebuilder.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildservicebuilder.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// BuildServiceBuilderClient is the REST API for Azure Spring Cloud +// BuildServiceBuilderClient is the REST API for Azure Spring Apps type BuildServiceBuilderClient struct { BaseClient } @@ -75,7 +75,7 @@ func (client BuildServiceBuilderClient) CreateOrUpdatePreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -161,7 +161,7 @@ func (client BuildServiceBuilderClient) DeletePreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -251,7 +251,7 @@ func (client BuildServiceBuilderClient) GetPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -335,7 +335,7 @@ func (client BuildServiceBuilderClient) ListPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/certificates.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/certificates.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/certificates.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/certificates.go index f3bc4c1932f..28d323fcb2a 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/certificates.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/certificates.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// CertificatesClient is the REST API for Azure Spring Cloud +// CertificatesClient is the REST API for Azure Spring Apps type CertificatesClient struct { BaseClient } @@ -72,7 +72,7 @@ func (client CertificatesClient) CreateOrUpdatePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -156,7 +156,7 @@ func (client CertificatesClient) DeletePreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -244,7 +244,7 @@ func (client CertificatesClient) GetPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -326,7 +326,7 @@ func (client CertificatesClient) ListPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/client.go new file mode 100644 index 00000000000..1cea2e3bec9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/client.go @@ -0,0 +1,41 @@ +// Package appplatform implements the Azure ARM Appplatform service API version 2022-05-01-preview. +// +// REST API for Azure Spring Apps +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Appplatform + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Appplatform. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/configservers.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/configservers.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/configservers.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/configservers.go index ac40cc94af3..d810a1543ab 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/configservers.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/configservers.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// ConfigServersClient is the REST API for Azure Spring Cloud +// ConfigServersClient is the REST API for Azure Spring Apps type ConfigServersClient struct { BaseClient } @@ -77,7 +77,7 @@ func (client ConfigServersClient) GetPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -148,7 +148,7 @@ func (client ConfigServersClient) UpdatePatchPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -242,7 +242,7 @@ func (client ConfigServersClient) UpdatePutPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -332,7 +332,7 @@ func (client ConfigServersClient) ValidatePreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/configurationservices.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/configurationservices.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/configurationservices.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/configurationservices.go index 65ac8ae6b71..76e47567286 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/configurationservices.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/configurationservices.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// ConfigurationServicesClient is the REST API for Azure Spring Cloud +// ConfigurationServicesClient is the REST API for Azure Spring Apps type ConfigurationServicesClient struct { BaseClient } @@ -74,7 +74,7 @@ func (client ConfigurationServicesClient) CreateOrUpdatePreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -158,7 +158,7 @@ func (client ConfigurationServicesClient) DeletePreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -246,7 +246,7 @@ func (client ConfigurationServicesClient) GetPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -328,7 +328,7 @@ func (client ConfigurationServicesClient) ListPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -438,7 +438,7 @@ func (client ConfigurationServicesClient) ValidatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/customdomains.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/customdomains.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/customdomains.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/customdomains.go index 7b3ef4244b6..7f628c6cd73 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/customdomains.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/customdomains.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// CustomDomainsClient is the REST API for Azure Spring Cloud +// CustomDomainsClient is the REST API for Azure Spring Apps type CustomDomainsClient struct { BaseClient } @@ -74,7 +74,7 @@ func (client CustomDomainsClient) CreateOrUpdatePreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -160,7 +160,7 @@ func (client CustomDomainsClient) DeletePreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -250,7 +250,7 @@ func (client CustomDomainsClient) GetPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -334,7 +334,7 @@ func (client CustomDomainsClient) ListPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -446,7 +446,7 @@ func (client CustomDomainsClient) UpdatePreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/deployments.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/deployments.go similarity index 96% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/deployments.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/deployments.go index 188fc5203d7..e1a456e48c0 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/deployments.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/deployments.go @@ -10,11 +10,12 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/tracing" "net/http" ) -// DeploymentsClient is the REST API for Azure Spring Cloud +// DeploymentsClient is the REST API for Azure Spring Apps type DeploymentsClient struct { BaseClient } @@ -49,6 +50,21 @@ func (client DeploymentsClient) CreateOrUpdate(ctx context.Context, resourceGrou tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: deploymentResource, + Constraints: []validation.Constraint{{Target: "deploymentResource.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.LivenessProbe", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.LivenessProbe.DisableProbe", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "deploymentResource.Properties.DeploymentSettings.ReadinessProbe", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.ReadinessProbe.DisableProbe", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "deploymentResource.Properties.DeploymentSettings.StartupProbe", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.StartupProbe.DisableProbe", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("appplatform.DeploymentsClient", "CreateOrUpdate", err.Error()) + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, deploymentResource) if err != nil { err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request") @@ -74,7 +90,7 @@ func (client DeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -160,7 +176,7 @@ func (client DeploymentsClient) DeletePreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -244,7 +260,7 @@ func (client DeploymentsClient) GenerateHeapDumpPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -330,7 +346,7 @@ func (client DeploymentsClient) GenerateThreadDumpPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -422,7 +438,7 @@ func (client DeploymentsClient) GetPreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -503,7 +519,7 @@ func (client DeploymentsClient) GetLogFileURLPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -588,7 +604,7 @@ func (client DeploymentsClient) ListPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -711,7 +727,7 @@ func (client DeploymentsClient) ListForClusterPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -825,7 +841,7 @@ func (client DeploymentsClient) RestartPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -908,7 +924,7 @@ func (client DeploymentsClient) StartPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -992,7 +1008,7 @@ func (client DeploymentsClient) StartJFRPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1077,7 +1093,7 @@ func (client DeploymentsClient) StopPreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1161,7 +1177,7 @@ func (client DeploymentsClient) UpdatePreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/enums.go new file mode 100644 index 00000000000..2408ff5bec7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/enums.go @@ -0,0 +1,710 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // ActionTypeInternal ... + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ActionTypeInternal} +} + +// APIPortalProvisioningState enumerates the values for api portal provisioning state. +type APIPortalProvisioningState string + +const ( + // APIPortalProvisioningStateCreating ... + APIPortalProvisioningStateCreating APIPortalProvisioningState = "Creating" + // APIPortalProvisioningStateDeleting ... + APIPortalProvisioningStateDeleting APIPortalProvisioningState = "Deleting" + // APIPortalProvisioningStateFailed ... + APIPortalProvisioningStateFailed APIPortalProvisioningState = "Failed" + // APIPortalProvisioningStateSucceeded ... + APIPortalProvisioningStateSucceeded APIPortalProvisioningState = "Succeeded" + // APIPortalProvisioningStateUpdating ... + APIPortalProvisioningStateUpdating APIPortalProvisioningState = "Updating" +) + +// PossibleAPIPortalProvisioningStateValues returns an array of possible values for the APIPortalProvisioningState const type. +func PossibleAPIPortalProvisioningStateValues() []APIPortalProvisioningState { + return []APIPortalProvisioningState{APIPortalProvisioningStateCreating, APIPortalProvisioningStateDeleting, APIPortalProvisioningStateFailed, APIPortalProvisioningStateSucceeded, APIPortalProvisioningStateUpdating} +} + +// AppResourceProvisioningState enumerates the values for app resource provisioning state. +type AppResourceProvisioningState string + +const ( + // AppResourceProvisioningStateCreating ... + AppResourceProvisioningStateCreating AppResourceProvisioningState = "Creating" + // AppResourceProvisioningStateDeleting ... + AppResourceProvisioningStateDeleting AppResourceProvisioningState = "Deleting" + // AppResourceProvisioningStateFailed ... + AppResourceProvisioningStateFailed AppResourceProvisioningState = "Failed" + // AppResourceProvisioningStateSucceeded ... + AppResourceProvisioningStateSucceeded AppResourceProvisioningState = "Succeeded" + // AppResourceProvisioningStateUpdating ... + AppResourceProvisioningStateUpdating AppResourceProvisioningState = "Updating" +) + +// PossibleAppResourceProvisioningStateValues returns an array of possible values for the AppResourceProvisioningState const type. +func PossibleAppResourceProvisioningStateValues() []AppResourceProvisioningState { + return []AppResourceProvisioningState{AppResourceProvisioningStateCreating, AppResourceProvisioningStateDeleting, AppResourceProvisioningStateFailed, AppResourceProvisioningStateSucceeded, AppResourceProvisioningStateUpdating} +} + +// BindingType enumerates the values for binding type. +type BindingType string + +const ( + // BindingTypeApacheSkyWalking ... + BindingTypeApacheSkyWalking BindingType = "ApacheSkyWalking" + // BindingTypeAppDynamics ... + BindingTypeAppDynamics BindingType = "AppDynamics" + // BindingTypeApplicationInsights ... + BindingTypeApplicationInsights BindingType = "ApplicationInsights" + // BindingTypeDynatrace ... + BindingTypeDynatrace BindingType = "Dynatrace" + // BindingTypeElasticAPM ... + BindingTypeElasticAPM BindingType = "ElasticAPM" + // BindingTypeNewRelic ... + BindingTypeNewRelic BindingType = "NewRelic" +) + +// PossibleBindingTypeValues returns an array of possible values for the BindingType const type. +func PossibleBindingTypeValues() []BindingType { + return []BindingType{BindingTypeApacheSkyWalking, BindingTypeAppDynamics, BindingTypeApplicationInsights, BindingTypeDynatrace, BindingTypeElasticAPM, BindingTypeNewRelic} +} + +// BuilderProvisioningState enumerates the values for builder provisioning state. +type BuilderProvisioningState string + +const ( + // BuilderProvisioningStateCreating ... + BuilderProvisioningStateCreating BuilderProvisioningState = "Creating" + // BuilderProvisioningStateDeleting ... + BuilderProvisioningStateDeleting BuilderProvisioningState = "Deleting" + // BuilderProvisioningStateFailed ... + BuilderProvisioningStateFailed BuilderProvisioningState = "Failed" + // BuilderProvisioningStateSucceeded ... + BuilderProvisioningStateSucceeded BuilderProvisioningState = "Succeeded" + // BuilderProvisioningStateUpdating ... + BuilderProvisioningStateUpdating BuilderProvisioningState = "Updating" +) + +// PossibleBuilderProvisioningStateValues returns an array of possible values for the BuilderProvisioningState const type. +func PossibleBuilderProvisioningStateValues() []BuilderProvisioningState { + return []BuilderProvisioningState{BuilderProvisioningStateCreating, BuilderProvisioningStateDeleting, BuilderProvisioningStateFailed, BuilderProvisioningStateSucceeded, BuilderProvisioningStateUpdating} +} + +// BuildpackBindingProvisioningState enumerates the values for buildpack binding provisioning state. +type BuildpackBindingProvisioningState string + +const ( + // BuildpackBindingProvisioningStateCreating ... + BuildpackBindingProvisioningStateCreating BuildpackBindingProvisioningState = "Creating" + // BuildpackBindingProvisioningStateDeleting ... + BuildpackBindingProvisioningStateDeleting BuildpackBindingProvisioningState = "Deleting" + // BuildpackBindingProvisioningStateFailed ... + BuildpackBindingProvisioningStateFailed BuildpackBindingProvisioningState = "Failed" + // BuildpackBindingProvisioningStateSucceeded ... + BuildpackBindingProvisioningStateSucceeded BuildpackBindingProvisioningState = "Succeeded" + // BuildpackBindingProvisioningStateUpdating ... + BuildpackBindingProvisioningStateUpdating BuildpackBindingProvisioningState = "Updating" +) + +// PossibleBuildpackBindingProvisioningStateValues returns an array of possible values for the BuildpackBindingProvisioningState const type. +func PossibleBuildpackBindingProvisioningStateValues() []BuildpackBindingProvisioningState { + return []BuildpackBindingProvisioningState{BuildpackBindingProvisioningStateCreating, BuildpackBindingProvisioningStateDeleting, BuildpackBindingProvisioningStateFailed, BuildpackBindingProvisioningStateSucceeded, BuildpackBindingProvisioningStateUpdating} +} + +// BuildProvisioningState enumerates the values for build provisioning state. +type BuildProvisioningState string + +const ( + // BuildProvisioningStateCreating ... + BuildProvisioningStateCreating BuildProvisioningState = "Creating" + // BuildProvisioningStateDeleting ... + BuildProvisioningStateDeleting BuildProvisioningState = "Deleting" + // BuildProvisioningStateFailed ... + BuildProvisioningStateFailed BuildProvisioningState = "Failed" + // BuildProvisioningStateSucceeded ... + BuildProvisioningStateSucceeded BuildProvisioningState = "Succeeded" + // BuildProvisioningStateUpdating ... + BuildProvisioningStateUpdating BuildProvisioningState = "Updating" +) + +// PossibleBuildProvisioningStateValues returns an array of possible values for the BuildProvisioningState const type. +func PossibleBuildProvisioningStateValues() []BuildProvisioningState { + return []BuildProvisioningState{BuildProvisioningStateCreating, BuildProvisioningStateDeleting, BuildProvisioningStateFailed, BuildProvisioningStateSucceeded, BuildProvisioningStateUpdating} +} + +// BuildResultProvisioningState enumerates the values for build result provisioning state. +type BuildResultProvisioningState string + +const ( + // BuildResultProvisioningStateBuilding ... + BuildResultProvisioningStateBuilding BuildResultProvisioningState = "Building" + // BuildResultProvisioningStateDeleting ... + BuildResultProvisioningStateDeleting BuildResultProvisioningState = "Deleting" + // BuildResultProvisioningStateFailed ... + BuildResultProvisioningStateFailed BuildResultProvisioningState = "Failed" + // BuildResultProvisioningStateQueuing ... + BuildResultProvisioningStateQueuing BuildResultProvisioningState = "Queuing" + // BuildResultProvisioningStateSucceeded ... + BuildResultProvisioningStateSucceeded BuildResultProvisioningState = "Succeeded" +) + +// PossibleBuildResultProvisioningStateValues returns an array of possible values for the BuildResultProvisioningState const type. +func PossibleBuildResultProvisioningStateValues() []BuildResultProvisioningState { + return []BuildResultProvisioningState{BuildResultProvisioningStateBuilding, BuildResultProvisioningStateDeleting, BuildResultProvisioningStateFailed, BuildResultProvisioningStateQueuing, BuildResultProvisioningStateSucceeded} +} + +// BuildServiceProvisioningState enumerates the values for build service provisioning state. +type BuildServiceProvisioningState string + +const ( + // BuildServiceProvisioningStateCreating ... + BuildServiceProvisioningStateCreating BuildServiceProvisioningState = "Creating" + // BuildServiceProvisioningStateDeleting ... + BuildServiceProvisioningStateDeleting BuildServiceProvisioningState = "Deleting" + // BuildServiceProvisioningStateFailed ... + BuildServiceProvisioningStateFailed BuildServiceProvisioningState = "Failed" + // BuildServiceProvisioningStateSucceeded ... + BuildServiceProvisioningStateSucceeded BuildServiceProvisioningState = "Succeeded" + // BuildServiceProvisioningStateUpdating ... + BuildServiceProvisioningStateUpdating BuildServiceProvisioningState = "Updating" +) + +// PossibleBuildServiceProvisioningStateValues returns an array of possible values for the BuildServiceProvisioningState const type. +func PossibleBuildServiceProvisioningStateValues() []BuildServiceProvisioningState { + return []BuildServiceProvisioningState{BuildServiceProvisioningStateCreating, BuildServiceProvisioningStateDeleting, BuildServiceProvisioningStateFailed, BuildServiceProvisioningStateSucceeded, BuildServiceProvisioningStateUpdating} +} + +// CertificateResourceProvisioningState enumerates the values for certificate resource provisioning state. +type CertificateResourceProvisioningState string + +const ( + // CertificateResourceProvisioningStateCreating ... + CertificateResourceProvisioningStateCreating CertificateResourceProvisioningState = "Creating" + // CertificateResourceProvisioningStateDeleting ... + CertificateResourceProvisioningStateDeleting CertificateResourceProvisioningState = "Deleting" + // CertificateResourceProvisioningStateFailed ... + CertificateResourceProvisioningStateFailed CertificateResourceProvisioningState = "Failed" + // CertificateResourceProvisioningStateSucceeded ... + CertificateResourceProvisioningStateSucceeded CertificateResourceProvisioningState = "Succeeded" + // CertificateResourceProvisioningStateUpdating ... + CertificateResourceProvisioningStateUpdating CertificateResourceProvisioningState = "Updating" +) + +// PossibleCertificateResourceProvisioningStateValues returns an array of possible values for the CertificateResourceProvisioningState const type. +func PossibleCertificateResourceProvisioningStateValues() []CertificateResourceProvisioningState { + return []CertificateResourceProvisioningState{CertificateResourceProvisioningStateCreating, CertificateResourceProvisioningStateDeleting, CertificateResourceProvisioningStateFailed, CertificateResourceProvisioningStateSucceeded, CertificateResourceProvisioningStateUpdating} +} + +// ConfigServerState enumerates the values for config server state. +type ConfigServerState string + +const ( + // ConfigServerStateDeleted ... + ConfigServerStateDeleted ConfigServerState = "Deleted" + // ConfigServerStateFailed ... + ConfigServerStateFailed ConfigServerState = "Failed" + // ConfigServerStateNotAvailable ... + ConfigServerStateNotAvailable ConfigServerState = "NotAvailable" + // ConfigServerStateSucceeded ... + ConfigServerStateSucceeded ConfigServerState = "Succeeded" + // ConfigServerStateUpdating ... + ConfigServerStateUpdating ConfigServerState = "Updating" +) + +// PossibleConfigServerStateValues returns an array of possible values for the ConfigServerState const type. +func PossibleConfigServerStateValues() []ConfigServerState { + return []ConfigServerState{ConfigServerStateDeleted, ConfigServerStateFailed, ConfigServerStateNotAvailable, ConfigServerStateSucceeded, ConfigServerStateUpdating} +} + +// ConfigurationServiceProvisioningState enumerates the values for configuration service provisioning state. +type ConfigurationServiceProvisioningState string + +const ( + // ConfigurationServiceProvisioningStateCreating ... + ConfigurationServiceProvisioningStateCreating ConfigurationServiceProvisioningState = "Creating" + // ConfigurationServiceProvisioningStateDeleting ... + ConfigurationServiceProvisioningStateDeleting ConfigurationServiceProvisioningState = "Deleting" + // ConfigurationServiceProvisioningStateFailed ... + ConfigurationServiceProvisioningStateFailed ConfigurationServiceProvisioningState = "Failed" + // ConfigurationServiceProvisioningStateSucceeded ... + ConfigurationServiceProvisioningStateSucceeded ConfigurationServiceProvisioningState = "Succeeded" + // ConfigurationServiceProvisioningStateUpdating ... + ConfigurationServiceProvisioningStateUpdating ConfigurationServiceProvisioningState = "Updating" +) + +// PossibleConfigurationServiceProvisioningStateValues returns an array of possible values for the ConfigurationServiceProvisioningState const type. +func PossibleConfigurationServiceProvisioningStateValues() []ConfigurationServiceProvisioningState { + return []ConfigurationServiceProvisioningState{ConfigurationServiceProvisioningStateCreating, ConfigurationServiceProvisioningStateDeleting, ConfigurationServiceProvisioningStateFailed, ConfigurationServiceProvisioningStateSucceeded, ConfigurationServiceProvisioningStateUpdating} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// CustomDomainResourceProvisioningState enumerates the values for custom domain resource provisioning state. +type CustomDomainResourceProvisioningState string + +const ( + // CustomDomainResourceProvisioningStateCreating ... + CustomDomainResourceProvisioningStateCreating CustomDomainResourceProvisioningState = "Creating" + // CustomDomainResourceProvisioningStateDeleting ... + CustomDomainResourceProvisioningStateDeleting CustomDomainResourceProvisioningState = "Deleting" + // CustomDomainResourceProvisioningStateFailed ... + CustomDomainResourceProvisioningStateFailed CustomDomainResourceProvisioningState = "Failed" + // CustomDomainResourceProvisioningStateSucceeded ... + CustomDomainResourceProvisioningStateSucceeded CustomDomainResourceProvisioningState = "Succeeded" + // CustomDomainResourceProvisioningStateUpdating ... + CustomDomainResourceProvisioningStateUpdating CustomDomainResourceProvisioningState = "Updating" +) + +// PossibleCustomDomainResourceProvisioningStateValues returns an array of possible values for the CustomDomainResourceProvisioningState const type. +func PossibleCustomDomainResourceProvisioningStateValues() []CustomDomainResourceProvisioningState { + return []CustomDomainResourceProvisioningState{CustomDomainResourceProvisioningStateCreating, CustomDomainResourceProvisioningStateDeleting, CustomDomainResourceProvisioningStateFailed, CustomDomainResourceProvisioningStateSucceeded, CustomDomainResourceProvisioningStateUpdating} +} + +// DeploymentResourceProvisioningState enumerates the values for deployment resource provisioning state. +type DeploymentResourceProvisioningState string + +const ( + // DeploymentResourceProvisioningStateCreating ... + DeploymentResourceProvisioningStateCreating DeploymentResourceProvisioningState = "Creating" + // DeploymentResourceProvisioningStateFailed ... + DeploymentResourceProvisioningStateFailed DeploymentResourceProvisioningState = "Failed" + // DeploymentResourceProvisioningStateSucceeded ... + DeploymentResourceProvisioningStateSucceeded DeploymentResourceProvisioningState = "Succeeded" + // DeploymentResourceProvisioningStateUpdating ... + DeploymentResourceProvisioningStateUpdating DeploymentResourceProvisioningState = "Updating" +) + +// PossibleDeploymentResourceProvisioningStateValues returns an array of possible values for the DeploymentResourceProvisioningState const type. +func PossibleDeploymentResourceProvisioningStateValues() []DeploymentResourceProvisioningState { + return []DeploymentResourceProvisioningState{DeploymentResourceProvisioningStateCreating, DeploymentResourceProvisioningStateFailed, DeploymentResourceProvisioningStateSucceeded, DeploymentResourceProvisioningStateUpdating} +} + +// DeploymentResourceStatus enumerates the values for deployment resource status. +type DeploymentResourceStatus string + +const ( + // DeploymentResourceStatusRunning ... + DeploymentResourceStatusRunning DeploymentResourceStatus = "Running" + // DeploymentResourceStatusStopped ... + DeploymentResourceStatusStopped DeploymentResourceStatus = "Stopped" +) + +// PossibleDeploymentResourceStatusValues returns an array of possible values for the DeploymentResourceStatus const type. +func PossibleDeploymentResourceStatusValues() []DeploymentResourceStatus { + return []DeploymentResourceStatus{DeploymentResourceStatusRunning, DeploymentResourceStatusStopped} +} + +// GatewayProvisioningState enumerates the values for gateway provisioning state. +type GatewayProvisioningState string + +const ( + // GatewayProvisioningStateCreating ... + GatewayProvisioningStateCreating GatewayProvisioningState = "Creating" + // GatewayProvisioningStateDeleting ... + GatewayProvisioningStateDeleting GatewayProvisioningState = "Deleting" + // GatewayProvisioningStateFailed ... + GatewayProvisioningStateFailed GatewayProvisioningState = "Failed" + // GatewayProvisioningStateSucceeded ... + GatewayProvisioningStateSucceeded GatewayProvisioningState = "Succeeded" + // GatewayProvisioningStateUpdating ... + GatewayProvisioningStateUpdating GatewayProvisioningState = "Updating" +) + +// PossibleGatewayProvisioningStateValues returns an array of possible values for the GatewayProvisioningState const type. +func PossibleGatewayProvisioningStateValues() []GatewayProvisioningState { + return []GatewayProvisioningState{GatewayProvisioningStateCreating, GatewayProvisioningStateDeleting, GatewayProvisioningStateFailed, GatewayProvisioningStateSucceeded, GatewayProvisioningStateUpdating} +} + +// HTTPSchemeType enumerates the values for http scheme type. +type HTTPSchemeType string + +const ( + // HTTPSchemeTypeHTTP ... + HTTPSchemeTypeHTTP HTTPSchemeType = "HTTP" + // HTTPSchemeTypeHTTPS ... + HTTPSchemeTypeHTTPS HTTPSchemeType = "HTTPS" +) + +// PossibleHTTPSchemeTypeValues returns an array of possible values for the HTTPSchemeType const type. +func PossibleHTTPSchemeTypeValues() []HTTPSchemeType { + return []HTTPSchemeType{HTTPSchemeTypeHTTP, HTTPSchemeTypeHTTPS} +} + +// KPackBuildStageProvisioningState enumerates the values for k pack build stage provisioning state. +type KPackBuildStageProvisioningState string + +const ( + // KPackBuildStageProvisioningStateFailed ... + KPackBuildStageProvisioningStateFailed KPackBuildStageProvisioningState = "Failed" + // KPackBuildStageProvisioningStateNotStarted ... + KPackBuildStageProvisioningStateNotStarted KPackBuildStageProvisioningState = "NotStarted" + // KPackBuildStageProvisioningStateRunning ... + KPackBuildStageProvisioningStateRunning KPackBuildStageProvisioningState = "Running" + // KPackBuildStageProvisioningStateSucceeded ... + KPackBuildStageProvisioningStateSucceeded KPackBuildStageProvisioningState = "Succeeded" +) + +// PossibleKPackBuildStageProvisioningStateValues returns an array of possible values for the KPackBuildStageProvisioningState const type. +func PossibleKPackBuildStageProvisioningStateValues() []KPackBuildStageProvisioningState { + return []KPackBuildStageProvisioningState{KPackBuildStageProvisioningStateFailed, KPackBuildStageProvisioningStateNotStarted, KPackBuildStageProvisioningStateRunning, KPackBuildStageProvisioningStateSucceeded} +} + +// LastModifiedByType enumerates the values for last modified by type. +type LastModifiedByType string + +const ( + // LastModifiedByTypeApplication ... + LastModifiedByTypeApplication LastModifiedByType = "Application" + // LastModifiedByTypeKey ... + LastModifiedByTypeKey LastModifiedByType = "Key" + // LastModifiedByTypeManagedIdentity ... + LastModifiedByTypeManagedIdentity LastModifiedByType = "ManagedIdentity" + // LastModifiedByTypeUser ... + LastModifiedByTypeUser LastModifiedByType = "User" +) + +// PossibleLastModifiedByTypeValues returns an array of possible values for the LastModifiedByType const type. +func PossibleLastModifiedByTypeValues() []LastModifiedByType { + return []LastModifiedByType{LastModifiedByTypeApplication, LastModifiedByTypeKey, LastModifiedByTypeManagedIdentity, LastModifiedByTypeUser} +} + +// ManagedIdentityType enumerates the values for managed identity type. +type ManagedIdentityType string + +const ( + // ManagedIdentityTypeNone ... + ManagedIdentityTypeNone ManagedIdentityType = "None" + // ManagedIdentityTypeSystemAssigned ... + ManagedIdentityTypeSystemAssigned ManagedIdentityType = "SystemAssigned" + // ManagedIdentityTypeSystemAssignedUserAssigned ... + ManagedIdentityTypeSystemAssignedUserAssigned ManagedIdentityType = "SystemAssigned,UserAssigned" + // ManagedIdentityTypeUserAssigned ... + ManagedIdentityTypeUserAssigned ManagedIdentityType = "UserAssigned" +) + +// PossibleManagedIdentityTypeValues returns an array of possible values for the ManagedIdentityType const type. +func PossibleManagedIdentityTypeValues() []ManagedIdentityType { + return []ManagedIdentityType{ManagedIdentityTypeNone, ManagedIdentityTypeSystemAssigned, ManagedIdentityTypeSystemAssignedUserAssigned, ManagedIdentityTypeUserAssigned} +} + +// MonitoringSettingState enumerates the values for monitoring setting state. +type MonitoringSettingState string + +const ( + // MonitoringSettingStateFailed ... + MonitoringSettingStateFailed MonitoringSettingState = "Failed" + // MonitoringSettingStateNotAvailable ... + MonitoringSettingStateNotAvailable MonitoringSettingState = "NotAvailable" + // MonitoringSettingStateSucceeded ... + MonitoringSettingStateSucceeded MonitoringSettingState = "Succeeded" + // MonitoringSettingStateUpdating ... + MonitoringSettingStateUpdating MonitoringSettingState = "Updating" +) + +// PossibleMonitoringSettingStateValues returns an array of possible values for the MonitoringSettingState const type. +func PossibleMonitoringSettingStateValues() []MonitoringSettingState { + return []MonitoringSettingState{MonitoringSettingStateFailed, MonitoringSettingStateNotAvailable, MonitoringSettingStateSucceeded, MonitoringSettingStateUpdating} +} + +// PowerState enumerates the values for power state. +type PowerState string + +const ( + // PowerStateRunning ... + PowerStateRunning PowerState = "Running" + // PowerStateStopped ... + PowerStateStopped PowerState = "Stopped" +) + +// PossiblePowerStateValues returns an array of possible values for the PowerState const type. +func PossiblePowerStateValues() []PowerState { + return []PowerState{PowerStateRunning, PowerStateStopped} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleted ... + ProvisioningStateDeleted ProvisioningState = "Deleted" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateMoved ... + ProvisioningStateMoved ProvisioningState = "Moved" + // ProvisioningStateMoveFailed ... + ProvisioningStateMoveFailed ProvisioningState = "MoveFailed" + // ProvisioningStateMoving ... + ProvisioningStateMoving ProvisioningState = "Moving" + // ProvisioningStateStarting ... + ProvisioningStateStarting ProvisioningState = "Starting" + // ProvisioningStateStopping ... + ProvisioningStateStopping ProvisioningState = "Stopping" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoved, ProvisioningStateMoveFailed, ProvisioningStateMoving, ProvisioningStateStarting, ProvisioningStateStopping, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// ResourceSkuRestrictionsReasonCode enumerates the values for resource sku restrictions reason code. +type ResourceSkuRestrictionsReasonCode string + +const ( + // ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription ... + ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription ResourceSkuRestrictionsReasonCode = "NotAvailableForSubscription" + // ResourceSkuRestrictionsReasonCodeQuotaID ... + ResourceSkuRestrictionsReasonCodeQuotaID ResourceSkuRestrictionsReasonCode = "QuotaId" +) + +// PossibleResourceSkuRestrictionsReasonCodeValues returns an array of possible values for the ResourceSkuRestrictionsReasonCode const type. +func PossibleResourceSkuRestrictionsReasonCodeValues() []ResourceSkuRestrictionsReasonCode { + return []ResourceSkuRestrictionsReasonCode{ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription, ResourceSkuRestrictionsReasonCodeQuotaID} +} + +// ResourceSkuRestrictionsType enumerates the values for resource sku restrictions type. +type ResourceSkuRestrictionsType string + +const ( + // ResourceSkuRestrictionsTypeLocation ... + ResourceSkuRestrictionsTypeLocation ResourceSkuRestrictionsType = "Location" + // ResourceSkuRestrictionsTypeZone ... + ResourceSkuRestrictionsTypeZone ResourceSkuRestrictionsType = "Zone" +) + +// PossibleResourceSkuRestrictionsTypeValues returns an array of possible values for the ResourceSkuRestrictionsType const type. +func PossibleResourceSkuRestrictionsTypeValues() []ResourceSkuRestrictionsType { + return []ResourceSkuRestrictionsType{ResourceSkuRestrictionsTypeLocation, ResourceSkuRestrictionsTypeZone} +} + +// ServiceRegistryProvisioningState enumerates the values for service registry provisioning state. +type ServiceRegistryProvisioningState string + +const ( + // ServiceRegistryProvisioningStateCreating ... + ServiceRegistryProvisioningStateCreating ServiceRegistryProvisioningState = "Creating" + // ServiceRegistryProvisioningStateDeleting ... + ServiceRegistryProvisioningStateDeleting ServiceRegistryProvisioningState = "Deleting" + // ServiceRegistryProvisioningStateFailed ... + ServiceRegistryProvisioningStateFailed ServiceRegistryProvisioningState = "Failed" + // ServiceRegistryProvisioningStateSucceeded ... + ServiceRegistryProvisioningStateSucceeded ServiceRegistryProvisioningState = "Succeeded" + // ServiceRegistryProvisioningStateUpdating ... + ServiceRegistryProvisioningStateUpdating ServiceRegistryProvisioningState = "Updating" +) + +// PossibleServiceRegistryProvisioningStateValues returns an array of possible values for the ServiceRegistryProvisioningState const type. +func PossibleServiceRegistryProvisioningStateValues() []ServiceRegistryProvisioningState { + return []ServiceRegistryProvisioningState{ServiceRegistryProvisioningStateCreating, ServiceRegistryProvisioningStateDeleting, ServiceRegistryProvisioningStateFailed, ServiceRegistryProvisioningStateSucceeded, ServiceRegistryProvisioningStateUpdating} +} + +// SkuScaleType enumerates the values for sku scale type. +type SkuScaleType string + +const ( + // SkuScaleTypeAutomatic ... + SkuScaleTypeAutomatic SkuScaleType = "Automatic" + // SkuScaleTypeManual ... + SkuScaleTypeManual SkuScaleType = "Manual" + // SkuScaleTypeNone ... + SkuScaleTypeNone SkuScaleType = "None" +) + +// PossibleSkuScaleTypeValues returns an array of possible values for the SkuScaleType const type. +func PossibleSkuScaleTypeValues() []SkuScaleType { + return []SkuScaleType{SkuScaleTypeAutomatic, SkuScaleTypeManual, SkuScaleTypeNone} +} + +// StorageType enumerates the values for storage type. +type StorageType string + +const ( + // StorageTypeStorageAccount ... + StorageTypeStorageAccount StorageType = "StorageAccount" + // StorageTypeStorageProperties ... + StorageTypeStorageProperties StorageType = "StorageProperties" +) + +// PossibleStorageTypeValues returns an array of possible values for the StorageType const type. +func PossibleStorageTypeValues() []StorageType { + return []StorageType{StorageTypeStorageAccount, StorageTypeStorageProperties} +} + +// SupportedRuntimePlatform enumerates the values for supported runtime platform. +type SupportedRuntimePlatform string + +const ( + // SupportedRuntimePlatformJava ... + SupportedRuntimePlatformJava SupportedRuntimePlatform = "Java" + // SupportedRuntimePlatformNETCore ... + SupportedRuntimePlatformNETCore SupportedRuntimePlatform = ".NET Core" +) + +// PossibleSupportedRuntimePlatformValues returns an array of possible values for the SupportedRuntimePlatform const type. +func PossibleSupportedRuntimePlatformValues() []SupportedRuntimePlatform { + return []SupportedRuntimePlatform{SupportedRuntimePlatformJava, SupportedRuntimePlatformNETCore} +} + +// SupportedRuntimeValue enumerates the values for supported runtime value. +type SupportedRuntimeValue string + +const ( + // SupportedRuntimeValueJava11 ... + SupportedRuntimeValueJava11 SupportedRuntimeValue = "Java_11" + // SupportedRuntimeValueJava17 ... + SupportedRuntimeValueJava17 SupportedRuntimeValue = "Java_17" + // SupportedRuntimeValueJava8 ... + SupportedRuntimeValueJava8 SupportedRuntimeValue = "Java_8" + // SupportedRuntimeValueNetCore31 ... + SupportedRuntimeValueNetCore31 SupportedRuntimeValue = "NetCore_31" +) + +// PossibleSupportedRuntimeValueValues returns an array of possible values for the SupportedRuntimeValue const type. +func PossibleSupportedRuntimeValueValues() []SupportedRuntimeValue { + return []SupportedRuntimeValue{SupportedRuntimeValueJava11, SupportedRuntimeValueJava17, SupportedRuntimeValueJava8, SupportedRuntimeValueNetCore31} +} + +// TestKeyType enumerates the values for test key type. +type TestKeyType string + +const ( + // TestKeyTypePrimary ... + TestKeyTypePrimary TestKeyType = "Primary" + // TestKeyTypeSecondary ... + TestKeyTypeSecondary TestKeyType = "Secondary" +) + +// PossibleTestKeyTypeValues returns an array of possible values for the TestKeyType const type. +func PossibleTestKeyTypeValues() []TestKeyType { + return []TestKeyType{TestKeyTypePrimary, TestKeyTypeSecondary} +} + +// TrafficDirection enumerates the values for traffic direction. +type TrafficDirection string + +const ( + // TrafficDirectionInbound ... + TrafficDirectionInbound TrafficDirection = "Inbound" + // TrafficDirectionOutbound ... + TrafficDirectionOutbound TrafficDirection = "Outbound" +) + +// PossibleTrafficDirectionValues returns an array of possible values for the TrafficDirection const type. +func PossibleTrafficDirectionValues() []TrafficDirection { + return []TrafficDirection{TrafficDirectionInbound, TrafficDirectionOutbound} +} + +// Type enumerates the values for type. +type Type string + +const ( + // TypeAzureFileVolume ... + TypeAzureFileVolume Type = "AzureFileVolume" + // TypeCustomPersistentDiskProperties ... + TypeCustomPersistentDiskProperties Type = "CustomPersistentDiskProperties" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{TypeAzureFileVolume, TypeCustomPersistentDiskProperties} +} + +// TypeBasicCertificateProperties enumerates the values for type basic certificate properties. +type TypeBasicCertificateProperties string + +const ( + // TypeBasicCertificatePropertiesTypeCertificateProperties ... + TypeBasicCertificatePropertiesTypeCertificateProperties TypeBasicCertificateProperties = "CertificateProperties" + // TypeBasicCertificatePropertiesTypeContentCertificate ... + TypeBasicCertificatePropertiesTypeContentCertificate TypeBasicCertificateProperties = "ContentCertificate" + // TypeBasicCertificatePropertiesTypeKeyVaultCertificate ... + TypeBasicCertificatePropertiesTypeKeyVaultCertificate TypeBasicCertificateProperties = "KeyVaultCertificate" +) + +// PossibleTypeBasicCertificatePropertiesValues returns an array of possible values for the TypeBasicCertificateProperties const type. +func PossibleTypeBasicCertificatePropertiesValues() []TypeBasicCertificateProperties { + return []TypeBasicCertificateProperties{TypeBasicCertificatePropertiesTypeCertificateProperties, TypeBasicCertificatePropertiesTypeContentCertificate, TypeBasicCertificatePropertiesTypeKeyVaultCertificate} +} + +// TypeBasicProbeAction enumerates the values for type basic probe action. +type TypeBasicProbeAction string + +const ( + // TypeBasicProbeActionTypeExecAction ... + TypeBasicProbeActionTypeExecAction TypeBasicProbeAction = "ExecAction" + // TypeBasicProbeActionTypeHTTPGetAction ... + TypeBasicProbeActionTypeHTTPGetAction TypeBasicProbeAction = "HTTPGetAction" + // TypeBasicProbeActionTypeProbeAction ... + TypeBasicProbeActionTypeProbeAction TypeBasicProbeAction = "ProbeAction" + // TypeBasicProbeActionTypeTCPSocketAction ... + TypeBasicProbeActionTypeTCPSocketAction TypeBasicProbeAction = "TCPSocketAction" +) + +// PossibleTypeBasicProbeActionValues returns an array of possible values for the TypeBasicProbeAction const type. +func PossibleTypeBasicProbeActionValues() []TypeBasicProbeAction { + return []TypeBasicProbeAction{TypeBasicProbeActionTypeExecAction, TypeBasicProbeActionTypeHTTPGetAction, TypeBasicProbeActionTypeProbeAction, TypeBasicProbeActionTypeTCPSocketAction} +} + +// TypeBasicUserSourceInfo enumerates the values for type basic user source info. +type TypeBasicUserSourceInfo string + +const ( + // TypeBasicUserSourceInfoTypeBuildResult ... + TypeBasicUserSourceInfoTypeBuildResult TypeBasicUserSourceInfo = "BuildResult" + // TypeBasicUserSourceInfoTypeContainer ... + TypeBasicUserSourceInfoTypeContainer TypeBasicUserSourceInfo = "Container" + // TypeBasicUserSourceInfoTypeJar ... + TypeBasicUserSourceInfoTypeJar TypeBasicUserSourceInfo = "Jar" + // TypeBasicUserSourceInfoTypeNetCoreZip ... + TypeBasicUserSourceInfoTypeNetCoreZip TypeBasicUserSourceInfo = "NetCoreZip" + // TypeBasicUserSourceInfoTypeSource ... + TypeBasicUserSourceInfoTypeSource TypeBasicUserSourceInfo = "Source" + // TypeBasicUserSourceInfoTypeUploadedUserSourceInfo ... + TypeBasicUserSourceInfoTypeUploadedUserSourceInfo TypeBasicUserSourceInfo = "UploadedUserSourceInfo" + // TypeBasicUserSourceInfoTypeUserSourceInfo ... + TypeBasicUserSourceInfoTypeUserSourceInfo TypeBasicUserSourceInfo = "UserSourceInfo" +) + +// PossibleTypeBasicUserSourceInfoValues returns an array of possible values for the TypeBasicUserSourceInfo const type. +func PossibleTypeBasicUserSourceInfoValues() []TypeBasicUserSourceInfo { + return []TypeBasicUserSourceInfo{TypeBasicUserSourceInfoTypeBuildResult, TypeBasicUserSourceInfoTypeContainer, TypeBasicUserSourceInfoTypeJar, TypeBasicUserSourceInfoTypeNetCoreZip, TypeBasicUserSourceInfoTypeSource, TypeBasicUserSourceInfoTypeUploadedUserSourceInfo, TypeBasicUserSourceInfoTypeUserSourceInfo} +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/gatewaycustomdomains.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gatewaycustomdomains.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/gatewaycustomdomains.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gatewaycustomdomains.go index 92e276558e5..2ba9a4e5b90 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/gatewaycustomdomains.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gatewaycustomdomains.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// GatewayCustomDomainsClient is the REST API for Azure Spring Cloud +// GatewayCustomDomainsClient is the REST API for Azure Spring Apps type GatewayCustomDomainsClient struct { BaseClient } @@ -75,7 +75,7 @@ func (client GatewayCustomDomainsClient) CreateOrUpdatePreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -161,7 +161,7 @@ func (client GatewayCustomDomainsClient) DeletePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -251,7 +251,7 @@ func (client GatewayCustomDomainsClient) GetPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -335,7 +335,7 @@ func (client GatewayCustomDomainsClient) ListPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/gatewayrouteconfigs.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gatewayrouteconfigs.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/gatewayrouteconfigs.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gatewayrouteconfigs.go index c38a3d4171e..1f80054fa1a 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/gatewayrouteconfigs.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gatewayrouteconfigs.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// GatewayRouteConfigsClient is the REST API for Azure Spring Cloud +// GatewayRouteConfigsClient is the REST API for Azure Spring Apps type GatewayRouteConfigsClient struct { BaseClient } @@ -76,7 +76,7 @@ func (client GatewayRouteConfigsClient) CreateOrUpdatePreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -162,7 +162,7 @@ func (client GatewayRouteConfigsClient) DeletePreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -252,7 +252,7 @@ func (client GatewayRouteConfigsClient) GetPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -336,7 +336,7 @@ func (client GatewayRouteConfigsClient) ListPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/gateways.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gateways.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/gateways.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gateways.go index 15cc5153762..31fb4c9e4aa 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/gateways.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gateways.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// GatewaysClient is the REST API for Azure Spring Cloud +// GatewaysClient is the REST API for Azure Spring Apps type GatewaysClient struct { BaseClient } @@ -73,7 +73,7 @@ func (client GatewaysClient) CreateOrUpdatePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -157,7 +157,7 @@ func (client GatewaysClient) DeletePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -245,7 +245,7 @@ func (client GatewaysClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -327,7 +327,7 @@ func (client GatewaysClient) ListPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -450,7 +450,7 @@ func (client GatewaysClient) ValidateDomainPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/models.go new file mode 100644 index 00000000000..1a8d33624b9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/models.go @@ -0,0 +1,9834 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" + +// ActiveDeploymentCollection object that includes an array of Deployment resource name and set them as +// active. +type ActiveDeploymentCollection struct { + // ActiveDeploymentNames - Collection of Deployment name. + ActiveDeploymentNames *[]string `json:"activeDeploymentNames,omitempty"` +} + +// APIPortalCustomDomainProperties the properties of custom domain for API portal +type APIPortalCustomDomainProperties struct { + // Thumbprint - The thumbprint of bound certificate. + Thumbprint *string `json:"thumbprint,omitempty"` +} + +// APIPortalCustomDomainResource custom domain of the API portal +type APIPortalCustomDomainResource struct { + autorest.Response `json:"-"` + Properties *APIPortalCustomDomainProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for APIPortalCustomDomainResource. +func (apcdr APIPortalCustomDomainResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apcdr.Properties != nil { + objectMap["properties"] = apcdr.Properties + } + if apcdr.SystemData != nil { + objectMap["systemData"] = apcdr.SystemData + } + return json.Marshal(objectMap) +} + +// APIPortalCustomDomainResourceCollection object that includes an array of API portal custom domain +// resources and a possible link for next set +type APIPortalCustomDomainResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of API portal custom domain resources + Value *[]APIPortalCustomDomainResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// APIPortalCustomDomainResourceCollectionIterator provides access to a complete listing of +// APIPortalCustomDomainResource values. +type APIPortalCustomDomainResourceCollectionIterator struct { + i int + page APIPortalCustomDomainResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *APIPortalCustomDomainResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalCustomDomainResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *APIPortalCustomDomainResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter APIPortalCustomDomainResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter APIPortalCustomDomainResourceCollectionIterator) Response() APIPortalCustomDomainResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter APIPortalCustomDomainResourceCollectionIterator) Value() APIPortalCustomDomainResource { + if !iter.page.NotDone() { + return APIPortalCustomDomainResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the APIPortalCustomDomainResourceCollectionIterator type. +func NewAPIPortalCustomDomainResourceCollectionIterator(page APIPortalCustomDomainResourceCollectionPage) APIPortalCustomDomainResourceCollectionIterator { + return APIPortalCustomDomainResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (apcdrc APIPortalCustomDomainResourceCollection) IsEmpty() bool { + return apcdrc.Value == nil || len(*apcdrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (apcdrc APIPortalCustomDomainResourceCollection) hasNextLink() bool { + return apcdrc.NextLink != nil && len(*apcdrc.NextLink) != 0 +} + +// aPIPortalCustomDomainResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (apcdrc APIPortalCustomDomainResourceCollection) aPIPortalCustomDomainResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !apcdrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(apcdrc.NextLink))) +} + +// APIPortalCustomDomainResourceCollectionPage contains a page of APIPortalCustomDomainResource values. +type APIPortalCustomDomainResourceCollectionPage struct { + fn func(context.Context, APIPortalCustomDomainResourceCollection) (APIPortalCustomDomainResourceCollection, error) + apcdrc APIPortalCustomDomainResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *APIPortalCustomDomainResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalCustomDomainResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.apcdrc) + if err != nil { + return err + } + page.apcdrc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *APIPortalCustomDomainResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page APIPortalCustomDomainResourceCollectionPage) NotDone() bool { + return !page.apcdrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page APIPortalCustomDomainResourceCollectionPage) Response() APIPortalCustomDomainResourceCollection { + return page.apcdrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page APIPortalCustomDomainResourceCollectionPage) Values() []APIPortalCustomDomainResource { + if page.apcdrc.IsEmpty() { + return nil + } + return *page.apcdrc.Value +} + +// Creates a new instance of the APIPortalCustomDomainResourceCollectionPage type. +func NewAPIPortalCustomDomainResourceCollectionPage(cur APIPortalCustomDomainResourceCollection, getNextPage func(context.Context, APIPortalCustomDomainResourceCollection) (APIPortalCustomDomainResourceCollection, error)) APIPortalCustomDomainResourceCollectionPage { + return APIPortalCustomDomainResourceCollectionPage{ + fn: getNextPage, + apcdrc: cur, + } +} + +// APIPortalCustomDomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type APIPortalCustomDomainsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(APIPortalCustomDomainsClient) (APIPortalCustomDomainResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *APIPortalCustomDomainsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for APIPortalCustomDomainsCreateOrUpdateFuture.Result. +func (future *APIPortalCustomDomainsCreateOrUpdateFuture) result(client APIPortalCustomDomainsClient) (apcdr APIPortalCustomDomainResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + apcdr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.APIPortalCustomDomainsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if apcdr.Response.Response, err = future.GetResult(sender); err == nil && apcdr.Response.Response.StatusCode != http.StatusNoContent { + apcdr, err = client.CreateOrUpdateResponder(apcdr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsCreateOrUpdateFuture", "Result", apcdr.Response.Response, "Failure responding to request") + } + } + return +} + +// APIPortalCustomDomainsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type APIPortalCustomDomainsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(APIPortalCustomDomainsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *APIPortalCustomDomainsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for APIPortalCustomDomainsDeleteFuture.Result. +func (future *APIPortalCustomDomainsDeleteFuture) result(client APIPortalCustomDomainsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.APIPortalCustomDomainsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// APIPortalInstance collection of instances belong to the API portal +type APIPortalInstance struct { + // Name - READ-ONLY; Name of the API portal instance + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Status of the API portal instance + Status *string `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for APIPortalInstance. +func (API APIPortalInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// APIPortalProperties API portal properties payload +type APIPortalProperties struct { + // ProvisioningState - READ-ONLY; State of the API portal. Possible values include: 'APIPortalProvisioningStateCreating', 'APIPortalProvisioningStateUpdating', 'APIPortalProvisioningStateSucceeded', 'APIPortalProvisioningStateFailed', 'APIPortalProvisioningStateDeleting' + ProvisioningState APIPortalProvisioningState `json:"provisioningState,omitempty"` + // Public - Indicates whether the API portal exposes endpoint. + Public *bool `json:"public,omitempty"` + // URL - READ-ONLY; URL of the API portal, exposed when 'public' is true. + URL *string `json:"url,omitempty"` + // HTTPSOnly - Indicate if only https is allowed. + HTTPSOnly *bool `json:"httpsOnly,omitempty"` + // GatewayIds - The array of resource Ids of gateway to integrate with API portal. + GatewayIds *[]string `json:"gatewayIds,omitempty"` + // SourceUrls - Collection of OpenAPI source URL locations. + SourceUrls *[]string `json:"sourceUrls,omitempty"` + SsoProperties *SsoProperties `json:"ssoProperties,omitempty"` + // ResourceRequests - READ-ONLY; The requested resource quantity for required CPU and Memory. + ResourceRequests *APIPortalResourceRequests `json:"resourceRequests,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to API portal. + Instances *[]APIPortalInstance `json:"instances,omitempty"` +} + +// MarshalJSON is the custom marshaler for APIPortalProperties. +func (app APIPortalProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if app.Public != nil { + objectMap["public"] = app.Public + } + if app.HTTPSOnly != nil { + objectMap["httpsOnly"] = app.HTTPSOnly + } + if app.GatewayIds != nil { + objectMap["gatewayIds"] = app.GatewayIds + } + if app.SourceUrls != nil { + objectMap["sourceUrls"] = app.SourceUrls + } + if app.SsoProperties != nil { + objectMap["ssoProperties"] = app.SsoProperties + } + return json.Marshal(objectMap) +} + +// APIPortalResource API portal resource +type APIPortalResource struct { + autorest.Response `json:"-"` + Properties *APIPortalProperties `json:"properties,omitempty"` + // Sku - Sku of the API portal resource + Sku *Sku `json:"sku,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for APIPortalResource. +func (apr APIPortalResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apr.Properties != nil { + objectMap["properties"] = apr.Properties + } + if apr.Sku != nil { + objectMap["sku"] = apr.Sku + } + if apr.SystemData != nil { + objectMap["systemData"] = apr.SystemData + } + return json.Marshal(objectMap) +} + +// APIPortalResourceCollection object that includes an array of API portal resources and a possible link +// for next set +type APIPortalResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of API portal resources + Value *[]APIPortalResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// APIPortalResourceCollectionIterator provides access to a complete listing of APIPortalResource values. +type APIPortalResourceCollectionIterator struct { + i int + page APIPortalResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *APIPortalResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *APIPortalResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter APIPortalResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter APIPortalResourceCollectionIterator) Response() APIPortalResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter APIPortalResourceCollectionIterator) Value() APIPortalResource { + if !iter.page.NotDone() { + return APIPortalResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the APIPortalResourceCollectionIterator type. +func NewAPIPortalResourceCollectionIterator(page APIPortalResourceCollectionPage) APIPortalResourceCollectionIterator { + return APIPortalResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aprc APIPortalResourceCollection) IsEmpty() bool { + return aprc.Value == nil || len(*aprc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aprc APIPortalResourceCollection) hasNextLink() bool { + return aprc.NextLink != nil && len(*aprc.NextLink) != 0 +} + +// aPIPortalResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aprc APIPortalResourceCollection) aPIPortalResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !aprc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aprc.NextLink))) +} + +// APIPortalResourceCollectionPage contains a page of APIPortalResource values. +type APIPortalResourceCollectionPage struct { + fn func(context.Context, APIPortalResourceCollection) (APIPortalResourceCollection, error) + aprc APIPortalResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *APIPortalResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aprc) + if err != nil { + return err + } + page.aprc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *APIPortalResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page APIPortalResourceCollectionPage) NotDone() bool { + return !page.aprc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page APIPortalResourceCollectionPage) Response() APIPortalResourceCollection { + return page.aprc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page APIPortalResourceCollectionPage) Values() []APIPortalResource { + if page.aprc.IsEmpty() { + return nil + } + return *page.aprc.Value +} + +// Creates a new instance of the APIPortalResourceCollectionPage type. +func NewAPIPortalResourceCollectionPage(cur APIPortalResourceCollection, getNextPage func(context.Context, APIPortalResourceCollection) (APIPortalResourceCollection, error)) APIPortalResourceCollectionPage { + return APIPortalResourceCollectionPage{ + fn: getNextPage, + aprc: cur, + } +} + +// APIPortalResourceRequests resource requests of the API portal +type APIPortalResourceRequests struct { + // CPU - READ-ONLY; Cpu allocated to each API portal instance + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; Memory allocated to each API portal instance + Memory *string `json:"memory,omitempty"` +} + +// MarshalJSON is the custom marshaler for APIPortalResourceRequests. +func (aprr APIPortalResourceRequests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// APIPortalsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type APIPortalsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(APIPortalsClient) (APIPortalResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *APIPortalsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for APIPortalsCreateOrUpdateFuture.Result. +func (future *APIPortalsCreateOrUpdateFuture) result(client APIPortalsClient) (apr APIPortalResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + apr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.APIPortalsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if apr.Response.Response, err = future.GetResult(sender); err == nil && apr.Response.Response.StatusCode != http.StatusNoContent { + apr, err = client.CreateOrUpdateResponder(apr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsCreateOrUpdateFuture", "Result", apr.Response.Response, "Failure responding to request") + } + } + return +} + +// APIPortalsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type APIPortalsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(APIPortalsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *APIPortalsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for APIPortalsDeleteFuture.Result. +func (future *APIPortalsDeleteFuture) result(client APIPortalsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.APIPortalsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ApplicationInsightsAgentVersions application Insights agent versions properties payload +type ApplicationInsightsAgentVersions struct { + // Java - READ-ONLY; Indicates the version of application insight java agent + Java *string `json:"java,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsAgentVersions. +func (aiav ApplicationInsightsAgentVersions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AppResource app resource payload +type AppResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the App resource + Properties *AppResourceProperties `json:"properties,omitempty"` + // Identity - The Managed Identity type of the app resource + Identity *ManagedIdentityProperties `json:"identity,omitempty"` + // Location - The GEO location of the application, always the same with its parent resource + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppResource. +func (ar AppResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.Properties != nil { + objectMap["properties"] = ar.Properties + } + if ar.Identity != nil { + objectMap["identity"] = ar.Identity + } + if ar.Location != nil { + objectMap["location"] = ar.Location + } + if ar.SystemData != nil { + objectMap["systemData"] = ar.SystemData + } + return json.Marshal(objectMap) +} + +// AppResourceCollection object that includes an array of App resources and a possible link for next set +type AppResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of App resources + Value *[]AppResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// AppResourceCollectionIterator provides access to a complete listing of AppResource values. +type AppResourceCollectionIterator struct { + i int + page AppResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AppResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AppResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AppResourceCollectionIterator) Response() AppResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AppResourceCollectionIterator) Value() AppResource { + if !iter.page.NotDone() { + return AppResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppResourceCollectionIterator type. +func NewAppResourceCollectionIterator(page AppResourceCollectionPage) AppResourceCollectionIterator { + return AppResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arc AppResourceCollection) IsEmpty() bool { + return arc.Value == nil || len(*arc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (arc AppResourceCollection) hasNextLink() bool { + return arc.NextLink != nil && len(*arc.NextLink) != 0 +} + +// appResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arc AppResourceCollection) appResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !arc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arc.NextLink))) +} + +// AppResourceCollectionPage contains a page of AppResource values. +type AppResourceCollectionPage struct { + fn func(context.Context, AppResourceCollection) (AppResourceCollection, error) + arc AppResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AppResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.arc) + if err != nil { + return err + } + page.arc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AppResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppResourceCollectionPage) NotDone() bool { + return !page.arc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppResourceCollectionPage) Response() AppResourceCollection { + return page.arc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppResourceCollectionPage) Values() []AppResource { + if page.arc.IsEmpty() { + return nil + } + return *page.arc.Value +} + +// Creates a new instance of the AppResourceCollectionPage type. +func NewAppResourceCollectionPage(cur AppResourceCollection, getNextPage func(context.Context, AppResourceCollection) (AppResourceCollection, error)) AppResourceCollectionPage { + return AppResourceCollectionPage{ + fn: getNextPage, + arc: cur, + } +} + +// AppResourceProperties app resource properties payload +type AppResourceProperties struct { + // Public - Indicates whether the App exposes public endpoint + Public *bool `json:"public,omitempty"` + // URL - READ-ONLY; URL of the App + URL *string `json:"url,omitempty"` + // AddonConfigs - Collection of addons + AddonConfigs map[string]map[string]interface{} `json:"addonConfigs"` + // ProvisioningState - READ-ONLY; Provisioning state of the App. Possible values include: 'AppResourceProvisioningStateSucceeded', 'AppResourceProvisioningStateFailed', 'AppResourceProvisioningStateCreating', 'AppResourceProvisioningStateUpdating', 'AppResourceProvisioningStateDeleting' + ProvisioningState AppResourceProvisioningState `json:"provisioningState,omitempty"` + // Fqdn - Fully qualified dns Name. + Fqdn *string `json:"fqdn,omitempty"` + // HTTPSOnly - Indicate if only https is allowed. + HTTPSOnly *bool `json:"httpsOnly,omitempty"` + // TemporaryDisk - Temporary disk settings + TemporaryDisk *TemporaryDisk `json:"temporaryDisk,omitempty"` + // PersistentDisk - Persistent disk settings + PersistentDisk *PersistentDisk `json:"persistentDisk,omitempty"` + // CustomPersistentDisks - List of custom persistent disks + CustomPersistentDisks *[]CustomPersistentDiskResource `json:"customPersistentDisks,omitempty"` + // EnableEndToEndTLS - Indicate if end to end TLS is enabled. + EnableEndToEndTLS *bool `json:"enableEndToEndTLS,omitempty"` + // LoadedCertificates - Collection of loaded certificates + LoadedCertificates *[]LoadedCertificate `json:"loadedCertificates,omitempty"` + // VnetAddons - Additional App settings in vnet injection instance + VnetAddons *AppVNetAddons `json:"vnetAddons,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppResourceProperties. +func (arp AppResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arp.Public != nil { + objectMap["public"] = arp.Public + } + if arp.AddonConfigs != nil { + objectMap["addonConfigs"] = arp.AddonConfigs + } + if arp.Fqdn != nil { + objectMap["fqdn"] = arp.Fqdn + } + if arp.HTTPSOnly != nil { + objectMap["httpsOnly"] = arp.HTTPSOnly + } + if arp.TemporaryDisk != nil { + objectMap["temporaryDisk"] = arp.TemporaryDisk + } + if arp.PersistentDisk != nil { + objectMap["persistentDisk"] = arp.PersistentDisk + } + if arp.CustomPersistentDisks != nil { + objectMap["customPersistentDisks"] = arp.CustomPersistentDisks + } + if arp.EnableEndToEndTLS != nil { + objectMap["enableEndToEndTLS"] = arp.EnableEndToEndTLS + } + if arp.LoadedCertificates != nil { + objectMap["loadedCertificates"] = arp.LoadedCertificates + } + if arp.VnetAddons != nil { + objectMap["vnetAddons"] = arp.VnetAddons + } + return json.Marshal(objectMap) +} + +// AppsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (AppResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsCreateOrUpdateFuture.Result. +func (future *AppsCreateOrUpdateFuture) result(client AppsClient) (ar AppResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.AppsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { + ar, err = client.CreateOrUpdateResponder(ar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsCreateOrUpdateFuture", "Result", ar.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type AppsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsDeleteFuture.Result. +func (future *AppsDeleteFuture) result(client AppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.AppsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AppsSetActiveDeploymentsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsSetActiveDeploymentsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (AppResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsSetActiveDeploymentsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsSetActiveDeploymentsFuture.Result. +func (future *AppsSetActiveDeploymentsFuture) result(client AppsClient) (ar AppResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsSetActiveDeploymentsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.AppsSetActiveDeploymentsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { + ar, err = client.SetActiveDeploymentsResponder(ar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsSetActiveDeploymentsFuture", "Result", ar.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type AppsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (AppResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AppsUpdateFuture.Result. +func (future *AppsUpdateFuture) result(client AppsClient) (ar AppResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.AppsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { + ar, err = client.UpdateResponder(ar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsUpdateFuture", "Result", ar.Response.Response, "Failure responding to request") + } + } + return +} + +// AppVNetAddons additional App settings in vnet injection instance +type AppVNetAddons struct { + // PublicEndpoint - Indicates whether the App in vnet injection instance exposes endpoint which could be accessed from internet. + PublicEndpoint *bool `json:"publicEndpoint,omitempty"` + // PublicEndpointURL - READ-ONLY; URL of the App in vnet injection instance which could be accessed from internet + PublicEndpointURL *string `json:"publicEndpointUrl,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppVNetAddons. +func (avna AppVNetAddons) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if avna.PublicEndpoint != nil { + objectMap["publicEndpoint"] = avna.PublicEndpoint + } + return json.Marshal(objectMap) +} + +// AvailableOperations available operations of the service +type AvailableOperations struct { + autorest.Response `json:"-"` + // Value - Collection of available operation details + Value *[]OperationDetail `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// AvailableOperationsIterator provides access to a complete listing of OperationDetail values. +type AvailableOperationsIterator struct { + i int + page AvailableOperationsPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AvailableOperationsIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AvailableOperationsIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AvailableOperationsIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AvailableOperationsIterator) Response() AvailableOperations { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AvailableOperationsIterator) Value() OperationDetail { + if !iter.page.NotDone() { + return OperationDetail{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AvailableOperationsIterator type. +func NewAvailableOperationsIterator(page AvailableOperationsPage) AvailableOperationsIterator { + return AvailableOperationsIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ao AvailableOperations) IsEmpty() bool { + return ao.Value == nil || len(*ao.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ao AvailableOperations) hasNextLink() bool { + return ao.NextLink != nil && len(*ao.NextLink) != 0 +} + +// availableOperationsPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ao AvailableOperations) availableOperationsPreparer(ctx context.Context) (*http.Request, error) { + if !ao.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ao.NextLink))) +} + +// AvailableOperationsPage contains a page of OperationDetail values. +type AvailableOperationsPage struct { + fn func(context.Context, AvailableOperations) (AvailableOperations, error) + ao AvailableOperations +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AvailableOperationsPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ao) + if err != nil { + return err + } + page.ao = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AvailableOperationsPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AvailableOperationsPage) NotDone() bool { + return !page.ao.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AvailableOperationsPage) Response() AvailableOperations { + return page.ao +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AvailableOperationsPage) Values() []OperationDetail { + if page.ao.IsEmpty() { + return nil + } + return *page.ao.Value +} + +// Creates a new instance of the AvailableOperationsPage type. +func NewAvailableOperationsPage(cur AvailableOperations, getNextPage func(context.Context, AvailableOperations) (AvailableOperations, error)) AvailableOperationsPage { + return AvailableOperationsPage{ + fn: getNextPage, + ao: cur, + } +} + +// AvailableRuntimeVersions ... +type AvailableRuntimeVersions struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; A list of all supported runtime versions. + Value *[]SupportedRuntimeVersion `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailableRuntimeVersions. +func (arv AvailableRuntimeVersions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureFileVolume the properties of the Azure File volume. Azure File shares are mounted as volumes. +type AzureFileVolume struct { + // ShareName - The share name of the Azure File share. + ShareName *string `json:"shareName,omitempty"` + // MountPath - The mount path of the persistent disk. + MountPath *string `json:"mountPath,omitempty"` + // ReadOnly - Indicates whether the persistent disk is a readOnly one. + ReadOnly *bool `json:"readOnly,omitempty"` + // MountOptions - These are the mount options for a persistent disk. + MountOptions *[]string `json:"mountOptions,omitempty"` + // Type - Possible values include: 'TypeCustomPersistentDiskProperties', 'TypeAzureFileVolume' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFileVolume. +func (afv AzureFileVolume) MarshalJSON() ([]byte, error) { + afv.Type = TypeAzureFileVolume + objectMap := make(map[string]interface{}) + if afv.ShareName != nil { + objectMap["shareName"] = afv.ShareName + } + if afv.MountPath != nil { + objectMap["mountPath"] = afv.MountPath + } + if afv.ReadOnly != nil { + objectMap["readOnly"] = afv.ReadOnly + } + if afv.MountOptions != nil { + objectMap["mountOptions"] = afv.MountOptions + } + if afv.Type != "" { + objectMap["type"] = afv.Type + } + return json.Marshal(objectMap) +} + +// AsAzureFileVolume is the BasicCustomPersistentDiskProperties implementation for AzureFileVolume. +func (afv AzureFileVolume) AsAzureFileVolume() (*AzureFileVolume, bool) { + return &afv, true +} + +// AsCustomPersistentDiskProperties is the BasicCustomPersistentDiskProperties implementation for AzureFileVolume. +func (afv AzureFileVolume) AsCustomPersistentDiskProperties() (*CustomPersistentDiskProperties, bool) { + return nil, false +} + +// AsBasicCustomPersistentDiskProperties is the BasicCustomPersistentDiskProperties implementation for AzureFileVolume. +func (afv AzureFileVolume) AsBasicCustomPersistentDiskProperties() (BasicCustomPersistentDiskProperties, bool) { + return &afv, true +} + +// BindingResource binding resource payload +type BindingResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Binding resource + Properties *BindingResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BindingResource. +func (br BindingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if br.Properties != nil { + objectMap["properties"] = br.Properties + } + if br.SystemData != nil { + objectMap["systemData"] = br.SystemData + } + return json.Marshal(objectMap) +} + +// BindingResourceCollection object that includes an array of Binding resources and a possible link for +// next set +type BindingResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Binding resources + Value *[]BindingResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BindingResourceCollectionIterator provides access to a complete listing of BindingResource values. +type BindingResourceCollectionIterator struct { + i int + page BindingResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BindingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BindingResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BindingResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BindingResourceCollectionIterator) Response() BindingResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BindingResourceCollectionIterator) Value() BindingResource { + if !iter.page.NotDone() { + return BindingResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BindingResourceCollectionIterator type. +func NewBindingResourceCollectionIterator(page BindingResourceCollectionPage) BindingResourceCollectionIterator { + return BindingResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (brc BindingResourceCollection) IsEmpty() bool { + return brc.Value == nil || len(*brc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (brc BindingResourceCollection) hasNextLink() bool { + return brc.NextLink != nil && len(*brc.NextLink) != 0 +} + +// bindingResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (brc BindingResourceCollection) bindingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !brc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(brc.NextLink))) +} + +// BindingResourceCollectionPage contains a page of BindingResource values. +type BindingResourceCollectionPage struct { + fn func(context.Context, BindingResourceCollection) (BindingResourceCollection, error) + brc BindingResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BindingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.brc) + if err != nil { + return err + } + page.brc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BindingResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BindingResourceCollectionPage) NotDone() bool { + return !page.brc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BindingResourceCollectionPage) Response() BindingResourceCollection { + return page.brc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BindingResourceCollectionPage) Values() []BindingResource { + if page.brc.IsEmpty() { + return nil + } + return *page.brc.Value +} + +// Creates a new instance of the BindingResourceCollectionPage type. +func NewBindingResourceCollectionPage(cur BindingResourceCollection, getNextPage func(context.Context, BindingResourceCollection) (BindingResourceCollection, error)) BindingResourceCollectionPage { + return BindingResourceCollectionPage{ + fn: getNextPage, + brc: cur, + } +} + +// BindingResourceProperties binding resource properties payload +type BindingResourceProperties struct { + // ResourceName - READ-ONLY; The name of the bound resource + ResourceName *string `json:"resourceName,omitempty"` + // ResourceType - READ-ONLY; The standard Azure resource type of the bound resource + ResourceType *string `json:"resourceType,omitempty"` + // ResourceID - The Azure resource id of the bound resource + ResourceID *string `json:"resourceId,omitempty"` + // Key - The key of the bound resource + Key *string `json:"key,omitempty"` + // BindingParameters - Binding parameters of the Binding resource + BindingParameters map[string]interface{} `json:"bindingParameters"` + // GeneratedProperties - READ-ONLY; The generated Spring Boot property file for this binding. The secret will be deducted. + GeneratedProperties *string `json:"generatedProperties,omitempty"` + // CreatedAt - READ-ONLY; Creation time of the Binding resource + CreatedAt *string `json:"createdAt,omitempty"` + // UpdatedAt - READ-ONLY; Update time of the Binding resource + UpdatedAt *string `json:"updatedAt,omitempty"` +} + +// MarshalJSON is the custom marshaler for BindingResourceProperties. +func (brp BindingResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if brp.ResourceID != nil { + objectMap["resourceId"] = brp.ResourceID + } + if brp.Key != nil { + objectMap["key"] = brp.Key + } + if brp.BindingParameters != nil { + objectMap["bindingParameters"] = brp.BindingParameters + } + return json.Marshal(objectMap) +} + +// BindingsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BindingsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BindingsClient) (BindingResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BindingsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BindingsCreateOrUpdateFuture.Result. +func (future *BindingsCreateOrUpdateFuture) result(client BindingsClient) (br BindingResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + br.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BindingsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if br.Response.Response, err = future.GetResult(sender); err == nil && br.Response.Response.StatusCode != http.StatusNoContent { + br, err = client.CreateOrUpdateResponder(br.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsCreateOrUpdateFuture", "Result", br.Response.Response, "Failure responding to request") + } + } + return +} + +// BindingsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BindingsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BindingsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BindingsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BindingsDeleteFuture.Result. +func (future *BindingsDeleteFuture) result(client BindingsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BindingsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BindingsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BindingsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BindingsClient) (BindingResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BindingsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BindingsUpdateFuture.Result. +func (future *BindingsUpdateFuture) result(client BindingsClient) (br BindingResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + br.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BindingsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if br.Response.Response, err = future.GetResult(sender); err == nil && br.Response.Response.StatusCode != http.StatusNoContent { + br, err = client.UpdateResponder(br.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsUpdateFuture", "Result", br.Response.Response, "Failure responding to request") + } + } + return +} + +// Build build resource payload +type Build struct { + autorest.Response `json:"-"` + // Properties - Properties of the build resource + Properties *BuildProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Build. +func (b Build) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if b.Properties != nil { + objectMap["properties"] = b.Properties + } + if b.SystemData != nil { + objectMap["systemData"] = b.SystemData + } + return json.Marshal(objectMap) +} + +// BuildCollection object that includes an array of Build resources and a possible link for next set +type BuildCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Build resources + Value *[]Build `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuildCollectionIterator provides access to a complete listing of Build values. +type BuildCollectionIterator struct { + i int + page BuildCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BuildCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BuildCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuildCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BuildCollectionIterator) Response() BuildCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BuildCollectionIterator) Value() Build { + if !iter.page.NotDone() { + return Build{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuildCollectionIterator type. +func NewBuildCollectionIterator(page BuildCollectionPage) BuildCollectionIterator { + return BuildCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bc BuildCollection) IsEmpty() bool { + return bc.Value == nil || len(*bc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bc BuildCollection) hasNextLink() bool { + return bc.NextLink != nil && len(*bc.NextLink) != 0 +} + +// buildCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bc BuildCollection) buildCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !bc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bc.NextLink))) +} + +// BuildCollectionPage contains a page of Build values. +type BuildCollectionPage struct { + fn func(context.Context, BuildCollection) (BuildCollection, error) + bc BuildCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BuildCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bc) + if err != nil { + return err + } + page.bc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BuildCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuildCollectionPage) NotDone() bool { + return !page.bc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuildCollectionPage) Response() BuildCollection { + return page.bc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuildCollectionPage) Values() []Build { + if page.bc.IsEmpty() { + return nil + } + return *page.bc.Value +} + +// Creates a new instance of the BuildCollectionPage type. +func NewBuildCollectionPage(cur BuildCollection, getNextPage func(context.Context, BuildCollection) (BuildCollection, error)) BuildCollectionPage { + return BuildCollectionPage{ + fn: getNextPage, + bc: cur, + } +} + +// BuilderProperties kPack Builder properties payload +type BuilderProperties struct { + // ProvisioningState - READ-ONLY; Builder provision status. Possible values include: 'BuilderProvisioningStateCreating', 'BuilderProvisioningStateUpdating', 'BuilderProvisioningStateSucceeded', 'BuilderProvisioningStateFailed', 'BuilderProvisioningStateDeleting' + ProvisioningState BuilderProvisioningState `json:"provisioningState,omitempty"` + // Stack - Builder cluster stack property. + Stack *StackProperties `json:"stack,omitempty"` + // BuildpackGroups - Builder buildpack groups. + BuildpackGroups *[]BuildpacksGroupProperties `json:"buildpackGroups,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuilderProperties. +func (bp BuilderProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bp.Stack != nil { + objectMap["stack"] = bp.Stack + } + if bp.BuildpackGroups != nil { + objectMap["buildpackGroups"] = bp.BuildpackGroups + } + return json.Marshal(objectMap) +} + +// BuilderResource kPack Builder resource +type BuilderResource struct { + autorest.Response `json:"-"` + // Properties - Property of the Builder resource. + Properties *BuilderProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuilderResource. +func (br BuilderResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if br.Properties != nil { + objectMap["properties"] = br.Properties + } + if br.SystemData != nil { + objectMap["systemData"] = br.SystemData + } + return json.Marshal(objectMap) +} + +// BuilderResourceCollection object that includes an array of Builder resources and a possible link for +// next set +type BuilderResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Builder resources + Value *[]BuilderResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuilderResourceCollectionIterator provides access to a complete listing of BuilderResource values. +type BuilderResourceCollectionIterator struct { + i int + page BuilderResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BuilderResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuilderResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BuilderResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuilderResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BuilderResourceCollectionIterator) Response() BuilderResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BuilderResourceCollectionIterator) Value() BuilderResource { + if !iter.page.NotDone() { + return BuilderResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuilderResourceCollectionIterator type. +func NewBuilderResourceCollectionIterator(page BuilderResourceCollectionPage) BuilderResourceCollectionIterator { + return BuilderResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (brc BuilderResourceCollection) IsEmpty() bool { + return brc.Value == nil || len(*brc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (brc BuilderResourceCollection) hasNextLink() bool { + return brc.NextLink != nil && len(*brc.NextLink) != 0 +} + +// builderResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (brc BuilderResourceCollection) builderResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !brc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(brc.NextLink))) +} + +// BuilderResourceCollectionPage contains a page of BuilderResource values. +type BuilderResourceCollectionPage struct { + fn func(context.Context, BuilderResourceCollection) (BuilderResourceCollection, error) + brc BuilderResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BuilderResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuilderResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.brc) + if err != nil { + return err + } + page.brc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BuilderResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuilderResourceCollectionPage) NotDone() bool { + return !page.brc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuilderResourceCollectionPage) Response() BuilderResourceCollection { + return page.brc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuilderResourceCollectionPage) Values() []BuilderResource { + if page.brc.IsEmpty() { + return nil + } + return *page.brc.Value +} + +// Creates a new instance of the BuilderResourceCollectionPage type. +func NewBuilderResourceCollectionPage(cur BuilderResourceCollection, getNextPage func(context.Context, BuilderResourceCollection) (BuilderResourceCollection, error)) BuilderResourceCollectionPage { + return BuilderResourceCollectionPage{ + fn: getNextPage, + brc: cur, + } +} + +// BuildpackBindingCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BuildpackBindingCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BuildpackBindingClient) (BuildpackBindingResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BuildpackBindingCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BuildpackBindingCreateOrUpdateFuture.Result. +func (future *BuildpackBindingCreateOrUpdateFuture) result(client BuildpackBindingClient) (bbr BuildpackBindingResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bbr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BuildpackBindingCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bbr.Response.Response, err = future.GetResult(sender); err == nil && bbr.Response.Response.StatusCode != http.StatusNoContent { + bbr, err = client.CreateOrUpdateResponder(bbr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingCreateOrUpdateFuture", "Result", bbr.Response.Response, "Failure responding to request") + } + } + return +} + +// BuildpackBindingDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BuildpackBindingDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BuildpackBindingClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BuildpackBindingDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BuildpackBindingDeleteFuture.Result. +func (future *BuildpackBindingDeleteFuture) result(client BuildpackBindingClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BuildpackBindingDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BuildpackBindingLaunchProperties buildpack Binding Launch Properties +type BuildpackBindingLaunchProperties struct { + // Properties - Non-sensitive properties for launchProperties + Properties map[string]*string `json:"properties"` + // Secrets - Sensitive properties for launchProperties + Secrets map[string]*string `json:"secrets"` +} + +// MarshalJSON is the custom marshaler for BuildpackBindingLaunchProperties. +func (bblp BuildpackBindingLaunchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bblp.Properties != nil { + objectMap["properties"] = bblp.Properties + } + if bblp.Secrets != nil { + objectMap["secrets"] = bblp.Secrets + } + return json.Marshal(objectMap) +} + +// BuildpackBindingProperties properties of a buildpack binding +type BuildpackBindingProperties struct { + // BindingType - Buildpack Binding Type. Possible values include: 'BindingTypeApplicationInsights', 'BindingTypeApacheSkyWalking', 'BindingTypeAppDynamics', 'BindingTypeDynatrace', 'BindingTypeNewRelic', 'BindingTypeElasticAPM' + BindingType BindingType `json:"bindingType,omitempty"` + // ProvisioningState - READ-ONLY; State of the Buildpack Binding. Possible values include: 'BuildpackBindingProvisioningStateCreating', 'BuildpackBindingProvisioningStateUpdating', 'BuildpackBindingProvisioningStateSucceeded', 'BuildpackBindingProvisioningStateFailed', 'BuildpackBindingProvisioningStateDeleting' + ProvisioningState BuildpackBindingProvisioningState `json:"provisioningState,omitempty"` + // LaunchProperties - The object describes the buildpack binding launch properties + LaunchProperties *BuildpackBindingLaunchProperties `json:"launchProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildpackBindingProperties. +func (bbp BuildpackBindingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bbp.BindingType != "" { + objectMap["bindingType"] = bbp.BindingType + } + if bbp.LaunchProperties != nil { + objectMap["launchProperties"] = bbp.LaunchProperties + } + return json.Marshal(objectMap) +} + +// BuildpackBindingResource buildpack Binding Resource object +type BuildpackBindingResource struct { + autorest.Response `json:"-"` + // Properties - Properties of a buildpack binding + Properties *BuildpackBindingProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildpackBindingResource. +func (bbr BuildpackBindingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bbr.Properties != nil { + objectMap["properties"] = bbr.Properties + } + if bbr.SystemData != nil { + objectMap["systemData"] = bbr.SystemData + } + return json.Marshal(objectMap) +} + +// BuildpackBindingResourceCollection object that includes an array of BuildpackBinding resources and a +// possible link for next set +type BuildpackBindingResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of BuildpackBinding resources + Value *[]BuildpackBindingResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuildpackBindingResourceCollectionIterator provides access to a complete listing of +// BuildpackBindingResource values. +type BuildpackBindingResourceCollectionIterator struct { + i int + page BuildpackBindingResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BuildpackBindingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BuildpackBindingResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuildpackBindingResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BuildpackBindingResourceCollectionIterator) Response() BuildpackBindingResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BuildpackBindingResourceCollectionIterator) Value() BuildpackBindingResource { + if !iter.page.NotDone() { + return BuildpackBindingResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuildpackBindingResourceCollectionIterator type. +func NewBuildpackBindingResourceCollectionIterator(page BuildpackBindingResourceCollectionPage) BuildpackBindingResourceCollectionIterator { + return BuildpackBindingResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bbrc BuildpackBindingResourceCollection) IsEmpty() bool { + return bbrc.Value == nil || len(*bbrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bbrc BuildpackBindingResourceCollection) hasNextLink() bool { + return bbrc.NextLink != nil && len(*bbrc.NextLink) != 0 +} + +// buildpackBindingResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bbrc BuildpackBindingResourceCollection) buildpackBindingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !bbrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bbrc.NextLink))) +} + +// BuildpackBindingResourceCollectionPage contains a page of BuildpackBindingResource values. +type BuildpackBindingResourceCollectionPage struct { + fn func(context.Context, BuildpackBindingResourceCollection) (BuildpackBindingResourceCollection, error) + bbrc BuildpackBindingResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BuildpackBindingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bbrc) + if err != nil { + return err + } + page.bbrc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BuildpackBindingResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuildpackBindingResourceCollectionPage) NotDone() bool { + return !page.bbrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuildpackBindingResourceCollectionPage) Response() BuildpackBindingResourceCollection { + return page.bbrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuildpackBindingResourceCollectionPage) Values() []BuildpackBindingResource { + if page.bbrc.IsEmpty() { + return nil + } + return *page.bbrc.Value +} + +// Creates a new instance of the BuildpackBindingResourceCollectionPage type. +func NewBuildpackBindingResourceCollectionPage(cur BuildpackBindingResourceCollection, getNextPage func(context.Context, BuildpackBindingResourceCollection) (BuildpackBindingResourceCollection, error)) BuildpackBindingResourceCollectionPage { + return BuildpackBindingResourceCollectionPage{ + fn: getNextPage, + bbrc: cur, + } +} + +// BuildpackProperties buildpack properties payload +type BuildpackProperties struct { + // ID - Id of the buildpack + ID *string `json:"id,omitempty"` +} + +// BuildpacksGroupProperties buildpack group properties of the Builder +type BuildpacksGroupProperties struct { + // Name - Buildpack group name + Name *string `json:"name,omitempty"` + // Buildpacks - Buildpacks in the buildpack group + Buildpacks *[]BuildpackProperties `json:"buildpacks,omitempty"` +} + +// BuildProperties build resource properties payload +type BuildProperties struct { + // RelativePath - The relative path of source code + RelativePath *string `json:"relativePath,omitempty"` + // Builder - The resource id of builder to build the source code + Builder *string `json:"builder,omitempty"` + // AgentPool - The resource id of agent pool + AgentPool *string `json:"agentPool,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the KPack build result. Possible values include: 'BuildProvisioningStateCreating', 'BuildProvisioningStateUpdating', 'BuildProvisioningStateSucceeded', 'BuildProvisioningStateFailed', 'BuildProvisioningStateDeleting' + ProvisioningState BuildProvisioningState `json:"provisioningState,omitempty"` + // Env - The environment variables for this build + Env map[string]*string `json:"env"` + // TriggeredBuildResult - The build result triggered by this build + TriggeredBuildResult *TriggeredBuildResult `json:"triggeredBuildResult,omitempty"` + // ResourceRequests - The customized build resource for this build + ResourceRequests *BuildResourceRequests `json:"resourceRequests,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildProperties. +func (bp BuildProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bp.RelativePath != nil { + objectMap["relativePath"] = bp.RelativePath + } + if bp.Builder != nil { + objectMap["builder"] = bp.Builder + } + if bp.AgentPool != nil { + objectMap["agentPool"] = bp.AgentPool + } + if bp.Env != nil { + objectMap["env"] = bp.Env + } + if bp.TriggeredBuildResult != nil { + objectMap["triggeredBuildResult"] = bp.TriggeredBuildResult + } + if bp.ResourceRequests != nil { + objectMap["resourceRequests"] = bp.ResourceRequests + } + return json.Marshal(objectMap) +} + +// BuildResourceRequests resource request payload of Build Resource. +type BuildResourceRequests struct { + // CPU - Optional Cpu allocated to the build resource. 1 core can be represented by 1 or 1000m. + // The default value is 1, this should not exceed build service agent pool cpu size. + CPU *string `json:"cpu,omitempty"` + // Memory - Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi or 1024Mi. + // The default value is 2Gi, this should not exceed build service agent pool memory size. + Memory *string `json:"memory,omitempty"` +} + +// BuildResult build result resource payload +type BuildResult struct { + autorest.Response `json:"-"` + // Properties - Properties of the build result resource + Properties *BuildResultProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildResult. +func (br BuildResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if br.Properties != nil { + objectMap["properties"] = br.Properties + } + if br.SystemData != nil { + objectMap["systemData"] = br.SystemData + } + return json.Marshal(objectMap) +} + +// BuildResultCollection object that includes an array of Build result resources and a possible link for +// next set +type BuildResultCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Build result resources + Value *[]BuildResult `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuildResultCollectionIterator provides access to a complete listing of BuildResult values. +type BuildResultCollectionIterator struct { + i int + page BuildResultCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BuildResultCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildResultCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BuildResultCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuildResultCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BuildResultCollectionIterator) Response() BuildResultCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BuildResultCollectionIterator) Value() BuildResult { + if !iter.page.NotDone() { + return BuildResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuildResultCollectionIterator type. +func NewBuildResultCollectionIterator(page BuildResultCollectionPage) BuildResultCollectionIterator { + return BuildResultCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (brc BuildResultCollection) IsEmpty() bool { + return brc.Value == nil || len(*brc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (brc BuildResultCollection) hasNextLink() bool { + return brc.NextLink != nil && len(*brc.NextLink) != 0 +} + +// buildResultCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (brc BuildResultCollection) buildResultCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !brc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(brc.NextLink))) +} + +// BuildResultCollectionPage contains a page of BuildResult values. +type BuildResultCollectionPage struct { + fn func(context.Context, BuildResultCollection) (BuildResultCollection, error) + brc BuildResultCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BuildResultCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildResultCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.brc) + if err != nil { + return err + } + page.brc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BuildResultCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuildResultCollectionPage) NotDone() bool { + return !page.brc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuildResultCollectionPage) Response() BuildResultCollection { + return page.brc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuildResultCollectionPage) Values() []BuildResult { + if page.brc.IsEmpty() { + return nil + } + return *page.brc.Value +} + +// Creates a new instance of the BuildResultCollectionPage type. +func NewBuildResultCollectionPage(cur BuildResultCollection, getNextPage func(context.Context, BuildResultCollection) (BuildResultCollection, error)) BuildResultCollectionPage { + return BuildResultCollectionPage{ + fn: getNextPage, + brc: cur, + } +} + +// BuildResultLog build result log resource properties payload +type BuildResultLog struct { + autorest.Response `json:"-"` + // BlobURL - The public download URL of this build result log + BlobURL *string `json:"blobUrl,omitempty"` +} + +// BuildResultProperties build result resource properties payload +type BuildResultProperties struct { + // Name - The name of this build result + Name *string `json:"name,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the KPack build result. Possible values include: 'BuildResultProvisioningStateQueuing', 'BuildResultProvisioningStateBuilding', 'BuildResultProvisioningStateSucceeded', 'BuildResultProvisioningStateFailed', 'BuildResultProvisioningStateDeleting' + ProvisioningState BuildResultProvisioningState `json:"provisioningState,omitempty"` + // BuildPodName - The build pod name which can be used to get the build log streaming. + BuildPodName *string `json:"buildPodName,omitempty"` + // BuildStages - READ-ONLY; All of the build stage (init-container and container) resources in build pod. + BuildStages *[]BuildStageProperties `json:"buildStages,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildResultProperties. +func (brp BuildResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if brp.Name != nil { + objectMap["name"] = brp.Name + } + if brp.BuildPodName != nil { + objectMap["buildPodName"] = brp.BuildPodName + } + return json.Marshal(objectMap) +} + +// BuildResultUserSourceInfo reference to a build result +type BuildResultUserSourceInfo struct { + // BuildResultID - Resource id of an existing succeeded build result under the same Spring instance. + BuildResultID *string `json:"buildResultId,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeBasicUserSourceInfoTypeUserSourceInfo', 'TypeBasicUserSourceInfoTypeUploadedUserSourceInfo', 'TypeBasicUserSourceInfoTypeJar', 'TypeBasicUserSourceInfoTypeSource', 'TypeBasicUserSourceInfoTypeNetCoreZip', 'TypeBasicUserSourceInfoTypeBuildResult', 'TypeBasicUserSourceInfoTypeContainer' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) MarshalJSON() ([]byte, error) { + brusi.Type = TypeBasicUserSourceInfoTypeBuildResult + objectMap := make(map[string]interface{}) + if brusi.BuildResultID != nil { + objectMap["buildResultId"] = brusi.BuildResultID + } + if brusi.Version != nil { + objectMap["version"] = brusi.Version + } + if brusi.Type != "" { + objectMap["type"] = brusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return &brusi, true +} + +// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &brusi, true +} + +// BuildService build service resource payload +type BuildService struct { + autorest.Response `json:"-"` + // Properties - Properties of the build resource + Properties *BuildServiceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildService. +func (bs BuildService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bs.Properties != nil { + objectMap["properties"] = bs.Properties + } + if bs.SystemData != nil { + objectMap["systemData"] = bs.SystemData + } + return json.Marshal(objectMap) +} + +// BuildServiceAgentPoolProperties build service agent pool properties +type BuildServiceAgentPoolProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the build service agent pool + ProvisioningState *string `json:"provisioningState,omitempty"` + // PoolSize - build service agent pool size properties + PoolSize *BuildServiceAgentPoolSizeProperties `json:"poolSize,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildServiceAgentPoolProperties. +func (bsapp BuildServiceAgentPoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsapp.PoolSize != nil { + objectMap["poolSize"] = bsapp.PoolSize + } + return json.Marshal(objectMap) +} + +// BuildServiceAgentPoolResource the build service agent pool resource +type BuildServiceAgentPoolResource struct { + autorest.Response `json:"-"` + // Properties - build service agent pool properties + Properties *BuildServiceAgentPoolProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildServiceAgentPoolResource. +func (bsapr BuildServiceAgentPoolResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsapr.Properties != nil { + objectMap["properties"] = bsapr.Properties + } + if bsapr.SystemData != nil { + objectMap["systemData"] = bsapr.SystemData + } + return json.Marshal(objectMap) +} + +// BuildServiceAgentPoolResourceCollection object that includes an array of build service agent pool +// resources and a possible link for next set +type BuildServiceAgentPoolResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of build service agent pool resource + Value *[]BuildServiceAgentPoolResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuildServiceAgentPoolResourceCollectionIterator provides access to a complete listing of +// BuildServiceAgentPoolResource values. +type BuildServiceAgentPoolResourceCollectionIterator struct { + i int + page BuildServiceAgentPoolResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BuildServiceAgentPoolResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BuildServiceAgentPoolResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuildServiceAgentPoolResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BuildServiceAgentPoolResourceCollectionIterator) Response() BuildServiceAgentPoolResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BuildServiceAgentPoolResourceCollectionIterator) Value() BuildServiceAgentPoolResource { + if !iter.page.NotDone() { + return BuildServiceAgentPoolResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuildServiceAgentPoolResourceCollectionIterator type. +func NewBuildServiceAgentPoolResourceCollectionIterator(page BuildServiceAgentPoolResourceCollectionPage) BuildServiceAgentPoolResourceCollectionIterator { + return BuildServiceAgentPoolResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bsaprc BuildServiceAgentPoolResourceCollection) IsEmpty() bool { + return bsaprc.Value == nil || len(*bsaprc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bsaprc BuildServiceAgentPoolResourceCollection) hasNextLink() bool { + return bsaprc.NextLink != nil && len(*bsaprc.NextLink) != 0 +} + +// buildServiceAgentPoolResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bsaprc BuildServiceAgentPoolResourceCollection) buildServiceAgentPoolResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !bsaprc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bsaprc.NextLink))) +} + +// BuildServiceAgentPoolResourceCollectionPage contains a page of BuildServiceAgentPoolResource values. +type BuildServiceAgentPoolResourceCollectionPage struct { + fn func(context.Context, BuildServiceAgentPoolResourceCollection) (BuildServiceAgentPoolResourceCollection, error) + bsaprc BuildServiceAgentPoolResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BuildServiceAgentPoolResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bsaprc) + if err != nil { + return err + } + page.bsaprc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BuildServiceAgentPoolResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuildServiceAgentPoolResourceCollectionPage) NotDone() bool { + return !page.bsaprc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuildServiceAgentPoolResourceCollectionPage) Response() BuildServiceAgentPoolResourceCollection { + return page.bsaprc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuildServiceAgentPoolResourceCollectionPage) Values() []BuildServiceAgentPoolResource { + if page.bsaprc.IsEmpty() { + return nil + } + return *page.bsaprc.Value +} + +// Creates a new instance of the BuildServiceAgentPoolResourceCollectionPage type. +func NewBuildServiceAgentPoolResourceCollectionPage(cur BuildServiceAgentPoolResourceCollection, getNextPage func(context.Context, BuildServiceAgentPoolResourceCollection) (BuildServiceAgentPoolResourceCollection, error)) BuildServiceAgentPoolResourceCollectionPage { + return BuildServiceAgentPoolResourceCollectionPage{ + fn: getNextPage, + bsaprc: cur, + } +} + +// BuildServiceAgentPoolSizeProperties build service agent pool size properties +type BuildServiceAgentPoolSizeProperties struct { + // Name - The name of build service agent pool size + Name *string `json:"name,omitempty"` + // CPU - READ-ONLY; The cpu property of build service agent pool size + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; The memory property of build service agent pool size + Memory *string `json:"memory,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildServiceAgentPoolSizeProperties. +func (bsapsp BuildServiceAgentPoolSizeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsapsp.Name != nil { + objectMap["name"] = bsapsp.Name + } + return json.Marshal(objectMap) +} + +// BuildServiceAgentPoolUpdatePutFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BuildServiceAgentPoolUpdatePutFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BuildServiceAgentPoolClient) (BuildServiceAgentPoolResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BuildServiceAgentPoolUpdatePutFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BuildServiceAgentPoolUpdatePutFuture.Result. +func (future *BuildServiceAgentPoolUpdatePutFuture) result(client BuildServiceAgentPoolClient) (bsapr BuildServiceAgentPoolResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolUpdatePutFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bsapr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BuildServiceAgentPoolUpdatePutFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bsapr.Response.Response, err = future.GetResult(sender); err == nil && bsapr.Response.Response.StatusCode != http.StatusNoContent { + bsapr, err = client.UpdatePutResponder(bsapr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolUpdatePutFuture", "Result", bsapr.Response.Response, "Failure responding to request") + } + } + return +} + +// BuildServiceBuilderCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BuildServiceBuilderCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BuildServiceBuilderClient) (BuilderResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BuildServiceBuilderCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BuildServiceBuilderCreateOrUpdateFuture.Result. +func (future *BuildServiceBuilderCreateOrUpdateFuture) result(client BuildServiceBuilderClient) (br BuilderResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + br.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BuildServiceBuilderCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if br.Response.Response, err = future.GetResult(sender); err == nil && br.Response.Response.StatusCode != http.StatusNoContent { + br, err = client.CreateOrUpdateResponder(br.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderCreateOrUpdateFuture", "Result", br.Response.Response, "Failure responding to request") + } + } + return +} + +// BuildServiceBuilderDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BuildServiceBuilderDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BuildServiceBuilderClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BuildServiceBuilderDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BuildServiceBuilderDeleteFuture.Result. +func (future *BuildServiceBuilderDeleteFuture) result(client BuildServiceBuilderClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BuildServiceBuilderDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BuildServiceCollection object that includes an array of Build service resources and a possible link for +// next set +type BuildServiceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Build service resources + Value *[]BuildService `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuildServiceCollectionIterator provides access to a complete listing of BuildService values. +type BuildServiceCollectionIterator struct { + i int + page BuildServiceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BuildServiceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BuildServiceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuildServiceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BuildServiceCollectionIterator) Response() BuildServiceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BuildServiceCollectionIterator) Value() BuildService { + if !iter.page.NotDone() { + return BuildService{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuildServiceCollectionIterator type. +func NewBuildServiceCollectionIterator(page BuildServiceCollectionPage) BuildServiceCollectionIterator { + return BuildServiceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bsc BuildServiceCollection) IsEmpty() bool { + return bsc.Value == nil || len(*bsc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bsc BuildServiceCollection) hasNextLink() bool { + return bsc.NextLink != nil && len(*bsc.NextLink) != 0 +} + +// buildServiceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bsc BuildServiceCollection) buildServiceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !bsc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bsc.NextLink))) +} + +// BuildServiceCollectionPage contains a page of BuildService values. +type BuildServiceCollectionPage struct { + fn func(context.Context, BuildServiceCollection) (BuildServiceCollection, error) + bsc BuildServiceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BuildServiceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bsc) + if err != nil { + return err + } + page.bsc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BuildServiceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuildServiceCollectionPage) NotDone() bool { + return !page.bsc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuildServiceCollectionPage) Response() BuildServiceCollection { + return page.bsc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuildServiceCollectionPage) Values() []BuildService { + if page.bsc.IsEmpty() { + return nil + } + return *page.bsc.Value +} + +// Creates a new instance of the BuildServiceCollectionPage type. +func NewBuildServiceCollectionPage(cur BuildServiceCollection, getNextPage func(context.Context, BuildServiceCollection) (BuildServiceCollection, error)) BuildServiceCollectionPage { + return BuildServiceCollectionPage{ + fn: getNextPage, + bsc: cur, + } +} + +// BuildServiceProperties build service resource properties payload +type BuildServiceProperties struct { + // KPackVersion - The installed KPack version in this build service. + KPackVersion *string `json:"kPackVersion,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the KPack build result. Possible values include: 'BuildServiceProvisioningStateCreating', 'BuildServiceProvisioningStateUpdating', 'BuildServiceProvisioningStateSucceeded', 'BuildServiceProvisioningStateFailed', 'BuildServiceProvisioningStateDeleting' + ProvisioningState BuildServiceProvisioningState `json:"provisioningState,omitempty"` + // ResourceRequests - The runtime resource configuration of this build service. + ResourceRequests *BuildServicePropertiesResourceRequests `json:"resourceRequests,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildServiceProperties. +func (bsp BuildServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsp.KPackVersion != nil { + objectMap["kPackVersion"] = bsp.KPackVersion + } + if bsp.ResourceRequests != nil { + objectMap["resourceRequests"] = bsp.ResourceRequests + } + return json.Marshal(objectMap) +} + +// BuildServicePropertiesResourceRequests the runtime resource configuration of this build service. +type BuildServicePropertiesResourceRequests struct { + // CPU - READ-ONLY; vCPU allocated to the entire build service node pool. + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; Memory allocated to the entire build service node pool. + Memory *string `json:"memory,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildServicePropertiesResourceRequests. +func (bspR BuildServicePropertiesResourceRequests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BuildStageProperties the build stage (init-container and container) resources in build pod. +type BuildStageProperties struct { + // Name - READ-ONLY; The name of this build stage resource. + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; The provisioning state of this build stage resource. Possible values include: 'KPackBuildStageProvisioningStateNotStarted', 'KPackBuildStageProvisioningStateRunning', 'KPackBuildStageProvisioningStateSucceeded', 'KPackBuildStageProvisioningStateFailed' + Status KPackBuildStageProvisioningState `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildStageProperties. +func (bsp BuildStageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BasicCertificateProperties certificate resource payload. +type BasicCertificateProperties interface { + AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) + AsContentCertificateProperties() (*ContentCertificateProperties, bool) + AsCertificateProperties() (*CertificateProperties, bool) +} + +// CertificateProperties certificate resource payload. +type CertificateProperties struct { + // Thumbprint - READ-ONLY; The thumbprint of certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // Issuer - READ-ONLY; The issuer of certificate. + Issuer *string `json:"issuer,omitempty"` + // IssuedDate - READ-ONLY; The issue date of certificate. + IssuedDate *string `json:"issuedDate,omitempty"` + // ExpirationDate - READ-ONLY; The expiration date of certificate. + ExpirationDate *string `json:"expirationDate,omitempty"` + // ActivateDate - READ-ONLY; The activate date of certificate. + ActivateDate *string `json:"activateDate,omitempty"` + // SubjectName - READ-ONLY; The subject name of certificate. + SubjectName *string `json:"subjectName,omitempty"` + // DNSNames - READ-ONLY; The domain list of certificate. + DNSNames *[]string `json:"dnsNames,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the Certificate. Possible values include: 'CertificateResourceProvisioningStateCreating', 'CertificateResourceProvisioningStateUpdating', 'CertificateResourceProvisioningStateSucceeded', 'CertificateResourceProvisioningStateFailed', 'CertificateResourceProvisioningStateDeleting' + ProvisioningState CertificateResourceProvisioningState `json:"provisioningState,omitempty"` + // Type - Possible values include: 'TypeBasicCertificatePropertiesTypeCertificateProperties', 'TypeBasicCertificatePropertiesTypeKeyVaultCertificate', 'TypeBasicCertificatePropertiesTypeContentCertificate' + Type TypeBasicCertificateProperties `json:"type,omitempty"` +} + +func unmarshalBasicCertificateProperties(body []byte) (BasicCertificateProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicCertificatePropertiesTypeKeyVaultCertificate): + var kvcp KeyVaultCertificateProperties + err := json.Unmarshal(body, &kvcp) + return kvcp, err + case string(TypeBasicCertificatePropertiesTypeContentCertificate): + var ccp ContentCertificateProperties + err := json.Unmarshal(body, &ccp) + return ccp, err + default: + var cp CertificateProperties + err := json.Unmarshal(body, &cp) + return cp, err + } +} +func unmarshalBasicCertificatePropertiesArray(body []byte) ([]BasicCertificateProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + cpArray := make([]BasicCertificateProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + cp, err := unmarshalBasicCertificateProperties(*rawMessage) + if err != nil { + return nil, err + } + cpArray[index] = cp + } + return cpArray, nil +} + +// MarshalJSON is the custom marshaler for CertificateProperties. +func (cp CertificateProperties) MarshalJSON() ([]byte, error) { + cp.Type = TypeBasicCertificatePropertiesTypeCertificateProperties + objectMap := make(map[string]interface{}) + if cp.Type != "" { + objectMap["type"] = cp.Type + } + return json.Marshal(objectMap) +} + +// AsKeyVaultCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. +func (cp CertificateProperties) AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) { + return nil, false +} + +// AsContentCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. +func (cp CertificateProperties) AsContentCertificateProperties() (*ContentCertificateProperties, bool) { + return nil, false +} + +// AsCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. +func (cp CertificateProperties) AsCertificateProperties() (*CertificateProperties, bool) { + return &cp, true +} + +// AsBasicCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. +func (cp CertificateProperties) AsBasicCertificateProperties() (BasicCertificateProperties, bool) { + return &cp, true +} + +// CertificateResource certificate resource payload. +type CertificateResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the certificate resource payload. + Properties BasicCertificateProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateResource. +func (cr CertificateResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = cr.Properties + if cr.SystemData != nil { + objectMap["systemData"] = cr.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CertificateResource struct. +func (cr *CertificateResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + properties, err := unmarshalBasicCertificateProperties(*v) + if err != nil { + return err + } + cr.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cr.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + cr.SystemData = &systemData + } + } + } + + return nil +} + +// CertificateResourceCollection collection compose of certificate resources list and a possible link for +// next page. +type CertificateResourceCollection struct { + autorest.Response `json:"-"` + // Value - The certificate resources list. + Value *[]CertificateResource `json:"value,omitempty"` + // NextLink - The link to next page of certificate list. + NextLink *string `json:"nextLink,omitempty"` +} + +// CertificateResourceCollectionIterator provides access to a complete listing of CertificateResource +// values. +type CertificateResourceCollectionIterator struct { + i int + page CertificateResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CertificateResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CertificateResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CertificateResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CertificateResourceCollectionIterator) Response() CertificateResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CertificateResourceCollectionIterator) Value() CertificateResource { + if !iter.page.NotDone() { + return CertificateResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CertificateResourceCollectionIterator type. +func NewCertificateResourceCollectionIterator(page CertificateResourceCollectionPage) CertificateResourceCollectionIterator { + return CertificateResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (crc CertificateResourceCollection) IsEmpty() bool { + return crc.Value == nil || len(*crc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (crc CertificateResourceCollection) hasNextLink() bool { + return crc.NextLink != nil && len(*crc.NextLink) != 0 +} + +// certificateResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (crc CertificateResourceCollection) certificateResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !crc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(crc.NextLink))) +} + +// CertificateResourceCollectionPage contains a page of CertificateResource values. +type CertificateResourceCollectionPage struct { + fn func(context.Context, CertificateResourceCollection) (CertificateResourceCollection, error) + crc CertificateResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CertificateResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.crc) + if err != nil { + return err + } + page.crc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CertificateResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CertificateResourceCollectionPage) NotDone() bool { + return !page.crc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CertificateResourceCollectionPage) Response() CertificateResourceCollection { + return page.crc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CertificateResourceCollectionPage) Values() []CertificateResource { + if page.crc.IsEmpty() { + return nil + } + return *page.crc.Value +} + +// Creates a new instance of the CertificateResourceCollectionPage type. +func NewCertificateResourceCollectionPage(cur CertificateResourceCollection, getNextPage func(context.Context, CertificateResourceCollection) (CertificateResourceCollection, error)) CertificateResourceCollectionPage { + return CertificateResourceCollectionPage{ + fn: getNextPage, + crc: cur, + } +} + +// CertificatesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type CertificatesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CertificatesClient) (CertificateResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CertificatesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CertificatesCreateOrUpdateFuture.Result. +func (future *CertificatesCreateOrUpdateFuture) result(client CertificatesClient) (cr CertificateResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.CertificatesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { + cr, err = client.CreateOrUpdateResponder(cr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesCreateOrUpdateFuture", "Result", cr.Response.Response, "Failure responding to request") + } + } + return +} + +// CertificatesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CertificatesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CertificatesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CertificatesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CertificatesDeleteFuture.Result. +func (future *CertificatesDeleteFuture) result(client CertificatesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.CertificatesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// CloudError an error response from the service. +type CloudError struct { + // Error - An error response from the service. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// ClusterResourceProperties service properties payload +type ClusterResourceProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the Service. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateStarting', 'ProvisioningStateStopping', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving', 'ProvisioningStateMoved', 'ProvisioningStateMoveFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // NetworkProfile - Network profile of the Service + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // VnetAddons - Additional Service settings in vnet injection instance + VnetAddons *ServiceVNetAddons `json:"vnetAddons,omitempty"` + // Version - READ-ONLY; Version of the Service + Version *int32 `json:"version,omitempty"` + // ServiceID - READ-ONLY; ServiceInstanceEntity GUID which uniquely identifies a created resource + ServiceID *string `json:"serviceId,omitempty"` + // PowerState - READ-ONLY; Power state of the Service. Possible values include: 'PowerStateRunning', 'PowerStateStopped' + PowerState PowerState `json:"powerState,omitempty"` + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + // Fqdn - READ-ONLY; Fully qualified dns name of the service instance + Fqdn *string `json:"fqdn,omitempty"` + // MarketplaceResource - Purchasing 3rd party product of the Service resource. + MarketplaceResource *MarketplaceResource `json:"marketplaceResource,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterResourceProperties. +func (crp ClusterResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if crp.NetworkProfile != nil { + objectMap["networkProfile"] = crp.NetworkProfile + } + if crp.VnetAddons != nil { + objectMap["vnetAddons"] = crp.VnetAddons + } + if crp.ZoneRedundant != nil { + objectMap["zoneRedundant"] = crp.ZoneRedundant + } + if crp.MarketplaceResource != nil { + objectMap["marketplaceResource"] = crp.MarketplaceResource + } + return json.Marshal(objectMap) +} + +// ConfigServerGitProperty property of git. +type ConfigServerGitProperty struct { + // Repositories - Repositories of git. + Repositories *[]GitPatternRepository `json:"repositories,omitempty"` + // URI - URI of the repository + URI *string `json:"uri,omitempty"` + // Label - Label of the repository + Label *string `json:"label,omitempty"` + // SearchPaths - Searching path of the repository + SearchPaths *[]string `json:"searchPaths,omitempty"` + // Username - Username of git repository basic auth. + Username *string `json:"username,omitempty"` + // Password - Password of git repository basic auth. + Password *string `json:"password,omitempty"` + // HostKey - Public sshKey of git repository. + HostKey *string `json:"hostKey,omitempty"` + // HostKeyAlgorithm - SshKey algorithm of git repository. + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + // PrivateKey - Private sshKey algorithm of git repository. + PrivateKey *string `json:"privateKey,omitempty"` + // StrictHostKeyChecking - Strict host key checking or not. + StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` +} + +// ConfigServerProperties config server git properties payload +type ConfigServerProperties struct { + // ProvisioningState - READ-ONLY; State of the config server. Possible values include: 'ConfigServerStateNotAvailable', 'ConfigServerStateDeleted', 'ConfigServerStateFailed', 'ConfigServerStateSucceeded', 'ConfigServerStateUpdating' + ProvisioningState ConfigServerState `json:"provisioningState,omitempty"` + // Error - Error when apply config server settings. + Error *Error `json:"error,omitempty"` + // ConfigServer - Settings of config server. + ConfigServer *ConfigServerSettings `json:"configServer,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigServerProperties. +func (csp ConfigServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csp.Error != nil { + objectMap["error"] = csp.Error + } + if csp.ConfigServer != nil { + objectMap["configServer"] = csp.ConfigServer + } + return json.Marshal(objectMap) +} + +// ConfigServerResource config Server resource +type ConfigServerResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Config Server resource + Properties *ConfigServerProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigServerResource. +func (csr ConfigServerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csr.Properties != nil { + objectMap["properties"] = csr.Properties + } + if csr.SystemData != nil { + objectMap["systemData"] = csr.SystemData + } + return json.Marshal(objectMap) +} + +// ConfigServerSettings the settings of config server. +type ConfigServerSettings struct { + // GitProperty - Property of git environment. + GitProperty *ConfigServerGitProperty `json:"gitProperty,omitempty"` +} + +// ConfigServerSettingsErrorRecord error record of the config server settings +type ConfigServerSettingsErrorRecord struct { + // Name - The name of the config server settings error record + Name *string `json:"name,omitempty"` + // URI - The uri of the config server settings error record + URI *string `json:"uri,omitempty"` + // Messages - The detail error messages of the record + Messages *[]string `json:"messages,omitempty"` +} + +// ConfigServerSettingsValidateResult validation result for config server settings +type ConfigServerSettingsValidateResult struct { + autorest.Response `json:"-"` + // IsValid - Indicate if the config server settings are valid + IsValid *bool `json:"isValid,omitempty"` + // Details - The detail validation results + Details *[]ConfigServerSettingsErrorRecord `json:"details,omitempty"` +} + +// ConfigServersUpdatePatchFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConfigServersUpdatePatchFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigServersClient) (ConfigServerResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigServersUpdatePatchFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConfigServersUpdatePatchFuture.Result. +func (future *ConfigServersUpdatePatchFuture) result(client ConfigServersClient) (csr ConfigServerResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePatchFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + csr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigServersUpdatePatchFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if csr.Response.Response, err = future.GetResult(sender); err == nil && csr.Response.Response.StatusCode != http.StatusNoContent { + csr, err = client.UpdatePatchResponder(csr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePatchFuture", "Result", csr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConfigServersUpdatePutFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConfigServersUpdatePutFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigServersClient) (ConfigServerResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigServersUpdatePutFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConfigServersUpdatePutFuture.Result. +func (future *ConfigServersUpdatePutFuture) result(client ConfigServersClient) (csr ConfigServerResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePutFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + csr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigServersUpdatePutFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if csr.Response.Response, err = future.GetResult(sender); err == nil && csr.Response.Response.StatusCode != http.StatusNoContent { + csr, err = client.UpdatePutResponder(csr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePutFuture", "Result", csr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConfigServersValidateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConfigServersValidateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigServersClient) (ConfigServerSettingsValidateResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigServersValidateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConfigServersValidateFuture.Result. +func (future *ConfigServersValidateFuture) result(client ConfigServersClient) (cssvr ConfigServerSettingsValidateResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersValidateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cssvr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigServersValidateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cssvr.Response.Response, err = future.GetResult(sender); err == nil && cssvr.Response.Response.StatusCode != http.StatusNoContent { + cssvr, err = client.ValidateResponder(cssvr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersValidateFuture", "Result", cssvr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConfigurationServiceGitProperty property of git environment. +type ConfigurationServiceGitProperty struct { + Repositories *[]ConfigurationServiceGitRepository `json:"repositories,omitempty"` +} + +// ConfigurationServiceGitPropertyValidateResult validation result for configuration service settings +type ConfigurationServiceGitPropertyValidateResult struct { + // IsValid - Indicate if the configuration service settings are valid + IsValid *bool `json:"isValid,omitempty"` + // GitReposValidationResult - The detail validation results + GitReposValidationResult *[]ValidationMessages `json:"gitReposValidationResult,omitempty"` +} + +// ConfigurationServiceGitRepository git repository property payload for Application Configuration Service +type ConfigurationServiceGitRepository struct { + // Name - Name of the repository + Name *string `json:"name,omitempty"` + // Patterns - Collection of patterns of the repository + Patterns *[]string `json:"patterns,omitempty"` + // URI - URI of the repository + URI *string `json:"uri,omitempty"` + // Label - Label of the repository + Label *string `json:"label,omitempty"` + // SearchPaths - Searching path of the repository + SearchPaths *[]string `json:"searchPaths,omitempty"` + // Username - Username of git repository basic auth. + Username *string `json:"username,omitempty"` + // Password - Password of git repository basic auth. + Password *string `json:"password,omitempty"` + // HostKey - Public sshKey of git repository. + HostKey *string `json:"hostKey,omitempty"` + // HostKeyAlgorithm - SshKey algorithm of git repository. + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + // PrivateKey - Private sshKey algorithm of git repository. + PrivateKey *string `json:"privateKey,omitempty"` + // StrictHostKeyChecking - Strict host key checking or not. + StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` +} + +// ConfigurationServiceInstance collection of instances belong to the Application Configuration Service +type ConfigurationServiceInstance struct { + // Name - READ-ONLY; Name of the Application Configuration Service instance + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Status of the Application Configuration Service instance + Status *string `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationServiceInstance. +func (csi ConfigurationServiceInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ConfigurationServiceProperties application Configuration Service properties payload +type ConfigurationServiceProperties struct { + // ProvisioningState - READ-ONLY; State of the Application Configuration Service. Possible values include: 'ConfigurationServiceProvisioningStateCreating', 'ConfigurationServiceProvisioningStateUpdating', 'ConfigurationServiceProvisioningStateSucceeded', 'ConfigurationServiceProvisioningStateFailed', 'ConfigurationServiceProvisioningStateDeleting' + ProvisioningState ConfigurationServiceProvisioningState `json:"provisioningState,omitempty"` + // ResourceRequests - The requested resource quantity for required CPU and Memory. + ResourceRequests *ConfigurationServiceResourceRequests `json:"resourceRequests,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to Application Configuration Service. + Instances *[]ConfigurationServiceInstance `json:"instances,omitempty"` + Settings *ConfigurationServiceSettings `json:"settings,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationServiceProperties. +func (csp ConfigurationServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csp.ResourceRequests != nil { + objectMap["resourceRequests"] = csp.ResourceRequests + } + if csp.Settings != nil { + objectMap["settings"] = csp.Settings + } + return json.Marshal(objectMap) +} + +// ConfigurationServiceResource application Configuration Service resource +type ConfigurationServiceResource struct { + autorest.Response `json:"-"` + Properties *ConfigurationServiceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationServiceResource. +func (csr ConfigurationServiceResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csr.Properties != nil { + objectMap["properties"] = csr.Properties + } + if csr.SystemData != nil { + objectMap["systemData"] = csr.SystemData + } + return json.Marshal(objectMap) +} + +// ConfigurationServiceResourceCollection object that includes an array of configuration service resources +// and a possible link for next set +type ConfigurationServiceResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of configuration service resources + Value *[]ConfigurationServiceResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// ConfigurationServiceResourceCollectionIterator provides access to a complete listing of +// ConfigurationServiceResource values. +type ConfigurationServiceResourceCollectionIterator struct { + i int + page ConfigurationServiceResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ConfigurationServiceResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServiceResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ConfigurationServiceResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ConfigurationServiceResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ConfigurationServiceResourceCollectionIterator) Response() ConfigurationServiceResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ConfigurationServiceResourceCollectionIterator) Value() ConfigurationServiceResource { + if !iter.page.NotDone() { + return ConfigurationServiceResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ConfigurationServiceResourceCollectionIterator type. +func NewConfigurationServiceResourceCollectionIterator(page ConfigurationServiceResourceCollectionPage) ConfigurationServiceResourceCollectionIterator { + return ConfigurationServiceResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (csrc ConfigurationServiceResourceCollection) IsEmpty() bool { + return csrc.Value == nil || len(*csrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (csrc ConfigurationServiceResourceCollection) hasNextLink() bool { + return csrc.NextLink != nil && len(*csrc.NextLink) != 0 +} + +// configurationServiceResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (csrc ConfigurationServiceResourceCollection) configurationServiceResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !csrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(csrc.NextLink))) +} + +// ConfigurationServiceResourceCollectionPage contains a page of ConfigurationServiceResource values. +type ConfigurationServiceResourceCollectionPage struct { + fn func(context.Context, ConfigurationServiceResourceCollection) (ConfigurationServiceResourceCollection, error) + csrc ConfigurationServiceResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ConfigurationServiceResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServiceResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.csrc) + if err != nil { + return err + } + page.csrc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ConfigurationServiceResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ConfigurationServiceResourceCollectionPage) NotDone() bool { + return !page.csrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ConfigurationServiceResourceCollectionPage) Response() ConfigurationServiceResourceCollection { + return page.csrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ConfigurationServiceResourceCollectionPage) Values() []ConfigurationServiceResource { + if page.csrc.IsEmpty() { + return nil + } + return *page.csrc.Value +} + +// Creates a new instance of the ConfigurationServiceResourceCollectionPage type. +func NewConfigurationServiceResourceCollectionPage(cur ConfigurationServiceResourceCollection, getNextPage func(context.Context, ConfigurationServiceResourceCollection) (ConfigurationServiceResourceCollection, error)) ConfigurationServiceResourceCollectionPage { + return ConfigurationServiceResourceCollectionPage{ + fn: getNextPage, + csrc: cur, + } +} + +// ConfigurationServiceResourceRequests resource request payload of Application Configuration Service +type ConfigurationServiceResourceRequests struct { + // CPU - READ-ONLY; Cpu allocated to each Application Configuration Service instance + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; Memory allocated to each Application Configuration Service instance + Memory *string `json:"memory,omitempty"` + // InstanceCount - READ-ONLY; Instance count of the Application Configuration Service + InstanceCount *int32 `json:"instanceCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationServiceResourceRequests. +func (csrr ConfigurationServiceResourceRequests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ConfigurationServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConfigurationServicesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigurationServicesClient) (ConfigurationServiceResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigurationServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConfigurationServicesCreateOrUpdateFuture.Result. +func (future *ConfigurationServicesCreateOrUpdateFuture) result(client ConfigurationServicesClient) (csr ConfigurationServiceResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + csr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigurationServicesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if csr.Response.Response, err = future.GetResult(sender); err == nil && csr.Response.Response.StatusCode != http.StatusNoContent { + csr, err = client.CreateOrUpdateResponder(csr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesCreateOrUpdateFuture", "Result", csr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConfigurationServicesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConfigurationServicesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigurationServicesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigurationServicesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConfigurationServicesDeleteFuture.Result. +func (future *ConfigurationServicesDeleteFuture) result(client ConfigurationServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigurationServicesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ConfigurationServiceSettings the settings of Application Configuration Service. +type ConfigurationServiceSettings struct { + GitProperty *ConfigurationServiceGitProperty `json:"gitProperty,omitempty"` +} + +// ConfigurationServiceSettingsValidateResult validation result for configuration service settings +type ConfigurationServiceSettingsValidateResult struct { + autorest.Response `json:"-"` + GitPropertyValidationResult *ConfigurationServiceGitPropertyValidateResult `json:"gitPropertyValidationResult,omitempty"` +} + +// ConfigurationServicesValidateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConfigurationServicesValidateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigurationServicesClient) (ConfigurationServiceSettingsValidateResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigurationServicesValidateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConfigurationServicesValidateFuture.Result. +func (future *ConfigurationServicesValidateFuture) result(client ConfigurationServicesClient) (cssvr ConfigurationServiceSettingsValidateResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesValidateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cssvr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigurationServicesValidateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cssvr.Response.Response, err = future.GetResult(sender); err == nil && cssvr.Response.Response.StatusCode != http.StatusNoContent { + cssvr, err = client.ValidateResponder(cssvr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesValidateFuture", "Result", cssvr.Response.Response, "Failure responding to request") + } + } + return +} + +// ContainerProbeSettings container liveness and readiness probe settings +type ContainerProbeSettings struct { + // DisableProbe - Indicates whether disable the liveness and readiness probe + DisableProbe *bool `json:"disableProbe,omitempty"` +} + +// ContentCertificateProperties properties of certificate imported from key vault. +type ContentCertificateProperties struct { + // Content - The content of uploaded certificate. + Content *string `json:"content,omitempty"` + // Thumbprint - READ-ONLY; The thumbprint of certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // Issuer - READ-ONLY; The issuer of certificate. + Issuer *string `json:"issuer,omitempty"` + // IssuedDate - READ-ONLY; The issue date of certificate. + IssuedDate *string `json:"issuedDate,omitempty"` + // ExpirationDate - READ-ONLY; The expiration date of certificate. + ExpirationDate *string `json:"expirationDate,omitempty"` + // ActivateDate - READ-ONLY; The activate date of certificate. + ActivateDate *string `json:"activateDate,omitempty"` + // SubjectName - READ-ONLY; The subject name of certificate. + SubjectName *string `json:"subjectName,omitempty"` + // DNSNames - READ-ONLY; The domain list of certificate. + DNSNames *[]string `json:"dnsNames,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the Certificate. Possible values include: 'CertificateResourceProvisioningStateCreating', 'CertificateResourceProvisioningStateUpdating', 'CertificateResourceProvisioningStateSucceeded', 'CertificateResourceProvisioningStateFailed', 'CertificateResourceProvisioningStateDeleting' + ProvisioningState CertificateResourceProvisioningState `json:"provisioningState,omitempty"` + // Type - Possible values include: 'TypeBasicCertificatePropertiesTypeCertificateProperties', 'TypeBasicCertificatePropertiesTypeKeyVaultCertificate', 'TypeBasicCertificatePropertiesTypeContentCertificate' + Type TypeBasicCertificateProperties `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContentCertificateProperties. +func (ccp ContentCertificateProperties) MarshalJSON() ([]byte, error) { + ccp.Type = TypeBasicCertificatePropertiesTypeContentCertificate + objectMap := make(map[string]interface{}) + if ccp.Content != nil { + objectMap["content"] = ccp.Content + } + if ccp.Type != "" { + objectMap["type"] = ccp.Type + } + return json.Marshal(objectMap) +} + +// AsKeyVaultCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. +func (ccp ContentCertificateProperties) AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) { + return nil, false +} + +// AsContentCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. +func (ccp ContentCertificateProperties) AsContentCertificateProperties() (*ContentCertificateProperties, bool) { + return &ccp, true +} + +// AsCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. +func (ccp ContentCertificateProperties) AsCertificateProperties() (*CertificateProperties, bool) { + return nil, false +} + +// AsBasicCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. +func (ccp ContentCertificateProperties) AsBasicCertificateProperties() (BasicCertificateProperties, bool) { + return &ccp, true +} + +// CustomContainer custom container payload +type CustomContainer struct { + // Server - The name of the registry that contains the container image + Server *string `json:"server,omitempty"` + // ContainerImage - Container image of the custom container. This should be in the form of : without the server name of the registry + ContainerImage *string `json:"containerImage,omitempty"` + // Command - Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. + Command *[]string `json:"command,omitempty"` + // Args - Arguments to the entrypoint. The docker image's CMD is used if this is not provided. + Args *[]string `json:"args,omitempty"` + // ImageRegistryCredential - Credential of the image registry + ImageRegistryCredential *ImageRegistryCredential `json:"imageRegistryCredential,omitempty"` + // LanguageFramework - Language framework of the container image uploaded + LanguageFramework *string `json:"languageFramework,omitempty"` +} + +// CustomContainerUserSourceInfo custom container user source info +type CustomContainerUserSourceInfo struct { + CustomContainer *CustomContainer `json:"customContainer,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeBasicUserSourceInfoTypeUserSourceInfo', 'TypeBasicUserSourceInfoTypeUploadedUserSourceInfo', 'TypeBasicUserSourceInfoTypeJar', 'TypeBasicUserSourceInfoTypeSource', 'TypeBasicUserSourceInfoTypeNetCoreZip', 'TypeBasicUserSourceInfoTypeBuildResult', 'TypeBasicUserSourceInfoTypeContainer' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) MarshalJSON() ([]byte, error) { + ccusi.Type = TypeBasicUserSourceInfoTypeContainer + objectMap := make(map[string]interface{}) + if ccusi.CustomContainer != nil { + objectMap["customContainer"] = ccusi.CustomContainer + } + if ccusi.Version != nil { + objectMap["version"] = ccusi.Version + } + if ccusi.Type != "" { + objectMap["type"] = ccusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { + return &ccusi, true +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &ccusi, true +} + +// CustomDomainProperties custom domain of app resource payload. +type CustomDomainProperties struct { + // Thumbprint - The thumbprint of bound certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // AppName - READ-ONLY; The app name of domain. + AppName *string `json:"appName,omitempty"` + // CertName - The bound certificate name of domain. + CertName *string `json:"certName,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the Domain. Possible values include: 'CustomDomainResourceProvisioningStateCreating', 'CustomDomainResourceProvisioningStateUpdating', 'CustomDomainResourceProvisioningStateSucceeded', 'CustomDomainResourceProvisioningStateFailed', 'CustomDomainResourceProvisioningStateDeleting' + ProvisioningState CustomDomainResourceProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomainProperties. +func (cdp CustomDomainProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cdp.Thumbprint != nil { + objectMap["thumbprint"] = cdp.Thumbprint + } + if cdp.CertName != nil { + objectMap["certName"] = cdp.CertName + } + return json.Marshal(objectMap) +} + +// CustomDomainResource custom domain resource payload. +type CustomDomainResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the custom domain resource. + Properties *CustomDomainProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomainResource. +func (cdr CustomDomainResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cdr.Properties != nil { + objectMap["properties"] = cdr.Properties + } + if cdr.SystemData != nil { + objectMap["systemData"] = cdr.SystemData + } + return json.Marshal(objectMap) +} + +// CustomDomainResourceCollection collection compose of a custom domain resources list and a possible link +// for next page. +type CustomDomainResourceCollection struct { + autorest.Response `json:"-"` + // Value - The custom domain resources list. + Value *[]CustomDomainResource `json:"value,omitempty"` + // NextLink - The link to next page of custom domain list. + NextLink *string `json:"nextLink,omitempty"` +} + +// CustomDomainResourceCollectionIterator provides access to a complete listing of CustomDomainResource +// values. +type CustomDomainResourceCollectionIterator struct { + i int + page CustomDomainResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CustomDomainResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CustomDomainResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CustomDomainResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CustomDomainResourceCollectionIterator) Response() CustomDomainResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CustomDomainResourceCollectionIterator) Value() CustomDomainResource { + if !iter.page.NotDone() { + return CustomDomainResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CustomDomainResourceCollectionIterator type. +func NewCustomDomainResourceCollectionIterator(page CustomDomainResourceCollectionPage) CustomDomainResourceCollectionIterator { + return CustomDomainResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cdrc CustomDomainResourceCollection) IsEmpty() bool { + return cdrc.Value == nil || len(*cdrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cdrc CustomDomainResourceCollection) hasNextLink() bool { + return cdrc.NextLink != nil && len(*cdrc.NextLink) != 0 +} + +// customDomainResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cdrc CustomDomainResourceCollection) customDomainResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !cdrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cdrc.NextLink))) +} + +// CustomDomainResourceCollectionPage contains a page of CustomDomainResource values. +type CustomDomainResourceCollectionPage struct { + fn func(context.Context, CustomDomainResourceCollection) (CustomDomainResourceCollection, error) + cdrc CustomDomainResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CustomDomainResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cdrc) + if err != nil { + return err + } + page.cdrc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CustomDomainResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CustomDomainResourceCollectionPage) NotDone() bool { + return !page.cdrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CustomDomainResourceCollectionPage) Response() CustomDomainResourceCollection { + return page.cdrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CustomDomainResourceCollectionPage) Values() []CustomDomainResource { + if page.cdrc.IsEmpty() { + return nil + } + return *page.cdrc.Value +} + +// Creates a new instance of the CustomDomainResourceCollectionPage type. +func NewCustomDomainResourceCollectionPage(cur CustomDomainResourceCollection, getNextPage func(context.Context, CustomDomainResourceCollection) (CustomDomainResourceCollection, error)) CustomDomainResourceCollectionPage { + return CustomDomainResourceCollectionPage{ + fn: getNextPage, + cdrc: cur, + } +} + +// CustomDomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type CustomDomainsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomDomainsClient) (CustomDomainResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomDomainsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CustomDomainsCreateOrUpdateFuture.Result. +func (future *CustomDomainsCreateOrUpdateFuture) result(client CustomDomainsClient) (cdr CustomDomainResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cdr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.CustomDomainsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cdr.Response.Response, err = future.GetResult(sender); err == nil && cdr.Response.Response.StatusCode != http.StatusNoContent { + cdr, err = client.CreateOrUpdateResponder(cdr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsCreateOrUpdateFuture", "Result", cdr.Response.Response, "Failure responding to request") + } + } + return +} + +// CustomDomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CustomDomainsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomDomainsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomDomainsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CustomDomainsDeleteFuture.Result. +func (future *CustomDomainsDeleteFuture) result(client CustomDomainsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.CustomDomainsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// CustomDomainsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CustomDomainsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomDomainsClient) (CustomDomainResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomDomainsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CustomDomainsUpdateFuture.Result. +func (future *CustomDomainsUpdateFuture) result(client CustomDomainsClient) (cdr CustomDomainResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cdr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.CustomDomainsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cdr.Response.Response, err = future.GetResult(sender); err == nil && cdr.Response.Response.StatusCode != http.StatusNoContent { + cdr, err = client.UpdateResponder(cdr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsUpdateFuture", "Result", cdr.Response.Response, "Failure responding to request") + } + } + return +} + +// CustomDomainValidatePayload custom domain validate payload. +type CustomDomainValidatePayload struct { + // Name - Name to be validated + Name *string `json:"name,omitempty"` +} + +// CustomDomainValidateResult validation result for custom domain. +type CustomDomainValidateResult struct { + autorest.Response `json:"-"` + // IsValid - Indicates if domain name is valid. + IsValid *bool `json:"isValid,omitempty"` + // Message - Message of why domain name is invalid. + Message *string `json:"message,omitempty"` +} + +// BasicCustomPersistentDiskProperties custom persistent disk resource payload. +type BasicCustomPersistentDiskProperties interface { + AsAzureFileVolume() (*AzureFileVolume, bool) + AsCustomPersistentDiskProperties() (*CustomPersistentDiskProperties, bool) +} + +// CustomPersistentDiskProperties custom persistent disk resource payload. +type CustomPersistentDiskProperties struct { + // MountPath - The mount path of the persistent disk. + MountPath *string `json:"mountPath,omitempty"` + // ReadOnly - Indicates whether the persistent disk is a readOnly one. + ReadOnly *bool `json:"readOnly,omitempty"` + // MountOptions - These are the mount options for a persistent disk. + MountOptions *[]string `json:"mountOptions,omitempty"` + // Type - Possible values include: 'TypeCustomPersistentDiskProperties', 'TypeAzureFileVolume' + Type Type `json:"type,omitempty"` +} + +func unmarshalBasicCustomPersistentDiskProperties(body []byte) (BasicCustomPersistentDiskProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeAzureFileVolume): + var afv AzureFileVolume + err := json.Unmarshal(body, &afv) + return afv, err + default: + var cpdp CustomPersistentDiskProperties + err := json.Unmarshal(body, &cpdp) + return cpdp, err + } +} +func unmarshalBasicCustomPersistentDiskPropertiesArray(body []byte) ([]BasicCustomPersistentDiskProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + cpdpArray := make([]BasicCustomPersistentDiskProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + cpdp, err := unmarshalBasicCustomPersistentDiskProperties(*rawMessage) + if err != nil { + return nil, err + } + cpdpArray[index] = cpdp + } + return cpdpArray, nil +} + +// MarshalJSON is the custom marshaler for CustomPersistentDiskProperties. +func (cpdp CustomPersistentDiskProperties) MarshalJSON() ([]byte, error) { + cpdp.Type = TypeCustomPersistentDiskProperties + objectMap := make(map[string]interface{}) + if cpdp.MountPath != nil { + objectMap["mountPath"] = cpdp.MountPath + } + if cpdp.ReadOnly != nil { + objectMap["readOnly"] = cpdp.ReadOnly + } + if cpdp.MountOptions != nil { + objectMap["mountOptions"] = cpdp.MountOptions + } + if cpdp.Type != "" { + objectMap["type"] = cpdp.Type + } + return json.Marshal(objectMap) +} + +// AsAzureFileVolume is the BasicCustomPersistentDiskProperties implementation for CustomPersistentDiskProperties. +func (cpdp CustomPersistentDiskProperties) AsAzureFileVolume() (*AzureFileVolume, bool) { + return nil, false +} + +// AsCustomPersistentDiskProperties is the BasicCustomPersistentDiskProperties implementation for CustomPersistentDiskProperties. +func (cpdp CustomPersistentDiskProperties) AsCustomPersistentDiskProperties() (*CustomPersistentDiskProperties, bool) { + return &cpdp, true +} + +// AsBasicCustomPersistentDiskProperties is the BasicCustomPersistentDiskProperties implementation for CustomPersistentDiskProperties. +func (cpdp CustomPersistentDiskProperties) AsBasicCustomPersistentDiskProperties() (BasicCustomPersistentDiskProperties, bool) { + return &cpdp, true +} + +// CustomPersistentDiskResource custom persistent disk resource payload. +type CustomPersistentDiskResource struct { + // CustomPersistentDiskProperties - Properties of the custom persistent disk resource payload. + CustomPersistentDiskProperties BasicCustomPersistentDiskProperties `json:"customPersistentDiskProperties,omitempty"` + // StorageID - The resource id of Azure Spring Apps Storage resource. + StorageID *string `json:"storageId,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for CustomPersistentDiskResource struct. +func (cpdr *CustomPersistentDiskResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "customPersistentDiskProperties": + if v != nil { + customPersistentDiskProperties, err := unmarshalBasicCustomPersistentDiskProperties(*v) + if err != nil { + return err + } + cpdr.CustomPersistentDiskProperties = customPersistentDiskProperties + } + case "storageId": + if v != nil { + var storageID string + err = json.Unmarshal(*v, &storageID) + if err != nil { + return err + } + cpdr.StorageID = &storageID + } + } + } + + return nil +} + +// DeploymentInstance deployment instance payload +type DeploymentInstance struct { + // Name - READ-ONLY; Name of the deployment instance + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Status of the deployment instance + Status *string `json:"status,omitempty"` + // Reason - READ-ONLY; Failed reason of the deployment instance + Reason *string `json:"reason,omitempty"` + // DiscoveryStatus - READ-ONLY; Discovery status of the deployment instance + DiscoveryStatus *string `json:"discoveryStatus,omitempty"` + // StartTime - READ-ONLY; Start time of the deployment instance + StartTime *string `json:"startTime,omitempty"` + // Zone - READ-ONLY; Availability zone information of the deployment instance + Zone *string `json:"zone,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentInstance. +func (di DeploymentInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DeploymentResource deployment resource payload +type DeploymentResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Deployment resource + Properties *DeploymentResourceProperties `json:"properties,omitempty"` + // Sku - Sku of the Deployment resource + Sku *Sku `json:"sku,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentResource. +func (dr DeploymentResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dr.Properties != nil { + objectMap["properties"] = dr.Properties + } + if dr.Sku != nil { + objectMap["sku"] = dr.Sku + } + if dr.SystemData != nil { + objectMap["systemData"] = dr.SystemData + } + return json.Marshal(objectMap) +} + +// DeploymentResourceCollection object that includes an array of App resources and a possible link for next +// set +type DeploymentResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Deployment resources + Value *[]DeploymentResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// DeploymentResourceCollectionIterator provides access to a complete listing of DeploymentResource values. +type DeploymentResourceCollectionIterator struct { + i int + page DeploymentResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeploymentResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DeploymentResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeploymentResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeploymentResourceCollectionIterator) Response() DeploymentResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeploymentResourceCollectionIterator) Value() DeploymentResource { + if !iter.page.NotDone() { + return DeploymentResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DeploymentResourceCollectionIterator type. +func NewDeploymentResourceCollectionIterator(page DeploymentResourceCollectionPage) DeploymentResourceCollectionIterator { + return DeploymentResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (drc DeploymentResourceCollection) IsEmpty() bool { + return drc.Value == nil || len(*drc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (drc DeploymentResourceCollection) hasNextLink() bool { + return drc.NextLink != nil && len(*drc.NextLink) != 0 +} + +// deploymentResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (drc DeploymentResourceCollection) deploymentResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !drc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(drc.NextLink))) +} + +// DeploymentResourceCollectionPage contains a page of DeploymentResource values. +type DeploymentResourceCollectionPage struct { + fn func(context.Context, DeploymentResourceCollection) (DeploymentResourceCollection, error) + drc DeploymentResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeploymentResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.drc) + if err != nil { + return err + } + page.drc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DeploymentResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeploymentResourceCollectionPage) NotDone() bool { + return !page.drc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeploymentResourceCollectionPage) Response() DeploymentResourceCollection { + return page.drc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeploymentResourceCollectionPage) Values() []DeploymentResource { + if page.drc.IsEmpty() { + return nil + } + return *page.drc.Value +} + +// Creates a new instance of the DeploymentResourceCollectionPage type. +func NewDeploymentResourceCollectionPage(cur DeploymentResourceCollection, getNextPage func(context.Context, DeploymentResourceCollection) (DeploymentResourceCollection, error)) DeploymentResourceCollectionPage { + return DeploymentResourceCollectionPage{ + fn: getNextPage, + drc: cur, + } +} + +// DeploymentResourceProperties deployment resource properties payload +type DeploymentResourceProperties struct { + // Source - Uploaded source information of the deployment. + Source BasicUserSourceInfo `json:"source,omitempty"` + // DeploymentSettings - Deployment settings of the Deployment + DeploymentSettings *DeploymentSettings `json:"deploymentSettings,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the Deployment. Possible values include: 'DeploymentResourceProvisioningStateCreating', 'DeploymentResourceProvisioningStateUpdating', 'DeploymentResourceProvisioningStateSucceeded', 'DeploymentResourceProvisioningStateFailed' + ProvisioningState DeploymentResourceProvisioningState `json:"provisioningState,omitempty"` + // Status - READ-ONLY; Status of the Deployment. Possible values include: 'DeploymentResourceStatusStopped', 'DeploymentResourceStatusRunning' + Status DeploymentResourceStatus `json:"status,omitempty"` + // Active - Indicates whether the Deployment is active + Active *bool `json:"active,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to the Deployment + Instances *[]DeploymentInstance `json:"instances,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentResourceProperties. +func (drp DeploymentResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["source"] = drp.Source + if drp.DeploymentSettings != nil { + objectMap["deploymentSettings"] = drp.DeploymentSettings + } + if drp.Active != nil { + objectMap["active"] = drp.Active + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DeploymentResourceProperties struct. +func (drp *DeploymentResourceProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "source": + if v != nil { + source, err := unmarshalBasicUserSourceInfo(*v) + if err != nil { + return err + } + drp.Source = source + } + case "deploymentSettings": + if v != nil { + var deploymentSettings DeploymentSettings + err = json.Unmarshal(*v, &deploymentSettings) + if err != nil { + return err + } + drp.DeploymentSettings = &deploymentSettings + } + case "provisioningState": + if v != nil { + var provisioningState DeploymentResourceProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + drp.ProvisioningState = provisioningState + } + case "status": + if v != nil { + var status DeploymentResourceStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + drp.Status = status + } + case "active": + if v != nil { + var active bool + err = json.Unmarshal(*v, &active) + if err != nil { + return err + } + drp.Active = &active + } + case "instances": + if v != nil { + var instances []DeploymentInstance + err = json.Unmarshal(*v, &instances) + if err != nil { + return err + } + drp.Instances = &instances + } + } + } + + return nil +} + +// DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsCreateOrUpdateFuture.Result. +func (future *DeploymentsCreateOrUpdateFuture) result(client DeploymentsClient) (dr DeploymentResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dr.Response.Response, err = future.GetResult(sender); err == nil && dr.Response.Response.StatusCode != http.StatusNoContent { + dr, err = client.CreateOrUpdateResponder(dr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsCreateOrUpdateFuture", "Result", dr.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsDeleteFuture.Result. +func (future *DeploymentsDeleteFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentSettings deployment settings payload +type DeploymentSettings struct { + // ResourceRequests - The requested resource quantity for required CPU and Memory. It is recommended that using this field to represent the required CPU and Memory, the old field cpu and memoryInGB will be deprecated later. + ResourceRequests *ResourceRequests `json:"resourceRequests,omitempty"` + // EnvironmentVariables - Collection of environment variables + EnvironmentVariables map[string]*string `json:"environmentVariables"` + // AddonConfigs - Collection of addons + AddonConfigs map[string]map[string]interface{} `json:"addonConfigs"` + // LivenessProbe - Periodic probe of App Instance liveness. App Instance will be restarted if the probe fails. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + LivenessProbe *Probe `json:"livenessProbe,omitempty"` + // ReadinessProbe - Periodic probe of App Instance service readiness. App Instance will be removed from service endpoints if the probe fails. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + ReadinessProbe *Probe `json:"readinessProbe,omitempty"` + // StartupProbe - StartupProbe indicates that the App Instance has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a App Instance's lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + StartupProbe *Probe `json:"startupProbe,omitempty"` + // TerminationGracePeriodSeconds - Optional duration in seconds the App Instance needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the App Instance are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 90 seconds. + TerminationGracePeriodSeconds *int32 `json:"terminationGracePeriodSeconds,omitempty"` + ContainerProbeSettings *ContainerProbeSettings `json:"containerProbeSettings,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentSettings. +func (ds DeploymentSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ds.ResourceRequests != nil { + objectMap["resourceRequests"] = ds.ResourceRequests + } + if ds.EnvironmentVariables != nil { + objectMap["environmentVariables"] = ds.EnvironmentVariables + } + if ds.AddonConfigs != nil { + objectMap["addonConfigs"] = ds.AddonConfigs + } + if ds.LivenessProbe != nil { + objectMap["livenessProbe"] = ds.LivenessProbe + } + if ds.ReadinessProbe != nil { + objectMap["readinessProbe"] = ds.ReadinessProbe + } + if ds.StartupProbe != nil { + objectMap["startupProbe"] = ds.StartupProbe + } + if ds.TerminationGracePeriodSeconds != nil { + objectMap["terminationGracePeriodSeconds"] = ds.TerminationGracePeriodSeconds + } + if ds.ContainerProbeSettings != nil { + objectMap["containerProbeSettings"] = ds.ContainerProbeSettings + } + return json.Marshal(objectMap) +} + +// DeploymentsGenerateHeapDumpFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsGenerateHeapDumpFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsGenerateHeapDumpFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsGenerateHeapDumpFuture.Result. +func (future *DeploymentsGenerateHeapDumpFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsGenerateHeapDumpFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsGenerateHeapDumpFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsGenerateThreadDumpFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsGenerateThreadDumpFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsGenerateThreadDumpFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsGenerateThreadDumpFuture.Result. +func (future *DeploymentsGenerateThreadDumpFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsGenerateThreadDumpFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsGenerateThreadDumpFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsRestartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsRestartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsRestartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsRestartFuture.Result. +func (future *DeploymentsRestartFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsRestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsRestartFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsStartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsStartFuture.Result. +func (future *DeploymentsStartFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsStartFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsStartJFRFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsStartJFRFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsStartJFRFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsStartJFRFuture.Result. +func (future *DeploymentsStartJFRFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsStartJFRFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsStartJFRFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsStopFuture.Result. +func (future *DeploymentsStopFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsStopFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeploymentsUpdateFuture.Result. +func (future *DeploymentsUpdateFuture) result(client DeploymentsClient) (dr DeploymentResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dr.Response.Response, err = future.GetResult(sender); err == nil && dr.Response.Response.StatusCode != http.StatusNoContent { + dr, err = client.UpdateResponder(dr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsUpdateFuture", "Result", dr.Response.Response, "Failure responding to request") + } + } + return +} + +// DiagnosticParameters diagnostic parameters of diagnostic operations +type DiagnosticParameters struct { + // AppInstance - App instance name + AppInstance *string `json:"appInstance,omitempty"` + // FilePath - Your target file path in your own BYOS + FilePath *string `json:"filePath,omitempty"` + // Duration - Duration of your JFR. 1 min can be represented by 1m or 60s. + Duration *string `json:"duration,omitempty"` +} + +// Error the error code compose of code and message. +type Error struct { + // Code - The code of error. + Code *string `json:"code,omitempty"` + // Message - The message of error. + Message *string `json:"message,omitempty"` +} + +// ExecAction execAction describes a "run in container" action. +type ExecAction struct { + // Command - Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy. + Command *[]string `json:"command,omitempty"` + // Type - Possible values include: 'TypeBasicProbeActionTypeProbeAction', 'TypeBasicProbeActionTypeHTTPGetAction', 'TypeBasicProbeActionTypeExecAction', 'TypeBasicProbeActionTypeTCPSocketAction' + Type TypeBasicProbeAction `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExecAction. +func (ea ExecAction) MarshalJSON() ([]byte, error) { + ea.Type = TypeBasicProbeActionTypeExecAction + objectMap := make(map[string]interface{}) + if ea.Command != nil { + objectMap["command"] = ea.Command + } + if ea.Type != "" { + objectMap["type"] = ea.Type + } + return json.Marshal(objectMap) +} + +// AsHTTPGetAction is the BasicProbeAction implementation for ExecAction. +func (ea ExecAction) AsHTTPGetAction() (*HTTPGetAction, bool) { + return nil, false +} + +// AsExecAction is the BasicProbeAction implementation for ExecAction. +func (ea ExecAction) AsExecAction() (*ExecAction, bool) { + return &ea, true +} + +// AsTCPSocketAction is the BasicProbeAction implementation for ExecAction. +func (ea ExecAction) AsTCPSocketAction() (*TCPSocketAction, bool) { + return nil, false +} + +// AsProbeAction is the BasicProbeAction implementation for ExecAction. +func (ea ExecAction) AsProbeAction() (*ProbeAction, bool) { + return nil, false +} + +// AsBasicProbeAction is the BasicProbeAction implementation for ExecAction. +func (ea ExecAction) AsBasicProbeAction() (BasicProbeAction, bool) { + return &ea, true +} + +// GatewayAPIMetadataProperties API metadata property for Spring Cloud Gateway +type GatewayAPIMetadataProperties struct { + // Title - Title describing the context of the APIs available on the Gateway instance (default: `Spring Cloud Gateway for K8S`) + Title *string `json:"title,omitempty"` + // Description - Detailed description of the APIs available on the Gateway instance (default: `Generated OpenAPI 3 document that describes the API routes configured.`) + Description *string `json:"description,omitempty"` + // Documentation - Location of additional documentation for the APIs available on the Gateway instance + Documentation *string `json:"documentation,omitempty"` + // Version - Version of APIs available on this Gateway instance (default: `unspecified`). + Version *string `json:"version,omitempty"` + // ServerURL - Base URL that API consumers will use to access APIs on the Gateway instance. + ServerURL *string `json:"serverUrl,omitempty"` +} + +// GatewayAPIRoute API route config of the Spring Cloud Gateway +type GatewayAPIRoute struct { + // Title - A title, will be applied to methods in the generated OpenAPI documentation. + Title *string `json:"title,omitempty"` + // Description - A description, will be applied to methods in the generated OpenAPI documentation. + Description *string `json:"description,omitempty"` + // URI - Full uri, will override `appName`. + URI *string `json:"uri,omitempty"` + // SsoEnabled - Enable sso validation. + SsoEnabled *bool `json:"ssoEnabled,omitempty"` + // TokenRelay - Pass currently-authenticated user's identity token to application service, default is 'false' + TokenRelay *bool `json:"tokenRelay,omitempty"` + // Predicates - A number of conditions to evaluate a route for each request. Each predicate may be evaluated against request headers and parameter values. All of the predicates associated with a route must evaluate to true for the route to be matched to the request. + Predicates *[]string `json:"predicates,omitempty"` + // Filters - To modify the request before sending it to the target endpoint, or the received response. + Filters *[]string `json:"filters,omitempty"` + // Order - Route processing order. + Order *int32 `json:"order,omitempty"` + // Tags - Classification tags, will be applied to methods in the generated OpenAPI documentation. + Tags *[]string `json:"tags,omitempty"` +} + +// GatewayCorsProperties cross-Origin Resource Sharing property +type GatewayCorsProperties struct { + // AllowedOrigins - Allowed origins to make cross-site requests. The special value `*` allows all domains. + AllowedOrigins *[]string `json:"allowedOrigins,omitempty"` + // AllowedMethods - Allowed HTTP methods on cross-site requests. The special value `*` allows all methods. If not set, `GET` and `HEAD` are allowed by default. + AllowedMethods *[]string `json:"allowedMethods,omitempty"` + // AllowedHeaders - Allowed headers in cross-site requests. The special value `*` allows actual requests to send any header. + AllowedHeaders *[]string `json:"allowedHeaders,omitempty"` + // MaxAge - How long, in seconds, the response from a pre-flight request can be cached by clients. + MaxAge *int32 `json:"maxAge,omitempty"` + // AllowCredentials - Whether user credentials are supported on cross-site requests. Valid values: `true`, `false`. + AllowCredentials *bool `json:"allowCredentials,omitempty"` + // ExposedHeaders - HTTP response headers to expose for cross-site requests. + ExposedHeaders *[]string `json:"exposedHeaders,omitempty"` +} + +// GatewayCustomDomainProperties the properties of custom domain for Spring Cloud Gateway +type GatewayCustomDomainProperties struct { + // Thumbprint - The thumbprint of bound certificate. + Thumbprint *string `json:"thumbprint,omitempty"` +} + +// GatewayCustomDomainResource custom domain of the Spring Cloud Gateway +type GatewayCustomDomainResource struct { + autorest.Response `json:"-"` + Properties *GatewayCustomDomainProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayCustomDomainResource. +func (gcdr GatewayCustomDomainResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gcdr.Properties != nil { + objectMap["properties"] = gcdr.Properties + } + if gcdr.SystemData != nil { + objectMap["systemData"] = gcdr.SystemData + } + return json.Marshal(objectMap) +} + +// GatewayCustomDomainResourceCollection object that includes an array of Spring Cloud Gateway custom +// domain resources and a possible link for next set +type GatewayCustomDomainResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Spring Cloud Gateway custom domain resources + Value *[]GatewayCustomDomainResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// GatewayCustomDomainResourceCollectionIterator provides access to a complete listing of +// GatewayCustomDomainResource values. +type GatewayCustomDomainResourceCollectionIterator struct { + i int + page GatewayCustomDomainResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *GatewayCustomDomainResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCustomDomainResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *GatewayCustomDomainResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter GatewayCustomDomainResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter GatewayCustomDomainResourceCollectionIterator) Response() GatewayCustomDomainResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter GatewayCustomDomainResourceCollectionIterator) Value() GatewayCustomDomainResource { + if !iter.page.NotDone() { + return GatewayCustomDomainResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the GatewayCustomDomainResourceCollectionIterator type. +func NewGatewayCustomDomainResourceCollectionIterator(page GatewayCustomDomainResourceCollectionPage) GatewayCustomDomainResourceCollectionIterator { + return GatewayCustomDomainResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (gcdrc GatewayCustomDomainResourceCollection) IsEmpty() bool { + return gcdrc.Value == nil || len(*gcdrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (gcdrc GatewayCustomDomainResourceCollection) hasNextLink() bool { + return gcdrc.NextLink != nil && len(*gcdrc.NextLink) != 0 +} + +// gatewayCustomDomainResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (gcdrc GatewayCustomDomainResourceCollection) gatewayCustomDomainResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !gcdrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(gcdrc.NextLink))) +} + +// GatewayCustomDomainResourceCollectionPage contains a page of GatewayCustomDomainResource values. +type GatewayCustomDomainResourceCollectionPage struct { + fn func(context.Context, GatewayCustomDomainResourceCollection) (GatewayCustomDomainResourceCollection, error) + gcdrc GatewayCustomDomainResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *GatewayCustomDomainResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCustomDomainResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.gcdrc) + if err != nil { + return err + } + page.gcdrc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *GatewayCustomDomainResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page GatewayCustomDomainResourceCollectionPage) NotDone() bool { + return !page.gcdrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page GatewayCustomDomainResourceCollectionPage) Response() GatewayCustomDomainResourceCollection { + return page.gcdrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page GatewayCustomDomainResourceCollectionPage) Values() []GatewayCustomDomainResource { + if page.gcdrc.IsEmpty() { + return nil + } + return *page.gcdrc.Value +} + +// Creates a new instance of the GatewayCustomDomainResourceCollectionPage type. +func NewGatewayCustomDomainResourceCollectionPage(cur GatewayCustomDomainResourceCollection, getNextPage func(context.Context, GatewayCustomDomainResourceCollection) (GatewayCustomDomainResourceCollection, error)) GatewayCustomDomainResourceCollectionPage { + return GatewayCustomDomainResourceCollectionPage{ + fn: getNextPage, + gcdrc: cur, + } +} + +// GatewayCustomDomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GatewayCustomDomainsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(GatewayCustomDomainsClient) (GatewayCustomDomainResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GatewayCustomDomainsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for GatewayCustomDomainsCreateOrUpdateFuture.Result. +func (future *GatewayCustomDomainsCreateOrUpdateFuture) result(client GatewayCustomDomainsClient) (gcdr GatewayCustomDomainResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + gcdr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.GatewayCustomDomainsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gcdr.Response.Response, err = future.GetResult(sender); err == nil && gcdr.Response.Response.StatusCode != http.StatusNoContent { + gcdr, err = client.CreateOrUpdateResponder(gcdr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsCreateOrUpdateFuture", "Result", gcdr.Response.Response, "Failure responding to request") + } + } + return +} + +// GatewayCustomDomainsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GatewayCustomDomainsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(GatewayCustomDomainsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GatewayCustomDomainsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for GatewayCustomDomainsDeleteFuture.Result. +func (future *GatewayCustomDomainsDeleteFuture) result(client GatewayCustomDomainsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.GatewayCustomDomainsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// GatewayInstance collection of instances belong to the Spring Cloud Gateway +type GatewayInstance struct { + // Name - READ-ONLY; Name of the Spring Cloud Gateway instance + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Status of the Spring Cloud Gateway instance + Status *string `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayInstance. +func (gi GatewayInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// GatewayOperatorProperties properties of the Spring Cloud Gateway Operator. +type GatewayOperatorProperties struct { + // ResourceRequests - The requested resource quantity for required CPU and Memory. + ResourceRequests *GatewayOperatorResourceRequests `json:"resourceRequests,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to Spring Cloud Gateway operator. + Instances *[]GatewayInstance `json:"instances,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayOperatorProperties. +func (gop GatewayOperatorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gop.ResourceRequests != nil { + objectMap["resourceRequests"] = gop.ResourceRequests + } + return json.Marshal(objectMap) +} + +// GatewayOperatorResourceRequests properties of the Spring Cloud Gateway Operator. +type GatewayOperatorResourceRequests struct { + // CPU - READ-ONLY; Cpu allocated to each Spring Cloud Gateway Operator instance. + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; Memory allocated to each Spring Cloud Gateway Operator instance. + Memory *string `json:"memory,omitempty"` + // InstanceCount - READ-ONLY; Instance count of the Spring Cloud Gateway Operator. + InstanceCount *int32 `json:"instanceCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayOperatorResourceRequests. +func (gorr GatewayOperatorResourceRequests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// GatewayProperties spring Cloud Gateway properties payload +type GatewayProperties struct { + // ProvisioningState - READ-ONLY; State of the Spring Cloud Gateway. Possible values include: 'GatewayProvisioningStateCreating', 'GatewayProvisioningStateUpdating', 'GatewayProvisioningStateSucceeded', 'GatewayProvisioningStateFailed', 'GatewayProvisioningStateDeleting' + ProvisioningState GatewayProvisioningState `json:"provisioningState,omitempty"` + // Public - Indicates whether the Spring Cloud Gateway exposes endpoint. + Public *bool `json:"public,omitempty"` + // URL - READ-ONLY; URL of the Spring Cloud Gateway, exposed when 'public' is true. + URL *string `json:"url,omitempty"` + // HTTPSOnly - Indicate if only https is allowed. + HTTPSOnly *bool `json:"httpsOnly,omitempty"` + SsoProperties *SsoProperties `json:"ssoProperties,omitempty"` + APIMetadataProperties *GatewayAPIMetadataProperties `json:"apiMetadataProperties,omitempty"` + CorsProperties *GatewayCorsProperties `json:"corsProperties,omitempty"` + // ResourceRequests - The requested resource quantity for required CPU and Memory. + ResourceRequests *GatewayResourceRequests `json:"resourceRequests,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to Spring Cloud Gateway. + Instances *[]GatewayInstance `json:"instances,omitempty"` + // OperatorProperties - READ-ONLY + OperatorProperties *GatewayOperatorProperties `json:"operatorProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayProperties. +func (gp GatewayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gp.Public != nil { + objectMap["public"] = gp.Public + } + if gp.HTTPSOnly != nil { + objectMap["httpsOnly"] = gp.HTTPSOnly + } + if gp.SsoProperties != nil { + objectMap["ssoProperties"] = gp.SsoProperties + } + if gp.APIMetadataProperties != nil { + objectMap["apiMetadataProperties"] = gp.APIMetadataProperties + } + if gp.CorsProperties != nil { + objectMap["corsProperties"] = gp.CorsProperties + } + if gp.ResourceRequests != nil { + objectMap["resourceRequests"] = gp.ResourceRequests + } + return json.Marshal(objectMap) +} + +// GatewayResource spring Cloud Gateway resource +type GatewayResource struct { + autorest.Response `json:"-"` + Properties *GatewayProperties `json:"properties,omitempty"` + // Sku - Sku of the Spring Cloud Gateway resource + Sku *Sku `json:"sku,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayResource. +func (gr GatewayResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gr.Properties != nil { + objectMap["properties"] = gr.Properties + } + if gr.Sku != nil { + objectMap["sku"] = gr.Sku + } + if gr.SystemData != nil { + objectMap["systemData"] = gr.SystemData + } + return json.Marshal(objectMap) +} + +// GatewayResourceCollection object that includes an array of gateway resources and a possible link for +// next set +type GatewayResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of gateway resources + Value *[]GatewayResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// GatewayResourceCollectionIterator provides access to a complete listing of GatewayResource values. +type GatewayResourceCollectionIterator struct { + i int + page GatewayResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *GatewayResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *GatewayResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter GatewayResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter GatewayResourceCollectionIterator) Response() GatewayResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter GatewayResourceCollectionIterator) Value() GatewayResource { + if !iter.page.NotDone() { + return GatewayResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the GatewayResourceCollectionIterator type. +func NewGatewayResourceCollectionIterator(page GatewayResourceCollectionPage) GatewayResourceCollectionIterator { + return GatewayResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (grc GatewayResourceCollection) IsEmpty() bool { + return grc.Value == nil || len(*grc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (grc GatewayResourceCollection) hasNextLink() bool { + return grc.NextLink != nil && len(*grc.NextLink) != 0 +} + +// gatewayResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (grc GatewayResourceCollection) gatewayResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !grc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(grc.NextLink))) +} + +// GatewayResourceCollectionPage contains a page of GatewayResource values. +type GatewayResourceCollectionPage struct { + fn func(context.Context, GatewayResourceCollection) (GatewayResourceCollection, error) + grc GatewayResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *GatewayResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.grc) + if err != nil { + return err + } + page.grc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *GatewayResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page GatewayResourceCollectionPage) NotDone() bool { + return !page.grc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page GatewayResourceCollectionPage) Response() GatewayResourceCollection { + return page.grc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page GatewayResourceCollectionPage) Values() []GatewayResource { + if page.grc.IsEmpty() { + return nil + } + return *page.grc.Value +} + +// Creates a new instance of the GatewayResourceCollectionPage type. +func NewGatewayResourceCollectionPage(cur GatewayResourceCollection, getNextPage func(context.Context, GatewayResourceCollection) (GatewayResourceCollection, error)) GatewayResourceCollectionPage { + return GatewayResourceCollectionPage{ + fn: getNextPage, + grc: cur, + } +} + +// GatewayResourceRequests resource request payload of Spring Cloud Gateway. +type GatewayResourceRequests struct { + // CPU - Cpu allocated to each Spring Cloud Gateway instance. + CPU *string `json:"cpu,omitempty"` + // Memory - Memory allocated to each Spring Cloud Gateway instance. + Memory *string `json:"memory,omitempty"` +} + +// GatewayRouteConfigOpenAPIProperties openAPI properties of Spring Cloud Gateway route config. +type GatewayRouteConfigOpenAPIProperties struct { + // URI - The URI of OpenAPI specification. + URI *string `json:"uri,omitempty"` +} + +// GatewayRouteConfigProperties API route config of the Spring Cloud Gateway +type GatewayRouteConfigProperties struct { + // ProvisioningState - READ-ONLY; State of the Spring Cloud Gateway route config. Possible values include: 'GatewayProvisioningStateCreating', 'GatewayProvisioningStateUpdating', 'GatewayProvisioningStateSucceeded', 'GatewayProvisioningStateFailed', 'GatewayProvisioningStateDeleting' + ProvisioningState GatewayProvisioningState `json:"provisioningState,omitempty"` + // AppResourceID - The resource Id of the Azure Spring Apps app, required unless route defines `uri`. + AppResourceID *string `json:"appResourceId,omitempty"` + OpenAPI *GatewayRouteConfigOpenAPIProperties `json:"openApi,omitempty"` + // Routes - Array of API routes, each route contains properties such as `title`, `uri`, `ssoEnabled`, `predicates`, `filters`. + Routes *[]GatewayAPIRoute `json:"routes,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayRouteConfigProperties. +func (grcp GatewayRouteConfigProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if grcp.AppResourceID != nil { + objectMap["appResourceId"] = grcp.AppResourceID + } + if grcp.OpenAPI != nil { + objectMap["openApi"] = grcp.OpenAPI + } + if grcp.Routes != nil { + objectMap["routes"] = grcp.Routes + } + return json.Marshal(objectMap) +} + +// GatewayRouteConfigResource spring Cloud Gateway route config resource +type GatewayRouteConfigResource struct { + autorest.Response `json:"-"` + Properties *GatewayRouteConfigProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayRouteConfigResource. +func (grcr GatewayRouteConfigResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if grcr.Properties != nil { + objectMap["properties"] = grcr.Properties + } + if grcr.SystemData != nil { + objectMap["systemData"] = grcr.SystemData + } + return json.Marshal(objectMap) +} + +// GatewayRouteConfigResourceCollection object that includes an array of Spring Cloud Gateway route config +// resources and a possible link for next set +type GatewayRouteConfigResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Spring Cloud Gateway route config resources + Value *[]GatewayRouteConfigResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// GatewayRouteConfigResourceCollectionIterator provides access to a complete listing of +// GatewayRouteConfigResource values. +type GatewayRouteConfigResourceCollectionIterator struct { + i int + page GatewayRouteConfigResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *GatewayRouteConfigResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayRouteConfigResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *GatewayRouteConfigResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter GatewayRouteConfigResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter GatewayRouteConfigResourceCollectionIterator) Response() GatewayRouteConfigResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter GatewayRouteConfigResourceCollectionIterator) Value() GatewayRouteConfigResource { + if !iter.page.NotDone() { + return GatewayRouteConfigResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the GatewayRouteConfigResourceCollectionIterator type. +func NewGatewayRouteConfigResourceCollectionIterator(page GatewayRouteConfigResourceCollectionPage) GatewayRouteConfigResourceCollectionIterator { + return GatewayRouteConfigResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (grcrc GatewayRouteConfigResourceCollection) IsEmpty() bool { + return grcrc.Value == nil || len(*grcrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (grcrc GatewayRouteConfigResourceCollection) hasNextLink() bool { + return grcrc.NextLink != nil && len(*grcrc.NextLink) != 0 +} + +// gatewayRouteConfigResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (grcrc GatewayRouteConfigResourceCollection) gatewayRouteConfigResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !grcrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(grcrc.NextLink))) +} + +// GatewayRouteConfigResourceCollectionPage contains a page of GatewayRouteConfigResource values. +type GatewayRouteConfigResourceCollectionPage struct { + fn func(context.Context, GatewayRouteConfigResourceCollection) (GatewayRouteConfigResourceCollection, error) + grcrc GatewayRouteConfigResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *GatewayRouteConfigResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayRouteConfigResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.grcrc) + if err != nil { + return err + } + page.grcrc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *GatewayRouteConfigResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page GatewayRouteConfigResourceCollectionPage) NotDone() bool { + return !page.grcrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page GatewayRouteConfigResourceCollectionPage) Response() GatewayRouteConfigResourceCollection { + return page.grcrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page GatewayRouteConfigResourceCollectionPage) Values() []GatewayRouteConfigResource { + if page.grcrc.IsEmpty() { + return nil + } + return *page.grcrc.Value +} + +// Creates a new instance of the GatewayRouteConfigResourceCollectionPage type. +func NewGatewayRouteConfigResourceCollectionPage(cur GatewayRouteConfigResourceCollection, getNextPage func(context.Context, GatewayRouteConfigResourceCollection) (GatewayRouteConfigResourceCollection, error)) GatewayRouteConfigResourceCollectionPage { + return GatewayRouteConfigResourceCollectionPage{ + fn: getNextPage, + grcrc: cur, + } +} + +// GatewayRouteConfigsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GatewayRouteConfigsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(GatewayRouteConfigsClient) (GatewayRouteConfigResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GatewayRouteConfigsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for GatewayRouteConfigsCreateOrUpdateFuture.Result. +func (future *GatewayRouteConfigsCreateOrUpdateFuture) result(client GatewayRouteConfigsClient) (grcr GatewayRouteConfigResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + grcr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.GatewayRouteConfigsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if grcr.Response.Response, err = future.GetResult(sender); err == nil && grcr.Response.Response.StatusCode != http.StatusNoContent { + grcr, err = client.CreateOrUpdateResponder(grcr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsCreateOrUpdateFuture", "Result", grcr.Response.Response, "Failure responding to request") + } + } + return +} + +// GatewayRouteConfigsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GatewayRouteConfigsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(GatewayRouteConfigsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GatewayRouteConfigsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for GatewayRouteConfigsDeleteFuture.Result. +func (future *GatewayRouteConfigsDeleteFuture) result(client GatewayRouteConfigsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.GatewayRouteConfigsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// GatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(GatewaysClient) (GatewayResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for GatewaysCreateOrUpdateFuture.Result. +func (future *GatewaysCreateOrUpdateFuture) result(client GatewaysClient) (gr GatewayResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + gr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.GatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { + gr, err = client.CreateOrUpdateResponder(gr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysCreateOrUpdateFuture", "Result", gr.Response.Response, "Failure responding to request") + } + } + return +} + +// GatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(GatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GatewaysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for GatewaysDeleteFuture.Result. +func (future *GatewaysDeleteFuture) result(client GatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.GatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// GitPatternRepository git repository property payload for config server +type GitPatternRepository struct { + // Name - Name of the repository + Name *string `json:"name,omitempty"` + // Pattern - Collection of pattern of the repository + Pattern *[]string `json:"pattern,omitempty"` + // URI - URI of the repository + URI *string `json:"uri,omitempty"` + // Label - Label of the repository + Label *string `json:"label,omitempty"` + // SearchPaths - Searching path of the repository + SearchPaths *[]string `json:"searchPaths,omitempty"` + // Username - Username of git repository basic auth. + Username *string `json:"username,omitempty"` + // Password - Password of git repository basic auth. + Password *string `json:"password,omitempty"` + // HostKey - Public sshKey of git repository. + HostKey *string `json:"hostKey,omitempty"` + // HostKeyAlgorithm - SshKey algorithm of git repository. + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + // PrivateKey - Private sshKey algorithm of git repository. + PrivateKey *string `json:"privateKey,omitempty"` + // StrictHostKeyChecking - Strict host key checking or not. + StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` +} + +// HTTPGetAction hTTPGetAction describes an action based on HTTP Get requests. +type HTTPGetAction struct { + // Path - Path to access on the HTTP server. + Path *string `json:"path,omitempty"` + // Scheme - Scheme to use for connecting to the host. Defaults to HTTP. + // Possible enum values: + // - `"HTTP"` means that the scheme used will be http:// + // - `"HTTPS"` means that the scheme used will be https://. Possible values include: 'HTTPSchemeTypeHTTP', 'HTTPSchemeTypeHTTPS' + Scheme HTTPSchemeType `json:"scheme,omitempty"` + // Type - Possible values include: 'TypeBasicProbeActionTypeProbeAction', 'TypeBasicProbeActionTypeHTTPGetAction', 'TypeBasicProbeActionTypeExecAction', 'TypeBasicProbeActionTypeTCPSocketAction' + Type TypeBasicProbeAction `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for HTTPGetAction. +func (hga HTTPGetAction) MarshalJSON() ([]byte, error) { + hga.Type = TypeBasicProbeActionTypeHTTPGetAction + objectMap := make(map[string]interface{}) + if hga.Path != nil { + objectMap["path"] = hga.Path + } + if hga.Scheme != "" { + objectMap["scheme"] = hga.Scheme + } + if hga.Type != "" { + objectMap["type"] = hga.Type + } + return json.Marshal(objectMap) +} + +// AsHTTPGetAction is the BasicProbeAction implementation for HTTPGetAction. +func (hga HTTPGetAction) AsHTTPGetAction() (*HTTPGetAction, bool) { + return &hga, true +} + +// AsExecAction is the BasicProbeAction implementation for HTTPGetAction. +func (hga HTTPGetAction) AsExecAction() (*ExecAction, bool) { + return nil, false +} + +// AsTCPSocketAction is the BasicProbeAction implementation for HTTPGetAction. +func (hga HTTPGetAction) AsTCPSocketAction() (*TCPSocketAction, bool) { + return nil, false +} + +// AsProbeAction is the BasicProbeAction implementation for HTTPGetAction. +func (hga HTTPGetAction) AsProbeAction() (*ProbeAction, bool) { + return nil, false +} + +// AsBasicProbeAction is the BasicProbeAction implementation for HTTPGetAction. +func (hga HTTPGetAction) AsBasicProbeAction() (BasicProbeAction, bool) { + return &hga, true +} + +// ImageRegistryCredential credential of the image registry +type ImageRegistryCredential struct { + // Username - The username of the image registry credential + Username *string `json:"username,omitempty"` + // Password - The password of the image registry credential + Password *string `json:"password,omitempty"` +} + +// IngressConfig ingress configuration payload for Azure Spring Apps resource. +type IngressConfig struct { + // ReadTimeoutInSeconds - Ingress read time out in seconds. + ReadTimeoutInSeconds *int32 `json:"readTimeoutInSeconds,omitempty"` +} + +// JarUploadedUserSourceInfo uploaded Jar binary for a deployment +type JarUploadedUserSourceInfo struct { + // RuntimeVersion - Runtime version of the Jar file + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + // JvmOptions - JVM parameter + JvmOptions *string `json:"jvmOptions,omitempty"` + // RelativePath - Relative path of the storage which stores the source + RelativePath *string `json:"relativePath,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeBasicUserSourceInfoTypeUserSourceInfo', 'TypeBasicUserSourceInfoTypeUploadedUserSourceInfo', 'TypeBasicUserSourceInfoTypeJar', 'TypeBasicUserSourceInfoTypeSource', 'TypeBasicUserSourceInfoTypeNetCoreZip', 'TypeBasicUserSourceInfoTypeBuildResult', 'TypeBasicUserSourceInfoTypeContainer' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + juusi.Type = TypeBasicUserSourceInfoTypeJar + objectMap := make(map[string]interface{}) + if juusi.RuntimeVersion != nil { + objectMap["runtimeVersion"] = juusi.RuntimeVersion + } + if juusi.JvmOptions != nil { + objectMap["jvmOptions"] = juusi.JvmOptions + } + if juusi.RelativePath != nil { + objectMap["relativePath"] = juusi.RelativePath + } + if juusi.Version != nil { + objectMap["version"] = juusi.Version + } + if juusi.Type != "" { + objectMap["type"] = juusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return &juusi, true +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return &juusi, true +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &juusi, true +} + +// KeyVaultCertificateProperties properties of certificate imported from key vault. +type KeyVaultCertificateProperties struct { + // VaultURI - The vault uri of user key vault. + VaultURI *string `json:"vaultUri,omitempty"` + // KeyVaultCertName - The certificate name of key vault. + KeyVaultCertName *string `json:"keyVaultCertName,omitempty"` + // CertVersion - The certificate version of key vault. + CertVersion *string `json:"certVersion,omitempty"` + // ExcludePrivateKey - Optional. If set to true, it will not import private key from key vault. + ExcludePrivateKey *bool `json:"excludePrivateKey,omitempty"` + // Thumbprint - READ-ONLY; The thumbprint of certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // Issuer - READ-ONLY; The issuer of certificate. + Issuer *string `json:"issuer,omitempty"` + // IssuedDate - READ-ONLY; The issue date of certificate. + IssuedDate *string `json:"issuedDate,omitempty"` + // ExpirationDate - READ-ONLY; The expiration date of certificate. + ExpirationDate *string `json:"expirationDate,omitempty"` + // ActivateDate - READ-ONLY; The activate date of certificate. + ActivateDate *string `json:"activateDate,omitempty"` + // SubjectName - READ-ONLY; The subject name of certificate. + SubjectName *string `json:"subjectName,omitempty"` + // DNSNames - READ-ONLY; The domain list of certificate. + DNSNames *[]string `json:"dnsNames,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the Certificate. Possible values include: 'CertificateResourceProvisioningStateCreating', 'CertificateResourceProvisioningStateUpdating', 'CertificateResourceProvisioningStateSucceeded', 'CertificateResourceProvisioningStateFailed', 'CertificateResourceProvisioningStateDeleting' + ProvisioningState CertificateResourceProvisioningState `json:"provisioningState,omitempty"` + // Type - Possible values include: 'TypeBasicCertificatePropertiesTypeCertificateProperties', 'TypeBasicCertificatePropertiesTypeKeyVaultCertificate', 'TypeBasicCertificatePropertiesTypeContentCertificate' + Type TypeBasicCertificateProperties `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for KeyVaultCertificateProperties. +func (kvcp KeyVaultCertificateProperties) MarshalJSON() ([]byte, error) { + kvcp.Type = TypeBasicCertificatePropertiesTypeKeyVaultCertificate + objectMap := make(map[string]interface{}) + if kvcp.VaultURI != nil { + objectMap["vaultUri"] = kvcp.VaultURI + } + if kvcp.KeyVaultCertName != nil { + objectMap["keyVaultCertName"] = kvcp.KeyVaultCertName + } + if kvcp.CertVersion != nil { + objectMap["certVersion"] = kvcp.CertVersion + } + if kvcp.ExcludePrivateKey != nil { + objectMap["excludePrivateKey"] = kvcp.ExcludePrivateKey + } + if kvcp.Type != "" { + objectMap["type"] = kvcp.Type + } + return json.Marshal(objectMap) +} + +// AsKeyVaultCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. +func (kvcp KeyVaultCertificateProperties) AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) { + return &kvcp, true +} + +// AsContentCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. +func (kvcp KeyVaultCertificateProperties) AsContentCertificateProperties() (*ContentCertificateProperties, bool) { + return nil, false +} + +// AsCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. +func (kvcp KeyVaultCertificateProperties) AsCertificateProperties() (*CertificateProperties, bool) { + return nil, false +} + +// AsBasicCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. +func (kvcp KeyVaultCertificateProperties) AsBasicCertificateProperties() (BasicCertificateProperties, bool) { + return &kvcp, true +} + +// LoadedCertificate loaded certificate payload +type LoadedCertificate struct { + // ResourceID - Resource Id of loaded certificate + ResourceID *string `json:"resourceId,omitempty"` + // LoadTrustStore - Indicate whether the certificate will be loaded into default trust store, only work for Java runtime. + LoadTrustStore *bool `json:"loadTrustStore,omitempty"` +} + +// LogFileURLResponse log file URL payload +type LogFileURLResponse struct { + autorest.Response `json:"-"` + // URL - URL of the log file + URL *string `json:"url,omitempty"` +} + +// LogSpecification specifications of the Log for Azure Monitoring +type LogSpecification struct { + // Name - Name of the log + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the log + DisplayName *string `json:"displayName,omitempty"` + // BlobDuration - Blob duration of the log + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// ManagedIdentityProperties managed identity properties retrieved from ARM request headers. +type ManagedIdentityProperties struct { + // Type - Type of the managed identity. Possible values include: 'ManagedIdentityTypeNone', 'ManagedIdentityTypeSystemAssigned', 'ManagedIdentityTypeUserAssigned', 'ManagedIdentityTypeSystemAssignedUserAssigned' + Type ManagedIdentityType `json:"type,omitempty"` + // PrincipalID - Principal Id of system-assigned managed identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - Tenant Id of system-assigned managed identity. + TenantID *string `json:"tenantId,omitempty"` + // UserAssignedIdentities - Properties of user-assigned managed identities + UserAssignedIdentities map[string]*UserAssignedManagedIdentity `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ManagedIdentityProperties. +func (mip ManagedIdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mip.Type != "" { + objectMap["type"] = mip.Type + } + if mip.PrincipalID != nil { + objectMap["principalId"] = mip.PrincipalID + } + if mip.TenantID != nil { + objectMap["tenantId"] = mip.TenantID + } + if mip.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = mip.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// MarketplaceResource purchasing 3rd Party product for one Azure Spring Apps instance +type MarketplaceResource struct { + // Plan - The plan id of the 3rd Party Artifact that is being procured. + Plan *string `json:"plan,omitempty"` + // Publisher - The publisher id of the 3rd Party Artifact that is being bought. + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. + Product *string `json:"product,omitempty"` +} + +// MetricDimension specifications of the Dimension of metrics +type MetricDimension struct { + // Name - Name of the dimension + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the dimension + DisplayName *string `json:"displayName,omitempty"` + // ToBeExportedForShoebox - Whether this dimension should be included for the Shoebox export scenario + ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` +} + +// MetricSpecification specifications of the Metrics for Azure Monitoring +type MetricSpecification struct { + // Name - Name of the metric + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the metric + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Localized friendly description of the metric + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - Unit that makes sense for the metric + Unit *string `json:"unit,omitempty"` + // Category - Name of the metric category that the metric belongs to. A metric can only belong to a single category. + Category *string `json:"category,omitempty"` + // AggregationType - Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. + AggregationType *string `json:"aggregationType,omitempty"` + // SupportedAggregationTypes - Supported aggregation types + SupportedAggregationTypes *[]string `json:"supportedAggregationTypes,omitempty"` + // SupportedTimeGrainTypes - Supported time grain types + SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` + // FillGapWithZero - Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // Dimensions - Dimensions of the metric + Dimensions *[]MetricDimension `json:"dimensions,omitempty"` + // SourceMdmNamespace - Name of the MDM namespace. Optional. + SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` +} + +// MonitoringSettingProperties monitoring Setting properties payload +type MonitoringSettingProperties struct { + // ProvisioningState - READ-ONLY; State of the Monitoring Setting. Possible values include: 'MonitoringSettingStateNotAvailable', 'MonitoringSettingStateFailed', 'MonitoringSettingStateSucceeded', 'MonitoringSettingStateUpdating' + ProvisioningState MonitoringSettingState `json:"provisioningState,omitempty"` + // Error - Error when apply Monitoring Setting changes. + Error *Error `json:"error,omitempty"` + // TraceEnabled - Indicates whether enable the trace functionality, which will be deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate if monitoringSettings enabled or not + TraceEnabled *bool `json:"traceEnabled,omitempty"` + // AppInsightsInstrumentationKey - Target application insight instrumentation key, null or whitespace include empty will disable monitoringSettings + AppInsightsInstrumentationKey *string `json:"appInsightsInstrumentationKey,omitempty"` + // AppInsightsSamplingRate - Indicates the sampling rate of application insight agent, should be in range [0.0, 100.0] + AppInsightsSamplingRate *float64 `json:"appInsightsSamplingRate,omitempty"` + // AppInsightsAgentVersions - Indicates the versions of application insight agent + AppInsightsAgentVersions *ApplicationInsightsAgentVersions `json:"appInsightsAgentVersions,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitoringSettingProperties. +func (msp MonitoringSettingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if msp.Error != nil { + objectMap["error"] = msp.Error + } + if msp.TraceEnabled != nil { + objectMap["traceEnabled"] = msp.TraceEnabled + } + if msp.AppInsightsInstrumentationKey != nil { + objectMap["appInsightsInstrumentationKey"] = msp.AppInsightsInstrumentationKey + } + if msp.AppInsightsSamplingRate != nil { + objectMap["appInsightsSamplingRate"] = msp.AppInsightsSamplingRate + } + if msp.AppInsightsAgentVersions != nil { + objectMap["appInsightsAgentVersions"] = msp.AppInsightsAgentVersions + } + return json.Marshal(objectMap) +} + +// MonitoringSettingResource monitoring Setting resource +type MonitoringSettingResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Monitoring Setting resource + Properties *MonitoringSettingProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitoringSettingResource. +func (msr MonitoringSettingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if msr.Properties != nil { + objectMap["properties"] = msr.Properties + } + if msr.SystemData != nil { + objectMap["systemData"] = msr.SystemData + } + return json.Marshal(objectMap) +} + +// MonitoringSettingsUpdatePatchFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type MonitoringSettingsUpdatePatchFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitoringSettingsClient) (MonitoringSettingResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MonitoringSettingsUpdatePatchFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for MonitoringSettingsUpdatePatchFuture.Result. +func (future *MonitoringSettingsUpdatePatchFuture) result(client MonitoringSettingsClient) (msr MonitoringSettingResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePatchFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + msr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.MonitoringSettingsUpdatePatchFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if msr.Response.Response, err = future.GetResult(sender); err == nil && msr.Response.Response.StatusCode != http.StatusNoContent { + msr, err = client.UpdatePatchResponder(msr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePatchFuture", "Result", msr.Response.Response, "Failure responding to request") + } + } + return +} + +// MonitoringSettingsUpdatePutFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type MonitoringSettingsUpdatePutFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitoringSettingsClient) (MonitoringSettingResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MonitoringSettingsUpdatePutFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for MonitoringSettingsUpdatePutFuture.Result. +func (future *MonitoringSettingsUpdatePutFuture) result(client MonitoringSettingsClient) (msr MonitoringSettingResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePutFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + msr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.MonitoringSettingsUpdatePutFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if msr.Response.Response, err = future.GetResult(sender); err == nil && msr.Response.Response.StatusCode != http.StatusNoContent { + msr, err = client.UpdatePutResponder(msr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePutFuture", "Result", msr.Response.Response, "Failure responding to request") + } + } + return +} + +// NameAvailability name availability result payload +type NameAvailability struct { + autorest.Response `json:"-"` + // NameAvailable - Indicates whether the name is available + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - Reason why the name is not available + Reason *string `json:"reason,omitempty"` + // Message - Message why the name is not available + Message *string `json:"message,omitempty"` +} + +// NameAvailabilityParameters name availability parameters payload +type NameAvailabilityParameters struct { + // Type - Type of the resource to check name availability + Type *string `json:"type,omitempty"` + // Name - Name to be checked + Name *string `json:"name,omitempty"` +} + +// NetCoreZipUploadedUserSourceInfo uploaded Jar binary for a deployment +type NetCoreZipUploadedUserSourceInfo struct { + // NetCoreMainEntryPath - The path to the .NET executable relative to zip root + NetCoreMainEntryPath *string `json:"netCoreMainEntryPath,omitempty"` + // RuntimeVersion - Runtime version of the .Net file + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + // RelativePath - Relative path of the storage which stores the source + RelativePath *string `json:"relativePath,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeBasicUserSourceInfoTypeUserSourceInfo', 'TypeBasicUserSourceInfoTypeUploadedUserSourceInfo', 'TypeBasicUserSourceInfoTypeJar', 'TypeBasicUserSourceInfoTypeSource', 'TypeBasicUserSourceInfoTypeNetCoreZip', 'TypeBasicUserSourceInfoTypeBuildResult', 'TypeBasicUserSourceInfoTypeContainer' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + nczuusi.Type = TypeBasicUserSourceInfoTypeNetCoreZip + objectMap := make(map[string]interface{}) + if nczuusi.NetCoreMainEntryPath != nil { + objectMap["netCoreMainEntryPath"] = nczuusi.NetCoreMainEntryPath + } + if nczuusi.RuntimeVersion != nil { + objectMap["runtimeVersion"] = nczuusi.RuntimeVersion + } + if nczuusi.RelativePath != nil { + objectMap["relativePath"] = nczuusi.RelativePath + } + if nczuusi.Version != nil { + objectMap["version"] = nczuusi.Version + } + if nczuusi.Type != "" { + objectMap["type"] = nczuusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return &nczuusi, true +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return &nczuusi, true +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &nczuusi, true +} + +// NetworkProfile service network profile payload +type NetworkProfile struct { + // ServiceRuntimeSubnetID - Fully qualified resource Id of the subnet to host Azure Spring Apps Service Runtime + ServiceRuntimeSubnetID *string `json:"serviceRuntimeSubnetId,omitempty"` + // AppSubnetID - Fully qualified resource Id of the subnet to host customer apps in Azure Spring Apps + AppSubnetID *string `json:"appSubnetId,omitempty"` + // ServiceCidr - Azure Spring Apps service reserved CIDR + ServiceCidr *string `json:"serviceCidr,omitempty"` + // ServiceRuntimeNetworkResourceGroup - Name of the resource group containing network resources of Azure Spring Apps Service Runtime + ServiceRuntimeNetworkResourceGroup *string `json:"serviceRuntimeNetworkResourceGroup,omitempty"` + // AppNetworkResourceGroup - Name of the resource group containing network resources for customer apps in Azure Spring Apps + AppNetworkResourceGroup *string `json:"appNetworkResourceGroup,omitempty"` + // OutboundIPs - READ-ONLY; Desired outbound IP resources for Azure Spring Apps resource. + OutboundIPs *NetworkProfileOutboundIPs `json:"outboundIPs,omitempty"` + // RequiredTraffics - READ-ONLY; Required inbound or outbound traffics for Azure Spring Apps resource. + RequiredTraffics *[]RequiredTraffic `json:"requiredTraffics,omitempty"` + // IngressConfig - Ingress configuration payload for Azure Spring Apps resource. + IngressConfig *IngressConfig `json:"ingressConfig,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetworkProfile. +func (np NetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if np.ServiceRuntimeSubnetID != nil { + objectMap["serviceRuntimeSubnetId"] = np.ServiceRuntimeSubnetID + } + if np.AppSubnetID != nil { + objectMap["appSubnetId"] = np.AppSubnetID + } + if np.ServiceCidr != nil { + objectMap["serviceCidr"] = np.ServiceCidr + } + if np.ServiceRuntimeNetworkResourceGroup != nil { + objectMap["serviceRuntimeNetworkResourceGroup"] = np.ServiceRuntimeNetworkResourceGroup + } + if np.AppNetworkResourceGroup != nil { + objectMap["appNetworkResourceGroup"] = np.AppNetworkResourceGroup + } + if np.IngressConfig != nil { + objectMap["ingressConfig"] = np.IngressConfig + } + return json.Marshal(objectMap) +} + +// NetworkProfileOutboundIPs desired outbound IP resources for Azure Spring Apps resource. +type NetworkProfileOutboundIPs struct { + // PublicIPs - READ-ONLY; A list of public IP addresses. + PublicIPs *[]string `json:"publicIPs,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetworkProfileOutboundIPs. +func (npP NetworkProfileOutboundIPs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationDetail operation detail payload +type OperationDetail struct { + // Name - Name of the operation + Name *string `json:"name,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - Display of the operation + Display *OperationDisplay `json:"display,omitempty"` + // ActionType - READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: 'ActionTypeInternal' + ActionType ActionType `json:"actionType,omitempty"` + // Origin - Origin of the operation + Origin *string `json:"origin,omitempty"` + // Properties - Properties of the operation + Properties *OperationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationDetail. +func (od OperationDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if od.Name != nil { + objectMap["name"] = od.Name + } + if od.IsDataAction != nil { + objectMap["isDataAction"] = od.IsDataAction + } + if od.Display != nil { + objectMap["display"] = od.Display + } + if od.Origin != nil { + objectMap["origin"] = od.Origin + } + if od.Properties != nil { + objectMap["properties"] = od.Properties + } + return json.Marshal(objectMap) +} + +// OperationDisplay operation display payload +type OperationDisplay struct { + // Provider - Resource provider of the operation + Provider *string `json:"provider,omitempty"` + // Resource - Resource of the operation + Resource *string `json:"resource,omitempty"` + // Operation - Localized friendly name for the operation + Operation *string `json:"operation,omitempty"` + // Description - Localized friendly description for the operation + Description *string `json:"description,omitempty"` +} + +// OperationProperties extra Operation properties +type OperationProperties struct { + // ServiceSpecification - Service specifications of the operation + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// PersistentDisk persistent disk payload +type PersistentDisk struct { + // SizeInGB - Size of the persistent disk in GB + SizeInGB *int32 `json:"sizeInGB,omitempty"` + // UsedInGB - READ-ONLY; Size of the used persistent disk in GB + UsedInGB *int32 `json:"usedInGB,omitempty"` + // MountPath - Mount path of the persistent disk + MountPath *string `json:"mountPath,omitempty"` +} + +// MarshalJSON is the custom marshaler for PersistentDisk. +func (pd PersistentDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pd.SizeInGB != nil { + objectMap["sizeInGB"] = pd.SizeInGB + } + if pd.MountPath != nil { + objectMap["mountPath"] = pd.MountPath + } + return json.Marshal(objectMap) +} + +// Probe probe describes a health check to be performed against an App Instance to determine whether it is +// alive or ready to receive traffic. +type Probe struct { + // ProbeAction - The action of the probe. + ProbeAction BasicProbeAction `json:"probeAction,omitempty"` + // DisableProbe - Indicate whether the probe is disabled. + DisableProbe *bool `json:"disableProbe,omitempty"` + // InitialDelaySeconds - Number of seconds after the App Instance has started before probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"` + // PeriodSeconds - How often (in seconds) to perform the probe. Minimum value is 1. + PeriodSeconds *int32 `json:"periodSeconds,omitempty"` + // TimeoutSeconds - Number of seconds after which the probe times out. Minimum value is 1. + TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` + // FailureThreshold - Minimum consecutive failures for the probe to be considered failed after having succeeded. Minimum value is 1. + FailureThreshold *int32 `json:"failureThreshold,omitempty"` + // SuccessThreshold - Minimum consecutive successes for the probe to be considered successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. + SuccessThreshold *int32 `json:"successThreshold,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for Probe struct. +func (p *Probe) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "probeAction": + if v != nil { + probeAction, err := unmarshalBasicProbeAction(*v) + if err != nil { + return err + } + p.ProbeAction = probeAction + } + case "disableProbe": + if v != nil { + var disableProbe bool + err = json.Unmarshal(*v, &disableProbe) + if err != nil { + return err + } + p.DisableProbe = &disableProbe + } + case "initialDelaySeconds": + if v != nil { + var initialDelaySeconds int32 + err = json.Unmarshal(*v, &initialDelaySeconds) + if err != nil { + return err + } + p.InitialDelaySeconds = &initialDelaySeconds + } + case "periodSeconds": + if v != nil { + var periodSeconds int32 + err = json.Unmarshal(*v, &periodSeconds) + if err != nil { + return err + } + p.PeriodSeconds = &periodSeconds + } + case "timeoutSeconds": + if v != nil { + var timeoutSeconds int32 + err = json.Unmarshal(*v, &timeoutSeconds) + if err != nil { + return err + } + p.TimeoutSeconds = &timeoutSeconds + } + case "failureThreshold": + if v != nil { + var failureThreshold int32 + err = json.Unmarshal(*v, &failureThreshold) + if err != nil { + return err + } + p.FailureThreshold = &failureThreshold + } + case "successThreshold": + if v != nil { + var successThreshold int32 + err = json.Unmarshal(*v, &successThreshold) + if err != nil { + return err + } + p.SuccessThreshold = &successThreshold + } + } + } + + return nil +} + +// BasicProbeAction the action of the probe. +type BasicProbeAction interface { + AsHTTPGetAction() (*HTTPGetAction, bool) + AsExecAction() (*ExecAction, bool) + AsTCPSocketAction() (*TCPSocketAction, bool) + AsProbeAction() (*ProbeAction, bool) +} + +// ProbeAction the action of the probe. +type ProbeAction struct { + // Type - Possible values include: 'TypeBasicProbeActionTypeProbeAction', 'TypeBasicProbeActionTypeHTTPGetAction', 'TypeBasicProbeActionTypeExecAction', 'TypeBasicProbeActionTypeTCPSocketAction' + Type TypeBasicProbeAction `json:"type,omitempty"` +} + +func unmarshalBasicProbeAction(body []byte) (BasicProbeAction, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicProbeActionTypeHTTPGetAction): + var hga HTTPGetAction + err := json.Unmarshal(body, &hga) + return hga, err + case string(TypeBasicProbeActionTypeExecAction): + var ea ExecAction + err := json.Unmarshal(body, &ea) + return ea, err + case string(TypeBasicProbeActionTypeTCPSocketAction): + var tsa TCPSocketAction + err := json.Unmarshal(body, &tsa) + return tsa, err + default: + var pa ProbeAction + err := json.Unmarshal(body, &pa) + return pa, err + } +} +func unmarshalBasicProbeActionArray(body []byte) ([]BasicProbeAction, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + paArray := make([]BasicProbeAction, len(rawMessages)) + + for index, rawMessage := range rawMessages { + pa, err := unmarshalBasicProbeAction(*rawMessage) + if err != nil { + return nil, err + } + paArray[index] = pa + } + return paArray, nil +} + +// MarshalJSON is the custom marshaler for ProbeAction. +func (pa ProbeAction) MarshalJSON() ([]byte, error) { + pa.Type = TypeBasicProbeActionTypeProbeAction + objectMap := make(map[string]interface{}) + if pa.Type != "" { + objectMap["type"] = pa.Type + } + return json.Marshal(objectMap) +} + +// AsHTTPGetAction is the BasicProbeAction implementation for ProbeAction. +func (pa ProbeAction) AsHTTPGetAction() (*HTTPGetAction, bool) { + return nil, false +} + +// AsExecAction is the BasicProbeAction implementation for ProbeAction. +func (pa ProbeAction) AsExecAction() (*ExecAction, bool) { + return nil, false +} + +// AsTCPSocketAction is the BasicProbeAction implementation for ProbeAction. +func (pa ProbeAction) AsTCPSocketAction() (*TCPSocketAction, bool) { + return nil, false +} + +// AsProbeAction is the BasicProbeAction implementation for ProbeAction. +func (pa ProbeAction) AsProbeAction() (*ProbeAction, bool) { + return &pa, true +} + +// AsBasicProbeAction is the BasicProbeAction implementation for ProbeAction. +func (pa ProbeAction) AsBasicProbeAction() (BasicProbeAction, bool) { + return &pa, true +} + +// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than +// required location and tags. +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pr.SystemData != nil { + objectMap["systemData"] = pr.SystemData + } + return json.Marshal(objectMap) +} + +// RegenerateTestKeyRequestPayload regenerate test key request payload +type RegenerateTestKeyRequestPayload struct { + // KeyType - Type of the test key. Possible values include: 'TestKeyTypePrimary', 'TestKeyTypeSecondary' + KeyType TestKeyType `json:"keyType,omitempty"` +} + +// RequiredTraffic required inbound or outbound traffic for Azure Spring Apps resource. +type RequiredTraffic struct { + // Protocol - READ-ONLY; The protocol of required traffic + Protocol *string `json:"protocol,omitempty"` + // Port - READ-ONLY; The port of required traffic + Port *int32 `json:"port,omitempty"` + // Ips - READ-ONLY; The ip list of required traffic + Ips *[]string `json:"ips,omitempty"` + // Fqdns - READ-ONLY; The FQDN list of required traffic + Fqdns *[]string `json:"fqdns,omitempty"` + // Direction - READ-ONLY; The direction of required traffic. Possible values include: 'TrafficDirectionInbound', 'TrafficDirectionOutbound' + Direction TrafficDirection `json:"direction,omitempty"` +} + +// MarshalJSON is the custom marshaler for RequiredTraffic. +func (rt RequiredTraffic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource the core properties of ARM resources. +type Resource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.SystemData != nil { + objectMap["systemData"] = r.SystemData + } + return json.Marshal(objectMap) +} + +// ResourceRequests deployment resource request payload +type ResourceRequests struct { + // CPU - Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. + CPU *string `json:"cpu,omitempty"` + // Memory - Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + Memory *string `json:"memory,omitempty"` +} + +// ResourceSku describes an available Azure Spring Apps SKU. +type ResourceSku struct { + // ResourceType - Gets the type of resource the SKU applies to. + ResourceType *string `json:"resourceType,omitempty"` + // Name - Gets the name of SKU. + Name *string `json:"name,omitempty"` + // Tier - Gets the tier of SKU. + Tier *string `json:"tier,omitempty"` + // Capacity - Gets the capacity of SKU. + Capacity *SkuCapacity `json:"capacity,omitempty"` + // Locations - Gets the set of locations that the SKU is available. + Locations *[]string `json:"locations,omitempty"` + // LocationInfo - Gets a list of locations and availability zones in those locations where the SKU is available. + LocationInfo *[]ResourceSkuLocationInfo `json:"locationInfo,omitempty"` + // Restrictions - Gets the restrictions because of which SKU cannot be used. This is + // empty if there are no restrictions. + Restrictions *[]ResourceSkuRestrictions `json:"restrictions,omitempty"` +} + +// ResourceSkuCapabilities ... +type ResourceSkuCapabilities struct { + // Name - Gets an invariant to describe the feature. + Name *string `json:"name,omitempty"` + // Value - Gets an invariant if the feature is measured by quantity. + Value *string `json:"value,omitempty"` +} + +// ResourceSkuCollection object that includes an array of Azure Spring Apps SKU and a possible link for +// next set +type ResourceSkuCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resource SKU + Value *[]ResourceSku `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceSkuCollectionIterator provides access to a complete listing of ResourceSku values. +type ResourceSkuCollectionIterator struct { + i int + page ResourceSkuCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceSkuCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceSkuCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceSkuCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceSkuCollectionIterator) Response() ResourceSkuCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceSkuCollectionIterator) Value() ResourceSku { + if !iter.page.NotDone() { + return ResourceSku{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceSkuCollectionIterator type. +func NewResourceSkuCollectionIterator(page ResourceSkuCollectionPage) ResourceSkuCollectionIterator { + return ResourceSkuCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rsc ResourceSkuCollection) IsEmpty() bool { + return rsc.Value == nil || len(*rsc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rsc ResourceSkuCollection) hasNextLink() bool { + return rsc.NextLink != nil && len(*rsc.NextLink) != 0 +} + +// resourceSkuCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rsc ResourceSkuCollection) resourceSkuCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !rsc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rsc.NextLink))) +} + +// ResourceSkuCollectionPage contains a page of ResourceSku values. +type ResourceSkuCollectionPage struct { + fn func(context.Context, ResourceSkuCollection) (ResourceSkuCollection, error) + rsc ResourceSkuCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceSkuCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rsc) + if err != nil { + return err + } + page.rsc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceSkuCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceSkuCollectionPage) NotDone() bool { + return !page.rsc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceSkuCollectionPage) Response() ResourceSkuCollection { + return page.rsc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceSkuCollectionPage) Values() []ResourceSku { + if page.rsc.IsEmpty() { + return nil + } + return *page.rsc.Value +} + +// Creates a new instance of the ResourceSkuCollectionPage type. +func NewResourceSkuCollectionPage(cur ResourceSkuCollection, getNextPage func(context.Context, ResourceSkuCollection) (ResourceSkuCollection, error)) ResourceSkuCollectionPage { + return ResourceSkuCollectionPage{ + fn: getNextPage, + rsc: cur, + } +} + +// ResourceSkuLocationInfo locations and availability zones where the SKU is available +type ResourceSkuLocationInfo struct { + // Location - Gets location of the SKU + Location *string `json:"location,omitempty"` + // Zones - Gets list of availability zones where the SKU is supported. + Zones *[]string `json:"zones,omitempty"` + // ZoneDetails - Gets details of capabilities available to a SKU in specific zones. + ZoneDetails *[]ResourceSkuZoneDetails `json:"zoneDetails,omitempty"` +} + +// ResourceSkuRestrictionInfo information about the restriction where the SKU cannot be used +type ResourceSkuRestrictionInfo struct { + // Locations - Gets locations where the SKU is restricted + Locations *[]string `json:"locations,omitempty"` + // Zones - Gets list of availability zones where the SKU is restricted. + Zones *[]string `json:"zones,omitempty"` +} + +// ResourceSkuRestrictions restrictions where the SKU cannot be used +type ResourceSkuRestrictions struct { + // Type - Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: 'ResourceSkuRestrictionsTypeLocation', 'ResourceSkuRestrictionsTypeZone' + Type ResourceSkuRestrictionsType `json:"type,omitempty"` + // Values - Gets the value of restrictions. If the restriction type is set to + // location. This would be different locations where the SKU is restricted. + Values *[]string `json:"values,omitempty"` + // RestrictionInfo - Gets the information about the restriction where the SKU cannot be used. + RestrictionInfo *ResourceSkuRestrictionInfo `json:"restrictionInfo,omitempty"` + // ReasonCode - Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: 'ResourceSkuRestrictionsReasonCodeQuotaID', 'ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription' + ReasonCode ResourceSkuRestrictionsReasonCode `json:"reasonCode,omitempty"` +} + +// ResourceSkuZoneDetails details of capabilities available to a SKU in specific zones +type ResourceSkuZoneDetails struct { + // Name - Gets the set of zones that the SKU is available in with the + // specified capabilities. + Name *[]string `json:"name,omitempty"` + // Capabilities - Gets a list of capabilities that are available for the SKU in the + // specified list of zones. + Capabilities *[]ResourceSkuCapabilities `json:"capabilities,omitempty"` +} + +// ResourceUploadDefinition resource upload definition payload +type ResourceUploadDefinition struct { + autorest.Response `json:"-"` + // RelativePath - Source relative path + RelativePath *string `json:"relativePath,omitempty"` + // UploadURL - Upload URL + UploadURL *string `json:"uploadUrl,omitempty"` +} + +// ServiceRegistriesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ServiceRegistriesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServiceRegistriesClient) (ServiceRegistryResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServiceRegistriesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServiceRegistriesCreateOrUpdateFuture.Result. +func (future *ServiceRegistriesCreateOrUpdateFuture) result(client ServiceRegistriesClient) (srr ServiceRegistryResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + srr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServiceRegistriesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if srr.Response.Response, err = future.GetResult(sender); err == nil && srr.Response.Response.StatusCode != http.StatusNoContent { + srr, err = client.CreateOrUpdateResponder(srr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesCreateOrUpdateFuture", "Result", srr.Response.Response, "Failure responding to request") + } + } + return +} + +// ServiceRegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServiceRegistriesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServiceRegistriesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServiceRegistriesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServiceRegistriesDeleteFuture.Result. +func (future *ServiceRegistriesDeleteFuture) result(client ServiceRegistriesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServiceRegistriesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ServiceRegistryInstance collection of instances belong to the Service Registry +type ServiceRegistryInstance struct { + // Name - READ-ONLY; Name of the Service Registry instance + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Status of the Service Registry instance + Status *string `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceRegistryInstance. +func (sri ServiceRegistryInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ServiceRegistryProperties service Registry properties payload +type ServiceRegistryProperties struct { + // ProvisioningState - READ-ONLY; State of the Service Registry. Possible values include: 'ServiceRegistryProvisioningStateCreating', 'ServiceRegistryProvisioningStateUpdating', 'ServiceRegistryProvisioningStateSucceeded', 'ServiceRegistryProvisioningStateFailed', 'ServiceRegistryProvisioningStateDeleting' + ProvisioningState ServiceRegistryProvisioningState `json:"provisioningState,omitempty"` + // ResourceRequests - The requested resource quantity for required CPU and Memory. + ResourceRequests *ServiceRegistryResourceRequests `json:"resourceRequests,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to Service Registry. + Instances *[]ServiceRegistryInstance `json:"instances,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceRegistryProperties. +func (srp ServiceRegistryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if srp.ResourceRequests != nil { + objectMap["resourceRequests"] = srp.ResourceRequests + } + return json.Marshal(objectMap) +} + +// ServiceRegistryResource service Registry resource +type ServiceRegistryResource struct { + autorest.Response `json:"-"` + Properties *ServiceRegistryProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceRegistryResource. +func (srr ServiceRegistryResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if srr.Properties != nil { + objectMap["properties"] = srr.Properties + } + if srr.SystemData != nil { + objectMap["systemData"] = srr.SystemData + } + return json.Marshal(objectMap) +} + +// ServiceRegistryResourceCollection object that includes an array of Service Registry resources and a +// possible link for next set +type ServiceRegistryResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Service Registry resources + Value *[]ServiceRegistryResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// ServiceRegistryResourceCollectionIterator provides access to a complete listing of +// ServiceRegistryResource values. +type ServiceRegistryResourceCollectionIterator struct { + i int + page ServiceRegistryResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ServiceRegistryResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistryResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ServiceRegistryResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceRegistryResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ServiceRegistryResourceCollectionIterator) Response() ServiceRegistryResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ServiceRegistryResourceCollectionIterator) Value() ServiceRegistryResource { + if !iter.page.NotDone() { + return ServiceRegistryResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServiceRegistryResourceCollectionIterator type. +func NewServiceRegistryResourceCollectionIterator(page ServiceRegistryResourceCollectionPage) ServiceRegistryResourceCollectionIterator { + return ServiceRegistryResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (srrc ServiceRegistryResourceCollection) IsEmpty() bool { + return srrc.Value == nil || len(*srrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (srrc ServiceRegistryResourceCollection) hasNextLink() bool { + return srrc.NextLink != nil && len(*srrc.NextLink) != 0 +} + +// serviceRegistryResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (srrc ServiceRegistryResourceCollection) serviceRegistryResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !srrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(srrc.NextLink))) +} + +// ServiceRegistryResourceCollectionPage contains a page of ServiceRegistryResource values. +type ServiceRegistryResourceCollectionPage struct { + fn func(context.Context, ServiceRegistryResourceCollection) (ServiceRegistryResourceCollection, error) + srrc ServiceRegistryResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ServiceRegistryResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistryResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.srrc) + if err != nil { + return err + } + page.srrc = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ServiceRegistryResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceRegistryResourceCollectionPage) NotDone() bool { + return !page.srrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceRegistryResourceCollectionPage) Response() ServiceRegistryResourceCollection { + return page.srrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceRegistryResourceCollectionPage) Values() []ServiceRegistryResource { + if page.srrc.IsEmpty() { + return nil + } + return *page.srrc.Value +} + +// Creates a new instance of the ServiceRegistryResourceCollectionPage type. +func NewServiceRegistryResourceCollectionPage(cur ServiceRegistryResourceCollection, getNextPage func(context.Context, ServiceRegistryResourceCollection) (ServiceRegistryResourceCollection, error)) ServiceRegistryResourceCollectionPage { + return ServiceRegistryResourceCollectionPage{ + fn: getNextPage, + srrc: cur, + } +} + +// ServiceRegistryResourceRequests resource request payload of Service Registry +type ServiceRegistryResourceRequests struct { + // CPU - READ-ONLY; Cpu allocated to each Service Registry instance + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; Memory allocated to each Service Registry instance + Memory *string `json:"memory,omitempty"` + // InstanceCount - READ-ONLY; Instance count of the Service Registry + InstanceCount *int32 `json:"instanceCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceRegistryResourceRequests. +func (srrr ServiceRegistryResourceRequests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ServiceResource service resource +type ServiceResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Service resource + Properties *ClusterResourceProperties `json:"properties,omitempty"` + // Sku - Sku of the Service resource + Sku *Sku `json:"sku,omitempty"` + // Location - The GEO location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Tags of the service which is a list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceResource. +func (sr ServiceResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.Properties != nil { + objectMap["properties"] = sr.Properties + } + if sr.Sku != nil { + objectMap["sku"] = sr.Sku + } + if sr.Location != nil { + objectMap["location"] = sr.Location + } + if sr.Tags != nil { + objectMap["tags"] = sr.Tags + } + if sr.SystemData != nil { + objectMap["systemData"] = sr.SystemData + } + return json.Marshal(objectMap) +} + +// ServiceResourceList object that includes an array of Service resources and a possible link for next set +type ServiceResourceList struct { + autorest.Response `json:"-"` + // Value - Collection of Service resources + Value *[]ServiceResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// ServiceResourceListIterator provides access to a complete listing of ServiceResource values. +type ServiceResourceListIterator struct { + i int + page ServiceResourceListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ServiceResourceListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ServiceResourceListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceResourceListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ServiceResourceListIterator) Response() ServiceResourceList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ServiceResourceListIterator) Value() ServiceResource { + if !iter.page.NotDone() { + return ServiceResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServiceResourceListIterator type. +func NewServiceResourceListIterator(page ServiceResourceListPage) ServiceResourceListIterator { + return ServiceResourceListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (srl ServiceResourceList) IsEmpty() bool { + return srl.Value == nil || len(*srl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (srl ServiceResourceList) hasNextLink() bool { + return srl.NextLink != nil && len(*srl.NextLink) != 0 +} + +// serviceResourceListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (srl ServiceResourceList) serviceResourceListPreparer(ctx context.Context) (*http.Request, error) { + if !srl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(srl.NextLink))) +} + +// ServiceResourceListPage contains a page of ServiceResource values. +type ServiceResourceListPage struct { + fn func(context.Context, ServiceResourceList) (ServiceResourceList, error) + srl ServiceResourceList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ServiceResourceListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.srl) + if err != nil { + return err + } + page.srl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ServiceResourceListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceResourceListPage) NotDone() bool { + return !page.srl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceResourceListPage) Response() ServiceResourceList { + return page.srl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceResourceListPage) Values() []ServiceResource { + if page.srl.IsEmpty() { + return nil + } + return *page.srl.Value +} + +// Creates a new instance of the ServiceResourceListPage type. +func NewServiceResourceListPage(cur ServiceResourceList, getNextPage func(context.Context, ServiceResourceList) (ServiceResourceList, error)) ServiceResourceListPage { + return ServiceResourceListPage{ + fn: getNextPage, + srl: cur, + } +} + +// ServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServicesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServicesClient) (ServiceResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServicesCreateOrUpdateFuture.Result. +func (future *ServicesCreateOrUpdateFuture) result(client ServicesClient) (sr ServiceResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { + sr, err = client.CreateOrUpdateResponder(sr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") + } + } + return +} + +// ServicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServicesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServicesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServicesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServicesDeleteFuture.Result. +func (future *ServicesDeleteFuture) result(client ServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ServiceSpecification service specification payload +type ServiceSpecification struct { + // LogSpecifications - Specifications of the Log for Azure Monitoring + LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` + // MetricSpecifications - Specifications of the Metrics for Azure Monitoring + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` +} + +// ServicesStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServicesStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServicesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServicesStartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServicesStartFuture.Result. +func (future *ServicesStartFuture) result(client ServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesStartFuture") + return + } + ar.Response = future.Response() + return +} + +// ServicesStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ServicesStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServicesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServicesStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServicesStopFuture.Result. +func (future *ServicesStopFuture) result(client ServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesStopFuture") + return + } + ar.Response = future.Response() + return +} + +// ServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServicesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServicesClient) (ServiceResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServicesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServicesUpdateFuture.Result. +func (future *ServicesUpdateFuture) result(client ServicesClient) (sr ServiceResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { + sr, err = client.UpdateResponder(sr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") + } + } + return +} + +// ServiceVNetAddons additional Service settings in vnet injection instance +type ServiceVNetAddons struct { + // LogStreamPublicEndpoint - Indicates whether the log stream in vnet injection instance could be accessed from internet. + LogStreamPublicEndpoint *bool `json:"logStreamPublicEndpoint,omitempty"` +} + +// Sku sku of Azure Spring Apps +type Sku struct { + // Name - Name of the Sku + Name *string `json:"name,omitempty"` + // Tier - Tier of the Sku + Tier *string `json:"tier,omitempty"` + // Capacity - Current capacity of the target resource + Capacity *int32 `json:"capacity,omitempty"` +} + +// SkuCapacity the SKU capacity +type SkuCapacity struct { + // Minimum - Gets or sets the minimum. + Minimum *int32 `json:"minimum,omitempty"` + // Maximum - Gets or sets the maximum. + Maximum *int32 `json:"maximum,omitempty"` + // Default - Gets or sets the default. + Default *int32 `json:"default,omitempty"` + // ScaleType - Gets or sets the type of the scale. Possible values include: 'SkuScaleTypeNone', 'SkuScaleTypeManual', 'SkuScaleTypeAutomatic' + ScaleType SkuScaleType `json:"scaleType,omitempty"` +} + +// SourceUploadedUserSourceInfo uploaded Java source code binary for a deployment +type SourceUploadedUserSourceInfo struct { + // ArtifactSelector - Selector for the artifact to be used for the deployment for multi-module projects. This should be + // the relative path to the target module/project. + ArtifactSelector *string `json:"artifactSelector,omitempty"` + // RuntimeVersion - Runtime version of the source file + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + // RelativePath - Relative path of the storage which stores the source + RelativePath *string `json:"relativePath,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeBasicUserSourceInfoTypeUserSourceInfo', 'TypeBasicUserSourceInfoTypeUploadedUserSourceInfo', 'TypeBasicUserSourceInfoTypeJar', 'TypeBasicUserSourceInfoTypeSource', 'TypeBasicUserSourceInfoTypeNetCoreZip', 'TypeBasicUserSourceInfoTypeBuildResult', 'TypeBasicUserSourceInfoTypeContainer' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + suusi.Type = TypeBasicUserSourceInfoTypeSource + objectMap := make(map[string]interface{}) + if suusi.ArtifactSelector != nil { + objectMap["artifactSelector"] = suusi.ArtifactSelector + } + if suusi.RuntimeVersion != nil { + objectMap["runtimeVersion"] = suusi.RuntimeVersion + } + if suusi.RelativePath != nil { + objectMap["relativePath"] = suusi.RelativePath + } + if suusi.Version != nil { + objectMap["version"] = suusi.Version + } + if suusi.Type != "" { + objectMap["type"] = suusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return &suusi, true +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return &suusi, true +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &suusi, true +} + +// SsoProperties single sign-on related configuration +type SsoProperties struct { + // Scope - It defines the specific actions applications can be allowed to do on a user's behalf + Scope *[]string `json:"scope,omitempty"` + // ClientID - The public identifier for the application + ClientID *string `json:"clientId,omitempty"` + // ClientSecret - The secret known only to the application and the authorization server + ClientSecret *string `json:"clientSecret,omitempty"` + // IssuerURI - The URI of Issuer Identifier + IssuerURI *string `json:"issuerUri,omitempty"` +} + +// StackProperties kPack ClusterStack properties payload +type StackProperties struct { + // ID - Id of the ClusterStack. + ID *string `json:"id,omitempty"` + // Version - Version of the ClusterStack + Version *string `json:"version,omitempty"` +} + +// StorageAccount storage resource of type Azure Storage Account. +type StorageAccount struct { + // AccountName - The account name of the Azure Storage Account. + AccountName *string `json:"accountName,omitempty"` + // AccountKey - The account key of the Azure Storage Account. + AccountKey *string `json:"accountKey,omitempty"` + // StorageType - Possible values include: 'StorageTypeStorageProperties', 'StorageTypeStorageAccount' + StorageType StorageType `json:"storageType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageAccount. +func (sa StorageAccount) MarshalJSON() ([]byte, error) { + sa.StorageType = StorageTypeStorageAccount + objectMap := make(map[string]interface{}) + if sa.AccountName != nil { + objectMap["accountName"] = sa.AccountName + } + if sa.AccountKey != nil { + objectMap["accountKey"] = sa.AccountKey + } + if sa.StorageType != "" { + objectMap["storageType"] = sa.StorageType + } + return json.Marshal(objectMap) +} + +// AsStorageAccount is the BasicStorageProperties implementation for StorageAccount. +func (sa StorageAccount) AsStorageAccount() (*StorageAccount, bool) { + return &sa, true +} + +// AsStorageProperties is the BasicStorageProperties implementation for StorageAccount. +func (sa StorageAccount) AsStorageProperties() (*StorageProperties, bool) { + return nil, false +} + +// AsBasicStorageProperties is the BasicStorageProperties implementation for StorageAccount. +func (sa StorageAccount) AsBasicStorageProperties() (BasicStorageProperties, bool) { + return &sa, true +} + +// BasicStorageProperties storage resource payload. +type BasicStorageProperties interface { + AsStorageAccount() (*StorageAccount, bool) + AsStorageProperties() (*StorageProperties, bool) +} + +// StorageProperties storage resource payload. +type StorageProperties struct { + // StorageType - Possible values include: 'StorageTypeStorageProperties', 'StorageTypeStorageAccount' + StorageType StorageType `json:"storageType,omitempty"` +} + +func unmarshalBasicStorageProperties(body []byte) (BasicStorageProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["storageType"] { + case string(StorageTypeStorageAccount): + var sa StorageAccount + err := json.Unmarshal(body, &sa) + return sa, err + default: + var sp StorageProperties + err := json.Unmarshal(body, &sp) + return sp, err + } +} +func unmarshalBasicStoragePropertiesArray(body []byte) ([]BasicStorageProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + spArray := make([]BasicStorageProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + sp, err := unmarshalBasicStorageProperties(*rawMessage) + if err != nil { + return nil, err + } + spArray[index] = sp + } + return spArray, nil +} + +// MarshalJSON is the custom marshaler for StorageProperties. +func (sp StorageProperties) MarshalJSON() ([]byte, error) { + sp.StorageType = StorageTypeStorageProperties + objectMap := make(map[string]interface{}) + if sp.StorageType != "" { + objectMap["storageType"] = sp.StorageType + } + return json.Marshal(objectMap) +} + +// AsStorageAccount is the BasicStorageProperties implementation for StorageProperties. +func (sp StorageProperties) AsStorageAccount() (*StorageAccount, bool) { + return nil, false +} + +// AsStorageProperties is the BasicStorageProperties implementation for StorageProperties. +func (sp StorageProperties) AsStorageProperties() (*StorageProperties, bool) { + return &sp, true +} + +// AsBasicStorageProperties is the BasicStorageProperties implementation for StorageProperties. +func (sp StorageProperties) AsBasicStorageProperties() (BasicStorageProperties, bool) { + return &sp, true +} + +// StorageResource storage resource payload. +type StorageResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the storage resource payload. + Properties BasicStorageProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageResource. +func (sr StorageResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = sr.Properties + if sr.SystemData != nil { + objectMap["systemData"] = sr.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StorageResource struct. +func (sr *StorageResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + properties, err := unmarshalBasicStorageProperties(*v) + if err != nil { + return err + } + sr.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sr.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sr.SystemData = &systemData + } + } + } + + return nil +} + +// StorageResourceCollection collection compose of storage resources list and a possible link for next +// page. +type StorageResourceCollection struct { + autorest.Response `json:"-"` + // Value - The storage resources list. + Value *[]StorageResource `json:"value,omitempty"` + // NextLink - The link to next page of storage list. + NextLink *string `json:"nextLink,omitempty"` +} + +// StorageResourceCollectionIterator provides access to a complete listing of StorageResource values. +type StorageResourceCollectionIterator struct { + i int + page StorageResourceCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *StorageResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageResourceCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *StorageResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter StorageResourceCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter StorageResourceCollectionIterator) Response() StorageResourceCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter StorageResourceCollectionIterator) Value() StorageResource { + if !iter.page.NotDone() { + return StorageResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the StorageResourceCollectionIterator type. +func NewStorageResourceCollectionIterator(page StorageResourceCollectionPage) StorageResourceCollectionIterator { + return StorageResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (src StorageResourceCollection) IsEmpty() bool { + return src.Value == nil || len(*src.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (src StorageResourceCollection) hasNextLink() bool { + return src.NextLink != nil && len(*src.NextLink) != 0 +} + +// storageResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (src StorageResourceCollection) storageResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !src.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(src.NextLink))) +} + +// StorageResourceCollectionPage contains a page of StorageResource values. +type StorageResourceCollectionPage struct { + fn func(context.Context, StorageResourceCollection) (StorageResourceCollection, error) + src StorageResourceCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *StorageResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageResourceCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.src) + if err != nil { + return err + } + page.src = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *StorageResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page StorageResourceCollectionPage) NotDone() bool { + return !page.src.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page StorageResourceCollectionPage) Response() StorageResourceCollection { + return page.src +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page StorageResourceCollectionPage) Values() []StorageResource { + if page.src.IsEmpty() { + return nil + } + return *page.src.Value +} + +// Creates a new instance of the StorageResourceCollectionPage type. +func NewStorageResourceCollectionPage(cur StorageResourceCollection, getNextPage func(context.Context, StorageResourceCollection) (StorageResourceCollection, error)) StorageResourceCollectionPage { + return StorageResourceCollectionPage{ + fn: getNextPage, + src: cur, + } +} + +// StoragesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type StoragesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StoragesClient) (StorageResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StoragesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StoragesCreateOrUpdateFuture.Result. +func (future *StoragesCreateOrUpdateFuture) result(client StoragesClient) (sr StorageResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.StoragesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.StoragesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { + sr, err = client.CreateOrUpdateResponder(sr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.StoragesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") + } + } + return +} + +// StoragesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type StoragesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StoragesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StoragesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for StoragesDeleteFuture.Result. +func (future *StoragesDeleteFuture) result(client StoragesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.StoragesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.StoragesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SupportedBuildpackResource supported buildpack resource payload +type SupportedBuildpackResource struct { + autorest.Response `json:"-"` + Properties *SupportedBuildpackResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SupportedBuildpackResource. +func (sbr SupportedBuildpackResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sbr.Properties != nil { + objectMap["properties"] = sbr.Properties + } + if sbr.SystemData != nil { + objectMap["systemData"] = sbr.SystemData + } + return json.Marshal(objectMap) +} + +// SupportedBuildpackResourceProperties supported buildpack resource properties +type SupportedBuildpackResourceProperties struct { + // BuildpackID - The id of supported buildpack + BuildpackID *string `json:"buildpackId,omitempty"` +} + +// SupportedBuildpacksCollection object that includes an array of supported buildpacks resources and a +// possible link for next set +type SupportedBuildpacksCollection struct { + autorest.Response `json:"-"` + // Value - Collection of supported buildpacks resources + Value *[]SupportedBuildpackResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// SupportedRuntimeVersion supported deployment runtime version descriptor. +type SupportedRuntimeVersion struct { + // Value - The raw value which could be passed to deployment CRUD operations. Possible values include: 'SupportedRuntimeValueJava8', 'SupportedRuntimeValueJava11', 'SupportedRuntimeValueJava17', 'SupportedRuntimeValueNetCore31' + Value SupportedRuntimeValue `json:"value,omitempty"` + // Platform - The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: 'SupportedRuntimePlatformJava', 'SupportedRuntimePlatformNETCore' + Platform SupportedRuntimePlatform `json:"platform,omitempty"` + // Version - The detailed version (major.minor) of the platform. + Version *string `json:"version,omitempty"` +} + +// SupportedStackResource supported stack resource payload +type SupportedStackResource struct { + autorest.Response `json:"-"` + Properties *SupportedStackResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SupportedStackResource. +func (ssr SupportedStackResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssr.Properties != nil { + objectMap["properties"] = ssr.Properties + } + if ssr.SystemData != nil { + objectMap["systemData"] = ssr.SystemData + } + return json.Marshal(objectMap) +} + +// SupportedStackResourceProperties supported stack resource properties +type SupportedStackResourceProperties struct { + // StackID - The id of supported stack + StackID *string `json:"stackId,omitempty"` + // Version - The version of supported stack + Version *string `json:"version,omitempty"` +} + +// SupportedStacksCollection object that includes an array of supported stacks resources and a possible +// link for next set +type SupportedStacksCollection struct { + autorest.Response `json:"-"` + // Value - Collection of supported stacks resources + Value *[]SupportedStackResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'LastModifiedByTypeUser', 'LastModifiedByTypeApplication', 'LastModifiedByTypeManagedIdentity', 'LastModifiedByTypeKey' + LastModifiedByType LastModifiedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource modification (UTC). + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TCPSocketAction tCPSocketAction describes an action based on opening a socket +type TCPSocketAction struct { + // Type - Possible values include: 'TypeBasicProbeActionTypeProbeAction', 'TypeBasicProbeActionTypeHTTPGetAction', 'TypeBasicProbeActionTypeExecAction', 'TypeBasicProbeActionTypeTCPSocketAction' + Type TypeBasicProbeAction `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TCPSocketAction. +func (tsa TCPSocketAction) MarshalJSON() ([]byte, error) { + tsa.Type = TypeBasicProbeActionTypeTCPSocketAction + objectMap := make(map[string]interface{}) + if tsa.Type != "" { + objectMap["type"] = tsa.Type + } + return json.Marshal(objectMap) +} + +// AsHTTPGetAction is the BasicProbeAction implementation for TCPSocketAction. +func (tsa TCPSocketAction) AsHTTPGetAction() (*HTTPGetAction, bool) { + return nil, false +} + +// AsExecAction is the BasicProbeAction implementation for TCPSocketAction. +func (tsa TCPSocketAction) AsExecAction() (*ExecAction, bool) { + return nil, false +} + +// AsTCPSocketAction is the BasicProbeAction implementation for TCPSocketAction. +func (tsa TCPSocketAction) AsTCPSocketAction() (*TCPSocketAction, bool) { + return &tsa, true +} + +// AsProbeAction is the BasicProbeAction implementation for TCPSocketAction. +func (tsa TCPSocketAction) AsProbeAction() (*ProbeAction, bool) { + return nil, false +} + +// AsBasicProbeAction is the BasicProbeAction implementation for TCPSocketAction. +func (tsa TCPSocketAction) AsBasicProbeAction() (BasicProbeAction, bool) { + return &tsa, true +} + +// TemporaryDisk temporary disk payload +type TemporaryDisk struct { + // SizeInGB - Size of the temporary disk in GB + SizeInGB *int32 `json:"sizeInGB,omitempty"` + // MountPath - Mount path of the temporary disk + MountPath *string `json:"mountPath,omitempty"` +} + +// TestKeys test keys payload +type TestKeys struct { + autorest.Response `json:"-"` + // PrimaryKey - Primary key + PrimaryKey *string `json:"primaryKey,omitempty"` + // SecondaryKey - Secondary key + SecondaryKey *string `json:"secondaryKey,omitempty"` + // PrimaryTestEndpoint - Primary test endpoint + PrimaryTestEndpoint *string `json:"primaryTestEndpoint,omitempty"` + // SecondaryTestEndpoint - Secondary test endpoint + SecondaryTestEndpoint *string `json:"secondaryTestEndpoint,omitempty"` + // Enabled - Indicates whether the test endpoint feature enabled or not + Enabled *bool `json:"enabled,omitempty"` +} + +// TrackedResource the resource model definition for a ARM tracked top level resource. +type TrackedResource struct { + // Location - The GEO location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Tags of the service which is a list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Location != nil { + objectMap["location"] = tr.Location + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.SystemData != nil { + objectMap["systemData"] = tr.SystemData + } + return json.Marshal(objectMap) +} + +// TriggeredBuildResult the build result triggered by a build +type TriggeredBuildResult struct { + // ID - The unique build id of this build result + ID *string `json:"id,omitempty"` +} + +// BasicUploadedUserSourceInfo source with uploaded location +type BasicUploadedUserSourceInfo interface { + AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) + AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) + AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) + AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) +} + +// UploadedUserSourceInfo source with uploaded location +type UploadedUserSourceInfo struct { + // RelativePath - Relative path of the storage which stores the source + RelativePath *string `json:"relativePath,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeBasicUserSourceInfoTypeUserSourceInfo', 'TypeBasicUserSourceInfoTypeUploadedUserSourceInfo', 'TypeBasicUserSourceInfoTypeJar', 'TypeBasicUserSourceInfoTypeSource', 'TypeBasicUserSourceInfoTypeNetCoreZip', 'TypeBasicUserSourceInfoTypeBuildResult', 'TypeBasicUserSourceInfoTypeContainer' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +func unmarshalBasicUploadedUserSourceInfo(body []byte) (BasicUploadedUserSourceInfo, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicUserSourceInfoTypeJar): + var juusi JarUploadedUserSourceInfo + err := json.Unmarshal(body, &juusi) + return juusi, err + case string(TypeBasicUserSourceInfoTypeSource): + var suusi SourceUploadedUserSourceInfo + err := json.Unmarshal(body, &suusi) + return suusi, err + case string(TypeBasicUserSourceInfoTypeNetCoreZip): + var nczuusi NetCoreZipUploadedUserSourceInfo + err := json.Unmarshal(body, &nczuusi) + return nczuusi, err + default: + var uusi UploadedUserSourceInfo + err := json.Unmarshal(body, &uusi) + return uusi, err + } +} +func unmarshalBasicUploadedUserSourceInfoArray(body []byte) ([]BasicUploadedUserSourceInfo, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + uusiArray := make([]BasicUploadedUserSourceInfo, len(rawMessages)) + + for index, rawMessage := range rawMessages { + uusi, err := unmarshalBasicUploadedUserSourceInfo(*rawMessage) + if err != nil { + return nil, err + } + uusiArray[index] = uusi + } + return uusiArray, nil +} + +// MarshalJSON is the custom marshaler for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + uusi.Type = TypeBasicUserSourceInfoTypeUploadedUserSourceInfo + objectMap := make(map[string]interface{}) + if uusi.RelativePath != nil { + objectMap["relativePath"] = uusi.RelativePath + } + if uusi.Version != nil { + objectMap["version"] = uusi.Version + } + if uusi.Type != "" { + objectMap["type"] = uusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return &uusi, true +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return &uusi, true +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &uusi, true +} + +// UserAssignedManagedIdentity the details of the user-assigned managed identity assigned to an App. +type UserAssignedManagedIdentity struct { + // PrincipalID - READ-ONLY; Principal Id of user-assigned managed identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; Client Id of user-assigned managed identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserAssignedManagedIdentity. +func (uami UserAssignedManagedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BasicUserSourceInfo source information for a deployment +type BasicUserSourceInfo interface { + AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) + AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) + AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) + AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) + AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) + AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) + AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) + AsUserSourceInfo() (*UserSourceInfo, bool) +} + +// UserSourceInfo source information for a deployment +type UserSourceInfo struct { + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeBasicUserSourceInfoTypeUserSourceInfo', 'TypeBasicUserSourceInfoTypeUploadedUserSourceInfo', 'TypeBasicUserSourceInfoTypeJar', 'TypeBasicUserSourceInfoTypeSource', 'TypeBasicUserSourceInfoTypeNetCoreZip', 'TypeBasicUserSourceInfoTypeBuildResult', 'TypeBasicUserSourceInfoTypeContainer' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +func unmarshalBasicUserSourceInfo(body []byte) (BasicUserSourceInfo, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicUserSourceInfoTypeUploadedUserSourceInfo): + var uusi UploadedUserSourceInfo + err := json.Unmarshal(body, &uusi) + return uusi, err + case string(TypeBasicUserSourceInfoTypeJar): + var juusi JarUploadedUserSourceInfo + err := json.Unmarshal(body, &juusi) + return juusi, err + case string(TypeBasicUserSourceInfoTypeSource): + var suusi SourceUploadedUserSourceInfo + err := json.Unmarshal(body, &suusi) + return suusi, err + case string(TypeBasicUserSourceInfoTypeNetCoreZip): + var nczuusi NetCoreZipUploadedUserSourceInfo + err := json.Unmarshal(body, &nczuusi) + return nczuusi, err + case string(TypeBasicUserSourceInfoTypeBuildResult): + var brusi BuildResultUserSourceInfo + err := json.Unmarshal(body, &brusi) + return brusi, err + case string(TypeBasicUserSourceInfoTypeContainer): + var ccusi CustomContainerUserSourceInfo + err := json.Unmarshal(body, &ccusi) + return ccusi, err + default: + var usi UserSourceInfo + err := json.Unmarshal(body, &usi) + return usi, err + } +} +func unmarshalBasicUserSourceInfoArray(body []byte) ([]BasicUserSourceInfo, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + usiArray := make([]BasicUserSourceInfo, len(rawMessages)) + + for index, rawMessage := range rawMessages { + usi, err := unmarshalBasicUserSourceInfo(*rawMessage) + if err != nil { + return nil, err + } + usiArray[index] = usi + } + return usiArray, nil +} + +// MarshalJSON is the custom marshaler for UserSourceInfo. +func (usi UserSourceInfo) MarshalJSON() ([]byte, error) { + usi.Type = TypeBasicUserSourceInfoTypeUserSourceInfo + objectMap := make(map[string]interface{}) + if usi.Version != nil { + objectMap["version"] = usi.Version + } + if usi.Type != "" { + objectMap["type"] = usi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return &usi, true +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &usi, true +} + +// ValidationMessages validate messages of the configuration service git repositories +type ValidationMessages struct { + // Name - The name of the configuration service git repository. + Name *string `json:"name,omitempty"` + // Messages - Detailed validation messages. + Messages *[]string `json:"messages,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/monitoringsettings.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/monitoringsettings.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/monitoringsettings.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/monitoringsettings.go index 6feea311ea0..aaa5cd07ce5 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/monitoringsettings.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/monitoringsettings.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// MonitoringSettingsClient is the REST API for Azure Spring Cloud +// MonitoringSettingsClient is the REST API for Azure Spring Apps type MonitoringSettingsClient struct { BaseClient } @@ -78,7 +78,7 @@ func (client MonitoringSettingsClient) GetPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -149,7 +149,7 @@ func (client MonitoringSettingsClient) UpdatePatchPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -243,7 +243,7 @@ func (client MonitoringSettingsClient) UpdatePutPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/operations.go new file mode 100644 index 00000000000..83707cfec13 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/operations.go @@ -0,0 +1,140 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the REST API for Azure Spring Apps +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available REST API operations of the Microsoft.AppPlatform provider. +func (client OperationsClient) List(ctx context.Context) (result AvailableOperationsPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.ao.Response.Response != nil { + sc = result.ao.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ao.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.ao, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.ao.hasNextLink() && result.ao.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.AppPlatform/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result AvailableOperations, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults AvailableOperations) (result AvailableOperations, err error) { + req, err := lastResults.availableOperationsPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result AvailableOperationsIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/runtimeversions.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/runtimeversions.go similarity index 97% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/runtimeversions.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/runtimeversions.go index 896cc97cbe2..a4e59680f20 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/runtimeversions.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/runtimeversions.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// RuntimeVersionsClient is the REST API for Azure Spring Cloud +// RuntimeVersionsClient is the REST API for Azure Spring Apps type RuntimeVersionsClient struct { BaseClient } @@ -66,7 +66,7 @@ func (client RuntimeVersionsClient) ListRuntimeVersions(ctx context.Context) (re // ListRuntimeVersionsPreparer prepares the ListRuntimeVersions request. func (client RuntimeVersionsClient) ListRuntimeVersionsPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/serviceregistries.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/serviceregistries.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/serviceregistries.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/serviceregistries.go index bc79902ddb2..ca0ad3e9237 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/serviceregistries.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/serviceregistries.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// ServiceRegistriesClient is the REST API for Azure Spring Cloud +// ServiceRegistriesClient is the REST API for Azure Spring Apps type ServiceRegistriesClient struct { BaseClient } @@ -72,7 +72,7 @@ func (client ServiceRegistriesClient) CreateOrUpdatePreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -154,7 +154,7 @@ func (client ServiceRegistriesClient) DeletePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -242,7 +242,7 @@ func (client ServiceRegistriesClient) GetPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -324,7 +324,7 @@ func (client ServiceRegistriesClient) ListPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/services.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/services.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/services.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/services.go index dd58f440bcd..e96ba204297 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/services.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/services.go @@ -15,7 +15,7 @@ import ( "net/http" ) -// ServicesClient is the REST API for Azure Spring Cloud +// ServicesClient is the REST API for Azure Spring Apps type ServicesClient struct { BaseClient } @@ -82,7 +82,7 @@ func (client ServicesClient) CheckNameAvailabilityPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -155,7 +155,7 @@ func (client ServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -237,7 +237,7 @@ func (client ServicesClient) DeletePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -323,7 +323,7 @@ func (client ServicesClient) DisableTestEndpointPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -399,7 +399,7 @@ func (client ServicesClient) EnableTestEndpointPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -476,7 +476,7 @@ func (client ServicesClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -556,7 +556,7 @@ func (client ServicesClient) ListPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -669,7 +669,7 @@ func (client ServicesClient) ListBySubscriptionPreparer(ctx context.Context) (*h "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -783,7 +783,7 @@ func (client ServicesClient) ListTestKeysPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -861,7 +861,7 @@ func (client ServicesClient) RegenerateTestKeyPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -933,7 +933,7 @@ func (client ServicesClient) StartPreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1012,7 +1012,7 @@ func (client ServicesClient) StopPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1092,7 +1092,7 @@ func (client ServicesClient) UpdatePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/skus.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/skus.go new file mode 100644 index 00000000000..949a9a06d91 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/skus.go @@ -0,0 +1,144 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SkusClient is the REST API for Azure Spring Apps +type SkusClient struct { + BaseClient +} + +// NewSkusClient creates an instance of the SkusClient client. +func NewSkusClient(subscriptionID string) SkusClient { + return NewSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSkusClientWithBaseURI creates an instance of the SkusClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSkusClientWithBaseURI(baseURI string, subscriptionID string) SkusClient { + return SkusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available skus of the Microsoft.AppPlatform provider. +func (client SkusClient) List(ctx context.Context) (result ResourceSkuCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkusClient.List") + defer func() { + sc := -1 + if result.rsc.Response.Response != nil { + sc = result.rsc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rsc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "List", resp, "Failure sending request") + return + } + + result.rsc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "List", resp, "Failure responding to request") + return + } + if result.rsc.hasNextLink() && result.rsc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SkusClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SkusClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SkusClient) ListResponder(resp *http.Response) (result ResourceSkuCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SkusClient) listNextResults(ctx context.Context, lastResults ResourceSkuCollection) (result ResourceSkuCollection, err error) { + req, err := lastResults.resourceSkuCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.SkusClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.SkusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SkusClient) ListComplete(ctx context.Context) (result ResourceSkuCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkusClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/storages.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/storages.go similarity index 98% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/storages.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/storages.go index 2525c2f89a6..86805955513 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/storages.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/storages.go @@ -14,7 +14,7 @@ import ( "net/http" ) -// StoragesClient is the REST API for Azure Spring Cloud +// StoragesClient is the REST API for Azure Spring Apps type StoragesClient struct { BaseClient } @@ -72,7 +72,7 @@ func (client StoragesClient) CreateOrUpdatePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -156,7 +156,7 @@ func (client StoragesClient) DeletePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -244,7 +244,7 @@ func (client StoragesClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -275,7 +275,7 @@ func (client StoragesClient) GetResponder(resp *http.Response) (result StorageRe return } -// List list all the storages of one Azure Spring Cloud instance. +// List list all the storages of one Azure Spring Apps resource. // Parameters: // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value // from the Azure Resource Manager API or the portal. @@ -326,7 +326,7 @@ func (client StoragesClient) ListPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-03-01-preview" + const APIVersion = "2022-05-01-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/version.go new file mode 100644 index 00000000000..7ab799fb5ab --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/version.go @@ -0,0 +1,19 @@ +package appplatform + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " appplatform/2022-05-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/_meta.json deleted file mode 100644 index 87905204c1d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "25a8355d4094595edf9b58b13e8c95b0b0c9c50c", - "readme": "/_/azure-rest-api-specs/specification/containerservice/resource-manager/readme.md", - "tag": "package-preview-2022-01", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2022-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/containerservice/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/client.go deleted file mode 100644 index 400e1362955..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package containerservice implements the Azure ARM Containerservice service API version 2022-01-02-preview. -// -// The Container Service Client. -package containerservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Containerservice - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Containerservice. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/enums.go deleted file mode 100644 index 31520c87139..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/enums.go +++ /dev/null @@ -1,982 +0,0 @@ -package containerservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AgentPoolMode enumerates the values for agent pool mode. -type AgentPoolMode string - -const ( - // AgentPoolModeSystem System agent pools are primarily for hosting critical system pods such as CoreDNS - // and metrics-server. System agent pools osType must be Linux. System agent pools VM SKU must have at - // least 2vCPUs and 4GB of memory. - AgentPoolModeSystem AgentPoolMode = "System" - // AgentPoolModeUser User agent pools are primarily for hosting your application pods. - AgentPoolModeUser AgentPoolMode = "User" -) - -// PossibleAgentPoolModeValues returns an array of possible values for the AgentPoolMode const type. -func PossibleAgentPoolModeValues() []AgentPoolMode { - return []AgentPoolMode{AgentPoolModeSystem, AgentPoolModeUser} -} - -// AgentPoolType enumerates the values for agent pool type. -type AgentPoolType string - -const ( - // AgentPoolTypeAvailabilitySet Use of this is strongly discouraged. - AgentPoolTypeAvailabilitySet AgentPoolType = "AvailabilitySet" - // AgentPoolTypeVirtualMachineScaleSets Create an Agent Pool backed by a Virtual Machine Scale Set. - AgentPoolTypeVirtualMachineScaleSets AgentPoolType = "VirtualMachineScaleSets" -) - -// PossibleAgentPoolTypeValues returns an array of possible values for the AgentPoolType const type. -func PossibleAgentPoolTypeValues() []AgentPoolType { - return []AgentPoolType{AgentPoolTypeAvailabilitySet, AgentPoolTypeVirtualMachineScaleSets} -} - -// Code enumerates the values for code. -type Code string - -const ( - // CodeRunning The cluster is running. - CodeRunning Code = "Running" - // CodeStopped The cluster is stopped. - CodeStopped Code = "Stopped" -) - -// PossibleCodeValues returns an array of possible values for the Code const type. -func PossibleCodeValues() []Code { - return []Code{CodeRunning, CodeStopped} -} - -// ConnectionStatus enumerates the values for connection status. -type ConnectionStatus string - -const ( - // ConnectionStatusApproved ... - ConnectionStatusApproved ConnectionStatus = "Approved" - // ConnectionStatusDisconnected ... - ConnectionStatusDisconnected ConnectionStatus = "Disconnected" - // ConnectionStatusPending ... - ConnectionStatusPending ConnectionStatus = "Pending" - // ConnectionStatusRejected ... - ConnectionStatusRejected ConnectionStatus = "Rejected" -) - -// PossibleConnectionStatusValues returns an array of possible values for the ConnectionStatus const type. -func PossibleConnectionStatusValues() []ConnectionStatus { - return []ConnectionStatus{ConnectionStatusApproved, ConnectionStatusDisconnected, ConnectionStatusPending, ConnectionStatusRejected} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// Expander enumerates the values for expander. -type Expander string - -const ( - // ExpanderLeastWaste Selects the node group that will have the least idle CPU (if tied, unused memory) - // after scale-up. This is useful when you have different classes of nodes, for example, high CPU or high - // memory nodes, and only want to expand those when there are pending pods that need a lot of those - // resources. - ExpanderLeastWaste Expander = "least-waste" - // ExpanderMostPods Selects the node group that would be able to schedule the most pods when scaling up. - // This is useful when you are using nodeSelector to make sure certain pods land on certain nodes. Note - // that this won't cause the autoscaler to select bigger nodes vs. smaller, as it can add multiple smaller - // nodes at once. - ExpanderMostPods Expander = "most-pods" - // ExpanderPriority Selects the node group that has the highest priority assigned by the user. It's - // configuration is described in more details - // [here](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/expander/priority/readme.md). - ExpanderPriority Expander = "priority" - // ExpanderRandom Used when you don't have a particular need for the node groups to scale differently. - ExpanderRandom Expander = "random" -) - -// PossibleExpanderValues returns an array of possible values for the Expander const type. -func PossibleExpanderValues() []Expander { - return []Expander{ExpanderLeastWaste, ExpanderMostPods, ExpanderPriority, ExpanderRandom} -} - -// ExtendedLocationTypes enumerates the values for extended location types. -type ExtendedLocationTypes string - -const ( - // ExtendedLocationTypesEdgeZone ... - ExtendedLocationTypesEdgeZone ExtendedLocationTypes = "EdgeZone" -) - -// PossibleExtendedLocationTypesValues returns an array of possible values for the ExtendedLocationTypes const type. -func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { - return []ExtendedLocationTypes{ExtendedLocationTypesEdgeZone} -} - -// Format enumerates the values for format. -type Format string - -const ( - // FormatAzure Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully - // removed in 1.25. - FormatAzure Format = "azure" - // FormatExec Return exec format kubeconfig. This format requires kubelogin binary in the path. - FormatExec Format = "exec" -) - -// PossibleFormatValues returns an array of possible values for the Format const type. -func PossibleFormatValues() []Format { - return []Format{FormatAzure, FormatExec} -} - -// GPUInstanceProfile enumerates the values for gpu instance profile. -type GPUInstanceProfile string - -const ( - // GPUInstanceProfileMIG1g ... - GPUInstanceProfileMIG1g GPUInstanceProfile = "MIG1g" - // GPUInstanceProfileMIG2g ... - GPUInstanceProfileMIG2g GPUInstanceProfile = "MIG2g" - // GPUInstanceProfileMIG3g ... - GPUInstanceProfileMIG3g GPUInstanceProfile = "MIG3g" - // GPUInstanceProfileMIG4g ... - GPUInstanceProfileMIG4g GPUInstanceProfile = "MIG4g" - // GPUInstanceProfileMIG7g ... - GPUInstanceProfileMIG7g GPUInstanceProfile = "MIG7g" -) - -// PossibleGPUInstanceProfileValues returns an array of possible values for the GPUInstanceProfile const type. -func PossibleGPUInstanceProfileValues() []GPUInstanceProfile { - return []GPUInstanceProfile{GPUInstanceProfileMIG1g, GPUInstanceProfileMIG2g, GPUInstanceProfileMIG3g, GPUInstanceProfileMIG4g, GPUInstanceProfileMIG7g} -} - -// IPFamily enumerates the values for ip family. -type IPFamily string - -const ( - // IPFamilyIPv4 ... - IPFamilyIPv4 IPFamily = "IPv4" - // IPFamilyIPv6 ... - IPFamilyIPv6 IPFamily = "IPv6" -) - -// PossibleIPFamilyValues returns an array of possible values for the IPFamily const type. -func PossibleIPFamilyValues() []IPFamily { - return []IPFamily{IPFamilyIPv4, IPFamilyIPv6} -} - -// KubeletDiskType enumerates the values for kubelet disk type. -type KubeletDiskType string - -const ( - // KubeletDiskTypeOS Kubelet will use the OS disk for its data. - KubeletDiskTypeOS KubeletDiskType = "OS" - // KubeletDiskTypeTemporary Kubelet will use the temporary disk for its data. - KubeletDiskTypeTemporary KubeletDiskType = "Temporary" -) - -// PossibleKubeletDiskTypeValues returns an array of possible values for the KubeletDiskType const type. -func PossibleKubeletDiskTypeValues() []KubeletDiskType { - return []KubeletDiskType{KubeletDiskTypeOS, KubeletDiskTypeTemporary} -} - -// LicenseType enumerates the values for license type. -type LicenseType string - -const ( - // LicenseTypeNone No additional licensing is applied. - LicenseTypeNone LicenseType = "None" - // LicenseTypeWindowsServer Enables Azure Hybrid User Benefits for Windows VMs. - LicenseTypeWindowsServer LicenseType = "Windows_Server" -) - -// PossibleLicenseTypeValues returns an array of possible values for the LicenseType const type. -func PossibleLicenseTypeValues() []LicenseType { - return []LicenseType{LicenseTypeNone, LicenseTypeWindowsServer} -} - -// LoadBalancerSku enumerates the values for load balancer sku. -type LoadBalancerSku string - -const ( - // LoadBalancerSkuBasic Use a basic Load Balancer with limited functionality. - LoadBalancerSkuBasic LoadBalancerSku = "basic" - // LoadBalancerSkuStandard Use a a standard Load Balancer. This is the recommended Load Balancer SKU. For - // more information about on working with the load balancer in the managed cluster, see the [standard Load - // Balancer](https://docs.microsoft.com/azure/aks/load-balancer-standard) article. - LoadBalancerSkuStandard LoadBalancerSku = "standard" -) - -// PossibleLoadBalancerSkuValues returns an array of possible values for the LoadBalancerSku const type. -func PossibleLoadBalancerSkuValues() []LoadBalancerSku { - return []LoadBalancerSku{LoadBalancerSkuBasic, LoadBalancerSkuStandard} -} - -// ManagedClusterPodIdentityProvisioningState enumerates the values for managed cluster pod identity -// provisioning state. -type ManagedClusterPodIdentityProvisioningState string - -const ( - // ManagedClusterPodIdentityProvisioningStateAssigned ... - ManagedClusterPodIdentityProvisioningStateAssigned ManagedClusterPodIdentityProvisioningState = "Assigned" - // ManagedClusterPodIdentityProvisioningStateDeleting ... - ManagedClusterPodIdentityProvisioningStateDeleting ManagedClusterPodIdentityProvisioningState = "Deleting" - // ManagedClusterPodIdentityProvisioningStateFailed ... - ManagedClusterPodIdentityProvisioningStateFailed ManagedClusterPodIdentityProvisioningState = "Failed" - // ManagedClusterPodIdentityProvisioningStateUpdating ... - ManagedClusterPodIdentityProvisioningStateUpdating ManagedClusterPodIdentityProvisioningState = "Updating" -) - -// PossibleManagedClusterPodIdentityProvisioningStateValues returns an array of possible values for the ManagedClusterPodIdentityProvisioningState const type. -func PossibleManagedClusterPodIdentityProvisioningStateValues() []ManagedClusterPodIdentityProvisioningState { - return []ManagedClusterPodIdentityProvisioningState{ManagedClusterPodIdentityProvisioningStateAssigned, ManagedClusterPodIdentityProvisioningStateDeleting, ManagedClusterPodIdentityProvisioningStateFailed, ManagedClusterPodIdentityProvisioningStateUpdating} -} - -// ManagedClusterSKUName enumerates the values for managed cluster sku name. -type ManagedClusterSKUName string - -const ( - // ManagedClusterSKUNameBasic ... - ManagedClusterSKUNameBasic ManagedClusterSKUName = "Basic" -) - -// PossibleManagedClusterSKUNameValues returns an array of possible values for the ManagedClusterSKUName const type. -func PossibleManagedClusterSKUNameValues() []ManagedClusterSKUName { - return []ManagedClusterSKUName{ManagedClusterSKUNameBasic} -} - -// ManagedClusterSKUTier enumerates the values for managed cluster sku tier. -type ManagedClusterSKUTier string - -const ( - // ManagedClusterSKUTierFree No guaranteed SLA, no additional charges. Free tier clusters have an SLO of - // 99.5%. - ManagedClusterSKUTierFree ManagedClusterSKUTier = "Free" - // ManagedClusterSKUTierPaid Guarantees 99.95% availability of the Kubernetes API server endpoint for - // clusters that use Availability Zones and 99.9% of availability for clusters that don't use Availability - // Zones. - ManagedClusterSKUTierPaid ManagedClusterSKUTier = "Paid" -) - -// PossibleManagedClusterSKUTierValues returns an array of possible values for the ManagedClusterSKUTier const type. -func PossibleManagedClusterSKUTierValues() []ManagedClusterSKUTier { - return []ManagedClusterSKUTier{ManagedClusterSKUTierFree, ManagedClusterSKUTierPaid} -} - -// NetworkMode enumerates the values for network mode. -type NetworkMode string - -const ( - // NetworkModeBridge This is no longer supported - NetworkModeBridge NetworkMode = "bridge" - // NetworkModeTransparent No bridge is created. Intra-VM Pod to Pod communication is through IP routes - // created by Azure CNI. See [Transparent Mode](https://docs.microsoft.com/azure/aks/faq#transparent-mode) - // for more information. - NetworkModeTransparent NetworkMode = "transparent" -) - -// PossibleNetworkModeValues returns an array of possible values for the NetworkMode const type. -func PossibleNetworkModeValues() []NetworkMode { - return []NetworkMode{NetworkModeBridge, NetworkModeTransparent} -} - -// NetworkPlugin enumerates the values for network plugin. -type NetworkPlugin string - -const ( - // NetworkPluginAzure Use the Azure CNI network plugin. See [Azure CNI (advanced) - // networking](https://docs.microsoft.com/azure/aks/concepts-network#azure-cni-advanced-networking) for - // more information. - NetworkPluginAzure NetworkPlugin = "azure" - // NetworkPluginKubenet Use the Kubenet network plugin. See [Kubenet (basic) - // networking](https://docs.microsoft.com/azure/aks/concepts-network#kubenet-basic-networking) for more - // information. - NetworkPluginKubenet NetworkPlugin = "kubenet" - // NetworkPluginNone Do not use a network plugin. A custom CNI will need to be installed after cluster - // creation for networking functionality. - NetworkPluginNone NetworkPlugin = "none" -) - -// PossibleNetworkPluginValues returns an array of possible values for the NetworkPlugin const type. -func PossibleNetworkPluginValues() []NetworkPlugin { - return []NetworkPlugin{NetworkPluginAzure, NetworkPluginKubenet, NetworkPluginNone} -} - -// NetworkPolicy enumerates the values for network policy. -type NetworkPolicy string - -const ( - // NetworkPolicyAzure Use Azure network policies. See [differences between Azure and Calico - // policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) - // for more information. - NetworkPolicyAzure NetworkPolicy = "azure" - // NetworkPolicyCalico Use Calico network policies. See [differences between Azure and Calico - // policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) - // for more information. - NetworkPolicyCalico NetworkPolicy = "calico" -) - -// PossibleNetworkPolicyValues returns an array of possible values for the NetworkPolicy const type. -func PossibleNetworkPolicyValues() []NetworkPolicy { - return []NetworkPolicy{NetworkPolicyAzure, NetworkPolicyCalico} -} - -// OSDiskType enumerates the values for os disk type. -type OSDiskType string - -const ( - // OSDiskTypeEphemeral Ephemeral OS disks are stored only on the host machine, just like a temporary disk. - // This provides lower read/write latency, along with faster node scaling and cluster upgrades. - OSDiskTypeEphemeral OSDiskType = "Ephemeral" - // OSDiskTypeManaged Azure replicates the operating system disk for a virtual machine to Azure storage to - // avoid data loss should the VM need to be relocated to another host. Since containers aren't designed to - // have local state persisted, this behavior offers limited value while providing some drawbacks, including - // slower node provisioning and higher read/write latency. - OSDiskTypeManaged OSDiskType = "Managed" -) - -// PossibleOSDiskTypeValues returns an array of possible values for the OSDiskType const type. -func PossibleOSDiskTypeValues() []OSDiskType { - return []OSDiskType{OSDiskTypeEphemeral, OSDiskTypeManaged} -} - -// OSSKU enumerates the values for ossku. -type OSSKU string - -const ( - // OSSKUCBLMariner ... - OSSKUCBLMariner OSSKU = "CBLMariner" - // OSSKUUbuntu ... - OSSKUUbuntu OSSKU = "Ubuntu" -) - -// PossibleOSSKUValues returns an array of possible values for the OSSKU const type. -func PossibleOSSKUValues() []OSSKU { - return []OSSKU{OSSKUCBLMariner, OSSKUUbuntu} -} - -// OSType enumerates the values for os type. -type OSType string - -const ( - // OSTypeLinux Use Linux. - OSTypeLinux OSType = "Linux" - // OSTypeWindows Use Windows. - OSTypeWindows OSType = "Windows" -) - -// PossibleOSTypeValues returns an array of possible values for the OSType const type. -func PossibleOSTypeValues() []OSType { - return []OSType{OSTypeLinux, OSTypeWindows} -} - -// OutboundType enumerates the values for outbound type. -type OutboundType string - -const ( - // OutboundTypeLoadBalancer The load balancer is used for egress through an AKS assigned public IP. This - // supports Kubernetes services of type 'loadBalancer'. For more information see [outbound type - // loadbalancer](https://docs.microsoft.com/azure/aks/egress-outboundtype#outbound-type-of-loadbalancer). - OutboundTypeLoadBalancer OutboundType = "loadBalancer" - // OutboundTypeManagedNATGateway The AKS-managed NAT gateway is used for egress. - OutboundTypeManagedNATGateway OutboundType = "managedNATGateway" - // OutboundTypeUserAssignedNATGateway The user-assigned NAT gateway associated to the cluster subnet is - // used for egress. This is an advanced scenario and requires proper network configuration. - OutboundTypeUserAssignedNATGateway OutboundType = "userAssignedNATGateway" - // OutboundTypeUserDefinedRouting Egress paths must be defined by the user. This is an advanced scenario - // and requires proper network configuration. For more information see [outbound type - // userDefinedRouting](https://docs.microsoft.com/azure/aks/egress-outboundtype#outbound-type-of-userdefinedrouting). - OutboundTypeUserDefinedRouting OutboundType = "userDefinedRouting" -) - -// PossibleOutboundTypeValues returns an array of possible values for the OutboundType const type. -func PossibleOutboundTypeValues() []OutboundType { - return []OutboundType{OutboundTypeLoadBalancer, OutboundTypeManagedNATGateway, OutboundTypeUserAssignedNATGateway, OutboundTypeUserDefinedRouting} -} - -// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection -// provisioning state. -type PrivateEndpointConnectionProvisioningState string - -const ( - // PrivateEndpointConnectionProvisioningStateCreating ... - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - // PrivateEndpointConnectionProvisioningStateDeleting ... - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - // PrivateEndpointConnectionProvisioningStateFailed ... - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - // PrivateEndpointConnectionProvisioningStateSucceeded ... - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" -) - -// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. -func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { - return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // PublicNetworkAccessDisabled ... - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - // PublicNetworkAccessEnabled ... - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeNone Do not use a managed identity for the Managed Cluster, service principal will - // be used instead. - ResourceIdentityTypeNone ResourceIdentityType = "None" - // ResourceIdentityTypeSystemAssigned Use an implicitly created system assigned managed identity to manage - // cluster resources. Master components in the control plane such as kube-controller-manager will use the - // system assigned managed identity to manipulate Azure resources. - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - // ResourceIdentityTypeUserAssigned Use a user-specified identity to manage cluster resources. Master - // components in the control plane such as kube-controller-manager will use the specified user assigned - // managed identity to manipulate Azure resources. - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeUserAssigned} -} - -// ScaleDownMode enumerates the values for scale down mode. -type ScaleDownMode string - -const ( - // ScaleDownModeDeallocate Attempt to start deallocated instances (if they exist) during scale up and - // deallocate instances during scale down. - ScaleDownModeDeallocate ScaleDownMode = "Deallocate" - // ScaleDownModeDelete Create new instances during scale up and remove instances during scale down. - ScaleDownModeDelete ScaleDownMode = "Delete" -) - -// PossibleScaleDownModeValues returns an array of possible values for the ScaleDownMode const type. -func PossibleScaleDownModeValues() []ScaleDownMode { - return []ScaleDownMode{ScaleDownModeDeallocate, ScaleDownModeDelete} -} - -// ScaleSetEvictionPolicy enumerates the values for scale set eviction policy. -type ScaleSetEvictionPolicy string - -const ( - // ScaleSetEvictionPolicyDeallocate Nodes in the underlying Scale Set of the node pool are set to the - // stopped-deallocated state upon eviction. Nodes in the stopped-deallocated state count against your - // compute quota and can cause issues with cluster scaling or upgrading. - ScaleSetEvictionPolicyDeallocate ScaleSetEvictionPolicy = "Deallocate" - // ScaleSetEvictionPolicyDelete Nodes in the underlying Scale Set of the node pool are deleted when they're - // evicted. - ScaleSetEvictionPolicyDelete ScaleSetEvictionPolicy = "Delete" -) - -// PossibleScaleSetEvictionPolicyValues returns an array of possible values for the ScaleSetEvictionPolicy const type. -func PossibleScaleSetEvictionPolicyValues() []ScaleSetEvictionPolicy { - return []ScaleSetEvictionPolicy{ScaleSetEvictionPolicyDeallocate, ScaleSetEvictionPolicyDelete} -} - -// ScaleSetPriority enumerates the values for scale set priority. -type ScaleSetPriority string - -const ( - // ScaleSetPriorityRegular Regular VMs will be used. - ScaleSetPriorityRegular ScaleSetPriority = "Regular" - // ScaleSetPrioritySpot Spot priority VMs will be used. There is no SLA for spot nodes. See [spot on - // AKS](https://docs.microsoft.com/azure/aks/spot-node-pool) for more information. - ScaleSetPrioritySpot ScaleSetPriority = "Spot" -) - -// PossibleScaleSetPriorityValues returns an array of possible values for the ScaleSetPriority const type. -func PossibleScaleSetPriorityValues() []ScaleSetPriority { - return []ScaleSetPriority{ScaleSetPriorityRegular, ScaleSetPrioritySpot} -} - -// SnapshotType enumerates the values for snapshot type. -type SnapshotType string - -const ( - // SnapshotTypeNodePool The snapshot is a snapshot of a node pool. - SnapshotTypeNodePool SnapshotType = "NodePool" -) - -// PossibleSnapshotTypeValues returns an array of possible values for the SnapshotType const type. -func PossibleSnapshotTypeValues() []SnapshotType { - return []SnapshotType{SnapshotTypeNodePool} -} - -// StorageProfileTypes enumerates the values for storage profile types. -type StorageProfileTypes string - -const ( - // StorageProfileTypesManagedDisks ... - StorageProfileTypesManagedDisks StorageProfileTypes = "ManagedDisks" - // StorageProfileTypesStorageAccount ... - StorageProfileTypesStorageAccount StorageProfileTypes = "StorageAccount" -) - -// PossibleStorageProfileTypesValues returns an array of possible values for the StorageProfileTypes const type. -func PossibleStorageProfileTypesValues() []StorageProfileTypes { - return []StorageProfileTypes{StorageProfileTypesManagedDisks, StorageProfileTypesStorageAccount} -} - -// UpgradeChannel enumerates the values for upgrade channel. -type UpgradeChannel string - -const ( - // UpgradeChannelNodeImage Automatically upgrade the node image to the latest version available. Microsoft - // provides patches and new images for image nodes frequently (usually weekly), but your running nodes - // won't get the new images unless you do a node image upgrade. Turning on the node-image channel will - // automatically update your node images whenever a new version is available. - UpgradeChannelNodeImage UpgradeChannel = "node-image" - // UpgradeChannelNone Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. - UpgradeChannelNone UpgradeChannel = "none" - // UpgradeChannelPatch Automatically upgrade the cluster to the latest supported patch version when it - // becomes available while keeping the minor version the same. For example, if a cluster is running version - // 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded to - // 1.17.9. - UpgradeChannelPatch UpgradeChannel = "patch" - // UpgradeChannelRapid Automatically upgrade the cluster to the latest supported patch release on the - // latest supported minor version. In cases where the cluster is at a version of Kubernetes that is at an - // N-2 minor version where N is the latest supported minor version, the cluster first upgrades to the - // latest supported patch version on N-1 minor version. For example, if a cluster is running version 1.17.7 - // and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster first is upgraded to 1.18.6, - // then is upgraded to 1.19.1. - UpgradeChannelRapid UpgradeChannel = "rapid" - // UpgradeChannelStable Automatically upgrade the cluster to the latest supported patch release on minor - // version N-1, where N is the latest supported minor version. For example, if a cluster is running version - // 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded to - // 1.18.6. - UpgradeChannelStable UpgradeChannel = "stable" -) - -// PossibleUpgradeChannelValues returns an array of possible values for the UpgradeChannel const type. -func PossibleUpgradeChannelValues() []UpgradeChannel { - return []UpgradeChannel{UpgradeChannelNodeImage, UpgradeChannelNone, UpgradeChannelPatch, UpgradeChannelRapid, UpgradeChannelStable} -} - -// VMSizeTypes enumerates the values for vm size types. -type VMSizeTypes string - -const ( - // VMSizeTypesStandardA1 ... - VMSizeTypesStandardA1 VMSizeTypes = "Standard_A1" - // VMSizeTypesStandardA10 ... - VMSizeTypesStandardA10 VMSizeTypes = "Standard_A10" - // VMSizeTypesStandardA11 ... - VMSizeTypesStandardA11 VMSizeTypes = "Standard_A11" - // VMSizeTypesStandardA1V2 ... - VMSizeTypesStandardA1V2 VMSizeTypes = "Standard_A1_v2" - // VMSizeTypesStandardA2 ... - VMSizeTypesStandardA2 VMSizeTypes = "Standard_A2" - // VMSizeTypesStandardA2mV2 ... - VMSizeTypesStandardA2mV2 VMSizeTypes = "Standard_A2m_v2" - // VMSizeTypesStandardA2V2 ... - VMSizeTypesStandardA2V2 VMSizeTypes = "Standard_A2_v2" - // VMSizeTypesStandardA3 ... - VMSizeTypesStandardA3 VMSizeTypes = "Standard_A3" - // VMSizeTypesStandardA4 ... - VMSizeTypesStandardA4 VMSizeTypes = "Standard_A4" - // VMSizeTypesStandardA4mV2 ... - VMSizeTypesStandardA4mV2 VMSizeTypes = "Standard_A4m_v2" - // VMSizeTypesStandardA4V2 ... - VMSizeTypesStandardA4V2 VMSizeTypes = "Standard_A4_v2" - // VMSizeTypesStandardA5 ... - VMSizeTypesStandardA5 VMSizeTypes = "Standard_A5" - // VMSizeTypesStandardA6 ... - VMSizeTypesStandardA6 VMSizeTypes = "Standard_A6" - // VMSizeTypesStandardA7 ... - VMSizeTypesStandardA7 VMSizeTypes = "Standard_A7" - // VMSizeTypesStandardA8 ... - VMSizeTypesStandardA8 VMSizeTypes = "Standard_A8" - // VMSizeTypesStandardA8mV2 ... - VMSizeTypesStandardA8mV2 VMSizeTypes = "Standard_A8m_v2" - // VMSizeTypesStandardA8V2 ... - VMSizeTypesStandardA8V2 VMSizeTypes = "Standard_A8_v2" - // VMSizeTypesStandardA9 ... - VMSizeTypesStandardA9 VMSizeTypes = "Standard_A9" - // VMSizeTypesStandardB2ms ... - VMSizeTypesStandardB2ms VMSizeTypes = "Standard_B2ms" - // VMSizeTypesStandardB2s ... - VMSizeTypesStandardB2s VMSizeTypes = "Standard_B2s" - // VMSizeTypesStandardB4ms ... - VMSizeTypesStandardB4ms VMSizeTypes = "Standard_B4ms" - // VMSizeTypesStandardB8ms ... - VMSizeTypesStandardB8ms VMSizeTypes = "Standard_B8ms" - // VMSizeTypesStandardD1 ... - VMSizeTypesStandardD1 VMSizeTypes = "Standard_D1" - // VMSizeTypesStandardD11 ... - VMSizeTypesStandardD11 VMSizeTypes = "Standard_D11" - // VMSizeTypesStandardD11V2 ... - VMSizeTypesStandardD11V2 VMSizeTypes = "Standard_D11_v2" - // VMSizeTypesStandardD11V2Promo ... - VMSizeTypesStandardD11V2Promo VMSizeTypes = "Standard_D11_v2_Promo" - // VMSizeTypesStandardD12 ... - VMSizeTypesStandardD12 VMSizeTypes = "Standard_D12" - // VMSizeTypesStandardD12V2 ... - VMSizeTypesStandardD12V2 VMSizeTypes = "Standard_D12_v2" - // VMSizeTypesStandardD12V2Promo ... - VMSizeTypesStandardD12V2Promo VMSizeTypes = "Standard_D12_v2_Promo" - // VMSizeTypesStandardD13 ... - VMSizeTypesStandardD13 VMSizeTypes = "Standard_D13" - // VMSizeTypesStandardD13V2 ... - VMSizeTypesStandardD13V2 VMSizeTypes = "Standard_D13_v2" - // VMSizeTypesStandardD13V2Promo ... - VMSizeTypesStandardD13V2Promo VMSizeTypes = "Standard_D13_v2_Promo" - // VMSizeTypesStandardD14 ... - VMSizeTypesStandardD14 VMSizeTypes = "Standard_D14" - // VMSizeTypesStandardD14V2 ... - VMSizeTypesStandardD14V2 VMSizeTypes = "Standard_D14_v2" - // VMSizeTypesStandardD14V2Promo ... - VMSizeTypesStandardD14V2Promo VMSizeTypes = "Standard_D14_v2_Promo" - // VMSizeTypesStandardD15V2 ... - VMSizeTypesStandardD15V2 VMSizeTypes = "Standard_D15_v2" - // VMSizeTypesStandardD16sV3 ... - VMSizeTypesStandardD16sV3 VMSizeTypes = "Standard_D16s_v3" - // VMSizeTypesStandardD16V3 ... - VMSizeTypesStandardD16V3 VMSizeTypes = "Standard_D16_v3" - // VMSizeTypesStandardD1V2 ... - VMSizeTypesStandardD1V2 VMSizeTypes = "Standard_D1_v2" - // VMSizeTypesStandardD2 ... - VMSizeTypesStandardD2 VMSizeTypes = "Standard_D2" - // VMSizeTypesStandardD2sV3 ... - VMSizeTypesStandardD2sV3 VMSizeTypes = "Standard_D2s_v3" - // VMSizeTypesStandardD2V2 ... - VMSizeTypesStandardD2V2 VMSizeTypes = "Standard_D2_v2" - // VMSizeTypesStandardD2V2Promo ... - VMSizeTypesStandardD2V2Promo VMSizeTypes = "Standard_D2_v2_Promo" - // VMSizeTypesStandardD2V3 ... - VMSizeTypesStandardD2V3 VMSizeTypes = "Standard_D2_v3" - // VMSizeTypesStandardD3 ... - VMSizeTypesStandardD3 VMSizeTypes = "Standard_D3" - // VMSizeTypesStandardD32sV3 ... - VMSizeTypesStandardD32sV3 VMSizeTypes = "Standard_D32s_v3" - // VMSizeTypesStandardD32V3 ... - VMSizeTypesStandardD32V3 VMSizeTypes = "Standard_D32_v3" - // VMSizeTypesStandardD3V2 ... - VMSizeTypesStandardD3V2 VMSizeTypes = "Standard_D3_v2" - // VMSizeTypesStandardD3V2Promo ... - VMSizeTypesStandardD3V2Promo VMSizeTypes = "Standard_D3_v2_Promo" - // VMSizeTypesStandardD4 ... - VMSizeTypesStandardD4 VMSizeTypes = "Standard_D4" - // VMSizeTypesStandardD4sV3 ... - VMSizeTypesStandardD4sV3 VMSizeTypes = "Standard_D4s_v3" - // VMSizeTypesStandardD4V2 ... - VMSizeTypesStandardD4V2 VMSizeTypes = "Standard_D4_v2" - // VMSizeTypesStandardD4V2Promo ... - VMSizeTypesStandardD4V2Promo VMSizeTypes = "Standard_D4_v2_Promo" - // VMSizeTypesStandardD4V3 ... - VMSizeTypesStandardD4V3 VMSizeTypes = "Standard_D4_v3" - // VMSizeTypesStandardD5V2 ... - VMSizeTypesStandardD5V2 VMSizeTypes = "Standard_D5_v2" - // VMSizeTypesStandardD5V2Promo ... - VMSizeTypesStandardD5V2Promo VMSizeTypes = "Standard_D5_v2_Promo" - // VMSizeTypesStandardD64sV3 ... - VMSizeTypesStandardD64sV3 VMSizeTypes = "Standard_D64s_v3" - // VMSizeTypesStandardD64V3 ... - VMSizeTypesStandardD64V3 VMSizeTypes = "Standard_D64_v3" - // VMSizeTypesStandardD8sV3 ... - VMSizeTypesStandardD8sV3 VMSizeTypes = "Standard_D8s_v3" - // VMSizeTypesStandardD8V3 ... - VMSizeTypesStandardD8V3 VMSizeTypes = "Standard_D8_v3" - // VMSizeTypesStandardDS1 ... - VMSizeTypesStandardDS1 VMSizeTypes = "Standard_DS1" - // VMSizeTypesStandardDS11 ... - VMSizeTypesStandardDS11 VMSizeTypes = "Standard_DS11" - // VMSizeTypesStandardDS11V2 ... - VMSizeTypesStandardDS11V2 VMSizeTypes = "Standard_DS11_v2" - // VMSizeTypesStandardDS11V2Promo ... - VMSizeTypesStandardDS11V2Promo VMSizeTypes = "Standard_DS11_v2_Promo" - // VMSizeTypesStandardDS12 ... - VMSizeTypesStandardDS12 VMSizeTypes = "Standard_DS12" - // VMSizeTypesStandardDS12V2 ... - VMSizeTypesStandardDS12V2 VMSizeTypes = "Standard_DS12_v2" - // VMSizeTypesStandardDS12V2Promo ... - VMSizeTypesStandardDS12V2Promo VMSizeTypes = "Standard_DS12_v2_Promo" - // VMSizeTypesStandardDS13 ... - VMSizeTypesStandardDS13 VMSizeTypes = "Standard_DS13" - // VMSizeTypesStandardDS132V2 ... - VMSizeTypesStandardDS132V2 VMSizeTypes = "Standard_DS13-2_v2" - // VMSizeTypesStandardDS134V2 ... - VMSizeTypesStandardDS134V2 VMSizeTypes = "Standard_DS13-4_v2" - // VMSizeTypesStandardDS13V2 ... - VMSizeTypesStandardDS13V2 VMSizeTypes = "Standard_DS13_v2" - // VMSizeTypesStandardDS13V2Promo ... - VMSizeTypesStandardDS13V2Promo VMSizeTypes = "Standard_DS13_v2_Promo" - // VMSizeTypesStandardDS14 ... - VMSizeTypesStandardDS14 VMSizeTypes = "Standard_DS14" - // VMSizeTypesStandardDS144V2 ... - VMSizeTypesStandardDS144V2 VMSizeTypes = "Standard_DS14-4_v2" - // VMSizeTypesStandardDS148V2 ... - VMSizeTypesStandardDS148V2 VMSizeTypes = "Standard_DS14-8_v2" - // VMSizeTypesStandardDS14V2 ... - VMSizeTypesStandardDS14V2 VMSizeTypes = "Standard_DS14_v2" - // VMSizeTypesStandardDS14V2Promo ... - VMSizeTypesStandardDS14V2Promo VMSizeTypes = "Standard_DS14_v2_Promo" - // VMSizeTypesStandardDS15V2 ... - VMSizeTypesStandardDS15V2 VMSizeTypes = "Standard_DS15_v2" - // VMSizeTypesStandardDS1V2 ... - VMSizeTypesStandardDS1V2 VMSizeTypes = "Standard_DS1_v2" - // VMSizeTypesStandardDS2 ... - VMSizeTypesStandardDS2 VMSizeTypes = "Standard_DS2" - // VMSizeTypesStandardDS2V2 ... - VMSizeTypesStandardDS2V2 VMSizeTypes = "Standard_DS2_v2" - // VMSizeTypesStandardDS2V2Promo ... - VMSizeTypesStandardDS2V2Promo VMSizeTypes = "Standard_DS2_v2_Promo" - // VMSizeTypesStandardDS3 ... - VMSizeTypesStandardDS3 VMSizeTypes = "Standard_DS3" - // VMSizeTypesStandardDS3V2 ... - VMSizeTypesStandardDS3V2 VMSizeTypes = "Standard_DS3_v2" - // VMSizeTypesStandardDS3V2Promo ... - VMSizeTypesStandardDS3V2Promo VMSizeTypes = "Standard_DS3_v2_Promo" - // VMSizeTypesStandardDS4 ... - VMSizeTypesStandardDS4 VMSizeTypes = "Standard_DS4" - // VMSizeTypesStandardDS4V2 ... - VMSizeTypesStandardDS4V2 VMSizeTypes = "Standard_DS4_v2" - // VMSizeTypesStandardDS4V2Promo ... - VMSizeTypesStandardDS4V2Promo VMSizeTypes = "Standard_DS4_v2_Promo" - // VMSizeTypesStandardDS5V2 ... - VMSizeTypesStandardDS5V2 VMSizeTypes = "Standard_DS5_v2" - // VMSizeTypesStandardDS5V2Promo ... - VMSizeTypesStandardDS5V2Promo VMSizeTypes = "Standard_DS5_v2_Promo" - // VMSizeTypesStandardE16sV3 ... - VMSizeTypesStandardE16sV3 VMSizeTypes = "Standard_E16s_v3" - // VMSizeTypesStandardE16V3 ... - VMSizeTypesStandardE16V3 VMSizeTypes = "Standard_E16_v3" - // VMSizeTypesStandardE2sV3 ... - VMSizeTypesStandardE2sV3 VMSizeTypes = "Standard_E2s_v3" - // VMSizeTypesStandardE2V3 ... - VMSizeTypesStandardE2V3 VMSizeTypes = "Standard_E2_v3" - // VMSizeTypesStandardE3216sV3 ... - VMSizeTypesStandardE3216sV3 VMSizeTypes = "Standard_E32-16s_v3" - // VMSizeTypesStandardE328sV3 ... - VMSizeTypesStandardE328sV3 VMSizeTypes = "Standard_E32-8s_v3" - // VMSizeTypesStandardE32sV3 ... - VMSizeTypesStandardE32sV3 VMSizeTypes = "Standard_E32s_v3" - // VMSizeTypesStandardE32V3 ... - VMSizeTypesStandardE32V3 VMSizeTypes = "Standard_E32_v3" - // VMSizeTypesStandardE4sV3 ... - VMSizeTypesStandardE4sV3 VMSizeTypes = "Standard_E4s_v3" - // VMSizeTypesStandardE4V3 ... - VMSizeTypesStandardE4V3 VMSizeTypes = "Standard_E4_v3" - // VMSizeTypesStandardE6416sV3 ... - VMSizeTypesStandardE6416sV3 VMSizeTypes = "Standard_E64-16s_v3" - // VMSizeTypesStandardE6432sV3 ... - VMSizeTypesStandardE6432sV3 VMSizeTypes = "Standard_E64-32s_v3" - // VMSizeTypesStandardE64sV3 ... - VMSizeTypesStandardE64sV3 VMSizeTypes = "Standard_E64s_v3" - // VMSizeTypesStandardE64V3 ... - VMSizeTypesStandardE64V3 VMSizeTypes = "Standard_E64_v3" - // VMSizeTypesStandardE8sV3 ... - VMSizeTypesStandardE8sV3 VMSizeTypes = "Standard_E8s_v3" - // VMSizeTypesStandardE8V3 ... - VMSizeTypesStandardE8V3 VMSizeTypes = "Standard_E8_v3" - // VMSizeTypesStandardF1 ... - VMSizeTypesStandardF1 VMSizeTypes = "Standard_F1" - // VMSizeTypesStandardF16 ... - VMSizeTypesStandardF16 VMSizeTypes = "Standard_F16" - // VMSizeTypesStandardF16s ... - VMSizeTypesStandardF16s VMSizeTypes = "Standard_F16s" - // VMSizeTypesStandardF16sV2 ... - VMSizeTypesStandardF16sV2 VMSizeTypes = "Standard_F16s_v2" - // VMSizeTypesStandardF1s ... - VMSizeTypesStandardF1s VMSizeTypes = "Standard_F1s" - // VMSizeTypesStandardF2 ... - VMSizeTypesStandardF2 VMSizeTypes = "Standard_F2" - // VMSizeTypesStandardF2s ... - VMSizeTypesStandardF2s VMSizeTypes = "Standard_F2s" - // VMSizeTypesStandardF2sV2 ... - VMSizeTypesStandardF2sV2 VMSizeTypes = "Standard_F2s_v2" - // VMSizeTypesStandardF32sV2 ... - VMSizeTypesStandardF32sV2 VMSizeTypes = "Standard_F32s_v2" - // VMSizeTypesStandardF4 ... - VMSizeTypesStandardF4 VMSizeTypes = "Standard_F4" - // VMSizeTypesStandardF4s ... - VMSizeTypesStandardF4s VMSizeTypes = "Standard_F4s" - // VMSizeTypesStandardF4sV2 ... - VMSizeTypesStandardF4sV2 VMSizeTypes = "Standard_F4s_v2" - // VMSizeTypesStandardF64sV2 ... - VMSizeTypesStandardF64sV2 VMSizeTypes = "Standard_F64s_v2" - // VMSizeTypesStandardF72sV2 ... - VMSizeTypesStandardF72sV2 VMSizeTypes = "Standard_F72s_v2" - // VMSizeTypesStandardF8 ... - VMSizeTypesStandardF8 VMSizeTypes = "Standard_F8" - // VMSizeTypesStandardF8s ... - VMSizeTypesStandardF8s VMSizeTypes = "Standard_F8s" - // VMSizeTypesStandardF8sV2 ... - VMSizeTypesStandardF8sV2 VMSizeTypes = "Standard_F8s_v2" - // VMSizeTypesStandardG1 ... - VMSizeTypesStandardG1 VMSizeTypes = "Standard_G1" - // VMSizeTypesStandardG2 ... - VMSizeTypesStandardG2 VMSizeTypes = "Standard_G2" - // VMSizeTypesStandardG3 ... - VMSizeTypesStandardG3 VMSizeTypes = "Standard_G3" - // VMSizeTypesStandardG4 ... - VMSizeTypesStandardG4 VMSizeTypes = "Standard_G4" - // VMSizeTypesStandardG5 ... - VMSizeTypesStandardG5 VMSizeTypes = "Standard_G5" - // VMSizeTypesStandardGS1 ... - VMSizeTypesStandardGS1 VMSizeTypes = "Standard_GS1" - // VMSizeTypesStandardGS2 ... - VMSizeTypesStandardGS2 VMSizeTypes = "Standard_GS2" - // VMSizeTypesStandardGS3 ... - VMSizeTypesStandardGS3 VMSizeTypes = "Standard_GS3" - // VMSizeTypesStandardGS4 ... - VMSizeTypesStandardGS4 VMSizeTypes = "Standard_GS4" - // VMSizeTypesStandardGS44 ... - VMSizeTypesStandardGS44 VMSizeTypes = "Standard_GS4-4" - // VMSizeTypesStandardGS48 ... - VMSizeTypesStandardGS48 VMSizeTypes = "Standard_GS4-8" - // VMSizeTypesStandardGS5 ... - VMSizeTypesStandardGS5 VMSizeTypes = "Standard_GS5" - // VMSizeTypesStandardGS516 ... - VMSizeTypesStandardGS516 VMSizeTypes = "Standard_GS5-16" - // VMSizeTypesStandardGS58 ... - VMSizeTypesStandardGS58 VMSizeTypes = "Standard_GS5-8" - // VMSizeTypesStandardH16 ... - VMSizeTypesStandardH16 VMSizeTypes = "Standard_H16" - // VMSizeTypesStandardH16m ... - VMSizeTypesStandardH16m VMSizeTypes = "Standard_H16m" - // VMSizeTypesStandardH16mr ... - VMSizeTypesStandardH16mr VMSizeTypes = "Standard_H16mr" - // VMSizeTypesStandardH16r ... - VMSizeTypesStandardH16r VMSizeTypes = "Standard_H16r" - // VMSizeTypesStandardH8 ... - VMSizeTypesStandardH8 VMSizeTypes = "Standard_H8" - // VMSizeTypesStandardH8m ... - VMSizeTypesStandardH8m VMSizeTypes = "Standard_H8m" - // VMSizeTypesStandardL16s ... - VMSizeTypesStandardL16s VMSizeTypes = "Standard_L16s" - // VMSizeTypesStandardL32s ... - VMSizeTypesStandardL32s VMSizeTypes = "Standard_L32s" - // VMSizeTypesStandardL4s ... - VMSizeTypesStandardL4s VMSizeTypes = "Standard_L4s" - // VMSizeTypesStandardL8s ... - VMSizeTypesStandardL8s VMSizeTypes = "Standard_L8s" - // VMSizeTypesStandardM12832ms ... - VMSizeTypesStandardM12832ms VMSizeTypes = "Standard_M128-32ms" - // VMSizeTypesStandardM12864ms ... - VMSizeTypesStandardM12864ms VMSizeTypes = "Standard_M128-64ms" - // VMSizeTypesStandardM128ms ... - VMSizeTypesStandardM128ms VMSizeTypes = "Standard_M128ms" - // VMSizeTypesStandardM128s ... - VMSizeTypesStandardM128s VMSizeTypes = "Standard_M128s" - // VMSizeTypesStandardM6416ms ... - VMSizeTypesStandardM6416ms VMSizeTypes = "Standard_M64-16ms" - // VMSizeTypesStandardM6432ms ... - VMSizeTypesStandardM6432ms VMSizeTypes = "Standard_M64-32ms" - // VMSizeTypesStandardM64ms ... - VMSizeTypesStandardM64ms VMSizeTypes = "Standard_M64ms" - // VMSizeTypesStandardM64s ... - VMSizeTypesStandardM64s VMSizeTypes = "Standard_M64s" - // VMSizeTypesStandardNC12 ... - VMSizeTypesStandardNC12 VMSizeTypes = "Standard_NC12" - // VMSizeTypesStandardNC12sV2 ... - VMSizeTypesStandardNC12sV2 VMSizeTypes = "Standard_NC12s_v2" - // VMSizeTypesStandardNC12sV3 ... - VMSizeTypesStandardNC12sV3 VMSizeTypes = "Standard_NC12s_v3" - // VMSizeTypesStandardNC24 ... - VMSizeTypesStandardNC24 VMSizeTypes = "Standard_NC24" - // VMSizeTypesStandardNC24r ... - VMSizeTypesStandardNC24r VMSizeTypes = "Standard_NC24r" - // VMSizeTypesStandardNC24rsV2 ... - VMSizeTypesStandardNC24rsV2 VMSizeTypes = "Standard_NC24rs_v2" - // VMSizeTypesStandardNC24rsV3 ... - VMSizeTypesStandardNC24rsV3 VMSizeTypes = "Standard_NC24rs_v3" - // VMSizeTypesStandardNC24sV2 ... - VMSizeTypesStandardNC24sV2 VMSizeTypes = "Standard_NC24s_v2" - // VMSizeTypesStandardNC24sV3 ... - VMSizeTypesStandardNC24sV3 VMSizeTypes = "Standard_NC24s_v3" - // VMSizeTypesStandardNC6 ... - VMSizeTypesStandardNC6 VMSizeTypes = "Standard_NC6" - // VMSizeTypesStandardNC6sV2 ... - VMSizeTypesStandardNC6sV2 VMSizeTypes = "Standard_NC6s_v2" - // VMSizeTypesStandardNC6sV3 ... - VMSizeTypesStandardNC6sV3 VMSizeTypes = "Standard_NC6s_v3" - // VMSizeTypesStandardND12s ... - VMSizeTypesStandardND12s VMSizeTypes = "Standard_ND12s" - // VMSizeTypesStandardND24rs ... - VMSizeTypesStandardND24rs VMSizeTypes = "Standard_ND24rs" - // VMSizeTypesStandardND24s ... - VMSizeTypesStandardND24s VMSizeTypes = "Standard_ND24s" - // VMSizeTypesStandardND6s ... - VMSizeTypesStandardND6s VMSizeTypes = "Standard_ND6s" - // VMSizeTypesStandardNV12 ... - VMSizeTypesStandardNV12 VMSizeTypes = "Standard_NV12" - // VMSizeTypesStandardNV24 ... - VMSizeTypesStandardNV24 VMSizeTypes = "Standard_NV24" - // VMSizeTypesStandardNV6 ... - VMSizeTypesStandardNV6 VMSizeTypes = "Standard_NV6" -) - -// PossibleVMSizeTypesValues returns an array of possible values for the VMSizeTypes const type. -func PossibleVMSizeTypesValues() []VMSizeTypes { - return []VMSizeTypes{VMSizeTypesStandardA1, VMSizeTypesStandardA10, VMSizeTypesStandardA11, VMSizeTypesStandardA1V2, VMSizeTypesStandardA2, VMSizeTypesStandardA2mV2, VMSizeTypesStandardA2V2, VMSizeTypesStandardA3, VMSizeTypesStandardA4, VMSizeTypesStandardA4mV2, VMSizeTypesStandardA4V2, VMSizeTypesStandardA5, VMSizeTypesStandardA6, VMSizeTypesStandardA7, VMSizeTypesStandardA8, VMSizeTypesStandardA8mV2, VMSizeTypesStandardA8V2, VMSizeTypesStandardA9, VMSizeTypesStandardB2ms, VMSizeTypesStandardB2s, VMSizeTypesStandardB4ms, VMSizeTypesStandardB8ms, VMSizeTypesStandardD1, VMSizeTypesStandardD11, VMSizeTypesStandardD11V2, VMSizeTypesStandardD11V2Promo, VMSizeTypesStandardD12, VMSizeTypesStandardD12V2, VMSizeTypesStandardD12V2Promo, VMSizeTypesStandardD13, VMSizeTypesStandardD13V2, VMSizeTypesStandardD13V2Promo, VMSizeTypesStandardD14, VMSizeTypesStandardD14V2, VMSizeTypesStandardD14V2Promo, VMSizeTypesStandardD15V2, VMSizeTypesStandardD16sV3, VMSizeTypesStandardD16V3, VMSizeTypesStandardD1V2, VMSizeTypesStandardD2, VMSizeTypesStandardD2sV3, VMSizeTypesStandardD2V2, VMSizeTypesStandardD2V2Promo, VMSizeTypesStandardD2V3, VMSizeTypesStandardD3, VMSizeTypesStandardD32sV3, VMSizeTypesStandardD32V3, VMSizeTypesStandardD3V2, VMSizeTypesStandardD3V2Promo, VMSizeTypesStandardD4, VMSizeTypesStandardD4sV3, VMSizeTypesStandardD4V2, VMSizeTypesStandardD4V2Promo, VMSizeTypesStandardD4V3, VMSizeTypesStandardD5V2, VMSizeTypesStandardD5V2Promo, VMSizeTypesStandardD64sV3, VMSizeTypesStandardD64V3, VMSizeTypesStandardD8sV3, VMSizeTypesStandardD8V3, VMSizeTypesStandardDS1, VMSizeTypesStandardDS11, VMSizeTypesStandardDS11V2, VMSizeTypesStandardDS11V2Promo, VMSizeTypesStandardDS12, VMSizeTypesStandardDS12V2, VMSizeTypesStandardDS12V2Promo, VMSizeTypesStandardDS13, VMSizeTypesStandardDS132V2, VMSizeTypesStandardDS134V2, VMSizeTypesStandardDS13V2, VMSizeTypesStandardDS13V2Promo, VMSizeTypesStandardDS14, VMSizeTypesStandardDS144V2, VMSizeTypesStandardDS148V2, VMSizeTypesStandardDS14V2, VMSizeTypesStandardDS14V2Promo, VMSizeTypesStandardDS15V2, VMSizeTypesStandardDS1V2, VMSizeTypesStandardDS2, VMSizeTypesStandardDS2V2, VMSizeTypesStandardDS2V2Promo, VMSizeTypesStandardDS3, VMSizeTypesStandardDS3V2, VMSizeTypesStandardDS3V2Promo, VMSizeTypesStandardDS4, VMSizeTypesStandardDS4V2, VMSizeTypesStandardDS4V2Promo, VMSizeTypesStandardDS5V2, VMSizeTypesStandardDS5V2Promo, VMSizeTypesStandardE16sV3, VMSizeTypesStandardE16V3, VMSizeTypesStandardE2sV3, VMSizeTypesStandardE2V3, VMSizeTypesStandardE3216sV3, VMSizeTypesStandardE328sV3, VMSizeTypesStandardE32sV3, VMSizeTypesStandardE32V3, VMSizeTypesStandardE4sV3, VMSizeTypesStandardE4V3, VMSizeTypesStandardE6416sV3, VMSizeTypesStandardE6432sV3, VMSizeTypesStandardE64sV3, VMSizeTypesStandardE64V3, VMSizeTypesStandardE8sV3, VMSizeTypesStandardE8V3, VMSizeTypesStandardF1, VMSizeTypesStandardF16, VMSizeTypesStandardF16s, VMSizeTypesStandardF16sV2, VMSizeTypesStandardF1s, VMSizeTypesStandardF2, VMSizeTypesStandardF2s, VMSizeTypesStandardF2sV2, VMSizeTypesStandardF32sV2, VMSizeTypesStandardF4, VMSizeTypesStandardF4s, VMSizeTypesStandardF4sV2, VMSizeTypesStandardF64sV2, VMSizeTypesStandardF72sV2, VMSizeTypesStandardF8, VMSizeTypesStandardF8s, VMSizeTypesStandardF8sV2, VMSizeTypesStandardG1, VMSizeTypesStandardG2, VMSizeTypesStandardG3, VMSizeTypesStandardG4, VMSizeTypesStandardG5, VMSizeTypesStandardGS1, VMSizeTypesStandardGS2, VMSizeTypesStandardGS3, VMSizeTypesStandardGS4, VMSizeTypesStandardGS44, VMSizeTypesStandardGS48, VMSizeTypesStandardGS5, VMSizeTypesStandardGS516, VMSizeTypesStandardGS58, VMSizeTypesStandardH16, VMSizeTypesStandardH16m, VMSizeTypesStandardH16mr, VMSizeTypesStandardH16r, VMSizeTypesStandardH8, VMSizeTypesStandardH8m, VMSizeTypesStandardL16s, VMSizeTypesStandardL32s, VMSizeTypesStandardL4s, VMSizeTypesStandardL8s, VMSizeTypesStandardM12832ms, VMSizeTypesStandardM12864ms, VMSizeTypesStandardM128ms, VMSizeTypesStandardM128s, VMSizeTypesStandardM6416ms, VMSizeTypesStandardM6432ms, VMSizeTypesStandardM64ms, VMSizeTypesStandardM64s, VMSizeTypesStandardNC12, VMSizeTypesStandardNC12sV2, VMSizeTypesStandardNC12sV3, VMSizeTypesStandardNC24, VMSizeTypesStandardNC24r, VMSizeTypesStandardNC24rsV2, VMSizeTypesStandardNC24rsV3, VMSizeTypesStandardNC24sV2, VMSizeTypesStandardNC24sV3, VMSizeTypesStandardNC6, VMSizeTypesStandardNC6sV2, VMSizeTypesStandardNC6sV3, VMSizeTypesStandardND12s, VMSizeTypesStandardND24rs, VMSizeTypesStandardND24s, VMSizeTypesStandardND6s, VMSizeTypesStandardNV12, VMSizeTypesStandardNV24, VMSizeTypesStandardNV6} -} - -// WeekDay enumerates the values for week day. -type WeekDay string - -const ( - // WeekDayFriday ... - WeekDayFriday WeekDay = "Friday" - // WeekDayMonday ... - WeekDayMonday WeekDay = "Monday" - // WeekDaySaturday ... - WeekDaySaturday WeekDay = "Saturday" - // WeekDaySunday ... - WeekDaySunday WeekDay = "Sunday" - // WeekDayThursday ... - WeekDayThursday WeekDay = "Thursday" - // WeekDayTuesday ... - WeekDayTuesday WeekDay = "Tuesday" - // WeekDayWednesday ... - WeekDayWednesday WeekDay = "Wednesday" -) - -// PossibleWeekDayValues returns an array of possible values for the WeekDay const type. -func PossibleWeekDayValues() []WeekDay { - return []WeekDay{WeekDayFriday, WeekDayMonday, WeekDaySaturday, WeekDaySunday, WeekDayThursday, WeekDayTuesday, WeekDayWednesday} -} - -// WorkloadRuntime enumerates the values for workload runtime. -type WorkloadRuntime string - -const ( - // WorkloadRuntimeOCIContainer Nodes will use Kubelet to run standard OCI container workloads. - WorkloadRuntimeOCIContainer WorkloadRuntime = "OCIContainer" - // WorkloadRuntimeWasmWasi Nodes will use Krustlet to run WASM workloads using the WASI provider (Preview). - WorkloadRuntimeWasmWasi WorkloadRuntime = "WasmWasi" -) - -// PossibleWorkloadRuntimeValues returns an array of possible values for the WorkloadRuntime const type. -func PossibleWorkloadRuntimeValues() []WorkloadRuntime { - return []WorkloadRuntime{WorkloadRuntimeOCIContainer, WorkloadRuntimeWasmWasi} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/models.go deleted file mode 100644 index fa3fa53e286..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/models.go +++ /dev/null @@ -1,4042 +0,0 @@ -package containerservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice" - -// AccessProfile profile for enabling a user to access a managed cluster. -type AccessProfile struct { - // KubeConfig - Base64-encoded Kubernetes configuration file. - KubeConfig *[]byte `json:"kubeConfig,omitempty"` -} - -// AgentPool agent Pool. -type AgentPool struct { - autorest.Response `json:"-"` - // ManagedClusterAgentPoolProfileProperties - Properties of an agent pool. - *ManagedClusterAgentPoolProfileProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPool. -func (ap AgentPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.ManagedClusterAgentPoolProfileProperties != nil { - objectMap["properties"] = ap.ManagedClusterAgentPoolProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AgentPool struct. -func (ap *AgentPool) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var managedClusterAgentPoolProfileProperties ManagedClusterAgentPoolProfileProperties - err = json.Unmarshal(*v, &managedClusterAgentPoolProfileProperties) - if err != nil { - return err - } - ap.ManagedClusterAgentPoolProfileProperties = &managedClusterAgentPoolProfileProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ap.Type = &typeVar - } - } - } - - return nil -} - -// AgentPoolAvailableVersions the list of available versions for an agent pool. -type AgentPoolAvailableVersions struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The ID of the agent pool version list. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the agent pool version list. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the agent pool version list. - Type *string `json:"type,omitempty"` - // AgentPoolAvailableVersionsProperties - Properties of agent pool available versions. - *AgentPoolAvailableVersionsProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPoolAvailableVersions. -func (apav AgentPoolAvailableVersions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if apav.AgentPoolAvailableVersionsProperties != nil { - objectMap["properties"] = apav.AgentPoolAvailableVersionsProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AgentPoolAvailableVersions struct. -func (apav *AgentPoolAvailableVersions) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - apav.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - apav.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - apav.Type = &typeVar - } - case "properties": - if v != nil { - var agentPoolAvailableVersionsProperties AgentPoolAvailableVersionsProperties - err = json.Unmarshal(*v, &agentPoolAvailableVersionsProperties) - if err != nil { - return err - } - apav.AgentPoolAvailableVersionsProperties = &agentPoolAvailableVersionsProperties - } - } - } - - return nil -} - -// AgentPoolAvailableVersionsProperties the list of available agent pool versions. -type AgentPoolAvailableVersionsProperties struct { - // AgentPoolVersions - List of versions available for agent pool. - AgentPoolVersions *[]AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem `json:"agentPoolVersions,omitempty"` -} - -// AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem ... -type AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem struct { - // Default - Whether this version is the default agent pool version. - Default *bool `json:"default,omitempty"` - // KubernetesVersion - The Kubernetes version (major.minor.patch). - KubernetesVersion *string `json:"kubernetesVersion,omitempty"` - // IsPreview - Whether Kubernetes version is currently in preview. - IsPreview *bool `json:"isPreview,omitempty"` -} - -// AgentPoolListResult the response from the List Agent Pools operation. -type AgentPoolListResult struct { - autorest.Response `json:"-"` - // Value - The list of agent pools. - Value *[]AgentPool `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of agent pool results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPoolListResult. -func (aplr AgentPoolListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aplr.Value != nil { - objectMap["value"] = aplr.Value - } - return json.Marshal(objectMap) -} - -// AgentPoolListResultIterator provides access to a complete listing of AgentPool values. -type AgentPoolListResultIterator struct { - i int - page AgentPoolListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AgentPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AgentPoolListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AgentPoolListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AgentPoolListResultIterator) Response() AgentPoolListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AgentPoolListResultIterator) Value() AgentPool { - if !iter.page.NotDone() { - return AgentPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AgentPoolListResultIterator type. -func NewAgentPoolListResultIterator(page AgentPoolListResultPage) AgentPoolListResultIterator { - return AgentPoolListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aplr AgentPoolListResult) IsEmpty() bool { - return aplr.Value == nil || len(*aplr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aplr AgentPoolListResult) hasNextLink() bool { - return aplr.NextLink != nil && len(*aplr.NextLink) != 0 -} - -// agentPoolListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aplr AgentPoolListResult) agentPoolListResultPreparer(ctx context.Context) (*http.Request, error) { - if !aplr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aplr.NextLink))) -} - -// AgentPoolListResultPage contains a page of AgentPool values. -type AgentPoolListResultPage struct { - fn func(context.Context, AgentPoolListResult) (AgentPoolListResult, error) - aplr AgentPoolListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AgentPoolListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.aplr) - if err != nil { - return err - } - page.aplr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AgentPoolListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AgentPoolListResultPage) NotDone() bool { - return !page.aplr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AgentPoolListResultPage) Response() AgentPoolListResult { - return page.aplr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AgentPoolListResultPage) Values() []AgentPool { - if page.aplr.IsEmpty() { - return nil - } - return *page.aplr.Value -} - -// Creates a new instance of the AgentPoolListResultPage type. -func NewAgentPoolListResultPage(cur AgentPoolListResult, getNextPage func(context.Context, AgentPoolListResult) (AgentPoolListResult, error)) AgentPoolListResultPage { - return AgentPoolListResultPage{ - fn: getNextPage, - aplr: cur, - } -} - -// AgentPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type AgentPoolsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (AgentPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AgentPoolsCreateOrUpdateFuture.Result. -func (future *AgentPoolsCreateOrUpdateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { - ap, err = client.CreateOrUpdateResponder(ap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsCreateOrUpdateFuture", "Result", ap.Response.Response, "Failure responding to request") - } - } - return -} - -// AgentPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AgentPoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AgentPoolsDeleteFuture.Result. -func (future *AgentPoolsDeleteFuture) result(client AgentPoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AgentPoolsUpgradeNodeImageVersionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type AgentPoolsUpgradeNodeImageVersionFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AgentPoolsClient) (AgentPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AgentPoolsUpgradeNodeImageVersionFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AgentPoolsUpgradeNodeImageVersionFuture.Result. -func (future *AgentPoolsUpgradeNodeImageVersionFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsUpgradeNodeImageVersionFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ap.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsUpgradeNodeImageVersionFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { - ap, err = client.UpgradeNodeImageVersionResponder(ap.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsUpgradeNodeImageVersionFuture", "Result", ap.Response.Response, "Failure responding to request") - } - } - return -} - -// AgentPoolUpgradeProfile the list of available upgrades for an agent pool. -type AgentPoolUpgradeProfile struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The ID of the agent pool upgrade profile. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the agent pool upgrade profile. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the agent pool upgrade profile. - Type *string `json:"type,omitempty"` - // AgentPoolUpgradeProfileProperties - The properties of the agent pool upgrade profile. - *AgentPoolUpgradeProfileProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgentPoolUpgradeProfile. -func (apup AgentPoolUpgradeProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if apup.AgentPoolUpgradeProfileProperties != nil { - objectMap["properties"] = apup.AgentPoolUpgradeProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AgentPoolUpgradeProfile struct. -func (apup *AgentPoolUpgradeProfile) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - apup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - apup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - apup.Type = &typeVar - } - case "properties": - if v != nil { - var agentPoolUpgradeProfileProperties AgentPoolUpgradeProfileProperties - err = json.Unmarshal(*v, &agentPoolUpgradeProfileProperties) - if err != nil { - return err - } - apup.AgentPoolUpgradeProfileProperties = &agentPoolUpgradeProfileProperties - } - } - } - - return nil -} - -// AgentPoolUpgradeProfileProperties the list of available upgrade versions. -type AgentPoolUpgradeProfileProperties struct { - // KubernetesVersion - The Kubernetes version (major.minor.patch). - KubernetesVersion *string `json:"kubernetesVersion,omitempty"` - // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' - OsType OSType `json:"osType,omitempty"` - // Upgrades - List of orchestrator types and versions available for upgrade. - Upgrades *[]AgentPoolUpgradeProfilePropertiesUpgradesItem `json:"upgrades,omitempty"` - // LatestNodeImageVersion - The latest AKS supported node image version. - LatestNodeImageVersion *string `json:"latestNodeImageVersion,omitempty"` -} - -// AgentPoolUpgradeProfilePropertiesUpgradesItem ... -type AgentPoolUpgradeProfilePropertiesUpgradesItem struct { - // KubernetesVersion - The Kubernetes version (major.minor.patch). - KubernetesVersion *string `json:"kubernetesVersion,omitempty"` - // IsPreview - Whether the Kubernetes version is currently in preview. - IsPreview *bool `json:"isPreview,omitempty"` -} - -// AgentPoolUpgradeSettings settings for upgrading an agentpool -type AgentPoolUpgradeSettings struct { - // MaxSurge - This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 1. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade - MaxSurge *string `json:"maxSurge,omitempty"` -} - -// CloudError an error response from the Container service. -type CloudError struct { - // Error - Details about the error. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from the Container service. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// CommandResultProperties the results of a run command -type CommandResultProperties struct { - // ProvisioningState - READ-ONLY; provisioning State - ProvisioningState *string `json:"provisioningState,omitempty"` - // ExitCode - READ-ONLY; The exit code of the command - ExitCode *int32 `json:"exitCode,omitempty"` - // StartedAt - READ-ONLY; The time when the command started. - StartedAt *date.Time `json:"startedAt,omitempty"` - // FinishedAt - READ-ONLY; The time when the command finished. - FinishedAt *date.Time `json:"finishedAt,omitempty"` - // Logs - READ-ONLY; The command output. - Logs *string `json:"logs,omitempty"` - // Reason - READ-ONLY; An explanation of why provisioningState is set to failed (if so). - Reason *string `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for CommandResultProperties. -func (crp CommandResultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CreationData data used when creating a target resource from a source resource. -type CreationData struct { - // SourceResourceID - This is the ARM ID of the source object to be used to create the target object. - SourceResourceID *string `json:"sourceResourceId,omitempty"` -} - -// CredentialResult the credential result response. -type CredentialResult struct { - // Name - READ-ONLY; The name of the credential. - Name *string `json:"name,omitempty"` - // Value - READ-ONLY; Base64-encoded Kubernetes configuration file. - Value *[]byte `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for CredentialResult. -func (cr CredentialResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CredentialResults the list credential result response. -type CredentialResults struct { - autorest.Response `json:"-"` - // Kubeconfigs - READ-ONLY; Base64-encoded Kubernetes configuration file. - Kubeconfigs *[]CredentialResult `json:"kubeconfigs,omitempty"` -} - -// MarshalJSON is the custom marshaler for CredentialResults. -func (cr CredentialResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DiagnosticsProfile profile for diagnostics on the container service cluster. -type DiagnosticsProfile struct { - // VMDiagnostics - Profile for diagnostics on the container service VMs. - VMDiagnostics *VMDiagnostics `json:"vmDiagnostics,omitempty"` -} - -// EndpointDependency a domain name that AKS agent nodes are reaching at. -type EndpointDependency struct { - // DomainName - The domain name of the dependency. - DomainName *string `json:"domainName,omitempty"` - // EndpointDetails - The Ports and Protocols used when connecting to domainName. - EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` -} - -// EndpointDetail connect information from the AKS agent nodes to a single endpoint. -type EndpointDetail struct { - // IPAddress - An IP Address that Domain Name currently resolves to. - IPAddress *string `json:"ipAddress,omitempty"` - // Port - The port an endpoint is connected to. - Port *int32 `json:"port,omitempty"` - // Protocol - The protocol used for connection - Protocol *string `json:"protocol,omitempty"` - // Description - Description of the detail - Description *string `json:"description,omitempty"` -} - -// ExtendedLocation the complex type of the extended location. -type ExtendedLocation struct { - // Name - The name of the extended location. - Name *string `json:"name,omitempty"` - // Type - The type of the extended location. Possible values include: 'ExtendedLocationTypesEdgeZone' - Type ExtendedLocationTypes `json:"type,omitempty"` -} - -// KubeletConfig see [AKS custom node -// configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details. -type KubeletConfig struct { - // CPUManagerPolicy - The default is 'none'. See [Kubernetes CPU management policies](https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#cpu-management-policies) for more information. Allowed values are 'none' and 'static'. - CPUManagerPolicy *string `json:"cpuManagerPolicy,omitempty"` - // CPUCfsQuota - The default is true. - CPUCfsQuota *bool `json:"cpuCfsQuota,omitempty"` - // CPUCfsQuotaPeriod - The default is '100ms.' Valid values are a sequence of decimal numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported units are 'ns', 'us', 'ms', 's', 'm', and 'h'. - CPUCfsQuotaPeriod *string `json:"cpuCfsQuotaPeriod,omitempty"` - // ImageGcHighThreshold - To disable image garbage collection, set to 100. The default is 85% - ImageGcHighThreshold *int32 `json:"imageGcHighThreshold,omitempty"` - // ImageGcLowThreshold - This cannot be set higher than imageGcHighThreshold. The default is 80% - ImageGcLowThreshold *int32 `json:"imageGcLowThreshold,omitempty"` - // TopologyManagerPolicy - For more information see [Kubernetes Topology Manager](https://kubernetes.io/docs/tasks/administer-cluster/topology-manager). The default is 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'. - TopologyManagerPolicy *string `json:"topologyManagerPolicy,omitempty"` - // AllowedUnsafeSysctls - Allowed list of unsafe sysctls or unsafe sysctl patterns (ending in `*`). - AllowedUnsafeSysctls *[]string `json:"allowedUnsafeSysctls,omitempty"` - // FailSwapOn - If set to true it will make the Kubelet fail to start if swap is enabled on the node. - FailSwapOn *bool `json:"failSwapOn,omitempty"` - // ContainerLogMaxSizeMB - The maximum size (e.g. 10Mi) of container log file before it is rotated. - ContainerLogMaxSizeMB *int32 `json:"containerLogMaxSizeMB,omitempty"` - // ContainerLogMaxFiles - The maximum number of container log files that can be present for a container. The number must be ≥ 2. - ContainerLogMaxFiles *int32 `json:"containerLogMaxFiles,omitempty"` - // PodMaxPids - The maximum number of processes per pod. - PodMaxPids *int32 `json:"podMaxPids,omitempty"` -} - -// LinuxOSConfig see [AKS custom node -// configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details. -type LinuxOSConfig struct { - // Sysctls - Sysctl settings for Linux agent nodes. - Sysctls *SysctlConfig `json:"sysctls,omitempty"` - // TransparentHugePageEnabled - Valid values are 'always', 'madvise', and 'never'. The default is 'always'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). - TransparentHugePageEnabled *string `json:"transparentHugePageEnabled,omitempty"` - // TransparentHugePageDefrag - Valid values are 'always', 'defer', 'defer+madvise', 'madvise' and 'never'. The default is 'madvise'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). - TransparentHugePageDefrag *string `json:"transparentHugePageDefrag,omitempty"` - // SwapFileSizeMB - The size in MB of a swap file that will be created on each node. - SwapFileSizeMB *int32 `json:"swapFileSizeMB,omitempty"` -} - -// LinuxProfile profile for Linux VMs in the container service cluster. -type LinuxProfile struct { - // AdminUsername - The administrator username to use for Linux VMs. - AdminUsername *string `json:"adminUsername,omitempty"` - // SSH - The SSH configuration for Linux-based VMs running on Azure. - SSH *SSHConfiguration `json:"ssh,omitempty"` -} - -// MaintenanceConfiguration see [planned -// maintenance](https://docs.microsoft.com/azure/aks/planned-maintenance) for more information about -// planned maintenance. -type MaintenanceConfiguration struct { - autorest.Response `json:"-"` - // SystemData - READ-ONLY; The system metadata relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // MaintenanceConfigurationProperties - Properties of a default maintenance configuration. - *MaintenanceConfigurationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MaintenanceConfiguration. -func (mc MaintenanceConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mc.MaintenanceConfigurationProperties != nil { - objectMap["properties"] = mc.MaintenanceConfigurationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MaintenanceConfiguration struct. -func (mc *MaintenanceConfiguration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - mc.SystemData = &systemData - } - case "properties": - if v != nil { - var maintenanceConfigurationProperties MaintenanceConfigurationProperties - err = json.Unmarshal(*v, &maintenanceConfigurationProperties) - if err != nil { - return err - } - mc.MaintenanceConfigurationProperties = &maintenanceConfigurationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mc.Type = &typeVar - } - } - } - - return nil -} - -// MaintenanceConfigurationListResult the response from the List maintenance configurations operation. -type MaintenanceConfigurationListResult struct { - autorest.Response `json:"-"` - // Value - The list of maintenance configurations. - Value *[]MaintenanceConfiguration `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of maintenance configuration results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for MaintenanceConfigurationListResult. -func (mclr MaintenanceConfigurationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mclr.Value != nil { - objectMap["value"] = mclr.Value - } - return json.Marshal(objectMap) -} - -// MaintenanceConfigurationListResultIterator provides access to a complete listing of -// MaintenanceConfiguration values. -type MaintenanceConfigurationListResultIterator struct { - i int - page MaintenanceConfigurationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *MaintenanceConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *MaintenanceConfigurationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter MaintenanceConfigurationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter MaintenanceConfigurationListResultIterator) Response() MaintenanceConfigurationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter MaintenanceConfigurationListResultIterator) Value() MaintenanceConfiguration { - if !iter.page.NotDone() { - return MaintenanceConfiguration{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the MaintenanceConfigurationListResultIterator type. -func NewMaintenanceConfigurationListResultIterator(page MaintenanceConfigurationListResultPage) MaintenanceConfigurationListResultIterator { - return MaintenanceConfigurationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mclr MaintenanceConfigurationListResult) IsEmpty() bool { - return mclr.Value == nil || len(*mclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mclr MaintenanceConfigurationListResult) hasNextLink() bool { - return mclr.NextLink != nil && len(*mclr.NextLink) != 0 -} - -// maintenanceConfigurationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mclr MaintenanceConfigurationListResult) maintenanceConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mclr.NextLink))) -} - -// MaintenanceConfigurationListResultPage contains a page of MaintenanceConfiguration values. -type MaintenanceConfigurationListResultPage struct { - fn func(context.Context, MaintenanceConfigurationListResult) (MaintenanceConfigurationListResult, error) - mclr MaintenanceConfigurationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *MaintenanceConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.mclr) - if err != nil { - return err - } - page.mclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *MaintenanceConfigurationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page MaintenanceConfigurationListResultPage) NotDone() bool { - return !page.mclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page MaintenanceConfigurationListResultPage) Response() MaintenanceConfigurationListResult { - return page.mclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page MaintenanceConfigurationListResultPage) Values() []MaintenanceConfiguration { - if page.mclr.IsEmpty() { - return nil - } - return *page.mclr.Value -} - -// Creates a new instance of the MaintenanceConfigurationListResultPage type. -func NewMaintenanceConfigurationListResultPage(cur MaintenanceConfigurationListResult, getNextPage func(context.Context, MaintenanceConfigurationListResult) (MaintenanceConfigurationListResult, error)) MaintenanceConfigurationListResultPage { - return MaintenanceConfigurationListResultPage{ - fn: getNextPage, - mclr: cur, - } -} - -// MaintenanceConfigurationProperties properties used to configure planned maintenance for a Managed -// Cluster. -type MaintenanceConfigurationProperties struct { - // TimeInWeek - If two array entries specify the same day of the week, the applied configuration is the union of times in both entries. - TimeInWeek *[]TimeInWeek `json:"timeInWeek,omitempty"` - // NotAllowedTime - Time slots on which upgrade is not allowed. - NotAllowedTime *[]TimeSpan `json:"notAllowedTime,omitempty"` -} - -// ManagedCluster managed cluster. -type ManagedCluster struct { - autorest.Response `json:"-"` - // Sku - The managed cluster SKU. - Sku *ManagedClusterSKU `json:"sku,omitempty"` - // ExtendedLocation - The extended location of the Virtual Machine. - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - // Identity - The identity of the managed cluster, if configured. - Identity *ManagedClusterIdentity `json:"identity,omitempty"` - // ManagedClusterProperties - Properties of a managed cluster. - *ManagedClusterProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ManagedCluster. -func (mc ManagedCluster) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mc.Sku != nil { - objectMap["sku"] = mc.Sku - } - if mc.ExtendedLocation != nil { - objectMap["extendedLocation"] = mc.ExtendedLocation - } - if mc.Identity != nil { - objectMap["identity"] = mc.Identity - } - if mc.ManagedClusterProperties != nil { - objectMap["properties"] = mc.ManagedClusterProperties - } - if mc.Location != nil { - objectMap["location"] = mc.Location - } - if mc.Tags != nil { - objectMap["tags"] = mc.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedCluster struct. -func (mc *ManagedCluster) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku ManagedClusterSKU - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - mc.Sku = &sku - } - case "extendedLocation": - if v != nil { - var extendedLocation ExtendedLocation - err = json.Unmarshal(*v, &extendedLocation) - if err != nil { - return err - } - mc.ExtendedLocation = &extendedLocation - } - case "identity": - if v != nil { - var identity ManagedClusterIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - mc.Identity = &identity - } - case "properties": - if v != nil { - var managedClusterProperties ManagedClusterProperties - err = json.Unmarshal(*v, &managedClusterProperties) - if err != nil { - return err - } - mc.ManagedClusterProperties = &managedClusterProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mc.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mc.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mc.Tags = tags - } - } - } - - return nil -} - -// ManagedClusterAADProfile for more details see [managed AAD on -// AKS](https://docs.microsoft.com/azure/aks/managed-aad). -type ManagedClusterAADProfile struct { - // Managed - Whether to enable managed AAD. - Managed *bool `json:"managed,omitempty"` - // EnableAzureRBAC - Whether to enable Azure RBAC for Kubernetes authorization. - EnableAzureRBAC *bool `json:"enableAzureRBAC,omitempty"` - // AdminGroupObjectIDs - The list of AAD group object IDs that will have admin role of the cluster. - AdminGroupObjectIDs *[]string `json:"adminGroupObjectIDs,omitempty"` - // ClientAppID - The client AAD application ID. - ClientAppID *string `json:"clientAppID,omitempty"` - // ServerAppID - The server AAD application ID. - ServerAppID *string `json:"serverAppID,omitempty"` - // ServerAppSecret - The server AAD application secret. - ServerAppSecret *string `json:"serverAppSecret,omitempty"` - // TenantID - The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. - TenantID *string `json:"tenantID,omitempty"` -} - -// ManagedClusterAccessProfile managed cluster Access Profile. -type ManagedClusterAccessProfile struct { - autorest.Response `json:"-"` - // AccessProfile - AccessProfile of a managed cluster. - *AccessProfile `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterAccessProfile. -func (mcap ManagedClusterAccessProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcap.AccessProfile != nil { - objectMap["properties"] = mcap.AccessProfile - } - if mcap.Location != nil { - objectMap["location"] = mcap.Location - } - if mcap.Tags != nil { - objectMap["tags"] = mcap.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedClusterAccessProfile struct. -func (mcap *ManagedClusterAccessProfile) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var accessProfile AccessProfile - err = json.Unmarshal(*v, &accessProfile) - if err != nil { - return err - } - mcap.AccessProfile = &accessProfile - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mcap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mcap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mcap.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mcap.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mcap.Tags = tags - } - } - } - - return nil -} - -// ManagedClusterAddonProfile a Kubernetes add-on profile for a managed cluster. -type ManagedClusterAddonProfile struct { - // Enabled - Whether the add-on is enabled or not. - Enabled *bool `json:"enabled,omitempty"` - // Config - Key-value pairs for configuring an add-on. - Config map[string]*string `json:"config"` - // Identity - READ-ONLY; Information of user assigned identity used by this add-on. - Identity *ManagedClusterAddonProfileIdentity `json:"identity,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterAddonProfile. -func (mcap ManagedClusterAddonProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcap.Enabled != nil { - objectMap["enabled"] = mcap.Enabled - } - if mcap.Config != nil { - objectMap["config"] = mcap.Config - } - return json.Marshal(objectMap) -} - -// ManagedClusterAddonProfileIdentity information of user assigned identity used by this add-on. -type ManagedClusterAddonProfileIdentity struct { - // ResourceID - The resource ID of the user assigned identity. - ResourceID *string `json:"resourceId,omitempty"` - // ClientID - The client ID of the user assigned identity. - ClientID *string `json:"clientId,omitempty"` - // ObjectID - The object ID of the user assigned identity. - ObjectID *string `json:"objectId,omitempty"` -} - -// ManagedClusterAgentPoolProfile profile for the container service agent pool. -type ManagedClusterAgentPoolProfile struct { - // Name - Windows agent pool names must be 6 characters or less. - Name *string `json:"name,omitempty"` - // Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. - Count *int32 `json:"count,omitempty"` - // VMSize - VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions - VMSize *string `json:"vmSize,omitempty"` - OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` - // OsDiskType - Possible values include: 'OSDiskTypeManaged', 'OSDiskTypeEphemeral' - OsDiskType OSDiskType `json:"osDiskType,omitempty"` - // KubeletDiskType - Possible values include: 'KubeletDiskTypeOS', 'KubeletDiskTypeTemporary' - KubeletDiskType KubeletDiskType `json:"kubeletDiskType,omitempty"` - // WorkloadRuntime - Possible values include: 'WorkloadRuntimeOCIContainer', 'WorkloadRuntimeWasmWasi' - WorkloadRuntime WorkloadRuntime `json:"workloadRuntime,omitempty"` - // MessageOfTheDay - A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). - MessageOfTheDay *string `json:"messageOfTheDay,omitempty"` - // VnetSubnetID - If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} - VnetSubnetID *string `json:"vnetSubnetID,omitempty"` - // PodSubnetID - If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} - PodSubnetID *string `json:"podSubnetID,omitempty"` - // MaxPods - The maximum number of pods that can run on a node. - MaxPods *int32 `json:"maxPods,omitempty"` - // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' - OsType OSType `json:"osType,omitempty"` - // OsSKU - Possible values include: 'OSSKUUbuntu', 'OSSKUCBLMariner' - OsSKU OSSKU `json:"osSKU,omitempty"` - // MaxCount - The maximum number of nodes for auto-scaling - MaxCount *int32 `json:"maxCount,omitempty"` - // MinCount - The minimum number of nodes for auto-scaling - MinCount *int32 `json:"minCount,omitempty"` - // EnableAutoScaling - Whether to enable auto-scaler - EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` - // ScaleDownMode - This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. Possible values include: 'ScaleDownModeDelete', 'ScaleDownModeDeallocate' - ScaleDownMode ScaleDownMode `json:"scaleDownMode,omitempty"` - // Type - Possible values include: 'AgentPoolTypeVirtualMachineScaleSets', 'AgentPoolTypeAvailabilitySet' - Type AgentPoolType `json:"type,omitempty"` - // Mode - Possible values include: 'AgentPoolModeSystem', 'AgentPoolModeUser' - Mode AgentPoolMode `json:"mode,omitempty"` - // OrchestratorVersion - As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). - OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` - // NodeImageVersion - READ-ONLY; The version of node image - NodeImageVersion *string `json:"nodeImageVersion,omitempty"` - // UpgradeSettings - Settings for upgrading the agentpool - UpgradeSettings *AgentPoolUpgradeSettings `json:"upgradeSettings,omitempty"` - // ProvisioningState - READ-ONLY; The current deployment or provisioning state. - ProvisioningState *string `json:"provisioningState,omitempty"` - // PowerState - When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded - PowerState *PowerState `json:"powerState,omitempty"` - // AvailabilityZones - The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. - AvailabilityZones *[]string `json:"availabilityZones,omitempty"` - // EnableNodePublicIP - Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. - EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"` - // NodePublicIPPrefixID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName} - NodePublicIPPrefixID *string `json:"nodePublicIPPrefixID,omitempty"` - // ScaleSetPriority - The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. Possible values include: 'ScaleSetPrioritySpot', 'ScaleSetPriorityRegular' - ScaleSetPriority ScaleSetPriority `json:"scaleSetPriority,omitempty"` - // ScaleSetEvictionPolicy - This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. Possible values include: 'ScaleSetEvictionPolicyDelete', 'ScaleSetEvictionPolicyDeallocate' - ScaleSetEvictionPolicy ScaleSetEvictionPolicy `json:"scaleSetEvictionPolicy,omitempty"` - // SpotMaxPrice - Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing) - SpotMaxPrice *float64 `json:"spotMaxPrice,omitempty"` - // Tags - The tags to be persisted on the agent pool virtual machine scale set. - Tags map[string]*string `json:"tags"` - // NodeLabels - The node labels to be persisted across all nodes in agent pool. - NodeLabels map[string]*string `json:"nodeLabels"` - // NodeTaints - The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. - NodeTaints *[]string `json:"nodeTaints,omitempty"` - // ProximityPlacementGroupID - The ID for Proximity Placement Group. - ProximityPlacementGroupID *string `json:"proximityPlacementGroupID,omitempty"` - // KubeletConfig - The Kubelet configuration on the agent pool nodes. - KubeletConfig *KubeletConfig `json:"kubeletConfig,omitempty"` - // LinuxOSConfig - The OS configuration of Linux agent nodes. - LinuxOSConfig *LinuxOSConfig `json:"linuxOSConfig,omitempty"` - // EnableEncryptionAtHost - This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption - EnableEncryptionAtHost *bool `json:"enableEncryptionAtHost,omitempty"` - // EnableUltraSSD - Whether to enable UltraSSD - EnableUltraSSD *bool `json:"enableUltraSSD,omitempty"` - // EnableFIPS - See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. - EnableFIPS *bool `json:"enableFIPS,omitempty"` - // GpuInstanceProfile - GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Possible values include: 'GPUInstanceProfileMIG1g', 'GPUInstanceProfileMIG2g', 'GPUInstanceProfileMIG3g', 'GPUInstanceProfileMIG4g', 'GPUInstanceProfileMIG7g' - GpuInstanceProfile GPUInstanceProfile `json:"gpuInstanceProfile,omitempty"` - // CreationData - CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. - CreationData *CreationData `json:"creationData,omitempty"` - // CapacityReservationGroupID - AKS will associate the specified agent pool with the Capacity Reservation Group. - CapacityReservationGroupID *string `json:"capacityReservationGroupID,omitempty"` - // HostGroupID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). - HostGroupID *string `json:"hostGroupID,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterAgentPoolProfile. -func (mcapp ManagedClusterAgentPoolProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcapp.Name != nil { - objectMap["name"] = mcapp.Name - } - if mcapp.Count != nil { - objectMap["count"] = mcapp.Count - } - if mcapp.VMSize != nil { - objectMap["vmSize"] = mcapp.VMSize - } - if mcapp.OsDiskSizeGB != nil { - objectMap["osDiskSizeGB"] = mcapp.OsDiskSizeGB - } - if mcapp.OsDiskType != "" { - objectMap["osDiskType"] = mcapp.OsDiskType - } - if mcapp.KubeletDiskType != "" { - objectMap["kubeletDiskType"] = mcapp.KubeletDiskType - } - if mcapp.WorkloadRuntime != "" { - objectMap["workloadRuntime"] = mcapp.WorkloadRuntime - } - if mcapp.MessageOfTheDay != nil { - objectMap["messageOfTheDay"] = mcapp.MessageOfTheDay - } - if mcapp.VnetSubnetID != nil { - objectMap["vnetSubnetID"] = mcapp.VnetSubnetID - } - if mcapp.PodSubnetID != nil { - objectMap["podSubnetID"] = mcapp.PodSubnetID - } - if mcapp.MaxPods != nil { - objectMap["maxPods"] = mcapp.MaxPods - } - if mcapp.OsType != "" { - objectMap["osType"] = mcapp.OsType - } - if mcapp.OsSKU != "" { - objectMap["osSKU"] = mcapp.OsSKU - } - if mcapp.MaxCount != nil { - objectMap["maxCount"] = mcapp.MaxCount - } - if mcapp.MinCount != nil { - objectMap["minCount"] = mcapp.MinCount - } - if mcapp.EnableAutoScaling != nil { - objectMap["enableAutoScaling"] = mcapp.EnableAutoScaling - } - if mcapp.ScaleDownMode != "" { - objectMap["scaleDownMode"] = mcapp.ScaleDownMode - } - if mcapp.Type != "" { - objectMap["type"] = mcapp.Type - } - if mcapp.Mode != "" { - objectMap["mode"] = mcapp.Mode - } - if mcapp.OrchestratorVersion != nil { - objectMap["orchestratorVersion"] = mcapp.OrchestratorVersion - } - if mcapp.UpgradeSettings != nil { - objectMap["upgradeSettings"] = mcapp.UpgradeSettings - } - if mcapp.PowerState != nil { - objectMap["powerState"] = mcapp.PowerState - } - if mcapp.AvailabilityZones != nil { - objectMap["availabilityZones"] = mcapp.AvailabilityZones - } - if mcapp.EnableNodePublicIP != nil { - objectMap["enableNodePublicIP"] = mcapp.EnableNodePublicIP - } - if mcapp.NodePublicIPPrefixID != nil { - objectMap["nodePublicIPPrefixID"] = mcapp.NodePublicIPPrefixID - } - if mcapp.ScaleSetPriority != "" { - objectMap["scaleSetPriority"] = mcapp.ScaleSetPriority - } - if mcapp.ScaleSetEvictionPolicy != "" { - objectMap["scaleSetEvictionPolicy"] = mcapp.ScaleSetEvictionPolicy - } - if mcapp.SpotMaxPrice != nil { - objectMap["spotMaxPrice"] = mcapp.SpotMaxPrice - } - if mcapp.Tags != nil { - objectMap["tags"] = mcapp.Tags - } - if mcapp.NodeLabels != nil { - objectMap["nodeLabels"] = mcapp.NodeLabels - } - if mcapp.NodeTaints != nil { - objectMap["nodeTaints"] = mcapp.NodeTaints - } - if mcapp.ProximityPlacementGroupID != nil { - objectMap["proximityPlacementGroupID"] = mcapp.ProximityPlacementGroupID - } - if mcapp.KubeletConfig != nil { - objectMap["kubeletConfig"] = mcapp.KubeletConfig - } - if mcapp.LinuxOSConfig != nil { - objectMap["linuxOSConfig"] = mcapp.LinuxOSConfig - } - if mcapp.EnableEncryptionAtHost != nil { - objectMap["enableEncryptionAtHost"] = mcapp.EnableEncryptionAtHost - } - if mcapp.EnableUltraSSD != nil { - objectMap["enableUltraSSD"] = mcapp.EnableUltraSSD - } - if mcapp.EnableFIPS != nil { - objectMap["enableFIPS"] = mcapp.EnableFIPS - } - if mcapp.GpuInstanceProfile != "" { - objectMap["gpuInstanceProfile"] = mcapp.GpuInstanceProfile - } - if mcapp.CreationData != nil { - objectMap["creationData"] = mcapp.CreationData - } - if mcapp.CapacityReservationGroupID != nil { - objectMap["capacityReservationGroupID"] = mcapp.CapacityReservationGroupID - } - if mcapp.HostGroupID != nil { - objectMap["hostGroupID"] = mcapp.HostGroupID - } - return json.Marshal(objectMap) -} - -// ManagedClusterAgentPoolProfileProperties properties for the container service agent pool profile. -type ManagedClusterAgentPoolProfileProperties struct { - // Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. - Count *int32 `json:"count,omitempty"` - // VMSize - VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions - VMSize *string `json:"vmSize,omitempty"` - OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` - // OsDiskType - Possible values include: 'OSDiskTypeManaged', 'OSDiskTypeEphemeral' - OsDiskType OSDiskType `json:"osDiskType,omitempty"` - // KubeletDiskType - Possible values include: 'KubeletDiskTypeOS', 'KubeletDiskTypeTemporary' - KubeletDiskType KubeletDiskType `json:"kubeletDiskType,omitempty"` - // WorkloadRuntime - Possible values include: 'WorkloadRuntimeOCIContainer', 'WorkloadRuntimeWasmWasi' - WorkloadRuntime WorkloadRuntime `json:"workloadRuntime,omitempty"` - // MessageOfTheDay - A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). - MessageOfTheDay *string `json:"messageOfTheDay,omitempty"` - // VnetSubnetID - If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} - VnetSubnetID *string `json:"vnetSubnetID,omitempty"` - // PodSubnetID - If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} - PodSubnetID *string `json:"podSubnetID,omitempty"` - // MaxPods - The maximum number of pods that can run on a node. - MaxPods *int32 `json:"maxPods,omitempty"` - // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' - OsType OSType `json:"osType,omitempty"` - // OsSKU - Possible values include: 'OSSKUUbuntu', 'OSSKUCBLMariner' - OsSKU OSSKU `json:"osSKU,omitempty"` - // MaxCount - The maximum number of nodes for auto-scaling - MaxCount *int32 `json:"maxCount,omitempty"` - // MinCount - The minimum number of nodes for auto-scaling - MinCount *int32 `json:"minCount,omitempty"` - // EnableAutoScaling - Whether to enable auto-scaler - EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` - // ScaleDownMode - This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. Possible values include: 'ScaleDownModeDelete', 'ScaleDownModeDeallocate' - ScaleDownMode ScaleDownMode `json:"scaleDownMode,omitempty"` - // Type - Possible values include: 'AgentPoolTypeVirtualMachineScaleSets', 'AgentPoolTypeAvailabilitySet' - Type AgentPoolType `json:"type,omitempty"` - // Mode - Possible values include: 'AgentPoolModeSystem', 'AgentPoolModeUser' - Mode AgentPoolMode `json:"mode,omitempty"` - // OrchestratorVersion - As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). - OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` - // NodeImageVersion - READ-ONLY; The version of node image - NodeImageVersion *string `json:"nodeImageVersion,omitempty"` - // UpgradeSettings - Settings for upgrading the agentpool - UpgradeSettings *AgentPoolUpgradeSettings `json:"upgradeSettings,omitempty"` - // ProvisioningState - READ-ONLY; The current deployment or provisioning state. - ProvisioningState *string `json:"provisioningState,omitempty"` - // PowerState - When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded - PowerState *PowerState `json:"powerState,omitempty"` - // AvailabilityZones - The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. - AvailabilityZones *[]string `json:"availabilityZones,omitempty"` - // EnableNodePublicIP - Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. - EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"` - // NodePublicIPPrefixID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName} - NodePublicIPPrefixID *string `json:"nodePublicIPPrefixID,omitempty"` - // ScaleSetPriority - The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. Possible values include: 'ScaleSetPrioritySpot', 'ScaleSetPriorityRegular' - ScaleSetPriority ScaleSetPriority `json:"scaleSetPriority,omitempty"` - // ScaleSetEvictionPolicy - This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. Possible values include: 'ScaleSetEvictionPolicyDelete', 'ScaleSetEvictionPolicyDeallocate' - ScaleSetEvictionPolicy ScaleSetEvictionPolicy `json:"scaleSetEvictionPolicy,omitempty"` - // SpotMaxPrice - Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing) - SpotMaxPrice *float64 `json:"spotMaxPrice,omitempty"` - // Tags - The tags to be persisted on the agent pool virtual machine scale set. - Tags map[string]*string `json:"tags"` - // NodeLabels - The node labels to be persisted across all nodes in agent pool. - NodeLabels map[string]*string `json:"nodeLabels"` - // NodeTaints - The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. - NodeTaints *[]string `json:"nodeTaints,omitempty"` - // ProximityPlacementGroupID - The ID for Proximity Placement Group. - ProximityPlacementGroupID *string `json:"proximityPlacementGroupID,omitempty"` - // KubeletConfig - The Kubelet configuration on the agent pool nodes. - KubeletConfig *KubeletConfig `json:"kubeletConfig,omitempty"` - // LinuxOSConfig - The OS configuration of Linux agent nodes. - LinuxOSConfig *LinuxOSConfig `json:"linuxOSConfig,omitempty"` - // EnableEncryptionAtHost - This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption - EnableEncryptionAtHost *bool `json:"enableEncryptionAtHost,omitempty"` - // EnableUltraSSD - Whether to enable UltraSSD - EnableUltraSSD *bool `json:"enableUltraSSD,omitempty"` - // EnableFIPS - See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. - EnableFIPS *bool `json:"enableFIPS,omitempty"` - // GpuInstanceProfile - GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Possible values include: 'GPUInstanceProfileMIG1g', 'GPUInstanceProfileMIG2g', 'GPUInstanceProfileMIG3g', 'GPUInstanceProfileMIG4g', 'GPUInstanceProfileMIG7g' - GpuInstanceProfile GPUInstanceProfile `json:"gpuInstanceProfile,omitempty"` - // CreationData - CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. - CreationData *CreationData `json:"creationData,omitempty"` - // CapacityReservationGroupID - AKS will associate the specified agent pool with the Capacity Reservation Group. - CapacityReservationGroupID *string `json:"capacityReservationGroupID,omitempty"` - // HostGroupID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). - HostGroupID *string `json:"hostGroupID,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterAgentPoolProfileProperties. -func (mcappp ManagedClusterAgentPoolProfileProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcappp.Count != nil { - objectMap["count"] = mcappp.Count - } - if mcappp.VMSize != nil { - objectMap["vmSize"] = mcappp.VMSize - } - if mcappp.OsDiskSizeGB != nil { - objectMap["osDiskSizeGB"] = mcappp.OsDiskSizeGB - } - if mcappp.OsDiskType != "" { - objectMap["osDiskType"] = mcappp.OsDiskType - } - if mcappp.KubeletDiskType != "" { - objectMap["kubeletDiskType"] = mcappp.KubeletDiskType - } - if mcappp.WorkloadRuntime != "" { - objectMap["workloadRuntime"] = mcappp.WorkloadRuntime - } - if mcappp.MessageOfTheDay != nil { - objectMap["messageOfTheDay"] = mcappp.MessageOfTheDay - } - if mcappp.VnetSubnetID != nil { - objectMap["vnetSubnetID"] = mcappp.VnetSubnetID - } - if mcappp.PodSubnetID != nil { - objectMap["podSubnetID"] = mcappp.PodSubnetID - } - if mcappp.MaxPods != nil { - objectMap["maxPods"] = mcappp.MaxPods - } - if mcappp.OsType != "" { - objectMap["osType"] = mcappp.OsType - } - if mcappp.OsSKU != "" { - objectMap["osSKU"] = mcappp.OsSKU - } - if mcappp.MaxCount != nil { - objectMap["maxCount"] = mcappp.MaxCount - } - if mcappp.MinCount != nil { - objectMap["minCount"] = mcappp.MinCount - } - if mcappp.EnableAutoScaling != nil { - objectMap["enableAutoScaling"] = mcappp.EnableAutoScaling - } - if mcappp.ScaleDownMode != "" { - objectMap["scaleDownMode"] = mcappp.ScaleDownMode - } - if mcappp.Type != "" { - objectMap["type"] = mcappp.Type - } - if mcappp.Mode != "" { - objectMap["mode"] = mcappp.Mode - } - if mcappp.OrchestratorVersion != nil { - objectMap["orchestratorVersion"] = mcappp.OrchestratorVersion - } - if mcappp.UpgradeSettings != nil { - objectMap["upgradeSettings"] = mcappp.UpgradeSettings - } - if mcappp.PowerState != nil { - objectMap["powerState"] = mcappp.PowerState - } - if mcappp.AvailabilityZones != nil { - objectMap["availabilityZones"] = mcappp.AvailabilityZones - } - if mcappp.EnableNodePublicIP != nil { - objectMap["enableNodePublicIP"] = mcappp.EnableNodePublicIP - } - if mcappp.NodePublicIPPrefixID != nil { - objectMap["nodePublicIPPrefixID"] = mcappp.NodePublicIPPrefixID - } - if mcappp.ScaleSetPriority != "" { - objectMap["scaleSetPriority"] = mcappp.ScaleSetPriority - } - if mcappp.ScaleSetEvictionPolicy != "" { - objectMap["scaleSetEvictionPolicy"] = mcappp.ScaleSetEvictionPolicy - } - if mcappp.SpotMaxPrice != nil { - objectMap["spotMaxPrice"] = mcappp.SpotMaxPrice - } - if mcappp.Tags != nil { - objectMap["tags"] = mcappp.Tags - } - if mcappp.NodeLabels != nil { - objectMap["nodeLabels"] = mcappp.NodeLabels - } - if mcappp.NodeTaints != nil { - objectMap["nodeTaints"] = mcappp.NodeTaints - } - if mcappp.ProximityPlacementGroupID != nil { - objectMap["proximityPlacementGroupID"] = mcappp.ProximityPlacementGroupID - } - if mcappp.KubeletConfig != nil { - objectMap["kubeletConfig"] = mcappp.KubeletConfig - } - if mcappp.LinuxOSConfig != nil { - objectMap["linuxOSConfig"] = mcappp.LinuxOSConfig - } - if mcappp.EnableEncryptionAtHost != nil { - objectMap["enableEncryptionAtHost"] = mcappp.EnableEncryptionAtHost - } - if mcappp.EnableUltraSSD != nil { - objectMap["enableUltraSSD"] = mcappp.EnableUltraSSD - } - if mcappp.EnableFIPS != nil { - objectMap["enableFIPS"] = mcappp.EnableFIPS - } - if mcappp.GpuInstanceProfile != "" { - objectMap["gpuInstanceProfile"] = mcappp.GpuInstanceProfile - } - if mcappp.CreationData != nil { - objectMap["creationData"] = mcappp.CreationData - } - if mcappp.CapacityReservationGroupID != nil { - objectMap["capacityReservationGroupID"] = mcappp.CapacityReservationGroupID - } - if mcappp.HostGroupID != nil { - objectMap["hostGroupID"] = mcappp.HostGroupID - } - return json.Marshal(objectMap) -} - -// ManagedClusterAPIServerAccessProfile access profile for managed cluster API server. -type ManagedClusterAPIServerAccessProfile struct { - // AuthorizedIPRanges - IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. This feature is not compatible with clusters that use Public IP Per Node, or clusters that are using a Basic Load Balancer. For more information see [API server authorized IP ranges](https://docs.microsoft.com/azure/aks/api-server-authorized-ip-ranges). - AuthorizedIPRanges *[]string `json:"authorizedIPRanges,omitempty"` - // EnablePrivateCluster - For more details, see [Creating a private AKS cluster](https://docs.microsoft.com/azure/aks/private-clusters). - EnablePrivateCluster *bool `json:"enablePrivateCluster,omitempty"` - // PrivateDNSZone - The default is System. For more details see [configure private DNS zone](https://docs.microsoft.com/azure/aks/private-clusters#configure-private-dns-zone). Allowed values are 'system' and 'none'. - PrivateDNSZone *string `json:"privateDNSZone,omitempty"` - // EnablePrivateClusterPublicFQDN - Whether to create additional public FQDN for private cluster or not. - EnablePrivateClusterPublicFQDN *bool `json:"enablePrivateClusterPublicFQDN,omitempty"` - // DisableRunCommand - Whether to disable run command for the cluster or not. - DisableRunCommand *bool `json:"disableRunCommand,omitempty"` -} - -// ManagedClusterAutoUpgradeProfile auto upgrade profile for a managed cluster. -type ManagedClusterAutoUpgradeProfile struct { - // UpgradeChannel - For more information see [setting the AKS cluster auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel). Possible values include: 'UpgradeChannelRapid', 'UpgradeChannelStable', 'UpgradeChannelPatch', 'UpgradeChannelNodeImage', 'UpgradeChannelNone' - UpgradeChannel UpgradeChannel `json:"upgradeChannel,omitempty"` -} - -// ManagedClusterHTTPProxyConfig cluster HTTP proxy configuration. -type ManagedClusterHTTPProxyConfig struct { - // HTTPProxy - The HTTP proxy server endpoint to use. - HTTPProxy *string `json:"httpProxy,omitempty"` - // HTTPSProxy - The HTTPS proxy server endpoint to use. - HTTPSProxy *string `json:"httpsProxy,omitempty"` - // NoProxy - The endpoints that should not go through proxy. - NoProxy *[]string `json:"noProxy,omitempty"` - // TrustedCa - Alternative CA cert to use for connecting to proxy servers. - TrustedCa *string `json:"trustedCa,omitempty"` -} - -// ManagedClusterIdentity identity for the managed cluster. -type ManagedClusterIdentity struct { - // PrincipalID - READ-ONLY; The principal id of the system assigned identity which is used by master components. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant id of the system assigned identity which is used by master components. - TenantID *string `json:"tenantId,omitempty"` - // Type - For more information see [use managed identities in AKS](https://docs.microsoft.com/azure/aks/use-managed-identity). Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeNone' - Type ResourceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*ManagedClusterIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterIdentity. -func (mci ManagedClusterIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mci.Type != "" { - objectMap["type"] = mci.Type - } - if mci.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = mci.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// ManagedClusterIdentityUserAssignedIdentitiesValue ... -type ManagedClusterIdentityUserAssignedIdentitiesValue struct { - // PrincipalID - READ-ONLY; The principal id of user assigned identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - READ-ONLY; The client id of user assigned identity. - ClientID *string `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterIdentityUserAssignedIdentitiesValue. -func (mciAiv ManagedClusterIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagedClusterListResult the response from the List Managed Clusters operation. -type ManagedClusterListResult struct { - autorest.Response `json:"-"` - // Value - The list of managed clusters. - Value *[]ManagedCluster `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of managed cluster results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterListResult. -func (mclr ManagedClusterListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mclr.Value != nil { - objectMap["value"] = mclr.Value - } - return json.Marshal(objectMap) -} - -// ManagedClusterListResultIterator provides access to a complete listing of ManagedCluster values. -type ManagedClusterListResultIterator struct { - i int - page ManagedClusterListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ManagedClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ManagedClusterListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ManagedClusterListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ManagedClusterListResultIterator) Response() ManagedClusterListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ManagedClusterListResultIterator) Value() ManagedCluster { - if !iter.page.NotDone() { - return ManagedCluster{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ManagedClusterListResultIterator type. -func NewManagedClusterListResultIterator(page ManagedClusterListResultPage) ManagedClusterListResultIterator { - return ManagedClusterListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mclr ManagedClusterListResult) IsEmpty() bool { - return mclr.Value == nil || len(*mclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mclr ManagedClusterListResult) hasNextLink() bool { - return mclr.NextLink != nil && len(*mclr.NextLink) != 0 -} - -// managedClusterListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mclr ManagedClusterListResult) managedClusterListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mclr.NextLink))) -} - -// ManagedClusterListResultPage contains a page of ManagedCluster values. -type ManagedClusterListResultPage struct { - fn func(context.Context, ManagedClusterListResult) (ManagedClusterListResult, error) - mclr ManagedClusterListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ManagedClusterListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.mclr) - if err != nil { - return err - } - page.mclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ManagedClusterListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ManagedClusterListResultPage) NotDone() bool { - return !page.mclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ManagedClusterListResultPage) Response() ManagedClusterListResult { - return page.mclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ManagedClusterListResultPage) Values() []ManagedCluster { - if page.mclr.IsEmpty() { - return nil - } - return *page.mclr.Value -} - -// Creates a new instance of the ManagedClusterListResultPage type. -func NewManagedClusterListResultPage(cur ManagedClusterListResult, getNextPage func(context.Context, ManagedClusterListResult) (ManagedClusterListResult, error)) ManagedClusterListResultPage { - return ManagedClusterListResultPage{ - fn: getNextPage, - mclr: cur, - } -} - -// ManagedClusterLoadBalancerProfile profile of the managed cluster load balancer. -type ManagedClusterLoadBalancerProfile struct { - // ManagedOutboundIPs - Desired managed outbound IPs for the cluster load balancer. - ManagedOutboundIPs *ManagedClusterLoadBalancerProfileManagedOutboundIPs `json:"managedOutboundIPs,omitempty"` - // OutboundIPPrefixes - Desired outbound IP Prefix resources for the cluster load balancer. - OutboundIPPrefixes *ManagedClusterLoadBalancerProfileOutboundIPPrefixes `json:"outboundIPPrefixes,omitempty"` - // OutboundIPs - Desired outbound IP resources for the cluster load balancer. - OutboundIPs *ManagedClusterLoadBalancerProfileOutboundIPs `json:"outboundIPs,omitempty"` - // EffectiveOutboundIPs - The effective outbound IP resources of the cluster load balancer. - EffectiveOutboundIPs *[]ResourceReference `json:"effectiveOutboundIPs,omitempty"` - // AllocatedOutboundPorts - The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in Azure dynamically allocating ports. - AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` - // IdleTimeoutInMinutes - Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 30 minutes. - IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` - // EnableMultipleStandardLoadBalancers - Enable multiple standard load balancers per AKS cluster or not. - EnableMultipleStandardLoadBalancers *bool `json:"enableMultipleStandardLoadBalancers,omitempty"` -} - -// ManagedClusterLoadBalancerProfileManagedOutboundIPs desired managed outbound IPs for the cluster load -// balancer. -type ManagedClusterLoadBalancerProfileManagedOutboundIPs struct { - // Count - The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. - Count *int32 `json:"count,omitempty"` - // CountIPv6 - The desired number of IPv6 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 0 for single-stack and 1 for dual-stack. - CountIPv6 *int32 `json:"countIPv6,omitempty"` -} - -// ManagedClusterLoadBalancerProfileOutboundIPPrefixes desired outbound IP Prefix resources for the cluster -// load balancer. -type ManagedClusterLoadBalancerProfileOutboundIPPrefixes struct { - // PublicIPPrefixes - A list of public IP prefix resources. - PublicIPPrefixes *[]ResourceReference `json:"publicIPPrefixes,omitempty"` -} - -// ManagedClusterLoadBalancerProfileOutboundIPs desired outbound IP resources for the cluster load -// balancer. -type ManagedClusterLoadBalancerProfileOutboundIPs struct { - // PublicIPs - A list of public IP resources. - PublicIPs *[]ResourceReference `json:"publicIPs,omitempty"` -} - -// ManagedClusterManagedOutboundIPProfile profile of the managed outbound IP resources of the managed -// cluster. -type ManagedClusterManagedOutboundIPProfile struct { - // Count - The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. - Count *int32 `json:"count,omitempty"` -} - -// ManagedClusterNATGatewayProfile profile of the managed cluster NAT gateway. -type ManagedClusterNATGatewayProfile struct { - // ManagedOutboundIPProfile - Profile of the managed outbound IP resources of the cluster NAT gateway. - ManagedOutboundIPProfile *ManagedClusterManagedOutboundIPProfile `json:"managedOutboundIPProfile,omitempty"` - // EffectiveOutboundIPs - The effective outbound IP resources of the cluster NAT gateway. - EffectiveOutboundIPs *[]ResourceReference `json:"effectiveOutboundIPs,omitempty"` - // IdleTimeoutInMinutes - Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 4 minutes. - IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` -} - -// ManagedClusterOIDCIssuerProfile the OIDC issuer profile of the Managed Cluster. -type ManagedClusterOIDCIssuerProfile struct { - // IssuerURL - READ-ONLY; The OIDC issuer url of the Managed Cluster. - IssuerURL *string `json:"issuerURL,omitempty"` - // Enabled - Whether the OIDC issuer is enabled. - Enabled *bool `json:"enabled,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterOIDCIssuerProfile. -func (mcoip ManagedClusterOIDCIssuerProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcoip.Enabled != nil { - objectMap["enabled"] = mcoip.Enabled - } - return json.Marshal(objectMap) -} - -// ManagedClusterPodIdentity details about the pod identity assigned to the Managed Cluster. -type ManagedClusterPodIdentity struct { - // Name - The name of the pod identity. - Name *string `json:"name,omitempty"` - // Namespace - The namespace of the pod identity. - Namespace *string `json:"namespace,omitempty"` - // BindingSelector - The binding selector to use for the AzureIdentityBinding resource. - BindingSelector *string `json:"bindingSelector,omitempty"` - // Identity - The user assigned identity details. - Identity *UserAssignedIdentity `json:"identity,omitempty"` - // ProvisioningState - READ-ONLY; The current provisioning state of the pod identity. Possible values include: 'ManagedClusterPodIdentityProvisioningStateAssigned', 'ManagedClusterPodIdentityProvisioningStateUpdating', 'ManagedClusterPodIdentityProvisioningStateDeleting', 'ManagedClusterPodIdentityProvisioningStateFailed' - ProvisioningState ManagedClusterPodIdentityProvisioningState `json:"provisioningState,omitempty"` - // ProvisioningInfo - READ-ONLY - ProvisioningInfo *ManagedClusterPodIdentityProvisioningInfo `json:"provisioningInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterPodIdentity. -func (mcpi ManagedClusterPodIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcpi.Name != nil { - objectMap["name"] = mcpi.Name - } - if mcpi.Namespace != nil { - objectMap["namespace"] = mcpi.Namespace - } - if mcpi.BindingSelector != nil { - objectMap["bindingSelector"] = mcpi.BindingSelector - } - if mcpi.Identity != nil { - objectMap["identity"] = mcpi.Identity - } - return json.Marshal(objectMap) -} - -// ManagedClusterPodIdentityException see [disable AAD Pod Identity for a specific -// Pod/Application](https://azure.github.io/aad-pod-identity/docs/configure/application_exception/) for -// more details. -type ManagedClusterPodIdentityException struct { - // Name - The name of the pod identity exception. - Name *string `json:"name,omitempty"` - // Namespace - The namespace of the pod identity exception. - Namespace *string `json:"namespace,omitempty"` - // PodLabels - The pod labels to match. - PodLabels map[string]*string `json:"podLabels"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterPodIdentityException. -func (mcpie ManagedClusterPodIdentityException) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcpie.Name != nil { - objectMap["name"] = mcpie.Name - } - if mcpie.Namespace != nil { - objectMap["namespace"] = mcpie.Namespace - } - if mcpie.PodLabels != nil { - objectMap["podLabels"] = mcpie.PodLabels - } - return json.Marshal(objectMap) -} - -// ManagedClusterPodIdentityProfile see [use AAD pod -// identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on pod -// identity integration. -type ManagedClusterPodIdentityProfile struct { - // Enabled - Whether the pod identity addon is enabled. - Enabled *bool `json:"enabled,omitempty"` - // AllowNetworkPluginKubenet - Running in Kubenet is disabled by default due to the security related nature of AAD Pod Identity and the risks of IP spoofing. See [using Kubenet network plugin with AAD Pod Identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity#using-kubenet-network-plugin-with-azure-active-directory-pod-managed-identities) for more information. - AllowNetworkPluginKubenet *bool `json:"allowNetworkPluginKubenet,omitempty"` - // UserAssignedIdentities - The pod identities to use in the cluster. - UserAssignedIdentities *[]ManagedClusterPodIdentity `json:"userAssignedIdentities,omitempty"` - // UserAssignedIdentityExceptions - The pod identity exceptions to allow. - UserAssignedIdentityExceptions *[]ManagedClusterPodIdentityException `json:"userAssignedIdentityExceptions,omitempty"` -} - -// ManagedClusterPodIdentityProvisioningError an error response from the pod identity provisioning. -type ManagedClusterPodIdentityProvisioningError struct { - // Error - Details about the error. - Error *ManagedClusterPodIdentityProvisioningErrorBody `json:"error,omitempty"` -} - -// ManagedClusterPodIdentityProvisioningErrorBody an error response from the pod identity provisioning. -type ManagedClusterPodIdentityProvisioningErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]ManagedClusterPodIdentityProvisioningErrorBody `json:"details,omitempty"` -} - -// ManagedClusterPodIdentityProvisioningInfo ... -type ManagedClusterPodIdentityProvisioningInfo struct { - // Error - Pod identity assignment error (if any). - Error *ManagedClusterPodIdentityProvisioningError `json:"error,omitempty"` -} - -// ManagedClusterPoolUpgradeProfile the list of available upgrade versions. -type ManagedClusterPoolUpgradeProfile struct { - // KubernetesVersion - The Kubernetes version (major.minor.patch). - KubernetesVersion *string `json:"kubernetesVersion,omitempty"` - // Name - The Agent Pool name. - Name *string `json:"name,omitempty"` - // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' - OsType OSType `json:"osType,omitempty"` - // Upgrades - List of orchestrator types and versions available for upgrade. - Upgrades *[]ManagedClusterPoolUpgradeProfileUpgradesItem `json:"upgrades,omitempty"` -} - -// ManagedClusterPoolUpgradeProfileUpgradesItem ... -type ManagedClusterPoolUpgradeProfileUpgradesItem struct { - // KubernetesVersion - The Kubernetes version (major.minor.patch). - KubernetesVersion *string `json:"kubernetesVersion,omitempty"` - // IsPreview - Whether the Kubernetes version is currently in preview. - IsPreview *bool `json:"isPreview,omitempty"` -} - -// ManagedClusterProperties properties of the managed cluster. -type ManagedClusterProperties struct { - // ProvisioningState - READ-ONLY; The current provisioning state. - ProvisioningState *string `json:"provisioningState,omitempty"` - // PowerState - READ-ONLY; The Power State of the cluster. - PowerState *PowerState `json:"powerState,omitempty"` - // MaxAgentPools - READ-ONLY; The max number of agent pools for the managed cluster. - MaxAgentPools *int32 `json:"maxAgentPools,omitempty"` - // KubernetesVersion - When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See [upgrading an AKS cluster](https://docs.microsoft.com/azure/aks/upgrade-cluster) for more details. - KubernetesVersion *string `json:"kubernetesVersion,omitempty"` - // CurrentKubernetesVersion - READ-ONLY; The version of Kubernetes the Managed Cluster is running. - CurrentKubernetesVersion *string `json:"currentKubernetesVersion,omitempty"` - // DNSPrefix - This cannot be updated once the Managed Cluster has been created. - DNSPrefix *string `json:"dnsPrefix,omitempty"` - // FqdnSubdomain - This cannot be updated once the Managed Cluster has been created. - FqdnSubdomain *string `json:"fqdnSubdomain,omitempty"` - // Fqdn - READ-ONLY; The FQDN of the master pool. - Fqdn *string `json:"fqdn,omitempty"` - // PrivateFQDN - READ-ONLY; The FQDN of private cluster. - PrivateFQDN *string `json:"privateFQDN,omitempty"` - // AzurePortalFQDN - READ-ONLY; The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) headers to be sent in some responses, which Kubernetes APIServer doesn't handle by default. This special FQDN supports CORS, allowing the Azure Portal to function properly. - AzurePortalFQDN *string `json:"azurePortalFQDN,omitempty"` - // AgentPoolProfiles - The agent pool properties. - AgentPoolProfiles *[]ManagedClusterAgentPoolProfile `json:"agentPoolProfiles,omitempty"` - // LinuxProfile - The profile for Linux VMs in the Managed Cluster. - LinuxProfile *LinuxProfile `json:"linuxProfile,omitempty"` - // WindowsProfile - The profile for Windows VMs in the Managed Cluster. - WindowsProfile *ManagedClusterWindowsProfile `json:"windowsProfile,omitempty"` - // ServicePrincipalProfile - Information about a service principal identity for the cluster to use for manipulating Azure APIs. - ServicePrincipalProfile *ManagedClusterServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"` - // AddonProfiles - The profile of managed cluster add-on. - AddonProfiles map[string]*ManagedClusterAddonProfile `json:"addonProfiles"` - // PodIdentityProfile - See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on AAD pod identity integration. - PodIdentityProfile *ManagedClusterPodIdentityProfile `json:"podIdentityProfile,omitempty"` - // OidcIssuerProfile - The OIDC issuer profile of the Managed Cluster. - OidcIssuerProfile *ManagedClusterOIDCIssuerProfile `json:"oidcIssuerProfile,omitempty"` - // NodeResourceGroup - The name of the resource group containing agent pool nodes. - NodeResourceGroup *string `json:"nodeResourceGroup,omitempty"` - // EnableRBAC - Whether to enable Kubernetes Role-Based Access Control. - EnableRBAC *bool `json:"enableRBAC,omitempty"` - // EnablePodSecurityPolicy - (DEPRECATING) Whether to enable Kubernetes pod security policy (preview). This feature is set for removal on October 15th, 2020. Learn more at aka.ms/aks/azpodpolicy. - EnablePodSecurityPolicy *bool `json:"enablePodSecurityPolicy,omitempty"` - // EnableNamespaceResources - The default value is false. It can be enabled/disabled on creation and updation of the managed cluster. See [https://aka.ms/NamespaceARMResource](https://aka.ms/NamespaceARMResource) for more details on Namespace as a ARM Resource. - EnableNamespaceResources *bool `json:"enableNamespaceResources,omitempty"` - // NetworkProfile - The network configuration profile. - NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` - // AadProfile - The Azure Active Directory configuration. - AadProfile *ManagedClusterAADProfile `json:"aadProfile,omitempty"` - // AutoUpgradeProfile - The auto upgrade configuration. - AutoUpgradeProfile *ManagedClusterAutoUpgradeProfile `json:"autoUpgradeProfile,omitempty"` - // AutoScalerProfile - Parameters to be applied to the cluster-autoscaler when enabled - AutoScalerProfile *ManagedClusterPropertiesAutoScalerProfile `json:"autoScalerProfile,omitempty"` - // APIServerAccessProfile - The access profile for managed cluster API server. - APIServerAccessProfile *ManagedClusterAPIServerAccessProfile `json:"apiServerAccessProfile,omitempty"` - // DiskEncryptionSetID - This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}' - DiskEncryptionSetID *string `json:"diskEncryptionSetID,omitempty"` - // IdentityProfile - Identities associated with the cluster. - IdentityProfile map[string]*UserAssignedIdentity `json:"identityProfile"` - // PrivateLinkResources - Private link resources associated with the cluster. - PrivateLinkResources *[]PrivateLinkResource `json:"privateLinkResources,omitempty"` - // DisableLocalAccounts - If set to true, getting static credentials will be disabled for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details see [disable local accounts](https://docs.microsoft.com/azure/aks/managed-aad#disable-local-accounts-preview). - DisableLocalAccounts *bool `json:"disableLocalAccounts,omitempty"` - // HTTPProxyConfig - Configurations for provisioning the cluster with HTTP proxy servers. - HTTPProxyConfig *ManagedClusterHTTPProxyConfig `json:"httpProxyConfig,omitempty"` - // SecurityProfile - Security profile for the managed cluster. - SecurityProfile *ManagedClusterSecurityProfile `json:"securityProfile,omitempty"` - // PublicNetworkAccess - Allow or deny public network access for AKS. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterProperties. -func (mcp ManagedClusterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcp.KubernetesVersion != nil { - objectMap["kubernetesVersion"] = mcp.KubernetesVersion - } - if mcp.DNSPrefix != nil { - objectMap["dnsPrefix"] = mcp.DNSPrefix - } - if mcp.FqdnSubdomain != nil { - objectMap["fqdnSubdomain"] = mcp.FqdnSubdomain - } - if mcp.AgentPoolProfiles != nil { - objectMap["agentPoolProfiles"] = mcp.AgentPoolProfiles - } - if mcp.LinuxProfile != nil { - objectMap["linuxProfile"] = mcp.LinuxProfile - } - if mcp.WindowsProfile != nil { - objectMap["windowsProfile"] = mcp.WindowsProfile - } - if mcp.ServicePrincipalProfile != nil { - objectMap["servicePrincipalProfile"] = mcp.ServicePrincipalProfile - } - if mcp.AddonProfiles != nil { - objectMap["addonProfiles"] = mcp.AddonProfiles - } - if mcp.PodIdentityProfile != nil { - objectMap["podIdentityProfile"] = mcp.PodIdentityProfile - } - if mcp.OidcIssuerProfile != nil { - objectMap["oidcIssuerProfile"] = mcp.OidcIssuerProfile - } - if mcp.NodeResourceGroup != nil { - objectMap["nodeResourceGroup"] = mcp.NodeResourceGroup - } - if mcp.EnableRBAC != nil { - objectMap["enableRBAC"] = mcp.EnableRBAC - } - if mcp.EnablePodSecurityPolicy != nil { - objectMap["enablePodSecurityPolicy"] = mcp.EnablePodSecurityPolicy - } - if mcp.EnableNamespaceResources != nil { - objectMap["enableNamespaceResources"] = mcp.EnableNamespaceResources - } - if mcp.NetworkProfile != nil { - objectMap["networkProfile"] = mcp.NetworkProfile - } - if mcp.AadProfile != nil { - objectMap["aadProfile"] = mcp.AadProfile - } - if mcp.AutoUpgradeProfile != nil { - objectMap["autoUpgradeProfile"] = mcp.AutoUpgradeProfile - } - if mcp.AutoScalerProfile != nil { - objectMap["autoScalerProfile"] = mcp.AutoScalerProfile - } - if mcp.APIServerAccessProfile != nil { - objectMap["apiServerAccessProfile"] = mcp.APIServerAccessProfile - } - if mcp.DiskEncryptionSetID != nil { - objectMap["diskEncryptionSetID"] = mcp.DiskEncryptionSetID - } - if mcp.IdentityProfile != nil { - objectMap["identityProfile"] = mcp.IdentityProfile - } - if mcp.PrivateLinkResources != nil { - objectMap["privateLinkResources"] = mcp.PrivateLinkResources - } - if mcp.DisableLocalAccounts != nil { - objectMap["disableLocalAccounts"] = mcp.DisableLocalAccounts - } - if mcp.HTTPProxyConfig != nil { - objectMap["httpProxyConfig"] = mcp.HTTPProxyConfig - } - if mcp.SecurityProfile != nil { - objectMap["securityProfile"] = mcp.SecurityProfile - } - if mcp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = mcp.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// ManagedClusterPropertiesAutoScalerProfile parameters to be applied to the cluster-autoscaler when -// enabled -type ManagedClusterPropertiesAutoScalerProfile struct { - // BalanceSimilarNodeGroups - Valid values are 'true' and 'false' - BalanceSimilarNodeGroups *string `json:"balance-similar-node-groups,omitempty"` - // Expander - If not specified, the default is 'random'. See [expanders](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders) for more information. Possible values include: 'ExpanderLeastWaste', 'ExpanderMostPods', 'ExpanderPriority', 'ExpanderRandom' - Expander Expander `json:"expander,omitempty"` - // MaxEmptyBulkDelete - The default is 10. - MaxEmptyBulkDelete *string `json:"max-empty-bulk-delete,omitempty"` - // MaxGracefulTerminationSec - The default is 600. - MaxGracefulTerminationSec *string `json:"max-graceful-termination-sec,omitempty"` - // MaxNodeProvisionTime - The default is '15m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - MaxNodeProvisionTime *string `json:"max-node-provision-time,omitempty"` - // MaxTotalUnreadyPercentage - The default is 45. The maximum is 100 and the minimum is 0. - MaxTotalUnreadyPercentage *string `json:"max-total-unready-percentage,omitempty"` - // NewPodScaleUpDelay - For scenarios like burst/batch scale where you don't want CA to act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc). - NewPodScaleUpDelay *string `json:"new-pod-scale-up-delay,omitempty"` - // OkTotalUnreadyCount - This must be an integer. The default is 3. - OkTotalUnreadyCount *string `json:"ok-total-unready-count,omitempty"` - // ScanInterval - The default is '10'. Values must be an integer number of seconds. - ScanInterval *string `json:"scan-interval,omitempty"` - // ScaleDownDelayAfterAdd - The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - ScaleDownDelayAfterAdd *string `json:"scale-down-delay-after-add,omitempty"` - // ScaleDownDelayAfterDelete - The default is the scan-interval. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - ScaleDownDelayAfterDelete *string `json:"scale-down-delay-after-delete,omitempty"` - // ScaleDownDelayAfterFailure - The default is '3m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - ScaleDownDelayAfterFailure *string `json:"scale-down-delay-after-failure,omitempty"` - // ScaleDownUnneededTime - The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - ScaleDownUnneededTime *string `json:"scale-down-unneeded-time,omitempty"` - // ScaleDownUnreadyTime - The default is '20m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - ScaleDownUnreadyTime *string `json:"scale-down-unready-time,omitempty"` - // ScaleDownUtilizationThreshold - The default is '0.5'. - ScaleDownUtilizationThreshold *string `json:"scale-down-utilization-threshold,omitempty"` - // SkipNodesWithLocalStorage - The default is true. - SkipNodesWithLocalStorage *string `json:"skip-nodes-with-local-storage,omitempty"` - // SkipNodesWithSystemPods - The default is true. - SkipNodesWithSystemPods *string `json:"skip-nodes-with-system-pods,omitempty"` -} - -// ManagedClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedClustersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedClustersClient) (ManagedCluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedClustersCreateOrUpdateFuture.Result. -func (future *ManagedClustersCreateOrUpdateFuture) result(client ManagedClustersClient) (mc ManagedCluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mc.Response.Response, err = future.GetResult(sender); err == nil && mc.Response.Response.StatusCode != http.StatusNoContent { - mc, err = client.CreateOrUpdateResponder(mc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersCreateOrUpdateFuture", "Result", mc.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagedClustersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedClustersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedClustersDeleteFuture.Result. -func (future *ManagedClustersDeleteFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedClusterSecurityProfile security profile for the container service cluster. -type ManagedClusterSecurityProfile struct { - // AzureDefender - Azure Defender settings for the security profile. - AzureDefender *ManagedClusterSecurityProfileAzureDefender `json:"azureDefender,omitempty"` -} - -// ManagedClusterSecurityProfileAzureDefender azure Defender settings for the security profile. -type ManagedClusterSecurityProfileAzureDefender struct { - // Enabled - Whether to enable Azure Defender - Enabled *bool `json:"enabled,omitempty"` - // LogAnalyticsWorkspaceResourceID - Resource ID of the Log Analytics workspace to be associated with Azure Defender. When Azure Defender is enabled, this field is required and must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty. - LogAnalyticsWorkspaceResourceID *string `json:"logAnalyticsWorkspaceResourceId,omitempty"` -} - -// ManagedClusterServicePrincipalProfile information about a service principal identity for the cluster to -// use for manipulating Azure APIs. -type ManagedClusterServicePrincipalProfile struct { - // ClientID - The ID for the service principal. - ClientID *string `json:"clientId,omitempty"` - // Secret - The secret password associated with the service principal in plain text. - Secret *string `json:"secret,omitempty"` -} - -// ManagedClusterSKU the SKU of a Managed Cluster. -type ManagedClusterSKU struct { - // Name - The name of a managed cluster SKU. Possible values include: 'ManagedClusterSKUNameBasic' - Name ManagedClusterSKUName `json:"name,omitempty"` - // Tier - If not specified, the default is 'Free'. See [uptime SLA](https://docs.microsoft.com/azure/aks/uptime-sla) for more details. Possible values include: 'ManagedClusterSKUTierPaid', 'ManagedClusterSKUTierFree' - Tier ManagedClusterSKUTier `json:"tier,omitempty"` -} - -// ManagedClustersResetAADProfileFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedClustersResetAADProfileFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedClustersResetAADProfileFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedClustersResetAADProfileFuture.Result. -func (future *ManagedClustersResetAADProfileFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersResetAADProfileFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersResetAADProfileFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedClustersResetServicePrincipalProfileFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type ManagedClustersResetServicePrincipalProfileFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedClustersResetServicePrincipalProfileFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedClustersResetServicePrincipalProfileFuture.Result. -func (future *ManagedClustersResetServicePrincipalProfileFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersResetServicePrincipalProfileFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersResetServicePrincipalProfileFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedClustersRotateClusterCertificatesFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type ManagedClustersRotateClusterCertificatesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedClustersRotateClusterCertificatesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedClustersRotateClusterCertificatesFuture.Result. -func (future *ManagedClustersRotateClusterCertificatesFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRotateClusterCertificatesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersRotateClusterCertificatesFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedClustersRunCommandFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedClustersRunCommandFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedClustersClient) (RunCommandResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedClustersRunCommandFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedClustersRunCommandFuture.Result. -func (future *ManagedClustersRunCommandFuture) result(client ManagedClustersClient) (rcr RunCommandResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRunCommandFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - rcr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersRunCommandFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rcr.Response.Response, err = future.GetResult(sender); err == nil && rcr.Response.Response.StatusCode != http.StatusNoContent { - rcr, err = client.RunCommandResponder(rcr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRunCommandFuture", "Result", rcr.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedClustersStartFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagedClustersStartFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedClustersStartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedClustersStartFuture.Result. -func (future *ManagedClustersStartFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersStartFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedClustersStopFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ManagedClustersStopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedClustersStopFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedClustersStopFuture.Result. -func (future *ManagedClustersStopFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersStopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersStopFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedClustersUpdateTagsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedClustersUpdateTagsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedClustersClient) (ManagedCluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedClustersUpdateTagsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedClustersUpdateTagsFuture.Result. -func (future *ManagedClustersUpdateTagsFuture) result(client ManagedClustersClient) (mc ManagedCluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersUpdateTagsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mc.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersUpdateTagsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mc.Response.Response, err = future.GetResult(sender); err == nil && mc.Response.Response.StatusCode != http.StatusNoContent { - mc, err = client.UpdateTagsResponder(mc.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersUpdateTagsFuture", "Result", mc.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedClusterUpgradeProfile the list of available upgrades for compute pools. -type ManagedClusterUpgradeProfile struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The ID of the upgrade profile. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the upgrade profile. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the upgrade profile. - Type *string `json:"type,omitempty"` - // ManagedClusterUpgradeProfileProperties - The properties of the upgrade profile. - *ManagedClusterUpgradeProfileProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedClusterUpgradeProfile. -func (mcup ManagedClusterUpgradeProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcup.ManagedClusterUpgradeProfileProperties != nil { - objectMap["properties"] = mcup.ManagedClusterUpgradeProfileProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedClusterUpgradeProfile struct. -func (mcup *ManagedClusterUpgradeProfile) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mcup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mcup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mcup.Type = &typeVar - } - case "properties": - if v != nil { - var managedClusterUpgradeProfileProperties ManagedClusterUpgradeProfileProperties - err = json.Unmarshal(*v, &managedClusterUpgradeProfileProperties) - if err != nil { - return err - } - mcup.ManagedClusterUpgradeProfileProperties = &managedClusterUpgradeProfileProperties - } - } - } - - return nil -} - -// ManagedClusterUpgradeProfileProperties control plane and agent pool upgrade profiles. -type ManagedClusterUpgradeProfileProperties struct { - // ControlPlaneProfile - The list of available upgrade versions for the control plane. - ControlPlaneProfile *ManagedClusterPoolUpgradeProfile `json:"controlPlaneProfile,omitempty"` - // AgentPoolProfiles - The list of available upgrade versions for agent pools. - AgentPoolProfiles *[]ManagedClusterPoolUpgradeProfile `json:"agentPoolProfiles,omitempty"` -} - -// ManagedClusterWindowsProfile profile for Windows VMs in the managed cluster. -type ManagedClusterWindowsProfile struct { - // AdminUsername - Specifies the name of the administrator account.

**Restriction:** Cannot end in "."

**Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5".

**Minimum-length:** 1 character

**Max-length:** 20 characters - AdminUsername *string `json:"adminUsername,omitempty"` - // AdminPassword - Specifies the password of the administrator account.

**Minimum-length:** 8 characters

**Max-length:** 123 characters

**Complexity requirements:** 3 out of 4 conditions below need to be fulfilled
Has lower characters
Has upper characters
Has a digit
Has a special character (Regex match [\W_])

**Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" - AdminPassword *string `json:"adminPassword,omitempty"` - // LicenseType - The license type to use for Windows VMs. See [Azure Hybrid User Benefits](https://azure.microsoft.com/pricing/hybrid-benefit/faq/) for more details. Possible values include: 'LicenseTypeNone', 'LicenseTypeWindowsServer' - LicenseType LicenseType `json:"licenseType,omitempty"` - // EnableCSIProxy - For more details on CSI proxy, see the [CSI proxy GitHub repo](https://github.com/kubernetes-csi/csi-proxy). - EnableCSIProxy *bool `json:"enableCSIProxy,omitempty"` - // GmsaProfile - The Windows gMSA Profile in the Managed Cluster. - GmsaProfile *WindowsGmsaProfile `json:"gmsaProfile,omitempty"` -} - -// MasterProfile profile for the container service master. -type MasterProfile struct { - // Count - Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. - Count *int32 `json:"count,omitempty"` - // DNSPrefix - DNS prefix to be used to create the FQDN for the master pool. - DNSPrefix *string `json:"dnsPrefix,omitempty"` - // VMSize - Size of agent VMs. Possible values include: 'VMSizeTypesStandardA1', 'VMSizeTypesStandardA10', 'VMSizeTypesStandardA11', 'VMSizeTypesStandardA1V2', 'VMSizeTypesStandardA2', 'VMSizeTypesStandardA2V2', 'VMSizeTypesStandardA2mV2', 'VMSizeTypesStandardA3', 'VMSizeTypesStandardA4', 'VMSizeTypesStandardA4V2', 'VMSizeTypesStandardA4mV2', 'VMSizeTypesStandardA5', 'VMSizeTypesStandardA6', 'VMSizeTypesStandardA7', 'VMSizeTypesStandardA8', 'VMSizeTypesStandardA8V2', 'VMSizeTypesStandardA8mV2', 'VMSizeTypesStandardA9', 'VMSizeTypesStandardB2ms', 'VMSizeTypesStandardB2s', 'VMSizeTypesStandardB4ms', 'VMSizeTypesStandardB8ms', 'VMSizeTypesStandardD1', 'VMSizeTypesStandardD11', 'VMSizeTypesStandardD11V2', 'VMSizeTypesStandardD11V2Promo', 'VMSizeTypesStandardD12', 'VMSizeTypesStandardD12V2', 'VMSizeTypesStandardD12V2Promo', 'VMSizeTypesStandardD13', 'VMSizeTypesStandardD13V2', 'VMSizeTypesStandardD13V2Promo', 'VMSizeTypesStandardD14', 'VMSizeTypesStandardD14V2', 'VMSizeTypesStandardD14V2Promo', 'VMSizeTypesStandardD15V2', 'VMSizeTypesStandardD16V3', 'VMSizeTypesStandardD16sV3', 'VMSizeTypesStandardD1V2', 'VMSizeTypesStandardD2', 'VMSizeTypesStandardD2V2', 'VMSizeTypesStandardD2V2Promo', 'VMSizeTypesStandardD2V3', 'VMSizeTypesStandardD2sV3', 'VMSizeTypesStandardD3', 'VMSizeTypesStandardD32V3', 'VMSizeTypesStandardD32sV3', 'VMSizeTypesStandardD3V2', 'VMSizeTypesStandardD3V2Promo', 'VMSizeTypesStandardD4', 'VMSizeTypesStandardD4V2', 'VMSizeTypesStandardD4V2Promo', 'VMSizeTypesStandardD4V3', 'VMSizeTypesStandardD4sV3', 'VMSizeTypesStandardD5V2', 'VMSizeTypesStandardD5V2Promo', 'VMSizeTypesStandardD64V3', 'VMSizeTypesStandardD64sV3', 'VMSizeTypesStandardD8V3', 'VMSizeTypesStandardD8sV3', 'VMSizeTypesStandardDS1', 'VMSizeTypesStandardDS11', 'VMSizeTypesStandardDS11V2', 'VMSizeTypesStandardDS11V2Promo', 'VMSizeTypesStandardDS12', 'VMSizeTypesStandardDS12V2', 'VMSizeTypesStandardDS12V2Promo', 'VMSizeTypesStandardDS13', 'VMSizeTypesStandardDS132V2', 'VMSizeTypesStandardDS134V2', 'VMSizeTypesStandardDS13V2', 'VMSizeTypesStandardDS13V2Promo', 'VMSizeTypesStandardDS14', 'VMSizeTypesStandardDS144V2', 'VMSizeTypesStandardDS148V2', 'VMSizeTypesStandardDS14V2', 'VMSizeTypesStandardDS14V2Promo', 'VMSizeTypesStandardDS15V2', 'VMSizeTypesStandardDS1V2', 'VMSizeTypesStandardDS2', 'VMSizeTypesStandardDS2V2', 'VMSizeTypesStandardDS2V2Promo', 'VMSizeTypesStandardDS3', 'VMSizeTypesStandardDS3V2', 'VMSizeTypesStandardDS3V2Promo', 'VMSizeTypesStandardDS4', 'VMSizeTypesStandardDS4V2', 'VMSizeTypesStandardDS4V2Promo', 'VMSizeTypesStandardDS5V2', 'VMSizeTypesStandardDS5V2Promo', 'VMSizeTypesStandardE16V3', 'VMSizeTypesStandardE16sV3', 'VMSizeTypesStandardE2V3', 'VMSizeTypesStandardE2sV3', 'VMSizeTypesStandardE3216sV3', 'VMSizeTypesStandardE328sV3', 'VMSizeTypesStandardE32V3', 'VMSizeTypesStandardE32sV3', 'VMSizeTypesStandardE4V3', 'VMSizeTypesStandardE4sV3', 'VMSizeTypesStandardE6416sV3', 'VMSizeTypesStandardE6432sV3', 'VMSizeTypesStandardE64V3', 'VMSizeTypesStandardE64sV3', 'VMSizeTypesStandardE8V3', 'VMSizeTypesStandardE8sV3', 'VMSizeTypesStandardF1', 'VMSizeTypesStandardF16', 'VMSizeTypesStandardF16s', 'VMSizeTypesStandardF16sV2', 'VMSizeTypesStandardF1s', 'VMSizeTypesStandardF2', 'VMSizeTypesStandardF2s', 'VMSizeTypesStandardF2sV2', 'VMSizeTypesStandardF32sV2', 'VMSizeTypesStandardF4', 'VMSizeTypesStandardF4s', 'VMSizeTypesStandardF4sV2', 'VMSizeTypesStandardF64sV2', 'VMSizeTypesStandardF72sV2', 'VMSizeTypesStandardF8', 'VMSizeTypesStandardF8s', 'VMSizeTypesStandardF8sV2', 'VMSizeTypesStandardG1', 'VMSizeTypesStandardG2', 'VMSizeTypesStandardG3', 'VMSizeTypesStandardG4', 'VMSizeTypesStandardG5', 'VMSizeTypesStandardGS1', 'VMSizeTypesStandardGS2', 'VMSizeTypesStandardGS3', 'VMSizeTypesStandardGS4', 'VMSizeTypesStandardGS44', 'VMSizeTypesStandardGS48', 'VMSizeTypesStandardGS5', 'VMSizeTypesStandardGS516', 'VMSizeTypesStandardGS58', 'VMSizeTypesStandardH16', 'VMSizeTypesStandardH16m', 'VMSizeTypesStandardH16mr', 'VMSizeTypesStandardH16r', 'VMSizeTypesStandardH8', 'VMSizeTypesStandardH8m', 'VMSizeTypesStandardL16s', 'VMSizeTypesStandardL32s', 'VMSizeTypesStandardL4s', 'VMSizeTypesStandardL8s', 'VMSizeTypesStandardM12832ms', 'VMSizeTypesStandardM12864ms', 'VMSizeTypesStandardM128ms', 'VMSizeTypesStandardM128s', 'VMSizeTypesStandardM6416ms', 'VMSizeTypesStandardM6432ms', 'VMSizeTypesStandardM64ms', 'VMSizeTypesStandardM64s', 'VMSizeTypesStandardNC12', 'VMSizeTypesStandardNC12sV2', 'VMSizeTypesStandardNC12sV3', 'VMSizeTypesStandardNC24', 'VMSizeTypesStandardNC24r', 'VMSizeTypesStandardNC24rsV2', 'VMSizeTypesStandardNC24rsV3', 'VMSizeTypesStandardNC24sV2', 'VMSizeTypesStandardNC24sV3', 'VMSizeTypesStandardNC6', 'VMSizeTypesStandardNC6sV2', 'VMSizeTypesStandardNC6sV3', 'VMSizeTypesStandardND12s', 'VMSizeTypesStandardND24rs', 'VMSizeTypesStandardND24s', 'VMSizeTypesStandardND6s', 'VMSizeTypesStandardNV12', 'VMSizeTypesStandardNV24', 'VMSizeTypesStandardNV6' - VMSize VMSizeTypes `json:"vmSize,omitempty"` - // OsDiskSizeGB - OS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. - OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` - // VnetSubnetID - VNet SubnetID specifies the VNet's subnet identifier. - VnetSubnetID *string `json:"vnetSubnetID,omitempty"` - // FirstConsecutiveStaticIP - FirstConsecutiveStaticIP used to specify the first static ip of masters. - FirstConsecutiveStaticIP *string `json:"firstConsecutiveStaticIP,omitempty"` - // StorageProfile - Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. Possible values include: 'StorageProfileTypesStorageAccount', 'StorageProfileTypesManagedDisks' - StorageProfile StorageProfileTypes `json:"storageProfile,omitempty"` - // Fqdn - READ-ONLY; FQDN for the master pool. - Fqdn *string `json:"fqdn,omitempty"` -} - -// MarshalJSON is the custom marshaler for MasterProfile. -func (mp MasterProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mp.Count != nil { - objectMap["count"] = mp.Count - } - if mp.DNSPrefix != nil { - objectMap["dnsPrefix"] = mp.DNSPrefix - } - if mp.VMSize != "" { - objectMap["vmSize"] = mp.VMSize - } - if mp.OsDiskSizeGB != nil { - objectMap["osDiskSizeGB"] = mp.OsDiskSizeGB - } - if mp.VnetSubnetID != nil { - objectMap["vnetSubnetID"] = mp.VnetSubnetID - } - if mp.FirstConsecutiveStaticIP != nil { - objectMap["firstConsecutiveStaticIP"] = mp.FirstConsecutiveStaticIP - } - if mp.StorageProfile != "" { - objectMap["storageProfile"] = mp.StorageProfile - } - return json.Marshal(objectMap) -} - -// NetworkProfile profile of network configuration. -type NetworkProfile struct { - // NetworkPlugin - Network plugin used for building the Kubernetes network. Possible values include: 'NetworkPluginAzure', 'NetworkPluginKubenet', 'NetworkPluginNone' - NetworkPlugin NetworkPlugin `json:"networkPlugin,omitempty"` - // NetworkPolicy - Network policy used for building the Kubernetes network. Possible values include: 'NetworkPolicyCalico', 'NetworkPolicyAzure' - NetworkPolicy NetworkPolicy `json:"networkPolicy,omitempty"` - // NetworkMode - This cannot be specified if networkPlugin is anything other than 'azure'. Possible values include: 'NetworkModeTransparent', 'NetworkModeBridge' - NetworkMode NetworkMode `json:"networkMode,omitempty"` - // PodCidr - A CIDR notation IP range from which to assign pod IPs when kubenet is used. - PodCidr *string `json:"podCidr,omitempty"` - // ServiceCidr - A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges. - ServiceCidr *string `json:"serviceCidr,omitempty"` - // DNSServiceIP - An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr. - DNSServiceIP *string `json:"dnsServiceIP,omitempty"` - // DockerBridgeCidr - A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. - DockerBridgeCidr *string `json:"dockerBridgeCidr,omitempty"` - // OutboundType - This can only be set at cluster creation time and cannot be changed later. For more information see [egress outbound type](https://docs.microsoft.com/azure/aks/egress-outboundtype). Possible values include: 'OutboundTypeLoadBalancer', 'OutboundTypeUserDefinedRouting', 'OutboundTypeManagedNATGateway', 'OutboundTypeUserAssignedNATGateway' - OutboundType OutboundType `json:"outboundType,omitempty"` - // LoadBalancerSku - The default is 'standard'. See [Azure Load Balancer SKUs](https://docs.microsoft.com/azure/load-balancer/skus) for more information about the differences between load balancer SKUs. Possible values include: 'LoadBalancerSkuStandard', 'LoadBalancerSkuBasic' - LoadBalancerSku LoadBalancerSku `json:"loadBalancerSku,omitempty"` - // LoadBalancerProfile - Profile of the cluster load balancer. - LoadBalancerProfile *ManagedClusterLoadBalancerProfile `json:"loadBalancerProfile,omitempty"` - // NatGatewayProfile - Profile of the cluster NAT gateway. - NatGatewayProfile *ManagedClusterNATGatewayProfile `json:"natGatewayProfile,omitempty"` - // PodCidrs - One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. - PodCidrs *[]string `json:"podCidrs,omitempty"` - // ServiceCidrs - One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap with any Subnet IP ranges. - ServiceCidrs *[]string `json:"serviceCidrs,omitempty"` - // IPFamilies - IP families are used to determine single-stack or dual-stack clusters. For single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and IPv6. - IPFamilies *[]IPFamily `json:"ipFamilies,omitempty"` -} - -// OperationListResult the List Operation response. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; The list of operations - Value *[]OperationValue `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationValue describes the properties of a Operation value. -type OperationValue struct { - // Origin - READ-ONLY; The origin of the operation. - Origin *string `json:"origin,omitempty"` - // Name - READ-ONLY; The name of the operation. - Name *string `json:"name,omitempty"` - // OperationValueDisplay - Describes the properties of a Operation Value Display. - *OperationValueDisplay `json:"display,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationValue. -func (ov OperationValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ov.OperationValueDisplay != nil { - objectMap["display"] = ov.OperationValueDisplay - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationValue struct. -func (ov *OperationValue) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - ov.Origin = &origin - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ov.Name = &name - } - case "display": - if v != nil { - var operationValueDisplay OperationValueDisplay - err = json.Unmarshal(*v, &operationValueDisplay) - if err != nil { - return err - } - ov.OperationValueDisplay = &operationValueDisplay - } - } - } - - return nil -} - -// OperationValueDisplay describes the properties of a Operation Value Display. -type OperationValueDisplay struct { - // Operation - READ-ONLY; The display name of the operation. - Operation *string `json:"operation,omitempty"` - // Resource - READ-ONLY; The display name of the resource the operation applies to. - Resource *string `json:"resource,omitempty"` - // Description - READ-ONLY; The description of the operation. - Description *string `json:"description,omitempty"` - // Provider - READ-ONLY; The resource provider for the operation. - Provider *string `json:"provider,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationValueDisplay. -func (ovd OperationValueDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OSOptionProfile the OS option profile. -type OSOptionProfile struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The ID of the OS option resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the OS option resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the OS option resource. - Type *string `json:"type,omitempty"` - // OSOptionPropertyList - The list of OS options. - *OSOptionPropertyList `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for OSOptionProfile. -func (oop OSOptionProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oop.OSOptionPropertyList != nil { - objectMap["properties"] = oop.OSOptionPropertyList - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OSOptionProfile struct. -func (oop *OSOptionProfile) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - oop.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - oop.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - oop.Type = &typeVar - } - case "properties": - if v != nil { - var oSOptionPropertyList OSOptionPropertyList - err = json.Unmarshal(*v, &oSOptionPropertyList) - if err != nil { - return err - } - oop.OSOptionPropertyList = &oSOptionPropertyList - } - } - } - - return nil -} - -// OSOptionProperty OS option property. -type OSOptionProperty struct { - // OsType - The OS type. - OsType *string `json:"os-type,omitempty"` - // EnableFipsImage - Whether the image is FIPS-enabled. - EnableFipsImage *bool `json:"enable-fips-image,omitempty"` -} - -// OSOptionPropertyList the list of OS option properties. -type OSOptionPropertyList struct { - // OsOptionPropertyList - The list of OS options. - OsOptionPropertyList *[]OSOptionProperty `json:"osOptionPropertyList,omitempty"` -} - -// OutboundEnvironmentEndpoint egress endpoints which AKS agent nodes connect to for common purpose. -type OutboundEnvironmentEndpoint struct { - // Category - The category of endpoints accessed by the AKS agent node, e.g. azure-resource-management, apiserver, etc. - Category *string `json:"category,omitempty"` - // Endpoints - The endpoints that AKS agent nodes connect to - Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` -} - -// OutboundEnvironmentEndpointCollection collection of OutboundEnvironmentEndpoint -type OutboundEnvironmentEndpointCollection struct { - autorest.Response `json:"-"` - // Value - Collection of resources. - Value *[]OutboundEnvironmentEndpoint `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to next page of resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OutboundEnvironmentEndpointCollection. -func (oeec OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if oeec.Value != nil { - objectMap["value"] = oeec.Value - } - return json.Marshal(objectMap) -} - -// OutboundEnvironmentEndpointCollectionIterator provides access to a complete listing of -// OutboundEnvironmentEndpoint values. -type OutboundEnvironmentEndpointCollectionIterator struct { - i int - page OutboundEnvironmentEndpointCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OutboundEnvironmentEndpointCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OutboundEnvironmentEndpointCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OutboundEnvironmentEndpointCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OutboundEnvironmentEndpointCollectionIterator) Response() OutboundEnvironmentEndpointCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OutboundEnvironmentEndpointCollectionIterator) Value() OutboundEnvironmentEndpoint { - if !iter.page.NotDone() { - return OutboundEnvironmentEndpoint{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OutboundEnvironmentEndpointCollectionIterator type. -func NewOutboundEnvironmentEndpointCollectionIterator(page OutboundEnvironmentEndpointCollectionPage) OutboundEnvironmentEndpointCollectionIterator { - return OutboundEnvironmentEndpointCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (oeec OutboundEnvironmentEndpointCollection) IsEmpty() bool { - return oeec.Value == nil || len(*oeec.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (oeec OutboundEnvironmentEndpointCollection) hasNextLink() bool { - return oeec.NextLink != nil && len(*oeec.NextLink) != 0 -} - -// outboundEnvironmentEndpointCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (oeec OutboundEnvironmentEndpointCollection) outboundEnvironmentEndpointCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !oeec.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(oeec.NextLink))) -} - -// OutboundEnvironmentEndpointCollectionPage contains a page of OutboundEnvironmentEndpoint values. -type OutboundEnvironmentEndpointCollectionPage struct { - fn func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error) - oeec OutboundEnvironmentEndpointCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OutboundEnvironmentEndpointCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.oeec) - if err != nil { - return err - } - page.oeec = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OutboundEnvironmentEndpointCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OutboundEnvironmentEndpointCollectionPage) NotDone() bool { - return !page.oeec.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OutboundEnvironmentEndpointCollectionPage) Response() OutboundEnvironmentEndpointCollection { - return page.oeec -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OutboundEnvironmentEndpointCollectionPage) Values() []OutboundEnvironmentEndpoint { - if page.oeec.IsEmpty() { - return nil - } - return *page.oeec.Value -} - -// Creates a new instance of the OutboundEnvironmentEndpointCollectionPage type. -func NewOutboundEnvironmentEndpointCollectionPage(cur OutboundEnvironmentEndpointCollection, getNextPage func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error)) OutboundEnvironmentEndpointCollectionPage { - return OutboundEnvironmentEndpointCollectionPage{ - fn: getNextPage, - oeec: cur, - } -} - -// PowerState describes the Power State of the cluster -type PowerState struct { - // Code - Tells whether the cluster is Running or Stopped. Possible values include: 'CodeRunning', 'CodeStopped' - Code Code `json:"code,omitempty"` -} - -// PrivateEndpoint private endpoint which a connection belongs to. -type PrivateEndpoint struct { - // ID - The resource ID of the private endpoint - ID *string `json:"id,omitempty"` -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The ID of the private endpoint connection. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the private endpoint connection. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type. - Type *string `json:"type,omitempty"` - // PrivateEndpointConnectionProperties - The properties of a private endpoint connection. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // ProvisioningState - READ-ONLY; The current provisioning state. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' - ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` - // PrivateEndpoint - The resource of private endpoint. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. -func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecp.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = pecp.PrivateEndpoint - } - if pecp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("containerservice.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // ID - The ID of the private link resource. - ID *string `json:"id,omitempty"` - // Name - The name of the private link resource. - Name *string `json:"name,omitempty"` - // Type - The resource type. - Type *string `json:"type,omitempty"` - // GroupID - The group ID of the resource. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - The RequiredMembers of the resource - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // PrivateLinkServiceID - READ-ONLY; The private link service ID of the resource, this field is exposed only to NRP internally. - PrivateLinkServiceID *string `json:"privateLinkServiceID,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.ID != nil { - objectMap["id"] = plr.ID - } - if plr.Name != nil { - objectMap["name"] = plr.Name - } - if plr.Type != nil { - objectMap["type"] = plr.Type - } - if plr.GroupID != nil { - objectMap["groupId"] = plr.GroupID - } - if plr.RequiredMembers != nil { - objectMap["requiredMembers"] = plr.RequiredMembers - } - return json.Marshal(objectMap) -} - -// PrivateLinkResourcesListResult a list of private link resources -type PrivateLinkResourcesListResult struct { - autorest.Response `json:"-"` - // Value - The collection value. - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkServiceConnectionState the state of a private link service connection. -type PrivateLinkServiceConnectionState struct { - // Status - The private link service connection status. Possible values include: 'ConnectionStatusPending', 'ConnectionStatusApproved', 'ConnectionStatusRejected', 'ConnectionStatusDisconnected' - Status ConnectionStatus `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` -} - -// Resource the Resource model definition. -type Resource struct { - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// ResourceReference a reference to an Azure resource. -type ResourceReference struct { - // ID - The fully qualified Azure resource id. - ID *string `json:"id,omitempty"` -} - -// RunCommandRequest a run command request -type RunCommandRequest struct { - // Command - The command to run. - Command *string `json:"command,omitempty"` - // Context - A base64 encoded zip file containing the files required by the command. - Context *string `json:"context,omitempty"` - // ClusterToken - AuthToken issued for AKS AAD Server App. - ClusterToken *string `json:"clusterToken,omitempty"` -} - -// RunCommandResult run command result. -type RunCommandResult struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The command id. - ID *string `json:"id,omitempty"` - // CommandResultProperties - Properties of command result. - *CommandResultProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for RunCommandResult. -func (rcr RunCommandResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rcr.CommandResultProperties != nil { - objectMap["properties"] = rcr.CommandResultProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for RunCommandResult struct. -func (rcr *RunCommandResult) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rcr.ID = &ID - } - case "properties": - if v != nil { - var commandResultProperties CommandResultProperties - err = json.Unmarshal(*v, &commandResultProperties) - if err != nil { - return err - } - rcr.CommandResultProperties = &commandResultProperties - } - } - } - - return nil -} - -// Snapshot a node pool snapshot resource. -type Snapshot struct { - autorest.Response `json:"-"` - // SystemData - READ-ONLY; The system metadata relating to this snapshot. - SystemData *SystemData `json:"systemData,omitempty"` - // SnapshotProperties - Properties of a snapshot. - *SnapshotProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Snapshot. -func (s Snapshot) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.SnapshotProperties != nil { - objectMap["properties"] = s.SnapshotProperties - } - if s.Location != nil { - objectMap["location"] = s.Location - } - if s.Tags != nil { - objectMap["tags"] = s.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Snapshot struct. -func (s *Snapshot) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - s.SystemData = &systemData - } - case "properties": - if v != nil { - var snapshotProperties SnapshotProperties - err = json.Unmarshal(*v, &snapshotProperties) - if err != nil { - return err - } - s.SnapshotProperties = &snapshotProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - s.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - s.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - s.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - s.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - s.Tags = tags - } - } - } - - return nil -} - -// SnapshotListResult the response from the List Snapshots operation. -type SnapshotListResult struct { - autorest.Response `json:"-"` - // Value - The list of snapshots. - Value *[]Snapshot `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of snapshot results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SnapshotListResult. -func (slr SnapshotListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if slr.Value != nil { - objectMap["value"] = slr.Value - } - return json.Marshal(objectMap) -} - -// SnapshotListResultIterator provides access to a complete listing of Snapshot values. -type SnapshotListResultIterator struct { - i int - page SnapshotListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SnapshotListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SnapshotListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SnapshotListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SnapshotListResultIterator) Response() SnapshotListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SnapshotListResultIterator) Value() Snapshot { - if !iter.page.NotDone() { - return Snapshot{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SnapshotListResultIterator type. -func NewSnapshotListResultIterator(page SnapshotListResultPage) SnapshotListResultIterator { - return SnapshotListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (slr SnapshotListResult) IsEmpty() bool { - return slr.Value == nil || len(*slr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (slr SnapshotListResult) hasNextLink() bool { - return slr.NextLink != nil && len(*slr.NextLink) != 0 -} - -// snapshotListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (slr SnapshotListResult) snapshotListResultPreparer(ctx context.Context) (*http.Request, error) { - if !slr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(slr.NextLink))) -} - -// SnapshotListResultPage contains a page of Snapshot values. -type SnapshotListResultPage struct { - fn func(context.Context, SnapshotListResult) (SnapshotListResult, error) - slr SnapshotListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SnapshotListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.slr) - if err != nil { - return err - } - page.slr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SnapshotListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SnapshotListResultPage) NotDone() bool { - return !page.slr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SnapshotListResultPage) Response() SnapshotListResult { - return page.slr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SnapshotListResultPage) Values() []Snapshot { - if page.slr.IsEmpty() { - return nil - } - return *page.slr.Value -} - -// Creates a new instance of the SnapshotListResultPage type. -func NewSnapshotListResultPage(cur SnapshotListResult, getNextPage func(context.Context, SnapshotListResult) (SnapshotListResult, error)) SnapshotListResultPage { - return SnapshotListResultPage{ - fn: getNextPage, - slr: cur, - } -} - -// SnapshotProperties properties used to configure a node pool snapshot. -type SnapshotProperties struct { - // CreationData - CreationData to be used to specify the source agent pool resource ID to create this snapshot. - CreationData *CreationData `json:"creationData,omitempty"` - // SnapshotType - Possible values include: 'SnapshotTypeNodePool' - SnapshotType SnapshotType `json:"snapshotType,omitempty"` - // KubernetesVersion - READ-ONLY; The version of Kubernetes. - KubernetesVersion *string `json:"kubernetesVersion,omitempty"` - // NodeImageVersion - READ-ONLY; The version of node image. - NodeImageVersion *string `json:"nodeImageVersion,omitempty"` - // OsType - READ-ONLY; Possible values include: 'OSTypeLinux', 'OSTypeWindows' - OsType OSType `json:"osType,omitempty"` - // OsSku - READ-ONLY; Possible values include: 'OSSKUUbuntu', 'OSSKUCBLMariner' - OsSku OSSKU `json:"osSku,omitempty"` - // VMSize - READ-ONLY; The size of the VM. - VMSize *string `json:"vmSize,omitempty"` - // EnableFIPS - READ-ONLY; Whether to use a FIPS-enabled OS. - EnableFIPS *bool `json:"enableFIPS,omitempty"` -} - -// MarshalJSON is the custom marshaler for SnapshotProperties. -func (sp SnapshotProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.CreationData != nil { - objectMap["creationData"] = sp.CreationData - } - if sp.SnapshotType != "" { - objectMap["snapshotType"] = sp.SnapshotType - } - return json.Marshal(objectMap) -} - -// SSHConfiguration SSH configuration for Linux-based VMs running on Azure. -type SSHConfiguration struct { - // PublicKeys - The list of SSH public keys used to authenticate with Linux-based VMs. A maximum of 1 key may be specified. - PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` -} - -// SSHPublicKey contains information about SSH certificate public key data. -type SSHPublicKey struct { - // KeyData - Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. - KeyData *string `json:"keyData,omitempty"` -} - -// SubResource reference to another subresource. -type SubResource struct { - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubResource. -func (sr SubResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SysctlConfig sysctl settings for Linux agent nodes. -type SysctlConfig struct { - // NetCoreSomaxconn - Sysctl setting net.core.somaxconn. - NetCoreSomaxconn *int32 `json:"netCoreSomaxconn,omitempty"` - // NetCoreNetdevMaxBacklog - Sysctl setting net.core.netdev_max_backlog. - NetCoreNetdevMaxBacklog *int32 `json:"netCoreNetdevMaxBacklog,omitempty"` - // NetCoreRmemDefault - Sysctl setting net.core.rmem_default. - NetCoreRmemDefault *int32 `json:"netCoreRmemDefault,omitempty"` - // NetCoreRmemMax - Sysctl setting net.core.rmem_max. - NetCoreRmemMax *int32 `json:"netCoreRmemMax,omitempty"` - // NetCoreWmemDefault - Sysctl setting net.core.wmem_default. - NetCoreWmemDefault *int32 `json:"netCoreWmemDefault,omitempty"` - // NetCoreWmemMax - Sysctl setting net.core.wmem_max. - NetCoreWmemMax *int32 `json:"netCoreWmemMax,omitempty"` - // NetCoreOptmemMax - Sysctl setting net.core.optmem_max. - NetCoreOptmemMax *int32 `json:"netCoreOptmemMax,omitempty"` - // NetIpv4TCPMaxSynBacklog - Sysctl setting net.ipv4.tcp_max_syn_backlog. - NetIpv4TCPMaxSynBacklog *int32 `json:"netIpv4TcpMaxSynBacklog,omitempty"` - // NetIpv4TCPMaxTwBuckets - Sysctl setting net.ipv4.tcp_max_tw_buckets. - NetIpv4TCPMaxTwBuckets *int32 `json:"netIpv4TcpMaxTwBuckets,omitempty"` - // NetIpv4TCPFinTimeout - Sysctl setting net.ipv4.tcp_fin_timeout. - NetIpv4TCPFinTimeout *int32 `json:"netIpv4TcpFinTimeout,omitempty"` - // NetIpv4TCPKeepaliveTime - Sysctl setting net.ipv4.tcp_keepalive_time. - NetIpv4TCPKeepaliveTime *int32 `json:"netIpv4TcpKeepaliveTime,omitempty"` - // NetIpv4TCPKeepaliveProbes - Sysctl setting net.ipv4.tcp_keepalive_probes. - NetIpv4TCPKeepaliveProbes *int32 `json:"netIpv4TcpKeepaliveProbes,omitempty"` - // NetIpv4TcpkeepaliveIntvl - Sysctl setting net.ipv4.tcp_keepalive_intvl. - NetIpv4TcpkeepaliveIntvl *int32 `json:"netIpv4TcpkeepaliveIntvl,omitempty"` - // NetIpv4TCPTwReuse - Sysctl setting net.ipv4.tcp_tw_reuse. - NetIpv4TCPTwReuse *bool `json:"netIpv4TcpTwReuse,omitempty"` - // NetIpv4IPLocalPortRange - Sysctl setting net.ipv4.ip_local_port_range. - NetIpv4IPLocalPortRange *string `json:"netIpv4IpLocalPortRange,omitempty"` - // NetIpv4NeighDefaultGcThresh1 - Sysctl setting net.ipv4.neigh.default.gc_thresh1. - NetIpv4NeighDefaultGcThresh1 *int32 `json:"netIpv4NeighDefaultGcThresh1,omitempty"` - // NetIpv4NeighDefaultGcThresh2 - Sysctl setting net.ipv4.neigh.default.gc_thresh2. - NetIpv4NeighDefaultGcThresh2 *int32 `json:"netIpv4NeighDefaultGcThresh2,omitempty"` - // NetIpv4NeighDefaultGcThresh3 - Sysctl setting net.ipv4.neigh.default.gc_thresh3. - NetIpv4NeighDefaultGcThresh3 *int32 `json:"netIpv4NeighDefaultGcThresh3,omitempty"` - // NetNetfilterNfConntrackMax - Sysctl setting net.netfilter.nf_conntrack_max. - NetNetfilterNfConntrackMax *int32 `json:"netNetfilterNfConntrackMax,omitempty"` - // NetNetfilterNfConntrackBuckets - Sysctl setting net.netfilter.nf_conntrack_buckets. - NetNetfilterNfConntrackBuckets *int32 `json:"netNetfilterNfConntrackBuckets,omitempty"` - // FsInotifyMaxUserWatches - Sysctl setting fs.inotify.max_user_watches. - FsInotifyMaxUserWatches *int32 `json:"fsInotifyMaxUserWatches,omitempty"` - // FsFileMax - Sysctl setting fs.file-max. - FsFileMax *int32 `json:"fsFileMax,omitempty"` - // FsAioMaxNr - Sysctl setting fs.aio-max-nr. - FsAioMaxNr *int32 `json:"fsAioMaxNr,omitempty"` - // FsNrOpen - Sysctl setting fs.nr_open. - FsNrOpen *int32 `json:"fsNrOpen,omitempty"` - // KernelThreadsMax - Sysctl setting kernel.threads-max. - KernelThreadsMax *int32 `json:"kernelThreadsMax,omitempty"` - // VMMaxMapCount - Sysctl setting vm.max_map_count. - VMMaxMapCount *int32 `json:"vmMaxMapCount,omitempty"` - // VMSwappiness - Sysctl setting vm.swappiness. - VMSwappiness *int32 `json:"vmSwappiness,omitempty"` - // VMVfsCachePressure - Sysctl setting vm.vfs_cache_pressure. - VMVfsCachePressure *int32 `json:"vmVfsCachePressure,omitempty"` -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The UTC timestamp of resource creation. - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The type of identity that last modified the resource. - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TagsObject tags object for patch operations. -type TagsObject struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TagsObject. -func (toVar TagsObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if toVar.Tags != nil { - objectMap["tags"] = toVar.Tags - } - return json.Marshal(objectMap) -} - -// TimeInWeek time in a week. -type TimeInWeek struct { - // Day - The day of the week. Possible values include: 'WeekDaySunday', 'WeekDayMonday', 'WeekDayTuesday', 'WeekDayWednesday', 'WeekDayThursday', 'WeekDayFriday', 'WeekDaySaturday' - Day WeekDay `json:"day,omitempty"` - // HourSlots - Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. - HourSlots *[]int32 `json:"hourSlots,omitempty"` -} - -// TimeSpan for example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. -type TimeSpan struct { - // Start - The start of a time span - Start *date.Time `json:"start,omitempty"` - // End - The end of a time span - End *date.Time `json:"end,omitempty"` -} - -// UserAssignedIdentity details about a user assigned identity. -type UserAssignedIdentity struct { - // ResourceID - The resource ID of the user assigned identity. - ResourceID *string `json:"resourceId,omitempty"` - // ClientID - The client ID of the user assigned identity. - ClientID *string `json:"clientId,omitempty"` - // ObjectID - The object ID of the user assigned identity. - ObjectID *string `json:"objectId,omitempty"` -} - -// VMDiagnostics profile for diagnostics on the container service VMs. -type VMDiagnostics struct { - // Enabled - Whether the VM diagnostic agent is provisioned on the VM. - Enabled *bool `json:"enabled,omitempty"` - // StorageURI - READ-ONLY; The URI of the storage account where diagnostics are stored. - StorageURI *string `json:"storageUri,omitempty"` -} - -// MarshalJSON is the custom marshaler for VMDiagnostics. -func (vd VMDiagnostics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vd.Enabled != nil { - objectMap["enabled"] = vd.Enabled - } - return json.Marshal(objectMap) -} - -// WindowsGmsaProfile windows gMSA Profile in the managed cluster. -type WindowsGmsaProfile struct { - // Enabled - Specifies whether to enable Windows gMSA in the managed cluster. - Enabled *bool `json:"enabled,omitempty"` - // DNSServer - Specifies the DNS server for Windows gMSA.

Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. - DNSServer *string `json:"dnsServer,omitempty"` - // RootDomainName - Specifies the root domain name for Windows gMSA.

Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. - RootDomainName *string `json:"rootDomainName,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/operations.go deleted file mode 100644 index a4ac9ed1a9a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package containerservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the the Container Service Client. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List sends the list request. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2022-01-02-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ContainerService/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/privateendpointconnections.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/privateendpointconnections.go deleted file mode 100644 index 2812f9604fb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/privateendpointconnections.go +++ /dev/null @@ -1,394 +0,0 @@ -package containerservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionsClient is the the Container Service Client. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete sends the delete request. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-02-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get to learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-02-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List to learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-02-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update sends the update request. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -// privateEndpointConnectionName - the name of the private endpoint connection. -// parameters - the updated private endpoint connection. -func (client PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PrivateEndpointConnectionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-02-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Name = nil - parameters.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) UpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/privatelinkresources.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/privatelinkresources.go deleted file mode 100644 index f0c295a1dc1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/privatelinkresources.go +++ /dev/null @@ -1,119 +0,0 @@ -package containerservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the the Container Service Client. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List to learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateLinkResourcesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.PrivateLinkResourcesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.PrivateLinkResourcesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-02-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResourcesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/snapshots.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/snapshots.go deleted file mode 100644 index c4db2d369da..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/snapshots.go +++ /dev/null @@ -1,617 +0,0 @@ -package containerservice - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SnapshotsClient is the the Container Service Client. -type SnapshotsClient struct { - BaseClient -} - -// NewSnapshotsClient creates an instance of the SnapshotsClient client. -func NewSnapshotsClient(subscriptionID string) SnapshotsClient { - return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient { - return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate sends the create or update request. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -// parameters - the snapshot to create or update. -func (client SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters Snapshot) (result Snapshot, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.SnapshotsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SnapshotsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters Snapshot) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-02-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (result Snapshot, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete sends the delete request. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -func (client SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.SnapshotsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-02-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get sends the get request. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -func (client SnapshotsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Snapshot, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.SnapshotsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-02-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List sends the list request. -func (client SnapshotsClient) List(ctx context.Context) (result SnapshotListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") - defer func() { - sc := -1 - if result.slr.Response.Response != nil { - sc = result.slr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "List", resp, "Failure sending request") - return - } - - result.slr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "List", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SnapshotsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-02-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client SnapshotsClient) listNextResults(ctx context.Context, lastResults SnapshotListResult) (result SnapshotListResult, err error) { - req, err := lastResults.snapshotListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SnapshotsClient) ListComplete(ctx context.Context) (result SnapshotListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup sends the list by resource group request. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client SnapshotsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SnapshotListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.slr.Response.Response != nil { - sc = result.slr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.SnapshotsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.slr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.slr.hasNextLink() && result.slr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client SnapshotsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-02-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) ListByResourceGroupResponder(resp *http.Response) (result SnapshotListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client SnapshotsClient) listByResourceGroupNextResults(ctx context.Context, lastResults SnapshotListResult) (result SnapshotListResult, err error) { - req, err := lastResults.snapshotListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SnapshotListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// UpdateTags sends the update tags request. -// Parameters: -// resourceGroupName - the name of the resource group. -// resourceName - the name of the managed cluster resource. -// parameters - parameters supplied to the Update snapshot Tags operation. -func (client SnapshotsClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (result Snapshot, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.UpdateTags") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("containerservice.SnapshotsClient", "UpdateTags", err.Error()) - } - - req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, resourceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "UpdateTags", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "UpdateTags", resp, "Failure sending request") - return - } - - result, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "UpdateTags", resp, "Failure responding to request") - return - } - - return -} - -// UpdateTagsPreparer prepares the UpdateTags request. -func (client SnapshotsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-01-02-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTagsSender sends the UpdateTags request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateTagsResponder handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) UpdateTagsResponder(resp *http.Response) (result Snapshot, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/version.go deleted file mode 100644 index 2c146d5e440..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package containerservice - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " containerservice/2022-01-02-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/CHANGELOG.md similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement/CHANGELOG.md rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/CHANGELOG.md diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/_meta.json new file mode 100644 index 00000000000..8b1625a1cee --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "fc9d4d2798f755bea848ac1c29b2730d31002cb8", + "readme": "/_/azure-rest-api-specs/specification/containerservice/resource-manager/readme.md", + "tag": "package-preview-2022-03", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2022-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/containerservice/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/agentpools.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/agentpools.go similarity index 89% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/agentpools.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/agentpools.go index b6c12e20e1b..90495e507bf 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/agentpools.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/agentpools.go @@ -33,7 +33,7 @@ func NewAgentPoolsClientWithBaseURI(baseURI string, subscriptionID string) Agent // CreateOrUpdate sends the create or update request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // agentPoolName - the name of the agent pool. // parameters - the agent pool to create or update. @@ -49,8 +49,11 @@ func (client AgentPoolsClient) CreateOrUpdate(ctx context.Context, resourceGroup }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -89,7 +92,7 @@ func (client AgentPoolsClient) CreateOrUpdatePreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -134,10 +137,12 @@ func (client AgentPoolsClient) CreateOrUpdateResponder(resp *http.Response) (res // Delete sends the delete request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // agentPoolName - the name of the agent pool. -func (client AgentPoolsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPoolsDeleteFuture, err error) { +// ignorePodDisruptionBudget - ignore-pod-disruption-budget=true to delete those pods on a node without +// considering Pod Disruption Budget +func (client AgentPoolsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, ignorePodDisruptionBudget *bool) (result AgentPoolsDeleteFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.Delete") defer func() { @@ -149,8 +154,11 @@ func (client AgentPoolsClient) Delete(ctx context.Context, resourceGroupName str }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -158,7 +166,7 @@ func (client AgentPoolsClient) Delete(ctx context.Context, resourceGroupName str return result, validation.NewError("containerservice.AgentPoolsClient", "Delete", err.Error()) } - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, agentPoolName) + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, agentPoolName, ignorePodDisruptionBudget) if err != nil { err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Delete", nil, "Failure preparing request") return @@ -174,7 +182,7 @@ func (client AgentPoolsClient) Delete(ctx context.Context, resourceGroupName str } // DeletePreparer prepares the Delete request. -func (client AgentPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (*http.Request, error) { +func (client AgentPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, ignorePodDisruptionBudget *bool) (*http.Request, error) { pathParameters := map[string]interface{}{ "agentPoolName": autorest.Encode("path", agentPoolName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -182,10 +190,13 @@ func (client AgentPoolsClient) DeletePreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } + if ignorePodDisruptionBudget != nil { + queryParameters["ignore-pod-disruption-budget"] = autorest.Encode("query", *ignorePodDisruptionBudget) + } preparer := autorest.CreatePreparer( autorest.AsDelete(), @@ -224,7 +235,7 @@ func (client AgentPoolsClient) DeleteResponder(resp *http.Response) (result auto // Get sends the get request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // agentPoolName - the name of the agent pool. func (client AgentPoolsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPool, err error) { @@ -239,8 +250,11 @@ func (client AgentPoolsClient) Get(ctx context.Context, resourceGroupName string }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -279,7 +293,7 @@ func (client AgentPoolsClient) GetPreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -314,7 +328,7 @@ func (client AgentPoolsClient) GetResponder(resp *http.Response) (result AgentPo // versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version // lifecycle. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. func (client AgentPoolsClient) GetAvailableAgentPoolVersions(ctx context.Context, resourceGroupName string, resourceName string) (result AgentPoolAvailableVersions, err error) { if tracing.IsEnabled() { @@ -328,8 +342,11 @@ func (client AgentPoolsClient) GetAvailableAgentPoolVersions(ctx context.Context }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -367,7 +384,7 @@ func (client AgentPoolsClient) GetAvailableAgentPoolVersionsPreparer(ctx context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -400,7 +417,7 @@ func (client AgentPoolsClient) GetAvailableAgentPoolVersionsResponder(resp *http // GetUpgradeProfile sends the get upgrade profile request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // agentPoolName - the name of the agent pool. func (client AgentPoolsClient) GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPoolUpgradeProfile, err error) { @@ -415,8 +432,11 @@ func (client AgentPoolsClient) GetUpgradeProfile(ctx context.Context, resourceGr }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -455,7 +475,7 @@ func (client AgentPoolsClient) GetUpgradeProfilePreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -488,7 +508,7 @@ func (client AgentPoolsClient) GetUpgradeProfileResponder(resp *http.Response) ( // List sends the list request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. func (client AgentPoolsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result AgentPoolListResultPage, err error) { if tracing.IsEnabled() { @@ -502,8 +522,11 @@ func (client AgentPoolsClient) List(ctx context.Context, resourceGroupName strin }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -546,7 +569,7 @@ func (client AgentPoolsClient) ListPreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -618,7 +641,7 @@ func (client AgentPoolsClient) ListComplete(ctx context.Context, resourceGroupNa // to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, // see: https://docs.microsoft.com/azure/aks/node-image-upgrade // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // agentPoolName - the name of the agent pool. func (client AgentPoolsClient) UpgradeNodeImageVersion(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPoolsUpgradeNodeImageVersionFuture, err error) { @@ -633,8 +656,11 @@ func (client AgentPoolsClient) UpgradeNodeImageVersion(ctx context.Context, reso }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -666,7 +692,7 @@ func (client AgentPoolsClient) UpgradeNodeImageVersionPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/client.go new file mode 100644 index 00000000000..c28b2f59ab5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/client.go @@ -0,0 +1,41 @@ +// Package containerservice implements the Azure ARM Containerservice service API version 2022-03-02-preview. +// +// The Container Service Client. +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Containerservice + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Containerservice. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/enums.go new file mode 100644 index 00000000000..60781e75500 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/enums.go @@ -0,0 +1,984 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AgentPoolMode enumerates the values for agent pool mode. +type AgentPoolMode string + +const ( + // AgentPoolModeSystem System agent pools are primarily for hosting critical system pods such as CoreDNS + // and metrics-server. System agent pools osType must be Linux. System agent pools VM SKU must have at + // least 2vCPUs and 4GB of memory. + AgentPoolModeSystem AgentPoolMode = "System" + // AgentPoolModeUser User agent pools are primarily for hosting your application pods. + AgentPoolModeUser AgentPoolMode = "User" +) + +// PossibleAgentPoolModeValues returns an array of possible values for the AgentPoolMode const type. +func PossibleAgentPoolModeValues() []AgentPoolMode { + return []AgentPoolMode{AgentPoolModeSystem, AgentPoolModeUser} +} + +// AgentPoolType enumerates the values for agent pool type. +type AgentPoolType string + +const ( + // AgentPoolTypeAvailabilitySet Use of this is strongly discouraged. + AgentPoolTypeAvailabilitySet AgentPoolType = "AvailabilitySet" + // AgentPoolTypeVirtualMachineScaleSets Create an Agent Pool backed by a Virtual Machine Scale Set. + AgentPoolTypeVirtualMachineScaleSets AgentPoolType = "VirtualMachineScaleSets" +) + +// PossibleAgentPoolTypeValues returns an array of possible values for the AgentPoolType const type. +func PossibleAgentPoolTypeValues() []AgentPoolType { + return []AgentPoolType{AgentPoolTypeAvailabilitySet, AgentPoolTypeVirtualMachineScaleSets} +} + +// Code enumerates the values for code. +type Code string + +const ( + // CodeRunning The cluster is running. + CodeRunning Code = "Running" + // CodeStopped The cluster is stopped. + CodeStopped Code = "Stopped" +) + +// PossibleCodeValues returns an array of possible values for the Code const type. +func PossibleCodeValues() []Code { + return []Code{CodeRunning, CodeStopped} +} + +// ConnectionStatus enumerates the values for connection status. +type ConnectionStatus string + +const ( + // ConnectionStatusApproved ... + ConnectionStatusApproved ConnectionStatus = "Approved" + // ConnectionStatusDisconnected ... + ConnectionStatusDisconnected ConnectionStatus = "Disconnected" + // ConnectionStatusPending ... + ConnectionStatusPending ConnectionStatus = "Pending" + // ConnectionStatusRejected ... + ConnectionStatusRejected ConnectionStatus = "Rejected" +) + +// PossibleConnectionStatusValues returns an array of possible values for the ConnectionStatus const type. +func PossibleConnectionStatusValues() []ConnectionStatus { + return []ConnectionStatus{ConnectionStatusApproved, ConnectionStatusDisconnected, ConnectionStatusPending, ConnectionStatusRejected} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// Expander enumerates the values for expander. +type Expander string + +const ( + // ExpanderLeastWaste Selects the node group that will have the least idle CPU (if tied, unused memory) + // after scale-up. This is useful when you have different classes of nodes, for example, high CPU or high + // memory nodes, and only want to expand those when there are pending pods that need a lot of those + // resources. + ExpanderLeastWaste Expander = "least-waste" + // ExpanderMostPods Selects the node group that would be able to schedule the most pods when scaling up. + // This is useful when you are using nodeSelector to make sure certain pods land on certain nodes. Note + // that this won't cause the autoscaler to select bigger nodes vs. smaller, as it can add multiple smaller + // nodes at once. + ExpanderMostPods Expander = "most-pods" + // ExpanderPriority Selects the node group that has the highest priority assigned by the user. It's + // configuration is described in more details + // [here](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/expander/priority/readme.md). + ExpanderPriority Expander = "priority" + // ExpanderRandom Used when you don't have a particular need for the node groups to scale differently. + ExpanderRandom Expander = "random" +) + +// PossibleExpanderValues returns an array of possible values for the Expander const type. +func PossibleExpanderValues() []Expander { + return []Expander{ExpanderLeastWaste, ExpanderMostPods, ExpanderPriority, ExpanderRandom} +} + +// ExtendedLocationTypes enumerates the values for extended location types. +type ExtendedLocationTypes string + +const ( + // ExtendedLocationTypesEdgeZone ... + ExtendedLocationTypesEdgeZone ExtendedLocationTypes = "EdgeZone" +) + +// PossibleExtendedLocationTypesValues returns an array of possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{ExtendedLocationTypesEdgeZone} +} + +// Format enumerates the values for format. +type Format string + +const ( + // FormatAzure Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully + // removed in 1.25. + FormatAzure Format = "azure" + // FormatExec Return exec format kubeconfig. This format requires kubelogin binary in the path. + FormatExec Format = "exec" +) + +// PossibleFormatValues returns an array of possible values for the Format const type. +func PossibleFormatValues() []Format { + return []Format{FormatAzure, FormatExec} +} + +// GPUInstanceProfile enumerates the values for gpu instance profile. +type GPUInstanceProfile string + +const ( + // GPUInstanceProfileMIG1g ... + GPUInstanceProfileMIG1g GPUInstanceProfile = "MIG1g" + // GPUInstanceProfileMIG2g ... + GPUInstanceProfileMIG2g GPUInstanceProfile = "MIG2g" + // GPUInstanceProfileMIG3g ... + GPUInstanceProfileMIG3g GPUInstanceProfile = "MIG3g" + // GPUInstanceProfileMIG4g ... + GPUInstanceProfileMIG4g GPUInstanceProfile = "MIG4g" + // GPUInstanceProfileMIG7g ... + GPUInstanceProfileMIG7g GPUInstanceProfile = "MIG7g" +) + +// PossibleGPUInstanceProfileValues returns an array of possible values for the GPUInstanceProfile const type. +func PossibleGPUInstanceProfileValues() []GPUInstanceProfile { + return []GPUInstanceProfile{GPUInstanceProfileMIG1g, GPUInstanceProfileMIG2g, GPUInstanceProfileMIG3g, GPUInstanceProfileMIG4g, GPUInstanceProfileMIG7g} +} + +// IPFamily enumerates the values for ip family. +type IPFamily string + +const ( + // IPFamilyIPv4 ... + IPFamilyIPv4 IPFamily = "IPv4" + // IPFamilyIPv6 ... + IPFamilyIPv6 IPFamily = "IPv6" +) + +// PossibleIPFamilyValues returns an array of possible values for the IPFamily const type. +func PossibleIPFamilyValues() []IPFamily { + return []IPFamily{IPFamilyIPv4, IPFamilyIPv6} +} + +// KubeletDiskType enumerates the values for kubelet disk type. +type KubeletDiskType string + +const ( + // KubeletDiskTypeOS Kubelet will use the OS disk for its data. + KubeletDiskTypeOS KubeletDiskType = "OS" + // KubeletDiskTypeTemporary Kubelet will use the temporary disk for its data. + KubeletDiskTypeTemporary KubeletDiskType = "Temporary" +) + +// PossibleKubeletDiskTypeValues returns an array of possible values for the KubeletDiskType const type. +func PossibleKubeletDiskTypeValues() []KubeletDiskType { + return []KubeletDiskType{KubeletDiskTypeOS, KubeletDiskTypeTemporary} +} + +// LicenseType enumerates the values for license type. +type LicenseType string + +const ( + // LicenseTypeNone No additional licensing is applied. + LicenseTypeNone LicenseType = "None" + // LicenseTypeWindowsServer Enables Azure Hybrid User Benefits for Windows VMs. + LicenseTypeWindowsServer LicenseType = "Windows_Server" +) + +// PossibleLicenseTypeValues returns an array of possible values for the LicenseType const type. +func PossibleLicenseTypeValues() []LicenseType { + return []LicenseType{LicenseTypeNone, LicenseTypeWindowsServer} +} + +// LoadBalancerSku enumerates the values for load balancer sku. +type LoadBalancerSku string + +const ( + // LoadBalancerSkuBasic Use a basic Load Balancer with limited functionality. + LoadBalancerSkuBasic LoadBalancerSku = "basic" + // LoadBalancerSkuStandard Use a a standard Load Balancer. This is the recommended Load Balancer SKU. For + // more information about on working with the load balancer in the managed cluster, see the [standard Load + // Balancer](https://docs.microsoft.com/azure/aks/load-balancer-standard) article. + LoadBalancerSkuStandard LoadBalancerSku = "standard" +) + +// PossibleLoadBalancerSkuValues returns an array of possible values for the LoadBalancerSku const type. +func PossibleLoadBalancerSkuValues() []LoadBalancerSku { + return []LoadBalancerSku{LoadBalancerSkuBasic, LoadBalancerSkuStandard} +} + +// ManagedClusterPodIdentityProvisioningState enumerates the values for managed cluster pod identity +// provisioning state. +type ManagedClusterPodIdentityProvisioningState string + +const ( + // ManagedClusterPodIdentityProvisioningStateAssigned ... + ManagedClusterPodIdentityProvisioningStateAssigned ManagedClusterPodIdentityProvisioningState = "Assigned" + // ManagedClusterPodIdentityProvisioningStateDeleting ... + ManagedClusterPodIdentityProvisioningStateDeleting ManagedClusterPodIdentityProvisioningState = "Deleting" + // ManagedClusterPodIdentityProvisioningStateFailed ... + ManagedClusterPodIdentityProvisioningStateFailed ManagedClusterPodIdentityProvisioningState = "Failed" + // ManagedClusterPodIdentityProvisioningStateUpdating ... + ManagedClusterPodIdentityProvisioningStateUpdating ManagedClusterPodIdentityProvisioningState = "Updating" +) + +// PossibleManagedClusterPodIdentityProvisioningStateValues returns an array of possible values for the ManagedClusterPodIdentityProvisioningState const type. +func PossibleManagedClusterPodIdentityProvisioningStateValues() []ManagedClusterPodIdentityProvisioningState { + return []ManagedClusterPodIdentityProvisioningState{ManagedClusterPodIdentityProvisioningStateAssigned, ManagedClusterPodIdentityProvisioningStateDeleting, ManagedClusterPodIdentityProvisioningStateFailed, ManagedClusterPodIdentityProvisioningStateUpdating} +} + +// ManagedClusterSKUName enumerates the values for managed cluster sku name. +type ManagedClusterSKUName string + +const ( + // ManagedClusterSKUNameBasic ... + ManagedClusterSKUNameBasic ManagedClusterSKUName = "Basic" +) + +// PossibleManagedClusterSKUNameValues returns an array of possible values for the ManagedClusterSKUName const type. +func PossibleManagedClusterSKUNameValues() []ManagedClusterSKUName { + return []ManagedClusterSKUName{ManagedClusterSKUNameBasic} +} + +// ManagedClusterSKUTier enumerates the values for managed cluster sku tier. +type ManagedClusterSKUTier string + +const ( + // ManagedClusterSKUTierFree No guaranteed SLA, no additional charges. Free tier clusters have an SLO of + // 99.5%. + ManagedClusterSKUTierFree ManagedClusterSKUTier = "Free" + // ManagedClusterSKUTierPaid Guarantees 99.95% availability of the Kubernetes API server endpoint for + // clusters that use Availability Zones and 99.9% of availability for clusters that don't use Availability + // Zones. + ManagedClusterSKUTierPaid ManagedClusterSKUTier = "Paid" +) + +// PossibleManagedClusterSKUTierValues returns an array of possible values for the ManagedClusterSKUTier const type. +func PossibleManagedClusterSKUTierValues() []ManagedClusterSKUTier { + return []ManagedClusterSKUTier{ManagedClusterSKUTierFree, ManagedClusterSKUTierPaid} +} + +// NetworkMode enumerates the values for network mode. +type NetworkMode string + +const ( + // NetworkModeBridge This is no longer supported + NetworkModeBridge NetworkMode = "bridge" + // NetworkModeTransparent No bridge is created. Intra-VM Pod to Pod communication is through IP routes + // created by Azure CNI. See [Transparent Mode](https://docs.microsoft.com/azure/aks/faq#transparent-mode) + // for more information. + NetworkModeTransparent NetworkMode = "transparent" +) + +// PossibleNetworkModeValues returns an array of possible values for the NetworkMode const type. +func PossibleNetworkModeValues() []NetworkMode { + return []NetworkMode{NetworkModeBridge, NetworkModeTransparent} +} + +// NetworkPlugin enumerates the values for network plugin. +type NetworkPlugin string + +const ( + // NetworkPluginAzure Use the Azure CNI network plugin. See [Azure CNI (advanced) + // networking](https://docs.microsoft.com/azure/aks/concepts-network#azure-cni-advanced-networking) for + // more information. + NetworkPluginAzure NetworkPlugin = "azure" + // NetworkPluginKubenet Use the Kubenet network plugin. See [Kubenet (basic) + // networking](https://docs.microsoft.com/azure/aks/concepts-network#kubenet-basic-networking) for more + // information. + NetworkPluginKubenet NetworkPlugin = "kubenet" + // NetworkPluginNone Do not use a network plugin. A custom CNI will need to be installed after cluster + // creation for networking functionality. + NetworkPluginNone NetworkPlugin = "none" +) + +// PossibleNetworkPluginValues returns an array of possible values for the NetworkPlugin const type. +func PossibleNetworkPluginValues() []NetworkPlugin { + return []NetworkPlugin{NetworkPluginAzure, NetworkPluginKubenet, NetworkPluginNone} +} + +// NetworkPolicy enumerates the values for network policy. +type NetworkPolicy string + +const ( + // NetworkPolicyAzure Use Azure network policies. See [differences between Azure and Calico + // policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) + // for more information. + NetworkPolicyAzure NetworkPolicy = "azure" + // NetworkPolicyCalico Use Calico network policies. See [differences between Azure and Calico + // policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) + // for more information. + NetworkPolicyCalico NetworkPolicy = "calico" +) + +// PossibleNetworkPolicyValues returns an array of possible values for the NetworkPolicy const type. +func PossibleNetworkPolicyValues() []NetworkPolicy { + return []NetworkPolicy{NetworkPolicyAzure, NetworkPolicyCalico} +} + +// OSDiskType enumerates the values for os disk type. +type OSDiskType string + +const ( + // OSDiskTypeEphemeral Ephemeral OS disks are stored only on the host machine, just like a temporary disk. + // This provides lower read/write latency, along with faster node scaling and cluster upgrades. + OSDiskTypeEphemeral OSDiskType = "Ephemeral" + // OSDiskTypeManaged Azure replicates the operating system disk for a virtual machine to Azure storage to + // avoid data loss should the VM need to be relocated to another host. Since containers aren't designed to + // have local state persisted, this behavior offers limited value while providing some drawbacks, including + // slower node provisioning and higher read/write latency. + OSDiskTypeManaged OSDiskType = "Managed" +) + +// PossibleOSDiskTypeValues returns an array of possible values for the OSDiskType const type. +func PossibleOSDiskTypeValues() []OSDiskType { + return []OSDiskType{OSDiskTypeEphemeral, OSDiskTypeManaged} +} + +// OSSKU enumerates the values for ossku. +type OSSKU string + +const ( + // OSSKUCBLMariner ... + OSSKUCBLMariner OSSKU = "CBLMariner" + // OSSKUUbuntu ... + OSSKUUbuntu OSSKU = "Ubuntu" +) + +// PossibleOSSKUValues returns an array of possible values for the OSSKU const type. +func PossibleOSSKUValues() []OSSKU { + return []OSSKU{OSSKUCBLMariner, OSSKUUbuntu} +} + +// OSType enumerates the values for os type. +type OSType string + +const ( + // OSTypeLinux Use Linux. + OSTypeLinux OSType = "Linux" + // OSTypeWindows Use Windows. + OSTypeWindows OSType = "Windows" +) + +// PossibleOSTypeValues returns an array of possible values for the OSType const type. +func PossibleOSTypeValues() []OSType { + return []OSType{OSTypeLinux, OSTypeWindows} +} + +// OutboundType enumerates the values for outbound type. +type OutboundType string + +const ( + // OutboundTypeLoadBalancer The load balancer is used for egress through an AKS assigned public IP. This + // supports Kubernetes services of type 'loadBalancer'. For more information see [outbound type + // loadbalancer](https://docs.microsoft.com/azure/aks/egress-outboundtype#outbound-type-of-loadbalancer). + OutboundTypeLoadBalancer OutboundType = "loadBalancer" + // OutboundTypeManagedNATGateway The AKS-managed NAT gateway is used for egress. + OutboundTypeManagedNATGateway OutboundType = "managedNATGateway" + // OutboundTypeUserAssignedNATGateway The user-assigned NAT gateway associated to the cluster subnet is + // used for egress. This is an advanced scenario and requires proper network configuration. + OutboundTypeUserAssignedNATGateway OutboundType = "userAssignedNATGateway" + // OutboundTypeUserDefinedRouting Egress paths must be defined by the user. This is an advanced scenario + // and requires proper network configuration. For more information see [outbound type + // userDefinedRouting](https://docs.microsoft.com/azure/aks/egress-outboundtype#outbound-type-of-userdefinedrouting). + OutboundTypeUserDefinedRouting OutboundType = "userDefinedRouting" +) + +// PossibleOutboundTypeValues returns an array of possible values for the OutboundType const type. +func PossibleOutboundTypeValues() []OutboundType { + return []OutboundType{OutboundTypeLoadBalancer, OutboundTypeManagedNATGateway, OutboundTypeUserAssignedNATGateway, OutboundTypeUserDefinedRouting} +} + +// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection +// provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + // PrivateEndpointConnectionProvisioningStateCreating ... + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + // PrivateEndpointConnectionProvisioningStateDeleting ... + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + // PrivateEndpointConnectionProvisioningStateFailed ... + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateSucceeded ... + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled ... + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled ... + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeNone Do not use a managed identity for the Managed Cluster, service principal will + // be used instead. + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeSystemAssigned Use an implicitly created system assigned managed identity to manage + // cluster resources. Master components in the control plane such as kube-controller-manager will use the + // system assigned managed identity to manipulate Azure resources. + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + // ResourceIdentityTypeUserAssigned Use a user-specified identity to manage cluster resources. Master + // components in the control plane such as kube-controller-manager will use the specified user assigned + // managed identity to manipulate Azure resources. + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeUserAssigned} +} + +// ScaleDownMode enumerates the values for scale down mode. +type ScaleDownMode string + +const ( + // ScaleDownModeDeallocate Attempt to start deallocated instances (if they exist) during scale up and + // deallocate instances during scale down. + ScaleDownModeDeallocate ScaleDownMode = "Deallocate" + // ScaleDownModeDelete Create new instances during scale up and remove instances during scale down. + ScaleDownModeDelete ScaleDownMode = "Delete" +) + +// PossibleScaleDownModeValues returns an array of possible values for the ScaleDownMode const type. +func PossibleScaleDownModeValues() []ScaleDownMode { + return []ScaleDownMode{ScaleDownModeDeallocate, ScaleDownModeDelete} +} + +// ScaleSetEvictionPolicy enumerates the values for scale set eviction policy. +type ScaleSetEvictionPolicy string + +const ( + // ScaleSetEvictionPolicyDeallocate Nodes in the underlying Scale Set of the node pool are set to the + // stopped-deallocated state upon eviction. Nodes in the stopped-deallocated state count against your + // compute quota and can cause issues with cluster scaling or upgrading. + ScaleSetEvictionPolicyDeallocate ScaleSetEvictionPolicy = "Deallocate" + // ScaleSetEvictionPolicyDelete Nodes in the underlying Scale Set of the node pool are deleted when they're + // evicted. + ScaleSetEvictionPolicyDelete ScaleSetEvictionPolicy = "Delete" +) + +// PossibleScaleSetEvictionPolicyValues returns an array of possible values for the ScaleSetEvictionPolicy const type. +func PossibleScaleSetEvictionPolicyValues() []ScaleSetEvictionPolicy { + return []ScaleSetEvictionPolicy{ScaleSetEvictionPolicyDeallocate, ScaleSetEvictionPolicyDelete} +} + +// ScaleSetPriority enumerates the values for scale set priority. +type ScaleSetPriority string + +const ( + // ScaleSetPriorityRegular Regular VMs will be used. + ScaleSetPriorityRegular ScaleSetPriority = "Regular" + // ScaleSetPrioritySpot Spot priority VMs will be used. There is no SLA for spot nodes. See [spot on + // AKS](https://docs.microsoft.com/azure/aks/spot-node-pool) for more information. + ScaleSetPrioritySpot ScaleSetPriority = "Spot" +) + +// PossibleScaleSetPriorityValues returns an array of possible values for the ScaleSetPriority const type. +func PossibleScaleSetPriorityValues() []ScaleSetPriority { + return []ScaleSetPriority{ScaleSetPriorityRegular, ScaleSetPrioritySpot} +} + +// SnapshotType enumerates the values for snapshot type. +type SnapshotType string + +const ( + // SnapshotTypeManagedCluster The snapshot is a snapshot of a managed cluster. + SnapshotTypeManagedCluster SnapshotType = "ManagedCluster" + // SnapshotTypeNodePool The snapshot is a snapshot of a node pool. + SnapshotTypeNodePool SnapshotType = "NodePool" +) + +// PossibleSnapshotTypeValues returns an array of possible values for the SnapshotType const type. +func PossibleSnapshotTypeValues() []SnapshotType { + return []SnapshotType{SnapshotTypeManagedCluster, SnapshotTypeNodePool} +} + +// StorageProfileTypes enumerates the values for storage profile types. +type StorageProfileTypes string + +const ( + // StorageProfileTypesManagedDisks ... + StorageProfileTypesManagedDisks StorageProfileTypes = "ManagedDisks" + // StorageProfileTypesStorageAccount ... + StorageProfileTypesStorageAccount StorageProfileTypes = "StorageAccount" +) + +// PossibleStorageProfileTypesValues returns an array of possible values for the StorageProfileTypes const type. +func PossibleStorageProfileTypesValues() []StorageProfileTypes { + return []StorageProfileTypes{StorageProfileTypesManagedDisks, StorageProfileTypesStorageAccount} +} + +// UpgradeChannel enumerates the values for upgrade channel. +type UpgradeChannel string + +const ( + // UpgradeChannelNodeImage Automatically upgrade the node image to the latest version available. Microsoft + // provides patches and new images for image nodes frequently (usually weekly), but your running nodes + // won't get the new images unless you do a node image upgrade. Turning on the node-image channel will + // automatically update your node images whenever a new version is available. + UpgradeChannelNodeImage UpgradeChannel = "node-image" + // UpgradeChannelNone Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. + UpgradeChannelNone UpgradeChannel = "none" + // UpgradeChannelPatch Automatically upgrade the cluster to the latest supported patch version when it + // becomes available while keeping the minor version the same. For example, if a cluster is running version + // 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded to + // 1.17.9. + UpgradeChannelPatch UpgradeChannel = "patch" + // UpgradeChannelRapid Automatically upgrade the cluster to the latest supported patch release on the + // latest supported minor version. In cases where the cluster is at a version of Kubernetes that is at an + // N-2 minor version where N is the latest supported minor version, the cluster first upgrades to the + // latest supported patch version on N-1 minor version. For example, if a cluster is running version 1.17.7 + // and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster first is upgraded to 1.18.6, + // then is upgraded to 1.19.1. + UpgradeChannelRapid UpgradeChannel = "rapid" + // UpgradeChannelStable Automatically upgrade the cluster to the latest supported patch release on minor + // version N-1, where N is the latest supported minor version. For example, if a cluster is running version + // 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded to + // 1.18.6. + UpgradeChannelStable UpgradeChannel = "stable" +) + +// PossibleUpgradeChannelValues returns an array of possible values for the UpgradeChannel const type. +func PossibleUpgradeChannelValues() []UpgradeChannel { + return []UpgradeChannel{UpgradeChannelNodeImage, UpgradeChannelNone, UpgradeChannelPatch, UpgradeChannelRapid, UpgradeChannelStable} +} + +// VMSizeTypes enumerates the values for vm size types. +type VMSizeTypes string + +const ( + // VMSizeTypesStandardA1 ... + VMSizeTypesStandardA1 VMSizeTypes = "Standard_A1" + // VMSizeTypesStandardA10 ... + VMSizeTypesStandardA10 VMSizeTypes = "Standard_A10" + // VMSizeTypesStandardA11 ... + VMSizeTypesStandardA11 VMSizeTypes = "Standard_A11" + // VMSizeTypesStandardA1V2 ... + VMSizeTypesStandardA1V2 VMSizeTypes = "Standard_A1_v2" + // VMSizeTypesStandardA2 ... + VMSizeTypesStandardA2 VMSizeTypes = "Standard_A2" + // VMSizeTypesStandardA2mV2 ... + VMSizeTypesStandardA2mV2 VMSizeTypes = "Standard_A2m_v2" + // VMSizeTypesStandardA2V2 ... + VMSizeTypesStandardA2V2 VMSizeTypes = "Standard_A2_v2" + // VMSizeTypesStandardA3 ... + VMSizeTypesStandardA3 VMSizeTypes = "Standard_A3" + // VMSizeTypesStandardA4 ... + VMSizeTypesStandardA4 VMSizeTypes = "Standard_A4" + // VMSizeTypesStandardA4mV2 ... + VMSizeTypesStandardA4mV2 VMSizeTypes = "Standard_A4m_v2" + // VMSizeTypesStandardA4V2 ... + VMSizeTypesStandardA4V2 VMSizeTypes = "Standard_A4_v2" + // VMSizeTypesStandardA5 ... + VMSizeTypesStandardA5 VMSizeTypes = "Standard_A5" + // VMSizeTypesStandardA6 ... + VMSizeTypesStandardA6 VMSizeTypes = "Standard_A6" + // VMSizeTypesStandardA7 ... + VMSizeTypesStandardA7 VMSizeTypes = "Standard_A7" + // VMSizeTypesStandardA8 ... + VMSizeTypesStandardA8 VMSizeTypes = "Standard_A8" + // VMSizeTypesStandardA8mV2 ... + VMSizeTypesStandardA8mV2 VMSizeTypes = "Standard_A8m_v2" + // VMSizeTypesStandardA8V2 ... + VMSizeTypesStandardA8V2 VMSizeTypes = "Standard_A8_v2" + // VMSizeTypesStandardA9 ... + VMSizeTypesStandardA9 VMSizeTypes = "Standard_A9" + // VMSizeTypesStandardB2ms ... + VMSizeTypesStandardB2ms VMSizeTypes = "Standard_B2ms" + // VMSizeTypesStandardB2s ... + VMSizeTypesStandardB2s VMSizeTypes = "Standard_B2s" + // VMSizeTypesStandardB4ms ... + VMSizeTypesStandardB4ms VMSizeTypes = "Standard_B4ms" + // VMSizeTypesStandardB8ms ... + VMSizeTypesStandardB8ms VMSizeTypes = "Standard_B8ms" + // VMSizeTypesStandardD1 ... + VMSizeTypesStandardD1 VMSizeTypes = "Standard_D1" + // VMSizeTypesStandardD11 ... + VMSizeTypesStandardD11 VMSizeTypes = "Standard_D11" + // VMSizeTypesStandardD11V2 ... + VMSizeTypesStandardD11V2 VMSizeTypes = "Standard_D11_v2" + // VMSizeTypesStandardD11V2Promo ... + VMSizeTypesStandardD11V2Promo VMSizeTypes = "Standard_D11_v2_Promo" + // VMSizeTypesStandardD12 ... + VMSizeTypesStandardD12 VMSizeTypes = "Standard_D12" + // VMSizeTypesStandardD12V2 ... + VMSizeTypesStandardD12V2 VMSizeTypes = "Standard_D12_v2" + // VMSizeTypesStandardD12V2Promo ... + VMSizeTypesStandardD12V2Promo VMSizeTypes = "Standard_D12_v2_Promo" + // VMSizeTypesStandardD13 ... + VMSizeTypesStandardD13 VMSizeTypes = "Standard_D13" + // VMSizeTypesStandardD13V2 ... + VMSizeTypesStandardD13V2 VMSizeTypes = "Standard_D13_v2" + // VMSizeTypesStandardD13V2Promo ... + VMSizeTypesStandardD13V2Promo VMSizeTypes = "Standard_D13_v2_Promo" + // VMSizeTypesStandardD14 ... + VMSizeTypesStandardD14 VMSizeTypes = "Standard_D14" + // VMSizeTypesStandardD14V2 ... + VMSizeTypesStandardD14V2 VMSizeTypes = "Standard_D14_v2" + // VMSizeTypesStandardD14V2Promo ... + VMSizeTypesStandardD14V2Promo VMSizeTypes = "Standard_D14_v2_Promo" + // VMSizeTypesStandardD15V2 ... + VMSizeTypesStandardD15V2 VMSizeTypes = "Standard_D15_v2" + // VMSizeTypesStandardD16sV3 ... + VMSizeTypesStandardD16sV3 VMSizeTypes = "Standard_D16s_v3" + // VMSizeTypesStandardD16V3 ... + VMSizeTypesStandardD16V3 VMSizeTypes = "Standard_D16_v3" + // VMSizeTypesStandardD1V2 ... + VMSizeTypesStandardD1V2 VMSizeTypes = "Standard_D1_v2" + // VMSizeTypesStandardD2 ... + VMSizeTypesStandardD2 VMSizeTypes = "Standard_D2" + // VMSizeTypesStandardD2sV3 ... + VMSizeTypesStandardD2sV3 VMSizeTypes = "Standard_D2s_v3" + // VMSizeTypesStandardD2V2 ... + VMSizeTypesStandardD2V2 VMSizeTypes = "Standard_D2_v2" + // VMSizeTypesStandardD2V2Promo ... + VMSizeTypesStandardD2V2Promo VMSizeTypes = "Standard_D2_v2_Promo" + // VMSizeTypesStandardD2V3 ... + VMSizeTypesStandardD2V3 VMSizeTypes = "Standard_D2_v3" + // VMSizeTypesStandardD3 ... + VMSizeTypesStandardD3 VMSizeTypes = "Standard_D3" + // VMSizeTypesStandardD32sV3 ... + VMSizeTypesStandardD32sV3 VMSizeTypes = "Standard_D32s_v3" + // VMSizeTypesStandardD32V3 ... + VMSizeTypesStandardD32V3 VMSizeTypes = "Standard_D32_v3" + // VMSizeTypesStandardD3V2 ... + VMSizeTypesStandardD3V2 VMSizeTypes = "Standard_D3_v2" + // VMSizeTypesStandardD3V2Promo ... + VMSizeTypesStandardD3V2Promo VMSizeTypes = "Standard_D3_v2_Promo" + // VMSizeTypesStandardD4 ... + VMSizeTypesStandardD4 VMSizeTypes = "Standard_D4" + // VMSizeTypesStandardD4sV3 ... + VMSizeTypesStandardD4sV3 VMSizeTypes = "Standard_D4s_v3" + // VMSizeTypesStandardD4V2 ... + VMSizeTypesStandardD4V2 VMSizeTypes = "Standard_D4_v2" + // VMSizeTypesStandardD4V2Promo ... + VMSizeTypesStandardD4V2Promo VMSizeTypes = "Standard_D4_v2_Promo" + // VMSizeTypesStandardD4V3 ... + VMSizeTypesStandardD4V3 VMSizeTypes = "Standard_D4_v3" + // VMSizeTypesStandardD5V2 ... + VMSizeTypesStandardD5V2 VMSizeTypes = "Standard_D5_v2" + // VMSizeTypesStandardD5V2Promo ... + VMSizeTypesStandardD5V2Promo VMSizeTypes = "Standard_D5_v2_Promo" + // VMSizeTypesStandardD64sV3 ... + VMSizeTypesStandardD64sV3 VMSizeTypes = "Standard_D64s_v3" + // VMSizeTypesStandardD64V3 ... + VMSizeTypesStandardD64V3 VMSizeTypes = "Standard_D64_v3" + // VMSizeTypesStandardD8sV3 ... + VMSizeTypesStandardD8sV3 VMSizeTypes = "Standard_D8s_v3" + // VMSizeTypesStandardD8V3 ... + VMSizeTypesStandardD8V3 VMSizeTypes = "Standard_D8_v3" + // VMSizeTypesStandardDS1 ... + VMSizeTypesStandardDS1 VMSizeTypes = "Standard_DS1" + // VMSizeTypesStandardDS11 ... + VMSizeTypesStandardDS11 VMSizeTypes = "Standard_DS11" + // VMSizeTypesStandardDS11V2 ... + VMSizeTypesStandardDS11V2 VMSizeTypes = "Standard_DS11_v2" + // VMSizeTypesStandardDS11V2Promo ... + VMSizeTypesStandardDS11V2Promo VMSizeTypes = "Standard_DS11_v2_Promo" + // VMSizeTypesStandardDS12 ... + VMSizeTypesStandardDS12 VMSizeTypes = "Standard_DS12" + // VMSizeTypesStandardDS12V2 ... + VMSizeTypesStandardDS12V2 VMSizeTypes = "Standard_DS12_v2" + // VMSizeTypesStandardDS12V2Promo ... + VMSizeTypesStandardDS12V2Promo VMSizeTypes = "Standard_DS12_v2_Promo" + // VMSizeTypesStandardDS13 ... + VMSizeTypesStandardDS13 VMSizeTypes = "Standard_DS13" + // VMSizeTypesStandardDS132V2 ... + VMSizeTypesStandardDS132V2 VMSizeTypes = "Standard_DS13-2_v2" + // VMSizeTypesStandardDS134V2 ... + VMSizeTypesStandardDS134V2 VMSizeTypes = "Standard_DS13-4_v2" + // VMSizeTypesStandardDS13V2 ... + VMSizeTypesStandardDS13V2 VMSizeTypes = "Standard_DS13_v2" + // VMSizeTypesStandardDS13V2Promo ... + VMSizeTypesStandardDS13V2Promo VMSizeTypes = "Standard_DS13_v2_Promo" + // VMSizeTypesStandardDS14 ... + VMSizeTypesStandardDS14 VMSizeTypes = "Standard_DS14" + // VMSizeTypesStandardDS144V2 ... + VMSizeTypesStandardDS144V2 VMSizeTypes = "Standard_DS14-4_v2" + // VMSizeTypesStandardDS148V2 ... + VMSizeTypesStandardDS148V2 VMSizeTypes = "Standard_DS14-8_v2" + // VMSizeTypesStandardDS14V2 ... + VMSizeTypesStandardDS14V2 VMSizeTypes = "Standard_DS14_v2" + // VMSizeTypesStandardDS14V2Promo ... + VMSizeTypesStandardDS14V2Promo VMSizeTypes = "Standard_DS14_v2_Promo" + // VMSizeTypesStandardDS15V2 ... + VMSizeTypesStandardDS15V2 VMSizeTypes = "Standard_DS15_v2" + // VMSizeTypesStandardDS1V2 ... + VMSizeTypesStandardDS1V2 VMSizeTypes = "Standard_DS1_v2" + // VMSizeTypesStandardDS2 ... + VMSizeTypesStandardDS2 VMSizeTypes = "Standard_DS2" + // VMSizeTypesStandardDS2V2 ... + VMSizeTypesStandardDS2V2 VMSizeTypes = "Standard_DS2_v2" + // VMSizeTypesStandardDS2V2Promo ... + VMSizeTypesStandardDS2V2Promo VMSizeTypes = "Standard_DS2_v2_Promo" + // VMSizeTypesStandardDS3 ... + VMSizeTypesStandardDS3 VMSizeTypes = "Standard_DS3" + // VMSizeTypesStandardDS3V2 ... + VMSizeTypesStandardDS3V2 VMSizeTypes = "Standard_DS3_v2" + // VMSizeTypesStandardDS3V2Promo ... + VMSizeTypesStandardDS3V2Promo VMSizeTypes = "Standard_DS3_v2_Promo" + // VMSizeTypesStandardDS4 ... + VMSizeTypesStandardDS4 VMSizeTypes = "Standard_DS4" + // VMSizeTypesStandardDS4V2 ... + VMSizeTypesStandardDS4V2 VMSizeTypes = "Standard_DS4_v2" + // VMSizeTypesStandardDS4V2Promo ... + VMSizeTypesStandardDS4V2Promo VMSizeTypes = "Standard_DS4_v2_Promo" + // VMSizeTypesStandardDS5V2 ... + VMSizeTypesStandardDS5V2 VMSizeTypes = "Standard_DS5_v2" + // VMSizeTypesStandardDS5V2Promo ... + VMSizeTypesStandardDS5V2Promo VMSizeTypes = "Standard_DS5_v2_Promo" + // VMSizeTypesStandardE16sV3 ... + VMSizeTypesStandardE16sV3 VMSizeTypes = "Standard_E16s_v3" + // VMSizeTypesStandardE16V3 ... + VMSizeTypesStandardE16V3 VMSizeTypes = "Standard_E16_v3" + // VMSizeTypesStandardE2sV3 ... + VMSizeTypesStandardE2sV3 VMSizeTypes = "Standard_E2s_v3" + // VMSizeTypesStandardE2V3 ... + VMSizeTypesStandardE2V3 VMSizeTypes = "Standard_E2_v3" + // VMSizeTypesStandardE3216sV3 ... + VMSizeTypesStandardE3216sV3 VMSizeTypes = "Standard_E32-16s_v3" + // VMSizeTypesStandardE328sV3 ... + VMSizeTypesStandardE328sV3 VMSizeTypes = "Standard_E32-8s_v3" + // VMSizeTypesStandardE32sV3 ... + VMSizeTypesStandardE32sV3 VMSizeTypes = "Standard_E32s_v3" + // VMSizeTypesStandardE32V3 ... + VMSizeTypesStandardE32V3 VMSizeTypes = "Standard_E32_v3" + // VMSizeTypesStandardE4sV3 ... + VMSizeTypesStandardE4sV3 VMSizeTypes = "Standard_E4s_v3" + // VMSizeTypesStandardE4V3 ... + VMSizeTypesStandardE4V3 VMSizeTypes = "Standard_E4_v3" + // VMSizeTypesStandardE6416sV3 ... + VMSizeTypesStandardE6416sV3 VMSizeTypes = "Standard_E64-16s_v3" + // VMSizeTypesStandardE6432sV3 ... + VMSizeTypesStandardE6432sV3 VMSizeTypes = "Standard_E64-32s_v3" + // VMSizeTypesStandardE64sV3 ... + VMSizeTypesStandardE64sV3 VMSizeTypes = "Standard_E64s_v3" + // VMSizeTypesStandardE64V3 ... + VMSizeTypesStandardE64V3 VMSizeTypes = "Standard_E64_v3" + // VMSizeTypesStandardE8sV3 ... + VMSizeTypesStandardE8sV3 VMSizeTypes = "Standard_E8s_v3" + // VMSizeTypesStandardE8V3 ... + VMSizeTypesStandardE8V3 VMSizeTypes = "Standard_E8_v3" + // VMSizeTypesStandardF1 ... + VMSizeTypesStandardF1 VMSizeTypes = "Standard_F1" + // VMSizeTypesStandardF16 ... + VMSizeTypesStandardF16 VMSizeTypes = "Standard_F16" + // VMSizeTypesStandardF16s ... + VMSizeTypesStandardF16s VMSizeTypes = "Standard_F16s" + // VMSizeTypesStandardF16sV2 ... + VMSizeTypesStandardF16sV2 VMSizeTypes = "Standard_F16s_v2" + // VMSizeTypesStandardF1s ... + VMSizeTypesStandardF1s VMSizeTypes = "Standard_F1s" + // VMSizeTypesStandardF2 ... + VMSizeTypesStandardF2 VMSizeTypes = "Standard_F2" + // VMSizeTypesStandardF2s ... + VMSizeTypesStandardF2s VMSizeTypes = "Standard_F2s" + // VMSizeTypesStandardF2sV2 ... + VMSizeTypesStandardF2sV2 VMSizeTypes = "Standard_F2s_v2" + // VMSizeTypesStandardF32sV2 ... + VMSizeTypesStandardF32sV2 VMSizeTypes = "Standard_F32s_v2" + // VMSizeTypesStandardF4 ... + VMSizeTypesStandardF4 VMSizeTypes = "Standard_F4" + // VMSizeTypesStandardF4s ... + VMSizeTypesStandardF4s VMSizeTypes = "Standard_F4s" + // VMSizeTypesStandardF4sV2 ... + VMSizeTypesStandardF4sV2 VMSizeTypes = "Standard_F4s_v2" + // VMSizeTypesStandardF64sV2 ... + VMSizeTypesStandardF64sV2 VMSizeTypes = "Standard_F64s_v2" + // VMSizeTypesStandardF72sV2 ... + VMSizeTypesStandardF72sV2 VMSizeTypes = "Standard_F72s_v2" + // VMSizeTypesStandardF8 ... + VMSizeTypesStandardF8 VMSizeTypes = "Standard_F8" + // VMSizeTypesStandardF8s ... + VMSizeTypesStandardF8s VMSizeTypes = "Standard_F8s" + // VMSizeTypesStandardF8sV2 ... + VMSizeTypesStandardF8sV2 VMSizeTypes = "Standard_F8s_v2" + // VMSizeTypesStandardG1 ... + VMSizeTypesStandardG1 VMSizeTypes = "Standard_G1" + // VMSizeTypesStandardG2 ... + VMSizeTypesStandardG2 VMSizeTypes = "Standard_G2" + // VMSizeTypesStandardG3 ... + VMSizeTypesStandardG3 VMSizeTypes = "Standard_G3" + // VMSizeTypesStandardG4 ... + VMSizeTypesStandardG4 VMSizeTypes = "Standard_G4" + // VMSizeTypesStandardG5 ... + VMSizeTypesStandardG5 VMSizeTypes = "Standard_G5" + // VMSizeTypesStandardGS1 ... + VMSizeTypesStandardGS1 VMSizeTypes = "Standard_GS1" + // VMSizeTypesStandardGS2 ... + VMSizeTypesStandardGS2 VMSizeTypes = "Standard_GS2" + // VMSizeTypesStandardGS3 ... + VMSizeTypesStandardGS3 VMSizeTypes = "Standard_GS3" + // VMSizeTypesStandardGS4 ... + VMSizeTypesStandardGS4 VMSizeTypes = "Standard_GS4" + // VMSizeTypesStandardGS44 ... + VMSizeTypesStandardGS44 VMSizeTypes = "Standard_GS4-4" + // VMSizeTypesStandardGS48 ... + VMSizeTypesStandardGS48 VMSizeTypes = "Standard_GS4-8" + // VMSizeTypesStandardGS5 ... + VMSizeTypesStandardGS5 VMSizeTypes = "Standard_GS5" + // VMSizeTypesStandardGS516 ... + VMSizeTypesStandardGS516 VMSizeTypes = "Standard_GS5-16" + // VMSizeTypesStandardGS58 ... + VMSizeTypesStandardGS58 VMSizeTypes = "Standard_GS5-8" + // VMSizeTypesStandardH16 ... + VMSizeTypesStandardH16 VMSizeTypes = "Standard_H16" + // VMSizeTypesStandardH16m ... + VMSizeTypesStandardH16m VMSizeTypes = "Standard_H16m" + // VMSizeTypesStandardH16mr ... + VMSizeTypesStandardH16mr VMSizeTypes = "Standard_H16mr" + // VMSizeTypesStandardH16r ... + VMSizeTypesStandardH16r VMSizeTypes = "Standard_H16r" + // VMSizeTypesStandardH8 ... + VMSizeTypesStandardH8 VMSizeTypes = "Standard_H8" + // VMSizeTypesStandardH8m ... + VMSizeTypesStandardH8m VMSizeTypes = "Standard_H8m" + // VMSizeTypesStandardL16s ... + VMSizeTypesStandardL16s VMSizeTypes = "Standard_L16s" + // VMSizeTypesStandardL32s ... + VMSizeTypesStandardL32s VMSizeTypes = "Standard_L32s" + // VMSizeTypesStandardL4s ... + VMSizeTypesStandardL4s VMSizeTypes = "Standard_L4s" + // VMSizeTypesStandardL8s ... + VMSizeTypesStandardL8s VMSizeTypes = "Standard_L8s" + // VMSizeTypesStandardM12832ms ... + VMSizeTypesStandardM12832ms VMSizeTypes = "Standard_M128-32ms" + // VMSizeTypesStandardM12864ms ... + VMSizeTypesStandardM12864ms VMSizeTypes = "Standard_M128-64ms" + // VMSizeTypesStandardM128ms ... + VMSizeTypesStandardM128ms VMSizeTypes = "Standard_M128ms" + // VMSizeTypesStandardM128s ... + VMSizeTypesStandardM128s VMSizeTypes = "Standard_M128s" + // VMSizeTypesStandardM6416ms ... + VMSizeTypesStandardM6416ms VMSizeTypes = "Standard_M64-16ms" + // VMSizeTypesStandardM6432ms ... + VMSizeTypesStandardM6432ms VMSizeTypes = "Standard_M64-32ms" + // VMSizeTypesStandardM64ms ... + VMSizeTypesStandardM64ms VMSizeTypes = "Standard_M64ms" + // VMSizeTypesStandardM64s ... + VMSizeTypesStandardM64s VMSizeTypes = "Standard_M64s" + // VMSizeTypesStandardNC12 ... + VMSizeTypesStandardNC12 VMSizeTypes = "Standard_NC12" + // VMSizeTypesStandardNC12sV2 ... + VMSizeTypesStandardNC12sV2 VMSizeTypes = "Standard_NC12s_v2" + // VMSizeTypesStandardNC12sV3 ... + VMSizeTypesStandardNC12sV3 VMSizeTypes = "Standard_NC12s_v3" + // VMSizeTypesStandardNC24 ... + VMSizeTypesStandardNC24 VMSizeTypes = "Standard_NC24" + // VMSizeTypesStandardNC24r ... + VMSizeTypesStandardNC24r VMSizeTypes = "Standard_NC24r" + // VMSizeTypesStandardNC24rsV2 ... + VMSizeTypesStandardNC24rsV2 VMSizeTypes = "Standard_NC24rs_v2" + // VMSizeTypesStandardNC24rsV3 ... + VMSizeTypesStandardNC24rsV3 VMSizeTypes = "Standard_NC24rs_v3" + // VMSizeTypesStandardNC24sV2 ... + VMSizeTypesStandardNC24sV2 VMSizeTypes = "Standard_NC24s_v2" + // VMSizeTypesStandardNC24sV3 ... + VMSizeTypesStandardNC24sV3 VMSizeTypes = "Standard_NC24s_v3" + // VMSizeTypesStandardNC6 ... + VMSizeTypesStandardNC6 VMSizeTypes = "Standard_NC6" + // VMSizeTypesStandardNC6sV2 ... + VMSizeTypesStandardNC6sV2 VMSizeTypes = "Standard_NC6s_v2" + // VMSizeTypesStandardNC6sV3 ... + VMSizeTypesStandardNC6sV3 VMSizeTypes = "Standard_NC6s_v3" + // VMSizeTypesStandardND12s ... + VMSizeTypesStandardND12s VMSizeTypes = "Standard_ND12s" + // VMSizeTypesStandardND24rs ... + VMSizeTypesStandardND24rs VMSizeTypes = "Standard_ND24rs" + // VMSizeTypesStandardND24s ... + VMSizeTypesStandardND24s VMSizeTypes = "Standard_ND24s" + // VMSizeTypesStandardND6s ... + VMSizeTypesStandardND6s VMSizeTypes = "Standard_ND6s" + // VMSizeTypesStandardNV12 ... + VMSizeTypesStandardNV12 VMSizeTypes = "Standard_NV12" + // VMSizeTypesStandardNV24 ... + VMSizeTypesStandardNV24 VMSizeTypes = "Standard_NV24" + // VMSizeTypesStandardNV6 ... + VMSizeTypesStandardNV6 VMSizeTypes = "Standard_NV6" +) + +// PossibleVMSizeTypesValues returns an array of possible values for the VMSizeTypes const type. +func PossibleVMSizeTypesValues() []VMSizeTypes { + return []VMSizeTypes{VMSizeTypesStandardA1, VMSizeTypesStandardA10, VMSizeTypesStandardA11, VMSizeTypesStandardA1V2, VMSizeTypesStandardA2, VMSizeTypesStandardA2mV2, VMSizeTypesStandardA2V2, VMSizeTypesStandardA3, VMSizeTypesStandardA4, VMSizeTypesStandardA4mV2, VMSizeTypesStandardA4V2, VMSizeTypesStandardA5, VMSizeTypesStandardA6, VMSizeTypesStandardA7, VMSizeTypesStandardA8, VMSizeTypesStandardA8mV2, VMSizeTypesStandardA8V2, VMSizeTypesStandardA9, VMSizeTypesStandardB2ms, VMSizeTypesStandardB2s, VMSizeTypesStandardB4ms, VMSizeTypesStandardB8ms, VMSizeTypesStandardD1, VMSizeTypesStandardD11, VMSizeTypesStandardD11V2, VMSizeTypesStandardD11V2Promo, VMSizeTypesStandardD12, VMSizeTypesStandardD12V2, VMSizeTypesStandardD12V2Promo, VMSizeTypesStandardD13, VMSizeTypesStandardD13V2, VMSizeTypesStandardD13V2Promo, VMSizeTypesStandardD14, VMSizeTypesStandardD14V2, VMSizeTypesStandardD14V2Promo, VMSizeTypesStandardD15V2, VMSizeTypesStandardD16sV3, VMSizeTypesStandardD16V3, VMSizeTypesStandardD1V2, VMSizeTypesStandardD2, VMSizeTypesStandardD2sV3, VMSizeTypesStandardD2V2, VMSizeTypesStandardD2V2Promo, VMSizeTypesStandardD2V3, VMSizeTypesStandardD3, VMSizeTypesStandardD32sV3, VMSizeTypesStandardD32V3, VMSizeTypesStandardD3V2, VMSizeTypesStandardD3V2Promo, VMSizeTypesStandardD4, VMSizeTypesStandardD4sV3, VMSizeTypesStandardD4V2, VMSizeTypesStandardD4V2Promo, VMSizeTypesStandardD4V3, VMSizeTypesStandardD5V2, VMSizeTypesStandardD5V2Promo, VMSizeTypesStandardD64sV3, VMSizeTypesStandardD64V3, VMSizeTypesStandardD8sV3, VMSizeTypesStandardD8V3, VMSizeTypesStandardDS1, VMSizeTypesStandardDS11, VMSizeTypesStandardDS11V2, VMSizeTypesStandardDS11V2Promo, VMSizeTypesStandardDS12, VMSizeTypesStandardDS12V2, VMSizeTypesStandardDS12V2Promo, VMSizeTypesStandardDS13, VMSizeTypesStandardDS132V2, VMSizeTypesStandardDS134V2, VMSizeTypesStandardDS13V2, VMSizeTypesStandardDS13V2Promo, VMSizeTypesStandardDS14, VMSizeTypesStandardDS144V2, VMSizeTypesStandardDS148V2, VMSizeTypesStandardDS14V2, VMSizeTypesStandardDS14V2Promo, VMSizeTypesStandardDS15V2, VMSizeTypesStandardDS1V2, VMSizeTypesStandardDS2, VMSizeTypesStandardDS2V2, VMSizeTypesStandardDS2V2Promo, VMSizeTypesStandardDS3, VMSizeTypesStandardDS3V2, VMSizeTypesStandardDS3V2Promo, VMSizeTypesStandardDS4, VMSizeTypesStandardDS4V2, VMSizeTypesStandardDS4V2Promo, VMSizeTypesStandardDS5V2, VMSizeTypesStandardDS5V2Promo, VMSizeTypesStandardE16sV3, VMSizeTypesStandardE16V3, VMSizeTypesStandardE2sV3, VMSizeTypesStandardE2V3, VMSizeTypesStandardE3216sV3, VMSizeTypesStandardE328sV3, VMSizeTypesStandardE32sV3, VMSizeTypesStandardE32V3, VMSizeTypesStandardE4sV3, VMSizeTypesStandardE4V3, VMSizeTypesStandardE6416sV3, VMSizeTypesStandardE6432sV3, VMSizeTypesStandardE64sV3, VMSizeTypesStandardE64V3, VMSizeTypesStandardE8sV3, VMSizeTypesStandardE8V3, VMSizeTypesStandardF1, VMSizeTypesStandardF16, VMSizeTypesStandardF16s, VMSizeTypesStandardF16sV2, VMSizeTypesStandardF1s, VMSizeTypesStandardF2, VMSizeTypesStandardF2s, VMSizeTypesStandardF2sV2, VMSizeTypesStandardF32sV2, VMSizeTypesStandardF4, VMSizeTypesStandardF4s, VMSizeTypesStandardF4sV2, VMSizeTypesStandardF64sV2, VMSizeTypesStandardF72sV2, VMSizeTypesStandardF8, VMSizeTypesStandardF8s, VMSizeTypesStandardF8sV2, VMSizeTypesStandardG1, VMSizeTypesStandardG2, VMSizeTypesStandardG3, VMSizeTypesStandardG4, VMSizeTypesStandardG5, VMSizeTypesStandardGS1, VMSizeTypesStandardGS2, VMSizeTypesStandardGS3, VMSizeTypesStandardGS4, VMSizeTypesStandardGS44, VMSizeTypesStandardGS48, VMSizeTypesStandardGS5, VMSizeTypesStandardGS516, VMSizeTypesStandardGS58, VMSizeTypesStandardH16, VMSizeTypesStandardH16m, VMSizeTypesStandardH16mr, VMSizeTypesStandardH16r, VMSizeTypesStandardH8, VMSizeTypesStandardH8m, VMSizeTypesStandardL16s, VMSizeTypesStandardL32s, VMSizeTypesStandardL4s, VMSizeTypesStandardL8s, VMSizeTypesStandardM12832ms, VMSizeTypesStandardM12864ms, VMSizeTypesStandardM128ms, VMSizeTypesStandardM128s, VMSizeTypesStandardM6416ms, VMSizeTypesStandardM6432ms, VMSizeTypesStandardM64ms, VMSizeTypesStandardM64s, VMSizeTypesStandardNC12, VMSizeTypesStandardNC12sV2, VMSizeTypesStandardNC12sV3, VMSizeTypesStandardNC24, VMSizeTypesStandardNC24r, VMSizeTypesStandardNC24rsV2, VMSizeTypesStandardNC24rsV3, VMSizeTypesStandardNC24sV2, VMSizeTypesStandardNC24sV3, VMSizeTypesStandardNC6, VMSizeTypesStandardNC6sV2, VMSizeTypesStandardNC6sV3, VMSizeTypesStandardND12s, VMSizeTypesStandardND24rs, VMSizeTypesStandardND24s, VMSizeTypesStandardND6s, VMSizeTypesStandardNV12, VMSizeTypesStandardNV24, VMSizeTypesStandardNV6} +} + +// WeekDay enumerates the values for week day. +type WeekDay string + +const ( + // WeekDayFriday ... + WeekDayFriday WeekDay = "Friday" + // WeekDayMonday ... + WeekDayMonday WeekDay = "Monday" + // WeekDaySaturday ... + WeekDaySaturday WeekDay = "Saturday" + // WeekDaySunday ... + WeekDaySunday WeekDay = "Sunday" + // WeekDayThursday ... + WeekDayThursday WeekDay = "Thursday" + // WeekDayTuesday ... + WeekDayTuesday WeekDay = "Tuesday" + // WeekDayWednesday ... + WeekDayWednesday WeekDay = "Wednesday" +) + +// PossibleWeekDayValues returns an array of possible values for the WeekDay const type. +func PossibleWeekDayValues() []WeekDay { + return []WeekDay{WeekDayFriday, WeekDayMonday, WeekDaySaturday, WeekDaySunday, WeekDayThursday, WeekDayTuesday, WeekDayWednesday} +} + +// WorkloadRuntime enumerates the values for workload runtime. +type WorkloadRuntime string + +const ( + // WorkloadRuntimeOCIContainer Nodes will use Kubelet to run standard OCI container workloads. + WorkloadRuntimeOCIContainer WorkloadRuntime = "OCIContainer" + // WorkloadRuntimeWasmWasi Nodes will use Krustlet to run WASM workloads using the WASI provider (Preview). + WorkloadRuntimeWasmWasi WorkloadRuntime = "WasmWasi" +) + +// PossibleWorkloadRuntimeValues returns an array of possible values for the WorkloadRuntime const type. +func PossibleWorkloadRuntimeValues() []WorkloadRuntime { + return []WorkloadRuntime{WorkloadRuntimeOCIContainer, WorkloadRuntimeWasmWasi} +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/maintenanceconfigurations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/maintenanceconfigurations.go similarity index 91% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/maintenanceconfigurations.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/maintenanceconfigurations.go index fe6db11019d..441e6d2d3bb 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/maintenanceconfigurations.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/maintenanceconfigurations.go @@ -34,7 +34,7 @@ func NewMaintenanceConfigurationsClientWithBaseURI(baseURI string, subscriptionI // CreateOrUpdate sends the create or update request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // configName - the name of the maintenance configuration. // parameters - the maintenance configuration to create or update. @@ -50,8 +50,11 @@ func (client MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -90,7 +93,7 @@ func (client MaintenanceConfigurationsClient) CreateOrUpdatePreparer(ctx context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -126,7 +129,7 @@ func (client MaintenanceConfigurationsClient) CreateOrUpdateResponder(resp *http // Delete sends the delete request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // configName - the name of the maintenance configuration. func (client MaintenanceConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, configName string) (result autorest.Response, err error) { @@ -141,8 +144,11 @@ func (client MaintenanceConfigurationsClient) Delete(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -181,7 +187,7 @@ func (client MaintenanceConfigurationsClient) DeletePreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -213,7 +219,7 @@ func (client MaintenanceConfigurationsClient) DeleteResponder(resp *http.Respons // Get sends the get request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // configName - the name of the maintenance configuration. func (client MaintenanceConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, configName string) (result MaintenanceConfiguration, err error) { @@ -228,8 +234,11 @@ func (client MaintenanceConfigurationsClient) Get(ctx context.Context, resourceG }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -268,7 +277,7 @@ func (client MaintenanceConfigurationsClient) GetPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -301,7 +310,7 @@ func (client MaintenanceConfigurationsClient) GetResponder(resp *http.Response) // ListByManagedCluster sends the list by managed cluster request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. func (client MaintenanceConfigurationsClient) ListByManagedCluster(ctx context.Context, resourceGroupName string, resourceName string) (result MaintenanceConfigurationListResultPage, err error) { if tracing.IsEnabled() { @@ -315,8 +324,11 @@ func (client MaintenanceConfigurationsClient) ListByManagedCluster(ctx context.C }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -359,7 +371,7 @@ func (client MaintenanceConfigurationsClient) ListByManagedClusterPreparer(ctx c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/managedclusters.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/managedclusters.go similarity index 86% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/managedclusters.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/managedclusters.go index 29ca7dee89d..1c1c93d3eef 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/managedclusters.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/managedclusters.go @@ -33,7 +33,7 @@ func NewManagedClustersClientWithBaseURI(baseURI string, subscriptionID string) // CreateOrUpdate sends the create or update request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // parameters - the managed cluster to create or update. func (client ManagedClustersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedCluster) (result ManagedClustersCreateOrUpdateFuture, err error) { @@ -48,8 +48,11 @@ func (client ManagedClustersClient) CreateOrUpdate(ctx context.Context, resource }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -135,7 +138,7 @@ func (client ManagedClustersClient) CreateOrUpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -180,9 +183,11 @@ func (client ManagedClustersClient) CreateOrUpdateResponder(resp *http.Response) // Delete sends the delete request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. -func (client ManagedClustersClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersDeleteFuture, err error) { +// ignorePodDisruptionBudget - ignore-pod-disruption-budget=true to delete those pods on a node without +// considering Pod Disruption Budget +func (client ManagedClustersClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, ignorePodDisruptionBudget *bool) (result ManagedClustersDeleteFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.Delete") defer func() { @@ -194,8 +199,11 @@ func (client ManagedClustersClient) Delete(ctx context.Context, resourceGroupNam }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -203,7 +211,7 @@ func (client ManagedClustersClient) Delete(ctx context.Context, resourceGroupNam return result, validation.NewError("containerservice.ManagedClustersClient", "Delete", err.Error()) } - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, ignorePodDisruptionBudget) if err != nil { err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Delete", nil, "Failure preparing request") return @@ -219,17 +227,20 @@ func (client ManagedClustersClient) Delete(ctx context.Context, resourceGroupNam } // DeletePreparer prepares the Delete request. -func (client ManagedClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { +func (client ManagedClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, ignorePodDisruptionBudget *bool) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } + if ignorePodDisruptionBudget != nil { + queryParameters["ignore-pod-disruption-budget"] = autorest.Encode("query", *ignorePodDisruptionBudget) + } preparer := autorest.CreatePreparer( autorest.AsDelete(), @@ -268,7 +279,7 @@ func (client ManagedClustersClient) DeleteResponder(resp *http.Response) (result // Get sends the get request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. func (client ManagedClustersClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedCluster, err error) { if tracing.IsEnabled() { @@ -282,8 +293,11 @@ func (client ManagedClustersClient) Get(ctx context.Context, resourceGroupName s }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -321,7 +335,7 @@ func (client ManagedClustersClient) GetPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -356,7 +370,7 @@ func (client ManagedClustersClient) GetResponder(resp *http.Response) (result Ma // [ListClusterUserCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusterusercredentials) or // [ListClusterAdminCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusteradmincredentials) . // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // roleName - the name of the role for managed cluster accessProfile resource. func (client ManagedClustersClient) GetAccessProfile(ctx context.Context, resourceGroupName string, resourceName string, roleName string) (result ManagedClusterAccessProfile, err error) { @@ -371,8 +385,11 @@ func (client ManagedClustersClient) GetAccessProfile(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -411,7 +428,7 @@ func (client ManagedClustersClient) GetAccessProfilePreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -444,7 +461,7 @@ func (client ManagedClustersClient) GetAccessProfileResponder(resp *http.Respons // GetCommandResult sends the get command result request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // commandID - id of the command. func (client ManagedClustersClient) GetCommandResult(ctx context.Context, resourceGroupName string, resourceName string, commandID string) (result RunCommandResult, err error) { @@ -459,8 +476,11 @@ func (client ManagedClustersClient) GetCommandResult(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -499,7 +519,7 @@ func (client ManagedClustersClient) GetCommandResultPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -532,7 +552,7 @@ func (client ManagedClustersClient) GetCommandResultResponder(resp *http.Respons // GetOSOptions sends the get os options request. // Parameters: -// location - the name of a supported Azure region. +// location - the name of Azure region. // resourceType - the resource type for which the OS options needs to be returned func (client ManagedClustersClient) GetOSOptions(ctx context.Context, location string, resourceType string) (result OSOptionProfile, err error) { if tracing.IsEnabled() { @@ -545,6 +565,14 @@ func (client ManagedClustersClient) GetOSOptions(ctx context.Context, location s tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "GetOSOptions", err.Error()) + } + req, err := client.GetOSOptionsPreparer(ctx, location, resourceType) if err != nil { err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetOSOptions", nil, "Failure preparing request") @@ -574,7 +602,7 @@ func (client ManagedClustersClient) GetOSOptionsPreparer(ctx context.Context, lo "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -610,7 +638,7 @@ func (client ManagedClustersClient) GetOSOptionsResponder(resp *http.Response) ( // GetUpgradeProfile sends the get upgrade profile request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. func (client ManagedClustersClient) GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClusterUpgradeProfile, err error) { if tracing.IsEnabled() { @@ -624,8 +652,11 @@ func (client ManagedClustersClient) GetUpgradeProfile(ctx context.Context, resou }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -663,7 +694,7 @@ func (client ManagedClustersClient) GetUpgradeProfilePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -706,6 +737,12 @@ func (client ManagedClustersClient) List(ctx context.Context) (result ManagedClu tracing.EndSpan(ctx, sc, err) }() } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx) if err != nil { @@ -739,7 +776,7 @@ func (client ManagedClustersClient) ListPreparer(ctx context.Context) (*http.Req "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -809,7 +846,7 @@ func (client ManagedClustersClient) ListComplete(ctx context.Context) (result Ma // ListByResourceGroup sends the list by resource group request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client ManagedClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ManagedClusterListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListByResourceGroup") @@ -822,8 +859,11 @@ func (client ManagedClustersClient) ListByResourceGroup(ctx context.Context, res }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("containerservice.ManagedClustersClient", "ListByResourceGroup", err.Error()) } @@ -861,7 +901,7 @@ func (client ManagedClustersClient) ListByResourceGroupPreparer(ctx context.Cont "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -931,13 +971,10 @@ func (client ManagedClustersClient) ListByResourceGroupComplete(ctx context.Cont // ListClusterAdminCredentials sends the list cluster admin credentials request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // serverFqdn - server fqdn type for credentials to be returned -// formatParameter - only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' -// will return azure auth-provider kubeconfig; format 'exec' will return exec format kubeconfig, which requires -// kubelogin binary in the path. -func (client ManagedClustersClient) ListClusterAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string, formatParameter Format) (result CredentialResults, err error) { +func (client ManagedClustersClient) ListClusterAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result CredentialResults, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListClusterAdminCredentials") defer func() { @@ -949,8 +986,11 @@ func (client ManagedClustersClient) ListClusterAdminCredentials(ctx context.Cont }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -958,7 +998,7 @@ func (client ManagedClustersClient) ListClusterAdminCredentials(ctx context.Cont return result, validation.NewError("containerservice.ManagedClustersClient", "ListClusterAdminCredentials", err.Error()) } - req, err := client.ListClusterAdminCredentialsPreparer(ctx, resourceGroupName, resourceName, serverFqdn, formatParameter) + req, err := client.ListClusterAdminCredentialsPreparer(ctx, resourceGroupName, resourceName, serverFqdn) if err != nil { err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterAdminCredentials", nil, "Failure preparing request") return @@ -981,23 +1021,20 @@ func (client ManagedClustersClient) ListClusterAdminCredentials(ctx context.Cont } // ListClusterAdminCredentialsPreparer prepares the ListClusterAdminCredentials request. -func (client ManagedClustersClient) ListClusterAdminCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string, formatParameter Format) (*http.Request, error) { +func (client ManagedClustersClient) ListClusterAdminCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } if len(serverFqdn) > 0 { queryParameters["server-fqdn"] = autorest.Encode("query", serverFqdn) } - if len(string(formatParameter)) > 0 { - queryParameters["format"] = autorest.Encode("query", formatParameter) - } preparer := autorest.CreatePreparer( autorest.AsPost(), @@ -1027,7 +1064,7 @@ func (client ManagedClustersClient) ListClusterAdminCredentialsResponder(resp *h // ListClusterMonitoringUserCredentials sends the list cluster monitoring user credentials request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // serverFqdn - server fqdn type for credentials to be returned func (client ManagedClustersClient) ListClusterMonitoringUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result CredentialResults, err error) { @@ -1042,8 +1079,11 @@ func (client ManagedClustersClient) ListClusterMonitoringUserCredentials(ctx con }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -1081,7 +1121,7 @@ func (client ManagedClustersClient) ListClusterMonitoringUserCredentialsPreparer "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1117,10 +1157,13 @@ func (client ManagedClustersClient) ListClusterMonitoringUserCredentialsResponde // ListClusterUserCredentials sends the list cluster user credentials request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // serverFqdn - server fqdn type for credentials to be returned -func (client ManagedClustersClient) ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result CredentialResults, err error) { +// formatParameter - only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' +// will return azure auth-provider kubeconfig; format 'exec' will return exec format kubeconfig, which requires +// kubelogin binary in the path. +func (client ManagedClustersClient) ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string, formatParameter Format) (result CredentialResults, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListClusterUserCredentials") defer func() { @@ -1132,8 +1175,11 @@ func (client ManagedClustersClient) ListClusterUserCredentials(ctx context.Conte }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -1141,7 +1187,7 @@ func (client ManagedClustersClient) ListClusterUserCredentials(ctx context.Conte return result, validation.NewError("containerservice.ManagedClustersClient", "ListClusterUserCredentials", err.Error()) } - req, err := client.ListClusterUserCredentialsPreparer(ctx, resourceGroupName, resourceName, serverFqdn) + req, err := client.ListClusterUserCredentialsPreparer(ctx, resourceGroupName, resourceName, serverFqdn, formatParameter) if err != nil { err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterUserCredentials", nil, "Failure preparing request") return @@ -1164,20 +1210,23 @@ func (client ManagedClustersClient) ListClusterUserCredentials(ctx context.Conte } // ListClusterUserCredentialsPreparer prepares the ListClusterUserCredentials request. -func (client ManagedClustersClient) ListClusterUserCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (*http.Request, error) { +func (client ManagedClustersClient) ListClusterUserCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string, formatParameter Format) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } if len(serverFqdn) > 0 { queryParameters["server-fqdn"] = autorest.Encode("query", serverFqdn) } + if len(string(formatParameter)) > 0 { + queryParameters["format"] = autorest.Encode("query", formatParameter) + } preparer := autorest.CreatePreparer( autorest.AsPost(), @@ -1208,7 +1257,7 @@ func (client ManagedClustersClient) ListClusterUserCredentialsResponder(resp *ht // ListOutboundNetworkDependenciesEndpoints gets a list of egress endpoints (network endpoints of all outbound // dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, resourceName string) (result OutboundEnvironmentEndpointCollectionPage, err error) { if tracing.IsEnabled() { @@ -1222,8 +1271,11 @@ func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpoints(ctx }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -1266,7 +1318,7 @@ func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsPrep "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1336,7 +1388,7 @@ func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsComp // ResetAADProfile sends the reset aad profile request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // parameters - the AAD profile to set on the Managed Cluster func (client ManagedClustersClient) ResetAADProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterAADProfile) (result ManagedClustersResetAADProfileFuture, err error) { @@ -1351,8 +1403,11 @@ func (client ManagedClustersClient) ResetAADProfile(ctx context.Context, resourc }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -1383,7 +1438,7 @@ func (client ManagedClustersClient) ResetAADProfilePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1427,7 +1482,7 @@ func (client ManagedClustersClient) ResetAADProfileResponder(resp *http.Response // ResetServicePrincipalProfile this action cannot be performed on a cluster that is not using a service principal // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // parameters - the service principal profile to set on the managed cluster. func (client ManagedClustersClient) ResetServicePrincipalProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterServicePrincipalProfile) (result ManagedClustersResetServicePrincipalProfileFuture, err error) { @@ -1442,8 +1497,11 @@ func (client ManagedClustersClient) ResetServicePrincipalProfile(ctx context.Con }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -1476,7 +1534,7 @@ func (client ManagedClustersClient) ResetServicePrincipalProfilePreparer(ctx con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1521,7 +1579,7 @@ func (client ManagedClustersClient) ResetServicePrincipalProfileResponder(resp * // RotateClusterCertificates see [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for // more details about rotating managed cluster certificates. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. func (client ManagedClustersClient) RotateClusterCertificates(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersRotateClusterCertificatesFuture, err error) { if tracing.IsEnabled() { @@ -1535,8 +1593,11 @@ func (client ManagedClustersClient) RotateClusterCertificates(ctx context.Contex }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -1567,7 +1628,7 @@ func (client ManagedClustersClient) RotateClusterCertificatesPreparer(ctx contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1607,10 +1668,101 @@ func (client ManagedClustersClient) RotateClusterCertificatesResponder(resp *htt return } +// RotateServiceAccountSigningKeys sends the rotate service account signing keys request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) RotateServiceAccountSigningKeys(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersRotateServiceAccountSigningKeysFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.RotateServiceAccountSigningKeys") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "RotateServiceAccountSigningKeys", err.Error()) + } + + req, err := client.RotateServiceAccountSigningKeysPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RotateServiceAccountSigningKeys", nil, "Failure preparing request") + return + } + + result, err = client.RotateServiceAccountSigningKeysSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RotateServiceAccountSigningKeys", result.Response(), "Failure sending request") + return + } + + return +} + +// RotateServiceAccountSigningKeysPreparer prepares the RotateServiceAccountSigningKeys request. +func (client ManagedClustersClient) RotateServiceAccountSigningKeysPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RotateServiceAccountSigningKeysSender sends the RotateServiceAccountSigningKeys request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) RotateServiceAccountSigningKeysSender(req *http.Request) (future ManagedClustersRotateServiceAccountSigningKeysFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RotateServiceAccountSigningKeysResponder handles the response to the RotateServiceAccountSigningKeys request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) RotateServiceAccountSigningKeysResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + // RunCommand AKS will create a pod to run the command. This is primarily useful for private clusters. For more // information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // requestPayload - the run command request func (client ManagedClustersClient) RunCommand(ctx context.Context, resourceGroupName string, resourceName string, requestPayload RunCommandRequest) (result ManagedClustersRunCommandFuture, err error) { @@ -1625,8 +1777,11 @@ func (client ManagedClustersClient) RunCommand(ctx context.Context, resourceGrou }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -1659,7 +1814,7 @@ func (client ManagedClustersClient) RunCommandPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1705,7 +1860,7 @@ func (client ManagedClustersClient) RunCommandResponder(resp *http.Response) (re // Start see [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about // starting a cluster. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. func (client ManagedClustersClient) Start(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersStartFuture, err error) { if tracing.IsEnabled() { @@ -1719,8 +1874,11 @@ func (client ManagedClustersClient) Start(ctx context.Context, resourceGroupName }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -1751,7 +1909,7 @@ func (client ManagedClustersClient) StartPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1796,7 +1954,7 @@ func (client ManagedClustersClient) StartResponder(resp *http.Response) (result // charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for // more details about stopping a cluster. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. func (client ManagedClustersClient) Stop(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersStopFuture, err error) { if tracing.IsEnabled() { @@ -1810,8 +1968,11 @@ func (client ManagedClustersClient) Stop(ctx context.Context, resourceGroupName }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -1842,7 +2003,7 @@ func (client ManagedClustersClient) StopPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1884,7 +2045,7 @@ func (client ManagedClustersClient) StopResponder(resp *http.Response) (result a // UpdateTags sends the update tags request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // parameters - parameters supplied to the Update Managed Cluster Tags operation. func (client ManagedClustersClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (result ManagedClustersUpdateTagsFuture, err error) { @@ -1899,8 +2060,11 @@ func (client ManagedClustersClient) UpdateTags(ctx context.Context, resourceGrou }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -1931,7 +2095,7 @@ func (client ManagedClustersClient) UpdateTagsPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/managedclustersnapshots.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/managedclustersnapshots.go new file mode 100644 index 00000000000..89f23ffed8c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/managedclustersnapshots.go @@ -0,0 +1,638 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ManagedClusterSnapshotsClient is the the Container Service Client. +type ManagedClusterSnapshotsClient struct { + BaseClient +} + +// NewManagedClusterSnapshotsClient creates an instance of the ManagedClusterSnapshotsClient client. +func NewManagedClusterSnapshotsClient(subscriptionID string) ManagedClusterSnapshotsClient { + return NewManagedClusterSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagedClusterSnapshotsClientWithBaseURI creates an instance of the ManagedClusterSnapshotsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewManagedClusterSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) ManagedClusterSnapshotsClient { + return ManagedClusterSnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - the managed cluster snapshot to create or update. +func (client ManagedClusterSnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterSnapshot) (result ManagedClusterSnapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClusterSnapshotsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ManagedClusterSnapshotsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterSnapshot) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClusterSnapshotsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ManagedClusterSnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedClusterSnapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClusterSnapshotsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClusterSnapshotsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ManagedClusterSnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClusterSnapshotsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ManagedClusterSnapshotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClusterSnapshotsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClusterSnapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClusterSnapshotsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ManagedClusterSnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClusterSnapshotsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ManagedClusterSnapshotsClient) GetResponder(resp *http.Response) (result ManagedClusterSnapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client ManagedClusterSnapshotsClient) List(ctx context.Context) (result ManagedClusterSnapshotListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.List") + defer func() { + sc := -1 + if result.mcslr.Response.Response != nil { + sc = result.mcslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClusterSnapshotsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mcslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "List", resp, "Failure sending request") + return + } + + result.mcslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "List", resp, "Failure responding to request") + return + } + if result.mcslr.hasNextLink() && result.mcslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ManagedClusterSnapshotsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClusterSnapshotsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ManagedClusterSnapshotsClient) ListResponder(resp *http.Response) (result ManagedClusterSnapshotListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ManagedClusterSnapshotsClient) listNextResults(ctx context.Context, lastResults ManagedClusterSnapshotListResult) (result ManagedClusterSnapshotListResult, err error) { + req, err := lastResults.managedClusterSnapshotListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedClusterSnapshotsClient) ListComplete(ctx context.Context) (result ManagedClusterSnapshotListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup sends the list by resource group request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client ManagedClusterSnapshotsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ManagedClusterSnapshotListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.mcslr.Response.Response != nil { + sc = result.mcslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClusterSnapshotsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.mcslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.mcslr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.mcslr.hasNextLink() && result.mcslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ManagedClusterSnapshotsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClusterSnapshotsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ManagedClusterSnapshotsClient) ListByResourceGroupResponder(resp *http.Response) (result ManagedClusterSnapshotListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ManagedClusterSnapshotsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ManagedClusterSnapshotListResult) (result ManagedClusterSnapshotListResult, err error) { + req, err := lastResults.managedClusterSnapshotListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedClusterSnapshotsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ManagedClusterSnapshotListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags sends the update tags request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - parameters supplied to the Update managed cluster snapshot Tags operation. +func (client ManagedClusterSnapshotsClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (result ManagedClusterSnapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClusterSnapshotsClient", "UpdateTags", err.Error()) + } + + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ManagedClusterSnapshotsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClusterSnapshotsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ManagedClusterSnapshotsClient) UpdateTagsResponder(resp *http.Response) (result ManagedClusterSnapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/models.go new file mode 100644 index 00000000000..0f058147120 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/models.go @@ -0,0 +1,4579 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice" + +// AccessProfile profile for enabling a user to access a managed cluster. +type AccessProfile struct { + // KubeConfig - Base64-encoded Kubernetes configuration file. + KubeConfig *[]byte `json:"kubeConfig,omitempty"` +} + +// AgentPool agent Pool. +type AgentPool struct { + autorest.Response `json:"-"` + // ManagedClusterAgentPoolProfileProperties - Properties of an agent pool. + *ManagedClusterAgentPoolProfileProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPool. +func (ap AgentPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.ManagedClusterAgentPoolProfileProperties != nil { + objectMap["properties"] = ap.ManagedClusterAgentPoolProfileProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AgentPool struct. +func (ap *AgentPool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managedClusterAgentPoolProfileProperties ManagedClusterAgentPoolProfileProperties + err = json.Unmarshal(*v, &managedClusterAgentPoolProfileProperties) + if err != nil { + return err + } + ap.ManagedClusterAgentPoolProfileProperties = &managedClusterAgentPoolProfileProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ap.Type = &typeVar + } + } + } + + return nil +} + +// AgentPoolAvailableVersions the list of available versions for an agent pool. +type AgentPoolAvailableVersions struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the agent pool version list. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the agent pool version list. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the agent pool version list. + Type *string `json:"type,omitempty"` + // AgentPoolAvailableVersionsProperties - Properties of agent pool available versions. + *AgentPoolAvailableVersionsProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPoolAvailableVersions. +func (apav AgentPoolAvailableVersions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apav.AgentPoolAvailableVersionsProperties != nil { + objectMap["properties"] = apav.AgentPoolAvailableVersionsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AgentPoolAvailableVersions struct. +func (apav *AgentPoolAvailableVersions) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + apav.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + apav.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + apav.Type = &typeVar + } + case "properties": + if v != nil { + var agentPoolAvailableVersionsProperties AgentPoolAvailableVersionsProperties + err = json.Unmarshal(*v, &agentPoolAvailableVersionsProperties) + if err != nil { + return err + } + apav.AgentPoolAvailableVersionsProperties = &agentPoolAvailableVersionsProperties + } + } + } + + return nil +} + +// AgentPoolAvailableVersionsProperties the list of available agent pool versions. +type AgentPoolAvailableVersionsProperties struct { + // AgentPoolVersions - List of versions available for agent pool. + AgentPoolVersions *[]AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem `json:"agentPoolVersions,omitempty"` +} + +// AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem ... +type AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem struct { + // Default - Whether this version is the default agent pool version. + Default *bool `json:"default,omitempty"` + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // IsPreview - Whether Kubernetes version is currently in preview. + IsPreview *bool `json:"isPreview,omitempty"` +} + +// AgentPoolListResult the response from the List Agent Pools operation. +type AgentPoolListResult struct { + autorest.Response `json:"-"` + // Value - The list of agent pools. + Value *[]AgentPool `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of agent pool results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPoolListResult. +func (aplr AgentPoolListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aplr.Value != nil { + objectMap["value"] = aplr.Value + } + return json.Marshal(objectMap) +} + +// AgentPoolListResultIterator provides access to a complete listing of AgentPool values. +type AgentPoolListResultIterator struct { + i int + page AgentPoolListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AgentPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AgentPoolListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AgentPoolListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AgentPoolListResultIterator) Response() AgentPoolListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AgentPoolListResultIterator) Value() AgentPool { + if !iter.page.NotDone() { + return AgentPool{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AgentPoolListResultIterator type. +func NewAgentPoolListResultIterator(page AgentPoolListResultPage) AgentPoolListResultIterator { + return AgentPoolListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aplr AgentPoolListResult) IsEmpty() bool { + return aplr.Value == nil || len(*aplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aplr AgentPoolListResult) hasNextLink() bool { + return aplr.NextLink != nil && len(*aplr.NextLink) != 0 +} + +// agentPoolListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aplr AgentPoolListResult) agentPoolListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aplr.NextLink))) +} + +// AgentPoolListResultPage contains a page of AgentPool values. +type AgentPoolListResultPage struct { + fn func(context.Context, AgentPoolListResult) (AgentPoolListResult, error) + aplr AgentPoolListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AgentPoolListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aplr) + if err != nil { + return err + } + page.aplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AgentPoolListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AgentPoolListResultPage) NotDone() bool { + return !page.aplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AgentPoolListResultPage) Response() AgentPoolListResult { + return page.aplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AgentPoolListResultPage) Values() []AgentPool { + if page.aplr.IsEmpty() { + return nil + } + return *page.aplr.Value +} + +// Creates a new instance of the AgentPoolListResultPage type. +func NewAgentPoolListResultPage(cur AgentPoolListResult, getNextPage func(context.Context, AgentPoolListResult) (AgentPoolListResult, error)) AgentPoolListResultPage { + return AgentPoolListResultPage{ + fn: getNextPage, + aplr: cur, + } +} + +// AgentPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AgentPoolsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AgentPoolsClient) (AgentPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AgentPoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AgentPoolsCreateOrUpdateFuture.Result. +func (future *AgentPoolsCreateOrUpdateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ap.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { + ap, err = client.CreateOrUpdateResponder(ap.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsCreateOrUpdateFuture", "Result", ap.Response.Response, "Failure responding to request") + } + } + return +} + +// AgentPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AgentPoolsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AgentPoolsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AgentPoolsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AgentPoolsDeleteFuture.Result. +func (future *AgentPoolsDeleteFuture) result(client AgentPoolsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AgentPoolsUpgradeNodeImageVersionFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AgentPoolsUpgradeNodeImageVersionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AgentPoolsClient) (AgentPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AgentPoolsUpgradeNodeImageVersionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AgentPoolsUpgradeNodeImageVersionFuture.Result. +func (future *AgentPoolsUpgradeNodeImageVersionFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsUpgradeNodeImageVersionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ap.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsUpgradeNodeImageVersionFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { + ap, err = client.UpgradeNodeImageVersionResponder(ap.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsUpgradeNodeImageVersionFuture", "Result", ap.Response.Response, "Failure responding to request") + } + } + return +} + +// AgentPoolUpgradeProfile the list of available upgrades for an agent pool. +type AgentPoolUpgradeProfile struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the agent pool upgrade profile. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the agent pool upgrade profile. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the agent pool upgrade profile. + Type *string `json:"type,omitempty"` + // AgentPoolUpgradeProfileProperties - The properties of the agent pool upgrade profile. + *AgentPoolUpgradeProfileProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPoolUpgradeProfile. +func (apup AgentPoolUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apup.AgentPoolUpgradeProfileProperties != nil { + objectMap["properties"] = apup.AgentPoolUpgradeProfileProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AgentPoolUpgradeProfile struct. +func (apup *AgentPoolUpgradeProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + apup.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + apup.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + apup.Type = &typeVar + } + case "properties": + if v != nil { + var agentPoolUpgradeProfileProperties AgentPoolUpgradeProfileProperties + err = json.Unmarshal(*v, &agentPoolUpgradeProfileProperties) + if err != nil { + return err + } + apup.AgentPoolUpgradeProfileProperties = &agentPoolUpgradeProfileProperties + } + } + } + + return nil +} + +// AgentPoolUpgradeProfileProperties the list of available upgrade versions. +type AgentPoolUpgradeProfileProperties struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // Upgrades - List of orchestrator types and versions available for upgrade. + Upgrades *[]AgentPoolUpgradeProfilePropertiesUpgradesItem `json:"upgrades,omitempty"` + // LatestNodeImageVersion - The latest AKS supported node image version. + LatestNodeImageVersion *string `json:"latestNodeImageVersion,omitempty"` +} + +// AgentPoolUpgradeProfilePropertiesUpgradesItem ... +type AgentPoolUpgradeProfilePropertiesUpgradesItem struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // IsPreview - Whether the Kubernetes version is currently in preview. + IsPreview *bool `json:"isPreview,omitempty"` +} + +// AgentPoolUpgradeSettings settings for upgrading an agentpool +type AgentPoolUpgradeSettings struct { + // MaxSurge - This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 1. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade + MaxSurge *string `json:"maxSurge,omitempty"` +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureKeyVaultKms azure Key Vault key management service settings for the security profile. +type AzureKeyVaultKms struct { + // Enabled - Whether to enable Azure Key Vault key management service. The default is false. + Enabled *bool `json:"enabled,omitempty"` + // KeyID - Identifier of Azure Key Vault key. See [key identifier format](https://docs.microsoft.com/en-us/azure/key-vault/general/about-keys-secrets-certificates#vault-name-and-object-name) for more details. When Azure Key Vault key management service is enabled, this field is required and must be a valid key identifier. When Azure Key Vault key management service is disabled, leave the field empty. + KeyID *string `json:"keyId,omitempty"` +} + +// CloudError an error response from the Container service. +type CloudError struct { + // Error - Details about the error. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the Container service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// CommandResultProperties the results of a run command +type CommandResultProperties struct { + // ProvisioningState - READ-ONLY; provisioning State + ProvisioningState *string `json:"provisioningState,omitempty"` + // ExitCode - READ-ONLY; The exit code of the command + ExitCode *int32 `json:"exitCode,omitempty"` + // StartedAt - READ-ONLY; The time when the command started. + StartedAt *date.Time `json:"startedAt,omitempty"` + // FinishedAt - READ-ONLY; The time when the command finished. + FinishedAt *date.Time `json:"finishedAt,omitempty"` + // Logs - READ-ONLY; The command output. + Logs *string `json:"logs,omitempty"` + // Reason - READ-ONLY; An explanation of why provisioningState is set to failed (if so). + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for CommandResultProperties. +func (crp CommandResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CreationData data used when creating a target resource from a source resource. +type CreationData struct { + // SourceResourceID - This is the ARM ID of the source object to be used to create the target object. + SourceResourceID *string `json:"sourceResourceId,omitempty"` +} + +// CredentialResult the credential result response. +type CredentialResult struct { + // Name - READ-ONLY; The name of the credential. + Name *string `json:"name,omitempty"` + // Value - READ-ONLY; Base64-encoded Kubernetes configuration file. + Value *[]byte `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for CredentialResult. +func (cr CredentialResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CredentialResults the list credential result response. +type CredentialResults struct { + autorest.Response `json:"-"` + // Kubeconfigs - READ-ONLY; Base64-encoded Kubernetes configuration file. + Kubeconfigs *[]CredentialResult `json:"kubeconfigs,omitempty"` +} + +// MarshalJSON is the custom marshaler for CredentialResults. +func (cr CredentialResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DiagnosticsProfile profile for diagnostics on the container service cluster. +type DiagnosticsProfile struct { + // VMDiagnostics - Profile for diagnostics on the container service VMs. + VMDiagnostics *VMDiagnostics `json:"vmDiagnostics,omitempty"` +} + +// EndpointDependency a domain name that AKS agent nodes are reaching at. +type EndpointDependency struct { + // DomainName - The domain name of the dependency. + DomainName *string `json:"domainName,omitempty"` + // EndpointDetails - The Ports and Protocols used when connecting to domainName. + EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` +} + +// EndpointDetail connect information from the AKS agent nodes to a single endpoint. +type EndpointDetail struct { + // IPAddress - An IP Address that Domain Name currently resolves to. + IPAddress *string `json:"ipAddress,omitempty"` + // Port - The port an endpoint is connected to. + Port *int32 `json:"port,omitempty"` + // Protocol - The protocol used for connection + Protocol *string `json:"protocol,omitempty"` + // Description - Description of the detail + Description *string `json:"description,omitempty"` +} + +// ExtendedLocation the complex type of the extended location. +type ExtendedLocation struct { + // Name - The name of the extended location. + Name *string `json:"name,omitempty"` + // Type - The type of the extended location. Possible values include: 'ExtendedLocationTypesEdgeZone' + Type ExtendedLocationTypes `json:"type,omitempty"` +} + +// KubeletConfig see [AKS custom node +// configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details. +type KubeletConfig struct { + // CPUManagerPolicy - The default is 'none'. See [Kubernetes CPU management policies](https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#cpu-management-policies) for more information. Allowed values are 'none' and 'static'. + CPUManagerPolicy *string `json:"cpuManagerPolicy,omitempty"` + // CPUCfsQuota - The default is true. + CPUCfsQuota *bool `json:"cpuCfsQuota,omitempty"` + // CPUCfsQuotaPeriod - The default is '100ms.' Valid values are a sequence of decimal numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported units are 'ns', 'us', 'ms', 's', 'm', and 'h'. + CPUCfsQuotaPeriod *string `json:"cpuCfsQuotaPeriod,omitempty"` + // ImageGcHighThreshold - To disable image garbage collection, set to 100. The default is 85% + ImageGcHighThreshold *int32 `json:"imageGcHighThreshold,omitempty"` + // ImageGcLowThreshold - This cannot be set higher than imageGcHighThreshold. The default is 80% + ImageGcLowThreshold *int32 `json:"imageGcLowThreshold,omitempty"` + // TopologyManagerPolicy - For more information see [Kubernetes Topology Manager](https://kubernetes.io/docs/tasks/administer-cluster/topology-manager). The default is 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'. + TopologyManagerPolicy *string `json:"topologyManagerPolicy,omitempty"` + // AllowedUnsafeSysctls - Allowed list of unsafe sysctls or unsafe sysctl patterns (ending in `*`). + AllowedUnsafeSysctls *[]string `json:"allowedUnsafeSysctls,omitempty"` + // FailSwapOn - If set to true it will make the Kubelet fail to start if swap is enabled on the node. + FailSwapOn *bool `json:"failSwapOn,omitempty"` + // ContainerLogMaxSizeMB - The maximum size (e.g. 10Mi) of container log file before it is rotated. + ContainerLogMaxSizeMB *int32 `json:"containerLogMaxSizeMB,omitempty"` + // ContainerLogMaxFiles - The maximum number of container log files that can be present for a container. The number must be ≥ 2. + ContainerLogMaxFiles *int32 `json:"containerLogMaxFiles,omitempty"` + // PodMaxPids - The maximum number of processes per pod. + PodMaxPids *int32 `json:"podMaxPids,omitempty"` +} + +// LinuxOSConfig see [AKS custom node +// configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details. +type LinuxOSConfig struct { + // Sysctls - Sysctl settings for Linux agent nodes. + Sysctls *SysctlConfig `json:"sysctls,omitempty"` + // TransparentHugePageEnabled - Valid values are 'always', 'madvise', and 'never'. The default is 'always'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). + TransparentHugePageEnabled *string `json:"transparentHugePageEnabled,omitempty"` + // TransparentHugePageDefrag - Valid values are 'always', 'defer', 'defer+madvise', 'madvise' and 'never'. The default is 'madvise'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). + TransparentHugePageDefrag *string `json:"transparentHugePageDefrag,omitempty"` + // SwapFileSizeMB - The size in MB of a swap file that will be created on each node. + SwapFileSizeMB *int32 `json:"swapFileSizeMB,omitempty"` +} + +// LinuxProfile profile for Linux VMs in the container service cluster. +type LinuxProfile struct { + // AdminUsername - The administrator username to use for Linux VMs. + AdminUsername *string `json:"adminUsername,omitempty"` + // SSH - The SSH configuration for Linux-based VMs running on Azure. + SSH *SSHConfiguration `json:"ssh,omitempty"` +} + +// MaintenanceConfiguration see [planned +// maintenance](https://docs.microsoft.com/azure/aks/planned-maintenance) for more information about +// planned maintenance. +type MaintenanceConfiguration struct { + autorest.Response `json:"-"` + // SystemData - READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // MaintenanceConfigurationProperties - Properties of a default maintenance configuration. + *MaintenanceConfigurationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MaintenanceConfiguration. +func (mc MaintenanceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mc.MaintenanceConfigurationProperties != nil { + objectMap["properties"] = mc.MaintenanceConfigurationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MaintenanceConfiguration struct. +func (mc *MaintenanceConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mc.SystemData = &systemData + } + case "properties": + if v != nil { + var maintenanceConfigurationProperties MaintenanceConfigurationProperties + err = json.Unmarshal(*v, &maintenanceConfigurationProperties) + if err != nil { + return err + } + mc.MaintenanceConfigurationProperties = &maintenanceConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mc.Type = &typeVar + } + } + } + + return nil +} + +// MaintenanceConfigurationListResult the response from the List maintenance configurations operation. +type MaintenanceConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - The list of maintenance configurations. + Value *[]MaintenanceConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of maintenance configuration results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for MaintenanceConfigurationListResult. +func (mclr MaintenanceConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mclr.Value != nil { + objectMap["value"] = mclr.Value + } + return json.Marshal(objectMap) +} + +// MaintenanceConfigurationListResultIterator provides access to a complete listing of +// MaintenanceConfiguration values. +type MaintenanceConfigurationListResultIterator struct { + i int + page MaintenanceConfigurationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MaintenanceConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *MaintenanceConfigurationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MaintenanceConfigurationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MaintenanceConfigurationListResultIterator) Response() MaintenanceConfigurationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MaintenanceConfigurationListResultIterator) Value() MaintenanceConfiguration { + if !iter.page.NotDone() { + return MaintenanceConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MaintenanceConfigurationListResultIterator type. +func NewMaintenanceConfigurationListResultIterator(page MaintenanceConfigurationListResultPage) MaintenanceConfigurationListResultIterator { + return MaintenanceConfigurationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mclr MaintenanceConfigurationListResult) IsEmpty() bool { + return mclr.Value == nil || len(*mclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mclr MaintenanceConfigurationListResult) hasNextLink() bool { + return mclr.NextLink != nil && len(*mclr.NextLink) != 0 +} + +// maintenanceConfigurationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mclr MaintenanceConfigurationListResult) maintenanceConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mclr.NextLink))) +} + +// MaintenanceConfigurationListResultPage contains a page of MaintenanceConfiguration values. +type MaintenanceConfigurationListResultPage struct { + fn func(context.Context, MaintenanceConfigurationListResult) (MaintenanceConfigurationListResult, error) + mclr MaintenanceConfigurationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MaintenanceConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mclr) + if err != nil { + return err + } + page.mclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *MaintenanceConfigurationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MaintenanceConfigurationListResultPage) NotDone() bool { + return !page.mclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MaintenanceConfigurationListResultPage) Response() MaintenanceConfigurationListResult { + return page.mclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MaintenanceConfigurationListResultPage) Values() []MaintenanceConfiguration { + if page.mclr.IsEmpty() { + return nil + } + return *page.mclr.Value +} + +// Creates a new instance of the MaintenanceConfigurationListResultPage type. +func NewMaintenanceConfigurationListResultPage(cur MaintenanceConfigurationListResult, getNextPage func(context.Context, MaintenanceConfigurationListResult) (MaintenanceConfigurationListResult, error)) MaintenanceConfigurationListResultPage { + return MaintenanceConfigurationListResultPage{ + fn: getNextPage, + mclr: cur, + } +} + +// MaintenanceConfigurationProperties properties used to configure planned maintenance for a Managed +// Cluster. +type MaintenanceConfigurationProperties struct { + // TimeInWeek - If two array entries specify the same day of the week, the applied configuration is the union of times in both entries. + TimeInWeek *[]TimeInWeek `json:"timeInWeek,omitempty"` + // NotAllowedTime - Time slots on which upgrade is not allowed. + NotAllowedTime *[]TimeSpan `json:"notAllowedTime,omitempty"` +} + +// ManagedCluster managed cluster. +type ManagedCluster struct { + autorest.Response `json:"-"` + // Sku - The managed cluster SKU. + Sku *ManagedClusterSKU `json:"sku,omitempty"` + // ExtendedLocation - The extended location of the Virtual Machine. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Identity - The identity of the managed cluster, if configured. + Identity *ManagedClusterIdentity `json:"identity,omitempty"` + // ManagedClusterProperties - Properties of a managed cluster. + *ManagedClusterProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedCluster. +func (mc ManagedCluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mc.Sku != nil { + objectMap["sku"] = mc.Sku + } + if mc.ExtendedLocation != nil { + objectMap["extendedLocation"] = mc.ExtendedLocation + } + if mc.Identity != nil { + objectMap["identity"] = mc.Identity + } + if mc.ManagedClusterProperties != nil { + objectMap["properties"] = mc.ManagedClusterProperties + } + if mc.Tags != nil { + objectMap["tags"] = mc.Tags + } + if mc.Location != nil { + objectMap["location"] = mc.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedCluster struct. +func (mc *ManagedCluster) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku ManagedClusterSKU + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + mc.Sku = &sku + } + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + mc.ExtendedLocation = &extendedLocation + } + case "identity": + if v != nil { + var identity ManagedClusterIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + mc.Identity = &identity + } + case "properties": + if v != nil { + var managedClusterProperties ManagedClusterProperties + err = json.Unmarshal(*v, &managedClusterProperties) + if err != nil { + return err + } + mc.ManagedClusterProperties = &managedClusterProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mc.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mc.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mc.SystemData = &systemData + } + } + } + + return nil +} + +// ManagedClusterAADProfile for more details see [managed AAD on +// AKS](https://docs.microsoft.com/azure/aks/managed-aad). +type ManagedClusterAADProfile struct { + // Managed - Whether to enable managed AAD. + Managed *bool `json:"managed,omitempty"` + // EnableAzureRBAC - Whether to enable Azure RBAC for Kubernetes authorization. + EnableAzureRBAC *bool `json:"enableAzureRBAC,omitempty"` + // AdminGroupObjectIDs - The list of AAD group object IDs that will have admin role of the cluster. + AdminGroupObjectIDs *[]string `json:"adminGroupObjectIDs,omitempty"` + // ClientAppID - The client AAD application ID. + ClientAppID *string `json:"clientAppID,omitempty"` + // ServerAppID - The server AAD application ID. + ServerAppID *string `json:"serverAppID,omitempty"` + // ServerAppSecret - The server AAD application secret. + ServerAppSecret *string `json:"serverAppSecret,omitempty"` + // TenantID - The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. + TenantID *string `json:"tenantID,omitempty"` +} + +// ManagedClusterAccessProfile managed cluster Access Profile. +type ManagedClusterAccessProfile struct { + autorest.Response `json:"-"` + // AccessProfile - AccessProfile of a managed cluster. + *AccessProfile `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAccessProfile. +func (mcap ManagedClusterAccessProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcap.AccessProfile != nil { + objectMap["properties"] = mcap.AccessProfile + } + if mcap.Tags != nil { + objectMap["tags"] = mcap.Tags + } + if mcap.Location != nil { + objectMap["location"] = mcap.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedClusterAccessProfile struct. +func (mcap *ManagedClusterAccessProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var accessProfile AccessProfile + err = json.Unmarshal(*v, &accessProfile) + if err != nil { + return err + } + mcap.AccessProfile = &accessProfile + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mcap.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mcap.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mcap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mcap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mcap.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mcap.SystemData = &systemData + } + } + } + + return nil +} + +// ManagedClusterAddonProfile a Kubernetes add-on profile for a managed cluster. +type ManagedClusterAddonProfile struct { + // Enabled - Whether the add-on is enabled or not. + Enabled *bool `json:"enabled,omitempty"` + // Config - Key-value pairs for configuring an add-on. + Config map[string]*string `json:"config"` + // Identity - READ-ONLY; Information of user assigned identity used by this add-on. + Identity *ManagedClusterAddonProfileIdentity `json:"identity,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAddonProfile. +func (mcap ManagedClusterAddonProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcap.Enabled != nil { + objectMap["enabled"] = mcap.Enabled + } + if mcap.Config != nil { + objectMap["config"] = mcap.Config + } + return json.Marshal(objectMap) +} + +// ManagedClusterAddonProfileIdentity information of user assigned identity used by this add-on. +type ManagedClusterAddonProfileIdentity struct { + // ResourceID - The resource ID of the user assigned identity. + ResourceID *string `json:"resourceId,omitempty"` + // ClientID - The client ID of the user assigned identity. + ClientID *string `json:"clientId,omitempty"` + // ObjectID - The object ID of the user assigned identity. + ObjectID *string `json:"objectId,omitempty"` +} + +// ManagedClusterAgentPoolProfile profile for the container service agent pool. +type ManagedClusterAgentPoolProfile struct { + // Name - Windows agent pool names must be 6 characters or less. + Name *string `json:"name,omitempty"` + // Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. + Count *int32 `json:"count,omitempty"` + // VMSize - VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions + VMSize *string `json:"vmSize,omitempty"` + OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` + // OsDiskType - Possible values include: 'OSDiskTypeManaged', 'OSDiskTypeEphemeral' + OsDiskType OSDiskType `json:"osDiskType,omitempty"` + // KubeletDiskType - Possible values include: 'KubeletDiskTypeOS', 'KubeletDiskTypeTemporary' + KubeletDiskType KubeletDiskType `json:"kubeletDiskType,omitempty"` + // WorkloadRuntime - Possible values include: 'WorkloadRuntimeOCIContainer', 'WorkloadRuntimeWasmWasi' + WorkloadRuntime WorkloadRuntime `json:"workloadRuntime,omitempty"` + // MessageOfTheDay - A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). + MessageOfTheDay *string `json:"messageOfTheDay,omitempty"` + // VnetSubnetID - If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + VnetSubnetID *string `json:"vnetSubnetID,omitempty"` + // PodSubnetID - If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + PodSubnetID *string `json:"podSubnetID,omitempty"` + // MaxPods - The maximum number of pods that can run on a node. + MaxPods *int32 `json:"maxPods,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // OsSKU - Possible values include: 'OSSKUUbuntu', 'OSSKUCBLMariner' + OsSKU OSSKU `json:"osSKU,omitempty"` + // MaxCount - The maximum number of nodes for auto-scaling + MaxCount *int32 `json:"maxCount,omitempty"` + // MinCount - The minimum number of nodes for auto-scaling + MinCount *int32 `json:"minCount,omitempty"` + // EnableAutoScaling - Whether to enable auto-scaler + EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` + // ScaleDownMode - This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. Possible values include: 'ScaleDownModeDelete', 'ScaleDownModeDeallocate' + ScaleDownMode ScaleDownMode `json:"scaleDownMode,omitempty"` + // Type - Possible values include: 'AgentPoolTypeVirtualMachineScaleSets', 'AgentPoolTypeAvailabilitySet' + Type AgentPoolType `json:"type,omitempty"` + // Mode - Possible values include: 'AgentPoolModeSystem', 'AgentPoolModeUser' + Mode AgentPoolMode `json:"mode,omitempty"` + // OrchestratorVersion - Both patch version and are supported. When is specified, the latest supported patch version is chosen automatically. Updating the agent pool with the same once it has been created will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` + // CurrentOrchestratorVersion - If orchestratorVersion was a fully specified version , this field will be exactly equal to it. If orchestratorVersion was , this field will contain the full version being used. + CurrentOrchestratorVersion *string `json:"currentOrchestratorVersion,omitempty"` + // NodeImageVersion - READ-ONLY; The version of node image + NodeImageVersion *string `json:"nodeImageVersion,omitempty"` + // UpgradeSettings - Settings for upgrading the agentpool + UpgradeSettings *AgentPoolUpgradeSettings `json:"upgradeSettings,omitempty"` + // ProvisioningState - READ-ONLY; The current deployment or provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PowerState - When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded + PowerState *PowerState `json:"powerState,omitempty"` + // AvailabilityZones - The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + AvailabilityZones *[]string `json:"availabilityZones,omitempty"` + // EnableNodePublicIP - Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"` + // NodePublicIPPrefixID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName} + NodePublicIPPrefixID *string `json:"nodePublicIPPrefixID,omitempty"` + // ScaleSetPriority - The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. Possible values include: 'ScaleSetPrioritySpot', 'ScaleSetPriorityRegular' + ScaleSetPriority ScaleSetPriority `json:"scaleSetPriority,omitempty"` + // ScaleSetEvictionPolicy - This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. Possible values include: 'ScaleSetEvictionPolicyDelete', 'ScaleSetEvictionPolicyDeallocate' + ScaleSetEvictionPolicy ScaleSetEvictionPolicy `json:"scaleSetEvictionPolicy,omitempty"` + // SpotMaxPrice - Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing) + SpotMaxPrice *float64 `json:"spotMaxPrice,omitempty"` + // Tags - The tags to be persisted on the agent pool virtual machine scale set. + Tags map[string]*string `json:"tags"` + // NodeLabels - The node labels to be persisted across all nodes in agent pool. + NodeLabels map[string]*string `json:"nodeLabels"` + // NodeTaints - The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + NodeTaints *[]string `json:"nodeTaints,omitempty"` + // ProximityPlacementGroupID - The ID for Proximity Placement Group. + ProximityPlacementGroupID *string `json:"proximityPlacementGroupID,omitempty"` + // KubeletConfig - The Kubelet configuration on the agent pool nodes. + KubeletConfig *KubeletConfig `json:"kubeletConfig,omitempty"` + // LinuxOSConfig - The OS configuration of Linux agent nodes. + LinuxOSConfig *LinuxOSConfig `json:"linuxOSConfig,omitempty"` + // EnableEncryptionAtHost - This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption + EnableEncryptionAtHost *bool `json:"enableEncryptionAtHost,omitempty"` + // EnableUltraSSD - Whether to enable UltraSSD + EnableUltraSSD *bool `json:"enableUltraSSD,omitempty"` + // EnableFIPS - See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. + EnableFIPS *bool `json:"enableFIPS,omitempty"` + // GpuInstanceProfile - GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Possible values include: 'GPUInstanceProfileMIG1g', 'GPUInstanceProfileMIG2g', 'GPUInstanceProfileMIG3g', 'GPUInstanceProfileMIG4g', 'GPUInstanceProfileMIG7g' + GpuInstanceProfile GPUInstanceProfile `json:"gpuInstanceProfile,omitempty"` + // CreationData - CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + CreationData *CreationData `json:"creationData,omitempty"` + // CapacityReservationGroupID - AKS will associate the specified agent pool with the Capacity Reservation Group. + CapacityReservationGroupID *string `json:"capacityReservationGroupID,omitempty"` + // HostGroupID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + HostGroupID *string `json:"hostGroupID,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAgentPoolProfile. +func (mcapp ManagedClusterAgentPoolProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcapp.Name != nil { + objectMap["name"] = mcapp.Name + } + if mcapp.Count != nil { + objectMap["count"] = mcapp.Count + } + if mcapp.VMSize != nil { + objectMap["vmSize"] = mcapp.VMSize + } + if mcapp.OsDiskSizeGB != nil { + objectMap["osDiskSizeGB"] = mcapp.OsDiskSizeGB + } + if mcapp.OsDiskType != "" { + objectMap["osDiskType"] = mcapp.OsDiskType + } + if mcapp.KubeletDiskType != "" { + objectMap["kubeletDiskType"] = mcapp.KubeletDiskType + } + if mcapp.WorkloadRuntime != "" { + objectMap["workloadRuntime"] = mcapp.WorkloadRuntime + } + if mcapp.MessageOfTheDay != nil { + objectMap["messageOfTheDay"] = mcapp.MessageOfTheDay + } + if mcapp.VnetSubnetID != nil { + objectMap["vnetSubnetID"] = mcapp.VnetSubnetID + } + if mcapp.PodSubnetID != nil { + objectMap["podSubnetID"] = mcapp.PodSubnetID + } + if mcapp.MaxPods != nil { + objectMap["maxPods"] = mcapp.MaxPods + } + if mcapp.OsType != "" { + objectMap["osType"] = mcapp.OsType + } + if mcapp.OsSKU != "" { + objectMap["osSKU"] = mcapp.OsSKU + } + if mcapp.MaxCount != nil { + objectMap["maxCount"] = mcapp.MaxCount + } + if mcapp.MinCount != nil { + objectMap["minCount"] = mcapp.MinCount + } + if mcapp.EnableAutoScaling != nil { + objectMap["enableAutoScaling"] = mcapp.EnableAutoScaling + } + if mcapp.ScaleDownMode != "" { + objectMap["scaleDownMode"] = mcapp.ScaleDownMode + } + if mcapp.Type != "" { + objectMap["type"] = mcapp.Type + } + if mcapp.Mode != "" { + objectMap["mode"] = mcapp.Mode + } + if mcapp.OrchestratorVersion != nil { + objectMap["orchestratorVersion"] = mcapp.OrchestratorVersion + } + if mcapp.CurrentOrchestratorVersion != nil { + objectMap["currentOrchestratorVersion"] = mcapp.CurrentOrchestratorVersion + } + if mcapp.UpgradeSettings != nil { + objectMap["upgradeSettings"] = mcapp.UpgradeSettings + } + if mcapp.PowerState != nil { + objectMap["powerState"] = mcapp.PowerState + } + if mcapp.AvailabilityZones != nil { + objectMap["availabilityZones"] = mcapp.AvailabilityZones + } + if mcapp.EnableNodePublicIP != nil { + objectMap["enableNodePublicIP"] = mcapp.EnableNodePublicIP + } + if mcapp.NodePublicIPPrefixID != nil { + objectMap["nodePublicIPPrefixID"] = mcapp.NodePublicIPPrefixID + } + if mcapp.ScaleSetPriority != "" { + objectMap["scaleSetPriority"] = mcapp.ScaleSetPriority + } + if mcapp.ScaleSetEvictionPolicy != "" { + objectMap["scaleSetEvictionPolicy"] = mcapp.ScaleSetEvictionPolicy + } + if mcapp.SpotMaxPrice != nil { + objectMap["spotMaxPrice"] = mcapp.SpotMaxPrice + } + if mcapp.Tags != nil { + objectMap["tags"] = mcapp.Tags + } + if mcapp.NodeLabels != nil { + objectMap["nodeLabels"] = mcapp.NodeLabels + } + if mcapp.NodeTaints != nil { + objectMap["nodeTaints"] = mcapp.NodeTaints + } + if mcapp.ProximityPlacementGroupID != nil { + objectMap["proximityPlacementGroupID"] = mcapp.ProximityPlacementGroupID + } + if mcapp.KubeletConfig != nil { + objectMap["kubeletConfig"] = mcapp.KubeletConfig + } + if mcapp.LinuxOSConfig != nil { + objectMap["linuxOSConfig"] = mcapp.LinuxOSConfig + } + if mcapp.EnableEncryptionAtHost != nil { + objectMap["enableEncryptionAtHost"] = mcapp.EnableEncryptionAtHost + } + if mcapp.EnableUltraSSD != nil { + objectMap["enableUltraSSD"] = mcapp.EnableUltraSSD + } + if mcapp.EnableFIPS != nil { + objectMap["enableFIPS"] = mcapp.EnableFIPS + } + if mcapp.GpuInstanceProfile != "" { + objectMap["gpuInstanceProfile"] = mcapp.GpuInstanceProfile + } + if mcapp.CreationData != nil { + objectMap["creationData"] = mcapp.CreationData + } + if mcapp.CapacityReservationGroupID != nil { + objectMap["capacityReservationGroupID"] = mcapp.CapacityReservationGroupID + } + if mcapp.HostGroupID != nil { + objectMap["hostGroupID"] = mcapp.HostGroupID + } + return json.Marshal(objectMap) +} + +// ManagedClusterAgentPoolProfileProperties properties for the container service agent pool profile. +type ManagedClusterAgentPoolProfileProperties struct { + // Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. + Count *int32 `json:"count,omitempty"` + // VMSize - VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions + VMSize *string `json:"vmSize,omitempty"` + OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` + // OsDiskType - Possible values include: 'OSDiskTypeManaged', 'OSDiskTypeEphemeral' + OsDiskType OSDiskType `json:"osDiskType,omitempty"` + // KubeletDiskType - Possible values include: 'KubeletDiskTypeOS', 'KubeletDiskTypeTemporary' + KubeletDiskType KubeletDiskType `json:"kubeletDiskType,omitempty"` + // WorkloadRuntime - Possible values include: 'WorkloadRuntimeOCIContainer', 'WorkloadRuntimeWasmWasi' + WorkloadRuntime WorkloadRuntime `json:"workloadRuntime,omitempty"` + // MessageOfTheDay - A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). + MessageOfTheDay *string `json:"messageOfTheDay,omitempty"` + // VnetSubnetID - If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + VnetSubnetID *string `json:"vnetSubnetID,omitempty"` + // PodSubnetID - If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + PodSubnetID *string `json:"podSubnetID,omitempty"` + // MaxPods - The maximum number of pods that can run on a node. + MaxPods *int32 `json:"maxPods,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // OsSKU - Possible values include: 'OSSKUUbuntu', 'OSSKUCBLMariner' + OsSKU OSSKU `json:"osSKU,omitempty"` + // MaxCount - The maximum number of nodes for auto-scaling + MaxCount *int32 `json:"maxCount,omitempty"` + // MinCount - The minimum number of nodes for auto-scaling + MinCount *int32 `json:"minCount,omitempty"` + // EnableAutoScaling - Whether to enable auto-scaler + EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` + // ScaleDownMode - This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. Possible values include: 'ScaleDownModeDelete', 'ScaleDownModeDeallocate' + ScaleDownMode ScaleDownMode `json:"scaleDownMode,omitempty"` + // Type - Possible values include: 'AgentPoolTypeVirtualMachineScaleSets', 'AgentPoolTypeAvailabilitySet' + Type AgentPoolType `json:"type,omitempty"` + // Mode - Possible values include: 'AgentPoolModeSystem', 'AgentPoolModeUser' + Mode AgentPoolMode `json:"mode,omitempty"` + // OrchestratorVersion - Both patch version and are supported. When is specified, the latest supported patch version is chosen automatically. Updating the agent pool with the same once it has been created will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` + // CurrentOrchestratorVersion - If orchestratorVersion was a fully specified version , this field will be exactly equal to it. If orchestratorVersion was , this field will contain the full version being used. + CurrentOrchestratorVersion *string `json:"currentOrchestratorVersion,omitempty"` + // NodeImageVersion - READ-ONLY; The version of node image + NodeImageVersion *string `json:"nodeImageVersion,omitempty"` + // UpgradeSettings - Settings for upgrading the agentpool + UpgradeSettings *AgentPoolUpgradeSettings `json:"upgradeSettings,omitempty"` + // ProvisioningState - READ-ONLY; The current deployment or provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PowerState - When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded + PowerState *PowerState `json:"powerState,omitempty"` + // AvailabilityZones - The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + AvailabilityZones *[]string `json:"availabilityZones,omitempty"` + // EnableNodePublicIP - Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"` + // NodePublicIPPrefixID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName} + NodePublicIPPrefixID *string `json:"nodePublicIPPrefixID,omitempty"` + // ScaleSetPriority - The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. Possible values include: 'ScaleSetPrioritySpot', 'ScaleSetPriorityRegular' + ScaleSetPriority ScaleSetPriority `json:"scaleSetPriority,omitempty"` + // ScaleSetEvictionPolicy - This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. Possible values include: 'ScaleSetEvictionPolicyDelete', 'ScaleSetEvictionPolicyDeallocate' + ScaleSetEvictionPolicy ScaleSetEvictionPolicy `json:"scaleSetEvictionPolicy,omitempty"` + // SpotMaxPrice - Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing) + SpotMaxPrice *float64 `json:"spotMaxPrice,omitempty"` + // Tags - The tags to be persisted on the agent pool virtual machine scale set. + Tags map[string]*string `json:"tags"` + // NodeLabels - The node labels to be persisted across all nodes in agent pool. + NodeLabels map[string]*string `json:"nodeLabels"` + // NodeTaints - The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + NodeTaints *[]string `json:"nodeTaints,omitempty"` + // ProximityPlacementGroupID - The ID for Proximity Placement Group. + ProximityPlacementGroupID *string `json:"proximityPlacementGroupID,omitempty"` + // KubeletConfig - The Kubelet configuration on the agent pool nodes. + KubeletConfig *KubeletConfig `json:"kubeletConfig,omitempty"` + // LinuxOSConfig - The OS configuration of Linux agent nodes. + LinuxOSConfig *LinuxOSConfig `json:"linuxOSConfig,omitempty"` + // EnableEncryptionAtHost - This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption + EnableEncryptionAtHost *bool `json:"enableEncryptionAtHost,omitempty"` + // EnableUltraSSD - Whether to enable UltraSSD + EnableUltraSSD *bool `json:"enableUltraSSD,omitempty"` + // EnableFIPS - See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. + EnableFIPS *bool `json:"enableFIPS,omitempty"` + // GpuInstanceProfile - GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Possible values include: 'GPUInstanceProfileMIG1g', 'GPUInstanceProfileMIG2g', 'GPUInstanceProfileMIG3g', 'GPUInstanceProfileMIG4g', 'GPUInstanceProfileMIG7g' + GpuInstanceProfile GPUInstanceProfile `json:"gpuInstanceProfile,omitempty"` + // CreationData - CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + CreationData *CreationData `json:"creationData,omitempty"` + // CapacityReservationGroupID - AKS will associate the specified agent pool with the Capacity Reservation Group. + CapacityReservationGroupID *string `json:"capacityReservationGroupID,omitempty"` + // HostGroupID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + HostGroupID *string `json:"hostGroupID,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAgentPoolProfileProperties. +func (mcappp ManagedClusterAgentPoolProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcappp.Count != nil { + objectMap["count"] = mcappp.Count + } + if mcappp.VMSize != nil { + objectMap["vmSize"] = mcappp.VMSize + } + if mcappp.OsDiskSizeGB != nil { + objectMap["osDiskSizeGB"] = mcappp.OsDiskSizeGB + } + if mcappp.OsDiskType != "" { + objectMap["osDiskType"] = mcappp.OsDiskType + } + if mcappp.KubeletDiskType != "" { + objectMap["kubeletDiskType"] = mcappp.KubeletDiskType + } + if mcappp.WorkloadRuntime != "" { + objectMap["workloadRuntime"] = mcappp.WorkloadRuntime + } + if mcappp.MessageOfTheDay != nil { + objectMap["messageOfTheDay"] = mcappp.MessageOfTheDay + } + if mcappp.VnetSubnetID != nil { + objectMap["vnetSubnetID"] = mcappp.VnetSubnetID + } + if mcappp.PodSubnetID != nil { + objectMap["podSubnetID"] = mcappp.PodSubnetID + } + if mcappp.MaxPods != nil { + objectMap["maxPods"] = mcappp.MaxPods + } + if mcappp.OsType != "" { + objectMap["osType"] = mcappp.OsType + } + if mcappp.OsSKU != "" { + objectMap["osSKU"] = mcappp.OsSKU + } + if mcappp.MaxCount != nil { + objectMap["maxCount"] = mcappp.MaxCount + } + if mcappp.MinCount != nil { + objectMap["minCount"] = mcappp.MinCount + } + if mcappp.EnableAutoScaling != nil { + objectMap["enableAutoScaling"] = mcappp.EnableAutoScaling + } + if mcappp.ScaleDownMode != "" { + objectMap["scaleDownMode"] = mcappp.ScaleDownMode + } + if mcappp.Type != "" { + objectMap["type"] = mcappp.Type + } + if mcappp.Mode != "" { + objectMap["mode"] = mcappp.Mode + } + if mcappp.OrchestratorVersion != nil { + objectMap["orchestratorVersion"] = mcappp.OrchestratorVersion + } + if mcappp.CurrentOrchestratorVersion != nil { + objectMap["currentOrchestratorVersion"] = mcappp.CurrentOrchestratorVersion + } + if mcappp.UpgradeSettings != nil { + objectMap["upgradeSettings"] = mcappp.UpgradeSettings + } + if mcappp.PowerState != nil { + objectMap["powerState"] = mcappp.PowerState + } + if mcappp.AvailabilityZones != nil { + objectMap["availabilityZones"] = mcappp.AvailabilityZones + } + if mcappp.EnableNodePublicIP != nil { + objectMap["enableNodePublicIP"] = mcappp.EnableNodePublicIP + } + if mcappp.NodePublicIPPrefixID != nil { + objectMap["nodePublicIPPrefixID"] = mcappp.NodePublicIPPrefixID + } + if mcappp.ScaleSetPriority != "" { + objectMap["scaleSetPriority"] = mcappp.ScaleSetPriority + } + if mcappp.ScaleSetEvictionPolicy != "" { + objectMap["scaleSetEvictionPolicy"] = mcappp.ScaleSetEvictionPolicy + } + if mcappp.SpotMaxPrice != nil { + objectMap["spotMaxPrice"] = mcappp.SpotMaxPrice + } + if mcappp.Tags != nil { + objectMap["tags"] = mcappp.Tags + } + if mcappp.NodeLabels != nil { + objectMap["nodeLabels"] = mcappp.NodeLabels + } + if mcappp.NodeTaints != nil { + objectMap["nodeTaints"] = mcappp.NodeTaints + } + if mcappp.ProximityPlacementGroupID != nil { + objectMap["proximityPlacementGroupID"] = mcappp.ProximityPlacementGroupID + } + if mcappp.KubeletConfig != nil { + objectMap["kubeletConfig"] = mcappp.KubeletConfig + } + if mcappp.LinuxOSConfig != nil { + objectMap["linuxOSConfig"] = mcappp.LinuxOSConfig + } + if mcappp.EnableEncryptionAtHost != nil { + objectMap["enableEncryptionAtHost"] = mcappp.EnableEncryptionAtHost + } + if mcappp.EnableUltraSSD != nil { + objectMap["enableUltraSSD"] = mcappp.EnableUltraSSD + } + if mcappp.EnableFIPS != nil { + objectMap["enableFIPS"] = mcappp.EnableFIPS + } + if mcappp.GpuInstanceProfile != "" { + objectMap["gpuInstanceProfile"] = mcappp.GpuInstanceProfile + } + if mcappp.CreationData != nil { + objectMap["creationData"] = mcappp.CreationData + } + if mcappp.CapacityReservationGroupID != nil { + objectMap["capacityReservationGroupID"] = mcappp.CapacityReservationGroupID + } + if mcappp.HostGroupID != nil { + objectMap["hostGroupID"] = mcappp.HostGroupID + } + return json.Marshal(objectMap) +} + +// ManagedClusterAPIServerAccessProfile access profile for managed cluster API server. +type ManagedClusterAPIServerAccessProfile struct { + // AuthorizedIPRanges - IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. This feature is not compatible with clusters that use Public IP Per Node, or clusters that are using a Basic Load Balancer. For more information see [API server authorized IP ranges](https://docs.microsoft.com/azure/aks/api-server-authorized-ip-ranges). + AuthorizedIPRanges *[]string `json:"authorizedIPRanges,omitempty"` + // EnablePrivateCluster - For more details, see [Creating a private AKS cluster](https://docs.microsoft.com/azure/aks/private-clusters). + EnablePrivateCluster *bool `json:"enablePrivateCluster,omitempty"` + // PrivateDNSZone - The default is System. For more details see [configure private DNS zone](https://docs.microsoft.com/azure/aks/private-clusters#configure-private-dns-zone). Allowed values are 'system' and 'none'. + PrivateDNSZone *string `json:"privateDNSZone,omitempty"` + // EnablePrivateClusterPublicFQDN - Whether to create additional public FQDN for private cluster or not. + EnablePrivateClusterPublicFQDN *bool `json:"enablePrivateClusterPublicFQDN,omitempty"` + // DisableRunCommand - Whether to disable run command for the cluster or not. + DisableRunCommand *bool `json:"disableRunCommand,omitempty"` +} + +// ManagedClusterAutoUpgradeProfile auto upgrade profile for a managed cluster. +type ManagedClusterAutoUpgradeProfile struct { + // UpgradeChannel - For more information see [setting the AKS cluster auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel). Possible values include: 'UpgradeChannelRapid', 'UpgradeChannelStable', 'UpgradeChannelPatch', 'UpgradeChannelNodeImage', 'UpgradeChannelNone' + UpgradeChannel UpgradeChannel `json:"upgradeChannel,omitempty"` +} + +// ManagedClusterHTTPProxyConfig cluster HTTP proxy configuration. +type ManagedClusterHTTPProxyConfig struct { + // HTTPProxy - The HTTP proxy server endpoint to use. + HTTPProxy *string `json:"httpProxy,omitempty"` + // HTTPSProxy - The HTTPS proxy server endpoint to use. + HTTPSProxy *string `json:"httpsProxy,omitempty"` + // NoProxy - The endpoints that should not go through proxy. + NoProxy *[]string `json:"noProxy,omitempty"` + // EffectiveNoProxy - READ-ONLY; A read-only list of all endpoints for which traffic should not be sent to the proxy. This list is a superset of noProxy and values injected by AKS. + EffectiveNoProxy *[]string `json:"effectiveNoProxy,omitempty"` + // TrustedCa - Alternative CA cert to use for connecting to proxy servers. + TrustedCa *string `json:"trustedCa,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterHTTPProxyConfig. +func (mchpc ManagedClusterHTTPProxyConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mchpc.HTTPProxy != nil { + objectMap["httpProxy"] = mchpc.HTTPProxy + } + if mchpc.HTTPSProxy != nil { + objectMap["httpsProxy"] = mchpc.HTTPSProxy + } + if mchpc.NoProxy != nil { + objectMap["noProxy"] = mchpc.NoProxy + } + if mchpc.TrustedCa != nil { + objectMap["trustedCa"] = mchpc.TrustedCa + } + return json.Marshal(objectMap) +} + +// ManagedClusterIdentity identity for the managed cluster. +type ManagedClusterIdentity struct { + // PrincipalID - READ-ONLY; The principal id of the system assigned identity which is used by master components. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id of the system assigned identity which is used by master components. + TenantID *string `json:"tenantId,omitempty"` + // Type - For more information see [use managed identities in AKS](https://docs.microsoft.com/azure/aks/use-managed-identity). Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*ManagedClusterIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterIdentity. +func (mci ManagedClusterIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mci.Type != "" { + objectMap["type"] = mci.Type + } + if mci.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = mci.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// ManagedClusterIdentityUserAssignedIdentitiesValue ... +type ManagedClusterIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterIdentityUserAssignedIdentitiesValue. +func (mciAiv ManagedClusterIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedClusterIngressProfile ingress profile for the container service cluster. +type ManagedClusterIngressProfile struct { + // WebAppRouting - Web App Routing settings for the ingress profile. + WebAppRouting *ManagedClusterIngressProfileWebAppRouting `json:"webAppRouting,omitempty"` +} + +// ManagedClusterIngressProfileWebAppRouting web App Routing settings for the ingress profile. +type ManagedClusterIngressProfileWebAppRouting struct { + // Enabled - Whether to enable Web App Routing. + Enabled *bool `json:"enabled,omitempty"` + // DNSZoneResourceID - Resource ID of the DNS Zone to be associated with the web app. Used only when Web App Routing is enabled. + DNSZoneResourceID *string `json:"dnsZoneResourceId,omitempty"` +} + +// ManagedClusterListResult the response from the List Managed Clusters operation. +type ManagedClusterListResult struct { + autorest.Response `json:"-"` + // Value - The list of managed clusters. + Value *[]ManagedCluster `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of managed cluster results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterListResult. +func (mclr ManagedClusterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mclr.Value != nil { + objectMap["value"] = mclr.Value + } + return json.Marshal(objectMap) +} + +// ManagedClusterListResultIterator provides access to a complete listing of ManagedCluster values. +type ManagedClusterListResultIterator struct { + i int + page ManagedClusterListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedClusterListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedClusterListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedClusterListResultIterator) Response() ManagedClusterListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedClusterListResultIterator) Value() ManagedCluster { + if !iter.page.NotDone() { + return ManagedCluster{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedClusterListResultIterator type. +func NewManagedClusterListResultIterator(page ManagedClusterListResultPage) ManagedClusterListResultIterator { + return ManagedClusterListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mclr ManagedClusterListResult) IsEmpty() bool { + return mclr.Value == nil || len(*mclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mclr ManagedClusterListResult) hasNextLink() bool { + return mclr.NextLink != nil && len(*mclr.NextLink) != 0 +} + +// managedClusterListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mclr ManagedClusterListResult) managedClusterListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mclr.NextLink))) +} + +// ManagedClusterListResultPage contains a page of ManagedCluster values. +type ManagedClusterListResultPage struct { + fn func(context.Context, ManagedClusterListResult) (ManagedClusterListResult, error) + mclr ManagedClusterListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedClusterListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mclr) + if err != nil { + return err + } + page.mclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedClusterListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedClusterListResultPage) NotDone() bool { + return !page.mclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedClusterListResultPage) Response() ManagedClusterListResult { + return page.mclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedClusterListResultPage) Values() []ManagedCluster { + if page.mclr.IsEmpty() { + return nil + } + return *page.mclr.Value +} + +// Creates a new instance of the ManagedClusterListResultPage type. +func NewManagedClusterListResultPage(cur ManagedClusterListResult, getNextPage func(context.Context, ManagedClusterListResult) (ManagedClusterListResult, error)) ManagedClusterListResultPage { + return ManagedClusterListResultPage{ + fn: getNextPage, + mclr: cur, + } +} + +// ManagedClusterLoadBalancerProfile profile of the managed cluster load balancer. +type ManagedClusterLoadBalancerProfile struct { + // ManagedOutboundIPs - Desired managed outbound IPs for the cluster load balancer. + ManagedOutboundIPs *ManagedClusterLoadBalancerProfileManagedOutboundIPs `json:"managedOutboundIPs,omitempty"` + // OutboundIPPrefixes - Desired outbound IP Prefix resources for the cluster load balancer. + OutboundIPPrefixes *ManagedClusterLoadBalancerProfileOutboundIPPrefixes `json:"outboundIPPrefixes,omitempty"` + // OutboundIPs - Desired outbound IP resources for the cluster load balancer. + OutboundIPs *ManagedClusterLoadBalancerProfileOutboundIPs `json:"outboundIPs,omitempty"` + // EffectiveOutboundIPs - The effective outbound IP resources of the cluster load balancer. + EffectiveOutboundIPs *[]ResourceReference `json:"effectiveOutboundIPs,omitempty"` + // AllocatedOutboundPorts - The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in Azure dynamically allocating ports. + AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` + // IdleTimeoutInMinutes - Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 30 minutes. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // EnableMultipleStandardLoadBalancers - Enable multiple standard load balancers per AKS cluster or not. + EnableMultipleStandardLoadBalancers *bool `json:"enableMultipleStandardLoadBalancers,omitempty"` +} + +// ManagedClusterLoadBalancerProfileManagedOutboundIPs desired managed outbound IPs for the cluster load +// balancer. +type ManagedClusterLoadBalancerProfileManagedOutboundIPs struct { + // Count - The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. + Count *int32 `json:"count,omitempty"` + // CountIPv6 - The desired number of IPv6 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 0 for single-stack and 1 for dual-stack. + CountIPv6 *int32 `json:"countIPv6,omitempty"` +} + +// ManagedClusterLoadBalancerProfileOutboundIPPrefixes desired outbound IP Prefix resources for the cluster +// load balancer. +type ManagedClusterLoadBalancerProfileOutboundIPPrefixes struct { + // PublicIPPrefixes - A list of public IP prefix resources. + PublicIPPrefixes *[]ResourceReference `json:"publicIPPrefixes,omitempty"` +} + +// ManagedClusterLoadBalancerProfileOutboundIPs desired outbound IP resources for the cluster load +// balancer. +type ManagedClusterLoadBalancerProfileOutboundIPs struct { + // PublicIPs - A list of public IP resources. + PublicIPs *[]ResourceReference `json:"publicIPs,omitempty"` +} + +// ManagedClusterManagedOutboundIPProfile profile of the managed outbound IP resources of the managed +// cluster. +type ManagedClusterManagedOutboundIPProfile struct { + // Count - The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. + Count *int32 `json:"count,omitempty"` +} + +// ManagedClusterNATGatewayProfile profile of the managed cluster NAT gateway. +type ManagedClusterNATGatewayProfile struct { + // ManagedOutboundIPProfile - Profile of the managed outbound IP resources of the cluster NAT gateway. + ManagedOutboundIPProfile *ManagedClusterManagedOutboundIPProfile `json:"managedOutboundIPProfile,omitempty"` + // EffectiveOutboundIPs - The effective outbound IP resources of the cluster NAT gateway. + EffectiveOutboundIPs *[]ResourceReference `json:"effectiveOutboundIPs,omitempty"` + // IdleTimeoutInMinutes - Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 4 minutes. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` +} + +// ManagedClusterOIDCIssuerProfile the OIDC issuer profile of the Managed Cluster. +type ManagedClusterOIDCIssuerProfile struct { + // IssuerURL - READ-ONLY; The OIDC issuer url of the Managed Cluster. + IssuerURL *string `json:"issuerURL,omitempty"` + // Enabled - Whether the OIDC issuer is enabled. + Enabled *bool `json:"enabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterOIDCIssuerProfile. +func (mcoip ManagedClusterOIDCIssuerProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcoip.Enabled != nil { + objectMap["enabled"] = mcoip.Enabled + } + return json.Marshal(objectMap) +} + +// ManagedClusterPodIdentity details about the pod identity assigned to the Managed Cluster. +type ManagedClusterPodIdentity struct { + // Name - The name of the pod identity. + Name *string `json:"name,omitempty"` + // Namespace - The namespace of the pod identity. + Namespace *string `json:"namespace,omitempty"` + // BindingSelector - The binding selector to use for the AzureIdentityBinding resource. + BindingSelector *string `json:"bindingSelector,omitempty"` + // Identity - The user assigned identity details. + Identity *UserAssignedIdentity `json:"identity,omitempty"` + // ProvisioningState - READ-ONLY; The current provisioning state of the pod identity. Possible values include: 'ManagedClusterPodIdentityProvisioningStateAssigned', 'ManagedClusterPodIdentityProvisioningStateUpdating', 'ManagedClusterPodIdentityProvisioningStateDeleting', 'ManagedClusterPodIdentityProvisioningStateFailed' + ProvisioningState ManagedClusterPodIdentityProvisioningState `json:"provisioningState,omitempty"` + // ProvisioningInfo - READ-ONLY + ProvisioningInfo *ManagedClusterPodIdentityProvisioningInfo `json:"provisioningInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterPodIdentity. +func (mcpi ManagedClusterPodIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcpi.Name != nil { + objectMap["name"] = mcpi.Name + } + if mcpi.Namespace != nil { + objectMap["namespace"] = mcpi.Namespace + } + if mcpi.BindingSelector != nil { + objectMap["bindingSelector"] = mcpi.BindingSelector + } + if mcpi.Identity != nil { + objectMap["identity"] = mcpi.Identity + } + return json.Marshal(objectMap) +} + +// ManagedClusterPodIdentityException see [disable AAD Pod Identity for a specific +// Pod/Application](https://azure.github.io/aad-pod-identity/docs/configure/application_exception/) for +// more details. +type ManagedClusterPodIdentityException struct { + // Name - The name of the pod identity exception. + Name *string `json:"name,omitempty"` + // Namespace - The namespace of the pod identity exception. + Namespace *string `json:"namespace,omitempty"` + // PodLabels - The pod labels to match. + PodLabels map[string]*string `json:"podLabels"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterPodIdentityException. +func (mcpie ManagedClusterPodIdentityException) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcpie.Name != nil { + objectMap["name"] = mcpie.Name + } + if mcpie.Namespace != nil { + objectMap["namespace"] = mcpie.Namespace + } + if mcpie.PodLabels != nil { + objectMap["podLabels"] = mcpie.PodLabels + } + return json.Marshal(objectMap) +} + +// ManagedClusterPodIdentityProfile see [use AAD pod +// identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on pod +// identity integration. +type ManagedClusterPodIdentityProfile struct { + // Enabled - Whether the pod identity addon is enabled. + Enabled *bool `json:"enabled,omitempty"` + // AllowNetworkPluginKubenet - Running in Kubenet is disabled by default due to the security related nature of AAD Pod Identity and the risks of IP spoofing. See [using Kubenet network plugin with AAD Pod Identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity#using-kubenet-network-plugin-with-azure-active-directory-pod-managed-identities) for more information. + AllowNetworkPluginKubenet *bool `json:"allowNetworkPluginKubenet,omitempty"` + // UserAssignedIdentities - The pod identities to use in the cluster. + UserAssignedIdentities *[]ManagedClusterPodIdentity `json:"userAssignedIdentities,omitempty"` + // UserAssignedIdentityExceptions - The pod identity exceptions to allow. + UserAssignedIdentityExceptions *[]ManagedClusterPodIdentityException `json:"userAssignedIdentityExceptions,omitempty"` +} + +// ManagedClusterPodIdentityProvisioningError an error response from the pod identity provisioning. +type ManagedClusterPodIdentityProvisioningError struct { + // Error - Details about the error. + Error *ManagedClusterPodIdentityProvisioningErrorBody `json:"error,omitempty"` +} + +// ManagedClusterPodIdentityProvisioningErrorBody an error response from the pod identity provisioning. +type ManagedClusterPodIdentityProvisioningErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]ManagedClusterPodIdentityProvisioningErrorBody `json:"details,omitempty"` +} + +// ManagedClusterPodIdentityProvisioningInfo ... +type ManagedClusterPodIdentityProvisioningInfo struct { + // Error - Pod identity assignment error (if any). + Error *ManagedClusterPodIdentityProvisioningError `json:"error,omitempty"` +} + +// ManagedClusterPoolUpgradeProfile the list of available upgrade versions. +type ManagedClusterPoolUpgradeProfile struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // Name - The Agent Pool name. + Name *string `json:"name,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // Upgrades - List of orchestrator types and versions available for upgrade. + Upgrades *[]ManagedClusterPoolUpgradeProfileUpgradesItem `json:"upgrades,omitempty"` +} + +// ManagedClusterPoolUpgradeProfileUpgradesItem ... +type ManagedClusterPoolUpgradeProfileUpgradesItem struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // IsPreview - Whether the Kubernetes version is currently in preview. + IsPreview *bool `json:"isPreview,omitempty"` +} + +// ManagedClusterProperties properties of the managed cluster. +type ManagedClusterProperties struct { + // ProvisioningState - READ-ONLY; The current provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PowerState - READ-ONLY; The Power State of the cluster. + PowerState *PowerState `json:"powerState,omitempty"` + // CreationData - CreationData to be used to specify the source Snapshot ID if the cluster will be created/upgraded using a snapshot. + CreationData *CreationData `json:"creationData,omitempty"` + // MaxAgentPools - READ-ONLY; The max number of agent pools for the managed cluster. + MaxAgentPools *int32 `json:"maxAgentPools,omitempty"` + // KubernetesVersion - When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See [upgrading an AKS cluster](https://docs.microsoft.com/azure/aks/upgrade-cluster) for more details. + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // CurrentKubernetesVersion - READ-ONLY; The version of Kubernetes the Managed Cluster is running. + CurrentKubernetesVersion *string `json:"currentKubernetesVersion,omitempty"` + // DNSPrefix - This cannot be updated once the Managed Cluster has been created. + DNSPrefix *string `json:"dnsPrefix,omitempty"` + // FqdnSubdomain - This cannot be updated once the Managed Cluster has been created. + FqdnSubdomain *string `json:"fqdnSubdomain,omitempty"` + // Fqdn - READ-ONLY; The FQDN of the master pool. + Fqdn *string `json:"fqdn,omitempty"` + // PrivateFQDN - READ-ONLY; The FQDN of private cluster. + PrivateFQDN *string `json:"privateFQDN,omitempty"` + // AzurePortalFQDN - READ-ONLY; The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) headers to be sent in some responses, which Kubernetes APIServer doesn't handle by default. This special FQDN supports CORS, allowing the Azure Portal to function properly. + AzurePortalFQDN *string `json:"azurePortalFQDN,omitempty"` + // AgentPoolProfiles - The agent pool properties. + AgentPoolProfiles *[]ManagedClusterAgentPoolProfile `json:"agentPoolProfiles,omitempty"` + // LinuxProfile - The profile for Linux VMs in the Managed Cluster. + LinuxProfile *LinuxProfile `json:"linuxProfile,omitempty"` + // WindowsProfile - The profile for Windows VMs in the Managed Cluster. + WindowsProfile *ManagedClusterWindowsProfile `json:"windowsProfile,omitempty"` + // ServicePrincipalProfile - Information about a service principal identity for the cluster to use for manipulating Azure APIs. + ServicePrincipalProfile *ManagedClusterServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"` + // AddonProfiles - The profile of managed cluster add-on. + AddonProfiles map[string]*ManagedClusterAddonProfile `json:"addonProfiles"` + // PodIdentityProfile - See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on AAD pod identity integration. + PodIdentityProfile *ManagedClusterPodIdentityProfile `json:"podIdentityProfile,omitempty"` + // OidcIssuerProfile - The OIDC issuer profile of the Managed Cluster. + OidcIssuerProfile *ManagedClusterOIDCIssuerProfile `json:"oidcIssuerProfile,omitempty"` + // NodeResourceGroup - The name of the resource group containing agent pool nodes. + NodeResourceGroup *string `json:"nodeResourceGroup,omitempty"` + // EnableRBAC - Whether to enable Kubernetes Role-Based Access Control. + EnableRBAC *bool `json:"enableRBAC,omitempty"` + // EnablePodSecurityPolicy - (DEPRECATING) Whether to enable Kubernetes pod security policy (preview). This feature is set for removal on October 15th, 2020. Learn more at aka.ms/aks/azpodpolicy. + EnablePodSecurityPolicy *bool `json:"enablePodSecurityPolicy,omitempty"` + // EnableNamespaceResources - The default value is false. It can be enabled/disabled on creation and updation of the managed cluster. See [https://aka.ms/NamespaceARMResource](https://aka.ms/NamespaceARMResource) for more details on Namespace as a ARM Resource. + EnableNamespaceResources *bool `json:"enableNamespaceResources,omitempty"` + // NetworkProfile - The network configuration profile. + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // AadProfile - The Azure Active Directory configuration. + AadProfile *ManagedClusterAADProfile `json:"aadProfile,omitempty"` + // AutoUpgradeProfile - The auto upgrade configuration. + AutoUpgradeProfile *ManagedClusterAutoUpgradeProfile `json:"autoUpgradeProfile,omitempty"` + // AutoScalerProfile - Parameters to be applied to the cluster-autoscaler when enabled + AutoScalerProfile *ManagedClusterPropertiesAutoScalerProfile `json:"autoScalerProfile,omitempty"` + // APIServerAccessProfile - The access profile for managed cluster API server. + APIServerAccessProfile *ManagedClusterAPIServerAccessProfile `json:"apiServerAccessProfile,omitempty"` + // DiskEncryptionSetID - This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}' + DiskEncryptionSetID *string `json:"diskEncryptionSetID,omitempty"` + // IdentityProfile - Identities associated with the cluster. + IdentityProfile map[string]*UserAssignedIdentity `json:"identityProfile"` + // PrivateLinkResources - Private link resources associated with the cluster. + PrivateLinkResources *[]PrivateLinkResource `json:"privateLinkResources,omitempty"` + // DisableLocalAccounts - If set to true, getting static credentials will be disabled for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details see [disable local accounts](https://docs.microsoft.com/azure/aks/managed-aad#disable-local-accounts-preview). + DisableLocalAccounts *bool `json:"disableLocalAccounts,omitempty"` + // HTTPProxyConfig - Configurations for provisioning the cluster with HTTP proxy servers. + HTTPProxyConfig *ManagedClusterHTTPProxyConfig `json:"httpProxyConfig,omitempty"` + // SecurityProfile - Security profile for the managed cluster. + SecurityProfile *ManagedClusterSecurityProfile `json:"securityProfile,omitempty"` + // IngressProfile - Ingress profile for the managed cluster. + IngressProfile *ManagedClusterIngressProfile `json:"ingressProfile,omitempty"` + // PublicNetworkAccess - Allow or deny public network access for AKS. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterProperties. +func (mcp ManagedClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcp.CreationData != nil { + objectMap["creationData"] = mcp.CreationData + } + if mcp.KubernetesVersion != nil { + objectMap["kubernetesVersion"] = mcp.KubernetesVersion + } + if mcp.DNSPrefix != nil { + objectMap["dnsPrefix"] = mcp.DNSPrefix + } + if mcp.FqdnSubdomain != nil { + objectMap["fqdnSubdomain"] = mcp.FqdnSubdomain + } + if mcp.AgentPoolProfiles != nil { + objectMap["agentPoolProfiles"] = mcp.AgentPoolProfiles + } + if mcp.LinuxProfile != nil { + objectMap["linuxProfile"] = mcp.LinuxProfile + } + if mcp.WindowsProfile != nil { + objectMap["windowsProfile"] = mcp.WindowsProfile + } + if mcp.ServicePrincipalProfile != nil { + objectMap["servicePrincipalProfile"] = mcp.ServicePrincipalProfile + } + if mcp.AddonProfiles != nil { + objectMap["addonProfiles"] = mcp.AddonProfiles + } + if mcp.PodIdentityProfile != nil { + objectMap["podIdentityProfile"] = mcp.PodIdentityProfile + } + if mcp.OidcIssuerProfile != nil { + objectMap["oidcIssuerProfile"] = mcp.OidcIssuerProfile + } + if mcp.NodeResourceGroup != nil { + objectMap["nodeResourceGroup"] = mcp.NodeResourceGroup + } + if mcp.EnableRBAC != nil { + objectMap["enableRBAC"] = mcp.EnableRBAC + } + if mcp.EnablePodSecurityPolicy != nil { + objectMap["enablePodSecurityPolicy"] = mcp.EnablePodSecurityPolicy + } + if mcp.EnableNamespaceResources != nil { + objectMap["enableNamespaceResources"] = mcp.EnableNamespaceResources + } + if mcp.NetworkProfile != nil { + objectMap["networkProfile"] = mcp.NetworkProfile + } + if mcp.AadProfile != nil { + objectMap["aadProfile"] = mcp.AadProfile + } + if mcp.AutoUpgradeProfile != nil { + objectMap["autoUpgradeProfile"] = mcp.AutoUpgradeProfile + } + if mcp.AutoScalerProfile != nil { + objectMap["autoScalerProfile"] = mcp.AutoScalerProfile + } + if mcp.APIServerAccessProfile != nil { + objectMap["apiServerAccessProfile"] = mcp.APIServerAccessProfile + } + if mcp.DiskEncryptionSetID != nil { + objectMap["diskEncryptionSetID"] = mcp.DiskEncryptionSetID + } + if mcp.IdentityProfile != nil { + objectMap["identityProfile"] = mcp.IdentityProfile + } + if mcp.PrivateLinkResources != nil { + objectMap["privateLinkResources"] = mcp.PrivateLinkResources + } + if mcp.DisableLocalAccounts != nil { + objectMap["disableLocalAccounts"] = mcp.DisableLocalAccounts + } + if mcp.HTTPProxyConfig != nil { + objectMap["httpProxyConfig"] = mcp.HTTPProxyConfig + } + if mcp.SecurityProfile != nil { + objectMap["securityProfile"] = mcp.SecurityProfile + } + if mcp.IngressProfile != nil { + objectMap["ingressProfile"] = mcp.IngressProfile + } + if mcp.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = mcp.PublicNetworkAccess + } + return json.Marshal(objectMap) +} + +// ManagedClusterPropertiesAutoScalerProfile parameters to be applied to the cluster-autoscaler when +// enabled +type ManagedClusterPropertiesAutoScalerProfile struct { + // BalanceSimilarNodeGroups - Valid values are 'true' and 'false' + BalanceSimilarNodeGroups *string `json:"balance-similar-node-groups,omitempty"` + // Expander - If not specified, the default is 'random'. See [expanders](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders) for more information. Possible values include: 'ExpanderLeastWaste', 'ExpanderMostPods', 'ExpanderPriority', 'ExpanderRandom' + Expander Expander `json:"expander,omitempty"` + // MaxEmptyBulkDelete - The default is 10. + MaxEmptyBulkDelete *string `json:"max-empty-bulk-delete,omitempty"` + // MaxGracefulTerminationSec - The default is 600. + MaxGracefulTerminationSec *string `json:"max-graceful-termination-sec,omitempty"` + // MaxNodeProvisionTime - The default is '15m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + MaxNodeProvisionTime *string `json:"max-node-provision-time,omitempty"` + // MaxTotalUnreadyPercentage - The default is 45. The maximum is 100 and the minimum is 0. + MaxTotalUnreadyPercentage *string `json:"max-total-unready-percentage,omitempty"` + // NewPodScaleUpDelay - For scenarios like burst/batch scale where you don't want CA to act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc). + NewPodScaleUpDelay *string `json:"new-pod-scale-up-delay,omitempty"` + // OkTotalUnreadyCount - This must be an integer. The default is 3. + OkTotalUnreadyCount *string `json:"ok-total-unready-count,omitempty"` + // ScanInterval - The default is '10'. Values must be an integer number of seconds. + ScanInterval *string `json:"scan-interval,omitempty"` + // ScaleDownDelayAfterAdd - The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterAdd *string `json:"scale-down-delay-after-add,omitempty"` + // ScaleDownDelayAfterDelete - The default is the scan-interval. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterDelete *string `json:"scale-down-delay-after-delete,omitempty"` + // ScaleDownDelayAfterFailure - The default is '3m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterFailure *string `json:"scale-down-delay-after-failure,omitempty"` + // ScaleDownUnneededTime - The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownUnneededTime *string `json:"scale-down-unneeded-time,omitempty"` + // ScaleDownUnreadyTime - The default is '20m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownUnreadyTime *string `json:"scale-down-unready-time,omitempty"` + // ScaleDownUtilizationThreshold - The default is '0.5'. + ScaleDownUtilizationThreshold *string `json:"scale-down-utilization-threshold,omitempty"` + // SkipNodesWithLocalStorage - The default is true. + SkipNodesWithLocalStorage *string `json:"skip-nodes-with-local-storage,omitempty"` + // SkipNodesWithSystemPods - The default is true. + SkipNodesWithSystemPods *string `json:"skip-nodes-with-system-pods,omitempty"` +} + +// ManagedClusterPropertiesForSnapshot managed cluster properties for snapshot, these properties are read +// only. +type ManagedClusterPropertiesForSnapshot struct { + // KubernetesVersion - The current kubernetes version. + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // Sku - The current managed cluster sku. + Sku *ManagedClusterSKU `json:"sku,omitempty"` + // EnableRbac - Whether the cluster has enabled Kubernetes Role-Based Access Control or not. + EnableRbac *bool `json:"enableRbac,omitempty"` + // NetworkProfile - The current network profile. + NetworkProfile *NetworkProfileForSnapshot `json:"networkProfile,omitempty"` +} + +// ManagedClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (ManagedCluster, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersCreateOrUpdateFuture.Result. +func (future *ManagedClustersCreateOrUpdateFuture) result(client ManagedClustersClient) (mc ManagedCluster, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mc.Response.Response, err = future.GetResult(sender); err == nil && mc.Response.Response.StatusCode != http.StatusNoContent { + mc, err = client.CreateOrUpdateResponder(mc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersCreateOrUpdateFuture", "Result", mc.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedClustersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersDeleteFuture.Result. +func (future *ManagedClustersDeleteFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClusterSecurityProfile security profile for the container service cluster. +type ManagedClusterSecurityProfile struct { + // AzureDefender - Azure Defender settings for the security profile. + AzureDefender *ManagedClusterSecurityProfileAzureDefender `json:"azureDefender,omitempty"` + // AzureKeyVaultKms - Azure Key Vault [key management service](https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/) settings for the security profile. + AzureKeyVaultKms *AzureKeyVaultKms `json:"azureKeyVaultKms,omitempty"` + // WorkloadIdentity - [Workload Identity](https://azure.github.io/azure-workload-identity/docs/) settings for the security profile. + WorkloadIdentity *ManagedClusterSecurityProfileWorkloadIdentity `json:"workloadIdentity,omitempty"` +} + +// ManagedClusterSecurityProfileAzureDefender azure Defender settings for the security profile. +type ManagedClusterSecurityProfileAzureDefender struct { + // Enabled - Whether to enable Azure Defender + Enabled *bool `json:"enabled,omitempty"` + // LogAnalyticsWorkspaceResourceID - Resource ID of the Log Analytics workspace to be associated with Azure Defender. When Azure Defender is enabled, this field is required and must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty. + LogAnalyticsWorkspaceResourceID *string `json:"logAnalyticsWorkspaceResourceId,omitempty"` +} + +// ManagedClusterSecurityProfileWorkloadIdentity workload Identity settings for the security profile. +type ManagedClusterSecurityProfileWorkloadIdentity struct { + // Enabled - Whether to enable Workload Identity + Enabled *bool `json:"enabled,omitempty"` +} + +// ManagedClusterServicePrincipalProfile information about a service principal identity for the cluster to +// use for manipulating Azure APIs. +type ManagedClusterServicePrincipalProfile struct { + // ClientID - The ID for the service principal. + ClientID *string `json:"clientId,omitempty"` + // Secret - The secret password associated with the service principal in plain text. + Secret *string `json:"secret,omitempty"` +} + +// ManagedClusterSKU the SKU of a Managed Cluster. +type ManagedClusterSKU struct { + // Name - The name of a managed cluster SKU. Possible values include: 'ManagedClusterSKUNameBasic' + Name ManagedClusterSKUName `json:"name,omitempty"` + // Tier - If not specified, the default is 'Free'. See [uptime SLA](https://docs.microsoft.com/azure/aks/uptime-sla) for more details. Possible values include: 'ManagedClusterSKUTierPaid', 'ManagedClusterSKUTierFree' + Tier ManagedClusterSKUTier `json:"tier,omitempty"` +} + +// ManagedClusterSnapshot a managed cluster snapshot resource. +type ManagedClusterSnapshot struct { + autorest.Response `json:"-"` + // ManagedClusterSnapshotProperties - Properties of a managed cluster snapshot. + *ManagedClusterSnapshotProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterSnapshot. +func (mcs ManagedClusterSnapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcs.ManagedClusterSnapshotProperties != nil { + objectMap["properties"] = mcs.ManagedClusterSnapshotProperties + } + if mcs.Tags != nil { + objectMap["tags"] = mcs.Tags + } + if mcs.Location != nil { + objectMap["location"] = mcs.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedClusterSnapshot struct. +func (mcs *ManagedClusterSnapshot) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managedClusterSnapshotProperties ManagedClusterSnapshotProperties + err = json.Unmarshal(*v, &managedClusterSnapshotProperties) + if err != nil { + return err + } + mcs.ManagedClusterSnapshotProperties = &managedClusterSnapshotProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mcs.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mcs.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mcs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mcs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mcs.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mcs.SystemData = &systemData + } + } + } + + return nil +} + +// ManagedClusterSnapshotListResult the response from the List Managed Cluster Snapshots operation. +type ManagedClusterSnapshotListResult struct { + autorest.Response `json:"-"` + // Value - The list of managed cluster snapshots. + Value *[]ManagedClusterSnapshot `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of managed cluster snapshot results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterSnapshotListResult. +func (mcslr ManagedClusterSnapshotListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcslr.Value != nil { + objectMap["value"] = mcslr.Value + } + return json.Marshal(objectMap) +} + +// ManagedClusterSnapshotListResultIterator provides access to a complete listing of ManagedClusterSnapshot +// values. +type ManagedClusterSnapshotListResultIterator struct { + i int + page ManagedClusterSnapshotListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedClusterSnapshotListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedClusterSnapshotListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedClusterSnapshotListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedClusterSnapshotListResultIterator) Response() ManagedClusterSnapshotListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedClusterSnapshotListResultIterator) Value() ManagedClusterSnapshot { + if !iter.page.NotDone() { + return ManagedClusterSnapshot{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedClusterSnapshotListResultIterator type. +func NewManagedClusterSnapshotListResultIterator(page ManagedClusterSnapshotListResultPage) ManagedClusterSnapshotListResultIterator { + return ManagedClusterSnapshotListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mcslr ManagedClusterSnapshotListResult) IsEmpty() bool { + return mcslr.Value == nil || len(*mcslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mcslr ManagedClusterSnapshotListResult) hasNextLink() bool { + return mcslr.NextLink != nil && len(*mcslr.NextLink) != 0 +} + +// managedClusterSnapshotListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mcslr ManagedClusterSnapshotListResult) managedClusterSnapshotListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mcslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mcslr.NextLink))) +} + +// ManagedClusterSnapshotListResultPage contains a page of ManagedClusterSnapshot values. +type ManagedClusterSnapshotListResultPage struct { + fn func(context.Context, ManagedClusterSnapshotListResult) (ManagedClusterSnapshotListResult, error) + mcslr ManagedClusterSnapshotListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedClusterSnapshotListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mcslr) + if err != nil { + return err + } + page.mcslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedClusterSnapshotListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedClusterSnapshotListResultPage) NotDone() bool { + return !page.mcslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedClusterSnapshotListResultPage) Response() ManagedClusterSnapshotListResult { + return page.mcslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedClusterSnapshotListResultPage) Values() []ManagedClusterSnapshot { + if page.mcslr.IsEmpty() { + return nil + } + return *page.mcslr.Value +} + +// Creates a new instance of the ManagedClusterSnapshotListResultPage type. +func NewManagedClusterSnapshotListResultPage(cur ManagedClusterSnapshotListResult, getNextPage func(context.Context, ManagedClusterSnapshotListResult) (ManagedClusterSnapshotListResult, error)) ManagedClusterSnapshotListResultPage { + return ManagedClusterSnapshotListResultPage{ + fn: getNextPage, + mcslr: cur, + } +} + +// ManagedClusterSnapshotProperties properties for a managed cluster snapshot. +type ManagedClusterSnapshotProperties struct { + // CreationData - CreationData to be used to specify the source resource ID to create this snapshot. + CreationData *CreationData `json:"creationData,omitempty"` + // SnapshotType - Possible values include: 'SnapshotTypeNodePool', 'SnapshotTypeManagedCluster' + SnapshotType SnapshotType `json:"snapshotType,omitempty"` + // ManagedClusterPropertiesReadOnly - What the properties will be showed when getting managed cluster snapshot. Those properties are read-only. + ManagedClusterPropertiesReadOnly *ManagedClusterPropertiesForSnapshot `json:"managedClusterPropertiesReadOnly,omitempty"` +} + +// ManagedClustersResetAADProfileFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersResetAADProfileFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersResetAADProfileFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersResetAADProfileFuture.Result. +func (future *ManagedClustersResetAADProfileFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersResetAADProfileFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersResetAADProfileFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersResetServicePrincipalProfileFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ManagedClustersResetServicePrincipalProfileFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersResetServicePrincipalProfileFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersResetServicePrincipalProfileFuture.Result. +func (future *ManagedClustersResetServicePrincipalProfileFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersResetServicePrincipalProfileFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersResetServicePrincipalProfileFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersRotateClusterCertificatesFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ManagedClustersRotateClusterCertificatesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersRotateClusterCertificatesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersRotateClusterCertificatesFuture.Result. +func (future *ManagedClustersRotateClusterCertificatesFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRotateClusterCertificatesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersRotateClusterCertificatesFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersRotateServiceAccountSigningKeysFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ManagedClustersRotateServiceAccountSigningKeysFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersRotateServiceAccountSigningKeysFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersRotateServiceAccountSigningKeysFuture.Result. +func (future *ManagedClustersRotateServiceAccountSigningKeysFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRotateServiceAccountSigningKeysFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersRotateServiceAccountSigningKeysFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersRunCommandFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersRunCommandFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (RunCommandResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersRunCommandFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersRunCommandFuture.Result. +func (future *ManagedClustersRunCommandFuture) result(client ManagedClustersClient) (rcr RunCommandResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRunCommandFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rcr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersRunCommandFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rcr.Response.Response, err = future.GetResult(sender); err == nil && rcr.Response.Response.StatusCode != http.StatusNoContent { + rcr, err = client.RunCommandResponder(rcr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRunCommandFuture", "Result", rcr.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedClustersStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedClustersStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersStartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersStartFuture.Result. +func (future *ManagedClustersStartFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersStartFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedClustersStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersStopFuture.Result. +func (future *ManagedClustersStopFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersStopFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClusterStorageProfile storage profile for the container service cluster. +type ManagedClusterStorageProfile struct { + // DiskCSIDriver - AzureDisk CSI Driver settings for the storage profile. + DiskCSIDriver *ManagedClusterStorageProfileDiskCSIDriver `json:"diskCSIDriver,omitempty"` + // FileCSIDriver - AzureFile CSI Driver settings for the storage profile. + FileCSIDriver *ManagedClusterStorageProfileFileCSIDriver `json:"fileCSIDriver,omitempty"` + // SnapshotController - Snapshot Controller settings for the storage profile. + SnapshotController *ManagedClusterStorageProfileSnapshotController `json:"snapshotController,omitempty"` +} + +// ManagedClusterStorageProfileDiskCSIDriver azureDisk CSI Driver settings for the storage profile. +type ManagedClusterStorageProfileDiskCSIDriver struct { + // Enabled - Whether to enable AzureDisk CSI Driver. The default value is true. + Enabled *bool `json:"enabled,omitempty"` + // Version - The version of AzureDisk CSI Driver. The default value is v1. + Version *string `json:"version,omitempty"` +} + +// ManagedClusterStorageProfileFileCSIDriver azureFile CSI Driver settings for the storage profile. +type ManagedClusterStorageProfileFileCSIDriver struct { + // Enabled - Whether to enable AzureFile CSI Driver. The default value is true. + Enabled *bool `json:"enabled,omitempty"` +} + +// ManagedClusterStorageProfileSnapshotController snapshot Controller settings for the storage profile. +type ManagedClusterStorageProfileSnapshotController struct { + // Enabled - Whether to enable Snapshot Controller. The default value is true. + Enabled *bool `json:"enabled,omitempty"` +} + +// ManagedClustersUpdateTagsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (ManagedCluster, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersUpdateTagsFuture.Result. +func (future *ManagedClustersUpdateTagsFuture) result(client ManagedClustersClient) (mc ManagedCluster, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mc.Response.Response, err = future.GetResult(sender); err == nil && mc.Response.Response.StatusCode != http.StatusNoContent { + mc, err = client.UpdateTagsResponder(mc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersUpdateTagsFuture", "Result", mc.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedClusterUpgradeProfile the list of available upgrades for compute pools. +type ManagedClusterUpgradeProfile struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the upgrade profile. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the upgrade profile. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the upgrade profile. + Type *string `json:"type,omitempty"` + // ManagedClusterUpgradeProfileProperties - The properties of the upgrade profile. + *ManagedClusterUpgradeProfileProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterUpgradeProfile. +func (mcup ManagedClusterUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcup.ManagedClusterUpgradeProfileProperties != nil { + objectMap["properties"] = mcup.ManagedClusterUpgradeProfileProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedClusterUpgradeProfile struct. +func (mcup *ManagedClusterUpgradeProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mcup.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mcup.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mcup.Type = &typeVar + } + case "properties": + if v != nil { + var managedClusterUpgradeProfileProperties ManagedClusterUpgradeProfileProperties + err = json.Unmarshal(*v, &managedClusterUpgradeProfileProperties) + if err != nil { + return err + } + mcup.ManagedClusterUpgradeProfileProperties = &managedClusterUpgradeProfileProperties + } + } + } + + return nil +} + +// ManagedClusterUpgradeProfileProperties control plane and agent pool upgrade profiles. +type ManagedClusterUpgradeProfileProperties struct { + // ControlPlaneProfile - The list of available upgrade versions for the control plane. + ControlPlaneProfile *ManagedClusterPoolUpgradeProfile `json:"controlPlaneProfile,omitempty"` + // AgentPoolProfiles - The list of available upgrade versions for agent pools. + AgentPoolProfiles *[]ManagedClusterPoolUpgradeProfile `json:"agentPoolProfiles,omitempty"` +} + +// ManagedClusterWindowsProfile profile for Windows VMs in the managed cluster. +type ManagedClusterWindowsProfile struct { + // AdminUsername - Specifies the name of the administrator account.

**Restriction:** Cannot end in "."

**Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5".

**Minimum-length:** 1 character

**Max-length:** 20 characters + AdminUsername *string `json:"adminUsername,omitempty"` + // AdminPassword - Specifies the password of the administrator account.

**Minimum-length:** 8 characters

**Max-length:** 123 characters

**Complexity requirements:** 3 out of 4 conditions below need to be fulfilled
Has lower characters
Has upper characters
Has a digit
Has a special character (Regex match [\W_])

**Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" + AdminPassword *string `json:"adminPassword,omitempty"` + // LicenseType - The license type to use for Windows VMs. See [Azure Hybrid User Benefits](https://azure.microsoft.com/pricing/hybrid-benefit/faq/) for more details. Possible values include: 'LicenseTypeNone', 'LicenseTypeWindowsServer' + LicenseType LicenseType `json:"licenseType,omitempty"` + // EnableCSIProxy - For more details on CSI proxy, see the [CSI proxy GitHub repo](https://github.com/kubernetes-csi/csi-proxy). + EnableCSIProxy *bool `json:"enableCSIProxy,omitempty"` + // GmsaProfile - The Windows gMSA Profile in the Managed Cluster. + GmsaProfile *WindowsGmsaProfile `json:"gmsaProfile,omitempty"` +} + +// MasterProfile profile for the container service master. +type MasterProfile struct { + // Count - Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. + Count *int32 `json:"count,omitempty"` + // DNSPrefix - DNS prefix to be used to create the FQDN for the master pool. + DNSPrefix *string `json:"dnsPrefix,omitempty"` + // VMSize - Size of agent VMs. Possible values include: 'VMSizeTypesStandardA1', 'VMSizeTypesStandardA10', 'VMSizeTypesStandardA11', 'VMSizeTypesStandardA1V2', 'VMSizeTypesStandardA2', 'VMSizeTypesStandardA2V2', 'VMSizeTypesStandardA2mV2', 'VMSizeTypesStandardA3', 'VMSizeTypesStandardA4', 'VMSizeTypesStandardA4V2', 'VMSizeTypesStandardA4mV2', 'VMSizeTypesStandardA5', 'VMSizeTypesStandardA6', 'VMSizeTypesStandardA7', 'VMSizeTypesStandardA8', 'VMSizeTypesStandardA8V2', 'VMSizeTypesStandardA8mV2', 'VMSizeTypesStandardA9', 'VMSizeTypesStandardB2ms', 'VMSizeTypesStandardB2s', 'VMSizeTypesStandardB4ms', 'VMSizeTypesStandardB8ms', 'VMSizeTypesStandardD1', 'VMSizeTypesStandardD11', 'VMSizeTypesStandardD11V2', 'VMSizeTypesStandardD11V2Promo', 'VMSizeTypesStandardD12', 'VMSizeTypesStandardD12V2', 'VMSizeTypesStandardD12V2Promo', 'VMSizeTypesStandardD13', 'VMSizeTypesStandardD13V2', 'VMSizeTypesStandardD13V2Promo', 'VMSizeTypesStandardD14', 'VMSizeTypesStandardD14V2', 'VMSizeTypesStandardD14V2Promo', 'VMSizeTypesStandardD15V2', 'VMSizeTypesStandardD16V3', 'VMSizeTypesStandardD16sV3', 'VMSizeTypesStandardD1V2', 'VMSizeTypesStandardD2', 'VMSizeTypesStandardD2V2', 'VMSizeTypesStandardD2V2Promo', 'VMSizeTypesStandardD2V3', 'VMSizeTypesStandardD2sV3', 'VMSizeTypesStandardD3', 'VMSizeTypesStandardD32V3', 'VMSizeTypesStandardD32sV3', 'VMSizeTypesStandardD3V2', 'VMSizeTypesStandardD3V2Promo', 'VMSizeTypesStandardD4', 'VMSizeTypesStandardD4V2', 'VMSizeTypesStandardD4V2Promo', 'VMSizeTypesStandardD4V3', 'VMSizeTypesStandardD4sV3', 'VMSizeTypesStandardD5V2', 'VMSizeTypesStandardD5V2Promo', 'VMSizeTypesStandardD64V3', 'VMSizeTypesStandardD64sV3', 'VMSizeTypesStandardD8V3', 'VMSizeTypesStandardD8sV3', 'VMSizeTypesStandardDS1', 'VMSizeTypesStandardDS11', 'VMSizeTypesStandardDS11V2', 'VMSizeTypesStandardDS11V2Promo', 'VMSizeTypesStandardDS12', 'VMSizeTypesStandardDS12V2', 'VMSizeTypesStandardDS12V2Promo', 'VMSizeTypesStandardDS13', 'VMSizeTypesStandardDS132V2', 'VMSizeTypesStandardDS134V2', 'VMSizeTypesStandardDS13V2', 'VMSizeTypesStandardDS13V2Promo', 'VMSizeTypesStandardDS14', 'VMSizeTypesStandardDS144V2', 'VMSizeTypesStandardDS148V2', 'VMSizeTypesStandardDS14V2', 'VMSizeTypesStandardDS14V2Promo', 'VMSizeTypesStandardDS15V2', 'VMSizeTypesStandardDS1V2', 'VMSizeTypesStandardDS2', 'VMSizeTypesStandardDS2V2', 'VMSizeTypesStandardDS2V2Promo', 'VMSizeTypesStandardDS3', 'VMSizeTypesStandardDS3V2', 'VMSizeTypesStandardDS3V2Promo', 'VMSizeTypesStandardDS4', 'VMSizeTypesStandardDS4V2', 'VMSizeTypesStandardDS4V2Promo', 'VMSizeTypesStandardDS5V2', 'VMSizeTypesStandardDS5V2Promo', 'VMSizeTypesStandardE16V3', 'VMSizeTypesStandardE16sV3', 'VMSizeTypesStandardE2V3', 'VMSizeTypesStandardE2sV3', 'VMSizeTypesStandardE3216sV3', 'VMSizeTypesStandardE328sV3', 'VMSizeTypesStandardE32V3', 'VMSizeTypesStandardE32sV3', 'VMSizeTypesStandardE4V3', 'VMSizeTypesStandardE4sV3', 'VMSizeTypesStandardE6416sV3', 'VMSizeTypesStandardE6432sV3', 'VMSizeTypesStandardE64V3', 'VMSizeTypesStandardE64sV3', 'VMSizeTypesStandardE8V3', 'VMSizeTypesStandardE8sV3', 'VMSizeTypesStandardF1', 'VMSizeTypesStandardF16', 'VMSizeTypesStandardF16s', 'VMSizeTypesStandardF16sV2', 'VMSizeTypesStandardF1s', 'VMSizeTypesStandardF2', 'VMSizeTypesStandardF2s', 'VMSizeTypesStandardF2sV2', 'VMSizeTypesStandardF32sV2', 'VMSizeTypesStandardF4', 'VMSizeTypesStandardF4s', 'VMSizeTypesStandardF4sV2', 'VMSizeTypesStandardF64sV2', 'VMSizeTypesStandardF72sV2', 'VMSizeTypesStandardF8', 'VMSizeTypesStandardF8s', 'VMSizeTypesStandardF8sV2', 'VMSizeTypesStandardG1', 'VMSizeTypesStandardG2', 'VMSizeTypesStandardG3', 'VMSizeTypesStandardG4', 'VMSizeTypesStandardG5', 'VMSizeTypesStandardGS1', 'VMSizeTypesStandardGS2', 'VMSizeTypesStandardGS3', 'VMSizeTypesStandardGS4', 'VMSizeTypesStandardGS44', 'VMSizeTypesStandardGS48', 'VMSizeTypesStandardGS5', 'VMSizeTypesStandardGS516', 'VMSizeTypesStandardGS58', 'VMSizeTypesStandardH16', 'VMSizeTypesStandardH16m', 'VMSizeTypesStandardH16mr', 'VMSizeTypesStandardH16r', 'VMSizeTypesStandardH8', 'VMSizeTypesStandardH8m', 'VMSizeTypesStandardL16s', 'VMSizeTypesStandardL32s', 'VMSizeTypesStandardL4s', 'VMSizeTypesStandardL8s', 'VMSizeTypesStandardM12832ms', 'VMSizeTypesStandardM12864ms', 'VMSizeTypesStandardM128ms', 'VMSizeTypesStandardM128s', 'VMSizeTypesStandardM6416ms', 'VMSizeTypesStandardM6432ms', 'VMSizeTypesStandardM64ms', 'VMSizeTypesStandardM64s', 'VMSizeTypesStandardNC12', 'VMSizeTypesStandardNC12sV2', 'VMSizeTypesStandardNC12sV3', 'VMSizeTypesStandardNC24', 'VMSizeTypesStandardNC24r', 'VMSizeTypesStandardNC24rsV2', 'VMSizeTypesStandardNC24rsV3', 'VMSizeTypesStandardNC24sV2', 'VMSizeTypesStandardNC24sV3', 'VMSizeTypesStandardNC6', 'VMSizeTypesStandardNC6sV2', 'VMSizeTypesStandardNC6sV3', 'VMSizeTypesStandardND12s', 'VMSizeTypesStandardND24rs', 'VMSizeTypesStandardND24s', 'VMSizeTypesStandardND6s', 'VMSizeTypesStandardNV12', 'VMSizeTypesStandardNV24', 'VMSizeTypesStandardNV6' + VMSize VMSizeTypes `json:"vmSize,omitempty"` + // OsDiskSizeGB - OS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` + // VnetSubnetID - VNet SubnetID specifies the VNet's subnet identifier. + VnetSubnetID *string `json:"vnetSubnetID,omitempty"` + // FirstConsecutiveStaticIP - FirstConsecutiveStaticIP used to specify the first static ip of masters. + FirstConsecutiveStaticIP *string `json:"firstConsecutiveStaticIP,omitempty"` + // StorageProfile - Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. Possible values include: 'StorageProfileTypesStorageAccount', 'StorageProfileTypesManagedDisks' + StorageProfile StorageProfileTypes `json:"storageProfile,omitempty"` + // Fqdn - READ-ONLY; FQDN for the master pool. + Fqdn *string `json:"fqdn,omitempty"` +} + +// MarshalJSON is the custom marshaler for MasterProfile. +func (mp MasterProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mp.Count != nil { + objectMap["count"] = mp.Count + } + if mp.DNSPrefix != nil { + objectMap["dnsPrefix"] = mp.DNSPrefix + } + if mp.VMSize != "" { + objectMap["vmSize"] = mp.VMSize + } + if mp.OsDiskSizeGB != nil { + objectMap["osDiskSizeGB"] = mp.OsDiskSizeGB + } + if mp.VnetSubnetID != nil { + objectMap["vnetSubnetID"] = mp.VnetSubnetID + } + if mp.FirstConsecutiveStaticIP != nil { + objectMap["firstConsecutiveStaticIP"] = mp.FirstConsecutiveStaticIP + } + if mp.StorageProfile != "" { + objectMap["storageProfile"] = mp.StorageProfile + } + return json.Marshal(objectMap) +} + +// NetworkProfile profile of network configuration. +type NetworkProfile struct { + // NetworkPlugin - Network plugin used for building the Kubernetes network. Possible values include: 'NetworkPluginAzure', 'NetworkPluginKubenet', 'NetworkPluginNone' + NetworkPlugin NetworkPlugin `json:"networkPlugin,omitempty"` + // NetworkPolicy - Network policy used for building the Kubernetes network. Possible values include: 'NetworkPolicyCalico', 'NetworkPolicyAzure' + NetworkPolicy NetworkPolicy `json:"networkPolicy,omitempty"` + // NetworkMode - This cannot be specified if networkPlugin is anything other than 'azure'. Possible values include: 'NetworkModeTransparent', 'NetworkModeBridge' + NetworkMode NetworkMode `json:"networkMode,omitempty"` + // PodCidr - A CIDR notation IP range from which to assign pod IPs when kubenet is used. + PodCidr *string `json:"podCidr,omitempty"` + // ServiceCidr - A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges. + ServiceCidr *string `json:"serviceCidr,omitempty"` + // DNSServiceIP - An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr. + DNSServiceIP *string `json:"dnsServiceIP,omitempty"` + // DockerBridgeCidr - A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. + DockerBridgeCidr *string `json:"dockerBridgeCidr,omitempty"` + // OutboundType - This can only be set at cluster creation time and cannot be changed later. For more information see [egress outbound type](https://docs.microsoft.com/azure/aks/egress-outboundtype). Possible values include: 'OutboundTypeLoadBalancer', 'OutboundTypeUserDefinedRouting', 'OutboundTypeManagedNATGateway', 'OutboundTypeUserAssignedNATGateway' + OutboundType OutboundType `json:"outboundType,omitempty"` + // LoadBalancerSku - The default is 'standard'. See [Azure Load Balancer SKUs](https://docs.microsoft.com/azure/load-balancer/skus) for more information about the differences between load balancer SKUs. Possible values include: 'LoadBalancerSkuStandard', 'LoadBalancerSkuBasic' + LoadBalancerSku LoadBalancerSku `json:"loadBalancerSku,omitempty"` + // LoadBalancerProfile - Profile of the cluster load balancer. + LoadBalancerProfile *ManagedClusterLoadBalancerProfile `json:"loadBalancerProfile,omitempty"` + // NatGatewayProfile - Profile of the cluster NAT gateway. + NatGatewayProfile *ManagedClusterNATGatewayProfile `json:"natGatewayProfile,omitempty"` + // PodCidrs - One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. + PodCidrs *[]string `json:"podCidrs,omitempty"` + // ServiceCidrs - One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap with any Subnet IP ranges. + ServiceCidrs *[]string `json:"serviceCidrs,omitempty"` + // IPFamilies - IP families are used to determine single-stack or dual-stack clusters. For single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and IPv6. + IPFamilies *[]IPFamily `json:"ipFamilies,omitempty"` +} + +// NetworkProfileForSnapshot network profile for managed cluster snapshot, these properties are read only. +type NetworkProfileForSnapshot struct { + // NetworkPlugin - networkPlugin for managed cluster snapshot. Possible values include: 'NetworkPluginAzure', 'NetworkPluginKubenet', 'NetworkPluginNone' + NetworkPlugin NetworkPlugin `json:"networkPlugin,omitempty"` + // NetworkPolicy - networkPolicy for managed cluster snapshot. Possible values include: 'NetworkPolicyCalico', 'NetworkPolicyAzure' + NetworkPolicy NetworkPolicy `json:"networkPolicy,omitempty"` + // NetworkMode - networkMode for managed cluster snapshot. Possible values include: 'NetworkModeTransparent', 'NetworkModeBridge' + NetworkMode NetworkMode `json:"networkMode,omitempty"` + // LoadBalancerSku - loadBalancerSku for managed cluster snapshot. Possible values include: 'LoadBalancerSkuStandard', 'LoadBalancerSkuBasic' + LoadBalancerSku LoadBalancerSku `json:"loadBalancerSku,omitempty"` +} + +// OperationListResult the List Operation response. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of operations + Value *[]OperationValue `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationListResult. +func (olr OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationValue describes the properties of a Operation value. +type OperationValue struct { + // Origin - READ-ONLY; The origin of the operation. + Origin *string `json:"origin,omitempty"` + // Name - READ-ONLY; The name of the operation. + Name *string `json:"name,omitempty"` + // OperationValueDisplay - Describes the properties of a Operation Value Display. + *OperationValueDisplay `json:"display,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationValue. +func (ov OperationValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ov.OperationValueDisplay != nil { + objectMap["display"] = ov.OperationValueDisplay + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OperationValue struct. +func (ov *OperationValue) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + ov.Origin = &origin + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ov.Name = &name + } + case "display": + if v != nil { + var operationValueDisplay OperationValueDisplay + err = json.Unmarshal(*v, &operationValueDisplay) + if err != nil { + return err + } + ov.OperationValueDisplay = &operationValueDisplay + } + } + } + + return nil +} + +// OperationValueDisplay describes the properties of a Operation Value Display. +type OperationValueDisplay struct { + // Operation - READ-ONLY; The display name of the operation. + Operation *string `json:"operation,omitempty"` + // Resource - READ-ONLY; The display name of the resource the operation applies to. + Resource *string `json:"resource,omitempty"` + // Description - READ-ONLY; The description of the operation. + Description *string `json:"description,omitempty"` + // Provider - READ-ONLY; The resource provider for the operation. + Provider *string `json:"provider,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationValueDisplay. +func (ovd OperationValueDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OSOptionProfile the OS option profile. +type OSOptionProfile struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the OS option resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the OS option resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the OS option resource. + Type *string `json:"type,omitempty"` + // OSOptionPropertyList - The list of OS options. + *OSOptionPropertyList `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for OSOptionProfile. +func (oop OSOptionProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oop.OSOptionPropertyList != nil { + objectMap["properties"] = oop.OSOptionPropertyList + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OSOptionProfile struct. +func (oop *OSOptionProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + oop.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + oop.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + oop.Type = &typeVar + } + case "properties": + if v != nil { + var oSOptionPropertyList OSOptionPropertyList + err = json.Unmarshal(*v, &oSOptionPropertyList) + if err != nil { + return err + } + oop.OSOptionPropertyList = &oSOptionPropertyList + } + } + } + + return nil +} + +// OSOptionProperty OS option property. +type OSOptionProperty struct { + // OsType - The OS type. + OsType *string `json:"os-type,omitempty"` + // EnableFipsImage - Whether the image is FIPS-enabled. + EnableFipsImage *bool `json:"enable-fips-image,omitempty"` +} + +// OSOptionPropertyList the list of OS option properties. +type OSOptionPropertyList struct { + // OsOptionPropertyList - The list of OS options. + OsOptionPropertyList *[]OSOptionProperty `json:"osOptionPropertyList,omitempty"` +} + +// OutboundEnvironmentEndpoint egress endpoints which AKS agent nodes connect to for common purpose. +type OutboundEnvironmentEndpoint struct { + // Category - The category of endpoints accessed by the AKS agent node, e.g. azure-resource-management, apiserver, etc. + Category *string `json:"category,omitempty"` + // Endpoints - The endpoints that AKS agent nodes connect to + Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` +} + +// OutboundEnvironmentEndpointCollection collection of OutboundEnvironmentEndpoint +type OutboundEnvironmentEndpointCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]OutboundEnvironmentEndpoint `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutboundEnvironmentEndpointCollection. +func (oeec OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oeec.Value != nil { + objectMap["value"] = oeec.Value + } + return json.Marshal(objectMap) +} + +// OutboundEnvironmentEndpointCollectionIterator provides access to a complete listing of +// OutboundEnvironmentEndpoint values. +type OutboundEnvironmentEndpointCollectionIterator struct { + i int + page OutboundEnvironmentEndpointCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OutboundEnvironmentEndpointCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OutboundEnvironmentEndpointCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OutboundEnvironmentEndpointCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OutboundEnvironmentEndpointCollectionIterator) Response() OutboundEnvironmentEndpointCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OutboundEnvironmentEndpointCollectionIterator) Value() OutboundEnvironmentEndpoint { + if !iter.page.NotDone() { + return OutboundEnvironmentEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OutboundEnvironmentEndpointCollectionIterator type. +func NewOutboundEnvironmentEndpointCollectionIterator(page OutboundEnvironmentEndpointCollectionPage) OutboundEnvironmentEndpointCollectionIterator { + return OutboundEnvironmentEndpointCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (oeec OutboundEnvironmentEndpointCollection) IsEmpty() bool { + return oeec.Value == nil || len(*oeec.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (oeec OutboundEnvironmentEndpointCollection) hasNextLink() bool { + return oeec.NextLink != nil && len(*oeec.NextLink) != 0 +} + +// outboundEnvironmentEndpointCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (oeec OutboundEnvironmentEndpointCollection) outboundEnvironmentEndpointCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !oeec.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(oeec.NextLink))) +} + +// OutboundEnvironmentEndpointCollectionPage contains a page of OutboundEnvironmentEndpoint values. +type OutboundEnvironmentEndpointCollectionPage struct { + fn func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error) + oeec OutboundEnvironmentEndpointCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OutboundEnvironmentEndpointCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.oeec) + if err != nil { + return err + } + page.oeec = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OutboundEnvironmentEndpointCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OutboundEnvironmentEndpointCollectionPage) NotDone() bool { + return !page.oeec.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OutboundEnvironmentEndpointCollectionPage) Response() OutboundEnvironmentEndpointCollection { + return page.oeec +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OutboundEnvironmentEndpointCollectionPage) Values() []OutboundEnvironmentEndpoint { + if page.oeec.IsEmpty() { + return nil + } + return *page.oeec.Value +} + +// Creates a new instance of the OutboundEnvironmentEndpointCollectionPage type. +func NewOutboundEnvironmentEndpointCollectionPage(cur OutboundEnvironmentEndpointCollection, getNextPage func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error)) OutboundEnvironmentEndpointCollectionPage { + return OutboundEnvironmentEndpointCollectionPage{ + fn: getNextPage, + oeec: cur, + } +} + +// PowerState describes the Power State of the cluster +type PowerState struct { + // Code - Tells whether the cluster is Running or Stopped. Possible values include: 'CodeRunning', 'CodeStopped' + Code Code `json:"code,omitempty"` +} + +// PrivateEndpoint private endpoint which a connection belongs to. +type PrivateEndpoint struct { + // ID - The resource ID of the private endpoint + ID *string `json:"id,omitempty"` +} + +// PrivateEndpointConnection a private endpoint connection +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the private endpoint connection. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the private endpoint connection. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // PrivateEndpointConnectionProperties - The properties of a private endpoint connection. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + } + } + + return nil +} + +// PrivateEndpointConnectionListResult a list of private endpoint connections +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - The collection value. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` +} + +// PrivateEndpointConnectionProperties properties of a private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // ProvisioningState - READ-ONLY; The current provisioning state. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' + ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` + // PrivateEndpoint - The resource of private endpoint. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. +func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pecp.PrivateEndpoint != nil { + objectMap["privateEndpoint"] = pecp.PrivateEndpoint + } + if pecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. +func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkResource a private link resource +type PrivateLinkResource struct { + autorest.Response `json:"-"` + // ID - The ID of the private link resource. + ID *string `json:"id,omitempty"` + // Name - The name of the private link resource. + Name *string `json:"name,omitempty"` + // Type - The resource type. + Type *string `json:"type,omitempty"` + // GroupID - The group ID of the resource. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - The RequiredMembers of the resource + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // PrivateLinkServiceID - READ-ONLY; The private link service ID of the resource, this field is exposed only to NRP internally. + PrivateLinkServiceID *string `json:"privateLinkServiceID,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.ID != nil { + objectMap["id"] = plr.ID + } + if plr.Name != nil { + objectMap["name"] = plr.Name + } + if plr.Type != nil { + objectMap["type"] = plr.Type + } + if plr.GroupID != nil { + objectMap["groupId"] = plr.GroupID + } + if plr.RequiredMembers != nil { + objectMap["requiredMembers"] = plr.RequiredMembers + } + return json.Marshal(objectMap) +} + +// PrivateLinkResourcesListResult a list of private link resources +type PrivateLinkResourcesListResult struct { + autorest.Response `json:"-"` + // Value - The collection value. + Value *[]PrivateLinkResource `json:"value,omitempty"` +} + +// PrivateLinkServiceConnectionState the state of a private link service connection. +type PrivateLinkServiceConnectionState struct { + // Status - The private link service connection status. Possible values include: 'ConnectionStatusPending', 'ConnectionStatusApproved', 'ConnectionStatusRejected', 'ConnectionStatusDisconnected' + Status ConnectionStatus `json:"status,omitempty"` + // Description - The private link service connection description. + Description *string `json:"description,omitempty"` +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceReference a reference to an Azure resource. +type ResourceReference struct { + // ID - The fully qualified Azure resource id. + ID *string `json:"id,omitempty"` +} + +// RunCommandRequest a run command request +type RunCommandRequest struct { + // Command - The command to run. + Command *string `json:"command,omitempty"` + // Context - A base64 encoded zip file containing the files required by the command. + Context *string `json:"context,omitempty"` + // ClusterToken - AuthToken issued for AKS AAD Server App. + ClusterToken *string `json:"clusterToken,omitempty"` +} + +// RunCommandResult run command result. +type RunCommandResult struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The command id. + ID *string `json:"id,omitempty"` + // CommandResultProperties - Properties of command result. + *CommandResultProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RunCommandResult. +func (rcr RunCommandResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rcr.CommandResultProperties != nil { + objectMap["properties"] = rcr.CommandResultProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RunCommandResult struct. +func (rcr *RunCommandResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rcr.ID = &ID + } + case "properties": + if v != nil { + var commandResultProperties CommandResultProperties + err = json.Unmarshal(*v, &commandResultProperties) + if err != nil { + return err + } + rcr.CommandResultProperties = &commandResultProperties + } + } + } + + return nil +} + +// Snapshot a node pool snapshot resource. +type Snapshot struct { + autorest.Response `json:"-"` + // SnapshotProperties - Properties of a snapshot. + *SnapshotProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Snapshot. +func (s Snapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SnapshotProperties != nil { + objectMap["properties"] = s.SnapshotProperties + } + if s.Tags != nil { + objectMap["tags"] = s.Tags + } + if s.Location != nil { + objectMap["location"] = s.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Snapshot struct. +func (s *Snapshot) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var snapshotProperties SnapshotProperties + err = json.Unmarshal(*v, &snapshotProperties) + if err != nil { + return err + } + s.SnapshotProperties = &snapshotProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + s.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + s.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + s.SystemData = &systemData + } + } + } + + return nil +} + +// SnapshotListResult the response from the List Snapshots operation. +type SnapshotListResult struct { + autorest.Response `json:"-"` + // Value - The list of snapshots. + Value *[]Snapshot `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of snapshot results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotListResult. +func (slr SnapshotListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if slr.Value != nil { + objectMap["value"] = slr.Value + } + return json.Marshal(objectMap) +} + +// SnapshotListResultIterator provides access to a complete listing of Snapshot values. +type SnapshotListResultIterator struct { + i int + page SnapshotListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SnapshotListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SnapshotListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SnapshotListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SnapshotListResultIterator) Response() SnapshotListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SnapshotListResultIterator) Value() Snapshot { + if !iter.page.NotDone() { + return Snapshot{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SnapshotListResultIterator type. +func NewSnapshotListResultIterator(page SnapshotListResultPage) SnapshotListResultIterator { + return SnapshotListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (slr SnapshotListResult) IsEmpty() bool { + return slr.Value == nil || len(*slr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (slr SnapshotListResult) hasNextLink() bool { + return slr.NextLink != nil && len(*slr.NextLink) != 0 +} + +// snapshotListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (slr SnapshotListResult) snapshotListResultPreparer(ctx context.Context) (*http.Request, error) { + if !slr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(slr.NextLink))) +} + +// SnapshotListResultPage contains a page of Snapshot values. +type SnapshotListResultPage struct { + fn func(context.Context, SnapshotListResult) (SnapshotListResult, error) + slr SnapshotListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SnapshotListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.slr) + if err != nil { + return err + } + page.slr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SnapshotListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SnapshotListResultPage) NotDone() bool { + return !page.slr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SnapshotListResultPage) Response() SnapshotListResult { + return page.slr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SnapshotListResultPage) Values() []Snapshot { + if page.slr.IsEmpty() { + return nil + } + return *page.slr.Value +} + +// Creates a new instance of the SnapshotListResultPage type. +func NewSnapshotListResultPage(cur SnapshotListResult, getNextPage func(context.Context, SnapshotListResult) (SnapshotListResult, error)) SnapshotListResultPage { + return SnapshotListResultPage{ + fn: getNextPage, + slr: cur, + } +} + +// SnapshotProperties properties used to configure a node pool snapshot. +type SnapshotProperties struct { + // CreationData - CreationData to be used to specify the source agent pool resource ID to create this snapshot. + CreationData *CreationData `json:"creationData,omitempty"` + // SnapshotType - Possible values include: 'SnapshotTypeNodePool', 'SnapshotTypeManagedCluster' + SnapshotType SnapshotType `json:"snapshotType,omitempty"` + // KubernetesVersion - READ-ONLY; The version of Kubernetes. + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // NodeImageVersion - READ-ONLY; The version of node image. + NodeImageVersion *string `json:"nodeImageVersion,omitempty"` + // OsType - READ-ONLY; Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // OsSku - READ-ONLY; Possible values include: 'OSSKUUbuntu', 'OSSKUCBLMariner' + OsSku OSSKU `json:"osSku,omitempty"` + // VMSize - READ-ONLY; The size of the VM. + VMSize *string `json:"vmSize,omitempty"` + // EnableFIPS - READ-ONLY; Whether to use a FIPS-enabled OS. + EnableFIPS *bool `json:"enableFIPS,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotProperties. +func (sp SnapshotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.CreationData != nil { + objectMap["creationData"] = sp.CreationData + } + if sp.SnapshotType != "" { + objectMap["snapshotType"] = sp.SnapshotType + } + return json.Marshal(objectMap) +} + +// SSHConfiguration SSH configuration for Linux-based VMs running on Azure. +type SSHConfiguration struct { + // PublicKeys - The list of SSH public keys used to authenticate with Linux-based VMs. A maximum of 1 key may be specified. + PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` +} + +// SSHPublicKey contains information about SSH certificate public key data. +type SSHPublicKey struct { + // KeyData - Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. + KeyData *string `json:"keyData,omitempty"` +} + +// SubResource reference to another subresource. +type SubResource struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubResource. +func (sr SubResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SysctlConfig sysctl settings for Linux agent nodes. +type SysctlConfig struct { + // NetCoreSomaxconn - Sysctl setting net.core.somaxconn. + NetCoreSomaxconn *int32 `json:"netCoreSomaxconn,omitempty"` + // NetCoreNetdevMaxBacklog - Sysctl setting net.core.netdev_max_backlog. + NetCoreNetdevMaxBacklog *int32 `json:"netCoreNetdevMaxBacklog,omitempty"` + // NetCoreRmemDefault - Sysctl setting net.core.rmem_default. + NetCoreRmemDefault *int32 `json:"netCoreRmemDefault,omitempty"` + // NetCoreRmemMax - Sysctl setting net.core.rmem_max. + NetCoreRmemMax *int32 `json:"netCoreRmemMax,omitempty"` + // NetCoreWmemDefault - Sysctl setting net.core.wmem_default. + NetCoreWmemDefault *int32 `json:"netCoreWmemDefault,omitempty"` + // NetCoreWmemMax - Sysctl setting net.core.wmem_max. + NetCoreWmemMax *int32 `json:"netCoreWmemMax,omitempty"` + // NetCoreOptmemMax - Sysctl setting net.core.optmem_max. + NetCoreOptmemMax *int32 `json:"netCoreOptmemMax,omitempty"` + // NetIpv4TCPMaxSynBacklog - Sysctl setting net.ipv4.tcp_max_syn_backlog. + NetIpv4TCPMaxSynBacklog *int32 `json:"netIpv4TcpMaxSynBacklog,omitempty"` + // NetIpv4TCPMaxTwBuckets - Sysctl setting net.ipv4.tcp_max_tw_buckets. + NetIpv4TCPMaxTwBuckets *int32 `json:"netIpv4TcpMaxTwBuckets,omitempty"` + // NetIpv4TCPFinTimeout - Sysctl setting net.ipv4.tcp_fin_timeout. + NetIpv4TCPFinTimeout *int32 `json:"netIpv4TcpFinTimeout,omitempty"` + // NetIpv4TCPKeepaliveTime - Sysctl setting net.ipv4.tcp_keepalive_time. + NetIpv4TCPKeepaliveTime *int32 `json:"netIpv4TcpKeepaliveTime,omitempty"` + // NetIpv4TCPKeepaliveProbes - Sysctl setting net.ipv4.tcp_keepalive_probes. + NetIpv4TCPKeepaliveProbes *int32 `json:"netIpv4TcpKeepaliveProbes,omitempty"` + // NetIpv4TcpkeepaliveIntvl - Sysctl setting net.ipv4.tcp_keepalive_intvl. + NetIpv4TcpkeepaliveIntvl *int32 `json:"netIpv4TcpkeepaliveIntvl,omitempty"` + // NetIpv4TCPTwReuse - Sysctl setting net.ipv4.tcp_tw_reuse. + NetIpv4TCPTwReuse *bool `json:"netIpv4TcpTwReuse,omitempty"` + // NetIpv4IPLocalPortRange - Sysctl setting net.ipv4.ip_local_port_range. + NetIpv4IPLocalPortRange *string `json:"netIpv4IpLocalPortRange,omitempty"` + // NetIpv4NeighDefaultGcThresh1 - Sysctl setting net.ipv4.neigh.default.gc_thresh1. + NetIpv4NeighDefaultGcThresh1 *int32 `json:"netIpv4NeighDefaultGcThresh1,omitempty"` + // NetIpv4NeighDefaultGcThresh2 - Sysctl setting net.ipv4.neigh.default.gc_thresh2. + NetIpv4NeighDefaultGcThresh2 *int32 `json:"netIpv4NeighDefaultGcThresh2,omitempty"` + // NetIpv4NeighDefaultGcThresh3 - Sysctl setting net.ipv4.neigh.default.gc_thresh3. + NetIpv4NeighDefaultGcThresh3 *int32 `json:"netIpv4NeighDefaultGcThresh3,omitempty"` + // NetNetfilterNfConntrackMax - Sysctl setting net.netfilter.nf_conntrack_max. + NetNetfilterNfConntrackMax *int32 `json:"netNetfilterNfConntrackMax,omitempty"` + // NetNetfilterNfConntrackBuckets - Sysctl setting net.netfilter.nf_conntrack_buckets. + NetNetfilterNfConntrackBuckets *int32 `json:"netNetfilterNfConntrackBuckets,omitempty"` + // FsInotifyMaxUserWatches - Sysctl setting fs.inotify.max_user_watches. + FsInotifyMaxUserWatches *int32 `json:"fsInotifyMaxUserWatches,omitempty"` + // FsFileMax - Sysctl setting fs.file-max. + FsFileMax *int32 `json:"fsFileMax,omitempty"` + // FsAioMaxNr - Sysctl setting fs.aio-max-nr. + FsAioMaxNr *int32 `json:"fsAioMaxNr,omitempty"` + // FsNrOpen - Sysctl setting fs.nr_open. + FsNrOpen *int32 `json:"fsNrOpen,omitempty"` + // KernelThreadsMax - Sysctl setting kernel.threads-max. + KernelThreadsMax *int32 `json:"kernelThreadsMax,omitempty"` + // VMMaxMapCount - Sysctl setting vm.max_map_count. + VMMaxMapCount *int32 `json:"vmMaxMapCount,omitempty"` + // VMSwappiness - Sysctl setting vm.swappiness. + VMSwappiness *int32 `json:"vmSwappiness,omitempty"` + // VMVfsCachePressure - Sysctl setting vm.vfs_cache_pressure. + VMVfsCachePressure *int32 `json:"vmVfsCachePressure,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TagsObject tags object for patch operations. +type TagsObject struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TagsObject. +func (toVar TagsObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if toVar.Tags != nil { + objectMap["tags"] = toVar.Tags + } + return json.Marshal(objectMap) +} + +// TimeInWeek time in a week. +type TimeInWeek struct { + // Day - The day of the week. Possible values include: 'WeekDaySunday', 'WeekDayMonday', 'WeekDayTuesday', 'WeekDayWednesday', 'WeekDayThursday', 'WeekDayFriday', 'WeekDaySaturday' + Day WeekDay `json:"day,omitempty"` + // HourSlots - Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. + HourSlots *[]int32 `json:"hourSlots,omitempty"` +} + +// TimeSpan for example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. +type TimeSpan struct { + // Start - The start of a time span + Start *date.Time `json:"start,omitempty"` + // End - The end of a time span + End *date.Time `json:"end,omitempty"` +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// UserAssignedIdentity details about a user assigned identity. +type UserAssignedIdentity struct { + // ResourceID - The resource ID of the user assigned identity. + ResourceID *string `json:"resourceId,omitempty"` + // ClientID - The client ID of the user assigned identity. + ClientID *string `json:"clientId,omitempty"` + // ObjectID - The object ID of the user assigned identity. + ObjectID *string `json:"objectId,omitempty"` +} + +// VMDiagnostics profile for diagnostics on the container service VMs. +type VMDiagnostics struct { + // Enabled - Whether the VM diagnostic agent is provisioned on the VM. + Enabled *bool `json:"enabled,omitempty"` + // StorageURI - READ-ONLY; The URI of the storage account where diagnostics are stored. + StorageURI *string `json:"storageUri,omitempty"` +} + +// MarshalJSON is the custom marshaler for VMDiagnostics. +func (vd VMDiagnostics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vd.Enabled != nil { + objectMap["enabled"] = vd.Enabled + } + return json.Marshal(objectMap) +} + +// WindowsGmsaProfile windows gMSA Profile in the managed cluster. +type WindowsGmsaProfile struct { + // Enabled - Specifies whether to enable Windows gMSA in the managed cluster. + Enabled *bool `json:"enabled,omitempty"` + // DNSServer - Specifies the DNS server for Windows gMSA.

Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. + DNSServer *string `json:"dnsServer,omitempty"` + // RootDomainName - Specifies the root domain name for Windows gMSA.

Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. + RootDomainName *string `json:"rootDomainName,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/operations.go new file mode 100644 index 00000000000..d3fceb6d4aa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/operations.go @@ -0,0 +1,98 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the the Container Service Client. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List sends the list request. +func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.OperationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ContainerService/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/privateendpointconnections.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/privateendpointconnections.go new file mode 100644 index 00000000000..316d11958ea --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/privateendpointconnections.go @@ -0,0 +1,406 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateEndpointConnectionsClient is the the Container Service Client. +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get to learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List to learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateEndpointConnectionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// privateEndpointConnectionName - the name of the private endpoint connection. +// parameters - the updated private endpoint connection. +func (client PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PrivateEndpointConnectionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) UpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/privatelinkresources.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/privatelinkresources.go new file mode 100644 index 00000000000..0b898090ea6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/privatelinkresources.go @@ -0,0 +1,122 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateLinkResourcesClient is the the Container Service Client. +type PrivateLinkResourcesClient struct { + BaseClient +} + +// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List to learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateLinkResourcesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateLinkResourcesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.PrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResourcesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/resolveprivatelinkserviceid.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/resolveprivatelinkserviceid.go similarity index 92% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/resolveprivatelinkserviceid.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/resolveprivatelinkserviceid.go index c191c1253a8..f4472650fce 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/resolveprivatelinkserviceid.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/resolveprivatelinkserviceid.go @@ -34,7 +34,7 @@ func NewResolvePrivateLinkServiceIDClientWithBaseURI(baseURI string, subscriptio // POST sends the post request. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the managed cluster resource. // parameters - parameters required in order to resolve a private link service ID. func (client ResolvePrivateLinkServiceIDClient) POST(ctx context.Context, resourceGroupName string, resourceName string, parameters PrivateLinkResource) (result PrivateLinkResource, err error) { @@ -49,8 +49,11 @@ func (client ResolvePrivateLinkServiceIDClient) POST(ctx context.Context, resour }() } if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceName, Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, @@ -88,7 +91,7 @@ func (client ResolvePrivateLinkServiceIDClient) POSTPreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2022-01-02-preview" + const APIVersion = "2022-03-02-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/snapshots.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/snapshots.go new file mode 100644 index 00000000000..eebb40b76ed --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/snapshots.go @@ -0,0 +1,637 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SnapshotsClient is the the Container Service Client. +type SnapshotsClient struct { + BaseClient +} + +// NewSnapshotsClient creates an instance of the SnapshotsClient client. +func NewSnapshotsClient(subscriptionID string) SnapshotsClient { + return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient { + return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - the snapshot to create or update. +func (client SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters Snapshot) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SnapshotsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters Snapshot) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client SnapshotsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client SnapshotsClient) List(ctx context.Context) (result SnapshotListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") + defer func() { + sc := -1 + if result.slr.Response.Response != nil { + sc = result.slr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "List", resp, "Failure sending request") + return + } + + result.slr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "List", resp, "Failure responding to request") + return + } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SnapshotsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SnapshotsClient) listNextResults(ctx context.Context, lastResults SnapshotListResult) (result SnapshotListResult, err error) { + req, err := lastResults.snapshotListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SnapshotsClient) ListComplete(ctx context.Context) (result SnapshotListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup sends the list by resource group request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client SnapshotsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SnapshotListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.slr.Response.Response != nil { + sc = result.slr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.slr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client SnapshotsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) ListByResourceGroupResponder(resp *http.Response) (result SnapshotListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client SnapshotsClient) listByResourceGroupNextResults(ctx context.Context, lastResults SnapshotListResult) (result SnapshotListResult, err error) { + req, err := lastResults.snapshotListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SnapshotListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags sends the update tags request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - parameters supplied to the Update snapshot Tags operation. +func (client SnapshotsClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "UpdateTags", err.Error()) + } + + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client SnapshotsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) UpdateTagsResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/version.go new file mode 100644 index 00000000000..23c92ba7393 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/version.go @@ -0,0 +1,19 @@ +package containerservice + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " containerservice/2022-03-02-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/_meta.json deleted file mode 100644 index d077a1a195d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "2b56c8a3da0e04aea6f6d80a9ac04741d1ae5904", - "readme": "/_/azure-rest-api-specs/specification/desktopvirtualization/resource-manager/readme.md", - "tag": "package-preview-2021-09", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2021-09 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/desktopvirtualization/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/applicationgroups.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/applicationgroups.go deleted file mode 100644 index 730dac683d8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/applicationgroups.go +++ /dev/null @@ -1,649 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ApplicationGroupsClient is the client for the ApplicationGroups methods of the Desktopvirtualization service. -type ApplicationGroupsClient struct { - BaseClient -} - -// NewApplicationGroupsClient creates an instance of the ApplicationGroupsClient client. -func NewApplicationGroupsClient(subscriptionID string) ApplicationGroupsClient { - return NewApplicationGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationGroupsClientWithBaseURI creates an instance of the ApplicationGroupsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewApplicationGroupsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationGroupsClient { - return ApplicationGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an applicationGroup. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -// applicationGroup - object containing ApplicationGroup definitions. -func (client ApplicationGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationGroup ApplicationGroup) (result ApplicationGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: applicationGroup, - Constraints: []validation.Constraint{{Target: "applicationGroup.ApplicationGroupProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "applicationGroup.ApplicationGroupProperties.HostPoolArmPath", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationGroupsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationGroupName, applicationGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ApplicationGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationGroup ApplicationGroup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", pathParameters), - autorest.WithJSON(applicationGroup), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ApplicationGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove an applicationGroup. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -func (client ApplicationGroupsClient) Delete(ctx context.Context, resourceGroupName string, applicationGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationGroupsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, applicationGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an application group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -func (client ApplicationGroupsClient) Get(ctx context.Context, resourceGroupName string, applicationGroupName string) (result ApplicationGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationGroupsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, applicationGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGroupsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationGroupsClient) GetResponder(resp *http.Response) (result ApplicationGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list applicationGroups. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// filter - oData filter expression. Valid properties for filtering are applicationGroupType. -func (client ApplicationGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result ApplicationGroupListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.agl.Response.Response != nil { - sc = result.agl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationGroupsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.agl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.agl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.agl.hasNextLink() && result.agl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ApplicationGroupsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGroupsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ApplicationGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationGroupList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ApplicationGroupsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ApplicationGroupList) (result ApplicationGroupList, err error) { - req, err := lastResults.applicationGroupListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationGroupsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string) (result ApplicationGroupListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, filter) - return -} - -// ListBySubscription list applicationGroups in subscription. -// Parameters: -// filter - oData filter expression. Valid properties for filtering are applicationGroupType. -func (client ApplicationGroupsClient) ListBySubscription(ctx context.Context, filter string) (result ApplicationGroupListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.ListBySubscription") - defer func() { - sc := -1 - if result.agl.Response.Response != nil { - sc = result.agl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationGroupsClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.agl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.agl, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.agl.hasNextLink() && result.agl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ApplicationGroupsClient) ListBySubscriptionPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGroupsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client ApplicationGroupsClient) ListBySubscriptionResponder(resp *http.Response) (result ApplicationGroupList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client ApplicationGroupsClient) listBySubscriptionNextResults(ctx context.Context, lastResults ApplicationGroupList) (result ApplicationGroupList, err error) { - req, err := lastResults.applicationGroupListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationGroupsClient) ListBySubscriptionComplete(ctx context.Context, filter string) (result ApplicationGroupListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx, filter) - return -} - -// Update update an applicationGroup. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -// applicationGroup - object containing ApplicationGroup definitions. -func (client ApplicationGroupsClient) Update(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationGroup *ApplicationGroupPatch) (result ApplicationGroup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationGroupsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, applicationGroupName, applicationGroup) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationGroupsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ApplicationGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationGroup *ApplicationGroupPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if applicationGroup != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(applicationGroup)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationGroupsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ApplicationGroupsClient) UpdateResponder(resp *http.Response) (result ApplicationGroup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/applications.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/applications.go deleted file mode 100644 index 7ea340d6a44..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/applications.go +++ /dev/null @@ -1,544 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ApplicationsClient is the client for the Applications methods of the Desktopvirtualization service. -type ApplicationsClient struct { - BaseClient -} - -// NewApplicationsClient creates an instance of the ApplicationsClient client. -func NewApplicationsClient(subscriptionID string) ApplicationsClient { - return NewApplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewApplicationsClientWithBaseURI creates an instance of the ApplicationsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewApplicationsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationsClient { - return ApplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update an application. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -// applicationName - the name of the application within the specified application group -// application - object containing Application definitions. -func (client ApplicationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string, application Application) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: application, - Constraints: []validation.Constraint{{Target: "application.ApplicationProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationGroupName, applicationName, application) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ApplicationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string, application Application) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", pathParameters), - autorest.WithJSON(application), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) CreateOrUpdateResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove an application. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -// applicationName - the name of the application within the specified application group -func (client ApplicationsClient) Delete(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, applicationGroupName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ApplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an application. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -// applicationName - the name of the application within the specified application group -func (client ApplicationsClient) Get(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, applicationGroupName, applicationName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ApplicationsClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) GetResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list applications. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -func (client ApplicationsClient) List(ctx context.Context, resourceGroupName string, applicationGroupName string) (result ApplicationListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.List") - defer func() { - sc := -1 - if result.al.Response.Response != nil { - sc = result.al.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, applicationGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.al.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "List", resp, "Failure sending request") - return - } - - result.al, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "List", resp, "Failure responding to request") - return - } - if result.al.hasNextLink() && result.al.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ApplicationsClient) ListPreparer(ctx context.Context, resourceGroupName string, applicationGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) ListResponder(resp *http.Response) (result ApplicationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ApplicationsClient) listNextResults(ctx context.Context, lastResults ApplicationList) (result ApplicationList, err error) { - req, err := lastResults.applicationListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ApplicationsClient) ListComplete(ctx context.Context, resourceGroupName string, applicationGroupName string) (result ApplicationListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, applicationGroupName) - return -} - -// Update update an application. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -// applicationName - the name of the application within the specified application group -// application - object containing Application definitions. -func (client ApplicationsClient) Update(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string, application *ApplicationPatch) (result Application, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: applicationName, - Constraints: []validation.Constraint{{Target: "applicationName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "applicationName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ApplicationsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, applicationGroupName, applicationName, application) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ApplicationsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ApplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, applicationName string, application *ApplicationPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "applicationName": autorest.Encode("path", applicationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if application != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(application)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ApplicationsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ApplicationsClient) UpdateResponder(resp *http.Response) (result Application, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/client.go deleted file mode 100644 index 5965600296a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package desktopvirtualization implements the Azure ARM Desktopvirtualization service API version 2021-09-03-preview. -// -// -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Desktopvirtualization - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Desktopvirtualization. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/desktops.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/desktops.go deleted file mode 100644 index c07bd2fefc7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/desktops.go +++ /dev/null @@ -1,354 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DesktopsClient is the client for the Desktops methods of the Desktopvirtualization service. -type DesktopsClient struct { - BaseClient -} - -// NewDesktopsClient creates an instance of the DesktopsClient client. -func NewDesktopsClient(subscriptionID string) DesktopsClient { - return NewDesktopsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDesktopsClientWithBaseURI creates an instance of the DesktopsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDesktopsClientWithBaseURI(baseURI string, subscriptionID string) DesktopsClient { - return DesktopsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get a desktop. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -// desktopName - the name of the desktop within the specified desktop group -func (client DesktopsClient) Get(ctx context.Context, resourceGroupName string, applicationGroupName string, desktopName string) (result Desktop, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DesktopsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: desktopName, - Constraints: []validation.Constraint{{Target: "desktopName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "desktopName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.DesktopsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, applicationGroupName, desktopName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DesktopsClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, desktopName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "desktopName": autorest.Encode("path", desktopName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DesktopsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DesktopsClient) GetResponder(resp *http.Response) (result Desktop, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list desktops. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -func (client DesktopsClient) List(ctx context.Context, resourceGroupName string, applicationGroupName string) (result DesktopListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DesktopsClient.List") - defer func() { - sc := -1 - if result.dl.Response.Response != nil { - sc = result.dl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.DesktopsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, applicationGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.dl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "List", resp, "Failure sending request") - return - } - - result.dl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "List", resp, "Failure responding to request") - return - } - if result.dl.hasNextLink() && result.dl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DesktopsClient) ListPreparer(ctx context.Context, resourceGroupName string, applicationGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DesktopsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DesktopsClient) ListResponder(resp *http.Response) (result DesktopList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client DesktopsClient) listNextResults(ctx context.Context, lastResults DesktopList) (result DesktopList, err error) { - req, err := lastResults.desktopListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client DesktopsClient) ListComplete(ctx context.Context, resourceGroupName string, applicationGroupName string) (result DesktopListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DesktopsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, applicationGroupName) - return -} - -// Update update a desktop. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -// desktopName - the name of the desktop within the specified desktop group -// desktop - object containing Desktop definitions. -func (client DesktopsClient) Update(ctx context.Context, resourceGroupName string, applicationGroupName string, desktopName string, desktop *DesktopPatch) (result Desktop, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DesktopsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: desktopName, - Constraints: []validation.Constraint{{Target: "desktopName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "desktopName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.DesktopsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, applicationGroupName, desktopName, desktop) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.DesktopsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DesktopsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, applicationGroupName string, desktopName string, desktop *DesktopPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "desktopName": autorest.Encode("path", desktopName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if desktop != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(desktop)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DesktopsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client DesktopsClient) UpdateResponder(resp *http.Response) (result Desktop, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/enums.go deleted file mode 100644 index ffb1d735875..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/enums.go +++ /dev/null @@ -1,509 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ApplicationGroupType enumerates the values for application group type. -type ApplicationGroupType string - -const ( - // ApplicationGroupTypeDesktop ... - ApplicationGroupTypeDesktop ApplicationGroupType = "Desktop" - // ApplicationGroupTypeRemoteApp ... - ApplicationGroupTypeRemoteApp ApplicationGroupType = "RemoteApp" -) - -// PossibleApplicationGroupTypeValues returns an array of possible values for the ApplicationGroupType const type. -func PossibleApplicationGroupTypeValues() []ApplicationGroupType { - return []ApplicationGroupType{ApplicationGroupTypeDesktop, ApplicationGroupTypeRemoteApp} -} - -// ApplicationType enumerates the values for application type. -type ApplicationType string - -const ( - // ApplicationTypeDesktop ... - ApplicationTypeDesktop ApplicationType = "Desktop" - // ApplicationTypeRemoteApp ... - ApplicationTypeRemoteApp ApplicationType = "RemoteApp" -) - -// PossibleApplicationTypeValues returns an array of possible values for the ApplicationType const type. -func PossibleApplicationTypeValues() []ApplicationType { - return []ApplicationType{ApplicationTypeDesktop, ApplicationTypeRemoteApp} -} - -// CommandLineSetting enumerates the values for command line setting. -type CommandLineSetting string - -const ( - // CommandLineSettingAllow ... - CommandLineSettingAllow CommandLineSetting = "Allow" - // CommandLineSettingDoNotAllow ... - CommandLineSettingDoNotAllow CommandLineSetting = "DoNotAllow" - // CommandLineSettingRequire ... - CommandLineSettingRequire CommandLineSetting = "Require" -) - -// PossibleCommandLineSettingValues returns an array of possible values for the CommandLineSetting const type. -func PossibleCommandLineSettingValues() []CommandLineSetting { - return []CommandLineSetting{CommandLineSettingAllow, CommandLineSettingDoNotAllow, CommandLineSettingRequire} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// HealthCheckName enumerates the values for health check name. -type HealthCheckName string - -const ( - // HealthCheckNameAppAttachHealthCheck Verifies that the AppAttachService is healthy (there were no issues - // during package staging). The AppAttachService is used to enable the staging/registration (and eventual - // deregistration/destaging) of MSIX apps that have been set up by the tenant admin. This checks whether - // the component had any failures during package staging. Failures in staging will prevent some MSIX apps - // from working properly for the end user. If this check fails, it is non fatal and the machine still can - // service connections, main issue may be certain apps will not work for end-users. - HealthCheckNameAppAttachHealthCheck HealthCheckName = "AppAttachHealthCheck" - // HealthCheckNameDomainJoinedCheck Verifies the SessionHost is joined to a domain. If this check fails is - // classified as fatal as no connection can succeed if the SessionHost is not joined to the domain. - HealthCheckNameDomainJoinedCheck HealthCheckName = "DomainJoinedCheck" - // HealthCheckNameDomainReachable Verifies the domain the SessionHost is joined to is still reachable. If - // this check fails is classified as fatal as no connection can succeed if the domain the SessionHost is - // joined is not reachable at the time of connection. - HealthCheckNameDomainReachable HealthCheckName = "DomainReachable" - // HealthCheckNameDomainTrustCheck Verifies the SessionHost is not experiencing domain trust issues that - // will prevent authentication on SessionHost at connection time when session is created. If this check - // fails is classified as fatal as no connection can succeed if we cannot reach the domain for - // authentication on the SessionHost. - HealthCheckNameDomainTrustCheck HealthCheckName = "DomainTrustCheck" - // HealthCheckNameFSLogixHealthCheck Verifies the FSLogix service is up and running to make sure users' - // profiles are loaded in the session. If this check fails is classified as fatal as even if the connection - // can succeed, user experience is bad as the user profile cannot be loaded and user will get a temporary - // profile in the session. - HealthCheckNameFSLogixHealthCheck HealthCheckName = "FSLogixHealthCheck" - // HealthCheckNameMetaDataServiceCheck Verifies the metadata service is accessible and return compute - // properties. - HealthCheckNameMetaDataServiceCheck HealthCheckName = "MetaDataServiceCheck" - // HealthCheckNameMonitoringAgentCheck Verifies that the required Geneva agent is running. If this check - // fails, it is non fatal and the machine still can service connections, main issue may be that monitoring - // agent is missing or running (possibly) older version. - HealthCheckNameMonitoringAgentCheck HealthCheckName = "MonitoringAgentCheck" - // HealthCheckNameSupportedEncryptionCheck Verifies the value of SecurityLayer registration key. If the - // value is 0 (SecurityLayer.RDP) this check fails with Error code = NativeMethodErrorCode.E_FAIL and is - // fatal. If the value is 1 (SecurityLayer.Negotiate) this check fails with Error code = - // NativeMethodErrorCode.ERROR_SUCCESS and is non fatal. - HealthCheckNameSupportedEncryptionCheck HealthCheckName = "SupportedEncryptionCheck" - // HealthCheckNameSxSStackListenerCheck Verifies that the SxS stack is up and running so connections can - // succeed. If this check fails is classified as fatal as no connection can succeed if the SxS stack is not - // ready. - HealthCheckNameSxSStackListenerCheck HealthCheckName = "SxSStackListenerCheck" - // HealthCheckNameUrlsAccessibleCheck Verifies that the required WVD service and Geneva URLs are reachable - // from the SessionHost. These URLs are: RdTokenUri, RdBrokerURI, RdDiagnosticsUri and storage blob URLs - // for agent monitoring (geneva). If this check fails, it is non fatal and the machine still can service - // connections, main issue may be that monitoring agent is unable to store warm path data (logs, operations - // ...). - HealthCheckNameUrlsAccessibleCheck HealthCheckName = "UrlsAccessibleCheck" - // HealthCheckNameWebRTCRedirectorCheck Verifies whether the WebRTCRedirector component is healthy. The - // WebRTCRedirector component is used to optimize video and audio performance in Microsoft Teams. This - // checks whether the component is still running, and whether there is a higher version available. If this - // check fails, it is non fatal and the machine still can service connections, main issue may be the - // WebRTCRedirector component has to be restarted or updated. - HealthCheckNameWebRTCRedirectorCheck HealthCheckName = "WebRTCRedirectorCheck" -) - -// PossibleHealthCheckNameValues returns an array of possible values for the HealthCheckName const type. -func PossibleHealthCheckNameValues() []HealthCheckName { - return []HealthCheckName{HealthCheckNameAppAttachHealthCheck, HealthCheckNameDomainJoinedCheck, HealthCheckNameDomainReachable, HealthCheckNameDomainTrustCheck, HealthCheckNameFSLogixHealthCheck, HealthCheckNameMetaDataServiceCheck, HealthCheckNameMonitoringAgentCheck, HealthCheckNameSupportedEncryptionCheck, HealthCheckNameSxSStackListenerCheck, HealthCheckNameUrlsAccessibleCheck, HealthCheckNameWebRTCRedirectorCheck} -} - -// HealthCheckResult enumerates the values for health check result. -type HealthCheckResult string - -const ( - // HealthCheckResultHealthCheckFailed Health check failed. - HealthCheckResultHealthCheckFailed HealthCheckResult = "HealthCheckFailed" - // HealthCheckResultHealthCheckSucceeded Health check passed. - HealthCheckResultHealthCheckSucceeded HealthCheckResult = "HealthCheckSucceeded" - // HealthCheckResultSessionHostShutdown We received a Shutdown notification. - HealthCheckResultSessionHostShutdown HealthCheckResult = "SessionHostShutdown" - // HealthCheckResultUnknown Health check result is not currently known. - HealthCheckResultUnknown HealthCheckResult = "Unknown" -) - -// PossibleHealthCheckResultValues returns an array of possible values for the HealthCheckResult const type. -func PossibleHealthCheckResultValues() []HealthCheckResult { - return []HealthCheckResult{HealthCheckResultHealthCheckFailed, HealthCheckResultHealthCheckSucceeded, HealthCheckResultSessionHostShutdown, HealthCheckResultUnknown} -} - -// HostPoolType enumerates the values for host pool type. -type HostPoolType string - -const ( - // HostPoolTypeBYODesktop Users assign their own machines, load balancing logic remains the same as - // Personal. PersonalDesktopAssignmentType must be Direct. - HostPoolTypeBYODesktop HostPoolType = "BYODesktop" - // HostPoolTypePersonal Users will be assigned a SessionHost either by administrators - // (PersonalDesktopAssignmentType = Direct) or upon connecting to the pool (PersonalDesktopAssignmentType = - // Automatic). They will always be redirected to their assigned SessionHost. - HostPoolTypePersonal HostPoolType = "Personal" - // HostPoolTypePooled Users get a new (random) SessionHost every time it connects to the HostPool. - HostPoolTypePooled HostPoolType = "Pooled" -) - -// PossibleHostPoolTypeValues returns an array of possible values for the HostPoolType const type. -func PossibleHostPoolTypeValues() []HostPoolType { - return []HostPoolType{HostPoolTypeBYODesktop, HostPoolTypePersonal, HostPoolTypePooled} -} - -// LoadBalancerType enumerates the values for load balancer type. -type LoadBalancerType string - -const ( - // LoadBalancerTypeBreadthFirst ... - LoadBalancerTypeBreadthFirst LoadBalancerType = "BreadthFirst" - // LoadBalancerTypeDepthFirst ... - LoadBalancerTypeDepthFirst LoadBalancerType = "DepthFirst" - // LoadBalancerTypePersistent ... - LoadBalancerTypePersistent LoadBalancerType = "Persistent" -) - -// PossibleLoadBalancerTypeValues returns an array of possible values for the LoadBalancerType const type. -func PossibleLoadBalancerTypeValues() []LoadBalancerType { - return []LoadBalancerType{LoadBalancerTypeBreadthFirst, LoadBalancerTypeDepthFirst, LoadBalancerTypePersistent} -} - -// Operation enumerates the values for operation. -type Operation string - -const ( - // OperationComplete Complete the migration. - OperationComplete Operation = "Complete" - // OperationHide Hide the hostpool. - OperationHide Operation = "Hide" - // OperationRevoke Revoke the migration. - OperationRevoke Operation = "Revoke" - // OperationStart Start the migration. - OperationStart Operation = "Start" - // OperationUnhide Unhide the hostpool. - OperationUnhide Operation = "Unhide" -) - -// PossibleOperationValues returns an array of possible values for the Operation const type. -func PossibleOperationValues() []Operation { - return []Operation{OperationComplete, OperationHide, OperationRevoke, OperationStart, OperationUnhide} -} - -// PersonalDesktopAssignmentType enumerates the values for personal desktop assignment type. -type PersonalDesktopAssignmentType string - -const ( - // PersonalDesktopAssignmentTypeAutomatic ... - PersonalDesktopAssignmentTypeAutomatic PersonalDesktopAssignmentType = "Automatic" - // PersonalDesktopAssignmentTypeDirect ... - PersonalDesktopAssignmentTypeDirect PersonalDesktopAssignmentType = "Direct" -) - -// PossiblePersonalDesktopAssignmentTypeValues returns an array of possible values for the PersonalDesktopAssignmentType const type. -func PossiblePersonalDesktopAssignmentTypeValues() []PersonalDesktopAssignmentType { - return []PersonalDesktopAssignmentType{PersonalDesktopAssignmentTypeAutomatic, PersonalDesktopAssignmentTypeDirect} -} - -// PreferredAppGroupType enumerates the values for preferred app group type. -type PreferredAppGroupType string - -const ( - // PreferredAppGroupTypeDesktop ... - PreferredAppGroupTypeDesktop PreferredAppGroupType = "Desktop" - // PreferredAppGroupTypeNone ... - PreferredAppGroupTypeNone PreferredAppGroupType = "None" - // PreferredAppGroupTypeRailApplications ... - PreferredAppGroupTypeRailApplications PreferredAppGroupType = "RailApplications" -) - -// PossiblePreferredAppGroupTypeValues returns an array of possible values for the PreferredAppGroupType const type. -func PossiblePreferredAppGroupTypeValues() []PreferredAppGroupType { - return []PreferredAppGroupType{PreferredAppGroupTypeDesktop, PreferredAppGroupTypeNone, PreferredAppGroupTypeRailApplications} -} - -// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection -// provisioning state. -type PrivateEndpointConnectionProvisioningState string - -const ( - // PrivateEndpointConnectionProvisioningStateCreating ... - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - // PrivateEndpointConnectionProvisioningStateDeleting ... - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - // PrivateEndpointConnectionProvisioningStateFailed ... - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - // PrivateEndpointConnectionProvisioningStateSucceeded ... - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" -) - -// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. -func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { - return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded} -} - -// PrivateEndpointServiceConnectionStatus enumerates the values for private endpoint service connection status. -type PrivateEndpointServiceConnectionStatus string - -const ( - // PrivateEndpointServiceConnectionStatusApproved ... - PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - // PrivateEndpointServiceConnectionStatusPending ... - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" - // PrivateEndpointServiceConnectionStatusRejected ... - PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" -) - -// PossiblePrivateEndpointServiceConnectionStatusValues returns an array of possible values for the PrivateEndpointServiceConnectionStatus const type. -func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { - return []PrivateEndpointServiceConnectionStatus{PrivateEndpointServiceConnectionStatusApproved, PrivateEndpointServiceConnectionStatusPending, PrivateEndpointServiceConnectionStatusRejected} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // PublicNetworkAccessDisabled ... - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - // PublicNetworkAccessEnabled ... - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} -} - -// RegistrationTokenOperation enumerates the values for registration token operation. -type RegistrationTokenOperation string - -const ( - // RegistrationTokenOperationDelete ... - RegistrationTokenOperationDelete RegistrationTokenOperation = "Delete" - // RegistrationTokenOperationNone ... - RegistrationTokenOperationNone RegistrationTokenOperation = "None" - // RegistrationTokenOperationUpdate ... - RegistrationTokenOperationUpdate RegistrationTokenOperation = "Update" -) - -// PossibleRegistrationTokenOperationValues returns an array of possible values for the RegistrationTokenOperation const type. -func PossibleRegistrationTokenOperationValues() []RegistrationTokenOperation { - return []RegistrationTokenOperation{RegistrationTokenOperationDelete, RegistrationTokenOperationNone, RegistrationTokenOperationUpdate} -} - -// RemoteApplicationType enumerates the values for remote application type. -type RemoteApplicationType string - -const ( - // RemoteApplicationTypeInBuilt ... - RemoteApplicationTypeInBuilt RemoteApplicationType = "InBuilt" - // RemoteApplicationTypeMsixApplication ... - RemoteApplicationTypeMsixApplication RemoteApplicationType = "MsixApplication" -) - -// PossibleRemoteApplicationTypeValues returns an array of possible values for the RemoteApplicationType const type. -func PossibleRemoteApplicationTypeValues() []RemoteApplicationType { - return []RemoteApplicationType{RemoteApplicationTypeInBuilt, RemoteApplicationTypeMsixApplication} -} - -// ResourceIdentityType enumerates the values for resource identity type. -type ResourceIdentityType string - -const ( - // ResourceIdentityTypeSystemAssigned ... - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" -) - -// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ResourceIdentityTypeSystemAssigned} -} - -// ScalingHostPoolType enumerates the values for scaling host pool type. -type ScalingHostPoolType string - -const ( - // ScalingHostPoolTypePooled Users get a new (random) SessionHost every time it connects to the HostPool. - ScalingHostPoolTypePooled ScalingHostPoolType = "Pooled" -) - -// PossibleScalingHostPoolTypeValues returns an array of possible values for the ScalingHostPoolType const type. -func PossibleScalingHostPoolTypeValues() []ScalingHostPoolType { - return []ScalingHostPoolType{ScalingHostPoolTypePooled} -} - -// SessionHostLoadBalancingAlgorithm enumerates the values for session host load balancing algorithm. -type SessionHostLoadBalancingAlgorithm string - -const ( - // SessionHostLoadBalancingAlgorithmBreadthFirst ... - SessionHostLoadBalancingAlgorithmBreadthFirst SessionHostLoadBalancingAlgorithm = "BreadthFirst" - // SessionHostLoadBalancingAlgorithmDepthFirst ... - SessionHostLoadBalancingAlgorithmDepthFirst SessionHostLoadBalancingAlgorithm = "DepthFirst" -) - -// PossibleSessionHostLoadBalancingAlgorithmValues returns an array of possible values for the SessionHostLoadBalancingAlgorithm const type. -func PossibleSessionHostLoadBalancingAlgorithmValues() []SessionHostLoadBalancingAlgorithm { - return []SessionHostLoadBalancingAlgorithm{SessionHostLoadBalancingAlgorithmBreadthFirst, SessionHostLoadBalancingAlgorithmDepthFirst} -} - -// SessionState enumerates the values for session state. -type SessionState string - -const ( - // SessionStateActive ... - SessionStateActive SessionState = "Active" - // SessionStateDisconnected ... - SessionStateDisconnected SessionState = "Disconnected" - // SessionStateLogOff ... - SessionStateLogOff SessionState = "LogOff" - // SessionStatePending ... - SessionStatePending SessionState = "Pending" - // SessionStateUnknown ... - SessionStateUnknown SessionState = "Unknown" - // SessionStateUserProfileDiskMounted ... - SessionStateUserProfileDiskMounted SessionState = "UserProfileDiskMounted" -) - -// PossibleSessionStateValues returns an array of possible values for the SessionState const type. -func PossibleSessionStateValues() []SessionState { - return []SessionState{SessionStateActive, SessionStateDisconnected, SessionStateLogOff, SessionStatePending, SessionStateUnknown, SessionStateUserProfileDiskMounted} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // SkuTierBasic ... - SkuTierBasic SkuTier = "Basic" - // SkuTierFree ... - SkuTierFree SkuTier = "Free" - // SkuTierPremium ... - SkuTierPremium SkuTier = "Premium" - // SkuTierStandard ... - SkuTierStandard SkuTier = "Standard" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{SkuTierBasic, SkuTierFree, SkuTierPremium, SkuTierStandard} -} - -// SSOSecretType enumerates the values for sso secret type. -type SSOSecretType string - -const ( - // SSOSecretTypeCertificate ... - SSOSecretTypeCertificate SSOSecretType = "Certificate" - // SSOSecretTypeCertificateInKeyVault ... - SSOSecretTypeCertificateInKeyVault SSOSecretType = "CertificateInKeyVault" - // SSOSecretTypeSharedKey ... - SSOSecretTypeSharedKey SSOSecretType = "SharedKey" - // SSOSecretTypeSharedKeyInKeyVault ... - SSOSecretTypeSharedKeyInKeyVault SSOSecretType = "SharedKeyInKeyVault" -) - -// PossibleSSOSecretTypeValues returns an array of possible values for the SSOSecretType const type. -func PossibleSSOSecretTypeValues() []SSOSecretType { - return []SSOSecretType{SSOSecretTypeCertificate, SSOSecretTypeCertificateInKeyVault, SSOSecretTypeSharedKey, SSOSecretTypeSharedKeyInKeyVault} -} - -// Status enumerates the values for status. -type Status string - -const ( - // StatusAvailable Session Host has passed all the health checks and is available to handle connections. - StatusAvailable Status = "Available" - // StatusDisconnected The Session Host is unavailable because it is currently disconnected. - StatusDisconnected Status = "Disconnected" - // StatusDomainTrustRelationshipLost SessionHost's domain trust relationship lost - StatusDomainTrustRelationshipLost Status = "DomainTrustRelationshipLost" - // StatusFSLogixNotHealthy FSLogix is in an unhealthy state on the session host. - StatusFSLogixNotHealthy Status = "FSLogixNotHealthy" - // StatusNeedsAssistance New status to inform admins that the health on their endpoint needs to be fixed. - // The connections might not fail, as these issues are not fatal. - StatusNeedsAssistance Status = "NeedsAssistance" - // StatusNoHeartbeat The Session Host is not heart beating. - StatusNoHeartbeat Status = "NoHeartbeat" - // StatusNotJoinedToDomain SessionHost is not joined to domain. - StatusNotJoinedToDomain Status = "NotJoinedToDomain" - // StatusShutdown Session Host is shutdown - RD Agent reported session host to be stopped or deallocated. - StatusShutdown Status = "Shutdown" - // StatusSxSStackListenerNotReady SxS stack installed on the SessionHost is not ready to receive - // connections. - StatusSxSStackListenerNotReady Status = "SxSStackListenerNotReady" - // StatusUnavailable Session Host is either turned off or has failed critical health checks which is - // causing service not to be able to route connections to this session host. Note this replaces previous - // 'NoHeartBeat' status. - StatusUnavailable Status = "Unavailable" - // StatusUpgradeFailed Session Host is unavailable because the critical component upgrade (agent, - // side-by-side stack, etc.) failed. - StatusUpgradeFailed Status = "UpgradeFailed" - // StatusUpgrading Session Host is unavailable because currently an upgrade of RDAgent/side-by-side stack - // is in progress. Note: this state will be removed once the upgrade completes and the host is able to - // accept connections. - StatusUpgrading Status = "Upgrading" -) - -// PossibleStatusValues returns an array of possible values for the Status const type. -func PossibleStatusValues() []Status { - return []Status{StatusAvailable, StatusDisconnected, StatusDomainTrustRelationshipLost, StatusFSLogixNotHealthy, StatusNeedsAssistance, StatusNoHeartbeat, StatusNotJoinedToDomain, StatusShutdown, StatusSxSStackListenerNotReady, StatusUnavailable, StatusUpgradeFailed, StatusUpgrading} -} - -// StopHostsWhen enumerates the values for stop hosts when. -type StopHostsWhen string - -const ( - // StopHostsWhenZeroActiveSessions ... - StopHostsWhenZeroActiveSessions StopHostsWhen = "ZeroActiveSessions" - // StopHostsWhenZeroSessions ... - StopHostsWhenZeroSessions StopHostsWhen = "ZeroSessions" -) - -// PossibleStopHostsWhenValues returns an array of possible values for the StopHostsWhen const type. -func PossibleStopHostsWhenValues() []StopHostsWhen { - return []StopHostsWhen{StopHostsWhenZeroActiveSessions, StopHostsWhenZeroSessions} -} - -// UpdateState enumerates the values for update state. -type UpdateState string - -const ( - // UpdateStateFailed ... - UpdateStateFailed UpdateState = "Failed" - // UpdateStateInitial ... - UpdateStateInitial UpdateState = "Initial" - // UpdateStatePending ... - UpdateStatePending UpdateState = "Pending" - // UpdateStateStarted ... - UpdateStateStarted UpdateState = "Started" - // UpdateStateSucceeded ... - UpdateStateSucceeded UpdateState = "Succeeded" -) - -// PossibleUpdateStateValues returns an array of possible values for the UpdateState const type. -func PossibleUpdateStateValues() []UpdateState { - return []UpdateState{UpdateStateFailed, UpdateStateInitial, UpdateStatePending, UpdateStateStarted, UpdateStateSucceeded} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/hostpools.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/hostpools.go deleted file mode 100644 index 5631121963d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/hostpools.go +++ /dev/null @@ -1,730 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// HostPoolsClient is the client for the HostPools methods of the Desktopvirtualization service. -type HostPoolsClient struct { - BaseClient -} - -// NewHostPoolsClient creates an instance of the HostPoolsClient client. -func NewHostPoolsClient(subscriptionID string) HostPoolsClient { - return NewHostPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewHostPoolsClientWithBaseURI creates an instance of the HostPoolsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewHostPoolsClientWithBaseURI(baseURI string, subscriptionID string) HostPoolsClient { - return HostPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a host pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// hostPool - object containing HostPool definitions. -func (client HostPoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, hostPoolName string, hostPool HostPool) (result HostPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: hostPool, - Constraints: []validation.Constraint{{Target: "hostPool.HostPoolProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.HostPoolsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, hostPoolName, hostPool) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client HostPoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, hostPool HostPool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", pathParameters), - autorest.WithJSON(hostPool), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client HostPoolsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client HostPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result HostPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove a host pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// force - force flag to delete sessionHost. -func (client HostPoolsClient) Delete(ctx context.Context, resourceGroupName string, hostPoolName string, force *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.HostPoolsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, hostPoolName, force) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client HostPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, force *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if force != nil { - queryParameters["force"] = autorest.Encode("query", *force) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client HostPoolsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client HostPoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a host pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -func (client HostPoolsClient) Get(ctx context.Context, resourceGroupName string, hostPoolName string) (result HostPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.HostPoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, hostPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client HostPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, hostPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client HostPoolsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client HostPoolsClient) GetResponder(resp *http.Response) (result HostPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list hostPools in subscription. -func (client HostPoolsClient) List(ctx context.Context) (result HostPoolListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.List") - defer func() { - sc := -1 - if result.hpl.Response.Response != nil { - sc = result.hpl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.HostPoolsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.hpl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "List", resp, "Failure sending request") - return - } - - result.hpl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "List", resp, "Failure responding to request") - return - } - if result.hpl.hasNextLink() && result.hpl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client HostPoolsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client HostPoolsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client HostPoolsClient) ListResponder(resp *http.Response) (result HostPoolList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client HostPoolsClient) listNextResults(ctx context.Context, lastResults HostPoolList) (result HostPoolList, err error) { - req, err := lastResults.hostPoolListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client HostPoolsClient) ListComplete(ctx context.Context) (result HostPoolListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup list hostPools. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client HostPoolsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result HostPoolListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.hpl.Response.Response != nil { - sc = result.hpl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.HostPoolsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.hpl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.hpl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.hpl.hasNextLink() && result.hpl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client HostPoolsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client HostPoolsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client HostPoolsClient) ListByResourceGroupResponder(resp *http.Response) (result HostPoolList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client HostPoolsClient) listByResourceGroupNextResults(ctx context.Context, lastResults HostPoolList) (result HostPoolList, err error) { - req, err := lastResults.hostPoolListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client HostPoolsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result HostPoolListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// RetrieveRegistrationToken registration token of the host pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -func (client HostPoolsClient) RetrieveRegistrationToken(ctx context.Context, resourceGroupName string, hostPoolName string) (result RegistrationInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.RetrieveRegistrationToken") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.HostPoolsClient", "RetrieveRegistrationToken", err.Error()) - } - - req, err := client.RetrieveRegistrationTokenPreparer(ctx, resourceGroupName, hostPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "RetrieveRegistrationToken", nil, "Failure preparing request") - return - } - - resp, err := client.RetrieveRegistrationTokenSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "RetrieveRegistrationToken", resp, "Failure sending request") - return - } - - result, err = client.RetrieveRegistrationTokenResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "RetrieveRegistrationToken", resp, "Failure responding to request") - return - } - - return -} - -// RetrieveRegistrationTokenPreparer prepares the RetrieveRegistrationToken request. -func (client HostPoolsClient) RetrieveRegistrationTokenPreparer(ctx context.Context, resourceGroupName string, hostPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RetrieveRegistrationTokenSender sends the RetrieveRegistrationToken request. The method will close the -// http.Response Body if it receives an error. -func (client HostPoolsClient) RetrieveRegistrationTokenSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RetrieveRegistrationTokenResponder handles the response to the RetrieveRegistrationToken request. The method always -// closes the http.Response Body. -func (client HostPoolsClient) RetrieveRegistrationTokenResponder(resp *http.Response) (result RegistrationInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update a host pool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// hostPool - object containing HostPool definitions. -func (client HostPoolsClient) Update(ctx context.Context, resourceGroupName string, hostPoolName string, hostPool *HostPoolPatch) (result HostPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.HostPoolsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, hostPoolName, hostPool) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.HostPoolsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client HostPoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, hostPool *HostPoolPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if hostPool != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(hostPool)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client HostPoolsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client HostPoolsClient) UpdateResponder(resp *http.Response) (result HostPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/models.go deleted file mode 100644 index 1fcaa5188ea..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/models.go +++ /dev/null @@ -1,5627 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization" - -// Application schema for Application properties. -type Application struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ApplicationProperties - Detailed properties for Application - *ApplicationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Application. -func (a Application) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.SystemData != nil { - objectMap["systemData"] = a.SystemData - } - if a.ApplicationProperties != nil { - objectMap["properties"] = a.ApplicationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Application struct. -func (a *Application) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - a.SystemData = &systemData - } - case "properties": - if v != nil { - var applicationProperties ApplicationProperties - err = json.Unmarshal(*v, &applicationProperties) - if err != nil { - return err - } - a.ApplicationProperties = &applicationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - } - } - - return nil -} - -// ApplicationGroup represents a ApplicationGroup definition. -type ApplicationGroup struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ApplicationGroupProperties - Detailed properties for ApplicationGroup - *ApplicationGroupProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. - ManagedBy *string `json:"managedBy,omitempty"` - // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` - Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGroup. -func (ag ApplicationGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ag.SystemData != nil { - objectMap["systemData"] = ag.SystemData - } - if ag.ApplicationGroupProperties != nil { - objectMap["properties"] = ag.ApplicationGroupProperties - } - if ag.Location != nil { - objectMap["location"] = ag.Location - } - if ag.ManagedBy != nil { - objectMap["managedBy"] = ag.ManagedBy - } - if ag.Kind != nil { - objectMap["kind"] = ag.Kind - } - if ag.Tags != nil { - objectMap["tags"] = ag.Tags - } - if ag.Identity != nil { - objectMap["identity"] = ag.Identity - } - if ag.Sku != nil { - objectMap["sku"] = ag.Sku - } - if ag.Plan != nil { - objectMap["plan"] = ag.Plan - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGroup struct. -func (ag *ApplicationGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ag.SystemData = &systemData - } - case "properties": - if v != nil { - var applicationGroupProperties ApplicationGroupProperties - err = json.Unmarshal(*v, &applicationGroupProperties) - if err != nil { - return err - } - ag.ApplicationGroupProperties = &applicationGroupProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ag.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ag.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ag.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ag.Location = &location - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - ag.ManagedBy = &managedBy - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ag.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ag.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ag.Tags = tags - } - case "identity": - if v != nil { - var identity ResourceModelWithAllowedPropertySetIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - ag.Identity = &identity - } - case "sku": - if v != nil { - var sku ResourceModelWithAllowedPropertySetSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - ag.Sku = &sku - } - case "plan": - if v != nil { - var plan ResourceModelWithAllowedPropertySetPlan - err = json.Unmarshal(*v, &plan) - if err != nil { - return err - } - ag.Plan = &plan - } - } - } - - return nil -} - -// ApplicationGroupList list of ApplicationGroup definitions. -type ApplicationGroupList struct { - autorest.Response `json:"-"` - // Value - List of ApplicationGroup definitions. - Value *[]ApplicationGroup `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGroupList. -func (agl ApplicationGroupList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agl.Value != nil { - objectMap["value"] = agl.Value - } - return json.Marshal(objectMap) -} - -// ApplicationGroupListIterator provides access to a complete listing of ApplicationGroup values. -type ApplicationGroupListIterator struct { - i int - page ApplicationGroupListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ApplicationGroupListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ApplicationGroupListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ApplicationGroupListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ApplicationGroupListIterator) Response() ApplicationGroupList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ApplicationGroupListIterator) Value() ApplicationGroup { - if !iter.page.NotDone() { - return ApplicationGroup{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ApplicationGroupListIterator type. -func NewApplicationGroupListIterator(page ApplicationGroupListPage) ApplicationGroupListIterator { - return ApplicationGroupListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (agl ApplicationGroupList) IsEmpty() bool { - return agl.Value == nil || len(*agl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (agl ApplicationGroupList) hasNextLink() bool { - return agl.NextLink != nil && len(*agl.NextLink) != 0 -} - -// applicationGroupListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (agl ApplicationGroupList) applicationGroupListPreparer(ctx context.Context) (*http.Request, error) { - if !agl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(agl.NextLink))) -} - -// ApplicationGroupListPage contains a page of ApplicationGroup values. -type ApplicationGroupListPage struct { - fn func(context.Context, ApplicationGroupList) (ApplicationGroupList, error) - agl ApplicationGroupList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ApplicationGroupListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGroupListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.agl) - if err != nil { - return err - } - page.agl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ApplicationGroupListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ApplicationGroupListPage) NotDone() bool { - return !page.agl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ApplicationGroupListPage) Response() ApplicationGroupList { - return page.agl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ApplicationGroupListPage) Values() []ApplicationGroup { - if page.agl.IsEmpty() { - return nil - } - return *page.agl.Value -} - -// Creates a new instance of the ApplicationGroupListPage type. -func NewApplicationGroupListPage(cur ApplicationGroupList, getNextPage func(context.Context, ApplicationGroupList) (ApplicationGroupList, error)) ApplicationGroupListPage { - return ApplicationGroupListPage{ - fn: getNextPage, - agl: cur, - } -} - -// ApplicationGroupPatch applicationGroup properties that can be patched. -type ApplicationGroupPatch struct { - // Tags - tags to be updated - Tags map[string]*string `json:"tags"` - // ApplicationGroupPatchProperties - ApplicationGroup properties that can be patched. - *ApplicationGroupPatchProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGroupPatch. -func (agp ApplicationGroupPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agp.Tags != nil { - objectMap["tags"] = agp.Tags - } - if agp.ApplicationGroupPatchProperties != nil { - objectMap["properties"] = agp.ApplicationGroupPatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationGroupPatch struct. -func (agp *ApplicationGroupPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - agp.Tags = tags - } - case "properties": - if v != nil { - var applicationGroupPatchProperties ApplicationGroupPatchProperties - err = json.Unmarshal(*v, &applicationGroupPatchProperties) - if err != nil { - return err - } - agp.ApplicationGroupPatchProperties = &applicationGroupPatchProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agp.Type = &typeVar - } - } - } - - return nil -} - -// ApplicationGroupPatchProperties applicationGroup properties that can be patched. -type ApplicationGroupPatchProperties struct { - // Description - Description of ApplicationGroup. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of ApplicationGroup. - FriendlyName *string `json:"friendlyName,omitempty"` -} - -// ApplicationGroupProperties schema for ApplicationGroup properties. -type ApplicationGroupProperties struct { - // ObjectID - READ-ONLY; ObjectId of ApplicationGroup. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // Description - Description of ApplicationGroup. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of ApplicationGroup. - FriendlyName *string `json:"friendlyName,omitempty"` - // HostPoolArmPath - HostPool arm path of ApplicationGroup. - HostPoolArmPath *string `json:"hostPoolArmPath,omitempty"` - // WorkspaceArmPath - READ-ONLY; Workspace arm path of ApplicationGroup. - WorkspaceArmPath *string `json:"workspaceArmPath,omitempty"` - // ApplicationGroupType - Resource Type of ApplicationGroup. Possible values include: 'ApplicationGroupTypeRemoteApp', 'ApplicationGroupTypeDesktop' - ApplicationGroupType ApplicationGroupType `json:"applicationGroupType,omitempty"` - // MigrationRequest - The registration info of HostPool. - MigrationRequest *MigrationRequestProperties `json:"migrationRequest,omitempty"` - // CloudPcResource - READ-ONLY; Is cloud pc resource. - CloudPcResource *bool `json:"cloudPcResource,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationGroupProperties. -func (agp ApplicationGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agp.Description != nil { - objectMap["description"] = agp.Description - } - if agp.FriendlyName != nil { - objectMap["friendlyName"] = agp.FriendlyName - } - if agp.HostPoolArmPath != nil { - objectMap["hostPoolArmPath"] = agp.HostPoolArmPath - } - if agp.ApplicationGroupType != "" { - objectMap["applicationGroupType"] = agp.ApplicationGroupType - } - if agp.MigrationRequest != nil { - objectMap["migrationRequest"] = agp.MigrationRequest - } - return json.Marshal(objectMap) -} - -// ApplicationList list of Application definitions. -type ApplicationList struct { - autorest.Response `json:"-"` - // Value - List of Application definitions. - Value *[]Application `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationList. -func (al ApplicationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if al.Value != nil { - objectMap["value"] = al.Value - } - return json.Marshal(objectMap) -} - -// ApplicationListIterator provides access to a complete listing of Application values. -type ApplicationListIterator struct { - i int - page ApplicationListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ApplicationListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ApplicationListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ApplicationListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ApplicationListIterator) Response() ApplicationList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ApplicationListIterator) Value() Application { - if !iter.page.NotDone() { - return Application{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ApplicationListIterator type. -func NewApplicationListIterator(page ApplicationListPage) ApplicationListIterator { - return ApplicationListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (al ApplicationList) IsEmpty() bool { - return al.Value == nil || len(*al.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (al ApplicationList) hasNextLink() bool { - return al.NextLink != nil && len(*al.NextLink) != 0 -} - -// applicationListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (al ApplicationList) applicationListPreparer(ctx context.Context) (*http.Request, error) { - if !al.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(al.NextLink))) -} - -// ApplicationListPage contains a page of Application values. -type ApplicationListPage struct { - fn func(context.Context, ApplicationList) (ApplicationList, error) - al ApplicationList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ApplicationListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.al) - if err != nil { - return err - } - page.al = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ApplicationListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ApplicationListPage) NotDone() bool { - return !page.al.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ApplicationListPage) Response() ApplicationList { - return page.al -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ApplicationListPage) Values() []Application { - if page.al.IsEmpty() { - return nil - } - return *page.al.Value -} - -// Creates a new instance of the ApplicationListPage type. -func NewApplicationListPage(cur ApplicationList, getNextPage func(context.Context, ApplicationList) (ApplicationList, error)) ApplicationListPage { - return ApplicationListPage{ - fn: getNextPage, - al: cur, - } -} - -// ApplicationPatch application properties that can be patched. -type ApplicationPatch struct { - // Tags - tags to be updated - Tags map[string]*string `json:"tags"` - // ApplicationPatchProperties - Detailed properties for Application - *ApplicationPatchProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationPatch. -func (ap ApplicationPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.Tags != nil { - objectMap["tags"] = ap.Tags - } - if ap.ApplicationPatchProperties != nil { - objectMap["properties"] = ap.ApplicationPatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationPatch struct. -func (ap *ApplicationPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ap.Tags = tags - } - case "properties": - if v != nil { - var applicationPatchProperties ApplicationPatchProperties - err = json.Unmarshal(*v, &applicationPatchProperties) - if err != nil { - return err - } - ap.ApplicationPatchProperties = &applicationPatchProperties - } - } - } - - return nil -} - -// ApplicationPatchProperties application properties that can be patched. -type ApplicationPatchProperties struct { - // Description - Description of Application. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of Application. - FriendlyName *string `json:"friendlyName,omitempty"` - // FilePath - Specifies a path for the executable file for the application. - FilePath *string `json:"filePath,omitempty"` - // CommandLineSetting - Specifies whether this published application can be launched with command line arguments provided by the client, command line arguments specified at publish time, or no command line arguments at all. Possible values include: 'CommandLineSettingDoNotAllow', 'CommandLineSettingAllow', 'CommandLineSettingRequire' - CommandLineSetting CommandLineSetting `json:"commandLineSetting,omitempty"` - // CommandLineArguments - Command Line Arguments for Application. - CommandLineArguments *string `json:"commandLineArguments,omitempty"` - // ShowInPortal - Specifies whether to show the RemoteApp program in the RD Web Access server. - ShowInPortal *bool `json:"showInPortal,omitempty"` - // IconPath - Path to icon. - IconPath *string `json:"iconPath,omitempty"` - // IconIndex - Index of the icon. - IconIndex *int32 `json:"iconIndex,omitempty"` - // MsixPackageFamilyName - Specifies the package family name for MSIX applications - MsixPackageFamilyName *string `json:"msixPackageFamilyName,omitempty"` - // MsixPackageApplicationID - Specifies the package application Id for MSIX applications - MsixPackageApplicationID *string `json:"msixPackageApplicationId,omitempty"` - // ApplicationType - Resource Type of Application. Possible values include: 'RemoteApplicationTypeInBuilt', 'RemoteApplicationTypeMsixApplication' - ApplicationType RemoteApplicationType `json:"applicationType,omitempty"` -} - -// ApplicationProperties schema for Application properties. -type ApplicationProperties struct { - // ObjectID - READ-ONLY; ObjectId of Application. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // Description - Description of Application. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of Application. - FriendlyName *string `json:"friendlyName,omitempty"` - // FilePath - Specifies a path for the executable file for the application. - FilePath *string `json:"filePath,omitempty"` - // MsixPackageFamilyName - Specifies the package family name for MSIX applications - MsixPackageFamilyName *string `json:"msixPackageFamilyName,omitempty"` - // MsixPackageApplicationID - Specifies the package application Id for MSIX applications - MsixPackageApplicationID *string `json:"msixPackageApplicationId,omitempty"` - // ApplicationType - Resource Type of Application. Possible values include: 'RemoteApplicationTypeInBuilt', 'RemoteApplicationTypeMsixApplication' - ApplicationType RemoteApplicationType `json:"applicationType,omitempty"` - // CommandLineSetting - Specifies whether this published application can be launched with command line arguments provided by the client, command line arguments specified at publish time, or no command line arguments at all. Possible values include: 'CommandLineSettingDoNotAllow', 'CommandLineSettingAllow', 'CommandLineSettingRequire' - CommandLineSetting CommandLineSetting `json:"commandLineSetting,omitempty"` - // CommandLineArguments - Command Line Arguments for Application. - CommandLineArguments *string `json:"commandLineArguments,omitempty"` - // ShowInPortal - Specifies whether to show the RemoteApp program in the RD Web Access server. - ShowInPortal *bool `json:"showInPortal,omitempty"` - // IconPath - Path to icon. - IconPath *string `json:"iconPath,omitempty"` - // IconIndex - Index of the icon. - IconIndex *int32 `json:"iconIndex,omitempty"` - // IconHash - READ-ONLY; Hash of the icon. - IconHash *string `json:"iconHash,omitempty"` - // IconContent - READ-ONLY; the icon a 64 bit string as a byte array. - IconContent *[]byte `json:"iconContent,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationProperties. -func (ap ApplicationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.Description != nil { - objectMap["description"] = ap.Description - } - if ap.FriendlyName != nil { - objectMap["friendlyName"] = ap.FriendlyName - } - if ap.FilePath != nil { - objectMap["filePath"] = ap.FilePath - } - if ap.MsixPackageFamilyName != nil { - objectMap["msixPackageFamilyName"] = ap.MsixPackageFamilyName - } - if ap.MsixPackageApplicationID != nil { - objectMap["msixPackageApplicationId"] = ap.MsixPackageApplicationID - } - if ap.ApplicationType != "" { - objectMap["applicationType"] = ap.ApplicationType - } - if ap.CommandLineSetting != "" { - objectMap["commandLineSetting"] = ap.CommandLineSetting - } - if ap.CommandLineArguments != nil { - objectMap["commandLineArguments"] = ap.CommandLineArguments - } - if ap.ShowInPortal != nil { - objectMap["showInPortal"] = ap.ShowInPortal - } - if ap.IconPath != nil { - objectMap["iconPath"] = ap.IconPath - } - if ap.IconIndex != nil { - objectMap["iconIndex"] = ap.IconIndex - } - return json.Marshal(objectMap) -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CloudError cloud error object. -type CloudError struct { - Error *CloudErrorProperties `json:"error,omitempty"` -} - -// CloudErrorProperties cloud error object properties. -type CloudErrorProperties struct { - // Code - Error code - Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// Desktop schema for Desktop properties. -type Desktop struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // DesktopProperties - Detailed properties for Desktop - *DesktopProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Desktop. -func (d Desktop) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.SystemData != nil { - objectMap["systemData"] = d.SystemData - } - if d.DesktopProperties != nil { - objectMap["properties"] = d.DesktopProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Desktop struct. -func (d *Desktop) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - d.SystemData = &systemData - } - case "properties": - if v != nil { - var desktopProperties DesktopProperties - err = json.Unmarshal(*v, &desktopProperties) - if err != nil { - return err - } - d.DesktopProperties = &desktopProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - } - } - - return nil -} - -// DesktopList list of Desktop definitions. -type DesktopList struct { - autorest.Response `json:"-"` - // Value - List of Desktop definitions. - Value *[]Desktop `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DesktopList. -func (dl DesktopList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dl.Value != nil { - objectMap["value"] = dl.Value - } - return json.Marshal(objectMap) -} - -// DesktopListIterator provides access to a complete listing of Desktop values. -type DesktopListIterator struct { - i int - page DesktopListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DesktopListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DesktopListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DesktopListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DesktopListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DesktopListIterator) Response() DesktopList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DesktopListIterator) Value() Desktop { - if !iter.page.NotDone() { - return Desktop{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DesktopListIterator type. -func NewDesktopListIterator(page DesktopListPage) DesktopListIterator { - return DesktopListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dl DesktopList) IsEmpty() bool { - return dl.Value == nil || len(*dl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dl DesktopList) hasNextLink() bool { - return dl.NextLink != nil && len(*dl.NextLink) != 0 -} - -// desktopListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dl DesktopList) desktopListPreparer(ctx context.Context) (*http.Request, error) { - if !dl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dl.NextLink))) -} - -// DesktopListPage contains a page of Desktop values. -type DesktopListPage struct { - fn func(context.Context, DesktopList) (DesktopList, error) - dl DesktopList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DesktopListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DesktopListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dl) - if err != nil { - return err - } - page.dl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DesktopListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DesktopListPage) NotDone() bool { - return !page.dl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DesktopListPage) Response() DesktopList { - return page.dl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DesktopListPage) Values() []Desktop { - if page.dl.IsEmpty() { - return nil - } - return *page.dl.Value -} - -// Creates a new instance of the DesktopListPage type. -func NewDesktopListPage(cur DesktopList, getNextPage func(context.Context, DesktopList) (DesktopList, error)) DesktopListPage { - return DesktopListPage{ - fn: getNextPage, - dl: cur, - } -} - -// DesktopPatch desktop properties that can be patched. -type DesktopPatch struct { - // Tags - tags to be updated - Tags map[string]*string `json:"tags"` - // DesktopPatchProperties - Detailed properties for Desktop - *DesktopPatchProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for DesktopPatch. -func (dp DesktopPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.Tags != nil { - objectMap["tags"] = dp.Tags - } - if dp.DesktopPatchProperties != nil { - objectMap["properties"] = dp.DesktopPatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DesktopPatch struct. -func (dp *DesktopPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dp.Tags = tags - } - case "properties": - if v != nil { - var desktopPatchProperties DesktopPatchProperties - err = json.Unmarshal(*v, &desktopPatchProperties) - if err != nil { - return err - } - dp.DesktopPatchProperties = &desktopPatchProperties - } - } - } - - return nil -} - -// DesktopPatchProperties desktop properties that can be patched. -type DesktopPatchProperties struct { - // Description - Description of Desktop. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of Desktop. - FriendlyName *string `json:"friendlyName,omitempty"` -} - -// DesktopProperties schema for Desktop properties. -type DesktopProperties struct { - // ObjectID - READ-ONLY; ObjectId of Desktop. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // Description - Description of Desktop. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of Desktop. - FriendlyName *string `json:"friendlyName,omitempty"` - // IconHash - READ-ONLY; Hash of the icon. - IconHash *string `json:"iconHash,omitempty"` - // IconContent - READ-ONLY; The icon a 64 bit string as a byte array. - IconContent *[]byte `json:"iconContent,omitempty"` -} - -// MarshalJSON is the custom marshaler for DesktopProperties. -func (dp DesktopProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.Description != nil { - objectMap["description"] = dp.Description - } - if dp.FriendlyName != nil { - objectMap["friendlyName"] = dp.FriendlyName - } - return json.Marshal(objectMap) -} - -// ExpandMsixImage represents the definition of contents retrieved after expanding the MSIX Image. -type ExpandMsixImage struct { - // ExpandMsixImageProperties - Detailed properties for ExpandMsixImage - *ExpandMsixImageProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpandMsixImage. -func (emi ExpandMsixImage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if emi.ExpandMsixImageProperties != nil { - objectMap["properties"] = emi.ExpandMsixImageProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ExpandMsixImage struct. -func (emi *ExpandMsixImage) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var expandMsixImageProperties ExpandMsixImageProperties - err = json.Unmarshal(*v, &expandMsixImageProperties) - if err != nil { - return err - } - emi.ExpandMsixImageProperties = &expandMsixImageProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - emi.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - emi.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - emi.Type = &typeVar - } - } - } - - return nil -} - -// ExpandMsixImageList list of MSIX package properties retrieved from MSIX Image expansion. -type ExpandMsixImageList struct { - autorest.Response `json:"-"` - // Value - List of MSIX package properties from give MSIX Image. - Value *[]ExpandMsixImage `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpandMsixImageList. -func (emil ExpandMsixImageList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if emil.Value != nil { - objectMap["value"] = emil.Value - } - return json.Marshal(objectMap) -} - -// ExpandMsixImageListIterator provides access to a complete listing of ExpandMsixImage values. -type ExpandMsixImageListIterator struct { - i int - page ExpandMsixImageListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ExpandMsixImageListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpandMsixImageListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ExpandMsixImageListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ExpandMsixImageListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ExpandMsixImageListIterator) Response() ExpandMsixImageList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ExpandMsixImageListIterator) Value() ExpandMsixImage { - if !iter.page.NotDone() { - return ExpandMsixImage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ExpandMsixImageListIterator type. -func NewExpandMsixImageListIterator(page ExpandMsixImageListPage) ExpandMsixImageListIterator { - return ExpandMsixImageListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (emil ExpandMsixImageList) IsEmpty() bool { - return emil.Value == nil || len(*emil.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (emil ExpandMsixImageList) hasNextLink() bool { - return emil.NextLink != nil && len(*emil.NextLink) != 0 -} - -// expandMsixImageListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (emil ExpandMsixImageList) expandMsixImageListPreparer(ctx context.Context) (*http.Request, error) { - if !emil.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(emil.NextLink))) -} - -// ExpandMsixImageListPage contains a page of ExpandMsixImage values. -type ExpandMsixImageListPage struct { - fn func(context.Context, ExpandMsixImageList) (ExpandMsixImageList, error) - emil ExpandMsixImageList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ExpandMsixImageListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExpandMsixImageListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.emil) - if err != nil { - return err - } - page.emil = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ExpandMsixImageListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ExpandMsixImageListPage) NotDone() bool { - return !page.emil.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ExpandMsixImageListPage) Response() ExpandMsixImageList { - return page.emil -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ExpandMsixImageListPage) Values() []ExpandMsixImage { - if page.emil.IsEmpty() { - return nil - } - return *page.emil.Value -} - -// Creates a new instance of the ExpandMsixImageListPage type. -func NewExpandMsixImageListPage(cur ExpandMsixImageList, getNextPage func(context.Context, ExpandMsixImageList) (ExpandMsixImageList, error)) ExpandMsixImageListPage { - return ExpandMsixImageListPage{ - fn: getNextPage, - emil: cur, - } -} - -// ExpandMsixImageProperties schema for Expand MSIX Image properties. -type ExpandMsixImageProperties struct { - // PackageAlias - Alias of MSIX Package. - PackageAlias *string `json:"packageAlias,omitempty"` - // ImagePath - VHD/CIM image path on Network Share. - ImagePath *string `json:"imagePath,omitempty"` - // PackageName - Package Name from appxmanifest.xml. - PackageName *string `json:"packageName,omitempty"` - // PackageFamilyName - Package Family Name from appxmanifest.xml. Contains Package Name and Publisher name. - PackageFamilyName *string `json:"packageFamilyName,omitempty"` - // PackageFullName - Package Full Name from appxmanifest.xml. - PackageFullName *string `json:"packageFullName,omitempty"` - // DisplayName - User friendly Name to be displayed in the portal. - DisplayName *string `json:"displayName,omitempty"` - // PackageRelativePath - Relative Path to the package inside the image. - PackageRelativePath *string `json:"packageRelativePath,omitempty"` - // IsRegularRegistration - Specifies how to register Package in feed. - IsRegularRegistration *bool `json:"isRegularRegistration,omitempty"` - // IsActive - Make this version of the package the active one across the hostpool. - IsActive *bool `json:"isActive,omitempty"` - // PackageDependencies - List of package dependencies. - PackageDependencies *[]MsixPackageDependencies `json:"packageDependencies,omitempty"` - // Version - Package Version found in the appxmanifest.xml. - Version *string `json:"version,omitempty"` - // LastUpdated - Date Package was last updated, found in the appxmanifest.xml. - LastUpdated *date.Time `json:"lastUpdated,omitempty"` - // PackageApplications - List of package applications. - PackageApplications *[]MsixPackageApplications `json:"packageApplications,omitempty"` -} - -// HostPool represents a HostPool definition. -type HostPool struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // HostPoolProperties - Detailed properties for HostPool - *HostPoolProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. - ManagedBy *string `json:"managedBy,omitempty"` - // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` - Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` -} - -// MarshalJSON is the custom marshaler for HostPool. -func (hp HostPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hp.SystemData != nil { - objectMap["systemData"] = hp.SystemData - } - if hp.HostPoolProperties != nil { - objectMap["properties"] = hp.HostPoolProperties - } - if hp.Location != nil { - objectMap["location"] = hp.Location - } - if hp.ManagedBy != nil { - objectMap["managedBy"] = hp.ManagedBy - } - if hp.Kind != nil { - objectMap["kind"] = hp.Kind - } - if hp.Tags != nil { - objectMap["tags"] = hp.Tags - } - if hp.Identity != nil { - objectMap["identity"] = hp.Identity - } - if hp.Sku != nil { - objectMap["sku"] = hp.Sku - } - if hp.Plan != nil { - objectMap["plan"] = hp.Plan - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for HostPool struct. -func (hp *HostPool) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - hp.SystemData = &systemData - } - case "properties": - if v != nil { - var hostPoolProperties HostPoolProperties - err = json.Unmarshal(*v, &hostPoolProperties) - if err != nil { - return err - } - hp.HostPoolProperties = &hostPoolProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - hp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - hp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - hp.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - hp.Location = &location - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - hp.ManagedBy = &managedBy - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - hp.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - hp.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - hp.Tags = tags - } - case "identity": - if v != nil { - var identity ResourceModelWithAllowedPropertySetIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - hp.Identity = &identity - } - case "sku": - if v != nil { - var sku ResourceModelWithAllowedPropertySetSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - hp.Sku = &sku - } - case "plan": - if v != nil { - var plan ResourceModelWithAllowedPropertySetPlan - err = json.Unmarshal(*v, &plan) - if err != nil { - return err - } - hp.Plan = &plan - } - } - } - - return nil -} - -// HostPoolList list of HostPool definitions. -type HostPoolList struct { - autorest.Response `json:"-"` - // Value - List of HostPool definitions. - Value *[]HostPool `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for HostPoolList. -func (hpl HostPoolList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hpl.Value != nil { - objectMap["value"] = hpl.Value - } - return json.Marshal(objectMap) -} - -// HostPoolListIterator provides access to a complete listing of HostPool values. -type HostPoolListIterator struct { - i int - page HostPoolListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *HostPoolListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *HostPoolListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter HostPoolListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter HostPoolListIterator) Response() HostPoolList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter HostPoolListIterator) Value() HostPool { - if !iter.page.NotDone() { - return HostPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the HostPoolListIterator type. -func NewHostPoolListIterator(page HostPoolListPage) HostPoolListIterator { - return HostPoolListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (hpl HostPoolList) IsEmpty() bool { - return hpl.Value == nil || len(*hpl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (hpl HostPoolList) hasNextLink() bool { - return hpl.NextLink != nil && len(*hpl.NextLink) != 0 -} - -// hostPoolListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (hpl HostPoolList) hostPoolListPreparer(ctx context.Context) (*http.Request, error) { - if !hpl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(hpl.NextLink))) -} - -// HostPoolListPage contains a page of HostPool values. -type HostPoolListPage struct { - fn func(context.Context, HostPoolList) (HostPoolList, error) - hpl HostPoolList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *HostPoolListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HostPoolListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.hpl) - if err != nil { - return err - } - page.hpl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *HostPoolListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page HostPoolListPage) NotDone() bool { - return !page.hpl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page HostPoolListPage) Response() HostPoolList { - return page.hpl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page HostPoolListPage) Values() []HostPool { - if page.hpl.IsEmpty() { - return nil - } - return *page.hpl.Value -} - -// Creates a new instance of the HostPoolListPage type. -func NewHostPoolListPage(cur HostPoolList, getNextPage func(context.Context, HostPoolList) (HostPoolList, error)) HostPoolListPage { - return HostPoolListPage{ - fn: getNextPage, - hpl: cur, - } -} - -// HostPoolPatch hostPool properties that can be patched. -type HostPoolPatch struct { - // Tags - tags to be updated - Tags map[string]*string `json:"tags"` - // HostPoolPatchProperties - HostPool properties that can be patched. - *HostPoolPatchProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for HostPoolPatch. -func (hpp HostPoolPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hpp.Tags != nil { - objectMap["tags"] = hpp.Tags - } - if hpp.HostPoolPatchProperties != nil { - objectMap["properties"] = hpp.HostPoolPatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for HostPoolPatch struct. -func (hpp *HostPoolPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - hpp.Tags = tags - } - case "properties": - if v != nil { - var hostPoolPatchProperties HostPoolPatchProperties - err = json.Unmarshal(*v, &hostPoolPatchProperties) - if err != nil { - return err - } - hpp.HostPoolPatchProperties = &hostPoolPatchProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - hpp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - hpp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - hpp.Type = &typeVar - } - } - } - - return nil -} - -// HostPoolPatchProperties properties of HostPool. -type HostPoolPatchProperties struct { - // FriendlyName - Friendly name of HostPool. - FriendlyName *string `json:"friendlyName,omitempty"` - // Description - Description of HostPool. - Description *string `json:"description,omitempty"` - // CustomRdpProperty - Custom rdp property of HostPool. - CustomRdpProperty *string `json:"customRdpProperty,omitempty"` - // MaxSessionLimit - The max session limit of HostPool. - MaxSessionLimit *int32 `json:"maxSessionLimit,omitempty"` - // PersonalDesktopAssignmentType - PersonalDesktopAssignment type for HostPool. Possible values include: 'PersonalDesktopAssignmentTypeAutomatic', 'PersonalDesktopAssignmentTypeDirect' - PersonalDesktopAssignmentType PersonalDesktopAssignmentType `json:"personalDesktopAssignmentType,omitempty"` - // LoadBalancerType - The type of the load balancer. Possible values include: 'LoadBalancerTypeBreadthFirst', 'LoadBalancerTypeDepthFirst', 'LoadBalancerTypePersistent' - LoadBalancerType LoadBalancerType `json:"loadBalancerType,omitempty"` - // Ring - The ring number of HostPool. - Ring *int32 `json:"ring,omitempty"` - // ValidationEnvironment - Is validation environment. - ValidationEnvironment *bool `json:"validationEnvironment,omitempty"` - // RegistrationInfo - The registration info of HostPool. - RegistrationInfo *RegistrationInfoPatch `json:"registrationInfo,omitempty"` - // VMTemplate - VM template for sessionhosts configuration within hostpool. - VMTemplate *string `json:"vmTemplate,omitempty"` - // SsoadfsAuthority - URL to customer ADFS server for signing WVD SSO certificates. - SsoadfsAuthority *string `json:"ssoadfsAuthority,omitempty"` - // SsoClientID - ClientId for the registered Relying Party used to issue WVD SSO certificates. - SsoClientID *string `json:"ssoClientId,omitempty"` - // SsoClientSecretKeyVaultPath - Path to Azure KeyVault storing the secret used for communication to ADFS. - SsoClientSecretKeyVaultPath *string `json:"ssoClientSecretKeyVaultPath,omitempty"` - // SsoSecretType - The type of single sign on Secret Type. Possible values include: 'SSOSecretTypeSharedKey', 'SSOSecretTypeCertificate', 'SSOSecretTypeSharedKeyInKeyVault', 'SSOSecretTypeCertificateInKeyVault' - SsoSecretType SSOSecretType `json:"ssoSecretType,omitempty"` - // PreferredAppGroupType - The type of preferred application group type, default to Desktop Application Group. Possible values include: 'PreferredAppGroupTypeNone', 'PreferredAppGroupTypeDesktop', 'PreferredAppGroupTypeRailApplications' - PreferredAppGroupType PreferredAppGroupType `json:"preferredAppGroupType,omitempty"` - // StartVMOnConnect - The flag to turn on/off StartVMOnConnect feature. - StartVMOnConnect *bool `json:"startVMOnConnect,omitempty"` - // PublicNetworkAccess - Enabled to allow this resource to be access from the public network. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// HostPoolProperties properties of HostPool. -type HostPoolProperties struct { - // ObjectID - READ-ONLY; ObjectId of HostPool. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // FriendlyName - Friendly name of HostPool. - FriendlyName *string `json:"friendlyName,omitempty"` - // Description - Description of HostPool. - Description *string `json:"description,omitempty"` - // HostPoolType - HostPool type for desktop. Possible values include: 'HostPoolTypePersonal', 'HostPoolTypePooled', 'HostPoolTypeBYODesktop' - HostPoolType HostPoolType `json:"hostPoolType,omitempty"` - // PersonalDesktopAssignmentType - PersonalDesktopAssignment type for HostPool. Possible values include: 'PersonalDesktopAssignmentTypeAutomatic', 'PersonalDesktopAssignmentTypeDirect' - PersonalDesktopAssignmentType PersonalDesktopAssignmentType `json:"personalDesktopAssignmentType,omitempty"` - // CustomRdpProperty - Custom rdp property of HostPool. - CustomRdpProperty *string `json:"customRdpProperty,omitempty"` - // MaxSessionLimit - The max session limit of HostPool. - MaxSessionLimit *int32 `json:"maxSessionLimit,omitempty"` - // LoadBalancerType - The type of the load balancer. Possible values include: 'LoadBalancerTypeBreadthFirst', 'LoadBalancerTypeDepthFirst', 'LoadBalancerTypePersistent' - LoadBalancerType LoadBalancerType `json:"loadBalancerType,omitempty"` - // Ring - The ring number of HostPool. - Ring *int32 `json:"ring,omitempty"` - // ValidationEnvironment - Is validation environment. - ValidationEnvironment *bool `json:"validationEnvironment,omitempty"` - // RegistrationInfo - The registration info of HostPool. - RegistrationInfo *RegistrationInfo `json:"registrationInfo,omitempty"` - // VMTemplate - VM template for sessionhosts configuration within hostpool. - VMTemplate *string `json:"vmTemplate,omitempty"` - // ApplicationGroupReferences - READ-ONLY; List of applicationGroup links. - ApplicationGroupReferences *[]string `json:"applicationGroupReferences,omitempty"` - // SsoadfsAuthority - URL to customer ADFS server for signing WVD SSO certificates. - SsoadfsAuthority *string `json:"ssoadfsAuthority,omitempty"` - // SsoClientID - ClientId for the registered Relying Party used to issue WVD SSO certificates. - SsoClientID *string `json:"ssoClientId,omitempty"` - // SsoClientSecretKeyVaultPath - Path to Azure KeyVault storing the secret used for communication to ADFS. - SsoClientSecretKeyVaultPath *string `json:"ssoClientSecretKeyVaultPath,omitempty"` - // SsoSecretType - The type of single sign on Secret Type. Possible values include: 'SSOSecretTypeSharedKey', 'SSOSecretTypeCertificate', 'SSOSecretTypeSharedKeyInKeyVault', 'SSOSecretTypeCertificateInKeyVault' - SsoSecretType SSOSecretType `json:"ssoSecretType,omitempty"` - // PreferredAppGroupType - The type of preferred application group type, default to Desktop Application Group. Possible values include: 'PreferredAppGroupTypeNone', 'PreferredAppGroupTypeDesktop', 'PreferredAppGroupTypeRailApplications' - PreferredAppGroupType PreferredAppGroupType `json:"preferredAppGroupType,omitempty"` - // StartVMOnConnect - The flag to turn on/off StartVMOnConnect feature. - StartVMOnConnect *bool `json:"startVMOnConnect,omitempty"` - // MigrationRequest - The registration info of HostPool. - MigrationRequest *MigrationRequestProperties `json:"migrationRequest,omitempty"` - // CloudPcResource - READ-ONLY; Is cloud pc resource. - CloudPcResource *bool `json:"cloudPcResource,omitempty"` - // PublicNetworkAccess - Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for HostPoolProperties. -func (hpp HostPoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hpp.FriendlyName != nil { - objectMap["friendlyName"] = hpp.FriendlyName - } - if hpp.Description != nil { - objectMap["description"] = hpp.Description - } - if hpp.HostPoolType != "" { - objectMap["hostPoolType"] = hpp.HostPoolType - } - if hpp.PersonalDesktopAssignmentType != "" { - objectMap["personalDesktopAssignmentType"] = hpp.PersonalDesktopAssignmentType - } - if hpp.CustomRdpProperty != nil { - objectMap["customRdpProperty"] = hpp.CustomRdpProperty - } - if hpp.MaxSessionLimit != nil { - objectMap["maxSessionLimit"] = hpp.MaxSessionLimit - } - if hpp.LoadBalancerType != "" { - objectMap["loadBalancerType"] = hpp.LoadBalancerType - } - if hpp.Ring != nil { - objectMap["ring"] = hpp.Ring - } - if hpp.ValidationEnvironment != nil { - objectMap["validationEnvironment"] = hpp.ValidationEnvironment - } - if hpp.RegistrationInfo != nil { - objectMap["registrationInfo"] = hpp.RegistrationInfo - } - if hpp.VMTemplate != nil { - objectMap["vmTemplate"] = hpp.VMTemplate - } - if hpp.SsoadfsAuthority != nil { - objectMap["ssoadfsAuthority"] = hpp.SsoadfsAuthority - } - if hpp.SsoClientID != nil { - objectMap["ssoClientId"] = hpp.SsoClientID - } - if hpp.SsoClientSecretKeyVaultPath != nil { - objectMap["ssoClientSecretKeyVaultPath"] = hpp.SsoClientSecretKeyVaultPath - } - if hpp.SsoSecretType != "" { - objectMap["ssoSecretType"] = hpp.SsoSecretType - } - if hpp.PreferredAppGroupType != "" { - objectMap["preferredAppGroupType"] = hpp.PreferredAppGroupType - } - if hpp.StartVMOnConnect != nil { - objectMap["startVMOnConnect"] = hpp.StartVMOnConnect - } - if hpp.MigrationRequest != nil { - objectMap["migrationRequest"] = hpp.MigrationRequest - } - if hpp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = hpp.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// Identity identity for the resource. -type Identity struct { - // PrincipalID - READ-ONLY; The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned' - Type ResourceIdentityType `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if i.Type != "" { - objectMap["type"] = i.Type - } - return json.Marshal(objectMap) -} - -// LogSpecification specifications of the Log for Azure Monitoring -type LogSpecification struct { - // Name - Name of the log - Name *string `json:"name,omitempty"` - // DisplayName - Localized friendly display name of the log - DisplayName *string `json:"displayName,omitempty"` - // BlobDuration - Blob duration of the log - BlobDuration *string `json:"blobDuration,omitempty"` -} - -// MigrationRequestProperties properties for arm migration. -type MigrationRequestProperties struct { - // Operation - The type of operation for migration. Possible values include: 'OperationStart', 'OperationRevoke', 'OperationComplete', 'OperationHide', 'OperationUnhide' - Operation Operation `json:"operation,omitempty"` - // MigrationPath - The path to the legacy object to migrate. - MigrationPath *string `json:"migrationPath,omitempty"` -} - -// MSIXImageURI represents URI referring to MSIX Image -type MSIXImageURI struct { - // URI - URI to Image - URI *string `json:"uri,omitempty"` -} - -// MSIXPackage schema for MSIX Package properties. -type MSIXPackage struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // MSIXPackageProperties - Detailed properties for MSIX Package - *MSIXPackageProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MSIXPackage. -func (mp MSIXPackage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mp.SystemData != nil { - objectMap["systemData"] = mp.SystemData - } - if mp.MSIXPackageProperties != nil { - objectMap["properties"] = mp.MSIXPackageProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MSIXPackage struct. -func (mp *MSIXPackage) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - mp.SystemData = &systemData - } - case "properties": - if v != nil { - var mSIXPackageProperties MSIXPackageProperties - err = json.Unmarshal(*v, &mSIXPackageProperties) - if err != nil { - return err - } - mp.MSIXPackageProperties = &mSIXPackageProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mp.Type = &typeVar - } - } - } - - return nil -} - -// MsixPackageApplications schema for MSIX Package Application properties. -type MsixPackageApplications struct { - // AppID - Package Application Id, found in appxmanifest.xml. - AppID *string `json:"appId,omitempty"` - // Description - Description of Package Application. - Description *string `json:"description,omitempty"` - // AppUserModelID - Used to activate Package Application. Consists of Package Name and ApplicationID. Found in appxmanifest.xml. - AppUserModelID *string `json:"appUserModelID,omitempty"` - // FriendlyName - User friendly name. - FriendlyName *string `json:"friendlyName,omitempty"` - // IconImageName - User friendly name. - IconImageName *string `json:"iconImageName,omitempty"` - // RawIcon - the icon a 64 bit string as a byte array. - RawIcon *[]byte `json:"rawIcon,omitempty"` - // RawPng - the icon a 64 bit string as a byte array. - RawPng *[]byte `json:"rawPng,omitempty"` -} - -// MsixPackageDependencies schema for MSIX Package Dependencies properties. -type MsixPackageDependencies struct { - // DependencyName - Name of package dependency. - DependencyName *string `json:"dependencyName,omitempty"` - // Publisher - Name of dependency publisher. - Publisher *string `json:"publisher,omitempty"` - // MinVersion - Dependency version required. - MinVersion *string `json:"minVersion,omitempty"` -} - -// MSIXPackageList list of MSIX Package definitions. -type MSIXPackageList struct { - autorest.Response `json:"-"` - // Value - List of MSIX Package definitions. - Value *[]MSIXPackage `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for MSIXPackageList. -func (mpl MSIXPackageList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mpl.Value != nil { - objectMap["value"] = mpl.Value - } - return json.Marshal(objectMap) -} - -// MSIXPackageListIterator provides access to a complete listing of MSIXPackage values. -type MSIXPackageListIterator struct { - i int - page MSIXPackageListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *MSIXPackageListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackageListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *MSIXPackageListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter MSIXPackageListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter MSIXPackageListIterator) Response() MSIXPackageList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter MSIXPackageListIterator) Value() MSIXPackage { - if !iter.page.NotDone() { - return MSIXPackage{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the MSIXPackageListIterator type. -func NewMSIXPackageListIterator(page MSIXPackageListPage) MSIXPackageListIterator { - return MSIXPackageListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mpl MSIXPackageList) IsEmpty() bool { - return mpl.Value == nil || len(*mpl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mpl MSIXPackageList) hasNextLink() bool { - return mpl.NextLink != nil && len(*mpl.NextLink) != 0 -} - -// mSIXPackageListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mpl MSIXPackageList) mSIXPackageListPreparer(ctx context.Context) (*http.Request, error) { - if !mpl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mpl.NextLink))) -} - -// MSIXPackageListPage contains a page of MSIXPackage values. -type MSIXPackageListPage struct { - fn func(context.Context, MSIXPackageList) (MSIXPackageList, error) - mpl MSIXPackageList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *MSIXPackageListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackageListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.mpl) - if err != nil { - return err - } - page.mpl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *MSIXPackageListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page MSIXPackageListPage) NotDone() bool { - return !page.mpl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page MSIXPackageListPage) Response() MSIXPackageList { - return page.mpl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page MSIXPackageListPage) Values() []MSIXPackage { - if page.mpl.IsEmpty() { - return nil - } - return *page.mpl.Value -} - -// Creates a new instance of the MSIXPackageListPage type. -func NewMSIXPackageListPage(cur MSIXPackageList, getNextPage func(context.Context, MSIXPackageList) (MSIXPackageList, error)) MSIXPackageListPage { - return MSIXPackageListPage{ - fn: getNextPage, - mpl: cur, - } -} - -// MSIXPackagePatch MSIX Package properties that can be patched. -type MSIXPackagePatch struct { - // MSIXPackagePatchProperties - Detailed properties for MSIX Package - *MSIXPackagePatchProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MSIXPackagePatch. -func (mpp MSIXPackagePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mpp.MSIXPackagePatchProperties != nil { - objectMap["properties"] = mpp.MSIXPackagePatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MSIXPackagePatch struct. -func (mpp *MSIXPackagePatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var mSIXPackagePatchProperties MSIXPackagePatchProperties - err = json.Unmarshal(*v, &mSIXPackagePatchProperties) - if err != nil { - return err - } - mpp.MSIXPackagePatchProperties = &mSIXPackagePatchProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mpp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mpp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mpp.Type = &typeVar - } - } - } - - return nil -} - -// MSIXPackagePatchProperties MSIX Package properties that can be patched. -type MSIXPackagePatchProperties struct { - // IsActive - Set a version of the package to be active across hostpool. - IsActive *bool `json:"isActive,omitempty"` - // IsRegularRegistration - Set Registration mode. Regular or Delayed. - IsRegularRegistration *bool `json:"isRegularRegistration,omitempty"` - // DisplayName - Display name for MSIX Package. - DisplayName *string `json:"displayName,omitempty"` -} - -// MSIXPackageProperties schema for MSIX Package properties. -type MSIXPackageProperties struct { - // ImagePath - VHD/CIM image path on Network Share. - ImagePath *string `json:"imagePath,omitempty"` - // PackageName - Package Name from appxmanifest.xml. - PackageName *string `json:"packageName,omitempty"` - // PackageFamilyName - Package Family Name from appxmanifest.xml. Contains Package Name and Publisher name. - PackageFamilyName *string `json:"packageFamilyName,omitempty"` - // DisplayName - User friendly Name to be displayed in the portal. - DisplayName *string `json:"displayName,omitempty"` - // PackageRelativePath - Relative Path to the package inside the image. - PackageRelativePath *string `json:"packageRelativePath,omitempty"` - // IsRegularRegistration - Specifies how to register Package in feed. - IsRegularRegistration *bool `json:"isRegularRegistration,omitempty"` - // IsActive - Make this version of the package the active one across the hostpool. - IsActive *bool `json:"isActive,omitempty"` - // PackageDependencies - List of package dependencies. - PackageDependencies *[]MsixPackageDependencies `json:"packageDependencies,omitempty"` - // Version - Package Version found in the appxmanifest.xml. - Version *string `json:"version,omitempty"` - // LastUpdated - Date Package was last updated, found in the appxmanifest.xml. - LastUpdated *date.Time `json:"lastUpdated,omitempty"` - // PackageApplications - List of package applications. - PackageApplications *[]MsixPackageApplications `json:"packageApplications,omitempty"` -} - -// OperationProperties properties of the operation -type OperationProperties struct { - ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// Plan plan for the resource. -type Plan struct { - // Name - A user defined name of the 3rd Party Artifact that is being procured. - Name *string `json:"name,omitempty"` - // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic - Publisher *string `json:"publisher,omitempty"` - // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. - Product *string `json:"product,omitempty"` - // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. - PromotionCode *string `json:"promotionCode,omitempty"` - // Version - The version of the desired product/artifact. - Version *string `json:"version,omitempty"` -} - -// PrivateEndpoint the Private Endpoint resource. -type PrivateEndpoint struct { - // ID - READ-ONLY; The ARM identifier for Private Endpoint - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpoint. -func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection the Private Endpoint Connection resource. -type PrivateEndpointConnection struct { - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResultWithSystemData list of private endpoint connection associated with -// the specified storage account -type PrivateEndpointConnectionListResultWithSystemData struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnectionWithSystemData `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResultWithSystemData. -func (peclrwsd PrivateEndpointConnectionListResultWithSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if peclrwsd.Value != nil { - objectMap["value"] = peclrwsd.Value - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionListResultWithSystemDataIterator provides access to a complete listing of -// PrivateEndpointConnectionWithSystemData values. -type PrivateEndpointConnectionListResultWithSystemDataIterator struct { - i int - page PrivateEndpointConnectionListResultWithSystemDataPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateEndpointConnectionListResultWithSystemDataIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultWithSystemDataIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateEndpointConnectionListResultWithSystemDataIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultWithSystemDataIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateEndpointConnectionListResultWithSystemDataIterator) Response() PrivateEndpointConnectionListResultWithSystemData { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateEndpointConnectionListResultWithSystemDataIterator) Value() PrivateEndpointConnectionWithSystemData { - if !iter.page.NotDone() { - return PrivateEndpointConnectionWithSystemData{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultWithSystemDataIterator type. -func NewPrivateEndpointConnectionListResultWithSystemDataIterator(page PrivateEndpointConnectionListResultWithSystemDataPage) PrivateEndpointConnectionListResultWithSystemDataIterator { - return PrivateEndpointConnectionListResultWithSystemDataIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclrwsd PrivateEndpointConnectionListResultWithSystemData) IsEmpty() bool { - return peclrwsd.Value == nil || len(*peclrwsd.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclrwsd PrivateEndpointConnectionListResultWithSystemData) hasNextLink() bool { - return peclrwsd.NextLink != nil && len(*peclrwsd.NextLink) != 0 -} - -// privateEndpointConnectionListResultWithSystemDataPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclrwsd PrivateEndpointConnectionListResultWithSystemData) privateEndpointConnectionListResultWithSystemDataPreparer(ctx context.Context) (*http.Request, error) { - if !peclrwsd.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclrwsd.NextLink))) -} - -// PrivateEndpointConnectionListResultWithSystemDataPage contains a page of -// PrivateEndpointConnectionWithSystemData values. -type PrivateEndpointConnectionListResultWithSystemDataPage struct { - fn func(context.Context, PrivateEndpointConnectionListResultWithSystemData) (PrivateEndpointConnectionListResultWithSystemData, error) - peclrwsd PrivateEndpointConnectionListResultWithSystemData -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateEndpointConnectionListResultWithSystemDataPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultWithSystemDataPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.peclrwsd) - if err != nil { - return err - } - page.peclrwsd = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateEndpointConnectionListResultWithSystemDataPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultWithSystemDataPage) NotDone() bool { - return !page.peclrwsd.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultWithSystemDataPage) Response() PrivateEndpointConnectionListResultWithSystemData { - return page.peclrwsd -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultWithSystemDataPage) Values() []PrivateEndpointConnectionWithSystemData { - if page.peclrwsd.IsEmpty() { - return nil - } - return *page.peclrwsd.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultWithSystemDataPage type. -func NewPrivateEndpointConnectionListResultWithSystemDataPage(cur PrivateEndpointConnectionListResultWithSystemData, getNextPage func(context.Context, PrivateEndpointConnectionListResultWithSystemData) (PrivateEndpointConnectionListResultWithSystemData, error)) PrivateEndpointConnectionListResultWithSystemDataPage { - return PrivateEndpointConnectionListResultWithSystemDataPage{ - fn: getNextPage, - peclrwsd: cur, - } -} - -// PrivateEndpointConnectionProperties properties of the PrivateEndpointConnectProperties. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The resource of private end point. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - The provisioning state of the private endpoint connection resource. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' - ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionWithSystemData the Private Endpoint Connection resource. -type PrivateEndpointConnectionWithSystemData struct { - autorest.Response `json:"-"` - SystemData *SystemData `json:"systemData,omitempty"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionWithSystemData. -func (pecwsd PrivateEndpointConnectionWithSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecwsd.SystemData != nil { - objectMap["systemData"] = pecwsd.SystemData - } - if pecwsd.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pecwsd.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnectionWithSystemData struct. -func (pecwsd *PrivateEndpointConnectionWithSystemData) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - pecwsd.SystemData = &systemData - } - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pecwsd.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pecwsd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pecwsd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pecwsd.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.PrivateLinkResourceProperties != nil { - objectMap["properties"] = plr.PrivateLinkResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. -func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult. -func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plrlr.Value != nil { - objectMap["value"] = plrlr.Value - } - return json.Marshal(objectMap) -} - -// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource -// values. -type PrivateLinkResourceListResultIterator struct { - i int - page PrivateLinkResourceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateLinkResourceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListResultIterator type. -func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { - return PrivateLinkResourceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { - return plrlr.Value == nil || len(*plrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { - return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 -} - -// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !plrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrlr.NextLink))) -} - -// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListResultPage struct { - fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) - plrlr PrivateLinkResourceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.plrlr) - if err != nil { - return err - } - page.plrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateLinkResourceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListResultPage) NotDone() bool { - return !page.plrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { - return page.plrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { - if page.plrlr.IsEmpty() { - return nil - } - return *page.plrlr.Value -} - -// Creates a new instance of the PrivateLinkResourceListResultPage type. -func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { - return PrivateLinkResourceListResultPage{ - fn: getNextPage, - plrlr: cur, - } -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - The private link resource Private link DNS zone name. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plrp.RequiredZoneNames != nil { - objectMap["requiredZoneNames"] = plrp.RequiredZoneNames - } - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionState a collection of information about the state of the connection between -// service consumer and provider. -type PrivateLinkServiceConnectionState struct { - // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'PrivateEndpointServiceConnectionStatusPending', 'PrivateEndpointServiceConnectionStatusApproved', 'PrivateEndpointServiceConnectionStatusRejected' - Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` - // Description - The reason for approval/rejection of the connection. - Description *string `json:"description,omitempty"` - // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RegistrationInfo represents a RegistrationInfo definition. -type RegistrationInfo struct { - autorest.Response `json:"-"` - // ExpirationTime - Expiration time of registration token. - ExpirationTime *date.Time `json:"expirationTime,omitempty"` - // Token - The registration token base64 encoded string. - Token *string `json:"token,omitempty"` - // RegistrationTokenOperation - The type of resetting the token. Possible values include: 'RegistrationTokenOperationDelete', 'RegistrationTokenOperationNone', 'RegistrationTokenOperationUpdate' - RegistrationTokenOperation RegistrationTokenOperation `json:"registrationTokenOperation,omitempty"` -} - -// RegistrationInfoPatch represents a RegistrationInfo definition. -type RegistrationInfoPatch struct { - // ExpirationTime - Expiration time of registration token. - ExpirationTime *date.Time `json:"expirationTime,omitempty"` - // RegistrationTokenOperation - The type of resetting the token. Possible values include: 'RegistrationTokenOperationDelete', 'RegistrationTokenOperationNone', 'RegistrationTokenOperationUpdate' - RegistrationTokenOperation RegistrationTokenOperation `json:"registrationTokenOperation,omitempty"` -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed -// properties for a resource. Except properties bag, there cannot be a top level property outside of this -// set. -type ResourceModelWithAllowedPropertySet struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. - ManagedBy *string `json:"managedBy,omitempty"` - // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` - Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. -func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rmwaps.Location != nil { - objectMap["location"] = rmwaps.Location - } - if rmwaps.ManagedBy != nil { - objectMap["managedBy"] = rmwaps.ManagedBy - } - if rmwaps.Kind != nil { - objectMap["kind"] = rmwaps.Kind - } - if rmwaps.Tags != nil { - objectMap["tags"] = rmwaps.Tags - } - if rmwaps.Identity != nil { - objectMap["identity"] = rmwaps.Identity - } - if rmwaps.Sku != nil { - objectMap["sku"] = rmwaps.Sku - } - if rmwaps.Plan != nil { - objectMap["plan"] = rmwaps.Plan - } - return json.Marshal(objectMap) -} - -// ResourceModelWithAllowedPropertySetIdentity ... -type ResourceModelWithAllowedPropertySetIdentity struct { - // PrincipalID - READ-ONLY; The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned' - Type ResourceIdentityType `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity. -func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rmwaps.Type != "" { - objectMap["type"] = rmwaps.Type - } - return json.Marshal(objectMap) -} - -// ResourceModelWithAllowedPropertySetPlan ... -type ResourceModelWithAllowedPropertySetPlan struct { - // Name - A user defined name of the 3rd Party Artifact that is being procured. - Name *string `json:"name,omitempty"` - // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic - Publisher *string `json:"publisher,omitempty"` - // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. - Product *string `json:"product,omitempty"` - // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. - PromotionCode *string `json:"promotionCode,omitempty"` - // Version - The version of the desired product/artifact. - Version *string `json:"version,omitempty"` -} - -// ResourceModelWithAllowedPropertySetSku ... -type ResourceModelWithAllowedPropertySetSku struct { - // Name - The name of the SKU. Ex - P3. It is typically a letter+number code - Name *string `json:"name,omitempty"` - // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'SkuTierFree', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' - Tier SkuTier `json:"tier,omitempty"` - // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. - Size *string `json:"size,omitempty"` - // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. - Family *string `json:"family,omitempty"` - // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. - Capacity *int32 `json:"capacity,omitempty"` -} - -// ResourceProviderOperation supported operation of this resource provider. -type ResourceProviderOperation struct { - // Name - Operation name, in format of {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *ResourceProviderOperationDisplay `json:"display,omitempty"` - // IsDataAction - Is a data action. - IsDataAction *bool `json:"isDataAction,omitempty"` - Properties *OperationProperties `json:"properties,omitempty"` -} - -// ResourceProviderOperationDisplay display metadata associated with the operation. -type ResourceProviderOperationDisplay struct { - // Provider - Resource provider: Microsoft Desktop Virtualization. - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - Type of operation: get, read, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - Description of this operation. - Description *string `json:"description,omitempty"` -} - -// ResourceProviderOperationList result of the request to list operations. -type ResourceProviderOperationList struct { - autorest.Response `json:"-"` - // Value - List of operations supported by this resource provider. - Value *[]ResourceProviderOperation `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceProviderOperationList. -func (rpol ResourceProviderOperationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rpol.Value != nil { - objectMap["value"] = rpol.Value - } - return json.Marshal(objectMap) -} - -// ResourceProviderOperationListIterator provides access to a complete listing of ResourceProviderOperation -// values. -type ResourceProviderOperationListIterator struct { - i int - page ResourceProviderOperationListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ResourceProviderOperationListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ResourceProviderOperationListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ResourceProviderOperationListIterator) Response() ResourceProviderOperationList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ResourceProviderOperationListIterator) Value() ResourceProviderOperation { - if !iter.page.NotDone() { - return ResourceProviderOperation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ResourceProviderOperationListIterator type. -func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator { - return ResourceProviderOperationListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rpol ResourceProviderOperationList) IsEmpty() bool { - return rpol.Value == nil || len(*rpol.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rpol ResourceProviderOperationList) hasNextLink() bool { - return rpol.NextLink != nil && len(*rpol.NextLink) != 0 -} - -// resourceProviderOperationListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) { - if !rpol.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rpol.NextLink))) -} - -// ResourceProviderOperationListPage contains a page of ResourceProviderOperation values. -type ResourceProviderOperationListPage struct { - fn func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error) - rpol ResourceProviderOperationList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rpol) - if err != nil { - return err - } - page.rpol = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ResourceProviderOperationListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ResourceProviderOperationListPage) NotDone() bool { - return !page.rpol.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList { - return page.rpol -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation { - if page.rpol.IsEmpty() { - return nil - } - return *page.rpol.Value -} - -// Creates a new instance of the ResourceProviderOperationListPage type. -func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage { - return ResourceProviderOperationListPage{ - fn: getNextPage, - rpol: cur, - } -} - -// ScalingHostPoolReference scaling plan reference to hostpool. -type ScalingHostPoolReference struct { - // HostPoolArmPath - Arm path of referenced hostpool. - HostPoolArmPath *string `json:"hostPoolArmPath,omitempty"` - // ScalingPlanEnabled - Is the scaling plan enabled for this hostpool. - ScalingPlanEnabled *bool `json:"scalingPlanEnabled,omitempty"` -} - -// ScalingPlan represents a scaling plan definition. -type ScalingPlan struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ScalingPlanProperties - Detailed properties for scaling plan. - *ScalingPlanProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. - ManagedBy *string `json:"managedBy,omitempty"` - // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` - Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScalingPlan. -func (sp ScalingPlan) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.SystemData != nil { - objectMap["systemData"] = sp.SystemData - } - if sp.ScalingPlanProperties != nil { - objectMap["properties"] = sp.ScalingPlanProperties - } - if sp.Location != nil { - objectMap["location"] = sp.Location - } - if sp.ManagedBy != nil { - objectMap["managedBy"] = sp.ManagedBy - } - if sp.Kind != nil { - objectMap["kind"] = sp.Kind - } - if sp.Tags != nil { - objectMap["tags"] = sp.Tags - } - if sp.Identity != nil { - objectMap["identity"] = sp.Identity - } - if sp.Sku != nil { - objectMap["sku"] = sp.Sku - } - if sp.Plan != nil { - objectMap["plan"] = sp.Plan - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScalingPlan struct. -func (sp *ScalingPlan) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sp.SystemData = &systemData - } - case "properties": - if v != nil { - var scalingPlanProperties ScalingPlanProperties - err = json.Unmarshal(*v, &scalingPlanProperties) - if err != nil { - return err - } - sp.ScalingPlanProperties = &scalingPlanProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sp.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sp.Location = &location - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - sp.ManagedBy = &managedBy - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - sp.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sp.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sp.Tags = tags - } - case "identity": - if v != nil { - var identity ResourceModelWithAllowedPropertySetIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sp.Identity = &identity - } - case "sku": - if v != nil { - var sku ResourceModelWithAllowedPropertySetSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sp.Sku = &sku - } - case "plan": - if v != nil { - var plan ResourceModelWithAllowedPropertySetPlan - err = json.Unmarshal(*v, &plan) - if err != nil { - return err - } - sp.Plan = &plan - } - } - } - - return nil -} - -// ScalingPlanList list of scaling plan definitions. -type ScalingPlanList struct { - autorest.Response `json:"-"` - // Value - List of scaling plan definitions. - Value *[]ScalingPlan `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScalingPlanList. -func (spl ScalingPlanList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spl.Value != nil { - objectMap["value"] = spl.Value - } - return json.Marshal(objectMap) -} - -// ScalingPlanListIterator provides access to a complete listing of ScalingPlan values. -type ScalingPlanListIterator struct { - i int - page ScalingPlanListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ScalingPlanListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlanListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ScalingPlanListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ScalingPlanListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ScalingPlanListIterator) Response() ScalingPlanList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ScalingPlanListIterator) Value() ScalingPlan { - if !iter.page.NotDone() { - return ScalingPlan{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ScalingPlanListIterator type. -func NewScalingPlanListIterator(page ScalingPlanListPage) ScalingPlanListIterator { - return ScalingPlanListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (spl ScalingPlanList) IsEmpty() bool { - return spl.Value == nil || len(*spl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (spl ScalingPlanList) hasNextLink() bool { - return spl.NextLink != nil && len(*spl.NextLink) != 0 -} - -// scalingPlanListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (spl ScalingPlanList) scalingPlanListPreparer(ctx context.Context) (*http.Request, error) { - if !spl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(spl.NextLink))) -} - -// ScalingPlanListPage contains a page of ScalingPlan values. -type ScalingPlanListPage struct { - fn func(context.Context, ScalingPlanList) (ScalingPlanList, error) - spl ScalingPlanList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ScalingPlanListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlanListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.spl) - if err != nil { - return err - } - page.spl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ScalingPlanListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ScalingPlanListPage) NotDone() bool { - return !page.spl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ScalingPlanListPage) Response() ScalingPlanList { - return page.spl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ScalingPlanListPage) Values() []ScalingPlan { - if page.spl.IsEmpty() { - return nil - } - return *page.spl.Value -} - -// Creates a new instance of the ScalingPlanListPage type. -func NewScalingPlanListPage(cur ScalingPlanList, getNextPage func(context.Context, ScalingPlanList) (ScalingPlanList, error)) ScalingPlanListPage { - return ScalingPlanListPage{ - fn: getNextPage, - spl: cur, - } -} - -// ScalingPlanPatch scaling plan properties that can be patched. -type ScalingPlanPatch struct { - // Tags - tags to be updated - Tags map[string]*string `json:"tags"` - // ScalingPlanPatchProperties - Detailed properties for scaling plan - *ScalingPlanPatchProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScalingPlanPatch. -func (spp ScalingPlanPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spp.Tags != nil { - objectMap["tags"] = spp.Tags - } - if spp.ScalingPlanPatchProperties != nil { - objectMap["properties"] = spp.ScalingPlanPatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ScalingPlanPatch struct. -func (spp *ScalingPlanPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - spp.Tags = tags - } - case "properties": - if v != nil { - var scalingPlanPatchProperties ScalingPlanPatchProperties - err = json.Unmarshal(*v, &scalingPlanPatchProperties) - if err != nil { - return err - } - spp.ScalingPlanPatchProperties = &scalingPlanPatchProperties - } - } - } - - return nil -} - -// ScalingPlanPatchProperties scaling plan properties. -type ScalingPlanPatchProperties struct { - // Description - Description of scaling plan. - Description *string `json:"description,omitempty"` - // FriendlyName - User friendly name of scaling plan. - FriendlyName *string `json:"friendlyName,omitempty"` - // TimeZone - Timezone of the scaling plan. - TimeZone *string `json:"timeZone,omitempty"` - // ExclusionTag - Exclusion tag for scaling plan. - ExclusionTag *string `json:"exclusionTag,omitempty"` - // Schedules - List of ScalingSchedule definitions. - Schedules *[]ScalingSchedule `json:"schedules,omitempty"` - // HostPoolReferences - List of ScalingHostPoolReference definitions. - HostPoolReferences *[]ScalingHostPoolReference `json:"hostPoolReferences,omitempty"` -} - -// ScalingPlanProperties scaling plan properties. -type ScalingPlanProperties struct { - // ObjectID - READ-ONLY; ObjectId of scaling plan. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // Description - Description of scaling plan. - Description *string `json:"description,omitempty"` - // FriendlyName - User friendly name of scaling plan. - FriendlyName *string `json:"friendlyName,omitempty"` - // TimeZone - Timezone of the scaling plan. - TimeZone *string `json:"timeZone,omitempty"` - // HostPoolType - HostPool type for desktop. Possible values include: 'ScalingHostPoolTypePooled' - HostPoolType ScalingHostPoolType `json:"hostPoolType,omitempty"` - // ExclusionTag - Exclusion tag for scaling plan. - ExclusionTag *string `json:"exclusionTag,omitempty"` - // Schedules - List of ScalingSchedule definitions. - Schedules *[]ScalingSchedule `json:"schedules,omitempty"` - // HostPoolReferences - List of ScalingHostPoolReference definitions. - HostPoolReferences *[]ScalingHostPoolReference `json:"hostPoolReferences,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScalingPlanProperties. -func (spp ScalingPlanProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spp.Description != nil { - objectMap["description"] = spp.Description - } - if spp.FriendlyName != nil { - objectMap["friendlyName"] = spp.FriendlyName - } - if spp.TimeZone != nil { - objectMap["timeZone"] = spp.TimeZone - } - if spp.HostPoolType != "" { - objectMap["hostPoolType"] = spp.HostPoolType - } - if spp.ExclusionTag != nil { - objectMap["exclusionTag"] = spp.ExclusionTag - } - if spp.Schedules != nil { - objectMap["schedules"] = spp.Schedules - } - if spp.HostPoolReferences != nil { - objectMap["hostPoolReferences"] = spp.HostPoolReferences - } - return json.Marshal(objectMap) -} - -// ScalingSchedule scaling plan schedule. -type ScalingSchedule struct { - // Name - Name of the scaling schedule. - Name *string `json:"name,omitempty"` - // DaysOfWeek - Set of days of the week on which this schedule is active. - DaysOfWeek *[]string `json:"daysOfWeek,omitempty"` - // RampUpStartTime - Starting time for ramp up period. - RampUpStartTime *Time `json:"rampUpStartTime,omitempty"` - // RampUpLoadBalancingAlgorithm - Load balancing algorithm for ramp up period. Possible values include: 'SessionHostLoadBalancingAlgorithmBreadthFirst', 'SessionHostLoadBalancingAlgorithmDepthFirst' - RampUpLoadBalancingAlgorithm SessionHostLoadBalancingAlgorithm `json:"rampUpLoadBalancingAlgorithm,omitempty"` - // RampUpMinimumHostsPct - Minimum host percentage for ramp up period. - RampUpMinimumHostsPct *int32 `json:"rampUpMinimumHostsPct,omitempty"` - // RampUpCapacityThresholdPct - Capacity threshold for ramp up period. - RampUpCapacityThresholdPct *int32 `json:"rampUpCapacityThresholdPct,omitempty"` - // PeakStartTime - Starting time for peak period. - PeakStartTime *Time `json:"peakStartTime,omitempty"` - // PeakLoadBalancingAlgorithm - Load balancing algorithm for peak period. Possible values include: 'SessionHostLoadBalancingAlgorithmBreadthFirst', 'SessionHostLoadBalancingAlgorithmDepthFirst' - PeakLoadBalancingAlgorithm SessionHostLoadBalancingAlgorithm `json:"peakLoadBalancingAlgorithm,omitempty"` - // RampDownStartTime - Starting time for ramp down period. - RampDownStartTime *Time `json:"rampDownStartTime,omitempty"` - // RampDownLoadBalancingAlgorithm - Load balancing algorithm for ramp down period. Possible values include: 'SessionHostLoadBalancingAlgorithmBreadthFirst', 'SessionHostLoadBalancingAlgorithmDepthFirst' - RampDownLoadBalancingAlgorithm SessionHostLoadBalancingAlgorithm `json:"rampDownLoadBalancingAlgorithm,omitempty"` - // RampDownMinimumHostsPct - Minimum host percentage for ramp down period. - RampDownMinimumHostsPct *int32 `json:"rampDownMinimumHostsPct,omitempty"` - // RampDownCapacityThresholdPct - Capacity threshold for ramp down period. - RampDownCapacityThresholdPct *int32 `json:"rampDownCapacityThresholdPct,omitempty"` - // RampDownForceLogoffUsers - Should users be logged off forcefully from hosts. - RampDownForceLogoffUsers *bool `json:"rampDownForceLogoffUsers,omitempty"` - // RampDownStopHostsWhen - Specifies when to stop hosts during ramp down period. Possible values include: 'StopHostsWhenZeroSessions', 'StopHostsWhenZeroActiveSessions' - RampDownStopHostsWhen StopHostsWhen `json:"rampDownStopHostsWhen,omitempty"` - // RampDownWaitTimeMinutes - Number of minutes to wait to stop hosts during ramp down period. - RampDownWaitTimeMinutes *int32 `json:"rampDownWaitTimeMinutes,omitempty"` - // RampDownNotificationMessage - Notification message for users during ramp down period. - RampDownNotificationMessage *string `json:"rampDownNotificationMessage,omitempty"` - // OffPeakStartTime - Starting time for off-peak period. - OffPeakStartTime *Time `json:"offPeakStartTime,omitempty"` - // OffPeakLoadBalancingAlgorithm - Load balancing algorithm for off-peak period. Possible values include: 'SessionHostLoadBalancingAlgorithmBreadthFirst', 'SessionHostLoadBalancingAlgorithmDepthFirst' - OffPeakLoadBalancingAlgorithm SessionHostLoadBalancingAlgorithm `json:"offPeakLoadBalancingAlgorithm,omitempty"` -} - -// SendMessage represents message sent to a UserSession. -type SendMessage struct { - // MessageTitle - Title of message. - MessageTitle *string `json:"messageTitle,omitempty"` - // MessageBody - Body of message. - MessageBody *string `json:"messageBody,omitempty"` -} - -// ServiceSpecification service specification payload -type ServiceSpecification struct { - // LogSpecifications - Specifications of the Log for Azure Monitoring - LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` -} - -// SessionHost represents a SessionHost definition. -type SessionHost struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // SessionHostProperties - Detailed properties for SessionHost - *SessionHostProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SessionHost. -func (sh SessionHost) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sh.SystemData != nil { - objectMap["systemData"] = sh.SystemData - } - if sh.SessionHostProperties != nil { - objectMap["properties"] = sh.SessionHostProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SessionHost struct. -func (sh *SessionHost) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sh.SystemData = &systemData - } - case "properties": - if v != nil { - var sessionHostProperties SessionHostProperties - err = json.Unmarshal(*v, &sessionHostProperties) - if err != nil { - return err - } - sh.SessionHostProperties = &sessionHostProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sh.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sh.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sh.Type = &typeVar - } - } - } - - return nil -} - -// SessionHostHealthCheckFailureDetails contains details on the failure. -type SessionHostHealthCheckFailureDetails struct { - // Message - READ-ONLY; Failure message: hints on what is wrong and how to recover. - Message *string `json:"message,omitempty"` - // ErrorCode - READ-ONLY; Error code corresponding for the failure. - ErrorCode *int32 `json:"errorCode,omitempty"` - // LastHealthCheckDateTime - READ-ONLY; The timestamp of the last update. - LastHealthCheckDateTime *date.Time `json:"lastHealthCheckDateTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for SessionHostHealthCheckFailureDetails. -func (shhcfd SessionHostHealthCheckFailureDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SessionHostHealthCheckReport the report for session host information. -type SessionHostHealthCheckReport struct { - // HealthCheckName - READ-ONLY; Represents the name of the health check operation performed. Possible values include: 'HealthCheckNameDomainJoinedCheck', 'HealthCheckNameDomainTrustCheck', 'HealthCheckNameFSLogixHealthCheck', 'HealthCheckNameSxSStackListenerCheck', 'HealthCheckNameUrlsAccessibleCheck', 'HealthCheckNameMonitoringAgentCheck', 'HealthCheckNameDomainReachable', 'HealthCheckNameWebRTCRedirectorCheck', 'HealthCheckNameSupportedEncryptionCheck', 'HealthCheckNameMetaDataServiceCheck', 'HealthCheckNameAppAttachHealthCheck' - HealthCheckName HealthCheckName `json:"healthCheckName,omitempty"` - // HealthCheckResult - READ-ONLY; Represents the Health state of the health check we performed. Possible values include: 'HealthCheckResultUnknown', 'HealthCheckResultHealthCheckSucceeded', 'HealthCheckResultHealthCheckFailed', 'HealthCheckResultSessionHostShutdown' - HealthCheckResult HealthCheckResult `json:"healthCheckResult,omitempty"` - // AdditionalFailureDetails - READ-ONLY; Additional detailed information on the failure. - AdditionalFailureDetails *SessionHostHealthCheckFailureDetails `json:"additionalFailureDetails,omitempty"` -} - -// MarshalJSON is the custom marshaler for SessionHostHealthCheckReport. -func (shhcr SessionHostHealthCheckReport) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SessionHostList list of SessionHost definitions. -type SessionHostList struct { - autorest.Response `json:"-"` - // Value - List of SessionHost definitions. - Value *[]SessionHost `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for SessionHostList. -func (shl SessionHostList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if shl.Value != nil { - objectMap["value"] = shl.Value - } - return json.Marshal(objectMap) -} - -// SessionHostListIterator provides access to a complete listing of SessionHost values. -type SessionHostListIterator struct { - i int - page SessionHostListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SessionHostListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionHostListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SessionHostListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SessionHostListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SessionHostListIterator) Response() SessionHostList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SessionHostListIterator) Value() SessionHost { - if !iter.page.NotDone() { - return SessionHost{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SessionHostListIterator type. -func NewSessionHostListIterator(page SessionHostListPage) SessionHostListIterator { - return SessionHostListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (shl SessionHostList) IsEmpty() bool { - return shl.Value == nil || len(*shl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (shl SessionHostList) hasNextLink() bool { - return shl.NextLink != nil && len(*shl.NextLink) != 0 -} - -// sessionHostListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (shl SessionHostList) sessionHostListPreparer(ctx context.Context) (*http.Request, error) { - if !shl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(shl.NextLink))) -} - -// SessionHostListPage contains a page of SessionHost values. -type SessionHostListPage struct { - fn func(context.Context, SessionHostList) (SessionHostList, error) - shl SessionHostList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SessionHostListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionHostListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.shl) - if err != nil { - return err - } - page.shl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SessionHostListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SessionHostListPage) NotDone() bool { - return !page.shl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SessionHostListPage) Response() SessionHostList { - return page.shl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SessionHostListPage) Values() []SessionHost { - if page.shl.IsEmpty() { - return nil - } - return *page.shl.Value -} - -// Creates a new instance of the SessionHostListPage type. -func NewSessionHostListPage(cur SessionHostList, getNextPage func(context.Context, SessionHostList) (SessionHostList, error)) SessionHostListPage { - return SessionHostListPage{ - fn: getNextPage, - shl: cur, - } -} - -// SessionHostPatch sessionHost properties that can be patched. -type SessionHostPatch struct { - // SessionHostPatchProperties - Detailed properties for SessionHost - *SessionHostPatchProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SessionHostPatch. -func (shp SessionHostPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if shp.SessionHostPatchProperties != nil { - objectMap["properties"] = shp.SessionHostPatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SessionHostPatch struct. -func (shp *SessionHostPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var sessionHostPatchProperties SessionHostPatchProperties - err = json.Unmarshal(*v, &sessionHostPatchProperties) - if err != nil { - return err - } - shp.SessionHostPatchProperties = &sessionHostPatchProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - shp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - shp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - shp.Type = &typeVar - } - } - } - - return nil -} - -// SessionHostPatchProperties sessionHost properties that can be patched. -type SessionHostPatchProperties struct { - // AllowNewSession - Allow a new session. - AllowNewSession *bool `json:"allowNewSession,omitempty"` - // AssignedUser - User assigned to SessionHost. - AssignedUser *string `json:"assignedUser,omitempty"` -} - -// SessionHostProperties schema for SessionHost properties. -type SessionHostProperties struct { - // ObjectID - READ-ONLY; ObjectId of SessionHost. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // LastHeartBeat - Last heart beat from SessionHost. - LastHeartBeat *date.Time `json:"lastHeartBeat,omitempty"` - // Sessions - Number of sessions on SessionHost. - Sessions *int32 `json:"sessions,omitempty"` - // AgentVersion - Version of agent on SessionHost. - AgentVersion *string `json:"agentVersion,omitempty"` - // AllowNewSession - Allow a new session. - AllowNewSession *bool `json:"allowNewSession,omitempty"` - // VirtualMachineID - READ-ONLY; Virtual Machine Id of SessionHost's underlying virtual machine. - VirtualMachineID *string `json:"virtualMachineId,omitempty"` - // ResourceID - READ-ONLY; Resource Id of SessionHost's underlying virtual machine. - ResourceID *string `json:"resourceId,omitempty"` - // AssignedUser - User assigned to SessionHost. - AssignedUser *string `json:"assignedUser,omitempty"` - // Status - Status for a SessionHost. Possible values include: 'StatusAvailable', 'StatusUnavailable', 'StatusShutdown', 'StatusDisconnected', 'StatusUpgrading', 'StatusUpgradeFailed', 'StatusNoHeartbeat', 'StatusNotJoinedToDomain', 'StatusDomainTrustRelationshipLost', 'StatusSxSStackListenerNotReady', 'StatusFSLogixNotHealthy', 'StatusNeedsAssistance' - Status Status `json:"status,omitempty"` - // StatusTimestamp - READ-ONLY; The timestamp of the status. - StatusTimestamp *date.Time `json:"statusTimestamp,omitempty"` - // OsVersion - The version of the OS on the session host. - OsVersion *string `json:"osVersion,omitempty"` - // SxSStackVersion - The version of the side by side stack on the session host. - SxSStackVersion *string `json:"sxSStackVersion,omitempty"` - // UpdateState - Update state of a SessionHost. Possible values include: 'UpdateStateInitial', 'UpdateStatePending', 'UpdateStateStarted', 'UpdateStateSucceeded', 'UpdateStateFailed' - UpdateState UpdateState `json:"updateState,omitempty"` - // LastUpdateTime - READ-ONLY; The timestamp of the last update. - LastUpdateTime *date.Time `json:"lastUpdateTime,omitempty"` - // UpdateErrorMessage - The error message. - UpdateErrorMessage *string `json:"updateErrorMessage,omitempty"` - // SessionHostHealthCheckResults - READ-ONLY; List of SessionHostHealthCheckReports - SessionHostHealthCheckResults *[]SessionHostHealthCheckReport `json:"sessionHostHealthCheckResults,omitempty"` -} - -// MarshalJSON is the custom marshaler for SessionHostProperties. -func (shp SessionHostProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if shp.LastHeartBeat != nil { - objectMap["lastHeartBeat"] = shp.LastHeartBeat - } - if shp.Sessions != nil { - objectMap["sessions"] = shp.Sessions - } - if shp.AgentVersion != nil { - objectMap["agentVersion"] = shp.AgentVersion - } - if shp.AllowNewSession != nil { - objectMap["allowNewSession"] = shp.AllowNewSession - } - if shp.AssignedUser != nil { - objectMap["assignedUser"] = shp.AssignedUser - } - if shp.Status != "" { - objectMap["status"] = shp.Status - } - if shp.OsVersion != nil { - objectMap["osVersion"] = shp.OsVersion - } - if shp.SxSStackVersion != nil { - objectMap["sxSStackVersion"] = shp.SxSStackVersion - } - if shp.UpdateState != "" { - objectMap["updateState"] = shp.UpdateState - } - if shp.UpdateErrorMessage != nil { - objectMap["updateErrorMessage"] = shp.UpdateErrorMessage - } - return json.Marshal(objectMap) -} - -// Sku the resource model definition representing SKU -type Sku struct { - // Name - The name of the SKU. Ex - P3. It is typically a letter+number code - Name *string `json:"name,omitempty"` - // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'SkuTierFree', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' - Tier SkuTier `json:"tier,omitempty"` - // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. - Size *string `json:"size,omitempty"` - // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. - Family *string `json:"family,omitempty"` - // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. - Capacity *int32 `json:"capacity,omitempty"` -} - -// StartMenuItem represents a StartMenuItem definition. -type StartMenuItem struct { - // StartMenuItemProperties - Detailed properties for StartMenuItem - *StartMenuItemProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for StartMenuItem. -func (smi StartMenuItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smi.StartMenuItemProperties != nil { - objectMap["properties"] = smi.StartMenuItemProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for StartMenuItem struct. -func (smi *StartMenuItem) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var startMenuItemProperties StartMenuItemProperties - err = json.Unmarshal(*v, &startMenuItemProperties) - if err != nil { - return err - } - smi.StartMenuItemProperties = &startMenuItemProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - smi.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - smi.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - smi.Type = &typeVar - } - } - } - - return nil -} - -// StartMenuItemList list of StartMenuItem definitions. -type StartMenuItemList struct { - autorest.Response `json:"-"` - // Value - List of StartMenuItem definitions. - Value *[]StartMenuItem `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for StartMenuItemList. -func (smil StartMenuItemList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smil.Value != nil { - objectMap["value"] = smil.Value - } - return json.Marshal(objectMap) -} - -// StartMenuItemListIterator provides access to a complete listing of StartMenuItem values. -type StartMenuItemListIterator struct { - i int - page StartMenuItemListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *StartMenuItemListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/StartMenuItemListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *StartMenuItemListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter StartMenuItemListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter StartMenuItemListIterator) Response() StartMenuItemList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter StartMenuItemListIterator) Value() StartMenuItem { - if !iter.page.NotDone() { - return StartMenuItem{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the StartMenuItemListIterator type. -func NewStartMenuItemListIterator(page StartMenuItemListPage) StartMenuItemListIterator { - return StartMenuItemListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (smil StartMenuItemList) IsEmpty() bool { - return smil.Value == nil || len(*smil.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (smil StartMenuItemList) hasNextLink() bool { - return smil.NextLink != nil && len(*smil.NextLink) != 0 -} - -// startMenuItemListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (smil StartMenuItemList) startMenuItemListPreparer(ctx context.Context) (*http.Request, error) { - if !smil.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(smil.NextLink))) -} - -// StartMenuItemListPage contains a page of StartMenuItem values. -type StartMenuItemListPage struct { - fn func(context.Context, StartMenuItemList) (StartMenuItemList, error) - smil StartMenuItemList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *StartMenuItemListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/StartMenuItemListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.smil) - if err != nil { - return err - } - page.smil = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *StartMenuItemListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page StartMenuItemListPage) NotDone() bool { - return !page.smil.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page StartMenuItemListPage) Response() StartMenuItemList { - return page.smil -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page StartMenuItemListPage) Values() []StartMenuItem { - if page.smil.IsEmpty() { - return nil - } - return *page.smil.Value -} - -// Creates a new instance of the StartMenuItemListPage type. -func NewStartMenuItemListPage(cur StartMenuItemList, getNextPage func(context.Context, StartMenuItemList) (StartMenuItemList, error)) StartMenuItemListPage { - return StartMenuItemListPage{ - fn: getNextPage, - smil: cur, - } -} - -// StartMenuItemProperties schema for StartMenuItem properties. -type StartMenuItemProperties struct { - // AppAlias - Alias of StartMenuItem. - AppAlias *string `json:"appAlias,omitempty"` - // FilePath - Path to the file of StartMenuItem. - FilePath *string `json:"filePath,omitempty"` - // CommandLineArguments - Command line arguments for StartMenuItem. - CommandLineArguments *string `json:"commandLineArguments,omitempty"` - // IconPath - Path to the icon. - IconPath *string `json:"iconPath,omitempty"` - // IconIndex - Index of the icon. - IconIndex *int32 `json:"iconIndex,omitempty"` -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// Time the time for a scaling action to occur. -type Time struct { - // Hour - The hour. - Hour *int32 `json:"hour,omitempty"` - // Minute - The minute. - Minute *int32 `json:"minute,omitempty"` -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// UserSession represents a UserSession definition. -type UserSession struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // UserSessionProperties - Detailed properties for UserSession - *UserSessionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserSession. -func (us UserSession) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if us.SystemData != nil { - objectMap["systemData"] = us.SystemData - } - if us.UserSessionProperties != nil { - objectMap["properties"] = us.UserSessionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for UserSession struct. -func (us *UserSession) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - us.SystemData = &systemData - } - case "properties": - if v != nil { - var userSessionProperties UserSessionProperties - err = json.Unmarshal(*v, &userSessionProperties) - if err != nil { - return err - } - us.UserSessionProperties = &userSessionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - us.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - us.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - us.Type = &typeVar - } - } - } - - return nil -} - -// UserSessionList list of UserSession definitions. -type UserSessionList struct { - autorest.Response `json:"-"` - // Value - List of UserSession definitions. - Value *[]UserSession `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserSessionList. -func (usl UserSessionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if usl.Value != nil { - objectMap["value"] = usl.Value - } - return json.Marshal(objectMap) -} - -// UserSessionListIterator provides access to a complete listing of UserSession values. -type UserSessionListIterator struct { - i int - page UserSessionListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *UserSessionListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *UserSessionListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter UserSessionListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter UserSessionListIterator) Response() UserSessionList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter UserSessionListIterator) Value() UserSession { - if !iter.page.NotDone() { - return UserSession{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the UserSessionListIterator type. -func NewUserSessionListIterator(page UserSessionListPage) UserSessionListIterator { - return UserSessionListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (usl UserSessionList) IsEmpty() bool { - return usl.Value == nil || len(*usl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (usl UserSessionList) hasNextLink() bool { - return usl.NextLink != nil && len(*usl.NextLink) != 0 -} - -// userSessionListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (usl UserSessionList) userSessionListPreparer(ctx context.Context) (*http.Request, error) { - if !usl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(usl.NextLink))) -} - -// UserSessionListPage contains a page of UserSession values. -type UserSessionListPage struct { - fn func(context.Context, UserSessionList) (UserSessionList, error) - usl UserSessionList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *UserSessionListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.usl) - if err != nil { - return err - } - page.usl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *UserSessionListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page UserSessionListPage) NotDone() bool { - return !page.usl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page UserSessionListPage) Response() UserSessionList { - return page.usl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page UserSessionListPage) Values() []UserSession { - if page.usl.IsEmpty() { - return nil - } - return *page.usl.Value -} - -// Creates a new instance of the UserSessionListPage type. -func NewUserSessionListPage(cur UserSessionList, getNextPage func(context.Context, UserSessionList) (UserSessionList, error)) UserSessionListPage { - return UserSessionListPage{ - fn: getNextPage, - usl: cur, - } -} - -// UserSessionProperties schema for UserSession properties. -type UserSessionProperties struct { - // ObjectID - READ-ONLY; ObjectId of user session. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // UserPrincipalName - The user principal name. - UserPrincipalName *string `json:"userPrincipalName,omitempty"` - // ApplicationType - Application type of application. Possible values include: 'ApplicationTypeRemoteApp', 'ApplicationTypeDesktop' - ApplicationType ApplicationType `json:"applicationType,omitempty"` - // SessionState - State of user session. Possible values include: 'SessionStateUnknown', 'SessionStateActive', 'SessionStateDisconnected', 'SessionStatePending', 'SessionStateLogOff', 'SessionStateUserProfileDiskMounted' - SessionState SessionState `json:"sessionState,omitempty"` - // ActiveDirectoryUserName - The active directory user name. - ActiveDirectoryUserName *string `json:"activeDirectoryUserName,omitempty"` - // CreateTime - The timestamp of the user session create. - CreateTime *date.Time `json:"createTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserSessionProperties. -func (usp UserSessionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if usp.UserPrincipalName != nil { - objectMap["userPrincipalName"] = usp.UserPrincipalName - } - if usp.ApplicationType != "" { - objectMap["applicationType"] = usp.ApplicationType - } - if usp.SessionState != "" { - objectMap["sessionState"] = usp.SessionState - } - if usp.ActiveDirectoryUserName != nil { - objectMap["activeDirectoryUserName"] = usp.ActiveDirectoryUserName - } - if usp.CreateTime != nil { - objectMap["createTime"] = usp.CreateTime - } - return json.Marshal(objectMap) -} - -// Workspace represents a Workspace definition. -type Workspace struct { - autorest.Response `json:"-"` - // SystemData - Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty"` - // WorkspaceProperties - Detailed properties for Workspace - *WorkspaceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. - ManagedBy *string `json:"managedBy,omitempty"` - // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - Kind *string `json:"kind,omitempty"` - // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` - Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` - Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` -} - -// MarshalJSON is the custom marshaler for Workspace. -func (w Workspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.SystemData != nil { - objectMap["systemData"] = w.SystemData - } - if w.WorkspaceProperties != nil { - objectMap["properties"] = w.WorkspaceProperties - } - if w.Location != nil { - objectMap["location"] = w.Location - } - if w.ManagedBy != nil { - objectMap["managedBy"] = w.ManagedBy - } - if w.Kind != nil { - objectMap["kind"] = w.Kind - } - if w.Tags != nil { - objectMap["tags"] = w.Tags - } - if w.Identity != nil { - objectMap["identity"] = w.Identity - } - if w.Sku != nil { - objectMap["sku"] = w.Sku - } - if w.Plan != nil { - objectMap["plan"] = w.Plan - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Workspace struct. -func (w *Workspace) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - w.SystemData = &systemData - } - case "properties": - if v != nil { - var workspaceProperties WorkspaceProperties - err = json.Unmarshal(*v, &workspaceProperties) - if err != nil { - return err - } - w.WorkspaceProperties = &workspaceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - w.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - w.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - w.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - w.Location = &location - } - case "managedBy": - if v != nil { - var managedBy string - err = json.Unmarshal(*v, &managedBy) - if err != nil { - return err - } - w.ManagedBy = &managedBy - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - w.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - w.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - w.Tags = tags - } - case "identity": - if v != nil { - var identity ResourceModelWithAllowedPropertySetIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - w.Identity = &identity - } - case "sku": - if v != nil { - var sku ResourceModelWithAllowedPropertySetSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - w.Sku = &sku - } - case "plan": - if v != nil { - var plan ResourceModelWithAllowedPropertySetPlan - err = json.Unmarshal(*v, &plan) - if err != nil { - return err - } - w.Plan = &plan - } - } - } - - return nil -} - -// WorkspaceList list of Workspace definitions. -type WorkspaceList struct { - autorest.Response `json:"-"` - // Value - List of Workspace definitions. - Value *[]Workspace `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspaceList. -func (wl WorkspaceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wl.Value != nil { - objectMap["value"] = wl.Value - } - return json.Marshal(objectMap) -} - -// WorkspaceListIterator provides access to a complete listing of Workspace values. -type WorkspaceListIterator struct { - i int - page WorkspaceListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *WorkspaceListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *WorkspaceListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WorkspaceListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter WorkspaceListIterator) Response() WorkspaceList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter WorkspaceListIterator) Value() Workspace { - if !iter.page.NotDone() { - return Workspace{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WorkspaceListIterator type. -func NewWorkspaceListIterator(page WorkspaceListPage) WorkspaceListIterator { - return WorkspaceListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wl WorkspaceList) IsEmpty() bool { - return wl.Value == nil || len(*wl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wl WorkspaceList) hasNextLink() bool { - return wl.NextLink != nil && len(*wl.NextLink) != 0 -} - -// workspaceListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wl WorkspaceList) workspaceListPreparer(ctx context.Context) (*http.Request, error) { - if !wl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wl.NextLink))) -} - -// WorkspaceListPage contains a page of Workspace values. -type WorkspaceListPage struct { - fn func(context.Context, WorkspaceList) (WorkspaceList, error) - wl WorkspaceList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *WorkspaceListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.wl) - if err != nil { - return err - } - page.wl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *WorkspaceListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WorkspaceListPage) NotDone() bool { - return !page.wl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WorkspaceListPage) Response() WorkspaceList { - return page.wl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WorkspaceListPage) Values() []Workspace { - if page.wl.IsEmpty() { - return nil - } - return *page.wl.Value -} - -// Creates a new instance of the WorkspaceListPage type. -func NewWorkspaceListPage(cur WorkspaceList, getNextPage func(context.Context, WorkspaceList) (WorkspaceList, error)) WorkspaceListPage { - return WorkspaceListPage{ - fn: getNextPage, - wl: cur, - } -} - -// WorkspacePatch workspace properties that can be patched. -type WorkspacePatch struct { - // Tags - tags to be updated - Tags map[string]*string `json:"tags"` - // WorkspacePatchProperties - Detailed properties for Workspace - *WorkspacePatchProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspacePatch. -func (wp WorkspacePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.Tags != nil { - objectMap["tags"] = wp.Tags - } - if wp.WorkspacePatchProperties != nil { - objectMap["properties"] = wp.WorkspacePatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WorkspacePatch struct. -func (wp *WorkspacePatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - wp.Tags = tags - } - case "properties": - if v != nil { - var workspacePatchProperties WorkspacePatchProperties - err = json.Unmarshal(*v, &workspacePatchProperties) - if err != nil { - return err - } - wp.WorkspacePatchProperties = &workspacePatchProperties - } - } - } - - return nil -} - -// WorkspacePatchProperties workspace properties that can be patched. -type WorkspacePatchProperties struct { - // Description - Description of Workspace. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of Workspace. - FriendlyName *string `json:"friendlyName,omitempty"` - // ApplicationGroupReferences - List of applicationGroup links. - ApplicationGroupReferences *[]string `json:"applicationGroupReferences,omitempty"` - // PublicNetworkAccess - Enabled to allow this resource to be access from the public network. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// WorkspaceProperties schema for Workspace properties. -type WorkspaceProperties struct { - // ObjectID - READ-ONLY; ObjectId of Workspace. (internal use) - ObjectID *string `json:"objectId,omitempty"` - // Description - Description of Workspace. - Description *string `json:"description,omitempty"` - // FriendlyName - Friendly name of Workspace. - FriendlyName *string `json:"friendlyName,omitempty"` - // ApplicationGroupReferences - List of applicationGroup resource Ids. - ApplicationGroupReferences *[]string `json:"applicationGroupReferences,omitempty"` - // CloudPcResource - READ-ONLY; Is cloud pc resource. - CloudPcResource *bool `json:"cloudPcResource,omitempty"` - // PublicNetworkAccess - Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkspaceProperties. -func (wp WorkspaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.Description != nil { - objectMap["description"] = wp.Description - } - if wp.FriendlyName != nil { - objectMap["friendlyName"] = wp.FriendlyName - } - if wp.ApplicationGroupReferences != nil { - objectMap["applicationGroupReferences"] = wp.ApplicationGroupReferences - } - if wp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = wp.PublicNetworkAccess - } - return json.Marshal(objectMap) -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/msiximages.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/msiximages.go deleted file mode 100644 index ae7b4d38218..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/msiximages.go +++ /dev/null @@ -1,165 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MsixImagesClient is the client for the MsixImages methods of the Desktopvirtualization service. -type MsixImagesClient struct { - BaseClient -} - -// NewMsixImagesClient creates an instance of the MsixImagesClient client. -func NewMsixImagesClient(subscriptionID string) MsixImagesClient { - return NewMsixImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMsixImagesClientWithBaseURI creates an instance of the MsixImagesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewMsixImagesClientWithBaseURI(baseURI string, subscriptionID string) MsixImagesClient { - return MsixImagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Expand expands and Lists MSIX packages in an Image, given the Image Path. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// msixImageURI - object containing URI to MSIX Image -func (client MsixImagesClient) Expand(ctx context.Context, resourceGroupName string, hostPoolName string, msixImageURI MSIXImageURI) (result ExpandMsixImageListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MsixImagesClient.Expand") - defer func() { - sc := -1 - if result.emil.Response.Response != nil { - sc = result.emil.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.MsixImagesClient", "Expand", err.Error()) - } - - result.fn = client.expandNextResults - req, err := client.ExpandPreparer(ctx, resourceGroupName, hostPoolName, msixImageURI) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MsixImagesClient", "Expand", nil, "Failure preparing request") - return - } - - resp, err := client.ExpandSender(req) - if err != nil { - result.emil.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.MsixImagesClient", "Expand", resp, "Failure sending request") - return - } - - result.emil, err = client.ExpandResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MsixImagesClient", "Expand", resp, "Failure responding to request") - return - } - if result.emil.hasNextLink() && result.emil.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ExpandPreparer prepares the Expand request. -func (client MsixImagesClient) ExpandPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, msixImageURI MSIXImageURI) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage", pathParameters), - autorest.WithJSON(msixImageURI), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ExpandSender sends the Expand request. The method will close the -// http.Response Body if it receives an error. -func (client MsixImagesClient) ExpandSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ExpandResponder handles the response to the Expand request. The method always -// closes the http.Response Body. -func (client MsixImagesClient) ExpandResponder(resp *http.Response) (result ExpandMsixImageList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// expandNextResults retrieves the next set of results, if any. -func (client MsixImagesClient) expandNextResults(ctx context.Context, lastResults ExpandMsixImageList) (result ExpandMsixImageList, err error) { - req, err := lastResults.expandMsixImageListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.MsixImagesClient", "expandNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ExpandSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.MsixImagesClient", "expandNextResults", resp, "Failure sending next results request") - } - result, err = client.ExpandResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MsixImagesClient", "expandNextResults", resp, "Failure responding to next results request") - } - return -} - -// ExpandComplete enumerates all values, automatically crossing page boundaries as required. -func (client MsixImagesClient) ExpandComplete(ctx context.Context, resourceGroupName string, hostPoolName string, msixImageURI MSIXImageURI) (result ExpandMsixImageListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MsixImagesClient.Expand") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.Expand(ctx, resourceGroupName, hostPoolName, msixImageURI) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/msixpackages.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/msixpackages.go deleted file mode 100644 index 2883ff86a0a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/msixpackages.go +++ /dev/null @@ -1,544 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MSIXPackagesClient is the client for the MSIXPackages methods of the Desktopvirtualization service. -type MSIXPackagesClient struct { - BaseClient -} - -// NewMSIXPackagesClient creates an instance of the MSIXPackagesClient client. -func NewMSIXPackagesClient(subscriptionID string) MSIXPackagesClient { - return NewMSIXPackagesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMSIXPackagesClientWithBaseURI creates an instance of the MSIXPackagesClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewMSIXPackagesClientWithBaseURI(baseURI string, subscriptionID string) MSIXPackagesClient { - return MSIXPackagesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a MSIX package. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// msixPackageFullName - the version specific package full name of the MSIX package within specified hostpool -// msixPackage - object containing MSIX Package definitions. -func (client MSIXPackagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string, msixPackage MSIXPackage) (result MSIXPackage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackagesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: msixPackageFullName, - Constraints: []validation.Constraint{{Target: "msixPackageFullName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "msixPackageFullName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: msixPackage, - Constraints: []validation.Constraint{{Target: "msixPackage.MSIXPackageProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.MSIXPackagesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, hostPoolName, msixPackageFullName, msixPackage) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client MSIXPackagesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string, msixPackage MSIXPackage) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "msixPackageFullName": autorest.Encode("path", msixPackageFullName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", pathParameters), - autorest.WithJSON(msixPackage), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client MSIXPackagesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client MSIXPackagesClient) CreateOrUpdateResponder(resp *http.Response) (result MSIXPackage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove an MSIX Package. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// msixPackageFullName - the version specific package full name of the MSIX package within specified hostpool -func (client MSIXPackagesClient) Delete(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackagesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: msixPackageFullName, - Constraints: []validation.Constraint{{Target: "msixPackageFullName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "msixPackageFullName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.MSIXPackagesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, hostPoolName, msixPackageFullName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client MSIXPackagesClient) DeletePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "msixPackageFullName": autorest.Encode("path", msixPackageFullName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client MSIXPackagesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client MSIXPackagesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a msixpackage. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// msixPackageFullName - the version specific package full name of the MSIX package within specified hostpool -func (client MSIXPackagesClient) Get(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string) (result MSIXPackage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackagesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: msixPackageFullName, - Constraints: []validation.Constraint{{Target: "msixPackageFullName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "msixPackageFullName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.MSIXPackagesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, hostPoolName, msixPackageFullName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MSIXPackagesClient) GetPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "msixPackageFullName": autorest.Encode("path", msixPackageFullName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client MSIXPackagesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client MSIXPackagesClient) GetResponder(resp *http.Response) (result MSIXPackage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list MSIX packages in hostpool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -func (client MSIXPackagesClient) List(ctx context.Context, resourceGroupName string, hostPoolName string) (result MSIXPackageListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackagesClient.List") - defer func() { - sc := -1 - if result.mpl.Response.Response != nil { - sc = result.mpl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.MSIXPackagesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, hostPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.mpl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "List", resp, "Failure sending request") - return - } - - result.mpl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "List", resp, "Failure responding to request") - return - } - if result.mpl.hasNextLink() && result.mpl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MSIXPackagesClient) ListPreparer(ctx context.Context, resourceGroupName string, hostPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client MSIXPackagesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client MSIXPackagesClient) ListResponder(resp *http.Response) (result MSIXPackageList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client MSIXPackagesClient) listNextResults(ctx context.Context, lastResults MSIXPackageList) (result MSIXPackageList, err error) { - req, err := lastResults.mSIXPackageListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client MSIXPackagesClient) ListComplete(ctx context.Context, resourceGroupName string, hostPoolName string) (result MSIXPackageListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackagesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, hostPoolName) - return -} - -// Update update an MSIX Package. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// msixPackageFullName - the version specific package full name of the MSIX package within specified hostpool -// msixPackage - object containing MSIX Package definitions. -func (client MSIXPackagesClient) Update(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string, msixPackage *MSIXPackagePatch) (result MSIXPackage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MSIXPackagesClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: msixPackageFullName, - Constraints: []validation.Constraint{{Target: "msixPackageFullName", Name: validation.MaxLength, Rule: 100, Chain: nil}, - {Target: "msixPackageFullName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.MSIXPackagesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, hostPoolName, msixPackageFullName, msixPackage) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.MSIXPackagesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client MSIXPackagesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, msixPackageFullName string, msixPackage *MSIXPackagePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "msixPackageFullName": autorest.Encode("path", msixPackageFullName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if msixPackage != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(msixPackage)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client MSIXPackagesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client MSIXPackagesClient) UpdateResponder(resp *http.Response) (result MSIXPackage, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/operations.go deleted file mode 100644 index e7983362934..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the client for the Operations methods of the Desktopvirtualization service. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list all of the available operations the Desktop Virtualization resource provider supports. -func (client OperationsClient) List(ctx context.Context) (result ResourceProviderOperationListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.rpol.Response.Response != nil { - sc = result.rpol.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rpol.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.rpol, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.rpol.hasNextLink() && result.rpol.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DesktopVirtualization/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result ResourceProviderOperationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults ResourceProviderOperationList) (result ResourceProviderOperationList, err error) { - req, err := lastResults.resourceProviderOperationListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result ResourceProviderOperationListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/privateendpointconnections.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/privateendpointconnections.go deleted file mode 100644 index d9a2045dc49..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/privateendpointconnections.go +++ /dev/null @@ -1,850 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionsClient is the client for the PrivateEndpointConnections methods of the -// Desktopvirtualization service. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// DeleteByHostPool remove a connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -func (client PrivateEndpointConnectionsClient) DeleteByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.DeleteByHostPool") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByHostPool", err.Error()) - } - - req, err := client.DeleteByHostPoolPreparer(ctx, resourceGroupName, hostPoolName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByHostPool", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteByHostPoolSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByHostPool", resp, "Failure sending request") - return - } - - result, err = client.DeleteByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByHostPool", resp, "Failure responding to request") - return - } - - return -} - -// DeleteByHostPoolPreparer prepares the DeleteByHostPool request. -func (client PrivateEndpointConnectionsClient) DeleteByHostPoolPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteByHostPoolSender sends the DeleteByHostPool request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteByHostPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteByHostPoolResponder handles the response to the DeleteByHostPool request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteByHostPoolResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteByWorkspace remove a connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -func (client PrivateEndpointConnectionsClient) DeleteByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.DeleteByWorkspace") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByWorkspace", err.Error()) - } - - req, err := client.DeleteByWorkspacePreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteByWorkspaceSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByWorkspace", resp, "Failure sending request") - return - } - - result, err = client.DeleteByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "DeleteByWorkspace", resp, "Failure responding to request") - return - } - - return -} - -// DeleteByWorkspacePreparer prepares the DeleteByWorkspace request. -func (client PrivateEndpointConnectionsClient) DeleteByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteByWorkspaceSender sends the DeleteByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteByWorkspaceResponder handles the response to the DeleteByWorkspace request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteByWorkspaceResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetByHostPool get a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -func (client PrivateEndpointConnectionsClient) GetByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionWithSystemData, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.GetByHostPool") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "GetByHostPool", err.Error()) - } - - req, err := client.GetByHostPoolPreparer(ctx, resourceGroupName, hostPoolName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "GetByHostPool", nil, "Failure preparing request") - return - } - - resp, err := client.GetByHostPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "GetByHostPool", resp, "Failure sending request") - return - } - - result, err = client.GetByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "GetByHostPool", resp, "Failure responding to request") - return - } - - return -} - -// GetByHostPoolPreparer prepares the GetByHostPool request. -func (client PrivateEndpointConnectionsClient) GetByHostPoolPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByHostPoolSender sends the GetByHostPool request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetByHostPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByHostPoolResponder handles the response to the GetByHostPool request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetByHostPoolResponder(resp *http.Response) (result PrivateEndpointConnectionWithSystemData, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetByWorkspace get a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -func (client PrivateEndpointConnectionsClient) GetByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionWithSystemData, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.GetByWorkspace") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "GetByWorkspace", err.Error()) - } - - req, err := client.GetByWorkspacePreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "GetByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.GetByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "GetByWorkspace", resp, "Failure sending request") - return - } - - result, err = client.GetByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "GetByWorkspace", resp, "Failure responding to request") - return - } - - return -} - -// GetByWorkspacePreparer prepares the GetByWorkspace request. -func (client PrivateEndpointConnectionsClient) GetByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByWorkspaceSender sends the GetByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByWorkspaceResponder handles the response to the GetByWorkspace request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetByWorkspaceResponder(resp *http.Response) (result PrivateEndpointConnectionWithSystemData, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHostPool list private endpoint connections associated with hostpool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -func (client PrivateEndpointConnectionsClient) ListByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string) (result PrivateEndpointConnectionListResultWithSystemDataPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByHostPool") - defer func() { - sc := -1 - if result.peclrwsd.Response.Response != nil { - sc = result.peclrwsd.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "ListByHostPool", err.Error()) - } - - result.fn = client.listByHostPoolNextResults - req, err := client.ListByHostPoolPreparer(ctx, resourceGroupName, hostPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "ListByHostPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.peclrwsd.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "ListByHostPool", resp, "Failure sending request") - return - } - - result.peclrwsd, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "ListByHostPool", resp, "Failure responding to request") - return - } - if result.peclrwsd.hasNextLink() && result.peclrwsd.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByHostPoolPreparer prepares the ListByHostPool request. -func (client PrivateEndpointConnectionsClient) ListByHostPoolPreparer(ctx context.Context, resourceGroupName string, hostPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByHostPoolSender sends the ListByHostPool request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByHostPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByHostPoolResponder handles the response to the ListByHostPool request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByHostPoolResponder(resp *http.Response) (result PrivateEndpointConnectionListResultWithSystemData, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByHostPoolNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionsClient) listByHostPoolNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResultWithSystemData) (result PrivateEndpointConnectionListResultWithSystemData, err error) { - req, err := lastResults.privateEndpointConnectionListResultWithSystemDataPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "listByHostPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "listByHostPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "listByHostPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByHostPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListByHostPoolComplete(ctx context.Context, resourceGroupName string, hostPoolName string) (result PrivateEndpointConnectionListResultWithSystemDataIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByHostPool") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByHostPool(ctx, resourceGroupName, hostPoolName) - return -} - -// ListByWorkspace list private endpoint connections. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client PrivateEndpointConnectionsClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateEndpointConnectionListResultWithSystemDataPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByWorkspace") - defer func() { - sc := -1 - if result.peclrwsd.Response.Response != nil { - sc = result.peclrwsd.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.peclrwsd.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.peclrwsd, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.peclrwsd.hasNextLink() && result.peclrwsd.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client PrivateEndpointConnectionsClient) ListByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByWorkspaceResponder(resp *http.Response) (result PrivateEndpointConnectionListResultWithSystemData, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionsClient) listByWorkspaceNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResultWithSystemData) (result PrivateEndpointConnectionListResultWithSystemData, err error) { - req, err := lastResults.privateEndpointConnectionListResultWithSystemDataPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateEndpointConnectionListResultWithSystemDataIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByWorkspace") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} - -// UpdateByHostPool approve or reject a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -// connection - object containing the updated connection. -func (client PrivateEndpointConnectionsClient) UpdateByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string, connection PrivateEndpointConnection) (result PrivateEndpointConnectionWithSystemData, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.UpdateByHostPool") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: connection, - Constraints: []validation.Constraint{{Target: "connection.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "connection.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByHostPool", err.Error()) - } - - req, err := client.UpdateByHostPoolPreparer(ctx, resourceGroupName, hostPoolName, privateEndpointConnectionName, connection) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByHostPool", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateByHostPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByHostPool", resp, "Failure sending request") - return - } - - result, err = client.UpdateByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByHostPool", resp, "Failure responding to request") - return - } - - return -} - -// UpdateByHostPoolPreparer prepares the UpdateByHostPool request. -func (client PrivateEndpointConnectionsClient) UpdateByHostPoolPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, privateEndpointConnectionName string, connection PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(connection), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateByHostPoolSender sends the UpdateByHostPool request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) UpdateByHostPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateByHostPoolResponder handles the response to the UpdateByHostPool request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) UpdateByHostPoolResponder(resp *http.Response) (result PrivateEndpointConnectionWithSystemData, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateByWorkspace approve or reject a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -// connection - object containing the updated connection. -func (client PrivateEndpointConnectionsClient) UpdateByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, connection PrivateEndpointConnection) (result PrivateEndpointConnectionWithSystemData, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.UpdateByWorkspace") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: connection, - Constraints: []validation.Constraint{{Target: "connection.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "connection.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByWorkspace", err.Error()) - } - - req, err := client.UpdateByWorkspacePreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName, connection) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByWorkspace", resp, "Failure sending request") - return - } - - result, err = client.UpdateByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateEndpointConnectionsClient", "UpdateByWorkspace", resp, "Failure responding to request") - return - } - - return -} - -// UpdateByWorkspacePreparer prepares the UpdateByWorkspace request. -func (client PrivateEndpointConnectionsClient) UpdateByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, connection PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(connection), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateByWorkspaceSender sends the UpdateByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) UpdateByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateByWorkspaceResponder handles the response to the UpdateByWorkspace request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) UpdateByWorkspaceResponder(resp *http.Response) (result PrivateEndpointConnectionWithSystemData, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/privatelinkresources.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/privatelinkresources.go deleted file mode 100644 index 3126be922c0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/privatelinkresources.go +++ /dev/null @@ -1,293 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the client for the PrivateLinkResources methods of the Desktopvirtualization service. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByHostPool list the private link resources available for this hostpool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -func (client PrivateLinkResourcesClient) ListByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByHostPool") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateLinkResourcesClient", "ListByHostPool", err.Error()) - } - - result.fn = client.listByHostPoolNextResults - req, err := client.ListByHostPoolPreparer(ctx, resourceGroupName, hostPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "ListByHostPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "ListByHostPool", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "ListByHostPool", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByHostPoolPreparer prepares the ListByHostPool request. -func (client PrivateLinkResourcesClient) ListByHostPoolPreparer(ctx context.Context, resourceGroupName string, hostPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByHostPoolSender sends the ListByHostPool request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByHostPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByHostPoolResponder handles the response to the ListByHostPool request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByHostPoolResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByHostPoolNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listByHostPoolNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "listByHostPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "listByHostPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "listByHostPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByHostPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListByHostPoolComplete(ctx context.Context, resourceGroupName string, hostPoolName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByHostPool") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByHostPool(ctx, resourceGroupName, hostPoolName) - return -} - -// ListByWorkspace list the private link resources available for this workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client PrivateLinkResourcesClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateLinkResourceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByWorkspace") - defer func() { - sc := -1 - if result.plrlr.Response.Response != nil { - sc = result.plrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.PrivateLinkResourcesClient", "ListByWorkspace", err.Error()) - } - - result.fn = client.listByWorkspaceNextResults - req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "ListByWorkspace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.plrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "ListByWorkspace", resp, "Failure sending request") - return - } - - result.plrlr, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "ListByWorkspace", resp, "Failure responding to request") - return - } - if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByWorkspacePreparer prepares the ListByWorkspace request. -func (client PrivateLinkResourcesClient) ListByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByWorkspaceResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByWorkspaceNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listByWorkspaceNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { - req, err := lastResults.privateLinkResourceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByWorkspaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByWorkspaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.PrivateLinkResourcesClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateLinkResourceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByWorkspace") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByWorkspace(ctx, resourceGroupName, workspaceName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/scalingplans.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/scalingplans.go deleted file mode 100644 index 74f05f8cd0d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/scalingplans.go +++ /dev/null @@ -1,766 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ScalingPlansClient is the client for the ScalingPlans methods of the Desktopvirtualization service. -type ScalingPlansClient struct { - BaseClient -} - -// NewScalingPlansClient creates an instance of the ScalingPlansClient client. -func NewScalingPlansClient(subscriptionID string) ScalingPlansClient { - return NewScalingPlansClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScalingPlansClientWithBaseURI creates an instance of the ScalingPlansClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewScalingPlansClientWithBaseURI(baseURI string, subscriptionID string) ScalingPlansClient { - return ScalingPlansClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create or update a scaling plan. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scalingPlanName - the name of the scaling plan. -// scalingPlan - object containing scaling plan definitions. -func (client ScalingPlansClient) Create(ctx context.Context, resourceGroupName string, scalingPlanName string, scalingPlan ScalingPlan) (result ScalingPlan, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: scalingPlanName, - Constraints: []validation.Constraint{{Target: "scalingPlanName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "scalingPlanName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ScalingPlansClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, scalingPlanName, scalingPlan) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ScalingPlansClient) CreatePreparer(ctx context.Context, resourceGroupName string, scalingPlanName string, scalingPlan ScalingPlan) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scalingPlanName": autorest.Encode("path", scalingPlanName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", pathParameters), - autorest.WithJSON(scalingPlan), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ScalingPlansClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ScalingPlansClient) CreateResponder(resp *http.Response) (result ScalingPlan, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove a scaling plan. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scalingPlanName - the name of the scaling plan. -func (client ScalingPlansClient) Delete(ctx context.Context, resourceGroupName string, scalingPlanName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: scalingPlanName, - Constraints: []validation.Constraint{{Target: "scalingPlanName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "scalingPlanName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ScalingPlansClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, scalingPlanName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScalingPlansClient) DeletePreparer(ctx context.Context, resourceGroupName string, scalingPlanName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scalingPlanName": autorest.Encode("path", scalingPlanName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ScalingPlansClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ScalingPlansClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a scaling plan. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scalingPlanName - the name of the scaling plan. -func (client ScalingPlansClient) Get(ctx context.Context, resourceGroupName string, scalingPlanName string) (result ScalingPlan, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: scalingPlanName, - Constraints: []validation.Constraint{{Target: "scalingPlanName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "scalingPlanName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ScalingPlansClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, scalingPlanName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScalingPlansClient) GetPreparer(ctx context.Context, resourceGroupName string, scalingPlanName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scalingPlanName": autorest.Encode("path", scalingPlanName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ScalingPlansClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ScalingPlansClient) GetResponder(resp *http.Response) (result ScalingPlan, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByHostPool list scaling plan associated with hostpool. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -func (client ScalingPlansClient) ListByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string) (result ScalingPlanListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.ListByHostPool") - defer func() { - sc := -1 - if result.spl.Response.Response != nil { - sc = result.spl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ScalingPlansClient", "ListByHostPool", err.Error()) - } - - result.fn = client.listByHostPoolNextResults - req, err := client.ListByHostPoolPreparer(ctx, resourceGroupName, hostPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListByHostPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.spl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListByHostPool", resp, "Failure sending request") - return - } - - result.spl, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListByHostPool", resp, "Failure responding to request") - return - } - if result.spl.hasNextLink() && result.spl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByHostPoolPreparer prepares the ListByHostPool request. -func (client ScalingPlansClient) ListByHostPoolPreparer(ctx context.Context, resourceGroupName string, hostPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByHostPoolSender sends the ListByHostPool request. The method will close the -// http.Response Body if it receives an error. -func (client ScalingPlansClient) ListByHostPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByHostPoolResponder handles the response to the ListByHostPool request. The method always -// closes the http.Response Body. -func (client ScalingPlansClient) ListByHostPoolResponder(resp *http.Response) (result ScalingPlanList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByHostPoolNextResults retrieves the next set of results, if any. -func (client ScalingPlansClient) listByHostPoolNextResults(ctx context.Context, lastResults ScalingPlanList) (result ScalingPlanList, err error) { - req, err := lastResults.scalingPlanListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listByHostPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listByHostPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listByHostPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByHostPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client ScalingPlansClient) ListByHostPoolComplete(ctx context.Context, resourceGroupName string, hostPoolName string) (result ScalingPlanListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.ListByHostPool") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByHostPool(ctx, resourceGroupName, hostPoolName) - return -} - -// ListByResourceGroup list scaling plans. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ScalingPlansClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ScalingPlanListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.spl.Response.Response != nil { - sc = result.spl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ScalingPlansClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.spl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.spl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.spl.hasNextLink() && result.spl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ScalingPlansClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ScalingPlansClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ScalingPlansClient) ListByResourceGroupResponder(resp *http.Response) (result ScalingPlanList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ScalingPlansClient) listByResourceGroupNextResults(ctx context.Context, lastResults ScalingPlanList) (result ScalingPlanList, err error) { - req, err := lastResults.scalingPlanListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ScalingPlansClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ScalingPlanListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription list scaling plans in subscription. -func (client ScalingPlansClient) ListBySubscription(ctx context.Context) (result ScalingPlanListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.ListBySubscription") - defer func() { - sc := -1 - if result.spl.Response.Response != nil { - sc = result.spl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ScalingPlansClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.spl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.spl, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.spl.hasNextLink() && result.spl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client ScalingPlansClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client ScalingPlansClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client ScalingPlansClient) ListBySubscriptionResponder(resp *http.Response) (result ScalingPlanList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client ScalingPlansClient) listBySubscriptionNextResults(ctx context.Context, lastResults ScalingPlanList) (result ScalingPlanList, err error) { - req, err := lastResults.scalingPlanListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client ScalingPlansClient) ListBySubscriptionComplete(ctx context.Context) (result ScalingPlanListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// Update update a scaling plan. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// scalingPlanName - the name of the scaling plan. -// scalingPlan - object containing scaling plan definitions. -func (client ScalingPlansClient) Update(ctx context.Context, resourceGroupName string, scalingPlanName string, scalingPlan *ScalingPlanPatch) (result ScalingPlan, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScalingPlansClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: scalingPlanName, - Constraints: []validation.Constraint{{Target: "scalingPlanName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "scalingPlanName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.ScalingPlansClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, scalingPlanName, scalingPlan) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.ScalingPlansClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScalingPlansClient) UpdatePreparer(ctx context.Context, resourceGroupName string, scalingPlanName string, scalingPlan *ScalingPlanPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scalingPlanName": autorest.Encode("path", scalingPlanName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if scalingPlan != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(scalingPlan)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ScalingPlansClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ScalingPlansClient) UpdateResponder(resp *http.Response) (result ScalingPlan, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/sessionhosts.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/sessionhosts.go deleted file mode 100644 index c48a94fdb18..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/sessionhosts.go +++ /dev/null @@ -1,454 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SessionHostsClient is the client for the SessionHosts methods of the Desktopvirtualization service. -type SessionHostsClient struct { - BaseClient -} - -// NewSessionHostsClient creates an instance of the SessionHostsClient client. -func NewSessionHostsClient(subscriptionID string) SessionHostsClient { - return NewSessionHostsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSessionHostsClientWithBaseURI creates an instance of the SessionHostsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSessionHostsClientWithBaseURI(baseURI string, subscriptionID string) SessionHostsClient { - return SessionHostsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete remove a SessionHost. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// sessionHostName - the name of the session host within the specified host pool -// force - force flag to force sessionHost deletion even when userSession exists. -func (client SessionHostsClient) Delete(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, force *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionHostsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.SessionHostsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, hostPoolName, sessionHostName, force) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SessionHostsClient) DeletePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, force *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if force != nil { - queryParameters["force"] = autorest.Encode("query", *force) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SessionHostsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SessionHostsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a session host. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// sessionHostName - the name of the session host within the specified host pool -func (client SessionHostsClient) Get(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string) (result SessionHost, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionHostsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.SessionHostsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, hostPoolName, sessionHostName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SessionHostsClient) GetPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SessionHostsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SessionHostsClient) GetResponder(resp *http.Response) (result SessionHost, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list sessionHosts. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -func (client SessionHostsClient) List(ctx context.Context, resourceGroupName string, hostPoolName string) (result SessionHostListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionHostsClient.List") - defer func() { - sc := -1 - if result.shl.Response.Response != nil { - sc = result.shl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.SessionHostsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, hostPoolName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.shl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "List", resp, "Failure sending request") - return - } - - result.shl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "List", resp, "Failure responding to request") - return - } - if result.shl.hasNextLink() && result.shl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SessionHostsClient) ListPreparer(ctx context.Context, resourceGroupName string, hostPoolName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SessionHostsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SessionHostsClient) ListResponder(resp *http.Response) (result SessionHostList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client SessionHostsClient) listNextResults(ctx context.Context, lastResults SessionHostList) (result SessionHostList, err error) { - req, err := lastResults.sessionHostListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SessionHostsClient) ListComplete(ctx context.Context, resourceGroupName string, hostPoolName string) (result SessionHostListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionHostsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, hostPoolName) - return -} - -// Update update a session host. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// sessionHostName - the name of the session host within the specified host pool -// sessionHost - object containing SessionHost definitions. -// force - force flag to update assign, unassign or reassign personal desktop. -func (client SessionHostsClient) Update(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, sessionHost *SessionHostPatch, force *bool) (result SessionHost, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SessionHostsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.SessionHostsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, hostPoolName, sessionHostName, sessionHost, force) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.SessionHostsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SessionHostsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, sessionHost *SessionHostPatch, force *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if force != nil { - queryParameters["force"] = autorest.Encode("query", *force) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if sessionHost != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(sessionHost)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SessionHostsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SessionHostsClient) UpdateResponder(resp *http.Response) (result SessionHost, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/startmenuitems.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/startmenuitems.go deleted file mode 100644 index c471392cf06..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/startmenuitems.go +++ /dev/null @@ -1,162 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// StartMenuItemsClient is the client for the StartMenuItems methods of the Desktopvirtualization service. -type StartMenuItemsClient struct { - BaseClient -} - -// NewStartMenuItemsClient creates an instance of the StartMenuItemsClient client. -func NewStartMenuItemsClient(subscriptionID string) StartMenuItemsClient { - return NewStartMenuItemsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewStartMenuItemsClientWithBaseURI creates an instance of the StartMenuItemsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewStartMenuItemsClientWithBaseURI(baseURI string, subscriptionID string) StartMenuItemsClient { - return StartMenuItemsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list start menu items in the given application group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// applicationGroupName - the name of the application group -func (client StartMenuItemsClient) List(ctx context.Context, resourceGroupName string, applicationGroupName string) (result StartMenuItemListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/StartMenuItemsClient.List") - defer func() { - sc := -1 - if result.smil.Response.Response != nil { - sc = result.smil.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: applicationGroupName, - Constraints: []validation.Constraint{{Target: "applicationGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "applicationGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.StartMenuItemsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, applicationGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.StartMenuItemsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.smil.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.StartMenuItemsClient", "List", resp, "Failure sending request") - return - } - - result.smil, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.StartMenuItemsClient", "List", resp, "Failure responding to request") - return - } - if result.smil.hasNextLink() && result.smil.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client StartMenuItemsClient) ListPreparer(ctx context.Context, resourceGroupName string, applicationGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "applicationGroupName": autorest.Encode("path", applicationGroupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client StartMenuItemsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client StartMenuItemsClient) ListResponder(resp *http.Response) (result StartMenuItemList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client StartMenuItemsClient) listNextResults(ctx context.Context, lastResults StartMenuItemList) (result StartMenuItemList, err error) { - req, err := lastResults.startMenuItemListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.StartMenuItemsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.StartMenuItemsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.StartMenuItemsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client StartMenuItemsClient) ListComplete(ctx context.Context, resourceGroupName string, applicationGroupName string) (result StartMenuItemListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/StartMenuItemsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, applicationGroupName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/usersessions.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/usersessions.go deleted file mode 100644 index 5f09aea2c4a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/usersessions.go +++ /dev/null @@ -1,700 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// UserSessionsClient is the client for the UserSessions methods of the Desktopvirtualization service. -type UserSessionsClient struct { - BaseClient -} - -// NewUserSessionsClient creates an instance of the UserSessionsClient client. -func NewUserSessionsClient(subscriptionID string) UserSessionsClient { - return NewUserSessionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewUserSessionsClientWithBaseURI creates an instance of the UserSessionsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewUserSessionsClientWithBaseURI(baseURI string, subscriptionID string) UserSessionsClient { - return UserSessionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete remove a userSession. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// sessionHostName - the name of the session host within the specified host pool -// userSessionID - the name of the user session within the specified session host -// force - force flag to login off userSession. -func (client UserSessionsClient) Delete(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string, force *bool) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: userSessionID, - Constraints: []validation.Constraint{{Target: "userSessionID", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "userSessionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.UserSessionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, hostPoolName, sessionHostName, userSessionID, force) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client UserSessionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string, force *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userSessionId": autorest.Encode("path", userSessionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if force != nil { - queryParameters["force"] = autorest.Encode("query", *force) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client UserSessionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client UserSessionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Disconnect disconnect a userSession. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// sessionHostName - the name of the session host within the specified host pool -// userSessionID - the name of the user session within the specified session host -func (client UserSessionsClient) Disconnect(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.Disconnect") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: userSessionID, - Constraints: []validation.Constraint{{Target: "userSessionID", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "userSessionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.UserSessionsClient", "Disconnect", err.Error()) - } - - req, err := client.DisconnectPreparer(ctx, resourceGroupName, hostPoolName, sessionHostName, userSessionID) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Disconnect", nil, "Failure preparing request") - return - } - - resp, err := client.DisconnectSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Disconnect", resp, "Failure sending request") - return - } - - result, err = client.DisconnectResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Disconnect", resp, "Failure responding to request") - return - } - - return -} - -// DisconnectPreparer prepares the Disconnect request. -func (client UserSessionsClient) DisconnectPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userSessionId": autorest.Encode("path", userSessionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DisconnectSender sends the Disconnect request. The method will close the -// http.Response Body if it receives an error. -func (client UserSessionsClient) DisconnectSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DisconnectResponder handles the response to the Disconnect request. The method always -// closes the http.Response Body. -func (client UserSessionsClient) DisconnectResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a userSession. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// sessionHostName - the name of the session host within the specified host pool -// userSessionID - the name of the user session within the specified session host -func (client UserSessionsClient) Get(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string) (result UserSession, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: userSessionID, - Constraints: []validation.Constraint{{Target: "userSessionID", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "userSessionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.UserSessionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, hostPoolName, sessionHostName, userSessionID) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client UserSessionsClient) GetPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userSessionId": autorest.Encode("path", userSessionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client UserSessionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client UserSessionsClient) GetResponder(resp *http.Response) (result UserSession, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list userSessions. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// sessionHostName - the name of the session host within the specified host pool -func (client UserSessionsClient) List(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string) (result UserSessionListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.List") - defer func() { - sc := -1 - if result.usl.Response.Response != nil { - sc = result.usl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.UserSessionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, hostPoolName, sessionHostName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.usl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "List", resp, "Failure sending request") - return - } - - result.usl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "List", resp, "Failure responding to request") - return - } - if result.usl.hasNextLink() && result.usl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client UserSessionsClient) ListPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client UserSessionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client UserSessionsClient) ListResponder(resp *http.Response) (result UserSessionList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client UserSessionsClient) listNextResults(ctx context.Context, lastResults UserSessionList) (result UserSessionList, err error) { - req, err := lastResults.userSessionListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserSessionsClient) ListComplete(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string) (result UserSessionListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, hostPoolName, sessionHostName) - return -} - -// ListByHostPool list userSessions. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// filter - oData filter expression. Valid properties for filtering are userprincipalname and sessionstate. -func (client UserSessionsClient) ListByHostPool(ctx context.Context, resourceGroupName string, hostPoolName string, filter string) (result UserSessionListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.ListByHostPool") - defer func() { - sc := -1 - if result.usl.Response.Response != nil { - sc = result.usl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.UserSessionsClient", "ListByHostPool", err.Error()) - } - - result.fn = client.listByHostPoolNextResults - req, err := client.ListByHostPoolPreparer(ctx, resourceGroupName, hostPoolName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "ListByHostPool", nil, "Failure preparing request") - return - } - - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.usl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "ListByHostPool", resp, "Failure sending request") - return - } - - result.usl, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "ListByHostPool", resp, "Failure responding to request") - return - } - if result.usl.hasNextLink() && result.usl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByHostPoolPreparer prepares the ListByHostPool request. -func (client UserSessionsClient) ListByHostPoolPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByHostPoolSender sends the ListByHostPool request. The method will close the -// http.Response Body if it receives an error. -func (client UserSessionsClient) ListByHostPoolSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByHostPoolResponder handles the response to the ListByHostPool request. The method always -// closes the http.Response Body. -func (client UserSessionsClient) ListByHostPoolResponder(resp *http.Response) (result UserSessionList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByHostPoolNextResults retrieves the next set of results, if any. -func (client UserSessionsClient) listByHostPoolNextResults(ctx context.Context, lastResults UserSessionList) (result UserSessionList, err error) { - req, err := lastResults.userSessionListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "listByHostPoolNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByHostPoolSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "listByHostPoolNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByHostPoolResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "listByHostPoolNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByHostPoolComplete enumerates all values, automatically crossing page boundaries as required. -func (client UserSessionsClient) ListByHostPoolComplete(ctx context.Context, resourceGroupName string, hostPoolName string, filter string) (result UserSessionListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.ListByHostPool") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByHostPool(ctx, resourceGroupName, hostPoolName, filter) - return -} - -// SendMessageMethod send a message to a user. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// hostPoolName - the name of the host pool within the specified resource group -// sessionHostName - the name of the session host within the specified host pool -// userSessionID - the name of the user session within the specified session host -// sendMessage - object containing message includes title and message body -func (client UserSessionsClient) SendMessageMethod(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string, sendMessage *SendMessage) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/UserSessionsClient.SendMessageMethod") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: hostPoolName, - Constraints: []validation.Constraint{{Target: "hostPoolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "hostPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: sessionHostName, - Constraints: []validation.Constraint{{Target: "sessionHostName", Name: validation.MaxLength, Rule: 48, Chain: nil}, - {Target: "sessionHostName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: userSessionID, - Constraints: []validation.Constraint{{Target: "userSessionID", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "userSessionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.UserSessionsClient", "SendMessageMethod", err.Error()) - } - - req, err := client.SendMessageMethodPreparer(ctx, resourceGroupName, hostPoolName, sessionHostName, userSessionID, sendMessage) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "SendMessageMethod", nil, "Failure preparing request") - return - } - - resp, err := client.SendMessageMethodSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "SendMessageMethod", resp, "Failure sending request") - return - } - - result, err = client.SendMessageMethodResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.UserSessionsClient", "SendMessageMethod", resp, "Failure responding to request") - return - } - - return -} - -// SendMessageMethodPreparer prepares the SendMessageMethod request. -func (client UserSessionsClient) SendMessageMethodPreparer(ctx context.Context, resourceGroupName string, hostPoolName string, sessionHostName string, userSessionID string, sendMessage *SendMessage) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "hostPoolName": autorest.Encode("path", hostPoolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sessionHostName": autorest.Encode("path", sessionHostName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "userSessionId": autorest.Encode("path", userSessionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if sendMessage != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(sendMessage)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SendMessageMethodSender sends the SendMessageMethod request. The method will close the -// http.Response Body if it receives an error. -func (client UserSessionsClient) SendMessageMethodSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SendMessageMethodResponder handles the response to the SendMessageMethod request. The method always -// closes the http.Response Body. -func (client UserSessionsClient) SendMessageMethodResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/version.go deleted file mode 100644 index 44c98c076df..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package desktopvirtualization - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " desktopvirtualization/2021-09-03-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/workspaces.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/workspaces.go deleted file mode 100644 index e390eb2d801..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization/workspaces.go +++ /dev/null @@ -1,636 +0,0 @@ -package desktopvirtualization - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// WorkspacesClient is the client for the Workspaces methods of the Desktopvirtualization service. -type WorkspacesClient struct { - BaseClient -} - -// NewWorkspacesClient creates an instance of the WorkspacesClient client. -func NewWorkspacesClient(subscriptionID string) WorkspacesClient { - return NewWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkspacesClientWithBaseURI creates an instance of the WorkspacesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) WorkspacesClient { - return WorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// workspace - object containing Workspace definitions. -func (client WorkspacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, workspace Workspace) (result Workspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.WorkspacesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, workspace) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, workspace Workspace) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", pathParameters), - autorest.WithJSON(workspace), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result Workspace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove a workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspacesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.WorkspacesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkspacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -func (client WorkspacesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result Workspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.WorkspacesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkspacesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) GetResponder(resp *http.Response) (result Workspace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list workspaces. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client WorkspacesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result WorkspaceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.wl.Response.Response != nil { - sc = result.wl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.WorkspacesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.wl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.wl, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.wl.hasNextLink() && result.wl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client WorkspacesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) ListByResourceGroupResponder(resp *http.Response) (result WorkspaceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client WorkspacesClient) listByResourceGroupNextResults(ctx context.Context, lastResults WorkspaceList) (result WorkspaceList, err error) { - req, err := lastResults.workspaceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspacesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result WorkspaceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription list workspaces in subscription. -func (client WorkspacesClient) ListBySubscription(ctx context.Context) (result WorkspaceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListBySubscription") - defer func() { - sc := -1 - if result.wl.Response.Response != nil { - sc = result.wl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.WorkspacesClient", "ListBySubscription", err.Error()) - } - - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.wl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.wl, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.wl.hasNextLink() && result.wl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client WorkspacesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) ListBySubscriptionResponder(resp *http.Response) (result WorkspaceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client WorkspacesClient) listBySubscriptionNextResults(ctx context.Context, lastResults WorkspaceList) (result WorkspaceList, err error) { - req, err := lastResults.workspaceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client WorkspacesClient) ListBySubscriptionComplete(ctx context.Context) (result WorkspaceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// Update update a workspace. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// workspaceName - the name of the workspace -// workspace - object containing Workspace definitions. -func (client WorkspacesClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, workspace *WorkspacePatch) (result Workspace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: workspaceName, - Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("desktopvirtualization.WorkspacesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, workspace) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "desktopvirtualization.WorkspacesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WorkspacesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, workspace *WorkspacePatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workspaceName": autorest.Encode("path", workspaceName), - } - - const APIVersion = "2021-09-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if workspace != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(workspace)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client WorkspacesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client WorkspacesClient) UpdateResponder(resp *http.Response) (result Workspace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/_meta.json deleted file mode 100644 index 3ce427e77cf..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/hardwaresecuritymodules/resource-manager/readme.md", - "tag": "package-2018-10", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2018-10 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/hardwaresecuritymodules/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/client.go deleted file mode 100644 index 9306d4fd2f3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/client.go +++ /dev/null @@ -1,42 +0,0 @@ -// Package hardwaresecuritymodules implements the Azure ARM Hardwaresecuritymodules service API version -// 2018-10-31-preview. -// -// The Azure management API provides a RESTful set of web services that interact with Azure Dedicated HSM RP. -package hardwaresecuritymodules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Hardwaresecuritymodules - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Hardwaresecuritymodules. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/dedicatedhsm.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/dedicatedhsm.go deleted file mode 100644 index 4af9b540c4d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/dedicatedhsm.go +++ /dev/null @@ -1,604 +0,0 @@ -package hardwaresecuritymodules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DedicatedHsmClient is the the Azure management API provides a RESTful set of web services that interact with Azure -// Dedicated HSM RP. -type DedicatedHsmClient struct { - BaseClient -} - -// NewDedicatedHsmClient creates an instance of the DedicatedHsmClient client. -func NewDedicatedHsmClient(subscriptionID string) DedicatedHsmClient { - return NewDedicatedHsmClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDedicatedHsmClientWithBaseURI creates an instance of the DedicatedHsmClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDedicatedHsmClientWithBaseURI(baseURI string, subscriptionID string) DedicatedHsmClient { - return DedicatedHsmClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update a dedicated HSM in the specified subscription. -// Parameters: -// resourceGroupName - the name of the Resource Group to which the resource belongs. -// name - name of the dedicated Hsm -// parameters - parameters to create or update the dedicated hsm -func (client DedicatedHsmClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters DedicatedHsm) (result DedicatedHsmCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: name, - Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.DedicatedHsmProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("hardwaresecuritymodules.DedicatedHsmClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DedicatedHsmClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, parameters DedicatedHsm) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-10-31-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DedicatedHsmClient) CreateOrUpdateSender(req *http.Request) (future DedicatedHsmCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DedicatedHsmClient) CreateOrUpdateResponder(resp *http.Response) (result DedicatedHsm, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the specified Azure Dedicated HSM. -// Parameters: -// resourceGroupName - the name of the Resource Group to which the dedicated HSM belongs. -// name - the name of the dedicated HSM to delete -func (client DedicatedHsmClient) Delete(ctx context.Context, resourceGroupName string, name string) (result DedicatedHsmDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DedicatedHsmClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-10-31-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DedicatedHsmClient) DeleteSender(req *http.Request) (future DedicatedHsmDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DedicatedHsmClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified Azure dedicated HSM. -// Parameters: -// resourceGroupName - the name of the Resource Group to which the dedicated hsm belongs. -// name - the name of the dedicated HSM. -func (client DedicatedHsmClient) Get(ctx context.Context, resourceGroupName string, name string) (result DedicatedHsm, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, name) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DedicatedHsmClient) GetPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-10-31-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DedicatedHsmClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DedicatedHsmClient) GetResponder(resp *http.Response) (result DedicatedHsm, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup the List operation gets information about the dedicated hsms associated with the subscription -// and within the specified resource group. -// Parameters: -// resourceGroupName - the name of the Resource Group to which the dedicated HSM belongs. -// top - maximum number of results to return. -func (client DedicatedHsmClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32) (result DedicatedHsmListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.dhlr.Response.Response != nil { - sc = result.dhlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.dhlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.dhlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.dhlr.hasNextLink() && result.dhlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DedicatedHsmClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-10-31-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client DedicatedHsmClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client DedicatedHsmClient) ListByResourceGroupResponder(resp *http.Response) (result DedicatedHsmListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client DedicatedHsmClient) listByResourceGroupNextResults(ctx context.Context, lastResults DedicatedHsmListResult) (result DedicatedHsmListResult, err error) { - req, err := lastResults.dedicatedHsmListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client DedicatedHsmClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, top *int32) (result DedicatedHsmListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, top) - return -} - -// ListBySubscription the List operation gets information about the dedicated HSMs associated with the subscription. -// Parameters: -// top - maximum number of results to return. -func (client DedicatedHsmClient) ListBySubscription(ctx context.Context, top *int32) (result DedicatedHsmListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.ListBySubscription") - defer func() { - sc := -1 - if result.dhlr.Response.Response != nil { - sc = result.dhlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, top) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.dhlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.dhlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.dhlr.hasNextLink() && result.dhlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client DedicatedHsmClient) ListBySubscriptionPreparer(ctx context.Context, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-10-31-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client DedicatedHsmClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client DedicatedHsmClient) ListBySubscriptionResponder(resp *http.Response) (result DedicatedHsmListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client DedicatedHsmClient) listBySubscriptionNextResults(ctx context.Context, lastResults DedicatedHsmListResult) (result DedicatedHsmListResult, err error) { - req, err := lastResults.dedicatedHsmListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client DedicatedHsmClient) ListBySubscriptionComplete(ctx context.Context, top *int32) (result DedicatedHsmListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx, top) - return -} - -// Update update a dedicated HSM in the specified subscription. -// Parameters: -// resourceGroupName - the name of the Resource Group to which the server belongs. -// name - name of the dedicated HSM -// parameters - parameters to patch the dedicated HSM -func (client DedicatedHsmClient) Update(ctx context.Context, resourceGroupName string, name string, parameters DedicatedHsmPatchParameters) (result DedicatedHsmUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: name, - Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("hardwaresecuritymodules.DedicatedHsmClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, name, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DedicatedHsmClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, parameters DedicatedHsmPatchParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "name": autorest.Encode("path", name), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-10-31-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DedicatedHsmClient) UpdateSender(req *http.Request) (future DedicatedHsmUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client DedicatedHsmClient) UpdateResponder(resp *http.Response) (result DedicatedHsm, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/enums.go deleted file mode 100644 index e94da87ef16..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/enums.go +++ /dev/null @@ -1,45 +0,0 @@ -package hardwaresecuritymodules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// JSONWebKeyType enumerates the values for json web key type. -type JSONWebKeyType string - -const ( - // Allocating A device is currently being allocated for the dedicated HSM resource. - Allocating JSONWebKeyType = "Allocating" - // CheckingQuota Validating the subscription has sufficient quota to allocate a dedicated HSM device. - CheckingQuota JSONWebKeyType = "CheckingQuota" - // Connecting The dedicated HSM is being connected to the virtual network. - Connecting JSONWebKeyType = "Connecting" - // Deleting The dedicated HSM is currently being deleted. - Deleting JSONWebKeyType = "Deleting" - // Failed Provisioning of the dedicated HSM has failed. - Failed JSONWebKeyType = "Failed" - // Provisioning The dedicated HSM is currently being provisioned. - Provisioning JSONWebKeyType = "Provisioning" - // Succeeded The dedicated HSM has been full provisioned. - Succeeded JSONWebKeyType = "Succeeded" -) - -// PossibleJSONWebKeyTypeValues returns an array of possible values for the JSONWebKeyType const type. -func PossibleJSONWebKeyTypeValues() []JSONWebKeyType { - return []JSONWebKeyType{Allocating, CheckingQuota, Connecting, Deleting, Failed, Provisioning, Succeeded} -} - -// Name enumerates the values for name. -type Name string - -const ( - // SafeNetLunaNetworkHSMA790 ... - SafeNetLunaNetworkHSMA790 Name = "SafeNet Luna Network HSM A790" -) - -// PossibleNameValues returns an array of possible values for the Name const type. -func PossibleNameValues() []Name { - return []Name{SafeNetLunaNetworkHSMA790} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/models.go deleted file mode 100644 index 8b7566537e7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/models.go +++ /dev/null @@ -1,620 +0,0 @@ -package hardwaresecuritymodules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules" - -// APIEntityReference the API entity reference. -type APIEntityReference struct { - // ID - The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - ID *string `json:"id,omitempty"` -} - -// DedicatedHsm resource information with extended details. -type DedicatedHsm struct { - autorest.Response `json:"-"` - // DedicatedHsmProperties - Properties of the dedicated HSM - *DedicatedHsmProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The Azure Resource Manager resource ID for the dedicated HSM. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the dedicated HSM. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type of the dedicated HSM. - Type *string `json:"type,omitempty"` - // Location - The supported Azure location where the dedicated HSM should be created. - Location *string `json:"location,omitempty"` - // Sku - SKU details - Sku *Sku `json:"sku,omitempty"` - // Zones - The Dedicated Hsm zones. - Zones *[]string `json:"zones,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DedicatedHsm. -func (dh DedicatedHsm) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dh.DedicatedHsmProperties != nil { - objectMap["properties"] = dh.DedicatedHsmProperties - } - if dh.Location != nil { - objectMap["location"] = dh.Location - } - if dh.Sku != nil { - objectMap["sku"] = dh.Sku - } - if dh.Zones != nil { - objectMap["zones"] = dh.Zones - } - if dh.Tags != nil { - objectMap["tags"] = dh.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DedicatedHsm struct. -func (dh *DedicatedHsm) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var dedicatedHsmProperties DedicatedHsmProperties - err = json.Unmarshal(*v, &dedicatedHsmProperties) - if err != nil { - return err - } - dh.DedicatedHsmProperties = &dedicatedHsmProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dh.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dh.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dh.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dh.Location = &location - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - dh.Sku = &sku - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - dh.Zones = &zones - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - dh.Tags = tags - } - } - } - - return nil -} - -// DedicatedHsmCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DedicatedHsmCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DedicatedHsmClient) (DedicatedHsm, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DedicatedHsmCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DedicatedHsmCreateOrUpdateFuture.Result. -func (future *DedicatedHsmCreateOrUpdateFuture) result(client DedicatedHsmClient) (dh DedicatedHsm, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dh.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("hardwaresecuritymodules.DedicatedHsmCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dh.Response.Response, err = future.GetResult(sender); err == nil && dh.Response.Response.StatusCode != http.StatusNoContent { - dh, err = client.CreateOrUpdateResponder(dh.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmCreateOrUpdateFuture", "Result", dh.Response.Response, "Failure responding to request") - } - } - return -} - -// DedicatedHsmDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DedicatedHsmDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DedicatedHsmClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DedicatedHsmDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DedicatedHsmDeleteFuture.Result. -func (future *DedicatedHsmDeleteFuture) result(client DedicatedHsmClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("hardwaresecuritymodules.DedicatedHsmDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DedicatedHsmError the error exception. -type DedicatedHsmError struct { - // Error - READ-ONLY - Error *Error `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for DedicatedHsmError. -func (dhe DedicatedHsmError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DedicatedHsmListResult list of dedicated HSMs -type DedicatedHsmListResult struct { - autorest.Response `json:"-"` - // Value - The list of dedicated HSMs. - Value *[]DedicatedHsm `json:"value,omitempty"` - // NextLink - The URL to get the next set of dedicated hsms. - NextLink *string `json:"nextLink,omitempty"` -} - -// DedicatedHsmListResultIterator provides access to a complete listing of DedicatedHsm values. -type DedicatedHsmListResultIterator struct { - i int - page DedicatedHsmListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DedicatedHsmListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DedicatedHsmListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DedicatedHsmListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DedicatedHsmListResultIterator) Response() DedicatedHsmListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DedicatedHsmListResultIterator) Value() DedicatedHsm { - if !iter.page.NotDone() { - return DedicatedHsm{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DedicatedHsmListResultIterator type. -func NewDedicatedHsmListResultIterator(page DedicatedHsmListResultPage) DedicatedHsmListResultIterator { - return DedicatedHsmListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dhlr DedicatedHsmListResult) IsEmpty() bool { - return dhlr.Value == nil || len(*dhlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dhlr DedicatedHsmListResult) hasNextLink() bool { - return dhlr.NextLink != nil && len(*dhlr.NextLink) != 0 -} - -// dedicatedHsmListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dhlr DedicatedHsmListResult) dedicatedHsmListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dhlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dhlr.NextLink))) -} - -// DedicatedHsmListResultPage contains a page of DedicatedHsm values. -type DedicatedHsmListResultPage struct { - fn func(context.Context, DedicatedHsmListResult) (DedicatedHsmListResult, error) - dhlr DedicatedHsmListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DedicatedHsmListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedHsmListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dhlr) - if err != nil { - return err - } - page.dhlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DedicatedHsmListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DedicatedHsmListResultPage) NotDone() bool { - return !page.dhlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DedicatedHsmListResultPage) Response() DedicatedHsmListResult { - return page.dhlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DedicatedHsmListResultPage) Values() []DedicatedHsm { - if page.dhlr.IsEmpty() { - return nil - } - return *page.dhlr.Value -} - -// Creates a new instance of the DedicatedHsmListResultPage type. -func NewDedicatedHsmListResultPage(cur DedicatedHsmListResult, getNextPage func(context.Context, DedicatedHsmListResult) (DedicatedHsmListResult, error)) DedicatedHsmListResultPage { - return DedicatedHsmListResultPage{ - fn: getNextPage, - dhlr: cur, - } -} - -// DedicatedHsmOperation REST API operation -type DedicatedHsmOperation struct { - // Name - The name of the Dedicated HSM Resource Provider Operation. - Name *string `json:"name,omitempty"` - // IsDataAction - READ-ONLY; Gets or sets a value indicating whether it is a data plane action - IsDataAction *string `json:"isDataAction,omitempty"` - Display *DedicatedHsmOperationDisplay `json:"display,omitempty"` -} - -// MarshalJSON is the custom marshaler for DedicatedHsmOperation. -func (dho DedicatedHsmOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dho.Name != nil { - objectMap["name"] = dho.Name - } - if dho.Display != nil { - objectMap["display"] = dho.Display - } - return json.Marshal(objectMap) -} - -// DedicatedHsmOperationDisplay ... -type DedicatedHsmOperationDisplay struct { - // Provider - The Resource Provider of the operation - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - The object that represents the operation. - Description *string `json:"description,omitempty"` -} - -// DedicatedHsmOperationListResult result of the request to list Dedicated HSM Provider operations. It -// contains a list of operations. -type DedicatedHsmOperationListResult struct { - autorest.Response `json:"-"` - // Value - List of Dedicated HSM Resource Provider operations. - Value *[]DedicatedHsmOperation `json:"value,omitempty"` -} - -// DedicatedHsmPatchParameters patchable properties of the dedicated HSM -type DedicatedHsmPatchParameters struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for DedicatedHsmPatchParameters. -func (dhpp DedicatedHsmPatchParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dhpp.Tags != nil { - objectMap["tags"] = dhpp.Tags - } - return json.Marshal(objectMap) -} - -// DedicatedHsmProperties properties of the dedicated hsm -type DedicatedHsmProperties struct { - // NetworkProfile - Specifies the network interfaces of the dedicated hsm. - NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` - // StampID - This field will be used when RP does not support Availability zones. - StampID *string `json:"stampId,omitempty"` - // StatusMessage - READ-ONLY; Resource Status Message. - StatusMessage *string `json:"statusMessage,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state. Possible values include: 'Succeeded', 'Provisioning', 'Allocating', 'Connecting', 'Failed', 'CheckingQuota', 'Deleting' - ProvisioningState JSONWebKeyType `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for DedicatedHsmProperties. -func (dhp DedicatedHsmProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dhp.NetworkProfile != nil { - objectMap["networkProfile"] = dhp.NetworkProfile - } - if dhp.StampID != nil { - objectMap["stampId"] = dhp.StampID - } - return json.Marshal(objectMap) -} - -// DedicatedHsmUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DedicatedHsmUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DedicatedHsmClient) (DedicatedHsm, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DedicatedHsmUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DedicatedHsmUpdateFuture.Result. -func (future *DedicatedHsmUpdateFuture) result(client DedicatedHsmClient) (dh DedicatedHsm, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dh.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("hardwaresecuritymodules.DedicatedHsmUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dh.Response.Response, err = future.GetResult(sender); err == nil && dh.Response.Response.StatusCode != http.StatusNoContent { - dh, err = client.UpdateResponder(dh.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.DedicatedHsmUpdateFuture", "Result", dh.Response.Response, "Failure responding to request") - } - } - return -} - -// Error the key vault server error. -type Error struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // InnerError - READ-ONLY - InnerError *Error `json:"innererror,omitempty"` -} - -// MarshalJSON is the custom marshaler for Error. -func (e Error) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// NetworkInterface the network interface definition. -type NetworkInterface struct { - // ID - READ-ONLY; The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - ID *string `json:"id,omitempty"` - // PrivateIPAddress - Private Ip address of the interface - PrivateIPAddress *string `json:"privateIpAddress,omitempty"` -} - -// MarshalJSON is the custom marshaler for NetworkInterface. -func (ni NetworkInterface) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ni.PrivateIPAddress != nil { - objectMap["privateIpAddress"] = ni.PrivateIPAddress - } - return json.Marshal(objectMap) -} - -// NetworkProfile ... -type NetworkProfile struct { - // Subnet - Specifies the identifier of the subnet. - Subnet *APIEntityReference `json:"subnet,omitempty"` - // NetworkInterfaces - Specifies the list of resource Ids for the network interfaces associated with the dedicated HSM. - NetworkInterfaces *[]NetworkInterface `json:"networkInterfaces,omitempty"` -} - -// Resource dedicated HSM resource -type Resource struct { - // ID - READ-ONLY; The Azure Resource Manager resource ID for the dedicated HSM. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the dedicated HSM. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The resource type of the dedicated HSM. - Type *string `json:"type,omitempty"` - // Location - The supported Azure location where the dedicated HSM should be created. - Location *string `json:"location,omitempty"` - // Sku - SKU details - Sku *Sku `json:"sku,omitempty"` - // Zones - The Dedicated Hsm zones. - Zones *[]string `json:"zones,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Sku != nil { - objectMap["sku"] = r.Sku - } - if r.Zones != nil { - objectMap["zones"] = r.Zones - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) -} - -// ResourceListResult list of dedicated HSM resources. -type ResourceListResult struct { - // Value - The list of dedicated HSM resources. - Value *[]Resource `json:"value,omitempty"` - // NextLink - The URL to get the next set of dedicated HSM resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// Sku ... -type Sku struct { - // Name - SKU of the dedicated HSM. Possible values include: 'SafeNetLunaNetworkHSMA790' - Name Name `json:"name,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/operations.go deleted file mode 100644 index 195428eb9e4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/operations.go +++ /dev/null @@ -1,99 +0,0 @@ -package hardwaresecuritymodules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the the Azure management API provides a RESTful set of web services that interact with Azure -// Dedicated HSM RP. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List get a list of Dedicated HSM operations. -func (client OperationsClient) List(ctx context.Context) (result DedicatedHsmOperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hardwaresecuritymodules.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2018-10-31-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.HardwareSecurityModules/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result DedicatedHsmOperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/version.go deleted file mode 100644 index 38e8ad9f433..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package hardwaresecuritymodules - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " hardwaresecuritymodules/2018-10-31-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/_meta.json deleted file mode 100644 index d8306d1abfe..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/policyinsights/resource-manager/readme.md", - "tag": "package-2019-10", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2019-10 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/policyinsights/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/client.go deleted file mode 100644 index e12b01c6975..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/client.go +++ /dev/null @@ -1,39 +0,0 @@ -// Package policyinsights implements the Azure ARM Policyinsights service API version . -// -// -package policyinsights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Policyinsights - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Policyinsights. -type BaseClient struct { - autorest.Client - BaseURI string -} - -// New creates an instance of the BaseClient client. -func New() BaseClient { - return NewWithBaseURI(DefaultBaseURI) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/enums.go deleted file mode 100644 index 2c21cb3b8ae..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/enums.go +++ /dev/null @@ -1,38 +0,0 @@ -package policyinsights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// PolicyStatesResource enumerates the values for policy states resource. -type PolicyStatesResource string - -const ( - // Default ... - Default PolicyStatesResource = "default" - // Latest ... - Latest PolicyStatesResource = "latest" -) - -// PossiblePolicyStatesResourceValues returns an array of possible values for the PolicyStatesResource const type. -func PossiblePolicyStatesResourceValues() []PolicyStatesResource { - return []PolicyStatesResource{Default, Latest} -} - -// ResourceDiscoveryMode enumerates the values for resource discovery mode. -type ResourceDiscoveryMode string - -const ( - // ExistingNonCompliant Remediate resources that are already known to be non-compliant. - ExistingNonCompliant ResourceDiscoveryMode = "ExistingNonCompliant" - // ReEvaluateCompliance Re-evaluate the compliance state of resources and then remediate the resources - // found to be non-compliant. - ReEvaluateCompliance ResourceDiscoveryMode = "ReEvaluateCompliance" -) - -// PossibleResourceDiscoveryModeValues returns an array of possible values for the ResourceDiscoveryMode const type. -func PossibleResourceDiscoveryModeValues() []ResourceDiscoveryMode { - return []ResourceDiscoveryMode{ExistingNonCompliant, ReEvaluateCompliance} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/models.go deleted file mode 100644 index 6a043e44d22..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/models.go +++ /dev/null @@ -1,2962 +0,0 @@ -package policyinsights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights" - -// ComplianceDetail the compliance state rollup. -type ComplianceDetail struct { - // ComplianceState - The compliance state. - ComplianceState *string `json:"complianceState,omitempty"` - // Count - Summarized count value for this compliance state. - Count *int32 `json:"count,omitempty"` -} - -// ComponentEventDetails component event details. -type ComponentEventDetails struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ID - Component Id. - ID *string `json:"id,omitempty"` - // Type - Component type. - Type *string `json:"type,omitempty"` - // Name - Component name. - Name *string `json:"name,omitempty"` - // Timestamp - Timestamp for component policy event record. - Timestamp *date.Time `json:"timestamp,omitempty"` - // TenantID - Tenant ID for the policy event record. - TenantID *string `json:"tenantId,omitempty"` - // PrincipalOid - Principal object ID for the user who initiated the resource component operation that triggered the policy event. - PrincipalOid *string `json:"principalOid,omitempty"` - // PolicyDefinitionAction - Policy definition action, i.e. effect. - PolicyDefinitionAction *string `json:"policyDefinitionAction,omitempty"` -} - -// MarshalJSON is the custom marshaler for ComponentEventDetails. -func (ced ComponentEventDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ced.ID != nil { - objectMap["id"] = ced.ID - } - if ced.Type != nil { - objectMap["type"] = ced.Type - } - if ced.Name != nil { - objectMap["name"] = ced.Name - } - if ced.Timestamp != nil { - objectMap["timestamp"] = ced.Timestamp - } - if ced.TenantID != nil { - objectMap["tenantId"] = ced.TenantID - } - if ced.PrincipalOid != nil { - objectMap["principalOid"] = ced.PrincipalOid - } - if ced.PolicyDefinitionAction != nil { - objectMap["policyDefinitionAction"] = ced.PolicyDefinitionAction - } - for k, v := range ced.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ComponentEventDetails struct. -func (ced *ComponentEventDetails) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if ced.AdditionalProperties == nil { - ced.AdditionalProperties = make(map[string]interface{}) - } - ced.AdditionalProperties[k] = additionalProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ced.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ced.Type = &typeVar - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ced.Name = &name - } - case "timestamp": - if v != nil { - var timestamp date.Time - err = json.Unmarshal(*v, ×tamp) - if err != nil { - return err - } - ced.Timestamp = ×tamp - } - case "tenantId": - if v != nil { - var tenantID string - err = json.Unmarshal(*v, &tenantID) - if err != nil { - return err - } - ced.TenantID = &tenantID - } - case "principalOid": - if v != nil { - var principalOid string - err = json.Unmarshal(*v, &principalOid) - if err != nil { - return err - } - ced.PrincipalOid = &principalOid - } - case "policyDefinitionAction": - if v != nil { - var policyDefinitionAction string - err = json.Unmarshal(*v, &policyDefinitionAction) - if err != nil { - return err - } - ced.PolicyDefinitionAction = &policyDefinitionAction - } - } - } - - return nil -} - -// ComponentStateDetails component state details. -type ComponentStateDetails struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // ID - Component Id. - ID *string `json:"id,omitempty"` - // Type - Component type. - Type *string `json:"type,omitempty"` - // Name - Component name. - Name *string `json:"name,omitempty"` - // Timestamp - Component compliance evaluation timestamp. - Timestamp *date.Time `json:"timestamp,omitempty"` - // ComplianceState - Component compliance state. - ComplianceState *string `json:"complianceState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ComponentStateDetails. -func (csd ComponentStateDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if csd.ID != nil { - objectMap["id"] = csd.ID - } - if csd.Type != nil { - objectMap["type"] = csd.Type - } - if csd.Name != nil { - objectMap["name"] = csd.Name - } - if csd.Timestamp != nil { - objectMap["timestamp"] = csd.Timestamp - } - if csd.ComplianceState != nil { - objectMap["complianceState"] = csd.ComplianceState - } - for k, v := range csd.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ComponentStateDetails struct. -func (csd *ComponentStateDetails) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if csd.AdditionalProperties == nil { - csd.AdditionalProperties = make(map[string]interface{}) - } - csd.AdditionalProperties[k] = additionalProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - csd.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - csd.Type = &typeVar - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - csd.Name = &name - } - case "timestamp": - if v != nil { - var timestamp date.Time - err = json.Unmarshal(*v, ×tamp) - if err != nil { - return err - } - csd.Timestamp = ×tamp - } - case "complianceState": - if v != nil { - var complianceState string - err = json.Unmarshal(*v, &complianceState) - if err != nil { - return err - } - csd.ComplianceState = &complianceState - } - } - } - - return nil -} - -// ErrorDefinition error definition. -type ErrorDefinition struct { - // Code - READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; Description of the error. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The target of the error. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; Internal error details. - Details *[]ErrorDefinition `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; Additional scenario specific error details. - AdditionalInfo *[]TypedErrorInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorDefinition. -func (ed ErrorDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse error response. -type ErrorResponse struct { - // Error - The error details. - Error *ErrorDefinition `json:"error,omitempty"` -} - -// ExpressionEvaluationDetails evaluation details of policy language expressions. -type ExpressionEvaluationDetails struct { - // Result - Evaluation result. - Result *string `json:"result,omitempty"` - // Expression - Expression evaluated. - Expression *string `json:"expression,omitempty"` - // ExpressionKind - READ-ONLY; The kind of expression that was evaluated. - ExpressionKind *string `json:"expressionKind,omitempty"` - // Path - Property path if the expression is a field or an alias. - Path *string `json:"path,omitempty"` - // ExpressionValue - Value of the expression. - ExpressionValue interface{} `json:"expressionValue,omitempty"` - // TargetValue - Target value to be compared with the expression value. - TargetValue interface{} `json:"targetValue,omitempty"` - // Operator - Operator to compare the expression value and the target value. - Operator *string `json:"operator,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExpressionEvaluationDetails. -func (eed ExpressionEvaluationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if eed.Result != nil { - objectMap["result"] = eed.Result - } - if eed.Expression != nil { - objectMap["expression"] = eed.Expression - } - if eed.Path != nil { - objectMap["path"] = eed.Path - } - if eed.ExpressionValue != nil { - objectMap["expressionValue"] = eed.ExpressionValue - } - if eed.TargetValue != nil { - objectMap["targetValue"] = eed.TargetValue - } - if eed.Operator != nil { - objectMap["operator"] = eed.Operator - } - return json.Marshal(objectMap) -} - -// IfNotExistsEvaluationDetails evaluation details of IfNotExists effect. -type IfNotExistsEvaluationDetails struct { - // ResourceID - ID of the last evaluated resource for IfNotExists effect. - ResourceID *string `json:"resourceId,omitempty"` - // TotalResources - Total number of resources to which the existence condition is applicable. - TotalResources *int32 `json:"totalResources,omitempty"` -} - -// Operation operation definition. -type Operation struct { - // Name - Operation name. - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - Resource provider name. - Provider *string `json:"provider,omitempty"` - // Resource - Resource name on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - Operation name. - Operation *string `json:"operation,omitempty"` - // Description - Operation description. - Description *string `json:"description,omitempty"` -} - -// OperationsListResults list of available operations. -type OperationsListResults struct { - autorest.Response `json:"-"` - // OdataCount - OData entity count; represents the number of operations returned. - OdataCount *int32 `json:"@odata.count,omitempty"` - // Value - List of available operations. - Value *[]Operation `json:"value,omitempty"` -} - -// PolicyAssignmentSummary policy assignment summary. -type PolicyAssignmentSummary struct { - // PolicyAssignmentID - Policy assignment ID. - PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"` - // PolicySetDefinitionID - Policy set definition ID, if the policy assignment is for a policy set. - PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty"` - // Results - Compliance summary for the policy assignment. - Results *SummaryResults `json:"results,omitempty"` - // PolicyDefinitions - Policy definitions summary. - PolicyDefinitions *[]PolicyDefinitionSummary `json:"policyDefinitions,omitempty"` - // PolicyGroups - Policy definition group summary. - PolicyGroups *[]PolicyGroupSummary `json:"policyGroups,omitempty"` -} - -// PolicyDefinitionSummary policy definition summary. -type PolicyDefinitionSummary struct { - // PolicyDefinitionID - Policy definition ID. - PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"` - // PolicyDefinitionReferenceID - Policy definition reference ID. - PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"` - // PolicyDefinitionGroupNames - Policy definition group names. - PolicyDefinitionGroupNames *[]string `json:"policyDefinitionGroupNames,omitempty"` - // Effect - Policy effect, i.e. policy definition action. - Effect *string `json:"effect,omitempty"` - // Results - Compliance summary for the policy definition. - Results *SummaryResults `json:"results,omitempty"` -} - -// PolicyDetails the policy details. -type PolicyDetails struct { - // PolicyDefinitionID - READ-ONLY; The ID of the policy definition. - PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"` - // PolicyAssignmentID - READ-ONLY; The ID of the policy assignment. - PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"` - // PolicyAssignmentDisplayName - READ-ONLY; The display name of the policy assignment. - PolicyAssignmentDisplayName *string `json:"policyAssignmentDisplayName,omitempty"` - // PolicyAssignmentScope - READ-ONLY; The scope of the policy assignment. - PolicyAssignmentScope *string `json:"policyAssignmentScope,omitempty"` - // PolicySetDefinitionID - READ-ONLY; The ID of the policy set definition. - PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty"` - // PolicyDefinitionReferenceID - READ-ONLY; The policy definition reference ID within the policy set definition. - PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyDetails. -func (pd PolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PolicyEvaluationDetails policy evaluation details. -type PolicyEvaluationDetails struct { - // EvaluatedExpressions - Details of the evaluated expressions. - EvaluatedExpressions *[]ExpressionEvaluationDetails `json:"evaluatedExpressions,omitempty"` - // IfNotExistsDetails - Evaluation details of IfNotExists effect. - IfNotExistsDetails *IfNotExistsEvaluationDetails `json:"ifNotExistsDetails,omitempty"` -} - -// PolicyEvent policy event record. -type PolicyEvent struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataID - OData entity ID; always set to null since policy event records do not have an entity ID. - OdataID *string `json:"@odata.id,omitempty"` - // OdataContext - OData context string; used by OData clients to resolve type information based on metadata. - OdataContext *string `json:"@odata.context,omitempty"` - // Timestamp - Timestamp for the policy event record. - Timestamp *date.Time `json:"timestamp,omitempty"` - // ResourceID - Resource ID. - ResourceID *string `json:"resourceId,omitempty"` - // PolicyAssignmentID - Policy assignment ID. - PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"` - // PolicyDefinitionID - Policy definition ID. - PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"` - // EffectiveParameters - Effective parameters for the policy assignment. - EffectiveParameters *string `json:"effectiveParameters,omitempty"` - // IsCompliant - Flag which states whether the resource is compliant against the policy assignment it was evaluated against. - IsCompliant *bool `json:"isCompliant,omitempty"` - // SubscriptionID - Subscription ID. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // ResourceType - Resource type. - ResourceType *string `json:"resourceType,omitempty"` - // ResourceLocation - Resource location. - ResourceLocation *string `json:"resourceLocation,omitempty"` - // ResourceGroup - Resource group name. - ResourceGroup *string `json:"resourceGroup,omitempty"` - // ResourceTags - List of resource tags. - ResourceTags *string `json:"resourceTags,omitempty"` - // PolicyAssignmentName - Policy assignment name. - PolicyAssignmentName *string `json:"policyAssignmentName,omitempty"` - // PolicyAssignmentOwner - Policy assignment owner. - PolicyAssignmentOwner *string `json:"policyAssignmentOwner,omitempty"` - // PolicyAssignmentParameters - Policy assignment parameters. - PolicyAssignmentParameters *string `json:"policyAssignmentParameters,omitempty"` - // PolicyAssignmentScope - Policy assignment scope. - PolicyAssignmentScope *string `json:"policyAssignmentScope,omitempty"` - // PolicyDefinitionName - Policy definition name. - PolicyDefinitionName *string `json:"policyDefinitionName,omitempty"` - // PolicyDefinitionAction - Policy definition action, i.e. effect. - PolicyDefinitionAction *string `json:"policyDefinitionAction,omitempty"` - // PolicyDefinitionCategory - Policy definition category. - PolicyDefinitionCategory *string `json:"policyDefinitionCategory,omitempty"` - // PolicySetDefinitionID - Policy set definition ID, if the policy assignment is for a policy set. - PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty"` - // PolicySetDefinitionName - Policy set definition name, if the policy assignment is for a policy set. - PolicySetDefinitionName *string `json:"policySetDefinitionName,omitempty"` - // PolicySetDefinitionOwner - Policy set definition owner, if the policy assignment is for a policy set. - PolicySetDefinitionOwner *string `json:"policySetDefinitionOwner,omitempty"` - // PolicySetDefinitionCategory - Policy set definition category, if the policy assignment is for a policy set. - PolicySetDefinitionCategory *string `json:"policySetDefinitionCategory,omitempty"` - // PolicySetDefinitionParameters - Policy set definition parameters, if the policy assignment is for a policy set. - PolicySetDefinitionParameters *string `json:"policySetDefinitionParameters,omitempty"` - // ManagementGroupIds - Comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under. - ManagementGroupIds *string `json:"managementGroupIds,omitempty"` - // PolicyDefinitionReferenceID - Reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. - PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"` - // ComplianceState - Compliance state of the resource. - ComplianceState *string `json:"complianceState,omitempty"` - // TenantID - Tenant ID for the policy event record. - TenantID *string `json:"tenantId,omitempty"` - // PrincipalOid - Principal object ID for the user who initiated the resource operation that triggered the policy event. - PrincipalOid *string `json:"principalOid,omitempty"` - // Components - Components events records populated only when URL contains $expand=components clause. - Components *[]ComponentEventDetails `json:"components,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyEvent. -func (peVar PolicyEvent) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if peVar.OdataID != nil { - objectMap["@odata.id"] = peVar.OdataID - } - if peVar.OdataContext != nil { - objectMap["@odata.context"] = peVar.OdataContext - } - if peVar.Timestamp != nil { - objectMap["timestamp"] = peVar.Timestamp - } - if peVar.ResourceID != nil { - objectMap["resourceId"] = peVar.ResourceID - } - if peVar.PolicyAssignmentID != nil { - objectMap["policyAssignmentId"] = peVar.PolicyAssignmentID - } - if peVar.PolicyDefinitionID != nil { - objectMap["policyDefinitionId"] = peVar.PolicyDefinitionID - } - if peVar.EffectiveParameters != nil { - objectMap["effectiveParameters"] = peVar.EffectiveParameters - } - if peVar.IsCompliant != nil { - objectMap["isCompliant"] = peVar.IsCompliant - } - if peVar.SubscriptionID != nil { - objectMap["subscriptionId"] = peVar.SubscriptionID - } - if peVar.ResourceType != nil { - objectMap["resourceType"] = peVar.ResourceType - } - if peVar.ResourceLocation != nil { - objectMap["resourceLocation"] = peVar.ResourceLocation - } - if peVar.ResourceGroup != nil { - objectMap["resourceGroup"] = peVar.ResourceGroup - } - if peVar.ResourceTags != nil { - objectMap["resourceTags"] = peVar.ResourceTags - } - if peVar.PolicyAssignmentName != nil { - objectMap["policyAssignmentName"] = peVar.PolicyAssignmentName - } - if peVar.PolicyAssignmentOwner != nil { - objectMap["policyAssignmentOwner"] = peVar.PolicyAssignmentOwner - } - if peVar.PolicyAssignmentParameters != nil { - objectMap["policyAssignmentParameters"] = peVar.PolicyAssignmentParameters - } - if peVar.PolicyAssignmentScope != nil { - objectMap["policyAssignmentScope"] = peVar.PolicyAssignmentScope - } - if peVar.PolicyDefinitionName != nil { - objectMap["policyDefinitionName"] = peVar.PolicyDefinitionName - } - if peVar.PolicyDefinitionAction != nil { - objectMap["policyDefinitionAction"] = peVar.PolicyDefinitionAction - } - if peVar.PolicyDefinitionCategory != nil { - objectMap["policyDefinitionCategory"] = peVar.PolicyDefinitionCategory - } - if peVar.PolicySetDefinitionID != nil { - objectMap["policySetDefinitionId"] = peVar.PolicySetDefinitionID - } - if peVar.PolicySetDefinitionName != nil { - objectMap["policySetDefinitionName"] = peVar.PolicySetDefinitionName - } - if peVar.PolicySetDefinitionOwner != nil { - objectMap["policySetDefinitionOwner"] = peVar.PolicySetDefinitionOwner - } - if peVar.PolicySetDefinitionCategory != nil { - objectMap["policySetDefinitionCategory"] = peVar.PolicySetDefinitionCategory - } - if peVar.PolicySetDefinitionParameters != nil { - objectMap["policySetDefinitionParameters"] = peVar.PolicySetDefinitionParameters - } - if peVar.ManagementGroupIds != nil { - objectMap["managementGroupIds"] = peVar.ManagementGroupIds - } - if peVar.PolicyDefinitionReferenceID != nil { - objectMap["policyDefinitionReferenceId"] = peVar.PolicyDefinitionReferenceID - } - if peVar.ComplianceState != nil { - objectMap["complianceState"] = peVar.ComplianceState - } - if peVar.TenantID != nil { - objectMap["tenantId"] = peVar.TenantID - } - if peVar.PrincipalOid != nil { - objectMap["principalOid"] = peVar.PrincipalOid - } - if peVar.Components != nil { - objectMap["components"] = peVar.Components - } - for k, v := range peVar.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PolicyEvent struct. -func (peVar *PolicyEvent) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if peVar.AdditionalProperties == nil { - peVar.AdditionalProperties = make(map[string]interface{}) - } - peVar.AdditionalProperties[k] = additionalProperties - } - case "@odata.id": - if v != nil { - var odataID string - err = json.Unmarshal(*v, &odataID) - if err != nil { - return err - } - peVar.OdataID = &odataID - } - case "@odata.context": - if v != nil { - var odataContext string - err = json.Unmarshal(*v, &odataContext) - if err != nil { - return err - } - peVar.OdataContext = &odataContext - } - case "timestamp": - if v != nil { - var timestamp date.Time - err = json.Unmarshal(*v, ×tamp) - if err != nil { - return err - } - peVar.Timestamp = ×tamp - } - case "resourceId": - if v != nil { - var resourceID string - err = json.Unmarshal(*v, &resourceID) - if err != nil { - return err - } - peVar.ResourceID = &resourceID - } - case "policyAssignmentId": - if v != nil { - var policyAssignmentID string - err = json.Unmarshal(*v, &policyAssignmentID) - if err != nil { - return err - } - peVar.PolicyAssignmentID = &policyAssignmentID - } - case "policyDefinitionId": - if v != nil { - var policyDefinitionID string - err = json.Unmarshal(*v, &policyDefinitionID) - if err != nil { - return err - } - peVar.PolicyDefinitionID = &policyDefinitionID - } - case "effectiveParameters": - if v != nil { - var effectiveParameters string - err = json.Unmarshal(*v, &effectiveParameters) - if err != nil { - return err - } - peVar.EffectiveParameters = &effectiveParameters - } - case "isCompliant": - if v != nil { - var isCompliant bool - err = json.Unmarshal(*v, &isCompliant) - if err != nil { - return err - } - peVar.IsCompliant = &isCompliant - } - case "subscriptionId": - if v != nil { - var subscriptionID string - err = json.Unmarshal(*v, &subscriptionID) - if err != nil { - return err - } - peVar.SubscriptionID = &subscriptionID - } - case "resourceType": - if v != nil { - var resourceType string - err = json.Unmarshal(*v, &resourceType) - if err != nil { - return err - } - peVar.ResourceType = &resourceType - } - case "resourceLocation": - if v != nil { - var resourceLocation string - err = json.Unmarshal(*v, &resourceLocation) - if err != nil { - return err - } - peVar.ResourceLocation = &resourceLocation - } - case "resourceGroup": - if v != nil { - var resourceGroup string - err = json.Unmarshal(*v, &resourceGroup) - if err != nil { - return err - } - peVar.ResourceGroup = &resourceGroup - } - case "resourceTags": - if v != nil { - var resourceTags string - err = json.Unmarshal(*v, &resourceTags) - if err != nil { - return err - } - peVar.ResourceTags = &resourceTags - } - case "policyAssignmentName": - if v != nil { - var policyAssignmentName string - err = json.Unmarshal(*v, &policyAssignmentName) - if err != nil { - return err - } - peVar.PolicyAssignmentName = &policyAssignmentName - } - case "policyAssignmentOwner": - if v != nil { - var policyAssignmentOwner string - err = json.Unmarshal(*v, &policyAssignmentOwner) - if err != nil { - return err - } - peVar.PolicyAssignmentOwner = &policyAssignmentOwner - } - case "policyAssignmentParameters": - if v != nil { - var policyAssignmentParameters string - err = json.Unmarshal(*v, &policyAssignmentParameters) - if err != nil { - return err - } - peVar.PolicyAssignmentParameters = &policyAssignmentParameters - } - case "policyAssignmentScope": - if v != nil { - var policyAssignmentScope string - err = json.Unmarshal(*v, &policyAssignmentScope) - if err != nil { - return err - } - peVar.PolicyAssignmentScope = &policyAssignmentScope - } - case "policyDefinitionName": - if v != nil { - var policyDefinitionName string - err = json.Unmarshal(*v, &policyDefinitionName) - if err != nil { - return err - } - peVar.PolicyDefinitionName = &policyDefinitionName - } - case "policyDefinitionAction": - if v != nil { - var policyDefinitionAction string - err = json.Unmarshal(*v, &policyDefinitionAction) - if err != nil { - return err - } - peVar.PolicyDefinitionAction = &policyDefinitionAction - } - case "policyDefinitionCategory": - if v != nil { - var policyDefinitionCategory string - err = json.Unmarshal(*v, &policyDefinitionCategory) - if err != nil { - return err - } - peVar.PolicyDefinitionCategory = &policyDefinitionCategory - } - case "policySetDefinitionId": - if v != nil { - var policySetDefinitionID string - err = json.Unmarshal(*v, &policySetDefinitionID) - if err != nil { - return err - } - peVar.PolicySetDefinitionID = &policySetDefinitionID - } - case "policySetDefinitionName": - if v != nil { - var policySetDefinitionName string - err = json.Unmarshal(*v, &policySetDefinitionName) - if err != nil { - return err - } - peVar.PolicySetDefinitionName = &policySetDefinitionName - } - case "policySetDefinitionOwner": - if v != nil { - var policySetDefinitionOwner string - err = json.Unmarshal(*v, &policySetDefinitionOwner) - if err != nil { - return err - } - peVar.PolicySetDefinitionOwner = &policySetDefinitionOwner - } - case "policySetDefinitionCategory": - if v != nil { - var policySetDefinitionCategory string - err = json.Unmarshal(*v, &policySetDefinitionCategory) - if err != nil { - return err - } - peVar.PolicySetDefinitionCategory = &policySetDefinitionCategory - } - case "policySetDefinitionParameters": - if v != nil { - var policySetDefinitionParameters string - err = json.Unmarshal(*v, &policySetDefinitionParameters) - if err != nil { - return err - } - peVar.PolicySetDefinitionParameters = &policySetDefinitionParameters - } - case "managementGroupIds": - if v != nil { - var managementGroupIds string - err = json.Unmarshal(*v, &managementGroupIds) - if err != nil { - return err - } - peVar.ManagementGroupIds = &managementGroupIds - } - case "policyDefinitionReferenceId": - if v != nil { - var policyDefinitionReferenceID string - err = json.Unmarshal(*v, &policyDefinitionReferenceID) - if err != nil { - return err - } - peVar.PolicyDefinitionReferenceID = &policyDefinitionReferenceID - } - case "complianceState": - if v != nil { - var complianceState string - err = json.Unmarshal(*v, &complianceState) - if err != nil { - return err - } - peVar.ComplianceState = &complianceState - } - case "tenantId": - if v != nil { - var tenantID string - err = json.Unmarshal(*v, &tenantID) - if err != nil { - return err - } - peVar.TenantID = &tenantID - } - case "principalOid": - if v != nil { - var principalOid string - err = json.Unmarshal(*v, &principalOid) - if err != nil { - return err - } - peVar.PrincipalOid = &principalOid - } - case "components": - if v != nil { - var components []ComponentEventDetails - err = json.Unmarshal(*v, &components) - if err != nil { - return err - } - peVar.Components = &components - } - } - } - - return nil -} - -// PolicyEventsQueryResults query results. -type PolicyEventsQueryResults struct { - autorest.Response `json:"-"` - // OdataContext - OData context string; used by OData clients to resolve type information based on metadata. - OdataContext *string `json:"@odata.context,omitempty"` - // OdataCount - OData entity count; represents the number of policy event records returned. - OdataCount *int32 `json:"@odata.count,omitempty"` - // OdataNextLink - Odata next link; URL to get the next set of results. - OdataNextLink *string `json:"@odata.nextLink,omitempty"` - // Value - Query results. - Value *[]PolicyEvent `json:"value,omitempty"` -} - -// PolicyEventsQueryResultsIterator provides access to a complete listing of PolicyEvent values. -type PolicyEventsQueryResultsIterator struct { - i int - page PolicyEventsQueryResultsPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PolicyEventsQueryResultsIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsQueryResultsIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PolicyEventsQueryResultsIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PolicyEventsQueryResultsIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PolicyEventsQueryResultsIterator) Response() PolicyEventsQueryResults { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PolicyEventsQueryResultsIterator) Value() PolicyEvent { - if !iter.page.NotDone() { - return PolicyEvent{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PolicyEventsQueryResultsIterator type. -func NewPolicyEventsQueryResultsIterator(page PolicyEventsQueryResultsPage) PolicyEventsQueryResultsIterator { - return PolicyEventsQueryResultsIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peqr PolicyEventsQueryResults) IsEmpty() bool { - return peqr.Value == nil || len(*peqr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peqr PolicyEventsQueryResults) hasNextLink() bool { - return peqr.OdataNextLink != nil && len(*peqr.OdataNextLink) != 0 -} - -// policyEventsQueryResultsPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peqr PolicyEventsQueryResults) policyEventsQueryResultsPreparer(ctx context.Context) (*http.Request, error) { - if !peqr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peqr.OdataNextLink))) -} - -// PolicyEventsQueryResultsPage contains a page of PolicyEvent values. -type PolicyEventsQueryResultsPage struct { - fn func(context.Context, PolicyEventsQueryResults) (PolicyEventsQueryResults, error) - peqr PolicyEventsQueryResults -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PolicyEventsQueryResultsPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsQueryResultsPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.peqr) - if err != nil { - return err - } - page.peqr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PolicyEventsQueryResultsPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PolicyEventsQueryResultsPage) NotDone() bool { - return !page.peqr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PolicyEventsQueryResultsPage) Response() PolicyEventsQueryResults { - return page.peqr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PolicyEventsQueryResultsPage) Values() []PolicyEvent { - if page.peqr.IsEmpty() { - return nil - } - return *page.peqr.Value -} - -// Creates a new instance of the PolicyEventsQueryResultsPage type. -func NewPolicyEventsQueryResultsPage(cur PolicyEventsQueryResults, getNextPage func(context.Context, PolicyEventsQueryResults) (PolicyEventsQueryResults, error)) PolicyEventsQueryResultsPage { - return PolicyEventsQueryResultsPage{ - fn: getNextPage, - peqr: cur, - } -} - -// PolicyGroupSummary policy definition group summary. -type PolicyGroupSummary struct { - // PolicyGroupName - Policy group name. - PolicyGroupName *string `json:"policyGroupName,omitempty"` - // Results - Compliance summary for the policy definition group. - Results *SummaryResults `json:"results,omitempty"` -} - -// PolicyMetadata policy metadata resource definition. -type PolicyMetadata struct { - autorest.Response `json:"-"` - // PolicyMetadataProperties - Properties of the policy metadata. - *PolicyMetadataProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the policy metadata. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; The type of the policy metadata. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; The name of the policy metadata. - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyMetadata. -func (pm PolicyMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pm.PolicyMetadataProperties != nil { - objectMap["properties"] = pm.PolicyMetadataProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PolicyMetadata struct. -func (pm *PolicyMetadata) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var policyMetadataProperties PolicyMetadataProperties - err = json.Unmarshal(*v, &policyMetadataProperties) - if err != nil { - return err - } - pm.PolicyMetadataProperties = &policyMetadataProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pm.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pm.Type = &typeVar - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pm.Name = &name - } - } - } - - return nil -} - -// PolicyMetadataCollection collection of policy metadata resources. -type PolicyMetadataCollection struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of policy metadata definitions. - Value *[]SlimPolicyMetadata `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyMetadataCollection. -func (pmc PolicyMetadataCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PolicyMetadataCollectionIterator provides access to a complete listing of SlimPolicyMetadata values. -type PolicyMetadataCollectionIterator struct { - i int - page PolicyMetadataCollectionPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PolicyMetadataCollectionIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyMetadataCollectionIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PolicyMetadataCollectionIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PolicyMetadataCollectionIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PolicyMetadataCollectionIterator) Response() PolicyMetadataCollection { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PolicyMetadataCollectionIterator) Value() SlimPolicyMetadata { - if !iter.page.NotDone() { - return SlimPolicyMetadata{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PolicyMetadataCollectionIterator type. -func NewPolicyMetadataCollectionIterator(page PolicyMetadataCollectionPage) PolicyMetadataCollectionIterator { - return PolicyMetadataCollectionIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pmc PolicyMetadataCollection) IsEmpty() bool { - return pmc.Value == nil || len(*pmc.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pmc PolicyMetadataCollection) hasNextLink() bool { - return pmc.NextLink != nil && len(*pmc.NextLink) != 0 -} - -// policyMetadataCollectionPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pmc PolicyMetadataCollection) policyMetadataCollectionPreparer(ctx context.Context) (*http.Request, error) { - if !pmc.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pmc.NextLink))) -} - -// PolicyMetadataCollectionPage contains a page of SlimPolicyMetadata values. -type PolicyMetadataCollectionPage struct { - fn func(context.Context, PolicyMetadataCollection) (PolicyMetadataCollection, error) - pmc PolicyMetadataCollection -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PolicyMetadataCollectionPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyMetadataCollectionPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.pmc) - if err != nil { - return err - } - page.pmc = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PolicyMetadataCollectionPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PolicyMetadataCollectionPage) NotDone() bool { - return !page.pmc.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PolicyMetadataCollectionPage) Response() PolicyMetadataCollection { - return page.pmc -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PolicyMetadataCollectionPage) Values() []SlimPolicyMetadata { - if page.pmc.IsEmpty() { - return nil - } - return *page.pmc.Value -} - -// Creates a new instance of the PolicyMetadataCollectionPage type. -func NewPolicyMetadataCollectionPage(cur PolicyMetadataCollection, getNextPage func(context.Context, PolicyMetadataCollection) (PolicyMetadataCollection, error)) PolicyMetadataCollectionPage { - return PolicyMetadataCollectionPage{ - fn: getNextPage, - pmc: cur, - } -} - -// PolicyMetadataProperties the properties of the policy metadata. -type PolicyMetadataProperties struct { - // Description - READ-ONLY; The description of the policy metadata. - Description *string `json:"description,omitempty"` - // Requirements - READ-ONLY; The requirements of the policy metadata. - Requirements *string `json:"requirements,omitempty"` - // MetadataID - READ-ONLY; The policy metadata identifier. - MetadataID *string `json:"metadataId,omitempty"` - // Category - READ-ONLY; The category of the policy metadata. - Category *string `json:"category,omitempty"` - // Title - READ-ONLY; The title of the policy metadata. - Title *string `json:"title,omitempty"` - // Owner - READ-ONLY; The owner of the policy metadata. - Owner *string `json:"owner,omitempty"` - // AdditionalContentURL - READ-ONLY; Url for getting additional content about the resource metadata. - AdditionalContentURL *string `json:"additionalContentUrl,omitempty"` - // Metadata - READ-ONLY; Additional metadata. - Metadata interface{} `json:"metadata,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyMetadataProperties. -func (pmp PolicyMetadataProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PolicyMetadataSlimProperties the properties of the policy metadata, excluding properties containing -// large strings -type PolicyMetadataSlimProperties struct { - // MetadataID - READ-ONLY; The policy metadata identifier. - MetadataID *string `json:"metadataId,omitempty"` - // Category - READ-ONLY; The category of the policy metadata. - Category *string `json:"category,omitempty"` - // Title - READ-ONLY; The title of the policy metadata. - Title *string `json:"title,omitempty"` - // Owner - READ-ONLY; The owner of the policy metadata. - Owner *string `json:"owner,omitempty"` - // AdditionalContentURL - READ-ONLY; Url for getting additional content about the resource metadata. - AdditionalContentURL *string `json:"additionalContentUrl,omitempty"` - // Metadata - READ-ONLY; Additional metadata. - Metadata interface{} `json:"metadata,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyMetadataSlimProperties. -func (pmsp PolicyMetadataSlimProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PolicyState policy state record. -type PolicyState struct { - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - // OdataID - OData entity ID; always set to null since policy state records do not have an entity ID. - OdataID *string `json:"@odata.id,omitempty"` - // OdataContext - OData context string; used by OData clients to resolve type information based on metadata. - OdataContext *string `json:"@odata.context,omitempty"` - // Timestamp - Timestamp for the policy state record. - Timestamp *date.Time `json:"timestamp,omitempty"` - // ResourceID - Resource ID. - ResourceID *string `json:"resourceId,omitempty"` - // PolicyAssignmentID - Policy assignment ID. - PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"` - // PolicyDefinitionID - Policy definition ID. - PolicyDefinitionID *string `json:"policyDefinitionId,omitempty"` - // EffectiveParameters - Effective parameters for the policy assignment. - EffectiveParameters *string `json:"effectiveParameters,omitempty"` - // IsCompliant - Flag which states whether the resource is compliant against the policy assignment it was evaluated against. This property is deprecated; please use ComplianceState instead. - IsCompliant *bool `json:"isCompliant,omitempty"` - // SubscriptionID - Subscription ID. - SubscriptionID *string `json:"subscriptionId,omitempty"` - // ResourceType - Resource type. - ResourceType *string `json:"resourceType,omitempty"` - // ResourceLocation - Resource location. - ResourceLocation *string `json:"resourceLocation,omitempty"` - // ResourceGroup - Resource group name. - ResourceGroup *string `json:"resourceGroup,omitempty"` - // ResourceTags - List of resource tags. - ResourceTags *string `json:"resourceTags,omitempty"` - // PolicyAssignmentName - Policy assignment name. - PolicyAssignmentName *string `json:"policyAssignmentName,omitempty"` - // PolicyAssignmentOwner - Policy assignment owner. - PolicyAssignmentOwner *string `json:"policyAssignmentOwner,omitempty"` - // PolicyAssignmentParameters - Policy assignment parameters. - PolicyAssignmentParameters *string `json:"policyAssignmentParameters,omitempty"` - // PolicyAssignmentScope - Policy assignment scope. - PolicyAssignmentScope *string `json:"policyAssignmentScope,omitempty"` - // PolicyDefinitionName - Policy definition name. - PolicyDefinitionName *string `json:"policyDefinitionName,omitempty"` - // PolicyDefinitionAction - Policy definition action, i.e. effect. - PolicyDefinitionAction *string `json:"policyDefinitionAction,omitempty"` - // PolicyDefinitionCategory - Policy definition category. - PolicyDefinitionCategory *string `json:"policyDefinitionCategory,omitempty"` - // PolicySetDefinitionID - Policy set definition ID, if the policy assignment is for a policy set. - PolicySetDefinitionID *string `json:"policySetDefinitionId,omitempty"` - // PolicySetDefinitionName - Policy set definition name, if the policy assignment is for a policy set. - PolicySetDefinitionName *string `json:"policySetDefinitionName,omitempty"` - // PolicySetDefinitionOwner - Policy set definition owner, if the policy assignment is for a policy set. - PolicySetDefinitionOwner *string `json:"policySetDefinitionOwner,omitempty"` - // PolicySetDefinitionCategory - Policy set definition category, if the policy assignment is for a policy set. - PolicySetDefinitionCategory *string `json:"policySetDefinitionCategory,omitempty"` - // PolicySetDefinitionParameters - Policy set definition parameters, if the policy assignment is for a policy set. - PolicySetDefinitionParameters *string `json:"policySetDefinitionParameters,omitempty"` - // ManagementGroupIds - Comma separated list of management group IDs, which represent the hierarchy of the management groups the resource is under. - ManagementGroupIds *string `json:"managementGroupIds,omitempty"` - // PolicyDefinitionReferenceID - Reference ID for the policy definition inside the policy set, if the policy assignment is for a policy set. - PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"` - // ComplianceState - Compliance state of the resource. - ComplianceState *string `json:"complianceState,omitempty"` - // PolicyEvaluationDetails - Policy evaluation details. - PolicyEvaluationDetails *PolicyEvaluationDetails `json:"policyEvaluationDetails,omitempty"` - // PolicyDefinitionGroupNames - Policy definition group names. - PolicyDefinitionGroupNames *[]string `json:"policyDefinitionGroupNames,omitempty"` - // Components - Components state compliance records populated only when URL contains $expand=components clause. - Components *[]ComponentStateDetails `json:"components,omitempty"` - // PolicyDefinitionVersion - READ-ONLY; Evaluated policy definition version. - PolicyDefinitionVersion *string `json:"policyDefinitionVersion,omitempty"` - // PolicySetDefinitionVersion - READ-ONLY; Evaluated policy set definition version. - PolicySetDefinitionVersion *string `json:"policySetDefinitionVersion,omitempty"` - // PolicyAssignmentVersion - READ-ONLY; Evaluated policy assignment version. - PolicyAssignmentVersion *string `json:"policyAssignmentVersion,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyState. -func (ps PolicyState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ps.OdataID != nil { - objectMap["@odata.id"] = ps.OdataID - } - if ps.OdataContext != nil { - objectMap["@odata.context"] = ps.OdataContext - } - if ps.Timestamp != nil { - objectMap["timestamp"] = ps.Timestamp - } - if ps.ResourceID != nil { - objectMap["resourceId"] = ps.ResourceID - } - if ps.PolicyAssignmentID != nil { - objectMap["policyAssignmentId"] = ps.PolicyAssignmentID - } - if ps.PolicyDefinitionID != nil { - objectMap["policyDefinitionId"] = ps.PolicyDefinitionID - } - if ps.EffectiveParameters != nil { - objectMap["effectiveParameters"] = ps.EffectiveParameters - } - if ps.IsCompliant != nil { - objectMap["isCompliant"] = ps.IsCompliant - } - if ps.SubscriptionID != nil { - objectMap["subscriptionId"] = ps.SubscriptionID - } - if ps.ResourceType != nil { - objectMap["resourceType"] = ps.ResourceType - } - if ps.ResourceLocation != nil { - objectMap["resourceLocation"] = ps.ResourceLocation - } - if ps.ResourceGroup != nil { - objectMap["resourceGroup"] = ps.ResourceGroup - } - if ps.ResourceTags != nil { - objectMap["resourceTags"] = ps.ResourceTags - } - if ps.PolicyAssignmentName != nil { - objectMap["policyAssignmentName"] = ps.PolicyAssignmentName - } - if ps.PolicyAssignmentOwner != nil { - objectMap["policyAssignmentOwner"] = ps.PolicyAssignmentOwner - } - if ps.PolicyAssignmentParameters != nil { - objectMap["policyAssignmentParameters"] = ps.PolicyAssignmentParameters - } - if ps.PolicyAssignmentScope != nil { - objectMap["policyAssignmentScope"] = ps.PolicyAssignmentScope - } - if ps.PolicyDefinitionName != nil { - objectMap["policyDefinitionName"] = ps.PolicyDefinitionName - } - if ps.PolicyDefinitionAction != nil { - objectMap["policyDefinitionAction"] = ps.PolicyDefinitionAction - } - if ps.PolicyDefinitionCategory != nil { - objectMap["policyDefinitionCategory"] = ps.PolicyDefinitionCategory - } - if ps.PolicySetDefinitionID != nil { - objectMap["policySetDefinitionId"] = ps.PolicySetDefinitionID - } - if ps.PolicySetDefinitionName != nil { - objectMap["policySetDefinitionName"] = ps.PolicySetDefinitionName - } - if ps.PolicySetDefinitionOwner != nil { - objectMap["policySetDefinitionOwner"] = ps.PolicySetDefinitionOwner - } - if ps.PolicySetDefinitionCategory != nil { - objectMap["policySetDefinitionCategory"] = ps.PolicySetDefinitionCategory - } - if ps.PolicySetDefinitionParameters != nil { - objectMap["policySetDefinitionParameters"] = ps.PolicySetDefinitionParameters - } - if ps.ManagementGroupIds != nil { - objectMap["managementGroupIds"] = ps.ManagementGroupIds - } - if ps.PolicyDefinitionReferenceID != nil { - objectMap["policyDefinitionReferenceId"] = ps.PolicyDefinitionReferenceID - } - if ps.ComplianceState != nil { - objectMap["complianceState"] = ps.ComplianceState - } - if ps.PolicyEvaluationDetails != nil { - objectMap["policyEvaluationDetails"] = ps.PolicyEvaluationDetails - } - if ps.PolicyDefinitionGroupNames != nil { - objectMap["policyDefinitionGroupNames"] = ps.PolicyDefinitionGroupNames - } - if ps.Components != nil { - objectMap["components"] = ps.Components - } - for k, v := range ps.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PolicyState struct. -func (ps *PolicyState) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - default: - if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) - if err != nil { - return err - } - if ps.AdditionalProperties == nil { - ps.AdditionalProperties = make(map[string]interface{}) - } - ps.AdditionalProperties[k] = additionalProperties - } - case "@odata.id": - if v != nil { - var odataID string - err = json.Unmarshal(*v, &odataID) - if err != nil { - return err - } - ps.OdataID = &odataID - } - case "@odata.context": - if v != nil { - var odataContext string - err = json.Unmarshal(*v, &odataContext) - if err != nil { - return err - } - ps.OdataContext = &odataContext - } - case "timestamp": - if v != nil { - var timestamp date.Time - err = json.Unmarshal(*v, ×tamp) - if err != nil { - return err - } - ps.Timestamp = ×tamp - } - case "resourceId": - if v != nil { - var resourceID string - err = json.Unmarshal(*v, &resourceID) - if err != nil { - return err - } - ps.ResourceID = &resourceID - } - case "policyAssignmentId": - if v != nil { - var policyAssignmentID string - err = json.Unmarshal(*v, &policyAssignmentID) - if err != nil { - return err - } - ps.PolicyAssignmentID = &policyAssignmentID - } - case "policyDefinitionId": - if v != nil { - var policyDefinitionID string - err = json.Unmarshal(*v, &policyDefinitionID) - if err != nil { - return err - } - ps.PolicyDefinitionID = &policyDefinitionID - } - case "effectiveParameters": - if v != nil { - var effectiveParameters string - err = json.Unmarshal(*v, &effectiveParameters) - if err != nil { - return err - } - ps.EffectiveParameters = &effectiveParameters - } - case "isCompliant": - if v != nil { - var isCompliant bool - err = json.Unmarshal(*v, &isCompliant) - if err != nil { - return err - } - ps.IsCompliant = &isCompliant - } - case "subscriptionId": - if v != nil { - var subscriptionID string - err = json.Unmarshal(*v, &subscriptionID) - if err != nil { - return err - } - ps.SubscriptionID = &subscriptionID - } - case "resourceType": - if v != nil { - var resourceType string - err = json.Unmarshal(*v, &resourceType) - if err != nil { - return err - } - ps.ResourceType = &resourceType - } - case "resourceLocation": - if v != nil { - var resourceLocation string - err = json.Unmarshal(*v, &resourceLocation) - if err != nil { - return err - } - ps.ResourceLocation = &resourceLocation - } - case "resourceGroup": - if v != nil { - var resourceGroup string - err = json.Unmarshal(*v, &resourceGroup) - if err != nil { - return err - } - ps.ResourceGroup = &resourceGroup - } - case "resourceTags": - if v != nil { - var resourceTags string - err = json.Unmarshal(*v, &resourceTags) - if err != nil { - return err - } - ps.ResourceTags = &resourceTags - } - case "policyAssignmentName": - if v != nil { - var policyAssignmentName string - err = json.Unmarshal(*v, &policyAssignmentName) - if err != nil { - return err - } - ps.PolicyAssignmentName = &policyAssignmentName - } - case "policyAssignmentOwner": - if v != nil { - var policyAssignmentOwner string - err = json.Unmarshal(*v, &policyAssignmentOwner) - if err != nil { - return err - } - ps.PolicyAssignmentOwner = &policyAssignmentOwner - } - case "policyAssignmentParameters": - if v != nil { - var policyAssignmentParameters string - err = json.Unmarshal(*v, &policyAssignmentParameters) - if err != nil { - return err - } - ps.PolicyAssignmentParameters = &policyAssignmentParameters - } - case "policyAssignmentScope": - if v != nil { - var policyAssignmentScope string - err = json.Unmarshal(*v, &policyAssignmentScope) - if err != nil { - return err - } - ps.PolicyAssignmentScope = &policyAssignmentScope - } - case "policyDefinitionName": - if v != nil { - var policyDefinitionName string - err = json.Unmarshal(*v, &policyDefinitionName) - if err != nil { - return err - } - ps.PolicyDefinitionName = &policyDefinitionName - } - case "policyDefinitionAction": - if v != nil { - var policyDefinitionAction string - err = json.Unmarshal(*v, &policyDefinitionAction) - if err != nil { - return err - } - ps.PolicyDefinitionAction = &policyDefinitionAction - } - case "policyDefinitionCategory": - if v != nil { - var policyDefinitionCategory string - err = json.Unmarshal(*v, &policyDefinitionCategory) - if err != nil { - return err - } - ps.PolicyDefinitionCategory = &policyDefinitionCategory - } - case "policySetDefinitionId": - if v != nil { - var policySetDefinitionID string - err = json.Unmarshal(*v, &policySetDefinitionID) - if err != nil { - return err - } - ps.PolicySetDefinitionID = &policySetDefinitionID - } - case "policySetDefinitionName": - if v != nil { - var policySetDefinitionName string - err = json.Unmarshal(*v, &policySetDefinitionName) - if err != nil { - return err - } - ps.PolicySetDefinitionName = &policySetDefinitionName - } - case "policySetDefinitionOwner": - if v != nil { - var policySetDefinitionOwner string - err = json.Unmarshal(*v, &policySetDefinitionOwner) - if err != nil { - return err - } - ps.PolicySetDefinitionOwner = &policySetDefinitionOwner - } - case "policySetDefinitionCategory": - if v != nil { - var policySetDefinitionCategory string - err = json.Unmarshal(*v, &policySetDefinitionCategory) - if err != nil { - return err - } - ps.PolicySetDefinitionCategory = &policySetDefinitionCategory - } - case "policySetDefinitionParameters": - if v != nil { - var policySetDefinitionParameters string - err = json.Unmarshal(*v, &policySetDefinitionParameters) - if err != nil { - return err - } - ps.PolicySetDefinitionParameters = &policySetDefinitionParameters - } - case "managementGroupIds": - if v != nil { - var managementGroupIds string - err = json.Unmarshal(*v, &managementGroupIds) - if err != nil { - return err - } - ps.ManagementGroupIds = &managementGroupIds - } - case "policyDefinitionReferenceId": - if v != nil { - var policyDefinitionReferenceID string - err = json.Unmarshal(*v, &policyDefinitionReferenceID) - if err != nil { - return err - } - ps.PolicyDefinitionReferenceID = &policyDefinitionReferenceID - } - case "complianceState": - if v != nil { - var complianceState string - err = json.Unmarshal(*v, &complianceState) - if err != nil { - return err - } - ps.ComplianceState = &complianceState - } - case "policyEvaluationDetails": - if v != nil { - var policyEvaluationDetails PolicyEvaluationDetails - err = json.Unmarshal(*v, &policyEvaluationDetails) - if err != nil { - return err - } - ps.PolicyEvaluationDetails = &policyEvaluationDetails - } - case "policyDefinitionGroupNames": - if v != nil { - var policyDefinitionGroupNames []string - err = json.Unmarshal(*v, &policyDefinitionGroupNames) - if err != nil { - return err - } - ps.PolicyDefinitionGroupNames = &policyDefinitionGroupNames - } - case "components": - if v != nil { - var components []ComponentStateDetails - err = json.Unmarshal(*v, &components) - if err != nil { - return err - } - ps.Components = &components - } - case "policyDefinitionVersion": - if v != nil { - var policyDefinitionVersion string - err = json.Unmarshal(*v, &policyDefinitionVersion) - if err != nil { - return err - } - ps.PolicyDefinitionVersion = &policyDefinitionVersion - } - case "policySetDefinitionVersion": - if v != nil { - var policySetDefinitionVersion string - err = json.Unmarshal(*v, &policySetDefinitionVersion) - if err != nil { - return err - } - ps.PolicySetDefinitionVersion = &policySetDefinitionVersion - } - case "policyAssignmentVersion": - if v != nil { - var policyAssignmentVersion string - err = json.Unmarshal(*v, &policyAssignmentVersion) - if err != nil { - return err - } - ps.PolicyAssignmentVersion = &policyAssignmentVersion - } - } - } - - return nil -} - -// PolicyStatesQueryResults query results. -type PolicyStatesQueryResults struct { - autorest.Response `json:"-"` - // OdataContext - OData context string; used by OData clients to resolve type information based on metadata. - OdataContext *string `json:"@odata.context,omitempty"` - // OdataCount - OData entity count; represents the number of policy state records returned. - OdataCount *int32 `json:"@odata.count,omitempty"` - // OdataNextLink - Odata next link; URL to get the next set of results. - OdataNextLink *string `json:"@odata.nextLink,omitempty"` - // Value - Query results. - Value *[]PolicyState `json:"value,omitempty"` -} - -// PolicyStatesQueryResultsIterator provides access to a complete listing of PolicyState values. -type PolicyStatesQueryResultsIterator struct { - i int - page PolicyStatesQueryResultsPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PolicyStatesQueryResultsIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesQueryResultsIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PolicyStatesQueryResultsIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PolicyStatesQueryResultsIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PolicyStatesQueryResultsIterator) Response() PolicyStatesQueryResults { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PolicyStatesQueryResultsIterator) Value() PolicyState { - if !iter.page.NotDone() { - return PolicyState{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PolicyStatesQueryResultsIterator type. -func NewPolicyStatesQueryResultsIterator(page PolicyStatesQueryResultsPage) PolicyStatesQueryResultsIterator { - return PolicyStatesQueryResultsIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (psqr PolicyStatesQueryResults) IsEmpty() bool { - return psqr.Value == nil || len(*psqr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (psqr PolicyStatesQueryResults) hasNextLink() bool { - return psqr.OdataNextLink != nil && len(*psqr.OdataNextLink) != 0 -} - -// policyStatesQueryResultsPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (psqr PolicyStatesQueryResults) policyStatesQueryResultsPreparer(ctx context.Context) (*http.Request, error) { - if !psqr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(psqr.OdataNextLink))) -} - -// PolicyStatesQueryResultsPage contains a page of PolicyState values. -type PolicyStatesQueryResultsPage struct { - fn func(context.Context, PolicyStatesQueryResults) (PolicyStatesQueryResults, error) - psqr PolicyStatesQueryResults -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PolicyStatesQueryResultsPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesQueryResultsPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.psqr) - if err != nil { - return err - } - page.psqr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PolicyStatesQueryResultsPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PolicyStatesQueryResultsPage) NotDone() bool { - return !page.psqr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PolicyStatesQueryResultsPage) Response() PolicyStatesQueryResults { - return page.psqr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PolicyStatesQueryResultsPage) Values() []PolicyState { - if page.psqr.IsEmpty() { - return nil - } - return *page.psqr.Value -} - -// Creates a new instance of the PolicyStatesQueryResultsPage type. -func NewPolicyStatesQueryResultsPage(cur PolicyStatesQueryResults, getNextPage func(context.Context, PolicyStatesQueryResults) (PolicyStatesQueryResults, error)) PolicyStatesQueryResultsPage { - return PolicyStatesQueryResultsPage{ - fn: getNextPage, - psqr: cur, - } -} - -// PolicyStatesTriggerResourceGroupEvaluationFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type PolicyStatesTriggerResourceGroupEvaluationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PolicyStatesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PolicyStatesTriggerResourceGroupEvaluationFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PolicyStatesTriggerResourceGroupEvaluationFuture.Result. -func (future *PolicyStatesTriggerResourceGroupEvaluationFuture) result(client PolicyStatesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesTriggerResourceGroupEvaluationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("policyinsights.PolicyStatesTriggerResourceGroupEvaluationFuture") - return - } - ar.Response = future.Response() - return -} - -// PolicyStatesTriggerSubscriptionEvaluationFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PolicyStatesTriggerSubscriptionEvaluationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PolicyStatesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PolicyStatesTriggerSubscriptionEvaluationFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PolicyStatesTriggerSubscriptionEvaluationFuture.Result. -func (future *PolicyStatesTriggerSubscriptionEvaluationFuture) result(client PolicyStatesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesTriggerSubscriptionEvaluationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("policyinsights.PolicyStatesTriggerSubscriptionEvaluationFuture") - return - } - ar.Response = future.Response() - return -} - -// PolicyTrackedResource policy tracked resource record. -type PolicyTrackedResource struct { - // TrackedResourceID - READ-ONLY; The ID of the policy tracked resource. - TrackedResourceID *string `json:"trackedResourceId,omitempty"` - // PolicyDetails - READ-ONLY; The details of the policy that require the tracked resource. - PolicyDetails *PolicyDetails `json:"policyDetails,omitempty"` - // CreatedBy - READ-ONLY; The details of the policy triggered deployment that created the tracked resource. - CreatedBy *TrackedResourceModificationDetails `json:"createdBy,omitempty"` - // LastModifiedBy - READ-ONLY; The details of the policy triggered deployment that modified the tracked resource. - LastModifiedBy *TrackedResourceModificationDetails `json:"lastModifiedBy,omitempty"` - // LastUpdateUtc - READ-ONLY; Timestamp of the last update to the tracked resource. - LastUpdateUtc *date.Time `json:"lastUpdateUtc,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyTrackedResource. -func (ptr PolicyTrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PolicyTrackedResourcesQueryResults query results. -type PolicyTrackedResourcesQueryResults struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Query results. - Value *[]PolicyTrackedResource `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyTrackedResourcesQueryResults. -func (ptrqr PolicyTrackedResourcesQueryResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PolicyTrackedResourcesQueryResultsIterator provides access to a complete listing of -// PolicyTrackedResource values. -type PolicyTrackedResourcesQueryResultsIterator struct { - i int - page PolicyTrackedResourcesQueryResultsPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PolicyTrackedResourcesQueryResultsIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyTrackedResourcesQueryResultsIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PolicyTrackedResourcesQueryResultsIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PolicyTrackedResourcesQueryResultsIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PolicyTrackedResourcesQueryResultsIterator) Response() PolicyTrackedResourcesQueryResults { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PolicyTrackedResourcesQueryResultsIterator) Value() PolicyTrackedResource { - if !iter.page.NotDone() { - return PolicyTrackedResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PolicyTrackedResourcesQueryResultsIterator type. -func NewPolicyTrackedResourcesQueryResultsIterator(page PolicyTrackedResourcesQueryResultsPage) PolicyTrackedResourcesQueryResultsIterator { - return PolicyTrackedResourcesQueryResultsIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ptrqr PolicyTrackedResourcesQueryResults) IsEmpty() bool { - return ptrqr.Value == nil || len(*ptrqr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ptrqr PolicyTrackedResourcesQueryResults) hasNextLink() bool { - return ptrqr.NextLink != nil && len(*ptrqr.NextLink) != 0 -} - -// policyTrackedResourcesQueryResultsPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ptrqr PolicyTrackedResourcesQueryResults) policyTrackedResourcesQueryResultsPreparer(ctx context.Context) (*http.Request, error) { - if !ptrqr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ptrqr.NextLink))) -} - -// PolicyTrackedResourcesQueryResultsPage contains a page of PolicyTrackedResource values. -type PolicyTrackedResourcesQueryResultsPage struct { - fn func(context.Context, PolicyTrackedResourcesQueryResults) (PolicyTrackedResourcesQueryResults, error) - ptrqr PolicyTrackedResourcesQueryResults -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PolicyTrackedResourcesQueryResultsPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyTrackedResourcesQueryResultsPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ptrqr) - if err != nil { - return err - } - page.ptrqr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PolicyTrackedResourcesQueryResultsPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PolicyTrackedResourcesQueryResultsPage) NotDone() bool { - return !page.ptrqr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PolicyTrackedResourcesQueryResultsPage) Response() PolicyTrackedResourcesQueryResults { - return page.ptrqr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PolicyTrackedResourcesQueryResultsPage) Values() []PolicyTrackedResource { - if page.ptrqr.IsEmpty() { - return nil - } - return *page.ptrqr.Value -} - -// Creates a new instance of the PolicyTrackedResourcesQueryResultsPage type. -func NewPolicyTrackedResourcesQueryResultsPage(cur PolicyTrackedResourcesQueryResults, getNextPage func(context.Context, PolicyTrackedResourcesQueryResults) (PolicyTrackedResourcesQueryResults, error)) PolicyTrackedResourcesQueryResultsPage { - return PolicyTrackedResourcesQueryResultsPage{ - fn: getNextPage, - ptrqr: cur, - } -} - -// QueryFailure error response. -type QueryFailure struct { - // Error - Error definition. - Error *QueryFailureError `json:"error,omitempty"` -} - -// QueryFailureError error definition. -type QueryFailureError struct { - // Code - READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; Description of the error. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueryFailureError. -func (qf QueryFailureError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Remediation the remediation definition. -type Remediation struct { - autorest.Response `json:"-"` - // RemediationProperties - Properties for the remediation. - *RemediationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the remediation. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; The type of the remediation. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; The name of the remediation. - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for Remediation. -func (r Remediation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.RemediationProperties != nil { - objectMap["properties"] = r.RemediationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Remediation struct. -func (r *Remediation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var remediationProperties RemediationProperties - err = json.Unmarshal(*v, &remediationProperties) - if err != nil { - return err - } - r.RemediationProperties = &remediationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - r.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - r.Type = &typeVar - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - r.Name = &name - } - } - } - - return nil -} - -// RemediationDeployment details of a single deployment created by the remediation. -type RemediationDeployment struct { - // RemediatedResourceID - READ-ONLY; Resource ID of the resource that is being remediated by the deployment. - RemediatedResourceID *string `json:"remediatedResourceId,omitempty"` - // DeploymentID - READ-ONLY; Resource ID of the template deployment that will remediate the resource. - DeploymentID *string `json:"deploymentId,omitempty"` - // Status - READ-ONLY; Status of the remediation deployment. - Status *string `json:"status,omitempty"` - // ResourceLocation - READ-ONLY; Location of the resource that is being remediated. - ResourceLocation *string `json:"resourceLocation,omitempty"` - // Error - READ-ONLY; Error encountered while remediated the resource. - Error *ErrorDefinition `json:"error,omitempty"` - // CreatedOn - READ-ONLY; The time at which the remediation was created. - CreatedOn *date.Time `json:"createdOn,omitempty"` - // LastUpdatedOn - READ-ONLY; The time at which the remediation deployment was last updated. - LastUpdatedOn *date.Time `json:"lastUpdatedOn,omitempty"` -} - -// MarshalJSON is the custom marshaler for RemediationDeployment. -func (rd RemediationDeployment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RemediationDeploymentsListResult list of deployments for a remediation. -type RemediationDeploymentsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of deployments for the remediation. - Value *[]RemediationDeployment `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RemediationDeploymentsListResult. -func (rdlr RemediationDeploymentsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RemediationDeploymentsListResultIterator provides access to a complete listing of RemediationDeployment -// values. -type RemediationDeploymentsListResultIterator struct { - i int - page RemediationDeploymentsListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RemediationDeploymentsListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationDeploymentsListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RemediationDeploymentsListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RemediationDeploymentsListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RemediationDeploymentsListResultIterator) Response() RemediationDeploymentsListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RemediationDeploymentsListResultIterator) Value() RemediationDeployment { - if !iter.page.NotDone() { - return RemediationDeployment{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RemediationDeploymentsListResultIterator type. -func NewRemediationDeploymentsListResultIterator(page RemediationDeploymentsListResultPage) RemediationDeploymentsListResultIterator { - return RemediationDeploymentsListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rdlr RemediationDeploymentsListResult) IsEmpty() bool { - return rdlr.Value == nil || len(*rdlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rdlr RemediationDeploymentsListResult) hasNextLink() bool { - return rdlr.NextLink != nil && len(*rdlr.NextLink) != 0 -} - -// remediationDeploymentsListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rdlr RemediationDeploymentsListResult) remediationDeploymentsListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rdlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rdlr.NextLink))) -} - -// RemediationDeploymentsListResultPage contains a page of RemediationDeployment values. -type RemediationDeploymentsListResultPage struct { - fn func(context.Context, RemediationDeploymentsListResult) (RemediationDeploymentsListResult, error) - rdlr RemediationDeploymentsListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RemediationDeploymentsListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationDeploymentsListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rdlr) - if err != nil { - return err - } - page.rdlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RemediationDeploymentsListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RemediationDeploymentsListResultPage) NotDone() bool { - return !page.rdlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RemediationDeploymentsListResultPage) Response() RemediationDeploymentsListResult { - return page.rdlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RemediationDeploymentsListResultPage) Values() []RemediationDeployment { - if page.rdlr.IsEmpty() { - return nil - } - return *page.rdlr.Value -} - -// Creates a new instance of the RemediationDeploymentsListResultPage type. -func NewRemediationDeploymentsListResultPage(cur RemediationDeploymentsListResult, getNextPage func(context.Context, RemediationDeploymentsListResult) (RemediationDeploymentsListResult, error)) RemediationDeploymentsListResultPage { - return RemediationDeploymentsListResultPage{ - fn: getNextPage, - rdlr: cur, - } -} - -// RemediationDeploymentSummary the deployment status summary for all deployments created by the -// remediation. -type RemediationDeploymentSummary struct { - // TotalDeployments - READ-ONLY; The number of deployments required by the remediation. - TotalDeployments *int32 `json:"totalDeployments,omitempty"` - // SuccessfulDeployments - READ-ONLY; The number of deployments required by the remediation that have succeeded. - SuccessfulDeployments *int32 `json:"successfulDeployments,omitempty"` - // FailedDeployments - READ-ONLY; The number of deployments required by the remediation that have failed. - FailedDeployments *int32 `json:"failedDeployments,omitempty"` -} - -// MarshalJSON is the custom marshaler for RemediationDeploymentSummary. -func (rds RemediationDeploymentSummary) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RemediationFilters the filters that will be applied to determine which resources to remediate. -type RemediationFilters struct { - // Locations - The resource locations that will be remediated. - Locations *[]string `json:"locations,omitempty"` -} - -// RemediationListResult list of remediations. -type RemediationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of remediation definitions. - Value *[]Remediation `json:"value,omitempty"` - // NextLink - READ-ONLY; The URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for RemediationListResult. -func (rlr RemediationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// RemediationListResultIterator provides access to a complete listing of Remediation values. -type RemediationListResultIterator struct { - i int - page RemediationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RemediationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RemediationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RemediationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RemediationListResultIterator) Response() RemediationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RemediationListResultIterator) Value() Remediation { - if !iter.page.NotDone() { - return Remediation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RemediationListResultIterator type. -func NewRemediationListResultIterator(page RemediationListResultPage) RemediationListResultIterator { - return RemediationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RemediationListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RemediationListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// remediationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RemediationListResult) remediationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rlr.NextLink))) -} - -// RemediationListResultPage contains a page of Remediation values. -type RemediationListResultPage struct { - fn func(context.Context, RemediationListResult) (RemediationListResult, error) - rlr RemediationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RemediationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rlr) - if err != nil { - return err - } - page.rlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RemediationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RemediationListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RemediationListResultPage) Response() RemediationListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RemediationListResultPage) Values() []Remediation { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RemediationListResultPage type. -func NewRemediationListResultPage(cur RemediationListResult, getNextPage func(context.Context, RemediationListResult) (RemediationListResult, error)) RemediationListResultPage { - return RemediationListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// RemediationProperties the remediation properties. -type RemediationProperties struct { - // PolicyAssignmentID - The resource ID of the policy assignment that should be remediated. - PolicyAssignmentID *string `json:"policyAssignmentId,omitempty"` - // PolicyDefinitionReferenceID - The policy definition reference ID of the individual definition that should be remediated. Required when the policy assignment being remediated assigns a policy set definition. - PolicyDefinitionReferenceID *string `json:"policyDefinitionReferenceId,omitempty"` - // ResourceDiscoveryMode - The way resources to remediate are discovered. Defaults to ExistingNonCompliant if not specified. Possible values include: 'ExistingNonCompliant', 'ReEvaluateCompliance' - ResourceDiscoveryMode ResourceDiscoveryMode `json:"resourceDiscoveryMode,omitempty"` - // ProvisioningState - READ-ONLY; The status of the remediation. - ProvisioningState *string `json:"provisioningState,omitempty"` - // CreatedOn - READ-ONLY; The time at which the remediation was created. - CreatedOn *date.Time `json:"createdOn,omitempty"` - // LastUpdatedOn - READ-ONLY; The time at which the remediation was last updated. - LastUpdatedOn *date.Time `json:"lastUpdatedOn,omitempty"` - // Filters - The filters that will be applied to determine which resources to remediate. - Filters *RemediationFilters `json:"filters,omitempty"` - // DeploymentStatus - READ-ONLY; The deployment status summary for all deployments created by the remediation. - DeploymentStatus *RemediationDeploymentSummary `json:"deploymentStatus,omitempty"` -} - -// MarshalJSON is the custom marshaler for RemediationProperties. -func (rp RemediationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rp.PolicyAssignmentID != nil { - objectMap["policyAssignmentId"] = rp.PolicyAssignmentID - } - if rp.PolicyDefinitionReferenceID != nil { - objectMap["policyDefinitionReferenceId"] = rp.PolicyDefinitionReferenceID - } - if rp.ResourceDiscoveryMode != "" { - objectMap["resourceDiscoveryMode"] = rp.ResourceDiscoveryMode - } - if rp.Filters != nil { - objectMap["filters"] = rp.Filters - } - return json.Marshal(objectMap) -} - -// SlimPolicyMetadata slim version of policy metadata resource definition, excluding properties with large -// strings -type SlimPolicyMetadata struct { - // PolicyMetadataSlimProperties - Properties of the policy metadata. - *PolicyMetadataSlimProperties `json:"properties,omitempty"` - // ID - READ-ONLY; The ID of the policy metadata. - ID *string `json:"id,omitempty"` - // Type - READ-ONLY; The type of the policy metadata. - Type *string `json:"type,omitempty"` - // Name - READ-ONLY; The name of the policy metadata. - Name *string `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for SlimPolicyMetadata. -func (spm SlimPolicyMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spm.PolicyMetadataSlimProperties != nil { - objectMap["properties"] = spm.PolicyMetadataSlimProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SlimPolicyMetadata struct. -func (spm *SlimPolicyMetadata) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var policyMetadataSlimProperties PolicyMetadataSlimProperties - err = json.Unmarshal(*v, &policyMetadataSlimProperties) - if err != nil { - return err - } - spm.PolicyMetadataSlimProperties = &policyMetadataSlimProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spm.ID = &ID - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spm.Type = &typeVar - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spm.Name = &name - } - } - } - - return nil -} - -// SummarizeResults summarize action results. -type SummarizeResults struct { - autorest.Response `json:"-"` - // OdataContext - OData context string; used by OData clients to resolve type information based on metadata. - OdataContext *string `json:"@odata.context,omitempty"` - // OdataCount - OData entity count; represents the number of summaries returned; always set to 1. - OdataCount *int32 `json:"@odata.count,omitempty"` - // Value - Summarize action results. - Value *[]Summary `json:"value,omitempty"` -} - -// Summary summary results. -type Summary struct { - // OdataID - OData entity ID; always set to null since summaries do not have an entity ID. - OdataID *string `json:"@odata.id,omitempty"` - // OdataContext - OData context string; used by OData clients to resolve type information based on metadata. - OdataContext *string `json:"@odata.context,omitempty"` - // Results - Compliance summary for all policy assignments. - Results *SummaryResults `json:"results,omitempty"` - // PolicyAssignments - Policy assignments summary. - PolicyAssignments *[]PolicyAssignmentSummary `json:"policyAssignments,omitempty"` -} - -// SummaryResults compliance summary on a particular summary level. -type SummaryResults struct { - // QueryResultsURI - HTTP POST URI for queryResults action on Microsoft.PolicyInsights to retrieve raw results for the compliance summary. This property will not be available by default in future API versions, but could be queried explicitly. - QueryResultsURI *string `json:"queryResultsUri,omitempty"` - // NonCompliantResources - Number of non-compliant resources. - NonCompliantResources *int32 `json:"nonCompliantResources,omitempty"` - // NonCompliantPolicies - Number of non-compliant policies. - NonCompliantPolicies *int32 `json:"nonCompliantPolicies,omitempty"` - // ResourceDetails - The resources summary at this level. - ResourceDetails *[]ComplianceDetail `json:"resourceDetails,omitempty"` - // PolicyDetails - The policy artifact summary at this level. For query scope level, it represents policy assignment summary. For policy assignment level, it represents policy definitions summary. - PolicyDetails *[]ComplianceDetail `json:"policyDetails,omitempty"` - // PolicyGroupDetails - The policy definition group summary at this level. - PolicyGroupDetails *[]ComplianceDetail `json:"policyGroupDetails,omitempty"` -} - -// TrackedResourceModificationDetails the details of the policy triggered deployment that created or -// modified the tracked resource. -type TrackedResourceModificationDetails struct { - // PolicyDetails - READ-ONLY; The details of the policy that created or modified the tracked resource. - PolicyDetails *PolicyDetails `json:"policyDetails,omitempty"` - // DeploymentID - READ-ONLY; The ID of the deployment that created or modified the tracked resource. - DeploymentID *string `json:"deploymentId,omitempty"` - // DeploymentTime - READ-ONLY; Timestamp of the deployment that created or modified the tracked resource. - DeploymentTime *date.Time `json:"deploymentTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResourceModificationDetails. -func (trmd TrackedResourceModificationDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TypedErrorInfo scenario specific error details. -type TypedErrorInfo struct { - // Type - READ-ONLY; The type of included error details. - Type *string `json:"type,omitempty"` - // Info - READ-ONLY; The scenario specific error details. - Info interface{} `json:"info,omitempty"` -} - -// MarshalJSON is the custom marshaler for TypedErrorInfo. -func (tei TypedErrorInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/operations.go deleted file mode 100644 index 304ceb16dcf..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package policyinsights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the client for the Operations methods of the Policyinsights service. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient() OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI)} -} - -// List lists available operations. -func (client OperationsClient) List(ctx context.Context) (result OperationsListResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.PolicyInsights/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationsListResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/policyevents.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/policyevents.go deleted file mode 100644 index e5939080c35..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/policyevents.go +++ /dev/null @@ -1,1336 +0,0 @@ -package policyinsights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PolicyEventsClient is the client for the PolicyEvents methods of the Policyinsights service. -type PolicyEventsClient struct { - BaseClient -} - -// NewPolicyEventsClient creates an instance of the PolicyEventsClient client. -func NewPolicyEventsClient() PolicyEventsClient { - return NewPolicyEventsClientWithBaseURI(DefaultBaseURI) -} - -// NewPolicyEventsClientWithBaseURI creates an instance of the PolicyEventsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewPolicyEventsClientWithBaseURI(baseURI string) PolicyEventsClient { - return PolicyEventsClient{NewWithBaseURI(baseURI)} -} - -// ListQueryResultsForManagementGroup queries policy events for the resources under the management group. -// Parameters: -// managementGroupName - management group name. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyEventsClient) ListQueryResultsForManagementGroup(ctx context.Context, managementGroupName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyEventsQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForManagementGroup") - defer func() { - sc := -1 - if result.peqr.Response.Response != nil { - sc = result.peqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyEventsClient", "ListQueryResultsForManagementGroup", err.Error()) - } - - result.fn = client.listQueryResultsForManagementGroupNextResults - req, err := client.ListQueryResultsForManagementGroupPreparer(ctx, managementGroupName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForManagementGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForManagementGroupSender(req) - if err != nil { - result.peqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForManagementGroup", resp, "Failure sending request") - return - } - - result.peqr, err = client.ListQueryResultsForManagementGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForManagementGroup", resp, "Failure responding to request") - return - } - if result.peqr.hasNextLink() && result.peqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForManagementGroupPreparer prepares the ListQueryResultsForManagementGroup request. -func (client PolicyEventsClient) ListQueryResultsForManagementGroupPreparer(ctx context.Context, managementGroupName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managementGroupName": autorest.Encode("path", managementGroupName), - "managementGroupsNamespace": autorest.Encode("path", "Microsoft.Management"), - "policyEventsResource": autorest.Encode("path", "default"), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForManagementGroupSender sends the ListQueryResultsForManagementGroup request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyEventsClient) ListQueryResultsForManagementGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListQueryResultsForManagementGroupResponder handles the response to the ListQueryResultsForManagementGroup request. The method always -// closes the http.Response Body. -func (client PolicyEventsClient) ListQueryResultsForManagementGroupResponder(resp *http.Response) (result PolicyEventsQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForManagementGroupNextResults retrieves the next set of results, if any. -func (client PolicyEventsClient) listQueryResultsForManagementGroupNextResults(ctx context.Context, lastResults PolicyEventsQueryResults) (result PolicyEventsQueryResults, err error) { - req, err := lastResults.policyEventsQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForManagementGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForManagementGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForManagementGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForManagementGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForManagementGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForManagementGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyEventsClient) ListQueryResultsForManagementGroupComplete(ctx context.Context, managementGroupName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyEventsQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForManagementGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForManagementGroup(ctx, managementGroupName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - return -} - -// ListQueryResultsForPolicyDefinition queries policy events for the subscription level policy definition. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// policyDefinitionName - policy definition name. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyEventsClient) ListQueryResultsForPolicyDefinition(ctx context.Context, subscriptionID string, policyDefinitionName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyEventsQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForPolicyDefinition") - defer func() { - sc := -1 - if result.peqr.Response.Response != nil { - sc = result.peqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyEventsClient", "ListQueryResultsForPolicyDefinition", err.Error()) - } - - result.fn = client.listQueryResultsForPolicyDefinitionNextResults - req, err := client.ListQueryResultsForPolicyDefinitionPreparer(ctx, subscriptionID, policyDefinitionName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForPolicyDefinition", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForPolicyDefinitionSender(req) - if err != nil { - result.peqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForPolicyDefinition", resp, "Failure sending request") - return - } - - result.peqr, err = client.ListQueryResultsForPolicyDefinitionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForPolicyDefinition", resp, "Failure responding to request") - return - } - if result.peqr.hasNextLink() && result.peqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForPolicyDefinitionPreparer prepares the ListQueryResultsForPolicyDefinition request. -func (client PolicyEventsClient) ListQueryResultsForPolicyDefinitionPreparer(ctx context.Context, subscriptionID string, policyDefinitionName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationNamespace": autorest.Encode("path", "Microsoft.Authorization"), - "policyDefinitionName": autorest.Encode("path", policyDefinitionName), - "policyEventsResource": autorest.Encode("path", "default"), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForPolicyDefinitionSender sends the ListQueryResultsForPolicyDefinition request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyEventsClient) ListQueryResultsForPolicyDefinitionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListQueryResultsForPolicyDefinitionResponder handles the response to the ListQueryResultsForPolicyDefinition request. The method always -// closes the http.Response Body. -func (client PolicyEventsClient) ListQueryResultsForPolicyDefinitionResponder(resp *http.Response) (result PolicyEventsQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForPolicyDefinitionNextResults retrieves the next set of results, if any. -func (client PolicyEventsClient) listQueryResultsForPolicyDefinitionNextResults(ctx context.Context, lastResults PolicyEventsQueryResults) (result PolicyEventsQueryResults, err error) { - req, err := lastResults.policyEventsQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForPolicyDefinitionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForPolicyDefinitionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForPolicyDefinitionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForPolicyDefinitionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForPolicyDefinitionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForPolicyDefinitionComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyEventsClient) ListQueryResultsForPolicyDefinitionComplete(ctx context.Context, subscriptionID string, policyDefinitionName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyEventsQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForPolicyDefinition") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForPolicyDefinition(ctx, subscriptionID, policyDefinitionName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - return -} - -// ListQueryResultsForPolicySetDefinition queries policy events for the subscription level policy set definition. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// policySetDefinitionName - policy set definition name. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyEventsClient) ListQueryResultsForPolicySetDefinition(ctx context.Context, subscriptionID string, policySetDefinitionName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyEventsQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForPolicySetDefinition") - defer func() { - sc := -1 - if result.peqr.Response.Response != nil { - sc = result.peqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyEventsClient", "ListQueryResultsForPolicySetDefinition", err.Error()) - } - - result.fn = client.listQueryResultsForPolicySetDefinitionNextResults - req, err := client.ListQueryResultsForPolicySetDefinitionPreparer(ctx, subscriptionID, policySetDefinitionName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForPolicySetDefinition", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForPolicySetDefinitionSender(req) - if err != nil { - result.peqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForPolicySetDefinition", resp, "Failure sending request") - return - } - - result.peqr, err = client.ListQueryResultsForPolicySetDefinitionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForPolicySetDefinition", resp, "Failure responding to request") - return - } - if result.peqr.hasNextLink() && result.peqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForPolicySetDefinitionPreparer prepares the ListQueryResultsForPolicySetDefinition request. -func (client PolicyEventsClient) ListQueryResultsForPolicySetDefinitionPreparer(ctx context.Context, subscriptionID string, policySetDefinitionName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationNamespace": autorest.Encode("path", "Microsoft.Authorization"), - "policyEventsResource": autorest.Encode("path", "default"), - "policySetDefinitionName": autorest.Encode("path", policySetDefinitionName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForPolicySetDefinitionSender sends the ListQueryResultsForPolicySetDefinition request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyEventsClient) ListQueryResultsForPolicySetDefinitionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListQueryResultsForPolicySetDefinitionResponder handles the response to the ListQueryResultsForPolicySetDefinition request. The method always -// closes the http.Response Body. -func (client PolicyEventsClient) ListQueryResultsForPolicySetDefinitionResponder(resp *http.Response) (result PolicyEventsQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForPolicySetDefinitionNextResults retrieves the next set of results, if any. -func (client PolicyEventsClient) listQueryResultsForPolicySetDefinitionNextResults(ctx context.Context, lastResults PolicyEventsQueryResults) (result PolicyEventsQueryResults, err error) { - req, err := lastResults.policyEventsQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForPolicySetDefinitionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForPolicySetDefinitionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForPolicySetDefinitionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForPolicySetDefinitionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForPolicySetDefinitionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForPolicySetDefinitionComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyEventsClient) ListQueryResultsForPolicySetDefinitionComplete(ctx context.Context, subscriptionID string, policySetDefinitionName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyEventsQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForPolicySetDefinition") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForPolicySetDefinition(ctx, subscriptionID, policySetDefinitionName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - return -} - -// ListQueryResultsForResource queries policy events for the resource. -// Parameters: -// resourceID - resource ID. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// expand - the $expand query parameter. For example, to expand components use $expand=components -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyEventsClient) ListQueryResultsForResource(ctx context.Context, resourceID string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, expand string, skipToken string) (result PolicyEventsQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForResource") - defer func() { - sc := -1 - if result.peqr.Response.Response != nil { - sc = result.peqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyEventsClient", "ListQueryResultsForResource", err.Error()) - } - - result.fn = client.listQueryResultsForResourceNextResults - req, err := client.ListQueryResultsForResourcePreparer(ctx, resourceID, top, orderBy, selectParameter, from, toParameter, filter, apply, expand, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForResourceSender(req) - if err != nil { - result.peqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForResource", resp, "Failure sending request") - return - } - - result.peqr, err = client.ListQueryResultsForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForResource", resp, "Failure responding to request") - return - } - if result.peqr.hasNextLink() && result.peqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForResourcePreparer prepares the ListQueryResultsForResource request. -func (client PolicyEventsClient) ListQueryResultsForResourcePreparer(ctx context.Context, resourceID string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, expand string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyEventsResource": autorest.Encode("path", "default"), - "resourceId": resourceID, - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForResourceSender sends the ListQueryResultsForResource request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyEventsClient) ListQueryResultsForResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListQueryResultsForResourceResponder handles the response to the ListQueryResultsForResource request. The method always -// closes the http.Response Body. -func (client PolicyEventsClient) ListQueryResultsForResourceResponder(resp *http.Response) (result PolicyEventsQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForResourceNextResults retrieves the next set of results, if any. -func (client PolicyEventsClient) listQueryResultsForResourceNextResults(ctx context.Context, lastResults PolicyEventsQueryResults) (result PolicyEventsQueryResults, err error) { - req, err := lastResults.policyEventsQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyEventsClient) ListQueryResultsForResourceComplete(ctx context.Context, resourceID string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, expand string, skipToken string) (result PolicyEventsQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForResource") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForResource(ctx, resourceID, top, orderBy, selectParameter, from, toParameter, filter, apply, expand, skipToken) - return -} - -// ListQueryResultsForResourceGroup queries policy events for the resources under the resource group. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// resourceGroupName - resource group name. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyEventsClient) ListQueryResultsForResourceGroup(ctx context.Context, subscriptionID string, resourceGroupName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyEventsQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForResourceGroup") - defer func() { - sc := -1 - if result.peqr.Response.Response != nil { - sc = result.peqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyEventsClient", "ListQueryResultsForResourceGroup", err.Error()) - } - - result.fn = client.listQueryResultsForResourceGroupNextResults - req, err := client.ListQueryResultsForResourceGroupPreparer(ctx, subscriptionID, resourceGroupName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForResourceGroupSender(req) - if err != nil { - result.peqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForResourceGroup", resp, "Failure sending request") - return - } - - result.peqr, err = client.ListQueryResultsForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForResourceGroup", resp, "Failure responding to request") - return - } - if result.peqr.hasNextLink() && result.peqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForResourceGroupPreparer prepares the ListQueryResultsForResourceGroup request. -func (client PolicyEventsClient) ListQueryResultsForResourceGroupPreparer(ctx context.Context, subscriptionID string, resourceGroupName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyEventsResource": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForResourceGroupSender sends the ListQueryResultsForResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyEventsClient) ListQueryResultsForResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListQueryResultsForResourceGroupResponder handles the response to the ListQueryResultsForResourceGroup request. The method always -// closes the http.Response Body. -func (client PolicyEventsClient) ListQueryResultsForResourceGroupResponder(resp *http.Response) (result PolicyEventsQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForResourceGroupNextResults retrieves the next set of results, if any. -func (client PolicyEventsClient) listQueryResultsForResourceGroupNextResults(ctx context.Context, lastResults PolicyEventsQueryResults) (result PolicyEventsQueryResults, err error) { - req, err := lastResults.policyEventsQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyEventsClient) ListQueryResultsForResourceGroupComplete(ctx context.Context, subscriptionID string, resourceGroupName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyEventsQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForResourceGroup(ctx, subscriptionID, resourceGroupName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - return -} - -// ListQueryResultsForResourceGroupLevelPolicyAssignment queries policy events for the resource group level policy -// assignment. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// resourceGroupName - resource group name. -// policyAssignmentName - policy assignment name. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyEventsClient) ListQueryResultsForResourceGroupLevelPolicyAssignment(ctx context.Context, subscriptionID string, resourceGroupName string, policyAssignmentName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyEventsQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForResourceGroupLevelPolicyAssignment") - defer func() { - sc := -1 - if result.peqr.Response.Response != nil { - sc = result.peqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyEventsClient", "ListQueryResultsForResourceGroupLevelPolicyAssignment", err.Error()) - } - - result.fn = client.listQueryResultsForResourceGroupLevelPolicyAssignmentNextResults - req, err := client.ListQueryResultsForResourceGroupLevelPolicyAssignmentPreparer(ctx, subscriptionID, resourceGroupName, policyAssignmentName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForResourceGroupLevelPolicyAssignment", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForResourceGroupLevelPolicyAssignmentSender(req) - if err != nil { - result.peqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForResourceGroupLevelPolicyAssignment", resp, "Failure sending request") - return - } - - result.peqr, err = client.ListQueryResultsForResourceGroupLevelPolicyAssignmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForResourceGroupLevelPolicyAssignment", resp, "Failure responding to request") - return - } - if result.peqr.hasNextLink() && result.peqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForResourceGroupLevelPolicyAssignmentPreparer prepares the ListQueryResultsForResourceGroupLevelPolicyAssignment request. -func (client PolicyEventsClient) ListQueryResultsForResourceGroupLevelPolicyAssignmentPreparer(ctx context.Context, subscriptionID string, resourceGroupName string, policyAssignmentName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationNamespace": autorest.Encode("path", "Microsoft.Authorization"), - "policyAssignmentName": autorest.Encode("path", policyAssignmentName), - "policyEventsResource": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForResourceGroupLevelPolicyAssignmentSender sends the ListQueryResultsForResourceGroupLevelPolicyAssignment request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyEventsClient) ListQueryResultsForResourceGroupLevelPolicyAssignmentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListQueryResultsForResourceGroupLevelPolicyAssignmentResponder handles the response to the ListQueryResultsForResourceGroupLevelPolicyAssignment request. The method always -// closes the http.Response Body. -func (client PolicyEventsClient) ListQueryResultsForResourceGroupLevelPolicyAssignmentResponder(resp *http.Response) (result PolicyEventsQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForResourceGroupLevelPolicyAssignmentNextResults retrieves the next set of results, if any. -func (client PolicyEventsClient) listQueryResultsForResourceGroupLevelPolicyAssignmentNextResults(ctx context.Context, lastResults PolicyEventsQueryResults) (result PolicyEventsQueryResults, err error) { - req, err := lastResults.policyEventsQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForResourceGroupLevelPolicyAssignmentNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForResourceGroupLevelPolicyAssignmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForResourceGroupLevelPolicyAssignmentNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForResourceGroupLevelPolicyAssignmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForResourceGroupLevelPolicyAssignmentNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForResourceGroupLevelPolicyAssignmentComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyEventsClient) ListQueryResultsForResourceGroupLevelPolicyAssignmentComplete(ctx context.Context, subscriptionID string, resourceGroupName string, policyAssignmentName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyEventsQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForResourceGroupLevelPolicyAssignment") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForResourceGroupLevelPolicyAssignment(ctx, subscriptionID, resourceGroupName, policyAssignmentName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - return -} - -// ListQueryResultsForSubscription queries policy events for the resources under the subscription. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyEventsClient) ListQueryResultsForSubscription(ctx context.Context, subscriptionID string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyEventsQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForSubscription") - defer func() { - sc := -1 - if result.peqr.Response.Response != nil { - sc = result.peqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyEventsClient", "ListQueryResultsForSubscription", err.Error()) - } - - result.fn = client.listQueryResultsForSubscriptionNextResults - req, err := client.ListQueryResultsForSubscriptionPreparer(ctx, subscriptionID, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForSubscriptionSender(req) - if err != nil { - result.peqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForSubscription", resp, "Failure sending request") - return - } - - result.peqr, err = client.ListQueryResultsForSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForSubscription", resp, "Failure responding to request") - return - } - if result.peqr.hasNextLink() && result.peqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForSubscriptionPreparer prepares the ListQueryResultsForSubscription request. -func (client PolicyEventsClient) ListQueryResultsForSubscriptionPreparer(ctx context.Context, subscriptionID string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyEventsResource": autorest.Encode("path", "default"), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForSubscriptionSender sends the ListQueryResultsForSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyEventsClient) ListQueryResultsForSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListQueryResultsForSubscriptionResponder handles the response to the ListQueryResultsForSubscription request. The method always -// closes the http.Response Body. -func (client PolicyEventsClient) ListQueryResultsForSubscriptionResponder(resp *http.Response) (result PolicyEventsQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForSubscriptionNextResults retrieves the next set of results, if any. -func (client PolicyEventsClient) listQueryResultsForSubscriptionNextResults(ctx context.Context, lastResults PolicyEventsQueryResults) (result PolicyEventsQueryResults, err error) { - req, err := lastResults.policyEventsQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForSubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForSubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForSubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForSubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyEventsClient) ListQueryResultsForSubscriptionComplete(ctx context.Context, subscriptionID string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyEventsQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForSubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForSubscription(ctx, subscriptionID, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - return -} - -// ListQueryResultsForSubscriptionLevelPolicyAssignment queries policy events for the subscription level policy -// assignment. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// policyAssignmentName - policy assignment name. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyEventsClient) ListQueryResultsForSubscriptionLevelPolicyAssignment(ctx context.Context, subscriptionID string, policyAssignmentName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyEventsQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForSubscriptionLevelPolicyAssignment") - defer func() { - sc := -1 - if result.peqr.Response.Response != nil { - sc = result.peqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyEventsClient", "ListQueryResultsForSubscriptionLevelPolicyAssignment", err.Error()) - } - - result.fn = client.listQueryResultsForSubscriptionLevelPolicyAssignmentNextResults - req, err := client.ListQueryResultsForSubscriptionLevelPolicyAssignmentPreparer(ctx, subscriptionID, policyAssignmentName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForSubscriptionLevelPolicyAssignment", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForSubscriptionLevelPolicyAssignmentSender(req) - if err != nil { - result.peqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForSubscriptionLevelPolicyAssignment", resp, "Failure sending request") - return - } - - result.peqr, err = client.ListQueryResultsForSubscriptionLevelPolicyAssignmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "ListQueryResultsForSubscriptionLevelPolicyAssignment", resp, "Failure responding to request") - return - } - if result.peqr.hasNextLink() && result.peqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForSubscriptionLevelPolicyAssignmentPreparer prepares the ListQueryResultsForSubscriptionLevelPolicyAssignment request. -func (client PolicyEventsClient) ListQueryResultsForSubscriptionLevelPolicyAssignmentPreparer(ctx context.Context, subscriptionID string, policyAssignmentName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationNamespace": autorest.Encode("path", "Microsoft.Authorization"), - "policyAssignmentName": autorest.Encode("path", policyAssignmentName), - "policyEventsResource": autorest.Encode("path", "default"), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForSubscriptionLevelPolicyAssignmentSender sends the ListQueryResultsForSubscriptionLevelPolicyAssignment request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyEventsClient) ListQueryResultsForSubscriptionLevelPolicyAssignmentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListQueryResultsForSubscriptionLevelPolicyAssignmentResponder handles the response to the ListQueryResultsForSubscriptionLevelPolicyAssignment request. The method always -// closes the http.Response Body. -func (client PolicyEventsClient) ListQueryResultsForSubscriptionLevelPolicyAssignmentResponder(resp *http.Response) (result PolicyEventsQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForSubscriptionLevelPolicyAssignmentNextResults retrieves the next set of results, if any. -func (client PolicyEventsClient) listQueryResultsForSubscriptionLevelPolicyAssignmentNextResults(ctx context.Context, lastResults PolicyEventsQueryResults) (result PolicyEventsQueryResults, err error) { - req, err := lastResults.policyEventsQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForSubscriptionLevelPolicyAssignmentNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForSubscriptionLevelPolicyAssignmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForSubscriptionLevelPolicyAssignmentNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForSubscriptionLevelPolicyAssignmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyEventsClient", "listQueryResultsForSubscriptionLevelPolicyAssignmentNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForSubscriptionLevelPolicyAssignmentComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyEventsClient) ListQueryResultsForSubscriptionLevelPolicyAssignmentComplete(ctx context.Context, subscriptionID string, policyAssignmentName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyEventsQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyEventsClient.ListQueryResultsForSubscriptionLevelPolicyAssignment") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForSubscriptionLevelPolicyAssignment(ctx, subscriptionID, policyAssignmentName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/policymetadata.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/policymetadata.go deleted file mode 100644 index 911a138dd2d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/policymetadata.go +++ /dev/null @@ -1,226 +0,0 @@ -package policyinsights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PolicyMetadataClient is the client for the PolicyMetadata methods of the Policyinsights service. -type PolicyMetadataClient struct { - BaseClient -} - -// NewPolicyMetadataClient creates an instance of the PolicyMetadataClient client. -func NewPolicyMetadataClient() PolicyMetadataClient { - return NewPolicyMetadataClientWithBaseURI(DefaultBaseURI) -} - -// NewPolicyMetadataClientWithBaseURI creates an instance of the PolicyMetadataClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewPolicyMetadataClientWithBaseURI(baseURI string) PolicyMetadataClient { - return PolicyMetadataClient{NewWithBaseURI(baseURI)} -} - -// GetResource get policy metadata resource. -// Parameters: -// resourceName - the name of the policy metadata resource. -func (client PolicyMetadataClient) GetResource(ctx context.Context, resourceName string) (result PolicyMetadata, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyMetadataClient.GetResource") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetResourcePreparer(ctx, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyMetadataClient", "GetResource", nil, "Failure preparing request") - return - } - - resp, err := client.GetResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyMetadataClient", "GetResource", resp, "Failure sending request") - return - } - - result, err = client.GetResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyMetadataClient", "GetResource", resp, "Failure responding to request") - return - } - - return -} - -// GetResourcePreparer prepares the GetResource request. -func (client PolicyMetadataClient) GetResourcePreparer(ctx context.Context, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceName": resourceName, - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.PolicyInsights/policyMetadata/{resourceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetResourceSender sends the GetResource request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyMetadataClient) GetResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResourceResponder handles the response to the GetResource request. The method always -// closes the http.Response Body. -func (client PolicyMetadataClient) GetResourceResponder(resp *http.Response) (result PolicyMetadata, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get a list of the policy metadata resources. -// Parameters: -// top - maximum number of records to return. -func (client PolicyMetadataClient) List(ctx context.Context, top *int32) (result PolicyMetadataCollectionPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyMetadataClient.List") - defer func() { - sc := -1 - if result.pmc.Response.Response != nil { - sc = result.pmc.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyMetadataClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, top) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyMetadataClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.pmc.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyMetadataClient", "List", resp, "Failure sending request") - return - } - - result.pmc, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyMetadataClient", "List", resp, "Failure responding to request") - return - } - if result.pmc.hasNextLink() && result.pmc.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PolicyMetadataClient) ListPreparer(ctx context.Context, top *int32) (*http.Request, error) { - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.PolicyInsights/policyMetadata"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyMetadataClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PolicyMetadataClient) ListResponder(resp *http.Response) (result PolicyMetadataCollection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client PolicyMetadataClient) listNextResults(ctx context.Context, lastResults PolicyMetadataCollection) (result PolicyMetadataCollection, err error) { - req, err := lastResults.policyMetadataCollectionPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyMetadataClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyMetadataClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyMetadataClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyMetadataClient) ListComplete(ctx context.Context, top *int32) (result PolicyMetadataCollectionIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyMetadataClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, top) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/policystates.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/policystates.go deleted file mode 100644 index 918dab07a55..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/policystates.go +++ /dev/null @@ -1,2314 +0,0 @@ -package policyinsights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PolicyStatesClient is the client for the PolicyStates methods of the Policyinsights service. -type PolicyStatesClient struct { - BaseClient -} - -// NewPolicyStatesClient creates an instance of the PolicyStatesClient client. -func NewPolicyStatesClient() PolicyStatesClient { - return NewPolicyStatesClientWithBaseURI(DefaultBaseURI) -} - -// NewPolicyStatesClientWithBaseURI creates an instance of the PolicyStatesClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewPolicyStatesClientWithBaseURI(baseURI string) PolicyStatesClient { - return PolicyStatesClient{NewWithBaseURI(baseURI)} -} - -// ListQueryResultsForManagementGroup queries policy states for the resources under the management group. -// Parameters: -// policyStatesResource - the virtual resource under PolicyStates resource type. In a given time range, -// 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). -// managementGroupName - management group name. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyStatesClient) ListQueryResultsForManagementGroup(ctx context.Context, policyStatesResource PolicyStatesResource, managementGroupName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyStatesQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForManagementGroup") - defer func() { - sc := -1 - if result.psqr.Response.Response != nil { - sc = result.psqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "ListQueryResultsForManagementGroup", err.Error()) - } - - result.fn = client.listQueryResultsForManagementGroupNextResults - req, err := client.ListQueryResultsForManagementGroupPreparer(ctx, policyStatesResource, managementGroupName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForManagementGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForManagementGroupSender(req) - if err != nil { - result.psqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForManagementGroup", resp, "Failure sending request") - return - } - - result.psqr, err = client.ListQueryResultsForManagementGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForManagementGroup", resp, "Failure responding to request") - return - } - if result.psqr.hasNextLink() && result.psqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForManagementGroupPreparer prepares the ListQueryResultsForManagementGroup request. -func (client PolicyStatesClient) ListQueryResultsForManagementGroupPreparer(ctx context.Context, policyStatesResource PolicyStatesResource, managementGroupName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managementGroupName": autorest.Encode("path", managementGroupName), - "managementGroupsNamespace": autorest.Encode("path", "Microsoft.Management"), - "policyStatesResource": autorest.Encode("path", policyStatesResource), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForManagementGroupSender sends the ListQueryResultsForManagementGroup request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) ListQueryResultsForManagementGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListQueryResultsForManagementGroupResponder handles the response to the ListQueryResultsForManagementGroup request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) ListQueryResultsForManagementGroupResponder(resp *http.Response) (result PolicyStatesQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForManagementGroupNextResults retrieves the next set of results, if any. -func (client PolicyStatesClient) listQueryResultsForManagementGroupNextResults(ctx context.Context, lastResults PolicyStatesQueryResults) (result PolicyStatesQueryResults, err error) { - req, err := lastResults.policyStatesQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForManagementGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForManagementGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForManagementGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForManagementGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForManagementGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForManagementGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyStatesClient) ListQueryResultsForManagementGroupComplete(ctx context.Context, policyStatesResource PolicyStatesResource, managementGroupName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyStatesQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForManagementGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForManagementGroup(ctx, policyStatesResource, managementGroupName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - return -} - -// ListQueryResultsForPolicyDefinition queries policy states for the subscription level policy definition. -// Parameters: -// policyStatesResource - the virtual resource under PolicyStates resource type. In a given time range, -// 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). -// subscriptionID - microsoft Azure subscription ID. -// policyDefinitionName - policy definition name. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyStatesClient) ListQueryResultsForPolicyDefinition(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, policyDefinitionName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyStatesQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForPolicyDefinition") - defer func() { - sc := -1 - if result.psqr.Response.Response != nil { - sc = result.psqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "ListQueryResultsForPolicyDefinition", err.Error()) - } - - result.fn = client.listQueryResultsForPolicyDefinitionNextResults - req, err := client.ListQueryResultsForPolicyDefinitionPreparer(ctx, policyStatesResource, subscriptionID, policyDefinitionName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForPolicyDefinition", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForPolicyDefinitionSender(req) - if err != nil { - result.psqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForPolicyDefinition", resp, "Failure sending request") - return - } - - result.psqr, err = client.ListQueryResultsForPolicyDefinitionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForPolicyDefinition", resp, "Failure responding to request") - return - } - if result.psqr.hasNextLink() && result.psqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForPolicyDefinitionPreparer prepares the ListQueryResultsForPolicyDefinition request. -func (client PolicyStatesClient) ListQueryResultsForPolicyDefinitionPreparer(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, policyDefinitionName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationNamespace": autorest.Encode("path", "Microsoft.Authorization"), - "policyDefinitionName": autorest.Encode("path", policyDefinitionName), - "policyStatesResource": autorest.Encode("path", policyStatesResource), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForPolicyDefinitionSender sends the ListQueryResultsForPolicyDefinition request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) ListQueryResultsForPolicyDefinitionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListQueryResultsForPolicyDefinitionResponder handles the response to the ListQueryResultsForPolicyDefinition request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) ListQueryResultsForPolicyDefinitionResponder(resp *http.Response) (result PolicyStatesQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForPolicyDefinitionNextResults retrieves the next set of results, if any. -func (client PolicyStatesClient) listQueryResultsForPolicyDefinitionNextResults(ctx context.Context, lastResults PolicyStatesQueryResults) (result PolicyStatesQueryResults, err error) { - req, err := lastResults.policyStatesQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForPolicyDefinitionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForPolicyDefinitionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForPolicyDefinitionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForPolicyDefinitionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForPolicyDefinitionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForPolicyDefinitionComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyStatesClient) ListQueryResultsForPolicyDefinitionComplete(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, policyDefinitionName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyStatesQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForPolicyDefinition") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForPolicyDefinition(ctx, policyStatesResource, subscriptionID, policyDefinitionName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - return -} - -// ListQueryResultsForPolicySetDefinition queries policy states for the subscription level policy set definition. -// Parameters: -// policyStatesResource - the virtual resource under PolicyStates resource type. In a given time range, -// 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). -// subscriptionID - microsoft Azure subscription ID. -// policySetDefinitionName - policy set definition name. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyStatesClient) ListQueryResultsForPolicySetDefinition(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, policySetDefinitionName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyStatesQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForPolicySetDefinition") - defer func() { - sc := -1 - if result.psqr.Response.Response != nil { - sc = result.psqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "ListQueryResultsForPolicySetDefinition", err.Error()) - } - - result.fn = client.listQueryResultsForPolicySetDefinitionNextResults - req, err := client.ListQueryResultsForPolicySetDefinitionPreparer(ctx, policyStatesResource, subscriptionID, policySetDefinitionName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForPolicySetDefinition", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForPolicySetDefinitionSender(req) - if err != nil { - result.psqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForPolicySetDefinition", resp, "Failure sending request") - return - } - - result.psqr, err = client.ListQueryResultsForPolicySetDefinitionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForPolicySetDefinition", resp, "Failure responding to request") - return - } - if result.psqr.hasNextLink() && result.psqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForPolicySetDefinitionPreparer prepares the ListQueryResultsForPolicySetDefinition request. -func (client PolicyStatesClient) ListQueryResultsForPolicySetDefinitionPreparer(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, policySetDefinitionName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationNamespace": autorest.Encode("path", "Microsoft.Authorization"), - "policySetDefinitionName": autorest.Encode("path", policySetDefinitionName), - "policyStatesResource": autorest.Encode("path", policyStatesResource), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForPolicySetDefinitionSender sends the ListQueryResultsForPolicySetDefinition request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) ListQueryResultsForPolicySetDefinitionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListQueryResultsForPolicySetDefinitionResponder handles the response to the ListQueryResultsForPolicySetDefinition request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) ListQueryResultsForPolicySetDefinitionResponder(resp *http.Response) (result PolicyStatesQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForPolicySetDefinitionNextResults retrieves the next set of results, if any. -func (client PolicyStatesClient) listQueryResultsForPolicySetDefinitionNextResults(ctx context.Context, lastResults PolicyStatesQueryResults) (result PolicyStatesQueryResults, err error) { - req, err := lastResults.policyStatesQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForPolicySetDefinitionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForPolicySetDefinitionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForPolicySetDefinitionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForPolicySetDefinitionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForPolicySetDefinitionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForPolicySetDefinitionComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyStatesClient) ListQueryResultsForPolicySetDefinitionComplete(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, policySetDefinitionName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyStatesQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForPolicySetDefinition") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForPolicySetDefinition(ctx, policyStatesResource, subscriptionID, policySetDefinitionName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - return -} - -// ListQueryResultsForResource queries policy states for the resource. -// Parameters: -// policyStatesResource - the virtual resource under PolicyStates resource type. In a given time range, -// 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). -// resourceID - resource ID. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// expand - the $expand query parameter. For example, to expand components use $expand=components -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyStatesClient) ListQueryResultsForResource(ctx context.Context, policyStatesResource PolicyStatesResource, resourceID string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, expand string, skipToken string) (result PolicyStatesQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForResource") - defer func() { - sc := -1 - if result.psqr.Response.Response != nil { - sc = result.psqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "ListQueryResultsForResource", err.Error()) - } - - result.fn = client.listQueryResultsForResourceNextResults - req, err := client.ListQueryResultsForResourcePreparer(ctx, policyStatesResource, resourceID, top, orderBy, selectParameter, from, toParameter, filter, apply, expand, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForResourceSender(req) - if err != nil { - result.psqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForResource", resp, "Failure sending request") - return - } - - result.psqr, err = client.ListQueryResultsForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForResource", resp, "Failure responding to request") - return - } - if result.psqr.hasNextLink() && result.psqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForResourcePreparer prepares the ListQueryResultsForResource request. -func (client PolicyStatesClient) ListQueryResultsForResourcePreparer(ctx context.Context, policyStatesResource PolicyStatesResource, resourceID string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, expand string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyStatesResource": autorest.Encode("path", policyStatesResource), - "resourceId": resourceID, - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForResourceSender sends the ListQueryResultsForResource request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) ListQueryResultsForResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListQueryResultsForResourceResponder handles the response to the ListQueryResultsForResource request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) ListQueryResultsForResourceResponder(resp *http.Response) (result PolicyStatesQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForResourceNextResults retrieves the next set of results, if any. -func (client PolicyStatesClient) listQueryResultsForResourceNextResults(ctx context.Context, lastResults PolicyStatesQueryResults) (result PolicyStatesQueryResults, err error) { - req, err := lastResults.policyStatesQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyStatesClient) ListQueryResultsForResourceComplete(ctx context.Context, policyStatesResource PolicyStatesResource, resourceID string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, expand string, skipToken string) (result PolicyStatesQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForResource") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForResource(ctx, policyStatesResource, resourceID, top, orderBy, selectParameter, from, toParameter, filter, apply, expand, skipToken) - return -} - -// ListQueryResultsForResourceGroup queries policy states for the resources under the resource group. -// Parameters: -// policyStatesResource - the virtual resource under PolicyStates resource type. In a given time range, -// 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). -// subscriptionID - microsoft Azure subscription ID. -// resourceGroupName - resource group name. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyStatesClient) ListQueryResultsForResourceGroup(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, resourceGroupName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyStatesQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForResourceGroup") - defer func() { - sc := -1 - if result.psqr.Response.Response != nil { - sc = result.psqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "ListQueryResultsForResourceGroup", err.Error()) - } - - result.fn = client.listQueryResultsForResourceGroupNextResults - req, err := client.ListQueryResultsForResourceGroupPreparer(ctx, policyStatesResource, subscriptionID, resourceGroupName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForResourceGroupSender(req) - if err != nil { - result.psqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForResourceGroup", resp, "Failure sending request") - return - } - - result.psqr, err = client.ListQueryResultsForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForResourceGroup", resp, "Failure responding to request") - return - } - if result.psqr.hasNextLink() && result.psqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForResourceGroupPreparer prepares the ListQueryResultsForResourceGroup request. -func (client PolicyStatesClient) ListQueryResultsForResourceGroupPreparer(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, resourceGroupName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyStatesResource": autorest.Encode("path", policyStatesResource), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForResourceGroupSender sends the ListQueryResultsForResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) ListQueryResultsForResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListQueryResultsForResourceGroupResponder handles the response to the ListQueryResultsForResourceGroup request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) ListQueryResultsForResourceGroupResponder(resp *http.Response) (result PolicyStatesQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForResourceGroupNextResults retrieves the next set of results, if any. -func (client PolicyStatesClient) listQueryResultsForResourceGroupNextResults(ctx context.Context, lastResults PolicyStatesQueryResults) (result PolicyStatesQueryResults, err error) { - req, err := lastResults.policyStatesQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyStatesClient) ListQueryResultsForResourceGroupComplete(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, resourceGroupName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyStatesQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForResourceGroup(ctx, policyStatesResource, subscriptionID, resourceGroupName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - return -} - -// ListQueryResultsForResourceGroupLevelPolicyAssignment queries policy states for the resource group level policy -// assignment. -// Parameters: -// policyStatesResource - the virtual resource under PolicyStates resource type. In a given time range, -// 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). -// subscriptionID - microsoft Azure subscription ID. -// resourceGroupName - resource group name. -// policyAssignmentName - policy assignment name. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyStatesClient) ListQueryResultsForResourceGroupLevelPolicyAssignment(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, resourceGroupName string, policyAssignmentName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyStatesQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForResourceGroupLevelPolicyAssignment") - defer func() { - sc := -1 - if result.psqr.Response.Response != nil { - sc = result.psqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "ListQueryResultsForResourceGroupLevelPolicyAssignment", err.Error()) - } - - result.fn = client.listQueryResultsForResourceGroupLevelPolicyAssignmentNextResults - req, err := client.ListQueryResultsForResourceGroupLevelPolicyAssignmentPreparer(ctx, policyStatesResource, subscriptionID, resourceGroupName, policyAssignmentName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForResourceGroupLevelPolicyAssignment", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForResourceGroupLevelPolicyAssignmentSender(req) - if err != nil { - result.psqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForResourceGroupLevelPolicyAssignment", resp, "Failure sending request") - return - } - - result.psqr, err = client.ListQueryResultsForResourceGroupLevelPolicyAssignmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForResourceGroupLevelPolicyAssignment", resp, "Failure responding to request") - return - } - if result.psqr.hasNextLink() && result.psqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForResourceGroupLevelPolicyAssignmentPreparer prepares the ListQueryResultsForResourceGroupLevelPolicyAssignment request. -func (client PolicyStatesClient) ListQueryResultsForResourceGroupLevelPolicyAssignmentPreparer(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, resourceGroupName string, policyAssignmentName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationNamespace": autorest.Encode("path", "Microsoft.Authorization"), - "policyAssignmentName": autorest.Encode("path", policyAssignmentName), - "policyStatesResource": autorest.Encode("path", policyStatesResource), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForResourceGroupLevelPolicyAssignmentSender sends the ListQueryResultsForResourceGroupLevelPolicyAssignment request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) ListQueryResultsForResourceGroupLevelPolicyAssignmentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListQueryResultsForResourceGroupLevelPolicyAssignmentResponder handles the response to the ListQueryResultsForResourceGroupLevelPolicyAssignment request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) ListQueryResultsForResourceGroupLevelPolicyAssignmentResponder(resp *http.Response) (result PolicyStatesQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForResourceGroupLevelPolicyAssignmentNextResults retrieves the next set of results, if any. -func (client PolicyStatesClient) listQueryResultsForResourceGroupLevelPolicyAssignmentNextResults(ctx context.Context, lastResults PolicyStatesQueryResults) (result PolicyStatesQueryResults, err error) { - req, err := lastResults.policyStatesQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForResourceGroupLevelPolicyAssignmentNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForResourceGroupLevelPolicyAssignmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForResourceGroupLevelPolicyAssignmentNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForResourceGroupLevelPolicyAssignmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForResourceGroupLevelPolicyAssignmentNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForResourceGroupLevelPolicyAssignmentComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyStatesClient) ListQueryResultsForResourceGroupLevelPolicyAssignmentComplete(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, resourceGroupName string, policyAssignmentName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyStatesQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForResourceGroupLevelPolicyAssignment") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForResourceGroupLevelPolicyAssignment(ctx, policyStatesResource, subscriptionID, resourceGroupName, policyAssignmentName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - return -} - -// ListQueryResultsForSubscription queries policy states for the resources under the subscription. -// Parameters: -// policyStatesResource - the virtual resource under PolicyStates resource type. In a given time range, -// 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). -// subscriptionID - microsoft Azure subscription ID. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyStatesClient) ListQueryResultsForSubscription(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyStatesQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForSubscription") - defer func() { - sc := -1 - if result.psqr.Response.Response != nil { - sc = result.psqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "ListQueryResultsForSubscription", err.Error()) - } - - result.fn = client.listQueryResultsForSubscriptionNextResults - req, err := client.ListQueryResultsForSubscriptionPreparer(ctx, policyStatesResource, subscriptionID, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForSubscriptionSender(req) - if err != nil { - result.psqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForSubscription", resp, "Failure sending request") - return - } - - result.psqr, err = client.ListQueryResultsForSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForSubscription", resp, "Failure responding to request") - return - } - if result.psqr.hasNextLink() && result.psqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForSubscriptionPreparer prepares the ListQueryResultsForSubscription request. -func (client PolicyStatesClient) ListQueryResultsForSubscriptionPreparer(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyStatesResource": autorest.Encode("path", policyStatesResource), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForSubscriptionSender sends the ListQueryResultsForSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) ListQueryResultsForSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListQueryResultsForSubscriptionResponder handles the response to the ListQueryResultsForSubscription request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) ListQueryResultsForSubscriptionResponder(resp *http.Response) (result PolicyStatesQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForSubscriptionNextResults retrieves the next set of results, if any. -func (client PolicyStatesClient) listQueryResultsForSubscriptionNextResults(ctx context.Context, lastResults PolicyStatesQueryResults) (result PolicyStatesQueryResults, err error) { - req, err := lastResults.policyStatesQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForSubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForSubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForSubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForSubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyStatesClient) ListQueryResultsForSubscriptionComplete(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyStatesQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForSubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForSubscription(ctx, policyStatesResource, subscriptionID, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - return -} - -// ListQueryResultsForSubscriptionLevelPolicyAssignment queries policy states for the subscription level policy -// assignment. -// Parameters: -// policyStatesResource - the virtual resource under PolicyStates resource type. In a given time range, -// 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). -// subscriptionID - microsoft Azure subscription ID. -// policyAssignmentName - policy assignment name. -// top - maximum number of records to return. -// orderBy - ordering expression using OData notation. One or more comma-separated column names with an -// optional "desc" (the default) or "asc", e.g. "$orderby=PolicyAssignmentId, ResourceId asc". -// selectParameter - select expression using OData notation. Limits the columns on each record to just those -// requested, e.g. "$select=PolicyAssignmentId, ResourceId". -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -// apply - oData apply expression for aggregations. -// skipToken - skiptoken is only provided if a previous response returned a partial result as a part of -// nextLink element. -func (client PolicyStatesClient) ListQueryResultsForSubscriptionLevelPolicyAssignment(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, policyAssignmentName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyStatesQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForSubscriptionLevelPolicyAssignment") - defer func() { - sc := -1 - if result.psqr.Response.Response != nil { - sc = result.psqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "ListQueryResultsForSubscriptionLevelPolicyAssignment", err.Error()) - } - - result.fn = client.listQueryResultsForSubscriptionLevelPolicyAssignmentNextResults - req, err := client.ListQueryResultsForSubscriptionLevelPolicyAssignmentPreparer(ctx, policyStatesResource, subscriptionID, policyAssignmentName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForSubscriptionLevelPolicyAssignment", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForSubscriptionLevelPolicyAssignmentSender(req) - if err != nil { - result.psqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForSubscriptionLevelPolicyAssignment", resp, "Failure sending request") - return - } - - result.psqr, err = client.ListQueryResultsForSubscriptionLevelPolicyAssignmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "ListQueryResultsForSubscriptionLevelPolicyAssignment", resp, "Failure responding to request") - return - } - if result.psqr.hasNextLink() && result.psqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForSubscriptionLevelPolicyAssignmentPreparer prepares the ListQueryResultsForSubscriptionLevelPolicyAssignment request. -func (client PolicyStatesClient) ListQueryResultsForSubscriptionLevelPolicyAssignmentPreparer(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, policyAssignmentName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationNamespace": autorest.Encode("path", "Microsoft.Authorization"), - "policyAssignmentName": autorest.Encode("path", policyAssignmentName), - "policyStatesResource": autorest.Encode("path", policyStatesResource), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(orderBy) > 0 { - queryParameters["$orderby"] = autorest.Encode("query", orderBy) - } - if len(selectParameter) > 0 { - queryParameters["$select"] = autorest.Encode("query", selectParameter) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(apply) > 0 { - queryParameters["$apply"] = autorest.Encode("query", apply) - } - if len(skipToken) > 0 { - queryParameters["$skiptoken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForSubscriptionLevelPolicyAssignmentSender sends the ListQueryResultsForSubscriptionLevelPolicyAssignment request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) ListQueryResultsForSubscriptionLevelPolicyAssignmentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListQueryResultsForSubscriptionLevelPolicyAssignmentResponder handles the response to the ListQueryResultsForSubscriptionLevelPolicyAssignment request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) ListQueryResultsForSubscriptionLevelPolicyAssignmentResponder(resp *http.Response) (result PolicyStatesQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForSubscriptionLevelPolicyAssignmentNextResults retrieves the next set of results, if any. -func (client PolicyStatesClient) listQueryResultsForSubscriptionLevelPolicyAssignmentNextResults(ctx context.Context, lastResults PolicyStatesQueryResults) (result PolicyStatesQueryResults, err error) { - req, err := lastResults.policyStatesQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForSubscriptionLevelPolicyAssignmentNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForSubscriptionLevelPolicyAssignmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForSubscriptionLevelPolicyAssignmentNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForSubscriptionLevelPolicyAssignmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "listQueryResultsForSubscriptionLevelPolicyAssignmentNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForSubscriptionLevelPolicyAssignmentComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyStatesClient) ListQueryResultsForSubscriptionLevelPolicyAssignmentComplete(ctx context.Context, policyStatesResource PolicyStatesResource, subscriptionID string, policyAssignmentName string, top *int32, orderBy string, selectParameter string, from *date.Time, toParameter *date.Time, filter string, apply string, skipToken string) (result PolicyStatesQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.ListQueryResultsForSubscriptionLevelPolicyAssignment") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForSubscriptionLevelPolicyAssignment(ctx, policyStatesResource, subscriptionID, policyAssignmentName, top, orderBy, selectParameter, from, toParameter, filter, apply, skipToken) - return -} - -// SummarizeForManagementGroup summarizes policy states for the resources under the management group. -// Parameters: -// managementGroupName - management group name. -// top - maximum number of records to return. -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -func (client PolicyStatesClient) SummarizeForManagementGroup(ctx context.Context, managementGroupName string, top *int32, from *date.Time, toParameter *date.Time, filter string) (result SummarizeResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.SummarizeForManagementGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "SummarizeForManagementGroup", err.Error()) - } - - req, err := client.SummarizeForManagementGroupPreparer(ctx, managementGroupName, top, from, toParameter, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForManagementGroup", nil, "Failure preparing request") - return - } - - resp, err := client.SummarizeForManagementGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForManagementGroup", resp, "Failure sending request") - return - } - - result, err = client.SummarizeForManagementGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForManagementGroup", resp, "Failure responding to request") - return - } - - return -} - -// SummarizeForManagementGroupPreparer prepares the SummarizeForManagementGroup request. -func (client PolicyStatesClient) SummarizeForManagementGroupPreparer(ctx context.Context, managementGroupName string, top *int32, from *date.Time, toParameter *date.Time, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managementGroupName": autorest.Encode("path", managementGroupName), - "managementGroupsNamespace": autorest.Encode("path", "Microsoft.Management"), - "policyStatesSummaryResource": autorest.Encode("path", "latest"), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SummarizeForManagementGroupSender sends the SummarizeForManagementGroup request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) SummarizeForManagementGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// SummarizeForManagementGroupResponder handles the response to the SummarizeForManagementGroup request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) SummarizeForManagementGroupResponder(resp *http.Response) (result SummarizeResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SummarizeForPolicyDefinition summarizes policy states for the subscription level policy definition. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// policyDefinitionName - policy definition name. -// top - maximum number of records to return. -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -func (client PolicyStatesClient) SummarizeForPolicyDefinition(ctx context.Context, subscriptionID string, policyDefinitionName string, top *int32, from *date.Time, toParameter *date.Time, filter string) (result SummarizeResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.SummarizeForPolicyDefinition") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "SummarizeForPolicyDefinition", err.Error()) - } - - req, err := client.SummarizeForPolicyDefinitionPreparer(ctx, subscriptionID, policyDefinitionName, top, from, toParameter, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForPolicyDefinition", nil, "Failure preparing request") - return - } - - resp, err := client.SummarizeForPolicyDefinitionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForPolicyDefinition", resp, "Failure sending request") - return - } - - result, err = client.SummarizeForPolicyDefinitionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForPolicyDefinition", resp, "Failure responding to request") - return - } - - return -} - -// SummarizeForPolicyDefinitionPreparer prepares the SummarizeForPolicyDefinition request. -func (client PolicyStatesClient) SummarizeForPolicyDefinitionPreparer(ctx context.Context, subscriptionID string, policyDefinitionName string, top *int32, from *date.Time, toParameter *date.Time, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationNamespace": autorest.Encode("path", "Microsoft.Authorization"), - "policyDefinitionName": autorest.Encode("path", policyDefinitionName), - "policyStatesSummaryResource": autorest.Encode("path", "latest"), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SummarizeForPolicyDefinitionSender sends the SummarizeForPolicyDefinition request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) SummarizeForPolicyDefinitionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SummarizeForPolicyDefinitionResponder handles the response to the SummarizeForPolicyDefinition request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) SummarizeForPolicyDefinitionResponder(resp *http.Response) (result SummarizeResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SummarizeForPolicySetDefinition summarizes policy states for the subscription level policy set definition. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// policySetDefinitionName - policy set definition name. -// top - maximum number of records to return. -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -func (client PolicyStatesClient) SummarizeForPolicySetDefinition(ctx context.Context, subscriptionID string, policySetDefinitionName string, top *int32, from *date.Time, toParameter *date.Time, filter string) (result SummarizeResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.SummarizeForPolicySetDefinition") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "SummarizeForPolicySetDefinition", err.Error()) - } - - req, err := client.SummarizeForPolicySetDefinitionPreparer(ctx, subscriptionID, policySetDefinitionName, top, from, toParameter, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForPolicySetDefinition", nil, "Failure preparing request") - return - } - - resp, err := client.SummarizeForPolicySetDefinitionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForPolicySetDefinition", resp, "Failure sending request") - return - } - - result, err = client.SummarizeForPolicySetDefinitionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForPolicySetDefinition", resp, "Failure responding to request") - return - } - - return -} - -// SummarizeForPolicySetDefinitionPreparer prepares the SummarizeForPolicySetDefinition request. -func (client PolicyStatesClient) SummarizeForPolicySetDefinitionPreparer(ctx context.Context, subscriptionID string, policySetDefinitionName string, top *int32, from *date.Time, toParameter *date.Time, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationNamespace": autorest.Encode("path", "Microsoft.Authorization"), - "policySetDefinitionName": autorest.Encode("path", policySetDefinitionName), - "policyStatesSummaryResource": autorest.Encode("path", "latest"), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SummarizeForPolicySetDefinitionSender sends the SummarizeForPolicySetDefinition request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) SummarizeForPolicySetDefinitionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SummarizeForPolicySetDefinitionResponder handles the response to the SummarizeForPolicySetDefinition request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) SummarizeForPolicySetDefinitionResponder(resp *http.Response) (result SummarizeResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SummarizeForResource summarizes policy states for the resource. -// Parameters: -// resourceID - resource ID. -// top - maximum number of records to return. -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -func (client PolicyStatesClient) SummarizeForResource(ctx context.Context, resourceID string, top *int32, from *date.Time, toParameter *date.Time, filter string) (result SummarizeResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.SummarizeForResource") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "SummarizeForResource", err.Error()) - } - - req, err := client.SummarizeForResourcePreparer(ctx, resourceID, top, from, toParameter, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForResource", nil, "Failure preparing request") - return - } - - resp, err := client.SummarizeForResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForResource", resp, "Failure sending request") - return - } - - result, err = client.SummarizeForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForResource", resp, "Failure responding to request") - return - } - - return -} - -// SummarizeForResourcePreparer prepares the SummarizeForResource request. -func (client PolicyStatesClient) SummarizeForResourcePreparer(ctx context.Context, resourceID string, top *int32, from *date.Time, toParameter *date.Time, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyStatesSummaryResource": autorest.Encode("path", "latest"), - "resourceId": resourceID, - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SummarizeForResourceSender sends the SummarizeForResource request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) SummarizeForResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// SummarizeForResourceResponder handles the response to the SummarizeForResource request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) SummarizeForResourceResponder(resp *http.Response) (result SummarizeResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SummarizeForResourceGroup summarizes policy states for the resources under the resource group. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// resourceGroupName - resource group name. -// top - maximum number of records to return. -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -func (client PolicyStatesClient) SummarizeForResourceGroup(ctx context.Context, subscriptionID string, resourceGroupName string, top *int32, from *date.Time, toParameter *date.Time, filter string) (result SummarizeResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.SummarizeForResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "SummarizeForResourceGroup", err.Error()) - } - - req, err := client.SummarizeForResourceGroupPreparer(ctx, subscriptionID, resourceGroupName, top, from, toParameter, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.SummarizeForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.SummarizeForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// SummarizeForResourceGroupPreparer prepares the SummarizeForResourceGroup request. -func (client PolicyStatesClient) SummarizeForResourceGroupPreparer(ctx context.Context, subscriptionID string, resourceGroupName string, top *int32, from *date.Time, toParameter *date.Time, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyStatesSummaryResource": autorest.Encode("path", "latest"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SummarizeForResourceGroupSender sends the SummarizeForResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) SummarizeForResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SummarizeForResourceGroupResponder handles the response to the SummarizeForResourceGroup request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) SummarizeForResourceGroupResponder(resp *http.Response) (result SummarizeResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SummarizeForResourceGroupLevelPolicyAssignment summarizes policy states for the resource group level policy -// assignment. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// resourceGroupName - resource group name. -// policyAssignmentName - policy assignment name. -// top - maximum number of records to return. -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -func (client PolicyStatesClient) SummarizeForResourceGroupLevelPolicyAssignment(ctx context.Context, subscriptionID string, resourceGroupName string, policyAssignmentName string, top *int32, from *date.Time, toParameter *date.Time, filter string) (result SummarizeResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.SummarizeForResourceGroupLevelPolicyAssignment") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "SummarizeForResourceGroupLevelPolicyAssignment", err.Error()) - } - - req, err := client.SummarizeForResourceGroupLevelPolicyAssignmentPreparer(ctx, subscriptionID, resourceGroupName, policyAssignmentName, top, from, toParameter, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForResourceGroupLevelPolicyAssignment", nil, "Failure preparing request") - return - } - - resp, err := client.SummarizeForResourceGroupLevelPolicyAssignmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForResourceGroupLevelPolicyAssignment", resp, "Failure sending request") - return - } - - result, err = client.SummarizeForResourceGroupLevelPolicyAssignmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForResourceGroupLevelPolicyAssignment", resp, "Failure responding to request") - return - } - - return -} - -// SummarizeForResourceGroupLevelPolicyAssignmentPreparer prepares the SummarizeForResourceGroupLevelPolicyAssignment request. -func (client PolicyStatesClient) SummarizeForResourceGroupLevelPolicyAssignmentPreparer(ctx context.Context, subscriptionID string, resourceGroupName string, policyAssignmentName string, top *int32, from *date.Time, toParameter *date.Time, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationNamespace": autorest.Encode("path", "Microsoft.Authorization"), - "policyAssignmentName": autorest.Encode("path", policyAssignmentName), - "policyStatesSummaryResource": autorest.Encode("path", "latest"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SummarizeForResourceGroupLevelPolicyAssignmentSender sends the SummarizeForResourceGroupLevelPolicyAssignment request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) SummarizeForResourceGroupLevelPolicyAssignmentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SummarizeForResourceGroupLevelPolicyAssignmentResponder handles the response to the SummarizeForResourceGroupLevelPolicyAssignment request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) SummarizeForResourceGroupLevelPolicyAssignmentResponder(resp *http.Response) (result SummarizeResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SummarizeForSubscription summarizes policy states for the resources under the subscription. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// top - maximum number of records to return. -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -func (client PolicyStatesClient) SummarizeForSubscription(ctx context.Context, subscriptionID string, top *int32, from *date.Time, toParameter *date.Time, filter string) (result SummarizeResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.SummarizeForSubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "SummarizeForSubscription", err.Error()) - } - - req, err := client.SummarizeForSubscriptionPreparer(ctx, subscriptionID, top, from, toParameter, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.SummarizeForSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForSubscription", resp, "Failure sending request") - return - } - - result, err = client.SummarizeForSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForSubscription", resp, "Failure responding to request") - return - } - - return -} - -// SummarizeForSubscriptionPreparer prepares the SummarizeForSubscription request. -func (client PolicyStatesClient) SummarizeForSubscriptionPreparer(ctx context.Context, subscriptionID string, top *int32, from *date.Time, toParameter *date.Time, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyStatesSummaryResource": autorest.Encode("path", "latest"), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SummarizeForSubscriptionSender sends the SummarizeForSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) SummarizeForSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SummarizeForSubscriptionResponder handles the response to the SummarizeForSubscription request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) SummarizeForSubscriptionResponder(resp *http.Response) (result SummarizeResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// SummarizeForSubscriptionLevelPolicyAssignment summarizes policy states for the subscription level policy assignment. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// policyAssignmentName - policy assignment name. -// top - maximum number of records to return. -// from - ISO 8601 formatted timestamp specifying the start time of the interval to query. When not specified, -// the service uses ($to - 1-day). -// toParameter - ISO 8601 formatted timestamp specifying the end time of the interval to query. When not -// specified, the service uses request time. -// filter - oData filter expression. -func (client PolicyStatesClient) SummarizeForSubscriptionLevelPolicyAssignment(ctx context.Context, subscriptionID string, policyAssignmentName string, top *int32, from *date.Time, toParameter *date.Time, filter string) (result SummarizeResults, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.SummarizeForSubscriptionLevelPolicyAssignment") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyStatesClient", "SummarizeForSubscriptionLevelPolicyAssignment", err.Error()) - } - - req, err := client.SummarizeForSubscriptionLevelPolicyAssignmentPreparer(ctx, subscriptionID, policyAssignmentName, top, from, toParameter, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForSubscriptionLevelPolicyAssignment", nil, "Failure preparing request") - return - } - - resp, err := client.SummarizeForSubscriptionLevelPolicyAssignmentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForSubscriptionLevelPolicyAssignment", resp, "Failure sending request") - return - } - - result, err = client.SummarizeForSubscriptionLevelPolicyAssignmentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "SummarizeForSubscriptionLevelPolicyAssignment", resp, "Failure responding to request") - return - } - - return -} - -// SummarizeForSubscriptionLevelPolicyAssignmentPreparer prepares the SummarizeForSubscriptionLevelPolicyAssignment request. -func (client PolicyStatesClient) SummarizeForSubscriptionLevelPolicyAssignmentPreparer(ctx context.Context, subscriptionID string, policyAssignmentName string, top *int32, from *date.Time, toParameter *date.Time, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationNamespace": autorest.Encode("path", "Microsoft.Authorization"), - "policyAssignmentName": autorest.Encode("path", policyAssignmentName), - "policyStatesSummaryResource": autorest.Encode("path", "latest"), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if from != nil { - queryParameters["$from"] = autorest.Encode("query", *from) - } - if toParameter != nil { - queryParameters["$to"] = autorest.Encode("query", *toParameter) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyStates/{policyStatesSummaryResource}/summarize", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SummarizeForSubscriptionLevelPolicyAssignmentSender sends the SummarizeForSubscriptionLevelPolicyAssignment request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) SummarizeForSubscriptionLevelPolicyAssignmentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// SummarizeForSubscriptionLevelPolicyAssignmentResponder handles the response to the SummarizeForSubscriptionLevelPolicyAssignment request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) SummarizeForSubscriptionLevelPolicyAssignmentResponder(resp *http.Response) (result SummarizeResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// TriggerResourceGroupEvaluation triggers a policy evaluation scan for all the resources under the resource group. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// resourceGroupName - resource group name. -func (client PolicyStatesClient) TriggerResourceGroupEvaluation(ctx context.Context, subscriptionID string, resourceGroupName string) (result PolicyStatesTriggerResourceGroupEvaluationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.TriggerResourceGroupEvaluation") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.TriggerResourceGroupEvaluationPreparer(ctx, subscriptionID, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "TriggerResourceGroupEvaluation", nil, "Failure preparing request") - return - } - - result, err = client.TriggerResourceGroupEvaluationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "TriggerResourceGroupEvaluation", result.Response(), "Failure sending request") - return - } - - return -} - -// TriggerResourceGroupEvaluationPreparer prepares the TriggerResourceGroupEvaluation request. -func (client PolicyStatesClient) TriggerResourceGroupEvaluationPreparer(ctx context.Context, subscriptionID string, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// TriggerResourceGroupEvaluationSender sends the TriggerResourceGroupEvaluation request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) TriggerResourceGroupEvaluationSender(req *http.Request) (future PolicyStatesTriggerResourceGroupEvaluationFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// TriggerResourceGroupEvaluationResponder handles the response to the TriggerResourceGroupEvaluation request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) TriggerResourceGroupEvaluationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// TriggerSubscriptionEvaluation triggers a policy evaluation scan for all the resources under the subscription -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -func (client PolicyStatesClient) TriggerSubscriptionEvaluation(ctx context.Context, subscriptionID string) (result PolicyStatesTriggerSubscriptionEvaluationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyStatesClient.TriggerSubscriptionEvaluation") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.TriggerSubscriptionEvaluationPreparer(ctx, subscriptionID) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "TriggerSubscriptionEvaluation", nil, "Failure preparing request") - return - } - - result, err = client.TriggerSubscriptionEvaluationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyStatesClient", "TriggerSubscriptionEvaluation", result.Response(), "Failure sending request") - return - } - - return -} - -// TriggerSubscriptionEvaluationPreparer prepares the TriggerSubscriptionEvaluation request. -func (client PolicyStatesClient) TriggerSubscriptionEvaluationPreparer(ctx context.Context, subscriptionID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyStates/latest/triggerEvaluation", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// TriggerSubscriptionEvaluationSender sends the TriggerSubscriptionEvaluation request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyStatesClient) TriggerSubscriptionEvaluationSender(req *http.Request) (future PolicyStatesTriggerSubscriptionEvaluationFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// TriggerSubscriptionEvaluationResponder handles the response to the TriggerSubscriptionEvaluation request. The method always -// closes the http.Response Body. -func (client PolicyStatesClient) TriggerSubscriptionEvaluationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/policytrackedresources.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/policytrackedresources.go deleted file mode 100644 index 11232972660..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/policytrackedresources.go +++ /dev/null @@ -1,560 +0,0 @@ -package policyinsights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PolicyTrackedResourcesClient is the client for the PolicyTrackedResources methods of the Policyinsights service. -type PolicyTrackedResourcesClient struct { - BaseClient -} - -// NewPolicyTrackedResourcesClient creates an instance of the PolicyTrackedResourcesClient client. -func NewPolicyTrackedResourcesClient() PolicyTrackedResourcesClient { - return NewPolicyTrackedResourcesClientWithBaseURI(DefaultBaseURI) -} - -// NewPolicyTrackedResourcesClientWithBaseURI creates an instance of the PolicyTrackedResourcesClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewPolicyTrackedResourcesClientWithBaseURI(baseURI string) PolicyTrackedResourcesClient { - return PolicyTrackedResourcesClient{NewWithBaseURI(baseURI)} -} - -// ListQueryResultsForManagementGroup queries policy tracked resources under the management group. -// Parameters: -// managementGroupName - management group name. -// top - maximum number of records to return. -// filter - oData filter expression. -func (client PolicyTrackedResourcesClient) ListQueryResultsForManagementGroup(ctx context.Context, managementGroupName string, top *int32, filter string) (result PolicyTrackedResourcesQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup") - defer func() { - sc := -1 - if result.ptrqr.Response.Response != nil { - sc = result.ptrqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForManagementGroup", err.Error()) - } - - result.fn = client.listQueryResultsForManagementGroupNextResults - req, err := client.ListQueryResultsForManagementGroupPreparer(ctx, managementGroupName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForManagementGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForManagementGroupSender(req) - if err != nil { - result.ptrqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForManagementGroup", resp, "Failure sending request") - return - } - - result.ptrqr, err = client.ListQueryResultsForManagementGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForManagementGroup", resp, "Failure responding to request") - return - } - if result.ptrqr.hasNextLink() && result.ptrqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForManagementGroupPreparer prepares the ListQueryResultsForManagementGroup request. -func (client PolicyTrackedResourcesClient) ListQueryResultsForManagementGroupPreparer(ctx context.Context, managementGroupName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managementGroupName": autorest.Encode("path", managementGroupName), - "managementGroupsNamespace": autorest.Encode("path", "Microsoft.Management"), - "policyTrackedResourcesResource": autorest.Encode("path", "default"), - } - - const APIVersion = "2018-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForManagementGroupSender sends the ListQueryResultsForManagementGroup request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyTrackedResourcesClient) ListQueryResultsForManagementGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListQueryResultsForManagementGroupResponder handles the response to the ListQueryResultsForManagementGroup request. The method always -// closes the http.Response Body. -func (client PolicyTrackedResourcesClient) ListQueryResultsForManagementGroupResponder(resp *http.Response) (result PolicyTrackedResourcesQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForManagementGroupNextResults retrieves the next set of results, if any. -func (client PolicyTrackedResourcesClient) listQueryResultsForManagementGroupNextResults(ctx context.Context, lastResults PolicyTrackedResourcesQueryResults) (result PolicyTrackedResourcesQueryResults, err error) { - req, err := lastResults.policyTrackedResourcesQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "listQueryResultsForManagementGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForManagementGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "listQueryResultsForManagementGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForManagementGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "listQueryResultsForManagementGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForManagementGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyTrackedResourcesClient) ListQueryResultsForManagementGroupComplete(ctx context.Context, managementGroupName string, top *int32, filter string) (result PolicyTrackedResourcesQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyTrackedResourcesClient.ListQueryResultsForManagementGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForManagementGroup(ctx, managementGroupName, top, filter) - return -} - -// ListQueryResultsForResource queries policy tracked resources under the resource. -// Parameters: -// resourceID - resource ID. -// top - maximum number of records to return. -// filter - oData filter expression. -func (client PolicyTrackedResourcesClient) ListQueryResultsForResource(ctx context.Context, resourceID string, top *int32, filter string) (result PolicyTrackedResourcesQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyTrackedResourcesClient.ListQueryResultsForResource") - defer func() { - sc := -1 - if result.ptrqr.Response.Response != nil { - sc = result.ptrqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForResource", err.Error()) - } - - result.fn = client.listQueryResultsForResourceNextResults - req, err := client.ListQueryResultsForResourcePreparer(ctx, resourceID, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForResourceSender(req) - if err != nil { - result.ptrqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForResource", resp, "Failure sending request") - return - } - - result.ptrqr, err = client.ListQueryResultsForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForResource", resp, "Failure responding to request") - return - } - if result.ptrqr.hasNextLink() && result.ptrqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForResourcePreparer prepares the ListQueryResultsForResource request. -func (client PolicyTrackedResourcesClient) ListQueryResultsForResourcePreparer(ctx context.Context, resourceID string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyTrackedResourcesResource": autorest.Encode("path", "default"), - "resourceId": resourceID, - } - - const APIVersion = "2018-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForResourceSender sends the ListQueryResultsForResource request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyTrackedResourcesClient) ListQueryResultsForResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListQueryResultsForResourceResponder handles the response to the ListQueryResultsForResource request. The method always -// closes the http.Response Body. -func (client PolicyTrackedResourcesClient) ListQueryResultsForResourceResponder(resp *http.Response) (result PolicyTrackedResourcesQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForResourceNextResults retrieves the next set of results, if any. -func (client PolicyTrackedResourcesClient) listQueryResultsForResourceNextResults(ctx context.Context, lastResults PolicyTrackedResourcesQueryResults) (result PolicyTrackedResourcesQueryResults, err error) { - req, err := lastResults.policyTrackedResourcesQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "listQueryResultsForResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "listQueryResultsForResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "listQueryResultsForResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyTrackedResourcesClient) ListQueryResultsForResourceComplete(ctx context.Context, resourceID string, top *int32, filter string) (result PolicyTrackedResourcesQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyTrackedResourcesClient.ListQueryResultsForResource") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForResource(ctx, resourceID, top, filter) - return -} - -// ListQueryResultsForResourceGroup queries policy tracked resources under the resource group. -// Parameters: -// resourceGroupName - resource group name. -// subscriptionID - microsoft Azure subscription ID. -// top - maximum number of records to return. -// filter - oData filter expression. -func (client PolicyTrackedResourcesClient) ListQueryResultsForResourceGroup(ctx context.Context, resourceGroupName string, subscriptionID string, top *int32, filter string) (result PolicyTrackedResourcesQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyTrackedResourcesClient.ListQueryResultsForResourceGroup") - defer func() { - sc := -1 - if result.ptrqr.Response.Response != nil { - sc = result.ptrqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForResourceGroup", err.Error()) - } - - result.fn = client.listQueryResultsForResourceGroupNextResults - req, err := client.ListQueryResultsForResourceGroupPreparer(ctx, resourceGroupName, subscriptionID, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForResourceGroupSender(req) - if err != nil { - result.ptrqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForResourceGroup", resp, "Failure sending request") - return - } - - result.ptrqr, err = client.ListQueryResultsForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForResourceGroup", resp, "Failure responding to request") - return - } - if result.ptrqr.hasNextLink() && result.ptrqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForResourceGroupPreparer prepares the ListQueryResultsForResourceGroup request. -func (client PolicyTrackedResourcesClient) ListQueryResultsForResourceGroupPreparer(ctx context.Context, resourceGroupName string, subscriptionID string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyTrackedResourcesResource": autorest.Encode("path", "default"), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2018-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForResourceGroupSender sends the ListQueryResultsForResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyTrackedResourcesClient) ListQueryResultsForResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListQueryResultsForResourceGroupResponder handles the response to the ListQueryResultsForResourceGroup request. The method always -// closes the http.Response Body. -func (client PolicyTrackedResourcesClient) ListQueryResultsForResourceGroupResponder(resp *http.Response) (result PolicyTrackedResourcesQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForResourceGroupNextResults retrieves the next set of results, if any. -func (client PolicyTrackedResourcesClient) listQueryResultsForResourceGroupNextResults(ctx context.Context, lastResults PolicyTrackedResourcesQueryResults) (result PolicyTrackedResourcesQueryResults, err error) { - req, err := lastResults.policyTrackedResourcesQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "listQueryResultsForResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "listQueryResultsForResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "listQueryResultsForResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyTrackedResourcesClient) ListQueryResultsForResourceGroupComplete(ctx context.Context, resourceGroupName string, subscriptionID string, top *int32, filter string) (result PolicyTrackedResourcesQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyTrackedResourcesClient.ListQueryResultsForResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForResourceGroup(ctx, resourceGroupName, subscriptionID, top, filter) - return -} - -// ListQueryResultsForSubscription queries policy tracked resources under the subscription. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// top - maximum number of records to return. -// filter - oData filter expression. -func (client PolicyTrackedResourcesClient) ListQueryResultsForSubscription(ctx context.Context, subscriptionID string, top *int32, filter string) (result PolicyTrackedResourcesQueryResultsPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyTrackedResourcesClient.ListQueryResultsForSubscription") - defer func() { - sc := -1 - if result.ptrqr.Response.Response != nil { - sc = result.ptrqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForSubscription", err.Error()) - } - - result.fn = client.listQueryResultsForSubscriptionNextResults - req, err := client.ListQueryResultsForSubscriptionPreparer(ctx, subscriptionID, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListQueryResultsForSubscriptionSender(req) - if err != nil { - result.ptrqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForSubscription", resp, "Failure sending request") - return - } - - result.ptrqr, err = client.ListQueryResultsForSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "ListQueryResultsForSubscription", resp, "Failure responding to request") - return - } - if result.ptrqr.hasNextLink() && result.ptrqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListQueryResultsForSubscriptionPreparer prepares the ListQueryResultsForSubscription request. -func (client PolicyTrackedResourcesClient) ListQueryResultsForSubscriptionPreparer(ctx context.Context, subscriptionID string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "policyTrackedResourcesResource": autorest.Encode("path", "default"), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2018-07-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyTrackedResources/{policyTrackedResourcesResource}/queryResults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListQueryResultsForSubscriptionSender sends the ListQueryResultsForSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client PolicyTrackedResourcesClient) ListQueryResultsForSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListQueryResultsForSubscriptionResponder handles the response to the ListQueryResultsForSubscription request. The method always -// closes the http.Response Body. -func (client PolicyTrackedResourcesClient) ListQueryResultsForSubscriptionResponder(resp *http.Response) (result PolicyTrackedResourcesQueryResults, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listQueryResultsForSubscriptionNextResults retrieves the next set of results, if any. -func (client PolicyTrackedResourcesClient) listQueryResultsForSubscriptionNextResults(ctx context.Context, lastResults PolicyTrackedResourcesQueryResults) (result PolicyTrackedResourcesQueryResults, err error) { - req, err := lastResults.policyTrackedResourcesQueryResultsPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "listQueryResultsForSubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListQueryResultsForSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "listQueryResultsForSubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListQueryResultsForSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.PolicyTrackedResourcesClient", "listQueryResultsForSubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListQueryResultsForSubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client PolicyTrackedResourcesClient) ListQueryResultsForSubscriptionComplete(ctx context.Context, subscriptionID string, top *int32, filter string) (result PolicyTrackedResourcesQueryResultsIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyTrackedResourcesClient.ListQueryResultsForSubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListQueryResultsForSubscription(ctx, subscriptionID, top, filter) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/remediations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/remediations.go deleted file mode 100644 index 6f14bcc3933..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/remediations.go +++ /dev/null @@ -1,2306 +0,0 @@ -package policyinsights - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RemediationsClient is the client for the Remediations methods of the Policyinsights service. -type RemediationsClient struct { - BaseClient -} - -// NewRemediationsClient creates an instance of the RemediationsClient client. -func NewRemediationsClient() RemediationsClient { - return NewRemediationsClientWithBaseURI(DefaultBaseURI) -} - -// NewRemediationsClientWithBaseURI creates an instance of the RemediationsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewRemediationsClientWithBaseURI(baseURI string) RemediationsClient { - return RemediationsClient{NewWithBaseURI(baseURI)} -} - -// CancelAtManagementGroup cancels a remediation at management group scope. -// Parameters: -// managementGroupID - management group ID. -// remediationName - the name of the remediation. -func (client RemediationsClient) CancelAtManagementGroup(ctx context.Context, managementGroupID string, remediationName string) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.CancelAtManagementGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelAtManagementGroupPreparer(ctx, managementGroupID, remediationName) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CancelAtManagementGroup", nil, "Failure preparing request") - return - } - - resp, err := client.CancelAtManagementGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CancelAtManagementGroup", resp, "Failure sending request") - return - } - - result, err = client.CancelAtManagementGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CancelAtManagementGroup", resp, "Failure responding to request") - return - } - - return -} - -// CancelAtManagementGroupPreparer prepares the CancelAtManagementGroup request. -func (client RemediationsClient) CancelAtManagementGroupPreparer(ctx context.Context, managementGroupID string, remediationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managementGroupId": autorest.Encode("path", managementGroupID), - "managementGroupsNamespace": autorest.Encode("path", "Microsoft.Management"), - "remediationName": autorest.Encode("path", remediationName), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelAtManagementGroupSender sends the CancelAtManagementGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) CancelAtManagementGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CancelAtManagementGroupResponder handles the response to the CancelAtManagementGroup request. The method always -// closes the http.Response Body. -func (client RemediationsClient) CancelAtManagementGroupResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CancelAtResource cancel a remediation at resource scope. -// Parameters: -// resourceID - resource ID. -// remediationName - the name of the remediation. -func (client RemediationsClient) CancelAtResource(ctx context.Context, resourceID string, remediationName string) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.CancelAtResource") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelAtResourcePreparer(ctx, resourceID, remediationName) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CancelAtResource", nil, "Failure preparing request") - return - } - - resp, err := client.CancelAtResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CancelAtResource", resp, "Failure sending request") - return - } - - result, err = client.CancelAtResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CancelAtResource", resp, "Failure responding to request") - return - } - - return -} - -// CancelAtResourcePreparer prepares the CancelAtResource request. -func (client RemediationsClient) CancelAtResourcePreparer(ctx context.Context, resourceID string, remediationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "remediationName": autorest.Encode("path", remediationName), - "resourceId": resourceID, - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelAtResourceSender sends the CancelAtResource request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) CancelAtResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CancelAtResourceResponder handles the response to the CancelAtResource request. The method always -// closes the http.Response Body. -func (client RemediationsClient) CancelAtResourceResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CancelAtResourceGroup cancels a remediation at resource group scope. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// resourceGroupName - resource group name. -// remediationName - the name of the remediation. -func (client RemediationsClient) CancelAtResourceGroup(ctx context.Context, subscriptionID string, resourceGroupName string, remediationName string) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.CancelAtResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelAtResourceGroupPreparer(ctx, subscriptionID, resourceGroupName, remediationName) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CancelAtResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.CancelAtResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CancelAtResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.CancelAtResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CancelAtResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// CancelAtResourceGroupPreparer prepares the CancelAtResourceGroup request. -func (client RemediationsClient) CancelAtResourceGroupPreparer(ctx context.Context, subscriptionID string, resourceGroupName string, remediationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "remediationName": autorest.Encode("path", remediationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelAtResourceGroupSender sends the CancelAtResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) CancelAtResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelAtResourceGroupResponder handles the response to the CancelAtResourceGroup request. The method always -// closes the http.Response Body. -func (client RemediationsClient) CancelAtResourceGroupResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CancelAtSubscription cancels a remediation at subscription scope. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// remediationName - the name of the remediation. -func (client RemediationsClient) CancelAtSubscription(ctx context.Context, subscriptionID string, remediationName string) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.CancelAtSubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CancelAtSubscriptionPreparer(ctx, subscriptionID, remediationName) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CancelAtSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.CancelAtSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CancelAtSubscription", resp, "Failure sending request") - return - } - - result, err = client.CancelAtSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CancelAtSubscription", resp, "Failure responding to request") - return - } - - return -} - -// CancelAtSubscriptionPreparer prepares the CancelAtSubscription request. -func (client RemediationsClient) CancelAtSubscriptionPreparer(ctx context.Context, subscriptionID string, remediationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "remediationName": autorest.Encode("path", remediationName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CancelAtSubscriptionSender sends the CancelAtSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) CancelAtSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CancelAtSubscriptionResponder handles the response to the CancelAtSubscription request. The method always -// closes the http.Response Body. -func (client RemediationsClient) CancelAtSubscriptionResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAtManagementGroup creates or updates a remediation at management group scope. -// Parameters: -// managementGroupID - management group ID. -// remediationName - the name of the remediation. -// parameters - the remediation parameters. -func (client RemediationsClient) CreateOrUpdateAtManagementGroup(ctx context.Context, managementGroupID string, remediationName string, parameters Remediation) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.CreateOrUpdateAtManagementGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdateAtManagementGroupPreparer(ctx, managementGroupID, remediationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CreateOrUpdateAtManagementGroup", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAtManagementGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CreateOrUpdateAtManagementGroup", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAtManagementGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CreateOrUpdateAtManagementGroup", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateAtManagementGroupPreparer prepares the CreateOrUpdateAtManagementGroup request. -func (client RemediationsClient) CreateOrUpdateAtManagementGroupPreparer(ctx context.Context, managementGroupID string, remediationName string, parameters Remediation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managementGroupId": autorest.Encode("path", managementGroupID), - "managementGroupsNamespace": autorest.Encode("path", "Microsoft.Management"), - "remediationName": autorest.Encode("path", remediationName), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Type = nil - parameters.Name = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateAtManagementGroupSender sends the CreateOrUpdateAtManagementGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) CreateOrUpdateAtManagementGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateAtManagementGroupResponder handles the response to the CreateOrUpdateAtManagementGroup request. The method always -// closes the http.Response Body. -func (client RemediationsClient) CreateOrUpdateAtManagementGroupResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAtResource creates or updates a remediation at resource scope. -// Parameters: -// resourceID - resource ID. -// remediationName - the name of the remediation. -// parameters - the remediation parameters. -func (client RemediationsClient) CreateOrUpdateAtResource(ctx context.Context, resourceID string, remediationName string, parameters Remediation) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.CreateOrUpdateAtResource") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdateAtResourcePreparer(ctx, resourceID, remediationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CreateOrUpdateAtResource", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAtResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CreateOrUpdateAtResource", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAtResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CreateOrUpdateAtResource", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateAtResourcePreparer prepares the CreateOrUpdateAtResource request. -func (client RemediationsClient) CreateOrUpdateAtResourcePreparer(ctx context.Context, resourceID string, remediationName string, parameters Remediation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "remediationName": autorest.Encode("path", remediationName), - "resourceId": resourceID, - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Type = nil - parameters.Name = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateAtResourceSender sends the CreateOrUpdateAtResource request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) CreateOrUpdateAtResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateOrUpdateAtResourceResponder handles the response to the CreateOrUpdateAtResource request. The method always -// closes the http.Response Body. -func (client RemediationsClient) CreateOrUpdateAtResourceResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAtResourceGroup creates or updates a remediation at resource group scope. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// resourceGroupName - resource group name. -// remediationName - the name of the remediation. -// parameters - the remediation parameters. -func (client RemediationsClient) CreateOrUpdateAtResourceGroup(ctx context.Context, subscriptionID string, resourceGroupName string, remediationName string, parameters Remediation) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.CreateOrUpdateAtResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdateAtResourceGroupPreparer(ctx, subscriptionID, resourceGroupName, remediationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CreateOrUpdateAtResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAtResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CreateOrUpdateAtResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAtResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CreateOrUpdateAtResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateAtResourceGroupPreparer prepares the CreateOrUpdateAtResourceGroup request. -func (client RemediationsClient) CreateOrUpdateAtResourceGroupPreparer(ctx context.Context, subscriptionID string, resourceGroupName string, remediationName string, parameters Remediation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "remediationName": autorest.Encode("path", remediationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Type = nil - parameters.Name = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateAtResourceGroupSender sends the CreateOrUpdateAtResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) CreateOrUpdateAtResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateAtResourceGroupResponder handles the response to the CreateOrUpdateAtResourceGroup request. The method always -// closes the http.Response Body. -func (client RemediationsClient) CreateOrUpdateAtResourceGroupResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAtSubscription creates or updates a remediation at subscription scope. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// remediationName - the name of the remediation. -// parameters - the remediation parameters. -func (client RemediationsClient) CreateOrUpdateAtSubscription(ctx context.Context, subscriptionID string, remediationName string, parameters Remediation) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.CreateOrUpdateAtSubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdateAtSubscriptionPreparer(ctx, subscriptionID, remediationName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CreateOrUpdateAtSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAtSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CreateOrUpdateAtSubscription", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAtSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "CreateOrUpdateAtSubscription", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateAtSubscriptionPreparer prepares the CreateOrUpdateAtSubscription request. -func (client RemediationsClient) CreateOrUpdateAtSubscriptionPreparer(ctx context.Context, subscriptionID string, remediationName string, parameters Remediation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "remediationName": autorest.Encode("path", remediationName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.ID = nil - parameters.Type = nil - parameters.Name = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateAtSubscriptionSender sends the CreateOrUpdateAtSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) CreateOrUpdateAtSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateAtSubscriptionResponder handles the response to the CreateOrUpdateAtSubscription request. The method always -// closes the http.Response Body. -func (client RemediationsClient) CreateOrUpdateAtSubscriptionResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteAtManagementGroup deletes an existing remediation at management group scope. -// Parameters: -// managementGroupID - management group ID. -// remediationName - the name of the remediation. -func (client RemediationsClient) DeleteAtManagementGroup(ctx context.Context, managementGroupID string, remediationName string) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.DeleteAtManagementGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteAtManagementGroupPreparer(ctx, managementGroupID, remediationName) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "DeleteAtManagementGroup", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAtManagementGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "DeleteAtManagementGroup", resp, "Failure sending request") - return - } - - result, err = client.DeleteAtManagementGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "DeleteAtManagementGroup", resp, "Failure responding to request") - return - } - - return -} - -// DeleteAtManagementGroupPreparer prepares the DeleteAtManagementGroup request. -func (client RemediationsClient) DeleteAtManagementGroupPreparer(ctx context.Context, managementGroupID string, remediationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managementGroupId": autorest.Encode("path", managementGroupID), - "managementGroupsNamespace": autorest.Encode("path", "Microsoft.Management"), - "remediationName": autorest.Encode("path", remediationName), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteAtManagementGroupSender sends the DeleteAtManagementGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) DeleteAtManagementGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteAtManagementGroupResponder handles the response to the DeleteAtManagementGroup request. The method always -// closes the http.Response Body. -func (client RemediationsClient) DeleteAtManagementGroupResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteAtResource deletes an existing remediation at individual resource scope. -// Parameters: -// resourceID - resource ID. -// remediationName - the name of the remediation. -func (client RemediationsClient) DeleteAtResource(ctx context.Context, resourceID string, remediationName string) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.DeleteAtResource") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteAtResourcePreparer(ctx, resourceID, remediationName) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "DeleteAtResource", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAtResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "DeleteAtResource", resp, "Failure sending request") - return - } - - result, err = client.DeleteAtResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "DeleteAtResource", resp, "Failure responding to request") - return - } - - return -} - -// DeleteAtResourcePreparer prepares the DeleteAtResource request. -func (client RemediationsClient) DeleteAtResourcePreparer(ctx context.Context, resourceID string, remediationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "remediationName": autorest.Encode("path", remediationName), - "resourceId": resourceID, - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteAtResourceSender sends the DeleteAtResource request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) DeleteAtResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteAtResourceResponder handles the response to the DeleteAtResource request. The method always -// closes the http.Response Body. -func (client RemediationsClient) DeleteAtResourceResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteAtResourceGroup deletes an existing remediation at resource group scope. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// resourceGroupName - resource group name. -// remediationName - the name of the remediation. -func (client RemediationsClient) DeleteAtResourceGroup(ctx context.Context, subscriptionID string, resourceGroupName string, remediationName string) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.DeleteAtResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteAtResourceGroupPreparer(ctx, subscriptionID, resourceGroupName, remediationName) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "DeleteAtResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAtResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "DeleteAtResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.DeleteAtResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "DeleteAtResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// DeleteAtResourceGroupPreparer prepares the DeleteAtResourceGroup request. -func (client RemediationsClient) DeleteAtResourceGroupPreparer(ctx context.Context, subscriptionID string, resourceGroupName string, remediationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "remediationName": autorest.Encode("path", remediationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteAtResourceGroupSender sends the DeleteAtResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) DeleteAtResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteAtResourceGroupResponder handles the response to the DeleteAtResourceGroup request. The method always -// closes the http.Response Body. -func (client RemediationsClient) DeleteAtResourceGroupResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DeleteAtSubscription deletes an existing remediation at subscription scope. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// remediationName - the name of the remediation. -func (client RemediationsClient) DeleteAtSubscription(ctx context.Context, subscriptionID string, remediationName string) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.DeleteAtSubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeleteAtSubscriptionPreparer(ctx, subscriptionID, remediationName) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "DeleteAtSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAtSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "DeleteAtSubscription", resp, "Failure sending request") - return - } - - result, err = client.DeleteAtSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "DeleteAtSubscription", resp, "Failure responding to request") - return - } - - return -} - -// DeleteAtSubscriptionPreparer prepares the DeleteAtSubscription request. -func (client RemediationsClient) DeleteAtSubscriptionPreparer(ctx context.Context, subscriptionID string, remediationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "remediationName": autorest.Encode("path", remediationName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteAtSubscriptionSender sends the DeleteAtSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) DeleteAtSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteAtSubscriptionResponder handles the response to the DeleteAtSubscription request. The method always -// closes the http.Response Body. -func (client RemediationsClient) DeleteAtSubscriptionResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAtManagementGroup gets an existing remediation at management group scope. -// Parameters: -// managementGroupID - management group ID. -// remediationName - the name of the remediation. -func (client RemediationsClient) GetAtManagementGroup(ctx context.Context, managementGroupID string, remediationName string) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.GetAtManagementGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAtManagementGroupPreparer(ctx, managementGroupID, remediationName) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "GetAtManagementGroup", nil, "Failure preparing request") - return - } - - resp, err := client.GetAtManagementGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "GetAtManagementGroup", resp, "Failure sending request") - return - } - - result, err = client.GetAtManagementGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "GetAtManagementGroup", resp, "Failure responding to request") - return - } - - return -} - -// GetAtManagementGroupPreparer prepares the GetAtManagementGroup request. -func (client RemediationsClient) GetAtManagementGroupPreparer(ctx context.Context, managementGroupID string, remediationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managementGroupId": autorest.Encode("path", managementGroupID), - "managementGroupsNamespace": autorest.Encode("path", "Microsoft.Management"), - "remediationName": autorest.Encode("path", remediationName), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAtManagementGroupSender sends the GetAtManagementGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) GetAtManagementGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetAtManagementGroupResponder handles the response to the GetAtManagementGroup request. The method always -// closes the http.Response Body. -func (client RemediationsClient) GetAtManagementGroupResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAtResource gets an existing remediation at resource scope. -// Parameters: -// resourceID - resource ID. -// remediationName - the name of the remediation. -func (client RemediationsClient) GetAtResource(ctx context.Context, resourceID string, remediationName string) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.GetAtResource") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAtResourcePreparer(ctx, resourceID, remediationName) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "GetAtResource", nil, "Failure preparing request") - return - } - - resp, err := client.GetAtResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "GetAtResource", resp, "Failure sending request") - return - } - - result, err = client.GetAtResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "GetAtResource", resp, "Failure responding to request") - return - } - - return -} - -// GetAtResourcePreparer prepares the GetAtResource request. -func (client RemediationsClient) GetAtResourcePreparer(ctx context.Context, resourceID string, remediationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "remediationName": autorest.Encode("path", remediationName), - "resourceId": resourceID, - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAtResourceSender sends the GetAtResource request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) GetAtResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetAtResourceResponder handles the response to the GetAtResource request. The method always -// closes the http.Response Body. -func (client RemediationsClient) GetAtResourceResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAtResourceGroup gets an existing remediation at resource group scope. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// resourceGroupName - resource group name. -// remediationName - the name of the remediation. -func (client RemediationsClient) GetAtResourceGroup(ctx context.Context, subscriptionID string, resourceGroupName string, remediationName string) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.GetAtResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAtResourceGroupPreparer(ctx, subscriptionID, resourceGroupName, remediationName) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "GetAtResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.GetAtResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "GetAtResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.GetAtResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "GetAtResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// GetAtResourceGroupPreparer prepares the GetAtResourceGroup request. -func (client RemediationsClient) GetAtResourceGroupPreparer(ctx context.Context, subscriptionID string, resourceGroupName string, remediationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "remediationName": autorest.Encode("path", remediationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAtResourceGroupSender sends the GetAtResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) GetAtResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAtResourceGroupResponder handles the response to the GetAtResourceGroup request. The method always -// closes the http.Response Body. -func (client RemediationsClient) GetAtResourceGroupResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAtSubscription gets an existing remediation at subscription scope. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// remediationName - the name of the remediation. -func (client RemediationsClient) GetAtSubscription(ctx context.Context, subscriptionID string, remediationName string) (result Remediation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.GetAtSubscription") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetAtSubscriptionPreparer(ctx, subscriptionID, remediationName) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "GetAtSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.GetAtSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "GetAtSubscription", resp, "Failure sending request") - return - } - - result, err = client.GetAtSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "GetAtSubscription", resp, "Failure responding to request") - return - } - - return -} - -// GetAtSubscriptionPreparer prepares the GetAtSubscription request. -func (client RemediationsClient) GetAtSubscriptionPreparer(ctx context.Context, subscriptionID string, remediationName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "remediationName": autorest.Encode("path", remediationName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAtSubscriptionSender sends the GetAtSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) GetAtSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAtSubscriptionResponder handles the response to the GetAtSubscription request. The method always -// closes the http.Response Body. -func (client RemediationsClient) GetAtSubscriptionResponder(resp *http.Response) (result Remediation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListDeploymentsAtManagementGroup gets all deployments for a remediation at management group scope. -// Parameters: -// managementGroupID - management group ID. -// remediationName - the name of the remediation. -// top - maximum number of records to return. -func (client RemediationsClient) ListDeploymentsAtManagementGroup(ctx context.Context, managementGroupID string, remediationName string, top *int32) (result RemediationDeploymentsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListDeploymentsAtManagementGroup") - defer func() { - sc := -1 - if result.rdlr.Response.Response != nil { - sc = result.rdlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.RemediationsClient", "ListDeploymentsAtManagementGroup", err.Error()) - } - - result.fn = client.listDeploymentsAtManagementGroupNextResults - req, err := client.ListDeploymentsAtManagementGroupPreparer(ctx, managementGroupID, remediationName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListDeploymentsAtManagementGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListDeploymentsAtManagementGroupSender(req) - if err != nil { - result.rdlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListDeploymentsAtManagementGroup", resp, "Failure sending request") - return - } - - result.rdlr, err = client.ListDeploymentsAtManagementGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListDeploymentsAtManagementGroup", resp, "Failure responding to request") - return - } - if result.rdlr.hasNextLink() && result.rdlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListDeploymentsAtManagementGroupPreparer prepares the ListDeploymentsAtManagementGroup request. -func (client RemediationsClient) ListDeploymentsAtManagementGroupPreparer(ctx context.Context, managementGroupID string, remediationName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managementGroupId": autorest.Encode("path", managementGroupID), - "managementGroupsNamespace": autorest.Encode("path", "Microsoft.Management"), - "remediationName": autorest.Encode("path", remediationName), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListDeploymentsAtManagementGroupSender sends the ListDeploymentsAtManagementGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) ListDeploymentsAtManagementGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListDeploymentsAtManagementGroupResponder handles the response to the ListDeploymentsAtManagementGroup request. The method always -// closes the http.Response Body. -func (client RemediationsClient) ListDeploymentsAtManagementGroupResponder(resp *http.Response) (result RemediationDeploymentsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listDeploymentsAtManagementGroupNextResults retrieves the next set of results, if any. -func (client RemediationsClient) listDeploymentsAtManagementGroupNextResults(ctx context.Context, lastResults RemediationDeploymentsListResult) (result RemediationDeploymentsListResult, err error) { - req, err := lastResults.remediationDeploymentsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listDeploymentsAtManagementGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListDeploymentsAtManagementGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listDeploymentsAtManagementGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListDeploymentsAtManagementGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listDeploymentsAtManagementGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListDeploymentsAtManagementGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client RemediationsClient) ListDeploymentsAtManagementGroupComplete(ctx context.Context, managementGroupID string, remediationName string, top *int32) (result RemediationDeploymentsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListDeploymentsAtManagementGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListDeploymentsAtManagementGroup(ctx, managementGroupID, remediationName, top) - return -} - -// ListDeploymentsAtResource gets all deployments for a remediation at resource scope. -// Parameters: -// resourceID - resource ID. -// remediationName - the name of the remediation. -// top - maximum number of records to return. -func (client RemediationsClient) ListDeploymentsAtResource(ctx context.Context, resourceID string, remediationName string, top *int32) (result RemediationDeploymentsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListDeploymentsAtResource") - defer func() { - sc := -1 - if result.rdlr.Response.Response != nil { - sc = result.rdlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.RemediationsClient", "ListDeploymentsAtResource", err.Error()) - } - - result.fn = client.listDeploymentsAtResourceNextResults - req, err := client.ListDeploymentsAtResourcePreparer(ctx, resourceID, remediationName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListDeploymentsAtResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListDeploymentsAtResourceSender(req) - if err != nil { - result.rdlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListDeploymentsAtResource", resp, "Failure sending request") - return - } - - result.rdlr, err = client.ListDeploymentsAtResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListDeploymentsAtResource", resp, "Failure responding to request") - return - } - if result.rdlr.hasNextLink() && result.rdlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListDeploymentsAtResourcePreparer prepares the ListDeploymentsAtResource request. -func (client RemediationsClient) ListDeploymentsAtResourcePreparer(ctx context.Context, resourceID string, remediationName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "remediationName": autorest.Encode("path", remediationName), - "resourceId": resourceID, - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListDeploymentsAtResourceSender sends the ListDeploymentsAtResource request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) ListDeploymentsAtResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListDeploymentsAtResourceResponder handles the response to the ListDeploymentsAtResource request. The method always -// closes the http.Response Body. -func (client RemediationsClient) ListDeploymentsAtResourceResponder(resp *http.Response) (result RemediationDeploymentsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listDeploymentsAtResourceNextResults retrieves the next set of results, if any. -func (client RemediationsClient) listDeploymentsAtResourceNextResults(ctx context.Context, lastResults RemediationDeploymentsListResult) (result RemediationDeploymentsListResult, err error) { - req, err := lastResults.remediationDeploymentsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listDeploymentsAtResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListDeploymentsAtResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listDeploymentsAtResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListDeploymentsAtResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listDeploymentsAtResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListDeploymentsAtResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client RemediationsClient) ListDeploymentsAtResourceComplete(ctx context.Context, resourceID string, remediationName string, top *int32) (result RemediationDeploymentsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListDeploymentsAtResource") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListDeploymentsAtResource(ctx, resourceID, remediationName, top) - return -} - -// ListDeploymentsAtResourceGroup gets all deployments for a remediation at resource group scope. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// resourceGroupName - resource group name. -// remediationName - the name of the remediation. -// top - maximum number of records to return. -func (client RemediationsClient) ListDeploymentsAtResourceGroup(ctx context.Context, subscriptionID string, resourceGroupName string, remediationName string, top *int32) (result RemediationDeploymentsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListDeploymentsAtResourceGroup") - defer func() { - sc := -1 - if result.rdlr.Response.Response != nil { - sc = result.rdlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.RemediationsClient", "ListDeploymentsAtResourceGroup", err.Error()) - } - - result.fn = client.listDeploymentsAtResourceGroupNextResults - req, err := client.ListDeploymentsAtResourceGroupPreparer(ctx, subscriptionID, resourceGroupName, remediationName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListDeploymentsAtResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListDeploymentsAtResourceGroupSender(req) - if err != nil { - result.rdlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListDeploymentsAtResourceGroup", resp, "Failure sending request") - return - } - - result.rdlr, err = client.ListDeploymentsAtResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListDeploymentsAtResourceGroup", resp, "Failure responding to request") - return - } - if result.rdlr.hasNextLink() && result.rdlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListDeploymentsAtResourceGroupPreparer prepares the ListDeploymentsAtResourceGroup request. -func (client RemediationsClient) ListDeploymentsAtResourceGroupPreparer(ctx context.Context, subscriptionID string, resourceGroupName string, remediationName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "remediationName": autorest.Encode("path", remediationName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListDeploymentsAtResourceGroupSender sends the ListDeploymentsAtResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) ListDeploymentsAtResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListDeploymentsAtResourceGroupResponder handles the response to the ListDeploymentsAtResourceGroup request. The method always -// closes the http.Response Body. -func (client RemediationsClient) ListDeploymentsAtResourceGroupResponder(resp *http.Response) (result RemediationDeploymentsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listDeploymentsAtResourceGroupNextResults retrieves the next set of results, if any. -func (client RemediationsClient) listDeploymentsAtResourceGroupNextResults(ctx context.Context, lastResults RemediationDeploymentsListResult) (result RemediationDeploymentsListResult, err error) { - req, err := lastResults.remediationDeploymentsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listDeploymentsAtResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListDeploymentsAtResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listDeploymentsAtResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListDeploymentsAtResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listDeploymentsAtResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListDeploymentsAtResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client RemediationsClient) ListDeploymentsAtResourceGroupComplete(ctx context.Context, subscriptionID string, resourceGroupName string, remediationName string, top *int32) (result RemediationDeploymentsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListDeploymentsAtResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListDeploymentsAtResourceGroup(ctx, subscriptionID, resourceGroupName, remediationName, top) - return -} - -// ListDeploymentsAtSubscription gets all deployments for a remediation at subscription scope. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// remediationName - the name of the remediation. -// top - maximum number of records to return. -func (client RemediationsClient) ListDeploymentsAtSubscription(ctx context.Context, subscriptionID string, remediationName string, top *int32) (result RemediationDeploymentsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListDeploymentsAtSubscription") - defer func() { - sc := -1 - if result.rdlr.Response.Response != nil { - sc = result.rdlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.RemediationsClient", "ListDeploymentsAtSubscription", err.Error()) - } - - result.fn = client.listDeploymentsAtSubscriptionNextResults - req, err := client.ListDeploymentsAtSubscriptionPreparer(ctx, subscriptionID, remediationName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListDeploymentsAtSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListDeploymentsAtSubscriptionSender(req) - if err != nil { - result.rdlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListDeploymentsAtSubscription", resp, "Failure sending request") - return - } - - result.rdlr, err = client.ListDeploymentsAtSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListDeploymentsAtSubscription", resp, "Failure responding to request") - return - } - if result.rdlr.hasNextLink() && result.rdlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListDeploymentsAtSubscriptionPreparer prepares the ListDeploymentsAtSubscription request. -func (client RemediationsClient) ListDeploymentsAtSubscriptionPreparer(ctx context.Context, subscriptionID string, remediationName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "remediationName": autorest.Encode("path", remediationName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListDeploymentsAtSubscriptionSender sends the ListDeploymentsAtSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) ListDeploymentsAtSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListDeploymentsAtSubscriptionResponder handles the response to the ListDeploymentsAtSubscription request. The method always -// closes the http.Response Body. -func (client RemediationsClient) ListDeploymentsAtSubscriptionResponder(resp *http.Response) (result RemediationDeploymentsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listDeploymentsAtSubscriptionNextResults retrieves the next set of results, if any. -func (client RemediationsClient) listDeploymentsAtSubscriptionNextResults(ctx context.Context, lastResults RemediationDeploymentsListResult) (result RemediationDeploymentsListResult, err error) { - req, err := lastResults.remediationDeploymentsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listDeploymentsAtSubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListDeploymentsAtSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listDeploymentsAtSubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListDeploymentsAtSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listDeploymentsAtSubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListDeploymentsAtSubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client RemediationsClient) ListDeploymentsAtSubscriptionComplete(ctx context.Context, subscriptionID string, remediationName string, top *int32) (result RemediationDeploymentsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListDeploymentsAtSubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListDeploymentsAtSubscription(ctx, subscriptionID, remediationName, top) - return -} - -// ListForManagementGroup gets all remediations for the management group. -// Parameters: -// managementGroupID - management group ID. -// top - maximum number of records to return. -// filter - oData filter expression. -func (client RemediationsClient) ListForManagementGroup(ctx context.Context, managementGroupID string, top *int32, filter string) (result RemediationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListForManagementGroup") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.RemediationsClient", "ListForManagementGroup", err.Error()) - } - - result.fn = client.listForManagementGroupNextResults - req, err := client.ListForManagementGroupPreparer(ctx, managementGroupID, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListForManagementGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListForManagementGroupSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListForManagementGroup", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListForManagementGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListForManagementGroup", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListForManagementGroupPreparer prepares the ListForManagementGroup request. -func (client RemediationsClient) ListForManagementGroupPreparer(ctx context.Context, managementGroupID string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "managementGroupId": autorest.Encode("path", managementGroupID), - "managementGroupsNamespace": autorest.Encode("path", "Microsoft.Management"), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListForManagementGroupSender sends the ListForManagementGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) ListForManagementGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListForManagementGroupResponder handles the response to the ListForManagementGroup request. The method always -// closes the http.Response Body. -func (client RemediationsClient) ListForManagementGroupResponder(resp *http.Response) (result RemediationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listForManagementGroupNextResults retrieves the next set of results, if any. -func (client RemediationsClient) listForManagementGroupNextResults(ctx context.Context, lastResults RemediationListResult) (result RemediationListResult, err error) { - req, err := lastResults.remediationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listForManagementGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListForManagementGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listForManagementGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListForManagementGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listForManagementGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListForManagementGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client RemediationsClient) ListForManagementGroupComplete(ctx context.Context, managementGroupID string, top *int32, filter string) (result RemediationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListForManagementGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListForManagementGroup(ctx, managementGroupID, top, filter) - return -} - -// ListForResource gets all remediations for a resource. -// Parameters: -// resourceID - resource ID. -// top - maximum number of records to return. -// filter - oData filter expression. -func (client RemediationsClient) ListForResource(ctx context.Context, resourceID string, top *int32, filter string) (result RemediationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListForResource") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.RemediationsClient", "ListForResource", err.Error()) - } - - result.fn = client.listForResourceNextResults - req, err := client.ListForResourcePreparer(ctx, resourceID, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListForResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListForResource", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListForResource", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListForResourcePreparer prepares the ListForResource request. -func (client RemediationsClient) ListForResourcePreparer(ctx context.Context, resourceID string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceId": resourceID, - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{resourceId}/providers/Microsoft.PolicyInsights/remediations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListForResourceSender sends the ListForResource request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) ListForResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListForResourceResponder handles the response to the ListForResource request. The method always -// closes the http.Response Body. -func (client RemediationsClient) ListForResourceResponder(resp *http.Response) (result RemediationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listForResourceNextResults retrieves the next set of results, if any. -func (client RemediationsClient) listForResourceNextResults(ctx context.Context, lastResults RemediationListResult) (result RemediationListResult, err error) { - req, err := lastResults.remediationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listForResourceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListForResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listForResourceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListForResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listForResourceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListForResourceComplete enumerates all values, automatically crossing page boundaries as required. -func (client RemediationsClient) ListForResourceComplete(ctx context.Context, resourceID string, top *int32, filter string) (result RemediationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListForResource") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListForResource(ctx, resourceID, top, filter) - return -} - -// ListForResourceGroup gets all remediations for the subscription. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// resourceGroupName - resource group name. -// top - maximum number of records to return. -// filter - oData filter expression. -func (client RemediationsClient) ListForResourceGroup(ctx context.Context, subscriptionID string, resourceGroupName string, top *int32, filter string) (result RemediationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListForResourceGroup") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.RemediationsClient", "ListForResourceGroup", err.Error()) - } - - result.fn = client.listForResourceGroupNextResults - req, err := client.ListForResourceGroupPreparer(ctx, subscriptionID, resourceGroupName, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListForResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListForResourceGroup", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListForResourceGroup", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListForResourceGroupPreparer prepares the ListForResourceGroup request. -func (client RemediationsClient) ListForResourceGroupPreparer(ctx context.Context, subscriptionID string, resourceGroupName string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always -// closes the http.Response Body. -func (client RemediationsClient) ListForResourceGroupResponder(resp *http.Response) (result RemediationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listForResourceGroupNextResults retrieves the next set of results, if any. -func (client RemediationsClient) listForResourceGroupNextResults(ctx context.Context, lastResults RemediationListResult) (result RemediationListResult, err error) { - req, err := lastResults.remediationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listForResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListForResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listForResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListForResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listForResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListForResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client RemediationsClient) ListForResourceGroupComplete(ctx context.Context, subscriptionID string, resourceGroupName string, top *int32, filter string) (result RemediationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListForResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListForResourceGroup(ctx, subscriptionID, resourceGroupName, top, filter) - return -} - -// ListForSubscription gets all remediations for the subscription. -// Parameters: -// subscriptionID - microsoft Azure subscription ID. -// top - maximum number of records to return. -// filter - oData filter expression. -func (client RemediationsClient) ListForSubscription(ctx context.Context, subscriptionID string, top *int32, filter string) (result RemediationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListForSubscription") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil { - return result, validation.NewError("policyinsights.RemediationsClient", "ListForSubscription", err.Error()) - } - - result.fn = client.listForSubscriptionNextResults - req, err := client.ListForSubscriptionPreparer(ctx, subscriptionID, top, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListForSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListForSubscriptionSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListForSubscription", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListForSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "ListForSubscription", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListForSubscriptionPreparer prepares the ListForSubscription request. -func (client RemediationsClient) ListForSubscriptionPreparer(ctx context.Context, subscriptionID string, top *int32, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", subscriptionID), - } - - const APIVersion = "2019-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListForSubscriptionSender sends the ListForSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client RemediationsClient) ListForSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListForSubscriptionResponder handles the response to the ListForSubscription request. The method always -// closes the http.Response Body. -func (client RemediationsClient) ListForSubscriptionResponder(resp *http.Response) (result RemediationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listForSubscriptionNextResults retrieves the next set of results, if any. -func (client RemediationsClient) listForSubscriptionNextResults(ctx context.Context, lastResults RemediationListResult) (result RemediationListResult, err error) { - req, err := lastResults.remediationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listForSubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListForSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listForSubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListForSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "policyinsights.RemediationsClient", "listForSubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListForSubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client RemediationsClient) ListForSubscriptionComplete(ctx context.Context, subscriptionID string, top *int32, filter string) (result RemediationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RemediationsClient.ListForSubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListForSubscription(ctx, subscriptionID, top, filter) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/version.go deleted file mode 100644 index 021d4f90203..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package policyinsights - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " policyinsights/2019-10-01-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/_meta.json deleted file mode 100644 index 68e168c2ffb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", - "readme": "/_/azure-rest-api-specs/specification/portal/resource-manager/readme.md", - "tag": "package-2019-01-01-preview", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2019-01-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/portal/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/client.go deleted file mode 100644 index b38469ac940..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package portal implements the Azure ARM Portal service API version 2019-01-01-preview. -// -// -package portal - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Portal - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Portal. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/dashboards.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/dashboards.go deleted file mode 100644 index 57c3bbc01bb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/dashboards.go +++ /dev/null @@ -1,603 +0,0 @@ -package portal - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DashboardsClient is the client for the Dashboards methods of the Portal service. -type DashboardsClient struct { - BaseClient -} - -// NewDashboardsClient creates an instance of the DashboardsClient client. -func NewDashboardsClient(subscriptionID string) DashboardsClient { - return NewDashboardsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDashboardsClientWithBaseURI creates an instance of the DashboardsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDashboardsClientWithBaseURI(baseURI string, subscriptionID string) DashboardsClient { - return DashboardsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Dashboard. -// Parameters: -// resourceGroupName - the name of the resource group. -// dashboardName - the name of the dashboard. -// dashboard - the parameters required to create or update a dashboard. -func (client DashboardsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, dashboardName string, dashboard Dashboard) (result Dashboard, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DashboardsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: dashboardName, - Constraints: []validation.Constraint{{Target: "dashboardName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "dashboardName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: dashboard, - Constraints: []validation.Constraint{{Target: "dashboard.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("portal.DashboardsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, dashboardName, dashboard) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DashboardsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, dashboardName string, dashboard Dashboard) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dashboardName": autorest.Encode("path", dashboardName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - dashboard.ID = nil - dashboard.Name = nil - dashboard.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", pathParameters), - autorest.WithJSON(dashboard), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DashboardsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DashboardsClient) CreateOrUpdateResponder(resp *http.Response) (result Dashboard, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the Dashboard. -// Parameters: -// resourceGroupName - the name of the resource group. -// dashboardName - the name of the dashboard. -func (client DashboardsClient) Delete(ctx context.Context, resourceGroupName string, dashboardName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DashboardsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: dashboardName, - Constraints: []validation.Constraint{{Target: "dashboardName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "dashboardName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("portal.DashboardsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, dashboardName) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DashboardsClient) DeletePreparer(ctx context.Context, resourceGroupName string, dashboardName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dashboardName": autorest.Encode("path", dashboardName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DashboardsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DashboardsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the Dashboard. -// Parameters: -// resourceGroupName - the name of the resource group. -// dashboardName - the name of the dashboard. -func (client DashboardsClient) Get(ctx context.Context, resourceGroupName string, dashboardName string) (result Dashboard, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DashboardsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: dashboardName, - Constraints: []validation.Constraint{{Target: "dashboardName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "dashboardName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("portal.DashboardsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, dashboardName) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DashboardsClient) GetPreparer(ctx context.Context, resourceGroupName string, dashboardName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dashboardName": autorest.Encode("path", dashboardName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DashboardsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DashboardsClient) GetResponder(resp *http.Response) (result Dashboard, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup gets all the Dashboards within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. -func (client DashboardsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DashboardListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DashboardsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client DashboardsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client DashboardsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client DashboardsClient) ListByResourceGroupResponder(resp *http.Response) (result DashboardListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client DashboardsClient) listByResourceGroupNextResults(ctx context.Context, lastResults DashboardListResult) (result DashboardListResult, err error) { - req, err := lastResults.dashboardListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "portal.DashboardsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "portal.DashboardsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client DashboardsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DashboardListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DashboardsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySubscription gets all the dashboards within a subscription. -func (client DashboardsClient) ListBySubscription(ctx context.Context) (result DashboardListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DashboardsClient.ListBySubscription") - defer func() { - sc := -1 - if result.dlr.Response.Response != nil { - sc = result.dlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.dlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.dlr, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.dlr.hasNextLink() && result.dlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client DashboardsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Portal/dashboards", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client DashboardsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client DashboardsClient) ListBySubscriptionResponder(resp *http.Response) (result DashboardListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client DashboardsClient) listBySubscriptionNextResults(ctx context.Context, lastResults DashboardListResult) (result DashboardListResult, err error) { - req, err := lastResults.dashboardListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "portal.DashboardsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "portal.DashboardsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client DashboardsClient) ListBySubscriptionComplete(ctx context.Context) (result DashboardListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DashboardsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// Update updates an existing Dashboard. -// Parameters: -// resourceGroupName - the name of the resource group. -// dashboardName - the name of the dashboard. -// dashboard - the updatable fields of a Dashboard. -func (client DashboardsClient) Update(ctx context.Context, resourceGroupName string, dashboardName string, dashboard PatchableDashboard) (result Dashboard, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DashboardsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: dashboardName, - Constraints: []validation.Constraint{{Target: "dashboardName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "dashboardName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("portal.DashboardsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, dashboardName, dashboard) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.DashboardsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DashboardsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, dashboardName string, dashboard PatchableDashboard) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "dashboardName": autorest.Encode("path", dashboardName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards/{dashboardName}", pathParameters), - autorest.WithJSON(dashboard), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DashboardsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client DashboardsClient) UpdateResponder(resp *http.Response) (result Dashboard, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/models.go deleted file mode 100644 index 3aea1c0ca90..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/models.go +++ /dev/null @@ -1,801 +0,0 @@ -package portal - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal" - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Configuration tenant configuration. -type Configuration struct { - autorest.Response `json:"-"` - // ConfigurationProperties - Tenant configuration properties. - *ConfigurationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Configuration. -func (c Configuration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.ConfigurationProperties != nil { - objectMap["properties"] = c.ConfigurationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Configuration struct. -func (c *Configuration) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var configurationProperties ConfigurationProperties - err = json.Unmarshal(*v, &configurationProperties) - if err != nil { - return err - } - c.ConfigurationProperties = &configurationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - c.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - c.Type = &typeVar - } - } - } - - return nil -} - -// ConfigurationList list of tenant configurations. -type ConfigurationList struct { - autorest.Response `json:"-"` - // Value - The array of tenant configurations. - Value *[]Configuration `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ConfigurationProperties tenant configuration properties. -type ConfigurationProperties struct { - // EnforcePrivateMarkdownStorage - When flag is set to true Markdown tile will require external storage configuration (URI). The inline content configuration will be prohibited. - EnforcePrivateMarkdownStorage *bool `json:"enforcePrivateMarkdownStorage,omitempty"` -} - -// Dashboard the shared dashboard resource definition. -type Dashboard struct { - autorest.Response `json:"-"` - // DashboardProperties - The shared dashboard properties. - *DashboardProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Dashboard. -func (d Dashboard) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if d.DashboardProperties != nil { - objectMap["properties"] = d.DashboardProperties - } - if d.Location != nil { - objectMap["location"] = d.Location - } - if d.Tags != nil { - objectMap["tags"] = d.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Dashboard struct. -func (d *Dashboard) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var dashboardProperties DashboardProperties - err = json.Unmarshal(*v, &dashboardProperties) - if err != nil { - return err - } - d.DashboardProperties = &dashboardProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - d.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - d.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - d.Tags = tags - } - } - } - - return nil -} - -// DashboardLens a dashboard lens. -type DashboardLens struct { - // Order - The lens order. - Order *int32 `json:"order,omitempty"` - // Parts - The dashboard parts. - Parts map[string]*DashboardParts `json:"parts"` - // Metadata - The dashboard len's metadata. - Metadata map[string]interface{} `json:"metadata"` -} - -// MarshalJSON is the custom marshaler for DashboardLens. -func (dl DashboardLens) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dl.Order != nil { - objectMap["order"] = dl.Order - } - if dl.Parts != nil { - objectMap["parts"] = dl.Parts - } - if dl.Metadata != nil { - objectMap["metadata"] = dl.Metadata - } - return json.Marshal(objectMap) -} - -// DashboardListResult list of dashboards. -type DashboardListResult struct { - autorest.Response `json:"-"` - // Value - The array of custom resource provider manifests. - Value *[]Dashboard `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// DashboardListResultIterator provides access to a complete listing of Dashboard values. -type DashboardListResultIterator struct { - i int - page DashboardListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DashboardListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DashboardListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DashboardListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DashboardListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DashboardListResultIterator) Response() DashboardListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DashboardListResultIterator) Value() Dashboard { - if !iter.page.NotDone() { - return Dashboard{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DashboardListResultIterator type. -func NewDashboardListResultIterator(page DashboardListResultPage) DashboardListResultIterator { - return DashboardListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dlr DashboardListResult) IsEmpty() bool { - return dlr.Value == nil || len(*dlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dlr DashboardListResult) hasNextLink() bool { - return dlr.NextLink != nil && len(*dlr.NextLink) != 0 -} - -// dashboardListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dlr DashboardListResult) dashboardListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dlr.NextLink))) -} - -// DashboardListResultPage contains a page of Dashboard values. -type DashboardListResultPage struct { - fn func(context.Context, DashboardListResult) (DashboardListResult, error) - dlr DashboardListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DashboardListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DashboardListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dlr) - if err != nil { - return err - } - page.dlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DashboardListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DashboardListResultPage) NotDone() bool { - return !page.dlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DashboardListResultPage) Response() DashboardListResult { - return page.dlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DashboardListResultPage) Values() []Dashboard { - if page.dlr.IsEmpty() { - return nil - } - return *page.dlr.Value -} - -// Creates a new instance of the DashboardListResultPage type. -func NewDashboardListResultPage(cur DashboardListResult, getNextPage func(context.Context, DashboardListResult) (DashboardListResult, error)) DashboardListResultPage { - return DashboardListResultPage{ - fn: getNextPage, - dlr: cur, - } -} - -// DashboardParts a dashboard part. -type DashboardParts struct { - // Position - The dashboard's part position. - Position *DashboardPartsPosition `json:"position,omitempty"` - // Metadata - The dashboard part's metadata. - Metadata map[string]interface{} `json:"metadata"` -} - -// MarshalJSON is the custom marshaler for DashboardParts. -func (dp DashboardParts) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.Position != nil { - objectMap["position"] = dp.Position - } - if dp.Metadata != nil { - objectMap["metadata"] = dp.Metadata - } - return json.Marshal(objectMap) -} - -// DashboardPartsPosition the dashboard's part position. -type DashboardPartsPosition struct { - // X - The dashboard's part x coordinate. - X *int32 `json:"x,omitempty"` - // Y - The dashboard's part y coordinate. - Y *int32 `json:"y,omitempty"` - // RowSpan - The dashboard's part row span. - RowSpan *int32 `json:"rowSpan,omitempty"` - // ColSpan - The dashboard's part column span. - ColSpan *int32 `json:"colSpan,omitempty"` - // Metadata - The dashboard part's metadata. - Metadata map[string]interface{} `json:"metadata"` -} - -// MarshalJSON is the custom marshaler for DashboardPartsPosition. -func (dp DashboardPartsPosition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.X != nil { - objectMap["x"] = dp.X - } - if dp.Y != nil { - objectMap["y"] = dp.Y - } - if dp.RowSpan != nil { - objectMap["rowSpan"] = dp.RowSpan - } - if dp.ColSpan != nil { - objectMap["colSpan"] = dp.ColSpan - } - if dp.Metadata != nil { - objectMap["metadata"] = dp.Metadata - } - return json.Marshal(objectMap) -} - -// DashboardProperties the shared dashboard properties. -type DashboardProperties struct { - // Lenses - The dashboard lenses. - Lenses map[string]*DashboardLens `json:"lenses"` - // Metadata - The dashboard metadata. - Metadata map[string]interface{} `json:"metadata"` -} - -// MarshalJSON is the custom marshaler for DashboardProperties. -func (dp DashboardProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.Lenses != nil { - objectMap["lenses"] = dp.Lenses - } - if dp.Metadata != nil { - objectMap["metadata"] = dp.Metadata - } - return json.Marshal(objectMap) -} - -// ErrorDefinition error definition. -type ErrorDefinition struct { - // Code - READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. - Code *int32 `json:"code,omitempty"` - // Message - READ-ONLY; Description of the error. - Message *string `json:"message,omitempty"` - // Details - READ-ONLY; Internal error details. - Details *[]ErrorDefinition `json:"details,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorDefinition. -func (ed ErrorDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse error response. -type ErrorResponse struct { - // Error - The error details. - Error *ErrorDefinition `json:"error,omitempty"` -} - -// PatchableDashboard the shared dashboard resource definition. -type PatchableDashboard struct { - // DashboardProperties - The shared dashboard properties. - *DashboardProperties `json:"properties,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PatchableDashboard. -func (pd PatchableDashboard) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pd.DashboardProperties != nil { - objectMap["properties"] = pd.DashboardProperties - } - if pd.Tags != nil { - objectMap["tags"] = pd.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PatchableDashboard struct. -func (pd *PatchableDashboard) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var dashboardProperties DashboardProperties - err = json.Unmarshal(*v, &dashboardProperties) - if err != nil { - return err - } - pd.DashboardProperties = &dashboardProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - pd.Tags = tags - } - } - } - - return nil -} - -// ProxyResource the resource model definition for an Azure Resource Manager proxy resource. It will have -// everything other than required location and tags -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceProviderOperation supported operations of this resource provider. -type ResourceProviderOperation struct { - // Name - Operation name, in format of {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // IsDataAction - Indicates whether the operation applies to data-plane. - IsDataAction *string `json:"isDataAction,omitempty"` - // Display - Display metadata associated with the operation. - Display *ResourceProviderOperationDisplay `json:"display,omitempty"` -} - -// ResourceProviderOperationDisplay display metadata associated with the operation. -type ResourceProviderOperationDisplay struct { - // Provider - Resource provider: Microsoft Custom Providers. - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed. - Resource *string `json:"resource,omitempty"` - // Operation - Type of operation: get, read, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - Description of this operation. - Description *string `json:"description,omitempty"` -} - -// ResourceProviderOperationList results of the request to list operations. -type ResourceProviderOperationList struct { - autorest.Response `json:"-"` - // Value - List of operations supported by this resource provider. - Value *[]ResourceProviderOperation `json:"value,omitempty"` - // NextLink - The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ResourceProviderOperationListIterator provides access to a complete listing of ResourceProviderOperation -// values. -type ResourceProviderOperationListIterator struct { - i int - page ResourceProviderOperationListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ResourceProviderOperationListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ResourceProviderOperationListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ResourceProviderOperationListIterator) Response() ResourceProviderOperationList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ResourceProviderOperationListIterator) Value() ResourceProviderOperation { - if !iter.page.NotDone() { - return ResourceProviderOperation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ResourceProviderOperationListIterator type. -func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator { - return ResourceProviderOperationListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rpol ResourceProviderOperationList) IsEmpty() bool { - return rpol.Value == nil || len(*rpol.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rpol ResourceProviderOperationList) hasNextLink() bool { - return rpol.NextLink != nil && len(*rpol.NextLink) != 0 -} - -// resourceProviderOperationListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) { - if !rpol.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rpol.NextLink))) -} - -// ResourceProviderOperationListPage contains a page of ResourceProviderOperation values. -type ResourceProviderOperationListPage struct { - fn func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error) - rpol ResourceProviderOperationList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rpol) - if err != nil { - return err - } - page.rpol = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ResourceProviderOperationListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ResourceProviderOperationListPage) NotDone() bool { - return !page.rpol.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList { - return page.rpol -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation { - if page.rpol.IsEmpty() { - return nil - } - return *page.rpol.Value -} - -// Creates a new instance of the ResourceProviderOperationListPage type. -func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage { - return ResourceProviderOperationListPage{ - fn: getNextPage, - rpol: cur, - } -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/operations.go deleted file mode 100644 index 4dea94ef0a3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package portal - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the client for the Operations methods of the Portal service. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List the Microsoft Portal operations API. -func (client OperationsClient) List(ctx context.Context) (result ResourceProviderOperationListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.rpol.Response.Response != nil { - sc = result.rpol.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.rpol.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "portal.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.rpol, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.rpol.hasNextLink() && result.rpol.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2019-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Portal/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result ResourceProviderOperationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults ResourceProviderOperationList) (result ResourceProviderOperationList, err error) { - req, err := lastResults.resourceProviderOperationListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "portal.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "portal.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result ResourceProviderOperationListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/tenantconfigurations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/tenantconfigurations.go deleted file mode 100644 index 5a0aad7a5ce..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/tenantconfigurations.go +++ /dev/null @@ -1,316 +0,0 @@ -package portal - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// TenantConfigurationsClient is the client for the TenantConfigurations methods of the Portal service. -type TenantConfigurationsClient struct { - BaseClient -} - -// NewTenantConfigurationsClient creates an instance of the TenantConfigurationsClient client. -func NewTenantConfigurationsClient(subscriptionID string) TenantConfigurationsClient { - return NewTenantConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTenantConfigurationsClientWithBaseURI creates an instance of the TenantConfigurationsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewTenantConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) TenantConfigurationsClient { - return TenantConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create the tenant configuration. If configuration already exists - update it. User has to be a Tenant Admin -// for this operation. -// Parameters: -// tenantConfiguration - the parameters required to create or update tenant configuration. -func (client TenantConfigurationsClient) Create(ctx context.Context, tenantConfiguration Configuration) (result Configuration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationsClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreatePreparer(ctx, tenantConfiguration) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.TenantConfigurationsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "portal.TenantConfigurationsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.TenantConfigurationsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client TenantConfigurationsClient) CreatePreparer(ctx context.Context, tenantConfiguration Configuration) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", "default"), - } - - const APIVersion = "2019-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Portal/tenantConfigurations/{configurationName}", pathParameters), - autorest.WithJSON(tenantConfiguration), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client TenantConfigurationsClient) CreateResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the tenant configuration. User has to be a Tenant Admin for this operation. -func (client TenantConfigurationsClient) Delete(ctx context.Context) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.TenantConfigurationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "portal.TenantConfigurationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.TenantConfigurationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TenantConfigurationsClient) DeletePreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", "default"), - } - - const APIVersion = "2019-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Portal/tenantConfigurations/{configurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client TenantConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the tenant configuration. -func (client TenantConfigurationsClient) Get(ctx context.Context) (result Configuration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.TenantConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "portal.TenantConfigurationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.TenantConfigurationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TenantConfigurationsClient) GetPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configurationName": autorest.Encode("path", "default"), - } - - const APIVersion = "2019-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Portal/tenantConfigurations/{configurationName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TenantConfigurationsClient) GetResponder(resp *http.Response) (result Configuration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets list of the tenant configurations. -func (client TenantConfigurationsClient) List(ctx context.Context) (result ConfigurationList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TenantConfigurationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.TenantConfigurationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "portal.TenantConfigurationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "portal.TenantConfigurationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client TenantConfigurationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2019-01-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Portal/tenantConfigurations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client TenantConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client TenantConfigurationsClient) ListResponder(resp *http.Response) (result ConfigurationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/version.go deleted file mode 100644 index 28798e95de4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package portal - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " portal/2019-01-01-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/_meta.json deleted file mode 100644 index 48dcf3c45aa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "af463c3f9502d353b8a009685177f13335adb8cd", - "readme": "/_/azure-rest-api-specs/specification/servicebus/resource-manager/readme.md", - "tag": "package-2021-06-preview", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-06-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/servicebus/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/client.go deleted file mode 100644 index 149da60ad47..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package servicebus implements the Azure ARM Servicebus service API version 2021-06-01-preview. -// -// -package servicebus - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Servicebus - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Servicebus. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/disasterrecoveryconfigs.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/disasterrecoveryconfigs.go deleted file mode 100644 index e9857e1e57f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/disasterrecoveryconfigs.go +++ /dev/null @@ -1,1040 +0,0 @@ -package servicebus - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// DisasterRecoveryConfigsClient is the client for the DisasterRecoveryConfigs methods of the Servicebus service. -type DisasterRecoveryConfigsClient struct { - BaseClient -} - -// NewDisasterRecoveryConfigsClient creates an instance of the DisasterRecoveryConfigsClient client. -func NewDisasterRecoveryConfigsClient(subscriptionID string) DisasterRecoveryConfigsClient { - return NewDisasterRecoveryConfigsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDisasterRecoveryConfigsClientWithBaseURI creates an instance of the DisasterRecoveryConfigsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewDisasterRecoveryConfigsClientWithBaseURI(baseURI string, subscriptionID string) DisasterRecoveryConfigsClient { - return DisasterRecoveryConfigsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// BreakPairing this operation disables the Disaster Recovery and stops replicating changes from primary to secondary -// namespaces -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// alias - the Disaster Recovery configuration name -func (client DisasterRecoveryConfigsClient) BreakPairing(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.BreakPairing") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: alias, - Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "BreakPairing", err.Error()) - } - - req, err := client.BreakPairingPreparer(ctx, resourceGroupName, namespaceName, alias) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "BreakPairing", nil, "Failure preparing request") - return - } - - resp, err := client.BreakPairingSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "BreakPairing", resp, "Failure sending request") - return - } - - result, err = client.BreakPairingResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "BreakPairing", resp, "Failure responding to request") - return - } - - return -} - -// BreakPairingPreparer prepares the BreakPairing request. -func (client DisasterRecoveryConfigsClient) BreakPairingPreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "alias": autorest.Encode("path", alias), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/breakPairing", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// BreakPairingSender sends the BreakPairing request. The method will close the -// http.Response Body if it receives an error. -func (client DisasterRecoveryConfigsClient) BreakPairingSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// BreakPairingResponder handles the response to the BreakPairing request. The method always -// closes the http.Response Body. -func (client DisasterRecoveryConfigsClient) BreakPairingResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// CheckNameAvailabilityMethod check the give namespace name availability. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// parameters - parameters to check availability of the given namespace name -func (client DisasterRecoveryConfigsClient) CheckNameAvailabilityMethod(ctx context.Context, resourceGroupName string, namespaceName string, parameters CheckNameAvailability) (result CheckNameAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.CheckNameAvailabilityMethod") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "CheckNameAvailabilityMethod", err.Error()) - } - - req, err := client.CheckNameAvailabilityMethodPreparer(ctx, resourceGroupName, namespaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "CheckNameAvailabilityMethod", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilityMethodSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "CheckNameAvailabilityMethod", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityMethodResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "CheckNameAvailabilityMethod", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityMethodPreparer prepares the CheckNameAvailabilityMethod request. -func (client DisasterRecoveryConfigsClient) CheckNameAvailabilityMethodPreparer(ctx context.Context, resourceGroupName string, namespaceName string, parameters CheckNameAvailability) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/CheckNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilityMethodSender sends the CheckNameAvailabilityMethod request. The method will close the -// http.Response Body if it receives an error. -func (client DisasterRecoveryConfigsClient) CheckNameAvailabilityMethodSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityMethodResponder handles the response to the CheckNameAvailabilityMethod request. The method always -// closes the http.Response Body. -func (client DisasterRecoveryConfigsClient) CheckNameAvailabilityMethodResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a new Alias(Disaster Recovery configuration) -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// alias - the Disaster Recovery configuration name -// parameters - parameters required to create an Alias(Disaster Recovery configuration) -func (client DisasterRecoveryConfigsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, alias string, parameters ArmDisasterRecovery) (result ArmDisasterRecovery, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: alias, - Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, alias, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DisasterRecoveryConfigsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string, parameters ArmDisasterRecovery) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "alias": autorest.Encode("path", alias), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client DisasterRecoveryConfigsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DisasterRecoveryConfigsClient) CreateOrUpdateResponder(resp *http.Response) (result ArmDisasterRecovery, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an Alias(Disaster Recovery configuration) -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// alias - the Disaster Recovery configuration name -func (client DisasterRecoveryConfigsClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: alias, - Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, alias) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DisasterRecoveryConfigsClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "alias": autorest.Encode("path", alias), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client DisasterRecoveryConfigsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DisasterRecoveryConfigsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// FailOver invokes GEO DR failover and reconfigure the alias to point to the secondary namespace -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// alias - the Disaster Recovery configuration name -// parameters - parameters required to create an Alias(Disaster Recovery configuration) -func (client DisasterRecoveryConfigsClient) FailOver(ctx context.Context, resourceGroupName string, namespaceName string, alias string, parameters *FailoverProperties) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.FailOver") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: alias, - Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "FailOver", err.Error()) - } - - req, err := client.FailOverPreparer(ctx, resourceGroupName, namespaceName, alias, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "FailOver", nil, "Failure preparing request") - return - } - - resp, err := client.FailOverSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "FailOver", resp, "Failure sending request") - return - } - - result, err = client.FailOverResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "FailOver", resp, "Failure responding to request") - return - } - - return -} - -// FailOverPreparer prepares the FailOver request. -func (client DisasterRecoveryConfigsClient) FailOverPreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string, parameters *FailoverProperties) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "alias": autorest.Encode("path", alias), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/failover", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if parameters != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(parameters)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailOverSender sends the FailOver request. The method will close the -// http.Response Body if it receives an error. -func (client DisasterRecoveryConfigsClient) FailOverSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// FailOverResponder handles the response to the FailOver request. The method always -// closes the http.Response Body. -func (client DisasterRecoveryConfigsClient) FailOverResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// alias - the Disaster Recovery configuration name -func (client DisasterRecoveryConfigsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result ArmDisasterRecovery, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: alias, - Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, alias) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DisasterRecoveryConfigsClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "alias": autorest.Encode("path", alias), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DisasterRecoveryConfigsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DisasterRecoveryConfigsClient) GetResponder(resp *http.Response) (result ArmDisasterRecovery, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule gets an authorization rule for a namespace by rule name. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// alias - the Disaster Recovery configuration name -// authorizationRuleName - the authorization rule name. -func (client DisasterRecoveryConfigsClient) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, alias string, authorizationRuleName string) (result SBAuthorizationRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.GetAuthorizationRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: alias, - Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "GetAuthorizationRule", err.Error()) - } - - req, err := client.GetAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, alias, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "GetAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client DisasterRecoveryConfigsClient) GetAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "alias": autorest.Encode("path", alias), - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client DisasterRecoveryConfigsClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client DisasterRecoveryConfigsClient) GetAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all Alias(Disaster Recovery configurations) -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -func (client DisasterRecoveryConfigsClient) List(ctx context.Context, resourceGroupName string, namespaceName string) (result ArmDisasterRecoveryListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.List") - defer func() { - sc := -1 - if result.adrlr.Response.Response != nil { - sc = result.adrlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.adrlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "List", resp, "Failure sending request") - return - } - - result.adrlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "List", resp, "Failure responding to request") - return - } - if result.adrlr.hasNextLink() && result.adrlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client DisasterRecoveryConfigsClient) ListPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client DisasterRecoveryConfigsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client DisasterRecoveryConfigsClient) ListResponder(resp *http.Response) (result ArmDisasterRecoveryListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client DisasterRecoveryConfigsClient) listNextResults(ctx context.Context, lastResults ArmDisasterRecoveryListResult) (result ArmDisasterRecoveryListResult, err error) { - req, err := lastResults.armDisasterRecoveryListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client DisasterRecoveryConfigsClient) ListComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result ArmDisasterRecoveryListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, namespaceName) - return -} - -// ListAuthorizationRules gets the authorization rules for a namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// alias - the Disaster Recovery configuration name -func (client DisasterRecoveryConfigsClient) ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result SBAuthorizationRuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.ListAuthorizationRules") - defer func() { - sc := -1 - if result.sarlr.Response.Response != nil { - sc = result.sarlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: alias, - Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "ListAuthorizationRules", err.Error()) - } - - result.fn = client.listAuthorizationRulesNextResults - req, err := client.ListAuthorizationRulesPreparer(ctx, resourceGroupName, namespaceName, alias) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.sarlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result.sarlr, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "ListAuthorizationRules", resp, "Failure responding to request") - return - } - if result.sarlr.hasNextLink() && result.sarlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client DisasterRecoveryConfigsClient) ListAuthorizationRulesPreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "alias": autorest.Encode("path", alias), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client DisasterRecoveryConfigsClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client DisasterRecoveryConfigsClient) ListAuthorizationRulesResponder(resp *http.Response) (result SBAuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client DisasterRecoveryConfigsClient) listAuthorizationRulesNextResults(ctx context.Context, lastResults SBAuthorizationRuleListResult) (result SBAuthorizationRuleListResult, err error) { - req, err := lastResults.sBAuthorizationRuleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "listAuthorizationRulesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "listAuthorizationRulesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "listAuthorizationRulesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAuthorizationRulesComplete enumerates all values, automatically crossing page boundaries as required. -func (client DisasterRecoveryConfigsClient) ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string, alias string) (result SBAuthorizationRuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.ListAuthorizationRules") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAuthorizationRules(ctx, resourceGroupName, namespaceName, alias) - return -} - -// ListKeys gets the primary and secondary connection strings for the namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// alias - the Disaster Recovery configuration name -// authorizationRuleName - the authorization rule name. -func (client DisasterRecoveryConfigsClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, alias string, authorizationRuleName string) (result AccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DisasterRecoveryConfigsClient.ListKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: alias, - Constraints: []validation.Constraint{{Target: "alias", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "alias", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.DisasterRecoveryConfigsClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, namespaceName, alias, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.DisasterRecoveryConfigsClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client DisasterRecoveryConfigsClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, alias string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "alias": autorest.Encode("path", alias), - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/disasterRecoveryConfigs/{alias}/authorizationRules/{authorizationRuleName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client DisasterRecoveryConfigsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client DisasterRecoveryConfigsClient) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/enums.go deleted file mode 100644 index 52ad60d6ba5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/enums.go +++ /dev/null @@ -1,310 +0,0 @@ -package servicebus - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AccessRights enumerates the values for access rights. -type AccessRights string - -const ( - // AccessRightsListen ... - AccessRightsListen AccessRights = "Listen" - // AccessRightsManage ... - AccessRightsManage AccessRights = "Manage" - // AccessRightsSend ... - AccessRightsSend AccessRights = "Send" -) - -// PossibleAccessRightsValues returns an array of possible values for the AccessRights const type. -func PossibleAccessRightsValues() []AccessRights { - return []AccessRights{AccessRightsListen, AccessRightsManage, AccessRightsSend} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// DefaultAction enumerates the values for default action. -type DefaultAction string - -const ( - // DefaultActionAllow ... - DefaultActionAllow DefaultAction = "Allow" - // DefaultActionDeny ... - DefaultActionDeny DefaultAction = "Deny" -) - -// PossibleDefaultActionValues returns an array of possible values for the DefaultAction const type. -func PossibleDefaultActionValues() []DefaultAction { - return []DefaultAction{DefaultActionAllow, DefaultActionDeny} -} - -// EndPointProvisioningState enumerates the values for end point provisioning state. -type EndPointProvisioningState string - -const ( - // EndPointProvisioningStateCanceled ... - EndPointProvisioningStateCanceled EndPointProvisioningState = "Canceled" - // EndPointProvisioningStateCreating ... - EndPointProvisioningStateCreating EndPointProvisioningState = "Creating" - // EndPointProvisioningStateDeleting ... - EndPointProvisioningStateDeleting EndPointProvisioningState = "Deleting" - // EndPointProvisioningStateFailed ... - EndPointProvisioningStateFailed EndPointProvisioningState = "Failed" - // EndPointProvisioningStateSucceeded ... - EndPointProvisioningStateSucceeded EndPointProvisioningState = "Succeeded" - // EndPointProvisioningStateUpdating ... - EndPointProvisioningStateUpdating EndPointProvisioningState = "Updating" -) - -// PossibleEndPointProvisioningStateValues returns an array of possible values for the EndPointProvisioningState const type. -func PossibleEndPointProvisioningStateValues() []EndPointProvisioningState { - return []EndPointProvisioningState{EndPointProvisioningStateCanceled, EndPointProvisioningStateCreating, EndPointProvisioningStateDeleting, EndPointProvisioningStateFailed, EndPointProvisioningStateSucceeded, EndPointProvisioningStateUpdating} -} - -// EntityStatus enumerates the values for entity status. -type EntityStatus string - -const ( - // EntityStatusActive ... - EntityStatusActive EntityStatus = "Active" - // EntityStatusCreating ... - EntityStatusCreating EntityStatus = "Creating" - // EntityStatusDeleting ... - EntityStatusDeleting EntityStatus = "Deleting" - // EntityStatusDisabled ... - EntityStatusDisabled EntityStatus = "Disabled" - // EntityStatusReceiveDisabled ... - EntityStatusReceiveDisabled EntityStatus = "ReceiveDisabled" - // EntityStatusRenaming ... - EntityStatusRenaming EntityStatus = "Renaming" - // EntityStatusRestoring ... - EntityStatusRestoring EntityStatus = "Restoring" - // EntityStatusSendDisabled ... - EntityStatusSendDisabled EntityStatus = "SendDisabled" - // EntityStatusUnknown ... - EntityStatusUnknown EntityStatus = "Unknown" -) - -// PossibleEntityStatusValues returns an array of possible values for the EntityStatus const type. -func PossibleEntityStatusValues() []EntityStatus { - return []EntityStatus{EntityStatusActive, EntityStatusCreating, EntityStatusDeleting, EntityStatusDisabled, EntityStatusReceiveDisabled, EntityStatusRenaming, EntityStatusRestoring, EntityStatusSendDisabled, EntityStatusUnknown} -} - -// FilterType enumerates the values for filter type. -type FilterType string - -const ( - // FilterTypeCorrelationFilter ... - FilterTypeCorrelationFilter FilterType = "CorrelationFilter" - // FilterTypeSQLFilter ... - FilterTypeSQLFilter FilterType = "SqlFilter" -) - -// PossibleFilterTypeValues returns an array of possible values for the FilterType const type. -func PossibleFilterTypeValues() []FilterType { - return []FilterType{FilterTypeCorrelationFilter, FilterTypeSQLFilter} -} - -// KeySource enumerates the values for key source. -type KeySource string - -const ( - // KeySourceMicrosoftKeyVault ... - KeySourceMicrosoftKeyVault KeySource = "Microsoft.KeyVault" -) - -// PossibleKeySourceValues returns an array of possible values for the KeySource const type. -func PossibleKeySourceValues() []KeySource { - return []KeySource{KeySourceMicrosoftKeyVault} -} - -// KeyType enumerates the values for key type. -type KeyType string - -const ( - // KeyTypePrimaryKey ... - KeyTypePrimaryKey KeyType = "PrimaryKey" - // KeyTypeSecondaryKey ... - KeyTypeSecondaryKey KeyType = "SecondaryKey" -) - -// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. -func PossibleKeyTypeValues() []KeyType { - return []KeyType{KeyTypePrimaryKey, KeyTypeSecondaryKey} -} - -// ManagedServiceIdentityType enumerates the values for managed service identity type. -type ManagedServiceIdentityType string - -const ( - // ManagedServiceIdentityTypeNone ... - ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - // ManagedServiceIdentityTypeSystemAssigned ... - ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" - // ManagedServiceIdentityTypeSystemAssignedUserAssigned ... - ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned, UserAssigned" - // ManagedServiceIdentityTypeUserAssigned ... - ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" -) - -// PossibleManagedServiceIdentityTypeValues returns an array of possible values for the ManagedServiceIdentityType const type. -func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { - return []ManagedServiceIdentityType{ManagedServiceIdentityTypeNone, ManagedServiceIdentityTypeSystemAssigned, ManagedServiceIdentityTypeSystemAssignedUserAssigned, ManagedServiceIdentityTypeUserAssigned} -} - -// NetworkRuleIPAction enumerates the values for network rule ip action. -type NetworkRuleIPAction string - -const ( - // NetworkRuleIPActionAllow ... - NetworkRuleIPActionAllow NetworkRuleIPAction = "Allow" -) - -// PossibleNetworkRuleIPActionValues returns an array of possible values for the NetworkRuleIPAction const type. -func PossibleNetworkRuleIPActionValues() []NetworkRuleIPAction { - return []NetworkRuleIPAction{NetworkRuleIPActionAllow} -} - -// PrivateLinkConnectionStatus enumerates the values for private link connection status. -type PrivateLinkConnectionStatus string - -const ( - // PrivateLinkConnectionStatusApproved ... - PrivateLinkConnectionStatusApproved PrivateLinkConnectionStatus = "Approved" - // PrivateLinkConnectionStatusDisconnected ... - PrivateLinkConnectionStatusDisconnected PrivateLinkConnectionStatus = "Disconnected" - // PrivateLinkConnectionStatusPending ... - PrivateLinkConnectionStatusPending PrivateLinkConnectionStatus = "Pending" - // PrivateLinkConnectionStatusRejected ... - PrivateLinkConnectionStatusRejected PrivateLinkConnectionStatus = "Rejected" -) - -// PossiblePrivateLinkConnectionStatusValues returns an array of possible values for the PrivateLinkConnectionStatus const type. -func PossiblePrivateLinkConnectionStatusValues() []PrivateLinkConnectionStatus { - return []PrivateLinkConnectionStatus{PrivateLinkConnectionStatusApproved, PrivateLinkConnectionStatusDisconnected, PrivateLinkConnectionStatusPending, PrivateLinkConnectionStatusRejected} -} - -// ProvisioningStateDR enumerates the values for provisioning state dr. -type ProvisioningStateDR string - -const ( - // ProvisioningStateDRAccepted ... - ProvisioningStateDRAccepted ProvisioningStateDR = "Accepted" - // ProvisioningStateDRFailed ... - ProvisioningStateDRFailed ProvisioningStateDR = "Failed" - // ProvisioningStateDRSucceeded ... - ProvisioningStateDRSucceeded ProvisioningStateDR = "Succeeded" -) - -// PossibleProvisioningStateDRValues returns an array of possible values for the ProvisioningStateDR const type. -func PossibleProvisioningStateDRValues() []ProvisioningStateDR { - return []ProvisioningStateDR{ProvisioningStateDRAccepted, ProvisioningStateDRFailed, ProvisioningStateDRSucceeded} -} - -// PublicNetworkAccessFlag enumerates the values for public network access flag. -type PublicNetworkAccessFlag string - -const ( - // PublicNetworkAccessFlagDisabled ... - PublicNetworkAccessFlagDisabled PublicNetworkAccessFlag = "Disabled" - // PublicNetworkAccessFlagEnabled ... - PublicNetworkAccessFlagEnabled PublicNetworkAccessFlag = "Enabled" -) - -// PossiblePublicNetworkAccessFlagValues returns an array of possible values for the PublicNetworkAccessFlag const type. -func PossiblePublicNetworkAccessFlagValues() []PublicNetworkAccessFlag { - return []PublicNetworkAccessFlag{PublicNetworkAccessFlagDisabled, PublicNetworkAccessFlagEnabled} -} - -// RoleDisasterRecovery enumerates the values for role disaster recovery. -type RoleDisasterRecovery string - -const ( - // RoleDisasterRecoveryPrimary ... - RoleDisasterRecoveryPrimary RoleDisasterRecovery = "Primary" - // RoleDisasterRecoveryPrimaryNotReplicating ... - RoleDisasterRecoveryPrimaryNotReplicating RoleDisasterRecovery = "PrimaryNotReplicating" - // RoleDisasterRecoverySecondary ... - RoleDisasterRecoverySecondary RoleDisasterRecovery = "Secondary" -) - -// PossibleRoleDisasterRecoveryValues returns an array of possible values for the RoleDisasterRecovery const type. -func PossibleRoleDisasterRecoveryValues() []RoleDisasterRecovery { - return []RoleDisasterRecovery{RoleDisasterRecoveryPrimary, RoleDisasterRecoveryPrimaryNotReplicating, RoleDisasterRecoverySecondary} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // SkuNameBasic ... - SkuNameBasic SkuName = "Basic" - // SkuNamePremium ... - SkuNamePremium SkuName = "Premium" - // SkuNameStandard ... - SkuNameStandard SkuName = "Standard" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{SkuNameBasic, SkuNamePremium, SkuNameStandard} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // SkuTierBasic ... - SkuTierBasic SkuTier = "Basic" - // SkuTierPremium ... - SkuTierPremium SkuTier = "Premium" - // SkuTierStandard ... - SkuTierStandard SkuTier = "Standard" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{SkuTierBasic, SkuTierPremium, SkuTierStandard} -} - -// UnavailableReason enumerates the values for unavailable reason. -type UnavailableReason string - -const ( - // UnavailableReasonInvalidName ... - UnavailableReasonInvalidName UnavailableReason = "InvalidName" - // UnavailableReasonNameInLockdown ... - UnavailableReasonNameInLockdown UnavailableReason = "NameInLockdown" - // UnavailableReasonNameInUse ... - UnavailableReasonNameInUse UnavailableReason = "NameInUse" - // UnavailableReasonNone ... - UnavailableReasonNone UnavailableReason = "None" - // UnavailableReasonSubscriptionIsDisabled ... - UnavailableReasonSubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" - // UnavailableReasonTooManyNamespaceInCurrentSubscription ... - UnavailableReasonTooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" -) - -// PossibleUnavailableReasonValues returns an array of possible values for the UnavailableReason const type. -func PossibleUnavailableReasonValues() []UnavailableReason { - return []UnavailableReason{UnavailableReasonInvalidName, UnavailableReasonNameInLockdown, UnavailableReasonNameInUse, UnavailableReasonNone, UnavailableReasonSubscriptionIsDisabled, UnavailableReasonTooManyNamespaceInCurrentSubscription} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/migrationconfigs.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/migrationconfigs.go deleted file mode 100644 index 4157d2940a9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/migrationconfigs.go +++ /dev/null @@ -1,608 +0,0 @@ -package servicebus - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// MigrationConfigsClient is the client for the MigrationConfigs methods of the Servicebus service. -type MigrationConfigsClient struct { - BaseClient -} - -// NewMigrationConfigsClient creates an instance of the MigrationConfigsClient client. -func NewMigrationConfigsClient(subscriptionID string) MigrationConfigsClient { - return NewMigrationConfigsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMigrationConfigsClientWithBaseURI creates an instance of the MigrationConfigsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewMigrationConfigsClientWithBaseURI(baseURI string, subscriptionID string) MigrationConfigsClient { - return MigrationConfigsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CompleteMigration this operation Completes Migration of entities by pointing the connection strings to Premium -// namespace and any entities created after the operation will be under Premium Namespace. CompleteMigration operation -// will fail when entity migration is in-progress. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -func (client MigrationConfigsClient) CompleteMigration(ctx context.Context, resourceGroupName string, namespaceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigsClient.CompleteMigration") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.MigrationConfigsClient", "CompleteMigration", err.Error()) - } - - req, err := client.CompleteMigrationPreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "CompleteMigration", nil, "Failure preparing request") - return - } - - resp, err := client.CompleteMigrationSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "CompleteMigration", resp, "Failure sending request") - return - } - - result, err = client.CompleteMigrationResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "CompleteMigration", resp, "Failure responding to request") - return - } - - return -} - -// CompleteMigrationPreparer prepares the CompleteMigration request. -func (client MigrationConfigsClient) CompleteMigrationPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configName": autorest.Encode("path", "$default"), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/upgrade", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CompleteMigrationSender sends the CompleteMigration request. The method will close the -// http.Response Body if it receives an error. -func (client MigrationConfigsClient) CompleteMigrationSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CompleteMigrationResponder handles the response to the CompleteMigration request. The method always -// closes the http.Response Body. -func (client MigrationConfigsClient) CompleteMigrationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// CreateAndStartMigration creates Migration configuration and starts migration of entities from Standard to Premium -// namespace -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// parameters - parameters required to create Migration Configuration -func (client MigrationConfigsClient) CreateAndStartMigration(ctx context.Context, resourceGroupName string, namespaceName string, parameters MigrationConfigProperties) (result MigrationConfigsCreateAndStartMigrationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigsClient.CreateAndStartMigration") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.MigrationConfigPropertiesProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.MigrationConfigPropertiesProperties.TargetNamespace", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.MigrationConfigPropertiesProperties.PostMigrationName", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("servicebus.MigrationConfigsClient", "CreateAndStartMigration", err.Error()) - } - - req, err := client.CreateAndStartMigrationPreparer(ctx, resourceGroupName, namespaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "CreateAndStartMigration", nil, "Failure preparing request") - return - } - - result, err = client.CreateAndStartMigrationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "CreateAndStartMigration", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateAndStartMigrationPreparer prepares the CreateAndStartMigration request. -func (client MigrationConfigsClient) CreateAndStartMigrationPreparer(ctx context.Context, resourceGroupName string, namespaceName string, parameters MigrationConfigProperties) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configName": autorest.Encode("path", "$default"), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateAndStartMigrationSender sends the CreateAndStartMigration request. The method will close the -// http.Response Body if it receives an error. -func (client MigrationConfigsClient) CreateAndStartMigrationSender(req *http.Request) (future MigrationConfigsCreateAndStartMigrationFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateAndStartMigrationResponder handles the response to the CreateAndStartMigration request. The method always -// closes the http.Response Body. -func (client MigrationConfigsClient) CreateAndStartMigrationResponder(resp *http.Response) (result MigrationConfigProperties, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a MigrationConfiguration -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -func (client MigrationConfigsClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.MigrationConfigsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client MigrationConfigsClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configName": autorest.Encode("path", "$default"), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client MigrationConfigsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client MigrationConfigsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieves Migration Config -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -func (client MigrationConfigsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string) (result MigrationConfigProperties, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.MigrationConfigsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MigrationConfigsClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configName": autorest.Encode("path", "$default"), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client MigrationConfigsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client MigrationConfigsClient) GetResponder(resp *http.Response) (result MigrationConfigProperties, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all migrationConfigurations -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -func (client MigrationConfigsClient) List(ctx context.Context, resourceGroupName string, namespaceName string) (result MigrationConfigListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigsClient.List") - defer func() { - sc := -1 - if result.mclr.Response.Response != nil { - sc = result.mclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.MigrationConfigsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.mclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "List", resp, "Failure sending request") - return - } - - result.mclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "List", resp, "Failure responding to request") - return - } - if result.mclr.hasNextLink() && result.mclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client MigrationConfigsClient) ListPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client MigrationConfigsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client MigrationConfigsClient) ListResponder(resp *http.Response) (result MigrationConfigListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client MigrationConfigsClient) listNextResults(ctx context.Context, lastResults MigrationConfigListResult) (result MigrationConfigListResult, err error) { - req, err := lastResults.migrationConfigListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client MigrationConfigsClient) ListComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result MigrationConfigListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, namespaceName) - return -} - -// Revert this operation reverts Migration -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -func (client MigrationConfigsClient) Revert(ctx context.Context, resourceGroupName string, namespaceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigsClient.Revert") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.MigrationConfigsClient", "Revert", err.Error()) - } - - req, err := client.RevertPreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Revert", nil, "Failure preparing request") - return - } - - resp, err := client.RevertSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Revert", resp, "Failure sending request") - return - } - - result, err = client.RevertResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsClient", "Revert", resp, "Failure responding to request") - return - } - - return -} - -// RevertPreparer prepares the Revert request. -func (client MigrationConfigsClient) RevertPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "configName": autorest.Encode("path", "$default"), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/migrationConfigurations/{configName}/revert", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RevertSender sends the Revert request. The method will close the -// http.Response Body if it receives an error. -func (client MigrationConfigsClient) RevertSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RevertResponder handles the response to the Revert request. The method always -// closes the http.Response Body. -func (client MigrationConfigsClient) RevertResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/models.go deleted file mode 100644 index 13755feaedd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/models.go +++ /dev/null @@ -1,3989 +0,0 @@ -package servicebus - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" - -// AccessKeys namespace/ServiceBus Connection String -type AccessKeys struct { - autorest.Response `json:"-"` - // PrimaryConnectionString - READ-ONLY; Primary connection string of the created namespace authorization rule. - PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` - // SecondaryConnectionString - READ-ONLY; Secondary connection string of the created namespace authorization rule. - SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` - // AliasPrimaryConnectionString - READ-ONLY; Primary connection string of the alias if GEO DR is enabled - AliasPrimaryConnectionString *string `json:"aliasPrimaryConnectionString,omitempty"` - // AliasSecondaryConnectionString - READ-ONLY; Secondary connection string of the alias if GEO DR is enabled - AliasSecondaryConnectionString *string `json:"aliasSecondaryConnectionString,omitempty"` - // PrimaryKey - READ-ONLY; A base64-encoded 256-bit primary key for signing and validating the SAS token. - PrimaryKey *string `json:"primaryKey,omitempty"` - // SecondaryKey - READ-ONLY; A base64-encoded 256-bit primary key for signing and validating the SAS token. - SecondaryKey *string `json:"secondaryKey,omitempty"` - // KeyName - READ-ONLY; A string that describes the authorization rule. - KeyName *string `json:"keyName,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccessKeys. -func (ak AccessKeys) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Action represents the filter actions which are allowed for the transformation of a message that have -// been matched by a filter expression. -type Action struct { - // SQLExpression - SQL expression. e.g. MyProperty='ABC' - SQLExpression *string `json:"sqlExpression,omitempty"` - // CompatibilityLevel - This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. - CompatibilityLevel *int32 `json:"compatibilityLevel,omitempty"` - // RequiresPreprocessing - Value that indicates whether the rule action requires preprocessing. - RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"` -} - -// ArmDisasterRecovery single item in List or Get Alias(Disaster Recovery configuration) operation -type ArmDisasterRecovery struct { - autorest.Response `json:"-"` - // ArmDisasterRecoveryProperties - Properties required to the Create Or Update Alias(Disaster Recovery configurations) - *ArmDisasterRecoveryProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ArmDisasterRecovery. -func (adr ArmDisasterRecovery) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if adr.ArmDisasterRecoveryProperties != nil { - objectMap["properties"] = adr.ArmDisasterRecoveryProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ArmDisasterRecovery struct. -func (adr *ArmDisasterRecovery) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var armDisasterRecoveryProperties ArmDisasterRecoveryProperties - err = json.Unmarshal(*v, &armDisasterRecoveryProperties) - if err != nil { - return err - } - adr.ArmDisasterRecoveryProperties = &armDisasterRecoveryProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - adr.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - adr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - adr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - adr.Type = &typeVar - } - } - } - - return nil -} - -// ArmDisasterRecoveryListResult the result of the List Alias(Disaster Recovery configuration) operation. -type ArmDisasterRecoveryListResult struct { - autorest.Response `json:"-"` - // Value - List of Alias(Disaster Recovery configurations) - Value *[]ArmDisasterRecovery `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next set of results. Not empty if Value contains incomplete list of Alias(Disaster Recovery configuration) - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ArmDisasterRecoveryListResult. -func (adrlr ArmDisasterRecoveryListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if adrlr.Value != nil { - objectMap["value"] = adrlr.Value - } - return json.Marshal(objectMap) -} - -// ArmDisasterRecoveryListResultIterator provides access to a complete listing of ArmDisasterRecovery -// values. -type ArmDisasterRecoveryListResultIterator struct { - i int - page ArmDisasterRecoveryListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ArmDisasterRecoveryListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArmDisasterRecoveryListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ArmDisasterRecoveryListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ArmDisasterRecoveryListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ArmDisasterRecoveryListResultIterator) Response() ArmDisasterRecoveryListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ArmDisasterRecoveryListResultIterator) Value() ArmDisasterRecovery { - if !iter.page.NotDone() { - return ArmDisasterRecovery{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ArmDisasterRecoveryListResultIterator type. -func NewArmDisasterRecoveryListResultIterator(page ArmDisasterRecoveryListResultPage) ArmDisasterRecoveryListResultIterator { - return ArmDisasterRecoveryListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (adrlr ArmDisasterRecoveryListResult) IsEmpty() bool { - return adrlr.Value == nil || len(*adrlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (adrlr ArmDisasterRecoveryListResult) hasNextLink() bool { - return adrlr.NextLink != nil && len(*adrlr.NextLink) != 0 -} - -// armDisasterRecoveryListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (adrlr ArmDisasterRecoveryListResult) armDisasterRecoveryListResultPreparer(ctx context.Context) (*http.Request, error) { - if !adrlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(adrlr.NextLink))) -} - -// ArmDisasterRecoveryListResultPage contains a page of ArmDisasterRecovery values. -type ArmDisasterRecoveryListResultPage struct { - fn func(context.Context, ArmDisasterRecoveryListResult) (ArmDisasterRecoveryListResult, error) - adrlr ArmDisasterRecoveryListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ArmDisasterRecoveryListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ArmDisasterRecoveryListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.adrlr) - if err != nil { - return err - } - page.adrlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ArmDisasterRecoveryListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ArmDisasterRecoveryListResultPage) NotDone() bool { - return !page.adrlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ArmDisasterRecoveryListResultPage) Response() ArmDisasterRecoveryListResult { - return page.adrlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ArmDisasterRecoveryListResultPage) Values() []ArmDisasterRecovery { - if page.adrlr.IsEmpty() { - return nil - } - return *page.adrlr.Value -} - -// Creates a new instance of the ArmDisasterRecoveryListResultPage type. -func NewArmDisasterRecoveryListResultPage(cur ArmDisasterRecoveryListResult, getNextPage func(context.Context, ArmDisasterRecoveryListResult) (ArmDisasterRecoveryListResult, error)) ArmDisasterRecoveryListResultPage { - return ArmDisasterRecoveryListResultPage{ - fn: getNextPage, - adrlr: cur, - } -} - -// ArmDisasterRecoveryProperties properties required to the Create Or Update Alias(Disaster Recovery -// configurations) -type ArmDisasterRecoveryProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the Alias(Disaster Recovery configuration) - possible values 'Accepted' or 'Succeeded' or 'Failed'. Possible values include: 'ProvisioningStateDRAccepted', 'ProvisioningStateDRSucceeded', 'ProvisioningStateDRFailed' - ProvisioningState ProvisioningStateDR `json:"provisioningState,omitempty"` - // PendingReplicationOperationsCount - READ-ONLY; Number of entities pending to be replicated. - PendingReplicationOperationsCount *int64 `json:"pendingReplicationOperationsCount,omitempty"` - // PartnerNamespace - ARM Id of the Primary/Secondary eventhub namespace name, which is part of GEO DR pairing - PartnerNamespace *string `json:"partnerNamespace,omitempty"` - // AlternateName - Primary/Secondary eventhub namespace name, which is part of GEO DR pairing - AlternateName *string `json:"alternateName,omitempty"` - // Role - READ-ONLY; role of namespace in GEO DR - possible values 'Primary' or 'PrimaryNotReplicating' or 'Secondary'. Possible values include: 'RoleDisasterRecoveryPrimary', 'RoleDisasterRecoveryPrimaryNotReplicating', 'RoleDisasterRecoverySecondary' - Role RoleDisasterRecovery `json:"role,omitempty"` -} - -// MarshalJSON is the custom marshaler for ArmDisasterRecoveryProperties. -func (adr ArmDisasterRecoveryProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if adr.PartnerNamespace != nil { - objectMap["partnerNamespace"] = adr.PartnerNamespace - } - if adr.AlternateName != nil { - objectMap["alternateName"] = adr.AlternateName - } - return json.Marshal(objectMap) -} - -// CheckNameAvailability description of a Check Name availability request properties. -type CheckNameAvailability struct { - // Name - The Name to check the namespace name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number. - Name *string `json:"name,omitempty"` -} - -// CheckNameAvailabilityResult description of a Check Name availability request properties. -type CheckNameAvailabilityResult struct { - autorest.Response `json:"-"` - // Message - READ-ONLY; The detailed info regarding the reason associated with the namespace. - Message *string `json:"message,omitempty"` - // NameAvailable - Value indicating namespace is availability, true if the namespace is available; otherwise, false. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - The reason for unavailability of a namespace. Possible values include: 'UnavailableReasonNone', 'UnavailableReasonInvalidName', 'UnavailableReasonSubscriptionIsDisabled', 'UnavailableReasonNameInUse', 'UnavailableReasonNameInLockdown', 'UnavailableReasonTooManyNamespaceInCurrentSubscription' - Reason UnavailableReason `json:"reason,omitempty"` -} - -// MarshalJSON is the custom marshaler for CheckNameAvailabilityResult. -func (cnar CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cnar.NameAvailable != nil { - objectMap["nameAvailable"] = cnar.NameAvailable - } - if cnar.Reason != "" { - objectMap["reason"] = cnar.Reason - } - return json.Marshal(objectMap) -} - -// ConnectionState connectionState information. -type ConnectionState struct { - // Status - Status of the connection. Possible values include: 'PrivateLinkConnectionStatusPending', 'PrivateLinkConnectionStatusApproved', 'PrivateLinkConnectionStatusRejected', 'PrivateLinkConnectionStatusDisconnected' - Status PrivateLinkConnectionStatus `json:"status,omitempty"` - // Description - Description of the connection state. - Description *string `json:"description,omitempty"` -} - -// CorrelationFilter represents the correlation filter expression. -type CorrelationFilter struct { - // Properties - dictionary object for custom filters - Properties map[string]*string `json:"properties"` - // CorrelationID - Identifier of the correlation. - CorrelationID *string `json:"correlationId,omitempty"` - // MessageID - Identifier of the message. - MessageID *string `json:"messageId,omitempty"` - // To - Address to send to. - To *string `json:"to,omitempty"` - // ReplyTo - Address of the queue to reply to. - ReplyTo *string `json:"replyTo,omitempty"` - // Label - Application specific label. - Label *string `json:"label,omitempty"` - // SessionID - Session identifier. - SessionID *string `json:"sessionId,omitempty"` - // ReplyToSessionID - Session identifier to reply to. - ReplyToSessionID *string `json:"replyToSessionId,omitempty"` - // ContentType - Content type of the message. - ContentType *string `json:"contentType,omitempty"` - // RequiresPreprocessing - Value that indicates whether the rule action requires preprocessing. - RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"` -} - -// MarshalJSON is the custom marshaler for CorrelationFilter. -func (cf CorrelationFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cf.Properties != nil { - objectMap["properties"] = cf.Properties - } - if cf.CorrelationID != nil { - objectMap["correlationId"] = cf.CorrelationID - } - if cf.MessageID != nil { - objectMap["messageId"] = cf.MessageID - } - if cf.To != nil { - objectMap["to"] = cf.To - } - if cf.ReplyTo != nil { - objectMap["replyTo"] = cf.ReplyTo - } - if cf.Label != nil { - objectMap["label"] = cf.Label - } - if cf.SessionID != nil { - objectMap["sessionId"] = cf.SessionID - } - if cf.ReplyToSessionID != nil { - objectMap["replyToSessionId"] = cf.ReplyToSessionID - } - if cf.ContentType != nil { - objectMap["contentType"] = cf.ContentType - } - if cf.RequiresPreprocessing != nil { - objectMap["requiresPreprocessing"] = cf.RequiresPreprocessing - } - return json.Marshal(objectMap) -} - -// Encryption properties to configure Encryption -type Encryption struct { - // KeyVaultProperties - Properties of KeyVault - KeyVaultProperties *[]KeyVaultProperties `json:"keyVaultProperties,omitempty"` - // KeySource - Enumerates the possible value of keySource for Encryption. Possible values include: 'KeySourceMicrosoftKeyVault' - KeySource KeySource `json:"keySource,omitempty"` - // RequireInfrastructureEncryption - Enable Infrastructure Encryption (Double Encryption) - RequireInfrastructureEncryption *bool `json:"requireInfrastructureEncryption,omitempty"` -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponse the resource management error response. -type ErrorResponse struct { - // Error - The error object. - Error *ErrorResponseError `json:"error,omitempty"` -} - -// ErrorResponseError the error object. -type ErrorResponseError struct { - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]ErrorResponse `json:"details,omitempty"` - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponseError. -func (er ErrorResponseError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FailoverProperties safe failover is to indicate the service should wait for pending replication to -// finish before switching to the secondary. -type FailoverProperties struct { - // FailoverPropertiesProperties - Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. - *FailoverPropertiesProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for FailoverProperties. -func (fp FailoverProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fp.FailoverPropertiesProperties != nil { - objectMap["properties"] = fp.FailoverPropertiesProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FailoverProperties struct. -func (fp *FailoverProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var failoverPropertiesProperties FailoverPropertiesProperties - err = json.Unmarshal(*v, &failoverPropertiesProperties) - if err != nil { - return err - } - fp.FailoverPropertiesProperties = &failoverPropertiesProperties - } - } - } - - return nil -} - -// FailoverPropertiesProperties safe failover is to indicate the service should wait for pending -// replication to finish before switching to the secondary. -type FailoverPropertiesProperties struct { - // IsSafeFailover - Safe failover is to indicate the service should wait for pending replication to finish before switching to the secondary. - IsSafeFailover *bool `json:"IsSafeFailover,omitempty"` -} - -// Identity properties to configure User Assigned Identities for Bring your Own Keys -type Identity struct { - // PrincipalID - READ-ONLY; ObjectId from the KeyVault - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; TenantId from the KeyVault - TenantID *string `json:"tenantId,omitempty"` - // Type - Type of managed service identity. Possible values include: 'ManagedServiceIdentityTypeSystemAssigned', 'ManagedServiceIdentityTypeUserAssigned', 'ManagedServiceIdentityTypeSystemAssignedUserAssigned', 'ManagedServiceIdentityTypeNone' - Type ManagedServiceIdentityType `json:"type,omitempty"` - // UserAssignedIdentities - Properties for User Assigned Identities - UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if i.Type != "" { - objectMap["type"] = i.Type - } - if i.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = i.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// KeyVaultProperties properties to configure keyVault Properties -type KeyVaultProperties struct { - // KeyName - Name of the Key from KeyVault - KeyName *string `json:"keyName,omitempty"` - // KeyVaultURI - Uri of KeyVault - KeyVaultURI *string `json:"keyVaultUri,omitempty"` - // KeyVersion - Version of KeyVault - KeyVersion *string `json:"keyVersion,omitempty"` - Identity *UserAssignedIdentityProperties `json:"identity,omitempty"` -} - -// MessageCountDetails message Count Details. -type MessageCountDetails struct { - // ActiveMessageCount - READ-ONLY; Number of active messages in the queue, topic, or subscription. - ActiveMessageCount *int64 `json:"activeMessageCount,omitempty"` - // DeadLetterMessageCount - READ-ONLY; Number of messages that are dead lettered. - DeadLetterMessageCount *int64 `json:"deadLetterMessageCount,omitempty"` - // ScheduledMessageCount - READ-ONLY; Number of scheduled messages. - ScheduledMessageCount *int64 `json:"scheduledMessageCount,omitempty"` - // TransferMessageCount - READ-ONLY; Number of messages transferred to another queue, topic, or subscription. - TransferMessageCount *int64 `json:"transferMessageCount,omitempty"` - // TransferDeadLetterMessageCount - READ-ONLY; Number of messages transferred into dead letters. - TransferDeadLetterMessageCount *int64 `json:"transferDeadLetterMessageCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for MessageCountDetails. -func (mcd MessageCountDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// MigrationConfigListResult the result of the List migrationConfigurations operation. -type MigrationConfigListResult struct { - autorest.Response `json:"-"` - // Value - List of Migration Configs - Value *[]MigrationConfigProperties `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to the next set of results. Not empty if Value contains incomplete list of migrationConfigurations - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrationConfigListResult. -func (mclr MigrationConfigListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mclr.Value != nil { - objectMap["value"] = mclr.Value - } - return json.Marshal(objectMap) -} - -// MigrationConfigListResultIterator provides access to a complete listing of MigrationConfigProperties -// values. -type MigrationConfigListResultIterator struct { - i int - page MigrationConfigListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *MigrationConfigListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *MigrationConfigListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter MigrationConfigListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter MigrationConfigListResultIterator) Response() MigrationConfigListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter MigrationConfigListResultIterator) Value() MigrationConfigProperties { - if !iter.page.NotDone() { - return MigrationConfigProperties{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the MigrationConfigListResultIterator type. -func NewMigrationConfigListResultIterator(page MigrationConfigListResultPage) MigrationConfigListResultIterator { - return MigrationConfigListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (mclr MigrationConfigListResult) IsEmpty() bool { - return mclr.Value == nil || len(*mclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (mclr MigrationConfigListResult) hasNextLink() bool { - return mclr.NextLink != nil && len(*mclr.NextLink) != 0 -} - -// migrationConfigListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (mclr MigrationConfigListResult) migrationConfigListResultPreparer(ctx context.Context) (*http.Request, error) { - if !mclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(mclr.NextLink))) -} - -// MigrationConfigListResultPage contains a page of MigrationConfigProperties values. -type MigrationConfigListResultPage struct { - fn func(context.Context, MigrationConfigListResult) (MigrationConfigListResult, error) - mclr MigrationConfigListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *MigrationConfigListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MigrationConfigListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.mclr) - if err != nil { - return err - } - page.mclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *MigrationConfigListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page MigrationConfigListResultPage) NotDone() bool { - return !page.mclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page MigrationConfigListResultPage) Response() MigrationConfigListResult { - return page.mclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page MigrationConfigListResultPage) Values() []MigrationConfigProperties { - if page.mclr.IsEmpty() { - return nil - } - return *page.mclr.Value -} - -// Creates a new instance of the MigrationConfigListResultPage type. -func NewMigrationConfigListResultPage(cur MigrationConfigListResult, getNextPage func(context.Context, MigrationConfigListResult) (MigrationConfigListResult, error)) MigrationConfigListResultPage { - return MigrationConfigListResultPage{ - fn: getNextPage, - mclr: cur, - } -} - -// MigrationConfigProperties single item in List or Get Migration Config operation -type MigrationConfigProperties struct { - autorest.Response `json:"-"` - // MigrationConfigPropertiesProperties - Properties required to the Create Migration Configuration - *MigrationConfigPropertiesProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrationConfigProperties. -func (mcp MigrationConfigProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcp.MigrationConfigPropertiesProperties != nil { - objectMap["properties"] = mcp.MigrationConfigPropertiesProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MigrationConfigProperties struct. -func (mcp *MigrationConfigProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var migrationConfigPropertiesProperties MigrationConfigPropertiesProperties - err = json.Unmarshal(*v, &migrationConfigPropertiesProperties) - if err != nil { - return err - } - mcp.MigrationConfigPropertiesProperties = &migrationConfigPropertiesProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - mcp.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mcp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mcp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mcp.Type = &typeVar - } - } - } - - return nil -} - -// MigrationConfigPropertiesProperties properties required to the Create Migration Configuration -type MigrationConfigPropertiesProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of Migration Configuration - ProvisioningState *string `json:"provisioningState,omitempty"` - // PendingReplicationOperationsCount - READ-ONLY; Number of entities pending to be replicated. - PendingReplicationOperationsCount *int64 `json:"pendingReplicationOperationsCount,omitempty"` - // TargetNamespace - Existing premium Namespace ARM Id name which has no entities, will be used for migration - TargetNamespace *string `json:"targetNamespace,omitempty"` - // PostMigrationName - Name to access Standard Namespace after migration - PostMigrationName *string `json:"postMigrationName,omitempty"` - // MigrationState - READ-ONLY; State in which Standard to Premium Migration is, possible values : Unknown, Reverting, Completing, Initiating, Syncing, Active - MigrationState *string `json:"migrationState,omitempty"` -} - -// MarshalJSON is the custom marshaler for MigrationConfigPropertiesProperties. -func (mcp MigrationConfigPropertiesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mcp.TargetNamespace != nil { - objectMap["targetNamespace"] = mcp.TargetNamespace - } - if mcp.PostMigrationName != nil { - objectMap["postMigrationName"] = mcp.PostMigrationName - } - return json.Marshal(objectMap) -} - -// MigrationConfigsCreateAndStartMigrationFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type MigrationConfigsCreateAndStartMigrationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(MigrationConfigsClient) (MigrationConfigProperties, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *MigrationConfigsCreateAndStartMigrationFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for MigrationConfigsCreateAndStartMigrationFuture.Result. -func (future *MigrationConfigsCreateAndStartMigrationFuture) result(client MigrationConfigsClient) (mcp MigrationConfigProperties, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsCreateAndStartMigrationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mcp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicebus.MigrationConfigsCreateAndStartMigrationFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mcp.Response.Response, err = future.GetResult(sender); err == nil && mcp.Response.Response.StatusCode != http.StatusNoContent { - mcp, err = client.CreateAndStartMigrationResponder(mcp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.MigrationConfigsCreateAndStartMigrationFuture", "Result", mcp.Response.Response, "Failure responding to request") - } - } - return -} - -// NamespacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type NamespacesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NamespacesClient) (SBNamespace, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NamespacesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for NamespacesCreateOrUpdateFuture.Result. -func (future *NamespacesCreateOrUpdateFuture) result(client NamespacesClient) (sn SBNamespace, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sn.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicebus.NamespacesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sn.Response.Response, err = future.GetResult(sender); err == nil && sn.Response.Response.StatusCode != http.StatusNoContent { - sn, err = client.CreateOrUpdateResponder(sn.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesCreateOrUpdateFuture", "Result", sn.Response.Response, "Failure responding to request") - } - } - return -} - -// NamespacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type NamespacesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(NamespacesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *NamespacesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for NamespacesDeleteFuture.Result. -func (future *NamespacesDeleteFuture) result(client NamespacesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicebus.NamespacesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// NetworkRuleSet description of NetworkRuleSet resource. -type NetworkRuleSet struct { - autorest.Response `json:"-"` - // NetworkRuleSetProperties - NetworkRuleSet properties - *NetworkRuleSetProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for NetworkRuleSet. -func (nrs NetworkRuleSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if nrs.NetworkRuleSetProperties != nil { - objectMap["properties"] = nrs.NetworkRuleSetProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for NetworkRuleSet struct. -func (nrs *NetworkRuleSet) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var networkRuleSetProperties NetworkRuleSetProperties - err = json.Unmarshal(*v, &networkRuleSetProperties) - if err != nil { - return err - } - nrs.NetworkRuleSetProperties = &networkRuleSetProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - nrs.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - nrs.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - nrs.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - nrs.Type = &typeVar - } - } - } - - return nil -} - -// NetworkRuleSetListResult the response of the List NetworkRuleSet operation. -type NetworkRuleSetListResult struct { - autorest.Response `json:"-"` - // Value - Result of the List NetworkRuleSet operation. - Value *[]NetworkRuleSet `json:"value,omitempty"` - // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of NetworkRuleSet. - NextLink *string `json:"nextLink,omitempty"` -} - -// NetworkRuleSetListResultIterator provides access to a complete listing of NetworkRuleSet values. -type NetworkRuleSetListResultIterator struct { - i int - page NetworkRuleSetListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *NetworkRuleSetListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkRuleSetListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *NetworkRuleSetListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter NetworkRuleSetListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter NetworkRuleSetListResultIterator) Response() NetworkRuleSetListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter NetworkRuleSetListResultIterator) Value() NetworkRuleSet { - if !iter.page.NotDone() { - return NetworkRuleSet{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the NetworkRuleSetListResultIterator type. -func NewNetworkRuleSetListResultIterator(page NetworkRuleSetListResultPage) NetworkRuleSetListResultIterator { - return NetworkRuleSetListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (nrslr NetworkRuleSetListResult) IsEmpty() bool { - return nrslr.Value == nil || len(*nrslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (nrslr NetworkRuleSetListResult) hasNextLink() bool { - return nrslr.NextLink != nil && len(*nrslr.NextLink) != 0 -} - -// networkRuleSetListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (nrslr NetworkRuleSetListResult) networkRuleSetListResultPreparer(ctx context.Context) (*http.Request, error) { - if !nrslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(nrslr.NextLink))) -} - -// NetworkRuleSetListResultPage contains a page of NetworkRuleSet values. -type NetworkRuleSetListResultPage struct { - fn func(context.Context, NetworkRuleSetListResult) (NetworkRuleSetListResult, error) - nrslr NetworkRuleSetListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *NetworkRuleSetListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NetworkRuleSetListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.nrslr) - if err != nil { - return err - } - page.nrslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *NetworkRuleSetListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page NetworkRuleSetListResultPage) NotDone() bool { - return !page.nrslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page NetworkRuleSetListResultPage) Response() NetworkRuleSetListResult { - return page.nrslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page NetworkRuleSetListResultPage) Values() []NetworkRuleSet { - if page.nrslr.IsEmpty() { - return nil - } - return *page.nrslr.Value -} - -// Creates a new instance of the NetworkRuleSetListResultPage type. -func NewNetworkRuleSetListResultPage(cur NetworkRuleSetListResult, getNextPage func(context.Context, NetworkRuleSetListResult) (NetworkRuleSetListResult, error)) NetworkRuleSetListResultPage { - return NetworkRuleSetListResultPage{ - fn: getNextPage, - nrslr: cur, - } -} - -// NetworkRuleSetProperties networkRuleSet properties -type NetworkRuleSetProperties struct { - // TrustedServiceAccessEnabled - Value that indicates whether Trusted Service Access is Enabled or not. - TrustedServiceAccessEnabled *bool `json:"trustedServiceAccessEnabled,omitempty"` - // DefaultAction - Default Action for Network Rule Set. Possible values include: 'DefaultActionAllow', 'DefaultActionDeny' - DefaultAction DefaultAction `json:"defaultAction,omitempty"` - // VirtualNetworkRules - List VirtualNetwork Rules - VirtualNetworkRules *[]NWRuleSetVirtualNetworkRules `json:"virtualNetworkRules,omitempty"` - // IPRules - List of IpRules - IPRules *[]NWRuleSetIPRules `json:"ipRules,omitempty"` - // PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. Possible values include: 'PublicNetworkAccessFlagEnabled', 'PublicNetworkAccessFlagDisabled' - PublicNetworkAccess PublicNetworkAccessFlag `json:"publicNetworkAccess,omitempty"` -} - -// NWRuleSetIPRules description of NetWorkRuleSet - IpRules resource. -type NWRuleSetIPRules struct { - // IPMask - IP Mask - IPMask *string `json:"ipMask,omitempty"` - // Action - The IP Filter Action. Possible values include: 'NetworkRuleIPActionAllow' - Action NetworkRuleIPAction `json:"action,omitempty"` -} - -// NWRuleSetVirtualNetworkRules description of VirtualNetworkRules - NetworkRules resource. -type NWRuleSetVirtualNetworkRules struct { - // Subnet - Subnet properties - Subnet *Subnet `json:"subnet,omitempty"` - // IgnoreMissingVnetServiceEndpoint - Value that indicates whether to ignore missing VNet Service Endpoint - IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` -} - -// Operation a ServiceBus REST API operation -type Operation struct { - // Name - READ-ONLY; Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - The object that represents the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if o.Display != nil { - objectMap["display"] = o.Display - } - return json.Marshal(objectMap) -} - -// OperationDisplay the object that represents the operation. -type OperationDisplay struct { - // Provider - READ-ONLY; Service provider: Microsoft.ServiceBus - Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; Resource on which the operation is performed: Invoice, etc. - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResult result of the request to list ServiceBus operations. It contains a list of -// operations and a URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of ServiceBus operations supported by the Microsoft.ServiceBus resource provider. - Value *[]Operation `json:"value,omitempty"` - // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// PrivateEndpoint privateEndpoint information. -type PrivateEndpoint struct { - // ID - The ARM identifier for Private Endpoint. - ID *string `json:"id,omitempty"` -} - -// PrivateEndpointConnection properties of the PrivateEndpointConnection. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnection. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - pec.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult result of the list of all private endpoint connections operation. -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - A collection of private endpoint connection resources. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` - // NextLink - A link for the next page of private endpoint connection resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// PrivateEndpointConnectionListResultIterator provides access to a complete listing of -// PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultIterator struct { - i int - page PrivateEndpointConnectionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateEndpointConnectionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. -func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { - return PrivateEndpointConnectionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { - return peclr.Value == nil || len(*peclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { - return peclr.NextLink != nil && len(*peclr.NextLink) != 0 -} - -// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !peclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(peclr.NextLink))) -} - -// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListResultPage struct { - fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) - peclr PrivateEndpointConnectionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.peclr) - if err != nil { - return err - } - page.peclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateEndpointConnectionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListResultPage) NotDone() bool { - return !page.peclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { - return page.peclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { - if page.peclr.IsEmpty() { - return nil - } - return *page.peclr.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListResultPage type. -func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { - return PrivateEndpointConnectionListResultPage{ - fn: getNextPage, - peclr: cur, - } -} - -// PrivateEndpointConnectionProperties properties of the private endpoint connection resource. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The Private Endpoint resource for this Connection. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Details about the state of the connection. - PrivateLinkServiceConnectionState *ConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - Provisioning state of the Private Endpoint Connection. Possible values include: 'EndPointProvisioningStateCreating', 'EndPointProvisioningStateUpdating', 'EndPointProvisioningStateDeleting', 'EndPointProvisioningStateSucceeded', 'EndPointProvisioningStateCanceled', 'EndPointProvisioningStateFailed' - ProvisioningState EndPointProvisioningState `json:"provisioningState,omitempty"` -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("servicebus.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkResource information of the private link resource. -type PrivateLinkResource struct { - // PrivateLinkResourceProperties - Properties of the private link resource. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - Fully qualified identifier of the resource. - ID *string `json:"id,omitempty"` - // Name - Name of the resource - Name *string `json:"name,omitempty"` - // Type - Type of the resource - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.PrivateLinkResourceProperties != nil { - objectMap["properties"] = plr.PrivateLinkResourceProperties - } - if plr.ID != nil { - objectMap["id"] = plr.ID - } - if plr.Name != nil { - objectMap["name"] = plr.Name - } - if plr.Type != nil { - objectMap["type"] = plr.Type - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. -func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkResourceProperties properties of PrivateLinkResource -type PrivateLinkResourceProperties struct { - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - Required Members - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - Required Zone Names - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// PrivateLinkResourcesListResult result of the List private link resources operation. -type PrivateLinkResourcesListResult struct { - autorest.Response `json:"-"` - // Value - A collection of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` - // NextLink - A link for the next page of private link resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// RegenerateAccessKeyParameters parameters supplied to the Regenerate Authorization Rule operation, -// specifies which key needs to be reset. -type RegenerateAccessKeyParameters struct { - // KeyType - The access key to regenerate. Possible values include: 'KeyTypePrimaryKey', 'KeyTypeSecondaryKey' - KeyType KeyType `json:"keyType,omitempty"` - // Key - Optional, if the key value provided, is reset for KeyType value or autogenerate Key value set for keyType - Key *string `json:"key,omitempty"` -} - -// Resource the Resource definition for other than namespace. -type Resource struct { - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceNamespacePatch the Resource definition. -type ResourceNamespacePatch struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceNamespacePatch. -func (rnp ResourceNamespacePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rnp.Location != nil { - objectMap["location"] = rnp.Location - } - if rnp.Tags != nil { - objectMap["tags"] = rnp.Tags - } - return json.Marshal(objectMap) -} - -// Rule description of Rule Resource. -type Rule struct { - autorest.Response `json:"-"` - // Ruleproperties - Properties of Rule resource - *Ruleproperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Rule. -func (r Rule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Ruleproperties != nil { - objectMap["properties"] = r.Ruleproperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Rule struct. -func (r *Rule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var ruleproperties Ruleproperties - err = json.Unmarshal(*v, &ruleproperties) - if err != nil { - return err - } - r.Ruleproperties = &ruleproperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - r.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - r.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - r.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - r.Type = &typeVar - } - } - } - - return nil -} - -// RuleListResult the response of the List rule operation. -type RuleListResult struct { - autorest.Response `json:"-"` - // Value - Result of the List Rules operation. - Value *[]Rule `json:"value,omitempty"` - // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of rules - NextLink *string `json:"nextLink,omitempty"` -} - -// RuleListResultIterator provides access to a complete listing of Rule values. -type RuleListResultIterator struct { - i int - page RuleListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *RuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RuleListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *RuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RuleListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter RuleListResultIterator) Response() RuleListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter RuleListResultIterator) Value() Rule { - if !iter.page.NotDone() { - return Rule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the RuleListResultIterator type. -func NewRuleListResultIterator(page RuleListResultPage) RuleListResultIterator { - return RuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rlr RuleListResult) IsEmpty() bool { - return rlr.Value == nil || len(*rlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rlr RuleListResult) hasNextLink() bool { - return rlr.NextLink != nil && len(*rlr.NextLink) != 0 -} - -// ruleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rlr RuleListResult) ruleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !rlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rlr.NextLink))) -} - -// RuleListResultPage contains a page of Rule values. -type RuleListResultPage struct { - fn func(context.Context, RuleListResult) (RuleListResult, error) - rlr RuleListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *RuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RuleListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rlr) - if err != nil { - return err - } - page.rlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *RuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RuleListResultPage) NotDone() bool { - return !page.rlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page RuleListResultPage) Response() RuleListResult { - return page.rlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RuleListResultPage) Values() []Rule { - if page.rlr.IsEmpty() { - return nil - } - return *page.rlr.Value -} - -// Creates a new instance of the RuleListResultPage type. -func NewRuleListResultPage(cur RuleListResult, getNextPage func(context.Context, RuleListResult) (RuleListResult, error)) RuleListResultPage { - return RuleListResultPage{ - fn: getNextPage, - rlr: cur, - } -} - -// Ruleproperties description of Rule Resource. -type Ruleproperties struct { - // Action - Represents the filter actions which are allowed for the transformation of a message that have been matched by a filter expression. - Action *Action `json:"action,omitempty"` - // FilterType - Filter type that is evaluated against a BrokeredMessage. Possible values include: 'FilterTypeSQLFilter', 'FilterTypeCorrelationFilter' - FilterType FilterType `json:"filterType,omitempty"` - // SQLFilter - Properties of sqlFilter - SQLFilter *SQLFilter `json:"sqlFilter,omitempty"` - // CorrelationFilter - Properties of correlationFilter - CorrelationFilter *CorrelationFilter `json:"correlationFilter,omitempty"` -} - -// SBAuthorizationRule description of a namespace authorization rule. -type SBAuthorizationRule struct { - autorest.Response `json:"-"` - // SBAuthorizationRuleProperties - AuthorizationRule properties. - *SBAuthorizationRuleProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SBAuthorizationRule. -func (sar SBAuthorizationRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sar.SBAuthorizationRuleProperties != nil { - objectMap["properties"] = sar.SBAuthorizationRuleProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SBAuthorizationRule struct. -func (sar *SBAuthorizationRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var sBAuthorizationRuleProperties SBAuthorizationRuleProperties - err = json.Unmarshal(*v, &sBAuthorizationRuleProperties) - if err != nil { - return err - } - sar.SBAuthorizationRuleProperties = &sBAuthorizationRuleProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sar.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sar.Type = &typeVar - } - } - } - - return nil -} - -// SBAuthorizationRuleListResult the response to the List Namespace operation. -type SBAuthorizationRuleListResult struct { - autorest.Response `json:"-"` - // Value - Result of the List Authorization Rules operation. - Value *[]SBAuthorizationRule `json:"value,omitempty"` - // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of Authorization Rules. - NextLink *string `json:"nextLink,omitempty"` -} - -// SBAuthorizationRuleListResultIterator provides access to a complete listing of SBAuthorizationRule -// values. -type SBAuthorizationRuleListResultIterator struct { - i int - page SBAuthorizationRuleListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SBAuthorizationRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SBAuthorizationRuleListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SBAuthorizationRuleListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SBAuthorizationRuleListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SBAuthorizationRuleListResultIterator) Response() SBAuthorizationRuleListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SBAuthorizationRuleListResultIterator) Value() SBAuthorizationRule { - if !iter.page.NotDone() { - return SBAuthorizationRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SBAuthorizationRuleListResultIterator type. -func NewSBAuthorizationRuleListResultIterator(page SBAuthorizationRuleListResultPage) SBAuthorizationRuleListResultIterator { - return SBAuthorizationRuleListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sarlr SBAuthorizationRuleListResult) IsEmpty() bool { - return sarlr.Value == nil || len(*sarlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sarlr SBAuthorizationRuleListResult) hasNextLink() bool { - return sarlr.NextLink != nil && len(*sarlr.NextLink) != 0 -} - -// sBAuthorizationRuleListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sarlr SBAuthorizationRuleListResult) sBAuthorizationRuleListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sarlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sarlr.NextLink))) -} - -// SBAuthorizationRuleListResultPage contains a page of SBAuthorizationRule values. -type SBAuthorizationRuleListResultPage struct { - fn func(context.Context, SBAuthorizationRuleListResult) (SBAuthorizationRuleListResult, error) - sarlr SBAuthorizationRuleListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SBAuthorizationRuleListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SBAuthorizationRuleListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sarlr) - if err != nil { - return err - } - page.sarlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SBAuthorizationRuleListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SBAuthorizationRuleListResultPage) NotDone() bool { - return !page.sarlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SBAuthorizationRuleListResultPage) Response() SBAuthorizationRuleListResult { - return page.sarlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SBAuthorizationRuleListResultPage) Values() []SBAuthorizationRule { - if page.sarlr.IsEmpty() { - return nil - } - return *page.sarlr.Value -} - -// Creates a new instance of the SBAuthorizationRuleListResultPage type. -func NewSBAuthorizationRuleListResultPage(cur SBAuthorizationRuleListResult, getNextPage func(context.Context, SBAuthorizationRuleListResult) (SBAuthorizationRuleListResult, error)) SBAuthorizationRuleListResultPage { - return SBAuthorizationRuleListResultPage{ - fn: getNextPage, - sarlr: cur, - } -} - -// SBAuthorizationRuleProperties authorizationRule properties. -type SBAuthorizationRuleProperties struct { - // Rights - The rights associated with the rule. - Rights *[]AccessRights `json:"rights,omitempty"` -} - -// SBClientAffineProperties properties specific to client affine subscriptions. -type SBClientAffineProperties struct { - // ClientID - Indicates the Client ID of the application that created the client-affine subscription. - ClientID *string `json:"clientId,omitempty"` - // IsDurable - For client-affine subscriptions, this value indicates whether the subscription is durable or not. - IsDurable *bool `json:"isDurable,omitempty"` - // IsShared - For client-affine subscriptions, this value indicates whether the subscription is shared or not. - IsShared *bool `json:"isShared,omitempty"` -} - -// SBNamespace description of a namespace resource. -type SBNamespace struct { - autorest.Response `json:"-"` - // Sku - Properties of SKU - Sku *SBSku `json:"sku,omitempty"` - // Identity - Properties of BYOK Identity description - Identity *Identity `json:"identity,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // SBNamespaceProperties - Properties of the namespace. - *SBNamespaceProperties `json:"properties,omitempty"` - // Location - The Geo-location where the resource lives - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SBNamespace. -func (sn SBNamespace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sn.Sku != nil { - objectMap["sku"] = sn.Sku - } - if sn.Identity != nil { - objectMap["identity"] = sn.Identity - } - if sn.SBNamespaceProperties != nil { - objectMap["properties"] = sn.SBNamespaceProperties - } - if sn.Location != nil { - objectMap["location"] = sn.Location - } - if sn.Tags != nil { - objectMap["tags"] = sn.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SBNamespace struct. -func (sn *SBNamespace) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku SBSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - sn.Sku = &sku - } - case "identity": - if v != nil { - var identity Identity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - sn.Identity = &identity - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sn.SystemData = &systemData - } - case "properties": - if v != nil { - var sBNamespaceProperties SBNamespaceProperties - err = json.Unmarshal(*v, &sBNamespaceProperties) - if err != nil { - return err - } - sn.SBNamespaceProperties = &sBNamespaceProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sn.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sn.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sn.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sn.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sn.Type = &typeVar - } - } - } - - return nil -} - -// SBNamespaceListResult the response of the List Namespace operation. -type SBNamespaceListResult struct { - autorest.Response `json:"-"` - // Value - Result of the List Namespace operation. - Value *[]SBNamespace `json:"value,omitempty"` - // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of Namespaces. - NextLink *string `json:"nextLink,omitempty"` -} - -// SBNamespaceListResultIterator provides access to a complete listing of SBNamespace values. -type SBNamespaceListResultIterator struct { - i int - page SBNamespaceListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SBNamespaceListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SBNamespaceListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SBNamespaceListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SBNamespaceListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SBNamespaceListResultIterator) Response() SBNamespaceListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SBNamespaceListResultIterator) Value() SBNamespace { - if !iter.page.NotDone() { - return SBNamespace{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SBNamespaceListResultIterator type. -func NewSBNamespaceListResultIterator(page SBNamespaceListResultPage) SBNamespaceListResultIterator { - return SBNamespaceListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (snlr SBNamespaceListResult) IsEmpty() bool { - return snlr.Value == nil || len(*snlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (snlr SBNamespaceListResult) hasNextLink() bool { - return snlr.NextLink != nil && len(*snlr.NextLink) != 0 -} - -// sBNamespaceListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (snlr SBNamespaceListResult) sBNamespaceListResultPreparer(ctx context.Context) (*http.Request, error) { - if !snlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(snlr.NextLink))) -} - -// SBNamespaceListResultPage contains a page of SBNamespace values. -type SBNamespaceListResultPage struct { - fn func(context.Context, SBNamespaceListResult) (SBNamespaceListResult, error) - snlr SBNamespaceListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SBNamespaceListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SBNamespaceListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.snlr) - if err != nil { - return err - } - page.snlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SBNamespaceListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SBNamespaceListResultPage) NotDone() bool { - return !page.snlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SBNamespaceListResultPage) Response() SBNamespaceListResult { - return page.snlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SBNamespaceListResultPage) Values() []SBNamespace { - if page.snlr.IsEmpty() { - return nil - } - return *page.snlr.Value -} - -// Creates a new instance of the SBNamespaceListResultPage type. -func NewSBNamespaceListResultPage(cur SBNamespaceListResult, getNextPage func(context.Context, SBNamespaceListResult) (SBNamespaceListResult, error)) SBNamespaceListResultPage { - return SBNamespaceListResultPage{ - fn: getNextPage, - snlr: cur, - } -} - -// SBNamespaceProperties properties of the namespace. -type SBNamespaceProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the namespace. - ProvisioningState *string `json:"provisioningState,omitempty"` - // Status - READ-ONLY; Status of the namespace. - Status *string `json:"status,omitempty"` - // CreatedAt - READ-ONLY; The time the namespace was created - CreatedAt *date.Time `json:"createdAt,omitempty"` - // UpdatedAt - READ-ONLY; The time the namespace was updated. - UpdatedAt *date.Time `json:"updatedAt,omitempty"` - // ServiceBusEndpoint - READ-ONLY; Endpoint you can use to perform Service Bus operations. - ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` - // MetricID - READ-ONLY; Identifier for Azure Insights metrics - MetricID *string `json:"metricId,omitempty"` - // ZoneRedundant - Enabling this property creates a Premium Service Bus Namespace in regions supported availability zones. - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` - // Encryption - Properties of BYOK Encryption description - Encryption *Encryption `json:"encryption,omitempty"` - // PrivateEndpointConnections - List of private endpoint connections. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // DisableLocalAuth - This property disables SAS authentication for the Service Bus namespace. - DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` -} - -// MarshalJSON is the custom marshaler for SBNamespaceProperties. -func (snp SBNamespaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if snp.ZoneRedundant != nil { - objectMap["zoneRedundant"] = snp.ZoneRedundant - } - if snp.Encryption != nil { - objectMap["encryption"] = snp.Encryption - } - if snp.PrivateEndpointConnections != nil { - objectMap["privateEndpointConnections"] = snp.PrivateEndpointConnections - } - if snp.DisableLocalAuth != nil { - objectMap["disableLocalAuth"] = snp.DisableLocalAuth - } - return json.Marshal(objectMap) -} - -// SBNamespaceUpdateParameters description of a namespace resource. -type SBNamespaceUpdateParameters struct { - // Sku - Properties of SKU - Sku *SBSku `json:"sku,omitempty"` - // SBNamespaceProperties - Properties of the namespace. - *SBNamespaceProperties `json:"properties,omitempty"` - // Identity - Properties of BYOK Identity description - Identity *Identity `json:"identity,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SBNamespaceUpdateParameters. -func (snup SBNamespaceUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if snup.Sku != nil { - objectMap["sku"] = snup.Sku - } - if snup.SBNamespaceProperties != nil { - objectMap["properties"] = snup.SBNamespaceProperties - } - if snup.Identity != nil { - objectMap["identity"] = snup.Identity - } - if snup.Location != nil { - objectMap["location"] = snup.Location - } - if snup.Tags != nil { - objectMap["tags"] = snup.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SBNamespaceUpdateParameters struct. -func (snup *SBNamespaceUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku SBSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - snup.Sku = &sku - } - case "properties": - if v != nil { - var sBNamespaceProperties SBNamespaceProperties - err = json.Unmarshal(*v, &sBNamespaceProperties) - if err != nil { - return err - } - snup.SBNamespaceProperties = &sBNamespaceProperties - } - case "identity": - if v != nil { - var identity Identity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - snup.Identity = &identity - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - snup.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - snup.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - snup.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - snup.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - snup.Type = &typeVar - } - } - } - - return nil -} - -// SBQueue description of queue Resource. -type SBQueue struct { - autorest.Response `json:"-"` - // SBQueueProperties - Queue Properties - *SBQueueProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SBQueue. -func (sq SBQueue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sq.SBQueueProperties != nil { - objectMap["properties"] = sq.SBQueueProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SBQueue struct. -func (sq *SBQueue) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var sBQueueProperties SBQueueProperties - err = json.Unmarshal(*v, &sBQueueProperties) - if err != nil { - return err - } - sq.SBQueueProperties = &sBQueueProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sq.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sq.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sq.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sq.Type = &typeVar - } - } - } - - return nil -} - -// SBQueueListResult the response to the List Queues operation. -type SBQueueListResult struct { - autorest.Response `json:"-"` - // Value - Result of the List Queues operation. - Value *[]SBQueue `json:"value,omitempty"` - // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of queues. - NextLink *string `json:"nextLink,omitempty"` -} - -// SBQueueListResultIterator provides access to a complete listing of SBQueue values. -type SBQueueListResultIterator struct { - i int - page SBQueueListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SBQueueListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SBQueueListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SBQueueListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SBQueueListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SBQueueListResultIterator) Response() SBQueueListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SBQueueListResultIterator) Value() SBQueue { - if !iter.page.NotDone() { - return SBQueue{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SBQueueListResultIterator type. -func NewSBQueueListResultIterator(page SBQueueListResultPage) SBQueueListResultIterator { - return SBQueueListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sqlr SBQueueListResult) IsEmpty() bool { - return sqlr.Value == nil || len(*sqlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sqlr SBQueueListResult) hasNextLink() bool { - return sqlr.NextLink != nil && len(*sqlr.NextLink) != 0 -} - -// sBQueueListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sqlr SBQueueListResult) sBQueueListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sqlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sqlr.NextLink))) -} - -// SBQueueListResultPage contains a page of SBQueue values. -type SBQueueListResultPage struct { - fn func(context.Context, SBQueueListResult) (SBQueueListResult, error) - sqlr SBQueueListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SBQueueListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SBQueueListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sqlr) - if err != nil { - return err - } - page.sqlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SBQueueListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SBQueueListResultPage) NotDone() bool { - return !page.sqlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SBQueueListResultPage) Response() SBQueueListResult { - return page.sqlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SBQueueListResultPage) Values() []SBQueue { - if page.sqlr.IsEmpty() { - return nil - } - return *page.sqlr.Value -} - -// Creates a new instance of the SBQueueListResultPage type. -func NewSBQueueListResultPage(cur SBQueueListResult, getNextPage func(context.Context, SBQueueListResult) (SBQueueListResult, error)) SBQueueListResultPage { - return SBQueueListResultPage{ - fn: getNextPage, - sqlr: cur, - } -} - -// SBQueueProperties the Queue Properties definition. -type SBQueueProperties struct { - // CountDetails - READ-ONLY; Message Count Details. - CountDetails *MessageCountDetails `json:"countDetails,omitempty"` - // CreatedAt - READ-ONLY; The exact time the message was created. - CreatedAt *date.Time `json:"createdAt,omitempty"` - // UpdatedAt - READ-ONLY; The exact time the message was updated. - UpdatedAt *date.Time `json:"updatedAt,omitempty"` - // AccessedAt - READ-ONLY; Last time a message was sent, or the last time there was a receive request to this queue. - AccessedAt *date.Time `json:"accessedAt,omitempty"` - // SizeInBytes - READ-ONLY; The size of the queue, in bytes. - SizeInBytes *int64 `json:"sizeInBytes,omitempty"` - // MessageCount - READ-ONLY; The number of messages in the queue. - MessageCount *int64 `json:"messageCount,omitempty"` - // LockDuration - ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. The maximum value for LockDuration is 5 minutes; the default value is 1 minute. - LockDuration *string `json:"lockDuration,omitempty"` - // MaxSizeInMegabytes - The maximum size of the queue in megabytes, which is the size of memory allocated for the queue. Default is 1024. - MaxSizeInMegabytes *int32 `json:"maxSizeInMegabytes,omitempty"` - // MaxMessageSizeInKilobytes - Maximum size (in KB) of the message payload that can be accepted by the queue. This property is only used in Premium today and default is 1024. - MaxMessageSizeInKilobytes *int64 `json:"maxMessageSizeInKilobytes,omitempty"` - // RequiresDuplicateDetection - A value indicating if this queue requires duplicate detection. - RequiresDuplicateDetection *bool `json:"requiresDuplicateDetection,omitempty"` - // RequiresSession - A value that indicates whether the queue supports the concept of sessions. - RequiresSession *bool `json:"requiresSession,omitempty"` - // DefaultMessageTimeToLive - ISO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. - DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` - // DeadLetteringOnMessageExpiration - A value that indicates whether this queue has dead letter support when a message expires. - DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"` - // DuplicateDetectionHistoryTimeWindow - ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. - DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"` - // MaxDeliveryCount - The maximum delivery count. A message is automatically deadlettered after this number of deliveries. default value is 10. - MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` - // Status - Enumerates the possible values for the status of a messaging entity. Possible values include: 'EntityStatusActive', 'EntityStatusDisabled', 'EntityStatusRestoring', 'EntityStatusSendDisabled', 'EntityStatusReceiveDisabled', 'EntityStatusCreating', 'EntityStatusDeleting', 'EntityStatusRenaming', 'EntityStatusUnknown' - Status EntityStatus `json:"status,omitempty"` - // EnableBatchedOperations - Value that indicates whether server-side batched operations are enabled. - EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` - // AutoDeleteOnIdle - ISO 8061 timeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes. - AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` - // EnablePartitioning - A value that indicates whether the queue is to be partitioned across multiple message brokers. - EnablePartitioning *bool `json:"enablePartitioning,omitempty"` - // EnableExpress - A value that indicates whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage. - EnableExpress *bool `json:"enableExpress,omitempty"` - // ForwardTo - Queue/Topic name to forward the messages - ForwardTo *string `json:"forwardTo,omitempty"` - // ForwardDeadLetteredMessagesTo - Queue/Topic name to forward the Dead Letter message - ForwardDeadLetteredMessagesTo *string `json:"forwardDeadLetteredMessagesTo,omitempty"` -} - -// MarshalJSON is the custom marshaler for SBQueueProperties. -func (sqp SBQueueProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sqp.LockDuration != nil { - objectMap["lockDuration"] = sqp.LockDuration - } - if sqp.MaxSizeInMegabytes != nil { - objectMap["maxSizeInMegabytes"] = sqp.MaxSizeInMegabytes - } - if sqp.MaxMessageSizeInKilobytes != nil { - objectMap["maxMessageSizeInKilobytes"] = sqp.MaxMessageSizeInKilobytes - } - if sqp.RequiresDuplicateDetection != nil { - objectMap["requiresDuplicateDetection"] = sqp.RequiresDuplicateDetection - } - if sqp.RequiresSession != nil { - objectMap["requiresSession"] = sqp.RequiresSession - } - if sqp.DefaultMessageTimeToLive != nil { - objectMap["defaultMessageTimeToLive"] = sqp.DefaultMessageTimeToLive - } - if sqp.DeadLetteringOnMessageExpiration != nil { - objectMap["deadLetteringOnMessageExpiration"] = sqp.DeadLetteringOnMessageExpiration - } - if sqp.DuplicateDetectionHistoryTimeWindow != nil { - objectMap["duplicateDetectionHistoryTimeWindow"] = sqp.DuplicateDetectionHistoryTimeWindow - } - if sqp.MaxDeliveryCount != nil { - objectMap["maxDeliveryCount"] = sqp.MaxDeliveryCount - } - if sqp.Status != "" { - objectMap["status"] = sqp.Status - } - if sqp.EnableBatchedOperations != nil { - objectMap["enableBatchedOperations"] = sqp.EnableBatchedOperations - } - if sqp.AutoDeleteOnIdle != nil { - objectMap["autoDeleteOnIdle"] = sqp.AutoDeleteOnIdle - } - if sqp.EnablePartitioning != nil { - objectMap["enablePartitioning"] = sqp.EnablePartitioning - } - if sqp.EnableExpress != nil { - objectMap["enableExpress"] = sqp.EnableExpress - } - if sqp.ForwardTo != nil { - objectMap["forwardTo"] = sqp.ForwardTo - } - if sqp.ForwardDeadLetteredMessagesTo != nil { - objectMap["forwardDeadLetteredMessagesTo"] = sqp.ForwardDeadLetteredMessagesTo - } - return json.Marshal(objectMap) -} - -// SBSku SKU of the namespace. -type SBSku struct { - // Name - Name of this SKU. Possible values include: 'SkuNameBasic', 'SkuNameStandard', 'SkuNamePremium' - Name SkuName `json:"name,omitempty"` - // Tier - The billing tier of this particular SKU. Possible values include: 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' - Tier SkuTier `json:"tier,omitempty"` - // Capacity - The specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. - Capacity *int32 `json:"capacity,omitempty"` -} - -// SBSubscription description of subscription resource. -type SBSubscription struct { - autorest.Response `json:"-"` - // SBSubscriptionProperties - Properties of subscriptions resource. - *SBSubscriptionProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SBSubscription. -func (ss SBSubscription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ss.SBSubscriptionProperties != nil { - objectMap["properties"] = ss.SBSubscriptionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SBSubscription struct. -func (ss *SBSubscription) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var sBSubscriptionProperties SBSubscriptionProperties - err = json.Unmarshal(*v, &sBSubscriptionProperties) - if err != nil { - return err - } - ss.SBSubscriptionProperties = &sBSubscriptionProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - ss.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ss.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ss.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ss.Type = &typeVar - } - } - } - - return nil -} - -// SBSubscriptionListResult the response to the List Subscriptions operation. -type SBSubscriptionListResult struct { - autorest.Response `json:"-"` - // Value - Result of the List Subscriptions operation. - Value *[]SBSubscription `json:"value,omitempty"` - // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of subscriptions. - NextLink *string `json:"nextLink,omitempty"` -} - -// SBSubscriptionListResultIterator provides access to a complete listing of SBSubscription values. -type SBSubscriptionListResultIterator struct { - i int - page SBSubscriptionListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SBSubscriptionListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SBSubscriptionListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SBSubscriptionListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SBSubscriptionListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SBSubscriptionListResultIterator) Response() SBSubscriptionListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SBSubscriptionListResultIterator) Value() SBSubscription { - if !iter.page.NotDone() { - return SBSubscription{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SBSubscriptionListResultIterator type. -func NewSBSubscriptionListResultIterator(page SBSubscriptionListResultPage) SBSubscriptionListResultIterator { - return SBSubscriptionListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sslr SBSubscriptionListResult) IsEmpty() bool { - return sslr.Value == nil || len(*sslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sslr SBSubscriptionListResult) hasNextLink() bool { - return sslr.NextLink != nil && len(*sslr.NextLink) != 0 -} - -// sBSubscriptionListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sslr SBSubscriptionListResult) sBSubscriptionListResultPreparer(ctx context.Context) (*http.Request, error) { - if !sslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sslr.NextLink))) -} - -// SBSubscriptionListResultPage contains a page of SBSubscription values. -type SBSubscriptionListResultPage struct { - fn func(context.Context, SBSubscriptionListResult) (SBSubscriptionListResult, error) - sslr SBSubscriptionListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SBSubscriptionListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SBSubscriptionListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sslr) - if err != nil { - return err - } - page.sslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SBSubscriptionListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SBSubscriptionListResultPage) NotDone() bool { - return !page.sslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SBSubscriptionListResultPage) Response() SBSubscriptionListResult { - return page.sslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SBSubscriptionListResultPage) Values() []SBSubscription { - if page.sslr.IsEmpty() { - return nil - } - return *page.sslr.Value -} - -// Creates a new instance of the SBSubscriptionListResultPage type. -func NewSBSubscriptionListResultPage(cur SBSubscriptionListResult, getNextPage func(context.Context, SBSubscriptionListResult) (SBSubscriptionListResult, error)) SBSubscriptionListResultPage { - return SBSubscriptionListResultPage{ - fn: getNextPage, - sslr: cur, - } -} - -// SBSubscriptionProperties description of Subscription Resource. -type SBSubscriptionProperties struct { - // MessageCount - READ-ONLY; Number of messages. - MessageCount *int64 `json:"messageCount,omitempty"` - // CreatedAt - READ-ONLY; Exact time the message was created. - CreatedAt *date.Time `json:"createdAt,omitempty"` - // AccessedAt - READ-ONLY; Last time there was a receive request to this subscription. - AccessedAt *date.Time `json:"accessedAt,omitempty"` - // UpdatedAt - READ-ONLY; The exact time the message was updated. - UpdatedAt *date.Time `json:"updatedAt,omitempty"` - // CountDetails - READ-ONLY; Message count details - CountDetails *MessageCountDetails `json:"countDetails,omitempty"` - // LockDuration - ISO 8061 lock duration timespan for the subscription. The default value is 1 minute. - LockDuration *string `json:"lockDuration,omitempty"` - // RequiresSession - Value indicating if a subscription supports the concept of sessions. - RequiresSession *bool `json:"requiresSession,omitempty"` - // DefaultMessageTimeToLive - ISO 8061 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. - DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` - // DeadLetteringOnFilterEvaluationExceptions - Value that indicates whether a subscription has dead letter support on filter evaluation exceptions. - DeadLetteringOnFilterEvaluationExceptions *bool `json:"deadLetteringOnFilterEvaluationExceptions,omitempty"` - // DeadLetteringOnMessageExpiration - Value that indicates whether a subscription has dead letter support when a message expires. - DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"` - // DuplicateDetectionHistoryTimeWindow - ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. - DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"` - // MaxDeliveryCount - Number of maximum deliveries. - MaxDeliveryCount *int32 `json:"maxDeliveryCount,omitempty"` - // Status - Enumerates the possible values for the status of a messaging entity. Possible values include: 'EntityStatusActive', 'EntityStatusDisabled', 'EntityStatusRestoring', 'EntityStatusSendDisabled', 'EntityStatusReceiveDisabled', 'EntityStatusCreating', 'EntityStatusDeleting', 'EntityStatusRenaming', 'EntityStatusUnknown' - Status EntityStatus `json:"status,omitempty"` - // EnableBatchedOperations - Value that indicates whether server-side batched operations are enabled. - EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` - // AutoDeleteOnIdle - ISO 8061 timeSpan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. - AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` - // ForwardTo - Queue/Topic name to forward the messages - ForwardTo *string `json:"forwardTo,omitempty"` - // ForwardDeadLetteredMessagesTo - Queue/Topic name to forward the Dead Letter message - ForwardDeadLetteredMessagesTo *string `json:"forwardDeadLetteredMessagesTo,omitempty"` - // IsClientAffine - Value that indicates whether the subscription has an affinity to the client id. - IsClientAffine *bool `json:"isClientAffine,omitempty"` - // ClientAffineProperties - Properties specific to client affine subscriptions. - ClientAffineProperties *SBClientAffineProperties `json:"clientAffineProperties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SBSubscriptionProperties. -func (ssp SBSubscriptionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ssp.LockDuration != nil { - objectMap["lockDuration"] = ssp.LockDuration - } - if ssp.RequiresSession != nil { - objectMap["requiresSession"] = ssp.RequiresSession - } - if ssp.DefaultMessageTimeToLive != nil { - objectMap["defaultMessageTimeToLive"] = ssp.DefaultMessageTimeToLive - } - if ssp.DeadLetteringOnFilterEvaluationExceptions != nil { - objectMap["deadLetteringOnFilterEvaluationExceptions"] = ssp.DeadLetteringOnFilterEvaluationExceptions - } - if ssp.DeadLetteringOnMessageExpiration != nil { - objectMap["deadLetteringOnMessageExpiration"] = ssp.DeadLetteringOnMessageExpiration - } - if ssp.DuplicateDetectionHistoryTimeWindow != nil { - objectMap["duplicateDetectionHistoryTimeWindow"] = ssp.DuplicateDetectionHistoryTimeWindow - } - if ssp.MaxDeliveryCount != nil { - objectMap["maxDeliveryCount"] = ssp.MaxDeliveryCount - } - if ssp.Status != "" { - objectMap["status"] = ssp.Status - } - if ssp.EnableBatchedOperations != nil { - objectMap["enableBatchedOperations"] = ssp.EnableBatchedOperations - } - if ssp.AutoDeleteOnIdle != nil { - objectMap["autoDeleteOnIdle"] = ssp.AutoDeleteOnIdle - } - if ssp.ForwardTo != nil { - objectMap["forwardTo"] = ssp.ForwardTo - } - if ssp.ForwardDeadLetteredMessagesTo != nil { - objectMap["forwardDeadLetteredMessagesTo"] = ssp.ForwardDeadLetteredMessagesTo - } - if ssp.IsClientAffine != nil { - objectMap["isClientAffine"] = ssp.IsClientAffine - } - if ssp.ClientAffineProperties != nil { - objectMap["clientAffineProperties"] = ssp.ClientAffineProperties - } - return json.Marshal(objectMap) -} - -// SBTopic description of topic resource. -type SBTopic struct { - autorest.Response `json:"-"` - // SBTopicProperties - Properties of topic resource. - *SBTopicProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SBTopic. -func (st SBTopic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if st.SBTopicProperties != nil { - objectMap["properties"] = st.SBTopicProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SBTopic struct. -func (st *SBTopic) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var sBTopicProperties SBTopicProperties - err = json.Unmarshal(*v, &sBTopicProperties) - if err != nil { - return err - } - st.SBTopicProperties = &sBTopicProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - st.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - st.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - st.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - st.Type = &typeVar - } - } - } - - return nil -} - -// SBTopicListResult the response to the List Topics operation. -type SBTopicListResult struct { - autorest.Response `json:"-"` - // Value - Result of the List Topics operation. - Value *[]SBTopic `json:"value,omitempty"` - // NextLink - Link to the next set of results. Not empty if Value contains incomplete list of topics. - NextLink *string `json:"nextLink,omitempty"` -} - -// SBTopicListResultIterator provides access to a complete listing of SBTopic values. -type SBTopicListResultIterator struct { - i int - page SBTopicListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SBTopicListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SBTopicListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SBTopicListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SBTopicListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SBTopicListResultIterator) Response() SBTopicListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SBTopicListResultIterator) Value() SBTopic { - if !iter.page.NotDone() { - return SBTopic{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SBTopicListResultIterator type. -func NewSBTopicListResultIterator(page SBTopicListResultPage) SBTopicListResultIterator { - return SBTopicListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (stlr SBTopicListResult) IsEmpty() bool { - return stlr.Value == nil || len(*stlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (stlr SBTopicListResult) hasNextLink() bool { - return stlr.NextLink != nil && len(*stlr.NextLink) != 0 -} - -// sBTopicListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (stlr SBTopicListResult) sBTopicListResultPreparer(ctx context.Context) (*http.Request, error) { - if !stlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(stlr.NextLink))) -} - -// SBTopicListResultPage contains a page of SBTopic values. -type SBTopicListResultPage struct { - fn func(context.Context, SBTopicListResult) (SBTopicListResult, error) - stlr SBTopicListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SBTopicListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SBTopicListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.stlr) - if err != nil { - return err - } - page.stlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SBTopicListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SBTopicListResultPage) NotDone() bool { - return !page.stlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SBTopicListResultPage) Response() SBTopicListResult { - return page.stlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SBTopicListResultPage) Values() []SBTopic { - if page.stlr.IsEmpty() { - return nil - } - return *page.stlr.Value -} - -// Creates a new instance of the SBTopicListResultPage type. -func NewSBTopicListResultPage(cur SBTopicListResult, getNextPage func(context.Context, SBTopicListResult) (SBTopicListResult, error)) SBTopicListResultPage { - return SBTopicListResultPage{ - fn: getNextPage, - stlr: cur, - } -} - -// SBTopicProperties the Topic Properties definition. -type SBTopicProperties struct { - // SizeInBytes - READ-ONLY; Size of the topic, in bytes. - SizeInBytes *int64 `json:"sizeInBytes,omitempty"` - // CreatedAt - READ-ONLY; Exact time the message was created. - CreatedAt *date.Time `json:"createdAt,omitempty"` - // UpdatedAt - READ-ONLY; The exact time the message was updated. - UpdatedAt *date.Time `json:"updatedAt,omitempty"` - // AccessedAt - READ-ONLY; Last time the message was sent, or a request was received, for this topic. - AccessedAt *date.Time `json:"accessedAt,omitempty"` - // SubscriptionCount - READ-ONLY; Number of subscriptions. - SubscriptionCount *int32 `json:"subscriptionCount,omitempty"` - // CountDetails - READ-ONLY; Message count details - CountDetails *MessageCountDetails `json:"countDetails,omitempty"` - // DefaultMessageTimeToLive - ISO 8601 Default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself. - DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` - // MaxSizeInMegabytes - Maximum size of the topic in megabytes, which is the size of the memory allocated for the topic. Default is 1024. - MaxSizeInMegabytes *int32 `json:"maxSizeInMegabytes,omitempty"` - // MaxMessageSizeInKilobytes - Maximum size (in KB) of the message payload that can be accepted by the topic. This property is only used in Premium today and default is 1024. - MaxMessageSizeInKilobytes *int64 `json:"maxMessageSizeInKilobytes,omitempty"` - // RequiresDuplicateDetection - Value indicating if this topic requires duplicate detection. - RequiresDuplicateDetection *bool `json:"requiresDuplicateDetection,omitempty"` - // DuplicateDetectionHistoryTimeWindow - ISO8601 timespan structure that defines the duration of the duplicate detection history. The default value is 10 minutes. - DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"` - // EnableBatchedOperations - Value that indicates whether server-side batched operations are enabled. - EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` - // Status - Enumerates the possible values for the status of a messaging entity. Possible values include: 'EntityStatusActive', 'EntityStatusDisabled', 'EntityStatusRestoring', 'EntityStatusSendDisabled', 'EntityStatusReceiveDisabled', 'EntityStatusCreating', 'EntityStatusDeleting', 'EntityStatusRenaming', 'EntityStatusUnknown' - Status EntityStatus `json:"status,omitempty"` - // SupportOrdering - Value that indicates whether the topic supports ordering. - SupportOrdering *bool `json:"supportOrdering,omitempty"` - // AutoDeleteOnIdle - ISO 8601 timespan idle interval after which the topic is automatically deleted. The minimum duration is 5 minutes. - AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` - // EnablePartitioning - Value that indicates whether the topic to be partitioned across multiple message brokers is enabled. - EnablePartitioning *bool `json:"enablePartitioning,omitempty"` - // EnableExpress - Value that indicates whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage. - EnableExpress *bool `json:"enableExpress,omitempty"` -} - -// MarshalJSON is the custom marshaler for SBTopicProperties. -func (stp SBTopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if stp.DefaultMessageTimeToLive != nil { - objectMap["defaultMessageTimeToLive"] = stp.DefaultMessageTimeToLive - } - if stp.MaxSizeInMegabytes != nil { - objectMap["maxSizeInMegabytes"] = stp.MaxSizeInMegabytes - } - if stp.MaxMessageSizeInKilobytes != nil { - objectMap["maxMessageSizeInKilobytes"] = stp.MaxMessageSizeInKilobytes - } - if stp.RequiresDuplicateDetection != nil { - objectMap["requiresDuplicateDetection"] = stp.RequiresDuplicateDetection - } - if stp.DuplicateDetectionHistoryTimeWindow != nil { - objectMap["duplicateDetectionHistoryTimeWindow"] = stp.DuplicateDetectionHistoryTimeWindow - } - if stp.EnableBatchedOperations != nil { - objectMap["enableBatchedOperations"] = stp.EnableBatchedOperations - } - if stp.Status != "" { - objectMap["status"] = stp.Status - } - if stp.SupportOrdering != nil { - objectMap["supportOrdering"] = stp.SupportOrdering - } - if stp.AutoDeleteOnIdle != nil { - objectMap["autoDeleteOnIdle"] = stp.AutoDeleteOnIdle - } - if stp.EnablePartitioning != nil { - objectMap["enablePartitioning"] = stp.EnablePartitioning - } - if stp.EnableExpress != nil { - objectMap["enableExpress"] = stp.EnableExpress - } - return json.Marshal(objectMap) -} - -// SQLFilter represents a filter which is a composition of an expression and an action that is executed in -// the pub/sub pipeline. -type SQLFilter struct { - // SQLExpression - The SQL expression. e.g. MyProperty='ABC' - SQLExpression *string `json:"sqlExpression,omitempty"` - // CompatibilityLevel - This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. - CompatibilityLevel *int32 `json:"compatibilityLevel,omitempty"` - // RequiresPreprocessing - Value that indicates whether the rule action requires preprocessing. - RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"` -} - -// SQLRuleAction represents set of actions written in SQL language-based syntax that is performed against a -// ServiceBus.Messaging.BrokeredMessage -type SQLRuleAction struct { - // SQLExpression - SQL expression. e.g. MyProperty='ABC' - SQLExpression *string `json:"sqlExpression,omitempty"` - // CompatibilityLevel - This property is reserved for future use. An integer value showing the compatibility level, currently hard-coded to 20. - CompatibilityLevel *int32 `json:"compatibilityLevel,omitempty"` - // RequiresPreprocessing - Value that indicates whether the rule action requires preprocessing. - RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"` -} - -// Subnet properties supplied for Subnet -type Subnet struct { - // ID - Resource ID of Virtual Network Subnet - ID *string `json:"id,omitempty"` -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The type of identity that last modified the resource. - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TrackedResource the Resource definition. -type TrackedResource struct { - // Location - The Geo-location where the resource lives - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Location != nil { - objectMap["location"] = tr.Location - } - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - return json.Marshal(objectMap) -} - -// UserAssignedIdentity recognized Dictionary value. -type UserAssignedIdentity struct { - // PrincipalID - READ-ONLY; Principal Id of user assigned identity - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - READ-ONLY; Client Id of user assigned identity - ClientID *string `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserAssignedIdentity. -func (uai UserAssignedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UserAssignedIdentityProperties ... -type UserAssignedIdentityProperties struct { - // UserAssignedIdentity - ARM ID of user Identity selected for encryption - UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/namespaces.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/namespaces.go deleted file mode 100644 index 6e34c5da36d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/namespaces.go +++ /dev/null @@ -1,1600 +0,0 @@ -package servicebus - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// NamespacesClient is the client for the Namespaces methods of the Servicebus service. -type NamespacesClient struct { - BaseClient -} - -// NewNamespacesClient creates an instance of the NamespacesClient client. -func NewNamespacesClient(subscriptionID string) NamespacesClient { - return NewNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewNamespacesClientWithBaseURI creates an instance of the NamespacesClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewNamespacesClientWithBaseURI(baseURI string, subscriptionID string) NamespacesClient { - return NamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailabilityMethod check the give namespace name availability. -// Parameters: -// parameters - parameters to check availability of the given namespace name -func (client NamespacesClient) CheckNameAvailabilityMethod(ctx context.Context, parameters CheckNameAvailability) (result CheckNameAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.CheckNameAvailabilityMethod") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "CheckNameAvailabilityMethod", err.Error()) - } - - req, err := client.CheckNameAvailabilityMethodPreparer(ctx, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilityMethodSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityMethodResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CheckNameAvailabilityMethod", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityMethodPreparer prepares the CheckNameAvailabilityMethod request. -func (client NamespacesClient) CheckNameAvailabilityMethodPreparer(ctx context.Context, parameters CheckNameAvailability) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/CheckNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilityMethodSender sends the CheckNameAvailabilityMethod request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CheckNameAvailabilityMethodSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityMethodResponder handles the response to the CheckNameAvailabilityMethod request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CheckNameAvailabilityMethodResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a service namespace. Once created, this namespace's resource manifest is -// immutable. This operation is idempotent. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name. -// parameters - parameters supplied to create a namespace resource. -func (client NamespacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, parameters SBNamespace) (result NamespacesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client NamespacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, parameters SBNamespace) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CreateOrUpdateSender(req *http.Request) (future NamespacesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CreateOrUpdateResponder(resp *http.Response) (result SBNamespace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAuthorizationRule creates or updates an authorization rule for a namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// authorizationRuleName - the authorization rule name. -// parameters - the shared access authorization rule. -func (client NamespacesClient) CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SBAuthorizationRule) (result SBAuthorizationRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.CreateOrUpdateAuthorizationRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SBAuthorizationRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SBAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule", err.Error()) - } - - req, err := client.CreateOrUpdateAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client NamespacesClient) CreateOrUpdateAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters SBAuthorizationRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateNetworkRuleSet create or update NetworkRuleSet for a Namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// parameters - the Namespace IpFilterRule. -func (client NamespacesClient) CreateOrUpdateNetworkRuleSet(ctx context.Context, resourceGroupName string, namespaceName string, parameters NetworkRuleSet) (result NetworkRuleSet, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.CreateOrUpdateNetworkRuleSet") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "CreateOrUpdateNetworkRuleSet", err.Error()) - } - - req, err := client.CreateOrUpdateNetworkRuleSetPreparer(ctx, resourceGroupName, namespaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateNetworkRuleSet", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateNetworkRuleSetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateNetworkRuleSet", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateNetworkRuleSetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "CreateOrUpdateNetworkRuleSet", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateNetworkRuleSetPreparer prepares the CreateOrUpdateNetworkRuleSet request. -func (client NamespacesClient) CreateOrUpdateNetworkRuleSetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, parameters NetworkRuleSet) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateNetworkRuleSetSender sends the CreateOrUpdateNetworkRuleSet request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) CreateOrUpdateNetworkRuleSetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateNetworkRuleSetResponder handles the response to the CreateOrUpdateNetworkRuleSet request. The method always -// closes the http.Response Body. -func (client NamespacesClient) CreateOrUpdateNetworkRuleSetResponder(resp *http.Response) (result NetworkRuleSet, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing namespace. This operation also removes all associated resources under the namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -func (client NamespacesClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string) (result NamespacesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client NamespacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) DeleteSender(req *http.Request) (future NamespacesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client NamespacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAuthorizationRule deletes a namespace authorization rule. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// authorizationRuleName - the authorization rule name. -func (client NamespacesClient) DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.DeleteAuthorizationRule") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "DeleteAuthorizationRule", err.Error()) - } - - req, err := client.DeleteAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAuthorizationRuleSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.DeleteAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client NamespacesClient) DeleteAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a description for the specified namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -func (client NamespacesClient) Get(ctx context.Context, resourceGroupName string, namespaceName string) (result SBNamespace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client NamespacesClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client NamespacesClient) GetResponder(resp *http.Response) (result SBNamespace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule gets an authorization rule for a namespace by rule name. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// authorizationRuleName - the authorization rule name. -func (client NamespacesClient) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result SBAuthorizationRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.GetAuthorizationRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "GetAuthorizationRule", err.Error()) - } - - req, err := client.GetAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client NamespacesClient) GetAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client NamespacesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetNetworkRuleSet gets NetworkRuleSet for a Namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -func (client NamespacesClient) GetNetworkRuleSet(ctx context.Context, resourceGroupName string, namespaceName string) (result NetworkRuleSet, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.GetNetworkRuleSet") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "GetNetworkRuleSet", err.Error()) - } - - req, err := client.GetNetworkRuleSetPreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetNetworkRuleSet", nil, "Failure preparing request") - return - } - - resp, err := client.GetNetworkRuleSetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetNetworkRuleSet", resp, "Failure sending request") - return - } - - result, err = client.GetNetworkRuleSetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "GetNetworkRuleSet", resp, "Failure responding to request") - return - } - - return -} - -// GetNetworkRuleSetPreparer prepares the GetNetworkRuleSet request. -func (client NamespacesClient) GetNetworkRuleSetPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets/default", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetNetworkRuleSetSender sends the GetNetworkRuleSet request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) GetNetworkRuleSetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetNetworkRuleSetResponder handles the response to the GetNetworkRuleSet request. The method always -// closes the http.Response Body. -func (client NamespacesClient) GetNetworkRuleSetResponder(resp *http.Response) (result NetworkRuleSet, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all the available namespaces within the subscription, irrespective of the resource groups. -func (client NamespacesClient) List(ctx context.Context) (result SBNamespaceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.List") - defer func() { - sc := -1 - if result.snlr.Response.Response != nil { - sc = result.snlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.snlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "List", resp, "Failure sending request") - return - } - - result.snlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "List", resp, "Failure responding to request") - return - } - if result.snlr.hasNextLink() && result.snlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client NamespacesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListResponder(resp *http.Response) (result SBNamespaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client NamespacesClient) listNextResults(ctx context.Context, lastResults SBNamespaceListResult) (result SBNamespaceListResult, err error) { - req, err := lastResults.sBNamespaceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client NamespacesClient) ListComplete(ctx context.Context) (result SBNamespaceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListAuthorizationRules gets the authorization rules for a namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -func (client NamespacesClient) ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string) (result SBAuthorizationRuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListAuthorizationRules") - defer func() { - sc := -1 - if result.sarlr.Response.Response != nil { - sc = result.sarlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "ListAuthorizationRules", err.Error()) - } - - result.fn = client.listAuthorizationRulesNextResults - req, err := client.ListAuthorizationRulesPreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.sarlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result.sarlr, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListAuthorizationRules", resp, "Failure responding to request") - return - } - if result.sarlr.hasNextLink() && result.sarlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client NamespacesClient) ListAuthorizationRulesPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SBAuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client NamespacesClient) listAuthorizationRulesNextResults(ctx context.Context, lastResults SBAuthorizationRuleListResult) (result SBAuthorizationRuleListResult, err error) { - req, err := lastResults.sBAuthorizationRuleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listAuthorizationRulesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listAuthorizationRulesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listAuthorizationRulesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAuthorizationRulesComplete enumerates all values, automatically crossing page boundaries as required. -func (client NamespacesClient) ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result SBAuthorizationRuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListAuthorizationRules") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAuthorizationRules(ctx, resourceGroupName, namespaceName) - return -} - -// ListByResourceGroup gets the available namespaces within a resource group. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -func (client NamespacesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SBNamespaceListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.snlr.Response.Response != nil { - sc = result.snlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.snlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.snlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.snlr.hasNextLink() && result.snlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client NamespacesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListByResourceGroupResponder(resp *http.Response) (result SBNamespaceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client NamespacesClient) listByResourceGroupNextResults(ctx context.Context, lastResults SBNamespaceListResult) (result SBNamespaceListResult, err error) { - req, err := lastResults.sBNamespaceListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client NamespacesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SBNamespaceListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListKeys gets the primary and secondary connection strings for the namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// authorizationRuleName - the authorization rule name. -func (client NamespacesClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result AccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, namespaceName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client NamespacesClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListNetworkRuleSets gets list of NetworkRuleSet for a Namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -func (client NamespacesClient) ListNetworkRuleSets(ctx context.Context, resourceGroupName string, namespaceName string) (result NetworkRuleSetListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListNetworkRuleSets") - defer func() { - sc := -1 - if result.nrslr.Response.Response != nil { - sc = result.nrslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "ListNetworkRuleSets", err.Error()) - } - - result.fn = client.listNetworkRuleSetsNextResults - req, err := client.ListNetworkRuleSetsPreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListNetworkRuleSets", nil, "Failure preparing request") - return - } - - resp, err := client.ListNetworkRuleSetsSender(req) - if err != nil { - result.nrslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListNetworkRuleSets", resp, "Failure sending request") - return - } - - result.nrslr, err = client.ListNetworkRuleSetsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "ListNetworkRuleSets", resp, "Failure responding to request") - return - } - if result.nrslr.hasNextLink() && result.nrslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListNetworkRuleSetsPreparer prepares the ListNetworkRuleSets request. -func (client NamespacesClient) ListNetworkRuleSetsPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/networkRuleSets", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListNetworkRuleSetsSender sends the ListNetworkRuleSets request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) ListNetworkRuleSetsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListNetworkRuleSetsResponder handles the response to the ListNetworkRuleSets request. The method always -// closes the http.Response Body. -func (client NamespacesClient) ListNetworkRuleSetsResponder(resp *http.Response) (result NetworkRuleSetListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNetworkRuleSetsNextResults retrieves the next set of results, if any. -func (client NamespacesClient) listNetworkRuleSetsNextResults(ctx context.Context, lastResults NetworkRuleSetListResult) (result NetworkRuleSetListResult, err error) { - req, err := lastResults.networkRuleSetListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listNetworkRuleSetsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListNetworkRuleSetsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listNetworkRuleSetsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListNetworkRuleSetsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "listNetworkRuleSetsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListNetworkRuleSetsComplete enumerates all values, automatically crossing page boundaries as required. -func (client NamespacesClient) ListNetworkRuleSetsComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result NetworkRuleSetListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListNetworkRuleSets") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListNetworkRuleSets(ctx, resourceGroupName, namespaceName) - return -} - -// RegenerateKeys regenerates the primary or secondary connection strings for the namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// authorizationRuleName - the authorization rule name. -// parameters - parameters supplied to regenerate the authorization rule. -func (client NamespacesClient) RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters) (result AccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.RegenerateKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "RegenerateKeys", err.Error()) - } - - req, err := client.RegenerateKeysPreparer(ctx, resourceGroupName, namespaceName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "RegenerateKeys", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client NamespacesClient) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/AuthorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client NamespacesClient) RegenerateKeysResponder(resp *http.Response) (result AccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a service namespace. Once created, this namespace's resource manifest is immutable. This operation is -// idempotent. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// parameters - parameters supplied to update a namespace resource. -func (client NamespacesClient) Update(ctx context.Context, resourceGroupName string, namespaceName string, parameters SBNamespaceUpdateParameters) (result SBNamespace, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.NamespacesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, namespaceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.NamespacesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client NamespacesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, parameters SBNamespaceUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client NamespacesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client NamespacesClient) UpdateResponder(resp *http.Response) (result SBNamespace, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/operations.go deleted file mode 100644 index 9bcd98ac66d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package servicebus - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the client for the Operations methods of the Servicebus service. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available ServiceBus REST API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.ServiceBus/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/privateendpointconnections.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/privateendpointconnections.go deleted file mode 100644 index d6ea029c154..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/privateendpointconnections.go +++ /dev/null @@ -1,431 +0,0 @@ -package servicebus - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionsClient is the client for the PrivateEndpointConnections methods of the Servicebus service. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates PrivateEndpointConnections of service namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// privateEndpointConnectionName - the PrivateEndpointConnection name -// parameters - parameters supplied to update Status of PrivateEndPoint Connection to namespace resource. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing Private Endpoint Connection. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// privateEndpointConnectionName - the PrivateEndpointConnection name -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a description for the specified Private Endpoint Connection. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// privateEndpointConnectionName - the PrivateEndpointConnection name -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets the available PrivateEndpointConnections within a namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, namespaceName string) (result PrivateEndpointConnectionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") - defer func() { - sc := -1 - if result.peclr.Response.Response != nil { - sc = result.peclr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.PrivateEndpointConnectionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.peclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") - return - } - - result.peclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") - return - } - if result.peclr.hasNextLink() && result.peclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionsClient) listNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { - req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result PrivateEndpointConnectionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, namespaceName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/privatelinkresources.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/privatelinkresources.go deleted file mode 100644 index 456d9a3947b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/privatelinkresources.go +++ /dev/null @@ -1,119 +0,0 @@ -package servicebus - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the client for the PrivateLinkResources methods of the Servicebus service. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets lists of resources that supports Privatelinks. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, namespaceName string) (result PrivateLinkResourcesListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.PrivateLinkResourcesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) GetResponder(resp *http.Response) (result PrivateLinkResourcesListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/queues.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/queues.go deleted file mode 100644 index 51860ed7400..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/queues.go +++ /dev/null @@ -1,1069 +0,0 @@ -package servicebus - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// QueuesClient is the client for the Queues methods of the Servicebus service. -type QueuesClient struct { - BaseClient -} - -// NewQueuesClient creates an instance of the QueuesClient client. -func NewQueuesClient(subscriptionID string) QueuesClient { - return NewQueuesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewQueuesClientWithBaseURI creates an instance of the QueuesClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewQueuesClientWithBaseURI(baseURI string, subscriptionID string) QueuesClient { - return QueuesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a Service Bus queue. This operation is idempotent. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// queueName - the queue name. -// parameters - parameters supplied to create or update a queue resource. -func (client QueuesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, parameters SBQueue) (result SBQueue, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.QueuesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, queueName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client QueuesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, parameters SBQueue) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client QueuesClient) CreateOrUpdateResponder(resp *http.Response) (result SBQueue, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAuthorizationRule creates an authorization rule for a queue. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// queueName - the queue name. -// authorizationRuleName - the authorization rule name. -// parameters - the shared access authorization rule. -func (client QueuesClient) CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters SBAuthorizationRule) (result SBAuthorizationRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.CreateOrUpdateAuthorizationRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SBAuthorizationRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SBAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", err.Error()) - } - - req, err := client.CreateOrUpdateAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client QueuesClient) CreateOrUpdateAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters SBAuthorizationRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (client QueuesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a queue from the specified namespace in a resource group. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// queueName - the queue name. -func (client QueuesClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.QueuesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, queueName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client QueuesClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client QueuesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAuthorizationRule deletes a queue authorization rule. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// queueName - the queue name. -// authorizationRuleName - the authorization rule name. -func (client QueuesClient) DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.DeleteAuthorizationRule") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.QueuesClient", "DeleteAuthorizationRule", err.Error()) - } - - req, err := client.DeleteAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, queueName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAuthorizationRuleSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.DeleteAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client QueuesClient) DeleteAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (client QueuesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns a description for the specified queue. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// queueName - the queue name. -func (client QueuesClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result SBQueue, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.QueuesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, queueName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client QueuesClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client QueuesClient) GetResponder(resp *http.Response) (result SBQueue, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule gets an authorization rule for a queue by rule name. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// queueName - the queue name. -// authorizationRuleName - the authorization rule name. -func (client QueuesClient) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result SBAuthorizationRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.GetAuthorizationRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.QueuesClient", "GetAuthorizationRule", err.Error()) - } - - req, err := client.GetAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, queueName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client QueuesClient) GetAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client QueuesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRules gets all authorization rules for a queue. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// queueName - the queue name. -func (client QueuesClient) ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result SBAuthorizationRuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.ListAuthorizationRules") - defer func() { - sc := -1 - if result.sarlr.Response.Response != nil { - sc = result.sarlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.QueuesClient", "ListAuthorizationRules", err.Error()) - } - - result.fn = client.listAuthorizationRulesNextResults - req, err := client.ListAuthorizationRulesPreparer(ctx, resourceGroupName, namespaceName, queueName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.sarlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result.sarlr, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", resp, "Failure responding to request") - return - } - if result.sarlr.hasNextLink() && result.sarlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client QueuesClient) ListAuthorizationRulesPreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client QueuesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SBAuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client QueuesClient) listAuthorizationRulesNextResults(ctx context.Context, lastResults SBAuthorizationRuleListResult) (result SBAuthorizationRuleListResult, err error) { - req, err := lastResults.sBAuthorizationRuleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listAuthorizationRulesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listAuthorizationRulesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listAuthorizationRulesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAuthorizationRulesComplete enumerates all values, automatically crossing page boundaries as required. -func (client QueuesClient) ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result SBAuthorizationRuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.ListAuthorizationRules") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAuthorizationRules(ctx, resourceGroupName, namespaceName, queueName) - return -} - -// ListByNamespace gets the queues within a namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// skip - skip is only used if a previous operation returned a partial result. If a previous response contains -// a nextLink element, the value of the nextLink element will include a skip parameter that specifies a -// starting point to use for subsequent calls. -// top - may be used to limit the number of results to the most recent N usageDetails. -func (client QueuesClient) ListByNamespace(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result SBQueueListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.ListByNamespace") - defer func() { - sc := -1 - if result.sqlr.Response.Response != nil { - sc = result.sqlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, - {Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("servicebus.QueuesClient", "ListByNamespace", err.Error()) - } - - result.fn = client.listByNamespaceNextResults - req, err := client.ListByNamespacePreparer(ctx, resourceGroupName, namespaceName, skip, top) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListByNamespace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNamespaceSender(req) - if err != nil { - result.sqlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListByNamespace", resp, "Failure sending request") - return - } - - result.sqlr, err = client.ListByNamespaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListByNamespace", resp, "Failure responding to request") - return - } - if result.sqlr.hasNextLink() && result.sqlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByNamespacePreparer prepares the ListByNamespace request. -func (client QueuesClient) ListByNamespacePreparer(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNamespaceSender sends the ListByNamespace request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) ListByNamespaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNamespaceResponder handles the response to the ListByNamespace request. The method always -// closes the http.Response Body. -func (client QueuesClient) ListByNamespaceResponder(resp *http.Response) (result SBQueueListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByNamespaceNextResults retrieves the next set of results, if any. -func (client QueuesClient) listByNamespaceNextResults(ctx context.Context, lastResults SBQueueListResult) (result SBQueueListResult, err error) { - req, err := lastResults.sBQueueListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listByNamespaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByNamespaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listByNamespaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByNamespaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listByNamespaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByNamespaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client QueuesClient) ListByNamespaceComplete(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result SBQueueListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.ListByNamespace") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByNamespace(ctx, resourceGroupName, namespaceName, skip, top) - return -} - -// ListKeys primary and secondary connection strings to the queue. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// queueName - the queue name. -// authorizationRuleName - the authorization rule name. -func (client QueuesClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result AccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.ListKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.QueuesClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, namespaceName, queueName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client QueuesClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client QueuesClient) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerates the primary or secondary connection strings to the queue. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// queueName - the queue name. -// authorizationRuleName - the authorization rule name. -// parameters - parameters supplied to regenerate the authorization rule. -func (client QueuesClient) RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters) (result AccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.RegenerateKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.QueuesClient", "RegenerateKeys", err.Error()) - } - - req, err := client.RegenerateKeysPreparer(ctx, resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client QueuesClient) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client QueuesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client QueuesClient) RegenerateKeysResponder(resp *http.Response) (result AccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/rules.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/rules.go deleted file mode 100644 index 9fd10bb35e1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/rules.go +++ /dev/null @@ -1,492 +0,0 @@ -package servicebus - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// RulesClient is the client for the Rules methods of the Servicebus service. -type RulesClient struct { - BaseClient -} - -// NewRulesClient creates an instance of the RulesClient client. -func NewRulesClient(subscriptionID string) RulesClient { - return NewRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRulesClientWithBaseURI creates an instance of the RulesClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewRulesClientWithBaseURI(baseURI string, subscriptionID string) RulesClient { - return RulesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a new rule and updates an existing rule -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -// subscriptionName - the subscription name. -// ruleName - the rule name. -// parameters - parameters supplied to create a rule. -func (client RulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string, parameters Rule) (result Rule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: subscriptionName, - Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: ruleName, - Constraints: []validation.Constraint{{Target: "ruleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "ruleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.RulesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, topicName, subscriptionName, ruleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client RulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string, parameters Rule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "subscriptionName": autorest.Encode("path", subscriptionName), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client RulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client RulesClient) CreateOrUpdateResponder(resp *http.Response) (result Rule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an existing rule. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -// subscriptionName - the subscription name. -// ruleName - the rule name. -func (client RulesClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: subscriptionName, - Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: ruleName, - Constraints: []validation.Constraint{{Target: "ruleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "ruleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.RulesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, topicName, subscriptionName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client RulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "subscriptionName": autorest.Encode("path", subscriptionName), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client RulesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client RulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get retrieves the description for the specified rule. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -// subscriptionName - the subscription name. -// ruleName - the rule name. -func (client RulesClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string) (result Rule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: subscriptionName, - Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: ruleName, - Constraints: []validation.Constraint{{Target: "ruleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "ruleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.RulesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, topicName, subscriptionName, ruleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RulesClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "ruleName": autorest.Encode("path", ruleName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "subscriptionName": autorest.Encode("path", subscriptionName), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules/{ruleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RulesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RulesClient) GetResponder(resp *http.Response) (result Rule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscriptions list all the rules within given topic-subscription -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -// subscriptionName - the subscription name. -// skip - skip is only used if a previous operation returned a partial result. If a previous response contains -// a nextLink element, the value of the nextLink element will include a skip parameter that specifies a -// starting point to use for subsequent calls. -// top - may be used to limit the number of results to the most recent N usageDetails. -func (client RulesClient) ListBySubscriptions(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, skip *int32, top *int32) (result RuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.ListBySubscriptions") - defer func() { - sc := -1 - if result.rlr.Response.Response != nil { - sc = result.rlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: subscriptionName, - Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, - {Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("servicebus.RulesClient", "ListBySubscriptions", err.Error()) - } - - result.fn = client.listBySubscriptionsNextResults - req, err := client.ListBySubscriptionsPreparer(ctx, resourceGroupName, namespaceName, topicName, subscriptionName, skip, top) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "ListBySubscriptions", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionsSender(req) - if err != nil { - result.rlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "ListBySubscriptions", resp, "Failure sending request") - return - } - - result.rlr, err = client.ListBySubscriptionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "ListBySubscriptions", resp, "Failure responding to request") - return - } - if result.rlr.hasNextLink() && result.rlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionsPreparer prepares the ListBySubscriptions request. -func (client RulesClient) ListBySubscriptionsPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, skip *int32, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "subscriptionName": autorest.Encode("path", subscriptionName), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}/rules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionsSender sends the ListBySubscriptions request. The method will close the -// http.Response Body if it receives an error. -func (client RulesClient) ListBySubscriptionsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionsResponder handles the response to the ListBySubscriptions request. The method always -// closes the http.Response Body. -func (client RulesClient) ListBySubscriptionsResponder(resp *http.Response) (result RuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionsNextResults retrieves the next set of results, if any. -func (client RulesClient) listBySubscriptionsNextResults(ctx context.Context, lastResults RuleListResult) (result RuleListResult, err error) { - req, err := lastResults.ruleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.RulesClient", "listBySubscriptionsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.RulesClient", "listBySubscriptionsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.RulesClient", "listBySubscriptionsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionsComplete enumerates all values, automatically crossing page boundaries as required. -func (client RulesClient) ListBySubscriptionsComplete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, skip *int32, top *int32) (result RuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RulesClient.ListBySubscriptions") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscriptions(ctx, resourceGroupName, namespaceName, topicName, subscriptionName, skip, top) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/subscriptions.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/subscriptions.go deleted file mode 100644 index 0f78e281c66..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/subscriptions.go +++ /dev/null @@ -1,472 +0,0 @@ -package servicebus - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SubscriptionsClient is the client for the Subscriptions methods of the Servicebus service. -type SubscriptionsClient struct { - BaseClient -} - -// NewSubscriptionsClient creates an instance of the SubscriptionsClient client. -func NewSubscriptionsClient(subscriptionID string) SubscriptionsClient { - return NewSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubscriptionsClientWithBaseURI creates an instance of the SubscriptionsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionsClient { - return SubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a topic subscription. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -// subscriptionName - the subscription name. -// parameters - parameters supplied to create a subscription resource. -func (client SubscriptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, parameters SBSubscription) (result SBSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: subscriptionName, - Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.SubscriptionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, topicName, subscriptionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, parameters SBSubscription) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "subscriptionName": autorest.Encode("path", subscriptionName), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result SBSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a subscription from the specified topic. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -// subscriptionName - the subscription name. -func (client SubscriptionsClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: subscriptionName, - Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.SubscriptionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, topicName, subscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SubscriptionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "subscriptionName": autorest.Encode("path", subscriptionName), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SubscriptionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns a subscription description for the specified topic. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -// subscriptionName - the subscription name. -func (client SubscriptionsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (result SBSubscription, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: subscriptionName, - Constraints: []validation.Constraint{{Target: "subscriptionName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "subscriptionName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.SubscriptionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, topicName, subscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SubscriptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, subscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "subscriptionName": autorest.Encode("path", subscriptionName), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions/{subscriptionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SubscriptionsClient) GetResponder(resp *http.Response) (result SBSubscription, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByTopic list all the subscriptions under a specified topic. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -// skip - skip is only used if a previous operation returned a partial result. If a previous response contains -// a nextLink element, the value of the nextLink element will include a skip parameter that specifies a -// starting point to use for subsequent calls. -// top - may be used to limit the number of results to the most recent N usageDetails. -func (client SubscriptionsClient) ListByTopic(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, skip *int32, top *int32) (result SBSubscriptionListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.ListByTopic") - defer func() { - sc := -1 - if result.sslr.Response.Response != nil { - sc = result.sslr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, - {Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("servicebus.SubscriptionsClient", "ListByTopic", err.Error()) - } - - result.fn = client.listByTopicNextResults - req, err := client.ListByTopicPreparer(ctx, resourceGroupName, namespaceName, topicName, skip, top) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListByTopic", nil, "Failure preparing request") - return - } - - resp, err := client.ListByTopicSender(req) - if err != nil { - result.sslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListByTopic", resp, "Failure sending request") - return - } - - result.sslr, err = client.ListByTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "ListByTopic", resp, "Failure responding to request") - return - } - if result.sslr.hasNextLink() && result.sslr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByTopicPreparer prepares the ListByTopic request. -func (client SubscriptionsClient) ListByTopicPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, skip *int32, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/subscriptions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByTopicSender sends the ListByTopic request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionsClient) ListByTopicSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByTopicResponder handles the response to the ListByTopic request. The method always -// closes the http.Response Body. -func (client SubscriptionsClient) ListByTopicResponder(resp *http.Response) (result SBSubscriptionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByTopicNextResults retrieves the next set of results, if any. -func (client SubscriptionsClient) listByTopicNextResults(ctx context.Context, lastResults SBSubscriptionListResult) (result SBSubscriptionListResult, err error) { - req, err := lastResults.sBSubscriptionListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "listByTopicNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByTopicSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "listByTopicNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByTopicResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.SubscriptionsClient", "listByTopicNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByTopicComplete enumerates all values, automatically crossing page boundaries as required. -func (client SubscriptionsClient) ListByTopicComplete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, skip *int32, top *int32) (result SBSubscriptionListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.ListByTopic") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByTopic(ctx, resourceGroupName, namespaceName, topicName, skip, top) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/topics.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/topics.go deleted file mode 100644 index 91462d403a8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/topics.go +++ /dev/null @@ -1,1069 +0,0 @@ -package servicebus - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// TopicsClient is the client for the Topics methods of the Servicebus service. -type TopicsClient struct { - BaseClient -} - -// NewTopicsClient creates an instance of the TopicsClient client. -func NewTopicsClient(subscriptionID string) TopicsClient { - return NewTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTopicsClientWithBaseURI creates an instance of the TopicsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient { - return TopicsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates a topic in the specified namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -// parameters - parameters supplied to create a topic resource. -func (client TopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, parameters SBTopic) (result SBTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.TopicsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, topicName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, parameters SBTopic) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result SBTopic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdateAuthorizationRule creates an authorization rule for the specified topic. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -// authorizationRuleName - the authorization rule name. -// parameters - the shared access authorization rule. -func (client TopicsClient) CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters SBAuthorizationRule) (result SBAuthorizationRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.CreateOrUpdateAuthorizationRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SBAuthorizationRuleProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.SBAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule", err.Error()) - } - - req, err := client.CreateOrUpdateAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request. -func (client TopicsClient) CreateOrUpdateAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters SBAuthorizationRule) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (client TopicsClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a topic from the specified namespace and resource group. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -func (client TopicsClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.TopicsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client TopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client TopicsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// DeleteAuthorizationRule deletes a topic authorization rule. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -// authorizationRuleName - the authorization rule name. -func (client TopicsClient) DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.DeleteAuthorizationRule") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.TopicsClient", "DeleteAuthorizationRule", err.Error()) - } - - req, err := client.DeleteAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, topicName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteAuthorizationRuleSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.DeleteAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "DeleteAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request. -func (client TopicsClient) DeleteAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (client TopicsClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns a description for the specified topic. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -func (client TopicsClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (result SBTopic, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.TopicsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client TopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client TopicsClient) GetResponder(resp *http.Response) (result SBTopic, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetAuthorizationRule returns the specified authorization rule. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -// authorizationRuleName - the authorization rule name. -func (client TopicsClient) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result SBAuthorizationRule, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.GetAuthorizationRule") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.TopicsClient", "GetAuthorizationRule", err.Error()) - } - - req, err := client.GetAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, topicName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - resp, err := client.GetAuthorizationRuleSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "GetAuthorizationRule", resp, "Failure sending request") - return - } - - result, err = client.GetAuthorizationRuleResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "GetAuthorizationRule", resp, "Failure responding to request") - return - } - - return -} - -// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request. -func (client TopicsClient) GetAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (client TopicsClient) GetAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListAuthorizationRules gets authorization rules for a topic. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -func (client TopicsClient) ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (result SBAuthorizationRuleListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListAuthorizationRules") - defer func() { - sc := -1 - if result.sarlr.Response.Response != nil { - sc = result.sarlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.TopicsClient", "ListAuthorizationRules", err.Error()) - } - - result.fn = client.listAuthorizationRulesNextResults - req, err := client.ListAuthorizationRulesPreparer(ctx, resourceGroupName, namespaceName, topicName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.sarlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", resp, "Failure sending request") - return - } - - result.sarlr, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListAuthorizationRules", resp, "Failure responding to request") - return - } - if result.sarlr.hasNextLink() && result.sarlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request. -func (client TopicsClient) ListAuthorizationRulesPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListAuthorizationRulesResponder(resp *http.Response) (result SBAuthorizationRuleListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listAuthorizationRulesNextResults retrieves the next set of results, if any. -func (client TopicsClient) listAuthorizationRulesNextResults(ctx context.Context, lastResults SBAuthorizationRuleListResult) (result SBAuthorizationRuleListResult, err error) { - req, err := lastResults.sBAuthorizationRuleListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "listAuthorizationRulesNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListAuthorizationRulesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "listAuthorizationRulesNextResults", resp, "Failure sending next results request") - } - result, err = client.ListAuthorizationRulesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "listAuthorizationRulesNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListAuthorizationRulesComplete enumerates all values, automatically crossing page boundaries as required. -func (client TopicsClient) ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string, topicName string) (result SBAuthorizationRuleListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListAuthorizationRules") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListAuthorizationRules(ctx, resourceGroupName, namespaceName, topicName) - return -} - -// ListByNamespace gets all the topics in a namespace. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// skip - skip is only used if a previous operation returned a partial result. If a previous response contains -// a nextLink element, the value of the nextLink element will include a skip parameter that specifies a -// starting point to use for subsequent calls. -// top - may be used to limit the number of results to the most recent N usageDetails. -func (client TopicsClient) ListByNamespace(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result SBTopicListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListByNamespace") - defer func() { - sc := -1 - if result.stlr.Response.Response != nil { - sc = result.stlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: skip, - Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, - {Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, - }}}}, - {TargetValue: top, - Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, - {Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("servicebus.TopicsClient", "ListByNamespace", err.Error()) - } - - result.fn = client.listByNamespaceNextResults - req, err := client.ListByNamespacePreparer(ctx, resourceGroupName, namespaceName, skip, top) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListByNamespace", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNamespaceSender(req) - if err != nil { - result.stlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListByNamespace", resp, "Failure sending request") - return - } - - result.stlr, err = client.ListByNamespaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListByNamespace", resp, "Failure responding to request") - return - } - if result.stlr.hasNextLink() && result.stlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByNamespacePreparer prepares the ListByNamespace request. -func (client TopicsClient) ListByNamespacePreparer(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if skip != nil { - queryParameters["$skip"] = autorest.Encode("query", *skip) - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNamespaceSender sends the ListByNamespace request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListByNamespaceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNamespaceResponder handles the response to the ListByNamespace request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListByNamespaceResponder(resp *http.Response) (result SBTopicListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByNamespaceNextResults retrieves the next set of results, if any. -func (client TopicsClient) listByNamespaceNextResults(ctx context.Context, lastResults SBTopicListResult) (result SBTopicListResult, err error) { - req, err := lastResults.sBTopicListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "listByNamespaceNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByNamespaceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "servicebus.TopicsClient", "listByNamespaceNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByNamespaceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "listByNamespaceNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByNamespaceComplete enumerates all values, automatically crossing page boundaries as required. -func (client TopicsClient) ListByNamespaceComplete(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result SBTopicListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListByNamespace") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByNamespace(ctx, resourceGroupName, namespaceName, skip, top) - return -} - -// ListKeys gets the primary and secondary connection strings for the topic. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -// authorizationRuleName - the authorization rule name. -func (client TopicsClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (result AccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.TopicsClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, namespaceName, topicName, authorizationRuleName) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client TopicsClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/ListKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client TopicsClient) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKeys regenerates primary or secondary connection strings for the topic. -// Parameters: -// resourceGroupName - name of the Resource group within the Azure subscription. -// namespaceName - the namespace name -// topicName - the topic name. -// authorizationRuleName - the authorization rule name. -// parameters - parameters supplied to regenerate the authorization rule. -func (client TopicsClient) RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters) (result AccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.RegenerateKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: namespaceName, - Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}}, - {TargetValue: topicName, - Constraints: []validation.Constraint{{Target: "topicName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: authorizationRuleName, - Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil}, - {Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("servicebus.TopicsClient", "RegenerateKeys", err.Error()) - } - - req, err := client.RegenerateKeysPreparer(ctx, resourceGroupName, namespaceName, topicName, authorizationRuleName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "RegenerateKeys", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "servicebus.TopicsClient", "RegenerateKeys", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeysPreparer prepares the RegenerateKeys request. -func (client TopicsClient) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "authorizationRuleName": autorest.Encode("path", authorizationRuleName), - "namespaceName": autorest.Encode("path", namespaceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "topicName": autorest.Encode("path", topicName), - } - - const APIVersion = "2021-06-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/topics/{topicName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateKeysSender sends the RegenerateKeys request. The method will close the -// http.Response Body if it receives an error. -func (client TopicsClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (client TopicsClient) RegenerateKeysResponder(resp *http.Response) (result AccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/version.go deleted file mode 100644 index 3da1a066329..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package servicebus - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " servicebus/2021-06-01-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/_meta.json deleted file mode 100644 index 7665abd86aa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "bb4175d29020cfff55f1d9087c2a5a89765067dc", - "readme": "/_/azure-rest-api-specs/specification/sqlvirtualmachine/resource-manager/readme.md", - "tag": "package-preview-2021-11", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2021-11 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/sqlvirtualmachine/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/availabilitygrouplisteners.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/availabilitygrouplisteners.go deleted file mode 100644 index 3715eb6b6b4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/availabilitygrouplisteners.go +++ /dev/null @@ -1,404 +0,0 @@ -package sqlvirtualmachine - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AvailabilityGroupListenersClient is the the SQL virtual machine management API provides a RESTful set of web APIs -// that interact with Azure Compute, Network & Storage services to manage your SQL Server virtual machine. The API -// enables users to create, delete and retrieve a SQL virtual machine, SQL virtual machine group or availability group -// listener. -type AvailabilityGroupListenersClient struct { - BaseClient -} - -// NewAvailabilityGroupListenersClient creates an instance of the AvailabilityGroupListenersClient client. -func NewAvailabilityGroupListenersClient(subscriptionID string) AvailabilityGroupListenersClient { - return NewAvailabilityGroupListenersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAvailabilityGroupListenersClientWithBaseURI creates an instance of the AvailabilityGroupListenersClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewAvailabilityGroupListenersClientWithBaseURI(baseURI string, subscriptionID string) AvailabilityGroupListenersClient { - return AvailabilityGroupListenersClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an availability group listener. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -// SQLVirtualMachineGroupName - name of the SQL virtual machine group. -// availabilityGroupListenerName - name of the availability group listener. -// parameters - the availability group listener. -func (client AvailabilityGroupListenersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string, availabilityGroupListenerName string, parameters AvailabilityGroupListener) (result AvailabilityGroupListenersCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilityGroupListenersClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, SQLVirtualMachineGroupName, availabilityGroupListenerName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AvailabilityGroupListenersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string, availabilityGroupListenerName string, parameters AvailabilityGroupListener) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "availabilityGroupListenerName": autorest.Encode("path", availabilityGroupListenerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlVirtualMachineGroupName": autorest.Encode("path", SQLVirtualMachineGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}/availabilityGroupListeners/{availabilityGroupListenerName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AvailabilityGroupListenersClient) CreateOrUpdateSender(req *http.Request) (future AvailabilityGroupListenersCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AvailabilityGroupListenersClient) CreateOrUpdateResponder(resp *http.Response) (result AvailabilityGroupListener, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an availability group listener. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -// SQLVirtualMachineGroupName - name of the SQL virtual machine group. -// availabilityGroupListenerName - name of the availability group listener. -func (client AvailabilityGroupListenersClient) Delete(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string, availabilityGroupListenerName string) (result AvailabilityGroupListenersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilityGroupListenersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, SQLVirtualMachineGroupName, availabilityGroupListenerName) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AvailabilityGroupListenersClient) DeletePreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string, availabilityGroupListenerName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "availabilityGroupListenerName": autorest.Encode("path", availabilityGroupListenerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlVirtualMachineGroupName": autorest.Encode("path", SQLVirtualMachineGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}/availabilityGroupListeners/{availabilityGroupListenerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AvailabilityGroupListenersClient) DeleteSender(req *http.Request) (future AvailabilityGroupListenersDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AvailabilityGroupListenersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets an availability group listener. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -// SQLVirtualMachineGroupName - name of the SQL virtual machine group. -// availabilityGroupListenerName - name of the availability group listener. -// expand - the child resources to include in the response. -func (client AvailabilityGroupListenersClient) Get(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string, availabilityGroupListenerName string, expand string) (result AvailabilityGroupListener, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilityGroupListenersClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, SQLVirtualMachineGroupName, availabilityGroupListenerName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AvailabilityGroupListenersClient) GetPreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string, availabilityGroupListenerName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "availabilityGroupListenerName": autorest.Encode("path", availabilityGroupListenerName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlVirtualMachineGroupName": autorest.Encode("path", SQLVirtualMachineGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}/availabilityGroupListeners/{availabilityGroupListenerName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AvailabilityGroupListenersClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AvailabilityGroupListenersClient) GetResponder(resp *http.Response) (result AvailabilityGroupListener, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByGroup lists all availability group listeners in a SQL virtual machine group. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -// SQLVirtualMachineGroupName - name of the SQL virtual machine group. -func (client AvailabilityGroupListenersClient) ListByGroup(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string) (result AvailabilityGroupListenerListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilityGroupListenersClient.ListByGroup") - defer func() { - sc := -1 - if result.agllr.Response.Response != nil { - sc = result.agllr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByGroupNextResults - req, err := client.ListByGroupPreparer(ctx, resourceGroupName, SQLVirtualMachineGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersClient", "ListByGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByGroupSender(req) - if err != nil { - result.agllr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersClient", "ListByGroup", resp, "Failure sending request") - return - } - - result.agllr, err = client.ListByGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersClient", "ListByGroup", resp, "Failure responding to request") - return - } - if result.agllr.hasNextLink() && result.agllr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByGroupPreparer prepares the ListByGroup request. -func (client AvailabilityGroupListenersClient) ListByGroupPreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlVirtualMachineGroupName": autorest.Encode("path", SQLVirtualMachineGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}/availabilityGroupListeners", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByGroupSender sends the ListByGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AvailabilityGroupListenersClient) ListByGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByGroupResponder handles the response to the ListByGroup request. The method always -// closes the http.Response Body. -func (client AvailabilityGroupListenersClient) ListByGroupResponder(resp *http.Response) (result AvailabilityGroupListenerListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByGroupNextResults retrieves the next set of results, if any. -func (client AvailabilityGroupListenersClient) listByGroupNextResults(ctx context.Context, lastResults AvailabilityGroupListenerListResult) (result AvailabilityGroupListenerListResult, err error) { - req, err := lastResults.availabilityGroupListenerListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersClient", "listByGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersClient", "listByGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersClient", "listByGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AvailabilityGroupListenersClient) ListByGroupComplete(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string) (result AvailabilityGroupListenerListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilityGroupListenersClient.ListByGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByGroup(ctx, resourceGroupName, SQLVirtualMachineGroupName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/client.go deleted file mode 100644 index 4878862ce59..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Package sqlvirtualmachine implements the Azure ARM Sqlvirtualmachine service API version 2021-11-01-preview. -// -// The SQL virtual machine management API provides a RESTful set of web APIs that interact with Azure Compute, Network -// & Storage services to manage your SQL Server virtual machine. The API enables users to create, delete and retrieve a -// SQL virtual machine, SQL virtual machine group or availability group listener. -package sqlvirtualmachine - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Sqlvirtualmachine - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Sqlvirtualmachine. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/enums.go deleted file mode 100644 index c57f3db6b3e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/enums.go +++ /dev/null @@ -1,375 +0,0 @@ -package sqlvirtualmachine - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// BackupScheduleType enumerates the values for backup schedule type. -type BackupScheduleType string - -const ( - // BackupScheduleTypeAutomated ... - BackupScheduleTypeAutomated BackupScheduleType = "Automated" - // BackupScheduleTypeManual ... - BackupScheduleTypeManual BackupScheduleType = "Manual" -) - -// PossibleBackupScheduleTypeValues returns an array of possible values for the BackupScheduleType const type. -func PossibleBackupScheduleTypeValues() []BackupScheduleType { - return []BackupScheduleType{BackupScheduleTypeAutomated, BackupScheduleTypeManual} -} - -// ClusterConfiguration enumerates the values for cluster configuration. -type ClusterConfiguration string - -const ( - // ClusterConfigurationDomainful ... - ClusterConfigurationDomainful ClusterConfiguration = "Domainful" -) - -// PossibleClusterConfigurationValues returns an array of possible values for the ClusterConfiguration const type. -func PossibleClusterConfigurationValues() []ClusterConfiguration { - return []ClusterConfiguration{ClusterConfigurationDomainful} -} - -// ClusterManagerType enumerates the values for cluster manager type. -type ClusterManagerType string - -const ( - // ClusterManagerTypeWSFC ... - ClusterManagerTypeWSFC ClusterManagerType = "WSFC" -) - -// PossibleClusterManagerTypeValues returns an array of possible values for the ClusterManagerType const type. -func PossibleClusterManagerTypeValues() []ClusterManagerType { - return []ClusterManagerType{ClusterManagerTypeWSFC} -} - -// Commit enumerates the values for commit. -type Commit string - -const ( - // CommitASYNCHRONOUSCOMMIT ... - CommitASYNCHRONOUSCOMMIT Commit = "ASYNCHRONOUS_COMMIT" - // CommitSYNCHRONOUSCOMMIT ... - CommitSYNCHRONOUSCOMMIT Commit = "SYNCHRONOUS_COMMIT" -) - -// PossibleCommitValues returns an array of possible values for the Commit const type. -func PossibleCommitValues() []Commit { - return []Commit{CommitASYNCHRONOUSCOMMIT, CommitSYNCHRONOUSCOMMIT} -} - -// ConnectivityType enumerates the values for connectivity type. -type ConnectivityType string - -const ( - // ConnectivityTypeLOCAL ... - ConnectivityTypeLOCAL ConnectivityType = "LOCAL" - // ConnectivityTypePRIVATE ... - ConnectivityTypePRIVATE ConnectivityType = "PRIVATE" - // ConnectivityTypePUBLIC ... - ConnectivityTypePUBLIC ConnectivityType = "PUBLIC" -) - -// PossibleConnectivityTypeValues returns an array of possible values for the ConnectivityType const type. -func PossibleConnectivityTypeValues() []ConnectivityType { - return []ConnectivityType{ConnectivityTypeLOCAL, ConnectivityTypePRIVATE, ConnectivityTypePUBLIC} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// DayOfWeek enumerates the values for day of week. -type DayOfWeek string - -const ( - // DayOfWeekFriday ... - DayOfWeekFriday DayOfWeek = "Friday" - // DayOfWeekMonday ... - DayOfWeekMonday DayOfWeek = "Monday" - // DayOfWeekSaturday ... - DayOfWeekSaturday DayOfWeek = "Saturday" - // DayOfWeekSunday ... - DayOfWeekSunday DayOfWeek = "Sunday" - // DayOfWeekThursday ... - DayOfWeekThursday DayOfWeek = "Thursday" - // DayOfWeekTuesday ... - DayOfWeekTuesday DayOfWeek = "Tuesday" - // DayOfWeekWednesday ... - DayOfWeekWednesday DayOfWeek = "Wednesday" -) - -// PossibleDayOfWeekValues returns an array of possible values for the DayOfWeek const type. -func PossibleDayOfWeekValues() []DayOfWeek { - return []DayOfWeek{DayOfWeekFriday, DayOfWeekMonday, DayOfWeekSaturday, DayOfWeekSunday, DayOfWeekThursday, DayOfWeekTuesday, DayOfWeekWednesday} -} - -// DaysOfWeek enumerates the values for days of week. -type DaysOfWeek string - -const ( - // DaysOfWeekFriday ... - DaysOfWeekFriday DaysOfWeek = "Friday" - // DaysOfWeekMonday ... - DaysOfWeekMonday DaysOfWeek = "Monday" - // DaysOfWeekSaturday ... - DaysOfWeekSaturday DaysOfWeek = "Saturday" - // DaysOfWeekSunday ... - DaysOfWeekSunday DaysOfWeek = "Sunday" - // DaysOfWeekThursday ... - DaysOfWeekThursday DaysOfWeek = "Thursday" - // DaysOfWeekTuesday ... - DaysOfWeekTuesday DaysOfWeek = "Tuesday" - // DaysOfWeekWednesday ... - DaysOfWeekWednesday DaysOfWeek = "Wednesday" -) - -// PossibleDaysOfWeekValues returns an array of possible values for the DaysOfWeek const type. -func PossibleDaysOfWeekValues() []DaysOfWeek { - return []DaysOfWeek{DaysOfWeekFriday, DaysOfWeekMonday, DaysOfWeekSaturday, DaysOfWeekSunday, DaysOfWeekThursday, DaysOfWeekTuesday, DaysOfWeekWednesday} -} - -// DiskConfigurationType enumerates the values for disk configuration type. -type DiskConfigurationType string - -const ( - // DiskConfigurationTypeADD ... - DiskConfigurationTypeADD DiskConfigurationType = "ADD" - // DiskConfigurationTypeEXTEND ... - DiskConfigurationTypeEXTEND DiskConfigurationType = "EXTEND" - // DiskConfigurationTypeNEW ... - DiskConfigurationTypeNEW DiskConfigurationType = "NEW" -) - -// PossibleDiskConfigurationTypeValues returns an array of possible values for the DiskConfigurationType const type. -func PossibleDiskConfigurationTypeValues() []DiskConfigurationType { - return []DiskConfigurationType{DiskConfigurationTypeADD, DiskConfigurationTypeEXTEND, DiskConfigurationTypeNEW} -} - -// Failover enumerates the values for failover. -type Failover string - -const ( - // FailoverAUTOMATIC ... - FailoverAUTOMATIC Failover = "AUTOMATIC" - // FailoverMANUAL ... - FailoverMANUAL Failover = "MANUAL" -) - -// PossibleFailoverValues returns an array of possible values for the Failover const type. -func PossibleFailoverValues() []Failover { - return []Failover{FailoverAUTOMATIC, FailoverMANUAL} -} - -// FullBackupFrequencyType enumerates the values for full backup frequency type. -type FullBackupFrequencyType string - -const ( - // FullBackupFrequencyTypeDaily ... - FullBackupFrequencyTypeDaily FullBackupFrequencyType = "Daily" - // FullBackupFrequencyTypeWeekly ... - FullBackupFrequencyTypeWeekly FullBackupFrequencyType = "Weekly" -) - -// PossibleFullBackupFrequencyTypeValues returns an array of possible values for the FullBackupFrequencyType const type. -func PossibleFullBackupFrequencyTypeValues() []FullBackupFrequencyType { - return []FullBackupFrequencyType{FullBackupFrequencyTypeDaily, FullBackupFrequencyTypeWeekly} -} - -// IdentityType enumerates the values for identity type. -type IdentityType string - -const ( - // IdentityTypeNone ... - IdentityTypeNone IdentityType = "None" - // IdentityTypeSystemAssigned ... - IdentityTypeSystemAssigned IdentityType = "SystemAssigned" -) - -// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. -func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{IdentityTypeNone, IdentityTypeSystemAssigned} -} - -// OperationOrigin enumerates the values for operation origin. -type OperationOrigin string - -const ( - // OperationOriginSystem ... - OperationOriginSystem OperationOrigin = "system" - // OperationOriginUser ... - OperationOriginUser OperationOrigin = "user" -) - -// PossibleOperationOriginValues returns an array of possible values for the OperationOrigin const type. -func PossibleOperationOriginValues() []OperationOrigin { - return []OperationOrigin{OperationOriginSystem, OperationOriginUser} -} - -// ReadableSecondary enumerates the values for readable secondary. -type ReadableSecondary string - -const ( - // ReadableSecondaryALL ... - ReadableSecondaryALL ReadableSecondary = "ALL" - // ReadableSecondaryNO ... - ReadableSecondaryNO ReadableSecondary = "NO" - // ReadableSecondaryREADONLY ... - ReadableSecondaryREADONLY ReadableSecondary = "READ_ONLY" -) - -// PossibleReadableSecondaryValues returns an array of possible values for the ReadableSecondary const type. -func PossibleReadableSecondaryValues() []ReadableSecondary { - return []ReadableSecondary{ReadableSecondaryALL, ReadableSecondaryNO, ReadableSecondaryREADONLY} -} - -// Role enumerates the values for role. -type Role string - -const ( - // RolePRIMARY ... - RolePRIMARY Role = "PRIMARY" - // RoleSECONDARY ... - RoleSECONDARY Role = "SECONDARY" -) - -// PossibleRoleValues returns an array of possible values for the Role const type. -func PossibleRoleValues() []Role { - return []Role{RolePRIMARY, RoleSECONDARY} -} - -// ScaleType enumerates the values for scale type. -type ScaleType string - -const ( - // ScaleTypeHA ... - ScaleTypeHA ScaleType = "HA" -) - -// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. -func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ScaleTypeHA} -} - -// SQLImageSku enumerates the values for sql image sku. -type SQLImageSku string - -const ( - // SQLImageSkuDeveloper ... - SQLImageSkuDeveloper SQLImageSku = "Developer" - // SQLImageSkuEnterprise ... - SQLImageSkuEnterprise SQLImageSku = "Enterprise" - // SQLImageSkuExpress ... - SQLImageSkuExpress SQLImageSku = "Express" - // SQLImageSkuStandard ... - SQLImageSkuStandard SQLImageSku = "Standard" - // SQLImageSkuWeb ... - SQLImageSkuWeb SQLImageSku = "Web" -) - -// PossibleSQLImageSkuValues returns an array of possible values for the SQLImageSku const type. -func PossibleSQLImageSkuValues() []SQLImageSku { - return []SQLImageSku{SQLImageSkuDeveloper, SQLImageSkuEnterprise, SQLImageSkuExpress, SQLImageSkuStandard, SQLImageSkuWeb} -} - -// SQLManagementMode enumerates the values for sql management mode. -type SQLManagementMode string - -const ( - // SQLManagementModeFull ... - SQLManagementModeFull SQLManagementMode = "Full" - // SQLManagementModeLightWeight ... - SQLManagementModeLightWeight SQLManagementMode = "LightWeight" - // SQLManagementModeNoAgent ... - SQLManagementModeNoAgent SQLManagementMode = "NoAgent" -) - -// PossibleSQLManagementModeValues returns an array of possible values for the SQLManagementMode const type. -func PossibleSQLManagementModeValues() []SQLManagementMode { - return []SQLManagementMode{SQLManagementModeFull, SQLManagementModeLightWeight, SQLManagementModeNoAgent} -} - -// SQLServerLicenseType enumerates the values for sql server license type. -type SQLServerLicenseType string - -const ( - // SQLServerLicenseTypeAHUB ... - SQLServerLicenseTypeAHUB SQLServerLicenseType = "AHUB" - // SQLServerLicenseTypeDR ... - SQLServerLicenseTypeDR SQLServerLicenseType = "DR" - // SQLServerLicenseTypePAYG ... - SQLServerLicenseTypePAYG SQLServerLicenseType = "PAYG" -) - -// PossibleSQLServerLicenseTypeValues returns an array of possible values for the SQLServerLicenseType const type. -func PossibleSQLServerLicenseTypeValues() []SQLServerLicenseType { - return []SQLServerLicenseType{SQLServerLicenseTypeAHUB, SQLServerLicenseTypeDR, SQLServerLicenseTypePAYG} -} - -// SQLVMGroupImageSku enumerates the values for sqlvm group image sku. -type SQLVMGroupImageSku string - -const ( - // SQLVMGroupImageSkuDeveloper ... - SQLVMGroupImageSkuDeveloper SQLVMGroupImageSku = "Developer" - // SQLVMGroupImageSkuEnterprise ... - SQLVMGroupImageSkuEnterprise SQLVMGroupImageSku = "Enterprise" -) - -// PossibleSQLVMGroupImageSkuValues returns an array of possible values for the SQLVMGroupImageSku const type. -func PossibleSQLVMGroupImageSkuValues() []SQLVMGroupImageSku { - return []SQLVMGroupImageSku{SQLVMGroupImageSkuDeveloper, SQLVMGroupImageSkuEnterprise} -} - -// SQLWorkloadType enumerates the values for sql workload type. -type SQLWorkloadType string - -const ( - // SQLWorkloadTypeDW ... - SQLWorkloadTypeDW SQLWorkloadType = "DW" - // SQLWorkloadTypeGENERAL ... - SQLWorkloadTypeGENERAL SQLWorkloadType = "GENERAL" - // SQLWorkloadTypeOLTP ... - SQLWorkloadTypeOLTP SQLWorkloadType = "OLTP" -) - -// PossibleSQLWorkloadTypeValues returns an array of possible values for the SQLWorkloadType const type. -func PossibleSQLWorkloadTypeValues() []SQLWorkloadType { - return []SQLWorkloadType{SQLWorkloadTypeDW, SQLWorkloadTypeGENERAL, SQLWorkloadTypeOLTP} -} - -// StorageWorkloadType enumerates the values for storage workload type. -type StorageWorkloadType string - -const ( - // StorageWorkloadTypeDW ... - StorageWorkloadTypeDW StorageWorkloadType = "DW" - // StorageWorkloadTypeGENERAL ... - StorageWorkloadTypeGENERAL StorageWorkloadType = "GENERAL" - // StorageWorkloadTypeOLTP ... - StorageWorkloadTypeOLTP StorageWorkloadType = "OLTP" -) - -// PossibleStorageWorkloadTypeValues returns an array of possible values for the StorageWorkloadType const type. -func PossibleStorageWorkloadTypeValues() []StorageWorkloadType { - return []StorageWorkloadType{StorageWorkloadTypeDW, StorageWorkloadTypeGENERAL, StorageWorkloadTypeOLTP} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/groups.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/groups.go deleted file mode 100644 index b72eb637903..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/groups.go +++ /dev/null @@ -1,586 +0,0 @@ -package sqlvirtualmachine - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// GroupsClient is the the SQL virtual machine management API provides a RESTful set of web APIs that interact with -// Azure Compute, Network & Storage services to manage your SQL Server virtual machine. The API enables users to -// create, delete and retrieve a SQL virtual machine, SQL virtual machine group or availability group listener. -type GroupsClient struct { - BaseClient -} - -// NewGroupsClient creates an instance of the GroupsClient client. -func NewGroupsClient(subscriptionID string) GroupsClient { - return NewGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewGroupsClientWithBaseURI creates an instance of the GroupsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewGroupsClientWithBaseURI(baseURI string, subscriptionID string) GroupsClient { - return GroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a SQL virtual machine group. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -// SQLVirtualMachineGroupName - name of the SQL virtual machine group. -// parameters - the SQL virtual machine group. -func (client GroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string, parameters Group) (result GroupsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, SQLVirtualMachineGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client GroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string, parameters Group) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlVirtualMachineGroupName": autorest.Encode("path", SQLVirtualMachineGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) CreateOrUpdateSender(req *http.Request) (future GroupsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client GroupsClient) CreateOrUpdateResponder(resp *http.Response) (result Group, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a SQL virtual machine group. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -// SQLVirtualMachineGroupName - name of the SQL virtual machine group. -func (client GroupsClient) Delete(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string) (result GroupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, SQLVirtualMachineGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client GroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlVirtualMachineGroupName": autorest.Encode("path", SQLVirtualMachineGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) DeleteSender(req *http.Request) (future GroupsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client GroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a SQL virtual machine group. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -// SQLVirtualMachineGroupName - name of the SQL virtual machine group. -func (client GroupsClient) Get(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string) (result Group, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, SQLVirtualMachineGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client GroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlVirtualMachineGroupName": autorest.Encode("path", SQLVirtualMachineGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client GroupsClient) GetResponder(resp *http.Response) (result Group, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all SQL virtual machine groups in a subscription. -func (client GroupsClient) List(ctx context.Context) (result GroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.List") - defer func() { - sc := -1 - if result.glr.Response.Response != nil { - sc = result.glr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.glr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "List", resp, "Failure sending request") - return - } - - result.glr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "List", resp, "Failure responding to request") - return - } - if result.glr.hasNextLink() && result.glr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client GroupsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client GroupsClient) ListResponder(resp *http.Response) (result GroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client GroupsClient) listNextResults(ctx context.Context, lastResults GroupListResult) (result GroupListResult, err error) { - req, err := lastResults.groupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client GroupsClient) ListComplete(ctx context.Context) (result GroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup gets all SQL virtual machine groups in a resource group. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -func (client GroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result GroupListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.glr.Response.Response != nil { - sc = result.glr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.glr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.glr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.glr.hasNextLink() && result.glr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client GroupsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client GroupsClient) ListByResourceGroupResponder(resp *http.Response) (result GroupListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client GroupsClient) listByResourceGroupNextResults(ctx context.Context, lastResults GroupListResult) (result GroupListResult, err error) { - req, err := lastResults.groupListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client GroupsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result GroupListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// Update updates SQL virtual machine group tags. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -// SQLVirtualMachineGroupName - name of the SQL virtual machine group. -// parameters - the SQL virtual machine group. -func (client GroupsClient) Update(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string, parameters GroupUpdate) (result GroupsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, SQLVirtualMachineGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client GroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string, parameters GroupUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlVirtualMachineGroupName": autorest.Encode("path", SQLVirtualMachineGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client GroupsClient) UpdateSender(req *http.Request) (future GroupsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client GroupsClient) UpdateResponder(resp *http.Response) (result Group, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/models.go deleted file mode 100644 index 9631b814432..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/models.go +++ /dev/null @@ -1,1975 +0,0 @@ -package sqlvirtualmachine - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "github.com/gofrs/uuid" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine" - -// AdditionalFeaturesServerConfigurations additional SQL Server feature settings. -type AdditionalFeaturesServerConfigurations struct { - // IsRServicesEnabled - Enable or disable R services (SQL 2016 onwards). - IsRServicesEnabled *bool `json:"isRServicesEnabled,omitempty"` -} - -// AgConfiguration availability group configuration. -type AgConfiguration struct { - // Replicas - READ-ONLY; Replica configurations. - Replicas *[]AgReplica `json:"replicas,omitempty"` -} - -// MarshalJSON is the custom marshaler for AgConfiguration. -func (ac AgConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AgReplica availability group replica configuration. -type AgReplica struct { - // SQLVirtualMachineInstanceID - Sql VirtualMachine Instance Id. - SQLVirtualMachineInstanceID *string `json:"sqlVirtualMachineInstanceId,omitempty"` - // Role - Replica Role in availability group. Possible values include: 'RolePRIMARY', 'RoleSECONDARY' - Role Role `json:"role,omitempty"` - // Commit - Replica commit mode in availability group. Possible values include: 'CommitSYNCHRONOUSCOMMIT', 'CommitASYNCHRONOUSCOMMIT' - Commit Commit `json:"commit,omitempty"` - // Failover - Replica failover mode in availability group. Possible values include: 'FailoverAUTOMATIC', 'FailoverMANUAL' - Failover Failover `json:"failover,omitempty"` - // ReadableSecondary - Replica readable secondary mode in availability group. Possible values include: 'ReadableSecondaryNO', 'ReadableSecondaryALL', 'ReadableSecondaryREADONLY' - ReadableSecondary ReadableSecondary `json:"readableSecondary,omitempty"` -} - -// AssessmentSettings configure assessment for databases in your SQL virtual machine. -type AssessmentSettings struct { - // Enable - Enable or disable assessment feature on SQL virtual machine. - Enable *bool `json:"enable,omitempty"` - // RunImmediately - Run assessment immediately on SQL virtual machine. - RunImmediately *bool `json:"runImmediately,omitempty"` - // Schedule - Schedule for Assessment. - Schedule *Schedule `json:"schedule,omitempty"` -} - -// AutoBackupSettings configure backups for databases in your SQL virtual machine. -type AutoBackupSettings struct { - // Enable - Enable or disable autobackup on SQL virtual machine. - Enable *bool `json:"enable,omitempty"` - // EnableEncryption - Enable or disable encryption for backup on SQL virtual machine. - EnableEncryption *bool `json:"enableEncryption,omitempty"` - // RetentionPeriod - Retention period of backup: 1-90 days. - RetentionPeriod *int32 `json:"retentionPeriod,omitempty"` - // StorageAccountURL - Storage account url where backup will be taken to. - StorageAccountURL *string `json:"storageAccountUrl,omitempty"` - // StorageContainerName - Storage container name where backup will be taken to. - StorageContainerName *string `json:"storageContainerName,omitempty"` - // StorageAccessKey - Storage account key where backup will be taken to. - StorageAccessKey *string `json:"storageAccessKey,omitempty"` - // Password - Password for encryption on backup. - Password *string `json:"password,omitempty"` - // BackupSystemDbs - Include or exclude system databases from auto backup. - BackupSystemDbs *bool `json:"backupSystemDbs,omitempty"` - // BackupScheduleType - Backup schedule type. Possible values include: 'BackupScheduleTypeManual', 'BackupScheduleTypeAutomated' - BackupScheduleType BackupScheduleType `json:"backupScheduleType,omitempty"` - // FullBackupFrequency - Frequency of full backups. In both cases, full backups begin during the next scheduled time window. Possible values include: 'FullBackupFrequencyTypeDaily', 'FullBackupFrequencyTypeWeekly' - FullBackupFrequency FullBackupFrequencyType `json:"fullBackupFrequency,omitempty"` - // DaysOfWeek - Days of the week for the backups when FullBackupFrequency is set to Weekly. - DaysOfWeek *[]DaysOfWeek `json:"daysOfWeek,omitempty"` - // FullBackupStartTime - Start time of a given day during which full backups can take place. 0-23 hours. - FullBackupStartTime *int32 `json:"fullBackupStartTime,omitempty"` - // FullBackupWindowHours - Duration of the time window of a given day during which full backups can take place. 1-23 hours. - FullBackupWindowHours *int32 `json:"fullBackupWindowHours,omitempty"` - // LogBackupFrequency - Frequency of log backups. 5-60 minutes. - LogBackupFrequency *int32 `json:"logBackupFrequency,omitempty"` -} - -// AutoPatchingSettings set a patching window during which Windows and SQL patches will be applied. -type AutoPatchingSettings struct { - // Enable - Enable or disable autopatching on SQL virtual machine. - Enable *bool `json:"enable,omitempty"` - // DayOfWeek - Day of week to apply the patch on. Possible values include: 'DayOfWeekMonday', 'DayOfWeekTuesday', 'DayOfWeekWednesday', 'DayOfWeekThursday', 'DayOfWeekFriday', 'DayOfWeekSaturday', 'DayOfWeekSunday' - DayOfWeek DayOfWeek `json:"dayOfWeek,omitempty"` - // MaintenanceWindowStartingHour - Hour of the day when patching is initiated. Local VM time. - MaintenanceWindowStartingHour *int32 `json:"maintenanceWindowStartingHour,omitempty"` - // MaintenanceWindowDuration - Duration of patching. - MaintenanceWindowDuration *int32 `json:"maintenanceWindowDuration,omitempty"` -} - -// AvailabilityGroupListener a SQL Server availability group listener. -type AvailabilityGroupListener struct { - autorest.Response `json:"-"` - // AvailabilityGroupListenerProperties - Resource properties. - *AvailabilityGroupListenerProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AvailabilityGroupListener. -func (agl AvailabilityGroupListener) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if agl.AvailabilityGroupListenerProperties != nil { - objectMap["properties"] = agl.AvailabilityGroupListenerProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AvailabilityGroupListener struct. -func (agl *AvailabilityGroupListener) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var availabilityGroupListenerProperties AvailabilityGroupListenerProperties - err = json.Unmarshal(*v, &availabilityGroupListenerProperties) - if err != nil { - return err - } - agl.AvailabilityGroupListenerProperties = &availabilityGroupListenerProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - agl.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - agl.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - agl.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - agl.Type = &typeVar - } - } - } - - return nil -} - -// AvailabilityGroupListenerListResult a list of availability group listeners. -type AvailabilityGroupListenerListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]AvailabilityGroupListener `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for AvailabilityGroupListenerListResult. -func (agllr AvailabilityGroupListenerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AvailabilityGroupListenerListResultIterator provides access to a complete listing of -// AvailabilityGroupListener values. -type AvailabilityGroupListenerListResultIterator struct { - i int - page AvailabilityGroupListenerListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AvailabilityGroupListenerListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilityGroupListenerListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AvailabilityGroupListenerListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AvailabilityGroupListenerListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AvailabilityGroupListenerListResultIterator) Response() AvailabilityGroupListenerListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AvailabilityGroupListenerListResultIterator) Value() AvailabilityGroupListener { - if !iter.page.NotDone() { - return AvailabilityGroupListener{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AvailabilityGroupListenerListResultIterator type. -func NewAvailabilityGroupListenerListResultIterator(page AvailabilityGroupListenerListResultPage) AvailabilityGroupListenerListResultIterator { - return AvailabilityGroupListenerListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (agllr AvailabilityGroupListenerListResult) IsEmpty() bool { - return agllr.Value == nil || len(*agllr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (agllr AvailabilityGroupListenerListResult) hasNextLink() bool { - return agllr.NextLink != nil && len(*agllr.NextLink) != 0 -} - -// availabilityGroupListenerListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (agllr AvailabilityGroupListenerListResult) availabilityGroupListenerListResultPreparer(ctx context.Context) (*http.Request, error) { - if !agllr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(agllr.NextLink))) -} - -// AvailabilityGroupListenerListResultPage contains a page of AvailabilityGroupListener values. -type AvailabilityGroupListenerListResultPage struct { - fn func(context.Context, AvailabilityGroupListenerListResult) (AvailabilityGroupListenerListResult, error) - agllr AvailabilityGroupListenerListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AvailabilityGroupListenerListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailabilityGroupListenerListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.agllr) - if err != nil { - return err - } - page.agllr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AvailabilityGroupListenerListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AvailabilityGroupListenerListResultPage) NotDone() bool { - return !page.agllr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AvailabilityGroupListenerListResultPage) Response() AvailabilityGroupListenerListResult { - return page.agllr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AvailabilityGroupListenerListResultPage) Values() []AvailabilityGroupListener { - if page.agllr.IsEmpty() { - return nil - } - return *page.agllr.Value -} - -// Creates a new instance of the AvailabilityGroupListenerListResultPage type. -func NewAvailabilityGroupListenerListResultPage(cur AvailabilityGroupListenerListResult, getNextPage func(context.Context, AvailabilityGroupListenerListResult) (AvailabilityGroupListenerListResult, error)) AvailabilityGroupListenerListResultPage { - return AvailabilityGroupListenerListResultPage{ - fn: getNextPage, - agllr: cur, - } -} - -// AvailabilityGroupListenerProperties the properties of an availability group listener. -type AvailabilityGroupListenerProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state to track the async operation status. - ProvisioningState *string `json:"provisioningState,omitempty"` - // AvailabilityGroupName - Name of the availability group. - AvailabilityGroupName *string `json:"availabilityGroupName,omitempty"` - // LoadBalancerConfigurations - List of load balancer configurations for an availability group listener. - LoadBalancerConfigurations *[]LoadBalancerConfiguration `json:"loadBalancerConfigurations,omitempty"` - // CreateDefaultAvailabilityGroupIfNotExist - Create a default availability group if it does not exist. - CreateDefaultAvailabilityGroupIfNotExist *bool `json:"createDefaultAvailabilityGroupIfNotExist,omitempty"` - // Port - Listener port. - Port *int32 `json:"port,omitempty"` - // AvailabilityGroupConfiguration - Availability Group configuration. - AvailabilityGroupConfiguration *AgConfiguration `json:"availabilityGroupConfiguration,omitempty"` -} - -// MarshalJSON is the custom marshaler for AvailabilityGroupListenerProperties. -func (aglp AvailabilityGroupListenerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aglp.AvailabilityGroupName != nil { - objectMap["availabilityGroupName"] = aglp.AvailabilityGroupName - } - if aglp.LoadBalancerConfigurations != nil { - objectMap["loadBalancerConfigurations"] = aglp.LoadBalancerConfigurations - } - if aglp.CreateDefaultAvailabilityGroupIfNotExist != nil { - objectMap["createDefaultAvailabilityGroupIfNotExist"] = aglp.CreateDefaultAvailabilityGroupIfNotExist - } - if aglp.Port != nil { - objectMap["port"] = aglp.Port - } - if aglp.AvailabilityGroupConfiguration != nil { - objectMap["availabilityGroupConfiguration"] = aglp.AvailabilityGroupConfiguration - } - return json.Marshal(objectMap) -} - -// AvailabilityGroupListenersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type AvailabilityGroupListenersCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AvailabilityGroupListenersClient) (AvailabilityGroupListener, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AvailabilityGroupListenersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AvailabilityGroupListenersCreateOrUpdateFuture.Result. -func (future *AvailabilityGroupListenersCreateOrUpdateFuture) result(client AvailabilityGroupListenersClient) (agl AvailabilityGroupListener, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - agl.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sqlvirtualmachine.AvailabilityGroupListenersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if agl.Response.Response, err = future.GetResult(sender); err == nil && agl.Response.Response.StatusCode != http.StatusNoContent { - agl, err = client.CreateOrUpdateResponder(agl.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersCreateOrUpdateFuture", "Result", agl.Response.Response, "Failure responding to request") - } - } - return -} - -// AvailabilityGroupListenersDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type AvailabilityGroupListenersDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AvailabilityGroupListenersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AvailabilityGroupListenersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AvailabilityGroupListenersDeleteFuture.Result. -func (future *AvailabilityGroupListenersDeleteFuture) result(client AvailabilityGroupListenersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.AvailabilityGroupListenersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sqlvirtualmachine.AvailabilityGroupListenersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// Group a SQL virtual machine group. -type Group struct { - autorest.Response `json:"-"` - // GroupProperties - Resource properties. - *GroupProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Group. -func (g Group) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if g.GroupProperties != nil { - objectMap["properties"] = g.GroupProperties - } - if g.Location != nil { - objectMap["location"] = g.Location - } - if g.Tags != nil { - objectMap["tags"] = g.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Group struct. -func (g *Group) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var groupProperties GroupProperties - err = json.Unmarshal(*v, &groupProperties) - if err != nil { - return err - } - g.GroupProperties = &groupProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - g.SystemData = &systemData - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - g.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - g.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - g.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - g.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - g.Type = &typeVar - } - } - } - - return nil -} - -// GroupListResult a list of SQL virtual machine groups. -type GroupListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]Group `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupListResult. -func (glr GroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// GroupListResultIterator provides access to a complete listing of Group values. -type GroupListResultIterator struct { - i int - page GroupListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *GroupListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *GroupListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter GroupListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter GroupListResultIterator) Response() GroupListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter GroupListResultIterator) Value() Group { - if !iter.page.NotDone() { - return Group{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the GroupListResultIterator type. -func NewGroupListResultIterator(page GroupListResultPage) GroupListResultIterator { - return GroupListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (glr GroupListResult) IsEmpty() bool { - return glr.Value == nil || len(*glr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (glr GroupListResult) hasNextLink() bool { - return glr.NextLink != nil && len(*glr.NextLink) != 0 -} - -// groupListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (glr GroupListResult) groupListResultPreparer(ctx context.Context) (*http.Request, error) { - if !glr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(glr.NextLink))) -} - -// GroupListResultPage contains a page of Group values. -type GroupListResultPage struct { - fn func(context.Context, GroupListResult) (GroupListResult, error) - glr GroupListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *GroupListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/GroupListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.glr) - if err != nil { - return err - } - page.glr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *GroupListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page GroupListResultPage) NotDone() bool { - return !page.glr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page GroupListResultPage) Response() GroupListResult { - return page.glr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page GroupListResultPage) Values() []Group { - if page.glr.IsEmpty() { - return nil - } - return *page.glr.Value -} - -// Creates a new instance of the GroupListResultPage type. -func NewGroupListResultPage(cur GroupListResult, getNextPage func(context.Context, GroupListResult) (GroupListResult, error)) GroupListResultPage { - return GroupListResultPage{ - fn: getNextPage, - glr: cur, - } -} - -// GroupProperties the properties of a SQL virtual machine group. -type GroupProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state to track the async operation status. - ProvisioningState *string `json:"provisioningState,omitempty"` - // SQLImageOffer - SQL image offer. Examples may include SQL2016-WS2016, SQL2017-WS2016. - SQLImageOffer *string `json:"sqlImageOffer,omitempty"` - // SQLImageSku - SQL image sku. Possible values include: 'SQLVMGroupImageSkuDeveloper', 'SQLVMGroupImageSkuEnterprise' - SQLImageSku SQLVMGroupImageSku `json:"sqlImageSku,omitempty"` - // ScaleType - READ-ONLY; Scale type. Possible values include: 'ScaleTypeHA' - ScaleType ScaleType `json:"scaleType,omitempty"` - // ClusterManagerType - READ-ONLY; Type of cluster manager: Windows Server Failover Cluster (WSFC), implied by the scale type of the group and the OS type. Possible values include: 'ClusterManagerTypeWSFC' - ClusterManagerType ClusterManagerType `json:"clusterManagerType,omitempty"` - // ClusterConfiguration - READ-ONLY; Cluster type. Possible values include: 'ClusterConfigurationDomainful' - ClusterConfiguration ClusterConfiguration `json:"clusterConfiguration,omitempty"` - // WsfcDomainProfile - Cluster Active Directory domain profile. - WsfcDomainProfile *WsfcDomainProfile `json:"wsfcDomainProfile,omitempty"` -} - -// MarshalJSON is the custom marshaler for GroupProperties. -func (gp GroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gp.SQLImageOffer != nil { - objectMap["sqlImageOffer"] = gp.SQLImageOffer - } - if gp.SQLImageSku != "" { - objectMap["sqlImageSku"] = gp.SQLImageSku - } - if gp.WsfcDomainProfile != nil { - objectMap["wsfcDomainProfile"] = gp.WsfcDomainProfile - } - return json.Marshal(objectMap) -} - -// GroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type GroupsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GroupsClient) (Group, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GroupsCreateOrUpdateFuture.Result. -func (future *GroupsCreateOrUpdateFuture) result(client GroupsClient) (g Group, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - g.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sqlvirtualmachine.GroupsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if g.Response.Response, err = future.GetResult(sender); err == nil && g.Response.Response.StatusCode != http.StatusNoContent { - g, err = client.CreateOrUpdateResponder(g.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsCreateOrUpdateFuture", "Result", g.Response.Response, "Failure responding to request") - } - } - return -} - -// GroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type GroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GroupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GroupsDeleteFuture.Result. -func (future *GroupsDeleteFuture) result(client GroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sqlvirtualmachine.GroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// GroupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type GroupsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(GroupsClient) (Group, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *GroupsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for GroupsUpdateFuture.Result. -func (future *GroupsUpdateFuture) result(client GroupsClient) (g Group, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - g.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sqlvirtualmachine.GroupsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if g.Response.Response, err = future.GetResult(sender); err == nil && g.Response.Response.StatusCode != http.StatusNoContent { - g, err = client.UpdateResponder(g.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.GroupsUpdateFuture", "Result", g.Response.Response, "Failure responding to request") - } - } - return -} - -// GroupUpdate an update to a SQL virtual machine group. -type GroupUpdate struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for GroupUpdate. -func (gu GroupUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if gu.Tags != nil { - objectMap["tags"] = gu.Tags - } - return json.Marshal(objectMap) -} - -// KeyVaultCredentialSettings configure your SQL virtual machine to be able to connect to the Azure Key -// Vault service. -type KeyVaultCredentialSettings struct { - // Enable - Enable or disable key vault credential setting. - Enable *bool `json:"enable,omitempty"` - // CredentialName - Credential name. - CredentialName *string `json:"credentialName,omitempty"` - // AzureKeyVaultURL - Azure Key Vault url. - AzureKeyVaultURL *string `json:"azureKeyVaultUrl,omitempty"` - // ServicePrincipalName - Service principal name to access key vault. - ServicePrincipalName *string `json:"servicePrincipalName,omitempty"` - // ServicePrincipalSecret - Service principal name secret to access key vault. - ServicePrincipalSecret *string `json:"servicePrincipalSecret,omitempty"` -} - -// ListResult a list of SQL virtual machines. -type ListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]SQLVirtualMachine `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListResult. -func (lr ListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ListResultIterator provides access to a complete listing of SQLVirtualMachine values. -type ListResultIterator struct { - i int - page ListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListResultIterator) Response() ListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListResultIterator) Value() SQLVirtualMachine { - if !iter.page.NotDone() { - return SQLVirtualMachine{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListResultIterator type. -func NewListResultIterator(page ListResultPage) ListResultIterator { - return ListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lr ListResult) IsEmpty() bool { - return lr.Value == nil || len(*lr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lr ListResult) hasNextLink() bool { - return lr.NextLink != nil && len(*lr.NextLink) != 0 -} - -// listResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { - if !lr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lr.NextLink))) -} - -// ListResultPage contains a page of SQLVirtualMachine values. -type ListResultPage struct { - fn func(context.Context, ListResult) (ListResult, error) - lr ListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lr) - if err != nil { - return err - } - page.lr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListResultPage) NotDone() bool { - return !page.lr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListResultPage) Response() ListResult { - return page.lr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListResultPage) Values() []SQLVirtualMachine { - if page.lr.IsEmpty() { - return nil - } - return *page.lr.Value -} - -// Creates a new instance of the ListResultPage type. -func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { - return ListResultPage{ - fn: getNextPage, - lr: cur, - } -} - -// LoadBalancerConfiguration a load balancer configuration for an availability group listener. -type LoadBalancerConfiguration struct { - // PrivateIPAddress - Private IP address. - PrivateIPAddress *PrivateIPAddress `json:"privateIpAddress,omitempty"` - // PublicIPAddressResourceID - Resource id of the public IP. - PublicIPAddressResourceID *string `json:"publicIpAddressResourceId,omitempty"` - // LoadBalancerResourceID - Resource id of the load balancer. - LoadBalancerResourceID *string `json:"loadBalancerResourceId,omitempty"` - // ProbePort - Probe port. - ProbePort *int32 `json:"probePort,omitempty"` - // SQLVirtualMachineInstances - List of the SQL virtual machine instance resource id's that are enrolled into the availability group listener. - SQLVirtualMachineInstances *[]string `json:"sqlVirtualMachineInstances,omitempty"` -} - -// Operation SQL REST API operation definition. -type Operation struct { - // Name - READ-ONLY; The name of the operation being performed on this particular object. - Name *string `json:"name,omitempty"` - // Display - READ-ONLY; The localized display information for this particular operation / action. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - READ-ONLY; The intended executor of the operation. Possible values include: 'OperationOriginUser', 'OperationOriginSystem' - Origin OperationOrigin `json:"origin,omitempty"` - // Properties - READ-ONLY; Additional descriptions for the operation. - Properties map[string]interface{} `json:"properties"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - READ-ONLY; The localized friendly form of the resource provider name. - Provider *string `json:"provider,omitempty"` - // Resource - READ-ONLY; The localized friendly form of the resource type related to this action/operation. - Resource *string `json:"resource,omitempty"` - // Operation - READ-ONLY; The localized friendly name for the operation. - Operation *string `json:"operation,omitempty"` - // Description - READ-ONLY; The localized friendly description for the operation. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationDisplay. -func (od OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResult result of the request to list SQL operations. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Array of results. - Value *[]Operation `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationListResult. -func (olr OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// PrivateIPAddress a private IP address bound to the availability group listener. -type PrivateIPAddress struct { - // IPAddress - Private IP address bound to the availability group listener. - IPAddress *string `json:"ipAddress,omitempty"` - // SubnetResourceID - Subnet used to include private IP. - SubnetResourceID *string `json:"subnetResourceId,omitempty"` -} - -// Properties the SQL virtual machine properties. -type Properties struct { - // VirtualMachineResourceID - ARM Resource id of underlying virtual machine created from SQL marketplace image. - VirtualMachineResourceID *string `json:"virtualMachineResourceId,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state to track the async operation status. - ProvisioningState *string `json:"provisioningState,omitempty"` - // SQLImageOffer - SQL image offer. Examples include SQL2016-WS2016, SQL2017-WS2016. - SQLImageOffer *string `json:"sqlImageOffer,omitempty"` - // SQLServerLicenseType - SQL Server license type. Possible values include: 'SQLServerLicenseTypePAYG', 'SQLServerLicenseTypeAHUB', 'SQLServerLicenseTypeDR' - SQLServerLicenseType SQLServerLicenseType `json:"sqlServerLicenseType,omitempty"` - // SQLManagement - SQL Server Management type. Possible values include: 'SQLManagementModeFull', 'SQLManagementModeLightWeight', 'SQLManagementModeNoAgent' - SQLManagement SQLManagementMode `json:"sqlManagement,omitempty"` - // SQLImageSku - SQL Server edition type. Possible values include: 'SQLImageSkuDeveloper', 'SQLImageSkuExpress', 'SQLImageSkuStandard', 'SQLImageSkuEnterprise', 'SQLImageSkuWeb' - SQLImageSku SQLImageSku `json:"sqlImageSku,omitempty"` - // SQLVirtualMachineGroupResourceID - ARM resource id of the SQL virtual machine group this SQL virtual machine is or will be part of. - SQLVirtualMachineGroupResourceID *string `json:"sqlVirtualMachineGroupResourceId,omitempty"` - // WsfcDomainCredentials - Domain credentials for setting up Windows Server Failover Cluster for SQL availability group. - WsfcDomainCredentials *WsfcDomainCredentials `json:"wsfcDomainCredentials,omitempty"` - // AutoPatchingSettings - Auto patching settings for applying critical security updates to SQL virtual machine. - AutoPatchingSettings *AutoPatchingSettings `json:"autoPatchingSettings,omitempty"` - // AutoBackupSettings - Auto backup settings for SQL Server. - AutoBackupSettings *AutoBackupSettings `json:"autoBackupSettings,omitempty"` - // KeyVaultCredentialSettings - Key vault credential settings. - KeyVaultCredentialSettings *KeyVaultCredentialSettings `json:"keyVaultCredentialSettings,omitempty"` - // ServerConfigurationsManagementSettings - SQL Server configuration management settings. - ServerConfigurationsManagementSettings *ServerConfigurationsManagementSettings `json:"serverConfigurationsManagementSettings,omitempty"` - // StorageConfigurationSettings - Storage Configuration Settings. - StorageConfigurationSettings *StorageConfigurationSettings `json:"storageConfigurationSettings,omitempty"` - // AssessmentSettings - Assessment Settings. - AssessmentSettings *AssessmentSettings `json:"assessmentSettings,omitempty"` -} - -// MarshalJSON is the custom marshaler for Properties. -func (p Properties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if p.VirtualMachineResourceID != nil { - objectMap["virtualMachineResourceId"] = p.VirtualMachineResourceID - } - if p.SQLImageOffer != nil { - objectMap["sqlImageOffer"] = p.SQLImageOffer - } - if p.SQLServerLicenseType != "" { - objectMap["sqlServerLicenseType"] = p.SQLServerLicenseType - } - if p.SQLManagement != "" { - objectMap["sqlManagement"] = p.SQLManagement - } - if p.SQLImageSku != "" { - objectMap["sqlImageSku"] = p.SQLImageSku - } - if p.SQLVirtualMachineGroupResourceID != nil { - objectMap["sqlVirtualMachineGroupResourceId"] = p.SQLVirtualMachineGroupResourceID - } - if p.WsfcDomainCredentials != nil { - objectMap["wsfcDomainCredentials"] = p.WsfcDomainCredentials - } - if p.AutoPatchingSettings != nil { - objectMap["autoPatchingSettings"] = p.AutoPatchingSettings - } - if p.AutoBackupSettings != nil { - objectMap["autoBackupSettings"] = p.AutoBackupSettings - } - if p.KeyVaultCredentialSettings != nil { - objectMap["keyVaultCredentialSettings"] = p.KeyVaultCredentialSettings - } - if p.ServerConfigurationsManagementSettings != nil { - objectMap["serverConfigurationsManagementSettings"] = p.ServerConfigurationsManagementSettings - } - if p.StorageConfigurationSettings != nil { - objectMap["storageConfigurationSettings"] = p.StorageConfigurationSettings - } - if p.AssessmentSettings != nil { - objectMap["assessmentSettings"] = p.AssessmentSettings - } - return json.Marshal(objectMap) -} - -// ProxyResource ARM proxy resource. -type ProxyResource struct { - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Resource ARM resource. -type Resource struct { - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceIdentity azure Active Directory identity configuration for a resource. -type ResourceIdentity struct { - // PrincipalID - READ-ONLY; The Azure Active Directory principal id. - PrincipalID *uuid.UUID `json:"principalId,omitempty"` - // Type - The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory principal for the resource. Possible values include: 'IdentityTypeNone', 'IdentityTypeSystemAssigned' - Type IdentityType `json:"type,omitempty"` - // TenantID - READ-ONLY; The Azure Active Directory tenant id. - TenantID *uuid.UUID `json:"tenantId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceIdentity. -func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ri.Type != "" { - objectMap["type"] = ri.Type - } - return json.Marshal(objectMap) -} - -// Schedule ... -type Schedule struct { - // Enable - Enable or disable assessment schedule on SQL virtual machine. - Enable *bool `json:"enable,omitempty"` - // WeeklyInterval - Number of weeks to schedule between 2 assessment runs. Takes value from 1-6 - WeeklyInterval *int32 `json:"weeklyInterval,omitempty"` - // MonthlyOccurrence - Occurrence of the DayOfWeek day within a month to schedule assessment. Takes values: 1,2,3,4 and -1. Use -1 for last DayOfWeek day of the month - MonthlyOccurrence *int32 `json:"monthlyOccurrence,omitempty"` - // DayOfWeek - Day of the week to run assessment. Possible values include: 'DayOfWeekMonday', 'DayOfWeekTuesday', 'DayOfWeekWednesday', 'DayOfWeekThursday', 'DayOfWeekFriday', 'DayOfWeekSaturday', 'DayOfWeekSunday' - DayOfWeek DayOfWeek `json:"dayOfWeek,omitempty"` - // StartTime - Time of the day in HH:mm format. Eg. 17:30 - StartTime *string `json:"startTime,omitempty"` -} - -// ServerConfigurationsManagementSettings set the connectivity, storage and workload settings. -type ServerConfigurationsManagementSettings struct { - // SQLConnectivityUpdateSettings - SQL connectivity type settings. - SQLConnectivityUpdateSettings *SQLConnectivityUpdateSettings `json:"sqlConnectivityUpdateSettings,omitempty"` - // SQLWorkloadTypeUpdateSettings - SQL workload type settings. - SQLWorkloadTypeUpdateSettings *SQLWorkloadTypeUpdateSettings `json:"sqlWorkloadTypeUpdateSettings,omitempty"` - // SQLStorageUpdateSettings - SQL storage update settings. - SQLStorageUpdateSettings *SQLStorageUpdateSettings `json:"sqlStorageUpdateSettings,omitempty"` - // AdditionalFeaturesServerConfigurations - Additional SQL feature settings. - AdditionalFeaturesServerConfigurations *AdditionalFeaturesServerConfigurations `json:"additionalFeaturesServerConfigurations,omitempty"` - // SQLInstanceSettings - SQL Instance settings. - SQLInstanceSettings *SQLInstanceSettings `json:"sqlInstanceSettings,omitempty"` -} - -// SQLConnectivityUpdateSettings set the access level and network port settings for SQL Server. -type SQLConnectivityUpdateSettings struct { - // ConnectivityType - SQL Server connectivity option. Possible values include: 'ConnectivityTypeLOCAL', 'ConnectivityTypePRIVATE', 'ConnectivityTypePUBLIC' - ConnectivityType ConnectivityType `json:"connectivityType,omitempty"` - // Port - SQL Server port. - Port *int32 `json:"port,omitempty"` - // SQLAuthUpdateUserName - SQL Server sysadmin login to create. - SQLAuthUpdateUserName *string `json:"sqlAuthUpdateUserName,omitempty"` - // SQLAuthUpdatePassword - SQL Server sysadmin login password. - SQLAuthUpdatePassword *string `json:"sqlAuthUpdatePassword,omitempty"` -} - -// SQLInstanceSettings set the server/instance-level settings for SQL Server. -type SQLInstanceSettings struct { - // Collation - SQL Server Collation. - Collation *string `json:"collation,omitempty"` - // MaxDop - SQL Server MAXDOP. - MaxDop *int32 `json:"maxDop,omitempty"` - // IsOptimizeForAdHocWorkloadsEnabled - SQL Server Optimize for Adhoc workloads. - IsOptimizeForAdHocWorkloadsEnabled *bool `json:"isOptimizeForAdHocWorkloadsEnabled,omitempty"` - // MinServerMemoryMB - SQL Server minimum memory. - MinServerMemoryMB *int32 `json:"minServerMemoryMB,omitempty"` - // MaxServerMemoryMB - SQL Server maximum memory. - MaxServerMemoryMB *int32 `json:"maxServerMemoryMB,omitempty"` -} - -// SQLStorageSettings set disk storage settings for SQL Server. -type SQLStorageSettings struct { - // Luns - Logical Unit Numbers for the disks. - Luns *[]int32 `json:"luns,omitempty"` - // DefaultFilePath - SQL Server default file path - DefaultFilePath *string `json:"defaultFilePath,omitempty"` -} - -// SQLStorageUpdateSettings set disk storage settings for SQL Server. -type SQLStorageUpdateSettings struct { - // DiskCount - Virtual machine disk count. - DiskCount *int32 `json:"diskCount,omitempty"` - // StartingDeviceID - Device id of the first disk to be updated. - StartingDeviceID *int32 `json:"startingDeviceId,omitempty"` - // DiskConfigurationType - Disk configuration to apply to SQL Server. Possible values include: 'DiskConfigurationTypeNEW', 'DiskConfigurationTypeEXTEND', 'DiskConfigurationTypeADD' - DiskConfigurationType DiskConfigurationType `json:"diskConfigurationType,omitempty"` -} - -// SQLTempDbSettings ... -type SQLTempDbSettings struct { - // DataFileSize - SQL Server default file size - DataFileSize *int32 `json:"dataFileSize,omitempty"` - // DataGrowth - SQL Server default file autoGrowth size - DataGrowth *int32 `json:"dataGrowth,omitempty"` - // LogFileSize - SQL Server default file size - LogFileSize *int32 `json:"logFileSize,omitempty"` - // LogGrowth - SQL Server default file autoGrowth size - LogGrowth *int32 `json:"logGrowth,omitempty"` - // DataFileCount - SQL Server default file count - DataFileCount *int32 `json:"dataFileCount,omitempty"` - // Luns - Logical Unit Numbers for the disks. - Luns *[]int32 `json:"luns,omitempty"` - // DefaultFilePath - SQL Server default file path - DefaultFilePath *string `json:"defaultFilePath,omitempty"` -} - -// SQLVirtualMachine a SQL virtual machine. -type SQLVirtualMachine struct { - autorest.Response `json:"-"` - // Identity - Azure Active Directory identity of the server. - Identity *ResourceIdentity `json:"identity,omitempty"` - // Properties - Resource properties. - *Properties `json:"properties,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SQLVirtualMachine. -func (svm SQLVirtualMachine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if svm.Identity != nil { - objectMap["identity"] = svm.Identity - } - if svm.Properties != nil { - objectMap["properties"] = svm.Properties - } - if svm.Location != nil { - objectMap["location"] = svm.Location - } - if svm.Tags != nil { - objectMap["tags"] = svm.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SQLVirtualMachine struct. -func (svm *SQLVirtualMachine) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "identity": - if v != nil { - var identity ResourceIdentity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - svm.Identity = &identity - } - case "properties": - if v != nil { - var properties Properties - err = json.Unmarshal(*v, &properties) - if err != nil { - return err - } - svm.Properties = &properties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - svm.SystemData = &systemData - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - svm.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - svm.Tags = tags - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - svm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - svm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - svm.Type = &typeVar - } - } - } - - return nil -} - -// SQLVirtualMachinesCreateOrUpdateFutureType an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLVirtualMachinesCreateOrUpdateFutureType struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLVirtualMachinesClient) (SQLVirtualMachine, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLVirtualMachinesCreateOrUpdateFutureType) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SQLVirtualMachinesCreateOrUpdateFutureType.Result. -func (future *SQLVirtualMachinesCreateOrUpdateFutureType) result(client SQLVirtualMachinesClient) (svm SQLVirtualMachine, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesCreateOrUpdateFutureType", "Result", future.Response(), "Polling failure") - return - } - if !done { - svm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sqlvirtualmachine.SQLVirtualMachinesCreateOrUpdateFutureType") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if svm.Response.Response, err = future.GetResult(sender); err == nil && svm.Response.Response.StatusCode != http.StatusNoContent { - svm, err = client.CreateOrUpdateResponder(svm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesCreateOrUpdateFutureType", "Result", svm.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLVirtualMachinesDeleteFutureType an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLVirtualMachinesDeleteFutureType struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLVirtualMachinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLVirtualMachinesDeleteFutureType) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SQLVirtualMachinesDeleteFutureType.Result. -func (future *SQLVirtualMachinesDeleteFutureType) result(client SQLVirtualMachinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesDeleteFutureType", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sqlvirtualmachine.SQLVirtualMachinesDeleteFutureType") - return - } - ar.Response = future.Response() - return -} - -// SQLVirtualMachinesRedeployFutureType an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLVirtualMachinesRedeployFutureType struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLVirtualMachinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLVirtualMachinesRedeployFutureType) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SQLVirtualMachinesRedeployFutureType.Result. -func (future *SQLVirtualMachinesRedeployFutureType) result(client SQLVirtualMachinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesRedeployFutureType", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sqlvirtualmachine.SQLVirtualMachinesRedeployFutureType") - return - } - ar.Response = future.Response() - return -} - -// SQLVirtualMachinesStartAssessmentFutureType an abstraction for monitoring and retrieving the results of -// a long-running operation. -type SQLVirtualMachinesStartAssessmentFutureType struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLVirtualMachinesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLVirtualMachinesStartAssessmentFutureType) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SQLVirtualMachinesStartAssessmentFutureType.Result. -func (future *SQLVirtualMachinesStartAssessmentFutureType) result(client SQLVirtualMachinesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesStartAssessmentFutureType", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sqlvirtualmachine.SQLVirtualMachinesStartAssessmentFutureType") - return - } - ar.Response = future.Response() - return -} - -// SQLVirtualMachinesUpdateFutureType an abstraction for monitoring and retrieving the results of a -// long-running operation. -type SQLVirtualMachinesUpdateFutureType struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SQLVirtualMachinesClient) (SQLVirtualMachine, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SQLVirtualMachinesUpdateFutureType) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SQLVirtualMachinesUpdateFutureType.Result. -func (future *SQLVirtualMachinesUpdateFutureType) result(client SQLVirtualMachinesClient) (svm SQLVirtualMachine, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesUpdateFutureType", "Result", future.Response(), "Polling failure") - return - } - if !done { - svm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("sqlvirtualmachine.SQLVirtualMachinesUpdateFutureType") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if svm.Response.Response, err = future.GetResult(sender); err == nil && svm.Response.Response.StatusCode != http.StatusNoContent { - svm, err = client.UpdateResponder(svm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesUpdateFutureType", "Result", svm.Response.Response, "Failure responding to request") - } - } - return -} - -// SQLWorkloadTypeUpdateSettings set workload type to optimize storage for SQL Server. -type SQLWorkloadTypeUpdateSettings struct { - // SQLWorkloadType - SQL Server workload type. Possible values include: 'SQLWorkloadTypeGENERAL', 'SQLWorkloadTypeOLTP', 'SQLWorkloadTypeDW' - SQLWorkloadType SQLWorkloadType `json:"sqlWorkloadType,omitempty"` -} - -// StorageConfigurationSettings storage Configurations for SQL Data, Log and TempDb. -type StorageConfigurationSettings struct { - // SQLDataSettings - SQL Server Data Storage Settings. - SQLDataSettings *SQLStorageSettings `json:"sqlDataSettings,omitempty"` - // SQLLogSettings - SQL Server Log Storage Settings. - SQLLogSettings *SQLStorageSettings `json:"sqlLogSettings,omitempty"` - // SQLTempDbSettings - SQL Server TempDb Storage Settings. - SQLTempDbSettings *SQLTempDbSettings `json:"sqlTempDbSettings,omitempty"` - // SQLSystemDbOnDataDisk - SQL Server SystemDb Storage on DataPool if true. - SQLSystemDbOnDataDisk *bool `json:"sqlSystemDbOnDataDisk,omitempty"` - // DiskConfigurationType - Disk configuration to apply to SQL Server. Possible values include: 'DiskConfigurationTypeNEW', 'DiskConfigurationTypeEXTEND', 'DiskConfigurationTypeADD' - DiskConfigurationType DiskConfigurationType `json:"diskConfigurationType,omitempty"` - // StorageWorkloadType - Storage workload type. Possible values include: 'StorageWorkloadTypeGENERAL', 'StorageWorkloadTypeOLTP', 'StorageWorkloadTypeDW' - StorageWorkloadType StorageWorkloadType `json:"storageWorkloadType,omitempty"` -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TrackedResource ARM tracked top level resource. -type TrackedResource struct { - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; Resource ID. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Location != nil { - objectMap["location"] = tr.Location - } - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - return json.Marshal(objectMap) -} - -// Update an update to a SQL virtual machine. -type Update struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Update. -func (u Update) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if u.Tags != nil { - objectMap["tags"] = u.Tags - } - return json.Marshal(objectMap) -} - -// WsfcDomainCredentials domain credentials for setting up Windows Server Failover Cluster for SQL -// availability group. -type WsfcDomainCredentials struct { - // ClusterBootstrapAccountPassword - Cluster bootstrap account password. - ClusterBootstrapAccountPassword *string `json:"clusterBootstrapAccountPassword,omitempty"` - // ClusterOperatorAccountPassword - Cluster operator account password. - ClusterOperatorAccountPassword *string `json:"clusterOperatorAccountPassword,omitempty"` - // SQLServiceAccountPassword - SQL service account password. - SQLServiceAccountPassword *string `json:"sqlServiceAccountPassword,omitempty"` -} - -// WsfcDomainProfile active Directory account details to operate Windows Server Failover Cluster. -type WsfcDomainProfile struct { - // DomainFqdn - Fully qualified name of the domain. - DomainFqdn *string `json:"domainFqdn,omitempty"` - // OuPath - Organizational Unit path in which the nodes and cluster will be present. - OuPath *string `json:"ouPath,omitempty"` - // ClusterBootstrapAccount - Account name used for creating cluster (at minimum needs permissions to 'Create Computer Objects' in domain). - ClusterBootstrapAccount *string `json:"clusterBootstrapAccount,omitempty"` - // ClusterOperatorAccount - Account name used for operating cluster i.e. will be part of administrators group on all the participating virtual machines in the cluster. - ClusterOperatorAccount *string `json:"clusterOperatorAccount,omitempty"` - // SQLServiceAccount - Account name under which SQL service will run on all participating SQL virtual machines in the cluster. - SQLServiceAccount *string `json:"sqlServiceAccount,omitempty"` - // FileShareWitnessPath - Optional path for fileshare witness. - FileShareWitnessPath *string `json:"fileShareWitnessPath,omitempty"` - // StorageAccountURL - Fully qualified ARM resource id of the witness storage account. - StorageAccountURL *string `json:"storageAccountUrl,omitempty"` - // StorageAccountPrimaryKey - Primary key of the witness storage account. - StorageAccountPrimaryKey *string `json:"storageAccountPrimaryKey,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/operations.go deleted file mode 100644 index 4386fc4dce2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/operations.go +++ /dev/null @@ -1,142 +0,0 @@ -package sqlvirtualmachine - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the the SQL virtual machine management API provides a RESTful set of web APIs that interact with -// Azure Compute, Network & Storage services to manage your SQL Server virtual machine. The API enables users to -// create, delete and retrieve a SQL virtual machine, SQL virtual machine group or availability group listener. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available SQL Virtual Machine Rest API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.SqlVirtualMachine/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sqlvirtualmachine.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sqlvirtualmachine.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/sqlvirtualmachines.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/sqlvirtualmachines.go deleted file mode 100644 index f0f611ec79b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/sqlvirtualmachines.go +++ /dev/null @@ -1,869 +0,0 @@ -package sqlvirtualmachine - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SQLVirtualMachinesClient is the the SQL virtual machine management API provides a RESTful set of web APIs that -// interact with Azure Compute, Network & Storage services to manage your SQL Server virtual machine. The API enables -// users to create, delete and retrieve a SQL virtual machine, SQL virtual machine group or availability group -// listener. -type SQLVirtualMachinesClient struct { - BaseClient -} - -// NewSQLVirtualMachinesClient creates an instance of the SQLVirtualMachinesClient client. -func NewSQLVirtualMachinesClient(subscriptionID string) SQLVirtualMachinesClient { - return NewSQLVirtualMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSQLVirtualMachinesClientWithBaseURI creates an instance of the SQLVirtualMachinesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewSQLVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string) SQLVirtualMachinesClient { - return SQLVirtualMachinesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates a SQL virtual machine. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -// SQLVirtualMachineName - name of the SQL virtual machine. -// parameters - the SQL virtual machine. -func (client SQLVirtualMachinesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string, parameters SQLVirtualMachine) (result SQLVirtualMachinesCreateOrUpdateFutureType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLVirtualMachinesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, SQLVirtualMachineName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client SQLVirtualMachinesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string, parameters SQLVirtualMachine) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlVirtualMachineName": autorest.Encode("path", SQLVirtualMachineName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client SQLVirtualMachinesClient) CreateOrUpdateSender(req *http.Request) (future SQLVirtualMachinesCreateOrUpdateFutureType, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client SQLVirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response) (result SQLVirtualMachine, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a SQL virtual machine. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -// SQLVirtualMachineName - name of the SQL virtual machine. -func (client SQLVirtualMachinesClient) Delete(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string) (result SQLVirtualMachinesDeleteFutureType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLVirtualMachinesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, SQLVirtualMachineName) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SQLVirtualMachinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlVirtualMachineName": autorest.Encode("path", SQLVirtualMachineName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SQLVirtualMachinesClient) DeleteSender(req *http.Request) (future SQLVirtualMachinesDeleteFutureType, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SQLVirtualMachinesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a SQL virtual machine. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -// SQLVirtualMachineName - name of the SQL virtual machine. -// expand - the child resources to include in the response. -func (client SQLVirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string, expand string) (result SQLVirtualMachine, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLVirtualMachinesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, SQLVirtualMachineName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SQLVirtualMachinesClient) GetPreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string, expand string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlVirtualMachineName": autorest.Encode("path", SQLVirtualMachineName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(expand) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SQLVirtualMachinesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SQLVirtualMachinesClient) GetResponder(resp *http.Response) (result SQLVirtualMachine, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets all SQL virtual machines in a subscription. -func (client SQLVirtualMachinesClient) List(ctx context.Context) (result ListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLVirtualMachinesClient.List") - defer func() { - sc := -1 - if result.lr.Response.Response != nil { - sc = result.lr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.lr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "List", resp, "Failure sending request") - return - } - - result.lr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "List", resp, "Failure responding to request") - return - } - if result.lr.hasNextLink() && result.lr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SQLVirtualMachinesClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SQLVirtualMachinesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SQLVirtualMachinesClient) ListResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client SQLVirtualMachinesClient) listNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.listResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLVirtualMachinesClient) ListComplete(ctx context.Context) (result ListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLVirtualMachinesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup gets all SQL virtual machines in a resource group. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -func (client SQLVirtualMachinesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLVirtualMachinesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.lr.Response.Response != nil { - sc = result.lr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.lr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.lr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.lr.hasNextLink() && result.lr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client SQLVirtualMachinesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client SQLVirtualMachinesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client SQLVirtualMachinesClient) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client SQLVirtualMachinesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.listResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLVirtualMachinesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLVirtualMachinesClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListBySQLVMGroup gets the list of sql virtual machines in a SQL virtual machine group. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -// SQLVirtualMachineGroupName - name of the SQL virtual machine group. -func (client SQLVirtualMachinesClient) ListBySQLVMGroup(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string) (result ListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLVirtualMachinesClient.ListBySQLVMGroup") - defer func() { - sc := -1 - if result.lr.Response.Response != nil { - sc = result.lr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySQLVMGroupNextResults - req, err := client.ListBySQLVMGroupPreparer(ctx, resourceGroupName, SQLVirtualMachineGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "ListBySQLVMGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySQLVMGroupSender(req) - if err != nil { - result.lr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "ListBySQLVMGroup", resp, "Failure sending request") - return - } - - result.lr, err = client.ListBySQLVMGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "ListBySQLVMGroup", resp, "Failure responding to request") - return - } - if result.lr.hasNextLink() && result.lr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySQLVMGroupPreparer prepares the ListBySQLVMGroup request. -func (client SQLVirtualMachinesClient) ListBySQLVMGroupPreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlVirtualMachineGroupName": autorest.Encode("path", SQLVirtualMachineGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}/sqlVirtualMachines", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySQLVMGroupSender sends the ListBySQLVMGroup request. The method will close the -// http.Response Body if it receives an error. -func (client SQLVirtualMachinesClient) ListBySQLVMGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySQLVMGroupResponder handles the response to the ListBySQLVMGroup request. The method always -// closes the http.Response Body. -func (client SQLVirtualMachinesClient) ListBySQLVMGroupResponder(resp *http.Response) (result ListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySQLVMGroupNextResults retrieves the next set of results, if any. -func (client SQLVirtualMachinesClient) listBySQLVMGroupNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { - req, err := lastResults.listResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "listBySQLVMGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySQLVMGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "listBySQLVMGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySQLVMGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "listBySQLVMGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySQLVMGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client SQLVirtualMachinesClient) ListBySQLVMGroupComplete(ctx context.Context, resourceGroupName string, SQLVirtualMachineGroupName string) (result ListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLVirtualMachinesClient.ListBySQLVMGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySQLVMGroup(ctx, resourceGroupName, SQLVirtualMachineGroupName) - return -} - -// Redeploy uninstalls and reinstalls the SQL Iaas Extension. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -// SQLVirtualMachineName - name of the SQL virtual machine. -func (client SQLVirtualMachinesClient) Redeploy(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string) (result SQLVirtualMachinesRedeployFutureType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLVirtualMachinesClient.Redeploy") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RedeployPreparer(ctx, resourceGroupName, SQLVirtualMachineName) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "Redeploy", nil, "Failure preparing request") - return - } - - result, err = client.RedeploySender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "Redeploy", result.Response(), "Failure sending request") - return - } - - return -} - -// RedeployPreparer prepares the Redeploy request. -func (client SQLVirtualMachinesClient) RedeployPreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlVirtualMachineName": autorest.Encode("path", SQLVirtualMachineName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/redeploy", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RedeploySender sends the Redeploy request. The method will close the -// http.Response Body if it receives an error. -func (client SQLVirtualMachinesClient) RedeploySender(req *http.Request) (future SQLVirtualMachinesRedeployFutureType, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RedeployResponder handles the response to the Redeploy request. The method always -// closes the http.Response Body. -func (client SQLVirtualMachinesClient) RedeployResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// StartAssessment starts Assessment on SQL virtual machine. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -// SQLVirtualMachineName - name of the SQL virtual machine. -func (client SQLVirtualMachinesClient) StartAssessment(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string) (result SQLVirtualMachinesStartAssessmentFutureType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLVirtualMachinesClient.StartAssessment") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.StartAssessmentPreparer(ctx, resourceGroupName, SQLVirtualMachineName) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "StartAssessment", nil, "Failure preparing request") - return - } - - result, err = client.StartAssessmentSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "StartAssessment", result.Response(), "Failure sending request") - return - } - - return -} - -// StartAssessmentPreparer prepares the StartAssessment request. -func (client SQLVirtualMachinesClient) StartAssessmentPreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlVirtualMachineName": autorest.Encode("path", SQLVirtualMachineName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/startAssessment", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StartAssessmentSender sends the StartAssessment request. The method will close the -// http.Response Body if it receives an error. -func (client SQLVirtualMachinesClient) StartAssessmentSender(req *http.Request) (future SQLVirtualMachinesStartAssessmentFutureType, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StartAssessmentResponder handles the response to the StartAssessment request. The method always -// closes the http.Response Body. -func (client SQLVirtualMachinesClient) StartAssessmentResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update updates a SQL virtual machine. -// Parameters: -// resourceGroupName - name of the resource group that contains the resource. You can obtain this value from -// the Azure Resource Manager API or the portal. -// SQLVirtualMachineName - name of the SQL virtual machine. -// parameters - the SQL virtual machine. -func (client SQLVirtualMachinesClient) Update(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string, parameters Update) (result SQLVirtualMachinesUpdateFutureType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLVirtualMachinesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, SQLVirtualMachineName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "sqlvirtualmachine.SQLVirtualMachinesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SQLVirtualMachinesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, SQLVirtualMachineName string, parameters Update) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sqlVirtualMachineName": autorest.Encode("path", SQLVirtualMachineName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SQLVirtualMachinesClient) UpdateSender(req *http.Request) (future SQLVirtualMachinesUpdateFutureType, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SQLVirtualMachinesClient) UpdateResponder(resp *http.Response) (result SQLVirtualMachine, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/version.go deleted file mode 100644 index 5cc4d805722..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package sqlvirtualmachine - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " sqlvirtualmachine/2021-11-01-preview" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/_meta.json deleted file mode 100644 index 923d8b00a8e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "30d1537f0c9aa49e6e04401b1d16f612b31231e7", - "readme": "/_/azure-rest-api-specs/specification/purview/resource-manager/readme.md", - "tag": "package-2021-07-01", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-07-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/purview/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/accounts.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/accounts.go deleted file mode 100644 index 9e73c088bd6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/accounts.go +++ /dev/null @@ -1,816 +0,0 @@ -package purview - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AccountsClient is the creates a Microsoft.Purview management client. -type AccountsClient struct { - BaseClient -} - -// NewAccountsClient creates an instance of the AccountsClient client. -func NewAccountsClient(subscriptionID string) AccountsClient { - return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountsClientWithBaseURI creates an instance of the AccountsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { - return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// AddRootCollectionAdmin add the administrator for root collection associated with this account. -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the account. -// collectionAdminUpdate - the collection admin update payload. -func (client AccountsClient) AddRootCollectionAdmin(ctx context.Context, resourceGroupName string, accountName string, collectionAdminUpdate CollectionAdminUpdate) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.AddRootCollectionAdmin") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.AddRootCollectionAdminPreparer(ctx, resourceGroupName, accountName, collectionAdminUpdate) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "AddRootCollectionAdmin", nil, "Failure preparing request") - return - } - - resp, err := client.AddRootCollectionAdminSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "AddRootCollectionAdmin", resp, "Failure sending request") - return - } - - result, err = client.AddRootCollectionAdminResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "AddRootCollectionAdmin", resp, "Failure responding to request") - return - } - - return -} - -// AddRootCollectionAdminPreparer prepares the AddRootCollectionAdmin request. -func (client AccountsClient) AddRootCollectionAdminPreparer(ctx context.Context, resourceGroupName string, accountName string, collectionAdminUpdate CollectionAdminUpdate) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/addRootCollectionAdmin", pathParameters), - autorest.WithJSON(collectionAdminUpdate), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AddRootCollectionAdminSender sends the AddRootCollectionAdmin request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) AddRootCollectionAdminSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// AddRootCollectionAdminResponder handles the response to the AddRootCollectionAdmin request. The method always -// closes the http.Response Body. -func (client AccountsClient) AddRootCollectionAdminResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// CheckNameAvailability checks if account name is available. -// Parameters: -// checkNameAvailabilityRequest - the check name availability request. -func (client AccountsClient) CheckNameAvailability(ctx context.Context, checkNameAvailabilityRequest CheckNameAvailabilityRequest) (result CheckNameAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CheckNameAvailabilityPreparer(ctx, checkNameAvailabilityRequest) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client AccountsClient) CheckNameAvailabilityPreparer(ctx context.Context, checkNameAvailabilityRequest CheckNameAvailabilityRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Purview/checkNameAvailability", pathParameters), - autorest.WithJSON(checkNameAvailabilityRequest), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client AccountsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates an account -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the account. -// account - the account. -func (client AccountsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, account Account) (result AccountsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, account) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AccountsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, account Account) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}", pathParameters), - autorest.WithJSON(account), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) CreateOrUpdateSender(req *http.Request) (future AccountsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AccountsClient) CreateOrUpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an account resource -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the account. -func (client AccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result AccountsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) DeleteSender(req *http.Request) (future AccountsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get an account -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the account. -func (client AccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AccountsClient) GetResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup list accounts in ResourceGroup -// Parameters: -// resourceGroupName - the resource group name. -// skipToken - the skip token. -func (client AccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, skipToken string) (result AccountListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.al.Response.Response != nil { - sc = result.al.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.al.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.al, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.al.hasNextLink() && result.al.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AccountsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) (result AccountList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client AccountsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AccountList) (result AccountList, err error) { - req, err := lastResults.accountListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "purview.AccountsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "purview.AccountsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, skipToken string) (result AccountListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, skipToken) - return -} - -// ListBySubscription list accounts in Subscription -// Parameters: -// skipToken - the skip token. -func (client AccountsClient) ListBySubscription(ctx context.Context, skipToken string) (result AccountListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.al.Response.Response != nil { - sc = result.al.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.al.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.al, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.al.hasNextLink() && result.al.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AccountsClient) ListBySubscriptionPreparer(ctx context.Context, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Purview/accounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListBySubscriptionResponder(resp *http.Response) (result AccountList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client AccountsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AccountList) (result AccountList, err error) { - req, err := lastResults.accountListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "purview.AccountsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "purview.AccountsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountsClient) ListBySubscriptionComplete(ctx context.Context, skipToken string) (result AccountListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx, skipToken) - return -} - -// ListKeys list the authorization keys associated with this account. -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the account. -func (client AccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result AccessKeys, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client AccountsClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/listkeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates an account -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the account. -// accountUpdateParameters - the account update parameters. -func (client AccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, accountUpdateParameters AccountUpdateParameters) (result AccountsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, accountUpdateParameters) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, accountUpdateParameters AccountUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}", pathParameters), - autorest.WithJSON(accountUpdateParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) UpdateSender(req *http.Request) (future AccountsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/client.go deleted file mode 100644 index 58b5fceca2d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package purview implements the Azure ARM Purview service API version 2021-07-01. -// -// Creates a Microsoft.Purview management client. -package purview - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Purview - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Purview. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/defaultaccounts.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/defaultaccounts.go deleted file mode 100644 index aa91cd57ff5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/defaultaccounts.go +++ /dev/null @@ -1,256 +0,0 @@ -package purview - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "github.com/gofrs/uuid" - "net/http" -) - -// DefaultAccountsClient is the creates a Microsoft.Purview management client. -type DefaultAccountsClient struct { - BaseClient -} - -// NewDefaultAccountsClient creates an instance of the DefaultAccountsClient client. -func NewDefaultAccountsClient(subscriptionID string) DefaultAccountsClient { - return NewDefaultAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDefaultAccountsClientWithBaseURI creates an instance of the DefaultAccountsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewDefaultAccountsClientWithBaseURI(baseURI string, subscriptionID string) DefaultAccountsClient { - return DefaultAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the default account for the scope. -// Parameters: -// scopeTenantID - the tenant ID. -// scopeType - the scope for the default account. -// scope - the Id of the scope object, for example if the scope is "Subscription" then it is the ID of that -// subscription. -func (client DefaultAccountsClient) Get(ctx context.Context, scopeTenantID uuid.UUID, scopeType ScopeType, scope string) (result DefaultAccountPayload, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DefaultAccountsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, scopeTenantID, scopeType, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.DefaultAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "purview.DefaultAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.DefaultAccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DefaultAccountsClient) GetPreparer(ctx context.Context, scopeTenantID uuid.UUID, scopeType ScopeType, scope string) (*http.Request, error) { - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "scopeTenantId": autorest.Encode("query", scopeTenantID), - "scopeType": autorest.Encode("query", scopeType), - } - if len(scope) > 0 { - queryParameters["scope"] = autorest.Encode("query", scope) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Purview/getDefaultAccount"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client DefaultAccountsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client DefaultAccountsClient) GetResponder(resp *http.Response) (result DefaultAccountPayload, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Remove removes the default account from the scope. -// Parameters: -// scopeTenantID - the tenant ID. -// scopeType - the scope for the default account. -// scope - the Id of the scope object, for example if the scope is "Subscription" then it is the ID of that -// subscription. -func (client DefaultAccountsClient) Remove(ctx context.Context, scopeTenantID uuid.UUID, scopeType ScopeType, scope string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DefaultAccountsClient.Remove") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RemovePreparer(ctx, scopeTenantID, scopeType, scope) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.DefaultAccountsClient", "Remove", nil, "Failure preparing request") - return - } - - resp, err := client.RemoveSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "purview.DefaultAccountsClient", "Remove", resp, "Failure sending request") - return - } - - result, err = client.RemoveResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.DefaultAccountsClient", "Remove", resp, "Failure responding to request") - return - } - - return -} - -// RemovePreparer prepares the Remove request. -func (client DefaultAccountsClient) RemovePreparer(ctx context.Context, scopeTenantID uuid.UUID, scopeType ScopeType, scope string) (*http.Request, error) { - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "scopeTenantId": autorest.Encode("query", scopeTenantID), - "scopeType": autorest.Encode("query", scopeType), - } - if len(scope) > 0 { - queryParameters["scope"] = autorest.Encode("query", scope) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Purview/removeDefaultAccount"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RemoveSender sends the Remove request. The method will close the -// http.Response Body if it receives an error. -func (client DefaultAccountsClient) RemoveSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// RemoveResponder handles the response to the Remove request. The method always -// closes the http.Response Body. -func (client DefaultAccountsClient) RemoveResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Set sets the default account for the scope. -// Parameters: -// defaultAccountPayload - the payload containing the default account information and the scope. -func (client DefaultAccountsClient) Set(ctx context.Context, defaultAccountPayload DefaultAccountPayload) (result DefaultAccountPayload, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DefaultAccountsClient.Set") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.SetPreparer(ctx, defaultAccountPayload) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.DefaultAccountsClient", "Set", nil, "Failure preparing request") - return - } - - resp, err := client.SetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "purview.DefaultAccountsClient", "Set", resp, "Failure sending request") - return - } - - result, err = client.SetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.DefaultAccountsClient", "Set", resp, "Failure responding to request") - return - } - - return -} - -// SetPreparer prepares the Set request. -func (client DefaultAccountsClient) SetPreparer(ctx context.Context, defaultAccountPayload DefaultAccountPayload) (*http.Request, error) { - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Purview/setDefaultAccount"), - autorest.WithJSON(defaultAccountPayload), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// SetSender sends the Set request. The method will close the -// http.Response Body if it receives an error. -func (client DefaultAccountsClient) SetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// SetResponder handles the response to the Set request. The method always -// closes the http.Response Body. -func (client DefaultAccountsClient) SetResponder(resp *http.Response) (result DefaultAccountPayload, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/enums.go deleted file mode 100644 index 89af3e70a8e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/enums.go +++ /dev/null @@ -1,168 +0,0 @@ -package purview - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// LastModifiedByType enumerates the values for last modified by type. -type LastModifiedByType string - -const ( - // LastModifiedByTypeApplication ... - LastModifiedByTypeApplication LastModifiedByType = "Application" - // LastModifiedByTypeKey ... - LastModifiedByTypeKey LastModifiedByType = "Key" - // LastModifiedByTypeManagedIdentity ... - LastModifiedByTypeManagedIdentity LastModifiedByType = "ManagedIdentity" - // LastModifiedByTypeUser ... - LastModifiedByTypeUser LastModifiedByType = "User" -) - -// PossibleLastModifiedByTypeValues returns an array of possible values for the LastModifiedByType const type. -func PossibleLastModifiedByTypeValues() []LastModifiedByType { - return []LastModifiedByType{LastModifiedByTypeApplication, LastModifiedByTypeKey, LastModifiedByTypeManagedIdentity, LastModifiedByTypeUser} -} - -// Name enumerates the values for name. -type Name string - -const ( - // NameStandard ... - NameStandard Name = "Standard" -) - -// PossibleNameValues returns an array of possible values for the Name const type. -func PossibleNameValues() []Name { - return []Name{NameStandard} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCanceled ... - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateCreating ... - ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateMoving ... - ProvisioningStateMoving ProvisioningState = "Moving" - // ProvisioningStateSoftDeleted ... - ProvisioningStateSoftDeleted ProvisioningState = "SoftDeleted" - // ProvisioningStateSoftDeleting ... - ProvisioningStateSoftDeleting ProvisioningState = "SoftDeleting" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUnknown ... - ProvisioningStateUnknown ProvisioningState = "Unknown" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoving, ProvisioningStateSoftDeleted, ProvisioningStateSoftDeleting, ProvisioningStateSucceeded, ProvisioningStateUnknown} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // PublicNetworkAccessDisabled ... - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - // PublicNetworkAccessEnabled ... - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" - // PublicNetworkAccessNotSpecified ... - PublicNetworkAccessNotSpecified PublicNetworkAccess = "NotSpecified" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled, PublicNetworkAccessNotSpecified} -} - -// Reason enumerates the values for reason. -type Reason string - -const ( - // ReasonAlreadyExists ... - ReasonAlreadyExists Reason = "AlreadyExists" - // ReasonInvalid ... - ReasonInvalid Reason = "Invalid" -) - -// PossibleReasonValues returns an array of possible values for the Reason const type. -func PossibleReasonValues() []Reason { - return []Reason{ReasonAlreadyExists, ReasonInvalid} -} - -// ScopeType enumerates the values for scope type. -type ScopeType string - -const ( - // ScopeTypeSubscription ... - ScopeTypeSubscription ScopeType = "Subscription" - // ScopeTypeTenant ... - ScopeTypeTenant ScopeType = "Tenant" -) - -// PossibleScopeTypeValues returns an array of possible values for the ScopeType const type. -func PossibleScopeTypeValues() []ScopeType { - return []ScopeType{ScopeTypeSubscription, ScopeTypeTenant} -} - -// Status enumerates the values for status. -type Status string - -const ( - // StatusApproved ... - StatusApproved Status = "Approved" - // StatusDisconnected ... - StatusDisconnected Status = "Disconnected" - // StatusPending ... - StatusPending Status = "Pending" - // StatusRejected ... - StatusRejected Status = "Rejected" - // StatusUnknown ... - StatusUnknown Status = "Unknown" -) - -// PossibleStatusValues returns an array of possible values for the Status const type. -func PossibleStatusValues() []Status { - return []Status{StatusApproved, StatusDisconnected, StatusPending, StatusRejected, StatusUnknown} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeSystemAssigned ... - TypeSystemAssigned Type = "SystemAssigned" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeSystemAssigned} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/models.go deleted file mode 100644 index d22560794ae..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/models.go +++ /dev/null @@ -1,1684 +0,0 @@ -package purview - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview" - -// AccessKeys the Account access keys. -type AccessKeys struct { - autorest.Response `json:"-"` - // AtlasKafkaPrimaryEndpoint - Gets or sets the primary connection string. - AtlasKafkaPrimaryEndpoint *string `json:"atlasKafkaPrimaryEndpoint,omitempty"` - // AtlasKafkaSecondaryEndpoint - Gets or sets the secondary connection string. - AtlasKafkaSecondaryEndpoint *string `json:"atlasKafkaSecondaryEndpoint,omitempty"` -} - -// Account account resource -type Account struct { - autorest.Response `json:"-"` - // AccountProperties - Gets or sets the properties. - *AccountProperties `json:"properties,omitempty"` - // Sku - Gets or sets the Sku. - Sku *AccountSku `json:"sku,omitempty"` - // ID - READ-ONLY; Gets or sets the identifier. - ID *string `json:"id,omitempty"` - // Identity - Identity Info on the tracked resource - Identity *Identity `json:"identity,omitempty"` - // Location - Gets or sets the location. - Location *string `json:"location,omitempty"` - // Name - READ-ONLY; Gets or sets the name. - Name *string `json:"name,omitempty"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *TrackedResourceSystemData `json:"systemData,omitempty"` - // Tags - Tags on the azure resource. - Tags map[string]*string `json:"tags"` - // Type - READ-ONLY; Gets or sets the type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Account. -func (a Account) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.AccountProperties != nil { - objectMap["properties"] = a.AccountProperties - } - if a.Sku != nil { - objectMap["sku"] = a.Sku - } - if a.Identity != nil { - objectMap["identity"] = a.Identity - } - if a.Location != nil { - objectMap["location"] = a.Location - } - if a.Tags != nil { - objectMap["tags"] = a.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Account struct. -func (a *Account) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var accountProperties AccountProperties - err = json.Unmarshal(*v, &accountProperties) - if err != nil { - return err - } - a.AccountProperties = &accountProperties - } - case "sku": - if v != nil { - var sku AccountSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - a.Sku = &sku - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "identity": - if v != nil { - var identity Identity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - a.Identity = &identity - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - a.Location = &location - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "systemData": - if v != nil { - var systemData TrackedResourceSystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - a.SystemData = &systemData - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - a.Tags = tags - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - } - } - - return nil -} - -// AccountEndpoints the account endpoints -type AccountEndpoints struct { - // Catalog - READ-ONLY; Gets the catalog endpoint. - Catalog *string `json:"catalog,omitempty"` - // Guardian - READ-ONLY; Gets the guardian endpoint. - Guardian *string `json:"guardian,omitempty"` - // Scan - READ-ONLY; Gets the scan endpoint. - Scan *string `json:"scan,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountEndpoints. -func (ae AccountEndpoints) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AccountList paged list of account resources -type AccountList struct { - autorest.Response `json:"-"` - // Count - Total item count. - Count *int64 `json:"count,omitempty"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type results. - Value *[]Account `json:"value,omitempty"` -} - -// AccountListIterator provides access to a complete listing of Account values. -type AccountListIterator struct { - i int - page AccountListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AccountListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AccountListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AccountListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AccountListIterator) Response() AccountList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AccountListIterator) Value() Account { - if !iter.page.NotDone() { - return Account{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AccountListIterator type. -func NewAccountListIterator(page AccountListPage) AccountListIterator { - return AccountListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (al AccountList) IsEmpty() bool { - return al.Value == nil || len(*al.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (al AccountList) hasNextLink() bool { - return al.NextLink != nil && len(*al.NextLink) != 0 -} - -// accountListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (al AccountList) accountListPreparer(ctx context.Context) (*http.Request, error) { - if !al.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(al.NextLink))) -} - -// AccountListPage contains a page of Account values. -type AccountListPage struct { - fn func(context.Context, AccountList) (AccountList, error) - al AccountList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AccountListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.al) - if err != nil { - return err - } - page.al = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AccountListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AccountListPage) NotDone() bool { - return !page.al.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AccountListPage) Response() AccountList { - return page.al -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AccountListPage) Values() []Account { - if page.al.IsEmpty() { - return nil - } - return *page.al.Value -} - -// Creates a new instance of the AccountListPage type. -func NewAccountListPage(cur AccountList, getNextPage func(context.Context, AccountList) (AccountList, error)) AccountListPage { - return AccountListPage{ - fn: getNextPage, - al: cur, - } -} - -// AccountProperties the account properties -type AccountProperties struct { - // CloudConnectors - Cloud connectors. - // External cloud identifier used as part of scanning configuration. - CloudConnectors *CloudConnectors `json:"cloudConnectors,omitempty"` - // CreatedAt - READ-ONLY; Gets the time at which the entity was created. - CreatedAt *date.Time `json:"createdAt,omitempty"` - // CreatedBy - READ-ONLY; Gets the creator of the entity. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByObjectID - READ-ONLY; Gets the creators of the entity's object id. - CreatedByObjectID *string `json:"createdByObjectId,omitempty"` - // Endpoints - READ-ONLY; The URIs that are the public endpoints of the account. - Endpoints *AccountPropertiesEndpoints `json:"endpoints,omitempty"` - // FriendlyName - READ-ONLY; Gets or sets the friendly name. - FriendlyName *string `json:"friendlyName,omitempty"` - // ManagedResourceGroupName - Gets or sets the managed resource group name - ManagedResourceGroupName *string `json:"managedResourceGroupName,omitempty"` - // ManagedResources - READ-ONLY; Gets the resource identifiers of the managed resources. - ManagedResources *AccountPropertiesManagedResources `json:"managedResources,omitempty"` - // PrivateEndpointConnections - READ-ONLY; Gets the private endpoint connections information. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // ProvisioningState - READ-ONLY; Gets or sets the state of the provisioning. Possible values include: 'ProvisioningStateUnknown', 'ProvisioningStateCreating', 'ProvisioningStateMoving', 'ProvisioningStateDeleting', 'ProvisioningStateSoftDeleting', 'ProvisioningStateSoftDeleted', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateCanceled' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // PublicNetworkAccess - Gets or sets the public network access. Possible values include: 'PublicNetworkAccessNotSpecified', 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountProperties. -func (ap AccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.CloudConnectors != nil { - objectMap["cloudConnectors"] = ap.CloudConnectors - } - if ap.ManagedResourceGroupName != nil { - objectMap["managedResourceGroupName"] = ap.ManagedResourceGroupName - } - if ap.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = ap.PublicNetworkAccess - } - return json.Marshal(objectMap) -} - -// AccountPropertiesEndpoints the URIs that are the public endpoints of the account. -type AccountPropertiesEndpoints struct { - // Catalog - READ-ONLY; Gets the catalog endpoint. - Catalog *string `json:"catalog,omitempty"` - // Guardian - READ-ONLY; Gets the guardian endpoint. - Guardian *string `json:"guardian,omitempty"` - // Scan - READ-ONLY; Gets the scan endpoint. - Scan *string `json:"scan,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountPropertiesEndpoints. -func (ap AccountPropertiesEndpoints) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AccountPropertiesManagedResources gets the resource identifiers of the managed resources. -type AccountPropertiesManagedResources struct { - // EventHubNamespace - READ-ONLY; Gets the managed event hub namespace resource identifier. - EventHubNamespace *string `json:"eventHubNamespace,omitempty"` - // ResourceGroup - READ-ONLY; Gets the managed resource group resource identifier. This resource group will host resource dependencies for the account. - ResourceGroup *string `json:"resourceGroup,omitempty"` - // StorageAccount - READ-ONLY; Gets the managed storage account resource identifier. - StorageAccount *string `json:"storageAccount,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountPropertiesManagedResources. -func (apR AccountPropertiesManagedResources) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AccountsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountsClient) (Account, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountsCreateOrUpdateFuture.Result. -func (future *AccountsCreateOrUpdateFuture) result(client AccountsClient) (a Account, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - a.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("purview.AccountsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { - a, err = client.CreateOrUpdateResponder(a.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request") - } - } - return -} - -// AccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountsDeleteFuture.Result. -func (future *AccountsDeleteFuture) result(client AccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("purview.AccountsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AccountSku the Sku -type AccountSku struct { - // Capacity - Gets or sets the sku capacity. Possible values include: 4, 16 - Capacity *int32 `json:"capacity,omitempty"` - // Name - Gets or sets the sku name. Possible values include: 'NameStandard' - Name Name `json:"name,omitempty"` -} - -// AccountsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountsClient) (Account, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountsUpdateFuture.Result. -func (future *AccountsUpdateFuture) result(client AccountsClient) (a Account, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - a.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("purview.AccountsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { - a, err = client.UpdateResponder(a.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.AccountsUpdateFuture", "Result", a.Response.Response, "Failure responding to request") - } - } - return -} - -// AccountUpdateParameters the account update properties. -type AccountUpdateParameters struct { - // Properties - The account properties. - Properties *AccountProperties `json:"properties,omitempty"` - // Tags - Tags on the azure resource. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for AccountUpdateParameters. -func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aup.Properties != nil { - objectMap["properties"] = aup.Properties - } - if aup.Tags != nil { - objectMap["tags"] = aup.Tags - } - return json.Marshal(objectMap) -} - -// CheckNameAvailabilityRequest the request payload for CheckNameAvailability API -type CheckNameAvailabilityRequest struct { - // Name - Resource name to verify for availability - Name *string `json:"name,omitempty"` - // Type - Fully qualified resource type which includes provider namespace - Type *string `json:"type,omitempty"` -} - -// CheckNameAvailabilityResult the response payload for CheckNameAvailability API -type CheckNameAvailabilityResult struct { - autorest.Response `json:"-"` - // Message - Error message - Message *string `json:"message,omitempty"` - // NameAvailable - Indicates if name is valid and available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - The reason the name is not available. Possible values include: 'ReasonInvalid', 'ReasonAlreadyExists' - Reason Reason `json:"reason,omitempty"` -} - -// CloudConnectors ... -type CloudConnectors struct { - // AwsExternalID - READ-ONLY; AWS external identifier. - // Configured in AWS to allow use of the role arn used for scanning - AwsExternalID *string `json:"awsExternalId,omitempty"` -} - -// MarshalJSON is the custom marshaler for CloudConnectors. -func (cc CloudConnectors) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CollectionAdminUpdate collection administrator update. -type CollectionAdminUpdate struct { - // ObjectID - Gets or sets the object identifier of the admin. - ObjectID *string `json:"objectId,omitempty"` -} - -// DefaultAccountPayload payload to get and set the default account in the given scope -type DefaultAccountPayload struct { - autorest.Response `json:"-"` - // AccountName - The name of the account that is set as the default. - AccountName *string `json:"accountName,omitempty"` - // ResourceGroupName - The resource group name of the account that is set as the default. - ResourceGroupName *string `json:"resourceGroupName,omitempty"` - // Scope - The scope object ID. For example, sub ID or tenant ID. - Scope *string `json:"scope,omitempty"` - // ScopeTenantID - The scope tenant in which the default account is set. - ScopeTenantID *string `json:"scopeTenantId,omitempty"` - // ScopeType - The scope where the default account is set. Possible values include: 'ScopeTypeTenant', 'ScopeTypeSubscription' - ScopeType ScopeType `json:"scopeType,omitempty"` - // SubscriptionID - The subscription ID of the account that is set as the default. - SubscriptionID *string `json:"subscriptionId,omitempty"` -} - -// DimensionProperties properties for dimension -type DimensionProperties struct { - // DisplayName - localized display name of the dimension to customer - DisplayName *string `json:"displayName,omitempty"` - // Name - dimension name - Name *string `json:"name,omitempty"` - // ToBeExportedForCustomer - flag indicating whether this dimension should be included to the customer in Azure Monitor logs (aka Shoebox) - ToBeExportedForCustomer *bool `json:"toBeExportedForCustomer,omitempty"` -} - -// ErrorModel default error model -type ErrorModel struct { - // Code - READ-ONLY; Gets or sets the code. - Code *string `json:"code,omitempty"` - // Details - READ-ONLY; Gets or sets the details. - Details *[]ErrorModel `json:"details,omitempty"` - // Message - READ-ONLY; Gets or sets the messages. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; Gets or sets the target. - Target *string `json:"target,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorModel. -func (em ErrorModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponseModel default error response model -type ErrorResponseModel struct { - // Error - READ-ONLY; Gets or sets the error. - Error *ErrorResponseModelError `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponseModel. -func (erm ErrorResponseModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponseModelError gets or sets the error. -type ErrorResponseModelError struct { - // Code - READ-ONLY; Gets or sets the code. - Code *string `json:"code,omitempty"` - // Details - READ-ONLY; Gets or sets the details. - Details *[]ErrorModel `json:"details,omitempty"` - // Message - READ-ONLY; Gets or sets the messages. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; Gets or sets the target. - Target *string `json:"target,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponseModelError. -func (erm ErrorResponseModelError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Identity the Managed Identity of the resource -type Identity struct { - // PrincipalID - READ-ONLY; Service principal object Id - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; Tenant Id - TenantID *string `json:"tenantId,omitempty"` - // Type - Identity Type. Possible values include: 'TypeSystemAssigned' - Type Type `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if i.Type != "" { - objectMap["type"] = i.Type - } - return json.Marshal(objectMap) -} - -// ManagedResources the managed resources in customer subscription. -type ManagedResources struct { - // EventHubNamespace - READ-ONLY; Gets the managed event hub namespace resource identifier. - EventHubNamespace *string `json:"eventHubNamespace,omitempty"` - // ResourceGroup - READ-ONLY; Gets the managed resource group resource identifier. This resource group will host resource dependencies for the account. - ResourceGroup *string `json:"resourceGroup,omitempty"` - // StorageAccount - READ-ONLY; Gets the managed storage account resource identifier. - StorageAccount *string `json:"storageAccount,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedResources. -func (mr ManagedResources) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Operation operation resource -type Operation struct { - // Display - Properties on the operation - Display *OperationDisplay `json:"display,omitempty"` - // IsDataAction - Whether operation is a data action - IsDataAction *bool `json:"isDataAction,omitempty"` - // Name - Operation name for display purposes - Name *string `json:"name,omitempty"` - // Origin - origin of the operation - Origin *string `json:"origin,omitempty"` - // OperationProperties - properties for the operation meta info - *OperationProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if o.Display != nil { - objectMap["display"] = o.Display - } - if o.IsDataAction != nil { - objectMap["isDataAction"] = o.IsDataAction - } - if o.Name != nil { - objectMap["name"] = o.Name - } - if o.Origin != nil { - objectMap["origin"] = o.Origin - } - if o.OperationProperties != nil { - objectMap["properties"] = o.OperationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Operation struct. -func (o *Operation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "display": - if v != nil { - var display OperationDisplay - err = json.Unmarshal(*v, &display) - if err != nil { - return err - } - o.Display = &display - } - case "isDataAction": - if v != nil { - var isDataAction bool - err = json.Unmarshal(*v, &isDataAction) - if err != nil { - return err - } - o.IsDataAction = &isDataAction - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - o.Name = &name - } - case "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - o.Origin = &origin - } - case "properties": - if v != nil { - var operationProperties OperationProperties - err = json.Unmarshal(*v, &operationProperties) - if err != nil { - return err - } - o.OperationProperties = &operationProperties - } - } - } - - return nil -} - -// OperationDisplay the response model for get operation properties -type OperationDisplay struct { - // Description - Description of the operation for display purposes - Description *string `json:"description,omitempty"` - // Operation - Name of the operation for display purposes - Operation *string `json:"operation,omitempty"` - // Provider - Name of the provider for display purposes - Provider *string `json:"provider,omitempty"` - // Resource - Name of the resource type for display purposes - Resource *string `json:"resource,omitempty"` -} - -// OperationList paged list of operation resources -type OperationList struct { - autorest.Response `json:"-"` - // Count - Total item count. - Count *int64 `json:"count,omitempty"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type results. - Value *[]Operation `json:"value,omitempty"` -} - -// OperationListIterator provides access to a complete listing of Operation values. -type OperationListIterator struct { - i int - page OperationListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListIterator) Response() OperationList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListIterator type. -func NewOperationListIterator(page OperationListPage) OperationListIterator { - return OperationListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ol OperationList) IsEmpty() bool { - return ol.Value == nil || len(*ol.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ol OperationList) hasNextLink() bool { - return ol.NextLink != nil && len(*ol.NextLink) != 0 -} - -// operationListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) { - if !ol.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ol.NextLink))) -} - -// OperationListPage contains a page of Operation values. -type OperationListPage struct { - fn func(context.Context, OperationList) (OperationList, error) - ol OperationList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ol) - if err != nil { - return err - } - page.ol = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListPage) NotDone() bool { - return !page.ol.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListPage) Response() OperationList { - return page.ol -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListPage) Values() []Operation { - if page.ol.IsEmpty() { - return nil - } - return *page.ol.Value -} - -// Creates a new instance of the OperationListPage type. -func NewOperationListPage(cur OperationList, getNextPage func(context.Context, OperationList) (OperationList, error)) OperationListPage { - return OperationListPage{ - fn: getNextPage, - ol: cur, - } -} - -// OperationMetaLogSpecification log specifications for operation api -type OperationMetaLogSpecification struct { - // BlobDuration - blob duration of the log - BlobDuration *string `json:"blobDuration,omitempty"` - // DisplayName - localized name of the log category - DisplayName *string `json:"displayName,omitempty"` - // Name - name of the log category - Name *string `json:"name,omitempty"` -} - -// OperationMetaMetricSpecification metric specifications for the operation -type OperationMetaMetricSpecification struct { - // AggregationType - aggregation type of metric - AggregationType *string `json:"aggregationType,omitempty"` - // Dimensions - properties for dimension - Dimensions *[]DimensionProperties `json:"dimensions,omitempty"` - // DisplayDescription - description of the metric - DisplayDescription *string `json:"displayDescription,omitempty"` - // DisplayName - localized name of the metric - DisplayName *string `json:"displayName,omitempty"` - // EnableRegionalMdmAccount - enable regional mdm account - EnableRegionalMdmAccount *string `json:"enableRegionalMdmAccount,omitempty"` - // InternalMetricName - internal metric name - InternalMetricName *string `json:"internalMetricName,omitempty"` - // Name - name of the metric - Name *string `json:"name,omitempty"` - // ResourceIDDimensionNameOverride - dimension name use to replace resource id if specified - ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` - // SourceMdmNamespace - Metric namespace. - // Only set the namespace if different from the default value, - // leaving it empty makes it use the value from the ARM manifest. - SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` - // SupportedAggregationTypes - supported aggregation types - SupportedAggregationTypes *[]string `json:"supportedAggregationTypes,omitempty"` - // SupportedTimeGrainTypes - supported time grain types - SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` - // Unit - units for the metric - Unit *string `json:"unit,omitempty"` -} - -// OperationMetaServiceSpecification the operation meta service specification -type OperationMetaServiceSpecification struct { - // LogSpecifications - log specifications for the operation - LogSpecifications *[]OperationMetaLogSpecification `json:"logSpecifications,omitempty"` - // MetricSpecifications - metric specifications for the operation - MetricSpecifications *[]OperationMetaMetricSpecification `json:"metricSpecifications,omitempty"` -} - -// OperationProperties properties on meta info -type OperationProperties struct { - // ServiceSpecification - meta service specification - ServiceSpecification *OperationMetaServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// PrivateEndpoint a private endpoint class. -type PrivateEndpoint struct { - // ID - The private endpoint identifier. - ID *string `json:"id,omitempty"` -} - -// PrivateEndpointConnection a private endpoint connection class. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - The connection identifier. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Gets or sets the identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets or sets the name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets or sets the type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - } - } - - return nil -} - -// PrivateEndpointConnectionList paged list of private endpoint connections -type PrivateEndpointConnectionList struct { - autorest.Response `json:"-"` - // Count - Total item count. - Count *int64 `json:"count,omitempty"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type results. - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionListIterator provides access to a complete listing of PrivateEndpointConnection -// values. -type PrivateEndpointConnectionListIterator struct { - i int - page PrivateEndpointConnectionListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateEndpointConnectionListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateEndpointConnectionListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateEndpointConnectionListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateEndpointConnectionListIterator) Response() PrivateEndpointConnectionList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateEndpointConnectionListIterator) Value() PrivateEndpointConnection { - if !iter.page.NotDone() { - return PrivateEndpointConnection{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateEndpointConnectionListIterator type. -func NewPrivateEndpointConnectionListIterator(page PrivateEndpointConnectionListPage) PrivateEndpointConnectionListIterator { - return PrivateEndpointConnectionListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (pecl PrivateEndpointConnectionList) IsEmpty() bool { - return pecl.Value == nil || len(*pecl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (pecl PrivateEndpointConnectionList) hasNextLink() bool { - return pecl.NextLink != nil && len(*pecl.NextLink) != 0 -} - -// privateEndpointConnectionListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (pecl PrivateEndpointConnectionList) privateEndpointConnectionListPreparer(ctx context.Context) (*http.Request, error) { - if !pecl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(pecl.NextLink))) -} - -// PrivateEndpointConnectionListPage contains a page of PrivateEndpointConnection values. -type PrivateEndpointConnectionListPage struct { - fn func(context.Context, PrivateEndpointConnectionList) (PrivateEndpointConnectionList, error) - pecl PrivateEndpointConnectionList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateEndpointConnectionListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.pecl) - if err != nil { - return err - } - page.pecl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateEndpointConnectionListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateEndpointConnectionListPage) NotDone() bool { - return !page.pecl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateEndpointConnectionListPage) Response() PrivateEndpointConnectionList { - return page.pecl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateEndpointConnectionListPage) Values() []PrivateEndpointConnection { - if page.pecl.IsEmpty() { - return nil - } - return *page.pecl.Value -} - -// Creates a new instance of the PrivateEndpointConnectionListPage type. -func NewPrivateEndpointConnectionListPage(cur PrivateEndpointConnectionList, getNextPage func(context.Context, PrivateEndpointConnectionList) (PrivateEndpointConnectionList, error)) PrivateEndpointConnectionListPage { - return PrivateEndpointConnectionListPage{ - fn: getNextPage, - pecl: cur, - } -} - -// PrivateEndpointConnectionProperties a private endpoint connection properties class. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The private endpoint information. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - The private link service connection state. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. -func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecp.PrivateEndpoint != nil { - objectMap["privateEndpoint"] = pecp.PrivateEndpoint - } - if pecp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("purview.PrivateEndpointConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("purview.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateLinkResource a privately linkable resource. -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The private link resource identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The private link resource name. - Name *string `json:"name,omitempty"` - // Properties - READ-ONLY; The private link resource properties. - Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` - // Type - READ-ONLY; The private link resource type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResourceList paged list of private link resources -type PrivateLinkResourceList struct { - autorest.Response `json:"-"` - // Count - Total item count. - Count *int64 `json:"count,omitempty"` - // NextLink - The Url of next result page. - NextLink *string `json:"nextLink,omitempty"` - // Value - Collection of items of type results. - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceListIterator provides access to a complete listing of PrivateLinkResource values. -type PrivateLinkResourceListIterator struct { - i int - page PrivateLinkResourceListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *PrivateLinkResourceListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *PrivateLinkResourceListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PrivateLinkResourceListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter PrivateLinkResourceListIterator) Response() PrivateLinkResourceList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter PrivateLinkResourceListIterator) Value() PrivateLinkResource { - if !iter.page.NotDone() { - return PrivateLinkResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the PrivateLinkResourceListIterator type. -func NewPrivateLinkResourceListIterator(page PrivateLinkResourceListPage) PrivateLinkResourceListIterator { - return PrivateLinkResourceListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (plrl PrivateLinkResourceList) IsEmpty() bool { - return plrl.Value == nil || len(*plrl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (plrl PrivateLinkResourceList) hasNextLink() bool { - return plrl.NextLink != nil && len(*plrl.NextLink) != 0 -} - -// privateLinkResourceListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (plrl PrivateLinkResourceList) privateLinkResourceListPreparer(ctx context.Context) (*http.Request, error) { - if !plrl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(plrl.NextLink))) -} - -// PrivateLinkResourceListPage contains a page of PrivateLinkResource values. -type PrivateLinkResourceListPage struct { - fn func(context.Context, PrivateLinkResourceList) (PrivateLinkResourceList, error) - plrl PrivateLinkResourceList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *PrivateLinkResourceListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.plrl) - if err != nil { - return err - } - page.plrl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *PrivateLinkResourceListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PrivateLinkResourceListPage) NotDone() bool { - return !page.plrl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page PrivateLinkResourceListPage) Response() PrivateLinkResourceList { - return page.plrl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page PrivateLinkResourceListPage) Values() []PrivateLinkResource { - if page.plrl.IsEmpty() { - return nil - } - return *page.plrl.Value -} - -// Creates a new instance of the PrivateLinkResourceListPage type. -func NewPrivateLinkResourceListPage(cur PrivateLinkResourceList, getNextPage func(context.Context, PrivateLinkResourceList) (PrivateLinkResourceList, error)) PrivateLinkResourceListPage { - return PrivateLinkResourceListPage{ - fn: getNextPage, - plrl: cur, - } -} - -// PrivateLinkResourceProperties a privately linkable resource properties. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group identifier. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; This translates to how many Private IPs should be created for each privately linkable resource. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY; The required zone names for private link resource. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionState the private link service connection state. -type PrivateLinkServiceConnectionState struct { - // ActionsRequired - The required actions. - ActionsRequired *string `json:"actionsRequired,omitempty"` - // Description - The description. - Description *string `json:"description,omitempty"` - // Status - The status. Possible values include: 'StatusUnknown', 'StatusPending', 'StatusApproved', 'StatusRejected', 'StatusDisconnected' - Status Status `json:"status,omitempty"` -} - -// ProxyResource proxy Azure Resource -type ProxyResource struct { - // ID - READ-ONLY; Gets or sets the identifier. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Gets or sets the name. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Gets or sets the type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedAt - READ-ONLY; The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // CreatedBy - READ-ONLY; The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - READ-ONLY; The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // LastModifiedAt - READ-ONLY; The timestamp of the last modification the resource (UTC). - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` - // LastModifiedBy - READ-ONLY; The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - READ-ONLY; The type of identity that last modified the resource. Possible values include: 'LastModifiedByTypeUser', 'LastModifiedByTypeApplication', 'LastModifiedByTypeManagedIdentity', 'LastModifiedByTypeKey' - LastModifiedByType LastModifiedByType `json:"lastModifiedByType,omitempty"` -} - -// MarshalJSON is the custom marshaler for SystemData. -func (sd SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TrackedResource azure ARM Tracked Resource -type TrackedResource struct { - // ID - READ-ONLY; Gets or sets the identifier. - ID *string `json:"id,omitempty"` - // Identity - Identity Info on the tracked resource - Identity *Identity `json:"identity,omitempty"` - // Location - Gets or sets the location. - Location *string `json:"location,omitempty"` - // Name - READ-ONLY; Gets or sets the name. - Name *string `json:"name,omitempty"` - // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *TrackedResourceSystemData `json:"systemData,omitempty"` - // Tags - Tags on the azure resource. - Tags map[string]*string `json:"tags"` - // Type - READ-ONLY; Gets or sets the type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Identity != nil { - objectMap["identity"] = tr.Identity - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - return json.Marshal(objectMap) -} - -// TrackedResourceSystemData metadata pertaining to creation and last modification of the resource. -type TrackedResourceSystemData struct { - // CreatedAt - READ-ONLY; The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // CreatedBy - READ-ONLY; The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - READ-ONLY; The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // LastModifiedAt - READ-ONLY; The timestamp of the last modification the resource (UTC). - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` - // LastModifiedBy - READ-ONLY; The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - READ-ONLY; The type of identity that last modified the resource. Possible values include: 'LastModifiedByTypeUser', 'LastModifiedByTypeApplication', 'LastModifiedByTypeManagedIdentity', 'LastModifiedByTypeKey' - LastModifiedByType LastModifiedByType `json:"lastModifiedByType,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResourceSystemData. -func (trD TrackedResourceSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/operations.go deleted file mode 100644 index 16c2730d40b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/operations.go +++ /dev/null @@ -1,140 +0,0 @@ -package purview - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the creates a Microsoft.Purview management client. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list of available operations -func (client OperationsClient) List(ctx context.Context) (result OperationListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.ol.Response.Response != nil { - sc = result.ol.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.ol.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "purview.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.ol, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.ol.hasNextLink() && result.ol.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Purview/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationList) (result OperationList, err error) { - req, err := lastResults.operationListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "purview.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "purview.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/privateendpointconnections.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/privateendpointconnections.go deleted file mode 100644 index daf0576239f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/privateendpointconnections.go +++ /dev/null @@ -1,396 +0,0 @@ -package purview - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionsClient is the creates a Microsoft.Purview management client. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update a private endpoint connection -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the account. -// privateEndpointConnectionName - name of the private endpoint connection. -// request - the request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, request PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName, request) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, request PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(request), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a private endpoint connection -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the account. -// privateEndpointConnectionName - name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a private endpoint connection -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the account. -// privateEndpointConnectionName - name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAccount get private endpoint connections for account -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the account. -// skipToken - the skip token. -func (client PrivateEndpointConnectionsClient) ListByAccount(ctx context.Context, resourceGroupName string, accountName string, skipToken string) (result PrivateEndpointConnectionListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByAccount") - defer func() { - sc := -1 - if result.pecl.Response.Response != nil { - sc = result.pecl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByAccountNextResults - req, err := client.ListByAccountPreparer(ctx, resourceGroupName, accountName, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsClient", "ListByAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAccountSender(req) - if err != nil { - result.pecl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsClient", "ListByAccount", resp, "Failure sending request") - return - } - - result.pecl, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsClient", "ListByAccount", resp, "Failure responding to request") - return - } - if result.pecl.hasNextLink() && result.pecl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAccountPreparer prepares the ListByAccount request. -func (client PrivateEndpointConnectionsClient) ListByAccountPreparer(ctx context.Context, resourceGroupName string, accountName string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAccountSender sends the ListByAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListByAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAccountResponder handles the response to the ListByAccount request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListByAccountResponder(resp *http.Response) (result PrivateEndpointConnectionList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAccountNextResults retrieves the next set of results, if any. -func (client PrivateEndpointConnectionsClient) listByAccountNextResults(ctx context.Context, lastResults PrivateEndpointConnectionList) (result PrivateEndpointConnectionList, err error) { - req, err := lastResults.privateEndpointConnectionListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsClient", "listByAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsClient", "listByAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateEndpointConnectionsClient", "listByAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateEndpointConnectionsClient) ListByAccountComplete(ctx context.Context, resourceGroupName string, accountName string, skipToken string) (result PrivateEndpointConnectionListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByAccount") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByAccount(ctx, resourceGroupName, accountName, skipToken) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/privatelinkresources.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/privatelinkresources.go deleted file mode 100644 index c27e9d1bb68..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/privatelinkresources.go +++ /dev/null @@ -1,228 +0,0 @@ -package purview - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the creates a Microsoft.Purview management client. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// GetByGroupID gets a privately linkable resources for an account with given group identifier -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the account. -// groupID - the group identifier. -func (client PrivateLinkResourcesClient) GetByGroupID(ctx context.Context, resourceGroupName string, accountName string, groupID string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.GetByGroupID") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetByGroupIDPreparer(ctx, resourceGroupName, accountName, groupID) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateLinkResourcesClient", "GetByGroupID", nil, "Failure preparing request") - return - } - - resp, err := client.GetByGroupIDSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "purview.PrivateLinkResourcesClient", "GetByGroupID", resp, "Failure sending request") - return - } - - result, err = client.GetByGroupIDResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateLinkResourcesClient", "GetByGroupID", resp, "Failure responding to request") - return - } - - return -} - -// GetByGroupIDPreparer prepares the GetByGroupID request. -func (client PrivateLinkResourcesClient) GetByGroupIDPreparer(ctx context.Context, resourceGroupName string, accountName string, groupID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "groupId": autorest.Encode("path", groupID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateLinkResources/{groupId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetByGroupIDSender sends the GetByGroupID request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) GetByGroupIDSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetByGroupIDResponder handles the response to the GetByGroupID request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) GetByGroupIDResponder(resp *http.Response) (result PrivateLinkResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByAccount gets a list of privately linkable resources for an account -// Parameters: -// resourceGroupName - the resource group name. -// accountName - the name of the account. -func (client PrivateLinkResourcesClient) ListByAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateLinkResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByAccount") - defer func() { - sc := -1 - if result.plrl.Response.Response != nil { - sc = result.plrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listByAccountNextResults - req, err := client.ListByAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateLinkResourcesClient", "ListByAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByAccountSender(req) - if err != nil { - result.plrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "purview.PrivateLinkResourcesClient", "ListByAccount", resp, "Failure sending request") - return - } - - result.plrl, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateLinkResourcesClient", "ListByAccount", resp, "Failure responding to request") - return - } - if result.plrl.hasNextLink() && result.plrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByAccountPreparer prepares the ListByAccount request. -func (client PrivateLinkResourcesClient) ListByAccountPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByAccountSender sends the ListByAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByAccountResponder handles the response to the ListByAccount request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByAccountResponder(resp *http.Response) (result PrivateLinkResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByAccountNextResults retrieves the next set of results, if any. -func (client PrivateLinkResourcesClient) listByAccountNextResults(ctx context.Context, lastResults PrivateLinkResourceList) (result PrivateLinkResourceList, err error) { - req, err := lastResults.privateLinkResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "purview.PrivateLinkResourcesClient", "listByAccountNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "purview.PrivateLinkResourcesClient", "listByAccountNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "purview.PrivateLinkResourcesClient", "listByAccountNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByAccountComplete enumerates all values, automatically crossing page boundaries as required. -func (client PrivateLinkResourcesClient) ListByAccountComplete(ctx context.Context, resourceGroupName string, accountName string) (result PrivateLinkResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByAccount") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByAccount(ctx, resourceGroupName, accountName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/version.go deleted file mode 100644 index a8e0f78aec3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package purview - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " purview/2021-07-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/_meta.json deleted file mode 100644 index 9db13d1349c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "5fcc6854765009e891052653b304cfe80353430a", - "readme": "/_/azure-rest-api-specs/specification/storage/resource-manager/readme.md", - "tag": "package-2021-04", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-04 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/storage/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/accounts.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/accounts.go deleted file mode 100644 index 8eb85a11438..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/accounts.go +++ /dev/null @@ -1,1444 +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. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AccountsClient is the the Azure Storage Management API. -type AccountsClient struct { - BaseClient -} - -// NewAccountsClient creates an instance of the AccountsClient client. -func NewAccountsClient(subscriptionID string) AccountsClient { - return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountsClientWithBaseURI creates an instance of the AccountsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { - return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks that the storage account name is valid and is not already in use. -// Parameters: -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -func (client AccountsClient) CheckNameAvailability(ctx context.Context, accountName AccountCheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "accountName.Type", Name: validation.Null, Rule: true, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.AccountsClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client AccountsClient) CheckNameAvailabilityPreparer(ctx context.Context, accountName AccountCheckNameAvailabilityParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability", pathParameters), - autorest.WithJSON(accountName), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client AccountsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Create asynchronously creates a new storage account with the specified parameters. If an account is already created -// and a subsequent create request is issued with different properties, the account properties will be updated. If an -// account is already created and a subsequent create or update request is issued with the exact same set of -// properties, the request will succeed. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// parameters - the parameters to provide for the created account. -func (client AccountsClient) Create(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters) (result AccountsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccountPropertiesCreateParameters", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.SasPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.SasPolicy.SasExpirationPeriod", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccountPropertiesCreateParameters.SasPolicy.ExpirationAction", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.AccountPropertiesCreateParameters.KeyPolicy", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.KeyPolicy.KeyExpirationPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.AccountPropertiesCreateParameters.CustomDomain", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.CustomDomain.Name", Name: validation.Null, Rule: true, Chain: nil}}}, - {Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication.ActiveDirectoryProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication.ActiveDirectoryProperties.DomainName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication.ActiveDirectoryProperties.NetBiosDomainName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication.ActiveDirectoryProperties.ForestName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication.ActiveDirectoryProperties.DomainGUID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication.ActiveDirectoryProperties.DomainSid", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication.ActiveDirectoryProperties.AzureStorageSid", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}, - }}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.AccountsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client AccountsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) CreateSender(req *http.Request) (future AccountsCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client AccountsClient) CreateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a storage account in Microsoft Azure. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -func (client AccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.AccountsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Failover failover request can be triggered for a storage account in case of availability issues. The failover occurs -// from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will -// become primary after failover. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -func (client AccountsClient) Failover(ctx context.Context, resourceGroupName string, accountName string) (result AccountsFailoverFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Failover") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.AccountsClient", "Failover", err.Error()) - } - - req, err := client.FailoverPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Failover", nil, "Failure preparing request") - return - } - - result, err = client.FailoverSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Failover", result.Response(), "Failure sending request") - return - } - - return -} - -// FailoverPreparer prepares the Failover request. -func (client AccountsClient) FailoverPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FailoverSender sends the Failover request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) FailoverSender(req *http.Request) (future AccountsFailoverFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// FailoverResponder handles the response to the Failover request. The method always -// closes the http.Response Body. -func (client AccountsClient) FailoverResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetProperties returns the properties for the specified storage account including but not limited to name, SKU name, -// location, and account status. The ListKeys operation should be used to retrieve storage keys. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// expand - may be used to expand the properties within account's properties. By default, data is not included -// when fetching properties. Currently we only support geoReplicationStats and blobRestoreStatus. -func (client AccountsClient) GetProperties(ctx context.Context, resourceGroupName string, accountName string, expand AccountExpand) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.GetProperties") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.AccountsClient", "GetProperties", err.Error()) - } - - req, err := client.GetPropertiesPreparer(ctx, resourceGroupName, accountName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", nil, "Failure preparing request") - return - } - - resp, err := client.GetPropertiesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", resp, "Failure sending request") - return - } - - result, err = client.GetPropertiesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", resp, "Failure responding to request") - return - } - - return -} - -// GetPropertiesPreparer prepares the GetProperties request. -func (client AccountsClient) GetPropertiesPreparer(ctx context.Context, resourceGroupName string, accountName string, expand AccountExpand) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(expand)) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetPropertiesSender sends the GetProperties request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) GetPropertiesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetPropertiesResponder handles the response to the GetProperties request. The method always -// closes the http.Response Body. -func (client AccountsClient) GetPropertiesResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all the storage accounts available under the subscription. Note that storage keys are not returned; use -// the ListKeys operation for this. -func (client AccountsClient) List(ctx context.Context) (result AccountListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.List") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.AccountsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "List", resp, "Failure sending request") - return - } - - result.alr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "List", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AccountsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client AccountsClient) listNextResults(ctx context.Context, lastResults AccountListResult) (result AccountListResult, err error) { - req, err := lastResults.accountListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountsClient) ListComplete(ctx context.Context) (result AccountListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListAccountSAS list SAS credentials of a storage account. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// parameters - the parameters to provide to list SAS credentials for the storage account. -func (client AccountsClient) ListAccountSAS(ctx context.Context, resourceGroupName string, accountName string, parameters AccountSasParameters) (result ListAccountSasResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListAccountSAS") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.SharedAccessExpiryTime", Name: validation.Null, Rule: true, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.AccountsClient", "ListAccountSAS", err.Error()) - } - - req, err := client.ListAccountSASPreparer(ctx, resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListAccountSAS", nil, "Failure preparing request") - return - } - - resp, err := client.ListAccountSASSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListAccountSAS", resp, "Failure sending request") - return - } - - result, err = client.ListAccountSASResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListAccountSAS", resp, "Failure responding to request") - return - } - - return -} - -// ListAccountSASPreparer prepares the ListAccountSAS request. -func (client AccountsClient) ListAccountSASPreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountSasParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListAccountSASSender sends the ListAccountSAS request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListAccountSASSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListAccountSASResponder handles the response to the ListAccountSAS request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListAccountSASResponder(resp *http.Response) (result ListAccountSasResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists all the storage accounts available under the given resource group. Note that storage keys -// are not returned; use the ListKeys operation for this. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -func (client AccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AccountListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.alr.Response.Response != nil { - sc = result.alr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.AccountsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.alr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.alr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.alr.hasNextLink() && result.alr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AccountsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client AccountsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AccountListResult) (result AccountListResult, err error) { - req, err := lastResults.accountListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AccountListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// ListKeys lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// expand - specifies type of the key to be listed. Possible value is kerb. -func (client AccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string, expand ListKeyExpand) (result AccountListKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListKeys") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.AccountsClient", "ListKeys", err.Error()) - } - - req, err := client.ListKeysPreparer(ctx, resourceGroupName, accountName, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp, err := client.ListKeysSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", resp, "Failure sending request") - return - } - - result, err = client.ListKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", resp, "Failure responding to request") - return - } - - return -} - -// ListKeysPreparer prepares the ListKeys request. -func (client AccountsClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, accountName string, expand ListKeyExpand) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(expand)) > 0 { - queryParameters["$expand"] = autorest.Encode("query", expand) - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListKeysSender sends the ListKeys request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListKeysResponder handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListKeysResponder(resp *http.Response) (result AccountListKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListServiceSAS list service SAS credentials of a specific resource. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// parameters - the parameters to provide to list service SAS credentials. -func (client AccountsClient) ListServiceSAS(ctx context.Context, resourceGroupName string, accountName string, parameters ServiceSasParameters) (result ListServiceSasResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListServiceSAS") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.CanonicalizedResource", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.Identifier", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Identifier", Name: validation.MaxLength, Rule: 64, Chain: nil}}}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.AccountsClient", "ListServiceSAS", err.Error()) - } - - req, err := client.ListServiceSASPreparer(ctx, resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListServiceSAS", nil, "Failure preparing request") - return - } - - resp, err := client.ListServiceSASSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListServiceSAS", resp, "Failure sending request") - return - } - - result, err = client.ListServiceSASResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListServiceSAS", resp, "Failure responding to request") - return - } - - return -} - -// ListServiceSASPreparer prepares the ListServiceSAS request. -func (client AccountsClient) ListServiceSASPreparer(ctx context.Context, resourceGroupName string, accountName string, parameters ServiceSasParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListServiceSASSender sends the ListServiceSAS request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListServiceSASSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListServiceSASResponder handles the response to the ListServiceSAS request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListServiceSASResponder(resp *http.Response) (result ListServiceSasResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RegenerateKey regenerates one of the access keys or Kerberos keys for the specified storage account. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// regenerateKey - specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. -func (client AccountsClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (result AccountListKeysResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.RegenerateKey") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: regenerateKey, - Constraints: []validation.Constraint{{Target: "regenerateKey.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.AccountsClient", "RegenerateKey", err.Error()) - } - - req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, accountName, regenerateKey) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - resp, err := client.RegenerateKeySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", resp, "Failure sending request") - return - } - - result, err = client.RegenerateKeyResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", resp, "Failure responding to request") - return - } - - return -} - -// RegenerateKeyPreparer prepares the RegenerateKey request. -func (client AccountsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey", pathParameters), - autorest.WithJSON(regenerateKey), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RegenerateKeySender sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result AccountListKeysResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RestoreBlobRanges restore blobs in the specified blob ranges -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// parameters - the parameters to provide for restore blob ranges. -func (client AccountsClient) RestoreBlobRanges(ctx context.Context, resourceGroupName string, accountName string, parameters BlobRestoreParameters) (result AccountsRestoreBlobRangesFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.RestoreBlobRanges") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.TimeToRestore", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.BlobRanges", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.AccountsClient", "RestoreBlobRanges", err.Error()) - } - - req, err := client.RestoreBlobRangesPreparer(ctx, resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RestoreBlobRanges", nil, "Failure preparing request") - return - } - - result, err = client.RestoreBlobRangesSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RestoreBlobRanges", result.Response(), "Failure sending request") - return - } - - return -} - -// RestoreBlobRangesPreparer prepares the RestoreBlobRanges request. -func (client AccountsClient) RestoreBlobRangesPreparer(ctx context.Context, resourceGroupName string, accountName string, parameters BlobRestoreParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RestoreBlobRangesSender sends the RestoreBlobRanges request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) RestoreBlobRangesSender(req *http.Request) (future AccountsRestoreBlobRangesFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RestoreBlobRangesResponder handles the response to the RestoreBlobRanges request. The method always -// closes the http.Response Body. -func (client AccountsClient) RestoreBlobRangesResponder(resp *http.Response) (result BlobRestoreStatus, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RevokeUserDelegationKeys revoke user delegation keys. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -func (client AccountsClient) RevokeUserDelegationKeys(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.RevokeUserDelegationKeys") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.AccountsClient", "RevokeUserDelegationKeys", err.Error()) - } - - req, err := client.RevokeUserDelegationKeysPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RevokeUserDelegationKeys", nil, "Failure preparing request") - return - } - - resp, err := client.RevokeUserDelegationKeysSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RevokeUserDelegationKeys", resp, "Failure sending request") - return - } - - result, err = client.RevokeUserDelegationKeysResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RevokeUserDelegationKeys", resp, "Failure responding to request") - return - } - - return -} - -// RevokeUserDelegationKeysPreparer prepares the RevokeUserDelegationKeys request. -func (client AccountsClient) RevokeUserDelegationKeysPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RevokeUserDelegationKeysSender sends the RevokeUserDelegationKeys request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) RevokeUserDelegationKeysSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RevokeUserDelegationKeysResponder handles the response to the RevokeUserDelegationKeys request. The method always -// closes the http.Response Body. -func (client AccountsClient) RevokeUserDelegationKeysResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update the update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. -// It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; -// the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value -// must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This -// call does not change the storage keys for the account. If you want to change the storage account keys, use the -// regenerate keys operation. The location and name of the storage account cannot be changed after creation. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// parameters - the parameters to provide for the updated account. -func (client AccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.AccountsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/client.go deleted file mode 100644 index 4d3fa84b632..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package storage implements the Azure ARM Storage service API version 2021-04-01. -// -// The Azure Storage Management API. -package storage - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Storage - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Storage. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/enums.go deleted file mode 100644 index e46f629d1ee..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/enums.go +++ /dev/null @@ -1,924 +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. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AccessTier enumerates the values for access tier. -type AccessTier string - -const ( - // AccessTierCool ... - AccessTierCool AccessTier = "Cool" - // AccessTierHot ... - AccessTierHot AccessTier = "Hot" -) - -// PossibleAccessTierValues returns an array of possible values for the AccessTier const type. -func PossibleAccessTierValues() []AccessTier { - return []AccessTier{AccessTierCool, AccessTierHot} -} - -// AccountExpand enumerates the values for account expand. -type AccountExpand string - -const ( - // AccountExpandBlobRestoreStatus ... - AccountExpandBlobRestoreStatus AccountExpand = "blobRestoreStatus" - // AccountExpandGeoReplicationStats ... - AccountExpandGeoReplicationStats AccountExpand = "geoReplicationStats" -) - -// PossibleAccountExpandValues returns an array of possible values for the AccountExpand const type. -func PossibleAccountExpandValues() []AccountExpand { - return []AccountExpand{AccountExpandBlobRestoreStatus, AccountExpandGeoReplicationStats} -} - -// AccountStatus enumerates the values for account status. -type AccountStatus string - -const ( - // AccountStatusAvailable ... - AccountStatusAvailable AccountStatus = "available" - // AccountStatusUnavailable ... - AccountStatusUnavailable AccountStatus = "unavailable" -) - -// PossibleAccountStatusValues returns an array of possible values for the AccountStatus const type. -func PossibleAccountStatusValues() []AccountStatus { - return []AccountStatus{AccountStatusAvailable, AccountStatusUnavailable} -} - -// Action enumerates the values for action. -type Action string - -const ( - // ActionAllow ... - ActionAllow Action = "Allow" -) - -// PossibleActionValues returns an array of possible values for the Action const type. -func PossibleActionValues() []Action { - return []Action{ActionAllow} -} - -// Action1 enumerates the values for action 1. -type Action1 string - -const ( - // Action1Acquire ... - Action1Acquire Action1 = "Acquire" - // Action1Break ... - Action1Break Action1 = "Break" - // Action1Change ... - Action1Change Action1 = "Change" - // Action1Release ... - Action1Release Action1 = "Release" - // Action1Renew ... - Action1Renew Action1 = "Renew" -) - -// PossibleAction1Values returns an array of possible values for the Action1 const type. -func PossibleAction1Values() []Action1 { - return []Action1{Action1Acquire, Action1Break, Action1Change, Action1Release, Action1Renew} -} - -// BlobRestoreProgressStatus enumerates the values for blob restore progress status. -type BlobRestoreProgressStatus string - -const ( - // BlobRestoreProgressStatusComplete ... - BlobRestoreProgressStatusComplete BlobRestoreProgressStatus = "Complete" - // BlobRestoreProgressStatusFailed ... - BlobRestoreProgressStatusFailed BlobRestoreProgressStatus = "Failed" - // BlobRestoreProgressStatusInProgress ... - BlobRestoreProgressStatusInProgress BlobRestoreProgressStatus = "InProgress" -) - -// PossibleBlobRestoreProgressStatusValues returns an array of possible values for the BlobRestoreProgressStatus const type. -func PossibleBlobRestoreProgressStatusValues() []BlobRestoreProgressStatus { - return []BlobRestoreProgressStatus{BlobRestoreProgressStatusComplete, BlobRestoreProgressStatusFailed, BlobRestoreProgressStatusInProgress} -} - -// Bypass enumerates the values for bypass. -type Bypass string - -const ( - // BypassAzureServices ... - BypassAzureServices Bypass = "AzureServices" - // BypassLogging ... - BypassLogging Bypass = "Logging" - // BypassMetrics ... - BypassMetrics Bypass = "Metrics" - // BypassNone ... - BypassNone Bypass = "None" -) - -// PossibleBypassValues returns an array of possible values for the Bypass const type. -func PossibleBypassValues() []Bypass { - return []Bypass{BypassAzureServices, BypassLogging, BypassMetrics, BypassNone} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// DefaultAction enumerates the values for default action. -type DefaultAction string - -const ( - // DefaultActionAllow ... - DefaultActionAllow DefaultAction = "Allow" - // DefaultActionDeny ... - DefaultActionDeny DefaultAction = "Deny" -) - -// PossibleDefaultActionValues returns an array of possible values for the DefaultAction const type. -func PossibleDefaultActionValues() []DefaultAction { - return []DefaultAction{DefaultActionAllow, DefaultActionDeny} -} - -// DefaultSharePermission enumerates the values for default share permission. -type DefaultSharePermission string - -const ( - // DefaultSharePermissionNone ... - DefaultSharePermissionNone DefaultSharePermission = "None" - // DefaultSharePermissionStorageFileDataSmbShareContributor ... - DefaultSharePermissionStorageFileDataSmbShareContributor DefaultSharePermission = "StorageFileDataSmbShareContributor" - // DefaultSharePermissionStorageFileDataSmbShareElevatedContributor ... - DefaultSharePermissionStorageFileDataSmbShareElevatedContributor DefaultSharePermission = "StorageFileDataSmbShareElevatedContributor" - // DefaultSharePermissionStorageFileDataSmbShareOwner ... - DefaultSharePermissionStorageFileDataSmbShareOwner DefaultSharePermission = "StorageFileDataSmbShareOwner" - // DefaultSharePermissionStorageFileDataSmbShareReader ... - DefaultSharePermissionStorageFileDataSmbShareReader DefaultSharePermission = "StorageFileDataSmbShareReader" -) - -// PossibleDefaultSharePermissionValues returns an array of possible values for the DefaultSharePermission const type. -func PossibleDefaultSharePermissionValues() []DefaultSharePermission { - return []DefaultSharePermission{DefaultSharePermissionNone, DefaultSharePermissionStorageFileDataSmbShareContributor, DefaultSharePermissionStorageFileDataSmbShareElevatedContributor, DefaultSharePermissionStorageFileDataSmbShareOwner, DefaultSharePermissionStorageFileDataSmbShareReader} -} - -// DirectoryServiceOptions enumerates the values for directory service options. -type DirectoryServiceOptions string - -const ( - // DirectoryServiceOptionsAADDS ... - DirectoryServiceOptionsAADDS DirectoryServiceOptions = "AADDS" - // DirectoryServiceOptionsAD ... - DirectoryServiceOptionsAD DirectoryServiceOptions = "AD" - // DirectoryServiceOptionsNone ... - DirectoryServiceOptionsNone DirectoryServiceOptions = "None" -) - -// PossibleDirectoryServiceOptionsValues returns an array of possible values for the DirectoryServiceOptions const type. -func PossibleDirectoryServiceOptionsValues() []DirectoryServiceOptions { - return []DirectoryServiceOptions{DirectoryServiceOptionsAADDS, DirectoryServiceOptionsAD, DirectoryServiceOptionsNone} -} - -// EnabledProtocols enumerates the values for enabled protocols. -type EnabledProtocols string - -const ( - // EnabledProtocolsNFS ... - EnabledProtocolsNFS EnabledProtocols = "NFS" - // EnabledProtocolsSMB ... - EnabledProtocolsSMB EnabledProtocols = "SMB" -) - -// PossibleEnabledProtocolsValues returns an array of possible values for the EnabledProtocols const type. -func PossibleEnabledProtocolsValues() []EnabledProtocols { - return []EnabledProtocols{EnabledProtocolsNFS, EnabledProtocolsSMB} -} - -// EncryptionScopeSource enumerates the values for encryption scope source. -type EncryptionScopeSource string - -const ( - // EncryptionScopeSourceMicrosoftKeyVault ... - EncryptionScopeSourceMicrosoftKeyVault EncryptionScopeSource = "Microsoft.KeyVault" - // EncryptionScopeSourceMicrosoftStorage ... - EncryptionScopeSourceMicrosoftStorage EncryptionScopeSource = "Microsoft.Storage" -) - -// PossibleEncryptionScopeSourceValues returns an array of possible values for the EncryptionScopeSource const type. -func PossibleEncryptionScopeSourceValues() []EncryptionScopeSource { - return []EncryptionScopeSource{EncryptionScopeSourceMicrosoftKeyVault, EncryptionScopeSourceMicrosoftStorage} -} - -// EncryptionScopeState enumerates the values for encryption scope state. -type EncryptionScopeState string - -const ( - // EncryptionScopeStateDisabled ... - EncryptionScopeStateDisabled EncryptionScopeState = "Disabled" - // EncryptionScopeStateEnabled ... - EncryptionScopeStateEnabled EncryptionScopeState = "Enabled" -) - -// PossibleEncryptionScopeStateValues returns an array of possible values for the EncryptionScopeState const type. -func PossibleEncryptionScopeStateValues() []EncryptionScopeState { - return []EncryptionScopeState{EncryptionScopeStateDisabled, EncryptionScopeStateEnabled} -} - -// ExtendedLocationTypes enumerates the values for extended location types. -type ExtendedLocationTypes string - -const ( - // ExtendedLocationTypesEdgeZone ... - ExtendedLocationTypesEdgeZone ExtendedLocationTypes = "EdgeZone" -) - -// PossibleExtendedLocationTypesValues returns an array of possible values for the ExtendedLocationTypes const type. -func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { - return []ExtendedLocationTypes{ExtendedLocationTypesEdgeZone} -} - -// Format enumerates the values for format. -type Format string - -const ( - // FormatCsv ... - FormatCsv Format = "Csv" - // FormatParquet ... - FormatParquet Format = "Parquet" -) - -// PossibleFormatValues returns an array of possible values for the Format const type. -func PossibleFormatValues() []Format { - return []Format{FormatCsv, FormatParquet} -} - -// GeoReplicationStatus enumerates the values for geo replication status. -type GeoReplicationStatus string - -const ( - // GeoReplicationStatusBootstrap ... - GeoReplicationStatusBootstrap GeoReplicationStatus = "Bootstrap" - // GeoReplicationStatusLive ... - GeoReplicationStatusLive GeoReplicationStatus = "Live" - // GeoReplicationStatusUnavailable ... - GeoReplicationStatusUnavailable GeoReplicationStatus = "Unavailable" -) - -// PossibleGeoReplicationStatusValues returns an array of possible values for the GeoReplicationStatus const type. -func PossibleGeoReplicationStatusValues() []GeoReplicationStatus { - return []GeoReplicationStatus{GeoReplicationStatusBootstrap, GeoReplicationStatusLive, GeoReplicationStatusUnavailable} -} - -// HTTPProtocol enumerates the values for http protocol. -type HTTPProtocol string - -const ( - // HTTPProtocolHTTPS ... - HTTPProtocolHTTPS HTTPProtocol = "https" - // HTTPProtocolHttpshttp ... - HTTPProtocolHttpshttp HTTPProtocol = "https,http" -) - -// PossibleHTTPProtocolValues returns an array of possible values for the HTTPProtocol const type. -func PossibleHTTPProtocolValues() []HTTPProtocol { - return []HTTPProtocol{HTTPProtocolHTTPS, HTTPProtocolHttpshttp} -} - -// IdentityType enumerates the values for identity type. -type IdentityType string - -const ( - // IdentityTypeNone ... - IdentityTypeNone IdentityType = "None" - // IdentityTypeSystemAssigned ... - IdentityTypeSystemAssigned IdentityType = "SystemAssigned" - // IdentityTypeSystemAssignedUserAssigned ... - IdentityTypeSystemAssignedUserAssigned IdentityType = "SystemAssigned,UserAssigned" - // IdentityTypeUserAssigned ... - IdentityTypeUserAssigned IdentityType = "UserAssigned" -) - -// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. -func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{IdentityTypeNone, IdentityTypeSystemAssigned, IdentityTypeSystemAssignedUserAssigned, IdentityTypeUserAssigned} -} - -// ImmutabilityPolicyState enumerates the values for immutability policy state. -type ImmutabilityPolicyState string - -const ( - // ImmutabilityPolicyStateLocked ... - ImmutabilityPolicyStateLocked ImmutabilityPolicyState = "Locked" - // ImmutabilityPolicyStateUnlocked ... - ImmutabilityPolicyStateUnlocked ImmutabilityPolicyState = "Unlocked" -) - -// PossibleImmutabilityPolicyStateValues returns an array of possible values for the ImmutabilityPolicyState const type. -func PossibleImmutabilityPolicyStateValues() []ImmutabilityPolicyState { - return []ImmutabilityPolicyState{ImmutabilityPolicyStateLocked, ImmutabilityPolicyStateUnlocked} -} - -// ImmutabilityPolicyUpdateType enumerates the values for immutability policy update type. -type ImmutabilityPolicyUpdateType string - -const ( - // ImmutabilityPolicyUpdateTypeExtend ... - ImmutabilityPolicyUpdateTypeExtend ImmutabilityPolicyUpdateType = "extend" - // ImmutabilityPolicyUpdateTypeLock ... - ImmutabilityPolicyUpdateTypeLock ImmutabilityPolicyUpdateType = "lock" - // ImmutabilityPolicyUpdateTypePut ... - ImmutabilityPolicyUpdateTypePut ImmutabilityPolicyUpdateType = "put" -) - -// PossibleImmutabilityPolicyUpdateTypeValues returns an array of possible values for the ImmutabilityPolicyUpdateType const type. -func PossibleImmutabilityPolicyUpdateTypeValues() []ImmutabilityPolicyUpdateType { - return []ImmutabilityPolicyUpdateType{ImmutabilityPolicyUpdateTypeExtend, ImmutabilityPolicyUpdateTypeLock, ImmutabilityPolicyUpdateTypePut} -} - -// KeyPermission enumerates the values for key permission. -type KeyPermission string - -const ( - // KeyPermissionFull ... - KeyPermissionFull KeyPermission = "Full" - // KeyPermissionRead ... - KeyPermissionRead KeyPermission = "Read" -) - -// PossibleKeyPermissionValues returns an array of possible values for the KeyPermission const type. -func PossibleKeyPermissionValues() []KeyPermission { - return []KeyPermission{KeyPermissionFull, KeyPermissionRead} -} - -// KeySource enumerates the values for key source. -type KeySource string - -const ( - // KeySourceMicrosoftKeyvault ... - KeySourceMicrosoftKeyvault KeySource = "Microsoft.Keyvault" - // KeySourceMicrosoftStorage ... - KeySourceMicrosoftStorage KeySource = "Microsoft.Storage" -) - -// PossibleKeySourceValues returns an array of possible values for the KeySource const type. -func PossibleKeySourceValues() []KeySource { - return []KeySource{KeySourceMicrosoftKeyvault, KeySourceMicrosoftStorage} -} - -// KeyType enumerates the values for key type. -type KeyType string - -const ( - // KeyTypeAccount ... - KeyTypeAccount KeyType = "Account" - // KeyTypeService ... - KeyTypeService KeyType = "Service" -) - -// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. -func PossibleKeyTypeValues() []KeyType { - return []KeyType{KeyTypeAccount, KeyTypeService} -} - -// Kind enumerates the values for kind. -type Kind string - -const ( - // KindBlobStorage ... - KindBlobStorage Kind = "BlobStorage" - // KindBlockBlobStorage ... - KindBlockBlobStorage Kind = "BlockBlobStorage" - // KindFileStorage ... - KindFileStorage Kind = "FileStorage" - // KindStorage ... - KindStorage Kind = "Storage" - // KindStorageV2 ... - KindStorageV2 Kind = "StorageV2" -) - -// PossibleKindValues returns an array of possible values for the Kind const type. -func PossibleKindValues() []Kind { - return []Kind{KindBlobStorage, KindBlockBlobStorage, KindFileStorage, KindStorage, KindStorageV2} -} - -// LargeFileSharesState enumerates the values for large file shares state. -type LargeFileSharesState string - -const ( - // LargeFileSharesStateDisabled ... - LargeFileSharesStateDisabled LargeFileSharesState = "Disabled" - // LargeFileSharesStateEnabled ... - LargeFileSharesStateEnabled LargeFileSharesState = "Enabled" -) - -// PossibleLargeFileSharesStateValues returns an array of possible values for the LargeFileSharesState const type. -func PossibleLargeFileSharesStateValues() []LargeFileSharesState { - return []LargeFileSharesState{LargeFileSharesStateDisabled, LargeFileSharesStateEnabled} -} - -// LeaseDuration enumerates the values for lease duration. -type LeaseDuration string - -const ( - // LeaseDurationFixed ... - LeaseDurationFixed LeaseDuration = "Fixed" - // LeaseDurationInfinite ... - LeaseDurationInfinite LeaseDuration = "Infinite" -) - -// PossibleLeaseDurationValues returns an array of possible values for the LeaseDuration const type. -func PossibleLeaseDurationValues() []LeaseDuration { - return []LeaseDuration{LeaseDurationFixed, LeaseDurationInfinite} -} - -// LeaseShareAction enumerates the values for lease share action. -type LeaseShareAction string - -const ( - // LeaseShareActionAcquire ... - LeaseShareActionAcquire LeaseShareAction = "Acquire" - // LeaseShareActionBreak ... - LeaseShareActionBreak LeaseShareAction = "Break" - // LeaseShareActionChange ... - LeaseShareActionChange LeaseShareAction = "Change" - // LeaseShareActionRelease ... - LeaseShareActionRelease LeaseShareAction = "Release" - // LeaseShareActionRenew ... - LeaseShareActionRenew LeaseShareAction = "Renew" -) - -// PossibleLeaseShareActionValues returns an array of possible values for the LeaseShareAction const type. -func PossibleLeaseShareActionValues() []LeaseShareAction { - return []LeaseShareAction{LeaseShareActionAcquire, LeaseShareActionBreak, LeaseShareActionChange, LeaseShareActionRelease, LeaseShareActionRenew} -} - -// LeaseState enumerates the values for lease state. -type LeaseState string - -const ( - // LeaseStateAvailable ... - LeaseStateAvailable LeaseState = "Available" - // LeaseStateBreaking ... - LeaseStateBreaking LeaseState = "Breaking" - // LeaseStateBroken ... - LeaseStateBroken LeaseState = "Broken" - // LeaseStateExpired ... - LeaseStateExpired LeaseState = "Expired" - // LeaseStateLeased ... - LeaseStateLeased LeaseState = "Leased" -) - -// PossibleLeaseStateValues returns an array of possible values for the LeaseState const type. -func PossibleLeaseStateValues() []LeaseState { - return []LeaseState{LeaseStateAvailable, LeaseStateBreaking, LeaseStateBroken, LeaseStateExpired, LeaseStateLeased} -} - -// LeaseStatus enumerates the values for lease status. -type LeaseStatus string - -const ( - // LeaseStatusLocked ... - LeaseStatusLocked LeaseStatus = "Locked" - // LeaseStatusUnlocked ... - LeaseStatusUnlocked LeaseStatus = "Unlocked" -) - -// PossibleLeaseStatusValues returns an array of possible values for the LeaseStatus const type. -func PossibleLeaseStatusValues() []LeaseStatus { - return []LeaseStatus{LeaseStatusLocked, LeaseStatusUnlocked} -} - -// ListContainersInclude enumerates the values for list containers include. -type ListContainersInclude string - -const ( - // ListContainersIncludeDeleted ... - ListContainersIncludeDeleted ListContainersInclude = "deleted" -) - -// PossibleListContainersIncludeValues returns an array of possible values for the ListContainersInclude const type. -func PossibleListContainersIncludeValues() []ListContainersInclude { - return []ListContainersInclude{ListContainersIncludeDeleted} -} - -// ListKeyExpand enumerates the values for list key expand. -type ListKeyExpand string - -const ( - // ListKeyExpandKerb ... - ListKeyExpandKerb ListKeyExpand = "kerb" -) - -// PossibleListKeyExpandValues returns an array of possible values for the ListKeyExpand const type. -func PossibleListKeyExpandValues() []ListKeyExpand { - return []ListKeyExpand{ListKeyExpandKerb} -} - -// MigrationState enumerates the values for migration state. -type MigrationState string - -const ( - // MigrationStateCompleted ... - MigrationStateCompleted MigrationState = "Completed" - // MigrationStateInProgress ... - MigrationStateInProgress MigrationState = "InProgress" -) - -// PossibleMigrationStateValues returns an array of possible values for the MigrationState const type. -func PossibleMigrationStateValues() []MigrationState { - return []MigrationState{MigrationStateCompleted, MigrationStateInProgress} -} - -// MinimumTLSVersion enumerates the values for minimum tls version. -type MinimumTLSVersion string - -const ( - // MinimumTLSVersionTLS10 ... - MinimumTLSVersionTLS10 MinimumTLSVersion = "TLS1_0" - // MinimumTLSVersionTLS11 ... - MinimumTLSVersionTLS11 MinimumTLSVersion = "TLS1_1" - // MinimumTLSVersionTLS12 ... - MinimumTLSVersionTLS12 MinimumTLSVersion = "TLS1_2" -) - -// PossibleMinimumTLSVersionValues returns an array of possible values for the MinimumTLSVersion const type. -func PossibleMinimumTLSVersionValues() []MinimumTLSVersion { - return []MinimumTLSVersion{MinimumTLSVersionTLS10, MinimumTLSVersionTLS11, MinimumTLSVersionTLS12} -} - -// Name enumerates the values for name. -type Name string - -const ( - // NameAccessTimeTracking ... - NameAccessTimeTracking Name = "AccessTimeTracking" -) - -// PossibleNameValues returns an array of possible values for the Name const type. -func PossibleNameValues() []Name { - return []Name{NameAccessTimeTracking} -} - -// ObjectType enumerates the values for object type. -type ObjectType string - -const ( - // ObjectTypeBlob ... - ObjectTypeBlob ObjectType = "Blob" - // ObjectTypeContainer ... - ObjectTypeContainer ObjectType = "Container" -) - -// PossibleObjectTypeValues returns an array of possible values for the ObjectType const type. -func PossibleObjectTypeValues() []ObjectType { - return []ObjectType{ObjectTypeBlob, ObjectTypeContainer} -} - -// Permissions enumerates the values for permissions. -type Permissions string - -const ( - // PermissionsA ... - PermissionsA Permissions = "a" - // PermissionsC ... - PermissionsC Permissions = "c" - // PermissionsD ... - PermissionsD Permissions = "d" - // PermissionsL ... - PermissionsL Permissions = "l" - // PermissionsP ... - PermissionsP Permissions = "p" - // PermissionsR ... - PermissionsR Permissions = "r" - // PermissionsU ... - PermissionsU Permissions = "u" - // PermissionsW ... - PermissionsW Permissions = "w" -) - -// PossiblePermissionsValues returns an array of possible values for the Permissions const type. -func PossiblePermissionsValues() []Permissions { - return []Permissions{PermissionsA, PermissionsC, PermissionsD, PermissionsL, PermissionsP, PermissionsR, PermissionsU, PermissionsW} -} - -// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection -// provisioning state. -type PrivateEndpointConnectionProvisioningState string - -const ( - // PrivateEndpointConnectionProvisioningStateCreating ... - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - // PrivateEndpointConnectionProvisioningStateDeleting ... - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - // PrivateEndpointConnectionProvisioningStateFailed ... - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - // PrivateEndpointConnectionProvisioningStateSucceeded ... - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" -) - -// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. -func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { - return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded} -} - -// PrivateEndpointServiceConnectionStatus enumerates the values for private endpoint service connection status. -type PrivateEndpointServiceConnectionStatus string - -const ( - // PrivateEndpointServiceConnectionStatusApproved ... - PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - // PrivateEndpointServiceConnectionStatusPending ... - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" - // PrivateEndpointServiceConnectionStatusRejected ... - PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" -) - -// PossiblePrivateEndpointServiceConnectionStatusValues returns an array of possible values for the PrivateEndpointServiceConnectionStatus const type. -func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { - return []PrivateEndpointServiceConnectionStatus{PrivateEndpointServiceConnectionStatusApproved, PrivateEndpointServiceConnectionStatusPending, PrivateEndpointServiceConnectionStatusRejected} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCreating ... - ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateResolvingDNS ... - ProvisioningStateResolvingDNS ProvisioningState = "ResolvingDNS" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateResolvingDNS, ProvisioningStateSucceeded} -} - -// PublicAccess enumerates the values for public access. -type PublicAccess string - -const ( - // PublicAccessBlob ... - PublicAccessBlob PublicAccess = "Blob" - // PublicAccessContainer ... - PublicAccessContainer PublicAccess = "Container" - // PublicAccessNone ... - PublicAccessNone PublicAccess = "None" -) - -// PossiblePublicAccessValues returns an array of possible values for the PublicAccess const type. -func PossiblePublicAccessValues() []PublicAccess { - return []PublicAccess{PublicAccessBlob, PublicAccessContainer, PublicAccessNone} -} - -// Reason enumerates the values for reason. -type Reason string - -const ( - // ReasonAccountNameInvalid ... - ReasonAccountNameInvalid Reason = "AccountNameInvalid" - // ReasonAlreadyExists ... - ReasonAlreadyExists Reason = "AlreadyExists" -) - -// PossibleReasonValues returns an array of possible values for the Reason const type. -func PossibleReasonValues() []Reason { - return []Reason{ReasonAccountNameInvalid, ReasonAlreadyExists} -} - -// ReasonCode enumerates the values for reason code. -type ReasonCode string - -const ( - // ReasonCodeNotAvailableForSubscription ... - ReasonCodeNotAvailableForSubscription ReasonCode = "NotAvailableForSubscription" - // ReasonCodeQuotaID ... - ReasonCodeQuotaID ReasonCode = "QuotaId" -) - -// PossibleReasonCodeValues returns an array of possible values for the ReasonCode const type. -func PossibleReasonCodeValues() []ReasonCode { - return []ReasonCode{ReasonCodeNotAvailableForSubscription, ReasonCodeQuotaID} -} - -// RootSquashType enumerates the values for root squash type. -type RootSquashType string - -const ( - // RootSquashTypeAllSquash ... - RootSquashTypeAllSquash RootSquashType = "AllSquash" - // RootSquashTypeNoRootSquash ... - RootSquashTypeNoRootSquash RootSquashType = "NoRootSquash" - // RootSquashTypeRootSquash ... - RootSquashTypeRootSquash RootSquashType = "RootSquash" -) - -// PossibleRootSquashTypeValues returns an array of possible values for the RootSquashType const type. -func PossibleRootSquashTypeValues() []RootSquashType { - return []RootSquashType{RootSquashTypeAllSquash, RootSquashTypeNoRootSquash, RootSquashTypeRootSquash} -} - -// RoutingChoice enumerates the values for routing choice. -type RoutingChoice string - -const ( - // RoutingChoiceInternetRouting ... - RoutingChoiceInternetRouting RoutingChoice = "InternetRouting" - // RoutingChoiceMicrosoftRouting ... - RoutingChoiceMicrosoftRouting RoutingChoice = "MicrosoftRouting" -) - -// PossibleRoutingChoiceValues returns an array of possible values for the RoutingChoice const type. -func PossibleRoutingChoiceValues() []RoutingChoice { - return []RoutingChoice{RoutingChoiceInternetRouting, RoutingChoiceMicrosoftRouting} -} - -// Schedule enumerates the values for schedule. -type Schedule string - -const ( - // ScheduleDaily ... - ScheduleDaily Schedule = "Daily" - // ScheduleWeekly ... - ScheduleWeekly Schedule = "Weekly" -) - -// PossibleScheduleValues returns an array of possible values for the Schedule const type. -func PossibleScheduleValues() []Schedule { - return []Schedule{ScheduleDaily, ScheduleWeekly} -} - -// Services enumerates the values for services. -type Services string - -const ( - // ServicesB ... - ServicesB Services = "b" - // ServicesF ... - ServicesF Services = "f" - // ServicesQ ... - ServicesQ Services = "q" - // ServicesT ... - ServicesT Services = "t" -) - -// PossibleServicesValues returns an array of possible values for the Services const type. -func PossibleServicesValues() []Services { - return []Services{ServicesB, ServicesF, ServicesQ, ServicesT} -} - -// ShareAccessTier enumerates the values for share access tier. -type ShareAccessTier string - -const ( - // ShareAccessTierCool ... - ShareAccessTierCool ShareAccessTier = "Cool" - // ShareAccessTierHot ... - ShareAccessTierHot ShareAccessTier = "Hot" - // ShareAccessTierPremium ... - ShareAccessTierPremium ShareAccessTier = "Premium" - // ShareAccessTierTransactionOptimized ... - ShareAccessTierTransactionOptimized ShareAccessTier = "TransactionOptimized" -) - -// PossibleShareAccessTierValues returns an array of possible values for the ShareAccessTier const type. -func PossibleShareAccessTierValues() []ShareAccessTier { - return []ShareAccessTier{ShareAccessTierCool, ShareAccessTierHot, ShareAccessTierPremium, ShareAccessTierTransactionOptimized} -} - -// SignedResource enumerates the values for signed resource. -type SignedResource string - -const ( - // SignedResourceB ... - SignedResourceB SignedResource = "b" - // SignedResourceC ... - SignedResourceC SignedResource = "c" - // SignedResourceF ... - SignedResourceF SignedResource = "f" - // SignedResourceS ... - SignedResourceS SignedResource = "s" -) - -// PossibleSignedResourceValues returns an array of possible values for the SignedResource const type. -func PossibleSignedResourceValues() []SignedResource { - return []SignedResource{SignedResourceB, SignedResourceC, SignedResourceF, SignedResourceS} -} - -// SignedResourceTypes enumerates the values for signed resource types. -type SignedResourceTypes string - -const ( - // SignedResourceTypesC ... - SignedResourceTypesC SignedResourceTypes = "c" - // SignedResourceTypesO ... - SignedResourceTypesO SignedResourceTypes = "o" - // SignedResourceTypesS ... - SignedResourceTypesS SignedResourceTypes = "s" -) - -// PossibleSignedResourceTypesValues returns an array of possible values for the SignedResourceTypes const type. -func PossibleSignedResourceTypesValues() []SignedResourceTypes { - return []SignedResourceTypes{SignedResourceTypesC, SignedResourceTypesO, SignedResourceTypesS} -} - -// SkuName enumerates the values for sku name. -type SkuName string - -const ( - // SkuNamePremiumLRS ... - SkuNamePremiumLRS SkuName = "Premium_LRS" - // SkuNamePremiumZRS ... - SkuNamePremiumZRS SkuName = "Premium_ZRS" - // SkuNameStandardGRS ... - SkuNameStandardGRS SkuName = "Standard_GRS" - // SkuNameStandardGZRS ... - SkuNameStandardGZRS SkuName = "Standard_GZRS" - // SkuNameStandardLRS ... - SkuNameStandardLRS SkuName = "Standard_LRS" - // SkuNameStandardRAGRS ... - SkuNameStandardRAGRS SkuName = "Standard_RAGRS" - // SkuNameStandardRAGZRS ... - SkuNameStandardRAGZRS SkuName = "Standard_RAGZRS" - // SkuNameStandardZRS ... - SkuNameStandardZRS SkuName = "Standard_ZRS" -) - -// PossibleSkuNameValues returns an array of possible values for the SkuName const type. -func PossibleSkuNameValues() []SkuName { - return []SkuName{SkuNamePremiumLRS, SkuNamePremiumZRS, SkuNameStandardGRS, SkuNameStandardGZRS, SkuNameStandardLRS, SkuNameStandardRAGRS, SkuNameStandardRAGZRS, SkuNameStandardZRS} -} - -// SkuTier enumerates the values for sku tier. -type SkuTier string - -const ( - // SkuTierPremium ... - SkuTierPremium SkuTier = "Premium" - // SkuTierStandard ... - SkuTierStandard SkuTier = "Standard" -) - -// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. -func PossibleSkuTierValues() []SkuTier { - return []SkuTier{SkuTierPremium, SkuTierStandard} -} - -// State enumerates the values for state. -type State string - -const ( - // StateDeprovisioning ... - StateDeprovisioning State = "Deprovisioning" - // StateFailed ... - StateFailed State = "Failed" - // StateNetworkSourceDeleted ... - StateNetworkSourceDeleted State = "NetworkSourceDeleted" - // StateProvisioning ... - StateProvisioning State = "Provisioning" - // StateSucceeded ... - StateSucceeded State = "Succeeded" -) - -// PossibleStateValues returns an array of possible values for the State const type. -func PossibleStateValues() []State { - return []State{StateDeprovisioning, StateFailed, StateNetworkSourceDeleted, StateProvisioning, StateSucceeded} -} - -// UsageUnit enumerates the values for usage unit. -type UsageUnit string - -const ( - // UsageUnitBytes ... - UsageUnitBytes UsageUnit = "Bytes" - // UsageUnitBytesPerSecond ... - UsageUnitBytesPerSecond UsageUnit = "BytesPerSecond" - // UsageUnitCount ... - UsageUnitCount UsageUnit = "Count" - // UsageUnitCountsPerSecond ... - UsageUnitCountsPerSecond UsageUnit = "CountsPerSecond" - // UsageUnitPercent ... - UsageUnitPercent UsageUnit = "Percent" - // UsageUnitSeconds ... - UsageUnitSeconds UsageUnit = "Seconds" -) - -// PossibleUsageUnitValues returns an array of possible values for the UsageUnit const type. -func PossibleUsageUnitValues() []UsageUnit { - return []UsageUnit{UsageUnitBytes, UsageUnitBytesPerSecond, UsageUnitCount, UsageUnitCountsPerSecond, UsageUnitPercent, UsageUnitSeconds} -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/models.go deleted file mode 100644 index 61695714c53..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/models.go +++ /dev/null @@ -1,5273 +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. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage" - -// AccessPolicy ... -type AccessPolicy struct { - // Start - Start time of the access policy - Start *date.Time `json:"start,omitempty"` - // Expiry - Expiry time of the access policy - Expiry *date.Time `json:"expiry,omitempty"` - // Permission - List of abbreviated permissions. - Permission *string `json:"permission,omitempty"` -} - -// Account the storage account. -type Account struct { - autorest.Response `json:"-"` - // Sku - READ-ONLY; Gets the SKU. - Sku *Sku `json:"sku,omitempty"` - // Kind - READ-ONLY; Gets the Kind. Possible values include: 'KindStorage', 'KindStorageV2', 'KindBlobStorage', 'KindFileStorage', 'KindBlockBlobStorage' - Kind Kind `json:"kind,omitempty"` - // Identity - The identity of the resource. - Identity *Identity `json:"identity,omitempty"` - // ExtendedLocation - The extendedLocation of the resource. - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - // AccountProperties - Properties of the storage account. - *AccountProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Account. -func (a Account) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.Identity != nil { - objectMap["identity"] = a.Identity - } - if a.ExtendedLocation != nil { - objectMap["extendedLocation"] = a.ExtendedLocation - } - if a.AccountProperties != nil { - objectMap["properties"] = a.AccountProperties - } - if a.Tags != nil { - objectMap["tags"] = a.Tags - } - if a.Location != nil { - objectMap["location"] = a.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Account struct. -func (a *Account) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - a.Sku = &sku - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - a.Kind = kind - } - case "identity": - if v != nil { - var identity Identity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - a.Identity = &identity - } - case "extendedLocation": - if v != nil { - var extendedLocation ExtendedLocation - err = json.Unmarshal(*v, &extendedLocation) - if err != nil { - return err - } - a.ExtendedLocation = &extendedLocation - } - case "properties": - if v != nil { - var accountProperties AccountProperties - err = json.Unmarshal(*v, &accountProperties) - if err != nil { - return err - } - a.AccountProperties = &accountProperties - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - a.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - a.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - } - } - - return nil -} - -// AccountCheckNameAvailabilityParameters the parameters used to check the availability of the storage -// account name. -type AccountCheckNameAvailabilityParameters struct { - // Name - The storage account name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, Microsoft.Storage/storageAccounts - Type *string `json:"type,omitempty"` -} - -// AccountCreateParameters the parameters used when creating a storage account. -type AccountCreateParameters struct { - // Sku - Required. Gets or sets the SKU name. - Sku *Sku `json:"sku,omitempty"` - // Kind - Required. Indicates the type of storage account. Possible values include: 'KindStorage', 'KindStorageV2', 'KindBlobStorage', 'KindFileStorage', 'KindBlockBlobStorage' - Kind Kind `json:"kind,omitempty"` - // Location - Required. Gets or sets the location of the resource. This will be one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. - Location *string `json:"location,omitempty"` - // ExtendedLocation - Optional. Set the extended location of the resource. If not set, the storage account will be created in Azure main region. Otherwise it will be created in the specified extended location - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - // Tags - Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. - Tags map[string]*string `json:"tags"` - // Identity - The identity of the resource. - Identity *Identity `json:"identity,omitempty"` - // AccountPropertiesCreateParameters - The parameters used to create the storage account. - *AccountPropertiesCreateParameters `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountCreateParameters. -func (acp AccountCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if acp.Sku != nil { - objectMap["sku"] = acp.Sku - } - if acp.Kind != "" { - objectMap["kind"] = acp.Kind - } - if acp.Location != nil { - objectMap["location"] = acp.Location - } - if acp.ExtendedLocation != nil { - objectMap["extendedLocation"] = acp.ExtendedLocation - } - if acp.Tags != nil { - objectMap["tags"] = acp.Tags - } - if acp.Identity != nil { - objectMap["identity"] = acp.Identity - } - if acp.AccountPropertiesCreateParameters != nil { - objectMap["properties"] = acp.AccountPropertiesCreateParameters - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccountCreateParameters struct. -func (acp *AccountCreateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - acp.Sku = &sku - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - acp.Kind = kind - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - acp.Location = &location - } - case "extendedLocation": - if v != nil { - var extendedLocation ExtendedLocation - err = json.Unmarshal(*v, &extendedLocation) - if err != nil { - return err - } - acp.ExtendedLocation = &extendedLocation - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - acp.Tags = tags - } - case "identity": - if v != nil { - var identity Identity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - acp.Identity = &identity - } - case "properties": - if v != nil { - var accountPropertiesCreateParameters AccountPropertiesCreateParameters - err = json.Unmarshal(*v, &accountPropertiesCreateParameters) - if err != nil { - return err - } - acp.AccountPropertiesCreateParameters = &accountPropertiesCreateParameters - } - } - } - - return nil -} - -// AccountInternetEndpoints the URIs that are used to perform a retrieval of a public blob, file, web or -// dfs object via a internet routing endpoint. -type AccountInternetEndpoints struct { - // Blob - READ-ONLY; Gets the blob endpoint. - Blob *string `json:"blob,omitempty"` - // File - READ-ONLY; Gets the file endpoint. - File *string `json:"file,omitempty"` - // Web - READ-ONLY; Gets the web endpoint. - Web *string `json:"web,omitempty"` - // Dfs - READ-ONLY; Gets the dfs endpoint. - Dfs *string `json:"dfs,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountInternetEndpoints. -func (aie AccountInternetEndpoints) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AccountKey an access key for the storage account. -type AccountKey struct { - // KeyName - READ-ONLY; Name of the key. - KeyName *string `json:"keyName,omitempty"` - // Value - READ-ONLY; Base 64-encoded value of the key. - Value *string `json:"value,omitempty"` - // Permissions - READ-ONLY; Permissions for the key -- read-only or full permissions. Possible values include: 'KeyPermissionRead', 'KeyPermissionFull' - Permissions KeyPermission `json:"permissions,omitempty"` - // CreationTime - READ-ONLY; Creation time of the key, in round trip date format. - CreationTime *date.Time `json:"creationTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountKey. -func (ak AccountKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AccountListKeysResult the response from the ListKeys operation. -type AccountListKeysResult struct { - autorest.Response `json:"-"` - // Keys - READ-ONLY; Gets the list of storage account keys and their properties for the specified storage account. - Keys *[]AccountKey `json:"keys,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountListKeysResult. -func (alkr AccountListKeysResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AccountListResult the response from the List Storage Accounts operation. -type AccountListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Gets the list of storage accounts and their properties. - Value *[]Account `json:"value,omitempty"` - // NextLink - READ-ONLY; Request URL that can be used to query next page of storage accounts. Returned when total number of requested storage accounts exceed maximum page size. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountListResult. -func (alr AccountListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AccountListResultIterator provides access to a complete listing of Account values. -type AccountListResultIterator struct { - i int - page AccountListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AccountListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AccountListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AccountListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AccountListResultIterator) Response() AccountListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AccountListResultIterator) Value() Account { - if !iter.page.NotDone() { - return Account{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AccountListResultIterator type. -func NewAccountListResultIterator(page AccountListResultPage) AccountListResultIterator { - return AccountListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (alr AccountListResult) IsEmpty() bool { - return alr.Value == nil || len(*alr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (alr AccountListResult) hasNextLink() bool { - return alr.NextLink != nil && len(*alr.NextLink) != 0 -} - -// accountListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (alr AccountListResult) accountListResultPreparer(ctx context.Context) (*http.Request, error) { - if !alr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(alr.NextLink))) -} - -// AccountListResultPage contains a page of Account values. -type AccountListResultPage struct { - fn func(context.Context, AccountListResult) (AccountListResult, error) - alr AccountListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AccountListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.alr) - if err != nil { - return err - } - page.alr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AccountListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AccountListResultPage) NotDone() bool { - return !page.alr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AccountListResultPage) Response() AccountListResult { - return page.alr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AccountListResultPage) Values() []Account { - if page.alr.IsEmpty() { - return nil - } - return *page.alr.Value -} - -// Creates a new instance of the AccountListResultPage type. -func NewAccountListResultPage(cur AccountListResult, getNextPage func(context.Context, AccountListResult) (AccountListResult, error)) AccountListResultPage { - return AccountListResultPage{ - fn: getNextPage, - alr: cur, - } -} - -// AccountMicrosoftEndpoints the URIs that are used to perform a retrieval of a public blob, queue, table, -// web or dfs object via a microsoft routing endpoint. -type AccountMicrosoftEndpoints struct { - // Blob - READ-ONLY; Gets the blob endpoint. - Blob *string `json:"blob,omitempty"` - // Queue - READ-ONLY; Gets the queue endpoint. - Queue *string `json:"queue,omitempty"` - // Table - READ-ONLY; Gets the table endpoint. - Table *string `json:"table,omitempty"` - // File - READ-ONLY; Gets the file endpoint. - File *string `json:"file,omitempty"` - // Web - READ-ONLY; Gets the web endpoint. - Web *string `json:"web,omitempty"` - // Dfs - READ-ONLY; Gets the dfs endpoint. - Dfs *string `json:"dfs,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountMicrosoftEndpoints. -func (ame AccountMicrosoftEndpoints) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AccountProperties properties of the storage account. -type AccountProperties struct { - // ProvisioningState - READ-ONLY; Gets the status of the storage account at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateResolvingDNS', 'ProvisioningStateSucceeded' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // PrimaryEndpoints - READ-ONLY; Gets the URLs that are used to perform a retrieval of a public blob, queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob endpoint. - PrimaryEndpoints *Endpoints `json:"primaryEndpoints,omitempty"` - // PrimaryLocation - READ-ONLY; Gets the location of the primary data center for the storage account. - PrimaryLocation *string `json:"primaryLocation,omitempty"` - // StatusOfPrimary - READ-ONLY; Gets the status indicating whether the primary location of the storage account is available or unavailable. Possible values include: 'AccountStatusAvailable', 'AccountStatusUnavailable' - StatusOfPrimary AccountStatus `json:"statusOfPrimary,omitempty"` - // LastGeoFailoverTime - READ-ONLY; Gets the timestamp of the most recent instance of a failover to the secondary location. Only the most recent timestamp is retained. This element is not returned if there has never been a failover instance. Only available if the accountType is Standard_GRS or Standard_RAGRS. - LastGeoFailoverTime *date.Time `json:"lastGeoFailoverTime,omitempty"` - // SecondaryLocation - READ-ONLY; Gets the location of the geo-replicated secondary for the storage account. Only available if the accountType is Standard_GRS or Standard_RAGRS. - SecondaryLocation *string `json:"secondaryLocation,omitempty"` - // StatusOfSecondary - READ-ONLY; Gets the status indicating whether the secondary location of the storage account is available or unavailable. Only available if the SKU name is Standard_GRS or Standard_RAGRS. Possible values include: 'AccountStatusAvailable', 'AccountStatusUnavailable' - StatusOfSecondary AccountStatus `json:"statusOfSecondary,omitempty"` - // CreationTime - READ-ONLY; Gets the creation date and time of the storage account in UTC. - CreationTime *date.Time `json:"creationTime,omitempty"` - // CustomDomain - READ-ONLY; Gets the custom domain the user assigned to this storage account. - CustomDomain *CustomDomain `json:"customDomain,omitempty"` - // SasPolicy - READ-ONLY; SasPolicy assigned to the storage account. - SasPolicy *SasPolicy `json:"sasPolicy,omitempty"` - // KeyPolicy - READ-ONLY; KeyPolicy assigned to the storage account. - KeyPolicy *KeyPolicy `json:"keyPolicy,omitempty"` - // KeyCreationTime - READ-ONLY; Storage account keys creation time. - KeyCreationTime *KeyCreationTime `json:"keyCreationTime,omitempty"` - // SecondaryEndpoints - READ-ONLY; Gets the URLs that are used to perform a retrieval of a public blob, queue, or table object from the secondary location of the storage account. Only available if the SKU name is Standard_RAGRS. - SecondaryEndpoints *Endpoints `json:"secondaryEndpoints,omitempty"` - // Encryption - READ-ONLY; Gets the encryption settings on the account. If unspecified, the account is unencrypted. - Encryption *Encryption `json:"encryption,omitempty"` - // AccessTier - READ-ONLY; Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: 'AccessTierHot', 'AccessTierCool' - AccessTier AccessTier `json:"accessTier,omitempty"` - // AzureFilesIdentityBasedAuthentication - Provides the identity based authentication settings for Azure Files. - AzureFilesIdentityBasedAuthentication *AzureFilesIdentityBasedAuthentication `json:"azureFilesIdentityBasedAuthentication,omitempty"` - // EnableHTTPSTrafficOnly - Allows https traffic only to storage service if sets to true. - EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"` - // NetworkRuleSet - READ-ONLY; Network rule set - NetworkRuleSet *NetworkRuleSet `json:"networkAcls,omitempty"` - // IsHnsEnabled - Account HierarchicalNamespace enabled if sets to true. - IsHnsEnabled *bool `json:"isHnsEnabled,omitempty"` - // GeoReplicationStats - READ-ONLY; Geo Replication Stats - GeoReplicationStats *GeoReplicationStats `json:"geoReplicationStats,omitempty"` - // FailoverInProgress - READ-ONLY; If the failover is in progress, the value will be true, otherwise, it will be null. - FailoverInProgress *bool `json:"failoverInProgress,omitempty"` - // LargeFileSharesState - Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: 'LargeFileSharesStateDisabled', 'LargeFileSharesStateEnabled' - LargeFileSharesState LargeFileSharesState `json:"largeFileSharesState,omitempty"` - // PrivateEndpointConnections - READ-ONLY; List of private endpoint connection associated with the specified storage account - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - // RoutingPreference - Maintains information about the network routing choice opted by the user for data transfer - RoutingPreference *RoutingPreference `json:"routingPreference,omitempty"` - // BlobRestoreStatus - READ-ONLY; Blob restore status - BlobRestoreStatus *BlobRestoreStatus `json:"blobRestoreStatus,omitempty"` - // AllowBlobPublicAccess - Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - AllowBlobPublicAccess *bool `json:"allowBlobPublicAccess,omitempty"` - // MinimumTLSVersion - Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: 'MinimumTLSVersionTLS10', 'MinimumTLSVersionTLS11', 'MinimumTLSVersionTLS12' - MinimumTLSVersion MinimumTLSVersion `json:"minimumTlsVersion,omitempty"` - // AllowSharedKeyAccess - Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - AllowSharedKeyAccess *bool `json:"allowSharedKeyAccess,omitempty"` - // EnableNfsV3 - NFS 3.0 protocol support enabled if set to true. - EnableNfsV3 *bool `json:"isNfsV3Enabled,omitempty"` - // AllowCrossTenantReplication - Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. - AllowCrossTenantReplication *bool `json:"allowCrossTenantReplication,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountProperties. -func (ap AccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.AzureFilesIdentityBasedAuthentication != nil { - objectMap["azureFilesIdentityBasedAuthentication"] = ap.AzureFilesIdentityBasedAuthentication - } - if ap.EnableHTTPSTrafficOnly != nil { - objectMap["supportsHttpsTrafficOnly"] = ap.EnableHTTPSTrafficOnly - } - if ap.IsHnsEnabled != nil { - objectMap["isHnsEnabled"] = ap.IsHnsEnabled - } - if ap.LargeFileSharesState != "" { - objectMap["largeFileSharesState"] = ap.LargeFileSharesState - } - if ap.RoutingPreference != nil { - objectMap["routingPreference"] = ap.RoutingPreference - } - if ap.AllowBlobPublicAccess != nil { - objectMap["allowBlobPublicAccess"] = ap.AllowBlobPublicAccess - } - if ap.MinimumTLSVersion != "" { - objectMap["minimumTlsVersion"] = ap.MinimumTLSVersion - } - if ap.AllowSharedKeyAccess != nil { - objectMap["allowSharedKeyAccess"] = ap.AllowSharedKeyAccess - } - if ap.EnableNfsV3 != nil { - objectMap["isNfsV3Enabled"] = ap.EnableNfsV3 - } - if ap.AllowCrossTenantReplication != nil { - objectMap["allowCrossTenantReplication"] = ap.AllowCrossTenantReplication - } - return json.Marshal(objectMap) -} - -// AccountPropertiesCreateParameters the parameters used to create the storage account. -type AccountPropertiesCreateParameters struct { - // SasPolicy - SasPolicy assigned to the storage account. - SasPolicy *SasPolicy `json:"sasPolicy,omitempty"` - // KeyPolicy - KeyPolicy assigned to the storage account. - KeyPolicy *KeyPolicy `json:"keyPolicy,omitempty"` - // CustomDomain - User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - CustomDomain *CustomDomain `json:"customDomain,omitempty"` - // Encryption - Not applicable. Azure Storage encryption is enabled for all storage accounts and cannot be disabled. - Encryption *Encryption `json:"encryption,omitempty"` - // NetworkRuleSet - Network rule set - NetworkRuleSet *NetworkRuleSet `json:"networkAcls,omitempty"` - // AccessTier - Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: 'AccessTierHot', 'AccessTierCool' - AccessTier AccessTier `json:"accessTier,omitempty"` - // AzureFilesIdentityBasedAuthentication - Provides the identity based authentication settings for Azure Files. - AzureFilesIdentityBasedAuthentication *AzureFilesIdentityBasedAuthentication `json:"azureFilesIdentityBasedAuthentication,omitempty"` - // EnableHTTPSTrafficOnly - Allows https traffic only to storage service if sets to true. The default value is true since API version 2019-04-01. - EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"` - // IsHnsEnabled - Account HierarchicalNamespace enabled if sets to true. - IsHnsEnabled *bool `json:"isHnsEnabled,omitempty"` - // LargeFileSharesState - Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: 'LargeFileSharesStateDisabled', 'LargeFileSharesStateEnabled' - LargeFileSharesState LargeFileSharesState `json:"largeFileSharesState,omitempty"` - // RoutingPreference - Maintains information about the network routing choice opted by the user for data transfer - RoutingPreference *RoutingPreference `json:"routingPreference,omitempty"` - // AllowBlobPublicAccess - Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - AllowBlobPublicAccess *bool `json:"allowBlobPublicAccess,omitempty"` - // MinimumTLSVersion - Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: 'MinimumTLSVersionTLS10', 'MinimumTLSVersionTLS11', 'MinimumTLSVersionTLS12' - MinimumTLSVersion MinimumTLSVersion `json:"minimumTlsVersion,omitempty"` - // AllowSharedKeyAccess - Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - AllowSharedKeyAccess *bool `json:"allowSharedKeyAccess,omitempty"` - // EnableNfsV3 - NFS 3.0 protocol support enabled if set to true. - EnableNfsV3 *bool `json:"isNfsV3Enabled,omitempty"` - // AllowCrossTenantReplication - Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. - AllowCrossTenantReplication *bool `json:"allowCrossTenantReplication,omitempty"` -} - -// AccountPropertiesUpdateParameters the parameters used when updating a storage account. -type AccountPropertiesUpdateParameters struct { - // CustomDomain - Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. - CustomDomain *CustomDomain `json:"customDomain,omitempty"` - // Encryption - Provides the encryption settings on the account. The default setting is unencrypted. - Encryption *Encryption `json:"encryption,omitempty"` - // SasPolicy - SasPolicy assigned to the storage account. - SasPolicy *SasPolicy `json:"sasPolicy,omitempty"` - // KeyPolicy - KeyPolicy assigned to the storage account. - KeyPolicy *KeyPolicy `json:"keyPolicy,omitempty"` - // AccessTier - Required for storage accounts where kind = BlobStorage. The access tier used for billing. Possible values include: 'AccessTierHot', 'AccessTierCool' - AccessTier AccessTier `json:"accessTier,omitempty"` - // AzureFilesIdentityBasedAuthentication - Provides the identity based authentication settings for Azure Files. - AzureFilesIdentityBasedAuthentication *AzureFilesIdentityBasedAuthentication `json:"azureFilesIdentityBasedAuthentication,omitempty"` - // EnableHTTPSTrafficOnly - Allows https traffic only to storage service if sets to true. - EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"` - // NetworkRuleSet - Network rule set - NetworkRuleSet *NetworkRuleSet `json:"networkAcls,omitempty"` - // LargeFileSharesState - Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: 'LargeFileSharesStateDisabled', 'LargeFileSharesStateEnabled' - LargeFileSharesState LargeFileSharesState `json:"largeFileSharesState,omitempty"` - // RoutingPreference - Maintains information about the network routing choice opted by the user for data transfer - RoutingPreference *RoutingPreference `json:"routingPreference,omitempty"` - // AllowBlobPublicAccess - Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. - AllowBlobPublicAccess *bool `json:"allowBlobPublicAccess,omitempty"` - // MinimumTLSVersion - Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: 'MinimumTLSVersionTLS10', 'MinimumTLSVersionTLS11', 'MinimumTLSVersionTLS12' - MinimumTLSVersion MinimumTLSVersion `json:"minimumTlsVersion,omitempty"` - // AllowSharedKeyAccess - Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. - AllowSharedKeyAccess *bool `json:"allowSharedKeyAccess,omitempty"` - // AllowCrossTenantReplication - Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. - AllowCrossTenantReplication *bool `json:"allowCrossTenantReplication,omitempty"` -} - -// AccountRegenerateKeyParameters the parameters used to regenerate the storage account key. -type AccountRegenerateKeyParameters struct { - // KeyName - The name of storage keys that want to be regenerated, possible values are key1, key2, kerb1, kerb2. - KeyName *string `json:"keyName,omitempty"` -} - -// AccountSasParameters the parameters to list SAS credentials of a storage account. -type AccountSasParameters struct { - // Services - The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: 'ServicesB', 'ServicesQ', 'ServicesT', 'ServicesF' - Services Services `json:"signedServices,omitempty"` - // ResourceTypes - The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: 'SignedResourceTypesS', 'SignedResourceTypesC', 'SignedResourceTypesO' - ResourceTypes SignedResourceTypes `json:"signedResourceTypes,omitempty"` - // Permissions - The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: 'PermissionsR', 'PermissionsD', 'PermissionsW', 'PermissionsL', 'PermissionsA', 'PermissionsC', 'PermissionsU', 'PermissionsP' - Permissions Permissions `json:"signedPermission,omitempty"` - // IPAddressOrRange - An IP address or a range of IP addresses from which to accept requests. - IPAddressOrRange *string `json:"signedIp,omitempty"` - // Protocols - The protocol permitted for a request made with the account SAS. Possible values include: 'HTTPProtocolHttpshttp', 'HTTPProtocolHTTPS' - Protocols HTTPProtocol `json:"signedProtocol,omitempty"` - // SharedAccessStartTime - The time at which the SAS becomes valid. - SharedAccessStartTime *date.Time `json:"signedStart,omitempty"` - // SharedAccessExpiryTime - The time at which the shared access signature becomes invalid. - SharedAccessExpiryTime *date.Time `json:"signedExpiry,omitempty"` - // KeyToSign - The key to sign the account SAS token with. - KeyToSign *string `json:"keyToSign,omitempty"` -} - -// AccountsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountsClient) (Account, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountsCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountsCreateFuture.Result. -func (future *AccountsCreateFuture) result(client AccountsClient) (a Account, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - a.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("storage.AccountsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { - a, err = client.CreateResponder(a.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsCreateFuture", "Result", a.Response.Response, "Failure responding to request") - } - } - return -} - -// AccountsFailoverFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountsFailoverFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountsFailoverFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountsFailoverFuture.Result. -func (future *AccountsFailoverFuture) result(client AccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsFailoverFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("storage.AccountsFailoverFuture") - return - } - ar.Response = future.Response() - return -} - -// AccountsRestoreBlobRangesFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type AccountsRestoreBlobRangesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountsClient) (BlobRestoreStatus, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountsRestoreBlobRangesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountsRestoreBlobRangesFuture.Result. -func (future *AccountsRestoreBlobRangesFuture) result(client AccountsClient) (brs BlobRestoreStatus, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsRestoreBlobRangesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - brs.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("storage.AccountsRestoreBlobRangesFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if brs.Response.Response, err = future.GetResult(sender); err == nil && brs.Response.Response.StatusCode != http.StatusNoContent { - brs, err = client.RestoreBlobRangesResponder(brs.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.AccountsRestoreBlobRangesFuture", "Result", brs.Response.Response, "Failure responding to request") - } - } - return -} - -// AccountUpdateParameters the parameters that can be provided when updating the storage account -// properties. -type AccountUpdateParameters struct { - // Sku - Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. - Sku *Sku `json:"sku,omitempty"` - // Tags - Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - Tags map[string]*string `json:"tags"` - // Identity - The identity of the resource. - Identity *Identity `json:"identity,omitempty"` - // AccountPropertiesUpdateParameters - The parameters used when updating a storage account. - *AccountPropertiesUpdateParameters `json:"properties,omitempty"` - // Kind - Optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. Possible values include: 'KindStorage', 'KindStorageV2', 'KindBlobStorage', 'KindFileStorage', 'KindBlockBlobStorage' - Kind Kind `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountUpdateParameters. -func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aup.Sku != nil { - objectMap["sku"] = aup.Sku - } - if aup.Tags != nil { - objectMap["tags"] = aup.Tags - } - if aup.Identity != nil { - objectMap["identity"] = aup.Identity - } - if aup.AccountPropertiesUpdateParameters != nil { - objectMap["properties"] = aup.AccountPropertiesUpdateParameters - } - if aup.Kind != "" { - objectMap["kind"] = aup.Kind - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccountUpdateParameters struct. -func (aup *AccountUpdateParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - aup.Sku = &sku - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - aup.Tags = tags - } - case "identity": - if v != nil { - var identity Identity - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - aup.Identity = &identity - } - case "properties": - if v != nil { - var accountPropertiesUpdateParameters AccountPropertiesUpdateParameters - err = json.Unmarshal(*v, &accountPropertiesUpdateParameters) - if err != nil { - return err - } - aup.AccountPropertiesUpdateParameters = &accountPropertiesUpdateParameters - } - case "kind": - if v != nil { - var kind Kind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - aup.Kind = kind - } - } - } - - return nil -} - -// ActiveDirectoryProperties settings properties for Active Directory (AD). -type ActiveDirectoryProperties struct { - // DomainName - Specifies the primary domain that the AD DNS server is authoritative for. - DomainName *string `json:"domainName,omitempty"` - // NetBiosDomainName - Specifies the NetBIOS domain name. - NetBiosDomainName *string `json:"netBiosDomainName,omitempty"` - // ForestName - Specifies the Active Directory forest to get. - ForestName *string `json:"forestName,omitempty"` - // DomainGUID - Specifies the domain GUID. - DomainGUID *string `json:"domainGuid,omitempty"` - // DomainSid - Specifies the security identifier (SID). - DomainSid *string `json:"domainSid,omitempty"` - // AzureStorageSid - Specifies the security identifier (SID) for Azure Storage. - AzureStorageSid *string `json:"azureStorageSid,omitempty"` -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AzureFilesIdentityBasedAuthentication settings for Azure Files identity based authentication. -type AzureFilesIdentityBasedAuthentication struct { - // DirectoryServiceOptions - Indicates the directory service used. Possible values include: 'DirectoryServiceOptionsNone', 'DirectoryServiceOptionsAADDS', 'DirectoryServiceOptionsAD' - DirectoryServiceOptions DirectoryServiceOptions `json:"directoryServiceOptions,omitempty"` - // ActiveDirectoryProperties - Required if choose AD. - ActiveDirectoryProperties *ActiveDirectoryProperties `json:"activeDirectoryProperties,omitempty"` - // DefaultSharePermission - Default share permission for users using Kerberos authentication if RBAC role is not assigned. Possible values include: 'DefaultSharePermissionNone', 'DefaultSharePermissionStorageFileDataSmbShareReader', 'DefaultSharePermissionStorageFileDataSmbShareContributor', 'DefaultSharePermissionStorageFileDataSmbShareElevatedContributor', 'DefaultSharePermissionStorageFileDataSmbShareOwner' - DefaultSharePermission DefaultSharePermission `json:"defaultSharePermission,omitempty"` -} - -// BlobContainer properties of the blob container, including Id, resource name, resource type, Etag. -type BlobContainer struct { - autorest.Response `json:"-"` - // ContainerProperties - Properties of the blob container. - *ContainerProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobContainer. -func (bc BlobContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bc.ContainerProperties != nil { - objectMap["properties"] = bc.ContainerProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BlobContainer struct. -func (bc *BlobContainer) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var containerProperties ContainerProperties - err = json.Unmarshal(*v, &containerProperties) - if err != nil { - return err - } - bc.ContainerProperties = &containerProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - bc.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bc.Type = &typeVar - } - } - } - - return nil -} - -// BlobContainersObjectLevelWormFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type BlobContainersObjectLevelWormFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BlobContainersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BlobContainersObjectLevelWormFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BlobContainersObjectLevelWormFuture.Result. -func (future *BlobContainersObjectLevelWormFuture) result(client BlobContainersClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.BlobContainersObjectLevelWormFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("storage.BlobContainersObjectLevelWormFuture") - return - } - ar.Response = future.Response() - return -} - -// BlobInventoryPolicy the storage account blob inventory policy. -type BlobInventoryPolicy struct { - autorest.Response `json:"-"` - // BlobInventoryPolicyProperties - Returns the storage account blob inventory policy rules. - *BlobInventoryPolicyProperties `json:"properties,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobInventoryPolicy. -func (bip BlobInventoryPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bip.BlobInventoryPolicyProperties != nil { - objectMap["properties"] = bip.BlobInventoryPolicyProperties - } - if bip.SystemData != nil { - objectMap["systemData"] = bip.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BlobInventoryPolicy struct. -func (bip *BlobInventoryPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var blobInventoryPolicyProperties BlobInventoryPolicyProperties - err = json.Unmarshal(*v, &blobInventoryPolicyProperties) - if err != nil { - return err - } - bip.BlobInventoryPolicyProperties = &blobInventoryPolicyProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - bip.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bip.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bip.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bip.Type = &typeVar - } - } - } - - return nil -} - -// BlobInventoryPolicyDefinition an object that defines the blob inventory rule. -type BlobInventoryPolicyDefinition struct { - // Filters - An object that defines the filter set. - Filters *BlobInventoryPolicyFilter `json:"filters,omitempty"` - // Format - This is a required field, it specifies the format for the inventory files. Possible values include: 'FormatCsv', 'FormatParquet' - Format Format `json:"format,omitempty"` - // Schedule - This is a required field. This field is used to schedule an inventory formation. Possible values include: 'ScheduleDaily', 'ScheduleWeekly' - Schedule Schedule `json:"schedule,omitempty"` - // ObjectType - This is a required field. This field specifies the scope of the inventory created either at the blob or container level. Possible values include: 'ObjectTypeBlob', 'ObjectTypeContainer' - ObjectType ObjectType `json:"objectType,omitempty"` - // SchemaFields - This is a required field. This field specifies the fields and properties of the object to be included in the inventory. The Schema field value 'Name' is always required. The valid values for this field for the 'Blob' definition.objectType include 'Name, Creation-Time, Last-Modified, Content-Length, Content-MD5, BlobType, AccessTier, AccessTierChangeTime, Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl, Snapshot, VersionId, IsCurrentVersion, Metadata, LastAccessTime'. The valid values for 'Container' definition.objectType include 'Name, Last-Modified, Metadata, LeaseStatus, LeaseState, LeaseDuration, PublicAccess, HasImmutabilityPolicy, HasLegalHold'. Schema field values 'Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl' are valid only for Hns enabled accounts. - SchemaFields *[]string `json:"schemaFields,omitempty"` -} - -// BlobInventoryPolicyFilter an object that defines the blob inventory rule filter conditions. For 'Blob' -// definition.objectType all filter properties are applicable, 'blobTypes' is required and others are -// optional. For 'Container' definition.objectType only prefixMatch is applicable and is optional. -type BlobInventoryPolicyFilter struct { - // PrefixMatch - An array of strings for blob prefixes to be matched. - PrefixMatch *[]string `json:"prefixMatch,omitempty"` - // BlobTypes - An array of predefined enum values. Valid values include blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. This field is required when definition.objectType property is set to 'Blob'. - BlobTypes *[]string `json:"blobTypes,omitempty"` - // IncludeBlobVersions - Includes blob versions in blob inventory when value is set to true. The definition.schemaFields values 'VersionId and IsCurrentVersion' are required if this property is set to true, else they must be excluded. - IncludeBlobVersions *bool `json:"includeBlobVersions,omitempty"` - // IncludeSnapshots - Includes blob snapshots in blob inventory when value is set to true. The definition.schemaFields value 'Snapshot' is required if this property is set to true, else it must be excluded. - IncludeSnapshots *bool `json:"includeSnapshots,omitempty"` -} - -// BlobInventoryPolicyProperties the storage account blob inventory policy properties. -type BlobInventoryPolicyProperties struct { - // LastModifiedTime - READ-ONLY; Returns the last modified date and time of the blob inventory policy. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Policy - The storage account blob inventory policy object. It is composed of policy rules. - Policy *BlobInventoryPolicySchema `json:"policy,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobInventoryPolicyProperties. -func (bipp BlobInventoryPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bipp.Policy != nil { - objectMap["policy"] = bipp.Policy - } - return json.Marshal(objectMap) -} - -// BlobInventoryPolicyRule an object that wraps the blob inventory rule. Each rule is uniquely defined by -// name. -type BlobInventoryPolicyRule struct { - // Enabled - Rule is enabled when set to true. - Enabled *bool `json:"enabled,omitempty"` - // Name - A rule name can contain any combination of alpha numeric characters. Rule name is case-sensitive. It must be unique within a policy. - Name *string `json:"name,omitempty"` - // Destination - Container name where blob inventory files are stored. Must be pre-created. - Destination *string `json:"destination,omitempty"` - // Definition - An object that defines the blob inventory policy rule. - Definition *BlobInventoryPolicyDefinition `json:"definition,omitempty"` -} - -// BlobInventoryPolicySchema the storage account blob inventory policy rules. -type BlobInventoryPolicySchema struct { - // Enabled - Policy is enabled if set to true. - Enabled *bool `json:"enabled,omitempty"` - // Type - The valid value is Inventory - Type *string `json:"type,omitempty"` - // Rules - The storage account blob inventory policy rules. The rule is applied when it is enabled. - Rules *[]BlobInventoryPolicyRule `json:"rules,omitempty"` -} - -// BlobRestoreParameters blob restore parameters -type BlobRestoreParameters struct { - // TimeToRestore - Restore blob to the specified time. - TimeToRestore *date.Time `json:"timeToRestore,omitempty"` - // BlobRanges - Blob ranges to restore. - BlobRanges *[]BlobRestoreRange `json:"blobRanges,omitempty"` -} - -// BlobRestoreRange blob range -type BlobRestoreRange struct { - // StartRange - Blob start range. This is inclusive. Empty means account start. - StartRange *string `json:"startRange,omitempty"` - // EndRange - Blob end range. This is exclusive. Empty means account end. - EndRange *string `json:"endRange,omitempty"` -} - -// BlobRestoreStatus blob restore status. -type BlobRestoreStatus struct { - autorest.Response `json:"-"` - // Status - READ-ONLY; The status of blob restore progress. Possible values are: - InProgress: Indicates that blob restore is ongoing. - Complete: Indicates that blob restore has been completed successfully. - Failed: Indicates that blob restore is failed. Possible values include: 'BlobRestoreProgressStatusInProgress', 'BlobRestoreProgressStatusComplete', 'BlobRestoreProgressStatusFailed' - Status BlobRestoreProgressStatus `json:"status,omitempty"` - // FailureReason - READ-ONLY; Failure reason when blob restore is failed. - FailureReason *string `json:"failureReason,omitempty"` - // RestoreID - READ-ONLY; Id for tracking blob restore request. - RestoreID *string `json:"restoreId,omitempty"` - // Parameters - READ-ONLY; Blob restore request parameters. - Parameters *BlobRestoreParameters `json:"parameters,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobRestoreStatus. -func (brs BlobRestoreStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BlobServiceItems ... -type BlobServiceItems struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of blob services returned. - Value *[]BlobServiceProperties `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobServiceItems. -func (bsi BlobServiceItems) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BlobServiceProperties the properties of a storage account’s Blob service. -type BlobServiceProperties struct { - autorest.Response `json:"-"` - // BlobServicePropertiesProperties - The properties of a storage account’s Blob service. - *BlobServicePropertiesProperties `json:"properties,omitempty"` - // Sku - READ-ONLY; Sku name and tier. - Sku *Sku `json:"sku,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for BlobServiceProperties. -func (bsp BlobServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bsp.BlobServicePropertiesProperties != nil { - objectMap["properties"] = bsp.BlobServicePropertiesProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BlobServiceProperties struct. -func (bsp *BlobServiceProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var blobServiceProperties BlobServicePropertiesProperties - err = json.Unmarshal(*v, &blobServiceProperties) - if err != nil { - return err - } - bsp.BlobServicePropertiesProperties = &blobServiceProperties - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - bsp.Sku = &sku - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bsp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bsp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bsp.Type = &typeVar - } - } - } - - return nil -} - -// BlobServicePropertiesProperties the properties of a storage account’s Blob service. -type BlobServicePropertiesProperties struct { - // Cors - Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service. - Cors *CorsRules `json:"cors,omitempty"` - // DefaultServiceVersion - DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions. - DefaultServiceVersion *string `json:"defaultServiceVersion,omitempty"` - // DeleteRetentionPolicy - The blob service properties for blob soft delete. - DeleteRetentionPolicy *DeleteRetentionPolicy `json:"deleteRetentionPolicy,omitempty"` - // IsVersioningEnabled - Versioning is enabled if set to true. - IsVersioningEnabled *bool `json:"isVersioningEnabled,omitempty"` - // AutomaticSnapshotPolicyEnabled - Deprecated in favor of isVersioningEnabled property. - AutomaticSnapshotPolicyEnabled *bool `json:"automaticSnapshotPolicyEnabled,omitempty"` - // ChangeFeed - The blob service properties for change feed events. - ChangeFeed *ChangeFeed `json:"changeFeed,omitempty"` - // RestorePolicy - The blob service properties for blob restore policy. - RestorePolicy *RestorePolicyProperties `json:"restorePolicy,omitempty"` - // ContainerDeleteRetentionPolicy - The blob service properties for container soft delete. - ContainerDeleteRetentionPolicy *DeleteRetentionPolicy `json:"containerDeleteRetentionPolicy,omitempty"` - // LastAccessTimeTrackingPolicy - The blob service property to configure last access time based tracking policy. - LastAccessTimeTrackingPolicy *LastAccessTimeTrackingPolicy `json:"lastAccessTimeTrackingPolicy,omitempty"` -} - -// ChangeFeed the blob service properties for change feed events. -type ChangeFeed struct { - // Enabled - Indicates whether change feed event logging is enabled for the Blob service. - Enabled *bool `json:"enabled,omitempty"` - // RetentionInDays - Indicates the duration of changeFeed retention in days. Minimum value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite retention of the change feed. - RetentionInDays *int32 `json:"retentionInDays,omitempty"` -} - -// CheckNameAvailabilityResult the CheckNameAvailability operation response. -type CheckNameAvailabilityResult struct { - autorest.Response `json:"-"` - // NameAvailable - READ-ONLY; Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or is invalid and cannot be used. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - READ-ONLY; Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: 'ReasonAccountNameInvalid', 'ReasonAlreadyExists' - Reason Reason `json:"reason,omitempty"` - // Message - READ-ONLY; Gets an error message explaining the Reason value in more detail. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for CheckNameAvailabilityResult. -func (cnar CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// CloudError an error response from the Storage service. -type CloudError struct { - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from the Storage service. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// ContainerProperties the properties of a container. -type ContainerProperties struct { - // Version - READ-ONLY; The version of the deleted blob container. - Version *string `json:"version,omitempty"` - // Deleted - READ-ONLY; Indicates whether the blob container was deleted. - Deleted *bool `json:"deleted,omitempty"` - // DeletedTime - READ-ONLY; Blob container deletion time. - DeletedTime *date.Time `json:"deletedTime,omitempty"` - // RemainingRetentionDays - READ-ONLY; Remaining retention days for soft deleted blob container. - RemainingRetentionDays *int32 `json:"remainingRetentionDays,omitempty"` - // DefaultEncryptionScope - Default the container to use specified encryption scope for all writes. - DefaultEncryptionScope *string `json:"defaultEncryptionScope,omitempty"` - // DenyEncryptionScopeOverride - Block override of encryption scope from the container default. - DenyEncryptionScopeOverride *bool `json:"denyEncryptionScopeOverride,omitempty"` - // PublicAccess - Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: 'PublicAccessContainer', 'PublicAccessBlob', 'PublicAccessNone' - PublicAccess PublicAccess `json:"publicAccess,omitempty"` - // LastModifiedTime - READ-ONLY; Returns the date and time the container was last modified. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // LeaseStatus - READ-ONLY; The lease status of the container. Possible values include: 'LeaseStatusLocked', 'LeaseStatusUnlocked' - LeaseStatus LeaseStatus `json:"leaseStatus,omitempty"` - // LeaseState - READ-ONLY; Lease state of the container. Possible values include: 'LeaseStateAvailable', 'LeaseStateLeased', 'LeaseStateExpired', 'LeaseStateBreaking', 'LeaseStateBroken' - LeaseState LeaseState `json:"leaseState,omitempty"` - // LeaseDuration - READ-ONLY; Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: 'LeaseDurationInfinite', 'LeaseDurationFixed' - LeaseDuration LeaseDuration `json:"leaseDuration,omitempty"` - // Metadata - A name-value pair to associate with the container as metadata. - Metadata map[string]*string `json:"metadata"` - // ImmutabilityPolicy - READ-ONLY; The ImmutabilityPolicy property of the container. - ImmutabilityPolicy *ImmutabilityPolicyProperties `json:"immutabilityPolicy,omitempty"` - // LegalHold - READ-ONLY; The LegalHold property of the container. - LegalHold *LegalHoldProperties `json:"legalHold,omitempty"` - // HasLegalHold - READ-ONLY; The hasLegalHold public property is set to true by SRP if there are at least one existing tag. The hasLegalHold public property is set to false by SRP if all existing legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. - HasLegalHold *bool `json:"hasLegalHold,omitempty"` - // HasImmutabilityPolicy - READ-ONLY; The hasImmutabilityPolicy public property is set to true by SRP if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public property is set to false by SRP if ImmutabilityPolicy has not been created for this container. - HasImmutabilityPolicy *bool `json:"hasImmutabilityPolicy,omitempty"` - // ImmutableStorageWithVersioning - The object level immutability property of the container. The property is immutable and can only be set to true at the container creation time. Existing containers must undergo a migration process. - ImmutableStorageWithVersioning *ImmutableStorageWithVersioning `json:"immutableStorageWithVersioning,omitempty"` -} - -// MarshalJSON is the custom marshaler for ContainerProperties. -func (cp ContainerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.DefaultEncryptionScope != nil { - objectMap["defaultEncryptionScope"] = cp.DefaultEncryptionScope - } - if cp.DenyEncryptionScopeOverride != nil { - objectMap["denyEncryptionScopeOverride"] = cp.DenyEncryptionScopeOverride - } - if cp.PublicAccess != "" { - objectMap["publicAccess"] = cp.PublicAccess - } - if cp.Metadata != nil { - objectMap["metadata"] = cp.Metadata - } - if cp.ImmutableStorageWithVersioning != nil { - objectMap["immutableStorageWithVersioning"] = cp.ImmutableStorageWithVersioning - } - return json.Marshal(objectMap) -} - -// CorsRule specifies a CORS rule for the Blob service. -type CorsRule struct { - // AllowedOrigins - Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains - AllowedOrigins *[]string `json:"allowedOrigins,omitempty"` - // AllowedMethods - Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin. - AllowedMethods *[]string `json:"allowedMethods,omitempty"` - // MaxAgeInSeconds - Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response. - MaxAgeInSeconds *int32 `json:"maxAgeInSeconds,omitempty"` - // ExposedHeaders - Required if CorsRule element is present. A list of response headers to expose to CORS clients. - ExposedHeaders *[]string `json:"exposedHeaders,omitempty"` - // AllowedHeaders - Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request. - AllowedHeaders *[]string `json:"allowedHeaders,omitempty"` -} - -// CorsRules sets the CORS rules. You can include up to five CorsRule elements in the request. -type CorsRules struct { - // CorsRules - The List of CORS rules. You can include up to five CorsRule elements in the request. - CorsRules *[]CorsRule `json:"corsRules,omitempty"` -} - -// CustomDomain the custom domain assigned to this storage account. This can be set via Update. -type CustomDomain struct { - // Name - Gets or sets the custom domain name assigned to the storage account. Name is the CNAME source. - Name *string `json:"name,omitempty"` - // UseSubDomainName - Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. - UseSubDomainName *bool `json:"useSubDomainName,omitempty"` -} - -// DateAfterCreation object to define the number of days after creation. -type DateAfterCreation struct { - // DaysAfterCreationGreaterThan - Value indicating the age in days after creation - DaysAfterCreationGreaterThan *float64 `json:"daysAfterCreationGreaterThan,omitempty"` -} - -// DateAfterModification object to define the number of days after object last modification Or last access. -// Properties daysAfterModificationGreaterThan and daysAfterLastAccessTimeGreaterThan are mutually -// exclusive. -type DateAfterModification struct { - // DaysAfterModificationGreaterThan - Value indicating the age in days after last modification - DaysAfterModificationGreaterThan *float64 `json:"daysAfterModificationGreaterThan,omitempty"` - // DaysAfterLastAccessTimeGreaterThan - Value indicating the age in days after last blob access. This property can only be used in conjunction with last access time tracking policy - DaysAfterLastAccessTimeGreaterThan *float64 `json:"daysAfterLastAccessTimeGreaterThan,omitempty"` -} - -// DeletedAccount deleted storage account -type DeletedAccount struct { - autorest.Response `json:"-"` - // DeletedAccountProperties - Properties of the deleted account. - *DeletedAccountProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeletedAccount. -func (da DeletedAccount) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if da.DeletedAccountProperties != nil { - objectMap["properties"] = da.DeletedAccountProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DeletedAccount struct. -func (da *DeletedAccount) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var deletedAccountProperties DeletedAccountProperties - err = json.Unmarshal(*v, &deletedAccountProperties) - if err != nil { - return err - } - da.DeletedAccountProperties = &deletedAccountProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - da.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - da.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - da.Type = &typeVar - } - } - } - - return nil -} - -// DeletedAccountListResult the response from the List Deleted Accounts operation. -type DeletedAccountListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Gets the list of deleted accounts and their properties. - Value *[]DeletedAccount `json:"value,omitempty"` - // NextLink - READ-ONLY; Request URL that can be used to query next page of deleted accounts. Returned when total number of requested deleted accounts exceed maximum page size. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeletedAccountListResult. -func (dalr DeletedAccountListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DeletedAccountListResultIterator provides access to a complete listing of DeletedAccount values. -type DeletedAccountListResultIterator struct { - i int - page DeletedAccountListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DeletedAccountListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeletedAccountListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DeletedAccountListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DeletedAccountListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DeletedAccountListResultIterator) Response() DeletedAccountListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DeletedAccountListResultIterator) Value() DeletedAccount { - if !iter.page.NotDone() { - return DeletedAccount{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DeletedAccountListResultIterator type. -func NewDeletedAccountListResultIterator(page DeletedAccountListResultPage) DeletedAccountListResultIterator { - return DeletedAccountListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dalr DeletedAccountListResult) IsEmpty() bool { - return dalr.Value == nil || len(*dalr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dalr DeletedAccountListResult) hasNextLink() bool { - return dalr.NextLink != nil && len(*dalr.NextLink) != 0 -} - -// deletedAccountListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dalr DeletedAccountListResult) deletedAccountListResultPreparer(ctx context.Context) (*http.Request, error) { - if !dalr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dalr.NextLink))) -} - -// DeletedAccountListResultPage contains a page of DeletedAccount values. -type DeletedAccountListResultPage struct { - fn func(context.Context, DeletedAccountListResult) (DeletedAccountListResult, error) - dalr DeletedAccountListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DeletedAccountListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DeletedAccountListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dalr) - if err != nil { - return err - } - page.dalr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DeletedAccountListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DeletedAccountListResultPage) NotDone() bool { - return !page.dalr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DeletedAccountListResultPage) Response() DeletedAccountListResult { - return page.dalr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DeletedAccountListResultPage) Values() []DeletedAccount { - if page.dalr.IsEmpty() { - return nil - } - return *page.dalr.Value -} - -// Creates a new instance of the DeletedAccountListResultPage type. -func NewDeletedAccountListResultPage(cur DeletedAccountListResult, getNextPage func(context.Context, DeletedAccountListResult) (DeletedAccountListResult, error)) DeletedAccountListResultPage { - return DeletedAccountListResultPage{ - fn: getNextPage, - dalr: cur, - } -} - -// DeletedAccountProperties attributes of a deleted storage account. -type DeletedAccountProperties struct { - // StorageAccountResourceID - READ-ONLY; Full resource id of the original storage account. - StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"` - // Location - READ-ONLY; Location of the deleted account. - Location *string `json:"location,omitempty"` - // RestoreReference - READ-ONLY; Can be used to attempt recovering this deleted account via PutStorageAccount API. - RestoreReference *string `json:"restoreReference,omitempty"` - // CreationTime - READ-ONLY; Creation time of the deleted account. - CreationTime *string `json:"creationTime,omitempty"` - // DeletionTime - READ-ONLY; Deletion time of the deleted account. - DeletionTime *string `json:"deletionTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for DeletedAccountProperties. -func (dap DeletedAccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DeletedShare the deleted share to be restored. -type DeletedShare struct { - // DeletedShareName - Required. Identify the name of the deleted share that will be restored. - DeletedShareName *string `json:"deletedShareName,omitempty"` - // DeletedShareVersion - Required. Identify the version of the deleted share that will be restored. - DeletedShareVersion *string `json:"deletedShareVersion,omitempty"` -} - -// DeleteRetentionPolicy the service properties for soft delete. -type DeleteRetentionPolicy struct { - // Enabled - Indicates whether DeleteRetentionPolicy is enabled. - Enabled *bool `json:"enabled,omitempty"` - // Days - Indicates the number of days that the deleted item should be retained. The minimum specified value can be 1 and the maximum value can be 365. - Days *int32 `json:"days,omitempty"` -} - -// Dimension dimension of blobs, possibly be blob type or access tier. -type Dimension struct { - // Name - Display name of dimension. - Name *string `json:"name,omitempty"` - // DisplayName - Display name of dimension. - DisplayName *string `json:"displayName,omitempty"` -} - -// Encryption the encryption settings on the storage account. -type Encryption struct { - // Services - List of services which support encryption. - Services *EncryptionServices `json:"services,omitempty"` - // KeySource - The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: 'KeySourceMicrosoftStorage', 'KeySourceMicrosoftKeyvault' - KeySource KeySource `json:"keySource,omitempty"` - // RequireInfrastructureEncryption - A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest. - RequireInfrastructureEncryption *bool `json:"requireInfrastructureEncryption,omitempty"` - // KeyVaultProperties - Properties provided by key vault. - KeyVaultProperties *KeyVaultProperties `json:"keyvaultproperties,omitempty"` - // EncryptionIdentity - The identity to be used with service-side encryption at rest. - EncryptionIdentity *EncryptionIdentity `json:"identity,omitempty"` -} - -// EncryptionIdentity encryption identity for the storage account. -type EncryptionIdentity struct { - // EncryptionUserAssignedIdentity - Resource identifier of the UserAssigned identity to be associated with server-side encryption on the storage account. - EncryptionUserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` -} - -// EncryptionScope the Encryption Scope resource. -type EncryptionScope struct { - autorest.Response `json:"-"` - // EncryptionScopeProperties - Properties of the encryption scope. - *EncryptionScopeProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncryptionScope. -func (es EncryptionScope) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if es.EncryptionScopeProperties != nil { - objectMap["properties"] = es.EncryptionScopeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for EncryptionScope struct. -func (es *EncryptionScope) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var encryptionScopeProperties EncryptionScopeProperties - err = json.Unmarshal(*v, &encryptionScopeProperties) - if err != nil { - return err - } - es.EncryptionScopeProperties = &encryptionScopeProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - es.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - es.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - es.Type = &typeVar - } - } - } - - return nil -} - -// EncryptionScopeKeyVaultProperties the key vault properties for the encryption scope. This is a required -// field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. -type EncryptionScopeKeyVaultProperties struct { - // KeyURI - The object identifier for a key vault key object. When applied, the encryption scope will use the key referenced by the identifier to enable customer-managed key support on this encryption scope. - KeyURI *string `json:"keyUri,omitempty"` - // CurrentVersionedKeyIdentifier - READ-ONLY; The object identifier of the current versioned Key Vault Key in use. - CurrentVersionedKeyIdentifier *string `json:"currentVersionedKeyIdentifier,omitempty"` - // LastKeyRotationTimestamp - READ-ONLY; Timestamp of last rotation of the Key Vault Key. - LastKeyRotationTimestamp *date.Time `json:"lastKeyRotationTimestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncryptionScopeKeyVaultProperties. -func (eskvp EncryptionScopeKeyVaultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if eskvp.KeyURI != nil { - objectMap["keyUri"] = eskvp.KeyURI - } - return json.Marshal(objectMap) -} - -// EncryptionScopeListResult list of encryption scopes requested, and if paging is required, a URL to the -// next page of encryption scopes. -type EncryptionScopeListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of encryption scopes requested. - Value *[]EncryptionScope `json:"value,omitempty"` - // NextLink - READ-ONLY; Request URL that can be used to query next page of encryption scopes. Returned when total number of requested encryption scopes exceeds the maximum page size. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncryptionScopeListResult. -func (eslr EncryptionScopeListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// EncryptionScopeListResultIterator provides access to a complete listing of EncryptionScope values. -type EncryptionScopeListResultIterator struct { - i int - page EncryptionScopeListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *EncryptionScopeListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionScopeListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *EncryptionScopeListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter EncryptionScopeListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter EncryptionScopeListResultIterator) Response() EncryptionScopeListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter EncryptionScopeListResultIterator) Value() EncryptionScope { - if !iter.page.NotDone() { - return EncryptionScope{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the EncryptionScopeListResultIterator type. -func NewEncryptionScopeListResultIterator(page EncryptionScopeListResultPage) EncryptionScopeListResultIterator { - return EncryptionScopeListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (eslr EncryptionScopeListResult) IsEmpty() bool { - return eslr.Value == nil || len(*eslr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (eslr EncryptionScopeListResult) hasNextLink() bool { - return eslr.NextLink != nil && len(*eslr.NextLink) != 0 -} - -// encryptionScopeListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (eslr EncryptionScopeListResult) encryptionScopeListResultPreparer(ctx context.Context) (*http.Request, error) { - if !eslr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(eslr.NextLink))) -} - -// EncryptionScopeListResultPage contains a page of EncryptionScope values. -type EncryptionScopeListResultPage struct { - fn func(context.Context, EncryptionScopeListResult) (EncryptionScopeListResult, error) - eslr EncryptionScopeListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *EncryptionScopeListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionScopeListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.eslr) - if err != nil { - return err - } - page.eslr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *EncryptionScopeListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page EncryptionScopeListResultPage) NotDone() bool { - return !page.eslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page EncryptionScopeListResultPage) Response() EncryptionScopeListResult { - return page.eslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page EncryptionScopeListResultPage) Values() []EncryptionScope { - if page.eslr.IsEmpty() { - return nil - } - return *page.eslr.Value -} - -// Creates a new instance of the EncryptionScopeListResultPage type. -func NewEncryptionScopeListResultPage(cur EncryptionScopeListResult, getNextPage func(context.Context, EncryptionScopeListResult) (EncryptionScopeListResult, error)) EncryptionScopeListResultPage { - return EncryptionScopeListResultPage{ - fn: getNextPage, - eslr: cur, - } -} - -// EncryptionScopeProperties properties of the encryption scope. -type EncryptionScopeProperties struct { - // Source - The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. Possible values include: 'EncryptionScopeSourceMicrosoftStorage', 'EncryptionScopeSourceMicrosoftKeyVault' - Source EncryptionScopeSource `json:"source,omitempty"` - // State - The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. Possible values include: 'EncryptionScopeStateEnabled', 'EncryptionScopeStateDisabled' - State EncryptionScopeState `json:"state,omitempty"` - // CreationTime - READ-ONLY; Gets the creation date and time of the encryption scope in UTC. - CreationTime *date.Time `json:"creationTime,omitempty"` - // LastModifiedTime - READ-ONLY; Gets the last modification date and time of the encryption scope in UTC. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // KeyVaultProperties - The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. - KeyVaultProperties *EncryptionScopeKeyVaultProperties `json:"keyVaultProperties,omitempty"` - // RequireInfrastructureEncryption - A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest. - RequireInfrastructureEncryption *bool `json:"requireInfrastructureEncryption,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncryptionScopeProperties. -func (esp EncryptionScopeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if esp.Source != "" { - objectMap["source"] = esp.Source - } - if esp.State != "" { - objectMap["state"] = esp.State - } - if esp.KeyVaultProperties != nil { - objectMap["keyVaultProperties"] = esp.KeyVaultProperties - } - if esp.RequireInfrastructureEncryption != nil { - objectMap["requireInfrastructureEncryption"] = esp.RequireInfrastructureEncryption - } - return json.Marshal(objectMap) -} - -// EncryptionService a service that allows server-side encryption to be used. -type EncryptionService struct { - // Enabled - A boolean indicating whether or not the service encrypts the data as it is stored. - Enabled *bool `json:"enabled,omitempty"` - // LastEnabledTime - READ-ONLY; Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. - LastEnabledTime *date.Time `json:"lastEnabledTime,omitempty"` - // KeyType - Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped encryption key will be used. 'Service' key type implies that a default service key is used. Possible values include: 'KeyTypeService', 'KeyTypeAccount' - KeyType KeyType `json:"keyType,omitempty"` -} - -// MarshalJSON is the custom marshaler for EncryptionService. -func (es EncryptionService) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if es.Enabled != nil { - objectMap["enabled"] = es.Enabled - } - if es.KeyType != "" { - objectMap["keyType"] = es.KeyType - } - return json.Marshal(objectMap) -} - -// EncryptionServices a list of services that support encryption. -type EncryptionServices struct { - // Blob - The encryption function of the blob storage service. - Blob *EncryptionService `json:"blob,omitempty"` - // File - The encryption function of the file storage service. - File *EncryptionService `json:"file,omitempty"` - // Table - The encryption function of the table storage service. - Table *EncryptionService `json:"table,omitempty"` - // Queue - The encryption function of the queue storage service. - Queue *EncryptionService `json:"queue,omitempty"` -} - -// Endpoints the URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs -// object. -type Endpoints struct { - // Blob - READ-ONLY; Gets the blob endpoint. - Blob *string `json:"blob,omitempty"` - // Queue - READ-ONLY; Gets the queue endpoint. - Queue *string `json:"queue,omitempty"` - // Table - READ-ONLY; Gets the table endpoint. - Table *string `json:"table,omitempty"` - // File - READ-ONLY; Gets the file endpoint. - File *string `json:"file,omitempty"` - // Web - READ-ONLY; Gets the web endpoint. - Web *string `json:"web,omitempty"` - // Dfs - READ-ONLY; Gets the dfs endpoint. - Dfs *string `json:"dfs,omitempty"` - // MicrosoftEndpoints - Gets the microsoft routing storage endpoints. - MicrosoftEndpoints *AccountMicrosoftEndpoints `json:"microsoftEndpoints,omitempty"` - // InternetEndpoints - Gets the internet routing storage endpoints - InternetEndpoints *AccountInternetEndpoints `json:"internetEndpoints,omitempty"` -} - -// MarshalJSON is the custom marshaler for Endpoints. -func (e Endpoints) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if e.MicrosoftEndpoints != nil { - objectMap["microsoftEndpoints"] = e.MicrosoftEndpoints - } - if e.InternetEndpoints != nil { - objectMap["internetEndpoints"] = e.InternetEndpoints - } - return json.Marshal(objectMap) -} - -// ErrorResponse an error response from the storage resource provider. -type ErrorResponse struct { - // Error - Azure Storage Resource Provider error response body. - Error *ErrorResponseBody `json:"error,omitempty"` -} - -// ErrorResponseBody error response body contract. -type ErrorResponseBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` -} - -// ExtendedLocation the complex type of the extended location. -type ExtendedLocation struct { - // Name - The name of the extended location. - Name *string `json:"name,omitempty"` - // Type - The type of the extended location. Possible values include: 'ExtendedLocationTypesEdgeZone' - Type ExtendedLocationTypes `json:"type,omitempty"` -} - -// FileServiceItems ... -type FileServiceItems struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of file services returned. - Value *[]FileServiceProperties `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileServiceItems. -func (fsi FileServiceItems) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FileServiceProperties the properties of File services in storage account. -type FileServiceProperties struct { - autorest.Response `json:"-"` - // FileServicePropertiesProperties - The properties of File services in storage account. - *FileServicePropertiesProperties `json:"properties,omitempty"` - // Sku - READ-ONLY; Sku name and tier. - Sku *Sku `json:"sku,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileServiceProperties. -func (fsp FileServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fsp.FileServicePropertiesProperties != nil { - objectMap["properties"] = fsp.FileServicePropertiesProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FileServiceProperties struct. -func (fsp *FileServiceProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var fileServiceProperties FileServicePropertiesProperties - err = json.Unmarshal(*v, &fileServiceProperties) - if err != nil { - return err - } - fsp.FileServicePropertiesProperties = &fileServiceProperties - } - case "sku": - if v != nil { - var sku Sku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - fsp.Sku = &sku - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fsp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fsp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fsp.Type = &typeVar - } - } - } - - return nil -} - -// FileServicePropertiesProperties the properties of File services in storage account. -type FileServicePropertiesProperties struct { - // Cors - Specifies CORS rules for the File service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the File service. - Cors *CorsRules `json:"cors,omitempty"` - // ShareDeleteRetentionPolicy - The file service properties for share soft delete. - ShareDeleteRetentionPolicy *DeleteRetentionPolicy `json:"shareDeleteRetentionPolicy,omitempty"` - // ProtocolSettings - Protocol settings for file service - ProtocolSettings *ProtocolSettings `json:"protocolSettings,omitempty"` -} - -// FileShare properties of the file share, including Id, resource name, resource type, Etag. -type FileShare struct { - autorest.Response `json:"-"` - // FileShareProperties - Properties of the file share. - *FileShareProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileShare. -func (fs FileShare) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fs.FileShareProperties != nil { - objectMap["properties"] = fs.FileShareProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FileShare struct. -func (fs *FileShare) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var fileShareProperties FileShareProperties - err = json.Unmarshal(*v, &fileShareProperties) - if err != nil { - return err - } - fs.FileShareProperties = &fileShareProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - fs.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fs.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fs.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fs.Type = &typeVar - } - } - } - - return nil -} - -// FileShareItem the file share properties be listed out. -type FileShareItem struct { - // FileShareProperties - The file share properties be listed out. - *FileShareProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileShareItem. -func (fsi FileShareItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fsi.FileShareProperties != nil { - objectMap["properties"] = fsi.FileShareProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for FileShareItem struct. -func (fsi *FileShareItem) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var fileShareProperties FileShareProperties - err = json.Unmarshal(*v, &fileShareProperties) - if err != nil { - return err - } - fsi.FileShareProperties = &fileShareProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - fsi.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - fsi.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - fsi.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - fsi.Type = &typeVar - } - } - } - - return nil -} - -// FileShareItems response schema. Contains list of shares returned, and if paging is requested or -// required, a URL to next page of shares. -type FileShareItems struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of file shares returned. - Value *[]FileShareItem `json:"value,omitempty"` - // NextLink - READ-ONLY; Request URL that can be used to query next page of shares. Returned when total number of requested shares exceed maximum page size. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileShareItems. -func (fsi FileShareItems) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// FileShareItemsIterator provides access to a complete listing of FileShareItem values. -type FileShareItemsIterator struct { - i int - page FileShareItemsPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *FileShareItemsIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FileShareItemsIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *FileShareItemsIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter FileShareItemsIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter FileShareItemsIterator) Response() FileShareItems { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter FileShareItemsIterator) Value() FileShareItem { - if !iter.page.NotDone() { - return FileShareItem{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the FileShareItemsIterator type. -func NewFileShareItemsIterator(page FileShareItemsPage) FileShareItemsIterator { - return FileShareItemsIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (fsi FileShareItems) IsEmpty() bool { - return fsi.Value == nil || len(*fsi.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (fsi FileShareItems) hasNextLink() bool { - return fsi.NextLink != nil && len(*fsi.NextLink) != 0 -} - -// fileShareItemsPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (fsi FileShareItems) fileShareItemsPreparer(ctx context.Context) (*http.Request, error) { - if !fsi.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(fsi.NextLink))) -} - -// FileShareItemsPage contains a page of FileShareItem values. -type FileShareItemsPage struct { - fn func(context.Context, FileShareItems) (FileShareItems, error) - fsi FileShareItems -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *FileShareItemsPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FileShareItemsPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.fsi) - if err != nil { - return err - } - page.fsi = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *FileShareItemsPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page FileShareItemsPage) NotDone() bool { - return !page.fsi.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page FileShareItemsPage) Response() FileShareItems { - return page.fsi -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page FileShareItemsPage) Values() []FileShareItem { - if page.fsi.IsEmpty() { - return nil - } - return *page.fsi.Value -} - -// Creates a new instance of the FileShareItemsPage type. -func NewFileShareItemsPage(cur FileShareItems, getNextPage func(context.Context, FileShareItems) (FileShareItems, error)) FileShareItemsPage { - return FileShareItemsPage{ - fn: getNextPage, - fsi: cur, - } -} - -// FileShareProperties the properties of the file share. -type FileShareProperties struct { - // LastModifiedTime - READ-ONLY; Returns the date and time the share was last modified. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Metadata - A name-value pair to associate with the share as metadata. - Metadata map[string]*string `json:"metadata"` - // ShareQuota - The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. - ShareQuota *int32 `json:"shareQuota,omitempty"` - // EnabledProtocols - The authentication protocol that is used for the file share. Can only be specified when creating a share. Possible values include: 'EnabledProtocolsSMB', 'EnabledProtocolsNFS' - EnabledProtocols EnabledProtocols `json:"enabledProtocols,omitempty"` - // RootSquash - The property is for NFS share only. The default is NoRootSquash. Possible values include: 'RootSquashTypeNoRootSquash', 'RootSquashTypeRootSquash', 'RootSquashTypeAllSquash' - RootSquash RootSquashType `json:"rootSquash,omitempty"` - // Version - READ-ONLY; The version of the share. - Version *string `json:"version,omitempty"` - // Deleted - READ-ONLY; Indicates whether the share was deleted. - Deleted *bool `json:"deleted,omitempty"` - // DeletedTime - READ-ONLY; The deleted time if the share was deleted. - DeletedTime *date.Time `json:"deletedTime,omitempty"` - // RemainingRetentionDays - READ-ONLY; Remaining retention days for share that was soft deleted. - RemainingRetentionDays *int32 `json:"remainingRetentionDays,omitempty"` - // AccessTier - Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: 'ShareAccessTierTransactionOptimized', 'ShareAccessTierHot', 'ShareAccessTierCool', 'ShareAccessTierPremium' - AccessTier ShareAccessTier `json:"accessTier,omitempty"` - // AccessTierChangeTime - READ-ONLY; Indicates the last modification time for share access tier. - AccessTierChangeTime *date.Time `json:"accessTierChangeTime,omitempty"` - // AccessTierStatus - READ-ONLY; Indicates if there is a pending transition for access tier. - AccessTierStatus *string `json:"accessTierStatus,omitempty"` - // ShareUsageBytes - READ-ONLY; The approximate size of the data stored on the share. Note that this value may not include all recently created or recently resized files. - ShareUsageBytes *int64 `json:"shareUsageBytes,omitempty"` - // LeaseStatus - READ-ONLY; The lease status of the share. Possible values include: 'LeaseStatusLocked', 'LeaseStatusUnlocked' - LeaseStatus LeaseStatus `json:"leaseStatus,omitempty"` - // LeaseState - READ-ONLY; Lease state of the share. Possible values include: 'LeaseStateAvailable', 'LeaseStateLeased', 'LeaseStateExpired', 'LeaseStateBreaking', 'LeaseStateBroken' - LeaseState LeaseState `json:"leaseState,omitempty"` - // LeaseDuration - READ-ONLY; Specifies whether the lease on a share is of infinite or fixed duration, only when the share is leased. Possible values include: 'LeaseDurationInfinite', 'LeaseDurationFixed' - LeaseDuration LeaseDuration `json:"leaseDuration,omitempty"` - // SignedIdentifiers - List of stored access policies specified on the share. - SignedIdentifiers *[]SignedIdentifier `json:"signedIdentifiers,omitempty"` - // SnapshotTime - READ-ONLY; Creation time of share snapshot returned in the response of list shares with expand param "snapshots". - SnapshotTime *date.Time `json:"snapshotTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for FileShareProperties. -func (fsp FileShareProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fsp.Metadata != nil { - objectMap["metadata"] = fsp.Metadata - } - if fsp.ShareQuota != nil { - objectMap["shareQuota"] = fsp.ShareQuota - } - if fsp.EnabledProtocols != "" { - objectMap["enabledProtocols"] = fsp.EnabledProtocols - } - if fsp.RootSquash != "" { - objectMap["rootSquash"] = fsp.RootSquash - } - if fsp.AccessTier != "" { - objectMap["accessTier"] = fsp.AccessTier - } - if fsp.SignedIdentifiers != nil { - objectMap["signedIdentifiers"] = fsp.SignedIdentifiers - } - return json.Marshal(objectMap) -} - -// GeoReplicationStats statistics related to replication for storage account's Blob, Table, Queue and File -// services. It is only available when geo-redundant replication is enabled for the storage account. -type GeoReplicationStats struct { - // Status - READ-ONLY; The status of the secondary location. Possible values are: - Live: Indicates that the secondary location is active and operational. - Bootstrap: Indicates initial synchronization from the primary location to the secondary location is in progress.This typically occurs when replication is first enabled. - Unavailable: Indicates that the secondary location is temporarily unavailable. Possible values include: 'GeoReplicationStatusLive', 'GeoReplicationStatusBootstrap', 'GeoReplicationStatusUnavailable' - Status GeoReplicationStatus `json:"status,omitempty"` - // LastSyncTime - READ-ONLY; All primary writes preceding this UTC date/time value are guaranteed to be available for read operations. Primary writes following this point in time may or may not be available for reads. Element may be default value if value of LastSyncTime is not available, this can happen if secondary is offline or we are in bootstrap. - LastSyncTime *date.Time `json:"lastSyncTime,omitempty"` - // CanFailover - READ-ONLY; A boolean flag which indicates whether or not account failover is supported for the account. - CanFailover *bool `json:"canFailover,omitempty"` -} - -// MarshalJSON is the custom marshaler for GeoReplicationStats. -func (grs GeoReplicationStats) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Identity identity for the resource. -type Identity struct { - // PrincipalID - READ-ONLY; The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty"` - // Type - The identity type. Possible values include: 'IdentityTypeNone', 'IdentityTypeSystemAssigned', 'IdentityTypeUserAssigned', 'IdentityTypeSystemAssignedUserAssigned' - Type IdentityType `json:"type,omitempty"` - // UserAssignedIdentities - Gets or sets a list of key value pairs that describe the set of User Assigned identities that will be used with this storage account. The key is the ARM resource identifier of the identity. Only 1 User Assigned identity is permitted here. - UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities"` -} - -// MarshalJSON is the custom marshaler for Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if i.Type != "" { - objectMap["type"] = i.Type - } - if i.UserAssignedIdentities != nil { - objectMap["userAssignedIdentities"] = i.UserAssignedIdentities - } - return json.Marshal(objectMap) -} - -// ImmutabilityPolicy the ImmutabilityPolicy property of a blob container, including Id, resource name, -// resource type, Etag. -type ImmutabilityPolicy struct { - autorest.Response `json:"-"` - // ImmutabilityPolicyProperty - The properties of an ImmutabilityPolicy of a blob container. - *ImmutabilityPolicyProperty `json:"properties,omitempty"` - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ImmutabilityPolicy. -func (IP ImmutabilityPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if IP.ImmutabilityPolicyProperty != nil { - objectMap["properties"] = IP.ImmutabilityPolicyProperty - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ImmutabilityPolicy struct. -func (IP *ImmutabilityPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var immutabilityPolicyProperty ImmutabilityPolicyProperty - err = json.Unmarshal(*v, &immutabilityPolicyProperty) - if err != nil { - return err - } - IP.ImmutabilityPolicyProperty = &immutabilityPolicyProperty - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - IP.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - IP.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - IP.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - IP.Type = &typeVar - } - } - } - - return nil -} - -// ImmutabilityPolicyProperties the properties of an ImmutabilityPolicy of a blob container. -type ImmutabilityPolicyProperties struct { - // ImmutabilityPolicyProperty - The properties of an ImmutabilityPolicy of a blob container. - *ImmutabilityPolicyProperty `json:"properties,omitempty"` - // Etag - READ-ONLY; ImmutabilityPolicy Etag. - Etag *string `json:"etag,omitempty"` - // UpdateHistory - READ-ONLY; The ImmutabilityPolicy update history of the blob container. - UpdateHistory *[]UpdateHistoryProperty `json:"updateHistory,omitempty"` -} - -// MarshalJSON is the custom marshaler for ImmutabilityPolicyProperties. -func (ipp ImmutabilityPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipp.ImmutabilityPolicyProperty != nil { - objectMap["properties"] = ipp.ImmutabilityPolicyProperty - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ImmutabilityPolicyProperties struct. -func (ipp *ImmutabilityPolicyProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var immutabilityPolicyProperty ImmutabilityPolicyProperty - err = json.Unmarshal(*v, &immutabilityPolicyProperty) - if err != nil { - return err - } - ipp.ImmutabilityPolicyProperty = &immutabilityPolicyProperty - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - ipp.Etag = &etag - } - case "updateHistory": - if v != nil { - var updateHistory []UpdateHistoryProperty - err = json.Unmarshal(*v, &updateHistory) - if err != nil { - return err - } - ipp.UpdateHistory = &updateHistory - } - } - } - - return nil -} - -// ImmutabilityPolicyProperty the properties of an ImmutabilityPolicy of a blob container. -type ImmutabilityPolicyProperty struct { - // ImmutabilityPeriodSinceCreationInDays - The immutability period for the blobs in the container since the policy creation, in days. - ImmutabilityPeriodSinceCreationInDays *int32 `json:"immutabilityPeriodSinceCreationInDays,omitempty"` - // State - READ-ONLY; The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: 'ImmutabilityPolicyStateLocked', 'ImmutabilityPolicyStateUnlocked' - State ImmutabilityPolicyState `json:"state,omitempty"` - // AllowProtectedAppendWrites - This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API - AllowProtectedAppendWrites *bool `json:"allowProtectedAppendWrites,omitempty"` -} - -// MarshalJSON is the custom marshaler for ImmutabilityPolicyProperty. -func (ipp ImmutabilityPolicyProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ipp.ImmutabilityPeriodSinceCreationInDays != nil { - objectMap["immutabilityPeriodSinceCreationInDays"] = ipp.ImmutabilityPeriodSinceCreationInDays - } - if ipp.AllowProtectedAppendWrites != nil { - objectMap["allowProtectedAppendWrites"] = ipp.AllowProtectedAppendWrites - } - return json.Marshal(objectMap) -} - -// ImmutableStorageWithVersioning object level immutability properties of the container. -type ImmutableStorageWithVersioning struct { - // Enabled - This is an immutable property, when set to true it enables object level immutability at the container level. - Enabled *bool `json:"enabled,omitempty"` - // TimeStamp - READ-ONLY; Returns the date and time the object level immutability was enabled. - TimeStamp *date.Time `json:"timeStamp,omitempty"` - // MigrationState - READ-ONLY; This property denotes the container level immutability to object level immutability migration state. Possible values include: 'MigrationStateInProgress', 'MigrationStateCompleted' - MigrationState MigrationState `json:"migrationState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ImmutableStorageWithVersioning. -func (iswv ImmutableStorageWithVersioning) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iswv.Enabled != nil { - objectMap["enabled"] = iswv.Enabled - } - return json.Marshal(objectMap) -} - -// IPRule IP rule with specific IP or IP range in CIDR format. -type IPRule struct { - // IPAddressOrRange - Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. - IPAddressOrRange *string `json:"value,omitempty"` - // Action - The action of IP ACL rule. Possible values include: 'ActionAllow' - Action Action `json:"action,omitempty"` -} - -// KeyCreationTime storage account keys creation time. -type KeyCreationTime struct { - Key1 *date.Time `json:"key1,omitempty"` - Key2 *date.Time `json:"key2,omitempty"` -} - -// KeyPolicy keyPolicy assigned to the storage account. -type KeyPolicy struct { - // KeyExpirationPeriodInDays - The key expiration period in days. - KeyExpirationPeriodInDays *int32 `json:"keyExpirationPeriodInDays,omitempty"` -} - -// KeyVaultProperties properties of key vault. -type KeyVaultProperties struct { - // KeyName - The name of KeyVault key. - KeyName *string `json:"keyname,omitempty"` - // KeyVersion - The version of KeyVault key. - KeyVersion *string `json:"keyversion,omitempty"` - // KeyVaultURI - The Uri of KeyVault. - KeyVaultURI *string `json:"keyvaulturi,omitempty"` - // CurrentVersionedKeyIdentifier - READ-ONLY; The object identifier of the current versioned Key Vault Key in use. - CurrentVersionedKeyIdentifier *string `json:"currentVersionedKeyIdentifier,omitempty"` - // LastKeyRotationTimestamp - READ-ONLY; Timestamp of last rotation of the Key Vault Key. - LastKeyRotationTimestamp *date.Time `json:"lastKeyRotationTimestamp,omitempty"` -} - -// MarshalJSON is the custom marshaler for KeyVaultProperties. -func (kvp KeyVaultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if kvp.KeyName != nil { - objectMap["keyname"] = kvp.KeyName - } - if kvp.KeyVersion != nil { - objectMap["keyversion"] = kvp.KeyVersion - } - if kvp.KeyVaultURI != nil { - objectMap["keyvaulturi"] = kvp.KeyVaultURI - } - return json.Marshal(objectMap) -} - -// LastAccessTimeTrackingPolicy the blob service properties for Last access time based tracking policy. -type LastAccessTimeTrackingPolicy struct { - // Enable - When set to true last access time based tracking is enabled. - Enable *bool `json:"enable,omitempty"` - // Name - Name of the policy. The valid value is AccessTimeTracking. This field is currently read only. Possible values include: 'NameAccessTimeTracking' - Name Name `json:"name,omitempty"` - // TrackingGranularityInDays - The field specifies blob object tracking granularity in days, typically how often the blob object should be tracked.This field is currently read only with value as 1 - TrackingGranularityInDays *int32 `json:"trackingGranularityInDays,omitempty"` - // BlobType - An array of predefined supported blob types. Only blockBlob is the supported value. This field is currently read only - BlobType *[]string `json:"blobType,omitempty"` -} - -// LeaseContainerRequest lease Container request schema. -type LeaseContainerRequest struct { - // Action - Specifies the lease action. Can be one of the available actions. Possible values include: 'Action1Acquire', 'Action1Renew', 'Action1Change', 'Action1Release', 'Action1Break' - Action Action1 `json:"action,omitempty"` - // LeaseID - Identifies the lease. Can be specified in any valid GUID string format. - LeaseID *string `json:"leaseId,omitempty"` - // BreakPeriod - Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - BreakPeriod *int32 `json:"breakPeriod,omitempty"` - // LeaseDuration - Required for acquire. Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. - LeaseDuration *int32 `json:"leaseDuration,omitempty"` - // ProposedLeaseID - Optional for acquire, required for change. Proposed lease ID, in a GUID string format. - ProposedLeaseID *string `json:"proposedLeaseId,omitempty"` -} - -// LeaseContainerResponse lease Container response schema. -type LeaseContainerResponse struct { - autorest.Response `json:"-"` - // LeaseID - Returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release the lease. - LeaseID *string `json:"leaseId,omitempty"` - // LeaseTimeSeconds - Approximate time remaining in the lease period, in seconds. - LeaseTimeSeconds *string `json:"leaseTimeSeconds,omitempty"` -} - -// LeaseShareRequest lease Share request schema. -type LeaseShareRequest struct { - // Action - Specifies the lease action. Can be one of the available actions. Possible values include: 'LeaseShareActionAcquire', 'LeaseShareActionRenew', 'LeaseShareActionChange', 'LeaseShareActionRelease', 'LeaseShareActionBreak' - Action LeaseShareAction `json:"action,omitempty"` - // LeaseID - Identifies the lease. Can be specified in any valid GUID string format. - LeaseID *string `json:"leaseId,omitempty"` - // BreakPeriod - Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. - BreakPeriod *int32 `json:"breakPeriod,omitempty"` - // LeaseDuration - Required for acquire. Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. - LeaseDuration *int32 `json:"leaseDuration,omitempty"` - // ProposedLeaseID - Optional for acquire, required for change. Proposed lease ID, in a GUID string format. - ProposedLeaseID *string `json:"proposedLeaseId,omitempty"` -} - -// LeaseShareResponse lease Share response schema. -type LeaseShareResponse struct { - autorest.Response `json:"-"` - // LeaseID - Returned unique lease ID that must be included with any request to delete the share, or to renew, change, or release the lease. - LeaseID *string `json:"leaseId,omitempty"` - // LeaseTimeSeconds - Approximate time remaining in the lease period, in seconds. - LeaseTimeSeconds *string `json:"leaseTimeSeconds,omitempty"` -} - -// LegalHold the LegalHold property of a blob container. -type LegalHold struct { - autorest.Response `json:"-"` - // HasLegalHold - READ-ONLY; The hasLegalHold public property is set to true by SRP if there are at least one existing tag. The hasLegalHold public property is set to false by SRP if all existing legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. - HasLegalHold *bool `json:"hasLegalHold,omitempty"` - // Tags - Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. - Tags *[]string `json:"tags,omitempty"` -} - -// MarshalJSON is the custom marshaler for LegalHold. -func (lh LegalHold) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lh.Tags != nil { - objectMap["tags"] = lh.Tags - } - return json.Marshal(objectMap) -} - -// LegalHoldProperties the LegalHold property of a blob container. -type LegalHoldProperties struct { - // HasLegalHold - READ-ONLY; The hasLegalHold public property is set to true by SRP if there are at least one existing tag. The hasLegalHold public property is set to false by SRP if all existing legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. - HasLegalHold *bool `json:"hasLegalHold,omitempty"` - // Tags - The list of LegalHold tags of a blob container. - Tags *[]TagProperty `json:"tags,omitempty"` -} - -// MarshalJSON is the custom marshaler for LegalHoldProperties. -func (lhp LegalHoldProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lhp.Tags != nil { - objectMap["tags"] = lhp.Tags - } - return json.Marshal(objectMap) -} - -// ListAccountSasResponse the List SAS credentials operation response. -type ListAccountSasResponse struct { - autorest.Response `json:"-"` - // AccountSasToken - READ-ONLY; List SAS credentials of storage account. - AccountSasToken *string `json:"accountSasToken,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListAccountSasResponse. -func (lasr ListAccountSasResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ListBlobInventoryPolicy list of blob inventory policies returned. -type ListBlobInventoryPolicy struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of blob inventory policies. - Value *[]BlobInventoryPolicy `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListBlobInventoryPolicy. -func (lbip ListBlobInventoryPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ListContainerItem the blob container properties be listed out. -type ListContainerItem struct { - // ContainerProperties - The blob container properties be listed out. - *ContainerProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListContainerItem. -func (lci ListContainerItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lci.ContainerProperties != nil { - objectMap["properties"] = lci.ContainerProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ListContainerItem struct. -func (lci *ListContainerItem) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var containerProperties ContainerProperties - err = json.Unmarshal(*v, &containerProperties) - if err != nil { - return err - } - lci.ContainerProperties = &containerProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - lci.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lci.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lci.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lci.Type = &typeVar - } - } - } - - return nil -} - -// ListContainerItems response schema. Contains list of blobs returned, and if paging is requested or -// required, a URL to next page of containers. -type ListContainerItems struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of blobs containers returned. - Value *[]ListContainerItem `json:"value,omitempty"` - // NextLink - READ-ONLY; Request URL that can be used to query next page of containers. Returned when total number of requested containers exceed maximum page size. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListContainerItems. -func (lci ListContainerItems) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ListContainerItemsIterator provides access to a complete listing of ListContainerItem values. -type ListContainerItemsIterator struct { - i int - page ListContainerItemsPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListContainerItemsIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListContainerItemsIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListContainerItemsIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListContainerItemsIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListContainerItemsIterator) Response() ListContainerItems { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListContainerItemsIterator) Value() ListContainerItem { - if !iter.page.NotDone() { - return ListContainerItem{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListContainerItemsIterator type. -func NewListContainerItemsIterator(page ListContainerItemsPage) ListContainerItemsIterator { - return ListContainerItemsIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lci ListContainerItems) IsEmpty() bool { - return lci.Value == nil || len(*lci.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lci ListContainerItems) hasNextLink() bool { - return lci.NextLink != nil && len(*lci.NextLink) != 0 -} - -// listContainerItemsPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lci ListContainerItems) listContainerItemsPreparer(ctx context.Context) (*http.Request, error) { - if !lci.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lci.NextLink))) -} - -// ListContainerItemsPage contains a page of ListContainerItem values. -type ListContainerItemsPage struct { - fn func(context.Context, ListContainerItems) (ListContainerItems, error) - lci ListContainerItems -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListContainerItemsPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListContainerItemsPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lci) - if err != nil { - return err - } - page.lci = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListContainerItemsPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListContainerItemsPage) NotDone() bool { - return !page.lci.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListContainerItemsPage) Response() ListContainerItems { - return page.lci -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListContainerItemsPage) Values() []ListContainerItem { - if page.lci.IsEmpty() { - return nil - } - return *page.lci.Value -} - -// Creates a new instance of the ListContainerItemsPage type. -func NewListContainerItemsPage(cur ListContainerItems, getNextPage func(context.Context, ListContainerItems) (ListContainerItems, error)) ListContainerItemsPage { - return ListContainerItemsPage{ - fn: getNextPage, - lci: cur, - } -} - -// ListQueue ... -type ListQueue struct { - // ListQueueProperties - List Queue resource properties. - *ListQueueProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListQueue. -func (lq ListQueue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lq.ListQueueProperties != nil { - objectMap["properties"] = lq.ListQueueProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ListQueue struct. -func (lq *ListQueue) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var queueProperties ListQueueProperties - err = json.Unmarshal(*v, &queueProperties) - if err != nil { - return err - } - lq.ListQueueProperties = &queueProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - lq.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - lq.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - lq.Type = &typeVar - } - } - } - - return nil -} - -// ListQueueProperties ... -type ListQueueProperties struct { - // Metadata - A name-value pair that represents queue metadata. - Metadata map[string]*string `json:"metadata"` -} - -// MarshalJSON is the custom marshaler for ListQueueProperties. -func (lqp ListQueueProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if lqp.Metadata != nil { - objectMap["metadata"] = lqp.Metadata - } - return json.Marshal(objectMap) -} - -// ListQueueResource response schema. Contains list of queues returned -type ListQueueResource struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of queues returned. - Value *[]ListQueue `json:"value,omitempty"` - // NextLink - READ-ONLY; Request URL that can be used to list next page of queues - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListQueueResource. -func (lqr ListQueueResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ListQueueResourceIterator provides access to a complete listing of ListQueue values. -type ListQueueResourceIterator struct { - i int - page ListQueueResourcePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListQueueResourceIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListQueueResourceIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListQueueResourceIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListQueueResourceIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListQueueResourceIterator) Response() ListQueueResource { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListQueueResourceIterator) Value() ListQueue { - if !iter.page.NotDone() { - return ListQueue{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListQueueResourceIterator type. -func NewListQueueResourceIterator(page ListQueueResourcePage) ListQueueResourceIterator { - return ListQueueResourceIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (lqr ListQueueResource) IsEmpty() bool { - return lqr.Value == nil || len(*lqr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (lqr ListQueueResource) hasNextLink() bool { - return lqr.NextLink != nil && len(*lqr.NextLink) != 0 -} - -// listQueueResourcePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (lqr ListQueueResource) listQueueResourcePreparer(ctx context.Context) (*http.Request, error) { - if !lqr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(lqr.NextLink))) -} - -// ListQueueResourcePage contains a page of ListQueue values. -type ListQueueResourcePage struct { - fn func(context.Context, ListQueueResource) (ListQueueResource, error) - lqr ListQueueResource -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListQueueResourcePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListQueueResourcePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.lqr) - if err != nil { - return err - } - page.lqr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListQueueResourcePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListQueueResourcePage) NotDone() bool { - return !page.lqr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListQueueResourcePage) Response() ListQueueResource { - return page.lqr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListQueueResourcePage) Values() []ListQueue { - if page.lqr.IsEmpty() { - return nil - } - return *page.lqr.Value -} - -// Creates a new instance of the ListQueueResourcePage type. -func NewListQueueResourcePage(cur ListQueueResource, getNextPage func(context.Context, ListQueueResource) (ListQueueResource, error)) ListQueueResourcePage { - return ListQueueResourcePage{ - fn: getNextPage, - lqr: cur, - } -} - -// ListQueueServices ... -type ListQueueServices struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of queue services returned. - Value *[]QueueServiceProperties `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListQueueServices. -func (lqs ListQueueServices) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ListServiceSasResponse the List service SAS credentials operation response. -type ListServiceSasResponse struct { - autorest.Response `json:"-"` - // ServiceSasToken - READ-ONLY; List service SAS credentials of specific resource. - ServiceSasToken *string `json:"serviceSasToken,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListServiceSasResponse. -func (lssr ListServiceSasResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ListTableResource response schema. Contains list of tables returned -type ListTableResource struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of tables returned. - Value *[]Table `json:"value,omitempty"` - // NextLink - READ-ONLY; Request URL that can be used to query next page of tables - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListTableResource. -func (ltr ListTableResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ListTableResourceIterator provides access to a complete listing of Table values. -type ListTableResourceIterator struct { - i int - page ListTableResourcePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ListTableResourceIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListTableResourceIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ListTableResourceIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ListTableResourceIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ListTableResourceIterator) Response() ListTableResource { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ListTableResourceIterator) Value() Table { - if !iter.page.NotDone() { - return Table{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ListTableResourceIterator type. -func NewListTableResourceIterator(page ListTableResourcePage) ListTableResourceIterator { - return ListTableResourceIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ltr ListTableResource) IsEmpty() bool { - return ltr.Value == nil || len(*ltr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ltr ListTableResource) hasNextLink() bool { - return ltr.NextLink != nil && len(*ltr.NextLink) != 0 -} - -// listTableResourcePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ltr ListTableResource) listTableResourcePreparer(ctx context.Context) (*http.Request, error) { - if !ltr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ltr.NextLink))) -} - -// ListTableResourcePage contains a page of Table values. -type ListTableResourcePage struct { - fn func(context.Context, ListTableResource) (ListTableResource, error) - ltr ListTableResource -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ListTableResourcePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ListTableResourcePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ltr) - if err != nil { - return err - } - page.ltr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ListTableResourcePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ListTableResourcePage) NotDone() bool { - return !page.ltr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ListTableResourcePage) Response() ListTableResource { - return page.ltr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ListTableResourcePage) Values() []Table { - if page.ltr.IsEmpty() { - return nil - } - return *page.ltr.Value -} - -// Creates a new instance of the ListTableResourcePage type. -func NewListTableResourcePage(cur ListTableResource, getNextPage func(context.Context, ListTableResource) (ListTableResource, error)) ListTableResourcePage { - return ListTableResourcePage{ - fn: getNextPage, - ltr: cur, - } -} - -// ListTableServices ... -type ListTableServices struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List of table services returned. - Value *[]TableServiceProperties `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for ListTableServices. -func (lts ListTableServices) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ManagementPolicy the Get Storage Account ManagementPolicies operation response. -type ManagementPolicy struct { - autorest.Response `json:"-"` - // ManagementPolicyProperties - Returns the Storage Account Data Policies Rules. - *ManagementPolicyProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagementPolicy. -func (mp ManagementPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mp.ManagementPolicyProperties != nil { - objectMap["properties"] = mp.ManagementPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagementPolicy struct. -func (mp *ManagementPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var managementPolicyProperties ManagementPolicyProperties - err = json.Unmarshal(*v, &managementPolicyProperties) - if err != nil { - return err - } - mp.ManagementPolicyProperties = &managementPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mp.Type = &typeVar - } - } - } - - return nil -} - -// ManagementPolicyAction actions are applied to the filtered blobs when the execution condition is met. -type ManagementPolicyAction struct { - // BaseBlob - The management policy action for base blob - BaseBlob *ManagementPolicyBaseBlob `json:"baseBlob,omitempty"` - // Snapshot - The management policy action for snapshot - Snapshot *ManagementPolicySnapShot `json:"snapshot,omitempty"` - // Version - The management policy action for version - Version *ManagementPolicyVersion `json:"version,omitempty"` -} - -// ManagementPolicyBaseBlob management policy action for base blob. -type ManagementPolicyBaseBlob struct { - // TierToCool - The function to tier blobs to cool storage. Support blobs currently at Hot tier - TierToCool *DateAfterModification `json:"tierToCool,omitempty"` - // TierToArchive - The function to tier blobs to archive storage. Support blobs currently at Hot or Cool tier - TierToArchive *DateAfterModification `json:"tierToArchive,omitempty"` - // Delete - The function to delete the blob - Delete *DateAfterModification `json:"delete,omitempty"` - // EnableAutoTierToHotFromCool - This property enables auto tiering of a blob from cool to hot on a blob access. This property requires tierToCool.daysAfterLastAccessTimeGreaterThan. - EnableAutoTierToHotFromCool *bool `json:"enableAutoTierToHotFromCool,omitempty"` -} - -// ManagementPolicyDefinition an object that defines the Lifecycle rule. Each definition is made up with a -// filters set and an actions set. -type ManagementPolicyDefinition struct { - // Actions - An object that defines the action set. - Actions *ManagementPolicyAction `json:"actions,omitempty"` - // Filters - An object that defines the filter set. - Filters *ManagementPolicyFilter `json:"filters,omitempty"` -} - -// ManagementPolicyFilter filters limit rule actions to a subset of blobs within the storage account. If -// multiple filters are defined, a logical AND is performed on all filters. -type ManagementPolicyFilter struct { - // PrefixMatch - An array of strings for prefixes to be match. - PrefixMatch *[]string `json:"prefixMatch,omitempty"` - // BlobTypes - An array of predefined enum values. Currently blockBlob supports all tiering and delete actions. Only delete actions are supported for appendBlob. - BlobTypes *[]string `json:"blobTypes,omitempty"` - // BlobIndexMatch - An array of blob index tag based filters, there can be at most 10 tag filters - BlobIndexMatch *[]TagFilter `json:"blobIndexMatch,omitempty"` -} - -// ManagementPolicyProperties the Storage Account ManagementPolicy properties. -type ManagementPolicyProperties struct { - // LastModifiedTime - READ-ONLY; Returns the date and time the ManagementPolicies was last modified. - LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // Policy - The Storage Account ManagementPolicy, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - Policy *ManagementPolicySchema `json:"policy,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagementPolicyProperties. -func (mpp ManagementPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mpp.Policy != nil { - objectMap["policy"] = mpp.Policy - } - return json.Marshal(objectMap) -} - -// ManagementPolicyRule an object that wraps the Lifecycle rule. Each rule is uniquely defined by name. -type ManagementPolicyRule struct { - // Enabled - Rule is enabled if set to true. - Enabled *bool `json:"enabled,omitempty"` - // Name - A rule name can contain any combination of alpha numeric characters. Rule name is case-sensitive. It must be unique within a policy. - Name *string `json:"name,omitempty"` - // Type - The valid value is Lifecycle - Type *string `json:"type,omitempty"` - // Definition - An object that defines the Lifecycle rule. - Definition *ManagementPolicyDefinition `json:"definition,omitempty"` -} - -// ManagementPolicySchema the Storage Account ManagementPolicies Rules. See more details in: -// https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. -type ManagementPolicySchema struct { - // Rules - The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - Rules *[]ManagementPolicyRule `json:"rules,omitempty"` -} - -// ManagementPolicySnapShot management policy action for snapshot. -type ManagementPolicySnapShot struct { - // TierToCool - The function to tier blob snapshot to cool storage. Support blob snapshot currently at Hot tier - TierToCool *DateAfterCreation `json:"tierToCool,omitempty"` - // TierToArchive - The function to tier blob snapshot to archive storage. Support blob snapshot currently at Hot or Cool tier - TierToArchive *DateAfterCreation `json:"tierToArchive,omitempty"` - // Delete - The function to delete the blob snapshot - Delete *DateAfterCreation `json:"delete,omitempty"` -} - -// ManagementPolicyVersion management policy action for blob version. -type ManagementPolicyVersion struct { - // TierToCool - The function to tier blob version to cool storage. Support blob version currently at Hot tier - TierToCool *DateAfterCreation `json:"tierToCool,omitempty"` - // TierToArchive - The function to tier blob version to archive storage. Support blob version currently at Hot or Cool tier - TierToArchive *DateAfterCreation `json:"tierToArchive,omitempty"` - // Delete - The function to delete the blob version - Delete *DateAfterCreation `json:"delete,omitempty"` -} - -// MetricSpecification metric specification of operation. -type MetricSpecification struct { - // Name - Name of metric specification. - Name *string `json:"name,omitempty"` - // DisplayName - Display name of metric specification. - DisplayName *string `json:"displayName,omitempty"` - // DisplayDescription - Display description of metric specification. - DisplayDescription *string `json:"displayDescription,omitempty"` - // Unit - Unit could be Bytes or Count. - Unit *string `json:"unit,omitempty"` - // Dimensions - Dimensions of blobs, including blob type and access tier. - Dimensions *[]Dimension `json:"dimensions,omitempty"` - // AggregationType - Aggregation type could be Average. - AggregationType *string `json:"aggregationType,omitempty"` - // FillGapWithZero - The property to decide fill gap with zero or not. - FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` - // Category - The category this metric specification belong to, could be Capacity. - Category *string `json:"category,omitempty"` - // ResourceIDDimensionNameOverride - Account Resource Id. - ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` -} - -// Multichannel multichannel setting. Applies to Premium FileStorage only. -type Multichannel struct { - // Enabled - Indicates whether multichannel is enabled - Enabled *bool `json:"enabled,omitempty"` -} - -// NetworkRuleSet network rule set -type NetworkRuleSet struct { - // Bypass - Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics. Possible values include: 'BypassNone', 'BypassLogging', 'BypassMetrics', 'BypassAzureServices' - Bypass Bypass `json:"bypass,omitempty"` - // ResourceAccessRules - Sets the resource access rules - ResourceAccessRules *[]ResourceAccessRule `json:"resourceAccessRules,omitempty"` - // VirtualNetworkRules - Sets the virtual network rules - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` - // IPRules - Sets the IP ACL rules - IPRules *[]IPRule `json:"ipRules,omitempty"` - // DefaultAction - Specifies the default action of allow or deny when no other rules match. Possible values include: 'DefaultActionAllow', 'DefaultActionDeny' - DefaultAction DefaultAction `json:"defaultAction,omitempty"` -} - -// ObjectReplicationPolicies list storage account object replication policies. -type ObjectReplicationPolicies struct { - autorest.Response `json:"-"` - // Value - The replication policy between two storage accounts. - Value *[]ObjectReplicationPolicy `json:"value,omitempty"` -} - -// ObjectReplicationPolicy the replication policy between two storage accounts. Multiple rules can be -// defined in one policy. -type ObjectReplicationPolicy struct { - autorest.Response `json:"-"` - // ObjectReplicationPolicyProperties - Returns the Storage Account Object Replication Policy. - *ObjectReplicationPolicyProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ObjectReplicationPolicy. -func (orp ObjectReplicationPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if orp.ObjectReplicationPolicyProperties != nil { - objectMap["properties"] = orp.ObjectReplicationPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ObjectReplicationPolicy struct. -func (orp *ObjectReplicationPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var objectReplicationPolicyProperties ObjectReplicationPolicyProperties - err = json.Unmarshal(*v, &objectReplicationPolicyProperties) - if err != nil { - return err - } - orp.ObjectReplicationPolicyProperties = &objectReplicationPolicyProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - orp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - orp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - orp.Type = &typeVar - } - } - } - - return nil -} - -// ObjectReplicationPolicyFilter filters limit replication to a subset of blobs within the storage account. -// A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is -// performed on all filters. -type ObjectReplicationPolicyFilter struct { - // PrefixMatch - Optional. Filters the results to replicate only blobs whose names begin with the specified prefix. - PrefixMatch *[]string `json:"prefixMatch,omitempty"` - // MinCreationTime - Blobs created after the time will be replicated to the destination. It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z - MinCreationTime *string `json:"minCreationTime,omitempty"` -} - -// ObjectReplicationPolicyProperties the Storage Account ObjectReplicationPolicy properties. -type ObjectReplicationPolicyProperties struct { - // PolicyID - READ-ONLY; A unique id for object replication policy. - PolicyID *string `json:"policyId,omitempty"` - // EnabledTime - READ-ONLY; Indicates when the policy is enabled on the source account. - EnabledTime *date.Time `json:"enabledTime,omitempty"` - // SourceAccount - Required. Source account name. It should be full resource id if allowCrossTenantReplication set to false. - SourceAccount *string `json:"sourceAccount,omitempty"` - // DestinationAccount - Required. Destination account name. It should be full resource id if allowCrossTenantReplication set to false. - DestinationAccount *string `json:"destinationAccount,omitempty"` - // Rules - The storage account object replication rules. - Rules *[]ObjectReplicationPolicyRule `json:"rules,omitempty"` -} - -// MarshalJSON is the custom marshaler for ObjectReplicationPolicyProperties. -func (orpp ObjectReplicationPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if orpp.SourceAccount != nil { - objectMap["sourceAccount"] = orpp.SourceAccount - } - if orpp.DestinationAccount != nil { - objectMap["destinationAccount"] = orpp.DestinationAccount - } - if orpp.Rules != nil { - objectMap["rules"] = orpp.Rules - } - return json.Marshal(objectMap) -} - -// ObjectReplicationPolicyRule the replication policy rule between two containers. -type ObjectReplicationPolicyRule struct { - // RuleID - Rule Id is auto-generated for each new rule on destination account. It is required for put policy on source account. - RuleID *string `json:"ruleId,omitempty"` - // SourceContainer - Required. Source container name. - SourceContainer *string `json:"sourceContainer,omitempty"` - // DestinationContainer - Required. Destination container name. - DestinationContainer *string `json:"destinationContainer,omitempty"` - // Filters - Optional. An object that defines the filter set. - Filters *ObjectReplicationPolicyFilter `json:"filters,omitempty"` -} - -// Operation storage REST API operation definition. -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - The origin of operations. - Origin *string `json:"origin,omitempty"` - // OperationProperties - Properties of operation, include metric specifications. - *OperationProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if o.Name != nil { - objectMap["name"] = o.Name - } - if o.Display != nil { - objectMap["display"] = o.Display - } - if o.Origin != nil { - objectMap["origin"] = o.Origin - } - if o.OperationProperties != nil { - objectMap["properties"] = o.OperationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Operation struct. -func (o *Operation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - o.Name = &name - } - case "display": - if v != nil { - var display OperationDisplay - err = json.Unmarshal(*v, &display) - if err != nil { - return err - } - o.Display = &display - } - case "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - o.Origin = &origin - } - case "properties": - if v != nil { - var operationProperties OperationProperties - err = json.Unmarshal(*v, &operationProperties) - if err != nil { - return err - } - o.OperationProperties = &operationProperties - } - } - } - - return nil -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft Storage. - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed etc. - Resource *string `json:"resource,omitempty"` - // Operation - Type of operation: get, read, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - Description of the operation. - Description *string `json:"description,omitempty"` -} - -// OperationListResult result of the request to list Storage operations. It contains a list of operations -// and a URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of Storage operations supported by the Storage resource provider. - Value *[]Operation `json:"value,omitempty"` -} - -// OperationProperties properties of operation, include metric specifications. -type OperationProperties struct { - // ServiceSpecification - One property of operation, include metric specifications. - ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// PrivateEndpoint the Private Endpoint resource. -type PrivateEndpoint struct { - // ID - READ-ONLY; The ARM identifier for Private Endpoint - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpoint. -func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection the Private Endpoint Connection resource. -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult list of private endpoint connection associated with the specified -// storage account -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of the PrivateEndpointConnectProperties. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - The resource of private end point. - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // ProvisioningState - The provisioning state of the private endpoint connection resource. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' - ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.PrivateLinkResourceProperties != nil { - objectMap["properties"] = plr.PrivateLinkResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. -func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - The private link resource Private link DNS zone name. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plrp.RequiredZoneNames != nil { - objectMap["requiredZoneNames"] = plrp.RequiredZoneNames - } - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionState a collection of information about the state of the connection between -// service consumer and provider. -type PrivateLinkServiceConnectionState struct { - // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'PrivateEndpointServiceConnectionStatusPending', 'PrivateEndpointServiceConnectionStatusApproved', 'PrivateEndpointServiceConnectionStatusRejected' - Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` - // Description - The reason for approval/rejection of the connection. - Description *string `json:"description,omitempty"` - // ActionRequired - A message indicating if changes on the service provider require any updates on the consumer. - ActionRequired *string `json:"actionRequired,omitempty"` -} - -// ProtocolSettings protocol settings for file service -type ProtocolSettings struct { - // Smb - Setting for SMB protocol - Smb *SmbSetting `json:"smb,omitempty"` -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Queue ... -type Queue struct { - autorest.Response `json:"-"` - // QueueProperties - Queue resource properties. - *QueueProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Queue. -func (q Queue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if q.QueueProperties != nil { - objectMap["properties"] = q.QueueProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Queue struct. -func (q *Queue) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var queueProperties QueueProperties - err = json.Unmarshal(*v, &queueProperties) - if err != nil { - return err - } - q.QueueProperties = &queueProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - q.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - q.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - q.Type = &typeVar - } - } - } - - return nil -} - -// QueueProperties ... -type QueueProperties struct { - // Metadata - A name-value pair that represents queue metadata. - Metadata map[string]*string `json:"metadata"` - // ApproximateMessageCount - READ-ONLY; Integer indicating an approximate number of messages in the queue. This number is not lower than the actual number of messages in the queue, but could be higher. - ApproximateMessageCount *int32 `json:"approximateMessageCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueueProperties. -func (qp QueueProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if qp.Metadata != nil { - objectMap["metadata"] = qp.Metadata - } - return json.Marshal(objectMap) -} - -// QueueServiceProperties the properties of a storage account’s Queue service. -type QueueServiceProperties struct { - autorest.Response `json:"-"` - // QueueServicePropertiesProperties - The properties of a storage account’s Queue service. - *QueueServicePropertiesProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for QueueServiceProperties. -func (qsp QueueServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if qsp.QueueServicePropertiesProperties != nil { - objectMap["properties"] = qsp.QueueServicePropertiesProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for QueueServiceProperties struct. -func (qsp *QueueServiceProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var queueServiceProperties QueueServicePropertiesProperties - err = json.Unmarshal(*v, &queueServiceProperties) - if err != nil { - return err - } - qsp.QueueServicePropertiesProperties = &queueServiceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - qsp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - qsp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - qsp.Type = &typeVar - } - } - } - - return nil -} - -// QueueServicePropertiesProperties the properties of a storage account’s Queue service. -type QueueServicePropertiesProperties struct { - // Cors - Specifies CORS rules for the Queue service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Queue service. - Cors *CorsRules `json:"cors,omitempty"` -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceAccessRule resource Access Rule. -type ResourceAccessRule struct { - // TenantID - Tenant Id - TenantID *string `json:"tenantId,omitempty"` - // ResourceID - Resource Id - ResourceID *string `json:"resourceId,omitempty"` -} - -// RestorePolicyProperties the blob service properties for blob restore policy -type RestorePolicyProperties struct { - // Enabled - Blob restore is enabled if set to true. - Enabled *bool `json:"enabled,omitempty"` - // Days - how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days. - Days *int32 `json:"days,omitempty"` - // LastEnabledTime - READ-ONLY; Deprecated in favor of minRestoreTime property. - LastEnabledTime *date.Time `json:"lastEnabledTime,omitempty"` - // MinRestoreTime - READ-ONLY; Returns the minimum date and time that the restore can be started. - MinRestoreTime *date.Time `json:"minRestoreTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestorePolicyProperties. -func (rpp RestorePolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rpp.Enabled != nil { - objectMap["enabled"] = rpp.Enabled - } - if rpp.Days != nil { - objectMap["days"] = rpp.Days - } - return json.Marshal(objectMap) -} - -// Restriction the restriction because of which SKU cannot be used. -type Restriction struct { - // Type - READ-ONLY; The type of restrictions. As of now only possible value for this is location. - Type *string `json:"type,omitempty"` - // Values - READ-ONLY; The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. - Values *[]string `json:"values,omitempty"` - // ReasonCode - The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: 'ReasonCodeQuotaID', 'ReasonCodeNotAvailableForSubscription' - ReasonCode ReasonCode `json:"reasonCode,omitempty"` -} - -// MarshalJSON is the custom marshaler for Restriction. -func (r Restriction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.ReasonCode != "" { - objectMap["reasonCode"] = r.ReasonCode - } - return json.Marshal(objectMap) -} - -// RoutingPreference routing preference defines the type of network, either microsoft or internet routing -// to be used to deliver the user data, the default option is microsoft routing -type RoutingPreference struct { - // RoutingChoice - Routing Choice defines the kind of network routing opted by the user. Possible values include: 'RoutingChoiceMicrosoftRouting', 'RoutingChoiceInternetRouting' - RoutingChoice RoutingChoice `json:"routingChoice,omitempty"` - // PublishMicrosoftEndpoints - A boolean flag which indicates whether microsoft routing storage endpoints are to be published - PublishMicrosoftEndpoints *bool `json:"publishMicrosoftEndpoints,omitempty"` - // PublishInternetEndpoints - A boolean flag which indicates whether internet routing storage endpoints are to be published - PublishInternetEndpoints *bool `json:"publishInternetEndpoints,omitempty"` -} - -// SasPolicy sasPolicy assigned to the storage account. -type SasPolicy struct { - // SasExpirationPeriod - The SAS expiration period, DD.HH:MM:SS. - SasExpirationPeriod *string `json:"sasExpirationPeriod,omitempty"` - // ExpirationAction - The SAS expiration action. Can only be Log. - ExpirationAction *string `json:"expirationAction,omitempty"` -} - -// ServiceSasParameters the parameters to list service SAS credentials of a specific resource. -type ServiceSasParameters struct { - // CanonicalizedResource - The canonical path to the signed resource. - CanonicalizedResource *string `json:"canonicalizedResource,omitempty"` - // Resource - The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: 'SignedResourceB', 'SignedResourceC', 'SignedResourceF', 'SignedResourceS' - Resource SignedResource `json:"signedResource,omitempty"` - // Permissions - The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: 'PermissionsR', 'PermissionsD', 'PermissionsW', 'PermissionsL', 'PermissionsA', 'PermissionsC', 'PermissionsU', 'PermissionsP' - Permissions Permissions `json:"signedPermission,omitempty"` - // IPAddressOrRange - An IP address or a range of IP addresses from which to accept requests. - IPAddressOrRange *string `json:"signedIp,omitempty"` - // Protocols - The protocol permitted for a request made with the account SAS. Possible values include: 'HTTPProtocolHttpshttp', 'HTTPProtocolHTTPS' - Protocols HTTPProtocol `json:"signedProtocol,omitempty"` - // SharedAccessStartTime - The time at which the SAS becomes valid. - SharedAccessStartTime *date.Time `json:"signedStart,omitempty"` - // SharedAccessExpiryTime - The time at which the shared access signature becomes invalid. - SharedAccessExpiryTime *date.Time `json:"signedExpiry,omitempty"` - // Identifier - A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. - Identifier *string `json:"signedIdentifier,omitempty"` - // PartitionKeyStart - The start of partition key. - PartitionKeyStart *string `json:"startPk,omitempty"` - // PartitionKeyEnd - The end of partition key. - PartitionKeyEnd *string `json:"endPk,omitempty"` - // RowKeyStart - The start of row key. - RowKeyStart *string `json:"startRk,omitempty"` - // RowKeyEnd - The end of row key. - RowKeyEnd *string `json:"endRk,omitempty"` - // KeyToSign - The key to sign the account SAS token with. - KeyToSign *string `json:"keyToSign,omitempty"` - // CacheControl - The response header override for cache control. - CacheControl *string `json:"rscc,omitempty"` - // ContentDisposition - The response header override for content disposition. - ContentDisposition *string `json:"rscd,omitempty"` - // ContentEncoding - The response header override for content encoding. - ContentEncoding *string `json:"rsce,omitempty"` - // ContentLanguage - The response header override for content language. - ContentLanguage *string `json:"rscl,omitempty"` - // ContentType - The response header override for content type. - ContentType *string `json:"rsct,omitempty"` -} - -// ServiceSpecification one property of operation, include metric specifications. -type ServiceSpecification struct { - // MetricSpecifications - Metric specifications of operation. - MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` -} - -// SignedIdentifier ... -type SignedIdentifier struct { - // ID - An unique identifier of the stored access policy. - ID *string `json:"id,omitempty"` - // AccessPolicy - Access policy - AccessPolicy *AccessPolicy `json:"accessPolicy,omitempty"` -} - -// Sku the SKU of the storage account. -type Sku struct { - // Name - Possible values include: 'SkuNameStandardLRS', 'SkuNameStandardGRS', 'SkuNameStandardRAGRS', 'SkuNameStandardZRS', 'SkuNamePremiumLRS', 'SkuNamePremiumZRS', 'SkuNameStandardGZRS', 'SkuNameStandardRAGZRS' - Name SkuName `json:"name,omitempty"` - // Tier - Possible values include: 'SkuTierStandard', 'SkuTierPremium' - Tier SkuTier `json:"tier,omitempty"` -} - -// SKUCapability the capability information in the specified SKU, including file encryption, network ACLs, -// change notification, etc. -type SKUCapability struct { - // Name - READ-ONLY; The name of capability, The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. - Name *string `json:"name,omitempty"` - // Value - READ-ONLY; A string value to indicate states of given capability. Possibly 'true' or 'false'. - Value *string `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SKUCapability. -func (sc SKUCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SkuInformation storage SKU and its properties -type SkuInformation struct { - // Name - Possible values include: 'SkuNameStandardLRS', 'SkuNameStandardGRS', 'SkuNameStandardRAGRS', 'SkuNameStandardZRS', 'SkuNamePremiumLRS', 'SkuNamePremiumZRS', 'SkuNameStandardGZRS', 'SkuNameStandardRAGZRS' - Name SkuName `json:"name,omitempty"` - // Tier - Possible values include: 'SkuTierStandard', 'SkuTierPremium' - Tier SkuTier `json:"tier,omitempty"` - // ResourceType - READ-ONLY; The type of the resource, usually it is 'storageAccounts'. - ResourceType *string `json:"resourceType,omitempty"` - // Kind - READ-ONLY; Indicates the type of storage account. Possible values include: 'KindStorage', 'KindStorageV2', 'KindBlobStorage', 'KindFileStorage', 'KindBlockBlobStorage' - Kind Kind `json:"kind,omitempty"` - // Locations - READ-ONLY; The set of locations that the SKU is available. This will be supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). - Locations *[]string `json:"locations,omitempty"` - // Capabilities - READ-ONLY; The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. - Capabilities *[]SKUCapability `json:"capabilities,omitempty"` - // Restrictions - The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - Restrictions *[]Restriction `json:"restrictions,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkuInformation. -func (si SkuInformation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if si.Name != "" { - objectMap["name"] = si.Name - } - if si.Tier != "" { - objectMap["tier"] = si.Tier - } - if si.Restrictions != nil { - objectMap["restrictions"] = si.Restrictions - } - return json.Marshal(objectMap) -} - -// SkuListResult the response from the List Storage SKUs operation. -type SkuListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; Get the list result of storage SKUs and their properties. - Value *[]SkuInformation `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkuListResult. -func (slr SkuListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SmbSetting setting for SMB protocol -type SmbSetting struct { - // Multichannel - Multichannel setting. Applies to Premium FileStorage only. - Multichannel *Multichannel `json:"multichannel,omitempty"` - // Versions - SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, SMB3.1.1. Should be passed as a string with delimiter ';'. - Versions *string `json:"versions,omitempty"` - // AuthenticationMethods - SMB authentication methods supported by server. Valid values are NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. - AuthenticationMethods *string `json:"authenticationMethods,omitempty"` - // KerberosTicketEncryption - Kerberos ticket encryption supported by server. Valid values are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';' - KerberosTicketEncryption *string `json:"kerberosTicketEncryption,omitempty"` - // ChannelEncryption - SMB channel encryption supported by server. Valid values are AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. - ChannelEncryption *string `json:"channelEncryption,omitempty"` -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// Table properties of the table, including Id, resource name, resource type. -type Table struct { - autorest.Response `json:"-"` - // TableProperties - Table resource properties. - *TableProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Table. -func (t Table) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if t.TableProperties != nil { - objectMap["properties"] = t.TableProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Table struct. -func (t *Table) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var tableProperties TableProperties - err = json.Unmarshal(*v, &tableProperties) - if err != nil { - return err - } - t.TableProperties = &tableProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - t.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - t.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - t.Type = &typeVar - } - } - } - - return nil -} - -// TableProperties ... -type TableProperties struct { - // TableName - READ-ONLY; Table name under the specified account - TableName *string `json:"tableName,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableProperties. -func (tp TableProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TableServiceProperties the properties of a storage account’s Table service. -type TableServiceProperties struct { - autorest.Response `json:"-"` - // TableServicePropertiesProperties - The properties of a storage account’s Table service. - *TableServicePropertiesProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TableServiceProperties. -func (tsp TableServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tsp.TableServicePropertiesProperties != nil { - objectMap["properties"] = tsp.TableServicePropertiesProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for TableServiceProperties struct. -func (tsp *TableServiceProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var tableServiceProperties TableServicePropertiesProperties - err = json.Unmarshal(*v, &tableServiceProperties) - if err != nil { - return err - } - tsp.TableServicePropertiesProperties = &tableServiceProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - tsp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - tsp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - tsp.Type = &typeVar - } - } - } - - return nil -} - -// TableServicePropertiesProperties the properties of a storage account’s Table service. -type TableServicePropertiesProperties struct { - // Cors - Specifies CORS rules for the Table service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Table service. - Cors *CorsRules `json:"cors,omitempty"` -} - -// TagFilter blob index tag based filtering for blob objects -type TagFilter struct { - // Name - This is the filter tag name, it can have 1 - 128 characters - Name *string `json:"name,omitempty"` - // Op - This is the comparison operator which is used for object comparison and filtering. Only == (equality operator) is currently supported - Op *string `json:"op,omitempty"` - // Value - This is the filter tag value field used for tag based filtering, it can have 0 - 256 characters - Value *string `json:"value,omitempty"` -} - -// TagProperty a tag of the LegalHold of a blob container. -type TagProperty struct { - // Tag - READ-ONLY; The tag value. - Tag *string `json:"tag,omitempty"` - // Timestamp - READ-ONLY; Returns the date and time the tag was added. - Timestamp *date.Time `json:"timestamp,omitempty"` - // ObjectIdentifier - READ-ONLY; Returns the Object ID of the user who added the tag. - ObjectIdentifier *string `json:"objectIdentifier,omitempty"` - // TenantID - READ-ONLY; Returns the Tenant ID that issued the token for the user who added the tag. - TenantID *string `json:"tenantId,omitempty"` - // Upn - READ-ONLY; Returns the User Principal Name of the user who added the tag. - Upn *string `json:"upn,omitempty"` -} - -// MarshalJSON is the custom marshaler for TagProperty. -func (tp TagProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// UpdateHistoryProperty an update history of the ImmutabilityPolicy of a blob container. -type UpdateHistoryProperty struct { - // Update - READ-ONLY; The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend. Possible values include: 'ImmutabilityPolicyUpdateTypePut', 'ImmutabilityPolicyUpdateTypeLock', 'ImmutabilityPolicyUpdateTypeExtend' - Update ImmutabilityPolicyUpdateType `json:"update,omitempty"` - // ImmutabilityPeriodSinceCreationInDays - READ-ONLY; The immutability period for the blobs in the container since the policy creation, in days. - ImmutabilityPeriodSinceCreationInDays *int32 `json:"immutabilityPeriodSinceCreationInDays,omitempty"` - // Timestamp - READ-ONLY; Returns the date and time the ImmutabilityPolicy was updated. - Timestamp *date.Time `json:"timestamp,omitempty"` - // ObjectIdentifier - READ-ONLY; Returns the Object ID of the user who updated the ImmutabilityPolicy. - ObjectIdentifier *string `json:"objectIdentifier,omitempty"` - // TenantID - READ-ONLY; Returns the Tenant ID that issued the token for the user who updated the ImmutabilityPolicy. - TenantID *string `json:"tenantId,omitempty"` - // Upn - READ-ONLY; Returns the User Principal Name of the user who updated the ImmutabilityPolicy. - Upn *string `json:"upn,omitempty"` -} - -// MarshalJSON is the custom marshaler for UpdateHistoryProperty. -func (uhp UpdateHistoryProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Usage describes Storage Resource Usage. -type Usage struct { - // Unit - READ-ONLY; Gets the unit of measurement. Possible values include: 'UsageUnitCount', 'UsageUnitBytes', 'UsageUnitSeconds', 'UsageUnitPercent', 'UsageUnitCountsPerSecond', 'UsageUnitBytesPerSecond' - Unit UsageUnit `json:"unit,omitempty"` - // CurrentValue - READ-ONLY; Gets the current count of the allocated resources in the subscription. - CurrentValue *int32 `json:"currentValue,omitempty"` - // Limit - READ-ONLY; Gets the maximum count of the resources that can be allocated in the subscription. - Limit *int32 `json:"limit,omitempty"` - // Name - READ-ONLY; Gets the name of the type of usage. - Name *UsageName `json:"name,omitempty"` -} - -// MarshalJSON is the custom marshaler for Usage. -func (u Usage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UsageListResult the response from the List Usages operation. -type UsageListResult struct { - autorest.Response `json:"-"` - // Value - Gets or sets the list of Storage Resource Usages. - Value *[]Usage `json:"value,omitempty"` -} - -// UsageName the usage names that can be used; currently limited to StorageAccount. -type UsageName struct { - // Value - READ-ONLY; Gets a string describing the resource name. - Value *string `json:"value,omitempty"` - // LocalizedValue - READ-ONLY; Gets a localized string describing the resource name. - LocalizedValue *string `json:"localizedValue,omitempty"` -} - -// MarshalJSON is the custom marshaler for UsageName. -func (un UsageName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// UserAssignedIdentity userAssignedIdentity for the resource. -type UserAssignedIdentity struct { - // PrincipalID - READ-ONLY; The principal ID of the identity. - PrincipalID *string `json:"principalId,omitempty"` - // ClientID - READ-ONLY; The client ID of the identity. - ClientID *string `json:"clientId,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserAssignedIdentity. -func (uai UserAssignedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// VirtualNetworkRule virtual Network rule. -type VirtualNetworkRule struct { - // VirtualNetworkResourceID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - VirtualNetworkResourceID *string `json:"id,omitempty"` - // Action - The action of virtual network rule. Possible values include: 'ActionAllow' - Action Action `json:"action,omitempty"` - // State - Gets the state of virtual network rule. Possible values include: 'StateProvisioning', 'StateDeprovisioning', 'StateSucceeded', 'StateFailed', 'StateNetworkSourceDeleted' - State State `json:"state,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/operations.go deleted file mode 100644 index 3f8311c259b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/operations.go +++ /dev/null @@ -1,98 +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. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the the Azure Storage Management API. -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available Storage Rest API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Storage/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/privateendpointconnections.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/privateendpointconnections.go deleted file mode 100644 index 33702adf9a0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/privateendpointconnections.go +++ /dev/null @@ -1,411 +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. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateEndpointConnectionsClient is the the Azure Storage Management API. -type PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete deletes the specified private endpoint connection associated with the storage account. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.PrivateEndpointConnectionsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified private endpoint connection associated with the storage account. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.PrivateEndpointConnectionsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all the private endpoint connections associated with the storage account. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, accountName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.PrivateEndpointConnectionsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Put update the state of specified private endpoint connection associated with the storage account. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure -// resource -// properties - the private endpoint connection properties. -func (client PrivateEndpointConnectionsClient) Put(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Put") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: properties, - Constraints: []validation.Constraint{{Target: "properties.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "properties.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("storage.PrivateEndpointConnectionsClient", "Put", err.Error()) - } - - req, err := client.PutPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName, properties) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Put", nil, "Failure preparing request") - return - } - - resp, err := client.PutSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Put", resp, "Failure sending request") - return - } - - result, err = client.PutResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Put", resp, "Failure responding to request") - return - } - - return -} - -// PutPreparer prepares the Put request. -func (client PrivateEndpointConnectionsClient) PutPreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), - autorest.WithJSON(properties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PutSender sends the Put request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateEndpointConnectionsClient) PutSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// PutResponder handles the response to the Put request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) PutResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/privatelinkresources.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/privatelinkresources.go deleted file mode 100644 index 75c49f63da0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/privatelinkresources.go +++ /dev/null @@ -1,124 +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. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PrivateLinkResourcesClient is the the Azure Storage Management API. -type PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// ListByStorageAccount gets the private link resources that need to be created for a storage account. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -func (client PrivateLinkResourcesClient) ListByStorageAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateLinkResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByStorageAccount") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.PrivateLinkResourcesClient", "ListByStorageAccount", err.Error()) - } - - req, err := client.ListByStorageAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.PrivateLinkResourcesClient", "ListByStorageAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByStorageAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.PrivateLinkResourcesClient", "ListByStorageAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByStorageAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.PrivateLinkResourcesClient", "ListByStorageAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByStorageAccountPreparer prepares the ListByStorageAccount request. -func (client PrivateLinkResourcesClient) ListByStorageAccountPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByStorageAccountSender sends the ListByStorageAccount request. The method will close the -// http.Response Body if it receives an error. -func (client PrivateLinkResourcesClient) ListByStorageAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByStorageAccountResponder handles the response to the ListByStorageAccount request. The method always -// closes the http.Response Body. -func (client PrivateLinkResourcesClient) ListByStorageAccountResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/queue.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/queue.go deleted file mode 100644 index 372c626f567..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/queue.go +++ /dev/null @@ -1,571 +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. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// QueueClient is the the Azure Storage Management API. -type QueueClient struct { - BaseClient -} - -// NewQueueClient creates an instance of the QueueClient client. -func NewQueueClient(subscriptionID string) QueueClient { - return NewQueueClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewQueueClientWithBaseURI creates an instance of the QueueClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewQueueClientWithBaseURI(baseURI string, subscriptionID string) QueueClient { - return QueueClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a new queue with the specified queue name, under the specified account. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// queueName - a queue name must be unique within a storage account and must be between 3 and 63 characters.The -// name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an -// alphanumeric character and it cannot have two consecutive dash(-) characters. -// queue - queue properties and metadata to be created with -func (client QueueClient) Create(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue) (result Queue, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.Create") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "queueName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.QueueClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, queueName, queue) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.QueueClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.QueueClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.QueueClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client QueueClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}", pathParameters), - autorest.WithJSON(queue), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client QueueClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client QueueClient) CreateResponder(resp *http.Response) (result Queue, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the queue with the specified queue name, under the specified account if it exists. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// queueName - a queue name must be unique within a storage account and must be between 3 and 63 characters.The -// name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an -// alphanumeric character and it cannot have two consecutive dash(-) characters. -func (client QueueClient) Delete(ctx context.Context, resourceGroupName string, accountName string, queueName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "queueName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.QueueClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, queueName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.QueueClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "storage.QueueClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.QueueClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client QueueClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, queueName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client QueueClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client QueueClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the queue with the specified queue name, under the specified account if it exists. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// queueName - a queue name must be unique within a storage account and must be between 3 and 63 characters.The -// name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an -// alphanumeric character and it cannot have two consecutive dash(-) characters. -func (client QueueClient) Get(ctx context.Context, resourceGroupName string, accountName string, queueName string) (result Queue, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "queueName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.QueueClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, queueName) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.QueueClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.QueueClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.QueueClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client QueueClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, queueName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client QueueClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client QueueClient) GetResponder(resp *http.Response) (result Queue, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of all the queues under the specified storage account -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// maxpagesize - optional, a maximum number of queues that should be included in a list queue response -// filter - optional, When specified, only the queues with a name starting with the given filter will be -// listed. -func (client QueueClient) List(ctx context.Context, resourceGroupName string, accountName string, maxpagesize string, filter string) (result ListQueueResourcePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.List") - defer func() { - sc := -1 - if result.lqr.Response.Response != nil { - sc = result.lqr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.QueueClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, accountName, maxpagesize, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.QueueClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.lqr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.QueueClient", "List", resp, "Failure sending request") - return - } - - result.lqr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.QueueClient", "List", resp, "Failure responding to request") - return - } - if result.lqr.hasNextLink() && result.lqr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client QueueClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, maxpagesize string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(maxpagesize) > 0 { - queryParameters["$maxpagesize"] = autorest.Encode("query", maxpagesize) - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client QueueClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client QueueClient) ListResponder(resp *http.Response) (result ListQueueResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client QueueClient) listNextResults(ctx context.Context, lastResults ListQueueResource) (result ListQueueResource, err error) { - req, err := lastResults.listQueueResourcePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "storage.QueueClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "storage.QueueClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.QueueClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client QueueClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, maxpagesize string, filter string) (result ListQueueResourceIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, accountName, maxpagesize, filter) - return -} - -// Update creates a new queue with the specified queue name, under the specified account. -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// accountName - the name of the storage account within the specified resource group. Storage account names -// must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// queueName - a queue name must be unique within a storage account and must be between 3 and 63 characters.The -// name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an -// alphanumeric character and it cannot have two consecutive dash(-) characters. -// queue - queue properties and metadata to be created with -func (client QueueClient) Update(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue) (result Queue, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: accountName, - Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, - {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: queueName, - Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 63, Chain: nil}, - {Target: "queueName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.QueueClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, queueName, queue) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.QueueClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.QueueClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.QueueClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client QueueClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "queueName": autorest.Encode("path", queueName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}", pathParameters), - autorest.WithJSON(queue), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client QueueClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client QueueClient) UpdateResponder(resp *http.Response) (result Queue, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/skus.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/skus.go deleted file mode 100644 index 5fdc10896d3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/skus.go +++ /dev/null @@ -1,109 +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. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SkusClient is the the Azure Storage Management API. -type SkusClient struct { - BaseClient -} - -// NewSkusClient creates an instance of the SkusClient client. -func NewSkusClient(subscriptionID string) SkusClient { - return NewSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSkusClientWithBaseURI creates an instance of the SkusClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSkusClientWithBaseURI(baseURI string, subscriptionID string) SkusClient { - return SkusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the available SKUs supported by Microsoft.Storage for given subscription. -func (client SkusClient) List(ctx context.Context) (result SkuListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SkusClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { - return result, validation.NewError("storage.SkusClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.SkusClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "storage.SkusClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "storage.SkusClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SkusClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-04-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SkusClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SkusClient) ListResponder(resp *http.Response) (result SkuListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/version.go deleted file mode 100644 index 5b3e81db0a4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package storage - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " storage/2021-04-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/CHANGELOG.md similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns/CHANGELOG.md rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/CHANGELOG.md diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/_meta.json b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/_meta.json new file mode 100644 index 00000000000..1093e901988 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "a1a224b54f05debfa94fd19477ed820c64f0f9fc", + "readme": "/_/azure-rest-api-specs/specification/storage/resource-manager/readme.md", + "tag": "package-2021-09", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-09 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/storage/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/accounts.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/accounts.go new file mode 100644 index 00000000000..53d37ea455a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/accounts.go @@ -0,0 +1,1642 @@ +package storage + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AccountsClient is the the Azure Storage Management API. +type AccountsClient struct { + BaseClient +} + +// NewAccountsClient creates an instance of the AccountsClient client. +func NewAccountsClient(subscriptionID string) AccountsClient { + return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccountsClientWithBaseURI creates an instance of the AccountsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { + return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// AbortHierarchicalNamespaceMigration abort live Migration of storage account to enable Hns +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +func (client AccountsClient) AbortHierarchicalNamespaceMigration(ctx context.Context, resourceGroupName string, accountName string) (result AccountsAbortHierarchicalNamespaceMigrationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.AbortHierarchicalNamespaceMigration") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "AbortHierarchicalNamespaceMigration", err.Error()) + } + + req, err := client.AbortHierarchicalNamespaceMigrationPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "AbortHierarchicalNamespaceMigration", nil, "Failure preparing request") + return + } + + result, err = client.AbortHierarchicalNamespaceMigrationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "AbortHierarchicalNamespaceMigration", result.Response(), "Failure sending request") + return + } + + return +} + +// AbortHierarchicalNamespaceMigrationPreparer prepares the AbortHierarchicalNamespaceMigration request. +func (client AccountsClient) AbortHierarchicalNamespaceMigrationPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/aborthnsonmigration", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AbortHierarchicalNamespaceMigrationSender sends the AbortHierarchicalNamespaceMigration request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) AbortHierarchicalNamespaceMigrationSender(req *http.Request) (future AccountsAbortHierarchicalNamespaceMigrationFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// AbortHierarchicalNamespaceMigrationResponder handles the response to the AbortHierarchicalNamespaceMigration request. The method always +// closes the http.Response Body. +func (client AccountsClient) AbortHierarchicalNamespaceMigrationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CheckNameAvailability checks that the storage account name is valid and is not already in use. +// Parameters: +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +func (client AccountsClient) CheckNameAvailability(ctx context.Context, accountName AccountCheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "accountName.Type", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client AccountsClient) CheckNameAvailabilityPreparer(ctx context.Context, accountName AccountCheckNameAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability", pathParameters), + autorest.WithJSON(accountName), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client AccountsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Create asynchronously creates a new storage account with the specified parameters. If an account is already created +// and a subsequent create request is issued with different properties, the account properties will be updated. If an +// account is already created and a subsequent create or update request is issued with the exact same set of +// properties, the request will succeed. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// parameters - the parameters to provide for the created account. +func (client AccountsClient) Create(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters) (result AccountsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountPropertiesCreateParameters", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.SasPolicy", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.SasPolicy.SasExpirationPeriod", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountPropertiesCreateParameters.SasPolicy.ExpirationAction", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "parameters.AccountPropertiesCreateParameters.KeyPolicy", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.KeyPolicy.KeyExpirationPeriodInDays", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.AccountPropertiesCreateParameters.CustomDomain", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.CustomDomain.Name", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication.ActiveDirectoryProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication.ActiveDirectoryProperties.DomainName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication.ActiveDirectoryProperties.NetBiosDomainName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication.ActiveDirectoryProperties.ForestName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication.ActiveDirectoryProperties.DomainGUID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication.ActiveDirectoryProperties.DomainSid", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AccountPropertiesCreateParameters.AzureFilesIdentityBasedAuthentication.ActiveDirectoryProperties.AzureStorageSid", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + {Target: "parameters.AccountPropertiesCreateParameters.ImmutableStorageWithVersioning", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.ImmutableStorageWithVersioning.ImmutabilityPolicy", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.ImmutableStorageWithVersioning.ImmutabilityPolicy.ImmutabilityPeriodSinceCreationInDays", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AccountPropertiesCreateParameters.ImmutableStorageWithVersioning.ImmutabilityPolicy.ImmutabilityPeriodSinceCreationInDays", Name: validation.InclusiveMaximum, Rule: int64(146000), Chain: nil}, + {Target: "parameters.AccountPropertiesCreateParameters.ImmutableStorageWithVersioning.ImmutabilityPolicy.ImmutabilityPeriodSinceCreationInDays", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + }}, + }}, + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AccountsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) CreateSender(req *http.Request) (future AccountsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AccountsClient) CreateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a storage account in Microsoft Azure. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +func (client AccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Failover failover request can be triggered for a storage account in case of availability issues. The failover occurs +// from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will +// become primary after failover. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +func (client AccountsClient) Failover(ctx context.Context, resourceGroupName string, accountName string) (result AccountsFailoverFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Failover") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "Failover", err.Error()) + } + + req, err := client.FailoverPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Failover", nil, "Failure preparing request") + return + } + + result, err = client.FailoverSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Failover", result.Response(), "Failure sending request") + return + } + + return +} + +// FailoverPreparer prepares the Failover request. +func (client AccountsClient) FailoverPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// FailoverSender sends the Failover request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) FailoverSender(req *http.Request) (future AccountsFailoverFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// FailoverResponder handles the response to the Failover request. The method always +// closes the http.Response Body. +func (client AccountsClient) FailoverResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetProperties returns the properties for the specified storage account including but not limited to name, SKU name, +// location, and account status. The ListKeys operation should be used to retrieve storage keys. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// expand - may be used to expand the properties within account's properties. By default, data is not included +// when fetching properties. Currently we only support geoReplicationStats and blobRestoreStatus. +func (client AccountsClient) GetProperties(ctx context.Context, resourceGroupName string, accountName string, expand AccountExpand) (result Account, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.GetProperties") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "GetProperties", err.Error()) + } + + req, err := client.GetPropertiesPreparer(ctx, resourceGroupName, accountName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", nil, "Failure preparing request") + return + } + + resp, err := client.GetPropertiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", resp, "Failure sending request") + return + } + + result, err = client.GetPropertiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", resp, "Failure responding to request") + return + } + + return +} + +// GetPropertiesPreparer prepares the GetProperties request. +func (client AccountsClient) GetPropertiesPreparer(ctx context.Context, resourceGroupName string, accountName string, expand AccountExpand) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(expand)) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPropertiesSender sends the GetProperties request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) GetPropertiesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPropertiesResponder handles the response to the GetProperties request. The method always +// closes the http.Response Body. +func (client AccountsClient) GetPropertiesResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// HierarchicalNamespaceMigration live Migration of storage account to enable Hns +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// requestType - required. Hierarchical namespace migration type can either be a hierarchical namespace +// validation request 'HnsOnValidationRequest' or a hydration request 'HnsOnHydrationRequest'. The validation +// request will validate the migration whereas the hydration request will migrate the account. +func (client AccountsClient) HierarchicalNamespaceMigration(ctx context.Context, resourceGroupName string, accountName string, requestType string) (result AccountsHierarchicalNamespaceMigrationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.HierarchicalNamespaceMigration") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "HierarchicalNamespaceMigration", err.Error()) + } + + req, err := client.HierarchicalNamespaceMigrationPreparer(ctx, resourceGroupName, accountName, requestType) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "HierarchicalNamespaceMigration", nil, "Failure preparing request") + return + } + + result, err = client.HierarchicalNamespaceMigrationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "HierarchicalNamespaceMigration", result.Response(), "Failure sending request") + return + } + + return +} + +// HierarchicalNamespaceMigrationPreparer prepares the HierarchicalNamespaceMigration request. +func (client AccountsClient) HierarchicalNamespaceMigrationPreparer(ctx context.Context, resourceGroupName string, accountName string, requestType string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "requestType": autorest.Encode("query", requestType), + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/hnsonmigration", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// HierarchicalNamespaceMigrationSender sends the HierarchicalNamespaceMigration request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) HierarchicalNamespaceMigrationSender(req *http.Request) (future AccountsHierarchicalNamespaceMigrationFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// HierarchicalNamespaceMigrationResponder handles the response to the HierarchicalNamespaceMigration request. The method always +// closes the http.Response Body. +func (client AccountsClient) HierarchicalNamespaceMigrationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// List lists all the storage accounts available under the subscription. Note that storage keys are not returned; use +// the ListKeys operation for this. +func (client AccountsClient) List(ctx context.Context) (result AccountListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.List") + defer func() { + sc := -1 + if result.alr.Response.Response != nil { + sc = result.alr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.alr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "List", resp, "Failure sending request") + return + } + + result.alr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "List", resp, "Failure responding to request") + return + } + if result.alr.hasNextLink() && result.alr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AccountsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListResponder(resp *http.Response) (result AccountListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AccountsClient) listNextResults(ctx context.Context, lastResults AccountListResult) (result AccountListResult, err error) { + req, err := lastResults.accountListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountsClient) ListComplete(ctx context.Context) (result AccountListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListAccountSAS list SAS credentials of a storage account. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// parameters - the parameters to provide to list SAS credentials for the storage account. +func (client AccountsClient) ListAccountSAS(ctx context.Context, resourceGroupName string, accountName string, parameters AccountSasParameters) (result ListAccountSasResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListAccountSAS") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SharedAccessExpiryTime", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "ListAccountSAS", err.Error()) + } + + req, err := client.ListAccountSASPreparer(ctx, resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListAccountSAS", nil, "Failure preparing request") + return + } + + resp, err := client.ListAccountSASSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListAccountSAS", resp, "Failure sending request") + return + } + + result, err = client.ListAccountSASResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListAccountSAS", resp, "Failure responding to request") + return + } + + return +} + +// ListAccountSASPreparer prepares the ListAccountSAS request. +func (client AccountsClient) ListAccountSASPreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountSasParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAccountSASSender sends the ListAccountSAS request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListAccountSASSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAccountSASResponder handles the response to the ListAccountSAS request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListAccountSASResponder(resp *http.Response) (result ListAccountSasResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup lists all the storage accounts available under the given resource group. Note that storage keys +// are not returned; use the ListKeys operation for this. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +func (client AccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AccountListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.alr.Response.Response != nil { + sc = result.alr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.alr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.alr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.alr.hasNextLink() && result.alr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AccountsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client AccountsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AccountListResult) (result AccountListResult, err error) { + req, err := lastResults.accountListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AccountListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListKeys lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// expand - specifies type of the key to be listed. Possible value is kerb. +func (client AccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string, expand ListKeyExpand) (result AccountListKeysResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "ListKeys", err.Error()) + } + + req, err := client.ListKeysPreparer(ctx, resourceGroupName, accountName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client AccountsClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, accountName string, expand ListKeyExpand) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(expand)) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListKeysResponder(resp *http.Response) (result AccountListKeysResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListServiceSAS list service SAS credentials of a specific resource. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// parameters - the parameters to provide to list service SAS credentials. +func (client AccountsClient) ListServiceSAS(ctx context.Context, resourceGroupName string, accountName string, parameters ServiceSasParameters) (result ListServiceSasResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListServiceSAS") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.CanonicalizedResource", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Identifier", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Identifier", Name: validation.MaxLength, Rule: 64, Chain: nil}}}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "ListServiceSAS", err.Error()) + } + + req, err := client.ListServiceSASPreparer(ctx, resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListServiceSAS", nil, "Failure preparing request") + return + } + + resp, err := client.ListServiceSASSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListServiceSAS", resp, "Failure sending request") + return + } + + result, err = client.ListServiceSASResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListServiceSAS", resp, "Failure responding to request") + return + } + + return +} + +// ListServiceSASPreparer prepares the ListServiceSAS request. +func (client AccountsClient) ListServiceSASPreparer(ctx context.Context, resourceGroupName string, accountName string, parameters ServiceSasParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListServiceSASSender sends the ListServiceSAS request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListServiceSASSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListServiceSASResponder handles the response to the ListServiceSAS request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListServiceSASResponder(resp *http.Response) (result ListServiceSasResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKey regenerates one of the access keys or Kerberos keys for the specified storage account. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// regenerateKey - specifies name of the key which should be regenerated -- key1, key2, kerb1, kerb2. +func (client AccountsClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (result AccountListKeysResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.RegenerateKey") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: regenerateKey, + Constraints: []validation.Constraint{{Target: "regenerateKey.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "RegenerateKey", err.Error()) + } + + req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, accountName, regenerateKey) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", resp, "Failure responding to request") + return + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client AccountsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey", pathParameters), + autorest.WithJSON(regenerateKey), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result AccountListKeysResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RestoreBlobRanges restore blobs in the specified blob ranges +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// parameters - the parameters to provide for restore blob ranges. +func (client AccountsClient) RestoreBlobRanges(ctx context.Context, resourceGroupName string, accountName string, parameters BlobRestoreParameters) (result AccountsRestoreBlobRangesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.RestoreBlobRanges") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TimeToRestore", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.BlobRanges", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "RestoreBlobRanges", err.Error()) + } + + req, err := client.RestoreBlobRangesPreparer(ctx, resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RestoreBlobRanges", nil, "Failure preparing request") + return + } + + result, err = client.RestoreBlobRangesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RestoreBlobRanges", result.Response(), "Failure sending request") + return + } + + return +} + +// RestoreBlobRangesPreparer prepares the RestoreBlobRanges request. +func (client AccountsClient) RestoreBlobRangesPreparer(ctx context.Context, resourceGroupName string, accountName string, parameters BlobRestoreParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreBlobRangesSender sends the RestoreBlobRanges request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) RestoreBlobRangesSender(req *http.Request) (future AccountsRestoreBlobRangesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RestoreBlobRangesResponder handles the response to the RestoreBlobRanges request. The method always +// closes the http.Response Body. +func (client AccountsClient) RestoreBlobRangesResponder(resp *http.Response) (result BlobRestoreStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RevokeUserDelegationKeys revoke user delegation keys. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +func (client AccountsClient) RevokeUserDelegationKeys(ctx context.Context, resourceGroupName string, accountName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.RevokeUserDelegationKeys") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "RevokeUserDelegationKeys", err.Error()) + } + + req, err := client.RevokeUserDelegationKeysPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RevokeUserDelegationKeys", nil, "Failure preparing request") + return + } + + resp, err := client.RevokeUserDelegationKeysSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RevokeUserDelegationKeys", resp, "Failure sending request") + return + } + + result, err = client.RevokeUserDelegationKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RevokeUserDelegationKeys", resp, "Failure responding to request") + return + } + + return +} + +// RevokeUserDelegationKeysPreparer prepares the RevokeUserDelegationKeys request. +func (client AccountsClient) RevokeUserDelegationKeysPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RevokeUserDelegationKeysSender sends the RevokeUserDelegationKeys request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) RevokeUserDelegationKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RevokeUserDelegationKeysResponder handles the response to the RevokeUserDelegationKeys request. The method always +// closes the http.Response Body. +func (client AccountsClient) RevokeUserDelegationKeysResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update the update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. +// It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; +// the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value +// must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This +// call does not change the storage keys for the account. If you want to change the storage account keys, use the +// regenerate keys operation. The location and name of the storage account cannot be changed after creation. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// parameters - the parameters to provide for the updated account. +func (client AccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.AccountsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/blobcontainers.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/blobcontainers.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/blobcontainers.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/blobcontainers.go index cedbf65f187..ab6e1f974fc 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/blobcontainers.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/blobcontainers.go @@ -102,7 +102,7 @@ func (client BlobContainersClient) ClearLegalHoldPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -206,7 +206,7 @@ func (client BlobContainersClient) CreatePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -315,7 +315,7 @@ func (client BlobContainersClient) CreateOrUpdateImmutabilityPolicyPreparer(ctx "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -422,7 +422,7 @@ func (client BlobContainersClient) DeletePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -526,7 +526,7 @@ func (client BlobContainersClient) DeleteImmutabilityPolicyPreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -633,7 +633,7 @@ func (client BlobContainersClient) ExtendImmutabilityPolicyPreparer(ctx context. "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -737,7 +737,7 @@ func (client BlobContainersClient) GetPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -840,7 +840,7 @@ func (client BlobContainersClient) GetImmutabilityPolicyPreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -944,7 +944,7 @@ func (client BlobContainersClient) LeasePreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1049,7 +1049,7 @@ func (client BlobContainersClient) ListPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1197,7 +1197,7 @@ func (client BlobContainersClient) LockImmutabilityPolicyPreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1291,7 +1291,7 @@ func (client BlobContainersClient) ObjectLevelWormPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1402,7 +1402,7 @@ func (client BlobContainersClient) SetLegalHoldPreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1505,7 +1505,7 @@ func (client BlobContainersClient) UpdatePreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/blobinventorypolicies.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/blobinventorypolicies.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/blobinventorypolicies.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/blobinventorypolicies.go index b37de3a4297..112f6c1a95c 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/blobinventorypolicies.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/blobinventorypolicies.go @@ -102,7 +102,7 @@ func (client BlobInventoryPoliciesClient) CreateOrUpdatePreparer(ctx context.Con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -196,7 +196,7 @@ func (client BlobInventoryPoliciesClient) DeletePreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -287,7 +287,7 @@ func (client BlobInventoryPoliciesClient) GetPreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -378,7 +378,7 @@ func (client BlobInventoryPoliciesClient) ListPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/blobservices.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/blobservices.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/blobservices.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/blobservices.go index d9553078ea3..c25c6606954 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/blobservices.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/blobservices.go @@ -93,7 +93,7 @@ func (client BlobServicesClient) GetServicePropertiesPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -184,7 +184,7 @@ func (client BlobServicesClient) ListPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -309,7 +309,7 @@ func (client BlobServicesClient) SetServicePropertiesPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/client.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/client.go new file mode 100644 index 00000000000..713b72d1e7b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/client.go @@ -0,0 +1,41 @@ +// Package storage implements the Azure ARM Storage service API version 2021-09-01. +// +// The Azure Storage Management API. +package storage + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Storage + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Storage. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/deletedaccounts.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/deletedaccounts.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/deletedaccounts.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/deletedaccounts.go index 4019996f917..a8abefe8626 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/deletedaccounts.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/deletedaccounts.go @@ -85,7 +85,7 @@ func (client DeletedAccountsClient) GetPreparer(ctx context.Context, deletedAcco "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -167,7 +167,7 @@ func (client DeletedAccountsClient) ListPreparer(ctx context.Context) (*http.Req "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/encryptionscopes.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/encryptionscopes.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/encryptionscopes.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/encryptionscopes.go index a904eeb7ebe..0a120d35646 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/encryptionscopes.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/encryptionscopes.go @@ -99,7 +99,7 @@ func (client EncryptionScopesClient) GetPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -195,7 +195,7 @@ func (client EncryptionScopesClient) ListPreparer(ctx context.Context, resourceG "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -332,7 +332,7 @@ func (client EncryptionScopesClient) PatchPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -435,7 +435,7 @@ func (client EncryptionScopesClient) PutPreparer(ctx context.Context, resourceGr "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/enums.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/enums.go new file mode 100644 index 00000000000..bba1ff6410c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/enums.go @@ -0,0 +1,1018 @@ +package storage + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AccessTier enumerates the values for access tier. +type AccessTier string + +const ( + // AccessTierCool ... + AccessTierCool AccessTier = "Cool" + // AccessTierHot ... + AccessTierHot AccessTier = "Hot" + // AccessTierPremium ... + AccessTierPremium AccessTier = "Premium" +) + +// PossibleAccessTierValues returns an array of possible values for the AccessTier const type. +func PossibleAccessTierValues() []AccessTier { + return []AccessTier{AccessTierCool, AccessTierHot, AccessTierPremium} +} + +// AccountExpand enumerates the values for account expand. +type AccountExpand string + +const ( + // AccountExpandBlobRestoreStatus ... + AccountExpandBlobRestoreStatus AccountExpand = "blobRestoreStatus" + // AccountExpandGeoReplicationStats ... + AccountExpandGeoReplicationStats AccountExpand = "geoReplicationStats" +) + +// PossibleAccountExpandValues returns an array of possible values for the AccountExpand const type. +func PossibleAccountExpandValues() []AccountExpand { + return []AccountExpand{AccountExpandBlobRestoreStatus, AccountExpandGeoReplicationStats} +} + +// AccountImmutabilityPolicyState enumerates the values for account immutability policy state. +type AccountImmutabilityPolicyState string + +const ( + // AccountImmutabilityPolicyStateDisabled ... + AccountImmutabilityPolicyStateDisabled AccountImmutabilityPolicyState = "Disabled" + // AccountImmutabilityPolicyStateLocked ... + AccountImmutabilityPolicyStateLocked AccountImmutabilityPolicyState = "Locked" + // AccountImmutabilityPolicyStateUnlocked ... + AccountImmutabilityPolicyStateUnlocked AccountImmutabilityPolicyState = "Unlocked" +) + +// PossibleAccountImmutabilityPolicyStateValues returns an array of possible values for the AccountImmutabilityPolicyState const type. +func PossibleAccountImmutabilityPolicyStateValues() []AccountImmutabilityPolicyState { + return []AccountImmutabilityPolicyState{AccountImmutabilityPolicyStateDisabled, AccountImmutabilityPolicyStateLocked, AccountImmutabilityPolicyStateUnlocked} +} + +// AccountStatus enumerates the values for account status. +type AccountStatus string + +const ( + // AccountStatusAvailable ... + AccountStatusAvailable AccountStatus = "available" + // AccountStatusUnavailable ... + AccountStatusUnavailable AccountStatus = "unavailable" +) + +// PossibleAccountStatusValues returns an array of possible values for the AccountStatus const type. +func PossibleAccountStatusValues() []AccountStatus { + return []AccountStatus{AccountStatusAvailable, AccountStatusUnavailable} +} + +// AccountType enumerates the values for account type. +type AccountType string + +const ( + // AccountTypeComputer ... + AccountTypeComputer AccountType = "Computer" + // AccountTypeUser ... + AccountTypeUser AccountType = "User" +) + +// PossibleAccountTypeValues returns an array of possible values for the AccountType const type. +func PossibleAccountTypeValues() []AccountType { + return []AccountType{AccountTypeComputer, AccountTypeUser} +} + +// Action enumerates the values for action. +type Action string + +const ( + // ActionAllow ... + ActionAllow Action = "Allow" +) + +// PossibleActionValues returns an array of possible values for the Action const type. +func PossibleActionValues() []Action { + return []Action{ActionAllow} +} + +// Action1 enumerates the values for action 1. +type Action1 string + +const ( + // Action1Acquire ... + Action1Acquire Action1 = "Acquire" + // Action1Break ... + Action1Break Action1 = "Break" + // Action1Change ... + Action1Change Action1 = "Change" + // Action1Release ... + Action1Release Action1 = "Release" + // Action1Renew ... + Action1Renew Action1 = "Renew" +) + +// PossibleAction1Values returns an array of possible values for the Action1 const type. +func PossibleAction1Values() []Action1 { + return []Action1{Action1Acquire, Action1Break, Action1Change, Action1Release, Action1Renew} +} + +// AllowedCopyScope enumerates the values for allowed copy scope. +type AllowedCopyScope string + +const ( + // AllowedCopyScopeAAD ... + AllowedCopyScopeAAD AllowedCopyScope = "AAD" + // AllowedCopyScopePrivateLink ... + AllowedCopyScopePrivateLink AllowedCopyScope = "PrivateLink" +) + +// PossibleAllowedCopyScopeValues returns an array of possible values for the AllowedCopyScope const type. +func PossibleAllowedCopyScopeValues() []AllowedCopyScope { + return []AllowedCopyScope{AllowedCopyScopeAAD, AllowedCopyScopePrivateLink} +} + +// BlobRestoreProgressStatus enumerates the values for blob restore progress status. +type BlobRestoreProgressStatus string + +const ( + // BlobRestoreProgressStatusComplete ... + BlobRestoreProgressStatusComplete BlobRestoreProgressStatus = "Complete" + // BlobRestoreProgressStatusFailed ... + BlobRestoreProgressStatusFailed BlobRestoreProgressStatus = "Failed" + // BlobRestoreProgressStatusInProgress ... + BlobRestoreProgressStatusInProgress BlobRestoreProgressStatus = "InProgress" +) + +// PossibleBlobRestoreProgressStatusValues returns an array of possible values for the BlobRestoreProgressStatus const type. +func PossibleBlobRestoreProgressStatusValues() []BlobRestoreProgressStatus { + return []BlobRestoreProgressStatus{BlobRestoreProgressStatusComplete, BlobRestoreProgressStatusFailed, BlobRestoreProgressStatusInProgress} +} + +// Bypass enumerates the values for bypass. +type Bypass string + +const ( + // BypassAzureServices ... + BypassAzureServices Bypass = "AzureServices" + // BypassLogging ... + BypassLogging Bypass = "Logging" + // BypassMetrics ... + BypassMetrics Bypass = "Metrics" + // BypassNone ... + BypassNone Bypass = "None" +) + +// PossibleBypassValues returns an array of possible values for the Bypass const type. +func PossibleBypassValues() []Bypass { + return []Bypass{BypassAzureServices, BypassLogging, BypassMetrics, BypassNone} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// DefaultAction enumerates the values for default action. +type DefaultAction string + +const ( + // DefaultActionAllow ... + DefaultActionAllow DefaultAction = "Allow" + // DefaultActionDeny ... + DefaultActionDeny DefaultAction = "Deny" +) + +// PossibleDefaultActionValues returns an array of possible values for the DefaultAction const type. +func PossibleDefaultActionValues() []DefaultAction { + return []DefaultAction{DefaultActionAllow, DefaultActionDeny} +} + +// DefaultSharePermission enumerates the values for default share permission. +type DefaultSharePermission string + +const ( + // DefaultSharePermissionNone ... + DefaultSharePermissionNone DefaultSharePermission = "None" + // DefaultSharePermissionStorageFileDataSmbShareContributor ... + DefaultSharePermissionStorageFileDataSmbShareContributor DefaultSharePermission = "StorageFileDataSmbShareContributor" + // DefaultSharePermissionStorageFileDataSmbShareElevatedContributor ... + DefaultSharePermissionStorageFileDataSmbShareElevatedContributor DefaultSharePermission = "StorageFileDataSmbShareElevatedContributor" + // DefaultSharePermissionStorageFileDataSmbShareReader ... + DefaultSharePermissionStorageFileDataSmbShareReader DefaultSharePermission = "StorageFileDataSmbShareReader" +) + +// PossibleDefaultSharePermissionValues returns an array of possible values for the DefaultSharePermission const type. +func PossibleDefaultSharePermissionValues() []DefaultSharePermission { + return []DefaultSharePermission{DefaultSharePermissionNone, DefaultSharePermissionStorageFileDataSmbShareContributor, DefaultSharePermissionStorageFileDataSmbShareElevatedContributor, DefaultSharePermissionStorageFileDataSmbShareReader} +} + +// DirectoryServiceOptions enumerates the values for directory service options. +type DirectoryServiceOptions string + +const ( + // DirectoryServiceOptionsAADDS ... + DirectoryServiceOptionsAADDS DirectoryServiceOptions = "AADDS" + // DirectoryServiceOptionsAD ... + DirectoryServiceOptionsAD DirectoryServiceOptions = "AD" + // DirectoryServiceOptionsNone ... + DirectoryServiceOptionsNone DirectoryServiceOptions = "None" +) + +// PossibleDirectoryServiceOptionsValues returns an array of possible values for the DirectoryServiceOptions const type. +func PossibleDirectoryServiceOptionsValues() []DirectoryServiceOptions { + return []DirectoryServiceOptions{DirectoryServiceOptionsAADDS, DirectoryServiceOptionsAD, DirectoryServiceOptionsNone} +} + +// DNSEndpointType enumerates the values for dns endpoint type. +type DNSEndpointType string + +const ( + // DNSEndpointTypeAzureDNSZone ... + DNSEndpointTypeAzureDNSZone DNSEndpointType = "AzureDnsZone" + // DNSEndpointTypeStandard ... + DNSEndpointTypeStandard DNSEndpointType = "Standard" +) + +// PossibleDNSEndpointTypeValues returns an array of possible values for the DNSEndpointType const type. +func PossibleDNSEndpointTypeValues() []DNSEndpointType { + return []DNSEndpointType{DNSEndpointTypeAzureDNSZone, DNSEndpointTypeStandard} +} + +// EnabledProtocols enumerates the values for enabled protocols. +type EnabledProtocols string + +const ( + // EnabledProtocolsNFS ... + EnabledProtocolsNFS EnabledProtocols = "NFS" + // EnabledProtocolsSMB ... + EnabledProtocolsSMB EnabledProtocols = "SMB" +) + +// PossibleEnabledProtocolsValues returns an array of possible values for the EnabledProtocols const type. +func PossibleEnabledProtocolsValues() []EnabledProtocols { + return []EnabledProtocols{EnabledProtocolsNFS, EnabledProtocolsSMB} +} + +// EncryptionScopeSource enumerates the values for encryption scope source. +type EncryptionScopeSource string + +const ( + // EncryptionScopeSourceMicrosoftKeyVault ... + EncryptionScopeSourceMicrosoftKeyVault EncryptionScopeSource = "Microsoft.KeyVault" + // EncryptionScopeSourceMicrosoftStorage ... + EncryptionScopeSourceMicrosoftStorage EncryptionScopeSource = "Microsoft.Storage" +) + +// PossibleEncryptionScopeSourceValues returns an array of possible values for the EncryptionScopeSource const type. +func PossibleEncryptionScopeSourceValues() []EncryptionScopeSource { + return []EncryptionScopeSource{EncryptionScopeSourceMicrosoftKeyVault, EncryptionScopeSourceMicrosoftStorage} +} + +// EncryptionScopeState enumerates the values for encryption scope state. +type EncryptionScopeState string + +const ( + // EncryptionScopeStateDisabled ... + EncryptionScopeStateDisabled EncryptionScopeState = "Disabled" + // EncryptionScopeStateEnabled ... + EncryptionScopeStateEnabled EncryptionScopeState = "Enabled" +) + +// PossibleEncryptionScopeStateValues returns an array of possible values for the EncryptionScopeState const type. +func PossibleEncryptionScopeStateValues() []EncryptionScopeState { + return []EncryptionScopeState{EncryptionScopeStateDisabled, EncryptionScopeStateEnabled} +} + +// ExtendedLocationTypes enumerates the values for extended location types. +type ExtendedLocationTypes string + +const ( + // ExtendedLocationTypesEdgeZone ... + ExtendedLocationTypesEdgeZone ExtendedLocationTypes = "EdgeZone" +) + +// PossibleExtendedLocationTypesValues returns an array of possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{ExtendedLocationTypesEdgeZone} +} + +// Format enumerates the values for format. +type Format string + +const ( + // FormatCsv ... + FormatCsv Format = "Csv" + // FormatParquet ... + FormatParquet Format = "Parquet" +) + +// PossibleFormatValues returns an array of possible values for the Format const type. +func PossibleFormatValues() []Format { + return []Format{FormatCsv, FormatParquet} +} + +// GeoReplicationStatus enumerates the values for geo replication status. +type GeoReplicationStatus string + +const ( + // GeoReplicationStatusBootstrap ... + GeoReplicationStatusBootstrap GeoReplicationStatus = "Bootstrap" + // GeoReplicationStatusLive ... + GeoReplicationStatusLive GeoReplicationStatus = "Live" + // GeoReplicationStatusUnavailable ... + GeoReplicationStatusUnavailable GeoReplicationStatus = "Unavailable" +) + +// PossibleGeoReplicationStatusValues returns an array of possible values for the GeoReplicationStatus const type. +func PossibleGeoReplicationStatusValues() []GeoReplicationStatus { + return []GeoReplicationStatus{GeoReplicationStatusBootstrap, GeoReplicationStatusLive, GeoReplicationStatusUnavailable} +} + +// HTTPProtocol enumerates the values for http protocol. +type HTTPProtocol string + +const ( + // HTTPProtocolHTTPS ... + HTTPProtocolHTTPS HTTPProtocol = "https" + // HTTPProtocolHttpshttp ... + HTTPProtocolHttpshttp HTTPProtocol = "https,http" +) + +// PossibleHTTPProtocolValues returns an array of possible values for the HTTPProtocol const type. +func PossibleHTTPProtocolValues() []HTTPProtocol { + return []HTTPProtocol{HTTPProtocolHTTPS, HTTPProtocolHttpshttp} +} + +// IdentityType enumerates the values for identity type. +type IdentityType string + +const ( + // IdentityTypeNone ... + IdentityTypeNone IdentityType = "None" + // IdentityTypeSystemAssigned ... + IdentityTypeSystemAssigned IdentityType = "SystemAssigned" + // IdentityTypeSystemAssignedUserAssigned ... + IdentityTypeSystemAssignedUserAssigned IdentityType = "SystemAssigned,UserAssigned" + // IdentityTypeUserAssigned ... + IdentityTypeUserAssigned IdentityType = "UserAssigned" +) + +// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{IdentityTypeNone, IdentityTypeSystemAssigned, IdentityTypeSystemAssignedUserAssigned, IdentityTypeUserAssigned} +} + +// ImmutabilityPolicyState enumerates the values for immutability policy state. +type ImmutabilityPolicyState string + +const ( + // ImmutabilityPolicyStateLocked ... + ImmutabilityPolicyStateLocked ImmutabilityPolicyState = "Locked" + // ImmutabilityPolicyStateUnlocked ... + ImmutabilityPolicyStateUnlocked ImmutabilityPolicyState = "Unlocked" +) + +// PossibleImmutabilityPolicyStateValues returns an array of possible values for the ImmutabilityPolicyState const type. +func PossibleImmutabilityPolicyStateValues() []ImmutabilityPolicyState { + return []ImmutabilityPolicyState{ImmutabilityPolicyStateLocked, ImmutabilityPolicyStateUnlocked} +} + +// ImmutabilityPolicyUpdateType enumerates the values for immutability policy update type. +type ImmutabilityPolicyUpdateType string + +const ( + // ImmutabilityPolicyUpdateTypeExtend ... + ImmutabilityPolicyUpdateTypeExtend ImmutabilityPolicyUpdateType = "extend" + // ImmutabilityPolicyUpdateTypeLock ... + ImmutabilityPolicyUpdateTypeLock ImmutabilityPolicyUpdateType = "lock" + // ImmutabilityPolicyUpdateTypePut ... + ImmutabilityPolicyUpdateTypePut ImmutabilityPolicyUpdateType = "put" +) + +// PossibleImmutabilityPolicyUpdateTypeValues returns an array of possible values for the ImmutabilityPolicyUpdateType const type. +func PossibleImmutabilityPolicyUpdateTypeValues() []ImmutabilityPolicyUpdateType { + return []ImmutabilityPolicyUpdateType{ImmutabilityPolicyUpdateTypeExtend, ImmutabilityPolicyUpdateTypeLock, ImmutabilityPolicyUpdateTypePut} +} + +// KeyPermission enumerates the values for key permission. +type KeyPermission string + +const ( + // KeyPermissionFull ... + KeyPermissionFull KeyPermission = "Full" + // KeyPermissionRead ... + KeyPermissionRead KeyPermission = "Read" +) + +// PossibleKeyPermissionValues returns an array of possible values for the KeyPermission const type. +func PossibleKeyPermissionValues() []KeyPermission { + return []KeyPermission{KeyPermissionFull, KeyPermissionRead} +} + +// KeySource enumerates the values for key source. +type KeySource string + +const ( + // KeySourceMicrosoftKeyvault ... + KeySourceMicrosoftKeyvault KeySource = "Microsoft.Keyvault" + // KeySourceMicrosoftStorage ... + KeySourceMicrosoftStorage KeySource = "Microsoft.Storage" +) + +// PossibleKeySourceValues returns an array of possible values for the KeySource const type. +func PossibleKeySourceValues() []KeySource { + return []KeySource{KeySourceMicrosoftKeyvault, KeySourceMicrosoftStorage} +} + +// KeyType enumerates the values for key type. +type KeyType string + +const ( + // KeyTypeAccount ... + KeyTypeAccount KeyType = "Account" + // KeyTypeService ... + KeyTypeService KeyType = "Service" +) + +// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. +func PossibleKeyTypeValues() []KeyType { + return []KeyType{KeyTypeAccount, KeyTypeService} +} + +// Kind enumerates the values for kind. +type Kind string + +const ( + // KindBlobStorage ... + KindBlobStorage Kind = "BlobStorage" + // KindBlockBlobStorage ... + KindBlockBlobStorage Kind = "BlockBlobStorage" + // KindFileStorage ... + KindFileStorage Kind = "FileStorage" + // KindStorage ... + KindStorage Kind = "Storage" + // KindStorageV2 ... + KindStorageV2 Kind = "StorageV2" +) + +// PossibleKindValues returns an array of possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{KindBlobStorage, KindBlockBlobStorage, KindFileStorage, KindStorage, KindStorageV2} +} + +// LargeFileSharesState enumerates the values for large file shares state. +type LargeFileSharesState string + +const ( + // LargeFileSharesStateDisabled ... + LargeFileSharesStateDisabled LargeFileSharesState = "Disabled" + // LargeFileSharesStateEnabled ... + LargeFileSharesStateEnabled LargeFileSharesState = "Enabled" +) + +// PossibleLargeFileSharesStateValues returns an array of possible values for the LargeFileSharesState const type. +func PossibleLargeFileSharesStateValues() []LargeFileSharesState { + return []LargeFileSharesState{LargeFileSharesStateDisabled, LargeFileSharesStateEnabled} +} + +// LeaseDuration enumerates the values for lease duration. +type LeaseDuration string + +const ( + // LeaseDurationFixed ... + LeaseDurationFixed LeaseDuration = "Fixed" + // LeaseDurationInfinite ... + LeaseDurationInfinite LeaseDuration = "Infinite" +) + +// PossibleLeaseDurationValues returns an array of possible values for the LeaseDuration const type. +func PossibleLeaseDurationValues() []LeaseDuration { + return []LeaseDuration{LeaseDurationFixed, LeaseDurationInfinite} +} + +// LeaseShareAction enumerates the values for lease share action. +type LeaseShareAction string + +const ( + // LeaseShareActionAcquire ... + LeaseShareActionAcquire LeaseShareAction = "Acquire" + // LeaseShareActionBreak ... + LeaseShareActionBreak LeaseShareAction = "Break" + // LeaseShareActionChange ... + LeaseShareActionChange LeaseShareAction = "Change" + // LeaseShareActionRelease ... + LeaseShareActionRelease LeaseShareAction = "Release" + // LeaseShareActionRenew ... + LeaseShareActionRenew LeaseShareAction = "Renew" +) + +// PossibleLeaseShareActionValues returns an array of possible values for the LeaseShareAction const type. +func PossibleLeaseShareActionValues() []LeaseShareAction { + return []LeaseShareAction{LeaseShareActionAcquire, LeaseShareActionBreak, LeaseShareActionChange, LeaseShareActionRelease, LeaseShareActionRenew} +} + +// LeaseState enumerates the values for lease state. +type LeaseState string + +const ( + // LeaseStateAvailable ... + LeaseStateAvailable LeaseState = "Available" + // LeaseStateBreaking ... + LeaseStateBreaking LeaseState = "Breaking" + // LeaseStateBroken ... + LeaseStateBroken LeaseState = "Broken" + // LeaseStateExpired ... + LeaseStateExpired LeaseState = "Expired" + // LeaseStateLeased ... + LeaseStateLeased LeaseState = "Leased" +) + +// PossibleLeaseStateValues returns an array of possible values for the LeaseState const type. +func PossibleLeaseStateValues() []LeaseState { + return []LeaseState{LeaseStateAvailable, LeaseStateBreaking, LeaseStateBroken, LeaseStateExpired, LeaseStateLeased} +} + +// LeaseStatus enumerates the values for lease status. +type LeaseStatus string + +const ( + // LeaseStatusLocked ... + LeaseStatusLocked LeaseStatus = "Locked" + // LeaseStatusUnlocked ... + LeaseStatusUnlocked LeaseStatus = "Unlocked" +) + +// PossibleLeaseStatusValues returns an array of possible values for the LeaseStatus const type. +func PossibleLeaseStatusValues() []LeaseStatus { + return []LeaseStatus{LeaseStatusLocked, LeaseStatusUnlocked} +} + +// ListContainersInclude enumerates the values for list containers include. +type ListContainersInclude string + +const ( + // ListContainersIncludeDeleted ... + ListContainersIncludeDeleted ListContainersInclude = "deleted" +) + +// PossibleListContainersIncludeValues returns an array of possible values for the ListContainersInclude const type. +func PossibleListContainersIncludeValues() []ListContainersInclude { + return []ListContainersInclude{ListContainersIncludeDeleted} +} + +// ListKeyExpand enumerates the values for list key expand. +type ListKeyExpand string + +const ( + // ListKeyExpandKerb ... + ListKeyExpandKerb ListKeyExpand = "kerb" +) + +// PossibleListKeyExpandValues returns an array of possible values for the ListKeyExpand const type. +func PossibleListKeyExpandValues() []ListKeyExpand { + return []ListKeyExpand{ListKeyExpandKerb} +} + +// MigrationState enumerates the values for migration state. +type MigrationState string + +const ( + // MigrationStateCompleted ... + MigrationStateCompleted MigrationState = "Completed" + // MigrationStateInProgress ... + MigrationStateInProgress MigrationState = "InProgress" +) + +// PossibleMigrationStateValues returns an array of possible values for the MigrationState const type. +func PossibleMigrationStateValues() []MigrationState { + return []MigrationState{MigrationStateCompleted, MigrationStateInProgress} +} + +// MinimumTLSVersion enumerates the values for minimum tls version. +type MinimumTLSVersion string + +const ( + // MinimumTLSVersionTLS10 ... + MinimumTLSVersionTLS10 MinimumTLSVersion = "TLS1_0" + // MinimumTLSVersionTLS11 ... + MinimumTLSVersionTLS11 MinimumTLSVersion = "TLS1_1" + // MinimumTLSVersionTLS12 ... + MinimumTLSVersionTLS12 MinimumTLSVersion = "TLS1_2" +) + +// PossibleMinimumTLSVersionValues returns an array of possible values for the MinimumTLSVersion const type. +func PossibleMinimumTLSVersionValues() []MinimumTLSVersion { + return []MinimumTLSVersion{MinimumTLSVersionTLS10, MinimumTLSVersionTLS11, MinimumTLSVersionTLS12} +} + +// Name enumerates the values for name. +type Name string + +const ( + // NameAccessTimeTracking ... + NameAccessTimeTracking Name = "AccessTimeTracking" +) + +// PossibleNameValues returns an array of possible values for the Name const type. +func PossibleNameValues() []Name { + return []Name{NameAccessTimeTracking} +} + +// ObjectType enumerates the values for object type. +type ObjectType string + +const ( + // ObjectTypeBlob ... + ObjectTypeBlob ObjectType = "Blob" + // ObjectTypeContainer ... + ObjectTypeContainer ObjectType = "Container" +) + +// PossibleObjectTypeValues returns an array of possible values for the ObjectType const type. +func PossibleObjectTypeValues() []ObjectType { + return []ObjectType{ObjectTypeBlob, ObjectTypeContainer} +} + +// Permissions enumerates the values for permissions. +type Permissions string + +const ( + // PermissionsA ... + PermissionsA Permissions = "a" + // PermissionsC ... + PermissionsC Permissions = "c" + // PermissionsD ... + PermissionsD Permissions = "d" + // PermissionsL ... + PermissionsL Permissions = "l" + // PermissionsP ... + PermissionsP Permissions = "p" + // PermissionsR ... + PermissionsR Permissions = "r" + // PermissionsU ... + PermissionsU Permissions = "u" + // PermissionsW ... + PermissionsW Permissions = "w" +) + +// PossiblePermissionsValues returns an array of possible values for the Permissions const type. +func PossiblePermissionsValues() []Permissions { + return []Permissions{PermissionsA, PermissionsC, PermissionsD, PermissionsL, PermissionsP, PermissionsR, PermissionsU, PermissionsW} +} + +// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection +// provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + // PrivateEndpointConnectionProvisioningStateCreating ... + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + // PrivateEndpointConnectionProvisioningStateDeleting ... + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + // PrivateEndpointConnectionProvisioningStateFailed ... + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateSucceeded ... + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded} +} + +// PrivateEndpointServiceConnectionStatus enumerates the values for private endpoint service connection status. +type PrivateEndpointServiceConnectionStatus string + +const ( + // PrivateEndpointServiceConnectionStatusApproved ... + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + // PrivateEndpointServiceConnectionStatusPending ... + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + // PrivateEndpointServiceConnectionStatusRejected ... + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointServiceConnectionStatusValues returns an array of possible values for the PrivateEndpointServiceConnectionStatus const type. +func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { + return []PrivateEndpointServiceConnectionStatus{PrivateEndpointServiceConnectionStatusApproved, PrivateEndpointServiceConnectionStatusPending, PrivateEndpointServiceConnectionStatusRejected} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateResolvingDNS ... + ProvisioningStateResolvingDNS ProvisioningState = "ResolvingDNS" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateResolvingDNS, ProvisioningStateSucceeded} +} + +// PublicAccess enumerates the values for public access. +type PublicAccess string + +const ( + // PublicAccessBlob ... + PublicAccessBlob PublicAccess = "Blob" + // PublicAccessContainer ... + PublicAccessContainer PublicAccess = "Container" + // PublicAccessNone ... + PublicAccessNone PublicAccess = "None" +) + +// PossiblePublicAccessValues returns an array of possible values for the PublicAccess const type. +func PossiblePublicAccessValues() []PublicAccess { + return []PublicAccess{PublicAccessBlob, PublicAccessContainer, PublicAccessNone} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled ... + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled ... + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} +} + +// Reason enumerates the values for reason. +type Reason string + +const ( + // ReasonAccountNameInvalid ... + ReasonAccountNameInvalid Reason = "AccountNameInvalid" + // ReasonAlreadyExists ... + ReasonAlreadyExists Reason = "AlreadyExists" +) + +// PossibleReasonValues returns an array of possible values for the Reason const type. +func PossibleReasonValues() []Reason { + return []Reason{ReasonAccountNameInvalid, ReasonAlreadyExists} +} + +// ReasonCode enumerates the values for reason code. +type ReasonCode string + +const ( + // ReasonCodeNotAvailableForSubscription ... + ReasonCodeNotAvailableForSubscription ReasonCode = "NotAvailableForSubscription" + // ReasonCodeQuotaID ... + ReasonCodeQuotaID ReasonCode = "QuotaId" +) + +// PossibleReasonCodeValues returns an array of possible values for the ReasonCode const type. +func PossibleReasonCodeValues() []ReasonCode { + return []ReasonCode{ReasonCodeNotAvailableForSubscription, ReasonCodeQuotaID} +} + +// RootSquashType enumerates the values for root squash type. +type RootSquashType string + +const ( + // RootSquashTypeAllSquash ... + RootSquashTypeAllSquash RootSquashType = "AllSquash" + // RootSquashTypeNoRootSquash ... + RootSquashTypeNoRootSquash RootSquashType = "NoRootSquash" + // RootSquashTypeRootSquash ... + RootSquashTypeRootSquash RootSquashType = "RootSquash" +) + +// PossibleRootSquashTypeValues returns an array of possible values for the RootSquashType const type. +func PossibleRootSquashTypeValues() []RootSquashType { + return []RootSquashType{RootSquashTypeAllSquash, RootSquashTypeNoRootSquash, RootSquashTypeRootSquash} +} + +// RoutingChoice enumerates the values for routing choice. +type RoutingChoice string + +const ( + // RoutingChoiceInternetRouting ... + RoutingChoiceInternetRouting RoutingChoice = "InternetRouting" + // RoutingChoiceMicrosoftRouting ... + RoutingChoiceMicrosoftRouting RoutingChoice = "MicrosoftRouting" +) + +// PossibleRoutingChoiceValues returns an array of possible values for the RoutingChoice const type. +func PossibleRoutingChoiceValues() []RoutingChoice { + return []RoutingChoice{RoutingChoiceInternetRouting, RoutingChoiceMicrosoftRouting} +} + +// Schedule enumerates the values for schedule. +type Schedule string + +const ( + // ScheduleDaily ... + ScheduleDaily Schedule = "Daily" + // ScheduleWeekly ... + ScheduleWeekly Schedule = "Weekly" +) + +// PossibleScheduleValues returns an array of possible values for the Schedule const type. +func PossibleScheduleValues() []Schedule { + return []Schedule{ScheduleDaily, ScheduleWeekly} +} + +// Services enumerates the values for services. +type Services string + +const ( + // ServicesB ... + ServicesB Services = "b" + // ServicesF ... + ServicesF Services = "f" + // ServicesQ ... + ServicesQ Services = "q" + // ServicesT ... + ServicesT Services = "t" +) + +// PossibleServicesValues returns an array of possible values for the Services const type. +func PossibleServicesValues() []Services { + return []Services{ServicesB, ServicesF, ServicesQ, ServicesT} +} + +// ShareAccessTier enumerates the values for share access tier. +type ShareAccessTier string + +const ( + // ShareAccessTierCool ... + ShareAccessTierCool ShareAccessTier = "Cool" + // ShareAccessTierHot ... + ShareAccessTierHot ShareAccessTier = "Hot" + // ShareAccessTierPremium ... + ShareAccessTierPremium ShareAccessTier = "Premium" + // ShareAccessTierTransactionOptimized ... + ShareAccessTierTransactionOptimized ShareAccessTier = "TransactionOptimized" +) + +// PossibleShareAccessTierValues returns an array of possible values for the ShareAccessTier const type. +func PossibleShareAccessTierValues() []ShareAccessTier { + return []ShareAccessTier{ShareAccessTierCool, ShareAccessTierHot, ShareAccessTierPremium, ShareAccessTierTransactionOptimized} +} + +// SignedResource enumerates the values for signed resource. +type SignedResource string + +const ( + // SignedResourceB ... + SignedResourceB SignedResource = "b" + // SignedResourceC ... + SignedResourceC SignedResource = "c" + // SignedResourceF ... + SignedResourceF SignedResource = "f" + // SignedResourceS ... + SignedResourceS SignedResource = "s" +) + +// PossibleSignedResourceValues returns an array of possible values for the SignedResource const type. +func PossibleSignedResourceValues() []SignedResource { + return []SignedResource{SignedResourceB, SignedResourceC, SignedResourceF, SignedResourceS} +} + +// SignedResourceTypes enumerates the values for signed resource types. +type SignedResourceTypes string + +const ( + // SignedResourceTypesC ... + SignedResourceTypesC SignedResourceTypes = "c" + // SignedResourceTypesO ... + SignedResourceTypesO SignedResourceTypes = "o" + // SignedResourceTypesS ... + SignedResourceTypesS SignedResourceTypes = "s" +) + +// PossibleSignedResourceTypesValues returns an array of possible values for the SignedResourceTypes const type. +func PossibleSignedResourceTypesValues() []SignedResourceTypes { + return []SignedResourceTypes{SignedResourceTypesC, SignedResourceTypesO, SignedResourceTypesS} +} + +// SkuConversionStatus enumerates the values for sku conversion status. +type SkuConversionStatus string + +const ( + // SkuConversionStatusFailed ... + SkuConversionStatusFailed SkuConversionStatus = "Failed" + // SkuConversionStatusInProgress ... + SkuConversionStatusInProgress SkuConversionStatus = "InProgress" + // SkuConversionStatusSucceeded ... + SkuConversionStatusSucceeded SkuConversionStatus = "Succeeded" +) + +// PossibleSkuConversionStatusValues returns an array of possible values for the SkuConversionStatus const type. +func PossibleSkuConversionStatusValues() []SkuConversionStatus { + return []SkuConversionStatus{SkuConversionStatusFailed, SkuConversionStatusInProgress, SkuConversionStatusSucceeded} +} + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // SkuNamePremiumLRS ... + SkuNamePremiumLRS SkuName = "Premium_LRS" + // SkuNamePremiumZRS ... + SkuNamePremiumZRS SkuName = "Premium_ZRS" + // SkuNameStandardGRS ... + SkuNameStandardGRS SkuName = "Standard_GRS" + // SkuNameStandardGZRS ... + SkuNameStandardGZRS SkuName = "Standard_GZRS" + // SkuNameStandardLRS ... + SkuNameStandardLRS SkuName = "Standard_LRS" + // SkuNameStandardRAGRS ... + SkuNameStandardRAGRS SkuName = "Standard_RAGRS" + // SkuNameStandardRAGZRS ... + SkuNameStandardRAGZRS SkuName = "Standard_RAGZRS" + // SkuNameStandardZRS ... + SkuNameStandardZRS SkuName = "Standard_ZRS" +) + +// PossibleSkuNameValues returns an array of possible values for the SkuName const type. +func PossibleSkuNameValues() []SkuName { + return []SkuName{SkuNamePremiumLRS, SkuNamePremiumZRS, SkuNameStandardGRS, SkuNameStandardGZRS, SkuNameStandardLRS, SkuNameStandardRAGRS, SkuNameStandardRAGZRS, SkuNameStandardZRS} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // SkuTierPremium ... + SkuTierPremium SkuTier = "Premium" + // SkuTierStandard ... + SkuTierStandard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{SkuTierPremium, SkuTierStandard} +} + +// State enumerates the values for state. +type State string + +const ( + // StateDeprovisioning ... + StateDeprovisioning State = "Deprovisioning" + // StateFailed ... + StateFailed State = "Failed" + // StateNetworkSourceDeleted ... + StateNetworkSourceDeleted State = "NetworkSourceDeleted" + // StateProvisioning ... + StateProvisioning State = "Provisioning" + // StateSucceeded ... + StateSucceeded State = "Succeeded" +) + +// PossibleStateValues returns an array of possible values for the State const type. +func PossibleStateValues() []State { + return []State{StateDeprovisioning, StateFailed, StateNetworkSourceDeleted, StateProvisioning, StateSucceeded} +} + +// UsageUnit enumerates the values for usage unit. +type UsageUnit string + +const ( + // UsageUnitBytes ... + UsageUnitBytes UsageUnit = "Bytes" + // UsageUnitBytesPerSecond ... + UsageUnitBytesPerSecond UsageUnit = "BytesPerSecond" + // UsageUnitCount ... + UsageUnitCount UsageUnit = "Count" + // UsageUnitCountsPerSecond ... + UsageUnitCountsPerSecond UsageUnit = "CountsPerSecond" + // UsageUnitPercent ... + UsageUnitPercent UsageUnit = "Percent" + // UsageUnitSeconds ... + UsageUnitSeconds UsageUnit = "Seconds" +) + +// PossibleUsageUnitValues returns an array of possible values for the UsageUnit const type. +func PossibleUsageUnitValues() []UsageUnit { + return []UsageUnit{UsageUnitBytes, UsageUnitBytesPerSecond, UsageUnitCount, UsageUnitCountsPerSecond, UsageUnitPercent, UsageUnitSeconds} +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/fileservices.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/fileservices.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/fileservices.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/fileservices.go index e626313de1a..57c977db71f 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/fileservices.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/fileservices.go @@ -93,7 +93,7 @@ func (client FileServicesClient) GetServicePropertiesPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -184,7 +184,7 @@ func (client FileServicesClient) ListPreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -288,7 +288,7 @@ func (client FileServicesClient) SetServicePropertiesPreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/fileshares.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/fileshares.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/fileshares.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/fileshares.go index 8c6d637d9f6..bd6cfa5eb1c 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/fileshares.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/fileshares.go @@ -109,7 +109,7 @@ func (client FileSharesClient) CreatePreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -218,7 +218,7 @@ func (client FileSharesClient) DeletePreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -325,7 +325,7 @@ func (client FileSharesClient) GetPreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -433,7 +433,7 @@ func (client FileSharesClient) LeasePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -542,7 +542,7 @@ func (client FileSharesClient) ListPreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -689,7 +689,7 @@ func (client FileSharesClient) RestorePreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -790,7 +790,7 @@ func (client FileSharesClient) UpdatePreparer(ctx context.Context, resourceGroup "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/localusers.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/localusers.go new file mode 100644 index 00000000000..4552d1e63ec --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/localusers.go @@ -0,0 +1,610 @@ +package storage + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LocalUsersClient is the the Azure Storage Management API. +type LocalUsersClient struct { + BaseClient +} + +// NewLocalUsersClient creates an instance of the LocalUsersClient client. +func NewLocalUsersClient(subscriptionID string) LocalUsersClient { + return NewLocalUsersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocalUsersClientWithBaseURI creates an instance of the LocalUsersClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewLocalUsersClientWithBaseURI(baseURI string, subscriptionID string) LocalUsersClient { + return LocalUsersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update the properties of a local user associated with the storage account +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// username - the name of local user. The username must contain lowercase letters and numbers only. It must be +// unique only within the storage account. +// properties - the local user associated with a storage account. +func (client LocalUsersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, username string, properties LocalUser) (result LocalUser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalUsersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: username, + Constraints: []validation.Constraint{{Target: "username", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "username", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.LocalUsersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, username, properties) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LocalUsersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, username string, properties LocalUser) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "username": autorest.Encode("path", username), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}", pathParameters), + autorest.WithJSON(properties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LocalUsersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LocalUsersClient) CreateOrUpdateResponder(resp *http.Response) (result LocalUser, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the local user associated with the specified storage account. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// username - the name of local user. The username must contain lowercase letters and numbers only. It must be +// unique only within the storage account. +func (client LocalUsersClient) Delete(ctx context.Context, resourceGroupName string, accountName string, username string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalUsersClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: username, + Constraints: []validation.Constraint{{Target: "username", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "username", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.LocalUsersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, username) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LocalUsersClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, username string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "username": autorest.Encode("path", username), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LocalUsersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LocalUsersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the local user of the storage account by username. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// username - the name of local user. The username must contain lowercase letters and numbers only. It must be +// unique only within the storage account. +func (client LocalUsersClient) Get(ctx context.Context, resourceGroupName string, accountName string, username string) (result LocalUser, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalUsersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: username, + Constraints: []validation.Constraint{{Target: "username", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "username", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.LocalUsersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, username) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client LocalUsersClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, username string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "username": autorest.Encode("path", username), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LocalUsersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LocalUsersClient) GetResponder(resp *http.Response) (result LocalUser, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list the local users associated with the storage account. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +func (client LocalUsersClient) List(ctx context.Context, resourceGroupName string, accountName string) (result LocalUsers, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalUsersClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.LocalUsersClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LocalUsersClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LocalUsersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LocalUsersClient) ListResponder(resp *http.Response) (result LocalUsers, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListKeys list SSH authorized keys and shared key of the local user. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// username - the name of local user. The username must contain lowercase letters and numbers only. It must be +// unique only within the storage account. +func (client LocalUsersClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string, username string) (result LocalUserKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalUsersClient.ListKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: username, + Constraints: []validation.Constraint{{Target: "username", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "username", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.LocalUsersClient", "ListKeys", err.Error()) + } + + req, err := client.ListKeysPreparer(ctx, resourceGroupName, accountName, username) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "ListKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client LocalUsersClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, accountName string, username string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "username": autorest.Encode("path", username), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client LocalUsersClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client LocalUsersClient) ListKeysResponder(resp *http.Response) (result LocalUserKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegeneratePassword regenerate the local user SSH password. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// username - the name of local user. The username must contain lowercase letters and numbers only. It must be +// unique only within the storage account. +func (client LocalUsersClient) RegeneratePassword(ctx context.Context, resourceGroupName string, accountName string, username string) (result LocalUserRegeneratePasswordResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalUsersClient.RegeneratePassword") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: username, + Constraints: []validation.Constraint{{Target: "username", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "username", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.LocalUsersClient", "RegeneratePassword", err.Error()) + } + + req, err := client.RegeneratePasswordPreparer(ctx, resourceGroupName, accountName, username) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "RegeneratePassword", nil, "Failure preparing request") + return + } + + resp, err := client.RegeneratePasswordSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "RegeneratePassword", resp, "Failure sending request") + return + } + + result, err = client.RegeneratePasswordResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.LocalUsersClient", "RegeneratePassword", resp, "Failure responding to request") + return + } + + return +} + +// RegeneratePasswordPreparer prepares the RegeneratePassword request. +func (client LocalUsersClient) RegeneratePasswordPreparer(ctx context.Context, resourceGroupName string, accountName string, username string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "username": autorest.Encode("path", username), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}/regeneratePassword", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegeneratePasswordSender sends the RegeneratePassword request. The method will close the +// http.Response Body if it receives an error. +func (client LocalUsersClient) RegeneratePasswordSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegeneratePasswordResponder handles the response to the RegeneratePassword request. The method always +// closes the http.Response Body. +func (client LocalUsersClient) RegeneratePasswordResponder(resp *http.Response) (result LocalUserRegeneratePasswordResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/managementpolicies.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/managementpolicies.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/managementpolicies.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/managementpolicies.go index 8181c9be753..c55da446fd6 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/managementpolicies.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/managementpolicies.go @@ -99,7 +99,7 @@ func (client ManagementPoliciesClient) CreateOrUpdatePreparer(ctx context.Contex "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -193,7 +193,7 @@ func (client ManagementPoliciesClient) DeletePreparer(ctx context.Context, resou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -284,7 +284,7 @@ func (client ManagementPoliciesClient) GetPreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/models.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/models.go new file mode 100644 index 00000000000..69058ef272d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/models.go @@ -0,0 +1,5743 @@ +package storage + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage" + +// AccessPolicy ... +type AccessPolicy struct { + // StartTime - Start time of the access policy + StartTime *date.Time `json:"startTime,omitempty"` + // ExpiryTime - Expiry time of the access policy + ExpiryTime *date.Time `json:"expiryTime,omitempty"` + // Permission - List of abbreviated permissions. + Permission *string `json:"permission,omitempty"` +} + +// Account the storage account. +type Account struct { + autorest.Response `json:"-"` + // Sku - READ-ONLY; Gets the SKU. + Sku *Sku `json:"sku,omitempty"` + // Kind - READ-ONLY; Gets the Kind. Possible values include: 'KindStorage', 'KindStorageV2', 'KindBlobStorage', 'KindFileStorage', 'KindBlockBlobStorage' + Kind Kind `json:"kind,omitempty"` + // Identity - The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + // ExtendedLocation - The extendedLocation of the resource. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // AccountProperties - Properties of the storage account. + *AccountProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Account. +func (a Account) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.Identity != nil { + objectMap["identity"] = a.Identity + } + if a.ExtendedLocation != nil { + objectMap["extendedLocation"] = a.ExtendedLocation + } + if a.AccountProperties != nil { + objectMap["properties"] = a.AccountProperties + } + if a.Tags != nil { + objectMap["tags"] = a.Tags + } + if a.Location != nil { + objectMap["location"] = a.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Account struct. +func (a *Account) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + a.Sku = &sku + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + a.Kind = kind + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + a.Identity = &identity + } + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + a.ExtendedLocation = &extendedLocation + } + case "properties": + if v != nil { + var accountProperties AccountProperties + err = json.Unmarshal(*v, &accountProperties) + if err != nil { + return err + } + a.AccountProperties = &accountProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + a.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + a.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + a.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + a.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + a.Type = &typeVar + } + } + } + + return nil +} + +// AccountCheckNameAvailabilityParameters the parameters used to check the availability of the storage +// account name. +type AccountCheckNameAvailabilityParameters struct { + // Name - The storage account name. + Name *string `json:"name,omitempty"` + // Type - The type of resource, Microsoft.Storage/storageAccounts + Type *string `json:"type,omitempty"` +} + +// AccountCreateParameters the parameters used when creating a storage account. +type AccountCreateParameters struct { + // Sku - Required. Gets or sets the SKU name. + Sku *Sku `json:"sku,omitempty"` + // Kind - Required. Indicates the type of storage account. Possible values include: 'KindStorage', 'KindStorageV2', 'KindBlobStorage', 'KindFileStorage', 'KindBlockBlobStorage' + Kind Kind `json:"kind,omitempty"` + // Location - Required. Gets or sets the location of the resource. This will be one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. + Location *string `json:"location,omitempty"` + // ExtendedLocation - Optional. Set the extended location of the resource. If not set, the storage account will be created in Azure main region. Otherwise it will be created in the specified extended location + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Tags - Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. + Tags map[string]*string `json:"tags"` + // Identity - The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + // AccountPropertiesCreateParameters - The parameters used to create the storage account. + *AccountPropertiesCreateParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountCreateParameters. +func (acp AccountCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if acp.Sku != nil { + objectMap["sku"] = acp.Sku + } + if acp.Kind != "" { + objectMap["kind"] = acp.Kind + } + if acp.Location != nil { + objectMap["location"] = acp.Location + } + if acp.ExtendedLocation != nil { + objectMap["extendedLocation"] = acp.ExtendedLocation + } + if acp.Tags != nil { + objectMap["tags"] = acp.Tags + } + if acp.Identity != nil { + objectMap["identity"] = acp.Identity + } + if acp.AccountPropertiesCreateParameters != nil { + objectMap["properties"] = acp.AccountPropertiesCreateParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccountCreateParameters struct. +func (acp *AccountCreateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + acp.Sku = &sku + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + acp.Kind = kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + acp.Location = &location + } + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + acp.ExtendedLocation = &extendedLocation + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + acp.Tags = tags + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + acp.Identity = &identity + } + case "properties": + if v != nil { + var accountPropertiesCreateParameters AccountPropertiesCreateParameters + err = json.Unmarshal(*v, &accountPropertiesCreateParameters) + if err != nil { + return err + } + acp.AccountPropertiesCreateParameters = &accountPropertiesCreateParameters + } + } + } + + return nil +} + +// AccountImmutabilityPolicyProperties this defines account-level immutability policy properties. +type AccountImmutabilityPolicyProperties struct { + // ImmutabilityPeriodSinceCreationInDays - The immutability period for the blobs in the container since the policy creation, in days. + ImmutabilityPeriodSinceCreationInDays *int32 `json:"immutabilityPeriodSinceCreationInDays,omitempty"` + // State - The ImmutabilityPolicy state defines the mode of the policy. Disabled state disables the policy, Unlocked state allows increase and decrease of immutability retention time and also allows toggling allowProtectedAppendWrites property, Locked state only allows the increase of the immutability retention time. A policy can only be created in a Disabled or Unlocked state and can be toggled between the two states. Only a policy in an Unlocked state can transition to a Locked state which cannot be reverted. Possible values include: 'AccountImmutabilityPolicyStateUnlocked', 'AccountImmutabilityPolicyStateLocked', 'AccountImmutabilityPolicyStateDisabled' + State AccountImmutabilityPolicyState `json:"state,omitempty"` + // AllowProtectedAppendWrites - This property can only be changed for disabled and unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. + AllowProtectedAppendWrites *bool `json:"allowProtectedAppendWrites,omitempty"` +} + +// AccountInternetEndpoints the URIs that are used to perform a retrieval of a public blob, file, web or +// dfs object via a internet routing endpoint. +type AccountInternetEndpoints struct { + // Blob - READ-ONLY; Gets the blob endpoint. + Blob *string `json:"blob,omitempty"` + // File - READ-ONLY; Gets the file endpoint. + File *string `json:"file,omitempty"` + // Web - READ-ONLY; Gets the web endpoint. + Web *string `json:"web,omitempty"` + // Dfs - READ-ONLY; Gets the dfs endpoint. + Dfs *string `json:"dfs,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountInternetEndpoints. +func (aie AccountInternetEndpoints) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AccountKey an access key for the storage account. +type AccountKey struct { + // KeyName - READ-ONLY; Name of the key. + KeyName *string `json:"keyName,omitempty"` + // Value - READ-ONLY; Base 64-encoded value of the key. + Value *string `json:"value,omitempty"` + // Permissions - READ-ONLY; Permissions for the key -- read-only or full permissions. Possible values include: 'KeyPermissionRead', 'KeyPermissionFull' + Permissions KeyPermission `json:"permissions,omitempty"` + // CreationTime - READ-ONLY; Creation time of the key, in round trip date format. + CreationTime *date.Time `json:"creationTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountKey. +func (ak AccountKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AccountListKeysResult the response from the ListKeys operation. +type AccountListKeysResult struct { + autorest.Response `json:"-"` + // Keys - READ-ONLY; Gets the list of storage account keys and their properties for the specified storage account. + Keys *[]AccountKey `json:"keys,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountListKeysResult. +func (alkr AccountListKeysResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AccountListResult the response from the List Storage Accounts operation. +type AccountListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Gets the list of storage accounts and their properties. + Value *[]Account `json:"value,omitempty"` + // NextLink - READ-ONLY; Request URL that can be used to query next page of storage accounts. Returned when total number of requested storage accounts exceed maximum page size. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountListResult. +func (alr AccountListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AccountListResultIterator provides access to a complete listing of Account values. +type AccountListResultIterator struct { + i int + page AccountListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AccountListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AccountListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AccountListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AccountListResultIterator) Response() AccountListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AccountListResultIterator) Value() Account { + if !iter.page.NotDone() { + return Account{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AccountListResultIterator type. +func NewAccountListResultIterator(page AccountListResultPage) AccountListResultIterator { + return AccountListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (alr AccountListResult) IsEmpty() bool { + return alr.Value == nil || len(*alr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (alr AccountListResult) hasNextLink() bool { + return alr.NextLink != nil && len(*alr.NextLink) != 0 +} + +// accountListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (alr AccountListResult) accountListResultPreparer(ctx context.Context) (*http.Request, error) { + if !alr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(alr.NextLink))) +} + +// AccountListResultPage contains a page of Account values. +type AccountListResultPage struct { + fn func(context.Context, AccountListResult) (AccountListResult, error) + alr AccountListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AccountListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.alr) + if err != nil { + return err + } + page.alr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AccountListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AccountListResultPage) NotDone() bool { + return !page.alr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AccountListResultPage) Response() AccountListResult { + return page.alr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AccountListResultPage) Values() []Account { + if page.alr.IsEmpty() { + return nil + } + return *page.alr.Value +} + +// Creates a new instance of the AccountListResultPage type. +func NewAccountListResultPage(cur AccountListResult, getNextPage func(context.Context, AccountListResult) (AccountListResult, error)) AccountListResultPage { + return AccountListResultPage{ + fn: getNextPage, + alr: cur, + } +} + +// AccountMicrosoftEndpoints the URIs that are used to perform a retrieval of a public blob, queue, table, +// web or dfs object via a microsoft routing endpoint. +type AccountMicrosoftEndpoints struct { + // Blob - READ-ONLY; Gets the blob endpoint. + Blob *string `json:"blob,omitempty"` + // Queue - READ-ONLY; Gets the queue endpoint. + Queue *string `json:"queue,omitempty"` + // Table - READ-ONLY; Gets the table endpoint. + Table *string `json:"table,omitempty"` + // File - READ-ONLY; Gets the file endpoint. + File *string `json:"file,omitempty"` + // Web - READ-ONLY; Gets the web endpoint. + Web *string `json:"web,omitempty"` + // Dfs - READ-ONLY; Gets the dfs endpoint. + Dfs *string `json:"dfs,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountMicrosoftEndpoints. +func (ame AccountMicrosoftEndpoints) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AccountProperties properties of the storage account. +type AccountProperties struct { + // ProvisioningState - READ-ONLY; Gets the status of the storage account at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateResolvingDNS', 'ProvisioningStateSucceeded' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrimaryEndpoints - READ-ONLY; Gets the URLs that are used to perform a retrieval of a public blob, queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob endpoint. + PrimaryEndpoints *Endpoints `json:"primaryEndpoints,omitempty"` + // PrimaryLocation - READ-ONLY; Gets the location of the primary data center for the storage account. + PrimaryLocation *string `json:"primaryLocation,omitempty"` + // StatusOfPrimary - READ-ONLY; Gets the status indicating whether the primary location of the storage account is available or unavailable. Possible values include: 'AccountStatusAvailable', 'AccountStatusUnavailable' + StatusOfPrimary AccountStatus `json:"statusOfPrimary,omitempty"` + // LastGeoFailoverTime - READ-ONLY; Gets the timestamp of the most recent instance of a failover to the secondary location. Only the most recent timestamp is retained. This element is not returned if there has never been a failover instance. Only available if the accountType is Standard_GRS or Standard_RAGRS. + LastGeoFailoverTime *date.Time `json:"lastGeoFailoverTime,omitempty"` + // SecondaryLocation - READ-ONLY; Gets the location of the geo-replicated secondary for the storage account. Only available if the accountType is Standard_GRS or Standard_RAGRS. + SecondaryLocation *string `json:"secondaryLocation,omitempty"` + // StatusOfSecondary - READ-ONLY; Gets the status indicating whether the secondary location of the storage account is available or unavailable. Only available if the SKU name is Standard_GRS or Standard_RAGRS. Possible values include: 'AccountStatusAvailable', 'AccountStatusUnavailable' + StatusOfSecondary AccountStatus `json:"statusOfSecondary,omitempty"` + // CreationTime - READ-ONLY; Gets the creation date and time of the storage account in UTC. + CreationTime *date.Time `json:"creationTime,omitempty"` + // CustomDomain - READ-ONLY; Gets the custom domain the user assigned to this storage account. + CustomDomain *CustomDomain `json:"customDomain,omitempty"` + // SasPolicy - READ-ONLY; SasPolicy assigned to the storage account. + SasPolicy *SasPolicy `json:"sasPolicy,omitempty"` + // KeyPolicy - READ-ONLY; KeyPolicy assigned to the storage account. + KeyPolicy *KeyPolicy `json:"keyPolicy,omitempty"` + // KeyCreationTime - READ-ONLY; Storage account keys creation time. + KeyCreationTime *KeyCreationTime `json:"keyCreationTime,omitempty"` + // SecondaryEndpoints - READ-ONLY; Gets the URLs that are used to perform a retrieval of a public blob, queue, or table object from the secondary location of the storage account. Only available if the SKU name is Standard_RAGRS. + SecondaryEndpoints *Endpoints `json:"secondaryEndpoints,omitempty"` + // Encryption - READ-ONLY; Encryption settings to be used for server-side encryption for the storage account. + Encryption *Encryption `json:"encryption,omitempty"` + // AccessTier - READ-ONLY; Required for storage accounts where kind = BlobStorage. The access tier is used for billing. The 'Premium' access tier is the default value for premium block blobs storage account type and it cannot be changed for the premium block blobs storage account type. Possible values include: 'AccessTierHot', 'AccessTierCool', 'AccessTierPremium' + AccessTier AccessTier `json:"accessTier,omitempty"` + // AzureFilesIdentityBasedAuthentication - Provides the identity based authentication settings for Azure Files. + AzureFilesIdentityBasedAuthentication *AzureFilesIdentityBasedAuthentication `json:"azureFilesIdentityBasedAuthentication,omitempty"` + // EnableHTTPSTrafficOnly - Allows https traffic only to storage service if sets to true. + EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"` + // NetworkRuleSet - READ-ONLY; Network rule set + NetworkRuleSet *NetworkRuleSet `json:"networkAcls,omitempty"` + // IsSftpEnabled - Enables Secure File Transfer Protocol, if set to true + IsSftpEnabled *bool `json:"isSftpEnabled,omitempty"` + // IsLocalUserEnabled - Enables local users feature, if set to true + IsLocalUserEnabled *bool `json:"isLocalUserEnabled,omitempty"` + // IsHnsEnabled - Account HierarchicalNamespace enabled if sets to true. + IsHnsEnabled *bool `json:"isHnsEnabled,omitempty"` + // GeoReplicationStats - READ-ONLY; Geo Replication Stats + GeoReplicationStats *GeoReplicationStats `json:"geoReplicationStats,omitempty"` + // FailoverInProgress - READ-ONLY; If the failover is in progress, the value will be true, otherwise, it will be null. + FailoverInProgress *bool `json:"failoverInProgress,omitempty"` + // LargeFileSharesState - Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: 'LargeFileSharesStateDisabled', 'LargeFileSharesStateEnabled' + LargeFileSharesState LargeFileSharesState `json:"largeFileSharesState,omitempty"` + // PrivateEndpointConnections - READ-ONLY; List of private endpoint connection associated with the specified storage account + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // RoutingPreference - Maintains information about the network routing choice opted by the user for data transfer + RoutingPreference *RoutingPreference `json:"routingPreference,omitempty"` + // BlobRestoreStatus - READ-ONLY; Blob restore status + BlobRestoreStatus *BlobRestoreStatus `json:"blobRestoreStatus,omitempty"` + // AllowBlobPublicAccess - Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. + AllowBlobPublicAccess *bool `json:"allowBlobPublicAccess,omitempty"` + // MinimumTLSVersion - Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: 'MinimumTLSVersionTLS10', 'MinimumTLSVersionTLS11', 'MinimumTLSVersionTLS12' + MinimumTLSVersion MinimumTLSVersion `json:"minimumTlsVersion,omitempty"` + // AllowSharedKeyAccess - Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. + AllowSharedKeyAccess *bool `json:"allowSharedKeyAccess,omitempty"` + // EnableNfsV3 - NFS 3.0 protocol support enabled if set to true. + EnableNfsV3 *bool `json:"isNfsV3Enabled,omitempty"` + // AllowCrossTenantReplication - Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. + AllowCrossTenantReplication *bool `json:"allowCrossTenantReplication,omitempty"` + // DefaultToOAuthAuthentication - A boolean flag which indicates whether the default authentication is OAuth or not. The default interpretation is false for this property. + DefaultToOAuthAuthentication *bool `json:"defaultToOAuthAuthentication,omitempty"` + // PublicNetworkAccess - Allow or disallow public network access to Storage Account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // ImmutableStorageWithVersioning - The property is immutable and can only be set to true at the account creation time. When set to true, it enables object level immutability for all the containers in the account by default. + ImmutableStorageWithVersioning *ImmutableStorageAccount `json:"immutableStorageWithVersioning,omitempty"` + // AllowedCopyScope - Restrict copy to and from Storage Accounts within an AAD tenant or with Private Links to the same VNet. Possible values include: 'AllowedCopyScopePrivateLink', 'AllowedCopyScopeAAD' + AllowedCopyScope AllowedCopyScope `json:"allowedCopyScope,omitempty"` + // StorageAccountSkuConversionStatus - This property is readOnly and is set by server during asynchronous storage account sku conversion operations. + StorageAccountSkuConversionStatus *AccountSkuConversionStatus `json:"storageAccountSkuConversionStatus,omitempty"` + // DNSEndpointType - Allows you to specify the type of endpoint. Set this to AzureDNSZone to create a large number of accounts in a single subscription, which creates accounts in an Azure DNS Zone and the endpoint URL will have an alphanumeric DNS Zone identifier. Possible values include: 'DNSEndpointTypeStandard', 'DNSEndpointTypeAzureDNSZone' + DNSEndpointType DNSEndpointType `json:"dnsEndpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountProperties. +func (ap AccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.AzureFilesIdentityBasedAuthentication != nil { + objectMap["azureFilesIdentityBasedAuthentication"] = ap.AzureFilesIdentityBasedAuthentication + } + if ap.EnableHTTPSTrafficOnly != nil { + objectMap["supportsHttpsTrafficOnly"] = ap.EnableHTTPSTrafficOnly + } + if ap.IsSftpEnabled != nil { + objectMap["isSftpEnabled"] = ap.IsSftpEnabled + } + if ap.IsLocalUserEnabled != nil { + objectMap["isLocalUserEnabled"] = ap.IsLocalUserEnabled + } + if ap.IsHnsEnabled != nil { + objectMap["isHnsEnabled"] = ap.IsHnsEnabled + } + if ap.LargeFileSharesState != "" { + objectMap["largeFileSharesState"] = ap.LargeFileSharesState + } + if ap.RoutingPreference != nil { + objectMap["routingPreference"] = ap.RoutingPreference + } + if ap.AllowBlobPublicAccess != nil { + objectMap["allowBlobPublicAccess"] = ap.AllowBlobPublicAccess + } + if ap.MinimumTLSVersion != "" { + objectMap["minimumTlsVersion"] = ap.MinimumTLSVersion + } + if ap.AllowSharedKeyAccess != nil { + objectMap["allowSharedKeyAccess"] = ap.AllowSharedKeyAccess + } + if ap.EnableNfsV3 != nil { + objectMap["isNfsV3Enabled"] = ap.EnableNfsV3 + } + if ap.AllowCrossTenantReplication != nil { + objectMap["allowCrossTenantReplication"] = ap.AllowCrossTenantReplication + } + if ap.DefaultToOAuthAuthentication != nil { + objectMap["defaultToOAuthAuthentication"] = ap.DefaultToOAuthAuthentication + } + if ap.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = ap.PublicNetworkAccess + } + if ap.ImmutableStorageWithVersioning != nil { + objectMap["immutableStorageWithVersioning"] = ap.ImmutableStorageWithVersioning + } + if ap.AllowedCopyScope != "" { + objectMap["allowedCopyScope"] = ap.AllowedCopyScope + } + if ap.StorageAccountSkuConversionStatus != nil { + objectMap["storageAccountSkuConversionStatus"] = ap.StorageAccountSkuConversionStatus + } + if ap.DNSEndpointType != "" { + objectMap["dnsEndpointType"] = ap.DNSEndpointType + } + return json.Marshal(objectMap) +} + +// AccountPropertiesCreateParameters the parameters used to create the storage account. +type AccountPropertiesCreateParameters struct { + // AllowedCopyScope - Restrict copy to and from Storage Accounts within an AAD tenant or with Private Links to the same VNet. Possible values include: 'AllowedCopyScopePrivateLink', 'AllowedCopyScopeAAD' + AllowedCopyScope AllowedCopyScope `json:"allowedCopyScope,omitempty"` + // PublicNetworkAccess - Allow or disallow public network access to Storage Account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // SasPolicy - SasPolicy assigned to the storage account. + SasPolicy *SasPolicy `json:"sasPolicy,omitempty"` + // KeyPolicy - KeyPolicy assigned to the storage account. + KeyPolicy *KeyPolicy `json:"keyPolicy,omitempty"` + // CustomDomain - User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. + CustomDomain *CustomDomain `json:"customDomain,omitempty"` + // Encryption - Encryption settings to be used for server-side encryption for the storage account. + Encryption *Encryption `json:"encryption,omitempty"` + // NetworkRuleSet - Network rule set + NetworkRuleSet *NetworkRuleSet `json:"networkAcls,omitempty"` + // AccessTier - Required for storage accounts where kind = BlobStorage. The access tier is used for billing. The 'Premium' access tier is the default value for premium block blobs storage account type and it cannot be changed for the premium block blobs storage account type. Possible values include: 'AccessTierHot', 'AccessTierCool', 'AccessTierPremium' + AccessTier AccessTier `json:"accessTier,omitempty"` + // AzureFilesIdentityBasedAuthentication - Provides the identity based authentication settings for Azure Files. + AzureFilesIdentityBasedAuthentication *AzureFilesIdentityBasedAuthentication `json:"azureFilesIdentityBasedAuthentication,omitempty"` + // EnableHTTPSTrafficOnly - Allows https traffic only to storage service if sets to true. The default value is true since API version 2019-04-01. + EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"` + // IsSftpEnabled - Enables Secure File Transfer Protocol, if set to true + IsSftpEnabled *bool `json:"isSftpEnabled,omitempty"` + // IsLocalUserEnabled - Enables local users feature, if set to true + IsLocalUserEnabled *bool `json:"isLocalUserEnabled,omitempty"` + // IsHnsEnabled - Account HierarchicalNamespace enabled if sets to true. + IsHnsEnabled *bool `json:"isHnsEnabled,omitempty"` + // LargeFileSharesState - Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: 'LargeFileSharesStateDisabled', 'LargeFileSharesStateEnabled' + LargeFileSharesState LargeFileSharesState `json:"largeFileSharesState,omitempty"` + // RoutingPreference - Maintains information about the network routing choice opted by the user for data transfer + RoutingPreference *RoutingPreference `json:"routingPreference,omitempty"` + // AllowBlobPublicAccess - Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. + AllowBlobPublicAccess *bool `json:"allowBlobPublicAccess,omitempty"` + // MinimumTLSVersion - Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: 'MinimumTLSVersionTLS10', 'MinimumTLSVersionTLS11', 'MinimumTLSVersionTLS12' + MinimumTLSVersion MinimumTLSVersion `json:"minimumTlsVersion,omitempty"` + // AllowSharedKeyAccess - Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. + AllowSharedKeyAccess *bool `json:"allowSharedKeyAccess,omitempty"` + // EnableNfsV3 - NFS 3.0 protocol support enabled if set to true. + EnableNfsV3 *bool `json:"isNfsV3Enabled,omitempty"` + // AllowCrossTenantReplication - Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. + AllowCrossTenantReplication *bool `json:"allowCrossTenantReplication,omitempty"` + // DefaultToOAuthAuthentication - A boolean flag which indicates whether the default authentication is OAuth or not. The default interpretation is false for this property. + DefaultToOAuthAuthentication *bool `json:"defaultToOAuthAuthentication,omitempty"` + // ImmutableStorageWithVersioning - The property is immutable and can only be set to true at the account creation time. When set to true, it enables object level immutability for all the new containers in the account by default. + ImmutableStorageWithVersioning *ImmutableStorageAccount `json:"immutableStorageWithVersioning,omitempty"` + // DNSEndpointType - Allows you to specify the type of endpoint. Set this to AzureDNSZone to create a large number of accounts in a single subscription, which creates accounts in an Azure DNS Zone and the endpoint URL will have an alphanumeric DNS Zone identifier. Possible values include: 'DNSEndpointTypeStandard', 'DNSEndpointTypeAzureDNSZone' + DNSEndpointType DNSEndpointType `json:"dnsEndpointType,omitempty"` +} + +// AccountPropertiesUpdateParameters the parameters used when updating a storage account. +type AccountPropertiesUpdateParameters struct { + // CustomDomain - Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. + CustomDomain *CustomDomain `json:"customDomain,omitempty"` + // Encryption - Not applicable. Azure Storage encryption at rest is enabled by default for all storage accounts and cannot be disabled. + Encryption *Encryption `json:"encryption,omitempty"` + // SasPolicy - SasPolicy assigned to the storage account. + SasPolicy *SasPolicy `json:"sasPolicy,omitempty"` + // KeyPolicy - KeyPolicy assigned to the storage account. + KeyPolicy *KeyPolicy `json:"keyPolicy,omitempty"` + // AccessTier - Required for storage accounts where kind = BlobStorage. The access tier is used for billing. The 'Premium' access tier is the default value for premium block blobs storage account type and it cannot be changed for the premium block blobs storage account type. Possible values include: 'AccessTierHot', 'AccessTierCool', 'AccessTierPremium' + AccessTier AccessTier `json:"accessTier,omitempty"` + // AzureFilesIdentityBasedAuthentication - Provides the identity based authentication settings for Azure Files. + AzureFilesIdentityBasedAuthentication *AzureFilesIdentityBasedAuthentication `json:"azureFilesIdentityBasedAuthentication,omitempty"` + // EnableHTTPSTrafficOnly - Allows https traffic only to storage service if sets to true. + EnableHTTPSTrafficOnly *bool `json:"supportsHttpsTrafficOnly,omitempty"` + // IsSftpEnabled - Enables Secure File Transfer Protocol, if set to true + IsSftpEnabled *bool `json:"isSftpEnabled,omitempty"` + // IsLocalUserEnabled - Enables local users feature, if set to true + IsLocalUserEnabled *bool `json:"isLocalUserEnabled,omitempty"` + // NetworkRuleSet - Network rule set + NetworkRuleSet *NetworkRuleSet `json:"networkAcls,omitempty"` + // LargeFileSharesState - Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. Possible values include: 'LargeFileSharesStateDisabled', 'LargeFileSharesStateEnabled' + LargeFileSharesState LargeFileSharesState `json:"largeFileSharesState,omitempty"` + // RoutingPreference - Maintains information about the network routing choice opted by the user for data transfer + RoutingPreference *RoutingPreference `json:"routingPreference,omitempty"` + // AllowBlobPublicAccess - Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for this property. + AllowBlobPublicAccess *bool `json:"allowBlobPublicAccess,omitempty"` + // MinimumTLSVersion - Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS 1.0 for this property. Possible values include: 'MinimumTLSVersionTLS10', 'MinimumTLSVersionTLS11', 'MinimumTLSVersionTLS12' + MinimumTLSVersion MinimumTLSVersion `json:"minimumTlsVersion,omitempty"` + // AllowSharedKeyAccess - Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If false, then all requests, including shared access signatures, must be authorized with Azure Active Directory (Azure AD). The default value is null, which is equivalent to true. + AllowSharedKeyAccess *bool `json:"allowSharedKeyAccess,omitempty"` + // AllowCrossTenantReplication - Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. + AllowCrossTenantReplication *bool `json:"allowCrossTenantReplication,omitempty"` + // DefaultToOAuthAuthentication - A boolean flag which indicates whether the default authentication is OAuth or not. The default interpretation is false for this property. + DefaultToOAuthAuthentication *bool `json:"defaultToOAuthAuthentication,omitempty"` + // PublicNetworkAccess - Allow or disallow public network access to Storage Account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // ImmutableStorageWithVersioning - The property is immutable and can only be set to true at the account creation time. When set to true, it enables object level immutability for all the containers in the account by default. + ImmutableStorageWithVersioning *ImmutableStorageAccount `json:"immutableStorageWithVersioning,omitempty"` + // AllowedCopyScope - Restrict copy to and from Storage Accounts within an AAD tenant or with Private Links to the same VNet. Possible values include: 'AllowedCopyScopePrivateLink', 'AllowedCopyScopeAAD' + AllowedCopyScope AllowedCopyScope `json:"allowedCopyScope,omitempty"` + // DNSEndpointType - Allows you to specify the type of endpoint. Set this to AzureDNSZone to create a large number of accounts in a single subscription, which creates accounts in an Azure DNS Zone and the endpoint URL will have an alphanumeric DNS Zone identifier. Possible values include: 'DNSEndpointTypeStandard', 'DNSEndpointTypeAzureDNSZone' + DNSEndpointType DNSEndpointType `json:"dnsEndpointType,omitempty"` +} + +// AccountRegenerateKeyParameters the parameters used to regenerate the storage account key. +type AccountRegenerateKeyParameters struct { + // KeyName - The name of storage keys that want to be regenerated, possible values are key1, key2, kerb1, kerb2. + KeyName *string `json:"keyName,omitempty"` +} + +// AccountsAbortHierarchicalNamespaceMigrationFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type AccountsAbortHierarchicalNamespaceMigrationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountsAbortHierarchicalNamespaceMigrationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountsAbortHierarchicalNamespaceMigrationFuture.Result. +func (future *AccountsAbortHierarchicalNamespaceMigrationFuture) result(client AccountsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsAbortHierarchicalNamespaceMigrationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storage.AccountsAbortHierarchicalNamespaceMigrationFuture") + return + } + ar.Response = future.Response() + return +} + +// AccountSasParameters the parameters to list SAS credentials of a storage account. +type AccountSasParameters struct { + // Services - The signed services accessible with the account SAS. Possible values include: Blob (b), Queue (q), Table (t), File (f). Possible values include: 'ServicesB', 'ServicesQ', 'ServicesT', 'ServicesF' + Services Services `json:"signedServices,omitempty"` + // ResourceTypes - The signed resource types that are accessible with the account SAS. Service (s): Access to service-level APIs; Container (c): Access to container-level APIs; Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files. Possible values include: 'SignedResourceTypesS', 'SignedResourceTypesC', 'SignedResourceTypesO' + ResourceTypes SignedResourceTypes `json:"signedResourceTypes,omitempty"` + // Permissions - The signed permissions for the account SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: 'PermissionsR', 'PermissionsD', 'PermissionsW', 'PermissionsL', 'PermissionsA', 'PermissionsC', 'PermissionsU', 'PermissionsP' + Permissions Permissions `json:"signedPermission,omitempty"` + // IPAddressOrRange - An IP address or a range of IP addresses from which to accept requests. + IPAddressOrRange *string `json:"signedIp,omitempty"` + // Protocols - The protocol permitted for a request made with the account SAS. Possible values include: 'HTTPProtocolHttpshttp', 'HTTPProtocolHTTPS' + Protocols HTTPProtocol `json:"signedProtocol,omitempty"` + // SharedAccessStartTime - The time at which the SAS becomes valid. + SharedAccessStartTime *date.Time `json:"signedStart,omitempty"` + // SharedAccessExpiryTime - The time at which the shared access signature becomes invalid. + SharedAccessExpiryTime *date.Time `json:"signedExpiry,omitempty"` + // KeyToSign - The key to sign the account SAS token with. + KeyToSign *string `json:"keyToSign,omitempty"` +} + +// AccountsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountsClient) (Account, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountsCreateFuture.Result. +func (future *AccountsCreateFuture) result(client AccountsClient) (a Account, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + a.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storage.AccountsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { + a, err = client.CreateResponder(a.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsCreateFuture", "Result", a.Response.Response, "Failure responding to request") + } + } + return +} + +// AccountsFailoverFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountsFailoverFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountsFailoverFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountsFailoverFuture.Result. +func (future *AccountsFailoverFuture) result(client AccountsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsFailoverFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storage.AccountsFailoverFuture") + return + } + ar.Response = future.Response() + return +} + +// AccountsHierarchicalNamespaceMigrationFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type AccountsHierarchicalNamespaceMigrationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountsHierarchicalNamespaceMigrationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountsHierarchicalNamespaceMigrationFuture.Result. +func (future *AccountsHierarchicalNamespaceMigrationFuture) result(client AccountsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsHierarchicalNamespaceMigrationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storage.AccountsHierarchicalNamespaceMigrationFuture") + return + } + ar.Response = future.Response() + return +} + +// AccountSkuConversionStatus this defines the sku conversion status object for asynchronous sku +// conversions. +type AccountSkuConversionStatus struct { + // SkuConversionStatus - READ-ONLY; This property indicates the current sku conversion status. Possible values include: 'SkuConversionStatusInProgress', 'SkuConversionStatusSucceeded', 'SkuConversionStatusFailed' + SkuConversionStatus SkuConversionStatus `json:"skuConversionStatus,omitempty"` + // TargetSkuName - This property represents the target sku name to which the account sku is being converted asynchronously. Possible values include: 'SkuNameStandardLRS', 'SkuNameStandardGRS', 'SkuNameStandardRAGRS', 'SkuNameStandardZRS', 'SkuNamePremiumLRS', 'SkuNamePremiumZRS', 'SkuNameStandardGZRS', 'SkuNameStandardRAGZRS' + TargetSkuName SkuName `json:"targetSkuName,omitempty"` + // StartTime - READ-ONLY; This property represents the sku conversion start time. + StartTime *string `json:"startTime,omitempty"` + // EndTime - READ-ONLY; This property represents the sku conversion end time. + EndTime *string `json:"endTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountSkuConversionStatus. +func (ascs AccountSkuConversionStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ascs.TargetSkuName != "" { + objectMap["targetSkuName"] = ascs.TargetSkuName + } + return json.Marshal(objectMap) +} + +// AccountsRestoreBlobRangesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AccountsRestoreBlobRangesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountsClient) (BlobRestoreStatus, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountsRestoreBlobRangesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AccountsRestoreBlobRangesFuture.Result. +func (future *AccountsRestoreBlobRangesFuture) result(client AccountsClient) (brs BlobRestoreStatus, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsRestoreBlobRangesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + brs.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storage.AccountsRestoreBlobRangesFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if brs.Response.Response, err = future.GetResult(sender); err == nil && brs.Response.Response.StatusCode != http.StatusNoContent { + brs, err = client.RestoreBlobRangesResponder(brs.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.AccountsRestoreBlobRangesFuture", "Result", brs.Response.Response, "Failure responding to request") + } + } + return +} + +// AccountUpdateParameters the parameters that can be provided when updating the storage account +// properties. +type AccountUpdateParameters struct { + // Sku - Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. + Sku *Sku `json:"sku,omitempty"` + // Tags - Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. + Tags map[string]*string `json:"tags"` + // Identity - The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + // AccountPropertiesUpdateParameters - The parameters used when updating a storage account. + *AccountPropertiesUpdateParameters `json:"properties,omitempty"` + // Kind - Optional. Indicates the type of storage account. Currently only StorageV2 value supported by server. Possible values include: 'KindStorage', 'KindStorageV2', 'KindBlobStorage', 'KindFileStorage', 'KindBlockBlobStorage' + Kind Kind `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountUpdateParameters. +func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aup.Sku != nil { + objectMap["sku"] = aup.Sku + } + if aup.Tags != nil { + objectMap["tags"] = aup.Tags + } + if aup.Identity != nil { + objectMap["identity"] = aup.Identity + } + if aup.AccountPropertiesUpdateParameters != nil { + objectMap["properties"] = aup.AccountPropertiesUpdateParameters + } + if aup.Kind != "" { + objectMap["kind"] = aup.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccountUpdateParameters struct. +func (aup *AccountUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + aup.Sku = &sku + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + aup.Tags = tags + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + aup.Identity = &identity + } + case "properties": + if v != nil { + var accountPropertiesUpdateParameters AccountPropertiesUpdateParameters + err = json.Unmarshal(*v, &accountPropertiesUpdateParameters) + if err != nil { + return err + } + aup.AccountPropertiesUpdateParameters = &accountPropertiesUpdateParameters + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + aup.Kind = kind + } + } + } + + return nil +} + +// ActiveDirectoryProperties settings properties for Active Directory (AD). +type ActiveDirectoryProperties struct { + // DomainName - Specifies the primary domain that the AD DNS server is authoritative for. + DomainName *string `json:"domainName,omitempty"` + // NetBiosDomainName - Specifies the NetBIOS domain name. + NetBiosDomainName *string `json:"netBiosDomainName,omitempty"` + // ForestName - Specifies the Active Directory forest to get. + ForestName *string `json:"forestName,omitempty"` + // DomainGUID - Specifies the domain GUID. + DomainGUID *string `json:"domainGuid,omitempty"` + // DomainSid - Specifies the security identifier (SID). + DomainSid *string `json:"domainSid,omitempty"` + // AzureStorageSid - Specifies the security identifier (SID) for Azure Storage. + AzureStorageSid *string `json:"azureStorageSid,omitempty"` + // SamAccountName - Specifies the Active Directory SAMAccountName for Azure Storage. + SamAccountName *string `json:"samAccountName,omitempty"` + // AccountType - Specifies the Active Directory account type for Azure Storage. Possible values include: 'AccountTypeUser', 'AccountTypeComputer' + AccountType AccountType `json:"accountType,omitempty"` +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureFilesIdentityBasedAuthentication settings for Azure Files identity based authentication. +type AzureFilesIdentityBasedAuthentication struct { + // DirectoryServiceOptions - Indicates the directory service used. Possible values include: 'DirectoryServiceOptionsNone', 'DirectoryServiceOptionsAADDS', 'DirectoryServiceOptionsAD' + DirectoryServiceOptions DirectoryServiceOptions `json:"directoryServiceOptions,omitempty"` + // ActiveDirectoryProperties - Required if choose AD. + ActiveDirectoryProperties *ActiveDirectoryProperties `json:"activeDirectoryProperties,omitempty"` + // DefaultSharePermission - Default share permission for users using Kerberos authentication if RBAC role is not assigned. Possible values include: 'DefaultSharePermissionNone', 'DefaultSharePermissionStorageFileDataSmbShareReader', 'DefaultSharePermissionStorageFileDataSmbShareContributor', 'DefaultSharePermissionStorageFileDataSmbShareElevatedContributor' + DefaultSharePermission DefaultSharePermission `json:"defaultSharePermission,omitempty"` +} + +// BlobContainer properties of the blob container, including Id, resource name, resource type, Etag. +type BlobContainer struct { + autorest.Response `json:"-"` + // ContainerProperties - Properties of the blob container. + *ContainerProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BlobContainer. +func (bc BlobContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bc.ContainerProperties != nil { + objectMap["properties"] = bc.ContainerProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BlobContainer struct. +func (bc *BlobContainer) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var containerProperties ContainerProperties + err = json.Unmarshal(*v, &containerProperties) + if err != nil { + return err + } + bc.ContainerProperties = &containerProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + bc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bc.Type = &typeVar + } + } + } + + return nil +} + +// BlobContainersObjectLevelWormFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BlobContainersObjectLevelWormFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BlobContainersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BlobContainersObjectLevelWormFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BlobContainersObjectLevelWormFuture.Result. +func (future *BlobContainersObjectLevelWormFuture) result(client BlobContainersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.BlobContainersObjectLevelWormFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("storage.BlobContainersObjectLevelWormFuture") + return + } + ar.Response = future.Response() + return +} + +// BlobInventoryPolicy the storage account blob inventory policy. +type BlobInventoryPolicy struct { + autorest.Response `json:"-"` + // BlobInventoryPolicyProperties - Returns the storage account blob inventory policy rules. + *BlobInventoryPolicyProperties `json:"properties,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BlobInventoryPolicy. +func (bip BlobInventoryPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bip.BlobInventoryPolicyProperties != nil { + objectMap["properties"] = bip.BlobInventoryPolicyProperties + } + if bip.SystemData != nil { + objectMap["systemData"] = bip.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BlobInventoryPolicy struct. +func (bip *BlobInventoryPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var blobInventoryPolicyProperties BlobInventoryPolicyProperties + err = json.Unmarshal(*v, &blobInventoryPolicyProperties) + if err != nil { + return err + } + bip.BlobInventoryPolicyProperties = &blobInventoryPolicyProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + bip.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bip.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bip.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bip.Type = &typeVar + } + } + } + + return nil +} + +// BlobInventoryPolicyDefinition an object that defines the blob inventory rule. +type BlobInventoryPolicyDefinition struct { + // Filters - An object that defines the filter set. + Filters *BlobInventoryPolicyFilter `json:"filters,omitempty"` + // Format - This is a required field, it specifies the format for the inventory files. Possible values include: 'FormatCsv', 'FormatParquet' + Format Format `json:"format,omitempty"` + // Schedule - This is a required field. This field is used to schedule an inventory formation. Possible values include: 'ScheduleDaily', 'ScheduleWeekly' + Schedule Schedule `json:"schedule,omitempty"` + // ObjectType - This is a required field. This field specifies the scope of the inventory created either at the blob or container level. Possible values include: 'ObjectTypeBlob', 'ObjectTypeContainer' + ObjectType ObjectType `json:"objectType,omitempty"` + // SchemaFields - This is a required field. This field specifies the fields and properties of the object to be included in the inventory. The Schema field value 'Name' is always required. The valid values for this field for the 'Blob' definition.objectType include 'Name, Creation-Time, Last-Modified, Content-Length, Content-MD5, BlobType, AccessTier, AccessTierChangeTime, AccessTierInferred, Tags, Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl, Snapshot, VersionId, IsCurrentVersion, Metadata, LastAccessTime, Tags, Etag, ContentType, ContentEncoding, ContentLanguage, ContentCRC64, CacheControl, ContentDisposition, LeaseStatus, LeaseState, LeaseDuration, ServerEncrypted, Deleted, DeletionId, DeletedTime, RemainingRetentionDays, ImmutabilityPolicyUntilDate, ImmutabilityPolicyMode, LegalHold, CopyId, CopyStatus, CopySource, CopyProgress, CopyCompletionTime, CopyStatusDescription, CustomerProvidedKeySha256, RehydratePriority, ArchiveStatus, XmsBlobSequenceNumber, EncryptionScope, IncrementalCopy, TagCount'. For Blob object type schema field value 'DeletedTime' is applicable only for Hns enabled accounts. The valid values for 'Container' definition.objectType include 'Name, Last-Modified, Metadata, LeaseStatus, LeaseState, LeaseDuration, PublicAccess, HasImmutabilityPolicy, HasLegalHold, Etag, DefaultEncryptionScope, DenyEncryptionScopeOverride, ImmutableStorageWithVersioningEnabled, Deleted, Version, DeletedTime, RemainingRetentionDays'. Schema field values 'Expiry-Time, hdi_isfolder, Owner, Group, Permissions, Acl, DeletionId' are valid only for Hns enabled accounts.Schema field values 'Tags, TagCount' are only valid for Non-Hns accounts. + SchemaFields *[]string `json:"schemaFields,omitempty"` +} + +// BlobInventoryPolicyFilter an object that defines the blob inventory rule filter conditions. For 'Blob' +// definition.objectType all filter properties are applicable, 'blobTypes' is required and others are +// optional. For 'Container' definition.objectType only prefixMatch is applicable and is optional. +type BlobInventoryPolicyFilter struct { + // PrefixMatch - An array of strings with maximum 10 blob prefixes to be included in the inventory. + PrefixMatch *[]string `json:"prefixMatch,omitempty"` + // ExcludePrefix - An array of strings with maximum 10 blob prefixes to be excluded from the inventory. + ExcludePrefix *[]string `json:"excludePrefix,omitempty"` + // BlobTypes - An array of predefined enum values. Valid values include blockBlob, appendBlob, pageBlob. Hns accounts does not support pageBlobs. This field is required when definition.objectType property is set to 'Blob'. + BlobTypes *[]string `json:"blobTypes,omitempty"` + // IncludeBlobVersions - Includes blob versions in blob inventory when value is set to true. The definition.schemaFields values 'VersionId and IsCurrentVersion' are required if this property is set to true, else they must be excluded. + IncludeBlobVersions *bool `json:"includeBlobVersions,omitempty"` + // IncludeSnapshots - Includes blob snapshots in blob inventory when value is set to true. The definition.schemaFields value 'Snapshot' is required if this property is set to true, else it must be excluded. + IncludeSnapshots *bool `json:"includeSnapshots,omitempty"` + // IncludeDeleted - For 'Container' definition.objectType the definition.schemaFields must include 'Deleted, Version, DeletedTime and RemainingRetentionDays'. For 'Blob' definition.objectType and HNS enabled storage accounts the definition.schemaFields must include 'DeletionId, Deleted, DeletedTime and RemainingRetentionDays' and for Hns disabled accounts the definition.schemaFields must include 'Deleted and RemainingRetentionDays', else it must be excluded. + IncludeDeleted *bool `json:"includeDeleted,omitempty"` +} + +// BlobInventoryPolicyProperties the storage account blob inventory policy properties. +type BlobInventoryPolicyProperties struct { + // LastModifiedTime - READ-ONLY; Returns the last modified date and time of the blob inventory policy. + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + // Policy - The storage account blob inventory policy object. It is composed of policy rules. + Policy *BlobInventoryPolicySchema `json:"policy,omitempty"` +} + +// MarshalJSON is the custom marshaler for BlobInventoryPolicyProperties. +func (bipp BlobInventoryPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bipp.Policy != nil { + objectMap["policy"] = bipp.Policy + } + return json.Marshal(objectMap) +} + +// BlobInventoryPolicyRule an object that wraps the blob inventory rule. Each rule is uniquely defined by +// name. +type BlobInventoryPolicyRule struct { + // Enabled - Rule is enabled when set to true. + Enabled *bool `json:"enabled,omitempty"` + // Name - A rule name can contain any combination of alpha numeric characters. Rule name is case-sensitive. It must be unique within a policy. + Name *string `json:"name,omitempty"` + // Destination - Container name where blob inventory files are stored. Must be pre-created. + Destination *string `json:"destination,omitempty"` + // Definition - An object that defines the blob inventory policy rule. + Definition *BlobInventoryPolicyDefinition `json:"definition,omitempty"` +} + +// BlobInventoryPolicySchema the storage account blob inventory policy rules. +type BlobInventoryPolicySchema struct { + // Enabled - Policy is enabled if set to true. + Enabled *bool `json:"enabled,omitempty"` + // Destination - READ-ONLY; Deprecated Property from API version 2021-04-01 onwards, the required destination container name must be specified at the rule level 'policy.rule.destination' + Destination *string `json:"destination,omitempty"` + // Type - The valid value is Inventory + Type *string `json:"type,omitempty"` + // Rules - The storage account blob inventory policy rules. The rule is applied when it is enabled. + Rules *[]BlobInventoryPolicyRule `json:"rules,omitempty"` +} + +// MarshalJSON is the custom marshaler for BlobInventoryPolicySchema. +func (bips BlobInventoryPolicySchema) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bips.Enabled != nil { + objectMap["enabled"] = bips.Enabled + } + if bips.Type != nil { + objectMap["type"] = bips.Type + } + if bips.Rules != nil { + objectMap["rules"] = bips.Rules + } + return json.Marshal(objectMap) +} + +// BlobRestoreParameters blob restore parameters +type BlobRestoreParameters struct { + // TimeToRestore - Restore blob to the specified time. + TimeToRestore *date.Time `json:"timeToRestore,omitempty"` + // BlobRanges - Blob ranges to restore. + BlobRanges *[]BlobRestoreRange `json:"blobRanges,omitempty"` +} + +// BlobRestoreRange blob range +type BlobRestoreRange struct { + // StartRange - Blob start range. This is inclusive. Empty means account start. + StartRange *string `json:"startRange,omitempty"` + // EndRange - Blob end range. This is exclusive. Empty means account end. + EndRange *string `json:"endRange,omitempty"` +} + +// BlobRestoreStatus blob restore status. +type BlobRestoreStatus struct { + autorest.Response `json:"-"` + // Status - READ-ONLY; The status of blob restore progress. Possible values are: - InProgress: Indicates that blob restore is ongoing. - Complete: Indicates that blob restore has been completed successfully. - Failed: Indicates that blob restore is failed. Possible values include: 'BlobRestoreProgressStatusInProgress', 'BlobRestoreProgressStatusComplete', 'BlobRestoreProgressStatusFailed' + Status BlobRestoreProgressStatus `json:"status,omitempty"` + // FailureReason - READ-ONLY; Failure reason when blob restore is failed. + FailureReason *string `json:"failureReason,omitempty"` + // RestoreID - READ-ONLY; Id for tracking blob restore request. + RestoreID *string `json:"restoreId,omitempty"` + // Parameters - READ-ONLY; Blob restore request parameters. + Parameters *BlobRestoreParameters `json:"parameters,omitempty"` +} + +// MarshalJSON is the custom marshaler for BlobRestoreStatus. +func (brs BlobRestoreStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BlobServiceItems ... +type BlobServiceItems struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of blob services returned. + Value *[]BlobServiceProperties `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for BlobServiceItems. +func (bsi BlobServiceItems) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BlobServiceProperties the properties of a storage account’s Blob service. +type BlobServiceProperties struct { + autorest.Response `json:"-"` + // BlobServicePropertiesProperties - The properties of a storage account’s Blob service. + *BlobServicePropertiesProperties `json:"properties,omitempty"` + // Sku - READ-ONLY; Sku name and tier. + Sku *Sku `json:"sku,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BlobServiceProperties. +func (bsp BlobServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsp.BlobServicePropertiesProperties != nil { + objectMap["properties"] = bsp.BlobServicePropertiesProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BlobServiceProperties struct. +func (bsp *BlobServiceProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var blobServiceProperties BlobServicePropertiesProperties + err = json.Unmarshal(*v, &blobServiceProperties) + if err != nil { + return err + } + bsp.BlobServicePropertiesProperties = &blobServiceProperties + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + bsp.Sku = &sku + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bsp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bsp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bsp.Type = &typeVar + } + } + } + + return nil +} + +// BlobServicePropertiesProperties the properties of a storage account’s Blob service. +type BlobServicePropertiesProperties struct { + // Cors - Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service. + Cors *CorsRules `json:"cors,omitempty"` + // DefaultServiceVersion - DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions. + DefaultServiceVersion *string `json:"defaultServiceVersion,omitempty"` + // DeleteRetentionPolicy - The blob service properties for blob soft delete. + DeleteRetentionPolicy *DeleteRetentionPolicy `json:"deleteRetentionPolicy,omitempty"` + // IsVersioningEnabled - Versioning is enabled if set to true. + IsVersioningEnabled *bool `json:"isVersioningEnabled,omitempty"` + // AutomaticSnapshotPolicyEnabled - Deprecated in favor of isVersioningEnabled property. + AutomaticSnapshotPolicyEnabled *bool `json:"automaticSnapshotPolicyEnabled,omitempty"` + // ChangeFeed - The blob service properties for change feed events. + ChangeFeed *ChangeFeed `json:"changeFeed,omitempty"` + // RestorePolicy - The blob service properties for blob restore policy. + RestorePolicy *RestorePolicyProperties `json:"restorePolicy,omitempty"` + // ContainerDeleteRetentionPolicy - The blob service properties for container soft delete. + ContainerDeleteRetentionPolicy *DeleteRetentionPolicy `json:"containerDeleteRetentionPolicy,omitempty"` + // LastAccessTimeTrackingPolicy - The blob service property to configure last access time based tracking policy. + LastAccessTimeTrackingPolicy *LastAccessTimeTrackingPolicy `json:"lastAccessTimeTrackingPolicy,omitempty"` +} + +// ChangeFeed the blob service properties for change feed events. +type ChangeFeed struct { + // Enabled - Indicates whether change feed event logging is enabled for the Blob service. + Enabled *bool `json:"enabled,omitempty"` + // RetentionInDays - Indicates the duration of changeFeed retention in days. Minimum value is 1 day and maximum value is 146000 days (400 years). A null value indicates an infinite retention of the change feed. + RetentionInDays *int32 `json:"retentionInDays,omitempty"` +} + +// CheckNameAvailabilityResult the CheckNameAvailability operation response. +type CheckNameAvailabilityResult struct { + autorest.Response `json:"-"` + // NameAvailable - READ-ONLY; Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or is invalid and cannot be used. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - READ-ONLY; Gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: 'ReasonAccountNameInvalid', 'ReasonAlreadyExists' + Reason Reason `json:"reason,omitempty"` + // Message - READ-ONLY; Gets an error message explaining the Reason value in more detail. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckNameAvailabilityResult. +func (cnar CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CloudError an error response from the Storage service. +type CloudError struct { + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the Storage service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// ContainerProperties the properties of a container. +type ContainerProperties struct { + // Version - READ-ONLY; The version of the deleted blob container. + Version *string `json:"version,omitempty"` + // Deleted - READ-ONLY; Indicates whether the blob container was deleted. + Deleted *bool `json:"deleted,omitempty"` + // DeletedTime - READ-ONLY; Blob container deletion time. + DeletedTime *date.Time `json:"deletedTime,omitempty"` + // RemainingRetentionDays - READ-ONLY; Remaining retention days for soft deleted blob container. + RemainingRetentionDays *int32 `json:"remainingRetentionDays,omitempty"` + // DefaultEncryptionScope - Default the container to use specified encryption scope for all writes. + DefaultEncryptionScope *string `json:"defaultEncryptionScope,omitempty"` + // DenyEncryptionScopeOverride - Block override of encryption scope from the container default. + DenyEncryptionScopeOverride *bool `json:"denyEncryptionScopeOverride,omitempty"` + // PublicAccess - Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: 'PublicAccessContainer', 'PublicAccessBlob', 'PublicAccessNone' + PublicAccess PublicAccess `json:"publicAccess,omitempty"` + // LastModifiedTime - READ-ONLY; Returns the date and time the container was last modified. + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + // LeaseStatus - READ-ONLY; The lease status of the container. Possible values include: 'LeaseStatusLocked', 'LeaseStatusUnlocked' + LeaseStatus LeaseStatus `json:"leaseStatus,omitempty"` + // LeaseState - READ-ONLY; Lease state of the container. Possible values include: 'LeaseStateAvailable', 'LeaseStateLeased', 'LeaseStateExpired', 'LeaseStateBreaking', 'LeaseStateBroken' + LeaseState LeaseState `json:"leaseState,omitempty"` + // LeaseDuration - READ-ONLY; Specifies whether the lease on a container is of infinite or fixed duration, only when the container is leased. Possible values include: 'LeaseDurationInfinite', 'LeaseDurationFixed' + LeaseDuration LeaseDuration `json:"leaseDuration,omitempty"` + // Metadata - A name-value pair to associate with the container as metadata. + Metadata map[string]*string `json:"metadata"` + // ImmutabilityPolicy - READ-ONLY; The ImmutabilityPolicy property of the container. + ImmutabilityPolicy *ImmutabilityPolicyProperties `json:"immutabilityPolicy,omitempty"` + // LegalHold - READ-ONLY; The LegalHold property of the container. + LegalHold *LegalHoldProperties `json:"legalHold,omitempty"` + // HasLegalHold - READ-ONLY; The hasLegalHold public property is set to true by SRP if there are at least one existing tag. The hasLegalHold public property is set to false by SRP if all existing legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. + HasLegalHold *bool `json:"hasLegalHold,omitempty"` + // HasImmutabilityPolicy - READ-ONLY; The hasImmutabilityPolicy public property is set to true by SRP if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public property is set to false by SRP if ImmutabilityPolicy has not been created for this container. + HasImmutabilityPolicy *bool `json:"hasImmutabilityPolicy,omitempty"` + // ImmutableStorageWithVersioning - The object level immutability property of the container. The property is immutable and can only be set to true at the container creation time. Existing containers must undergo a migration process. + ImmutableStorageWithVersioning *ImmutableStorageWithVersioning `json:"immutableStorageWithVersioning,omitempty"` + // EnableNfsV3RootSquash - Enable NFSv3 root squash on blob container. + EnableNfsV3RootSquash *bool `json:"enableNfsV3RootSquash,omitempty"` + // EnableNfsV3AllSquash - Enable NFSv3 all squash on blob container. + EnableNfsV3AllSquash *bool `json:"enableNfsV3AllSquash,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerProperties. +func (cp ContainerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.DefaultEncryptionScope != nil { + objectMap["defaultEncryptionScope"] = cp.DefaultEncryptionScope + } + if cp.DenyEncryptionScopeOverride != nil { + objectMap["denyEncryptionScopeOverride"] = cp.DenyEncryptionScopeOverride + } + if cp.PublicAccess != "" { + objectMap["publicAccess"] = cp.PublicAccess + } + if cp.Metadata != nil { + objectMap["metadata"] = cp.Metadata + } + if cp.ImmutableStorageWithVersioning != nil { + objectMap["immutableStorageWithVersioning"] = cp.ImmutableStorageWithVersioning + } + if cp.EnableNfsV3RootSquash != nil { + objectMap["enableNfsV3RootSquash"] = cp.EnableNfsV3RootSquash + } + if cp.EnableNfsV3AllSquash != nil { + objectMap["enableNfsV3AllSquash"] = cp.EnableNfsV3AllSquash + } + return json.Marshal(objectMap) +} + +// CorsRule specifies a CORS rule for the Blob service. +type CorsRule struct { + // AllowedOrigins - Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains + AllowedOrigins *[]string `json:"allowedOrigins,omitempty"` + // AllowedMethods - Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin. + AllowedMethods *[]string `json:"allowedMethods,omitempty"` + // MaxAgeInSeconds - Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response. + MaxAgeInSeconds *int32 `json:"maxAgeInSeconds,omitempty"` + // ExposedHeaders - Required if CorsRule element is present. A list of response headers to expose to CORS clients. + ExposedHeaders *[]string `json:"exposedHeaders,omitempty"` + // AllowedHeaders - Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request. + AllowedHeaders *[]string `json:"allowedHeaders,omitempty"` +} + +// CorsRules sets the CORS rules. You can include up to five CorsRule elements in the request. +type CorsRules struct { + // CorsRules - The List of CORS rules. You can include up to five CorsRule elements in the request. + CorsRules *[]CorsRule `json:"corsRules,omitempty"` +} + +// CustomDomain the custom domain assigned to this storage account. This can be set via Update. +type CustomDomain struct { + // Name - Gets or sets the custom domain name assigned to the storage account. Name is the CNAME source. + Name *string `json:"name,omitempty"` + // UseSubDomainName - Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. + UseSubDomainName *bool `json:"useSubDomainName,omitempty"` +} + +// DateAfterCreation object to define snapshot and version action conditions. +type DateAfterCreation struct { + // DaysAfterCreationGreaterThan - Value indicating the age in days after creation + DaysAfterCreationGreaterThan *float64 `json:"daysAfterCreationGreaterThan,omitempty"` + // DaysAfterLastTierChangeGreaterThan - Value indicating the age in days after last blob tier change time. This property is only applicable for tierToArchive actions and requires daysAfterCreationGreaterThan to be set for snapshots and blob version based actions. The blob will be archived if both the conditions are satisfied. + DaysAfterLastTierChangeGreaterThan *float64 `json:"daysAfterLastTierChangeGreaterThan,omitempty"` +} + +// DateAfterModification object to define the base blob action conditions. Properties +// daysAfterModificationGreaterThan, daysAfterLastAccessTimeGreaterThan and daysAfterCreationGreaterThan +// are mutually exclusive. The daysAfterLastTierChangeGreaterThan property is only applicable for +// tierToArchive actions which requires daysAfterModificationGreaterThan to be set, also it cannot be used +// in conjunction with daysAfterLastAccessTimeGreaterThan or daysAfterCreationGreaterThan. +type DateAfterModification struct { + // DaysAfterModificationGreaterThan - Value indicating the age in days after last modification + DaysAfterModificationGreaterThan *float64 `json:"daysAfterModificationGreaterThan,omitempty"` + // DaysAfterLastAccessTimeGreaterThan - Value indicating the age in days after last blob access. This property can only be used in conjunction with last access time tracking policy + DaysAfterLastAccessTimeGreaterThan *float64 `json:"daysAfterLastAccessTimeGreaterThan,omitempty"` + // DaysAfterLastTierChangeGreaterThan - Value indicating the age in days after last blob tier change time. This property is only applicable for tierToArchive actions and requires daysAfterModificationGreaterThan to be set for baseBlobs based actions. The blob will be archived if both the conditions are satisfied. + DaysAfterLastTierChangeGreaterThan *float64 `json:"daysAfterLastTierChangeGreaterThan,omitempty"` + // DaysAfterCreationGreaterThan - Value indicating the age in days after blob creation. + DaysAfterCreationGreaterThan *float64 `json:"daysAfterCreationGreaterThan,omitempty"` +} + +// DeletedAccount deleted storage account +type DeletedAccount struct { + autorest.Response `json:"-"` + // DeletedAccountProperties - Properties of the deleted account. + *DeletedAccountProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeletedAccount. +func (da DeletedAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if da.DeletedAccountProperties != nil { + objectMap["properties"] = da.DeletedAccountProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DeletedAccount struct. +func (da *DeletedAccount) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var deletedAccountProperties DeletedAccountProperties + err = json.Unmarshal(*v, &deletedAccountProperties) + if err != nil { + return err + } + da.DeletedAccountProperties = &deletedAccountProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + da.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + da.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + da.Type = &typeVar + } + } + } + + return nil +} + +// DeletedAccountListResult the response from the List Deleted Accounts operation. +type DeletedAccountListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Gets the list of deleted accounts and their properties. + Value *[]DeletedAccount `json:"value,omitempty"` + // NextLink - READ-ONLY; Request URL that can be used to query next page of deleted accounts. Returned when total number of requested deleted accounts exceed maximum page size. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeletedAccountListResult. +func (dalr DeletedAccountListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DeletedAccountListResultIterator provides access to a complete listing of DeletedAccount values. +type DeletedAccountListResultIterator struct { + i int + page DeletedAccountListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeletedAccountListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedAccountListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DeletedAccountListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeletedAccountListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeletedAccountListResultIterator) Response() DeletedAccountListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeletedAccountListResultIterator) Value() DeletedAccount { + if !iter.page.NotDone() { + return DeletedAccount{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DeletedAccountListResultIterator type. +func NewDeletedAccountListResultIterator(page DeletedAccountListResultPage) DeletedAccountListResultIterator { + return DeletedAccountListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dalr DeletedAccountListResult) IsEmpty() bool { + return dalr.Value == nil || len(*dalr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dalr DeletedAccountListResult) hasNextLink() bool { + return dalr.NextLink != nil && len(*dalr.NextLink) != 0 +} + +// deletedAccountListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dalr DeletedAccountListResult) deletedAccountListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dalr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dalr.NextLink))) +} + +// DeletedAccountListResultPage contains a page of DeletedAccount values. +type DeletedAccountListResultPage struct { + fn func(context.Context, DeletedAccountListResult) (DeletedAccountListResult, error) + dalr DeletedAccountListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeletedAccountListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedAccountListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dalr) + if err != nil { + return err + } + page.dalr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DeletedAccountListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeletedAccountListResultPage) NotDone() bool { + return !page.dalr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeletedAccountListResultPage) Response() DeletedAccountListResult { + return page.dalr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeletedAccountListResultPage) Values() []DeletedAccount { + if page.dalr.IsEmpty() { + return nil + } + return *page.dalr.Value +} + +// Creates a new instance of the DeletedAccountListResultPage type. +func NewDeletedAccountListResultPage(cur DeletedAccountListResult, getNextPage func(context.Context, DeletedAccountListResult) (DeletedAccountListResult, error)) DeletedAccountListResultPage { + return DeletedAccountListResultPage{ + fn: getNextPage, + dalr: cur, + } +} + +// DeletedAccountProperties attributes of a deleted storage account. +type DeletedAccountProperties struct { + // StorageAccountResourceID - READ-ONLY; Full resource id of the original storage account. + StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"` + // Location - READ-ONLY; Location of the deleted account. + Location *string `json:"location,omitempty"` + // RestoreReference - READ-ONLY; Can be used to attempt recovering this deleted account via PutStorageAccount API. + RestoreReference *string `json:"restoreReference,omitempty"` + // CreationTime - READ-ONLY; Creation time of the deleted account. + CreationTime *string `json:"creationTime,omitempty"` + // DeletionTime - READ-ONLY; Deletion time of the deleted account. + DeletionTime *string `json:"deletionTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeletedAccountProperties. +func (dap DeletedAccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DeletedShare the deleted share to be restored. +type DeletedShare struct { + // DeletedShareName - Required. Identify the name of the deleted share that will be restored. + DeletedShareName *string `json:"deletedShareName,omitempty"` + // DeletedShareVersion - Required. Identify the version of the deleted share that will be restored. + DeletedShareVersion *string `json:"deletedShareVersion,omitempty"` +} + +// DeleteRetentionPolicy the service properties for soft delete. +type DeleteRetentionPolicy struct { + // Enabled - Indicates whether DeleteRetentionPolicy is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Days - Indicates the number of days that the deleted item should be retained. The minimum specified value can be 1 and the maximum value can be 365. + Days *int32 `json:"days,omitempty"` + // AllowPermanentDelete - This property when set to true allows deletion of the soft deleted blob versions and snapshots. This property cannot be used blob restore policy. This property only applies to blob service and does not apply to containers or file share. + AllowPermanentDelete *bool `json:"allowPermanentDelete,omitempty"` +} + +// Dimension dimension of blobs, possibly be blob type or access tier. +type Dimension struct { + // Name - Display name of dimension. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of dimension. + DisplayName *string `json:"displayName,omitempty"` +} + +// Encryption the encryption settings on the storage account. +type Encryption struct { + // Services - List of services which support encryption. + Services *EncryptionServices `json:"services,omitempty"` + // KeySource - The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Storage, Microsoft.Keyvault. Possible values include: 'KeySourceMicrosoftStorage', 'KeySourceMicrosoftKeyvault' + KeySource KeySource `json:"keySource,omitempty"` + // RequireInfrastructureEncryption - A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest. + RequireInfrastructureEncryption *bool `json:"requireInfrastructureEncryption,omitempty"` + // KeyVaultProperties - Properties provided by key vault. + KeyVaultProperties *KeyVaultProperties `json:"keyvaultproperties,omitempty"` + // EncryptionIdentity - The identity to be used with service-side encryption at rest. + EncryptionIdentity *EncryptionIdentity `json:"identity,omitempty"` +} + +// EncryptionIdentity encryption identity for the storage account. +type EncryptionIdentity struct { + // EncryptionUserAssignedIdentity - Resource identifier of the UserAssigned identity to be associated with server-side encryption on the storage account. + EncryptionUserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` + // EncryptionFederatedIdentityClientID - ClientId of the multi-tenant application to be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys server-side encryption on the storage account. + EncryptionFederatedIdentityClientID *string `json:"federatedIdentityClientId,omitempty"` +} + +// EncryptionScope the Encryption Scope resource. +type EncryptionScope struct { + autorest.Response `json:"-"` + // EncryptionScopeProperties - Properties of the encryption scope. + *EncryptionScopeProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EncryptionScope. +func (es EncryptionScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if es.EncryptionScopeProperties != nil { + objectMap["properties"] = es.EncryptionScopeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EncryptionScope struct. +func (es *EncryptionScope) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var encryptionScopeProperties EncryptionScopeProperties + err = json.Unmarshal(*v, &encryptionScopeProperties) + if err != nil { + return err + } + es.EncryptionScopeProperties = &encryptionScopeProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + es.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + es.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + es.Type = &typeVar + } + } + } + + return nil +} + +// EncryptionScopeKeyVaultProperties the key vault properties for the encryption scope. This is a required +// field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. +type EncryptionScopeKeyVaultProperties struct { + // KeyURI - The object identifier for a key vault key object. When applied, the encryption scope will use the key referenced by the identifier to enable customer-managed key support on this encryption scope. + KeyURI *string `json:"keyUri,omitempty"` + // CurrentVersionedKeyIdentifier - READ-ONLY; The object identifier of the current versioned Key Vault Key in use. + CurrentVersionedKeyIdentifier *string `json:"currentVersionedKeyIdentifier,omitempty"` + // LastKeyRotationTimestamp - READ-ONLY; Timestamp of last rotation of the Key Vault Key. + LastKeyRotationTimestamp *date.Time `json:"lastKeyRotationTimestamp,omitempty"` +} + +// MarshalJSON is the custom marshaler for EncryptionScopeKeyVaultProperties. +func (eskvp EncryptionScopeKeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if eskvp.KeyURI != nil { + objectMap["keyUri"] = eskvp.KeyURI + } + return json.Marshal(objectMap) +} + +// EncryptionScopeListResult list of encryption scopes requested, and if paging is required, a URL to the +// next page of encryption scopes. +type EncryptionScopeListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of encryption scopes requested. + Value *[]EncryptionScope `json:"value,omitempty"` + // NextLink - READ-ONLY; Request URL that can be used to query next page of encryption scopes. Returned when total number of requested encryption scopes exceeds the maximum page size. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for EncryptionScopeListResult. +func (eslr EncryptionScopeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EncryptionScopeListResultIterator provides access to a complete listing of EncryptionScope values. +type EncryptionScopeListResultIterator struct { + i int + page EncryptionScopeListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EncryptionScopeListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionScopeListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EncryptionScopeListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EncryptionScopeListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EncryptionScopeListResultIterator) Response() EncryptionScopeListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EncryptionScopeListResultIterator) Value() EncryptionScope { + if !iter.page.NotDone() { + return EncryptionScope{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EncryptionScopeListResultIterator type. +func NewEncryptionScopeListResultIterator(page EncryptionScopeListResultPage) EncryptionScopeListResultIterator { + return EncryptionScopeListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (eslr EncryptionScopeListResult) IsEmpty() bool { + return eslr.Value == nil || len(*eslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (eslr EncryptionScopeListResult) hasNextLink() bool { + return eslr.NextLink != nil && len(*eslr.NextLink) != 0 +} + +// encryptionScopeListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (eslr EncryptionScopeListResult) encryptionScopeListResultPreparer(ctx context.Context) (*http.Request, error) { + if !eslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(eslr.NextLink))) +} + +// EncryptionScopeListResultPage contains a page of EncryptionScope values. +type EncryptionScopeListResultPage struct { + fn func(context.Context, EncryptionScopeListResult) (EncryptionScopeListResult, error) + eslr EncryptionScopeListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EncryptionScopeListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EncryptionScopeListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.eslr) + if err != nil { + return err + } + page.eslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EncryptionScopeListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EncryptionScopeListResultPage) NotDone() bool { + return !page.eslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EncryptionScopeListResultPage) Response() EncryptionScopeListResult { + return page.eslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EncryptionScopeListResultPage) Values() []EncryptionScope { + if page.eslr.IsEmpty() { + return nil + } + return *page.eslr.Value +} + +// Creates a new instance of the EncryptionScopeListResultPage type. +func NewEncryptionScopeListResultPage(cur EncryptionScopeListResult, getNextPage func(context.Context, EncryptionScopeListResult) (EncryptionScopeListResult, error)) EncryptionScopeListResultPage { + return EncryptionScopeListResultPage{ + fn: getNextPage, + eslr: cur, + } +} + +// EncryptionScopeProperties properties of the encryption scope. +type EncryptionScopeProperties struct { + // Source - The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. Possible values include: 'EncryptionScopeSourceMicrosoftStorage', 'EncryptionScopeSourceMicrosoftKeyVault' + Source EncryptionScopeSource `json:"source,omitempty"` + // State - The state of the encryption scope. Possible values (case-insensitive): Enabled, Disabled. Possible values include: 'EncryptionScopeStateEnabled', 'EncryptionScopeStateDisabled' + State EncryptionScopeState `json:"state,omitempty"` + // CreationTime - READ-ONLY; Gets the creation date and time of the encryption scope in UTC. + CreationTime *date.Time `json:"creationTime,omitempty"` + // LastModifiedTime - READ-ONLY; Gets the last modification date and time of the encryption scope in UTC. + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + // KeyVaultProperties - The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. + KeyVaultProperties *EncryptionScopeKeyVaultProperties `json:"keyVaultProperties,omitempty"` + // RequireInfrastructureEncryption - A boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest. + RequireInfrastructureEncryption *bool `json:"requireInfrastructureEncryption,omitempty"` +} + +// MarshalJSON is the custom marshaler for EncryptionScopeProperties. +func (esp EncryptionScopeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if esp.Source != "" { + objectMap["source"] = esp.Source + } + if esp.State != "" { + objectMap["state"] = esp.State + } + if esp.KeyVaultProperties != nil { + objectMap["keyVaultProperties"] = esp.KeyVaultProperties + } + if esp.RequireInfrastructureEncryption != nil { + objectMap["requireInfrastructureEncryption"] = esp.RequireInfrastructureEncryption + } + return json.Marshal(objectMap) +} + +// EncryptionService a service that allows server-side encryption to be used. +type EncryptionService struct { + // Enabled - A boolean indicating whether or not the service encrypts the data as it is stored. Encryption at rest is enabled by default today and cannot be disabled. + Enabled *bool `json:"enabled,omitempty"` + // LastEnabledTime - READ-ONLY; Gets a rough estimate of the date/time when the encryption was last enabled by the user. Data is encrypted at rest by default today and cannot be disabled. + LastEnabledTime *date.Time `json:"lastEnabledTime,omitempty"` + // KeyType - Encryption key type to be used for the encryption service. 'Account' key type implies that an account-scoped encryption key will be used. 'Service' key type implies that a default service key is used. Possible values include: 'KeyTypeService', 'KeyTypeAccount' + KeyType KeyType `json:"keyType,omitempty"` +} + +// MarshalJSON is the custom marshaler for EncryptionService. +func (es EncryptionService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if es.Enabled != nil { + objectMap["enabled"] = es.Enabled + } + if es.KeyType != "" { + objectMap["keyType"] = es.KeyType + } + return json.Marshal(objectMap) +} + +// EncryptionServices a list of services that support encryption. +type EncryptionServices struct { + // Blob - The encryption function of the blob storage service. + Blob *EncryptionService `json:"blob,omitempty"` + // File - The encryption function of the file storage service. + File *EncryptionService `json:"file,omitempty"` + // Table - The encryption function of the table storage service. + Table *EncryptionService `json:"table,omitempty"` + // Queue - The encryption function of the queue storage service. + Queue *EncryptionService `json:"queue,omitempty"` +} + +// Endpoints the URIs that are used to perform a retrieval of a public blob, queue, table, web or dfs +// object. +type Endpoints struct { + // Blob - READ-ONLY; Gets the blob endpoint. + Blob *string `json:"blob,omitempty"` + // Queue - READ-ONLY; Gets the queue endpoint. + Queue *string `json:"queue,omitempty"` + // Table - READ-ONLY; Gets the table endpoint. + Table *string `json:"table,omitempty"` + // File - READ-ONLY; Gets the file endpoint. + File *string `json:"file,omitempty"` + // Web - READ-ONLY; Gets the web endpoint. + Web *string `json:"web,omitempty"` + // Dfs - READ-ONLY; Gets the dfs endpoint. + Dfs *string `json:"dfs,omitempty"` + // MicrosoftEndpoints - Gets the microsoft routing storage endpoints. + MicrosoftEndpoints *AccountMicrosoftEndpoints `json:"microsoftEndpoints,omitempty"` + // InternetEndpoints - Gets the internet routing storage endpoints + InternetEndpoints *AccountInternetEndpoints `json:"internetEndpoints,omitempty"` +} + +// MarshalJSON is the custom marshaler for Endpoints. +func (e Endpoints) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.MicrosoftEndpoints != nil { + objectMap["microsoftEndpoints"] = e.MicrosoftEndpoints + } + if e.InternetEndpoints != nil { + objectMap["internetEndpoints"] = e.InternetEndpoints + } + return json.Marshal(objectMap) +} + +// ErrorResponse an error response from the storage resource provider. +type ErrorResponse struct { + // Error - Azure Storage Resource Provider error response body. + Error *ErrorResponseBody `json:"error,omitempty"` +} + +// ErrorResponseBody error response body contract. +type ErrorResponseBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` +} + +// ExtendedLocation the complex type of the extended location. +type ExtendedLocation struct { + // Name - The name of the extended location. + Name *string `json:"name,omitempty"` + // Type - The type of the extended location. Possible values include: 'ExtendedLocationTypesEdgeZone' + Type ExtendedLocationTypes `json:"type,omitempty"` +} + +// FileServiceItems ... +type FileServiceItems struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of file services returned. + Value *[]FileServiceProperties `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for FileServiceItems. +func (fsi FileServiceItems) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FileServiceProperties the properties of File services in storage account. +type FileServiceProperties struct { + autorest.Response `json:"-"` + // FileServicePropertiesProperties - The properties of File services in storage account. + *FileServicePropertiesProperties `json:"properties,omitempty"` + // Sku - READ-ONLY; Sku name and tier. + Sku *Sku `json:"sku,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for FileServiceProperties. +func (fsp FileServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fsp.FileServicePropertiesProperties != nil { + objectMap["properties"] = fsp.FileServicePropertiesProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FileServiceProperties struct. +func (fsp *FileServiceProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var fileServiceProperties FileServicePropertiesProperties + err = json.Unmarshal(*v, &fileServiceProperties) + if err != nil { + return err + } + fsp.FileServicePropertiesProperties = &fileServiceProperties + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + fsp.Sku = &sku + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fsp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fsp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fsp.Type = &typeVar + } + } + } + + return nil +} + +// FileServicePropertiesProperties the properties of File services in storage account. +type FileServicePropertiesProperties struct { + // Cors - Specifies CORS rules for the File service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the File service. + Cors *CorsRules `json:"cors,omitempty"` + // ShareDeleteRetentionPolicy - The file service properties for share soft delete. + ShareDeleteRetentionPolicy *DeleteRetentionPolicy `json:"shareDeleteRetentionPolicy,omitempty"` + // ProtocolSettings - Protocol settings for file service + ProtocolSettings *ProtocolSettings `json:"protocolSettings,omitempty"` +} + +// FileShare properties of the file share, including Id, resource name, resource type, Etag. +type FileShare struct { + autorest.Response `json:"-"` + // FileShareProperties - Properties of the file share. + *FileShareProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for FileShare. +func (fs FileShare) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fs.FileShareProperties != nil { + objectMap["properties"] = fs.FileShareProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FileShare struct. +func (fs *FileShare) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var fileShareProperties FileShareProperties + err = json.Unmarshal(*v, &fileShareProperties) + if err != nil { + return err + } + fs.FileShareProperties = &fileShareProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + fs.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fs.Type = &typeVar + } + } + } + + return nil +} + +// FileShareItem the file share properties be listed out. +type FileShareItem struct { + // FileShareProperties - The file share properties be listed out. + *FileShareProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for FileShareItem. +func (fsi FileShareItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fsi.FileShareProperties != nil { + objectMap["properties"] = fsi.FileShareProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FileShareItem struct. +func (fsi *FileShareItem) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var fileShareProperties FileShareProperties + err = json.Unmarshal(*v, &fileShareProperties) + if err != nil { + return err + } + fsi.FileShareProperties = &fileShareProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + fsi.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fsi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fsi.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fsi.Type = &typeVar + } + } + } + + return nil +} + +// FileShareItems response schema. Contains list of shares returned, and if paging is requested or +// required, a URL to next page of shares. +type FileShareItems struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of file shares returned. + Value *[]FileShareItem `json:"value,omitempty"` + // NextLink - READ-ONLY; Request URL that can be used to query next page of shares. Returned when total number of requested shares exceed maximum page size. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for FileShareItems. +func (fsi FileShareItems) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FileShareItemsIterator provides access to a complete listing of FileShareItem values. +type FileShareItemsIterator struct { + i int + page FileShareItemsPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *FileShareItemsIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FileShareItemsIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *FileShareItemsIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FileShareItemsIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter FileShareItemsIterator) Response() FileShareItems { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter FileShareItemsIterator) Value() FileShareItem { + if !iter.page.NotDone() { + return FileShareItem{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FileShareItemsIterator type. +func NewFileShareItemsIterator(page FileShareItemsPage) FileShareItemsIterator { + return FileShareItemsIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (fsi FileShareItems) IsEmpty() bool { + return fsi.Value == nil || len(*fsi.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (fsi FileShareItems) hasNextLink() bool { + return fsi.NextLink != nil && len(*fsi.NextLink) != 0 +} + +// fileShareItemsPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (fsi FileShareItems) fileShareItemsPreparer(ctx context.Context) (*http.Request, error) { + if !fsi.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(fsi.NextLink))) +} + +// FileShareItemsPage contains a page of FileShareItem values. +type FileShareItemsPage struct { + fn func(context.Context, FileShareItems) (FileShareItems, error) + fsi FileShareItems +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *FileShareItemsPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FileShareItemsPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.fsi) + if err != nil { + return err + } + page.fsi = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *FileShareItemsPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FileShareItemsPage) NotDone() bool { + return !page.fsi.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FileShareItemsPage) Response() FileShareItems { + return page.fsi +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FileShareItemsPage) Values() []FileShareItem { + if page.fsi.IsEmpty() { + return nil + } + return *page.fsi.Value +} + +// Creates a new instance of the FileShareItemsPage type. +func NewFileShareItemsPage(cur FileShareItems, getNextPage func(context.Context, FileShareItems) (FileShareItems, error)) FileShareItemsPage { + return FileShareItemsPage{ + fn: getNextPage, + fsi: cur, + } +} + +// FileShareProperties the properties of the file share. +type FileShareProperties struct { + // LastModifiedTime - READ-ONLY; Returns the date and time the share was last modified. + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + // Metadata - A name-value pair to associate with the share as metadata. + Metadata map[string]*string `json:"metadata"` + // ShareQuota - The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. + ShareQuota *int32 `json:"shareQuota,omitempty"` + // EnabledProtocols - The authentication protocol that is used for the file share. Can only be specified when creating a share. Possible values include: 'EnabledProtocolsSMB', 'EnabledProtocolsNFS' + EnabledProtocols EnabledProtocols `json:"enabledProtocols,omitempty"` + // RootSquash - The property is for NFS share only. The default is NoRootSquash. Possible values include: 'RootSquashTypeNoRootSquash', 'RootSquashTypeRootSquash', 'RootSquashTypeAllSquash' + RootSquash RootSquashType `json:"rootSquash,omitempty"` + // Version - READ-ONLY; The version of the share. + Version *string `json:"version,omitempty"` + // Deleted - READ-ONLY; Indicates whether the share was deleted. + Deleted *bool `json:"deleted,omitempty"` + // DeletedTime - READ-ONLY; The deleted time if the share was deleted. + DeletedTime *date.Time `json:"deletedTime,omitempty"` + // RemainingRetentionDays - READ-ONLY; Remaining retention days for share that was soft deleted. + RemainingRetentionDays *int32 `json:"remainingRetentionDays,omitempty"` + // AccessTier - Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Possible values include: 'ShareAccessTierTransactionOptimized', 'ShareAccessTierHot', 'ShareAccessTierCool', 'ShareAccessTierPremium' + AccessTier ShareAccessTier `json:"accessTier,omitempty"` + // AccessTierChangeTime - READ-ONLY; Indicates the last modification time for share access tier. + AccessTierChangeTime *date.Time `json:"accessTierChangeTime,omitempty"` + // AccessTierStatus - READ-ONLY; Indicates if there is a pending transition for access tier. + AccessTierStatus *string `json:"accessTierStatus,omitempty"` + // ShareUsageBytes - READ-ONLY; The approximate size of the data stored on the share. Note that this value may not include all recently created or recently resized files. + ShareUsageBytes *int64 `json:"shareUsageBytes,omitempty"` + // LeaseStatus - READ-ONLY; The lease status of the share. Possible values include: 'LeaseStatusLocked', 'LeaseStatusUnlocked' + LeaseStatus LeaseStatus `json:"leaseStatus,omitempty"` + // LeaseState - READ-ONLY; Lease state of the share. Possible values include: 'LeaseStateAvailable', 'LeaseStateLeased', 'LeaseStateExpired', 'LeaseStateBreaking', 'LeaseStateBroken' + LeaseState LeaseState `json:"leaseState,omitempty"` + // LeaseDuration - READ-ONLY; Specifies whether the lease on a share is of infinite or fixed duration, only when the share is leased. Possible values include: 'LeaseDurationInfinite', 'LeaseDurationFixed' + LeaseDuration LeaseDuration `json:"leaseDuration,omitempty"` + // SignedIdentifiers - List of stored access policies specified on the share. + SignedIdentifiers *[]SignedIdentifier `json:"signedIdentifiers,omitempty"` + // SnapshotTime - READ-ONLY; Creation time of share snapshot returned in the response of list shares with expand param "snapshots". + SnapshotTime *date.Time `json:"snapshotTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for FileShareProperties. +func (fsp FileShareProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fsp.Metadata != nil { + objectMap["metadata"] = fsp.Metadata + } + if fsp.ShareQuota != nil { + objectMap["shareQuota"] = fsp.ShareQuota + } + if fsp.EnabledProtocols != "" { + objectMap["enabledProtocols"] = fsp.EnabledProtocols + } + if fsp.RootSquash != "" { + objectMap["rootSquash"] = fsp.RootSquash + } + if fsp.AccessTier != "" { + objectMap["accessTier"] = fsp.AccessTier + } + if fsp.SignedIdentifiers != nil { + objectMap["signedIdentifiers"] = fsp.SignedIdentifiers + } + return json.Marshal(objectMap) +} + +// GeoReplicationStats statistics related to replication for storage account's Blob, Table, Queue and File +// services. It is only available when geo-redundant replication is enabled for the storage account. +type GeoReplicationStats struct { + // Status - READ-ONLY; The status of the secondary location. Possible values are: - Live: Indicates that the secondary location is active and operational. - Bootstrap: Indicates initial synchronization from the primary location to the secondary location is in progress.This typically occurs when replication is first enabled. - Unavailable: Indicates that the secondary location is temporarily unavailable. Possible values include: 'GeoReplicationStatusLive', 'GeoReplicationStatusBootstrap', 'GeoReplicationStatusUnavailable' + Status GeoReplicationStatus `json:"status,omitempty"` + // LastSyncTime - READ-ONLY; All primary writes preceding this UTC date/time value are guaranteed to be available for read operations. Primary writes following this point in time may or may not be available for reads. Element may be default value if value of LastSyncTime is not available, this can happen if secondary is offline or we are in bootstrap. + LastSyncTime *date.Time `json:"lastSyncTime,omitempty"` + // CanFailover - READ-ONLY; A boolean flag which indicates whether or not account failover is supported for the account. + CanFailover *bool `json:"canFailover,omitempty"` +} + +// MarshalJSON is the custom marshaler for GeoReplicationStats. +func (grs GeoReplicationStats) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Identity identity for the resource. +type Identity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'IdentityTypeNone', 'IdentityTypeSystemAssigned', 'IdentityTypeUserAssigned', 'IdentityTypeSystemAssignedUserAssigned' + Type IdentityType `json:"type,omitempty"` + // UserAssignedIdentities - Gets or sets a list of key value pairs that describe the set of User Assigned identities that will be used with this storage account. The key is the ARM resource identifier of the identity. Only 1 User Assigned identity is permitted here. + UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + if i.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = i.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// ImmutabilityPolicy the ImmutabilityPolicy property of a blob container, including Id, resource name, +// resource type, Etag. +type ImmutabilityPolicy struct { + autorest.Response `json:"-"` + // ImmutabilityPolicyProperty - The properties of an ImmutabilityPolicy of a blob container. + *ImmutabilityPolicyProperty `json:"properties,omitempty"` + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImmutabilityPolicy. +func (IP ImmutabilityPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if IP.ImmutabilityPolicyProperty != nil { + objectMap["properties"] = IP.ImmutabilityPolicyProperty + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ImmutabilityPolicy struct. +func (IP *ImmutabilityPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var immutabilityPolicyProperty ImmutabilityPolicyProperty + err = json.Unmarshal(*v, &immutabilityPolicyProperty) + if err != nil { + return err + } + IP.ImmutabilityPolicyProperty = &immutabilityPolicyProperty + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + IP.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + IP.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + IP.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + IP.Type = &typeVar + } + } + } + + return nil +} + +// ImmutabilityPolicyProperties the properties of an ImmutabilityPolicy of a blob container. +type ImmutabilityPolicyProperties struct { + // ImmutabilityPolicyProperty - The properties of an ImmutabilityPolicy of a blob container. + *ImmutabilityPolicyProperty `json:"properties,omitempty"` + // Etag - READ-ONLY; ImmutabilityPolicy Etag. + Etag *string `json:"etag,omitempty"` + // UpdateHistory - READ-ONLY; The ImmutabilityPolicy update history of the blob container. + UpdateHistory *[]UpdateHistoryProperty `json:"updateHistory,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImmutabilityPolicyProperties. +func (ipp ImmutabilityPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ipp.ImmutabilityPolicyProperty != nil { + objectMap["properties"] = ipp.ImmutabilityPolicyProperty + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ImmutabilityPolicyProperties struct. +func (ipp *ImmutabilityPolicyProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var immutabilityPolicyProperty ImmutabilityPolicyProperty + err = json.Unmarshal(*v, &immutabilityPolicyProperty) + if err != nil { + return err + } + ipp.ImmutabilityPolicyProperty = &immutabilityPolicyProperty + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ipp.Etag = &etag + } + case "updateHistory": + if v != nil { + var updateHistory []UpdateHistoryProperty + err = json.Unmarshal(*v, &updateHistory) + if err != nil { + return err + } + ipp.UpdateHistory = &updateHistory + } + } + } + + return nil +} + +// ImmutabilityPolicyProperty the properties of an ImmutabilityPolicy of a blob container. +type ImmutabilityPolicyProperty struct { + // ImmutabilityPeriodSinceCreationInDays - The immutability period for the blobs in the container since the policy creation, in days. + ImmutabilityPeriodSinceCreationInDays *int32 `json:"immutabilityPeriodSinceCreationInDays,omitempty"` + // State - READ-ONLY; The ImmutabilityPolicy state of a blob container, possible values include: Locked and Unlocked. Possible values include: 'ImmutabilityPolicyStateLocked', 'ImmutabilityPolicyStateUnlocked' + State ImmutabilityPolicyState `json:"state,omitempty"` + // AllowProtectedAppendWrites - This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. + AllowProtectedAppendWrites *bool `json:"allowProtectedAppendWrites,omitempty"` + // AllowProtectedAppendWritesAll - This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock Blobs' while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and 'allowProtectedAppendWritesAll' properties are mutually exclusive. + AllowProtectedAppendWritesAll *bool `json:"allowProtectedAppendWritesAll,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImmutabilityPolicyProperty. +func (ipp ImmutabilityPolicyProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ipp.ImmutabilityPeriodSinceCreationInDays != nil { + objectMap["immutabilityPeriodSinceCreationInDays"] = ipp.ImmutabilityPeriodSinceCreationInDays + } + if ipp.AllowProtectedAppendWrites != nil { + objectMap["allowProtectedAppendWrites"] = ipp.AllowProtectedAppendWrites + } + if ipp.AllowProtectedAppendWritesAll != nil { + objectMap["allowProtectedAppendWritesAll"] = ipp.AllowProtectedAppendWritesAll + } + return json.Marshal(objectMap) +} + +// ImmutableStorageAccount this property enables and defines account-level immutability. Enabling the +// feature auto-enables Blob Versioning. +type ImmutableStorageAccount struct { + // Enabled - A boolean flag which enables account-level immutability. All the containers under such an account have object-level immutability enabled by default. + Enabled *bool `json:"enabled,omitempty"` + // ImmutabilityPolicy - Specifies the default account-level immutability policy which is inherited and applied to objects that do not possess an explicit immutability policy at the object level. The object-level immutability policy has higher precedence than the container-level immutability policy, which has a higher precedence than the account-level immutability policy. + ImmutabilityPolicy *AccountImmutabilityPolicyProperties `json:"immutabilityPolicy,omitempty"` +} + +// ImmutableStorageWithVersioning object level immutability properties of the container. +type ImmutableStorageWithVersioning struct { + // Enabled - This is an immutable property, when set to true it enables object level immutability at the container level. + Enabled *bool `json:"enabled,omitempty"` + // TimeStamp - READ-ONLY; Returns the date and time the object level immutability was enabled. + TimeStamp *date.Time `json:"timeStamp,omitempty"` + // MigrationState - READ-ONLY; This property denotes the container level immutability to object level immutability migration state. Possible values include: 'MigrationStateInProgress', 'MigrationStateCompleted' + MigrationState MigrationState `json:"migrationState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImmutableStorageWithVersioning. +func (iswv ImmutableStorageWithVersioning) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if iswv.Enabled != nil { + objectMap["enabled"] = iswv.Enabled + } + return json.Marshal(objectMap) +} + +// IPRule IP rule with specific IP or IP range in CIDR format. +type IPRule struct { + // IPAddressOrRange - Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. + IPAddressOrRange *string `json:"value,omitempty"` + // Action - The action of IP ACL rule. Possible values include: 'ActionAllow' + Action Action `json:"action,omitempty"` +} + +// KeyCreationTime storage account keys creation time. +type KeyCreationTime struct { + Key1 *date.Time `json:"key1,omitempty"` + Key2 *date.Time `json:"key2,omitempty"` +} + +// KeyPolicy keyPolicy assigned to the storage account. +type KeyPolicy struct { + // KeyExpirationPeriodInDays - The key expiration period in days. + KeyExpirationPeriodInDays *int32 `json:"keyExpirationPeriodInDays,omitempty"` +} + +// KeyVaultProperties properties of key vault. +type KeyVaultProperties struct { + // KeyName - The name of KeyVault key. + KeyName *string `json:"keyname,omitempty"` + // KeyVersion - The version of KeyVault key. + KeyVersion *string `json:"keyversion,omitempty"` + // KeyVaultURI - The Uri of KeyVault. + KeyVaultURI *string `json:"keyvaulturi,omitempty"` + // CurrentVersionedKeyIdentifier - READ-ONLY; The object identifier of the current versioned Key Vault Key in use. + CurrentVersionedKeyIdentifier *string `json:"currentVersionedKeyIdentifier,omitempty"` + // LastKeyRotationTimestamp - READ-ONLY; Timestamp of last rotation of the Key Vault Key. + LastKeyRotationTimestamp *date.Time `json:"lastKeyRotationTimestamp,omitempty"` + // CurrentVersionedKeyExpirationTimestamp - READ-ONLY; This is a read only property that represents the expiration time of the current version of the customer managed key used for encryption. + CurrentVersionedKeyExpirationTimestamp *date.Time `json:"currentVersionedKeyExpirationTimestamp,omitempty"` +} + +// MarshalJSON is the custom marshaler for KeyVaultProperties. +func (kvp KeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kvp.KeyName != nil { + objectMap["keyname"] = kvp.KeyName + } + if kvp.KeyVersion != nil { + objectMap["keyversion"] = kvp.KeyVersion + } + if kvp.KeyVaultURI != nil { + objectMap["keyvaulturi"] = kvp.KeyVaultURI + } + return json.Marshal(objectMap) +} + +// LastAccessTimeTrackingPolicy the blob service properties for Last access time based tracking policy. +type LastAccessTimeTrackingPolicy struct { + // Enable - When set to true last access time based tracking is enabled. + Enable *bool `json:"enable,omitempty"` + // Name - Name of the policy. The valid value is AccessTimeTracking. This field is currently read only. Possible values include: 'NameAccessTimeTracking' + Name Name `json:"name,omitempty"` + // TrackingGranularityInDays - The field specifies blob object tracking granularity in days, typically how often the blob object should be tracked.This field is currently read only with value as 1 + TrackingGranularityInDays *int32 `json:"trackingGranularityInDays,omitempty"` + // BlobType - An array of predefined supported blob types. Only blockBlob is the supported value. This field is currently read only + BlobType *[]string `json:"blobType,omitempty"` +} + +// LeaseContainerRequest lease Container request schema. +type LeaseContainerRequest struct { + // Action - Specifies the lease action. Can be one of the available actions. Possible values include: 'Action1Acquire', 'Action1Renew', 'Action1Change', 'Action1Release', 'Action1Break' + Action Action1 `json:"action,omitempty"` + // LeaseID - Identifies the lease. Can be specified in any valid GUID string format. + LeaseID *string `json:"leaseId,omitempty"` + // BreakPeriod - Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. + BreakPeriod *int32 `json:"breakPeriod,omitempty"` + // LeaseDuration - Required for acquire. Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. + LeaseDuration *int32 `json:"leaseDuration,omitempty"` + // ProposedLeaseID - Optional for acquire, required for change. Proposed lease ID, in a GUID string format. + ProposedLeaseID *string `json:"proposedLeaseId,omitempty"` +} + +// LeaseContainerResponse lease Container response schema. +type LeaseContainerResponse struct { + autorest.Response `json:"-"` + // LeaseID - Returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release the lease. + LeaseID *string `json:"leaseId,omitempty"` + // LeaseTimeSeconds - Approximate time remaining in the lease period, in seconds. + LeaseTimeSeconds *string `json:"leaseTimeSeconds,omitempty"` +} + +// LeaseShareRequest lease Share request schema. +type LeaseShareRequest struct { + // Action - Specifies the lease action. Can be one of the available actions. Possible values include: 'LeaseShareActionAcquire', 'LeaseShareActionRenew', 'LeaseShareActionChange', 'LeaseShareActionRelease', 'LeaseShareActionBreak' + Action LeaseShareAction `json:"action,omitempty"` + // LeaseID - Identifies the lease. Can be specified in any valid GUID string format. + LeaseID *string `json:"leaseId,omitempty"` + // BreakPeriod - Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. + BreakPeriod *int32 `json:"breakPeriod,omitempty"` + // LeaseDuration - Required for acquire. Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. + LeaseDuration *int32 `json:"leaseDuration,omitempty"` + // ProposedLeaseID - Optional for acquire, required for change. Proposed lease ID, in a GUID string format. + ProposedLeaseID *string `json:"proposedLeaseId,omitempty"` +} + +// LeaseShareResponse lease Share response schema. +type LeaseShareResponse struct { + autorest.Response `json:"-"` + // LeaseID - Returned unique lease ID that must be included with any request to delete the share, or to renew, change, or release the lease. + LeaseID *string `json:"leaseId,omitempty"` + // LeaseTimeSeconds - Approximate time remaining in the lease period, in seconds. + LeaseTimeSeconds *string `json:"leaseTimeSeconds,omitempty"` +} + +// LegalHold the LegalHold property of a blob container. +type LegalHold struct { + autorest.Response `json:"-"` + // HasLegalHold - READ-ONLY; The hasLegalHold public property is set to true by SRP if there are at least one existing tag. The hasLegalHold public property is set to false by SRP if all existing legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. + HasLegalHold *bool `json:"hasLegalHold,omitempty"` + // Tags - Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. + Tags *[]string `json:"tags,omitempty"` + // AllowProtectedAppendWritesAll - When enabled, new blocks can be written to both 'Append and Bock Blobs' while maintaining legal hold protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. + AllowProtectedAppendWritesAll *bool `json:"allowProtectedAppendWritesAll,omitempty"` +} + +// MarshalJSON is the custom marshaler for LegalHold. +func (lh LegalHold) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lh.Tags != nil { + objectMap["tags"] = lh.Tags + } + if lh.AllowProtectedAppendWritesAll != nil { + objectMap["allowProtectedAppendWritesAll"] = lh.AllowProtectedAppendWritesAll + } + return json.Marshal(objectMap) +} + +// LegalHoldProperties the LegalHold property of a blob container. +type LegalHoldProperties struct { + // HasLegalHold - READ-ONLY; The hasLegalHold public property is set to true by SRP if there are at least one existing tag. The hasLegalHold public property is set to false by SRP if all existing legal hold tags are cleared out. There can be a maximum of 1000 blob containers with hasLegalHold=true for a given account. + HasLegalHold *bool `json:"hasLegalHold,omitempty"` + // Tags - The list of LegalHold tags of a blob container. + Tags *[]TagProperty `json:"tags,omitempty"` + // ProtectedAppendWritesHistory - Protected append blob writes history. + ProtectedAppendWritesHistory *ProtectedAppendWritesHistory `json:"protectedAppendWritesHistory,omitempty"` +} + +// MarshalJSON is the custom marshaler for LegalHoldProperties. +func (lhp LegalHoldProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lhp.Tags != nil { + objectMap["tags"] = lhp.Tags + } + if lhp.ProtectedAppendWritesHistory != nil { + objectMap["protectedAppendWritesHistory"] = lhp.ProtectedAppendWritesHistory + } + return json.Marshal(objectMap) +} + +// ListAccountSasResponse the List SAS credentials operation response. +type ListAccountSasResponse struct { + autorest.Response `json:"-"` + // AccountSasToken - READ-ONLY; List SAS credentials of storage account. + AccountSasToken *string `json:"accountSasToken,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListAccountSasResponse. +func (lasr ListAccountSasResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ListBlobInventoryPolicy list of blob inventory policies returned. +type ListBlobInventoryPolicy struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of blob inventory policies. + Value *[]BlobInventoryPolicy `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListBlobInventoryPolicy. +func (lbip ListBlobInventoryPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ListContainerItem the blob container properties be listed out. +type ListContainerItem struct { + // ContainerProperties - The blob container properties be listed out. + *ContainerProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListContainerItem. +func (lci ListContainerItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lci.ContainerProperties != nil { + objectMap["properties"] = lci.ContainerProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ListContainerItem struct. +func (lci *ListContainerItem) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var containerProperties ContainerProperties + err = json.Unmarshal(*v, &containerProperties) + if err != nil { + return err + } + lci.ContainerProperties = &containerProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lci.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lci.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lci.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lci.Type = &typeVar + } + } + } + + return nil +} + +// ListContainerItems response schema. Contains list of blobs returned, and if paging is requested or +// required, a URL to next page of containers. +type ListContainerItems struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of blobs containers returned. + Value *[]ListContainerItem `json:"value,omitempty"` + // NextLink - READ-ONLY; Request URL that can be used to query next page of containers. Returned when total number of requested containers exceed maximum page size. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListContainerItems. +func (lci ListContainerItems) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ListContainerItemsIterator provides access to a complete listing of ListContainerItem values. +type ListContainerItemsIterator struct { + i int + page ListContainerItemsPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListContainerItemsIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListContainerItemsIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListContainerItemsIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListContainerItemsIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListContainerItemsIterator) Response() ListContainerItems { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListContainerItemsIterator) Value() ListContainerItem { + if !iter.page.NotDone() { + return ListContainerItem{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListContainerItemsIterator type. +func NewListContainerItemsIterator(page ListContainerItemsPage) ListContainerItemsIterator { + return ListContainerItemsIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lci ListContainerItems) IsEmpty() bool { + return lci.Value == nil || len(*lci.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lci ListContainerItems) hasNextLink() bool { + return lci.NextLink != nil && len(*lci.NextLink) != 0 +} + +// listContainerItemsPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lci ListContainerItems) listContainerItemsPreparer(ctx context.Context) (*http.Request, error) { + if !lci.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lci.NextLink))) +} + +// ListContainerItemsPage contains a page of ListContainerItem values. +type ListContainerItemsPage struct { + fn func(context.Context, ListContainerItems) (ListContainerItems, error) + lci ListContainerItems +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListContainerItemsPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListContainerItemsPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lci) + if err != nil { + return err + } + page.lci = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListContainerItemsPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListContainerItemsPage) NotDone() bool { + return !page.lci.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListContainerItemsPage) Response() ListContainerItems { + return page.lci +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListContainerItemsPage) Values() []ListContainerItem { + if page.lci.IsEmpty() { + return nil + } + return *page.lci.Value +} + +// Creates a new instance of the ListContainerItemsPage type. +func NewListContainerItemsPage(cur ListContainerItems, getNextPage func(context.Context, ListContainerItems) (ListContainerItems, error)) ListContainerItemsPage { + return ListContainerItemsPage{ + fn: getNextPage, + lci: cur, + } +} + +// ListQueue ... +type ListQueue struct { + // ListQueueProperties - List Queue resource properties. + *ListQueueProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListQueue. +func (lq ListQueue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lq.ListQueueProperties != nil { + objectMap["properties"] = lq.ListQueueProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ListQueue struct. +func (lq *ListQueue) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var queueProperties ListQueueProperties + err = json.Unmarshal(*v, &queueProperties) + if err != nil { + return err + } + lq.ListQueueProperties = &queueProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lq.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lq.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lq.Type = &typeVar + } + } + } + + return nil +} + +// ListQueueProperties ... +type ListQueueProperties struct { + // Metadata - A name-value pair that represents queue metadata. + Metadata map[string]*string `json:"metadata"` +} + +// MarshalJSON is the custom marshaler for ListQueueProperties. +func (lqp ListQueueProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lqp.Metadata != nil { + objectMap["metadata"] = lqp.Metadata + } + return json.Marshal(objectMap) +} + +// ListQueueResource response schema. Contains list of queues returned +type ListQueueResource struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of queues returned. + Value *[]ListQueue `json:"value,omitempty"` + // NextLink - READ-ONLY; Request URL that can be used to list next page of queues + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListQueueResource. +func (lqr ListQueueResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ListQueueResourceIterator provides access to a complete listing of ListQueue values. +type ListQueueResourceIterator struct { + i int + page ListQueueResourcePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListQueueResourceIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListQueueResourceIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListQueueResourceIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListQueueResourceIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListQueueResourceIterator) Response() ListQueueResource { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListQueueResourceIterator) Value() ListQueue { + if !iter.page.NotDone() { + return ListQueue{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListQueueResourceIterator type. +func NewListQueueResourceIterator(page ListQueueResourcePage) ListQueueResourceIterator { + return ListQueueResourceIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lqr ListQueueResource) IsEmpty() bool { + return lqr.Value == nil || len(*lqr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lqr ListQueueResource) hasNextLink() bool { + return lqr.NextLink != nil && len(*lqr.NextLink) != 0 +} + +// listQueueResourcePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lqr ListQueueResource) listQueueResourcePreparer(ctx context.Context) (*http.Request, error) { + if !lqr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lqr.NextLink))) +} + +// ListQueueResourcePage contains a page of ListQueue values. +type ListQueueResourcePage struct { + fn func(context.Context, ListQueueResource) (ListQueueResource, error) + lqr ListQueueResource +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListQueueResourcePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListQueueResourcePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lqr) + if err != nil { + return err + } + page.lqr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListQueueResourcePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListQueueResourcePage) NotDone() bool { + return !page.lqr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListQueueResourcePage) Response() ListQueueResource { + return page.lqr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListQueueResourcePage) Values() []ListQueue { + if page.lqr.IsEmpty() { + return nil + } + return *page.lqr.Value +} + +// Creates a new instance of the ListQueueResourcePage type. +func NewListQueueResourcePage(cur ListQueueResource, getNextPage func(context.Context, ListQueueResource) (ListQueueResource, error)) ListQueueResourcePage { + return ListQueueResourcePage{ + fn: getNextPage, + lqr: cur, + } +} + +// ListQueueServices ... +type ListQueueServices struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of queue services returned. + Value *[]QueueServiceProperties `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListQueueServices. +func (lqs ListQueueServices) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ListServiceSasResponse the List service SAS credentials operation response. +type ListServiceSasResponse struct { + autorest.Response `json:"-"` + // ServiceSasToken - READ-ONLY; List service SAS credentials of specific resource. + ServiceSasToken *string `json:"serviceSasToken,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListServiceSasResponse. +func (lssr ListServiceSasResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ListTableResource response schema. Contains list of tables returned +type ListTableResource struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of tables returned. + Value *[]Table `json:"value,omitempty"` + // NextLink - READ-ONLY; Request URL that can be used to query next page of tables + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListTableResource. +func (ltr ListTableResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ListTableResourceIterator provides access to a complete listing of Table values. +type ListTableResourceIterator struct { + i int + page ListTableResourcePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListTableResourceIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListTableResourceIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListTableResourceIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListTableResourceIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListTableResourceIterator) Response() ListTableResource { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListTableResourceIterator) Value() Table { + if !iter.page.NotDone() { + return Table{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListTableResourceIterator type. +func NewListTableResourceIterator(page ListTableResourcePage) ListTableResourceIterator { + return ListTableResourceIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ltr ListTableResource) IsEmpty() bool { + return ltr.Value == nil || len(*ltr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ltr ListTableResource) hasNextLink() bool { + return ltr.NextLink != nil && len(*ltr.NextLink) != 0 +} + +// listTableResourcePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ltr ListTableResource) listTableResourcePreparer(ctx context.Context) (*http.Request, error) { + if !ltr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ltr.NextLink))) +} + +// ListTableResourcePage contains a page of Table values. +type ListTableResourcePage struct { + fn func(context.Context, ListTableResource) (ListTableResource, error) + ltr ListTableResource +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListTableResourcePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListTableResourcePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ltr) + if err != nil { + return err + } + page.ltr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListTableResourcePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListTableResourcePage) NotDone() bool { + return !page.ltr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListTableResourcePage) Response() ListTableResource { + return page.ltr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListTableResourcePage) Values() []Table { + if page.ltr.IsEmpty() { + return nil + } + return *page.ltr.Value +} + +// Creates a new instance of the ListTableResourcePage type. +func NewListTableResourcePage(cur ListTableResource, getNextPage func(context.Context, ListTableResource) (ListTableResource, error)) ListTableResourcePage { + return ListTableResourcePage{ + fn: getNextPage, + ltr: cur, + } +} + +// ListTableServices ... +type ListTableServices struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of table services returned. + Value *[]TableServiceProperties `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListTableServices. +func (lts ListTableServices) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// LocalUser the local user associated with the storage accounts. +type LocalUser struct { + autorest.Response `json:"-"` + // LocalUserProperties - Storage account local user properties. + *LocalUserProperties `json:"properties,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for LocalUser. +func (lu LocalUser) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lu.LocalUserProperties != nil { + objectMap["properties"] = lu.LocalUserProperties + } + if lu.SystemData != nil { + objectMap["systemData"] = lu.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LocalUser struct. +func (lu *LocalUser) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var localUserProperties LocalUserProperties + err = json.Unmarshal(*v, &localUserProperties) + if err != nil { + return err + } + lu.LocalUserProperties = &localUserProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + lu.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lu.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lu.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lu.Type = &typeVar + } + } + } + + return nil +} + +// LocalUserKeys the Storage Account Local User keys. +type LocalUserKeys struct { + autorest.Response `json:"-"` + SSHAuthorizedKeys *[]SSHPublicKey `json:"sshAuthorizedKeys,omitempty"` + SharedKey *string `json:"sharedKey,omitempty"` +} + +// LocalUserProperties the Storage Account Local User properties. +type LocalUserProperties struct { + // PermissionScopes - The permission scopes of the local user. + PermissionScopes *[]PermissionScope `json:"permissionScopes,omitempty"` + // HomeDirectory - Optional, local user home directory. + HomeDirectory *string `json:"homeDirectory,omitempty"` + SSHAuthorizedKeys *[]SSHPublicKey `json:"sshAuthorizedKeys,omitempty"` + // Sid - READ-ONLY; A unique Security Identifier that is generated by the server. + Sid *string `json:"sid,omitempty"` + // HasSharedKey - Indicates whether shared key exists. Set it to false to remove existing shared key. + HasSharedKey *bool `json:"hasSharedKey,omitempty"` + // HasSSHKey - Indicates whether ssh key exists. Set it to false to remove existing SSH key. + HasSSHKey *bool `json:"hasSshKey,omitempty"` + // HasSSHPassword - Indicates whether ssh password exists. Set it to false to remove existing SSH password. + HasSSHPassword *bool `json:"hasSshPassword,omitempty"` +} + +// MarshalJSON is the custom marshaler for LocalUserProperties. +func (lup LocalUserProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lup.PermissionScopes != nil { + objectMap["permissionScopes"] = lup.PermissionScopes + } + if lup.HomeDirectory != nil { + objectMap["homeDirectory"] = lup.HomeDirectory + } + if lup.SSHAuthorizedKeys != nil { + objectMap["sshAuthorizedKeys"] = lup.SSHAuthorizedKeys + } + if lup.HasSharedKey != nil { + objectMap["hasSharedKey"] = lup.HasSharedKey + } + if lup.HasSSHKey != nil { + objectMap["hasSshKey"] = lup.HasSSHKey + } + if lup.HasSSHPassword != nil { + objectMap["hasSshPassword"] = lup.HasSSHPassword + } + return json.Marshal(objectMap) +} + +// LocalUserRegeneratePasswordResult the secrets of Storage Account Local User. +type LocalUserRegeneratePasswordResult struct { + autorest.Response `json:"-"` + // SSHPassword - READ-ONLY; Auto generated password by the server for SSH authentication if hasSshPassword is set to true on the creation of local user. + SSHPassword *string `json:"sshPassword,omitempty"` +} + +// MarshalJSON is the custom marshaler for LocalUserRegeneratePasswordResult. +func (lurpr LocalUserRegeneratePasswordResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// LocalUsers list storage account local users. +type LocalUsers struct { + autorest.Response `json:"-"` + // Value - The local users associated with the storage account. + Value *[]LocalUser `json:"value,omitempty"` +} + +// ManagementPolicy the Get Storage Account ManagementPolicies operation response. +type ManagementPolicy struct { + autorest.Response `json:"-"` + // ManagementPolicyProperties - Returns the Storage Account Data Policies Rules. + *ManagementPolicyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagementPolicy. +func (mp ManagementPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mp.ManagementPolicyProperties != nil { + objectMap["properties"] = mp.ManagementPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagementPolicy struct. +func (mp *ManagementPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managementPolicyProperties ManagementPolicyProperties + err = json.Unmarshal(*v, &managementPolicyProperties) + if err != nil { + return err + } + mp.ManagementPolicyProperties = &managementPolicyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mp.Type = &typeVar + } + } + } + + return nil +} + +// ManagementPolicyAction actions are applied to the filtered blobs when the execution condition is met. +type ManagementPolicyAction struct { + // BaseBlob - The management policy action for base blob + BaseBlob *ManagementPolicyBaseBlob `json:"baseBlob,omitempty"` + // Snapshot - The management policy action for snapshot + Snapshot *ManagementPolicySnapShot `json:"snapshot,omitempty"` + // Version - The management policy action for version + Version *ManagementPolicyVersion `json:"version,omitempty"` +} + +// ManagementPolicyBaseBlob management policy action for base blob. +type ManagementPolicyBaseBlob struct { + // TierToCool - The function to tier blobs to cool storage. Support blobs currently at Hot tier + TierToCool *DateAfterModification `json:"tierToCool,omitempty"` + // TierToArchive - The function to tier blobs to archive storage. Support blobs currently at Hot or Cool tier + TierToArchive *DateAfterModification `json:"tierToArchive,omitempty"` + // Delete - The function to delete the blob + Delete *DateAfterModification `json:"delete,omitempty"` + // EnableAutoTierToHotFromCool - This property enables auto tiering of a blob from cool to hot on a blob access. This property requires tierToCool.daysAfterLastAccessTimeGreaterThan. + EnableAutoTierToHotFromCool *bool `json:"enableAutoTierToHotFromCool,omitempty"` +} + +// ManagementPolicyDefinition an object that defines the Lifecycle rule. Each definition is made up with a +// filters set and an actions set. +type ManagementPolicyDefinition struct { + // Actions - An object that defines the action set. + Actions *ManagementPolicyAction `json:"actions,omitempty"` + // Filters - An object that defines the filter set. + Filters *ManagementPolicyFilter `json:"filters,omitempty"` +} + +// ManagementPolicyFilter filters limit rule actions to a subset of blobs within the storage account. If +// multiple filters are defined, a logical AND is performed on all filters. +type ManagementPolicyFilter struct { + // PrefixMatch - An array of strings for prefixes to be match. + PrefixMatch *[]string `json:"prefixMatch,omitempty"` + // BlobTypes - An array of predefined enum values. Currently blockBlob supports all tiering and delete actions. Only delete actions are supported for appendBlob. + BlobTypes *[]string `json:"blobTypes,omitempty"` + // BlobIndexMatch - An array of blob index tag based filters, there can be at most 10 tag filters + BlobIndexMatch *[]TagFilter `json:"blobIndexMatch,omitempty"` +} + +// ManagementPolicyProperties the Storage Account ManagementPolicy properties. +type ManagementPolicyProperties struct { + // LastModifiedTime - READ-ONLY; Returns the date and time the ManagementPolicies was last modified. + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + // Policy - The Storage Account ManagementPolicy, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + Policy *ManagementPolicySchema `json:"policy,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagementPolicyProperties. +func (mpp ManagementPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mpp.Policy != nil { + objectMap["policy"] = mpp.Policy + } + return json.Marshal(objectMap) +} + +// ManagementPolicyRule an object that wraps the Lifecycle rule. Each rule is uniquely defined by name. +type ManagementPolicyRule struct { + // Enabled - Rule is enabled if set to true. + Enabled *bool `json:"enabled,omitempty"` + // Name - A rule name can contain any combination of alpha numeric characters. Rule name is case-sensitive. It must be unique within a policy. + Name *string `json:"name,omitempty"` + // Type - The valid value is Lifecycle + Type *string `json:"type,omitempty"` + // Definition - An object that defines the Lifecycle rule. + Definition *ManagementPolicyDefinition `json:"definition,omitempty"` +} + +// ManagementPolicySchema the Storage Account ManagementPolicies Rules. See more details in: +// https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. +type ManagementPolicySchema struct { + // Rules - The Storage Account ManagementPolicies Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + Rules *[]ManagementPolicyRule `json:"rules,omitempty"` +} + +// ManagementPolicySnapShot management policy action for snapshot. +type ManagementPolicySnapShot struct { + // TierToCool - The function to tier blob snapshot to cool storage. Support blob snapshot currently at Hot tier + TierToCool *DateAfterCreation `json:"tierToCool,omitempty"` + // TierToArchive - The function to tier blob snapshot to archive storage. Support blob snapshot currently at Hot or Cool tier + TierToArchive *DateAfterCreation `json:"tierToArchive,omitempty"` + // Delete - The function to delete the blob snapshot + Delete *DateAfterCreation `json:"delete,omitempty"` +} + +// ManagementPolicyVersion management policy action for blob version. +type ManagementPolicyVersion struct { + // TierToCool - The function to tier blob version to cool storage. Support blob version currently at Hot tier + TierToCool *DateAfterCreation `json:"tierToCool,omitempty"` + // TierToArchive - The function to tier blob version to archive storage. Support blob version currently at Hot or Cool tier + TierToArchive *DateAfterCreation `json:"tierToArchive,omitempty"` + // Delete - The function to delete the blob version + Delete *DateAfterCreation `json:"delete,omitempty"` +} + +// MetricSpecification metric specification of operation. +type MetricSpecification struct { + // Name - Name of metric specification. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of metric specification. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Display description of metric specification. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - Unit could be Bytes or Count. + Unit *string `json:"unit,omitempty"` + // Dimensions - Dimensions of blobs, including blob type and access tier. + Dimensions *[]Dimension `json:"dimensions,omitempty"` + // AggregationType - Aggregation type could be Average. + AggregationType *string `json:"aggregationType,omitempty"` + // FillGapWithZero - The property to decide fill gap with zero or not. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // Category - The category this metric specification belong to, could be Capacity. + Category *string `json:"category,omitempty"` + // ResourceIDDimensionNameOverride - Account Resource Id. + ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` +} + +// Multichannel multichannel setting. Applies to Premium FileStorage only. +type Multichannel struct { + // Enabled - Indicates whether multichannel is enabled + Enabled *bool `json:"enabled,omitempty"` +} + +// NetworkRuleSet network rule set +type NetworkRuleSet struct { + // Bypass - Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any combination of Logging|Metrics|AzureServices (For example, "Logging, Metrics"), or None to bypass none of those traffics. Possible values include: 'BypassNone', 'BypassLogging', 'BypassMetrics', 'BypassAzureServices' + Bypass Bypass `json:"bypass,omitempty"` + // ResourceAccessRules - Sets the resource access rules + ResourceAccessRules *[]ResourceAccessRule `json:"resourceAccessRules,omitempty"` + // VirtualNetworkRules - Sets the virtual network rules + VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` + // IPRules - Sets the IP ACL rules + IPRules *[]IPRule `json:"ipRules,omitempty"` + // DefaultAction - Specifies the default action of allow or deny when no other rules match. Possible values include: 'DefaultActionAllow', 'DefaultActionDeny' + DefaultAction DefaultAction `json:"defaultAction,omitempty"` +} + +// ObjectReplicationPolicies list storage account object replication policies. +type ObjectReplicationPolicies struct { + autorest.Response `json:"-"` + // Value - The replication policy between two storage accounts. + Value *[]ObjectReplicationPolicy `json:"value,omitempty"` +} + +// ObjectReplicationPolicy the replication policy between two storage accounts. Multiple rules can be +// defined in one policy. +type ObjectReplicationPolicy struct { + autorest.Response `json:"-"` + // ObjectReplicationPolicyProperties - Returns the Storage Account Object Replication Policy. + *ObjectReplicationPolicyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ObjectReplicationPolicy. +func (orp ObjectReplicationPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if orp.ObjectReplicationPolicyProperties != nil { + objectMap["properties"] = orp.ObjectReplicationPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ObjectReplicationPolicy struct. +func (orp *ObjectReplicationPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var objectReplicationPolicyProperties ObjectReplicationPolicyProperties + err = json.Unmarshal(*v, &objectReplicationPolicyProperties) + if err != nil { + return err + } + orp.ObjectReplicationPolicyProperties = &objectReplicationPolicyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + orp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + orp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + orp.Type = &typeVar + } + } + } + + return nil +} + +// ObjectReplicationPolicyFilter filters limit replication to a subset of blobs within the storage account. +// A logical OR is performed on values in the filter. If multiple filters are defined, a logical AND is +// performed on all filters. +type ObjectReplicationPolicyFilter struct { + // PrefixMatch - Optional. Filters the results to replicate only blobs whose names begin with the specified prefix. + PrefixMatch *[]string `json:"prefixMatch,omitempty"` + // MinCreationTime - Blobs created after the time will be replicated to the destination. It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z + MinCreationTime *string `json:"minCreationTime,omitempty"` +} + +// ObjectReplicationPolicyProperties the Storage Account ObjectReplicationPolicy properties. +type ObjectReplicationPolicyProperties struct { + // PolicyID - READ-ONLY; A unique id for object replication policy. + PolicyID *string `json:"policyId,omitempty"` + // EnabledTime - READ-ONLY; Indicates when the policy is enabled on the source account. + EnabledTime *date.Time `json:"enabledTime,omitempty"` + // SourceAccount - Required. Source account name. It should be full resource id if allowCrossTenantReplication set to false. + SourceAccount *string `json:"sourceAccount,omitempty"` + // DestinationAccount - Required. Destination account name. It should be full resource id if allowCrossTenantReplication set to false. + DestinationAccount *string `json:"destinationAccount,omitempty"` + // Rules - The storage account object replication rules. + Rules *[]ObjectReplicationPolicyRule `json:"rules,omitempty"` +} + +// MarshalJSON is the custom marshaler for ObjectReplicationPolicyProperties. +func (orpp ObjectReplicationPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if orpp.SourceAccount != nil { + objectMap["sourceAccount"] = orpp.SourceAccount + } + if orpp.DestinationAccount != nil { + objectMap["destinationAccount"] = orpp.DestinationAccount + } + if orpp.Rules != nil { + objectMap["rules"] = orpp.Rules + } + return json.Marshal(objectMap) +} + +// ObjectReplicationPolicyRule the replication policy rule between two containers. +type ObjectReplicationPolicyRule struct { + // RuleID - Rule Id is auto-generated for each new rule on destination account. It is required for put policy on source account. + RuleID *string `json:"ruleId,omitempty"` + // SourceContainer - Required. Source container name. + SourceContainer *string `json:"sourceContainer,omitempty"` + // DestinationContainer - Required. Destination container name. + DestinationContainer *string `json:"destinationContainer,omitempty"` + // Filters - Optional. An object that defines the filter set. + Filters *ObjectReplicationPolicyFilter `json:"filters,omitempty"` +} + +// Operation storage REST API operation definition. +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - The origin of operations. + Origin *string `json:"origin,omitempty"` + // OperationProperties - Properties of operation, include metric specifications. + *OperationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Name != nil { + objectMap["name"] = o.Name + } + if o.Display != nil { + objectMap["display"] = o.Display + } + if o.Origin != nil { + objectMap["origin"] = o.Origin + } + if o.OperationProperties != nil { + objectMap["properties"] = o.OperationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Operation struct. +func (o *Operation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o.Name = &name + } + case "display": + if v != nil { + var display OperationDisplay + err = json.Unmarshal(*v, &display) + if err != nil { + return err + } + o.Display = &display + } + case "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + o.Origin = &origin + } + case "properties": + if v != nil { + var operationProperties OperationProperties + err = json.Unmarshal(*v, &operationProperties) + if err != nil { + return err + } + o.OperationProperties = &operationProperties + } + } + } + + return nil +} + +// OperationDisplay display metadata associated with the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft Storage. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed etc. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of the operation. + Description *string `json:"description,omitempty"` +} + +// OperationListResult result of the request to list Storage operations. It contains a list of operations +// and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of Storage operations supported by the Storage resource provider. + Value *[]Operation `json:"value,omitempty"` +} + +// OperationProperties properties of operation, include metric specifications. +type OperationProperties struct { + // ServiceSpecification - One property of operation, include metric specifications. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// PermissionScope ... +type PermissionScope struct { + // Permissions - The permissions for the local user. Possible values include: Read (r), Write (w), Delete (d), List (l), and Create (c). + Permissions *string `json:"permissions,omitempty"` + // Service - The service used by the local user, e.g. blob, file. + Service *string `json:"service,omitempty"` + // ResourceName - The name of resource, normally the container name or the file share name, used by the local user. + ResourceName *string `json:"resourceName,omitempty"` +} + +// PrivateEndpoint the Private Endpoint resource. +type PrivateEndpoint struct { + // ID - READ-ONLY; The ARM identifier for Private Endpoint + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpoint. +func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnection the Private Endpoint Connection resource. +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // PrivateEndpointConnectionProperties - Resource properties. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + } + } + + return nil +} + +// PrivateEndpointConnectionListResult list of private endpoint connection associated with the specified +// storage account +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - Array of private endpoint connections + Value *[]PrivateEndpointConnection `json:"value,omitempty"` +} + +// PrivateEndpointConnectionProperties properties of the PrivateEndpointConnectProperties. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - The resource of private end point. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - The provisioning state of the private endpoint connection resource. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' + ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} + +// PrivateLinkResource a private link resource +type PrivateLinkResource struct { + // PrivateLinkResourceProperties - Resource properties. + *PrivateLinkResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.PrivateLinkResourceProperties != nil { + objectMap["properties"] = plr.PrivateLinkResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. +func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkResourceProperties PrivateLinkResourceProperties + err = json.Unmarshal(*v, &privateLinkResourceProperties) + if err != nil { + return err + } + plr.PrivateLinkResourceProperties = &privateLinkResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plr.Type = &typeVar + } + } + } + + return nil +} + +// PrivateLinkResourceListResult a list of private link resources +type PrivateLinkResourceListResult struct { + autorest.Response `json:"-"` + // Value - Array of private link resources + Value *[]PrivateLinkResource `json:"value,omitempty"` +} + +// PrivateLinkResourceProperties properties of a private link resource. +type PrivateLinkResourceProperties struct { + // GroupID - READ-ONLY; The private link resource group id. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - READ-ONLY; The private link resource required member names. + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - The private link resource Private link DNS zone name. + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. +func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plrp.RequiredZoneNames != nil { + objectMap["requiredZoneNames"] = plrp.RequiredZoneNames + } + return json.Marshal(objectMap) +} + +// PrivateLinkServiceConnectionState a collection of information about the state of the connection between +// service consumer and provider. +type PrivateLinkServiceConnectionState struct { + // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'PrivateEndpointServiceConnectionStatusPending', 'PrivateEndpointServiceConnectionStatusApproved', 'PrivateEndpointServiceConnectionStatusRejected' + Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` + // Description - The reason for approval/rejection of the connection. + Description *string `json:"description,omitempty"` + // ActionRequired - A message indicating if changes on the service provider require any updates on the consumer. + ActionRequired *string `json:"actionRequired,omitempty"` +} + +// ProtectedAppendWritesHistory protected append writes history setting for the blob container with Legal +// holds. +type ProtectedAppendWritesHistory struct { + // AllowProtectedAppendWritesAll - When enabled, new blocks can be written to both 'Append and Bock Blobs' while maintaining legal hold protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. + AllowProtectedAppendWritesAll *bool `json:"allowProtectedAppendWritesAll,omitempty"` + // Timestamp - READ-ONLY; Returns the date and time the tag was added. + Timestamp *date.Time `json:"timestamp,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProtectedAppendWritesHistory. +func (pawh ProtectedAppendWritesHistory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pawh.AllowProtectedAppendWritesAll != nil { + objectMap["allowProtectedAppendWritesAll"] = pawh.AllowProtectedAppendWritesAll + } + return json.Marshal(objectMap) +} + +// ProtocolSettings protocol settings for file service +type ProtocolSettings struct { + // Smb - Setting for SMB protocol + Smb *SmbSetting `json:"smb,omitempty"` +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Queue ... +type Queue struct { + autorest.Response `json:"-"` + // QueueProperties - Queue resource properties. + *QueueProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Queue. +func (q Queue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if q.QueueProperties != nil { + objectMap["properties"] = q.QueueProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Queue struct. +func (q *Queue) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var queueProperties QueueProperties + err = json.Unmarshal(*v, &queueProperties) + if err != nil { + return err + } + q.QueueProperties = &queueProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + q.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + q.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + q.Type = &typeVar + } + } + } + + return nil +} + +// QueueProperties ... +type QueueProperties struct { + // Metadata - A name-value pair that represents queue metadata. + Metadata map[string]*string `json:"metadata"` + // ApproximateMessageCount - READ-ONLY; Integer indicating an approximate number of messages in the queue. This number is not lower than the actual number of messages in the queue, but could be higher. + ApproximateMessageCount *int32 `json:"approximateMessageCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for QueueProperties. +func (qp QueueProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if qp.Metadata != nil { + objectMap["metadata"] = qp.Metadata + } + return json.Marshal(objectMap) +} + +// QueueServiceProperties the properties of a storage account’s Queue service. +type QueueServiceProperties struct { + autorest.Response `json:"-"` + // QueueServicePropertiesProperties - The properties of a storage account’s Queue service. + *QueueServicePropertiesProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for QueueServiceProperties. +func (qsp QueueServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if qsp.QueueServicePropertiesProperties != nil { + objectMap["properties"] = qsp.QueueServicePropertiesProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for QueueServiceProperties struct. +func (qsp *QueueServiceProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var queueServiceProperties QueueServicePropertiesProperties + err = json.Unmarshal(*v, &queueServiceProperties) + if err != nil { + return err + } + qsp.QueueServicePropertiesProperties = &queueServiceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + qsp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + qsp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + qsp.Type = &typeVar + } + } + } + + return nil +} + +// QueueServicePropertiesProperties the properties of a storage account’s Queue service. +type QueueServicePropertiesProperties struct { + // Cors - Specifies CORS rules for the Queue service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Queue service. + Cors *CorsRules `json:"cors,omitempty"` +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceAccessRule resource Access Rule. +type ResourceAccessRule struct { + // TenantID - Tenant Id + TenantID *string `json:"tenantId,omitempty"` + // ResourceID - Resource Id + ResourceID *string `json:"resourceId,omitempty"` +} + +// RestorePolicyProperties the blob service properties for blob restore policy +type RestorePolicyProperties struct { + // Enabled - Blob restore is enabled if set to true. + Enabled *bool `json:"enabled,omitempty"` + // Days - how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days. + Days *int32 `json:"days,omitempty"` + // LastEnabledTime - READ-ONLY; Deprecated in favor of minRestoreTime property. + LastEnabledTime *date.Time `json:"lastEnabledTime,omitempty"` + // MinRestoreTime - READ-ONLY; Returns the minimum date and time that the restore can be started. + MinRestoreTime *date.Time `json:"minRestoreTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for RestorePolicyProperties. +func (rpp RestorePolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpp.Enabled != nil { + objectMap["enabled"] = rpp.Enabled + } + if rpp.Days != nil { + objectMap["days"] = rpp.Days + } + return json.Marshal(objectMap) +} + +// Restriction the restriction because of which SKU cannot be used. +type Restriction struct { + // Type - READ-ONLY; The type of restrictions. As of now only possible value for this is location. + Type *string `json:"type,omitempty"` + // Values - READ-ONLY; The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. + Values *[]string `json:"values,omitempty"` + // ReasonCode - The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: 'ReasonCodeQuotaID', 'ReasonCodeNotAvailableForSubscription' + ReasonCode ReasonCode `json:"reasonCode,omitempty"` +} + +// MarshalJSON is the custom marshaler for Restriction. +func (r Restriction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.ReasonCode != "" { + objectMap["reasonCode"] = r.ReasonCode + } + return json.Marshal(objectMap) +} + +// RoutingPreference routing preference defines the type of network, either microsoft or internet routing +// to be used to deliver the user data, the default option is microsoft routing +type RoutingPreference struct { + // RoutingChoice - Routing Choice defines the kind of network routing opted by the user. Possible values include: 'RoutingChoiceMicrosoftRouting', 'RoutingChoiceInternetRouting' + RoutingChoice RoutingChoice `json:"routingChoice,omitempty"` + // PublishMicrosoftEndpoints - A boolean flag which indicates whether microsoft routing storage endpoints are to be published + PublishMicrosoftEndpoints *bool `json:"publishMicrosoftEndpoints,omitempty"` + // PublishInternetEndpoints - A boolean flag which indicates whether internet routing storage endpoints are to be published + PublishInternetEndpoints *bool `json:"publishInternetEndpoints,omitempty"` +} + +// SasPolicy sasPolicy assigned to the storage account. +type SasPolicy struct { + // SasExpirationPeriod - The SAS expiration period, DD.HH:MM:SS. + SasExpirationPeriod *string `json:"sasExpirationPeriod,omitempty"` + // ExpirationAction - The SAS expiration action. Can only be Log. + ExpirationAction *string `json:"expirationAction,omitempty"` +} + +// ServiceSasParameters the parameters to list service SAS credentials of a specific resource. +type ServiceSasParameters struct { + // CanonicalizedResource - The canonical path to the signed resource. + CanonicalizedResource *string `json:"canonicalizedResource,omitempty"` + // Resource - The signed services accessible with the service SAS. Possible values include: Blob (b), Container (c), File (f), Share (s). Possible values include: 'SignedResourceB', 'SignedResourceC', 'SignedResourceF', 'SignedResourceS' + Resource SignedResource `json:"signedResource,omitempty"` + // Permissions - The signed permissions for the service SAS. Possible values include: Read (r), Write (w), Delete (d), List (l), Add (a), Create (c), Update (u) and Process (p). Possible values include: 'PermissionsR', 'PermissionsD', 'PermissionsW', 'PermissionsL', 'PermissionsA', 'PermissionsC', 'PermissionsU', 'PermissionsP' + Permissions Permissions `json:"signedPermission,omitempty"` + // IPAddressOrRange - An IP address or a range of IP addresses from which to accept requests. + IPAddressOrRange *string `json:"signedIp,omitempty"` + // Protocols - The protocol permitted for a request made with the account SAS. Possible values include: 'HTTPProtocolHttpshttp', 'HTTPProtocolHTTPS' + Protocols HTTPProtocol `json:"signedProtocol,omitempty"` + // SharedAccessStartTime - The time at which the SAS becomes valid. + SharedAccessStartTime *date.Time `json:"signedStart,omitempty"` + // SharedAccessExpiryTime - The time at which the shared access signature becomes invalid. + SharedAccessExpiryTime *date.Time `json:"signedExpiry,omitempty"` + // Identifier - A unique value up to 64 characters in length that correlates to an access policy specified for the container, queue, or table. + Identifier *string `json:"signedIdentifier,omitempty"` + // PartitionKeyStart - The start of partition key. + PartitionKeyStart *string `json:"startPk,omitempty"` + // PartitionKeyEnd - The end of partition key. + PartitionKeyEnd *string `json:"endPk,omitempty"` + // RowKeyStart - The start of row key. + RowKeyStart *string `json:"startRk,omitempty"` + // RowKeyEnd - The end of row key. + RowKeyEnd *string `json:"endRk,omitempty"` + // KeyToSign - The key to sign the account SAS token with. + KeyToSign *string `json:"keyToSign,omitempty"` + // CacheControl - The response header override for cache control. + CacheControl *string `json:"rscc,omitempty"` + // ContentDisposition - The response header override for content disposition. + ContentDisposition *string `json:"rscd,omitempty"` + // ContentEncoding - The response header override for content encoding. + ContentEncoding *string `json:"rsce,omitempty"` + // ContentLanguage - The response header override for content language. + ContentLanguage *string `json:"rscl,omitempty"` + // ContentType - The response header override for content type. + ContentType *string `json:"rsct,omitempty"` +} + +// ServiceSpecification one property of operation, include metric specifications. +type ServiceSpecification struct { + // MetricSpecifications - Metric specifications of operation. + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` +} + +// SignedIdentifier ... +type SignedIdentifier struct { + // ID - An unique identifier of the stored access policy. + ID *string `json:"id,omitempty"` + // AccessPolicy - Access policy + AccessPolicy *AccessPolicy `json:"accessPolicy,omitempty"` +} + +// Sku the SKU of the storage account. +type Sku struct { + // Name - Possible values include: 'SkuNameStandardLRS', 'SkuNameStandardGRS', 'SkuNameStandardRAGRS', 'SkuNameStandardZRS', 'SkuNamePremiumLRS', 'SkuNamePremiumZRS', 'SkuNameStandardGZRS', 'SkuNameStandardRAGZRS' + Name SkuName `json:"name,omitempty"` + // Tier - Possible values include: 'SkuTierStandard', 'SkuTierPremium' + Tier SkuTier `json:"tier,omitempty"` +} + +// SKUCapability the capability information in the specified SKU, including file encryption, network ACLs, +// change notification, etc. +type SKUCapability struct { + // Name - READ-ONLY; The name of capability, The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. + Name *string `json:"name,omitempty"` + // Value - READ-ONLY; A string value to indicate states of given capability. Possibly 'true' or 'false'. + Value *string `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for SKUCapability. +func (sc SKUCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SkuInformation storage SKU and its properties +type SkuInformation struct { + // Name - Possible values include: 'SkuNameStandardLRS', 'SkuNameStandardGRS', 'SkuNameStandardRAGRS', 'SkuNameStandardZRS', 'SkuNamePremiumLRS', 'SkuNamePremiumZRS', 'SkuNameStandardGZRS', 'SkuNameStandardRAGZRS' + Name SkuName `json:"name,omitempty"` + // Tier - Possible values include: 'SkuTierStandard', 'SkuTierPremium' + Tier SkuTier `json:"tier,omitempty"` + // ResourceType - READ-ONLY; The type of the resource, usually it is 'storageAccounts'. + ResourceType *string `json:"resourceType,omitempty"` + // Kind - READ-ONLY; Indicates the type of storage account. Possible values include: 'KindStorage', 'KindStorageV2', 'KindBlobStorage', 'KindFileStorage', 'KindBlockBlobStorage' + Kind Kind `json:"kind,omitempty"` + // Locations - READ-ONLY; The set of locations that the SKU is available. This will be supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). + Locations *[]string `json:"locations,omitempty"` + // Capabilities - READ-ONLY; The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. + Capabilities *[]SKUCapability `json:"capabilities,omitempty"` + // Restrictions - The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. + Restrictions *[]Restriction `json:"restrictions,omitempty"` +} + +// MarshalJSON is the custom marshaler for SkuInformation. +func (si SkuInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if si.Name != "" { + objectMap["name"] = si.Name + } + if si.Tier != "" { + objectMap["tier"] = si.Tier + } + if si.Restrictions != nil { + objectMap["restrictions"] = si.Restrictions + } + return json.Marshal(objectMap) +} + +// SkuListResult the response from the List Storage SKUs operation. +type SkuListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Get the list result of storage SKUs and their properties. + Value *[]SkuInformation `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for SkuListResult. +func (slr SkuListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SmbSetting setting for SMB protocol +type SmbSetting struct { + // Multichannel - Multichannel setting. Applies to Premium FileStorage only. + Multichannel *Multichannel `json:"multichannel,omitempty"` + // Versions - SMB protocol versions supported by server. Valid values are SMB2.1, SMB3.0, SMB3.1.1. Should be passed as a string with delimiter ';'. + Versions *string `json:"versions,omitempty"` + // AuthenticationMethods - SMB authentication methods supported by server. Valid values are NTLMv2, Kerberos. Should be passed as a string with delimiter ';'. + AuthenticationMethods *string `json:"authenticationMethods,omitempty"` + // KerberosTicketEncryption - Kerberos ticket encryption supported by server. Valid values are RC4-HMAC, AES-256. Should be passed as a string with delimiter ';' + KerberosTicketEncryption *string `json:"kerberosTicketEncryption,omitempty"` + // ChannelEncryption - SMB channel encryption supported by server. Valid values are AES-128-CCM, AES-128-GCM, AES-256-GCM. Should be passed as a string with delimiter ';'. + ChannelEncryption *string `json:"channelEncryption,omitempty"` +} + +// SSHPublicKey ... +type SSHPublicKey struct { + // Description - Optional. It is used to store the function/usage of the key + Description *string `json:"description,omitempty"` + // Key - Ssh public key base64 encoded. The format should be: ' ', e.g. ssh-rsa AAAABBBB + Key *string `json:"key,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// Table properties of the table, including Id, resource name, resource type. +type Table struct { + autorest.Response `json:"-"` + // TableProperties - Table resource properties. + *TableProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Table. +func (t Table) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.TableProperties != nil { + objectMap["properties"] = t.TableProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Table struct. +func (t *Table) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var tableProperties TableProperties + err = json.Unmarshal(*v, &tableProperties) + if err != nil { + return err + } + t.TableProperties = &tableProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + t.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + t.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + t.Type = &typeVar + } + } + } + + return nil +} + +// TableAccessPolicy table Access Policy Properties Object. +type TableAccessPolicy struct { + // StartTime - Start time of the access policy + StartTime *date.Time `json:"startTime,omitempty"` + // ExpiryTime - Expiry time of the access policy + ExpiryTime *date.Time `json:"expiryTime,omitempty"` + // Permission - Required. List of abbreviated permissions. Supported permission values include 'r','a','u','d' + Permission *string `json:"permission,omitempty"` +} + +// TableProperties ... +type TableProperties struct { + // TableName - READ-ONLY; Table name under the specified account + TableName *string `json:"tableName,omitempty"` + // SignedIdentifiers - List of stored access policies specified on the table. + SignedIdentifiers *[]TableSignedIdentifier `json:"signedIdentifiers,omitempty"` +} + +// MarshalJSON is the custom marshaler for TableProperties. +func (tp TableProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tp.SignedIdentifiers != nil { + objectMap["signedIdentifiers"] = tp.SignedIdentifiers + } + return json.Marshal(objectMap) +} + +// TableServiceProperties the properties of a storage account’s Table service. +type TableServiceProperties struct { + autorest.Response `json:"-"` + // TableServicePropertiesProperties - The properties of a storage account’s Table service. + *TableServicePropertiesProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TableServiceProperties. +func (tsp TableServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tsp.TableServicePropertiesProperties != nil { + objectMap["properties"] = tsp.TableServicePropertiesProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TableServiceProperties struct. +func (tsp *TableServiceProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var tableServiceProperties TableServicePropertiesProperties + err = json.Unmarshal(*v, &tableServiceProperties) + if err != nil { + return err + } + tsp.TableServicePropertiesProperties = &tableServiceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + tsp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + tsp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + tsp.Type = &typeVar + } + } + } + + return nil +} + +// TableServicePropertiesProperties the properties of a storage account’s Table service. +type TableServicePropertiesProperties struct { + // Cors - Specifies CORS rules for the Table service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Table service. + Cors *CorsRules `json:"cors,omitempty"` +} + +// TableSignedIdentifier object to set Table Access Policy. +type TableSignedIdentifier struct { + // ID - unique-64-character-value of the stored access policy. + ID *string `json:"id,omitempty"` + // AccessPolicy - Access policy + AccessPolicy *TableAccessPolicy `json:"accessPolicy,omitempty"` +} + +// TagFilter blob index tag based filtering for blob objects +type TagFilter struct { + // Name - This is the filter tag name, it can have 1 - 128 characters + Name *string `json:"name,omitempty"` + // Op - This is the comparison operator which is used for object comparison and filtering. Only == (equality operator) is currently supported + Op *string `json:"op,omitempty"` + // Value - This is the filter tag value field used for tag based filtering, it can have 0 - 256 characters + Value *string `json:"value,omitempty"` +} + +// TagProperty a tag of the LegalHold of a blob container. +type TagProperty struct { + // Tag - READ-ONLY; The tag value. + Tag *string `json:"tag,omitempty"` + // Timestamp - READ-ONLY; Returns the date and time the tag was added. + Timestamp *date.Time `json:"timestamp,omitempty"` + // ObjectIdentifier - READ-ONLY; Returns the Object ID of the user who added the tag. + ObjectIdentifier *string `json:"objectIdentifier,omitempty"` + // TenantID - READ-ONLY; Returns the Tenant ID that issued the token for the user who added the tag. + TenantID *string `json:"tenantId,omitempty"` + // Upn - READ-ONLY; Returns the User Principal Name of the user who added the tag. + Upn *string `json:"upn,omitempty"` +} + +// MarshalJSON is the custom marshaler for TagProperty. +func (tp TagProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// UpdateHistoryProperty an update history of the ImmutabilityPolicy of a blob container. +type UpdateHistoryProperty struct { + // Update - READ-ONLY; The ImmutabilityPolicy update type of a blob container, possible values include: put, lock and extend. Possible values include: 'ImmutabilityPolicyUpdateTypePut', 'ImmutabilityPolicyUpdateTypeLock', 'ImmutabilityPolicyUpdateTypeExtend' + Update ImmutabilityPolicyUpdateType `json:"update,omitempty"` + // ImmutabilityPeriodSinceCreationInDays - READ-ONLY; The immutability period for the blobs in the container since the policy creation, in days. + ImmutabilityPeriodSinceCreationInDays *int32 `json:"immutabilityPeriodSinceCreationInDays,omitempty"` + // Timestamp - READ-ONLY; Returns the date and time the ImmutabilityPolicy was updated. + Timestamp *date.Time `json:"timestamp,omitempty"` + // ObjectIdentifier - READ-ONLY; Returns the Object ID of the user who updated the ImmutabilityPolicy. + ObjectIdentifier *string `json:"objectIdentifier,omitempty"` + // TenantID - READ-ONLY; Returns the Tenant ID that issued the token for the user who updated the ImmutabilityPolicy. + TenantID *string `json:"tenantId,omitempty"` + // Upn - READ-ONLY; Returns the User Principal Name of the user who updated the ImmutabilityPolicy. + Upn *string `json:"upn,omitempty"` + // AllowProtectedAppendWrites - This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to an append blob while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. + AllowProtectedAppendWrites *bool `json:"allowProtectedAppendWrites,omitempty"` + // AllowProtectedAppendWritesAll - This property can only be changed for unlocked time-based retention policies. When enabled, new blocks can be written to both 'Append and Bock Blobs' while maintaining immutability protection and compliance. Only new blocks can be added and any existing blocks cannot be modified or deleted. This property cannot be changed with ExtendImmutabilityPolicy API. The 'allowProtectedAppendWrites' and 'allowProtectedAppendWritesAll' properties are mutually exclusive. + AllowProtectedAppendWritesAll *bool `json:"allowProtectedAppendWritesAll,omitempty"` +} + +// MarshalJSON is the custom marshaler for UpdateHistoryProperty. +func (uhp UpdateHistoryProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if uhp.AllowProtectedAppendWrites != nil { + objectMap["allowProtectedAppendWrites"] = uhp.AllowProtectedAppendWrites + } + if uhp.AllowProtectedAppendWritesAll != nil { + objectMap["allowProtectedAppendWritesAll"] = uhp.AllowProtectedAppendWritesAll + } + return json.Marshal(objectMap) +} + +// Usage describes Storage Resource Usage. +type Usage struct { + // Unit - READ-ONLY; Gets the unit of measurement. Possible values include: 'UsageUnitCount', 'UsageUnitBytes', 'UsageUnitSeconds', 'UsageUnitPercent', 'UsageUnitCountsPerSecond', 'UsageUnitBytesPerSecond' + Unit UsageUnit `json:"unit,omitempty"` + // CurrentValue - READ-ONLY; Gets the current count of the allocated resources in the subscription. + CurrentValue *int32 `json:"currentValue,omitempty"` + // Limit - READ-ONLY; Gets the maximum count of the resources that can be allocated in the subscription. + Limit *int32 `json:"limit,omitempty"` + // Name - READ-ONLY; Gets the name of the type of usage. + Name *UsageName `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for Usage. +func (u Usage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UsageListResult the response from the List Usages operation. +type UsageListResult struct { + autorest.Response `json:"-"` + // Value - Gets or sets the list of Storage Resource Usages. + Value *[]Usage `json:"value,omitempty"` +} + +// UsageName the usage names that can be used; currently limited to StorageAccount. +type UsageName struct { + // Value - READ-ONLY; Gets a string describing the resource name. + Value *string `json:"value,omitempty"` + // LocalizedValue - READ-ONLY; Gets a localized string describing the resource name. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// MarshalJSON is the custom marshaler for UsageName. +func (un UsageName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UserAssignedIdentity userAssignedIdentity for the resource. +type UserAssignedIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of the identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client ID of the identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserAssignedIdentity. +func (uai UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// VirtualNetworkRule virtual Network rule. +type VirtualNetworkRule struct { + // VirtualNetworkResourceID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + VirtualNetworkResourceID *string `json:"id,omitempty"` + // Action - The action of virtual network rule. Possible values include: 'ActionAllow' + Action Action `json:"action,omitempty"` + // State - Gets the state of virtual network rule. Possible values include: 'StateProvisioning', 'StateDeprovisioning', 'StateSucceeded', 'StateFailed', 'StateNetworkSourceDeleted' + State State `json:"state,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/objectreplicationpolicies.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/objectreplicationpolicies.go similarity index 94% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/objectreplicationpolicies.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/objectreplicationpolicies.go index c41bedaf423..bf815f6c03f 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/objectreplicationpolicies.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/objectreplicationpolicies.go @@ -38,7 +38,10 @@ func NewObjectReplicationPoliciesClientWithBaseURI(baseURI string, subscriptionI // insensitive. // accountName - the name of the storage account within the specified resource group. Storage account names // must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// objectReplicationPolicyID - the ID of object replication policy or 'default' if the policy ID is unknown. +// objectReplicationPolicyID - for the destination account, provide the value 'default'. Configure the policy +// on the destination account first. For the source account, provide the value of the policy ID that is +// returned when you download the policy that was defined on the destination account. The policy is downloaded +// as a JSON file. // properties - the object replication policy set to a storage account. A unique policy ID will be created if // absent. func (client ObjectReplicationPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, properties ObjectReplicationPolicy) (result ObjectReplicationPolicy, err error) { @@ -103,7 +106,7 @@ func (client ObjectReplicationPoliciesClient) CreateOrUpdatePreparer(ctx context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -142,7 +145,10 @@ func (client ObjectReplicationPoliciesClient) CreateOrUpdateResponder(resp *http // insensitive. // accountName - the name of the storage account within the specified resource group. Storage account names // must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// objectReplicationPolicyID - the ID of object replication policy or 'default' if the policy ID is unknown. +// objectReplicationPolicyID - for the destination account, provide the value 'default'. Configure the policy +// on the destination account first. For the source account, provide the value of the policy ID that is +// returned when you download the policy that was defined on the destination account. The policy is downloaded +// as a JSON file. func (client ObjectReplicationPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string) (result autorest.Response, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ObjectReplicationPoliciesClient.Delete") @@ -200,7 +206,7 @@ func (client ObjectReplicationPoliciesClient) DeletePreparer(ctx context.Context "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -236,7 +242,10 @@ func (client ObjectReplicationPoliciesClient) DeleteResponder(resp *http.Respons // insensitive. // accountName - the name of the storage account within the specified resource group. Storage account names // must be between 3 and 24 characters in length and use numbers and lower-case letters only. -// objectReplicationPolicyID - the ID of object replication policy or 'default' if the policy ID is unknown. +// objectReplicationPolicyID - for the destination account, provide the value 'default'. Configure the policy +// on the destination account first. For the source account, provide the value of the policy ID that is +// returned when you download the policy that was defined on the destination account. The policy is downloaded +// as a JSON file. func (client ObjectReplicationPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string) (result ObjectReplicationPolicy, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ObjectReplicationPoliciesClient.Get") @@ -294,7 +303,7 @@ func (client ObjectReplicationPoliciesClient) GetPreparer(ctx context.Context, r "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -385,7 +394,7 @@ func (client ObjectReplicationPoliciesClient) ListPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/operations.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/operations.go new file mode 100644 index 00000000000..af5740f324f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/operations.go @@ -0,0 +1,98 @@ +package storage + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the the Azure Storage Management API. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Storage Rest API operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.OperationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Storage/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/privateendpointconnections.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/privateendpointconnections.go new file mode 100644 index 00000000000..6bd6921f59d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/privateendpointconnections.go @@ -0,0 +1,411 @@ +package storage + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateEndpointConnectionsClient is the the Azure Storage Management API. +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete deletes the specified private endpoint connection associated with the storage account. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure +// resource +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.PrivateEndpointConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified private endpoint connection associated with the storage account. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure +// resource +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.PrivateEndpointConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all the private endpoint connections associated with the storage account. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, accountName string) (result PrivateEndpointConnectionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.PrivateEndpointConnectionsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Put update the state of specified private endpoint connection associated with the storage account. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// privateEndpointConnectionName - the name of the private endpoint connection associated with the Azure +// resource +// properties - the private endpoint connection properties. +func (client PrivateEndpointConnectionsClient) Put(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Put") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: properties, + Constraints: []validation.Constraint{{Target: "properties.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "properties.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("storage.PrivateEndpointConnectionsClient", "Put", err.Error()) + } + + req, err := client.PutPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName, properties) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Put", nil, "Failure preparing request") + return + } + + resp, err := client.PutSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Put", resp, "Failure sending request") + return + } + + result, err = client.PutResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.PrivateEndpointConnectionsClient", "Put", resp, "Failure responding to request") + return + } + + return +} + +// PutPreparer prepares the Put request. +func (client PrivateEndpointConnectionsClient) PutPreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(properties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutSender sends the Put request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) PutSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PutResponder handles the response to the Put request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) PutResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/privatelinkresources.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/privatelinkresources.go new file mode 100644 index 00000000000..eefcb3e152a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/privatelinkresources.go @@ -0,0 +1,124 @@ +package storage + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateLinkResourcesClient is the the Azure Storage Management API. +type PrivateLinkResourcesClient struct { + BaseClient +} + +// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByStorageAccount gets the private link resources that need to be created for a storage account. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +func (client PrivateLinkResourcesClient) ListByStorageAccount(ctx context.Context, resourceGroupName string, accountName string) (result PrivateLinkResourceListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByStorageAccount") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.PrivateLinkResourcesClient", "ListByStorageAccount", err.Error()) + } + + req, err := client.ListByStorageAccountPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.PrivateLinkResourcesClient", "ListByStorageAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByStorageAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.PrivateLinkResourcesClient", "ListByStorageAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByStorageAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.PrivateLinkResourcesClient", "ListByStorageAccount", resp, "Failure responding to request") + return + } + + return +} + +// ListByStorageAccountPreparer prepares the ListByStorageAccount request. +func (client PrivateLinkResourcesClient) ListByStorageAccountPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByStorageAccountSender sends the ListByStorageAccount request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) ListByStorageAccountSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByStorageAccountResponder handles the response to the ListByStorageAccount request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) ListByStorageAccountResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/queue.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/queue.go new file mode 100644 index 00000000000..ce6ae22a065 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/queue.go @@ -0,0 +1,571 @@ +package storage + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// QueueClient is the the Azure Storage Management API. +type QueueClient struct { + BaseClient +} + +// NewQueueClient creates an instance of the QueueClient client. +func NewQueueClient(subscriptionID string) QueueClient { + return NewQueueClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewQueueClientWithBaseURI creates an instance of the QueueClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewQueueClientWithBaseURI(baseURI string, subscriptionID string) QueueClient { + return QueueClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a new queue with the specified queue name, under the specified account. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// queueName - a queue name must be unique within a storage account and must be between 3 and 63 characters.The +// name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an +// alphanumeric character and it cannot have two consecutive dash(-) characters. +// queue - queue properties and metadata to be created with +func (client QueueClient) Create(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue) (result Queue, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.QueueClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, queueName, queue) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.QueueClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.QueueClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.QueueClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client QueueClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}", pathParameters), + autorest.WithJSON(queue), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client QueueClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client QueueClient) CreateResponder(resp *http.Response) (result Queue, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the queue with the specified queue name, under the specified account if it exists. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// queueName - a queue name must be unique within a storage account and must be between 3 and 63 characters.The +// name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an +// alphanumeric character and it cannot have two consecutive dash(-) characters. +func (client QueueClient) Delete(ctx context.Context, resourceGroupName string, accountName string, queueName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.QueueClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, queueName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.QueueClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "storage.QueueClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.QueueClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client QueueClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, queueName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client QueueClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client QueueClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the queue with the specified queue name, under the specified account if it exists. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// queueName - a queue name must be unique within a storage account and must be between 3 and 63 characters.The +// name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an +// alphanumeric character and it cannot have two consecutive dash(-) characters. +func (client QueueClient) Get(ctx context.Context, resourceGroupName string, accountName string, queueName string) (result Queue, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.QueueClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, queueName) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.QueueClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.QueueClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.QueueClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client QueueClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, queueName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client QueueClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client QueueClient) GetResponder(resp *http.Response) (result Queue, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of all the queues under the specified storage account +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// maxpagesize - optional, a maximum number of queues that should be included in a list queue response +// filter - optional, When specified, only the queues with a name starting with the given filter will be +// listed. +func (client QueueClient) List(ctx context.Context, resourceGroupName string, accountName string, maxpagesize string, filter string) (result ListQueueResourcePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.List") + defer func() { + sc := -1 + if result.lqr.Response.Response != nil { + sc = result.lqr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.QueueClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, accountName, maxpagesize, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.QueueClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lqr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.QueueClient", "List", resp, "Failure sending request") + return + } + + result.lqr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.QueueClient", "List", resp, "Failure responding to request") + return + } + if result.lqr.hasNextLink() && result.lqr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client QueueClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, maxpagesize string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(maxpagesize) > 0 { + queryParameters["$maxpagesize"] = autorest.Encode("query", maxpagesize) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client QueueClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client QueueClient) ListResponder(resp *http.Response) (result ListQueueResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client QueueClient) listNextResults(ctx context.Context, lastResults ListQueueResource) (result ListQueueResource, err error) { + req, err := lastResults.listQueueResourcePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "storage.QueueClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "storage.QueueClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.QueueClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client QueueClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, maxpagesize string, filter string) (result ListQueueResourceIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, accountName, maxpagesize, filter) + return +} + +// Update creates a new queue with the specified queue name, under the specified account. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// accountName - the name of the storage account within the specified resource group. Storage account names +// must be between 3 and 24 characters in length and use numbers and lower-case letters only. +// queueName - a queue name must be unique within a storage account and must be between 3 and 63 characters.The +// name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an +// alphanumeric character and it cannot have two consecutive dash(-) characters. +// queue - queue properties and metadata to be created with +func (client QueueClient) Update(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue) (result Queue, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QueueClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 24, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: queueName, + Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "queueName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.QueueClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, queueName, queue) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.QueueClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.QueueClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.QueueClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client QueueClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "queueName": autorest.Encode("path", queueName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/queueServices/default/queues/{queueName}", pathParameters), + autorest.WithJSON(queue), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client QueueClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client QueueClient) UpdateResponder(resp *http.Response) (result Queue, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/queueservices.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/queueservices.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/queueservices.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/queueservices.go index f778ad7a151..21d70bb06d5 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/queueservices.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/queueservices.go @@ -93,7 +93,7 @@ func (client QueueServicesClient) GetServicePropertiesPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -184,7 +184,7 @@ func (client QueueServicesClient) ListPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -279,7 +279,7 @@ func (client QueueServicesClient) SetServicePropertiesPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/skus.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/skus.go new file mode 100644 index 00000000000..a756e884531 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/skus.go @@ -0,0 +1,109 @@ +package storage + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SkusClient is the the Azure Storage Management API. +type SkusClient struct { + BaseClient +} + +// NewSkusClient creates an instance of the SkusClient client. +func NewSkusClient(subscriptionID string) SkusClient { + return NewSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSkusClientWithBaseURI creates an instance of the SkusClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSkusClientWithBaseURI(baseURI string, subscriptionID string) SkusClient { + return SkusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists the available SKUs supported by Microsoft.Storage for given subscription. +func (client SkusClient) List(ctx context.Context) (result SkuListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkusClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("storage.SkusClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.SkusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "storage.SkusClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "storage.SkusClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SkusClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SkusClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SkusClient) ListResponder(resp *http.Response) (result SkuListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/table.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/table.go similarity index 95% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/table.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/table.go index 51a83b904d3..77d7dff4024 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/table.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/table.go @@ -39,7 +39,8 @@ func NewTableClientWithBaseURI(baseURI string, subscriptionID string) TableClien // must be between 3 and 24 characters in length and use numbers and lower-case letters only. // tableName - a table name must be unique within a storage account and must be between 3 and 63 characters.The // name must comprise of only alphanumeric characters and it cannot begin with a numeric character. -func (client TableClient) Create(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result Table, err error) { +// parameters - the parameters to provide to create a table. +func (client TableClient) Create(ctx context.Context, resourceGroupName string, accountName string, tableName string, parameters *Table) (result Table, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/TableClient.Create") defer func() { @@ -67,7 +68,7 @@ func (client TableClient) Create(ctx context.Context, resourceGroupName string, return result, validation.NewError("storage.TableClient", "Create", err.Error()) } - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, tableName) + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, tableName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "storage.TableClient", "Create", nil, "Failure preparing request") return @@ -90,7 +91,7 @@ func (client TableClient) Create(ctx context.Context, resourceGroupName string, } // CreatePreparer prepares the Create request. -func (client TableClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { +func (client TableClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, parameters *Table) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -98,16 +99,21 @@ func (client TableClient) CreatePreparer(ctx context.Context, resourceGroupName "tableName": autorest.Encode("path", tableName), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}", pathParameters), autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -196,7 +202,7 @@ func (client TableClient) DeletePreparer(ctx context.Context, resourceGroupName "tableName": autorest.Encode("path", tableName), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -293,7 +299,7 @@ func (client TableClient) GetPreparer(ctx context.Context, resourceGroupName str "tableName": autorest.Encode("path", tableName), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -389,7 +395,7 @@ func (client TableClient) ListPreparer(ctx context.Context, resourceGroupName st "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -465,7 +471,8 @@ func (client TableClient) ListComplete(ctx context.Context, resourceGroupName st // must be between 3 and 24 characters in length and use numbers and lower-case letters only. // tableName - a table name must be unique within a storage account and must be between 3 and 63 characters.The // name must comprise of only alphanumeric characters and it cannot begin with a numeric character. -func (client TableClient) Update(ctx context.Context, resourceGroupName string, accountName string, tableName string) (result Table, err error) { +// parameters - the parameters to provide to create a table. +func (client TableClient) Update(ctx context.Context, resourceGroupName string, accountName string, tableName string, parameters *Table) (result Table, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/TableClient.Update") defer func() { @@ -493,7 +500,7 @@ func (client TableClient) Update(ctx context.Context, resourceGroupName string, return result, validation.NewError("storage.TableClient", "Update", err.Error()) } - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, tableName) + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, tableName, parameters) if err != nil { err = autorest.NewErrorWithError(err, "storage.TableClient", "Update", nil, "Failure preparing request") return @@ -516,7 +523,7 @@ func (client TableClient) Update(ctx context.Context, resourceGroupName string, } // UpdatePreparer prepares the Update request. -func (client TableClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string) (*http.Request, error) { +func (client TableClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, tableName string, parameters *Table) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -524,16 +531,21 @@ func (client TableClient) UpdatePreparer(ctx context.Context, resourceGroupName "tableName": autorest.Encode("path", tableName), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/tableServices/default/tables/{tableName}", pathParameters), autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/tableservices.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/tableservices.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/tableservices.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/tableservices.go index f8f19232e0f..694ca736b6a 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/tableservices.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/tableservices.go @@ -93,7 +93,7 @@ func (client TableServicesClient) GetServicePropertiesPreparer(ctx context.Conte "tableServiceName": autorest.Encode("path", "default"), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -184,7 +184,7 @@ func (client TableServicesClient) ListPreparer(ctx context.Context, resourceGrou "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -279,7 +279,7 @@ func (client TableServicesClient) SetServicePropertiesPreparer(ctx context.Conte "tableServiceName": autorest.Encode("path", "default"), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/usages.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/usages.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/usages.go rename to terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/usages.go index 4ef93c30a6a..0952a56a532 100644 --- a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage/usages.go +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/usages.go @@ -80,7 +80,7 @@ func (client UsagesClient) ListByLocationPreparer(ctx context.Context, location "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2021-04-01" + const APIVersion = "2021-09-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/version.go b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/version.go new file mode 100644 index 00000000000..5e71325b63f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage/version.go @@ -0,0 +1,19 @@ +package storage + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " storage/2021-09-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/authentication/environment.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/authentication/environment.go index 05910ffbdf8..fe0a5380668 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/authentication/environment.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/authentication/environment.go @@ -113,11 +113,17 @@ func AzureEnvironmentByNameFromEndpoint(ctx context.Context, endpoint string, en // while the array contains values for _, env := range environments { - if strings.EqualFold(env.Name, environmentName) { + if strings.EqualFold(env.Name, environmentName) || (environmentName == "" && len(environments) == 1) { + // if resourceManager endpoint is empty, assume it's the provided endpoint + if env.ResourceManager == "" { + env.ResourceManager = fmt.Sprintf("https://%s/", endpoint) + } + aEnv, err := buildAzureEnvironment(env) if err != nil { return nil, err } + return aEnv, nil } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/lang/response/response.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/lang/response/response.go index 9f0e1b506f5..74495589d8b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/lang/response/response.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/lang/response/response.go @@ -6,20 +6,22 @@ import ( // WasBadRequest returns true if the HttpResponse is non-nil and has a status code of BadRequest func WasBadRequest(resp *http.Response) bool { - return responseWasStatusCode(resp, http.StatusBadRequest) + return WasStatusCode(resp, http.StatusBadRequest) } // WasConflict returns true if the HttpResponse is non-nil and has a status code of Conflict func WasConflict(resp *http.Response) bool { - return responseWasStatusCode(resp, http.StatusConflict) + return WasStatusCode(resp, http.StatusConflict) } // WasNotFound returns true if the HttpResponse is non-nil and has a status code of NotFound func WasNotFound(resp *http.Response) bool { - return responseWasStatusCode(resp, http.StatusNotFound) + return WasStatusCode(resp, http.StatusNotFound) } -func responseWasStatusCode(resp *http.Response, statusCode int) bool { +// WasStatusCode returns true if the HttpResponse is non-nil and matches the Status Code +// It's recommended to use WasBadRequest/WasConflict/WasNotFound where possible instead +func WasStatusCode(resp *http.Response, statusCode int) bool { if r := resp; r != nil { if r.StatusCode == statusCode { return true diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/polling/poller.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/polling/poller.go index 0060dcd7f44..d08c4889e02 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/polling/poller.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/polling/poller.go @@ -4,9 +4,11 @@ import ( "context" "fmt" "net/http" + "strings" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" ) type LongRunningPoller struct { @@ -16,9 +18,12 @@ type LongRunningPoller struct { future *azure.Future ctx context.Context client autorest.Client + method string } // NewLongRunningPollerFromResponse creates a new LongRunningPoller from the HTTP Response +// this is deprecated and replaced by NewPollerFromResponse. Can be removed once all the +// embedded SDKs have been removed. func NewLongRunningPollerFromResponse(ctx context.Context, resp *http.Response, client autorest.Client) (LongRunningPoller, error) { poller := LongRunningPoller{ ctx: ctx, @@ -32,6 +37,21 @@ func NewLongRunningPollerFromResponse(ctx context.Context, resp *http.Response, return poller, nil } +// NewPollerFromResponse creates a new LongRunningPoller from the HTTP Response +func NewPollerFromResponse(ctx context.Context, resp *http.Response, client autorest.Client, method string) (LongRunningPoller, error) { + poller := LongRunningPoller{ + ctx: ctx, + client: client, + method: method, + } + future, err := azure.NewFutureFromResponse(resp) + if err != nil { + return poller, err + } + poller.future = &future + return poller, nil +} + // PollUntilDone polls until this Long Running Poller is completed func (fw *LongRunningPoller) PollUntilDone() error { if fw.future == nil { @@ -40,5 +60,10 @@ func (fw *LongRunningPoller) PollUntilDone() error { err := fw.future.WaitForCompletionRef(fw.ctx, fw.client) fw.HttpResponse = fw.future.Response() + if strings.EqualFold(fw.method, "DELETE") { + if response.WasNotFound(fw.HttpResponse) { + err = nil + } + } return err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/cloud_services_ip_configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/cloud_services_ip_configuration.go new file mode 100644 index 00000000000..68c8eb8ed75 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/cloud_services_ip_configuration.go @@ -0,0 +1,163 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = CloudServicesIPConfigurationId{} + +// CloudServicesIPConfigurationId is a struct representing the Resource ID for a Cloud Services I P Configuration +type CloudServicesIPConfigurationId struct { + SubscriptionId string + ResourceGroup string + CloudServiceName string + RoleInstanceName string + NetworkInterfaceName string + IpConfigurationName string +} + +// NewCloudServicesIPConfigurationID returns a new CloudServicesIPConfigurationId struct +func NewCloudServicesIPConfigurationID(subscriptionId string, resourceGroup string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, ipConfigurationName string) CloudServicesIPConfigurationId { + return CloudServicesIPConfigurationId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + CloudServiceName: cloudServiceName, + RoleInstanceName: roleInstanceName, + NetworkInterfaceName: networkInterfaceName, + IpConfigurationName: ipConfigurationName, + } +} + +// ParseCloudServicesIPConfigurationID parses 'input' into a CloudServicesIPConfigurationId +func ParseCloudServicesIPConfigurationID(input string) (*CloudServicesIPConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(CloudServicesIPConfigurationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CloudServicesIPConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'cloudServiceName' was not found in the resource id %q", input) + } + + if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'roleInstanceName' was not found in the resource id %q", input) + } + + if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { + return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input) + } + + if id.IpConfigurationName, ok = parsed.Parsed["ipConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'ipConfigurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseCloudServicesIPConfigurationIDInsensitively parses 'input' case-insensitively into a CloudServicesIPConfigurationId +// note: this method should only be used for API response data and not user input +func ParseCloudServicesIPConfigurationIDInsensitively(input string) (*CloudServicesIPConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(CloudServicesIPConfigurationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CloudServicesIPConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'cloudServiceName' was not found in the resource id %q", input) + } + + if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'roleInstanceName' was not found in the resource id %q", input) + } + + if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { + return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input) + } + + if id.IpConfigurationName, ok = parsed.Parsed["ipConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'ipConfigurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateCloudServicesIPConfigurationID checks that 'input' can be parsed as a Cloud Services I P Configuration ID +func ValidateCloudServicesIPConfigurationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCloudServicesIPConfigurationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cloud Services I P Configuration ID +func (id CloudServicesIPConfigurationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/cloudServices/%s/roleInstances/%s/networkInterfaces/%s/ipConfigurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.CloudServiceName, id.RoleInstanceName, id.NetworkInterfaceName, id.IpConfigurationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cloud Services I P Configuration ID +func (id CloudServicesIPConfigurationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("cloudServices", "cloudServices", "cloudServices"), + resourceids.UserSpecifiedSegment("cloudServiceName", "cloudServiceValue"), + resourceids.StaticSegment("roleInstances", "roleInstances", "roleInstances"), + resourceids.UserSpecifiedSegment("roleInstanceName", "roleInstanceValue"), + resourceids.StaticSegment("networkInterfaces", "networkInterfaces", "networkInterfaces"), + resourceids.UserSpecifiedSegment("networkInterfaceName", "networkInterfaceValue"), + resourceids.StaticSegment("ipConfigurations", "ipConfigurations", "ipConfigurations"), + resourceids.UserSpecifiedSegment("ipConfigurationName", "ipConfigurationValue"), + } +} + +// String returns a human-readable description of this Cloud Services I P Configuration ID +func (id CloudServicesIPConfigurationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Cloud Service Name: %q", id.CloudServiceName), + fmt.Sprintf("Role Instance Name: %q", id.RoleInstanceName), + fmt.Sprintf("Network Interface Name: %q", id.NetworkInterfaceName), + fmt.Sprintf("Ip Configuration Name: %q", id.IpConfigurationName), + } + return fmt.Sprintf("Cloud Services I P Configuration (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/cloud_services_public_ip.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/cloud_services_public_ip.go new file mode 100644 index 00000000000..2c806cd333d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/cloud_services_public_ip.go @@ -0,0 +1,176 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = CloudServicesPublicIPAddressId{} + +// CloudServicesPublicIPAddressId is a struct representing the Resource ID for a Cloud Services Public I P Address +type CloudServicesPublicIPAddressId struct { + SubscriptionId string + ResourceGroup string + CloudServiceName string + RoleInstanceName string + NetworkInterfaceName string + IpConfigurationName string + PublicIPAddressName string +} + +// NewCloudServicesPublicIPAddressID returns a new CloudServicesPublicIPAddressId struct +func NewCloudServicesPublicIPAddressID(subscriptionId string, resourceGroup string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, ipConfigurationName string, publicIPAddressName string) CloudServicesPublicIPAddressId { + return CloudServicesPublicIPAddressId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + CloudServiceName: cloudServiceName, + RoleInstanceName: roleInstanceName, + NetworkInterfaceName: networkInterfaceName, + IpConfigurationName: ipConfigurationName, + PublicIPAddressName: publicIPAddressName, + } +} + +// ParseCloudServicesPublicIPAddressID parses 'input' into a CloudServicesPublicIPAddressId +func ParseCloudServicesPublicIPAddressID(input string) (*CloudServicesPublicIPAddressId, error) { + parser := resourceids.NewParserFromResourceIdType(CloudServicesPublicIPAddressId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CloudServicesPublicIPAddressId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'cloudServiceName' was not found in the resource id %q", input) + } + + if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'roleInstanceName' was not found in the resource id %q", input) + } + + if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { + return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input) + } + + if id.IpConfigurationName, ok = parsed.Parsed["ipConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'ipConfigurationName' was not found in the resource id %q", input) + } + + if id.PublicIPAddressName, ok = parsed.Parsed["publicIPAddressName"]; !ok { + return nil, fmt.Errorf("the segment 'publicIPAddressName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseCloudServicesPublicIPAddressIDInsensitively parses 'input' case-insensitively into a CloudServicesPublicIPAddressId +// note: this method should only be used for API response data and not user input +func ParseCloudServicesPublicIPAddressIDInsensitively(input string) (*CloudServicesPublicIPAddressId, error) { + parser := resourceids.NewParserFromResourceIdType(CloudServicesPublicIPAddressId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CloudServicesPublicIPAddressId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'cloudServiceName' was not found in the resource id %q", input) + } + + if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'roleInstanceName' was not found in the resource id %q", input) + } + + if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { + return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input) + } + + if id.IpConfigurationName, ok = parsed.Parsed["ipConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'ipConfigurationName' was not found in the resource id %q", input) + } + + if id.PublicIPAddressName, ok = parsed.Parsed["publicIPAddressName"]; !ok { + return nil, fmt.Errorf("the segment 'publicIPAddressName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateCloudServicesPublicIPAddressID checks that 'input' can be parsed as a Cloud Services Public I P Address ID +func ValidateCloudServicesPublicIPAddressID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCloudServicesPublicIPAddressID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cloud Services Public I P Address ID +func (id CloudServicesPublicIPAddressId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/cloudServices/%s/roleInstances/%s/networkInterfaces/%s/ipConfigurations/%s/publicIPAddresses/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.CloudServiceName, id.RoleInstanceName, id.NetworkInterfaceName, id.IpConfigurationName, id.PublicIPAddressName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cloud Services Public I P Address ID +func (id CloudServicesPublicIPAddressId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("cloudServices", "cloudServices", "cloudServices"), + resourceids.UserSpecifiedSegment("cloudServiceName", "cloudServiceValue"), + resourceids.StaticSegment("roleInstances", "roleInstances", "roleInstances"), + resourceids.UserSpecifiedSegment("roleInstanceName", "roleInstanceValue"), + resourceids.StaticSegment("networkInterfaces", "networkInterfaces", "networkInterfaces"), + resourceids.UserSpecifiedSegment("networkInterfaceName", "networkInterfaceValue"), + resourceids.StaticSegment("ipConfigurations", "ipConfigurations", "ipConfigurations"), + resourceids.UserSpecifiedSegment("ipConfigurationName", "ipConfigurationValue"), + resourceids.StaticSegment("publicIPAddresses", "publicIPAddresses", "publicIPAddresses"), + resourceids.UserSpecifiedSegment("publicIPAddressName", "publicIPAddressValue"), + } +} + +// String returns a human-readable description of this Cloud Services Public I P Address ID +func (id CloudServicesPublicIPAddressId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Cloud Service Name: %q", id.CloudServiceName), + fmt.Sprintf("Role Instance Name: %q", id.RoleInstanceName), + fmt.Sprintf("Network Interface Name: %q", id.NetworkInterfaceName), + fmt.Sprintf("Ip Configuration Name: %q", id.IpConfigurationName), + fmt.Sprintf("Public I P Address Name: %q", id.PublicIPAddressName), + } + return fmt.Sprintf("Cloud Services Public I P Address (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/express_route_circuit_peering.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/express_route_circuit_peering.go new file mode 100644 index 00000000000..3c95470ad57 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/express_route_circuit_peering.go @@ -0,0 +1,137 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ExpressRouteCircuitPeeringId{} + +// ExpressRouteCircuitPeeringId is a struct representing the Resource ID for a Express Route Circuit Peering +type ExpressRouteCircuitPeeringId struct { + SubscriptionId string + ResourceGroup string + CircuitName string + PeeringName string +} + +// NewExpressRouteCircuitPeeringID returns a new ExpressRouteCircuitPeeringId struct +func NewExpressRouteCircuitPeeringID(subscriptionId string, resourceGroup string, circuitName string, peeringName string) ExpressRouteCircuitPeeringId { + return ExpressRouteCircuitPeeringId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + CircuitName: circuitName, + PeeringName: peeringName, + } +} + +// ParseExpressRouteCircuitPeeringID parses 'input' into a ExpressRouteCircuitPeeringId +func ParseExpressRouteCircuitPeeringID(input string) (*ExpressRouteCircuitPeeringId, error) { + parser := resourceids.NewParserFromResourceIdType(ExpressRouteCircuitPeeringId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ExpressRouteCircuitPeeringId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.CircuitName, ok = parsed.Parsed["circuitName"]; !ok { + return nil, fmt.Errorf("the segment 'circuitName' was not found in the resource id %q", input) + } + + if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { + return nil, fmt.Errorf("the segment 'peeringName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseExpressRouteCircuitPeeringIDInsensitively parses 'input' case-insensitively into a ExpressRouteCircuitPeeringId +// note: this method should only be used for API response data and not user input +func ParseExpressRouteCircuitPeeringIDInsensitively(input string) (*ExpressRouteCircuitPeeringId, error) { + parser := resourceids.NewParserFromResourceIdType(ExpressRouteCircuitPeeringId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ExpressRouteCircuitPeeringId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.CircuitName, ok = parsed.Parsed["circuitName"]; !ok { + return nil, fmt.Errorf("the segment 'circuitName' was not found in the resource id %q", input) + } + + if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { + return nil, fmt.Errorf("the segment 'peeringName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateExpressRouteCircuitPeeringID checks that 'input' can be parsed as a Express Route Circuit Peering ID +func ValidateExpressRouteCircuitPeeringID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseExpressRouteCircuitPeeringID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Express Route Circuit Peering ID +func (id ExpressRouteCircuitPeeringId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/expressRouteCircuits/%s/peerings/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.CircuitName, id.PeeringName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Express Route Circuit Peering ID +func (id ExpressRouteCircuitPeeringId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("expressRouteCircuits", "expressRouteCircuits", "expressRouteCircuits"), + resourceids.UserSpecifiedSegment("circuitName", "circuitValue"), + resourceids.StaticSegment("peerings", "peerings", "peerings"), + resourceids.UserSpecifiedSegment("peeringName", "peeringValue"), + } +} + +// String returns a human-readable description of this Express Route Circuit Peering ID +func (id ExpressRouteCircuitPeeringId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Circuit Name: %q", id.CircuitName), + fmt.Sprintf("Peering Name: %q", id.PeeringName), + } + return fmt.Sprintf("Express Route Circuit Peering (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/network_interface.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/network_interface.go new file mode 100644 index 00000000000..a54f1c25aea --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/network_interface.go @@ -0,0 +1,124 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NetworkInterfaceId{} + +// NetworkInterfaceId is a struct representing the Resource ID for a Network Interface +type NetworkInterfaceId struct { + SubscriptionId string + ResourceGroup string + NetworkInterfaceName string +} + +// NewNetworkInterfaceID returns a new NetworkInterfaceId struct +func NewNetworkInterfaceID(subscriptionId string, resourceGroup string, networkInterfaceName string) NetworkInterfaceId { + return NetworkInterfaceId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + NetworkInterfaceName: networkInterfaceName, + } +} + +// ParseNetworkInterfaceID parses 'input' into a NetworkInterfaceId +func ParseNetworkInterfaceID(input string) (*NetworkInterfaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NetworkInterfaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetworkInterfaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { + return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNetworkInterfaceIDInsensitively parses 'input' case-insensitively into a NetworkInterfaceId +// note: this method should only be used for API response data and not user input +func ParseNetworkInterfaceIDInsensitively(input string) (*NetworkInterfaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NetworkInterfaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetworkInterfaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { + return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNetworkInterfaceID checks that 'input' can be parsed as a Network Interface ID +func ValidateNetworkInterfaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNetworkInterfaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Network Interface ID +func (id NetworkInterfaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/networkInterfaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetworkInterfaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Network Interface ID +func (id NetworkInterfaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("networkInterfaces", "networkInterfaces", "networkInterfaces"), + resourceids.UserSpecifiedSegment("networkInterfaceName", "networkInterfaceValue"), + } +} + +// String returns a human-readable description of this Network Interface ID +func (id NetworkInterfaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Network Interface Name: %q", id.NetworkInterfaceName), + } + return fmt.Sprintf("Network Interface (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/network_interface_ip_configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/network_interface_ip_configuration.go new file mode 100644 index 00000000000..5f8d41be65c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/network_interface_ip_configuration.go @@ -0,0 +1,137 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NetworkInterfaceIPConfigurationId{} + +// NetworkInterfaceIPConfigurationId is a struct representing the Resource ID for a Network Interface I P Configuration +type NetworkInterfaceIPConfigurationId struct { + SubscriptionId string + ResourceGroup string + NetworkInterfaceName string + IpConfigurationName string +} + +// NewNetworkInterfaceIPConfigurationID returns a new NetworkInterfaceIPConfigurationId struct +func NewNetworkInterfaceIPConfigurationID(subscriptionId string, resourceGroup string, networkInterfaceName string, ipConfigurationName string) NetworkInterfaceIPConfigurationId { + return NetworkInterfaceIPConfigurationId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + NetworkInterfaceName: networkInterfaceName, + IpConfigurationName: ipConfigurationName, + } +} + +// ParseNetworkInterfaceIPConfigurationID parses 'input' into a NetworkInterfaceIPConfigurationId +func ParseNetworkInterfaceIPConfigurationID(input string) (*NetworkInterfaceIPConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(NetworkInterfaceIPConfigurationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetworkInterfaceIPConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { + return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input) + } + + if id.IpConfigurationName, ok = parsed.Parsed["ipConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'ipConfigurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNetworkInterfaceIPConfigurationIDInsensitively parses 'input' case-insensitively into a NetworkInterfaceIPConfigurationId +// note: this method should only be used for API response data and not user input +func ParseNetworkInterfaceIPConfigurationIDInsensitively(input string) (*NetworkInterfaceIPConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(NetworkInterfaceIPConfigurationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetworkInterfaceIPConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { + return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input) + } + + if id.IpConfigurationName, ok = parsed.Parsed["ipConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'ipConfigurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNetworkInterfaceIPConfigurationID checks that 'input' can be parsed as a Network Interface I P Configuration ID +func ValidateNetworkInterfaceIPConfigurationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNetworkInterfaceIPConfigurationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Network Interface I P Configuration ID +func (id NetworkInterfaceIPConfigurationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/networkInterfaces/%s/ipConfigurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetworkInterfaceName, id.IpConfigurationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Network Interface I P Configuration ID +func (id NetworkInterfaceIPConfigurationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("networkInterfaces", "networkInterfaces", "networkInterfaces"), + resourceids.UserSpecifiedSegment("networkInterfaceName", "networkInterfaceValue"), + resourceids.StaticSegment("ipConfigurations", "ipConfigurations", "ipConfigurations"), + resourceids.UserSpecifiedSegment("ipConfigurationName", "ipConfigurationValue"), + } +} + +// String returns a human-readable description of this Network Interface I P Configuration ID +func (id NetworkInterfaceIPConfigurationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Network Interface Name: %q", id.NetworkInterfaceName), + fmt.Sprintf("Ip Configuration Name: %q", id.IpConfigurationName), + } + return fmt.Sprintf("Network Interface I P Configuration (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/provisioning_service.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/provisioning_service.go new file mode 100644 index 00000000000..a9b4598a40a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/provisioning_service.go @@ -0,0 +1,124 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ProvisioningServiceId{} + +// ProvisioningServiceId is a struct representing the Resource ID for a Provisioning Service +type ProvisioningServiceId struct { + SubscriptionId string + ResourceGroupName string + ProvisioningServiceName string +} + +// NewProvisioningServiceID returns a new ProvisioningServiceId struct +func NewProvisioningServiceID(subscriptionId string, resourceGroupName string, provisioningServiceName string) ProvisioningServiceId { + return ProvisioningServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProvisioningServiceName: provisioningServiceName, + } +} + +// ParseProvisioningServiceID parses 'input' into a ProvisioningServiceId +func ParseProvisioningServiceID(input string) (*ProvisioningServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ProvisioningServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProvisioningServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'provisioningServiceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseProvisioningServiceIDInsensitively parses 'input' case-insensitively into a ProvisioningServiceId +// note: this method should only be used for API response data and not user input +func ParseProvisioningServiceIDInsensitively(input string) (*ProvisioningServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(ProvisioningServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProvisioningServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'provisioningServiceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateProvisioningServiceID checks that 'input' can be parsed as a Provisioning Service ID +func ValidateProvisioningServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProvisioningServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Provisioning Service ID +func (id ProvisioningServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Devices/provisioningServices/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProvisioningServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Provisioning Service ID +func (id ProvisioningServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDevices", "Microsoft.Devices", "Microsoft.Devices"), + resourceids.StaticSegment("staticProvisioningServices", "provisioningServices", "provisioningServices"), + resourceids.UserSpecifiedSegment("provisioningServiceName", "provisioningServiceValue"), + } +} + +// String returns a human-readable description of this Provisioning Service ID +func (id ProvisioningServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Provisioning Service Name: %q", id.ProvisioningServiceName), + } + return fmt.Sprintf("Provisioning Service (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/public_ip_address.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/public_ip_address.go new file mode 100644 index 00000000000..6628ac25826 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/public_ip_address.go @@ -0,0 +1,124 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PublicIPAddressId{} + +// PublicIPAddressId is a struct representing the Resource ID for a Public I P Address +type PublicIPAddressId struct { + SubscriptionId string + ResourceGroup string + PublicIPAddressesName string +} + +// NewPublicIPAddressID returns a new PublicIPAddressId struct +func NewPublicIPAddressID(subscriptionId string, resourceGroup string, publicIPAddressesName string) PublicIPAddressId { + return PublicIPAddressId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + PublicIPAddressesName: publicIPAddressesName, + } +} + +// ParsePublicIPAddressID parses 'input' into a PublicIPAddressId +func ParsePublicIPAddressID(input string) (*PublicIPAddressId, error) { + parser := resourceids.NewParserFromResourceIdType(PublicIPAddressId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PublicIPAddressId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.PublicIPAddressesName, ok = parsed.Parsed["publicIPAddressesName"]; !ok { + return nil, fmt.Errorf("the segment 'publicIPAddressesName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePublicIPAddressIDInsensitively parses 'input' case-insensitively into a PublicIPAddressId +// note: this method should only be used for API response data and not user input +func ParsePublicIPAddressIDInsensitively(input string) (*PublicIPAddressId, error) { + parser := resourceids.NewParserFromResourceIdType(PublicIPAddressId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PublicIPAddressId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.PublicIPAddressesName, ok = parsed.Parsed["publicIPAddressesName"]; !ok { + return nil, fmt.Errorf("the segment 'publicIPAddressesName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePublicIPAddressID checks that 'input' can be parsed as a Public I P Address ID +func ValidatePublicIPAddressID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePublicIPAddressID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Public I P Address ID +func (id PublicIPAddressId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/publicIPAddresses/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.PublicIPAddressesName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Public I P Address ID +func (id PublicIPAddressId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("publicIPAddresses", "publicIPAddresses", "publicIPAddresses"), + resourceids.UserSpecifiedSegment("publicIPAddressesName", "publicIPAddressesValue"), + } +} + +// String returns a human-readable description of this Public I P Address ID +func (id PublicIPAddressId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Public I P Addresses Name: %q", id.PublicIPAddressesName), + } + return fmt.Sprintf("Public I P Address (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_hub_bgp_connection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_hub_bgp_connection.go new file mode 100644 index 00000000000..c72f9c7e35a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_hub_bgp_connection.go @@ -0,0 +1,137 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VirtualHubBGPConnectionId{} + +// VirtualHubBGPConnectionId is a struct representing the Resource ID for a Virtual Hub B G P Connection +type VirtualHubBGPConnectionId struct { + SubscriptionId string + ResourceGroup string + HubName string + ConnectionName string +} + +// NewVirtualHubBGPConnectionID returns a new VirtualHubBGPConnectionId struct +func NewVirtualHubBGPConnectionID(subscriptionId string, resourceGroup string, hubName string, connectionName string) VirtualHubBGPConnectionId { + return VirtualHubBGPConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + HubName: hubName, + ConnectionName: connectionName, + } +} + +// ParseVirtualHubBGPConnectionID parses 'input' into a VirtualHubBGPConnectionId +func ParseVirtualHubBGPConnectionID(input string) (*VirtualHubBGPConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualHubBGPConnectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualHubBGPConnectionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.HubName, ok = parsed.Parsed["hubName"]; !ok { + return nil, fmt.Errorf("the segment 'hubName' was not found in the resource id %q", input) + } + + if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { + return nil, fmt.Errorf("the segment 'connectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVirtualHubBGPConnectionIDInsensitively parses 'input' case-insensitively into a VirtualHubBGPConnectionId +// note: this method should only be used for API response data and not user input +func ParseVirtualHubBGPConnectionIDInsensitively(input string) (*VirtualHubBGPConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualHubBGPConnectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualHubBGPConnectionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.HubName, ok = parsed.Parsed["hubName"]; !ok { + return nil, fmt.Errorf("the segment 'hubName' was not found in the resource id %q", input) + } + + if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { + return nil, fmt.Errorf("the segment 'connectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVirtualHubBGPConnectionID checks that 'input' can be parsed as a Virtual Hub B G P Connection ID +func ValidateVirtualHubBGPConnectionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVirtualHubBGPConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Hub B G P Connection ID +func (id VirtualHubBGPConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/virtualHubs/%s/bgpConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.HubName, id.ConnectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Hub B G P Connection ID +func (id VirtualHubBGPConnectionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("virtualHubs", "virtualHubs", "virtualHubs"), + resourceids.UserSpecifiedSegment("hubName", "hubValue"), + resourceids.StaticSegment("bgpConnections", "bgpConnections", "bgpConnections"), + resourceids.UserSpecifiedSegment("connectionName", "connectionValue"), + } +} + +// String returns a human-readable description of this Virtual Hub B G P Connection ID +func (id VirtualHubBGPConnectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Hub Name: %q", id.HubName), + fmt.Sprintf("Connection Name: %q", id.ConnectionName), + } + return fmt.Sprintf("Virtual Hub B G P Connection (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_hub_ip_configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_hub_ip_configuration.go new file mode 100644 index 00000000000..fd939b70d70 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_hub_ip_configuration.go @@ -0,0 +1,137 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VirtualHubIPConfigurationId{} + +// VirtualHubIPConfigurationId is a struct representing the Resource ID for a Virtual Hub I P Configuration +type VirtualHubIPConfigurationId struct { + SubscriptionId string + ResourceGroup string + VirtualHubName string + IpConfigName string +} + +// NewVirtualHubIPConfigurationID returns a new VirtualHubIPConfigurationId struct +func NewVirtualHubIPConfigurationID(subscriptionId string, resourceGroup string, virtualHubName string, ipConfigName string) VirtualHubIPConfigurationId { + return VirtualHubIPConfigurationId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + VirtualHubName: virtualHubName, + IpConfigName: ipConfigName, + } +} + +// ParseVirtualHubIPConfigurationID parses 'input' into a VirtualHubIPConfigurationId +func ParseVirtualHubIPConfigurationID(input string) (*VirtualHubIPConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualHubIPConfigurationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualHubIPConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualHubName' was not found in the resource id %q", input) + } + + if id.IpConfigName, ok = parsed.Parsed["ipConfigName"]; !ok { + return nil, fmt.Errorf("the segment 'ipConfigName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVirtualHubIPConfigurationIDInsensitively parses 'input' case-insensitively into a VirtualHubIPConfigurationId +// note: this method should only be used for API response data and not user input +func ParseVirtualHubIPConfigurationIDInsensitively(input string) (*VirtualHubIPConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualHubIPConfigurationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualHubIPConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualHubName' was not found in the resource id %q", input) + } + + if id.IpConfigName, ok = parsed.Parsed["ipConfigName"]; !ok { + return nil, fmt.Errorf("the segment 'ipConfigName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVirtualHubIPConfigurationID checks that 'input' can be parsed as a Virtual Hub I P Configuration ID +func ValidateVirtualHubIPConfigurationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVirtualHubIPConfigurationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Hub I P Configuration ID +func (id VirtualHubIPConfigurationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/virtualHubs/%s/ipConfigurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.VirtualHubName, id.IpConfigName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Hub I P Configuration ID +func (id VirtualHubIPConfigurationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("virtualHubs", "virtualHubs", "virtualHubs"), + resourceids.UserSpecifiedSegment("virtualHubName", "virtualHubValue"), + resourceids.StaticSegment("ipConfigurations", "ipConfigurations", "ipConfigurations"), + resourceids.UserSpecifiedSegment("ipConfigName", "ipConfigValue"), + } +} + +// String returns a human-readable description of this Virtual Hub I P Configuration ID +func (id VirtualHubIPConfigurationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Virtual Hub Name: %q", id.VirtualHubName), + fmt.Sprintf("Ip Config Name: %q", id.IpConfigName), + } + return fmt.Sprintf("Virtual Hub I P Configuration (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_ip_configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_ip_configuration.go new file mode 100644 index 00000000000..a0c7e983c6e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_ip_configuration.go @@ -0,0 +1,163 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VirtualMachineScaleSetIPConfigurationId{} + +// VirtualMachineScaleSetIPConfigurationId is a struct representing the Resource ID for a Virtual Machine Scale Set Public I P Address +type VirtualMachineScaleSetIPConfigurationId struct { + SubscriptionId string + ResourceGroup string + VirtualMachineScaleSetName string + VirtualMachineIndex string + NetworkInterfaceName string + IpConfigurationName string +} + +// NewVirtualMachineScaleSetIPConfigurationId returns a new VirtualMachineScaleSetIPConfigurationId struct +func NewVirtualMachineScaleSetIPConfigurationID(subscriptionId string, resourceGroup string, virtualMachineScaleSetName string, virtualMachineIndex string, networkInterfaceName string, ipConfigurationName string) VirtualMachineScaleSetIPConfigurationId { + return VirtualMachineScaleSetIPConfigurationId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + VirtualMachineIndex: virtualMachineIndex, + NetworkInterfaceName: networkInterfaceName, + IpConfigurationName: ipConfigurationName, + } +} + +// ParseVirtualMachineScaleSetIPConfigurationId parses 'input' into a VirtualMachineScaleSetIPConfigurationId +func ParseVirtualMachineScaleSetIPConfigurationId(input string) (*VirtualMachineScaleSetIPConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualMachineScaleSetIPConfigurationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualMachineScaleSetIPConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualMachineScaleSetName' was not found in the resource id %q", input) + } + + if id.VirtualMachineIndex, ok = parsed.Parsed["virtualMachineIndex"]; !ok { + return nil, fmt.Errorf("the segment 'virtualMachineIndex' was not found in the resource id %q", input) + } + + if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { + return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input) + } + + if id.IpConfigurationName, ok = parsed.Parsed["ipConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'ipConfigurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetIPConfigurationIdInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetIPConfigurationId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetIPConfigurationIdInsensitively(input string) (*VirtualMachineScaleSetIPConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualMachineScaleSetIPConfigurationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualMachineScaleSetIPConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualMachineScaleSetName' was not found in the resource id %q", input) + } + + if id.VirtualMachineIndex, ok = parsed.Parsed["virtualMachineIndex"]; !ok { + return nil, fmt.Errorf("the segment 'virtualMachineIndex' was not found in the resource id %q", input) + } + + if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { + return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input) + } + + if id.IpConfigurationName, ok = parsed.Parsed["ipConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'ipConfigurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVirtualMachineScaleSetIPConfigurationId checks that 'input' can be parsed as a Virtual Machine Scale Set Public I P Address ID +func ValidateVirtualMachineScaleSetIPConfigurationId(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVirtualMachineScaleSetIPConfigurationId(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set Public I P Address ID +func (id VirtualMachineScaleSetIPConfigurationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%s/networkInterfaces/%s/ipConfigurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.VirtualMachineScaleSetName, id.VirtualMachineIndex, id.NetworkInterfaceName, id.IpConfigurationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set Public I P Address ID +func (id VirtualMachineScaleSetIPConfigurationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("virtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetValue"), + resourceids.StaticSegment("virtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineIndex", "virtualMachineIndexValue"), + resourceids.StaticSegment("networkInterfaces", "networkInterfaces", "networkInterfaces"), + resourceids.UserSpecifiedSegment("networkInterfaceName", "networkInterfaceValue"), + resourceids.StaticSegment("ipConfigurations", "ipConfigurations", "ipConfigurations"), + resourceids.UserSpecifiedSegment("ipConfigurationName", "ipConfigurationValue"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set Public I P Address ID +func (id VirtualMachineScaleSetIPConfigurationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Virtual Machine Index: %q", id.VirtualMachineIndex), + fmt.Sprintf("Network Interface Name: %q", id.NetworkInterfaceName), + fmt.Sprintf("Ip Configuration Name: %q", id.IpConfigurationName), + } + return fmt.Sprintf("Virtual Machine Scale Set IP Configuration (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_network_interface.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_network_interface.go new file mode 100644 index 00000000000..ba6237064ab --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_network_interface.go @@ -0,0 +1,150 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VirtualMachineScaleSetNetworkInterfaceId{} + +// VirtualMachineScaleSetNetworkInterfaceId is a struct representing the Resource ID for a Virtual Machine Scale Set Network Interface +type VirtualMachineScaleSetNetworkInterfaceId struct { + SubscriptionId string + ResourceGroup string + VirtualMachineScaleSetName string + VirtualMachineIndex string + NetworkInterfaceName string +} + +// NewVirtualMachineScaleSetNetworkInterfaceID returns a new VirtualMachineScaleSetNetworkInterfaceId struct +func NewVirtualMachineScaleSetNetworkInterfaceID(subscriptionId string, resourceGroup string, virtualMachineScaleSetName string, virtualMachineIndex string, networkInterfaceName string) VirtualMachineScaleSetNetworkInterfaceId { + return VirtualMachineScaleSetNetworkInterfaceId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + VirtualMachineIndex: virtualMachineIndex, + NetworkInterfaceName: networkInterfaceName, + } +} + +// ParseVirtualMachineScaleSetNetworkInterfaceID parses 'input' into a VirtualMachineScaleSetNetworkInterfaceId +func ParseVirtualMachineScaleSetNetworkInterfaceID(input string) (*VirtualMachineScaleSetNetworkInterfaceId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualMachineScaleSetNetworkInterfaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualMachineScaleSetNetworkInterfaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualMachineScaleSetName' was not found in the resource id %q", input) + } + + if id.VirtualMachineIndex, ok = parsed.Parsed["virtualMachineIndex"]; !ok { + return nil, fmt.Errorf("the segment 'virtualMachineIndex' was not found in the resource id %q", input) + } + + if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { + return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetNetworkInterfaceIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetNetworkInterfaceId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetNetworkInterfaceIDInsensitively(input string) (*VirtualMachineScaleSetNetworkInterfaceId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualMachineScaleSetNetworkInterfaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualMachineScaleSetNetworkInterfaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualMachineScaleSetName' was not found in the resource id %q", input) + } + + if id.VirtualMachineIndex, ok = parsed.Parsed["virtualMachineIndex"]; !ok { + return nil, fmt.Errorf("the segment 'virtualMachineIndex' was not found in the resource id %q", input) + } + + if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { + return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVirtualMachineScaleSetNetworkInterfaceID checks that 'input' can be parsed as a Virtual Machine Scale Set Network Interface ID +func ValidateVirtualMachineScaleSetNetworkInterfaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVirtualMachineScaleSetNetworkInterfaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set Network Interface ID +func (id VirtualMachineScaleSetNetworkInterfaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%s/networkInterfaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.VirtualMachineScaleSetName, id.VirtualMachineIndex, id.NetworkInterfaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set Network Interface ID +func (id VirtualMachineScaleSetNetworkInterfaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("virtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetValue"), + resourceids.StaticSegment("virtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineIndex", "virtualMachineIndexValue"), + resourceids.StaticSegment("networkInterfaces", "networkInterfaces", "networkInterfaces"), + resourceids.UserSpecifiedSegment("networkInterfaceName", "networkInterfaceValue"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set Network Interface ID +func (id VirtualMachineScaleSetNetworkInterfaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Virtual Machine Index: %q", id.VirtualMachineIndex), + fmt.Sprintf("Network Interface Name: %q", id.NetworkInterfaceName), + } + return fmt.Sprintf("Virtual Machine Scale Set Network Interface (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_public_ip_address.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_public_ip_address.go new file mode 100644 index 00000000000..baf3b011e49 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_machine_scale_set_public_ip_address.go @@ -0,0 +1,176 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VirtualMachineScaleSetPublicIPAddressId{} + +// VirtualMachineScaleSetPublicIPAddressId is a struct representing the Resource ID for a Virtual Machine Scale Set Public I P Address +type VirtualMachineScaleSetPublicIPAddressId struct { + SubscriptionId string + ResourceGroup string + VirtualMachineScaleSetName string + VirtualMachineIndex string + NetworkInterfaceName string + IpConfigurationName string + PublicIpAddressName string +} + +// NewVirtualMachineScaleSetPublicIPAddressID returns a new VirtualMachineScaleSetPublicIPAddressId struct +func NewVirtualMachineScaleSetPublicIPAddressID(subscriptionId string, resourceGroup string, virtualMachineScaleSetName string, virtualMachineIndex string, networkInterfaceName string, ipConfigurationName string, publicIpAddressName string) VirtualMachineScaleSetPublicIPAddressId { + return VirtualMachineScaleSetPublicIPAddressId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + VirtualMachineIndex: virtualMachineIndex, + NetworkInterfaceName: networkInterfaceName, + IpConfigurationName: ipConfigurationName, + PublicIpAddressName: publicIpAddressName, + } +} + +// ParseVirtualMachineScaleSetPublicIPAddressID parses 'input' into a VirtualMachineScaleSetPublicIPAddressId +func ParseVirtualMachineScaleSetPublicIPAddressID(input string) (*VirtualMachineScaleSetPublicIPAddressId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualMachineScaleSetPublicIPAddressId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualMachineScaleSetPublicIPAddressId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualMachineScaleSetName' was not found in the resource id %q", input) + } + + if id.VirtualMachineIndex, ok = parsed.Parsed["virtualMachineIndex"]; !ok { + return nil, fmt.Errorf("the segment 'virtualMachineIndex' was not found in the resource id %q", input) + } + + if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { + return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input) + } + + if id.IpConfigurationName, ok = parsed.Parsed["ipConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'ipConfigurationName' was not found in the resource id %q", input) + } + + if id.PublicIpAddressName, ok = parsed.Parsed["publicIpAddressName"]; !ok { + return nil, fmt.Errorf("the segment 'publicIpAddressName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetPublicIPAddressIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetPublicIPAddressId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetPublicIPAddressIDInsensitively(input string) (*VirtualMachineScaleSetPublicIPAddressId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualMachineScaleSetPublicIPAddressId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualMachineScaleSetPublicIPAddressId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualMachineScaleSetName' was not found in the resource id %q", input) + } + + if id.VirtualMachineIndex, ok = parsed.Parsed["virtualMachineIndex"]; !ok { + return nil, fmt.Errorf("the segment 'virtualMachineIndex' was not found in the resource id %q", input) + } + + if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { + return nil, fmt.Errorf("the segment 'networkInterfaceName' was not found in the resource id %q", input) + } + + if id.IpConfigurationName, ok = parsed.Parsed["ipConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'ipConfigurationName' was not found in the resource id %q", input) + } + + if id.PublicIpAddressName, ok = parsed.Parsed["publicIpAddressName"]; !ok { + return nil, fmt.Errorf("the segment 'publicIpAddressName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVirtualMachineScaleSetPublicIPAddressID checks that 'input' can be parsed as a Virtual Machine Scale Set Public I P Address ID +func ValidateVirtualMachineScaleSetPublicIPAddressID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVirtualMachineScaleSetPublicIPAddressID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set Public I P Address ID +func (id VirtualMachineScaleSetPublicIPAddressId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%s/networkInterfaces/%s/ipConfigurations/%s/publicIPAddresses/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.VirtualMachineScaleSetName, id.VirtualMachineIndex, id.NetworkInterfaceName, id.IpConfigurationName, id.PublicIpAddressName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set Public I P Address ID +func (id VirtualMachineScaleSetPublicIPAddressId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("virtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetValue"), + resourceids.StaticSegment("virtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineIndex", "virtualMachineIndexValue"), + resourceids.StaticSegment("networkInterfaces", "networkInterfaces", "networkInterfaces"), + resourceids.UserSpecifiedSegment("networkInterfaceName", "networkInterfaceValue"), + resourceids.StaticSegment("ipConfigurations", "ipConfigurations", "ipConfigurations"), + resourceids.UserSpecifiedSegment("ipConfigurationName", "ipConfigurationValue"), + resourceids.StaticSegment("publicIPAddresses", "publicIPAddresses", "publicIPAddresses"), + resourceids.UserSpecifiedSegment("publicIpAddressName", "publicIpAddressValue"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set Public I P Address ID +func (id VirtualMachineScaleSetPublicIPAddressId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Virtual Machine Index: %q", id.VirtualMachineIndex), + fmt.Sprintf("Network Interface Name: %q", id.NetworkInterfaceName), + fmt.Sprintf("Ip Configuration Name: %q", id.IpConfigurationName), + fmt.Sprintf("Public Ip Address Name: %q", id.PublicIpAddressName), + } + return fmt.Sprintf("Virtual Machine Scale Set Public IP Address (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_router_peering.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_router_peering.go new file mode 100644 index 00000000000..0a026e000a4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_router_peering.go @@ -0,0 +1,137 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VirtualRouterPeeringId{} + +// VirtualRouterPeeringId is a struct representing the Resource ID for a Virtual Router Peering +type VirtualRouterPeeringId struct { + SubscriptionId string + ResourceGroup string + VirtualRouterName string + PeeringName string +} + +// NewVirtualRouterPeeringID returns a new VirtualRouterPeeringId struct +func NewVirtualRouterPeeringID(subscriptionId string, resourceGroup string, virtualRouterName string, peeringName string) VirtualRouterPeeringId { + return VirtualRouterPeeringId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + VirtualRouterName: virtualRouterName, + PeeringName: peeringName, + } +} + +// ParseVirtualRouterPeeringID parses 'input' into a VirtualRouterPeeringId +func ParseVirtualRouterPeeringID(input string) (*VirtualRouterPeeringId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualRouterPeeringId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualRouterPeeringId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.VirtualRouterName, ok = parsed.Parsed["virtualRouterName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualRouterName' was not found in the resource id %q", input) + } + + if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { + return nil, fmt.Errorf("the segment 'peeringName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVirtualRouterPeeringIDInsensitively parses 'input' case-insensitively into a VirtualRouterPeeringId +// note: this method should only be used for API response data and not user input +func ParseVirtualRouterPeeringIDInsensitively(input string) (*VirtualRouterPeeringId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualRouterPeeringId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualRouterPeeringId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.VirtualRouterName, ok = parsed.Parsed["virtualRouterName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualRouterName' was not found in the resource id %q", input) + } + + if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { + return nil, fmt.Errorf("the segment 'peeringName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVirtualRouterPeeringID checks that 'input' can be parsed as a Virtual Router Peering ID +func ValidateVirtualRouterPeeringID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVirtualRouterPeeringID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Router Peering ID +func (id VirtualRouterPeeringId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/virtualRouters/%s/peerings/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.VirtualRouterName, id.PeeringName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Router Peering ID +func (id VirtualRouterPeeringId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("virtualRouters", "virtualRouters", "virtualRouters"), + resourceids.UserSpecifiedSegment("virtualRouterName", "virtualRouterValue"), + resourceids.StaticSegment("peerings", "peerings", "peerings"), + resourceids.UserSpecifiedSegment("peeringName", "peeringValue"), + } +} + +// String returns a human-readable description of this Virtual Router Peering ID +func (id VirtualRouterPeeringId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Virtual Router Name: %q", id.VirtualRouterName), + fmt.Sprintf("Peering Name: %q", id.PeeringName), + } + return fmt.Sprintf("Virtual Router Peering (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_wan_p2s_vpn_gateway.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_wan_p2s_vpn_gateway.go new file mode 100644 index 00000000000..e87ae5cda59 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/virtual_wan_p2s_vpn_gateway.go @@ -0,0 +1,124 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VirtualWANP2SVPNGatewayId{} + +// VirtualWANP2SVPNGatewayId is a struct representing the Resource ID for a Virtual W A N P 2 S V P N Gateway +type VirtualWANP2SVPNGatewayId struct { + SubscriptionId string + ResourceGroup string + GatewayName string +} + +// NewVirtualWANP2SVPNGatewayID returns a new VirtualWANP2SVPNGatewayId struct +func NewVirtualWANP2SVPNGatewayID(subscriptionId string, resourceGroup string, gatewayName string) VirtualWANP2SVPNGatewayId { + return VirtualWANP2SVPNGatewayId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + GatewayName: gatewayName, + } +} + +// ParseVirtualWANP2SVPNGatewayID parses 'input' into a VirtualWANP2SVPNGatewayId +func ParseVirtualWANP2SVPNGatewayID(input string) (*VirtualWANP2SVPNGatewayId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualWANP2SVPNGatewayId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualWANP2SVPNGatewayId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { + return nil, fmt.Errorf("the segment 'gatewayName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVirtualWANP2SVPNGatewayIDInsensitively parses 'input' case-insensitively into a VirtualWANP2SVPNGatewayId +// note: this method should only be used for API response data and not user input +func ParseVirtualWANP2SVPNGatewayIDInsensitively(input string) (*VirtualWANP2SVPNGatewayId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualWANP2SVPNGatewayId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualWANP2SVPNGatewayId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { + return nil, fmt.Errorf("the segment 'gatewayName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVirtualWANP2SVPNGatewayID checks that 'input' can be parsed as a Virtual W A N P 2 S V P N Gateway ID +func ValidateVirtualWANP2SVPNGatewayID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVirtualWANP2SVPNGatewayID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual W A N P 2 S V P N Gateway ID +func (id VirtualWANP2SVPNGatewayId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/p2sVpnGateways/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.GatewayName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual W A N P 2 S V P N Gateway ID +func (id VirtualWANP2SVPNGatewayId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("p2sVpnGateways", "p2sVpnGateways", "p2sVpnGateways"), + resourceids.UserSpecifiedSegment("gatewayName", "gatewayValue"), + } +} + +// String returns a human-readable description of this Virtual W A N P 2 S V P N Gateway ID +func (id VirtualWANP2SVPNGatewayId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Gateway Name: %q", id.GatewayName), + } + return fmt.Sprintf("Virtual WAN P2S VPN Gateway (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vpn_connection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vpn_connection.go new file mode 100644 index 00000000000..a7cdedbd96f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/commonids/vpn_connection.go @@ -0,0 +1,137 @@ +package commonids + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VPNConnectionId{} + +// VPNConnectionId is a struct representing the Resource ID for a V P N Connection +type VPNConnectionId struct { + SubscriptionId string + ResourceGroup string + GatewayName string + ConnectionName string +} + +// NewVPNConnectionID returns a new VPNConnectionId struct +func NewVPNConnectionID(subscriptionId string, resourceGroup string, gatewayName string, connectionName string) VPNConnectionId { + return VPNConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + GatewayName: gatewayName, + ConnectionName: connectionName, + } +} + +// ParseVPNConnectionID parses 'input' into a VPNConnectionId +func ParseVPNConnectionID(input string) (*VPNConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(VPNConnectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VPNConnectionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { + return nil, fmt.Errorf("the segment 'gatewayName' was not found in the resource id %q", input) + } + + if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { + return nil, fmt.Errorf("the segment 'connectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVPNConnectionIDInsensitively parses 'input' case-insensitively into a VPNConnectionId +// note: this method should only be used for API response data and not user input +func ParseVPNConnectionIDInsensitively(input string) (*VPNConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(VPNConnectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VPNConnectionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { + return nil, fmt.Errorf("the segment 'gatewayName' was not found in the resource id %q", input) + } + + if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { + return nil, fmt.Errorf("the segment 'connectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVPNConnectionID checks that 'input' can be parsed as a V P N Connection ID +func ValidateVPNConnectionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVPNConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted V P N Connection ID +func (id VPNConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/vpnGateways/%s/vpnConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.GatewayName, id.ConnectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this V P N Connection ID +func (id VPNConnectionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("providers", "providers", "providers"), + resourceids.ResourceProviderSegment("resourceProvider", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("vpnGateways", "vpnGateways", "vpnGateways"), + resourceids.UserSpecifiedSegment("gatewayName", "gatewayValue"), + resourceids.StaticSegment("vpnConnections", "vpnConnections", "vpnConnections"), + resourceids.UserSpecifiedSegment("connectionName", "connectionValue"), + } +} + +// String returns a human-readable description of this V P N Connection ID +func (id VPNConnectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Gateway Name: %q", id.GatewayName), + fmt.Sprintf("Connection Name: %q", id.ConnectionName), + } + return fmt.Sprintf("V P N Connection (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_list.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_list.go index 1d6563e1273..c20bba824ad 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_list.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_list.go @@ -45,7 +45,10 @@ func (s *LegacySystemAndUserAssignedList) MarshalJSON() ([]byte, error) { out := map[string]interface{}{ "type": string(identityType), - "userAssignedIdentities": userAssignedIdentityIds, + "userAssignedIdentities": nil, + } + if len(userAssignedIdentityIds) > 0 { + out["userAssignedIdentities"] = userAssignedIdentityIds } return json.Marshal(out) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_map.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_map.go index 570d6c947d1..b0db27d13a5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_map.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/legacy_system_and_user_assigned_map.go @@ -45,7 +45,10 @@ func (s *LegacySystemAndUserAssignedMap) MarshalJSON() ([]byte, error) { out := map[string]interface{}{ "type": string(identityType), - "userAssignedIdentities": userAssignedIdentityIds, + "userAssignedIdentities": nil, + } + if len(userAssignedIdentityIds) > 0 { + out["userAssignedIdentities"] = userAssignedIdentityIds } return json.Marshal(out) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_list.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_list.go index bde209825f3..090e056bbb1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_list.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_list.go @@ -40,7 +40,10 @@ func (s *SystemAndUserAssignedList) MarshalJSON() ([]byte, error) { out := map[string]interface{}{ "type": string(identityType), - "userAssignedIdentities": userAssignedIdentityIds, + "userAssignedIdentities": nil, + } + if len(userAssignedIdentityIds) > 0 { + out["userAssignedIdentities"] = userAssignedIdentityIds } return json.Marshal(out) } @@ -108,3 +111,54 @@ func FlattenSystemAndUserAssignedList(input *SystemAndUserAssignedList) (*[]inte }, }, nil } + +// ExpandSystemAndUserAssignedListFromModel expands the typed schema input into a SystemAndUserAssignedList struct +func ExpandSystemAndUserAssignedListFromModel(input []ModelSystemAssignedUserAssigned) (*SystemAndUserAssignedList, error) { + if len(input) == 0 { + return &SystemAndUserAssignedList{ + Type: TypeNone, + IdentityIds: nil, + }, nil + } + + identity := input[0] + + if len(identity.IdentityIds) > 0 && (identity.Type != TypeSystemAssignedUserAssigned && identity.Type != TypeUserAssigned) { + return nil, fmt.Errorf("`identity_ids` can only be specified when `type` is set to %q or %q", TypeSystemAssignedUserAssigned, TypeUserAssigned) + } + + return &SystemAndUserAssignedList{ + Type: identity.Type, + IdentityIds: identity.IdentityIds, + }, nil +} + +// FlattenSystemAndUserAssignedListToModel turns a SystemAndUserAssignedList into a typed schema model +func FlattenSystemAndUserAssignedListToModel(input *SystemAndUserAssignedList) (*[]ModelSystemAssignedUserAssigned, error) { + if input == nil { + return &[]ModelSystemAssignedUserAssigned{}, nil + } + + input.Type = normalizeType(input.Type) + if input.Type != TypeSystemAssigned && input.Type != TypeSystemAssignedUserAssigned && input.Type != TypeUserAssigned { + return &[]ModelSystemAssignedUserAssigned{}, nil + } + + identityIds := make([]string, 0) + for _, raw := range input.IdentityIds { + id, err := commonids.ParseUserAssignedIdentityIDInsensitively(raw) + if err != nil { + return nil, fmt.Errorf("parsing %q as a User Assigned Identity ID: %+v", raw, err) + } + identityIds = append(identityIds, id.ID()) + } + + return &[]ModelSystemAssignedUserAssigned{ + { + Type: input.Type, + IdentityIds: identityIds, + PrincipalId: input.PrincipalId, + TenantId: input.TenantId, + }, + }, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_map.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_map.go index 4491d30075c..27704de5172 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_map.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_and_user_assigned_map.go @@ -40,7 +40,10 @@ func (s *SystemAndUserAssignedMap) MarshalJSON() ([]byte, error) { out := map[string]interface{}{ "type": string(identityType), - "userAssignedIdentities": userAssignedIdentityIds, + "userAssignedIdentities": nil, + } + if len(userAssignedIdentityIds) > 0 { + out["userAssignedIdentities"] = userAssignedIdentityIds } return json.Marshal(out) } @@ -111,3 +114,61 @@ func FlattenSystemAndUserAssignedMap(input *SystemAndUserAssignedMap) (*[]interf }, }, nil } + +// ExpandSystemAndUserAssignedMapFromModel expands the typed schema input into a SystemAndUserAssignedMap struct +func ExpandSystemAndUserAssignedMapFromModel(input []ModelSystemAssignedUserAssigned) (*SystemAndUserAssignedMap, error) { + if len(input) == 0 { + return &SystemAndUserAssignedMap{ + Type: TypeNone, + IdentityIds: nil, + }, nil + } + + identity := input[0] + + identityIds := make(map[string]UserAssignedIdentityDetails, len(identity.IdentityIds)) + for _, v := range identity.IdentityIds { + identityIds[v] = UserAssignedIdentityDetails{ + // intentionally empty since the expand shouldn't send these values + } + } + if len(identityIds) > 0 && (identity.Type != TypeSystemAssignedUserAssigned && identity.Type != TypeUserAssigned) { + return nil, fmt.Errorf("`identity_ids` can only be specified when `type` is set to %q or %q", TypeSystemAssignedUserAssigned, TypeUserAssigned) + } + + return &SystemAndUserAssignedMap{ + Type: identity.Type, + IdentityIds: identityIds, + }, nil +} + +// FlattenSystemAndUserAssignedMapToModel turns a SystemAndUserAssignedMap into a typed schema model +func FlattenSystemAndUserAssignedMapToModel(input *SystemAndUserAssignedMap) (*[]ModelSystemAssignedUserAssigned, error) { + if input == nil { + return &[]ModelSystemAssignedUserAssigned{}, nil + } + + input.Type = normalizeType(input.Type) + + if input.Type != TypeSystemAssigned && input.Type != TypeSystemAssignedUserAssigned && input.Type != TypeUserAssigned { + return &[]ModelSystemAssignedUserAssigned{}, nil + } + + identityIds := make([]string, 0) + for raw := range input.IdentityIds { + id, err := commonids.ParseUserAssignedIdentityIDInsensitively(raw) + if err != nil { + return nil, fmt.Errorf("parsing %q as a User Assigned Identity ID: %+v", raw, err) + } + identityIds = append(identityIds, id.ID()) + } + + return &[]ModelSystemAssignedUserAssigned{ + { + Type: input.Type, + IdentityIds: identityIds, + PrincipalId: input.PrincipalId, + TenantId: input.TenantId, + }, + }, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_assigned.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_assigned.go index aa1c1c79cad..5bcd7742d82 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_assigned.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_assigned.go @@ -54,3 +54,35 @@ func FlattenSystemAssigned(input *SystemAssigned) []interface{} { }, } } + +func ExpandSystemAssignedFromModel(input []ModelSystemAssigned) (*SystemAssigned, error) { + if len(input) == 0 { + return &SystemAssigned{ + Type: TypeNone, + }, nil + } + + return &SystemAssigned{ + Type: TypeSystemAssigned, + }, nil +} + +func FlattenSystemAssignedToModel(input *SystemAssigned) []ModelSystemAssigned { + if input == nil { + return []ModelSystemAssigned{} + } + + input.Type = normalizeType(input.Type) + + if input.Type == TypeNone { + return []ModelSystemAssigned{} + } + + return []ModelSystemAssigned{ + { + Type: input.Type, + PrincipalId: input.PrincipalId, + TenantId: input.TenantId, + }, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_list.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_list.go index 428c2633f79..c1b631d6321 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_list.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_list.go @@ -37,7 +37,10 @@ func (s *SystemOrUserAssignedList) MarshalJSON() ([]byte, error) { out := map[string]interface{}{ "type": string(identityType), - "userAssignedIdentities": userAssignedIdentityIds, + "userAssignedIdentities": nil, + } + if len(userAssignedIdentityIds) > 0 { + out["userAssignedIdentities"] = userAssignedIdentityIds } return json.Marshal(out) } @@ -102,3 +105,54 @@ func FlattenSystemAssignedOrUserAssignedList(input *SystemOrUserAssignedList) (* }, }, nil } + +// ExpandSystemOrUserAssignedListFromModel expands the typed schema input into a SystemOrUserAssignedList struct +func ExpandSystemOrUserAssignedListFromModel(input []ModelSystemAssignedUserAssigned) (*SystemOrUserAssignedList, error) { + if len(input) == 0 { + return &SystemOrUserAssignedList{ + Type: TypeNone, + IdentityIds: nil, + }, nil + } + + identity := input[0] + + if len(identity.IdentityIds) > 0 && identity.Type != TypeUserAssigned { + return nil, fmt.Errorf("`identity_ids` can only be specified when `type` is set to %q", TypeUserAssigned) + } + + return &SystemOrUserAssignedList{ + Type: identity.Type, + IdentityIds: identity.IdentityIds, + }, nil +} + +// FlattenSystemAssignedOrUserAssignedListToModel turns a SystemOrUserAssignedList into a typed schema model +func FlattenSystemAssignedOrUserAssignedListToModel(input *SystemOrUserAssignedList) (*[]ModelSystemAssignedUserAssigned, error) { + if input == nil { + return &[]ModelSystemAssignedUserAssigned{}, nil + } + + input.Type = normalizeType(input.Type) + if input.Type != TypeSystemAssigned && input.Type != TypeUserAssigned { + return &[]ModelSystemAssignedUserAssigned{}, nil + } + + identityIds := make([]string, 0) + for _, raw := range input.IdentityIds { + id, err := commonids.ParseUserAssignedIdentityIDInsensitively(raw) + if err != nil { + return nil, fmt.Errorf("parsing %q as a User Assigned Identity ID: %+v", raw, err) + } + identityIds = append(identityIds, id.ID()) + } + + return &[]ModelSystemAssignedUserAssigned{ + { + Type: input.Type, + IdentityIds: identityIds, + PrincipalId: input.PrincipalId, + TenantId: input.TenantId, + }, + }, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_map.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_map.go index 0c093d2f644..8db3adc88c6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_map.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/system_or_user_assigned_map.go @@ -37,7 +37,10 @@ func (s *SystemOrUserAssignedMap) MarshalJSON() ([]byte, error) { out := map[string]interface{}{ "type": string(identityType), - "userAssignedIdentities": userAssignedIdentityIds, + "userAssignedIdentities": nil, + } + if len(userAssignedIdentityIds) > 0 { + out["userAssignedIdentities"] = userAssignedIdentityIds } return json.Marshal(out) } @@ -69,10 +72,12 @@ func ExpandSystemOrUserAssignedMap(input []interface{}) (*SystemOrUserAssignedMa return nil, fmt.Errorf("`identity_ids` can only be specified when `type` is set to %q", string(TypeUserAssigned)) } - return &SystemOrUserAssignedMap{ + identity := &SystemOrUserAssignedMap{ Type: identityType, IdentityIds: identityIds, - }, nil + } + + return identity, nil } // FlattenSystemOrUserAssignedMap turns a SystemOrUserAssignedMap into a []interface{} @@ -104,3 +109,60 @@ func FlattenSystemOrUserAssignedMap(input *SystemOrUserAssignedMap) (*[]interfac }, }, nil } + +// ExpandSystemOrUserAssignedMapFromModel expands the typed schema input into a SystemOrUserAssignedMap struct +func ExpandSystemOrUserAssignedMapFromModel(input []ModelSystemAssignedUserAssigned) (*SystemOrUserAssignedMap, error) { + if len(input) == 0 { + return &SystemOrUserAssignedMap{ + Type: TypeNone, + IdentityIds: nil, + }, nil + } + + identity := input[0] + + identityIds := make(map[string]UserAssignedIdentityDetails, len(identity.IdentityIds)) + for _, v := range identity.IdentityIds { + identityIds[v] = UserAssignedIdentityDetails{ + // intentionally empty since the expand shouldn't send these values + } + } + if len(identityIds) > 0 && identity.Type != TypeUserAssigned { + return nil, fmt.Errorf("`identity_ids` can only be specified when `type` is set to %q", TypeUserAssigned) + } + + return &SystemOrUserAssignedMap{ + Type: identity.Type, + IdentityIds: identityIds, + }, nil +} + +// FlattenSystemOrUserAssignedMapToModel turns a SystemOrUserAssignedMap into a typed schema model +func FlattenSystemOrUserAssignedMapToModel(input *SystemOrUserAssignedMap) (*[]ModelSystemAssignedUserAssigned, error) { + if input == nil { + return &[]ModelSystemAssignedUserAssigned{}, nil + } + + input.Type = normalizeType(input.Type) + if input.Type != TypeSystemAssigned && input.Type != TypeUserAssigned { + return &[]ModelSystemAssignedUserAssigned{}, nil + } + + identityIds := make([]string, 0) + for raw := range input.IdentityIds { + id, err := commonids.ParseUserAssignedIdentityIDInsensitively(raw) + if err != nil { + return nil, fmt.Errorf("parsing %q as a User Assigned Identity ID: %+v", raw, err) + } + identityIds = append(identityIds, id.ID()) + } + + return &[]ModelSystemAssignedUserAssigned{ + { + Type: input.Type, + IdentityIds: identityIds, + PrincipalId: input.PrincipalId, + TenantId: input.TenantId, + }, + }, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/tfschema_model.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/tfschema_model.go new file mode 100644 index 00000000000..f787fec169f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/tfschema_model.go @@ -0,0 +1,19 @@ +package identity + +type ModelUserAssigned struct { + Type Type `tfschema:"type"` + IdentityIds []string `tfschema:"identity_ids"` +} + +type ModelSystemAssigned struct { + Type Type `tfschema:"type"` + PrincipalId string `tfschema:"principal_id"` + TenantId string `tfschema:"tenant_id"` +} + +type ModelSystemAssignedUserAssigned struct { + Type Type `tfschema:"type"` + PrincipalId string `tfschema:"principal_id"` + TenantId string `tfschema:"tenant_id"` + IdentityIds []string `tfschema:"identity_ids"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_list.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_list.go index 2a607162790..b3aeb035424 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_list.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_list.go @@ -29,7 +29,10 @@ func (s *UserAssignedList) MarshalJSON() ([]byte, error) { out := map[string]interface{}{ "type": string(identityType), - "userAssignedIdentities": userAssignedIdentityIds, + "userAssignedIdentities": nil, + } + if len(userAssignedIdentityIds) > 0 { + out["userAssignedIdentities"] = userAssignedIdentityIds } return json.Marshal(out) } @@ -90,3 +93,48 @@ func FlattenUserAssignedList(input *UserAssignedList) (*[]interface{}, error) { }, }, nil } + +// ExpandUserAssignedListFromModel expands the typed schema input into a UserAssignedList struct +func ExpandUserAssignedListFromModel(input []ModelUserAssigned) (*UserAssignedList, error) { + if len(input) == 0 { + return &UserAssignedList{ + Type: TypeNone, + IdentityIds: nil, + }, nil + } + + identity := input[0] + return &UserAssignedList{ + Type: identity.Type, + IdentityIds: identity.IdentityIds, + }, nil +} + +// FlattenUserAssignedListToModel turns a UserAssignedList into a typed schema model +func FlattenUserAssignedListToModel(input *UserAssignedList) (*[]ModelUserAssigned, error) { + if input == nil { + return &[]ModelUserAssigned{}, nil + } + + input.Type = normalizeType(input.Type) + + if input.Type != TypeUserAssigned { + return &[]ModelUserAssigned{}, nil + } + + identityIds := make([]string, 0) + for _, raw := range input.IdentityIds { + id, err := commonids.ParseUserAssignedIdentityIDInsensitively(raw) + if err != nil { + return nil, fmt.Errorf("parsing %q as a User Assigned Identity ID: %+v", raw, err) + } + identityIds = append(identityIds, id.ID()) + } + + return &[]ModelUserAssigned{ + { + Type: input.Type, + IdentityIds: identityIds, + }, + }, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_map.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_map.go index 52ac125caac..34cbe87fc31 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_map.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/identity/user_assigned_map.go @@ -29,7 +29,10 @@ func (s *UserAssignedMap) MarshalJSON() ([]byte, error) { out := map[string]interface{}{ "type": string(identityType), - "userAssignedIdentities": userAssignedIdentityIds, + "userAssignedIdentities": nil, + } + if len(userAssignedIdentityIds) > 0 { + out["userAssignedIdentities"] = userAssignedIdentityIds } return json.Marshal(out) } @@ -92,3 +95,56 @@ func FlattenUserAssignedMap(input *UserAssignedMap) (*[]interface{}, error) { }, }, nil } + +// ExpandUserAssignedMapFromModel expands the typed schema input into a UserAssignedMap struct +func ExpandUserAssignedMapFromModel(input []ModelUserAssigned) (*UserAssignedMap, error) { + if len(input) == 0 { + return &UserAssignedMap{ + Type: TypeNone, + IdentityIds: nil, + }, nil + } + + identity := input[0] + + identityIds := make(map[string]UserAssignedIdentityDetails, 0) + for _, v := range identity.IdentityIds { + identityIds[v] = UserAssignedIdentityDetails{ + // intentionally empty since the expand shouldn't send these values + } + } + + return &UserAssignedMap{ + Type: identity.Type, + IdentityIds: identityIds, + }, nil +} + +// FlattenUserAssignedMapToModel turns a UserAssignedMap into a typed schema model +func FlattenUserAssignedMapToModel(input *UserAssignedMap) (*[]ModelUserAssigned, error) { + if input == nil { + return &[]ModelUserAssigned{}, nil + } + + input.Type = normalizeType(input.Type) + + if input.Type != TypeUserAssigned { + return &[]ModelUserAssigned{}, nil + } + + identityIds := make([]string, 0) + for raw := range input.IdentityIds { + id, err := commonids.ParseUserAssignedIdentityIDInsensitively(raw) + if err != nil { + return nil, fmt.Errorf("parsing %q as a User Assigned Identity ID: %+v", raw, err) + } + identityIds = append(identityIds, id.ID()) + } + + return &[]ModelUserAssigned{ + { + Type: input.Type, + IdentityIds: identityIds, + }, + }, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata/model.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata/model.go new file mode 100644 index 00000000000..340c9dc4d6e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata/model.go @@ -0,0 +1,20 @@ +package systemdata + +import "encoding/json" + +var _ json.Marshaler = &SystemData{} + +type SystemData struct { + CreatedBy string `json:"createdBy"` + CreatedByType string `json:"createdByType"` + CreatedAt string `json:"createdAt"` + LastModifiedBy string `json:"lastModifiedBy"` + LastModifiedbyType string `json:"lastModifiedbyType"` + LastModifiedAt string `json:"lastModifiedAt"` +} + +// SystemData is a Read Only type. If Systemdata is part of a request some Azure APIs will ignore it, +// others will return HTTP 400. We're returning nothing on purpose to avoid the error. +func (s *SystemData) MarshalJSON() ([]byte, error) { + return []byte{}, nil +} \ No newline at end of file diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/LICENSE b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/LICENSE new file mode 100644 index 00000000000..a612ad9813b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/NOTICE.txt b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/NOTICE.txt new file mode 100644 index 00000000000..72e35f7f467 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/NOTICE.txt @@ -0,0 +1,13 @@ +Go-Azure-SDK +======= + +The following is a list of sources from which code was used/modified in this codebase. + +-------------------------------------------------------------------------------------- + +This codebase contains a modified portion of code from Microsoft which can be obtained at: + +* SOURCE: + * https://www.github.com/Azure/azure-rest-api-specs +* LICENSE: + * https://github.com/Azure/azure-rest-api-specs/blob/main/LICENSE diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/README.md new file mode 100644 index 00000000000..9aaf46050e0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices` Documentation + +The `domainservices` SDK allows for interaction with the Azure Resource Manager Service `aad` (API Version `2021-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices" +``` + + +### Client Initialization + +```go +client := domainservices.NewDomainServicesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DomainServicesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := domainservices.NewDomainServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "domainServiceValue") + +payload := domainservices.DomainService{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DomainServicesClient.Delete` + +```go +ctx := context.TODO() +id := domainservices.NewDomainServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "domainServiceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DomainServicesClient.Get` + +```go +ctx := context.TODO() +id := domainservices.NewDomainServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "domainServiceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DomainServicesClient.List` + +```go +ctx := context.TODO() +id := domainservices.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DomainServicesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := domainservices.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DomainServicesClient.Update` + +```go +ctx := context.TODO() +id := domainservices.NewDomainServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "domainServiceValue") + +payload := domainservices.DomainService{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/client.go new file mode 100644 index 00000000000..b9d16aba918 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/client.go @@ -0,0 +1,18 @@ +package domainservices + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DomainServicesClient struct { + Client autorest.Client + baseUri string +} + +func NewDomainServicesClientWithBaseURI(endpoint string) DomainServicesClient { + return DomainServicesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/constants.go new file mode 100644 index 00000000000..606ee7bed57 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/constants.go @@ -0,0 +1,382 @@ +package domainservices + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExternalAccess string + +const ( + ExternalAccessDisabled ExternalAccess = "Disabled" + ExternalAccessEnabled ExternalAccess = "Enabled" +) + +func PossibleValuesForExternalAccess() []string { + return []string{ + string(ExternalAccessDisabled), + string(ExternalAccessEnabled), + } +} + +func parseExternalAccess(input string) (*ExternalAccess, error) { + vals := map[string]ExternalAccess{ + "disabled": ExternalAccessDisabled, + "enabled": ExternalAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExternalAccess(input) + return &out, nil +} + +type FilteredSync string + +const ( + FilteredSyncDisabled FilteredSync = "Disabled" + FilteredSyncEnabled FilteredSync = "Enabled" +) + +func PossibleValuesForFilteredSync() []string { + return []string{ + string(FilteredSyncDisabled), + string(FilteredSyncEnabled), + } +} + +func parseFilteredSync(input string) (*FilteredSync, error) { + vals := map[string]FilteredSync{ + "disabled": FilteredSyncDisabled, + "enabled": FilteredSyncEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FilteredSync(input) + return &out, nil +} + +type KerberosArmoring string + +const ( + KerberosArmoringDisabled KerberosArmoring = "Disabled" + KerberosArmoringEnabled KerberosArmoring = "Enabled" +) + +func PossibleValuesForKerberosArmoring() []string { + return []string{ + string(KerberosArmoringDisabled), + string(KerberosArmoringEnabled), + } +} + +func parseKerberosArmoring(input string) (*KerberosArmoring, error) { + vals := map[string]KerberosArmoring{ + "disabled": KerberosArmoringDisabled, + "enabled": KerberosArmoringEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KerberosArmoring(input) + return &out, nil +} + +type KerberosRc4Encryption string + +const ( + KerberosRc4EncryptionDisabled KerberosRc4Encryption = "Disabled" + KerberosRc4EncryptionEnabled KerberosRc4Encryption = "Enabled" +) + +func PossibleValuesForKerberosRc4Encryption() []string { + return []string{ + string(KerberosRc4EncryptionDisabled), + string(KerberosRc4EncryptionEnabled), + } +} + +func parseKerberosRc4Encryption(input string) (*KerberosRc4Encryption, error) { + vals := map[string]KerberosRc4Encryption{ + "disabled": KerberosRc4EncryptionDisabled, + "enabled": KerberosRc4EncryptionEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KerberosRc4Encryption(input) + return &out, nil +} + +type Ldaps string + +const ( + LdapsDisabled Ldaps = "Disabled" + LdapsEnabled Ldaps = "Enabled" +) + +func PossibleValuesForLdaps() []string { + return []string{ + string(LdapsDisabled), + string(LdapsEnabled), + } +} + +func parseLdaps(input string) (*Ldaps, error) { + vals := map[string]Ldaps{ + "disabled": LdapsDisabled, + "enabled": LdapsEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Ldaps(input) + return &out, nil +} + +type NotifyDcAdmins string + +const ( + NotifyDcAdminsDisabled NotifyDcAdmins = "Disabled" + NotifyDcAdminsEnabled NotifyDcAdmins = "Enabled" +) + +func PossibleValuesForNotifyDcAdmins() []string { + return []string{ + string(NotifyDcAdminsDisabled), + string(NotifyDcAdminsEnabled), + } +} + +func parseNotifyDcAdmins(input string) (*NotifyDcAdmins, error) { + vals := map[string]NotifyDcAdmins{ + "disabled": NotifyDcAdminsDisabled, + "enabled": NotifyDcAdminsEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NotifyDcAdmins(input) + return &out, nil +} + +type NotifyGlobalAdmins string + +const ( + NotifyGlobalAdminsDisabled NotifyGlobalAdmins = "Disabled" + NotifyGlobalAdminsEnabled NotifyGlobalAdmins = "Enabled" +) + +func PossibleValuesForNotifyGlobalAdmins() []string { + return []string{ + string(NotifyGlobalAdminsDisabled), + string(NotifyGlobalAdminsEnabled), + } +} + +func parseNotifyGlobalAdmins(input string) (*NotifyGlobalAdmins, error) { + vals := map[string]NotifyGlobalAdmins{ + "disabled": NotifyGlobalAdminsDisabled, + "enabled": NotifyGlobalAdminsEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NotifyGlobalAdmins(input) + return &out, nil +} + +type NtlmV1 string + +const ( + NtlmV1Disabled NtlmV1 = "Disabled" + NtlmV1Enabled NtlmV1 = "Enabled" +) + +func PossibleValuesForNtlmV1() []string { + return []string{ + string(NtlmV1Disabled), + string(NtlmV1Enabled), + } +} + +func parseNtlmV1(input string) (*NtlmV1, error) { + vals := map[string]NtlmV1{ + "disabled": NtlmV1Disabled, + "enabled": NtlmV1Enabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NtlmV1(input) + return &out, nil +} + +type Status string + +const ( + StatusFailure Status = "Failure" + StatusNone Status = "None" + StatusOK Status = "OK" + StatusRunning Status = "Running" + StatusSkipped Status = "Skipped" + StatusWarning Status = "Warning" +) + +func PossibleValuesForStatus() []string { + return []string{ + string(StatusFailure), + string(StatusNone), + string(StatusOK), + string(StatusRunning), + string(StatusSkipped), + string(StatusWarning), + } +} + +func parseStatus(input string) (*Status, error) { + vals := map[string]Status{ + "failure": StatusFailure, + "none": StatusNone, + "ok": StatusOK, + "running": StatusRunning, + "skipped": StatusSkipped, + "warning": StatusWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} + +type SyncKerberosPasswords string + +const ( + SyncKerberosPasswordsDisabled SyncKerberosPasswords = "Disabled" + SyncKerberosPasswordsEnabled SyncKerberosPasswords = "Enabled" +) + +func PossibleValuesForSyncKerberosPasswords() []string { + return []string{ + string(SyncKerberosPasswordsDisabled), + string(SyncKerberosPasswordsEnabled), + } +} + +func parseSyncKerberosPasswords(input string) (*SyncKerberosPasswords, error) { + vals := map[string]SyncKerberosPasswords{ + "disabled": SyncKerberosPasswordsDisabled, + "enabled": SyncKerberosPasswordsEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SyncKerberosPasswords(input) + return &out, nil +} + +type SyncNtlmPasswords string + +const ( + SyncNtlmPasswordsDisabled SyncNtlmPasswords = "Disabled" + SyncNtlmPasswordsEnabled SyncNtlmPasswords = "Enabled" +) + +func PossibleValuesForSyncNtlmPasswords() []string { + return []string{ + string(SyncNtlmPasswordsDisabled), + string(SyncNtlmPasswordsEnabled), + } +} + +func parseSyncNtlmPasswords(input string) (*SyncNtlmPasswords, error) { + vals := map[string]SyncNtlmPasswords{ + "disabled": SyncNtlmPasswordsDisabled, + "enabled": SyncNtlmPasswordsEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SyncNtlmPasswords(input) + return &out, nil +} + +type SyncOnPremPasswords string + +const ( + SyncOnPremPasswordsDisabled SyncOnPremPasswords = "Disabled" + SyncOnPremPasswordsEnabled SyncOnPremPasswords = "Enabled" +) + +func PossibleValuesForSyncOnPremPasswords() []string { + return []string{ + string(SyncOnPremPasswordsDisabled), + string(SyncOnPremPasswordsEnabled), + } +} + +func parseSyncOnPremPasswords(input string) (*SyncOnPremPasswords, error) { + vals := map[string]SyncOnPremPasswords{ + "disabled": SyncOnPremPasswordsDisabled, + "enabled": SyncOnPremPasswordsEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SyncOnPremPasswords(input) + return &out, nil +} + +type TlsV1 string + +const ( + TlsV1Disabled TlsV1 = "Disabled" + TlsV1Enabled TlsV1 = "Enabled" +) + +func PossibleValuesForTlsV1() []string { + return []string{ + string(TlsV1Disabled), + string(TlsV1Enabled), + } +} + +func parseTlsV1(input string) (*TlsV1, error) { + vals := map[string]TlsV1{ + "disabled": TlsV1Disabled, + "enabled": TlsV1Enabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TlsV1(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/id_domainservice.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/id_domainservice.go new file mode 100644 index 00000000000..aeb7add024c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/id_domainservice.go @@ -0,0 +1,124 @@ +package domainservices + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DomainServiceId{} + +// DomainServiceId is a struct representing the Resource ID for a Domain Service +type DomainServiceId struct { + SubscriptionId string + ResourceGroupName string + DomainServiceName string +} + +// NewDomainServiceID returns a new DomainServiceId struct +func NewDomainServiceID(subscriptionId string, resourceGroupName string, domainServiceName string) DomainServiceId { + return DomainServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DomainServiceName: domainServiceName, + } +} + +// ParseDomainServiceID parses 'input' into a DomainServiceId +func ParseDomainServiceID(input string) (*DomainServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(DomainServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DomainServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DomainServiceName, ok = parsed.Parsed["domainServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'domainServiceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDomainServiceIDInsensitively parses 'input' case-insensitively into a DomainServiceId +// note: this method should only be used for API response data and not user input +func ParseDomainServiceIDInsensitively(input string) (*DomainServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(DomainServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DomainServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DomainServiceName, ok = parsed.Parsed["domainServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'domainServiceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDomainServiceID checks that 'input' can be parsed as a Domain Service ID +func ValidateDomainServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDomainServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Domain Service ID +func (id DomainServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AAD/domainServices/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DomainServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Domain Service ID +func (id DomainServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAAD", "Microsoft.AAD", "Microsoft.AAD"), + resourceids.StaticSegment("staticDomainServices", "domainServices", "domainServices"), + resourceids.UserSpecifiedSegment("domainServiceName", "domainServiceValue"), + } +} + +// String returns a human-readable description of this Domain Service ID +func (id DomainServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Domain Service Name: %q", id.DomainServiceName), + } + return fmt.Sprintf("Domain Service (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_createorupdate_autorest.go new file mode 100644 index 00000000000..92c527b0a3f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package domainservices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c DomainServicesClient) CreateOrUpdate(ctx context.Context, id DomainServiceId, input DomainService) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c DomainServicesClient) CreateOrUpdateThenPoll(ctx context.Context, id DomainServiceId, input DomainService) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c DomainServicesClient) preparerForCreateOrUpdate(ctx context.Context, id DomainServiceId, input DomainService) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c DomainServicesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_delete_autorest.go new file mode 100644 index 00000000000..ddb42746d3e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_delete_autorest.go @@ -0,0 +1,78 @@ +package domainservices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c DomainServicesClient) Delete(ctx context.Context, id DomainServiceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DomainServicesClient) DeleteThenPoll(ctx context.Context, id DomainServiceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c DomainServicesClient) preparerForDelete(ctx context.Context, id DomainServiceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c DomainServicesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_get_autorest.go new file mode 100644 index 00000000000..a4fd97543d4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_get_autorest.go @@ -0,0 +1,68 @@ +package domainservices + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *DomainService +} + +// Get ... +func (c DomainServicesClient) Get(ctx context.Context, id DomainServiceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DomainServicesClient) preparerForGet(ctx context.Context, id DomainServiceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DomainServicesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_list_autorest.go new file mode 100644 index 00000000000..a099e99b306 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_list_autorest.go @@ -0,0 +1,187 @@ +package domainservices + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]DomainService + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []DomainService +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c DomainServicesClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c DomainServicesClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AAD/domainServices", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c DomainServicesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c DomainServicesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []DomainService `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c DomainServicesClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, DomainServiceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DomainServicesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DomainServiceOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]DomainService, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..60c33a8fabb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package domainservices + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]DomainService + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []DomainService +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c DomainServicesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c DomainServicesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AAD/domainServices", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c DomainServicesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c DomainServicesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []DomainService `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c DomainServicesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, DomainServiceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DomainServicesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate DomainServiceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]DomainService, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_update_autorest.go new file mode 100644 index 00000000000..1d68fb3aa81 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/method_update_autorest.go @@ -0,0 +1,79 @@ +package domainservices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c DomainServicesClient) Update(ctx context.Context, id DomainServiceId, input DomainService) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "domainservices.DomainServicesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c DomainServicesClient) UpdateThenPoll(ctx context.Context, id DomainServiceId, input DomainService) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c DomainServicesClient) preparerForUpdate(ctx context.Context, id DomainServiceId, input DomainService) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c DomainServicesClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_configdiagnostics.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_configdiagnostics.go new file mode 100644 index 00000000000..4bd1c047c3a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_configdiagnostics.go @@ -0,0 +1,9 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigDiagnostics struct { + LastExecuted *string `json:"lastExecuted,omitempty"` + ValidatorResults *[]ConfigDiagnosticsValidatorResult `json:"validatorResults,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_configdiagnosticsvalidatorresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_configdiagnosticsvalidatorresult.go new file mode 100644 index 00000000000..25159b76c0e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_configdiagnosticsvalidatorresult.go @@ -0,0 +1,11 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigDiagnosticsValidatorResult struct { + Issues *[]ConfigDiagnosticsValidatorResultIssue `json:"issues,omitempty"` + ReplicaSetSubnetDisplayName *string `json:"replicaSetSubnetDisplayName,omitempty"` + Status *Status `json:"status,omitempty"` + ValidatorId *string `json:"validatorId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_configdiagnosticsvalidatorresultissue.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_configdiagnosticsvalidatorresultissue.go new file mode 100644 index 00000000000..f7cfa21f854 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_configdiagnosticsvalidatorresultissue.go @@ -0,0 +1,9 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigDiagnosticsValidatorResultIssue struct { + DescriptionParams *[]string `json:"descriptionParams,omitempty"` + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_domainsecuritysettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_domainsecuritysettings.go new file mode 100644 index 00000000000..e96833e181e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_domainsecuritysettings.go @@ -0,0 +1,14 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DomainSecuritySettings struct { + KerberosArmoring *KerberosArmoring `json:"kerberosArmoring,omitempty"` + KerberosRc4Encryption *KerberosRc4Encryption `json:"kerberosRc4Encryption,omitempty"` + NtlmV1 *NtlmV1 `json:"ntlmV1,omitempty"` + SyncKerberosPasswords *SyncKerberosPasswords `json:"syncKerberosPasswords,omitempty"` + SyncNtlmPasswords *SyncNtlmPasswords `json:"syncNtlmPasswords,omitempty"` + SyncOnPremPasswords *SyncOnPremPasswords `json:"syncOnPremPasswords,omitempty"` + TlsV1 *TlsV1 `json:"tlsV1,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_domainservice.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_domainservice.go new file mode 100644 index 00000000000..01e872cfa6d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_domainservice.go @@ -0,0 +1,19 @@ +package domainservices + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DomainService struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DomainServiceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_domainserviceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_domainserviceproperties.go new file mode 100644 index 00000000000..9825521dce6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_domainserviceproperties.go @@ -0,0 +1,23 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DomainServiceProperties struct { + ConfigDiagnostics *ConfigDiagnostics `json:"configDiagnostics,omitempty"` + DeploymentId *string `json:"deploymentId,omitempty"` + DomainConfigurationType *string `json:"domainConfigurationType,omitempty"` + DomainName *string `json:"domainName,omitempty"` + DomainSecuritySettings *DomainSecuritySettings `json:"domainSecuritySettings,omitempty"` + FilteredSync *FilteredSync `json:"filteredSync,omitempty"` + LdapsSettings *LdapsSettings `json:"ldapsSettings,omitempty"` + MigrationProperties *MigrationProperties `json:"migrationProperties,omitempty"` + NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ReplicaSets *[]ReplicaSet `json:"replicaSets,omitempty"` + ResourceForestSettings *ResourceForestSettings `json:"resourceForestSettings,omitempty"` + Sku *string `json:"sku,omitempty"` + SyncOwner *string `json:"syncOwner,omitempty"` + TenantId *string `json:"tenantId,omitempty"` + Version *int64 `json:"version,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_foresttrust.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_foresttrust.go new file mode 100644 index 00000000000..2e9cc54206d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_foresttrust.go @@ -0,0 +1,12 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForestTrust struct { + FriendlyName *string `json:"friendlyName,omitempty"` + RemoteDnsIPs *string `json:"remoteDnsIps,omitempty"` + TrustDirection *string `json:"trustDirection,omitempty"` + TrustPassword *string `json:"trustPassword,omitempty"` + TrustedDomainFqdn *string `json:"trustedDomainFqdn,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_healthalert.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_healthalert.go new file mode 100644 index 00000000000..f38f86b0c66 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_healthalert.go @@ -0,0 +1,44 @@ +package domainservices + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HealthAlert struct { + Id *string `json:"id,omitempty"` + Issue *string `json:"issue,omitempty"` + LastDetected *string `json:"lastDetected,omitempty"` + Name *string `json:"name,omitempty"` + Raised *string `json:"raised,omitempty"` + ResolutionUri *string `json:"resolutionUri,omitempty"` + Severity *string `json:"severity,omitempty"` +} + +func (o *HealthAlert) GetLastDetectedAsTime() (*time.Time, error) { + if o.LastDetected == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastDetected, "2006-01-02T15:04:05Z07:00") +} + +func (o *HealthAlert) SetLastDetectedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastDetected = &formatted +} + +func (o *HealthAlert) GetRaisedAsTime() (*time.Time, error) { + if o.Raised == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Raised, "2006-01-02T15:04:05Z07:00") +} + +func (o *HealthAlert) SetRaisedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Raised = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_healthmonitor.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_healthmonitor.go new file mode 100644 index 00000000000..602cdc4bda6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_healthmonitor.go @@ -0,0 +1,10 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HealthMonitor struct { + Details *string `json:"details,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_ldapssettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_ldapssettings.go new file mode 100644 index 00000000000..1256ec4a9d7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_ldapssettings.go @@ -0,0 +1,32 @@ +package domainservices + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LdapsSettings struct { + CertificateNotAfter *string `json:"certificateNotAfter,omitempty"` + CertificateThumbprint *string `json:"certificateThumbprint,omitempty"` + ExternalAccess *ExternalAccess `json:"externalAccess,omitempty"` + Ldaps *Ldaps `json:"ldaps,omitempty"` + PfxCertificate *string `json:"pfxCertificate,omitempty"` + PfxCertificatePassword *string `json:"pfxCertificatePassword,omitempty"` + PublicCertificate *string `json:"publicCertificate,omitempty"` +} + +func (o *LdapsSettings) GetCertificateNotAfterAsTime() (*time.Time, error) { + if o.CertificateNotAfter == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CertificateNotAfter, "2006-01-02T15:04:05Z07:00") +} + +func (o *LdapsSettings) SetCertificateNotAfterAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CertificateNotAfter = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_migrationprogress.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_migrationprogress.go new file mode 100644 index 00000000000..6bcb5b61186 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_migrationprogress.go @@ -0,0 +1,9 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrationProgress struct { + CompletionPercentage *float64 `json:"completionPercentage,omitempty"` + ProgressMessage *string `json:"progressMessage,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_migrationproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_migrationproperties.go new file mode 100644 index 00000000000..e8aeabfbe83 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_migrationproperties.go @@ -0,0 +1,10 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrationProperties struct { + MigrationProgress *MigrationProgress `json:"migrationProgress,omitempty"` + OldSubnetId *string `json:"oldSubnetId,omitempty"` + OldVnetSiteId *string `json:"oldVnetSiteId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_notificationsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_notificationsettings.go new file mode 100644 index 00000000000..b7d1bd46d73 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_notificationsettings.go @@ -0,0 +1,10 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationSettings struct { + AdditionalRecipients *[]string `json:"additionalRecipients,omitempty"` + NotifyDcAdmins *NotifyDcAdmins `json:"notifyDcAdmins,omitempty"` + NotifyGlobalAdmins *NotifyGlobalAdmins `json:"notifyGlobalAdmins,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_replicaset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_replicaset.go new file mode 100644 index 00000000000..6bdfa202506 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_replicaset.go @@ -0,0 +1,17 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReplicaSet struct { + DomainControllerIPAddress *[]string `json:"domainControllerIpAddress,omitempty"` + ExternalAccessIPAddress *string `json:"externalAccessIpAddress,omitempty"` + HealthAlerts *[]HealthAlert `json:"healthAlerts,omitempty"` + HealthLastEvaluated *string `json:"healthLastEvaluated,omitempty"` + HealthMonitors *[]HealthMonitor `json:"healthMonitors,omitempty"` + Location *string `json:"location,omitempty"` + ReplicaSetId *string `json:"replicaSetId,omitempty"` + ServiceStatus *string `json:"serviceStatus,omitempty"` + SubnetId *string `json:"subnetId,omitempty"` + VnetSiteId *string `json:"vnetSiteId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_resourceforestsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_resourceforestsettings.go new file mode 100644 index 00000000000..5a9f02dc80f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/model_resourceforestsettings.go @@ -0,0 +1,9 @@ +package domainservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceForestSettings struct { + ResourceForest *string `json:"resourceForest,omitempty"` + Settings *[]ForestTrust `json:"settings,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/predicates.go new file mode 100644 index 00000000000..180f3360ea5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/predicates.go @@ -0,0 +1,34 @@ +package domainservices + +type DomainServiceOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p DomainServiceOperationPredicate) Matches(input DomainService) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/version.go new file mode 100644 index 00000000000..5bd9e4b8ecd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices/version.go @@ -0,0 +1,12 @@ +package domainservices + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/domainservices/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/README.md new file mode 100644 index 00000000000..5a2c76106c3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/README.md @@ -0,0 +1,141 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants` Documentation + +The `tenants` SDK allows for interaction with the Azure Resource Manager Service `aadb2c` (API Version `2021-04-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants" +``` + + +### Client Initialization + +```go +client := tenants.NewTenantsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `TenantsClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := tenants.NewSubscriptionID() + +payload := tenants.CheckNameAvailabilityRequest{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TenantsClient.Create` + +```go +ctx := context.TODO() +id := tenants.NewB2CDirectoryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "directoryValue") + +payload := tenants.CreateTenant{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `TenantsClient.Delete` + +```go +ctx := context.TODO() +id := tenants.NewB2CDirectoryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "directoryValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `TenantsClient.Get` + +```go +ctx := context.TODO() +id := tenants.NewB2CDirectoryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "directoryValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TenantsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := tenants.NewResourceGroupID() + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `TenantsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := tenants.NewSubscriptionID() + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `TenantsClient.Update` + +```go +ctx := context.TODO() +id := tenants.NewB2CDirectoryID("12345678-1234-9876-4563-123456789012", "example-resource-group", "directoryValue") + +payload := tenants.UpdateTenant{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/client.go new file mode 100644 index 00000000000..6aa427b9d76 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/client.go @@ -0,0 +1,18 @@ +package tenants + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TenantsClient struct { + Client autorest.Client + baseUri string +} + +func NewTenantsClientWithBaseURI(endpoint string) TenantsClient { + return TenantsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/constants.go new file mode 100644 index 00000000000..dff1cef307e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/constants.go @@ -0,0 +1,127 @@ +package tenants + +import "strings" + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BillingType string + +const ( + BillingTypeAuths BillingType = "auths" + BillingTypeMonthlyActiveUsers BillingType = "mau" +) + +func PossibleValuesForBillingType() []string { + return []string{ + string(BillingTypeAuths), + string(BillingTypeMonthlyActiveUsers), + } +} + +func parseBillingType(input string) (*BillingType, error) { + vals := map[string]BillingType{ + "auths": BillingTypeAuths, + "mau": BillingTypeMonthlyActiveUsers, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BillingType(input) + return &out, nil +} + +type Location string + +const ( + LocationAsiaPacific Location = "Asia Pacific" + LocationAustralia Location = "Australia" + LocationEurope Location = "Europe" + LocationGlobal Location = "Global" + LocationUnitedStates Location = "United States" +) + +func PossibleValuesForLocation() []string { + return []string{ + string(LocationAsiaPacific), + string(LocationAustralia), + string(LocationEurope), + string(LocationGlobal), + string(LocationUnitedStates), + } +} + +func parseLocation(input string) (*Location, error) { + vals := map[string]Location{ + "asia pacific": LocationAsiaPacific, + "australia": LocationAustralia, + "europe": LocationEurope, + "global": LocationGlobal, + "united states": LocationUnitedStates, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Location(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNamePremiumP1 SkuName = "PremiumP1" + SkuNamePremiumP2 SkuName = "PremiumP2" + SkuNameStandard SkuName = "Standard" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNamePremiumP1), + string(SkuNamePremiumP2), + string(SkuNameStandard), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "premiump1": SkuNamePremiumP1, + "premiump2": SkuNamePremiumP2, + "standard": SkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierA0 SkuTier = "A0" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierA0), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "a0": SkuTierA0, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/id_b2cdirectory.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/id_b2cdirectory.go similarity index 96% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/id_b2cdirectory.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/id_b2cdirectory.go index e04fcd3ed5b..ab25ebf8430 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/id_b2cdirectory.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/id_b2cdirectory.go @@ -107,7 +107,7 @@ func (id B2CDirectoryId) Segments() []resourceids.Segment { resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.StaticSegment("microsoftAzureActiveDirectory", "Microsoft.AzureActiveDirectory", "Microsoft.AzureActiveDirectory"), + resourceids.ResourceProviderSegment("microsoftAzureActiveDirectory", "Microsoft.AzureActiveDirectory", "Microsoft.AzureActiveDirectory"), resourceids.StaticSegment("b2cDirectories", "b2cDirectories", "b2cDirectories"), resourceids.UserSpecifiedSegment("directoryName", "directoryValue"), } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_checknameavailability_autorest.go new file mode 100644 index 00000000000..b890022e9ac --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_checknameavailability_autorest.go @@ -0,0 +1,71 @@ +package tenants + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameAvailabilityResult +} + +// CheckNameAvailability ... +func (c TenantsClient) CheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckNameAvailabilityRequest) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c TenantsClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckNameAvailabilityRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AzureActiveDirectory/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c TenantsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_create_autorest.go new file mode 100644 index 00000000000..6f1bcafe181 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_create_autorest.go @@ -0,0 +1,79 @@ +package tenants + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c TenantsClient) Create(ctx context.Context, id B2CDirectoryId, input CreateTenant) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c TenantsClient) CreateThenPoll(ctx context.Context, id B2CDirectoryId, input CreateTenant) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c TenantsClient) preparerForCreate(ctx context.Context, id B2CDirectoryId, input CreateTenant) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c TenantsClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_delete_autorest.go new file mode 100644 index 00000000000..336482ec7a8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_delete_autorest.go @@ -0,0 +1,78 @@ +package tenants + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c TenantsClient) Delete(ctx context.Context, id B2CDirectoryId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c TenantsClient) DeleteThenPoll(ctx context.Context, id B2CDirectoryId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c TenantsClient) preparerForDelete(ctx context.Context, id B2CDirectoryId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c TenantsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_get_autorest.go new file mode 100644 index 00000000000..467e36f742d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_get_autorest.go @@ -0,0 +1,68 @@ +package tenants + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Tenant +} + +// Get ... +func (c TenantsClient) Get(ctx context.Context, id B2CDirectoryId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c TenantsClient) preparerForGet(ctx context.Context, id B2CDirectoryId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c TenantsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..0a907d86aa5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package tenants + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Tenant + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Tenant +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c TenantsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c TenantsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AzureActiveDirectory/b2cDirectories", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c TenantsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c TenantsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Tenant `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c TenantsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, TenantOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c TenantsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate TenantOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Tenant, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..5716d14ea91 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package tenants + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Tenant + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []Tenant +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c TenantsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c TenantsClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AzureActiveDirectory/b2cDirectories", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c TenantsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c TenantsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Tenant `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c TenantsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, TenantOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c TenantsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate TenantOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]Tenant, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_update_autorest.go new file mode 100644 index 00000000000..24a8221326e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/method_update_autorest.go @@ -0,0 +1,69 @@ +package tenants + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Tenant +} + +// Update ... +func (c TenantsClient) Update(ctx context.Context, id B2CDirectoryId, input UpdateTenant) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c TenantsClient) preparerForUpdate(ctx context.Context, id B2CDirectoryId, input UpdateTenant) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c TenantsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_billingconfig.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_billingconfig.go new file mode 100644 index 00000000000..656c7e2ad19 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_billingconfig.go @@ -0,0 +1,9 @@ +package tenants + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BillingConfig struct { + BillingType *BillingType `json:"billingType,omitempty"` + EffectiveStartDateUtc *string `json:"effectiveStartDateUtc,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_checknameavailabilityrequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_checknameavailabilityrequest.go new file mode 100644 index 00000000000..d6e5f28f9fe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_checknameavailabilityrequest.go @@ -0,0 +1,9 @@ +package tenants + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityRequest struct { + CountryCode *string `json:"countryCode,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_checknameavailabilityresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_checknameavailabilityresult.go new file mode 100644 index 00000000000..fddebdf375d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_checknameavailabilityresult.go @@ -0,0 +1,10 @@ +package tenants + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityResult struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *string `json:"reason,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_createtenant.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_createtenant.go new file mode 100644 index 00000000000..e0816c62929 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_createtenant.go @@ -0,0 +1,11 @@ +package tenants + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateTenant struct { + Location Location `json:"location"` + Properties TenantPropertiesForCreate `json:"properties"` + Sku Sku `json:"sku"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_createtenantproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_createtenantproperties.go new file mode 100644 index 00000000000..2353d1e6006 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_createtenantproperties.go @@ -0,0 +1,9 @@ +package tenants + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateTenantProperties struct { + CountryCode string `json:"countryCode"` + DisplayName string `json:"displayName"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_sku.go new file mode 100644 index 00000000000..118d8ed8fcf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_sku.go @@ -0,0 +1,9 @@ +package tenants + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name SkuName `json:"name"` + Tier SkuTier `json:"tier"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_tenant.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_tenant.go new file mode 100644 index 00000000000..7ad28547288 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_tenant.go @@ -0,0 +1,14 @@ +package tenants + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Tenant struct { + Id *string `json:"id,omitempty"` + Location *Location `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *TenantProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_tenantproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_tenantproperties.go new file mode 100644 index 00000000000..bd2fddbf5de --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_tenantproperties.go @@ -0,0 +1,11 @@ +package tenants + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TenantProperties struct { + BillingConfig *BillingConfig `json:"billingConfig,omitempty"` + CountryCode *string `json:"countryCode,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_tenantpropertiesforcreate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_tenantpropertiesforcreate.go new file mode 100644 index 00000000000..efdd9598863 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_tenantpropertiesforcreate.go @@ -0,0 +1,8 @@ +package tenants + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TenantPropertiesForCreate struct { + CreateTenantProperties CreateTenantProperties `json:"createTenantProperties"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_updatetenant.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_updatetenant.go new file mode 100644 index 00000000000..f1120caff18 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_updatetenant.go @@ -0,0 +1,10 @@ +package tenants + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateTenant struct { + Properties UpdateTenantProperties `json:"properties"` + Sku Sku `json:"sku"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_updatetenantproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_updatetenantproperties.go new file mode 100644 index 00000000000..326070874b7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/model_updatetenantproperties.go @@ -0,0 +1,8 @@ +package tenants + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateTenantProperties struct { + BillingConfig *BillingConfig `json:"billingConfig,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/predicates.go new file mode 100644 index 00000000000..5582abdc372 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/predicates.go @@ -0,0 +1,24 @@ +package tenants + +type TenantOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p TenantOperationPredicate) Matches(input Tenant) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/version.go new file mode 100644 index 00000000000..b20b9e33589 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants/version.go @@ -0,0 +1,12 @@ +package tenants + +import "fmt" + +// Copyright (c) HashiCorp Inc. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-04-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/tenants/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/README.md new file mode 100644 index 00000000000..5850fe1f2c3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/README.md @@ -0,0 +1,207 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers` Documentation + +The `servers` SDK allows for interaction with the Azure Resource Manager Service `analysisservices` (API Version `2017-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers" +``` + + +### Client Initialization + +```go +client := servers.NewServersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServersClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := servers.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +payload := servers.CheckServerNameAvailabilityParameters{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.Create` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := servers.AnalysisServicesServer{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServersClient.Delete` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServersClient.DissociateGateway` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.DissociateGateway(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.GetDetails` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.GetDetails(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.List` + +```go +ctx := context.TODO() +id := servers.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := servers.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.ListByResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.ListGatewayStatus` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.ListGatewayStatus(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.ListSkusForExisting` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.ListSkusForExisting(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.Resume` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +if err := client.ResumeThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServersClient.Suspend` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +if err := client.SuspendThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServersClient.Update` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := servers.AnalysisServicesServerUpdateParameters{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/client.go new file mode 100644 index 00000000000..fd9e02ba599 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/client.go @@ -0,0 +1,18 @@ +package servers + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServersClient struct { + Client autorest.Client + baseUri string +} + +func NewServersClientWithBaseURI(endpoint string) ServersClient { + return ServersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/constants.go new file mode 100644 index 00000000000..0b6f058a050 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/constants.go @@ -0,0 +1,262 @@ +package servers + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectionMode string + +const ( + ConnectionModeAll ConnectionMode = "All" + ConnectionModeReadOnly ConnectionMode = "ReadOnly" +) + +func PossibleValuesForConnectionMode() []string { + return []string{ + string(ConnectionModeAll), + string(ConnectionModeReadOnly), + } +} + +func parseConnectionMode(input string) (*ConnectionMode, error) { + vals := map[string]ConnectionMode{ + "all": ConnectionModeAll, + "readonly": ConnectionModeReadOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConnectionMode(input) + return &out, nil +} + +type ManagedMode int64 + +const ( + ManagedModeOne ManagedMode = 1 + ManagedModeZero ManagedMode = 0 +) + +func PossibleValuesForManagedMode() []int64 { + return []int64{ + int64(ManagedModeOne), + int64(ManagedModeZero), + } +} + +func parseManagedMode(input int64) (*ManagedMode, error) { + vals := map[int64]ManagedMode{ + 1: ManagedModeOne, + 0: ManagedModeZero, + } + if v, ok := vals[input]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ManagedMode(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStatePaused ProvisioningState = "Paused" + ProvisioningStatePausing ProvisioningState = "Pausing" + ProvisioningStatePreparing ProvisioningState = "Preparing" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateResuming ProvisioningState = "Resuming" + ProvisioningStateScaling ProvisioningState = "Scaling" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateSuspended ProvisioningState = "Suspended" + ProvisioningStateSuspending ProvisioningState = "Suspending" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStatePaused), + string(ProvisioningStatePausing), + string(ProvisioningStatePreparing), + string(ProvisioningStateProvisioning), + string(ProvisioningStateResuming), + string(ProvisioningStateScaling), + string(ProvisioningStateSucceeded), + string(ProvisioningStateSuspended), + string(ProvisioningStateSuspending), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "paused": ProvisioningStatePaused, + "pausing": ProvisioningStatePausing, + "preparing": ProvisioningStatePreparing, + "provisioning": ProvisioningStateProvisioning, + "resuming": ProvisioningStateResuming, + "scaling": ProvisioningStateScaling, + "succeeded": ProvisioningStateSucceeded, + "suspended": ProvisioningStateSuspended, + "suspending": ProvisioningStateSuspending, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type ServerMonitorMode int64 + +const ( + ServerMonitorModeOne ServerMonitorMode = 1 + ServerMonitorModeZero ServerMonitorMode = 0 +) + +func PossibleValuesForServerMonitorMode() []int64 { + return []int64{ + int64(ServerMonitorModeOne), + int64(ServerMonitorModeZero), + } +} + +func parseServerMonitorMode(input int64) (*ServerMonitorMode, error) { + vals := map[int64]ServerMonitorMode{ + 1: ServerMonitorModeOne, + 0: ServerMonitorModeZero, + } + if v, ok := vals[input]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerMonitorMode(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierDevelopment SkuTier = "Development" + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierDevelopment), + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "development": SkuTierDevelopment, + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} + +type State string + +const ( + StateDeleting State = "Deleting" + StateFailed State = "Failed" + StatePaused State = "Paused" + StatePausing State = "Pausing" + StatePreparing State = "Preparing" + StateProvisioning State = "Provisioning" + StateResuming State = "Resuming" + StateScaling State = "Scaling" + StateSucceeded State = "Succeeded" + StateSuspended State = "Suspended" + StateSuspending State = "Suspending" + StateUpdating State = "Updating" +) + +func PossibleValuesForState() []string { + return []string{ + string(StateDeleting), + string(StateFailed), + string(StatePaused), + string(StatePausing), + string(StatePreparing), + string(StateProvisioning), + string(StateResuming), + string(StateScaling), + string(StateSucceeded), + string(StateSuspended), + string(StateSuspending), + string(StateUpdating), + } +} + +func parseState(input string) (*State, error) { + vals := map[string]State{ + "deleting": StateDeleting, + "failed": StateFailed, + "paused": StatePaused, + "pausing": StatePausing, + "preparing": StatePreparing, + "provisioning": StateProvisioning, + "resuming": StateResuming, + "scaling": StateScaling, + "succeeded": StateSucceeded, + "suspended": StateSuspended, + "suspending": StateSuspending, + "updating": StateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := State(input) + return &out, nil +} + +type Status int64 + +const ( + StatusZero Status = 0 +) + +func PossibleValuesForStatus() []int64 { + return []int64{ + int64(StatusZero), + } +} + +func parseStatus(input int64) (*Status, error) { + vals := map[int64]Status{ + 0: StatusZero, + } + if v, ok := vals[input]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/id_location.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/id_location.go new file mode 100644 index 00000000000..28c592f876c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/id_location.go @@ -0,0 +1,111 @@ +package servers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + Location string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, location string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + Location: location, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.AnalysisServices/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAnalysisServices", "Microsoft.AnalysisServices", "Microsoft.AnalysisServices"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("location", "locationValue"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location: %q", id.Location), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/id_server.go new file mode 100644 index 00000000000..1f1254ed332 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/id_server.go @@ -0,0 +1,124 @@ +package servers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AnalysisServices/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAnalysisServices", "Microsoft.AnalysisServices", "Microsoft.AnalysisServices"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_checknameavailability_autorest.go new file mode 100644 index 00000000000..cd070769727 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_checknameavailability_autorest.go @@ -0,0 +1,70 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckServerNameAvailabilityResult +} + +// CheckNameAvailability ... +func (c ServersClient) CheckNameAvailability(ctx context.Context, id LocationId, input CheckServerNameAvailabilityParameters) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c ServersClient) preparerForCheckNameAvailability(ctx context.Context, id LocationId, input CheckServerNameAvailabilityParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c ServersClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_create_autorest.go new file mode 100644 index 00000000000..0c71d5e4964 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_create_autorest.go @@ -0,0 +1,79 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c ServersClient) Create(ctx context.Context, id ServerId, input AnalysisServicesServer) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c ServersClient) CreateThenPoll(ctx context.Context, id ServerId, input AnalysisServicesServer) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c ServersClient) preparerForCreate(ctx context.Context, id ServerId, input AnalysisServicesServer) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c ServersClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_delete_autorest.go new file mode 100644 index 00000000000..f4e5bea63be --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_delete_autorest.go @@ -0,0 +1,78 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ServersClient) Delete(ctx context.Context, id ServerId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ServersClient) DeleteThenPoll(ctx context.Context, id ServerId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ServersClient) preparerForDelete(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ServersClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_dissociategateway_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_dissociategateway_autorest.go similarity index 84% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_dissociategateway_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_dissociategateway_autorest.go index ca5857a5636..355568d52b6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_dissociategateway_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_dissociategateway_autorest.go @@ -9,12 +9,15 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type DissociateGatewayResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DissociateGatewayOperationResponse struct { HttpResponse *http.Response } // DissociateGateway ... -func (c ServersClient) DissociateGateway(ctx context.Context, id ServerId) (result DissociateGatewayResponse, err error) { +func (c ServersClient) DissociateGateway(ctx context.Context, id ServerId) (result DissociateGatewayOperationResponse, err error) { req, err := c.preparerForDissociateGateway(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "servers.ServersClient", "DissociateGateway", nil, "Failure preparing request") @@ -53,11 +56,12 @@ func (c ServersClient) preparerForDissociateGateway(ctx context.Context, id Serv // responderForDissociateGateway handles the response to the DissociateGateway request. The method always // closes the http.Response Body. -func (c ServersClient) responderForDissociateGateway(resp *http.Response) (result DissociateGatewayResponse, err error) { +func (c ServersClient) responderForDissociateGateway(resp *http.Response) (result DissociateGatewayOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_getdetails_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_getdetails_autorest.go new file mode 100644 index 00000000000..9c44269c368 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_getdetails_autorest.go @@ -0,0 +1,68 @@ +package servers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDetailsOperationResponse struct { + HttpResponse *http.Response + Model *AnalysisServicesServer +} + +// GetDetails ... +func (c ServersClient) GetDetails(ctx context.Context, id ServerId) (result GetDetailsOperationResponse, err error) { + req, err := c.preparerForGetDetails(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "GetDetails", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "GetDetails", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetDetails(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "GetDetails", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetDetails prepares the GetDetails request. +func (c ServersClient) preparerForGetDetails(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetDetails handles the response to the GetDetails request. The method always +// closes the http.Response Body. +func (c ServersClient) responderForGetDetails(resp *http.Response) (result GetDetailsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_list_autorest.go new file mode 100644 index 00000000000..f09be9dd666 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_list_autorest.go @@ -0,0 +1,70 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *AnalysisServicesServers +} + +// List ... +func (c ServersClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c ServersClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AnalysisServices/servers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ServersClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..38696c300d5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_listbyresourcegroup_autorest.go @@ -0,0 +1,70 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *AnalysisServicesServers +} + +// ListByResourceGroup ... +func (c ServersClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ServersClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AnalysisServices/servers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ServersClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_listgatewaystatus_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_listgatewaystatus_autorest.go similarity index 85% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_listgatewaystatus_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_listgatewaystatus_autorest.go index 3eb169d2a44..acfc2e1e13d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_listgatewaystatus_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_listgatewaystatus_autorest.go @@ -9,13 +9,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type ListGatewayStatusResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListGatewayStatusOperationResponse struct { HttpResponse *http.Response Model *GatewayListStatusLive } // ListGatewayStatus ... -func (c ServersClient) ListGatewayStatus(ctx context.Context, id ServerId) (result ListGatewayStatusResponse, err error) { +func (c ServersClient) ListGatewayStatus(ctx context.Context, id ServerId) (result ListGatewayStatusOperationResponse, err error) { req, err := c.preparerForListGatewayStatus(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListGatewayStatus", nil, "Failure preparing request") @@ -54,12 +57,13 @@ func (c ServersClient) preparerForListGatewayStatus(ctx context.Context, id Serv // responderForListGatewayStatus handles the response to the ListGatewayStatus request. The method always // closes the http.Response Body. -func (c ServersClient) responderForListGatewayStatus(resp *http.Response) (result ListGatewayStatusResponse, err error) { +func (c ServersClient) responderForListGatewayStatus(resp *http.Response) (result ListGatewayStatusOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_listskusforexisting_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_listskusforexisting_autorest.go similarity index 85% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_listskusforexisting_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_listskusforexisting_autorest.go index 4dd74773a4d..85712cdb98d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_listskusforexisting_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_listskusforexisting_autorest.go @@ -9,13 +9,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type ListSkusForExistingResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSkusForExistingOperationResponse struct { HttpResponse *http.Response Model *SkuEnumerationForExistingResourceResult } // ListSkusForExisting ... -func (c ServersClient) ListSkusForExisting(ctx context.Context, id ServerId) (result ListSkusForExistingResponse, err error) { +func (c ServersClient) ListSkusForExisting(ctx context.Context, id ServerId) (result ListSkusForExistingOperationResponse, err error) { req, err := c.preparerForListSkusForExisting(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListSkusForExisting", nil, "Failure preparing request") @@ -54,12 +57,13 @@ func (c ServersClient) preparerForListSkusForExisting(ctx context.Context, id Se // responderForListSkusForExisting handles the response to the ListSkusForExisting request. The method always // closes the http.Response Body. -func (c ServersClient) responderForListSkusForExisting(resp *http.Response) (result ListSkusForExistingResponse, err error) { +func (c ServersClient) responderForListSkusForExisting(resp *http.Response) (result ListSkusForExistingOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_resume_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_resume_autorest.go new file mode 100644 index 00000000000..3892983b9c6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_resume_autorest.go @@ -0,0 +1,78 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResumeOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Resume ... +func (c ServersClient) Resume(ctx context.Context, id ServerId) (result ResumeOperationResponse, err error) { + req, err := c.preparerForResume(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Resume", nil, "Failure preparing request") + return + } + + result, err = c.senderForResume(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Resume", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ResumeThenPoll performs Resume then polls until it's completed +func (c ServersClient) ResumeThenPoll(ctx context.Context, id ServerId) error { + result, err := c.Resume(ctx, id) + if err != nil { + return fmt.Errorf("performing Resume: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Resume: %+v", err) + } + + return nil +} + +// preparerForResume prepares the Resume request. +func (c ServersClient) preparerForResume(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/resume", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForResume sends the Resume request. The method will close the +// http.Response Body if it receives an error. +func (c ServersClient) senderForResume(ctx context.Context, req *http.Request) (future ResumeOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_suspend_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_suspend_autorest.go new file mode 100644 index 00000000000..659062d2924 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_suspend_autorest.go @@ -0,0 +1,78 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SuspendOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Suspend ... +func (c ServersClient) Suspend(ctx context.Context, id ServerId) (result SuspendOperationResponse, err error) { + req, err := c.preparerForSuspend(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Suspend", nil, "Failure preparing request") + return + } + + result, err = c.senderForSuspend(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Suspend", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// SuspendThenPoll performs Suspend then polls until it's completed +func (c ServersClient) SuspendThenPoll(ctx context.Context, id ServerId) error { + result, err := c.Suspend(ctx, id) + if err != nil { + return fmt.Errorf("performing Suspend: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Suspend: %+v", err) + } + + return nil +} + +// preparerForSuspend prepares the Suspend request. +func (c ServersClient) preparerForSuspend(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/suspend", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForSuspend sends the Suspend request. The method will close the +// http.Response Body if it receives an error. +func (c ServersClient) senderForSuspend(ctx context.Context, req *http.Request) (future SuspendOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_update_autorest.go new file mode 100644 index 00000000000..2f88f658430 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/method_update_autorest.go @@ -0,0 +1,79 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c ServersClient) Update(ctx context.Context, id ServerId, input AnalysisServicesServerUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ServersClient) UpdateThenPoll(ctx context.Context, id ServerId, input AnalysisServicesServerUpdateParameters) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c ServersClient) preparerForUpdate(ctx context.Context, id ServerId, input AnalysisServicesServerUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c ServersClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_analysisservicesserver.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_analysisservicesserver.go similarity index 77% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_analysisservicesserver.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_analysisservicesserver.go index 54ff5bf32c2..f99f823bff7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_analysisservicesserver.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_analysisservicesserver.go @@ -1,5 +1,8 @@ package servers +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type AnalysisServicesServer struct { Id *string `json:"id,omitempty"` Location string `json:"location"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_analysisservicesservermutableproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_analysisservicesservermutableproperties.go new file mode 100644 index 00000000000..f3eea488472 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_analysisservicesservermutableproperties.go @@ -0,0 +1,14 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AnalysisServicesServerMutableProperties struct { + AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"` + BackupBlobContainerUri *string `json:"backupBlobContainerUri,omitempty"` + GatewayDetails *GatewayDetails `json:"gatewayDetails,omitempty"` + IPV4FirewallSettings *IPv4FirewallSettings `json:"ipV4FirewallSettings,omitempty"` + ManagedMode *ManagedMode `json:"managedMode,omitempty"` + QuerypoolConnectionMode *ConnectionMode `json:"querypoolConnectionMode,omitempty"` + ServerMonitorMode *ServerMonitorMode `json:"serverMonitorMode,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_analysisservicesserverproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_analysisservicesserverproperties.go similarity index 80% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_analysisservicesserverproperties.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_analysisservicesserverproperties.go index 53c211a1702..d3d4286ddee 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_analysisservicesserverproperties.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_analysisservicesserverproperties.go @@ -1,10 +1,13 @@ package servers +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type AnalysisServicesServerProperties struct { AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"` BackupBlobContainerUri *string `json:"backupBlobContainerUri,omitempty"` GatewayDetails *GatewayDetails `json:"gatewayDetails,omitempty"` - IpV4FirewallSettings *IPv4FirewallSettings `json:"ipV4FirewallSettings,omitempty"` + IPV4FirewallSettings *IPv4FirewallSettings `json:"ipV4FirewallSettings,omitempty"` ManagedMode *ManagedMode `json:"managedMode,omitempty"` ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` QuerypoolConnectionMode *ConnectionMode `json:"querypoolConnectionMode,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_analysisservicesservers.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_analysisservicesservers.go new file mode 100644 index 00000000000..dd7f6678823 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_analysisservicesservers.go @@ -0,0 +1,8 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AnalysisServicesServers struct { + Value []AnalysisServicesServer `json:"value"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_analysisservicesserverupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_analysisservicesserverupdateparameters.go new file mode 100644 index 00000000000..1463e369f88 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_analysisservicesserverupdateparameters.go @@ -0,0 +1,10 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AnalysisServicesServerUpdateParameters struct { + Properties *AnalysisServicesServerMutableProperties `json:"properties,omitempty"` + Sku *ResourceSku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_checkservernameavailabilityparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_checkservernameavailabilityparameters.go new file mode 100644 index 00000000000..e65e84ebdd6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_checkservernameavailabilityparameters.go @@ -0,0 +1,9 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckServerNameAvailabilityParameters struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_checkservernameavailabilityresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_checkservernameavailabilityresult.go new file mode 100644 index 00000000000..8ded2112616 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_checkservernameavailabilityresult.go @@ -0,0 +1,10 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckServerNameAvailabilityResult struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *string `json:"reason,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_gatewaydetails.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_gatewaydetails.go new file mode 100644 index 00000000000..b4296082ead --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_gatewaydetails.go @@ -0,0 +1,10 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayDetails struct { + DmtsClusterUri *string `json:"dmtsClusterUri,omitempty"` + GatewayObjectId *string `json:"gatewayObjectId,omitempty"` + GatewayResourceId *string `json:"gatewayResourceId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_gatewayliststatuslive.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_gatewayliststatuslive.go new file mode 100644 index 00000000000..a49cdc55392 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_gatewayliststatuslive.go @@ -0,0 +1,8 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewayListStatusLive struct { + Status *Status `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_ipv4firewallrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_ipv4firewallrule.go new file mode 100644 index 00000000000..e473d595603 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_ipv4firewallrule.go @@ -0,0 +1,10 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IPv4FirewallRule struct { + FirewallRuleName *string `json:"firewallRuleName,omitempty"` + RangeEnd *string `json:"rangeEnd,omitempty"` + RangeStart *string `json:"rangeStart,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_ipv4firewallsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_ipv4firewallsettings.go new file mode 100644 index 00000000000..8899944d7cb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_ipv4firewallsettings.go @@ -0,0 +1,9 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IPv4FirewallSettings struct { + EnablePowerBIService *bool `json:"enablePowerBIService,omitempty"` + FirewallRules *[]IPv4FirewallRule `json:"firewallRules,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_resourcesku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_resourcesku.go new file mode 100644 index 00000000000..99828509fb5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_resourcesku.go @@ -0,0 +1,10 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name string `json:"name"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_serveradministrators.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_serveradministrators.go new file mode 100644 index 00000000000..b0db9f7e5ae --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_serveradministrators.go @@ -0,0 +1,8 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerAdministrators struct { + Members *[]string `json:"members,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_skudetailsforexistingresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_skudetailsforexistingresource.go new file mode 100644 index 00000000000..2a3e7ffe2b3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_skudetailsforexistingresource.go @@ -0,0 +1,9 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuDetailsForExistingResource struct { + ResourceType *string `json:"resourceType,omitempty"` + Sku *ResourceSku `json:"sku,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_skuenumerationforexistingresourceresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_skuenumerationforexistingresourceresult.go new file mode 100644 index 00000000000..8d17fb29111 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/model_skuenumerationforexistingresourceresult.go @@ -0,0 +1,8 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuEnumerationForExistingResourceResult struct { + Value *[]SkuDetailsForExistingResource `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/version.go new file mode 100644 index 00000000000..3219554646f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers/version.go @@ -0,0 +1,12 @@ +package servers + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/servers/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/README.md new file mode 100644 index 00000000000..90bbe40e764 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/README.md @@ -0,0 +1,154 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores` Documentation + +The `configurationstores` SDK allows for interaction with the Azure Resource Manager Service `appconfiguration` (API Version `2022-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores" +``` + + +### Client Initialization + +```go +client := configurationstores.NewConfigurationStoresClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ConfigurationStoresClient.Create` + +```go +ctx := context.TODO() +id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configStoreValue") + +payload := configurationstores.ConfigurationStore{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ConfigurationStoresClient.Delete` + +```go +ctx := context.TODO() +id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configStoreValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ConfigurationStoresClient.Get` + +```go +ctx := context.TODO() +id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configStoreValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConfigurationStoresClient.List` + +```go +ctx := context.TODO() +id := configurationstores.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ConfigurationStoresClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := configurationstores.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ConfigurationStoresClient.ListKeys` + +```go +ctx := context.TODO() +id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configStoreValue") + +// alternatively `client.ListKeys(ctx, id)` can be used to do batched pagination +items, err := client.ListKeysComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ConfigurationStoresClient.RegenerateKey` + +```go +ctx := context.TODO() +id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configStoreValue") + +payload := configurationstores.RegenerateKeyParameters{ + // ... +} + + +read, err := client.RegenerateKey(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConfigurationStoresClient.Update` + +```go +ctx := context.TODO() +id := configurationstores.NewConfigurationStoreID("12345678-1234-9876-4563-123456789012", "example-resource-group", "configStoreValue") + +payload := configurationstores.ConfigurationStoreUpdateParameters{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/client.go new file mode 100644 index 00000000000..a8a958bcfcf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/client.go @@ -0,0 +1,18 @@ +package configurationstores + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationStoresClient struct { + Client autorest.Client + baseUri string +} + +func NewConfigurationStoresClientWithBaseURI(endpoint string) ConfigurationStoresClient { + return ConfigurationStoresClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/constants.go new file mode 100644 index 00000000000..75cdd3baed8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/constants.go @@ -0,0 +1,164 @@ +package configurationstores + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActionsRequired string + +const ( + ActionsRequiredNone ActionsRequired = "None" + ActionsRequiredRecreate ActionsRequired = "Recreate" +) + +func PossibleValuesForActionsRequired() []string { + return []string{ + string(ActionsRequiredNone), + string(ActionsRequiredRecreate), + } +} + +func parseActionsRequired(input string) (*ActionsRequired, error) { + vals := map[string]ActionsRequired{ + "none": ActionsRequiredNone, + "recreate": ActionsRequiredRecreate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ActionsRequired(input) + return &out, nil +} + +type ConnectionStatus string + +const ( + ConnectionStatusApproved ConnectionStatus = "Approved" + ConnectionStatusDisconnected ConnectionStatus = "Disconnected" + ConnectionStatusPending ConnectionStatus = "Pending" + ConnectionStatusRejected ConnectionStatus = "Rejected" +) + +func PossibleValuesForConnectionStatus() []string { + return []string{ + string(ConnectionStatusApproved), + string(ConnectionStatusDisconnected), + string(ConnectionStatusPending), + string(ConnectionStatusRejected), + } +} + +func parseConnectionStatus(input string) (*ConnectionStatus, error) { + vals := map[string]ConnectionStatus{ + "approved": ConnectionStatusApproved, + "disconnected": ConnectionStatusDisconnected, + "pending": ConnectionStatusPending, + "rejected": ConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConnectionStatus(input) + return &out, nil +} + +type CreateMode string + +const ( + CreateModeDefault CreateMode = "Default" + CreateModeRecover CreateMode = "Recover" +) + +func PossibleValuesForCreateMode() []string { + return []string{ + string(CreateModeDefault), + string(CreateModeRecover), + } +} + +func parseCreateMode(input string) (*CreateMode, error) { + vals := map[string]CreateMode{ + "default": CreateModeDefault, + "recover": CreateModeRecover, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CreateMode(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/id_configurationstore.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/id_configurationstore.go similarity index 89% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/id_configurationstore.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/id_configurationstore.go index 33155c7b0f3..5e9fc5e6977 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/id_configurationstore.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/id_configurationstore.go @@ -102,13 +102,13 @@ func (id ConfigurationStoreId) ID() string { // Segments returns a slice of Resource ID Segments which comprise this Configuration Store ID func (id ConfigurationStoreId) Segments() []resourceids.Segment { return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftAppConfiguration", "Microsoft.AppConfiguration", "Microsoft.AppConfiguration"), - resourceids.StaticSegment("configurationStores", "configurationStores", "configurationStores"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAppConfiguration", "Microsoft.AppConfiguration", "Microsoft.AppConfiguration"), + resourceids.StaticSegment("staticConfigurationStores", "configurationStores", "configurationStores"), resourceids.UserSpecifiedSegment("configStoreName", "configStoreValue"), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_create_autorest.go new file mode 100644 index 00000000000..584ebb8933e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_create_autorest.go @@ -0,0 +1,79 @@ +package configurationstores + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c ConfigurationStoresClient) Create(ctx context.Context, id ConfigurationStoreId, input ConfigurationStore) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c ConfigurationStoresClient) CreateThenPoll(ctx context.Context, id ConfigurationStoreId, input ConfigurationStore) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c ConfigurationStoresClient) preparerForCreate(ctx context.Context, id ConfigurationStoreId, input ConfigurationStore) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c ConfigurationStoresClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_delete_autorest.go new file mode 100644 index 00000000000..aaff0f3cd6d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_delete_autorest.go @@ -0,0 +1,78 @@ +package configurationstores + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ConfigurationStoresClient) Delete(ctx context.Context, id ConfigurationStoreId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ConfigurationStoresClient) DeleteThenPoll(ctx context.Context, id ConfigurationStoreId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ConfigurationStoresClient) preparerForDelete(ctx context.Context, id ConfigurationStoreId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ConfigurationStoresClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_get_autorest.go new file mode 100644 index 00000000000..bb49c12ed24 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_get_autorest.go @@ -0,0 +1,68 @@ +package configurationstores + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ConfigurationStore +} + +// Get ... +func (c ConfigurationStoresClient) Get(ctx context.Context, id ConfigurationStoreId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ConfigurationStoresClient) preparerForGet(ctx context.Context, id ConfigurationStoreId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ConfigurationStoresClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_list_autorest.go new file mode 100644 index 00000000000..ce758ae47bd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_list_autorest.go @@ -0,0 +1,187 @@ +package configurationstores + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]ConfigurationStore + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []ConfigurationStore +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c ConfigurationStoresClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c ConfigurationStoresClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AppConfiguration/configurationStores", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c ConfigurationStoresClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ConfigurationStoresClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []ConfigurationStore `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c ConfigurationStoresClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ConfigurationStoreOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ConfigurationStoresClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ConfigurationStoreOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]ConfigurationStore, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..b81a9948770 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package configurationstores + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]ConfigurationStore + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []ConfigurationStore +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c ConfigurationStoresClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ConfigurationStoresClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AppConfiguration/configurationStores", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c ConfigurationStoresClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ConfigurationStoresClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []ConfigurationStore `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c ConfigurationStoresClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ConfigurationStoreOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ConfigurationStoresClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ConfigurationStoreOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]ConfigurationStore, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_listkeys_autorest.go new file mode 100644 index 00000000000..561594e5894 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_listkeys_autorest.go @@ -0,0 +1,186 @@ +package configurationstores + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeysOperationResponse struct { + HttpResponse *http.Response + Model *[]ApiKey + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListKeysOperationResponse, error) +} + +type ListKeysCompleteResult struct { + Items []ApiKey +} + +func (r ListKeysOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListKeysOperationResponse) LoadMore(ctx context.Context) (resp ListKeysOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListKeys ... +func (c ConfigurationStoresClient) ListKeys(ctx context.Context, id ConfigurationStoreId) (resp ListKeysOperationResponse, err error) { + req, err := c.preparerForListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListKeys", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListKeys(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListKeys", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListKeys prepares the ListKeys request. +func (c ConfigurationStoresClient) preparerForListKeys(ctx context.Context, id ConfigurationStoreId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListKeysWithNextLink prepares the ListKeys request with the given nextLink token. +func (c ConfigurationStoresClient) preparerForListKeysWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListKeys handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (c ConfigurationStoresClient) responderForListKeys(resp *http.Response) (result ListKeysOperationResponse, err error) { + type page struct { + Values []ApiKey `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListKeysOperationResponse, err error) { + req, err := c.preparerForListKeysWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListKeysComplete retrieves all of the results into a single object +func (c ConfigurationStoresClient) ListKeysComplete(ctx context.Context, id ConfigurationStoreId) (ListKeysCompleteResult, error) { + return c.ListKeysCompleteMatchingPredicate(ctx, id, ApiKeyOperationPredicate{}) +} + +// ListKeysCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ConfigurationStoresClient) ListKeysCompleteMatchingPredicate(ctx context.Context, id ConfigurationStoreId, predicate ApiKeyOperationPredicate) (resp ListKeysCompleteResult, err error) { + items := make([]ApiKey, 0) + + page, err := c.ListKeys(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListKeysCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_regeneratekey_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_regeneratekey_autorest.go new file mode 100644 index 00000000000..c682c6d4d2f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_regeneratekey_autorest.go @@ -0,0 +1,70 @@ +package configurationstores + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyOperationResponse struct { + HttpResponse *http.Response + Model *ApiKey +} + +// RegenerateKey ... +func (c ConfigurationStoresClient) RegenerateKey(ctx context.Context, id ConfigurationStoreId, input RegenerateKeyParameters) (result RegenerateKeyOperationResponse, err error) { + req, err := c.preparerForRegenerateKey(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "RegenerateKey", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRegenerateKey(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "RegenerateKey", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRegenerateKey prepares the RegenerateKey request. +func (c ConfigurationStoresClient) preparerForRegenerateKey(ctx context.Context, id ConfigurationStoreId, input RegenerateKeyParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKey", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRegenerateKey handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (c ConfigurationStoresClient) responderForRegenerateKey(resp *http.Response) (result RegenerateKeyOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_update_autorest.go new file mode 100644 index 00000000000..970cc76c297 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/method_update_autorest.go @@ -0,0 +1,79 @@ +package configurationstores + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c ConfigurationStoresClient) Update(ctx context.Context, id ConfigurationStoreId, input ConfigurationStoreUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ConfigurationStoresClient) UpdateThenPoll(ctx context.Context, id ConfigurationStoreId, input ConfigurationStoreUpdateParameters) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c ConfigurationStoresClient) preparerForUpdate(ctx context.Context, id ConfigurationStoreId, input ConfigurationStoreUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c ConfigurationStoresClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_apikey.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_apikey.go new file mode 100644 index 00000000000..9fa93145170 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_apikey.go @@ -0,0 +1,31 @@ +package configurationstores + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiKey struct { + ConnectionString *string `json:"connectionString,omitempty"` + Id *string `json:"id,omitempty"` + LastModified *string `json:"lastModified,omitempty"` + Name *string `json:"name,omitempty"` + ReadOnly *bool `json:"readOnly,omitempty"` + Value *string `json:"value,omitempty"` +} + +func (o *ApiKey) GetLastModifiedAsTime() (*time.Time, error) { + if o.LastModified == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModified, "2006-01-02T15:04:05Z07:00") +} + +func (o *ApiKey) SetLastModifiedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModified = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_configurationstore.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_configurationstore.go new file mode 100644 index 00000000000..2eb894bdf5c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_configurationstore.go @@ -0,0 +1,21 @@ +package configurationstores + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationStore struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ConfigurationStoreProperties `json:"properties,omitempty"` + Sku Sku `json:"sku"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_configurationstoreproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_configurationstoreproperties.go new file mode 100644 index 00000000000..7dac08f3e24 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_configurationstoreproperties.go @@ -0,0 +1,35 @@ +package configurationstores + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationStoreProperties struct { + CreateMode *CreateMode `json:"createMode,omitempty"` + CreationDate *string `json:"creationDate,omitempty"` + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + EnablePurgeProtection *bool `json:"enablePurgeProtection,omitempty"` + Encryption *EncryptionProperties `json:"encryption,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnectionReference `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + SoftDeleteRetentionInDays *int64 `json:"softDeleteRetentionInDays,omitempty"` +} + +func (o *ConfigurationStoreProperties) GetCreationDateAsTime() (*time.Time, error) { + if o.CreationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ConfigurationStoreProperties) SetCreationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreationDate = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_configurationstorepropertiesupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_configurationstorepropertiesupdateparameters.go new file mode 100644 index 00000000000..dd82fc76a73 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_configurationstorepropertiesupdateparameters.go @@ -0,0 +1,11 @@ +package configurationstores + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationStorePropertiesUpdateParameters struct { + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + EnablePurgeProtection *bool `json:"enablePurgeProtection,omitempty"` + Encryption *EncryptionProperties `json:"encryption,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_configurationstoreupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_configurationstoreupdateparameters.go new file mode 100644 index 00000000000..f616d2a98ec --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_configurationstoreupdateparameters.go @@ -0,0 +1,15 @@ +package configurationstores + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationStoreUpdateParameters struct { + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Properties *ConfigurationStorePropertiesUpdateParameters `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_encryptionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_encryptionproperties.go new file mode 100644 index 00000000000..be0340c7047 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_encryptionproperties.go @@ -0,0 +1,8 @@ +package configurationstores + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionProperties struct { + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_keyvaultproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_keyvaultproperties.go new file mode 100644 index 00000000000..1e6e63eb2f8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_keyvaultproperties.go @@ -0,0 +1,9 @@ +package configurationstores + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultProperties struct { + IdentityClientId *string `json:"identityClientId,omitempty"` + KeyIdentifier *string `json:"keyIdentifier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_privateendpoint.go new file mode 100644 index 00000000000..e52ec48dad0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_privateendpoint.go @@ -0,0 +1,8 @@ +package configurationstores + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..7bd6508894c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package configurationstores + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_privateendpointconnectionreference.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_privateendpointconnectionreference.go new file mode 100644 index 00000000000..3a67ff54797 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_privateendpointconnectionreference.go @@ -0,0 +1,11 @@ +package configurationstores + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionReference struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_privatelinkserviceconnectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..f6c8547cb4f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package configurationstores + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *ActionsRequired `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *ConnectionStatus `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_regeneratekeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_regeneratekeyparameters.go new file mode 100644 index 00000000000..f84013d2630 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_regeneratekeyparameters.go @@ -0,0 +1,8 @@ +package configurationstores + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyParameters struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_sku.go new file mode 100644 index 00000000000..6472ed882f4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/model_sku.go @@ -0,0 +1,8 @@ +package configurationstores + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name string `json:"name"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/predicates.go new file mode 100644 index 00000000000..d4541357a23 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/predicates.go @@ -0,0 +1,67 @@ +package configurationstores + +type ApiKeyOperationPredicate struct { + ConnectionString *string + Id *string + LastModified *string + Name *string + ReadOnly *bool + Value *string +} + +func (p ApiKeyOperationPredicate) Matches(input ApiKey) bool { + + if p.ConnectionString != nil && (input.ConnectionString == nil && *p.ConnectionString != *input.ConnectionString) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.LastModified != nil && (input.LastModified == nil && *p.LastModified != *input.LastModified) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.ReadOnly != nil && (input.ReadOnly == nil && *p.ReadOnly != *input.ReadOnly) { + return false + } + + if p.Value != nil && (input.Value == nil && *p.Value != *input.Value) { + return false + } + + return true +} + +type ConfigurationStoreOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ConfigurationStoreOperationPredicate) Matches(input ConfigurationStore) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/version.go new file mode 100644 index 00000000000..2b9a9f58cee --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores/version.go @@ -0,0 +1,12 @@ +package configurationstores + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/configurationstores/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/README.md new file mode 100644 index 00000000000..d0523044219 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/README.md @@ -0,0 +1,110 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis` Documentation + +The `workbooktemplatesapis` SDK allows for interaction with the Azure Resource Manager Service `applicationinsights` (API Version `2020-11-20`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis" +``` + + +### Client Initialization + +```go +client := workbooktemplatesapis.NewWorkbookTemplatesAPIsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `WorkbookTemplatesAPIsClient.WorkbookTemplatesCreateOrUpdate` + +```go +ctx := context.TODO() +id := workbooktemplatesapis.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +payload := workbooktemplatesapis.WorkbookTemplate{ + // ... +} + + +read, err := client.WorkbookTemplatesCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkbookTemplatesAPIsClient.WorkbookTemplatesDelete` + +```go +ctx := context.TODO() +id := workbooktemplatesapis.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +read, err := client.WorkbookTemplatesDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkbookTemplatesAPIsClient.WorkbookTemplatesGet` + +```go +ctx := context.TODO() +id := workbooktemplatesapis.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +read, err := client.WorkbookTemplatesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkbookTemplatesAPIsClient.WorkbookTemplatesListByResourceGroup` + +```go +ctx := context.TODO() +id := workbooktemplatesapis.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.WorkbookTemplatesListByResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkbookTemplatesAPIsClient.WorkbookTemplatesUpdate` + +```go +ctx := context.TODO() +id := workbooktemplatesapis.NewWorkbookTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +payload := workbooktemplatesapis.WorkbookTemplateUpdateParameters{ + // ... +} + + +read, err := client.WorkbookTemplatesUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/client.go new file mode 100644 index 00000000000..e11129fabe3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/client.go @@ -0,0 +1,18 @@ +package workbooktemplatesapis + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplatesAPIsClient struct { + Client autorest.Client + baseUri string +} + +func NewWorkbookTemplatesAPIsClientWithBaseURI(endpoint string) WorkbookTemplatesAPIsClient { + return WorkbookTemplatesAPIsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/id_workbooktemplate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/id_workbooktemplate.go new file mode 100644 index 00000000000..42058833c61 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/id_workbooktemplate.go @@ -0,0 +1,124 @@ +package workbooktemplatesapis + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = WorkbookTemplateId{} + +// WorkbookTemplateId is a struct representing the Resource ID for a Workbook Template +type WorkbookTemplateId struct { + SubscriptionId string + ResourceGroupName string + ResourceName string +} + +// NewWorkbookTemplateID returns a new WorkbookTemplateId struct +func NewWorkbookTemplateID(subscriptionId string, resourceGroupName string, resourceName string) WorkbookTemplateId { + return WorkbookTemplateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceName: resourceName, + } +} + +// ParseWorkbookTemplateID parses 'input' into a WorkbookTemplateId +func ParseWorkbookTemplateID(input string) (*WorkbookTemplateId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkbookTemplateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkbookTemplateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseWorkbookTemplateIDInsensitively parses 'input' case-insensitively into a WorkbookTemplateId +// note: this method should only be used for API response data and not user input +func ParseWorkbookTemplateIDInsensitively(input string) (*WorkbookTemplateId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkbookTemplateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkbookTemplateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateWorkbookTemplateID checks that 'input' can be parsed as a Workbook Template ID +func ValidateWorkbookTemplateID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseWorkbookTemplateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workbook Template ID +func (id WorkbookTemplateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/workbookTemplates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workbook Template ID +func (id WorkbookTemplateId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), + resourceids.StaticSegment("staticWorkbookTemplates", "workbookTemplates", "workbookTemplates"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + } +} + +// String returns a human-readable description of this Workbook Template ID +func (id WorkbookTemplateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + } + return fmt.Sprintf("Workbook Template (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/method_workbooktemplatescreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/method_workbooktemplatescreateorupdate_autorest.go new file mode 100644 index 00000000000..ccbfa85c720 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/method_workbooktemplatescreateorupdate_autorest.go @@ -0,0 +1,69 @@ +package workbooktemplatesapis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplatesCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *WorkbookTemplate +} + +// WorkbookTemplatesCreateOrUpdate ... +func (c WorkbookTemplatesAPIsClient) WorkbookTemplatesCreateOrUpdate(ctx context.Context, id WorkbookTemplateId, input WorkbookTemplate) (result WorkbookTemplatesCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForWorkbookTemplatesCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooktemplatesapis.WorkbookTemplatesAPIsClient", "WorkbookTemplatesCreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooktemplatesapis.WorkbookTemplatesAPIsClient", "WorkbookTemplatesCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbookTemplatesCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooktemplatesapis.WorkbookTemplatesAPIsClient", "WorkbookTemplatesCreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkbookTemplatesCreateOrUpdate prepares the WorkbookTemplatesCreateOrUpdate request. +func (c WorkbookTemplatesAPIsClient) preparerForWorkbookTemplatesCreateOrUpdate(ctx context.Context, id WorkbookTemplateId, input WorkbookTemplate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbookTemplatesCreateOrUpdate handles the response to the WorkbookTemplatesCreateOrUpdate request. The method always +// closes the http.Response Body. +func (c WorkbookTemplatesAPIsClient) responderForWorkbookTemplatesCreateOrUpdate(resp *http.Response) (result WorkbookTemplatesCreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/method_workbooktemplatesdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/method_workbooktemplatesdelete_autorest.go new file mode 100644 index 00000000000..0088c4274a7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/method_workbooktemplatesdelete_autorest.go @@ -0,0 +1,66 @@ +package workbooktemplatesapis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplatesDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// WorkbookTemplatesDelete ... +func (c WorkbookTemplatesAPIsClient) WorkbookTemplatesDelete(ctx context.Context, id WorkbookTemplateId) (result WorkbookTemplatesDeleteOperationResponse, err error) { + req, err := c.preparerForWorkbookTemplatesDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooktemplatesapis.WorkbookTemplatesAPIsClient", "WorkbookTemplatesDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooktemplatesapis.WorkbookTemplatesAPIsClient", "WorkbookTemplatesDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbookTemplatesDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooktemplatesapis.WorkbookTemplatesAPIsClient", "WorkbookTemplatesDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkbookTemplatesDelete prepares the WorkbookTemplatesDelete request. +func (c WorkbookTemplatesAPIsClient) preparerForWorkbookTemplatesDelete(ctx context.Context, id WorkbookTemplateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbookTemplatesDelete handles the response to the WorkbookTemplatesDelete request. The method always +// closes the http.Response Body. +func (c WorkbookTemplatesAPIsClient) responderForWorkbookTemplatesDelete(resp *http.Response) (result WorkbookTemplatesDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/method_workbooktemplatesget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/method_workbooktemplatesget_autorest.go new file mode 100644 index 00000000000..b6c19f69c26 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/method_workbooktemplatesget_autorest.go @@ -0,0 +1,68 @@ +package workbooktemplatesapis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplatesGetOperationResponse struct { + HttpResponse *http.Response + Model *WorkbookTemplate +} + +// WorkbookTemplatesGet ... +func (c WorkbookTemplatesAPIsClient) WorkbookTemplatesGet(ctx context.Context, id WorkbookTemplateId) (result WorkbookTemplatesGetOperationResponse, err error) { + req, err := c.preparerForWorkbookTemplatesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooktemplatesapis.WorkbookTemplatesAPIsClient", "WorkbookTemplatesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooktemplatesapis.WorkbookTemplatesAPIsClient", "WorkbookTemplatesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbookTemplatesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooktemplatesapis.WorkbookTemplatesAPIsClient", "WorkbookTemplatesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkbookTemplatesGet prepares the WorkbookTemplatesGet request. +func (c WorkbookTemplatesAPIsClient) preparerForWorkbookTemplatesGet(ctx context.Context, id WorkbookTemplateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbookTemplatesGet handles the response to the WorkbookTemplatesGet request. The method always +// closes the http.Response Body. +func (c WorkbookTemplatesAPIsClient) responderForWorkbookTemplatesGet(resp *http.Response) (result WorkbookTemplatesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/method_workbooktemplateslistbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/method_workbooktemplateslistbyresourcegroup_autorest.go new file mode 100644 index 00000000000..0ac096a184a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/method_workbooktemplateslistbyresourcegroup_autorest.go @@ -0,0 +1,70 @@ +package workbooktemplatesapis + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplatesListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *WorkbookTemplatesListResult +} + +// WorkbookTemplatesListByResourceGroup ... +func (c WorkbookTemplatesAPIsClient) WorkbookTemplatesListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result WorkbookTemplatesListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForWorkbookTemplatesListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooktemplatesapis.WorkbookTemplatesAPIsClient", "WorkbookTemplatesListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooktemplatesapis.WorkbookTemplatesAPIsClient", "WorkbookTemplatesListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbookTemplatesListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooktemplatesapis.WorkbookTemplatesAPIsClient", "WorkbookTemplatesListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkbookTemplatesListByResourceGroup prepares the WorkbookTemplatesListByResourceGroup request. +func (c WorkbookTemplatesAPIsClient) preparerForWorkbookTemplatesListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Insights/workbookTemplates", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbookTemplatesListByResourceGroup handles the response to the WorkbookTemplatesListByResourceGroup request. The method always +// closes the http.Response Body. +func (c WorkbookTemplatesAPIsClient) responderForWorkbookTemplatesListByResourceGroup(resp *http.Response) (result WorkbookTemplatesListByResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/method_workbooktemplatesupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/method_workbooktemplatesupdate_autorest.go new file mode 100644 index 00000000000..f4c4bd7570b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/method_workbooktemplatesupdate_autorest.go @@ -0,0 +1,69 @@ +package workbooktemplatesapis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplatesUpdateOperationResponse struct { + HttpResponse *http.Response + Model *WorkbookTemplate +} + +// WorkbookTemplatesUpdate ... +func (c WorkbookTemplatesAPIsClient) WorkbookTemplatesUpdate(ctx context.Context, id WorkbookTemplateId, input WorkbookTemplateUpdateParameters) (result WorkbookTemplatesUpdateOperationResponse, err error) { + req, err := c.preparerForWorkbookTemplatesUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooktemplatesapis.WorkbookTemplatesAPIsClient", "WorkbookTemplatesUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooktemplatesapis.WorkbookTemplatesAPIsClient", "WorkbookTemplatesUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbookTemplatesUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooktemplatesapis.WorkbookTemplatesAPIsClient", "WorkbookTemplatesUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkbookTemplatesUpdate prepares the WorkbookTemplatesUpdate request. +func (c WorkbookTemplatesAPIsClient) preparerForWorkbookTemplatesUpdate(ctx context.Context, id WorkbookTemplateId, input WorkbookTemplateUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbookTemplatesUpdate handles the response to the WorkbookTemplatesUpdate request. The method always +// closes the http.Response Body. +func (c WorkbookTemplatesAPIsClient) responderForWorkbookTemplatesUpdate(resp *http.Response) (result WorkbookTemplatesUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplate.go new file mode 100644 index 00000000000..f3e0c42e001 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplate.go @@ -0,0 +1,13 @@ +package workbooktemplatesapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplate struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *WorkbookTemplateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplategallery.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplategallery.go new file mode 100644 index 00000000000..4046438733e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplategallery.go @@ -0,0 +1,12 @@ +package workbooktemplatesapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplateGallery struct { + Category *string `json:"category,omitempty"` + Name *string `json:"name,omitempty"` + Order *int64 `json:"order,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplatelocalizedgallery.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplatelocalizedgallery.go new file mode 100644 index 00000000000..770335e5d2a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplatelocalizedgallery.go @@ -0,0 +1,9 @@ +package workbooktemplatesapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplateLocalizedGallery struct { + Galleries *[]WorkbookTemplateGallery `json:"galleries,omitempty"` + TemplateData *interface{} `json:"templateData,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplateproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplateproperties.go new file mode 100644 index 00000000000..9a8a986384e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplateproperties.go @@ -0,0 +1,12 @@ +package workbooktemplatesapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplateProperties struct { + Author *string `json:"author,omitempty"` + Galleries []WorkbookTemplateGallery `json:"galleries"` + Localized *map[string][]WorkbookTemplateLocalizedGallery `json:"localized,omitempty"` + Priority *int64 `json:"priority,omitempty"` + TemplateData interface{} `json:"templateData"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplateslistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplateslistresult.go new file mode 100644 index 00000000000..7b38275aed8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplateslistresult.go @@ -0,0 +1,8 @@ +package workbooktemplatesapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplatesListResult struct { + Value *[]WorkbookTemplate `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplateupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplateupdateparameters.go new file mode 100644 index 00000000000..eee6e4b9133 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/model_workbooktemplateupdateparameters.go @@ -0,0 +1,9 @@ +package workbooktemplatesapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookTemplateUpdateParameters struct { + Properties *WorkbookTemplateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/version.go new file mode 100644 index 00000000000..abd25f3cdc9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/version.go @@ -0,0 +1,12 @@ +package workbooktemplatesapis + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-11-20" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/workbooktemplatesapis/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/README.md new file mode 100644 index 00000000000..f3698e6dbfe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/README.md @@ -0,0 +1,161 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis` Documentation + +The `workbooksapis` SDK allows for interaction with the Azure Resource Manager Service `applicationinsights` (API Version `2022-04-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis" +``` + + +### Client Initialization + +```go +client := workbooksapis.NewWorkbooksAPIsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `WorkbooksAPIsClient.WorkbooksCreateOrUpdate` + +```go +ctx := context.TODO() +id := workbooksapis.NewWorkbookID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +payload := workbooksapis.Workbook{ + // ... +} + + +read, err := client.WorkbooksCreateOrUpdate(ctx, id, payload, workbooksapis.DefaultWorkbooksCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkbooksAPIsClient.WorkbooksDelete` + +```go +ctx := context.TODO() +id := workbooksapis.NewWorkbookID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +read, err := client.WorkbooksDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkbooksAPIsClient.WorkbooksGet` + +```go +ctx := context.TODO() +id := workbooksapis.NewWorkbookID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +read, err := client.WorkbooksGet(ctx, id, workbooksapis.DefaultWorkbooksGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkbooksAPIsClient.WorkbooksListByResourceGroup` + +```go +ctx := context.TODO() +id := workbooksapis.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.WorkbooksListByResourceGroup(ctx, id, workbooksapis.DefaultWorkbooksListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.WorkbooksListByResourceGroupComplete(ctx, id, workbooksapis.DefaultWorkbooksListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WorkbooksAPIsClient.WorkbooksListBySubscription` + +```go +ctx := context.TODO() +id := workbooksapis.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.WorkbooksListBySubscription(ctx, id, workbooksapis.DefaultWorkbooksListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.WorkbooksListBySubscriptionComplete(ctx, id, workbooksapis.DefaultWorkbooksListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WorkbooksAPIsClient.WorkbooksRevisionGet` + +```go +ctx := context.TODO() +id := workbooksapis.NewRevisionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "revisionIdValue") + +read, err := client.WorkbooksRevisionGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkbooksAPIsClient.WorkbooksRevisionsList` + +```go +ctx := context.TODO() +id := workbooksapis.NewWorkbookID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +// alternatively `client.WorkbooksRevisionsList(ctx, id)` can be used to do batched pagination +items, err := client.WorkbooksRevisionsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WorkbooksAPIsClient.WorkbooksUpdate` + +```go +ctx := context.TODO() +id := workbooksapis.NewWorkbookID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +payload := workbooksapis.WorkbookUpdateParameters{ + // ... +} + + +read, err := client.WorkbooksUpdate(ctx, id, payload, workbooksapis.DefaultWorkbooksUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/client.go new file mode 100644 index 00000000000..651cbf32b07 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/client.go @@ -0,0 +1,18 @@ +package workbooksapis + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbooksAPIsClient struct { + Client autorest.Client + baseUri string +} + +func NewWorkbooksAPIsClientWithBaseURI(endpoint string) WorkbooksAPIsClient { + return WorkbooksAPIsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/constants.go new file mode 100644 index 00000000000..9a609b0db3c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/constants.go @@ -0,0 +1,90 @@ +package workbooksapis + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CategoryType string + +const ( + CategoryTypePerformance CategoryType = "performance" + CategoryTypeRetention CategoryType = "retention" + CategoryTypeTSG CategoryType = "TSG" + CategoryTypeWorkbook CategoryType = "workbook" +) + +func PossibleValuesForCategoryType() []string { + return []string{ + string(CategoryTypePerformance), + string(CategoryTypeRetention), + string(CategoryTypeTSG), + string(CategoryTypeWorkbook), + } +} + +func parseCategoryType(input string) (*CategoryType, error) { + vals := map[string]CategoryType{ + "performance": CategoryTypePerformance, + "retention": CategoryTypeRetention, + "tsg": CategoryTypeTSG, + "workbook": CategoryTypeWorkbook, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CategoryType(input) + return &out, nil +} + +type WorkbookSharedTypeKind string + +const ( + WorkbookSharedTypeKindShared WorkbookSharedTypeKind = "shared" +) + +func PossibleValuesForWorkbookSharedTypeKind() []string { + return []string{ + string(WorkbookSharedTypeKindShared), + } +} + +func parseWorkbookSharedTypeKind(input string) (*WorkbookSharedTypeKind, error) { + vals := map[string]WorkbookSharedTypeKind{ + "shared": WorkbookSharedTypeKindShared, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkbookSharedTypeKind(input) + return &out, nil +} + +type WorkbookUpdateSharedTypeKind string + +const ( + WorkbookUpdateSharedTypeKindShared WorkbookUpdateSharedTypeKind = "shared" +) + +func PossibleValuesForWorkbookUpdateSharedTypeKind() []string { + return []string{ + string(WorkbookUpdateSharedTypeKindShared), + } +} + +func parseWorkbookUpdateSharedTypeKind(input string) (*WorkbookUpdateSharedTypeKind, error) { + vals := map[string]WorkbookUpdateSharedTypeKind{ + "shared": WorkbookUpdateSharedTypeKindShared, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkbookUpdateSharedTypeKind(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_revision.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_revision.go new file mode 100644 index 00000000000..4556cfaec71 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_revision.go @@ -0,0 +1,137 @@ +package workbooksapis + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RevisionId{} + +// RevisionId is a struct representing the Resource ID for a Revision +type RevisionId struct { + SubscriptionId string + ResourceGroupName string + ResourceName string + RevisionId string +} + +// NewRevisionID returns a new RevisionId struct +func NewRevisionID(subscriptionId string, resourceGroupName string, resourceName string, revisionId string) RevisionId { + return RevisionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceName: resourceName, + RevisionId: revisionId, + } +} + +// ParseRevisionID parses 'input' into a RevisionId +func ParseRevisionID(input string) (*RevisionId, error) { + parser := resourceids.NewParserFromResourceIdType(RevisionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RevisionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + if id.RevisionId, ok = parsed.Parsed["revisionId"]; !ok { + return nil, fmt.Errorf("the segment 'revisionId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRevisionIDInsensitively parses 'input' case-insensitively into a RevisionId +// note: this method should only be used for API response data and not user input +func ParseRevisionIDInsensitively(input string) (*RevisionId, error) { + parser := resourceids.NewParserFromResourceIdType(RevisionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RevisionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + if id.RevisionId, ok = parsed.Parsed["revisionId"]; !ok { + return nil, fmt.Errorf("the segment 'revisionId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRevisionID checks that 'input' can be parsed as a Revision ID +func ValidateRevisionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRevisionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Revision ID +func (id RevisionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/workbooks/%s/revisions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.RevisionId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Revision ID +func (id RevisionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), + resourceids.StaticSegment("staticWorkbooks", "workbooks", "workbooks"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.StaticSegment("staticRevisions", "revisions", "revisions"), + resourceids.UserSpecifiedSegment("revisionId", "revisionIdValue"), + } +} + +// String returns a human-readable description of this Revision ID +func (id RevisionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Revision: %q", id.RevisionId), + } + return fmt.Sprintf("Revision (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_workbook.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_workbook.go new file mode 100644 index 00000000000..78b322bb80e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_workbook.go @@ -0,0 +1,124 @@ +package workbooksapis + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = WorkbookId{} + +// WorkbookId is a struct representing the Resource ID for a Workbook +type WorkbookId struct { + SubscriptionId string + ResourceGroupName string + ResourceName string +} + +// NewWorkbookID returns a new WorkbookId struct +func NewWorkbookID(subscriptionId string, resourceGroupName string, resourceName string) WorkbookId { + return WorkbookId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceName: resourceName, + } +} + +// ParseWorkbookID parses 'input' into a WorkbookId +func ParseWorkbookID(input string) (*WorkbookId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkbookId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkbookId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseWorkbookIDInsensitively parses 'input' case-insensitively into a WorkbookId +// note: this method should only be used for API response data and not user input +func ParseWorkbookIDInsensitively(input string) (*WorkbookId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkbookId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkbookId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateWorkbookID checks that 'input' can be parsed as a Workbook ID +func ValidateWorkbookID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseWorkbookID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workbook ID +func (id WorkbookId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/workbooks/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workbook ID +func (id WorkbookId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), + resourceids.StaticSegment("staticWorkbooks", "workbooks", "workbooks"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + } +} + +// String returns a human-readable description of this Workbook ID +func (id WorkbookId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + } + return fmt.Sprintf("Workbook (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbookscreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbookscreateorupdate_autorest.go new file mode 100644 index 00000000000..d51b79a20c8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbookscreateorupdate_autorest.go @@ -0,0 +1,98 @@ +package workbooksapis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbooksCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Workbook +} + +type WorkbooksCreateOrUpdateOperationOptions struct { + SourceId *string +} + +func DefaultWorkbooksCreateOrUpdateOperationOptions() WorkbooksCreateOrUpdateOperationOptions { + return WorkbooksCreateOrUpdateOperationOptions{} +} + +func (o WorkbooksCreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o WorkbooksCreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.SourceId != nil { + out["sourceId"] = *o.SourceId + } + + return out +} + +// WorkbooksCreateOrUpdate ... +func (c WorkbooksAPIsClient) WorkbooksCreateOrUpdate(ctx context.Context, id WorkbookId, input Workbook, options WorkbooksCreateOrUpdateOperationOptions) (result WorkbooksCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForWorkbooksCreateOrUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksCreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbooksCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksCreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkbooksCreateOrUpdate prepares the WorkbooksCreateOrUpdate request. +func (c WorkbooksAPIsClient) preparerForWorkbooksCreateOrUpdate(ctx context.Context, id WorkbookId, input Workbook, options WorkbooksCreateOrUpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbooksCreateOrUpdate handles the response to the WorkbooksCreateOrUpdate request. The method always +// closes the http.Response Body. +func (c WorkbooksAPIsClient) responderForWorkbooksCreateOrUpdate(resp *http.Response) (result WorkbooksCreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbooksdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbooksdelete_autorest.go new file mode 100644 index 00000000000..e6cde4eeef3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbooksdelete_autorest.go @@ -0,0 +1,66 @@ +package workbooksapis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbooksDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// WorkbooksDelete ... +func (c WorkbooksAPIsClient) WorkbooksDelete(ctx context.Context, id WorkbookId) (result WorkbooksDeleteOperationResponse, err error) { + req, err := c.preparerForWorkbooksDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbooksDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkbooksDelete prepares the WorkbooksDelete request. +func (c WorkbooksAPIsClient) preparerForWorkbooksDelete(ctx context.Context, id WorkbookId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbooksDelete handles the response to the WorkbooksDelete request. The method always +// closes the http.Response Body. +func (c WorkbooksAPIsClient) responderForWorkbooksDelete(resp *http.Response) (result WorkbooksDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbooksget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbooksget_autorest.go new file mode 100644 index 00000000000..4f8e45339af --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbooksget_autorest.go @@ -0,0 +1,97 @@ +package workbooksapis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbooksGetOperationResponse struct { + HttpResponse *http.Response + Model *Workbook +} + +type WorkbooksGetOperationOptions struct { + CanFetchContent *bool +} + +func DefaultWorkbooksGetOperationOptions() WorkbooksGetOperationOptions { + return WorkbooksGetOperationOptions{} +} + +func (o WorkbooksGetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o WorkbooksGetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.CanFetchContent != nil { + out["canFetchContent"] = *o.CanFetchContent + } + + return out +} + +// WorkbooksGet ... +func (c WorkbooksAPIsClient) WorkbooksGet(ctx context.Context, id WorkbookId, options WorkbooksGetOperationOptions) (result WorkbooksGetOperationResponse, err error) { + req, err := c.preparerForWorkbooksGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbooksGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkbooksGet prepares the WorkbooksGet request. +func (c WorkbooksAPIsClient) preparerForWorkbooksGet(ctx context.Context, id WorkbookId, options WorkbooksGetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbooksGet handles the response to the WorkbooksGet request. The method always +// closes the http.Response Body. +func (c WorkbooksAPIsClient) responderForWorkbooksGet(resp *http.Response) (result WorkbooksGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbookslistbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbookslistbyresourcegroup_autorest.go new file mode 100644 index 00000000000..67e843c2cfb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbookslistbyresourcegroup_autorest.go @@ -0,0 +1,231 @@ +package workbooksapis + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbooksListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Workbook + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (WorkbooksListByResourceGroupOperationResponse, error) +} + +type WorkbooksListByResourceGroupCompleteResult struct { + Items []Workbook +} + +func (r WorkbooksListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r WorkbooksListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp WorkbooksListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type WorkbooksListByResourceGroupOperationOptions struct { + CanFetchContent *bool + Category *CategoryType + SourceId *string + Tags *string +} + +func DefaultWorkbooksListByResourceGroupOperationOptions() WorkbooksListByResourceGroupOperationOptions { + return WorkbooksListByResourceGroupOperationOptions{} +} + +func (o WorkbooksListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o WorkbooksListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.CanFetchContent != nil { + out["canFetchContent"] = *o.CanFetchContent + } + + if o.Category != nil { + out["category"] = *o.Category + } + + if o.SourceId != nil { + out["sourceId"] = *o.SourceId + } + + if o.Tags != nil { + out["tags"] = *o.Tags + } + + return out +} + +// WorkbooksListByResourceGroup ... +func (c WorkbooksAPIsClient) WorkbooksListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options WorkbooksListByResourceGroupOperationOptions) (resp WorkbooksListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForWorkbooksListByResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForWorkbooksListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForWorkbooksListByResourceGroup prepares the WorkbooksListByResourceGroup request. +func (c WorkbooksAPIsClient) preparerForWorkbooksListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options WorkbooksListByResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Insights/workbooks", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForWorkbooksListByResourceGroupWithNextLink prepares the WorkbooksListByResourceGroup request with the given nextLink token. +func (c WorkbooksAPIsClient) preparerForWorkbooksListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbooksListByResourceGroup handles the response to the WorkbooksListByResourceGroup request. The method always +// closes the http.Response Body. +func (c WorkbooksAPIsClient) responderForWorkbooksListByResourceGroup(resp *http.Response) (result WorkbooksListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Workbook `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result WorkbooksListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForWorkbooksListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbooksListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// WorkbooksListByResourceGroupComplete retrieves all of the results into a single object +func (c WorkbooksAPIsClient) WorkbooksListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options WorkbooksListByResourceGroupOperationOptions) (WorkbooksListByResourceGroupCompleteResult, error) { + return c.WorkbooksListByResourceGroupCompleteMatchingPredicate(ctx, id, options, WorkbookOperationPredicate{}) +} + +// WorkbooksListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkbooksAPIsClient) WorkbooksListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options WorkbooksListByResourceGroupOperationOptions, predicate WorkbookOperationPredicate) (resp WorkbooksListByResourceGroupCompleteResult, err error) { + items := make([]Workbook, 0) + + page, err := c.WorkbooksListByResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := WorkbooksListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbookslistbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbookslistbysubscription_autorest.go new file mode 100644 index 00000000000..2c82ca2cf76 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbookslistbysubscription_autorest.go @@ -0,0 +1,226 @@ +package workbooksapis + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbooksListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Workbook + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (WorkbooksListBySubscriptionOperationResponse, error) +} + +type WorkbooksListBySubscriptionCompleteResult struct { + Items []Workbook +} + +func (r WorkbooksListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r WorkbooksListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp WorkbooksListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type WorkbooksListBySubscriptionOperationOptions struct { + CanFetchContent *bool + Category *CategoryType + Tags *string +} + +func DefaultWorkbooksListBySubscriptionOperationOptions() WorkbooksListBySubscriptionOperationOptions { + return WorkbooksListBySubscriptionOperationOptions{} +} + +func (o WorkbooksListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o WorkbooksListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.CanFetchContent != nil { + out["canFetchContent"] = *o.CanFetchContent + } + + if o.Category != nil { + out["category"] = *o.Category + } + + if o.Tags != nil { + out["tags"] = *o.Tags + } + + return out +} + +// WorkbooksListBySubscription ... +func (c WorkbooksAPIsClient) WorkbooksListBySubscription(ctx context.Context, id commonids.SubscriptionId, options WorkbooksListBySubscriptionOperationOptions) (resp WorkbooksListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForWorkbooksListBySubscription(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForWorkbooksListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForWorkbooksListBySubscription prepares the WorkbooksListBySubscription request. +func (c WorkbooksAPIsClient) preparerForWorkbooksListBySubscription(ctx context.Context, id commonids.SubscriptionId, options WorkbooksListBySubscriptionOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Insights/workbooks", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForWorkbooksListBySubscriptionWithNextLink prepares the WorkbooksListBySubscription request with the given nextLink token. +func (c WorkbooksAPIsClient) preparerForWorkbooksListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbooksListBySubscription handles the response to the WorkbooksListBySubscription request. The method always +// closes the http.Response Body. +func (c WorkbooksAPIsClient) responderForWorkbooksListBySubscription(resp *http.Response) (result WorkbooksListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Workbook `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result WorkbooksListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForWorkbooksListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbooksListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// WorkbooksListBySubscriptionComplete retrieves all of the results into a single object +func (c WorkbooksAPIsClient) WorkbooksListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options WorkbooksListBySubscriptionOperationOptions) (WorkbooksListBySubscriptionCompleteResult, error) { + return c.WorkbooksListBySubscriptionCompleteMatchingPredicate(ctx, id, options, WorkbookOperationPredicate{}) +} + +// WorkbooksListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkbooksAPIsClient) WorkbooksListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options WorkbooksListBySubscriptionOperationOptions, predicate WorkbookOperationPredicate) (resp WorkbooksListBySubscriptionCompleteResult, err error) { + items := make([]Workbook, 0) + + page, err := c.WorkbooksListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := WorkbooksListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbooksrevisionget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbooksrevisionget_autorest.go new file mode 100644 index 00000000000..cbb48f82644 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbooksrevisionget_autorest.go @@ -0,0 +1,68 @@ +package workbooksapis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbooksRevisionGetOperationResponse struct { + HttpResponse *http.Response + Model *Workbook +} + +// WorkbooksRevisionGet ... +func (c WorkbooksAPIsClient) WorkbooksRevisionGet(ctx context.Context, id RevisionId) (result WorkbooksRevisionGetOperationResponse, err error) { + req, err := c.preparerForWorkbooksRevisionGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksRevisionGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksRevisionGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbooksRevisionGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksRevisionGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkbooksRevisionGet prepares the WorkbooksRevisionGet request. +func (c WorkbooksAPIsClient) preparerForWorkbooksRevisionGet(ctx context.Context, id RevisionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbooksRevisionGet handles the response to the WorkbooksRevisionGet request. The method always +// closes the http.Response Body. +func (c WorkbooksAPIsClient) responderForWorkbooksRevisionGet(resp *http.Response) (result WorkbooksRevisionGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbooksrevisionslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbooksrevisionslist_autorest.go new file mode 100644 index 00000000000..d902bfa3e36 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbooksrevisionslist_autorest.go @@ -0,0 +1,186 @@ +package workbooksapis + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbooksRevisionsListOperationResponse struct { + HttpResponse *http.Response + Model *[]Workbook + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (WorkbooksRevisionsListOperationResponse, error) +} + +type WorkbooksRevisionsListCompleteResult struct { + Items []Workbook +} + +func (r WorkbooksRevisionsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r WorkbooksRevisionsListOperationResponse) LoadMore(ctx context.Context) (resp WorkbooksRevisionsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// WorkbooksRevisionsList ... +func (c WorkbooksAPIsClient) WorkbooksRevisionsList(ctx context.Context, id WorkbookId) (resp WorkbooksRevisionsListOperationResponse, err error) { + req, err := c.preparerForWorkbooksRevisionsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksRevisionsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksRevisionsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForWorkbooksRevisionsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksRevisionsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForWorkbooksRevisionsList prepares the WorkbooksRevisionsList request. +func (c WorkbooksAPIsClient) preparerForWorkbooksRevisionsList(ctx context.Context, id WorkbookId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/revisions", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForWorkbooksRevisionsListWithNextLink prepares the WorkbooksRevisionsList request with the given nextLink token. +func (c WorkbooksAPIsClient) preparerForWorkbooksRevisionsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbooksRevisionsList handles the response to the WorkbooksRevisionsList request. The method always +// closes the http.Response Body. +func (c WorkbooksAPIsClient) responderForWorkbooksRevisionsList(resp *http.Response) (result WorkbooksRevisionsListOperationResponse, err error) { + type page struct { + Values []Workbook `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result WorkbooksRevisionsListOperationResponse, err error) { + req, err := c.preparerForWorkbooksRevisionsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksRevisionsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksRevisionsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbooksRevisionsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksRevisionsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// WorkbooksRevisionsListComplete retrieves all of the results into a single object +func (c WorkbooksAPIsClient) WorkbooksRevisionsListComplete(ctx context.Context, id WorkbookId) (WorkbooksRevisionsListCompleteResult, error) { + return c.WorkbooksRevisionsListCompleteMatchingPredicate(ctx, id, WorkbookOperationPredicate{}) +} + +// WorkbooksRevisionsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkbooksAPIsClient) WorkbooksRevisionsListCompleteMatchingPredicate(ctx context.Context, id WorkbookId, predicate WorkbookOperationPredicate) (resp WorkbooksRevisionsListCompleteResult, err error) { + items := make([]Workbook, 0) + + page, err := c.WorkbooksRevisionsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := WorkbooksRevisionsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbooksupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbooksupdate_autorest.go new file mode 100644 index 00000000000..9e848912822 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/method_workbooksupdate_autorest.go @@ -0,0 +1,98 @@ +package workbooksapis + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbooksUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Workbook +} + +type WorkbooksUpdateOperationOptions struct { + SourceId *string +} + +func DefaultWorkbooksUpdateOperationOptions() WorkbooksUpdateOperationOptions { + return WorkbooksUpdateOperationOptions{} +} + +func (o WorkbooksUpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o WorkbooksUpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.SourceId != nil { + out["sourceId"] = *o.SourceId + } + + return out +} + +// WorkbooksUpdate ... +func (c WorkbooksAPIsClient) WorkbooksUpdate(ctx context.Context, id WorkbookId, input WorkbookUpdateParameters, options WorkbooksUpdateOperationOptions) (result WorkbooksUpdateOperationResponse, err error) { + req, err := c.preparerForWorkbooksUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkbooksUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workbooksapis.WorkbooksAPIsClient", "WorkbooksUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkbooksUpdate prepares the WorkbooksUpdate request. +func (c WorkbooksAPIsClient) preparerForWorkbooksUpdate(ctx context.Context, id WorkbookId, input WorkbookUpdateParameters, options WorkbooksUpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkbooksUpdate handles the response to the WorkbooksUpdate request. The method always +// closes the http.Response Body. +func (c WorkbooksAPIsClient) responderForWorkbooksUpdate(resp *http.Response) (result WorkbooksUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/model_workbook.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/model_workbook.go new file mode 100644 index 00000000000..44e7b742b73 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/model_workbook.go @@ -0,0 +1,22 @@ +package workbooksapis + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Workbook struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"` + Kind *WorkbookSharedTypeKind `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *WorkbookProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/model_workbookproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/model_workbookproperties.go new file mode 100644 index 00000000000..b1cc1c68a56 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/model_workbookproperties.go @@ -0,0 +1,36 @@ +package workbooksapis + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookProperties struct { + Category string `json:"category"` + Description *string `json:"description,omitempty"` + DisplayName string `json:"displayName"` + Revision *string `json:"revision,omitempty"` + SerializedData string `json:"serializedData"` + SourceId *string `json:"sourceId,omitempty"` + StorageUri *string `json:"storageUri,omitempty"` + Tags *[]string `json:"tags,omitempty"` + TimeModified *string `json:"timeModified,omitempty"` + UserId *string `json:"userId,omitempty"` + Version *string `json:"version,omitempty"` +} + +func (o *WorkbookProperties) GetTimeModifiedAsTime() (*time.Time, error) { + if o.TimeModified == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeModified, "2006-01-02T15:04:05Z07:00") +} + +func (o *WorkbookProperties) SetTimeModifiedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeModified = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/model_workbookpropertiesupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/model_workbookpropertiesupdateparameters.go new file mode 100644 index 00000000000..f27f938eb12 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/model_workbookpropertiesupdateparameters.go @@ -0,0 +1,13 @@ +package workbooksapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookPropertiesUpdateParameters struct { + Category *string `json:"category,omitempty"` + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Revision *string `json:"revision,omitempty"` + SerializedData *string `json:"serializedData,omitempty"` + Tags *[]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/model_workbookupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/model_workbookupdateparameters.go new file mode 100644 index 00000000000..b199d837b74 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/model_workbookupdateparameters.go @@ -0,0 +1,10 @@ +package workbooksapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkbookUpdateParameters struct { + Kind *WorkbookUpdateSharedTypeKind `json:"kind,omitempty"` + Properties *WorkbookPropertiesUpdateParameters `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/predicates.go new file mode 100644 index 00000000000..9a1d22c7384 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/predicates.go @@ -0,0 +1,34 @@ +package workbooksapis + +type WorkbookOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p WorkbookOperationPredicate) Matches(input Workbook) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/version.go new file mode 100644 index 00000000000..0a9c841b785 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis/version.go @@ -0,0 +1,12 @@ +package workbooksapis + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/workbooksapis/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/README.md new file mode 100644 index 00000000000..359a8777cef --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/README.md @@ -0,0 +1,158 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders` Documentation + +The `attestationproviders` SDK allows for interaction with the Azure Resource Manager Service `attestation` (API Version `2020-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders" +``` + + +### Client Initialization + +```go +client := attestationproviders.NewAttestationProvidersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AttestationProvidersClient.Create` + +```go +ctx := context.TODO() +id := attestationproviders.NewAttestationProvidersID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue") + +payload := attestationproviders.AttestationServiceCreationParams{ + // ... +} + + +read, err := client.Create(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AttestationProvidersClient.Delete` + +```go +ctx := context.TODO() +id := attestationproviders.NewAttestationProvidersID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AttestationProvidersClient.Get` + +```go +ctx := context.TODO() +id := attestationproviders.NewAttestationProvidersID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AttestationProvidersClient.GetDefaultByLocation` + +```go +ctx := context.TODO() +id := attestationproviders.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +read, err := client.GetDefaultByLocation(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AttestationProvidersClient.List` + +```go +ctx := context.TODO() +id := attestationproviders.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AttestationProvidersClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := attestationproviders.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.ListByResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AttestationProvidersClient.ListDefault` + +```go +ctx := context.TODO() +id := attestationproviders.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.ListDefault(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AttestationProvidersClient.Update` + +```go +ctx := context.TODO() +id := attestationproviders.NewAttestationProvidersID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue") + +payload := attestationproviders.AttestationServicePatchParams{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/client.go new file mode 100644 index 00000000000..86863f9657f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/client.go @@ -0,0 +1,18 @@ +package attestationproviders + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttestationProvidersClient struct { + Client autorest.Client + baseUri string +} + +func NewAttestationProvidersClientWithBaseURI(endpoint string) AttestationProvidersClient { + return AttestationProvidersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/constants.go new file mode 100644 index 00000000000..ea25702fdf2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/constants.go @@ -0,0 +1,102 @@ +package attestationproviders + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttestationServiceStatus string + +const ( + AttestationServiceStatusError AttestationServiceStatus = "Error" + AttestationServiceStatusNotReady AttestationServiceStatus = "NotReady" + AttestationServiceStatusReady AttestationServiceStatus = "Ready" +) + +func PossibleValuesForAttestationServiceStatus() []string { + return []string{ + string(AttestationServiceStatusError), + string(AttestationServiceStatusNotReady), + string(AttestationServiceStatusReady), + } +} + +func parseAttestationServiceStatus(input string) (*AttestationServiceStatus, error) { + vals := map[string]AttestationServiceStatus{ + "error": AttestationServiceStatusError, + "notready": AttestationServiceStatusNotReady, + "ready": AttestationServiceStatusReady, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AttestationServiceStatus(input) + return &out, nil +} + +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + } +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { + return []string{ + string(PrivateEndpointServiceConnectionStatusApproved), + string(PrivateEndpointServiceConnectionStatusPending), + string(PrivateEndpointServiceConnectionStatusRejected), + } +} + +func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { + vals := map[string]PrivateEndpointServiceConnectionStatus{ + "approved": PrivateEndpointServiceConnectionStatusApproved, + "pending": PrivateEndpointServiceConnectionStatusPending, + "rejected": PrivateEndpointServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointServiceConnectionStatus(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/id_attestationproviders.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/id_attestationproviders.go similarity index 90% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/id_attestationproviders.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/id_attestationproviders.go index a2cb2b27257..60a8ff50d08 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/id_attestationproviders.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/id_attestationproviders.go @@ -102,13 +102,13 @@ func (id AttestationProvidersId) ID() string { // Segments returns a slice of Resource ID Segments which comprise this Attestation Providers ID func (id AttestationProvidersId) Segments() []resourceids.Segment { return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftAttestation", "Microsoft.Attestation", "Microsoft.Attestation"), - resourceids.StaticSegment("attestationProviders", "attestationProviders", "attestationProviders"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAttestation", "Microsoft.Attestation", "Microsoft.Attestation"), + resourceids.StaticSegment("staticAttestationProviders", "attestationProviders", "attestationProviders"), resourceids.UserSpecifiedSegment("providerName", "providerValue"), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/id_location.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/id_location.go new file mode 100644 index 00000000000..d61bc587cf7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/id_location.go @@ -0,0 +1,111 @@ +package attestationproviders + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + Location string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, location string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + Location: location, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Attestation/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAttestation", "Microsoft.Attestation", "Microsoft.Attestation"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("location", "locationValue"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location: %q", id.Location), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_create_autorest.go new file mode 100644 index 00000000000..33e7292f4a4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_create_autorest.go @@ -0,0 +1,69 @@ +package attestationproviders + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *AttestationProviders +} + +// Create ... +func (c AttestationProvidersClient) Create(ctx context.Context, id AttestationProvidersId, input AttestationServiceCreationParams) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c AttestationProvidersClient) preparerForCreate(ctx context.Context, id AttestationProvidersId, input AttestationServiceCreationParams) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c AttestationProvidersClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_delete_autorest.go new file mode 100644 index 00000000000..03c6eee1f34 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_delete_autorest.go @@ -0,0 +1,66 @@ +package attestationproviders + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c AttestationProvidersClient) Delete(ctx context.Context, id AttestationProvidersId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c AttestationProvidersClient) preparerForDelete(ctx context.Context, id AttestationProvidersId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c AttestationProvidersClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_get_autorest.go new file mode 100644 index 00000000000..59b510b6a71 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_get_autorest.go @@ -0,0 +1,68 @@ +package attestationproviders + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *AttestationProviders +} + +// Get ... +func (c AttestationProvidersClient) Get(ctx context.Context, id AttestationProvidersId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c AttestationProvidersClient) preparerForGet(ctx context.Context, id AttestationProvidersId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c AttestationProvidersClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_getdefaultbylocation_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_getdefaultbylocation_autorest.go similarity index 84% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_getdefaultbylocation_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_getdefaultbylocation_autorest.go index 39bdd31d1fd..bdd45d7ed40 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_getdefaultbylocation_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_getdefaultbylocation_autorest.go @@ -9,13 +9,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type GetDefaultByLocationResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDefaultByLocationOperationResponse struct { HttpResponse *http.Response Model *AttestationProviders } // GetDefaultByLocation ... -func (c AttestationProvidersClient) GetDefaultByLocation(ctx context.Context, id LocationId) (result GetDefaultByLocationResponse, err error) { +func (c AttestationProvidersClient) GetDefaultByLocation(ctx context.Context, id LocationId) (result GetDefaultByLocationOperationResponse, err error) { req, err := c.preparerForGetDefaultByLocation(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "GetDefaultByLocation", nil, "Failure preparing request") @@ -54,12 +57,13 @@ func (c AttestationProvidersClient) preparerForGetDefaultByLocation(ctx context. // responderForGetDefaultByLocation handles the response to the GetDefaultByLocation request. The method always // closes the http.Response Body. -func (c AttestationProvidersClient) responderForGetDefaultByLocation(resp *http.Response) (result GetDefaultByLocationResponse, err error) { +func (c AttestationProvidersClient) responderForGetDefaultByLocation(resp *http.Response) (result GetDefaultByLocationOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_list_autorest.go new file mode 100644 index 00000000000..1b66fd78024 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_list_autorest.go @@ -0,0 +1,70 @@ +package attestationproviders + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *AttestationProviderListResult +} + +// List ... +func (c AttestationProvidersClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c AttestationProvidersClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Attestation/attestationProviders", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c AttestationProvidersClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..971ee430028 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_listbyresourcegroup_autorest.go @@ -0,0 +1,70 @@ +package attestationproviders + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *AttestationProviderListResult +} + +// ListByResourceGroup ... +func (c AttestationProvidersClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c AttestationProvidersClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Attestation/attestationProviders", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c AttestationProvidersClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_listdefault_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_listdefault_autorest.go similarity index 80% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_listdefault_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_listdefault_autorest.go index 85b3865b7ef..3443af76b68 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_listdefault_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_listdefault_autorest.go @@ -7,15 +7,19 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" ) -type ListDefaultResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListDefaultOperationResponse struct { HttpResponse *http.Response Model *AttestationProviderListResult } // ListDefault ... -func (c AttestationProvidersClient) ListDefault(ctx context.Context, id SubscriptionId) (result ListDefaultResponse, err error) { +func (c AttestationProvidersClient) ListDefault(ctx context.Context, id commonids.SubscriptionId) (result ListDefaultOperationResponse, err error) { req, err := c.preparerForListDefault(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "ListDefault", nil, "Failure preparing request") @@ -38,7 +42,7 @@ func (c AttestationProvidersClient) ListDefault(ctx context.Context, id Subscrip } // preparerForListDefault prepares the ListDefault request. -func (c AttestationProvidersClient) preparerForListDefault(ctx context.Context, id SubscriptionId) (*http.Request, error) { +func (c AttestationProvidersClient) preparerForListDefault(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -54,12 +58,13 @@ func (c AttestationProvidersClient) preparerForListDefault(ctx context.Context, // responderForListDefault handles the response to the ListDefault request. The method always // closes the http.Response Body. -func (c AttestationProvidersClient) responderForListDefault(resp *http.Response) (result ListDefaultResponse, err error) { +func (c AttestationProvidersClient) responderForListDefault(resp *http.Response) (result ListDefaultOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_update_autorest.go new file mode 100644 index 00000000000..a4610388e86 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/method_update_autorest.go @@ -0,0 +1,69 @@ +package attestationproviders + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *AttestationProviders +} + +// Update ... +func (c AttestationProvidersClient) Update(ctx context.Context, id AttestationProvidersId, input AttestationServicePatchParams) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c AttestationProvidersClient) preparerForUpdate(ctx context.Context, id AttestationProvidersId, input AttestationServicePatchParams) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c AttestationProvidersClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_attestationproviderlistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_attestationproviderlistresult.go new file mode 100644 index 00000000000..690d9a92fe1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_attestationproviderlistresult.go @@ -0,0 +1,13 @@ +package attestationproviders + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttestationProviderListResult struct { + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Value *[]AttestationProviders `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_attestationproviders.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_attestationproviders.go new file mode 100644 index 00000000000..273caabcb23 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_attestationproviders.go @@ -0,0 +1,18 @@ +package attestationproviders + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttestationProviders struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *StatusResult `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_attestationservicecreationparams.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_attestationservicecreationparams.go new file mode 100644 index 00000000000..bb55c6b371c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_attestationservicecreationparams.go @@ -0,0 +1,10 @@ +package attestationproviders + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttestationServiceCreationParams struct { + Location string `json:"location"` + Properties AttestationServiceCreationSpecificParams `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_attestationservicecreationspecificparams.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_attestationservicecreationspecificparams.go new file mode 100644 index 00000000000..1e981ad9206 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_attestationservicecreationspecificparams.go @@ -0,0 +1,8 @@ +package attestationproviders + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttestationServiceCreationSpecificParams struct { + PolicySigningCertificates *JsonWebKeySet `json:"policySigningCertificates,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_attestationservicepatchparams.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_attestationservicepatchparams.go new file mode 100644 index 00000000000..e4ed91ba993 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_attestationservicepatchparams.go @@ -0,0 +1,8 @@ +package attestationproviders + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttestationServicePatchParams struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_jsonwebkey.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_jsonwebkey.go similarity index 81% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_jsonwebkey.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_jsonwebkey.go index e946fb96802..3bb8473e4d0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_jsonwebkey.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_jsonwebkey.go @@ -1,5 +1,8 @@ package attestationproviders +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type JsonWebKey struct { Alg *string `json:"alg,omitempty"` Crv *string `json:"crv,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_jsonwebkeyset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_jsonwebkeyset.go new file mode 100644 index 00000000000..cf265e6df87 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_jsonwebkeyset.go @@ -0,0 +1,8 @@ +package attestationproviders + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type JsonWebKeySet struct { + Keys *[]JsonWebKey `json:"keys,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_privateendpoint.go new file mode 100644 index 00000000000..b359d0e3120 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_privateendpoint.go @@ -0,0 +1,8 @@ +package attestationproviders + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_privateendpointconnection.go new file mode 100644 index 00000000000..073d38791c9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package attestationproviders + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..c97234918c3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package attestationproviders + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_privatelinkserviceconnectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..ef2bbdafd21 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package attestationproviders + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_statusresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_statusresult.go new file mode 100644 index 00000000000..e7adc66ba0b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/model_statusresult.go @@ -0,0 +1,11 @@ +package attestationproviders + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StatusResult struct { + AttestUri *string `json:"attestUri,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + Status *AttestationServiceStatus `json:"status,omitempty"` + TrustModel *string `json:"trustModel,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/version.go new file mode 100644 index 00000000000..f317f810f5e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders/version.go @@ -0,0 +1,12 @@ +package attestationproviders + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/attestationproviders/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/README.md new file mode 100644 index 00000000000..f0e30e273d5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount` Documentation + +The `automationaccount` SDK allows for interaction with the Azure Resource Manager Service `automation` (API Version `2021-06-22`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount" +``` + + +### Client Initialization + +```go +client := automationaccount.NewAutomationAccountClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AutomationAccountClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := automationaccount.NewAutomationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "automationAccountValue") + +payload := automationaccount.AutomationAccountCreateOrUpdateParameters{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AutomationAccountClient.Delete` + +```go +ctx := context.TODO() +id := automationaccount.NewAutomationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "automationAccountValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AutomationAccountClient.Get` + +```go +ctx := context.TODO() +id := automationaccount.NewAutomationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "automationAccountValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AutomationAccountClient.List` + +```go +ctx := context.TODO() +id := automationaccount.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AutomationAccountClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := automationaccount.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AutomationAccountClient.Update` + +```go +ctx := context.TODO() +id := automationaccount.NewAutomationAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "automationAccountValue") + +payload := automationaccount.AutomationAccountUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/client.go new file mode 100644 index 00000000000..e5abe278fa4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/client.go @@ -0,0 +1,18 @@ +package automationaccount + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationAccountClient struct { + Client autorest.Client + baseUri string +} + +func NewAutomationAccountClientWithBaseURI(endpoint string) AutomationAccountClient { + return AutomationAccountClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/constants.go new file mode 100644 index 00000000000..720d1402880 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/constants.go @@ -0,0 +1,93 @@ +package automationaccount + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationAccountState string + +const ( + AutomationAccountStateOk AutomationAccountState = "Ok" + AutomationAccountStateSuspended AutomationAccountState = "Suspended" + AutomationAccountStateUnavailable AutomationAccountState = "Unavailable" +) + +func PossibleValuesForAutomationAccountState() []string { + return []string{ + string(AutomationAccountStateOk), + string(AutomationAccountStateSuspended), + string(AutomationAccountStateUnavailable), + } +} + +func parseAutomationAccountState(input string) (*AutomationAccountState, error) { + vals := map[string]AutomationAccountState{ + "ok": AutomationAccountStateOk, + "suspended": AutomationAccountStateSuspended, + "unavailable": AutomationAccountStateUnavailable, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutomationAccountState(input) + return &out, nil +} + +type EncryptionKeySourceType string + +const ( + EncryptionKeySourceTypeMicrosoftPointAutomation EncryptionKeySourceType = "Microsoft.Automation" + EncryptionKeySourceTypeMicrosoftPointKeyvault EncryptionKeySourceType = "Microsoft.Keyvault" +) + +func PossibleValuesForEncryptionKeySourceType() []string { + return []string{ + string(EncryptionKeySourceTypeMicrosoftPointAutomation), + string(EncryptionKeySourceTypeMicrosoftPointKeyvault), + } +} + +func parseEncryptionKeySourceType(input string) (*EncryptionKeySourceType, error) { + vals := map[string]EncryptionKeySourceType{ + "microsoft.automation": EncryptionKeySourceTypeMicrosoftPointAutomation, + "microsoft.keyvault": EncryptionKeySourceTypeMicrosoftPointKeyvault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EncryptionKeySourceType(input) + return &out, nil +} + +type SkuNameEnum string + +const ( + SkuNameEnumBasic SkuNameEnum = "Basic" + SkuNameEnumFree SkuNameEnum = "Free" +) + +func PossibleValuesForSkuNameEnum() []string { + return []string{ + string(SkuNameEnumBasic), + string(SkuNameEnumFree), + } +} + +func parseSkuNameEnum(input string) (*SkuNameEnum, error) { + vals := map[string]SkuNameEnum{ + "basic": SkuNameEnumBasic, + "free": SkuNameEnumFree, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuNameEnum(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/id_automationaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/id_automationaccount.go new file mode 100644 index 00000000000..622578978d6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/id_automationaccount.go @@ -0,0 +1,124 @@ +package automationaccount + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AutomationAccountId{} + +// AutomationAccountId is a struct representing the Resource ID for a Automation Account +type AutomationAccountId struct { + SubscriptionId string + ResourceGroupName string + AutomationAccountName string +} + +// NewAutomationAccountID returns a new AutomationAccountId struct +func NewAutomationAccountID(subscriptionId string, resourceGroupName string, automationAccountName string) AutomationAccountId { + return AutomationAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AutomationAccountName: automationAccountName, + } +} + +// ParseAutomationAccountID parses 'input' into a AutomationAccountId +func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AutomationAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AutomationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'automationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAutomationAccountIDInsensitively parses 'input' case-insensitively into a AutomationAccountId +// note: this method should only be used for API response data and not user input +func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AutomationAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AutomationAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { + return nil, fmt.Errorf("the segment 'automationAccountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID +func ValidateAutomationAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAutomationAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Automation Account ID +func (id AutomationAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Automation/automationAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AutomationAccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Automation Account ID +func (id AutomationAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAutomation", "Microsoft.Automation", "Microsoft.Automation"), + resourceids.StaticSegment("staticAutomationAccounts", "automationAccounts", "automationAccounts"), + resourceids.UserSpecifiedSegment("automationAccountName", "automationAccountValue"), + } +} + +// String returns a human-readable description of this Automation Account ID +func (id AutomationAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Automation Account Name: %q", id.AutomationAccountName), + } + return fmt.Sprintf("Automation Account (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_createorupdate_autorest.go new file mode 100644 index 00000000000..9ca9eedcf4e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package automationaccount + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *AutomationAccount +} + +// CreateOrUpdate ... +func (c AutomationAccountClient) CreateOrUpdate(ctx context.Context, id AutomationAccountId, input AutomationAccountCreateOrUpdateParameters) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c AutomationAccountClient) preparerForCreateOrUpdate(ctx context.Context, id AutomationAccountId, input AutomationAccountCreateOrUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c AutomationAccountClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_delete_autorest.go new file mode 100644 index 00000000000..04aa852b82e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_delete_autorest.go @@ -0,0 +1,66 @@ +package automationaccount + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c AutomationAccountClient) Delete(ctx context.Context, id AutomationAccountId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c AutomationAccountClient) preparerForDelete(ctx context.Context, id AutomationAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c AutomationAccountClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_get_autorest.go new file mode 100644 index 00000000000..4c582e8f9f1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_get_autorest.go @@ -0,0 +1,68 @@ +package automationaccount + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *AutomationAccount +} + +// Get ... +func (c AutomationAccountClient) Get(ctx context.Context, id AutomationAccountId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c AutomationAccountClient) preparerForGet(ctx context.Context, id AutomationAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c AutomationAccountClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_list_autorest.go new file mode 100644 index 00000000000..eeee92f3aea --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_list_autorest.go @@ -0,0 +1,187 @@ +package automationaccount + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]AutomationAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []AutomationAccount +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c AutomationAccountClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c AutomationAccountClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Automation/automationAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c AutomationAccountClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c AutomationAccountClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []AutomationAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c AutomationAccountClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, AutomationAccountOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AutomationAccountClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate AutomationAccountOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]AutomationAccount, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..9b7d0e54005 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package automationaccount + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]AutomationAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []AutomationAccount +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c AutomationAccountClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c AutomationAccountClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Automation/automationAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c AutomationAccountClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c AutomationAccountClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []AutomationAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c AutomationAccountClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, AutomationAccountOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AutomationAccountClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate AutomationAccountOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]AutomationAccount, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_update_autorest.go new file mode 100644 index 00000000000..166c133ee26 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/method_update_autorest.go @@ -0,0 +1,69 @@ +package automationaccount + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *AutomationAccount +} + +// Update ... +func (c AutomationAccountClient) Update(ctx context.Context, id AutomationAccountId, input AutomationAccountUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "automationaccount.AutomationAccountClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c AutomationAccountClient) preparerForUpdate(ctx context.Context, id AutomationAccountId, input AutomationAccountUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c AutomationAccountClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccount.go new file mode 100644 index 00000000000..b95604324bd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccount.go @@ -0,0 +1,21 @@ +package automationaccount + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationAccount struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AutomationAccountProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccountcreateorupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccountcreateorupdateparameters.go new file mode 100644 index 00000000000..63cc08e2fc4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccountcreateorupdateparameters.go @@ -0,0 +1,16 @@ +package automationaccount + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationAccountCreateOrUpdateParameters struct { + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AutomationAccountCreateOrUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccountcreateorupdateproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccountcreateorupdateproperties.go new file mode 100644 index 00000000000..9f0325c18ef --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccountcreateorupdateproperties.go @@ -0,0 +1,11 @@ +package automationaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationAccountCreateOrUpdateProperties struct { + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + Encryption *EncryptionProperties `json:"encryption,omitempty"` + PublicNetworkAccess *bool `json:"publicNetworkAccess,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccountproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccountproperties.go new file mode 100644 index 00000000000..4a52729a341 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccountproperties.go @@ -0,0 +1,48 @@ +package automationaccount + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationAccountProperties struct { + AutomationHybridServiceUrl *string `json:"automationHybridServiceUrl,omitempty"` + CreationTime *string `json:"creationTime,omitempty"` + Description *string `json:"description,omitempty"` + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + Encryption *EncryptionProperties `json:"encryption,omitempty"` + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + LastModifiedTime *string `json:"lastModifiedTime,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + PublicNetworkAccess *bool `json:"publicNetworkAccess,omitempty"` + Sku *Sku `json:"sku,omitempty"` + State *AutomationAccountState `json:"state,omitempty"` +} + +func (o *AutomationAccountProperties) GetCreationTimeAsTime() (*time.Time, error) { + if o.CreationTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreationTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutomationAccountProperties) SetCreationTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreationTime = &formatted +} + +func (o *AutomationAccountProperties) GetLastModifiedTimeAsTime() (*time.Time, error) { + if o.LastModifiedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModifiedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutomationAccountProperties) SetLastModifiedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModifiedTime = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccountupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccountupdateparameters.go new file mode 100644 index 00000000000..9855a40c4a1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccountupdateparameters.go @@ -0,0 +1,16 @@ +package automationaccount + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationAccountUpdateParameters struct { + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AutomationAccountUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccountupdateproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccountupdateproperties.go new file mode 100644 index 00000000000..7a3970e64fd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_automationaccountupdateproperties.go @@ -0,0 +1,11 @@ +package automationaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationAccountUpdateProperties struct { + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + Encryption *EncryptionProperties `json:"encryption,omitempty"` + PublicNetworkAccess *bool `json:"publicNetworkAccess,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_encryptionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_encryptionproperties.go new file mode 100644 index 00000000000..b01f327857e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_encryptionproperties.go @@ -0,0 +1,10 @@ +package automationaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionProperties struct { + Identity *EncryptionPropertiesIdentity `json:"identity,omitempty"` + KeySource *EncryptionKeySourceType `json:"keySource,omitempty"` + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_encryptionpropertiesidentity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_encryptionpropertiesidentity.go new file mode 100644 index 00000000000..f295cc93f97 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_encryptionpropertiesidentity.go @@ -0,0 +1,8 @@ +package automationaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionPropertiesIdentity struct { + UserAssignedIdentity *interface{} `json:"userAssignedIdentity,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_keyvaultproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_keyvaultproperties.go new file mode 100644 index 00000000000..26155817fab --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_keyvaultproperties.go @@ -0,0 +1,10 @@ +package automationaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultProperties struct { + KeyName *string `json:"keyName,omitempty"` + KeyVersion *string `json:"keyVersion,omitempty"` + KeyvaultUri *string `json:"keyvaultUri,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_privateendpointconnection.go new file mode 100644 index 00000000000..771c3d87b7e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package automationaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..be495fc43e2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package automationaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + GroupIds *[]string `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_privateendpointproperty.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_privateendpointproperty.go new file mode 100644 index 00000000000..1a0f9554384 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_privateendpointproperty.go @@ -0,0 +1,8 @@ +package automationaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointProperty struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_privatelinkserviceconnectionstateproperty.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_privatelinkserviceconnectionstateproperty.go new file mode 100644 index 00000000000..7bdbb686816 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_privatelinkserviceconnectionstateproperty.go @@ -0,0 +1,10 @@ +package automationaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionStateProperty struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *string `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_sku.go new file mode 100644 index 00000000000..0e4ac06e953 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/model_sku.go @@ -0,0 +1,10 @@ +package automationaccount + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name SkuNameEnum `json:"name"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/predicates.go new file mode 100644 index 00000000000..bad61ec4e99 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/predicates.go @@ -0,0 +1,34 @@ +package automationaccount + +type AutomationAccountOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p AutomationAccountOperationPredicate) Matches(input AutomationAccount) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/version.go new file mode 100644 index 00000000000..dc533843b89 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount/version.go @@ -0,0 +1,12 @@ +package automationaccount + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-22" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/automationaccount/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/README.md new file mode 100644 index 00000000000..b9a4f1ff150 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters` Documentation + +The `clusters` SDK allows for interaction with the Azure Resource Manager Service `azurestackhci` (API Version `2020-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters" +``` + + +### Client Initialization + +```go +client := clusters.NewClustersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ClustersClient.Create` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := clusters.Cluster{ + // ... +} + + +read, err := client.Create(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClustersClient.Delete` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClustersClient.Get` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClustersClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := clusters.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ClustersClient.ListBySubscription` + +```go +ctx := context.TODO() +id := clusters.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ClustersClient.Update` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := clusters.ClusterUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/client.go new file mode 100644 index 00000000000..1e6fabf8cba --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/client.go @@ -0,0 +1,18 @@ +package clusters + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClustersClient struct { + Client autorest.Client + baseUri string +} + +func NewClustersClientWithBaseURI(endpoint string) ClustersClient { + return ClustersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/constants.go new file mode 100644 index 00000000000..5727eacee51 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/constants.go @@ -0,0 +1,80 @@ +package clusters + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type Status string + +const ( + StatusConnectedRecently Status = "ConnectedRecently" + StatusDisconnected Status = "Disconnected" + StatusError Status = "Error" + StatusNotConnectedRecently Status = "NotConnectedRecently" + StatusNotYetRegistered Status = "NotYetRegistered" +) + +func PossibleValuesForStatus() []string { + return []string{ + string(StatusConnectedRecently), + string(StatusDisconnected), + string(StatusError), + string(StatusNotConnectedRecently), + string(StatusNotYetRegistered), + } +} + +func parseStatus(input string) (*Status, error) { + vals := map[string]Status{ + "connectedrecently": StatusConnectedRecently, + "disconnected": StatusDisconnected, + "error": StatusError, + "notconnectedrecently": StatusNotConnectedRecently, + "notyetregistered": StatusNotYetRegistered, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/id_cluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/id_cluster.go new file mode 100644 index 00000000000..2c50b82d34a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/id_cluster.go @@ -0,0 +1,124 @@ +package clusters + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ClusterId{} + +// ClusterId is a struct representing the Resource ID for a Cluster +type ClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewClusterID returns a new ClusterId struct +func NewClusterID(subscriptionId string, resourceGroupName string, clusterName string) ClusterId { + return ClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseClusterID parses 'input' into a ClusterId +func ParseClusterID(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseClusterIDInsensitively parses 'input' case-insensitively into a ClusterId +// note: this method should only be used for API response data and not user input +func ParseClusterIDInsensitively(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateClusterID checks that 'input' can be parsed as a Cluster ID +func ValidateClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cluster ID +func (id ClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cluster ID +func (id ClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftAzureStackHCI", "Microsoft.AzureStackHCI", "Microsoft.AzureStackHCI"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Cluster ID +func (id ClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_create_autorest.go new file mode 100644 index 00000000000..ed5732c9a93 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_create_autorest.go @@ -0,0 +1,69 @@ +package clusters + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *Cluster +} + +// Create ... +func (c ClustersClient) Create(ctx context.Context, id ClusterId, input Cluster) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c ClustersClient) preparerForCreate(ctx context.Context, id ClusterId, input Cluster) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_delete_autorest.go new file mode 100644 index 00000000000..3185fed14ca --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_delete_autorest.go @@ -0,0 +1,66 @@ +package clusters + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ClustersClient) Delete(ctx context.Context, id ClusterId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ClustersClient) preparerForDelete(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_get_autorest.go new file mode 100644 index 00000000000..2957d3dd8de --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_get_autorest.go @@ -0,0 +1,68 @@ +package clusters + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Cluster +} + +// Get ... +func (c ClustersClient) Get(ctx context.Context, id ClusterId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ClustersClient) preparerForGet(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..2e68a700b66 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Cluster + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Cluster +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c ClustersClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ClustersClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AzureStackHCI/clusters", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c ClustersClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Cluster `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c ClustersClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ClusterOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ClustersClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ClusterOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Cluster, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..a3c34eaa0f8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Cluster + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []Cluster +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c ClustersClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c ClustersClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AzureStackHCI/clusters", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c ClustersClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Cluster `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c ClustersClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ClusterOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ClustersClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ClusterOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]Cluster, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_update_autorest.go new file mode 100644 index 00000000000..2180bee7532 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/method_update_autorest.go @@ -0,0 +1,69 @@ +package clusters + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Cluster +} + +// Update ... +func (c ClustersClient) Update(ctx context.Context, id ClusterId, input ClusterUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ClustersClient) preparerForUpdate(ctx context.Context, id ClusterId, input ClusterUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/model_cluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/model_cluster.go new file mode 100644 index 00000000000..e551e3f2e59 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/model_cluster.go @@ -0,0 +1,18 @@ +package clusters + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Cluster struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ClusterProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/model_clusternode.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/model_clusternode.go new file mode 100644 index 00000000000..ee594fab201 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/model_clusternode.go @@ -0,0 +1,16 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterNode struct { + CoreCount *float64 `json:"coreCount,omitempty"` + Id *float64 `json:"id,omitempty"` + Manufacturer *string `json:"manufacturer,omitempty"` + MemoryInGiB *float64 `json:"memoryInGiB,omitempty"` + Model *string `json:"model,omitempty"` + Name *string `json:"name,omitempty"` + OsName *string `json:"osName,omitempty"` + OsVersion *string `json:"osVersion,omitempty"` + SerialNumber *string `json:"serialNumber,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/model_clusterproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/model_clusterproperties.go new file mode 100644 index 00000000000..447b291f05e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/model_clusterproperties.go @@ -0,0 +1,60 @@ +package clusters + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterProperties struct { + AadClientId string `json:"aadClientId"` + AadTenantId string `json:"aadTenantId"` + BillingModel *string `json:"billingModel,omitempty"` + CloudId *string `json:"cloudId,omitempty"` + LastBillingTimestamp *string `json:"lastBillingTimestamp,omitempty"` + LastSyncTimestamp *string `json:"lastSyncTimestamp,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RegistrationTimestamp *string `json:"registrationTimestamp,omitempty"` + ReportedProperties *ClusterReportedProperties `json:"reportedProperties,omitempty"` + Status *Status `json:"status,omitempty"` + TrialDaysRemaining *float64 `json:"trialDaysRemaining,omitempty"` +} + +func (o *ClusterProperties) GetLastBillingTimestampAsTime() (*time.Time, error) { + if o.LastBillingTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastBillingTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterProperties) SetLastBillingTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastBillingTimestamp = &formatted +} + +func (o *ClusterProperties) GetLastSyncTimestampAsTime() (*time.Time, error) { + if o.LastSyncTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastSyncTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterProperties) SetLastSyncTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastSyncTimestamp = &formatted +} + +func (o *ClusterProperties) GetRegistrationTimestampAsTime() (*time.Time, error) { + if o.RegistrationTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.RegistrationTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterProperties) SetRegistrationTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.RegistrationTimestamp = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/model_clusterreportedproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/model_clusterreportedproperties.go new file mode 100644 index 00000000000..77b38715579 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/model_clusterreportedproperties.go @@ -0,0 +1,30 @@ +package clusters + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterReportedProperties struct { + ClusterId *string `json:"clusterId,omitempty"` + ClusterName *string `json:"clusterName,omitempty"` + ClusterVersion *string `json:"clusterVersion,omitempty"` + LastUpdated *string `json:"lastUpdated,omitempty"` + Nodes *[]ClusterNode `json:"nodes,omitempty"` +} + +func (o *ClusterReportedProperties) GetLastUpdatedAsTime() (*time.Time, error) { + if o.LastUpdated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdated, "2006-01-02T15:04:05Z07:00") +} + +func (o *ClusterReportedProperties) SetLastUpdatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdated = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/model_clusterupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/model_clusterupdate.go new file mode 100644 index 00000000000..0941a771374 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/model_clusterupdate.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterUpdate struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/predicates.go new file mode 100644 index 00000000000..310bf92b2d6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/predicates.go @@ -0,0 +1,29 @@ +package clusters + +type ClusterOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ClusterOperationPredicate) Matches(input Cluster) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/version.go new file mode 100644 index 00000000000..83d4976c312 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters/version.go @@ -0,0 +1,12 @@ +package clusters + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/clusters/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/README.md new file mode 100644 index 00000000000..5e0fce157c0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/README.md @@ -0,0 +1,289 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts` Documentation + +The `cognitiveservicesaccounts` SDK allows for interaction with the Azure Resource Manager Service `cognitive` (API Version `2021-04-30`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts" +``` + + +### Client Initialization + +```go +client := cognitiveservicesaccounts.NewCognitiveServicesAccountsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CognitiveServicesAccountsClient.AccountsCreate` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := cognitiveservicesaccounts.Account{ + // ... +} + + +if err := client.AccountsCreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CognitiveServicesAccountsClient.AccountsDelete` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +if err := client.AccountsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CognitiveServicesAccountsClient.AccountsGet` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.AccountsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CognitiveServicesAccountsClient.AccountsList` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.AccountsList(ctx, id)` can be used to do batched pagination +items, err := client.AccountsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CognitiveServicesAccountsClient.AccountsListByResourceGroup` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.AccountsListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.AccountsListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CognitiveServicesAccountsClient.AccountsListKeys` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.AccountsListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CognitiveServicesAccountsClient.AccountsListSkus` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.AccountsListSkus(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CognitiveServicesAccountsClient.AccountsListUsages` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.AccountsListUsages(ctx, id, cognitiveservicesaccounts.DefaultAccountsListUsagesOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CognitiveServicesAccountsClient.AccountsRegenerateKey` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := cognitiveservicesaccounts.RegenerateKeyParameters{ + // ... +} + + +read, err := client.AccountsRegenerateKey(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CognitiveServicesAccountsClient.AccountsUpdate` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := cognitiveservicesaccounts.Account{ + // ... +} + + +if err := client.AccountsUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CognitiveServicesAccountsClient.CheckDomainAvailability` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := cognitiveservicesaccounts.CheckDomainAvailabilityParameter{ + // ... +} + + +read, err := client.CheckDomainAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CognitiveServicesAccountsClient.CheckSkuAvailability` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +payload := cognitiveservicesaccounts.CheckSkuAvailabilityParameter{ + // ... +} + + +read, err := client.CheckSkuAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CognitiveServicesAccountsClient.DeletedAccountsGet` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewDeletedAccountID("12345678-1234-9876-4563-123456789012", "locationValue", "example-resource-group", "accountValue") + +read, err := client.DeletedAccountsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CognitiveServicesAccountsClient.DeletedAccountsList` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.DeletedAccountsList(ctx, id)` can be used to do batched pagination +items, err := client.DeletedAccountsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CognitiveServicesAccountsClient.DeletedAccountsPurge` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewDeletedAccountID("12345678-1234-9876-4563-123456789012", "locationValue", "example-resource-group", "accountValue") + +if err := client.DeletedAccountsPurgeThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CognitiveServicesAccountsClient.ResourceSkusList` + +```go +ctx := context.TODO() +id := cognitiveservicesaccounts.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ResourceSkusList(ctx, id)` can be used to do batched pagination +items, err := client.ResourceSkusListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/client.go new file mode 100644 index 00000000000..a5babe44865 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/client.go @@ -0,0 +1,18 @@ +package cognitiveservicesaccounts + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CognitiveServicesAccountsClient struct { + Client autorest.Client + baseUri string +} + +func NewCognitiveServicesAccountsClientWithBaseURI(endpoint string) CognitiveServicesAccountsClient { + return CognitiveServicesAccountsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/constants.go new file mode 100644 index 00000000000..e19aa508de1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/constants.go @@ -0,0 +1,396 @@ +package cognitiveservicesaccounts + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyName string + +const ( + KeyNameKeyOne KeyName = "Key1" + KeyNameKeyTwo KeyName = "Key2" +) + +func PossibleValuesForKeyName() []string { + return []string{ + string(KeyNameKeyOne), + string(KeyNameKeyTwo), + } +} + +func parseKeyName(input string) (*KeyName, error) { + vals := map[string]KeyName{ + "key1": KeyNameKeyOne, + "key2": KeyNameKeyTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyName(input) + return &out, nil +} + +type KeySource string + +const ( + KeySourceMicrosoftPointCognitiveServices KeySource = "Microsoft.CognitiveServices" + KeySourceMicrosoftPointKeyVault KeySource = "Microsoft.KeyVault" +) + +func PossibleValuesForKeySource() []string { + return []string{ + string(KeySourceMicrosoftPointCognitiveServices), + string(KeySourceMicrosoftPointKeyVault), + } +} + +func parseKeySource(input string) (*KeySource, error) { + vals := map[string]KeySource{ + "microsoft.cognitiveservices": KeySourceMicrosoftPointCognitiveServices, + "microsoft.keyvault": KeySourceMicrosoftPointKeyVault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeySource(input) + return &out, nil +} + +type NetworkRuleAction string + +const ( + NetworkRuleActionAllow NetworkRuleAction = "Allow" + NetworkRuleActionDeny NetworkRuleAction = "Deny" +) + +func PossibleValuesForNetworkRuleAction() []string { + return []string{ + string(NetworkRuleActionAllow), + string(NetworkRuleActionDeny), + } +} + +func parseNetworkRuleAction(input string) (*NetworkRuleAction, error) { + vals := map[string]NetworkRuleAction{ + "allow": NetworkRuleActionAllow, + "deny": NetworkRuleActionDeny, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkRuleAction(input) + return &out, nil +} + +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + } +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { + return []string{ + string(PrivateEndpointServiceConnectionStatusApproved), + string(PrivateEndpointServiceConnectionStatusPending), + string(PrivateEndpointServiceConnectionStatusRejected), + } +} + +func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { + vals := map[string]PrivateEndpointServiceConnectionStatus{ + "approved": PrivateEndpointServiceConnectionStatusApproved, + "pending": PrivateEndpointServiceConnectionStatusPending, + "rejected": PrivateEndpointServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointServiceConnectionStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateResolvingDNS ProvisioningState = "ResolvingDNS" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateResolvingDNS), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "resolvingdns": ProvisioningStateResolvingDNS, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} + +type QuotaUsageStatus string + +const ( + QuotaUsageStatusBlocked QuotaUsageStatus = "Blocked" + QuotaUsageStatusInOverage QuotaUsageStatus = "InOverage" + QuotaUsageStatusIncluded QuotaUsageStatus = "Included" + QuotaUsageStatusUnknown QuotaUsageStatus = "Unknown" +) + +func PossibleValuesForQuotaUsageStatus() []string { + return []string{ + string(QuotaUsageStatusBlocked), + string(QuotaUsageStatusInOverage), + string(QuotaUsageStatusIncluded), + string(QuotaUsageStatusUnknown), + } +} + +func parseQuotaUsageStatus(input string) (*QuotaUsageStatus, error) { + vals := map[string]QuotaUsageStatus{ + "blocked": QuotaUsageStatusBlocked, + "inoverage": QuotaUsageStatusInOverage, + "included": QuotaUsageStatusIncluded, + "unknown": QuotaUsageStatusUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := QuotaUsageStatus(input) + return &out, nil +} + +type ResourceSkuRestrictionsReasonCode string + +const ( + ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription ResourceSkuRestrictionsReasonCode = "NotAvailableForSubscription" + ResourceSkuRestrictionsReasonCodeQuotaId ResourceSkuRestrictionsReasonCode = "QuotaId" +) + +func PossibleValuesForResourceSkuRestrictionsReasonCode() []string { + return []string{ + string(ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription), + string(ResourceSkuRestrictionsReasonCodeQuotaId), + } +} + +func parseResourceSkuRestrictionsReasonCode(input string) (*ResourceSkuRestrictionsReasonCode, error) { + vals := map[string]ResourceSkuRestrictionsReasonCode{ + "notavailableforsubscription": ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription, + "quotaid": ResourceSkuRestrictionsReasonCodeQuotaId, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceSkuRestrictionsReasonCode(input) + return &out, nil +} + +type ResourceSkuRestrictionsType string + +const ( + ResourceSkuRestrictionsTypeLocation ResourceSkuRestrictionsType = "Location" + ResourceSkuRestrictionsTypeZone ResourceSkuRestrictionsType = "Zone" +) + +func PossibleValuesForResourceSkuRestrictionsType() []string { + return []string{ + string(ResourceSkuRestrictionsTypeLocation), + string(ResourceSkuRestrictionsTypeZone), + } +} + +func parseResourceSkuRestrictionsType(input string) (*ResourceSkuRestrictionsType, error) { + vals := map[string]ResourceSkuRestrictionsType{ + "location": ResourceSkuRestrictionsTypeLocation, + "zone": ResourceSkuRestrictionsTypeZone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceSkuRestrictionsType(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierEnterprise SkuTier = "Enterprise" + SkuTierFree SkuTier = "Free" + SkuTierPremium SkuTier = "Premium" + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierEnterprise), + string(SkuTierFree), + string(SkuTierPremium), + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "enterprise": SkuTierEnterprise, + "free": SkuTierFree, + "premium": SkuTierPremium, + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} + +type UnitType string + +const ( + UnitTypeBytes UnitType = "Bytes" + UnitTypeBytesPerSecond UnitType = "BytesPerSecond" + UnitTypeCount UnitType = "Count" + UnitTypeCountPerSecond UnitType = "CountPerSecond" + UnitTypeMilliseconds UnitType = "Milliseconds" + UnitTypePercent UnitType = "Percent" + UnitTypeSeconds UnitType = "Seconds" +) + +func PossibleValuesForUnitType() []string { + return []string{ + string(UnitTypeBytes), + string(UnitTypeBytesPerSecond), + string(UnitTypeCount), + string(UnitTypeCountPerSecond), + string(UnitTypeMilliseconds), + string(UnitTypePercent), + string(UnitTypeSeconds), + } +} + +func parseUnitType(input string) (*UnitType, error) { + vals := map[string]UnitType{ + "bytes": UnitTypeBytes, + "bytespersecond": UnitTypeBytesPerSecond, + "count": UnitTypeCount, + "countpersecond": UnitTypeCountPerSecond, + "milliseconds": UnitTypeMilliseconds, + "percent": UnitTypePercent, + "seconds": UnitTypeSeconds, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UnitType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/id_account.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/id_account.go new file mode 100644 index 00000000000..27e93a4eb29 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/id_account.go @@ -0,0 +1,124 @@ +package cognitiveservicesaccounts + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AccountId{} + +// AccountId is a struct representing the Resource ID for a Account +type AccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewAccountID returns a new AccountId struct +func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { + return AccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseAccountID parses 'input' into a AccountId +func ParseAccountID(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId +// note: this method should only be used for API response data and not user input +func ParseAccountIDInsensitively(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAccountID checks that 'input' can be parsed as a Account ID +func ValidateAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Account ID +func (id AccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.CognitiveServices/accounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Account ID +func (id AccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCognitiveServices", "Microsoft.CognitiveServices", "Microsoft.CognitiveServices"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Account ID +func (id AccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/id_deletedaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/id_deletedaccount.go similarity index 89% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/id_deletedaccount.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/id_deletedaccount.go index aec2d9a947f..a4b9b279e2d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/id_deletedaccount.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/id_deletedaccount.go @@ -112,15 +112,15 @@ func (id DeletedAccountId) ID() string { // Segments returns a slice of Resource ID Segments which comprise this Deleted Account ID func (id DeletedAccountId) Segments() []resourceids.Segment { return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftCognitiveServices", "Microsoft.CognitiveServices", "Microsoft.CognitiveServices"), - resourceids.StaticSegment("locations", "locations", "locations"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCognitiveServices", "Microsoft.CognitiveServices", "Microsoft.CognitiveServices"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), resourceids.UserSpecifiedSegment("location", "locationValue"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("deletedAccounts", "deletedAccounts", "deletedAccounts"), + resourceids.StaticSegment("staticDeletedAccounts", "deletedAccounts", "deletedAccounts"), resourceids.UserSpecifiedSegment("accountName", "accountValue"), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/id_location.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/id_location.go new file mode 100644 index 00000000000..b37f22375c3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/id_location.go @@ -0,0 +1,111 @@ +package cognitiveservicesaccounts + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + Location string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, location string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + Location: location, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.CognitiveServices/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCognitiveServices", "Microsoft.CognitiveServices", "Microsoft.CognitiveServices"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("location", "locationValue"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location: %q", id.Location), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountscreate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountscreate_autorest.go similarity index 84% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountscreate_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountscreate_autorest.go index 1bc14cefbd7..265d03e0329 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountscreate_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountscreate_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type AccountsCreateResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsCreateOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // AccountsCreate ... -func (c CognitiveServicesAccountsClient) AccountsCreate(ctx context.Context, id AccountId, input Account) (result AccountsCreateResponse, err error) { +func (c CognitiveServicesAccountsClient) AccountsCreate(ctx context.Context, id AccountId, input Account) (result AccountsCreateOperationResponse, err error) { req, err := c.preparerForAccountsCreate(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsCreate", nil, "Failure preparing request") @@ -64,12 +67,13 @@ func (c CognitiveServicesAccountsClient) preparerForAccountsCreate(ctx context.C // senderForAccountsCreate sends the AccountsCreate request. The method will close the // http.Response Body if it receives an error. -func (c CognitiveServicesAccountsClient) senderForAccountsCreate(ctx context.Context, req *http.Request) (future AccountsCreateResponse, err error) { +func (c CognitiveServicesAccountsClient) senderForAccountsCreate(ctx context.Context, req *http.Request) (future AccountsCreateOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsdelete_autorest.go new file mode 100644 index 00000000000..b2e86ca8f3a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsdelete_autorest.go @@ -0,0 +1,78 @@ +package cognitiveservicesaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// AccountsDelete ... +func (c CognitiveServicesAccountsClient) AccountsDelete(ctx context.Context, id AccountId) (result AccountsDeleteOperationResponse, err error) { + req, err := c.preparerForAccountsDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForAccountsDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// AccountsDeleteThenPoll performs AccountsDelete then polls until it's completed +func (c CognitiveServicesAccountsClient) AccountsDeleteThenPoll(ctx context.Context, id AccountId) error { + result, err := c.AccountsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing AccountsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after AccountsDelete: %+v", err) + } + + return nil +} + +// preparerForAccountsDelete prepares the AccountsDelete request. +func (c CognitiveServicesAccountsClient) preparerForAccountsDelete(ctx context.Context, id AccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForAccountsDelete sends the AccountsDelete request. The method will close the +// http.Response Body if it receives an error. +func (c CognitiveServicesAccountsClient) senderForAccountsDelete(ctx context.Context, req *http.Request) (future AccountsDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsget_autorest.go new file mode 100644 index 00000000000..9d1e6ed9478 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsget_autorest.go @@ -0,0 +1,68 @@ +package cognitiveservicesaccounts + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsGetOperationResponse struct { + HttpResponse *http.Response + Model *Account +} + +// AccountsGet ... +func (c CognitiveServicesAccountsClient) AccountsGet(ctx context.Context, id AccountId) (result AccountsGetOperationResponse, err error) { + req, err := c.preparerForAccountsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForAccountsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForAccountsGet prepares the AccountsGet request. +func (c CognitiveServicesAccountsClient) preparerForAccountsGet(ctx context.Context, id AccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForAccountsGet handles the response to the AccountsGet request. The method always +// closes the http.Response Body. +func (c CognitiveServicesAccountsClient) responderForAccountsGet(resp *http.Response) (result AccountsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountslist_autorest.go new file mode 100644 index 00000000000..ce1b94c20ac --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountslist_autorest.go @@ -0,0 +1,187 @@ +package cognitiveservicesaccounts + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsListOperationResponse struct { + HttpResponse *http.Response + Model *[]Account + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (AccountsListOperationResponse, error) +} + +type AccountsListCompleteResult struct { + Items []Account +} + +func (r AccountsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r AccountsListOperationResponse) LoadMore(ctx context.Context) (resp AccountsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// AccountsList ... +func (c CognitiveServicesAccountsClient) AccountsList(ctx context.Context, id commonids.SubscriptionId) (resp AccountsListOperationResponse, err error) { + req, err := c.preparerForAccountsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForAccountsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForAccountsList prepares the AccountsList request. +func (c CognitiveServicesAccountsClient) preparerForAccountsList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.CognitiveServices/accounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForAccountsListWithNextLink prepares the AccountsList request with the given nextLink token. +func (c CognitiveServicesAccountsClient) preparerForAccountsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForAccountsList handles the response to the AccountsList request. The method always +// closes the http.Response Body. +func (c CognitiveServicesAccountsClient) responderForAccountsList(resp *http.Response) (result AccountsListOperationResponse, err error) { + type page struct { + Values []Account `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result AccountsListOperationResponse, err error) { + req, err := c.preparerForAccountsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForAccountsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// AccountsListComplete retrieves all of the results into a single object +func (c CognitiveServicesAccountsClient) AccountsListComplete(ctx context.Context, id commonids.SubscriptionId) (AccountsListCompleteResult, error) { + return c.AccountsListCompleteMatchingPredicate(ctx, id, AccountOperationPredicate{}) +} + +// AccountsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c CognitiveServicesAccountsClient) AccountsListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate AccountOperationPredicate) (resp AccountsListCompleteResult, err error) { + items := make([]Account, 0) + + page, err := c.AccountsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := AccountsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountslistbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountslistbyresourcegroup_autorest.go similarity index 82% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountslistbyresourcegroup_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountslistbyresourcegroup_autorest.go index fe4b0f12d25..56d365da419 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountslistbyresourcegroup_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountslistbyresourcegroup_autorest.go @@ -8,25 +8,29 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" ) -type AccountsListByResourceGroupResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsListByResourceGroupOperationResponse struct { HttpResponse *http.Response Model *[]Account nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (AccountsListByResourceGroupResponse, error) + nextPageFunc func(ctx context.Context, nextLink string) (AccountsListByResourceGroupOperationResponse, error) } type AccountsListByResourceGroupCompleteResult struct { Items []Account } -func (r AccountsListByResourceGroupResponse) HasMore() bool { +func (r AccountsListByResourceGroupOperationResponse) HasMore() bool { return r.nextLink != nil } -func (r AccountsListByResourceGroupResponse) LoadMore(ctx context.Context) (resp AccountsListByResourceGroupResponse, err error) { +func (r AccountsListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp AccountsListByResourceGroupOperationResponse, err error) { if !r.HasMore() { err = fmt.Errorf("no more pages returned") return @@ -35,7 +39,7 @@ func (r AccountsListByResourceGroupResponse) LoadMore(ctx context.Context) (resp } // AccountsListByResourceGroup ... -func (c CognitiveServicesAccountsClient) AccountsListByResourceGroup(ctx context.Context, id ResourceGroupId) (resp AccountsListByResourceGroupResponse, err error) { +func (c CognitiveServicesAccountsClient) AccountsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp AccountsListByResourceGroupOperationResponse, err error) { req, err := c.preparerForAccountsListByResourceGroup(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsListByResourceGroup", nil, "Failure preparing request") @@ -56,52 +60,8 @@ func (c CognitiveServicesAccountsClient) AccountsListByResourceGroup(ctx context return } -// AccountsListByResourceGroupComplete retrieves all of the results into a single object -func (c CognitiveServicesAccountsClient) AccountsListByResourceGroupComplete(ctx context.Context, id ResourceGroupId) (AccountsListByResourceGroupCompleteResult, error) { - return c.AccountsListByResourceGroupCompleteMatchingPredicate(ctx, id, AccountPredicate{}) -} - -// AccountsListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c CognitiveServicesAccountsClient) AccountsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate AccountPredicate) (resp AccountsListByResourceGroupCompleteResult, err error) { - items := make([]Account, 0) - - page, err := c.AccountsListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := AccountsListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForAccountsListByResourceGroup prepares the AccountsListByResourceGroup request. -func (c CognitiveServicesAccountsClient) preparerForAccountsListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { +func (c CognitiveServicesAccountsClient) preparerForAccountsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -142,7 +102,7 @@ func (c CognitiveServicesAccountsClient) preparerForAccountsListByResourceGroupW // responderForAccountsListByResourceGroup handles the response to the AccountsListByResourceGroup request. The method always // closes the http.Response Body. -func (c CognitiveServicesAccountsClient) responderForAccountsListByResourceGroup(resp *http.Response) (result AccountsListByResourceGroupResponse, err error) { +func (c CognitiveServicesAccountsClient) responderForAccountsListByResourceGroup(resp *http.Response) (result AccountsListByResourceGroupOperationResponse, err error) { type page struct { Values []Account `json:"value"` NextLink *string `json:"nextLink"` @@ -157,7 +117,7 @@ func (c CognitiveServicesAccountsClient) responderForAccountsListByResourceGroup result.Model = &respObj.Values result.nextLink = respObj.NextLink if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result AccountsListByResourceGroupResponse, err error) { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result AccountsListByResourceGroupOperationResponse, err error) { req, err := c.preparerForAccountsListByResourceGroupWithNextLink(ctx, nextLink) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsListByResourceGroup", nil, "Failure preparing request") @@ -181,3 +141,47 @@ func (c CognitiveServicesAccountsClient) responderForAccountsListByResourceGroup } return } + +// AccountsListByResourceGroupComplete retrieves all of the results into a single object +func (c CognitiveServicesAccountsClient) AccountsListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (AccountsListByResourceGroupCompleteResult, error) { + return c.AccountsListByResourceGroupCompleteMatchingPredicate(ctx, id, AccountOperationPredicate{}) +} + +// AccountsListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c CognitiveServicesAccountsClient) AccountsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate AccountOperationPredicate) (resp AccountsListByResourceGroupCompleteResult, err error) { + items := make([]Account, 0) + + page, err := c.AccountsListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := AccountsListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountslistkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountslistkeys_autorest.go similarity index 84% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountslistkeys_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountslistkeys_autorest.go index fcf19a269c1..bc1c255e8e8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountslistkeys_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountslistkeys_autorest.go @@ -9,13 +9,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type AccountsListKeysResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsListKeysOperationResponse struct { HttpResponse *http.Response Model *ApiKeys } // AccountsListKeys ... -func (c CognitiveServicesAccountsClient) AccountsListKeys(ctx context.Context, id AccountId) (result AccountsListKeysResponse, err error) { +func (c CognitiveServicesAccountsClient) AccountsListKeys(ctx context.Context, id AccountId) (result AccountsListKeysOperationResponse, err error) { req, err := c.preparerForAccountsListKeys(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsListKeys", nil, "Failure preparing request") @@ -54,12 +57,13 @@ func (c CognitiveServicesAccountsClient) preparerForAccountsListKeys(ctx context // responderForAccountsListKeys handles the response to the AccountsListKeys request. The method always // closes the http.Response Body. -func (c CognitiveServicesAccountsClient) responderForAccountsListKeys(resp *http.Response) (result AccountsListKeysResponse, err error) { +func (c CognitiveServicesAccountsClient) responderForAccountsListKeys(resp *http.Response) (result AccountsListKeysOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountslistskus_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountslistskus_autorest.go similarity index 85% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountslistskus_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountslistskus_autorest.go index 729c1859b93..ed6266c6de2 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountslistskus_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountslistskus_autorest.go @@ -9,13 +9,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type AccountsListSkusResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsListSkusOperationResponse struct { HttpResponse *http.Response Model *AccountSkuListResult } // AccountsListSkus ... -func (c CognitiveServicesAccountsClient) AccountsListSkus(ctx context.Context, id AccountId) (result AccountsListSkusResponse, err error) { +func (c CognitiveServicesAccountsClient) AccountsListSkus(ctx context.Context, id AccountId) (result AccountsListSkusOperationResponse, err error) { req, err := c.preparerForAccountsListSkus(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsListSkus", nil, "Failure preparing request") @@ -54,12 +57,13 @@ func (c CognitiveServicesAccountsClient) preparerForAccountsListSkus(ctx context // responderForAccountsListSkus handles the response to the AccountsListSkus request. The method always // closes the http.Response Body. -func (c CognitiveServicesAccountsClient) responderForAccountsListSkus(resp *http.Response) (result AccountsListSkusResponse, err error) { +func (c CognitiveServicesAccountsClient) responderForAccountsListSkus(resp *http.Response) (result AccountsListSkusOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountslistusages_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountslistusages_autorest.go new file mode 100644 index 00000000000..8fc725c1219 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountslistusages_autorest.go @@ -0,0 +1,98 @@ +package cognitiveservicesaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsListUsagesOperationResponse struct { + HttpResponse *http.Response + Model *UsageListResult +} + +type AccountsListUsagesOperationOptions struct { + Filter *string +} + +func DefaultAccountsListUsagesOperationOptions() AccountsListUsagesOperationOptions { + return AccountsListUsagesOperationOptions{} +} + +func (o AccountsListUsagesOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o AccountsListUsagesOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// AccountsListUsages ... +func (c CognitiveServicesAccountsClient) AccountsListUsages(ctx context.Context, id AccountId, options AccountsListUsagesOperationOptions) (result AccountsListUsagesOperationResponse, err error) { + req, err := c.preparerForAccountsListUsages(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsListUsages", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsListUsages", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForAccountsListUsages(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsListUsages", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForAccountsListUsages prepares the AccountsListUsages request. +func (c CognitiveServicesAccountsClient) preparerForAccountsListUsages(ctx context.Context, id AccountId, options AccountsListUsagesOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/usages", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForAccountsListUsages handles the response to the AccountsListUsages request. The method always +// closes the http.Response Body. +func (c CognitiveServicesAccountsClient) responderForAccountsListUsages(resp *http.Response) (result AccountsListUsagesOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountsregeneratekey_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsregeneratekey_autorest.go similarity index 86% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountsregeneratekey_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsregeneratekey_autorest.go index b14679358d6..f09b9639a2d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountsregeneratekey_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsregeneratekey_autorest.go @@ -9,13 +9,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type AccountsRegenerateKeyResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsRegenerateKeyOperationResponse struct { HttpResponse *http.Response Model *ApiKeys } // AccountsRegenerateKey ... -func (c CognitiveServicesAccountsClient) AccountsRegenerateKey(ctx context.Context, id AccountId, input RegenerateKeyParameters) (result AccountsRegenerateKeyResponse, err error) { +func (c CognitiveServicesAccountsClient) AccountsRegenerateKey(ctx context.Context, id AccountId, input RegenerateKeyParameters) (result AccountsRegenerateKeyOperationResponse, err error) { req, err := c.preparerForAccountsRegenerateKey(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsRegenerateKey", nil, "Failure preparing request") @@ -55,12 +58,13 @@ func (c CognitiveServicesAccountsClient) preparerForAccountsRegenerateKey(ctx co // responderForAccountsRegenerateKey handles the response to the AccountsRegenerateKey request. The method always // closes the http.Response Body. -func (c CognitiveServicesAccountsClient) responderForAccountsRegenerateKey(resp *http.Response) (result AccountsRegenerateKeyResponse, err error) { +func (c CognitiveServicesAccountsClient) responderForAccountsRegenerateKey(resp *http.Response) (result AccountsRegenerateKeyOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsupdate_autorest.go new file mode 100644 index 00000000000..d4434e7be10 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_accountsupdate_autorest.go @@ -0,0 +1,79 @@ +package cognitiveservicesaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// AccountsUpdate ... +func (c CognitiveServicesAccountsClient) AccountsUpdate(ctx context.Context, id AccountId, input Account) (result AccountsUpdateOperationResponse, err error) { + req, err := c.preparerForAccountsUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForAccountsUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// AccountsUpdateThenPoll performs AccountsUpdate then polls until it's completed +func (c CognitiveServicesAccountsClient) AccountsUpdateThenPoll(ctx context.Context, id AccountId, input Account) error { + result, err := c.AccountsUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AccountsUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after AccountsUpdate: %+v", err) + } + + return nil +} + +// preparerForAccountsUpdate prepares the AccountsUpdate request. +func (c CognitiveServicesAccountsClient) preparerForAccountsUpdate(ctx context.Context, id AccountId, input Account) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForAccountsUpdate sends the AccountsUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c CognitiveServicesAccountsClient) senderForAccountsUpdate(ctx context.Context, req *http.Request) (future AccountsUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_checkdomainavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_checkdomainavailability_autorest.go similarity index 79% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_checkdomainavailability_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_checkdomainavailability_autorest.go index 1809bf4561e..62bb22c4057 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_checkdomainavailability_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_checkdomainavailability_autorest.go @@ -7,15 +7,19 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" ) -type CheckDomainAvailabilityResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckDomainAvailabilityOperationResponse struct { HttpResponse *http.Response Model *DomainAvailability } // CheckDomainAvailability ... -func (c CognitiveServicesAccountsClient) CheckDomainAvailability(ctx context.Context, id SubscriptionId, input CheckDomainAvailabilityParameter) (result CheckDomainAvailabilityResponse, err error) { +func (c CognitiveServicesAccountsClient) CheckDomainAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckDomainAvailabilityParameter) (result CheckDomainAvailabilityOperationResponse, err error) { req, err := c.preparerForCheckDomainAvailability(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "CheckDomainAvailability", nil, "Failure preparing request") @@ -38,7 +42,7 @@ func (c CognitiveServicesAccountsClient) CheckDomainAvailability(ctx context.Con } // preparerForCheckDomainAvailability prepares the CheckDomainAvailability request. -func (c CognitiveServicesAccountsClient) preparerForCheckDomainAvailability(ctx context.Context, id SubscriptionId, input CheckDomainAvailabilityParameter) (*http.Request, error) { +func (c CognitiveServicesAccountsClient) preparerForCheckDomainAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckDomainAvailabilityParameter) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -55,12 +59,13 @@ func (c CognitiveServicesAccountsClient) preparerForCheckDomainAvailability(ctx // responderForCheckDomainAvailability handles the response to the CheckDomainAvailability request. The method always // closes the http.Response Body. -func (c CognitiveServicesAccountsClient) responderForCheckDomainAvailability(resp *http.Response) (result CheckDomainAvailabilityResponse, err error) { +func (c CognitiveServicesAccountsClient) responderForCheckDomainAvailability(resp *http.Response) (result CheckDomainAvailabilityOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_checkskuavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_checkskuavailability_autorest.go similarity index 86% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_checkskuavailability_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_checkskuavailability_autorest.go index d37c4be959f..4d543ce3b48 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_checkskuavailability_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_checkskuavailability_autorest.go @@ -9,13 +9,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type CheckSkuAvailabilityResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckSkuAvailabilityOperationResponse struct { HttpResponse *http.Response Model *SkuAvailabilityListResult } // CheckSkuAvailability ... -func (c CognitiveServicesAccountsClient) CheckSkuAvailability(ctx context.Context, id LocationId, input CheckSkuAvailabilityParameter) (result CheckSkuAvailabilityResponse, err error) { +func (c CognitiveServicesAccountsClient) CheckSkuAvailability(ctx context.Context, id LocationId, input CheckSkuAvailabilityParameter) (result CheckSkuAvailabilityOperationResponse, err error) { req, err := c.preparerForCheckSkuAvailability(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "CheckSkuAvailability", nil, "Failure preparing request") @@ -55,12 +58,13 @@ func (c CognitiveServicesAccountsClient) preparerForCheckSkuAvailability(ctx con // responderForCheckSkuAvailability handles the response to the CheckSkuAvailability request. The method always // closes the http.Response Body. -func (c CognitiveServicesAccountsClient) responderForCheckSkuAvailability(resp *http.Response) (result CheckSkuAvailabilityResponse, err error) { +func (c CognitiveServicesAccountsClient) responderForCheckSkuAvailability(resp *http.Response) (result CheckSkuAvailabilityOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_deletedaccountsget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountsget_autorest.go similarity index 87% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_deletedaccountsget_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountsget_autorest.go index c82acd219f3..b09beea08e1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_deletedaccountsget_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountsget_autorest.go @@ -8,13 +8,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type DeletedAccountsGetResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeletedAccountsGetOperationResponse struct { HttpResponse *http.Response Model *Account } // DeletedAccountsGet ... -func (c CognitiveServicesAccountsClient) DeletedAccountsGet(ctx context.Context, id DeletedAccountId) (result DeletedAccountsGetResponse, err error) { +func (c CognitiveServicesAccountsClient) DeletedAccountsGet(ctx context.Context, id DeletedAccountId) (result DeletedAccountsGetOperationResponse, err error) { req, err := c.preparerForDeletedAccountsGet(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "DeletedAccountsGet", nil, "Failure preparing request") @@ -53,12 +56,13 @@ func (c CognitiveServicesAccountsClient) preparerForDeletedAccountsGet(ctx conte // responderForDeletedAccountsGet handles the response to the DeletedAccountsGet request. The method always // closes the http.Response Body. -func (c CognitiveServicesAccountsClient) responderForDeletedAccountsGet(resp *http.Response) (result DeletedAccountsGetResponse, err error) { +func (c CognitiveServicesAccountsClient) responderForDeletedAccountsGet(resp *http.Response) (result DeletedAccountsGetOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_deletedaccountslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountslist_autorest.go similarity index 82% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_deletedaccountslist_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountslist_autorest.go index 88ac46aa1c1..8b6d8f246fc 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_deletedaccountslist_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountslist_autorest.go @@ -8,25 +8,29 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" ) -type DeletedAccountsListResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeletedAccountsListOperationResponse struct { HttpResponse *http.Response Model *[]Account nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (DeletedAccountsListResponse, error) + nextPageFunc func(ctx context.Context, nextLink string) (DeletedAccountsListOperationResponse, error) } type DeletedAccountsListCompleteResult struct { Items []Account } -func (r DeletedAccountsListResponse) HasMore() bool { +func (r DeletedAccountsListOperationResponse) HasMore() bool { return r.nextLink != nil } -func (r DeletedAccountsListResponse) LoadMore(ctx context.Context) (resp DeletedAccountsListResponse, err error) { +func (r DeletedAccountsListOperationResponse) LoadMore(ctx context.Context) (resp DeletedAccountsListOperationResponse, err error) { if !r.HasMore() { err = fmt.Errorf("no more pages returned") return @@ -35,7 +39,7 @@ func (r DeletedAccountsListResponse) LoadMore(ctx context.Context) (resp Deleted } // DeletedAccountsList ... -func (c CognitiveServicesAccountsClient) DeletedAccountsList(ctx context.Context, id SubscriptionId) (resp DeletedAccountsListResponse, err error) { +func (c CognitiveServicesAccountsClient) DeletedAccountsList(ctx context.Context, id commonids.SubscriptionId) (resp DeletedAccountsListOperationResponse, err error) { req, err := c.preparerForDeletedAccountsList(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "DeletedAccountsList", nil, "Failure preparing request") @@ -56,52 +60,8 @@ func (c CognitiveServicesAccountsClient) DeletedAccountsList(ctx context.Context return } -// DeletedAccountsListComplete retrieves all of the results into a single object -func (c CognitiveServicesAccountsClient) DeletedAccountsListComplete(ctx context.Context, id SubscriptionId) (DeletedAccountsListCompleteResult, error) { - return c.DeletedAccountsListCompleteMatchingPredicate(ctx, id, AccountPredicate{}) -} - -// DeletedAccountsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c CognitiveServicesAccountsClient) DeletedAccountsListCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate AccountPredicate) (resp DeletedAccountsListCompleteResult, err error) { - items := make([]Account, 0) - - page, err := c.DeletedAccountsList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := DeletedAccountsListCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForDeletedAccountsList prepares the DeletedAccountsList request. -func (c CognitiveServicesAccountsClient) preparerForDeletedAccountsList(ctx context.Context, id SubscriptionId) (*http.Request, error) { +func (c CognitiveServicesAccountsClient) preparerForDeletedAccountsList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -142,7 +102,7 @@ func (c CognitiveServicesAccountsClient) preparerForDeletedAccountsListWithNextL // responderForDeletedAccountsList handles the response to the DeletedAccountsList request. The method always // closes the http.Response Body. -func (c CognitiveServicesAccountsClient) responderForDeletedAccountsList(resp *http.Response) (result DeletedAccountsListResponse, err error) { +func (c CognitiveServicesAccountsClient) responderForDeletedAccountsList(resp *http.Response) (result DeletedAccountsListOperationResponse, err error) { type page struct { Values []Account `json:"value"` NextLink *string `json:"nextLink"` @@ -157,7 +117,7 @@ func (c CognitiveServicesAccountsClient) responderForDeletedAccountsList(resp *h result.Model = &respObj.Values result.nextLink = respObj.NextLink if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result DeletedAccountsListResponse, err error) { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result DeletedAccountsListOperationResponse, err error) { req, err := c.preparerForDeletedAccountsListWithNextLink(ctx, nextLink) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "DeletedAccountsList", nil, "Failure preparing request") @@ -181,3 +141,47 @@ func (c CognitiveServicesAccountsClient) responderForDeletedAccountsList(resp *h } return } + +// DeletedAccountsListComplete retrieves all of the results into a single object +func (c CognitiveServicesAccountsClient) DeletedAccountsListComplete(ctx context.Context, id commonids.SubscriptionId) (DeletedAccountsListCompleteResult, error) { + return c.DeletedAccountsListCompleteMatchingPredicate(ctx, id, AccountOperationPredicate{}) +} + +// DeletedAccountsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c CognitiveServicesAccountsClient) DeletedAccountsListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate AccountOperationPredicate) (resp DeletedAccountsListCompleteResult, err error) { + items := make([]Account, 0) + + page, err := c.DeletedAccountsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := DeletedAccountsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_deletedaccountspurge_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountspurge_autorest.go similarity index 84% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_deletedaccountspurge_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountspurge_autorest.go index 108d6d453e2..cea4509f7c7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_deletedaccountspurge_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_deletedaccountspurge_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type DeletedAccountsPurgeResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeletedAccountsPurgeOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // DeletedAccountsPurge ... -func (c CognitiveServicesAccountsClient) DeletedAccountsPurge(ctx context.Context, id DeletedAccountId) (result DeletedAccountsPurgeResponse, err error) { +func (c CognitiveServicesAccountsClient) DeletedAccountsPurge(ctx context.Context, id DeletedAccountId) (result DeletedAccountsPurgeOperationResponse, err error) { req, err := c.preparerForDeletedAccountsPurge(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "DeletedAccountsPurge", nil, "Failure preparing request") @@ -53,6 +56,7 @@ func (c CognitiveServicesAccountsClient) preparerForDeletedAccountsPurge(ctx con } preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), autorest.AsDelete(), autorest.WithBaseURL(c.baseUri), autorest.WithPath(id.ID()), @@ -62,12 +66,13 @@ func (c CognitiveServicesAccountsClient) preparerForDeletedAccountsPurge(ctx con // senderForDeletedAccountsPurge sends the DeletedAccountsPurge request. The method will close the // http.Response Body if it receives an error. -func (c CognitiveServicesAccountsClient) senderForDeletedAccountsPurge(ctx context.Context, req *http.Request) (future DeletedAccountsPurgeResponse, err error) { +func (c CognitiveServicesAccountsClient) senderForDeletedAccountsPurge(ctx context.Context, req *http.Request) (future DeletedAccountsPurgeOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_resourceskuslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_resourceskuslist_autorest.go similarity index 83% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_resourceskuslist_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_resourceskuslist_autorest.go index 06ea0537d6b..e63e9e0526d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_resourceskuslist_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/method_resourceskuslist_autorest.go @@ -8,25 +8,29 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" ) -type ResourceSkusListResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSkusListOperationResponse struct { HttpResponse *http.Response Model *[]ResourceSku nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ResourceSkusListResponse, error) + nextPageFunc func(ctx context.Context, nextLink string) (ResourceSkusListOperationResponse, error) } type ResourceSkusListCompleteResult struct { Items []ResourceSku } -func (r ResourceSkusListResponse) HasMore() bool { +func (r ResourceSkusListOperationResponse) HasMore() bool { return r.nextLink != nil } -func (r ResourceSkusListResponse) LoadMore(ctx context.Context) (resp ResourceSkusListResponse, err error) { +func (r ResourceSkusListOperationResponse) LoadMore(ctx context.Context) (resp ResourceSkusListOperationResponse, err error) { if !r.HasMore() { err = fmt.Errorf("no more pages returned") return @@ -35,7 +39,7 @@ func (r ResourceSkusListResponse) LoadMore(ctx context.Context) (resp ResourceSk } // ResourceSkusList ... -func (c CognitiveServicesAccountsClient) ResourceSkusList(ctx context.Context, id SubscriptionId) (resp ResourceSkusListResponse, err error) { +func (c CognitiveServicesAccountsClient) ResourceSkusList(ctx context.Context, id commonids.SubscriptionId) (resp ResourceSkusListOperationResponse, err error) { req, err := c.preparerForResourceSkusList(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "ResourceSkusList", nil, "Failure preparing request") @@ -56,52 +60,8 @@ func (c CognitiveServicesAccountsClient) ResourceSkusList(ctx context.Context, i return } -// ResourceSkusListComplete retrieves all of the results into a single object -func (c CognitiveServicesAccountsClient) ResourceSkusListComplete(ctx context.Context, id SubscriptionId) (ResourceSkusListCompleteResult, error) { - return c.ResourceSkusListCompleteMatchingPredicate(ctx, id, ResourceSkuPredicate{}) -} - -// ResourceSkusListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c CognitiveServicesAccountsClient) ResourceSkusListCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate ResourceSkuPredicate) (resp ResourceSkusListCompleteResult, err error) { - items := make([]ResourceSku, 0) - - page, err := c.ResourceSkusList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ResourceSkusListCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForResourceSkusList prepares the ResourceSkusList request. -func (c CognitiveServicesAccountsClient) preparerForResourceSkusList(ctx context.Context, id SubscriptionId) (*http.Request, error) { +func (c CognitiveServicesAccountsClient) preparerForResourceSkusList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -142,7 +102,7 @@ func (c CognitiveServicesAccountsClient) preparerForResourceSkusListWithNextLink // responderForResourceSkusList handles the response to the ResourceSkusList request. The method always // closes the http.Response Body. -func (c CognitiveServicesAccountsClient) responderForResourceSkusList(resp *http.Response) (result ResourceSkusListResponse, err error) { +func (c CognitiveServicesAccountsClient) responderForResourceSkusList(resp *http.Response) (result ResourceSkusListOperationResponse, err error) { type page struct { Values []ResourceSku `json:"value"` NextLink *string `json:"nextLink"` @@ -157,7 +117,7 @@ func (c CognitiveServicesAccountsClient) responderForResourceSkusList(resp *http result.Model = &respObj.Values result.nextLink = respObj.NextLink if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ResourceSkusListResponse, err error) { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ResourceSkusListOperationResponse, err error) { req, err := c.preparerForResourceSkusListWithNextLink(ctx, nextLink) if err != nil { err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "ResourceSkusList", nil, "Failure preparing request") @@ -181,3 +141,47 @@ func (c CognitiveServicesAccountsClient) responderForResourceSkusList(resp *http } return } + +// ResourceSkusListComplete retrieves all of the results into a single object +func (c CognitiveServicesAccountsClient) ResourceSkusListComplete(ctx context.Context, id commonids.SubscriptionId) (ResourceSkusListCompleteResult, error) { + return c.ResourceSkusListCompleteMatchingPredicate(ctx, id, ResourceSkuOperationPredicate{}) +} + +// ResourceSkusListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c CognitiveServicesAccountsClient) ResourceSkusListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ResourceSkuOperationPredicate) (resp ResourceSkusListCompleteResult, err error) { + items := make([]ResourceSku, 0) + + page, err := c.ResourceSkusList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ResourceSkusListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_account.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_account.go new file mode 100644 index 00000000000..d36d155cc48 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_account.go @@ -0,0 +1,23 @@ +package cognitiveservicesaccounts + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Account struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AccountProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_accountproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_accountproperties.go new file mode 100644 index 00000000000..77de4f3bda8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_accountproperties.go @@ -0,0 +1,29 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountProperties struct { + AllowedFqdnList *[]string `json:"allowedFqdnList,omitempty"` + ApiProperties *ApiProperties `json:"apiProperties,omitempty"` + CallRateLimit *CallRateLimit `json:"callRateLimit,omitempty"` + Capabilities *[]SkuCapability `json:"capabilities,omitempty"` + CustomSubDomainName *string `json:"customSubDomainName,omitempty"` + DateCreated *string `json:"dateCreated,omitempty"` + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + Encryption *Encryption `json:"encryption,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` + Endpoints *map[string]string `json:"endpoints,omitempty"` + InternalId *string `json:"internalId,omitempty"` + IsMigrated *bool `json:"isMigrated,omitempty"` + MigrationToken *string `json:"migrationToken,omitempty"` + NetworkAcls *NetworkRuleSet `json:"networkAcls,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + QuotaLimit *QuotaLimit `json:"quotaLimit,omitempty"` + Restore *bool `json:"restore,omitempty"` + RestrictOutboundNetworkAccess *bool `json:"restrictOutboundNetworkAccess,omitempty"` + SkuChangeInfo *SkuChangeInfo `json:"skuChangeInfo,omitempty"` + UserOwnedStorage *[]UserOwnedStorage `json:"userOwnedStorage,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_accountsku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_accountsku.go new file mode 100644 index 00000000000..5f0de7f2e8e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_accountsku.go @@ -0,0 +1,9 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountSku struct { + ResourceType *string `json:"resourceType,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_accountskulistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_accountskulistresult.go new file mode 100644 index 00000000000..736a0040367 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_accountskulistresult.go @@ -0,0 +1,8 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountSkuListResult struct { + Value *[]AccountSku `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_apikeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_apikeys.go new file mode 100644 index 00000000000..3c540b9caf5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_apikeys.go @@ -0,0 +1,9 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiKeys struct { + Key1 *string `json:"key1,omitempty"` + Key2 *string `json:"key2,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_apiproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_apiproperties.go similarity index 84% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_apiproperties.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_apiproperties.go index e179de1796d..46adaffcada 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_apiproperties.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_apiproperties.go @@ -1,5 +1,8 @@ package cognitiveservicesaccounts +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ApiProperties struct { AadClientId *string `json:"aadClientId,omitempty"` AadTenantId *string `json:"aadTenantId,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_callratelimit.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_callratelimit.go new file mode 100644 index 00000000000..f416a9a4aa1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_callratelimit.go @@ -0,0 +1,10 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CallRateLimit struct { + Count *float64 `json:"count,omitempty"` + RenewalPeriod *float64 `json:"renewalPeriod,omitempty"` + Rules *[]ThrottlingRule `json:"rules,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_checkdomainavailabilityparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_checkdomainavailabilityparameter.go new file mode 100644 index 00000000000..f1682e5623c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_checkdomainavailabilityparameter.go @@ -0,0 +1,9 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckDomainAvailabilityParameter struct { + SubdomainName string `json:"subdomainName"` + Type string `json:"type"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_checkskuavailabilityparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_checkskuavailabilityparameter.go new file mode 100644 index 00000000000..fe1aa94cc62 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_checkskuavailabilityparameter.go @@ -0,0 +1,10 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckSkuAvailabilityParameter struct { + Kind string `json:"kind"` + Skus []string `json:"skus"` + Type string `json:"type"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_domainavailability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_domainavailability.go new file mode 100644 index 00000000000..e5f62fec1cb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_domainavailability.go @@ -0,0 +1,11 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DomainAvailability struct { + IsSubdomainAvailable *bool `json:"isSubdomainAvailable,omitempty"` + Reason *string `json:"reason,omitempty"` + SubdomainName *string `json:"subdomainName,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_encryption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_encryption.go new file mode 100644 index 00000000000..be8e6b3d76f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_encryption.go @@ -0,0 +1,9 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Encryption struct { + KeySource *KeySource `json:"keySource,omitempty"` + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_iprule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_iprule.go new file mode 100644 index 00000000000..1ef646c4c32 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_iprule.go @@ -0,0 +1,8 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IPRule struct { + Value string `json:"value"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_keyvaultproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_keyvaultproperties.go new file mode 100644 index 00000000000..2a522a3491d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_keyvaultproperties.go @@ -0,0 +1,11 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultProperties struct { + IdentityClientId *string `json:"identityClientId,omitempty"` + KeyName *string `json:"keyName,omitempty"` + KeyVaultUri *string `json:"keyVaultUri,omitempty"` + KeyVersion *string `json:"keyVersion,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_metricname.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_metricname.go new file mode 100644 index 00000000000..696622a04da --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_metricname.go @@ -0,0 +1,9 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MetricName struct { + LocalizedValue *string `json:"localizedValue,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_networkruleset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_networkruleset.go new file mode 100644 index 00000000000..7362b165a12 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_networkruleset.go @@ -0,0 +1,10 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkRuleSet struct { + DefaultAction *NetworkRuleAction `json:"defaultAction,omitempty"` + IPRules *[]IPRule `json:"ipRules,omitempty"` + VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_privateendpoint.go new file mode 100644 index 00000000000..88ea8600bda --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_privateendpoint.go @@ -0,0 +1,8 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_privateendpointconnection.go new file mode 100644 index 00000000000..4e0eaa5a7ac --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_privateendpointconnection.go @@ -0,0 +1,18 @@ +package cognitiveservicesaccounts + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..054f5e47091 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_privateendpointconnectionproperties.go @@ -0,0 +1,11 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + GroupIds *[]string `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_privatelinkserviceconnectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..19c6d65788e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_quotalimit.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_quotalimit.go new file mode 100644 index 00000000000..6fae5444a8d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_quotalimit.go @@ -0,0 +1,10 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QuotaLimit struct { + Count *float64 `json:"count,omitempty"` + RenewalPeriod *float64 `json:"renewalPeriod,omitempty"` + Rules *[]ThrottlingRule `json:"rules,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_regeneratekeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_regeneratekeyparameters.go new file mode 100644 index 00000000000..c20914faab8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_regeneratekeyparameters.go @@ -0,0 +1,8 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyParameters struct { + KeyName KeyName `json:"keyName"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_requestmatchpattern.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_requestmatchpattern.go new file mode 100644 index 00000000000..fb82270622e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_requestmatchpattern.go @@ -0,0 +1,9 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RequestMatchPattern struct { + Method *string `json:"method,omitempty"` + Path *string `json:"path,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_resourcesku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_resourcesku.go new file mode 100644 index 00000000000..ffc5eccc031 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_resourcesku.go @@ -0,0 +1,13 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSku struct { + Kind *string `json:"kind,omitempty"` + Locations *[]string `json:"locations,omitempty"` + Name *string `json:"name,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + Restrictions *[]ResourceSkuRestrictions `json:"restrictions,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_resourceskurestrictioninfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_resourceskurestrictioninfo.go new file mode 100644 index 00000000000..229b2b5e192 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_resourceskurestrictioninfo.go @@ -0,0 +1,9 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSkuRestrictionInfo struct { + Locations *[]string `json:"locations,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_resourceskurestrictions.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_resourceskurestrictions.go new file mode 100644 index 00000000000..2a91cfcc616 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_resourceskurestrictions.go @@ -0,0 +1,11 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSkuRestrictions struct { + ReasonCode *ResourceSkuRestrictionsReasonCode `json:"reasonCode,omitempty"` + RestrictionInfo *ResourceSkuRestrictionInfo `json:"restrictionInfo,omitempty"` + Type *ResourceSkuRestrictionsType `json:"type,omitempty"` + Values *[]string `json:"values,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_sku.go new file mode 100644 index 00000000000..50eecc8d5ff --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_sku.go @@ -0,0 +1,12 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_skuavailability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_skuavailability.go new file mode 100644 index 00000000000..713f3e5841d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_skuavailability.go @@ -0,0 +1,13 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuAvailability struct { + Kind *string `json:"kind,omitempty"` + Message *string `json:"message,omitempty"` + Reason *string `json:"reason,omitempty"` + SkuAvailable *bool `json:"skuAvailable,omitempty"` + SkuName *string `json:"skuName,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_skuavailabilitylistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_skuavailabilitylistresult.go new file mode 100644 index 00000000000..843010ce915 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_skuavailabilitylistresult.go @@ -0,0 +1,8 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuAvailabilityListResult struct { + Value *[]SkuAvailability `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_skucapability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_skucapability.go new file mode 100644 index 00000000000..2508d7ebfbe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_skucapability.go @@ -0,0 +1,9 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuCapability struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_skuchangeinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_skuchangeinfo.go new file mode 100644 index 00000000000..b3c6dec1620 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_skuchangeinfo.go @@ -0,0 +1,10 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuChangeInfo struct { + CountOfDowngrades *float64 `json:"countOfDowngrades,omitempty"` + CountOfUpgradesAfterDowngrades *float64 `json:"countOfUpgradesAfterDowngrades,omitempty"` + LastChangeDate *string `json:"lastChangeDate,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_throttlingrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_throttlingrule.go similarity index 77% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_throttlingrule.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_throttlingrule.go index abcbb866212..35f94c2df40 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_throttlingrule.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_throttlingrule.go @@ -1,5 +1,8 @@ package cognitiveservicesaccounts +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ThrottlingRule struct { Count *float64 `json:"count,omitempty"` DynamicThrottlingEnabled *bool `json:"dynamicThrottlingEnabled,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_usage.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_usage.go new file mode 100644 index 00000000000..37438a1a01c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_usage.go @@ -0,0 +1,14 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Usage struct { + CurrentValue *float64 `json:"currentValue,omitempty"` + Limit *float64 `json:"limit,omitempty"` + Name *MetricName `json:"name,omitempty"` + NextResetTime *string `json:"nextResetTime,omitempty"` + QuotaPeriod *string `json:"quotaPeriod,omitempty"` + Status *QuotaUsageStatus `json:"status,omitempty"` + Unit *UnitType `json:"unit,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_usagelistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_usagelistresult.go new file mode 100644 index 00000000000..8efef996c8e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_usagelistresult.go @@ -0,0 +1,8 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UsageListResult struct { + Value *[]Usage `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_userownedstorage.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_userownedstorage.go new file mode 100644 index 00000000000..1d3c95441a3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_userownedstorage.go @@ -0,0 +1,9 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserOwnedStorage struct { + IdentityClientId *string `json:"identityClientId,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_virtualnetworkrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_virtualnetworkrule.go new file mode 100644 index 00000000000..8f5f36973a6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/model_virtualnetworkrule.go @@ -0,0 +1,10 @@ +package cognitiveservicesaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkRule struct { + Id string `json:"id"` + IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` + State *string `json:"state,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/predicates.go new file mode 100644 index 00000000000..bad9ffa9bcc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/predicates.go @@ -0,0 +1,67 @@ +package cognitiveservicesaccounts + +type AccountOperationPredicate struct { + Etag *string + Id *string + Kind *string + Location *string + Name *string + Type *string +} + +func (p AccountOperationPredicate) Matches(input Account) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && (input.Kind == nil && *p.Kind != *input.Kind) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type ResourceSkuOperationPredicate struct { + Kind *string + Name *string + ResourceType *string + Tier *string +} + +func (p ResourceSkuOperationPredicate) Matches(input ResourceSku) bool { + + if p.Kind != nil && (input.Kind == nil && *p.Kind != *input.Kind) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.ResourceType != nil && (input.ResourceType == nil && *p.ResourceType != *input.ResourceType) { + return false + } + + if p.Tier != nil && (input.Tier == nil && *p.Tier != *input.Tier) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/version.go new file mode 100644 index 00000000000..93e64e262ca --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts/version.go @@ -0,0 +1,12 @@ +package cognitiveservicesaccounts + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-04-30" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/cognitiveservicesaccounts/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/README.md new file mode 100644 index 00000000000..f70c650a2fd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/README.md @@ -0,0 +1,199 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice` Documentation + +The `communicationservice` SDK allows for interaction with the Azure Resource Manager Service `communication` (API Version `2020-08-20`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice" +``` + + +### Client Initialization + +```go +client := communicationservice.NewCommunicationServiceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CommunicationServiceClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := communicationservice.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := communicationservice.NameAvailabilityParameters{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CommunicationServiceClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := communicationservice.NewCommunicationServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "communicationServiceValue") + +payload := communicationservice.CommunicationServiceResource{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CommunicationServiceClient.Delete` + +```go +ctx := context.TODO() +id := communicationservice.NewCommunicationServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "communicationServiceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CommunicationServiceClient.Get` + +```go +ctx := context.TODO() +id := communicationservice.NewCommunicationServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "communicationServiceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CommunicationServiceClient.LinkNotificationHub` + +```go +ctx := context.TODO() +id := communicationservice.NewCommunicationServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "communicationServiceValue") + +payload := communicationservice.LinkNotificationHubParameters{ + // ... +} + + +read, err := client.LinkNotificationHub(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CommunicationServiceClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := communicationservice.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CommunicationServiceClient.ListBySubscription` + +```go +ctx := context.TODO() +id := communicationservice.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CommunicationServiceClient.ListKeys` + +```go +ctx := context.TODO() +id := communicationservice.NewCommunicationServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "communicationServiceValue") + +read, err := client.ListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CommunicationServiceClient.RegenerateKey` + +```go +ctx := context.TODO() +id := communicationservice.NewCommunicationServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "communicationServiceValue") + +payload := communicationservice.RegenerateKeyParameters{ + // ... +} + + +read, err := client.RegenerateKey(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CommunicationServiceClient.Update` + +```go +ctx := context.TODO() +id := communicationservice.NewCommunicationServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "communicationServiceValue") + +payload := communicationservice.CommunicationServiceResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/client.go new file mode 100644 index 00000000000..161e296e59c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/client.go @@ -0,0 +1,18 @@ +package communicationservice + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CommunicationServiceClient struct { + Client autorest.Client + baseUri string +} + +func NewCommunicationServiceClientWithBaseURI(endpoint string) CommunicationServiceClient { + return CommunicationServiceClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/constants.go new file mode 100644 index 00000000000..20e56b432fd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/constants.go @@ -0,0 +1,83 @@ +package communicationservice + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyType string + +const ( + KeyTypePrimary KeyType = "Primary" + KeyTypeSecondary KeyType = "Secondary" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypePrimary), + string(KeyTypeSecondary), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "primary": KeyTypePrimary, + "secondary": KeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUnknown), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + "unknown": ProvisioningStateUnknown, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/id_communicationservice.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/id_communicationservice.go new file mode 100644 index 00000000000..ff94de5917c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/id_communicationservice.go @@ -0,0 +1,124 @@ +package communicationservice + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = CommunicationServiceId{} + +// CommunicationServiceId is a struct representing the Resource ID for a Communication Service +type CommunicationServiceId struct { + SubscriptionId string + ResourceGroupName string + CommunicationServiceName string +} + +// NewCommunicationServiceID returns a new CommunicationServiceId struct +func NewCommunicationServiceID(subscriptionId string, resourceGroupName string, communicationServiceName string) CommunicationServiceId { + return CommunicationServiceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CommunicationServiceName: communicationServiceName, + } +} + +// ParseCommunicationServiceID parses 'input' into a CommunicationServiceId +func ParseCommunicationServiceID(input string) (*CommunicationServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(CommunicationServiceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CommunicationServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.CommunicationServiceName, ok = parsed.Parsed["communicationServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'communicationServiceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseCommunicationServiceIDInsensitively parses 'input' case-insensitively into a CommunicationServiceId +// note: this method should only be used for API response data and not user input +func ParseCommunicationServiceIDInsensitively(input string) (*CommunicationServiceId, error) { + parser := resourceids.NewParserFromResourceIdType(CommunicationServiceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CommunicationServiceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.CommunicationServiceName, ok = parsed.Parsed["communicationServiceName"]; !ok { + return nil, fmt.Errorf("the segment 'communicationServiceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateCommunicationServiceID checks that 'input' can be parsed as a Communication Service ID +func ValidateCommunicationServiceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCommunicationServiceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Communication Service ID +func (id CommunicationServiceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Communication/communicationServices/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CommunicationServiceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Communication Service ID +func (id CommunicationServiceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCommunication", "Microsoft.Communication", "Microsoft.Communication"), + resourceids.StaticSegment("staticCommunicationServices", "communicationServices", "communicationServices"), + resourceids.UserSpecifiedSegment("communicationServiceName", "communicationServiceValue"), + } +} + +// String returns a human-readable description of this Communication Service ID +func (id CommunicationServiceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Communication Service Name: %q", id.CommunicationServiceName), + } + return fmt.Sprintf("Communication Service (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_checknameavailability_autorest.go new file mode 100644 index 00000000000..0e2d20568f9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_checknameavailability_autorest.go @@ -0,0 +1,71 @@ +package communicationservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *NameAvailability +} + +// CheckNameAvailability ... +func (c CommunicationServiceClient) CheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input NameAvailabilityParameters) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c CommunicationServiceClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input NameAvailabilityParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Communication/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c CommunicationServiceClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_createorupdate_autorest.go new file mode 100644 index 00000000000..6f819ce91c8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package communicationservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c CommunicationServiceClient) CreateOrUpdate(ctx context.Context, id CommunicationServiceId, input CommunicationServiceResource) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c CommunicationServiceClient) CreateOrUpdateThenPoll(ctx context.Context, id CommunicationServiceId, input CommunicationServiceResource) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c CommunicationServiceClient) preparerForCreateOrUpdate(ctx context.Context, id CommunicationServiceId, input CommunicationServiceResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c CommunicationServiceClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_delete_autorest.go new file mode 100644 index 00000000000..d2b237f2453 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_delete_autorest.go @@ -0,0 +1,78 @@ +package communicationservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c CommunicationServiceClient) Delete(ctx context.Context, id CommunicationServiceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c CommunicationServiceClient) DeleteThenPoll(ctx context.Context, id CommunicationServiceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c CommunicationServiceClient) preparerForDelete(ctx context.Context, id CommunicationServiceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c CommunicationServiceClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_get_autorest.go new file mode 100644 index 00000000000..8e33bb1637e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_get_autorest.go @@ -0,0 +1,68 @@ +package communicationservice + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *CommunicationServiceResource +} + +// Get ... +func (c CommunicationServiceClient) Get(ctx context.Context, id CommunicationServiceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c CommunicationServiceClient) preparerForGet(ctx context.Context, id CommunicationServiceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c CommunicationServiceClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_linknotificationhub_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_linknotificationhub_autorest.go new file mode 100644 index 00000000000..858ce51c21c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_linknotificationhub_autorest.go @@ -0,0 +1,70 @@ +package communicationservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkNotificationHubOperationResponse struct { + HttpResponse *http.Response + Model *LinkedNotificationHub +} + +// LinkNotificationHub ... +func (c CommunicationServiceClient) LinkNotificationHub(ctx context.Context, id CommunicationServiceId, input LinkNotificationHubParameters) (result LinkNotificationHubOperationResponse, err error) { + req, err := c.preparerForLinkNotificationHub(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "LinkNotificationHub", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "LinkNotificationHub", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForLinkNotificationHub(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "LinkNotificationHub", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForLinkNotificationHub prepares the LinkNotificationHub request. +func (c CommunicationServiceClient) preparerForLinkNotificationHub(ctx context.Context, id CommunicationServiceId, input LinkNotificationHubParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/linkNotificationHub", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForLinkNotificationHub handles the response to the LinkNotificationHub request. The method always +// closes the http.Response Body. +func (c CommunicationServiceClient) responderForLinkNotificationHub(resp *http.Response) (result LinkNotificationHubOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..873c1ec8972 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package communicationservice + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]CommunicationServiceResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []CommunicationServiceResource +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c CommunicationServiceClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c CommunicationServiceClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Communication/communicationServices", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c CommunicationServiceClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c CommunicationServiceClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []CommunicationServiceResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c CommunicationServiceClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, CommunicationServiceResourceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c CommunicationServiceClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate CommunicationServiceResourceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]CommunicationServiceResource, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..34dab3a026e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package communicationservice + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]CommunicationServiceResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []CommunicationServiceResource +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c CommunicationServiceClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c CommunicationServiceClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Communication/communicationServices", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c CommunicationServiceClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c CommunicationServiceClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []CommunicationServiceResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c CommunicationServiceClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, CommunicationServiceResourceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c CommunicationServiceClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate CommunicationServiceResourceOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]CommunicationServiceResource, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_listkeys_autorest.go new file mode 100644 index 00000000000..a98affc6dcf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_listkeys_autorest.go @@ -0,0 +1,69 @@ +package communicationservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeysOperationResponse struct { + HttpResponse *http.Response + Model *CommunicationServiceKeys +} + +// ListKeys ... +func (c CommunicationServiceClient) ListKeys(ctx context.Context, id CommunicationServiceId) (result ListKeysOperationResponse, err error) { + req, err := c.preparerForListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "ListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "ListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "ListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListKeys prepares the ListKeys request. +func (c CommunicationServiceClient) preparerForListKeys(ctx context.Context, id CommunicationServiceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListKeys handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (c CommunicationServiceClient) responderForListKeys(resp *http.Response) (result ListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_regeneratekey_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_regeneratekey_autorest.go new file mode 100644 index 00000000000..549c2c244f7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_regeneratekey_autorest.go @@ -0,0 +1,70 @@ +package communicationservice + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyOperationResponse struct { + HttpResponse *http.Response + Model *CommunicationServiceKeys +} + +// RegenerateKey ... +func (c CommunicationServiceClient) RegenerateKey(ctx context.Context, id CommunicationServiceId, input RegenerateKeyParameters) (result RegenerateKeyOperationResponse, err error) { + req, err := c.preparerForRegenerateKey(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "RegenerateKey", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRegenerateKey(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "RegenerateKey", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRegenerateKey prepares the RegenerateKey request. +func (c CommunicationServiceClient) preparerForRegenerateKey(ctx context.Context, id CommunicationServiceId, input RegenerateKeyParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKey", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRegenerateKey handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (c CommunicationServiceClient) responderForRegenerateKey(resp *http.Response) (result RegenerateKeyOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_update_autorest.go new file mode 100644 index 00000000000..a0070fba097 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/method_update_autorest.go @@ -0,0 +1,69 @@ +package communicationservice + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *CommunicationServiceResource +} + +// Update ... +func (c CommunicationServiceClient) Update(ctx context.Context, id CommunicationServiceId, input CommunicationServiceResource) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "communicationservice.CommunicationServiceClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c CommunicationServiceClient) preparerForUpdate(ctx context.Context, id CommunicationServiceId, input CommunicationServiceResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c CommunicationServiceClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_communicationservicekeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_communicationservicekeys.go new file mode 100644 index 00000000000..9693da06eb5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_communicationservicekeys.go @@ -0,0 +1,11 @@ +package communicationservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CommunicationServiceKeys struct { + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_communicationserviceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_communicationserviceproperties.go new file mode 100644 index 00000000000..9c06e8032c0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_communicationserviceproperties.go @@ -0,0 +1,13 @@ +package communicationservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CommunicationServiceProperties struct { + DataLocation string `json:"dataLocation"` + HostName *string `json:"hostName,omitempty"` + ImmutableResourceId *string `json:"immutableResourceId,omitempty"` + NotificationHubId *string `json:"notificationHubId,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_communicationserviceresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_communicationserviceresource.go new file mode 100644 index 00000000000..1dab5e43c7a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_communicationserviceresource.go @@ -0,0 +1,18 @@ +package communicationservice + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CommunicationServiceResource struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *CommunicationServiceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_linkednotificationhub.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_linkednotificationhub.go new file mode 100644 index 00000000000..7ce80a9e03d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_linkednotificationhub.go @@ -0,0 +1,8 @@ +package communicationservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkedNotificationHub struct { + ResourceId *string `json:"resourceId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_linknotificationhubparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_linknotificationhubparameters.go new file mode 100644 index 00000000000..173e86b31d2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_linknotificationhubparameters.go @@ -0,0 +1,9 @@ +package communicationservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkNotificationHubParameters struct { + ConnectionString string `json:"connectionString"` + ResourceId string `json:"resourceId"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_nameavailability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_nameavailability.go new file mode 100644 index 00000000000..f61381127bd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_nameavailability.go @@ -0,0 +1,10 @@ +package communicationservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NameAvailability struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *string `json:"reason,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_nameavailabilityparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_nameavailabilityparameters.go new file mode 100644 index 00000000000..4450404714e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_nameavailabilityparameters.go @@ -0,0 +1,9 @@ +package communicationservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NameAvailabilityParameters struct { + Name string `json:"name"` + Type string `json:"type"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_regeneratekeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_regeneratekeyparameters.go new file mode 100644 index 00000000000..9ab19090d5c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/model_regeneratekeyparameters.go @@ -0,0 +1,8 @@ +package communicationservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyParameters struct { + KeyType *KeyType `json:"keyType,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/predicates.go new file mode 100644 index 00000000000..3d7108bee44 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/predicates.go @@ -0,0 +1,29 @@ +package communicationservice + +type CommunicationServiceResourceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CommunicationServiceResourceOperationPredicate) Matches(input CommunicationServiceResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/version.go new file mode 100644 index 00000000000..c0f39b408c2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice/version.go @@ -0,0 +1,12 @@ +package communicationservice + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-08-20" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/communicationservice/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/README.md new file mode 100644 index 00000000000..278ad75a71f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/README.md @@ -0,0 +1,144 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets` Documentation + +The `availabilitysets` SDK allows for interaction with the Azure Resource Manager Service `compute` (API Version `2021-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets" +``` + + +### Client Initialization + +```go +client := availabilitysets.NewAvailabilitySetsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AvailabilitySetsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := availabilitysets.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetValue") + +payload := availabilitysets.AvailabilitySet{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AvailabilitySetsClient.Delete` + +```go +ctx := context.TODO() +id := availabilitysets.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AvailabilitySetsClient.Get` + +```go +ctx := context.TODO() +id := availabilitysets.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AvailabilitySetsClient.List` + +```go +ctx := context.TODO() +id := availabilitysets.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AvailabilitySetsClient.ListAvailableSizes` + +```go +ctx := context.TODO() +id := availabilitysets.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetValue") + +read, err := client.ListAvailableSizes(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AvailabilitySetsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := availabilitysets.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id, availabilitysets.DefaultListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id, availabilitysets.DefaultListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AvailabilitySetsClient.Update` + +```go +ctx := context.TODO() +id := availabilitysets.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetValue") + +payload := availabilitysets.AvailabilitySetUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/client.go new file mode 100644 index 00000000000..fbd6545125a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/client.go @@ -0,0 +1,18 @@ +package availabilitysets + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilitySetsClient struct { + Client autorest.Client + baseUri string +} + +func NewAvailabilitySetsClientWithBaseURI(endpoint string) AvailabilitySetsClient { + return AvailabilitySetsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/constants.go new file mode 100644 index 00000000000..22121b1b4b8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/constants.go @@ -0,0 +1,37 @@ +package availabilitysets + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/id_availabilityset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/id_availabilityset.go new file mode 100644 index 00000000000..b539e5ddae9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/id_availabilityset.go @@ -0,0 +1,124 @@ +package availabilitysets + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AvailabilitySetId{} + +// AvailabilitySetId is a struct representing the Resource ID for a Availability Set +type AvailabilitySetId struct { + SubscriptionId string + ResourceGroupName string + AvailabilitySetName string +} + +// NewAvailabilitySetID returns a new AvailabilitySetId struct +func NewAvailabilitySetID(subscriptionId string, resourceGroupName string, availabilitySetName string) AvailabilitySetId { + return AvailabilitySetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AvailabilitySetName: availabilitySetName, + } +} + +// ParseAvailabilitySetID parses 'input' into a AvailabilitySetId +func ParseAvailabilitySetID(input string) (*AvailabilitySetId, error) { + parser := resourceids.NewParserFromResourceIdType(AvailabilitySetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AvailabilitySetId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AvailabilitySetName, ok = parsed.Parsed["availabilitySetName"]; !ok { + return nil, fmt.Errorf("the segment 'availabilitySetName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAvailabilitySetIDInsensitively parses 'input' case-insensitively into a AvailabilitySetId +// note: this method should only be used for API response data and not user input +func ParseAvailabilitySetIDInsensitively(input string) (*AvailabilitySetId, error) { + parser := resourceids.NewParserFromResourceIdType(AvailabilitySetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AvailabilitySetId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AvailabilitySetName, ok = parsed.Parsed["availabilitySetName"]; !ok { + return nil, fmt.Errorf("the segment 'availabilitySetName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAvailabilitySetID checks that 'input' can be parsed as a Availability Set ID +func ValidateAvailabilitySetID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAvailabilitySetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Availability Set ID +func (id AvailabilitySetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/availabilitySets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AvailabilitySetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Availability Set ID +func (id AvailabilitySetId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticAvailabilitySets", "availabilitySets", "availabilitySets"), + resourceids.UserSpecifiedSegment("availabilitySetName", "availabilitySetValue"), + } +} + +// String returns a human-readable description of this Availability Set ID +func (id AvailabilitySetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Availability Set Name: %q", id.AvailabilitySetName), + } + return fmt.Sprintf("Availability Set (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_createorupdate_autorest.go new file mode 100644 index 00000000000..8f4b17af5a8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package availabilitysets + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *AvailabilitySet +} + +// CreateOrUpdate ... +func (c AvailabilitySetsClient) CreateOrUpdate(ctx context.Context, id AvailabilitySetId, input AvailabilitySet) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c AvailabilitySetsClient) preparerForCreateOrUpdate(ctx context.Context, id AvailabilitySetId, input AvailabilitySet) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c AvailabilitySetsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_delete_autorest.go new file mode 100644 index 00000000000..ef139804bb6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_delete_autorest.go @@ -0,0 +1,66 @@ +package availabilitysets + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c AvailabilitySetsClient) Delete(ctx context.Context, id AvailabilitySetId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c AvailabilitySetsClient) preparerForDelete(ctx context.Context, id AvailabilitySetId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c AvailabilitySetsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_get_autorest.go new file mode 100644 index 00000000000..b4b11147cf8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_get_autorest.go @@ -0,0 +1,68 @@ +package availabilitysets + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *AvailabilitySet +} + +// Get ... +func (c AvailabilitySetsClient) Get(ctx context.Context, id AvailabilitySetId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c AvailabilitySetsClient) preparerForGet(ctx context.Context, id AvailabilitySetId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c AvailabilitySetsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_list_autorest.go new file mode 100644 index 00000000000..514d9d77d44 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_list_autorest.go @@ -0,0 +1,187 @@ +package availabilitysets + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]AvailabilitySet + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []AvailabilitySet +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c AvailabilitySetsClient) List(ctx context.Context, id commonids.ResourceGroupId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c AvailabilitySetsClient) preparerForList(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Compute/availabilitySets", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c AvailabilitySetsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c AvailabilitySetsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []AvailabilitySet `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c AvailabilitySetsClient) ListComplete(ctx context.Context, id commonids.ResourceGroupId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, AvailabilitySetOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AvailabilitySetsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate AvailabilitySetOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]AvailabilitySet, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_listavailablesizes_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_listavailablesizes_autorest.go new file mode 100644 index 00000000000..ee1cc65a8ff --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_listavailablesizes_autorest.go @@ -0,0 +1,69 @@ +package availabilitysets + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAvailableSizesOperationResponse struct { + HttpResponse *http.Response + Model *VirtualMachineSizeListResult +} + +// ListAvailableSizes ... +func (c AvailabilitySetsClient) ListAvailableSizes(ctx context.Context, id AvailabilitySetId) (result ListAvailableSizesOperationResponse, err error) { + req, err := c.preparerForListAvailableSizes(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "ListAvailableSizes", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "ListAvailableSizes", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListAvailableSizes(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "ListAvailableSizes", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListAvailableSizes prepares the ListAvailableSizes request. +func (c AvailabilitySetsClient) preparerForListAvailableSizes(ctx context.Context, id AvailabilitySetId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/vmSizes", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListAvailableSizes handles the response to the ListAvailableSizes request. The method always +// closes the http.Response Body. +func (c AvailabilitySetsClient) responderForListAvailableSizes(resp *http.Response) (result ListAvailableSizesOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..893de5ef122 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_listbysubscription_autorest.go @@ -0,0 +1,216 @@ +package availabilitysets + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]AvailabilitySet + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []AvailabilitySet +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListBySubscriptionOperationOptions struct { + Expand *string +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// ListBySubscription ... +func (c AvailabilitySetsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c AvailabilitySetsClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Compute/availabilitySets", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c AvailabilitySetsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c AvailabilitySetsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []AvailabilitySet `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c AvailabilitySetsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, AvailabilitySetOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AvailabilitySetsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions, predicate AvailabilitySetOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]AvailabilitySet, 0) + + page, err := c.ListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_update_autorest.go new file mode 100644 index 00000000000..6adfc2a2e6e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/method_update_autorest.go @@ -0,0 +1,69 @@ +package availabilitysets + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *AvailabilitySet +} + +// Update ... +func (c AvailabilitySetsClient) Update(ctx context.Context, id AvailabilitySetId, input AvailabilitySetUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "availabilitysets.AvailabilitySetsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c AvailabilitySetsClient) preparerForUpdate(ctx context.Context, id AvailabilitySetId, input AvailabilitySetUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c AvailabilitySetsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_availabilityset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_availabilityset.go new file mode 100644 index 00000000000..49248ed2f4a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_availabilityset.go @@ -0,0 +1,14 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilitySet struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *AvailabilitySetProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_availabilitysetproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_availabilitysetproperties.go new file mode 100644 index 00000000000..3e1e7585608 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_availabilitysetproperties.go @@ -0,0 +1,12 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilitySetProperties struct { + PlatformFaultDomainCount *int64 `json:"platformFaultDomainCount,omitempty"` + PlatformUpdateDomainCount *int64 `json:"platformUpdateDomainCount,omitempty"` + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + VirtualMachines *[]SubResource `json:"virtualMachines,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_availabilitysetupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_availabilitysetupdate.go new file mode 100644 index 00000000000..04ce035cd46 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_availabilitysetupdate.go @@ -0,0 +1,10 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilitySetUpdate struct { + Properties *AvailabilitySetProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_instanceviewstatus.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_instanceviewstatus.go new file mode 100644 index 00000000000..038a3c1dd32 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package availabilitysets + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_sku.go new file mode 100644 index 00000000000..9e275b34b2a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_sku.go @@ -0,0 +1,10 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_subresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_subresource.go new file mode 100644 index 00000000000..9890abb18c9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_subresource.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_virtualmachinesize.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_virtualmachinesize.go new file mode 100644 index 00000000000..d9b2adc3758 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_virtualmachinesize.go @@ -0,0 +1,13 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineSize struct { + MaxDataDiskCount *int64 `json:"maxDataDiskCount,omitempty"` + MemoryInMB *int64 `json:"memoryInMB,omitempty"` + Name *string `json:"name,omitempty"` + NumberOfCores *int64 `json:"numberOfCores,omitempty"` + OsDiskSizeInMB *int64 `json:"osDiskSizeInMB,omitempty"` + ResourceDiskSizeInMB *int64 `json:"resourceDiskSizeInMB,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_virtualmachinesizelistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_virtualmachinesizelistresult.go new file mode 100644 index 00000000000..190cfb1b670 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/model_virtualmachinesizelistresult.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineSizeListResult struct { + Value *[]VirtualMachineSize `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/predicates.go new file mode 100644 index 00000000000..224859f306a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/predicates.go @@ -0,0 +1,29 @@ +package availabilitysets + +type AvailabilitySetOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p AvailabilitySetOperationPredicate) Matches(input AvailabilitySet) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/version.go new file mode 100644 index 00000000000..f51ca52b554 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets/version.go @@ -0,0 +1,12 @@ +package availabilitysets + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/availabilitysets/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/README.md new file mode 100644 index 00000000000..37ae6ce25fe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups` Documentation + +The `dedicatedhostgroups` SDK allows for interaction with the Azure Resource Manager Service `compute` (API Version `2021-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups" +``` + + +### Client Initialization + +```go +client := dedicatedhostgroups.NewDedicatedHostGroupsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DedicatedHostGroupsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := dedicatedhostgroups.NewHostGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupValue") + +payload := dedicatedhostgroups.DedicatedHostGroup{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DedicatedHostGroupsClient.Delete` + +```go +ctx := context.TODO() +id := dedicatedhostgroups.NewHostGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DedicatedHostGroupsClient.Get` + +```go +ctx := context.TODO() +id := dedicatedhostgroups.NewHostGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupValue") + +read, err := client.Get(ctx, id, dedicatedhostgroups.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DedicatedHostGroupsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := dedicatedhostgroups.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DedicatedHostGroupsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := dedicatedhostgroups.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DedicatedHostGroupsClient.Update` + +```go +ctx := context.TODO() +id := dedicatedhostgroups.NewHostGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupValue") + +payload := dedicatedhostgroups.DedicatedHostGroupUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/client.go new file mode 100644 index 00000000000..134a20c571b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/client.go @@ -0,0 +1,18 @@ +package dedicatedhostgroups + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostGroupsClient struct { + Client autorest.Client + baseUri string +} + +func NewDedicatedHostGroupsClientWithBaseURI(endpoint string) DedicatedHostGroupsClient { + return DedicatedHostGroupsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/constants.go new file mode 100644 index 00000000000..6800a48d60e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/constants.go @@ -0,0 +1,65 @@ +package dedicatedhostgroups + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewTypes string + +const ( + InstanceViewTypesInstanceView InstanceViewTypes = "instanceView" + InstanceViewTypesUserData InstanceViewTypes = "userData" +) + +func PossibleValuesForInstanceViewTypes() []string { + return []string{ + string(InstanceViewTypesInstanceView), + string(InstanceViewTypesUserData), + } +} + +func parseInstanceViewTypes(input string) (*InstanceViewTypes, error) { + vals := map[string]InstanceViewTypes{ + "instanceview": InstanceViewTypesInstanceView, + "userdata": InstanceViewTypesUserData, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InstanceViewTypes(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/id_hostgroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/id_hostgroup.go new file mode 100644 index 00000000000..e6f1f64a374 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/id_hostgroup.go @@ -0,0 +1,124 @@ +package dedicatedhostgroups + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = HostGroupId{} + +// HostGroupId is a struct representing the Resource ID for a Host Group +type HostGroupId struct { + SubscriptionId string + ResourceGroupName string + HostGroupName string +} + +// NewHostGroupID returns a new HostGroupId struct +func NewHostGroupID(subscriptionId string, resourceGroupName string, hostGroupName string) HostGroupId { + return HostGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + HostGroupName: hostGroupName, + } +} + +// ParseHostGroupID parses 'input' into a HostGroupId +func ParseHostGroupID(input string) (*HostGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(HostGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'hostGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseHostGroupIDInsensitively parses 'input' case-insensitively into a HostGroupId +// note: this method should only be used for API response data and not user input +func ParseHostGroupIDInsensitively(input string) (*HostGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(HostGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'hostGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateHostGroupID checks that 'input' can be parsed as a Host Group ID +func ValidateHostGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseHostGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Host Group ID +func (id HostGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/hostGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.HostGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Host Group ID +func (id HostGroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticHostGroups", "hostGroups", "hostGroups"), + resourceids.UserSpecifiedSegment("hostGroupName", "hostGroupValue"), + } +} + +// String returns a human-readable description of this Host Group ID +func (id HostGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Host Group Name: %q", id.HostGroupName), + } + return fmt.Sprintf("Host Group (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_createorupdate_autorest.go new file mode 100644 index 00000000000..43753ae8f7a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package dedicatedhostgroups + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *DedicatedHostGroup +} + +// CreateOrUpdate ... +func (c DedicatedHostGroupsClient) CreateOrUpdate(ctx context.Context, id HostGroupId, input DedicatedHostGroup) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c DedicatedHostGroupsClient) preparerForCreateOrUpdate(ctx context.Context, id HostGroupId, input DedicatedHostGroup) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c DedicatedHostGroupsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_delete_autorest.go new file mode 100644 index 00000000000..d8eead37c12 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_delete_autorest.go @@ -0,0 +1,66 @@ +package dedicatedhostgroups + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c DedicatedHostGroupsClient) Delete(ctx context.Context, id HostGroupId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c DedicatedHostGroupsClient) preparerForDelete(ctx context.Context, id HostGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c DedicatedHostGroupsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_get_autorest.go new file mode 100644 index 00000000000..d100587d001 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_get_autorest.go @@ -0,0 +1,97 @@ +package dedicatedhostgroups + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *DedicatedHostGroup +} + +type GetOperationOptions struct { + Expand *InstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// Get ... +func (c DedicatedHostGroupsClient) Get(ctx context.Context, id HostGroupId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DedicatedHostGroupsClient) preparerForGet(ctx context.Context, id HostGroupId, options GetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DedicatedHostGroupsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..95b5f55a2a8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package dedicatedhostgroups + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]DedicatedHostGroup + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []DedicatedHostGroup +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c DedicatedHostGroupsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c DedicatedHostGroupsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Compute/hostGroups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c DedicatedHostGroupsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c DedicatedHostGroupsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []DedicatedHostGroup `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c DedicatedHostGroupsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, DedicatedHostGroupOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DedicatedHostGroupsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate DedicatedHostGroupOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]DedicatedHostGroup, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..d1bf92328bf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package dedicatedhostgroups + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]DedicatedHostGroup + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []DedicatedHostGroup +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c DedicatedHostGroupsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c DedicatedHostGroupsClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Compute/hostGroups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c DedicatedHostGroupsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c DedicatedHostGroupsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []DedicatedHostGroup `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c DedicatedHostGroupsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, DedicatedHostGroupOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DedicatedHostGroupsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DedicatedHostGroupOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]DedicatedHostGroup, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_update_autorest.go new file mode 100644 index 00000000000..368f672222b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/method_update_autorest.go @@ -0,0 +1,69 @@ +package dedicatedhostgroups + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *DedicatedHostGroup +} + +// Update ... +func (c DedicatedHostGroupsClient) Update(ctx context.Context, id HostGroupId, input DedicatedHostGroupUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhostgroups.DedicatedHostGroupsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c DedicatedHostGroupsClient) preparerForUpdate(ctx context.Context, id HostGroupId, input DedicatedHostGroupUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c DedicatedHostGroupsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostallocatablevm.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostallocatablevm.go new file mode 100644 index 00000000000..eb95a66408c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostallocatablevm.go @@ -0,0 +1,9 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostAllocatableVM struct { + Count *float64 `json:"count,omitempty"` + VmSize *string `json:"vmSize,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostavailablecapacity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostavailablecapacity.go new file mode 100644 index 00000000000..645a995fd14 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostavailablecapacity.go @@ -0,0 +1,8 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostAvailableCapacity struct { + AllocatableVMs *[]DedicatedHostAllocatableVM `json:"allocatableVMs,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostgroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostgroup.go new file mode 100644 index 00000000000..3c175527c0e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostgroup.go @@ -0,0 +1,14 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostGroup struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *DedicatedHostGroupProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostgroupinstanceview.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostgroupinstanceview.go new file mode 100644 index 00000000000..4f3f4179ea8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostgroupinstanceview.go @@ -0,0 +1,8 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostGroupInstanceView struct { + Hosts *[]DedicatedHostInstanceViewWithName `json:"hosts,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostgroupproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostgroupproperties.go new file mode 100644 index 00000000000..57f37cb87a9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostgroupproperties.go @@ -0,0 +1,11 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostGroupProperties struct { + Hosts *[]SubResourceReadOnly `json:"hosts,omitempty"` + InstanceView *DedicatedHostGroupInstanceView `json:"instanceView,omitempty"` + PlatformFaultDomainCount int64 `json:"platformFaultDomainCount"` + SupportAutomaticPlacement *bool `json:"supportAutomaticPlacement,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostgroupupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostgroupupdate.go new file mode 100644 index 00000000000..4630d43c845 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostgroupupdate.go @@ -0,0 +1,10 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostGroupUpdate struct { + Properties *DedicatedHostGroupProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostinstanceviewwithname.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostinstanceviewwithname.go new file mode 100644 index 00000000000..e8c32278760 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_dedicatedhostinstanceviewwithname.go @@ -0,0 +1,11 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostInstanceViewWithName struct { + AssetId *string `json:"assetId,omitempty"` + AvailableCapacity *DedicatedHostAvailableCapacity `json:"availableCapacity,omitempty"` + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_instanceviewstatus.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_instanceviewstatus.go new file mode 100644 index 00000000000..74b66b61bc6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package dedicatedhostgroups + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_subresourcereadonly.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_subresourcereadonly.go new file mode 100644 index 00000000000..9c5ae8726a8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/model_subresourcereadonly.go @@ -0,0 +1,8 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResourceReadOnly struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/predicates.go new file mode 100644 index 00000000000..34bfe81b458 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/predicates.go @@ -0,0 +1,29 @@ +package dedicatedhostgroups + +type DedicatedHostGroupOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p DedicatedHostGroupOperationPredicate) Matches(input DedicatedHostGroup) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/version.go new file mode 100644 index 00000000000..788e7707a6b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups/version.go @@ -0,0 +1,12 @@ +package dedicatedhostgroups + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/dedicatedhostgroups/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/README.md new file mode 100644 index 00000000000..da7c59d4064 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts` Documentation + +The `dedicatedhosts` SDK allows for interaction with the Azure Resource Manager Service `compute` (API Version `2021-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts" +``` + + +### Client Initialization + +```go +client := dedicatedhosts.NewDedicatedHostsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DedicatedHostsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := dedicatedhosts.NewHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupValue", "hostValue") + +payload := dedicatedhosts.DedicatedHost{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DedicatedHostsClient.Delete` + +```go +ctx := context.TODO() +id := dedicatedhosts.NewHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupValue", "hostValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DedicatedHostsClient.Get` + +```go +ctx := context.TODO() +id := dedicatedhosts.NewHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupValue", "hostValue") + +read, err := client.Get(ctx, id, dedicatedhosts.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DedicatedHostsClient.Update` + +```go +ctx := context.TODO() +id := dedicatedhosts.NewHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupValue", "hostValue") + +payload := dedicatedhosts.DedicatedHostUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/client.go new file mode 100644 index 00000000000..23417d2b3cc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/client.go @@ -0,0 +1,18 @@ +package dedicatedhosts + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostsClient struct { + Client autorest.Client + baseUri string +} + +func NewDedicatedHostsClientWithBaseURI(endpoint string) DedicatedHostsClient { + return DedicatedHostsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/constants.go new file mode 100644 index 00000000000..686182ccc3e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/constants.go @@ -0,0 +1,96 @@ +package dedicatedhosts + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostLicenseTypes string + +const ( + DedicatedHostLicenseTypesNone DedicatedHostLicenseTypes = "None" + DedicatedHostLicenseTypesWindowsServerHybrid DedicatedHostLicenseTypes = "Windows_Server_Hybrid" + DedicatedHostLicenseTypesWindowsServerPerpetual DedicatedHostLicenseTypes = "Windows_Server_Perpetual" +) + +func PossibleValuesForDedicatedHostLicenseTypes() []string { + return []string{ + string(DedicatedHostLicenseTypesNone), + string(DedicatedHostLicenseTypesWindowsServerHybrid), + string(DedicatedHostLicenseTypesWindowsServerPerpetual), + } +} + +func parseDedicatedHostLicenseTypes(input string) (*DedicatedHostLicenseTypes, error) { + vals := map[string]DedicatedHostLicenseTypes{ + "none": DedicatedHostLicenseTypesNone, + "windows_server_hybrid": DedicatedHostLicenseTypesWindowsServerHybrid, + "windows_server_perpetual": DedicatedHostLicenseTypesWindowsServerPerpetual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DedicatedHostLicenseTypes(input) + return &out, nil +} + +type InstanceViewTypes string + +const ( + InstanceViewTypesInstanceView InstanceViewTypes = "instanceView" + InstanceViewTypesUserData InstanceViewTypes = "userData" +) + +func PossibleValuesForInstanceViewTypes() []string { + return []string{ + string(InstanceViewTypesInstanceView), + string(InstanceViewTypesUserData), + } +} + +func parseInstanceViewTypes(input string) (*InstanceViewTypes, error) { + vals := map[string]InstanceViewTypes{ + "instanceview": InstanceViewTypesInstanceView, + "userdata": InstanceViewTypesUserData, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InstanceViewTypes(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/id_host.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/id_host.go new file mode 100644 index 00000000000..027aa1b4eb7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/id_host.go @@ -0,0 +1,137 @@ +package dedicatedhosts + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = HostId{} + +// HostId is a struct representing the Resource ID for a Host +type HostId struct { + SubscriptionId string + ResourceGroupName string + HostGroupName string + HostName string +} + +// NewHostID returns a new HostId struct +func NewHostID(subscriptionId string, resourceGroupName string, hostGroupName string, hostName string) HostId { + return HostId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + HostGroupName: hostGroupName, + HostName: hostName, + } +} + +// ParseHostID parses 'input' into a HostId +func ParseHostID(input string) (*HostId, error) { + parser := resourceids.NewParserFromResourceIdType(HostId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'hostGroupName' was not found in the resource id %q", input) + } + + if id.HostName, ok = parsed.Parsed["hostName"]; !ok { + return nil, fmt.Errorf("the segment 'hostName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseHostIDInsensitively parses 'input' case-insensitively into a HostId +// note: this method should only be used for API response data and not user input +func ParseHostIDInsensitively(input string) (*HostId, error) { + parser := resourceids.NewParserFromResourceIdType(HostId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'hostGroupName' was not found in the resource id %q", input) + } + + if id.HostName, ok = parsed.Parsed["hostName"]; !ok { + return nil, fmt.Errorf("the segment 'hostName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateHostID checks that 'input' can be parsed as a Host ID +func ValidateHostID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseHostID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Host ID +func (id HostId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/hostGroups/%s/hosts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.HostGroupName, id.HostName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Host ID +func (id HostId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticHostGroups", "hostGroups", "hostGroups"), + resourceids.UserSpecifiedSegment("hostGroupName", "hostGroupValue"), + resourceids.StaticSegment("staticHosts", "hosts", "hosts"), + resourceids.UserSpecifiedSegment("hostName", "hostValue"), + } +} + +// String returns a human-readable description of this Host ID +func (id HostId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Host Group Name: %q", id.HostGroupName), + fmt.Sprintf("Host Name: %q", id.HostName), + } + return fmt.Sprintf("Host (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/method_createorupdate_autorest.go new file mode 100644 index 00000000000..7a949f91c98 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package dedicatedhosts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c DedicatedHostsClient) CreateOrUpdate(ctx context.Context, id HostId, input DedicatedHost) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhosts.DedicatedHostsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhosts.DedicatedHostsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c DedicatedHostsClient) CreateOrUpdateThenPoll(ctx context.Context, id HostId, input DedicatedHost) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c DedicatedHostsClient) preparerForCreateOrUpdate(ctx context.Context, id HostId, input DedicatedHost) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c DedicatedHostsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/method_delete_autorest.go new file mode 100644 index 00000000000..9730b615da4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/method_delete_autorest.go @@ -0,0 +1,78 @@ +package dedicatedhosts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c DedicatedHostsClient) Delete(ctx context.Context, id HostId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhosts.DedicatedHostsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhosts.DedicatedHostsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DedicatedHostsClient) DeleteThenPoll(ctx context.Context, id HostId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c DedicatedHostsClient) preparerForDelete(ctx context.Context, id HostId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c DedicatedHostsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/method_get_autorest.go new file mode 100644 index 00000000000..ff03643bbe7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/method_get_autorest.go @@ -0,0 +1,97 @@ +package dedicatedhosts + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *DedicatedHost +} + +type GetOperationOptions struct { + Expand *InstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// Get ... +func (c DedicatedHostsClient) Get(ctx context.Context, id HostId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhosts.DedicatedHostsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhosts.DedicatedHostsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhosts.DedicatedHostsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DedicatedHostsClient) preparerForGet(ctx context.Context, id HostId, options GetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DedicatedHostsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/method_update_autorest.go new file mode 100644 index 00000000000..be212b805b9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/method_update_autorest.go @@ -0,0 +1,79 @@ +package dedicatedhosts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c DedicatedHostsClient) Update(ctx context.Context, id HostId, input DedicatedHostUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhosts.DedicatedHostsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhosts.DedicatedHostsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c DedicatedHostsClient) UpdateThenPoll(ctx context.Context, id HostId, input DedicatedHostUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c DedicatedHostsClient) preparerForUpdate(ctx context.Context, id HostId, input DedicatedHostUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c DedicatedHostsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhost.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhost.go new file mode 100644 index 00000000000..c5b706c12d8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhost.go @@ -0,0 +1,14 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHost struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *DedicatedHostProperties `json:"properties,omitempty"` + Sku Sku `json:"sku"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhostallocatablevm.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhostallocatablevm.go new file mode 100644 index 00000000000..62a06248b73 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhostallocatablevm.go @@ -0,0 +1,9 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostAllocatableVM struct { + Count *float64 `json:"count,omitempty"` + VmSize *string `json:"vmSize,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhostavailablecapacity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhostavailablecapacity.go new file mode 100644 index 00000000000..4a815b0460c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhostavailablecapacity.go @@ -0,0 +1,8 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostAvailableCapacity struct { + AllocatableVMs *[]DedicatedHostAllocatableVM `json:"allocatableVMs,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhostinstanceview.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhostinstanceview.go new file mode 100644 index 00000000000..7574083ca0d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhostinstanceview.go @@ -0,0 +1,10 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostInstanceView struct { + AssetId *string `json:"assetId,omitempty"` + AvailableCapacity *DedicatedHostAvailableCapacity `json:"availableCapacity,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhostproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhostproperties.go new file mode 100644 index 00000000000..067483736a4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhostproperties.go @@ -0,0 +1,46 @@ +package dedicatedhosts + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostProperties struct { + AutoReplaceOnFailure *bool `json:"autoReplaceOnFailure,omitempty"` + HostId *string `json:"hostId,omitempty"` + InstanceView *DedicatedHostInstanceView `json:"instanceView,omitempty"` + LicenseType *DedicatedHostLicenseTypes `json:"licenseType,omitempty"` + PlatformFaultDomain *int64 `json:"platformFaultDomain,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ProvisioningTime *string `json:"provisioningTime,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + VirtualMachines *[]SubResourceReadOnly `json:"virtualMachines,omitempty"` +} + +func (o *DedicatedHostProperties) GetProvisioningTimeAsTime() (*time.Time, error) { + if o.ProvisioningTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ProvisioningTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *DedicatedHostProperties) SetProvisioningTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ProvisioningTime = &formatted +} + +func (o *DedicatedHostProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *DedicatedHostProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhostupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhostupdate.go new file mode 100644 index 00000000000..c2a21bb93d1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_dedicatedhostupdate.go @@ -0,0 +1,9 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostUpdate struct { + Properties *DedicatedHostProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_instanceviewstatus.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_instanceviewstatus.go new file mode 100644 index 00000000000..fe3a89546ec --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package dedicatedhosts + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_sku.go new file mode 100644 index 00000000000..ce3dda6ffbe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_sku.go @@ -0,0 +1,10 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_subresourcereadonly.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_subresourcereadonly.go new file mode 100644 index 00000000000..91dea24f8e1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/model_subresourcereadonly.go @@ -0,0 +1,8 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResourceReadOnly struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/version.go new file mode 100644 index 00000000000..74e63de99bd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts/version.go @@ -0,0 +1,12 @@ +package dedicatedhosts + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/dedicatedhosts/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/README.md new file mode 100644 index 00000000000..5e636204d46 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups` Documentation + +The `proximityplacementgroups` SDK allows for interaction with the Azure Resource Manager Service `compute` (API Version `2021-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups" +``` + + +### Client Initialization + +```go +client := proximityplacementgroups.NewProximityPlacementGroupsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ProximityPlacementGroupsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := proximityplacementgroups.NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupValue") + +payload := proximityplacementgroups.ProximityPlacementGroup{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProximityPlacementGroupsClient.Delete` + +```go +ctx := context.TODO() +id := proximityplacementgroups.NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProximityPlacementGroupsClient.Get` + +```go +ctx := context.TODO() +id := proximityplacementgroups.NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupValue") + +read, err := client.Get(ctx, id, proximityplacementgroups.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProximityPlacementGroupsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := proximityplacementgroups.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ProximityPlacementGroupsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := proximityplacementgroups.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ProximityPlacementGroupsClient.Update` + +```go +ctx := context.TODO() +id := proximityplacementgroups.NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupValue") + +payload := proximityplacementgroups.UpdateResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/client.go new file mode 100644 index 00000000000..25996ae4971 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/client.go @@ -0,0 +1,18 @@ +package proximityplacementgroups + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProximityPlacementGroupsClient struct { + Client autorest.Client + baseUri string +} + +func NewProximityPlacementGroupsClientWithBaseURI(endpoint string) ProximityPlacementGroupsClient { + return ProximityPlacementGroupsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/constants.go new file mode 100644 index 00000000000..d7aa207e837 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/constants.go @@ -0,0 +1,65 @@ +package proximityplacementgroups + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProximityPlacementGroupType string + +const ( + ProximityPlacementGroupTypeStandard ProximityPlacementGroupType = "Standard" + ProximityPlacementGroupTypeUltra ProximityPlacementGroupType = "Ultra" +) + +func PossibleValuesForProximityPlacementGroupType() []string { + return []string{ + string(ProximityPlacementGroupTypeStandard), + string(ProximityPlacementGroupTypeUltra), + } +} + +func parseProximityPlacementGroupType(input string) (*ProximityPlacementGroupType, error) { + vals := map[string]ProximityPlacementGroupType{ + "standard": ProximityPlacementGroupTypeStandard, + "ultra": ProximityPlacementGroupTypeUltra, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProximityPlacementGroupType(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/id_proximityplacementgroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/id_proximityplacementgroup.go new file mode 100644 index 00000000000..922ac4a9d35 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/id_proximityplacementgroup.go @@ -0,0 +1,124 @@ +package proximityplacementgroups + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ProximityPlacementGroupId{} + +// ProximityPlacementGroupId is a struct representing the Resource ID for a Proximity Placement Group +type ProximityPlacementGroupId struct { + SubscriptionId string + ResourceGroupName string + ProximityPlacementGroupName string +} + +// NewProximityPlacementGroupID returns a new ProximityPlacementGroupId struct +func NewProximityPlacementGroupID(subscriptionId string, resourceGroupName string, proximityPlacementGroupName string) ProximityPlacementGroupId { + return ProximityPlacementGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProximityPlacementGroupName: proximityPlacementGroupName, + } +} + +// ParseProximityPlacementGroupID parses 'input' into a ProximityPlacementGroupId +func ParseProximityPlacementGroupID(input string) (*ProximityPlacementGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ProximityPlacementGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProximityPlacementGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProximityPlacementGroupName, ok = parsed.Parsed["proximityPlacementGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'proximityPlacementGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseProximityPlacementGroupIDInsensitively parses 'input' case-insensitively into a ProximityPlacementGroupId +// note: this method should only be used for API response data and not user input +func ParseProximityPlacementGroupIDInsensitively(input string) (*ProximityPlacementGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ProximityPlacementGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProximityPlacementGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProximityPlacementGroupName, ok = parsed.Parsed["proximityPlacementGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'proximityPlacementGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateProximityPlacementGroupID checks that 'input' can be parsed as a Proximity Placement Group ID +func ValidateProximityPlacementGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProximityPlacementGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Proximity Placement Group ID +func (id ProximityPlacementGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/proximityPlacementGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProximityPlacementGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Proximity Placement Group ID +func (id ProximityPlacementGroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticProximityPlacementGroups", "proximityPlacementGroups", "proximityPlacementGroups"), + resourceids.UserSpecifiedSegment("proximityPlacementGroupName", "proximityPlacementGroupValue"), + } +} + +// String returns a human-readable description of this Proximity Placement Group ID +func (id ProximityPlacementGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Proximity Placement Group Name: %q", id.ProximityPlacementGroupName), + } + return fmt.Sprintf("Proximity Placement Group (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_createorupdate_autorest.go new file mode 100644 index 00000000000..7e5b7fb65fc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package proximityplacementgroups + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *ProximityPlacementGroup +} + +// CreateOrUpdate ... +func (c ProximityPlacementGroupsClient) CreateOrUpdate(ctx context.Context, id ProximityPlacementGroupId, input ProximityPlacementGroup) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ProximityPlacementGroupsClient) preparerForCreateOrUpdate(ctx context.Context, id ProximityPlacementGroupId, input ProximityPlacementGroup) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ProximityPlacementGroupsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_delete_autorest.go new file mode 100644 index 00000000000..1d0dc9e8005 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_delete_autorest.go @@ -0,0 +1,66 @@ +package proximityplacementgroups + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ProximityPlacementGroupsClient) Delete(ctx context.Context, id ProximityPlacementGroupId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ProximityPlacementGroupsClient) preparerForDelete(ctx context.Context, id ProximityPlacementGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ProximityPlacementGroupsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_get_autorest.go new file mode 100644 index 00000000000..6e2f9a6e707 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_get_autorest.go @@ -0,0 +1,97 @@ +package proximityplacementgroups + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ProximityPlacementGroup +} + +type GetOperationOptions struct { + IncludeColocationStatus *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IncludeColocationStatus != nil { + out["includeColocationStatus"] = *o.IncludeColocationStatus + } + + return out +} + +// Get ... +func (c ProximityPlacementGroupsClient) Get(ctx context.Context, id ProximityPlacementGroupId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ProximityPlacementGroupsClient) preparerForGet(ctx context.Context, id ProximityPlacementGroupId, options GetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ProximityPlacementGroupsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..8a859ee11ab --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package proximityplacementgroups + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]ProximityPlacementGroup + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []ProximityPlacementGroup +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c ProximityPlacementGroupsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ProximityPlacementGroupsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Compute/proximityPlacementGroups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c ProximityPlacementGroupsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ProximityPlacementGroupsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []ProximityPlacementGroup `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c ProximityPlacementGroupsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ProximityPlacementGroupOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ProximityPlacementGroupsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ProximityPlacementGroupOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]ProximityPlacementGroup, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..83d00c46567 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package proximityplacementgroups + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]ProximityPlacementGroup + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []ProximityPlacementGroup +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c ProximityPlacementGroupsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c ProximityPlacementGroupsClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Compute/proximityPlacementGroups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c ProximityPlacementGroupsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c ProximityPlacementGroupsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []ProximityPlacementGroup `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c ProximityPlacementGroupsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ProximityPlacementGroupOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ProximityPlacementGroupsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ProximityPlacementGroupOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]ProximityPlacementGroup, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_update_autorest.go new file mode 100644 index 00000000000..d1317543f1d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/method_update_autorest.go @@ -0,0 +1,69 @@ +package proximityplacementgroups + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *ProximityPlacementGroup +} + +// Update ... +func (c ProximityPlacementGroupsClient) Update(ctx context.Context, id ProximityPlacementGroupId, input UpdateResource) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "proximityplacementgroups.ProximityPlacementGroupsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ProximityPlacementGroupsClient) preparerForUpdate(ctx context.Context, id ProximityPlacementGroupId, input UpdateResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ProximityPlacementGroupsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/model_instanceviewstatus.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/model_instanceviewstatus.go new file mode 100644 index 00000000000..3b148b1d660 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package proximityplacementgroups + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/model_proximityplacementgroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/model_proximityplacementgroup.go new file mode 100644 index 00000000000..11176f3fbb2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/model_proximityplacementgroup.go @@ -0,0 +1,13 @@ +package proximityplacementgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProximityPlacementGroup struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ProximityPlacementGroupProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/model_proximityplacementgroupproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/model_proximityplacementgroupproperties.go new file mode 100644 index 00000000000..003fa3b8aa9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/model_proximityplacementgroupproperties.go @@ -0,0 +1,12 @@ +package proximityplacementgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProximityPlacementGroupProperties struct { + AvailabilitySets *[]SubResourceWithColocationStatus `json:"availabilitySets,omitempty"` + ColocationStatus *InstanceViewStatus `json:"colocationStatus,omitempty"` + ProximityPlacementGroupType *ProximityPlacementGroupType `json:"proximityPlacementGroupType,omitempty"` + VirtualMachineScaleSets *[]SubResourceWithColocationStatus `json:"virtualMachineScaleSets,omitempty"` + VirtualMachines *[]SubResourceWithColocationStatus `json:"virtualMachines,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/model_subresourcewithcolocationstatus.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/model_subresourcewithcolocationstatus.go new file mode 100644 index 00000000000..a6c493baa63 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/model_subresourcewithcolocationstatus.go @@ -0,0 +1,9 @@ +package proximityplacementgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResourceWithColocationStatus struct { + ColocationStatus *InstanceViewStatus `json:"colocationStatus,omitempty"` + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/model_updateresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/model_updateresource.go new file mode 100644 index 00000000000..0c63bc1293b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/model_updateresource.go @@ -0,0 +1,8 @@ +package proximityplacementgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateResource struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/predicates.go new file mode 100644 index 00000000000..61d79f29b76 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/predicates.go @@ -0,0 +1,29 @@ +package proximityplacementgroups + +type ProximityPlacementGroupOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ProximityPlacementGroupOperationPredicate) Matches(input ProximityPlacementGroup) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/version.go new file mode 100644 index 00000000000..2b7d7e44fa2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups/version.go @@ -0,0 +1,12 @@ +package proximityplacementgroups + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/proximityplacementgroups/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/README.md new file mode 100644 index 00000000000..643490b8765 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/README.md @@ -0,0 +1,144 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys` Documentation + +The `sshpublickeys` SDK allows for interaction with the Azure Resource Manager Service `compute` (API Version `2021-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys" +``` + + +### Client Initialization + +```go +client := sshpublickeys.NewSshPublicKeysClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SshPublicKeysClient.Create` + +```go +ctx := context.TODO() +id := sshpublickeys.NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyValue") + +payload := sshpublickeys.SshPublicKeyResource{ + // ... +} + + +read, err := client.Create(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SshPublicKeysClient.Delete` + +```go +ctx := context.TODO() +id := sshpublickeys.NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SshPublicKeysClient.GenerateKeyPair` + +```go +ctx := context.TODO() +id := sshpublickeys.NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyValue") + +read, err := client.GenerateKeyPair(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SshPublicKeysClient.Get` + +```go +ctx := context.TODO() +id := sshpublickeys.NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SshPublicKeysClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := sshpublickeys.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SshPublicKeysClient.ListBySubscription` + +```go +ctx := context.TODO() +id := sshpublickeys.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SshPublicKeysClient.Update` + +```go +ctx := context.TODO() +id := sshpublickeys.NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyValue") + +payload := sshpublickeys.SshPublicKeyUpdateResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/client.go new file mode 100644 index 00000000000..e7322535ac3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/client.go @@ -0,0 +1,18 @@ +package sshpublickeys + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKeysClient struct { + Client autorest.Client + baseUri string +} + +func NewSshPublicKeysClientWithBaseURI(endpoint string) SshPublicKeysClient { + return SshPublicKeysClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/id_sshpublickey.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/id_sshpublickey.go new file mode 100644 index 00000000000..1cdafea9f5d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/id_sshpublickey.go @@ -0,0 +1,124 @@ +package sshpublickeys + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SshPublicKeyId{} + +// SshPublicKeyId is a struct representing the Resource ID for a Ssh Public Key +type SshPublicKeyId struct { + SubscriptionId string + ResourceGroupName string + SshPublicKeyName string +} + +// NewSshPublicKeyID returns a new SshPublicKeyId struct +func NewSshPublicKeyID(subscriptionId string, resourceGroupName string, sshPublicKeyName string) SshPublicKeyId { + return SshPublicKeyId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SshPublicKeyName: sshPublicKeyName, + } +} + +// ParseSshPublicKeyID parses 'input' into a SshPublicKeyId +func ParseSshPublicKeyID(input string) (*SshPublicKeyId, error) { + parser := resourceids.NewParserFromResourceIdType(SshPublicKeyId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SshPublicKeyId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.SshPublicKeyName, ok = parsed.Parsed["sshPublicKeyName"]; !ok { + return nil, fmt.Errorf("the segment 'sshPublicKeyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSshPublicKeyIDInsensitively parses 'input' case-insensitively into a SshPublicKeyId +// note: this method should only be used for API response data and not user input +func ParseSshPublicKeyIDInsensitively(input string) (*SshPublicKeyId, error) { + parser := resourceids.NewParserFromResourceIdType(SshPublicKeyId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SshPublicKeyId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.SshPublicKeyName, ok = parsed.Parsed["sshPublicKeyName"]; !ok { + return nil, fmt.Errorf("the segment 'sshPublicKeyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSshPublicKeyID checks that 'input' can be parsed as a Ssh Public Key ID +func ValidateSshPublicKeyID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSshPublicKeyID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Ssh Public Key ID +func (id SshPublicKeyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/sshPublicKeys/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SshPublicKeyName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Ssh Public Key ID +func (id SshPublicKeyId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticSshPublicKeys", "sshPublicKeys", "sshPublicKeys"), + resourceids.UserSpecifiedSegment("sshPublicKeyName", "sshPublicKeyValue"), + } +} + +// String returns a human-readable description of this Ssh Public Key ID +func (id SshPublicKeyId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Ssh Public Key Name: %q", id.SshPublicKeyName), + } + return fmt.Sprintf("Ssh Public Key (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_create_autorest.go new file mode 100644 index 00000000000..c5ce7486528 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_create_autorest.go @@ -0,0 +1,69 @@ +package sshpublickeys + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *SshPublicKeyResource +} + +// Create ... +func (c SshPublicKeysClient) Create(ctx context.Context, id SshPublicKeyId, input SshPublicKeyResource) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c SshPublicKeysClient) preparerForCreate(ctx context.Context, id SshPublicKeyId, input SshPublicKeyResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c SshPublicKeysClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_delete_autorest.go new file mode 100644 index 00000000000..a0fb461d507 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_delete_autorest.go @@ -0,0 +1,66 @@ +package sshpublickeys + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c SshPublicKeysClient) Delete(ctx context.Context, id SshPublicKeyId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c SshPublicKeysClient) preparerForDelete(ctx context.Context, id SshPublicKeyId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c SshPublicKeysClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_generatekeypair_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_generatekeypair_autorest.go new file mode 100644 index 00000000000..0200daedec1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_generatekeypair_autorest.go @@ -0,0 +1,69 @@ +package sshpublickeys + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GenerateKeyPairOperationResponse struct { + HttpResponse *http.Response + Model *SshPublicKeyGenerateKeyPairResult +} + +// GenerateKeyPair ... +func (c SshPublicKeysClient) GenerateKeyPair(ctx context.Context, id SshPublicKeyId) (result GenerateKeyPairOperationResponse, err error) { + req, err := c.preparerForGenerateKeyPair(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "GenerateKeyPair", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "GenerateKeyPair", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGenerateKeyPair(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "GenerateKeyPair", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGenerateKeyPair prepares the GenerateKeyPair request. +func (c SshPublicKeysClient) preparerForGenerateKeyPair(ctx context.Context, id SshPublicKeyId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/generateKeyPair", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGenerateKeyPair handles the response to the GenerateKeyPair request. The method always +// closes the http.Response Body. +func (c SshPublicKeysClient) responderForGenerateKeyPair(resp *http.Response) (result GenerateKeyPairOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_get_autorest.go new file mode 100644 index 00000000000..5c4e544265a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_get_autorest.go @@ -0,0 +1,68 @@ +package sshpublickeys + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *SshPublicKeyResource +} + +// Get ... +func (c SshPublicKeysClient) Get(ctx context.Context, id SshPublicKeyId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c SshPublicKeysClient) preparerForGet(ctx context.Context, id SshPublicKeyId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c SshPublicKeysClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..1216c2eef89 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package sshpublickeys + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]SshPublicKeyResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []SshPublicKeyResource +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c SshPublicKeysClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c SshPublicKeysClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Compute/sshPublicKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c SshPublicKeysClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c SshPublicKeysClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []SshPublicKeyResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c SshPublicKeysClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, SshPublicKeyResourceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SshPublicKeysClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate SshPublicKeyResourceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]SshPublicKeyResource, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..7990abae0ef --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package sshpublickeys + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]SshPublicKeyResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []SshPublicKeyResource +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c SshPublicKeysClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c SshPublicKeysClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Compute/sshPublicKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c SshPublicKeysClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c SshPublicKeysClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []SshPublicKeyResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c SshPublicKeysClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, SshPublicKeyResourceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SshPublicKeysClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate SshPublicKeyResourceOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]SshPublicKeyResource, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_update_autorest.go new file mode 100644 index 00000000000..7a0b0ca45f5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/method_update_autorest.go @@ -0,0 +1,69 @@ +package sshpublickeys + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *SshPublicKeyResource +} + +// Update ... +func (c SshPublicKeysClient) Update(ctx context.Context, id SshPublicKeyId, input SshPublicKeyUpdateResource) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sshpublickeys.SshPublicKeysClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c SshPublicKeysClient) preparerForUpdate(ctx context.Context, id SshPublicKeyId, input SshPublicKeyUpdateResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c SshPublicKeysClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/model_sshpublickeygeneratekeypairresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/model_sshpublickeygeneratekeypairresult.go new file mode 100644 index 00000000000..cf57d99b268 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/model_sshpublickeygeneratekeypairresult.go @@ -0,0 +1,10 @@ +package sshpublickeys + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKeyGenerateKeyPairResult struct { + Id string `json:"id"` + PrivateKey string `json:"privateKey"` + PublicKey string `json:"publicKey"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/model_sshpublickeyresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/model_sshpublickeyresource.go new file mode 100644 index 00000000000..bbabaefed19 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/model_sshpublickeyresource.go @@ -0,0 +1,13 @@ +package sshpublickeys + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKeyResource struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *SshPublicKeyResourceProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/model_sshpublickeyresourceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/model_sshpublickeyresourceproperties.go new file mode 100644 index 00000000000..b1d00a16a12 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/model_sshpublickeyresourceproperties.go @@ -0,0 +1,8 @@ +package sshpublickeys + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKeyResourceProperties struct { + PublicKey *string `json:"publicKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/model_sshpublickeyupdateresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/model_sshpublickeyupdateresource.go new file mode 100644 index 00000000000..e5ab89367c5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/model_sshpublickeyupdateresource.go @@ -0,0 +1,9 @@ +package sshpublickeys + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKeyUpdateResource struct { + Properties *SshPublicKeyResourceProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/predicates.go new file mode 100644 index 00000000000..f369fdbf129 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/predicates.go @@ -0,0 +1,29 @@ +package sshpublickeys + +type SshPublicKeyResourceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p SshPublicKeyResourceOperationPredicate) Matches(input SshPublicKeyResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/version.go new file mode 100644 index 00000000000..dfef6a053cb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys/version.go @@ -0,0 +1,12 @@ +package sshpublickeys + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/sshpublickeys/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/README.md new file mode 100644 index 00000000000..5fb3b45f80a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger` Documentation + +The `confidentialledger` SDK allows for interaction with the Azure Resource Manager Service `confidentialledger` (API Version `2022-05-13`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger" +``` + + +### Client Initialization + +```go +client := confidentialledger.NewConfidentialLedgerClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ConfidentialLedgerClient.LedgerCreate` + +```go +ctx := context.TODO() +id := confidentialledger.NewLedgerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ledgerValue") + +payload := confidentialledger.ConfidentialLedger{ + // ... +} + + +if err := client.LedgerCreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ConfidentialLedgerClient.LedgerDelete` + +```go +ctx := context.TODO() +id := confidentialledger.NewLedgerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ledgerValue") + +if err := client.LedgerDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ConfidentialLedgerClient.LedgerGet` + +```go +ctx := context.TODO() +id := confidentialledger.NewLedgerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ledgerValue") + +read, err := client.LedgerGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConfidentialLedgerClient.LedgerListByResourceGroup` + +```go +ctx := context.TODO() +id := confidentialledger.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.LedgerListByResourceGroup(ctx, id, confidentialledger.DefaultLedgerListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.LedgerListByResourceGroupComplete(ctx, id, confidentialledger.DefaultLedgerListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ConfidentialLedgerClient.LedgerListBySubscription` + +```go +ctx := context.TODO() +id := confidentialledger.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.LedgerListBySubscription(ctx, id, confidentialledger.DefaultLedgerListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.LedgerListBySubscriptionComplete(ctx, id, confidentialledger.DefaultLedgerListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ConfidentialLedgerClient.LedgerUpdate` + +```go +ctx := context.TODO() +id := confidentialledger.NewLedgerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "ledgerValue") + +payload := confidentialledger.ConfidentialLedger{ + // ... +} + + +if err := client.LedgerUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/client.go new file mode 100644 index 00000000000..7cfb835a12c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/client.go @@ -0,0 +1,18 @@ +package confidentialledger + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfidentialLedgerClient struct { + Client autorest.Client + baseUri string +} + +func NewConfidentialLedgerClientWithBaseURI(endpoint string) ConfidentialLedgerClient { + return ConfidentialLedgerClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/constants.go new file mode 100644 index 00000000000..770f3e704ed --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/constants.go @@ -0,0 +1,111 @@ +package confidentialledger + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LedgerRoleName string + +const ( + LedgerRoleNameAdministrator LedgerRoleName = "Administrator" + LedgerRoleNameContributor LedgerRoleName = "Contributor" + LedgerRoleNameReader LedgerRoleName = "Reader" +) + +func PossibleValuesForLedgerRoleName() []string { + return []string{ + string(LedgerRoleNameAdministrator), + string(LedgerRoleNameContributor), + string(LedgerRoleNameReader), + } +} + +func parseLedgerRoleName(input string) (*LedgerRoleName, error) { + vals := map[string]LedgerRoleName{ + "administrator": LedgerRoleNameAdministrator, + "contributor": LedgerRoleNameContributor, + "reader": LedgerRoleNameReader, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LedgerRoleName(input) + return &out, nil +} + +type LedgerType string + +const ( + LedgerTypePrivate LedgerType = "Private" + LedgerTypePublic LedgerType = "Public" + LedgerTypeUnknown LedgerType = "Unknown" +) + +func PossibleValuesForLedgerType() []string { + return []string{ + string(LedgerTypePrivate), + string(LedgerTypePublic), + string(LedgerTypeUnknown), + } +} + +func parseLedgerType(input string) (*LedgerType, error) { + vals := map[string]LedgerType{ + "private": LedgerTypePrivate, + "public": LedgerTypePublic, + "unknown": LedgerTypeUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LedgerType(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUnknown), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "unknown": ProvisioningStateUnknown, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/id_ledger.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/id_ledger.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/id_ledger.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/id_ledger.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgercreate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgercreate_autorest.go similarity index 90% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgercreate_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgercreate_autorest.go index f1132b0f94b..a85f38a8830 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgercreate_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgercreate_autorest.go @@ -10,6 +10,9 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type LedgerCreateOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response @@ -70,6 +73,7 @@ func (c ConfidentialLedgerClient) senderForLedgerCreate(ctx context.Context, req if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgerdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerdelete_autorest.go similarity index 90% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgerdelete_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerdelete_autorest.go index c5463e5ead9..7a43fa84326 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgerdelete_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerdelete_autorest.go @@ -10,6 +10,9 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type LedgerDeleteOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response @@ -69,6 +72,7 @@ func (c ConfidentialLedgerClient) senderForLedgerDelete(ctx context.Context, req if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgerget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerget_autorest.go similarity index 93% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgerget_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerget_autorest.go index 1bc16fab463..fc382a8e506 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgerget_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerget_autorest.go @@ -8,6 +8,9 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type LedgerGetOperationResponse struct { HttpResponse *http.Response Model *ConfidentialLedger @@ -60,5 +63,6 @@ func (c ConfidentialLedgerClient) responderForLedgerGet(resp *http.Response) (re autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgerlistbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerlistbyresourcegroup_autorest.go similarity index 95% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgerlistbyresourcegroup_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerlistbyresourcegroup_autorest.go index 33e8d4f3a1e..43ccdb80c09 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgerlistbyresourcegroup_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerlistbyresourcegroup_autorest.go @@ -11,6 +11,9 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type LedgerListByResourceGroupOperationResponse struct { HttpResponse *http.Response Model *[]ConfidentialLedger @@ -43,6 +46,12 @@ func DefaultLedgerListByResourceGroupOperationOptions() LedgerListByResourceGrou return LedgerListByResourceGroupOperationOptions{} } +func (o LedgerListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + func (o LedgerListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { out := make(map[string]interface{}) @@ -75,50 +84,6 @@ func (c ConfidentialLedgerClient) LedgerListByResourceGroup(ctx context.Context, return } -// LedgerListByResourceGroupComplete retrieves all of the results into a single object -func (c ConfidentialLedgerClient) LedgerListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options LedgerListByResourceGroupOperationOptions) (LedgerListByResourceGroupCompleteResult, error) { - return c.LedgerListByResourceGroupCompleteMatchingPredicate(ctx, id, options, ConfidentialLedgerOperationPredicate{}) -} - -// LedgerListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ConfidentialLedgerClient) LedgerListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options LedgerListByResourceGroupOperationOptions, predicate ConfidentialLedgerOperationPredicate) (resp LedgerListByResourceGroupCompleteResult, err error) { - items := make([]ConfidentialLedger, 0) - - page, err := c.LedgerListByResourceGroup(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := LedgerListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForLedgerListByResourceGroup prepares the LedgerListByResourceGroup request. func (c ConfidentialLedgerClient) preparerForLedgerListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options LedgerListByResourceGroupOperationOptions) (*http.Request, error) { queryParameters := map[string]interface{}{ @@ -133,6 +98,7 @@ func (c ConfidentialLedgerClient) preparerForLedgerListByResourceGroup(ctx conte autorest.AsContentType("application/json; charset=utf-8"), autorest.AsGet(), autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ConfidentialLedger/ledgers", id.ID())), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -204,3 +170,47 @@ func (c ConfidentialLedgerClient) responderForLedgerListByResourceGroup(resp *ht } return } + +// LedgerListByResourceGroupComplete retrieves all of the results into a single object +func (c ConfidentialLedgerClient) LedgerListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options LedgerListByResourceGroupOperationOptions) (LedgerListByResourceGroupCompleteResult, error) { + return c.LedgerListByResourceGroupCompleteMatchingPredicate(ctx, id, options, ConfidentialLedgerOperationPredicate{}) +} + +// LedgerListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ConfidentialLedgerClient) LedgerListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options LedgerListByResourceGroupOperationOptions, predicate ConfidentialLedgerOperationPredicate) (resp LedgerListByResourceGroupCompleteResult, err error) { + items := make([]ConfidentialLedger, 0) + + page, err := c.LedgerListByResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := LedgerListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgerlistbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerlistbysubscription_autorest.go similarity index 95% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgerlistbysubscription_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerlistbysubscription_autorest.go index 642a661ebb5..af4bf35b1fe 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgerlistbysubscription_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerlistbysubscription_autorest.go @@ -11,6 +11,9 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type LedgerListBySubscriptionOperationResponse struct { HttpResponse *http.Response Model *[]ConfidentialLedger @@ -43,6 +46,12 @@ func DefaultLedgerListBySubscriptionOperationOptions() LedgerListBySubscriptionO return LedgerListBySubscriptionOperationOptions{} } +func (o LedgerListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + func (o LedgerListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { out := make(map[string]interface{}) @@ -75,50 +84,6 @@ func (c ConfidentialLedgerClient) LedgerListBySubscription(ctx context.Context, return } -// LedgerListBySubscriptionComplete retrieves all of the results into a single object -func (c ConfidentialLedgerClient) LedgerListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options LedgerListBySubscriptionOperationOptions) (LedgerListBySubscriptionCompleteResult, error) { - return c.LedgerListBySubscriptionCompleteMatchingPredicate(ctx, id, options, ConfidentialLedgerOperationPredicate{}) -} - -// LedgerListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ConfidentialLedgerClient) LedgerListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options LedgerListBySubscriptionOperationOptions, predicate ConfidentialLedgerOperationPredicate) (resp LedgerListBySubscriptionCompleteResult, err error) { - items := make([]ConfidentialLedger, 0) - - page, err := c.LedgerListBySubscription(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := LedgerListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForLedgerListBySubscription prepares the LedgerListBySubscription request. func (c ConfidentialLedgerClient) preparerForLedgerListBySubscription(ctx context.Context, id commonids.SubscriptionId, options LedgerListBySubscriptionOperationOptions) (*http.Request, error) { queryParameters := map[string]interface{}{ @@ -133,6 +98,7 @@ func (c ConfidentialLedgerClient) preparerForLedgerListBySubscription(ctx contex autorest.AsContentType("application/json; charset=utf-8"), autorest.AsGet(), autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ConfidentialLedger/ledgers", id.ID())), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -204,3 +170,47 @@ func (c ConfidentialLedgerClient) responderForLedgerListBySubscription(resp *htt } return } + +// LedgerListBySubscriptionComplete retrieves all of the results into a single object +func (c ConfidentialLedgerClient) LedgerListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options LedgerListBySubscriptionOperationOptions) (LedgerListBySubscriptionCompleteResult, error) { + return c.LedgerListBySubscriptionCompleteMatchingPredicate(ctx, id, options, ConfidentialLedgerOperationPredicate{}) +} + +// LedgerListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ConfidentialLedgerClient) LedgerListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options LedgerListBySubscriptionOperationOptions, predicate ConfidentialLedgerOperationPredicate) (resp LedgerListBySubscriptionCompleteResult, err error) { + items := make([]ConfidentialLedger, 0) + + page, err := c.LedgerListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := LedgerListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgerupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerupdate_autorest.go similarity index 91% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgerupdate_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerupdate_autorest.go index c8951edb767..d3b81aa119c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/method_ledgerupdate_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/method_ledgerupdate_autorest.go @@ -10,6 +10,9 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type LedgerUpdateOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response @@ -70,6 +73,7 @@ func (c ConfidentialLedgerClient) senderForLedgerUpdate(ctx context.Context, req if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/model_aadbasedsecurityprincipal.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/model_aadbasedsecurityprincipal.go new file mode 100644 index 00000000000..0e38c0840bc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/model_aadbasedsecurityprincipal.go @@ -0,0 +1,10 @@ +package confidentialledger + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AADBasedSecurityPrincipal struct { + LedgerRoleName *LedgerRoleName `json:"ledgerRoleName,omitempty"` + PrincipalId *string `json:"principalId,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/model_certbasedsecurityprincipal.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/model_certbasedsecurityprincipal.go new file mode 100644 index 00000000000..655eab21ee3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/model_certbasedsecurityprincipal.go @@ -0,0 +1,9 @@ +package confidentialledger + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertBasedSecurityPrincipal struct { + Cert *string `json:"cert,omitempty"` + LedgerRoleName *LedgerRoleName `json:"ledgerRoleName,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/model_confidentialledger.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/model_confidentialledger.go new file mode 100644 index 00000000000..53b45896cd3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/model_confidentialledger.go @@ -0,0 +1,18 @@ +package confidentialledger + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfidentialLedger struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *LedgerProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/model_ledgerproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/model_ledgerproperties.go similarity index 84% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/model_ledgerproperties.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/model_ledgerproperties.go index 44ba70f5481..83b25911972 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/model_ledgerproperties.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/model_ledgerproperties.go @@ -1,5 +1,8 @@ package confidentialledger +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type LedgerProperties struct { AadBasedSecurityPrincipals *[]AADBasedSecurityPrincipal `json:"aadBasedSecurityPrincipals,omitempty"` CertBasedSecurityPrincipals *[]CertBasedSecurityPrincipal `json:"certBasedSecurityPrincipals,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/predicates.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/predicates.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/predicates.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/version.go new file mode 100644 index 00000000000..2528fa3818c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger/version.go @@ -0,0 +1,12 @@ +package confidentialledger + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-05-13" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/confidentialledger/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/README.md new file mode 100644 index 00000000000..367c474d442 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/README.md @@ -0,0 +1,263 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance` Documentation + +The `containerinstance` SDK allows for interaction with the Azure Resource Manager Service `containerinstance` (API Version `2021-03-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance" +``` + + +### Client Initialization + +```go +client := containerinstance.NewContainerInstanceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsCreateOrUpdate` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue") + +payload := containerinstance.ContainerGroup{ + // ... +} + + +if err := client.ContainerGroupsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsDelete` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue") + +if err := client.ContainerGroupsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsGet` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue") + +read, err := client.ContainerGroupsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsList` + +```go +ctx := context.TODO() +id := containerinstance.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ContainerGroupsList(ctx, id)` can be used to do batched pagination +items, err := client.ContainerGroupsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsListByResourceGroup` + +```go +ctx := context.TODO() +id := containerinstance.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ContainerGroupsListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ContainerGroupsListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsRestart` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue") + +if err := client.ContainerGroupsRestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsStart` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue") + +if err := client.ContainerGroupsStartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsStop` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue") + +read, err := client.ContainerGroupsStop(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainerGroupsUpdate` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue") + +payload := containerinstance.Resource{ + // ... +} + + +read, err := client.ContainerGroupsUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainersAttach` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue", "containerValue") + +read, err := client.ContainersAttach(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainersExecuteCommand` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue", "containerValue") + +payload := containerinstance.ContainerExecRequest{ + // ... +} + + +read, err := client.ContainersExecuteCommand(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.ContainersListLogs` + +```go +ctx := context.TODO() +id := containerinstance.NewContainerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "containerGroupValue", "containerValue") + +read, err := client.ContainersListLogs(ctx, id, containerinstance.DefaultContainersListLogsOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ContainerInstanceClient.LocationListCachedImages` + +```go +ctx := context.TODO() +id := containerinstance.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +// alternatively `client.LocationListCachedImages(ctx, id)` can be used to do batched pagination +items, err := client.LocationListCachedImagesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.LocationListCapabilities` + +```go +ctx := context.TODO() +id := containerinstance.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +// alternatively `client.LocationListCapabilities(ctx, id)` can be used to do batched pagination +items, err := client.LocationListCapabilitiesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ContainerInstanceClient.LocationListUsage` + +```go +ctx := context.TODO() +id := containerinstance.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +read, err := client.LocationListUsage(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/client.go new file mode 100644 index 00000000000..7c611fe53d7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/client.go @@ -0,0 +1,18 @@ +package containerinstance + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerInstanceClient struct { + Client autorest.Client + baseUri string +} + +func NewContainerInstanceClientWithBaseURI(endpoint string) ContainerInstanceClient { + return ContainerInstanceClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/constants.go new file mode 100644 index 00000000000..71335814b28 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/constants.go @@ -0,0 +1,264 @@ +package containerinstance + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupIPAddressType string + +const ( + ContainerGroupIPAddressTypePrivate ContainerGroupIPAddressType = "Private" + ContainerGroupIPAddressTypePublic ContainerGroupIPAddressType = "Public" +) + +func PossibleValuesForContainerGroupIPAddressType() []string { + return []string{ + string(ContainerGroupIPAddressTypePrivate), + string(ContainerGroupIPAddressTypePublic), + } +} + +func parseContainerGroupIPAddressType(input string) (*ContainerGroupIPAddressType, error) { + vals := map[string]ContainerGroupIPAddressType{ + "private": ContainerGroupIPAddressTypePrivate, + "public": ContainerGroupIPAddressTypePublic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerGroupIPAddressType(input) + return &out, nil +} + +type ContainerGroupNetworkProtocol string + +const ( + ContainerGroupNetworkProtocolTCP ContainerGroupNetworkProtocol = "TCP" + ContainerGroupNetworkProtocolUDP ContainerGroupNetworkProtocol = "UDP" +) + +func PossibleValuesForContainerGroupNetworkProtocol() []string { + return []string{ + string(ContainerGroupNetworkProtocolTCP), + string(ContainerGroupNetworkProtocolUDP), + } +} + +func parseContainerGroupNetworkProtocol(input string) (*ContainerGroupNetworkProtocol, error) { + vals := map[string]ContainerGroupNetworkProtocol{ + "tcp": ContainerGroupNetworkProtocolTCP, + "udp": ContainerGroupNetworkProtocolUDP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerGroupNetworkProtocol(input) + return &out, nil +} + +type ContainerGroupRestartPolicy string + +const ( + ContainerGroupRestartPolicyAlways ContainerGroupRestartPolicy = "Always" + ContainerGroupRestartPolicyNever ContainerGroupRestartPolicy = "Never" + ContainerGroupRestartPolicyOnFailure ContainerGroupRestartPolicy = "OnFailure" +) + +func PossibleValuesForContainerGroupRestartPolicy() []string { + return []string{ + string(ContainerGroupRestartPolicyAlways), + string(ContainerGroupRestartPolicyNever), + string(ContainerGroupRestartPolicyOnFailure), + } +} + +func parseContainerGroupRestartPolicy(input string) (*ContainerGroupRestartPolicy, error) { + vals := map[string]ContainerGroupRestartPolicy{ + "always": ContainerGroupRestartPolicyAlways, + "never": ContainerGroupRestartPolicyNever, + "onfailure": ContainerGroupRestartPolicyOnFailure, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerGroupRestartPolicy(input) + return &out, nil +} + +type ContainerGroupSku string + +const ( + ContainerGroupSkuDedicated ContainerGroupSku = "Dedicated" + ContainerGroupSkuStandard ContainerGroupSku = "Standard" +) + +func PossibleValuesForContainerGroupSku() []string { + return []string{ + string(ContainerGroupSkuDedicated), + string(ContainerGroupSkuStandard), + } +} + +func parseContainerGroupSku(input string) (*ContainerGroupSku, error) { + vals := map[string]ContainerGroupSku{ + "dedicated": ContainerGroupSkuDedicated, + "standard": ContainerGroupSkuStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerGroupSku(input) + return &out, nil +} + +type ContainerNetworkProtocol string + +const ( + ContainerNetworkProtocolTCP ContainerNetworkProtocol = "TCP" + ContainerNetworkProtocolUDP ContainerNetworkProtocol = "UDP" +) + +func PossibleValuesForContainerNetworkProtocol() []string { + return []string{ + string(ContainerNetworkProtocolTCP), + string(ContainerNetworkProtocolUDP), + } +} + +func parseContainerNetworkProtocol(input string) (*ContainerNetworkProtocol, error) { + vals := map[string]ContainerNetworkProtocol{ + "tcp": ContainerNetworkProtocolTCP, + "udp": ContainerNetworkProtocolUDP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ContainerNetworkProtocol(input) + return &out, nil +} + +type GpuSku string + +const ( + GpuSkuKEightZero GpuSku = "K80" + GpuSkuPOneHundred GpuSku = "P100" + GpuSkuVOneHundred GpuSku = "V100" +) + +func PossibleValuesForGpuSku() []string { + return []string{ + string(GpuSkuKEightZero), + string(GpuSkuPOneHundred), + string(GpuSkuVOneHundred), + } +} + +func parseGpuSku(input string) (*GpuSku, error) { + vals := map[string]GpuSku{ + "k80": GpuSkuKEightZero, + "p100": GpuSkuPOneHundred, + "v100": GpuSkuVOneHundred, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GpuSku(input) + return &out, nil +} + +type LogAnalyticsLogType string + +const ( + LogAnalyticsLogTypeContainerInsights LogAnalyticsLogType = "ContainerInsights" + LogAnalyticsLogTypeContainerInstanceLogs LogAnalyticsLogType = "ContainerInstanceLogs" +) + +func PossibleValuesForLogAnalyticsLogType() []string { + return []string{ + string(LogAnalyticsLogTypeContainerInsights), + string(LogAnalyticsLogTypeContainerInstanceLogs), + } +} + +func parseLogAnalyticsLogType(input string) (*LogAnalyticsLogType, error) { + vals := map[string]LogAnalyticsLogType{ + "containerinsights": LogAnalyticsLogTypeContainerInsights, + "containerinstancelogs": LogAnalyticsLogTypeContainerInstanceLogs, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LogAnalyticsLogType(input) + return &out, nil +} + +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +func PossibleValuesForOperatingSystemTypes() []string { + return []string{ + string(OperatingSystemTypesLinux), + string(OperatingSystemTypesWindows), + } +} + +func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) { + vals := map[string]OperatingSystemTypes{ + "linux": OperatingSystemTypesLinux, + "windows": OperatingSystemTypesWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemTypes(input) + return &out, nil +} + +type Scheme string + +const ( + SchemeHttp Scheme = "http" + SchemeHttps Scheme = "https" +) + +func PossibleValuesForScheme() []string { + return []string{ + string(SchemeHttp), + string(SchemeHttps), + } +} + +func parseScheme(input string) (*Scheme, error) { + vals := map[string]Scheme{ + "http": SchemeHttp, + "https": SchemeHttps, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Scheme(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_container.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_container.go new file mode 100644 index 00000000000..614af5e4336 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_container.go @@ -0,0 +1,137 @@ +package containerinstance + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ContainerId{} + +// ContainerId is a struct representing the Resource ID for a Container +type ContainerId struct { + SubscriptionId string + ResourceGroupName string + ContainerGroupName string + ContainerName string +} + +// NewContainerID returns a new ContainerId struct +func NewContainerID(subscriptionId string, resourceGroupName string, containerGroupName string, containerName string) ContainerId { + return ContainerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ContainerGroupName: containerGroupName, + ContainerName: containerName, + } +} + +// ParseContainerID parses 'input' into a ContainerId +func ParseContainerID(input string) (*ContainerId, error) { + parser := resourceids.NewParserFromResourceIdType(ContainerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ContainerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ContainerGroupName, ok = parsed.Parsed["containerGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'containerGroupName' was not found in the resource id %q", input) + } + + if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { + return nil, fmt.Errorf("the segment 'containerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseContainerIDInsensitively parses 'input' case-insensitively into a ContainerId +// note: this method should only be used for API response data and not user input +func ParseContainerIDInsensitively(input string) (*ContainerId, error) { + parser := resourceids.NewParserFromResourceIdType(ContainerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ContainerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ContainerGroupName, ok = parsed.Parsed["containerGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'containerGroupName' was not found in the resource id %q", input) + } + + if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { + return nil, fmt.Errorf("the segment 'containerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateContainerID checks that 'input' can be parsed as a Container ID +func ValidateContainerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseContainerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Container ID +func (id ContainerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerInstance/containerGroups/%s/containers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ContainerGroupName, id.ContainerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Container ID +func (id ContainerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftContainerInstance", "Microsoft.ContainerInstance", "Microsoft.ContainerInstance"), + resourceids.StaticSegment("staticContainerGroups", "containerGroups", "containerGroups"), + resourceids.UserSpecifiedSegment("containerGroupName", "containerGroupValue"), + resourceids.StaticSegment("staticContainers", "containers", "containers"), + resourceids.UserSpecifiedSegment("containerName", "containerValue"), + } +} + +// String returns a human-readable description of this Container ID +func (id ContainerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Container Group Name: %q", id.ContainerGroupName), + fmt.Sprintf("Container Name: %q", id.ContainerName), + } + return fmt.Sprintf("Container (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_containergroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_containergroup.go new file mode 100644 index 00000000000..75ce7b7c4e4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_containergroup.go @@ -0,0 +1,124 @@ +package containerinstance + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ContainerGroupId{} + +// ContainerGroupId is a struct representing the Resource ID for a Container Group +type ContainerGroupId struct { + SubscriptionId string + ResourceGroupName string + ContainerGroupName string +} + +// NewContainerGroupID returns a new ContainerGroupId struct +func NewContainerGroupID(subscriptionId string, resourceGroupName string, containerGroupName string) ContainerGroupId { + return ContainerGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ContainerGroupName: containerGroupName, + } +} + +// ParseContainerGroupID parses 'input' into a ContainerGroupId +func ParseContainerGroupID(input string) (*ContainerGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ContainerGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ContainerGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ContainerGroupName, ok = parsed.Parsed["containerGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'containerGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseContainerGroupIDInsensitively parses 'input' case-insensitively into a ContainerGroupId +// note: this method should only be used for API response data and not user input +func ParseContainerGroupIDInsensitively(input string) (*ContainerGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ContainerGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ContainerGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ContainerGroupName, ok = parsed.Parsed["containerGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'containerGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateContainerGroupID checks that 'input' can be parsed as a Container Group ID +func ValidateContainerGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseContainerGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Container Group ID +func (id ContainerGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerInstance/containerGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ContainerGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Container Group ID +func (id ContainerGroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftContainerInstance", "Microsoft.ContainerInstance", "Microsoft.ContainerInstance"), + resourceids.StaticSegment("staticContainerGroups", "containerGroups", "containerGroups"), + resourceids.UserSpecifiedSegment("containerGroupName", "containerGroupValue"), + } +} + +// String returns a human-readable description of this Container Group ID +func (id ContainerGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Container Group Name: %q", id.ContainerGroupName), + } + return fmt.Sprintf("Container Group (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_location.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_location.go new file mode 100644 index 00000000000..a1f453fb23f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/id_location.go @@ -0,0 +1,111 @@ +package containerinstance + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + Location string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, location string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + Location: location, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.ContainerInstance/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftContainerInstance", "Microsoft.ContainerInstance", "Microsoft.ContainerInstance"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("location", "locationValue"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location: %q", id.Location), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupscreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupscreateorupdate_autorest.go new file mode 100644 index 00000000000..801ccd09e96 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupscreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupsCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ContainerGroupsCreateOrUpdate ... +func (c ContainerInstanceClient) ContainerGroupsCreateOrUpdate(ctx context.Context, id ContainerGroupId, input ContainerGroup) (result ContainerGroupsCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForContainerGroupsCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForContainerGroupsCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ContainerGroupsCreateOrUpdateThenPoll performs ContainerGroupsCreateOrUpdate then polls until it's completed +func (c ContainerInstanceClient) ContainerGroupsCreateOrUpdateThenPoll(ctx context.Context, id ContainerGroupId, input ContainerGroup) error { + result, err := c.ContainerGroupsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ContainerGroupsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ContainerGroupsCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForContainerGroupsCreateOrUpdate prepares the ContainerGroupsCreateOrUpdate request. +func (c ContainerInstanceClient) preparerForContainerGroupsCreateOrUpdate(ctx context.Context, id ContainerGroupId, input ContainerGroup) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForContainerGroupsCreateOrUpdate sends the ContainerGroupsCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ContainerInstanceClient) senderForContainerGroupsCreateOrUpdate(ctx context.Context, req *http.Request) (future ContainerGroupsCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsdelete_autorest.go new file mode 100644 index 00000000000..7468b631f23 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsdelete_autorest.go @@ -0,0 +1,78 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupsDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ContainerGroupsDelete ... +func (c ContainerInstanceClient) ContainerGroupsDelete(ctx context.Context, id ContainerGroupId) (result ContainerGroupsDeleteOperationResponse, err error) { + req, err := c.preparerForContainerGroupsDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForContainerGroupsDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ContainerGroupsDeleteThenPoll performs ContainerGroupsDelete then polls until it's completed +func (c ContainerInstanceClient) ContainerGroupsDeleteThenPoll(ctx context.Context, id ContainerGroupId) error { + result, err := c.ContainerGroupsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing ContainerGroupsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ContainerGroupsDelete: %+v", err) + } + + return nil +} + +// preparerForContainerGroupsDelete prepares the ContainerGroupsDelete request. +func (c ContainerInstanceClient) preparerForContainerGroupsDelete(ctx context.Context, id ContainerGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForContainerGroupsDelete sends the ContainerGroupsDelete request. The method will close the +// http.Response Body if it receives an error. +func (c ContainerInstanceClient) senderForContainerGroupsDelete(ctx context.Context, req *http.Request) (future ContainerGroupsDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsget_autorest.go new file mode 100644 index 00000000000..af6ae2e37cd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsget_autorest.go @@ -0,0 +1,68 @@ +package containerinstance + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupsGetOperationResponse struct { + HttpResponse *http.Response + Model *ContainerGroup +} + +// ContainerGroupsGet ... +func (c ContainerInstanceClient) ContainerGroupsGet(ctx context.Context, id ContainerGroupId) (result ContainerGroupsGetOperationResponse, err error) { + req, err := c.preparerForContainerGroupsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainerGroupsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForContainerGroupsGet prepares the ContainerGroupsGet request. +func (c ContainerInstanceClient) preparerForContainerGroupsGet(ctx context.Context, id ContainerGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForContainerGroupsGet handles the response to the ContainerGroupsGet request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainerGroupsGet(resp *http.Response) (result ContainerGroupsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupslist_autorest.go new file mode 100644 index 00000000000..4d0113e72a0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupslist_autorest.go @@ -0,0 +1,187 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupsListOperationResponse struct { + HttpResponse *http.Response + Model *[]ContainerGroup + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ContainerGroupsListOperationResponse, error) +} + +type ContainerGroupsListCompleteResult struct { + Items []ContainerGroup +} + +func (r ContainerGroupsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ContainerGroupsListOperationResponse) LoadMore(ctx context.Context) (resp ContainerGroupsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ContainerGroupsList ... +func (c ContainerInstanceClient) ContainerGroupsList(ctx context.Context, id commonids.SubscriptionId) (resp ContainerGroupsListOperationResponse, err error) { + req, err := c.preparerForContainerGroupsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForContainerGroupsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForContainerGroupsList prepares the ContainerGroupsList request. +func (c ContainerInstanceClient) preparerForContainerGroupsList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ContainerInstance/containerGroups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForContainerGroupsListWithNextLink prepares the ContainerGroupsList request with the given nextLink token. +func (c ContainerInstanceClient) preparerForContainerGroupsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForContainerGroupsList handles the response to the ContainerGroupsList request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainerGroupsList(resp *http.Response) (result ContainerGroupsListOperationResponse, err error) { + type page struct { + Values []ContainerGroup `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ContainerGroupsListOperationResponse, err error) { + req, err := c.preparerForContainerGroupsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainerGroupsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ContainerGroupsListComplete retrieves all of the results into a single object +func (c ContainerInstanceClient) ContainerGroupsListComplete(ctx context.Context, id commonids.SubscriptionId) (ContainerGroupsListCompleteResult, error) { + return c.ContainerGroupsListCompleteMatchingPredicate(ctx, id, ContainerGroupOperationPredicate{}) +} + +// ContainerGroupsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ContainerInstanceClient) ContainerGroupsListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ContainerGroupOperationPredicate) (resp ContainerGroupsListCompleteResult, err error) { + items := make([]ContainerGroup, 0) + + page, err := c.ContainerGroupsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ContainerGroupsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupslistbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupslistbyresourcegroup_autorest.go new file mode 100644 index 00000000000..67e4b1d8b49 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupslistbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupsListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]ContainerGroup + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ContainerGroupsListByResourceGroupOperationResponse, error) +} + +type ContainerGroupsListByResourceGroupCompleteResult struct { + Items []ContainerGroup +} + +func (r ContainerGroupsListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ContainerGroupsListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ContainerGroupsListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ContainerGroupsListByResourceGroup ... +func (c ContainerInstanceClient) ContainerGroupsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ContainerGroupsListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForContainerGroupsListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForContainerGroupsListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForContainerGroupsListByResourceGroup prepares the ContainerGroupsListByResourceGroup request. +func (c ContainerInstanceClient) preparerForContainerGroupsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ContainerInstance/containerGroups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForContainerGroupsListByResourceGroupWithNextLink prepares the ContainerGroupsListByResourceGroup request with the given nextLink token. +func (c ContainerInstanceClient) preparerForContainerGroupsListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForContainerGroupsListByResourceGroup handles the response to the ContainerGroupsListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainerGroupsListByResourceGroup(resp *http.Response) (result ContainerGroupsListByResourceGroupOperationResponse, err error) { + type page struct { + Values []ContainerGroup `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ContainerGroupsListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForContainerGroupsListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainerGroupsListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ContainerGroupsListByResourceGroupComplete retrieves all of the results into a single object +func (c ContainerInstanceClient) ContainerGroupsListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ContainerGroupsListByResourceGroupCompleteResult, error) { + return c.ContainerGroupsListByResourceGroupCompleteMatchingPredicate(ctx, id, ContainerGroupOperationPredicate{}) +} + +// ContainerGroupsListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ContainerInstanceClient) ContainerGroupsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ContainerGroupOperationPredicate) (resp ContainerGroupsListByResourceGroupCompleteResult, err error) { + items := make([]ContainerGroup, 0) + + page, err := c.ContainerGroupsListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ContainerGroupsListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsrestart_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsrestart_autorest.go new file mode 100644 index 00000000000..b4792ea3d19 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsrestart_autorest.go @@ -0,0 +1,78 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupsRestartOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ContainerGroupsRestart ... +func (c ContainerInstanceClient) ContainerGroupsRestart(ctx context.Context, id ContainerGroupId) (result ContainerGroupsRestartOperationResponse, err error) { + req, err := c.preparerForContainerGroupsRestart(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsRestart", nil, "Failure preparing request") + return + } + + result, err = c.senderForContainerGroupsRestart(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsRestart", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ContainerGroupsRestartThenPoll performs ContainerGroupsRestart then polls until it's completed +func (c ContainerInstanceClient) ContainerGroupsRestartThenPoll(ctx context.Context, id ContainerGroupId) error { + result, err := c.ContainerGroupsRestart(ctx, id) + if err != nil { + return fmt.Errorf("performing ContainerGroupsRestart: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ContainerGroupsRestart: %+v", err) + } + + return nil +} + +// preparerForContainerGroupsRestart prepares the ContainerGroupsRestart request. +func (c ContainerInstanceClient) preparerForContainerGroupsRestart(ctx context.Context, id ContainerGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/restart", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForContainerGroupsRestart sends the ContainerGroupsRestart request. The method will close the +// http.Response Body if it receives an error. +func (c ContainerInstanceClient) senderForContainerGroupsRestart(ctx context.Context, req *http.Request) (future ContainerGroupsRestartOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsstart_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsstart_autorest.go new file mode 100644 index 00000000000..eb0e27e83be --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsstart_autorest.go @@ -0,0 +1,78 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupsStartOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ContainerGroupsStart ... +func (c ContainerInstanceClient) ContainerGroupsStart(ctx context.Context, id ContainerGroupId) (result ContainerGroupsStartOperationResponse, err error) { + req, err := c.preparerForContainerGroupsStart(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsStart", nil, "Failure preparing request") + return + } + + result, err = c.senderForContainerGroupsStart(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsStart", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ContainerGroupsStartThenPoll performs ContainerGroupsStart then polls until it's completed +func (c ContainerInstanceClient) ContainerGroupsStartThenPoll(ctx context.Context, id ContainerGroupId) error { + result, err := c.ContainerGroupsStart(ctx, id) + if err != nil { + return fmt.Errorf("performing ContainerGroupsStart: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ContainerGroupsStart: %+v", err) + } + + return nil +} + +// preparerForContainerGroupsStart prepares the ContainerGroupsStart request. +func (c ContainerInstanceClient) preparerForContainerGroupsStart(ctx context.Context, id ContainerGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/start", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForContainerGroupsStart sends the ContainerGroupsStart request. The method will close the +// http.Response Body if it receives an error. +func (c ContainerInstanceClient) senderForContainerGroupsStart(ctx context.Context, req *http.Request) (future ContainerGroupsStartOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsstop_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsstop_autorest.go new file mode 100644 index 00000000000..4fab0380b9b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsstop_autorest.go @@ -0,0 +1,67 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupsStopOperationResponse struct { + HttpResponse *http.Response +} + +// ContainerGroupsStop ... +func (c ContainerInstanceClient) ContainerGroupsStop(ctx context.Context, id ContainerGroupId) (result ContainerGroupsStopOperationResponse, err error) { + req, err := c.preparerForContainerGroupsStop(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsStop", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsStop", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainerGroupsStop(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsStop", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForContainerGroupsStop prepares the ContainerGroupsStop request. +func (c ContainerInstanceClient) preparerForContainerGroupsStop(ctx context.Context, id ContainerGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/stop", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForContainerGroupsStop handles the response to the ContainerGroupsStop request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainerGroupsStop(resp *http.Response) (result ContainerGroupsStopOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsupdate_autorest.go new file mode 100644 index 00000000000..9981b0f6707 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containergroupsupdate_autorest.go @@ -0,0 +1,69 @@ +package containerinstance + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupsUpdateOperationResponse struct { + HttpResponse *http.Response + Model *ContainerGroup +} + +// ContainerGroupsUpdate ... +func (c ContainerInstanceClient) ContainerGroupsUpdate(ctx context.Context, id ContainerGroupId, input Resource) (result ContainerGroupsUpdateOperationResponse, err error) { + req, err := c.preparerForContainerGroupsUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainerGroupsUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainerGroupsUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForContainerGroupsUpdate prepares the ContainerGroupsUpdate request. +func (c ContainerInstanceClient) preparerForContainerGroupsUpdate(ctx context.Context, id ContainerGroupId, input Resource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForContainerGroupsUpdate handles the response to the ContainerGroupsUpdate request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainerGroupsUpdate(resp *http.Response) (result ContainerGroupsUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containersattach_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containersattach_autorest.go new file mode 100644 index 00000000000..aff05fac327 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containersattach_autorest.go @@ -0,0 +1,69 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainersAttachOperationResponse struct { + HttpResponse *http.Response + Model *ContainerAttachResponse +} + +// ContainersAttach ... +func (c ContainerInstanceClient) ContainersAttach(ctx context.Context, id ContainerId) (result ContainersAttachOperationResponse, err error) { + req, err := c.preparerForContainersAttach(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersAttach", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersAttach", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainersAttach(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersAttach", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForContainersAttach prepares the ContainersAttach request. +func (c ContainerInstanceClient) preparerForContainersAttach(ctx context.Context, id ContainerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/attach", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForContainersAttach handles the response to the ContainersAttach request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainersAttach(resp *http.Response) (result ContainersAttachOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containersexecutecommand_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containersexecutecommand_autorest.go new file mode 100644 index 00000000000..1001f4c29b1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containersexecutecommand_autorest.go @@ -0,0 +1,70 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainersExecuteCommandOperationResponse struct { + HttpResponse *http.Response + Model *ContainerExecResponse +} + +// ContainersExecuteCommand ... +func (c ContainerInstanceClient) ContainersExecuteCommand(ctx context.Context, id ContainerId, input ContainerExecRequest) (result ContainersExecuteCommandOperationResponse, err error) { + req, err := c.preparerForContainersExecuteCommand(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersExecuteCommand", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersExecuteCommand", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainersExecuteCommand(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersExecuteCommand", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForContainersExecuteCommand prepares the ContainersExecuteCommand request. +func (c ContainerInstanceClient) preparerForContainersExecuteCommand(ctx context.Context, id ContainerId, input ContainerExecRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/exec", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForContainersExecuteCommand handles the response to the ContainersExecuteCommand request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainersExecuteCommand(resp *http.Response) (result ContainersExecuteCommandOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containerslistlogs_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containerslistlogs_autorest.go new file mode 100644 index 00000000000..ed9b55e5185 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_containerslistlogs_autorest.go @@ -0,0 +1,103 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainersListLogsOperationResponse struct { + HttpResponse *http.Response + Model *Logs +} + +type ContainersListLogsOperationOptions struct { + Tail *int64 + Timestamps *bool +} + +func DefaultContainersListLogsOperationOptions() ContainersListLogsOperationOptions { + return ContainersListLogsOperationOptions{} +} + +func (o ContainersListLogsOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ContainersListLogsOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Tail != nil { + out["tail"] = *o.Tail + } + + if o.Timestamps != nil { + out["timestamps"] = *o.Timestamps + } + + return out +} + +// ContainersListLogs ... +func (c ContainerInstanceClient) ContainersListLogs(ctx context.Context, id ContainerId, options ContainersListLogsOperationOptions) (result ContainersListLogsOperationResponse, err error) { + req, err := c.preparerForContainersListLogs(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersListLogs", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersListLogs", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForContainersListLogs(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "ContainersListLogs", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForContainersListLogs prepares the ContainersListLogs request. +func (c ContainerInstanceClient) preparerForContainersListLogs(ctx context.Context, id ContainerId, options ContainersListLogsOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/logs", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForContainersListLogs handles the response to the ContainersListLogs request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForContainersListLogs(resp *http.Response) (result ContainersListLogsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistcachedimages_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistcachedimages_autorest.go new file mode 100644 index 00000000000..612c11dc940 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistcachedimages_autorest.go @@ -0,0 +1,186 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LocationListCachedImagesOperationResponse struct { + HttpResponse *http.Response + Model *[]CachedImages + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (LocationListCachedImagesOperationResponse, error) +} + +type LocationListCachedImagesCompleteResult struct { + Items []CachedImages +} + +func (r LocationListCachedImagesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r LocationListCachedImagesOperationResponse) LoadMore(ctx context.Context) (resp LocationListCachedImagesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// LocationListCachedImages ... +func (c ContainerInstanceClient) LocationListCachedImages(ctx context.Context, id LocationId) (resp LocationListCachedImagesOperationResponse, err error) { + req, err := c.preparerForLocationListCachedImages(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCachedImages", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCachedImages", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForLocationListCachedImages(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCachedImages", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForLocationListCachedImages prepares the LocationListCachedImages request. +func (c ContainerInstanceClient) preparerForLocationListCachedImages(ctx context.Context, id LocationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/cachedImages", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForLocationListCachedImagesWithNextLink prepares the LocationListCachedImages request with the given nextLink token. +func (c ContainerInstanceClient) preparerForLocationListCachedImagesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForLocationListCachedImages handles the response to the LocationListCachedImages request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForLocationListCachedImages(resp *http.Response) (result LocationListCachedImagesOperationResponse, err error) { + type page struct { + Values []CachedImages `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result LocationListCachedImagesOperationResponse, err error) { + req, err := c.preparerForLocationListCachedImagesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCachedImages", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCachedImages", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForLocationListCachedImages(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCachedImages", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// LocationListCachedImagesComplete retrieves all of the results into a single object +func (c ContainerInstanceClient) LocationListCachedImagesComplete(ctx context.Context, id LocationId) (LocationListCachedImagesCompleteResult, error) { + return c.LocationListCachedImagesCompleteMatchingPredicate(ctx, id, CachedImagesOperationPredicate{}) +} + +// LocationListCachedImagesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ContainerInstanceClient) LocationListCachedImagesCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate CachedImagesOperationPredicate) (resp LocationListCachedImagesCompleteResult, err error) { + items := make([]CachedImages, 0) + + page, err := c.LocationListCachedImages(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := LocationListCachedImagesCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistcapabilities_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistcapabilities_autorest.go new file mode 100644 index 00000000000..473480935fe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistcapabilities_autorest.go @@ -0,0 +1,186 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LocationListCapabilitiesOperationResponse struct { + HttpResponse *http.Response + Model *[]Capabilities + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (LocationListCapabilitiesOperationResponse, error) +} + +type LocationListCapabilitiesCompleteResult struct { + Items []Capabilities +} + +func (r LocationListCapabilitiesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r LocationListCapabilitiesOperationResponse) LoadMore(ctx context.Context) (resp LocationListCapabilitiesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// LocationListCapabilities ... +func (c ContainerInstanceClient) LocationListCapabilities(ctx context.Context, id LocationId) (resp LocationListCapabilitiesOperationResponse, err error) { + req, err := c.preparerForLocationListCapabilities(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCapabilities", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCapabilities", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForLocationListCapabilities(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCapabilities", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForLocationListCapabilities prepares the LocationListCapabilities request. +func (c ContainerInstanceClient) preparerForLocationListCapabilities(ctx context.Context, id LocationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/capabilities", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForLocationListCapabilitiesWithNextLink prepares the LocationListCapabilities request with the given nextLink token. +func (c ContainerInstanceClient) preparerForLocationListCapabilitiesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForLocationListCapabilities handles the response to the LocationListCapabilities request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForLocationListCapabilities(resp *http.Response) (result LocationListCapabilitiesOperationResponse, err error) { + type page struct { + Values []Capabilities `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result LocationListCapabilitiesOperationResponse, err error) { + req, err := c.preparerForLocationListCapabilitiesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCapabilities", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCapabilities", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForLocationListCapabilities(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListCapabilities", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// LocationListCapabilitiesComplete retrieves all of the results into a single object +func (c ContainerInstanceClient) LocationListCapabilitiesComplete(ctx context.Context, id LocationId) (LocationListCapabilitiesCompleteResult, error) { + return c.LocationListCapabilitiesCompleteMatchingPredicate(ctx, id, CapabilitiesOperationPredicate{}) +} + +// LocationListCapabilitiesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ContainerInstanceClient) LocationListCapabilitiesCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate CapabilitiesOperationPredicate) (resp LocationListCapabilitiesCompleteResult, err error) { + items := make([]Capabilities, 0) + + page, err := c.LocationListCapabilities(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := LocationListCapabilitiesCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistusage_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistusage_autorest.go new file mode 100644 index 00000000000..461b96fac0c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/method_locationlistusage_autorest.go @@ -0,0 +1,69 @@ +package containerinstance + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LocationListUsageOperationResponse struct { + HttpResponse *http.Response + Model *UsageListResult +} + +// LocationListUsage ... +func (c ContainerInstanceClient) LocationListUsage(ctx context.Context, id LocationId) (result LocationListUsageOperationResponse, err error) { + req, err := c.preparerForLocationListUsage(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListUsage", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListUsage", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForLocationListUsage(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.ContainerInstanceClient", "LocationListUsage", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForLocationListUsage prepares the LocationListUsage request. +func (c ContainerInstanceClient) preparerForLocationListUsage(ctx context.Context, id LocationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/usages", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForLocationListUsage handles the response to the LocationListUsage request. The method always +// closes the http.Response Body. +func (c ContainerInstanceClient) responderForLocationListUsage(resp *http.Response) (result LocationListUsageOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_azurefilevolume.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_azurefilevolume.go new file mode 100644 index 00000000000..f884ba7abf4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_azurefilevolume.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureFileVolume struct { + ReadOnly *bool `json:"readOnly,omitempty"` + ShareName string `json:"shareName"` + StorageAccountKey *string `json:"storageAccountKey,omitempty"` + StorageAccountName string `json:"storageAccountName"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_cachedimages.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_cachedimages.go new file mode 100644 index 00000000000..35f76b32704 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_cachedimages.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CachedImages struct { + Image string `json:"image"` + OsType string `json:"osType"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_capabilities.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_capabilities.go new file mode 100644 index 00000000000..9e17f471ec3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_capabilities.go @@ -0,0 +1,13 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Capabilities struct { + Capabilities *CapabilitiesCapabilities `json:"capabilities,omitempty"` + Gpu *string `json:"gpu,omitempty"` + IPAddressType *string `json:"ipAddressType,omitempty"` + Location *string `json:"location,omitempty"` + OsType *string `json:"osType,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_capabilitiescapabilities.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_capabilitiescapabilities.go new file mode 100644 index 00000000000..257ec5ced3e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_capabilitiescapabilities.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilitiesCapabilities struct { + MaxCpu *float64 `json:"maxCpu,omitempty"` + MaxGpuCount *float64 `json:"maxGpuCount,omitempty"` + MaxMemoryInGB *float64 `json:"maxMemoryInGB,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_container.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_container.go new file mode 100644 index 00000000000..cd048b57c1e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_container.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Container struct { + Name string `json:"name"` + Properties ContainerProperties `json:"properties"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerattachresponse.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerattachresponse.go new file mode 100644 index 00000000000..5944a02f3d4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerattachresponse.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerAttachResponse struct { + Password *string `json:"password,omitempty"` + WebSocketUri *string `json:"webSocketUri,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexec.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexec.go new file mode 100644 index 00000000000..dfa94b71f19 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexec.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerExec struct { + Command *[]string `json:"command,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecrequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecrequest.go new file mode 100644 index 00000000000..078e69d0fb8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecrequest.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerExecRequest struct { + Command *string `json:"command,omitempty"` + TerminalSize *ContainerExecRequestTerminalSize `json:"terminalSize,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecrequestterminalsize.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecrequestterminalsize.go new file mode 100644 index 00000000000..40110632964 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecrequestterminalsize.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerExecRequestTerminalSize struct { + Cols *int64 `json:"cols,omitempty"` + Rows *int64 `json:"rows,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecresponse.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecresponse.go new file mode 100644 index 00000000000..61c49fda416 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerexecresponse.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerExecResponse struct { + Password *string `json:"password,omitempty"` + WebSocketUri *string `json:"webSocketUri,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroup.go new file mode 100644 index 00000000000..87017579b0c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroup.go @@ -0,0 +1,18 @@ +package containerinstance + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroup struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties ContainerGroupProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupdiagnostics.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupdiagnostics.go new file mode 100644 index 00000000000..b26d399f458 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupdiagnostics.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupDiagnostics struct { + LogAnalytics *LogAnalytics `json:"logAnalytics,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupnetworkprofile.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupnetworkprofile.go new file mode 100644 index 00000000000..dbfe19e6558 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupnetworkprofile.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupNetworkProfile struct { + Id string `json:"id"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupproperties.go new file mode 100644 index 00000000000..bc72bc2a610 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergroupproperties.go @@ -0,0 +1,21 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupProperties struct { + Containers []Container `json:"containers"` + Diagnostics *ContainerGroupDiagnostics `json:"diagnostics,omitempty"` + DnsConfig *DnsConfiguration `json:"dnsConfig,omitempty"` + EncryptionProperties *EncryptionProperties `json:"encryptionProperties,omitempty"` + IPAddress *IPAddress `json:"ipAddress,omitempty"` + ImageRegistryCredentials *[]ImageRegistryCredential `json:"imageRegistryCredentials,omitempty"` + InitContainers *[]InitContainerDefinition `json:"initContainers,omitempty"` + InstanceView *ContainerGroupPropertiesInstanceView `json:"instanceView,omitempty"` + NetworkProfile *ContainerGroupNetworkProfile `json:"networkProfile,omitempty"` + OsType OperatingSystemTypes `json:"osType"` + ProvisioningState *string `json:"provisioningState,omitempty"` + RestartPolicy *ContainerGroupRestartPolicy `json:"restartPolicy,omitempty"` + Sku *ContainerGroupSku `json:"sku,omitempty"` + Volumes *[]Volume `json:"volumes,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergrouppropertiesinstanceview.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergrouppropertiesinstanceview.go new file mode 100644 index 00000000000..6652cfdfeee --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containergrouppropertiesinstanceview.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerGroupPropertiesInstanceView struct { + Events *[]Event `json:"events,omitempty"` + State *string `json:"state,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerhttpget.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerhttpget.go new file mode 100644 index 00000000000..3ce858f1afe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerhttpget.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerHttpGet struct { + HttpHeaders *[]HttpHeader `json:"httpHeaders,omitempty"` + Path *string `json:"path,omitempty"` + Port int64 `json:"port"` + Scheme *Scheme `json:"scheme,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerport.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerport.go new file mode 100644 index 00000000000..26e3c3d6180 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerport.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerPort struct { + Port int64 `json:"port"` + Protocol *ContainerNetworkProtocol `json:"protocol,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerprobe.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerprobe.go new file mode 100644 index 00000000000..4bdf40dfe5c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerprobe.go @@ -0,0 +1,14 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerProbe struct { + Exec *ContainerExec `json:"exec,omitempty"` + FailureThreshold *int64 `json:"failureThreshold,omitempty"` + HttpGet *ContainerHttpGet `json:"httpGet,omitempty"` + InitialDelaySeconds *int64 `json:"initialDelaySeconds,omitempty"` + PeriodSeconds *int64 `json:"periodSeconds,omitempty"` + SuccessThreshold *int64 `json:"successThreshold,omitempty"` + TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerproperties.go new file mode 100644 index 00000000000..19f54823c9d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerproperties.go @@ -0,0 +1,16 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerProperties struct { + Command *[]string `json:"command,omitempty"` + EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` + Image string `json:"image"` + InstanceView *ContainerPropertiesInstanceView `json:"instanceView,omitempty"` + LivenessProbe *ContainerProbe `json:"livenessProbe,omitempty"` + Ports *[]ContainerPort `json:"ports,omitempty"` + ReadinessProbe *ContainerProbe `json:"readinessProbe,omitempty"` + Resources ResourceRequirements `json:"resources"` + VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerpropertiesinstanceview.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerpropertiesinstanceview.go new file mode 100644 index 00000000000..347af45a182 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerpropertiesinstanceview.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerPropertiesInstanceView struct { + CurrentState *ContainerState `json:"currentState,omitempty"` + Events *[]Event `json:"events,omitempty"` + PreviousState *ContainerState `json:"previousState,omitempty"` + RestartCount *int64 `json:"restartCount,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerstate.go new file mode 100644 index 00000000000..b75c2eee165 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_containerstate.go @@ -0,0 +1,42 @@ +package containerinstance + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ContainerState struct { + DetailStatus *string `json:"detailStatus,omitempty"` + ExitCode *int64 `json:"exitCode,omitempty"` + FinishTime *string `json:"finishTime,omitempty"` + StartTime *string `json:"startTime,omitempty"` + State *string `json:"state,omitempty"` +} + +func (o *ContainerState) GetFinishTimeAsTime() (*time.Time, error) { + if o.FinishTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.FinishTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ContainerState) SetFinishTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.FinishTime = &formatted +} + +func (o *ContainerState) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ContainerState) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_dnsconfiguration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_dnsconfiguration.go new file mode 100644 index 00000000000..08581fd75d3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_dnsconfiguration.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsConfiguration struct { + NameServers []string `json:"nameServers"` + Options *string `json:"options,omitempty"` + SearchDomains *string `json:"searchDomains,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_encryptionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_encryptionproperties.go new file mode 100644 index 00000000000..d0aeecbc61e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_encryptionproperties.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionProperties struct { + KeyName string `json:"keyName"` + KeyVersion string `json:"keyVersion"` + VaultBaseUrl string `json:"vaultBaseUrl"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_environmentvariable.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_environmentvariable.go new file mode 100644 index 00000000000..2184f90aa06 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_environmentvariable.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnvironmentVariable struct { + Name string `json:"name"` + SecureValue *string `json:"secureValue,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_event.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_event.go new file mode 100644 index 00000000000..a66aa6de014 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_event.go @@ -0,0 +1,43 @@ +package containerinstance + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Event struct { + Count *int64 `json:"count,omitempty"` + FirstTimestamp *string `json:"firstTimestamp,omitempty"` + LastTimestamp *string `json:"lastTimestamp,omitempty"` + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +func (o *Event) GetFirstTimestampAsTime() (*time.Time, error) { + if o.FirstTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.FirstTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *Event) SetFirstTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.FirstTimestamp = &formatted +} + +func (o *Event) GetLastTimestampAsTime() (*time.Time, error) { + if o.LastTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *Event) SetLastTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastTimestamp = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_gitrepovolume.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_gitrepovolume.go new file mode 100644 index 00000000000..fe91482b097 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_gitrepovolume.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GitRepoVolume struct { + Directory *string `json:"directory,omitempty"` + Repository string `json:"repository"` + Revision *string `json:"revision,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_gpuresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_gpuresource.go new file mode 100644 index 00000000000..eb389f05ae8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_gpuresource.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GpuResource struct { + Count int64 `json:"count"` + Sku GpuSku `json:"sku"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_httpheader.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_httpheader.go new file mode 100644 index 00000000000..b4825abbeea --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_httpheader.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HttpHeader struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_imageregistrycredential.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_imageregistrycredential.go new file mode 100644 index 00000000000..3bc3e568c9f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_imageregistrycredential.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageRegistryCredential struct { + Password *string `json:"password,omitempty"` + Server string `json:"server"` + Username string `json:"username"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerdefinition.go new file mode 100644 index 00000000000..01211fb4a02 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerdefinition.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InitContainerDefinition struct { + Name string `json:"name"` + Properties InitContainerPropertiesDefinition `json:"properties"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerpropertiesdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerpropertiesdefinition.go new file mode 100644 index 00000000000..301fd4ebd30 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerpropertiesdefinition.go @@ -0,0 +1,12 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InitContainerPropertiesDefinition struct { + Command *[]string `json:"command,omitempty"` + EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` + Image *string `json:"image,omitempty"` + InstanceView *InitContainerPropertiesDefinitionInstanceView `json:"instanceView,omitempty"` + VolumeMounts *[]VolumeMount `json:"volumeMounts,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerpropertiesdefinitioninstanceview.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerpropertiesdefinitioninstanceview.go new file mode 100644 index 00000000000..fd71b6bc7a1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_initcontainerpropertiesdefinitioninstanceview.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InitContainerPropertiesDefinitionInstanceView struct { + CurrentState *ContainerState `json:"currentState,omitempty"` + Events *[]Event `json:"events,omitempty"` + PreviousState *ContainerState `json:"previousState,omitempty"` + RestartCount *int64 `json:"restartCount,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_ipaddress.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_ipaddress.go new file mode 100644 index 00000000000..79052eb3897 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_ipaddress.go @@ -0,0 +1,12 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IPAddress struct { + DnsNameLabel *string `json:"dnsNameLabel,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` + IP *string `json:"ip,omitempty"` + Ports []Port `json:"ports"` + Type ContainerGroupIPAddressType `json:"type"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_loganalytics.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_loganalytics.go new file mode 100644 index 00000000000..df8644c0e3f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_loganalytics.go @@ -0,0 +1,12 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogAnalytics struct { + LogType *LogAnalyticsLogType `json:"logType,omitempty"` + Metadata *map[string]string `json:"metadata,omitempty"` + WorkspaceId string `json:"workspaceId"` + WorkspaceKey string `json:"workspaceKey"` + WorkspaceResourceId *map[string]string `json:"workspaceResourceId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_logs.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_logs.go new file mode 100644 index 00000000000..7e4dbc04938 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_logs.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Logs struct { + Content *string `json:"content,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_port.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_port.go new file mode 100644 index 00000000000..e3a87272de3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_port.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Port struct { + Port int64 `json:"port"` + Protocol *ContainerGroupNetworkProtocol `json:"protocol,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resource.go new file mode 100644 index 00000000000..d9db6f7f3e6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resource.go @@ -0,0 +1,12 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Resource struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcelimits.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcelimits.go new file mode 100644 index 00000000000..8a2f7fc441d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcelimits.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceLimits struct { + Cpu *float64 `json:"cpu,omitempty"` + Gpu *GpuResource `json:"gpu,omitempty"` + MemoryInGB *float64 `json:"memoryInGB,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcerequests.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcerequests.go new file mode 100644 index 00000000000..e17a7bf905e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcerequests.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceRequests struct { + Cpu float64 `json:"cpu"` + Gpu *GpuResource `json:"gpu,omitempty"` + MemoryInGB float64 `json:"memoryInGB"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcerequirements.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcerequirements.go new file mode 100644 index 00000000000..cdc6bfd4aaf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_resourcerequirements.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceRequirements struct { + Limits *ResourceLimits `json:"limits,omitempty"` + Requests ResourceRequests `json:"requests"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usage.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usage.go new file mode 100644 index 00000000000..2c30a75dee3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usage.go @@ -0,0 +1,11 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Usage struct { + CurrentValue *int64 `json:"currentValue,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Name *UsageName `json:"name,omitempty"` + Unit *string `json:"unit,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usagelistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usagelistresult.go new file mode 100644 index 00000000000..a473f08b4e7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usagelistresult.go @@ -0,0 +1,8 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UsageListResult struct { + Value *[]Usage `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usagename.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usagename.go new file mode 100644 index 00000000000..eba1c36c68b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_usagename.go @@ -0,0 +1,9 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UsageName struct { + LocalizedValue *string `json:"localizedValue,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_volume.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_volume.go new file mode 100644 index 00000000000..ea997d3e01f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_volume.go @@ -0,0 +1,12 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Volume struct { + AzureFile *AzureFileVolume `json:"azureFile,omitempty"` + EmptyDir *interface{} `json:"emptyDir,omitempty"` + GitRepo *GitRepoVolume `json:"gitRepo,omitempty"` + Name string `json:"name"` + Secret *map[string]string `json:"secret,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_volumemount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_volumemount.go new file mode 100644 index 00000000000..71d7148c1bf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/model_volumemount.go @@ -0,0 +1,10 @@ +package containerinstance + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumeMount struct { + MountPath string `json:"mountPath"` + Name string `json:"name"` + ReadOnly *bool `json:"readOnly,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/predicates.go new file mode 100644 index 00000000000..81fc669859b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/predicates.go @@ -0,0 +1,80 @@ +package containerinstance + +type CachedImagesOperationPredicate struct { + Image *string + OsType *string +} + +func (p CachedImagesOperationPredicate) Matches(input CachedImages) bool { + + if p.Image != nil && *p.Image != input.Image { + return false + } + + if p.OsType != nil && *p.OsType != input.OsType { + return false + } + + return true +} + +type CapabilitiesOperationPredicate struct { + Gpu *string + IPAddressType *string + Location *string + OsType *string + ResourceType *string +} + +func (p CapabilitiesOperationPredicate) Matches(input Capabilities) bool { + + if p.Gpu != nil && (input.Gpu == nil && *p.Gpu != *input.Gpu) { + return false + } + + if p.IPAddressType != nil && (input.IPAddressType == nil && *p.IPAddressType != *input.IPAddressType) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.OsType != nil && (input.OsType == nil && *p.OsType != *input.OsType) { + return false + } + + if p.ResourceType != nil && (input.ResourceType == nil && *p.ResourceType != *input.ResourceType) { + return false + } + + return true +} + +type ContainerGroupOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ContainerGroupOperationPredicate) Matches(input ContainerGroup) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/version.go new file mode 100644 index 00000000000..1f296067049 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance/version.go @@ -0,0 +1,12 @@ +package containerinstance + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-03-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/containerinstance/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/README.md new file mode 100644 index 00000000000..fa0670fe30c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/README.md @@ -0,0 +1,121 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports` Documentation + +The `exports` SDK allows for interaction with the Azure Resource Manager Service `costmanagement` (API Version `2021-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports" +``` + + +### Client Initialization + +```go +client := exports.NewExportsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ExportsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := exports.NewScopedExportID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "exportValue") + +payload := exports.Export{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ExportsClient.Delete` + +```go +ctx := context.TODO() +id := exports.NewScopedExportID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "exportValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ExportsClient.Execute` + +```go +ctx := context.TODO() +id := exports.NewScopedExportID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "exportValue") + +read, err := client.Execute(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ExportsClient.Get` + +```go +ctx := context.TODO() +id := exports.NewScopedExportID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "exportValue") + +read, err := client.Get(ctx, id, exports.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ExportsClient.GetExecutionHistory` + +```go +ctx := context.TODO() +id := exports.NewScopedExportID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "exportValue") + +read, err := client.GetExecutionHistory(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ExportsClient.List` + +```go +ctx := context.TODO() +id := exports.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +read, err := client.List(ctx, id, exports.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/client.go new file mode 100644 index 00000000000..512e25c313c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/client.go @@ -0,0 +1,18 @@ +package exports + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportsClient struct { + Client autorest.Client + baseUri string +} + +func NewExportsClientWithBaseURI(endpoint string) ExportsClient { + return ExportsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/constants.go new file mode 100644 index 00000000000..98fefa2ae1d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/constants.go @@ -0,0 +1,260 @@ +package exports + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExecutionStatus string + +const ( + ExecutionStatusCompleted ExecutionStatus = "Completed" + ExecutionStatusDataNotAvailable ExecutionStatus = "DataNotAvailable" + ExecutionStatusFailed ExecutionStatus = "Failed" + ExecutionStatusInProgress ExecutionStatus = "InProgress" + ExecutionStatusNewDataNotAvailable ExecutionStatus = "NewDataNotAvailable" + ExecutionStatusQueued ExecutionStatus = "Queued" + ExecutionStatusTimeout ExecutionStatus = "Timeout" +) + +func PossibleValuesForExecutionStatus() []string { + return []string{ + string(ExecutionStatusCompleted), + string(ExecutionStatusDataNotAvailable), + string(ExecutionStatusFailed), + string(ExecutionStatusInProgress), + string(ExecutionStatusNewDataNotAvailable), + string(ExecutionStatusQueued), + string(ExecutionStatusTimeout), + } +} + +func parseExecutionStatus(input string) (*ExecutionStatus, error) { + vals := map[string]ExecutionStatus{ + "completed": ExecutionStatusCompleted, + "datanotavailable": ExecutionStatusDataNotAvailable, + "failed": ExecutionStatusFailed, + "inprogress": ExecutionStatusInProgress, + "newdatanotavailable": ExecutionStatusNewDataNotAvailable, + "queued": ExecutionStatusQueued, + "timeout": ExecutionStatusTimeout, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExecutionStatus(input) + return &out, nil +} + +type ExecutionType string + +const ( + ExecutionTypeOnDemand ExecutionType = "OnDemand" + ExecutionTypeScheduled ExecutionType = "Scheduled" +) + +func PossibleValuesForExecutionType() []string { + return []string{ + string(ExecutionTypeOnDemand), + string(ExecutionTypeScheduled), + } +} + +func parseExecutionType(input string) (*ExecutionType, error) { + vals := map[string]ExecutionType{ + "ondemand": ExecutionTypeOnDemand, + "scheduled": ExecutionTypeScheduled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExecutionType(input) + return &out, nil +} + +type ExportType string + +const ( + ExportTypeActualCost ExportType = "ActualCost" + ExportTypeAmortizedCost ExportType = "AmortizedCost" + ExportTypeUsage ExportType = "Usage" +) + +func PossibleValuesForExportType() []string { + return []string{ + string(ExportTypeActualCost), + string(ExportTypeAmortizedCost), + string(ExportTypeUsage), + } +} + +func parseExportType(input string) (*ExportType, error) { + vals := map[string]ExportType{ + "actualcost": ExportTypeActualCost, + "amortizedcost": ExportTypeAmortizedCost, + "usage": ExportTypeUsage, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExportType(input) + return &out, nil +} + +type FormatType string + +const ( + FormatTypeCsv FormatType = "Csv" +) + +func PossibleValuesForFormatType() []string { + return []string{ + string(FormatTypeCsv), + } +} + +func parseFormatType(input string) (*FormatType, error) { + vals := map[string]FormatType{ + "csv": FormatTypeCsv, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FormatType(input) + return &out, nil +} + +type GranularityType string + +const ( + GranularityTypeDaily GranularityType = "Daily" +) + +func PossibleValuesForGranularityType() []string { + return []string{ + string(GranularityTypeDaily), + } +} + +func parseGranularityType(input string) (*GranularityType, error) { + vals := map[string]GranularityType{ + "daily": GranularityTypeDaily, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GranularityType(input) + return &out, nil +} + +type RecurrenceType string + +const ( + RecurrenceTypeAnnually RecurrenceType = "Annually" + RecurrenceTypeDaily RecurrenceType = "Daily" + RecurrenceTypeMonthly RecurrenceType = "Monthly" + RecurrenceTypeWeekly RecurrenceType = "Weekly" +) + +func PossibleValuesForRecurrenceType() []string { + return []string{ + string(RecurrenceTypeAnnually), + string(RecurrenceTypeDaily), + string(RecurrenceTypeMonthly), + string(RecurrenceTypeWeekly), + } +} + +func parseRecurrenceType(input string) (*RecurrenceType, error) { + vals := map[string]RecurrenceType{ + "annually": RecurrenceTypeAnnually, + "daily": RecurrenceTypeDaily, + "monthly": RecurrenceTypeMonthly, + "weekly": RecurrenceTypeWeekly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RecurrenceType(input) + return &out, nil +} + +type StatusType string + +const ( + StatusTypeActive StatusType = "Active" + StatusTypeInactive StatusType = "Inactive" +) + +func PossibleValuesForStatusType() []string { + return []string{ + string(StatusTypeActive), + string(StatusTypeInactive), + } +} + +func parseStatusType(input string) (*StatusType, error) { + vals := map[string]StatusType{ + "active": StatusTypeActive, + "inactive": StatusTypeInactive, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusType(input) + return &out, nil +} + +type TimeframeType string + +const ( + TimeframeTypeBillingMonthToDate TimeframeType = "BillingMonthToDate" + TimeframeTypeCustom TimeframeType = "Custom" + TimeframeTypeMonthToDate TimeframeType = "MonthToDate" + TimeframeTypeTheLastBillingMonth TimeframeType = "TheLastBillingMonth" + TimeframeTypeTheLastMonth TimeframeType = "TheLastMonth" + TimeframeTypeWeekToDate TimeframeType = "WeekToDate" +) + +func PossibleValuesForTimeframeType() []string { + return []string{ + string(TimeframeTypeBillingMonthToDate), + string(TimeframeTypeCustom), + string(TimeframeTypeMonthToDate), + string(TimeframeTypeTheLastBillingMonth), + string(TimeframeTypeTheLastMonth), + string(TimeframeTypeWeekToDate), + } +} + +func parseTimeframeType(input string) (*TimeframeType, error) { + vals := map[string]TimeframeType{ + "billingmonthtodate": TimeframeTypeBillingMonthToDate, + "custom": TimeframeTypeCustom, + "monthtodate": TimeframeTypeMonthToDate, + "thelastbillingmonth": TimeframeTypeTheLastBillingMonth, + "thelastmonth": TimeframeTypeTheLastMonth, + "weektodate": TimeframeTypeWeekToDate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TimeframeType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/id_scopedexport.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/id_scopedexport.go new file mode 100644 index 00000000000..6c5f4a1dfb0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/id_scopedexport.go @@ -0,0 +1,110 @@ +package exports + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ScopedExportId{} + +// ScopedExportId is a struct representing the Resource ID for a Scoped Export +type ScopedExportId struct { + Scope string + ExportName string +} + +// NewScopedExportID returns a new ScopedExportId struct +func NewScopedExportID(scope string, exportName string) ScopedExportId { + return ScopedExportId{ + Scope: scope, + ExportName: exportName, + } +} + +// ParseScopedExportID parses 'input' into a ScopedExportId +func ParseScopedExportID(input string) (*ScopedExportId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedExportId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopedExportId{} + + if id.Scope, ok = parsed.Parsed["scope"]; !ok { + return nil, fmt.Errorf("the segment 'scope' was not found in the resource id %q", input) + } + + if id.ExportName, ok = parsed.Parsed["exportName"]; !ok { + return nil, fmt.Errorf("the segment 'exportName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseScopedExportIDInsensitively parses 'input' case-insensitively into a ScopedExportId +// note: this method should only be used for API response data and not user input +func ParseScopedExportIDInsensitively(input string) (*ScopedExportId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedExportId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopedExportId{} + + if id.Scope, ok = parsed.Parsed["scope"]; !ok { + return nil, fmt.Errorf("the segment 'scope' was not found in the resource id %q", input) + } + + if id.ExportName, ok = parsed.Parsed["exportName"]; !ok { + return nil, fmt.Errorf("the segment 'exportName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateScopedExportID checks that 'input' can be parsed as a Scoped Export ID +func ValidateScopedExportID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseScopedExportID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scoped Export ID +func (id ScopedExportId) ID() string { + fmtString := "/%s/providers/Microsoft.CostManagement/exports/%s" + return fmt.Sprintf(fmtString, strings.TrimPrefix(id.Scope, "/"), id.ExportName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scoped Export ID +func (id ScopedExportId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.ScopeSegment("scope", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCostManagement", "Microsoft.CostManagement", "Microsoft.CostManagement"), + resourceids.StaticSegment("staticExports", "exports", "exports"), + resourceids.UserSpecifiedSegment("exportName", "exportValue"), + } +} + +// String returns a human-readable description of this Scoped Export ID +func (id ScopedExportId) String() string { + components := []string{ + fmt.Sprintf("Scope: %q", id.Scope), + fmt.Sprintf("Export Name: %q", id.ExportName), + } + return fmt.Sprintf("Scoped Export (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_createorupdate_autorest.go new file mode 100644 index 00000000000..86eb1416ecd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package exports + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Export +} + +// CreateOrUpdate ... +func (c ExportsClient) CreateOrUpdate(ctx context.Context, id ScopedExportId, input Export) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ExportsClient) preparerForCreateOrUpdate(ctx context.Context, id ScopedExportId, input Export) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ExportsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_delete_autorest.go new file mode 100644 index 00000000000..60ee5b3426b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_delete_autorest.go @@ -0,0 +1,66 @@ +package exports + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ExportsClient) Delete(ctx context.Context, id ScopedExportId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ExportsClient) preparerForDelete(ctx context.Context, id ScopedExportId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ExportsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_execute_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_execute_autorest.go new file mode 100644 index 00000000000..4468e0c911d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_execute_autorest.go @@ -0,0 +1,67 @@ +package exports + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExecuteOperationResponse struct { + HttpResponse *http.Response +} + +// Execute ... +func (c ExportsClient) Execute(ctx context.Context, id ScopedExportId) (result ExecuteOperationResponse, err error) { + req, err := c.preparerForExecute(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "Execute", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "Execute", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForExecute(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "Execute", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForExecute prepares the Execute request. +func (c ExportsClient) preparerForExecute(ctx context.Context, id ScopedExportId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/run", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForExecute handles the response to the Execute request. The method always +// closes the http.Response Body. +func (c ExportsClient) responderForExecute(resp *http.Response) (result ExecuteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_get_autorest.go new file mode 100644 index 00000000000..a65445b22a7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_get_autorest.go @@ -0,0 +1,97 @@ +package exports + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Export +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// Get ... +func (c ExportsClient) Get(ctx context.Context, id ScopedExportId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ExportsClient) preparerForGet(ctx context.Context, id ScopedExportId, options GetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ExportsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_getexecutionhistory_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_getexecutionhistory_autorest.go new file mode 100644 index 00000000000..bfb71da0ce8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_getexecutionhistory_autorest.go @@ -0,0 +1,69 @@ +package exports + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetExecutionHistoryOperationResponse struct { + HttpResponse *http.Response + Model *ExportExecutionListResult +} + +// GetExecutionHistory ... +func (c ExportsClient) GetExecutionHistory(ctx context.Context, id ScopedExportId) (result GetExecutionHistoryOperationResponse, err error) { + req, err := c.preparerForGetExecutionHistory(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "GetExecutionHistory", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "GetExecutionHistory", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetExecutionHistory(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "GetExecutionHistory", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetExecutionHistory prepares the GetExecutionHistory request. +func (c ExportsClient) preparerForGetExecutionHistory(ctx context.Context, id ScopedExportId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/runHistory", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetExecutionHistory handles the response to the GetExecutionHistory request. The method always +// closes the http.Response Body. +func (c ExportsClient) responderForGetExecutionHistory(resp *http.Response) (result GetExecutionHistoryOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_list_autorest.go new file mode 100644 index 00000000000..d9b422de4fc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/method_list_autorest.go @@ -0,0 +1,99 @@ +package exports + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *ExportListResult +} + +type ListOperationOptions struct { + Expand *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// List ... +func (c ExportsClient) List(ctx context.Context, id commonids.ScopeId, options ListOperationOptions) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "exports.ExportsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c ExportsClient) preparerForList(ctx context.Context, id commonids.ScopeId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.CostManagement/exports", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ExportsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_commonexportproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_commonexportproperties.go new file mode 100644 index 00000000000..814103b70a7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_commonexportproperties.go @@ -0,0 +1,31 @@ +package exports + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CommonExportProperties struct { + Definition ExportDefinition `json:"definition"` + DeliveryInfo ExportDeliveryInfo `json:"deliveryInfo"` + Format *FormatType `json:"format,omitempty"` + NextRunTimeEstimate *string `json:"nextRunTimeEstimate,omitempty"` + PartitionData *bool `json:"partitionData,omitempty"` + RunHistory *ExportExecutionListResult `json:"runHistory,omitempty"` +} + +func (o *CommonExportProperties) GetNextRunTimeEstimateAsTime() (*time.Time, error) { + if o.NextRunTimeEstimate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NextRunTimeEstimate, "2006-01-02T15:04:05Z07:00") +} + +func (o *CommonExportProperties) SetNextRunTimeEstimateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NextRunTimeEstimate = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_errordetails.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_errordetails.go new file mode 100644 index 00000000000..def5fc753e1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_errordetails.go @@ -0,0 +1,9 @@ +package exports + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorDetails struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_export.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_export.go new file mode 100644 index 00000000000..ea296361983 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_export.go @@ -0,0 +1,12 @@ +package exports + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Export struct { + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ExportProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportdataset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportdataset.go new file mode 100644 index 00000000000..c4a8d5acdf8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportdataset.go @@ -0,0 +1,9 @@ +package exports + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportDataset struct { + Configuration *ExportDatasetConfiguration `json:"configuration,omitempty"` + Granularity *GranularityType `json:"granularity,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportdatasetconfiguration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportdatasetconfiguration.go new file mode 100644 index 00000000000..9acc4e43e92 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportdatasetconfiguration.go @@ -0,0 +1,8 @@ +package exports + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportDatasetConfiguration struct { + Columns *[]string `json:"columns,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportdefinition.go new file mode 100644 index 00000000000..d128ed638e6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportdefinition.go @@ -0,0 +1,11 @@ +package exports + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportDefinition struct { + DataSet *ExportDataset `json:"dataSet,omitempty"` + TimePeriod *ExportTimePeriod `json:"timePeriod,omitempty"` + Timeframe TimeframeType `json:"timeframe"` + Type ExportType `json:"type"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportdeliverydestination.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportdeliverydestination.go new file mode 100644 index 00000000000..56cff46854a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportdeliverydestination.go @@ -0,0 +1,12 @@ +package exports + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportDeliveryDestination struct { + Container string `json:"container"` + ResourceId *string `json:"resourceId,omitempty"` + RootFolderPath *string `json:"rootFolderPath,omitempty"` + SasToken *string `json:"sasToken,omitempty"` + StorageAccount *string `json:"storageAccount,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportdeliveryinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportdeliveryinfo.go new file mode 100644 index 00000000000..204ca440e9f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportdeliveryinfo.go @@ -0,0 +1,8 @@ +package exports + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportDeliveryInfo struct { + Destination ExportDeliveryDestination `json:"destination"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportexecution.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportexecution.go new file mode 100644 index 00000000000..5cddc2df1e6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportexecution.go @@ -0,0 +1,12 @@ +package exports + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportExecution struct { + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ExportExecutionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportexecutionlistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportexecutionlistresult.go new file mode 100644 index 00000000000..a07b784ea30 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportexecutionlistresult.go @@ -0,0 +1,8 @@ +package exports + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportExecutionListResult struct { + Value *[]ExportExecution `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportexecutionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportexecutionproperties.go new file mode 100644 index 00000000000..c29e900fc3d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportexecutionproperties.go @@ -0,0 +1,58 @@ +package exports + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportExecutionProperties struct { + Error *ErrorDetails `json:"error,omitempty"` + ExecutionType *ExecutionType `json:"executionType,omitempty"` + FileName *string `json:"fileName,omitempty"` + ProcessingEndTime *string `json:"processingEndTime,omitempty"` + ProcessingStartTime *string `json:"processingStartTime,omitempty"` + RunSettings *CommonExportProperties `json:"runSettings,omitempty"` + Status *ExecutionStatus `json:"status,omitempty"` + SubmittedBy *string `json:"submittedBy,omitempty"` + SubmittedTime *string `json:"submittedTime,omitempty"` +} + +func (o *ExportExecutionProperties) GetProcessingEndTimeAsTime() (*time.Time, error) { + if o.ProcessingEndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ProcessingEndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExportExecutionProperties) SetProcessingEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ProcessingEndTime = &formatted +} + +func (o *ExportExecutionProperties) GetProcessingStartTimeAsTime() (*time.Time, error) { + if o.ProcessingStartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ProcessingStartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExportExecutionProperties) SetProcessingStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ProcessingStartTime = &formatted +} + +func (o *ExportExecutionProperties) GetSubmittedTimeAsTime() (*time.Time, error) { + if o.SubmittedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.SubmittedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExportExecutionProperties) SetSubmittedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.SubmittedTime = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportlistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportlistresult.go new file mode 100644 index 00000000000..6e50ebcc283 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportlistresult.go @@ -0,0 +1,8 @@ +package exports + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportListResult struct { + Value *[]Export `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportproperties.go new file mode 100644 index 00000000000..13dbc84cd87 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportproperties.go @@ -0,0 +1,32 @@ +package exports + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportProperties struct { + Definition ExportDefinition `json:"definition"` + DeliveryInfo ExportDeliveryInfo `json:"deliveryInfo"` + Format *FormatType `json:"format,omitempty"` + NextRunTimeEstimate *string `json:"nextRunTimeEstimate,omitempty"` + PartitionData *bool `json:"partitionData,omitempty"` + RunHistory *ExportExecutionListResult `json:"runHistory,omitempty"` + Schedule *ExportSchedule `json:"schedule,omitempty"` +} + +func (o *ExportProperties) GetNextRunTimeEstimateAsTime() (*time.Time, error) { + if o.NextRunTimeEstimate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NextRunTimeEstimate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExportProperties) SetNextRunTimeEstimateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NextRunTimeEstimate = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportrecurrenceperiod.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportrecurrenceperiod.go new file mode 100644 index 00000000000..b78c9ceddfe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportrecurrenceperiod.go @@ -0,0 +1,36 @@ +package exports + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportRecurrencePeriod struct { + From string `json:"from"` + To *string `json:"to,omitempty"` +} + +func (o *ExportRecurrencePeriod) GetFromAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.From, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExportRecurrencePeriod) SetFromAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.From = formatted +} + +func (o *ExportRecurrencePeriod) GetToAsTime() (*time.Time, error) { + if o.To == nil { + return nil, nil + } + return dates.ParseAsFormat(o.To, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExportRecurrencePeriod) SetToAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.To = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportschedule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportschedule.go new file mode 100644 index 00000000000..d9a1f5757c7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exportschedule.go @@ -0,0 +1,10 @@ +package exports + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportSchedule struct { + Recurrence *RecurrenceType `json:"recurrence,omitempty"` + RecurrencePeriod *ExportRecurrencePeriod `json:"recurrencePeriod,omitempty"` + Status *StatusType `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exporttimeperiod.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exporttimeperiod.go new file mode 100644 index 00000000000..82751bd3d6a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/model_exporttimeperiod.go @@ -0,0 +1,33 @@ +package exports + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportTimePeriod struct { + From string `json:"from"` + To string `json:"to"` +} + +func (o *ExportTimePeriod) GetFromAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.From, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExportTimePeriod) SetFromAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.From = formatted +} + +func (o *ExportTimePeriod) GetToAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.To, "2006-01-02T15:04:05Z07:00") +} + +func (o *ExportTimePeriod) SetToAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.To = formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/version.go new file mode 100644 index 00000000000..96be6d93da3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports/version.go @@ -0,0 +1,12 @@ +package exports + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/exports/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/README.md new file mode 100644 index 00000000000..b0f1e563ce3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces` Documentation + +The `workspaces` SDK allows for interaction with the Azure Resource Manager Service `databricks` (API Version `2021-04-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces" +``` + + +### Client Initialization + +```go +client := workspaces.NewWorkspacesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `WorkspacesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +payload := workspaces.Workspace{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `WorkspacesClient.Delete` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `WorkspacesClient.Get` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := workspaces.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WorkspacesClient.ListBySubscription` + +```go +ctx := context.TODO() +id := workspaces.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WorkspacesClient.Update` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +payload := workspaces.WorkspaceUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/client.go new file mode 100644 index 00000000000..02d022fa85e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/client.go @@ -0,0 +1,18 @@ +package workspaces + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacesClient struct { + Client autorest.Client + baseUri string +} + +func NewWorkspacesClientWithBaseURI(endpoint string) WorkspacesClient { + return WorkspacesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/constants.go new file mode 100644 index 00000000000..130ad6fbf3d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/constants.go @@ -0,0 +1,275 @@ +package workspaces + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomParameterType string + +const ( + CustomParameterTypeBool CustomParameterType = "Bool" + CustomParameterTypeObject CustomParameterType = "Object" + CustomParameterTypeString CustomParameterType = "String" +) + +func PossibleValuesForCustomParameterType() []string { + return []string{ + string(CustomParameterTypeBool), + string(CustomParameterTypeObject), + string(CustomParameterTypeString), + } +} + +func parseCustomParameterType(input string) (*CustomParameterType, error) { + vals := map[string]CustomParameterType{ + "bool": CustomParameterTypeBool, + "object": CustomParameterTypeObject, + "string": CustomParameterTypeString, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CustomParameterType(input) + return &out, nil +} + +type EncryptionKeySource string + +const ( + EncryptionKeySourceMicrosoftPointKeyvault EncryptionKeySource = "Microsoft.Keyvault" +) + +func PossibleValuesForEncryptionKeySource() []string { + return []string{ + string(EncryptionKeySourceMicrosoftPointKeyvault), + } +} + +func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { + vals := map[string]EncryptionKeySource{ + "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyvault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EncryptionKeySource(input) + return &out, nil +} + +type KeySource string + +const ( + KeySourceDefault KeySource = "Default" + KeySourceMicrosoftPointKeyvault KeySource = "Microsoft.Keyvault" +) + +func PossibleValuesForKeySource() []string { + return []string{ + string(KeySourceDefault), + string(KeySourceMicrosoftPointKeyvault), + } +} + +func parseKeySource(input string) (*KeySource, error) { + vals := map[string]KeySource{ + "default": KeySourceDefault, + "microsoft.keyvault": KeySourceMicrosoftPointKeyvault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeySource(input) + return &out, nil +} + +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" + PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + string(PrivateEndpointConnectionProvisioningStateUpdating), + } +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + "updating": PrivateEndpointConnectionProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStatus string + +const ( + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkServiceConnectionStatus() []string { + return []string{ + string(PrivateLinkServiceConnectionStatusApproved), + string(PrivateLinkServiceConnectionStatusDisconnected), + string(PrivateLinkServiceConnectionStatusPending), + string(PrivateLinkServiceConnectionStatusRejected), + } +} + +func parsePrivateLinkServiceConnectionStatus(input string) (*PrivateLinkServiceConnectionStatus, error) { + vals := map[string]PrivateLinkServiceConnectionStatus{ + "approved": PrivateLinkServiceConnectionStatusApproved, + "disconnected": PrivateLinkServiceConnectionStatusDisconnected, + "pending": PrivateLinkServiceConnectionStatusPending, + "rejected": PrivateLinkServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateReady ProvisioningState = "Ready" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateReady), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "created": ProvisioningStateCreated, + "creating": ProvisioningStateCreating, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "ready": ProvisioningStateReady, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} + +type RequiredNsgRules string + +const ( + RequiredNsgRulesAllRules RequiredNsgRules = "AllRules" + RequiredNsgRulesNoAzureDatabricksRules RequiredNsgRules = "NoAzureDatabricksRules" + RequiredNsgRulesNoAzureServiceRules RequiredNsgRules = "NoAzureServiceRules" +) + +func PossibleValuesForRequiredNsgRules() []string { + return []string{ + string(RequiredNsgRulesAllRules), + string(RequiredNsgRulesNoAzureDatabricksRules), + string(RequiredNsgRulesNoAzureServiceRules), + } +} + +func parseRequiredNsgRules(input string) (*RequiredNsgRules, error) { + vals := map[string]RequiredNsgRules{ + "allrules": RequiredNsgRulesAllRules, + "noazuredatabricksrules": RequiredNsgRulesNoAzureDatabricksRules, + "noazureservicerules": RequiredNsgRulesNoAzureServiceRules, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RequiredNsgRules(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/id_workspace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/id_workspace.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/id_workspace.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/id_workspace.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_createorupdate_autorest.go new file mode 100644 index 00000000000..7e742b0f05f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c WorkspacesClient) CreateOrUpdate(ctx context.Context, id WorkspaceId, input Workspace) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c WorkspacesClient) CreateOrUpdateThenPoll(ctx context.Context, id WorkspaceId, input Workspace) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c WorkspacesClient) preparerForCreateOrUpdate(ctx context.Context, id WorkspaceId, input Workspace) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c WorkspacesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_delete_autorest.go new file mode 100644 index 00000000000..3475fce1278 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_delete_autorest.go @@ -0,0 +1,78 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c WorkspacesClient) Delete(ctx context.Context, id WorkspaceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c WorkspacesClient) DeleteThenPoll(ctx context.Context, id WorkspaceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c WorkspacesClient) preparerForDelete(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c WorkspacesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_get_autorest.go new file mode 100644 index 00000000000..c16924832e3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_get_autorest.go @@ -0,0 +1,68 @@ +package workspaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Workspace +} + +// Get ... +func (c WorkspacesClient) Get(ctx context.Context, id WorkspaceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c WorkspacesClient) preparerForGet(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..d0a81317612 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Workspace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Workspace +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c WorkspacesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c WorkspacesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Databricks/workspaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c WorkspacesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Workspace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c WorkspacesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, WorkspaceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkspacesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate WorkspaceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Workspace, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..418bad379f4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Workspace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []Workspace +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c WorkspacesClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c WorkspacesClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Databricks/workspaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c WorkspacesClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Workspace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c WorkspacesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, WorkspaceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkspacesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate WorkspaceOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]Workspace, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_update_autorest.go new file mode 100644 index 00000000000..1bff4b670d1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/method_update_autorest.go @@ -0,0 +1,79 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c WorkspacesClient) Update(ctx context.Context, id WorkspaceId, input WorkspaceUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c WorkspacesClient) UpdateThenPoll(ctx context.Context, id WorkspaceId, input WorkspaceUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c WorkspacesClient) preparerForUpdate(ctx context.Context, id WorkspaceId, input WorkspaceUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c WorkspacesClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_createdby.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_createdby.go new file mode 100644 index 00000000000..fa06a35a393 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_createdby.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreatedBy struct { + ApplicationId *string `json:"applicationId,omitempty"` + Oid *string `json:"oid,omitempty"` + Puid *string `json:"puid,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_encryption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_encryption.go new file mode 100644 index 00000000000..3d37fddd7e5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_encryption.go @@ -0,0 +1,11 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Encryption struct { + KeyName *string `json:"KeyName,omitempty"` + KeySource *KeySource `json:"keySource,omitempty"` + Keyvaulturi *string `json:"keyvaulturi,omitempty"` + Keyversion *string `json:"keyversion,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_encryptionentitiesdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_encryptionentitiesdefinition.go new file mode 100644 index 00000000000..37c7a8fdbfb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_encryptionentitiesdefinition.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionEntitiesDefinition struct { + ManagedServices *EncryptionV2 `json:"managedServices,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_encryptionv2.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_encryptionv2.go new file mode 100644 index 00000000000..1569f86ef50 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_encryptionv2.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionV2 struct { + KeySource EncryptionKeySource `json:"keySource"` + KeyVaultProperties *EncryptionV2KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_encryptionv2keyvaultproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_encryptionv2keyvaultproperties.go new file mode 100644 index 00000000000..86adbd8c6a5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_encryptionv2keyvaultproperties.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionV2KeyVaultProperties struct { + KeyName string `json:"keyName"` + KeyVaultUri string `json:"keyVaultUri"` + KeyVersion string `json:"keyVersion"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_managedidentityconfiguration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_managedidentityconfiguration.go new file mode 100644 index 00000000000..aeea7f937c8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_managedidentityconfiguration.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedIdentityConfiguration struct { + PrincipalId *string `json:"principalId,omitempty"` + TenantId *string `json:"tenantId,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_privateendpoint.go new file mode 100644 index 00000000000..9f81ff8b836 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_privateendpoint.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_privateendpointconnection.go new file mode 100644 index 00000000000..aee2db4a4b3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties PrivateEndpointConnectionProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..34f25f6a480 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_privatelinkserviceconnectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..bdea419278e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionRequired *string `json:"actionRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status PrivateLinkServiceConnectionStatus `json:"status"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_sku.go new file mode 100644 index 00000000000..e5316e27b30 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_sku.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name string `json:"name"` + Tier *string `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspace.go new file mode 100644 index 00000000000..2a205ac1902 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspace.go @@ -0,0 +1,19 @@ +package workspaces + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Workspace struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties WorkspaceProperties `json:"properties"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspacecustombooleanparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspacecustombooleanparameter.go new file mode 100644 index 00000000000..a2e256bd2f0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspacecustombooleanparameter.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceCustomBooleanParameter struct { + Type *CustomParameterType `json:"type,omitempty"` + Value bool `json:"value"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspacecustomobjectparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspacecustomobjectparameter.go new file mode 100644 index 00000000000..85cfe098391 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspacecustomobjectparameter.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceCustomObjectParameter struct { + Type *CustomParameterType `json:"type,omitempty"` + Value interface{} `json:"value"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspacecustomparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspacecustomparameters.go similarity index 84% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspacecustomparameters.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspacecustomparameters.go index 71169023617..3c55d9c99e7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspacecustomparameters.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspacecustomparameters.go @@ -1,17 +1,20 @@ package workspaces +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type WorkspaceCustomParameters struct { AmlWorkspaceId *WorkspaceCustomStringParameter `json:"amlWorkspaceId,omitempty"` CustomPrivateSubnetName *WorkspaceCustomStringParameter `json:"customPrivateSubnetName,omitempty"` CustomPublicSubnetName *WorkspaceCustomStringParameter `json:"customPublicSubnetName,omitempty"` CustomVirtualNetworkId *WorkspaceCustomStringParameter `json:"customVirtualNetworkId,omitempty"` - EnableNoPublicIp *WorkspaceCustomBooleanParameter `json:"enableNoPublicIp,omitempty"` + EnableNoPublicIP *WorkspaceCustomBooleanParameter `json:"enableNoPublicIp,omitempty"` Encryption *WorkspaceEncryptionParameter `json:"encryption,omitempty"` LoadBalancerBackendPoolName *WorkspaceCustomStringParameter `json:"loadBalancerBackendPoolName,omitempty"` LoadBalancerId *WorkspaceCustomStringParameter `json:"loadBalancerId,omitempty"` NatGatewayName *WorkspaceCustomStringParameter `json:"natGatewayName,omitempty"` PrepareEncryption *WorkspaceCustomBooleanParameter `json:"prepareEncryption,omitempty"` - PublicIpName *WorkspaceCustomStringParameter `json:"publicIpName,omitempty"` + PublicIPName *WorkspaceCustomStringParameter `json:"publicIpName,omitempty"` RequireInfrastructureEncryption *WorkspaceCustomBooleanParameter `json:"requireInfrastructureEncryption,omitempty"` ResourceTags *WorkspaceCustomObjectParameter `json:"resourceTags,omitempty"` StorageAccountName *WorkspaceCustomStringParameter `json:"storageAccountName,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspacecustomstringparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspacecustomstringparameter.go new file mode 100644 index 00000000000..c983ffae968 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspacecustomstringparameter.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceCustomStringParameter struct { + Type *CustomParameterType `json:"type,omitempty"` + Value string `json:"value"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspaceencryptionparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspaceencryptionparameter.go new file mode 100644 index 00000000000..551ca748c04 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspaceencryptionparameter.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceEncryptionParameter struct { + Type *CustomParameterType `json:"type,omitempty"` + Value *Encryption `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspaceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspaceproperties.go new file mode 100644 index 00000000000..1a968a53acb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspaceproperties.go @@ -0,0 +1,40 @@ +package workspaces + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceProperties struct { + Authorizations *[]WorkspaceProviderAuthorization `json:"authorizations,omitempty"` + CreatedBy *CreatedBy `json:"createdBy,omitempty"` + CreatedDateTime *string `json:"createdDateTime,omitempty"` + Encryption *WorkspacePropertiesEncryption `json:"encryption,omitempty"` + ManagedResourceGroupId string `json:"managedResourceGroupId"` + Parameters *WorkspaceCustomParameters `json:"parameters,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + RequiredNsgRules *RequiredNsgRules `json:"requiredNsgRules,omitempty"` + StorageAccountIdentity *ManagedIdentityConfiguration `json:"storageAccountIdentity,omitempty"` + UiDefinitionUri *string `json:"uiDefinitionUri,omitempty"` + UpdatedBy *CreatedBy `json:"updatedBy,omitempty"` + WorkspaceId *string `json:"workspaceId,omitempty"` + WorkspaceUrl *string `json:"workspaceUrl,omitempty"` +} + +func (o *WorkspaceProperties) GetCreatedDateTimeAsTime() (*time.Time, error) { + if o.CreatedDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *WorkspaceProperties) SetCreatedDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedDateTime = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspacepropertiesencryption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspacepropertiesencryption.go new file mode 100644 index 00000000000..ddb3625ee74 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspacepropertiesencryption.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacePropertiesEncryption struct { + Entities EncryptionEntitiesDefinition `json:"entities"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspaceproviderauthorization.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspaceproviderauthorization.go new file mode 100644 index 00000000000..98d6f732126 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspaceproviderauthorization.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceProviderAuthorization struct { + PrincipalId string `json:"principalId"` + RoleDefinitionId string `json:"roleDefinitionId"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspaceupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspaceupdate.go new file mode 100644 index 00000000000..079a43eda11 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/model_workspaceupdate.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceUpdate struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/predicates.go new file mode 100644 index 00000000000..aed808b5b33 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/predicates.go @@ -0,0 +1,29 @@ +package workspaces + +type WorkspaceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p WorkspaceOperationPredicate) Matches(input Workspace) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/version.go new file mode 100644 index 00000000000..c253dde0243 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces/version.go @@ -0,0 +1,12 @@ +package workspaces + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-04-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/workspaces/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/README.md new file mode 100644 index 00000000000..6d057b71db5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/README.md @@ -0,0 +1,232 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances` Documentation + +The `backupinstances` SDK allows for interaction with the Azure Resource Manager Service `dataprotection` (API Version `2022-04-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances" +``` + + +### Client Initialization + +```go +client := backupinstances.NewBackupInstancesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `BackupInstancesClient.AdhocBackup` + +```go +ctx := context.TODO() +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") + +payload := backupinstances.TriggerBackupRequest{ + // ... +} + + +if err := client.AdhocBackupThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupInstancesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") + +payload := backupinstances.BackupInstanceResource{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupInstancesClient.Delete` + +```go +ctx := context.TODO() +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupInstancesClient.Get` + +```go +ctx := context.TODO() +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupInstancesClient.List` + +```go +ctx := context.TODO() +id := backupinstances.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BackupInstancesClient.ResumeBackups` + +```go +ctx := context.TODO() +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") + +if err := client.ResumeBackupsThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupInstancesClient.ResumeProtection` + +```go +ctx := context.TODO() +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") + +if err := client.ResumeProtectionThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupInstancesClient.StopProtection` + +```go +ctx := context.TODO() +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") + +if err := client.StopProtectionThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupInstancesClient.SuspendBackups` + +```go +ctx := context.TODO() +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") + +if err := client.SuspendBackupsThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupInstancesClient.SyncBackupInstance` + +```go +ctx := context.TODO() +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") + +payload := backupinstances.SyncBackupInstanceRequest{ + // ... +} + + +if err := client.SyncBackupInstanceThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupInstancesClient.TriggerRehydrate` + +```go +ctx := context.TODO() +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") + +payload := backupinstances.AzureBackupRehydrationRequest{ + // ... +} + + +if err := client.TriggerRehydrateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupInstancesClient.TriggerRestore` + +```go +ctx := context.TODO() +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") + +payload := backupinstances.AzureBackupRestoreRequest{ + // ... +} + + +if err := client.TriggerRestoreThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupInstancesClient.ValidateForBackup` + +```go +ctx := context.TODO() +id := backupinstances.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +payload := backupinstances.ValidateForBackupRequest{ + // ... +} + + +if err := client.ValidateForBackupThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupInstancesClient.ValidateForRestore` + +```go +ctx := context.TODO() +id := backupinstances.NewBackupInstanceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupInstanceValue") + +payload := backupinstances.ValidateRestoreRequestObject{ + // ... +} + + +if err := client.ValidateForRestoreThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/client.go new file mode 100644 index 00000000000..1779b995aad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/client.go @@ -0,0 +1,18 @@ +package backupinstances + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupInstancesClient struct { + Client autorest.Client + baseUri string +} + +func NewBackupInstancesClientWithBaseURI(endpoint string) BackupInstancesClient { + return BackupInstancesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/constants.go new file mode 100644 index 00000000000..6f879211bbc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/constants.go @@ -0,0 +1,337 @@ +package backupinstances + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CurrentProtectionState string + +const ( + CurrentProtectionStateBackupSchedulesSuspended CurrentProtectionState = "BackupSchedulesSuspended" + CurrentProtectionStateConfiguringProtection CurrentProtectionState = "ConfiguringProtection" + CurrentProtectionStateConfiguringProtectionFailed CurrentProtectionState = "ConfiguringProtectionFailed" + CurrentProtectionStateInvalid CurrentProtectionState = "Invalid" + CurrentProtectionStateNotProtected CurrentProtectionState = "NotProtected" + CurrentProtectionStateProtectionConfigured CurrentProtectionState = "ProtectionConfigured" + CurrentProtectionStateProtectionError CurrentProtectionState = "ProtectionError" + CurrentProtectionStateProtectionStopped CurrentProtectionState = "ProtectionStopped" + CurrentProtectionStateRetentionSchedulesSuspended CurrentProtectionState = "RetentionSchedulesSuspended" + CurrentProtectionStateSoftDeleted CurrentProtectionState = "SoftDeleted" + CurrentProtectionStateSoftDeleting CurrentProtectionState = "SoftDeleting" + CurrentProtectionStateUpdatingProtection CurrentProtectionState = "UpdatingProtection" +) + +func PossibleValuesForCurrentProtectionState() []string { + return []string{ + string(CurrentProtectionStateBackupSchedulesSuspended), + string(CurrentProtectionStateConfiguringProtection), + string(CurrentProtectionStateConfiguringProtectionFailed), + string(CurrentProtectionStateInvalid), + string(CurrentProtectionStateNotProtected), + string(CurrentProtectionStateProtectionConfigured), + string(CurrentProtectionStateProtectionError), + string(CurrentProtectionStateProtectionStopped), + string(CurrentProtectionStateRetentionSchedulesSuspended), + string(CurrentProtectionStateSoftDeleted), + string(CurrentProtectionStateSoftDeleting), + string(CurrentProtectionStateUpdatingProtection), + } +} + +func parseCurrentProtectionState(input string) (*CurrentProtectionState, error) { + vals := map[string]CurrentProtectionState{ + "backupschedulessuspended": CurrentProtectionStateBackupSchedulesSuspended, + "configuringprotection": CurrentProtectionStateConfiguringProtection, + "configuringprotectionfailed": CurrentProtectionStateConfiguringProtectionFailed, + "invalid": CurrentProtectionStateInvalid, + "notprotected": CurrentProtectionStateNotProtected, + "protectionconfigured": CurrentProtectionStateProtectionConfigured, + "protectionerror": CurrentProtectionStateProtectionError, + "protectionstopped": CurrentProtectionStateProtectionStopped, + "retentionschedulessuspended": CurrentProtectionStateRetentionSchedulesSuspended, + "softdeleted": CurrentProtectionStateSoftDeleted, + "softdeleting": CurrentProtectionStateSoftDeleting, + "updatingprotection": CurrentProtectionStateUpdatingProtection, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CurrentProtectionState(input) + return &out, nil +} + +type DataStoreTypes string + +const ( + DataStoreTypesArchiveStore DataStoreTypes = "ArchiveStore" + DataStoreTypesOperationalStore DataStoreTypes = "OperationalStore" + DataStoreTypesVaultStore DataStoreTypes = "VaultStore" +) + +func PossibleValuesForDataStoreTypes() []string { + return []string{ + string(DataStoreTypesArchiveStore), + string(DataStoreTypesOperationalStore), + string(DataStoreTypesVaultStore), + } +} + +func parseDataStoreTypes(input string) (*DataStoreTypes, error) { + vals := map[string]DataStoreTypes{ + "archivestore": DataStoreTypesArchiveStore, + "operationalstore": DataStoreTypesOperationalStore, + "vaultstore": DataStoreTypesVaultStore, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DataStoreTypes(input) + return &out, nil +} + +type RecoveryOption string + +const ( + RecoveryOptionFailIfExists RecoveryOption = "FailIfExists" +) + +func PossibleValuesForRecoveryOption() []string { + return []string{ + string(RecoveryOptionFailIfExists), + } +} + +func parseRecoveryOption(input string) (*RecoveryOption, error) { + vals := map[string]RecoveryOption{ + "failifexists": RecoveryOptionFailIfExists, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RecoveryOption(input) + return &out, nil +} + +type RehydrationPriority string + +const ( + RehydrationPriorityHigh RehydrationPriority = "High" + RehydrationPriorityInvalid RehydrationPriority = "Invalid" + RehydrationPriorityStandard RehydrationPriority = "Standard" +) + +func PossibleValuesForRehydrationPriority() []string { + return []string{ + string(RehydrationPriorityHigh), + string(RehydrationPriorityInvalid), + string(RehydrationPriorityStandard), + } +} + +func parseRehydrationPriority(input string) (*RehydrationPriority, error) { + vals := map[string]RehydrationPriority{ + "high": RehydrationPriorityHigh, + "invalid": RehydrationPriorityInvalid, + "standard": RehydrationPriorityStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RehydrationPriority(input) + return &out, nil +} + +type RestoreTargetLocationType string + +const ( + RestoreTargetLocationTypeAzureBlobs RestoreTargetLocationType = "AzureBlobs" + RestoreTargetLocationTypeAzureFiles RestoreTargetLocationType = "AzureFiles" + RestoreTargetLocationTypeInvalid RestoreTargetLocationType = "Invalid" +) + +func PossibleValuesForRestoreTargetLocationType() []string { + return []string{ + string(RestoreTargetLocationTypeAzureBlobs), + string(RestoreTargetLocationTypeAzureFiles), + string(RestoreTargetLocationTypeInvalid), + } +} + +func parseRestoreTargetLocationType(input string) (*RestoreTargetLocationType, error) { + vals := map[string]RestoreTargetLocationType{ + "azureblobs": RestoreTargetLocationTypeAzureBlobs, + "azurefiles": RestoreTargetLocationTypeAzureFiles, + "invalid": RestoreTargetLocationTypeInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RestoreTargetLocationType(input) + return &out, nil +} + +type SecretStoreType string + +const ( + SecretStoreTypeAzureKeyVault SecretStoreType = "AzureKeyVault" + SecretStoreTypeInvalid SecretStoreType = "Invalid" +) + +func PossibleValuesForSecretStoreType() []string { + return []string{ + string(SecretStoreTypeAzureKeyVault), + string(SecretStoreTypeInvalid), + } +} + +func parseSecretStoreType(input string) (*SecretStoreType, error) { + vals := map[string]SecretStoreType{ + "azurekeyvault": SecretStoreTypeAzureKeyVault, + "invalid": SecretStoreTypeInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecretStoreType(input) + return &out, nil +} + +type SourceDataStoreType string + +const ( + SourceDataStoreTypeArchiveStore SourceDataStoreType = "ArchiveStore" + SourceDataStoreTypeSnapshotStore SourceDataStoreType = "SnapshotStore" + SourceDataStoreTypeVaultStore SourceDataStoreType = "VaultStore" +) + +func PossibleValuesForSourceDataStoreType() []string { + return []string{ + string(SourceDataStoreTypeArchiveStore), + string(SourceDataStoreTypeSnapshotStore), + string(SourceDataStoreTypeVaultStore), + } +} + +func parseSourceDataStoreType(input string) (*SourceDataStoreType, error) { + vals := map[string]SourceDataStoreType{ + "archivestore": SourceDataStoreTypeArchiveStore, + "snapshotstore": SourceDataStoreTypeSnapshotStore, + "vaultstore": SourceDataStoreTypeVaultStore, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SourceDataStoreType(input) + return &out, nil +} + +type Status string + +const ( + StatusConfiguringProtection Status = "ConfiguringProtection" + StatusConfiguringProtectionFailed Status = "ConfiguringProtectionFailed" + StatusProtectionConfigured Status = "ProtectionConfigured" + StatusProtectionStopped Status = "ProtectionStopped" + StatusSoftDeleted Status = "SoftDeleted" + StatusSoftDeleting Status = "SoftDeleting" +) + +func PossibleValuesForStatus() []string { + return []string{ + string(StatusConfiguringProtection), + string(StatusConfiguringProtectionFailed), + string(StatusProtectionConfigured), + string(StatusProtectionStopped), + string(StatusSoftDeleted), + string(StatusSoftDeleting), + } +} + +func parseStatus(input string) (*Status, error) { + vals := map[string]Status{ + "configuringprotection": StatusConfiguringProtection, + "configuringprotectionfailed": StatusConfiguringProtectionFailed, + "protectionconfigured": StatusProtectionConfigured, + "protectionstopped": StatusProtectionStopped, + "softdeleted": StatusSoftDeleted, + "softdeleting": StatusSoftDeleting, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} + +type SyncType string + +const ( + SyncTypeDefault SyncType = "Default" + SyncTypeForceResync SyncType = "ForceResync" +) + +func PossibleValuesForSyncType() []string { + return []string{ + string(SyncTypeDefault), + string(SyncTypeForceResync), + } +} + +func parseSyncType(input string) (*SyncType, error) { + vals := map[string]SyncType{ + "default": SyncTypeDefault, + "forceresync": SyncTypeForceResync, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SyncType(input) + return &out, nil +} + +type ValidationType string + +const ( + ValidationTypeDeepValidation ValidationType = "DeepValidation" + ValidationTypeShallowValidation ValidationType = "ShallowValidation" +) + +func PossibleValuesForValidationType() []string { + return []string{ + string(ValidationTypeDeepValidation), + string(ValidationTypeShallowValidation), + } +} + +func parseValidationType(input string) (*ValidationType, error) { + vals := map[string]ValidationType{ + "deepvalidation": ValidationTypeDeepValidation, + "shallowvalidation": ValidationTypeShallowValidation, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ValidationType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupinstance.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupinstance.go new file mode 100644 index 00000000000..d7b8818dea5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupinstance.go @@ -0,0 +1,137 @@ +package backupinstances + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = BackupInstanceId{} + +// BackupInstanceId is a struct representing the Resource ID for a Backup Instance +type BackupInstanceId struct { + SubscriptionId string + ResourceGroupName string + VaultName string + BackupInstanceName string +} + +// NewBackupInstanceID returns a new BackupInstanceId struct +func NewBackupInstanceID(subscriptionId string, resourceGroupName string, vaultName string, backupInstanceName string) BackupInstanceId { + return BackupInstanceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + BackupInstanceName: backupInstanceName, + } +} + +// ParseBackupInstanceID parses 'input' into a BackupInstanceId +func ParseBackupInstanceID(input string) (*BackupInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(BackupInstanceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BackupInstanceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'backupInstanceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseBackupInstanceIDInsensitively parses 'input' case-insensitively into a BackupInstanceId +// note: this method should only be used for API response data and not user input +func ParseBackupInstanceIDInsensitively(input string) (*BackupInstanceId, error) { + parser := resourceids.NewParserFromResourceIdType(BackupInstanceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BackupInstanceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { + return nil, fmt.Errorf("the segment 'backupInstanceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateBackupInstanceID checks that 'input' can be parsed as a Backup Instance ID +func ValidateBackupInstanceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseBackupInstanceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Backup Instance ID +func (id BackupInstanceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/backupVaults/%s/backupInstances/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.BackupInstanceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Backup Instance ID +func (id BackupInstanceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), + resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + resourceids.StaticSegment("staticBackupInstances", "backupInstances", "backupInstances"), + resourceids.UserSpecifiedSegment("backupInstanceName", "backupInstanceValue"), + } +} + +// String returns a human-readable description of this Backup Instance ID +func (id BackupInstanceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Backup Instance Name: %q", id.BackupInstanceName), + } + return fmt.Sprintf("Backup Instance (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupvault.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupvault.go new file mode 100644 index 00000000000..3e60f3f7bb3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupvault.go @@ -0,0 +1,124 @@ +package backupinstances + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = BackupVaultId{} + +// BackupVaultId is a struct representing the Resource ID for a Backup Vault +type BackupVaultId struct { + SubscriptionId string + ResourceGroupName string + VaultName string +} + +// NewBackupVaultID returns a new BackupVaultId struct +func NewBackupVaultID(subscriptionId string, resourceGroupName string, vaultName string) BackupVaultId { + return BackupVaultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + } +} + +// ParseBackupVaultID parses 'input' into a BackupVaultId +func ParseBackupVaultID(input string) (*BackupVaultId, error) { + parser := resourceids.NewParserFromResourceIdType(BackupVaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BackupVaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseBackupVaultIDInsensitively parses 'input' case-insensitively into a BackupVaultId +// note: this method should only be used for API response data and not user input +func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { + parser := resourceids.NewParserFromResourceIdType(BackupVaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BackupVaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID +func ValidateBackupVaultID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseBackupVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Backup Vault ID +func (id BackupVaultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/backupVaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Backup Vault ID +func (id BackupVaultId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), + resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + } +} + +// String returns a human-readable description of this Backup Vault ID +func (id BackupVaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + } + return fmt.Sprintf("Backup Vault (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_adhocbackup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_adhocbackup_autorest.go new file mode 100644 index 00000000000..4e105a5381a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_adhocbackup_autorest.go @@ -0,0 +1,79 @@ +package backupinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdhocBackupOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// AdhocBackup ... +func (c BackupInstancesClient) AdhocBackup(ctx context.Context, id BackupInstanceId, input TriggerBackupRequest) (result AdhocBackupOperationResponse, err error) { + req, err := c.preparerForAdhocBackup(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "AdhocBackup", nil, "Failure preparing request") + return + } + + result, err = c.senderForAdhocBackup(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "AdhocBackup", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// AdhocBackupThenPoll performs AdhocBackup then polls until it's completed +func (c BackupInstancesClient) AdhocBackupThenPoll(ctx context.Context, id BackupInstanceId, input TriggerBackupRequest) error { + result, err := c.AdhocBackup(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AdhocBackup: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after AdhocBackup: %+v", err) + } + + return nil +} + +// preparerForAdhocBackup prepares the AdhocBackup request. +func (c BackupInstancesClient) preparerForAdhocBackup(ctx context.Context, id BackupInstanceId, input TriggerBackupRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backup", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForAdhocBackup sends the AdhocBackup request. The method will close the +// http.Response Body if it receives an error. +func (c BackupInstancesClient) senderForAdhocBackup(ctx context.Context, req *http.Request) (future AdhocBackupOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_createorupdate_autorest.go new file mode 100644 index 00000000000..bbf79bff4f2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package backupinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c BackupInstancesClient) CreateOrUpdate(ctx context.Context, id BackupInstanceId, input BackupInstanceResource) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c BackupInstancesClient) CreateOrUpdateThenPoll(ctx context.Context, id BackupInstanceId, input BackupInstanceResource) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c BackupInstancesClient) preparerForCreateOrUpdate(ctx context.Context, id BackupInstanceId, input BackupInstanceResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c BackupInstancesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_delete_autorest.go new file mode 100644 index 00000000000..a10d13925d5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_delete_autorest.go @@ -0,0 +1,78 @@ +package backupinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c BackupInstancesClient) Delete(ctx context.Context, id BackupInstanceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c BackupInstancesClient) DeleteThenPoll(ctx context.Context, id BackupInstanceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c BackupInstancesClient) preparerForDelete(ctx context.Context, id BackupInstanceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c BackupInstancesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_get_autorest.go new file mode 100644 index 00000000000..4c9f88b4ed7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_get_autorest.go @@ -0,0 +1,68 @@ +package backupinstances + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *BackupInstanceResource +} + +// Get ... +func (c BackupInstancesClient) Get(ctx context.Context, id BackupInstanceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c BackupInstancesClient) preparerForGet(ctx context.Context, id BackupInstanceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c BackupInstancesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_list_autorest.go new file mode 100644 index 00000000000..b78b22736ef --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_list_autorest.go @@ -0,0 +1,186 @@ +package backupinstances + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]BackupInstanceResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []BackupInstanceResource +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c BackupInstancesClient) List(ctx context.Context, id BackupVaultId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c BackupInstancesClient) preparerForList(ctx context.Context, id BackupVaultId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupInstances", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c BackupInstancesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c BackupInstancesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []BackupInstanceResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c BackupInstancesClient) ListComplete(ctx context.Context, id BackupVaultId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, BackupInstanceResourceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BackupInstancesClient) ListCompleteMatchingPredicate(ctx context.Context, id BackupVaultId, predicate BackupInstanceResourceOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]BackupInstanceResource, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_resumebackups_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_resumebackups_autorest.go new file mode 100644 index 00000000000..64667103d1f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_resumebackups_autorest.go @@ -0,0 +1,78 @@ +package backupinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResumeBackupsOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ResumeBackups ... +func (c BackupInstancesClient) ResumeBackups(ctx context.Context, id BackupInstanceId) (result ResumeBackupsOperationResponse, err error) { + req, err := c.preparerForResumeBackups(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "ResumeBackups", nil, "Failure preparing request") + return + } + + result, err = c.senderForResumeBackups(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "ResumeBackups", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ResumeBackupsThenPoll performs ResumeBackups then polls until it's completed +func (c BackupInstancesClient) ResumeBackupsThenPoll(ctx context.Context, id BackupInstanceId) error { + result, err := c.ResumeBackups(ctx, id) + if err != nil { + return fmt.Errorf("performing ResumeBackups: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ResumeBackups: %+v", err) + } + + return nil +} + +// preparerForResumeBackups prepares the ResumeBackups request. +func (c BackupInstancesClient) preparerForResumeBackups(ctx context.Context, id BackupInstanceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/resumeBackups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForResumeBackups sends the ResumeBackups request. The method will close the +// http.Response Body if it receives an error. +func (c BackupInstancesClient) senderForResumeBackups(ctx context.Context, req *http.Request) (future ResumeBackupsOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_resumeprotection_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_resumeprotection_autorest.go new file mode 100644 index 00000000000..04520c7c313 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_resumeprotection_autorest.go @@ -0,0 +1,78 @@ +package backupinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResumeProtectionOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ResumeProtection ... +func (c BackupInstancesClient) ResumeProtection(ctx context.Context, id BackupInstanceId) (result ResumeProtectionOperationResponse, err error) { + req, err := c.preparerForResumeProtection(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "ResumeProtection", nil, "Failure preparing request") + return + } + + result, err = c.senderForResumeProtection(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "ResumeProtection", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ResumeProtectionThenPoll performs ResumeProtection then polls until it's completed +func (c BackupInstancesClient) ResumeProtectionThenPoll(ctx context.Context, id BackupInstanceId) error { + result, err := c.ResumeProtection(ctx, id) + if err != nil { + return fmt.Errorf("performing ResumeProtection: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ResumeProtection: %+v", err) + } + + return nil +} + +// preparerForResumeProtection prepares the ResumeProtection request. +func (c BackupInstancesClient) preparerForResumeProtection(ctx context.Context, id BackupInstanceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/resumeProtection", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForResumeProtection sends the ResumeProtection request. The method will close the +// http.Response Body if it receives an error. +func (c BackupInstancesClient) senderForResumeProtection(ctx context.Context, req *http.Request) (future ResumeProtectionOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_stopprotection_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_stopprotection_autorest.go new file mode 100644 index 00000000000..5a02145f35a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_stopprotection_autorest.go @@ -0,0 +1,78 @@ +package backupinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopProtectionOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// StopProtection ... +func (c BackupInstancesClient) StopProtection(ctx context.Context, id BackupInstanceId) (result StopProtectionOperationResponse, err error) { + req, err := c.preparerForStopProtection(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "StopProtection", nil, "Failure preparing request") + return + } + + result, err = c.senderForStopProtection(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "StopProtection", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// StopProtectionThenPoll performs StopProtection then polls until it's completed +func (c BackupInstancesClient) StopProtectionThenPoll(ctx context.Context, id BackupInstanceId) error { + result, err := c.StopProtection(ctx, id) + if err != nil { + return fmt.Errorf("performing StopProtection: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after StopProtection: %+v", err) + } + + return nil +} + +// preparerForStopProtection prepares the StopProtection request. +func (c BackupInstancesClient) preparerForStopProtection(ctx context.Context, id BackupInstanceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/stopProtection", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForStopProtection sends the StopProtection request. The method will close the +// http.Response Body if it receives an error. +func (c BackupInstancesClient) senderForStopProtection(ctx context.Context, req *http.Request) (future StopProtectionOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_suspendbackups_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_suspendbackups_autorest.go new file mode 100644 index 00000000000..16aa3bc7dfe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_suspendbackups_autorest.go @@ -0,0 +1,78 @@ +package backupinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SuspendBackupsOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// SuspendBackups ... +func (c BackupInstancesClient) SuspendBackups(ctx context.Context, id BackupInstanceId) (result SuspendBackupsOperationResponse, err error) { + req, err := c.preparerForSuspendBackups(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "SuspendBackups", nil, "Failure preparing request") + return + } + + result, err = c.senderForSuspendBackups(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "SuspendBackups", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// SuspendBackupsThenPoll performs SuspendBackups then polls until it's completed +func (c BackupInstancesClient) SuspendBackupsThenPoll(ctx context.Context, id BackupInstanceId) error { + result, err := c.SuspendBackups(ctx, id) + if err != nil { + return fmt.Errorf("performing SuspendBackups: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after SuspendBackups: %+v", err) + } + + return nil +} + +// preparerForSuspendBackups prepares the SuspendBackups request. +func (c BackupInstancesClient) preparerForSuspendBackups(ctx context.Context, id BackupInstanceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/suspendBackups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForSuspendBackups sends the SuspendBackups request. The method will close the +// http.Response Body if it receives an error. +func (c BackupInstancesClient) senderForSuspendBackups(ctx context.Context, req *http.Request) (future SuspendBackupsOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_syncbackupinstance_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_syncbackupinstance_autorest.go new file mode 100644 index 00000000000..ae16647c37a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_syncbackupinstance_autorest.go @@ -0,0 +1,79 @@ +package backupinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SyncBackupInstanceOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// SyncBackupInstance ... +func (c BackupInstancesClient) SyncBackupInstance(ctx context.Context, id BackupInstanceId, input SyncBackupInstanceRequest) (result SyncBackupInstanceOperationResponse, err error) { + req, err := c.preparerForSyncBackupInstance(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "SyncBackupInstance", nil, "Failure preparing request") + return + } + + result, err = c.senderForSyncBackupInstance(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "SyncBackupInstance", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// SyncBackupInstanceThenPoll performs SyncBackupInstance then polls until it's completed +func (c BackupInstancesClient) SyncBackupInstanceThenPoll(ctx context.Context, id BackupInstanceId, input SyncBackupInstanceRequest) error { + result, err := c.SyncBackupInstance(ctx, id, input) + if err != nil { + return fmt.Errorf("performing SyncBackupInstance: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after SyncBackupInstance: %+v", err) + } + + return nil +} + +// preparerForSyncBackupInstance prepares the SyncBackupInstance request. +func (c BackupInstancesClient) preparerForSyncBackupInstance(ctx context.Context, id BackupInstanceId, input SyncBackupInstanceRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/sync", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForSyncBackupInstance sends the SyncBackupInstance request. The method will close the +// http.Response Body if it receives an error. +func (c BackupInstancesClient) senderForSyncBackupInstance(ctx context.Context, req *http.Request) (future SyncBackupInstanceOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_triggerrehydrate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_triggerrehydrate_autorest.go new file mode 100644 index 00000000000..a02a792414f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_triggerrehydrate_autorest.go @@ -0,0 +1,79 @@ +package backupinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TriggerRehydrateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// TriggerRehydrate ... +func (c BackupInstancesClient) TriggerRehydrate(ctx context.Context, id BackupInstanceId, input AzureBackupRehydrationRequest) (result TriggerRehydrateOperationResponse, err error) { + req, err := c.preparerForTriggerRehydrate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "TriggerRehydrate", nil, "Failure preparing request") + return + } + + result, err = c.senderForTriggerRehydrate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "TriggerRehydrate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// TriggerRehydrateThenPoll performs TriggerRehydrate then polls until it's completed +func (c BackupInstancesClient) TriggerRehydrateThenPoll(ctx context.Context, id BackupInstanceId, input AzureBackupRehydrationRequest) error { + result, err := c.TriggerRehydrate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing TriggerRehydrate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after TriggerRehydrate: %+v", err) + } + + return nil +} + +// preparerForTriggerRehydrate prepares the TriggerRehydrate request. +func (c BackupInstancesClient) preparerForTriggerRehydrate(ctx context.Context, id BackupInstanceId, input AzureBackupRehydrationRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/rehydrate", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForTriggerRehydrate sends the TriggerRehydrate request. The method will close the +// http.Response Body if it receives an error. +func (c BackupInstancesClient) senderForTriggerRehydrate(ctx context.Context, req *http.Request) (future TriggerRehydrateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_triggerrestore_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_triggerrestore_autorest.go new file mode 100644 index 00000000000..732480dfb78 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_triggerrestore_autorest.go @@ -0,0 +1,79 @@ +package backupinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TriggerRestoreOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// TriggerRestore ... +func (c BackupInstancesClient) TriggerRestore(ctx context.Context, id BackupInstanceId, input AzureBackupRestoreRequest) (result TriggerRestoreOperationResponse, err error) { + req, err := c.preparerForTriggerRestore(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "TriggerRestore", nil, "Failure preparing request") + return + } + + result, err = c.senderForTriggerRestore(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "TriggerRestore", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// TriggerRestoreThenPoll performs TriggerRestore then polls until it's completed +func (c BackupInstancesClient) TriggerRestoreThenPoll(ctx context.Context, id BackupInstanceId, input AzureBackupRestoreRequest) error { + result, err := c.TriggerRestore(ctx, id, input) + if err != nil { + return fmt.Errorf("performing TriggerRestore: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after TriggerRestore: %+v", err) + } + + return nil +} + +// preparerForTriggerRestore prepares the TriggerRestore request. +func (c BackupInstancesClient) preparerForTriggerRestore(ctx context.Context, id BackupInstanceId, input AzureBackupRestoreRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/restore", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForTriggerRestore sends the TriggerRestore request. The method will close the +// http.Response Body if it receives an error. +func (c BackupInstancesClient) senderForTriggerRestore(ctx context.Context, req *http.Request) (future TriggerRestoreOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_validateforbackup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_validateforbackup_autorest.go new file mode 100644 index 00000000000..ad1d3f60283 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_validateforbackup_autorest.go @@ -0,0 +1,79 @@ +package backupinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateForBackupOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ValidateForBackup ... +func (c BackupInstancesClient) ValidateForBackup(ctx context.Context, id BackupVaultId, input ValidateForBackupRequest) (result ValidateForBackupOperationResponse, err error) { + req, err := c.preparerForValidateForBackup(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "ValidateForBackup", nil, "Failure preparing request") + return + } + + result, err = c.senderForValidateForBackup(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "ValidateForBackup", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ValidateForBackupThenPoll performs ValidateForBackup then polls until it's completed +func (c BackupInstancesClient) ValidateForBackupThenPoll(ctx context.Context, id BackupVaultId, input ValidateForBackupRequest) error { + result, err := c.ValidateForBackup(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ValidateForBackup: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ValidateForBackup: %+v", err) + } + + return nil +} + +// preparerForValidateForBackup prepares the ValidateForBackup request. +func (c BackupInstancesClient) preparerForValidateForBackup(ctx context.Context, id BackupVaultId, input ValidateForBackupRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/validateForBackup", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForValidateForBackup sends the ValidateForBackup request. The method will close the +// http.Response Body if it receives an error. +func (c BackupInstancesClient) senderForValidateForBackup(ctx context.Context, req *http.Request) (future ValidateForBackupOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_validateforrestore_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_validateforrestore_autorest.go new file mode 100644 index 00000000000..e48ce307e91 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/method_validateforrestore_autorest.go @@ -0,0 +1,79 @@ +package backupinstances + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateForRestoreOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ValidateForRestore ... +func (c BackupInstancesClient) ValidateForRestore(ctx context.Context, id BackupInstanceId, input ValidateRestoreRequestObject) (result ValidateForRestoreOperationResponse, err error) { + req, err := c.preparerForValidateForRestore(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "ValidateForRestore", nil, "Failure preparing request") + return + } + + result, err = c.senderForValidateForRestore(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "backupinstances.BackupInstancesClient", "ValidateForRestore", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ValidateForRestoreThenPoll performs ValidateForRestore then polls until it's completed +func (c BackupInstancesClient) ValidateForRestoreThenPoll(ctx context.Context, id BackupInstanceId, input ValidateRestoreRequestObject) error { + result, err := c.ValidateForRestore(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ValidateForRestore: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ValidateForRestore: %+v", err) + } + + return nil +} + +// preparerForValidateForRestore prepares the ValidateForRestore request. +func (c BackupInstancesClient) preparerForValidateForRestore(ctx context.Context, id BackupInstanceId, input ValidateRestoreRequestObject) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/validateRestore", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForValidateForRestore sends the ValidateForRestore request. The method will close the +// http.Response Body if it receives an error. +func (c BackupInstancesClient) senderForValidateForRestore(ctx context.Context, req *http.Request) (future ValidateForRestoreOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_adhocbackupruleoptions.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_adhocbackupruleoptions.go new file mode 100644 index 00000000000..6c6e86388b8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_adhocbackupruleoptions.go @@ -0,0 +1,9 @@ +package backupinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdHocBackupRuleOptions struct { + RuleName string `json:"ruleName"` + TriggerOption AdhocBackupTriggerOption `json:"triggerOption"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_adhocbackuptriggeroption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_adhocbackuptriggeroption.go new file mode 100644 index 00000000000..3ce1a004123 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_adhocbackuptriggeroption.go @@ -0,0 +1,8 @@ +package backupinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdhocBackupTriggerOption struct { + RetentionTagOverride *string `json:"retentionTagOverride,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_authcredentials.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_authcredentials.go new file mode 100644 index 00000000000..e9aa73b8f73 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_authcredentials.go @@ -0,0 +1,48 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthCredentials interface { +} + +func unmarshalAuthCredentialsImplementation(input []byte) (AuthCredentials, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling AuthCredentials into map[string]interface: %+v", err) + } + + value, ok := temp["objectType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "SecretStoreBasedAuthCredentials") { + var out SecretStoreBasedAuthCredentials + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SecretStoreBasedAuthCredentials: %+v", err) + } + return out, nil + } + + type RawAuthCredentialsImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawAuthCredentialsImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_azurebackuprecoverypointbasedrestorerequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_azurebackuprecoverypointbasedrestorerequest.go new file mode 100644 index 00000000000..d6e691f7bfb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_azurebackuprecoverypointbasedrestorerequest.go @@ -0,0 +1,72 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AzureBackupRestoreRequest = AzureBackupRecoveryPointBasedRestoreRequest{} + +type AzureBackupRecoveryPointBasedRestoreRequest struct { + RecoveryPointId string `json:"recoveryPointId"` + + // Fields inherited from AzureBackupRestoreRequest + RestoreTargetInfo RestoreTargetInfoBase `json:"restoreTargetInfo"` + SourceDataStoreType SourceDataStoreType `json:"sourceDataStoreType"` + SourceResourceId *string `json:"sourceResourceId,omitempty"` +} + +var _ json.Marshaler = AzureBackupRecoveryPointBasedRestoreRequest{} + +func (s AzureBackupRecoveryPointBasedRestoreRequest) MarshalJSON() ([]byte, error) { + type wrapper AzureBackupRecoveryPointBasedRestoreRequest + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AzureBackupRecoveryPointBasedRestoreRequest: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AzureBackupRecoveryPointBasedRestoreRequest: %+v", err) + } + decoded["objectType"] = "AzureBackupRecoveryPointBasedRestoreRequest" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AzureBackupRecoveryPointBasedRestoreRequest: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &AzureBackupRecoveryPointBasedRestoreRequest{} + +func (s *AzureBackupRecoveryPointBasedRestoreRequest) UnmarshalJSON(bytes []byte) error { + type alias AzureBackupRecoveryPointBasedRestoreRequest + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into AzureBackupRecoveryPointBasedRestoreRequest: %+v", err) + } + + s.RecoveryPointId = decoded.RecoveryPointId + s.SourceDataStoreType = decoded.SourceDataStoreType + s.SourceResourceId = decoded.SourceResourceId + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AzureBackupRecoveryPointBasedRestoreRequest into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["restoreTargetInfo"]; ok { + impl, err := unmarshalRestoreTargetInfoBaseImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'RestoreTargetInfo' for 'AzureBackupRecoveryPointBasedRestoreRequest': %+v", err) + } + s.RestoreTargetInfo = impl + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_azurebackuprecoverytimebasedrestorerequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_azurebackuprecoverytimebasedrestorerequest.go new file mode 100644 index 00000000000..e67d2e54b10 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_azurebackuprecoverytimebasedrestorerequest.go @@ -0,0 +1,72 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AzureBackupRestoreRequest = AzureBackupRecoveryTimeBasedRestoreRequest{} + +type AzureBackupRecoveryTimeBasedRestoreRequest struct { + RecoveryPointTime string `json:"recoveryPointTime"` + + // Fields inherited from AzureBackupRestoreRequest + RestoreTargetInfo RestoreTargetInfoBase `json:"restoreTargetInfo"` + SourceDataStoreType SourceDataStoreType `json:"sourceDataStoreType"` + SourceResourceId *string `json:"sourceResourceId,omitempty"` +} + +var _ json.Marshaler = AzureBackupRecoveryTimeBasedRestoreRequest{} + +func (s AzureBackupRecoveryTimeBasedRestoreRequest) MarshalJSON() ([]byte, error) { + type wrapper AzureBackupRecoveryTimeBasedRestoreRequest + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AzureBackupRecoveryTimeBasedRestoreRequest: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AzureBackupRecoveryTimeBasedRestoreRequest: %+v", err) + } + decoded["objectType"] = "AzureBackupRecoveryTimeBasedRestoreRequest" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AzureBackupRecoveryTimeBasedRestoreRequest: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &AzureBackupRecoveryTimeBasedRestoreRequest{} + +func (s *AzureBackupRecoveryTimeBasedRestoreRequest) UnmarshalJSON(bytes []byte) error { + type alias AzureBackupRecoveryTimeBasedRestoreRequest + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into AzureBackupRecoveryTimeBasedRestoreRequest: %+v", err) + } + + s.RecoveryPointTime = decoded.RecoveryPointTime + s.SourceDataStoreType = decoded.SourceDataStoreType + s.SourceResourceId = decoded.SourceResourceId + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AzureBackupRecoveryTimeBasedRestoreRequest into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["restoreTargetInfo"]; ok { + impl, err := unmarshalRestoreTargetInfoBaseImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'RestoreTargetInfo' for 'AzureBackupRecoveryTimeBasedRestoreRequest': %+v", err) + } + s.RestoreTargetInfo = impl + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_azurebackuprehydrationrequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_azurebackuprehydrationrequest.go new file mode 100644 index 00000000000..b78ded8adb1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_azurebackuprehydrationrequest.go @@ -0,0 +1,10 @@ +package backupinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureBackupRehydrationRequest struct { + RecoveryPointId string `json:"recoveryPointId"` + RehydrationPriority *RehydrationPriority `json:"rehydrationPriority,omitempty"` + RehydrationRetentionDuration string `json:"rehydrationRetentionDuration"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_azurebackuprestorerequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_azurebackuprestorerequest.go new file mode 100644 index 00000000000..56d98f400a4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_azurebackuprestorerequest.go @@ -0,0 +1,56 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureBackupRestoreRequest interface { +} + +func unmarshalAzureBackupRestoreRequestImplementation(input []byte) (AzureBackupRestoreRequest, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling AzureBackupRestoreRequest into map[string]interface: %+v", err) + } + + value, ok := temp["objectType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "AzureBackupRecoveryPointBasedRestoreRequest") { + var out AzureBackupRecoveryPointBasedRestoreRequest + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AzureBackupRecoveryPointBasedRestoreRequest: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "AzureBackupRecoveryTimeBasedRestoreRequest") { + var out AzureBackupRecoveryTimeBasedRestoreRequest + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AzureBackupRecoveryTimeBasedRestoreRequest: %+v", err) + } + return out, nil + } + + type RawAzureBackupRestoreRequestImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawAzureBackupRestoreRequestImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_azureoperationalstoreparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_azureoperationalstoreparameters.go new file mode 100644 index 00000000000..f7daf43fe3e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_azureoperationalstoreparameters.go @@ -0,0 +1,42 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataStoreParameters = AzureOperationalStoreParameters{} + +type AzureOperationalStoreParameters struct { + ResourceGroupId *string `json:"resourceGroupId,omitempty"` + + // Fields inherited from DataStoreParameters + DataStoreType DataStoreTypes `json:"dataStoreType"` +} + +var _ json.Marshaler = AzureOperationalStoreParameters{} + +func (s AzureOperationalStoreParameters) MarshalJSON() ([]byte, error) { + type wrapper AzureOperationalStoreParameters + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AzureOperationalStoreParameters: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AzureOperationalStoreParameters: %+v", err) + } + decoded["objectType"] = "AzureOperationalStoreParameters" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AzureOperationalStoreParameters: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_backupinstance.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_backupinstance.go new file mode 100644 index 00000000000..da27fbc8c91 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_backupinstance.go @@ -0,0 +1,58 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupInstance struct { + CurrentProtectionState *CurrentProtectionState `json:"currentProtectionState,omitempty"` + DataSourceInfo Datasource `json:"dataSourceInfo"` + DataSourceSetInfo *DatasourceSet `json:"dataSourceSetInfo,omitempty"` + DatasourceAuthCredentials AuthCredentials `json:"datasourceAuthCredentials"` + FriendlyName *string `json:"friendlyName,omitempty"` + ObjectType string `json:"objectType"` + PolicyInfo PolicyInfo `json:"policyInfo"` + ProtectionErrorDetails *UserFacingError `json:"protectionErrorDetails,omitempty"` + ProtectionStatus *ProtectionStatusDetails `json:"protectionStatus,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ValidationType *ValidationType `json:"validationType,omitempty"` +} + +var _ json.Unmarshaler = &BackupInstance{} + +func (s *BackupInstance) UnmarshalJSON(bytes []byte) error { + type alias BackupInstance + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into BackupInstance: %+v", err) + } + + s.CurrentProtectionState = decoded.CurrentProtectionState + s.DataSourceInfo = decoded.DataSourceInfo + s.DataSourceSetInfo = decoded.DataSourceSetInfo + s.FriendlyName = decoded.FriendlyName + s.ObjectType = decoded.ObjectType + s.PolicyInfo = decoded.PolicyInfo + s.ProtectionErrorDetails = decoded.ProtectionErrorDetails + s.ProtectionStatus = decoded.ProtectionStatus + s.ProvisioningState = decoded.ProvisioningState + s.ValidationType = decoded.ValidationType + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling BackupInstance into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["datasourceAuthCredentials"]; ok { + impl, err := unmarshalAuthCredentialsImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'DatasourceAuthCredentials' for 'BackupInstance': %+v", err) + } + s.DatasourceAuthCredentials = impl + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_backupinstanceresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_backupinstanceresource.go new file mode 100644 index 00000000000..1b4dac59abe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_backupinstanceresource.go @@ -0,0 +1,16 @@ +package backupinstances + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupInstanceResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BackupInstance `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_datasource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_datasource.go new file mode 100644 index 00000000000..f54567895fd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_datasource.go @@ -0,0 +1,14 @@ +package backupinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Datasource struct { + DatasourceType *string `json:"datasourceType,omitempty"` + ObjectType *string `json:"objectType,omitempty"` + ResourceID string `json:"resourceID"` + ResourceLocation *string `json:"resourceLocation,omitempty"` + ResourceName *string `json:"resourceName,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + ResourceUri *string `json:"resourceUri,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_datasourceset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_datasourceset.go new file mode 100644 index 00000000000..665d80c0d14 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_datasourceset.go @@ -0,0 +1,14 @@ +package backupinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatasourceSet struct { + DatasourceType *string `json:"datasourceType,omitempty"` + ObjectType *string `json:"objectType,omitempty"` + ResourceID string `json:"resourceID"` + ResourceLocation *string `json:"resourceLocation,omitempty"` + ResourceName *string `json:"resourceName,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + ResourceUri *string `json:"resourceUri,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_datastoreparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_datastoreparameters.go new file mode 100644 index 00000000000..9795b15cfda --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_datastoreparameters.go @@ -0,0 +1,48 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataStoreParameters interface { +} + +func unmarshalDataStoreParametersImplementation(input []byte) (DataStoreParameters, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling DataStoreParameters into map[string]interface: %+v", err) + } + + value, ok := temp["objectType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "AzureOperationalStoreParameters") { + var out AzureOperationalStoreParameters + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AzureOperationalStoreParameters: %+v", err) + } + return out, nil + } + + type RawDataStoreParametersImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawDataStoreParametersImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_innererror.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_innererror.go new file mode 100644 index 00000000000..15fc997eebd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_innererror.go @@ -0,0 +1,10 @@ +package backupinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InnerError struct { + AdditionalInfo *map[string]string `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + EmbeddedInnerError *InnerError `json:"embeddedInnerError,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_itemlevelrestorecriteria.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_itemlevelrestorecriteria.go new file mode 100644 index 00000000000..2fb6da2664d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_itemlevelrestorecriteria.go @@ -0,0 +1,64 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ItemLevelRestoreCriteria interface { +} + +func unmarshalItemLevelRestoreCriteriaImplementation(input []byte) (ItemLevelRestoreCriteria, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling ItemLevelRestoreCriteria into map[string]interface: %+v", err) + } + + value, ok := temp["objectType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "KubernetesPVRestoreCriteria") { + var out KubernetesPVRestoreCriteria + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into KubernetesPVRestoreCriteria: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "KubernetesStorageClassRestoreCriteria") { + var out KubernetesStorageClassRestoreCriteria + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into KubernetesStorageClassRestoreCriteria: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "RangeBasedItemLevelRestoreCriteria") { + var out RangeBasedItemLevelRestoreCriteria + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into RangeBasedItemLevelRestoreCriteria: %+v", err) + } + return out, nil + } + + type RawItemLevelRestoreCriteriaImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawItemLevelRestoreCriteriaImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_itemlevelrestoretargetinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_itemlevelrestoretargetinfo.go new file mode 100644 index 00000000000..475d8764212 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_itemlevelrestoretargetinfo.go @@ -0,0 +1,92 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ RestoreTargetInfoBase = ItemLevelRestoreTargetInfo{} + +type ItemLevelRestoreTargetInfo struct { + DatasourceAuthCredentials AuthCredentials `json:"datasourceAuthCredentials"` + DatasourceInfo Datasource `json:"datasourceInfo"` + DatasourceSetInfo *DatasourceSet `json:"datasourceSetInfo,omitempty"` + RestoreCriteria []ItemLevelRestoreCriteria `json:"restoreCriteria"` + + // Fields inherited from RestoreTargetInfoBase + RecoveryOption RecoveryOption `json:"recoveryOption"` + RestoreLocation *string `json:"restoreLocation,omitempty"` +} + +var _ json.Marshaler = ItemLevelRestoreTargetInfo{} + +func (s ItemLevelRestoreTargetInfo) MarshalJSON() ([]byte, error) { + type wrapper ItemLevelRestoreTargetInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ItemLevelRestoreTargetInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ItemLevelRestoreTargetInfo: %+v", err) + } + decoded["objectType"] = "ItemLevelRestoreTargetInfo" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ItemLevelRestoreTargetInfo: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &ItemLevelRestoreTargetInfo{} + +func (s *ItemLevelRestoreTargetInfo) UnmarshalJSON(bytes []byte) error { + type alias ItemLevelRestoreTargetInfo + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into ItemLevelRestoreTargetInfo: %+v", err) + } + + s.DatasourceInfo = decoded.DatasourceInfo + s.DatasourceSetInfo = decoded.DatasourceSetInfo + s.RecoveryOption = decoded.RecoveryOption + s.RestoreLocation = decoded.RestoreLocation + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling ItemLevelRestoreTargetInfo into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["datasourceAuthCredentials"]; ok { + impl, err := unmarshalAuthCredentialsImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'DatasourceAuthCredentials' for 'ItemLevelRestoreTargetInfo': %+v", err) + } + s.DatasourceAuthCredentials = impl + } + + if v, ok := temp["restoreCriteria"]; ok { + var listTemp []json.RawMessage + if err := json.Unmarshal(v, &listTemp); err != nil { + return fmt.Errorf("unmarshaling RestoreCriteria into list []json.RawMessage: %+v", err) + } + + output := make([]ItemLevelRestoreCriteria, 0) + for i, val := range listTemp { + impl, err := unmarshalItemLevelRestoreCriteriaImplementation(val) + if err != nil { + return fmt.Errorf("unmarshaling index %d field 'RestoreCriteria' for 'ItemLevelRestoreTargetInfo': %+v", i, err) + } + output = append(output, impl) + } + s.RestoreCriteria = output + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_kubernetespvrestorecriteria.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_kubernetespvrestorecriteria.go new file mode 100644 index 00000000000..0f3d56cbfeb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_kubernetespvrestorecriteria.go @@ -0,0 +1,42 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ItemLevelRestoreCriteria = KubernetesPVRestoreCriteria{} + +type KubernetesPVRestoreCriteria struct { + Name *string `json:"name,omitempty"` + StorageClassName *string `json:"storageClassName,omitempty"` + + // Fields inherited from ItemLevelRestoreCriteria +} + +var _ json.Marshaler = KubernetesPVRestoreCriteria{} + +func (s KubernetesPVRestoreCriteria) MarshalJSON() ([]byte, error) { + type wrapper KubernetesPVRestoreCriteria + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling KubernetesPVRestoreCriteria: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling KubernetesPVRestoreCriteria: %+v", err) + } + decoded["objectType"] = "KubernetesPVRestoreCriteria" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling KubernetesPVRestoreCriteria: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_kubernetesstorageclassrestorecriteria.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_kubernetesstorageclassrestorecriteria.go new file mode 100644 index 00000000000..d4b08aa1e6f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_kubernetesstorageclassrestorecriteria.go @@ -0,0 +1,42 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ItemLevelRestoreCriteria = KubernetesStorageClassRestoreCriteria{} + +type KubernetesStorageClassRestoreCriteria struct { + Provisioner *string `json:"provisioner,omitempty"` + SelectedStorageClassName *string `json:"selectedStorageClassName,omitempty"` + + // Fields inherited from ItemLevelRestoreCriteria +} + +var _ json.Marshaler = KubernetesStorageClassRestoreCriteria{} + +func (s KubernetesStorageClassRestoreCriteria) MarshalJSON() ([]byte, error) { + type wrapper KubernetesStorageClassRestoreCriteria + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling KubernetesStorageClassRestoreCriteria: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling KubernetesStorageClassRestoreCriteria: %+v", err) + } + decoded["objectType"] = "KubernetesStorageClassRestoreCriteria" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling KubernetesStorageClassRestoreCriteria: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_operationextendedinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_operationextendedinfo.go new file mode 100644 index 00000000000..571a81265b1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_operationextendedinfo.go @@ -0,0 +1,48 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OperationExtendedInfo interface { +} + +func unmarshalOperationExtendedInfoImplementation(input []byte) (OperationExtendedInfo, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling OperationExtendedInfo into map[string]interface: %+v", err) + } + + value, ok := temp["objectType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "OperationJobExtendedInfo") { + var out OperationJobExtendedInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into OperationJobExtendedInfo: %+v", err) + } + return out, nil + } + + type RawOperationExtendedInfoImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawOperationExtendedInfoImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_operationjobextendedinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_operationjobextendedinfo.go new file mode 100644 index 00000000000..59cd3f9ddf6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_operationjobextendedinfo.go @@ -0,0 +1,41 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ OperationExtendedInfo = OperationJobExtendedInfo{} + +type OperationJobExtendedInfo struct { + JobId *string `json:"jobId,omitempty"` + + // Fields inherited from OperationExtendedInfo +} + +var _ json.Marshaler = OperationJobExtendedInfo{} + +func (s OperationJobExtendedInfo) MarshalJSON() ([]byte, error) { + type wrapper OperationJobExtendedInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling OperationJobExtendedInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling OperationJobExtendedInfo: %+v", err) + } + decoded["objectType"] = "OperationJobExtendedInfo" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling OperationJobExtendedInfo: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_policyinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_policyinfo.go new file mode 100644 index 00000000000..41646c6341d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_policyinfo.go @@ -0,0 +1,10 @@ +package backupinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyInfo struct { + PolicyId string `json:"policyId"` + PolicyParameters *PolicyParameters `json:"policyParameters,omitempty"` + PolicyVersion *string `json:"policyVersion,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_policyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_policyparameters.go new file mode 100644 index 00000000000..8116d662aa2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_policyparameters.go @@ -0,0 +1,41 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicyParameters struct { + DataStoreParametersList *[]DataStoreParameters `json:"dataStoreParametersList,omitempty"` +} + +var _ json.Unmarshaler = &PolicyParameters{} + +func (s *PolicyParameters) UnmarshalJSON(bytes []byte) error { + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling PolicyParameters into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["dataStoreParametersList"]; ok { + var listTemp []json.RawMessage + if err := json.Unmarshal(v, &listTemp); err != nil { + return fmt.Errorf("unmarshaling DataStoreParametersList into list []json.RawMessage: %+v", err) + } + + output := make([]DataStoreParameters, 0) + for i, val := range listTemp { + impl, err := unmarshalDataStoreParametersImplementation(val) + if err != nil { + return fmt.Errorf("unmarshaling index %d field 'DataStoreParametersList' for 'PolicyParameters': %+v", i, err) + } + output = append(output, impl) + } + s.DataStoreParametersList = &output + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_protectionstatusdetails.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_protectionstatusdetails.go new file mode 100644 index 00000000000..47607ca70da --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_protectionstatusdetails.go @@ -0,0 +1,9 @@ +package backupinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProtectionStatusDetails struct { + ErrorDetails *UserFacingError `json:"errorDetails,omitempty"` + Status *Status `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_rangebaseditemlevelrestorecriteria.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_rangebaseditemlevelrestorecriteria.go new file mode 100644 index 00000000000..c7df0c52c2b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_rangebaseditemlevelrestorecriteria.go @@ -0,0 +1,42 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ItemLevelRestoreCriteria = RangeBasedItemLevelRestoreCriteria{} + +type RangeBasedItemLevelRestoreCriteria struct { + MaxMatchingValue *string `json:"maxMatchingValue,omitempty"` + MinMatchingValue *string `json:"minMatchingValue,omitempty"` + + // Fields inherited from ItemLevelRestoreCriteria +} + +var _ json.Marshaler = RangeBasedItemLevelRestoreCriteria{} + +func (s RangeBasedItemLevelRestoreCriteria) MarshalJSON() ([]byte, error) { + type wrapper RangeBasedItemLevelRestoreCriteria + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling RangeBasedItemLevelRestoreCriteria: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling RangeBasedItemLevelRestoreCriteria: %+v", err) + } + decoded["objectType"] = "RangeBasedItemLevelRestoreCriteria" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling RangeBasedItemLevelRestoreCriteria: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_restorefilestargetinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_restorefilestargetinfo.go new file mode 100644 index 00000000000..04fe194025c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_restorefilestargetinfo.go @@ -0,0 +1,43 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ RestoreTargetInfoBase = RestoreFilesTargetInfo{} + +type RestoreFilesTargetInfo struct { + TargetDetails TargetDetails `json:"targetDetails"` + + // Fields inherited from RestoreTargetInfoBase + RecoveryOption RecoveryOption `json:"recoveryOption"` + RestoreLocation *string `json:"restoreLocation,omitempty"` +} + +var _ json.Marshaler = RestoreFilesTargetInfo{} + +func (s RestoreFilesTargetInfo) MarshalJSON() ([]byte, error) { + type wrapper RestoreFilesTargetInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling RestoreFilesTargetInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling RestoreFilesTargetInfo: %+v", err) + } + decoded["objectType"] = "RestoreFilesTargetInfo" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling RestoreFilesTargetInfo: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_restoretargetinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_restoretargetinfo.go new file mode 100644 index 00000000000..23f512f2c31 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_restoretargetinfo.go @@ -0,0 +1,74 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ RestoreTargetInfoBase = RestoreTargetInfo{} + +type RestoreTargetInfo struct { + DatasourceAuthCredentials AuthCredentials `json:"datasourceAuthCredentials"` + DatasourceInfo Datasource `json:"datasourceInfo"` + DatasourceSetInfo *DatasourceSet `json:"datasourceSetInfo,omitempty"` + + // Fields inherited from RestoreTargetInfoBase + RecoveryOption RecoveryOption `json:"recoveryOption"` + RestoreLocation *string `json:"restoreLocation,omitempty"` +} + +var _ json.Marshaler = RestoreTargetInfo{} + +func (s RestoreTargetInfo) MarshalJSON() ([]byte, error) { + type wrapper RestoreTargetInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling RestoreTargetInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling RestoreTargetInfo: %+v", err) + } + decoded["objectType"] = "RestoreTargetInfo" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling RestoreTargetInfo: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &RestoreTargetInfo{} + +func (s *RestoreTargetInfo) UnmarshalJSON(bytes []byte) error { + type alias RestoreTargetInfo + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into RestoreTargetInfo: %+v", err) + } + + s.DatasourceInfo = decoded.DatasourceInfo + s.DatasourceSetInfo = decoded.DatasourceSetInfo + s.RecoveryOption = decoded.RecoveryOption + s.RestoreLocation = decoded.RestoreLocation + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling RestoreTargetInfo into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["datasourceAuthCredentials"]; ok { + impl, err := unmarshalAuthCredentialsImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'DatasourceAuthCredentials' for 'RestoreTargetInfo': %+v", err) + } + s.DatasourceAuthCredentials = impl + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_restoretargetinfobase.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_restoretargetinfobase.go new file mode 100644 index 00000000000..795167a5a3b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_restoretargetinfobase.go @@ -0,0 +1,64 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestoreTargetInfoBase interface { +} + +func unmarshalRestoreTargetInfoBaseImplementation(input []byte) (RestoreTargetInfoBase, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling RestoreTargetInfoBase into map[string]interface: %+v", err) + } + + value, ok := temp["objectType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "ItemLevelRestoreTargetInfo") { + var out ItemLevelRestoreTargetInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ItemLevelRestoreTargetInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "RestoreFilesTargetInfo") { + var out RestoreFilesTargetInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into RestoreFilesTargetInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "RestoreTargetInfo") { + var out RestoreTargetInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into RestoreTargetInfo: %+v", err) + } + return out, nil + } + + type RawRestoreTargetInfoBaseImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawRestoreTargetInfoBaseImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_secretstorebasedauthcredentials.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_secretstorebasedauthcredentials.go new file mode 100644 index 00000000000..76f2af98598 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_secretstorebasedauthcredentials.go @@ -0,0 +1,41 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AuthCredentials = SecretStoreBasedAuthCredentials{} + +type SecretStoreBasedAuthCredentials struct { + SecretStoreResource *SecretStoreResource `json:"secretStoreResource,omitempty"` + + // Fields inherited from AuthCredentials +} + +var _ json.Marshaler = SecretStoreBasedAuthCredentials{} + +func (s SecretStoreBasedAuthCredentials) MarshalJSON() ([]byte, error) { + type wrapper SecretStoreBasedAuthCredentials + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SecretStoreBasedAuthCredentials: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SecretStoreBasedAuthCredentials: %+v", err) + } + decoded["objectType"] = "SecretStoreBasedAuthCredentials" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SecretStoreBasedAuthCredentials: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_secretstoreresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_secretstoreresource.go new file mode 100644 index 00000000000..ee1d6fb0bd9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_secretstoreresource.go @@ -0,0 +1,10 @@ +package backupinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecretStoreResource struct { + SecretStoreType SecretStoreType `json:"secretStoreType"` + Uri *string `json:"uri,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_syncbackupinstancerequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_syncbackupinstancerequest.go new file mode 100644 index 00000000000..ce2412fb5e5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_syncbackupinstancerequest.go @@ -0,0 +1,8 @@ +package backupinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SyncBackupInstanceRequest struct { + SyncType *SyncType `json:"syncType,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_targetdetails.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_targetdetails.go new file mode 100644 index 00000000000..78ddf484ca0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_targetdetails.go @@ -0,0 +1,10 @@ +package backupinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TargetDetails struct { + FilePrefix string `json:"filePrefix"` + RestoreTargetLocationType RestoreTargetLocationType `json:"restoreTargetLocationType"` + Url string `json:"url"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_triggerbackuprequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_triggerbackuprequest.go new file mode 100644 index 00000000000..ffe844c6e4a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_triggerbackuprequest.go @@ -0,0 +1,8 @@ +package backupinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TriggerBackupRequest struct { + BackupRuleOptions AdHocBackupRuleOptions `json:"backupRuleOptions"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_userfacingerror.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_userfacingerror.go new file mode 100644 index 00000000000..e3afc757301 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_userfacingerror.go @@ -0,0 +1,16 @@ +package backupinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserFacingError struct { + Code *string `json:"code,omitempty"` + Details *[]UserFacingError `json:"details,omitempty"` + InnerError *InnerError `json:"innerError,omitempty"` + IsRetryable *bool `json:"isRetryable,omitempty"` + IsUserError *bool `json:"isUserError,omitempty"` + Message *string `json:"message,omitempty"` + Properties *map[string]string `json:"properties,omitempty"` + RecommendedAction *[]string `json:"recommendedAction,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_validateforbackuprequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_validateforbackuprequest.go new file mode 100644 index 00000000000..92af8c34ee0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_validateforbackuprequest.go @@ -0,0 +1,8 @@ +package backupinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateForBackupRequest struct { + BackupInstance BackupInstance `json:"backupInstance"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_validaterestorerequestobject.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_validaterestorerequestobject.go new file mode 100644 index 00000000000..e59fe83da41 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/model_validaterestorerequestobject.go @@ -0,0 +1,32 @@ +package backupinstances + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateRestoreRequestObject struct { + RestoreRequestObject AzureBackupRestoreRequest `json:"restoreRequestObject"` +} + +var _ json.Unmarshaler = &ValidateRestoreRequestObject{} + +func (s *ValidateRestoreRequestObject) UnmarshalJSON(bytes []byte) error { + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling ValidateRestoreRequestObject into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["restoreRequestObject"]; ok { + impl, err := unmarshalAzureBackupRestoreRequestImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'RestoreRequestObject' for 'ValidateRestoreRequestObject': %+v", err) + } + s.RestoreRequestObject = impl + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/predicates.go new file mode 100644 index 00000000000..5be902a651a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/predicates.go @@ -0,0 +1,24 @@ +package backupinstances + +type BackupInstanceResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p BackupInstanceResourceOperationPredicate) Matches(input BackupInstanceResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/version.go new file mode 100644 index 00000000000..0d7abfc24d2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances/version.go @@ -0,0 +1,12 @@ +package backupinstances + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/backupinstances/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/README.md new file mode 100644 index 00000000000..8de25d8c9e7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies` Documentation + +The `backuppolicies` SDK allows for interaction with the Azure Resource Manager Service `dataprotection` (API Version `2022-04-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies" +``` + + +### Client Initialization + +```go +client := backuppolicies.NewBackupPoliciesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `BackupPoliciesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := backuppolicies.NewBackupPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupPolicyValue") + +payload := backuppolicies.BaseBackupPolicyResource{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupPoliciesClient.Delete` + +```go +ctx := context.TODO() +id := backuppolicies.NewBackupPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupPolicyValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupPoliciesClient.Get` + +```go +ctx := context.TODO() +id := backuppolicies.NewBackupPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue", "backupPolicyValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupPoliciesClient.List` + +```go +ctx := context.TODO() +id := backuppolicies.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/client.go new file mode 100644 index 00000000000..c8b3aad1674 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/client.go @@ -0,0 +1,18 @@ +package backuppolicies + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupPoliciesClient struct { + Client autorest.Client + baseUri string +} + +func NewBackupPoliciesClientWithBaseURI(endpoint string) BackupPoliciesClient { + return BackupPoliciesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/constants.go new file mode 100644 index 00000000000..db046729ed2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/constants.go @@ -0,0 +1,212 @@ +package backuppolicies + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AbsoluteMarker string + +const ( + AbsoluteMarkerAllBackup AbsoluteMarker = "AllBackup" + AbsoluteMarkerFirstOfDay AbsoluteMarker = "FirstOfDay" + AbsoluteMarkerFirstOfMonth AbsoluteMarker = "FirstOfMonth" + AbsoluteMarkerFirstOfWeek AbsoluteMarker = "FirstOfWeek" + AbsoluteMarkerFirstOfYear AbsoluteMarker = "FirstOfYear" +) + +func PossibleValuesForAbsoluteMarker() []string { + return []string{ + string(AbsoluteMarkerAllBackup), + string(AbsoluteMarkerFirstOfDay), + string(AbsoluteMarkerFirstOfMonth), + string(AbsoluteMarkerFirstOfWeek), + string(AbsoluteMarkerFirstOfYear), + } +} + +func parseAbsoluteMarker(input string) (*AbsoluteMarker, error) { + vals := map[string]AbsoluteMarker{ + "allbackup": AbsoluteMarkerAllBackup, + "firstofday": AbsoluteMarkerFirstOfDay, + "firstofmonth": AbsoluteMarkerFirstOfMonth, + "firstofweek": AbsoluteMarkerFirstOfWeek, + "firstofyear": AbsoluteMarkerFirstOfYear, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AbsoluteMarker(input) + return &out, nil +} + +type DataStoreTypes string + +const ( + DataStoreTypesArchiveStore DataStoreTypes = "ArchiveStore" + DataStoreTypesOperationalStore DataStoreTypes = "OperationalStore" + DataStoreTypesVaultStore DataStoreTypes = "VaultStore" +) + +func PossibleValuesForDataStoreTypes() []string { + return []string{ + string(DataStoreTypesArchiveStore), + string(DataStoreTypesOperationalStore), + string(DataStoreTypesVaultStore), + } +} + +func parseDataStoreTypes(input string) (*DataStoreTypes, error) { + vals := map[string]DataStoreTypes{ + "archivestore": DataStoreTypesArchiveStore, + "operationalstore": DataStoreTypesOperationalStore, + "vaultstore": DataStoreTypesVaultStore, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DataStoreTypes(input) + return &out, nil +} + +type DayOfWeek string + +const ( + DayOfWeekFriday DayOfWeek = "Friday" + DayOfWeekMonday DayOfWeek = "Monday" + DayOfWeekSaturday DayOfWeek = "Saturday" + DayOfWeekSunday DayOfWeek = "Sunday" + DayOfWeekThursday DayOfWeek = "Thursday" + DayOfWeekTuesday DayOfWeek = "Tuesday" + DayOfWeekWednesday DayOfWeek = "Wednesday" +) + +func PossibleValuesForDayOfWeek() []string { + return []string{ + string(DayOfWeekFriday), + string(DayOfWeekMonday), + string(DayOfWeekSaturday), + string(DayOfWeekSunday), + string(DayOfWeekThursday), + string(DayOfWeekTuesday), + string(DayOfWeekWednesday), + } +} + +func parseDayOfWeek(input string) (*DayOfWeek, error) { + vals := map[string]DayOfWeek{ + "friday": DayOfWeekFriday, + "monday": DayOfWeekMonday, + "saturday": DayOfWeekSaturday, + "sunday": DayOfWeekSunday, + "thursday": DayOfWeekThursday, + "tuesday": DayOfWeekTuesday, + "wednesday": DayOfWeekWednesday, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DayOfWeek(input) + return &out, nil +} + +type Month string + +const ( + MonthApril Month = "April" + MonthAugust Month = "August" + MonthDecember Month = "December" + MonthFebruary Month = "February" + MonthJanuary Month = "January" + MonthJuly Month = "July" + MonthJune Month = "June" + MonthMarch Month = "March" + MonthMay Month = "May" + MonthNovember Month = "November" + MonthOctober Month = "October" + MonthSeptember Month = "September" +) + +func PossibleValuesForMonth() []string { + return []string{ + string(MonthApril), + string(MonthAugust), + string(MonthDecember), + string(MonthFebruary), + string(MonthJanuary), + string(MonthJuly), + string(MonthJune), + string(MonthMarch), + string(MonthMay), + string(MonthNovember), + string(MonthOctober), + string(MonthSeptember), + } +} + +func parseMonth(input string) (*Month, error) { + vals := map[string]Month{ + "april": MonthApril, + "august": MonthAugust, + "december": MonthDecember, + "february": MonthFebruary, + "january": MonthJanuary, + "july": MonthJuly, + "june": MonthJune, + "march": MonthMarch, + "may": MonthMay, + "november": MonthNovember, + "october": MonthOctober, + "september": MonthSeptember, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Month(input) + return &out, nil +} + +type WeekNumber string + +const ( + WeekNumberFirst WeekNumber = "First" + WeekNumberFourth WeekNumber = "Fourth" + WeekNumberLast WeekNumber = "Last" + WeekNumberSecond WeekNumber = "Second" + WeekNumberThird WeekNumber = "Third" +) + +func PossibleValuesForWeekNumber() []string { + return []string{ + string(WeekNumberFirst), + string(WeekNumberFourth), + string(WeekNumberLast), + string(WeekNumberSecond), + string(WeekNumberThird), + } +} + +func parseWeekNumber(input string) (*WeekNumber, error) { + vals := map[string]WeekNumber{ + "first": WeekNumberFirst, + "fourth": WeekNumberFourth, + "last": WeekNumberLast, + "second": WeekNumberSecond, + "third": WeekNumberThird, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WeekNumber(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backuppolicies.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backuppolicies.go new file mode 100644 index 00000000000..e40bdd7856f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backuppolicies.go @@ -0,0 +1,137 @@ +package backuppolicies + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = BackupPoliciesId{} + +// BackupPoliciesId is a struct representing the Resource ID for a Backup Policies +type BackupPoliciesId struct { + SubscriptionId string + ResourceGroupName string + VaultName string + BackupPolicyName string +} + +// NewBackupPoliciesID returns a new BackupPoliciesId struct +func NewBackupPoliciesID(subscriptionId string, resourceGroupName string, vaultName string, backupPolicyName string) BackupPoliciesId { + return BackupPoliciesId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + BackupPolicyName: backupPolicyName, + } +} + +// ParseBackupPoliciesID parses 'input' into a BackupPoliciesId +func ParseBackupPoliciesID(input string) (*BackupPoliciesId, error) { + parser := resourceids.NewParserFromResourceIdType(BackupPoliciesId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BackupPoliciesId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { + return nil, fmt.Errorf("the segment 'backupPolicyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseBackupPoliciesIDInsensitively parses 'input' case-insensitively into a BackupPoliciesId +// note: this method should only be used for API response data and not user input +func ParseBackupPoliciesIDInsensitively(input string) (*BackupPoliciesId, error) { + parser := resourceids.NewParserFromResourceIdType(BackupPoliciesId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BackupPoliciesId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { + return nil, fmt.Errorf("the segment 'backupPolicyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateBackupPoliciesID checks that 'input' can be parsed as a Backup Policies ID +func ValidateBackupPoliciesID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseBackupPoliciesID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Backup Policies ID +func (id BackupPoliciesId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/backupVaults/%s/backupPolicies/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.BackupPolicyName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Backup Policies ID +func (id BackupPoliciesId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), + resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + resourceids.StaticSegment("staticBackupPolicies", "backupPolicies", "backupPolicies"), + resourceids.UserSpecifiedSegment("backupPolicyName", "backupPolicyValue"), + } +} + +// String returns a human-readable description of this Backup Policies ID +func (id BackupPoliciesId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Backup Policy Name: %q", id.BackupPolicyName), + } + return fmt.Sprintf("Backup Policies (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backupvault.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backupvault.go new file mode 100644 index 00000000000..17954d3b4e9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backupvault.go @@ -0,0 +1,124 @@ +package backuppolicies + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = BackupVaultId{} + +// BackupVaultId is a struct representing the Resource ID for a Backup Vault +type BackupVaultId struct { + SubscriptionId string + ResourceGroupName string + VaultName string +} + +// NewBackupVaultID returns a new BackupVaultId struct +func NewBackupVaultID(subscriptionId string, resourceGroupName string, vaultName string) BackupVaultId { + return BackupVaultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + } +} + +// ParseBackupVaultID parses 'input' into a BackupVaultId +func ParseBackupVaultID(input string) (*BackupVaultId, error) { + parser := resourceids.NewParserFromResourceIdType(BackupVaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BackupVaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseBackupVaultIDInsensitively parses 'input' case-insensitively into a BackupVaultId +// note: this method should only be used for API response data and not user input +func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { + parser := resourceids.NewParserFromResourceIdType(BackupVaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BackupVaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID +func ValidateBackupVaultID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseBackupVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Backup Vault ID +func (id BackupVaultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/backupVaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Backup Vault ID +func (id BackupVaultId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), + resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + } +} + +// String returns a human-readable description of this Backup Vault ID +func (id BackupVaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + } + return fmt.Sprintf("Backup Vault (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/method_createorupdate_autorest.go new file mode 100644 index 00000000000..3d08975c03b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package backuppolicies + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *BaseBackupPolicyResource +} + +// CreateOrUpdate ... +func (c BackupPoliciesClient) CreateOrUpdate(ctx context.Context, id BackupPoliciesId, input BaseBackupPolicyResource) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backuppolicies.BackupPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backuppolicies.BackupPoliciesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backuppolicies.BackupPoliciesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c BackupPoliciesClient) preparerForCreateOrUpdate(ctx context.Context, id BackupPoliciesId, input BaseBackupPolicyResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c BackupPoliciesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/method_delete_autorest.go new file mode 100644 index 00000000000..66aae24586c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/method_delete_autorest.go @@ -0,0 +1,66 @@ +package backuppolicies + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c BackupPoliciesClient) Delete(ctx context.Context, id BackupPoliciesId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backuppolicies.BackupPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backuppolicies.BackupPoliciesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backuppolicies.BackupPoliciesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c BackupPoliciesClient) preparerForDelete(ctx context.Context, id BackupPoliciesId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c BackupPoliciesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/method_get_autorest.go new file mode 100644 index 00000000000..08c09e30f7a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/method_get_autorest.go @@ -0,0 +1,68 @@ +package backuppolicies + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *BaseBackupPolicyResource +} + +// Get ... +func (c BackupPoliciesClient) Get(ctx context.Context, id BackupPoliciesId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backuppolicies.BackupPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backuppolicies.BackupPoliciesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backuppolicies.BackupPoliciesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c BackupPoliciesClient) preparerForGet(ctx context.Context, id BackupPoliciesId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c BackupPoliciesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/method_list_autorest.go new file mode 100644 index 00000000000..e3b7b2bac48 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/method_list_autorest.go @@ -0,0 +1,186 @@ +package backuppolicies + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]BaseBackupPolicyResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []BaseBackupPolicyResource +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c BackupPoliciesClient) List(ctx context.Context, id BackupVaultId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backuppolicies.BackupPoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backuppolicies.BackupPoliciesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backuppolicies.BackupPoliciesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c BackupPoliciesClient) preparerForList(ctx context.Context, id BackupVaultId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/backupPolicies", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c BackupPoliciesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c BackupPoliciesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []BaseBackupPolicyResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "backuppolicies.BackupPoliciesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backuppolicies.BackupPoliciesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backuppolicies.BackupPoliciesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c BackupPoliciesClient) ListComplete(ctx context.Context, id BackupVaultId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, BaseBackupPolicyResourceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BackupPoliciesClient) ListCompleteMatchingPredicate(ctx context.Context, id BackupVaultId, predicate BaseBackupPolicyResourceOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]BaseBackupPolicyResource, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_absolutedeleteoption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_absolutedeleteoption.go new file mode 100644 index 00000000000..a9aaf47dcb7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_absolutedeleteoption.go @@ -0,0 +1,41 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DeleteOption = AbsoluteDeleteOption{} + +type AbsoluteDeleteOption struct { + + // Fields inherited from DeleteOption + Duration string `json:"duration"` +} + +var _ json.Marshaler = AbsoluteDeleteOption{} + +func (s AbsoluteDeleteOption) MarshalJSON() ([]byte, error) { + type wrapper AbsoluteDeleteOption + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AbsoluteDeleteOption: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AbsoluteDeleteOption: %+v", err) + } + decoded["objectType"] = "AbsoluteDeleteOption" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AbsoluteDeleteOption: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_adhocbasedtaggingcriteria.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_adhocbasedtaggingcriteria.go new file mode 100644 index 00000000000..e74b150de31 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_adhocbasedtaggingcriteria.go @@ -0,0 +1,8 @@ +package backuppolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdhocBasedTaggingCriteria struct { + TagInfo *RetentionTag `json:"tagInfo,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_adhocbasedtriggercontext.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_adhocbasedtriggercontext.go new file mode 100644 index 00000000000..5505a40b8a6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_adhocbasedtriggercontext.go @@ -0,0 +1,41 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ TriggerContext = AdhocBasedTriggerContext{} + +type AdhocBasedTriggerContext struct { + TaggingCriteria AdhocBasedTaggingCriteria `json:"taggingCriteria"` + + // Fields inherited from TriggerContext +} + +var _ json.Marshaler = AdhocBasedTriggerContext{} + +func (s AdhocBasedTriggerContext) MarshalJSON() ([]byte, error) { + type wrapper AdhocBasedTriggerContext + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AdhocBasedTriggerContext: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AdhocBasedTriggerContext: %+v", err) + } + decoded["objectType"] = "AdhocBasedTriggerContext" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AdhocBasedTriggerContext: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_azurebackupparams.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_azurebackupparams.go new file mode 100644 index 00000000000..024401c3d86 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_azurebackupparams.go @@ -0,0 +1,41 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ BackupParameters = AzureBackupParams{} + +type AzureBackupParams struct { + BackupType string `json:"backupType"` + + // Fields inherited from BackupParameters +} + +var _ json.Marshaler = AzureBackupParams{} + +func (s AzureBackupParams) MarshalJSON() ([]byte, error) { + type wrapper AzureBackupParams + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AzureBackupParams: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AzureBackupParams: %+v", err) + } + decoded["objectType"] = "AzureBackupParams" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AzureBackupParams: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_azurebackuprule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_azurebackuprule.go new file mode 100644 index 00000000000..884536bf720 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_azurebackuprule.go @@ -0,0 +1,79 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ BasePolicyRule = AzureBackupRule{} + +type AzureBackupRule struct { + BackupParameters BackupParameters `json:"backupParameters"` + DataStore DataStoreInfoBase `json:"dataStore"` + Trigger TriggerContext `json:"trigger"` + + // Fields inherited from BasePolicyRule + Name string `json:"name"` +} + +var _ json.Marshaler = AzureBackupRule{} + +func (s AzureBackupRule) MarshalJSON() ([]byte, error) { + type wrapper AzureBackupRule + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AzureBackupRule: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AzureBackupRule: %+v", err) + } + decoded["objectType"] = "AzureBackupRule" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AzureBackupRule: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &AzureBackupRule{} + +func (s *AzureBackupRule) UnmarshalJSON(bytes []byte) error { + type alias AzureBackupRule + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into AzureBackupRule: %+v", err) + } + + s.DataStore = decoded.DataStore + s.Name = decoded.Name + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AzureBackupRule into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["backupParameters"]; ok { + impl, err := unmarshalBackupParametersImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'BackupParameters' for 'AzureBackupRule': %+v", err) + } + s.BackupParameters = impl + } + + if v, ok := temp["trigger"]; ok { + impl, err := unmarshalTriggerContextImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Trigger' for 'AzureBackupRule': %+v", err) + } + s.Trigger = impl + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_azureretentionrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_azureretentionrule.go new file mode 100644 index 00000000000..1362ef8628d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_azureretentionrule.go @@ -0,0 +1,43 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ BasePolicyRule = AzureRetentionRule{} + +type AzureRetentionRule struct { + IsDefault *bool `json:"isDefault,omitempty"` + Lifecycles []SourceLifeCycle `json:"lifecycles"` + + // Fields inherited from BasePolicyRule + Name string `json:"name"` +} + +var _ json.Marshaler = AzureRetentionRule{} + +func (s AzureRetentionRule) MarshalJSON() ([]byte, error) { + type wrapper AzureRetentionRule + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AzureRetentionRule: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AzureRetentionRule: %+v", err) + } + decoded["objectType"] = "AzureRetentionRule" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AzureRetentionRule: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_backupcriteria.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_backupcriteria.go new file mode 100644 index 00000000000..528250d0870 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_backupcriteria.go @@ -0,0 +1,48 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupCriteria interface { +} + +func unmarshalBackupCriteriaImplementation(input []byte) (BackupCriteria, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling BackupCriteria into map[string]interface: %+v", err) + } + + value, ok := temp["objectType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "ScheduleBasedBackupCriteria") { + var out ScheduleBasedBackupCriteria + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ScheduleBasedBackupCriteria: %+v", err) + } + return out, nil + } + + type RawBackupCriteriaImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawBackupCriteriaImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_backupparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_backupparameters.go new file mode 100644 index 00000000000..a0cb6b27bb8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_backupparameters.go @@ -0,0 +1,48 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupParameters interface { +} + +func unmarshalBackupParametersImplementation(input []byte) (BackupParameters, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling BackupParameters into map[string]interface: %+v", err) + } + + value, ok := temp["objectType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "AzureBackupParams") { + var out AzureBackupParams + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AzureBackupParams: %+v", err) + } + return out, nil + } + + type RawBackupParametersImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawBackupParametersImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_backuppolicy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_backuppolicy.go new file mode 100644 index 00000000000..5b770c9a733 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_backuppolicy.go @@ -0,0 +1,77 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ BaseBackupPolicy = BackupPolicy{} + +type BackupPolicy struct { + PolicyRules []BasePolicyRule `json:"policyRules"` + + // Fields inherited from BaseBackupPolicy + DatasourceTypes []string `json:"datasourceTypes"` +} + +var _ json.Marshaler = BackupPolicy{} + +func (s BackupPolicy) MarshalJSON() ([]byte, error) { + type wrapper BackupPolicy + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling BackupPolicy: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling BackupPolicy: %+v", err) + } + decoded["objectType"] = "BackupPolicy" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling BackupPolicy: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &BackupPolicy{} + +func (s *BackupPolicy) UnmarshalJSON(bytes []byte) error { + type alias BackupPolicy + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into BackupPolicy: %+v", err) + } + + s.DatasourceTypes = decoded.DatasourceTypes + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling BackupPolicy into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["policyRules"]; ok { + var listTemp []json.RawMessage + if err := json.Unmarshal(v, &listTemp); err != nil { + return fmt.Errorf("unmarshaling PolicyRules into list []json.RawMessage: %+v", err) + } + + output := make([]BasePolicyRule, 0) + for i, val := range listTemp { + impl, err := unmarshalBasePolicyRuleImplementation(val) + if err != nil { + return fmt.Errorf("unmarshaling index %d field 'PolicyRules' for 'BackupPolicy': %+v", i, err) + } + output = append(output, impl) + } + s.PolicyRules = output + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_backupschedule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_backupschedule.go new file mode 100644 index 00000000000..47d41f51d4c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_backupschedule.go @@ -0,0 +1,9 @@ +package backuppolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupSchedule struct { + RepeatingTimeIntervals []string `json:"repeatingTimeIntervals"` + TimeZone *string `json:"timeZone,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_basebackuppolicy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_basebackuppolicy.go new file mode 100644 index 00000000000..b4dea63ff96 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_basebackuppolicy.go @@ -0,0 +1,48 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BaseBackupPolicy interface { +} + +func unmarshalBaseBackupPolicyImplementation(input []byte) (BaseBackupPolicy, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling BaseBackupPolicy into map[string]interface: %+v", err) + } + + value, ok := temp["objectType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "BackupPolicy") { + var out BackupPolicy + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into BackupPolicy: %+v", err) + } + return out, nil + } + + type RawBaseBackupPolicyImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawBaseBackupPolicyImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_basebackuppolicyresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_basebackuppolicyresource.go new file mode 100644 index 00000000000..dbc62cc6103 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_basebackuppolicyresource.go @@ -0,0 +1,48 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BaseBackupPolicyResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties BaseBackupPolicy `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Unmarshaler = &BaseBackupPolicyResource{} + +func (s *BaseBackupPolicyResource) UnmarshalJSON(bytes []byte) error { + type alias BaseBackupPolicyResource + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into BaseBackupPolicyResource: %+v", err) + } + + s.Id = decoded.Id + s.Name = decoded.Name + s.SystemData = decoded.SystemData + s.Type = decoded.Type + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling BaseBackupPolicyResource into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["properties"]; ok { + impl, err := unmarshalBaseBackupPolicyImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Properties' for 'BaseBackupPolicyResource': %+v", err) + } + s.Properties = impl + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_basepolicyrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_basepolicyrule.go new file mode 100644 index 00000000000..a1215c40796 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_basepolicyrule.go @@ -0,0 +1,56 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BasePolicyRule interface { +} + +func unmarshalBasePolicyRuleImplementation(input []byte) (BasePolicyRule, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling BasePolicyRule into map[string]interface: %+v", err) + } + + value, ok := temp["objectType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "AzureBackupRule") { + var out AzureBackupRule + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AzureBackupRule: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "AzureRetentionRule") { + var out AzureRetentionRule + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AzureRetentionRule: %+v", err) + } + return out, nil + } + + type RawBasePolicyRuleImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawBasePolicyRuleImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_copyonexpiryoption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_copyonexpiryoption.go new file mode 100644 index 00000000000..38c92a43d50 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_copyonexpiryoption.go @@ -0,0 +1,40 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ CopyOption = CopyOnExpiryOption{} + +type CopyOnExpiryOption struct { + + // Fields inherited from CopyOption +} + +var _ json.Marshaler = CopyOnExpiryOption{} + +func (s CopyOnExpiryOption) MarshalJSON() ([]byte, error) { + type wrapper CopyOnExpiryOption + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling CopyOnExpiryOption: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling CopyOnExpiryOption: %+v", err) + } + decoded["objectType"] = "CopyOnExpiryOption" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling CopyOnExpiryOption: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_copyoption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_copyoption.go new file mode 100644 index 00000000000..2474cfef386 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_copyoption.go @@ -0,0 +1,64 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CopyOption interface { +} + +func unmarshalCopyOptionImplementation(input []byte) (CopyOption, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling CopyOption into map[string]interface: %+v", err) + } + + value, ok := temp["objectType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "CopyOnExpiryOption") { + var out CopyOnExpiryOption + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into CopyOnExpiryOption: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "CustomCopyOption") { + var out CustomCopyOption + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into CustomCopyOption: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ImmediateCopyOption") { + var out ImmediateCopyOption + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ImmediateCopyOption: %+v", err) + } + return out, nil + } + + type RawCopyOptionImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawCopyOptionImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_customcopyoption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_customcopyoption.go new file mode 100644 index 00000000000..f450054e89a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_customcopyoption.go @@ -0,0 +1,41 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ CopyOption = CustomCopyOption{} + +type CustomCopyOption struct { + Duration *string `json:"duration,omitempty"` + + // Fields inherited from CopyOption +} + +var _ json.Marshaler = CustomCopyOption{} + +func (s CustomCopyOption) MarshalJSON() ([]byte, error) { + type wrapper CustomCopyOption + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling CustomCopyOption: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling CustomCopyOption: %+v", err) + } + decoded["objectType"] = "CustomCopyOption" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling CustomCopyOption: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_datastoreinfobase.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_datastoreinfobase.go new file mode 100644 index 00000000000..d462ed4c6f6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_datastoreinfobase.go @@ -0,0 +1,9 @@ +package backuppolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataStoreInfoBase struct { + DataStoreType DataStoreTypes `json:"dataStoreType"` + ObjectType string `json:"objectType"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_day.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_day.go new file mode 100644 index 00000000000..c46c7f57129 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_day.go @@ -0,0 +1,9 @@ +package backuppolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Day struct { + Date *int64 `json:"date,omitempty"` + IsLast *bool `json:"isLast,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_deleteoption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_deleteoption.go new file mode 100644 index 00000000000..12eb50e63bb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_deleteoption.go @@ -0,0 +1,48 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOption interface { +} + +func unmarshalDeleteOptionImplementation(input []byte) (DeleteOption, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling DeleteOption into map[string]interface: %+v", err) + } + + value, ok := temp["objectType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "AbsoluteDeleteOption") { + var out AbsoluteDeleteOption + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AbsoluteDeleteOption: %+v", err) + } + return out, nil + } + + type RawDeleteOptionImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawDeleteOptionImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_immediatecopyoption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_immediatecopyoption.go new file mode 100644 index 00000000000..a8e54686cc9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_immediatecopyoption.go @@ -0,0 +1,40 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ CopyOption = ImmediateCopyOption{} + +type ImmediateCopyOption struct { + + // Fields inherited from CopyOption +} + +var _ json.Marshaler = ImmediateCopyOption{} + +func (s ImmediateCopyOption) MarshalJSON() ([]byte, error) { + type wrapper ImmediateCopyOption + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ImmediateCopyOption: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ImmediateCopyOption: %+v", err) + } + decoded["objectType"] = "ImmediateCopyOption" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ImmediateCopyOption: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_retentiontag.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_retentiontag.go new file mode 100644 index 00000000000..f9a6dff3e17 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_retentiontag.go @@ -0,0 +1,10 @@ +package backuppolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RetentionTag struct { + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + TagName string `json:"tagName"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_schedulebasedbackupcriteria.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_schedulebasedbackupcriteria.go new file mode 100644 index 00000000000..6e2c614f630 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_schedulebasedbackupcriteria.go @@ -0,0 +1,46 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ BackupCriteria = ScheduleBasedBackupCriteria{} + +type ScheduleBasedBackupCriteria struct { + AbsoluteCriteria *[]AbsoluteMarker `json:"absoluteCriteria,omitempty"` + DaysOfMonth *[]Day `json:"daysOfMonth,omitempty"` + DaysOfTheWeek *[]DayOfWeek `json:"daysOfTheWeek,omitempty"` + MonthsOfYear *[]Month `json:"monthsOfYear,omitempty"` + ScheduleTimes *[]string `json:"scheduleTimes,omitempty"` + WeeksOfTheMonth *[]WeekNumber `json:"weeksOfTheMonth,omitempty"` + + // Fields inherited from BackupCriteria +} + +var _ json.Marshaler = ScheduleBasedBackupCriteria{} + +func (s ScheduleBasedBackupCriteria) MarshalJSON() ([]byte, error) { + type wrapper ScheduleBasedBackupCriteria + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ScheduleBasedBackupCriteria: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ScheduleBasedBackupCriteria: %+v", err) + } + decoded["objectType"] = "ScheduleBasedBackupCriteria" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ScheduleBasedBackupCriteria: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_schedulebasedtriggercontext.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_schedulebasedtriggercontext.go new file mode 100644 index 00000000000..c7f96a85c13 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_schedulebasedtriggercontext.go @@ -0,0 +1,42 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ TriggerContext = ScheduleBasedTriggerContext{} + +type ScheduleBasedTriggerContext struct { + Schedule BackupSchedule `json:"schedule"` + TaggingCriteria []TaggingCriteria `json:"taggingCriteria"` + + // Fields inherited from TriggerContext +} + +var _ json.Marshaler = ScheduleBasedTriggerContext{} + +func (s ScheduleBasedTriggerContext) MarshalJSON() ([]byte, error) { + type wrapper ScheduleBasedTriggerContext + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ScheduleBasedTriggerContext: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ScheduleBasedTriggerContext: %+v", err) + } + decoded["objectType"] = "ScheduleBasedTriggerContext" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ScheduleBasedTriggerContext: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_sourcelifecycle.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_sourcelifecycle.go new file mode 100644 index 00000000000..7538681c1b2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_sourcelifecycle.go @@ -0,0 +1,42 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SourceLifeCycle struct { + DeleteAfter DeleteOption `json:"deleteAfter"` + SourceDataStore DataStoreInfoBase `json:"sourceDataStore"` + TargetDataStoreCopySettings *[]TargetCopySetting `json:"targetDataStoreCopySettings,omitempty"` +} + +var _ json.Unmarshaler = &SourceLifeCycle{} + +func (s *SourceLifeCycle) UnmarshalJSON(bytes []byte) error { + type alias SourceLifeCycle + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into SourceLifeCycle: %+v", err) + } + + s.SourceDataStore = decoded.SourceDataStore + s.TargetDataStoreCopySettings = decoded.TargetDataStoreCopySettings + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling SourceLifeCycle into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["deleteAfter"]; ok { + impl, err := unmarshalDeleteOptionImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'DeleteAfter' for 'SourceLifeCycle': %+v", err) + } + s.DeleteAfter = impl + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_taggingcriteria.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_taggingcriteria.go new file mode 100644 index 00000000000..71c094c4d32 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_taggingcriteria.go @@ -0,0 +1,53 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TaggingCriteria struct { + Criteria *[]BackupCriteria `json:"criteria,omitempty"` + IsDefault bool `json:"isDefault"` + TagInfo RetentionTag `json:"tagInfo"` + TaggingPriority int64 `json:"taggingPriority"` +} + +var _ json.Unmarshaler = &TaggingCriteria{} + +func (s *TaggingCriteria) UnmarshalJSON(bytes []byte) error { + type alias TaggingCriteria + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into TaggingCriteria: %+v", err) + } + + s.IsDefault = decoded.IsDefault + s.TagInfo = decoded.TagInfo + s.TaggingPriority = decoded.TaggingPriority + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling TaggingCriteria into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["criteria"]; ok { + var listTemp []json.RawMessage + if err := json.Unmarshal(v, &listTemp); err != nil { + return fmt.Errorf("unmarshaling Criteria into list []json.RawMessage: %+v", err) + } + + output := make([]BackupCriteria, 0) + for i, val := range listTemp { + impl, err := unmarshalBackupCriteriaImplementation(val) + if err != nil { + return fmt.Errorf("unmarshaling index %d field 'Criteria' for 'TaggingCriteria': %+v", i, err) + } + output = append(output, impl) + } + s.Criteria = &output + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_targetcopysetting.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_targetcopysetting.go new file mode 100644 index 00000000000..2c3e72d496e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_targetcopysetting.go @@ -0,0 +1,40 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TargetCopySetting struct { + CopyAfter CopyOption `json:"copyAfter"` + DataStore DataStoreInfoBase `json:"dataStore"` +} + +var _ json.Unmarshaler = &TargetCopySetting{} + +func (s *TargetCopySetting) UnmarshalJSON(bytes []byte) error { + type alias TargetCopySetting + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into TargetCopySetting: %+v", err) + } + + s.DataStore = decoded.DataStore + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling TargetCopySetting into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["copyAfter"]; ok { + impl, err := unmarshalCopyOptionImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'CopyAfter' for 'TargetCopySetting': %+v", err) + } + s.CopyAfter = impl + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_triggercontext.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_triggercontext.go new file mode 100644 index 00000000000..5c3bad5049d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/model_triggercontext.go @@ -0,0 +1,56 @@ +package backuppolicies + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TriggerContext interface { +} + +func unmarshalTriggerContextImplementation(input []byte) (TriggerContext, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling TriggerContext into map[string]interface: %+v", err) + } + + value, ok := temp["objectType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "AdhocBasedTriggerContext") { + var out AdhocBasedTriggerContext + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AdhocBasedTriggerContext: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ScheduleBasedTriggerContext") { + var out ScheduleBasedTriggerContext + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ScheduleBasedTriggerContext: %+v", err) + } + return out, nil + } + + type RawTriggerContextImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawTriggerContextImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/predicates.go new file mode 100644 index 00000000000..f784e9642aa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/predicates.go @@ -0,0 +1,24 @@ +package backuppolicies + +type BaseBackupPolicyResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p BaseBackupPolicyResourceOperationPredicate) Matches(input BaseBackupPolicyResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/version.go new file mode 100644 index 00000000000..223dba72da3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies/version.go @@ -0,0 +1,12 @@ +package backuppolicies + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/backuppolicies/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/README.md new file mode 100644 index 00000000000..33daba0721e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/README.md @@ -0,0 +1,141 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults` Documentation + +The `backupvaults` SDK allows for interaction with the Azure Resource Manager Service `dataprotection` (API Version `2022-04-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults" +``` + + +### Client Initialization + +```go +client := backupvaults.NewBackupVaultsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `BackupVaultsClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := backupvaults.NewProviderLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "locationValue") + +payload := backupvaults.CheckNameAvailabilityRequest{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupVaultsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +payload := backupvaults.BackupVaultResource{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupVaultsClient.Delete` + +```go +ctx := context.TODO() +id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupVaultsClient.Get` + +```go +ctx := context.TODO() +id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupVaultsClient.GetInResourceGroup` + +```go +ctx := context.TODO() +id := backupvaults.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.GetInResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.GetInResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BackupVaultsClient.GetInSubscription` + +```go +ctx := context.TODO() +id := backupvaults.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.GetInSubscription(ctx, id)` can be used to do batched pagination +items, err := client.GetInSubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BackupVaultsClient.Update` + +```go +ctx := context.TODO() +id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultValue") + +payload := backupvaults.PatchResourceRequestInput{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/client.go new file mode 100644 index 00000000000..62596b7a1cc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/client.go @@ -0,0 +1,18 @@ +package backupvaults + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupVaultsClient struct { + Client autorest.Client + baseUri string +} + +func NewBackupVaultsClientWithBaseURI(endpoint string) BackupVaultsClient { + return BackupVaultsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/constants.go new file mode 100644 index 00000000000..7c24aad53e0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/constants.go @@ -0,0 +1,182 @@ +package backupvaults + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AlertsState string + +const ( + AlertsStateDisabled AlertsState = "Disabled" + AlertsStateEnabled AlertsState = "Enabled" +) + +func PossibleValuesForAlertsState() []string { + return []string{ + string(AlertsStateDisabled), + string(AlertsStateEnabled), + } +} + +func parseAlertsState(input string) (*AlertsState, error) { + vals := map[string]AlertsState{ + "disabled": AlertsStateDisabled, + "enabled": AlertsStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AlertsState(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUnknown), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "unknown": ProvisioningStateUnknown, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type ResourceMoveState string + +const ( + ResourceMoveStateCommitFailed ResourceMoveState = "CommitFailed" + ResourceMoveStateCommitTimedout ResourceMoveState = "CommitTimedout" + ResourceMoveStateCriticalFailure ResourceMoveState = "CriticalFailure" + ResourceMoveStateFailed ResourceMoveState = "Failed" + ResourceMoveStateInProgress ResourceMoveState = "InProgress" + ResourceMoveStateMoveSucceeded ResourceMoveState = "MoveSucceeded" + ResourceMoveStatePartialSuccess ResourceMoveState = "PartialSuccess" + ResourceMoveStatePrepareFailed ResourceMoveState = "PrepareFailed" + ResourceMoveStatePrepareTimedout ResourceMoveState = "PrepareTimedout" + ResourceMoveStateUnknown ResourceMoveState = "Unknown" +) + +func PossibleValuesForResourceMoveState() []string { + return []string{ + string(ResourceMoveStateCommitFailed), + string(ResourceMoveStateCommitTimedout), + string(ResourceMoveStateCriticalFailure), + string(ResourceMoveStateFailed), + string(ResourceMoveStateInProgress), + string(ResourceMoveStateMoveSucceeded), + string(ResourceMoveStatePartialSuccess), + string(ResourceMoveStatePrepareFailed), + string(ResourceMoveStatePrepareTimedout), + string(ResourceMoveStateUnknown), + } +} + +func parseResourceMoveState(input string) (*ResourceMoveState, error) { + vals := map[string]ResourceMoveState{ + "commitfailed": ResourceMoveStateCommitFailed, + "committimedout": ResourceMoveStateCommitTimedout, + "criticalfailure": ResourceMoveStateCriticalFailure, + "failed": ResourceMoveStateFailed, + "inprogress": ResourceMoveStateInProgress, + "movesucceeded": ResourceMoveStateMoveSucceeded, + "partialsuccess": ResourceMoveStatePartialSuccess, + "preparefailed": ResourceMoveStatePrepareFailed, + "preparetimedout": ResourceMoveStatePrepareTimedout, + "unknown": ResourceMoveStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceMoveState(input) + return &out, nil +} + +type StorageSettingStoreTypes string + +const ( + StorageSettingStoreTypesArchiveStore StorageSettingStoreTypes = "ArchiveStore" + StorageSettingStoreTypesSnapshotStore StorageSettingStoreTypes = "SnapshotStore" + StorageSettingStoreTypesVaultStore StorageSettingStoreTypes = "VaultStore" +) + +func PossibleValuesForStorageSettingStoreTypes() []string { + return []string{ + string(StorageSettingStoreTypesArchiveStore), + string(StorageSettingStoreTypesSnapshotStore), + string(StorageSettingStoreTypesVaultStore), + } +} + +func parseStorageSettingStoreTypes(input string) (*StorageSettingStoreTypes, error) { + vals := map[string]StorageSettingStoreTypes{ + "archivestore": StorageSettingStoreTypesArchiveStore, + "snapshotstore": StorageSettingStoreTypesSnapshotStore, + "vaultstore": StorageSettingStoreTypesVaultStore, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageSettingStoreTypes(input) + return &out, nil +} + +type StorageSettingTypes string + +const ( + StorageSettingTypesGeoRedundant StorageSettingTypes = "GeoRedundant" + StorageSettingTypesLocallyRedundant StorageSettingTypes = "LocallyRedundant" +) + +func PossibleValuesForStorageSettingTypes() []string { + return []string{ + string(StorageSettingTypesGeoRedundant), + string(StorageSettingTypesLocallyRedundant), + } +} + +func parseStorageSettingTypes(input string) (*StorageSettingTypes, error) { + vals := map[string]StorageSettingTypes{ + "georedundant": StorageSettingTypesGeoRedundant, + "locallyredundant": StorageSettingTypesLocallyRedundant, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageSettingTypes(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/id_backupvault.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/id_backupvault.go new file mode 100644 index 00000000000..47da3421eb5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/id_backupvault.go @@ -0,0 +1,124 @@ +package backupvaults + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = BackupVaultId{} + +// BackupVaultId is a struct representing the Resource ID for a Backup Vault +type BackupVaultId struct { + SubscriptionId string + ResourceGroupName string + VaultName string +} + +// NewBackupVaultID returns a new BackupVaultId struct +func NewBackupVaultID(subscriptionId string, resourceGroupName string, vaultName string) BackupVaultId { + return BackupVaultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + } +} + +// ParseBackupVaultID parses 'input' into a BackupVaultId +func ParseBackupVaultID(input string) (*BackupVaultId, error) { + parser := resourceids.NewParserFromResourceIdType(BackupVaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BackupVaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseBackupVaultIDInsensitively parses 'input' case-insensitively into a BackupVaultId +// note: this method should only be used for API response data and not user input +func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { + parser := resourceids.NewParserFromResourceIdType(BackupVaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := BackupVaultId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { + return nil, fmt.Errorf("the segment 'vaultName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID +func ValidateBackupVaultID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseBackupVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Backup Vault ID +func (id BackupVaultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/backupVaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Backup Vault ID +func (id BackupVaultId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), + resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultValue"), + } +} + +// String returns a human-readable description of this Backup Vault ID +func (id BackupVaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + } + return fmt.Sprintf("Backup Vault (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/id_providerlocation.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/id_providerlocation.go new file mode 100644 index 00000000000..861193b45c8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/id_providerlocation.go @@ -0,0 +1,124 @@ +package backupvaults + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ProviderLocationId{} + +// ProviderLocationId is a struct representing the Resource ID for a Provider Location +type ProviderLocationId struct { + SubscriptionId string + ResourceGroupName string + Location string +} + +// NewProviderLocationID returns a new ProviderLocationId struct +func NewProviderLocationID(subscriptionId string, resourceGroupName string, location string) ProviderLocationId { + return ProviderLocationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + Location: location, + } +} + +// ParseProviderLocationID parses 'input' into a ProviderLocationId +func ParseProviderLocationID(input string) (*ProviderLocationId, error) { + parser := resourceids.NewParserFromResourceIdType(ProviderLocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProviderLocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseProviderLocationIDInsensitively parses 'input' case-insensitively into a ProviderLocationId +// note: this method should only be used for API response data and not user input +func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, error) { + parser := resourceids.NewParserFromResourceIdType(ProviderLocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProviderLocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID +func ValidateProviderLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProviderLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Provider Location ID +func (id ProviderLocationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.Location) +} + +// Segments returns a slice of Resource ID Segments which comprise this Provider Location ID +func (id ProviderLocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("location", "locationValue"), + } +} + +// String returns a human-readable description of this Provider Location ID +func (id ProviderLocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Location: %q", id.Location), + } + return fmt.Sprintf("Provider Location (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_checknameavailability_autorest.go new file mode 100644 index 00000000000..fd162836e43 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_checknameavailability_autorest.go @@ -0,0 +1,70 @@ +package backupvaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameAvailabilityResult +} + +// CheckNameAvailability ... +func (c BackupVaultsClient) CheckNameAvailability(ctx context.Context, id ProviderLocationId, input CheckNameAvailabilityRequest) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c BackupVaultsClient) preparerForCheckNameAvailability(ctx context.Context, id ProviderLocationId, input CheckNameAvailabilityRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c BackupVaultsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_createorupdate_autorest.go new file mode 100644 index 00000000000..7ddc6617903 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package backupvaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c BackupVaultsClient) CreateOrUpdate(ctx context.Context, id BackupVaultId, input BackupVaultResource) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c BackupVaultsClient) CreateOrUpdateThenPoll(ctx context.Context, id BackupVaultId, input BackupVaultResource) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c BackupVaultsClient) preparerForCreateOrUpdate(ctx context.Context, id BackupVaultId, input BackupVaultResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c BackupVaultsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_delete_autorest.go new file mode 100644 index 00000000000..11ab7461582 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_delete_autorest.go @@ -0,0 +1,66 @@ +package backupvaults + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c BackupVaultsClient) Delete(ctx context.Context, id BackupVaultId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c BackupVaultsClient) preparerForDelete(ctx context.Context, id BackupVaultId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c BackupVaultsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_get_autorest.go new file mode 100644 index 00000000000..39cadc91e34 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_get_autorest.go @@ -0,0 +1,68 @@ +package backupvaults + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *BackupVaultResource +} + +// Get ... +func (c BackupVaultsClient) Get(ctx context.Context, id BackupVaultId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c BackupVaultsClient) preparerForGet(ctx context.Context, id BackupVaultId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c BackupVaultsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_getinresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_getinresourcegroup_autorest.go new file mode 100644 index 00000000000..c9a2cd4be8f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_getinresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package backupvaults + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetInResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]BackupVaultResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (GetInResourceGroupOperationResponse, error) +} + +type GetInResourceGroupCompleteResult struct { + Items []BackupVaultResource +} + +func (r GetInResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r GetInResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp GetInResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// GetInResourceGroup ... +func (c BackupVaultsClient) GetInResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp GetInResourceGroupOperationResponse, err error) { + req, err := c.preparerForGetInResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "GetInResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "GetInResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForGetInResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "GetInResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForGetInResourceGroup prepares the GetInResourceGroup request. +func (c BackupVaultsClient) preparerForGetInResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DataProtection/backupVaults", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForGetInResourceGroupWithNextLink prepares the GetInResourceGroup request with the given nextLink token. +func (c BackupVaultsClient) preparerForGetInResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetInResourceGroup handles the response to the GetInResourceGroup request. The method always +// closes the http.Response Body. +func (c BackupVaultsClient) responderForGetInResourceGroup(resp *http.Response) (result GetInResourceGroupOperationResponse, err error) { + type page struct { + Values []BackupVaultResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result GetInResourceGroupOperationResponse, err error) { + req, err := c.preparerForGetInResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "GetInResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "GetInResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetInResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "GetInResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// GetInResourceGroupComplete retrieves all of the results into a single object +func (c BackupVaultsClient) GetInResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (GetInResourceGroupCompleteResult, error) { + return c.GetInResourceGroupCompleteMatchingPredicate(ctx, id, BackupVaultResourceOperationPredicate{}) +} + +// GetInResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BackupVaultsClient) GetInResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate BackupVaultResourceOperationPredicate) (resp GetInResourceGroupCompleteResult, err error) { + items := make([]BackupVaultResource, 0) + + page, err := c.GetInResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := GetInResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_getinsubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_getinsubscription_autorest.go new file mode 100644 index 00000000000..5b9d54eb5b7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_getinsubscription_autorest.go @@ -0,0 +1,187 @@ +package backupvaults + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetInSubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]BackupVaultResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (GetInSubscriptionOperationResponse, error) +} + +type GetInSubscriptionCompleteResult struct { + Items []BackupVaultResource +} + +func (r GetInSubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r GetInSubscriptionOperationResponse) LoadMore(ctx context.Context) (resp GetInSubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// GetInSubscription ... +func (c BackupVaultsClient) GetInSubscription(ctx context.Context, id commonids.SubscriptionId) (resp GetInSubscriptionOperationResponse, err error) { + req, err := c.preparerForGetInSubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "GetInSubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "GetInSubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForGetInSubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "GetInSubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForGetInSubscription prepares the GetInSubscription request. +func (c BackupVaultsClient) preparerForGetInSubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DataProtection/backupVaults", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForGetInSubscriptionWithNextLink prepares the GetInSubscription request with the given nextLink token. +func (c BackupVaultsClient) preparerForGetInSubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetInSubscription handles the response to the GetInSubscription request. The method always +// closes the http.Response Body. +func (c BackupVaultsClient) responderForGetInSubscription(resp *http.Response) (result GetInSubscriptionOperationResponse, err error) { + type page struct { + Values []BackupVaultResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result GetInSubscriptionOperationResponse, err error) { + req, err := c.preparerForGetInSubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "GetInSubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "GetInSubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetInSubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "GetInSubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// GetInSubscriptionComplete retrieves all of the results into a single object +func (c BackupVaultsClient) GetInSubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (GetInSubscriptionCompleteResult, error) { + return c.GetInSubscriptionCompleteMatchingPredicate(ctx, id, BackupVaultResourceOperationPredicate{}) +} + +// GetInSubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c BackupVaultsClient) GetInSubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate BackupVaultResourceOperationPredicate) (resp GetInSubscriptionCompleteResult, err error) { + items := make([]BackupVaultResource, 0) + + page, err := c.GetInSubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := GetInSubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_update_autorest.go new file mode 100644 index 00000000000..8ac85ea670d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/method_update_autorest.go @@ -0,0 +1,79 @@ +package backupvaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c BackupVaultsClient) Update(ctx context.Context, id BackupVaultId, input PatchResourceRequestInput) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "backupvaults.BackupVaultsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c BackupVaultsClient) UpdateThenPoll(ctx context.Context, id BackupVaultId, input PatchResourceRequestInput) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c BackupVaultsClient) preparerForUpdate(ctx context.Context, id BackupVaultId, input PatchResourceRequestInput) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c BackupVaultsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_azuremonitoralertsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_azuremonitoralertsettings.go new file mode 100644 index 00000000000..8abdec3ec1b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_azuremonitoralertsettings.go @@ -0,0 +1,8 @@ +package backupvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureMonitorAlertSettings struct { + AlertsForAllJobFailures *AlertsState `json:"alertsForAllJobFailures,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_backupvault.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_backupvault.go new file mode 100644 index 00000000000..833a20c17e9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_backupvault.go @@ -0,0 +1,12 @@ +package backupvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupVault struct { + MonitoringSettings *MonitoringSettings `json:"monitoringSettings,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + ResourceMoveDetails *ResourceMoveDetails `json:"resourceMoveDetails,omitempty"` + ResourceMoveState *ResourceMoveState `json:"resourceMoveState,omitempty"` + StorageSettings []StorageSetting `json:"storageSettings"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_backupvaultresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_backupvaultresource.go new file mode 100644 index 00000000000..978197ca4e3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_backupvaultresource.go @@ -0,0 +1,20 @@ +package backupvaults + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupVaultResource struct { + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *DppIdentityDetails `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties BackupVault `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_checknameavailabilityrequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_checknameavailabilityrequest.go new file mode 100644 index 00000000000..bb78afc83b2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_checknameavailabilityrequest.go @@ -0,0 +1,9 @@ +package backupvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityRequest struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_checknameavailabilityresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_checknameavailabilityresult.go new file mode 100644 index 00000000000..86c51891313 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_checknameavailabilityresult.go @@ -0,0 +1,10 @@ +package backupvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityResult struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *string `json:"reason,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_dppidentitydetails.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_dppidentitydetails.go new file mode 100644 index 00000000000..d9ebcf5d416 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_dppidentitydetails.go @@ -0,0 +1,10 @@ +package backupvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DppIdentityDetails struct { + PrincipalId *string `json:"principalId,omitempty"` + TenantId *string `json:"tenantId,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_monitoringsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_monitoringsettings.go new file mode 100644 index 00000000000..de0fa26a601 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_monitoringsettings.go @@ -0,0 +1,8 @@ +package backupvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoringSettings struct { + AzureMonitorAlertSettings *AzureMonitorAlertSettings `json:"azureMonitorAlertSettings,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_patchbackupvaultinput.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_patchbackupvaultinput.go new file mode 100644 index 00000000000..5695dea6c1b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_patchbackupvaultinput.go @@ -0,0 +1,8 @@ +package backupvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchBackupVaultInput struct { + MonitoringSettings *MonitoringSettings `json:"monitoringSettings,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_patchresourcerequestinput.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_patchresourcerequestinput.go new file mode 100644 index 00000000000..09683e7a1d0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_patchresourcerequestinput.go @@ -0,0 +1,10 @@ +package backupvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchResourceRequestInput struct { + Identity *DppIdentityDetails `json:"identity,omitempty"` + Properties *PatchBackupVaultInput `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_resourcemovedetails.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_resourcemovedetails.go new file mode 100644 index 00000000000..dc459fff005 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_resourcemovedetails.go @@ -0,0 +1,12 @@ +package backupvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceMoveDetails struct { + CompletionTimeUtc *string `json:"completionTimeUtc,omitempty"` + OperationId *string `json:"operationId,omitempty"` + SourceResourcePath *string `json:"sourceResourcePath,omitempty"` + StartTimeUtc *string `json:"startTimeUtc,omitempty"` + TargetResourcePath *string `json:"targetResourcePath,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_storagesetting.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_storagesetting.go new file mode 100644 index 00000000000..6112268872b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/model_storagesetting.go @@ -0,0 +1,9 @@ +package backupvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageSetting struct { + DatastoreType *StorageSettingStoreTypes `json:"datastoreType,omitempty"` + Type *StorageSettingTypes `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/predicates.go new file mode 100644 index 00000000000..0534bf8ace7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/predicates.go @@ -0,0 +1,34 @@ +package backupvaults + +type BackupVaultResourceOperationPredicate struct { + ETag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p BackupVaultResourceOperationPredicate) Matches(input BackupVaultResource) bool { + + if p.ETag != nil && (input.ETag == nil && *p.ETag != *input.ETag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/version.go new file mode 100644 index 00000000000..f489aea6fa6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults/version.go @@ -0,0 +1,12 @@ +package backupvaults + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/backupvaults/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/README.md new file mode 100644 index 00000000000..603f4cf287b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/README.md @@ -0,0 +1,326 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards` Documentation + +The `resourceguards` SDK allows for interaction with the Azure Resource Manager Service `dataprotection` (API Version `2022-04-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards" +``` + + +### Client Initialization + +```go +client := resourceguards.NewResourceGuardsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ResourceGuardsClient.Delete` + +```go +ctx := context.TODO() +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceGuardsClient.Get` + +```go +ctx := context.TODO() +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceGuardsClient.GetBackupSecurityPINRequestsObjects` + +```go +ctx := context.TODO() +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") + +// alternatively `client.GetBackupSecurityPINRequestsObjects(ctx, id)` can be used to do batched pagination +items, err := client.GetBackupSecurityPINRequestsObjectsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ResourceGuardsClient.GetDefaultBackupSecurityPINRequestsObject` + +```go +ctx := context.TODO() +id := resourceguards.NewGetBackupSecurityPINRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue", "requestValue") + +read, err := client.GetDefaultBackupSecurityPINRequestsObject(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceGuardsClient.GetDefaultDeleteProtectedItemRequestsObject` + +```go +ctx := context.TODO() +id := resourceguards.NewDeleteProtectedItemRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue", "requestValue") + +read, err := client.GetDefaultDeleteProtectedItemRequestsObject(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceGuardsClient.GetDefaultDeleteResourceGuardProxyRequestsObject` + +```go +ctx := context.TODO() +id := resourceguards.NewDeleteResourceGuardProxyRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue", "requestValue") + +read, err := client.GetDefaultDeleteResourceGuardProxyRequestsObject(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceGuardsClient.GetDefaultDisableSoftDeleteRequestsObject` + +```go +ctx := context.TODO() +id := resourceguards.NewDisableSoftDeleteRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue", "requestValue") + +read, err := client.GetDefaultDisableSoftDeleteRequestsObject(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceGuardsClient.GetDefaultUpdateProtectedItemRequestsObject` + +```go +ctx := context.TODO() +id := resourceguards.NewUpdateProtectedItemRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue", "requestValue") + +read, err := client.GetDefaultUpdateProtectedItemRequestsObject(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceGuardsClient.GetDefaultUpdateProtectionPolicyRequestsObject` + +```go +ctx := context.TODO() +id := resourceguards.NewUpdateProtectionPolicyRequestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue", "requestValue") + +read, err := client.GetDefaultUpdateProtectionPolicyRequestsObject(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceGuardsClient.GetDeleteProtectedItemRequestsObjects` + +```go +ctx := context.TODO() +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") + +// alternatively `client.GetDeleteProtectedItemRequestsObjects(ctx, id)` can be used to do batched pagination +items, err := client.GetDeleteProtectedItemRequestsObjectsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ResourceGuardsClient.GetDeleteResourceGuardProxyRequestsObjects` + +```go +ctx := context.TODO() +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") + +// alternatively `client.GetDeleteResourceGuardProxyRequestsObjects(ctx, id)` can be used to do batched pagination +items, err := client.GetDeleteResourceGuardProxyRequestsObjectsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ResourceGuardsClient.GetDisableSoftDeleteRequestsObjects` + +```go +ctx := context.TODO() +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") + +// alternatively `client.GetDisableSoftDeleteRequestsObjects(ctx, id)` can be used to do batched pagination +items, err := client.GetDisableSoftDeleteRequestsObjectsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ResourceGuardsClient.GetResourcesInResourceGroup` + +```go +ctx := context.TODO() +id := resourceguards.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.GetResourcesInResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.GetResourcesInResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ResourceGuardsClient.GetResourcesInSubscription` + +```go +ctx := context.TODO() +id := resourceguards.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.GetResourcesInSubscription(ctx, id)` can be used to do batched pagination +items, err := client.GetResourcesInSubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ResourceGuardsClient.GetUpdateProtectedItemRequestsObjects` + +```go +ctx := context.TODO() +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") + +// alternatively `client.GetUpdateProtectedItemRequestsObjects(ctx, id)` can be used to do batched pagination +items, err := client.GetUpdateProtectedItemRequestsObjectsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ResourceGuardsClient.GetUpdateProtectionPolicyRequestsObjects` + +```go +ctx := context.TODO() +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") + +// alternatively `client.GetUpdateProtectionPolicyRequestsObjects(ctx, id)` can be used to do batched pagination +items, err := client.GetUpdateProtectionPolicyRequestsObjectsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ResourceGuardsClient.Patch` + +```go +ctx := context.TODO() +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") + +payload := resourceguards.PatchResourceRequestInput{ + // ... +} + + +read, err := client.Patch(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceGuardsClient.Put` + +```go +ctx := context.TODO() +id := resourceguards.NewResourceGuardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceGuardsValue") + +payload := resourceguards.ResourceGuardResource{ + // ... +} + + +read, err := client.Put(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/client.go new file mode 100644 index 00000000000..acad34a2a68 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/client.go @@ -0,0 +1,18 @@ +package resourceguards + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceGuardsClient struct { + Client autorest.Client + baseUri string +} + +func NewResourceGuardsClientWithBaseURI(endpoint string) ResourceGuardsClient { + return ResourceGuardsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/constants.go new file mode 100644 index 00000000000..a5921d0c309 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/constants.go @@ -0,0 +1,71 @@ +package resourceguards + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AlertsState string + +const ( + AlertsStateDisabled AlertsState = "Disabled" + AlertsStateEnabled AlertsState = "Enabled" +) + +func PossibleValuesForAlertsState() []string { + return []string{ + string(AlertsStateDisabled), + string(AlertsStateEnabled), + } +} + +func parseAlertsState(input string) (*AlertsState, error) { + vals := map[string]AlertsState{ + "disabled": AlertsStateDisabled, + "enabled": AlertsStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AlertsState(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUnknown), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "unknown": ProvisioningStateUnknown, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteprotecteditemrequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteprotecteditemrequest.go new file mode 100644 index 00000000000..8cd76f04ac2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteprotecteditemrequest.go @@ -0,0 +1,137 @@ +package resourceguards + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DeleteProtectedItemRequestId{} + +// DeleteProtectedItemRequestId is a struct representing the Resource ID for a Delete Protected Item Request +type DeleteProtectedItemRequestId struct { + SubscriptionId string + ResourceGroupName string + ResourceGuardsName string + RequestName string +} + +// NewDeleteProtectedItemRequestID returns a new DeleteProtectedItemRequestId struct +func NewDeleteProtectedItemRequestID(subscriptionId string, resourceGroupName string, resourceGuardsName string, requestName string) DeleteProtectedItemRequestId { + return DeleteProtectedItemRequestId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceGuardsName: resourceGuardsName, + RequestName: requestName, + } +} + +// ParseDeleteProtectedItemRequestID parses 'input' into a DeleteProtectedItemRequestId +func ParseDeleteProtectedItemRequestID(input string) (*DeleteProtectedItemRequestId, error) { + parser := resourceids.NewParserFromResourceIdType(DeleteProtectedItemRequestId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DeleteProtectedItemRequestId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + } + + if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { + return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDeleteProtectedItemRequestIDInsensitively parses 'input' case-insensitively into a DeleteProtectedItemRequestId +// note: this method should only be used for API response data and not user input +func ParseDeleteProtectedItemRequestIDInsensitively(input string) (*DeleteProtectedItemRequestId, error) { + parser := resourceids.NewParserFromResourceIdType(DeleteProtectedItemRequestId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DeleteProtectedItemRequestId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + } + + if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { + return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDeleteProtectedItemRequestID checks that 'input' can be parsed as a Delete Protected Item Request ID +func ValidateDeleteProtectedItemRequestID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDeleteProtectedItemRequestID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Delete Protected Item Request ID +func (id DeleteProtectedItemRequestId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/resourceGuards/%s/deleteProtectedItemRequests/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardsName, id.RequestName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Delete Protected Item Request ID +func (id DeleteProtectedItemRequestId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), + resourceids.StaticSegment("staticResourceGuards", "resourceGuards", "resourceGuards"), + resourceids.UserSpecifiedSegment("resourceGuardsName", "resourceGuardsValue"), + resourceids.StaticSegment("staticDeleteProtectedItemRequests", "deleteProtectedItemRequests", "deleteProtectedItemRequests"), + resourceids.UserSpecifiedSegment("requestName", "requestValue"), + } +} + +// String returns a human-readable description of this Delete Protected Item Request ID +func (id DeleteProtectedItemRequestId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Guards Name: %q", id.ResourceGuardsName), + fmt.Sprintf("Request Name: %q", id.RequestName), + } + return fmt.Sprintf("Delete Protected Item Request (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteresourceguardproxyrequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteresourceguardproxyrequest.go new file mode 100644 index 00000000000..ce7801a7f77 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteresourceguardproxyrequest.go @@ -0,0 +1,137 @@ +package resourceguards + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DeleteResourceGuardProxyRequestId{} + +// DeleteResourceGuardProxyRequestId is a struct representing the Resource ID for a Delete Resource Guard Proxy Request +type DeleteResourceGuardProxyRequestId struct { + SubscriptionId string + ResourceGroupName string + ResourceGuardsName string + RequestName string +} + +// NewDeleteResourceGuardProxyRequestID returns a new DeleteResourceGuardProxyRequestId struct +func NewDeleteResourceGuardProxyRequestID(subscriptionId string, resourceGroupName string, resourceGuardsName string, requestName string) DeleteResourceGuardProxyRequestId { + return DeleteResourceGuardProxyRequestId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceGuardsName: resourceGuardsName, + RequestName: requestName, + } +} + +// ParseDeleteResourceGuardProxyRequestID parses 'input' into a DeleteResourceGuardProxyRequestId +func ParseDeleteResourceGuardProxyRequestID(input string) (*DeleteResourceGuardProxyRequestId, error) { + parser := resourceids.NewParserFromResourceIdType(DeleteResourceGuardProxyRequestId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DeleteResourceGuardProxyRequestId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + } + + if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { + return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDeleteResourceGuardProxyRequestIDInsensitively parses 'input' case-insensitively into a DeleteResourceGuardProxyRequestId +// note: this method should only be used for API response data and not user input +func ParseDeleteResourceGuardProxyRequestIDInsensitively(input string) (*DeleteResourceGuardProxyRequestId, error) { + parser := resourceids.NewParserFromResourceIdType(DeleteResourceGuardProxyRequestId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DeleteResourceGuardProxyRequestId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + } + + if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { + return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDeleteResourceGuardProxyRequestID checks that 'input' can be parsed as a Delete Resource Guard Proxy Request ID +func ValidateDeleteResourceGuardProxyRequestID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDeleteResourceGuardProxyRequestID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Delete Resource Guard Proxy Request ID +func (id DeleteResourceGuardProxyRequestId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/resourceGuards/%s/deleteResourceGuardProxyRequests/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardsName, id.RequestName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Delete Resource Guard Proxy Request ID +func (id DeleteResourceGuardProxyRequestId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), + resourceids.StaticSegment("staticResourceGuards", "resourceGuards", "resourceGuards"), + resourceids.UserSpecifiedSegment("resourceGuardsName", "resourceGuardsValue"), + resourceids.StaticSegment("staticDeleteResourceGuardProxyRequests", "deleteResourceGuardProxyRequests", "deleteResourceGuardProxyRequests"), + resourceids.UserSpecifiedSegment("requestName", "requestValue"), + } +} + +// String returns a human-readable description of this Delete Resource Guard Proxy Request ID +func (id DeleteResourceGuardProxyRequestId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Guards Name: %q", id.ResourceGuardsName), + fmt.Sprintf("Request Name: %q", id.RequestName), + } + return fmt.Sprintf("Delete Resource Guard Proxy Request (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_disablesoftdeleterequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_disablesoftdeleterequest.go new file mode 100644 index 00000000000..4fda5f44faf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_disablesoftdeleterequest.go @@ -0,0 +1,137 @@ +package resourceguards + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DisableSoftDeleteRequestId{} + +// DisableSoftDeleteRequestId is a struct representing the Resource ID for a Disable Soft Delete Request +type DisableSoftDeleteRequestId struct { + SubscriptionId string + ResourceGroupName string + ResourceGuardsName string + RequestName string +} + +// NewDisableSoftDeleteRequestID returns a new DisableSoftDeleteRequestId struct +func NewDisableSoftDeleteRequestID(subscriptionId string, resourceGroupName string, resourceGuardsName string, requestName string) DisableSoftDeleteRequestId { + return DisableSoftDeleteRequestId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceGuardsName: resourceGuardsName, + RequestName: requestName, + } +} + +// ParseDisableSoftDeleteRequestID parses 'input' into a DisableSoftDeleteRequestId +func ParseDisableSoftDeleteRequestID(input string) (*DisableSoftDeleteRequestId, error) { + parser := resourceids.NewParserFromResourceIdType(DisableSoftDeleteRequestId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DisableSoftDeleteRequestId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + } + + if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { + return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDisableSoftDeleteRequestIDInsensitively parses 'input' case-insensitively into a DisableSoftDeleteRequestId +// note: this method should only be used for API response data and not user input +func ParseDisableSoftDeleteRequestIDInsensitively(input string) (*DisableSoftDeleteRequestId, error) { + parser := resourceids.NewParserFromResourceIdType(DisableSoftDeleteRequestId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DisableSoftDeleteRequestId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + } + + if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { + return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDisableSoftDeleteRequestID checks that 'input' can be parsed as a Disable Soft Delete Request ID +func ValidateDisableSoftDeleteRequestID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDisableSoftDeleteRequestID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Disable Soft Delete Request ID +func (id DisableSoftDeleteRequestId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/resourceGuards/%s/disableSoftDeleteRequests/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardsName, id.RequestName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Disable Soft Delete Request ID +func (id DisableSoftDeleteRequestId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), + resourceids.StaticSegment("staticResourceGuards", "resourceGuards", "resourceGuards"), + resourceids.UserSpecifiedSegment("resourceGuardsName", "resourceGuardsValue"), + resourceids.StaticSegment("staticDisableSoftDeleteRequests", "disableSoftDeleteRequests", "disableSoftDeleteRequests"), + resourceids.UserSpecifiedSegment("requestName", "requestValue"), + } +} + +// String returns a human-readable description of this Disable Soft Delete Request ID +func (id DisableSoftDeleteRequestId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Guards Name: %q", id.ResourceGuardsName), + fmt.Sprintf("Request Name: %q", id.RequestName), + } + return fmt.Sprintf("Disable Soft Delete Request (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_getbackupsecuritypinrequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_getbackupsecuritypinrequest.go new file mode 100644 index 00000000000..23703f2e2d3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_getbackupsecuritypinrequest.go @@ -0,0 +1,137 @@ +package resourceguards + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = GetBackupSecurityPINRequestId{} + +// GetBackupSecurityPINRequestId is a struct representing the Resource ID for a Get Backup Security P I N Request +type GetBackupSecurityPINRequestId struct { + SubscriptionId string + ResourceGroupName string + ResourceGuardsName string + RequestName string +} + +// NewGetBackupSecurityPINRequestID returns a new GetBackupSecurityPINRequestId struct +func NewGetBackupSecurityPINRequestID(subscriptionId string, resourceGroupName string, resourceGuardsName string, requestName string) GetBackupSecurityPINRequestId { + return GetBackupSecurityPINRequestId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceGuardsName: resourceGuardsName, + RequestName: requestName, + } +} + +// ParseGetBackupSecurityPINRequestID parses 'input' into a GetBackupSecurityPINRequestId +func ParseGetBackupSecurityPINRequestID(input string) (*GetBackupSecurityPINRequestId, error) { + parser := resourceids.NewParserFromResourceIdType(GetBackupSecurityPINRequestId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GetBackupSecurityPINRequestId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + } + + if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { + return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseGetBackupSecurityPINRequestIDInsensitively parses 'input' case-insensitively into a GetBackupSecurityPINRequestId +// note: this method should only be used for API response data and not user input +func ParseGetBackupSecurityPINRequestIDInsensitively(input string) (*GetBackupSecurityPINRequestId, error) { + parser := resourceids.NewParserFromResourceIdType(GetBackupSecurityPINRequestId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GetBackupSecurityPINRequestId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + } + + if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { + return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateGetBackupSecurityPINRequestID checks that 'input' can be parsed as a Get Backup Security P I N Request ID +func ValidateGetBackupSecurityPINRequestID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseGetBackupSecurityPINRequestID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Get Backup Security P I N Request ID +func (id GetBackupSecurityPINRequestId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/resourceGuards/%s/getBackupSecurityPINRequests/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardsName, id.RequestName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Get Backup Security P I N Request ID +func (id GetBackupSecurityPINRequestId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), + resourceids.StaticSegment("staticResourceGuards", "resourceGuards", "resourceGuards"), + resourceids.UserSpecifiedSegment("resourceGuardsName", "resourceGuardsValue"), + resourceids.StaticSegment("staticGetBackupSecurityPINRequests", "getBackupSecurityPINRequests", "getBackupSecurityPINRequests"), + resourceids.UserSpecifiedSegment("requestName", "requestValue"), + } +} + +// String returns a human-readable description of this Get Backup Security P I N Request ID +func (id GetBackupSecurityPINRequestId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Guards Name: %q", id.ResourceGuardsName), + fmt.Sprintf("Request Name: %q", id.RequestName), + } + return fmt.Sprintf("Get Backup Security P I N Request (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_resourceguard.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_resourceguard.go new file mode 100644 index 00000000000..bf161f3aeb9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_resourceguard.go @@ -0,0 +1,124 @@ +package resourceguards + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ResourceGuardId{} + +// ResourceGuardId is a struct representing the Resource ID for a Resource Guard +type ResourceGuardId struct { + SubscriptionId string + ResourceGroupName string + ResourceGuardsName string +} + +// NewResourceGuardID returns a new ResourceGuardId struct +func NewResourceGuardID(subscriptionId string, resourceGroupName string, resourceGuardsName string) ResourceGuardId { + return ResourceGuardId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceGuardsName: resourceGuardsName, + } +} + +// ParseResourceGuardID parses 'input' into a ResourceGuardId +func ParseResourceGuardID(input string) (*ResourceGuardId, error) { + parser := resourceids.NewParserFromResourceIdType(ResourceGuardId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ResourceGuardId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseResourceGuardIDInsensitively parses 'input' case-insensitively into a ResourceGuardId +// note: this method should only be used for API response data and not user input +func ParseResourceGuardIDInsensitively(input string) (*ResourceGuardId, error) { + parser := resourceids.NewParserFromResourceIdType(ResourceGuardId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ResourceGuardId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateResourceGuardID checks that 'input' can be parsed as a Resource Guard ID +func ValidateResourceGuardID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseResourceGuardID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Resource Guard ID +func (id ResourceGuardId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/resourceGuards/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardsName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Resource Guard ID +func (id ResourceGuardId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), + resourceids.StaticSegment("staticResourceGuards", "resourceGuards", "resourceGuards"), + resourceids.UserSpecifiedSegment("resourceGuardsName", "resourceGuardsValue"), + } +} + +// String returns a human-readable description of this Resource Guard ID +func (id ResourceGuardId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Guards Name: %q", id.ResourceGuardsName), + } + return fmt.Sprintf("Resource Guard (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotecteditemrequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotecteditemrequest.go new file mode 100644 index 00000000000..6ca7f837c6e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotecteditemrequest.go @@ -0,0 +1,137 @@ +package resourceguards + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = UpdateProtectedItemRequestId{} + +// UpdateProtectedItemRequestId is a struct representing the Resource ID for a Update Protected Item Request +type UpdateProtectedItemRequestId struct { + SubscriptionId string + ResourceGroupName string + ResourceGuardsName string + RequestName string +} + +// NewUpdateProtectedItemRequestID returns a new UpdateProtectedItemRequestId struct +func NewUpdateProtectedItemRequestID(subscriptionId string, resourceGroupName string, resourceGuardsName string, requestName string) UpdateProtectedItemRequestId { + return UpdateProtectedItemRequestId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceGuardsName: resourceGuardsName, + RequestName: requestName, + } +} + +// ParseUpdateProtectedItemRequestID parses 'input' into a UpdateProtectedItemRequestId +func ParseUpdateProtectedItemRequestID(input string) (*UpdateProtectedItemRequestId, error) { + parser := resourceids.NewParserFromResourceIdType(UpdateProtectedItemRequestId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := UpdateProtectedItemRequestId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + } + + if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { + return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseUpdateProtectedItemRequestIDInsensitively parses 'input' case-insensitively into a UpdateProtectedItemRequestId +// note: this method should only be used for API response data and not user input +func ParseUpdateProtectedItemRequestIDInsensitively(input string) (*UpdateProtectedItemRequestId, error) { + parser := resourceids.NewParserFromResourceIdType(UpdateProtectedItemRequestId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := UpdateProtectedItemRequestId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + } + + if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { + return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateUpdateProtectedItemRequestID checks that 'input' can be parsed as a Update Protected Item Request ID +func ValidateUpdateProtectedItemRequestID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseUpdateProtectedItemRequestID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Update Protected Item Request ID +func (id UpdateProtectedItemRequestId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/resourceGuards/%s/updateProtectedItemRequests/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardsName, id.RequestName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Update Protected Item Request ID +func (id UpdateProtectedItemRequestId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), + resourceids.StaticSegment("staticResourceGuards", "resourceGuards", "resourceGuards"), + resourceids.UserSpecifiedSegment("resourceGuardsName", "resourceGuardsValue"), + resourceids.StaticSegment("staticUpdateProtectedItemRequests", "updateProtectedItemRequests", "updateProtectedItemRequests"), + resourceids.UserSpecifiedSegment("requestName", "requestValue"), + } +} + +// String returns a human-readable description of this Update Protected Item Request ID +func (id UpdateProtectedItemRequestId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Guards Name: %q", id.ResourceGuardsName), + fmt.Sprintf("Request Name: %q", id.RequestName), + } + return fmt.Sprintf("Update Protected Item Request (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotectionpolicyrequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotectionpolicyrequest.go new file mode 100644 index 00000000000..62d21b46b55 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotectionpolicyrequest.go @@ -0,0 +1,137 @@ +package resourceguards + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = UpdateProtectionPolicyRequestId{} + +// UpdateProtectionPolicyRequestId is a struct representing the Resource ID for a Update Protection Policy Request +type UpdateProtectionPolicyRequestId struct { + SubscriptionId string + ResourceGroupName string + ResourceGuardsName string + RequestName string +} + +// NewUpdateProtectionPolicyRequestID returns a new UpdateProtectionPolicyRequestId struct +func NewUpdateProtectionPolicyRequestID(subscriptionId string, resourceGroupName string, resourceGuardsName string, requestName string) UpdateProtectionPolicyRequestId { + return UpdateProtectionPolicyRequestId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceGuardsName: resourceGuardsName, + RequestName: requestName, + } +} + +// ParseUpdateProtectionPolicyRequestID parses 'input' into a UpdateProtectionPolicyRequestId +func ParseUpdateProtectionPolicyRequestID(input string) (*UpdateProtectionPolicyRequestId, error) { + parser := resourceids.NewParserFromResourceIdType(UpdateProtectionPolicyRequestId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := UpdateProtectionPolicyRequestId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + } + + if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { + return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseUpdateProtectionPolicyRequestIDInsensitively parses 'input' case-insensitively into a UpdateProtectionPolicyRequestId +// note: this method should only be used for API response data and not user input +func ParseUpdateProtectionPolicyRequestIDInsensitively(input string) (*UpdateProtectionPolicyRequestId, error) { + parser := resourceids.NewParserFromResourceIdType(UpdateProtectionPolicyRequestId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := UpdateProtectionPolicyRequestId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceGuardsName, ok = parsed.Parsed["resourceGuardsName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGuardsName' was not found in the resource id %q", input) + } + + if id.RequestName, ok = parsed.Parsed["requestName"]; !ok { + return nil, fmt.Errorf("the segment 'requestName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateUpdateProtectionPolicyRequestID checks that 'input' can be parsed as a Update Protection Policy Request ID +func ValidateUpdateProtectionPolicyRequestID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseUpdateProtectionPolicyRequestID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Update Protection Policy Request ID +func (id UpdateProtectionPolicyRequestId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/resourceGuards/%s/updateProtectionPolicyRequests/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceGuardsName, id.RequestName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Update Protection Policy Request ID +func (id UpdateProtectionPolicyRequestId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDataProtection", "Microsoft.DataProtection", "Microsoft.DataProtection"), + resourceids.StaticSegment("staticResourceGuards", "resourceGuards", "resourceGuards"), + resourceids.UserSpecifiedSegment("resourceGuardsName", "resourceGuardsValue"), + resourceids.StaticSegment("staticUpdateProtectionPolicyRequests", "updateProtectionPolicyRequests", "updateProtectionPolicyRequests"), + resourceids.UserSpecifiedSegment("requestName", "requestValue"), + } +} + +// String returns a human-readable description of this Update Protection Policy Request ID +func (id UpdateProtectionPolicyRequestId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Guards Name: %q", id.ResourceGuardsName), + fmt.Sprintf("Request Name: %q", id.RequestName), + } + return fmt.Sprintf("Update Protection Policy Request (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_delete_autorest.go new file mode 100644 index 00000000000..b83d7994cbc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_delete_autorest.go @@ -0,0 +1,66 @@ +package resourceguards + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ResourceGuardsClient) Delete(ctx context.Context, id ResourceGuardId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ResourceGuardsClient) preparerForDelete(ctx context.Context, id ResourceGuardId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_get_autorest.go new file mode 100644 index 00000000000..c4e71b39e34 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_get_autorest.go @@ -0,0 +1,68 @@ +package resourceguards + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ResourceGuardResource +} + +// Get ... +func (c ResourceGuardsClient) Get(ctx context.Context, id ResourceGuardId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ResourceGuardsClient) preparerForGet(ctx context.Context, id ResourceGuardId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getbackupsecuritypinrequestsobjects_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getbackupsecuritypinrequestsobjects_autorest.go new file mode 100644 index 00000000000..71af337d7d4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getbackupsecuritypinrequestsobjects_autorest.go @@ -0,0 +1,186 @@ +package resourceguards + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetBackupSecurityPINRequestsObjectsOperationResponse struct { + HttpResponse *http.Response + Model *[]DppBaseResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (GetBackupSecurityPINRequestsObjectsOperationResponse, error) +} + +type GetBackupSecurityPINRequestsObjectsCompleteResult struct { + Items []DppBaseResource +} + +func (r GetBackupSecurityPINRequestsObjectsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r GetBackupSecurityPINRequestsObjectsOperationResponse) LoadMore(ctx context.Context) (resp GetBackupSecurityPINRequestsObjectsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// GetBackupSecurityPINRequestsObjects ... +func (c ResourceGuardsClient) GetBackupSecurityPINRequestsObjects(ctx context.Context, id ResourceGuardId) (resp GetBackupSecurityPINRequestsObjectsOperationResponse, err error) { + req, err := c.preparerForGetBackupSecurityPINRequestsObjects(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetBackupSecurityPINRequestsObjects", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetBackupSecurityPINRequestsObjects", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForGetBackupSecurityPINRequestsObjects(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetBackupSecurityPINRequestsObjects", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForGetBackupSecurityPINRequestsObjects prepares the GetBackupSecurityPINRequestsObjects request. +func (c ResourceGuardsClient) preparerForGetBackupSecurityPINRequestsObjects(ctx context.Context, id ResourceGuardId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/getBackupSecurityPINRequests", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForGetBackupSecurityPINRequestsObjectsWithNextLink prepares the GetBackupSecurityPINRequestsObjects request with the given nextLink token. +func (c ResourceGuardsClient) preparerForGetBackupSecurityPINRequestsObjectsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetBackupSecurityPINRequestsObjects handles the response to the GetBackupSecurityPINRequestsObjects request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForGetBackupSecurityPINRequestsObjects(resp *http.Response) (result GetBackupSecurityPINRequestsObjectsOperationResponse, err error) { + type page struct { + Values []DppBaseResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result GetBackupSecurityPINRequestsObjectsOperationResponse, err error) { + req, err := c.preparerForGetBackupSecurityPINRequestsObjectsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetBackupSecurityPINRequestsObjects", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetBackupSecurityPINRequestsObjects", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetBackupSecurityPINRequestsObjects(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetBackupSecurityPINRequestsObjects", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// GetBackupSecurityPINRequestsObjectsComplete retrieves all of the results into a single object +func (c ResourceGuardsClient) GetBackupSecurityPINRequestsObjectsComplete(ctx context.Context, id ResourceGuardId) (GetBackupSecurityPINRequestsObjectsCompleteResult, error) { + return c.GetBackupSecurityPINRequestsObjectsCompleteMatchingPredicate(ctx, id, DppBaseResourceOperationPredicate{}) +} + +// GetBackupSecurityPINRequestsObjectsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ResourceGuardsClient) GetBackupSecurityPINRequestsObjectsCompleteMatchingPredicate(ctx context.Context, id ResourceGuardId, predicate DppBaseResourceOperationPredicate) (resp GetBackupSecurityPINRequestsObjectsCompleteResult, err error) { + items := make([]DppBaseResource, 0) + + page, err := c.GetBackupSecurityPINRequestsObjects(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := GetBackupSecurityPINRequestsObjectsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultbackupsecuritypinrequestsobject_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultbackupsecuritypinrequestsobject_autorest.go new file mode 100644 index 00000000000..56fc2e5311c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultbackupsecuritypinrequestsobject_autorest.go @@ -0,0 +1,68 @@ +package resourceguards + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDefaultBackupSecurityPINRequestsObjectOperationResponse struct { + HttpResponse *http.Response + Model *DppBaseResource +} + +// GetDefaultBackupSecurityPINRequestsObject ... +func (c ResourceGuardsClient) GetDefaultBackupSecurityPINRequestsObject(ctx context.Context, id GetBackupSecurityPINRequestId) (result GetDefaultBackupSecurityPINRequestsObjectOperationResponse, err error) { + req, err := c.preparerForGetDefaultBackupSecurityPINRequestsObject(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultBackupSecurityPINRequestsObject", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultBackupSecurityPINRequestsObject", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetDefaultBackupSecurityPINRequestsObject(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultBackupSecurityPINRequestsObject", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetDefaultBackupSecurityPINRequestsObject prepares the GetDefaultBackupSecurityPINRequestsObject request. +func (c ResourceGuardsClient) preparerForGetDefaultBackupSecurityPINRequestsObject(ctx context.Context, id GetBackupSecurityPINRequestId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetDefaultBackupSecurityPINRequestsObject handles the response to the GetDefaultBackupSecurityPINRequestsObject request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForGetDefaultBackupSecurityPINRequestsObject(resp *http.Response) (result GetDefaultBackupSecurityPINRequestsObjectOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultdeleteprotecteditemrequestsobject_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultdeleteprotecteditemrequestsobject_autorest.go new file mode 100644 index 00000000000..5911c0349eb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultdeleteprotecteditemrequestsobject_autorest.go @@ -0,0 +1,68 @@ +package resourceguards + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDefaultDeleteProtectedItemRequestsObjectOperationResponse struct { + HttpResponse *http.Response + Model *DppBaseResource +} + +// GetDefaultDeleteProtectedItemRequestsObject ... +func (c ResourceGuardsClient) GetDefaultDeleteProtectedItemRequestsObject(ctx context.Context, id DeleteProtectedItemRequestId) (result GetDefaultDeleteProtectedItemRequestsObjectOperationResponse, err error) { + req, err := c.preparerForGetDefaultDeleteProtectedItemRequestsObject(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultDeleteProtectedItemRequestsObject", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultDeleteProtectedItemRequestsObject", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetDefaultDeleteProtectedItemRequestsObject(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultDeleteProtectedItemRequestsObject", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetDefaultDeleteProtectedItemRequestsObject prepares the GetDefaultDeleteProtectedItemRequestsObject request. +func (c ResourceGuardsClient) preparerForGetDefaultDeleteProtectedItemRequestsObject(ctx context.Context, id DeleteProtectedItemRequestId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetDefaultDeleteProtectedItemRequestsObject handles the response to the GetDefaultDeleteProtectedItemRequestsObject request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForGetDefaultDeleteProtectedItemRequestsObject(resp *http.Response) (result GetDefaultDeleteProtectedItemRequestsObjectOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultdeleteresourceguardproxyrequestsobject_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultdeleteresourceguardproxyrequestsobject_autorest.go new file mode 100644 index 00000000000..635d82515a7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultdeleteresourceguardproxyrequestsobject_autorest.go @@ -0,0 +1,68 @@ +package resourceguards + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDefaultDeleteResourceGuardProxyRequestsObjectOperationResponse struct { + HttpResponse *http.Response + Model *DppBaseResource +} + +// GetDefaultDeleteResourceGuardProxyRequestsObject ... +func (c ResourceGuardsClient) GetDefaultDeleteResourceGuardProxyRequestsObject(ctx context.Context, id DeleteResourceGuardProxyRequestId) (result GetDefaultDeleteResourceGuardProxyRequestsObjectOperationResponse, err error) { + req, err := c.preparerForGetDefaultDeleteResourceGuardProxyRequestsObject(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultDeleteResourceGuardProxyRequestsObject", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultDeleteResourceGuardProxyRequestsObject", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetDefaultDeleteResourceGuardProxyRequestsObject(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultDeleteResourceGuardProxyRequestsObject", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetDefaultDeleteResourceGuardProxyRequestsObject prepares the GetDefaultDeleteResourceGuardProxyRequestsObject request. +func (c ResourceGuardsClient) preparerForGetDefaultDeleteResourceGuardProxyRequestsObject(ctx context.Context, id DeleteResourceGuardProxyRequestId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetDefaultDeleteResourceGuardProxyRequestsObject handles the response to the GetDefaultDeleteResourceGuardProxyRequestsObject request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForGetDefaultDeleteResourceGuardProxyRequestsObject(resp *http.Response) (result GetDefaultDeleteResourceGuardProxyRequestsObjectOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultdisablesoftdeleterequestsobject_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultdisablesoftdeleterequestsobject_autorest.go new file mode 100644 index 00000000000..9296842dd7a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultdisablesoftdeleterequestsobject_autorest.go @@ -0,0 +1,68 @@ +package resourceguards + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDefaultDisableSoftDeleteRequestsObjectOperationResponse struct { + HttpResponse *http.Response + Model *DppBaseResource +} + +// GetDefaultDisableSoftDeleteRequestsObject ... +func (c ResourceGuardsClient) GetDefaultDisableSoftDeleteRequestsObject(ctx context.Context, id DisableSoftDeleteRequestId) (result GetDefaultDisableSoftDeleteRequestsObjectOperationResponse, err error) { + req, err := c.preparerForGetDefaultDisableSoftDeleteRequestsObject(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultDisableSoftDeleteRequestsObject", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultDisableSoftDeleteRequestsObject", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetDefaultDisableSoftDeleteRequestsObject(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultDisableSoftDeleteRequestsObject", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetDefaultDisableSoftDeleteRequestsObject prepares the GetDefaultDisableSoftDeleteRequestsObject request. +func (c ResourceGuardsClient) preparerForGetDefaultDisableSoftDeleteRequestsObject(ctx context.Context, id DisableSoftDeleteRequestId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetDefaultDisableSoftDeleteRequestsObject handles the response to the GetDefaultDisableSoftDeleteRequestsObject request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForGetDefaultDisableSoftDeleteRequestsObject(resp *http.Response) (result GetDefaultDisableSoftDeleteRequestsObjectOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultupdateprotecteditemrequestsobject_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultupdateprotecteditemrequestsobject_autorest.go new file mode 100644 index 00000000000..34dfce5b02f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultupdateprotecteditemrequestsobject_autorest.go @@ -0,0 +1,68 @@ +package resourceguards + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDefaultUpdateProtectedItemRequestsObjectOperationResponse struct { + HttpResponse *http.Response + Model *DppBaseResource +} + +// GetDefaultUpdateProtectedItemRequestsObject ... +func (c ResourceGuardsClient) GetDefaultUpdateProtectedItemRequestsObject(ctx context.Context, id UpdateProtectedItemRequestId) (result GetDefaultUpdateProtectedItemRequestsObjectOperationResponse, err error) { + req, err := c.preparerForGetDefaultUpdateProtectedItemRequestsObject(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultUpdateProtectedItemRequestsObject", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultUpdateProtectedItemRequestsObject", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetDefaultUpdateProtectedItemRequestsObject(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultUpdateProtectedItemRequestsObject", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetDefaultUpdateProtectedItemRequestsObject prepares the GetDefaultUpdateProtectedItemRequestsObject request. +func (c ResourceGuardsClient) preparerForGetDefaultUpdateProtectedItemRequestsObject(ctx context.Context, id UpdateProtectedItemRequestId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetDefaultUpdateProtectedItemRequestsObject handles the response to the GetDefaultUpdateProtectedItemRequestsObject request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForGetDefaultUpdateProtectedItemRequestsObject(resp *http.Response) (result GetDefaultUpdateProtectedItemRequestsObjectOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultupdateprotectionpolicyrequestsobject_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultupdateprotectionpolicyrequestsobject_autorest.go new file mode 100644 index 00000000000..b771a36f94b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdefaultupdateprotectionpolicyrequestsobject_autorest.go @@ -0,0 +1,68 @@ +package resourceguards + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDefaultUpdateProtectionPolicyRequestsObjectOperationResponse struct { + HttpResponse *http.Response + Model *DppBaseResource +} + +// GetDefaultUpdateProtectionPolicyRequestsObject ... +func (c ResourceGuardsClient) GetDefaultUpdateProtectionPolicyRequestsObject(ctx context.Context, id UpdateProtectionPolicyRequestId) (result GetDefaultUpdateProtectionPolicyRequestsObjectOperationResponse, err error) { + req, err := c.preparerForGetDefaultUpdateProtectionPolicyRequestsObject(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultUpdateProtectionPolicyRequestsObject", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultUpdateProtectionPolicyRequestsObject", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetDefaultUpdateProtectionPolicyRequestsObject(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDefaultUpdateProtectionPolicyRequestsObject", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetDefaultUpdateProtectionPolicyRequestsObject prepares the GetDefaultUpdateProtectionPolicyRequestsObject request. +func (c ResourceGuardsClient) preparerForGetDefaultUpdateProtectionPolicyRequestsObject(ctx context.Context, id UpdateProtectionPolicyRequestId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetDefaultUpdateProtectionPolicyRequestsObject handles the response to the GetDefaultUpdateProtectionPolicyRequestsObject request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForGetDefaultUpdateProtectionPolicyRequestsObject(resp *http.Response) (result GetDefaultUpdateProtectionPolicyRequestsObjectOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdeleteprotecteditemrequestsobjects_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdeleteprotecteditemrequestsobjects_autorest.go new file mode 100644 index 00000000000..eb482c39b78 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdeleteprotecteditemrequestsobjects_autorest.go @@ -0,0 +1,186 @@ +package resourceguards + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDeleteProtectedItemRequestsObjectsOperationResponse struct { + HttpResponse *http.Response + Model *[]DppBaseResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (GetDeleteProtectedItemRequestsObjectsOperationResponse, error) +} + +type GetDeleteProtectedItemRequestsObjectsCompleteResult struct { + Items []DppBaseResource +} + +func (r GetDeleteProtectedItemRequestsObjectsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r GetDeleteProtectedItemRequestsObjectsOperationResponse) LoadMore(ctx context.Context) (resp GetDeleteProtectedItemRequestsObjectsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// GetDeleteProtectedItemRequestsObjects ... +func (c ResourceGuardsClient) GetDeleteProtectedItemRequestsObjects(ctx context.Context, id ResourceGuardId) (resp GetDeleteProtectedItemRequestsObjectsOperationResponse, err error) { + req, err := c.preparerForGetDeleteProtectedItemRequestsObjects(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDeleteProtectedItemRequestsObjects", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDeleteProtectedItemRequestsObjects", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForGetDeleteProtectedItemRequestsObjects(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDeleteProtectedItemRequestsObjects", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForGetDeleteProtectedItemRequestsObjects prepares the GetDeleteProtectedItemRequestsObjects request. +func (c ResourceGuardsClient) preparerForGetDeleteProtectedItemRequestsObjects(ctx context.Context, id ResourceGuardId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/deleteProtectedItemRequests", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForGetDeleteProtectedItemRequestsObjectsWithNextLink prepares the GetDeleteProtectedItemRequestsObjects request with the given nextLink token. +func (c ResourceGuardsClient) preparerForGetDeleteProtectedItemRequestsObjectsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetDeleteProtectedItemRequestsObjects handles the response to the GetDeleteProtectedItemRequestsObjects request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForGetDeleteProtectedItemRequestsObjects(resp *http.Response) (result GetDeleteProtectedItemRequestsObjectsOperationResponse, err error) { + type page struct { + Values []DppBaseResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result GetDeleteProtectedItemRequestsObjectsOperationResponse, err error) { + req, err := c.preparerForGetDeleteProtectedItemRequestsObjectsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDeleteProtectedItemRequestsObjects", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDeleteProtectedItemRequestsObjects", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetDeleteProtectedItemRequestsObjects(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDeleteProtectedItemRequestsObjects", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// GetDeleteProtectedItemRequestsObjectsComplete retrieves all of the results into a single object +func (c ResourceGuardsClient) GetDeleteProtectedItemRequestsObjectsComplete(ctx context.Context, id ResourceGuardId) (GetDeleteProtectedItemRequestsObjectsCompleteResult, error) { + return c.GetDeleteProtectedItemRequestsObjectsCompleteMatchingPredicate(ctx, id, DppBaseResourceOperationPredicate{}) +} + +// GetDeleteProtectedItemRequestsObjectsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ResourceGuardsClient) GetDeleteProtectedItemRequestsObjectsCompleteMatchingPredicate(ctx context.Context, id ResourceGuardId, predicate DppBaseResourceOperationPredicate) (resp GetDeleteProtectedItemRequestsObjectsCompleteResult, err error) { + items := make([]DppBaseResource, 0) + + page, err := c.GetDeleteProtectedItemRequestsObjects(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := GetDeleteProtectedItemRequestsObjectsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdeleteresourceguardproxyrequestsobjects_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdeleteresourceguardproxyrequestsobjects_autorest.go new file mode 100644 index 00000000000..4f54beba9d4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdeleteresourceguardproxyrequestsobjects_autorest.go @@ -0,0 +1,186 @@ +package resourceguards + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDeleteResourceGuardProxyRequestsObjectsOperationResponse struct { + HttpResponse *http.Response + Model *[]DppBaseResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (GetDeleteResourceGuardProxyRequestsObjectsOperationResponse, error) +} + +type GetDeleteResourceGuardProxyRequestsObjectsCompleteResult struct { + Items []DppBaseResource +} + +func (r GetDeleteResourceGuardProxyRequestsObjectsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r GetDeleteResourceGuardProxyRequestsObjectsOperationResponse) LoadMore(ctx context.Context) (resp GetDeleteResourceGuardProxyRequestsObjectsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// GetDeleteResourceGuardProxyRequestsObjects ... +func (c ResourceGuardsClient) GetDeleteResourceGuardProxyRequestsObjects(ctx context.Context, id ResourceGuardId) (resp GetDeleteResourceGuardProxyRequestsObjectsOperationResponse, err error) { + req, err := c.preparerForGetDeleteResourceGuardProxyRequestsObjects(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDeleteResourceGuardProxyRequestsObjects", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDeleteResourceGuardProxyRequestsObjects", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForGetDeleteResourceGuardProxyRequestsObjects(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDeleteResourceGuardProxyRequestsObjects", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForGetDeleteResourceGuardProxyRequestsObjects prepares the GetDeleteResourceGuardProxyRequestsObjects request. +func (c ResourceGuardsClient) preparerForGetDeleteResourceGuardProxyRequestsObjects(ctx context.Context, id ResourceGuardId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/deleteResourceGuardProxyRequests", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForGetDeleteResourceGuardProxyRequestsObjectsWithNextLink prepares the GetDeleteResourceGuardProxyRequestsObjects request with the given nextLink token. +func (c ResourceGuardsClient) preparerForGetDeleteResourceGuardProxyRequestsObjectsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetDeleteResourceGuardProxyRequestsObjects handles the response to the GetDeleteResourceGuardProxyRequestsObjects request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForGetDeleteResourceGuardProxyRequestsObjects(resp *http.Response) (result GetDeleteResourceGuardProxyRequestsObjectsOperationResponse, err error) { + type page struct { + Values []DppBaseResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result GetDeleteResourceGuardProxyRequestsObjectsOperationResponse, err error) { + req, err := c.preparerForGetDeleteResourceGuardProxyRequestsObjectsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDeleteResourceGuardProxyRequestsObjects", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDeleteResourceGuardProxyRequestsObjects", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetDeleteResourceGuardProxyRequestsObjects(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDeleteResourceGuardProxyRequestsObjects", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// GetDeleteResourceGuardProxyRequestsObjectsComplete retrieves all of the results into a single object +func (c ResourceGuardsClient) GetDeleteResourceGuardProxyRequestsObjectsComplete(ctx context.Context, id ResourceGuardId) (GetDeleteResourceGuardProxyRequestsObjectsCompleteResult, error) { + return c.GetDeleteResourceGuardProxyRequestsObjectsCompleteMatchingPredicate(ctx, id, DppBaseResourceOperationPredicate{}) +} + +// GetDeleteResourceGuardProxyRequestsObjectsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ResourceGuardsClient) GetDeleteResourceGuardProxyRequestsObjectsCompleteMatchingPredicate(ctx context.Context, id ResourceGuardId, predicate DppBaseResourceOperationPredicate) (resp GetDeleteResourceGuardProxyRequestsObjectsCompleteResult, err error) { + items := make([]DppBaseResource, 0) + + page, err := c.GetDeleteResourceGuardProxyRequestsObjects(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := GetDeleteResourceGuardProxyRequestsObjectsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdisablesoftdeleterequestsobjects_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdisablesoftdeleterequestsobjects_autorest.go new file mode 100644 index 00000000000..59ba0a661fc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getdisablesoftdeleterequestsobjects_autorest.go @@ -0,0 +1,186 @@ +package resourceguards + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDisableSoftDeleteRequestsObjectsOperationResponse struct { + HttpResponse *http.Response + Model *[]DppBaseResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (GetDisableSoftDeleteRequestsObjectsOperationResponse, error) +} + +type GetDisableSoftDeleteRequestsObjectsCompleteResult struct { + Items []DppBaseResource +} + +func (r GetDisableSoftDeleteRequestsObjectsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r GetDisableSoftDeleteRequestsObjectsOperationResponse) LoadMore(ctx context.Context) (resp GetDisableSoftDeleteRequestsObjectsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// GetDisableSoftDeleteRequestsObjects ... +func (c ResourceGuardsClient) GetDisableSoftDeleteRequestsObjects(ctx context.Context, id ResourceGuardId) (resp GetDisableSoftDeleteRequestsObjectsOperationResponse, err error) { + req, err := c.preparerForGetDisableSoftDeleteRequestsObjects(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDisableSoftDeleteRequestsObjects", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDisableSoftDeleteRequestsObjects", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForGetDisableSoftDeleteRequestsObjects(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDisableSoftDeleteRequestsObjects", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForGetDisableSoftDeleteRequestsObjects prepares the GetDisableSoftDeleteRequestsObjects request. +func (c ResourceGuardsClient) preparerForGetDisableSoftDeleteRequestsObjects(ctx context.Context, id ResourceGuardId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/disableSoftDeleteRequests", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForGetDisableSoftDeleteRequestsObjectsWithNextLink prepares the GetDisableSoftDeleteRequestsObjects request with the given nextLink token. +func (c ResourceGuardsClient) preparerForGetDisableSoftDeleteRequestsObjectsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetDisableSoftDeleteRequestsObjects handles the response to the GetDisableSoftDeleteRequestsObjects request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForGetDisableSoftDeleteRequestsObjects(resp *http.Response) (result GetDisableSoftDeleteRequestsObjectsOperationResponse, err error) { + type page struct { + Values []DppBaseResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result GetDisableSoftDeleteRequestsObjectsOperationResponse, err error) { + req, err := c.preparerForGetDisableSoftDeleteRequestsObjectsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDisableSoftDeleteRequestsObjects", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDisableSoftDeleteRequestsObjects", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetDisableSoftDeleteRequestsObjects(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetDisableSoftDeleteRequestsObjects", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// GetDisableSoftDeleteRequestsObjectsComplete retrieves all of the results into a single object +func (c ResourceGuardsClient) GetDisableSoftDeleteRequestsObjectsComplete(ctx context.Context, id ResourceGuardId) (GetDisableSoftDeleteRequestsObjectsCompleteResult, error) { + return c.GetDisableSoftDeleteRequestsObjectsCompleteMatchingPredicate(ctx, id, DppBaseResourceOperationPredicate{}) +} + +// GetDisableSoftDeleteRequestsObjectsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ResourceGuardsClient) GetDisableSoftDeleteRequestsObjectsCompleteMatchingPredicate(ctx context.Context, id ResourceGuardId, predicate DppBaseResourceOperationPredicate) (resp GetDisableSoftDeleteRequestsObjectsCompleteResult, err error) { + items := make([]DppBaseResource, 0) + + page, err := c.GetDisableSoftDeleteRequestsObjects(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := GetDisableSoftDeleteRequestsObjectsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getresourcesinresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getresourcesinresourcegroup_autorest.go new file mode 100644 index 00000000000..ed14f77871b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getresourcesinresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package resourceguards + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetResourcesInResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]ResourceGuardResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (GetResourcesInResourceGroupOperationResponse, error) +} + +type GetResourcesInResourceGroupCompleteResult struct { + Items []ResourceGuardResource +} + +func (r GetResourcesInResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r GetResourcesInResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp GetResourcesInResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// GetResourcesInResourceGroup ... +func (c ResourceGuardsClient) GetResourcesInResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp GetResourcesInResourceGroupOperationResponse, err error) { + req, err := c.preparerForGetResourcesInResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetResourcesInResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetResourcesInResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForGetResourcesInResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetResourcesInResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForGetResourcesInResourceGroup prepares the GetResourcesInResourceGroup request. +func (c ResourceGuardsClient) preparerForGetResourcesInResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DataProtection/resourceGuards", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForGetResourcesInResourceGroupWithNextLink prepares the GetResourcesInResourceGroup request with the given nextLink token. +func (c ResourceGuardsClient) preparerForGetResourcesInResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetResourcesInResourceGroup handles the response to the GetResourcesInResourceGroup request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForGetResourcesInResourceGroup(resp *http.Response) (result GetResourcesInResourceGroupOperationResponse, err error) { + type page struct { + Values []ResourceGuardResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result GetResourcesInResourceGroupOperationResponse, err error) { + req, err := c.preparerForGetResourcesInResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetResourcesInResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetResourcesInResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetResourcesInResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetResourcesInResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// GetResourcesInResourceGroupComplete retrieves all of the results into a single object +func (c ResourceGuardsClient) GetResourcesInResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (GetResourcesInResourceGroupCompleteResult, error) { + return c.GetResourcesInResourceGroupCompleteMatchingPredicate(ctx, id, ResourceGuardResourceOperationPredicate{}) +} + +// GetResourcesInResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ResourceGuardsClient) GetResourcesInResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ResourceGuardResourceOperationPredicate) (resp GetResourcesInResourceGroupCompleteResult, err error) { + items := make([]ResourceGuardResource, 0) + + page, err := c.GetResourcesInResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := GetResourcesInResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getresourcesinsubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getresourcesinsubscription_autorest.go new file mode 100644 index 00000000000..c0bd7de8e42 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getresourcesinsubscription_autorest.go @@ -0,0 +1,187 @@ +package resourceguards + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetResourcesInSubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]ResourceGuardResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (GetResourcesInSubscriptionOperationResponse, error) +} + +type GetResourcesInSubscriptionCompleteResult struct { + Items []ResourceGuardResource +} + +func (r GetResourcesInSubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r GetResourcesInSubscriptionOperationResponse) LoadMore(ctx context.Context) (resp GetResourcesInSubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// GetResourcesInSubscription ... +func (c ResourceGuardsClient) GetResourcesInSubscription(ctx context.Context, id commonids.SubscriptionId) (resp GetResourcesInSubscriptionOperationResponse, err error) { + req, err := c.preparerForGetResourcesInSubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetResourcesInSubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetResourcesInSubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForGetResourcesInSubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetResourcesInSubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForGetResourcesInSubscription prepares the GetResourcesInSubscription request. +func (c ResourceGuardsClient) preparerForGetResourcesInSubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DataProtection/resourceGuards", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForGetResourcesInSubscriptionWithNextLink prepares the GetResourcesInSubscription request with the given nextLink token. +func (c ResourceGuardsClient) preparerForGetResourcesInSubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetResourcesInSubscription handles the response to the GetResourcesInSubscription request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForGetResourcesInSubscription(resp *http.Response) (result GetResourcesInSubscriptionOperationResponse, err error) { + type page struct { + Values []ResourceGuardResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result GetResourcesInSubscriptionOperationResponse, err error) { + req, err := c.preparerForGetResourcesInSubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetResourcesInSubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetResourcesInSubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetResourcesInSubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetResourcesInSubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// GetResourcesInSubscriptionComplete retrieves all of the results into a single object +func (c ResourceGuardsClient) GetResourcesInSubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (GetResourcesInSubscriptionCompleteResult, error) { + return c.GetResourcesInSubscriptionCompleteMatchingPredicate(ctx, id, ResourceGuardResourceOperationPredicate{}) +} + +// GetResourcesInSubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ResourceGuardsClient) GetResourcesInSubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ResourceGuardResourceOperationPredicate) (resp GetResourcesInSubscriptionCompleteResult, err error) { + items := make([]ResourceGuardResource, 0) + + page, err := c.GetResourcesInSubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := GetResourcesInSubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getupdateprotecteditemrequestsobjects_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getupdateprotecteditemrequestsobjects_autorest.go new file mode 100644 index 00000000000..0d1355e36b8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getupdateprotecteditemrequestsobjects_autorest.go @@ -0,0 +1,186 @@ +package resourceguards + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetUpdateProtectedItemRequestsObjectsOperationResponse struct { + HttpResponse *http.Response + Model *[]DppBaseResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (GetUpdateProtectedItemRequestsObjectsOperationResponse, error) +} + +type GetUpdateProtectedItemRequestsObjectsCompleteResult struct { + Items []DppBaseResource +} + +func (r GetUpdateProtectedItemRequestsObjectsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r GetUpdateProtectedItemRequestsObjectsOperationResponse) LoadMore(ctx context.Context) (resp GetUpdateProtectedItemRequestsObjectsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// GetUpdateProtectedItemRequestsObjects ... +func (c ResourceGuardsClient) GetUpdateProtectedItemRequestsObjects(ctx context.Context, id ResourceGuardId) (resp GetUpdateProtectedItemRequestsObjectsOperationResponse, err error) { + req, err := c.preparerForGetUpdateProtectedItemRequestsObjects(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetUpdateProtectedItemRequestsObjects", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetUpdateProtectedItemRequestsObjects", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForGetUpdateProtectedItemRequestsObjects(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetUpdateProtectedItemRequestsObjects", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForGetUpdateProtectedItemRequestsObjects prepares the GetUpdateProtectedItemRequestsObjects request. +func (c ResourceGuardsClient) preparerForGetUpdateProtectedItemRequestsObjects(ctx context.Context, id ResourceGuardId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/updateProtectedItemRequests", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForGetUpdateProtectedItemRequestsObjectsWithNextLink prepares the GetUpdateProtectedItemRequestsObjects request with the given nextLink token. +func (c ResourceGuardsClient) preparerForGetUpdateProtectedItemRequestsObjectsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetUpdateProtectedItemRequestsObjects handles the response to the GetUpdateProtectedItemRequestsObjects request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForGetUpdateProtectedItemRequestsObjects(resp *http.Response) (result GetUpdateProtectedItemRequestsObjectsOperationResponse, err error) { + type page struct { + Values []DppBaseResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result GetUpdateProtectedItemRequestsObjectsOperationResponse, err error) { + req, err := c.preparerForGetUpdateProtectedItemRequestsObjectsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetUpdateProtectedItemRequestsObjects", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetUpdateProtectedItemRequestsObjects", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetUpdateProtectedItemRequestsObjects(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetUpdateProtectedItemRequestsObjects", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// GetUpdateProtectedItemRequestsObjectsComplete retrieves all of the results into a single object +func (c ResourceGuardsClient) GetUpdateProtectedItemRequestsObjectsComplete(ctx context.Context, id ResourceGuardId) (GetUpdateProtectedItemRequestsObjectsCompleteResult, error) { + return c.GetUpdateProtectedItemRequestsObjectsCompleteMatchingPredicate(ctx, id, DppBaseResourceOperationPredicate{}) +} + +// GetUpdateProtectedItemRequestsObjectsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ResourceGuardsClient) GetUpdateProtectedItemRequestsObjectsCompleteMatchingPredicate(ctx context.Context, id ResourceGuardId, predicate DppBaseResourceOperationPredicate) (resp GetUpdateProtectedItemRequestsObjectsCompleteResult, err error) { + items := make([]DppBaseResource, 0) + + page, err := c.GetUpdateProtectedItemRequestsObjects(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := GetUpdateProtectedItemRequestsObjectsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getupdateprotectionpolicyrequestsobjects_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getupdateprotectionpolicyrequestsobjects_autorest.go new file mode 100644 index 00000000000..af27fd48298 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_getupdateprotectionpolicyrequestsobjects_autorest.go @@ -0,0 +1,186 @@ +package resourceguards + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetUpdateProtectionPolicyRequestsObjectsOperationResponse struct { + HttpResponse *http.Response + Model *[]DppBaseResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (GetUpdateProtectionPolicyRequestsObjectsOperationResponse, error) +} + +type GetUpdateProtectionPolicyRequestsObjectsCompleteResult struct { + Items []DppBaseResource +} + +func (r GetUpdateProtectionPolicyRequestsObjectsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r GetUpdateProtectionPolicyRequestsObjectsOperationResponse) LoadMore(ctx context.Context) (resp GetUpdateProtectionPolicyRequestsObjectsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// GetUpdateProtectionPolicyRequestsObjects ... +func (c ResourceGuardsClient) GetUpdateProtectionPolicyRequestsObjects(ctx context.Context, id ResourceGuardId) (resp GetUpdateProtectionPolicyRequestsObjectsOperationResponse, err error) { + req, err := c.preparerForGetUpdateProtectionPolicyRequestsObjects(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetUpdateProtectionPolicyRequestsObjects", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetUpdateProtectionPolicyRequestsObjects", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForGetUpdateProtectionPolicyRequestsObjects(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetUpdateProtectionPolicyRequestsObjects", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForGetUpdateProtectionPolicyRequestsObjects prepares the GetUpdateProtectionPolicyRequestsObjects request. +func (c ResourceGuardsClient) preparerForGetUpdateProtectionPolicyRequestsObjects(ctx context.Context, id ResourceGuardId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/updateProtectionPolicyRequests", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForGetUpdateProtectionPolicyRequestsObjectsWithNextLink prepares the GetUpdateProtectionPolicyRequestsObjects request with the given nextLink token. +func (c ResourceGuardsClient) preparerForGetUpdateProtectionPolicyRequestsObjectsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetUpdateProtectionPolicyRequestsObjects handles the response to the GetUpdateProtectionPolicyRequestsObjects request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForGetUpdateProtectionPolicyRequestsObjects(resp *http.Response) (result GetUpdateProtectionPolicyRequestsObjectsOperationResponse, err error) { + type page struct { + Values []DppBaseResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result GetUpdateProtectionPolicyRequestsObjectsOperationResponse, err error) { + req, err := c.preparerForGetUpdateProtectionPolicyRequestsObjectsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetUpdateProtectionPolicyRequestsObjects", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetUpdateProtectionPolicyRequestsObjects", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetUpdateProtectionPolicyRequestsObjects(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "GetUpdateProtectionPolicyRequestsObjects", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// GetUpdateProtectionPolicyRequestsObjectsComplete retrieves all of the results into a single object +func (c ResourceGuardsClient) GetUpdateProtectionPolicyRequestsObjectsComplete(ctx context.Context, id ResourceGuardId) (GetUpdateProtectionPolicyRequestsObjectsCompleteResult, error) { + return c.GetUpdateProtectionPolicyRequestsObjectsCompleteMatchingPredicate(ctx, id, DppBaseResourceOperationPredicate{}) +} + +// GetUpdateProtectionPolicyRequestsObjectsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ResourceGuardsClient) GetUpdateProtectionPolicyRequestsObjectsCompleteMatchingPredicate(ctx context.Context, id ResourceGuardId, predicate DppBaseResourceOperationPredicate) (resp GetUpdateProtectionPolicyRequestsObjectsCompleteResult, err error) { + items := make([]DppBaseResource, 0) + + page, err := c.GetUpdateProtectionPolicyRequestsObjects(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := GetUpdateProtectionPolicyRequestsObjectsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_patch_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_patch_autorest.go new file mode 100644 index 00000000000..e1bdf8d1562 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_patch_autorest.go @@ -0,0 +1,69 @@ +package resourceguards + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchOperationResponse struct { + HttpResponse *http.Response + Model *ResourceGuardResource +} + +// Patch ... +func (c ResourceGuardsClient) Patch(ctx context.Context, id ResourceGuardId, input PatchResourceRequestInput) (result PatchOperationResponse, err error) { + req, err := c.preparerForPatch(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "Patch", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "Patch", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPatch(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "Patch", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPatch prepares the Patch request. +func (c ResourceGuardsClient) preparerForPatch(ctx context.Context, id ResourceGuardId, input PatchResourceRequestInput) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPatch handles the response to the Patch request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForPatch(resp *http.Response) (result PatchOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_put_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_put_autorest.go new file mode 100644 index 00000000000..c3600ac7c29 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/method_put_autorest.go @@ -0,0 +1,69 @@ +package resourceguards + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PutOperationResponse struct { + HttpResponse *http.Response + Model *ResourceGuardResource +} + +// Put ... +func (c ResourceGuardsClient) Put(ctx context.Context, id ResourceGuardId, input ResourceGuardResource) (result PutOperationResponse, err error) { + req, err := c.preparerForPut(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "Put", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "Put", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPut(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resourceguards.ResourceGuardsClient", "Put", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPut prepares the Put request. +func (c ResourceGuardsClient) preparerForPut(ctx context.Context, id ResourceGuardId, input ResourceGuardResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPut handles the response to the Put request. The method always +// closes the http.Response Body. +func (c ResourceGuardsClient) responderForPut(resp *http.Response) (result PutOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_azuremonitoralertsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_azuremonitoralertsettings.go new file mode 100644 index 00000000000..5da5f5599b6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_azuremonitoralertsettings.go @@ -0,0 +1,8 @@ +package resourceguards + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureMonitorAlertSettings struct { + AlertsForAllJobFailures *AlertsState `json:"alertsForAllJobFailures,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_dppbaseresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_dppbaseresource.go new file mode 100644 index 00000000000..68d4e93d8b5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_dppbaseresource.go @@ -0,0 +1,10 @@ +package resourceguards + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DppBaseResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_dppidentitydetails.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_dppidentitydetails.go new file mode 100644 index 00000000000..0bdda779492 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_dppidentitydetails.go @@ -0,0 +1,10 @@ +package resourceguards + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DppIdentityDetails struct { + PrincipalId *string `json:"principalId,omitempty"` + TenantId *string `json:"tenantId,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_monitoringsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_monitoringsettings.go new file mode 100644 index 00000000000..5b235dfc25f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_monitoringsettings.go @@ -0,0 +1,8 @@ +package resourceguards + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoringSettings struct { + AzureMonitorAlertSettings *AzureMonitorAlertSettings `json:"azureMonitorAlertSettings,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_patchbackupvaultinput.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_patchbackupvaultinput.go new file mode 100644 index 00000000000..0261097709c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_patchbackupvaultinput.go @@ -0,0 +1,8 @@ +package resourceguards + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchBackupVaultInput struct { + MonitoringSettings *MonitoringSettings `json:"monitoringSettings,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_patchresourcerequestinput.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_patchresourcerequestinput.go new file mode 100644 index 00000000000..bd691b1a9e3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_patchresourcerequestinput.go @@ -0,0 +1,10 @@ +package resourceguards + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchResourceRequestInput struct { + Identity *DppIdentityDetails `json:"identity,omitempty"` + Properties *PatchBackupVaultInput `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_resourceguard.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_resourceguard.go new file mode 100644 index 00000000000..968af9fa9f5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_resourceguard.go @@ -0,0 +1,12 @@ +package resourceguards + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceGuard struct { + AllowAutoApprovals *bool `json:"allowAutoApprovals,omitempty"` + Description *string `json:"description,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + ResourceGuardOperations *[]ResourceGuardOperation `json:"resourceGuardOperations,omitempty"` + VaultCriticalOperationExclusionList *[]string `json:"vaultCriticalOperationExclusionList,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_resourceguardoperation.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_resourceguardoperation.go new file mode 100644 index 00000000000..db7b25d6e59 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_resourceguardoperation.go @@ -0,0 +1,9 @@ +package resourceguards + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceGuardOperation struct { + RequestResourceType *string `json:"requestResourceType,omitempty"` + VaultCriticalOperation *string `json:"vaultCriticalOperation,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_resourceguardresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_resourceguardresource.go new file mode 100644 index 00000000000..1010f105ba4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/model_resourceguardresource.go @@ -0,0 +1,20 @@ +package resourceguards + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceGuardResource struct { + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *DppIdentityDetails `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ResourceGuard `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/predicates.go new file mode 100644 index 00000000000..be7d4cee988 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/predicates.go @@ -0,0 +1,57 @@ +package resourceguards + +type DppBaseResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DppBaseResourceOperationPredicate) Matches(input DppBaseResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type ResourceGuardResourceOperationPredicate struct { + ETag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p ResourceGuardResourceOperationPredicate) Matches(input ResourceGuardResource) bool { + + if p.ETag != nil && (input.ETag == nil && *p.ETag != *input.ETag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/version.go new file mode 100644 index 00000000000..97bbced95bd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards/version.go @@ -0,0 +1,12 @@ +package resourceguards + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/resourceguards/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/README.md new file mode 100644 index 00000000000..0b8fb592855 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application` Documentation + +The `application` SDK allows for interaction with the Azure Resource Manager Service `desktopvirtualization` (API Version `2021-09-03-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application" +``` + + +### Client Initialization + +```go +client := application.NewApplicationClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApplicationClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationGroupValue", "applicationValue") + +payload := application.Application{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationClient.Delete` + +```go +ctx := context.TODO() +id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationGroupValue", "applicationValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationClient.Get` + +```go +ctx := context.TODO() +id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationGroupValue", "applicationValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationClient.List` + +```go +ctx := context.TODO() +id := application.NewApplicationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationGroupValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ApplicationClient.Update` + +```go +ctx := context.TODO() +id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationGroupValue", "applicationValue") + +payload := application.ApplicationPatch{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/client.go new file mode 100644 index 00000000000..56913082b95 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/client.go @@ -0,0 +1,18 @@ +package application + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationClient struct { + Client autorest.Client + baseUri string +} + +func NewApplicationClientWithBaseURI(endpoint string) ApplicationClient { + return ApplicationClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/constants.go new file mode 100644 index 00000000000..5b2bf0a7cd4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/constants.go @@ -0,0 +1,65 @@ +package application + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CommandLineSetting string + +const ( + CommandLineSettingAllow CommandLineSetting = "Allow" + CommandLineSettingDoNotAllow CommandLineSetting = "DoNotAllow" + CommandLineSettingRequire CommandLineSetting = "Require" +) + +func PossibleValuesForCommandLineSetting() []string { + return []string{ + string(CommandLineSettingAllow), + string(CommandLineSettingDoNotAllow), + string(CommandLineSettingRequire), + } +} + +func parseCommandLineSetting(input string) (*CommandLineSetting, error) { + vals := map[string]CommandLineSetting{ + "allow": CommandLineSettingAllow, + "donotallow": CommandLineSettingDoNotAllow, + "require": CommandLineSettingRequire, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CommandLineSetting(input) + return &out, nil +} + +type RemoteApplicationType string + +const ( + RemoteApplicationTypeInBuilt RemoteApplicationType = "InBuilt" + RemoteApplicationTypeMsixApplication RemoteApplicationType = "MsixApplication" +) + +func PossibleValuesForRemoteApplicationType() []string { + return []string{ + string(RemoteApplicationTypeInBuilt), + string(RemoteApplicationTypeMsixApplication), + } +} + +func parseRemoteApplicationType(input string) (*RemoteApplicationType, error) { + vals := map[string]RemoteApplicationType{ + "inbuilt": RemoteApplicationTypeInBuilt, + "msixapplication": RemoteApplicationTypeMsixApplication, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RemoteApplicationType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_application.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_application.go new file mode 100644 index 00000000000..e5609ed2b7f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_application.go @@ -0,0 +1,137 @@ +package application + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ApplicationId{} + +// ApplicationId is a struct representing the Resource ID for a Application +type ApplicationId struct { + SubscriptionId string + ResourceGroupName string + ApplicationGroupName string + ApplicationName string +} + +// NewApplicationID returns a new ApplicationId struct +func NewApplicationID(subscriptionId string, resourceGroupName string, applicationGroupName string, applicationName string) ApplicationId { + return ApplicationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ApplicationGroupName: applicationGroupName, + ApplicationName: applicationName, + } +} + +// ParseApplicationID parses 'input' into a ApplicationId +func ParseApplicationID(input string) (*ApplicationId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseApplicationIDInsensitively parses 'input' case-insensitively into a ApplicationId +// note: this method should only be used for API response data and not user input +func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateApplicationID checks that 'input' can be parsed as a Application ID +func ValidateApplicationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApplicationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application ID +func (id ApplicationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/applicationGroups/%s/applications/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ApplicationGroupName, id.ApplicationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application ID +func (id ApplicationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticApplicationGroups", "applicationGroups", "applicationGroups"), + resourceids.UserSpecifiedSegment("applicationGroupName", "applicationGroupValue"), + resourceids.StaticSegment("staticApplications", "applications", "applications"), + resourceids.UserSpecifiedSegment("applicationName", "applicationValue"), + } +} + +// String returns a human-readable description of this Application ID +func (id ApplicationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Application Group Name: %q", id.ApplicationGroupName), + fmt.Sprintf("Application Name: %q", id.ApplicationName), + } + return fmt.Sprintf("Application (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_applicationgroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_applicationgroup.go new file mode 100644 index 00000000000..74e10313b6a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_applicationgroup.go @@ -0,0 +1,124 @@ +package application + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ApplicationGroupId{} + +// ApplicationGroupId is a struct representing the Resource ID for a Application Group +type ApplicationGroupId struct { + SubscriptionId string + ResourceGroupName string + ApplicationGroupName string +} + +// NewApplicationGroupID returns a new ApplicationGroupId struct +func NewApplicationGroupID(subscriptionId string, resourceGroupName string, applicationGroupName string) ApplicationGroupId { + return ApplicationGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ApplicationGroupName: applicationGroupName, + } +} + +// ParseApplicationGroupID parses 'input' into a ApplicationGroupId +func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseApplicationGroupIDInsensitively parses 'input' case-insensitively into a ApplicationGroupId +// note: this method should only be used for API response data and not user input +func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID +func ValidateApplicationGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApplicationGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application Group ID +func (id ApplicationGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/applicationGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ApplicationGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application Group ID +func (id ApplicationGroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticApplicationGroups", "applicationGroups", "applicationGroups"), + resourceids.UserSpecifiedSegment("applicationGroupName", "applicationGroupValue"), + } +} + +// String returns a human-readable description of this Application Group ID +func (id ApplicationGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Application Group Name: %q", id.ApplicationGroupName), + } + return fmt.Sprintf("Application Group (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_createorupdate_autorest.go new file mode 100644 index 00000000000..92366428509 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Application +} + +// CreateOrUpdate ... +func (c ApplicationClient) CreateOrUpdate(ctx context.Context, id ApplicationId, input Application) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ApplicationClient) preparerForCreateOrUpdate(ctx context.Context, id ApplicationId, input Application) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_delete_autorest.go new file mode 100644 index 00000000000..3adfaf68b49 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_delete_autorest.go @@ -0,0 +1,66 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ApplicationClient) Delete(ctx context.Context, id ApplicationId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ApplicationClient) preparerForDelete(ctx context.Context, id ApplicationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_get_autorest.go new file mode 100644 index 00000000000..694243403a5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_get_autorest.go @@ -0,0 +1,68 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Application +} + +// Get ... +func (c ApplicationClient) Get(ctx context.Context, id ApplicationId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ApplicationClient) preparerForGet(ctx context.Context, id ApplicationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_list_autorest.go new file mode 100644 index 00000000000..b4c6a96b660 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_list_autorest.go @@ -0,0 +1,186 @@ +package application + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Application + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Application +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c ApplicationClient) List(ctx context.Context, id ApplicationGroupId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c ApplicationClient) preparerForList(ctx context.Context, id ApplicationGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/applications", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c ApplicationClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Application `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c ApplicationClient) ListComplete(ctx context.Context, id ApplicationGroupId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ApplicationOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ApplicationClient) ListCompleteMatchingPredicate(ctx context.Context, id ApplicationGroupId, predicate ApplicationOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Application, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_update_autorest.go new file mode 100644 index 00000000000..a367a3c9eeb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/method_update_autorest.go @@ -0,0 +1,69 @@ +package application + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Application +} + +// Update ... +func (c ApplicationClient) Update(ctx context.Context, id ApplicationId, input ApplicationPatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "application.ApplicationClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ApplicationClient) preparerForUpdate(ctx context.Context, id ApplicationId, input ApplicationPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ApplicationClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_application.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_application.go new file mode 100644 index 00000000000..700c972b9de --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_application.go @@ -0,0 +1,16 @@ +package application + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Application struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties ApplicationProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationpatch.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationpatch.go new file mode 100644 index 00000000000..5b0e7d1a071 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationpatch.go @@ -0,0 +1,9 @@ +package application + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationPatch struct { + Properties *ApplicationPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationpatchproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationpatchproperties.go new file mode 100644 index 00000000000..ada985872c6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationpatchproperties.go @@ -0,0 +1,18 @@ +package application + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationPatchProperties struct { + ApplicationType *RemoteApplicationType `json:"applicationType,omitempty"` + CommandLineArguments *string `json:"commandLineArguments,omitempty"` + CommandLineSetting *CommandLineSetting `json:"commandLineSetting,omitempty"` + Description *string `json:"description,omitempty"` + FilePath *string `json:"filePath,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + IconIndex *int64 `json:"iconIndex,omitempty"` + IconPath *string `json:"iconPath,omitempty"` + MsixPackageApplicationId *string `json:"msixPackageApplicationId,omitempty"` + MsixPackageFamilyName *string `json:"msixPackageFamilyName,omitempty"` + ShowInPortal *bool `json:"showInPortal,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationproperties.go new file mode 100644 index 00000000000..74362ae1d50 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/model_applicationproperties.go @@ -0,0 +1,21 @@ +package application + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationProperties struct { + ApplicationType *RemoteApplicationType `json:"applicationType,omitempty"` + CommandLineArguments *string `json:"commandLineArguments,omitempty"` + CommandLineSetting CommandLineSetting `json:"commandLineSetting"` + Description *string `json:"description,omitempty"` + FilePath *string `json:"filePath,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + IconContent *string `json:"iconContent,omitempty"` + IconHash *string `json:"iconHash,omitempty"` + IconIndex *int64 `json:"iconIndex,omitempty"` + IconPath *string `json:"iconPath,omitempty"` + MsixPackageApplicationId *string `json:"msixPackageApplicationId,omitempty"` + MsixPackageFamilyName *string `json:"msixPackageFamilyName,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + ShowInPortal *bool `json:"showInPortal,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/predicates.go new file mode 100644 index 00000000000..82c6b7d376d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/predicates.go @@ -0,0 +1,24 @@ +package application + +type ApplicationOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ApplicationOperationPredicate) Matches(input Application) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/version.go new file mode 100644 index 00000000000..b3bd5a71e05 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application/version.go @@ -0,0 +1,12 @@ +package application + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-09-03-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/application/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/README.md new file mode 100644 index 00000000000..8cb88062411 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup` Documentation + +The `applicationgroup` SDK allows for interaction with the Azure Resource Manager Service `desktopvirtualization` (API Version `2021-09-03-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup" +``` + + +### Client Initialization + +```go +client := applicationgroup.NewApplicationGroupClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ApplicationGroupClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := applicationgroup.NewApplicationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationGroupValue") + +payload := applicationgroup.ApplicationGroup{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationGroupClient.Delete` + +```go +ctx := context.TODO() +id := applicationgroup.NewApplicationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationGroupValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationGroupClient.Get` + +```go +ctx := context.TODO() +id := applicationgroup.NewApplicationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationGroupValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ApplicationGroupClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := applicationgroup.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id, applicationgroup.DefaultListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id, applicationgroup.DefaultListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ApplicationGroupClient.ListBySubscription` + +```go +ctx := context.TODO() +id := applicationgroup.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id, applicationgroup.DefaultListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id, applicationgroup.DefaultListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ApplicationGroupClient.Update` + +```go +ctx := context.TODO() +id := applicationgroup.NewApplicationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationGroupValue") + +payload := applicationgroup.ApplicationGroupPatch{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/client.go new file mode 100644 index 00000000000..20ca14a850a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/client.go @@ -0,0 +1,18 @@ +package applicationgroup + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationGroupClient struct { + Client autorest.Client + baseUri string +} + +func NewApplicationGroupClientWithBaseURI(endpoint string) ApplicationGroupClient { + return ApplicationGroupClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/constants.go new file mode 100644 index 00000000000..a24e7261f53 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/constants.go @@ -0,0 +1,105 @@ +package applicationgroup + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationGroupType string + +const ( + ApplicationGroupTypeDesktop ApplicationGroupType = "Desktop" + ApplicationGroupTypeRemoteApp ApplicationGroupType = "RemoteApp" +) + +func PossibleValuesForApplicationGroupType() []string { + return []string{ + string(ApplicationGroupTypeDesktop), + string(ApplicationGroupTypeRemoteApp), + } +} + +func parseApplicationGroupType(input string) (*ApplicationGroupType, error) { + vals := map[string]ApplicationGroupType{ + "desktop": ApplicationGroupTypeDesktop, + "remoteapp": ApplicationGroupTypeRemoteApp, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApplicationGroupType(input) + return &out, nil +} + +type Operation string + +const ( + OperationComplete Operation = "Complete" + OperationHide Operation = "Hide" + OperationRevoke Operation = "Revoke" + OperationStart Operation = "Start" + OperationUnhide Operation = "Unhide" +) + +func PossibleValuesForOperation() []string { + return []string{ + string(OperationComplete), + string(OperationHide), + string(OperationRevoke), + string(OperationStart), + string(OperationUnhide), + } +} + +func parseOperation(input string) (*Operation, error) { + vals := map[string]Operation{ + "complete": OperationComplete, + "hide": OperationHide, + "revoke": OperationRevoke, + "start": OperationStart, + "unhide": OperationUnhide, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Operation(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierFree SkuTier = "Free" + SkuTierPremium SkuTier = "Premium" + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierFree), + string(SkuTierPremium), + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "free": SkuTierFree, + "premium": SkuTierPremium, + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/id_applicationgroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/id_applicationgroup.go new file mode 100644 index 00000000000..6c20bd489e9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/id_applicationgroup.go @@ -0,0 +1,124 @@ +package applicationgroup + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ApplicationGroupId{} + +// ApplicationGroupId is a struct representing the Resource ID for a Application Group +type ApplicationGroupId struct { + SubscriptionId string + ResourceGroupName string + ApplicationGroupName string +} + +// NewApplicationGroupID returns a new ApplicationGroupId struct +func NewApplicationGroupID(subscriptionId string, resourceGroupName string, applicationGroupName string) ApplicationGroupId { + return ApplicationGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ApplicationGroupName: applicationGroupName, + } +} + +// ParseApplicationGroupID parses 'input' into a ApplicationGroupId +func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseApplicationGroupIDInsensitively parses 'input' case-insensitively into a ApplicationGroupId +// note: this method should only be used for API response data and not user input +func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID +func ValidateApplicationGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApplicationGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application Group ID +func (id ApplicationGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/applicationGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ApplicationGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application Group ID +func (id ApplicationGroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticApplicationGroups", "applicationGroups", "applicationGroups"), + resourceids.UserSpecifiedSegment("applicationGroupName", "applicationGroupValue"), + } +} + +// String returns a human-readable description of this Application Group ID +func (id ApplicationGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Application Group Name: %q", id.ApplicationGroupName), + } + return fmt.Sprintf("Application Group (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_createorupdate_autorest.go new file mode 100644 index 00000000000..95e170bd959 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package applicationgroup + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *ApplicationGroup +} + +// CreateOrUpdate ... +func (c ApplicationGroupClient) CreateOrUpdate(ctx context.Context, id ApplicationGroupId, input ApplicationGroup) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ApplicationGroupClient) preparerForCreateOrUpdate(ctx context.Context, id ApplicationGroupId, input ApplicationGroup) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ApplicationGroupClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_delete_autorest.go new file mode 100644 index 00000000000..6b701f2a302 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_delete_autorest.go @@ -0,0 +1,66 @@ +package applicationgroup + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ApplicationGroupClient) Delete(ctx context.Context, id ApplicationGroupId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ApplicationGroupClient) preparerForDelete(ctx context.Context, id ApplicationGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ApplicationGroupClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_get_autorest.go new file mode 100644 index 00000000000..a5e06d04f7c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_get_autorest.go @@ -0,0 +1,68 @@ +package applicationgroup + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ApplicationGroup +} + +// Get ... +func (c ApplicationGroupClient) Get(ctx context.Context, id ApplicationGroupId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ApplicationGroupClient) preparerForGet(ctx context.Context, id ApplicationGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ApplicationGroupClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..cbb565df731 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_listbyresourcegroup_autorest.go @@ -0,0 +1,216 @@ +package applicationgroup + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]ApplicationGroup + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []ApplicationGroup +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByResourceGroupOperationOptions struct { + Filter *string +} + +func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { + return ListByResourceGroupOperationOptions{} +} + +func (o ListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// ListByResourceGroup ... +func (c ApplicationGroupClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ApplicationGroupClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/applicationGroups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c ApplicationGroupClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ApplicationGroupClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []ApplicationGroup `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c ApplicationGroupClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, ApplicationGroupOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ApplicationGroupClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate ApplicationGroupOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]ApplicationGroup, 0) + + page, err := c.ListByResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..fb72370186b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_listbysubscription_autorest.go @@ -0,0 +1,216 @@ +package applicationgroup + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]ApplicationGroup + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []ApplicationGroup +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListBySubscriptionOperationOptions struct { + Filter *string +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + return out +} + +// ListBySubscription ... +func (c ApplicationGroupClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c ApplicationGroupClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/applicationGroups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c ApplicationGroupClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c ApplicationGroupClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []ApplicationGroup `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c ApplicationGroupClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, ApplicationGroupOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ApplicationGroupClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions, predicate ApplicationGroupOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]ApplicationGroup, 0) + + page, err := c.ListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_update_autorest.go new file mode 100644 index 00000000000..266ebaf6c02 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/method_update_autorest.go @@ -0,0 +1,69 @@ +package applicationgroup + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *ApplicationGroup +} + +// Update ... +func (c ApplicationGroupClient) Update(ctx context.Context, id ApplicationGroupId, input ApplicationGroupPatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "applicationgroup.ApplicationGroupClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ApplicationGroupClient) preparerForUpdate(ctx context.Context, id ApplicationGroupId, input ApplicationGroupPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ApplicationGroupClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgroup.go new file mode 100644 index 00000000000..afb13f5670b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgroup.go @@ -0,0 +1,25 @@ +package applicationgroup + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationGroup struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` + Name *string `json:"name,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties ApplicationGroupProperties `json:"properties"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgrouppatch.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgrouppatch.go new file mode 100644 index 00000000000..e5d63002544 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgrouppatch.go @@ -0,0 +1,12 @@ +package applicationgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationGroupPatch struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ApplicationGroupPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgrouppatchproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgrouppatchproperties.go new file mode 100644 index 00000000000..2f2f5c20d79 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgrouppatchproperties.go @@ -0,0 +1,9 @@ +package applicationgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationGroupPatchProperties struct { + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgroupproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgroupproperties.go new file mode 100644 index 00000000000..8cc435c3bd9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_applicationgroupproperties.go @@ -0,0 +1,15 @@ +package applicationgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationGroupProperties struct { + ApplicationGroupType ApplicationGroupType `json:"applicationGroupType"` + CloudPcResource *bool `json:"cloudPcResource,omitempty"` + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + HostPoolArmPath string `json:"hostPoolArmPath"` + MigrationRequest *MigrationRequestProperties `json:"migrationRequest,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + WorkspaceArmPath *string `json:"workspaceArmPath,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_migrationrequestproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_migrationrequestproperties.go new file mode 100644 index 00000000000..238d6d02365 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_migrationrequestproperties.go @@ -0,0 +1,9 @@ +package applicationgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrationRequestProperties struct { + MigrationPath *string `json:"migrationPath,omitempty"` + Operation *Operation `json:"operation,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_plan.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_plan.go new file mode 100644 index 00000000000..865073b6a3e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_plan.go @@ -0,0 +1,12 @@ +package applicationgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name string `json:"name"` + Product string `json:"product"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher string `json:"publisher"` + Version *string `json:"version,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_sku.go new file mode 100644 index 00000000000..57066762740 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/model_sku.go @@ -0,0 +1,12 @@ +package applicationgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/predicates.go new file mode 100644 index 00000000000..f0e69f1abd2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/predicates.go @@ -0,0 +1,44 @@ +package applicationgroup + +type ApplicationGroupOperationPredicate struct { + Etag *string + Id *string + Kind *string + Location *string + ManagedBy *string + Name *string + Type *string +} + +func (p ApplicationGroupOperationPredicate) Matches(input ApplicationGroup) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && (input.Kind == nil && *p.Kind != *input.Kind) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.ManagedBy != nil && (input.ManagedBy == nil && *p.ManagedBy != *input.ManagedBy) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/version.go new file mode 100644 index 00000000000..abe65319f8b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/version.go @@ -0,0 +1,12 @@ +package applicationgroup + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-09-03-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/applicationgroup/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/README.md new file mode 100644 index 00000000000..851bda3ba3f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/README.md @@ -0,0 +1,74 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop` Documentation + +The `desktop` SDK allows for interaction with the Azure Resource Manager Service `desktopvirtualization` (API Version `2021-09-03-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop" +``` + + +### Client Initialization + +```go +client := desktop.NewDesktopClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DesktopClient.Get` + +```go +ctx := context.TODO() +id := desktop.NewDesktopID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationGroupValue", "desktopValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DesktopClient.List` + +```go +ctx := context.TODO() +id := desktop.NewApplicationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationGroupValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DesktopClient.Update` + +```go +ctx := context.TODO() +id := desktop.NewDesktopID("12345678-1234-9876-4563-123456789012", "example-resource-group", "applicationGroupValue", "desktopValue") + +payload := desktop.DesktopPatch{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/client.go new file mode 100644 index 00000000000..cc153930daa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/client.go @@ -0,0 +1,18 @@ +package desktop + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DesktopClient struct { + Client autorest.Client + baseUri string +} + +func NewDesktopClientWithBaseURI(endpoint string) DesktopClient { + return DesktopClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_applicationgroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_applicationgroup.go new file mode 100644 index 00000000000..fe30e445a4f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_applicationgroup.go @@ -0,0 +1,124 @@ +package desktop + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ApplicationGroupId{} + +// ApplicationGroupId is a struct representing the Resource ID for a Application Group +type ApplicationGroupId struct { + SubscriptionId string + ResourceGroupName string + ApplicationGroupName string +} + +// NewApplicationGroupID returns a new ApplicationGroupId struct +func NewApplicationGroupID(subscriptionId string, resourceGroupName string, applicationGroupName string) ApplicationGroupId { + return ApplicationGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ApplicationGroupName: applicationGroupName, + } +} + +// ParseApplicationGroupID parses 'input' into a ApplicationGroupId +func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseApplicationGroupIDInsensitively parses 'input' case-insensitively into a ApplicationGroupId +// note: this method should only be used for API response data and not user input +func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ApplicationGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ApplicationGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID +func ValidateApplicationGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseApplicationGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Application Group ID +func (id ApplicationGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/applicationGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ApplicationGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Application Group ID +func (id ApplicationGroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticApplicationGroups", "applicationGroups", "applicationGroups"), + resourceids.UserSpecifiedSegment("applicationGroupName", "applicationGroupValue"), + } +} + +// String returns a human-readable description of this Application Group ID +func (id ApplicationGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Application Group Name: %q", id.ApplicationGroupName), + } + return fmt.Sprintf("Application Group (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_desktop.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_desktop.go new file mode 100644 index 00000000000..1b44ed2f282 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_desktop.go @@ -0,0 +1,137 @@ +package desktop + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DesktopId{} + +// DesktopId is a struct representing the Resource ID for a Desktop +type DesktopId struct { + SubscriptionId string + ResourceGroupName string + ApplicationGroupName string + DesktopName string +} + +// NewDesktopID returns a new DesktopId struct +func NewDesktopID(subscriptionId string, resourceGroupName string, applicationGroupName string, desktopName string) DesktopId { + return DesktopId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ApplicationGroupName: applicationGroupName, + DesktopName: desktopName, + } +} + +// ParseDesktopID parses 'input' into a DesktopId +func ParseDesktopID(input string) (*DesktopId, error) { + parser := resourceids.NewParserFromResourceIdType(DesktopId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DesktopId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + if id.DesktopName, ok = parsed.Parsed["desktopName"]; !ok { + return nil, fmt.Errorf("the segment 'desktopName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDesktopIDInsensitively parses 'input' case-insensitively into a DesktopId +// note: this method should only be used for API response data and not user input +func ParseDesktopIDInsensitively(input string) (*DesktopId, error) { + parser := resourceids.NewParserFromResourceIdType(DesktopId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DesktopId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'applicationGroupName' was not found in the resource id %q", input) + } + + if id.DesktopName, ok = parsed.Parsed["desktopName"]; !ok { + return nil, fmt.Errorf("the segment 'desktopName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDesktopID checks that 'input' can be parsed as a Desktop ID +func ValidateDesktopID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDesktopID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Desktop ID +func (id DesktopId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/applicationGroups/%s/desktops/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ApplicationGroupName, id.DesktopName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Desktop ID +func (id DesktopId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticApplicationGroups", "applicationGroups", "applicationGroups"), + resourceids.UserSpecifiedSegment("applicationGroupName", "applicationGroupValue"), + resourceids.StaticSegment("staticDesktops", "desktops", "desktops"), + resourceids.UserSpecifiedSegment("desktopName", "desktopValue"), + } +} + +// String returns a human-readable description of this Desktop ID +func (id DesktopId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Application Group Name: %q", id.ApplicationGroupName), + fmt.Sprintf("Desktop Name: %q", id.DesktopName), + } + return fmt.Sprintf("Desktop (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_get_autorest.go new file mode 100644 index 00000000000..cba561e10ad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_get_autorest.go @@ -0,0 +1,68 @@ +package desktop + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Desktop +} + +// Get ... +func (c DesktopClient) Get(ctx context.Context, id DesktopId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DesktopClient) preparerForGet(ctx context.Context, id DesktopId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DesktopClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_list_autorest.go new file mode 100644 index 00000000000..111e71e4903 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_list_autorest.go @@ -0,0 +1,186 @@ +package desktop + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Desktop + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Desktop +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c DesktopClient) List(ctx context.Context, id ApplicationGroupId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c DesktopClient) preparerForList(ctx context.Context, id ApplicationGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/desktops", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c DesktopClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c DesktopClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Desktop `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c DesktopClient) ListComplete(ctx context.Context, id ApplicationGroupId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, DesktopOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DesktopClient) ListCompleteMatchingPredicate(ctx context.Context, id ApplicationGroupId, predicate DesktopOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Desktop, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_update_autorest.go new file mode 100644 index 00000000000..df42b7c5dc1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/method_update_autorest.go @@ -0,0 +1,69 @@ +package desktop + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Desktop +} + +// Update ... +func (c DesktopClient) Update(ctx context.Context, id DesktopId, input DesktopPatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "desktop.DesktopClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c DesktopClient) preparerForUpdate(ctx context.Context, id DesktopId, input DesktopPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c DesktopClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktop.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktop.go new file mode 100644 index 00000000000..6d41ecc215e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktop.go @@ -0,0 +1,16 @@ +package desktop + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Desktop struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DesktopProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktoppatch.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktoppatch.go new file mode 100644 index 00000000000..1d7d1672159 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktoppatch.go @@ -0,0 +1,9 @@ +package desktop + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DesktopPatch struct { + Properties *DesktopPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktoppatchproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktoppatchproperties.go new file mode 100644 index 00000000000..40b1a4577e1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktoppatchproperties.go @@ -0,0 +1,9 @@ +package desktop + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DesktopPatchProperties struct { + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktopproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktopproperties.go new file mode 100644 index 00000000000..2d961ead46c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/model_desktopproperties.go @@ -0,0 +1,12 @@ +package desktop + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DesktopProperties struct { + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + IconContent *string `json:"iconContent,omitempty"` + IconHash *string `json:"iconHash,omitempty"` + ObjectId *string `json:"objectId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/predicates.go new file mode 100644 index 00000000000..f8bbb1e357f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/predicates.go @@ -0,0 +1,24 @@ +package desktop + +type DesktopOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DesktopOperationPredicate) Matches(input Desktop) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/version.go new file mode 100644 index 00000000000..82f4c83323b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/version.go @@ -0,0 +1,12 @@ +package desktop + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-09-03-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/desktop/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/README.md new file mode 100644 index 00000000000..049d9235bec --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/README.md @@ -0,0 +1,144 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool` Documentation + +The `hostpool` SDK allows for interaction with the Azure Resource Manager Service `desktopvirtualization` (API Version `2021-09-03-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool" +``` + + +### Client Initialization + +```go +client := hostpool.NewHostPoolClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `HostPoolClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := hostpool.NewHostPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostPoolValue") + +payload := hostpool.HostPool{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `HostPoolClient.Delete` + +```go +ctx := context.TODO() +id := hostpool.NewHostPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostPoolValue") + +read, err := client.Delete(ctx, id, hostpool.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `HostPoolClient.Get` + +```go +ctx := context.TODO() +id := hostpool.NewHostPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostPoolValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `HostPoolClient.List` + +```go +ctx := context.TODO() +id := hostpool.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `HostPoolClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := hostpool.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `HostPoolClient.RetrieveRegistrationToken` + +```go +ctx := context.TODO() +id := hostpool.NewHostPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostPoolValue") + +read, err := client.RetrieveRegistrationToken(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `HostPoolClient.Update` + +```go +ctx := context.TODO() +id := hostpool.NewHostPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostPoolValue") + +payload := hostpool.HostPoolPatch{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/client.go new file mode 100644 index 00000000000..adce757bb86 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/client.go @@ -0,0 +1,18 @@ +package hostpool + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostPoolClient struct { + Client autorest.Client + baseUri string +} + +func NewHostPoolClientWithBaseURI(endpoint string) HostPoolClient { + return HostPoolClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/constants.go new file mode 100644 index 00000000000..2566a6adc1f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/constants.go @@ -0,0 +1,291 @@ +package hostpool + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostPoolType string + +const ( + HostPoolTypeBYODesktop HostPoolType = "BYODesktop" + HostPoolTypePersonal HostPoolType = "Personal" + HostPoolTypePooled HostPoolType = "Pooled" +) + +func PossibleValuesForHostPoolType() []string { + return []string{ + string(HostPoolTypeBYODesktop), + string(HostPoolTypePersonal), + string(HostPoolTypePooled), + } +} + +func parseHostPoolType(input string) (*HostPoolType, error) { + vals := map[string]HostPoolType{ + "byodesktop": HostPoolTypeBYODesktop, + "personal": HostPoolTypePersonal, + "pooled": HostPoolTypePooled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HostPoolType(input) + return &out, nil +} + +type LoadBalancerType string + +const ( + LoadBalancerTypeBreadthFirst LoadBalancerType = "BreadthFirst" + LoadBalancerTypeDepthFirst LoadBalancerType = "DepthFirst" + LoadBalancerTypePersistent LoadBalancerType = "Persistent" +) + +func PossibleValuesForLoadBalancerType() []string { + return []string{ + string(LoadBalancerTypeBreadthFirst), + string(LoadBalancerTypeDepthFirst), + string(LoadBalancerTypePersistent), + } +} + +func parseLoadBalancerType(input string) (*LoadBalancerType, error) { + vals := map[string]LoadBalancerType{ + "breadthfirst": LoadBalancerTypeBreadthFirst, + "depthfirst": LoadBalancerTypeDepthFirst, + "persistent": LoadBalancerTypePersistent, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LoadBalancerType(input) + return &out, nil +} + +type Operation string + +const ( + OperationComplete Operation = "Complete" + OperationHide Operation = "Hide" + OperationRevoke Operation = "Revoke" + OperationStart Operation = "Start" + OperationUnhide Operation = "Unhide" +) + +func PossibleValuesForOperation() []string { + return []string{ + string(OperationComplete), + string(OperationHide), + string(OperationRevoke), + string(OperationStart), + string(OperationUnhide), + } +} + +func parseOperation(input string) (*Operation, error) { + vals := map[string]Operation{ + "complete": OperationComplete, + "hide": OperationHide, + "revoke": OperationRevoke, + "start": OperationStart, + "unhide": OperationUnhide, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Operation(input) + return &out, nil +} + +type PersonalDesktopAssignmentType string + +const ( + PersonalDesktopAssignmentTypeAutomatic PersonalDesktopAssignmentType = "Automatic" + PersonalDesktopAssignmentTypeDirect PersonalDesktopAssignmentType = "Direct" +) + +func PossibleValuesForPersonalDesktopAssignmentType() []string { + return []string{ + string(PersonalDesktopAssignmentTypeAutomatic), + string(PersonalDesktopAssignmentTypeDirect), + } +} + +func parsePersonalDesktopAssignmentType(input string) (*PersonalDesktopAssignmentType, error) { + vals := map[string]PersonalDesktopAssignmentType{ + "automatic": PersonalDesktopAssignmentTypeAutomatic, + "direct": PersonalDesktopAssignmentTypeDirect, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PersonalDesktopAssignmentType(input) + return &out, nil +} + +type PreferredAppGroupType string + +const ( + PreferredAppGroupTypeDesktop PreferredAppGroupType = "Desktop" + PreferredAppGroupTypeNone PreferredAppGroupType = "None" + PreferredAppGroupTypeRailApplications PreferredAppGroupType = "RailApplications" +) + +func PossibleValuesForPreferredAppGroupType() []string { + return []string{ + string(PreferredAppGroupTypeDesktop), + string(PreferredAppGroupTypeNone), + string(PreferredAppGroupTypeRailApplications), + } +} + +func parsePreferredAppGroupType(input string) (*PreferredAppGroupType, error) { + vals := map[string]PreferredAppGroupType{ + "desktop": PreferredAppGroupTypeDesktop, + "none": PreferredAppGroupTypeNone, + "railapplications": PreferredAppGroupTypeRailApplications, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PreferredAppGroupType(input) + return &out, nil +} + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} + +type RegistrationTokenOperation string + +const ( + RegistrationTokenOperationDelete RegistrationTokenOperation = "Delete" + RegistrationTokenOperationNone RegistrationTokenOperation = "None" + RegistrationTokenOperationUpdate RegistrationTokenOperation = "Update" +) + +func PossibleValuesForRegistrationTokenOperation() []string { + return []string{ + string(RegistrationTokenOperationDelete), + string(RegistrationTokenOperationNone), + string(RegistrationTokenOperationUpdate), + } +} + +func parseRegistrationTokenOperation(input string) (*RegistrationTokenOperation, error) { + vals := map[string]RegistrationTokenOperation{ + "delete": RegistrationTokenOperationDelete, + "none": RegistrationTokenOperationNone, + "update": RegistrationTokenOperationUpdate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RegistrationTokenOperation(input) + return &out, nil +} + +type SSOSecretType string + +const ( + SSOSecretTypeCertificate SSOSecretType = "Certificate" + SSOSecretTypeCertificateInKeyVault SSOSecretType = "CertificateInKeyVault" + SSOSecretTypeSharedKey SSOSecretType = "SharedKey" + SSOSecretTypeSharedKeyInKeyVault SSOSecretType = "SharedKeyInKeyVault" +) + +func PossibleValuesForSSOSecretType() []string { + return []string{ + string(SSOSecretTypeCertificate), + string(SSOSecretTypeCertificateInKeyVault), + string(SSOSecretTypeSharedKey), + string(SSOSecretTypeSharedKeyInKeyVault), + } +} + +func parseSSOSecretType(input string) (*SSOSecretType, error) { + vals := map[string]SSOSecretType{ + "certificate": SSOSecretTypeCertificate, + "certificateinkeyvault": SSOSecretTypeCertificateInKeyVault, + "sharedkey": SSOSecretTypeSharedKey, + "sharedkeyinkeyvault": SSOSecretTypeSharedKeyInKeyVault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SSOSecretType(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierFree SkuTier = "Free" + SkuTierPremium SkuTier = "Premium" + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierFree), + string(SkuTierPremium), + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "free": SkuTierFree, + "premium": SkuTierPremium, + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/id_hostpool.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/id_hostpool.go new file mode 100644 index 00000000000..61c82943024 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/id_hostpool.go @@ -0,0 +1,124 @@ +package hostpool + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = HostPoolId{} + +// HostPoolId is a struct representing the Resource ID for a Host Pool +type HostPoolId struct { + SubscriptionId string + ResourceGroupName string + HostPoolName string +} + +// NewHostPoolID returns a new HostPoolId struct +func NewHostPoolID(subscriptionId string, resourceGroupName string, hostPoolName string) HostPoolId { + return HostPoolId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + HostPoolName: hostPoolName, + } +} + +// ParseHostPoolID parses 'input' into a HostPoolId +func ParseHostPoolID(input string) (*HostPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(HostPoolId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseHostPoolIDInsensitively parses 'input' case-insensitively into a HostPoolId +// note: this method should only be used for API response data and not user input +func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(HostPoolId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID +func ValidateHostPoolID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseHostPoolID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Host Pool ID +func (id HostPoolId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/hostPools/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.HostPoolName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Host Pool ID +func (id HostPoolId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticHostPools", "hostPools", "hostPools"), + resourceids.UserSpecifiedSegment("hostPoolName", "hostPoolValue"), + } +} + +// String returns a human-readable description of this Host Pool ID +func (id HostPoolId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Host Pool Name: %q", id.HostPoolName), + } + return fmt.Sprintf("Host Pool (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_createorupdate_autorest.go new file mode 100644 index 00000000000..2c5d6e766a8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package hostpool + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *HostPool +} + +// CreateOrUpdate ... +func (c HostPoolClient) CreateOrUpdate(ctx context.Context, id HostPoolId, input HostPool) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c HostPoolClient) preparerForCreateOrUpdate(ctx context.Context, id HostPoolId, input HostPool) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c HostPoolClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_delete_autorest.go new file mode 100644 index 00000000000..0a75bcb9728 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_delete_autorest.go @@ -0,0 +1,95 @@ +package hostpool + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + Force *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Force != nil { + out["force"] = *o.Force + } + + return out +} + +// Delete ... +func (c HostPoolClient) Delete(ctx context.Context, id HostPoolId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c HostPoolClient) preparerForDelete(ctx context.Context, id HostPoolId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c HostPoolClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_get_autorest.go new file mode 100644 index 00000000000..f00e17180f8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_get_autorest.go @@ -0,0 +1,68 @@ +package hostpool + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *HostPool +} + +// Get ... +func (c HostPoolClient) Get(ctx context.Context, id HostPoolId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c HostPoolClient) preparerForGet(ctx context.Context, id HostPoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c HostPoolClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_list_autorest.go new file mode 100644 index 00000000000..8beed4ef109 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_list_autorest.go @@ -0,0 +1,187 @@ +package hostpool + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]HostPool + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []HostPool +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c HostPoolClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c HostPoolClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/hostPools", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c HostPoolClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c HostPoolClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []HostPool `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c HostPoolClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, HostPoolOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c HostPoolClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate HostPoolOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]HostPool, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..383730dacb0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package hostpool + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]HostPool + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []HostPool +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c HostPoolClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c HostPoolClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/hostPools", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c HostPoolClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c HostPoolClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []HostPool `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c HostPoolClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, HostPoolOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c HostPoolClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate HostPoolOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]HostPool, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_retrieveregistrationtoken_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_retrieveregistrationtoken_autorest.go new file mode 100644 index 00000000000..cc4a3c34416 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_retrieveregistrationtoken_autorest.go @@ -0,0 +1,69 @@ +package hostpool + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RetrieveRegistrationTokenOperationResponse struct { + HttpResponse *http.Response + Model *RegistrationInfo +} + +// RetrieveRegistrationToken ... +func (c HostPoolClient) RetrieveRegistrationToken(ctx context.Context, id HostPoolId) (result RetrieveRegistrationTokenOperationResponse, err error) { + req, err := c.preparerForRetrieveRegistrationToken(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "RetrieveRegistrationToken", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "RetrieveRegistrationToken", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRetrieveRegistrationToken(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "RetrieveRegistrationToken", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRetrieveRegistrationToken prepares the RetrieveRegistrationToken request. +func (c HostPoolClient) preparerForRetrieveRegistrationToken(ctx context.Context, id HostPoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/retrieveRegistrationToken", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRetrieveRegistrationToken handles the response to the RetrieveRegistrationToken request. The method always +// closes the http.Response Body. +func (c HostPoolClient) responderForRetrieveRegistrationToken(resp *http.Response) (result RetrieveRegistrationTokenOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_update_autorest.go new file mode 100644 index 00000000000..1bc743f8b68 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/method_update_autorest.go @@ -0,0 +1,69 @@ +package hostpool + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *HostPool +} + +// Update ... +func (c HostPoolClient) Update(ctx context.Context, id HostPoolId, input HostPoolPatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hostpool.HostPoolClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c HostPoolClient) preparerForUpdate(ctx context.Context, id HostPoolId, input HostPoolPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c HostPoolClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpool.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpool.go new file mode 100644 index 00000000000..e3d98e6ba0c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpool.go @@ -0,0 +1,25 @@ +package hostpool + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostPool struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` + Name *string `json:"name,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties HostPoolProperties `json:"properties"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolpatch.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolpatch.go new file mode 100644 index 00000000000..6895ce28a7d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolpatch.go @@ -0,0 +1,12 @@ +package hostpool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostPoolPatch struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *HostPoolPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolpatchproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolpatchproperties.go new file mode 100644 index 00000000000..00cd5a49544 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolpatchproperties.go @@ -0,0 +1,24 @@ +package hostpool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostPoolPatchProperties struct { + CustomRdpProperty *string `json:"customRdpProperty,omitempty"` + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + LoadBalancerType *LoadBalancerType `json:"loadBalancerType,omitempty"` + MaxSessionLimit *int64 `json:"maxSessionLimit,omitempty"` + PersonalDesktopAssignmentType *PersonalDesktopAssignmentType `json:"personalDesktopAssignmentType,omitempty"` + PreferredAppGroupType *PreferredAppGroupType `json:"preferredAppGroupType,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + RegistrationInfo *RegistrationInfoPatch `json:"registrationInfo,omitempty"` + Ring *int64 `json:"ring,omitempty"` + SsoClientId *string `json:"ssoClientId,omitempty"` + SsoClientSecretKeyVaultPath *string `json:"ssoClientSecretKeyVaultPath,omitempty"` + SsoSecretType *SSOSecretType `json:"ssoSecretType,omitempty"` + SsoadfsAuthority *string `json:"ssoadfsAuthority,omitempty"` + StartVMOnConnect *bool `json:"startVMOnConnect,omitempty"` + ValidationEnvironment *bool `json:"validationEnvironment,omitempty"` + VmTemplate *string `json:"vmTemplate,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolproperties.go new file mode 100644 index 00000000000..065010f580c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_hostpoolproperties.go @@ -0,0 +1,29 @@ +package hostpool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostPoolProperties struct { + ApplicationGroupReferences *[]string `json:"applicationGroupReferences,omitempty"` + CloudPcResource *bool `json:"cloudPcResource,omitempty"` + CustomRdpProperty *string `json:"customRdpProperty,omitempty"` + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + HostPoolType HostPoolType `json:"hostPoolType"` + LoadBalancerType LoadBalancerType `json:"loadBalancerType"` + MaxSessionLimit *int64 `json:"maxSessionLimit,omitempty"` + MigrationRequest *MigrationRequestProperties `json:"migrationRequest,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + PersonalDesktopAssignmentType *PersonalDesktopAssignmentType `json:"personalDesktopAssignmentType,omitempty"` + PreferredAppGroupType PreferredAppGroupType `json:"preferredAppGroupType"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + RegistrationInfo *RegistrationInfo `json:"registrationInfo,omitempty"` + Ring *int64 `json:"ring,omitempty"` + SsoClientId *string `json:"ssoClientId,omitempty"` + SsoClientSecretKeyVaultPath *string `json:"ssoClientSecretKeyVaultPath,omitempty"` + SsoSecretType *SSOSecretType `json:"ssoSecretType,omitempty"` + SsoadfsAuthority *string `json:"ssoadfsAuthority,omitempty"` + StartVMOnConnect *bool `json:"startVMOnConnect,omitempty"` + ValidationEnvironment *bool `json:"validationEnvironment,omitempty"` + VmTemplate *string `json:"vmTemplate,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_migrationrequestproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_migrationrequestproperties.go new file mode 100644 index 00000000000..2f6b968453d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_migrationrequestproperties.go @@ -0,0 +1,9 @@ +package hostpool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrationRequestProperties struct { + MigrationPath *string `json:"migrationPath,omitempty"` + Operation *Operation `json:"operation,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_plan.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_plan.go new file mode 100644 index 00000000000..f81691c1b9a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_plan.go @@ -0,0 +1,12 @@ +package hostpool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name string `json:"name"` + Product string `json:"product"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher string `json:"publisher"` + Version *string `json:"version,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_registrationinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_registrationinfo.go new file mode 100644 index 00000000000..ed356c7e596 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_registrationinfo.go @@ -0,0 +1,28 @@ +package hostpool + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegistrationInfo struct { + ExpirationTime *string `json:"expirationTime,omitempty"` + RegistrationTokenOperation *RegistrationTokenOperation `json:"registrationTokenOperation,omitempty"` + Token *string `json:"token,omitempty"` +} + +func (o *RegistrationInfo) GetExpirationTimeAsTime() (*time.Time, error) { + if o.ExpirationTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ExpirationTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RegistrationInfo) SetExpirationTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationTime = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_registrationinfopatch.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_registrationinfopatch.go new file mode 100644 index 00000000000..7340343045e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_registrationinfopatch.go @@ -0,0 +1,27 @@ +package hostpool + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegistrationInfoPatch struct { + ExpirationTime *string `json:"expirationTime,omitempty"` + RegistrationTokenOperation *RegistrationTokenOperation `json:"registrationTokenOperation,omitempty"` +} + +func (o *RegistrationInfoPatch) GetExpirationTimeAsTime() (*time.Time, error) { + if o.ExpirationTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ExpirationTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RegistrationInfoPatch) SetExpirationTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationTime = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_sku.go new file mode 100644 index 00000000000..26583f4fcea --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/model_sku.go @@ -0,0 +1,12 @@ +package hostpool + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/predicates.go new file mode 100644 index 00000000000..27e04add212 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/predicates.go @@ -0,0 +1,44 @@ +package hostpool + +type HostPoolOperationPredicate struct { + Etag *string + Id *string + Kind *string + Location *string + ManagedBy *string + Name *string + Type *string +} + +func (p HostPoolOperationPredicate) Matches(input HostPool) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && (input.Kind == nil && *p.Kind != *input.Kind) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.ManagedBy != nil && (input.ManagedBy == nil && *p.ManagedBy != *input.ManagedBy) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/version.go new file mode 100644 index 00000000000..3601ff52ba2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/version.go @@ -0,0 +1,12 @@ +package hostpool + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-09-03-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/hostpool/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/README.md new file mode 100644 index 00000000000..28fcd8f81a5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/README.md @@ -0,0 +1,145 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan` Documentation + +The `scalingplan` SDK allows for interaction with the Azure Resource Manager Service `desktopvirtualization` (API Version `2021-09-03-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan" +``` + + +### Client Initialization + +```go +client := scalingplan.NewScalingPlanClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ScalingPlanClient.Create` + +```go +ctx := context.TODO() +id := scalingplan.NewScalingPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scalingPlanValue") + +payload := scalingplan.ScalingPlan{ + // ... +} + + +read, err := client.Create(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ScalingPlanClient.Delete` + +```go +ctx := context.TODO() +id := scalingplan.NewScalingPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scalingPlanValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ScalingPlanClient.Get` + +```go +ctx := context.TODO() +id := scalingplan.NewScalingPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scalingPlanValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ScalingPlanClient.ListByHostPool` + +```go +ctx := context.TODO() +id := scalingplan.NewHostPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostPoolValue") + +// alternatively `client.ListByHostPool(ctx, id)` can be used to do batched pagination +items, err := client.ListByHostPoolComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ScalingPlanClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := scalingplan.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ScalingPlanClient.ListBySubscription` + +```go +ctx := context.TODO() +id := scalingplan.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ScalingPlanClient.Update` + +```go +ctx := context.TODO() +id := scalingplan.NewScalingPlanID("12345678-1234-9876-4563-123456789012", "example-resource-group", "scalingPlanValue") + +payload := scalingplan.ScalingPlanPatch{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/client.go new file mode 100644 index 00000000000..eaee7bdef15 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/client.go @@ -0,0 +1,18 @@ +package scalingplan + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScalingPlanClient struct { + Client autorest.Client + baseUri string +} + +func NewScalingPlanClientWithBaseURI(endpoint string) ScalingPlanClient { + return ScalingPlanClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/constants.go new file mode 100644 index 00000000000..9a7fcbb8a5e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/constants.go @@ -0,0 +1,164 @@ +package scalingplan + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DaysOfWeek string + +const ( + DaysOfWeekFriday DaysOfWeek = "Friday" + DaysOfWeekMonday DaysOfWeek = "Monday" + DaysOfWeekSaturday DaysOfWeek = "Saturday" + DaysOfWeekSunday DaysOfWeek = "Sunday" + DaysOfWeekThursday DaysOfWeek = "Thursday" + DaysOfWeekTuesday DaysOfWeek = "Tuesday" + DaysOfWeekWednesday DaysOfWeek = "Wednesday" +) + +func PossibleValuesForDaysOfWeek() []string { + return []string{ + string(DaysOfWeekFriday), + string(DaysOfWeekMonday), + string(DaysOfWeekSaturday), + string(DaysOfWeekSunday), + string(DaysOfWeekThursday), + string(DaysOfWeekTuesday), + string(DaysOfWeekWednesday), + } +} + +func parseDaysOfWeek(input string) (*DaysOfWeek, error) { + vals := map[string]DaysOfWeek{ + "friday": DaysOfWeekFriday, + "monday": DaysOfWeekMonday, + "saturday": DaysOfWeekSaturday, + "sunday": DaysOfWeekSunday, + "thursday": DaysOfWeekThursday, + "tuesday": DaysOfWeekTuesday, + "wednesday": DaysOfWeekWednesday, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DaysOfWeek(input) + return &out, nil +} + +type ScalingHostPoolType string + +const ( + ScalingHostPoolTypePooled ScalingHostPoolType = "Pooled" +) + +func PossibleValuesForScalingHostPoolType() []string { + return []string{ + string(ScalingHostPoolTypePooled), + } +} + +func parseScalingHostPoolType(input string) (*ScalingHostPoolType, error) { + vals := map[string]ScalingHostPoolType{ + "pooled": ScalingHostPoolTypePooled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ScalingHostPoolType(input) + return &out, nil +} + +type SessionHostLoadBalancingAlgorithm string + +const ( + SessionHostLoadBalancingAlgorithmBreadthFirst SessionHostLoadBalancingAlgorithm = "BreadthFirst" + SessionHostLoadBalancingAlgorithmDepthFirst SessionHostLoadBalancingAlgorithm = "DepthFirst" +) + +func PossibleValuesForSessionHostLoadBalancingAlgorithm() []string { + return []string{ + string(SessionHostLoadBalancingAlgorithmBreadthFirst), + string(SessionHostLoadBalancingAlgorithmDepthFirst), + } +} + +func parseSessionHostLoadBalancingAlgorithm(input string) (*SessionHostLoadBalancingAlgorithm, error) { + vals := map[string]SessionHostLoadBalancingAlgorithm{ + "breadthfirst": SessionHostLoadBalancingAlgorithmBreadthFirst, + "depthfirst": SessionHostLoadBalancingAlgorithmDepthFirst, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SessionHostLoadBalancingAlgorithm(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierFree SkuTier = "Free" + SkuTierPremium SkuTier = "Premium" + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierFree), + string(SkuTierPremium), + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "free": SkuTierFree, + "premium": SkuTierPremium, + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} + +type StopHostsWhen string + +const ( + StopHostsWhenZeroActiveSessions StopHostsWhen = "ZeroActiveSessions" + StopHostsWhenZeroSessions StopHostsWhen = "ZeroSessions" +) + +func PossibleValuesForStopHostsWhen() []string { + return []string{ + string(StopHostsWhenZeroActiveSessions), + string(StopHostsWhenZeroSessions), + } +} + +func parseStopHostsWhen(input string) (*StopHostsWhen, error) { + vals := map[string]StopHostsWhen{ + "zeroactivesessions": StopHostsWhenZeroActiveSessions, + "zerosessions": StopHostsWhenZeroSessions, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StopHostsWhen(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_hostpool.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_hostpool.go new file mode 100644 index 00000000000..403b28434e0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_hostpool.go @@ -0,0 +1,124 @@ +package scalingplan + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = HostPoolId{} + +// HostPoolId is a struct representing the Resource ID for a Host Pool +type HostPoolId struct { + SubscriptionId string + ResourceGroupName string + HostPoolName string +} + +// NewHostPoolID returns a new HostPoolId struct +func NewHostPoolID(subscriptionId string, resourceGroupName string, hostPoolName string) HostPoolId { + return HostPoolId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + HostPoolName: hostPoolName, + } +} + +// ParseHostPoolID parses 'input' into a HostPoolId +func ParseHostPoolID(input string) (*HostPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(HostPoolId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseHostPoolIDInsensitively parses 'input' case-insensitively into a HostPoolId +// note: this method should only be used for API response data and not user input +func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(HostPoolId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID +func ValidateHostPoolID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseHostPoolID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Host Pool ID +func (id HostPoolId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/hostPools/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.HostPoolName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Host Pool ID +func (id HostPoolId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticHostPools", "hostPools", "hostPools"), + resourceids.UserSpecifiedSegment("hostPoolName", "hostPoolValue"), + } +} + +// String returns a human-readable description of this Host Pool ID +func (id HostPoolId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Host Pool Name: %q", id.HostPoolName), + } + return fmt.Sprintf("Host Pool (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_scalingplan.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_scalingplan.go new file mode 100644 index 00000000000..7ab8c80a40c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_scalingplan.go @@ -0,0 +1,124 @@ +package scalingplan + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ScalingPlanId{} + +// ScalingPlanId is a struct representing the Resource ID for a Scaling Plan +type ScalingPlanId struct { + SubscriptionId string + ResourceGroupName string + ScalingPlanName string +} + +// NewScalingPlanID returns a new ScalingPlanId struct +func NewScalingPlanID(subscriptionId string, resourceGroupName string, scalingPlanName string) ScalingPlanId { + return ScalingPlanId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ScalingPlanName: scalingPlanName, + } +} + +// ParseScalingPlanID parses 'input' into a ScalingPlanId +func ParseScalingPlanID(input string) (*ScalingPlanId, error) { + parser := resourceids.NewParserFromResourceIdType(ScalingPlanId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScalingPlanId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ScalingPlanName, ok = parsed.Parsed["scalingPlanName"]; !ok { + return nil, fmt.Errorf("the segment 'scalingPlanName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseScalingPlanIDInsensitively parses 'input' case-insensitively into a ScalingPlanId +// note: this method should only be used for API response data and not user input +func ParseScalingPlanIDInsensitively(input string) (*ScalingPlanId, error) { + parser := resourceids.NewParserFromResourceIdType(ScalingPlanId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScalingPlanId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ScalingPlanName, ok = parsed.Parsed["scalingPlanName"]; !ok { + return nil, fmt.Errorf("the segment 'scalingPlanName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateScalingPlanID checks that 'input' can be parsed as a Scaling Plan ID +func ValidateScalingPlanID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseScalingPlanID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scaling Plan ID +func (id ScalingPlanId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/scalingPlans/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ScalingPlanName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scaling Plan ID +func (id ScalingPlanId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticScalingPlans", "scalingPlans", "scalingPlans"), + resourceids.UserSpecifiedSegment("scalingPlanName", "scalingPlanValue"), + } +} + +// String returns a human-readable description of this Scaling Plan ID +func (id ScalingPlanId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Scaling Plan Name: %q", id.ScalingPlanName), + } + return fmt.Sprintf("Scaling Plan (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_create_autorest.go new file mode 100644 index 00000000000..e952f1e0537 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_create_autorest.go @@ -0,0 +1,69 @@ +package scalingplan + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *ScalingPlan +} + +// Create ... +func (c ScalingPlanClient) Create(ctx context.Context, id ScalingPlanId, input ScalingPlan) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c ScalingPlanClient) preparerForCreate(ctx context.Context, id ScalingPlanId, input ScalingPlan) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c ScalingPlanClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_delete_autorest.go new file mode 100644 index 00000000000..a9485dc482d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_delete_autorest.go @@ -0,0 +1,66 @@ +package scalingplan + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ScalingPlanClient) Delete(ctx context.Context, id ScalingPlanId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ScalingPlanClient) preparerForDelete(ctx context.Context, id ScalingPlanId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ScalingPlanClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_get_autorest.go new file mode 100644 index 00000000000..133b9e4d7cb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_get_autorest.go @@ -0,0 +1,68 @@ +package scalingplan + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ScalingPlan +} + +// Get ... +func (c ScalingPlanClient) Get(ctx context.Context, id ScalingPlanId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ScalingPlanClient) preparerForGet(ctx context.Context, id ScalingPlanId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ScalingPlanClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbyhostpool_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbyhostpool_autorest.go new file mode 100644 index 00000000000..011325451e3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbyhostpool_autorest.go @@ -0,0 +1,186 @@ +package scalingplan + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByHostPoolOperationResponse struct { + HttpResponse *http.Response + Model *[]ScalingPlan + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByHostPoolOperationResponse, error) +} + +type ListByHostPoolCompleteResult struct { + Items []ScalingPlan +} + +func (r ListByHostPoolOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByHostPoolOperationResponse) LoadMore(ctx context.Context) (resp ListByHostPoolOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByHostPool ... +func (c ScalingPlanClient) ListByHostPool(ctx context.Context, id HostPoolId) (resp ListByHostPoolOperationResponse, err error) { + req, err := c.preparerForListByHostPool(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByHostPool", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByHostPool", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByHostPool(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByHostPool", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByHostPool prepares the ListByHostPool request. +func (c ScalingPlanClient) preparerForListByHostPool(ctx context.Context, id HostPoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/scalingPlans", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByHostPoolWithNextLink prepares the ListByHostPool request with the given nextLink token. +func (c ScalingPlanClient) preparerForListByHostPoolWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByHostPool handles the response to the ListByHostPool request. The method always +// closes the http.Response Body. +func (c ScalingPlanClient) responderForListByHostPool(resp *http.Response) (result ListByHostPoolOperationResponse, err error) { + type page struct { + Values []ScalingPlan `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByHostPoolOperationResponse, err error) { + req, err := c.preparerForListByHostPoolWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByHostPool", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByHostPool", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByHostPool(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByHostPool", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByHostPoolComplete retrieves all of the results into a single object +func (c ScalingPlanClient) ListByHostPoolComplete(ctx context.Context, id HostPoolId) (ListByHostPoolCompleteResult, error) { + return c.ListByHostPoolCompleteMatchingPredicate(ctx, id, ScalingPlanOperationPredicate{}) +} + +// ListByHostPoolCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ScalingPlanClient) ListByHostPoolCompleteMatchingPredicate(ctx context.Context, id HostPoolId, predicate ScalingPlanOperationPredicate) (resp ListByHostPoolCompleteResult, err error) { + items := make([]ScalingPlan, 0) + + page, err := c.ListByHostPool(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByHostPoolCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..766861da9ac --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package scalingplan + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]ScalingPlan + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []ScalingPlan +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c ScalingPlanClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ScalingPlanClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/scalingPlans", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c ScalingPlanClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ScalingPlanClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []ScalingPlan `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c ScalingPlanClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ScalingPlanOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ScalingPlanClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ScalingPlanOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]ScalingPlan, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..c1c4470b67d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package scalingplan + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]ScalingPlan + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []ScalingPlan +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c ScalingPlanClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c ScalingPlanClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/scalingPlans", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c ScalingPlanClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c ScalingPlanClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []ScalingPlan `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c ScalingPlanClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ScalingPlanOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ScalingPlanClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ScalingPlanOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]ScalingPlan, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_update_autorest.go new file mode 100644 index 00000000000..601936a257c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/method_update_autorest.go @@ -0,0 +1,69 @@ +package scalingplan + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *ScalingPlan +} + +// Update ... +func (c ScalingPlanClient) Update(ctx context.Context, id ScalingPlanId, input ScalingPlanPatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scalingplan.ScalingPlanClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ScalingPlanClient) preparerForUpdate(ctx context.Context, id ScalingPlanId, input ScalingPlanPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ScalingPlanClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_plan.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_plan.go new file mode 100644 index 00000000000..07296ec4765 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_plan.go @@ -0,0 +1,12 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name string `json:"name"` + Product string `json:"product"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher string `json:"publisher"` + Version *string `json:"version,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalinghostpoolreference.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalinghostpoolreference.go new file mode 100644 index 00000000000..0bd8fd048bb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalinghostpoolreference.go @@ -0,0 +1,9 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScalingHostPoolReference struct { + HostPoolArmPath *string `json:"hostPoolArmPath,omitempty"` + ScalingPlanEnabled *bool `json:"scalingPlanEnabled,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplan.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplan.go new file mode 100644 index 00000000000..8b59d34339e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplan.go @@ -0,0 +1,25 @@ +package scalingplan + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScalingPlan struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` + Name *string `json:"name,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *ScalingPlanProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanpatch.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanpatch.go new file mode 100644 index 00000000000..642647709fe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanpatch.go @@ -0,0 +1,9 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScalingPlanPatch struct { + Properties *ScalingPlanPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanpatchproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanpatchproperties.go new file mode 100644 index 00000000000..393a26bb413 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanpatchproperties.go @@ -0,0 +1,13 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScalingPlanPatchProperties struct { + Description *string `json:"description,omitempty"` + ExclusionTag *string `json:"exclusionTag,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + HostPoolReferences *[]ScalingHostPoolReference `json:"hostPoolReferences,omitempty"` + Schedules *[]ScalingSchedule `json:"schedules,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanproperties.go new file mode 100644 index 00000000000..520ed16aa9a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingplanproperties.go @@ -0,0 +1,15 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScalingPlanProperties struct { + Description *string `json:"description,omitempty"` + ExclusionTag *string `json:"exclusionTag,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + HostPoolReferences *[]ScalingHostPoolReference `json:"hostPoolReferences,omitempty"` + HostPoolType *ScalingHostPoolType `json:"hostPoolType,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + Schedules *[]ScalingSchedule `json:"schedules,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingschedule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingschedule.go new file mode 100644 index 00000000000..313ed8bdf13 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_scalingschedule.go @@ -0,0 +1,25 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScalingSchedule struct { + DaysOfWeek *[]DaysOfWeek `json:"daysOfWeek,omitempty"` + Name *string `json:"name,omitempty"` + OffPeakLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"offPeakLoadBalancingAlgorithm,omitempty"` + OffPeakStartTime *Time `json:"offPeakStartTime,omitempty"` + PeakLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"peakLoadBalancingAlgorithm,omitempty"` + PeakStartTime *Time `json:"peakStartTime,omitempty"` + RampDownCapacityThresholdPct *int64 `json:"rampDownCapacityThresholdPct,omitempty"` + RampDownForceLogoffUsers *bool `json:"rampDownForceLogoffUsers,omitempty"` + RampDownLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"rampDownLoadBalancingAlgorithm,omitempty"` + RampDownMinimumHostsPct *int64 `json:"rampDownMinimumHostsPct,omitempty"` + RampDownNotificationMessage *string `json:"rampDownNotificationMessage,omitempty"` + RampDownStartTime *Time `json:"rampDownStartTime,omitempty"` + RampDownStopHostsWhen *StopHostsWhen `json:"rampDownStopHostsWhen,omitempty"` + RampDownWaitTimeMinutes *int64 `json:"rampDownWaitTimeMinutes,omitempty"` + RampUpCapacityThresholdPct *int64 `json:"rampUpCapacityThresholdPct,omitempty"` + RampUpLoadBalancingAlgorithm *SessionHostLoadBalancingAlgorithm `json:"rampUpLoadBalancingAlgorithm,omitempty"` + RampUpMinimumHostsPct *int64 `json:"rampUpMinimumHostsPct,omitempty"` + RampUpStartTime *Time `json:"rampUpStartTime,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_sku.go new file mode 100644 index 00000000000..364fdaef1a0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_sku.go @@ -0,0 +1,12 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_time.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_time.go new file mode 100644 index 00000000000..f9e8b6f4484 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/model_time.go @@ -0,0 +1,9 @@ +package scalingplan + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Time struct { + Hour int64 `json:"hour"` + Minute int64 `json:"minute"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/predicates.go new file mode 100644 index 00000000000..7633debe906 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/predicates.go @@ -0,0 +1,44 @@ +package scalingplan + +type ScalingPlanOperationPredicate struct { + Etag *string + Id *string + Kind *string + Location *string + ManagedBy *string + Name *string + Type *string +} + +func (p ScalingPlanOperationPredicate) Matches(input ScalingPlan) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && (input.Kind == nil && *p.Kind != *input.Kind) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.ManagedBy != nil && (input.ManagedBy == nil && *p.ManagedBy != *input.ManagedBy) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/version.go new file mode 100644 index 00000000000..577b2cdd7db --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/version.go @@ -0,0 +1,12 @@ +package scalingplan + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-09-03-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/scalingplan/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/README.md new file mode 100644 index 00000000000..ff187e4b7e2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost` Documentation + +The `sessionhost` SDK allows for interaction with the Azure Resource Manager Service `desktopvirtualization` (API Version `2021-09-03-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost" +``` + + +### Client Initialization + +```go +client := sessionhost.NewSessionHostClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SessionHostClient.Delete` + +```go +ctx := context.TODO() +id := sessionhost.NewSessionHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostPoolValue", "sessionHostValue") + +read, err := client.Delete(ctx, id, sessionhost.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SessionHostClient.Get` + +```go +ctx := context.TODO() +id := sessionhost.NewSessionHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostPoolValue", "sessionHostValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SessionHostClient.List` + +```go +ctx := context.TODO() +id := sessionhost.NewHostPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostPoolValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SessionHostClient.Update` + +```go +ctx := context.TODO() +id := sessionhost.NewSessionHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostPoolValue", "sessionHostValue") + +payload := sessionhost.SessionHostPatch{ + // ... +} + + +read, err := client.Update(ctx, id, payload, sessionhost.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/client.go new file mode 100644 index 00000000000..69a79d045fe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/client.go @@ -0,0 +1,18 @@ +package sessionhost + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SessionHostClient struct { + Client autorest.Client + baseUri string +} + +func NewSessionHostClientWithBaseURI(endpoint string) SessionHostClient { + return SessionHostClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/constants.go new file mode 100644 index 00000000000..ef4b007d663 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/constants.go @@ -0,0 +1,190 @@ +package sessionhost + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HealthCheckName string + +const ( + HealthCheckNameAppAttachHealthCheck HealthCheckName = "AppAttachHealthCheck" + HealthCheckNameDomainJoinedCheck HealthCheckName = "DomainJoinedCheck" + HealthCheckNameDomainReachable HealthCheckName = "DomainReachable" + HealthCheckNameDomainTrustCheck HealthCheckName = "DomainTrustCheck" + HealthCheckNameFSLogixHealthCheck HealthCheckName = "FSLogixHealthCheck" + HealthCheckNameMetaDataServiceCheck HealthCheckName = "MetaDataServiceCheck" + HealthCheckNameMonitoringAgentCheck HealthCheckName = "MonitoringAgentCheck" + HealthCheckNameSupportedEncryptionCheck HealthCheckName = "SupportedEncryptionCheck" + HealthCheckNameSxSStackListenerCheck HealthCheckName = "SxSStackListenerCheck" + HealthCheckNameUrlsAccessibleCheck HealthCheckName = "UrlsAccessibleCheck" + HealthCheckNameWebRTCRedirectorCheck HealthCheckName = "WebRTCRedirectorCheck" +) + +func PossibleValuesForHealthCheckName() []string { + return []string{ + string(HealthCheckNameAppAttachHealthCheck), + string(HealthCheckNameDomainJoinedCheck), + string(HealthCheckNameDomainReachable), + string(HealthCheckNameDomainTrustCheck), + string(HealthCheckNameFSLogixHealthCheck), + string(HealthCheckNameMetaDataServiceCheck), + string(HealthCheckNameMonitoringAgentCheck), + string(HealthCheckNameSupportedEncryptionCheck), + string(HealthCheckNameSxSStackListenerCheck), + string(HealthCheckNameUrlsAccessibleCheck), + string(HealthCheckNameWebRTCRedirectorCheck), + } +} + +func parseHealthCheckName(input string) (*HealthCheckName, error) { + vals := map[string]HealthCheckName{ + "appattachhealthcheck": HealthCheckNameAppAttachHealthCheck, + "domainjoinedcheck": HealthCheckNameDomainJoinedCheck, + "domainreachable": HealthCheckNameDomainReachable, + "domaintrustcheck": HealthCheckNameDomainTrustCheck, + "fslogixhealthcheck": HealthCheckNameFSLogixHealthCheck, + "metadataservicecheck": HealthCheckNameMetaDataServiceCheck, + "monitoringagentcheck": HealthCheckNameMonitoringAgentCheck, + "supportedencryptioncheck": HealthCheckNameSupportedEncryptionCheck, + "sxsstacklistenercheck": HealthCheckNameSxSStackListenerCheck, + "urlsaccessiblecheck": HealthCheckNameUrlsAccessibleCheck, + "webrtcredirectorcheck": HealthCheckNameWebRTCRedirectorCheck, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HealthCheckName(input) + return &out, nil +} + +type HealthCheckResult string + +const ( + HealthCheckResultHealthCheckFailed HealthCheckResult = "HealthCheckFailed" + HealthCheckResultHealthCheckSucceeded HealthCheckResult = "HealthCheckSucceeded" + HealthCheckResultSessionHostShutdown HealthCheckResult = "SessionHostShutdown" + HealthCheckResultUnknown HealthCheckResult = "Unknown" +) + +func PossibleValuesForHealthCheckResult() []string { + return []string{ + string(HealthCheckResultHealthCheckFailed), + string(HealthCheckResultHealthCheckSucceeded), + string(HealthCheckResultSessionHostShutdown), + string(HealthCheckResultUnknown), + } +} + +func parseHealthCheckResult(input string) (*HealthCheckResult, error) { + vals := map[string]HealthCheckResult{ + "healthcheckfailed": HealthCheckResultHealthCheckFailed, + "healthchecksucceeded": HealthCheckResultHealthCheckSucceeded, + "sessionhostshutdown": HealthCheckResultSessionHostShutdown, + "unknown": HealthCheckResultUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HealthCheckResult(input) + return &out, nil +} + +type Status string + +const ( + StatusAvailable Status = "Available" + StatusDisconnected Status = "Disconnected" + StatusDomainTrustRelationshipLost Status = "DomainTrustRelationshipLost" + StatusFSLogixNotHealthy Status = "FSLogixNotHealthy" + StatusNeedsAssistance Status = "NeedsAssistance" + StatusNoHeartbeat Status = "NoHeartbeat" + StatusNotJoinedToDomain Status = "NotJoinedToDomain" + StatusShutdown Status = "Shutdown" + StatusSxSStackListenerNotReady Status = "SxSStackListenerNotReady" + StatusUnavailable Status = "Unavailable" + StatusUpgradeFailed Status = "UpgradeFailed" + StatusUpgrading Status = "Upgrading" +) + +func PossibleValuesForStatus() []string { + return []string{ + string(StatusAvailable), + string(StatusDisconnected), + string(StatusDomainTrustRelationshipLost), + string(StatusFSLogixNotHealthy), + string(StatusNeedsAssistance), + string(StatusNoHeartbeat), + string(StatusNotJoinedToDomain), + string(StatusShutdown), + string(StatusSxSStackListenerNotReady), + string(StatusUnavailable), + string(StatusUpgradeFailed), + string(StatusUpgrading), + } +} + +func parseStatus(input string) (*Status, error) { + vals := map[string]Status{ + "available": StatusAvailable, + "disconnected": StatusDisconnected, + "domaintrustrelationshiplost": StatusDomainTrustRelationshipLost, + "fslogixnothealthy": StatusFSLogixNotHealthy, + "needsassistance": StatusNeedsAssistance, + "noheartbeat": StatusNoHeartbeat, + "notjoinedtodomain": StatusNotJoinedToDomain, + "shutdown": StatusShutdown, + "sxsstacklistenernotready": StatusSxSStackListenerNotReady, + "unavailable": StatusUnavailable, + "upgradefailed": StatusUpgradeFailed, + "upgrading": StatusUpgrading, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} + +type UpdateState string + +const ( + UpdateStateFailed UpdateState = "Failed" + UpdateStateInitial UpdateState = "Initial" + UpdateStatePending UpdateState = "Pending" + UpdateStateStarted UpdateState = "Started" + UpdateStateSucceeded UpdateState = "Succeeded" +) + +func PossibleValuesForUpdateState() []string { + return []string{ + string(UpdateStateFailed), + string(UpdateStateInitial), + string(UpdateStatePending), + string(UpdateStateStarted), + string(UpdateStateSucceeded), + } +} + +func parseUpdateState(input string) (*UpdateState, error) { + vals := map[string]UpdateState{ + "failed": UpdateStateFailed, + "initial": UpdateStateInitial, + "pending": UpdateStatePending, + "started": UpdateStateStarted, + "succeeded": UpdateStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpdateState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_hostpool.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_hostpool.go new file mode 100644 index 00000000000..b42dea32fb0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_hostpool.go @@ -0,0 +1,124 @@ +package sessionhost + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = HostPoolId{} + +// HostPoolId is a struct representing the Resource ID for a Host Pool +type HostPoolId struct { + SubscriptionId string + ResourceGroupName string + HostPoolName string +} + +// NewHostPoolID returns a new HostPoolId struct +func NewHostPoolID(subscriptionId string, resourceGroupName string, hostPoolName string) HostPoolId { + return HostPoolId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + HostPoolName: hostPoolName, + } +} + +// ParseHostPoolID parses 'input' into a HostPoolId +func ParseHostPoolID(input string) (*HostPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(HostPoolId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseHostPoolIDInsensitively parses 'input' case-insensitively into a HostPoolId +// note: this method should only be used for API response data and not user input +func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(HostPoolId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := HostPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID +func ValidateHostPoolID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseHostPoolID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Host Pool ID +func (id HostPoolId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/hostPools/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.HostPoolName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Host Pool ID +func (id HostPoolId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticHostPools", "hostPools", "hostPools"), + resourceids.UserSpecifiedSegment("hostPoolName", "hostPoolValue"), + } +} + +// String returns a human-readable description of this Host Pool ID +func (id HostPoolId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Host Pool Name: %q", id.HostPoolName), + } + return fmt.Sprintf("Host Pool (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_sessionhost.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_sessionhost.go new file mode 100644 index 00000000000..cd3fe90122c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_sessionhost.go @@ -0,0 +1,137 @@ +package sessionhost + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SessionHostId{} + +// SessionHostId is a struct representing the Resource ID for a Session Host +type SessionHostId struct { + SubscriptionId string + ResourceGroupName string + HostPoolName string + SessionHostName string +} + +// NewSessionHostID returns a new SessionHostId struct +func NewSessionHostID(subscriptionId string, resourceGroupName string, hostPoolName string, sessionHostName string) SessionHostId { + return SessionHostId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + HostPoolName: hostPoolName, + SessionHostName: sessionHostName, + } +} + +// ParseSessionHostID parses 'input' into a SessionHostId +func ParseSessionHostID(input string) (*SessionHostId, error) { + parser := resourceids.NewParserFromResourceIdType(SessionHostId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SessionHostId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { + return nil, fmt.Errorf("the segment 'sessionHostName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSessionHostIDInsensitively parses 'input' case-insensitively into a SessionHostId +// note: this method should only be used for API response data and not user input +func ParseSessionHostIDInsensitively(input string) (*SessionHostId, error) { + parser := resourceids.NewParserFromResourceIdType(SessionHostId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SessionHostId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { + return nil, fmt.Errorf("the segment 'hostPoolName' was not found in the resource id %q", input) + } + + if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { + return nil, fmt.Errorf("the segment 'sessionHostName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSessionHostID checks that 'input' can be parsed as a Session Host ID +func ValidateSessionHostID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSessionHostID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Session Host ID +func (id SessionHostId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/hostPools/%s/sessionHosts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.HostPoolName, id.SessionHostName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Session Host ID +func (id SessionHostId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticHostPools", "hostPools", "hostPools"), + resourceids.UserSpecifiedSegment("hostPoolName", "hostPoolValue"), + resourceids.StaticSegment("staticSessionHosts", "sessionHosts", "sessionHosts"), + resourceids.UserSpecifiedSegment("sessionHostName", "sessionHostValue"), + } +} + +// String returns a human-readable description of this Session Host ID +func (id SessionHostId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Host Pool Name: %q", id.HostPoolName), + fmt.Sprintf("Session Host Name: %q", id.SessionHostName), + } + return fmt.Sprintf("Session Host (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_delete_autorest.go new file mode 100644 index 00000000000..3110efc67ee --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_delete_autorest.go @@ -0,0 +1,95 @@ +package sessionhost + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + Force *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Force != nil { + out["force"] = *o.Force + } + + return out +} + +// Delete ... +func (c SessionHostClient) Delete(ctx context.Context, id SessionHostId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c SessionHostClient) preparerForDelete(ctx context.Context, id SessionHostId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c SessionHostClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_get_autorest.go new file mode 100644 index 00000000000..309db6d7386 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_get_autorest.go @@ -0,0 +1,68 @@ +package sessionhost + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *SessionHost +} + +// Get ... +func (c SessionHostClient) Get(ctx context.Context, id SessionHostId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c SessionHostClient) preparerForGet(ctx context.Context, id SessionHostId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c SessionHostClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_list_autorest.go new file mode 100644 index 00000000000..e1a8d5575dd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_list_autorest.go @@ -0,0 +1,186 @@ +package sessionhost + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]SessionHost + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []SessionHost +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c SessionHostClient) List(ctx context.Context, id HostPoolId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c SessionHostClient) preparerForList(ctx context.Context, id HostPoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/sessionHosts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c SessionHostClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c SessionHostClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []SessionHost `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c SessionHostClient) ListComplete(ctx context.Context, id HostPoolId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, SessionHostOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SessionHostClient) ListCompleteMatchingPredicate(ctx context.Context, id HostPoolId, predicate SessionHostOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]SessionHost, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_update_autorest.go new file mode 100644 index 00000000000..0d96c63c78e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/method_update_autorest.go @@ -0,0 +1,98 @@ +package sessionhost + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *SessionHost +} + +type UpdateOperationOptions struct { + Force *bool +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Force != nil { + out["force"] = *o.Force + } + + return out +} + +// Update ... +func (c SessionHostClient) Update(ctx context.Context, id SessionHostId, input SessionHostPatch, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sessionhost.SessionHostClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c SessionHostClient) preparerForUpdate(ctx context.Context, id SessionHostId, input SessionHostPatch, options UpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c SessionHostClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhost.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhost.go new file mode 100644 index 00000000000..6a59b593c4c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhost.go @@ -0,0 +1,16 @@ +package sessionhost + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SessionHost struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SessionHostProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhosthealthcheckfailuredetails.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhosthealthcheckfailuredetails.go new file mode 100644 index 00000000000..e2430e721a2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhosthealthcheckfailuredetails.go @@ -0,0 +1,28 @@ +package sessionhost + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SessionHostHealthCheckFailureDetails struct { + ErrorCode *int64 `json:"errorCode,omitempty"` + LastHealthCheckDateTime *string `json:"lastHealthCheckDateTime,omitempty"` + Message *string `json:"message,omitempty"` +} + +func (o *SessionHostHealthCheckFailureDetails) GetLastHealthCheckDateTimeAsTime() (*time.Time, error) { + if o.LastHealthCheckDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastHealthCheckDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *SessionHostHealthCheckFailureDetails) SetLastHealthCheckDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastHealthCheckDateTime = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhosthealthcheckreport.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhosthealthcheckreport.go new file mode 100644 index 00000000000..6545cf0a038 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhosthealthcheckreport.go @@ -0,0 +1,10 @@ +package sessionhost + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SessionHostHealthCheckReport struct { + AdditionalFailureDetails *SessionHostHealthCheckFailureDetails `json:"additionalFailureDetails,omitempty"` + HealthCheckName *HealthCheckName `json:"healthCheckName,omitempty"` + HealthCheckResult *HealthCheckResult `json:"healthCheckResult,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostpatch.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostpatch.go new file mode 100644 index 00000000000..f8fa6a57624 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostpatch.go @@ -0,0 +1,11 @@ +package sessionhost + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SessionHostPatch struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SessionHostPatchProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostpatchproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostpatchproperties.go new file mode 100644 index 00000000000..11eecb2240b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostpatchproperties.go @@ -0,0 +1,9 @@ +package sessionhost + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SessionHostPatchProperties struct { + AllowNewSession *bool `json:"allowNewSession,omitempty"` + AssignedUser *string `json:"assignedUser,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostproperties.go new file mode 100644 index 00000000000..71f9dc987b9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/model_sessionhostproperties.go @@ -0,0 +1,65 @@ +package sessionhost + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SessionHostProperties struct { + AgentVersion *string `json:"agentVersion,omitempty"` + AllowNewSession *bool `json:"allowNewSession,omitempty"` + AssignedUser *string `json:"assignedUser,omitempty"` + LastHeartBeat *string `json:"lastHeartBeat,omitempty"` + LastUpdateTime *string `json:"lastUpdateTime,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + OsVersion *string `json:"osVersion,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` + SessionHostHealthCheckResults *[]SessionHostHealthCheckReport `json:"sessionHostHealthCheckResults,omitempty"` + Sessions *int64 `json:"sessions,omitempty"` + Status *Status `json:"status,omitempty"` + StatusTimestamp *string `json:"statusTimestamp,omitempty"` + SxSStackVersion *string `json:"sxSStackVersion,omitempty"` + UpdateErrorMessage *string `json:"updateErrorMessage,omitempty"` + UpdateState *UpdateState `json:"updateState,omitempty"` + VirtualMachineId *string `json:"virtualMachineId,omitempty"` +} + +func (o *SessionHostProperties) GetLastHeartBeatAsTime() (*time.Time, error) { + if o.LastHeartBeat == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastHeartBeat, "2006-01-02T15:04:05Z07:00") +} + +func (o *SessionHostProperties) SetLastHeartBeatAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastHeartBeat = &formatted +} + +func (o *SessionHostProperties) GetLastUpdateTimeAsTime() (*time.Time, error) { + if o.LastUpdateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *SessionHostProperties) SetLastUpdateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdateTime = &formatted +} + +func (o *SessionHostProperties) GetStatusTimestampAsTime() (*time.Time, error) { + if o.StatusTimestamp == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StatusTimestamp, "2006-01-02T15:04:05Z07:00") +} + +func (o *SessionHostProperties) SetStatusTimestampAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StatusTimestamp = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/predicates.go new file mode 100644 index 00000000000..e1112a03be0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/predicates.go @@ -0,0 +1,24 @@ +package sessionhost + +type SessionHostOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SessionHostOperationPredicate) Matches(input SessionHost) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/version.go new file mode 100644 index 00000000000..a9a312570df --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/version.go @@ -0,0 +1,12 @@ +package sessionhost + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-09-03-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/sessionhost/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/README.md new file mode 100644 index 00000000000..1429a7e0e98 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace` Documentation + +The `workspace` SDK allows for interaction with the Azure Resource Manager Service `desktopvirtualization` (API Version `2021-09-03-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace" +``` + + +### Client Initialization + +```go +client := workspace.NewWorkspaceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `WorkspaceClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := workspace.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +payload := workspace.Workspace{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspaceClient.Delete` + +```go +ctx := context.TODO() +id := workspace.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspaceClient.Get` + +```go +ctx := context.TODO() +id := workspace.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspaceClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := workspace.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WorkspaceClient.ListBySubscription` + +```go +ctx := context.TODO() +id := workspace.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `WorkspaceClient.Update` + +```go +ctx := context.TODO() +id := workspace.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +payload := workspace.WorkspacePatch{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/client.go new file mode 100644 index 00000000000..57fd58240e0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/client.go @@ -0,0 +1,18 @@ +package workspace + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceClient struct { + Client autorest.Client + baseUri string +} + +func NewWorkspaceClientWithBaseURI(endpoint string) WorkspaceClient { + return WorkspaceClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/constants.go new file mode 100644 index 00000000000..d2244015bc2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/constants.go @@ -0,0 +1,68 @@ +package workspace + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierFree SkuTier = "Free" + SkuTierPremium SkuTier = "Premium" + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierFree), + string(SkuTierPremium), + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "free": SkuTierFree, + "premium": SkuTierPremium, + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/id_workspace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/id_workspace.go new file mode 100644 index 00000000000..90f00ab2c31 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/id_workspace.go @@ -0,0 +1,124 @@ +package workspace + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = WorkspaceId{} + +// WorkspaceId is a struct representing the Resource ID for a Workspace +type WorkspaceId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string +} + +// NewWorkspaceID returns a new WorkspaceId struct +func NewWorkspaceID(subscriptionId string, resourceGroupName string, workspaceName string) WorkspaceId { + return WorkspaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + } +} + +// ParseWorkspaceID parses 'input' into a WorkspaceId +func ParseWorkspaceID(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkspaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseWorkspaceIDInsensitively parses 'input' case-insensitively into a WorkspaceId +// note: this method should only be used for API response data and not user input +func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkspaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID +func ValidateWorkspaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workspace ID +func (id WorkspaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/workspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workspace ID +func (id WorkspaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDesktopVirtualization", "Microsoft.DesktopVirtualization", "Microsoft.DesktopVirtualization"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"), + } +} + +// String returns a human-readable description of this Workspace ID +func (id WorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + } + return fmt.Sprintf("Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_createorupdate_autorest.go new file mode 100644 index 00000000000..9abe495b567 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package workspace + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Workspace +} + +// CreateOrUpdate ... +func (c WorkspaceClient) CreateOrUpdate(ctx context.Context, id WorkspaceId, input Workspace) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c WorkspaceClient) preparerForCreateOrUpdate(ctx context.Context, id WorkspaceId, input Workspace) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c WorkspaceClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_delete_autorest.go new file mode 100644 index 00000000000..1e4d66d5ba2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_delete_autorest.go @@ -0,0 +1,66 @@ +package workspace + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c WorkspaceClient) Delete(ctx context.Context, id WorkspaceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c WorkspaceClient) preparerForDelete(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c WorkspaceClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_get_autorest.go new file mode 100644 index 00000000000..dd725ad1053 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_get_autorest.go @@ -0,0 +1,68 @@ +package workspace + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Workspace +} + +// Get ... +func (c WorkspaceClient) Get(ctx context.Context, id WorkspaceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c WorkspaceClient) preparerForGet(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c WorkspaceClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..996387ce499 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package workspace + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Workspace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Workspace +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c WorkspaceClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c WorkspaceClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/workspaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c WorkspaceClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c WorkspaceClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Workspace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c WorkspaceClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, WorkspaceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkspaceClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate WorkspaceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Workspace, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..f54b1fb98e7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package workspace + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Workspace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []Workspace +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c WorkspaceClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c WorkspaceClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DesktopVirtualization/workspaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c WorkspaceClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c WorkspaceClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Workspace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c WorkspaceClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, WorkspaceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c WorkspaceClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate WorkspaceOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]Workspace, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_update_autorest.go new file mode 100644 index 00000000000..7734cbf336c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/method_update_autorest.go @@ -0,0 +1,69 @@ +package workspace + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Workspace +} + +// Update ... +func (c WorkspaceClient) Update(ctx context.Context, id WorkspaceId, input WorkspacePatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspace.WorkspaceClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c WorkspaceClient) preparerForUpdate(ctx context.Context, id WorkspaceId, input WorkspacePatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c WorkspaceClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_plan.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_plan.go new file mode 100644 index 00000000000..5fb713a75fe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_plan.go @@ -0,0 +1,12 @@ +package workspace + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name string `json:"name"` + Product string `json:"product"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher string `json:"publisher"` + Version *string `json:"version,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_sku.go new file mode 100644 index 00000000000..8b18e233d75 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_sku.go @@ -0,0 +1,12 @@ +package workspace + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspace.go new file mode 100644 index 00000000000..6b48aa98737 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspace.go @@ -0,0 +1,25 @@ +package workspace + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Workspace struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` + Name *string `json:"name,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *WorkspaceProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspacepatch.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspacepatch.go new file mode 100644 index 00000000000..1ac870f647e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspacepatch.go @@ -0,0 +1,9 @@ +package workspace + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacePatch struct { + Properties *WorkspacePatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspacepatchproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspacepatchproperties.go new file mode 100644 index 00000000000..3f010914b65 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspacepatchproperties.go @@ -0,0 +1,11 @@ +package workspace + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacePatchProperties struct { + ApplicationGroupReferences *[]string `json:"applicationGroupReferences,omitempty"` + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspaceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspaceproperties.go new file mode 100644 index 00000000000..8c39ae8289b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/model_workspaceproperties.go @@ -0,0 +1,13 @@ +package workspace + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceProperties struct { + ApplicationGroupReferences *[]string `json:"applicationGroupReferences,omitempty"` + CloudPcResource *bool `json:"cloudPcResource,omitempty"` + Description *string `json:"description,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/predicates.go new file mode 100644 index 00000000000..232537375c9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/predicates.go @@ -0,0 +1,44 @@ +package workspace + +type WorkspaceOperationPredicate struct { + Etag *string + Id *string + Kind *string + Location *string + ManagedBy *string + Name *string + Type *string +} + +func (p WorkspaceOperationPredicate) Matches(input Workspace) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && (input.Kind == nil && *p.Kind != *input.Kind) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.ManagedBy != nil && (input.ManagedBy == nil && *p.ManagedBy != *input.ManagedBy) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/version.go new file mode 100644 index 00000000000..2337ea8938f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/version.go @@ -0,0 +1,12 @@ +package workspace + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-09-03-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/workspace/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/client.go new file mode 100644 index 00000000000..047a134e3f5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/client.go @@ -0,0 +1,32 @@ +package v2018_05_01 + +import ( + "github.com/Azure/go-autorest/autorest" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones" +) + +type Client struct { + Dns *dns.DnsClient + RecordSets *recordsets.RecordSetsClient + Zones *zones.ZonesClient +} + +func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { + + dnsClient := dns.NewDnsClientWithBaseURI(endpoint) + configureAuthFunc(&dnsClient.Client) + + recordSetsClient := recordsets.NewRecordSetsClientWithBaseURI(endpoint) + configureAuthFunc(&recordSetsClient.Client) + + zonesClient := zones.NewZonesClientWithBaseURI(endpoint) + configureAuthFunc(&zonesClient.Client) + + return Client{ + Dns: &dnsClient, + RecordSets: &recordSetsClient, + Zones: &zonesClient, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/README.md new file mode 100644 index 00000000000..131c3b69a37 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/README.md @@ -0,0 +1,41 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns` Documentation + +The `dns` SDK allows for interaction with the Azure Resource Manager Service `dns` (API Version `2018-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns" +``` + + +### Client Initialization + +```go +client := dns.NewDnsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DnsClient.DnsResourceReferenceGetByTargetResources` + +```go +ctx := context.TODO() +id := dns.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := dns.DnsResourceReferenceRequest{ + // ... +} + + +read, err := client.DnsResourceReferenceGetByTargetResources(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/client.go new file mode 100644 index 00000000000..89e764095ab --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/client.go @@ -0,0 +1,18 @@ +package dns + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsClient struct { + Client autorest.Client + baseUri string +} + +func NewDnsClientWithBaseURI(endpoint string) DnsClient { + return DnsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/method_dnsresourcereferencegetbytargetresources_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/method_dnsresourcereferencegetbytargetresources_autorest.go new file mode 100644 index 00000000000..677c81cc4b8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/method_dnsresourcereferencegetbytargetresources_autorest.go @@ -0,0 +1,71 @@ +package dns + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsResourceReferenceGetByTargetResourcesOperationResponse struct { + HttpResponse *http.Response + Model *DnsResourceReferenceResult +} + +// DnsResourceReferenceGetByTargetResources ... +func (c DnsClient) DnsResourceReferenceGetByTargetResources(ctx context.Context, id commonids.SubscriptionId, input DnsResourceReferenceRequest) (result DnsResourceReferenceGetByTargetResourcesOperationResponse, err error) { + req, err := c.preparerForDnsResourceReferenceGetByTargetResources(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.DnsClient", "DnsResourceReferenceGetByTargetResources", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.DnsClient", "DnsResourceReferenceGetByTargetResources", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDnsResourceReferenceGetByTargetResources(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dns.DnsClient", "DnsResourceReferenceGetByTargetResources", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDnsResourceReferenceGetByTargetResources prepares the DnsResourceReferenceGetByTargetResources request. +func (c DnsClient) preparerForDnsResourceReferenceGetByTargetResources(ctx context.Context, id commonids.SubscriptionId, input DnsResourceReferenceRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/getDnsResourceReference", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDnsResourceReferenceGetByTargetResources handles the response to the DnsResourceReferenceGetByTargetResources request. The method always +// closes the http.Response Body. +func (c DnsClient) responderForDnsResourceReferenceGetByTargetResources(resp *http.Response) (result DnsResourceReferenceGetByTargetResourcesOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereference.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereference.go new file mode 100644 index 00000000000..251d3502e53 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereference.go @@ -0,0 +1,9 @@ +package dns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsResourceReference struct { + DnsResources *[]SubResource `json:"dnsResources,omitempty"` + TargetResource *SubResource `json:"targetResource,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferencerequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferencerequest.go new file mode 100644 index 00000000000..235891e18d7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferencerequest.go @@ -0,0 +1,8 @@ +package dns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsResourceReferenceRequest struct { + Properties *DnsResourceReferenceRequestProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferencerequestproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferencerequestproperties.go new file mode 100644 index 00000000000..5b97f49db18 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferencerequestproperties.go @@ -0,0 +1,8 @@ +package dns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsResourceReferenceRequestProperties struct { + TargetResources *[]SubResource `json:"targetResources,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferenceresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferenceresult.go new file mode 100644 index 00000000000..e38b5769f2d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferenceresult.go @@ -0,0 +1,8 @@ +package dns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsResourceReferenceResult struct { + Properties *DnsResourceReferenceResultProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferenceresultproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferenceresultproperties.go new file mode 100644 index 00000000000..50e2df8fb87 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_dnsresourcereferenceresultproperties.go @@ -0,0 +1,8 @@ +package dns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsResourceReferenceResultProperties struct { + DnsResourceReferences *[]DnsResourceReference `json:"dnsResourceReferences,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_subresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_subresource.go new file mode 100644 index 00000000000..c0dc97fe59a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/model_subresource.go @@ -0,0 +1,8 @@ +package dns + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/version.go new file mode 100644 index 00000000000..dee2e101b8e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns/version.go @@ -0,0 +1,12 @@ +package dns + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/dns/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/README.md new file mode 100644 index 00000000000..9f4dd1a2815 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/README.md @@ -0,0 +1,145 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets` Documentation + +The `recordsets` SDK allows for interaction with the Azure Resource Manager Service `dns` (API Version `2018-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" +``` + + +### Client Initialization + +```go +client := recordsets.NewRecordSetsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RecordSetsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue", "A", "relativeRecordSetValue") + +payload := recordsets.RecordSet{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, recordsets.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RecordSetsClient.Delete` + +```go +ctx := context.TODO() +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue", "A", "relativeRecordSetValue") + +read, err := client.Delete(ctx, id, recordsets.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RecordSetsClient.Get` + +```go +ctx := context.TODO() +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue", "A", "relativeRecordSetValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RecordSetsClient.ListAllByDnsZone` + +```go +ctx := context.TODO() +id := recordsets.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue") + +// alternatively `client.ListAllByDnsZone(ctx, id, recordsets.DefaultListAllByDnsZoneOperationOptions())` can be used to do batched pagination +items, err := client.ListAllByDnsZoneComplete(ctx, id, recordsets.DefaultListAllByDnsZoneOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RecordSetsClient.ListByDnsZone` + +```go +ctx := context.TODO() +id := recordsets.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue") + +// alternatively `client.ListByDnsZone(ctx, id, recordsets.DefaultListByDnsZoneOperationOptions())` can be used to do batched pagination +items, err := client.ListByDnsZoneComplete(ctx, id, recordsets.DefaultListByDnsZoneOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RecordSetsClient.ListByType` + +```go +ctx := context.TODO() +id := recordsets.NewZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue", "A") + +// alternatively `client.ListByType(ctx, id, recordsets.DefaultListByTypeOperationOptions())` can be used to do batched pagination +items, err := client.ListByTypeComplete(ctx, id, recordsets.DefaultListByTypeOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RecordSetsClient.Update` + +```go +ctx := context.TODO() +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue", "A", "relativeRecordSetValue") + +payload := recordsets.RecordSet{ + // ... +} + + +read, err := client.Update(ctx, id, payload, recordsets.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/client.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/client.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/client.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/constants.go new file mode 100644 index 00000000000..5586596d244 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/constants.go @@ -0,0 +1,58 @@ +package recordsets + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecordType string + +const ( + RecordTypeA RecordType = "A" + RecordTypeAAAA RecordType = "AAAA" + RecordTypeCAA RecordType = "CAA" + RecordTypeCNAME RecordType = "CNAME" + RecordTypeMX RecordType = "MX" + RecordTypeNS RecordType = "NS" + RecordTypePTR RecordType = "PTR" + RecordTypeSOA RecordType = "SOA" + RecordTypeSRV RecordType = "SRV" + RecordTypeTXT RecordType = "TXT" +) + +func PossibleValuesForRecordType() []string { + return []string{ + string(RecordTypeA), + string(RecordTypeAAAA), + string(RecordTypeCAA), + string(RecordTypeCNAME), + string(RecordTypeMX), + string(RecordTypeNS), + string(RecordTypePTR), + string(RecordTypeSOA), + string(RecordTypeSRV), + string(RecordTypeTXT), + } +} + +func parseRecordType(input string) (*RecordType, error) { + vals := map[string]RecordType{ + "a": RecordTypeA, + "aaaa": RecordTypeAAAA, + "caa": RecordTypeCAA, + "cname": RecordTypeCNAME, + "mx": RecordTypeMX, + "ns": RecordTypeNS, + "ptr": RecordTypePTR, + "soa": RecordTypeSOA, + "srv": RecordTypeSRV, + "txt": RecordTypeTXT, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RecordType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_dnszone.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_dnszone.go new file mode 100644 index 00000000000..106e7a4319c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_dnszone.go @@ -0,0 +1,124 @@ +package recordsets + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DnsZoneId{} + +// DnsZoneId is a struct representing the Resource ID for a Dns Zone +type DnsZoneId struct { + SubscriptionId string + ResourceGroupName string + ZoneName string +} + +// NewDnsZoneID returns a new DnsZoneId struct +func NewDnsZoneID(subscriptionId string, resourceGroupName string, zoneName string) DnsZoneId { + return DnsZoneId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ZoneName: zoneName, + } +} + +// ParseDnsZoneID parses 'input' into a DnsZoneId +func ParseDnsZoneID(input string) (*DnsZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(DnsZoneId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DnsZoneId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { + return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDnsZoneIDInsensitively parses 'input' case-insensitively into a DnsZoneId +// note: this method should only be used for API response data and not user input +func ParseDnsZoneIDInsensitively(input string) (*DnsZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(DnsZoneId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DnsZoneId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { + return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDnsZoneID checks that 'input' can be parsed as a Dns Zone ID +func ValidateDnsZoneID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDnsZoneID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Dns Zone ID +func (id DnsZoneId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnsZones/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ZoneName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Dns Zone ID +func (id DnsZoneId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("staticDnsZones", "dnsZones", "dnsZones"), + resourceids.UserSpecifiedSegment("zoneName", "zoneValue"), + } +} + +// String returns a human-readable description of this Dns Zone ID +func (id DnsZoneId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Zone Name: %q", id.ZoneName), + } + return fmt.Sprintf("Dns Zone (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_recordtype.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_recordtype.go new file mode 100644 index 00000000000..8b8a6ca07bd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_recordtype.go @@ -0,0 +1,164 @@ +package recordsets + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RecordTypeId{} + +// RecordTypeId is a struct representing the Resource ID for a Record Type +type RecordTypeId struct { + SubscriptionId string + ResourceGroupName string + ZoneName string + RecordType RecordType + RelativeRecordSetName string +} + +// NewRecordTypeID returns a new RecordTypeId struct +func NewRecordTypeID(subscriptionId string, resourceGroupName string, zoneName string, recordType RecordType, relativeRecordSetName string) RecordTypeId { + return RecordTypeId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ZoneName: zoneName, + RecordType: recordType, + RelativeRecordSetName: relativeRecordSetName, + } +} + +// ParseRecordTypeID parses 'input' into a RecordTypeId +func ParseRecordTypeID(input string) (*RecordTypeId, error) { + parser := resourceids.NewParserFromResourceIdType(RecordTypeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RecordTypeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { + return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + } + + if v, ok := parsed.Parsed["recordType"]; true { + if !ok { + return nil, fmt.Errorf("the segment 'recordType' was not found in the resource id %q", input) + } + + recordType, err := parseRecordType(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.RecordType = *recordType + } + + if id.RelativeRecordSetName, ok = parsed.Parsed["relativeRecordSetName"]; !ok { + return nil, fmt.Errorf("the segment 'relativeRecordSetName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRecordTypeIDInsensitively parses 'input' case-insensitively into a RecordTypeId +// note: this method should only be used for API response data and not user input +func ParseRecordTypeIDInsensitively(input string) (*RecordTypeId, error) { + parser := resourceids.NewParserFromResourceIdType(RecordTypeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RecordTypeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { + return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + } + + if v, ok := parsed.Parsed["recordType"]; true { + if !ok { + return nil, fmt.Errorf("the segment 'recordType' was not found in the resource id %q", input) + } + + recordType, err := parseRecordType(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.RecordType = *recordType + } + + if id.RelativeRecordSetName, ok = parsed.Parsed["relativeRecordSetName"]; !ok { + return nil, fmt.Errorf("the segment 'relativeRecordSetName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRecordTypeID checks that 'input' can be parsed as a Record Type ID +func ValidateRecordTypeID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRecordTypeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Record Type ID +func (id RecordTypeId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnsZones/%s/%s/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ZoneName, string(id.RecordType), id.RelativeRecordSetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Record Type ID +func (id RecordTypeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("staticDnsZones", "dnsZones", "dnsZones"), + resourceids.UserSpecifiedSegment("zoneName", "zoneValue"), + resourceids.ConstantSegment("recordType", PossibleValuesForRecordType(), "A"), + resourceids.UserSpecifiedSegment("relativeRecordSetName", "relativeRecordSetValue"), + } +} + +// String returns a human-readable description of this Record Type ID +func (id RecordTypeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Zone Name: %q", id.ZoneName), + fmt.Sprintf("Record Type: %q", string(id.RecordType)), + fmt.Sprintf("Relative Record Set Name: %q", id.RelativeRecordSetName), + } + return fmt.Sprintf("Record Type (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_zone.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_zone.go new file mode 100644 index 00000000000..17d92e82ceb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/id_zone.go @@ -0,0 +1,152 @@ +package recordsets + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ZoneId{} + +// ZoneId is a struct representing the Resource ID for a Zone +type ZoneId struct { + SubscriptionId string + ResourceGroupName string + ZoneName string + RecordType RecordType +} + +// NewZoneID returns a new ZoneId struct +func NewZoneID(subscriptionId string, resourceGroupName string, zoneName string, recordType RecordType) ZoneId { + return ZoneId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ZoneName: zoneName, + RecordType: recordType, + } +} + +// ParseZoneID parses 'input' into a ZoneId +func ParseZoneID(input string) (*ZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(ZoneId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ZoneId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { + return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + } + + if v, ok := parsed.Parsed["recordType"]; true { + if !ok { + return nil, fmt.Errorf("the segment 'recordType' was not found in the resource id %q", input) + } + + recordType, err := parseRecordType(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.RecordType = *recordType + } + + return &id, nil +} + +// ParseZoneIDInsensitively parses 'input' case-insensitively into a ZoneId +// note: this method should only be used for API response data and not user input +func ParseZoneIDInsensitively(input string) (*ZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(ZoneId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ZoneId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { + return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + } + + if v, ok := parsed.Parsed["recordType"]; true { + if !ok { + return nil, fmt.Errorf("the segment 'recordType' was not found in the resource id %q", input) + } + + recordType, err := parseRecordType(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.RecordType = *recordType + } + + return &id, nil +} + +// ValidateZoneID checks that 'input' can be parsed as a Zone ID +func ValidateZoneID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseZoneID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Zone ID +func (id ZoneId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnsZones/%s/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ZoneName, string(id.RecordType)) +} + +// Segments returns a slice of Resource ID Segments which comprise this Zone ID +func (id ZoneId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("staticDnsZones", "dnsZones", "dnsZones"), + resourceids.UserSpecifiedSegment("zoneName", "zoneValue"), + resourceids.ConstantSegment("recordType", PossibleValuesForRecordType(), "A"), + } +} + +// String returns a human-readable description of this Zone ID +func (id ZoneId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Zone Name: %q", id.ZoneName), + fmt.Sprintf("Record Type: %q", string(id.RecordType)), + } + return fmt.Sprintf("Zone (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_createorupdate_autorest.go new file mode 100644 index 00000000000..115189971b8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_createorupdate_autorest.go @@ -0,0 +1,103 @@ +package recordsets + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *RecordSet +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + if o.IfNoneMatch != nil { + out["If-None-Match"] = *o.IfNoneMatch + } + + return out +} + +func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// CreateOrUpdate ... +func (c RecordSetsClient) CreateOrUpdate(ctx context.Context, id RecordTypeId, input RecordSet, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c RecordSetsClient) preparerForCreateOrUpdate(ctx context.Context, id RecordTypeId, input RecordSet, options CreateOrUpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c RecordSetsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_delete_autorest.go new file mode 100644 index 00000000000..705826e0a5e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_delete_autorest.go @@ -0,0 +1,95 @@ +package recordsets + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Delete ... +func (c RecordSetsClient) Delete(ctx context.Context, id RecordTypeId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c RecordSetsClient) preparerForDelete(ctx context.Context, id RecordTypeId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c RecordSetsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_get_autorest.go new file mode 100644 index 00000000000..0a853247729 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_get_autorest.go @@ -0,0 +1,68 @@ +package recordsets + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *RecordSet +} + +// Get ... +func (c RecordSetsClient) Get(ctx context.Context, id RecordTypeId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c RecordSetsClient) preparerForGet(ctx context.Context, id RecordTypeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c RecordSetsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_listallbydnszone_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_listallbydnszone_autorest.go new file mode 100644 index 00000000000..c7da0416554 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_listallbydnszone_autorest.go @@ -0,0 +1,220 @@ +package recordsets + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAllByDnsZoneOperationResponse struct { + HttpResponse *http.Response + Model *[]RecordSet + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListAllByDnsZoneOperationResponse, error) +} + +type ListAllByDnsZoneCompleteResult struct { + Items []RecordSet +} + +func (r ListAllByDnsZoneOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListAllByDnsZoneOperationResponse) LoadMore(ctx context.Context) (resp ListAllByDnsZoneOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListAllByDnsZoneOperationOptions struct { + Recordsetnamesuffix *string + Top *int64 +} + +func DefaultListAllByDnsZoneOperationOptions() ListAllByDnsZoneOperationOptions { + return ListAllByDnsZoneOperationOptions{} +} + +func (o ListAllByDnsZoneOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListAllByDnsZoneOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Recordsetnamesuffix != nil { + out["$recordsetnamesuffix"] = *o.Recordsetnamesuffix + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListAllByDnsZone ... +func (c RecordSetsClient) ListAllByDnsZone(ctx context.Context, id DnsZoneId, options ListAllByDnsZoneOperationOptions) (resp ListAllByDnsZoneOperationResponse, err error) { + req, err := c.preparerForListAllByDnsZone(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListAllByDnsZone", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListAllByDnsZone", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListAllByDnsZone(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListAllByDnsZone", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListAllByDnsZone prepares the ListAllByDnsZone request. +func (c RecordSetsClient) preparerForListAllByDnsZone(ctx context.Context, id DnsZoneId, options ListAllByDnsZoneOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/all", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListAllByDnsZoneWithNextLink prepares the ListAllByDnsZone request with the given nextLink token. +func (c RecordSetsClient) preparerForListAllByDnsZoneWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListAllByDnsZone handles the response to the ListAllByDnsZone request. The method always +// closes the http.Response Body. +func (c RecordSetsClient) responderForListAllByDnsZone(resp *http.Response) (result ListAllByDnsZoneOperationResponse, err error) { + type page struct { + Values []RecordSet `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListAllByDnsZoneOperationResponse, err error) { + req, err := c.preparerForListAllByDnsZoneWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListAllByDnsZone", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListAllByDnsZone", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListAllByDnsZone(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListAllByDnsZone", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListAllByDnsZoneComplete retrieves all of the results into a single object +func (c RecordSetsClient) ListAllByDnsZoneComplete(ctx context.Context, id DnsZoneId, options ListAllByDnsZoneOperationOptions) (ListAllByDnsZoneCompleteResult, error) { + return c.ListAllByDnsZoneCompleteMatchingPredicate(ctx, id, options, RecordSetOperationPredicate{}) +} + +// ListAllByDnsZoneCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RecordSetsClient) ListAllByDnsZoneCompleteMatchingPredicate(ctx context.Context, id DnsZoneId, options ListAllByDnsZoneOperationOptions, predicate RecordSetOperationPredicate) (resp ListAllByDnsZoneCompleteResult, err error) { + items := make([]RecordSet, 0) + + page, err := c.ListAllByDnsZone(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListAllByDnsZoneCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_listbydnszone_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_listbydnszone_autorest.go new file mode 100644 index 00000000000..b369625fedc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_listbydnszone_autorest.go @@ -0,0 +1,220 @@ +package recordsets + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByDnsZoneOperationResponse struct { + HttpResponse *http.Response + Model *[]RecordSet + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByDnsZoneOperationResponse, error) +} + +type ListByDnsZoneCompleteResult struct { + Items []RecordSet +} + +func (r ListByDnsZoneOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByDnsZoneOperationResponse) LoadMore(ctx context.Context) (resp ListByDnsZoneOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByDnsZoneOperationOptions struct { + Recordsetnamesuffix *string + Top *int64 +} + +func DefaultListByDnsZoneOperationOptions() ListByDnsZoneOperationOptions { + return ListByDnsZoneOperationOptions{} +} + +func (o ListByDnsZoneOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByDnsZoneOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Recordsetnamesuffix != nil { + out["$recordsetnamesuffix"] = *o.Recordsetnamesuffix + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListByDnsZone ... +func (c RecordSetsClient) ListByDnsZone(ctx context.Context, id DnsZoneId, options ListByDnsZoneOperationOptions) (resp ListByDnsZoneOperationResponse, err error) { + req, err := c.preparerForListByDnsZone(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByDnsZone", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByDnsZone", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByDnsZone(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByDnsZone", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByDnsZone prepares the ListByDnsZone request. +func (c RecordSetsClient) preparerForListByDnsZone(ctx context.Context, id DnsZoneId, options ListByDnsZoneOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/recordsets", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByDnsZoneWithNextLink prepares the ListByDnsZone request with the given nextLink token. +func (c RecordSetsClient) preparerForListByDnsZoneWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByDnsZone handles the response to the ListByDnsZone request. The method always +// closes the http.Response Body. +func (c RecordSetsClient) responderForListByDnsZone(resp *http.Response) (result ListByDnsZoneOperationResponse, err error) { + type page struct { + Values []RecordSet `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByDnsZoneOperationResponse, err error) { + req, err := c.preparerForListByDnsZoneWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByDnsZone", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByDnsZone", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByDnsZone(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByDnsZone", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByDnsZoneComplete retrieves all of the results into a single object +func (c RecordSetsClient) ListByDnsZoneComplete(ctx context.Context, id DnsZoneId, options ListByDnsZoneOperationOptions) (ListByDnsZoneCompleteResult, error) { + return c.ListByDnsZoneCompleteMatchingPredicate(ctx, id, options, RecordSetOperationPredicate{}) +} + +// ListByDnsZoneCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RecordSetsClient) ListByDnsZoneCompleteMatchingPredicate(ctx context.Context, id DnsZoneId, options ListByDnsZoneOperationOptions, predicate RecordSetOperationPredicate) (resp ListByDnsZoneCompleteResult, err error) { + items := make([]RecordSet, 0) + + page, err := c.ListByDnsZone(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByDnsZoneCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_listbytype_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_listbytype_autorest.go new file mode 100644 index 00000000000..50ced26d8e1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_listbytype_autorest.go @@ -0,0 +1,220 @@ +package recordsets + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByTypeOperationResponse struct { + HttpResponse *http.Response + Model *[]RecordSet + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByTypeOperationResponse, error) +} + +type ListByTypeCompleteResult struct { + Items []RecordSet +} + +func (r ListByTypeOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByTypeOperationResponse) LoadMore(ctx context.Context) (resp ListByTypeOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByTypeOperationOptions struct { + Recordsetnamesuffix *string + Top *int64 +} + +func DefaultListByTypeOperationOptions() ListByTypeOperationOptions { + return ListByTypeOperationOptions{} +} + +func (o ListByTypeOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByTypeOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Recordsetnamesuffix != nil { + out["$recordsetnamesuffix"] = *o.Recordsetnamesuffix + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListByType ... +func (c RecordSetsClient) ListByType(ctx context.Context, id ZoneId, options ListByTypeOperationOptions) (resp ListByTypeOperationResponse, err error) { + req, err := c.preparerForListByType(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByType(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByType prepares the ListByType request. +func (c RecordSetsClient) preparerForListByType(ctx context.Context, id ZoneId, options ListByTypeOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByTypeWithNextLink prepares the ListByType request with the given nextLink token. +func (c RecordSetsClient) preparerForListByTypeWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByType handles the response to the ListByType request. The method always +// closes the http.Response Body. +func (c RecordSetsClient) responderForListByType(resp *http.Response) (result ListByTypeOperationResponse, err error) { + type page struct { + Values []RecordSet `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByTypeOperationResponse, err error) { + req, err := c.preparerForListByTypeWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByType(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByTypeComplete retrieves all of the results into a single object +func (c RecordSetsClient) ListByTypeComplete(ctx context.Context, id ZoneId, options ListByTypeOperationOptions) (ListByTypeCompleteResult, error) { + return c.ListByTypeCompleteMatchingPredicate(ctx, id, options, RecordSetOperationPredicate{}) +} + +// ListByTypeCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RecordSetsClient) ListByTypeCompleteMatchingPredicate(ctx context.Context, id ZoneId, options ListByTypeOperationOptions, predicate RecordSetOperationPredicate) (resp ListByTypeCompleteResult, err error) { + items := make([]RecordSet, 0) + + page, err := c.ListByType(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByTypeCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_update_autorest.go new file mode 100644 index 00000000000..2fac5ae4042 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/method_update_autorest.go @@ -0,0 +1,98 @@ +package recordsets + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *RecordSet +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Update ... +func (c RecordSetsClient) Update(ctx context.Context, id RecordTypeId, input RecordSet, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c RecordSetsClient) preparerForUpdate(ctx context.Context, id RecordTypeId, input RecordSet, options UpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c RecordSetsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_aaaarecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_aaaarecord.go new file mode 100644 index 00000000000..ab849f34d41 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_aaaarecord.go @@ -0,0 +1,8 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AaaaRecord struct { + IPv6Address *string `json:"ipv6Address,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_arecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_arecord.go new file mode 100644 index 00000000000..878b5d761d5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_arecord.go @@ -0,0 +1,8 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ARecord struct { + IPv4Address *string `json:"ipv4Address,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_caarecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_caarecord.go new file mode 100644 index 00000000000..5ed36722ae2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_caarecord.go @@ -0,0 +1,10 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CaaRecord struct { + Flags *int64 `json:"flags,omitempty"` + Tag *string `json:"tag,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_cnamerecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_cnamerecord.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_cnamerecord.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_cnamerecord.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_mxrecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_mxrecord.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_mxrecord.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_mxrecord.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_nsrecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_nsrecord.go new file mode 100644 index 00000000000..e8ecb9f9ef4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_nsrecord.go @@ -0,0 +1,8 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NsRecord struct { + Nsdname *string `json:"nsdname,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_ptrrecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_ptrrecord.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_ptrrecord.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_ptrrecord.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_recordset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_recordset.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_recordset.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_recordset.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_recordsetproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_recordsetproperties.go new file mode 100644 index 00000000000..a02004816a2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_recordsetproperties.go @@ -0,0 +1,22 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecordSetProperties struct { + AAAARecords *[]AaaaRecord `json:"AAAARecords,omitempty"` + ARecords *[]ARecord `json:"ARecords,omitempty"` + CNAMERecord *CnameRecord `json:"CNAMERecord,omitempty"` + CaaRecords *[]CaaRecord `json:"caaRecords,omitempty"` + Fqdn *string `json:"fqdn,omitempty"` + MXRecords *[]MxRecord `json:"MXRecords,omitempty"` + Metadata *map[string]string `json:"metadata,omitempty"` + NSRecords *[]NsRecord `json:"NSRecords,omitempty"` + PTRRecords *[]PtrRecord `json:"PTRRecords,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + SOARecord *SoaRecord `json:"SOARecord,omitempty"` + SRVRecords *[]SrvRecord `json:"SRVRecords,omitempty"` + TTL *int64 `json:"TTL,omitempty"` + TXTRecords *[]TxtRecord `json:"TXTRecords,omitempty"` + TargetResource *SubResource `json:"targetResource,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_soarecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_soarecord.go new file mode 100644 index 00000000000..973b2929c37 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_soarecord.go @@ -0,0 +1,14 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SoaRecord struct { + Email *string `json:"email,omitempty"` + ExpireTime *int64 `json:"expireTime,omitempty"` + Host *string `json:"host,omitempty"` + MinimumTTL *int64 `json:"minimumTTL,omitempty"` + RefreshTime *int64 `json:"refreshTime,omitempty"` + RetryTime *int64 `json:"retryTime,omitempty"` + SerialNumber *int64 `json:"serialNumber,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_srvrecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_srvrecord.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_srvrecord.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_srvrecord.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_subresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_subresource.go new file mode 100644 index 00000000000..8e480245b50 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_subresource.go @@ -0,0 +1,8 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_txtrecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_txtrecord.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_txtrecord.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/model_txtrecord.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/predicates.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/predicates.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/predicates.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/version.go new file mode 100644 index 00000000000..691500e2007 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets/version.go @@ -0,0 +1,12 @@ +package recordsets + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/recordsets/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/README.md new file mode 100644 index 00000000000..3fad79a0b70 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/README.md @@ -0,0 +1,124 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones` Documentation + +The `zones` SDK allows for interaction with the Azure Resource Manager Service `dns` (API Version `2018-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones" +``` + + +### Client Initialization + +```go +client := zones.NewZonesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ZonesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue") + +payload := zones.Zone{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, zones.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ZonesClient.Delete` + +```go +ctx := context.TODO() +id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue") + +if err := client.DeleteThenPoll(ctx, id, zones.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `ZonesClient.Get` + +```go +ctx := context.TODO() +id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ZonesClient.List` + +```go +ctx := context.TODO() +id := zones.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id, zones.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, zones.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ZonesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := zones.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id, zones.DefaultListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id, zones.DefaultListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ZonesClient.Update` + +```go +ctx := context.TODO() +id := zones.NewDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "zoneValue") + +payload := zones.ZoneUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload, zones.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/client.go new file mode 100644 index 00000000000..e36c39abb89 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/client.go @@ -0,0 +1,18 @@ +package zones + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ZonesClient struct { + Client autorest.Client + baseUri string +} + +func NewZonesClientWithBaseURI(endpoint string) ZonesClient { + return ZonesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/constants.go new file mode 100644 index 00000000000..6150a4c67b3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/constants.go @@ -0,0 +1,34 @@ +package zones + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ZoneType string + +const ( + ZoneTypePrivate ZoneType = "Private" + ZoneTypePublic ZoneType = "Public" +) + +func PossibleValuesForZoneType() []string { + return []string{ + string(ZoneTypePrivate), + string(ZoneTypePublic), + } +} + +func parseZoneType(input string) (*ZoneType, error) { + vals := map[string]ZoneType{ + "private": ZoneTypePrivate, + "public": ZoneTypePublic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ZoneType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/id_dnszone.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/id_dnszone.go new file mode 100644 index 00000000000..cde7778f9a2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/id_dnszone.go @@ -0,0 +1,124 @@ +package zones + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DnsZoneId{} + +// DnsZoneId is a struct representing the Resource ID for a Dns Zone +type DnsZoneId struct { + SubscriptionId string + ResourceGroupName string + ZoneName string +} + +// NewDnsZoneID returns a new DnsZoneId struct +func NewDnsZoneID(subscriptionId string, resourceGroupName string, zoneName string) DnsZoneId { + return DnsZoneId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ZoneName: zoneName, + } +} + +// ParseDnsZoneID parses 'input' into a DnsZoneId +func ParseDnsZoneID(input string) (*DnsZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(DnsZoneId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DnsZoneId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { + return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDnsZoneIDInsensitively parses 'input' case-insensitively into a DnsZoneId +// note: this method should only be used for API response data and not user input +func ParseDnsZoneIDInsensitively(input string) (*DnsZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(DnsZoneId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DnsZoneId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ZoneName, ok = parsed.Parsed["zoneName"]; !ok { + return nil, fmt.Errorf("the segment 'zoneName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDnsZoneID checks that 'input' can be parsed as a Dns Zone ID +func ValidateDnsZoneID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDnsZoneID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Dns Zone ID +func (id DnsZoneId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnsZones/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ZoneName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Dns Zone ID +func (id DnsZoneId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("staticDnsZones", "dnsZones", "dnsZones"), + resourceids.UserSpecifiedSegment("zoneName", "zoneValue"), + } +} + +// String returns a human-readable description of this Dns Zone ID +func (id DnsZoneId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Zone Name: %q", id.ZoneName), + } + return fmt.Sprintf("Dns Zone (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_createorupdate_autorest.go new file mode 100644 index 00000000000..9f756912c6d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_createorupdate_autorest.go @@ -0,0 +1,103 @@ +package zones + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Zone +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + if o.IfNoneMatch != nil { + out["If-None-Match"] = *o.IfNoneMatch + } + + return out +} + +func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// CreateOrUpdate ... +func (c ZonesClient) CreateOrUpdate(ctx context.Context, id DnsZoneId, input Zone, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ZonesClient) preparerForCreateOrUpdate(ctx context.Context, id DnsZoneId, input Zone, options CreateOrUpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ZonesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_delete_autorest.go new file mode 100644 index 00000000000..d28060357b0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_delete_autorest.go @@ -0,0 +1,107 @@ +package zones + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Delete ... +func (c ZonesClient) Delete(ctx context.Context, id DnsZoneId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ZonesClient) DeleteThenPoll(ctx context.Context, id DnsZoneId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ZonesClient) preparerForDelete(ctx context.Context, id DnsZoneId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ZonesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_get_autorest.go new file mode 100644 index 00000000000..b583472a3a8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_get_autorest.go @@ -0,0 +1,68 @@ +package zones + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Zone +} + +// Get ... +func (c ZonesClient) Get(ctx context.Context, id DnsZoneId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ZonesClient) preparerForGet(ctx context.Context, id DnsZoneId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ZonesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_list_autorest.go new file mode 100644 index 00000000000..d20a35acdde --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_list_autorest.go @@ -0,0 +1,216 @@ +package zones + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Zone + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Zone +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c ZonesClient) List(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c ZonesClient) preparerForList(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/dnszones", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c ZonesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ZonesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Zone `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c ZonesClient) ListComplete(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, ZoneOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ZonesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions, predicate ZoneOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Zone, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..0e7ce808b01 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_listbyresourcegroup_autorest.go @@ -0,0 +1,216 @@ +package zones + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Zone + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Zone +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByResourceGroupOperationOptions struct { + Top *int64 +} + +func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { + return ListByResourceGroupOperationOptions{} +} + +func (o ListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListByResourceGroup ... +func (c ZonesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ZonesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/dnsZones", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c ZonesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ZonesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Zone `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c ZonesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, ZoneOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ZonesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate ZoneOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Zone, 0) + + page, err := c.ListByResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_update_autorest.go new file mode 100644 index 00000000000..6f013c7352a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/method_update_autorest.go @@ -0,0 +1,98 @@ +package zones + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Zone +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Update ... +func (c ZonesClient) Update(ctx context.Context, id DnsZoneId, input ZoneUpdate, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "zones.ZonesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ZonesClient) preparerForUpdate(ctx context.Context, id DnsZoneId, input ZoneUpdate, options UpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ZonesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/model_subresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/model_subresource.go new file mode 100644 index 00000000000..325bcfb56e5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/model_subresource.go @@ -0,0 +1,8 @@ +package zones + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/model_zone.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/model_zone.go new file mode 100644 index 00000000000..1d423222770 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/model_zone.go @@ -0,0 +1,14 @@ +package zones + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Zone struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ZoneProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/model_zoneproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/model_zoneproperties.go new file mode 100644 index 00000000000..f1c8b2e780e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/model_zoneproperties.go @@ -0,0 +1,14 @@ +package zones + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ZoneProperties struct { + MaxNumberOfRecordSets *int64 `json:"maxNumberOfRecordSets,omitempty"` + MaxNumberOfRecordsPerRecordSet *int64 `json:"maxNumberOfRecordsPerRecordSet,omitempty"` + NameServers *[]string `json:"nameServers,omitempty"` + NumberOfRecordSets *int64 `json:"numberOfRecordSets,omitempty"` + RegistrationVirtualNetworks *[]SubResource `json:"registrationVirtualNetworks,omitempty"` + ResolutionVirtualNetworks *[]SubResource `json:"resolutionVirtualNetworks,omitempty"` + ZoneType *ZoneType `json:"zoneType,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/model_zoneupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/model_zoneupdate.go new file mode 100644 index 00000000000..6cfc17369a7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/model_zoneupdate.go @@ -0,0 +1,8 @@ +package zones + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ZoneUpdate struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/predicates.go new file mode 100644 index 00000000000..1254cb7e830 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/predicates.go @@ -0,0 +1,34 @@ +package zones + +type ZoneOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p ZoneOperationPredicate) Matches(input Zone) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/version.go new file mode 100644 index 00000000000..97c17a20e3a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones/version.go @@ -0,0 +1,12 @@ +package zones + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/zones/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/README.md new file mode 100644 index 00000000000..4dae764c4f7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/README.md @@ -0,0 +1,120 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource` Documentation + +The `monitorsresource` SDK allows for interaction with the Azure Resource Manager Service `elastic` (API Version `2020-07-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource" +``` + + +### Client Initialization + +```go +client := monitorsresource.NewMonitorsResourceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `MonitorsResourceClient.MonitorsCreate` + +```go +ctx := context.TODO() +id := monitorsresource.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +payload := monitorsresource.ElasticMonitorResource{ + // ... +} + + +if err := client.MonitorsCreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `MonitorsResourceClient.MonitorsDelete` + +```go +ctx := context.TODO() +id := monitorsresource.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +if err := client.MonitorsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `MonitorsResourceClient.MonitorsGet` + +```go +ctx := context.TODO() +id := monitorsresource.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +read, err := client.MonitorsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `MonitorsResourceClient.MonitorsList` + +```go +ctx := context.TODO() +id := monitorsresource.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.MonitorsList(ctx, id)` can be used to do batched pagination +items, err := client.MonitorsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `MonitorsResourceClient.MonitorsListByResourceGroup` + +```go +ctx := context.TODO() +id := monitorsresource.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.MonitorsListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.MonitorsListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `MonitorsResourceClient.MonitorsUpdate` + +```go +ctx := context.TODO() +id := monitorsresource.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +payload := monitorsresource.ElasticMonitorResourceUpdateParameters{ + // ... +} + + +read, err := client.MonitorsUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/client.go new file mode 100644 index 00000000000..48e2515201a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/client.go @@ -0,0 +1,18 @@ +package monitorsresource + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorsResourceClient struct { + Client autorest.Client + baseUri string +} + +func NewMonitorsResourceClientWithBaseURI(endpoint string) MonitorsResourceClient { + return MonitorsResourceClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/constants.go new file mode 100644 index 00000000000..1768ecfff8c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/constants.go @@ -0,0 +1,111 @@ +package monitorsresource + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LiftrResourceCategories string + +const ( + LiftrResourceCategoriesMonitorLogs LiftrResourceCategories = "MonitorLogs" + LiftrResourceCategoriesUnknown LiftrResourceCategories = "Unknown" +) + +func PossibleValuesForLiftrResourceCategories() []string { + return []string{ + string(LiftrResourceCategoriesMonitorLogs), + string(LiftrResourceCategoriesUnknown), + } +} + +func parseLiftrResourceCategories(input string) (*LiftrResourceCategories, error) { + vals := map[string]LiftrResourceCategories{ + "monitorlogs": LiftrResourceCategoriesMonitorLogs, + "unknown": LiftrResourceCategoriesUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LiftrResourceCategories(input) + return &out, nil +} + +type MonitoringStatus string + +const ( + MonitoringStatusDisabled MonitoringStatus = "Disabled" + MonitoringStatusEnabled MonitoringStatus = "Enabled" +) + +func PossibleValuesForMonitoringStatus() []string { + return []string{ + string(MonitoringStatusDisabled), + string(MonitoringStatusEnabled), + } +} + +func parseMonitoringStatus(input string) (*MonitoringStatus, error) { + vals := map[string]MonitoringStatus{ + "disabled": MonitoringStatusDisabled, + "enabled": MonitoringStatusEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MonitoringStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateNotSpecified), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "notspecified": ProvisioningStateNotSpecified, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/id_monitor.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/id_monitor.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/id_monitor.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/id_monitor.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorscreate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorscreate_autorest.go similarity index 91% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorscreate_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorscreate_autorest.go index 04bb8ab0d37..34ca7fcefd4 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorscreate_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorscreate_autorest.go @@ -10,6 +10,9 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type MonitorsCreateOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response @@ -70,6 +73,7 @@ func (c MonitorsResourceClient) senderForMonitorsCreate(ctx context.Context, req if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorsdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorsdelete_autorest.go similarity index 90% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorsdelete_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorsdelete_autorest.go index b9c96c57b73..8b68d78fe69 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorsdelete_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorsdelete_autorest.go @@ -10,6 +10,9 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type MonitorsDeleteOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response @@ -69,6 +72,7 @@ func (c MonitorsResourceClient) senderForMonitorsDelete(ctx context.Context, req if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorsget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorsget_autorest.go similarity index 93% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorsget_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorsget_autorest.go index a22b3884c40..e24124d2d38 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorsget_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorsget_autorest.go @@ -8,6 +8,9 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type MonitorsGetOperationResponse struct { HttpResponse *http.Response Model *ElasticMonitorResource @@ -60,5 +63,6 @@ func (c MonitorsResourceClient) responderForMonitorsGet(resp *http.Response) (re autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorslist_autorest.go similarity index 97% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorslist_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorslist_autorest.go index 4ed609fb494..858b88ba8b8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorslist_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorslist_autorest.go @@ -11,6 +11,9 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type MonitorsListOperationResponse struct { HttpResponse *http.Response Model *[]ElasticMonitorResource @@ -57,50 +60,6 @@ func (c MonitorsResourceClient) MonitorsList(ctx context.Context, id commonids.S return } -// MonitorsListComplete retrieves all of the results into a single object -func (c MonitorsResourceClient) MonitorsListComplete(ctx context.Context, id commonids.SubscriptionId) (MonitorsListCompleteResult, error) { - return c.MonitorsListCompleteMatchingPredicate(ctx, id, ElasticMonitorResourceOperationPredicate{}) -} - -// MonitorsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c MonitorsResourceClient) MonitorsListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ElasticMonitorResourceOperationPredicate) (resp MonitorsListCompleteResult, err error) { - items := make([]ElasticMonitorResource, 0) - - page, err := c.MonitorsList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := MonitorsListCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForMonitorsList prepares the MonitorsList request. func (c MonitorsResourceClient) preparerForMonitorsList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { queryParameters := map[string]interface{}{ @@ -182,3 +141,47 @@ func (c MonitorsResourceClient) responderForMonitorsList(resp *http.Response) (r } return } + +// MonitorsListComplete retrieves all of the results into a single object +func (c MonitorsResourceClient) MonitorsListComplete(ctx context.Context, id commonids.SubscriptionId) (MonitorsListCompleteResult, error) { + return c.MonitorsListCompleteMatchingPredicate(ctx, id, ElasticMonitorResourceOperationPredicate{}) +} + +// MonitorsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c MonitorsResourceClient) MonitorsListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ElasticMonitorResourceOperationPredicate) (resp MonitorsListCompleteResult, err error) { + items := make([]ElasticMonitorResource, 0) + + page, err := c.MonitorsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := MonitorsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorslistbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorslistbyresourcegroup_autorest.go similarity index 97% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorslistbyresourcegroup_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorslistbyresourcegroup_autorest.go index 6e6e6bfaaf4..016eb93dd56 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorslistbyresourcegroup_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorslistbyresourcegroup_autorest.go @@ -11,6 +11,9 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type MonitorsListByResourceGroupOperationResponse struct { HttpResponse *http.Response Model *[]ElasticMonitorResource @@ -57,50 +60,6 @@ func (c MonitorsResourceClient) MonitorsListByResourceGroup(ctx context.Context, return } -// MonitorsListByResourceGroupComplete retrieves all of the results into a single object -func (c MonitorsResourceClient) MonitorsListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (MonitorsListByResourceGroupCompleteResult, error) { - return c.MonitorsListByResourceGroupCompleteMatchingPredicate(ctx, id, ElasticMonitorResourceOperationPredicate{}) -} - -// MonitorsListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c MonitorsResourceClient) MonitorsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ElasticMonitorResourceOperationPredicate) (resp MonitorsListByResourceGroupCompleteResult, err error) { - items := make([]ElasticMonitorResource, 0) - - page, err := c.MonitorsListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := MonitorsListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForMonitorsListByResourceGroup prepares the MonitorsListByResourceGroup request. func (c MonitorsResourceClient) preparerForMonitorsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { queryParameters := map[string]interface{}{ @@ -182,3 +141,47 @@ func (c MonitorsResourceClient) responderForMonitorsListByResourceGroup(resp *ht } return } + +// MonitorsListByResourceGroupComplete retrieves all of the results into a single object +func (c MonitorsResourceClient) MonitorsListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (MonitorsListByResourceGroupCompleteResult, error) { + return c.MonitorsListByResourceGroupCompleteMatchingPredicate(ctx, id, ElasticMonitorResourceOperationPredicate{}) +} + +// MonitorsListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c MonitorsResourceClient) MonitorsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ElasticMonitorResourceOperationPredicate) (resp MonitorsListByResourceGroupCompleteResult, err error) { + items := make([]ElasticMonitorResource, 0) + + page, err := c.MonitorsListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := MonitorsListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorsupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorsupdate_autorest.go similarity index 93% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorsupdate_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorsupdate_autorest.go index c38b0dcd909..3c8ed0ecc66 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/method_monitorsupdate_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/method_monitorsupdate_autorest.go @@ -8,6 +8,9 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type MonitorsUpdateOperationResponse struct { HttpResponse *http.Response Model *ElasticMonitorResource @@ -61,5 +64,6 @@ func (c MonitorsResourceClient) responderForMonitorsUpdate(resp *http.Response) autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_companyinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_companyinfo.go new file mode 100644 index 00000000000..a486c966b99 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_companyinfo.go @@ -0,0 +1,12 @@ +package monitorsresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CompanyInfo struct { + Business *string `json:"business,omitempty"` + Country *string `json:"country,omitempty"` + Domain *string `json:"domain,omitempty"` + EmployeesNumber *string `json:"employeesNumber,omitempty"` + State *string `json:"state,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_elasticclouddeployment.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_elasticclouddeployment.go similarity index 77% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_elasticclouddeployment.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_elasticclouddeployment.go index 389dd80a707..38ed50f276c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_elasticclouddeployment.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_elasticclouddeployment.go @@ -1,5 +1,8 @@ package monitorsresource +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ElasticCloudDeployment struct { AzureSubscriptionId *string `json:"azureSubscriptionId,omitempty"` DeploymentId *string `json:"deploymentId,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_elasticclouduser.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_elasticclouduser.go new file mode 100644 index 00000000000..245a8bf8826 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_elasticclouduser.go @@ -0,0 +1,10 @@ +package monitorsresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ElasticCloudUser struct { + ElasticCloudSsoDefaultUrl *string `json:"elasticCloudSsoDefaultUrl,omitempty"` + EmailAddress *string `json:"emailAddress,omitempty"` + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_elasticmonitorresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_elasticmonitorresource.go new file mode 100644 index 00000000000..302cb150abf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_elasticmonitorresource.go @@ -0,0 +1,21 @@ +package monitorsresource + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ElasticMonitorResource struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *MonitorProperties `json:"properties,omitempty"` + Sku *ResourceSku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_elasticmonitorresourceupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_elasticmonitorresourceupdateparameters.go new file mode 100644 index 00000000000..06c9a228676 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_elasticmonitorresourceupdateparameters.go @@ -0,0 +1,8 @@ +package monitorsresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ElasticMonitorResourceUpdateParameters struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_elasticproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_elasticproperties.go new file mode 100644 index 00000000000..4225f8adaef --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_elasticproperties.go @@ -0,0 +1,9 @@ +package monitorsresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ElasticProperties struct { + ElasticCloudDeployment *ElasticCloudDeployment `json:"elasticCloudDeployment,omitempty"` + ElasticCloudUser *ElasticCloudUser `json:"elasticCloudUser,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_monitorproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_monitorproperties.go similarity index 78% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_monitorproperties.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_monitorproperties.go index 513e2f5e2f4..df774353d76 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_monitorproperties.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_monitorproperties.go @@ -1,5 +1,8 @@ package monitorsresource +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type MonitorProperties struct { ElasticProperties *ElasticProperties `json:"elasticProperties,omitempty"` LiftrResourceCategory *LiftrResourceCategories `json:"liftrResourceCategory,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_resourcesku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_resourcesku.go new file mode 100644 index 00000000000..9344eedf068 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_resourcesku.go @@ -0,0 +1,8 @@ +package monitorsresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSku struct { + Name string `json:"name"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_userinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_userinfo.go new file mode 100644 index 00000000000..362273fe28f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/model_userinfo.go @@ -0,0 +1,12 @@ +package monitorsresource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInfo struct { + CompanyInfo *CompanyInfo `json:"companyInfo,omitempty"` + CompanyName *string `json:"companyName,omitempty"` + EmailAddress *string `json:"emailAddress,omitempty"` + FirstName *string `json:"firstName,omitempty"` + LastName *string `json:"lastName,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/predicates.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/predicates.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/predicates.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/version.go new file mode 100644 index 00000000000..ae558229874 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource/version.go @@ -0,0 +1,12 @@ +package monitorsresource + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-07-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/monitorsresource/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/README.md new file mode 100644 index 00000000000..5de2943dc50 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/README.md @@ -0,0 +1,86 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules` Documentation + +The `rules` SDK allows for interaction with the Azure Resource Manager Service `elastic` (API Version `2020-07-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules" +``` + + +### Client Initialization + +```go +client := rules.NewRulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RulesClient.TagRulesCreateOrUpdate` + +```go +ctx := context.TODO() +id := rules.NewTagRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "ruleSetValue") + +payload := rules.MonitoringTagRules{ + // ... +} + + +read, err := client.TagRulesCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RulesClient.TagRulesDelete` + +```go +ctx := context.TODO() +id := rules.NewTagRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "ruleSetValue") + +if err := client.TagRulesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RulesClient.TagRulesGet` + +```go +ctx := context.TODO() +id := rules.NewTagRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue", "ruleSetValue") + +read, err := client.TagRulesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RulesClient.TagRulesList` + +```go +ctx := context.TODO() +id := rules.NewMonitorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "monitorValue") + +// alternatively `client.TagRulesList(ctx, id)` can be used to do batched pagination +items, err := client.TagRulesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/client.go new file mode 100644 index 00000000000..7e1e300eef3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/client.go @@ -0,0 +1,18 @@ +package rules + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RulesClient struct { + Client autorest.Client + baseUri string +} + +func NewRulesClientWithBaseURI(endpoint string) RulesClient { + return RulesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/constants.go new file mode 100644 index 00000000000..84ef6717b84 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/constants.go @@ -0,0 +1,83 @@ +package rules + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateNotSpecified), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "notspecified": ProvisioningStateNotSpecified, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type TagAction string + +const ( + TagActionExclude TagAction = "Exclude" + TagActionInclude TagAction = "Include" +) + +func PossibleValuesForTagAction() []string { + return []string{ + string(TagActionExclude), + string(TagActionInclude), + } +} + +func parseTagAction(input string) (*TagAction, error) { + vals := map[string]TagAction{ + "exclude": TagActionExclude, + "include": TagActionInclude, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TagAction(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/id_monitor.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/id_monitor.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/id_monitor.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/id_monitor.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/id_tagrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/id_tagrule.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/id_tagrule.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/id_tagrule.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/method_tagrulescreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/method_tagrulescreateorupdate_autorest.go similarity index 93% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/method_tagrulescreateorupdate_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/method_tagrulescreateorupdate_autorest.go index 5b198ff510a..04fa47ada9d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/method_tagrulescreateorupdate_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/method_tagrulescreateorupdate_autorest.go @@ -8,6 +8,9 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type TagRulesCreateOrUpdateOperationResponse struct { HttpResponse *http.Response Model *MonitoringTagRules @@ -61,5 +64,6 @@ func (c RulesClient) responderForTagRulesCreateOrUpdate(resp *http.Response) (re autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/method_tagrulesdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/method_tagrulesdelete_autorest.go similarity index 90% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/method_tagrulesdelete_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/method_tagrulesdelete_autorest.go index 3eea0efaf57..e2125f74e17 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/method_tagrulesdelete_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/method_tagrulesdelete_autorest.go @@ -10,6 +10,9 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type TagRulesDeleteOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response @@ -69,6 +72,7 @@ func (c RulesClient) senderForTagRulesDelete(ctx context.Context, req *http.Requ if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/method_tagrulesget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/method_tagrulesget_autorest.go similarity index 92% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/method_tagrulesget_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/method_tagrulesget_autorest.go index 71b8d21a9df..379e59b6c8e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/method_tagrulesget_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/method_tagrulesget_autorest.go @@ -8,6 +8,9 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type TagRulesGetOperationResponse struct { HttpResponse *http.Response Model *MonitoringTagRules @@ -60,5 +63,6 @@ func (c RulesClient) responderForTagRulesGet(resp *http.Response) (result TagRul autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/method_tagruleslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/method_tagruleslist_autorest.go similarity index 97% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/method_tagruleslist_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/method_tagruleslist_autorest.go index 87771469524..6f2cbc36fc4 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/method_tagruleslist_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/method_tagruleslist_autorest.go @@ -10,6 +10,9 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type TagRulesListOperationResponse struct { HttpResponse *http.Response Model *[]MonitoringTagRules @@ -56,50 +59,6 @@ func (c RulesClient) TagRulesList(ctx context.Context, id MonitorId) (resp TagRu return } -// TagRulesListComplete retrieves all of the results into a single object -func (c RulesClient) TagRulesListComplete(ctx context.Context, id MonitorId) (TagRulesListCompleteResult, error) { - return c.TagRulesListCompleteMatchingPredicate(ctx, id, MonitoringTagRulesOperationPredicate{}) -} - -// TagRulesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c RulesClient) TagRulesListCompleteMatchingPredicate(ctx context.Context, id MonitorId, predicate MonitoringTagRulesOperationPredicate) (resp TagRulesListCompleteResult, err error) { - items := make([]MonitoringTagRules, 0) - - page, err := c.TagRulesList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := TagRulesListCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForTagRulesList prepares the TagRulesList request. func (c RulesClient) preparerForTagRulesList(ctx context.Context, id MonitorId) (*http.Request, error) { queryParameters := map[string]interface{}{ @@ -181,3 +140,47 @@ func (c RulesClient) responderForTagRulesList(resp *http.Response) (result TagRu } return } + +// TagRulesListComplete retrieves all of the results into a single object +func (c RulesClient) TagRulesListComplete(ctx context.Context, id MonitorId) (TagRulesListCompleteResult, error) { + return c.TagRulesListCompleteMatchingPredicate(ctx, id, MonitoringTagRulesOperationPredicate{}) +} + +// TagRulesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RulesClient) TagRulesListCompleteMatchingPredicate(ctx context.Context, id MonitorId, predicate MonitoringTagRulesOperationPredicate) (resp TagRulesListCompleteResult, err error) { + items := make([]MonitoringTagRules, 0) + + page, err := c.TagRulesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := TagRulesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/model_filteringtag.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/model_filteringtag.go new file mode 100644 index 00000000000..e3a860d7a44 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/model_filteringtag.go @@ -0,0 +1,10 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FilteringTag struct { + Action *TagAction `json:"action,omitempty"` + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/model_logrules.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/model_logrules.go new file mode 100644 index 00000000000..06b16330cb8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/model_logrules.go @@ -0,0 +1,11 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogRules struct { + FilteringTags *[]FilteringTag `json:"filteringTags,omitempty"` + SendAadLogs *bool `json:"sendAadLogs,omitempty"` + SendActivityLogs *bool `json:"sendActivityLogs,omitempty"` + SendSubscriptionLogs *bool `json:"sendSubscriptionLogs,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/model_monitoringtagrules.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/model_monitoringtagrules.go new file mode 100644 index 00000000000..fa5d3787584 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/model_monitoringtagrules.go @@ -0,0 +1,16 @@ +package rules + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoringTagRules struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *MonitoringTagRulesProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/model_monitoringtagrulesproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/model_monitoringtagrulesproperties.go new file mode 100644 index 00000000000..fb6369f8e45 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/model_monitoringtagrulesproperties.go @@ -0,0 +1,9 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoringTagRulesProperties struct { + LogRules *LogRules `json:"logRules,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/predicates.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/predicates.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/predicates.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/version.go new file mode 100644 index 00000000000..247a18d849b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules/version.go @@ -0,0 +1,12 @@ +package rules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-07-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/rules/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/README.md new file mode 100644 index 00000000000..af56440ddcf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/README.md @@ -0,0 +1,95 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs` Documentation + +The `authorizationruleseventhubs` SDK allows for interaction with the Azure Resource Manager Service `eventhub` (API Version `2021-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs" +``` + + +### Client Initialization + +```go +client := authorizationruleseventhubs.NewAuthorizationRulesEventHubsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AuthorizationRulesEventHubsClient.EventHubsCreateOrUpdateAuthorizationRule` + +```go +ctx := context.TODO() +id := authorizationruleseventhubs.NewEventhubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "authorizationRuleValue") + +payload := authorizationruleseventhubs.AuthorizationRule{ + // ... +} + + +read, err := client.EventHubsCreateOrUpdateAuthorizationRule(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AuthorizationRulesEventHubsClient.EventHubsListAuthorizationRules` + +```go +ctx := context.TODO() +id := authorizationruleseventhubs.NewEventhubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue") + +// alternatively `client.EventHubsListAuthorizationRules(ctx, id)` can be used to do batched pagination +items, err := client.EventHubsListAuthorizationRulesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AuthorizationRulesEventHubsClient.EventHubsListKeys` + +```go +ctx := context.TODO() +id := authorizationruleseventhubs.NewEventhubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "authorizationRuleValue") + +read, err := client.EventHubsListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AuthorizationRulesEventHubsClient.EventHubsRegenerateKeys` + +```go +ctx := context.TODO() +id := authorizationruleseventhubs.NewEventhubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "authorizationRuleValue") + +payload := authorizationruleseventhubs.RegenerateAccessKeyParameters{ + // ... +} + + +read, err := client.EventHubsRegenerateKeys(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/client.go new file mode 100644 index 00000000000..904950f0cca --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/client.go @@ -0,0 +1,18 @@ +package authorizationruleseventhubs + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationRulesEventHubsClient struct { + Client autorest.Client + baseUri string +} + +func NewAuthorizationRulesEventHubsClientWithBaseURI(endpoint string) AuthorizationRulesEventHubsClient { + return AuthorizationRulesEventHubsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/constants.go new file mode 100644 index 00000000000..8ad03472120 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/constants.go @@ -0,0 +1,65 @@ +package authorizationruleseventhubs + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessRights string + +const ( + AccessRightsListen AccessRights = "Listen" + AccessRightsManage AccessRights = "Manage" + AccessRightsSend AccessRights = "Send" +) + +func PossibleValuesForAccessRights() []string { + return []string{ + string(AccessRightsListen), + string(AccessRightsManage), + string(AccessRightsSend), + } +} + +func parseAccessRights(input string) (*AccessRights, error) { + vals := map[string]AccessRights{ + "listen": AccessRightsListen, + "manage": AccessRightsManage, + "send": AccessRightsSend, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessRights(input) + return &out, nil +} + +type KeyType string + +const ( + KeyTypePrimaryKey KeyType = "PrimaryKey" + KeyTypeSecondaryKey KeyType = "SecondaryKey" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypePrimaryKey), + string(KeyTypeSecondaryKey), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "primarykey": KeyTypePrimaryKey, + "secondarykey": KeyTypeSecondaryKey, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/id_eventhub.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhub.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/id_eventhub.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhub.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/method_eventhubscreateorupdateauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/method_eventhubscreateorupdateauthorizationrule_autorest.go similarity index 88% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/method_eventhubscreateorupdateauthorizationrule_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/method_eventhubscreateorupdateauthorizationrule_autorest.go index c9fac8e5afe..246ae80cbbf 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/method_eventhubscreateorupdateauthorizationrule_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/method_eventhubscreateorupdateauthorizationrule_autorest.go @@ -8,13 +8,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type EventHubsCreateOrUpdateAuthorizationRuleResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventHubsCreateOrUpdateAuthorizationRuleOperationResponse struct { HttpResponse *http.Response Model *AuthorizationRule } // EventHubsCreateOrUpdateAuthorizationRule ... -func (c AuthorizationRulesEventHubsClient) EventHubsCreateOrUpdateAuthorizationRule(ctx context.Context, id EventhubAuthorizationRuleId, input AuthorizationRule) (result EventHubsCreateOrUpdateAuthorizationRuleResponse, err error) { +func (c AuthorizationRulesEventHubsClient) EventHubsCreateOrUpdateAuthorizationRule(ctx context.Context, id EventhubAuthorizationRuleId, input AuthorizationRule) (result EventHubsCreateOrUpdateAuthorizationRuleOperationResponse, err error) { req, err := c.preparerForEventHubsCreateOrUpdateAuthorizationRule(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "authorizationruleseventhubs.AuthorizationRulesEventHubsClient", "EventHubsCreateOrUpdateAuthorizationRule", nil, "Failure preparing request") @@ -54,12 +57,13 @@ func (c AuthorizationRulesEventHubsClient) preparerForEventHubsCreateOrUpdateAut // responderForEventHubsCreateOrUpdateAuthorizationRule handles the response to the EventHubsCreateOrUpdateAuthorizationRule request. The method always // closes the http.Response Body. -func (c AuthorizationRulesEventHubsClient) responderForEventHubsCreateOrUpdateAuthorizationRule(resp *http.Response) (result EventHubsCreateOrUpdateAuthorizationRuleResponse, err error) { +func (c AuthorizationRulesEventHubsClient) responderForEventHubsCreateOrUpdateAuthorizationRule(resp *http.Response) (result EventHubsCreateOrUpdateAuthorizationRuleOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/method_eventhubslistauthorizationrules_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/method_eventhubslistauthorizationrules_autorest.go similarity index 87% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/method_eventhubslistauthorizationrules_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/method_eventhubslistauthorizationrules_autorest.go index e4e5954c8f1..85e47a98578 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/method_eventhubslistauthorizationrules_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/method_eventhubslistauthorizationrules_autorest.go @@ -10,23 +10,26 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type EventHubsListAuthorizationRulesResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventHubsListAuthorizationRulesOperationResponse struct { HttpResponse *http.Response Model *[]AuthorizationRule nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (EventHubsListAuthorizationRulesResponse, error) + nextPageFunc func(ctx context.Context, nextLink string) (EventHubsListAuthorizationRulesOperationResponse, error) } type EventHubsListAuthorizationRulesCompleteResult struct { Items []AuthorizationRule } -func (r EventHubsListAuthorizationRulesResponse) HasMore() bool { +func (r EventHubsListAuthorizationRulesOperationResponse) HasMore() bool { return r.nextLink != nil } -func (r EventHubsListAuthorizationRulesResponse) LoadMore(ctx context.Context) (resp EventHubsListAuthorizationRulesResponse, err error) { +func (r EventHubsListAuthorizationRulesOperationResponse) LoadMore(ctx context.Context) (resp EventHubsListAuthorizationRulesOperationResponse, err error) { if !r.HasMore() { err = fmt.Errorf("no more pages returned") return @@ -35,7 +38,7 @@ func (r EventHubsListAuthorizationRulesResponse) LoadMore(ctx context.Context) ( } // EventHubsListAuthorizationRules ... -func (c AuthorizationRulesEventHubsClient) EventHubsListAuthorizationRules(ctx context.Context, id EventhubId) (resp EventHubsListAuthorizationRulesResponse, err error) { +func (c AuthorizationRulesEventHubsClient) EventHubsListAuthorizationRules(ctx context.Context, id EventhubId) (resp EventHubsListAuthorizationRulesOperationResponse, err error) { req, err := c.preparerForEventHubsListAuthorizationRules(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "authorizationruleseventhubs.AuthorizationRulesEventHubsClient", "EventHubsListAuthorizationRules", nil, "Failure preparing request") @@ -56,50 +59,6 @@ func (c AuthorizationRulesEventHubsClient) EventHubsListAuthorizationRules(ctx c return } -// EventHubsListAuthorizationRulesComplete retrieves all of the results into a single object -func (c AuthorizationRulesEventHubsClient) EventHubsListAuthorizationRulesComplete(ctx context.Context, id EventhubId) (EventHubsListAuthorizationRulesCompleteResult, error) { - return c.EventHubsListAuthorizationRulesCompleteMatchingPredicate(ctx, id, AuthorizationRulePredicate{}) -} - -// EventHubsListAuthorizationRulesCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AuthorizationRulesEventHubsClient) EventHubsListAuthorizationRulesCompleteMatchingPredicate(ctx context.Context, id EventhubId, predicate AuthorizationRulePredicate) (resp EventHubsListAuthorizationRulesCompleteResult, err error) { - items := make([]AuthorizationRule, 0) - - page, err := c.EventHubsListAuthorizationRules(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := EventHubsListAuthorizationRulesCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForEventHubsListAuthorizationRules prepares the EventHubsListAuthorizationRules request. func (c AuthorizationRulesEventHubsClient) preparerForEventHubsListAuthorizationRules(ctx context.Context, id EventhubId) (*http.Request, error) { queryParameters := map[string]interface{}{ @@ -142,7 +101,7 @@ func (c AuthorizationRulesEventHubsClient) preparerForEventHubsListAuthorization // responderForEventHubsListAuthorizationRules handles the response to the EventHubsListAuthorizationRules request. The method always // closes the http.Response Body. -func (c AuthorizationRulesEventHubsClient) responderForEventHubsListAuthorizationRules(resp *http.Response) (result EventHubsListAuthorizationRulesResponse, err error) { +func (c AuthorizationRulesEventHubsClient) responderForEventHubsListAuthorizationRules(resp *http.Response) (result EventHubsListAuthorizationRulesOperationResponse, err error) { type page struct { Values []AuthorizationRule `json:"value"` NextLink *string `json:"nextLink"` @@ -157,7 +116,7 @@ func (c AuthorizationRulesEventHubsClient) responderForEventHubsListAuthorizatio result.Model = &respObj.Values result.nextLink = respObj.NextLink if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result EventHubsListAuthorizationRulesResponse, err error) { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result EventHubsListAuthorizationRulesOperationResponse, err error) { req, err := c.preparerForEventHubsListAuthorizationRulesWithNextLink(ctx, nextLink) if err != nil { err = autorest.NewErrorWithError(err, "authorizationruleseventhubs.AuthorizationRulesEventHubsClient", "EventHubsListAuthorizationRules", nil, "Failure preparing request") @@ -181,3 +140,47 @@ func (c AuthorizationRulesEventHubsClient) responderForEventHubsListAuthorizatio } return } + +// EventHubsListAuthorizationRulesComplete retrieves all of the results into a single object +func (c AuthorizationRulesEventHubsClient) EventHubsListAuthorizationRulesComplete(ctx context.Context, id EventhubId) (EventHubsListAuthorizationRulesCompleteResult, error) { + return c.EventHubsListAuthorizationRulesCompleteMatchingPredicate(ctx, id, AuthorizationRuleOperationPredicate{}) +} + +// EventHubsListAuthorizationRulesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AuthorizationRulesEventHubsClient) EventHubsListAuthorizationRulesCompleteMatchingPredicate(ctx context.Context, id EventhubId, predicate AuthorizationRuleOperationPredicate) (resp EventHubsListAuthorizationRulesCompleteResult, err error) { + items := make([]AuthorizationRule, 0) + + page, err := c.EventHubsListAuthorizationRules(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := EventHubsListAuthorizationRulesCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/method_eventhubslistkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/method_eventhubslistkeys_autorest.go similarity index 86% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/method_eventhubslistkeys_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/method_eventhubslistkeys_autorest.go index 0034654c017..be331950d87 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/method_eventhubslistkeys_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/method_eventhubslistkeys_autorest.go @@ -9,13 +9,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type EventHubsListKeysResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventHubsListKeysOperationResponse struct { HttpResponse *http.Response Model *AccessKeys } // EventHubsListKeys ... -func (c AuthorizationRulesEventHubsClient) EventHubsListKeys(ctx context.Context, id EventhubAuthorizationRuleId) (result EventHubsListKeysResponse, err error) { +func (c AuthorizationRulesEventHubsClient) EventHubsListKeys(ctx context.Context, id EventhubAuthorizationRuleId) (result EventHubsListKeysOperationResponse, err error) { req, err := c.preparerForEventHubsListKeys(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "authorizationruleseventhubs.AuthorizationRulesEventHubsClient", "EventHubsListKeys", nil, "Failure preparing request") @@ -54,12 +57,13 @@ func (c AuthorizationRulesEventHubsClient) preparerForEventHubsListKeys(ctx cont // responderForEventHubsListKeys handles the response to the EventHubsListKeys request. The method always // closes the http.Response Body. -func (c AuthorizationRulesEventHubsClient) responderForEventHubsListKeys(resp *http.Response) (result EventHubsListKeysResponse, err error) { +func (c AuthorizationRulesEventHubsClient) responderForEventHubsListKeys(resp *http.Response) (result EventHubsListKeysOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/method_eventhubsregeneratekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/method_eventhubsregeneratekeys_autorest.go similarity index 87% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/method_eventhubsregeneratekeys_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/method_eventhubsregeneratekeys_autorest.go index 167331b93b5..1e7b6a258ff 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/method_eventhubsregeneratekeys_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/method_eventhubsregeneratekeys_autorest.go @@ -9,13 +9,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type EventHubsRegenerateKeysResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventHubsRegenerateKeysOperationResponse struct { HttpResponse *http.Response Model *AccessKeys } // EventHubsRegenerateKeys ... -func (c AuthorizationRulesEventHubsClient) EventHubsRegenerateKeys(ctx context.Context, id EventhubAuthorizationRuleId, input RegenerateAccessKeyParameters) (result EventHubsRegenerateKeysResponse, err error) { +func (c AuthorizationRulesEventHubsClient) EventHubsRegenerateKeys(ctx context.Context, id EventhubAuthorizationRuleId, input RegenerateAccessKeyParameters) (result EventHubsRegenerateKeysOperationResponse, err error) { req, err := c.preparerForEventHubsRegenerateKeys(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "authorizationruleseventhubs.AuthorizationRulesEventHubsClient", "EventHubsRegenerateKeys", nil, "Failure preparing request") @@ -55,12 +58,13 @@ func (c AuthorizationRulesEventHubsClient) preparerForEventHubsRegenerateKeys(ct // responderForEventHubsRegenerateKeys handles the response to the EventHubsRegenerateKeys request. The method always // closes the http.Response Body. -func (c AuthorizationRulesEventHubsClient) responderForEventHubsRegenerateKeys(resp *http.Response) (result EventHubsRegenerateKeysResponse, err error) { +func (c AuthorizationRulesEventHubsClient) responderForEventHubsRegenerateKeys(resp *http.Response) (result EventHubsRegenerateKeysOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/model_accesskeys.go new file mode 100644 index 00000000000..fc22fc746d3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/model_accesskeys.go @@ -0,0 +1,14 @@ +package authorizationruleseventhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeys struct { + AliasPrimaryConnectionString *string `json:"aliasPrimaryConnectionString,omitempty"` + AliasSecondaryConnectionString *string `json:"aliasSecondaryConnectionString,omitempty"` + KeyName *string `json:"keyName,omitempty"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/model_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/model_authorizationrule.go new file mode 100644 index 00000000000..89ec3ee6132 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/model_authorizationrule.go @@ -0,0 +1,17 @@ +package authorizationruleseventhubs + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationRule struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AuthorizationRuleProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/model_authorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/model_authorizationruleproperties.go new file mode 100644 index 00000000000..afbfae90d04 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/model_authorizationruleproperties.go @@ -0,0 +1,8 @@ +package authorizationruleseventhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationRuleProperties struct { + Rights []AccessRights `json:"rights"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/model_regenerateaccesskeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/model_regenerateaccesskeyparameters.go new file mode 100644 index 00000000000..0e6cffdfe71 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/model_regenerateaccesskeyparameters.go @@ -0,0 +1,9 @@ +package authorizationruleseventhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateAccessKeyParameters struct { + Key *string `json:"key,omitempty"` + KeyType KeyType `json:"keyType"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/predicates.go new file mode 100644 index 00000000000..dd4d10bf370 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/predicates.go @@ -0,0 +1,29 @@ +package authorizationruleseventhubs + +type AuthorizationRuleOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p AuthorizationRuleOperationPredicate) Matches(input AuthorizationRule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/version.go new file mode 100644 index 00000000000..1cc434f71c1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/version.go @@ -0,0 +1,12 @@ +package authorizationruleseventhubs + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/authorizationruleseventhubs/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/README.md new file mode 100644 index 00000000000..b3e9317162f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces` Documentation + +The `authorizationrulesnamespaces` SDK allows for interaction with the Azure Resource Manager Service `eventhub` (API Version `2021-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces" +``` + + +### Client Initialization + +```go +client := authorizationrulesnamespaces.NewAuthorizationRulesNamespacesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AuthorizationRulesNamespacesClient.NamespacesCreateOrUpdateAuthorizationRule` + +```go +ctx := context.TODO() +id := authorizationrulesnamespaces.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +payload := authorizationrulesnamespaces.AuthorizationRule{ + // ... +} + + +read, err := client.NamespacesCreateOrUpdateAuthorizationRule(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AuthorizationRulesNamespacesClient.NamespacesDeleteAuthorizationRule` + +```go +ctx := context.TODO() +id := authorizationrulesnamespaces.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +read, err := client.NamespacesDeleteAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AuthorizationRulesNamespacesClient.NamespacesGetAuthorizationRule` + +```go +ctx := context.TODO() +id := authorizationrulesnamespaces.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +read, err := client.NamespacesGetAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AuthorizationRulesNamespacesClient.NamespacesListAuthorizationRules` + +```go +ctx := context.TODO() +id := authorizationrulesnamespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +// alternatively `client.NamespacesListAuthorizationRules(ctx, id)` can be used to do batched pagination +items, err := client.NamespacesListAuthorizationRulesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AuthorizationRulesNamespacesClient.NamespacesListKeys` + +```go +ctx := context.TODO() +id := authorizationrulesnamespaces.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +read, err := client.NamespacesListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AuthorizationRulesNamespacesClient.NamespacesRegenerateKeys` + +```go +ctx := context.TODO() +id := authorizationrulesnamespaces.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +payload := authorizationrulesnamespaces.RegenerateAccessKeyParameters{ + // ... +} + + +read, err := client.NamespacesRegenerateKeys(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/client.go new file mode 100644 index 00000000000..17b3b9be9e2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/client.go @@ -0,0 +1,18 @@ +package authorizationrulesnamespaces + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationRulesNamespacesClient struct { + Client autorest.Client + baseUri string +} + +func NewAuthorizationRulesNamespacesClientWithBaseURI(endpoint string) AuthorizationRulesNamespacesClient { + return AuthorizationRulesNamespacesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/constants.go new file mode 100644 index 00000000000..a4bb8d8c677 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/constants.go @@ -0,0 +1,65 @@ +package authorizationrulesnamespaces + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessRights string + +const ( + AccessRightsListen AccessRights = "Listen" + AccessRightsManage AccessRights = "Manage" + AccessRightsSend AccessRights = "Send" +) + +func PossibleValuesForAccessRights() []string { + return []string{ + string(AccessRightsListen), + string(AccessRightsManage), + string(AccessRightsSend), + } +} + +func parseAccessRights(input string) (*AccessRights, error) { + vals := map[string]AccessRights{ + "listen": AccessRightsListen, + "manage": AccessRightsManage, + "send": AccessRightsSend, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessRights(input) + return &out, nil +} + +type KeyType string + +const ( + KeyTypePrimaryKey KeyType = "PrimaryKey" + KeyTypeSecondaryKey KeyType = "SecondaryKey" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypePrimaryKey), + string(KeyTypeSecondaryKey), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "primarykey": KeyTypePrimaryKey, + "secondarykey": KeyTypeSecondaryKey, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/id_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/id_authorizationrule.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/id_authorizationrule.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/id_authorizationrule.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/id_namespace.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/id_namespace.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/id_namespace.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespacescreateorupdateauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespacescreateorupdateauthorizationrule_autorest.go new file mode 100644 index 00000000000..26d47b98379 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespacescreateorupdateauthorizationrule_autorest.go @@ -0,0 +1,69 @@ +package authorizationrulesnamespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesCreateOrUpdateAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *AuthorizationRule +} + +// NamespacesCreateOrUpdateAuthorizationRule ... +func (c AuthorizationRulesNamespacesClient) NamespacesCreateOrUpdateAuthorizationRule(ctx context.Context, id AuthorizationRuleId, input AuthorizationRule) (result NamespacesCreateOrUpdateAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForNamespacesCreateOrUpdateAuthorizationRule(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesCreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesCreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForNamespacesCreateOrUpdateAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesCreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForNamespacesCreateOrUpdateAuthorizationRule prepares the NamespacesCreateOrUpdateAuthorizationRule request. +func (c AuthorizationRulesNamespacesClient) preparerForNamespacesCreateOrUpdateAuthorizationRule(ctx context.Context, id AuthorizationRuleId, input AuthorizationRule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForNamespacesCreateOrUpdateAuthorizationRule handles the response to the NamespacesCreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (c AuthorizationRulesNamespacesClient) responderForNamespacesCreateOrUpdateAuthorizationRule(resp *http.Response) (result NamespacesCreateOrUpdateAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespacesdeleteauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespacesdeleteauthorizationrule_autorest.go new file mode 100644 index 00000000000..cedc6d8a514 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespacesdeleteauthorizationrule_autorest.go @@ -0,0 +1,66 @@ +package authorizationrulesnamespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesDeleteAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response +} + +// NamespacesDeleteAuthorizationRule ... +func (c AuthorizationRulesNamespacesClient) NamespacesDeleteAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (result NamespacesDeleteAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForNamespacesDeleteAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesDeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesDeleteAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForNamespacesDeleteAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesDeleteAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForNamespacesDeleteAuthorizationRule prepares the NamespacesDeleteAuthorizationRule request. +func (c AuthorizationRulesNamespacesClient) preparerForNamespacesDeleteAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForNamespacesDeleteAuthorizationRule handles the response to the NamespacesDeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (c AuthorizationRulesNamespacesClient) responderForNamespacesDeleteAuthorizationRule(resp *http.Response) (result NamespacesDeleteAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespacesgetauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespacesgetauthorizationrule_autorest.go new file mode 100644 index 00000000000..7992eecc2d4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespacesgetauthorizationrule_autorest.go @@ -0,0 +1,68 @@ +package authorizationrulesnamespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesGetAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *AuthorizationRule +} + +// NamespacesGetAuthorizationRule ... +func (c AuthorizationRulesNamespacesClient) NamespacesGetAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (result NamespacesGetAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForNamespacesGetAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesGetAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesGetAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForNamespacesGetAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesGetAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForNamespacesGetAuthorizationRule prepares the NamespacesGetAuthorizationRule request. +func (c AuthorizationRulesNamespacesClient) preparerForNamespacesGetAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForNamespacesGetAuthorizationRule handles the response to the NamespacesGetAuthorizationRule request. The method always +// closes the http.Response Body. +func (c AuthorizationRulesNamespacesClient) responderForNamespacesGetAuthorizationRule(resp *http.Response) (result NamespacesGetAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespaceslistauthorizationrules_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespaceslistauthorizationrules_autorest.go new file mode 100644 index 00000000000..5dc47f95bc8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespaceslistauthorizationrules_autorest.go @@ -0,0 +1,186 @@ +package authorizationrulesnamespaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesListAuthorizationRulesOperationResponse struct { + HttpResponse *http.Response + Model *[]AuthorizationRule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (NamespacesListAuthorizationRulesOperationResponse, error) +} + +type NamespacesListAuthorizationRulesCompleteResult struct { + Items []AuthorizationRule +} + +func (r NamespacesListAuthorizationRulesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r NamespacesListAuthorizationRulesOperationResponse) LoadMore(ctx context.Context) (resp NamespacesListAuthorizationRulesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// NamespacesListAuthorizationRules ... +func (c AuthorizationRulesNamespacesClient) NamespacesListAuthorizationRules(ctx context.Context, id NamespaceId) (resp NamespacesListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForNamespacesListAuthorizationRules(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListAuthorizationRules", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForNamespacesListAuthorizationRules(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListAuthorizationRules", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForNamespacesListAuthorizationRules prepares the NamespacesListAuthorizationRules request. +func (c AuthorizationRulesNamespacesClient) preparerForNamespacesListAuthorizationRules(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/authorizationRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForNamespacesListAuthorizationRulesWithNextLink prepares the NamespacesListAuthorizationRules request with the given nextLink token. +func (c AuthorizationRulesNamespacesClient) preparerForNamespacesListAuthorizationRulesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForNamespacesListAuthorizationRules handles the response to the NamespacesListAuthorizationRules request. The method always +// closes the http.Response Body. +func (c AuthorizationRulesNamespacesClient) responderForNamespacesListAuthorizationRules(resp *http.Response) (result NamespacesListAuthorizationRulesOperationResponse, err error) { + type page struct { + Values []AuthorizationRule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result NamespacesListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForNamespacesListAuthorizationRulesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListAuthorizationRules", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListAuthorizationRules", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForNamespacesListAuthorizationRules(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListAuthorizationRules", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// NamespacesListAuthorizationRulesComplete retrieves all of the results into a single object +func (c AuthorizationRulesNamespacesClient) NamespacesListAuthorizationRulesComplete(ctx context.Context, id NamespaceId) (NamespacesListAuthorizationRulesCompleteResult, error) { + return c.NamespacesListAuthorizationRulesCompleteMatchingPredicate(ctx, id, AuthorizationRuleOperationPredicate{}) +} + +// NamespacesListAuthorizationRulesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AuthorizationRulesNamespacesClient) NamespacesListAuthorizationRulesCompleteMatchingPredicate(ctx context.Context, id NamespaceId, predicate AuthorizationRuleOperationPredicate) (resp NamespacesListAuthorizationRulesCompleteResult, err error) { + items := make([]AuthorizationRule, 0) + + page, err := c.NamespacesListAuthorizationRules(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := NamespacesListAuthorizationRulesCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespaceslistkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespaceslistkeys_autorest.go new file mode 100644 index 00000000000..4fb0cdaad52 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespaceslistkeys_autorest.go @@ -0,0 +1,69 @@ +package authorizationrulesnamespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesListKeysOperationResponse struct { + HttpResponse *http.Response + Model *AccessKeys +} + +// NamespacesListKeys ... +func (c AuthorizationRulesNamespacesClient) NamespacesListKeys(ctx context.Context, id AuthorizationRuleId) (result NamespacesListKeysOperationResponse, err error) { + req, err := c.preparerForNamespacesListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForNamespacesListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForNamespacesListKeys prepares the NamespacesListKeys request. +func (c AuthorizationRulesNamespacesClient) preparerForNamespacesListKeys(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForNamespacesListKeys handles the response to the NamespacesListKeys request. The method always +// closes the http.Response Body. +func (c AuthorizationRulesNamespacesClient) responderForNamespacesListKeys(resp *http.Response) (result NamespacesListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespacesregeneratekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespacesregeneratekeys_autorest.go new file mode 100644 index 00000000000..00818363d71 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/method_namespacesregeneratekeys_autorest.go @@ -0,0 +1,70 @@ +package authorizationrulesnamespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesRegenerateKeysOperationResponse struct { + HttpResponse *http.Response + Model *AccessKeys +} + +// NamespacesRegenerateKeys ... +func (c AuthorizationRulesNamespacesClient) NamespacesRegenerateKeys(ctx context.Context, id AuthorizationRuleId, input RegenerateAccessKeyParameters) (result NamespacesRegenerateKeysOperationResponse, err error) { + req, err := c.preparerForNamespacesRegenerateKeys(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesRegenerateKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesRegenerateKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForNamespacesRegenerateKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesRegenerateKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForNamespacesRegenerateKeys prepares the NamespacesRegenerateKeys request. +func (c AuthorizationRulesNamespacesClient) preparerForNamespacesRegenerateKeys(ctx context.Context, id AuthorizationRuleId, input RegenerateAccessKeyParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKeys", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForNamespacesRegenerateKeys handles the response to the NamespacesRegenerateKeys request. The method always +// closes the http.Response Body. +func (c AuthorizationRulesNamespacesClient) responderForNamespacesRegenerateKeys(resp *http.Response) (result NamespacesRegenerateKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/model_accesskeys.go new file mode 100644 index 00000000000..fc776819235 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/model_accesskeys.go @@ -0,0 +1,14 @@ +package authorizationrulesnamespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeys struct { + AliasPrimaryConnectionString *string `json:"aliasPrimaryConnectionString,omitempty"` + AliasSecondaryConnectionString *string `json:"aliasSecondaryConnectionString,omitempty"` + KeyName *string `json:"keyName,omitempty"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/model_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/model_authorizationrule.go new file mode 100644 index 00000000000..e1a084cb7f9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/model_authorizationrule.go @@ -0,0 +1,17 @@ +package authorizationrulesnamespaces + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationRule struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AuthorizationRuleProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/model_authorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/model_authorizationruleproperties.go new file mode 100644 index 00000000000..100fb1ca6be --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/model_authorizationruleproperties.go @@ -0,0 +1,8 @@ +package authorizationrulesnamespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationRuleProperties struct { + Rights []AccessRights `json:"rights"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/model_regenerateaccesskeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/model_regenerateaccesskeyparameters.go new file mode 100644 index 00000000000..121a8261f31 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/model_regenerateaccesskeyparameters.go @@ -0,0 +1,9 @@ +package authorizationrulesnamespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateAccessKeyParameters struct { + Key *string `json:"key,omitempty"` + KeyType KeyType `json:"keyType"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/predicates.go new file mode 100644 index 00000000000..b8661da88d2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/predicates.go @@ -0,0 +1,29 @@ +package authorizationrulesnamespaces + +type AuthorizationRuleOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p AuthorizationRuleOperationPredicate) Matches(input AuthorizationRule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/version.go new file mode 100644 index 00000000000..5e1f0bd26e3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/version.go @@ -0,0 +1,12 @@ +package authorizationrulesnamespaces + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/authorizationrulesnamespaces/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/README.md new file mode 100644 index 00000000000..68e31c8b719 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/README.md @@ -0,0 +1,41 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs` Documentation + +The `checknameavailabilitydisasterrecoveryconfigs` SDK allows for interaction with the Azure Resource Manager Service `eventhub` (API Version `2021-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs" +``` + + +### Client Initialization + +```go +client := checknameavailabilitydisasterrecoveryconfigs.NewCheckNameAvailabilityDisasterRecoveryConfigsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CheckNameAvailabilityDisasterRecoveryConfigsClient.DisasterRecoveryConfigsCheckNameAvailability` + +```go +ctx := context.TODO() +id := checknameavailabilitydisasterrecoveryconfigs.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +payload := checknameavailabilitydisasterrecoveryconfigs.CheckNameAvailabilityParameter{ + // ... +} + + +read, err := client.DisasterRecoveryConfigsCheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/client.go new file mode 100644 index 00000000000..fcec870182a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/client.go @@ -0,0 +1,18 @@ +package checknameavailabilitydisasterrecoveryconfigs + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityDisasterRecoveryConfigsClient struct { + Client autorest.Client + baseUri string +} + +func NewCheckNameAvailabilityDisasterRecoveryConfigsClientWithBaseURI(endpoint string) CheckNameAvailabilityDisasterRecoveryConfigsClient { + return CheckNameAvailabilityDisasterRecoveryConfigsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/constants.go new file mode 100644 index 00000000000..e8bcdcb6ce6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/constants.go @@ -0,0 +1,46 @@ +package checknameavailabilitydisasterrecoveryconfigs + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UnavailableReason string + +const ( + UnavailableReasonInvalidName UnavailableReason = "InvalidName" + UnavailableReasonNameInLockdown UnavailableReason = "NameInLockdown" + UnavailableReasonNameInUse UnavailableReason = "NameInUse" + UnavailableReasonNone UnavailableReason = "None" + UnavailableReasonSubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" + UnavailableReasonTooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" +) + +func PossibleValuesForUnavailableReason() []string { + return []string{ + string(UnavailableReasonInvalidName), + string(UnavailableReasonNameInLockdown), + string(UnavailableReasonNameInUse), + string(UnavailableReasonNone), + string(UnavailableReasonSubscriptionIsDisabled), + string(UnavailableReasonTooManyNamespaceInCurrentSubscription), + } +} + +func parseUnavailableReason(input string) (*UnavailableReason, error) { + vals := map[string]UnavailableReason{ + "invalidname": UnavailableReasonInvalidName, + "nameinlockdown": UnavailableReasonNameInLockdown, + "nameinuse": UnavailableReasonNameInUse, + "none": UnavailableReasonNone, + "subscriptionisdisabled": UnavailableReasonSubscriptionIsDisabled, + "toomanynamespaceincurrentsubscription": UnavailableReasonTooManyNamespaceInCurrentSubscription, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UnavailableReason(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/method_disasterrecoveryconfigschecknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/method_disasterrecoveryconfigschecknameavailability_autorest.go similarity index 87% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/method_disasterrecoveryconfigschecknameavailability_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/method_disasterrecoveryconfigschecknameavailability_autorest.go index 4e8131e227e..7a81d6ab4fe 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/method_disasterrecoveryconfigschecknameavailability_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/method_disasterrecoveryconfigschecknameavailability_autorest.go @@ -9,13 +9,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type DisasterRecoveryConfigsCheckNameAvailabilityResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DisasterRecoveryConfigsCheckNameAvailabilityOperationResponse struct { HttpResponse *http.Response Model *CheckNameAvailabilityResult } // DisasterRecoveryConfigsCheckNameAvailability ... -func (c CheckNameAvailabilityDisasterRecoveryConfigsClient) DisasterRecoveryConfigsCheckNameAvailability(ctx context.Context, id NamespaceId, input CheckNameAvailabilityParameter) (result DisasterRecoveryConfigsCheckNameAvailabilityResponse, err error) { +func (c CheckNameAvailabilityDisasterRecoveryConfigsClient) DisasterRecoveryConfigsCheckNameAvailability(ctx context.Context, id NamespaceId, input CheckNameAvailabilityParameter) (result DisasterRecoveryConfigsCheckNameAvailabilityOperationResponse, err error) { req, err := c.preparerForDisasterRecoveryConfigsCheckNameAvailability(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "checknameavailabilitydisasterrecoveryconfigs.CheckNameAvailabilityDisasterRecoveryConfigsClient", "DisasterRecoveryConfigsCheckNameAvailability", nil, "Failure preparing request") @@ -55,12 +58,13 @@ func (c CheckNameAvailabilityDisasterRecoveryConfigsClient) preparerForDisasterR // responderForDisasterRecoveryConfigsCheckNameAvailability handles the response to the DisasterRecoveryConfigsCheckNameAvailability request. The method always // closes the http.Response Body. -func (c CheckNameAvailabilityDisasterRecoveryConfigsClient) responderForDisasterRecoveryConfigsCheckNameAvailability(resp *http.Response) (result DisasterRecoveryConfigsCheckNameAvailabilityResponse, err error) { +func (c CheckNameAvailabilityDisasterRecoveryConfigsClient) responderForDisasterRecoveryConfigsCheckNameAvailability(resp *http.Response) (result DisasterRecoveryConfigsCheckNameAvailabilityOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/model_checknameavailabilityparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/model_checknameavailabilityparameter.go new file mode 100644 index 00000000000..b1b7b4d1ada --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/model_checknameavailabilityparameter.go @@ -0,0 +1,8 @@ +package checknameavailabilitydisasterrecoveryconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityParameter struct { + Name string `json:"name"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/model_checknameavailabilityresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/model_checknameavailabilityresult.go new file mode 100644 index 00000000000..37fc7df5f14 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/model_checknameavailabilityresult.go @@ -0,0 +1,10 @@ +package checknameavailabilitydisasterrecoveryconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityResult struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *UnavailableReason `json:"reason,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/version.go new file mode 100644 index 00000000000..091375ae905 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/version.go @@ -0,0 +1,12 @@ +package checknameavailabilitydisasterrecoveryconfigs + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/checknameavailabilitydisasterrecoveryconfigs/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/README.md new file mode 100644 index 00000000000..645874f172a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups` Documentation + +The `consumergroups` SDK allows for interaction with the Azure Resource Manager Service `eventhub` (API Version `2021-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups" +``` + + +### Client Initialization + +```go +client := consumergroups.NewConsumerGroupsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ConsumerGroupsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := consumergroups.NewConsumerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "consumerGroupValue") + +payload := consumergroups.ConsumerGroup{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConsumerGroupsClient.Delete` + +```go +ctx := context.TODO() +id := consumergroups.NewConsumerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "consumerGroupValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConsumerGroupsClient.Get` + +```go +ctx := context.TODO() +id := consumergroups.NewConsumerGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "consumerGroupValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConsumerGroupsClient.ListByEventHub` + +```go +ctx := context.TODO() +id := consumergroups.NewEventhubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue") + +// alternatively `client.ListByEventHub(ctx, id, consumergroups.DefaultListByEventHubOperationOptions())` can be used to do batched pagination +items, err := client.ListByEventHubComplete(ctx, id, consumergroups.DefaultListByEventHubOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/client.go new file mode 100644 index 00000000000..980852cd6a0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/client.go @@ -0,0 +1,18 @@ +package consumergroups + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConsumerGroupsClient struct { + Client autorest.Client + baseUri string +} + +func NewConsumerGroupsClientWithBaseURI(endpoint string) ConsumerGroupsClient { + return ConsumerGroupsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/id_consumergroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/id_consumergroup.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/id_consumergroup.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/id_consumergroup.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/id_eventhub.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/id_eventhub.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/id_eventhub.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/id_eventhub.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/method_createorupdate_autorest.go new file mode 100644 index 00000000000..43f39ac5dfc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package consumergroups + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *ConsumerGroup +} + +// CreateOrUpdate ... +func (c ConsumerGroupsClient) CreateOrUpdate(ctx context.Context, id ConsumerGroupId, input ConsumerGroup) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ConsumerGroupsClient) preparerForCreateOrUpdate(ctx context.Context, id ConsumerGroupId, input ConsumerGroup) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ConsumerGroupsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/method_delete_autorest.go new file mode 100644 index 00000000000..9e2dc076805 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/method_delete_autorest.go @@ -0,0 +1,66 @@ +package consumergroups + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ConsumerGroupsClient) Delete(ctx context.Context, id ConsumerGroupId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ConsumerGroupsClient) preparerForDelete(ctx context.Context, id ConsumerGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ConsumerGroupsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/method_get_autorest.go new file mode 100644 index 00000000000..60079102863 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/method_get_autorest.go @@ -0,0 +1,68 @@ +package consumergroups + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ConsumerGroup +} + +// Get ... +func (c ConsumerGroupsClient) Get(ctx context.Context, id ConsumerGroupId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ConsumerGroupsClient) preparerForGet(ctx context.Context, id ConsumerGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ConsumerGroupsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/method_listbyeventhub_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/method_listbyeventhub_autorest.go similarity index 79% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/method_listbyeventhub_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/method_listbyeventhub_autorest.go index a40f0396620..0e63e820bc2 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/method_listbyeventhub_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/method_listbyeventhub_autorest.go @@ -10,23 +10,26 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type ListByEventHubResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByEventHubOperationResponse struct { HttpResponse *http.Response Model *[]ConsumerGroup nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByEventHubResponse, error) + nextPageFunc func(ctx context.Context, nextLink string) (ListByEventHubOperationResponse, error) } type ListByEventHubCompleteResult struct { Items []ConsumerGroup } -func (r ListByEventHubResponse) HasMore() bool { +func (r ListByEventHubOperationResponse) HasMore() bool { return r.nextLink != nil } -func (r ListByEventHubResponse) LoadMore(ctx context.Context) (resp ListByEventHubResponse, err error) { +func (r ListByEventHubOperationResponse) LoadMore(ctx context.Context) (resp ListByEventHubOperationResponse, err error) { if !r.HasMore() { err = fmt.Errorf("no more pages returned") return @@ -34,16 +37,22 @@ func (r ListByEventHubResponse) LoadMore(ctx context.Context) (resp ListByEventH return r.nextPageFunc(ctx, *r.nextLink) } -type ListByEventHubOptions struct { +type ListByEventHubOperationOptions struct { Skip *int64 Top *int64 } -func DefaultListByEventHubOptions() ListByEventHubOptions { - return ListByEventHubOptions{} +func DefaultListByEventHubOperationOptions() ListByEventHubOperationOptions { + return ListByEventHubOperationOptions{} +} + +func (o ListByEventHubOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out } -func (o ListByEventHubOptions) toQueryString() map[string]interface{} { +func (o ListByEventHubOperationOptions) toQueryString() map[string]interface{} { out := make(map[string]interface{}) if o.Skip != nil { @@ -58,7 +67,7 @@ func (o ListByEventHubOptions) toQueryString() map[string]interface{} { } // ListByEventHub ... -func (c ConsumerGroupsClient) ListByEventHub(ctx context.Context, id EventhubId, options ListByEventHubOptions) (resp ListByEventHubResponse, err error) { +func (c ConsumerGroupsClient) ListByEventHub(ctx context.Context, id EventhubId, options ListByEventHubOperationOptions) (resp ListByEventHubOperationResponse, err error) { req, err := c.preparerForListByEventHub(ctx, id, options) if err != nil { err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "ListByEventHub", nil, "Failure preparing request") @@ -79,52 +88,8 @@ func (c ConsumerGroupsClient) ListByEventHub(ctx context.Context, id EventhubId, return } -// ListByEventHubComplete retrieves all of the results into a single object -func (c ConsumerGroupsClient) ListByEventHubComplete(ctx context.Context, id EventhubId, options ListByEventHubOptions) (ListByEventHubCompleteResult, error) { - return c.ListByEventHubCompleteMatchingPredicate(ctx, id, options, ConsumerGroupPredicate{}) -} - -// ListByEventHubCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ConsumerGroupsClient) ListByEventHubCompleteMatchingPredicate(ctx context.Context, id EventhubId, options ListByEventHubOptions, predicate ConsumerGroupPredicate) (resp ListByEventHubCompleteResult, err error) { - items := make([]ConsumerGroup, 0) - - page, err := c.ListByEventHub(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByEventHubCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForListByEventHub prepares the ListByEventHub request. -func (c ConsumerGroupsClient) preparerForListByEventHub(ctx context.Context, id EventhubId, options ListByEventHubOptions) (*http.Request, error) { +func (c ConsumerGroupsClient) preparerForListByEventHub(ctx context.Context, id EventhubId, options ListByEventHubOperationOptions) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -137,6 +102,7 @@ func (c ConsumerGroupsClient) preparerForListByEventHub(ctx context.Context, id autorest.AsContentType("application/json; charset=utf-8"), autorest.AsGet(), autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), autorest.WithPath(fmt.Sprintf("%s/consumerGroups", id.ID())), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) @@ -169,7 +135,7 @@ func (c ConsumerGroupsClient) preparerForListByEventHubWithNextLink(ctx context. // responderForListByEventHub handles the response to the ListByEventHub request. The method always // closes the http.Response Body. -func (c ConsumerGroupsClient) responderForListByEventHub(resp *http.Response) (result ListByEventHubResponse, err error) { +func (c ConsumerGroupsClient) responderForListByEventHub(resp *http.Response) (result ListByEventHubOperationResponse, err error) { type page struct { Values []ConsumerGroup `json:"value"` NextLink *string `json:"nextLink"` @@ -184,7 +150,7 @@ func (c ConsumerGroupsClient) responderForListByEventHub(resp *http.Response) (r result.Model = &respObj.Values result.nextLink = respObj.NextLink if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByEventHubResponse, err error) { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByEventHubOperationResponse, err error) { req, err := c.preparerForListByEventHubWithNextLink(ctx, nextLink) if err != nil { err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "ListByEventHub", nil, "Failure preparing request") @@ -208,3 +174,47 @@ func (c ConsumerGroupsClient) responderForListByEventHub(resp *http.Response) (r } return } + +// ListByEventHubComplete retrieves all of the results into a single object +func (c ConsumerGroupsClient) ListByEventHubComplete(ctx context.Context, id EventhubId, options ListByEventHubOperationOptions) (ListByEventHubCompleteResult, error) { + return c.ListByEventHubCompleteMatchingPredicate(ctx, id, options, ConsumerGroupOperationPredicate{}) +} + +// ListByEventHubCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ConsumerGroupsClient) ListByEventHubCompleteMatchingPredicate(ctx context.Context, id EventhubId, options ListByEventHubOperationOptions, predicate ConsumerGroupOperationPredicate) (resp ListByEventHubCompleteResult, err error) { + items := make([]ConsumerGroup, 0) + + page, err := c.ListByEventHub(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByEventHubCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/model_consumergroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/model_consumergroup.go new file mode 100644 index 00000000000..18a5d2f9400 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/model_consumergroup.go @@ -0,0 +1,17 @@ +package consumergroups + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConsumerGroup struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ConsumerGroupProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/model_consumergroupproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/model_consumergroupproperties.go new file mode 100644 index 00000000000..f34d76ca78d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/model_consumergroupproperties.go @@ -0,0 +1,40 @@ +package consumergroups + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConsumerGroupProperties struct { + CreatedAt *string `json:"createdAt,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` + UserMetadata *string `json:"userMetadata,omitempty"` +} + +func (o *ConsumerGroupProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *ConsumerGroupProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *ConsumerGroupProperties) GetUpdatedAtAsTime() (*time.Time, error) { + if o.UpdatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpdatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *ConsumerGroupProperties) SetUpdatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpdatedAt = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/predicates.go new file mode 100644 index 00000000000..23761a13475 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/predicates.go @@ -0,0 +1,29 @@ +package consumergroups + +type ConsumerGroupOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ConsumerGroupOperationPredicate) Matches(input ConsumerGroup) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/version.go new file mode 100644 index 00000000000..5451c285311 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups/version.go @@ -0,0 +1,12 @@ +package consumergroups + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/consumergroups/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/README.md new file mode 100644 index 00000000000..e66d26198b6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/README.md @@ -0,0 +1,122 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs` Documentation + +The `disasterrecoveryconfigs` SDK allows for interaction with the Azure Resource Manager Service `eventhub` (API Version `2021-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs" +``` + + +### Client Initialization + +```go +client := disasterrecoveryconfigs.NewDisasterRecoveryConfigsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.BreakPairing` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") + +read, err := client.BreakPairing(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") + +payload := disasterrecoveryconfigs.ArmDisasterRecovery{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.Delete` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.FailOver` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") + +read, err := client.FailOver(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.Get` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.List` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/client.go new file mode 100644 index 00000000000..92bd0f75168 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/client.go @@ -0,0 +1,18 @@ +package disasterrecoveryconfigs + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DisasterRecoveryConfigsClient struct { + Client autorest.Client + baseUri string +} + +func NewDisasterRecoveryConfigsClientWithBaseURI(endpoint string) DisasterRecoveryConfigsClient { + return DisasterRecoveryConfigsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/constants.go new file mode 100644 index 00000000000..8c8c6ff74d2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/constants.go @@ -0,0 +1,68 @@ +package disasterrecoveryconfigs + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningStateDR string + +const ( + ProvisioningStateDRAccepted ProvisioningStateDR = "Accepted" + ProvisioningStateDRFailed ProvisioningStateDR = "Failed" + ProvisioningStateDRSucceeded ProvisioningStateDR = "Succeeded" +) + +func PossibleValuesForProvisioningStateDR() []string { + return []string{ + string(ProvisioningStateDRAccepted), + string(ProvisioningStateDRFailed), + string(ProvisioningStateDRSucceeded), + } +} + +func parseProvisioningStateDR(input string) (*ProvisioningStateDR, error) { + vals := map[string]ProvisioningStateDR{ + "accepted": ProvisioningStateDRAccepted, + "failed": ProvisioningStateDRFailed, + "succeeded": ProvisioningStateDRSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningStateDR(input) + return &out, nil +} + +type RoleDisasterRecovery string + +const ( + RoleDisasterRecoveryPrimary RoleDisasterRecovery = "Primary" + RoleDisasterRecoveryPrimaryNotReplicating RoleDisasterRecovery = "PrimaryNotReplicating" + RoleDisasterRecoverySecondary RoleDisasterRecovery = "Secondary" +) + +func PossibleValuesForRoleDisasterRecovery() []string { + return []string{ + string(RoleDisasterRecoveryPrimary), + string(RoleDisasterRecoveryPrimaryNotReplicating), + string(RoleDisasterRecoverySecondary), + } +} + +func parseRoleDisasterRecovery(input string) (*RoleDisasterRecovery, error) { + vals := map[string]RoleDisasterRecovery{ + "primary": RoleDisasterRecoveryPrimary, + "primarynotreplicating": RoleDisasterRecoveryPrimaryNotReplicating, + "secondary": RoleDisasterRecoverySecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RoleDisasterRecovery(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_namespace.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/id_namespace.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_namespace.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_breakpairing_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_breakpairing_autorest.go new file mode 100644 index 00000000000..4a8d52a71e9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_breakpairing_autorest.go @@ -0,0 +1,67 @@ +package disasterrecoveryconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BreakPairingOperationResponse struct { + HttpResponse *http.Response +} + +// BreakPairing ... +func (c DisasterRecoveryConfigsClient) BreakPairing(ctx context.Context, id DisasterRecoveryConfigId) (result BreakPairingOperationResponse, err error) { + req, err := c.preparerForBreakPairing(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "BreakPairing", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "BreakPairing", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForBreakPairing(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "BreakPairing", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForBreakPairing prepares the BreakPairing request. +func (c DisasterRecoveryConfigsClient) preparerForBreakPairing(ctx context.Context, id DisasterRecoveryConfigId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/breakPairing", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForBreakPairing handles the response to the BreakPairing request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForBreakPairing(resp *http.Response) (result BreakPairingOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_createorupdate_autorest.go new file mode 100644 index 00000000000..3f67b7cfe66 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package disasterrecoveryconfigs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *ArmDisasterRecovery +} + +// CreateOrUpdate ... +func (c DisasterRecoveryConfigsClient) CreateOrUpdate(ctx context.Context, id DisasterRecoveryConfigId, input ArmDisasterRecovery) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c DisasterRecoveryConfigsClient) preparerForCreateOrUpdate(ctx context.Context, id DisasterRecoveryConfigId, input ArmDisasterRecovery) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_delete_autorest.go new file mode 100644 index 00000000000..7ad43948df6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_delete_autorest.go @@ -0,0 +1,66 @@ +package disasterrecoveryconfigs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c DisasterRecoveryConfigsClient) Delete(ctx context.Context, id DisasterRecoveryConfigId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c DisasterRecoveryConfigsClient) preparerForDelete(ctx context.Context, id DisasterRecoveryConfigId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_failover_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_failover_autorest.go new file mode 100644 index 00000000000..16f4b481196 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_failover_autorest.go @@ -0,0 +1,67 @@ +package disasterrecoveryconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FailOverOperationResponse struct { + HttpResponse *http.Response +} + +// FailOver ... +func (c DisasterRecoveryConfigsClient) FailOver(ctx context.Context, id DisasterRecoveryConfigId) (result FailOverOperationResponse, err error) { + req, err := c.preparerForFailOver(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "FailOver", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "FailOver", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForFailOver(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "FailOver", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForFailOver prepares the FailOver request. +func (c DisasterRecoveryConfigsClient) preparerForFailOver(ctx context.Context, id DisasterRecoveryConfigId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/failover", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForFailOver handles the response to the FailOver request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForFailOver(resp *http.Response) (result FailOverOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_get_autorest.go new file mode 100644 index 00000000000..9bfdb91343b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_get_autorest.go @@ -0,0 +1,68 @@ +package disasterrecoveryconfigs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ArmDisasterRecovery +} + +// Get ... +func (c DisasterRecoveryConfigsClient) Get(ctx context.Context, id DisasterRecoveryConfigId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DisasterRecoveryConfigsClient) preparerForGet(ctx context.Context, id DisasterRecoveryConfigId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_list_autorest.go new file mode 100644 index 00000000000..8c260919410 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/method_list_autorest.go @@ -0,0 +1,186 @@ +package disasterrecoveryconfigs + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]ArmDisasterRecovery + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []ArmDisasterRecovery +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c DisasterRecoveryConfigsClient) List(ctx context.Context, id NamespaceId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c DisasterRecoveryConfigsClient) preparerForList(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/disasterRecoveryConfigs", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c DisasterRecoveryConfigsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []ArmDisasterRecovery `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c DisasterRecoveryConfigsClient) ListComplete(ctx context.Context, id NamespaceId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ArmDisasterRecoveryOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DisasterRecoveryConfigsClient) ListCompleteMatchingPredicate(ctx context.Context, id NamespaceId, predicate ArmDisasterRecoveryOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]ArmDisasterRecovery, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/model_armdisasterrecovery.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/model_armdisasterrecovery.go new file mode 100644 index 00000000000..aee2e3d78bb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/model_armdisasterrecovery.go @@ -0,0 +1,17 @@ +package disasterrecoveryconfigs + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArmDisasterRecovery struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ArmDisasterRecoveryProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/model_armdisasterrecoveryproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/model_armdisasterrecoveryproperties.go new file mode 100644 index 00000000000..233aac5a3e8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/model_armdisasterrecoveryproperties.go @@ -0,0 +1,12 @@ +package disasterrecoveryconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArmDisasterRecoveryProperties struct { + AlternateName *string `json:"alternateName,omitempty"` + PartnerNamespace *string `json:"partnerNamespace,omitempty"` + PendingReplicationOperationsCount *int64 `json:"pendingReplicationOperationsCount,omitempty"` + ProvisioningState *ProvisioningStateDR `json:"provisioningState,omitempty"` + Role *RoleDisasterRecovery `json:"role,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/predicates.go new file mode 100644 index 00000000000..6f4a274ebda --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/predicates.go @@ -0,0 +1,29 @@ +package disasterrecoveryconfigs + +type ArmDisasterRecoveryOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ArmDisasterRecoveryOperationPredicate) Matches(input ArmDisasterRecovery) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/version.go new file mode 100644 index 00000000000..fc3d33fb5be --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/version.go @@ -0,0 +1,12 @@ +package disasterrecoveryconfigs + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/disasterrecoveryconfigs/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/README.md new file mode 100644 index 00000000000..536d4cc8635 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/README.md @@ -0,0 +1,122 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs` Documentation + +The `eventhubs` SDK allows for interaction with the Azure Resource Manager Service `eventhub` (API Version `2021-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs" +``` + + +### Client Initialization + +```go +client := eventhubs.NewEventHubsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `EventHubsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := eventhubs.NewEventhubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue") + +payload := eventhubs.Eventhub{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EventHubsClient.Delete` + +```go +ctx := context.TODO() +id := eventhubs.NewEventhubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EventHubsClient.DeleteAuthorizationRule` + +```go +ctx := context.TODO() +id := eventhubs.NewEventhubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "authorizationRuleValue") + +read, err := client.DeleteAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EventHubsClient.Get` + +```go +ctx := context.TODO() +id := eventhubs.NewEventhubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EventHubsClient.GetAuthorizationRule` + +```go +ctx := context.TODO() +id := eventhubs.NewEventhubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "eventHubValue", "authorizationRuleValue") + +read, err := client.GetAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EventHubsClient.ListByNamespace` + +```go +ctx := context.TODO() +id := eventhubs.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +// alternatively `client.ListByNamespace(ctx, id, eventhubs.DefaultListByNamespaceOperationOptions())` can be used to do batched pagination +items, err := client.ListByNamespaceComplete(ctx, id, eventhubs.DefaultListByNamespaceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/client.go new file mode 100644 index 00000000000..5eb53e47b4a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/client.go @@ -0,0 +1,18 @@ +package eventhubs + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventHubsClient struct { + Client autorest.Client + baseUri string +} + +func NewEventHubsClientWithBaseURI(endpoint string) EventHubsClient { + return EventHubsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/constants.go new file mode 100644 index 00000000000..89e20f646d8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/constants.go @@ -0,0 +1,114 @@ +package eventhubs + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessRights string + +const ( + AccessRightsListen AccessRights = "Listen" + AccessRightsManage AccessRights = "Manage" + AccessRightsSend AccessRights = "Send" +) + +func PossibleValuesForAccessRights() []string { + return []string{ + string(AccessRightsListen), + string(AccessRightsManage), + string(AccessRightsSend), + } +} + +func parseAccessRights(input string) (*AccessRights, error) { + vals := map[string]AccessRights{ + "listen": AccessRightsListen, + "manage": AccessRightsManage, + "send": AccessRightsSend, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessRights(input) + return &out, nil +} + +type EncodingCaptureDescription string + +const ( + EncodingCaptureDescriptionAvro EncodingCaptureDescription = "Avro" + EncodingCaptureDescriptionAvroDeflate EncodingCaptureDescription = "AvroDeflate" +) + +func PossibleValuesForEncodingCaptureDescription() []string { + return []string{ + string(EncodingCaptureDescriptionAvro), + string(EncodingCaptureDescriptionAvroDeflate), + } +} + +func parseEncodingCaptureDescription(input string) (*EncodingCaptureDescription, error) { + vals := map[string]EncodingCaptureDescription{ + "avro": EncodingCaptureDescriptionAvro, + "avrodeflate": EncodingCaptureDescriptionAvroDeflate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EncodingCaptureDescription(input) + return &out, nil +} + +type EntityStatus string + +const ( + EntityStatusActive EntityStatus = "Active" + EntityStatusCreating EntityStatus = "Creating" + EntityStatusDeleting EntityStatus = "Deleting" + EntityStatusDisabled EntityStatus = "Disabled" + EntityStatusReceiveDisabled EntityStatus = "ReceiveDisabled" + EntityStatusRenaming EntityStatus = "Renaming" + EntityStatusRestoring EntityStatus = "Restoring" + EntityStatusSendDisabled EntityStatus = "SendDisabled" + EntityStatusUnknown EntityStatus = "Unknown" +) + +func PossibleValuesForEntityStatus() []string { + return []string{ + string(EntityStatusActive), + string(EntityStatusCreating), + string(EntityStatusDeleting), + string(EntityStatusDisabled), + string(EntityStatusReceiveDisabled), + string(EntityStatusRenaming), + string(EntityStatusRestoring), + string(EntityStatusSendDisabled), + string(EntityStatusUnknown), + } +} + +func parseEntityStatus(input string) (*EntityStatus, error) { + vals := map[string]EntityStatus{ + "active": EntityStatusActive, + "creating": EntityStatusCreating, + "deleting": EntityStatusDeleting, + "disabled": EntityStatusDisabled, + "receivedisabled": EntityStatusReceiveDisabled, + "renaming": EntityStatusRenaming, + "restoring": EntityStatusRestoring, + "senddisabled": EntityStatusSendDisabled, + "unknown": EntityStatusUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EntityStatus(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/id_eventhub.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhub.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/id_eventhub.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhub.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/id_eventhubauthorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhubauthorizationrule.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/id_eventhubauthorizationrule.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhubauthorizationrule.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/id_namespace.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/id_namespace.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/id_namespace.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_createorupdate_autorest.go new file mode 100644 index 00000000000..716b36a61b9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package eventhubs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Eventhub +} + +// CreateOrUpdate ... +func (c EventHubsClient) CreateOrUpdate(ctx context.Context, id EventhubId, input Eventhub) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c EventHubsClient) preparerForCreateOrUpdate(ctx context.Context, id EventhubId, input Eventhub) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c EventHubsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_delete_autorest.go new file mode 100644 index 00000000000..8ec4dd26b2d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_delete_autorest.go @@ -0,0 +1,66 @@ +package eventhubs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c EventHubsClient) Delete(ctx context.Context, id EventhubId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c EventHubsClient) preparerForDelete(ctx context.Context, id EventhubId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c EventHubsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_deleteauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_deleteauthorizationrule_autorest.go new file mode 100644 index 00000000000..624271e15ed --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_deleteauthorizationrule_autorest.go @@ -0,0 +1,66 @@ +package eventhubs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response +} + +// DeleteAuthorizationRule ... +func (c EventHubsClient) DeleteAuthorizationRule(ctx context.Context, id EventhubAuthorizationRuleId) (result DeleteAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForDeleteAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDeleteAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDeleteAuthorizationRule prepares the DeleteAuthorizationRule request. +func (c EventHubsClient) preparerForDeleteAuthorizationRule(ctx context.Context, id EventhubAuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDeleteAuthorizationRule handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (c EventHubsClient) responderForDeleteAuthorizationRule(resp *http.Response) (result DeleteAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_get_autorest.go new file mode 100644 index 00000000000..18d591d7dab --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_get_autorest.go @@ -0,0 +1,68 @@ +package eventhubs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Eventhub +} + +// Get ... +func (c EventHubsClient) Get(ctx context.Context, id EventhubId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c EventHubsClient) preparerForGet(ctx context.Context, id EventhubId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c EventHubsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_getauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_getauthorizationrule_autorest.go new file mode 100644 index 00000000000..f2ef0a2b33b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_getauthorizationrule_autorest.go @@ -0,0 +1,68 @@ +package eventhubs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *AuthorizationRule +} + +// GetAuthorizationRule ... +func (c EventHubsClient) GetAuthorizationRule(ctx context.Context, id EventhubAuthorizationRuleId) (result GetAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForGetAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "GetAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "GetAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetAuthorizationRule prepares the GetAuthorizationRule request. +func (c EventHubsClient) preparerForGetAuthorizationRule(ctx context.Context, id EventhubAuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetAuthorizationRule handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (c EventHubsClient) responderForGetAuthorizationRule(resp *http.Response) (result GetAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_listbynamespace_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_listbynamespace_autorest.go new file mode 100644 index 00000000000..0973b4358fe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/method_listbynamespace_autorest.go @@ -0,0 +1,220 @@ +package eventhubs + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByNamespaceOperationResponse struct { + HttpResponse *http.Response + Model *[]Eventhub + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByNamespaceOperationResponse, error) +} + +type ListByNamespaceCompleteResult struct { + Items []Eventhub +} + +func (r ListByNamespaceOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByNamespaceOperationResponse) LoadMore(ctx context.Context) (resp ListByNamespaceOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByNamespaceOperationOptions struct { + Skip *int64 + Top *int64 +} + +func DefaultListByNamespaceOperationOptions() ListByNamespaceOperationOptions { + return ListByNamespaceOperationOptions{} +} + +func (o ListByNamespaceOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByNamespaceOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Skip != nil { + out["$skip"] = *o.Skip + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListByNamespace ... +func (c EventHubsClient) ListByNamespace(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions) (resp ListByNamespaceOperationResponse, err error) { + req, err := c.preparerForListByNamespace(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "ListByNamespace", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "ListByNamespace", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByNamespace(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "ListByNamespace", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByNamespace prepares the ListByNamespace request. +func (c EventHubsClient) preparerForListByNamespace(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/eventhubs", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByNamespaceWithNextLink prepares the ListByNamespace request with the given nextLink token. +func (c EventHubsClient) preparerForListByNamespaceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByNamespace handles the response to the ListByNamespace request. The method always +// closes the http.Response Body. +func (c EventHubsClient) responderForListByNamespace(resp *http.Response) (result ListByNamespaceOperationResponse, err error) { + type page struct { + Values []Eventhub `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByNamespaceOperationResponse, err error) { + req, err := c.preparerForListByNamespaceWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "ListByNamespace", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "ListByNamespace", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByNamespace(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "ListByNamespace", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByNamespaceComplete retrieves all of the results into a single object +func (c EventHubsClient) ListByNamespaceComplete(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions) (ListByNamespaceCompleteResult, error) { + return c.ListByNamespaceCompleteMatchingPredicate(ctx, id, options, EventhubOperationPredicate{}) +} + +// ListByNamespaceCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c EventHubsClient) ListByNamespaceCompleteMatchingPredicate(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions, predicate EventhubOperationPredicate) (resp ListByNamespaceCompleteResult, err error) { + items := make([]Eventhub, 0) + + page, err := c.ListByNamespace(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByNamespaceCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_authorizationrule.go new file mode 100644 index 00000000000..a12f75a62ad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_authorizationrule.go @@ -0,0 +1,17 @@ +package eventhubs + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationRule struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AuthorizationRuleProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_authorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_authorizationruleproperties.go new file mode 100644 index 00000000000..3b364835633 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_authorizationruleproperties.go @@ -0,0 +1,8 @@ +package eventhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationRuleProperties struct { + Rights []AccessRights `json:"rights"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_capturedescription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_capturedescription.go similarity index 77% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_capturedescription.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_capturedescription.go index 2afde4372c4..527b7c7974b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_capturedescription.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_capturedescription.go @@ -1,5 +1,8 @@ package eventhubs +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type CaptureDescription struct { Destination *Destination `json:"destination,omitempty"` Enabled *bool `json:"enabled,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_destination.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_destination.go new file mode 100644 index 00000000000..e14ec4e1ee3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_destination.go @@ -0,0 +1,9 @@ +package eventhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Destination struct { + Name *string `json:"name,omitempty"` + Properties *DestinationProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_destinationproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_destinationproperties.go new file mode 100644 index 00000000000..e4853d31ce7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_destinationproperties.go @@ -0,0 +1,13 @@ +package eventhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DestinationProperties struct { + ArchiveNameFormat *string `json:"archiveNameFormat,omitempty"` + BlobContainer *string `json:"blobContainer,omitempty"` + DataLakeAccountName *string `json:"dataLakeAccountName,omitempty"` + DataLakeFolderPath *string `json:"dataLakeFolderPath,omitempty"` + DataLakeSubscriptionId *string `json:"dataLakeSubscriptionId,omitempty"` + StorageAccountResourceId *string `json:"storageAccountResourceId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_eventhub.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_eventhub.go new file mode 100644 index 00000000000..8e3e96c15c4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_eventhub.go @@ -0,0 +1,17 @@ +package eventhubs + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Eventhub struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *EventhubProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_eventhubproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_eventhubproperties.go new file mode 100644 index 00000000000..9afd92ec6dc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/model_eventhubproperties.go @@ -0,0 +1,44 @@ +package eventhubs + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventhubProperties struct { + CaptureDescription *CaptureDescription `json:"captureDescription,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + MessageRetentionInDays *int64 `json:"messageRetentionInDays,omitempty"` + PartitionCount *int64 `json:"partitionCount,omitempty"` + PartitionIds *[]string `json:"partitionIds,omitempty"` + Status *EntityStatus `json:"status,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` +} + +func (o *EventhubProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *EventhubProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *EventhubProperties) GetUpdatedAtAsTime() (*time.Time, error) { + if o.UpdatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpdatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *EventhubProperties) SetUpdatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpdatedAt = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/predicates.go new file mode 100644 index 00000000000..45ff4f21b1b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/predicates.go @@ -0,0 +1,29 @@ +package eventhubs + +type EventhubOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p EventhubOperationPredicate) Matches(input Eventhub) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/version.go new file mode 100644 index 00000000000..724db00da13 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs/version.go @@ -0,0 +1,12 @@ +package eventhubs + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/eventhubs/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/README.md new file mode 100644 index 00000000000..1dd2a22a0c5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters` Documentation + +The `eventhubsclusters` SDK allows for interaction with the Azure Resource Manager Service `eventhub` (API Version `2021-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters" +``` + + +### Client Initialization + +```go +client := eventhubsclusters.NewEventHubsClustersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `EventHubsClustersClient.ClustersCreateOrUpdate` + +```go +ctx := context.TODO() +id := eventhubsclusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := eventhubsclusters.Cluster{ + // ... +} + + +if err := client.ClustersCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `EventHubsClustersClient.ClustersDelete` + +```go +ctx := context.TODO() +id := eventhubsclusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +if err := client.ClustersDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `EventHubsClustersClient.ClustersGet` + +```go +ctx := context.TODO() +id := eventhubsclusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.ClustersGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EventHubsClustersClient.ClustersListByResourceGroup` + +```go +ctx := context.TODO() +id := eventhubsclusters.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ClustersListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ClustersListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `EventHubsClustersClient.ClustersListBySubscription` + +```go +ctx := context.TODO() +id := eventhubsclusters.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ClustersListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ClustersListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `EventHubsClustersClient.ClustersUpdate` + +```go +ctx := context.TODO() +id := eventhubsclusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := eventhubsclusters.Cluster{ + // ... +} + + +if err := client.ClustersUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/client.go new file mode 100644 index 00000000000..e8b85457045 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/client.go @@ -0,0 +1,18 @@ +package eventhubsclusters + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventHubsClustersClient struct { + Client autorest.Client + baseUri string +} + +func NewEventHubsClustersClientWithBaseURI(endpoint string) EventHubsClustersClient { + return EventHubsClustersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/constants.go new file mode 100644 index 00000000000..081abe1b29a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/constants.go @@ -0,0 +1,31 @@ +package eventhubsclusters + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterSkuName string + +const ( + ClusterSkuNameDedicated ClusterSkuName = "Dedicated" +) + +func PossibleValuesForClusterSkuName() []string { + return []string{ + string(ClusterSkuNameDedicated), + } +} + +func parseClusterSkuName(input string) (*ClusterSkuName, error) { + vals := map[string]ClusterSkuName{ + "dedicated": ClusterSkuNameDedicated, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterSkuName(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/id_cluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/id_cluster.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/id_cluster.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/id_cluster.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/method_clusterscreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clusterscreateorupdate_autorest.go similarity index 86% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/method_clusterscreateorupdate_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clusterscreateorupdate_autorest.go index e2e0bbc597d..bfd345967a6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/method_clusterscreateorupdate_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clusterscreateorupdate_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type ClustersCreateOrUpdateResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClustersCreateOrUpdateOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // ClustersCreateOrUpdate ... -func (c EventHubsClustersClient) ClustersCreateOrUpdate(ctx context.Context, id ClusterId, input Cluster) (result ClustersCreateOrUpdateResponse, err error) { +func (c EventHubsClustersClient) ClustersCreateOrUpdate(ctx context.Context, id ClusterId, input Cluster) (result ClustersCreateOrUpdateOperationResponse, err error) { req, err := c.preparerForClustersCreateOrUpdate(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "eventhubsclusters.EventHubsClustersClient", "ClustersCreateOrUpdate", nil, "Failure preparing request") @@ -64,12 +67,13 @@ func (c EventHubsClustersClient) preparerForClustersCreateOrUpdate(ctx context.C // senderForClustersCreateOrUpdate sends the ClustersCreateOrUpdate request. The method will close the // http.Response Body if it receives an error. -func (c EventHubsClustersClient) senderForClustersCreateOrUpdate(ctx context.Context, req *http.Request) (future ClustersCreateOrUpdateResponse, err error) { +func (c EventHubsClustersClient) senderForClustersCreateOrUpdate(ctx context.Context, req *http.Request) (future ClustersCreateOrUpdateOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/method_clustersdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clustersdelete_autorest.go similarity index 80% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/method_clustersdelete_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clustersdelete_autorest.go index f1fa2cfd034..c47586d4f81 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/method_clustersdelete_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clustersdelete_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type ClustersDeleteResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClustersDeleteOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // ClustersDelete ... -func (c EventHubsClustersClient) ClustersDelete(ctx context.Context, id ClusterId) (result ClustersDeleteResponse, err error) { +func (c EventHubsClustersClient) ClustersDelete(ctx context.Context, id ClusterId) (result ClustersDeleteOperationResponse, err error) { req, err := c.preparerForClustersDelete(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "eventhubsclusters.EventHubsClustersClient", "ClustersDelete", nil, "Failure preparing request") @@ -53,6 +56,7 @@ func (c EventHubsClustersClient) preparerForClustersDelete(ctx context.Context, } preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), autorest.AsDelete(), autorest.WithBaseURL(c.baseUri), autorest.WithPath(id.ID()), @@ -62,12 +66,13 @@ func (c EventHubsClustersClient) preparerForClustersDelete(ctx context.Context, // senderForClustersDelete sends the ClustersDelete request. The method will close the // http.Response Body if it receives an error. -func (c EventHubsClustersClient) senderForClustersDelete(ctx context.Context, req *http.Request) (future ClustersDeleteResponse, err error) { +func (c EventHubsClustersClient) senderForClustersDelete(ctx context.Context, req *http.Request) (future ClustersDeleteOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/method_clustersget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clustersget_autorest.go similarity index 85% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/method_clustersget_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clustersget_autorest.go index 96d3a564750..8d539077feb 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/method_clustersget_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clustersget_autorest.go @@ -8,13 +8,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type ClustersGetResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClustersGetOperationResponse struct { HttpResponse *http.Response Model *Cluster } // ClustersGet ... -func (c EventHubsClustersClient) ClustersGet(ctx context.Context, id ClusterId) (result ClustersGetResponse, err error) { +func (c EventHubsClustersClient) ClustersGet(ctx context.Context, id ClusterId) (result ClustersGetOperationResponse, err error) { req, err := c.preparerForClustersGet(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "eventhubsclusters.EventHubsClustersClient", "ClustersGet", nil, "Failure preparing request") @@ -53,12 +56,13 @@ func (c EventHubsClustersClient) preparerForClustersGet(ctx context.Context, id // responderForClustersGet handles the response to the ClustersGet request. The method always // closes the http.Response Body. -func (c EventHubsClustersClient) responderForClustersGet(resp *http.Response) (result ClustersGetResponse, err error) { +func (c EventHubsClustersClient) responderForClustersGet(resp *http.Response) (result ClustersGetOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/method_clusterslistbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clusterslistbyresourcegroup_autorest.go similarity index 82% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/method_clusterslistbyresourcegroup_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clusterslistbyresourcegroup_autorest.go index 04c4229cf25..cfcd577b1de 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/method_clusterslistbyresourcegroup_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clusterslistbyresourcegroup_autorest.go @@ -8,25 +8,29 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" ) -type ClustersListByResourceGroupResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClustersListByResourceGroupOperationResponse struct { HttpResponse *http.Response Model *[]Cluster nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ClustersListByResourceGroupResponse, error) + nextPageFunc func(ctx context.Context, nextLink string) (ClustersListByResourceGroupOperationResponse, error) } type ClustersListByResourceGroupCompleteResult struct { Items []Cluster } -func (r ClustersListByResourceGroupResponse) HasMore() bool { +func (r ClustersListByResourceGroupOperationResponse) HasMore() bool { return r.nextLink != nil } -func (r ClustersListByResourceGroupResponse) LoadMore(ctx context.Context) (resp ClustersListByResourceGroupResponse, err error) { +func (r ClustersListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ClustersListByResourceGroupOperationResponse, err error) { if !r.HasMore() { err = fmt.Errorf("no more pages returned") return @@ -35,7 +39,7 @@ func (r ClustersListByResourceGroupResponse) LoadMore(ctx context.Context) (resp } // ClustersListByResourceGroup ... -func (c EventHubsClustersClient) ClustersListByResourceGroup(ctx context.Context, id ResourceGroupId) (resp ClustersListByResourceGroupResponse, err error) { +func (c EventHubsClustersClient) ClustersListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ClustersListByResourceGroupOperationResponse, err error) { req, err := c.preparerForClustersListByResourceGroup(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "eventhubsclusters.EventHubsClustersClient", "ClustersListByResourceGroup", nil, "Failure preparing request") @@ -56,52 +60,8 @@ func (c EventHubsClustersClient) ClustersListByResourceGroup(ctx context.Context return } -// ClustersListByResourceGroupComplete retrieves all of the results into a single object -func (c EventHubsClustersClient) ClustersListByResourceGroupComplete(ctx context.Context, id ResourceGroupId) (ClustersListByResourceGroupCompleteResult, error) { - return c.ClustersListByResourceGroupCompleteMatchingPredicate(ctx, id, ClusterPredicate{}) -} - -// ClustersListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c EventHubsClustersClient) ClustersListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate ClusterPredicate) (resp ClustersListByResourceGroupCompleteResult, err error) { - items := make([]Cluster, 0) - - page, err := c.ClustersListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ClustersListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForClustersListByResourceGroup prepares the ClustersListByResourceGroup request. -func (c EventHubsClustersClient) preparerForClustersListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { +func (c EventHubsClustersClient) preparerForClustersListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -142,7 +102,7 @@ func (c EventHubsClustersClient) preparerForClustersListByResourceGroupWithNextL // responderForClustersListByResourceGroup handles the response to the ClustersListByResourceGroup request. The method always // closes the http.Response Body. -func (c EventHubsClustersClient) responderForClustersListByResourceGroup(resp *http.Response) (result ClustersListByResourceGroupResponse, err error) { +func (c EventHubsClustersClient) responderForClustersListByResourceGroup(resp *http.Response) (result ClustersListByResourceGroupOperationResponse, err error) { type page struct { Values []Cluster `json:"value"` NextLink *string `json:"nextLink"` @@ -157,7 +117,7 @@ func (c EventHubsClustersClient) responderForClustersListByResourceGroup(resp *h result.Model = &respObj.Values result.nextLink = respObj.NextLink if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ClustersListByResourceGroupResponse, err error) { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ClustersListByResourceGroupOperationResponse, err error) { req, err := c.preparerForClustersListByResourceGroupWithNextLink(ctx, nextLink) if err != nil { err = autorest.NewErrorWithError(err, "eventhubsclusters.EventHubsClustersClient", "ClustersListByResourceGroup", nil, "Failure preparing request") @@ -181,3 +141,47 @@ func (c EventHubsClustersClient) responderForClustersListByResourceGroup(resp *h } return } + +// ClustersListByResourceGroupComplete retrieves all of the results into a single object +func (c EventHubsClustersClient) ClustersListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ClustersListByResourceGroupCompleteResult, error) { + return c.ClustersListByResourceGroupCompleteMatchingPredicate(ctx, id, ClusterOperationPredicate{}) +} + +// ClustersListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c EventHubsClustersClient) ClustersListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ClusterOperationPredicate) (resp ClustersListByResourceGroupCompleteResult, err error) { + items := make([]Cluster, 0) + + page, err := c.ClustersListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ClustersListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clusterslistbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clusterslistbysubscription_autorest.go new file mode 100644 index 00000000000..85e475c381e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clusterslistbysubscription_autorest.go @@ -0,0 +1,187 @@ +package eventhubsclusters + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClustersListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Cluster + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ClustersListBySubscriptionOperationResponse, error) +} + +type ClustersListBySubscriptionCompleteResult struct { + Items []Cluster +} + +func (r ClustersListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ClustersListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ClustersListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ClustersListBySubscription ... +func (c EventHubsClustersClient) ClustersListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ClustersListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForClustersListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubsclusters.EventHubsClustersClient", "ClustersListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubsclusters.EventHubsClustersClient", "ClustersListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForClustersListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubsclusters.EventHubsClustersClient", "ClustersListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForClustersListBySubscription prepares the ClustersListBySubscription request. +func (c EventHubsClustersClient) preparerForClustersListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.EventHub/clusters", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForClustersListBySubscriptionWithNextLink prepares the ClustersListBySubscription request with the given nextLink token. +func (c EventHubsClustersClient) preparerForClustersListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForClustersListBySubscription handles the response to the ClustersListBySubscription request. The method always +// closes the http.Response Body. +func (c EventHubsClustersClient) responderForClustersListBySubscription(resp *http.Response) (result ClustersListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Cluster `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ClustersListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForClustersListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubsclusters.EventHubsClustersClient", "ClustersListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubsclusters.EventHubsClustersClient", "ClustersListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForClustersListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "eventhubsclusters.EventHubsClustersClient", "ClustersListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ClustersListBySubscriptionComplete retrieves all of the results into a single object +func (c EventHubsClustersClient) ClustersListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ClustersListBySubscriptionCompleteResult, error) { + return c.ClustersListBySubscriptionCompleteMatchingPredicate(ctx, id, ClusterOperationPredicate{}) +} + +// ClustersListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c EventHubsClustersClient) ClustersListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ClusterOperationPredicate) (resp ClustersListBySubscriptionCompleteResult, err error) { + items := make([]Cluster, 0) + + page, err := c.ClustersListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ClustersListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/method_clustersupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clustersupdate_autorest.go similarity index 82% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/method_clustersupdate_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clustersupdate_autorest.go index 7e5f83c316d..b912a1d3d15 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/method_clustersupdate_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/method_clustersupdate_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type ClustersUpdateResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClustersUpdateOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // ClustersUpdate ... -func (c EventHubsClustersClient) ClustersUpdate(ctx context.Context, id ClusterId, input Cluster) (result ClustersUpdateResponse, err error) { +func (c EventHubsClustersClient) ClustersUpdate(ctx context.Context, id ClusterId, input Cluster) (result ClustersUpdateOperationResponse, err error) { req, err := c.preparerForClustersUpdate(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "eventhubsclusters.EventHubsClustersClient", "ClustersUpdate", nil, "Failure preparing request") @@ -64,12 +67,13 @@ func (c EventHubsClustersClient) preparerForClustersUpdate(ctx context.Context, // senderForClustersUpdate sends the ClustersUpdate request. The method will close the // http.Response Body if it receives an error. -func (c EventHubsClustersClient) senderForClustersUpdate(ctx context.Context, req *http.Request) (future ClustersUpdateResponse, err error) { +func (c EventHubsClustersClient) senderForClustersUpdate(ctx context.Context, req *http.Request) (future ClustersUpdateOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/model_cluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/model_cluster.go new file mode 100644 index 00000000000..487917ed15a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/model_cluster.go @@ -0,0 +1,19 @@ +package eventhubsclusters + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Cluster struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ClusterProperties `json:"properties,omitempty"` + Sku *ClusterSku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/model_clusterproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/model_clusterproperties.go new file mode 100644 index 00000000000..eb3deebdf90 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/model_clusterproperties.go @@ -0,0 +1,11 @@ +package eventhubsclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterProperties struct { + CreatedAt *string `json:"createdAt,omitempty"` + MetricId *string `json:"metricId,omitempty"` + Status *string `json:"status,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/model_clustersku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/model_clustersku.go new file mode 100644 index 00000000000..aa0c7ea5e17 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/model_clustersku.go @@ -0,0 +1,9 @@ +package eventhubsclusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterSku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name ClusterSkuName `json:"name"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/predicates.go new file mode 100644 index 00000000000..7c63b56d238 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/predicates.go @@ -0,0 +1,29 @@ +package eventhubsclusters + +type ClusterOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ClusterOperationPredicate) Matches(input Cluster) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/version.go new file mode 100644 index 00000000000..568cb6bb581 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters/version.go @@ -0,0 +1,12 @@ +package eventhubsclusters + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/eventhubsclusters/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/README.md new file mode 100644 index 00000000000..7266d603fa8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/README.md @@ -0,0 +1,120 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces` Documentation + +The `namespaces` SDK allows for interaction with the Azure Resource Manager Service `eventhub` (API Version `2021-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces" +``` + + +### Client Initialization + +```go +client := namespaces.NewNamespacesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NamespacesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +payload := namespaces.EHNamespace{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `NamespacesClient.Delete` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `NamespacesClient.Get` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.List` + +```go +ctx := context.TODO() +id := namespaces.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NamespacesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := namespaces.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NamespacesClient.Update` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +payload := namespaces.EHNamespace{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/client.go new file mode 100644 index 00000000000..bf25155c419 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/client.go @@ -0,0 +1,18 @@ +package namespaces + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesClient struct { + Client autorest.Client + baseUri string +} + +func NewNamespacesClientWithBaseURI(endpoint string) NamespacesClient { + return NamespacesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/constants.go new file mode 100644 index 00000000000..6558e700ccb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/constants.go @@ -0,0 +1,167 @@ +package namespaces + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndPointProvisioningState string + +const ( + EndPointProvisioningStateCanceled EndPointProvisioningState = "Canceled" + EndPointProvisioningStateCreating EndPointProvisioningState = "Creating" + EndPointProvisioningStateDeleting EndPointProvisioningState = "Deleting" + EndPointProvisioningStateFailed EndPointProvisioningState = "Failed" + EndPointProvisioningStateSucceeded EndPointProvisioningState = "Succeeded" + EndPointProvisioningStateUpdating EndPointProvisioningState = "Updating" +) + +func PossibleValuesForEndPointProvisioningState() []string { + return []string{ + string(EndPointProvisioningStateCanceled), + string(EndPointProvisioningStateCreating), + string(EndPointProvisioningStateDeleting), + string(EndPointProvisioningStateFailed), + string(EndPointProvisioningStateSucceeded), + string(EndPointProvisioningStateUpdating), + } +} + +func parseEndPointProvisioningState(input string) (*EndPointProvisioningState, error) { + vals := map[string]EndPointProvisioningState{ + "canceled": EndPointProvisioningStateCanceled, + "creating": EndPointProvisioningStateCreating, + "deleting": EndPointProvisioningStateDeleting, + "failed": EndPointProvisioningStateFailed, + "succeeded": EndPointProvisioningStateSucceeded, + "updating": EndPointProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EndPointProvisioningState(input) + return &out, nil +} + +type KeySource string + +const ( + KeySourceMicrosoftPointKeyVault KeySource = "Microsoft.KeyVault" +) + +func PossibleValuesForKeySource() []string { + return []string{ + string(KeySourceMicrosoftPointKeyVault), + } +} + +func parseKeySource(input string) (*KeySource, error) { + vals := map[string]KeySource{ + "microsoft.keyvault": KeySourceMicrosoftPointKeyVault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeySource(input) + return &out, nil +} + +type PrivateLinkConnectionStatus string + +const ( + PrivateLinkConnectionStatusApproved PrivateLinkConnectionStatus = "Approved" + PrivateLinkConnectionStatusDisconnected PrivateLinkConnectionStatus = "Disconnected" + PrivateLinkConnectionStatusPending PrivateLinkConnectionStatus = "Pending" + PrivateLinkConnectionStatusRejected PrivateLinkConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkConnectionStatus() []string { + return []string{ + string(PrivateLinkConnectionStatusApproved), + string(PrivateLinkConnectionStatusDisconnected), + string(PrivateLinkConnectionStatusPending), + string(PrivateLinkConnectionStatusRejected), + } +} + +func parsePrivateLinkConnectionStatus(input string) (*PrivateLinkConnectionStatus, error) { + vals := map[string]PrivateLinkConnectionStatus{ + "approved": PrivateLinkConnectionStatusApproved, + "disconnected": PrivateLinkConnectionStatusDisconnected, + "pending": PrivateLinkConnectionStatusPending, + "rejected": PrivateLinkConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkConnectionStatus(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameBasic SkuName = "Basic" + SkuNamePremium SkuName = "Premium" + SkuNameStandard SkuName = "Standard" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameBasic), + string(SkuNamePremium), + string(SkuNameStandard), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "basic": SkuNameBasic, + "premium": SkuNamePremium, + "standard": SkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierPremium SkuTier = "Premium" + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierPremium), + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "premium": SkuTierPremium, + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/id_namespace.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/id_namespace.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/id_namespace.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_createorupdate_autorest.go new file mode 100644 index 00000000000..44e30b453db --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c NamespacesClient) CreateOrUpdate(ctx context.Context, id NamespaceId, input EHNamespace) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c NamespacesClient) CreateOrUpdateThenPoll(ctx context.Context, id NamespaceId, input EHNamespace) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c NamespacesClient) preparerForCreateOrUpdate(ctx context.Context, id NamespaceId, input EHNamespace) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c NamespacesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_delete_autorest.go new file mode 100644 index 00000000000..968dfe754f2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_delete_autorest.go @@ -0,0 +1,78 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c NamespacesClient) Delete(ctx context.Context, id NamespaceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c NamespacesClient) DeleteThenPoll(ctx context.Context, id NamespaceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c NamespacesClient) preparerForDelete(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c NamespacesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_get_autorest.go new file mode 100644 index 00000000000..353d8898389 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_get_autorest.go @@ -0,0 +1,68 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *EHNamespace +} + +// Get ... +func (c NamespacesClient) Get(ctx context.Context, id NamespaceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c NamespacesClient) preparerForGet(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_list_autorest.go new file mode 100644 index 00000000000..5a7df04ecfd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_list_autorest.go @@ -0,0 +1,187 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]EHNamespace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []EHNamespace +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c NamespacesClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c NamespacesClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.EventHub/namespaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c NamespacesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []EHNamespace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c NamespacesClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, EHNamespaceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NamespacesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate EHNamespaceOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]EHNamespace, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..d655de7c1ac --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]EHNamespace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []EHNamespace +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c NamespacesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c NamespacesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.EventHub/namespaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c NamespacesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []EHNamespace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c NamespacesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, EHNamespaceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NamespacesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate EHNamespaceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]EHNamespace, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_update_autorest.go new file mode 100644 index 00000000000..2dce2d19638 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/method_update_autorest.go @@ -0,0 +1,69 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *EHNamespace +} + +// Update ... +func (c NamespacesClient) Update(ctx context.Context, id NamespaceId, input EHNamespace) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c NamespacesClient) preparerForUpdate(ctx context.Context, id NamespaceId, input EHNamespace) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_connectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_connectionstate.go new file mode 100644 index 00000000000..022aa980deb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_connectionstate.go @@ -0,0 +1,9 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectionState struct { + Description *string `json:"description,omitempty"` + Status *PrivateLinkConnectionStatus `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_ehnamespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_ehnamespace.go new file mode 100644 index 00000000000..17819eb7bf0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_ehnamespace.go @@ -0,0 +1,21 @@ +package namespaces + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EHNamespace struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *EHNamespaceProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_ehnamespaceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_ehnamespaceproperties.go new file mode 100644 index 00000000000..65d06e6cf5b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_ehnamespaceproperties.go @@ -0,0 +1,52 @@ +package namespaces + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EHNamespaceProperties struct { + AlternateName *string `json:"alternateName,omitempty"` + ClusterArmId *string `json:"clusterArmId,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + Encryption *Encryption `json:"encryption,omitempty"` + IsAutoInflateEnabled *bool `json:"isAutoInflateEnabled,omitempty"` + KafkaEnabled *bool `json:"kafkaEnabled,omitempty"` + MaximumThroughputUnits *int64 `json:"maximumThroughputUnits,omitempty"` + MetricId *string `json:"metricId,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` + Status *string `json:"status,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` +} + +func (o *EHNamespaceProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *EHNamespaceProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *EHNamespaceProperties) GetUpdatedAtAsTime() (*time.Time, error) { + if o.UpdatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpdatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *EHNamespaceProperties) SetUpdatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpdatedAt = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_encryption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_encryption.go new file mode 100644 index 00000000000..c33fdbc6fad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_encryption.go @@ -0,0 +1,10 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Encryption struct { + KeySource *KeySource `json:"keySource,omitempty"` + KeyVaultProperties *[]KeyVaultProperties `json:"keyVaultProperties,omitempty"` + RequireInfrastructureEncryption *bool `json:"requireInfrastructureEncryption,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_keyvaultproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_keyvaultproperties.go new file mode 100644 index 00000000000..b0dfb9a4e06 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_keyvaultproperties.go @@ -0,0 +1,11 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultProperties struct { + Identity *UserAssignedIdentityProperties `json:"identity,omitempty"` + KeyName *string `json:"keyName,omitempty"` + KeyVaultUri *string `json:"keyVaultUri,omitempty"` + KeyVersion *string `json:"keyVersion,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_privateendpoint.go new file mode 100644 index 00000000000..3dec0387e5f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_privateendpoint.go @@ -0,0 +1,8 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_privateendpointconnection.go new file mode 100644 index 00000000000..58852b36e02 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_privateendpointconnection.go @@ -0,0 +1,17 @@ +package namespaces + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..e0aa15c5957 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *ConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *EndPointProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_sku.go new file mode 100644 index 00000000000..909b599f138 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_sku.go @@ -0,0 +1,10 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name SkuName `json:"name"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_userassignedidentityproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_userassignedidentityproperties.go new file mode 100644 index 00000000000..0685aa3ea14 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/model_userassignedidentityproperties.go @@ -0,0 +1,8 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserAssignedIdentityProperties struct { + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/predicates.go new file mode 100644 index 00000000000..da2e3acefe1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/predicates.go @@ -0,0 +1,29 @@ +package namespaces + +type EHNamespaceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p EHNamespaceOperationPredicate) Matches(input EHNamespace) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/version.go new file mode 100644 index 00000000000..e7fef9f37bd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces/version.go @@ -0,0 +1,12 @@ +package namespaces + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/namespaces/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/README.md new file mode 100644 index 00000000000..63fed3743c4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/README.md @@ -0,0 +1,73 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets` Documentation + +The `networkrulesets` SDK allows for interaction with the Azure Resource Manager Service `eventhub` (API Version `2021-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets" +``` + + +### Client Initialization + +```go +client := networkrulesets.NewNetworkRuleSetsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NetworkRuleSetsClient.NamespacesCreateOrUpdateNetworkRuleSet` + +```go +ctx := context.TODO() +id := networkrulesets.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +payload := networkrulesets.NetworkRuleSet{ + // ... +} + + +read, err := client.NamespacesCreateOrUpdateNetworkRuleSet(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NetworkRuleSetsClient.NamespacesGetNetworkRuleSet` + +```go +ctx := context.TODO() +id := networkrulesets.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +read, err := client.NamespacesGetNetworkRuleSet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NetworkRuleSetsClient.NamespacesListNetworkRuleSet` + +```go +ctx := context.TODO() +id := networkrulesets.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +read, err := client.NamespacesListNetworkRuleSet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/client.go new file mode 100644 index 00000000000..3182f271e9c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/client.go @@ -0,0 +1,18 @@ +package networkrulesets + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkRuleSetsClient struct { + Client autorest.Client + baseUri string +} + +func NewNetworkRuleSetsClientWithBaseURI(endpoint string) NetworkRuleSetsClient { + return NetworkRuleSetsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/constants.go new file mode 100644 index 00000000000..c99b8be50ab --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/constants.go @@ -0,0 +1,87 @@ +package networkrulesets + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DefaultAction string + +const ( + DefaultActionAllow DefaultAction = "Allow" + DefaultActionDeny DefaultAction = "Deny" +) + +func PossibleValuesForDefaultAction() []string { + return []string{ + string(DefaultActionAllow), + string(DefaultActionDeny), + } +} + +func parseDefaultAction(input string) (*DefaultAction, error) { + vals := map[string]DefaultAction{ + "allow": DefaultActionAllow, + "deny": DefaultActionDeny, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DefaultAction(input) + return &out, nil +} + +type NetworkRuleIPAction string + +const ( + NetworkRuleIPActionAllow NetworkRuleIPAction = "Allow" +) + +func PossibleValuesForNetworkRuleIPAction() []string { + return []string{ + string(NetworkRuleIPActionAllow), + } +} + +func parseNetworkRuleIPAction(input string) (*NetworkRuleIPAction, error) { + vals := map[string]NetworkRuleIPAction{ + "allow": NetworkRuleIPActionAllow, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkRuleIPAction(input) + return &out, nil +} + +type PublicNetworkAccessFlag string + +const ( + PublicNetworkAccessFlagDisabled PublicNetworkAccessFlag = "Disabled" + PublicNetworkAccessFlagEnabled PublicNetworkAccessFlag = "Enabled" +) + +func PossibleValuesForPublicNetworkAccessFlag() []string { + return []string{ + string(PublicNetworkAccessFlagDisabled), + string(PublicNetworkAccessFlagEnabled), + } +} + +func parsePublicNetworkAccessFlag(input string) (*PublicNetworkAccessFlag, error) { + vals := map[string]PublicNetworkAccessFlag{ + "disabled": PublicNetworkAccessFlagDisabled, + "enabled": PublicNetworkAccessFlagEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccessFlag(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/id_namespace.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/id_namespace.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/id_namespace.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/method_namespacescreateorupdatenetworkruleset_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/method_namespacescreateorupdatenetworkruleset_autorest.go similarity index 87% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/method_namespacescreateorupdatenetworkruleset_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/method_namespacescreateorupdatenetworkruleset_autorest.go index a72626d773e..2a6189625b9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/method_namespacescreateorupdatenetworkruleset_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/method_namespacescreateorupdatenetworkruleset_autorest.go @@ -9,13 +9,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type NamespacesCreateOrUpdateNetworkRuleSetResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesCreateOrUpdateNetworkRuleSetOperationResponse struct { HttpResponse *http.Response Model *NetworkRuleSet } // NamespacesCreateOrUpdateNetworkRuleSet ... -func (c NetworkRuleSetsClient) NamespacesCreateOrUpdateNetworkRuleSet(ctx context.Context, id NamespaceId, input NetworkRuleSet) (result NamespacesCreateOrUpdateNetworkRuleSetResponse, err error) { +func (c NetworkRuleSetsClient) NamespacesCreateOrUpdateNetworkRuleSet(ctx context.Context, id NamespaceId, input NetworkRuleSet) (result NamespacesCreateOrUpdateNetworkRuleSetOperationResponse, err error) { req, err := c.preparerForNamespacesCreateOrUpdateNetworkRuleSet(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "networkrulesets.NetworkRuleSetsClient", "NamespacesCreateOrUpdateNetworkRuleSet", nil, "Failure preparing request") @@ -55,12 +58,13 @@ func (c NetworkRuleSetsClient) preparerForNamespacesCreateOrUpdateNetworkRuleSet // responderForNamespacesCreateOrUpdateNetworkRuleSet handles the response to the NamespacesCreateOrUpdateNetworkRuleSet request. The method always // closes the http.Response Body. -func (c NetworkRuleSetsClient) responderForNamespacesCreateOrUpdateNetworkRuleSet(resp *http.Response) (result NamespacesCreateOrUpdateNetworkRuleSetResponse, err error) { +func (c NetworkRuleSetsClient) responderForNamespacesCreateOrUpdateNetworkRuleSet(resp *http.Response) (result NamespacesCreateOrUpdateNetworkRuleSetOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/method_namespacesgetnetworkruleset_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/method_namespacesgetnetworkruleset_autorest.go similarity index 86% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/method_namespacesgetnetworkruleset_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/method_namespacesgetnetworkruleset_autorest.go index 4b1c83ec612..50378de2751 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/method_namespacesgetnetworkruleset_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/method_namespacesgetnetworkruleset_autorest.go @@ -9,13 +9,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type NamespacesGetNetworkRuleSetResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesGetNetworkRuleSetOperationResponse struct { HttpResponse *http.Response Model *NetworkRuleSet } // NamespacesGetNetworkRuleSet ... -func (c NetworkRuleSetsClient) NamespacesGetNetworkRuleSet(ctx context.Context, id NamespaceId) (result NamespacesGetNetworkRuleSetResponse, err error) { +func (c NetworkRuleSetsClient) NamespacesGetNetworkRuleSet(ctx context.Context, id NamespaceId) (result NamespacesGetNetworkRuleSetOperationResponse, err error) { req, err := c.preparerForNamespacesGetNetworkRuleSet(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "networkrulesets.NetworkRuleSetsClient", "NamespacesGetNetworkRuleSet", nil, "Failure preparing request") @@ -54,12 +57,13 @@ func (c NetworkRuleSetsClient) preparerForNamespacesGetNetworkRuleSet(ctx contex // responderForNamespacesGetNetworkRuleSet handles the response to the NamespacesGetNetworkRuleSet request. The method always // closes the http.Response Body. -func (c NetworkRuleSetsClient) responderForNamespacesGetNetworkRuleSet(resp *http.Response) (result NamespacesGetNetworkRuleSetResponse, err error) { +func (c NetworkRuleSetsClient) responderForNamespacesGetNetworkRuleSet(resp *http.Response) (result NamespacesGetNetworkRuleSetOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/method_namespaceslistnetworkruleset_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/method_namespaceslistnetworkruleset_autorest.go new file mode 100644 index 00000000000..3e9b712797f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/method_namespaceslistnetworkruleset_autorest.go @@ -0,0 +1,69 @@ +package networkrulesets + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesListNetworkRuleSetOperationResponse struct { + HttpResponse *http.Response + Model *NetworkRuleSetListResult +} + +// NamespacesListNetworkRuleSet ... +func (c NetworkRuleSetsClient) NamespacesListNetworkRuleSet(ctx context.Context, id NamespaceId) (result NamespacesListNetworkRuleSetOperationResponse, err error) { + req, err := c.preparerForNamespacesListNetworkRuleSet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "networkrulesets.NetworkRuleSetsClient", "NamespacesListNetworkRuleSet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "networkrulesets.NetworkRuleSetsClient", "NamespacesListNetworkRuleSet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForNamespacesListNetworkRuleSet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "networkrulesets.NetworkRuleSetsClient", "NamespacesListNetworkRuleSet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForNamespacesListNetworkRuleSet prepares the NamespacesListNetworkRuleSet request. +func (c NetworkRuleSetsClient) preparerForNamespacesListNetworkRuleSet(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/networkRuleSets", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForNamespacesListNetworkRuleSet handles the response to the NamespacesListNetworkRuleSet request. The method always +// closes the http.Response Body. +func (c NetworkRuleSetsClient) responderForNamespacesListNetworkRuleSet(resp *http.Response) (result NamespacesListNetworkRuleSetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_networkruleset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_networkruleset.go new file mode 100644 index 00000000000..72569c393a8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_networkruleset.go @@ -0,0 +1,17 @@ +package networkrulesets + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkRuleSet struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *NetworkRuleSetProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_networkrulesetlistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_networkrulesetlistresult.go new file mode 100644 index 00000000000..a34fe31f086 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_networkrulesetlistresult.go @@ -0,0 +1,9 @@ +package networkrulesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkRuleSetListResult struct { + NextLink *string `json:"nextLink,omitempty"` + Value *[]NetworkRuleSet `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_networkrulesetproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_networkrulesetproperties.go new file mode 100644 index 00000000000..485ab327f07 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_networkrulesetproperties.go @@ -0,0 +1,12 @@ +package networkrulesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkRuleSetProperties struct { + DefaultAction *DefaultAction `json:"defaultAction,omitempty"` + IPRules *[]NWRuleSetIPRules `json:"ipRules,omitempty"` + PublicNetworkAccess *PublicNetworkAccessFlag `json:"publicNetworkAccess,omitempty"` + TrustedServiceAccessEnabled *bool `json:"trustedServiceAccessEnabled,omitempty"` + VirtualNetworkRules *[]NWRuleSetVirtualNetworkRules `json:"virtualNetworkRules,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_nwrulesetiprules.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_nwrulesetiprules.go new file mode 100644 index 00000000000..a568909a389 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_nwrulesetiprules.go @@ -0,0 +1,9 @@ +package networkrulesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NWRuleSetIPRules struct { + Action *NetworkRuleIPAction `json:"action,omitempty"` + IPMask *string `json:"ipMask,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_nwrulesetvirtualnetworkrules.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_nwrulesetvirtualnetworkrules.go new file mode 100644 index 00000000000..5a8c3ff0f51 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_nwrulesetvirtualnetworkrules.go @@ -0,0 +1,9 @@ +package networkrulesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NWRuleSetVirtualNetworkRules struct { + IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` + Subnet *Subnet `json:"subnet,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_subnet.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_subnet.go new file mode 100644 index 00000000000..9a2cdbb0a87 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/model_subnet.go @@ -0,0 +1,8 @@ +package networkrulesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Subnet struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/version.go new file mode 100644 index 00000000000..69601b6725c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets/version.go @@ -0,0 +1,12 @@ +package networkrulesets + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/networkrulesets/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/README.md new file mode 100644 index 00000000000..86a8c4bfcaa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry` Documentation + +The `schemaregistry` SDK allows for interaction with the Azure Resource Manager Service `eventhub` (API Version `2021-11-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry" +``` + + +### Client Initialization + +```go +client := schemaregistry.NewSchemaRegistryClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SchemaRegistryClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := schemaregistry.NewSchemaGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "schemaGroupValue") + +payload := schemaregistry.SchemaGroup{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SchemaRegistryClient.Delete` + +```go +ctx := context.TODO() +id := schemaregistry.NewSchemaGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "schemaGroupValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SchemaRegistryClient.Get` + +```go +ctx := context.TODO() +id := schemaregistry.NewSchemaGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "schemaGroupValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SchemaRegistryClient.ListByNamespace` + +```go +ctx := context.TODO() +id := schemaregistry.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +// alternatively `client.ListByNamespace(ctx, id, schemaregistry.DefaultListByNamespaceOperationOptions())` can be used to do batched pagination +items, err := client.ListByNamespaceComplete(ctx, id, schemaregistry.DefaultListByNamespaceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/client.go new file mode 100644 index 00000000000..0f62fd93dd9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/client.go @@ -0,0 +1,18 @@ +package schemaregistry + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchemaRegistryClient struct { + Client autorest.Client + baseUri string +} + +func NewSchemaRegistryClientWithBaseURI(endpoint string) SchemaRegistryClient { + return SchemaRegistryClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/constants.go new file mode 100644 index 00000000000..7a4b53869fe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/constants.go @@ -0,0 +1,65 @@ +package schemaregistry + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchemaCompatibility string + +const ( + SchemaCompatibilityBackward SchemaCompatibility = "Backward" + SchemaCompatibilityForward SchemaCompatibility = "Forward" + SchemaCompatibilityNone SchemaCompatibility = "None" +) + +func PossibleValuesForSchemaCompatibility() []string { + return []string{ + string(SchemaCompatibilityBackward), + string(SchemaCompatibilityForward), + string(SchemaCompatibilityNone), + } +} + +func parseSchemaCompatibility(input string) (*SchemaCompatibility, error) { + vals := map[string]SchemaCompatibility{ + "backward": SchemaCompatibilityBackward, + "forward": SchemaCompatibilityForward, + "none": SchemaCompatibilityNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SchemaCompatibility(input) + return &out, nil +} + +type SchemaType string + +const ( + SchemaTypeAvro SchemaType = "Avro" + SchemaTypeUnknown SchemaType = "Unknown" +) + +func PossibleValuesForSchemaType() []string { + return []string{ + string(SchemaTypeAvro), + string(SchemaTypeUnknown), + } +} + +func parseSchemaType(input string) (*SchemaType, error) { + vals := map[string]SchemaType{ + "avro": SchemaTypeAvro, + "unknown": SchemaTypeUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SchemaType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/id_namespace.go new file mode 100644 index 00000000000..6247a58974b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/id_namespace.go @@ -0,0 +1,124 @@ +package schemaregistry + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NamespaceId{} + +// NamespaceId is a struct representing the Resource ID for a Namespace +type NamespaceId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string +} + +// NewNamespaceID returns a new NamespaceId struct +func NewNamespaceID(subscriptionId string, resourceGroupName string, namespaceName string) NamespaceId { + return NamespaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + } +} + +// ParseNamespaceID parses 'input' into a NamespaceId +func ParseNamespaceID(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNamespaceIDInsensitively parses 'input' case-insensitively into a NamespaceId +// note: this method should only be used for API response data and not user input +func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID +func ValidateNamespaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNamespaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Namespace ID +func (id NamespaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventHub/namespaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Namespace ID +func (id NamespaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftEventHub", "Microsoft.EventHub", "Microsoft.EventHub"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + } +} + +// String returns a human-readable description of this Namespace ID +func (id NamespaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + } + return fmt.Sprintf("Namespace (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/id_schemagroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/id_schemagroup.go new file mode 100644 index 00000000000..24e1394431f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/id_schemagroup.go @@ -0,0 +1,137 @@ +package schemaregistry + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SchemaGroupId{} + +// SchemaGroupId is a struct representing the Resource ID for a Schema Group +type SchemaGroupId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + SchemaGroupName string +} + +// NewSchemaGroupID returns a new SchemaGroupId struct +func NewSchemaGroupID(subscriptionId string, resourceGroupName string, namespaceName string, schemaGroupName string) SchemaGroupId { + return SchemaGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + SchemaGroupName: schemaGroupName, + } +} + +// ParseSchemaGroupID parses 'input' into a SchemaGroupId +func ParseSchemaGroupID(input string) (*SchemaGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(SchemaGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SchemaGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.SchemaGroupName, ok = parsed.Parsed["schemaGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'schemaGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSchemaGroupIDInsensitively parses 'input' case-insensitively into a SchemaGroupId +// note: this method should only be used for API response data and not user input +func ParseSchemaGroupIDInsensitively(input string) (*SchemaGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(SchemaGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SchemaGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.SchemaGroupName, ok = parsed.Parsed["schemaGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'schemaGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSchemaGroupID checks that 'input' can be parsed as a Schema Group ID +func ValidateSchemaGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSchemaGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Schema Group ID +func (id SchemaGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventHub/namespaces/%s/schemaGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.SchemaGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Schema Group ID +func (id SchemaGroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftEventHub", "Microsoft.EventHub", "Microsoft.EventHub"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticSchemaGroups", "schemaGroups", "schemaGroups"), + resourceids.UserSpecifiedSegment("schemaGroupName", "schemaGroupValue"), + } +} + +// String returns a human-readable description of this Schema Group ID +func (id SchemaGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Schema Group Name: %q", id.SchemaGroupName), + } + return fmt.Sprintf("Schema Group (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/method_createorupdate_autorest.go new file mode 100644 index 00000000000..317ec3505ac --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package schemaregistry + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *SchemaGroup +} + +// CreateOrUpdate ... +func (c SchemaRegistryClient) CreateOrUpdate(ctx context.Context, id SchemaGroupId, input SchemaGroup) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "schemaregistry.SchemaRegistryClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schemaregistry.SchemaRegistryClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schemaregistry.SchemaRegistryClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c SchemaRegistryClient) preparerForCreateOrUpdate(ctx context.Context, id SchemaGroupId, input SchemaGroup) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c SchemaRegistryClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/method_delete_autorest.go new file mode 100644 index 00000000000..6ad24e9264b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/method_delete_autorest.go @@ -0,0 +1,66 @@ +package schemaregistry + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c SchemaRegistryClient) Delete(ctx context.Context, id SchemaGroupId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "schemaregistry.SchemaRegistryClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schemaregistry.SchemaRegistryClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schemaregistry.SchemaRegistryClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c SchemaRegistryClient) preparerForDelete(ctx context.Context, id SchemaGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c SchemaRegistryClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/method_get_autorest.go new file mode 100644 index 00000000000..9de51cd1edc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/method_get_autorest.go @@ -0,0 +1,68 @@ +package schemaregistry + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *SchemaGroup +} + +// Get ... +func (c SchemaRegistryClient) Get(ctx context.Context, id SchemaGroupId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "schemaregistry.SchemaRegistryClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schemaregistry.SchemaRegistryClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schemaregistry.SchemaRegistryClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c SchemaRegistryClient) preparerForGet(ctx context.Context, id SchemaGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c SchemaRegistryClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/method_listbynamespace_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/method_listbynamespace_autorest.go new file mode 100644 index 00000000000..47c5881524c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/method_listbynamespace_autorest.go @@ -0,0 +1,220 @@ +package schemaregistry + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByNamespaceOperationResponse struct { + HttpResponse *http.Response + Model *[]SchemaGroup + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByNamespaceOperationResponse, error) +} + +type ListByNamespaceCompleteResult struct { + Items []SchemaGroup +} + +func (r ListByNamespaceOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByNamespaceOperationResponse) LoadMore(ctx context.Context) (resp ListByNamespaceOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByNamespaceOperationOptions struct { + Skip *int64 + Top *int64 +} + +func DefaultListByNamespaceOperationOptions() ListByNamespaceOperationOptions { + return ListByNamespaceOperationOptions{} +} + +func (o ListByNamespaceOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByNamespaceOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Skip != nil { + out["$skip"] = *o.Skip + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListByNamespace ... +func (c SchemaRegistryClient) ListByNamespace(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions) (resp ListByNamespaceOperationResponse, err error) { + req, err := c.preparerForListByNamespace(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "schemaregistry.SchemaRegistryClient", "ListByNamespace", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schemaregistry.SchemaRegistryClient", "ListByNamespace", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByNamespace(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schemaregistry.SchemaRegistryClient", "ListByNamespace", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByNamespace prepares the ListByNamespace request. +func (c SchemaRegistryClient) preparerForListByNamespace(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/schemaGroups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByNamespaceWithNextLink prepares the ListByNamespace request with the given nextLink token. +func (c SchemaRegistryClient) preparerForListByNamespaceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByNamespace handles the response to the ListByNamespace request. The method always +// closes the http.Response Body. +func (c SchemaRegistryClient) responderForListByNamespace(resp *http.Response) (result ListByNamespaceOperationResponse, err error) { + type page struct { + Values []SchemaGroup `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByNamespaceOperationResponse, err error) { + req, err := c.preparerForListByNamespaceWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "schemaregistry.SchemaRegistryClient", "ListByNamespace", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "schemaregistry.SchemaRegistryClient", "ListByNamespace", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByNamespace(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "schemaregistry.SchemaRegistryClient", "ListByNamespace", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByNamespaceComplete retrieves all of the results into a single object +func (c SchemaRegistryClient) ListByNamespaceComplete(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions) (ListByNamespaceCompleteResult, error) { + return c.ListByNamespaceCompleteMatchingPredicate(ctx, id, options, SchemaGroupOperationPredicate{}) +} + +// ListByNamespaceCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SchemaRegistryClient) ListByNamespaceCompleteMatchingPredicate(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions, predicate SchemaGroupOperationPredicate) (resp ListByNamespaceCompleteResult, err error) { + items := make([]SchemaGroup, 0) + + page, err := c.ListByNamespace(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByNamespaceCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/model_schemagroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/model_schemagroup.go new file mode 100644 index 00000000000..b39dc6034a2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/model_schemagroup.go @@ -0,0 +1,17 @@ +package schemaregistry + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchemaGroup struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SchemaGroupProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/model_schemagroupproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/model_schemagroupproperties.go new file mode 100644 index 00000000000..1f9c58b6c2d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/model_schemagroupproperties.go @@ -0,0 +1,43 @@ +package schemaregistry + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchemaGroupProperties struct { + CreatedAtUtc *string `json:"createdAtUtc,omitempty"` + ETag *string `json:"eTag,omitempty"` + GroupProperties *map[string]string `json:"groupProperties,omitempty"` + SchemaCompatibility *SchemaCompatibility `json:"schemaCompatibility,omitempty"` + SchemaType *SchemaType `json:"schemaType,omitempty"` + UpdatedAtUtc *string `json:"updatedAtUtc,omitempty"` +} + +func (o *SchemaGroupProperties) GetCreatedAtUtcAsTime() (*time.Time, error) { + if o.CreatedAtUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAtUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *SchemaGroupProperties) SetCreatedAtUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAtUtc = &formatted +} + +func (o *SchemaGroupProperties) GetUpdatedAtUtcAsTime() (*time.Time, error) { + if o.UpdatedAtUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpdatedAtUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *SchemaGroupProperties) SetUpdatedAtUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpdatedAtUtc = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/predicates.go new file mode 100644 index 00000000000..51e1fd01f7a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/predicates.go @@ -0,0 +1,29 @@ +package schemaregistry + +type SchemaGroupOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p SchemaGroupOperationPredicate) Matches(input SchemaGroup) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/version.go new file mode 100644 index 00000000000..a2676928392 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry/version.go @@ -0,0 +1,12 @@ +package schemaregistry + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/schemaregistry/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/README.md new file mode 100644 index 00000000000..90bd26a208a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/README.md @@ -0,0 +1,120 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces` Documentation + +The `namespaces` SDK allows for interaction with the Azure Resource Manager Service `eventhub` (API Version `2022-01-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces" +``` + + +### Client Initialization + +```go +client := namespaces.NewNamespacesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NamespacesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +payload := namespaces.EHNamespace{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `NamespacesClient.Delete` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `NamespacesClient.Get` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.List` + +```go +ctx := context.TODO() +id := namespaces.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NamespacesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := namespaces.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NamespacesClient.Update` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +payload := namespaces.EHNamespace{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/client.go new file mode 100644 index 00000000000..bf25155c419 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/client.go @@ -0,0 +1,18 @@ +package namespaces + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesClient struct { + Client autorest.Client + baseUri string +} + +func NewNamespacesClientWithBaseURI(endpoint string) NamespacesClient { + return NamespacesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/constants.go new file mode 100644 index 00000000000..0dcfbe5460a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/constants.go @@ -0,0 +1,229 @@ +package namespaces + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndPointProvisioningState string + +const ( + EndPointProvisioningStateCanceled EndPointProvisioningState = "Canceled" + EndPointProvisioningStateCreating EndPointProvisioningState = "Creating" + EndPointProvisioningStateDeleting EndPointProvisioningState = "Deleting" + EndPointProvisioningStateFailed EndPointProvisioningState = "Failed" + EndPointProvisioningStateSucceeded EndPointProvisioningState = "Succeeded" + EndPointProvisioningStateUpdating EndPointProvisioningState = "Updating" +) + +func PossibleValuesForEndPointProvisioningState() []string { + return []string{ + string(EndPointProvisioningStateCanceled), + string(EndPointProvisioningStateCreating), + string(EndPointProvisioningStateDeleting), + string(EndPointProvisioningStateFailed), + string(EndPointProvisioningStateSucceeded), + string(EndPointProvisioningStateUpdating), + } +} + +func parseEndPointProvisioningState(input string) (*EndPointProvisioningState, error) { + vals := map[string]EndPointProvisioningState{ + "canceled": EndPointProvisioningStateCanceled, + "creating": EndPointProvisioningStateCreating, + "deleting": EndPointProvisioningStateDeleting, + "failed": EndPointProvisioningStateFailed, + "succeeded": EndPointProvisioningStateSucceeded, + "updating": EndPointProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EndPointProvisioningState(input) + return &out, nil +} + +type KeySource string + +const ( + KeySourceMicrosoftPointKeyVault KeySource = "Microsoft.KeyVault" +) + +func PossibleValuesForKeySource() []string { + return []string{ + string(KeySourceMicrosoftPointKeyVault), + } +} + +func parseKeySource(input string) (*KeySource, error) { + vals := map[string]KeySource{ + "microsoft.keyvault": KeySourceMicrosoftPointKeyVault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeySource(input) + return &out, nil +} + +type PrivateLinkConnectionStatus string + +const ( + PrivateLinkConnectionStatusApproved PrivateLinkConnectionStatus = "Approved" + PrivateLinkConnectionStatusDisconnected PrivateLinkConnectionStatus = "Disconnected" + PrivateLinkConnectionStatusPending PrivateLinkConnectionStatus = "Pending" + PrivateLinkConnectionStatusRejected PrivateLinkConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkConnectionStatus() []string { + return []string{ + string(PrivateLinkConnectionStatusApproved), + string(PrivateLinkConnectionStatusDisconnected), + string(PrivateLinkConnectionStatusPending), + string(PrivateLinkConnectionStatusRejected), + } +} + +func parsePrivateLinkConnectionStatus(input string) (*PrivateLinkConnectionStatus, error) { + vals := map[string]PrivateLinkConnectionStatus{ + "approved": PrivateLinkConnectionStatusApproved, + "disconnected": PrivateLinkConnectionStatusDisconnected, + "pending": PrivateLinkConnectionStatusPending, + "rejected": PrivateLinkConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkConnectionStatus(input) + return &out, nil +} + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" + PublicNetworkAccessSecuredByPerimeter PublicNetworkAccess = "SecuredByPerimeter" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + string(PublicNetworkAccessSecuredByPerimeter), + } +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + "securedbyperimeter": PublicNetworkAccessSecuredByPerimeter, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameBasic SkuName = "Basic" + SkuNamePremium SkuName = "Premium" + SkuNameStandard SkuName = "Standard" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameBasic), + string(SkuNamePremium), + string(SkuNameStandard), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "basic": SkuNameBasic, + "premium": SkuNamePremium, + "standard": SkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierPremium SkuTier = "Premium" + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierPremium), + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "premium": SkuTierPremium, + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} + +type TlsVersion string + +const ( + TlsVersionOnePointOne TlsVersion = "1.1" + TlsVersionOnePointTwo TlsVersion = "1.2" + TlsVersionOnePointZero TlsVersion = "1.0" +) + +func PossibleValuesForTlsVersion() []string { + return []string{ + string(TlsVersionOnePointOne), + string(TlsVersionOnePointTwo), + string(TlsVersionOnePointZero), + } +} + +func parseTlsVersion(input string) (*TlsVersion, error) { + vals := map[string]TlsVersion{ + "1.1": TlsVersionOnePointOne, + "1.2": TlsVersionOnePointTwo, + "1.0": TlsVersionOnePointZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TlsVersion(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/id_namespace.go new file mode 100644 index 00000000000..dba614cfaf0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/id_namespace.go @@ -0,0 +1,124 @@ +package namespaces + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NamespaceId{} + +// NamespaceId is a struct representing the Resource ID for a Namespace +type NamespaceId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string +} + +// NewNamespaceID returns a new NamespaceId struct +func NewNamespaceID(subscriptionId string, resourceGroupName string, namespaceName string) NamespaceId { + return NamespaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + } +} + +// ParseNamespaceID parses 'input' into a NamespaceId +func ParseNamespaceID(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNamespaceIDInsensitively parses 'input' case-insensitively into a NamespaceId +// note: this method should only be used for API response data and not user input +func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID +func ValidateNamespaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNamespaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Namespace ID +func (id NamespaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventHub/namespaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Namespace ID +func (id NamespaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftEventHub", "Microsoft.EventHub", "Microsoft.EventHub"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + } +} + +// String returns a human-readable description of this Namespace ID +func (id NamespaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + } + return fmt.Sprintf("Namespace (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_createorupdate_autorest.go new file mode 100644 index 00000000000..44e30b453db --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c NamespacesClient) CreateOrUpdate(ctx context.Context, id NamespaceId, input EHNamespace) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c NamespacesClient) CreateOrUpdateThenPoll(ctx context.Context, id NamespaceId, input EHNamespace) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c NamespacesClient) preparerForCreateOrUpdate(ctx context.Context, id NamespaceId, input EHNamespace) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c NamespacesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_delete_autorest.go new file mode 100644 index 00000000000..968dfe754f2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_delete_autorest.go @@ -0,0 +1,78 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c NamespacesClient) Delete(ctx context.Context, id NamespaceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c NamespacesClient) DeleteThenPoll(ctx context.Context, id NamespaceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c NamespacesClient) preparerForDelete(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c NamespacesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_get_autorest.go new file mode 100644 index 00000000000..353d8898389 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_get_autorest.go @@ -0,0 +1,68 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *EHNamespace +} + +// Get ... +func (c NamespacesClient) Get(ctx context.Context, id NamespaceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c NamespacesClient) preparerForGet(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_list_autorest.go new file mode 100644 index 00000000000..5a7df04ecfd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_list_autorest.go @@ -0,0 +1,187 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]EHNamespace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []EHNamespace +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c NamespacesClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c NamespacesClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.EventHub/namespaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c NamespacesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []EHNamespace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c NamespacesClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, EHNamespaceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NamespacesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate EHNamespaceOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]EHNamespace, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..d655de7c1ac --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]EHNamespace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []EHNamespace +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c NamespacesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c NamespacesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.EventHub/namespaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c NamespacesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []EHNamespace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c NamespacesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, EHNamespaceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NamespacesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate EHNamespaceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]EHNamespace, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_update_autorest.go new file mode 100644 index 00000000000..2dce2d19638 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/method_update_autorest.go @@ -0,0 +1,69 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *EHNamespace +} + +// Update ... +func (c NamespacesClient) Update(ctx context.Context, id NamespaceId, input EHNamespace) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c NamespacesClient) preparerForUpdate(ctx context.Context, id NamespaceId, input EHNamespace) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_connectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_connectionstate.go new file mode 100644 index 00000000000..022aa980deb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_connectionstate.go @@ -0,0 +1,9 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectionState struct { + Description *string `json:"description,omitempty"` + Status *PrivateLinkConnectionStatus `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_ehnamespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_ehnamespace.go new file mode 100644 index 00000000000..17819eb7bf0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_ehnamespace.go @@ -0,0 +1,21 @@ +package namespaces + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EHNamespace struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *EHNamespaceProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_ehnamespaceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_ehnamespaceproperties.go new file mode 100644 index 00000000000..aad420d3c16 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_ehnamespaceproperties.go @@ -0,0 +1,54 @@ +package namespaces + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EHNamespaceProperties struct { + AlternateName *string `json:"alternateName,omitempty"` + ClusterArmId *string `json:"clusterArmId,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + Encryption *Encryption `json:"encryption,omitempty"` + IsAutoInflateEnabled *bool `json:"isAutoInflateEnabled,omitempty"` + KafkaEnabled *bool `json:"kafkaEnabled,omitempty"` + MaximumThroughputUnits *int64 `json:"maximumThroughputUnits,omitempty"` + MetricId *string `json:"metricId,omitempty"` + MinimumTlsVersion *TlsVersion `json:"minimumTlsVersion,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` + Status *string `json:"status,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` +} + +func (o *EHNamespaceProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *EHNamespaceProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *EHNamespaceProperties) GetUpdatedAtAsTime() (*time.Time, error) { + if o.UpdatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpdatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *EHNamespaceProperties) SetUpdatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpdatedAt = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_encryption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_encryption.go new file mode 100644 index 00000000000..c33fdbc6fad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_encryption.go @@ -0,0 +1,10 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Encryption struct { + KeySource *KeySource `json:"keySource,omitempty"` + KeyVaultProperties *[]KeyVaultProperties `json:"keyVaultProperties,omitempty"` + RequireInfrastructureEncryption *bool `json:"requireInfrastructureEncryption,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_keyvaultproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_keyvaultproperties.go new file mode 100644 index 00000000000..b0dfb9a4e06 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_keyvaultproperties.go @@ -0,0 +1,11 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultProperties struct { + Identity *UserAssignedIdentityProperties `json:"identity,omitempty"` + KeyName *string `json:"keyName,omitempty"` + KeyVaultUri *string `json:"keyVaultUri,omitempty"` + KeyVersion *string `json:"keyVersion,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_privateendpoint.go new file mode 100644 index 00000000000..3dec0387e5f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_privateendpoint.go @@ -0,0 +1,8 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_privateendpointconnection.go new file mode 100644 index 00000000000..58852b36e02 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_privateendpointconnection.go @@ -0,0 +1,17 @@ +package namespaces + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..e0aa15c5957 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *ConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *EndPointProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_sku.go new file mode 100644 index 00000000000..909b599f138 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_sku.go @@ -0,0 +1,10 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name SkuName `json:"name"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_userassignedidentityproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_userassignedidentityproperties.go new file mode 100644 index 00000000000..0685aa3ea14 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/model_userassignedidentityproperties.go @@ -0,0 +1,8 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserAssignedIdentityProperties struct { + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/predicates.go new file mode 100644 index 00000000000..da2e3acefe1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/predicates.go @@ -0,0 +1,29 @@ +package namespaces + +type EHNamespaceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p EHNamespaceOperationPredicate) Matches(input EHNamespace) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/version.go new file mode 100644 index 00000000000..c7efc2b68fa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces/version.go @@ -0,0 +1,12 @@ +package namespaces + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-01-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/namespaces/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/README.md new file mode 100644 index 00000000000..80e619aeaac --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/README.md @@ -0,0 +1,181 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers` Documentation + +The `fluidrelayservers` SDK allows for interaction with the Azure Resource Manager Service `fluidrelay` (API Version `2022-05-26`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers" +``` + + +### Client Initialization + +```go +client := fluidrelayservers.NewFluidRelayServersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `FluidRelayServersClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := fluidrelayservers.NewFluidRelayServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fluidRelayServerValue") + +payload := fluidrelayservers.FluidRelayServer{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FluidRelayServersClient.Delete` + +```go +ctx := context.TODO() +id := fluidrelayservers.NewFluidRelayServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fluidRelayServerValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FluidRelayServersClient.Get` + +```go +ctx := context.TODO() +id := fluidrelayservers.NewFluidRelayServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fluidRelayServerValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FluidRelayServersClient.GetKeys` + +```go +ctx := context.TODO() +id := fluidrelayservers.NewFluidRelayServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fluidRelayServerValue") + +read, err := client.GetKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FluidRelayServersClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := fluidrelayservers.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `FluidRelayServersClient.ListBySubscription` + +```go +ctx := context.TODO() +id := fluidrelayservers.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `FluidRelayServersClient.ListKeys` + +```go +ctx := context.TODO() +id := fluidrelayservers.NewFluidRelayServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fluidRelayServerValue") + +read, err := client.ListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FluidRelayServersClient.RegenerateKey` + +```go +ctx := context.TODO() +id := fluidrelayservers.NewFluidRelayServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fluidRelayServerValue") + +payload := fluidrelayservers.RegenerateKeyRequest{ + // ... +} + + +read, err := client.RegenerateKey(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FluidRelayServersClient.Update` + +```go +ctx := context.TODO() +id := fluidrelayservers.NewFluidRelayServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "fluidRelayServerValue") + +payload := fluidrelayservers.FluidRelayServerUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/client.go new file mode 100644 index 00000000000..bd29abddd02 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/client.go @@ -0,0 +1,18 @@ +package fluidrelayservers + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FluidRelayServersClient struct { + Client autorest.Client + baseUri string +} + +func NewFluidRelayServersClientWithBaseURI(endpoint string) FluidRelayServersClient { + return FluidRelayServersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/constants.go new file mode 100644 index 00000000000..1d0e44d42c6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/constants.go @@ -0,0 +1,121 @@ +package fluidrelayservers + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CmkIdentityType string + +const ( + CmkIdentityTypeSystemAssigned CmkIdentityType = "SystemAssigned" + CmkIdentityTypeUserAssigned CmkIdentityType = "UserAssigned" +) + +func PossibleValuesForCmkIdentityType() []string { + return []string{ + string(CmkIdentityTypeSystemAssigned), + string(CmkIdentityTypeUserAssigned), + } +} + +func parseCmkIdentityType(input string) (*CmkIdentityType, error) { + vals := map[string]CmkIdentityType{ + "systemassigned": CmkIdentityTypeSystemAssigned, + "userassigned": CmkIdentityTypeUserAssigned, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CmkIdentityType(input) + return &out, nil +} + +type KeyName string + +const ( + KeyNameKeyOne KeyName = "key1" + KeyNameKeyTwo KeyName = "key2" +) + +func PossibleValuesForKeyName() []string { + return []string{ + string(KeyNameKeyOne), + string(KeyNameKeyTwo), + } +} + +func parseKeyName(input string) (*KeyName, error) { + vals := map[string]KeyName{ + "key1": KeyNameKeyOne, + "key2": KeyNameKeyTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyName(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type StorageSKU string + +const ( + StorageSKUBasic StorageSKU = "basic" + StorageSKUStandard StorageSKU = "standard" +) + +func PossibleValuesForStorageSKU() []string { + return []string{ + string(StorageSKUBasic), + string(StorageSKUStandard), + } +} + +func parseStorageSKU(input string) (*StorageSKU, error) { + vals := map[string]StorageSKU{ + "basic": StorageSKUBasic, + "standard": StorageSKUStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageSKU(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/id_fluidrelayserver.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/id_fluidrelayserver.go new file mode 100644 index 00000000000..bc41376a292 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/id_fluidrelayserver.go @@ -0,0 +1,124 @@ +package fluidrelayservers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FluidRelayServerId{} + +// FluidRelayServerId is a struct representing the Resource ID for a Fluid Relay Server +type FluidRelayServerId struct { + SubscriptionId string + ResourceGroup string + FluidRelayServerName string +} + +// NewFluidRelayServerID returns a new FluidRelayServerId struct +func NewFluidRelayServerID(subscriptionId string, resourceGroup string, fluidRelayServerName string) FluidRelayServerId { + return FluidRelayServerId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + FluidRelayServerName: fluidRelayServerName, + } +} + +// ParseFluidRelayServerID parses 'input' into a FluidRelayServerId +func ParseFluidRelayServerID(input string) (*FluidRelayServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FluidRelayServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FluidRelayServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.FluidRelayServerName, ok = parsed.Parsed["fluidRelayServerName"]; !ok { + return nil, fmt.Errorf("the segment 'fluidRelayServerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFluidRelayServerIDInsensitively parses 'input' case-insensitively into a FluidRelayServerId +// note: this method should only be used for API response data and not user input +func ParseFluidRelayServerIDInsensitively(input string) (*FluidRelayServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FluidRelayServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FluidRelayServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) + } + + if id.FluidRelayServerName, ok = parsed.Parsed["fluidRelayServerName"]; !ok { + return nil, fmt.Errorf("the segment 'fluidRelayServerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFluidRelayServerID checks that 'input' can be parsed as a Fluid Relay Server ID +func ValidateFluidRelayServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFluidRelayServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Fluid Relay Server ID +func (id FluidRelayServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.FluidRelay/fluidRelayServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.FluidRelayServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Fluid Relay Server ID +func (id FluidRelayServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftFluidRelay", "Microsoft.FluidRelay", "Microsoft.FluidRelay"), + resourceids.StaticSegment("staticFluidRelayServers", "fluidRelayServers", "fluidRelayServers"), + resourceids.UserSpecifiedSegment("fluidRelayServerName", "fluidRelayServerValue"), + } +} + +// String returns a human-readable description of this Fluid Relay Server ID +func (id FluidRelayServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group: %q", id.ResourceGroup), + fmt.Sprintf("Fluid Relay Server Name: %q", id.FluidRelayServerName), + } + return fmt.Sprintf("Fluid Relay Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_createorupdate_autorest.go new file mode 100644 index 00000000000..5929e57d680 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package fluidrelayservers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *FluidRelayServer +} + +// CreateOrUpdate ... +func (c FluidRelayServersClient) CreateOrUpdate(ctx context.Context, id FluidRelayServerId, input FluidRelayServer) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c FluidRelayServersClient) preparerForCreateOrUpdate(ctx context.Context, id FluidRelayServerId, input FluidRelayServer) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c FluidRelayServersClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_delete_autorest.go new file mode 100644 index 00000000000..ce5053850ff --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_delete_autorest.go @@ -0,0 +1,66 @@ +package fluidrelayservers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c FluidRelayServersClient) Delete(ctx context.Context, id FluidRelayServerId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c FluidRelayServersClient) preparerForDelete(ctx context.Context, id FluidRelayServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c FluidRelayServersClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_get_autorest.go new file mode 100644 index 00000000000..86ec21ed203 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_get_autorest.go @@ -0,0 +1,68 @@ +package fluidrelayservers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *FluidRelayServer +} + +// Get ... +func (c FluidRelayServersClient) Get(ctx context.Context, id FluidRelayServerId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c FluidRelayServersClient) preparerForGet(ctx context.Context, id FluidRelayServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c FluidRelayServersClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_getkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_getkeys_autorest.go new file mode 100644 index 00000000000..96567716e58 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_getkeys_autorest.go @@ -0,0 +1,69 @@ +package fluidrelayservers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetKeysOperationResponse struct { + HttpResponse *http.Response + Model *FluidRelayServerKeys +} + +// GetKeys ... +func (c FluidRelayServersClient) GetKeys(ctx context.Context, id FluidRelayServerId) (result GetKeysOperationResponse, err error) { + req, err := c.preparerForGetKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "GetKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "GetKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "GetKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetKeys prepares the GetKeys request. +func (c FluidRelayServersClient) preparerForGetKeys(ctx context.Context, id FluidRelayServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/getKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetKeys handles the response to the GetKeys request. The method always +// closes the http.Response Body. +func (c FluidRelayServersClient) responderForGetKeys(resp *http.Response) (result GetKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..467395fe52f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package fluidrelayservers + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]FluidRelayServer + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []FluidRelayServer +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c FluidRelayServersClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c FluidRelayServersClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.FluidRelay/fluidRelayServers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c FluidRelayServersClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c FluidRelayServersClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []FluidRelayServer `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c FluidRelayServersClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, FluidRelayServerOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c FluidRelayServersClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate FluidRelayServerOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]FluidRelayServer, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..99736adb460 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package fluidrelayservers + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]FluidRelayServer + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []FluidRelayServer +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c FluidRelayServersClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c FluidRelayServersClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.FluidRelay/fluidRelayServers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c FluidRelayServersClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c FluidRelayServersClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []FluidRelayServer `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c FluidRelayServersClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, FluidRelayServerOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c FluidRelayServersClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate FluidRelayServerOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]FluidRelayServer, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_listkeys_autorest.go new file mode 100644 index 00000000000..ebb54f6d9d1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_listkeys_autorest.go @@ -0,0 +1,69 @@ +package fluidrelayservers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeysOperationResponse struct { + HttpResponse *http.Response + Model *FluidRelayServerKeys +} + +// ListKeys ... +func (c FluidRelayServersClient) ListKeys(ctx context.Context, id FluidRelayServerId) (result ListKeysOperationResponse, err error) { + req, err := c.preparerForListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "ListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "ListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "ListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListKeys prepares the ListKeys request. +func (c FluidRelayServersClient) preparerForListKeys(ctx context.Context, id FluidRelayServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListKeys handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (c FluidRelayServersClient) responderForListKeys(resp *http.Response) (result ListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_regeneratekey_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_regeneratekey_autorest.go new file mode 100644 index 00000000000..62289520159 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_regeneratekey_autorest.go @@ -0,0 +1,70 @@ +package fluidrelayservers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyOperationResponse struct { + HttpResponse *http.Response + Model *FluidRelayServerKeys +} + +// RegenerateKey ... +func (c FluidRelayServersClient) RegenerateKey(ctx context.Context, id FluidRelayServerId, input RegenerateKeyRequest) (result RegenerateKeyOperationResponse, err error) { + req, err := c.preparerForRegenerateKey(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "RegenerateKey", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRegenerateKey(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "RegenerateKey", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRegenerateKey prepares the RegenerateKey request. +func (c FluidRelayServersClient) preparerForRegenerateKey(ctx context.Context, id FluidRelayServerId, input RegenerateKeyRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKey", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRegenerateKey handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (c FluidRelayServersClient) responderForRegenerateKey(resp *http.Response) (result RegenerateKeyOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_update_autorest.go new file mode 100644 index 00000000000..93c943d680c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/method_update_autorest.go @@ -0,0 +1,69 @@ +package fluidrelayservers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *FluidRelayServer +} + +// Update ... +func (c FluidRelayServersClient) Update(ctx context.Context, id FluidRelayServerId, input FluidRelayServerUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "fluidrelayservers.FluidRelayServersClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c FluidRelayServersClient) preparerForUpdate(ctx context.Context, id FluidRelayServerId, input FluidRelayServerUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c FluidRelayServersClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_customermanagedkeyencryptionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_customermanagedkeyencryptionproperties.go new file mode 100644 index 00000000000..c901b57f909 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_customermanagedkeyencryptionproperties.go @@ -0,0 +1,9 @@ +package fluidrelayservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomerManagedKeyEncryptionProperties struct { + KeyEncryptionKeyIdentity *CustomerManagedKeyEncryptionPropertiesKeyEncryptionKeyIdentity `json:"keyEncryptionKeyIdentity,omitempty"` + KeyEncryptionKeyUrl *string `json:"keyEncryptionKeyUrl,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_customermanagedkeyencryptionpropertieskeyencryptionkeyidentity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_customermanagedkeyencryptionpropertieskeyencryptionkeyidentity.go new file mode 100644 index 00000000000..a14936a4cb8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_customermanagedkeyencryptionpropertieskeyencryptionkeyidentity.go @@ -0,0 +1,9 @@ +package fluidrelayservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomerManagedKeyEncryptionPropertiesKeyEncryptionKeyIdentity struct { + IdentityType *CmkIdentityType `json:"identityType,omitempty"` + UserAssignedIdentityResourceId *string `json:"userAssignedIdentityResourceId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_encryptionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_encryptionproperties.go new file mode 100644 index 00000000000..ebb20890ac6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_encryptionproperties.go @@ -0,0 +1,8 @@ +package fluidrelayservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionProperties struct { + CustomerManagedKeyEncryption *CustomerManagedKeyEncryptionProperties `json:"customerManagedKeyEncryption,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayendpoints.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayendpoints.go new file mode 100644 index 00000000000..7d6f78c08fb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayendpoints.go @@ -0,0 +1,10 @@ +package fluidrelayservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FluidRelayEndpoints struct { + OrdererEndpoints *[]string `json:"ordererEndpoints,omitempty"` + ServiceEndpoints *[]string `json:"serviceEndpoints,omitempty"` + StorageEndpoints *[]string `json:"storageEndpoints,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayserver.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayserver.go new file mode 100644 index 00000000000..2295c002065 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayserver.go @@ -0,0 +1,20 @@ +package fluidrelayservers + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FluidRelayServer struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *FluidRelayServerProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayserverkeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayserverkeys.go new file mode 100644 index 00000000000..d70edabd7a0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayserverkeys.go @@ -0,0 +1,9 @@ +package fluidrelayservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FluidRelayServerKeys struct { + Key1 *string `json:"key1,omitempty"` + Key2 *string `json:"key2,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayserverproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayserverproperties.go new file mode 100644 index 00000000000..1c430eab5e3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayserverproperties.go @@ -0,0 +1,12 @@ +package fluidrelayservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FluidRelayServerProperties struct { + Encryption *EncryptionProperties `json:"encryption,omitempty"` + FluidRelayEndpoints *FluidRelayEndpoints `json:"fluidRelayEndpoints,omitempty"` + FrsTenantId *string `json:"frsTenantId,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Storagesku *StorageSKU `json:"storagesku,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayserverupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayserverupdate.go new file mode 100644 index 00000000000..51e0c55443f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayserverupdate.go @@ -0,0 +1,15 @@ +package fluidrelayservers + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FluidRelayServerUpdate struct { + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Properties *FluidRelayServerUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayserverupdateproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayserverupdateproperties.go new file mode 100644 index 00000000000..d150ca43a28 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_fluidrelayserverupdateproperties.go @@ -0,0 +1,8 @@ +package fluidrelayservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FluidRelayServerUpdateProperties struct { + Encryption *EncryptionProperties `json:"encryption,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_regeneratekeyrequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_regeneratekeyrequest.go new file mode 100644 index 00000000000..1aad29b6994 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/model_regeneratekeyrequest.go @@ -0,0 +1,8 @@ +package fluidrelayservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyRequest struct { + KeyName KeyName `json:"keyName"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/predicates.go new file mode 100644 index 00000000000..e618e42269b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/predicates.go @@ -0,0 +1,29 @@ +package fluidrelayservers + +type FluidRelayServerOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p FluidRelayServerOperationPredicate) Matches(input FluidRelayServer) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/version.go new file mode 100644 index 00000000000..7664a0458cc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/version.go @@ -0,0 +1,12 @@ +package fluidrelayservers + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-05-26" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/fluidrelayservers/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/README.md new file mode 100644 index 00000000000..2b50bf70298 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/README.md @@ -0,0 +1,133 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms` Documentation + +The `dedicatedhsms` SDK allows for interaction with the Azure Resource Manager Service `hardwaresecuritymodules` (API Version `2021-11-30`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms" +``` + + +### Client Initialization + +```go +client := dedicatedhsms.NewDedicatedHsmsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DedicatedHsmsClient.DedicatedHsmCreateOrUpdate` + +```go +ctx := context.TODO() +id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nameValue") + +payload := dedicatedhsms.DedicatedHsm{ + // ... +} + + +if err := client.DedicatedHsmCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DedicatedHsmsClient.DedicatedHsmDelete` + +```go +ctx := context.TODO() +id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nameValue") + +if err := client.DedicatedHsmDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DedicatedHsmsClient.DedicatedHsmGet` + +```go +ctx := context.TODO() +id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nameValue") + +read, err := client.DedicatedHsmGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DedicatedHsmsClient.DedicatedHsmListByResourceGroup` + +```go +ctx := context.TODO() +id := dedicatedhsms.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.DedicatedHsmListByResourceGroup(ctx, id, dedicatedhsms.DefaultDedicatedHsmListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.DedicatedHsmListByResourceGroupComplete(ctx, id, dedicatedhsms.DefaultDedicatedHsmListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DedicatedHsmsClient.DedicatedHsmListBySubscription` + +```go +ctx := context.TODO() +id := dedicatedhsms.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.DedicatedHsmListBySubscription(ctx, id, dedicatedhsms.DefaultDedicatedHsmListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.DedicatedHsmListBySubscriptionComplete(ctx, id, dedicatedhsms.DefaultDedicatedHsmListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DedicatedHsmsClient.DedicatedHsmListOutboundNetworkDependenciesEndpoints` + +```go +ctx := context.TODO() +id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nameValue") + +// alternatively `client.DedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx, id)` can be used to do batched pagination +items, err := client.DedicatedHsmListOutboundNetworkDependenciesEndpointsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DedicatedHsmsClient.DedicatedHsmUpdate` + +```go +ctx := context.TODO() +id := dedicatedhsms.NewDedicatedHSMID("12345678-1234-9876-4563-123456789012", "example-resource-group", "nameValue") + +payload := dedicatedhsms.DedicatedHsmPatchParameters{ + // ... +} + + +if err := client.DedicatedHsmUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/client.go new file mode 100644 index 00000000000..186b5df4b1a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/client.go @@ -0,0 +1,18 @@ +package dedicatedhsms + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmsClient struct { + Client autorest.Client + baseUri string +} + +func NewDedicatedHsmsClientWithBaseURI(endpoint string) DedicatedHsmsClient { + return DedicatedHsmsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/constants.go new file mode 100644 index 00000000000..f81a04d3248 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/constants.go @@ -0,0 +1,92 @@ +package dedicatedhsms + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type JsonWebKeyType string + +const ( + JsonWebKeyTypeAllocating JsonWebKeyType = "Allocating" + JsonWebKeyTypeCheckingQuota JsonWebKeyType = "CheckingQuota" + JsonWebKeyTypeConnecting JsonWebKeyType = "Connecting" + JsonWebKeyTypeDeleting JsonWebKeyType = "Deleting" + JsonWebKeyTypeFailed JsonWebKeyType = "Failed" + JsonWebKeyTypeProvisioning JsonWebKeyType = "Provisioning" + JsonWebKeyTypeSucceeded JsonWebKeyType = "Succeeded" +) + +func PossibleValuesForJsonWebKeyType() []string { + return []string{ + string(JsonWebKeyTypeAllocating), + string(JsonWebKeyTypeCheckingQuota), + string(JsonWebKeyTypeConnecting), + string(JsonWebKeyTypeDeleting), + string(JsonWebKeyTypeFailed), + string(JsonWebKeyTypeProvisioning), + string(JsonWebKeyTypeSucceeded), + } +} + +func parseJsonWebKeyType(input string) (*JsonWebKeyType, error) { + vals := map[string]JsonWebKeyType{ + "allocating": JsonWebKeyTypeAllocating, + "checkingquota": JsonWebKeyTypeCheckingQuota, + "connecting": JsonWebKeyTypeConnecting, + "deleting": JsonWebKeyTypeDeleting, + "failed": JsonWebKeyTypeFailed, + "provisioning": JsonWebKeyTypeProvisioning, + "succeeded": JsonWebKeyTypeSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := JsonWebKeyType(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNamePayShieldOneZeroKLMKOneCPSSixZero SkuName = "payShield10K_LMK1_CPS60" + SkuNamePayShieldOneZeroKLMKOneCPSTwoFiveZero SkuName = "payShield10K_LMK1_CPS250" + SkuNamePayShieldOneZeroKLMKOneCPSTwoFiveZeroZero SkuName = "payShield10K_LMK1_CPS2500" + SkuNamePayShieldOneZeroKLMKTwoCPSSixZero SkuName = "payShield10K_LMK2_CPS60" + SkuNamePayShieldOneZeroKLMKTwoCPSTwoFiveZero SkuName = "payShield10K_LMK2_CPS250" + SkuNamePayShieldOneZeroKLMKTwoCPSTwoFiveZeroZero SkuName = "payShield10K_LMK2_CPS2500" + SkuNameSafeNetLunaNetworkHSMASevenNineZero SkuName = "SafeNet Luna Network HSM A790" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNamePayShieldOneZeroKLMKOneCPSSixZero), + string(SkuNamePayShieldOneZeroKLMKOneCPSTwoFiveZero), + string(SkuNamePayShieldOneZeroKLMKOneCPSTwoFiveZeroZero), + string(SkuNamePayShieldOneZeroKLMKTwoCPSSixZero), + string(SkuNamePayShieldOneZeroKLMKTwoCPSTwoFiveZero), + string(SkuNamePayShieldOneZeroKLMKTwoCPSTwoFiveZeroZero), + string(SkuNameSafeNetLunaNetworkHSMASevenNineZero), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "payshield10k_lmk1_cps60": SkuNamePayShieldOneZeroKLMKOneCPSSixZero, + "payshield10k_lmk1_cps250": SkuNamePayShieldOneZeroKLMKOneCPSTwoFiveZero, + "payshield10k_lmk1_cps2500": SkuNamePayShieldOneZeroKLMKOneCPSTwoFiveZeroZero, + "payshield10k_lmk2_cps60": SkuNamePayShieldOneZeroKLMKTwoCPSSixZero, + "payshield10k_lmk2_cps250": SkuNamePayShieldOneZeroKLMKTwoCPSTwoFiveZero, + "payshield10k_lmk2_cps2500": SkuNamePayShieldOneZeroKLMKTwoCPSTwoFiveZeroZero, + "safenet luna network hsm a790": SkuNameSafeNetLunaNetworkHSMASevenNineZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/id_dedicatedhsm.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/id_dedicatedhsm.go new file mode 100644 index 00000000000..04dc52c6356 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/id_dedicatedhsm.go @@ -0,0 +1,124 @@ +package dedicatedhsms + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DedicatedHSMId{} + +// DedicatedHSMId is a struct representing the Resource ID for a Dedicated H S M +type DedicatedHSMId struct { + SubscriptionId string + ResourceGroupName string + Name string +} + +// NewDedicatedHSMID returns a new DedicatedHSMId struct +func NewDedicatedHSMID(subscriptionId string, resourceGroupName string, name string) DedicatedHSMId { + return DedicatedHSMId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + Name: name, + } +} + +// ParseDedicatedHSMID parses 'input' into a DedicatedHSMId +func ParseDedicatedHSMID(input string) (*DedicatedHSMId, error) { + parser := resourceids.NewParserFromResourceIdType(DedicatedHSMId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DedicatedHSMId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.Name, ok = parsed.Parsed["name"]; !ok { + return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDedicatedHSMIDInsensitively parses 'input' case-insensitively into a DedicatedHSMId +// note: this method should only be used for API response data and not user input +func ParseDedicatedHSMIDInsensitively(input string) (*DedicatedHSMId, error) { + parser := resourceids.NewParserFromResourceIdType(DedicatedHSMId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DedicatedHSMId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.Name, ok = parsed.Parsed["name"]; !ok { + return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDedicatedHSMID checks that 'input' can be parsed as a Dedicated H S M ID +func ValidateDedicatedHSMID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDedicatedHSMID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Dedicated H S M ID +func (id DedicatedHSMId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.Name) +} + +// Segments returns a slice of Resource ID Segments which comprise this Dedicated H S M ID +func (id DedicatedHSMId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftHardwareSecurityModules", "Microsoft.HardwareSecurityModules", "Microsoft.HardwareSecurityModules"), + resourceids.StaticSegment("staticDedicatedHSMs", "dedicatedHSMs", "dedicatedHSMs"), + resourceids.UserSpecifiedSegment("name", "nameValue"), + } +} + +// String returns a human-readable description of this Dedicated H S M ID +func (id DedicatedHSMId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Name: %q", id.Name), + } + return fmt.Sprintf("Dedicated H S M (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmcreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmcreateorupdate_autorest.go new file mode 100644 index 00000000000..e5ccb166ebf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmcreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package dedicatedhsms + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DedicatedHsmCreateOrUpdate ... +func (c DedicatedHsmsClient) DedicatedHsmCreateOrUpdate(ctx context.Context, id DedicatedHSMId, input DedicatedHsm) (result DedicatedHsmCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForDedicatedHsmCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DedicatedHsmCreateOrUpdateThenPoll performs DedicatedHsmCreateOrUpdate then polls until it's completed +func (c DedicatedHsmsClient) DedicatedHsmCreateOrUpdateThenPoll(ctx context.Context, id DedicatedHSMId, input DedicatedHsm) error { + result, err := c.DedicatedHsmCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DedicatedHsmCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DedicatedHsmCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForDedicatedHsmCreateOrUpdate prepares the DedicatedHsmCreateOrUpdate request. +func (c DedicatedHsmsClient) preparerForDedicatedHsmCreateOrUpdate(ctx context.Context, id DedicatedHSMId, input DedicatedHsm) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDedicatedHsmCreateOrUpdate sends the DedicatedHsmCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c DedicatedHsmsClient) senderForDedicatedHsmCreateOrUpdate(ctx context.Context, req *http.Request) (future DedicatedHsmCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmdelete_autorest.go new file mode 100644 index 00000000000..3df0fbb5545 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmdelete_autorest.go @@ -0,0 +1,78 @@ +package dedicatedhsms + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DedicatedHsmDelete ... +func (c DedicatedHsmsClient) DedicatedHsmDelete(ctx context.Context, id DedicatedHSMId) (result DedicatedHsmDeleteOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDedicatedHsmDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DedicatedHsmDeleteThenPoll performs DedicatedHsmDelete then polls until it's completed +func (c DedicatedHsmsClient) DedicatedHsmDeleteThenPoll(ctx context.Context, id DedicatedHSMId) error { + result, err := c.DedicatedHsmDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing DedicatedHsmDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DedicatedHsmDelete: %+v", err) + } + + return nil +} + +// preparerForDedicatedHsmDelete prepares the DedicatedHsmDelete request. +func (c DedicatedHsmsClient) preparerForDedicatedHsmDelete(ctx context.Context, id DedicatedHSMId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDedicatedHsmDelete sends the DedicatedHsmDelete request. The method will close the +// http.Response Body if it receives an error. +func (c DedicatedHsmsClient) senderForDedicatedHsmDelete(ctx context.Context, req *http.Request) (future DedicatedHsmDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmget_autorest.go new file mode 100644 index 00000000000..b0de63aecbc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmget_autorest.go @@ -0,0 +1,68 @@ +package dedicatedhsms + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmGetOperationResponse struct { + HttpResponse *http.Response + Model *DedicatedHsm +} + +// DedicatedHsmGet ... +func (c DedicatedHsmsClient) DedicatedHsmGet(ctx context.Context, id DedicatedHSMId) (result DedicatedHsmGetOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDedicatedHsmGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDedicatedHsmGet prepares the DedicatedHsmGet request. +func (c DedicatedHsmsClient) preparerForDedicatedHsmGet(ctx context.Context, id DedicatedHSMId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDedicatedHsmGet handles the response to the DedicatedHsmGet request. The method always +// closes the http.Response Body. +func (c DedicatedHsmsClient) responderForDedicatedHsmGet(resp *http.Response) (result DedicatedHsmGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbyresourcegroup_autorest.go new file mode 100644 index 00000000000..a0582dfc6f6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbyresourcegroup_autorest.go @@ -0,0 +1,216 @@ +package dedicatedhsms + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]DedicatedHsm + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (DedicatedHsmListByResourceGroupOperationResponse, error) +} + +type DedicatedHsmListByResourceGroupCompleteResult struct { + Items []DedicatedHsm +} + +func (r DedicatedHsmListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r DedicatedHsmListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp DedicatedHsmListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type DedicatedHsmListByResourceGroupOperationOptions struct { + Top *int64 +} + +func DefaultDedicatedHsmListByResourceGroupOperationOptions() DedicatedHsmListByResourceGroupOperationOptions { + return DedicatedHsmListByResourceGroupOperationOptions{} +} + +func (o DedicatedHsmListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o DedicatedHsmListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// DedicatedHsmListByResourceGroup ... +func (c DedicatedHsmsClient) DedicatedHsmListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options DedicatedHsmListByResourceGroupOperationOptions) (resp DedicatedHsmListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmListByResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForDedicatedHsmListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForDedicatedHsmListByResourceGroup prepares the DedicatedHsmListByResourceGroup request. +func (c DedicatedHsmsClient) preparerForDedicatedHsmListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options DedicatedHsmListByResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForDedicatedHsmListByResourceGroupWithNextLink prepares the DedicatedHsmListByResourceGroup request with the given nextLink token. +func (c DedicatedHsmsClient) preparerForDedicatedHsmListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDedicatedHsmListByResourceGroup handles the response to the DedicatedHsmListByResourceGroup request. The method always +// closes the http.Response Body. +func (c DedicatedHsmsClient) responderForDedicatedHsmListByResourceGroup(resp *http.Response) (result DedicatedHsmListByResourceGroupOperationResponse, err error) { + type page struct { + Values []DedicatedHsm `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result DedicatedHsmListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDedicatedHsmListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// DedicatedHsmListByResourceGroupComplete retrieves all of the results into a single object +func (c DedicatedHsmsClient) DedicatedHsmListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options DedicatedHsmListByResourceGroupOperationOptions) (DedicatedHsmListByResourceGroupCompleteResult, error) { + return c.DedicatedHsmListByResourceGroupCompleteMatchingPredicate(ctx, id, options, DedicatedHsmOperationPredicate{}) +} + +// DedicatedHsmListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DedicatedHsmsClient) DedicatedHsmListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options DedicatedHsmListByResourceGroupOperationOptions, predicate DedicatedHsmOperationPredicate) (resp DedicatedHsmListByResourceGroupCompleteResult, err error) { + items := make([]DedicatedHsm, 0) + + page, err := c.DedicatedHsmListByResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := DedicatedHsmListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbysubscription_autorest.go new file mode 100644 index 00000000000..60a98583728 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistbysubscription_autorest.go @@ -0,0 +1,216 @@ +package dedicatedhsms + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]DedicatedHsm + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (DedicatedHsmListBySubscriptionOperationResponse, error) +} + +type DedicatedHsmListBySubscriptionCompleteResult struct { + Items []DedicatedHsm +} + +func (r DedicatedHsmListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r DedicatedHsmListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp DedicatedHsmListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type DedicatedHsmListBySubscriptionOperationOptions struct { + Top *int64 +} + +func DefaultDedicatedHsmListBySubscriptionOperationOptions() DedicatedHsmListBySubscriptionOperationOptions { + return DedicatedHsmListBySubscriptionOperationOptions{} +} + +func (o DedicatedHsmListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o DedicatedHsmListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// DedicatedHsmListBySubscription ... +func (c DedicatedHsmsClient) DedicatedHsmListBySubscription(ctx context.Context, id commonids.SubscriptionId, options DedicatedHsmListBySubscriptionOperationOptions) (resp DedicatedHsmListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmListBySubscription(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForDedicatedHsmListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForDedicatedHsmListBySubscription prepares the DedicatedHsmListBySubscription request. +func (c DedicatedHsmsClient) preparerForDedicatedHsmListBySubscription(ctx context.Context, id commonids.SubscriptionId, options DedicatedHsmListBySubscriptionOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForDedicatedHsmListBySubscriptionWithNextLink prepares the DedicatedHsmListBySubscription request with the given nextLink token. +func (c DedicatedHsmsClient) preparerForDedicatedHsmListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDedicatedHsmListBySubscription handles the response to the DedicatedHsmListBySubscription request. The method always +// closes the http.Response Body. +func (c DedicatedHsmsClient) responderForDedicatedHsmListBySubscription(resp *http.Response) (result DedicatedHsmListBySubscriptionOperationResponse, err error) { + type page struct { + Values []DedicatedHsm `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result DedicatedHsmListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDedicatedHsmListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// DedicatedHsmListBySubscriptionComplete retrieves all of the results into a single object +func (c DedicatedHsmsClient) DedicatedHsmListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options DedicatedHsmListBySubscriptionOperationOptions) (DedicatedHsmListBySubscriptionCompleteResult, error) { + return c.DedicatedHsmListBySubscriptionCompleteMatchingPredicate(ctx, id, options, DedicatedHsmOperationPredicate{}) +} + +// DedicatedHsmListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DedicatedHsmsClient) DedicatedHsmListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options DedicatedHsmListBySubscriptionOperationOptions, predicate DedicatedHsmOperationPredicate) (resp DedicatedHsmListBySubscriptionCompleteResult, err error) { + items := make([]DedicatedHsm, 0) + + page, err := c.DedicatedHsmListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := DedicatedHsmListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistoutboundnetworkdependenciesendpoints_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistoutboundnetworkdependenciesendpoints_autorest.go new file mode 100644 index 00000000000..5444b844daf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmlistoutboundnetworkdependenciesendpoints_autorest.go @@ -0,0 +1,186 @@ +package dedicatedhsms + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse struct { + HttpResponse *http.Response + Model *[]OutboundEnvironmentEndpoint + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, error) +} + +type DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult struct { + Items []OutboundEnvironmentEndpoint +} + +func (r DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse) LoadMore(ctx context.Context) (resp DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// DedicatedHsmListOutboundNetworkDependenciesEndpoints ... +func (c DedicatedHsmsClient) DedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx context.Context, id DedicatedHSMId) (resp DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForDedicatedHsmListOutboundNetworkDependenciesEndpoints(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForDedicatedHsmListOutboundNetworkDependenciesEndpoints prepares the DedicatedHsmListOutboundNetworkDependenciesEndpoints request. +func (c DedicatedHsmsClient) preparerForDedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx context.Context, id DedicatedHSMId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/outboundNetworkDependenciesEndpoints", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForDedicatedHsmListOutboundNetworkDependenciesEndpointsWithNextLink prepares the DedicatedHsmListOutboundNetworkDependenciesEndpoints request with the given nextLink token. +func (c DedicatedHsmsClient) preparerForDedicatedHsmListOutboundNetworkDependenciesEndpointsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDedicatedHsmListOutboundNetworkDependenciesEndpoints handles the response to the DedicatedHsmListOutboundNetworkDependenciesEndpoints request. The method always +// closes the http.Response Body. +func (c DedicatedHsmsClient) responderForDedicatedHsmListOutboundNetworkDependenciesEndpoints(resp *http.Response) (result DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + type page struct { + Values []OutboundEnvironmentEndpoint `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result DedicatedHsmListOutboundNetworkDependenciesEndpointsOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmListOutboundNetworkDependenciesEndpointsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDedicatedHsmListOutboundNetworkDependenciesEndpoints(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmListOutboundNetworkDependenciesEndpoints", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// DedicatedHsmListOutboundNetworkDependenciesEndpointsComplete retrieves all of the results into a single object +func (c DedicatedHsmsClient) DedicatedHsmListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, id DedicatedHSMId) (DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult, error) { + return c.DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx, id, OutboundEnvironmentEndpointOperationPredicate{}) +} + +// DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DedicatedHsmsClient) DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteMatchingPredicate(ctx context.Context, id DedicatedHSMId, predicate OutboundEnvironmentEndpointOperationPredicate) (resp DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult, err error) { + items := make([]OutboundEnvironmentEndpoint, 0) + + page, err := c.DedicatedHsmListOutboundNetworkDependenciesEndpoints(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := DedicatedHsmListOutboundNetworkDependenciesEndpointsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmupdate_autorest.go new file mode 100644 index 00000000000..da7dcc6070d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/method_dedicatedhsmupdate_autorest.go @@ -0,0 +1,79 @@ +package dedicatedhsms + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DedicatedHsmUpdate ... +func (c DedicatedHsmsClient) DedicatedHsmUpdate(ctx context.Context, id DedicatedHSMId, input DedicatedHsmPatchParameters) (result DedicatedHsmUpdateOperationResponse, err error) { + req, err := c.preparerForDedicatedHsmUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForDedicatedHsmUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "dedicatedhsms.DedicatedHsmsClient", "DedicatedHsmUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DedicatedHsmUpdateThenPoll performs DedicatedHsmUpdate then polls until it's completed +func (c DedicatedHsmsClient) DedicatedHsmUpdateThenPoll(ctx context.Context, id DedicatedHSMId, input DedicatedHsmPatchParameters) error { + result, err := c.DedicatedHsmUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DedicatedHsmUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DedicatedHsmUpdate: %+v", err) + } + + return nil +} + +// preparerForDedicatedHsmUpdate prepares the DedicatedHsmUpdate request. +func (c DedicatedHsmsClient) preparerForDedicatedHsmUpdate(ctx context.Context, id DedicatedHSMId, input DedicatedHsmPatchParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDedicatedHsmUpdate sends the DedicatedHsmUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c DedicatedHsmsClient) senderForDedicatedHsmUpdate(ctx context.Context, req *http.Request) (future DedicatedHsmUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_apientityreference.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_apientityreference.go new file mode 100644 index 00000000000..8ad37fa56d2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_apientityreference.go @@ -0,0 +1,8 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiEntityReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsm.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsm.go new file mode 100644 index 00000000000..2d8a463e1f7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsm.go @@ -0,0 +1,20 @@ +package dedicatedhsms + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsm struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties DedicatedHsmProperties `json:"properties"` + Sku Sku `json:"sku"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsmpatchparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsmpatchparameters.go new file mode 100644 index 00000000000..86d8d0a762b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsmpatchparameters.go @@ -0,0 +1,8 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmPatchParameters struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsmproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsmproperties.go new file mode 100644 index 00000000000..089c6740f27 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_dedicatedhsmproperties.go @@ -0,0 +1,12 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHsmProperties struct { + ManagementNetworkProfile *NetworkProfile `json:"managementNetworkProfile,omitempty"` + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + ProvisioningState *JsonWebKeyType `json:"provisioningState,omitempty"` + StampId *string `json:"stampId,omitempty"` + StatusMessage *string `json:"statusMessage,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_endpointdependency.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_endpointdependency.go new file mode 100644 index 00000000000..8d0101e5200 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_endpointdependency.go @@ -0,0 +1,9 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointDependency struct { + DomainName *string `json:"domainName,omitempty"` + EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_endpointdetail.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_endpointdetail.go new file mode 100644 index 00000000000..981bf57daeb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_endpointdetail.go @@ -0,0 +1,11 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointDetail struct { + Description *string `json:"description,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + Port *int64 `json:"port,omitempty"` + Protocol *string `json:"protocol,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_networkinterface.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_networkinterface.go new file mode 100644 index 00000000000..6e817b138ff --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_networkinterface.go @@ -0,0 +1,9 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterface struct { + Id *string `json:"id,omitempty"` + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_networkprofile.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_networkprofile.go new file mode 100644 index 00000000000..ad833cee5f1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_networkprofile.go @@ -0,0 +1,9 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkProfile struct { + NetworkInterfaces *[]NetworkInterface `json:"networkInterfaces,omitempty"` + Subnet *ApiEntityReference `json:"subnet,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_outboundenvironmentendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_outboundenvironmentendpoint.go new file mode 100644 index 00000000000..2da670f790a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_outboundenvironmentendpoint.go @@ -0,0 +1,9 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OutboundEnvironmentEndpoint struct { + Category *string `json:"category,omitempty"` + Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_sku.go new file mode 100644 index 00000000000..5ca103935da --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/model_sku.go @@ -0,0 +1,8 @@ +package dedicatedhsms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name *SkuName `json:"name,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/predicates.go new file mode 100644 index 00000000000..8ecbb2e796f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/predicates.go @@ -0,0 +1,42 @@ +package dedicatedhsms + +type DedicatedHsmOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p DedicatedHsmOperationPredicate) Matches(input DedicatedHsm) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type OutboundEnvironmentEndpointOperationPredicate struct { + Category *string +} + +func (p OutboundEnvironmentEndpointOperationPredicate) Matches(input OutboundEnvironmentEndpoint) bool { + + if p.Category != nil && (input.Category == nil && *p.Category != *input.Category) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/version.go new file mode 100644 index 00000000000..1dfbb967b27 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/version.go @@ -0,0 +1,12 @@ +package dedicatedhsms + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-30" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/dedicatedhsms/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/README.md new file mode 100644 index 00000000000..09a277cf858 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints` Documentation + +The `datacollectionendpoints` SDK allows for interaction with the Azure Resource Manager Service `insights` (API Version `2021-04-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints" +``` + + +### Client Initialization + +```go +client := datacollectionendpoints.NewDataCollectionEndpointsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DataCollectionEndpointsClient.Create` + +```go +ctx := context.TODO() +id := datacollectionendpoints.NewDataCollectionEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataCollectionEndpointValue") + +payload := datacollectionendpoints.DataCollectionEndpointResource{ + // ... +} + + +read, err := client.Create(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DataCollectionEndpointsClient.Delete` + +```go +ctx := context.TODO() +id := datacollectionendpoints.NewDataCollectionEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataCollectionEndpointValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DataCollectionEndpointsClient.Get` + +```go +ctx := context.TODO() +id := datacollectionendpoints.NewDataCollectionEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataCollectionEndpointValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DataCollectionEndpointsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := datacollectionendpoints.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DataCollectionEndpointsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := datacollectionendpoints.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DataCollectionEndpointsClient.Update` + +```go +ctx := context.TODO() +id := datacollectionendpoints.NewDataCollectionEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataCollectionEndpointValue") + +payload := datacollectionendpoints.ResourceForUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/client.go new file mode 100644 index 00000000000..9ded58c2b9a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/client.go @@ -0,0 +1,18 @@ +package datacollectionendpoints + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataCollectionEndpointsClient struct { + Client autorest.Client + baseUri string +} + +func NewDataCollectionEndpointsClientWithBaseURI(endpoint string) DataCollectionEndpointsClient { + return DataCollectionEndpointsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/constants.go new file mode 100644 index 00000000000..e9b335d98f5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/constants.go @@ -0,0 +1,99 @@ +package datacollectionendpoints + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KnownDataCollectionEndpointProvisioningState string + +const ( + KnownDataCollectionEndpointProvisioningStateCreating KnownDataCollectionEndpointProvisioningState = "Creating" + KnownDataCollectionEndpointProvisioningStateDeleting KnownDataCollectionEndpointProvisioningState = "Deleting" + KnownDataCollectionEndpointProvisioningStateFailed KnownDataCollectionEndpointProvisioningState = "Failed" + KnownDataCollectionEndpointProvisioningStateSucceeded KnownDataCollectionEndpointProvisioningState = "Succeeded" + KnownDataCollectionEndpointProvisioningStateUpdating KnownDataCollectionEndpointProvisioningState = "Updating" +) + +func PossibleValuesForKnownDataCollectionEndpointProvisioningState() []string { + return []string{ + string(KnownDataCollectionEndpointProvisioningStateCreating), + string(KnownDataCollectionEndpointProvisioningStateDeleting), + string(KnownDataCollectionEndpointProvisioningStateFailed), + string(KnownDataCollectionEndpointProvisioningStateSucceeded), + string(KnownDataCollectionEndpointProvisioningStateUpdating), + } +} + +func parseKnownDataCollectionEndpointProvisioningState(input string) (*KnownDataCollectionEndpointProvisioningState, error) { + vals := map[string]KnownDataCollectionEndpointProvisioningState{ + "creating": KnownDataCollectionEndpointProvisioningStateCreating, + "deleting": KnownDataCollectionEndpointProvisioningStateDeleting, + "failed": KnownDataCollectionEndpointProvisioningStateFailed, + "succeeded": KnownDataCollectionEndpointProvisioningStateSucceeded, + "updating": KnownDataCollectionEndpointProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KnownDataCollectionEndpointProvisioningState(input) + return &out, nil +} + +type KnownDataCollectionEndpointResourceKind string + +const ( + KnownDataCollectionEndpointResourceKindLinux KnownDataCollectionEndpointResourceKind = "Linux" + KnownDataCollectionEndpointResourceKindWindows KnownDataCollectionEndpointResourceKind = "Windows" +) + +func PossibleValuesForKnownDataCollectionEndpointResourceKind() []string { + return []string{ + string(KnownDataCollectionEndpointResourceKindLinux), + string(KnownDataCollectionEndpointResourceKindWindows), + } +} + +func parseKnownDataCollectionEndpointResourceKind(input string) (*KnownDataCollectionEndpointResourceKind, error) { + vals := map[string]KnownDataCollectionEndpointResourceKind{ + "linux": KnownDataCollectionEndpointResourceKindLinux, + "windows": KnownDataCollectionEndpointResourceKindWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KnownDataCollectionEndpointResourceKind(input) + return &out, nil +} + +type KnownPublicNetworkAccessOptions string + +const ( + KnownPublicNetworkAccessOptionsDisabled KnownPublicNetworkAccessOptions = "Disabled" + KnownPublicNetworkAccessOptionsEnabled KnownPublicNetworkAccessOptions = "Enabled" +) + +func PossibleValuesForKnownPublicNetworkAccessOptions() []string { + return []string{ + string(KnownPublicNetworkAccessOptionsDisabled), + string(KnownPublicNetworkAccessOptionsEnabled), + } +} + +func parseKnownPublicNetworkAccessOptions(input string) (*KnownPublicNetworkAccessOptions, error) { + vals := map[string]KnownPublicNetworkAccessOptions{ + "disabled": KnownPublicNetworkAccessOptionsDisabled, + "enabled": KnownPublicNetworkAccessOptionsEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KnownPublicNetworkAccessOptions(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/id_datacollectionendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/id_datacollectionendpoint.go new file mode 100644 index 00000000000..a67615cdc87 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/id_datacollectionendpoint.go @@ -0,0 +1,124 @@ +package datacollectionendpoints + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DataCollectionEndpointId{} + +// DataCollectionEndpointId is a struct representing the Resource ID for a Data Collection Endpoint +type DataCollectionEndpointId struct { + SubscriptionId string + ResourceGroupName string + DataCollectionEndpointName string +} + +// NewDataCollectionEndpointID returns a new DataCollectionEndpointId struct +func NewDataCollectionEndpointID(subscriptionId string, resourceGroupName string, dataCollectionEndpointName string) DataCollectionEndpointId { + return DataCollectionEndpointId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DataCollectionEndpointName: dataCollectionEndpointName, + } +} + +// ParseDataCollectionEndpointID parses 'input' into a DataCollectionEndpointId +func ParseDataCollectionEndpointID(input string) (*DataCollectionEndpointId, error) { + parser := resourceids.NewParserFromResourceIdType(DataCollectionEndpointId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DataCollectionEndpointId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DataCollectionEndpointName, ok = parsed.Parsed["dataCollectionEndpointName"]; !ok { + return nil, fmt.Errorf("the segment 'dataCollectionEndpointName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDataCollectionEndpointIDInsensitively parses 'input' case-insensitively into a DataCollectionEndpointId +// note: this method should only be used for API response data and not user input +func ParseDataCollectionEndpointIDInsensitively(input string) (*DataCollectionEndpointId, error) { + parser := resourceids.NewParserFromResourceIdType(DataCollectionEndpointId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DataCollectionEndpointId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DataCollectionEndpointName, ok = parsed.Parsed["dataCollectionEndpointName"]; !ok { + return nil, fmt.Errorf("the segment 'dataCollectionEndpointName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDataCollectionEndpointID checks that 'input' can be parsed as a Data Collection Endpoint ID +func ValidateDataCollectionEndpointID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDataCollectionEndpointID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Data Collection Endpoint ID +func (id DataCollectionEndpointId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/dataCollectionEndpoints/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DataCollectionEndpointName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Data Collection Endpoint ID +func (id DataCollectionEndpointId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), + resourceids.StaticSegment("staticDataCollectionEndpoints", "dataCollectionEndpoints", "dataCollectionEndpoints"), + resourceids.UserSpecifiedSegment("dataCollectionEndpointName", "dataCollectionEndpointValue"), + } +} + +// String returns a human-readable description of this Data Collection Endpoint ID +func (id DataCollectionEndpointId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Data Collection Endpoint Name: %q", id.DataCollectionEndpointName), + } + return fmt.Sprintf("Data Collection Endpoint (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_create_autorest.go new file mode 100644 index 00000000000..89455d7bf72 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_create_autorest.go @@ -0,0 +1,69 @@ +package datacollectionendpoints + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *DataCollectionEndpointResource +} + +// Create ... +func (c DataCollectionEndpointsClient) Create(ctx context.Context, id DataCollectionEndpointId, input DataCollectionEndpointResource) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c DataCollectionEndpointsClient) preparerForCreate(ctx context.Context, id DataCollectionEndpointId, input DataCollectionEndpointResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c DataCollectionEndpointsClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_delete_autorest.go new file mode 100644 index 00000000000..a2ef214585b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_delete_autorest.go @@ -0,0 +1,66 @@ +package datacollectionendpoints + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c DataCollectionEndpointsClient) Delete(ctx context.Context, id DataCollectionEndpointId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c DataCollectionEndpointsClient) preparerForDelete(ctx context.Context, id DataCollectionEndpointId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c DataCollectionEndpointsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_get_autorest.go new file mode 100644 index 00000000000..2f824dc9a07 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_get_autorest.go @@ -0,0 +1,68 @@ +package datacollectionendpoints + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *DataCollectionEndpointResource +} + +// Get ... +func (c DataCollectionEndpointsClient) Get(ctx context.Context, id DataCollectionEndpointId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DataCollectionEndpointsClient) preparerForGet(ctx context.Context, id DataCollectionEndpointId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DataCollectionEndpointsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..51e7a2d2ce8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package datacollectionendpoints + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]DataCollectionEndpointResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []DataCollectionEndpointResource +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c DataCollectionEndpointsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c DataCollectionEndpointsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Insights/dataCollectionEndpoints", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c DataCollectionEndpointsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c DataCollectionEndpointsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []DataCollectionEndpointResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c DataCollectionEndpointsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, DataCollectionEndpointResourceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DataCollectionEndpointsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate DataCollectionEndpointResourceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]DataCollectionEndpointResource, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..6fbec475a01 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package datacollectionendpoints + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]DataCollectionEndpointResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []DataCollectionEndpointResource +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c DataCollectionEndpointsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c DataCollectionEndpointsClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Insights/dataCollectionEndpoints", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c DataCollectionEndpointsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c DataCollectionEndpointsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []DataCollectionEndpointResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c DataCollectionEndpointsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, DataCollectionEndpointResourceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DataCollectionEndpointsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DataCollectionEndpointResourceOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]DataCollectionEndpointResource, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_update_autorest.go new file mode 100644 index 00000000000..5079c3e90c4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/method_update_autorest.go @@ -0,0 +1,69 @@ +package datacollectionendpoints + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *DataCollectionEndpointResource +} + +// Update ... +func (c DataCollectionEndpointsClient) Update(ctx context.Context, id DataCollectionEndpointId, input ResourceForUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionendpoints.DataCollectionEndpointsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c DataCollectionEndpointsClient) preparerForUpdate(ctx context.Context, id DataCollectionEndpointId, input ResourceForUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c DataCollectionEndpointsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_configurationaccessendpointspec.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_configurationaccessendpointspec.go new file mode 100644 index 00000000000..e35b5822dac --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_configurationaccessendpointspec.go @@ -0,0 +1,8 @@ +package datacollectionendpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationAccessEndpointSpec struct { + Endpoint *string `json:"endpoint,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_datacollectionendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_datacollectionendpoint.go new file mode 100644 index 00000000000..8b85bdd7b56 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_datacollectionendpoint.go @@ -0,0 +1,13 @@ +package datacollectionendpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataCollectionEndpoint struct { + ConfigurationAccess *ConfigurationAccessEndpointSpec `json:"configurationAccess,omitempty"` + Description *string `json:"description,omitempty"` + ImmutableId *string `json:"immutableId,omitempty"` + LogsIngestion *LogsIngestionEndpointSpec `json:"logsIngestion,omitempty"` + NetworkAcls *NetworkRuleSet `json:"networkAcls,omitempty"` + ProvisioningState *KnownDataCollectionEndpointProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_datacollectionendpointresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_datacollectionendpointresource.go new file mode 100644 index 00000000000..e9b56ee8cd1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_datacollectionendpointresource.go @@ -0,0 +1,20 @@ +package datacollectionendpoints + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataCollectionEndpointResource struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Kind *KnownDataCollectionEndpointResourceKind `json:"kind,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *DataCollectionEndpoint `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_logsingestionendpointspec.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_logsingestionendpointspec.go new file mode 100644 index 00000000000..398fc326eea --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_logsingestionendpointspec.go @@ -0,0 +1,8 @@ +package datacollectionendpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogsIngestionEndpointSpec struct { + Endpoint *string `json:"endpoint,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_networkruleset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_networkruleset.go new file mode 100644 index 00000000000..86bef2b8810 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_networkruleset.go @@ -0,0 +1,8 @@ +package datacollectionendpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkRuleSet struct { + PublicNetworkAccess *KnownPublicNetworkAccessOptions `json:"publicNetworkAccess,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_resourceforupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_resourceforupdate.go new file mode 100644 index 00000000000..ef06bf24059 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/model_resourceforupdate.go @@ -0,0 +1,8 @@ +package datacollectionendpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceForUpdate struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/predicates.go new file mode 100644 index 00000000000..04b7e34cc60 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/predicates.go @@ -0,0 +1,34 @@ +package datacollectionendpoints + +type DataCollectionEndpointResourceOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p DataCollectionEndpointResourceOperationPredicate) Matches(input DataCollectionEndpointResource) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/version.go new file mode 100644 index 00000000000..883bbd46c61 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints/version.go @@ -0,0 +1,12 @@ +package datacollectionendpoints + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/datacollectionendpoints/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/README.md new file mode 100644 index 00000000000..d96e1bd4ef5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules` Documentation + +The `datacollectionrules` SDK allows for interaction with the Azure Resource Manager Service `insights` (API Version `2021-04-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules" +``` + + +### Client Initialization + +```go +client := datacollectionrules.NewDataCollectionRulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DataCollectionRulesClient.Create` + +```go +ctx := context.TODO() +id := datacollectionrules.NewDataCollectionRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataCollectionRuleValue") + +payload := datacollectionrules.DataCollectionRuleResource{ + // ... +} + + +read, err := client.Create(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DataCollectionRulesClient.Delete` + +```go +ctx := context.TODO() +id := datacollectionrules.NewDataCollectionRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataCollectionRuleValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DataCollectionRulesClient.Get` + +```go +ctx := context.TODO() +id := datacollectionrules.NewDataCollectionRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataCollectionRuleValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DataCollectionRulesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := datacollectionrules.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DataCollectionRulesClient.ListBySubscription` + +```go +ctx := context.TODO() +id := datacollectionrules.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DataCollectionRulesClient.Update` + +```go +ctx := context.TODO() +id := datacollectionrules.NewDataCollectionRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dataCollectionRuleValue") + +payload := datacollectionrules.ResourceForUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/client.go new file mode 100644 index 00000000000..61bca1098e0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/client.go @@ -0,0 +1,18 @@ +package datacollectionrules + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataCollectionRulesClient struct { + Client autorest.Client + baseUri string +} + +func NewDataCollectionRulesClientWithBaseURI(endpoint string) DataCollectionRulesClient { + return DataCollectionRulesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/constants.go new file mode 100644 index 00000000000..0bd1faa0d83 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/constants.go @@ -0,0 +1,360 @@ +package datacollectionrules + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KnownDataCollectionRuleProvisioningState string + +const ( + KnownDataCollectionRuleProvisioningStateCreating KnownDataCollectionRuleProvisioningState = "Creating" + KnownDataCollectionRuleProvisioningStateDeleting KnownDataCollectionRuleProvisioningState = "Deleting" + KnownDataCollectionRuleProvisioningStateFailed KnownDataCollectionRuleProvisioningState = "Failed" + KnownDataCollectionRuleProvisioningStateSucceeded KnownDataCollectionRuleProvisioningState = "Succeeded" + KnownDataCollectionRuleProvisioningStateUpdating KnownDataCollectionRuleProvisioningState = "Updating" +) + +func PossibleValuesForKnownDataCollectionRuleProvisioningState() []string { + return []string{ + string(KnownDataCollectionRuleProvisioningStateCreating), + string(KnownDataCollectionRuleProvisioningStateDeleting), + string(KnownDataCollectionRuleProvisioningStateFailed), + string(KnownDataCollectionRuleProvisioningStateSucceeded), + string(KnownDataCollectionRuleProvisioningStateUpdating), + } +} + +func parseKnownDataCollectionRuleProvisioningState(input string) (*KnownDataCollectionRuleProvisioningState, error) { + vals := map[string]KnownDataCollectionRuleProvisioningState{ + "creating": KnownDataCollectionRuleProvisioningStateCreating, + "deleting": KnownDataCollectionRuleProvisioningStateDeleting, + "failed": KnownDataCollectionRuleProvisioningStateFailed, + "succeeded": KnownDataCollectionRuleProvisioningStateSucceeded, + "updating": KnownDataCollectionRuleProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KnownDataCollectionRuleProvisioningState(input) + return &out, nil +} + +type KnownDataCollectionRuleResourceKind string + +const ( + KnownDataCollectionRuleResourceKindLinux KnownDataCollectionRuleResourceKind = "Linux" + KnownDataCollectionRuleResourceKindWindows KnownDataCollectionRuleResourceKind = "Windows" +) + +func PossibleValuesForKnownDataCollectionRuleResourceKind() []string { + return []string{ + string(KnownDataCollectionRuleResourceKindLinux), + string(KnownDataCollectionRuleResourceKindWindows), + } +} + +func parseKnownDataCollectionRuleResourceKind(input string) (*KnownDataCollectionRuleResourceKind, error) { + vals := map[string]KnownDataCollectionRuleResourceKind{ + "linux": KnownDataCollectionRuleResourceKindLinux, + "windows": KnownDataCollectionRuleResourceKindWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KnownDataCollectionRuleResourceKind(input) + return &out, nil +} + +type KnownDataFlowStreams string + +const ( + KnownDataFlowStreamsMicrosoftNegativeEvent KnownDataFlowStreams = "Microsoft-Event" + KnownDataFlowStreamsMicrosoftNegativeInsightsMetrics KnownDataFlowStreams = "Microsoft-InsightsMetrics" + KnownDataFlowStreamsMicrosoftNegativePerf KnownDataFlowStreams = "Microsoft-Perf" + KnownDataFlowStreamsMicrosoftNegativeSyslog KnownDataFlowStreams = "Microsoft-Syslog" + KnownDataFlowStreamsMicrosoftNegativeWindowsEvent KnownDataFlowStreams = "Microsoft-WindowsEvent" +) + +func PossibleValuesForKnownDataFlowStreams() []string { + return []string{ + string(KnownDataFlowStreamsMicrosoftNegativeEvent), + string(KnownDataFlowStreamsMicrosoftNegativeInsightsMetrics), + string(KnownDataFlowStreamsMicrosoftNegativePerf), + string(KnownDataFlowStreamsMicrosoftNegativeSyslog), + string(KnownDataFlowStreamsMicrosoftNegativeWindowsEvent), + } +} + +func parseKnownDataFlowStreams(input string) (*KnownDataFlowStreams, error) { + vals := map[string]KnownDataFlowStreams{ + "microsoft-event": KnownDataFlowStreamsMicrosoftNegativeEvent, + "microsoft-insightsmetrics": KnownDataFlowStreamsMicrosoftNegativeInsightsMetrics, + "microsoft-perf": KnownDataFlowStreamsMicrosoftNegativePerf, + "microsoft-syslog": KnownDataFlowStreamsMicrosoftNegativeSyslog, + "microsoft-windowsevent": KnownDataFlowStreamsMicrosoftNegativeWindowsEvent, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KnownDataFlowStreams(input) + return &out, nil +} + +type KnownExtensionDataSourceStreams string + +const ( + KnownExtensionDataSourceStreamsMicrosoftNegativeEvent KnownExtensionDataSourceStreams = "Microsoft-Event" + KnownExtensionDataSourceStreamsMicrosoftNegativeInsightsMetrics KnownExtensionDataSourceStreams = "Microsoft-InsightsMetrics" + KnownExtensionDataSourceStreamsMicrosoftNegativePerf KnownExtensionDataSourceStreams = "Microsoft-Perf" + KnownExtensionDataSourceStreamsMicrosoftNegativeSyslog KnownExtensionDataSourceStreams = "Microsoft-Syslog" + KnownExtensionDataSourceStreamsMicrosoftNegativeWindowsEvent KnownExtensionDataSourceStreams = "Microsoft-WindowsEvent" +) + +func PossibleValuesForKnownExtensionDataSourceStreams() []string { + return []string{ + string(KnownExtensionDataSourceStreamsMicrosoftNegativeEvent), + string(KnownExtensionDataSourceStreamsMicrosoftNegativeInsightsMetrics), + string(KnownExtensionDataSourceStreamsMicrosoftNegativePerf), + string(KnownExtensionDataSourceStreamsMicrosoftNegativeSyslog), + string(KnownExtensionDataSourceStreamsMicrosoftNegativeWindowsEvent), + } +} + +func parseKnownExtensionDataSourceStreams(input string) (*KnownExtensionDataSourceStreams, error) { + vals := map[string]KnownExtensionDataSourceStreams{ + "microsoft-event": KnownExtensionDataSourceStreamsMicrosoftNegativeEvent, + "microsoft-insightsmetrics": KnownExtensionDataSourceStreamsMicrosoftNegativeInsightsMetrics, + "microsoft-perf": KnownExtensionDataSourceStreamsMicrosoftNegativePerf, + "microsoft-syslog": KnownExtensionDataSourceStreamsMicrosoftNegativeSyslog, + "microsoft-windowsevent": KnownExtensionDataSourceStreamsMicrosoftNegativeWindowsEvent, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KnownExtensionDataSourceStreams(input) + return &out, nil +} + +type KnownPerfCounterDataSourceStreams string + +const ( + KnownPerfCounterDataSourceStreamsMicrosoftNegativeInsightsMetrics KnownPerfCounterDataSourceStreams = "Microsoft-InsightsMetrics" + KnownPerfCounterDataSourceStreamsMicrosoftNegativePerf KnownPerfCounterDataSourceStreams = "Microsoft-Perf" +) + +func PossibleValuesForKnownPerfCounterDataSourceStreams() []string { + return []string{ + string(KnownPerfCounterDataSourceStreamsMicrosoftNegativeInsightsMetrics), + string(KnownPerfCounterDataSourceStreamsMicrosoftNegativePerf), + } +} + +func parseKnownPerfCounterDataSourceStreams(input string) (*KnownPerfCounterDataSourceStreams, error) { + vals := map[string]KnownPerfCounterDataSourceStreams{ + "microsoft-insightsmetrics": KnownPerfCounterDataSourceStreamsMicrosoftNegativeInsightsMetrics, + "microsoft-perf": KnownPerfCounterDataSourceStreamsMicrosoftNegativePerf, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KnownPerfCounterDataSourceStreams(input) + return &out, nil +} + +type KnownSyslogDataSourceFacilityNames string + +const ( + KnownSyslogDataSourceFacilityNamesAny KnownSyslogDataSourceFacilityNames = "*" + KnownSyslogDataSourceFacilityNamesAuth KnownSyslogDataSourceFacilityNames = "auth" + KnownSyslogDataSourceFacilityNamesAuthpriv KnownSyslogDataSourceFacilityNames = "authpriv" + KnownSyslogDataSourceFacilityNamesCron KnownSyslogDataSourceFacilityNames = "cron" + KnownSyslogDataSourceFacilityNamesDaemon KnownSyslogDataSourceFacilityNames = "daemon" + KnownSyslogDataSourceFacilityNamesKern KnownSyslogDataSourceFacilityNames = "kern" + KnownSyslogDataSourceFacilityNamesLocalFive KnownSyslogDataSourceFacilityNames = "local5" + KnownSyslogDataSourceFacilityNamesLocalFour KnownSyslogDataSourceFacilityNames = "local4" + KnownSyslogDataSourceFacilityNamesLocalOne KnownSyslogDataSourceFacilityNames = "local1" + KnownSyslogDataSourceFacilityNamesLocalSeven KnownSyslogDataSourceFacilityNames = "local7" + KnownSyslogDataSourceFacilityNamesLocalSix KnownSyslogDataSourceFacilityNames = "local6" + KnownSyslogDataSourceFacilityNamesLocalThree KnownSyslogDataSourceFacilityNames = "local3" + KnownSyslogDataSourceFacilityNamesLocalTwo KnownSyslogDataSourceFacilityNames = "local2" + KnownSyslogDataSourceFacilityNamesLocalZero KnownSyslogDataSourceFacilityNames = "local0" + KnownSyslogDataSourceFacilityNamesLpr KnownSyslogDataSourceFacilityNames = "lpr" + KnownSyslogDataSourceFacilityNamesMail KnownSyslogDataSourceFacilityNames = "mail" + KnownSyslogDataSourceFacilityNamesMark KnownSyslogDataSourceFacilityNames = "mark" + KnownSyslogDataSourceFacilityNamesNews KnownSyslogDataSourceFacilityNames = "news" + KnownSyslogDataSourceFacilityNamesSyslog KnownSyslogDataSourceFacilityNames = "syslog" + KnownSyslogDataSourceFacilityNamesUser KnownSyslogDataSourceFacilityNames = "user" + KnownSyslogDataSourceFacilityNamesUucp KnownSyslogDataSourceFacilityNames = "uucp" +) + +func PossibleValuesForKnownSyslogDataSourceFacilityNames() []string { + return []string{ + string(KnownSyslogDataSourceFacilityNamesAny), + string(KnownSyslogDataSourceFacilityNamesAuth), + string(KnownSyslogDataSourceFacilityNamesAuthpriv), + string(KnownSyslogDataSourceFacilityNamesCron), + string(KnownSyslogDataSourceFacilityNamesDaemon), + string(KnownSyslogDataSourceFacilityNamesKern), + string(KnownSyslogDataSourceFacilityNamesLocalFive), + string(KnownSyslogDataSourceFacilityNamesLocalFour), + string(KnownSyslogDataSourceFacilityNamesLocalOne), + string(KnownSyslogDataSourceFacilityNamesLocalSeven), + string(KnownSyslogDataSourceFacilityNamesLocalSix), + string(KnownSyslogDataSourceFacilityNamesLocalThree), + string(KnownSyslogDataSourceFacilityNamesLocalTwo), + string(KnownSyslogDataSourceFacilityNamesLocalZero), + string(KnownSyslogDataSourceFacilityNamesLpr), + string(KnownSyslogDataSourceFacilityNamesMail), + string(KnownSyslogDataSourceFacilityNamesMark), + string(KnownSyslogDataSourceFacilityNamesNews), + string(KnownSyslogDataSourceFacilityNamesSyslog), + string(KnownSyslogDataSourceFacilityNamesUser), + string(KnownSyslogDataSourceFacilityNamesUucp), + } +} + +func parseKnownSyslogDataSourceFacilityNames(input string) (*KnownSyslogDataSourceFacilityNames, error) { + vals := map[string]KnownSyslogDataSourceFacilityNames{ + "*": KnownSyslogDataSourceFacilityNamesAny, + "auth": KnownSyslogDataSourceFacilityNamesAuth, + "authpriv": KnownSyslogDataSourceFacilityNamesAuthpriv, + "cron": KnownSyslogDataSourceFacilityNamesCron, + "daemon": KnownSyslogDataSourceFacilityNamesDaemon, + "kern": KnownSyslogDataSourceFacilityNamesKern, + "local5": KnownSyslogDataSourceFacilityNamesLocalFive, + "local4": KnownSyslogDataSourceFacilityNamesLocalFour, + "local1": KnownSyslogDataSourceFacilityNamesLocalOne, + "local7": KnownSyslogDataSourceFacilityNamesLocalSeven, + "local6": KnownSyslogDataSourceFacilityNamesLocalSix, + "local3": KnownSyslogDataSourceFacilityNamesLocalThree, + "local2": KnownSyslogDataSourceFacilityNamesLocalTwo, + "local0": KnownSyslogDataSourceFacilityNamesLocalZero, + "lpr": KnownSyslogDataSourceFacilityNamesLpr, + "mail": KnownSyslogDataSourceFacilityNamesMail, + "mark": KnownSyslogDataSourceFacilityNamesMark, + "news": KnownSyslogDataSourceFacilityNamesNews, + "syslog": KnownSyslogDataSourceFacilityNamesSyslog, + "user": KnownSyslogDataSourceFacilityNamesUser, + "uucp": KnownSyslogDataSourceFacilityNamesUucp, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KnownSyslogDataSourceFacilityNames(input) + return &out, nil +} + +type KnownSyslogDataSourceLogLevels string + +const ( + KnownSyslogDataSourceLogLevelsAlert KnownSyslogDataSourceLogLevels = "Alert" + KnownSyslogDataSourceLogLevelsAny KnownSyslogDataSourceLogLevels = "*" + KnownSyslogDataSourceLogLevelsCritical KnownSyslogDataSourceLogLevels = "Critical" + KnownSyslogDataSourceLogLevelsDebug KnownSyslogDataSourceLogLevels = "Debug" + KnownSyslogDataSourceLogLevelsEmergency KnownSyslogDataSourceLogLevels = "Emergency" + KnownSyslogDataSourceLogLevelsError KnownSyslogDataSourceLogLevels = "Error" + KnownSyslogDataSourceLogLevelsInfo KnownSyslogDataSourceLogLevels = "Info" + KnownSyslogDataSourceLogLevelsNotice KnownSyslogDataSourceLogLevels = "Notice" + KnownSyslogDataSourceLogLevelsWarning KnownSyslogDataSourceLogLevels = "Warning" +) + +func PossibleValuesForKnownSyslogDataSourceLogLevels() []string { + return []string{ + string(KnownSyslogDataSourceLogLevelsAlert), + string(KnownSyslogDataSourceLogLevelsAny), + string(KnownSyslogDataSourceLogLevelsCritical), + string(KnownSyslogDataSourceLogLevelsDebug), + string(KnownSyslogDataSourceLogLevelsEmergency), + string(KnownSyslogDataSourceLogLevelsError), + string(KnownSyslogDataSourceLogLevelsInfo), + string(KnownSyslogDataSourceLogLevelsNotice), + string(KnownSyslogDataSourceLogLevelsWarning), + } +} + +func parseKnownSyslogDataSourceLogLevels(input string) (*KnownSyslogDataSourceLogLevels, error) { + vals := map[string]KnownSyslogDataSourceLogLevels{ + "alert": KnownSyslogDataSourceLogLevelsAlert, + "*": KnownSyslogDataSourceLogLevelsAny, + "critical": KnownSyslogDataSourceLogLevelsCritical, + "debug": KnownSyslogDataSourceLogLevelsDebug, + "emergency": KnownSyslogDataSourceLogLevelsEmergency, + "error": KnownSyslogDataSourceLogLevelsError, + "info": KnownSyslogDataSourceLogLevelsInfo, + "notice": KnownSyslogDataSourceLogLevelsNotice, + "warning": KnownSyslogDataSourceLogLevelsWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KnownSyslogDataSourceLogLevels(input) + return &out, nil +} + +type KnownSyslogDataSourceStreams string + +const ( + KnownSyslogDataSourceStreamsMicrosoftNegativeSyslog KnownSyslogDataSourceStreams = "Microsoft-Syslog" +) + +func PossibleValuesForKnownSyslogDataSourceStreams() []string { + return []string{ + string(KnownSyslogDataSourceStreamsMicrosoftNegativeSyslog), + } +} + +func parseKnownSyslogDataSourceStreams(input string) (*KnownSyslogDataSourceStreams, error) { + vals := map[string]KnownSyslogDataSourceStreams{ + "microsoft-syslog": KnownSyslogDataSourceStreamsMicrosoftNegativeSyslog, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KnownSyslogDataSourceStreams(input) + return &out, nil +} + +type KnownWindowsEventLogDataSourceStreams string + +const ( + KnownWindowsEventLogDataSourceStreamsMicrosoftNegativeEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-Event" + KnownWindowsEventLogDataSourceStreamsMicrosoftNegativeWindowsEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-WindowsEvent" +) + +func PossibleValuesForKnownWindowsEventLogDataSourceStreams() []string { + return []string{ + string(KnownWindowsEventLogDataSourceStreamsMicrosoftNegativeEvent), + string(KnownWindowsEventLogDataSourceStreamsMicrosoftNegativeWindowsEvent), + } +} + +func parseKnownWindowsEventLogDataSourceStreams(input string) (*KnownWindowsEventLogDataSourceStreams, error) { + vals := map[string]KnownWindowsEventLogDataSourceStreams{ + "microsoft-event": KnownWindowsEventLogDataSourceStreamsMicrosoftNegativeEvent, + "microsoft-windowsevent": KnownWindowsEventLogDataSourceStreamsMicrosoftNegativeWindowsEvent, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KnownWindowsEventLogDataSourceStreams(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/id_datacollectionrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/id_datacollectionrule.go new file mode 100644 index 00000000000..d9b185b7d3e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/id_datacollectionrule.go @@ -0,0 +1,124 @@ +package datacollectionrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DataCollectionRuleId{} + +// DataCollectionRuleId is a struct representing the Resource ID for a Data Collection Rule +type DataCollectionRuleId struct { + SubscriptionId string + ResourceGroupName string + DataCollectionRuleName string +} + +// NewDataCollectionRuleID returns a new DataCollectionRuleId struct +func NewDataCollectionRuleID(subscriptionId string, resourceGroupName string, dataCollectionRuleName string) DataCollectionRuleId { + return DataCollectionRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DataCollectionRuleName: dataCollectionRuleName, + } +} + +// ParseDataCollectionRuleID parses 'input' into a DataCollectionRuleId +func ParseDataCollectionRuleID(input string) (*DataCollectionRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(DataCollectionRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DataCollectionRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DataCollectionRuleName, ok = parsed.Parsed["dataCollectionRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'dataCollectionRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDataCollectionRuleIDInsensitively parses 'input' case-insensitively into a DataCollectionRuleId +// note: this method should only be used for API response data and not user input +func ParseDataCollectionRuleIDInsensitively(input string) (*DataCollectionRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(DataCollectionRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DataCollectionRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DataCollectionRuleName, ok = parsed.Parsed["dataCollectionRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'dataCollectionRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDataCollectionRuleID checks that 'input' can be parsed as a Data Collection Rule ID +func ValidateDataCollectionRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDataCollectionRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Data Collection Rule ID +func (id DataCollectionRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/dataCollectionRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DataCollectionRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Data Collection Rule ID +func (id DataCollectionRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), + resourceids.StaticSegment("staticDataCollectionRules", "dataCollectionRules", "dataCollectionRules"), + resourceids.UserSpecifiedSegment("dataCollectionRuleName", "dataCollectionRuleValue"), + } +} + +// String returns a human-readable description of this Data Collection Rule ID +func (id DataCollectionRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Data Collection Rule Name: %q", id.DataCollectionRuleName), + } + return fmt.Sprintf("Data Collection Rule (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_create_autorest.go new file mode 100644 index 00000000000..63968af2e0d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_create_autorest.go @@ -0,0 +1,69 @@ +package datacollectionrules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *DataCollectionRuleResource +} + +// Create ... +func (c DataCollectionRulesClient) Create(ctx context.Context, id DataCollectionRuleId, input DataCollectionRuleResource) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c DataCollectionRulesClient) preparerForCreate(ctx context.Context, id DataCollectionRuleId, input DataCollectionRuleResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c DataCollectionRulesClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_delete_autorest.go new file mode 100644 index 00000000000..27a0fb8d93b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_delete_autorest.go @@ -0,0 +1,66 @@ +package datacollectionrules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c DataCollectionRulesClient) Delete(ctx context.Context, id DataCollectionRuleId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c DataCollectionRulesClient) preparerForDelete(ctx context.Context, id DataCollectionRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c DataCollectionRulesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_get_autorest.go new file mode 100644 index 00000000000..503a4b08e51 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_get_autorest.go @@ -0,0 +1,68 @@ +package datacollectionrules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *DataCollectionRuleResource +} + +// Get ... +func (c DataCollectionRulesClient) Get(ctx context.Context, id DataCollectionRuleId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DataCollectionRulesClient) preparerForGet(ctx context.Context, id DataCollectionRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DataCollectionRulesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..4e8ee59a881 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package datacollectionrules + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]DataCollectionRuleResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []DataCollectionRuleResource +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c DataCollectionRulesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c DataCollectionRulesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Insights/dataCollectionRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c DataCollectionRulesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c DataCollectionRulesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []DataCollectionRuleResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c DataCollectionRulesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, DataCollectionRuleResourceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DataCollectionRulesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate DataCollectionRuleResourceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]DataCollectionRuleResource, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..c90864f1a56 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package datacollectionrules + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]DataCollectionRuleResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []DataCollectionRuleResource +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c DataCollectionRulesClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c DataCollectionRulesClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Insights/dataCollectionRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c DataCollectionRulesClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c DataCollectionRulesClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []DataCollectionRuleResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c DataCollectionRulesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, DataCollectionRuleResourceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DataCollectionRulesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DataCollectionRuleResourceOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]DataCollectionRuleResource, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_update_autorest.go new file mode 100644 index 00000000000..1de36a708c5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/method_update_autorest.go @@ -0,0 +1,69 @@ +package datacollectionrules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *DataCollectionRuleResource +} + +// Update ... +func (c DataCollectionRulesClient) Update(ctx context.Context, id DataCollectionRuleId, input ResourceForUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "datacollectionrules.DataCollectionRulesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c DataCollectionRulesClient) preparerForUpdate(ctx context.Context, id DataCollectionRuleId, input ResourceForUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c DataCollectionRulesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_azuremonitormetricsdestination.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_azuremonitormetricsdestination.go new file mode 100644 index 00000000000..52fefb9fdd9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_azuremonitormetricsdestination.go @@ -0,0 +1,8 @@ +package datacollectionrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureMonitorMetricsDestination struct { + Name *string `json:"name,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_datacollectionrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_datacollectionrule.go new file mode 100644 index 00000000000..d0bd1cd25cf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_datacollectionrule.go @@ -0,0 +1,13 @@ +package datacollectionrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataCollectionRule struct { + DataFlows *[]DataFlow `json:"dataFlows,omitempty"` + DataSources *DataSourcesSpec `json:"dataSources,omitempty"` + Description *string `json:"description,omitempty"` + Destinations *DestinationsSpec `json:"destinations,omitempty"` + ImmutableId *string `json:"immutableId,omitempty"` + ProvisioningState *KnownDataCollectionRuleProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_datacollectionruleresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_datacollectionruleresource.go new file mode 100644 index 00000000000..47a54626fe8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_datacollectionruleresource.go @@ -0,0 +1,20 @@ +package datacollectionrules + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataCollectionRuleResource struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Kind *KnownDataCollectionRuleResourceKind `json:"kind,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *DataCollectionRule `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_dataflow.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_dataflow.go new file mode 100644 index 00000000000..8a8e80603e2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_dataflow.go @@ -0,0 +1,9 @@ +package datacollectionrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataFlow struct { + Destinations *[]string `json:"destinations,omitempty"` + Streams *[]KnownDataFlowStreams `json:"streams,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_datasourcesspec.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_datasourcesspec.go new file mode 100644 index 00000000000..132e331406e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_datasourcesspec.go @@ -0,0 +1,11 @@ +package datacollectionrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataSourcesSpec struct { + Extensions *[]ExtensionDataSource `json:"extensions,omitempty"` + PerformanceCounters *[]PerfCounterDataSource `json:"performanceCounters,omitempty"` + Syslog *[]SyslogDataSource `json:"syslog,omitempty"` + WindowsEventLogs *[]WindowsEventLogDataSource `json:"windowsEventLogs,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_destinationsspec.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_destinationsspec.go new file mode 100644 index 00000000000..432e41c07c4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_destinationsspec.go @@ -0,0 +1,9 @@ +package datacollectionrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DestinationsSpec struct { + AzureMonitorMetrics *AzureMonitorMetricsDestination `json:"azureMonitorMetrics,omitempty"` + LogAnalytics *[]LogAnalyticsDestination `json:"logAnalytics,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_extensiondatasource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_extensiondatasource.go new file mode 100644 index 00000000000..8f8599c7fef --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_extensiondatasource.go @@ -0,0 +1,12 @@ +package datacollectionrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtensionDataSource struct { + ExtensionName string `json:"extensionName"` + ExtensionSettings *interface{} `json:"extensionSettings,omitempty"` + InputDataSources *[]string `json:"inputDataSources,omitempty"` + Name *string `json:"name,omitempty"` + Streams *[]KnownExtensionDataSourceStreams `json:"streams,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_loganalyticsdestination.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_loganalyticsdestination.go new file mode 100644 index 00000000000..ecc04a3c5f0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_loganalyticsdestination.go @@ -0,0 +1,10 @@ +package datacollectionrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogAnalyticsDestination struct { + Name *string `json:"name,omitempty"` + WorkspaceId *string `json:"workspaceId,omitempty"` + WorkspaceResourceId *string `json:"workspaceResourceId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_perfcounterdatasource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_perfcounterdatasource.go new file mode 100644 index 00000000000..f43d0f81518 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_perfcounterdatasource.go @@ -0,0 +1,11 @@ +package datacollectionrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PerfCounterDataSource struct { + CounterSpecifiers *[]string `json:"counterSpecifiers,omitempty"` + Name *string `json:"name,omitempty"` + SamplingFrequencyInSeconds *int64 `json:"samplingFrequencyInSeconds,omitempty"` + Streams *[]KnownPerfCounterDataSourceStreams `json:"streams,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_resourceforupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_resourceforupdate.go new file mode 100644 index 00000000000..5e93df279da --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_resourceforupdate.go @@ -0,0 +1,8 @@ +package datacollectionrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceForUpdate struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_syslogdatasource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_syslogdatasource.go new file mode 100644 index 00000000000..543153d8999 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_syslogdatasource.go @@ -0,0 +1,11 @@ +package datacollectionrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SyslogDataSource struct { + FacilityNames *[]KnownSyslogDataSourceFacilityNames `json:"facilityNames,omitempty"` + LogLevels *[]KnownSyslogDataSourceLogLevels `json:"logLevels,omitempty"` + Name *string `json:"name,omitempty"` + Streams *[]KnownSyslogDataSourceStreams `json:"streams,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_windowseventlogdatasource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_windowseventlogdatasource.go new file mode 100644 index 00000000000..2b0e211004f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/model_windowseventlogdatasource.go @@ -0,0 +1,10 @@ +package datacollectionrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsEventLogDataSource struct { + Name *string `json:"name,omitempty"` + Streams *[]KnownWindowsEventLogDataSourceStreams `json:"streams,omitempty"` + XPathQueries *[]string `json:"xPathQueries,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/predicates.go new file mode 100644 index 00000000000..c2d496deb8d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/predicates.go @@ -0,0 +1,34 @@ +package datacollectionrules + +type DataCollectionRuleResourceOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p DataCollectionRuleResourceOperationPredicate) Matches(input DataCollectionRuleResource) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/version.go new file mode 100644 index 00000000000..9c4156750c3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules/version.go @@ -0,0 +1,12 @@ +package datacollectionrules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/datacollectionrules/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/README.md new file mode 100644 index 00000000000..6dc59f815d4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/README.md @@ -0,0 +1,175 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps` Documentation + +The `apps` SDK allows for interaction with the Azure Resource Manager Service `iotcentral` (API Version `2021-11-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps" +``` + + +### Client Initialization + +```go +client := apps.NewAppsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AppsClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := apps.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := apps.OperationInputs{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppsClient.CheckSubdomainAvailability` + +```go +ctx := context.TODO() +id := apps.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := apps.OperationInputs{ + // ... +} + + +read, err := client.CheckSubdomainAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := apps.NewIotAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +payload := apps.App{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppsClient.Delete` + +```go +ctx := context.TODO() +id := apps.NewIotAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AppsClient.Get` + +```go +ctx := context.TODO() +id := apps.NewIotAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AppsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := apps.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := apps.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppsClient.ListTemplates` + +```go +ctx := context.TODO() +id := apps.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListTemplates(ctx, id)` can be used to do batched pagination +items, err := client.ListTemplatesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AppsClient.Update` + +```go +ctx := context.TODO() +id := apps.NewIotAppID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +payload := apps.AppPatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/client.go new file mode 100644 index 00000000000..cf65f097bf4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/client.go @@ -0,0 +1,18 @@ +package apps + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AppsClient struct { + Client autorest.Client + baseUri string +} + +func NewAppsClientWithBaseURI(endpoint string) AppsClient { + return AppsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/constants.go new file mode 100644 index 00000000000..ea10f7f690a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/constants.go @@ -0,0 +1,251 @@ +package apps + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AppSku string + +const ( + AppSkuSTOne AppSku = "ST1" + AppSkuSTTwo AppSku = "ST2" + AppSkuSTZero AppSku = "ST0" +) + +func PossibleValuesForAppSku() []string { + return []string{ + string(AppSkuSTOne), + string(AppSkuSTTwo), + string(AppSkuSTZero), + } +} + +func parseAppSku(input string) (*AppSku, error) { + vals := map[string]AppSku{ + "st1": AppSkuSTOne, + "st2": AppSkuSTTwo, + "st0": AppSkuSTZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AppSku(input) + return &out, nil +} + +type AppState string + +const ( + AppStateCreated AppState = "created" + AppStateSuspended AppState = "suspended" +) + +func PossibleValuesForAppState() []string { + return []string{ + string(AppStateCreated), + string(AppStateSuspended), + } +} + +func parseAppState(input string) (*AppState, error) { + vals := map[string]AppState{ + "created": AppStateCreated, + "suspended": AppStateSuspended, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AppState(input) + return &out, nil +} + +type IPRuleAction string + +const ( + IPRuleActionAllow IPRuleAction = "Allow" +) + +func PossibleValuesForIPRuleAction() []string { + return []string{ + string(IPRuleActionAllow), + } +} + +func parseIPRuleAction(input string) (*IPRuleAction, error) { + vals := map[string]IPRuleAction{ + "allow": IPRuleActionAllow, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IPRuleAction(input) + return &out, nil +} + +type NetworkAction string + +const ( + NetworkActionAllow NetworkAction = "Allow" + NetworkActionDeny NetworkAction = "Deny" +) + +func PossibleValuesForNetworkAction() []string { + return []string{ + string(NetworkActionAllow), + string(NetworkActionDeny), + } +} + +func parseNetworkAction(input string) (*NetworkAction, error) { + vals := map[string]NetworkAction{ + "allow": NetworkActionAllow, + "deny": NetworkActionDeny, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkAction(input) + return &out, nil +} + +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + } +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { + return []string{ + string(PrivateEndpointServiceConnectionStatusApproved), + string(PrivateEndpointServiceConnectionStatusPending), + string(PrivateEndpointServiceConnectionStatusRejected), + } +} + +func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { + vals := map[string]PrivateEndpointServiceConnectionStatus{ + "approved": PrivateEndpointServiceConnectionStatusApproved, + "pending": PrivateEndpointServiceConnectionStatusPending, + "rejected": PrivateEndpointServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointServiceConnectionStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/id_iotapp.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/id_iotapp.go new file mode 100644 index 00000000000..41ee28a8735 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/id_iotapp.go @@ -0,0 +1,124 @@ +package apps + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = IotAppId{} + +// IotAppId is a struct representing the Resource ID for a Iot App +type IotAppId struct { + SubscriptionId string + ResourceGroupName string + ResourceName string +} + +// NewIotAppID returns a new IotAppId struct +func NewIotAppID(subscriptionId string, resourceGroupName string, resourceName string) IotAppId { + return IotAppId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceName: resourceName, + } +} + +// ParseIotAppID parses 'input' into a IotAppId +func ParseIotAppID(input string) (*IotAppId, error) { + parser := resourceids.NewParserFromResourceIdType(IotAppId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IotAppId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseIotAppIDInsensitively parses 'input' case-insensitively into a IotAppId +// note: this method should only be used for API response data and not user input +func ParseIotAppIDInsensitively(input string) (*IotAppId, error) { + parser := resourceids.NewParserFromResourceIdType(IotAppId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IotAppId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateIotAppID checks that 'input' can be parsed as a Iot App ID +func ValidateIotAppID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseIotAppID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Iot App ID +func (id IotAppId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.IoTCentral/iotApps/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Iot App ID +func (id IotAppId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftIoTCentral", "Microsoft.IoTCentral", "Microsoft.IoTCentral"), + resourceids.StaticSegment("staticIotApps", "iotApps", "iotApps"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + } +} + +// String returns a human-readable description of this Iot App ID +func (id IotAppId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + } + return fmt.Sprintf("Iot App (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_checknameavailability_autorest.go new file mode 100644 index 00000000000..942b1b9c1c7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_checknameavailability_autorest.go @@ -0,0 +1,71 @@ +package apps + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *AppAvailabilityInfo +} + +// CheckNameAvailability ... +func (c AppsClient) CheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input OperationInputs) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c AppsClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input OperationInputs) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.IoTCentral/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c AppsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_checksubdomainavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_checksubdomainavailability_autorest.go new file mode 100644 index 00000000000..1cc289e0a17 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_checksubdomainavailability_autorest.go @@ -0,0 +1,71 @@ +package apps + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckSubdomainAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *AppAvailabilityInfo +} + +// CheckSubdomainAvailability ... +func (c AppsClient) CheckSubdomainAvailability(ctx context.Context, id commonids.SubscriptionId, input OperationInputs) (result CheckSubdomainAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckSubdomainAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "CheckSubdomainAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "CheckSubdomainAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckSubdomainAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "CheckSubdomainAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckSubdomainAvailability prepares the CheckSubdomainAvailability request. +func (c AppsClient) preparerForCheckSubdomainAvailability(ctx context.Context, id commonids.SubscriptionId, input OperationInputs) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.IoTCentral/checkSubdomainAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckSubdomainAvailability handles the response to the CheckSubdomainAvailability request. The method always +// closes the http.Response Body. +func (c AppsClient) responderForCheckSubdomainAvailability(resp *http.Response) (result CheckSubdomainAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_createorupdate_autorest.go new file mode 100644 index 00000000000..74c72f7a87c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package apps + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c AppsClient) CreateOrUpdate(ctx context.Context, id IotAppId, input App) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c AppsClient) CreateOrUpdateThenPoll(ctx context.Context, id IotAppId, input App) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c AppsClient) preparerForCreateOrUpdate(ctx context.Context, id IotAppId, input App) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c AppsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_delete_autorest.go new file mode 100644 index 00000000000..df268a08243 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_delete_autorest.go @@ -0,0 +1,78 @@ +package apps + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c AppsClient) Delete(ctx context.Context, id IotAppId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c AppsClient) DeleteThenPoll(ctx context.Context, id IotAppId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c AppsClient) preparerForDelete(ctx context.Context, id IotAppId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c AppsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_get_autorest.go new file mode 100644 index 00000000000..06af1dedf38 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_get_autorest.go @@ -0,0 +1,68 @@ +package apps + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *App +} + +// Get ... +func (c AppsClient) Get(ctx context.Context, id IotAppId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c AppsClient) preparerForGet(ctx context.Context, id IotAppId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c AppsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..0eb4729220d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package apps + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]App + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []App +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c AppsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c AppsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.IoTCentral/iotApps", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c AppsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c AppsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []App `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c AppsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, AppOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AppsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate AppOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]App, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..2af177188cf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package apps + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]App + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []App +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c AppsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c AppsClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.IoTCentral/iotApps", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c AppsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c AppsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []App `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c AppsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, AppOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AppsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate AppOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]App, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_listtemplates_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_listtemplates_autorest.go new file mode 100644 index 00000000000..fcddca91820 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_listtemplates_autorest.go @@ -0,0 +1,187 @@ +package apps + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListTemplatesOperationResponse struct { + HttpResponse *http.Response + Model *[]AppTemplate + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListTemplatesOperationResponse, error) +} + +type ListTemplatesCompleteResult struct { + Items []AppTemplate +} + +func (r ListTemplatesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListTemplatesOperationResponse) LoadMore(ctx context.Context) (resp ListTemplatesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListTemplates ... +func (c AppsClient) ListTemplates(ctx context.Context, id commonids.SubscriptionId) (resp ListTemplatesOperationResponse, err error) { + req, err := c.preparerForListTemplates(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListTemplates", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListTemplates", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListTemplates(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListTemplates", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListTemplates prepares the ListTemplates request. +func (c AppsClient) preparerForListTemplates(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.IoTCentral/appTemplates", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListTemplatesWithNextLink prepares the ListTemplates request with the given nextLink token. +func (c AppsClient) preparerForListTemplatesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListTemplates handles the response to the ListTemplates request. The method always +// closes the http.Response Body. +func (c AppsClient) responderForListTemplates(resp *http.Response) (result ListTemplatesOperationResponse, err error) { + type page struct { + Values []AppTemplate `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListTemplatesOperationResponse, err error) { + req, err := c.preparerForListTemplatesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListTemplates", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListTemplates", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListTemplates(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "ListTemplates", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListTemplatesComplete retrieves all of the results into a single object +func (c AppsClient) ListTemplatesComplete(ctx context.Context, id commonids.SubscriptionId) (ListTemplatesCompleteResult, error) { + return c.ListTemplatesCompleteMatchingPredicate(ctx, id, AppTemplateOperationPredicate{}) +} + +// ListTemplatesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AppsClient) ListTemplatesCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate AppTemplateOperationPredicate) (resp ListTemplatesCompleteResult, err error) { + items := make([]AppTemplate, 0) + + page, err := c.ListTemplates(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListTemplatesCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_update_autorest.go new file mode 100644 index 00000000000..2e89b452e2c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/method_update_autorest.go @@ -0,0 +1,79 @@ +package apps + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c AppsClient) Update(ctx context.Context, id IotAppId, input AppPatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "apps.AppsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c AppsClient) UpdateThenPoll(ctx context.Context, id IotAppId, input AppPatch) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c AppsClient) preparerForUpdate(ctx context.Context, id IotAppId, input AppPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c AppsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_app.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_app.go new file mode 100644 index 00000000000..c61878307b6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_app.go @@ -0,0 +1,21 @@ +package apps + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type App struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *AppProperties `json:"properties,omitempty"` + Sku AppSkuInfo `json:"sku"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_appavailabilityinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_appavailabilityinfo.go new file mode 100644 index 00000000000..5d0d287afcd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_appavailabilityinfo.go @@ -0,0 +1,10 @@ +package apps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AppAvailabilityInfo struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *string `json:"reason,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_apppatch.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_apppatch.go new file mode 100644 index 00000000000..83db52803f9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_apppatch.go @@ -0,0 +1,15 @@ +package apps + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AppPatch struct { + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Properties *AppProperties `json:"properties,omitempty"` + Sku *AppSkuInfo `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_appproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_appproperties.go new file mode 100644 index 00000000000..954a240dc9c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_appproperties.go @@ -0,0 +1,16 @@ +package apps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AppProperties struct { + ApplicationId *string `json:"applicationId,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + NetworkRuleSets *NetworkRuleSets `json:"networkRuleSets,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + State *AppState `json:"state,omitempty"` + Subdomain *string `json:"subdomain,omitempty"` + Template *string `json:"template,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_appskuinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_appskuinfo.go new file mode 100644 index 00000000000..6b14aa3ba95 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_appskuinfo.go @@ -0,0 +1,8 @@ +package apps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AppSkuInfo struct { + Name AppSku `json:"name"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_apptemplate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_apptemplate.go new file mode 100644 index 00000000000..c0f26ce2f37 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_apptemplate.go @@ -0,0 +1,15 @@ +package apps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AppTemplate struct { + Description *string `json:"description,omitempty"` + Industry *string `json:"industry,omitempty"` + Locations *[]AppTemplateLocations `json:"locations,omitempty"` + ManifestId *string `json:"manifestId,omitempty"` + ManifestVersion *string `json:"manifestVersion,omitempty"` + Name *string `json:"name,omitempty"` + Order *float64 `json:"order,omitempty"` + Title *string `json:"title,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_apptemplatelocations.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_apptemplatelocations.go new file mode 100644 index 00000000000..ae984b7a409 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_apptemplatelocations.go @@ -0,0 +1,9 @@ +package apps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AppTemplateLocations struct { + DisplayName *string `json:"displayName,omitempty"` + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_networkrulesetiprule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_networkrulesetiprule.go new file mode 100644 index 00000000000..a4fb7e61b13 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_networkrulesetiprule.go @@ -0,0 +1,10 @@ +package apps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkRuleSetIPRule struct { + Action *IPRuleAction `json:"action,omitempty"` + FilterName *string `json:"filterName,omitempty"` + IPMask *string `json:"ipMask,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_networkrulesets.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_networkrulesets.go new file mode 100644 index 00000000000..98da5cb741e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_networkrulesets.go @@ -0,0 +1,11 @@ +package apps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkRuleSets struct { + ApplyToDevices *bool `json:"applyToDevices,omitempty"` + ApplyToIoTCentral *bool `json:"applyToIoTCentral,omitempty"` + DefaultAction *NetworkAction `json:"defaultAction,omitempty"` + IPRules *[]NetworkRuleSetIPRule `json:"ipRules,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_operationinputs.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_operationinputs.go new file mode 100644 index 00000000000..bcb6c96997e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_operationinputs.go @@ -0,0 +1,9 @@ +package apps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OperationInputs struct { + Name string `json:"name"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_privateendpoint.go new file mode 100644 index 00000000000..ddad5aaa1c3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_privateendpoint.go @@ -0,0 +1,8 @@ +package apps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_privateendpointconnection.go new file mode 100644 index 00000000000..452fe1d06f6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_privateendpointconnection.go @@ -0,0 +1,16 @@ +package apps + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..4a2ee7bcdaa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_privateendpointconnectionproperties.go @@ -0,0 +1,11 @@ +package apps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + GroupIds *[]string `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_privatelinkserviceconnectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..23c75dc05c2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package apps + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/predicates.go new file mode 100644 index 00000000000..250676290d2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/predicates.go @@ -0,0 +1,72 @@ +package apps + +type AppOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p AppOperationPredicate) Matches(input App) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type AppTemplateOperationPredicate struct { + Description *string + Industry *string + ManifestId *string + ManifestVersion *string + Name *string + Order *float64 + Title *string +} + +func (p AppTemplateOperationPredicate) Matches(input AppTemplate) bool { + + if p.Description != nil && (input.Description == nil && *p.Description != *input.Description) { + return false + } + + if p.Industry != nil && (input.Industry == nil && *p.Industry != *input.Industry) { + return false + } + + if p.ManifestId != nil && (input.ManifestId == nil && *p.ManifestId != *input.ManifestId) { + return false + } + + if p.ManifestVersion != nil && (input.ManifestVersion == nil && *p.ManifestVersion != *input.ManifestVersion) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Order != nil && (input.Order == nil && *p.Order != *input.Order) { + return false + } + + if p.Title != nil && (input.Title == nil && *p.Title != *input.Title) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/version.go new file mode 100644 index 00000000000..057e77ab96a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps/version.go @@ -0,0 +1,12 @@ +package apps + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-11-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/apps/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/README.md new file mode 100644 index 00000000000..c549cc909ef --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/README.md @@ -0,0 +1,124 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests` Documentation + +The `loadtests` SDK allows for interaction with the Azure Resource Manager Service `loadtestservice` (API Version `2021-12-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests" +``` + + +### Client Initialization + +```go +client := loadtests.NewLoadTestsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `LoadTestsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := loadtests.NewLoadTestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "loadTestValue") + +payload := loadtests.LoadTestResource{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `LoadTestsClient.Delete` + +```go +ctx := context.TODO() +id := loadtests.NewLoadTestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "loadTestValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `LoadTestsClient.Get` + +```go +ctx := context.TODO() +id := loadtests.NewLoadTestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "loadTestValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `LoadTestsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := loadtests.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `LoadTestsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := loadtests.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `LoadTestsClient.Update` + +```go +ctx := context.TODO() +id := loadtests.NewLoadTestID("12345678-1234-9876-4563-123456789012", "example-resource-group", "loadTestValue") + +payload := loadtests.LoadTestResourcePatchRequestBody{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/client.go new file mode 100644 index 00000000000..52a9c9028de --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/client.go @@ -0,0 +1,18 @@ +package loadtests + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadTestsClient struct { + Client autorest.Client + baseUri string +} + +func NewLoadTestsClientWithBaseURI(endpoint string) LoadTestsClient { + return LoadTestsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/constants.go new file mode 100644 index 00000000000..b76a82f3874 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/constants.go @@ -0,0 +1,40 @@ +package loadtests + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceState string + +const ( + ResourceStateCanceled ResourceState = "Canceled" + ResourceStateDeleted ResourceState = "Deleted" + ResourceStateFailed ResourceState = "Failed" + ResourceStateSucceeded ResourceState = "Succeeded" +) + +func PossibleValuesForResourceState() []string { + return []string{ + string(ResourceStateCanceled), + string(ResourceStateDeleted), + string(ResourceStateFailed), + string(ResourceStateSucceeded), + } +} + +func parseResourceState(input string) (*ResourceState, error) { + vals := map[string]ResourceState{ + "canceled": ResourceStateCanceled, + "deleted": ResourceStateDeleted, + "failed": ResourceStateFailed, + "succeeded": ResourceStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/id_loadtest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/id_loadtest.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/id_loadtest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/id_loadtest.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_createorupdate_autorest.go new file mode 100644 index 00000000000..2b90ec8d540 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package loadtests + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *LoadTestResource +} + +// CreateOrUpdate ... +func (c LoadTestsClient) CreateOrUpdate(ctx context.Context, id LoadTestId, input LoadTestResource) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c LoadTestsClient) preparerForCreateOrUpdate(ctx context.Context, id LoadTestId, input LoadTestResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c LoadTestsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_delete_autorest.go new file mode 100644 index 00000000000..2c08ce367d8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_delete_autorest.go @@ -0,0 +1,78 @@ +package loadtests + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c LoadTestsClient) Delete(ctx context.Context, id LoadTestId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c LoadTestsClient) DeleteThenPoll(ctx context.Context, id LoadTestId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c LoadTestsClient) preparerForDelete(ctx context.Context, id LoadTestId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c LoadTestsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_get_autorest.go new file mode 100644 index 00000000000..ef7b59cff5b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_get_autorest.go @@ -0,0 +1,68 @@ +package loadtests + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *LoadTestResource +} + +// Get ... +func (c LoadTestsClient) Get(ctx context.Context, id LoadTestId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c LoadTestsClient) preparerForGet(ctx context.Context, id LoadTestId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c LoadTestsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..8d6f822e215 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package loadtests + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]LoadTestResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []LoadTestResource +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c LoadTestsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c LoadTestsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.LoadTestService/loadTests", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c LoadTestsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c LoadTestsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []LoadTestResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c LoadTestsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, LoadTestResourceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c LoadTestsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate LoadTestResourceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]LoadTestResource, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..b376350e034 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package loadtests + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]LoadTestResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []LoadTestResource +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c LoadTestsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c LoadTestsClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.LoadTestService/loadTests", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c LoadTestsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c LoadTestsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []LoadTestResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c LoadTestsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, LoadTestResourceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c LoadTestsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate LoadTestResourceOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]LoadTestResource, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_update_autorest.go new file mode 100644 index 00000000000..ae7e5353e0c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/method_update_autorest.go @@ -0,0 +1,69 @@ +package loadtests + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *LoadTestResource +} + +// Update ... +func (c LoadTestsClient) Update(ctx context.Context, id LoadTestId, input LoadTestResourcePatchRequestBody) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c LoadTestsClient) preparerForUpdate(ctx context.Context, id LoadTestId, input LoadTestResourcePatchRequestBody) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c LoadTestsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/model_loadtestproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/model_loadtestproperties.go new file mode 100644 index 00000000000..3e20d03c7a2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/model_loadtestproperties.go @@ -0,0 +1,10 @@ +package loadtests + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadTestProperties struct { + DataPlaneURI *string `json:"dataPlaneURI,omitempty"` + Description *string `json:"description,omitempty"` + ProvisioningState *ResourceState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/model_loadtestresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/model_loadtestresource.go new file mode 100644 index 00000000000..8ec377d67a4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/model_loadtestresource.go @@ -0,0 +1,20 @@ +package loadtests + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadTestResource struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *LoadTestProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/model_loadtestresourcepatchrequestbody.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/model_loadtestresourcepatchrequestbody.go new file mode 100644 index 00000000000..1527f0aa1e4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/model_loadtestresourcepatchrequestbody.go @@ -0,0 +1,14 @@ +package loadtests + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadTestResourcePatchRequestBody struct { + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Properties *LoadTestResourcePatchRequestBodyProperties `json:"properties,omitempty"` + Tags *interface{} `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/model_loadtestresourcepatchrequestbodyproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/model_loadtestresourcepatchrequestbodyproperties.go new file mode 100644 index 00000000000..5ea48bcac34 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/model_loadtestresourcepatchrequestbodyproperties.go @@ -0,0 +1,8 @@ +package loadtests + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadTestResourcePatchRequestBodyProperties struct { + Description *string `json:"description,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/predicates.go new file mode 100644 index 00000000000..eae7ed74584 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/predicates.go @@ -0,0 +1,29 @@ +package loadtests + +type LoadTestResourceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p LoadTestResourceOperationPredicate) Matches(input LoadTestResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/version.go new file mode 100644 index 00000000000..244255eebfa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests/version.go @@ -0,0 +1,12 @@ +package loadtests + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-12-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/loadtests/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/README.md new file mode 100644 index 00000000000..0428527e39d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/README.md @@ -0,0 +1,126 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments` Documentation + +The `configurationassignments` SDK allows for interaction with the Azure Resource Manager Service `maintenance` (API Version `2021-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments" +``` + + +### Client Initialization + +```go +client := configurationassignments.NewConfigurationAssignmentsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ConfigurationAssignmentsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := configurationassignments.NewConfigurationAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue", "resourceTypeValue", "resourceValue", "configurationAssignmentValue") + +payload := configurationassignments.ConfigurationAssignment{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConfigurationAssignmentsClient.CreateOrUpdateParent` + +```go +ctx := context.TODO() +id := configurationassignments.NewProviders2ConfigurationAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue", "resourceParentTypeValue", "resourceParentValue", "resourceTypeValue", "resourceValue", "configurationAssignmentValue") + +payload := configurationassignments.ConfigurationAssignment{ + // ... +} + + +read, err := client.CreateOrUpdateParent(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConfigurationAssignmentsClient.Delete` + +```go +ctx := context.TODO() +id := configurationassignments.NewConfigurationAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue", "resourceTypeValue", "resourceValue", "configurationAssignmentValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConfigurationAssignmentsClient.DeleteParent` + +```go +ctx := context.TODO() +id := configurationassignments.NewProviders2ConfigurationAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue", "resourceParentTypeValue", "resourceParentValue", "resourceTypeValue", "resourceValue", "configurationAssignmentValue") + +read, err := client.DeleteParent(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConfigurationAssignmentsClient.List` + +```go +ctx := context.TODO() +id := configurationassignments.NewProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue", "resourceTypeValue", "resourceValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConfigurationAssignmentsClient.ListParent` + +```go +ctx := context.TODO() +id := configurationassignments.NewResourceGroupProviderID("12345678-1234-9876-4563-123456789012", "example-resource-group", "providerValue", "resourceParentTypeValue", "resourceParentValue", "resourceTypeValue", "resourceValue") + +read, err := client.ListParent(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/client.go new file mode 100644 index 00000000000..20420cff689 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/client.go @@ -0,0 +1,18 @@ +package configurationassignments + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationAssignmentsClient struct { + Client autorest.Client + baseUri string +} + +func NewConfigurationAssignmentsClientWithBaseURI(endpoint string) ConfigurationAssignmentsClient { + return ConfigurationAssignmentsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/id_configurationassignment.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/id_configurationassignment.go new file mode 100644 index 00000000000..6ece294c1dc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/id_configurationassignment.go @@ -0,0 +1,161 @@ +package configurationassignments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ConfigurationAssignmentId{} + +// ConfigurationAssignmentId is a struct representing the Resource ID for a Configuration Assignment +type ConfigurationAssignmentId struct { + SubscriptionId string + ResourceGroupName string + ProviderName string + ResourceType string + ResourceName string + ConfigurationAssignmentName string +} + +// NewConfigurationAssignmentID returns a new ConfigurationAssignmentId struct +func NewConfigurationAssignmentID(subscriptionId string, resourceGroupName string, providerName string, resourceType string, resourceName string, configurationAssignmentName string) ConfigurationAssignmentId { + return ConfigurationAssignmentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProviderName: providerName, + ResourceType: resourceType, + ResourceName: resourceName, + ConfigurationAssignmentName: configurationAssignmentName, + } +} + +// ParseConfigurationAssignmentID parses 'input' into a ConfigurationAssignmentId +func ParseConfigurationAssignmentID(input string) (*ConfigurationAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(ConfigurationAssignmentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ConfigurationAssignmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { + return nil, fmt.Errorf("the segment 'providerName' was not found in the resource id %q", input) + } + + if id.ResourceType, ok = parsed.Parsed["resourceType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceType' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + if id.ConfigurationAssignmentName, ok = parsed.Parsed["configurationAssignmentName"]; !ok { + return nil, fmt.Errorf("the segment 'configurationAssignmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseConfigurationAssignmentIDInsensitively parses 'input' case-insensitively into a ConfigurationAssignmentId +// note: this method should only be used for API response data and not user input +func ParseConfigurationAssignmentIDInsensitively(input string) (*ConfigurationAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(ConfigurationAssignmentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ConfigurationAssignmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { + return nil, fmt.Errorf("the segment 'providerName' was not found in the resource id %q", input) + } + + if id.ResourceType, ok = parsed.Parsed["resourceType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceType' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + if id.ConfigurationAssignmentName, ok = parsed.Parsed["configurationAssignmentName"]; !ok { + return nil, fmt.Errorf("the segment 'configurationAssignmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateConfigurationAssignmentID checks that 'input' can be parsed as a Configuration Assignment ID +func ValidateConfigurationAssignmentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseConfigurationAssignmentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Configuration Assignment ID +func (id ConfigurationAssignmentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/%s/%s/%s/providers/Microsoft.Maintenance/configurationAssignments/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProviderName, id.ResourceType, id.ResourceName, id.ConfigurationAssignmentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Configuration Assignment ID +func (id ConfigurationAssignmentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.UserSpecifiedSegment("providerName", "providerValue"), + resourceids.UserSpecifiedSegment("resourceType", "resourceTypeValue"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.StaticSegment("staticProviders2", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMaintenance", "Microsoft.Maintenance", "Microsoft.Maintenance"), + resourceids.StaticSegment("staticConfigurationAssignments", "configurationAssignments", "configurationAssignments"), + resourceids.UserSpecifiedSegment("configurationAssignmentName", "configurationAssignmentValue"), + } +} + +// String returns a human-readable description of this Configuration Assignment ID +func (id ConfigurationAssignmentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Provider Name: %q", id.ProviderName), + fmt.Sprintf("Resource Type: %q", id.ResourceType), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Configuration Assignment Name: %q", id.ConfigurationAssignmentName), + } + return fmt.Sprintf("Configuration Assignment (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/id_provider.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/id_provider.go new file mode 100644 index 00000000000..e39174314d2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/id_provider.go @@ -0,0 +1,146 @@ +package configurationassignments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ProviderId{} + +// ProviderId is a struct representing the Resource ID for a Provider +type ProviderId struct { + SubscriptionId string + ResourceGroupName string + ProviderName string + ResourceType string + ResourceName string +} + +// NewProviderID returns a new ProviderId struct +func NewProviderID(subscriptionId string, resourceGroupName string, providerName string, resourceType string, resourceName string) ProviderId { + return ProviderId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProviderName: providerName, + ResourceType: resourceType, + ResourceName: resourceName, + } +} + +// ParseProviderID parses 'input' into a ProviderId +func ParseProviderID(input string) (*ProviderId, error) { + parser := resourceids.NewParserFromResourceIdType(ProviderId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProviderId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { + return nil, fmt.Errorf("the segment 'providerName' was not found in the resource id %q", input) + } + + if id.ResourceType, ok = parsed.Parsed["resourceType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceType' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseProviderIDInsensitively parses 'input' case-insensitively into a ProviderId +// note: this method should only be used for API response data and not user input +func ParseProviderIDInsensitively(input string) (*ProviderId, error) { + parser := resourceids.NewParserFromResourceIdType(ProviderId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProviderId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { + return nil, fmt.Errorf("the segment 'providerName' was not found in the resource id %q", input) + } + + if id.ResourceType, ok = parsed.Parsed["resourceType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceType' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateProviderID checks that 'input' can be parsed as a Provider ID +func ValidateProviderID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProviderID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Provider ID +func (id ProviderId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/%s/%s/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProviderName, id.ResourceType, id.ResourceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Provider ID +func (id ProviderId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.UserSpecifiedSegment("providerName", "providerValue"), + resourceids.UserSpecifiedSegment("resourceType", "resourceTypeValue"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + } +} + +// String returns a human-readable description of this Provider ID +func (id ProviderId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Provider Name: %q", id.ProviderName), + fmt.Sprintf("Resource Type: %q", id.ResourceType), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + } + return fmt.Sprintf("Provider (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/id_providers2configurationassignment.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/id_providers2configurationassignment.go new file mode 100644 index 00000000000..c22624fabd6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/id_providers2configurationassignment.go @@ -0,0 +1,185 @@ +package configurationassignments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = Providers2ConfigurationAssignmentId{} + +// Providers2ConfigurationAssignmentId is a struct representing the Resource ID for a Providers 2 Configuration Assignment +type Providers2ConfigurationAssignmentId struct { + SubscriptionId string + ResourceGroupName string + ProviderName string + ResourceParentType string + ResourceParentName string + ResourceType string + ResourceName string + ConfigurationAssignmentName string +} + +// NewProviders2ConfigurationAssignmentID returns a new Providers2ConfigurationAssignmentId struct +func NewProviders2ConfigurationAssignmentID(subscriptionId string, resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string, configurationAssignmentName string) Providers2ConfigurationAssignmentId { + return Providers2ConfigurationAssignmentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProviderName: providerName, + ResourceParentType: resourceParentType, + ResourceParentName: resourceParentName, + ResourceType: resourceType, + ResourceName: resourceName, + ConfigurationAssignmentName: configurationAssignmentName, + } +} + +// ParseProviders2ConfigurationAssignmentID parses 'input' into a Providers2ConfigurationAssignmentId +func ParseProviders2ConfigurationAssignmentID(input string) (*Providers2ConfigurationAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(Providers2ConfigurationAssignmentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := Providers2ConfigurationAssignmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { + return nil, fmt.Errorf("the segment 'providerName' was not found in the resource id %q", input) + } + + if id.ResourceParentType, ok = parsed.Parsed["resourceParentType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceParentType' was not found in the resource id %q", input) + } + + if id.ResourceParentName, ok = parsed.Parsed["resourceParentName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceParentName' was not found in the resource id %q", input) + } + + if id.ResourceType, ok = parsed.Parsed["resourceType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceType' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + if id.ConfigurationAssignmentName, ok = parsed.Parsed["configurationAssignmentName"]; !ok { + return nil, fmt.Errorf("the segment 'configurationAssignmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseProviders2ConfigurationAssignmentIDInsensitively parses 'input' case-insensitively into a Providers2ConfigurationAssignmentId +// note: this method should only be used for API response data and not user input +func ParseProviders2ConfigurationAssignmentIDInsensitively(input string) (*Providers2ConfigurationAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(Providers2ConfigurationAssignmentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := Providers2ConfigurationAssignmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { + return nil, fmt.Errorf("the segment 'providerName' was not found in the resource id %q", input) + } + + if id.ResourceParentType, ok = parsed.Parsed["resourceParentType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceParentType' was not found in the resource id %q", input) + } + + if id.ResourceParentName, ok = parsed.Parsed["resourceParentName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceParentName' was not found in the resource id %q", input) + } + + if id.ResourceType, ok = parsed.Parsed["resourceType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceType' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + if id.ConfigurationAssignmentName, ok = parsed.Parsed["configurationAssignmentName"]; !ok { + return nil, fmt.Errorf("the segment 'configurationAssignmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateProviders2ConfigurationAssignmentID checks that 'input' can be parsed as a Providers 2 Configuration Assignment ID +func ValidateProviders2ConfigurationAssignmentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProviders2ConfigurationAssignmentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Providers 2 Configuration Assignment ID +func (id Providers2ConfigurationAssignmentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/%s/%s/%s/%s/%s/providers/Microsoft.Maintenance/configurationAssignments/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProviderName, id.ResourceParentType, id.ResourceParentName, id.ResourceType, id.ResourceName, id.ConfigurationAssignmentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Providers 2 Configuration Assignment ID +func (id Providers2ConfigurationAssignmentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.UserSpecifiedSegment("providerName", "providerValue"), + resourceids.UserSpecifiedSegment("resourceParentType", "resourceParentTypeValue"), + resourceids.UserSpecifiedSegment("resourceParentName", "resourceParentValue"), + resourceids.UserSpecifiedSegment("resourceType", "resourceTypeValue"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.StaticSegment("staticProviders2", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMaintenance", "Microsoft.Maintenance", "Microsoft.Maintenance"), + resourceids.StaticSegment("staticConfigurationAssignments", "configurationAssignments", "configurationAssignments"), + resourceids.UserSpecifiedSegment("configurationAssignmentName", "configurationAssignmentValue"), + } +} + +// String returns a human-readable description of this Providers 2 Configuration Assignment ID +func (id Providers2ConfigurationAssignmentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Provider Name: %q", id.ProviderName), + fmt.Sprintf("Resource Parent Type: %q", id.ResourceParentType), + fmt.Sprintf("Resource Parent Name: %q", id.ResourceParentName), + fmt.Sprintf("Resource Type: %q", id.ResourceType), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Configuration Assignment Name: %q", id.ConfigurationAssignmentName), + } + return fmt.Sprintf("Providers 2 Configuration Assignment (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/id_resourcegroupprovider.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/id_resourcegroupprovider.go new file mode 100644 index 00000000000..b34b82f54b8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/id_resourcegroupprovider.go @@ -0,0 +1,170 @@ +package configurationassignments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ResourceGroupProviderId{} + +// ResourceGroupProviderId is a struct representing the Resource ID for a Resource Group Provider +type ResourceGroupProviderId struct { + SubscriptionId string + ResourceGroupName string + ProviderName string + ResourceParentType string + ResourceParentName string + ResourceType string + ResourceName string +} + +// NewResourceGroupProviderID returns a new ResourceGroupProviderId struct +func NewResourceGroupProviderID(subscriptionId string, resourceGroupName string, providerName string, resourceParentType string, resourceParentName string, resourceType string, resourceName string) ResourceGroupProviderId { + return ResourceGroupProviderId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProviderName: providerName, + ResourceParentType: resourceParentType, + ResourceParentName: resourceParentName, + ResourceType: resourceType, + ResourceName: resourceName, + } +} + +// ParseResourceGroupProviderID parses 'input' into a ResourceGroupProviderId +func ParseResourceGroupProviderID(input string) (*ResourceGroupProviderId, error) { + parser := resourceids.NewParserFromResourceIdType(ResourceGroupProviderId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ResourceGroupProviderId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { + return nil, fmt.Errorf("the segment 'providerName' was not found in the resource id %q", input) + } + + if id.ResourceParentType, ok = parsed.Parsed["resourceParentType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceParentType' was not found in the resource id %q", input) + } + + if id.ResourceParentName, ok = parsed.Parsed["resourceParentName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceParentName' was not found in the resource id %q", input) + } + + if id.ResourceType, ok = parsed.Parsed["resourceType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceType' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseResourceGroupProviderIDInsensitively parses 'input' case-insensitively into a ResourceGroupProviderId +// note: this method should only be used for API response data and not user input +func ParseResourceGroupProviderIDInsensitively(input string) (*ResourceGroupProviderId, error) { + parser := resourceids.NewParserFromResourceIdType(ResourceGroupProviderId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ResourceGroupProviderId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { + return nil, fmt.Errorf("the segment 'providerName' was not found in the resource id %q", input) + } + + if id.ResourceParentType, ok = parsed.Parsed["resourceParentType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceParentType' was not found in the resource id %q", input) + } + + if id.ResourceParentName, ok = parsed.Parsed["resourceParentName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceParentName' was not found in the resource id %q", input) + } + + if id.ResourceType, ok = parsed.Parsed["resourceType"]; !ok { + return nil, fmt.Errorf("the segment 'resourceType' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateResourceGroupProviderID checks that 'input' can be parsed as a Resource Group Provider ID +func ValidateResourceGroupProviderID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseResourceGroupProviderID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Resource Group Provider ID +func (id ResourceGroupProviderId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/%s/%s/%s/%s/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProviderName, id.ResourceParentType, id.ResourceParentName, id.ResourceType, id.ResourceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Resource Group Provider ID +func (id ResourceGroupProviderId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.UserSpecifiedSegment("providerName", "providerValue"), + resourceids.UserSpecifiedSegment("resourceParentType", "resourceParentTypeValue"), + resourceids.UserSpecifiedSegment("resourceParentName", "resourceParentValue"), + resourceids.UserSpecifiedSegment("resourceType", "resourceTypeValue"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + } +} + +// String returns a human-readable description of this Resource Group Provider ID +func (id ResourceGroupProviderId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Provider Name: %q", id.ProviderName), + fmt.Sprintf("Resource Parent Type: %q", id.ResourceParentType), + fmt.Sprintf("Resource Parent Name: %q", id.ResourceParentName), + fmt.Sprintf("Resource Type: %q", id.ResourceType), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + } + return fmt.Sprintf("Resource Group Provider (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_createorupdate_autorest.go new file mode 100644 index 00000000000..fa5ba911b74 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package configurationassignments + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *ConfigurationAssignment +} + +// CreateOrUpdate ... +func (c ConfigurationAssignmentsClient) CreateOrUpdate(ctx context.Context, id ConfigurationAssignmentId, input ConfigurationAssignment) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ConfigurationAssignmentsClient) preparerForCreateOrUpdate(ctx context.Context, id ConfigurationAssignmentId, input ConfigurationAssignment) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ConfigurationAssignmentsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_createorupdateparent_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_createorupdateparent_autorest.go new file mode 100644 index 00000000000..9e100a0f4dc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_createorupdateparent_autorest.go @@ -0,0 +1,69 @@ +package configurationassignments + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateParentOperationResponse struct { + HttpResponse *http.Response + Model *ConfigurationAssignment +} + +// CreateOrUpdateParent ... +func (c ConfigurationAssignmentsClient) CreateOrUpdateParent(ctx context.Context, id Providers2ConfigurationAssignmentId, input ConfigurationAssignment) (result CreateOrUpdateParentOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdateParent(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "CreateOrUpdateParent", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "CreateOrUpdateParent", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdateParent(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "CreateOrUpdateParent", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdateParent prepares the CreateOrUpdateParent request. +func (c ConfigurationAssignmentsClient) preparerForCreateOrUpdateParent(ctx context.Context, id Providers2ConfigurationAssignmentId, input ConfigurationAssignment) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdateParent handles the response to the CreateOrUpdateParent request. The method always +// closes the http.Response Body. +func (c ConfigurationAssignmentsClient) responderForCreateOrUpdateParent(resp *http.Response) (result CreateOrUpdateParentOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_delete_autorest.go new file mode 100644 index 00000000000..8ab96516c8a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_delete_autorest.go @@ -0,0 +1,68 @@ +package configurationassignments + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + Model *ConfigurationAssignment +} + +// Delete ... +func (c ConfigurationAssignmentsClient) Delete(ctx context.Context, id ConfigurationAssignmentId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ConfigurationAssignmentsClient) preparerForDelete(ctx context.Context, id ConfigurationAssignmentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ConfigurationAssignmentsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_deleteparent_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_deleteparent_autorest.go new file mode 100644 index 00000000000..c3f7ce53a53 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_deleteparent_autorest.go @@ -0,0 +1,68 @@ +package configurationassignments + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteParentOperationResponse struct { + HttpResponse *http.Response + Model *ConfigurationAssignment +} + +// DeleteParent ... +func (c ConfigurationAssignmentsClient) DeleteParent(ctx context.Context, id Providers2ConfigurationAssignmentId) (result DeleteParentOperationResponse, err error) { + req, err := c.preparerForDeleteParent(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "DeleteParent", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "DeleteParent", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDeleteParent(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "DeleteParent", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDeleteParent prepares the DeleteParent request. +func (c ConfigurationAssignmentsClient) preparerForDeleteParent(ctx context.Context, id Providers2ConfigurationAssignmentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDeleteParent handles the response to the DeleteParent request. The method always +// closes the http.Response Body. +func (c ConfigurationAssignmentsClient) responderForDeleteParent(resp *http.Response) (result DeleteParentOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_list_autorest.go new file mode 100644 index 00000000000..91e27a03c7d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_list_autorest.go @@ -0,0 +1,69 @@ +package configurationassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *ListConfigurationAssignmentsResult +} + +// List ... +func (c ConfigurationAssignmentsClient) List(ctx context.Context, id ProviderId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c ConfigurationAssignmentsClient) preparerForList(ctx context.Context, id ProviderId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Maintenance/configurationAssignments", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ConfigurationAssignmentsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_listparent_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_listparent_autorest.go new file mode 100644 index 00000000000..58b7dd971b7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/method_listparent_autorest.go @@ -0,0 +1,69 @@ +package configurationassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListParentOperationResponse struct { + HttpResponse *http.Response + Model *ListConfigurationAssignmentsResult +} + +// ListParent ... +func (c ConfigurationAssignmentsClient) ListParent(ctx context.Context, id ResourceGroupProviderId) (result ListParentOperationResponse, err error) { + req, err := c.preparerForListParent(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "ListParent", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "ListParent", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListParent(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurationassignments.ConfigurationAssignmentsClient", "ListParent", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListParent prepares the ListParent request. +func (c ConfigurationAssignmentsClient) preparerForListParent(ctx context.Context, id ResourceGroupProviderId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Maintenance/configurationAssignments", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListParent handles the response to the ListParent request. The method always +// closes the http.Response Body. +func (c ConfigurationAssignmentsClient) responderForListParent(resp *http.Response) (result ListParentOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/model_configurationassignment.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/model_configurationassignment.go new file mode 100644 index 00000000000..99db0c67db7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/model_configurationassignment.go @@ -0,0 +1,17 @@ +package configurationassignments + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationAssignment struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ConfigurationAssignmentProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/model_configurationassignmentproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/model_configurationassignmentproperties.go new file mode 100644 index 00000000000..6f3b76b88e9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/model_configurationassignmentproperties.go @@ -0,0 +1,9 @@ +package configurationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationAssignmentProperties struct { + MaintenanceConfigurationId *string `json:"maintenanceConfigurationId,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/model_listconfigurationassignmentsresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/model_listconfigurationassignmentsresult.go new file mode 100644 index 00000000000..3a98d44c95c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/model_listconfigurationassignmentsresult.go @@ -0,0 +1,8 @@ +package configurationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListConfigurationAssignmentsResult struct { + Value *[]ConfigurationAssignment `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/version.go new file mode 100644 index 00000000000..9ef5817bfc3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments/version.go @@ -0,0 +1,12 @@ +package configurationassignments + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/configurationassignments/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/README.md new file mode 100644 index 00000000000..e85a12bd1ad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/README.md @@ -0,0 +1,126 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations` Documentation + +The `maintenanceconfigurations` SDK allows for interaction with the Azure Resource Manager Service `maintenance` (API Version `2021-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations" +``` + + +### Client Initialization + +```go +client := maintenanceconfigurations.NewMaintenanceConfigurationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `MaintenanceConfigurationsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +payload := maintenanceconfigurations.MaintenanceConfiguration{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `MaintenanceConfigurationsClient.Delete` + +```go +ctx := context.TODO() +id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `MaintenanceConfigurationsClient.ForResourceGroupList` + +```go +ctx := context.TODO() +id := maintenanceconfigurations.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.ForResourceGroupList(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `MaintenanceConfigurationsClient.Get` + +```go +ctx := context.TODO() +id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `MaintenanceConfigurationsClient.List` + +```go +ctx := context.TODO() +id := maintenanceconfigurations.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `MaintenanceConfigurationsClient.Update` + +```go +ctx := context.TODO() +id := maintenanceconfigurations.NewMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +payload := maintenanceconfigurations.MaintenanceConfiguration{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/client.go new file mode 100644 index 00000000000..c955dc01ae8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/client.go @@ -0,0 +1,18 @@ +package maintenanceconfigurations + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaintenanceConfigurationsClient struct { + Client autorest.Client + baseUri string +} + +func NewMaintenanceConfigurationsClientWithBaseURI(endpoint string) MaintenanceConfigurationsClient { + return MaintenanceConfigurationsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/constants.go new file mode 100644 index 00000000000..0f1d074b411 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/constants.go @@ -0,0 +1,74 @@ +package maintenanceconfigurations + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaintenanceScope string + +const ( + MaintenanceScopeExtension MaintenanceScope = "Extension" + MaintenanceScopeHost MaintenanceScope = "Host" + MaintenanceScopeInGuestPatch MaintenanceScope = "InGuestPatch" + MaintenanceScopeOSImage MaintenanceScope = "OSImage" + MaintenanceScopeSQLDB MaintenanceScope = "SQLDB" + MaintenanceScopeSQLManagedInstance MaintenanceScope = "SQLManagedInstance" +) + +func PossibleValuesForMaintenanceScope() []string { + return []string{ + string(MaintenanceScopeExtension), + string(MaintenanceScopeHost), + string(MaintenanceScopeInGuestPatch), + string(MaintenanceScopeOSImage), + string(MaintenanceScopeSQLDB), + string(MaintenanceScopeSQLManagedInstance), + } +} + +func parseMaintenanceScope(input string) (*MaintenanceScope, error) { + vals := map[string]MaintenanceScope{ + "extension": MaintenanceScopeExtension, + "host": MaintenanceScopeHost, + "inguestpatch": MaintenanceScopeInGuestPatch, + "osimage": MaintenanceScopeOSImage, + "sqldb": MaintenanceScopeSQLDB, + "sqlmanagedinstance": MaintenanceScopeSQLManagedInstance, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MaintenanceScope(input) + return &out, nil +} + +type Visibility string + +const ( + VisibilityCustom Visibility = "Custom" + VisibilityPublic Visibility = "Public" +) + +func PossibleValuesForVisibility() []string { + return []string{ + string(VisibilityCustom), + string(VisibilityPublic), + } +} + +func parseVisibility(input string) (*Visibility, error) { + vals := map[string]Visibility{ + "custom": VisibilityCustom, + "public": VisibilityPublic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Visibility(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/id_maintenanceconfiguration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/id_maintenanceconfiguration.go new file mode 100644 index 00000000000..26f59b7c537 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/id_maintenanceconfiguration.go @@ -0,0 +1,124 @@ +package maintenanceconfigurations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = MaintenanceConfigurationId{} + +// MaintenanceConfigurationId is a struct representing the Resource ID for a Maintenance Configuration +type MaintenanceConfigurationId struct { + SubscriptionId string + ResourceGroupName string + ResourceName string +} + +// NewMaintenanceConfigurationID returns a new MaintenanceConfigurationId struct +func NewMaintenanceConfigurationID(subscriptionId string, resourceGroupName string, resourceName string) MaintenanceConfigurationId { + return MaintenanceConfigurationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceName: resourceName, + } +} + +// ParseMaintenanceConfigurationID parses 'input' into a MaintenanceConfigurationId +func ParseMaintenanceConfigurationID(input string) (*MaintenanceConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(MaintenanceConfigurationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MaintenanceConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseMaintenanceConfigurationIDInsensitively parses 'input' case-insensitively into a MaintenanceConfigurationId +// note: this method should only be used for API response data and not user input +func ParseMaintenanceConfigurationIDInsensitively(input string) (*MaintenanceConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(MaintenanceConfigurationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := MaintenanceConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateMaintenanceConfigurationID checks that 'input' can be parsed as a Maintenance Configuration ID +func ValidateMaintenanceConfigurationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseMaintenanceConfigurationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Maintenance Configuration ID +func (id MaintenanceConfigurationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Maintenance/maintenanceConfigurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Maintenance Configuration ID +func (id MaintenanceConfigurationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMaintenance", "Microsoft.Maintenance", "Microsoft.Maintenance"), + resourceids.StaticSegment("staticMaintenanceConfigurations", "maintenanceConfigurations", "maintenanceConfigurations"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + } +} + +// String returns a human-readable description of this Maintenance Configuration ID +func (id MaintenanceConfigurationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + } + return fmt.Sprintf("Maintenance Configuration (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_createorupdate_autorest.go new file mode 100644 index 00000000000..57eb1a03ef4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package maintenanceconfigurations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *MaintenanceConfiguration +} + +// CreateOrUpdate ... +func (c MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c MaintenanceConfigurationsClient) preparerForCreateOrUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c MaintenanceConfigurationsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_delete_autorest.go new file mode 100644 index 00000000000..4db05510870 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_delete_autorest.go @@ -0,0 +1,68 @@ +package maintenanceconfigurations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + Model *MaintenanceConfiguration +} + +// Delete ... +func (c MaintenanceConfigurationsClient) Delete(ctx context.Context, id MaintenanceConfigurationId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c MaintenanceConfigurationsClient) preparerForDelete(ctx context.Context, id MaintenanceConfigurationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c MaintenanceConfigurationsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_forresourcegrouplist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_forresourcegrouplist_autorest.go new file mode 100644 index 00000000000..ef931f5c0c6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_forresourcegrouplist_autorest.go @@ -0,0 +1,70 @@ +package maintenanceconfigurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForResourceGroupListOperationResponse struct { + HttpResponse *http.Response + Model *ListMaintenanceConfigurationsResult +} + +// ForResourceGroupList ... +func (c MaintenanceConfigurationsClient) ForResourceGroupList(ctx context.Context, id commonids.ResourceGroupId) (result ForResourceGroupListOperationResponse, err error) { + req, err := c.preparerForForResourceGroupList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ForResourceGroupList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ForResourceGroupList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForForResourceGroupList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "ForResourceGroupList", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForForResourceGroupList prepares the ForResourceGroupList request. +func (c MaintenanceConfigurationsClient) preparerForForResourceGroupList(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Maintenance/maintenanceConfigurations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForForResourceGroupList handles the response to the ForResourceGroupList request. The method always +// closes the http.Response Body. +func (c MaintenanceConfigurationsClient) responderForForResourceGroupList(resp *http.Response) (result ForResourceGroupListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_get_autorest.go new file mode 100644 index 00000000000..57a6eb55e01 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_get_autorest.go @@ -0,0 +1,68 @@ +package maintenanceconfigurations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *MaintenanceConfiguration +} + +// Get ... +func (c MaintenanceConfigurationsClient) Get(ctx context.Context, id MaintenanceConfigurationId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c MaintenanceConfigurationsClient) preparerForGet(ctx context.Context, id MaintenanceConfigurationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c MaintenanceConfigurationsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_list_autorest.go new file mode 100644 index 00000000000..a804bec70ad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_list_autorest.go @@ -0,0 +1,70 @@ +package maintenanceconfigurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *ListMaintenanceConfigurationsResult +} + +// List ... +func (c MaintenanceConfigurationsClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c MaintenanceConfigurationsClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Maintenance/maintenanceConfigurations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c MaintenanceConfigurationsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_update_autorest.go new file mode 100644 index 00000000000..0410ac2e145 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/method_update_autorest.go @@ -0,0 +1,69 @@ +package maintenanceconfigurations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *MaintenanceConfiguration +} + +// Update ... +func (c MaintenanceConfigurationsClient) Update(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "maintenanceconfigurations.MaintenanceConfigurationsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c MaintenanceConfigurationsClient) preparerForUpdate(ctx context.Context, id MaintenanceConfigurationId, input MaintenanceConfiguration) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c MaintenanceConfigurationsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/model_listmaintenanceconfigurationsresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/model_listmaintenanceconfigurationsresult.go new file mode 100644 index 00000000000..d43447c158e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/model_listmaintenanceconfigurationsresult.go @@ -0,0 +1,8 @@ +package maintenanceconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListMaintenanceConfigurationsResult struct { + Value *[]MaintenanceConfiguration `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/model_maintenanceconfiguration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/model_maintenanceconfiguration.go new file mode 100644 index 00000000000..dc98b878e51 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/model_maintenanceconfiguration.go @@ -0,0 +1,18 @@ +package maintenanceconfigurations + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaintenanceConfiguration struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *MaintenanceConfigurationProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/model_maintenanceconfigurationproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/model_maintenanceconfigurationproperties.go new file mode 100644 index 00000000000..f68853eeabf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/model_maintenanceconfigurationproperties.go @@ -0,0 +1,12 @@ +package maintenanceconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaintenanceConfigurationProperties struct { + ExtensionProperties *map[string]string `json:"extensionProperties,omitempty"` + MaintenanceScope *MaintenanceScope `json:"maintenanceScope,omitempty"` + MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` + Namespace *string `json:"namespace,omitempty"` + Visibility *Visibility `json:"visibility,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/model_maintenancewindow.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/model_maintenancewindow.go new file mode 100644 index 00000000000..6029080ddaa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/model_maintenancewindow.go @@ -0,0 +1,12 @@ +package maintenanceconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaintenanceWindow struct { + Duration *string `json:"duration,omitempty"` + ExpirationDateTime *string `json:"expirationDateTime,omitempty"` + RecurEvery *string `json:"recurEvery,omitempty"` + StartDateTime *string `json:"startDateTime,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/version.go new file mode 100644 index 00000000000..9e096213cf5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/version.go @@ -0,0 +1,12 @@ +package maintenanceconfigurations + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/maintenanceconfigurations/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/README.md new file mode 100644 index 00000000000..fcbf3aba316 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/README.md @@ -0,0 +1,52 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations` Documentation + +The `publicmaintenanceconfigurations` SDK allows for interaction with the Azure Resource Manager Service `maintenance` (API Version `2021-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations" +``` + + +### Client Initialization + +```go +client := publicmaintenanceconfigurations.NewPublicMaintenanceConfigurationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PublicMaintenanceConfigurationsClient.Get` + +```go +ctx := context.TODO() +id := publicmaintenanceconfigurations.NewPublicMaintenanceConfigurationID("12345678-1234-9876-4563-123456789012", "resourceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PublicMaintenanceConfigurationsClient.List` + +```go +ctx := context.TODO() +id := publicmaintenanceconfigurations.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/client.go new file mode 100644 index 00000000000..94b34c9c260 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/client.go @@ -0,0 +1,18 @@ +package publicmaintenanceconfigurations + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublicMaintenanceConfigurationsClient struct { + Client autorest.Client + baseUri string +} + +func NewPublicMaintenanceConfigurationsClientWithBaseURI(endpoint string) PublicMaintenanceConfigurationsClient { + return PublicMaintenanceConfigurationsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/constants.go new file mode 100644 index 00000000000..de99921f8b6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/constants.go @@ -0,0 +1,74 @@ +package publicmaintenanceconfigurations + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaintenanceScope string + +const ( + MaintenanceScopeExtension MaintenanceScope = "Extension" + MaintenanceScopeHost MaintenanceScope = "Host" + MaintenanceScopeInGuestPatch MaintenanceScope = "InGuestPatch" + MaintenanceScopeOSImage MaintenanceScope = "OSImage" + MaintenanceScopeSQLDB MaintenanceScope = "SQLDB" + MaintenanceScopeSQLManagedInstance MaintenanceScope = "SQLManagedInstance" +) + +func PossibleValuesForMaintenanceScope() []string { + return []string{ + string(MaintenanceScopeExtension), + string(MaintenanceScopeHost), + string(MaintenanceScopeInGuestPatch), + string(MaintenanceScopeOSImage), + string(MaintenanceScopeSQLDB), + string(MaintenanceScopeSQLManagedInstance), + } +} + +func parseMaintenanceScope(input string) (*MaintenanceScope, error) { + vals := map[string]MaintenanceScope{ + "extension": MaintenanceScopeExtension, + "host": MaintenanceScopeHost, + "inguestpatch": MaintenanceScopeInGuestPatch, + "osimage": MaintenanceScopeOSImage, + "sqldb": MaintenanceScopeSQLDB, + "sqlmanagedinstance": MaintenanceScopeSQLManagedInstance, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MaintenanceScope(input) + return &out, nil +} + +type Visibility string + +const ( + VisibilityCustom Visibility = "Custom" + VisibilityPublic Visibility = "Public" +) + +func PossibleValuesForVisibility() []string { + return []string{ + string(VisibilityCustom), + string(VisibilityPublic), + } +} + +func parseVisibility(input string) (*Visibility, error) { + vals := map[string]Visibility{ + "custom": VisibilityCustom, + "public": VisibilityPublic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Visibility(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go new file mode 100644 index 00000000000..598ea7f1a23 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go @@ -0,0 +1,111 @@ +package publicmaintenanceconfigurations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PublicMaintenanceConfigurationId{} + +// PublicMaintenanceConfigurationId is a struct representing the Resource ID for a Public Maintenance Configuration +type PublicMaintenanceConfigurationId struct { + SubscriptionId string + ResourceName string +} + +// NewPublicMaintenanceConfigurationID returns a new PublicMaintenanceConfigurationId struct +func NewPublicMaintenanceConfigurationID(subscriptionId string, resourceName string) PublicMaintenanceConfigurationId { + return PublicMaintenanceConfigurationId{ + SubscriptionId: subscriptionId, + ResourceName: resourceName, + } +} + +// ParsePublicMaintenanceConfigurationID parses 'input' into a PublicMaintenanceConfigurationId +func ParsePublicMaintenanceConfigurationID(input string) (*PublicMaintenanceConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(PublicMaintenanceConfigurationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PublicMaintenanceConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePublicMaintenanceConfigurationIDInsensitively parses 'input' case-insensitively into a PublicMaintenanceConfigurationId +// note: this method should only be used for API response data and not user input +func ParsePublicMaintenanceConfigurationIDInsensitively(input string) (*PublicMaintenanceConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(PublicMaintenanceConfigurationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PublicMaintenanceConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePublicMaintenanceConfigurationID checks that 'input' can be parsed as a Public Maintenance Configuration ID +func ValidatePublicMaintenanceConfigurationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePublicMaintenanceConfigurationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Public Maintenance Configuration ID +func (id PublicMaintenanceConfigurationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Public Maintenance Configuration ID +func (id PublicMaintenanceConfigurationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMaintenance", "Microsoft.Maintenance", "Microsoft.Maintenance"), + resourceids.StaticSegment("staticPublicMaintenanceConfigurations", "publicMaintenanceConfigurations", "publicMaintenanceConfigurations"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + } +} + +// String returns a human-readable description of this Public Maintenance Configuration ID +func (id PublicMaintenanceConfigurationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + } + return fmt.Sprintf("Public Maintenance Configuration (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/method_get_autorest.go new file mode 100644 index 00000000000..b2f4cafb7c0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/method_get_autorest.go @@ -0,0 +1,68 @@ +package publicmaintenanceconfigurations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *MaintenanceConfiguration +} + +// Get ... +func (c PublicMaintenanceConfigurationsClient) Get(ctx context.Context, id PublicMaintenanceConfigurationId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "publicmaintenanceconfigurations.PublicMaintenanceConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "publicmaintenanceconfigurations.PublicMaintenanceConfigurationsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "publicmaintenanceconfigurations.PublicMaintenanceConfigurationsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c PublicMaintenanceConfigurationsClient) preparerForGet(ctx context.Context, id PublicMaintenanceConfigurationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c PublicMaintenanceConfigurationsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/method_list_autorest.go new file mode 100644 index 00000000000..0716b1ccefe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/method_list_autorest.go @@ -0,0 +1,70 @@ +package publicmaintenanceconfigurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *ListMaintenanceConfigurationsResult +} + +// List ... +func (c PublicMaintenanceConfigurationsClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "publicmaintenanceconfigurations.PublicMaintenanceConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "publicmaintenanceconfigurations.PublicMaintenanceConfigurationsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "publicmaintenanceconfigurations.PublicMaintenanceConfigurationsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c PublicMaintenanceConfigurationsClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Maintenance/publicMaintenanceConfigurations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c PublicMaintenanceConfigurationsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/model_listmaintenanceconfigurationsresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/model_listmaintenanceconfigurationsresult.go new file mode 100644 index 00000000000..3b46e41b8ea --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/model_listmaintenanceconfigurationsresult.go @@ -0,0 +1,8 @@ +package publicmaintenanceconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListMaintenanceConfigurationsResult struct { + Value *[]MaintenanceConfiguration `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/model_maintenanceconfiguration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/model_maintenanceconfiguration.go new file mode 100644 index 00000000000..2d039cc921f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/model_maintenanceconfiguration.go @@ -0,0 +1,18 @@ +package publicmaintenanceconfigurations + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaintenanceConfiguration struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *MaintenanceConfigurationProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/model_maintenanceconfigurationproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/model_maintenanceconfigurationproperties.go new file mode 100644 index 00000000000..ab56ef9bfe0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/model_maintenanceconfigurationproperties.go @@ -0,0 +1,12 @@ +package publicmaintenanceconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaintenanceConfigurationProperties struct { + ExtensionProperties *map[string]string `json:"extensionProperties,omitempty"` + MaintenanceScope *MaintenanceScope `json:"maintenanceScope,omitempty"` + MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` + Namespace *string `json:"namespace,omitempty"` + Visibility *Visibility `json:"visibility,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/model_maintenancewindow.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/model_maintenancewindow.go new file mode 100644 index 00000000000..720a9f37998 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/model_maintenancewindow.go @@ -0,0 +1,12 @@ +package publicmaintenanceconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaintenanceWindow struct { + Duration *string `json:"duration,omitempty"` + ExpirationDateTime *string `json:"expirationDateTime,omitempty"` + RecurEvery *string `json:"recurEvery,omitempty"` + StartDateTime *string `json:"startDateTime,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/version.go new file mode 100644 index 00000000000..32a01350d54 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/version.go @@ -0,0 +1,12 @@ +package publicmaintenanceconfigurations + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/publicmaintenanceconfigurations/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/README.md new file mode 100644 index 00000000000..cfed3558886 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/README.md @@ -0,0 +1,144 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities` Documentation + +The `managedidentities` SDK allows for interaction with the Azure Resource Manager Service `managedidentity` (API Version `2018-11-30`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities" +``` + + +### Client Initialization + +```go +client := managedidentities.NewManagedIdentitiesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ManagedIdentitiesClient.SystemAssignedIdentitiesGetByScope` + +```go +ctx := context.TODO() +id := managedidentities.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +read, err := client.SystemAssignedIdentitiesGetByScope(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedIdentitiesClient.UserAssignedIdentitiesCreateOrUpdate` + +```go +ctx := context.TODO() +id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +payload := managedidentities.Identity{ + // ... +} + + +read, err := client.UserAssignedIdentitiesCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedIdentitiesClient.UserAssignedIdentitiesDelete` + +```go +ctx := context.TODO() +id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +read, err := client.UserAssignedIdentitiesDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedIdentitiesClient.UserAssignedIdentitiesGet` + +```go +ctx := context.TODO() +id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +read, err := client.UserAssignedIdentitiesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedIdentitiesClient.UserAssignedIdentitiesListByResourceGroup` + +```go +ctx := context.TODO() +id := managedidentities.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.UserAssignedIdentitiesListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.UserAssignedIdentitiesListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ManagedIdentitiesClient.UserAssignedIdentitiesListBySubscription` + +```go +ctx := context.TODO() +id := managedidentities.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.UserAssignedIdentitiesListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.UserAssignedIdentitiesListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ManagedIdentitiesClient.UserAssignedIdentitiesUpdate` + +```go +ctx := context.TODO() +id := managedidentities.NewUserAssignedIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +payload := managedidentities.IdentityUpdate{ + // ... +} + + +read, err := client.UserAssignedIdentitiesUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/client.go new file mode 100644 index 00000000000..b7ed375f569 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/client.go @@ -0,0 +1,18 @@ +package managedidentities + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedIdentitiesClient struct { + Client autorest.Client + baseUri string +} + +func NewManagedIdentitiesClientWithBaseURI(endpoint string) ManagedIdentitiesClient { + return ManagedIdentitiesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_systemassignedidentitiesgetbyscope_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_systemassignedidentitiesgetbyscope_autorest.go new file mode 100644 index 00000000000..22b0b58ddd6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_systemassignedidentitiesgetbyscope_autorest.go @@ -0,0 +1,70 @@ +package managedidentities + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SystemAssignedIdentitiesGetByScopeOperationResponse struct { + HttpResponse *http.Response + Model *SystemAssignedIdentity +} + +// SystemAssignedIdentitiesGetByScope ... +func (c ManagedIdentitiesClient) SystemAssignedIdentitiesGetByScope(ctx context.Context, id commonids.ScopeId) (result SystemAssignedIdentitiesGetByScopeOperationResponse, err error) { + req, err := c.preparerForSystemAssignedIdentitiesGetByScope(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "SystemAssignedIdentitiesGetByScope", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "SystemAssignedIdentitiesGetByScope", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSystemAssignedIdentitiesGetByScope(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "SystemAssignedIdentitiesGetByScope", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSystemAssignedIdentitiesGetByScope prepares the SystemAssignedIdentitiesGetByScope request. +func (c ManagedIdentitiesClient) preparerForSystemAssignedIdentitiesGetByScope(ctx context.Context, id commonids.ScopeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ManagedIdentity/identities/default", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSystemAssignedIdentitiesGetByScope handles the response to the SystemAssignedIdentitiesGetByScope request. The method always +// closes the http.Response Body. +func (c ManagedIdentitiesClient) responderForSystemAssignedIdentitiesGetByScope(resp *http.Response) (result SystemAssignedIdentitiesGetByScopeOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitiescreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitiescreateorupdate_autorest.go new file mode 100644 index 00000000000..d5f05a43907 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitiescreateorupdate_autorest.go @@ -0,0 +1,70 @@ +package managedidentities + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserAssignedIdentitiesCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Identity +} + +// UserAssignedIdentitiesCreateOrUpdate ... +func (c ManagedIdentitiesClient) UserAssignedIdentitiesCreateOrUpdate(ctx context.Context, id commonids.UserAssignedIdentityId, input Identity) (result UserAssignedIdentitiesCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForUserAssignedIdentitiesCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesCreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUserAssignedIdentitiesCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesCreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUserAssignedIdentitiesCreateOrUpdate prepares the UserAssignedIdentitiesCreateOrUpdate request. +func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesCreateOrUpdate(ctx context.Context, id commonids.UserAssignedIdentityId, input Identity) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUserAssignedIdentitiesCreateOrUpdate handles the response to the UserAssignedIdentitiesCreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ManagedIdentitiesClient) responderForUserAssignedIdentitiesCreateOrUpdate(resp *http.Response) (result UserAssignedIdentitiesCreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitiesdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitiesdelete_autorest.go new file mode 100644 index 00000000000..ea7e54fd0c0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitiesdelete_autorest.go @@ -0,0 +1,67 @@ +package managedidentities + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserAssignedIdentitiesDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// UserAssignedIdentitiesDelete ... +func (c ManagedIdentitiesClient) UserAssignedIdentitiesDelete(ctx context.Context, id commonids.UserAssignedIdentityId) (result UserAssignedIdentitiesDeleteOperationResponse, err error) { + req, err := c.preparerForUserAssignedIdentitiesDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUserAssignedIdentitiesDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUserAssignedIdentitiesDelete prepares the UserAssignedIdentitiesDelete request. +func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesDelete(ctx context.Context, id commonids.UserAssignedIdentityId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUserAssignedIdentitiesDelete handles the response to the UserAssignedIdentitiesDelete request. The method always +// closes the http.Response Body. +func (c ManagedIdentitiesClient) responderForUserAssignedIdentitiesDelete(resp *http.Response) (result UserAssignedIdentitiesDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitiesget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitiesget_autorest.go new file mode 100644 index 00000000000..dc6ce10ee8c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitiesget_autorest.go @@ -0,0 +1,69 @@ +package managedidentities + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserAssignedIdentitiesGetOperationResponse struct { + HttpResponse *http.Response + Model *Identity +} + +// UserAssignedIdentitiesGet ... +func (c ManagedIdentitiesClient) UserAssignedIdentitiesGet(ctx context.Context, id commonids.UserAssignedIdentityId) (result UserAssignedIdentitiesGetOperationResponse, err error) { + req, err := c.preparerForUserAssignedIdentitiesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUserAssignedIdentitiesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUserAssignedIdentitiesGet prepares the UserAssignedIdentitiesGet request. +func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesGet(ctx context.Context, id commonids.UserAssignedIdentityId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUserAssignedIdentitiesGet handles the response to the UserAssignedIdentitiesGet request. The method always +// closes the http.Response Body. +func (c ManagedIdentitiesClient) responderForUserAssignedIdentitiesGet(resp *http.Response) (result UserAssignedIdentitiesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitieslistbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitieslistbyresourcegroup_autorest.go new file mode 100644 index 00000000000..71cbdae7248 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitieslistbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package managedidentities + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserAssignedIdentitiesListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Identity + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (UserAssignedIdentitiesListByResourceGroupOperationResponse, error) +} + +type UserAssignedIdentitiesListByResourceGroupCompleteResult struct { + Items []Identity +} + +func (r UserAssignedIdentitiesListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r UserAssignedIdentitiesListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp UserAssignedIdentitiesListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// UserAssignedIdentitiesListByResourceGroup ... +func (c ManagedIdentitiesClient) UserAssignedIdentitiesListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp UserAssignedIdentitiesListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForUserAssignedIdentitiesListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForUserAssignedIdentitiesListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForUserAssignedIdentitiesListByResourceGroup prepares the UserAssignedIdentitiesListByResourceGroup request. +func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ManagedIdentity/userAssignedIdentities", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForUserAssignedIdentitiesListByResourceGroupWithNextLink prepares the UserAssignedIdentitiesListByResourceGroup request with the given nextLink token. +func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUserAssignedIdentitiesListByResourceGroup handles the response to the UserAssignedIdentitiesListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ManagedIdentitiesClient) responderForUserAssignedIdentitiesListByResourceGroup(resp *http.Response) (result UserAssignedIdentitiesListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Identity `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result UserAssignedIdentitiesListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForUserAssignedIdentitiesListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUserAssignedIdentitiesListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// UserAssignedIdentitiesListByResourceGroupComplete retrieves all of the results into a single object +func (c ManagedIdentitiesClient) UserAssignedIdentitiesListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (UserAssignedIdentitiesListByResourceGroupCompleteResult, error) { + return c.UserAssignedIdentitiesListByResourceGroupCompleteMatchingPredicate(ctx, id, IdentityOperationPredicate{}) +} + +// UserAssignedIdentitiesListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ManagedIdentitiesClient) UserAssignedIdentitiesListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate IdentityOperationPredicate) (resp UserAssignedIdentitiesListByResourceGroupCompleteResult, err error) { + items := make([]Identity, 0) + + page, err := c.UserAssignedIdentitiesListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := UserAssignedIdentitiesListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitieslistbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitieslistbysubscription_autorest.go new file mode 100644 index 00000000000..56809d47a15 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitieslistbysubscription_autorest.go @@ -0,0 +1,187 @@ +package managedidentities + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserAssignedIdentitiesListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Identity + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (UserAssignedIdentitiesListBySubscriptionOperationResponse, error) +} + +type UserAssignedIdentitiesListBySubscriptionCompleteResult struct { + Items []Identity +} + +func (r UserAssignedIdentitiesListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r UserAssignedIdentitiesListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp UserAssignedIdentitiesListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// UserAssignedIdentitiesListBySubscription ... +func (c ManagedIdentitiesClient) UserAssignedIdentitiesListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp UserAssignedIdentitiesListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForUserAssignedIdentitiesListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForUserAssignedIdentitiesListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForUserAssignedIdentitiesListBySubscription prepares the UserAssignedIdentitiesListBySubscription request. +func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ManagedIdentity/userAssignedIdentities", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForUserAssignedIdentitiesListBySubscriptionWithNextLink prepares the UserAssignedIdentitiesListBySubscription request with the given nextLink token. +func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUserAssignedIdentitiesListBySubscription handles the response to the UserAssignedIdentitiesListBySubscription request. The method always +// closes the http.Response Body. +func (c ManagedIdentitiesClient) responderForUserAssignedIdentitiesListBySubscription(resp *http.Response) (result UserAssignedIdentitiesListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Identity `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result UserAssignedIdentitiesListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForUserAssignedIdentitiesListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUserAssignedIdentitiesListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// UserAssignedIdentitiesListBySubscriptionComplete retrieves all of the results into a single object +func (c ManagedIdentitiesClient) UserAssignedIdentitiesListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (UserAssignedIdentitiesListBySubscriptionCompleteResult, error) { + return c.UserAssignedIdentitiesListBySubscriptionCompleteMatchingPredicate(ctx, id, IdentityOperationPredicate{}) +} + +// UserAssignedIdentitiesListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ManagedIdentitiesClient) UserAssignedIdentitiesListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate IdentityOperationPredicate) (resp UserAssignedIdentitiesListBySubscriptionCompleteResult, err error) { + items := make([]Identity, 0) + + page, err := c.UserAssignedIdentitiesListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := UserAssignedIdentitiesListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitiesupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitiesupdate_autorest.go new file mode 100644 index 00000000000..22cea8211eb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/method_userassignedidentitiesupdate_autorest.go @@ -0,0 +1,70 @@ +package managedidentities + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserAssignedIdentitiesUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Identity +} + +// UserAssignedIdentitiesUpdate ... +func (c ManagedIdentitiesClient) UserAssignedIdentitiesUpdate(ctx context.Context, id commonids.UserAssignedIdentityId, input IdentityUpdate) (result UserAssignedIdentitiesUpdateOperationResponse, err error) { + req, err := c.preparerForUserAssignedIdentitiesUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUserAssignedIdentitiesUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedidentities.ManagedIdentitiesClient", "UserAssignedIdentitiesUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUserAssignedIdentitiesUpdate prepares the UserAssignedIdentitiesUpdate request. +func (c ManagedIdentitiesClient) preparerForUserAssignedIdentitiesUpdate(ctx context.Context, id commonids.UserAssignedIdentityId, input IdentityUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUserAssignedIdentitiesUpdate handles the response to the UserAssignedIdentitiesUpdate request. The method always +// closes the http.Response Body. +func (c ManagedIdentitiesClient) responderForUserAssignedIdentitiesUpdate(resp *http.Response) (result UserAssignedIdentitiesUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/model_identity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/model_identity.go new file mode 100644 index 00000000000..57a699bedd4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/model_identity.go @@ -0,0 +1,13 @@ +package managedidentities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Identity struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *UserAssignedIdentityProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/model_identityupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/model_identityupdate.go new file mode 100644 index 00000000000..8a33c3afc3a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/model_identityupdate.go @@ -0,0 +1,13 @@ +package managedidentities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IdentityUpdate struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *UserAssignedIdentityProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/model_systemassignedidentity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/model_systemassignedidentity.go new file mode 100644 index 00000000000..99548d4fe8b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/model_systemassignedidentity.go @@ -0,0 +1,13 @@ +package managedidentities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SystemAssignedIdentity struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *SystemAssignedIdentityProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/model_systemassignedidentityproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/model_systemassignedidentityproperties.go new file mode 100644 index 00000000000..ce9255da48b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/model_systemassignedidentityproperties.go @@ -0,0 +1,11 @@ +package managedidentities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SystemAssignedIdentityProperties struct { + ClientId *string `json:"clientId,omitempty"` + ClientSecretUrl *string `json:"clientSecretUrl,omitempty"` + PrincipalId *string `json:"principalId,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/model_userassignedidentityproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/model_userassignedidentityproperties.go new file mode 100644 index 00000000000..f55185a771b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/model_userassignedidentityproperties.go @@ -0,0 +1,10 @@ +package managedidentities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserAssignedIdentityProperties struct { + ClientId *string `json:"clientId,omitempty"` + PrincipalId *string `json:"principalId,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/predicates.go new file mode 100644 index 00000000000..c2ebab38f5f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/predicates.go @@ -0,0 +1,29 @@ +package managedidentities + +type IdentityOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p IdentityOperationPredicate) Matches(input Identity) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/version.go new file mode 100644 index 00000000000..0c7ce728509 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities/version.go @@ -0,0 +1,12 @@ +package managedidentities + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-11-30" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/managedidentities/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/README.md new file mode 100644 index 00000000000..f31f28ef722 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments` Documentation + +The `registrationassignments` SDK allows for interaction with the Azure Resource Manager Service `managedservices` (API Version `2019-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments" +``` + + +### Client Initialization + +```go +client := registrationassignments.NewRegistrationAssignmentsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RegistrationAssignmentsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := registrationassignments.NewScopedRegistrationAssignmentID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "registrationAssignmentIdValue") + +payload := registrationassignments.RegistrationAssignment{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RegistrationAssignmentsClient.Delete` + +```go +ctx := context.TODO() +id := registrationassignments.NewScopedRegistrationAssignmentID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "registrationAssignmentIdValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RegistrationAssignmentsClient.Get` + +```go +ctx := context.TODO() +id := registrationassignments.NewScopedRegistrationAssignmentID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "registrationAssignmentIdValue") + +read, err := client.Get(ctx, id, registrationassignments.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RegistrationAssignmentsClient.List` + +```go +ctx := context.TODO() +id := registrationassignments.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +// alternatively `client.List(ctx, id, registrationassignments.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, registrationassignments.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/client.go new file mode 100644 index 00000000000..e565c927651 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/client.go @@ -0,0 +1,18 @@ +package registrationassignments + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegistrationAssignmentsClient struct { + Client autorest.Client + baseUri string +} + +func NewRegistrationAssignmentsClientWithBaseURI(endpoint string) RegistrationAssignmentsClient { + return RegistrationAssignmentsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/constants.go new file mode 100644 index 00000000000..401dbb8e28e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/constants.go @@ -0,0 +1,64 @@ +package registrationassignments + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + ProvisioningStateReady ProvisioningState = "Ready" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateNotSpecified), + string(ProvisioningStateReady), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "created": ProvisioningStateCreated, + "creating": ProvisioningStateCreating, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "notspecified": ProvisioningStateNotSpecified, + "ready": ProvisioningStateReady, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/id_scopedregistrationassignment.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/id_scopedregistrationassignment.go new file mode 100644 index 00000000000..d9e3fe30b3a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/id_scopedregistrationassignment.go @@ -0,0 +1,110 @@ +package registrationassignments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ScopedRegistrationAssignmentId{} + +// ScopedRegistrationAssignmentId is a struct representing the Resource ID for a Scoped Registration Assignment +type ScopedRegistrationAssignmentId struct { + Scope string + RegistrationAssignmentId string +} + +// NewScopedRegistrationAssignmentID returns a new ScopedRegistrationAssignmentId struct +func NewScopedRegistrationAssignmentID(scope string, registrationAssignmentId string) ScopedRegistrationAssignmentId { + return ScopedRegistrationAssignmentId{ + Scope: scope, + RegistrationAssignmentId: registrationAssignmentId, + } +} + +// ParseScopedRegistrationAssignmentID parses 'input' into a ScopedRegistrationAssignmentId +func ParseScopedRegistrationAssignmentID(input string) (*ScopedRegistrationAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedRegistrationAssignmentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopedRegistrationAssignmentId{} + + if id.Scope, ok = parsed.Parsed["scope"]; !ok { + return nil, fmt.Errorf("the segment 'scope' was not found in the resource id %q", input) + } + + if id.RegistrationAssignmentId, ok = parsed.Parsed["registrationAssignmentId"]; !ok { + return nil, fmt.Errorf("the segment 'registrationAssignmentId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseScopedRegistrationAssignmentIDInsensitively parses 'input' case-insensitively into a ScopedRegistrationAssignmentId +// note: this method should only be used for API response data and not user input +func ParseScopedRegistrationAssignmentIDInsensitively(input string) (*ScopedRegistrationAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedRegistrationAssignmentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopedRegistrationAssignmentId{} + + if id.Scope, ok = parsed.Parsed["scope"]; !ok { + return nil, fmt.Errorf("the segment 'scope' was not found in the resource id %q", input) + } + + if id.RegistrationAssignmentId, ok = parsed.Parsed["registrationAssignmentId"]; !ok { + return nil, fmt.Errorf("the segment 'registrationAssignmentId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateScopedRegistrationAssignmentID checks that 'input' can be parsed as a Scoped Registration Assignment ID +func ValidateScopedRegistrationAssignmentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseScopedRegistrationAssignmentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scoped Registration Assignment ID +func (id ScopedRegistrationAssignmentId) ID() string { + fmtString := "/%s/providers/Microsoft.ManagedServices/registrationAssignments/%s" + return fmt.Sprintf(fmtString, strings.TrimPrefix(id.Scope, "/"), id.RegistrationAssignmentId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scoped Registration Assignment ID +func (id ScopedRegistrationAssignmentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.ScopeSegment("scope", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftManagedServices", "Microsoft.ManagedServices", "Microsoft.ManagedServices"), + resourceids.StaticSegment("staticRegistrationAssignments", "registrationAssignments", "registrationAssignments"), + resourceids.UserSpecifiedSegment("registrationAssignmentId", "registrationAssignmentIdValue"), + } +} + +// String returns a human-readable description of this Scoped Registration Assignment ID +func (id ScopedRegistrationAssignmentId) String() string { + components := []string{ + fmt.Sprintf("Scope: %q", id.Scope), + fmt.Sprintf("Registration Assignment: %q", id.RegistrationAssignmentId), + } + return fmt.Sprintf("Scoped Registration Assignment (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/method_createorupdate_autorest.go new file mode 100644 index 00000000000..6887ce6d321 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package registrationassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c RegistrationAssignmentsClient) CreateOrUpdate(ctx context.Context, id ScopedRegistrationAssignmentId, input RegistrationAssignment) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationassignments.RegistrationAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationassignments.RegistrationAssignmentsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c RegistrationAssignmentsClient) CreateOrUpdateThenPoll(ctx context.Context, id ScopedRegistrationAssignmentId, input RegistrationAssignment) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c RegistrationAssignmentsClient) preparerForCreateOrUpdate(ctx context.Context, id ScopedRegistrationAssignmentId, input RegistrationAssignment) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c RegistrationAssignmentsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/method_delete_autorest.go new file mode 100644 index 00000000000..68a0795ae44 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/method_delete_autorest.go @@ -0,0 +1,78 @@ +package registrationassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c RegistrationAssignmentsClient) Delete(ctx context.Context, id ScopedRegistrationAssignmentId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationassignments.RegistrationAssignmentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationassignments.RegistrationAssignmentsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c RegistrationAssignmentsClient) DeleteThenPoll(ctx context.Context, id ScopedRegistrationAssignmentId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c RegistrationAssignmentsClient) preparerForDelete(ctx context.Context, id ScopedRegistrationAssignmentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c RegistrationAssignmentsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/method_get_autorest.go new file mode 100644 index 00000000000..9126a6d7b79 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/method_get_autorest.go @@ -0,0 +1,97 @@ +package registrationassignments + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *RegistrationAssignment +} + +type GetOperationOptions struct { + ExpandRegistrationDefinition *bool +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.ExpandRegistrationDefinition != nil { + out["$expandRegistrationDefinition"] = *o.ExpandRegistrationDefinition + } + + return out +} + +// Get ... +func (c RegistrationAssignmentsClient) Get(ctx context.Context, id ScopedRegistrationAssignmentId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationassignments.RegistrationAssignmentsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationassignments.RegistrationAssignmentsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationassignments.RegistrationAssignmentsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c RegistrationAssignmentsClient) preparerForGet(ctx context.Context, id ScopedRegistrationAssignmentId, options GetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c RegistrationAssignmentsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/method_list_autorest.go new file mode 100644 index 00000000000..6f99eb0914d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/method_list_autorest.go @@ -0,0 +1,216 @@ +package registrationassignments + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]RegistrationAssignment + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []RegistrationAssignment +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + ExpandRegistrationDefinition *bool +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.ExpandRegistrationDefinition != nil { + out["$expandRegistrationDefinition"] = *o.ExpandRegistrationDefinition + } + + return out +} + +// List ... +func (c RegistrationAssignmentsClient) List(ctx context.Context, id commonids.ScopeId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationassignments.RegistrationAssignmentsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationassignments.RegistrationAssignmentsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationassignments.RegistrationAssignmentsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c RegistrationAssignmentsClient) preparerForList(ctx context.Context, id commonids.ScopeId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ManagedServices/registrationAssignments", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c RegistrationAssignmentsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c RegistrationAssignmentsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []RegistrationAssignment `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationassignments.RegistrationAssignmentsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationassignments.RegistrationAssignmentsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationassignments.RegistrationAssignmentsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c RegistrationAssignmentsClient) ListComplete(ctx context.Context, id commonids.ScopeId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, RegistrationAssignmentOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RegistrationAssignmentsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, options ListOperationOptions, predicate RegistrationAssignmentOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]RegistrationAssignment, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_authorization.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_authorization.go new file mode 100644 index 00000000000..08268bf4414 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_authorization.go @@ -0,0 +1,11 @@ +package registrationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Authorization struct { + DelegatedRoleDefinitionIds *[]string `json:"delegatedRoleDefinitionIds,omitempty"` + PrincipalId string `json:"principalId"` + PrincipalIdDisplayName *string `json:"principalIdDisplayName,omitempty"` + RoleDefinitionId string `json:"roleDefinitionId"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_plan.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_plan.go new file mode 100644 index 00000000000..6a879190ebc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_plan.go @@ -0,0 +1,11 @@ +package registrationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name string `json:"name"` + Product string `json:"product"` + Publisher string `json:"publisher"` + Version string `json:"version"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_registrationassignment.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_registrationassignment.go new file mode 100644 index 00000000000..12d3e13ea36 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_registrationassignment.go @@ -0,0 +1,11 @@ +package registrationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegistrationAssignment struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RegistrationAssignmentProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_registrationassignmentproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_registrationassignmentproperties.go new file mode 100644 index 00000000000..63897dbeddf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_registrationassignmentproperties.go @@ -0,0 +1,10 @@ +package registrationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegistrationAssignmentProperties struct { + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RegistrationDefinition *RegistrationAssignmentPropertiesRegistrationDefinition `json:"registrationDefinition,omitempty"` + RegistrationDefinitionId string `json:"registrationDefinitionId"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_registrationassignmentpropertiesregistrationdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_registrationassignmentpropertiesregistrationdefinition.go new file mode 100644 index 00000000000..c9d35f75c99 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_registrationassignmentpropertiesregistrationdefinition.go @@ -0,0 +1,12 @@ +package registrationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegistrationAssignmentPropertiesRegistrationDefinition struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *RegistrationAssignmentPropertiesRegistrationDefinitionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_registrationassignmentpropertiesregistrationdefinitionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_registrationassignmentpropertiesregistrationdefinitionproperties.go new file mode 100644 index 00000000000..da5e0aae8a6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/model_registrationassignmentpropertiesregistrationdefinitionproperties.go @@ -0,0 +1,15 @@ +package registrationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegistrationAssignmentPropertiesRegistrationDefinitionProperties struct { + Authorizations *[]Authorization `json:"authorizations,omitempty"` + Description *string `json:"description,omitempty"` + ManagedByTenantId *string `json:"managedByTenantId,omitempty"` + ManagedByTenantName *string `json:"managedByTenantName,omitempty"` + ManageeTenantId *string `json:"manageeTenantId,omitempty"` + ManageeTenantName *string `json:"manageeTenantName,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RegistrationDefinitionName *string `json:"registrationDefinitionName,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/predicates.go new file mode 100644 index 00000000000..de0c361db9e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/predicates.go @@ -0,0 +1,24 @@ +package registrationassignments + +type RegistrationAssignmentOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p RegistrationAssignmentOperationPredicate) Matches(input RegistrationAssignment) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/version.go new file mode 100644 index 00000000000..ff0f5886b0e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments/version.go @@ -0,0 +1,12 @@ +package registrationassignments + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/registrationassignments/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/README.md new file mode 100644 index 00000000000..771e889a2ab --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/README.md @@ -0,0 +1,86 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions` Documentation + +The `registrationdefinitions` SDK allows for interaction with the Azure Resource Manager Service `managedservices` (API Version `2019-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions" +``` + + +### Client Initialization + +```go +client := registrationdefinitions.NewRegistrationDefinitionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RegistrationDefinitionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := registrationdefinitions.NewScopedRegistrationDefinitionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "registrationDefinitionIdValue") + +payload := registrationdefinitions.RegistrationDefinition{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RegistrationDefinitionsClient.Delete` + +```go +ctx := context.TODO() +id := registrationdefinitions.NewScopedRegistrationDefinitionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "registrationDefinitionIdValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RegistrationDefinitionsClient.Get` + +```go +ctx := context.TODO() +id := registrationdefinitions.NewScopedRegistrationDefinitionID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "registrationDefinitionIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RegistrationDefinitionsClient.List` + +```go +ctx := context.TODO() +id := registrationdefinitions.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/client.go new file mode 100644 index 00000000000..fcb7eab7cba --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/client.go @@ -0,0 +1,18 @@ +package registrationdefinitions + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegistrationDefinitionsClient struct { + Client autorest.Client + baseUri string +} + +func NewRegistrationDefinitionsClientWithBaseURI(endpoint string) RegistrationDefinitionsClient { + return RegistrationDefinitionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/constants.go new file mode 100644 index 00000000000..bc08accd921 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/constants.go @@ -0,0 +1,64 @@ +package registrationdefinitions + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + ProvisioningStateReady ProvisioningState = "Ready" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleted), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateNotSpecified), + string(ProvisioningStateReady), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "accepted": ProvisioningStateAccepted, + "canceled": ProvisioningStateCanceled, + "created": ProvisioningStateCreated, + "creating": ProvisioningStateCreating, + "deleted": ProvisioningStateDeleted, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "notspecified": ProvisioningStateNotSpecified, + "ready": ProvisioningStateReady, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/id_scopedregistrationdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/id_scopedregistrationdefinition.go new file mode 100644 index 00000000000..a1ac004b966 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/id_scopedregistrationdefinition.go @@ -0,0 +1,110 @@ +package registrationdefinitions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ScopedRegistrationDefinitionId{} + +// ScopedRegistrationDefinitionId is a struct representing the Resource ID for a Scoped Registration Definition +type ScopedRegistrationDefinitionId struct { + Scope string + RegistrationDefinitionId string +} + +// NewScopedRegistrationDefinitionID returns a new ScopedRegistrationDefinitionId struct +func NewScopedRegistrationDefinitionID(scope string, registrationDefinitionId string) ScopedRegistrationDefinitionId { + return ScopedRegistrationDefinitionId{ + Scope: scope, + RegistrationDefinitionId: registrationDefinitionId, + } +} + +// ParseScopedRegistrationDefinitionID parses 'input' into a ScopedRegistrationDefinitionId +func ParseScopedRegistrationDefinitionID(input string) (*ScopedRegistrationDefinitionId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedRegistrationDefinitionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopedRegistrationDefinitionId{} + + if id.Scope, ok = parsed.Parsed["scope"]; !ok { + return nil, fmt.Errorf("the segment 'scope' was not found in the resource id %q", input) + } + + if id.RegistrationDefinitionId, ok = parsed.Parsed["registrationDefinitionId"]; !ok { + return nil, fmt.Errorf("the segment 'registrationDefinitionId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseScopedRegistrationDefinitionIDInsensitively parses 'input' case-insensitively into a ScopedRegistrationDefinitionId +// note: this method should only be used for API response data and not user input +func ParseScopedRegistrationDefinitionIDInsensitively(input string) (*ScopedRegistrationDefinitionId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedRegistrationDefinitionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopedRegistrationDefinitionId{} + + if id.Scope, ok = parsed.Parsed["scope"]; !ok { + return nil, fmt.Errorf("the segment 'scope' was not found in the resource id %q", input) + } + + if id.RegistrationDefinitionId, ok = parsed.Parsed["registrationDefinitionId"]; !ok { + return nil, fmt.Errorf("the segment 'registrationDefinitionId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateScopedRegistrationDefinitionID checks that 'input' can be parsed as a Scoped Registration Definition ID +func ValidateScopedRegistrationDefinitionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseScopedRegistrationDefinitionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scoped Registration Definition ID +func (id ScopedRegistrationDefinitionId) ID() string { + fmtString := "/%s/providers/Microsoft.ManagedServices/registrationDefinitions/%s" + return fmt.Sprintf(fmtString, strings.TrimPrefix(id.Scope, "/"), id.RegistrationDefinitionId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scoped Registration Definition ID +func (id ScopedRegistrationDefinitionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.ScopeSegment("scope", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftManagedServices", "Microsoft.ManagedServices", "Microsoft.ManagedServices"), + resourceids.StaticSegment("staticRegistrationDefinitions", "registrationDefinitions", "registrationDefinitions"), + resourceids.UserSpecifiedSegment("registrationDefinitionId", "registrationDefinitionIdValue"), + } +} + +// String returns a human-readable description of this Scoped Registration Definition ID +func (id ScopedRegistrationDefinitionId) String() string { + components := []string{ + fmt.Sprintf("Scope: %q", id.Scope), + fmt.Sprintf("Registration Definition: %q", id.RegistrationDefinitionId), + } + return fmt.Sprintf("Scoped Registration Definition (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/method_createorupdate_autorest.go new file mode 100644 index 00000000000..e8bf5becdeb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package registrationdefinitions + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c RegistrationDefinitionsClient) CreateOrUpdate(ctx context.Context, id ScopedRegistrationDefinitionId, input RegistrationDefinition) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationdefinitions.RegistrationDefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationdefinitions.RegistrationDefinitionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c RegistrationDefinitionsClient) CreateOrUpdateThenPoll(ctx context.Context, id ScopedRegistrationDefinitionId, input RegistrationDefinition) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c RegistrationDefinitionsClient) preparerForCreateOrUpdate(ctx context.Context, id ScopedRegistrationDefinitionId, input RegistrationDefinition) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c RegistrationDefinitionsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/method_delete_autorest.go new file mode 100644 index 00000000000..735b2d1f5e0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/method_delete_autorest.go @@ -0,0 +1,66 @@ +package registrationdefinitions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c RegistrationDefinitionsClient) Delete(ctx context.Context, id ScopedRegistrationDefinitionId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationdefinitions.RegistrationDefinitionsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationdefinitions.RegistrationDefinitionsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationdefinitions.RegistrationDefinitionsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c RegistrationDefinitionsClient) preparerForDelete(ctx context.Context, id ScopedRegistrationDefinitionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c RegistrationDefinitionsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/method_get_autorest.go new file mode 100644 index 00000000000..6e019481822 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/method_get_autorest.go @@ -0,0 +1,68 @@ +package registrationdefinitions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *RegistrationDefinition +} + +// Get ... +func (c RegistrationDefinitionsClient) Get(ctx context.Context, id ScopedRegistrationDefinitionId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationdefinitions.RegistrationDefinitionsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationdefinitions.RegistrationDefinitionsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationdefinitions.RegistrationDefinitionsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c RegistrationDefinitionsClient) preparerForGet(ctx context.Context, id ScopedRegistrationDefinitionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c RegistrationDefinitionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/method_list_autorest.go new file mode 100644 index 00000000000..8aadef47e5b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/method_list_autorest.go @@ -0,0 +1,187 @@ +package registrationdefinitions + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]RegistrationDefinition + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []RegistrationDefinition +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c RegistrationDefinitionsClient) List(ctx context.Context, id commonids.ScopeId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationdefinitions.RegistrationDefinitionsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationdefinitions.RegistrationDefinitionsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationdefinitions.RegistrationDefinitionsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c RegistrationDefinitionsClient) preparerForList(ctx context.Context, id commonids.ScopeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ManagedServices/registrationDefinitions", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c RegistrationDefinitionsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c RegistrationDefinitionsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []RegistrationDefinition `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationdefinitions.RegistrationDefinitionsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationdefinitions.RegistrationDefinitionsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "registrationdefinitions.RegistrationDefinitionsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c RegistrationDefinitionsClient) ListComplete(ctx context.Context, id commonids.ScopeId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, RegistrationDefinitionOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RegistrationDefinitionsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, predicate RegistrationDefinitionOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]RegistrationDefinition, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/model_authorization.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/model_authorization.go new file mode 100644 index 00000000000..46dece780ed --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/model_authorization.go @@ -0,0 +1,11 @@ +package registrationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Authorization struct { + DelegatedRoleDefinitionIds *[]string `json:"delegatedRoleDefinitionIds,omitempty"` + PrincipalId string `json:"principalId"` + PrincipalIdDisplayName *string `json:"principalIdDisplayName,omitempty"` + RoleDefinitionId string `json:"roleDefinitionId"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/model_plan.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/model_plan.go new file mode 100644 index 00000000000..7c11e92703f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/model_plan.go @@ -0,0 +1,11 @@ +package registrationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name string `json:"name"` + Product string `json:"product"` + Publisher string `json:"publisher"` + Version string `json:"version"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/model_registrationdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/model_registrationdefinition.go new file mode 100644 index 00000000000..8e9de0c0747 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/model_registrationdefinition.go @@ -0,0 +1,12 @@ +package registrationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegistrationDefinition struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *RegistrationDefinitionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/model_registrationdefinitionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/model_registrationdefinitionproperties.go new file mode 100644 index 00000000000..a389a2e3f7d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/model_registrationdefinitionproperties.go @@ -0,0 +1,13 @@ +package registrationdefinitions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegistrationDefinitionProperties struct { + Authorizations []Authorization `json:"authorizations"` + Description *string `json:"description,omitempty"` + ManagedByTenantId string `json:"managedByTenantId"` + ManagedByTenantName *string `json:"managedByTenantName,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RegistrationDefinitionName *string `json:"registrationDefinitionName,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/predicates.go new file mode 100644 index 00000000000..aeaea69b657 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/predicates.go @@ -0,0 +1,24 @@ +package registrationdefinitions + +type RegistrationDefinitionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p RegistrationDefinitionOperationPredicate) Matches(input RegistrationDefinition) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/version.go new file mode 100644 index 00000000000..88f39d4415a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions/version.go @@ -0,0 +1,12 @@ +package registrationdefinitions + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/registrationdefinitions/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/README.md new file mode 100644 index 00000000000..baf364819f0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/README.md @@ -0,0 +1,165 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts` Documentation + +The `accounts` SDK allows for interaction with the Azure Resource Manager Service `maps` (API Version `2021-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts" +``` + + +### Client Initialization + +```go +client := accounts.NewAccountsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AccountsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := accounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := accounts.MapsAccount{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AccountsClient.Delete` + +```go +ctx := context.TODO() +id := accounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AccountsClient.Get` + +```go +ctx := context.TODO() +id := accounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AccountsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := accounts.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AccountsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := accounts.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AccountsClient.ListKeys` + +```go +ctx := context.TODO() +id := accounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.ListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AccountsClient.RegenerateKeys` + +```go +ctx := context.TODO() +id := accounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := accounts.MapsKeySpecification{ + // ... +} + + +read, err := client.RegenerateKeys(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AccountsClient.Update` + +```go +ctx := context.TODO() +id := accounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := accounts.MapsAccountUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/client.go new file mode 100644 index 00000000000..edcf2d80f35 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/client.go @@ -0,0 +1,18 @@ +package accounts + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsClient struct { + Client autorest.Client + baseUri string +} + +func NewAccountsClientWithBaseURI(endpoint string) AccountsClient { + return AccountsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/constants.go new file mode 100644 index 00000000000..1a147bcb0ce --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/constants.go @@ -0,0 +1,93 @@ +package accounts + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyType string + +const ( + KeyTypePrimary KeyType = "primary" + KeyTypeSecondary KeyType = "secondary" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypePrimary), + string(KeyTypeSecondary), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "primary": KeyTypePrimary, + "secondary": KeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} + +type Kind string + +const ( + KindGenOne Kind = "Gen1" + KindGenTwo Kind = "Gen2" +) + +func PossibleValuesForKind() []string { + return []string{ + string(KindGenOne), + string(KindGenTwo), + } +} + +func parseKind(input string) (*Kind, error) { + vals := map[string]Kind{ + "gen1": KindGenOne, + "gen2": KindGenTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Kind(input) + return &out, nil +} + +type Name string + +const ( + NameGTwo Name = "G2" + NameSOne Name = "S1" + NameSZero Name = "S0" +) + +func PossibleValuesForName() []string { + return []string{ + string(NameGTwo), + string(NameSOne), + string(NameSZero), + } +} + +func parseName(input string) (*Name, error) { + vals := map[string]Name{ + "g2": NameGTwo, + "s1": NameSOne, + "s0": NameSZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Name(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/id_account.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/id_account.go new file mode 100644 index 00000000000..c536f82e2f3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/id_account.go @@ -0,0 +1,124 @@ +package accounts + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AccountId{} + +// AccountId is a struct representing the Resource ID for a Account +type AccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewAccountID returns a new AccountId struct +func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { + return AccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseAccountID parses 'input' into a AccountId +func ParseAccountID(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId +// note: this method should only be used for API response data and not user input +func ParseAccountIDInsensitively(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAccountID checks that 'input' can be parsed as a Account ID +func ValidateAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Account ID +func (id AccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Maps/accounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Account ID +func (id AccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMaps", "Microsoft.Maps", "Microsoft.Maps"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Account ID +func (id AccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_createorupdate_autorest.go new file mode 100644 index 00000000000..29b5f627c6d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package accounts + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *MapsAccount +} + +// CreateOrUpdate ... +func (c AccountsClient) CreateOrUpdate(ctx context.Context, id AccountId, input MapsAccount) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c AccountsClient) preparerForCreateOrUpdate(ctx context.Context, id AccountId, input MapsAccount) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c AccountsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_delete_autorest.go new file mode 100644 index 00000000000..d80750a0a04 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_delete_autorest.go @@ -0,0 +1,66 @@ +package accounts + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c AccountsClient) Delete(ctx context.Context, id AccountId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c AccountsClient) preparerForDelete(ctx context.Context, id AccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c AccountsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_get_autorest.go new file mode 100644 index 00000000000..decf0819a07 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_get_autorest.go @@ -0,0 +1,68 @@ +package accounts + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *MapsAccount +} + +// Get ... +func (c AccountsClient) Get(ctx context.Context, id AccountId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c AccountsClient) preparerForGet(ctx context.Context, id AccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c AccountsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..6892470d55e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package accounts + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]MapsAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []MapsAccount +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c AccountsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c AccountsClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Maps/accounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c AccountsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c AccountsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []MapsAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c AccountsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, MapsAccountOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AccountsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate MapsAccountOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]MapsAccount, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..2b33b2ebf73 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package accounts + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]MapsAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []MapsAccount +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c AccountsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c AccountsClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Maps/accounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c AccountsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c AccountsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []MapsAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c AccountsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, MapsAccountOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AccountsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate MapsAccountOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]MapsAccount, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_listkeys_autorest.go new file mode 100644 index 00000000000..36f27b86058 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_listkeys_autorest.go @@ -0,0 +1,69 @@ +package accounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeysOperationResponse struct { + HttpResponse *http.Response + Model *MapsAccountKeys +} + +// ListKeys ... +func (c AccountsClient) ListKeys(ctx context.Context, id AccountId) (result ListKeysOperationResponse, err error) { + req, err := c.preparerForListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListKeys prepares the ListKeys request. +func (c AccountsClient) preparerForListKeys(ctx context.Context, id AccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListKeys handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (c AccountsClient) responderForListKeys(resp *http.Response) (result ListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_regeneratekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_regeneratekeys_autorest.go new file mode 100644 index 00000000000..1859d5b5530 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_regeneratekeys_autorest.go @@ -0,0 +1,70 @@ +package accounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeysOperationResponse struct { + HttpResponse *http.Response + Model *MapsAccountKeys +} + +// RegenerateKeys ... +func (c AccountsClient) RegenerateKeys(ctx context.Context, id AccountId, input MapsKeySpecification) (result RegenerateKeysOperationResponse, err error) { + req, err := c.preparerForRegenerateKeys(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "RegenerateKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRegenerateKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "RegenerateKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRegenerateKeys prepares the RegenerateKeys request. +func (c AccountsClient) preparerForRegenerateKeys(ctx context.Context, id AccountId, input MapsKeySpecification) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKey", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRegenerateKeys handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (c AccountsClient) responderForRegenerateKeys(resp *http.Response) (result RegenerateKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_update_autorest.go new file mode 100644 index 00000000000..a8510b4f1f6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/method_update_autorest.go @@ -0,0 +1,69 @@ +package accounts + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *MapsAccount +} + +// Update ... +func (c AccountsClient) Update(ctx context.Context, id AccountId, input MapsAccountUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c AccountsClient) preparerForUpdate(ctx context.Context, id AccountId, input MapsAccountUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c AccountsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_mapsaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_mapsaccount.go new file mode 100644 index 00000000000..13f950fb477 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_mapsaccount.go @@ -0,0 +1,20 @@ +package accounts + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MapsAccount struct { + Id *string `json:"id,omitempty"` + Kind *Kind `json:"kind,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *MapsAccountProperties `json:"properties,omitempty"` + Sku Sku `json:"sku"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_mapsaccountkeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_mapsaccountkeys.go new file mode 100644 index 00000000000..2e45e921511 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_mapsaccountkeys.go @@ -0,0 +1,11 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MapsAccountKeys struct { + PrimaryKey *string `json:"primaryKey,omitempty"` + PrimaryKeyLastUpdated *string `json:"primaryKeyLastUpdated,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` + SecondaryKeyLastUpdated *string `json:"secondaryKeyLastUpdated,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_mapsaccountproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_mapsaccountproperties.go new file mode 100644 index 00000000000..fd4131437ba --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_mapsaccountproperties.go @@ -0,0 +1,10 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MapsAccountProperties struct { + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + UniqueId *string `json:"uniqueId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_mapsaccountupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_mapsaccountupdateparameters.go new file mode 100644 index 00000000000..e07f3265e37 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_mapsaccountupdateparameters.go @@ -0,0 +1,11 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MapsAccountUpdateParameters struct { + Kind *Kind `json:"kind,omitempty"` + Properties *MapsAccountProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_mapskeyspecification.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_mapskeyspecification.go new file mode 100644 index 00000000000..dacf7b5d9dc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_mapskeyspecification.go @@ -0,0 +1,8 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MapsKeySpecification struct { + KeyType KeyType `json:"keyType"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_sku.go new file mode 100644 index 00000000000..004ced791b0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/model_sku.go @@ -0,0 +1,9 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name Name `json:"name"` + Tier *string `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/predicates.go new file mode 100644 index 00000000000..18746e427d7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/predicates.go @@ -0,0 +1,29 @@ +package accounts + +type MapsAccountOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p MapsAccountOperationPredicate) Matches(input MapsAccount) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/version.go new file mode 100644 index 00000000000..730444235e0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts/version.go @@ -0,0 +1,12 @@ +package accounts + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-02-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/accounts/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/README.md new file mode 100644 index 00000000000..6eb727c4cc4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators` Documentation + +The `creators` SDK allows for interaction with the Azure Resource Manager Service `maps` (API Version `2021-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators" +``` + + +### Client Initialization + +```go +client := creators.NewCreatorsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CreatorsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := creators.NewCreatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "creatorValue") + +payload := creators.Creator{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CreatorsClient.Delete` + +```go +ctx := context.TODO() +id := creators.NewCreatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "creatorValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CreatorsClient.Get` + +```go +ctx := context.TODO() +id := creators.NewCreatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "creatorValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CreatorsClient.ListByAccount` + +```go +ctx := context.TODO() +id := creators.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +// alternatively `client.ListByAccount(ctx, id)` can be used to do batched pagination +items, err := client.ListByAccountComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CreatorsClient.Update` + +```go +ctx := context.TODO() +id := creators.NewCreatorID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "creatorValue") + +payload := creators.CreatorUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/client.go new file mode 100644 index 00000000000..ce49fe39ee4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/client.go @@ -0,0 +1,18 @@ +package creators + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreatorsClient struct { + Client autorest.Client + baseUri string +} + +func NewCreatorsClientWithBaseURI(endpoint string) CreatorsClient { + return CreatorsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/id_account.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/id_account.go new file mode 100644 index 00000000000..ca85d5406fc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/id_account.go @@ -0,0 +1,124 @@ +package creators + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AccountId{} + +// AccountId is a struct representing the Resource ID for a Account +type AccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewAccountID returns a new AccountId struct +func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { + return AccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseAccountID parses 'input' into a AccountId +func ParseAccountID(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId +// note: this method should only be used for API response data and not user input +func ParseAccountIDInsensitively(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAccountID checks that 'input' can be parsed as a Account ID +func ValidateAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Account ID +func (id AccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Maps/accounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Account ID +func (id AccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMaps", "Microsoft.Maps", "Microsoft.Maps"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Account ID +func (id AccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/id_creator.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/id_creator.go similarity index 90% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/id_creator.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/id_creator.go index dda2e7a230f..5adf12e95d3 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/id_creator.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/id_creator.go @@ -112,15 +112,15 @@ func (id CreatorId) ID() string { // Segments returns a slice of Resource ID Segments which comprise this Creator ID func (id CreatorId) Segments() []resourceids.Segment { return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftMaps", "Microsoft.Maps", "Microsoft.Maps"), - resourceids.StaticSegment("accounts", "accounts", "accounts"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMaps", "Microsoft.Maps", "Microsoft.Maps"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("creators", "creators", "creators"), + resourceids.StaticSegment("staticCreators", "creators", "creators"), resourceids.UserSpecifiedSegment("creatorName", "creatorValue"), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/method_createorupdate_autorest.go new file mode 100644 index 00000000000..c4e29ce5106 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package creators + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Creator +} + +// CreateOrUpdate ... +func (c CreatorsClient) CreateOrUpdate(ctx context.Context, id CreatorId, input Creator) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c CreatorsClient) preparerForCreateOrUpdate(ctx context.Context, id CreatorId, input Creator) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c CreatorsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/method_delete_autorest.go new file mode 100644 index 00000000000..a44b5b2571f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/method_delete_autorest.go @@ -0,0 +1,66 @@ +package creators + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c CreatorsClient) Delete(ctx context.Context, id CreatorId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c CreatorsClient) preparerForDelete(ctx context.Context, id CreatorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c CreatorsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/method_get_autorest.go new file mode 100644 index 00000000000..29e90b6a6de --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/method_get_autorest.go @@ -0,0 +1,68 @@ +package creators + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Creator +} + +// Get ... +func (c CreatorsClient) Get(ctx context.Context, id CreatorId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c CreatorsClient) preparerForGet(ctx context.Context, id CreatorId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c CreatorsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/method_listbyaccount_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/method_listbyaccount_autorest.go similarity index 87% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/method_listbyaccount_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/method_listbyaccount_autorest.go index 0cf1e097caf..83852788452 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/method_listbyaccount_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/method_listbyaccount_autorest.go @@ -10,23 +10,26 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type ListByAccountResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByAccountOperationResponse struct { HttpResponse *http.Response Model *[]Creator nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByAccountResponse, error) + nextPageFunc func(ctx context.Context, nextLink string) (ListByAccountOperationResponse, error) } type ListByAccountCompleteResult struct { Items []Creator } -func (r ListByAccountResponse) HasMore() bool { +func (r ListByAccountOperationResponse) HasMore() bool { return r.nextLink != nil } -func (r ListByAccountResponse) LoadMore(ctx context.Context) (resp ListByAccountResponse, err error) { +func (r ListByAccountOperationResponse) LoadMore(ctx context.Context) (resp ListByAccountOperationResponse, err error) { if !r.HasMore() { err = fmt.Errorf("no more pages returned") return @@ -35,7 +38,7 @@ func (r ListByAccountResponse) LoadMore(ctx context.Context) (resp ListByAccount } // ListByAccount ... -func (c CreatorsClient) ListByAccount(ctx context.Context, id AccountId) (resp ListByAccountResponse, err error) { +func (c CreatorsClient) ListByAccount(ctx context.Context, id AccountId) (resp ListByAccountOperationResponse, err error) { req, err := c.preparerForListByAccount(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "ListByAccount", nil, "Failure preparing request") @@ -56,50 +59,6 @@ func (c CreatorsClient) ListByAccount(ctx context.Context, id AccountId) (resp L return } -// ListByAccountComplete retrieves all of the results into a single object -func (c CreatorsClient) ListByAccountComplete(ctx context.Context, id AccountId) (ListByAccountCompleteResult, error) { - return c.ListByAccountCompleteMatchingPredicate(ctx, id, CreatorPredicate{}) -} - -// ListByAccountCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c CreatorsClient) ListByAccountCompleteMatchingPredicate(ctx context.Context, id AccountId, predicate CreatorPredicate) (resp ListByAccountCompleteResult, err error) { - items := make([]Creator, 0) - - page, err := c.ListByAccount(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByAccountCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForListByAccount prepares the ListByAccount request. func (c CreatorsClient) preparerForListByAccount(ctx context.Context, id AccountId) (*http.Request, error) { queryParameters := map[string]interface{}{ @@ -142,7 +101,7 @@ func (c CreatorsClient) preparerForListByAccountWithNextLink(ctx context.Context // responderForListByAccount handles the response to the ListByAccount request. The method always // closes the http.Response Body. -func (c CreatorsClient) responderForListByAccount(resp *http.Response) (result ListByAccountResponse, err error) { +func (c CreatorsClient) responderForListByAccount(resp *http.Response) (result ListByAccountOperationResponse, err error) { type page struct { Values []Creator `json:"value"` NextLink *string `json:"nextLink"` @@ -157,7 +116,7 @@ func (c CreatorsClient) responderForListByAccount(resp *http.Response) (result L result.Model = &respObj.Values result.nextLink = respObj.NextLink if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByAccountResponse, err error) { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByAccountOperationResponse, err error) { req, err := c.preparerForListByAccountWithNextLink(ctx, nextLink) if err != nil { err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "ListByAccount", nil, "Failure preparing request") @@ -181,3 +140,47 @@ func (c CreatorsClient) responderForListByAccount(resp *http.Response) (result L } return } + +// ListByAccountComplete retrieves all of the results into a single object +func (c CreatorsClient) ListByAccountComplete(ctx context.Context, id AccountId) (ListByAccountCompleteResult, error) { + return c.ListByAccountCompleteMatchingPredicate(ctx, id, CreatorOperationPredicate{}) +} + +// ListByAccountCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c CreatorsClient) ListByAccountCompleteMatchingPredicate(ctx context.Context, id AccountId, predicate CreatorOperationPredicate) (resp ListByAccountCompleteResult, err error) { + items := make([]Creator, 0) + + page, err := c.ListByAccount(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByAccountCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/method_update_autorest.go new file mode 100644 index 00000000000..0868df12dbd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/method_update_autorest.go @@ -0,0 +1,69 @@ +package creators + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Creator +} + +// Update ... +func (c CreatorsClient) Update(ctx context.Context, id CreatorId, input CreatorUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c CreatorsClient) preparerForUpdate(ctx context.Context, id CreatorId, input CreatorUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c CreatorsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/model_creator.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/model_creator.go new file mode 100644 index 00000000000..377f7c26074 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/model_creator.go @@ -0,0 +1,13 @@ +package creators + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Creator struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties CreatorProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/model_creatorproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/model_creatorproperties.go new file mode 100644 index 00000000000..f6cf082a452 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/model_creatorproperties.go @@ -0,0 +1,9 @@ +package creators + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreatorProperties struct { + ProvisioningState *string `json:"provisioningState,omitempty"` + StorageUnits int64 `json:"storageUnits"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/model_creatorupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/model_creatorupdateparameters.go new file mode 100644 index 00000000000..a26242b4b28 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/model_creatorupdateparameters.go @@ -0,0 +1,9 @@ +package creators + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreatorUpdateParameters struct { + Properties *CreatorProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/predicates.go new file mode 100644 index 00000000000..5edfea66956 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/predicates.go @@ -0,0 +1,29 @@ +package creators + +type CreatorOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CreatorOperationPredicate) Matches(input Creator) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/version.go new file mode 100644 index 00000000000..ed4d3606e12 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators/version.go @@ -0,0 +1,12 @@ +package creators + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-02-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/creators/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/README.md new file mode 100644 index 00000000000..fa17aca6a5c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/README.md @@ -0,0 +1,69 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations` Documentation + +The `configurations` SDK allows for interaction with the Azure Resource Manager Service `mariadb` (API Version `2018-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations" +``` + + +### Client Initialization + +```go +client := configurations.NewConfigurationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ConfigurationsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := configurations.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "configurationValue") + +payload := configurations.Configuration{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ConfigurationsClient.Get` + +```go +ctx := context.TODO() +id := configurations.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "configurationValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConfigurationsClient.ListByServer` + +```go +ctx := context.TODO() +id := configurations.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.ListByServer(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/client.go new file mode 100644 index 00000000000..bbe813edd98 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/client.go @@ -0,0 +1,18 @@ +package configurations + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationsClient struct { + Client autorest.Client + baseUri string +} + +func NewConfigurationsClientWithBaseURI(endpoint string) ConfigurationsClient { + return ConfigurationsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/id_configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/id_configuration.go new file mode 100644 index 00000000000..4ee365c6b97 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/id_configuration.go @@ -0,0 +1,137 @@ +package configurations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ConfigurationId{} + +// ConfigurationId is a struct representing the Resource ID for a Configuration +type ConfigurationId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + ConfigurationName string +} + +// NewConfigurationID returns a new ConfigurationId struct +func NewConfigurationID(subscriptionId string, resourceGroupName string, serverName string, configurationName string) ConfigurationId { + return ConfigurationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + ConfigurationName: configurationName, + } +} + +// ParseConfigurationID parses 'input' into a ConfigurationId +func ParseConfigurationID(input string) (*ConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(ConfigurationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { + return nil, fmt.Errorf("the segment 'configurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseConfigurationIDInsensitively parses 'input' case-insensitively into a ConfigurationId +// note: this method should only be used for API response data and not user input +func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(ConfigurationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { + return nil, fmt.Errorf("the segment 'configurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID +func ValidateConfigurationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseConfigurationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Configuration ID +func (id ConfigurationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s/configurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.ConfigurationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Configuration ID +func (id ConfigurationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMariaDB", "Microsoft.DBforMariaDB", "Microsoft.DBforMariaDB"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticConfigurations", "configurations", "configurations"), + resourceids.UserSpecifiedSegment("configurationName", "configurationValue"), + } +} + +// String returns a human-readable description of this Configuration ID +func (id ConfigurationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Configuration Name: %q", id.ConfigurationName), + } + return fmt.Sprintf("Configuration (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/id_server.go new file mode 100644 index 00000000000..01a99b52063 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/id_server.go @@ -0,0 +1,124 @@ +package configurations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMariaDB", "Microsoft.DBforMariaDB", "Microsoft.DBforMariaDB"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/method_createorupdate_autorest.go new file mode 100644 index 00000000000..c1e771a52d1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package configurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c ConfigurationsClient) CreateOrUpdate(ctx context.Context, id ConfigurationId, input Configuration) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ConfigurationsClient) CreateOrUpdateThenPoll(ctx context.Context, id ConfigurationId, input Configuration) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ConfigurationsClient) preparerForCreateOrUpdate(ctx context.Context, id ConfigurationId, input Configuration) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ConfigurationsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/method_get_autorest.go new file mode 100644 index 00000000000..2aeb488f91c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/method_get_autorest.go @@ -0,0 +1,68 @@ +package configurations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Configuration +} + +// Get ... +func (c ConfigurationsClient) Get(ctx context.Context, id ConfigurationId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ConfigurationsClient) preparerForGet(ctx context.Context, id ConfigurationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ConfigurationsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/method_listbyserver_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/method_listbyserver_autorest.go new file mode 100644 index 00000000000..950a5ec48c1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/method_listbyserver_autorest.go @@ -0,0 +1,69 @@ +package configurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServerOperationResponse struct { + HttpResponse *http.Response + Model *ConfigurationListResult +} + +// ListByServer ... +func (c ConfigurationsClient) ListByServer(ctx context.Context, id ServerId) (result ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServer(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "ListByServer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "ListByServer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByServer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "ListByServer", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByServer prepares the ListByServer request. +func (c ConfigurationsClient) preparerForListByServer(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/configurations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByServer handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (c ConfigurationsClient) responderForListByServer(resp *http.Response) (result ListByServerOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/model_configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/model_configuration.go new file mode 100644 index 00000000000..84bf2c28127 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/model_configuration.go @@ -0,0 +1,11 @@ +package configurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Configuration struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ConfigurationProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/model_configurationlistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/model_configurationlistresult.go new file mode 100644 index 00000000000..98af12f5801 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/model_configurationlistresult.go @@ -0,0 +1,8 @@ +package configurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationListResult struct { + Value *[]Configuration `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/model_configurationproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/model_configurationproperties.go new file mode 100644 index 00000000000..51143bf6154 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/model_configurationproperties.go @@ -0,0 +1,13 @@ +package configurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationProperties struct { + AllowedValues *string `json:"allowedValues,omitempty"` + DataType *string `json:"dataType,omitempty"` + DefaultValue *string `json:"defaultValue,omitempty"` + Description *string `json:"description,omitempty"` + Source *string `json:"source,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/version.go new file mode 100644 index 00000000000..b31650f6434 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations/version.go @@ -0,0 +1,12 @@ +package configurations + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/configurations/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/README.md new file mode 100644 index 00000000000..3685fef1934 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/README.md @@ -0,0 +1,81 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases` Documentation + +The `databases` SDK allows for interaction with the Azure Resource Manager Service `mariadb` (API Version `2018-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases" +``` + + +### Client Initialization + +```go +client := databases.NewDatabasesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DatabasesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "databaseValue") + +payload := databases.Database{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Delete` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "databaseValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Get` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "databaseValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.ListByServer` + +```go +ctx := context.TODO() +id := databases.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.ListByServer(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/client.go new file mode 100644 index 00000000000..5305d65eb6c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/client.go @@ -0,0 +1,18 @@ +package databases + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesClient struct { + Client autorest.Client + baseUri string +} + +func NewDatabasesClientWithBaseURI(endpoint string) DatabasesClient { + return DatabasesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/id_database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/id_database.go new file mode 100644 index 00000000000..4a5dcb24690 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/id_database.go @@ -0,0 +1,137 @@ +package databases + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DatabaseId{} + +// DatabaseId is a struct representing the Resource ID for a Database +type DatabaseId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + DatabaseName string +} + +// NewDatabaseID returns a new DatabaseId struct +func NewDatabaseID(subscriptionId string, resourceGroupName string, serverName string, databaseName string) DatabaseId { + return DatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + DatabaseName: databaseName, + } +} + +// ParseDatabaseID parses 'input' into a DatabaseId +func ParseDatabaseID(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDatabaseIDInsensitively parses 'input' case-insensitively into a DatabaseId +// note: this method should only be used for API response data and not user input +func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDatabaseID checks that 'input' can be parsed as a Database ID +func ValidateDatabaseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Database ID +func (id DatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s/databases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.DatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Database ID +func (id DatabaseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMariaDB", "Microsoft.DBforMariaDB", "Microsoft.DBforMariaDB"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + } +} + +// String returns a human-readable description of this Database ID +func (id DatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + } + return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/id_server.go new file mode 100644 index 00000000000..2369e7a1a49 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/id_server.go @@ -0,0 +1,124 @@ +package databases + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMariaDB", "Microsoft.DBforMariaDB", "Microsoft.DBforMariaDB"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/method_createorupdate_autorest.go new file mode 100644 index 00000000000..8046543297d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c DatabasesClient) CreateOrUpdate(ctx context.Context, id DatabaseId, input Database) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c DatabasesClient) CreateOrUpdateThenPoll(ctx context.Context, id DatabaseId, input Database) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c DatabasesClient) preparerForCreateOrUpdate(ctx context.Context, id DatabaseId, input Database) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c DatabasesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/method_delete_autorest.go new file mode 100644 index 00000000000..13221da85a6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/method_delete_autorest.go @@ -0,0 +1,78 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c DatabasesClient) Delete(ctx context.Context, id DatabaseId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DatabasesClient) DeleteThenPoll(ctx context.Context, id DatabaseId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c DatabasesClient) preparerForDelete(ctx context.Context, id DatabaseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c DatabasesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/method_get_autorest.go new file mode 100644 index 00000000000..f35d313d226 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/method_get_autorest.go @@ -0,0 +1,68 @@ +package databases + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Database +} + +// Get ... +func (c DatabasesClient) Get(ctx context.Context, id DatabaseId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DatabasesClient) preparerForGet(ctx context.Context, id DatabaseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DatabasesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/method_listbyserver_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/method_listbyserver_autorest.go new file mode 100644 index 00000000000..c02aac94bf6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/method_listbyserver_autorest.go @@ -0,0 +1,69 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServerOperationResponse struct { + HttpResponse *http.Response + Model *DatabaseListResult +} + +// ListByServer ... +func (c DatabasesClient) ListByServer(ctx context.Context, id ServerId) (result ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServer(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByServer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByServer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByServer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByServer", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByServer prepares the ListByServer request. +func (c DatabasesClient) preparerForListByServer(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/databases", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByServer handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (c DatabasesClient) responderForListByServer(resp *http.Response) (result ListByServerOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/model_database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/model_database.go new file mode 100644 index 00000000000..a9880a7432b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/model_database.go @@ -0,0 +1,11 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Database struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DatabaseProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/model_databaselistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/model_databaselistresult.go new file mode 100644 index 00000000000..80645ead092 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/model_databaselistresult.go @@ -0,0 +1,8 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseListResult struct { + Value *[]Database `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/model_databaseproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/model_databaseproperties.go new file mode 100644 index 00000000000..85fcbd70d57 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/model_databaseproperties.go @@ -0,0 +1,9 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseProperties struct { + Charset *string `json:"charset,omitempty"` + Collation *string `json:"collation,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/version.go new file mode 100644 index 00000000000..6edfbce43c1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases/version.go @@ -0,0 +1,12 @@ +package databases + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/databases/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/README.md new file mode 100644 index 00000000000..d46a7c5402e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/README.md @@ -0,0 +1,81 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules` Documentation + +The `firewallrules` SDK allows for interaction with the Azure Resource Manager Service `mariadb` (API Version `2018-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules" +``` + + +### Client Initialization + +```go +client := firewallrules.NewFirewallRulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `FirewallRulesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "firewallRuleValue") + +payload := firewallrules.FirewallRule{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `FirewallRulesClient.Delete` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "firewallRuleValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `FirewallRulesClient.Get` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "firewallRuleValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FirewallRulesClient.ListByServer` + +```go +ctx := context.TODO() +id := firewallrules.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.ListByServer(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/client.go new file mode 100644 index 00000000000..ac01b0459a1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/client.go @@ -0,0 +1,18 @@ +package firewallrules + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRulesClient struct { + Client autorest.Client + baseUri string +} + +func NewFirewallRulesClientWithBaseURI(endpoint string) FirewallRulesClient { + return FirewallRulesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/id_firewallrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/id_firewallrule.go new file mode 100644 index 00000000000..7c308c2e5ef --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/id_firewallrule.go @@ -0,0 +1,137 @@ +package firewallrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FirewallRuleId{} + +// FirewallRuleId is a struct representing the Resource ID for a Firewall Rule +type FirewallRuleId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + FirewallRuleName string +} + +// NewFirewallRuleID returns a new FirewallRuleId struct +func NewFirewallRuleID(subscriptionId string, resourceGroupName string, serverName string, firewallRuleName string) FirewallRuleId { + return FirewallRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + FirewallRuleName: firewallRuleName, + } +} + +// ParseFirewallRuleID parses 'input' into a FirewallRuleId +func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FirewallRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'firewallRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFirewallRuleIDInsensitively parses 'input' case-insensitively into a FirewallRuleId +// note: this method should only be used for API response data and not user input +func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FirewallRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'firewallRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID +func ValidateFirewallRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFirewallRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Firewall Rule ID +func (id FirewallRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s/firewallRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.FirewallRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Firewall Rule ID +func (id FirewallRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMariaDB", "Microsoft.DBforMariaDB", "Microsoft.DBforMariaDB"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticFirewallRules", "firewallRules", "firewallRules"), + resourceids.UserSpecifiedSegment("firewallRuleName", "firewallRuleValue"), + } +} + +// String returns a human-readable description of this Firewall Rule ID +func (id FirewallRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Firewall Rule Name: %q", id.FirewallRuleName), + } + return fmt.Sprintf("Firewall Rule (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/id_server.go new file mode 100644 index 00000000000..a6c5ab98447 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/id_server.go @@ -0,0 +1,124 @@ +package firewallrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMariaDB", "Microsoft.DBforMariaDB", "Microsoft.DBforMariaDB"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/method_createorupdate_autorest.go new file mode 100644 index 00000000000..0dfa761f1a0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package firewallrules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c FirewallRulesClient) CreateOrUpdate(ctx context.Context, id FirewallRuleId, input FirewallRule) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c FirewallRulesClient) CreateOrUpdateThenPoll(ctx context.Context, id FirewallRuleId, input FirewallRule) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c FirewallRulesClient) preparerForCreateOrUpdate(ctx context.Context, id FirewallRuleId, input FirewallRule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c FirewallRulesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/method_delete_autorest.go new file mode 100644 index 00000000000..ec4b290ecdd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/method_delete_autorest.go @@ -0,0 +1,78 @@ +package firewallrules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c FirewallRulesClient) Delete(ctx context.Context, id FirewallRuleId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c FirewallRulesClient) DeleteThenPoll(ctx context.Context, id FirewallRuleId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c FirewallRulesClient) preparerForDelete(ctx context.Context, id FirewallRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c FirewallRulesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/method_get_autorest.go new file mode 100644 index 00000000000..1391c01ba1a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/method_get_autorest.go @@ -0,0 +1,68 @@ +package firewallrules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *FirewallRule +} + +// Get ... +func (c FirewallRulesClient) Get(ctx context.Context, id FirewallRuleId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c FirewallRulesClient) preparerForGet(ctx context.Context, id FirewallRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c FirewallRulesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/method_listbyserver_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/method_listbyserver_autorest.go new file mode 100644 index 00000000000..70624d92ee8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/method_listbyserver_autorest.go @@ -0,0 +1,69 @@ +package firewallrules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServerOperationResponse struct { + HttpResponse *http.Response + Model *FirewallRuleListResult +} + +// ListByServer ... +func (c FirewallRulesClient) ListByServer(ctx context.Context, id ServerId) (result ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServer(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "ListByServer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "ListByServer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByServer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "ListByServer", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByServer prepares the ListByServer request. +func (c FirewallRulesClient) preparerForListByServer(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/firewallRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByServer handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (c FirewallRulesClient) responderForListByServer(resp *http.Response) (result ListByServerOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/model_firewallrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/model_firewallrule.go new file mode 100644 index 00000000000..3178a13ed2c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/model_firewallrule.go @@ -0,0 +1,11 @@ +package firewallrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties FirewallRuleProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/model_firewallrulelistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/model_firewallrulelistresult.go new file mode 100644 index 00000000000..c01e91fae56 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/model_firewallrulelistresult.go @@ -0,0 +1,8 @@ +package firewallrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRuleListResult struct { + Value *[]FirewallRule `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/model_firewallruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/model_firewallruleproperties.go new file mode 100644 index 00000000000..fca4e1c3684 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/model_firewallruleproperties.go @@ -0,0 +1,9 @@ +package firewallrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRuleProperties struct { + EndIPAddress string `json:"endIpAddress"` + StartIPAddress string `json:"startIpAddress"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/version.go new file mode 100644 index 00000000000..50bf96272ae --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules/version.go @@ -0,0 +1,12 @@ +package firewallrules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/firewallrules/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/README.md new file mode 100644 index 00000000000..69d2b94e329 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/README.md @@ -0,0 +1,114 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers` Documentation + +The `servers` SDK allows for interaction with the Azure Resource Manager Service `mariadb` (API Version `2018-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers" +``` + + +### Client Initialization + +```go +client := servers.NewServersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServersClient.Create` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := servers.ServerForCreate{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServersClient.Delete` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServersClient.Get` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.List` + +```go +ctx := context.TODO() +id := servers.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := servers.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.ListByResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.Update` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := servers.ServerUpdateParameters{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/client.go new file mode 100644 index 00000000000..fd9e02ba599 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/client.go @@ -0,0 +1,18 @@ +package servers + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServersClient struct { + Client autorest.Client + baseUri string +} + +func NewServersClientWithBaseURI(endpoint string) ServersClient { + return ServersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/constants.go new file mode 100644 index 00000000000..7f3894de004 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/constants.go @@ -0,0 +1,372 @@ +package servers + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateMode string + +const ( + CreateModeDefault CreateMode = "Default" + CreateModeGeoRestore CreateMode = "GeoRestore" + CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" + CreateModeReplica CreateMode = "Replica" +) + +func PossibleValuesForCreateMode() []string { + return []string{ + string(CreateModeDefault), + string(CreateModeGeoRestore), + string(CreateModePointInTimeRestore), + string(CreateModeReplica), + } +} + +func parseCreateMode(input string) (*CreateMode, error) { + vals := map[string]CreateMode{ + "default": CreateModeDefault, + "georestore": CreateModeGeoRestore, + "pointintimerestore": CreateModePointInTimeRestore, + "replica": CreateModeReplica, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CreateMode(input) + return &out, nil +} + +type GeoRedundantBackup string + +const ( + GeoRedundantBackupDisabled GeoRedundantBackup = "Disabled" + GeoRedundantBackupEnabled GeoRedundantBackup = "Enabled" +) + +func PossibleValuesForGeoRedundantBackup() []string { + return []string{ + string(GeoRedundantBackupDisabled), + string(GeoRedundantBackupEnabled), + } +} + +func parseGeoRedundantBackup(input string) (*GeoRedundantBackup, error) { + vals := map[string]GeoRedundantBackup{ + "disabled": GeoRedundantBackupDisabled, + "enabled": GeoRedundantBackupEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GeoRedundantBackup(input) + return &out, nil +} + +type MinimalTlsVersionEnum string + +const ( + MinimalTlsVersionEnumTLSEnforcementDisabled MinimalTlsVersionEnum = "TLSEnforcementDisabled" + MinimalTlsVersionEnumTLSOneOne MinimalTlsVersionEnum = "TLS1_1" + MinimalTlsVersionEnumTLSOneTwo MinimalTlsVersionEnum = "TLS1_2" + MinimalTlsVersionEnumTLSOneZero MinimalTlsVersionEnum = "TLS1_0" +) + +func PossibleValuesForMinimalTlsVersionEnum() []string { + return []string{ + string(MinimalTlsVersionEnumTLSEnforcementDisabled), + string(MinimalTlsVersionEnumTLSOneOne), + string(MinimalTlsVersionEnumTLSOneTwo), + string(MinimalTlsVersionEnumTLSOneZero), + } +} + +func parseMinimalTlsVersionEnum(input string) (*MinimalTlsVersionEnum, error) { + vals := map[string]MinimalTlsVersionEnum{ + "tlsenforcementdisabled": MinimalTlsVersionEnumTLSEnforcementDisabled, + "tls1_1": MinimalTlsVersionEnumTLSOneOne, + "tls1_2": MinimalTlsVersionEnumTLSOneTwo, + "tls1_0": MinimalTlsVersionEnumTLSOneZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MinimalTlsVersionEnum(input) + return &out, nil +} + +type PrivateEndpointProvisioningState string + +const ( + PrivateEndpointProvisioningStateApproving PrivateEndpointProvisioningState = "Approving" + PrivateEndpointProvisioningStateDropping PrivateEndpointProvisioningState = "Dropping" + PrivateEndpointProvisioningStateFailed PrivateEndpointProvisioningState = "Failed" + PrivateEndpointProvisioningStateReady PrivateEndpointProvisioningState = "Ready" + PrivateEndpointProvisioningStateRejecting PrivateEndpointProvisioningState = "Rejecting" +) + +func PossibleValuesForPrivateEndpointProvisioningState() []string { + return []string{ + string(PrivateEndpointProvisioningStateApproving), + string(PrivateEndpointProvisioningStateDropping), + string(PrivateEndpointProvisioningStateFailed), + string(PrivateEndpointProvisioningStateReady), + string(PrivateEndpointProvisioningStateRejecting), + } +} + +func parsePrivateEndpointProvisioningState(input string) (*PrivateEndpointProvisioningState, error) { + vals := map[string]PrivateEndpointProvisioningState{ + "approving": PrivateEndpointProvisioningStateApproving, + "dropping": PrivateEndpointProvisioningStateDropping, + "failed": PrivateEndpointProvisioningStateFailed, + "ready": PrivateEndpointProvisioningStateReady, + "rejecting": PrivateEndpointProvisioningStateRejecting, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointProvisioningState(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStateActionsRequire string + +const ( + PrivateLinkServiceConnectionStateActionsRequireNone PrivateLinkServiceConnectionStateActionsRequire = "None" +) + +func PossibleValuesForPrivateLinkServiceConnectionStateActionsRequire() []string { + return []string{ + string(PrivateLinkServiceConnectionStateActionsRequireNone), + } +} + +func parsePrivateLinkServiceConnectionStateActionsRequire(input string) (*PrivateLinkServiceConnectionStateActionsRequire, error) { + vals := map[string]PrivateLinkServiceConnectionStateActionsRequire{ + "none": PrivateLinkServiceConnectionStateActionsRequireNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStateActionsRequire(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStateStatus string + +const ( + PrivateLinkServiceConnectionStateStatusApproved PrivateLinkServiceConnectionStateStatus = "Approved" + PrivateLinkServiceConnectionStateStatusDisconnected PrivateLinkServiceConnectionStateStatus = "Disconnected" + PrivateLinkServiceConnectionStateStatusPending PrivateLinkServiceConnectionStateStatus = "Pending" + PrivateLinkServiceConnectionStateStatusRejected PrivateLinkServiceConnectionStateStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkServiceConnectionStateStatus() []string { + return []string{ + string(PrivateLinkServiceConnectionStateStatusApproved), + string(PrivateLinkServiceConnectionStateStatusDisconnected), + string(PrivateLinkServiceConnectionStateStatusPending), + string(PrivateLinkServiceConnectionStateStatusRejected), + } +} + +func parsePrivateLinkServiceConnectionStateStatus(input string) (*PrivateLinkServiceConnectionStateStatus, error) { + vals := map[string]PrivateLinkServiceConnectionStateStatus{ + "approved": PrivateLinkServiceConnectionStateStatusApproved, + "disconnected": PrivateLinkServiceConnectionStateStatusDisconnected, + "pending": PrivateLinkServiceConnectionStateStatusPending, + "rejected": PrivateLinkServiceConnectionStateStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStateStatus(input) + return &out, nil +} + +type PublicNetworkAccessEnum string + +const ( + PublicNetworkAccessEnumDisabled PublicNetworkAccessEnum = "Disabled" + PublicNetworkAccessEnumEnabled PublicNetworkAccessEnum = "Enabled" +) + +func PossibleValuesForPublicNetworkAccessEnum() []string { + return []string{ + string(PublicNetworkAccessEnumDisabled), + string(PublicNetworkAccessEnumEnabled), + } +} + +func parsePublicNetworkAccessEnum(input string) (*PublicNetworkAccessEnum, error) { + vals := map[string]PublicNetworkAccessEnum{ + "disabled": PublicNetworkAccessEnumDisabled, + "enabled": PublicNetworkAccessEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccessEnum(input) + return &out, nil +} + +type ServerState string + +const ( + ServerStateDisabled ServerState = "Disabled" + ServerStateDropping ServerState = "Dropping" + ServerStateReady ServerState = "Ready" +) + +func PossibleValuesForServerState() []string { + return []string{ + string(ServerStateDisabled), + string(ServerStateDropping), + string(ServerStateReady), + } +} + +func parseServerState(input string) (*ServerState, error) { + vals := map[string]ServerState{ + "disabled": ServerStateDisabled, + "dropping": ServerStateDropping, + "ready": ServerStateReady, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerState(input) + return &out, nil +} + +type ServerVersion string + +const ( + ServerVersionOneZeroPointThree ServerVersion = "10.3" + ServerVersionOneZeroPointTwo ServerVersion = "10.2" +) + +func PossibleValuesForServerVersion() []string { + return []string{ + string(ServerVersionOneZeroPointThree), + string(ServerVersionOneZeroPointTwo), + } +} + +func parseServerVersion(input string) (*ServerVersion, error) { + vals := map[string]ServerVersion{ + "10.3": ServerVersionOneZeroPointThree, + "10.2": ServerVersionOneZeroPointTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerVersion(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierGeneralPurpose SkuTier = "GeneralPurpose" + SkuTierMemoryOptimized SkuTier = "MemoryOptimized" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierGeneralPurpose), + string(SkuTierMemoryOptimized), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "generalpurpose": SkuTierGeneralPurpose, + "memoryoptimized": SkuTierMemoryOptimized, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} + +type SslEnforcementEnum string + +const ( + SslEnforcementEnumDisabled SslEnforcementEnum = "Disabled" + SslEnforcementEnumEnabled SslEnforcementEnum = "Enabled" +) + +func PossibleValuesForSslEnforcementEnum() []string { + return []string{ + string(SslEnforcementEnumDisabled), + string(SslEnforcementEnumEnabled), + } +} + +func parseSslEnforcementEnum(input string) (*SslEnforcementEnum, error) { + vals := map[string]SslEnforcementEnum{ + "disabled": SslEnforcementEnumDisabled, + "enabled": SslEnforcementEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SslEnforcementEnum(input) + return &out, nil +} + +type StorageAutogrow string + +const ( + StorageAutogrowDisabled StorageAutogrow = "Disabled" + StorageAutogrowEnabled StorageAutogrow = "Enabled" +) + +func PossibleValuesForStorageAutogrow() []string { + return []string{ + string(StorageAutogrowDisabled), + string(StorageAutogrowEnabled), + } +} + +func parseStorageAutogrow(input string) (*StorageAutogrow, error) { + vals := map[string]StorageAutogrow{ + "disabled": StorageAutogrowDisabled, + "enabled": StorageAutogrowEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAutogrow(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/id_server.go new file mode 100644 index 00000000000..378e3ccace4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/id_server.go @@ -0,0 +1,124 @@ +package servers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMariaDB", "Microsoft.DBforMariaDB", "Microsoft.DBforMariaDB"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_create_autorest.go new file mode 100644 index 00000000000..e4d6bd5d731 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_create_autorest.go @@ -0,0 +1,79 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c ServersClient) Create(ctx context.Context, id ServerId, input ServerForCreate) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c ServersClient) CreateThenPoll(ctx context.Context, id ServerId, input ServerForCreate) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c ServersClient) preparerForCreate(ctx context.Context, id ServerId, input ServerForCreate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c ServersClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_delete_autorest.go new file mode 100644 index 00000000000..f4e5bea63be --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_delete_autorest.go @@ -0,0 +1,78 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ServersClient) Delete(ctx context.Context, id ServerId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ServersClient) DeleteThenPoll(ctx context.Context, id ServerId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ServersClient) preparerForDelete(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ServersClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_get_autorest.go new file mode 100644 index 00000000000..5c54dc25354 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_get_autorest.go @@ -0,0 +1,68 @@ +package servers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Server +} + +// Get ... +func (c ServersClient) Get(ctx context.Context, id ServerId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ServersClient) preparerForGet(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ServersClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_list_autorest.go new file mode 100644 index 00000000000..7d167a9a18c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_list_autorest.go @@ -0,0 +1,70 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *ServerListResult +} + +// List ... +func (c ServersClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c ServersClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DBforMariaDB/servers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ServersClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..28e8fc0a4df --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_listbyresourcegroup_autorest.go @@ -0,0 +1,70 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *ServerListResult +} + +// ListByResourceGroup ... +func (c ServersClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ServersClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DBforMariaDB/servers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ServersClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_update_autorest.go new file mode 100644 index 00000000000..62f5524b57a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/method_update_autorest.go @@ -0,0 +1,79 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c ServersClient) Update(ctx context.Context, id ServerId, input ServerUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ServersClient) UpdateThenPoll(ctx context.Context, id ServerId, input ServerUpdateParameters) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c ServersClient) preparerForUpdate(ctx context.Context, id ServerId, input ServerUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c ServersClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_privateendpointproperty.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_privateendpointproperty.go new file mode 100644 index 00000000000..6b1eab772d2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_privateendpointproperty.go @@ -0,0 +1,8 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointProperty struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_server.go new file mode 100644 index 00000000000..547e413d481 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_server.go @@ -0,0 +1,14 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Server struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ServerProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverforcreate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverforcreate.go new file mode 100644 index 00000000000..fd8d204648e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverforcreate.go @@ -0,0 +1,44 @@ +package servers + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerForCreate struct { + Location string `json:"location"` + Properties ServerPropertiesForCreate `json:"properties"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} + +var _ json.Unmarshaler = &ServerForCreate{} + +func (s *ServerForCreate) UnmarshalJSON(bytes []byte) error { + type alias ServerForCreate + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into ServerForCreate: %+v", err) + } + + s.Location = decoded.Location + s.Sku = decoded.Sku + s.Tags = decoded.Tags + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling ServerForCreate into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["properties"]; ok { + impl, err := unmarshalServerPropertiesForCreateImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Properties' for 'ServerForCreate': %+v", err) + } + s.Properties = impl + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverlistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverlistresult.go new file mode 100644 index 00000000000..ccf6bd24270 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverlistresult.go @@ -0,0 +1,8 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerListResult struct { + Value *[]Server `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverprivateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverprivateendpointconnection.go new file mode 100644 index 00000000000..9979a7cec1d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverprivateendpointconnection.go @@ -0,0 +1,9 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Properties *ServerPrivateEndpointConnectionProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverprivateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverprivateendpointconnectionproperties.go new file mode 100644 index 00000000000..c30676397ef --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverprivateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *ServerPrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *PrivateEndpointProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverprivatelinkserviceconnectionstateproperty.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverprivatelinkserviceconnectionstateproperty.go new file mode 100644 index 00000000000..05d887b1bc6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverprivatelinkserviceconnectionstateproperty.go @@ -0,0 +1,10 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPrivateLinkServiceConnectionStateProperty struct { + ActionsRequired *PrivateLinkServiceConnectionStateActionsRequire `json:"actionsRequired,omitempty"` + Description string `json:"description"` + Status PrivateLinkServiceConnectionStateStatus `json:"status"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverproperties.go new file mode 100644 index 00000000000..a056ea8f16c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverproperties.go @@ -0,0 +1,38 @@ +package servers + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerProperties struct { + AdministratorLogin *string `json:"administratorLogin,omitempty"` + EarliestRestoreDate *string `json:"earliestRestoreDate,omitempty"` + FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` + MasterServerId *string `json:"masterServerId,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PrivateEndpointConnections *[]ServerPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + ReplicaCapacity *int64 `json:"replicaCapacity,omitempty"` + ReplicationRole *string `json:"replicationRole,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + UserVisibleState *ServerState `json:"userVisibleState,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +func (o *ServerProperties) GetEarliestRestoreDateAsTime() (*time.Time, error) { + if o.EarliestRestoreDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EarliestRestoreDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ServerProperties) SetEarliestRestoreDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EarliestRestoreDate = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverpropertiesforcreate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverpropertiesforcreate.go new file mode 100644 index 00000000000..ef35f7ee261 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverpropertiesforcreate.go @@ -0,0 +1,72 @@ +package servers + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPropertiesForCreate interface { +} + +func unmarshalServerPropertiesForCreateImplementation(input []byte) (ServerPropertiesForCreate, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPropertiesForCreate into map[string]interface: %+v", err) + } + + value, ok := temp["createMode"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "Default") { + var out ServerPropertiesForDefaultCreate + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServerPropertiesForDefaultCreate: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "GeoRestore") { + var out ServerPropertiesForGeoRestore + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServerPropertiesForGeoRestore: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Replica") { + var out ServerPropertiesForReplica + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServerPropertiesForReplica: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "PointInTimeRestore") { + var out ServerPropertiesForRestore + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServerPropertiesForRestore: %+v", err) + } + return out, nil + } + + type RawServerPropertiesForCreateImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawServerPropertiesForCreateImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverpropertiesfordefaultcreate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverpropertiesfordefaultcreate.go new file mode 100644 index 00000000000..8311c1ef672 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverpropertiesfordefaultcreate.go @@ -0,0 +1,47 @@ +package servers + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ServerPropertiesForCreate = ServerPropertiesForDefaultCreate{} + +type ServerPropertiesForDefaultCreate struct { + AdministratorLogin string `json:"administratorLogin"` + AdministratorLoginPassword string `json:"administratorLoginPassword"` + + // Fields inherited from ServerPropertiesForCreate + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +var _ json.Marshaler = ServerPropertiesForDefaultCreate{} + +func (s ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) { + type wrapper ServerPropertiesForDefaultCreate + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServerPropertiesForDefaultCreate: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPropertiesForDefaultCreate: %+v", err) + } + decoded["createMode"] = "Default" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServerPropertiesForDefaultCreate: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverpropertiesforgeorestore.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverpropertiesforgeorestore.go new file mode 100644 index 00000000000..b57ee038d2a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverpropertiesforgeorestore.go @@ -0,0 +1,46 @@ +package servers + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ServerPropertiesForCreate = ServerPropertiesForGeoRestore{} + +type ServerPropertiesForGeoRestore struct { + SourceServerId string `json:"sourceServerId"` + + // Fields inherited from ServerPropertiesForCreate + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +var _ json.Marshaler = ServerPropertiesForGeoRestore{} + +func (s ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) { + type wrapper ServerPropertiesForGeoRestore + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServerPropertiesForGeoRestore: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPropertiesForGeoRestore: %+v", err) + } + decoded["createMode"] = "GeoRestore" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServerPropertiesForGeoRestore: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverpropertiesforreplica.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverpropertiesforreplica.go new file mode 100644 index 00000000000..58b5f5a7929 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverpropertiesforreplica.go @@ -0,0 +1,46 @@ +package servers + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ServerPropertiesForCreate = ServerPropertiesForReplica{} + +type ServerPropertiesForReplica struct { + SourceServerId string `json:"sourceServerId"` + + // Fields inherited from ServerPropertiesForCreate + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +var _ json.Marshaler = ServerPropertiesForReplica{} + +func (s ServerPropertiesForReplica) MarshalJSON() ([]byte, error) { + type wrapper ServerPropertiesForReplica + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServerPropertiesForReplica: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPropertiesForReplica: %+v", err) + } + decoded["createMode"] = "Replica" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServerPropertiesForReplica: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverpropertiesforrestore.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverpropertiesforrestore.go new file mode 100644 index 00000000000..c60b9f36802 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverpropertiesforrestore.go @@ -0,0 +1,47 @@ +package servers + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ServerPropertiesForCreate = ServerPropertiesForRestore{} + +type ServerPropertiesForRestore struct { + RestorePointInTime string `json:"restorePointInTime"` + SourceServerId string `json:"sourceServerId"` + + // Fields inherited from ServerPropertiesForCreate + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +var _ json.Marshaler = ServerPropertiesForRestore{} + +func (s ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { + type wrapper ServerPropertiesForRestore + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServerPropertiesForRestore: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPropertiesForRestore: %+v", err) + } + decoded["createMode"] = "PointInTimeRestore" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServerPropertiesForRestore: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverupdateparameters.go new file mode 100644 index 00000000000..b7088edafbe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverupdateparameters.go @@ -0,0 +1,10 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerUpdateParameters struct { + Properties *ServerUpdateParametersProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverupdateparametersproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverupdateparametersproperties.go new file mode 100644 index 00000000000..8557ea72752 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_serverupdateparametersproperties.go @@ -0,0 +1,14 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerUpdateParametersProperties struct { + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + ReplicationRole *string `json:"replicationRole,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_sku.go new file mode 100644 index 00000000000..8bb23cf521d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_sku.go @@ -0,0 +1,12 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_storageprofile.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_storageprofile.go new file mode 100644 index 00000000000..ecb9b55edb0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/model_storageprofile.go @@ -0,0 +1,11 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfile struct { + BackupRetentionDays *int64 `json:"backupRetentionDays,omitempty"` + GeoRedundantBackup *GeoRedundantBackup `json:"geoRedundantBackup,omitempty"` + StorageAutogrow *StorageAutogrow `json:"storageAutogrow,omitempty"` + StorageMB *int64 `json:"storageMB,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/version.go new file mode 100644 index 00000000000..2e8ea156885 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers/version.go @@ -0,0 +1,12 @@ +package servers + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/servers/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/README.md new file mode 100644 index 00000000000..9660b52a520 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules` Documentation + +The `virtualnetworkrules` SDK allows for interaction with the Azure Resource Manager Service `mariadb` (API Version `2018-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules" +``` + + +### Client Initialization + +```go +client := virtualnetworkrules.NewVirtualNetworkRulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualNetworkRulesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualnetworkrules.NewVirtualNetworkRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "virtualNetworkRuleValue") + +payload := virtualnetworkrules.VirtualNetworkRule{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworkRulesClient.Delete` + +```go +ctx := context.TODO() +id := virtualnetworkrules.NewVirtualNetworkRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "virtualNetworkRuleValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworkRulesClient.Get` + +```go +ctx := context.TODO() +id := virtualnetworkrules.NewVirtualNetworkRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "virtualNetworkRuleValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualNetworkRulesClient.ListByServer` + +```go +ctx := context.TODO() +id := virtualnetworkrules.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination +items, err := client.ListByServerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/client.go new file mode 100644 index 00000000000..c5bb4f331d3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/client.go @@ -0,0 +1,18 @@ +package virtualnetworkrules + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkRulesClient struct { + Client autorest.Client + baseUri string +} + +func NewVirtualNetworkRulesClientWithBaseURI(endpoint string) VirtualNetworkRulesClient { + return VirtualNetworkRulesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/constants.go new file mode 100644 index 00000000000..686ce6f868d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/constants.go @@ -0,0 +1,43 @@ +package virtualnetworkrules + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkRuleState string + +const ( + VirtualNetworkRuleStateDeleting VirtualNetworkRuleState = "Deleting" + VirtualNetworkRuleStateInProgress VirtualNetworkRuleState = "InProgress" + VirtualNetworkRuleStateInitializing VirtualNetworkRuleState = "Initializing" + VirtualNetworkRuleStateReady VirtualNetworkRuleState = "Ready" + VirtualNetworkRuleStateUnknown VirtualNetworkRuleState = "Unknown" +) + +func PossibleValuesForVirtualNetworkRuleState() []string { + return []string{ + string(VirtualNetworkRuleStateDeleting), + string(VirtualNetworkRuleStateInProgress), + string(VirtualNetworkRuleStateInitializing), + string(VirtualNetworkRuleStateReady), + string(VirtualNetworkRuleStateUnknown), + } +} + +func parseVirtualNetworkRuleState(input string) (*VirtualNetworkRuleState, error) { + vals := map[string]VirtualNetworkRuleState{ + "deleting": VirtualNetworkRuleStateDeleting, + "inprogress": VirtualNetworkRuleStateInProgress, + "initializing": VirtualNetworkRuleStateInitializing, + "ready": VirtualNetworkRuleStateReady, + "unknown": VirtualNetworkRuleStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualNetworkRuleState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/id_server.go new file mode 100644 index 00000000000..6fafcfc6fba --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/id_server.go @@ -0,0 +1,124 @@ +package virtualnetworkrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMariaDB", "Microsoft.DBforMariaDB", "Microsoft.DBforMariaDB"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/id_virtualnetworkrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/id_virtualnetworkrule.go new file mode 100644 index 00000000000..9a5d5dba67e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/id_virtualnetworkrule.go @@ -0,0 +1,137 @@ +package virtualnetworkrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VirtualNetworkRuleId{} + +// VirtualNetworkRuleId is a struct representing the Resource ID for a Virtual Network Rule +type VirtualNetworkRuleId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + VirtualNetworkRuleName string +} + +// NewVirtualNetworkRuleID returns a new VirtualNetworkRuleId struct +func NewVirtualNetworkRuleID(subscriptionId string, resourceGroupName string, serverName string, virtualNetworkRuleName string) VirtualNetworkRuleId { + return VirtualNetworkRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + VirtualNetworkRuleName: virtualNetworkRuleName, + } +} + +// ParseVirtualNetworkRuleID parses 'input' into a VirtualNetworkRuleId +func ParseVirtualNetworkRuleID(input string) (*VirtualNetworkRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualNetworkRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualNetworkRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualNetworkRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVirtualNetworkRuleIDInsensitively parses 'input' case-insensitively into a VirtualNetworkRuleId +// note: this method should only be used for API response data and not user input +func ParseVirtualNetworkRuleIDInsensitively(input string) (*VirtualNetworkRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualNetworkRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualNetworkRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualNetworkRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVirtualNetworkRuleID checks that 'input' can be parsed as a Virtual Network Rule ID +func ValidateVirtualNetworkRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVirtualNetworkRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Network Rule ID +func (id VirtualNetworkRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s/virtualNetworkRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.VirtualNetworkRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Network Rule ID +func (id VirtualNetworkRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforMariaDB", "Microsoft.DBforMariaDB", "Microsoft.DBforMariaDB"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticVirtualNetworkRules", "virtualNetworkRules", "virtualNetworkRules"), + resourceids.UserSpecifiedSegment("virtualNetworkRuleName", "virtualNetworkRuleValue"), + } +} + +// String returns a human-readable description of this Virtual Network Rule ID +func (id VirtualNetworkRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Virtual Network Rule Name: %q", id.VirtualNetworkRuleName), + } + return fmt.Sprintf("Virtual Network Rule (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/method_createorupdate_autorest.go new file mode 100644 index 00000000000..1246bc0f90f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package virtualnetworkrules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c VirtualNetworkRulesClient) CreateOrUpdate(ctx context.Context, id VirtualNetworkRuleId, input VirtualNetworkRule) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VirtualNetworkRulesClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualNetworkRuleId, input VirtualNetworkRule) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c VirtualNetworkRulesClient) preparerForCreateOrUpdate(ctx context.Context, id VirtualNetworkRuleId, input VirtualNetworkRule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualNetworkRulesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/method_delete_autorest.go new file mode 100644 index 00000000000..631aa2a8856 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/method_delete_autorest.go @@ -0,0 +1,78 @@ +package virtualnetworkrules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c VirtualNetworkRulesClient) Delete(ctx context.Context, id VirtualNetworkRuleId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualNetworkRulesClient) DeleteThenPoll(ctx context.Context, id VirtualNetworkRuleId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c VirtualNetworkRulesClient) preparerForDelete(ctx context.Context, id VirtualNetworkRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualNetworkRulesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/method_get_autorest.go new file mode 100644 index 00000000000..f105c5887a7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/method_get_autorest.go @@ -0,0 +1,68 @@ +package virtualnetworkrules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *VirtualNetworkRule +} + +// Get ... +func (c VirtualNetworkRulesClient) Get(ctx context.Context, id VirtualNetworkRuleId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c VirtualNetworkRulesClient) preparerForGet(ctx context.Context, id VirtualNetworkRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c VirtualNetworkRulesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/method_listbyserver_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/method_listbyserver_autorest.go new file mode 100644 index 00000000000..73136508fcb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/method_listbyserver_autorest.go @@ -0,0 +1,186 @@ +package virtualnetworkrules + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServerOperationResponse struct { + HttpResponse *http.Response + Model *[]VirtualNetworkRule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByServerOperationResponse, error) +} + +type ListByServerCompleteResult struct { + Items []VirtualNetworkRule +} + +func (r ListByServerOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByServerOperationResponse) LoadMore(ctx context.Context) (resp ListByServerOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByServer ... +func (c VirtualNetworkRulesClient) ListByServer(ctx context.Context, id ServerId) (resp ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServer(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "ListByServer", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByServer(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "ListByServer", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByServer prepares the ListByServer request. +func (c VirtualNetworkRulesClient) preparerForListByServer(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/virtualNetworkRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByServerWithNextLink prepares the ListByServer request with the given nextLink token. +func (c VirtualNetworkRulesClient) preparerForListByServerWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByServer handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (c VirtualNetworkRulesClient) responderForListByServer(resp *http.Response) (result ListByServerOperationResponse, err error) { + type page struct { + Values []VirtualNetworkRule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServerWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "ListByServer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "ListByServer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByServer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "ListByServer", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByServerComplete retrieves all of the results into a single object +func (c VirtualNetworkRulesClient) ListByServerComplete(ctx context.Context, id ServerId) (ListByServerCompleteResult, error) { + return c.ListByServerCompleteMatchingPredicate(ctx, id, VirtualNetworkRuleOperationPredicate{}) +} + +// ListByServerCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c VirtualNetworkRulesClient) ListByServerCompleteMatchingPredicate(ctx context.Context, id ServerId, predicate VirtualNetworkRuleOperationPredicate) (resp ListByServerCompleteResult, err error) { + items := make([]VirtualNetworkRule, 0) + + page, err := c.ListByServer(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByServerCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/model_virtualnetworkrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/model_virtualnetworkrule.go new file mode 100644 index 00000000000..16850c4e56f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/model_virtualnetworkrule.go @@ -0,0 +1,11 @@ +package virtualnetworkrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualNetworkRuleProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/model_virtualnetworkruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/model_virtualnetworkruleproperties.go new file mode 100644 index 00000000000..40e8ec8d241 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/model_virtualnetworkruleproperties.go @@ -0,0 +1,10 @@ +package virtualnetworkrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkRuleProperties struct { + IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` + State *VirtualNetworkRuleState `json:"state,omitempty"` + VirtualNetworkSubnetId string `json:"virtualNetworkSubnetId"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/predicates.go new file mode 100644 index 00000000000..ef565fb3103 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/predicates.go @@ -0,0 +1,24 @@ +package virtualnetworkrules + +type VirtualNetworkRuleOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p VirtualNetworkRuleOperationPredicate) Matches(input VirtualNetworkRule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/version.go new file mode 100644 index 00000000000..0e53377c7b5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules/version.go @@ -0,0 +1,12 @@ +package virtualnetworkrules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/virtualnetworkrules/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/README.md new file mode 100644 index 00000000000..d4b19da1105 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/README.md @@ -0,0 +1,236 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource` Documentation + +The `resource` SDK allows for interaction with the Azure Resource Manager Service `mixedreality` (API Version `2021-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource" +``` + + +### Client Initialization + +```go +client := resource.NewResourceClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ResourceClient.RemoteRenderingAccountsCreate` + +```go +ctx := context.TODO() +id := resource.NewRemoteRenderingAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := resource.RemoteRenderingAccount{ + // ... +} + + +read, err := client.RemoteRenderingAccountsCreate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceClient.RemoteRenderingAccountsDelete` + +```go +ctx := context.TODO() +id := resource.NewRemoteRenderingAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.RemoteRenderingAccountsDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceClient.RemoteRenderingAccountsGet` + +```go +ctx := context.TODO() +id := resource.NewRemoteRenderingAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.RemoteRenderingAccountsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceClient.RemoteRenderingAccountsListByResourceGroup` + +```go +ctx := context.TODO() +id := resource.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.RemoteRenderingAccountsListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.RemoteRenderingAccountsListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ResourceClient.RemoteRenderingAccountsListBySubscription` + +```go +ctx := context.TODO() +id := resource.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.RemoteRenderingAccountsListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.RemoteRenderingAccountsListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ResourceClient.RemoteRenderingAccountsUpdate` + +```go +ctx := context.TODO() +id := resource.NewRemoteRenderingAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := resource.RemoteRenderingAccount{ + // ... +} + + +read, err := client.RemoteRenderingAccountsUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceClient.SpatialAnchorsAccountsCreate` + +```go +ctx := context.TODO() +id := resource.NewSpatialAnchorsAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := resource.SpatialAnchorsAccount{ + // ... +} + + +read, err := client.SpatialAnchorsAccountsCreate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceClient.SpatialAnchorsAccountsDelete` + +```go +ctx := context.TODO() +id := resource.NewSpatialAnchorsAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.SpatialAnchorsAccountsDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceClient.SpatialAnchorsAccountsGet` + +```go +ctx := context.TODO() +id := resource.NewSpatialAnchorsAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.SpatialAnchorsAccountsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ResourceClient.SpatialAnchorsAccountsListByResourceGroup` + +```go +ctx := context.TODO() +id := resource.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.SpatialAnchorsAccountsListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.SpatialAnchorsAccountsListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ResourceClient.SpatialAnchorsAccountsListBySubscription` + +```go +ctx := context.TODO() +id := resource.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.SpatialAnchorsAccountsListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.SpatialAnchorsAccountsListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ResourceClient.SpatialAnchorsAccountsUpdate` + +```go +ctx := context.TODO() +id := resource.NewSpatialAnchorsAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := resource.SpatialAnchorsAccount{ + // ... +} + + +read, err := client.SpatialAnchorsAccountsUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/client.go new file mode 100644 index 00000000000..ee454a45546 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/client.go @@ -0,0 +1,18 @@ +package resource + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceClient struct { + Client autorest.Client + baseUri string +} + +func NewResourceClientWithBaseURI(endpoint string) ResourceClient { + return ResourceClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/constants.go new file mode 100644 index 00000000000..b06da2cf5d2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/constants.go @@ -0,0 +1,40 @@ +package resource + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierFree SkuTier = "Free" + SkuTierPremium SkuTier = "Premium" + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierFree), + string(SkuTierPremium), + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "free": SkuTierFree, + "premium": SkuTierPremium, + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/id_remoterenderingaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/id_remoterenderingaccount.go new file mode 100644 index 00000000000..a2c7ef0374a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/id_remoterenderingaccount.go @@ -0,0 +1,124 @@ +package resource + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RemoteRenderingAccountId{} + +// RemoteRenderingAccountId is a struct representing the Resource ID for a Remote Rendering Account +type RemoteRenderingAccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewRemoteRenderingAccountID returns a new RemoteRenderingAccountId struct +func NewRemoteRenderingAccountID(subscriptionId string, resourceGroupName string, accountName string) RemoteRenderingAccountId { + return RemoteRenderingAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseRemoteRenderingAccountID parses 'input' into a RemoteRenderingAccountId +func ParseRemoteRenderingAccountID(input string) (*RemoteRenderingAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(RemoteRenderingAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RemoteRenderingAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRemoteRenderingAccountIDInsensitively parses 'input' case-insensitively into a RemoteRenderingAccountId +// note: this method should only be used for API response data and not user input +func ParseRemoteRenderingAccountIDInsensitively(input string) (*RemoteRenderingAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(RemoteRenderingAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RemoteRenderingAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRemoteRenderingAccountID checks that 'input' can be parsed as a Remote Rendering Account ID +func ValidateRemoteRenderingAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRemoteRenderingAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Remote Rendering Account ID +func (id RemoteRenderingAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.MixedReality/remoteRenderingAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Remote Rendering Account ID +func (id RemoteRenderingAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMixedReality", "Microsoft.MixedReality", "Microsoft.MixedReality"), + resourceids.StaticSegment("staticRemoteRenderingAccounts", "remoteRenderingAccounts", "remoteRenderingAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Remote Rendering Account ID +func (id RemoteRenderingAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Remote Rendering Account (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/id_spatialanchorsaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/id_spatialanchorsaccount.go new file mode 100644 index 00000000000..bfd535bb360 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/id_spatialanchorsaccount.go @@ -0,0 +1,124 @@ +package resource + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SpatialAnchorsAccountId{} + +// SpatialAnchorsAccountId is a struct representing the Resource ID for a Spatial Anchors Account +type SpatialAnchorsAccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewSpatialAnchorsAccountID returns a new SpatialAnchorsAccountId struct +func NewSpatialAnchorsAccountID(subscriptionId string, resourceGroupName string, accountName string) SpatialAnchorsAccountId { + return SpatialAnchorsAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseSpatialAnchorsAccountID parses 'input' into a SpatialAnchorsAccountId +func ParseSpatialAnchorsAccountID(input string) (*SpatialAnchorsAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(SpatialAnchorsAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SpatialAnchorsAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSpatialAnchorsAccountIDInsensitively parses 'input' case-insensitively into a SpatialAnchorsAccountId +// note: this method should only be used for API response data and not user input +func ParseSpatialAnchorsAccountIDInsensitively(input string) (*SpatialAnchorsAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(SpatialAnchorsAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SpatialAnchorsAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSpatialAnchorsAccountID checks that 'input' can be parsed as a Spatial Anchors Account ID +func ValidateSpatialAnchorsAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSpatialAnchorsAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Spatial Anchors Account ID +func (id SpatialAnchorsAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.MixedReality/spatialAnchorsAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Spatial Anchors Account ID +func (id SpatialAnchorsAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMixedReality", "Microsoft.MixedReality", "Microsoft.MixedReality"), + resourceids.StaticSegment("staticSpatialAnchorsAccounts", "spatialAnchorsAccounts", "spatialAnchorsAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Spatial Anchors Account ID +func (id SpatialAnchorsAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Spatial Anchors Account (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountscreate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountscreate_autorest.go new file mode 100644 index 00000000000..b49f47a5a98 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountscreate_autorest.go @@ -0,0 +1,69 @@ +package resource + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemoteRenderingAccountsCreateOperationResponse struct { + HttpResponse *http.Response + Model *RemoteRenderingAccount +} + +// RemoteRenderingAccountsCreate ... +func (c ResourceClient) RemoteRenderingAccountsCreate(ctx context.Context, id RemoteRenderingAccountId, input RemoteRenderingAccount) (result RemoteRenderingAccountsCreateOperationResponse, err error) { + req, err := c.preparerForRemoteRenderingAccountsCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsCreate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsCreate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemoteRenderingAccountsCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsCreate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemoteRenderingAccountsCreate prepares the RemoteRenderingAccountsCreate request. +func (c ResourceClient) preparerForRemoteRenderingAccountsCreate(ctx context.Context, id RemoteRenderingAccountId, input RemoteRenderingAccount) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemoteRenderingAccountsCreate handles the response to the RemoteRenderingAccountsCreate request. The method always +// closes the http.Response Body. +func (c ResourceClient) responderForRemoteRenderingAccountsCreate(resp *http.Response) (result RemoteRenderingAccountsCreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountsdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountsdelete_autorest.go new file mode 100644 index 00000000000..c9022372d9e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountsdelete_autorest.go @@ -0,0 +1,66 @@ +package resource + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemoteRenderingAccountsDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// RemoteRenderingAccountsDelete ... +func (c ResourceClient) RemoteRenderingAccountsDelete(ctx context.Context, id RemoteRenderingAccountId) (result RemoteRenderingAccountsDeleteOperationResponse, err error) { + req, err := c.preparerForRemoteRenderingAccountsDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemoteRenderingAccountsDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemoteRenderingAccountsDelete prepares the RemoteRenderingAccountsDelete request. +func (c ResourceClient) preparerForRemoteRenderingAccountsDelete(ctx context.Context, id RemoteRenderingAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemoteRenderingAccountsDelete handles the response to the RemoteRenderingAccountsDelete request. The method always +// closes the http.Response Body. +func (c ResourceClient) responderForRemoteRenderingAccountsDelete(resp *http.Response) (result RemoteRenderingAccountsDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountsget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountsget_autorest.go new file mode 100644 index 00000000000..5ea338b0854 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountsget_autorest.go @@ -0,0 +1,68 @@ +package resource + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemoteRenderingAccountsGetOperationResponse struct { + HttpResponse *http.Response + Model *RemoteRenderingAccount +} + +// RemoteRenderingAccountsGet ... +func (c ResourceClient) RemoteRenderingAccountsGet(ctx context.Context, id RemoteRenderingAccountId) (result RemoteRenderingAccountsGetOperationResponse, err error) { + req, err := c.preparerForRemoteRenderingAccountsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemoteRenderingAccountsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemoteRenderingAccountsGet prepares the RemoteRenderingAccountsGet request. +func (c ResourceClient) preparerForRemoteRenderingAccountsGet(ctx context.Context, id RemoteRenderingAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemoteRenderingAccountsGet handles the response to the RemoteRenderingAccountsGet request. The method always +// closes the http.Response Body. +func (c ResourceClient) responderForRemoteRenderingAccountsGet(resp *http.Response) (result RemoteRenderingAccountsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountslistbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountslistbyresourcegroup_autorest.go new file mode 100644 index 00000000000..b3fccea255b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountslistbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package resource + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemoteRenderingAccountsListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]RemoteRenderingAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (RemoteRenderingAccountsListByResourceGroupOperationResponse, error) +} + +type RemoteRenderingAccountsListByResourceGroupCompleteResult struct { + Items []RemoteRenderingAccount +} + +func (r RemoteRenderingAccountsListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r RemoteRenderingAccountsListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp RemoteRenderingAccountsListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// RemoteRenderingAccountsListByResourceGroup ... +func (c ResourceClient) RemoteRenderingAccountsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp RemoteRenderingAccountsListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForRemoteRenderingAccountsListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForRemoteRenderingAccountsListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForRemoteRenderingAccountsListByResourceGroup prepares the RemoteRenderingAccountsListByResourceGroup request. +func (c ResourceClient) preparerForRemoteRenderingAccountsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.MixedReality/remoteRenderingAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForRemoteRenderingAccountsListByResourceGroupWithNextLink prepares the RemoteRenderingAccountsListByResourceGroup request with the given nextLink token. +func (c ResourceClient) preparerForRemoteRenderingAccountsListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemoteRenderingAccountsListByResourceGroup handles the response to the RemoteRenderingAccountsListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ResourceClient) responderForRemoteRenderingAccountsListByResourceGroup(resp *http.Response) (result RemoteRenderingAccountsListByResourceGroupOperationResponse, err error) { + type page struct { + Values []RemoteRenderingAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result RemoteRenderingAccountsListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForRemoteRenderingAccountsListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemoteRenderingAccountsListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// RemoteRenderingAccountsListByResourceGroupComplete retrieves all of the results into a single object +func (c ResourceClient) RemoteRenderingAccountsListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (RemoteRenderingAccountsListByResourceGroupCompleteResult, error) { + return c.RemoteRenderingAccountsListByResourceGroupCompleteMatchingPredicate(ctx, id, RemoteRenderingAccountOperationPredicate{}) +} + +// RemoteRenderingAccountsListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ResourceClient) RemoteRenderingAccountsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate RemoteRenderingAccountOperationPredicate) (resp RemoteRenderingAccountsListByResourceGroupCompleteResult, err error) { + items := make([]RemoteRenderingAccount, 0) + + page, err := c.RemoteRenderingAccountsListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := RemoteRenderingAccountsListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountslistbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountslistbysubscription_autorest.go new file mode 100644 index 00000000000..0d7de601b47 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountslistbysubscription_autorest.go @@ -0,0 +1,187 @@ +package resource + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemoteRenderingAccountsListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]RemoteRenderingAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (RemoteRenderingAccountsListBySubscriptionOperationResponse, error) +} + +type RemoteRenderingAccountsListBySubscriptionCompleteResult struct { + Items []RemoteRenderingAccount +} + +func (r RemoteRenderingAccountsListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r RemoteRenderingAccountsListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp RemoteRenderingAccountsListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// RemoteRenderingAccountsListBySubscription ... +func (c ResourceClient) RemoteRenderingAccountsListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp RemoteRenderingAccountsListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForRemoteRenderingAccountsListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForRemoteRenderingAccountsListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForRemoteRenderingAccountsListBySubscription prepares the RemoteRenderingAccountsListBySubscription request. +func (c ResourceClient) preparerForRemoteRenderingAccountsListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.MixedReality/remoteRenderingAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForRemoteRenderingAccountsListBySubscriptionWithNextLink prepares the RemoteRenderingAccountsListBySubscription request with the given nextLink token. +func (c ResourceClient) preparerForRemoteRenderingAccountsListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemoteRenderingAccountsListBySubscription handles the response to the RemoteRenderingAccountsListBySubscription request. The method always +// closes the http.Response Body. +func (c ResourceClient) responderForRemoteRenderingAccountsListBySubscription(resp *http.Response) (result RemoteRenderingAccountsListBySubscriptionOperationResponse, err error) { + type page struct { + Values []RemoteRenderingAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result RemoteRenderingAccountsListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForRemoteRenderingAccountsListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemoteRenderingAccountsListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// RemoteRenderingAccountsListBySubscriptionComplete retrieves all of the results into a single object +func (c ResourceClient) RemoteRenderingAccountsListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (RemoteRenderingAccountsListBySubscriptionCompleteResult, error) { + return c.RemoteRenderingAccountsListBySubscriptionCompleteMatchingPredicate(ctx, id, RemoteRenderingAccountOperationPredicate{}) +} + +// RemoteRenderingAccountsListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ResourceClient) RemoteRenderingAccountsListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate RemoteRenderingAccountOperationPredicate) (resp RemoteRenderingAccountsListBySubscriptionCompleteResult, err error) { + items := make([]RemoteRenderingAccount, 0) + + page, err := c.RemoteRenderingAccountsListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := RemoteRenderingAccountsListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountsupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountsupdate_autorest.go new file mode 100644 index 00000000000..447bdcc9595 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_remoterenderingaccountsupdate_autorest.go @@ -0,0 +1,69 @@ +package resource + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemoteRenderingAccountsUpdateOperationResponse struct { + HttpResponse *http.Response + Model *RemoteRenderingAccount +} + +// RemoteRenderingAccountsUpdate ... +func (c ResourceClient) RemoteRenderingAccountsUpdate(ctx context.Context, id RemoteRenderingAccountId, input RemoteRenderingAccount) (result RemoteRenderingAccountsUpdateOperationResponse, err error) { + req, err := c.preparerForRemoteRenderingAccountsUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemoteRenderingAccountsUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "RemoteRenderingAccountsUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemoteRenderingAccountsUpdate prepares the RemoteRenderingAccountsUpdate request. +func (c ResourceClient) preparerForRemoteRenderingAccountsUpdate(ctx context.Context, id RemoteRenderingAccountId, input RemoteRenderingAccount) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemoteRenderingAccountsUpdate handles the response to the RemoteRenderingAccountsUpdate request. The method always +// closes the http.Response Body. +func (c ResourceClient) responderForRemoteRenderingAccountsUpdate(resp *http.Response) (result RemoteRenderingAccountsUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountscreate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountscreate_autorest.go new file mode 100644 index 00000000000..4646838b2f6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountscreate_autorest.go @@ -0,0 +1,69 @@ +package resource + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SpatialAnchorsAccountsCreateOperationResponse struct { + HttpResponse *http.Response + Model *SpatialAnchorsAccount +} + +// SpatialAnchorsAccountsCreate ... +func (c ResourceClient) SpatialAnchorsAccountsCreate(ctx context.Context, id SpatialAnchorsAccountId, input SpatialAnchorsAccount) (result SpatialAnchorsAccountsCreateOperationResponse, err error) { + req, err := c.preparerForSpatialAnchorsAccountsCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsCreate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsCreate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSpatialAnchorsAccountsCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsCreate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSpatialAnchorsAccountsCreate prepares the SpatialAnchorsAccountsCreate request. +func (c ResourceClient) preparerForSpatialAnchorsAccountsCreate(ctx context.Context, id SpatialAnchorsAccountId, input SpatialAnchorsAccount) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSpatialAnchorsAccountsCreate handles the response to the SpatialAnchorsAccountsCreate request. The method always +// closes the http.Response Body. +func (c ResourceClient) responderForSpatialAnchorsAccountsCreate(resp *http.Response) (result SpatialAnchorsAccountsCreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountsdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountsdelete_autorest.go new file mode 100644 index 00000000000..8d4dedc290e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountsdelete_autorest.go @@ -0,0 +1,66 @@ +package resource + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SpatialAnchorsAccountsDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// SpatialAnchorsAccountsDelete ... +func (c ResourceClient) SpatialAnchorsAccountsDelete(ctx context.Context, id SpatialAnchorsAccountId) (result SpatialAnchorsAccountsDeleteOperationResponse, err error) { + req, err := c.preparerForSpatialAnchorsAccountsDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSpatialAnchorsAccountsDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSpatialAnchorsAccountsDelete prepares the SpatialAnchorsAccountsDelete request. +func (c ResourceClient) preparerForSpatialAnchorsAccountsDelete(ctx context.Context, id SpatialAnchorsAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSpatialAnchorsAccountsDelete handles the response to the SpatialAnchorsAccountsDelete request. The method always +// closes the http.Response Body. +func (c ResourceClient) responderForSpatialAnchorsAccountsDelete(resp *http.Response) (result SpatialAnchorsAccountsDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountsget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountsget_autorest.go new file mode 100644 index 00000000000..0ce928792c1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountsget_autorest.go @@ -0,0 +1,68 @@ +package resource + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SpatialAnchorsAccountsGetOperationResponse struct { + HttpResponse *http.Response + Model *SpatialAnchorsAccount +} + +// SpatialAnchorsAccountsGet ... +func (c ResourceClient) SpatialAnchorsAccountsGet(ctx context.Context, id SpatialAnchorsAccountId) (result SpatialAnchorsAccountsGetOperationResponse, err error) { + req, err := c.preparerForSpatialAnchorsAccountsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSpatialAnchorsAccountsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSpatialAnchorsAccountsGet prepares the SpatialAnchorsAccountsGet request. +func (c ResourceClient) preparerForSpatialAnchorsAccountsGet(ctx context.Context, id SpatialAnchorsAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSpatialAnchorsAccountsGet handles the response to the SpatialAnchorsAccountsGet request. The method always +// closes the http.Response Body. +func (c ResourceClient) responderForSpatialAnchorsAccountsGet(resp *http.Response) (result SpatialAnchorsAccountsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountslistbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountslistbyresourcegroup_autorest.go new file mode 100644 index 00000000000..2dbd43d7213 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountslistbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package resource + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SpatialAnchorsAccountsListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]SpatialAnchorsAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (SpatialAnchorsAccountsListByResourceGroupOperationResponse, error) +} + +type SpatialAnchorsAccountsListByResourceGroupCompleteResult struct { + Items []SpatialAnchorsAccount +} + +func (r SpatialAnchorsAccountsListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r SpatialAnchorsAccountsListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp SpatialAnchorsAccountsListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// SpatialAnchorsAccountsListByResourceGroup ... +func (c ResourceClient) SpatialAnchorsAccountsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp SpatialAnchorsAccountsListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForSpatialAnchorsAccountsListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForSpatialAnchorsAccountsListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForSpatialAnchorsAccountsListByResourceGroup prepares the SpatialAnchorsAccountsListByResourceGroup request. +func (c ResourceClient) preparerForSpatialAnchorsAccountsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.MixedReality/spatialAnchorsAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForSpatialAnchorsAccountsListByResourceGroupWithNextLink prepares the SpatialAnchorsAccountsListByResourceGroup request with the given nextLink token. +func (c ResourceClient) preparerForSpatialAnchorsAccountsListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSpatialAnchorsAccountsListByResourceGroup handles the response to the SpatialAnchorsAccountsListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ResourceClient) responderForSpatialAnchorsAccountsListByResourceGroup(resp *http.Response) (result SpatialAnchorsAccountsListByResourceGroupOperationResponse, err error) { + type page struct { + Values []SpatialAnchorsAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result SpatialAnchorsAccountsListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForSpatialAnchorsAccountsListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSpatialAnchorsAccountsListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// SpatialAnchorsAccountsListByResourceGroupComplete retrieves all of the results into a single object +func (c ResourceClient) SpatialAnchorsAccountsListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (SpatialAnchorsAccountsListByResourceGroupCompleteResult, error) { + return c.SpatialAnchorsAccountsListByResourceGroupCompleteMatchingPredicate(ctx, id, SpatialAnchorsAccountOperationPredicate{}) +} + +// SpatialAnchorsAccountsListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ResourceClient) SpatialAnchorsAccountsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate SpatialAnchorsAccountOperationPredicate) (resp SpatialAnchorsAccountsListByResourceGroupCompleteResult, err error) { + items := make([]SpatialAnchorsAccount, 0) + + page, err := c.SpatialAnchorsAccountsListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := SpatialAnchorsAccountsListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountslistbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountslistbysubscription_autorest.go new file mode 100644 index 00000000000..4f158bf5c2e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountslistbysubscription_autorest.go @@ -0,0 +1,187 @@ +package resource + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SpatialAnchorsAccountsListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]SpatialAnchorsAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (SpatialAnchorsAccountsListBySubscriptionOperationResponse, error) +} + +type SpatialAnchorsAccountsListBySubscriptionCompleteResult struct { + Items []SpatialAnchorsAccount +} + +func (r SpatialAnchorsAccountsListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r SpatialAnchorsAccountsListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp SpatialAnchorsAccountsListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// SpatialAnchorsAccountsListBySubscription ... +func (c ResourceClient) SpatialAnchorsAccountsListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp SpatialAnchorsAccountsListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForSpatialAnchorsAccountsListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForSpatialAnchorsAccountsListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForSpatialAnchorsAccountsListBySubscription prepares the SpatialAnchorsAccountsListBySubscription request. +func (c ResourceClient) preparerForSpatialAnchorsAccountsListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.MixedReality/spatialAnchorsAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForSpatialAnchorsAccountsListBySubscriptionWithNextLink prepares the SpatialAnchorsAccountsListBySubscription request with the given nextLink token. +func (c ResourceClient) preparerForSpatialAnchorsAccountsListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSpatialAnchorsAccountsListBySubscription handles the response to the SpatialAnchorsAccountsListBySubscription request. The method always +// closes the http.Response Body. +func (c ResourceClient) responderForSpatialAnchorsAccountsListBySubscription(resp *http.Response) (result SpatialAnchorsAccountsListBySubscriptionOperationResponse, err error) { + type page struct { + Values []SpatialAnchorsAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result SpatialAnchorsAccountsListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForSpatialAnchorsAccountsListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSpatialAnchorsAccountsListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// SpatialAnchorsAccountsListBySubscriptionComplete retrieves all of the results into a single object +func (c ResourceClient) SpatialAnchorsAccountsListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (SpatialAnchorsAccountsListBySubscriptionCompleteResult, error) { + return c.SpatialAnchorsAccountsListBySubscriptionCompleteMatchingPredicate(ctx, id, SpatialAnchorsAccountOperationPredicate{}) +} + +// SpatialAnchorsAccountsListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ResourceClient) SpatialAnchorsAccountsListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate SpatialAnchorsAccountOperationPredicate) (resp SpatialAnchorsAccountsListBySubscriptionCompleteResult, err error) { + items := make([]SpatialAnchorsAccount, 0) + + page, err := c.SpatialAnchorsAccountsListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := SpatialAnchorsAccountsListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountsupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountsupdate_autorest.go new file mode 100644 index 00000000000..09834e8d772 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/method_spatialanchorsaccountsupdate_autorest.go @@ -0,0 +1,69 @@ +package resource + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SpatialAnchorsAccountsUpdateOperationResponse struct { + HttpResponse *http.Response + Model *SpatialAnchorsAccount +} + +// SpatialAnchorsAccountsUpdate ... +func (c ResourceClient) SpatialAnchorsAccountsUpdate(ctx context.Context, id SpatialAnchorsAccountId, input SpatialAnchorsAccount) (result SpatialAnchorsAccountsUpdateOperationResponse, err error) { + req, err := c.preparerForSpatialAnchorsAccountsUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSpatialAnchorsAccountsUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "resource.ResourceClient", "SpatialAnchorsAccountsUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSpatialAnchorsAccountsUpdate prepares the SpatialAnchorsAccountsUpdate request. +func (c ResourceClient) preparerForSpatialAnchorsAccountsUpdate(ctx context.Context, id SpatialAnchorsAccountId, input SpatialAnchorsAccount) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSpatialAnchorsAccountsUpdate handles the response to the SpatialAnchorsAccountsUpdate request. The method always +// closes the http.Response Body. +func (c ResourceClient) responderForSpatialAnchorsAccountsUpdate(resp *http.Response) (result SpatialAnchorsAccountsUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/model_mixedrealityaccountproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/model_mixedrealityaccountproperties.go new file mode 100644 index 00000000000..38d0a1ed639 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/model_mixedrealityaccountproperties.go @@ -0,0 +1,10 @@ +package resource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MixedRealityAccountProperties struct { + AccountDomain *string `json:"accountDomain,omitempty"` + AccountId *string `json:"accountId,omitempty"` + StorageAccountName *string `json:"storageAccountName,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/model_remoterenderingaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/model_remoterenderingaccount.go new file mode 100644 index 00000000000..976e458637d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/model_remoterenderingaccount.go @@ -0,0 +1,23 @@ +package resource + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemoteRenderingAccount struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Kind *Sku `json:"kind,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Plan *identity.SystemAssigned `json:"plan,omitempty"` + Properties *MixedRealityAccountProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/model_sku.go new file mode 100644 index 00000000000..182c316eff9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/model_sku.go @@ -0,0 +1,12 @@ +package resource + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/model_spatialanchorsaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/model_spatialanchorsaccount.go new file mode 100644 index 00000000000..0aadd7c7371 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/model_spatialanchorsaccount.go @@ -0,0 +1,23 @@ +package resource + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SpatialAnchorsAccount struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Kind *Sku `json:"kind,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Plan *identity.SystemAssigned `json:"plan,omitempty"` + Properties *MixedRealityAccountProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/predicates.go new file mode 100644 index 00000000000..fd95c2f423a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/predicates.go @@ -0,0 +1,57 @@ +package resource + +type RemoteRenderingAccountOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p RemoteRenderingAccountOperationPredicate) Matches(input RemoteRenderingAccount) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type SpatialAnchorsAccountOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p SpatialAnchorsAccountOperationPredicate) Matches(input SpatialAnchorsAccount) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/version.go new file mode 100644 index 00000000000..3c60521cec7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource/version.go @@ -0,0 +1,12 @@ +package resource + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/resource/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/README.md new file mode 100644 index 00000000000..a47f3c6bf12 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools` Documentation + +The `capacitypools` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2021-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools" +``` + + +### Client Initialization + +```go +client := capacitypools.NewCapacityPoolsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CapacityPoolsClient.PoolsCreateOrUpdate` + +```go +ctx := context.TODO() +id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue") + +payload := capacitypools.CapacityPool{ + // ... +} + + +if err := client.PoolsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CapacityPoolsClient.PoolsDelete` + +```go +ctx := context.TODO() +id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue") + +if err := client.PoolsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CapacityPoolsClient.PoolsGet` + +```go +ctx := context.TODO() +id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue") + +read, err := client.PoolsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapacityPoolsClient.PoolsList` + +```go +ctx := context.TODO() +id := capacitypools.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +// alternatively `client.PoolsList(ctx, id)` can be used to do batched pagination +items, err := client.PoolsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CapacityPoolsClient.PoolsUpdate` + +```go +ctx := context.TODO() +id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue") + +payload := capacitypools.CapacityPoolPatch{ + // ... +} + + +if err := client.PoolsUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/client.go new file mode 100644 index 00000000000..d31b6b301a2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/client.go @@ -0,0 +1,18 @@ +package capacitypools + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityPoolsClient struct { + Client autorest.Client + baseUri string +} + +func NewCapacityPoolsClientWithBaseURI(endpoint string) CapacityPoolsClient { + return CapacityPoolsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/constants.go new file mode 100644 index 00000000000..4856e8e79bc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/constants.go @@ -0,0 +1,96 @@ +package capacitypools + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionType string + +const ( + EncryptionTypeDouble EncryptionType = "Double" + EncryptionTypeSingle EncryptionType = "Single" +) + +func PossibleValuesForEncryptionType() []string { + return []string{ + string(EncryptionTypeDouble), + string(EncryptionTypeSingle), + } +} + +func parseEncryptionType(input string) (*EncryptionType, error) { + vals := map[string]EncryptionType{ + "double": EncryptionTypeDouble, + "single": EncryptionTypeSingle, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EncryptionType(input) + return &out, nil +} + +type QosType string + +const ( + QosTypeAuto QosType = "Auto" + QosTypeManual QosType = "Manual" +) + +func PossibleValuesForQosType() []string { + return []string{ + string(QosTypeAuto), + string(QosTypeManual), + } +} + +func parseQosType(input string) (*QosType, error) { + vals := map[string]QosType{ + "auto": QosTypeAuto, + "manual": QosTypeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := QosType(input) + return &out, nil +} + +type ServiceLevel string + +const ( + ServiceLevelPremium ServiceLevel = "Premium" + ServiceLevelStandard ServiceLevel = "Standard" + ServiceLevelStandardZRS ServiceLevel = "StandardZRS" + ServiceLevelUltra ServiceLevel = "Ultra" +) + +func PossibleValuesForServiceLevel() []string { + return []string{ + string(ServiceLevelPremium), + string(ServiceLevelStandard), + string(ServiceLevelStandardZRS), + string(ServiceLevelUltra), + } +} + +func parseServiceLevel(input string) (*ServiceLevel, error) { + vals := map[string]ServiceLevel{ + "premium": ServiceLevelPremium, + "standard": ServiceLevelStandard, + "standardzrs": ServiceLevelStandardZRS, + "ultra": ServiceLevelUltra, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServiceLevel(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/id_capacitypool.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/id_capacitypool.go new file mode 100644 index 00000000000..a50e2940839 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/id_capacitypool.go @@ -0,0 +1,137 @@ +package capacitypools + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = CapacityPoolId{} + +// CapacityPoolId is a struct representing the Resource ID for a Capacity Pool +type CapacityPoolId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + PoolName string +} + +// NewCapacityPoolID returns a new CapacityPoolId struct +func NewCapacityPoolID(subscriptionId string, resourceGroupName string, accountName string, poolName string) CapacityPoolId { + return CapacityPoolId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + PoolName: poolName, + } +} + +// ParseCapacityPoolID parses 'input' into a CapacityPoolId +func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CapacityPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseCapacityPoolIDInsensitively parses 'input' case-insensitively into a CapacityPoolId +// note: this method should only be used for API response data and not user input +func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CapacityPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID +func ValidateCapacityPoolID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCapacityPoolID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Capacity Pool ID +func (id CapacityPoolId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Capacity Pool ID +func (id CapacityPoolId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), + resourceids.UserSpecifiedSegment("poolName", "poolValue"), + } +} + +// String returns a human-readable description of this Capacity Pool ID +func (id CapacityPoolId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Pool Name: %q", id.PoolName), + } + return fmt.Sprintf("Capacity Pool (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/id_netappaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/id_netappaccount.go new file mode 100644 index 00000000000..86bd7fcada4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/id_netappaccount.go @@ -0,0 +1,124 @@ +package capacitypools + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NetAppAccountId{} + +// NetAppAccountId is a struct representing the Resource ID for a Net App Account +type NetAppAccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewNetAppAccountID returns a new NetAppAccountId struct +func NewNetAppAccountID(subscriptionId string, resourceGroupName string, accountName string) NetAppAccountId { + return NetAppAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseNetAppAccountID parses 'input' into a NetAppAccountId +func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(NetAppAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetAppAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNetAppAccountIDInsensitively parses 'input' case-insensitively into a NetAppAccountId +// note: this method should only be used for API response data and not user input +func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(NetAppAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetAppAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID +func ValidateNetAppAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNetAppAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Net App Account ID +func (id NetAppAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Net App Account ID +func (id NetAppAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Net App Account ID +func (id NetAppAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Net App Account (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolscreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolscreateorupdate_autorest.go new file mode 100644 index 00000000000..72891f7b9df --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolscreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package capacitypools + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolsCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// PoolsCreateOrUpdate ... +func (c CapacityPoolsClient) PoolsCreateOrUpdate(ctx context.Context, id CapacityPoolId, input CapacityPool) (result PoolsCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForPoolsCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForPoolsCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// PoolsCreateOrUpdateThenPoll performs PoolsCreateOrUpdate then polls until it's completed +func (c CapacityPoolsClient) PoolsCreateOrUpdateThenPoll(ctx context.Context, id CapacityPoolId, input CapacityPool) error { + result, err := c.PoolsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing PoolsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after PoolsCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForPoolsCreateOrUpdate prepares the PoolsCreateOrUpdate request. +func (c CapacityPoolsClient) preparerForPoolsCreateOrUpdate(ctx context.Context, id CapacityPoolId, input CapacityPool) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForPoolsCreateOrUpdate sends the PoolsCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c CapacityPoolsClient) senderForPoolsCreateOrUpdate(ctx context.Context, req *http.Request) (future PoolsCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsdelete_autorest.go new file mode 100644 index 00000000000..61d0e6104b1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsdelete_autorest.go @@ -0,0 +1,78 @@ +package capacitypools + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolsDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// PoolsDelete ... +func (c CapacityPoolsClient) PoolsDelete(ctx context.Context, id CapacityPoolId) (result PoolsDeleteOperationResponse, err error) { + req, err := c.preparerForPoolsDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForPoolsDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// PoolsDeleteThenPoll performs PoolsDelete then polls until it's completed +func (c CapacityPoolsClient) PoolsDeleteThenPoll(ctx context.Context, id CapacityPoolId) error { + result, err := c.PoolsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing PoolsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after PoolsDelete: %+v", err) + } + + return nil +} + +// preparerForPoolsDelete prepares the PoolsDelete request. +func (c CapacityPoolsClient) preparerForPoolsDelete(ctx context.Context, id CapacityPoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForPoolsDelete sends the PoolsDelete request. The method will close the +// http.Response Body if it receives an error. +func (c CapacityPoolsClient) senderForPoolsDelete(ctx context.Context, req *http.Request) (future PoolsDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsget_autorest.go new file mode 100644 index 00000000000..e315bc1ebb1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsget_autorest.go @@ -0,0 +1,68 @@ +package capacitypools + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolsGetOperationResponse struct { + HttpResponse *http.Response + Model *CapacityPool +} + +// PoolsGet ... +func (c CapacityPoolsClient) PoolsGet(ctx context.Context, id CapacityPoolId) (result PoolsGetOperationResponse, err error) { + req, err := c.preparerForPoolsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPoolsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPoolsGet prepares the PoolsGet request. +func (c CapacityPoolsClient) preparerForPoolsGet(ctx context.Context, id CapacityPoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPoolsGet handles the response to the PoolsGet request. The method always +// closes the http.Response Body. +func (c CapacityPoolsClient) responderForPoolsGet(resp *http.Response) (result PoolsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolslist_autorest.go new file mode 100644 index 00000000000..c94f2008f22 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolslist_autorest.go @@ -0,0 +1,186 @@ +package capacitypools + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolsListOperationResponse struct { + HttpResponse *http.Response + Model *[]CapacityPool + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (PoolsListOperationResponse, error) +} + +type PoolsListCompleteResult struct { + Items []CapacityPool +} + +func (r PoolsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r PoolsListOperationResponse) LoadMore(ctx context.Context) (resp PoolsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// PoolsList ... +func (c CapacityPoolsClient) PoolsList(ctx context.Context, id NetAppAccountId) (resp PoolsListOperationResponse, err error) { + req, err := c.preparerForPoolsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForPoolsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForPoolsList prepares the PoolsList request. +func (c CapacityPoolsClient) preparerForPoolsList(ctx context.Context, id NetAppAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/capacityPools", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForPoolsListWithNextLink prepares the PoolsList request with the given nextLink token. +func (c CapacityPoolsClient) preparerForPoolsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPoolsList handles the response to the PoolsList request. The method always +// closes the http.Response Body. +func (c CapacityPoolsClient) responderForPoolsList(resp *http.Response) (result PoolsListOperationResponse, err error) { + type page struct { + Values []CapacityPool `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result PoolsListOperationResponse, err error) { + req, err := c.preparerForPoolsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPoolsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// PoolsListComplete retrieves all of the results into a single object +func (c CapacityPoolsClient) PoolsListComplete(ctx context.Context, id NetAppAccountId) (PoolsListCompleteResult, error) { + return c.PoolsListCompleteMatchingPredicate(ctx, id, CapacityPoolOperationPredicate{}) +} + +// PoolsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c CapacityPoolsClient) PoolsListCompleteMatchingPredicate(ctx context.Context, id NetAppAccountId, predicate CapacityPoolOperationPredicate) (resp PoolsListCompleteResult, err error) { + items := make([]CapacityPool, 0) + + page, err := c.PoolsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := PoolsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsupdate_autorest.go new file mode 100644 index 00000000000..680bc19748a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsupdate_autorest.go @@ -0,0 +1,79 @@ +package capacitypools + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolsUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// PoolsUpdate ... +func (c CapacityPoolsClient) PoolsUpdate(ctx context.Context, id CapacityPoolId, input CapacityPoolPatch) (result PoolsUpdateOperationResponse, err error) { + req, err := c.preparerForPoolsUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForPoolsUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// PoolsUpdateThenPoll performs PoolsUpdate then polls until it's completed +func (c CapacityPoolsClient) PoolsUpdateThenPoll(ctx context.Context, id CapacityPoolId, input CapacityPoolPatch) error { + result, err := c.PoolsUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing PoolsUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after PoolsUpdate: %+v", err) + } + + return nil +} + +// preparerForPoolsUpdate prepares the PoolsUpdate request. +func (c CapacityPoolsClient) preparerForPoolsUpdate(ctx context.Context, id CapacityPoolId, input CapacityPoolPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForPoolsUpdate sends the PoolsUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c CapacityPoolsClient) senderForPoolsUpdate(ctx context.Context, req *http.Request) (future PoolsUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_capacitypool.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_capacitypool.go new file mode 100644 index 00000000000..f5d6f1ea86d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_capacitypool.go @@ -0,0 +1,19 @@ +package capacitypools + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityPool struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties PoolProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_capacitypoolpatch.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_capacitypoolpatch.go new file mode 100644 index 00000000000..46abcde6b33 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_capacitypoolpatch.go @@ -0,0 +1,13 @@ +package capacitypools + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityPoolPatch struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PoolPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_poolpatchproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_poolpatchproperties.go new file mode 100644 index 00000000000..071dba44559 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_poolpatchproperties.go @@ -0,0 +1,9 @@ +package capacitypools + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolPatchProperties struct { + QosType *QosType `json:"qosType,omitempty"` + Size *int64 `json:"size,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_poolproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_poolproperties.go new file mode 100644 index 00000000000..a1fee733fb4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_poolproperties.go @@ -0,0 +1,16 @@ +package capacitypools + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolProperties struct { + CoolAccess *bool `json:"coolAccess,omitempty"` + EncryptionType *EncryptionType `json:"encryptionType,omitempty"` + PoolId *string `json:"poolId,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + QosType *QosType `json:"qosType,omitempty"` + ServiceLevel ServiceLevel `json:"serviceLevel"` + Size int64 `json:"size"` + TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` + UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/predicates.go new file mode 100644 index 00000000000..67e2199aa2c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/predicates.go @@ -0,0 +1,34 @@ +package capacitypools + +type CapacityPoolOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p CapacityPoolOperationPredicate) Matches(input CapacityPool) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/version.go new file mode 100644 index 00000000000..c647e160436 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/version.go @@ -0,0 +1,12 @@ +package capacitypools + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/capacitypools/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/README.md new file mode 100644 index 00000000000..d011b742330 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts` Documentation + +The `netappaccounts` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2021-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts" +``` + + +### Client Initialization + +```go +client := netappaccounts.NewNetAppAccountsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NetAppAccountsClient.AccountsCreateOrUpdate` + +```go +ctx := context.TODO() +id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := netappaccounts.NetAppAccount{ + // ... +} + + +if err := client.AccountsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `NetAppAccountsClient.AccountsDelete` + +```go +ctx := context.TODO() +id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +if err := client.AccountsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `NetAppAccountsClient.AccountsGet` + +```go +ctx := context.TODO() +id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.AccountsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NetAppAccountsClient.AccountsList` + +```go +ctx := context.TODO() +id := netappaccounts.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.AccountsList(ctx, id)` can be used to do batched pagination +items, err := client.AccountsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NetAppAccountsClient.AccountsListBySubscription` + +```go +ctx := context.TODO() +id := netappaccounts.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.AccountsListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.AccountsListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NetAppAccountsClient.AccountsUpdate` + +```go +ctx := context.TODO() +id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := netappaccounts.NetAppAccountPatch{ + // ... +} + + +if err := client.AccountsUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/client.go new file mode 100644 index 00000000000..1a10ce8e9b6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/client.go @@ -0,0 +1,18 @@ +package netappaccounts + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetAppAccountsClient struct { + Client autorest.Client + baseUri string +} + +func NewNetAppAccountsClientWithBaseURI(endpoint string) NetAppAccountsClient { + return NetAppAccountsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/constants.go new file mode 100644 index 00000000000..6e41970873a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/constants.go @@ -0,0 +1,43 @@ +package netappaccounts + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActiveDirectoryStatus string + +const ( + ActiveDirectoryStatusCreated ActiveDirectoryStatus = "Created" + ActiveDirectoryStatusDeleted ActiveDirectoryStatus = "Deleted" + ActiveDirectoryStatusError ActiveDirectoryStatus = "Error" + ActiveDirectoryStatusInUse ActiveDirectoryStatus = "InUse" + ActiveDirectoryStatusUpdating ActiveDirectoryStatus = "Updating" +) + +func PossibleValuesForActiveDirectoryStatus() []string { + return []string{ + string(ActiveDirectoryStatusCreated), + string(ActiveDirectoryStatusDeleted), + string(ActiveDirectoryStatusError), + string(ActiveDirectoryStatusInUse), + string(ActiveDirectoryStatusUpdating), + } +} + +func parseActiveDirectoryStatus(input string) (*ActiveDirectoryStatus, error) { + vals := map[string]ActiveDirectoryStatus{ + "created": ActiveDirectoryStatusCreated, + "deleted": ActiveDirectoryStatusDeleted, + "error": ActiveDirectoryStatusError, + "inuse": ActiveDirectoryStatusInUse, + "updating": ActiveDirectoryStatusUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ActiveDirectoryStatus(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/id_netappaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/id_netappaccount.go new file mode 100644 index 00000000000..68e53f4815f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/id_netappaccount.go @@ -0,0 +1,124 @@ +package netappaccounts + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NetAppAccountId{} + +// NetAppAccountId is a struct representing the Resource ID for a Net App Account +type NetAppAccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewNetAppAccountID returns a new NetAppAccountId struct +func NewNetAppAccountID(subscriptionId string, resourceGroupName string, accountName string) NetAppAccountId { + return NetAppAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseNetAppAccountID parses 'input' into a NetAppAccountId +func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(NetAppAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetAppAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNetAppAccountIDInsensitively parses 'input' case-insensitively into a NetAppAccountId +// note: this method should only be used for API response data and not user input +func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(NetAppAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetAppAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID +func ValidateNetAppAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNetAppAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Net App Account ID +func (id NetAppAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Net App Account ID +func (id NetAppAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Net App Account ID +func (id NetAppAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Net App Account (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountscreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountscreateorupdate_autorest.go new file mode 100644 index 00000000000..b192ede4f69 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountscreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package netappaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// AccountsCreateOrUpdate ... +func (c NetAppAccountsClient) AccountsCreateOrUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccount) (result AccountsCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForAccountsCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForAccountsCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// AccountsCreateOrUpdateThenPoll performs AccountsCreateOrUpdate then polls until it's completed +func (c NetAppAccountsClient) AccountsCreateOrUpdateThenPoll(ctx context.Context, id NetAppAccountId, input NetAppAccount) error { + result, err := c.AccountsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AccountsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after AccountsCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForAccountsCreateOrUpdate prepares the AccountsCreateOrUpdate request. +func (c NetAppAccountsClient) preparerForAccountsCreateOrUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccount) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForAccountsCreateOrUpdate sends the AccountsCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c NetAppAccountsClient) senderForAccountsCreateOrUpdate(ctx context.Context, req *http.Request) (future AccountsCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsdelete_autorest.go new file mode 100644 index 00000000000..4506db44c63 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsdelete_autorest.go @@ -0,0 +1,78 @@ +package netappaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// AccountsDelete ... +func (c NetAppAccountsClient) AccountsDelete(ctx context.Context, id NetAppAccountId) (result AccountsDeleteOperationResponse, err error) { + req, err := c.preparerForAccountsDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForAccountsDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// AccountsDeleteThenPoll performs AccountsDelete then polls until it's completed +func (c NetAppAccountsClient) AccountsDeleteThenPoll(ctx context.Context, id NetAppAccountId) error { + result, err := c.AccountsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing AccountsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after AccountsDelete: %+v", err) + } + + return nil +} + +// preparerForAccountsDelete prepares the AccountsDelete request. +func (c NetAppAccountsClient) preparerForAccountsDelete(ctx context.Context, id NetAppAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForAccountsDelete sends the AccountsDelete request. The method will close the +// http.Response Body if it receives an error. +func (c NetAppAccountsClient) senderForAccountsDelete(ctx context.Context, req *http.Request) (future AccountsDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsget_autorest.go new file mode 100644 index 00000000000..e1bfd36dd26 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsget_autorest.go @@ -0,0 +1,68 @@ +package netappaccounts + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsGetOperationResponse struct { + HttpResponse *http.Response + Model *NetAppAccount +} + +// AccountsGet ... +func (c NetAppAccountsClient) AccountsGet(ctx context.Context, id NetAppAccountId) (result AccountsGetOperationResponse, err error) { + req, err := c.preparerForAccountsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForAccountsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForAccountsGet prepares the AccountsGet request. +func (c NetAppAccountsClient) preparerForAccountsGet(ctx context.Context, id NetAppAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForAccountsGet handles the response to the AccountsGet request. The method always +// closes the http.Response Body. +func (c NetAppAccountsClient) responderForAccountsGet(resp *http.Response) (result AccountsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountslist_autorest.go new file mode 100644 index 00000000000..e847a17848c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountslist_autorest.go @@ -0,0 +1,187 @@ +package netappaccounts + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsListOperationResponse struct { + HttpResponse *http.Response + Model *[]NetAppAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (AccountsListOperationResponse, error) +} + +type AccountsListCompleteResult struct { + Items []NetAppAccount +} + +func (r AccountsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r AccountsListOperationResponse) LoadMore(ctx context.Context) (resp AccountsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// AccountsList ... +func (c NetAppAccountsClient) AccountsList(ctx context.Context, id commonids.ResourceGroupId) (resp AccountsListOperationResponse, err error) { + req, err := c.preparerForAccountsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForAccountsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForAccountsList prepares the AccountsList request. +func (c NetAppAccountsClient) preparerForAccountsList(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.NetApp/netAppAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForAccountsListWithNextLink prepares the AccountsList request with the given nextLink token. +func (c NetAppAccountsClient) preparerForAccountsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForAccountsList handles the response to the AccountsList request. The method always +// closes the http.Response Body. +func (c NetAppAccountsClient) responderForAccountsList(resp *http.Response) (result AccountsListOperationResponse, err error) { + type page struct { + Values []NetAppAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result AccountsListOperationResponse, err error) { + req, err := c.preparerForAccountsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForAccountsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// AccountsListComplete retrieves all of the results into a single object +func (c NetAppAccountsClient) AccountsListComplete(ctx context.Context, id commonids.ResourceGroupId) (AccountsListCompleteResult, error) { + return c.AccountsListCompleteMatchingPredicate(ctx, id, NetAppAccountOperationPredicate{}) +} + +// AccountsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NetAppAccountsClient) AccountsListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate NetAppAccountOperationPredicate) (resp AccountsListCompleteResult, err error) { + items := make([]NetAppAccount, 0) + + page, err := c.AccountsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := AccountsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountslistbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountslistbysubscription_autorest.go new file mode 100644 index 00000000000..38f468c2b83 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountslistbysubscription_autorest.go @@ -0,0 +1,187 @@ +package netappaccounts + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]NetAppAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (AccountsListBySubscriptionOperationResponse, error) +} + +type AccountsListBySubscriptionCompleteResult struct { + Items []NetAppAccount +} + +func (r AccountsListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r AccountsListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp AccountsListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// AccountsListBySubscription ... +func (c NetAppAccountsClient) AccountsListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp AccountsListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForAccountsListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForAccountsListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForAccountsListBySubscription prepares the AccountsListBySubscription request. +func (c NetAppAccountsClient) preparerForAccountsListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.NetApp/netAppAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForAccountsListBySubscriptionWithNextLink prepares the AccountsListBySubscription request with the given nextLink token. +func (c NetAppAccountsClient) preparerForAccountsListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForAccountsListBySubscription handles the response to the AccountsListBySubscription request. The method always +// closes the http.Response Body. +func (c NetAppAccountsClient) responderForAccountsListBySubscription(resp *http.Response) (result AccountsListBySubscriptionOperationResponse, err error) { + type page struct { + Values []NetAppAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result AccountsListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForAccountsListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForAccountsListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// AccountsListBySubscriptionComplete retrieves all of the results into a single object +func (c NetAppAccountsClient) AccountsListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (AccountsListBySubscriptionCompleteResult, error) { + return c.AccountsListBySubscriptionCompleteMatchingPredicate(ctx, id, NetAppAccountOperationPredicate{}) +} + +// AccountsListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NetAppAccountsClient) AccountsListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate NetAppAccountOperationPredicate) (resp AccountsListBySubscriptionCompleteResult, err error) { + items := make([]NetAppAccount, 0) + + page, err := c.AccountsListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := AccountsListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsupdate_autorest.go new file mode 100644 index 00000000000..8ed5cd37c4c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsupdate_autorest.go @@ -0,0 +1,79 @@ +package netappaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// AccountsUpdate ... +func (c NetAppAccountsClient) AccountsUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccountPatch) (result AccountsUpdateOperationResponse, err error) { + req, err := c.preparerForAccountsUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForAccountsUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// AccountsUpdateThenPoll performs AccountsUpdate then polls until it's completed +func (c NetAppAccountsClient) AccountsUpdateThenPoll(ctx context.Context, id NetAppAccountId, input NetAppAccountPatch) error { + result, err := c.AccountsUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AccountsUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after AccountsUpdate: %+v", err) + } + + return nil +} + +// preparerForAccountsUpdate prepares the AccountsUpdate request. +func (c NetAppAccountsClient) preparerForAccountsUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccountPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForAccountsUpdate sends the AccountsUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c NetAppAccountsClient) senderForAccountsUpdate(ctx context.Context, req *http.Request) (future AccountsUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_accountencryption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_accountencryption.go new file mode 100644 index 00000000000..39a9282ce50 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_accountencryption.go @@ -0,0 +1,8 @@ +package netappaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountEncryption struct { + KeySource *string `json:"keySource,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_accountproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_accountproperties.go new file mode 100644 index 00000000000..b158b47fc94 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_accountproperties.go @@ -0,0 +1,10 @@ +package netappaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountProperties struct { + ActiveDirectories *[]ActiveDirectory `json:"activeDirectories,omitempty"` + Encryption *AccountEncryption `json:"encryption,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_activedirectory.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_activedirectory.go new file mode 100644 index 00000000000..da90d13da0a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_activedirectory.go @@ -0,0 +1,29 @@ +package netappaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActiveDirectory struct { + ActiveDirectoryId *string `json:"activeDirectoryId,omitempty"` + AdName *string `json:"adName,omitempty"` + Administrators *[]string `json:"administrators,omitempty"` + AesEncryption *bool `json:"aesEncryption,omitempty"` + AllowLocalNfsUsersWithLdap *bool `json:"allowLocalNfsUsersWithLdap,omitempty"` + BackupOperators *[]string `json:"backupOperators,omitempty"` + Dns *string `json:"dns,omitempty"` + Domain *string `json:"domain,omitempty"` + EncryptDCConnections *bool `json:"encryptDCConnections,omitempty"` + KdcIP *string `json:"kdcIP,omitempty"` + LdapOverTLS *bool `json:"ldapOverTLS,omitempty"` + LdapSearchScope *LdapSearchScopeOpt `json:"ldapSearchScope,omitempty"` + LdapSigning *bool `json:"ldapSigning,omitempty"` + OrganizationalUnit *string `json:"organizationalUnit,omitempty"` + Password *string `json:"password,omitempty"` + SecurityOperators *[]string `json:"securityOperators,omitempty"` + ServerRootCACertificate *string `json:"serverRootCACertificate,omitempty"` + Site *string `json:"site,omitempty"` + SmbServerName *string `json:"smbServerName,omitempty"` + Status *ActiveDirectoryStatus `json:"status,omitempty"` + StatusDetails *string `json:"statusDetails,omitempty"` + Username *string `json:"username,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_ldapsearchscopeopt.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_ldapsearchscopeopt.go new file mode 100644 index 00000000000..c476b0f0875 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_ldapsearchscopeopt.go @@ -0,0 +1,10 @@ +package netappaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LdapSearchScopeOpt struct { + GroupDN *string `json:"groupDN,omitempty"` + GroupMembershipFilter *string `json:"groupMembershipFilter,omitempty"` + UserDN *string `json:"userDN,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_netappaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_netappaccount.go new file mode 100644 index 00000000000..ec2ed4aa10c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_netappaccount.go @@ -0,0 +1,19 @@ +package netappaccounts + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetAppAccount struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *AccountProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_netappaccountpatch.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_netappaccountpatch.go new file mode 100644 index 00000000000..d3c6c1efcc2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_netappaccountpatch.go @@ -0,0 +1,13 @@ +package netappaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetAppAccountPatch struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AccountProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/predicates.go new file mode 100644 index 00000000000..cc139fd85c4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/predicates.go @@ -0,0 +1,34 @@ +package netappaccounts + +type NetAppAccountOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p NetAppAccountOperationPredicate) Matches(input NetAppAccount) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/version.go new file mode 100644 index 00000000000..3de2667a1a8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/version.go @@ -0,0 +1,12 @@ +package netappaccounts + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/netappaccounts/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/README.md new file mode 100644 index 00000000000..802de9b9653 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/README.md @@ -0,0 +1,102 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy` Documentation + +The `snapshotpolicy` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2021-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy" +``` + + +### Client Initialization + +```go +client := snapshotpolicy.NewSnapshotPolicyClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesCreate` + +```go +ctx := context.TODO() +id := snapshotpolicy.NewSnapshotPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "snapshotPolicyValue") + +payload := snapshotpolicy.SnapshotPolicy{ + // ... +} + + +read, err := client.SnapshotPoliciesCreate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesDelete` + +```go +ctx := context.TODO() +id := snapshotpolicy.NewSnapshotPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "snapshotPolicyValue") + +if err := client.SnapshotPoliciesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesGet` + +```go +ctx := context.TODO() +id := snapshotpolicy.NewSnapshotPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "snapshotPolicyValue") + +read, err := client.SnapshotPoliciesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesList` + +```go +ctx := context.TODO() +id := snapshotpolicy.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.SnapshotPoliciesList(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesUpdate` + +```go +ctx := context.TODO() +id := snapshotpolicy.NewSnapshotPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "snapshotPolicyValue") + +payload := snapshotpolicy.SnapshotPolicyPatch{ + // ... +} + + +if err := client.SnapshotPoliciesUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/client.go new file mode 100644 index 00000000000..63c20fd6ea4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/client.go @@ -0,0 +1,18 @@ +package snapshotpolicy + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPolicyClient struct { + Client autorest.Client + baseUri string +} + +func NewSnapshotPolicyClientWithBaseURI(endpoint string) SnapshotPolicyClient { + return SnapshotPolicyClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/id_netappaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/id_netappaccount.go new file mode 100644 index 00000000000..726c28f92e9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/id_netappaccount.go @@ -0,0 +1,124 @@ +package snapshotpolicy + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NetAppAccountId{} + +// NetAppAccountId is a struct representing the Resource ID for a Net App Account +type NetAppAccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewNetAppAccountID returns a new NetAppAccountId struct +func NewNetAppAccountID(subscriptionId string, resourceGroupName string, accountName string) NetAppAccountId { + return NetAppAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseNetAppAccountID parses 'input' into a NetAppAccountId +func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(NetAppAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetAppAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNetAppAccountIDInsensitively parses 'input' case-insensitively into a NetAppAccountId +// note: this method should only be used for API response data and not user input +func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(NetAppAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetAppAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID +func ValidateNetAppAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNetAppAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Net App Account ID +func (id NetAppAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Net App Account ID +func (id NetAppAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Net App Account ID +func (id NetAppAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Net App Account (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/id_snapshotpolicies.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/id_snapshotpolicies.go new file mode 100644 index 00000000000..f0662d3bf33 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/id_snapshotpolicies.go @@ -0,0 +1,137 @@ +package snapshotpolicy + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SnapshotPoliciesId{} + +// SnapshotPoliciesId is a struct representing the Resource ID for a Snapshot Policies +type SnapshotPoliciesId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + SnapshotPolicyName string +} + +// NewSnapshotPoliciesID returns a new SnapshotPoliciesId struct +func NewSnapshotPoliciesID(subscriptionId string, resourceGroupName string, accountName string, snapshotPolicyName string) SnapshotPoliciesId { + return SnapshotPoliciesId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + SnapshotPolicyName: snapshotPolicyName, + } +} + +// ParseSnapshotPoliciesID parses 'input' into a SnapshotPoliciesId +func ParseSnapshotPoliciesID(input string) (*SnapshotPoliciesId, error) { + parser := resourceids.NewParserFromResourceIdType(SnapshotPoliciesId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SnapshotPoliciesId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { + return nil, fmt.Errorf("the segment 'snapshotPolicyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSnapshotPoliciesIDInsensitively parses 'input' case-insensitively into a SnapshotPoliciesId +// note: this method should only be used for API response data and not user input +func ParseSnapshotPoliciesIDInsensitively(input string) (*SnapshotPoliciesId, error) { + parser := resourceids.NewParserFromResourceIdType(SnapshotPoliciesId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SnapshotPoliciesId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { + return nil, fmt.Errorf("the segment 'snapshotPolicyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSnapshotPoliciesID checks that 'input' can be parsed as a Snapshot Policies ID +func ValidateSnapshotPoliciesID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSnapshotPoliciesID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Snapshot Policies ID +func (id SnapshotPoliciesId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/snapshotPolicies/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.SnapshotPolicyName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Snapshot Policies ID +func (id SnapshotPoliciesId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticSnapshotPolicies", "snapshotPolicies", "snapshotPolicies"), + resourceids.UserSpecifiedSegment("snapshotPolicyName", "snapshotPolicyValue"), + } +} + +// String returns a human-readable description of this Snapshot Policies ID +func (id SnapshotPoliciesId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Snapshot Policy Name: %q", id.SnapshotPolicyName), + } + return fmt.Sprintf("Snapshot Policies (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciescreate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciescreate_autorest.go new file mode 100644 index 00000000000..c6e331f03b2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciescreate_autorest.go @@ -0,0 +1,69 @@ +package snapshotpolicy + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPoliciesCreateOperationResponse struct { + HttpResponse *http.Response + Model *SnapshotPolicy +} + +// SnapshotPoliciesCreate ... +func (c SnapshotPolicyClient) SnapshotPoliciesCreate(ctx context.Context, id SnapshotPoliciesId, input SnapshotPolicy) (result SnapshotPoliciesCreateOperationResponse, err error) { + req, err := c.preparerForSnapshotPoliciesCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesCreate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesCreate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSnapshotPoliciesCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesCreate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSnapshotPoliciesCreate prepares the SnapshotPoliciesCreate request. +func (c SnapshotPolicyClient) preparerForSnapshotPoliciesCreate(ctx context.Context, id SnapshotPoliciesId, input SnapshotPolicy) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSnapshotPoliciesCreate handles the response to the SnapshotPoliciesCreate request. The method always +// closes the http.Response Body. +func (c SnapshotPolicyClient) responderForSnapshotPoliciesCreate(resp *http.Response) (result SnapshotPoliciesCreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesdelete_autorest.go new file mode 100644 index 00000000000..0b2ba890521 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesdelete_autorest.go @@ -0,0 +1,78 @@ +package snapshotpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPoliciesDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// SnapshotPoliciesDelete ... +func (c SnapshotPolicyClient) SnapshotPoliciesDelete(ctx context.Context, id SnapshotPoliciesId) (result SnapshotPoliciesDeleteOperationResponse, err error) { + req, err := c.preparerForSnapshotPoliciesDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForSnapshotPoliciesDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// SnapshotPoliciesDeleteThenPoll performs SnapshotPoliciesDelete then polls until it's completed +func (c SnapshotPolicyClient) SnapshotPoliciesDeleteThenPoll(ctx context.Context, id SnapshotPoliciesId) error { + result, err := c.SnapshotPoliciesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing SnapshotPoliciesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after SnapshotPoliciesDelete: %+v", err) + } + + return nil +} + +// preparerForSnapshotPoliciesDelete prepares the SnapshotPoliciesDelete request. +func (c SnapshotPolicyClient) preparerForSnapshotPoliciesDelete(ctx context.Context, id SnapshotPoliciesId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForSnapshotPoliciesDelete sends the SnapshotPoliciesDelete request. The method will close the +// http.Response Body if it receives an error. +func (c SnapshotPolicyClient) senderForSnapshotPoliciesDelete(ctx context.Context, req *http.Request) (future SnapshotPoliciesDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesget_autorest.go new file mode 100644 index 00000000000..909d4ee01f7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesget_autorest.go @@ -0,0 +1,68 @@ +package snapshotpolicy + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPoliciesGetOperationResponse struct { + HttpResponse *http.Response + Model *SnapshotPolicy +} + +// SnapshotPoliciesGet ... +func (c SnapshotPolicyClient) SnapshotPoliciesGet(ctx context.Context, id SnapshotPoliciesId) (result SnapshotPoliciesGetOperationResponse, err error) { + req, err := c.preparerForSnapshotPoliciesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSnapshotPoliciesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSnapshotPoliciesGet prepares the SnapshotPoliciesGet request. +func (c SnapshotPolicyClient) preparerForSnapshotPoliciesGet(ctx context.Context, id SnapshotPoliciesId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSnapshotPoliciesGet handles the response to the SnapshotPoliciesGet request. The method always +// closes the http.Response Body. +func (c SnapshotPolicyClient) responderForSnapshotPoliciesGet(resp *http.Response) (result SnapshotPoliciesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpolicieslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpolicieslist_autorest.go new file mode 100644 index 00000000000..ea72ff942c5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpolicieslist_autorest.go @@ -0,0 +1,69 @@ +package snapshotpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPoliciesListOperationResponse struct { + HttpResponse *http.Response + Model *SnapshotPoliciesList +} + +// SnapshotPoliciesList ... +func (c SnapshotPolicyClient) SnapshotPoliciesList(ctx context.Context, id NetAppAccountId) (result SnapshotPoliciesListOperationResponse, err error) { + req, err := c.preparerForSnapshotPoliciesList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSnapshotPoliciesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesList", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSnapshotPoliciesList prepares the SnapshotPoliciesList request. +func (c SnapshotPolicyClient) preparerForSnapshotPoliciesList(ctx context.Context, id NetAppAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/snapshotPolicies", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSnapshotPoliciesList handles the response to the SnapshotPoliciesList request. The method always +// closes the http.Response Body. +func (c SnapshotPolicyClient) responderForSnapshotPoliciesList(resp *http.Response) (result SnapshotPoliciesListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesupdate_autorest.go new file mode 100644 index 00000000000..eea75a1378c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesupdate_autorest.go @@ -0,0 +1,79 @@ +package snapshotpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPoliciesUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// SnapshotPoliciesUpdate ... +func (c SnapshotPolicyClient) SnapshotPoliciesUpdate(ctx context.Context, id SnapshotPoliciesId, input SnapshotPolicyPatch) (result SnapshotPoliciesUpdateOperationResponse, err error) { + req, err := c.preparerForSnapshotPoliciesUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForSnapshotPoliciesUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// SnapshotPoliciesUpdateThenPoll performs SnapshotPoliciesUpdate then polls until it's completed +func (c SnapshotPolicyClient) SnapshotPoliciesUpdateThenPoll(ctx context.Context, id SnapshotPoliciesId, input SnapshotPolicyPatch) error { + result, err := c.SnapshotPoliciesUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing SnapshotPoliciesUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after SnapshotPoliciesUpdate: %+v", err) + } + + return nil +} + +// preparerForSnapshotPoliciesUpdate prepares the SnapshotPoliciesUpdate request. +func (c SnapshotPolicyClient) preparerForSnapshotPoliciesUpdate(ctx context.Context, id SnapshotPoliciesId, input SnapshotPolicyPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForSnapshotPoliciesUpdate sends the SnapshotPoliciesUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c SnapshotPolicyClient) senderForSnapshotPoliciesUpdate(ctx context.Context, req *http.Request) (future SnapshotPoliciesUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_dailyschedule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_dailyschedule.go new file mode 100644 index 00000000000..bdafb72e6e0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_dailyschedule.go @@ -0,0 +1,11 @@ +package snapshotpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DailySchedule struct { + Hour *int64 `json:"hour,omitempty"` + Minute *int64 `json:"minute,omitempty"` + SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` + UsedBytes *int64 `json:"usedBytes,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_hourlyschedule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_hourlyschedule.go new file mode 100644 index 00000000000..a1e5d0fa028 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_hourlyschedule.go @@ -0,0 +1,10 @@ +package snapshotpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HourlySchedule struct { + Minute *int64 `json:"minute,omitempty"` + SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` + UsedBytes *int64 `json:"usedBytes,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_monthlyschedule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_monthlyschedule.go new file mode 100644 index 00000000000..02cbcad6a59 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_monthlyschedule.go @@ -0,0 +1,12 @@ +package snapshotpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonthlySchedule struct { + DaysOfMonth *string `json:"daysOfMonth,omitempty"` + Hour *int64 `json:"hour,omitempty"` + Minute *int64 `json:"minute,omitempty"` + SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` + UsedBytes *int64 `json:"usedBytes,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicieslist.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicieslist.go new file mode 100644 index 00000000000..910e2519adb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicieslist.go @@ -0,0 +1,8 @@ +package snapshotpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPoliciesList struct { + Value *[]SnapshotPolicy `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicy.go new file mode 100644 index 00000000000..310cfaaf1bb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicy.go @@ -0,0 +1,19 @@ +package snapshotpolicy + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPolicy struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties SnapshotPolicyProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicypatch.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicypatch.go new file mode 100644 index 00000000000..76df9be172b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicypatch.go @@ -0,0 +1,13 @@ +package snapshotpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPolicyPatch struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SnapshotPolicyProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicyproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicyproperties.go new file mode 100644 index 00000000000..fb4fb0fcb05 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicyproperties.go @@ -0,0 +1,13 @@ +package snapshotpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPolicyProperties struct { + DailySchedule *DailySchedule `json:"dailySchedule,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + HourlySchedule *HourlySchedule `json:"hourlySchedule,omitempty"` + MonthlySchedule *MonthlySchedule `json:"monthlySchedule,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + WeeklySchedule *WeeklySchedule `json:"weeklySchedule,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_weeklyschedule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_weeklyschedule.go new file mode 100644 index 00000000000..128ece7ef5e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_weeklyschedule.go @@ -0,0 +1,12 @@ +package snapshotpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WeeklySchedule struct { + Day *string `json:"day,omitempty"` + Hour *int64 `json:"hour,omitempty"` + Minute *int64 `json:"minute,omitempty"` + SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` + UsedBytes *int64 `json:"usedBytes,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/version.go new file mode 100644 index 00000000000..00061163a3a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/version.go @@ -0,0 +1,12 @@ +package snapshotpolicy + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/snapshotpolicy/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/README.md new file mode 100644 index 00000000000..e6d357e24b6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots` Documentation + +The `snapshots` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2021-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots" +``` + + +### Client Initialization + +```go +client := snapshots.NewSnapshotsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SnapshotsClient.Create` + +```go +ctx := context.TODO() +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue", "snapshotValue") + +payload := snapshots.Snapshot{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SnapshotsClient.Delete` + +```go +ctx := context.TODO() +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue", "snapshotValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SnapshotsClient.Get` + +```go +ctx := context.TODO() +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue", "snapshotValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SnapshotsClient.List` + +```go +ctx := context.TODO() +id := snapshots.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SnapshotsClient.RestoreFiles` + +```go +ctx := context.TODO() +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue", "snapshotValue") + +payload := snapshots.SnapshotRestoreFiles{ + // ... +} + + +if err := client.RestoreFilesThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SnapshotsClient.Update` + +```go +ctx := context.TODO() +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue", "snapshotValue") +var payload interface{} + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/client.go new file mode 100644 index 00000000000..62d2a132383 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/client.go @@ -0,0 +1,18 @@ +package snapshots + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotsClient struct { + Client autorest.Client + baseUri string +} + +func NewSnapshotsClientWithBaseURI(endpoint string) SnapshotsClient { + return SnapshotsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/id_snapshot.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/id_snapshot.go new file mode 100644 index 00000000000..d38fb8cb8f0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/id_snapshot.go @@ -0,0 +1,163 @@ +package snapshots + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SnapshotId{} + +// SnapshotId is a struct representing the Resource ID for a Snapshot +type SnapshotId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + PoolName string + VolumeName string + SnapshotName string +} + +// NewSnapshotID returns a new SnapshotId struct +func NewSnapshotID(subscriptionId string, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) SnapshotId { + return SnapshotId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + PoolName: poolName, + VolumeName: volumeName, + SnapshotName: snapshotName, + } +} + +// ParseSnapshotID parses 'input' into a SnapshotId +func ParseSnapshotID(input string) (*SnapshotId, error) { + parser := resourceids.NewParserFromResourceIdType(SnapshotId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SnapshotId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { + return nil, fmt.Errorf("the segment 'snapshotName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSnapshotIDInsensitively parses 'input' case-insensitively into a SnapshotId +// note: this method should only be used for API response data and not user input +func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { + parser := resourceids.NewParserFromResourceIdType(SnapshotId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SnapshotId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { + return nil, fmt.Errorf("the segment 'snapshotName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID +func ValidateSnapshotID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSnapshotID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Snapshot ID +func (id SnapshotId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/snapshots/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName, id.VolumeName, id.SnapshotName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Snapshot ID +func (id SnapshotId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), + resourceids.UserSpecifiedSegment("poolName", "poolValue"), + resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), + resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), + resourceids.StaticSegment("staticSnapshots", "snapshots", "snapshots"), + resourceids.UserSpecifiedSegment("snapshotName", "snapshotValue"), + } +} + +// String returns a human-readable description of this Snapshot ID +func (id SnapshotId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Pool Name: %q", id.PoolName), + fmt.Sprintf("Volume Name: %q", id.VolumeName), + fmt.Sprintf("Snapshot Name: %q", id.SnapshotName), + } + return fmt.Sprintf("Snapshot (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/id_volume.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/id_volume.go new file mode 100644 index 00000000000..c5cc73e141c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/id_volume.go @@ -0,0 +1,150 @@ +package snapshots + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VolumeId{} + +// VolumeId is a struct representing the Resource ID for a Volume +type VolumeId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + PoolName string + VolumeName string +} + +// NewVolumeID returns a new VolumeId struct +func NewVolumeID(subscriptionId string, resourceGroupName string, accountName string, poolName string, volumeName string) VolumeId { + return VolumeId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + PoolName: poolName, + VolumeName: volumeName, + } +} + +// ParseVolumeID parses 'input' into a VolumeId +func ParseVolumeID(input string) (*VolumeId, error) { + parser := resourceids.NewParserFromResourceIdType(VolumeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VolumeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVolumeIDInsensitively parses 'input' case-insensitively into a VolumeId +// note: this method should only be used for API response data and not user input +func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { + parser := resourceids.NewParserFromResourceIdType(VolumeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VolumeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVolumeID checks that 'input' can be parsed as a Volume ID +func ValidateVolumeID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVolumeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Volume ID +func (id VolumeId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName, id.VolumeName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Volume ID +func (id VolumeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), + resourceids.UserSpecifiedSegment("poolName", "poolValue"), + resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), + resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), + } +} + +// String returns a human-readable description of this Volume ID +func (id VolumeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Pool Name: %q", id.PoolName), + fmt.Sprintf("Volume Name: %q", id.VolumeName), + } + return fmt.Sprintf("Volume (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_create_autorest.go new file mode 100644 index 00000000000..90b33471ade --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_create_autorest.go @@ -0,0 +1,79 @@ +package snapshots + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c SnapshotsClient) Create(ctx context.Context, id SnapshotId, input Snapshot) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c SnapshotsClient) CreateThenPoll(ctx context.Context, id SnapshotId, input Snapshot) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c SnapshotsClient) preparerForCreate(ctx context.Context, id SnapshotId, input Snapshot) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c SnapshotsClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_delete_autorest.go new file mode 100644 index 00000000000..55f7d9d0796 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_delete_autorest.go @@ -0,0 +1,78 @@ +package snapshots + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c SnapshotsClient) Delete(ctx context.Context, id SnapshotId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c SnapshotsClient) DeleteThenPoll(ctx context.Context, id SnapshotId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c SnapshotsClient) preparerForDelete(ctx context.Context, id SnapshotId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c SnapshotsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_get_autorest.go new file mode 100644 index 00000000000..b328ad1cf52 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_get_autorest.go @@ -0,0 +1,68 @@ +package snapshots + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Snapshot +} + +// Get ... +func (c SnapshotsClient) Get(ctx context.Context, id SnapshotId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c SnapshotsClient) preparerForGet(ctx context.Context, id SnapshotId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c SnapshotsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_list_autorest.go new file mode 100644 index 00000000000..d56a945666b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_list_autorest.go @@ -0,0 +1,69 @@ +package snapshots + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *SnapshotsList +} + +// List ... +func (c SnapshotsClient) List(ctx context.Context, id VolumeId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c SnapshotsClient) preparerForList(ctx context.Context, id VolumeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/snapshots", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c SnapshotsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_restorefiles_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_restorefiles_autorest.go new file mode 100644 index 00000000000..18ef248aa73 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_restorefiles_autorest.go @@ -0,0 +1,79 @@ +package snapshots + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestoreFilesOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// RestoreFiles ... +func (c SnapshotsClient) RestoreFiles(ctx context.Context, id SnapshotId, input SnapshotRestoreFiles) (result RestoreFilesOperationResponse, err error) { + req, err := c.preparerForRestoreFiles(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "RestoreFiles", nil, "Failure preparing request") + return + } + + result, err = c.senderForRestoreFiles(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "RestoreFiles", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// RestoreFilesThenPoll performs RestoreFiles then polls until it's completed +func (c SnapshotsClient) RestoreFilesThenPoll(ctx context.Context, id SnapshotId, input SnapshotRestoreFiles) error { + result, err := c.RestoreFiles(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RestoreFiles: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after RestoreFiles: %+v", err) + } + + return nil +} + +// preparerForRestoreFiles prepares the RestoreFiles request. +func (c SnapshotsClient) preparerForRestoreFiles(ctx context.Context, id SnapshotId, input SnapshotRestoreFiles) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/restoreFiles", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForRestoreFiles sends the RestoreFiles request. The method will close the +// http.Response Body if it receives an error. +func (c SnapshotsClient) senderForRestoreFiles(ctx context.Context, req *http.Request) (future RestoreFilesOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_update_autorest.go new file mode 100644 index 00000000000..f96261c20b0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_update_autorest.go @@ -0,0 +1,79 @@ +package snapshots + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c SnapshotsClient) Update(ctx context.Context, id SnapshotId, input interface{}) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c SnapshotsClient) UpdateThenPoll(ctx context.Context, id SnapshotId, input interface{}) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c SnapshotsClient) preparerForUpdate(ctx context.Context, id SnapshotId, input interface{}) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c SnapshotsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshot.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshot.go new file mode 100644 index 00000000000..996c7160dd1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshot.go @@ -0,0 +1,12 @@ +package snapshots + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Snapshot struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *SnapshotProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotproperties.go new file mode 100644 index 00000000000..fe60537eaaa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotproperties.go @@ -0,0 +1,28 @@ +package snapshots + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotProperties struct { + Created *string `json:"created,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + SnapshotId *string `json:"snapshotId,omitempty"` +} + +func (o *SnapshotProperties) GetCreatedAsTime() (*time.Time, error) { + if o.Created == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") +} + +func (o *SnapshotProperties) SetCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Created = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotrestorefiles.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotrestorefiles.go new file mode 100644 index 00000000000..de80d971dcf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotrestorefiles.go @@ -0,0 +1,9 @@ +package snapshots + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotRestoreFiles struct { + DestinationPath *string `json:"destinationPath,omitempty"` + FilePaths []string `json:"filePaths"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotslist.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotslist.go new file mode 100644 index 00000000000..bf283b0d2ac --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotslist.go @@ -0,0 +1,8 @@ +package snapshots + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotsList struct { + Value *[]Snapshot `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/version.go new file mode 100644 index 00000000000..90179a6f56a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/version.go @@ -0,0 +1,12 @@ +package snapshots + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/snapshots/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/README.md new file mode 100644 index 00000000000..c42f7262724 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes` Documentation + +The `volumes` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2021-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes" +``` + + +### Client Initialization + +```go +client := volumes.NewVolumesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VolumesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +payload := volumes.Volume{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VolumesClient.Delete` + +```go +ctx := context.TODO() +id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +if err := client.DeleteThenPoll(ctx, id, volumes.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VolumesClient.Get` + +```go +ctx := context.TODO() +id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VolumesClient.List` + +```go +ctx := context.TODO() +id := volumes.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VolumesClient.Update` + +```go +ctx := context.TODO() +id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +payload := volumes.VolumePatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/client.go new file mode 100644 index 00000000000..d0a40573bf0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/client.go @@ -0,0 +1,18 @@ +package volumes + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesClient struct { + Client autorest.Client + baseUri string +} + +func NewVolumesClientWithBaseURI(endpoint string) VolumesClient { + return VolumesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/constants.go new file mode 100644 index 00000000000..4c9bed0d63b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/constants.go @@ -0,0 +1,270 @@ +package volumes + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvsDataStore string + +const ( + AvsDataStoreDisabled AvsDataStore = "Disabled" + AvsDataStoreEnabled AvsDataStore = "Enabled" +) + +func PossibleValuesForAvsDataStore() []string { + return []string{ + string(AvsDataStoreDisabled), + string(AvsDataStoreEnabled), + } +} + +func parseAvsDataStore(input string) (*AvsDataStore, error) { + vals := map[string]AvsDataStore{ + "disabled": AvsDataStoreDisabled, + "enabled": AvsDataStoreEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AvsDataStore(input) + return &out, nil +} + +type ChownMode string + +const ( + ChownModeRestricted ChownMode = "Restricted" + ChownModeUnrestricted ChownMode = "Unrestricted" +) + +func PossibleValuesForChownMode() []string { + return []string{ + string(ChownModeRestricted), + string(ChownModeUnrestricted), + } +} + +func parseChownMode(input string) (*ChownMode, error) { + vals := map[string]ChownMode{ + "restricted": ChownModeRestricted, + "unrestricted": ChownModeUnrestricted, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ChownMode(input) + return &out, nil +} + +type EnableSubvolumes string + +const ( + EnableSubvolumesDisabled EnableSubvolumes = "Disabled" + EnableSubvolumesEnabled EnableSubvolumes = "Enabled" +) + +func PossibleValuesForEnableSubvolumes() []string { + return []string{ + string(EnableSubvolumesDisabled), + string(EnableSubvolumesEnabled), + } +} + +func parseEnableSubvolumes(input string) (*EnableSubvolumes, error) { + vals := map[string]EnableSubvolumes{ + "disabled": EnableSubvolumesDisabled, + "enabled": EnableSubvolumesEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnableSubvolumes(input) + return &out, nil +} + +type EndpointType string + +const ( + EndpointTypeDst EndpointType = "dst" + EndpointTypeSrc EndpointType = "src" +) + +func PossibleValuesForEndpointType() []string { + return []string{ + string(EndpointTypeDst), + string(EndpointTypeSrc), + } +} + +func parseEndpointType(input string) (*EndpointType, error) { + vals := map[string]EndpointType{ + "dst": EndpointTypeDst, + "src": EndpointTypeSrc, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EndpointType(input) + return &out, nil +} + +type NetworkFeatures string + +const ( + NetworkFeaturesBasic NetworkFeatures = "Basic" + NetworkFeaturesStandard NetworkFeatures = "Standard" +) + +func PossibleValuesForNetworkFeatures() []string { + return []string{ + string(NetworkFeaturesBasic), + string(NetworkFeaturesStandard), + } +} + +func parseNetworkFeatures(input string) (*NetworkFeatures, error) { + vals := map[string]NetworkFeatures{ + "basic": NetworkFeaturesBasic, + "standard": NetworkFeaturesStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkFeatures(input) + return &out, nil +} + +type ReplicationSchedule string + +const ( + ReplicationScheduleDaily ReplicationSchedule = "daily" + ReplicationScheduleHourly ReplicationSchedule = "hourly" + ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" +) + +func PossibleValuesForReplicationSchedule() []string { + return []string{ + string(ReplicationScheduleDaily), + string(ReplicationScheduleHourly), + string(ReplicationScheduleOneZerominutely), + } +} + +func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { + vals := map[string]ReplicationSchedule{ + "daily": ReplicationScheduleDaily, + "hourly": ReplicationScheduleHourly, + "_10minutely": ReplicationScheduleOneZerominutely, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ReplicationSchedule(input) + return &out, nil +} + +type SecurityStyle string + +const ( + SecurityStyleNtfs SecurityStyle = "ntfs" + SecurityStyleUnix SecurityStyle = "unix" +) + +func PossibleValuesForSecurityStyle() []string { + return []string{ + string(SecurityStyleNtfs), + string(SecurityStyleUnix), + } +} + +func parseSecurityStyle(input string) (*SecurityStyle, error) { + vals := map[string]SecurityStyle{ + "ntfs": SecurityStyleNtfs, + "unix": SecurityStyleUnix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityStyle(input) + return &out, nil +} + +type ServiceLevel string + +const ( + ServiceLevelPremium ServiceLevel = "Premium" + ServiceLevelStandard ServiceLevel = "Standard" + ServiceLevelStandardZRS ServiceLevel = "StandardZRS" + ServiceLevelUltra ServiceLevel = "Ultra" +) + +func PossibleValuesForServiceLevel() []string { + return []string{ + string(ServiceLevelPremium), + string(ServiceLevelStandard), + string(ServiceLevelStandardZRS), + string(ServiceLevelUltra), + } +} + +func parseServiceLevel(input string) (*ServiceLevel, error) { + vals := map[string]ServiceLevel{ + "premium": ServiceLevelPremium, + "standard": ServiceLevelStandard, + "standardzrs": ServiceLevelStandardZRS, + "ultra": ServiceLevelUltra, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServiceLevel(input) + return &out, nil +} + +type VolumeStorageToNetworkProximity string + +const ( + VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" + VolumeStorageToNetworkProximityTOne VolumeStorageToNetworkProximity = "T1" + VolumeStorageToNetworkProximityTTwo VolumeStorageToNetworkProximity = "T2" +) + +func PossibleValuesForVolumeStorageToNetworkProximity() []string { + return []string{ + string(VolumeStorageToNetworkProximityDefault), + string(VolumeStorageToNetworkProximityTOne), + string(VolumeStorageToNetworkProximityTTwo), + } +} + +func parseVolumeStorageToNetworkProximity(input string) (*VolumeStorageToNetworkProximity, error) { + vals := map[string]VolumeStorageToNetworkProximity{ + "default": VolumeStorageToNetworkProximityDefault, + "t1": VolumeStorageToNetworkProximityTOne, + "t2": VolumeStorageToNetworkProximityTTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VolumeStorageToNetworkProximity(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/id_capacitypool.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/id_capacitypool.go new file mode 100644 index 00000000000..06f8b4531bd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/id_capacitypool.go @@ -0,0 +1,137 @@ +package volumes + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = CapacityPoolId{} + +// CapacityPoolId is a struct representing the Resource ID for a Capacity Pool +type CapacityPoolId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + PoolName string +} + +// NewCapacityPoolID returns a new CapacityPoolId struct +func NewCapacityPoolID(subscriptionId string, resourceGroupName string, accountName string, poolName string) CapacityPoolId { + return CapacityPoolId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + PoolName: poolName, + } +} + +// ParseCapacityPoolID parses 'input' into a CapacityPoolId +func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CapacityPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseCapacityPoolIDInsensitively parses 'input' case-insensitively into a CapacityPoolId +// note: this method should only be used for API response data and not user input +func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CapacityPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID +func ValidateCapacityPoolID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCapacityPoolID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Capacity Pool ID +func (id CapacityPoolId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Capacity Pool ID +func (id CapacityPoolId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), + resourceids.UserSpecifiedSegment("poolName", "poolValue"), + } +} + +// String returns a human-readable description of this Capacity Pool ID +func (id CapacityPoolId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Pool Name: %q", id.PoolName), + } + return fmt.Sprintf("Capacity Pool (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/id_volume.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/id_volume.go new file mode 100644 index 00000000000..d4e93b387a4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/id_volume.go @@ -0,0 +1,150 @@ +package volumes + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VolumeId{} + +// VolumeId is a struct representing the Resource ID for a Volume +type VolumeId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + PoolName string + VolumeName string +} + +// NewVolumeID returns a new VolumeId struct +func NewVolumeID(subscriptionId string, resourceGroupName string, accountName string, poolName string, volumeName string) VolumeId { + return VolumeId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + PoolName: poolName, + VolumeName: volumeName, + } +} + +// ParseVolumeID parses 'input' into a VolumeId +func ParseVolumeID(input string) (*VolumeId, error) { + parser := resourceids.NewParserFromResourceIdType(VolumeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VolumeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVolumeIDInsensitively parses 'input' case-insensitively into a VolumeId +// note: this method should only be used for API response data and not user input +func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { + parser := resourceids.NewParserFromResourceIdType(VolumeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VolumeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVolumeID checks that 'input' can be parsed as a Volume ID +func ValidateVolumeID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVolumeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Volume ID +func (id VolumeId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName, id.VolumeName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Volume ID +func (id VolumeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), + resourceids.UserSpecifiedSegment("poolName", "poolValue"), + resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), + resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), + } +} + +// String returns a human-readable description of this Volume ID +func (id VolumeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Pool Name: %q", id.PoolName), + fmt.Sprintf("Volume Name: %q", id.VolumeName), + } + return fmt.Sprintf("Volume (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_createorupdate_autorest.go new file mode 100644 index 00000000000..ae61c0fe91e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package volumes + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c VolumesClient) CreateOrUpdate(ctx context.Context, id VolumeId, input Volume) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VolumesClient) CreateOrUpdateThenPoll(ctx context.Context, id VolumeId, input Volume) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c VolumesClient) preparerForCreateOrUpdate(ctx context.Context, id VolumeId, input Volume) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_delete_autorest.go new file mode 100644 index 00000000000..1b97fdf87ab --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_delete_autorest.go @@ -0,0 +1,107 @@ +package volumes + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + ForceDelete *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.ForceDelete != nil { + out["forceDelete"] = *o.ForceDelete + } + + return out +} + +// Delete ... +func (c VolumesClient) Delete(ctx context.Context, id VolumeId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VolumesClient) DeleteThenPoll(ctx context.Context, id VolumeId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c VolumesClient) preparerForDelete(ctx context.Context, id VolumeId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_get_autorest.go new file mode 100644 index 00000000000..af7454ba5c5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_get_autorest.go @@ -0,0 +1,68 @@ +package volumes + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Volume +} + +// Get ... +func (c VolumesClient) Get(ctx context.Context, id VolumeId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c VolumesClient) preparerForGet(ctx context.Context, id VolumeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c VolumesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_list_autorest.go new file mode 100644 index 00000000000..967b2394068 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_list_autorest.go @@ -0,0 +1,186 @@ +package volumes + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Volume + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Volume +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c VolumesClient) List(ctx context.Context, id CapacityPoolId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c VolumesClient) preparerForList(ctx context.Context, id CapacityPoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/volumes", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c VolumesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c VolumesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Volume `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c VolumesClient) ListComplete(ctx context.Context, id CapacityPoolId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, VolumeOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c VolumesClient) ListCompleteMatchingPredicate(ctx context.Context, id CapacityPoolId, predicate VolumeOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Volume, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_update_autorest.go new file mode 100644 index 00000000000..7e6872e1513 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_update_autorest.go @@ -0,0 +1,79 @@ +package volumes + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c VolumesClient) Update(ctx context.Context, id VolumeId, input VolumePatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c VolumesClient) UpdateThenPoll(ctx context.Context, id VolumeId, input VolumePatch) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c VolumesClient) preparerForUpdate(ctx context.Context, id VolumeId, input VolumePatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_exportpolicyrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_exportpolicyrule.go new file mode 100644 index 00000000000..9b059c74757 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_exportpolicyrule.go @@ -0,0 +1,22 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportPolicyRule struct { + AllowedClients *string `json:"allowedClients,omitempty"` + ChownMode *ChownMode `json:"chownMode,omitempty"` + Cifs *bool `json:"cifs,omitempty"` + HasRootAccess *bool `json:"hasRootAccess,omitempty"` + Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` + Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` + Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` + Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` + Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` + Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` + Nfsv3 *bool `json:"nfsv3,omitempty"` + Nfsv41 *bool `json:"nfsv41,omitempty"` + RuleIndex *int64 `json:"ruleIndex,omitempty"` + UnixReadOnly *bool `json:"unixReadOnly,omitempty"` + UnixReadWrite *bool `json:"unixReadWrite,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_mounttargetproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_mounttargetproperties.go new file mode 100644 index 00000000000..7f5c238183c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_mounttargetproperties.go @@ -0,0 +1,11 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MountTargetProperties struct { + FileSystemId string `json:"fileSystemId"` + IPAddress *string `json:"ipAddress,omitempty"` + MountTargetId *string `json:"mountTargetId,omitempty"` + SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_placementkeyvaluepairs.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_placementkeyvaluepairs.go new file mode 100644 index 00000000000..588e9729c1e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_placementkeyvaluepairs.go @@ -0,0 +1,9 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PlacementKeyValuePairs struct { + Key string `json:"key"` + Value string `json:"value"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_replicationobject.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_replicationobject.go new file mode 100644 index 00000000000..b7d6873811e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_replicationobject.go @@ -0,0 +1,12 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReplicationObject struct { + EndpointType *EndpointType `json:"endpointType,omitempty"` + RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` + RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` + ReplicationId *string `json:"replicationId,omitempty"` + ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volume.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volume.go new file mode 100644 index 00000000000..f92955c95e9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volume.go @@ -0,0 +1,19 @@ +package volumes + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Volume struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties VolumeProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumebackupproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumebackupproperties.go new file mode 100644 index 00000000000..1de25f15e33 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumebackupproperties.go @@ -0,0 +1,11 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumeBackupProperties struct { + BackupEnabled *bool `json:"backupEnabled,omitempty"` + BackupPolicyId *string `json:"backupPolicyId,omitempty"` + PolicyEnforced *bool `json:"policyEnforced,omitempty"` + VaultId *string `json:"vaultId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatch.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatch.go new file mode 100644 index 00000000000..b39ea01aee8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatch.go @@ -0,0 +1,13 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumePatch struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VolumePatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchproperties.go new file mode 100644 index 00000000000..ed4479ca252 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchproperties.go @@ -0,0 +1,16 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumePatchProperties struct { + DataProtection *VolumePatchPropertiesDataProtection `json:"dataProtection,omitempty"` + DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` + DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` + ExportPolicy *VolumePatchPropertiesExportPolicy `json:"exportPolicy,omitempty"` + IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` + ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` + ThroughputMibps *float64 `json:"throughputMibps,omitempty"` + UnixPermissions *string `json:"unixPermissions,omitempty"` + UsageThreshold *int64 `json:"usageThreshold,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchpropertiesdataprotection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchpropertiesdataprotection.go new file mode 100644 index 00000000000..8c9edc10ff7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchpropertiesdataprotection.go @@ -0,0 +1,9 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumePatchPropertiesDataProtection struct { + Backup *VolumeBackupProperties `json:"backup,omitempty"` + Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchpropertiesexportpolicy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchpropertiesexportpolicy.go new file mode 100644 index 00000000000..ae83a5fc1b4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchpropertiesexportpolicy.go @@ -0,0 +1,8 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumePatchPropertiesExportPolicy struct { + Rules *[]ExportPolicyRule `json:"rules,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumeproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumeproperties.go new file mode 100644 index 00000000000..6ae23e00b8d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumeproperties.go @@ -0,0 +1,49 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumeProperties struct { + AvsDataStore *AvsDataStore `json:"avsDataStore,omitempty"` + BackupId *string `json:"backupId,omitempty"` + BaremetalTenantId *string `json:"baremetalTenantId,omitempty"` + CapacityPoolResourceId *string `json:"capacityPoolResourceId,omitempty"` + CloneProgress *int64 `json:"cloneProgress,omitempty"` + CoolAccess *bool `json:"coolAccess,omitempty"` + CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` + CreationToken string `json:"creationToken"` + DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` + DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` + DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` + EnableSubvolumes *EnableSubvolumes `json:"enableSubvolumes,omitempty"` + EncryptionKeySource *string `json:"encryptionKeySource,omitempty"` + ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` + FileSystemId *string `json:"fileSystemId,omitempty"` + IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` + IsRestoring *bool `json:"isRestoring,omitempty"` + KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` + LdapEnabled *bool `json:"ldapEnabled,omitempty"` + MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` + MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` + NetworkFeatures *NetworkFeatures `json:"networkFeatures,omitempty"` + NetworkSiblingSetId *string `json:"networkSiblingSetId,omitempty"` + PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` + ProtocolTypes *[]string `json:"protocolTypes,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` + SecurityStyle *SecurityStyle `json:"securityStyle,omitempty"` + ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` + SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` + SmbEncryption *bool `json:"smbEncryption,omitempty"` + SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` + SnapshotId *string `json:"snapshotId,omitempty"` + StorageToNetworkProximity *VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` + SubnetId string `json:"subnetId"` + T2Network *string `json:"t2Network,omitempty"` + ThroughputMibps *float64 `json:"throughputMibps,omitempty"` + UnixPermissions *string `json:"unixPermissions,omitempty"` + UsageThreshold int64 `json:"usageThreshold"` + VolumeGroupName *string `json:"volumeGroupName,omitempty"` + VolumeSpecName *string `json:"volumeSpecName,omitempty"` + VolumeType *string `json:"volumeType,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepropertiesdataprotection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepropertiesdataprotection.go new file mode 100644 index 00000000000..28163c70a51 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepropertiesdataprotection.go @@ -0,0 +1,10 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumePropertiesDataProtection struct { + Backup *VolumeBackupProperties `json:"backup,omitempty"` + Replication *ReplicationObject `json:"replication,omitempty"` + Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepropertiesexportpolicy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepropertiesexportpolicy.go new file mode 100644 index 00000000000..fda5f4739de --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepropertiesexportpolicy.go @@ -0,0 +1,8 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumePropertiesExportPolicy struct { + Rules *[]ExportPolicyRule `json:"rules,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumesnapshotproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumesnapshotproperties.go new file mode 100644 index 00000000000..48aba2acce0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumesnapshotproperties.go @@ -0,0 +1,8 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumeSnapshotProperties struct { + SnapshotPolicyId *string `json:"snapshotPolicyId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/predicates.go new file mode 100644 index 00000000000..536d6a70dc8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/predicates.go @@ -0,0 +1,34 @@ +package volumes + +type VolumeOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p VolumeOperationPredicate) Matches(input Volume) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/version.go new file mode 100644 index 00000000000..55ac8a54fde --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/version.go @@ -0,0 +1,12 @@ +package volumes + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/volumes/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/README.md new file mode 100644 index 00000000000..037bd15af1b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/README.md @@ -0,0 +1,106 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication` Documentation + +The `volumesreplication` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2021-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication" +``` + + +### Client Initialization + +```go +client := volumesreplication.NewVolumesReplicationClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VolumesReplicationClient.VolumesAuthorizeReplication` + +```go +ctx := context.TODO() +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +payload := volumesreplication.AuthorizeRequest{ + // ... +} + + +if err := client.VolumesAuthorizeReplicationThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VolumesReplicationClient.VolumesBreakReplication` + +```go +ctx := context.TODO() +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +payload := volumesreplication.BreakReplicationRequest{ + // ... +} + + +if err := client.VolumesBreakReplicationThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VolumesReplicationClient.VolumesDeleteReplication` + +```go +ctx := context.TODO() +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +if err := client.VolumesDeleteReplicationThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VolumesReplicationClient.VolumesReInitializeReplication` + +```go +ctx := context.TODO() +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +if err := client.VolumesReInitializeReplicationThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VolumesReplicationClient.VolumesReplicationStatus` + +```go +ctx := context.TODO() +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +read, err := client.VolumesReplicationStatus(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VolumesReplicationClient.VolumesResyncReplication` + +```go +ctx := context.TODO() +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +if err := client.VolumesResyncReplicationThenPoll(ctx, id); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/client.go new file mode 100644 index 00000000000..64a4d559d37 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/client.go @@ -0,0 +1,18 @@ +package volumesreplication + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesReplicationClient struct { + Client autorest.Client + baseUri string +} + +func NewVolumesReplicationClientWithBaseURI(endpoint string) VolumesReplicationClient { + return VolumesReplicationClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/constants.go new file mode 100644 index 00000000000..6b67c17d588 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/constants.go @@ -0,0 +1,65 @@ +package volumesreplication + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MirrorState string + +const ( + MirrorStateBroken MirrorState = "Broken" + MirrorStateMirrored MirrorState = "Mirrored" + MirrorStateUninitialized MirrorState = "Uninitialized" +) + +func PossibleValuesForMirrorState() []string { + return []string{ + string(MirrorStateBroken), + string(MirrorStateMirrored), + string(MirrorStateUninitialized), + } +} + +func parseMirrorState(input string) (*MirrorState, error) { + vals := map[string]MirrorState{ + "broken": MirrorStateBroken, + "mirrored": MirrorStateMirrored, + "uninitialized": MirrorStateUninitialized, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MirrorState(input) + return &out, nil +} + +type RelationshipStatus string + +const ( + RelationshipStatusIdle RelationshipStatus = "Idle" + RelationshipStatusTransferring RelationshipStatus = "Transferring" +) + +func PossibleValuesForRelationshipStatus() []string { + return []string{ + string(RelationshipStatusIdle), + string(RelationshipStatusTransferring), + } +} + +func parseRelationshipStatus(input string) (*RelationshipStatus, error) { + vals := map[string]RelationshipStatus{ + "idle": RelationshipStatusIdle, + "transferring": RelationshipStatusTransferring, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RelationshipStatus(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/id_volume.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/id_volume.go new file mode 100644 index 00000000000..c88adaf9858 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/id_volume.go @@ -0,0 +1,150 @@ +package volumesreplication + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VolumeId{} + +// VolumeId is a struct representing the Resource ID for a Volume +type VolumeId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + PoolName string + VolumeName string +} + +// NewVolumeID returns a new VolumeId struct +func NewVolumeID(subscriptionId string, resourceGroupName string, accountName string, poolName string, volumeName string) VolumeId { + return VolumeId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + PoolName: poolName, + VolumeName: volumeName, + } +} + +// ParseVolumeID parses 'input' into a VolumeId +func ParseVolumeID(input string) (*VolumeId, error) { + parser := resourceids.NewParserFromResourceIdType(VolumeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VolumeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVolumeIDInsensitively parses 'input' case-insensitively into a VolumeId +// note: this method should only be used for API response data and not user input +func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { + parser := resourceids.NewParserFromResourceIdType(VolumeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VolumeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVolumeID checks that 'input' can be parsed as a Volume ID +func ValidateVolumeID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVolumeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Volume ID +func (id VolumeId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName, id.VolumeName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Volume ID +func (id VolumeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), + resourceids.UserSpecifiedSegment("poolName", "poolValue"), + resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), + resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), + } +} + +// String returns a human-readable description of this Volume ID +func (id VolumeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Pool Name: %q", id.PoolName), + fmt.Sprintf("Volume Name: %q", id.VolumeName), + } + return fmt.Sprintf("Volume (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesauthorizereplication_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesauthorizereplication_autorest.go new file mode 100644 index 00000000000..76b9f035e73 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesauthorizereplication_autorest.go @@ -0,0 +1,79 @@ +package volumesreplication + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesAuthorizeReplicationOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// VolumesAuthorizeReplication ... +func (c VolumesReplicationClient) VolumesAuthorizeReplication(ctx context.Context, id VolumeId, input AuthorizeRequest) (result VolumesAuthorizeReplicationOperationResponse, err error) { + req, err := c.preparerForVolumesAuthorizeReplication(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesAuthorizeReplication", nil, "Failure preparing request") + return + } + + result, err = c.senderForVolumesAuthorizeReplication(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesAuthorizeReplication", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// VolumesAuthorizeReplicationThenPoll performs VolumesAuthorizeReplication then polls until it's completed +func (c VolumesReplicationClient) VolumesAuthorizeReplicationThenPoll(ctx context.Context, id VolumeId, input AuthorizeRequest) error { + result, err := c.VolumesAuthorizeReplication(ctx, id, input) + if err != nil { + return fmt.Errorf("performing VolumesAuthorizeReplication: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after VolumesAuthorizeReplication: %+v", err) + } + + return nil +} + +// preparerForVolumesAuthorizeReplication prepares the VolumesAuthorizeReplication request. +func (c VolumesReplicationClient) preparerForVolumesAuthorizeReplication(ctx context.Context, id VolumeId, input AuthorizeRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/authorizeReplication", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForVolumesAuthorizeReplication sends the VolumesAuthorizeReplication request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesReplicationClient) senderForVolumesAuthorizeReplication(ctx context.Context, req *http.Request) (future VolumesAuthorizeReplicationOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesbreakreplication_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesbreakreplication_autorest.go new file mode 100644 index 00000000000..2d1739198e3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesbreakreplication_autorest.go @@ -0,0 +1,79 @@ +package volumesreplication + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesBreakReplicationOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// VolumesBreakReplication ... +func (c VolumesReplicationClient) VolumesBreakReplication(ctx context.Context, id VolumeId, input BreakReplicationRequest) (result VolumesBreakReplicationOperationResponse, err error) { + req, err := c.preparerForVolumesBreakReplication(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesBreakReplication", nil, "Failure preparing request") + return + } + + result, err = c.senderForVolumesBreakReplication(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesBreakReplication", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// VolumesBreakReplicationThenPoll performs VolumesBreakReplication then polls until it's completed +func (c VolumesReplicationClient) VolumesBreakReplicationThenPoll(ctx context.Context, id VolumeId, input BreakReplicationRequest) error { + result, err := c.VolumesBreakReplication(ctx, id, input) + if err != nil { + return fmt.Errorf("performing VolumesBreakReplication: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after VolumesBreakReplication: %+v", err) + } + + return nil +} + +// preparerForVolumesBreakReplication prepares the VolumesBreakReplication request. +func (c VolumesReplicationClient) preparerForVolumesBreakReplication(ctx context.Context, id VolumeId, input BreakReplicationRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/breakReplication", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForVolumesBreakReplication sends the VolumesBreakReplication request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesReplicationClient) senderForVolumesBreakReplication(ctx context.Context, req *http.Request) (future VolumesBreakReplicationOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesdeletereplication_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesdeletereplication_autorest.go new file mode 100644 index 00000000000..6dd32453b2d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesdeletereplication_autorest.go @@ -0,0 +1,78 @@ +package volumesreplication + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesDeleteReplicationOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// VolumesDeleteReplication ... +func (c VolumesReplicationClient) VolumesDeleteReplication(ctx context.Context, id VolumeId) (result VolumesDeleteReplicationOperationResponse, err error) { + req, err := c.preparerForVolumesDeleteReplication(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesDeleteReplication", nil, "Failure preparing request") + return + } + + result, err = c.senderForVolumesDeleteReplication(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesDeleteReplication", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// VolumesDeleteReplicationThenPoll performs VolumesDeleteReplication then polls until it's completed +func (c VolumesReplicationClient) VolumesDeleteReplicationThenPoll(ctx context.Context, id VolumeId) error { + result, err := c.VolumesDeleteReplication(ctx, id) + if err != nil { + return fmt.Errorf("performing VolumesDeleteReplication: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after VolumesDeleteReplication: %+v", err) + } + + return nil +} + +// preparerForVolumesDeleteReplication prepares the VolumesDeleteReplication request. +func (c VolumesReplicationClient) preparerForVolumesDeleteReplication(ctx context.Context, id VolumeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/deleteReplication", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForVolumesDeleteReplication sends the VolumesDeleteReplication request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesReplicationClient) senderForVolumesDeleteReplication(ctx context.Context, req *http.Request) (future VolumesDeleteReplicationOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesreinitializereplication_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesreinitializereplication_autorest.go new file mode 100644 index 00000000000..f894605753f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesreinitializereplication_autorest.go @@ -0,0 +1,78 @@ +package volumesreplication + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesReInitializeReplicationOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// VolumesReInitializeReplication ... +func (c VolumesReplicationClient) VolumesReInitializeReplication(ctx context.Context, id VolumeId) (result VolumesReInitializeReplicationOperationResponse, err error) { + req, err := c.preparerForVolumesReInitializeReplication(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesReInitializeReplication", nil, "Failure preparing request") + return + } + + result, err = c.senderForVolumesReInitializeReplication(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesReInitializeReplication", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// VolumesReInitializeReplicationThenPoll performs VolumesReInitializeReplication then polls until it's completed +func (c VolumesReplicationClient) VolumesReInitializeReplicationThenPoll(ctx context.Context, id VolumeId) error { + result, err := c.VolumesReInitializeReplication(ctx, id) + if err != nil { + return fmt.Errorf("performing VolumesReInitializeReplication: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after VolumesReInitializeReplication: %+v", err) + } + + return nil +} + +// preparerForVolumesReInitializeReplication prepares the VolumesReInitializeReplication request. +func (c VolumesReplicationClient) preparerForVolumesReInitializeReplication(ctx context.Context, id VolumeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/reinitializeReplication", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForVolumesReInitializeReplication sends the VolumesReInitializeReplication request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesReplicationClient) senderForVolumesReInitializeReplication(ctx context.Context, req *http.Request) (future VolumesReInitializeReplicationOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesreplicationstatus_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesreplicationstatus_autorest.go new file mode 100644 index 00000000000..dfd5d975c24 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesreplicationstatus_autorest.go @@ -0,0 +1,69 @@ +package volumesreplication + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesReplicationStatusOperationResponse struct { + HttpResponse *http.Response + Model *ReplicationStatus +} + +// VolumesReplicationStatus ... +func (c VolumesReplicationClient) VolumesReplicationStatus(ctx context.Context, id VolumeId) (result VolumesReplicationStatusOperationResponse, err error) { + req, err := c.preparerForVolumesReplicationStatus(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesReplicationStatus", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesReplicationStatus", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForVolumesReplicationStatus(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesReplicationStatus", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForVolumesReplicationStatus prepares the VolumesReplicationStatus request. +func (c VolumesReplicationClient) preparerForVolumesReplicationStatus(ctx context.Context, id VolumeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/replicationStatus", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForVolumesReplicationStatus handles the response to the VolumesReplicationStatus request. The method always +// closes the http.Response Body. +func (c VolumesReplicationClient) responderForVolumesReplicationStatus(resp *http.Response) (result VolumesReplicationStatusOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesresyncreplication_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesresyncreplication_autorest.go new file mode 100644 index 00000000000..05f303966fa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesresyncreplication_autorest.go @@ -0,0 +1,78 @@ +package volumesreplication + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesResyncReplicationOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// VolumesResyncReplication ... +func (c VolumesReplicationClient) VolumesResyncReplication(ctx context.Context, id VolumeId) (result VolumesResyncReplicationOperationResponse, err error) { + req, err := c.preparerForVolumesResyncReplication(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesResyncReplication", nil, "Failure preparing request") + return + } + + result, err = c.senderForVolumesResyncReplication(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesResyncReplication", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// VolumesResyncReplicationThenPoll performs VolumesResyncReplication then polls until it's completed +func (c VolumesReplicationClient) VolumesResyncReplicationThenPoll(ctx context.Context, id VolumeId) error { + result, err := c.VolumesResyncReplication(ctx, id) + if err != nil { + return fmt.Errorf("performing VolumesResyncReplication: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after VolumesResyncReplication: %+v", err) + } + + return nil +} + +// preparerForVolumesResyncReplication prepares the VolumesResyncReplication request. +func (c VolumesReplicationClient) preparerForVolumesResyncReplication(ctx context.Context, id VolumeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/resyncReplication", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForVolumesResyncReplication sends the VolumesResyncReplication request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesReplicationClient) senderForVolumesResyncReplication(ctx context.Context, req *http.Request) (future VolumesResyncReplicationOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_authorizerequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_authorizerequest.go new file mode 100644 index 00000000000..ff1cefa31ef --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_authorizerequest.go @@ -0,0 +1,8 @@ +package volumesreplication + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizeRequest struct { + RemoteVolumeResourceId *string `json:"remoteVolumeResourceId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_breakreplicationrequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_breakreplicationrequest.go new file mode 100644 index 00000000000..b6a0a179a9c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_breakreplicationrequest.go @@ -0,0 +1,8 @@ +package volumesreplication + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BreakReplicationRequest struct { + ForceBreakReplication *bool `json:"forceBreakReplication,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_replicationstatus.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_replicationstatus.go new file mode 100644 index 00000000000..2a79dddf7a4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_replicationstatus.go @@ -0,0 +1,12 @@ +package volumesreplication + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReplicationStatus struct { + ErrorMessage *string `json:"errorMessage,omitempty"` + Healthy *bool `json:"healthy,omitempty"` + MirrorState *MirrorState `json:"mirrorState,omitempty"` + RelationshipStatus *RelationshipStatus `json:"relationshipStatus,omitempty"` + TotalProgress *string `json:"totalProgress,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/version.go new file mode 100644 index 00000000000..5a6266022a2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/version.go @@ -0,0 +1,12 @@ +package volumesreplication + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/volumesreplication/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/README.md new file mode 100644 index 00000000000..cfdfd61f2fd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/README.md @@ -0,0 +1,252 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces` Documentation + +The `namespaces` SDK allows for interaction with the Azure Resource Manager Service `notificationhubs` (API Version `2017-04-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces" +``` + + +### Client Initialization + +```go +client := namespaces.NewNamespacesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NamespacesClient.CheckAvailability` + +```go +ctx := context.TODO() +id := namespaces.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := namespaces.CheckAvailabilityParameters{ + // ... +} + + +read, err := client.CheckAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +payload := namespaces.NamespaceCreateOrUpdateParameters{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.CreateOrUpdateAuthorizationRule` + +```go +ctx := context.TODO() +id := namespaces.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +payload := namespaces.SharedAccessAuthorizationRuleCreateOrUpdateParameters{ + // ... +} + + +read, err := client.CreateOrUpdateAuthorizationRule(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.Delete` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `NamespacesClient.DeleteAuthorizationRule` + +```go +ctx := context.TODO() +id := namespaces.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +read, err := client.DeleteAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.Get` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.GetAuthorizationRule` + +```go +ctx := context.TODO() +id := namespaces.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +read, err := client.GetAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.List` + +```go +ctx := context.TODO() +id := namespaces.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NamespacesClient.ListAll` + +```go +ctx := context.TODO() +id := namespaces.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListAll(ctx, id)` can be used to do batched pagination +items, err := client.ListAllComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NamespacesClient.ListAuthorizationRules` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +// alternatively `client.ListAuthorizationRules(ctx, id)` can be used to do batched pagination +items, err := client.ListAuthorizationRulesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NamespacesClient.ListKeys` + +```go +ctx := context.TODO() +id := namespaces.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +read, err := client.ListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.Patch` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +payload := namespaces.NamespacePatchParameters{ + // ... +} + + +read, err := client.Patch(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.RegenerateKeys` + +```go +ctx := context.TODO() +id := namespaces.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +payload := namespaces.PolicykeyResource{ + // ... +} + + +read, err := client.RegenerateKeys(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/client.go new file mode 100644 index 00000000000..bf25155c419 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/client.go @@ -0,0 +1,18 @@ +package namespaces + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesClient struct { + Client autorest.Client + baseUri string +} + +func NewNamespacesClientWithBaseURI(endpoint string) NamespacesClient { + return NamespacesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/constants.go new file mode 100644 index 00000000000..c9c77c772ad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/constants.go @@ -0,0 +1,96 @@ +package namespaces + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessRights string + +const ( + AccessRightsListen AccessRights = "Listen" + AccessRightsManage AccessRights = "Manage" + AccessRightsSend AccessRights = "Send" +) + +func PossibleValuesForAccessRights() []string { + return []string{ + string(AccessRightsListen), + string(AccessRightsManage), + string(AccessRightsSend), + } +} + +func parseAccessRights(input string) (*AccessRights, error) { + vals := map[string]AccessRights{ + "listen": AccessRightsListen, + "manage": AccessRightsManage, + "send": AccessRightsSend, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessRights(input) + return &out, nil +} + +type NamespaceType string + +const ( + NamespaceTypeMessaging NamespaceType = "Messaging" + NamespaceTypeNotificationHub NamespaceType = "NotificationHub" +) + +func PossibleValuesForNamespaceType() []string { + return []string{ + string(NamespaceTypeMessaging), + string(NamespaceTypeNotificationHub), + } +} + +func parseNamespaceType(input string) (*NamespaceType, error) { + vals := map[string]NamespaceType{ + "messaging": NamespaceTypeMessaging, + "notificationhub": NamespaceTypeNotificationHub, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NamespaceType(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameBasic SkuName = "Basic" + SkuNameFree SkuName = "Free" + SkuNameStandard SkuName = "Standard" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameBasic), + string(SkuNameFree), + string(SkuNameStandard), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "basic": SkuNameBasic, + "free": SkuNameFree, + "standard": SkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/id_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/id_authorizationrule.go new file mode 100644 index 00000000000..54c98314ba7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/id_authorizationrule.go @@ -0,0 +1,137 @@ +package namespaces + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AuthorizationRuleId{} + +// AuthorizationRuleId is a struct representing the Resource ID for a Authorization Rule +type AuthorizationRuleId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + AuthorizationRuleName string +} + +// NewAuthorizationRuleID returns a new AuthorizationRuleId struct +func NewAuthorizationRuleID(subscriptionId string, resourceGroupName string, namespaceName string, authorizationRuleName string) AuthorizationRuleId { + return AuthorizationRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + AuthorizationRuleName: authorizationRuleName, + } +} + +// ParseAuthorizationRuleID parses 'input' into a AuthorizationRuleId +func ParseAuthorizationRuleID(input string) (*AuthorizationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(AuthorizationRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AuthorizationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAuthorizationRuleIDInsensitively parses 'input' case-insensitively into a AuthorizationRuleId +// note: this method should only be used for API response data and not user input +func ParseAuthorizationRuleIDInsensitively(input string) (*AuthorizationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(AuthorizationRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AuthorizationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAuthorizationRuleID checks that 'input' can be parsed as a Authorization Rule ID +func ValidateAuthorizationRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAuthorizationRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Authorization Rule ID +func (id AuthorizationRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NotificationHubs/namespaces/%s/authorizationRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.AuthorizationRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Authorization Rule ID +func (id AuthorizationRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNotificationHubs", "Microsoft.NotificationHubs", "Microsoft.NotificationHubs"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticAuthorizationRules", "authorizationRules", "authorizationRules"), + resourceids.UserSpecifiedSegment("authorizationRuleName", "authorizationRuleValue"), + } +} + +// String returns a human-readable description of this Authorization Rule ID +func (id AuthorizationRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Authorization Rule Name: %q", id.AuthorizationRuleName), + } + return fmt.Sprintf("Authorization Rule (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/id_namespace.go new file mode 100644 index 00000000000..965b6aa0498 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/id_namespace.go @@ -0,0 +1,124 @@ +package namespaces + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NamespaceId{} + +// NamespaceId is a struct representing the Resource ID for a Namespace +type NamespaceId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string +} + +// NewNamespaceID returns a new NamespaceId struct +func NewNamespaceID(subscriptionId string, resourceGroupName string, namespaceName string) NamespaceId { + return NamespaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + } +} + +// ParseNamespaceID parses 'input' into a NamespaceId +func ParseNamespaceID(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNamespaceIDInsensitively parses 'input' case-insensitively into a NamespaceId +// note: this method should only be used for API response data and not user input +func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID +func ValidateNamespaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNamespaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Namespace ID +func (id NamespaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NotificationHubs/namespaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Namespace ID +func (id NamespaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNotificationHubs", "Microsoft.NotificationHubs", "Microsoft.NotificationHubs"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + } +} + +// String returns a human-readable description of this Namespace ID +func (id NamespaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + } + return fmt.Sprintf("Namespace (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_checkavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_checkavailability_autorest.go new file mode 100644 index 00000000000..d14b13e4992 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_checkavailability_autorest.go @@ -0,0 +1,71 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckAvailabilityResult +} + +// CheckAvailability ... +func (c NamespacesClient) CheckAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckAvailabilityParameters) (result CheckAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CheckAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CheckAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CheckAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckAvailability prepares the CheckAvailability request. +func (c NamespacesClient) preparerForCheckAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckAvailabilityParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.NotificationHubs/checkNamespaceAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckAvailability handles the response to the CheckAvailability request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForCheckAvailability(resp *http.Response) (result CheckAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_createorupdate_autorest.go new file mode 100644 index 00000000000..77ac50b083b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *NamespaceResource +} + +// CreateOrUpdate ... +func (c NamespacesClient) CreateOrUpdate(ctx context.Context, id NamespaceId, input NamespaceCreateOrUpdateParameters) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c NamespacesClient) preparerForCreateOrUpdate(ctx context.Context, id NamespaceId, input NamespaceCreateOrUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_createorupdateauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_createorupdateauthorizationrule_autorest.go new file mode 100644 index 00000000000..1cd5f256ef5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_createorupdateauthorizationrule_autorest.go @@ -0,0 +1,69 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *SharedAccessAuthorizationRuleResource +} + +// CreateOrUpdateAuthorizationRule ... +func (c NamespacesClient) CreateOrUpdateAuthorizationRule(ctx context.Context, id AuthorizationRuleId, input SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result CreateOrUpdateAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdateAuthorizationRule(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdateAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdateAuthorizationRule prepares the CreateOrUpdateAuthorizationRule request. +func (c NamespacesClient) preparerForCreateOrUpdateAuthorizationRule(ctx context.Context, id AuthorizationRuleId, input SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdateAuthorizationRule handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForCreateOrUpdateAuthorizationRule(resp *http.Response) (result CreateOrUpdateAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_delete_autorest.go new file mode 100644 index 00000000000..968dfe754f2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_delete_autorest.go @@ -0,0 +1,78 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c NamespacesClient) Delete(ctx context.Context, id NamespaceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c NamespacesClient) DeleteThenPoll(ctx context.Context, id NamespaceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c NamespacesClient) preparerForDelete(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c NamespacesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_deleteauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_deleteauthorizationrule_autorest.go new file mode 100644 index 00000000000..92336c4b4a0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_deleteauthorizationrule_autorest.go @@ -0,0 +1,66 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response +} + +// DeleteAuthorizationRule ... +func (c NamespacesClient) DeleteAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (result DeleteAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForDeleteAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDeleteAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDeleteAuthorizationRule prepares the DeleteAuthorizationRule request. +func (c NamespacesClient) preparerForDeleteAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDeleteAuthorizationRule handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForDeleteAuthorizationRule(resp *http.Response) (result DeleteAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_get_autorest.go new file mode 100644 index 00000000000..298a50564f2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_get_autorest.go @@ -0,0 +1,68 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *NamespaceResource +} + +// Get ... +func (c NamespacesClient) Get(ctx context.Context, id NamespaceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c NamespacesClient) preparerForGet(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_getauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_getauthorizationrule_autorest.go new file mode 100644 index 00000000000..5568712e397 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_getauthorizationrule_autorest.go @@ -0,0 +1,68 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *SharedAccessAuthorizationRuleResource +} + +// GetAuthorizationRule ... +func (c NamespacesClient) GetAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (result GetAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForGetAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "GetAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "GetAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetAuthorizationRule prepares the GetAuthorizationRule request. +func (c NamespacesClient) preparerForGetAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetAuthorizationRule handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForGetAuthorizationRule(resp *http.Response) (result GetAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_list_autorest.go new file mode 100644 index 00000000000..523c1386ed1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_list_autorest.go @@ -0,0 +1,187 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]NamespaceResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []NamespaceResource +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c NamespacesClient) List(ctx context.Context, id commonids.ResourceGroupId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c NamespacesClient) preparerForList(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.NotificationHubs/namespaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c NamespacesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []NamespaceResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c NamespacesClient) ListComplete(ctx context.Context, id commonids.ResourceGroupId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, NamespaceResourceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NamespacesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate NamespaceResourceOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]NamespaceResource, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_listall_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_listall_autorest.go new file mode 100644 index 00000000000..f3a3ef9789a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_listall_autorest.go @@ -0,0 +1,187 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAllOperationResponse struct { + HttpResponse *http.Response + Model *[]NamespaceResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListAllOperationResponse, error) +} + +type ListAllCompleteResult struct { + Items []NamespaceResource +} + +func (r ListAllOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListAllOperationResponse) LoadMore(ctx context.Context) (resp ListAllOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListAll ... +func (c NamespacesClient) ListAll(ctx context.Context, id commonids.SubscriptionId) (resp ListAllOperationResponse, err error) { + req, err := c.preparerForListAll(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAll", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListAll(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAll", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListAll prepares the ListAll request. +func (c NamespacesClient) preparerForListAll(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.NotificationHubs/namespaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListAllWithNextLink prepares the ListAll request with the given nextLink token. +func (c NamespacesClient) preparerForListAllWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListAll handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForListAll(resp *http.Response) (result ListAllOperationResponse, err error) { + type page struct { + Values []NamespaceResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListAllOperationResponse, err error) { + req, err := c.preparerForListAllWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAll", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAll", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListAll(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAll", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListAllComplete retrieves all of the results into a single object +func (c NamespacesClient) ListAllComplete(ctx context.Context, id commonids.SubscriptionId) (ListAllCompleteResult, error) { + return c.ListAllCompleteMatchingPredicate(ctx, id, NamespaceResourceOperationPredicate{}) +} + +// ListAllCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NamespacesClient) ListAllCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate NamespaceResourceOperationPredicate) (resp ListAllCompleteResult, err error) { + items := make([]NamespaceResource, 0) + + page, err := c.ListAll(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListAllCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_listauthorizationrules_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_listauthorizationrules_autorest.go new file mode 100644 index 00000000000..b241c5740af --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_listauthorizationrules_autorest.go @@ -0,0 +1,186 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAuthorizationRulesOperationResponse struct { + HttpResponse *http.Response + Model *[]SharedAccessAuthorizationRuleResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListAuthorizationRulesOperationResponse, error) +} + +type ListAuthorizationRulesCompleteResult struct { + Items []SharedAccessAuthorizationRuleResource +} + +func (r ListAuthorizationRulesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListAuthorizationRulesOperationResponse) LoadMore(ctx context.Context) (resp ListAuthorizationRulesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListAuthorizationRules ... +func (c NamespacesClient) ListAuthorizationRules(ctx context.Context, id NamespaceId) (resp ListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForListAuthorizationRules(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListAuthorizationRules(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListAuthorizationRules prepares the ListAuthorizationRules request. +func (c NamespacesClient) preparerForListAuthorizationRules(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/authorizationRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListAuthorizationRulesWithNextLink prepares the ListAuthorizationRules request with the given nextLink token. +func (c NamespacesClient) preparerForListAuthorizationRulesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListAuthorizationRules handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForListAuthorizationRules(resp *http.Response) (result ListAuthorizationRulesOperationResponse, err error) { + type page struct { + Values []SharedAccessAuthorizationRuleResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForListAuthorizationRulesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListAuthorizationRules(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListAuthorizationRulesComplete retrieves all of the results into a single object +func (c NamespacesClient) ListAuthorizationRulesComplete(ctx context.Context, id NamespaceId) (ListAuthorizationRulesCompleteResult, error) { + return c.ListAuthorizationRulesCompleteMatchingPredicate(ctx, id, SharedAccessAuthorizationRuleResourceOperationPredicate{}) +} + +// ListAuthorizationRulesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NamespacesClient) ListAuthorizationRulesCompleteMatchingPredicate(ctx context.Context, id NamespaceId, predicate SharedAccessAuthorizationRuleResourceOperationPredicate) (resp ListAuthorizationRulesCompleteResult, err error) { + items := make([]SharedAccessAuthorizationRuleResource, 0) + + page, err := c.ListAuthorizationRules(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListAuthorizationRulesCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_listkeys_autorest.go new file mode 100644 index 00000000000..64703f27966 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_listkeys_autorest.go @@ -0,0 +1,69 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeysOperationResponse struct { + HttpResponse *http.Response + Model *ResourceListKeys +} + +// ListKeys ... +func (c NamespacesClient) ListKeys(ctx context.Context, id AuthorizationRuleId) (result ListKeysOperationResponse, err error) { + req, err := c.preparerForListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListKeys prepares the ListKeys request. +func (c NamespacesClient) preparerForListKeys(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListKeys handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForListKeys(resp *http.Response) (result ListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_patch_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_patch_autorest.go new file mode 100644 index 00000000000..b7b3967b5f7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_patch_autorest.go @@ -0,0 +1,69 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchOperationResponse struct { + HttpResponse *http.Response + Model *NamespaceResource +} + +// Patch ... +func (c NamespacesClient) Patch(ctx context.Context, id NamespaceId, input NamespacePatchParameters) (result PatchOperationResponse, err error) { + req, err := c.preparerForPatch(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Patch", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Patch", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPatch(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Patch", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPatch prepares the Patch request. +func (c NamespacesClient) preparerForPatch(ctx context.Context, id NamespaceId, input NamespacePatchParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPatch handles the response to the Patch request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForPatch(resp *http.Response) (result PatchOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_regeneratekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_regeneratekeys_autorest.go new file mode 100644 index 00000000000..3670a9fba0d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/method_regeneratekeys_autorest.go @@ -0,0 +1,70 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeysOperationResponse struct { + HttpResponse *http.Response + Model *ResourceListKeys +} + +// RegenerateKeys ... +func (c NamespacesClient) RegenerateKeys(ctx context.Context, id AuthorizationRuleId, input PolicykeyResource) (result RegenerateKeysOperationResponse, err error) { + req, err := c.preparerForRegenerateKeys(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "RegenerateKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRegenerateKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "RegenerateKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRegenerateKeys prepares the RegenerateKeys request. +func (c NamespacesClient) preparerForRegenerateKeys(ctx context.Context, id AuthorizationRuleId, input PolicykeyResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKeys", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRegenerateKeys handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForRegenerateKeys(resp *http.Response) (result RegenerateKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_checkavailabilityparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_checkavailabilityparameters.go new file mode 100644 index 00000000000..fb16d4baf94 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_checkavailabilityparameters.go @@ -0,0 +1,14 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckAvailabilityParameters struct { + Id *string `json:"id,omitempty"` + IsAvailiable *bool `json:"isAvailiable,omitempty"` + Location *string `json:"location,omitempty"` + Name string `json:"name"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_checkavailabilityresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_checkavailabilityresult.go new file mode 100644 index 00000000000..b2a066290a2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_checkavailabilityresult.go @@ -0,0 +1,14 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckAvailabilityResult struct { + Id *string `json:"id,omitempty"` + IsAvailiable *bool `json:"isAvailiable,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_namespacecreateorupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_namespacecreateorupdateparameters.go new file mode 100644 index 00000000000..ac5e6a4ebe3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_namespacecreateorupdateparameters.go @@ -0,0 +1,14 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespaceCreateOrUpdateParameters struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *NamespaceProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_namespacepatchparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_namespacepatchparameters.go new file mode 100644 index 00000000000..64762fc05c4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_namespacepatchparameters.go @@ -0,0 +1,9 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacePatchParameters struct { + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_namespaceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_namespaceproperties.go new file mode 100644 index 00000000000..2d1f74ce993 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_namespaceproperties.go @@ -0,0 +1,51 @@ +package namespaces + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespaceProperties struct { + CreatedAt *string `json:"createdAt,omitempty"` + Critical *bool `json:"critical,omitempty"` + DataCenter *string `json:"dataCenter,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + MetricId *string `json:"metricId,omitempty"` + Name *string `json:"name,omitempty"` + NamespaceType *NamespaceType `json:"namespaceType,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Region *string `json:"region,omitempty"` + ScaleUnit *string `json:"scaleUnit,omitempty"` + ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` + Status *string `json:"status,omitempty"` + SubscriptionId *string `json:"subscriptionId,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` +} + +func (o *NamespaceProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *NamespaceProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *NamespaceProperties) GetUpdatedAtAsTime() (*time.Time, error) { + if o.UpdatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpdatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *NamespaceProperties) SetUpdatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpdatedAt = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_namespaceresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_namespaceresource.go new file mode 100644 index 00000000000..6564db2447b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_namespaceresource.go @@ -0,0 +1,14 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespaceResource struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *NamespaceProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_policykeyresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_policykeyresource.go new file mode 100644 index 00000000000..806c5b62f73 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_policykeyresource.go @@ -0,0 +1,8 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicykeyResource struct { + PolicyKey *string `json:"policyKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_resourcelistkeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_resourcelistkeys.go new file mode 100644 index 00000000000..2d65966e645 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_resourcelistkeys.go @@ -0,0 +1,12 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceListKeys struct { + KeyName *string `json:"keyName,omitempty"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_sharedaccessauthorizationrulecreateorupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_sharedaccessauthorizationrulecreateorupdateparameters.go new file mode 100644 index 00000000000..f8b9fff6ca4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_sharedaccessauthorizationrulecreateorupdateparameters.go @@ -0,0 +1,8 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedAccessAuthorizationRuleCreateOrUpdateParameters struct { + Properties SharedAccessAuthorizationRuleProperties `json:"properties"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_sharedaccessauthorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_sharedaccessauthorizationruleproperties.go new file mode 100644 index 00000000000..54725ef854f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_sharedaccessauthorizationruleproperties.go @@ -0,0 +1,16 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedAccessAuthorizationRuleProperties struct { + ClaimType *string `json:"claimType,omitempty"` + ClaimValue *string `json:"claimValue,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` + KeyName *string `json:"keyName,omitempty"` + ModifiedTime *string `json:"modifiedTime,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + Revision *int64 `json:"revision,omitempty"` + Rights *[]AccessRights `json:"rights,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_sharedaccessauthorizationruleresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_sharedaccessauthorizationruleresource.go new file mode 100644 index 00000000000..cc60e95615c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_sharedaccessauthorizationruleresource.go @@ -0,0 +1,14 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedAccessAuthorizationRuleResource struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_sku.go new file mode 100644 index 00000000000..a8a950c9cfd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/model_sku.go @@ -0,0 +1,12 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name SkuName `json:"name"` + Size *string `json:"size,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/predicates.go new file mode 100644 index 00000000000..2337e395a0f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/predicates.go @@ -0,0 +1,57 @@ +package namespaces + +type NamespaceResourceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p NamespaceResourceOperationPredicate) Matches(input NamespaceResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type SharedAccessAuthorizationRuleResourceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p SharedAccessAuthorizationRuleResourceOperationPredicate) Matches(input SharedAccessAuthorizationRuleResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/version.go new file mode 100644 index 00000000000..a1c5b4cbe80 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces/version.go @@ -0,0 +1,12 @@ +package namespaces + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/namespaces/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/README.md new file mode 100644 index 00000000000..1fa1f9890b1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/README.md @@ -0,0 +1,272 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs` Documentation + +The `notificationhubs` SDK allows for interaction with the Azure Resource Manager Service `notificationhubs` (API Version `2017-04-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs" +``` + + +### Client Initialization + +```go +client := notificationhubs.NewNotificationHubsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NotificationHubsClient.CheckNotificationHubAvailability` + +```go +ctx := context.TODO() +id := notificationhubs.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +payload := notificationhubs.CheckAvailabilityParameters{ + // ... +} + + +read, err := client.CheckNotificationHubAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationHubsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := notificationhubs.NewNotificationHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "notificationHubValue") + +payload := notificationhubs.NotificationHubCreateOrUpdateParameters{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationHubsClient.CreateOrUpdateAuthorizationRule` + +```go +ctx := context.TODO() +id := notificationhubs.NewNotificationHubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "notificationHubValue", "authorizationRuleValue") + +payload := notificationhubs.SharedAccessAuthorizationRuleCreateOrUpdateParameters{ + // ... +} + + +read, err := client.CreateOrUpdateAuthorizationRule(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationHubsClient.DebugSend` + +```go +ctx := context.TODO() +id := notificationhubs.NewNotificationHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "notificationHubValue") +var payload interface{} + +read, err := client.DebugSend(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationHubsClient.Delete` + +```go +ctx := context.TODO() +id := notificationhubs.NewNotificationHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "notificationHubValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationHubsClient.DeleteAuthorizationRule` + +```go +ctx := context.TODO() +id := notificationhubs.NewNotificationHubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "notificationHubValue", "authorizationRuleValue") + +read, err := client.DeleteAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationHubsClient.Get` + +```go +ctx := context.TODO() +id := notificationhubs.NewNotificationHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "notificationHubValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationHubsClient.GetAuthorizationRule` + +```go +ctx := context.TODO() +id := notificationhubs.NewNotificationHubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "notificationHubValue", "authorizationRuleValue") + +read, err := client.GetAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationHubsClient.GetPnsCredentials` + +```go +ctx := context.TODO() +id := notificationhubs.NewNotificationHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "notificationHubValue") + +read, err := client.GetPnsCredentials(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationHubsClient.List` + +```go +ctx := context.TODO() +id := notificationhubs.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NotificationHubsClient.ListAuthorizationRules` + +```go +ctx := context.TODO() +id := notificationhubs.NewNotificationHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "notificationHubValue") + +// alternatively `client.ListAuthorizationRules(ctx, id)` can be used to do batched pagination +items, err := client.ListAuthorizationRulesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NotificationHubsClient.ListKeys` + +```go +ctx := context.TODO() +id := notificationhubs.NewNotificationHubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "notificationHubValue", "authorizationRuleValue") + +read, err := client.ListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationHubsClient.Patch` + +```go +ctx := context.TODO() +id := notificationhubs.NewNotificationHubID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "notificationHubValue") + +payload := notificationhubs.NotificationHubPatchParameters{ + // ... +} + + +read, err := client.Patch(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NotificationHubsClient.RegenerateKeys` + +```go +ctx := context.TODO() +id := notificationhubs.NewNotificationHubAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "notificationHubValue", "authorizationRuleValue") + +payload := notificationhubs.PolicykeyResource{ + // ... +} + + +read, err := client.RegenerateKeys(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/client.go new file mode 100644 index 00000000000..6788265dd2f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/client.go @@ -0,0 +1,18 @@ +package notificationhubs + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationHubsClient struct { + Client autorest.Client + baseUri string +} + +func NewNotificationHubsClientWithBaseURI(endpoint string) NotificationHubsClient { + return NotificationHubsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/constants.go new file mode 100644 index 00000000000..3f117f3a650 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/constants.go @@ -0,0 +1,68 @@ +package notificationhubs + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessRights string + +const ( + AccessRightsListen AccessRights = "Listen" + AccessRightsManage AccessRights = "Manage" + AccessRightsSend AccessRights = "Send" +) + +func PossibleValuesForAccessRights() []string { + return []string{ + string(AccessRightsListen), + string(AccessRightsManage), + string(AccessRightsSend), + } +} + +func parseAccessRights(input string) (*AccessRights, error) { + vals := map[string]AccessRights{ + "listen": AccessRightsListen, + "manage": AccessRightsManage, + "send": AccessRightsSend, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessRights(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameBasic SkuName = "Basic" + SkuNameFree SkuName = "Free" + SkuNameStandard SkuName = "Standard" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameBasic), + string(SkuNameFree), + string(SkuNameStandard), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "basic": SkuNameBasic, + "free": SkuNameFree, + "standard": SkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_namespace.go new file mode 100644 index 00000000000..3e8fa4d1e58 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_namespace.go @@ -0,0 +1,124 @@ +package notificationhubs + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NamespaceId{} + +// NamespaceId is a struct representing the Resource ID for a Namespace +type NamespaceId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string +} + +// NewNamespaceID returns a new NamespaceId struct +func NewNamespaceID(subscriptionId string, resourceGroupName string, namespaceName string) NamespaceId { + return NamespaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + } +} + +// ParseNamespaceID parses 'input' into a NamespaceId +func ParseNamespaceID(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNamespaceIDInsensitively parses 'input' case-insensitively into a NamespaceId +// note: this method should only be used for API response data and not user input +func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID +func ValidateNamespaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNamespaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Namespace ID +func (id NamespaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NotificationHubs/namespaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Namespace ID +func (id NamespaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNotificationHubs", "Microsoft.NotificationHubs", "Microsoft.NotificationHubs"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + } +} + +// String returns a human-readable description of this Namespace ID +func (id NamespaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + } + return fmt.Sprintf("Namespace (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_notificationhub.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_notificationhub.go new file mode 100644 index 00000000000..fc4e4a144fb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_notificationhub.go @@ -0,0 +1,137 @@ +package notificationhubs + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NotificationHubId{} + +// NotificationHubId is a struct representing the Resource ID for a Notification Hub +type NotificationHubId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + NotificationHubName string +} + +// NewNotificationHubID returns a new NotificationHubId struct +func NewNotificationHubID(subscriptionId string, resourceGroupName string, namespaceName string, notificationHubName string) NotificationHubId { + return NotificationHubId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + NotificationHubName: notificationHubName, + } +} + +// ParseNotificationHubID parses 'input' into a NotificationHubId +func ParseNotificationHubID(input string) (*NotificationHubId, error) { + parser := resourceids.NewParserFromResourceIdType(NotificationHubId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NotificationHubId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.NotificationHubName, ok = parsed.Parsed["notificationHubName"]; !ok { + return nil, fmt.Errorf("the segment 'notificationHubName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNotificationHubIDInsensitively parses 'input' case-insensitively into a NotificationHubId +// note: this method should only be used for API response data and not user input +func ParseNotificationHubIDInsensitively(input string) (*NotificationHubId, error) { + parser := resourceids.NewParserFromResourceIdType(NotificationHubId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NotificationHubId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.NotificationHubName, ok = parsed.Parsed["notificationHubName"]; !ok { + return nil, fmt.Errorf("the segment 'notificationHubName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNotificationHubID checks that 'input' can be parsed as a Notification Hub ID +func ValidateNotificationHubID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNotificationHubID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Notification Hub ID +func (id NotificationHubId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NotificationHubs/namespaces/%s/notificationHubs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.NotificationHubName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Notification Hub ID +func (id NotificationHubId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNotificationHubs", "Microsoft.NotificationHubs", "Microsoft.NotificationHubs"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticNotificationHubs", "notificationHubs", "notificationHubs"), + resourceids.UserSpecifiedSegment("notificationHubName", "notificationHubValue"), + } +} + +// String returns a human-readable description of this Notification Hub ID +func (id NotificationHubId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Notification Hub Name: %q", id.NotificationHubName), + } + return fmt.Sprintf("Notification Hub (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_notificationhubauthorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_notificationhubauthorizationrule.go new file mode 100644 index 00000000000..ed49ae44e07 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_notificationhubauthorizationrule.go @@ -0,0 +1,150 @@ +package notificationhubs + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NotificationHubAuthorizationRuleId{} + +// NotificationHubAuthorizationRuleId is a struct representing the Resource ID for a Notification Hub Authorization Rule +type NotificationHubAuthorizationRuleId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + NotificationHubName string + AuthorizationRuleName string +} + +// NewNotificationHubAuthorizationRuleID returns a new NotificationHubAuthorizationRuleId struct +func NewNotificationHubAuthorizationRuleID(subscriptionId string, resourceGroupName string, namespaceName string, notificationHubName string, authorizationRuleName string) NotificationHubAuthorizationRuleId { + return NotificationHubAuthorizationRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + NotificationHubName: notificationHubName, + AuthorizationRuleName: authorizationRuleName, + } +} + +// ParseNotificationHubAuthorizationRuleID parses 'input' into a NotificationHubAuthorizationRuleId +func ParseNotificationHubAuthorizationRuleID(input string) (*NotificationHubAuthorizationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(NotificationHubAuthorizationRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NotificationHubAuthorizationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.NotificationHubName, ok = parsed.Parsed["notificationHubName"]; !ok { + return nil, fmt.Errorf("the segment 'notificationHubName' was not found in the resource id %q", input) + } + + if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNotificationHubAuthorizationRuleIDInsensitively parses 'input' case-insensitively into a NotificationHubAuthorizationRuleId +// note: this method should only be used for API response data and not user input +func ParseNotificationHubAuthorizationRuleIDInsensitively(input string) (*NotificationHubAuthorizationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(NotificationHubAuthorizationRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NotificationHubAuthorizationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.NotificationHubName, ok = parsed.Parsed["notificationHubName"]; !ok { + return nil, fmt.Errorf("the segment 'notificationHubName' was not found in the resource id %q", input) + } + + if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNotificationHubAuthorizationRuleID checks that 'input' can be parsed as a Notification Hub Authorization Rule ID +func ValidateNotificationHubAuthorizationRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNotificationHubAuthorizationRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Notification Hub Authorization Rule ID +func (id NotificationHubAuthorizationRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NotificationHubs/namespaces/%s/notificationHubs/%s/authorizationRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.NotificationHubName, id.AuthorizationRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Notification Hub Authorization Rule ID +func (id NotificationHubAuthorizationRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNotificationHubs", "Microsoft.NotificationHubs", "Microsoft.NotificationHubs"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticNotificationHubs", "notificationHubs", "notificationHubs"), + resourceids.UserSpecifiedSegment("notificationHubName", "notificationHubValue"), + resourceids.StaticSegment("staticAuthorizationRules", "authorizationRules", "authorizationRules"), + resourceids.UserSpecifiedSegment("authorizationRuleName", "authorizationRuleValue"), + } +} + +// String returns a human-readable description of this Notification Hub Authorization Rule ID +func (id NotificationHubAuthorizationRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Notification Hub Name: %q", id.NotificationHubName), + fmt.Sprintf("Authorization Rule Name: %q", id.AuthorizationRuleName), + } + return fmt.Sprintf("Notification Hub Authorization Rule (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_checknotificationhubavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_checknotificationhubavailability_autorest.go new file mode 100644 index 00000000000..f90f4b218d2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_checknotificationhubavailability_autorest.go @@ -0,0 +1,70 @@ +package notificationhubs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNotificationHubAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckAvailabilityResult +} + +// CheckNotificationHubAvailability ... +func (c NotificationHubsClient) CheckNotificationHubAvailability(ctx context.Context, id NamespaceId, input CheckAvailabilityParameters) (result CheckNotificationHubAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNotificationHubAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "CheckNotificationHubAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "CheckNotificationHubAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNotificationHubAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "CheckNotificationHubAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNotificationHubAvailability prepares the CheckNotificationHubAvailability request. +func (c NotificationHubsClient) preparerForCheckNotificationHubAvailability(ctx context.Context, id NamespaceId, input CheckAvailabilityParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/checkNotificationHubAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNotificationHubAvailability handles the response to the CheckNotificationHubAvailability request. The method always +// closes the http.Response Body. +func (c NotificationHubsClient) responderForCheckNotificationHubAvailability(resp *http.Response) (result CheckNotificationHubAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_createorupdate_autorest.go new file mode 100644 index 00000000000..03912aab3d9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package notificationhubs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *NotificationHubResource +} + +// CreateOrUpdate ... +func (c NotificationHubsClient) CreateOrUpdate(ctx context.Context, id NotificationHubId, input NotificationHubCreateOrUpdateParameters) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c NotificationHubsClient) preparerForCreateOrUpdate(ctx context.Context, id NotificationHubId, input NotificationHubCreateOrUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c NotificationHubsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_createorupdateauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_createorupdateauthorizationrule_autorest.go new file mode 100644 index 00000000000..52b6a19d6a9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_createorupdateauthorizationrule_autorest.go @@ -0,0 +1,69 @@ +package notificationhubs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *SharedAccessAuthorizationRuleResource +} + +// CreateOrUpdateAuthorizationRule ... +func (c NotificationHubsClient) CreateOrUpdateAuthorizationRule(ctx context.Context, id NotificationHubAuthorizationRuleId, input SharedAccessAuthorizationRuleCreateOrUpdateParameters) (result CreateOrUpdateAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdateAuthorizationRule(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "CreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdateAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "CreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdateAuthorizationRule prepares the CreateOrUpdateAuthorizationRule request. +func (c NotificationHubsClient) preparerForCreateOrUpdateAuthorizationRule(ctx context.Context, id NotificationHubAuthorizationRuleId, input SharedAccessAuthorizationRuleCreateOrUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdateAuthorizationRule handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (c NotificationHubsClient) responderForCreateOrUpdateAuthorizationRule(resp *http.Response) (result CreateOrUpdateAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_debugsend_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_debugsend_autorest.go new file mode 100644 index 00000000000..36b3fafb126 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_debugsend_autorest.go @@ -0,0 +1,70 @@ +package notificationhubs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DebugSendOperationResponse struct { + HttpResponse *http.Response + Model *DebugSendResponse +} + +// DebugSend ... +func (c NotificationHubsClient) DebugSend(ctx context.Context, id NotificationHubId, input interface{}) (result DebugSendOperationResponse, err error) { + req, err := c.preparerForDebugSend(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "DebugSend", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "DebugSend", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDebugSend(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "DebugSend", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDebugSend prepares the DebugSend request. +func (c NotificationHubsClient) preparerForDebugSend(ctx context.Context, id NotificationHubId, input interface{}) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/debugsend", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDebugSend handles the response to the DebugSend request. The method always +// closes the http.Response Body. +func (c NotificationHubsClient) responderForDebugSend(resp *http.Response) (result DebugSendOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_delete_autorest.go new file mode 100644 index 00000000000..47852222b89 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_delete_autorest.go @@ -0,0 +1,66 @@ +package notificationhubs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c NotificationHubsClient) Delete(ctx context.Context, id NotificationHubId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c NotificationHubsClient) preparerForDelete(ctx context.Context, id NotificationHubId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c NotificationHubsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_deleteauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_deleteauthorizationrule_autorest.go new file mode 100644 index 00000000000..57aa8a5f022 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_deleteauthorizationrule_autorest.go @@ -0,0 +1,66 @@ +package notificationhubs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response +} + +// DeleteAuthorizationRule ... +func (c NotificationHubsClient) DeleteAuthorizationRule(ctx context.Context, id NotificationHubAuthorizationRuleId) (result DeleteAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForDeleteAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDeleteAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDeleteAuthorizationRule prepares the DeleteAuthorizationRule request. +func (c NotificationHubsClient) preparerForDeleteAuthorizationRule(ctx context.Context, id NotificationHubAuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDeleteAuthorizationRule handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (c NotificationHubsClient) responderForDeleteAuthorizationRule(resp *http.Response) (result DeleteAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_get_autorest.go new file mode 100644 index 00000000000..c2c95d04975 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_get_autorest.go @@ -0,0 +1,68 @@ +package notificationhubs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *NotificationHubResource +} + +// Get ... +func (c NotificationHubsClient) Get(ctx context.Context, id NotificationHubId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c NotificationHubsClient) preparerForGet(ctx context.Context, id NotificationHubId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c NotificationHubsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_getauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_getauthorizationrule_autorest.go new file mode 100644 index 00000000000..213dbbb2334 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_getauthorizationrule_autorest.go @@ -0,0 +1,68 @@ +package notificationhubs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *SharedAccessAuthorizationRuleResource +} + +// GetAuthorizationRule ... +func (c NotificationHubsClient) GetAuthorizationRule(ctx context.Context, id NotificationHubAuthorizationRuleId) (result GetAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForGetAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "GetAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "GetAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetAuthorizationRule prepares the GetAuthorizationRule request. +func (c NotificationHubsClient) preparerForGetAuthorizationRule(ctx context.Context, id NotificationHubAuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetAuthorizationRule handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (c NotificationHubsClient) responderForGetAuthorizationRule(resp *http.Response) (result GetAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_getpnscredentials_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_getpnscredentials_autorest.go new file mode 100644 index 00000000000..e8382681bee --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_getpnscredentials_autorest.go @@ -0,0 +1,69 @@ +package notificationhubs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetPnsCredentialsOperationResponse struct { + HttpResponse *http.Response + Model *PnsCredentialsResource +} + +// GetPnsCredentials ... +func (c NotificationHubsClient) GetPnsCredentials(ctx context.Context, id NotificationHubId) (result GetPnsCredentialsOperationResponse, err error) { + req, err := c.preparerForGetPnsCredentials(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "GetPnsCredentials", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "GetPnsCredentials", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetPnsCredentials(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "GetPnsCredentials", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetPnsCredentials prepares the GetPnsCredentials request. +func (c NotificationHubsClient) preparerForGetPnsCredentials(ctx context.Context, id NotificationHubId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/pnsCredentials", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetPnsCredentials handles the response to the GetPnsCredentials request. The method always +// closes the http.Response Body. +func (c NotificationHubsClient) responderForGetPnsCredentials(resp *http.Response) (result GetPnsCredentialsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_list_autorest.go new file mode 100644 index 00000000000..a1eb5d672b2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_list_autorest.go @@ -0,0 +1,186 @@ +package notificationhubs + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]NotificationHubResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []NotificationHubResource +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c NotificationHubsClient) List(ctx context.Context, id NamespaceId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c NotificationHubsClient) preparerForList(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/notificationHubs", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c NotificationHubsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c NotificationHubsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []NotificationHubResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c NotificationHubsClient) ListComplete(ctx context.Context, id NamespaceId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, NotificationHubResourceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NotificationHubsClient) ListCompleteMatchingPredicate(ctx context.Context, id NamespaceId, predicate NotificationHubResourceOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]NotificationHubResource, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_listauthorizationrules_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_listauthorizationrules_autorest.go new file mode 100644 index 00000000000..9aabfdf1009 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_listauthorizationrules_autorest.go @@ -0,0 +1,186 @@ +package notificationhubs + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAuthorizationRulesOperationResponse struct { + HttpResponse *http.Response + Model *[]SharedAccessAuthorizationRuleResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListAuthorizationRulesOperationResponse, error) +} + +type ListAuthorizationRulesCompleteResult struct { + Items []SharedAccessAuthorizationRuleResource +} + +func (r ListAuthorizationRulesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListAuthorizationRulesOperationResponse) LoadMore(ctx context.Context) (resp ListAuthorizationRulesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListAuthorizationRules ... +func (c NotificationHubsClient) ListAuthorizationRules(ctx context.Context, id NotificationHubId) (resp ListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForListAuthorizationRules(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "ListAuthorizationRules", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListAuthorizationRules(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "ListAuthorizationRules", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListAuthorizationRules prepares the ListAuthorizationRules request. +func (c NotificationHubsClient) preparerForListAuthorizationRules(ctx context.Context, id NotificationHubId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/authorizationRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListAuthorizationRulesWithNextLink prepares the ListAuthorizationRules request with the given nextLink token. +func (c NotificationHubsClient) preparerForListAuthorizationRulesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListAuthorizationRules handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (c NotificationHubsClient) responderForListAuthorizationRules(resp *http.Response) (result ListAuthorizationRulesOperationResponse, err error) { + type page struct { + Values []SharedAccessAuthorizationRuleResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForListAuthorizationRulesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "ListAuthorizationRules", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListAuthorizationRules(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "ListAuthorizationRules", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListAuthorizationRulesComplete retrieves all of the results into a single object +func (c NotificationHubsClient) ListAuthorizationRulesComplete(ctx context.Context, id NotificationHubId) (ListAuthorizationRulesCompleteResult, error) { + return c.ListAuthorizationRulesCompleteMatchingPredicate(ctx, id, SharedAccessAuthorizationRuleResourceOperationPredicate{}) +} + +// ListAuthorizationRulesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NotificationHubsClient) ListAuthorizationRulesCompleteMatchingPredicate(ctx context.Context, id NotificationHubId, predicate SharedAccessAuthorizationRuleResourceOperationPredicate) (resp ListAuthorizationRulesCompleteResult, err error) { + items := make([]SharedAccessAuthorizationRuleResource, 0) + + page, err := c.ListAuthorizationRules(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListAuthorizationRulesCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_listkeys_autorest.go new file mode 100644 index 00000000000..c0079bc2340 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_listkeys_autorest.go @@ -0,0 +1,69 @@ +package notificationhubs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeysOperationResponse struct { + HttpResponse *http.Response + Model *ResourceListKeys +} + +// ListKeys ... +func (c NotificationHubsClient) ListKeys(ctx context.Context, id NotificationHubAuthorizationRuleId) (result ListKeysOperationResponse, err error) { + req, err := c.preparerForListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "ListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "ListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "ListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListKeys prepares the ListKeys request. +func (c NotificationHubsClient) preparerForListKeys(ctx context.Context, id NotificationHubAuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListKeys handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (c NotificationHubsClient) responderForListKeys(resp *http.Response) (result ListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_patch_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_patch_autorest.go new file mode 100644 index 00000000000..2083f3d0dee --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_patch_autorest.go @@ -0,0 +1,69 @@ +package notificationhubs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchOperationResponse struct { + HttpResponse *http.Response + Model *NotificationHubResource +} + +// Patch ... +func (c NotificationHubsClient) Patch(ctx context.Context, id NotificationHubId, input NotificationHubPatchParameters) (result PatchOperationResponse, err error) { + req, err := c.preparerForPatch(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "Patch", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "Patch", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPatch(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "Patch", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPatch prepares the Patch request. +func (c NotificationHubsClient) preparerForPatch(ctx context.Context, id NotificationHubId, input NotificationHubPatchParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPatch handles the response to the Patch request. The method always +// closes the http.Response Body. +func (c NotificationHubsClient) responderForPatch(resp *http.Response) (result PatchOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_regeneratekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_regeneratekeys_autorest.go new file mode 100644 index 00000000000..323fbfe9d4c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/method_regeneratekeys_autorest.go @@ -0,0 +1,70 @@ +package notificationhubs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeysOperationResponse struct { + HttpResponse *http.Response + Model *ResourceListKeys +} + +// RegenerateKeys ... +func (c NotificationHubsClient) RegenerateKeys(ctx context.Context, id NotificationHubAuthorizationRuleId, input PolicykeyResource) (result RegenerateKeysOperationResponse, err error) { + req, err := c.preparerForRegenerateKeys(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "RegenerateKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRegenerateKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "notificationhubs.NotificationHubsClient", "RegenerateKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRegenerateKeys prepares the RegenerateKeys request. +func (c NotificationHubsClient) preparerForRegenerateKeys(ctx context.Context, id NotificationHubAuthorizationRuleId, input PolicykeyResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKeys", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRegenerateKeys handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (c NotificationHubsClient) responderForRegenerateKeys(resp *http.Response) (result RegenerateKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_admcredential.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_admcredential.go new file mode 100644 index 00000000000..fff74c8edaf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_admcredential.go @@ -0,0 +1,8 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdmCredential struct { + Properties *AdmCredentialProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_admcredentialproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_admcredentialproperties.go new file mode 100644 index 00000000000..e39e7063005 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_admcredentialproperties.go @@ -0,0 +1,10 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdmCredentialProperties struct { + AuthTokenUrl *string `json:"authTokenUrl,omitempty"` + ClientId *string `json:"clientId,omitempty"` + ClientSecret *string `json:"clientSecret,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_apnscredential.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_apnscredential.go new file mode 100644 index 00000000000..8db9f361918 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_apnscredential.go @@ -0,0 +1,8 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApnsCredential struct { + Properties *ApnsCredentialProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_apnscredentialproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_apnscredentialproperties.go new file mode 100644 index 00000000000..b7555a18515 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_apnscredentialproperties.go @@ -0,0 +1,15 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApnsCredentialProperties struct { + ApnsCertificate *string `json:"apnsCertificate,omitempty"` + AppId *string `json:"appId,omitempty"` + AppName *string `json:"appName,omitempty"` + CertificateKey *string `json:"certificateKey,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` + KeyId *string `json:"keyId,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + Token *string `json:"token,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_baiducredential.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_baiducredential.go new file mode 100644 index 00000000000..a982754cf6c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_baiducredential.go @@ -0,0 +1,8 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BaiduCredential struct { + Properties *BaiduCredentialProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_baiducredentialproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_baiducredentialproperties.go new file mode 100644 index 00000000000..9ad7d9bd22a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_baiducredentialproperties.go @@ -0,0 +1,10 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BaiduCredentialProperties struct { + BaiduApiKey *string `json:"baiduApiKey,omitempty"` + BaiduEndPoint *string `json:"baiduEndPoint,omitempty"` + BaiduSecretKey *string `json:"baiduSecretKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_checkavailabilityparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_checkavailabilityparameters.go new file mode 100644 index 00000000000..3106874b894 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_checkavailabilityparameters.go @@ -0,0 +1,14 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckAvailabilityParameters struct { + Id *string `json:"id,omitempty"` + IsAvailiable *bool `json:"isAvailiable,omitempty"` + Location *string `json:"location,omitempty"` + Name string `json:"name"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_checkavailabilityresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_checkavailabilityresult.go new file mode 100644 index 00000000000..ed609ebbe5f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_checkavailabilityresult.go @@ -0,0 +1,14 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckAvailabilityResult struct { + Id *string `json:"id,omitempty"` + IsAvailiable *bool `json:"isAvailiable,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_debugsendresponse.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_debugsendresponse.go new file mode 100644 index 00000000000..a7c8b7bf917 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_debugsendresponse.go @@ -0,0 +1,14 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DebugSendResponse struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DebugSendResult `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_debugsendresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_debugsendresult.go new file mode 100644 index 00000000000..f2f0321b0b8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_debugsendresult.go @@ -0,0 +1,10 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DebugSendResult struct { + Failure *float64 `json:"failure,omitempty"` + Results *interface{} `json:"results,omitempty"` + Success *float64 `json:"success,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_gcmcredential.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_gcmcredential.go new file mode 100644 index 00000000000..52cc6d30247 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_gcmcredential.go @@ -0,0 +1,8 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GcmCredential struct { + Properties *GcmCredentialProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_gcmcredentialproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_gcmcredentialproperties.go new file mode 100644 index 00000000000..0cef943bd73 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_gcmcredentialproperties.go @@ -0,0 +1,9 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GcmCredentialProperties struct { + GcmEndpoint *string `json:"gcmEndpoint,omitempty"` + GoogleApiKey *string `json:"googleApiKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_mpnscredential.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_mpnscredential.go new file mode 100644 index 00000000000..2d2b7ce6fe0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_mpnscredential.go @@ -0,0 +1,8 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MpnsCredential struct { + Properties *MpnsCredentialProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_mpnscredentialproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_mpnscredentialproperties.go new file mode 100644 index 00000000000..bcc18113843 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_mpnscredentialproperties.go @@ -0,0 +1,10 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MpnsCredentialProperties struct { + CertificateKey *string `json:"certificateKey,omitempty"` + MpnsCertificate *string `json:"mpnsCertificate,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_notificationhubcreateorupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_notificationhubcreateorupdateparameters.go new file mode 100644 index 00000000000..aed82c59ab4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_notificationhubcreateorupdateparameters.go @@ -0,0 +1,14 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationHubCreateOrUpdateParameters struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties NotificationHubProperties `json:"properties"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_notificationhubpatchparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_notificationhubpatchparameters.go new file mode 100644 index 00000000000..95732fedf68 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_notificationhubpatchparameters.go @@ -0,0 +1,14 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationHubPatchParameters struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *NotificationHubProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_notificationhubproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_notificationhubproperties.go new file mode 100644 index 00000000000..795c75db9cf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_notificationhubproperties.go @@ -0,0 +1,16 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationHubProperties struct { + AdmCredential *AdmCredential `json:"admCredential,omitempty"` + ApnsCredential *ApnsCredential `json:"apnsCredential,omitempty"` + AuthorizationRules *[]SharedAccessAuthorizationRuleProperties `json:"authorizationRules,omitempty"` + BaiduCredential *BaiduCredential `json:"baiduCredential,omitempty"` + GcmCredential *GcmCredential `json:"gcmCredential,omitempty"` + MpnsCredential *MpnsCredential `json:"mpnsCredential,omitempty"` + Name *string `json:"name,omitempty"` + RegistrationTtl *string `json:"registrationTtl,omitempty"` + WnsCredential *WnsCredential `json:"wnsCredential,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_notificationhubresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_notificationhubresource.go new file mode 100644 index 00000000000..1429c0ea346 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_notificationhubresource.go @@ -0,0 +1,14 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NotificationHubResource struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *NotificationHubProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_pnscredentialsproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_pnscredentialsproperties.go new file mode 100644 index 00000000000..5a74d04e2f8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_pnscredentialsproperties.go @@ -0,0 +1,13 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PnsCredentialsProperties struct { + AdmCredential *AdmCredential `json:"admCredential,omitempty"` + ApnsCredential *ApnsCredential `json:"apnsCredential,omitempty"` + BaiduCredential *BaiduCredential `json:"baiduCredential,omitempty"` + GcmCredential *GcmCredential `json:"gcmCredential,omitempty"` + MpnsCredential *MpnsCredential `json:"mpnsCredential,omitempty"` + WnsCredential *WnsCredential `json:"wnsCredential,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_pnscredentialsresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_pnscredentialsresource.go new file mode 100644 index 00000000000..05ac83b6189 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_pnscredentialsresource.go @@ -0,0 +1,14 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PnsCredentialsResource struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PnsCredentialsProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_policykeyresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_policykeyresource.go new file mode 100644 index 00000000000..f3cba815f8b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_policykeyresource.go @@ -0,0 +1,8 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PolicykeyResource struct { + PolicyKey *string `json:"policyKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_resourcelistkeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_resourcelistkeys.go new file mode 100644 index 00000000000..973fefafa88 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_resourcelistkeys.go @@ -0,0 +1,12 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceListKeys struct { + KeyName *string `json:"keyName,omitempty"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_sharedaccessauthorizationrulecreateorupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_sharedaccessauthorizationrulecreateorupdateparameters.go new file mode 100644 index 00000000000..a8263a5e612 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_sharedaccessauthorizationrulecreateorupdateparameters.go @@ -0,0 +1,8 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedAccessAuthorizationRuleCreateOrUpdateParameters struct { + Properties SharedAccessAuthorizationRuleProperties `json:"properties"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_sharedaccessauthorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_sharedaccessauthorizationruleproperties.go new file mode 100644 index 00000000000..1decf52835d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_sharedaccessauthorizationruleproperties.go @@ -0,0 +1,16 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedAccessAuthorizationRuleProperties struct { + ClaimType *string `json:"claimType,omitempty"` + ClaimValue *string `json:"claimValue,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` + KeyName *string `json:"keyName,omitempty"` + ModifiedTime *string `json:"modifiedTime,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + Revision *int64 `json:"revision,omitempty"` + Rights *[]AccessRights `json:"rights,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_sharedaccessauthorizationruleresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_sharedaccessauthorizationruleresource.go new file mode 100644 index 00000000000..c17feea2742 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_sharedaccessauthorizationruleresource.go @@ -0,0 +1,14 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedAccessAuthorizationRuleResource struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SharedAccessAuthorizationRuleProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_sku.go new file mode 100644 index 00000000000..c4a107cc126 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_sku.go @@ -0,0 +1,12 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name SkuName `json:"name"` + Size *string `json:"size,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_wnscredential.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_wnscredential.go new file mode 100644 index 00000000000..8982c278ba2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_wnscredential.go @@ -0,0 +1,8 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WnsCredential struct { + Properties *WnsCredentialProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_wnscredentialproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_wnscredentialproperties.go new file mode 100644 index 00000000000..3f1294bb875 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/model_wnscredentialproperties.go @@ -0,0 +1,10 @@ +package notificationhubs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WnsCredentialProperties struct { + PackageSid *string `json:"packageSid,omitempty"` + SecretKey *string `json:"secretKey,omitempty"` + WindowsLiveEndpoint *string `json:"windowsLiveEndpoint,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/predicates.go new file mode 100644 index 00000000000..87d2dafba7c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/predicates.go @@ -0,0 +1,57 @@ +package notificationhubs + +type NotificationHubResourceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p NotificationHubResourceOperationPredicate) Matches(input NotificationHubResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type SharedAccessAuthorizationRuleResourceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p SharedAccessAuthorizationRuleResourceOperationPredicate) Matches(input SharedAccessAuthorizationRuleResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/version.go new file mode 100644 index 00000000000..ac60580aeb7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs/version.go @@ -0,0 +1,12 @@ +package notificationhubs + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/notificationhubs/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/README.md new file mode 100644 index 00000000000..a32e5348f3f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks` Documentation + +The `querypacks` SDK allows for interaction with the Azure Resource Manager Service `operationalinsights` (API Version `2019-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks" +``` + + +### Client Initialization + +```go +client := querypacks.NewQueryPacksClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `QueryPacksClient.QueryPacksCreateOrUpdate` + +```go +ctx := context.TODO() +id := querypacks.NewQueryPackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "queryPackValue") + +payload := querypacks.LogAnalyticsQueryPack{ + // ... +} + + +read, err := client.QueryPacksCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `QueryPacksClient.QueryPacksDelete` + +```go +ctx := context.TODO() +id := querypacks.NewQueryPackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "queryPackValue") + +read, err := client.QueryPacksDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `QueryPacksClient.QueryPacksGet` + +```go +ctx := context.TODO() +id := querypacks.NewQueryPackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "queryPackValue") + +read, err := client.QueryPacksGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `QueryPacksClient.QueryPacksList` + +```go +ctx := context.TODO() +id := querypacks.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.QueryPacksList(ctx, id)` can be used to do batched pagination +items, err := client.QueryPacksListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `QueryPacksClient.QueryPacksListByResourceGroup` + +```go +ctx := context.TODO() +id := querypacks.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.QueryPacksListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.QueryPacksListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `QueryPacksClient.QueryPacksUpdateTags` + +```go +ctx := context.TODO() +id := querypacks.NewQueryPackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "queryPackValue") + +payload := querypacks.TagsResource{ + // ... +} + + +read, err := client.QueryPacksUpdateTags(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/client.go new file mode 100644 index 00000000000..9dca658ee8e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/client.go @@ -0,0 +1,18 @@ +package querypacks + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueryPacksClient struct { + Client autorest.Client + baseUri string +} + +func NewQueryPacksClientWithBaseURI(endpoint string) QueryPacksClient { + return QueryPacksClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/id_querypack.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/id_querypack.go new file mode 100644 index 00000000000..0c395ea666e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/id_querypack.go @@ -0,0 +1,124 @@ +package querypacks + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = QueryPackId{} + +// QueryPackId is a struct representing the Resource ID for a Query Pack +type QueryPackId struct { + SubscriptionId string + ResourceGroupName string + QueryPackName string +} + +// NewQueryPackID returns a new QueryPackId struct +func NewQueryPackID(subscriptionId string, resourceGroupName string, queryPackName string) QueryPackId { + return QueryPackId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + QueryPackName: queryPackName, + } +} + +// ParseQueryPackID parses 'input' into a QueryPackId +func ParseQueryPackID(input string) (*QueryPackId, error) { + parser := resourceids.NewParserFromResourceIdType(QueryPackId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := QueryPackId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.QueryPackName, ok = parsed.Parsed["queryPackName"]; !ok { + return nil, fmt.Errorf("the segment 'queryPackName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseQueryPackIDInsensitively parses 'input' case-insensitively into a QueryPackId +// note: this method should only be used for API response data and not user input +func ParseQueryPackIDInsensitively(input string) (*QueryPackId, error) { + parser := resourceids.NewParserFromResourceIdType(QueryPackId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := QueryPackId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.QueryPackName, ok = parsed.Parsed["queryPackName"]; !ok { + return nil, fmt.Errorf("the segment 'queryPackName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateQueryPackID checks that 'input' can be parsed as a Query Pack ID +func ValidateQueryPackID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseQueryPackID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Query Pack ID +func (id QueryPackId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OperationalInsights/queryPacks/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.QueryPackName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Query Pack ID +func (id QueryPackId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftOperationalInsights", "Microsoft.OperationalInsights", "Microsoft.OperationalInsights"), + resourceids.StaticSegment("staticQueryPacks", "queryPacks", "queryPacks"), + resourceids.UserSpecifiedSegment("queryPackName", "queryPackValue"), + } +} + +// String returns a human-readable description of this Query Pack ID +func (id QueryPackId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Query Pack Name: %q", id.QueryPackName), + } + return fmt.Sprintf("Query Pack (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypackscreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypackscreateorupdate_autorest.go new file mode 100644 index 00000000000..bf9b8ec8aaa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypackscreateorupdate_autorest.go @@ -0,0 +1,69 @@ +package querypacks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueryPacksCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *LogAnalyticsQueryPack +} + +// QueryPacksCreateOrUpdate ... +func (c QueryPacksClient) QueryPacksCreateOrUpdate(ctx context.Context, id QueryPackId, input LogAnalyticsQueryPack) (result QueryPacksCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForQueryPacksCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksCreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForQueryPacksCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksCreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForQueryPacksCreateOrUpdate prepares the QueryPacksCreateOrUpdate request. +func (c QueryPacksClient) preparerForQueryPacksCreateOrUpdate(ctx context.Context, id QueryPackId, input LogAnalyticsQueryPack) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForQueryPacksCreateOrUpdate handles the response to the QueryPacksCreateOrUpdate request. The method always +// closes the http.Response Body. +func (c QueryPacksClient) responderForQueryPacksCreateOrUpdate(resp *http.Response) (result QueryPacksCreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypacksdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypacksdelete_autorest.go new file mode 100644 index 00000000000..d3ac8488cbe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypacksdelete_autorest.go @@ -0,0 +1,66 @@ +package querypacks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueryPacksDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// QueryPacksDelete ... +func (c QueryPacksClient) QueryPacksDelete(ctx context.Context, id QueryPackId) (result QueryPacksDeleteOperationResponse, err error) { + req, err := c.preparerForQueryPacksDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForQueryPacksDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForQueryPacksDelete prepares the QueryPacksDelete request. +func (c QueryPacksClient) preparerForQueryPacksDelete(ctx context.Context, id QueryPackId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForQueryPacksDelete handles the response to the QueryPacksDelete request. The method always +// closes the http.Response Body. +func (c QueryPacksClient) responderForQueryPacksDelete(resp *http.Response) (result QueryPacksDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypacksget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypacksget_autorest.go new file mode 100644 index 00000000000..813cfcc911f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypacksget_autorest.go @@ -0,0 +1,68 @@ +package querypacks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueryPacksGetOperationResponse struct { + HttpResponse *http.Response + Model *LogAnalyticsQueryPack +} + +// QueryPacksGet ... +func (c QueryPacksClient) QueryPacksGet(ctx context.Context, id QueryPackId) (result QueryPacksGetOperationResponse, err error) { + req, err := c.preparerForQueryPacksGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForQueryPacksGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForQueryPacksGet prepares the QueryPacksGet request. +func (c QueryPacksClient) preparerForQueryPacksGet(ctx context.Context, id QueryPackId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForQueryPacksGet handles the response to the QueryPacksGet request. The method always +// closes the http.Response Body. +func (c QueryPacksClient) responderForQueryPacksGet(resp *http.Response) (result QueryPacksGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypackslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypackslist_autorest.go new file mode 100644 index 00000000000..b7f9faa72b9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypackslist_autorest.go @@ -0,0 +1,187 @@ +package querypacks + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueryPacksListOperationResponse struct { + HttpResponse *http.Response + Model *[]LogAnalyticsQueryPack + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (QueryPacksListOperationResponse, error) +} + +type QueryPacksListCompleteResult struct { + Items []LogAnalyticsQueryPack +} + +func (r QueryPacksListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r QueryPacksListOperationResponse) LoadMore(ctx context.Context) (resp QueryPacksListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// QueryPacksList ... +func (c QueryPacksClient) QueryPacksList(ctx context.Context, id commonids.SubscriptionId) (resp QueryPacksListOperationResponse, err error) { + req, err := c.preparerForQueryPacksList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForQueryPacksList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForQueryPacksList prepares the QueryPacksList request. +func (c QueryPacksClient) preparerForQueryPacksList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.OperationalInsights/queryPacks", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForQueryPacksListWithNextLink prepares the QueryPacksList request with the given nextLink token. +func (c QueryPacksClient) preparerForQueryPacksListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForQueryPacksList handles the response to the QueryPacksList request. The method always +// closes the http.Response Body. +func (c QueryPacksClient) responderForQueryPacksList(resp *http.Response) (result QueryPacksListOperationResponse, err error) { + type page struct { + Values []LogAnalyticsQueryPack `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result QueryPacksListOperationResponse, err error) { + req, err := c.preparerForQueryPacksListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForQueryPacksList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// QueryPacksListComplete retrieves all of the results into a single object +func (c QueryPacksClient) QueryPacksListComplete(ctx context.Context, id commonids.SubscriptionId) (QueryPacksListCompleteResult, error) { + return c.QueryPacksListCompleteMatchingPredicate(ctx, id, LogAnalyticsQueryPackOperationPredicate{}) +} + +// QueryPacksListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c QueryPacksClient) QueryPacksListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate LogAnalyticsQueryPackOperationPredicate) (resp QueryPacksListCompleteResult, err error) { + items := make([]LogAnalyticsQueryPack, 0) + + page, err := c.QueryPacksList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := QueryPacksListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypackslistbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypackslistbyresourcegroup_autorest.go new file mode 100644 index 00000000000..00ee03ac370 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypackslistbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package querypacks + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueryPacksListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]LogAnalyticsQueryPack + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (QueryPacksListByResourceGroupOperationResponse, error) +} + +type QueryPacksListByResourceGroupCompleteResult struct { + Items []LogAnalyticsQueryPack +} + +func (r QueryPacksListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r QueryPacksListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp QueryPacksListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// QueryPacksListByResourceGroup ... +func (c QueryPacksClient) QueryPacksListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp QueryPacksListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForQueryPacksListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForQueryPacksListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForQueryPacksListByResourceGroup prepares the QueryPacksListByResourceGroup request. +func (c QueryPacksClient) preparerForQueryPacksListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.OperationalInsights/queryPacks", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForQueryPacksListByResourceGroupWithNextLink prepares the QueryPacksListByResourceGroup request with the given nextLink token. +func (c QueryPacksClient) preparerForQueryPacksListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForQueryPacksListByResourceGroup handles the response to the QueryPacksListByResourceGroup request. The method always +// closes the http.Response Body. +func (c QueryPacksClient) responderForQueryPacksListByResourceGroup(resp *http.Response) (result QueryPacksListByResourceGroupOperationResponse, err error) { + type page struct { + Values []LogAnalyticsQueryPack `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result QueryPacksListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForQueryPacksListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForQueryPacksListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// QueryPacksListByResourceGroupComplete retrieves all of the results into a single object +func (c QueryPacksClient) QueryPacksListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (QueryPacksListByResourceGroupCompleteResult, error) { + return c.QueryPacksListByResourceGroupCompleteMatchingPredicate(ctx, id, LogAnalyticsQueryPackOperationPredicate{}) +} + +// QueryPacksListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c QueryPacksClient) QueryPacksListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate LogAnalyticsQueryPackOperationPredicate) (resp QueryPacksListByResourceGroupCompleteResult, err error) { + items := make([]LogAnalyticsQueryPack, 0) + + page, err := c.QueryPacksListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := QueryPacksListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypacksupdatetags_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypacksupdatetags_autorest.go new file mode 100644 index 00000000000..f35013ff45c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/method_querypacksupdatetags_autorest.go @@ -0,0 +1,69 @@ +package querypacks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueryPacksUpdateTagsOperationResponse struct { + HttpResponse *http.Response + Model *LogAnalyticsQueryPack +} + +// QueryPacksUpdateTags ... +func (c QueryPacksClient) QueryPacksUpdateTags(ctx context.Context, id QueryPackId, input TagsResource) (result QueryPacksUpdateTagsOperationResponse, err error) { + req, err := c.preparerForQueryPacksUpdateTags(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksUpdateTags", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksUpdateTags", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForQueryPacksUpdateTags(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "querypacks.QueryPacksClient", "QueryPacksUpdateTags", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForQueryPacksUpdateTags prepares the QueryPacksUpdateTags request. +func (c QueryPacksClient) preparerForQueryPacksUpdateTags(ctx context.Context, id QueryPackId, input TagsResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForQueryPacksUpdateTags handles the response to the QueryPacksUpdateTags request. The method always +// closes the http.Response Body. +func (c QueryPacksClient) responderForQueryPacksUpdateTags(resp *http.Response) (result QueryPacksUpdateTagsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/model_loganalyticsquerypack.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/model_loganalyticsquerypack.go new file mode 100644 index 00000000000..0faa1ce1c07 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/model_loganalyticsquerypack.go @@ -0,0 +1,13 @@ +package querypacks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogAnalyticsQueryPack struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties LogAnalyticsQueryPackProperties `json:"properties"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/model_loganalyticsquerypackproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/model_loganalyticsquerypackproperties.go new file mode 100644 index 00000000000..772445a81e8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/model_loganalyticsquerypackproperties.go @@ -0,0 +1,41 @@ +package querypacks + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogAnalyticsQueryPackProperties struct { + ProvisioningState *string `json:"provisioningState,omitempty"` + QueryPackId *string `json:"queryPackId,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + TimeModified *string `json:"timeModified,omitempty"` +} + +func (o *LogAnalyticsQueryPackProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *LogAnalyticsQueryPackProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} + +func (o *LogAnalyticsQueryPackProperties) GetTimeModifiedAsTime() (*time.Time, error) { + if o.TimeModified == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeModified, "2006-01-02T15:04:05Z07:00") +} + +func (o *LogAnalyticsQueryPackProperties) SetTimeModifiedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeModified = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/model_tagsresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/model_tagsresource.go new file mode 100644 index 00000000000..7fdf7eeb6c5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/model_tagsresource.go @@ -0,0 +1,8 @@ +package querypacks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TagsResource struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/predicates.go new file mode 100644 index 00000000000..93dd8980851 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/predicates.go @@ -0,0 +1,29 @@ +package querypacks + +type LogAnalyticsQueryPackOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p LogAnalyticsQueryPackOperationPredicate) Matches(input LogAnalyticsQueryPack) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/version.go new file mode 100644 index 00000000000..a95b1f7465c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks/version.go @@ -0,0 +1,12 @@ +package querypacks + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-09-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/querypacks/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/README.md new file mode 100644 index 00000000000..9ab093855c1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/README.md @@ -0,0 +1,299 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces` Documentation + +The `workspaces` SDK allows for interaction with the Azure Resource Manager Service `operationalinsights` (API Version `2020-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces" +``` + + +### Client Initialization + +```go +client := workspaces.NewWorkspacesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `WorkspacesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +payload := workspaces.Workspace{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `WorkspacesClient.Delete` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +if err := client.DeleteThenPoll(ctx, id, workspaces.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `WorkspacesClient.GatewaysDelete` + +```go +ctx := context.TODO() +id := workspaces.NewGatewayID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "gatewayIdValue") + +read, err := client.GatewaysDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.Get` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.IntelligencePacksDisable` + +```go +ctx := context.TODO() +id := workspaces.NewIntelligencePackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "intelligencePackValue") + +read, err := client.IntelligencePacksDisable(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.IntelligencePacksEnable` + +```go +ctx := context.TODO() +id := workspaces.NewIntelligencePackID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "intelligencePackValue") + +read, err := client.IntelligencePacksEnable(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.IntelligencePacksList` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +read, err := client.IntelligencePacksList(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.List` + +```go +ctx := context.TODO() +id := workspaces.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := workspaces.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.ListByResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.ManagementGroupsList` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +read, err := client.ManagementGroupsList(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.SchemaGet` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +read, err := client.SchemaGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.SharedKeysGetSharedKeys` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +read, err := client.SharedKeysGetSharedKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.SharedKeysRegenerate` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +read, err := client.SharedKeysRegenerate(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.Update` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +payload := workspaces.WorkspacePatch{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.UsagesList` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +read, err := client.UsagesList(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.WorkspacePurgeGetPurgeStatus` + +```go +ctx := context.TODO() +id := workspaces.NewOperationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "purgeIdValue") + +read, err := client.WorkspacePurgeGetPurgeStatus(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `WorkspacesClient.WorkspacePurgePurge` + +```go +ctx := context.TODO() +id := workspaces.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +payload := workspaces.WorkspacePurgeBody{ + // ... +} + + +read, err := client.WorkspacePurgePurge(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/client.go new file mode 100644 index 00000000000..02d022fa85e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/client.go @@ -0,0 +1,18 @@ +package workspaces + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacesClient struct { + Client autorest.Client + baseUri string +} + +func NewWorkspacesClientWithBaseURI(endpoint string) WorkspacesClient { + return WorkspacesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/constants.go new file mode 100644 index 00000000000..4d8f794e968 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/constants.go @@ -0,0 +1,219 @@ +package workspaces + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataIngestionStatus string + +const ( + DataIngestionStatusApproachingQuota DataIngestionStatus = "ApproachingQuota" + DataIngestionStatusForceOff DataIngestionStatus = "ForceOff" + DataIngestionStatusForceOn DataIngestionStatus = "ForceOn" + DataIngestionStatusOverQuota DataIngestionStatus = "OverQuota" + DataIngestionStatusRespectQuota DataIngestionStatus = "RespectQuota" + DataIngestionStatusSubscriptionSuspended DataIngestionStatus = "SubscriptionSuspended" +) + +func PossibleValuesForDataIngestionStatus() []string { + return []string{ + string(DataIngestionStatusApproachingQuota), + string(DataIngestionStatusForceOff), + string(DataIngestionStatusForceOn), + string(DataIngestionStatusOverQuota), + string(DataIngestionStatusRespectQuota), + string(DataIngestionStatusSubscriptionSuspended), + } +} + +func parseDataIngestionStatus(input string) (*DataIngestionStatus, error) { + vals := map[string]DataIngestionStatus{ + "approachingquota": DataIngestionStatusApproachingQuota, + "forceoff": DataIngestionStatusForceOff, + "forceon": DataIngestionStatusForceOn, + "overquota": DataIngestionStatusOverQuota, + "respectquota": DataIngestionStatusRespectQuota, + "subscriptionsuspended": DataIngestionStatusSubscriptionSuspended, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DataIngestionStatus(input) + return &out, nil +} + +type PublicNetworkAccessType string + +const ( + PublicNetworkAccessTypeDisabled PublicNetworkAccessType = "Disabled" + PublicNetworkAccessTypeEnabled PublicNetworkAccessType = "Enabled" +) + +func PossibleValuesForPublicNetworkAccessType() []string { + return []string{ + string(PublicNetworkAccessTypeDisabled), + string(PublicNetworkAccessTypeEnabled), + } +} + +func parsePublicNetworkAccessType(input string) (*PublicNetworkAccessType, error) { + vals := map[string]PublicNetworkAccessType{ + "disabled": PublicNetworkAccessTypeDisabled, + "enabled": PublicNetworkAccessTypeEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccessType(input) + return &out, nil +} + +type PurgeState string + +const ( + PurgeStateCompleted PurgeState = "completed" + PurgeStatePending PurgeState = "pending" +) + +func PossibleValuesForPurgeState() []string { + return []string{ + string(PurgeStateCompleted), + string(PurgeStatePending), + } +} + +func parsePurgeState(input string) (*PurgeState, error) { + vals := map[string]PurgeState{ + "completed": PurgeStateCompleted, + "pending": PurgeStatePending, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PurgeState(input) + return &out, nil +} + +type SearchSortEnum string + +const ( + SearchSortEnumAsc SearchSortEnum = "asc" + SearchSortEnumDesc SearchSortEnum = "desc" +) + +func PossibleValuesForSearchSortEnum() []string { + return []string{ + string(SearchSortEnumAsc), + string(SearchSortEnumDesc), + } +} + +func parseSearchSortEnum(input string) (*SearchSortEnum, error) { + vals := map[string]SearchSortEnum{ + "asc": SearchSortEnumAsc, + "desc": SearchSortEnumDesc, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SearchSortEnum(input) + return &out, nil +} + +type WorkspaceEntityStatus string + +const ( + WorkspaceEntityStatusCanceled WorkspaceEntityStatus = "Canceled" + WorkspaceEntityStatusCreating WorkspaceEntityStatus = "Creating" + WorkspaceEntityStatusDeleting WorkspaceEntityStatus = "Deleting" + WorkspaceEntityStatusFailed WorkspaceEntityStatus = "Failed" + WorkspaceEntityStatusProvisioningAccount WorkspaceEntityStatus = "ProvisioningAccount" + WorkspaceEntityStatusSucceeded WorkspaceEntityStatus = "Succeeded" + WorkspaceEntityStatusUpdating WorkspaceEntityStatus = "Updating" +) + +func PossibleValuesForWorkspaceEntityStatus() []string { + return []string{ + string(WorkspaceEntityStatusCanceled), + string(WorkspaceEntityStatusCreating), + string(WorkspaceEntityStatusDeleting), + string(WorkspaceEntityStatusFailed), + string(WorkspaceEntityStatusProvisioningAccount), + string(WorkspaceEntityStatusSucceeded), + string(WorkspaceEntityStatusUpdating), + } +} + +func parseWorkspaceEntityStatus(input string) (*WorkspaceEntityStatus, error) { + vals := map[string]WorkspaceEntityStatus{ + "canceled": WorkspaceEntityStatusCanceled, + "creating": WorkspaceEntityStatusCreating, + "deleting": WorkspaceEntityStatusDeleting, + "failed": WorkspaceEntityStatusFailed, + "provisioningaccount": WorkspaceEntityStatusProvisioningAccount, + "succeeded": WorkspaceEntityStatusSucceeded, + "updating": WorkspaceEntityStatusUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkspaceEntityStatus(input) + return &out, nil +} + +type WorkspaceSkuNameEnum string + +const ( + WorkspaceSkuNameEnumCapacityReservation WorkspaceSkuNameEnum = "CapacityReservation" + WorkspaceSkuNameEnumFree WorkspaceSkuNameEnum = "Free" + WorkspaceSkuNameEnumLACluster WorkspaceSkuNameEnum = "LACluster" + WorkspaceSkuNameEnumPerGBTwoZeroOneEight WorkspaceSkuNameEnum = "PerGB2018" + WorkspaceSkuNameEnumPerNode WorkspaceSkuNameEnum = "PerNode" + WorkspaceSkuNameEnumPremium WorkspaceSkuNameEnum = "Premium" + WorkspaceSkuNameEnumStandalone WorkspaceSkuNameEnum = "Standalone" + WorkspaceSkuNameEnumStandard WorkspaceSkuNameEnum = "Standard" +) + +func PossibleValuesForWorkspaceSkuNameEnum() []string { + return []string{ + string(WorkspaceSkuNameEnumCapacityReservation), + string(WorkspaceSkuNameEnumFree), + string(WorkspaceSkuNameEnumLACluster), + string(WorkspaceSkuNameEnumPerGBTwoZeroOneEight), + string(WorkspaceSkuNameEnumPerNode), + string(WorkspaceSkuNameEnumPremium), + string(WorkspaceSkuNameEnumStandalone), + string(WorkspaceSkuNameEnumStandard), + } +} + +func parseWorkspaceSkuNameEnum(input string) (*WorkspaceSkuNameEnum, error) { + vals := map[string]WorkspaceSkuNameEnum{ + "capacityreservation": WorkspaceSkuNameEnumCapacityReservation, + "free": WorkspaceSkuNameEnumFree, + "lacluster": WorkspaceSkuNameEnumLACluster, + "pergb2018": WorkspaceSkuNameEnumPerGBTwoZeroOneEight, + "pernode": WorkspaceSkuNameEnumPerNode, + "premium": WorkspaceSkuNameEnumPremium, + "standalone": WorkspaceSkuNameEnumStandalone, + "standard": WorkspaceSkuNameEnumStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WorkspaceSkuNameEnum(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/id_gateway.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/id_gateway.go new file mode 100644 index 00000000000..53c49197a6e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/id_gateway.go @@ -0,0 +1,137 @@ +package workspaces + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = GatewayId{} + +// GatewayId is a struct representing the Resource ID for a Gateway +type GatewayId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string + GatewayId string +} + +// NewGatewayID returns a new GatewayId struct +func NewGatewayID(subscriptionId string, resourceGroupName string, workspaceName string, gatewayId string) GatewayId { + return GatewayId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + GatewayId: gatewayId, + } +} + +// ParseGatewayID parses 'input' into a GatewayId +func ParseGatewayID(input string) (*GatewayId, error) { + parser := resourceids.NewParserFromResourceIdType(GatewayId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GatewayId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, fmt.Errorf("the segment 'gatewayId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseGatewayIDInsensitively parses 'input' case-insensitively into a GatewayId +// note: this method should only be used for API response data and not user input +func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { + parser := resourceids.NewParserFromResourceIdType(GatewayId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := GatewayId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { + return nil, fmt.Errorf("the segment 'gatewayId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateGatewayID checks that 'input' can be parsed as a Gateway ID +func ValidateGatewayID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseGatewayID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Gateway ID +func (id GatewayId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OperationalInsights/workspaces/%s/gateways/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName, id.GatewayId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Gateway ID +func (id GatewayId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftOperationalInsights", "Microsoft.OperationalInsights", "Microsoft.OperationalInsights"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"), + resourceids.StaticSegment("staticGateways", "gateways", "gateways"), + resourceids.UserSpecifiedSegment("gatewayId", "gatewayIdValue"), + } +} + +// String returns a human-readable description of this Gateway ID +func (id GatewayId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + fmt.Sprintf("Gateway: %q", id.GatewayId), + } + return fmt.Sprintf("Gateway (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/id_intelligencepack.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/id_intelligencepack.go new file mode 100644 index 00000000000..062df530648 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/id_intelligencepack.go @@ -0,0 +1,137 @@ +package workspaces + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = IntelligencePackId{} + +// IntelligencePackId is a struct representing the Resource ID for a Intelligence Pack +type IntelligencePackId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string + IntelligencePackName string +} + +// NewIntelligencePackID returns a new IntelligencePackId struct +func NewIntelligencePackID(subscriptionId string, resourceGroupName string, workspaceName string, intelligencePackName string) IntelligencePackId { + return IntelligencePackId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + IntelligencePackName: intelligencePackName, + } +} + +// ParseIntelligencePackID parses 'input' into a IntelligencePackId +func ParseIntelligencePackID(input string) (*IntelligencePackId, error) { + parser := resourceids.NewParserFromResourceIdType(IntelligencePackId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntelligencePackId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + if id.IntelligencePackName, ok = parsed.Parsed["intelligencePackName"]; !ok { + return nil, fmt.Errorf("the segment 'intelligencePackName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseIntelligencePackIDInsensitively parses 'input' case-insensitively into a IntelligencePackId +// note: this method should only be used for API response data and not user input +func ParseIntelligencePackIDInsensitively(input string) (*IntelligencePackId, error) { + parser := resourceids.NewParserFromResourceIdType(IntelligencePackId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := IntelligencePackId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + if id.IntelligencePackName, ok = parsed.Parsed["intelligencePackName"]; !ok { + return nil, fmt.Errorf("the segment 'intelligencePackName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateIntelligencePackID checks that 'input' can be parsed as a Intelligence Pack ID +func ValidateIntelligencePackID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseIntelligencePackID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Intelligence Pack ID +func (id IntelligencePackId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OperationalInsights/workspaces/%s/intelligencePacks/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName, id.IntelligencePackName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Intelligence Pack ID +func (id IntelligencePackId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftOperationalInsights", "Microsoft.OperationalInsights", "Microsoft.OperationalInsights"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"), + resourceids.StaticSegment("staticIntelligencePacks", "intelligencePacks", "intelligencePacks"), + resourceids.UserSpecifiedSegment("intelligencePackName", "intelligencePackValue"), + } +} + +// String returns a human-readable description of this Intelligence Pack ID +func (id IntelligencePackId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + fmt.Sprintf("Intelligence Pack Name: %q", id.IntelligencePackName), + } + return fmt.Sprintf("Intelligence Pack (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/id_operation.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/id_operation.go new file mode 100644 index 00000000000..569b1af1246 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/id_operation.go @@ -0,0 +1,137 @@ +package workspaces + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = OperationId{} + +// OperationId is a struct representing the Resource ID for a Operation +type OperationId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string + PurgeId string +} + +// NewOperationID returns a new OperationId struct +func NewOperationID(subscriptionId string, resourceGroupName string, workspaceName string, purgeId string) OperationId { + return OperationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + PurgeId: purgeId, + } +} + +// ParseOperationID parses 'input' into a OperationId +func ParseOperationID(input string) (*OperationId, error) { + parser := resourceids.NewParserFromResourceIdType(OperationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OperationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + if id.PurgeId, ok = parsed.Parsed["purgeId"]; !ok { + return nil, fmt.Errorf("the segment 'purgeId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseOperationIDInsensitively parses 'input' case-insensitively into a OperationId +// note: this method should only be used for API response data and not user input +func ParseOperationIDInsensitively(input string) (*OperationId, error) { + parser := resourceids.NewParserFromResourceIdType(OperationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := OperationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + if id.PurgeId, ok = parsed.Parsed["purgeId"]; !ok { + return nil, fmt.Errorf("the segment 'purgeId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateOperationID checks that 'input' can be parsed as a Operation ID +func ValidateOperationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseOperationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Operation ID +func (id OperationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OperationalInsights/workspaces/%s/operations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName, id.PurgeId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Operation ID +func (id OperationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftOperationalInsights", "Microsoft.OperationalInsights", "Microsoft.OperationalInsights"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"), + resourceids.StaticSegment("staticOperations", "operations", "operations"), + resourceids.UserSpecifiedSegment("purgeId", "purgeIdValue"), + } +} + +// String returns a human-readable description of this Operation ID +func (id OperationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + fmt.Sprintf("Purge: %q", id.PurgeId), + } + return fmt.Sprintf("Operation (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/id_workspace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/id_workspace.go new file mode 100644 index 00000000000..9276c8a614b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/id_workspace.go @@ -0,0 +1,124 @@ +package workspaces + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = WorkspaceId{} + +// WorkspaceId is a struct representing the Resource ID for a Workspace +type WorkspaceId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string +} + +// NewWorkspaceID returns a new WorkspaceId struct +func NewWorkspaceID(subscriptionId string, resourceGroupName string, workspaceName string) WorkspaceId { + return WorkspaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + } +} + +// ParseWorkspaceID parses 'input' into a WorkspaceId +func ParseWorkspaceID(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkspaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseWorkspaceIDInsensitively parses 'input' case-insensitively into a WorkspaceId +// note: this method should only be used for API response data and not user input +func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkspaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID +func ValidateWorkspaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workspace ID +func (id WorkspaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OperationalInsights/workspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workspace ID +func (id WorkspaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftOperationalInsights", "Microsoft.OperationalInsights", "Microsoft.OperationalInsights"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"), + } +} + +// String returns a human-readable description of this Workspace ID +func (id WorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + } + return fmt.Sprintf("Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_createorupdate_autorest.go new file mode 100644 index 00000000000..7e742b0f05f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c WorkspacesClient) CreateOrUpdate(ctx context.Context, id WorkspaceId, input Workspace) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c WorkspacesClient) CreateOrUpdateThenPoll(ctx context.Context, id WorkspaceId, input Workspace) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c WorkspacesClient) preparerForCreateOrUpdate(ctx context.Context, id WorkspaceId, input Workspace) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c WorkspacesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_delete_autorest.go new file mode 100644 index 00000000000..083805904ec --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_delete_autorest.go @@ -0,0 +1,107 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + Force *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Force != nil { + out["force"] = *o.Force + } + + return out +} + +// Delete ... +func (c WorkspacesClient) Delete(ctx context.Context, id WorkspaceId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c WorkspacesClient) DeleteThenPoll(ctx context.Context, id WorkspaceId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c WorkspacesClient) preparerForDelete(ctx context.Context, id WorkspaceId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c WorkspacesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_gatewaysdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_gatewaysdelete_autorest.go new file mode 100644 index 00000000000..e6aacf7d573 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_gatewaysdelete_autorest.go @@ -0,0 +1,66 @@ +package workspaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GatewaysDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// GatewaysDelete ... +func (c WorkspacesClient) GatewaysDelete(ctx context.Context, id GatewayId) (result GatewaysDeleteOperationResponse, err error) { + req, err := c.preparerForGatewaysDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "GatewaysDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "GatewaysDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGatewaysDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "GatewaysDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGatewaysDelete prepares the GatewaysDelete request. +func (c WorkspacesClient) preparerForGatewaysDelete(ctx context.Context, id GatewayId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGatewaysDelete handles the response to the GatewaysDelete request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForGatewaysDelete(resp *http.Response) (result GatewaysDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_get_autorest.go new file mode 100644 index 00000000000..c16924832e3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_get_autorest.go @@ -0,0 +1,68 @@ +package workspaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Workspace +} + +// Get ... +func (c WorkspacesClient) Get(ctx context.Context, id WorkspaceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c WorkspacesClient) preparerForGet(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_intelligencepacksdisable_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_intelligencepacksdisable_autorest.go new file mode 100644 index 00000000000..d20929aca98 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_intelligencepacksdisable_autorest.go @@ -0,0 +1,67 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntelligencePacksDisableOperationResponse struct { + HttpResponse *http.Response +} + +// IntelligencePacksDisable ... +func (c WorkspacesClient) IntelligencePacksDisable(ctx context.Context, id IntelligencePackId) (result IntelligencePacksDisableOperationResponse, err error) { + req, err := c.preparerForIntelligencePacksDisable(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "IntelligencePacksDisable", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "IntelligencePacksDisable", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForIntelligencePacksDisable(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "IntelligencePacksDisable", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForIntelligencePacksDisable prepares the IntelligencePacksDisable request. +func (c WorkspacesClient) preparerForIntelligencePacksDisable(ctx context.Context, id IntelligencePackId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/disable", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForIntelligencePacksDisable handles the response to the IntelligencePacksDisable request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForIntelligencePacksDisable(resp *http.Response) (result IntelligencePacksDisableOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_intelligencepacksenable_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_intelligencepacksenable_autorest.go new file mode 100644 index 00000000000..7427a62e3cf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_intelligencepacksenable_autorest.go @@ -0,0 +1,67 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntelligencePacksEnableOperationResponse struct { + HttpResponse *http.Response +} + +// IntelligencePacksEnable ... +func (c WorkspacesClient) IntelligencePacksEnable(ctx context.Context, id IntelligencePackId) (result IntelligencePacksEnableOperationResponse, err error) { + req, err := c.preparerForIntelligencePacksEnable(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "IntelligencePacksEnable", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "IntelligencePacksEnable", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForIntelligencePacksEnable(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "IntelligencePacksEnable", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForIntelligencePacksEnable prepares the IntelligencePacksEnable request. +func (c WorkspacesClient) preparerForIntelligencePacksEnable(ctx context.Context, id IntelligencePackId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/enable", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForIntelligencePacksEnable handles the response to the IntelligencePacksEnable request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForIntelligencePacksEnable(resp *http.Response) (result IntelligencePacksEnableOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_intelligencepackslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_intelligencepackslist_autorest.go new file mode 100644 index 00000000000..9bb8d7ac3d8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_intelligencepackslist_autorest.go @@ -0,0 +1,69 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntelligencePacksListOperationResponse struct { + HttpResponse *http.Response + Model *[]IntelligencePack +} + +// IntelligencePacksList ... +func (c WorkspacesClient) IntelligencePacksList(ctx context.Context, id WorkspaceId) (result IntelligencePacksListOperationResponse, err error) { + req, err := c.preparerForIntelligencePacksList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "IntelligencePacksList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "IntelligencePacksList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForIntelligencePacksList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "IntelligencePacksList", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForIntelligencePacksList prepares the IntelligencePacksList request. +func (c WorkspacesClient) preparerForIntelligencePacksList(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/intelligencePacks", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForIntelligencePacksList handles the response to the IntelligencePacksList request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForIntelligencePacksList(resp *http.Response) (result IntelligencePacksListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_list_autorest.go new file mode 100644 index 00000000000..4ce637522a8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_list_autorest.go @@ -0,0 +1,70 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *WorkspaceListResult +} + +// List ... +func (c WorkspacesClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c WorkspacesClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.OperationalInsights/workspaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..558cc363bf8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_listbyresourcegroup_autorest.go @@ -0,0 +1,70 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *WorkspaceListResult +} + +// ListByResourceGroup ... +func (c WorkspacesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c WorkspacesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.OperationalInsights/workspaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_managementgroupslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_managementgroupslist_autorest.go new file mode 100644 index 00000000000..4da6f94504b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_managementgroupslist_autorest.go @@ -0,0 +1,69 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagementGroupsListOperationResponse struct { + HttpResponse *http.Response + Model *WorkspaceListManagementGroupsResult +} + +// ManagementGroupsList ... +func (c WorkspacesClient) ManagementGroupsList(ctx context.Context, id WorkspaceId) (result ManagementGroupsListOperationResponse, err error) { + req, err := c.preparerForManagementGroupsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ManagementGroupsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ManagementGroupsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForManagementGroupsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ManagementGroupsList", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForManagementGroupsList prepares the ManagementGroupsList request. +func (c WorkspacesClient) preparerForManagementGroupsList(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/managementGroups", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForManagementGroupsList handles the response to the ManagementGroupsList request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForManagementGroupsList(resp *http.Response) (result ManagementGroupsListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_schemaget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_schemaget_autorest.go new file mode 100644 index 00000000000..b2810ea40ca --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_schemaget_autorest.go @@ -0,0 +1,69 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SchemaGetOperationResponse struct { + HttpResponse *http.Response + Model *SearchGetSchemaResponse +} + +// SchemaGet ... +func (c WorkspacesClient) SchemaGet(ctx context.Context, id WorkspaceId) (result SchemaGetOperationResponse, err error) { + req, err := c.preparerForSchemaGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "SchemaGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "SchemaGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSchemaGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "SchemaGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSchemaGet prepares the SchemaGet request. +func (c WorkspacesClient) preparerForSchemaGet(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/schema", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSchemaGet handles the response to the SchemaGet request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForSchemaGet(resp *http.Response) (result SchemaGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_sharedkeysgetsharedkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_sharedkeysgetsharedkeys_autorest.go new file mode 100644 index 00000000000..80de1dd4d24 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_sharedkeysgetsharedkeys_autorest.go @@ -0,0 +1,69 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedKeysGetSharedKeysOperationResponse struct { + HttpResponse *http.Response + Model *SharedKeys +} + +// SharedKeysGetSharedKeys ... +func (c WorkspacesClient) SharedKeysGetSharedKeys(ctx context.Context, id WorkspaceId) (result SharedKeysGetSharedKeysOperationResponse, err error) { + req, err := c.preparerForSharedKeysGetSharedKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "SharedKeysGetSharedKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "SharedKeysGetSharedKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSharedKeysGetSharedKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "SharedKeysGetSharedKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSharedKeysGetSharedKeys prepares the SharedKeysGetSharedKeys request. +func (c WorkspacesClient) preparerForSharedKeysGetSharedKeys(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/sharedKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSharedKeysGetSharedKeys handles the response to the SharedKeysGetSharedKeys request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForSharedKeysGetSharedKeys(resp *http.Response) (result SharedKeysGetSharedKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_sharedkeysregenerate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_sharedkeysregenerate_autorest.go new file mode 100644 index 00000000000..05d144e6efb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_sharedkeysregenerate_autorest.go @@ -0,0 +1,69 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedKeysRegenerateOperationResponse struct { + HttpResponse *http.Response + Model *SharedKeys +} + +// SharedKeysRegenerate ... +func (c WorkspacesClient) SharedKeysRegenerate(ctx context.Context, id WorkspaceId) (result SharedKeysRegenerateOperationResponse, err error) { + req, err := c.preparerForSharedKeysRegenerate(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "SharedKeysRegenerate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "SharedKeysRegenerate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSharedKeysRegenerate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "SharedKeysRegenerate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSharedKeysRegenerate prepares the SharedKeysRegenerate request. +func (c WorkspacesClient) preparerForSharedKeysRegenerate(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateSharedKey", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSharedKeysRegenerate handles the response to the SharedKeysRegenerate request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForSharedKeysRegenerate(resp *http.Response) (result SharedKeysRegenerateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_update_autorest.go new file mode 100644 index 00000000000..dbc9dc29192 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_update_autorest.go @@ -0,0 +1,69 @@ +package workspaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Workspace +} + +// Update ... +func (c WorkspacesClient) Update(ctx context.Context, id WorkspaceId, input WorkspacePatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c WorkspacesClient) preparerForUpdate(ctx context.Context, id WorkspaceId, input WorkspacePatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_usageslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_usageslist_autorest.go new file mode 100644 index 00000000000..62ae0cca608 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_usageslist_autorest.go @@ -0,0 +1,69 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UsagesListOperationResponse struct { + HttpResponse *http.Response + Model *WorkspaceListUsagesResult +} + +// UsagesList ... +func (c WorkspacesClient) UsagesList(ctx context.Context, id WorkspaceId) (result UsagesListOperationResponse, err error) { + req, err := c.preparerForUsagesList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "UsagesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "UsagesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUsagesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "UsagesList", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUsagesList prepares the UsagesList request. +func (c WorkspacesClient) preparerForUsagesList(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/usages", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUsagesList handles the response to the UsagesList request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForUsagesList(resp *http.Response) (result UsagesListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_workspacepurgegetpurgestatus_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_workspacepurgegetpurgestatus_autorest.go new file mode 100644 index 00000000000..670d92ebd64 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_workspacepurgegetpurgestatus_autorest.go @@ -0,0 +1,68 @@ +package workspaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacePurgeGetPurgeStatusOperationResponse struct { + HttpResponse *http.Response + Model *WorkspacePurgeStatusResponse +} + +// WorkspacePurgeGetPurgeStatus ... +func (c WorkspacesClient) WorkspacePurgeGetPurgeStatus(ctx context.Context, id OperationId) (result WorkspacePurgeGetPurgeStatusOperationResponse, err error) { + req, err := c.preparerForWorkspacePurgeGetPurgeStatus(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "WorkspacePurgeGetPurgeStatus", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "WorkspacePurgeGetPurgeStatus", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkspacePurgeGetPurgeStatus(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "WorkspacePurgeGetPurgeStatus", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkspacePurgeGetPurgeStatus prepares the WorkspacePurgeGetPurgeStatus request. +func (c WorkspacesClient) preparerForWorkspacePurgeGetPurgeStatus(ctx context.Context, id OperationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkspacePurgeGetPurgeStatus handles the response to the WorkspacePurgeGetPurgeStatus request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForWorkspacePurgeGetPurgeStatus(resp *http.Response) (result WorkspacePurgeGetPurgeStatusOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_workspacepurgepurge_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_workspacepurgepurge_autorest.go new file mode 100644 index 00000000000..44cc6cadfa3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/method_workspacepurgepurge_autorest.go @@ -0,0 +1,70 @@ +package workspaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacePurgePurgeOperationResponse struct { + HttpResponse *http.Response + Model *WorkspacePurgeResponse +} + +// WorkspacePurgePurge ... +func (c WorkspacesClient) WorkspacePurgePurge(ctx context.Context, id WorkspaceId, input WorkspacePurgeBody) (result WorkspacePurgePurgeOperationResponse, err error) { + req, err := c.preparerForWorkspacePurgePurge(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "WorkspacePurgePurge", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "WorkspacePurgePurge", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForWorkspacePurgePurge(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "WorkspacePurgePurge", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForWorkspacePurgePurge prepares the WorkspacePurgePurge request. +func (c WorkspacesClient) preparerForWorkspacePurgePurge(ctx context.Context, id WorkspaceId, input WorkspacePurgeBody) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/purge", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForWorkspacePurgePurge handles the response to the WorkspacePurgePurge request. The method always +// closes the http.Response Body. +func (c WorkspacesClient) responderForWorkspacePurgePurge(resp *http.Response) (result WorkspacePurgePurgeOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_coresummary.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_coresummary.go new file mode 100644 index 00000000000..df29cb10b50 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_coresummary.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CoreSummary struct { + NumberOfDocuments int64 `json:"numberOfDocuments"` + Status *string `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_intelligencepack.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_intelligencepack.go new file mode 100644 index 00000000000..813f158bed6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_intelligencepack.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IntelligencePack struct { + DisplayName *string `json:"displayName,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_managementgroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_managementgroup.go new file mode 100644 index 00000000000..dcb938c5793 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_managementgroup.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagementGroup struct { + Properties *ManagementGroupProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_managementgroupproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_managementgroupproperties.go new file mode 100644 index 00000000000..3d1b0b13e6e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_managementgroupproperties.go @@ -0,0 +1,45 @@ +package workspaces + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagementGroupProperties struct { + Created *string `json:"created,omitempty"` + DataReceived *string `json:"dataReceived,omitempty"` + Id *string `json:"id,omitempty"` + IsGateway *bool `json:"isGateway,omitempty"` + Name *string `json:"name,omitempty"` + ServerCount *int64 `json:"serverCount,omitempty"` + Sku *string `json:"sku,omitempty"` + Version *string `json:"version,omitempty"` +} + +func (o *ManagementGroupProperties) GetCreatedAsTime() (*time.Time, error) { + if o.Created == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") +} + +func (o *ManagementGroupProperties) SetCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Created = &formatted +} + +func (o *ManagementGroupProperties) GetDataReceivedAsTime() (*time.Time, error) { + if o.DataReceived == nil { + return nil, nil + } + return dates.ParseAsFormat(o.DataReceived, "2006-01-02T15:04:05Z07:00") +} + +func (o *ManagementGroupProperties) SetDataReceivedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.DataReceived = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_metricname.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_metricname.go new file mode 100644 index 00000000000..f33cbbc5f5e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_metricname.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MetricName struct { + LocalizedValue *string `json:"localizedValue,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_privatelinkscopedresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_privatelinkscopedresource.go new file mode 100644 index 00000000000..834d7f3c801 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_privatelinkscopedresource.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkScopedResource struct { + ResourceId *string `json:"resourceId,omitempty"` + ScopeId *string `json:"scopeId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_searchgetschemaresponse.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_searchgetschemaresponse.go new file mode 100644 index 00000000000..5cdb4d9f35d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_searchgetschemaresponse.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SearchGetSchemaResponse struct { + Metadata *SearchMetadata `json:"metadata,omitempty"` + Value *[]SearchSchemaValue `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_searchmetadata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_searchmetadata.go new file mode 100644 index 00000000000..0929b2438d0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_searchmetadata.go @@ -0,0 +1,54 @@ +package workspaces + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SearchMetadata struct { + AggregatedGroupingFields *string `json:"aggregatedGroupingFields,omitempty"` + AggregatedValueField *string `json:"aggregatedValueField,omitempty"` + CoreSummaries *[]CoreSummary `json:"coreSummaries,omitempty"` + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + LastUpdated *string `json:"lastUpdated,omitempty"` + Max *int64 `json:"max,omitempty"` + RequestId *string `json:"requestId,omitempty"` + RequestTime *int64 `json:"requestTime,omitempty"` + ResultType *string `json:"resultType,omitempty"` + Schema *SearchMetadataSchema `json:"schema,omitempty"` + Sort *[]SearchSort `json:"sort,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *string `json:"status,omitempty"` + Sum *int64 `json:"sum,omitempty"` + Top *int64 `json:"top,omitempty"` + Total *int64 `json:"total,omitempty"` +} + +func (o *SearchMetadata) GetLastUpdatedAsTime() (*time.Time, error) { + if o.LastUpdated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdated, "2006-01-02T15:04:05Z07:00") +} + +func (o *SearchMetadata) SetLastUpdatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdated = &formatted +} + +func (o *SearchMetadata) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *SearchMetadata) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_searchmetadataschema.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_searchmetadataschema.go new file mode 100644 index 00000000000..0e39da0d0e0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_searchmetadataschema.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SearchMetadataSchema struct { + Name *string `json:"name,omitempty"` + Version *int64 `json:"version,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_searchschemavalue.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_searchschemavalue.go new file mode 100644 index 00000000000..86826b00b37 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_searchschemavalue.go @@ -0,0 +1,14 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SearchSchemaValue struct { + DisplayName *string `json:"displayName,omitempty"` + Facet bool `json:"facet"` + Indexed bool `json:"indexed"` + Name *string `json:"name,omitempty"` + OwnerType *[]string `json:"ownerType,omitempty"` + Stored bool `json:"stored"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_searchsort.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_searchsort.go new file mode 100644 index 00000000000..a7740dc9365 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_searchsort.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SearchSort struct { + Name *string `json:"name,omitempty"` + Order *SearchSortEnum `json:"order,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_sharedkeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_sharedkeys.go new file mode 100644 index 00000000000..c11550ea99e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_sharedkeys.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedKeys struct { + PrimarySharedKey *string `json:"primarySharedKey,omitempty"` + SecondarySharedKey *string `json:"secondarySharedKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_usagemetric.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_usagemetric.go new file mode 100644 index 00000000000..c2fb1de1937 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_usagemetric.go @@ -0,0 +1,31 @@ +package workspaces + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UsageMetric struct { + CurrentValue *float64 `json:"currentValue,omitempty"` + Limit *float64 `json:"limit,omitempty"` + Name *MetricName `json:"name,omitempty"` + NextResetTime *string `json:"nextResetTime,omitempty"` + QuotaPeriod *string `json:"quotaPeriod,omitempty"` + Unit *string `json:"unit,omitempty"` +} + +func (o *UsageMetric) GetNextResetTimeAsTime() (*time.Time, error) { + if o.NextResetTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NextResetTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *UsageMetric) SetNextResetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NextResetTime = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspace.go new file mode 100644 index 00000000000..66d751ae162 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspace.go @@ -0,0 +1,14 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Workspace struct { + ETag *string `json:"eTag,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *WorkspaceProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacecapping.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacecapping.go new file mode 100644 index 00000000000..8a654ab52f0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacecapping.go @@ -0,0 +1,10 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceCapping struct { + DailyQuotaGb *float64 `json:"dailyQuotaGb,omitempty"` + DataIngestionStatus *DataIngestionStatus `json:"dataIngestionStatus,omitempty"` + QuotaNextResetTime *string `json:"quotaNextResetTime,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacelistmanagementgroupsresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacelistmanagementgroupsresult.go new file mode 100644 index 00000000000..101e18a9b88 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacelistmanagementgroupsresult.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceListManagementGroupsResult struct { + Value *[]ManagementGroup `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacelistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacelistresult.go new file mode 100644 index 00000000000..f3a9c4aa6d8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacelistresult.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceListResult struct { + Value *[]Workspace `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacelistusagesresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacelistusagesresult.go new file mode 100644 index 00000000000..2a0beb349b1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacelistusagesresult.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceListUsagesResult struct { + Value *[]UsageMetric `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacepatch.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacepatch.go new file mode 100644 index 00000000000..1de5ddceb7a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacepatch.go @@ -0,0 +1,13 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacePatch struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *WorkspaceProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspaceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspaceproperties.go new file mode 100644 index 00000000000..d6964c4b77b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspaceproperties.go @@ -0,0 +1,19 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceProperties struct { + CreatedDate *string `json:"createdDate,omitempty"` + CustomerId *string `json:"customerId,omitempty"` + Features *interface{} `json:"features,omitempty"` + ForceCmkForQuery *bool `json:"forceCmkForQuery,omitempty"` + ModifiedDate *string `json:"modifiedDate,omitempty"` + PrivateLinkScopedResources *[]PrivateLinkScopedResource `json:"privateLinkScopedResources,omitempty"` + ProvisioningState *WorkspaceEntityStatus `json:"provisioningState,omitempty"` + PublicNetworkAccessForIngestion *PublicNetworkAccessType `json:"publicNetworkAccessForIngestion,omitempty"` + PublicNetworkAccessForQuery *PublicNetworkAccessType `json:"publicNetworkAccessForQuery,omitempty"` + RetentionInDays *int64 `json:"retentionInDays,omitempty"` + Sku *WorkspaceSku `json:"sku,omitempty"` + WorkspaceCapping *WorkspaceCapping `json:"workspaceCapping,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacepurgebody.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacepurgebody.go new file mode 100644 index 00000000000..338b9dd175c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacepurgebody.go @@ -0,0 +1,9 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacePurgeBody struct { + Filters []WorkspacePurgeBodyFilters `json:"filters"` + Table string `json:"table"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacepurgebodyfilters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacepurgebodyfilters.go new file mode 100644 index 00000000000..a9cded5abc2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacepurgebodyfilters.go @@ -0,0 +1,11 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacePurgeBodyFilters struct { + Column *string `json:"column,omitempty"` + Key *string `json:"key,omitempty"` + Operator *string `json:"operator,omitempty"` + Value *interface{} `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacepurgeresponse.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacepurgeresponse.go new file mode 100644 index 00000000000..0187a62e139 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacepurgeresponse.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacePurgeResponse struct { + OperationId string `json:"operationId"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacepurgestatusresponse.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacepurgestatusresponse.go new file mode 100644 index 00000000000..b4c34494dc2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacepurgestatusresponse.go @@ -0,0 +1,8 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspacePurgeStatusResponse struct { + Status PurgeState `json:"status"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacesku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacesku.go new file mode 100644 index 00000000000..665bbf9c9d9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/model_workspacesku.go @@ -0,0 +1,11 @@ +package workspaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WorkspaceSku struct { + CapacityReservationLevel *int64 `json:"capacityReservationLevel,omitempty"` + LastSkuUpdate *string `json:"lastSkuUpdate,omitempty"` + MaxCapacityReservationLevel *int64 `json:"maxCapacityReservationLevel,omitempty"` + Name WorkspaceSkuNameEnum `json:"name"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/version.go new file mode 100644 index 00000000000..34a779bd000 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces/version.go @@ -0,0 +1,12 @@ +package workspaces + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/workspaces/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/README.md new file mode 100644 index 00000000000..5e27d94b3b6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/README.md @@ -0,0 +1,432 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations` Documentation + +The `remediations` SDK allows for interaction with the Azure Resource Manager Service `policyinsights` (API Version `2021-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations" +``` + + +### Client Initialization + +```go +client := remediations.NewRemediationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RemediationsClient.RemediationsCancelAtManagementGroup` + +```go +ctx := context.TODO() +id := remediations.NewProviders2RemediationID("managementGroupIdValue", "remediationValue") + +read, err := client.RemediationsCancelAtManagementGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsCancelAtResource` + +```go +ctx := context.TODO() +id := remediations.NewScopedRemediationID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "remediationValue") + +read, err := client.RemediationsCancelAtResource(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsCancelAtResourceGroup` + +```go +ctx := context.TODO() +id := remediations.NewProviderRemediationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "remediationValue") + +read, err := client.RemediationsCancelAtResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsCancelAtSubscription` + +```go +ctx := context.TODO() +id := remediations.NewRemediationID("12345678-1234-9876-4563-123456789012", "remediationValue") + +read, err := client.RemediationsCancelAtSubscription(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsCreateOrUpdateAtManagementGroup` + +```go +ctx := context.TODO() +id := remediations.NewProviders2RemediationID("managementGroupIdValue", "remediationValue") + +payload := remediations.Remediation{ + // ... +} + + +read, err := client.RemediationsCreateOrUpdateAtManagementGroup(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsCreateOrUpdateAtResource` + +```go +ctx := context.TODO() +id := remediations.NewScopedRemediationID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "remediationValue") + +payload := remediations.Remediation{ + // ... +} + + +read, err := client.RemediationsCreateOrUpdateAtResource(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsCreateOrUpdateAtResourceGroup` + +```go +ctx := context.TODO() +id := remediations.NewProviderRemediationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "remediationValue") + +payload := remediations.Remediation{ + // ... +} + + +read, err := client.RemediationsCreateOrUpdateAtResourceGroup(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsCreateOrUpdateAtSubscription` + +```go +ctx := context.TODO() +id := remediations.NewRemediationID("12345678-1234-9876-4563-123456789012", "remediationValue") + +payload := remediations.Remediation{ + // ... +} + + +read, err := client.RemediationsCreateOrUpdateAtSubscription(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsDeleteAtManagementGroup` + +```go +ctx := context.TODO() +id := remediations.NewProviders2RemediationID("managementGroupIdValue", "remediationValue") + +read, err := client.RemediationsDeleteAtManagementGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsDeleteAtResource` + +```go +ctx := context.TODO() +id := remediations.NewScopedRemediationID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "remediationValue") + +read, err := client.RemediationsDeleteAtResource(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsDeleteAtResourceGroup` + +```go +ctx := context.TODO() +id := remediations.NewProviderRemediationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "remediationValue") + +read, err := client.RemediationsDeleteAtResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsDeleteAtSubscription` + +```go +ctx := context.TODO() +id := remediations.NewRemediationID("12345678-1234-9876-4563-123456789012", "remediationValue") + +read, err := client.RemediationsDeleteAtSubscription(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsGetAtManagementGroup` + +```go +ctx := context.TODO() +id := remediations.NewProviders2RemediationID("managementGroupIdValue", "remediationValue") + +read, err := client.RemediationsGetAtManagementGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsGetAtResource` + +```go +ctx := context.TODO() +id := remediations.NewScopedRemediationID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "remediationValue") + +read, err := client.RemediationsGetAtResource(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsGetAtResourceGroup` + +```go +ctx := context.TODO() +id := remediations.NewProviderRemediationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "remediationValue") + +read, err := client.RemediationsGetAtResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsGetAtSubscription` + +```go +ctx := context.TODO() +id := remediations.NewRemediationID("12345678-1234-9876-4563-123456789012", "remediationValue") + +read, err := client.RemediationsGetAtSubscription(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RemediationsClient.RemediationsListDeploymentsAtManagementGroup` + +```go +ctx := context.TODO() +id := remediations.NewProviders2RemediationID("managementGroupIdValue", "remediationValue") + +// alternatively `client.RemediationsListDeploymentsAtManagementGroup(ctx, id, remediations.DefaultRemediationsListDeploymentsAtManagementGroupOperationOptions())` can be used to do batched pagination +items, err := client.RemediationsListDeploymentsAtManagementGroupComplete(ctx, id, remediations.DefaultRemediationsListDeploymentsAtManagementGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RemediationsClient.RemediationsListDeploymentsAtResource` + +```go +ctx := context.TODO() +id := remediations.NewScopedRemediationID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "remediationValue") + +// alternatively `client.RemediationsListDeploymentsAtResource(ctx, id, remediations.DefaultRemediationsListDeploymentsAtResourceOperationOptions())` can be used to do batched pagination +items, err := client.RemediationsListDeploymentsAtResourceComplete(ctx, id, remediations.DefaultRemediationsListDeploymentsAtResourceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RemediationsClient.RemediationsListDeploymentsAtResourceGroup` + +```go +ctx := context.TODO() +id := remediations.NewProviderRemediationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "remediationValue") + +// alternatively `client.RemediationsListDeploymentsAtResourceGroup(ctx, id, remediations.DefaultRemediationsListDeploymentsAtResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.RemediationsListDeploymentsAtResourceGroupComplete(ctx, id, remediations.DefaultRemediationsListDeploymentsAtResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RemediationsClient.RemediationsListDeploymentsAtSubscription` + +```go +ctx := context.TODO() +id := remediations.NewRemediationID("12345678-1234-9876-4563-123456789012", "remediationValue") + +// alternatively `client.RemediationsListDeploymentsAtSubscription(ctx, id, remediations.DefaultRemediationsListDeploymentsAtSubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.RemediationsListDeploymentsAtSubscriptionComplete(ctx, id, remediations.DefaultRemediationsListDeploymentsAtSubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RemediationsClient.RemediationsListForManagementGroup` + +```go +ctx := context.TODO() +id := remediations.NewManagementGroupID("managementGroupIdValue") + +// alternatively `client.RemediationsListForManagementGroup(ctx, id, remediations.DefaultRemediationsListForManagementGroupOperationOptions())` can be used to do batched pagination +items, err := client.RemediationsListForManagementGroupComplete(ctx, id, remediations.DefaultRemediationsListForManagementGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RemediationsClient.RemediationsListForResource` + +```go +ctx := context.TODO() +id := remediations.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +// alternatively `client.RemediationsListForResource(ctx, id, remediations.DefaultRemediationsListForResourceOperationOptions())` can be used to do batched pagination +items, err := client.RemediationsListForResourceComplete(ctx, id, remediations.DefaultRemediationsListForResourceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RemediationsClient.RemediationsListForResourceGroup` + +```go +ctx := context.TODO() +id := remediations.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.RemediationsListForResourceGroup(ctx, id, remediations.DefaultRemediationsListForResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.RemediationsListForResourceGroupComplete(ctx, id, remediations.DefaultRemediationsListForResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RemediationsClient.RemediationsListForSubscription` + +```go +ctx := context.TODO() +id := remediations.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.RemediationsListForSubscription(ctx, id, remediations.DefaultRemediationsListForSubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.RemediationsListForSubscriptionComplete(ctx, id, remediations.DefaultRemediationsListForSubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/client.go new file mode 100644 index 00000000000..d1ad12f4efb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/client.go @@ -0,0 +1,18 @@ +package remediations + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsClient struct { + Client autorest.Client + baseUri string +} + +func NewRemediationsClientWithBaseURI(endpoint string) RemediationsClient { + return RemediationsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/constants.go new file mode 100644 index 00000000000..e4b3feb5cd6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/constants.go @@ -0,0 +1,34 @@ +package remediations + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceDiscoveryMode string + +const ( + ResourceDiscoveryModeExistingNonCompliant ResourceDiscoveryMode = "ExistingNonCompliant" + ResourceDiscoveryModeReEvaluateCompliance ResourceDiscoveryMode = "ReEvaluateCompliance" +) + +func PossibleValuesForResourceDiscoveryMode() []string { + return []string{ + string(ResourceDiscoveryModeExistingNonCompliant), + string(ResourceDiscoveryModeReEvaluateCompliance), + } +} + +func parseResourceDiscoveryMode(input string) (*ResourceDiscoveryMode, error) { + vals := map[string]ResourceDiscoveryMode{ + "existingnoncompliant": ResourceDiscoveryModeExistingNonCompliant, + "reevaluatecompliance": ResourceDiscoveryModeReEvaluateCompliance, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceDiscoveryMode(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/id_managementgroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/id_managementgroup.go new file mode 100644 index 00000000000..dfce273e8e8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/id_managementgroup.go @@ -0,0 +1,98 @@ +package remediations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ManagementGroupId{} + +// ManagementGroupId is a struct representing the Resource ID for a Management Group +type ManagementGroupId struct { + ManagementGroupId string +} + +// NewManagementGroupID returns a new ManagementGroupId struct +func NewManagementGroupID(managementGroupId string) ManagementGroupId { + return ManagementGroupId{ + ManagementGroupId: managementGroupId, + } +} + +// ParseManagementGroupID parses 'input' into a ManagementGroupId +func ParseManagementGroupID(input string) (*ManagementGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagementGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagementGroupId{} + + if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { + return nil, fmt.Errorf("the segment 'managementGroupId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseManagementGroupIDInsensitively parses 'input' case-insensitively into a ManagementGroupId +// note: this method should only be used for API response data and not user input +func ParseManagementGroupIDInsensitively(input string) (*ManagementGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagementGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagementGroupId{} + + if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { + return nil, fmt.Errorf("the segment 'managementGroupId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateManagementGroupID checks that 'input' can be parsed as a Management Group ID +func ValidateManagementGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseManagementGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Management Group ID +func (id ManagementGroupId) ID() string { + fmtString := "/providers/Microsoft.Management/managementGroups/%s" + return fmt.Sprintf(fmtString, id.ManagementGroupId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Management Group ID +func (id ManagementGroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.StaticSegment("managementGroupsNamespace", "Microsoft.Management", "Microsoft.Management"), + resourceids.StaticSegment("staticManagementGroups", "managementGroups", "managementGroups"), + resourceids.UserSpecifiedSegment("managementGroupId", "managementGroupIdValue"), + } +} + +// String returns a human-readable description of this Management Group ID +func (id ManagementGroupId) String() string { + components := []string{ + fmt.Sprintf("Management Group: %q", id.ManagementGroupId), + } + return fmt.Sprintf("Management Group (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/id_providerremediation.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/id_providerremediation.go new file mode 100644 index 00000000000..7b2254a3ac4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/id_providerremediation.go @@ -0,0 +1,124 @@ +package remediations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ProviderRemediationId{} + +// ProviderRemediationId is a struct representing the Resource ID for a Provider Remediation +type ProviderRemediationId struct { + SubscriptionId string + ResourceGroupName string + RemediationName string +} + +// NewProviderRemediationID returns a new ProviderRemediationId struct +func NewProviderRemediationID(subscriptionId string, resourceGroupName string, remediationName string) ProviderRemediationId { + return ProviderRemediationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RemediationName: remediationName, + } +} + +// ParseProviderRemediationID parses 'input' into a ProviderRemediationId +func ParseProviderRemediationID(input string) (*ProviderRemediationId, error) { + parser := resourceids.NewParserFromResourceIdType(ProviderRemediationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProviderRemediationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { + return nil, fmt.Errorf("the segment 'remediationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseProviderRemediationIDInsensitively parses 'input' case-insensitively into a ProviderRemediationId +// note: this method should only be used for API response data and not user input +func ParseProviderRemediationIDInsensitively(input string) (*ProviderRemediationId, error) { + parser := resourceids.NewParserFromResourceIdType(ProviderRemediationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ProviderRemediationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { + return nil, fmt.Errorf("the segment 'remediationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateProviderRemediationID checks that 'input' can be parsed as a Provider Remediation ID +func ValidateProviderRemediationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProviderRemediationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Provider Remediation ID +func (id ProviderRemediationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.PolicyInsights/remediations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RemediationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Provider Remediation ID +func (id ProviderRemediationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftPolicyInsights", "Microsoft.PolicyInsights", "Microsoft.PolicyInsights"), + resourceids.StaticSegment("staticRemediations", "remediations", "remediations"), + resourceids.UserSpecifiedSegment("remediationName", "remediationValue"), + } +} + +// String returns a human-readable description of this Provider Remediation ID +func (id ProviderRemediationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Remediation Name: %q", id.RemediationName), + } + return fmt.Sprintf("Provider Remediation (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/id_providers2remediation.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/id_providers2remediation.go new file mode 100644 index 00000000000..2dfecf80007 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/id_providers2remediation.go @@ -0,0 +1,113 @@ +package remediations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = Providers2RemediationId{} + +// Providers2RemediationId is a struct representing the Resource ID for a Providers 2 Remediation +type Providers2RemediationId struct { + ManagementGroupId string + RemediationName string +} + +// NewProviders2RemediationID returns a new Providers2RemediationId struct +func NewProviders2RemediationID(managementGroupId string, remediationName string) Providers2RemediationId { + return Providers2RemediationId{ + ManagementGroupId: managementGroupId, + RemediationName: remediationName, + } +} + +// ParseProviders2RemediationID parses 'input' into a Providers2RemediationId +func ParseProviders2RemediationID(input string) (*Providers2RemediationId, error) { + parser := resourceids.NewParserFromResourceIdType(Providers2RemediationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := Providers2RemediationId{} + + if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { + return nil, fmt.Errorf("the segment 'managementGroupId' was not found in the resource id %q", input) + } + + if id.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { + return nil, fmt.Errorf("the segment 'remediationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseProviders2RemediationIDInsensitively parses 'input' case-insensitively into a Providers2RemediationId +// note: this method should only be used for API response data and not user input +func ParseProviders2RemediationIDInsensitively(input string) (*Providers2RemediationId, error) { + parser := resourceids.NewParserFromResourceIdType(Providers2RemediationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := Providers2RemediationId{} + + if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { + return nil, fmt.Errorf("the segment 'managementGroupId' was not found in the resource id %q", input) + } + + if id.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { + return nil, fmt.Errorf("the segment 'remediationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateProviders2RemediationID checks that 'input' can be parsed as a Providers 2 Remediation ID +func ValidateProviders2RemediationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProviders2RemediationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Providers 2 Remediation ID +func (id Providers2RemediationId) ID() string { + fmtString := "/providers/Microsoft.Management/managementGroups/%s/providers/Microsoft.PolicyInsights/remediations/%s" + return fmt.Sprintf(fmtString, id.ManagementGroupId, id.RemediationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Providers 2 Remediation ID +func (id Providers2RemediationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.StaticSegment("managementGroupsNamespace", "Microsoft.Management", "Microsoft.Management"), + resourceids.StaticSegment("staticManagementGroups", "managementGroups", "managementGroups"), + resourceids.UserSpecifiedSegment("managementGroupId", "managementGroupIdValue"), + resourceids.StaticSegment("staticProviders2", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftPolicyInsights", "Microsoft.PolicyInsights", "Microsoft.PolicyInsights"), + resourceids.StaticSegment("staticRemediations", "remediations", "remediations"), + resourceids.UserSpecifiedSegment("remediationName", "remediationValue"), + } +} + +// String returns a human-readable description of this Providers 2 Remediation ID +func (id Providers2RemediationId) String() string { + components := []string{ + fmt.Sprintf("Management Group: %q", id.ManagementGroupId), + fmt.Sprintf("Remediation Name: %q", id.RemediationName), + } + return fmt.Sprintf("Providers 2 Remediation (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/id_remediation.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/id_remediation.go new file mode 100644 index 00000000000..ce9ea88fd70 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/id_remediation.go @@ -0,0 +1,111 @@ +package remediations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RemediationId{} + +// RemediationId is a struct representing the Resource ID for a Remediation +type RemediationId struct { + SubscriptionId string + RemediationName string +} + +// NewRemediationID returns a new RemediationId struct +func NewRemediationID(subscriptionId string, remediationName string) RemediationId { + return RemediationId{ + SubscriptionId: subscriptionId, + RemediationName: remediationName, + } +} + +// ParseRemediationID parses 'input' into a RemediationId +func ParseRemediationID(input string) (*RemediationId, error) { + parser := resourceids.NewParserFromResourceIdType(RemediationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RemediationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { + return nil, fmt.Errorf("the segment 'remediationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRemediationIDInsensitively parses 'input' case-insensitively into a RemediationId +// note: this method should only be used for API response data and not user input +func ParseRemediationIDInsensitively(input string) (*RemediationId, error) { + parser := resourceids.NewParserFromResourceIdType(RemediationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RemediationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { + return nil, fmt.Errorf("the segment 'remediationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRemediationID checks that 'input' can be parsed as a Remediation ID +func ValidateRemediationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRemediationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Remediation ID +func (id RemediationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.PolicyInsights/remediations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.RemediationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Remediation ID +func (id RemediationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftPolicyInsights", "Microsoft.PolicyInsights", "Microsoft.PolicyInsights"), + resourceids.StaticSegment("staticRemediations", "remediations", "remediations"), + resourceids.UserSpecifiedSegment("remediationName", "remediationValue"), + } +} + +// String returns a human-readable description of this Remediation ID +func (id RemediationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Remediation Name: %q", id.RemediationName), + } + return fmt.Sprintf("Remediation (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/id_scopedremediation.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/id_scopedremediation.go new file mode 100644 index 00000000000..24a285abe6b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/id_scopedremediation.go @@ -0,0 +1,110 @@ +package remediations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ScopedRemediationId{} + +// ScopedRemediationId is a struct representing the Resource ID for a Scoped Remediation +type ScopedRemediationId struct { + ResourceId string + RemediationName string +} + +// NewScopedRemediationID returns a new ScopedRemediationId struct +func NewScopedRemediationID(resourceId string, remediationName string) ScopedRemediationId { + return ScopedRemediationId{ + ResourceId: resourceId, + RemediationName: remediationName, + } +} + +// ParseScopedRemediationID parses 'input' into a ScopedRemediationId +func ParseScopedRemediationID(input string) (*ScopedRemediationId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedRemediationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopedRemediationId{} + + if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { + return nil, fmt.Errorf("the segment 'resourceId' was not found in the resource id %q", input) + } + + if id.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { + return nil, fmt.Errorf("the segment 'remediationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseScopedRemediationIDInsensitively parses 'input' case-insensitively into a ScopedRemediationId +// note: this method should only be used for API response data and not user input +func ParseScopedRemediationIDInsensitively(input string) (*ScopedRemediationId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedRemediationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopedRemediationId{} + + if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { + return nil, fmt.Errorf("the segment 'resourceId' was not found in the resource id %q", input) + } + + if id.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { + return nil, fmt.Errorf("the segment 'remediationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateScopedRemediationID checks that 'input' can be parsed as a Scoped Remediation ID +func ValidateScopedRemediationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseScopedRemediationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scoped Remediation ID +func (id ScopedRemediationId) ID() string { + fmtString := "/%s/providers/Microsoft.PolicyInsights/remediations/%s" + return fmt.Sprintf(fmtString, strings.TrimPrefix(id.ResourceId, "/"), id.RemediationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scoped Remediation ID +func (id ScopedRemediationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.ScopeSegment("resourceId", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftPolicyInsights", "Microsoft.PolicyInsights", "Microsoft.PolicyInsights"), + resourceids.StaticSegment("staticRemediations", "remediations", "remediations"), + resourceids.UserSpecifiedSegment("remediationName", "remediationValue"), + } +} + +// String returns a human-readable description of this Scoped Remediation ID +func (id ScopedRemediationId) String() string { + components := []string{ + fmt.Sprintf("Resource: %q", id.ResourceId), + fmt.Sprintf("Remediation Name: %q", id.RemediationName), + } + return fmt.Sprintf("Scoped Remediation (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscancelatmanagementgroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscancelatmanagementgroup_autorest.go new file mode 100644 index 00000000000..accd577ccaa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscancelatmanagementgroup_autorest.go @@ -0,0 +1,69 @@ +package remediations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsCancelAtManagementGroupOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsCancelAtManagementGroup ... +func (c RemediationsClient) RemediationsCancelAtManagementGroup(ctx context.Context, id Providers2RemediationId) (result RemediationsCancelAtManagementGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsCancelAtManagementGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCancelAtManagementGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCancelAtManagementGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsCancelAtManagementGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCancelAtManagementGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsCancelAtManagementGroup prepares the RemediationsCancelAtManagementGroup request. +func (c RemediationsClient) preparerForRemediationsCancelAtManagementGroup(ctx context.Context, id Providers2RemediationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/cancel", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsCancelAtManagementGroup handles the response to the RemediationsCancelAtManagementGroup request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsCancelAtManagementGroup(resp *http.Response) (result RemediationsCancelAtManagementGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscancelatresource_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscancelatresource_autorest.go new file mode 100644 index 00000000000..323b3257359 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscancelatresource_autorest.go @@ -0,0 +1,69 @@ +package remediations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsCancelAtResourceOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsCancelAtResource ... +func (c RemediationsClient) RemediationsCancelAtResource(ctx context.Context, id ScopedRemediationId) (result RemediationsCancelAtResourceOperationResponse, err error) { + req, err := c.preparerForRemediationsCancelAtResource(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCancelAtResource", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCancelAtResource", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsCancelAtResource(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCancelAtResource", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsCancelAtResource prepares the RemediationsCancelAtResource request. +func (c RemediationsClient) preparerForRemediationsCancelAtResource(ctx context.Context, id ScopedRemediationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/cancel", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsCancelAtResource handles the response to the RemediationsCancelAtResource request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsCancelAtResource(resp *http.Response) (result RemediationsCancelAtResourceOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscancelatresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscancelatresourcegroup_autorest.go new file mode 100644 index 00000000000..15d4a3b7686 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscancelatresourcegroup_autorest.go @@ -0,0 +1,69 @@ +package remediations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsCancelAtResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsCancelAtResourceGroup ... +func (c RemediationsClient) RemediationsCancelAtResourceGroup(ctx context.Context, id ProviderRemediationId) (result RemediationsCancelAtResourceGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsCancelAtResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCancelAtResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCancelAtResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsCancelAtResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCancelAtResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsCancelAtResourceGroup prepares the RemediationsCancelAtResourceGroup request. +func (c RemediationsClient) preparerForRemediationsCancelAtResourceGroup(ctx context.Context, id ProviderRemediationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/cancel", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsCancelAtResourceGroup handles the response to the RemediationsCancelAtResourceGroup request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsCancelAtResourceGroup(resp *http.Response) (result RemediationsCancelAtResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscancelatsubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscancelatsubscription_autorest.go new file mode 100644 index 00000000000..a1575b72aed --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscancelatsubscription_autorest.go @@ -0,0 +1,69 @@ +package remediations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsCancelAtSubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsCancelAtSubscription ... +func (c RemediationsClient) RemediationsCancelAtSubscription(ctx context.Context, id RemediationId) (result RemediationsCancelAtSubscriptionOperationResponse, err error) { + req, err := c.preparerForRemediationsCancelAtSubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCancelAtSubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCancelAtSubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsCancelAtSubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCancelAtSubscription", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsCancelAtSubscription prepares the RemediationsCancelAtSubscription request. +func (c RemediationsClient) preparerForRemediationsCancelAtSubscription(ctx context.Context, id RemediationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/cancel", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsCancelAtSubscription handles the response to the RemediationsCancelAtSubscription request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsCancelAtSubscription(resp *http.Response) (result RemediationsCancelAtSubscriptionOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscreateorupdateatmanagementgroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscreateorupdateatmanagementgroup_autorest.go new file mode 100644 index 00000000000..e9f8c0df2a2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscreateorupdateatmanagementgroup_autorest.go @@ -0,0 +1,69 @@ +package remediations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsCreateOrUpdateAtManagementGroupOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsCreateOrUpdateAtManagementGroup ... +func (c RemediationsClient) RemediationsCreateOrUpdateAtManagementGroup(ctx context.Context, id Providers2RemediationId, input Remediation) (result RemediationsCreateOrUpdateAtManagementGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsCreateOrUpdateAtManagementGroup(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCreateOrUpdateAtManagementGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCreateOrUpdateAtManagementGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsCreateOrUpdateAtManagementGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCreateOrUpdateAtManagementGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsCreateOrUpdateAtManagementGroup prepares the RemediationsCreateOrUpdateAtManagementGroup request. +func (c RemediationsClient) preparerForRemediationsCreateOrUpdateAtManagementGroup(ctx context.Context, id Providers2RemediationId, input Remediation) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsCreateOrUpdateAtManagementGroup handles the response to the RemediationsCreateOrUpdateAtManagementGroup request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsCreateOrUpdateAtManagementGroup(resp *http.Response) (result RemediationsCreateOrUpdateAtManagementGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscreateorupdateatresource_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscreateorupdateatresource_autorest.go new file mode 100644 index 00000000000..61d4ec43f4f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscreateorupdateatresource_autorest.go @@ -0,0 +1,69 @@ +package remediations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsCreateOrUpdateAtResourceOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsCreateOrUpdateAtResource ... +func (c RemediationsClient) RemediationsCreateOrUpdateAtResource(ctx context.Context, id ScopedRemediationId, input Remediation) (result RemediationsCreateOrUpdateAtResourceOperationResponse, err error) { + req, err := c.preparerForRemediationsCreateOrUpdateAtResource(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCreateOrUpdateAtResource", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCreateOrUpdateAtResource", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsCreateOrUpdateAtResource(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCreateOrUpdateAtResource", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsCreateOrUpdateAtResource prepares the RemediationsCreateOrUpdateAtResource request. +func (c RemediationsClient) preparerForRemediationsCreateOrUpdateAtResource(ctx context.Context, id ScopedRemediationId, input Remediation) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsCreateOrUpdateAtResource handles the response to the RemediationsCreateOrUpdateAtResource request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsCreateOrUpdateAtResource(resp *http.Response) (result RemediationsCreateOrUpdateAtResourceOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscreateorupdateatresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscreateorupdateatresourcegroup_autorest.go new file mode 100644 index 00000000000..b6cb95e99c7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscreateorupdateatresourcegroup_autorest.go @@ -0,0 +1,69 @@ +package remediations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsCreateOrUpdateAtResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsCreateOrUpdateAtResourceGroup ... +func (c RemediationsClient) RemediationsCreateOrUpdateAtResourceGroup(ctx context.Context, id ProviderRemediationId, input Remediation) (result RemediationsCreateOrUpdateAtResourceGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsCreateOrUpdateAtResourceGroup(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCreateOrUpdateAtResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCreateOrUpdateAtResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsCreateOrUpdateAtResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCreateOrUpdateAtResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsCreateOrUpdateAtResourceGroup prepares the RemediationsCreateOrUpdateAtResourceGroup request. +func (c RemediationsClient) preparerForRemediationsCreateOrUpdateAtResourceGroup(ctx context.Context, id ProviderRemediationId, input Remediation) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsCreateOrUpdateAtResourceGroup handles the response to the RemediationsCreateOrUpdateAtResourceGroup request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsCreateOrUpdateAtResourceGroup(resp *http.Response) (result RemediationsCreateOrUpdateAtResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscreateorupdateatsubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscreateorupdateatsubscription_autorest.go new file mode 100644 index 00000000000..bece31c044a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationscreateorupdateatsubscription_autorest.go @@ -0,0 +1,69 @@ +package remediations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsCreateOrUpdateAtSubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsCreateOrUpdateAtSubscription ... +func (c RemediationsClient) RemediationsCreateOrUpdateAtSubscription(ctx context.Context, id RemediationId, input Remediation) (result RemediationsCreateOrUpdateAtSubscriptionOperationResponse, err error) { + req, err := c.preparerForRemediationsCreateOrUpdateAtSubscription(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCreateOrUpdateAtSubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCreateOrUpdateAtSubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsCreateOrUpdateAtSubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsCreateOrUpdateAtSubscription", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsCreateOrUpdateAtSubscription prepares the RemediationsCreateOrUpdateAtSubscription request. +func (c RemediationsClient) preparerForRemediationsCreateOrUpdateAtSubscription(ctx context.Context, id RemediationId, input Remediation) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsCreateOrUpdateAtSubscription handles the response to the RemediationsCreateOrUpdateAtSubscription request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsCreateOrUpdateAtSubscription(resp *http.Response) (result RemediationsCreateOrUpdateAtSubscriptionOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsdeleteatmanagementgroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsdeleteatmanagementgroup_autorest.go new file mode 100644 index 00000000000..e62fd228f40 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsdeleteatmanagementgroup_autorest.go @@ -0,0 +1,68 @@ +package remediations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsDeleteAtManagementGroupOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsDeleteAtManagementGroup ... +func (c RemediationsClient) RemediationsDeleteAtManagementGroup(ctx context.Context, id Providers2RemediationId) (result RemediationsDeleteAtManagementGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsDeleteAtManagementGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsDeleteAtManagementGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsDeleteAtManagementGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsDeleteAtManagementGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsDeleteAtManagementGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsDeleteAtManagementGroup prepares the RemediationsDeleteAtManagementGroup request. +func (c RemediationsClient) preparerForRemediationsDeleteAtManagementGroup(ctx context.Context, id Providers2RemediationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsDeleteAtManagementGroup handles the response to the RemediationsDeleteAtManagementGroup request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsDeleteAtManagementGroup(resp *http.Response) (result RemediationsDeleteAtManagementGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsdeleteatresource_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsdeleteatresource_autorest.go new file mode 100644 index 00000000000..5caaa3d04bf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsdeleteatresource_autorest.go @@ -0,0 +1,68 @@ +package remediations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsDeleteAtResourceOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsDeleteAtResource ... +func (c RemediationsClient) RemediationsDeleteAtResource(ctx context.Context, id ScopedRemediationId) (result RemediationsDeleteAtResourceOperationResponse, err error) { + req, err := c.preparerForRemediationsDeleteAtResource(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsDeleteAtResource", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsDeleteAtResource", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsDeleteAtResource(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsDeleteAtResource", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsDeleteAtResource prepares the RemediationsDeleteAtResource request. +func (c RemediationsClient) preparerForRemediationsDeleteAtResource(ctx context.Context, id ScopedRemediationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsDeleteAtResource handles the response to the RemediationsDeleteAtResource request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsDeleteAtResource(resp *http.Response) (result RemediationsDeleteAtResourceOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsdeleteatresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsdeleteatresourcegroup_autorest.go new file mode 100644 index 00000000000..90fc0ff91b5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsdeleteatresourcegroup_autorest.go @@ -0,0 +1,68 @@ +package remediations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsDeleteAtResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsDeleteAtResourceGroup ... +func (c RemediationsClient) RemediationsDeleteAtResourceGroup(ctx context.Context, id ProviderRemediationId) (result RemediationsDeleteAtResourceGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsDeleteAtResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsDeleteAtResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsDeleteAtResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsDeleteAtResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsDeleteAtResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsDeleteAtResourceGroup prepares the RemediationsDeleteAtResourceGroup request. +func (c RemediationsClient) preparerForRemediationsDeleteAtResourceGroup(ctx context.Context, id ProviderRemediationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsDeleteAtResourceGroup handles the response to the RemediationsDeleteAtResourceGroup request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsDeleteAtResourceGroup(resp *http.Response) (result RemediationsDeleteAtResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsdeleteatsubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsdeleteatsubscription_autorest.go new file mode 100644 index 00000000000..bedb33fa505 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsdeleteatsubscription_autorest.go @@ -0,0 +1,68 @@ +package remediations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsDeleteAtSubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsDeleteAtSubscription ... +func (c RemediationsClient) RemediationsDeleteAtSubscription(ctx context.Context, id RemediationId) (result RemediationsDeleteAtSubscriptionOperationResponse, err error) { + req, err := c.preparerForRemediationsDeleteAtSubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsDeleteAtSubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsDeleteAtSubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsDeleteAtSubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsDeleteAtSubscription", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsDeleteAtSubscription prepares the RemediationsDeleteAtSubscription request. +func (c RemediationsClient) preparerForRemediationsDeleteAtSubscription(ctx context.Context, id RemediationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsDeleteAtSubscription handles the response to the RemediationsDeleteAtSubscription request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsDeleteAtSubscription(resp *http.Response) (result RemediationsDeleteAtSubscriptionOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsgetatmanagementgroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsgetatmanagementgroup_autorest.go new file mode 100644 index 00000000000..d32c1d7cb85 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsgetatmanagementgroup_autorest.go @@ -0,0 +1,68 @@ +package remediations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsGetAtManagementGroupOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsGetAtManagementGroup ... +func (c RemediationsClient) RemediationsGetAtManagementGroup(ctx context.Context, id Providers2RemediationId) (result RemediationsGetAtManagementGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsGetAtManagementGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsGetAtManagementGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsGetAtManagementGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsGetAtManagementGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsGetAtManagementGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsGetAtManagementGroup prepares the RemediationsGetAtManagementGroup request. +func (c RemediationsClient) preparerForRemediationsGetAtManagementGroup(ctx context.Context, id Providers2RemediationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsGetAtManagementGroup handles the response to the RemediationsGetAtManagementGroup request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsGetAtManagementGroup(resp *http.Response) (result RemediationsGetAtManagementGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsgetatresource_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsgetatresource_autorest.go new file mode 100644 index 00000000000..c21c86edbf2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsgetatresource_autorest.go @@ -0,0 +1,68 @@ +package remediations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsGetAtResourceOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsGetAtResource ... +func (c RemediationsClient) RemediationsGetAtResource(ctx context.Context, id ScopedRemediationId) (result RemediationsGetAtResourceOperationResponse, err error) { + req, err := c.preparerForRemediationsGetAtResource(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsGetAtResource", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsGetAtResource", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsGetAtResource(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsGetAtResource", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsGetAtResource prepares the RemediationsGetAtResource request. +func (c RemediationsClient) preparerForRemediationsGetAtResource(ctx context.Context, id ScopedRemediationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsGetAtResource handles the response to the RemediationsGetAtResource request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsGetAtResource(resp *http.Response) (result RemediationsGetAtResourceOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsgetatresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsgetatresourcegroup_autorest.go new file mode 100644 index 00000000000..de938e787b2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsgetatresourcegroup_autorest.go @@ -0,0 +1,68 @@ +package remediations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsGetAtResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsGetAtResourceGroup ... +func (c RemediationsClient) RemediationsGetAtResourceGroup(ctx context.Context, id ProviderRemediationId) (result RemediationsGetAtResourceGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsGetAtResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsGetAtResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsGetAtResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsGetAtResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsGetAtResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsGetAtResourceGroup prepares the RemediationsGetAtResourceGroup request. +func (c RemediationsClient) preparerForRemediationsGetAtResourceGroup(ctx context.Context, id ProviderRemediationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsGetAtResourceGroup handles the response to the RemediationsGetAtResourceGroup request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsGetAtResourceGroup(resp *http.Response) (result RemediationsGetAtResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsgetatsubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsgetatsubscription_autorest.go new file mode 100644 index 00000000000..3e94c0ee59c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationsgetatsubscription_autorest.go @@ -0,0 +1,68 @@ +package remediations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsGetAtSubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *Remediation +} + +// RemediationsGetAtSubscription ... +func (c RemediationsClient) RemediationsGetAtSubscription(ctx context.Context, id RemediationId) (result RemediationsGetAtSubscriptionOperationResponse, err error) { + req, err := c.preparerForRemediationsGetAtSubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsGetAtSubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsGetAtSubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsGetAtSubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsGetAtSubscription", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemediationsGetAtSubscription prepares the RemediationsGetAtSubscription request. +func (c RemediationsClient) preparerForRemediationsGetAtSubscription(ctx context.Context, id RemediationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsGetAtSubscription handles the response to the RemediationsGetAtSubscription request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsGetAtSubscription(resp *http.Response) (result RemediationsGetAtSubscriptionOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistdeploymentsatmanagementgroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistdeploymentsatmanagementgroup_autorest.go new file mode 100644 index 00000000000..7fc7568da91 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistdeploymentsatmanagementgroup_autorest.go @@ -0,0 +1,215 @@ +package remediations + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsListDeploymentsAtManagementGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]RemediationDeployment + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (RemediationsListDeploymentsAtManagementGroupOperationResponse, error) +} + +type RemediationsListDeploymentsAtManagementGroupCompleteResult struct { + Items []RemediationDeployment +} + +func (r RemediationsListDeploymentsAtManagementGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r RemediationsListDeploymentsAtManagementGroupOperationResponse) LoadMore(ctx context.Context) (resp RemediationsListDeploymentsAtManagementGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type RemediationsListDeploymentsAtManagementGroupOperationOptions struct { + Top *int64 +} + +func DefaultRemediationsListDeploymentsAtManagementGroupOperationOptions() RemediationsListDeploymentsAtManagementGroupOperationOptions { + return RemediationsListDeploymentsAtManagementGroupOperationOptions{} +} + +func (o RemediationsListDeploymentsAtManagementGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o RemediationsListDeploymentsAtManagementGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// RemediationsListDeploymentsAtManagementGroup ... +func (c RemediationsClient) RemediationsListDeploymentsAtManagementGroup(ctx context.Context, id Providers2RemediationId, options RemediationsListDeploymentsAtManagementGroupOperationOptions) (resp RemediationsListDeploymentsAtManagementGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsListDeploymentsAtManagementGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtManagementGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtManagementGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForRemediationsListDeploymentsAtManagementGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtManagementGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForRemediationsListDeploymentsAtManagementGroup prepares the RemediationsListDeploymentsAtManagementGroup request. +func (c RemediationsClient) preparerForRemediationsListDeploymentsAtManagementGroup(ctx context.Context, id Providers2RemediationId, options RemediationsListDeploymentsAtManagementGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/listDeployments", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForRemediationsListDeploymentsAtManagementGroupWithNextLink prepares the RemediationsListDeploymentsAtManagementGroup request with the given nextLink token. +func (c RemediationsClient) preparerForRemediationsListDeploymentsAtManagementGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsListDeploymentsAtManagementGroup handles the response to the RemediationsListDeploymentsAtManagementGroup request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsListDeploymentsAtManagementGroup(resp *http.Response) (result RemediationsListDeploymentsAtManagementGroupOperationResponse, err error) { + type page struct { + Values []RemediationDeployment `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result RemediationsListDeploymentsAtManagementGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsListDeploymentsAtManagementGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtManagementGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtManagementGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsListDeploymentsAtManagementGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtManagementGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// RemediationsListDeploymentsAtManagementGroupComplete retrieves all of the results into a single object +func (c RemediationsClient) RemediationsListDeploymentsAtManagementGroupComplete(ctx context.Context, id Providers2RemediationId, options RemediationsListDeploymentsAtManagementGroupOperationOptions) (RemediationsListDeploymentsAtManagementGroupCompleteResult, error) { + return c.RemediationsListDeploymentsAtManagementGroupCompleteMatchingPredicate(ctx, id, options, RemediationDeploymentOperationPredicate{}) +} + +// RemediationsListDeploymentsAtManagementGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RemediationsClient) RemediationsListDeploymentsAtManagementGroupCompleteMatchingPredicate(ctx context.Context, id Providers2RemediationId, options RemediationsListDeploymentsAtManagementGroupOperationOptions, predicate RemediationDeploymentOperationPredicate) (resp RemediationsListDeploymentsAtManagementGroupCompleteResult, err error) { + items := make([]RemediationDeployment, 0) + + page, err := c.RemediationsListDeploymentsAtManagementGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := RemediationsListDeploymentsAtManagementGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistdeploymentsatresource_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistdeploymentsatresource_autorest.go new file mode 100644 index 00000000000..c7cb20e0c96 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistdeploymentsatresource_autorest.go @@ -0,0 +1,215 @@ +package remediations + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsListDeploymentsAtResourceOperationResponse struct { + HttpResponse *http.Response + Model *[]RemediationDeployment + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (RemediationsListDeploymentsAtResourceOperationResponse, error) +} + +type RemediationsListDeploymentsAtResourceCompleteResult struct { + Items []RemediationDeployment +} + +func (r RemediationsListDeploymentsAtResourceOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r RemediationsListDeploymentsAtResourceOperationResponse) LoadMore(ctx context.Context) (resp RemediationsListDeploymentsAtResourceOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type RemediationsListDeploymentsAtResourceOperationOptions struct { + Top *int64 +} + +func DefaultRemediationsListDeploymentsAtResourceOperationOptions() RemediationsListDeploymentsAtResourceOperationOptions { + return RemediationsListDeploymentsAtResourceOperationOptions{} +} + +func (o RemediationsListDeploymentsAtResourceOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o RemediationsListDeploymentsAtResourceOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// RemediationsListDeploymentsAtResource ... +func (c RemediationsClient) RemediationsListDeploymentsAtResource(ctx context.Context, id ScopedRemediationId, options RemediationsListDeploymentsAtResourceOperationOptions) (resp RemediationsListDeploymentsAtResourceOperationResponse, err error) { + req, err := c.preparerForRemediationsListDeploymentsAtResource(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtResource", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtResource", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForRemediationsListDeploymentsAtResource(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtResource", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForRemediationsListDeploymentsAtResource prepares the RemediationsListDeploymentsAtResource request. +func (c RemediationsClient) preparerForRemediationsListDeploymentsAtResource(ctx context.Context, id ScopedRemediationId, options RemediationsListDeploymentsAtResourceOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/listDeployments", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForRemediationsListDeploymentsAtResourceWithNextLink prepares the RemediationsListDeploymentsAtResource request with the given nextLink token. +func (c RemediationsClient) preparerForRemediationsListDeploymentsAtResourceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsListDeploymentsAtResource handles the response to the RemediationsListDeploymentsAtResource request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsListDeploymentsAtResource(resp *http.Response) (result RemediationsListDeploymentsAtResourceOperationResponse, err error) { + type page struct { + Values []RemediationDeployment `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result RemediationsListDeploymentsAtResourceOperationResponse, err error) { + req, err := c.preparerForRemediationsListDeploymentsAtResourceWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtResource", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtResource", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsListDeploymentsAtResource(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtResource", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// RemediationsListDeploymentsAtResourceComplete retrieves all of the results into a single object +func (c RemediationsClient) RemediationsListDeploymentsAtResourceComplete(ctx context.Context, id ScopedRemediationId, options RemediationsListDeploymentsAtResourceOperationOptions) (RemediationsListDeploymentsAtResourceCompleteResult, error) { + return c.RemediationsListDeploymentsAtResourceCompleteMatchingPredicate(ctx, id, options, RemediationDeploymentOperationPredicate{}) +} + +// RemediationsListDeploymentsAtResourceCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RemediationsClient) RemediationsListDeploymentsAtResourceCompleteMatchingPredicate(ctx context.Context, id ScopedRemediationId, options RemediationsListDeploymentsAtResourceOperationOptions, predicate RemediationDeploymentOperationPredicate) (resp RemediationsListDeploymentsAtResourceCompleteResult, err error) { + items := make([]RemediationDeployment, 0) + + page, err := c.RemediationsListDeploymentsAtResource(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := RemediationsListDeploymentsAtResourceCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistdeploymentsatresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistdeploymentsatresourcegroup_autorest.go new file mode 100644 index 00000000000..d6b08226e50 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistdeploymentsatresourcegroup_autorest.go @@ -0,0 +1,215 @@ +package remediations + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsListDeploymentsAtResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]RemediationDeployment + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (RemediationsListDeploymentsAtResourceGroupOperationResponse, error) +} + +type RemediationsListDeploymentsAtResourceGroupCompleteResult struct { + Items []RemediationDeployment +} + +func (r RemediationsListDeploymentsAtResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r RemediationsListDeploymentsAtResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp RemediationsListDeploymentsAtResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type RemediationsListDeploymentsAtResourceGroupOperationOptions struct { + Top *int64 +} + +func DefaultRemediationsListDeploymentsAtResourceGroupOperationOptions() RemediationsListDeploymentsAtResourceGroupOperationOptions { + return RemediationsListDeploymentsAtResourceGroupOperationOptions{} +} + +func (o RemediationsListDeploymentsAtResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o RemediationsListDeploymentsAtResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// RemediationsListDeploymentsAtResourceGroup ... +func (c RemediationsClient) RemediationsListDeploymentsAtResourceGroup(ctx context.Context, id ProviderRemediationId, options RemediationsListDeploymentsAtResourceGroupOperationOptions) (resp RemediationsListDeploymentsAtResourceGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsListDeploymentsAtResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForRemediationsListDeploymentsAtResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForRemediationsListDeploymentsAtResourceGroup prepares the RemediationsListDeploymentsAtResourceGroup request. +func (c RemediationsClient) preparerForRemediationsListDeploymentsAtResourceGroup(ctx context.Context, id ProviderRemediationId, options RemediationsListDeploymentsAtResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/listDeployments", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForRemediationsListDeploymentsAtResourceGroupWithNextLink prepares the RemediationsListDeploymentsAtResourceGroup request with the given nextLink token. +func (c RemediationsClient) preparerForRemediationsListDeploymentsAtResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsListDeploymentsAtResourceGroup handles the response to the RemediationsListDeploymentsAtResourceGroup request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsListDeploymentsAtResourceGroup(resp *http.Response) (result RemediationsListDeploymentsAtResourceGroupOperationResponse, err error) { + type page struct { + Values []RemediationDeployment `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result RemediationsListDeploymentsAtResourceGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsListDeploymentsAtResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsListDeploymentsAtResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// RemediationsListDeploymentsAtResourceGroupComplete retrieves all of the results into a single object +func (c RemediationsClient) RemediationsListDeploymentsAtResourceGroupComplete(ctx context.Context, id ProviderRemediationId, options RemediationsListDeploymentsAtResourceGroupOperationOptions) (RemediationsListDeploymentsAtResourceGroupCompleteResult, error) { + return c.RemediationsListDeploymentsAtResourceGroupCompleteMatchingPredicate(ctx, id, options, RemediationDeploymentOperationPredicate{}) +} + +// RemediationsListDeploymentsAtResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RemediationsClient) RemediationsListDeploymentsAtResourceGroupCompleteMatchingPredicate(ctx context.Context, id ProviderRemediationId, options RemediationsListDeploymentsAtResourceGroupOperationOptions, predicate RemediationDeploymentOperationPredicate) (resp RemediationsListDeploymentsAtResourceGroupCompleteResult, err error) { + items := make([]RemediationDeployment, 0) + + page, err := c.RemediationsListDeploymentsAtResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := RemediationsListDeploymentsAtResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistdeploymentsatsubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistdeploymentsatsubscription_autorest.go new file mode 100644 index 00000000000..d916e05fce1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistdeploymentsatsubscription_autorest.go @@ -0,0 +1,215 @@ +package remediations + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsListDeploymentsAtSubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]RemediationDeployment + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (RemediationsListDeploymentsAtSubscriptionOperationResponse, error) +} + +type RemediationsListDeploymentsAtSubscriptionCompleteResult struct { + Items []RemediationDeployment +} + +func (r RemediationsListDeploymentsAtSubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r RemediationsListDeploymentsAtSubscriptionOperationResponse) LoadMore(ctx context.Context) (resp RemediationsListDeploymentsAtSubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type RemediationsListDeploymentsAtSubscriptionOperationOptions struct { + Top *int64 +} + +func DefaultRemediationsListDeploymentsAtSubscriptionOperationOptions() RemediationsListDeploymentsAtSubscriptionOperationOptions { + return RemediationsListDeploymentsAtSubscriptionOperationOptions{} +} + +func (o RemediationsListDeploymentsAtSubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o RemediationsListDeploymentsAtSubscriptionOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// RemediationsListDeploymentsAtSubscription ... +func (c RemediationsClient) RemediationsListDeploymentsAtSubscription(ctx context.Context, id RemediationId, options RemediationsListDeploymentsAtSubscriptionOperationOptions) (resp RemediationsListDeploymentsAtSubscriptionOperationResponse, err error) { + req, err := c.preparerForRemediationsListDeploymentsAtSubscription(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtSubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtSubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForRemediationsListDeploymentsAtSubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtSubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForRemediationsListDeploymentsAtSubscription prepares the RemediationsListDeploymentsAtSubscription request. +func (c RemediationsClient) preparerForRemediationsListDeploymentsAtSubscription(ctx context.Context, id RemediationId, options RemediationsListDeploymentsAtSubscriptionOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/listDeployments", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForRemediationsListDeploymentsAtSubscriptionWithNextLink prepares the RemediationsListDeploymentsAtSubscription request with the given nextLink token. +func (c RemediationsClient) preparerForRemediationsListDeploymentsAtSubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsListDeploymentsAtSubscription handles the response to the RemediationsListDeploymentsAtSubscription request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsListDeploymentsAtSubscription(resp *http.Response) (result RemediationsListDeploymentsAtSubscriptionOperationResponse, err error) { + type page struct { + Values []RemediationDeployment `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result RemediationsListDeploymentsAtSubscriptionOperationResponse, err error) { + req, err := c.preparerForRemediationsListDeploymentsAtSubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtSubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtSubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsListDeploymentsAtSubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListDeploymentsAtSubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// RemediationsListDeploymentsAtSubscriptionComplete retrieves all of the results into a single object +func (c RemediationsClient) RemediationsListDeploymentsAtSubscriptionComplete(ctx context.Context, id RemediationId, options RemediationsListDeploymentsAtSubscriptionOperationOptions) (RemediationsListDeploymentsAtSubscriptionCompleteResult, error) { + return c.RemediationsListDeploymentsAtSubscriptionCompleteMatchingPredicate(ctx, id, options, RemediationDeploymentOperationPredicate{}) +} + +// RemediationsListDeploymentsAtSubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RemediationsClient) RemediationsListDeploymentsAtSubscriptionCompleteMatchingPredicate(ctx context.Context, id RemediationId, options RemediationsListDeploymentsAtSubscriptionOperationOptions, predicate RemediationDeploymentOperationPredicate) (resp RemediationsListDeploymentsAtSubscriptionCompleteResult, err error) { + items := make([]RemediationDeployment, 0) + + page, err := c.RemediationsListDeploymentsAtSubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := RemediationsListDeploymentsAtSubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistformanagementgroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistformanagementgroup_autorest.go new file mode 100644 index 00000000000..3f3459951d1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistformanagementgroup_autorest.go @@ -0,0 +1,220 @@ +package remediations + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsListForManagementGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Remediation + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (RemediationsListForManagementGroupOperationResponse, error) +} + +type RemediationsListForManagementGroupCompleteResult struct { + Items []Remediation +} + +func (r RemediationsListForManagementGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r RemediationsListForManagementGroupOperationResponse) LoadMore(ctx context.Context) (resp RemediationsListForManagementGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type RemediationsListForManagementGroupOperationOptions struct { + Filter *string + Top *int64 +} + +func DefaultRemediationsListForManagementGroupOperationOptions() RemediationsListForManagementGroupOperationOptions { + return RemediationsListForManagementGroupOperationOptions{} +} + +func (o RemediationsListForManagementGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o RemediationsListForManagementGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// RemediationsListForManagementGroup ... +func (c RemediationsClient) RemediationsListForManagementGroup(ctx context.Context, id ManagementGroupId, options RemediationsListForManagementGroupOperationOptions) (resp RemediationsListForManagementGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsListForManagementGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForManagementGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForManagementGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForRemediationsListForManagementGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForManagementGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForRemediationsListForManagementGroup prepares the RemediationsListForManagementGroup request. +func (c RemediationsClient) preparerForRemediationsListForManagementGroup(ctx context.Context, id ManagementGroupId, options RemediationsListForManagementGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.PolicyInsights/remediations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForRemediationsListForManagementGroupWithNextLink prepares the RemediationsListForManagementGroup request with the given nextLink token. +func (c RemediationsClient) preparerForRemediationsListForManagementGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsListForManagementGroup handles the response to the RemediationsListForManagementGroup request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsListForManagementGroup(resp *http.Response) (result RemediationsListForManagementGroupOperationResponse, err error) { + type page struct { + Values []Remediation `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result RemediationsListForManagementGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsListForManagementGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForManagementGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForManagementGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsListForManagementGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForManagementGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// RemediationsListForManagementGroupComplete retrieves all of the results into a single object +func (c RemediationsClient) RemediationsListForManagementGroupComplete(ctx context.Context, id ManagementGroupId, options RemediationsListForManagementGroupOperationOptions) (RemediationsListForManagementGroupCompleteResult, error) { + return c.RemediationsListForManagementGroupCompleteMatchingPredicate(ctx, id, options, RemediationOperationPredicate{}) +} + +// RemediationsListForManagementGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RemediationsClient) RemediationsListForManagementGroupCompleteMatchingPredicate(ctx context.Context, id ManagementGroupId, options RemediationsListForManagementGroupOperationOptions, predicate RemediationOperationPredicate) (resp RemediationsListForManagementGroupCompleteResult, err error) { + items := make([]Remediation, 0) + + page, err := c.RemediationsListForManagementGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := RemediationsListForManagementGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistforresource_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistforresource_autorest.go new file mode 100644 index 00000000000..ee6be7ef659 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistforresource_autorest.go @@ -0,0 +1,221 @@ +package remediations + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsListForResourceOperationResponse struct { + HttpResponse *http.Response + Model *[]Remediation + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (RemediationsListForResourceOperationResponse, error) +} + +type RemediationsListForResourceCompleteResult struct { + Items []Remediation +} + +func (r RemediationsListForResourceOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r RemediationsListForResourceOperationResponse) LoadMore(ctx context.Context) (resp RemediationsListForResourceOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type RemediationsListForResourceOperationOptions struct { + Filter *string + Top *int64 +} + +func DefaultRemediationsListForResourceOperationOptions() RemediationsListForResourceOperationOptions { + return RemediationsListForResourceOperationOptions{} +} + +func (o RemediationsListForResourceOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o RemediationsListForResourceOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// RemediationsListForResource ... +func (c RemediationsClient) RemediationsListForResource(ctx context.Context, id commonids.ScopeId, options RemediationsListForResourceOperationOptions) (resp RemediationsListForResourceOperationResponse, err error) { + req, err := c.preparerForRemediationsListForResource(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForResource", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForResource", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForRemediationsListForResource(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForResource", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForRemediationsListForResource prepares the RemediationsListForResource request. +func (c RemediationsClient) preparerForRemediationsListForResource(ctx context.Context, id commonids.ScopeId, options RemediationsListForResourceOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.PolicyInsights/remediations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForRemediationsListForResourceWithNextLink prepares the RemediationsListForResource request with the given nextLink token. +func (c RemediationsClient) preparerForRemediationsListForResourceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsListForResource handles the response to the RemediationsListForResource request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsListForResource(resp *http.Response) (result RemediationsListForResourceOperationResponse, err error) { + type page struct { + Values []Remediation `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result RemediationsListForResourceOperationResponse, err error) { + req, err := c.preparerForRemediationsListForResourceWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForResource", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForResource", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsListForResource(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForResource", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// RemediationsListForResourceComplete retrieves all of the results into a single object +func (c RemediationsClient) RemediationsListForResourceComplete(ctx context.Context, id commonids.ScopeId, options RemediationsListForResourceOperationOptions) (RemediationsListForResourceCompleteResult, error) { + return c.RemediationsListForResourceCompleteMatchingPredicate(ctx, id, options, RemediationOperationPredicate{}) +} + +// RemediationsListForResourceCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RemediationsClient) RemediationsListForResourceCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, options RemediationsListForResourceOperationOptions, predicate RemediationOperationPredicate) (resp RemediationsListForResourceCompleteResult, err error) { + items := make([]Remediation, 0) + + page, err := c.RemediationsListForResource(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := RemediationsListForResourceCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistforresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistforresourcegroup_autorest.go new file mode 100644 index 00000000000..97b870c47d0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistforresourcegroup_autorest.go @@ -0,0 +1,221 @@ +package remediations + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsListForResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Remediation + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (RemediationsListForResourceGroupOperationResponse, error) +} + +type RemediationsListForResourceGroupCompleteResult struct { + Items []Remediation +} + +func (r RemediationsListForResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r RemediationsListForResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp RemediationsListForResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type RemediationsListForResourceGroupOperationOptions struct { + Filter *string + Top *int64 +} + +func DefaultRemediationsListForResourceGroupOperationOptions() RemediationsListForResourceGroupOperationOptions { + return RemediationsListForResourceGroupOperationOptions{} +} + +func (o RemediationsListForResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o RemediationsListForResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// RemediationsListForResourceGroup ... +func (c RemediationsClient) RemediationsListForResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options RemediationsListForResourceGroupOperationOptions) (resp RemediationsListForResourceGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsListForResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForRemediationsListForResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForRemediationsListForResourceGroup prepares the RemediationsListForResourceGroup request. +func (c RemediationsClient) preparerForRemediationsListForResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options RemediationsListForResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.PolicyInsights/remediations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForRemediationsListForResourceGroupWithNextLink prepares the RemediationsListForResourceGroup request with the given nextLink token. +func (c RemediationsClient) preparerForRemediationsListForResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsListForResourceGroup handles the response to the RemediationsListForResourceGroup request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsListForResourceGroup(resp *http.Response) (result RemediationsListForResourceGroupOperationResponse, err error) { + type page struct { + Values []Remediation `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result RemediationsListForResourceGroupOperationResponse, err error) { + req, err := c.preparerForRemediationsListForResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsListForResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// RemediationsListForResourceGroupComplete retrieves all of the results into a single object +func (c RemediationsClient) RemediationsListForResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options RemediationsListForResourceGroupOperationOptions) (RemediationsListForResourceGroupCompleteResult, error) { + return c.RemediationsListForResourceGroupCompleteMatchingPredicate(ctx, id, options, RemediationOperationPredicate{}) +} + +// RemediationsListForResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RemediationsClient) RemediationsListForResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options RemediationsListForResourceGroupOperationOptions, predicate RemediationOperationPredicate) (resp RemediationsListForResourceGroupCompleteResult, err error) { + items := make([]Remediation, 0) + + page, err := c.RemediationsListForResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := RemediationsListForResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistforsubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistforsubscription_autorest.go new file mode 100644 index 00000000000..2af372127de --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/method_remediationslistforsubscription_autorest.go @@ -0,0 +1,221 @@ +package remediations + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationsListForSubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Remediation + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (RemediationsListForSubscriptionOperationResponse, error) +} + +type RemediationsListForSubscriptionCompleteResult struct { + Items []Remediation +} + +func (r RemediationsListForSubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r RemediationsListForSubscriptionOperationResponse) LoadMore(ctx context.Context) (resp RemediationsListForSubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type RemediationsListForSubscriptionOperationOptions struct { + Filter *string + Top *int64 +} + +func DefaultRemediationsListForSubscriptionOperationOptions() RemediationsListForSubscriptionOperationOptions { + return RemediationsListForSubscriptionOperationOptions{} +} + +func (o RemediationsListForSubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o RemediationsListForSubscriptionOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// RemediationsListForSubscription ... +func (c RemediationsClient) RemediationsListForSubscription(ctx context.Context, id commonids.SubscriptionId, options RemediationsListForSubscriptionOperationOptions) (resp RemediationsListForSubscriptionOperationResponse, err error) { + req, err := c.preparerForRemediationsListForSubscription(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForSubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForSubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForRemediationsListForSubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForSubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForRemediationsListForSubscription prepares the RemediationsListForSubscription request. +func (c RemediationsClient) preparerForRemediationsListForSubscription(ctx context.Context, id commonids.SubscriptionId, options RemediationsListForSubscriptionOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.PolicyInsights/remediations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForRemediationsListForSubscriptionWithNextLink prepares the RemediationsListForSubscription request with the given nextLink token. +func (c RemediationsClient) preparerForRemediationsListForSubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemediationsListForSubscription handles the response to the RemediationsListForSubscription request. The method always +// closes the http.Response Body. +func (c RemediationsClient) responderForRemediationsListForSubscription(resp *http.Response) (result RemediationsListForSubscriptionOperationResponse, err error) { + type page struct { + Values []Remediation `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result RemediationsListForSubscriptionOperationResponse, err error) { + req, err := c.preparerForRemediationsListForSubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForSubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForSubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemediationsListForSubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "remediations.RemediationsClient", "RemediationsListForSubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// RemediationsListForSubscriptionComplete retrieves all of the results into a single object +func (c RemediationsClient) RemediationsListForSubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options RemediationsListForSubscriptionOperationOptions) (RemediationsListForSubscriptionCompleteResult, error) { + return c.RemediationsListForSubscriptionCompleteMatchingPredicate(ctx, id, options, RemediationOperationPredicate{}) +} + +// RemediationsListForSubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RemediationsClient) RemediationsListForSubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options RemediationsListForSubscriptionOperationOptions, predicate RemediationOperationPredicate) (resp RemediationsListForSubscriptionCompleteResult, err error) { + items := make([]Remediation, 0) + + page, err := c.RemediationsListForSubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := RemediationsListForSubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_errordefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_errordefinition.go new file mode 100644 index 00000000000..7d2cb5ba700 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_errordefinition.go @@ -0,0 +1,12 @@ +package remediations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorDefinition struct { + AdditionalInfo *[]TypedErrorInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDefinition `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediation.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediation.go new file mode 100644 index 00000000000..f19bbad7544 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediation.go @@ -0,0 +1,16 @@ +package remediations + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Remediation struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RemediationProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediationdeployment.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediationdeployment.go new file mode 100644 index 00000000000..456d1946724 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediationdeployment.go @@ -0,0 +1,44 @@ +package remediations + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationDeployment struct { + CreatedOn *string `json:"createdOn,omitempty"` + DeploymentId *string `json:"deploymentId,omitempty"` + Error *ErrorDefinition `json:"error,omitempty"` + LastUpdatedOn *string `json:"lastUpdatedOn,omitempty"` + RemediatedResourceId *string `json:"remediatedResourceId,omitempty"` + ResourceLocation *string `json:"resourceLocation,omitempty"` + Status *string `json:"status,omitempty"` +} + +func (o *RemediationDeployment) GetCreatedOnAsTime() (*time.Time, error) { + if o.CreatedOn == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedOn, "2006-01-02T15:04:05Z07:00") +} + +func (o *RemediationDeployment) SetCreatedOnAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedOn = &formatted +} + +func (o *RemediationDeployment) GetLastUpdatedOnAsTime() (*time.Time, error) { + if o.LastUpdatedOn == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdatedOn, "2006-01-02T15:04:05Z07:00") +} + +func (o *RemediationDeployment) SetLastUpdatedOnAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdatedOn = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediationdeploymentsummary.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediationdeploymentsummary.go new file mode 100644 index 00000000000..db2a3e65be5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediationdeploymentsummary.go @@ -0,0 +1,10 @@ +package remediations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationDeploymentSummary struct { + FailedDeployments *int64 `json:"failedDeployments,omitempty"` + SuccessfulDeployments *int64 `json:"successfulDeployments,omitempty"` + TotalDeployments *int64 `json:"totalDeployments,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediationfilters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediationfilters.go new file mode 100644 index 00000000000..4ded0931be9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediationfilters.go @@ -0,0 +1,8 @@ +package remediations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationFilters struct { + Locations *[]string `json:"locations,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediationproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediationproperties.go new file mode 100644 index 00000000000..501085bcf65 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediationproperties.go @@ -0,0 +1,50 @@ +package remediations + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationProperties struct { + CorrelationId *string `json:"correlationId,omitempty"` + CreatedOn *string `json:"createdOn,omitempty"` + DeploymentStatus *RemediationDeploymentSummary `json:"deploymentStatus,omitempty"` + FailureThreshold *RemediationPropertiesFailureThreshold `json:"failureThreshold,omitempty"` + Filters *RemediationFilters `json:"filters,omitempty"` + LastUpdatedOn *string `json:"lastUpdatedOn,omitempty"` + ParallelDeployments *int64 `json:"parallelDeployments,omitempty"` + PolicyAssignmentId *string `json:"policyAssignmentId,omitempty"` + PolicyDefinitionReferenceId *string `json:"policyDefinitionReferenceId,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ResourceCount *int64 `json:"resourceCount,omitempty"` + ResourceDiscoveryMode *ResourceDiscoveryMode `json:"resourceDiscoveryMode,omitempty"` + StatusMessage *string `json:"statusMessage,omitempty"` +} + +func (o *RemediationProperties) GetCreatedOnAsTime() (*time.Time, error) { + if o.CreatedOn == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedOn, "2006-01-02T15:04:05Z07:00") +} + +func (o *RemediationProperties) SetCreatedOnAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedOn = &formatted +} + +func (o *RemediationProperties) GetLastUpdatedOnAsTime() (*time.Time, error) { + if o.LastUpdatedOn == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdatedOn, "2006-01-02T15:04:05Z07:00") +} + +func (o *RemediationProperties) SetLastUpdatedOnAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdatedOn = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediationpropertiesfailurethreshold.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediationpropertiesfailurethreshold.go new file mode 100644 index 00000000000..f3a8d59c959 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_remediationpropertiesfailurethreshold.go @@ -0,0 +1,8 @@ +package remediations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemediationPropertiesFailureThreshold struct { + Percentage *float64 `json:"percentage,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_typederrorinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_typederrorinfo.go new file mode 100644 index 00000000000..3819fb61aff --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/model_typederrorinfo.go @@ -0,0 +1,9 @@ +package remediations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TypedErrorInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/predicates.go new file mode 100644 index 00000000000..308b956527d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/predicates.go @@ -0,0 +1,62 @@ +package remediations + +type RemediationOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p RemediationOperationPredicate) Matches(input Remediation) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type RemediationDeploymentOperationPredicate struct { + CreatedOn *string + DeploymentId *string + LastUpdatedOn *string + RemediatedResourceId *string + ResourceLocation *string + Status *string +} + +func (p RemediationDeploymentOperationPredicate) Matches(input RemediationDeployment) bool { + + if p.CreatedOn != nil && (input.CreatedOn == nil && *p.CreatedOn != *input.CreatedOn) { + return false + } + + if p.DeploymentId != nil && (input.DeploymentId == nil && *p.DeploymentId != *input.DeploymentId) { + return false + } + + if p.LastUpdatedOn != nil && (input.LastUpdatedOn == nil && *p.LastUpdatedOn != *input.LastUpdatedOn) { + return false + } + + if p.RemediatedResourceId != nil && (input.RemediatedResourceId == nil && *p.RemediatedResourceId != *input.RemediatedResourceId) { + return false + } + + if p.ResourceLocation != nil && (input.ResourceLocation == nil && *p.ResourceLocation != *input.ResourceLocation) { + return false + } + + if p.Status != nil && (input.Status == nil && *p.Status != *input.Status) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/version.go new file mode 100644 index 00000000000..17f0e394ae0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations/version.go @@ -0,0 +1,12 @@ +package remediations + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/remediations/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/README.md new file mode 100644 index 00000000000..b9c6ba43e43 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard` Documentation + +The `dashboard` SDK allows for interaction with the Azure Resource Manager Service `portal` (API Version `2019-01-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard" +``` + + +### Client Initialization + +```go +client := dashboard.NewDashboardClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DashboardClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := dashboard.NewDashboardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dashboardValue") + +payload := dashboard.Dashboard{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DashboardClient.Delete` + +```go +ctx := context.TODO() +id := dashboard.NewDashboardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dashboardValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DashboardClient.Get` + +```go +ctx := context.TODO() +id := dashboard.NewDashboardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dashboardValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DashboardClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := dashboard.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DashboardClient.ListBySubscription` + +```go +ctx := context.TODO() +id := dashboard.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DashboardClient.Update` + +```go +ctx := context.TODO() +id := dashboard.NewDashboardID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dashboardValue") + +payload := dashboard.PatchableDashboard{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/client.go new file mode 100644 index 00000000000..c027cc891f6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/client.go @@ -0,0 +1,18 @@ +package dashboard + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DashboardClient struct { + Client autorest.Client + baseUri string +} + +func NewDashboardClientWithBaseURI(endpoint string) DashboardClient { + return DashboardClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/id_dashboard.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/id_dashboard.go new file mode 100644 index 00000000000..930ea221891 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/id_dashboard.go @@ -0,0 +1,124 @@ +package dashboard + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DashboardId{} + +// DashboardId is a struct representing the Resource ID for a Dashboard +type DashboardId struct { + SubscriptionId string + ResourceGroupName string + DashboardName string +} + +// NewDashboardID returns a new DashboardId struct +func NewDashboardID(subscriptionId string, resourceGroupName string, dashboardName string) DashboardId { + return DashboardId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + DashboardName: dashboardName, + } +} + +// ParseDashboardID parses 'input' into a DashboardId +func ParseDashboardID(input string) (*DashboardId, error) { + parser := resourceids.NewParserFromResourceIdType(DashboardId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DashboardId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DashboardName, ok = parsed.Parsed["dashboardName"]; !ok { + return nil, fmt.Errorf("the segment 'dashboardName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDashboardIDInsensitively parses 'input' case-insensitively into a DashboardId +// note: this method should only be used for API response data and not user input +func ParseDashboardIDInsensitively(input string) (*DashboardId, error) { + parser := resourceids.NewParserFromResourceIdType(DashboardId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DashboardId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.DashboardName, ok = parsed.Parsed["dashboardName"]; !ok { + return nil, fmt.Errorf("the segment 'dashboardName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDashboardID checks that 'input' can be parsed as a Dashboard ID +func ValidateDashboardID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDashboardID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Dashboard ID +func (id DashboardId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Portal/dashboards/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.DashboardName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Dashboard ID +func (id DashboardId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftPortal", "Microsoft.Portal", "Microsoft.Portal"), + resourceids.StaticSegment("staticDashboards", "dashboards", "dashboards"), + resourceids.UserSpecifiedSegment("dashboardName", "dashboardValue"), + } +} + +// String returns a human-readable description of this Dashboard ID +func (id DashboardId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Dashboard Name: %q", id.DashboardName), + } + return fmt.Sprintf("Dashboard (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_createorupdate_autorest.go new file mode 100644 index 00000000000..d5b6b14ea12 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package dashboard + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Dashboard +} + +// CreateOrUpdate ... +func (c DashboardClient) CreateOrUpdate(ctx context.Context, id DashboardId, input Dashboard) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c DashboardClient) preparerForCreateOrUpdate(ctx context.Context, id DashboardId, input Dashboard) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c DashboardClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_delete_autorest.go new file mode 100644 index 00000000000..6928656f121 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_delete_autorest.go @@ -0,0 +1,66 @@ +package dashboard + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c DashboardClient) Delete(ctx context.Context, id DashboardId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c DashboardClient) preparerForDelete(ctx context.Context, id DashboardId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c DashboardClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_get_autorest.go new file mode 100644 index 00000000000..84cd9bfdb23 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_get_autorest.go @@ -0,0 +1,68 @@ +package dashboard + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Dashboard +} + +// Get ... +func (c DashboardClient) Get(ctx context.Context, id DashboardId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DashboardClient) preparerForGet(ctx context.Context, id DashboardId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DashboardClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..afc26fbbef9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package dashboard + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Dashboard + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Dashboard +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c DashboardClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c DashboardClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Portal/dashboards", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c DashboardClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c DashboardClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Dashboard `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c DashboardClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, DashboardOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DashboardClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate DashboardOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Dashboard, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..7418fde9bb2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package dashboard + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Dashboard + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []Dashboard +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c DashboardClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c DashboardClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Portal/dashboards", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c DashboardClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c DashboardClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Dashboard `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c DashboardClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, DashboardOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DashboardClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DashboardOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]Dashboard, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_update_autorest.go new file mode 100644 index 00000000000..3111fe87bc9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/method_update_autorest.go @@ -0,0 +1,69 @@ +package dashboard + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Dashboard +} + +// Update ... +func (c DashboardClient) Update(ctx context.Context, id DashboardId, input PatchableDashboard) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dashboard.DashboardClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c DashboardClient) preparerForUpdate(ctx context.Context, id DashboardId, input PatchableDashboard) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c DashboardClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_dashboard.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_dashboard.go new file mode 100644 index 00000000000..dc617f03923 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_dashboard.go @@ -0,0 +1,13 @@ +package dashboard + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Dashboard struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *DashboardProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_dashboardlens.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_dashboardlens.go new file mode 100644 index 00000000000..afec2b8e6b0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_dashboardlens.go @@ -0,0 +1,10 @@ +package dashboard + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DashboardLens struct { + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Order int64 `json:"order"` + Parts map[string]DashboardParts `json:"parts"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_dashboardparts.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_dashboardparts.go new file mode 100644 index 00000000000..da33ac3c43a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_dashboardparts.go @@ -0,0 +1,9 @@ +package dashboard + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DashboardParts struct { + Metadata *interface{} `json:"metadata,omitempty"` + Position DashboardPartsPosition `json:"position"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_dashboardpartsposition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_dashboardpartsposition.go new file mode 100644 index 00000000000..ec317bbcc2c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_dashboardpartsposition.go @@ -0,0 +1,12 @@ +package dashboard + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DashboardPartsPosition struct { + ColSpan int64 `json:"colSpan"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` + RowSpan int64 `json:"rowSpan"` + X int64 `json:"x"` + Y int64 `json:"y"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_dashboardproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_dashboardproperties.go new file mode 100644 index 00000000000..d70ef395fa8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_dashboardproperties.go @@ -0,0 +1,9 @@ +package dashboard + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DashboardProperties struct { + Lenses *map[string]DashboardLens `json:"lenses,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_patchabledashboard.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_patchabledashboard.go new file mode 100644 index 00000000000..7560884a7f8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/model_patchabledashboard.go @@ -0,0 +1,9 @@ +package dashboard + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchableDashboard struct { + Properties *DashboardProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/predicates.go new file mode 100644 index 00000000000..61283d91f3a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/predicates.go @@ -0,0 +1,29 @@ +package dashboard + +type DashboardOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p DashboardOperationPredicate) Matches(input Dashboard) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/version.go new file mode 100644 index 00000000000..523ca92a281 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard/version.go @@ -0,0 +1,12 @@ +package dashboard + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-01-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/dashboard/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/README.md new file mode 100644 index 00000000000..485d1a89f37 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/README.md @@ -0,0 +1,88 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration` Documentation + +The `tenantconfiguration` SDK allows for interaction with the Azure Resource Manager Service `portal` (API Version `2019-01-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration" +``` + + +### Client Initialization + +```go +client := tenantconfiguration.NewTenantConfigurationClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `TenantConfigurationClient.TenantConfigurationsCreate` + +```go +ctx := context.TODO() + +payload := tenantconfiguration.Configuration{ + // ... +} + + +read, err := client.TenantConfigurationsCreate(ctx, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TenantConfigurationClient.TenantConfigurationsDelete` + +```go +ctx := context.TODO() + + +read, err := client.TenantConfigurationsDelete(ctx) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TenantConfigurationClient.TenantConfigurationsGet` + +```go +ctx := context.TODO() + + +read, err := client.TenantConfigurationsGet(ctx) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TenantConfigurationClient.TenantConfigurationsList` + +```go +ctx := context.TODO() + + +read, err := client.TenantConfigurationsList(ctx) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/client.go new file mode 100644 index 00000000000..b4cf4a17cf2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/client.go @@ -0,0 +1,18 @@ +package tenantconfiguration + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TenantConfigurationClient struct { + Client autorest.Client + baseUri string +} + +func NewTenantConfigurationClientWithBaseURI(endpoint string) TenantConfigurationClient { + return TenantConfigurationClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationscreate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationscreate_autorest.go new file mode 100644 index 00000000000..96efc828bd2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationscreate_autorest.go @@ -0,0 +1,69 @@ +package tenantconfiguration + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TenantConfigurationsCreateOperationResponse struct { + HttpResponse *http.Response + Model *Configuration +} + +// TenantConfigurationsCreate ... +func (c TenantConfigurationClient) TenantConfigurationsCreate(ctx context.Context, input Configuration) (result TenantConfigurationsCreateOperationResponse, err error) { + req, err := c.preparerForTenantConfigurationsCreate(ctx, input) + if err != nil { + err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "TenantConfigurationsCreate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "TenantConfigurationsCreate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForTenantConfigurationsCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "TenantConfigurationsCreate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForTenantConfigurationsCreate prepares the TenantConfigurationsCreate request. +func (c TenantConfigurationClient) preparerForTenantConfigurationsCreate(ctx context.Context, input Configuration) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath("/providers/Microsoft.Portal/tenantConfigurations/default"), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForTenantConfigurationsCreate handles the response to the TenantConfigurationsCreate request. The method always +// closes the http.Response Body. +func (c TenantConfigurationClient) responderForTenantConfigurationsCreate(resp *http.Response) (result TenantConfigurationsCreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationsdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationsdelete_autorest.go new file mode 100644 index 00000000000..de32952bd7f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationsdelete_autorest.go @@ -0,0 +1,66 @@ +package tenantconfiguration + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TenantConfigurationsDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// TenantConfigurationsDelete ... +func (c TenantConfigurationClient) TenantConfigurationsDelete(ctx context.Context) (result TenantConfigurationsDeleteOperationResponse, err error) { + req, err := c.preparerForTenantConfigurationsDelete(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "TenantConfigurationsDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "TenantConfigurationsDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForTenantConfigurationsDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "TenantConfigurationsDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForTenantConfigurationsDelete prepares the TenantConfigurationsDelete request. +func (c TenantConfigurationClient) preparerForTenantConfigurationsDelete(ctx context.Context) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath("/providers/Microsoft.Portal/tenantConfigurations/default"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForTenantConfigurationsDelete handles the response to the TenantConfigurationsDelete request. The method always +// closes the http.Response Body. +func (c TenantConfigurationClient) responderForTenantConfigurationsDelete(resp *http.Response) (result TenantConfigurationsDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationsget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationsget_autorest.go new file mode 100644 index 00000000000..77f33766c48 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationsget_autorest.go @@ -0,0 +1,68 @@ +package tenantconfiguration + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TenantConfigurationsGetOperationResponse struct { + HttpResponse *http.Response + Model *Configuration +} + +// TenantConfigurationsGet ... +func (c TenantConfigurationClient) TenantConfigurationsGet(ctx context.Context) (result TenantConfigurationsGetOperationResponse, err error) { + req, err := c.preparerForTenantConfigurationsGet(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "TenantConfigurationsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "TenantConfigurationsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForTenantConfigurationsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "TenantConfigurationsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForTenantConfigurationsGet prepares the TenantConfigurationsGet request. +func (c TenantConfigurationClient) preparerForTenantConfigurationsGet(ctx context.Context) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath("/providers/Microsoft.Portal/tenantConfigurations/default"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForTenantConfigurationsGet handles the response to the TenantConfigurationsGet request. The method always +// closes the http.Response Body. +func (c TenantConfigurationClient) responderForTenantConfigurationsGet(resp *http.Response) (result TenantConfigurationsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationslist_autorest.go new file mode 100644 index 00000000000..f95451ec1b3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/method_tenantconfigurationslist_autorest.go @@ -0,0 +1,68 @@ +package tenantconfiguration + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TenantConfigurationsListOperationResponse struct { + HttpResponse *http.Response + Model *ConfigurationList +} + +// TenantConfigurationsList ... +func (c TenantConfigurationClient) TenantConfigurationsList(ctx context.Context) (result TenantConfigurationsListOperationResponse, err error) { + req, err := c.preparerForTenantConfigurationsList(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "TenantConfigurationsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "TenantConfigurationsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForTenantConfigurationsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "tenantconfiguration.TenantConfigurationClient", "TenantConfigurationsList", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForTenantConfigurationsList prepares the TenantConfigurationsList request. +func (c TenantConfigurationClient) preparerForTenantConfigurationsList(ctx context.Context) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath("/providers/Microsoft.Portal/tenantConfigurations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForTenantConfigurationsList handles the response to the TenantConfigurationsList request. The method always +// closes the http.Response Body. +func (c TenantConfigurationClient) responderForTenantConfigurationsList(resp *http.Response) (result TenantConfigurationsListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/model_configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/model_configuration.go new file mode 100644 index 00000000000..cac3f7cdae5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/model_configuration.go @@ -0,0 +1,11 @@ +package tenantconfiguration + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Configuration struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ConfigurationProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/model_configurationlist.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/model_configurationlist.go new file mode 100644 index 00000000000..4566213fce7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/model_configurationlist.go @@ -0,0 +1,9 @@ +package tenantconfiguration + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationList struct { + NextLink *string `json:"nextLink,omitempty"` + Value *[]Configuration `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/model_configurationproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/model_configurationproperties.go new file mode 100644 index 00000000000..0b5997ecd4a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/model_configurationproperties.go @@ -0,0 +1,8 @@ +package tenantconfiguration + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationProperties struct { + EnforcePrivateMarkdownStorage *bool `json:"enforcePrivateMarkdownStorage,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/version.go new file mode 100644 index 00000000000..85b3a535a05 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration/version.go @@ -0,0 +1,12 @@ +package tenantconfiguration + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2019-01-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/tenantconfiguration/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/README.md new file mode 100644 index 00000000000..62f69b241ec --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/README.md @@ -0,0 +1,69 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations` Documentation + +The `configurations` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations" +``` + + +### Client Initialization + +```go +client := configurations.NewConfigurationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ConfigurationsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := configurations.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "configurationValue") + +payload := configurations.Configuration{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ConfigurationsClient.Get` + +```go +ctx := context.TODO() +id := configurations.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "configurationValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConfigurationsClient.ListByServer` + +```go +ctx := context.TODO() +id := configurations.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.ListByServer(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/client.go new file mode 100644 index 00000000000..bbe813edd98 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/client.go @@ -0,0 +1,18 @@ +package configurations + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationsClient struct { + Client autorest.Client + baseUri string +} + +func NewConfigurationsClientWithBaseURI(endpoint string) ConfigurationsClient { + return ConfigurationsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/id_configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/id_configuration.go new file mode 100644 index 00000000000..e8e5f35eeb5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/id_configuration.go @@ -0,0 +1,137 @@ +package configurations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ConfigurationId{} + +// ConfigurationId is a struct representing the Resource ID for a Configuration +type ConfigurationId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + ConfigurationName string +} + +// NewConfigurationID returns a new ConfigurationId struct +func NewConfigurationID(subscriptionId string, resourceGroupName string, serverName string, configurationName string) ConfigurationId { + return ConfigurationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + ConfigurationName: configurationName, + } +} + +// ParseConfigurationID parses 'input' into a ConfigurationId +func ParseConfigurationID(input string) (*ConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(ConfigurationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { + return nil, fmt.Errorf("the segment 'configurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseConfigurationIDInsensitively parses 'input' case-insensitively into a ConfigurationId +// note: this method should only be used for API response data and not user input +func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(ConfigurationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { + return nil, fmt.Errorf("the segment 'configurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID +func ValidateConfigurationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseConfigurationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Configuration ID +func (id ConfigurationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/configurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.ConfigurationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Configuration ID +func (id ConfigurationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticConfigurations", "configurations", "configurations"), + resourceids.UserSpecifiedSegment("configurationName", "configurationValue"), + } +} + +// String returns a human-readable description of this Configuration ID +func (id ConfigurationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Configuration Name: %q", id.ConfigurationName), + } + return fmt.Sprintf("Configuration (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/id_server.go new file mode 100644 index 00000000000..ae6c436e5c0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/id_server.go @@ -0,0 +1,124 @@ +package configurations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/method_createorupdate_autorest.go new file mode 100644 index 00000000000..c1e771a52d1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package configurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c ConfigurationsClient) CreateOrUpdate(ctx context.Context, id ConfigurationId, input Configuration) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ConfigurationsClient) CreateOrUpdateThenPoll(ctx context.Context, id ConfigurationId, input Configuration) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ConfigurationsClient) preparerForCreateOrUpdate(ctx context.Context, id ConfigurationId, input Configuration) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ConfigurationsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/method_get_autorest.go new file mode 100644 index 00000000000..2aeb488f91c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/method_get_autorest.go @@ -0,0 +1,68 @@ +package configurations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Configuration +} + +// Get ... +func (c ConfigurationsClient) Get(ctx context.Context, id ConfigurationId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ConfigurationsClient) preparerForGet(ctx context.Context, id ConfigurationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ConfigurationsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/method_listbyserver_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/method_listbyserver_autorest.go new file mode 100644 index 00000000000..950a5ec48c1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/method_listbyserver_autorest.go @@ -0,0 +1,69 @@ +package configurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServerOperationResponse struct { + HttpResponse *http.Response + Model *ConfigurationListResult +} + +// ListByServer ... +func (c ConfigurationsClient) ListByServer(ctx context.Context, id ServerId) (result ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServer(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "ListByServer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "ListByServer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByServer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "ListByServer", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByServer prepares the ListByServer request. +func (c ConfigurationsClient) preparerForListByServer(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/configurations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByServer handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (c ConfigurationsClient) responderForListByServer(resp *http.Response) (result ListByServerOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/model_configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/model_configuration.go new file mode 100644 index 00000000000..84bf2c28127 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/model_configuration.go @@ -0,0 +1,11 @@ +package configurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Configuration struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ConfigurationProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/model_configurationlistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/model_configurationlistresult.go new file mode 100644 index 00000000000..98af12f5801 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/model_configurationlistresult.go @@ -0,0 +1,8 @@ +package configurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationListResult struct { + Value *[]Configuration `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/model_configurationproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/model_configurationproperties.go new file mode 100644 index 00000000000..51143bf6154 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/model_configurationproperties.go @@ -0,0 +1,13 @@ +package configurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationProperties struct { + AllowedValues *string `json:"allowedValues,omitempty"` + DataType *string `json:"dataType,omitempty"` + DefaultValue *string `json:"defaultValue,omitempty"` + Description *string `json:"description,omitempty"` + Source *string `json:"source,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/version.go new file mode 100644 index 00000000000..14506a04060 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations/version.go @@ -0,0 +1,12 @@ +package configurations + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/configurations/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/README.md new file mode 100644 index 00000000000..62a59cee9f3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/README.md @@ -0,0 +1,81 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases` Documentation + +The `databases` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases" +``` + + +### Client Initialization + +```go +client := databases.NewDatabasesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DatabasesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "databaseValue") + +payload := databases.Database{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Delete` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "databaseValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Get` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "databaseValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.ListByServer` + +```go +ctx := context.TODO() +id := databases.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.ListByServer(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/client.go new file mode 100644 index 00000000000..5305d65eb6c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/client.go @@ -0,0 +1,18 @@ +package databases + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesClient struct { + Client autorest.Client + baseUri string +} + +func NewDatabasesClientWithBaseURI(endpoint string) DatabasesClient { + return DatabasesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/id_database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/id_database.go new file mode 100644 index 00000000000..e32e488ab16 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/id_database.go @@ -0,0 +1,137 @@ +package databases + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DatabaseId{} + +// DatabaseId is a struct representing the Resource ID for a Database +type DatabaseId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + DatabaseName string +} + +// NewDatabaseID returns a new DatabaseId struct +func NewDatabaseID(subscriptionId string, resourceGroupName string, serverName string, databaseName string) DatabaseId { + return DatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + DatabaseName: databaseName, + } +} + +// ParseDatabaseID parses 'input' into a DatabaseId +func ParseDatabaseID(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDatabaseIDInsensitively parses 'input' case-insensitively into a DatabaseId +// note: this method should only be used for API response data and not user input +func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDatabaseID checks that 'input' can be parsed as a Database ID +func ValidateDatabaseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Database ID +func (id DatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/databases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.DatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Database ID +func (id DatabaseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + } +} + +// String returns a human-readable description of this Database ID +func (id DatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + } + return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/id_server.go new file mode 100644 index 00000000000..3e180bab18c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/id_server.go @@ -0,0 +1,124 @@ +package databases + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/method_createorupdate_autorest.go new file mode 100644 index 00000000000..8046543297d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c DatabasesClient) CreateOrUpdate(ctx context.Context, id DatabaseId, input Database) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c DatabasesClient) CreateOrUpdateThenPoll(ctx context.Context, id DatabaseId, input Database) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c DatabasesClient) preparerForCreateOrUpdate(ctx context.Context, id DatabaseId, input Database) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c DatabasesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/method_delete_autorest.go new file mode 100644 index 00000000000..13221da85a6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/method_delete_autorest.go @@ -0,0 +1,78 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c DatabasesClient) Delete(ctx context.Context, id DatabaseId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DatabasesClient) DeleteThenPoll(ctx context.Context, id DatabaseId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c DatabasesClient) preparerForDelete(ctx context.Context, id DatabaseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c DatabasesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/method_get_autorest.go new file mode 100644 index 00000000000..f35d313d226 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/method_get_autorest.go @@ -0,0 +1,68 @@ +package databases + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Database +} + +// Get ... +func (c DatabasesClient) Get(ctx context.Context, id DatabaseId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DatabasesClient) preparerForGet(ctx context.Context, id DatabaseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DatabasesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/method_listbyserver_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/method_listbyserver_autorest.go new file mode 100644 index 00000000000..c02aac94bf6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/method_listbyserver_autorest.go @@ -0,0 +1,69 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServerOperationResponse struct { + HttpResponse *http.Response + Model *DatabaseListResult +} + +// ListByServer ... +func (c DatabasesClient) ListByServer(ctx context.Context, id ServerId) (result ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServer(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByServer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByServer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByServer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByServer", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByServer prepares the ListByServer request. +func (c DatabasesClient) preparerForListByServer(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/databases", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByServer handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (c DatabasesClient) responderForListByServer(resp *http.Response) (result ListByServerOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/model_database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/model_database.go new file mode 100644 index 00000000000..a9880a7432b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/model_database.go @@ -0,0 +1,11 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Database struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DatabaseProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/model_databaselistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/model_databaselistresult.go new file mode 100644 index 00000000000..80645ead092 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/model_databaselistresult.go @@ -0,0 +1,8 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseListResult struct { + Value *[]Database `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/model_databaseproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/model_databaseproperties.go new file mode 100644 index 00000000000..85fcbd70d57 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/model_databaseproperties.go @@ -0,0 +1,9 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseProperties struct { + Charset *string `json:"charset,omitempty"` + Collation *string `json:"collation,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/version.go new file mode 100644 index 00000000000..8d6c0a801d3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases/version.go @@ -0,0 +1,12 @@ +package databases + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/databases/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/README.md new file mode 100644 index 00000000000..df11d1f28ee --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/README.md @@ -0,0 +1,81 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules` Documentation + +The `firewallrules` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules" +``` + + +### Client Initialization + +```go +client := firewallrules.NewFirewallRulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `FirewallRulesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "firewallRuleValue") + +payload := firewallrules.FirewallRule{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `FirewallRulesClient.Delete` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "firewallRuleValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `FirewallRulesClient.Get` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "firewallRuleValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FirewallRulesClient.ListByServer` + +```go +ctx := context.TODO() +id := firewallrules.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.ListByServer(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/client.go new file mode 100644 index 00000000000..ac01b0459a1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/client.go @@ -0,0 +1,18 @@ +package firewallrules + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRulesClient struct { + Client autorest.Client + baseUri string +} + +func NewFirewallRulesClientWithBaseURI(endpoint string) FirewallRulesClient { + return FirewallRulesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/id_firewallrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/id_firewallrule.go new file mode 100644 index 00000000000..28f1497ed6c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/id_firewallrule.go @@ -0,0 +1,137 @@ +package firewallrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FirewallRuleId{} + +// FirewallRuleId is a struct representing the Resource ID for a Firewall Rule +type FirewallRuleId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + FirewallRuleName string +} + +// NewFirewallRuleID returns a new FirewallRuleId struct +func NewFirewallRuleID(subscriptionId string, resourceGroupName string, serverName string, firewallRuleName string) FirewallRuleId { + return FirewallRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + FirewallRuleName: firewallRuleName, + } +} + +// ParseFirewallRuleID parses 'input' into a FirewallRuleId +func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FirewallRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'firewallRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFirewallRuleIDInsensitively parses 'input' case-insensitively into a FirewallRuleId +// note: this method should only be used for API response data and not user input +func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FirewallRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'firewallRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID +func ValidateFirewallRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFirewallRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Firewall Rule ID +func (id FirewallRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/firewallRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.FirewallRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Firewall Rule ID +func (id FirewallRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticFirewallRules", "firewallRules", "firewallRules"), + resourceids.UserSpecifiedSegment("firewallRuleName", "firewallRuleValue"), + } +} + +// String returns a human-readable description of this Firewall Rule ID +func (id FirewallRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Firewall Rule Name: %q", id.FirewallRuleName), + } + return fmt.Sprintf("Firewall Rule (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/id_server.go new file mode 100644 index 00000000000..dd549b1e4ba --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/id_server.go @@ -0,0 +1,124 @@ +package firewallrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/method_createorupdate_autorest.go new file mode 100644 index 00000000000..0dfa761f1a0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package firewallrules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c FirewallRulesClient) CreateOrUpdate(ctx context.Context, id FirewallRuleId, input FirewallRule) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c FirewallRulesClient) CreateOrUpdateThenPoll(ctx context.Context, id FirewallRuleId, input FirewallRule) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c FirewallRulesClient) preparerForCreateOrUpdate(ctx context.Context, id FirewallRuleId, input FirewallRule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c FirewallRulesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/method_delete_autorest.go new file mode 100644 index 00000000000..ec4b290ecdd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/method_delete_autorest.go @@ -0,0 +1,78 @@ +package firewallrules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c FirewallRulesClient) Delete(ctx context.Context, id FirewallRuleId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c FirewallRulesClient) DeleteThenPoll(ctx context.Context, id FirewallRuleId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c FirewallRulesClient) preparerForDelete(ctx context.Context, id FirewallRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c FirewallRulesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/method_get_autorest.go new file mode 100644 index 00000000000..1391c01ba1a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/method_get_autorest.go @@ -0,0 +1,68 @@ +package firewallrules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *FirewallRule +} + +// Get ... +func (c FirewallRulesClient) Get(ctx context.Context, id FirewallRuleId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c FirewallRulesClient) preparerForGet(ctx context.Context, id FirewallRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c FirewallRulesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/method_listbyserver_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/method_listbyserver_autorest.go new file mode 100644 index 00000000000..70624d92ee8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/method_listbyserver_autorest.go @@ -0,0 +1,69 @@ +package firewallrules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServerOperationResponse struct { + HttpResponse *http.Response + Model *FirewallRuleListResult +} + +// ListByServer ... +func (c FirewallRulesClient) ListByServer(ctx context.Context, id ServerId) (result ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServer(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "ListByServer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "ListByServer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByServer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "ListByServer", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByServer prepares the ListByServer request. +func (c FirewallRulesClient) preparerForListByServer(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/firewallRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByServer handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (c FirewallRulesClient) responderForListByServer(resp *http.Response) (result ListByServerOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/model_firewallrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/model_firewallrule.go new file mode 100644 index 00000000000..3178a13ed2c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/model_firewallrule.go @@ -0,0 +1,11 @@ +package firewallrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties FirewallRuleProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/model_firewallrulelistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/model_firewallrulelistresult.go new file mode 100644 index 00000000000..c01e91fae56 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/model_firewallrulelistresult.go @@ -0,0 +1,8 @@ +package firewallrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRuleListResult struct { + Value *[]FirewallRule `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/model_firewallruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/model_firewallruleproperties.go new file mode 100644 index 00000000000..fca4e1c3684 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/model_firewallruleproperties.go @@ -0,0 +1,9 @@ +package firewallrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRuleProperties struct { + EndIPAddress string `json:"endIpAddress"` + StartIPAddress string `json:"startIpAddress"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/version.go new file mode 100644 index 00000000000..38c1ba53b63 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules/version.go @@ -0,0 +1,12 @@ +package firewallrules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/firewallrules/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/README.md new file mode 100644 index 00000000000..0867f669fea --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/README.md @@ -0,0 +1,36 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas` Documentation + +The `replicas` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas" +``` + + +### Client Initialization + +```go +client := replicas.NewReplicasClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ReplicasClient.ListByServer` + +```go +ctx := context.TODO() +id := replicas.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.ListByServer(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/client.go new file mode 100644 index 00000000000..3f4e5e68741 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/client.go @@ -0,0 +1,18 @@ +package replicas + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReplicasClient struct { + Client autorest.Client + baseUri string +} + +func NewReplicasClientWithBaseURI(endpoint string) ReplicasClient { + return ReplicasClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/constants.go new file mode 100644 index 00000000000..b42c112ef78 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/constants.go @@ -0,0 +1,381 @@ +package replicas + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GeoRedundantBackup string + +const ( + GeoRedundantBackupDisabled GeoRedundantBackup = "Disabled" + GeoRedundantBackupEnabled GeoRedundantBackup = "Enabled" +) + +func PossibleValuesForGeoRedundantBackup() []string { + return []string{ + string(GeoRedundantBackupDisabled), + string(GeoRedundantBackupEnabled), + } +} + +func parseGeoRedundantBackup(input string) (*GeoRedundantBackup, error) { + vals := map[string]GeoRedundantBackup{ + "disabled": GeoRedundantBackupDisabled, + "enabled": GeoRedundantBackupEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GeoRedundantBackup(input) + return &out, nil +} + +type InfrastructureEncryption string + +const ( + InfrastructureEncryptionDisabled InfrastructureEncryption = "Disabled" + InfrastructureEncryptionEnabled InfrastructureEncryption = "Enabled" +) + +func PossibleValuesForInfrastructureEncryption() []string { + return []string{ + string(InfrastructureEncryptionDisabled), + string(InfrastructureEncryptionEnabled), + } +} + +func parseInfrastructureEncryption(input string) (*InfrastructureEncryption, error) { + vals := map[string]InfrastructureEncryption{ + "disabled": InfrastructureEncryptionDisabled, + "enabled": InfrastructureEncryptionEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InfrastructureEncryption(input) + return &out, nil +} + +type MinimalTlsVersionEnum string + +const ( + MinimalTlsVersionEnumTLSEnforcementDisabled MinimalTlsVersionEnum = "TLSEnforcementDisabled" + MinimalTlsVersionEnumTLSOneOne MinimalTlsVersionEnum = "TLS1_1" + MinimalTlsVersionEnumTLSOneTwo MinimalTlsVersionEnum = "TLS1_2" + MinimalTlsVersionEnumTLSOneZero MinimalTlsVersionEnum = "TLS1_0" +) + +func PossibleValuesForMinimalTlsVersionEnum() []string { + return []string{ + string(MinimalTlsVersionEnumTLSEnforcementDisabled), + string(MinimalTlsVersionEnumTLSOneOne), + string(MinimalTlsVersionEnumTLSOneTwo), + string(MinimalTlsVersionEnumTLSOneZero), + } +} + +func parseMinimalTlsVersionEnum(input string) (*MinimalTlsVersionEnum, error) { + vals := map[string]MinimalTlsVersionEnum{ + "tlsenforcementdisabled": MinimalTlsVersionEnumTLSEnforcementDisabled, + "tls1_1": MinimalTlsVersionEnumTLSOneOne, + "tls1_2": MinimalTlsVersionEnumTLSOneTwo, + "tls1_0": MinimalTlsVersionEnumTLSOneZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MinimalTlsVersionEnum(input) + return &out, nil +} + +type PrivateEndpointProvisioningState string + +const ( + PrivateEndpointProvisioningStateApproving PrivateEndpointProvisioningState = "Approving" + PrivateEndpointProvisioningStateDropping PrivateEndpointProvisioningState = "Dropping" + PrivateEndpointProvisioningStateFailed PrivateEndpointProvisioningState = "Failed" + PrivateEndpointProvisioningStateReady PrivateEndpointProvisioningState = "Ready" + PrivateEndpointProvisioningStateRejecting PrivateEndpointProvisioningState = "Rejecting" +) + +func PossibleValuesForPrivateEndpointProvisioningState() []string { + return []string{ + string(PrivateEndpointProvisioningStateApproving), + string(PrivateEndpointProvisioningStateDropping), + string(PrivateEndpointProvisioningStateFailed), + string(PrivateEndpointProvisioningStateReady), + string(PrivateEndpointProvisioningStateRejecting), + } +} + +func parsePrivateEndpointProvisioningState(input string) (*PrivateEndpointProvisioningState, error) { + vals := map[string]PrivateEndpointProvisioningState{ + "approving": PrivateEndpointProvisioningStateApproving, + "dropping": PrivateEndpointProvisioningStateDropping, + "failed": PrivateEndpointProvisioningStateFailed, + "ready": PrivateEndpointProvisioningStateReady, + "rejecting": PrivateEndpointProvisioningStateRejecting, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointProvisioningState(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStateActionsRequire string + +const ( + PrivateLinkServiceConnectionStateActionsRequireNone PrivateLinkServiceConnectionStateActionsRequire = "None" +) + +func PossibleValuesForPrivateLinkServiceConnectionStateActionsRequire() []string { + return []string{ + string(PrivateLinkServiceConnectionStateActionsRequireNone), + } +} + +func parsePrivateLinkServiceConnectionStateActionsRequire(input string) (*PrivateLinkServiceConnectionStateActionsRequire, error) { + vals := map[string]PrivateLinkServiceConnectionStateActionsRequire{ + "none": PrivateLinkServiceConnectionStateActionsRequireNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStateActionsRequire(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStateStatus string + +const ( + PrivateLinkServiceConnectionStateStatusApproved PrivateLinkServiceConnectionStateStatus = "Approved" + PrivateLinkServiceConnectionStateStatusDisconnected PrivateLinkServiceConnectionStateStatus = "Disconnected" + PrivateLinkServiceConnectionStateStatusPending PrivateLinkServiceConnectionStateStatus = "Pending" + PrivateLinkServiceConnectionStateStatusRejected PrivateLinkServiceConnectionStateStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkServiceConnectionStateStatus() []string { + return []string{ + string(PrivateLinkServiceConnectionStateStatusApproved), + string(PrivateLinkServiceConnectionStateStatusDisconnected), + string(PrivateLinkServiceConnectionStateStatusPending), + string(PrivateLinkServiceConnectionStateStatusRejected), + } +} + +func parsePrivateLinkServiceConnectionStateStatus(input string) (*PrivateLinkServiceConnectionStateStatus, error) { + vals := map[string]PrivateLinkServiceConnectionStateStatus{ + "approved": PrivateLinkServiceConnectionStateStatusApproved, + "disconnected": PrivateLinkServiceConnectionStateStatusDisconnected, + "pending": PrivateLinkServiceConnectionStateStatusPending, + "rejected": PrivateLinkServiceConnectionStateStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStateStatus(input) + return &out, nil +} + +type PublicNetworkAccessEnum string + +const ( + PublicNetworkAccessEnumDisabled PublicNetworkAccessEnum = "Disabled" + PublicNetworkAccessEnumEnabled PublicNetworkAccessEnum = "Enabled" +) + +func PossibleValuesForPublicNetworkAccessEnum() []string { + return []string{ + string(PublicNetworkAccessEnumDisabled), + string(PublicNetworkAccessEnumEnabled), + } +} + +func parsePublicNetworkAccessEnum(input string) (*PublicNetworkAccessEnum, error) { + vals := map[string]PublicNetworkAccessEnum{ + "disabled": PublicNetworkAccessEnumDisabled, + "enabled": PublicNetworkAccessEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccessEnum(input) + return &out, nil +} + +type ServerState string + +const ( + ServerStateDisabled ServerState = "Disabled" + ServerStateDropping ServerState = "Dropping" + ServerStateInaccessible ServerState = "Inaccessible" + ServerStateReady ServerState = "Ready" +) + +func PossibleValuesForServerState() []string { + return []string{ + string(ServerStateDisabled), + string(ServerStateDropping), + string(ServerStateInaccessible), + string(ServerStateReady), + } +} + +func parseServerState(input string) (*ServerState, error) { + vals := map[string]ServerState{ + "disabled": ServerStateDisabled, + "dropping": ServerStateDropping, + "inaccessible": ServerStateInaccessible, + "ready": ServerStateReady, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerState(input) + return &out, nil +} + +type ServerVersion string + +const ( + ServerVersionNinePointFive ServerVersion = "9.5" + ServerVersionNinePointSix ServerVersion = "9.6" + ServerVersionOneOne ServerVersion = "11" + ServerVersionOneZero ServerVersion = "10" + ServerVersionOneZeroPointTwo ServerVersion = "10.2" + ServerVersionOneZeroPointZero ServerVersion = "10.0" +) + +func PossibleValuesForServerVersion() []string { + return []string{ + string(ServerVersionNinePointFive), + string(ServerVersionNinePointSix), + string(ServerVersionOneOne), + string(ServerVersionOneZero), + string(ServerVersionOneZeroPointTwo), + string(ServerVersionOneZeroPointZero), + } +} + +func parseServerVersion(input string) (*ServerVersion, error) { + vals := map[string]ServerVersion{ + "9.5": ServerVersionNinePointFive, + "9.6": ServerVersionNinePointSix, + "11": ServerVersionOneOne, + "10": ServerVersionOneZero, + "10.2": ServerVersionOneZeroPointTwo, + "10.0": ServerVersionOneZeroPointZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerVersion(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierGeneralPurpose SkuTier = "GeneralPurpose" + SkuTierMemoryOptimized SkuTier = "MemoryOptimized" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierGeneralPurpose), + string(SkuTierMemoryOptimized), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "generalpurpose": SkuTierGeneralPurpose, + "memoryoptimized": SkuTierMemoryOptimized, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} + +type SslEnforcementEnum string + +const ( + SslEnforcementEnumDisabled SslEnforcementEnum = "Disabled" + SslEnforcementEnumEnabled SslEnforcementEnum = "Enabled" +) + +func PossibleValuesForSslEnforcementEnum() []string { + return []string{ + string(SslEnforcementEnumDisabled), + string(SslEnforcementEnumEnabled), + } +} + +func parseSslEnforcementEnum(input string) (*SslEnforcementEnum, error) { + vals := map[string]SslEnforcementEnum{ + "disabled": SslEnforcementEnumDisabled, + "enabled": SslEnforcementEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SslEnforcementEnum(input) + return &out, nil +} + +type StorageAutogrow string + +const ( + StorageAutogrowDisabled StorageAutogrow = "Disabled" + StorageAutogrowEnabled StorageAutogrow = "Enabled" +) + +func PossibleValuesForStorageAutogrow() []string { + return []string{ + string(StorageAutogrowDisabled), + string(StorageAutogrowEnabled), + } +} + +func parseStorageAutogrow(input string) (*StorageAutogrow, error) { + vals := map[string]StorageAutogrow{ + "disabled": StorageAutogrowDisabled, + "enabled": StorageAutogrowEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAutogrow(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/id_server.go new file mode 100644 index 00000000000..5e6751acce0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/id_server.go @@ -0,0 +1,124 @@ +package replicas + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/method_listbyserver_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/method_listbyserver_autorest.go new file mode 100644 index 00000000000..c2cdbb89a83 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/method_listbyserver_autorest.go @@ -0,0 +1,69 @@ +package replicas + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServerOperationResponse struct { + HttpResponse *http.Response + Model *ServerListResult +} + +// ListByServer ... +func (c ReplicasClient) ListByServer(ctx context.Context, id ServerId) (result ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServer(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "replicas.ReplicasClient", "ListByServer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "replicas.ReplicasClient", "ListByServer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByServer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "replicas.ReplicasClient", "ListByServer", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByServer prepares the ListByServer request. +func (c ReplicasClient) preparerForListByServer(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/replicas", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByServer handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (c ReplicasClient) responderForListByServer(resp *http.Response) (result ListByServerOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_privateendpointproperty.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_privateendpointproperty.go new file mode 100644 index 00000000000..aa789c1702b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_privateendpointproperty.go @@ -0,0 +1,8 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointProperty struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_server.go new file mode 100644 index 00000000000..16c92f06695 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_server.go @@ -0,0 +1,19 @@ +package replicas + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Server struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ServerProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_serverlistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_serverlistresult.go new file mode 100644 index 00000000000..cfe3f1082fb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_serverlistresult.go @@ -0,0 +1,8 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerListResult struct { + Value *[]Server `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_serverprivateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_serverprivateendpointconnection.go new file mode 100644 index 00000000000..abef1be6aea --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_serverprivateendpointconnection.go @@ -0,0 +1,9 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Properties *ServerPrivateEndpointConnectionProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_serverprivateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_serverprivateendpointconnectionproperties.go new file mode 100644 index 00000000000..377f6aae3ac --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_serverprivateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *ServerPrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *PrivateEndpointProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_serverprivatelinkserviceconnectionstateproperty.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_serverprivatelinkserviceconnectionstateproperty.go new file mode 100644 index 00000000000..fb5596f395b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_serverprivatelinkserviceconnectionstateproperty.go @@ -0,0 +1,10 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPrivateLinkServiceConnectionStateProperty struct { + ActionsRequired *PrivateLinkServiceConnectionStateActionsRequire `json:"actionsRequired,omitempty"` + Description string `json:"description"` + Status PrivateLinkServiceConnectionStateStatus `json:"status"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_serverproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_serverproperties.go new file mode 100644 index 00000000000..502787a5c4b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_serverproperties.go @@ -0,0 +1,40 @@ +package replicas + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerProperties struct { + AdministratorLogin *string `json:"administratorLogin,omitempty"` + ByokEnforcement *string `json:"byokEnforcement,omitempty"` + EarliestRestoreDate *string `json:"earliestRestoreDate,omitempty"` + FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` + InfrastructureEncryption *InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + MasterServerId *string `json:"masterServerId,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PrivateEndpointConnections *[]ServerPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + ReplicaCapacity *int64 `json:"replicaCapacity,omitempty"` + ReplicationRole *string `json:"replicationRole,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + UserVisibleState *ServerState `json:"userVisibleState,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +func (o *ServerProperties) GetEarliestRestoreDateAsTime() (*time.Time, error) { + if o.EarliestRestoreDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EarliestRestoreDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ServerProperties) SetEarliestRestoreDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EarliestRestoreDate = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_sku.go new file mode 100644 index 00000000000..5d3c52561d8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_sku.go @@ -0,0 +1,12 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_storageprofile.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_storageprofile.go new file mode 100644 index 00000000000..9ae70a2ddc7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/model_storageprofile.go @@ -0,0 +1,11 @@ +package replicas + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfile struct { + BackupRetentionDays *int64 `json:"backupRetentionDays,omitempty"` + GeoRedundantBackup *GeoRedundantBackup `json:"geoRedundantBackup,omitempty"` + StorageAutogrow *StorageAutogrow `json:"storageAutogrow,omitempty"` + StorageMB *int64 `json:"storageMB,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/version.go new file mode 100644 index 00000000000..127efac8486 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas/version.go @@ -0,0 +1,12 @@ +package replicas + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/replicas/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/README.md new file mode 100644 index 00000000000..364e18bdfa7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/README.md @@ -0,0 +1,81 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators` Documentation + +The `serveradministrators` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators" +``` + + +### Client Initialization + +```go +client := serveradministrators.NewServerAdministratorsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServerAdministratorsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := serveradministrators.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := serveradministrators.ServerAdministratorResource{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServerAdministratorsClient.Delete` + +```go +ctx := context.TODO() +id := serveradministrators.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServerAdministratorsClient.Get` + +```go +ctx := context.TODO() +id := serveradministrators.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServerAdministratorsClient.List` + +```go +ctx := context.TODO() +id := serveradministrators.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/client.go new file mode 100644 index 00000000000..86b0c5954f3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/client.go @@ -0,0 +1,18 @@ +package serveradministrators + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerAdministratorsClient struct { + Client autorest.Client + baseUri string +} + +func NewServerAdministratorsClientWithBaseURI(endpoint string) ServerAdministratorsClient { + return ServerAdministratorsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/constants.go new file mode 100644 index 00000000000..30def71df4a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/constants.go @@ -0,0 +1,31 @@ +package serveradministrators + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdministratorType string + +const ( + AdministratorTypeActiveDirectory AdministratorType = "ActiveDirectory" +) + +func PossibleValuesForAdministratorType() []string { + return []string{ + string(AdministratorTypeActiveDirectory), + } +} + +func parseAdministratorType(input string) (*AdministratorType, error) { + vals := map[string]AdministratorType{ + "activedirectory": AdministratorTypeActiveDirectory, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AdministratorType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/id_server.go new file mode 100644 index 00000000000..d01b4688f0f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/id_server.go @@ -0,0 +1,124 @@ +package serveradministrators + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/method_createorupdate_autorest.go new file mode 100644 index 00000000000..36b49520cd5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package serveradministrators + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c ServerAdministratorsClient) CreateOrUpdate(ctx context.Context, id ServerId, input ServerAdministratorResource) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "serveradministrators.ServerAdministratorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "serveradministrators.ServerAdministratorsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ServerAdministratorsClient) CreateOrUpdateThenPoll(ctx context.Context, id ServerId, input ServerAdministratorResource) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ServerAdministratorsClient) preparerForCreateOrUpdate(ctx context.Context, id ServerId, input ServerAdministratorResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/administrators/activeDirectory", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ServerAdministratorsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/method_delete_autorest.go new file mode 100644 index 00000000000..767e22fe698 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/method_delete_autorest.go @@ -0,0 +1,78 @@ +package serveradministrators + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ServerAdministratorsClient) Delete(ctx context.Context, id ServerId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "serveradministrators.ServerAdministratorsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "serveradministrators.ServerAdministratorsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ServerAdministratorsClient) DeleteThenPoll(ctx context.Context, id ServerId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ServerAdministratorsClient) preparerForDelete(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/administrators/activeDirectory", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ServerAdministratorsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/method_get_autorest.go new file mode 100644 index 00000000000..1c372d9df45 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/method_get_autorest.go @@ -0,0 +1,69 @@ +package serveradministrators + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ServerAdministratorResource +} + +// Get ... +func (c ServerAdministratorsClient) Get(ctx context.Context, id ServerId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "serveradministrators.ServerAdministratorsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serveradministrators.ServerAdministratorsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serveradministrators.ServerAdministratorsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ServerAdministratorsClient) preparerForGet(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/administrators/activeDirectory", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ServerAdministratorsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/method_list_autorest.go new file mode 100644 index 00000000000..c26ecca29ae --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/method_list_autorest.go @@ -0,0 +1,69 @@ +package serveradministrators + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *ServerAdministratorResourceListResult +} + +// List ... +func (c ServerAdministratorsClient) List(ctx context.Context, id ServerId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "serveradministrators.ServerAdministratorsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serveradministrators.ServerAdministratorsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serveradministrators.ServerAdministratorsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c ServerAdministratorsClient) preparerForList(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/administrators", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ServerAdministratorsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/model_serveradministratorproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/model_serveradministratorproperties.go new file mode 100644 index 00000000000..581360e3ec3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/model_serveradministratorproperties.go @@ -0,0 +1,11 @@ +package serveradministrators + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerAdministratorProperties struct { + AdministratorType AdministratorType `json:"administratorType"` + Login string `json:"login"` + Sid string `json:"sid"` + TenantId string `json:"tenantId"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/model_serveradministratorresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/model_serveradministratorresource.go new file mode 100644 index 00000000000..70bd30aafa1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/model_serveradministratorresource.go @@ -0,0 +1,11 @@ +package serveradministrators + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerAdministratorResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ServerAdministratorProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/model_serveradministratorresourcelistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/model_serveradministratorresourcelistresult.go new file mode 100644 index 00000000000..7219f82deba --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/model_serveradministratorresourcelistresult.go @@ -0,0 +1,8 @@ +package serveradministrators + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerAdministratorResourceListResult struct { + Value *[]ServerAdministratorResource `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/version.go new file mode 100644 index 00000000000..c33f7aa2ba6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators/version.go @@ -0,0 +1,12 @@ +package serveradministrators + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/serveradministrators/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/README.md new file mode 100644 index 00000000000..819b1fc44b1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/README.md @@ -0,0 +1,114 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers` Documentation + +The `servers` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers" +``` + + +### Client Initialization + +```go +client := servers.NewServersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServersClient.Create` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := servers.ServerForCreate{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServersClient.Delete` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServersClient.Get` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.List` + +```go +ctx := context.TODO() +id := servers.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := servers.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.ListByResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.Update` + +```go +ctx := context.TODO() +id := servers.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := servers.ServerUpdateParameters{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/client.go new file mode 100644 index 00000000000..fd9e02ba599 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/client.go @@ -0,0 +1,18 @@ +package servers + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServersClient struct { + Client autorest.Client + baseUri string +} + +func NewServersClientWithBaseURI(endpoint string) ServersClient { + return ServersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/constants.go new file mode 100644 index 00000000000..85ac298d6aa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/constants.go @@ -0,0 +1,415 @@ +package servers + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateMode string + +const ( + CreateModeDefault CreateMode = "Default" + CreateModeGeoRestore CreateMode = "GeoRestore" + CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" + CreateModeReplica CreateMode = "Replica" +) + +func PossibleValuesForCreateMode() []string { + return []string{ + string(CreateModeDefault), + string(CreateModeGeoRestore), + string(CreateModePointInTimeRestore), + string(CreateModeReplica), + } +} + +func parseCreateMode(input string) (*CreateMode, error) { + vals := map[string]CreateMode{ + "default": CreateModeDefault, + "georestore": CreateModeGeoRestore, + "pointintimerestore": CreateModePointInTimeRestore, + "replica": CreateModeReplica, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CreateMode(input) + return &out, nil +} + +type GeoRedundantBackup string + +const ( + GeoRedundantBackupDisabled GeoRedundantBackup = "Disabled" + GeoRedundantBackupEnabled GeoRedundantBackup = "Enabled" +) + +func PossibleValuesForGeoRedundantBackup() []string { + return []string{ + string(GeoRedundantBackupDisabled), + string(GeoRedundantBackupEnabled), + } +} + +func parseGeoRedundantBackup(input string) (*GeoRedundantBackup, error) { + vals := map[string]GeoRedundantBackup{ + "disabled": GeoRedundantBackupDisabled, + "enabled": GeoRedundantBackupEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GeoRedundantBackup(input) + return &out, nil +} + +type InfrastructureEncryption string + +const ( + InfrastructureEncryptionDisabled InfrastructureEncryption = "Disabled" + InfrastructureEncryptionEnabled InfrastructureEncryption = "Enabled" +) + +func PossibleValuesForInfrastructureEncryption() []string { + return []string{ + string(InfrastructureEncryptionDisabled), + string(InfrastructureEncryptionEnabled), + } +} + +func parseInfrastructureEncryption(input string) (*InfrastructureEncryption, error) { + vals := map[string]InfrastructureEncryption{ + "disabled": InfrastructureEncryptionDisabled, + "enabled": InfrastructureEncryptionEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InfrastructureEncryption(input) + return &out, nil +} + +type MinimalTlsVersionEnum string + +const ( + MinimalTlsVersionEnumTLSEnforcementDisabled MinimalTlsVersionEnum = "TLSEnforcementDisabled" + MinimalTlsVersionEnumTLSOneOne MinimalTlsVersionEnum = "TLS1_1" + MinimalTlsVersionEnumTLSOneTwo MinimalTlsVersionEnum = "TLS1_2" + MinimalTlsVersionEnumTLSOneZero MinimalTlsVersionEnum = "TLS1_0" +) + +func PossibleValuesForMinimalTlsVersionEnum() []string { + return []string{ + string(MinimalTlsVersionEnumTLSEnforcementDisabled), + string(MinimalTlsVersionEnumTLSOneOne), + string(MinimalTlsVersionEnumTLSOneTwo), + string(MinimalTlsVersionEnumTLSOneZero), + } +} + +func parseMinimalTlsVersionEnum(input string) (*MinimalTlsVersionEnum, error) { + vals := map[string]MinimalTlsVersionEnum{ + "tlsenforcementdisabled": MinimalTlsVersionEnumTLSEnforcementDisabled, + "tls1_1": MinimalTlsVersionEnumTLSOneOne, + "tls1_2": MinimalTlsVersionEnumTLSOneTwo, + "tls1_0": MinimalTlsVersionEnumTLSOneZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MinimalTlsVersionEnum(input) + return &out, nil +} + +type PrivateEndpointProvisioningState string + +const ( + PrivateEndpointProvisioningStateApproving PrivateEndpointProvisioningState = "Approving" + PrivateEndpointProvisioningStateDropping PrivateEndpointProvisioningState = "Dropping" + PrivateEndpointProvisioningStateFailed PrivateEndpointProvisioningState = "Failed" + PrivateEndpointProvisioningStateReady PrivateEndpointProvisioningState = "Ready" + PrivateEndpointProvisioningStateRejecting PrivateEndpointProvisioningState = "Rejecting" +) + +func PossibleValuesForPrivateEndpointProvisioningState() []string { + return []string{ + string(PrivateEndpointProvisioningStateApproving), + string(PrivateEndpointProvisioningStateDropping), + string(PrivateEndpointProvisioningStateFailed), + string(PrivateEndpointProvisioningStateReady), + string(PrivateEndpointProvisioningStateRejecting), + } +} + +func parsePrivateEndpointProvisioningState(input string) (*PrivateEndpointProvisioningState, error) { + vals := map[string]PrivateEndpointProvisioningState{ + "approving": PrivateEndpointProvisioningStateApproving, + "dropping": PrivateEndpointProvisioningStateDropping, + "failed": PrivateEndpointProvisioningStateFailed, + "ready": PrivateEndpointProvisioningStateReady, + "rejecting": PrivateEndpointProvisioningStateRejecting, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointProvisioningState(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStateActionsRequire string + +const ( + PrivateLinkServiceConnectionStateActionsRequireNone PrivateLinkServiceConnectionStateActionsRequire = "None" +) + +func PossibleValuesForPrivateLinkServiceConnectionStateActionsRequire() []string { + return []string{ + string(PrivateLinkServiceConnectionStateActionsRequireNone), + } +} + +func parsePrivateLinkServiceConnectionStateActionsRequire(input string) (*PrivateLinkServiceConnectionStateActionsRequire, error) { + vals := map[string]PrivateLinkServiceConnectionStateActionsRequire{ + "none": PrivateLinkServiceConnectionStateActionsRequireNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStateActionsRequire(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStateStatus string + +const ( + PrivateLinkServiceConnectionStateStatusApproved PrivateLinkServiceConnectionStateStatus = "Approved" + PrivateLinkServiceConnectionStateStatusDisconnected PrivateLinkServiceConnectionStateStatus = "Disconnected" + PrivateLinkServiceConnectionStateStatusPending PrivateLinkServiceConnectionStateStatus = "Pending" + PrivateLinkServiceConnectionStateStatusRejected PrivateLinkServiceConnectionStateStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkServiceConnectionStateStatus() []string { + return []string{ + string(PrivateLinkServiceConnectionStateStatusApproved), + string(PrivateLinkServiceConnectionStateStatusDisconnected), + string(PrivateLinkServiceConnectionStateStatusPending), + string(PrivateLinkServiceConnectionStateStatusRejected), + } +} + +func parsePrivateLinkServiceConnectionStateStatus(input string) (*PrivateLinkServiceConnectionStateStatus, error) { + vals := map[string]PrivateLinkServiceConnectionStateStatus{ + "approved": PrivateLinkServiceConnectionStateStatusApproved, + "disconnected": PrivateLinkServiceConnectionStateStatusDisconnected, + "pending": PrivateLinkServiceConnectionStateStatusPending, + "rejected": PrivateLinkServiceConnectionStateStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStateStatus(input) + return &out, nil +} + +type PublicNetworkAccessEnum string + +const ( + PublicNetworkAccessEnumDisabled PublicNetworkAccessEnum = "Disabled" + PublicNetworkAccessEnumEnabled PublicNetworkAccessEnum = "Enabled" +) + +func PossibleValuesForPublicNetworkAccessEnum() []string { + return []string{ + string(PublicNetworkAccessEnumDisabled), + string(PublicNetworkAccessEnumEnabled), + } +} + +func parsePublicNetworkAccessEnum(input string) (*PublicNetworkAccessEnum, error) { + vals := map[string]PublicNetworkAccessEnum{ + "disabled": PublicNetworkAccessEnumDisabled, + "enabled": PublicNetworkAccessEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccessEnum(input) + return &out, nil +} + +type ServerState string + +const ( + ServerStateDisabled ServerState = "Disabled" + ServerStateDropping ServerState = "Dropping" + ServerStateInaccessible ServerState = "Inaccessible" + ServerStateReady ServerState = "Ready" +) + +func PossibleValuesForServerState() []string { + return []string{ + string(ServerStateDisabled), + string(ServerStateDropping), + string(ServerStateInaccessible), + string(ServerStateReady), + } +} + +func parseServerState(input string) (*ServerState, error) { + vals := map[string]ServerState{ + "disabled": ServerStateDisabled, + "dropping": ServerStateDropping, + "inaccessible": ServerStateInaccessible, + "ready": ServerStateReady, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerState(input) + return &out, nil +} + +type ServerVersion string + +const ( + ServerVersionNinePointFive ServerVersion = "9.5" + ServerVersionNinePointSix ServerVersion = "9.6" + ServerVersionOneOne ServerVersion = "11" + ServerVersionOneZero ServerVersion = "10" + ServerVersionOneZeroPointTwo ServerVersion = "10.2" + ServerVersionOneZeroPointZero ServerVersion = "10.0" +) + +func PossibleValuesForServerVersion() []string { + return []string{ + string(ServerVersionNinePointFive), + string(ServerVersionNinePointSix), + string(ServerVersionOneOne), + string(ServerVersionOneZero), + string(ServerVersionOneZeroPointTwo), + string(ServerVersionOneZeroPointZero), + } +} + +func parseServerVersion(input string) (*ServerVersion, error) { + vals := map[string]ServerVersion{ + "9.5": ServerVersionNinePointFive, + "9.6": ServerVersionNinePointSix, + "11": ServerVersionOneOne, + "10": ServerVersionOneZero, + "10.2": ServerVersionOneZeroPointTwo, + "10.0": ServerVersionOneZeroPointZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerVersion(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierGeneralPurpose SkuTier = "GeneralPurpose" + SkuTierMemoryOptimized SkuTier = "MemoryOptimized" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierGeneralPurpose), + string(SkuTierMemoryOptimized), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "generalpurpose": SkuTierGeneralPurpose, + "memoryoptimized": SkuTierMemoryOptimized, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} + +type SslEnforcementEnum string + +const ( + SslEnforcementEnumDisabled SslEnforcementEnum = "Disabled" + SslEnforcementEnumEnabled SslEnforcementEnum = "Enabled" +) + +func PossibleValuesForSslEnforcementEnum() []string { + return []string{ + string(SslEnforcementEnumDisabled), + string(SslEnforcementEnumEnabled), + } +} + +func parseSslEnforcementEnum(input string) (*SslEnforcementEnum, error) { + vals := map[string]SslEnforcementEnum{ + "disabled": SslEnforcementEnumDisabled, + "enabled": SslEnforcementEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SslEnforcementEnum(input) + return &out, nil +} + +type StorageAutogrow string + +const ( + StorageAutogrowDisabled StorageAutogrow = "Disabled" + StorageAutogrowEnabled StorageAutogrow = "Enabled" +) + +func PossibleValuesForStorageAutogrow() []string { + return []string{ + string(StorageAutogrowDisabled), + string(StorageAutogrowEnabled), + } +} + +func parseStorageAutogrow(input string) (*StorageAutogrow, error) { + vals := map[string]StorageAutogrow{ + "disabled": StorageAutogrowDisabled, + "enabled": StorageAutogrowEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAutogrow(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/id_server.go new file mode 100644 index 00000000000..c9f9807687b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/id_server.go @@ -0,0 +1,124 @@ +package servers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_create_autorest.go new file mode 100644 index 00000000000..e4d6bd5d731 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_create_autorest.go @@ -0,0 +1,79 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c ServersClient) Create(ctx context.Context, id ServerId, input ServerForCreate) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c ServersClient) CreateThenPoll(ctx context.Context, id ServerId, input ServerForCreate) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c ServersClient) preparerForCreate(ctx context.Context, id ServerId, input ServerForCreate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c ServersClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_delete_autorest.go new file mode 100644 index 00000000000..f4e5bea63be --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_delete_autorest.go @@ -0,0 +1,78 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ServersClient) Delete(ctx context.Context, id ServerId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ServersClient) DeleteThenPoll(ctx context.Context, id ServerId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ServersClient) preparerForDelete(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ServersClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_get_autorest.go new file mode 100644 index 00000000000..5c54dc25354 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_get_autorest.go @@ -0,0 +1,68 @@ +package servers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Server +} + +// Get ... +func (c ServersClient) Get(ctx context.Context, id ServerId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ServersClient) preparerForGet(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ServersClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_list_autorest.go new file mode 100644 index 00000000000..64f327e19d3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_list_autorest.go @@ -0,0 +1,70 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *ServerListResult +} + +// List ... +func (c ServersClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c ServersClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DBforPostgreSQL/servers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ServersClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..29011cf2d32 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_listbyresourcegroup_autorest.go @@ -0,0 +1,70 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *ServerListResult +} + +// ListByResourceGroup ... +func (c ServersClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ServersClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DBforPostgreSQL/servers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ServersClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_update_autorest.go new file mode 100644 index 00000000000..62f5524b57a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/method_update_autorest.go @@ -0,0 +1,79 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c ServersClient) Update(ctx context.Context, id ServerId, input ServerUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ServersClient) UpdateThenPoll(ctx context.Context, id ServerId, input ServerUpdateParameters) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c ServersClient) preparerForUpdate(ctx context.Context, id ServerId, input ServerUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c ServersClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_privateendpointproperty.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_privateendpointproperty.go new file mode 100644 index 00000000000..6b1eab772d2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_privateendpointproperty.go @@ -0,0 +1,8 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointProperty struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_server.go new file mode 100644 index 00000000000..8b1b48a38b3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_server.go @@ -0,0 +1,19 @@ +package servers + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Server struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ServerProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverforcreate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverforcreate.go new file mode 100644 index 00000000000..171c190411b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverforcreate.go @@ -0,0 +1,48 @@ +package servers + +import ( + "encoding/json" + "fmt" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerForCreate struct { + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Location string `json:"location"` + Properties ServerPropertiesForCreate `json:"properties"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} + +var _ json.Unmarshaler = &ServerForCreate{} + +func (s *ServerForCreate) UnmarshalJSON(bytes []byte) error { + type alias ServerForCreate + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into ServerForCreate: %+v", err) + } + + s.Identity = decoded.Identity + s.Location = decoded.Location + s.Sku = decoded.Sku + s.Tags = decoded.Tags + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling ServerForCreate into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["properties"]; ok { + impl, err := unmarshalServerPropertiesForCreateImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Properties' for 'ServerForCreate': %+v", err) + } + s.Properties = impl + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverlistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverlistresult.go new file mode 100644 index 00000000000..ccf6bd24270 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverlistresult.go @@ -0,0 +1,8 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerListResult struct { + Value *[]Server `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverprivateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverprivateendpointconnection.go new file mode 100644 index 00000000000..9979a7cec1d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverprivateendpointconnection.go @@ -0,0 +1,9 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Properties *ServerPrivateEndpointConnectionProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverprivateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverprivateendpointconnectionproperties.go new file mode 100644 index 00000000000..c30676397ef --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverprivateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *ServerPrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *PrivateEndpointProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverprivatelinkserviceconnectionstateproperty.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverprivatelinkserviceconnectionstateproperty.go new file mode 100644 index 00000000000..05d887b1bc6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverprivatelinkserviceconnectionstateproperty.go @@ -0,0 +1,10 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPrivateLinkServiceConnectionStateProperty struct { + ActionsRequired *PrivateLinkServiceConnectionStateActionsRequire `json:"actionsRequired,omitempty"` + Description string `json:"description"` + Status PrivateLinkServiceConnectionStateStatus `json:"status"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverproperties.go new file mode 100644 index 00000000000..18cd63a2667 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverproperties.go @@ -0,0 +1,40 @@ +package servers + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerProperties struct { + AdministratorLogin *string `json:"administratorLogin,omitempty"` + ByokEnforcement *string `json:"byokEnforcement,omitempty"` + EarliestRestoreDate *string `json:"earliestRestoreDate,omitempty"` + FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` + InfrastructureEncryption *InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + MasterServerId *string `json:"masterServerId,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PrivateEndpointConnections *[]ServerPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + ReplicaCapacity *int64 `json:"replicaCapacity,omitempty"` + ReplicationRole *string `json:"replicationRole,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + UserVisibleState *ServerState `json:"userVisibleState,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +func (o *ServerProperties) GetEarliestRestoreDateAsTime() (*time.Time, error) { + if o.EarliestRestoreDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EarliestRestoreDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ServerProperties) SetEarliestRestoreDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EarliestRestoreDate = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverpropertiesforcreate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverpropertiesforcreate.go new file mode 100644 index 00000000000..ef35f7ee261 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverpropertiesforcreate.go @@ -0,0 +1,72 @@ +package servers + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPropertiesForCreate interface { +} + +func unmarshalServerPropertiesForCreateImplementation(input []byte) (ServerPropertiesForCreate, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPropertiesForCreate into map[string]interface: %+v", err) + } + + value, ok := temp["createMode"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "Default") { + var out ServerPropertiesForDefaultCreate + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServerPropertiesForDefaultCreate: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "GeoRestore") { + var out ServerPropertiesForGeoRestore + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServerPropertiesForGeoRestore: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Replica") { + var out ServerPropertiesForReplica + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServerPropertiesForReplica: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "PointInTimeRestore") { + var out ServerPropertiesForRestore + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServerPropertiesForRestore: %+v", err) + } + return out, nil + } + + type RawServerPropertiesForCreateImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawServerPropertiesForCreateImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverpropertiesfordefaultcreate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverpropertiesfordefaultcreate.go new file mode 100644 index 00000000000..efa1824c838 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverpropertiesfordefaultcreate.go @@ -0,0 +1,48 @@ +package servers + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ServerPropertiesForCreate = ServerPropertiesForDefaultCreate{} + +type ServerPropertiesForDefaultCreate struct { + AdministratorLogin string `json:"administratorLogin"` + AdministratorLoginPassword string `json:"administratorLoginPassword"` + + // Fields inherited from ServerPropertiesForCreate + InfrastructureEncryption *InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +var _ json.Marshaler = ServerPropertiesForDefaultCreate{} + +func (s ServerPropertiesForDefaultCreate) MarshalJSON() ([]byte, error) { + type wrapper ServerPropertiesForDefaultCreate + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServerPropertiesForDefaultCreate: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPropertiesForDefaultCreate: %+v", err) + } + decoded["createMode"] = "Default" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServerPropertiesForDefaultCreate: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverpropertiesforgeorestore.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverpropertiesforgeorestore.go new file mode 100644 index 00000000000..f3775b48d53 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverpropertiesforgeorestore.go @@ -0,0 +1,47 @@ +package servers + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ServerPropertiesForCreate = ServerPropertiesForGeoRestore{} + +type ServerPropertiesForGeoRestore struct { + SourceServerId string `json:"sourceServerId"` + + // Fields inherited from ServerPropertiesForCreate + InfrastructureEncryption *InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +var _ json.Marshaler = ServerPropertiesForGeoRestore{} + +func (s ServerPropertiesForGeoRestore) MarshalJSON() ([]byte, error) { + type wrapper ServerPropertiesForGeoRestore + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServerPropertiesForGeoRestore: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPropertiesForGeoRestore: %+v", err) + } + decoded["createMode"] = "GeoRestore" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServerPropertiesForGeoRestore: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverpropertiesforreplica.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverpropertiesforreplica.go new file mode 100644 index 00000000000..9f8a64ee6e7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverpropertiesforreplica.go @@ -0,0 +1,47 @@ +package servers + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ServerPropertiesForCreate = ServerPropertiesForReplica{} + +type ServerPropertiesForReplica struct { + SourceServerId string `json:"sourceServerId"` + + // Fields inherited from ServerPropertiesForCreate + InfrastructureEncryption *InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +var _ json.Marshaler = ServerPropertiesForReplica{} + +func (s ServerPropertiesForReplica) MarshalJSON() ([]byte, error) { + type wrapper ServerPropertiesForReplica + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServerPropertiesForReplica: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPropertiesForReplica: %+v", err) + } + decoded["createMode"] = "Replica" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServerPropertiesForReplica: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverpropertiesforrestore.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverpropertiesforrestore.go new file mode 100644 index 00000000000..0a74bb93817 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverpropertiesforrestore.go @@ -0,0 +1,48 @@ +package servers + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ ServerPropertiesForCreate = ServerPropertiesForRestore{} + +type ServerPropertiesForRestore struct { + RestorePointInTime string `json:"restorePointInTime"` + SourceServerId string `json:"sourceServerId"` + + // Fields inherited from ServerPropertiesForCreate + InfrastructureEncryption *InfrastructureEncryption `json:"infrastructureEncryption,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +var _ json.Marshaler = ServerPropertiesForRestore{} + +func (s ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { + type wrapper ServerPropertiesForRestore + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServerPropertiesForRestore: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServerPropertiesForRestore: %+v", err) + } + decoded["createMode"] = "PointInTimeRestore" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServerPropertiesForRestore: %+v", err) + } + + return encoded, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverupdateparameters.go new file mode 100644 index 00000000000..28d9df792f8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverupdateparameters.go @@ -0,0 +1,15 @@ +package servers + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerUpdateParameters struct { + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Properties *ServerUpdateParametersProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverupdateparametersproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverupdateparametersproperties.go new file mode 100644 index 00000000000..8557ea72752 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_serverupdateparametersproperties.go @@ -0,0 +1,14 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerUpdateParametersProperties struct { + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + MinimalTlsVersion *MinimalTlsVersionEnum `json:"minimalTlsVersion,omitempty"` + PublicNetworkAccess *PublicNetworkAccessEnum `json:"publicNetworkAccess,omitempty"` + ReplicationRole *string `json:"replicationRole,omitempty"` + SslEnforcement *SslEnforcementEnum `json:"sslEnforcement,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_sku.go new file mode 100644 index 00000000000..8bb23cf521d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_sku.go @@ -0,0 +1,12 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_storageprofile.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_storageprofile.go new file mode 100644 index 00000000000..ecb9b55edb0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/model_storageprofile.go @@ -0,0 +1,11 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfile struct { + BackupRetentionDays *int64 `json:"backupRetentionDays,omitempty"` + GeoRedundantBackup *GeoRedundantBackup `json:"geoRedundantBackup,omitempty"` + StorageAutogrow *StorageAutogrow `json:"storageAutogrow,omitempty"` + StorageMB *int64 `json:"storageMB,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/version.go new file mode 100644 index 00000000000..80804cb0155 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers/version.go @@ -0,0 +1,12 @@ +package servers + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/servers/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/README.md new file mode 100644 index 00000000000..3042ca18fcf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/README.md @@ -0,0 +1,70 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies` Documentation + +The `serversecurityalertpolicies` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies" +``` + + +### Client Initialization + +```go +client := serversecurityalertpolicies.NewServerSecurityAlertPoliciesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServerSecurityAlertPoliciesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := serversecurityalertpolicies.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := serversecurityalertpolicies.ServerSecurityAlertPolicy{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServerSecurityAlertPoliciesClient.Get` + +```go +ctx := context.TODO() +id := serversecurityalertpolicies.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServerSecurityAlertPoliciesClient.ListByServer` + +```go +ctx := context.TODO() +id := serversecurityalertpolicies.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination +items, err := client.ListByServerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/client.go new file mode 100644 index 00000000000..1dd09ed92f4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/client.go @@ -0,0 +1,18 @@ +package serversecurityalertpolicies + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerSecurityAlertPoliciesClient struct { + Client autorest.Client + baseUri string +} + +func NewServerSecurityAlertPoliciesClientWithBaseURI(endpoint string) ServerSecurityAlertPoliciesClient { + return ServerSecurityAlertPoliciesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/constants.go new file mode 100644 index 00000000000..eb761a721c7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/constants.go @@ -0,0 +1,34 @@ +package serversecurityalertpolicies + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerSecurityAlertPolicyState string + +const ( + ServerSecurityAlertPolicyStateDisabled ServerSecurityAlertPolicyState = "Disabled" + ServerSecurityAlertPolicyStateEnabled ServerSecurityAlertPolicyState = "Enabled" +) + +func PossibleValuesForServerSecurityAlertPolicyState() []string { + return []string{ + string(ServerSecurityAlertPolicyStateDisabled), + string(ServerSecurityAlertPolicyStateEnabled), + } +} + +func parseServerSecurityAlertPolicyState(input string) (*ServerSecurityAlertPolicyState, error) { + vals := map[string]ServerSecurityAlertPolicyState{ + "disabled": ServerSecurityAlertPolicyStateDisabled, + "enabled": ServerSecurityAlertPolicyStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerSecurityAlertPolicyState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/id_server.go new file mode 100644 index 00000000000..45f40193d4d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/id_server.go @@ -0,0 +1,124 @@ +package serversecurityalertpolicies + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/method_createorupdate_autorest.go new file mode 100644 index 00000000000..5820577ef60 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package serversecurityalertpolicies + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c ServerSecurityAlertPoliciesClient) CreateOrUpdate(ctx context.Context, id ServerId, input ServerSecurityAlertPolicy) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "serversecurityalertpolicies.ServerSecurityAlertPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "serversecurityalertpolicies.ServerSecurityAlertPoliciesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ServerSecurityAlertPoliciesClient) CreateOrUpdateThenPoll(ctx context.Context, id ServerId, input ServerSecurityAlertPolicy) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ServerSecurityAlertPoliciesClient) preparerForCreateOrUpdate(ctx context.Context, id ServerId, input ServerSecurityAlertPolicy) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/securityAlertPolicies/Default", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ServerSecurityAlertPoliciesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/method_get_autorest.go new file mode 100644 index 00000000000..fe0dffe862a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/method_get_autorest.go @@ -0,0 +1,69 @@ +package serversecurityalertpolicies + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ServerSecurityAlertPolicy +} + +// Get ... +func (c ServerSecurityAlertPoliciesClient) Get(ctx context.Context, id ServerId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "serversecurityalertpolicies.ServerSecurityAlertPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serversecurityalertpolicies.ServerSecurityAlertPoliciesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serversecurityalertpolicies.ServerSecurityAlertPoliciesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ServerSecurityAlertPoliciesClient) preparerForGet(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/securityAlertPolicies/Default", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ServerSecurityAlertPoliciesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/method_listbyserver_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/method_listbyserver_autorest.go new file mode 100644 index 00000000000..c809b8b3df7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/method_listbyserver_autorest.go @@ -0,0 +1,186 @@ +package serversecurityalertpolicies + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServerOperationResponse struct { + HttpResponse *http.Response + Model *[]ServerSecurityAlertPolicy + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByServerOperationResponse, error) +} + +type ListByServerCompleteResult struct { + Items []ServerSecurityAlertPolicy +} + +func (r ListByServerOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByServerOperationResponse) LoadMore(ctx context.Context) (resp ListByServerOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByServer ... +func (c ServerSecurityAlertPoliciesClient) ListByServer(ctx context.Context, id ServerId) (resp ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServer(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "serversecurityalertpolicies.ServerSecurityAlertPoliciesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serversecurityalertpolicies.ServerSecurityAlertPoliciesClient", "ListByServer", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByServer(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serversecurityalertpolicies.ServerSecurityAlertPoliciesClient", "ListByServer", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByServer prepares the ListByServer request. +func (c ServerSecurityAlertPoliciesClient) preparerForListByServer(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/securityAlertPolicies", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByServerWithNextLink prepares the ListByServer request with the given nextLink token. +func (c ServerSecurityAlertPoliciesClient) preparerForListByServerWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByServer handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (c ServerSecurityAlertPoliciesClient) responderForListByServer(resp *http.Response) (result ListByServerOperationResponse, err error) { + type page struct { + Values []ServerSecurityAlertPolicy `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServerWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "serversecurityalertpolicies.ServerSecurityAlertPoliciesClient", "ListByServer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serversecurityalertpolicies.ServerSecurityAlertPoliciesClient", "ListByServer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByServer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serversecurityalertpolicies.ServerSecurityAlertPoliciesClient", "ListByServer", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByServerComplete retrieves all of the results into a single object +func (c ServerSecurityAlertPoliciesClient) ListByServerComplete(ctx context.Context, id ServerId) (ListByServerCompleteResult, error) { + return c.ListByServerCompleteMatchingPredicate(ctx, id, ServerSecurityAlertPolicyOperationPredicate{}) +} + +// ListByServerCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ServerSecurityAlertPoliciesClient) ListByServerCompleteMatchingPredicate(ctx context.Context, id ServerId, predicate ServerSecurityAlertPolicyOperationPredicate) (resp ListByServerCompleteResult, err error) { + items := make([]ServerSecurityAlertPolicy, 0) + + page, err := c.ListByServer(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByServerCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/model_securityalertpolicyproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/model_securityalertpolicyproperties.go new file mode 100644 index 00000000000..cdccecef6a5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/model_securityalertpolicyproperties.go @@ -0,0 +1,14 @@ +package serversecurityalertpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityAlertPolicyProperties struct { + DisabledAlerts *[]string `json:"disabledAlerts,omitempty"` + EmailAccountAdmins *bool `json:"emailAccountAdmins,omitempty"` + EmailAddresses *[]string `json:"emailAddresses,omitempty"` + RetentionDays *int64 `json:"retentionDays,omitempty"` + State ServerSecurityAlertPolicyState `json:"state"` + StorageAccountAccessKey *string `json:"storageAccountAccessKey,omitempty"` + StorageEndpoint *string `json:"storageEndpoint,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/model_serversecurityalertpolicy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/model_serversecurityalertpolicy.go new file mode 100644 index 00000000000..6e2a30d2aba --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/model_serversecurityalertpolicy.go @@ -0,0 +1,11 @@ +package serversecurityalertpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerSecurityAlertPolicy struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SecurityAlertPolicyProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/predicates.go new file mode 100644 index 00000000000..846b27998cb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/predicates.go @@ -0,0 +1,24 @@ +package serversecurityalertpolicies + +type ServerSecurityAlertPolicyOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ServerSecurityAlertPolicyOperationPredicate) Matches(input ServerSecurityAlertPolicy) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/version.go new file mode 100644 index 00000000000..f7fc4c20d1d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/version.go @@ -0,0 +1,12 @@ +package serversecurityalertpolicies + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/serversecurityalertpolicies/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/README.md new file mode 100644 index 00000000000..4a15410e459 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules` Documentation + +The `virtualnetworkrules` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2017-12-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules" +``` + + +### Client Initialization + +```go +client := virtualnetworkrules.NewVirtualNetworkRulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualNetworkRulesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualnetworkrules.NewVirtualNetworkRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "virtualNetworkRuleValue") + +payload := virtualnetworkrules.VirtualNetworkRule{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworkRulesClient.Delete` + +```go +ctx := context.TODO() +id := virtualnetworkrules.NewVirtualNetworkRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "virtualNetworkRuleValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworkRulesClient.Get` + +```go +ctx := context.TODO() +id := virtualnetworkrules.NewVirtualNetworkRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "virtualNetworkRuleValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualNetworkRulesClient.ListByServer` + +```go +ctx := context.TODO() +id := virtualnetworkrules.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination +items, err := client.ListByServerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/client.go new file mode 100644 index 00000000000..c5bb4f331d3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/client.go @@ -0,0 +1,18 @@ +package virtualnetworkrules + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkRulesClient struct { + Client autorest.Client + baseUri string +} + +func NewVirtualNetworkRulesClientWithBaseURI(endpoint string) VirtualNetworkRulesClient { + return VirtualNetworkRulesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/constants.go new file mode 100644 index 00000000000..686ce6f868d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/constants.go @@ -0,0 +1,43 @@ +package virtualnetworkrules + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkRuleState string + +const ( + VirtualNetworkRuleStateDeleting VirtualNetworkRuleState = "Deleting" + VirtualNetworkRuleStateInProgress VirtualNetworkRuleState = "InProgress" + VirtualNetworkRuleStateInitializing VirtualNetworkRuleState = "Initializing" + VirtualNetworkRuleStateReady VirtualNetworkRuleState = "Ready" + VirtualNetworkRuleStateUnknown VirtualNetworkRuleState = "Unknown" +) + +func PossibleValuesForVirtualNetworkRuleState() []string { + return []string{ + string(VirtualNetworkRuleStateDeleting), + string(VirtualNetworkRuleStateInProgress), + string(VirtualNetworkRuleStateInitializing), + string(VirtualNetworkRuleStateReady), + string(VirtualNetworkRuleStateUnknown), + } +} + +func parseVirtualNetworkRuleState(input string) (*VirtualNetworkRuleState, error) { + vals := map[string]VirtualNetworkRuleState{ + "deleting": VirtualNetworkRuleStateDeleting, + "inprogress": VirtualNetworkRuleStateInProgress, + "initializing": VirtualNetworkRuleStateInitializing, + "ready": VirtualNetworkRuleStateReady, + "unknown": VirtualNetworkRuleStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualNetworkRuleState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/id_server.go new file mode 100644 index 00000000000..8a9c62a9f91 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/id_server.go @@ -0,0 +1,124 @@ +package virtualnetworkrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/id_virtualnetworkrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/id_virtualnetworkrule.go new file mode 100644 index 00000000000..ce160ddfad1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/id_virtualnetworkrule.go @@ -0,0 +1,137 @@ +package virtualnetworkrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VirtualNetworkRuleId{} + +// VirtualNetworkRuleId is a struct representing the Resource ID for a Virtual Network Rule +type VirtualNetworkRuleId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + VirtualNetworkRuleName string +} + +// NewVirtualNetworkRuleID returns a new VirtualNetworkRuleId struct +func NewVirtualNetworkRuleID(subscriptionId string, resourceGroupName string, serverName string, virtualNetworkRuleName string) VirtualNetworkRuleId { + return VirtualNetworkRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + VirtualNetworkRuleName: virtualNetworkRuleName, + } +} + +// ParseVirtualNetworkRuleID parses 'input' into a VirtualNetworkRuleId +func ParseVirtualNetworkRuleID(input string) (*VirtualNetworkRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualNetworkRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualNetworkRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualNetworkRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVirtualNetworkRuleIDInsensitively parses 'input' case-insensitively into a VirtualNetworkRuleId +// note: this method should only be used for API response data and not user input +func ParseVirtualNetworkRuleIDInsensitively(input string) (*VirtualNetworkRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualNetworkRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualNetworkRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'virtualNetworkRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVirtualNetworkRuleID checks that 'input' can be parsed as a Virtual Network Rule ID +func ValidateVirtualNetworkRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVirtualNetworkRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Network Rule ID +func (id VirtualNetworkRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/virtualNetworkRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.VirtualNetworkRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Network Rule ID +func (id VirtualNetworkRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticVirtualNetworkRules", "virtualNetworkRules", "virtualNetworkRules"), + resourceids.UserSpecifiedSegment("virtualNetworkRuleName", "virtualNetworkRuleValue"), + } +} + +// String returns a human-readable description of this Virtual Network Rule ID +func (id VirtualNetworkRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Virtual Network Rule Name: %q", id.VirtualNetworkRuleName), + } + return fmt.Sprintf("Virtual Network Rule (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/method_createorupdate_autorest.go new file mode 100644 index 00000000000..1246bc0f90f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package virtualnetworkrules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c VirtualNetworkRulesClient) CreateOrUpdate(ctx context.Context, id VirtualNetworkRuleId, input VirtualNetworkRule) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VirtualNetworkRulesClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualNetworkRuleId, input VirtualNetworkRule) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c VirtualNetworkRulesClient) preparerForCreateOrUpdate(ctx context.Context, id VirtualNetworkRuleId, input VirtualNetworkRule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualNetworkRulesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/method_delete_autorest.go new file mode 100644 index 00000000000..631aa2a8856 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/method_delete_autorest.go @@ -0,0 +1,78 @@ +package virtualnetworkrules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c VirtualNetworkRulesClient) Delete(ctx context.Context, id VirtualNetworkRuleId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualNetworkRulesClient) DeleteThenPoll(ctx context.Context, id VirtualNetworkRuleId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c VirtualNetworkRulesClient) preparerForDelete(ctx context.Context, id VirtualNetworkRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualNetworkRulesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/method_get_autorest.go new file mode 100644 index 00000000000..f105c5887a7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/method_get_autorest.go @@ -0,0 +1,68 @@ +package virtualnetworkrules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *VirtualNetworkRule +} + +// Get ... +func (c VirtualNetworkRulesClient) Get(ctx context.Context, id VirtualNetworkRuleId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c VirtualNetworkRulesClient) preparerForGet(ctx context.Context, id VirtualNetworkRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c VirtualNetworkRulesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/method_listbyserver_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/method_listbyserver_autorest.go new file mode 100644 index 00000000000..73136508fcb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/method_listbyserver_autorest.go @@ -0,0 +1,186 @@ +package virtualnetworkrules + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServerOperationResponse struct { + HttpResponse *http.Response + Model *[]VirtualNetworkRule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByServerOperationResponse, error) +} + +type ListByServerCompleteResult struct { + Items []VirtualNetworkRule +} + +func (r ListByServerOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByServerOperationResponse) LoadMore(ctx context.Context) (resp ListByServerOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByServer ... +func (c VirtualNetworkRulesClient) ListByServer(ctx context.Context, id ServerId) (resp ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServer(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "ListByServer", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByServer(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "ListByServer", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByServer prepares the ListByServer request. +func (c VirtualNetworkRulesClient) preparerForListByServer(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/virtualNetworkRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByServerWithNextLink prepares the ListByServer request with the given nextLink token. +func (c VirtualNetworkRulesClient) preparerForListByServerWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByServer handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (c VirtualNetworkRulesClient) responderForListByServer(resp *http.Response) (result ListByServerOperationResponse, err error) { + type page struct { + Values []VirtualNetworkRule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServerWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "ListByServer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "ListByServer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByServer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworkrules.VirtualNetworkRulesClient", "ListByServer", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByServerComplete retrieves all of the results into a single object +func (c VirtualNetworkRulesClient) ListByServerComplete(ctx context.Context, id ServerId) (ListByServerCompleteResult, error) { + return c.ListByServerCompleteMatchingPredicate(ctx, id, VirtualNetworkRuleOperationPredicate{}) +} + +// ListByServerCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c VirtualNetworkRulesClient) ListByServerCompleteMatchingPredicate(ctx context.Context, id ServerId, predicate VirtualNetworkRuleOperationPredicate) (resp ListByServerCompleteResult, err error) { + items := make([]VirtualNetworkRule, 0) + + page, err := c.ListByServer(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByServerCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/model_virtualnetworkrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/model_virtualnetworkrule.go new file mode 100644 index 00000000000..16850c4e56f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/model_virtualnetworkrule.go @@ -0,0 +1,11 @@ +package virtualnetworkrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualNetworkRuleProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/model_virtualnetworkruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/model_virtualnetworkruleproperties.go new file mode 100644 index 00000000000..40e8ec8d241 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/model_virtualnetworkruleproperties.go @@ -0,0 +1,10 @@ +package virtualnetworkrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkRuleProperties struct { + IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` + State *VirtualNetworkRuleState `json:"state,omitempty"` + VirtualNetworkSubnetId string `json:"virtualNetworkSubnetId"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/predicates.go new file mode 100644 index 00000000000..ef565fb3103 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/predicates.go @@ -0,0 +1,24 @@ +package virtualnetworkrules + +type VirtualNetworkRuleOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p VirtualNetworkRuleOperationPredicate) Matches(input VirtualNetworkRule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/version.go new file mode 100644 index 00000000000..11bd3d9075a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules/version.go @@ -0,0 +1,12 @@ +package virtualnetworkrules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-12-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/virtualnetworkrules/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/README.md new file mode 100644 index 00000000000..cfa23ca10eb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys` Documentation + +The `serverkeys` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2020-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys" +``` + + +### Client Initialization + +```go +client := serverkeys.NewServerKeysClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServerKeysClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := serverkeys.NewKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "keyValue") + +payload := serverkeys.ServerKey{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServerKeysClient.Delete` + +```go +ctx := context.TODO() +id := serverkeys.NewKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "keyValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServerKeysClient.Get` + +```go +ctx := context.TODO() +id := serverkeys.NewKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "keyValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServerKeysClient.List` + +```go +ctx := context.TODO() +id := serverkeys.NewServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/client.go new file mode 100644 index 00000000000..1360abe5c1d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/client.go @@ -0,0 +1,18 @@ +package serverkeys + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerKeysClient struct { + Client autorest.Client + baseUri string +} + +func NewServerKeysClientWithBaseURI(endpoint string) ServerKeysClient { + return ServerKeysClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/constants.go new file mode 100644 index 00000000000..314994556d5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/constants.go @@ -0,0 +1,31 @@ +package serverkeys + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerKeyType string + +const ( + ServerKeyTypeAzureKeyVault ServerKeyType = "AzureKeyVault" +) + +func PossibleValuesForServerKeyType() []string { + return []string{ + string(ServerKeyTypeAzureKeyVault), + } +} + +func parseServerKeyType(input string) (*ServerKeyType, error) { + vals := map[string]ServerKeyType{ + "azurekeyvault": ServerKeyTypeAzureKeyVault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerKeyType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/id_key.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/id_key.go new file mode 100644 index 00000000000..24e900ad659 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/id_key.go @@ -0,0 +1,137 @@ +package serverkeys + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = KeyId{} + +// KeyId is a struct representing the Resource ID for a Key +type KeyId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + KeyName string +} + +// NewKeyID returns a new KeyId struct +func NewKeyID(subscriptionId string, resourceGroupName string, serverName string, keyName string) KeyId { + return KeyId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + KeyName: keyName, + } +} + +// ParseKeyID parses 'input' into a KeyId +func ParseKeyID(input string) (*KeyId, error) { + parser := resourceids.NewParserFromResourceIdType(KeyId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := KeyId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { + return nil, fmt.Errorf("the segment 'keyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseKeyIDInsensitively parses 'input' case-insensitively into a KeyId +// note: this method should only be used for API response data and not user input +func ParseKeyIDInsensitively(input string) (*KeyId, error) { + parser := resourceids.NewParserFromResourceIdType(KeyId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := KeyId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { + return nil, fmt.Errorf("the segment 'keyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateKeyID checks that 'input' can be parsed as a Key ID +func ValidateKeyID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseKeyID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Key ID +func (id KeyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/keys/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.KeyName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Key ID +func (id KeyId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticKeys", "keys", "keys"), + resourceids.UserSpecifiedSegment("keyName", "keyValue"), + } +} + +// String returns a human-readable description of this Key ID +func (id KeyId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Key Name: %q", id.KeyName), + } + return fmt.Sprintf("Key (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/id_server.go new file mode 100644 index 00000000000..c20bf017240 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/id_server.go @@ -0,0 +1,124 @@ +package serverkeys + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ServerId{} + +// ServerId is a struct representing the Resource ID for a Server +type ServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewServerID returns a new ServerId struct +func NewServerID(subscriptionId string, resourceGroupName string, serverName string) ServerId { + return ServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseServerID parses 'input' into a ServerId +func ParseServerID(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseServerIDInsensitively parses 'input' case-insensitively into a ServerId +// note: this method should only be used for API response data and not user input +func ParseServerIDInsensitively(input string) (*ServerId, error) { + parser := resourceids.NewParserFromResourceIdType(ServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateServerID checks that 'input' can be parsed as a Server ID +func ValidateServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Server ID +func (id ServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Server ID +func (id ServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticServers", "servers", "servers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Server ID +func (id ServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/method_createorupdate_autorest.go new file mode 100644 index 00000000000..88443b17993 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package serverkeys + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c ServerKeysClient) CreateOrUpdate(ctx context.Context, id KeyId, input ServerKey) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "serverkeys.ServerKeysClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "serverkeys.ServerKeysClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ServerKeysClient) CreateOrUpdateThenPoll(ctx context.Context, id KeyId, input ServerKey) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ServerKeysClient) preparerForCreateOrUpdate(ctx context.Context, id KeyId, input ServerKey) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ServerKeysClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/method_delete_autorest.go new file mode 100644 index 00000000000..7e9d72c9ba6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/method_delete_autorest.go @@ -0,0 +1,78 @@ +package serverkeys + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ServerKeysClient) Delete(ctx context.Context, id KeyId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "serverkeys.ServerKeysClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "serverkeys.ServerKeysClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ServerKeysClient) DeleteThenPoll(ctx context.Context, id KeyId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ServerKeysClient) preparerForDelete(ctx context.Context, id KeyId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ServerKeysClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/method_get_autorest.go new file mode 100644 index 00000000000..8f78f612b95 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/method_get_autorest.go @@ -0,0 +1,68 @@ +package serverkeys + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ServerKey +} + +// Get ... +func (c ServerKeysClient) Get(ctx context.Context, id KeyId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "serverkeys.ServerKeysClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serverkeys.ServerKeysClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serverkeys.ServerKeysClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ServerKeysClient) preparerForGet(ctx context.Context, id KeyId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ServerKeysClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/method_list_autorest.go new file mode 100644 index 00000000000..3220784b72d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/method_list_autorest.go @@ -0,0 +1,186 @@ +package serverkeys + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]ServerKey + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []ServerKey +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c ServerKeysClient) List(ctx context.Context, id ServerId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "serverkeys.ServerKeysClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serverkeys.ServerKeysClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serverkeys.ServerKeysClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c ServerKeysClient) preparerForList(ctx context.Context, id ServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/keys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c ServerKeysClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ServerKeysClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []ServerKey `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "serverkeys.ServerKeysClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "serverkeys.ServerKeysClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "serverkeys.ServerKeysClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c ServerKeysClient) ListComplete(ctx context.Context, id ServerId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ServerKeyOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ServerKeysClient) ListCompleteMatchingPredicate(ctx context.Context, id ServerId, predicate ServerKeyOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]ServerKey, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/model_serverkey.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/model_serverkey.go new file mode 100644 index 00000000000..b73a7026168 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/model_serverkey.go @@ -0,0 +1,12 @@ +package serverkeys + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerKey struct { + Id *string `json:"id,omitempty"` + Kind *string `json:"kind,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ServerKeyProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/model_serverkeyproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/model_serverkeyproperties.go new file mode 100644 index 00000000000..5b4fe33315f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/model_serverkeyproperties.go @@ -0,0 +1,28 @@ +package serverkeys + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerKeyProperties struct { + CreationDate *string `json:"creationDate,omitempty"` + ServerKeyType ServerKeyType `json:"serverKeyType"` + Uri *string `json:"uri,omitempty"` +} + +func (o *ServerKeyProperties) GetCreationDateAsTime() (*time.Time, error) { + if o.CreationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ServerKeyProperties) SetCreationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreationDate = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/predicates.go new file mode 100644 index 00000000000..f623a938ca6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/predicates.go @@ -0,0 +1,29 @@ +package serverkeys + +type ServerKeyOperationPredicate struct { + Id *string + Kind *string + Name *string + Type *string +} + +func (p ServerKeyOperationPredicate) Matches(input ServerKey) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && (input.Kind == nil && *p.Kind != *input.Kind) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/version.go new file mode 100644 index 00000000000..0155b1ec796 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys/version.go @@ -0,0 +1,12 @@ +package serverkeys + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/serverkeys/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/README.md new file mode 100644 index 00000000000..41d1f0bb087 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/README.md @@ -0,0 +1,87 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations` Documentation + +The `configurations` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2021-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations" +``` + + +### Client Initialization + +```go +client := configurations.NewConfigurationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ConfigurationsClient.Get` + +```go +ctx := context.TODO() +id := configurations.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "configurationValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConfigurationsClient.ListByServer` + +```go +ctx := context.TODO() +id := configurations.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination +items, err := client.ListByServerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ConfigurationsClient.Put` + +```go +ctx := context.TODO() +id := configurations.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "configurationValue") + +payload := configurations.Configuration{ + // ... +} + + +if err := client.PutThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ConfigurationsClient.Update` + +```go +ctx := context.TODO() +id := configurations.NewConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "configurationValue") + +payload := configurations.Configuration{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/client.go new file mode 100644 index 00000000000..bbe813edd98 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/client.go @@ -0,0 +1,18 @@ +package configurations + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationsClient struct { + Client autorest.Client + baseUri string +} + +func NewConfigurationsClientWithBaseURI(endpoint string) ConfigurationsClient { + return ConfigurationsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/constants.go new file mode 100644 index 00000000000..791ecc4ea29 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/constants.go @@ -0,0 +1,40 @@ +package configurations + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationDataType string + +const ( + ConfigurationDataTypeBoolean ConfigurationDataType = "Boolean" + ConfigurationDataTypeEnumeration ConfigurationDataType = "Enumeration" + ConfigurationDataTypeInteger ConfigurationDataType = "Integer" + ConfigurationDataTypeNumeric ConfigurationDataType = "Numeric" +) + +func PossibleValuesForConfigurationDataType() []string { + return []string{ + string(ConfigurationDataTypeBoolean), + string(ConfigurationDataTypeEnumeration), + string(ConfigurationDataTypeInteger), + string(ConfigurationDataTypeNumeric), + } +} + +func parseConfigurationDataType(input string) (*ConfigurationDataType, error) { + vals := map[string]ConfigurationDataType{ + "boolean": ConfigurationDataTypeBoolean, + "enumeration": ConfigurationDataTypeEnumeration, + "integer": ConfigurationDataTypeInteger, + "numeric": ConfigurationDataTypeNumeric, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConfigurationDataType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/id_configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/id_configuration.go new file mode 100644 index 00000000000..0381cb9c044 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/id_configuration.go @@ -0,0 +1,137 @@ +package configurations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ConfigurationId{} + +// ConfigurationId is a struct representing the Resource ID for a Configuration +type ConfigurationId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + ConfigurationName string +} + +// NewConfigurationID returns a new ConfigurationId struct +func NewConfigurationID(subscriptionId string, resourceGroupName string, serverName string, configurationName string) ConfigurationId { + return ConfigurationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + ConfigurationName: configurationName, + } +} + +// ParseConfigurationID parses 'input' into a ConfigurationId +func ParseConfigurationID(input string) (*ConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(ConfigurationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { + return nil, fmt.Errorf("the segment 'configurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseConfigurationIDInsensitively parses 'input' case-insensitively into a ConfigurationId +// note: this method should only be used for API response data and not user input +func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(ConfigurationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { + return nil, fmt.Errorf("the segment 'configurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID +func ValidateConfigurationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseConfigurationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Configuration ID +func (id ConfigurationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s/configurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.ConfigurationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Configuration ID +func (id ConfigurationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticConfigurations", "configurations", "configurations"), + resourceids.UserSpecifiedSegment("configurationName", "configurationValue"), + } +} + +// String returns a human-readable description of this Configuration ID +func (id ConfigurationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Configuration Name: %q", id.ConfigurationName), + } + return fmt.Sprintf("Configuration (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/id_flexibleserver.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/id_flexibleserver.go new file mode 100644 index 00000000000..34a1cb396bb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/id_flexibleserver.go @@ -0,0 +1,124 @@ +package configurations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FlexibleServerId{} + +// FlexibleServerId is a struct representing the Resource ID for a Flexible Server +type FlexibleServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewFlexibleServerID returns a new FlexibleServerId struct +func NewFlexibleServerID(subscriptionId string, resourceGroupName string, serverName string) FlexibleServerId { + return FlexibleServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseFlexibleServerID parses 'input' into a FlexibleServerId +func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFlexibleServerIDInsensitively parses 'input' case-insensitively into a FlexibleServerId +// note: this method should only be used for API response data and not user input +func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID +func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFlexibleServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Flexible Server ID +func (id FlexibleServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID +func (id FlexibleServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Flexible Server ID +func (id FlexibleServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/method_get_autorest.go new file mode 100644 index 00000000000..2aeb488f91c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/method_get_autorest.go @@ -0,0 +1,68 @@ +package configurations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Configuration +} + +// Get ... +func (c ConfigurationsClient) Get(ctx context.Context, id ConfigurationId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ConfigurationsClient) preparerForGet(ctx context.Context, id ConfigurationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ConfigurationsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/method_listbyserver_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/method_listbyserver_autorest.go new file mode 100644 index 00000000000..93f2ecccdee --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/method_listbyserver_autorest.go @@ -0,0 +1,186 @@ +package configurations + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServerOperationResponse struct { + HttpResponse *http.Response + Model *[]Configuration + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByServerOperationResponse, error) +} + +type ListByServerCompleteResult struct { + Items []Configuration +} + +func (r ListByServerOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByServerOperationResponse) LoadMore(ctx context.Context) (resp ListByServerOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByServer ... +func (c ConfigurationsClient) ListByServer(ctx context.Context, id FlexibleServerId) (resp ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServer(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "ListByServer", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByServer(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "ListByServer", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByServer prepares the ListByServer request. +func (c ConfigurationsClient) preparerForListByServer(ctx context.Context, id FlexibleServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/configurations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByServerWithNextLink prepares the ListByServer request with the given nextLink token. +func (c ConfigurationsClient) preparerForListByServerWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByServer handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (c ConfigurationsClient) responderForListByServer(resp *http.Response) (result ListByServerOperationResponse, err error) { + type page struct { + Values []Configuration `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServerWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "ListByServer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "ListByServer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByServer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "ListByServer", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByServerComplete retrieves all of the results into a single object +func (c ConfigurationsClient) ListByServerComplete(ctx context.Context, id FlexibleServerId) (ListByServerCompleteResult, error) { + return c.ListByServerCompleteMatchingPredicate(ctx, id, ConfigurationOperationPredicate{}) +} + +// ListByServerCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ConfigurationsClient) ListByServerCompleteMatchingPredicate(ctx context.Context, id FlexibleServerId, predicate ConfigurationOperationPredicate) (resp ListByServerCompleteResult, err error) { + items := make([]Configuration, 0) + + page, err := c.ListByServer(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByServerCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/method_put_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/method_put_autorest.go new file mode 100644 index 00000000000..4fa0462d018 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/method_put_autorest.go @@ -0,0 +1,79 @@ +package configurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PutOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Put ... +func (c ConfigurationsClient) Put(ctx context.Context, id ConfigurationId, input Configuration) (result PutOperationResponse, err error) { + req, err := c.preparerForPut(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "Put", nil, "Failure preparing request") + return + } + + result, err = c.senderForPut(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "Put", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// PutThenPoll performs Put then polls until it's completed +func (c ConfigurationsClient) PutThenPoll(ctx context.Context, id ConfigurationId, input Configuration) error { + result, err := c.Put(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Put: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Put: %+v", err) + } + + return nil +} + +// preparerForPut prepares the Put request. +func (c ConfigurationsClient) preparerForPut(ctx context.Context, id ConfigurationId, input Configuration) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForPut sends the Put request. The method will close the +// http.Response Body if it receives an error. +func (c ConfigurationsClient) senderForPut(ctx context.Context, req *http.Request) (future PutOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/method_update_autorest.go new file mode 100644 index 00000000000..7d79f3dd369 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/method_update_autorest.go @@ -0,0 +1,79 @@ +package configurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c ConfigurationsClient) Update(ctx context.Context, id ConfigurationId, input Configuration) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "configurations.ConfigurationsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ConfigurationsClient) UpdateThenPoll(ctx context.Context, id ConfigurationId, input Configuration) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c ConfigurationsClient) preparerForUpdate(ctx context.Context, id ConfigurationId, input Configuration) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c ConfigurationsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/model_configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/model_configuration.go new file mode 100644 index 00000000000..b541b4aa206 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/model_configuration.go @@ -0,0 +1,16 @@ +package configurations + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Configuration struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ConfigurationProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/model_configurationproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/model_configurationproperties.go new file mode 100644 index 00000000000..6e3b33946a4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/model_configurationproperties.go @@ -0,0 +1,18 @@ +package configurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationProperties struct { + AllowedValues *string `json:"allowedValues,omitempty"` + DataType *ConfigurationDataType `json:"dataType,omitempty"` + DefaultValue *string `json:"defaultValue,omitempty"` + Description *string `json:"description,omitempty"` + DocumentationLink *string `json:"documentationLink,omitempty"` + IsConfigPendingRestart *bool `json:"isConfigPendingRestart,omitempty"` + IsDynamicConfig *bool `json:"isDynamicConfig,omitempty"` + IsReadOnly *bool `json:"isReadOnly,omitempty"` + Source *string `json:"source,omitempty"` + Unit *string `json:"unit,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/predicates.go new file mode 100644 index 00000000000..9b399a2ac56 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/predicates.go @@ -0,0 +1,24 @@ +package configurations + +type ConfigurationOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ConfigurationOperationPredicate) Matches(input Configuration) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/version.go new file mode 100644 index 00000000000..d5ec5102c44 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations/version.go @@ -0,0 +1,12 @@ +package configurations + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/configurations/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/README.md new file mode 100644 index 00000000000..ecddbc99131 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases` Documentation + +The `databases` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2021-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases" +``` + + +### Client Initialization + +```go +client := databases.NewDatabasesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DatabasesClient.Create` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "databaseValue") + +payload := databases.Database{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Delete` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "databaseValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Get` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "databaseValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.ListByServer` + +```go +ctx := context.TODO() +id := databases.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination +items, err := client.ListByServerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/client.go new file mode 100644 index 00000000000..5305d65eb6c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/client.go @@ -0,0 +1,18 @@ +package databases + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesClient struct { + Client autorest.Client + baseUri string +} + +func NewDatabasesClientWithBaseURI(endpoint string) DatabasesClient { + return DatabasesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/id_database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/id_database.go new file mode 100644 index 00000000000..c96e95554f4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/id_database.go @@ -0,0 +1,137 @@ +package databases + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DatabaseId{} + +// DatabaseId is a struct representing the Resource ID for a Database +type DatabaseId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + DatabaseName string +} + +// NewDatabaseID returns a new DatabaseId struct +func NewDatabaseID(subscriptionId string, resourceGroupName string, serverName string, databaseName string) DatabaseId { + return DatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + DatabaseName: databaseName, + } +} + +// ParseDatabaseID parses 'input' into a DatabaseId +func ParseDatabaseID(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDatabaseIDInsensitively parses 'input' case-insensitively into a DatabaseId +// note: this method should only be used for API response data and not user input +func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDatabaseID checks that 'input' can be parsed as a Database ID +func ValidateDatabaseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Database ID +func (id DatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s/databases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.DatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Database ID +func (id DatabaseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + } +} + +// String returns a human-readable description of this Database ID +func (id DatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + } + return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/id_flexibleserver.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/id_flexibleserver.go new file mode 100644 index 00000000000..0f75b80891d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/id_flexibleserver.go @@ -0,0 +1,124 @@ +package databases + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FlexibleServerId{} + +// FlexibleServerId is a struct representing the Resource ID for a Flexible Server +type FlexibleServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewFlexibleServerID returns a new FlexibleServerId struct +func NewFlexibleServerID(subscriptionId string, resourceGroupName string, serverName string) FlexibleServerId { + return FlexibleServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseFlexibleServerID parses 'input' into a FlexibleServerId +func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFlexibleServerIDInsensitively parses 'input' case-insensitively into a FlexibleServerId +// note: this method should only be used for API response data and not user input +func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID +func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFlexibleServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Flexible Server ID +func (id FlexibleServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID +func (id FlexibleServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Flexible Server ID +func (id FlexibleServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_create_autorest.go new file mode 100644 index 00000000000..e9edfeb945d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_create_autorest.go @@ -0,0 +1,79 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c DatabasesClient) Create(ctx context.Context, id DatabaseId, input Database) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c DatabasesClient) CreateThenPoll(ctx context.Context, id DatabaseId, input Database) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c DatabasesClient) preparerForCreate(ctx context.Context, id DatabaseId, input Database) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c DatabasesClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_delete_autorest.go new file mode 100644 index 00000000000..13221da85a6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_delete_autorest.go @@ -0,0 +1,78 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c DatabasesClient) Delete(ctx context.Context, id DatabaseId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DatabasesClient) DeleteThenPoll(ctx context.Context, id DatabaseId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c DatabasesClient) preparerForDelete(ctx context.Context, id DatabaseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c DatabasesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_get_autorest.go new file mode 100644 index 00000000000..f35d313d226 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_get_autorest.go @@ -0,0 +1,68 @@ +package databases + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Database +} + +// Get ... +func (c DatabasesClient) Get(ctx context.Context, id DatabaseId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DatabasesClient) preparerForGet(ctx context.Context, id DatabaseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DatabasesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_listbyserver_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_listbyserver_autorest.go new file mode 100644 index 00000000000..5937f9e8958 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/method_listbyserver_autorest.go @@ -0,0 +1,186 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServerOperationResponse struct { + HttpResponse *http.Response + Model *[]Database + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByServerOperationResponse, error) +} + +type ListByServerCompleteResult struct { + Items []Database +} + +func (r ListByServerOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByServerOperationResponse) LoadMore(ctx context.Context) (resp ListByServerOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByServer ... +func (c DatabasesClient) ListByServer(ctx context.Context, id FlexibleServerId) (resp ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServer(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByServer", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByServer(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByServer", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByServer prepares the ListByServer request. +func (c DatabasesClient) preparerForListByServer(ctx context.Context, id FlexibleServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/databases", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByServerWithNextLink prepares the ListByServer request with the given nextLink token. +func (c DatabasesClient) preparerForListByServerWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByServer handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (c DatabasesClient) responderForListByServer(resp *http.Response) (result ListByServerOperationResponse, err error) { + type page struct { + Values []Database `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServerWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByServer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByServer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByServer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByServer", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByServerComplete retrieves all of the results into a single object +func (c DatabasesClient) ListByServerComplete(ctx context.Context, id FlexibleServerId) (ListByServerCompleteResult, error) { + return c.ListByServerCompleteMatchingPredicate(ctx, id, DatabaseOperationPredicate{}) +} + +// ListByServerCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DatabasesClient) ListByServerCompleteMatchingPredicate(ctx context.Context, id FlexibleServerId, predicate DatabaseOperationPredicate) (resp ListByServerCompleteResult, err error) { + items := make([]Database, 0) + + page, err := c.ListByServer(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByServerCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/model_database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/model_database.go new file mode 100644 index 00000000000..f656e011163 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/model_database.go @@ -0,0 +1,16 @@ +package databases + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Database struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DatabaseProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/model_databaseproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/model_databaseproperties.go new file mode 100644 index 00000000000..85fcbd70d57 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/model_databaseproperties.go @@ -0,0 +1,9 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseProperties struct { + Charset *string `json:"charset,omitempty"` + Collation *string `json:"collation,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/predicates.go new file mode 100644 index 00000000000..e5d3f3c9c38 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/predicates.go @@ -0,0 +1,24 @@ +package databases + +type DatabaseOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DatabaseOperationPredicate) Matches(input Database) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/version.go new file mode 100644 index 00000000000..6fa6f9e9056 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases/version.go @@ -0,0 +1,12 @@ +package databases + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/databases/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/README.md new file mode 100644 index 00000000000..bada377834b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules` Documentation + +The `firewallrules` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2021-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules" +``` + + +### Client Initialization + +```go +client := firewallrules.NewFirewallRulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `FirewallRulesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "firewallRuleValue") + +payload := firewallrules.FirewallRule{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `FirewallRulesClient.Delete` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "firewallRuleValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `FirewallRulesClient.Get` + +```go +ctx := context.TODO() +id := firewallrules.NewFirewallRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue", "firewallRuleValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `FirewallRulesClient.ListByServer` + +```go +ctx := context.TODO() +id := firewallrules.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +// alternatively `client.ListByServer(ctx, id)` can be used to do batched pagination +items, err := client.ListByServerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/client.go new file mode 100644 index 00000000000..ac01b0459a1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/client.go @@ -0,0 +1,18 @@ +package firewallrules + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRulesClient struct { + Client autorest.Client + baseUri string +} + +func NewFirewallRulesClientWithBaseURI(endpoint string) FirewallRulesClient { + return FirewallRulesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/id_firewallrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/id_firewallrule.go new file mode 100644 index 00000000000..ea7c9ca099d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/id_firewallrule.go @@ -0,0 +1,137 @@ +package firewallrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FirewallRuleId{} + +// FirewallRuleId is a struct representing the Resource ID for a Firewall Rule +type FirewallRuleId struct { + SubscriptionId string + ResourceGroupName string + ServerName string + FirewallRuleName string +} + +// NewFirewallRuleID returns a new FirewallRuleId struct +func NewFirewallRuleID(subscriptionId string, resourceGroupName string, serverName string, firewallRuleName string) FirewallRuleId { + return FirewallRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + FirewallRuleName: firewallRuleName, + } +} + +// ParseFirewallRuleID parses 'input' into a FirewallRuleId +func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FirewallRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'firewallRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFirewallRuleIDInsensitively parses 'input' case-insensitively into a FirewallRuleId +// note: this method should only be used for API response data and not user input +func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(FirewallRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FirewallRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'firewallRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID +func ValidateFirewallRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFirewallRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Firewall Rule ID +func (id FirewallRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s/firewallRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName, id.FirewallRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Firewall Rule ID +func (id FirewallRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + resourceids.StaticSegment("staticFirewallRules", "firewallRules", "firewallRules"), + resourceids.UserSpecifiedSegment("firewallRuleName", "firewallRuleValue"), + } +} + +// String returns a human-readable description of this Firewall Rule ID +func (id FirewallRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + fmt.Sprintf("Firewall Rule Name: %q", id.FirewallRuleName), + } + return fmt.Sprintf("Firewall Rule (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/id_flexibleserver.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/id_flexibleserver.go new file mode 100644 index 00000000000..2197cda3692 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/id_flexibleserver.go @@ -0,0 +1,124 @@ +package firewallrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FlexibleServerId{} + +// FlexibleServerId is a struct representing the Resource ID for a Flexible Server +type FlexibleServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewFlexibleServerID returns a new FlexibleServerId struct +func NewFlexibleServerID(subscriptionId string, resourceGroupName string, serverName string) FlexibleServerId { + return FlexibleServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseFlexibleServerID parses 'input' into a FlexibleServerId +func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFlexibleServerIDInsensitively parses 'input' case-insensitively into a FlexibleServerId +// note: this method should only be used for API response data and not user input +func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID +func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFlexibleServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Flexible Server ID +func (id FlexibleServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID +func (id FlexibleServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Flexible Server ID +func (id FlexibleServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_createorupdate_autorest.go new file mode 100644 index 00000000000..0dfa761f1a0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package firewallrules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c FirewallRulesClient) CreateOrUpdate(ctx context.Context, id FirewallRuleId, input FirewallRule) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c FirewallRulesClient) CreateOrUpdateThenPoll(ctx context.Context, id FirewallRuleId, input FirewallRule) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c FirewallRulesClient) preparerForCreateOrUpdate(ctx context.Context, id FirewallRuleId, input FirewallRule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c FirewallRulesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_delete_autorest.go new file mode 100644 index 00000000000..ec4b290ecdd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_delete_autorest.go @@ -0,0 +1,78 @@ +package firewallrules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c FirewallRulesClient) Delete(ctx context.Context, id FirewallRuleId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c FirewallRulesClient) DeleteThenPoll(ctx context.Context, id FirewallRuleId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c FirewallRulesClient) preparerForDelete(ctx context.Context, id FirewallRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c FirewallRulesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_get_autorest.go new file mode 100644 index 00000000000..1391c01ba1a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_get_autorest.go @@ -0,0 +1,68 @@ +package firewallrules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *FirewallRule +} + +// Get ... +func (c FirewallRulesClient) Get(ctx context.Context, id FirewallRuleId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c FirewallRulesClient) preparerForGet(ctx context.Context, id FirewallRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c FirewallRulesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_listbyserver_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_listbyserver_autorest.go new file mode 100644 index 00000000000..82fe51aed30 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/method_listbyserver_autorest.go @@ -0,0 +1,186 @@ +package firewallrules + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByServerOperationResponse struct { + HttpResponse *http.Response + Model *[]FirewallRule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByServerOperationResponse, error) +} + +type ListByServerCompleteResult struct { + Items []FirewallRule +} + +func (r ListByServerOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByServerOperationResponse) LoadMore(ctx context.Context) (resp ListByServerOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByServer ... +func (c FirewallRulesClient) ListByServer(ctx context.Context, id FlexibleServerId) (resp ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServer(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "ListByServer", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "ListByServer", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByServer(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "ListByServer", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByServer prepares the ListByServer request. +func (c FirewallRulesClient) preparerForListByServer(ctx context.Context, id FlexibleServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/firewallRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByServerWithNextLink prepares the ListByServer request with the given nextLink token. +func (c FirewallRulesClient) preparerForListByServerWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByServer handles the response to the ListByServer request. The method always +// closes the http.Response Body. +func (c FirewallRulesClient) responderForListByServer(resp *http.Response) (result ListByServerOperationResponse, err error) { + type page struct { + Values []FirewallRule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByServerOperationResponse, err error) { + req, err := c.preparerForListByServerWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "ListByServer", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "ListByServer", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByServer(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "firewallrules.FirewallRulesClient", "ListByServer", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByServerComplete retrieves all of the results into a single object +func (c FirewallRulesClient) ListByServerComplete(ctx context.Context, id FlexibleServerId) (ListByServerCompleteResult, error) { + return c.ListByServerCompleteMatchingPredicate(ctx, id, FirewallRuleOperationPredicate{}) +} + +// ListByServerCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c FirewallRulesClient) ListByServerCompleteMatchingPredicate(ctx context.Context, id FlexibleServerId, predicate FirewallRuleOperationPredicate) (resp ListByServerCompleteResult, err error) { + items := make([]FirewallRule, 0) + + page, err := c.ListByServer(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByServerCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/model_firewallrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/model_firewallrule.go new file mode 100644 index 00000000000..e6c4db6725d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/model_firewallrule.go @@ -0,0 +1,16 @@ +package firewallrules + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties FirewallRuleProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/model_firewallruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/model_firewallruleproperties.go new file mode 100644 index 00000000000..fca4e1c3684 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/model_firewallruleproperties.go @@ -0,0 +1,9 @@ +package firewallrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FirewallRuleProperties struct { + EndIPAddress string `json:"endIpAddress"` + StartIPAddress string `json:"startIpAddress"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/predicates.go new file mode 100644 index 00000000000..6badc865814 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/predicates.go @@ -0,0 +1,24 @@ +package firewallrules + +type FirewallRuleOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p FirewallRuleOperationPredicate) Matches(input FirewallRule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/version.go new file mode 100644 index 00000000000..75a8730ee27 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules/version.go @@ -0,0 +1,12 @@ +package firewallrules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/firewallrules/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/README.md new file mode 100644 index 00000000000..866027bcd6e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/README.md @@ -0,0 +1,37 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart` Documentation + +The `serverrestart` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2021-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart" +``` + + +### Client Initialization + +```go +client := serverrestart.NewServerRestartClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServerRestartClient.ServersRestart` + +```go +ctx := context.TODO() +id := serverrestart.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := serverrestart.RestartParameter{ + // ... +} + + +if err := client.ServersRestartThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/client.go new file mode 100644 index 00000000000..7e3313f4726 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/client.go @@ -0,0 +1,18 @@ +package serverrestart + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerRestartClient struct { + Client autorest.Client + baseUri string +} + +func NewServerRestartClientWithBaseURI(endpoint string) ServerRestartClient { + return ServerRestartClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/constants.go new file mode 100644 index 00000000000..be0c032378e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/constants.go @@ -0,0 +1,40 @@ +package serverrestart + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FailoverMode string + +const ( + FailoverModeForcedFailover FailoverMode = "ForcedFailover" + FailoverModeForcedSwitchover FailoverMode = "ForcedSwitchover" + FailoverModePlannedFailover FailoverMode = "PlannedFailover" + FailoverModePlannedSwitchover FailoverMode = "PlannedSwitchover" +) + +func PossibleValuesForFailoverMode() []string { + return []string{ + string(FailoverModeForcedFailover), + string(FailoverModeForcedSwitchover), + string(FailoverModePlannedFailover), + string(FailoverModePlannedSwitchover), + } +} + +func parseFailoverMode(input string) (*FailoverMode, error) { + vals := map[string]FailoverMode{ + "forcedfailover": FailoverModeForcedFailover, + "forcedswitchover": FailoverModeForcedSwitchover, + "plannedfailover": FailoverModePlannedFailover, + "plannedswitchover": FailoverModePlannedSwitchover, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FailoverMode(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/id_flexibleserver.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/id_flexibleserver.go new file mode 100644 index 00000000000..b0f5049b0ae --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/id_flexibleserver.go @@ -0,0 +1,124 @@ +package serverrestart + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FlexibleServerId{} + +// FlexibleServerId is a struct representing the Resource ID for a Flexible Server +type FlexibleServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewFlexibleServerID returns a new FlexibleServerId struct +func NewFlexibleServerID(subscriptionId string, resourceGroupName string, serverName string) FlexibleServerId { + return FlexibleServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseFlexibleServerID parses 'input' into a FlexibleServerId +func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFlexibleServerIDInsensitively parses 'input' case-insensitively into a FlexibleServerId +// note: this method should only be used for API response data and not user input +func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID +func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFlexibleServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Flexible Server ID +func (id FlexibleServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID +func (id FlexibleServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Flexible Server ID +func (id FlexibleServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/method_serversrestart_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/method_serversrestart_autorest.go new file mode 100644 index 00000000000..21ccdda88d5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/method_serversrestart_autorest.go @@ -0,0 +1,79 @@ +package serverrestart + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServersRestartOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// ServersRestart ... +func (c ServerRestartClient) ServersRestart(ctx context.Context, id FlexibleServerId, input RestartParameter) (result ServersRestartOperationResponse, err error) { + req, err := c.preparerForServersRestart(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "serverrestart.ServerRestartClient", "ServersRestart", nil, "Failure preparing request") + return + } + + result, err = c.senderForServersRestart(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "serverrestart.ServerRestartClient", "ServersRestart", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ServersRestartThenPoll performs ServersRestart then polls until it's completed +func (c ServerRestartClient) ServersRestartThenPoll(ctx context.Context, id FlexibleServerId, input RestartParameter) error { + result, err := c.ServersRestart(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ServersRestart: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after ServersRestart: %+v", err) + } + + return nil +} + +// preparerForServersRestart prepares the ServersRestart request. +func (c ServerRestartClient) preparerForServersRestart(ctx context.Context, id FlexibleServerId, input RestartParameter) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/restart", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForServersRestart sends the ServersRestart request. The method will close the +// http.Response Body if it receives an error. +func (c ServerRestartClient) senderForServersRestart(ctx context.Context, req *http.Request) (future ServersRestartOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/model_restartparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/model_restartparameter.go new file mode 100644 index 00000000000..752616bf818 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/model_restartparameter.go @@ -0,0 +1,9 @@ +package serverrestart + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestartParameter struct { + FailoverMode *FailoverMode `json:"failoverMode,omitempty"` + RestartWithFailover *bool `json:"restartWithFailover,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/version.go new file mode 100644 index 00000000000..34503f2369e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart/version.go @@ -0,0 +1,12 @@ +package serverrestart + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/serverrestart/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/README.md new file mode 100644 index 00000000000..5834df196d2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers` Documentation + +The `servers` SDK allows for interaction with the Azure Resource Manager Service `postgresql` (API Version `2021-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers" +``` + + +### Client Initialization + +```go +client := servers.NewServersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServersClient.Create` + +```go +ctx := context.TODO() +id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := servers.Server{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServersClient.Delete` + +```go +ctx := context.TODO() +id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServersClient.Get` + +```go +ctx := context.TODO() +id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServersClient.List` + +```go +ctx := context.TODO() +id := servers.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ServersClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := servers.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ServersClient.Update` + +```go +ctx := context.TODO() +id := servers.NewFlexibleServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serverValue") + +payload := servers.ServerForUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/client.go new file mode 100644 index 00000000000..fd9e02ba599 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/client.go @@ -0,0 +1,18 @@ +package servers + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServersClient struct { + Client autorest.Client + baseUri string +} + +func NewServersClientWithBaseURI(endpoint string) ServersClient { + return ServersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/constants.go new file mode 100644 index 00000000000..70fdc5dbbc9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/constants.go @@ -0,0 +1,300 @@ +package servers + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateMode string + +const ( + CreateModeCreate CreateMode = "Create" + CreateModeDefault CreateMode = "Default" + CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" + CreateModeUpdate CreateMode = "Update" +) + +func PossibleValuesForCreateMode() []string { + return []string{ + string(CreateModeCreate), + string(CreateModeDefault), + string(CreateModePointInTimeRestore), + string(CreateModeUpdate), + } +} + +func parseCreateMode(input string) (*CreateMode, error) { + vals := map[string]CreateMode{ + "create": CreateModeCreate, + "default": CreateModeDefault, + "pointintimerestore": CreateModePointInTimeRestore, + "update": CreateModeUpdate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CreateMode(input) + return &out, nil +} + +type CreateModeForUpdate string + +const ( + CreateModeForUpdateDefault CreateModeForUpdate = "Default" + CreateModeForUpdateUpdate CreateModeForUpdate = "Update" +) + +func PossibleValuesForCreateModeForUpdate() []string { + return []string{ + string(CreateModeForUpdateDefault), + string(CreateModeForUpdateUpdate), + } +} + +func parseCreateModeForUpdate(input string) (*CreateModeForUpdate, error) { + vals := map[string]CreateModeForUpdate{ + "default": CreateModeForUpdateDefault, + "update": CreateModeForUpdateUpdate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CreateModeForUpdate(input) + return &out, nil +} + +type GeoRedundantBackupEnum string + +const ( + GeoRedundantBackupEnumDisabled GeoRedundantBackupEnum = "Disabled" + GeoRedundantBackupEnumEnabled GeoRedundantBackupEnum = "Enabled" +) + +func PossibleValuesForGeoRedundantBackupEnum() []string { + return []string{ + string(GeoRedundantBackupEnumDisabled), + string(GeoRedundantBackupEnumEnabled), + } +} + +func parseGeoRedundantBackupEnum(input string) (*GeoRedundantBackupEnum, error) { + vals := map[string]GeoRedundantBackupEnum{ + "disabled": GeoRedundantBackupEnumDisabled, + "enabled": GeoRedundantBackupEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := GeoRedundantBackupEnum(input) + return &out, nil +} + +type HighAvailabilityMode string + +const ( + HighAvailabilityModeDisabled HighAvailabilityMode = "Disabled" + HighAvailabilityModeZoneRedundant HighAvailabilityMode = "ZoneRedundant" +) + +func PossibleValuesForHighAvailabilityMode() []string { + return []string{ + string(HighAvailabilityModeDisabled), + string(HighAvailabilityModeZoneRedundant), + } +} + +func parseHighAvailabilityMode(input string) (*HighAvailabilityMode, error) { + vals := map[string]HighAvailabilityMode{ + "disabled": HighAvailabilityModeDisabled, + "zoneredundant": HighAvailabilityModeZoneRedundant, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HighAvailabilityMode(input) + return &out, nil +} + +type ServerHAState string + +const ( + ServerHAStateCreatingStandby ServerHAState = "CreatingStandby" + ServerHAStateFailingOver ServerHAState = "FailingOver" + ServerHAStateHealthy ServerHAState = "Healthy" + ServerHAStateNotEnabled ServerHAState = "NotEnabled" + ServerHAStateRemovingStandby ServerHAState = "RemovingStandby" + ServerHAStateReplicatingData ServerHAState = "ReplicatingData" +) + +func PossibleValuesForServerHAState() []string { + return []string{ + string(ServerHAStateCreatingStandby), + string(ServerHAStateFailingOver), + string(ServerHAStateHealthy), + string(ServerHAStateNotEnabled), + string(ServerHAStateRemovingStandby), + string(ServerHAStateReplicatingData), + } +} + +func parseServerHAState(input string) (*ServerHAState, error) { + vals := map[string]ServerHAState{ + "creatingstandby": ServerHAStateCreatingStandby, + "failingover": ServerHAStateFailingOver, + "healthy": ServerHAStateHealthy, + "notenabled": ServerHAStateNotEnabled, + "removingstandby": ServerHAStateRemovingStandby, + "replicatingdata": ServerHAStateReplicatingData, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerHAState(input) + return &out, nil +} + +type ServerPublicNetworkAccessState string + +const ( + ServerPublicNetworkAccessStateDisabled ServerPublicNetworkAccessState = "Disabled" + ServerPublicNetworkAccessStateEnabled ServerPublicNetworkAccessState = "Enabled" +) + +func PossibleValuesForServerPublicNetworkAccessState() []string { + return []string{ + string(ServerPublicNetworkAccessStateDisabled), + string(ServerPublicNetworkAccessStateEnabled), + } +} + +func parseServerPublicNetworkAccessState(input string) (*ServerPublicNetworkAccessState, error) { + vals := map[string]ServerPublicNetworkAccessState{ + "disabled": ServerPublicNetworkAccessStateDisabled, + "enabled": ServerPublicNetworkAccessStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerPublicNetworkAccessState(input) + return &out, nil +} + +type ServerState string + +const ( + ServerStateDisabled ServerState = "Disabled" + ServerStateDropping ServerState = "Dropping" + ServerStateReady ServerState = "Ready" + ServerStateStarting ServerState = "Starting" + ServerStateStopped ServerState = "Stopped" + ServerStateStopping ServerState = "Stopping" + ServerStateUpdating ServerState = "Updating" +) + +func PossibleValuesForServerState() []string { + return []string{ + string(ServerStateDisabled), + string(ServerStateDropping), + string(ServerStateReady), + string(ServerStateStarting), + string(ServerStateStopped), + string(ServerStateStopping), + string(ServerStateUpdating), + } +} + +func parseServerState(input string) (*ServerState, error) { + vals := map[string]ServerState{ + "disabled": ServerStateDisabled, + "dropping": ServerStateDropping, + "ready": ServerStateReady, + "starting": ServerStateStarting, + "stopped": ServerStateStopped, + "stopping": ServerStateStopping, + "updating": ServerStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerState(input) + return &out, nil +} + +type ServerVersion string + +const ( + ServerVersionOneFour ServerVersion = "14" + ServerVersionOneOne ServerVersion = "11" + ServerVersionOneThree ServerVersion = "13" + ServerVersionOneTwo ServerVersion = "12" +) + +func PossibleValuesForServerVersion() []string { + return []string{ + string(ServerVersionOneFour), + string(ServerVersionOneOne), + string(ServerVersionOneThree), + string(ServerVersionOneTwo), + } +} + +func parseServerVersion(input string) (*ServerVersion, error) { + vals := map[string]ServerVersion{ + "14": ServerVersionOneFour, + "11": ServerVersionOneOne, + "13": ServerVersionOneThree, + "12": ServerVersionOneTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServerVersion(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBurstable SkuTier = "Burstable" + SkuTierGeneralPurpose SkuTier = "GeneralPurpose" + SkuTierMemoryOptimized SkuTier = "MemoryOptimized" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBurstable), + string(SkuTierGeneralPurpose), + string(SkuTierMemoryOptimized), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "burstable": SkuTierBurstable, + "generalpurpose": SkuTierGeneralPurpose, + "memoryoptimized": SkuTierMemoryOptimized, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/id_flexibleserver.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/id_flexibleserver.go new file mode 100644 index 00000000000..faf0175b6ac --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/id_flexibleserver.go @@ -0,0 +1,124 @@ +package servers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = FlexibleServerId{} + +// FlexibleServerId is a struct representing the Resource ID for a Flexible Server +type FlexibleServerId struct { + SubscriptionId string + ResourceGroupName string + ServerName string +} + +// NewFlexibleServerID returns a new FlexibleServerId struct +func NewFlexibleServerID(subscriptionId string, resourceGroupName string, serverName string) FlexibleServerId { + return FlexibleServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ServerName: serverName, + } +} + +// ParseFlexibleServerID parses 'input' into a FlexibleServerId +func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseFlexibleServerIDInsensitively parses 'input' case-insensitively into a FlexibleServerId +// note: this method should only be used for API response data and not user input +func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) { + parser := resourceids.NewParserFromResourceIdType(FlexibleServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := FlexibleServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { + return nil, fmt.Errorf("the segment 'serverName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID +func ValidateFlexibleServerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseFlexibleServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Flexible Server ID +func (id FlexibleServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Flexible Server ID +func (id FlexibleServerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftDBforPostgreSQL", "Microsoft.DBforPostgreSQL", "Microsoft.DBforPostgreSQL"), + resourceids.StaticSegment("staticFlexibleServers", "flexibleServers", "flexibleServers"), + resourceids.UserSpecifiedSegment("serverName", "serverValue"), + } +} + +// String returns a human-readable description of this Flexible Server ID +func (id FlexibleServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Server Name: %q", id.ServerName), + } + return fmt.Sprintf("Flexible Server (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_create_autorest.go new file mode 100644 index 00000000000..f7cd73566e6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_create_autorest.go @@ -0,0 +1,79 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c ServersClient) Create(ctx context.Context, id FlexibleServerId, input Server) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c ServersClient) CreateThenPoll(ctx context.Context, id FlexibleServerId, input Server) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c ServersClient) preparerForCreate(ctx context.Context, id FlexibleServerId, input Server) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c ServersClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_delete_autorest.go new file mode 100644 index 00000000000..d05fd1a076a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_delete_autorest.go @@ -0,0 +1,78 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ServersClient) Delete(ctx context.Context, id FlexibleServerId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ServersClient) DeleteThenPoll(ctx context.Context, id FlexibleServerId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ServersClient) preparerForDelete(ctx context.Context, id FlexibleServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ServersClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_get_autorest.go new file mode 100644 index 00000000000..bb0074a3085 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_get_autorest.go @@ -0,0 +1,68 @@ +package servers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Server +} + +// Get ... +func (c ServersClient) Get(ctx context.Context, id FlexibleServerId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ServersClient) preparerForGet(ctx context.Context, id FlexibleServerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ServersClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_list_autorest.go new file mode 100644 index 00000000000..c41e8d8ec75 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_list_autorest.go @@ -0,0 +1,187 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Server + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Server +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c ServersClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c ServersClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DBforPostgreSQL/flexibleServers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c ServersClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ServersClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Server `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c ServersClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ServerOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ServersClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ServerOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Server, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..e0329e5d701 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Server + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Server +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c ServersClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ServersClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.DBforPostgreSQL/flexibleServers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c ServersClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ServersClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Server `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c ServersClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ServerOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ServersClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ServerOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Server, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_update_autorest.go new file mode 100644 index 00000000000..588b1305994 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/method_update_autorest.go @@ -0,0 +1,79 @@ +package servers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c ServersClient) Update(ctx context.Context, id FlexibleServerId, input ServerForUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "servers.ServersClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ServersClient) UpdateThenPoll(ctx context.Context, id FlexibleServerId, input ServerForUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c ServersClient) preparerForUpdate(ctx context.Context, id FlexibleServerId, input ServerForUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c ServersClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_backup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_backup.go new file mode 100644 index 00000000000..94079534357 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_backup.go @@ -0,0 +1,28 @@ +package servers + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Backup struct { + BackupRetentionDays *int64 `json:"backupRetentionDays,omitempty"` + EarliestRestoreDate *string `json:"earliestRestoreDate,omitempty"` + GeoRedundantBackup *GeoRedundantBackupEnum `json:"geoRedundantBackup,omitempty"` +} + +func (o *Backup) GetEarliestRestoreDateAsTime() (*time.Time, error) { + if o.EarliestRestoreDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EarliestRestoreDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *Backup) SetEarliestRestoreDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EarliestRestoreDate = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_highavailability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_highavailability.go new file mode 100644 index 00000000000..76727402318 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_highavailability.go @@ -0,0 +1,10 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HighAvailability struct { + Mode *HighAvailabilityMode `json:"mode,omitempty"` + StandbyAvailabilityZone *string `json:"standbyAvailabilityZone,omitempty"` + State *ServerHAState `json:"state,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_maintenancewindow.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_maintenancewindow.go new file mode 100644 index 00000000000..e3316db4574 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_maintenancewindow.go @@ -0,0 +1,11 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MaintenanceWindow struct { + CustomWindow *string `json:"customWindow,omitempty"` + DayOfWeek *int64 `json:"dayOfWeek,omitempty"` + StartHour *int64 `json:"startHour,omitempty"` + StartMinute *int64 `json:"startMinute,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_network.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_network.go new file mode 100644 index 00000000000..7aeb70fc3a0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_network.go @@ -0,0 +1,10 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Network struct { + DelegatedSubnetResourceId *string `json:"delegatedSubnetResourceId,omitempty"` + PrivateDnsZoneArmResourceId *string `json:"privateDnsZoneArmResourceId,omitempty"` + PublicNetworkAccess *ServerPublicNetworkAccessState `json:"publicNetworkAccess,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_server.go new file mode 100644 index 00000000000..f92b081c32c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_server.go @@ -0,0 +1,19 @@ +package servers + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Server struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ServerProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_serverforupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_serverforupdate.go new file mode 100644 index 00000000000..1dd9be8b5f0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_serverforupdate.go @@ -0,0 +1,11 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerForUpdate struct { + Location *string `json:"location,omitempty"` + Properties *ServerPropertiesForUpdate `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_serverproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_serverproperties.go new file mode 100644 index 00000000000..02ce2c91a13 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_serverproperties.go @@ -0,0 +1,40 @@ +package servers + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerProperties struct { + AdministratorLogin *string `json:"administratorLogin,omitempty"` + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + AvailabilityZone *string `json:"availabilityZone,omitempty"` + Backup *Backup `json:"backup,omitempty"` + CreateMode *CreateMode `json:"createMode,omitempty"` + FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"` + HighAvailability *HighAvailability `json:"highAvailability,omitempty"` + MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` + MinorVersion *string `json:"minorVersion,omitempty"` + Network *Network `json:"network,omitempty"` + PointInTimeUTC *string `json:"pointInTimeUTC,omitempty"` + SourceServerResourceId *string `json:"sourceServerResourceId,omitempty"` + State *ServerState `json:"state,omitempty"` + Storage *Storage `json:"storage,omitempty"` + Version *ServerVersion `json:"version,omitempty"` +} + +func (o *ServerProperties) GetPointInTimeUTCAsTime() (*time.Time, error) { + if o.PointInTimeUTC == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PointInTimeUTC, "2006-01-02T15:04:05Z07:00") +} + +func (o *ServerProperties) SetPointInTimeUTCAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PointInTimeUTC = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_serverpropertiesforupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_serverpropertiesforupdate.go new file mode 100644 index 00000000000..b145b3945d3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_serverpropertiesforupdate.go @@ -0,0 +1,13 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerPropertiesForUpdate struct { + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + Backup *Backup `json:"backup,omitempty"` + CreateMode *CreateModeForUpdate `json:"createMode,omitempty"` + HighAvailability *HighAvailability `json:"highAvailability,omitempty"` + MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` + Storage *Storage `json:"storage,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_sku.go new file mode 100644 index 00000000000..6302164cd2e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_sku.go @@ -0,0 +1,9 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name string `json:"name"` + Tier SkuTier `json:"tier"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_storage.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_storage.go new file mode 100644 index 00000000000..3cc55ae6193 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/model_storage.go @@ -0,0 +1,8 @@ +package servers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Storage struct { + StorageSizeGB *int64 `json:"storageSizeGB,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/predicates.go new file mode 100644 index 00000000000..a74c8a63880 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/predicates.go @@ -0,0 +1,29 @@ +package servers + +type ServerOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ServerOperationPredicate) Matches(input Server) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/version.go new file mode 100644 index 00000000000..e7b3626ba2d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers/version.go @@ -0,0 +1,12 @@ +package servers + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/servers/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/README.md new file mode 100644 index 00000000000..425213a5749 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/README.md @@ -0,0 +1,175 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities` Documentation + +The `capacities` SDK allows for interaction with the Azure Resource Manager Service `powerbidedicated` (API Version `2021-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities" +``` + + +### Client Initialization + +```go +client := capacities.NewCapacitiesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CapacitiesClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := capacities.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +payload := capacities.CheckCapacityNameAvailabilityParameters{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapacitiesClient.Create` + +```go +ctx := context.TODO() +id := capacities.NewCapacitiesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedCapacityValue") + +payload := capacities.DedicatedCapacity{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CapacitiesClient.Delete` + +```go +ctx := context.TODO() +id := capacities.NewCapacitiesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedCapacityValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CapacitiesClient.GetDetails` + +```go +ctx := context.TODO() +id := capacities.NewCapacitiesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedCapacityValue") + +read, err := client.GetDetails(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapacitiesClient.List` + +```go +ctx := context.TODO() +id := capacities.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapacitiesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := capacities.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.ListByResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapacitiesClient.ListSkusForCapacity` + +```go +ctx := context.TODO() +id := capacities.NewCapacitiesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedCapacityValue") + +read, err := client.ListSkusForCapacity(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapacitiesClient.Resume` + +```go +ctx := context.TODO() +id := capacities.NewCapacitiesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedCapacityValue") + +if err := client.ResumeThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CapacitiesClient.Suspend` + +```go +ctx := context.TODO() +id := capacities.NewCapacitiesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedCapacityValue") + +if err := client.SuspendThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CapacitiesClient.Update` + +```go +ctx := context.TODO() +id := capacities.NewCapacitiesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "dedicatedCapacityValue") + +payload := capacities.DedicatedCapacityUpdateParameters{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/client.go new file mode 100644 index 00000000000..2a8b5cafc6b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/client.go @@ -0,0 +1,18 @@ +package capacities + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacitiesClient struct { + Client autorest.Client + baseUri string +} + +func NewCapacitiesClientWithBaseURI(endpoint string) CapacitiesClient { + return CapacitiesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/constants.go new file mode 100644 index 00000000000..e613550aae4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/constants.go @@ -0,0 +1,181 @@ +package capacities + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityProvisioningState string + +const ( + CapacityProvisioningStateDeleting CapacityProvisioningState = "Deleting" + CapacityProvisioningStateFailed CapacityProvisioningState = "Failed" + CapacityProvisioningStatePaused CapacityProvisioningState = "Paused" + CapacityProvisioningStatePausing CapacityProvisioningState = "Pausing" + CapacityProvisioningStatePreparing CapacityProvisioningState = "Preparing" + CapacityProvisioningStateProvisioning CapacityProvisioningState = "Provisioning" + CapacityProvisioningStateResuming CapacityProvisioningState = "Resuming" + CapacityProvisioningStateScaling CapacityProvisioningState = "Scaling" + CapacityProvisioningStateSucceeded CapacityProvisioningState = "Succeeded" + CapacityProvisioningStateSuspended CapacityProvisioningState = "Suspended" + CapacityProvisioningStateSuspending CapacityProvisioningState = "Suspending" + CapacityProvisioningStateUpdating CapacityProvisioningState = "Updating" +) + +func PossibleValuesForCapacityProvisioningState() []string { + return []string{ + string(CapacityProvisioningStateDeleting), + string(CapacityProvisioningStateFailed), + string(CapacityProvisioningStatePaused), + string(CapacityProvisioningStatePausing), + string(CapacityProvisioningStatePreparing), + string(CapacityProvisioningStateProvisioning), + string(CapacityProvisioningStateResuming), + string(CapacityProvisioningStateScaling), + string(CapacityProvisioningStateSucceeded), + string(CapacityProvisioningStateSuspended), + string(CapacityProvisioningStateSuspending), + string(CapacityProvisioningStateUpdating), + } +} + +func parseCapacityProvisioningState(input string) (*CapacityProvisioningState, error) { + vals := map[string]CapacityProvisioningState{ + "deleting": CapacityProvisioningStateDeleting, + "failed": CapacityProvisioningStateFailed, + "paused": CapacityProvisioningStatePaused, + "pausing": CapacityProvisioningStatePausing, + "preparing": CapacityProvisioningStatePreparing, + "provisioning": CapacityProvisioningStateProvisioning, + "resuming": CapacityProvisioningStateResuming, + "scaling": CapacityProvisioningStateScaling, + "succeeded": CapacityProvisioningStateSucceeded, + "suspended": CapacityProvisioningStateSuspended, + "suspending": CapacityProvisioningStateSuspending, + "updating": CapacityProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CapacityProvisioningState(input) + return &out, nil +} + +type CapacitySkuTier string + +const ( + CapacitySkuTierAutoPremiumHost CapacitySkuTier = "AutoPremiumHost" + CapacitySkuTierPBIEAzure CapacitySkuTier = "PBIE_Azure" + CapacitySkuTierPremium CapacitySkuTier = "Premium" +) + +func PossibleValuesForCapacitySkuTier() []string { + return []string{ + string(CapacitySkuTierAutoPremiumHost), + string(CapacitySkuTierPBIEAzure), + string(CapacitySkuTierPremium), + } +} + +func parseCapacitySkuTier(input string) (*CapacitySkuTier, error) { + vals := map[string]CapacitySkuTier{ + "autopremiumhost": CapacitySkuTierAutoPremiumHost, + "pbie_azure": CapacitySkuTierPBIEAzure, + "premium": CapacitySkuTierPremium, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CapacitySkuTier(input) + return &out, nil +} + +type Mode string + +const ( + ModeGenOne Mode = "Gen1" + ModeGenTwo Mode = "Gen2" +) + +func PossibleValuesForMode() []string { + return []string{ + string(ModeGenOne), + string(ModeGenTwo), + } +} + +func parseMode(input string) (*Mode, error) { + vals := map[string]Mode{ + "gen1": ModeGenOne, + "gen2": ModeGenTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Mode(input) + return &out, nil +} + +type State string + +const ( + StateDeleting State = "Deleting" + StateFailed State = "Failed" + StatePaused State = "Paused" + StatePausing State = "Pausing" + StatePreparing State = "Preparing" + StateProvisioning State = "Provisioning" + StateResuming State = "Resuming" + StateScaling State = "Scaling" + StateSucceeded State = "Succeeded" + StateSuspended State = "Suspended" + StateSuspending State = "Suspending" + StateUpdating State = "Updating" +) + +func PossibleValuesForState() []string { + return []string{ + string(StateDeleting), + string(StateFailed), + string(StatePaused), + string(StatePausing), + string(StatePreparing), + string(StateProvisioning), + string(StateResuming), + string(StateScaling), + string(StateSucceeded), + string(StateSuspended), + string(StateSuspending), + string(StateUpdating), + } +} + +func parseState(input string) (*State, error) { + vals := map[string]State{ + "deleting": StateDeleting, + "failed": StateFailed, + "paused": StatePaused, + "pausing": StatePausing, + "preparing": StatePreparing, + "provisioning": StateProvisioning, + "resuming": StateResuming, + "scaling": StateScaling, + "succeeded": StateSucceeded, + "suspended": StateSuspended, + "suspending": StateSuspending, + "updating": StateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := State(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/id_capacities.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/id_capacities.go similarity index 90% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/id_capacities.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/id_capacities.go index 3349915de44..6693bd6aad9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/id_capacities.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/id_capacities.go @@ -102,13 +102,13 @@ func (id CapacitiesId) ID() string { // Segments returns a slice of Resource ID Segments which comprise this Capacities ID func (id CapacitiesId) Segments() []resourceids.Segment { return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftPowerBIDedicated", "Microsoft.PowerBIDedicated", "Microsoft.PowerBIDedicated"), - resourceids.StaticSegment("capacities", "capacities", "capacities"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftPowerBIDedicated", "Microsoft.PowerBIDedicated", "Microsoft.PowerBIDedicated"), + resourceids.StaticSegment("staticCapacities", "capacities", "capacities"), resourceids.UserSpecifiedSegment("dedicatedCapacityName", "dedicatedCapacityValue"), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/id_location.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/id_location.go new file mode 100644 index 00000000000..5323abb2c4c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/id_location.go @@ -0,0 +1,111 @@ +package capacities + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + Location string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, location string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + Location: location, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.PowerBIDedicated/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftPowerBIDedicated", "Microsoft.PowerBIDedicated", "Microsoft.PowerBIDedicated"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("location", "locationValue"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location: %q", id.Location), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_checknameavailability_autorest.go new file mode 100644 index 00000000000..3b4bae555c0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_checknameavailability_autorest.go @@ -0,0 +1,70 @@ +package capacities + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckCapacityNameAvailabilityResult +} + +// CheckNameAvailability ... +func (c CapacitiesClient) CheckNameAvailability(ctx context.Context, id LocationId, input CheckCapacityNameAvailabilityParameters) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c CapacitiesClient) preparerForCheckNameAvailability(ctx context.Context, id LocationId, input CheckCapacityNameAvailabilityParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c CapacitiesClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_create_autorest.go new file mode 100644 index 00000000000..2f3e4c4d70b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_create_autorest.go @@ -0,0 +1,79 @@ +package capacities + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c CapacitiesClient) Create(ctx context.Context, id CapacitiesId, input DedicatedCapacity) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c CapacitiesClient) CreateThenPoll(ctx context.Context, id CapacitiesId, input DedicatedCapacity) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c CapacitiesClient) preparerForCreate(ctx context.Context, id CapacitiesId, input DedicatedCapacity) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c CapacitiesClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_delete_autorest.go new file mode 100644 index 00000000000..2ae1ea548f7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_delete_autorest.go @@ -0,0 +1,78 @@ +package capacities + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c CapacitiesClient) Delete(ctx context.Context, id CapacitiesId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c CapacitiesClient) DeleteThenPoll(ctx context.Context, id CapacitiesId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c CapacitiesClient) preparerForDelete(ctx context.Context, id CapacitiesId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c CapacitiesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_getdetails_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_getdetails_autorest.go new file mode 100644 index 00000000000..1e96f902cad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_getdetails_autorest.go @@ -0,0 +1,68 @@ +package capacities + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDetailsOperationResponse struct { + HttpResponse *http.Response + Model *DedicatedCapacity +} + +// GetDetails ... +func (c CapacitiesClient) GetDetails(ctx context.Context, id CapacitiesId) (result GetDetailsOperationResponse, err error) { + req, err := c.preparerForGetDetails(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "GetDetails", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "GetDetails", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetDetails(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "GetDetails", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetDetails prepares the GetDetails request. +func (c CapacitiesClient) preparerForGetDetails(ctx context.Context, id CapacitiesId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetDetails handles the response to the GetDetails request. The method always +// closes the http.Response Body. +func (c CapacitiesClient) responderForGetDetails(resp *http.Response) (result GetDetailsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_list_autorest.go new file mode 100644 index 00000000000..e65db7b1873 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_list_autorest.go @@ -0,0 +1,70 @@ +package capacities + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *DedicatedCapacities +} + +// List ... +func (c CapacitiesClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c CapacitiesClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.PowerBIDedicated/capacities", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c CapacitiesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..e1b2345465c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_listbyresourcegroup_autorest.go @@ -0,0 +1,70 @@ +package capacities + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *DedicatedCapacities +} + +// ListByResourceGroup ... +func (c CapacitiesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c CapacitiesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.PowerBIDedicated/capacities", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c CapacitiesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_listskusforcapacity_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_listskusforcapacity_autorest.go similarity index 85% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_listskusforcapacity_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_listskusforcapacity_autorest.go index 766fb2362b1..bd8b6cb29bb 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_listskusforcapacity_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_listskusforcapacity_autorest.go @@ -9,13 +9,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type ListSkusForCapacityResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSkusForCapacityOperationResponse struct { HttpResponse *http.Response Model *SkuEnumerationForExistingResourceResult } // ListSkusForCapacity ... -func (c CapacitiesClient) ListSkusForCapacity(ctx context.Context, id CapacitiesId) (result ListSkusForCapacityResponse, err error) { +func (c CapacitiesClient) ListSkusForCapacity(ctx context.Context, id CapacitiesId) (result ListSkusForCapacityOperationResponse, err error) { req, err := c.preparerForListSkusForCapacity(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "ListSkusForCapacity", nil, "Failure preparing request") @@ -54,12 +57,13 @@ func (c CapacitiesClient) preparerForListSkusForCapacity(ctx context.Context, id // responderForListSkusForCapacity handles the response to the ListSkusForCapacity request. The method always // closes the http.Response Body. -func (c CapacitiesClient) responderForListSkusForCapacity(resp *http.Response) (result ListSkusForCapacityResponse, err error) { +func (c CapacitiesClient) responderForListSkusForCapacity(resp *http.Response) (result ListSkusForCapacityOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_resume_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_resume_autorest.go new file mode 100644 index 00000000000..dce005d6e89 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_resume_autorest.go @@ -0,0 +1,78 @@ +package capacities + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResumeOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Resume ... +func (c CapacitiesClient) Resume(ctx context.Context, id CapacitiesId) (result ResumeOperationResponse, err error) { + req, err := c.preparerForResume(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Resume", nil, "Failure preparing request") + return + } + + result, err = c.senderForResume(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Resume", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// ResumeThenPoll performs Resume then polls until it's completed +func (c CapacitiesClient) ResumeThenPoll(ctx context.Context, id CapacitiesId) error { + result, err := c.Resume(ctx, id) + if err != nil { + return fmt.Errorf("performing Resume: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Resume: %+v", err) + } + + return nil +} + +// preparerForResume prepares the Resume request. +func (c CapacitiesClient) preparerForResume(ctx context.Context, id CapacitiesId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/resume", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForResume sends the Resume request. The method will close the +// http.Response Body if it receives an error. +func (c CapacitiesClient) senderForResume(ctx context.Context, req *http.Request) (future ResumeOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_suspend_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_suspend_autorest.go new file mode 100644 index 00000000000..915f4e13b43 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_suspend_autorest.go @@ -0,0 +1,78 @@ +package capacities + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SuspendOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Suspend ... +func (c CapacitiesClient) Suspend(ctx context.Context, id CapacitiesId) (result SuspendOperationResponse, err error) { + req, err := c.preparerForSuspend(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Suspend", nil, "Failure preparing request") + return + } + + result, err = c.senderForSuspend(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Suspend", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// SuspendThenPoll performs Suspend then polls until it's completed +func (c CapacitiesClient) SuspendThenPoll(ctx context.Context, id CapacitiesId) error { + result, err := c.Suspend(ctx, id) + if err != nil { + return fmt.Errorf("performing Suspend: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Suspend: %+v", err) + } + + return nil +} + +// preparerForSuspend prepares the Suspend request. +func (c CapacitiesClient) preparerForSuspend(ctx context.Context, id CapacitiesId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/suspend", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForSuspend sends the Suspend request. The method will close the +// http.Response Body if it receives an error. +func (c CapacitiesClient) senderForSuspend(ctx context.Context, req *http.Request) (future SuspendOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_update_autorest.go new file mode 100644 index 00000000000..d9142dd01c7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/method_update_autorest.go @@ -0,0 +1,79 @@ +package capacities + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c CapacitiesClient) Update(ctx context.Context, id CapacitiesId, input DedicatedCapacityUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c CapacitiesClient) UpdateThenPoll(ctx context.Context, id CapacitiesId, input DedicatedCapacityUpdateParameters) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c CapacitiesClient) preparerForUpdate(ctx context.Context, id CapacitiesId, input DedicatedCapacityUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c CapacitiesClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_capacitysku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_capacitysku.go new file mode 100644 index 00000000000..7d4bca3d13f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_capacitysku.go @@ -0,0 +1,10 @@ +package capacities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacitySku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name string `json:"name"` + Tier *CapacitySkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_checkcapacitynameavailabilityparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_checkcapacitynameavailabilityparameters.go new file mode 100644 index 00000000000..2bc3273ba42 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_checkcapacitynameavailabilityparameters.go @@ -0,0 +1,9 @@ +package capacities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckCapacityNameAvailabilityParameters struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_checkcapacitynameavailabilityresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_checkcapacitynameavailabilityresult.go new file mode 100644 index 00000000000..07b5c80b471 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_checkcapacitynameavailabilityresult.go @@ -0,0 +1,10 @@ +package capacities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckCapacityNameAvailabilityResult struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *string `json:"reason,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacities.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacities.go new file mode 100644 index 00000000000..448fe2190a5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacities.go @@ -0,0 +1,8 @@ +package capacities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedCapacities struct { + Value []DedicatedCapacity `json:"value"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacity.go new file mode 100644 index 00000000000..c1c084e6216 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacity.go @@ -0,0 +1,19 @@ +package capacities + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedCapacity struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *DedicatedCapacityProperties `json:"properties,omitempty"` + Sku CapacitySku `json:"sku"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacityadministrators.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacityadministrators.go new file mode 100644 index 00000000000..fa44f30cba1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacityadministrators.go @@ -0,0 +1,8 @@ +package capacities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedCapacityAdministrators struct { + Members *[]string `json:"members,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacitymutableproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacitymutableproperties.go new file mode 100644 index 00000000000..c0b5291b9af --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacitymutableproperties.go @@ -0,0 +1,11 @@ +package capacities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedCapacityMutableProperties struct { + Administration *DedicatedCapacityAdministrators `json:"administration,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + Mode *Mode `json:"mode,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacityproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacityproperties.go new file mode 100644 index 00000000000..548d909434c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacityproperties.go @@ -0,0 +1,13 @@ +package capacities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedCapacityProperties struct { + Administration *DedicatedCapacityAdministrators `json:"administration,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + Mode *Mode `json:"mode,omitempty"` + ProvisioningState *CapacityProvisioningState `json:"provisioningState,omitempty"` + State *State `json:"state,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacityupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacityupdateparameters.go new file mode 100644 index 00000000000..210d6264b30 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_dedicatedcapacityupdateparameters.go @@ -0,0 +1,10 @@ +package capacities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedCapacityUpdateParameters struct { + Properties *DedicatedCapacityMutableProperties `json:"properties,omitempty"` + Sku *CapacitySku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_skudetailsforexistingresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_skudetailsforexistingresource.go new file mode 100644 index 00000000000..df84d86e161 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_skudetailsforexistingresource.go @@ -0,0 +1,9 @@ +package capacities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuDetailsForExistingResource struct { + ResourceType *string `json:"resourceType,omitempty"` + Sku *CapacitySku `json:"sku,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_skuenumerationforexistingresourceresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_skuenumerationforexistingresourceresult.go new file mode 100644 index 00000000000..7634d5e369f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/model_skuenumerationforexistingresourceresult.go @@ -0,0 +1,8 @@ +package capacities + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuEnumerationForExistingResourceResult struct { + Value *[]SkuDetailsForExistingResource `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/version.go new file mode 100644 index 00000000000..5983f4efb73 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities/version.go @@ -0,0 +1,12 @@ +package capacities + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/capacities/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/README.md new file mode 100644 index 00000000000..5a0ca0b97ae --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones` Documentation + +The `privatezones` SDK allows for interaction with the Azure Resource Manager Service `privatedns` (API Version `2018-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones" +``` + + +### Client Initialization + +```go +client := privatezones.NewPrivateZonesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateZonesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := privatezones.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue") + +payload := privatezones.PrivateZone{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload, privatezones.DefaultCreateOrUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateZonesClient.Delete` + +```go +ctx := context.TODO() +id := privatezones.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue") + +if err := client.DeleteThenPoll(ctx, id, privatezones.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateZonesClient.Get` + +```go +ctx := context.TODO() +id := privatezones.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateZonesClient.List` + +```go +ctx := context.TODO() +id := privatezones.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id, privatezones.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, privatezones.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `PrivateZonesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := privatezones.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id, privatezones.DefaultListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id, privatezones.DefaultListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `PrivateZonesClient.Update` + +```go +ctx := context.TODO() +id := privatezones.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue") + +payload := privatezones.PrivateZone{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload, privatezones.DefaultUpdateOperationOptions()); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/client.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/client.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/client.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/constants.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/constants.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/constants.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/id_privatednszone.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/id_privatednszone.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/id_privatednszone.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/id_privatednszone.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_createorupdate_autorest.go new file mode 100644 index 00000000000..ccd19d4a6fa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_createorupdate_autorest.go @@ -0,0 +1,113 @@ +package privatezones + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + if o.IfNoneMatch != nil { + out["If-None-Match"] = *o.IfNoneMatch + } + + return out +} + +func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// CreateOrUpdate ... +func (c PrivateZonesClient) CreateOrUpdate(ctx context.Context, id PrivateDnsZoneId, input PrivateZone, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c PrivateZonesClient) CreateOrUpdateThenPoll(ctx context.Context, id PrivateDnsZoneId, input PrivateZone, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c PrivateZonesClient) preparerForCreateOrUpdate(ctx context.Context, id PrivateDnsZoneId, input PrivateZone, options CreateOrUpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateZonesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_delete_autorest.go new file mode 100644 index 00000000000..e32f85656f2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_delete_autorest.go @@ -0,0 +1,107 @@ +package privatezones + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Delete ... +func (c PrivateZonesClient) Delete(ctx context.Context, id PrivateDnsZoneId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c PrivateZonesClient) DeleteThenPoll(ctx context.Context, id PrivateDnsZoneId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c PrivateZonesClient) preparerForDelete(ctx context.Context, id PrivateDnsZoneId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateZonesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_get_autorest.go new file mode 100644 index 00000000000..93b3395f967 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_get_autorest.go @@ -0,0 +1,68 @@ +package privatezones + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *PrivateZone +} + +// Get ... +func (c PrivateZonesClient) Get(ctx context.Context, id PrivateDnsZoneId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c PrivateZonesClient) preparerForGet(ctx context.Context, id PrivateDnsZoneId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c PrivateZonesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_list_autorest.go new file mode 100644 index 00000000000..2a05c8a2602 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_list_autorest.go @@ -0,0 +1,216 @@ +package privatezones + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]PrivateZone + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []PrivateZone +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c PrivateZonesClient) List(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c PrivateZonesClient) preparerForList(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/privateDnsZones", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c PrivateZonesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c PrivateZonesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []PrivateZone `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c PrivateZonesClient) ListComplete(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, PrivateZoneOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PrivateZonesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions, predicate PrivateZoneOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]PrivateZone, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..21d9bacd8a2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_listbyresourcegroup_autorest.go @@ -0,0 +1,216 @@ +package privatezones + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]PrivateZone + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []PrivateZone +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByResourceGroupOperationOptions struct { + Top *int64 +} + +func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { + return ListByResourceGroupOperationOptions{} +} + +func (o ListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListByResourceGroup ... +func (c PrivateZonesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c PrivateZonesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/privateDnsZones", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c PrivateZonesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c PrivateZonesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []PrivateZone `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c PrivateZonesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, PrivateZoneOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PrivateZonesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate PrivateZoneOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]PrivateZone, 0) + + page, err := c.ListByResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_update_autorest.go new file mode 100644 index 00000000000..5a2191f6a54 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/method_update_autorest.go @@ -0,0 +1,108 @@ +package privatezones + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Update ... +func (c PrivateZonesClient) Update(ctx context.Context, id PrivateDnsZoneId, input PrivateZone, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c PrivateZonesClient) UpdateThenPoll(ctx context.Context, id PrivateDnsZoneId, input PrivateZone, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c PrivateZonesClient) preparerForUpdate(ctx context.Context, id PrivateDnsZoneId, input PrivateZone, options UpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateZonesClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/model_privatezone.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/model_privatezone.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/model_privatezone.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/model_privatezone.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/model_privatezoneproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/model_privatezoneproperties.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/model_privatezoneproperties.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/model_privatezoneproperties.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/predicates.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/predicates.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/predicates.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/version.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/version.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones/version.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/README.md new file mode 100644 index 00000000000..95d148f6de8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/README.md @@ -0,0 +1,128 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets` Documentation + +The `recordsets` SDK allows for interaction with the Azure Resource Manager Service `privatedns` (API Version `2018-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" +``` + + +### Client Initialization + +```go +client := recordsets.NewRecordSetsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RecordSetsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "A", "relativeRecordSetValue") + +payload := recordsets.RecordSet{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload, recordsets.DefaultCreateOrUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RecordSetsClient.Delete` + +```go +ctx := context.TODO() +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "A", "relativeRecordSetValue") + +read, err := client.Delete(ctx, id, recordsets.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RecordSetsClient.Get` + +```go +ctx := context.TODO() +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "A", "relativeRecordSetValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RecordSetsClient.List` + +```go +ctx := context.TODO() +id := recordsets.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue") + +// alternatively `client.List(ctx, id, recordsets.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, recordsets.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RecordSetsClient.ListByType` + +```go +ctx := context.TODO() +id := recordsets.NewPrivateZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "A") + +// alternatively `client.ListByType(ctx, id, recordsets.DefaultListByTypeOperationOptions())` can be used to do batched pagination +items, err := client.ListByTypeComplete(ctx, id, recordsets.DefaultListByTypeOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RecordSetsClient.Update` + +```go +ctx := context.TODO() +id := recordsets.NewRecordTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "A", "relativeRecordSetValue") + +payload := recordsets.RecordSet{ + // ... +} + + +read, err := client.Update(ctx, id, payload, recordsets.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/client.go new file mode 100644 index 00000000000..64dcacc5984 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/client.go @@ -0,0 +1,18 @@ +package recordsets + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecordSetsClient struct { + Client autorest.Client + baseUri string +} + +func NewRecordSetsClientWithBaseURI(endpoint string) RecordSetsClient { + return RecordSetsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/constants.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/constants.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/constants.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/id_privatednszone.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_privatednszone.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/id_privatednszone.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_privatednszone.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/id_privatezone.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_privatezone.go similarity index 97% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/id_privatezone.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_privatezone.go index 2e4f51b7873..ec29176c9af 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/id_privatezone.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_privatezone.go @@ -50,8 +50,8 @@ func ParsePrivateZoneID(input string) (*PrivateZoneId, error) { return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) } - if v, constFound := parsed.Parsed["recordType"]; true { - if !constFound { + if v, ok := parsed.Parsed["recordType"]; true { + if !ok { return nil, fmt.Errorf("the segment 'recordType' was not found in the resource id %q", input) } @@ -89,8 +89,8 @@ func ParsePrivateZoneIDInsensitively(input string) (*PrivateZoneId, error) { return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) } - if v, constFound := parsed.Parsed["recordType"]; true { - if !constFound { + if v, ok := parsed.Parsed["recordType"]; true { + if !ok { return nil, fmt.Errorf("the segment 'recordType' was not found in the resource id %q", input) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_recordtype.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_recordtype.go new file mode 100644 index 00000000000..8f383503c10 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/id_recordtype.go @@ -0,0 +1,164 @@ +package recordsets + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RecordTypeId{} + +// RecordTypeId is a struct representing the Resource ID for a Record Type +type RecordTypeId struct { + SubscriptionId string + ResourceGroupName string + PrivateZoneName string + RecordType RecordType + RelativeRecordSetName string +} + +// NewRecordTypeID returns a new RecordTypeId struct +func NewRecordTypeID(subscriptionId string, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string) RecordTypeId { + return RecordTypeId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + PrivateZoneName: privateZoneName, + RecordType: recordType, + RelativeRecordSetName: relativeRecordSetName, + } +} + +// ParseRecordTypeID parses 'input' into a RecordTypeId +func ParseRecordTypeID(input string) (*RecordTypeId, error) { + parser := resourceids.NewParserFromResourceIdType(RecordTypeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RecordTypeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) + } + + if v, ok := parsed.Parsed["recordType"]; true { + if !ok { + return nil, fmt.Errorf("the segment 'recordType' was not found in the resource id %q", input) + } + + recordType, err := parseRecordType(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.RecordType = *recordType + } + + if id.RelativeRecordSetName, ok = parsed.Parsed["relativeRecordSetName"]; !ok { + return nil, fmt.Errorf("the segment 'relativeRecordSetName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRecordTypeIDInsensitively parses 'input' case-insensitively into a RecordTypeId +// note: this method should only be used for API response data and not user input +func ParseRecordTypeIDInsensitively(input string) (*RecordTypeId, error) { + parser := resourceids.NewParserFromResourceIdType(RecordTypeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RecordTypeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { + return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) + } + + if v, ok := parsed.Parsed["recordType"]; true { + if !ok { + return nil, fmt.Errorf("the segment 'recordType' was not found in the resource id %q", input) + } + + recordType, err := parseRecordType(v) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", v, err) + } + id.RecordType = *recordType + } + + if id.RelativeRecordSetName, ok = parsed.Parsed["relativeRecordSetName"]; !ok { + return nil, fmt.Errorf("the segment 'relativeRecordSetName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRecordTypeID checks that 'input' can be parsed as a Record Type ID +func ValidateRecordTypeID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRecordTypeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Record Type ID +func (id RecordTypeId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s/%s/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateZoneName, string(id.RecordType), id.RelativeRecordSetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Record Type ID +func (id RecordTypeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), + resourceids.StaticSegment("staticPrivateDnsZones", "privateDnsZones", "privateDnsZones"), + resourceids.UserSpecifiedSegment("privateZoneName", "privateZoneValue"), + resourceids.ConstantSegment("recordType", PossibleValuesForRecordType(), "A"), + resourceids.UserSpecifiedSegment("relativeRecordSetName", "relativeRecordSetValue"), + } +} + +// String returns a human-readable description of this Record Type ID +func (id RecordTypeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Private Zone Name: %q", id.PrivateZoneName), + fmt.Sprintf("Record Type: %q", string(id.RecordType)), + fmt.Sprintf("Relative Record Set Name: %q", id.RelativeRecordSetName), + } + return fmt.Sprintf("Record Type (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_createorupdate_autorest.go new file mode 100644 index 00000000000..115189971b8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_createorupdate_autorest.go @@ -0,0 +1,103 @@ +package recordsets + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *RecordSet +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + if o.IfNoneMatch != nil { + out["If-None-Match"] = *o.IfNoneMatch + } + + return out +} + +func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// CreateOrUpdate ... +func (c RecordSetsClient) CreateOrUpdate(ctx context.Context, id RecordTypeId, input RecordSet, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c RecordSetsClient) preparerForCreateOrUpdate(ctx context.Context, id RecordTypeId, input RecordSet, options CreateOrUpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c RecordSetsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_delete_autorest.go new file mode 100644 index 00000000000..705826e0a5e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_delete_autorest.go @@ -0,0 +1,95 @@ +package recordsets + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Delete ... +func (c RecordSetsClient) Delete(ctx context.Context, id RecordTypeId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c RecordSetsClient) preparerForDelete(ctx context.Context, id RecordTypeId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c RecordSetsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_get_autorest.go new file mode 100644 index 00000000000..0a853247729 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_get_autorest.go @@ -0,0 +1,68 @@ +package recordsets + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *RecordSet +} + +// Get ... +func (c RecordSetsClient) Get(ctx context.Context, id RecordTypeId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c RecordSetsClient) preparerForGet(ctx context.Context, id RecordTypeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c RecordSetsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_list_autorest.go new file mode 100644 index 00000000000..f7b2d7a0839 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_list_autorest.go @@ -0,0 +1,220 @@ +package recordsets + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]RecordSet + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []RecordSet +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Recordsetnamesuffix *string + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Recordsetnamesuffix != nil { + out["$recordsetnamesuffix"] = *o.Recordsetnamesuffix + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c RecordSetsClient) List(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c RecordSetsClient) preparerForList(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/aLL", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c RecordSetsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c RecordSetsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []RecordSet `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c RecordSetsClient) ListComplete(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, RecordSetOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RecordSetsClient) ListCompleteMatchingPredicate(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions, predicate RecordSetOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]RecordSet, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_listbytype_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_listbytype_autorest.go new file mode 100644 index 00000000000..2d8355e2f2b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_listbytype_autorest.go @@ -0,0 +1,220 @@ +package recordsets + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByTypeOperationResponse struct { + HttpResponse *http.Response + Model *[]RecordSet + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByTypeOperationResponse, error) +} + +type ListByTypeCompleteResult struct { + Items []RecordSet +} + +func (r ListByTypeOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByTypeOperationResponse) LoadMore(ctx context.Context) (resp ListByTypeOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByTypeOperationOptions struct { + Recordsetnamesuffix *string + Top *int64 +} + +func DefaultListByTypeOperationOptions() ListByTypeOperationOptions { + return ListByTypeOperationOptions{} +} + +func (o ListByTypeOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByTypeOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Recordsetnamesuffix != nil { + out["$recordsetnamesuffix"] = *o.Recordsetnamesuffix + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListByType ... +func (c RecordSetsClient) ListByType(ctx context.Context, id PrivateZoneId, options ListByTypeOperationOptions) (resp ListByTypeOperationResponse, err error) { + req, err := c.preparerForListByType(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByType(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByType prepares the ListByType request. +func (c RecordSetsClient) preparerForListByType(ctx context.Context, id PrivateZoneId, options ListByTypeOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByTypeWithNextLink prepares the ListByType request with the given nextLink token. +func (c RecordSetsClient) preparerForListByTypeWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByType handles the response to the ListByType request. The method always +// closes the http.Response Body. +func (c RecordSetsClient) responderForListByType(resp *http.Response) (result ListByTypeOperationResponse, err error) { + type page struct { + Values []RecordSet `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByTypeOperationResponse, err error) { + req, err := c.preparerForListByTypeWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByType(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByTypeComplete retrieves all of the results into a single object +func (c RecordSetsClient) ListByTypeComplete(ctx context.Context, id PrivateZoneId, options ListByTypeOperationOptions) (ListByTypeCompleteResult, error) { + return c.ListByTypeCompleteMatchingPredicate(ctx, id, options, RecordSetOperationPredicate{}) +} + +// ListByTypeCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RecordSetsClient) ListByTypeCompleteMatchingPredicate(ctx context.Context, id PrivateZoneId, options ListByTypeOperationOptions, predicate RecordSetOperationPredicate) (resp ListByTypeCompleteResult, err error) { + items := make([]RecordSet, 0) + + page, err := c.ListByType(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByTypeCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_update_autorest.go new file mode 100644 index 00000000000..2fac5ae4042 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/method_update_autorest.go @@ -0,0 +1,98 @@ +package recordsets + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *RecordSet +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Update ... +func (c RecordSetsClient) Update(ctx context.Context, id RecordTypeId, input RecordSet, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c RecordSetsClient) preparerForUpdate(ctx context.Context, id RecordTypeId, input RecordSet, options UpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c RecordSetsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_aaaarecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_aaaarecord.go new file mode 100644 index 00000000000..ab849f34d41 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_aaaarecord.go @@ -0,0 +1,8 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AaaaRecord struct { + IPv6Address *string `json:"ipv6Address,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_arecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_arecord.go new file mode 100644 index 00000000000..878b5d761d5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_arecord.go @@ -0,0 +1,8 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ARecord struct { + IPv4Address *string `json:"ipv4Address,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_cnamerecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_cnamerecord.go new file mode 100644 index 00000000000..911f2640c05 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_cnamerecord.go @@ -0,0 +1,8 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CnameRecord struct { + Cname *string `json:"cname,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_mxrecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_mxrecord.go new file mode 100644 index 00000000000..54903e902e4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_mxrecord.go @@ -0,0 +1,9 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MxRecord struct { + Exchange *string `json:"exchange,omitempty"` + Preference *int64 `json:"preference,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_ptrrecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_ptrrecord.go new file mode 100644 index 00000000000..f05e7f6dd8c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_ptrrecord.go @@ -0,0 +1,8 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PtrRecord struct { + Ptrdname *string `json:"ptrdname,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_recordset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_recordset.go new file mode 100644 index 00000000000..5b44bdb5364 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_recordset.go @@ -0,0 +1,12 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecordSet struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RecordSetProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_recordsetproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_recordsetproperties.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_recordsetproperties.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_recordsetproperties.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_soarecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_soarecord.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_soarecord.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_soarecord.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_srvrecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_srvrecord.go new file mode 100644 index 00000000000..98d79cdea1d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_srvrecord.go @@ -0,0 +1,11 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SrvRecord struct { + Port *int64 `json:"port,omitempty"` + Priority *int64 `json:"priority,omitempty"` + Target *string `json:"target,omitempty"` + Weight *int64 `json:"weight,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_txtrecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_txtrecord.go new file mode 100644 index 00000000000..a55b70eade1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/model_txtrecord.go @@ -0,0 +1,8 @@ +package recordsets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TxtRecord struct { + Value *[]string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/predicates.go new file mode 100644 index 00000000000..f4ab833e9bf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/predicates.go @@ -0,0 +1,29 @@ +package recordsets + +type RecordSetOperationPredicate struct { + Etag *string + Id *string + Name *string + Type *string +} + +func (p RecordSetOperationPredicate) Matches(input RecordSet) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/version.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/version.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets/version.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/README.md new file mode 100644 index 00000000000..951aa280f8d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks` Documentation + +The `virtualnetworklinks` SDK allows for interaction with the Azure Resource Manager Service `privatedns` (API Version `2018-09-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks" +``` + + +### Client Initialization + +```go +client := virtualnetworklinks.NewVirtualNetworkLinksClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualNetworkLinksClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualnetworklinks.NewVirtualNetworkLinkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "virtualNetworkLinkValue") + +payload := virtualnetworklinks.VirtualNetworkLink{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload, virtualnetworklinks.DefaultCreateOrUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworkLinksClient.Delete` + +```go +ctx := context.TODO() +id := virtualnetworklinks.NewVirtualNetworkLinkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "virtualNetworkLinkValue") + +if err := client.DeleteThenPoll(ctx, id, virtualnetworklinks.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworkLinksClient.Get` + +```go +ctx := context.TODO() +id := virtualnetworklinks.NewVirtualNetworkLinkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "virtualNetworkLinkValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualNetworkLinksClient.List` + +```go +ctx := context.TODO() +id := virtualnetworklinks.NewPrivateDnsZoneID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue") + +// alternatively `client.List(ctx, id, virtualnetworklinks.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, virtualnetworklinks.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualNetworkLinksClient.Update` + +```go +ctx := context.TODO() +id := virtualnetworklinks.NewVirtualNetworkLinkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateZoneValue", "virtualNetworkLinkValue") + +payload := virtualnetworklinks.VirtualNetworkLink{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload, virtualnetworklinks.DefaultUpdateOperationOptions()); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/client.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/client.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/client.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/constants.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/constants.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/constants.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/id_privatednszone.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/id_privatednszone.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/id_privatednszone.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/id_privatednszone.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/id_virtualnetworklink.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/id_virtualnetworklink.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/id_virtualnetworklink.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/id_virtualnetworklink.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/method_createorupdate_autorest.go new file mode 100644 index 00000000000..210f701364c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/method_createorupdate_autorest.go @@ -0,0 +1,113 @@ +package virtualnetworklinks + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + if o.IfNoneMatch != nil { + out["If-None-Match"] = *o.IfNoneMatch + } + + return out +} + +func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// CreateOrUpdate ... +func (c VirtualNetworkLinksClient) CreateOrUpdate(ctx context.Context, id VirtualNetworkLinkId, input VirtualNetworkLink, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VirtualNetworkLinksClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualNetworkLinkId, input VirtualNetworkLink, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c VirtualNetworkLinksClient) preparerForCreateOrUpdate(ctx context.Context, id VirtualNetworkLinkId, input VirtualNetworkLink, options CreateOrUpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualNetworkLinksClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/method_delete_autorest.go new file mode 100644 index 00000000000..52398f30a49 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/method_delete_autorest.go @@ -0,0 +1,107 @@ +package virtualnetworklinks + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + IfMatch *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Delete ... +func (c VirtualNetworkLinksClient) Delete(ctx context.Context, id VirtualNetworkLinkId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualNetworkLinksClient) DeleteThenPoll(ctx context.Context, id VirtualNetworkLinkId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c VirtualNetworkLinksClient) preparerForDelete(ctx context.Context, id VirtualNetworkLinkId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualNetworkLinksClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/method_get_autorest.go new file mode 100644 index 00000000000..f8c635914e6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/method_get_autorest.go @@ -0,0 +1,68 @@ +package virtualnetworklinks + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *VirtualNetworkLink +} + +// Get ... +func (c VirtualNetworkLinksClient) Get(ctx context.Context, id VirtualNetworkLinkId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c VirtualNetworkLinksClient) preparerForGet(ctx context.Context, id VirtualNetworkLinkId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c VirtualNetworkLinksClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/method_list_autorest.go new file mode 100644 index 00000000000..0855a9fcfc4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/method_list_autorest.go @@ -0,0 +1,215 @@ +package virtualnetworklinks + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]VirtualNetworkLink + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []VirtualNetworkLink +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListOperationOptions struct { + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c VirtualNetworkLinksClient) List(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c VirtualNetworkLinksClient) preparerForList(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/virtualNetworkLinks", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c VirtualNetworkLinksClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c VirtualNetworkLinksClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []VirtualNetworkLink `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c VirtualNetworkLinksClient) ListComplete(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, VirtualNetworkLinkOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c VirtualNetworkLinksClient) ListCompleteMatchingPredicate(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions, predicate VirtualNetworkLinkOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]VirtualNetworkLink, 0) + + page, err := c.List(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/method_update_autorest.go new file mode 100644 index 00000000000..3d911db3a67 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/method_update_autorest.go @@ -0,0 +1,108 @@ +package virtualnetworklinks + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Update ... +func (c VirtualNetworkLinksClient) Update(ctx context.Context, id VirtualNetworkLinkId, input VirtualNetworkLink, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c VirtualNetworkLinksClient) UpdateThenPoll(ctx context.Context, id VirtualNetworkLinkId, input VirtualNetworkLink, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c VirtualNetworkLinksClient) preparerForUpdate(ctx context.Context, id VirtualNetworkLinkId, input VirtualNetworkLink, options UpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c VirtualNetworkLinksClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/model_subresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/model_subresource.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/model_subresource.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/model_subresource.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/model_virtualnetworklink.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/model_virtualnetworklink.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/model_virtualnetworklink.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/model_virtualnetworklink.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/model_virtualnetworklinkproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/model_virtualnetworklinkproperties.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/model_virtualnetworklinkproperties.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/model_virtualnetworklinkproperties.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/predicates.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/predicates.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/predicates.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/version.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/version.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks/version.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/README.md new file mode 100644 index 00000000000..27b4202393c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/README.md @@ -0,0 +1,153 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account` Documentation + +The `account` SDK allows for interaction with the Azure Resource Manager Service `purview` (API Version `2021-07-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account" +``` + + +### Client Initialization + +```go +client := account.NewAccountClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AccountClient.AddRootCollectionAdmin` + +```go +ctx := context.TODO() +id := account.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := account.CollectionAdminUpdate{ + // ... +} + + +read, err := client.AddRootCollectionAdmin(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AccountClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := account.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := account.Account{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AccountClient.Delete` + +```go +ctx := context.TODO() +id := account.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AccountClient.Get` + +```go +ctx := context.TODO() +id := account.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AccountClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := account.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AccountClient.ListBySubscription` + +```go +ctx := context.TODO() +id := account.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AccountClient.ListKeys` + +```go +ctx := context.TODO() +id := account.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.ListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AccountClient.Update` + +```go +ctx := context.TODO() +id := account.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := account.AccountUpdateParameters{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/client.go new file mode 100644 index 00000000000..576c4858107 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/client.go @@ -0,0 +1,18 @@ +package account + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountClient struct { + Client autorest.Client + baseUri string +} + +func NewAccountClientWithBaseURI(endpoint string) AccountClient { + return AccountClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/constants.go new file mode 100644 index 00000000000..31078ba5c74 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/constants.go @@ -0,0 +1,148 @@ +package account + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Name string + +const ( + NameStandard Name = "Standard" +) + +func PossibleValuesForName() []string { + return []string{ + string(NameStandard), + } +} + +func parseName(input string) (*Name, error) { + vals := map[string]Name{ + "standard": NameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Name(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateSoftDeleted ProvisioningState = "SoftDeleted" + ProvisioningStateSoftDeleting ProvisioningState = "SoftDeleting" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateSoftDeleted), + string(ProvisioningStateSoftDeleting), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUnknown), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "softdeleted": ProvisioningStateSoftDeleted, + "softdeleting": ProvisioningStateSoftDeleting, + "succeeded": ProvisioningStateSucceeded, + "unknown": ProvisioningStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" + PublicNetworkAccessNotSpecified PublicNetworkAccess = "NotSpecified" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + string(PublicNetworkAccessNotSpecified), + } +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + "notspecified": PublicNetworkAccessNotSpecified, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} + +type Status string + +const ( + StatusApproved Status = "Approved" + StatusDisconnected Status = "Disconnected" + StatusPending Status = "Pending" + StatusRejected Status = "Rejected" + StatusUnknown Status = "Unknown" +) + +func PossibleValuesForStatus() []string { + return []string{ + string(StatusApproved), + string(StatusDisconnected), + string(StatusPending), + string(StatusRejected), + string(StatusUnknown), + } +} + +func parseStatus(input string) (*Status, error) { + vals := map[string]Status{ + "approved": StatusApproved, + "disconnected": StatusDisconnected, + "pending": StatusPending, + "rejected": StatusRejected, + "unknown": StatusUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Status(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/id_account.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/id_account.go new file mode 100644 index 00000000000..d16aa79a6fa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/id_account.go @@ -0,0 +1,124 @@ +package account + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AccountId{} + +// AccountId is a struct representing the Resource ID for a Account +type AccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewAccountID returns a new AccountId struct +func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { + return AccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseAccountID parses 'input' into a AccountId +func ParseAccountID(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId +// note: this method should only be used for API response data and not user input +func ParseAccountIDInsensitively(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(AccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAccountID checks that 'input' can be parsed as a Account ID +func ValidateAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Account ID +func (id AccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Purview/accounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Account ID +func (id AccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftPurview", "Microsoft.Purview", "Microsoft.Purview"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Account ID +func (id AccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_addrootcollectionadmin_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_addrootcollectionadmin_autorest.go new file mode 100644 index 00000000000..fc52fbbc201 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_addrootcollectionadmin_autorest.go @@ -0,0 +1,68 @@ +package account + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AddRootCollectionAdminOperationResponse struct { + HttpResponse *http.Response +} + +// AddRootCollectionAdmin ... +func (c AccountClient) AddRootCollectionAdmin(ctx context.Context, id AccountId, input CollectionAdminUpdate) (result AddRootCollectionAdminOperationResponse, err error) { + req, err := c.preparerForAddRootCollectionAdmin(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "AddRootCollectionAdmin", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "AddRootCollectionAdmin", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForAddRootCollectionAdmin(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "AddRootCollectionAdmin", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForAddRootCollectionAdmin prepares the AddRootCollectionAdmin request. +func (c AccountClient) preparerForAddRootCollectionAdmin(ctx context.Context, id AccountId, input CollectionAdminUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/addRootCollectionAdmin", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForAddRootCollectionAdmin handles the response to the AddRootCollectionAdmin request. The method always +// closes the http.Response Body. +func (c AccountClient) responderForAddRootCollectionAdmin(resp *http.Response) (result AddRootCollectionAdminOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_createorupdate_autorest.go new file mode 100644 index 00000000000..8bfef414e46 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package account + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c AccountClient) CreateOrUpdate(ctx context.Context, id AccountId, input Account) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c AccountClient) CreateOrUpdateThenPoll(ctx context.Context, id AccountId, input Account) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c AccountClient) preparerForCreateOrUpdate(ctx context.Context, id AccountId, input Account) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c AccountClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_delete_autorest.go new file mode 100644 index 00000000000..43aad84a7cc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_delete_autorest.go @@ -0,0 +1,78 @@ +package account + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c AccountClient) Delete(ctx context.Context, id AccountId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c AccountClient) DeleteThenPoll(ctx context.Context, id AccountId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c AccountClient) preparerForDelete(ctx context.Context, id AccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c AccountClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_get_autorest.go new file mode 100644 index 00000000000..19da9f998f3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_get_autorest.go @@ -0,0 +1,68 @@ +package account + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Account +} + +// Get ... +func (c AccountClient) Get(ctx context.Context, id AccountId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c AccountClient) preparerForGet(ctx context.Context, id AccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c AccountClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..452d03d3bab --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package account + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Account + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Account +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c AccountClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c AccountClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Purview/accounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c AccountClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c AccountClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Account `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c AccountClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, AccountOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AccountClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate AccountOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Account, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..ae32361d3b2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package account + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]Account + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []Account +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c AccountClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c AccountClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Purview/accounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c AccountClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c AccountClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []Account `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c AccountClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, AccountOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AccountClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate AccountOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]Account, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_listkeys_autorest.go new file mode 100644 index 00000000000..b0896df6cd7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_listkeys_autorest.go @@ -0,0 +1,69 @@ +package account + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeysOperationResponse struct { + HttpResponse *http.Response + Model *AccessKeys +} + +// ListKeys ... +func (c AccountClient) ListKeys(ctx context.Context, id AccountId) (result ListKeysOperationResponse, err error) { + req, err := c.preparerForListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "ListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListKeys prepares the ListKeys request. +func (c AccountClient) preparerForListKeys(ctx context.Context, id AccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listkeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListKeys handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (c AccountClient) responderForListKeys(resp *http.Response) (result ListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_update_autorest.go new file mode 100644 index 00000000000..97b0b6801dd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/method_update_autorest.go @@ -0,0 +1,79 @@ +package account + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c AccountClient) Update(ctx context.Context, id AccountId, input AccountUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "account.AccountClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c AccountClient) UpdateThenPoll(ctx context.Context, id AccountId, input AccountUpdateParameters) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c AccountClient) preparerForUpdate(ctx context.Context, id AccountId, input AccountUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c AccountClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_accesskeys.go new file mode 100644 index 00000000000..1e6f7b905cc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_accesskeys.go @@ -0,0 +1,9 @@ +package account + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeys struct { + AtlasKafkaPrimaryEndpoint *string `json:"atlasKafkaPrimaryEndpoint,omitempty"` + AtlasKafkaSecondaryEndpoint *string `json:"atlasKafkaSecondaryEndpoint,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_account.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_account.go new file mode 100644 index 00000000000..616381b799b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_account.go @@ -0,0 +1,21 @@ +package account + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Account struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemOrUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AccountProperties `json:"properties,omitempty"` + Sku *AccountSku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_accountendpoints.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_accountendpoints.go new file mode 100644 index 00000000000..f4f2166eee1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_accountendpoints.go @@ -0,0 +1,10 @@ +package account + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountEndpoints struct { + Catalog *string `json:"catalog,omitempty"` + Guardian *string `json:"guardian,omitempty"` + Scan *string `json:"scan,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_accountproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_accountproperties.go new file mode 100644 index 00000000000..c589d83c114 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_accountproperties.go @@ -0,0 +1,36 @@ +package account + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountProperties struct { + CloudConnectors *CloudConnectors `json:"cloudConnectors,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByObjectId *string `json:"createdByObjectId,omitempty"` + Endpoints *AccountEndpoints `json:"endpoints,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + ManagedResourceGroupName *string `json:"managedResourceGroupName,omitempty"` + ManagedResources *ManagedResources `json:"managedResources,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +} + +func (o *AccountProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *AccountProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_accountsku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_accountsku.go new file mode 100644 index 00000000000..1320725550d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_accountsku.go @@ -0,0 +1,9 @@ +package account + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountSku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *Name `json:"name,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_accountupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_accountupdateparameters.go new file mode 100644 index 00000000000..fdaf9dc2295 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_accountupdateparameters.go @@ -0,0 +1,14 @@ +package account + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountUpdateParameters struct { + Identity *identity.SystemOrUserAssignedMap `json:"identity,omitempty"` + Properties *AccountProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_cloudconnectors.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_cloudconnectors.go new file mode 100644 index 00000000000..1f03d914c57 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_cloudconnectors.go @@ -0,0 +1,8 @@ +package account + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudConnectors struct { + AwsExternalId *string `json:"awsExternalId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_collectionadminupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_collectionadminupdate.go new file mode 100644 index 00000000000..49cf8d770d2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_collectionadminupdate.go @@ -0,0 +1,8 @@ +package account + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CollectionAdminUpdate struct { + ObjectId *string `json:"objectId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_managedresources.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_managedresources.go new file mode 100644 index 00000000000..396178d32e8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_managedresources.go @@ -0,0 +1,10 @@ +package account + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedResources struct { + EventHubNamespace *string `json:"eventHubNamespace,omitempty"` + ResourceGroup *string `json:"resourceGroup,omitempty"` + StorageAccount *string `json:"storageAccount,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_privateendpoint.go new file mode 100644 index 00000000000..33d23dd2641 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_privateendpoint.go @@ -0,0 +1,8 @@ +package account + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_privateendpointconnection.go new file mode 100644 index 00000000000..bf62bb2d493 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package account + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..eb0f7c4e246 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package account + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_privatelinkserviceconnectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..d8b7f8ba36b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package account + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *Status `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/predicates.go new file mode 100644 index 00000000000..03af56e26c4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/predicates.go @@ -0,0 +1,29 @@ +package account + +type AccountOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p AccountOperationPredicate) Matches(input Account) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/version.go new file mode 100644 index 00000000000..e2189d2f636 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account/version.go @@ -0,0 +1,12 @@ +package account + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-07-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/account/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/README.md new file mode 100644 index 00000000000..03e30a41867 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/README.md @@ -0,0 +1,183 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases` Documentation + +The `databases` SDK allows for interaction with the Azure Resource Manager Service `redisenterprise` (API Version `2022-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases" +``` + + +### Client Initialization + +```go +client := databases.NewDatabasesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DatabasesClient.Create` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := databases.Database{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Delete` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Export` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := databases.ExportClusterParameters{ + // ... +} + + +if err := client.ExportThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.ForceUnlink` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := databases.ForceUnlinkParameters{ + // ... +} + + +if err := client.ForceUnlinkThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Get` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.Import` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := databases.ImportClusterParameters{ + // ... +} + + +if err := client.ImportThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.ListByCluster` + +```go +ctx := context.TODO() +id := databases.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +// alternatively `client.ListByCluster(ctx, id)` can be used to do batched pagination +items, err := client.ListByClusterComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DatabasesClient.ListKeys` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +read, err := client.ListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.RegenerateKey` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := databases.RegenerateKeyParameters{ + // ... +} + + +if err := client.RegenerateKeyThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Update` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := databases.DatabaseUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/client.go new file mode 100644 index 00000000000..5305d65eb6c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/client.go @@ -0,0 +1,18 @@ +package databases + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesClient struct { + Client autorest.Client + baseUri string +} + +func NewDatabasesClientWithBaseURI(endpoint string) DatabasesClient { + return DatabasesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/constants.go new file mode 100644 index 00000000000..ae1ace23890 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/constants.go @@ -0,0 +1,330 @@ +package databases + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeyType string + +const ( + AccessKeyTypePrimary AccessKeyType = "Primary" + AccessKeyTypeSecondary AccessKeyType = "Secondary" +) + +func PossibleValuesForAccessKeyType() []string { + return []string{ + string(AccessKeyTypePrimary), + string(AccessKeyTypeSecondary), + } +} + +func parseAccessKeyType(input string) (*AccessKeyType, error) { + vals := map[string]AccessKeyType{ + "primary": AccessKeyTypePrimary, + "secondary": AccessKeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessKeyType(input) + return &out, nil +} + +type AofFrequency string + +const ( + AofFrequencyAlways AofFrequency = "always" + AofFrequencyOnes AofFrequency = "1s" +) + +func PossibleValuesForAofFrequency() []string { + return []string{ + string(AofFrequencyAlways), + string(AofFrequencyOnes), + } +} + +func parseAofFrequency(input string) (*AofFrequency, error) { + vals := map[string]AofFrequency{ + "always": AofFrequencyAlways, + "1s": AofFrequencyOnes, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AofFrequency(input) + return &out, nil +} + +type ClusteringPolicy string + +const ( + ClusteringPolicyEnterpriseCluster ClusteringPolicy = "EnterpriseCluster" + ClusteringPolicyOSSCluster ClusteringPolicy = "OSSCluster" +) + +func PossibleValuesForClusteringPolicy() []string { + return []string{ + string(ClusteringPolicyEnterpriseCluster), + string(ClusteringPolicyOSSCluster), + } +} + +func parseClusteringPolicy(input string) (*ClusteringPolicy, error) { + vals := map[string]ClusteringPolicy{ + "enterprisecluster": ClusteringPolicyEnterpriseCluster, + "osscluster": ClusteringPolicyOSSCluster, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusteringPolicy(input) + return &out, nil +} + +type EvictionPolicy string + +const ( + EvictionPolicyAllKeysLFU EvictionPolicy = "AllKeysLFU" + EvictionPolicyAllKeysLRU EvictionPolicy = "AllKeysLRU" + EvictionPolicyAllKeysRandom EvictionPolicy = "AllKeysRandom" + EvictionPolicyNoEviction EvictionPolicy = "NoEviction" + EvictionPolicyVolatileLFU EvictionPolicy = "VolatileLFU" + EvictionPolicyVolatileLRU EvictionPolicy = "VolatileLRU" + EvictionPolicyVolatileRandom EvictionPolicy = "VolatileRandom" + EvictionPolicyVolatileTTL EvictionPolicy = "VolatileTTL" +) + +func PossibleValuesForEvictionPolicy() []string { + return []string{ + string(EvictionPolicyAllKeysLFU), + string(EvictionPolicyAllKeysLRU), + string(EvictionPolicyAllKeysRandom), + string(EvictionPolicyNoEviction), + string(EvictionPolicyVolatileLFU), + string(EvictionPolicyVolatileLRU), + string(EvictionPolicyVolatileRandom), + string(EvictionPolicyVolatileTTL), + } +} + +func parseEvictionPolicy(input string) (*EvictionPolicy, error) { + vals := map[string]EvictionPolicy{ + "allkeyslfu": EvictionPolicyAllKeysLFU, + "allkeyslru": EvictionPolicyAllKeysLRU, + "allkeysrandom": EvictionPolicyAllKeysRandom, + "noeviction": EvictionPolicyNoEviction, + "volatilelfu": EvictionPolicyVolatileLFU, + "volatilelru": EvictionPolicyVolatileLRU, + "volatilerandom": EvictionPolicyVolatileRandom, + "volatilettl": EvictionPolicyVolatileTTL, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EvictionPolicy(input) + return &out, nil +} + +type LinkState string + +const ( + LinkStateLinkFailed LinkState = "LinkFailed" + LinkStateLinked LinkState = "Linked" + LinkStateLinking LinkState = "Linking" + LinkStateUnlinkFailed LinkState = "UnlinkFailed" + LinkStateUnlinking LinkState = "Unlinking" +) + +func PossibleValuesForLinkState() []string { + return []string{ + string(LinkStateLinkFailed), + string(LinkStateLinked), + string(LinkStateLinking), + string(LinkStateUnlinkFailed), + string(LinkStateUnlinking), + } +} + +func parseLinkState(input string) (*LinkState, error) { + vals := map[string]LinkState{ + "linkfailed": LinkStateLinkFailed, + "linked": LinkStateLinked, + "linking": LinkStateLinking, + "unlinkfailed": LinkStateUnlinkFailed, + "unlinking": LinkStateUnlinking, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinkState(input) + return &out, nil +} + +type Protocol string + +const ( + ProtocolEncrypted Protocol = "Encrypted" + ProtocolPlaintext Protocol = "Plaintext" +) + +func PossibleValuesForProtocol() []string { + return []string{ + string(ProtocolEncrypted), + string(ProtocolPlaintext), + } +} + +func parseProtocol(input string) (*Protocol, error) { + vals := map[string]Protocol{ + "encrypted": ProtocolEncrypted, + "plaintext": ProtocolPlaintext, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Protocol(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type RdbFrequency string + +const ( + RdbFrequencyOneTwoh RdbFrequency = "12h" + RdbFrequencyOneh RdbFrequency = "1h" + RdbFrequencySixh RdbFrequency = "6h" +) + +func PossibleValuesForRdbFrequency() []string { + return []string{ + string(RdbFrequencyOneTwoh), + string(RdbFrequencyOneh), + string(RdbFrequencySixh), + } +} + +func parseRdbFrequency(input string) (*RdbFrequency, error) { + vals := map[string]RdbFrequency{ + "12h": RdbFrequencyOneTwoh, + "1h": RdbFrequencyOneh, + "6h": RdbFrequencySixh, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RdbFrequency(input) + return &out, nil +} + +type ResourceState string + +const ( + ResourceStateCreateFailed ResourceState = "CreateFailed" + ResourceStateCreating ResourceState = "Creating" + ResourceStateDeleteFailed ResourceState = "DeleteFailed" + ResourceStateDeleting ResourceState = "Deleting" + ResourceStateDisableFailed ResourceState = "DisableFailed" + ResourceStateDisabled ResourceState = "Disabled" + ResourceStateDisabling ResourceState = "Disabling" + ResourceStateEnableFailed ResourceState = "EnableFailed" + ResourceStateEnabling ResourceState = "Enabling" + ResourceStateRunning ResourceState = "Running" + ResourceStateUpdateFailed ResourceState = "UpdateFailed" + ResourceStateUpdating ResourceState = "Updating" +) + +func PossibleValuesForResourceState() []string { + return []string{ + string(ResourceStateCreateFailed), + string(ResourceStateCreating), + string(ResourceStateDeleteFailed), + string(ResourceStateDeleting), + string(ResourceStateDisableFailed), + string(ResourceStateDisabled), + string(ResourceStateDisabling), + string(ResourceStateEnableFailed), + string(ResourceStateEnabling), + string(ResourceStateRunning), + string(ResourceStateUpdateFailed), + string(ResourceStateUpdating), + } +} + +func parseResourceState(input string) (*ResourceState, error) { + vals := map[string]ResourceState{ + "createfailed": ResourceStateCreateFailed, + "creating": ResourceStateCreating, + "deletefailed": ResourceStateDeleteFailed, + "deleting": ResourceStateDeleting, + "disablefailed": ResourceStateDisableFailed, + "disabled": ResourceStateDisabled, + "disabling": ResourceStateDisabling, + "enablefailed": ResourceStateEnableFailed, + "enabling": ResourceStateEnabling, + "running": ResourceStateRunning, + "updatefailed": ResourceStateUpdateFailed, + "updating": ResourceStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/id_database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/id_database.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/id_database.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/id_database.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/id_redisenterprise.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/id_redisenterprise.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/id_redisenterprise.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/id_redisenterprise.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_create_autorest.go new file mode 100644 index 00000000000..e9edfeb945d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_create_autorest.go @@ -0,0 +1,79 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c DatabasesClient) Create(ctx context.Context, id DatabaseId, input Database) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c DatabasesClient) CreateThenPoll(ctx context.Context, id DatabaseId, input Database) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c DatabasesClient) preparerForCreate(ctx context.Context, id DatabaseId, input Database) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c DatabasesClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_delete_autorest.go new file mode 100644 index 00000000000..13221da85a6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_delete_autorest.go @@ -0,0 +1,78 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c DatabasesClient) Delete(ctx context.Context, id DatabaseId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DatabasesClient) DeleteThenPoll(ctx context.Context, id DatabaseId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c DatabasesClient) preparerForDelete(ctx context.Context, id DatabaseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c DatabasesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_export_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_export_autorest.go similarity index 83% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_export_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_export_autorest.go index 181d98d419a..86805734f95 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_export_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_export_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type ExportResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // Export ... -func (c DatabasesClient) Export(ctx context.Context, id DatabaseId, input ExportClusterParameters) (result ExportResponse, err error) { +func (c DatabasesClient) Export(ctx context.Context, id DatabaseId, input ExportClusterParameters) (result ExportOperationResponse, err error) { req, err := c.preparerForExport(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Export", nil, "Failure preparing request") @@ -64,12 +67,13 @@ func (c DatabasesClient) preparerForExport(ctx context.Context, id DatabaseId, i // senderForExport sends the Export request. The method will close the // http.Response Body if it receives an error. -func (c DatabasesClient) senderForExport(ctx context.Context, req *http.Request) (future ExportResponse, err error) { +func (c DatabasesClient) senderForExport(ctx context.Context, req *http.Request) (future ExportOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_forceunlink_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_forceunlink_autorest.go similarity index 83% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_forceunlink_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_forceunlink_autorest.go index 2d1d84bc2d5..39b957d5bf3 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_forceunlink_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_forceunlink_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type ForceUnlinkResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForceUnlinkOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // ForceUnlink ... -func (c DatabasesClient) ForceUnlink(ctx context.Context, id DatabaseId, input ForceUnlinkParameters) (result ForceUnlinkResponse, err error) { +func (c DatabasesClient) ForceUnlink(ctx context.Context, id DatabaseId, input ForceUnlinkParameters) (result ForceUnlinkOperationResponse, err error) { req, err := c.preparerForForceUnlink(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ForceUnlink", nil, "Failure preparing request") @@ -64,12 +67,13 @@ func (c DatabasesClient) preparerForForceUnlink(ctx context.Context, id Database // senderForForceUnlink sends the ForceUnlink request. The method will close the // http.Response Body if it receives an error. -func (c DatabasesClient) senderForForceUnlink(ctx context.Context, req *http.Request) (future ForceUnlinkResponse, err error) { +func (c DatabasesClient) senderForForceUnlink(ctx context.Context, req *http.Request) (future ForceUnlinkOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_get_autorest.go new file mode 100644 index 00000000000..f35d313d226 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_get_autorest.go @@ -0,0 +1,68 @@ +package databases + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Database +} + +// Get ... +func (c DatabasesClient) Get(ctx context.Context, id DatabaseId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DatabasesClient) preparerForGet(ctx context.Context, id DatabaseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DatabasesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_import_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_import_autorest.go similarity index 83% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_import_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_import_autorest.go index 9b11c5efb62..e512521e78b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_import_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_import_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type ImportResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImportOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // Import ... -func (c DatabasesClient) Import(ctx context.Context, id DatabaseId, input ImportClusterParameters) (result ImportResponse, err error) { +func (c DatabasesClient) Import(ctx context.Context, id DatabaseId, input ImportClusterParameters) (result ImportOperationResponse, err error) { req, err := c.preparerForImport(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Import", nil, "Failure preparing request") @@ -64,12 +67,13 @@ func (c DatabasesClient) preparerForImport(ctx context.Context, id DatabaseId, i // senderForImport sends the Import request. The method will close the // http.Response Body if it receives an error. -func (c DatabasesClient) senderForImport(ctx context.Context, req *http.Request) (future ImportResponse, err error) { +func (c DatabasesClient) senderForImport(ctx context.Context, req *http.Request) (future ImportOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_listbycluster_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_listbycluster_autorest.go similarity index 87% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_listbycluster_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_listbycluster_autorest.go index fccaa65c96d..9e17a1551a2 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_listbycluster_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_listbycluster_autorest.go @@ -10,23 +10,26 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type ListByClusterResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByClusterOperationResponse struct { HttpResponse *http.Response Model *[]Database nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByClusterResponse, error) + nextPageFunc func(ctx context.Context, nextLink string) (ListByClusterOperationResponse, error) } type ListByClusterCompleteResult struct { Items []Database } -func (r ListByClusterResponse) HasMore() bool { +func (r ListByClusterOperationResponse) HasMore() bool { return r.nextLink != nil } -func (r ListByClusterResponse) LoadMore(ctx context.Context) (resp ListByClusterResponse, err error) { +func (r ListByClusterOperationResponse) LoadMore(ctx context.Context) (resp ListByClusterOperationResponse, err error) { if !r.HasMore() { err = fmt.Errorf("no more pages returned") return @@ -35,7 +38,7 @@ func (r ListByClusterResponse) LoadMore(ctx context.Context) (resp ListByCluster } // ListByCluster ... -func (c DatabasesClient) ListByCluster(ctx context.Context, id RedisEnterpriseId) (resp ListByClusterResponse, err error) { +func (c DatabasesClient) ListByCluster(ctx context.Context, id RedisEnterpriseId) (resp ListByClusterOperationResponse, err error) { req, err := c.preparerForListByCluster(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByCluster", nil, "Failure preparing request") @@ -56,50 +59,6 @@ func (c DatabasesClient) ListByCluster(ctx context.Context, id RedisEnterpriseId return } -// ListByClusterComplete retrieves all of the results into a single object -func (c DatabasesClient) ListByClusterComplete(ctx context.Context, id RedisEnterpriseId) (ListByClusterCompleteResult, error) { - return c.ListByClusterCompleteMatchingPredicate(ctx, id, DatabasePredicate{}) -} - -// ListByClusterCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c DatabasesClient) ListByClusterCompleteMatchingPredicate(ctx context.Context, id RedisEnterpriseId, predicate DatabasePredicate) (resp ListByClusterCompleteResult, err error) { - items := make([]Database, 0) - - page, err := c.ListByCluster(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByClusterCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForListByCluster prepares the ListByCluster request. func (c DatabasesClient) preparerForListByCluster(ctx context.Context, id RedisEnterpriseId) (*http.Request, error) { queryParameters := map[string]interface{}{ @@ -142,7 +101,7 @@ func (c DatabasesClient) preparerForListByClusterWithNextLink(ctx context.Contex // responderForListByCluster handles the response to the ListByCluster request. The method always // closes the http.Response Body. -func (c DatabasesClient) responderForListByCluster(resp *http.Response) (result ListByClusterResponse, err error) { +func (c DatabasesClient) responderForListByCluster(resp *http.Response) (result ListByClusterOperationResponse, err error) { type page struct { Values []Database `json:"value"` NextLink *string `json:"nextLink"` @@ -157,7 +116,7 @@ func (c DatabasesClient) responderForListByCluster(resp *http.Response) (result result.Model = &respObj.Values result.nextLink = respObj.NextLink if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByClusterResponse, err error) { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByClusterOperationResponse, err error) { req, err := c.preparerForListByClusterWithNextLink(ctx, nextLink) if err != nil { err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByCluster", nil, "Failure preparing request") @@ -181,3 +140,47 @@ func (c DatabasesClient) responderForListByCluster(resp *http.Response) (result } return } + +// ListByClusterComplete retrieves all of the results into a single object +func (c DatabasesClient) ListByClusterComplete(ctx context.Context, id RedisEnterpriseId) (ListByClusterCompleteResult, error) { + return c.ListByClusterCompleteMatchingPredicate(ctx, id, DatabaseOperationPredicate{}) +} + +// ListByClusterCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DatabasesClient) ListByClusterCompleteMatchingPredicate(ctx context.Context, id RedisEnterpriseId, predicate DatabaseOperationPredicate) (resp ListByClusterCompleteResult, err error) { + items := make([]Database, 0) + + page, err := c.ListByCluster(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByClusterCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_listkeys_autorest.go new file mode 100644 index 00000000000..11d416711f9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_listkeys_autorest.go @@ -0,0 +1,69 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeysOperationResponse struct { + HttpResponse *http.Response + Model *AccessKeys +} + +// ListKeys ... +func (c DatabasesClient) ListKeys(ctx context.Context, id DatabaseId) (result ListKeysOperationResponse, err error) { + req, err := c.preparerForListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListKeys prepares the ListKeys request. +func (c DatabasesClient) preparerForListKeys(ctx context.Context, id DatabaseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListKeys handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (c DatabasesClient) responderForListKeys(resp *http.Response) (result ListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_regeneratekey_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_regeneratekey_autorest.go new file mode 100644 index 00000000000..2e7fa11c532 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_regeneratekey_autorest.go @@ -0,0 +1,79 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// RegenerateKey ... +func (c DatabasesClient) RegenerateKey(ctx context.Context, id DatabaseId, input RegenerateKeyParameters) (result RegenerateKeyOperationResponse, err error) { + req, err := c.preparerForRegenerateKey(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + result, err = c.senderForRegenerateKey(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "RegenerateKey", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// RegenerateKeyThenPoll performs RegenerateKey then polls until it's completed +func (c DatabasesClient) RegenerateKeyThenPoll(ctx context.Context, id DatabaseId, input RegenerateKeyParameters) error { + result, err := c.RegenerateKey(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RegenerateKey: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after RegenerateKey: %+v", err) + } + + return nil +} + +// preparerForRegenerateKey prepares the RegenerateKey request. +func (c DatabasesClient) preparerForRegenerateKey(ctx context.Context, id DatabaseId, input RegenerateKeyParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKey", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForRegenerateKey sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (c DatabasesClient) senderForRegenerateKey(ctx context.Context, req *http.Request) (future RegenerateKeyOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_update_autorest.go new file mode 100644 index 00000000000..fa71d982b32 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/method_update_autorest.go @@ -0,0 +1,79 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c DatabasesClient) Update(ctx context.Context, id DatabaseId, input DatabaseUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c DatabasesClient) UpdateThenPoll(ctx context.Context, id DatabaseId, input DatabaseUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c DatabasesClient) preparerForUpdate(ctx context.Context, id DatabaseId, input DatabaseUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c DatabasesClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_accesskeys.go new file mode 100644 index 00000000000..d2c730f7d54 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_accesskeys.go @@ -0,0 +1,9 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeys struct { + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_database.go new file mode 100644 index 00000000000..a9880a7432b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_database.go @@ -0,0 +1,11 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Database struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DatabaseProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_databaseproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_databaseproperties.go new file mode 100644 index 00000000000..85d805064ef --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_databaseproperties.go @@ -0,0 +1,16 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseProperties struct { + ClientProtocol *Protocol `json:"clientProtocol,omitempty"` + ClusteringPolicy *ClusteringPolicy `json:"clusteringPolicy,omitempty"` + EvictionPolicy *EvictionPolicy `json:"evictionPolicy,omitempty"` + GeoReplication *DatabasePropertiesGeoReplication `json:"geoReplication,omitempty"` + Modules *[]Module `json:"modules,omitempty"` + Persistence *Persistence `json:"persistence,omitempty"` + Port *int64 `json:"port,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + ResourceState *ResourceState `json:"resourceState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_databasepropertiesgeoreplication.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_databasepropertiesgeoreplication.go new file mode 100644 index 00000000000..1aa0445a637 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_databasepropertiesgeoreplication.go @@ -0,0 +1,9 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasePropertiesGeoReplication struct { + GroupNickname *string `json:"groupNickname,omitempty"` + LinkedDatabases *[]LinkedDatabase `json:"linkedDatabases,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_databaseupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_databaseupdate.go new file mode 100644 index 00000000000..038f991ecef --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_databaseupdate.go @@ -0,0 +1,8 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseUpdate struct { + Properties *DatabaseProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_exportclusterparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_exportclusterparameters.go new file mode 100644 index 00000000000..35c3ad5e660 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_exportclusterparameters.go @@ -0,0 +1,8 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportClusterParameters struct { + SasUri string `json:"sasUri"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_forceunlinkparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_forceunlinkparameters.go new file mode 100644 index 00000000000..f3f97fbc4bf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_forceunlinkparameters.go @@ -0,0 +1,8 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForceUnlinkParameters struct { + Ids []string `json:"ids"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_importclusterparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_importclusterparameters.go new file mode 100644 index 00000000000..fa3be54a50f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_importclusterparameters.go @@ -0,0 +1,8 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImportClusterParameters struct { + SasUris []string `json:"sasUris"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_linkeddatabase.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_linkeddatabase.go new file mode 100644 index 00000000000..215442f62da --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_linkeddatabase.go @@ -0,0 +1,9 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkedDatabase struct { + Id *string `json:"id,omitempty"` + State *LinkState `json:"state,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_module.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_module.go new file mode 100644 index 00000000000..bde6a3ad4d4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_module.go @@ -0,0 +1,10 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Module struct { + Args *string `json:"args,omitempty"` + Name string `json:"name"` + Version *string `json:"version,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_persistence.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_persistence.go new file mode 100644 index 00000000000..fd1e748a3dd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_persistence.go @@ -0,0 +1,11 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Persistence struct { + AofEnabled *bool `json:"aofEnabled,omitempty"` + AofFrequency *AofFrequency `json:"aofFrequency,omitempty"` + RdbEnabled *bool `json:"rdbEnabled,omitempty"` + RdbFrequency *RdbFrequency `json:"rdbFrequency,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_regeneratekeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_regeneratekeyparameters.go new file mode 100644 index 00000000000..fa84cc54ad5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/model_regeneratekeyparameters.go @@ -0,0 +1,8 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyParameters struct { + KeyType AccessKeyType `json:"keyType"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/predicates.go new file mode 100644 index 00000000000..e5d3f3c9c38 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/predicates.go @@ -0,0 +1,24 @@ +package databases + +type DatabaseOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DatabaseOperationPredicate) Matches(input Database) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/version.go new file mode 100644 index 00000000000..925ad65c153 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases/version.go @@ -0,0 +1,12 @@ +package databases + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/databases/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/README.md new file mode 100644 index 00000000000..0c4c8b17ca7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/README.md @@ -0,0 +1,279 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise` Documentation + +The `redisenterprise` SDK allows for interaction with the Azure Resource Manager Service `redisenterprise` (API Version `2022-01-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise" +``` + + +### Client Initialization + +```go +client := redisenterprise.NewRedisEnterpriseClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RedisEnterpriseClient.Create` + +```go +ctx := context.TODO() +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := redisenterprise.Cluster{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesCreate` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := redisenterprise.Database{ + // ... +} + + +if err := client.DatabasesCreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesDelete` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +if err := client.DatabasesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesExport` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := redisenterprise.ExportClusterParameters{ + // ... +} + + +if err := client.DatabasesExportThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesForceUnlink` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := redisenterprise.ForceUnlinkParameters{ + // ... +} + + +if err := client.DatabasesForceUnlinkThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesGet` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +read, err := client.DatabasesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesImport` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := redisenterprise.ImportClusterParameters{ + // ... +} + + +if err := client.DatabasesImportThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesListByCluster` + +```go +ctx := context.TODO() +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +// alternatively `client.DatabasesListByCluster(ctx, id)` can be used to do batched pagination +items, err := client.DatabasesListByClusterComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesListKeys` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +read, err := client.DatabasesListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesRegenerateKey` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := redisenterprise.RegenerateKeyParameters{ + // ... +} + + +if err := client.DatabasesRegenerateKeyThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesUpdate` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := redisenterprise.DatabaseUpdate{ + // ... +} + + +if err := client.DatabasesUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.Delete` + +```go +ctx := context.TODO() +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.Get` + +```go +ctx := context.TODO() +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisEnterpriseClient.List` + +```go +ctx := context.TODO() +id := redisenterprise.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RedisEnterpriseClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := redisenterprise.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RedisEnterpriseClient.Update` + +```go +ctx := context.TODO() +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := redisenterprise.ClusterUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/client.go new file mode 100644 index 00000000000..02197c7e31c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/client.go @@ -0,0 +1,18 @@ +package redisenterprise + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedisEnterpriseClient struct { + Client autorest.Client + baseUri string +} + +func NewRedisEnterpriseClientWithBaseURI(endpoint string) RedisEnterpriseClient { + return RedisEnterpriseClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/constants.go new file mode 100644 index 00000000000..89fdc8bb2ff --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/constants.go @@ -0,0 +1,469 @@ +package redisenterprise + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeyType string + +const ( + AccessKeyTypePrimary AccessKeyType = "Primary" + AccessKeyTypeSecondary AccessKeyType = "Secondary" +) + +func PossibleValuesForAccessKeyType() []string { + return []string{ + string(AccessKeyTypePrimary), + string(AccessKeyTypeSecondary), + } +} + +func parseAccessKeyType(input string) (*AccessKeyType, error) { + vals := map[string]AccessKeyType{ + "primary": AccessKeyTypePrimary, + "secondary": AccessKeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessKeyType(input) + return &out, nil +} + +type AofFrequency string + +const ( + AofFrequencyAlways AofFrequency = "always" + AofFrequencyOnes AofFrequency = "1s" +) + +func PossibleValuesForAofFrequency() []string { + return []string{ + string(AofFrequencyAlways), + string(AofFrequencyOnes), + } +} + +func parseAofFrequency(input string) (*AofFrequency, error) { + vals := map[string]AofFrequency{ + "always": AofFrequencyAlways, + "1s": AofFrequencyOnes, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AofFrequency(input) + return &out, nil +} + +type ClusteringPolicy string + +const ( + ClusteringPolicyEnterpriseCluster ClusteringPolicy = "EnterpriseCluster" + ClusteringPolicyOSSCluster ClusteringPolicy = "OSSCluster" +) + +func PossibleValuesForClusteringPolicy() []string { + return []string{ + string(ClusteringPolicyEnterpriseCluster), + string(ClusteringPolicyOSSCluster), + } +} + +func parseClusteringPolicy(input string) (*ClusteringPolicy, error) { + vals := map[string]ClusteringPolicy{ + "enterprisecluster": ClusteringPolicyEnterpriseCluster, + "osscluster": ClusteringPolicyOSSCluster, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusteringPolicy(input) + return &out, nil +} + +type EvictionPolicy string + +const ( + EvictionPolicyAllKeysLFU EvictionPolicy = "AllKeysLFU" + EvictionPolicyAllKeysLRU EvictionPolicy = "AllKeysLRU" + EvictionPolicyAllKeysRandom EvictionPolicy = "AllKeysRandom" + EvictionPolicyNoEviction EvictionPolicy = "NoEviction" + EvictionPolicyVolatileLFU EvictionPolicy = "VolatileLFU" + EvictionPolicyVolatileLRU EvictionPolicy = "VolatileLRU" + EvictionPolicyVolatileRandom EvictionPolicy = "VolatileRandom" + EvictionPolicyVolatileTTL EvictionPolicy = "VolatileTTL" +) + +func PossibleValuesForEvictionPolicy() []string { + return []string{ + string(EvictionPolicyAllKeysLFU), + string(EvictionPolicyAllKeysLRU), + string(EvictionPolicyAllKeysRandom), + string(EvictionPolicyNoEviction), + string(EvictionPolicyVolatileLFU), + string(EvictionPolicyVolatileLRU), + string(EvictionPolicyVolatileRandom), + string(EvictionPolicyVolatileTTL), + } +} + +func parseEvictionPolicy(input string) (*EvictionPolicy, error) { + vals := map[string]EvictionPolicy{ + "allkeyslfu": EvictionPolicyAllKeysLFU, + "allkeyslru": EvictionPolicyAllKeysLRU, + "allkeysrandom": EvictionPolicyAllKeysRandom, + "noeviction": EvictionPolicyNoEviction, + "volatilelfu": EvictionPolicyVolatileLFU, + "volatilelru": EvictionPolicyVolatileLRU, + "volatilerandom": EvictionPolicyVolatileRandom, + "volatilettl": EvictionPolicyVolatileTTL, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EvictionPolicy(input) + return &out, nil +} + +type LinkState string + +const ( + LinkStateLinkFailed LinkState = "LinkFailed" + LinkStateLinked LinkState = "Linked" + LinkStateLinking LinkState = "Linking" + LinkStateUnlinkFailed LinkState = "UnlinkFailed" + LinkStateUnlinking LinkState = "Unlinking" +) + +func PossibleValuesForLinkState() []string { + return []string{ + string(LinkStateLinkFailed), + string(LinkStateLinked), + string(LinkStateLinking), + string(LinkStateUnlinkFailed), + string(LinkStateUnlinking), + } +} + +func parseLinkState(input string) (*LinkState, error) { + vals := map[string]LinkState{ + "linkfailed": LinkStateLinkFailed, + "linked": LinkStateLinked, + "linking": LinkStateLinking, + "unlinkfailed": LinkStateUnlinkFailed, + "unlinking": LinkStateUnlinking, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinkState(input) + return &out, nil +} + +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + } +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { + return []string{ + string(PrivateEndpointServiceConnectionStatusApproved), + string(PrivateEndpointServiceConnectionStatusPending), + string(PrivateEndpointServiceConnectionStatusRejected), + } +} + +func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { + vals := map[string]PrivateEndpointServiceConnectionStatus{ + "approved": PrivateEndpointServiceConnectionStatusApproved, + "pending": PrivateEndpointServiceConnectionStatusPending, + "rejected": PrivateEndpointServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointServiceConnectionStatus(input) + return &out, nil +} + +type Protocol string + +const ( + ProtocolEncrypted Protocol = "Encrypted" + ProtocolPlaintext Protocol = "Plaintext" +) + +func PossibleValuesForProtocol() []string { + return []string{ + string(ProtocolEncrypted), + string(ProtocolPlaintext), + } +} + +func parseProtocol(input string) (*Protocol, error) { + vals := map[string]Protocol{ + "encrypted": ProtocolEncrypted, + "plaintext": ProtocolPlaintext, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Protocol(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type RdbFrequency string + +const ( + RdbFrequencyOneTwoh RdbFrequency = "12h" + RdbFrequencyOneh RdbFrequency = "1h" + RdbFrequencySixh RdbFrequency = "6h" +) + +func PossibleValuesForRdbFrequency() []string { + return []string{ + string(RdbFrequencyOneTwoh), + string(RdbFrequencyOneh), + string(RdbFrequencySixh), + } +} + +func parseRdbFrequency(input string) (*RdbFrequency, error) { + vals := map[string]RdbFrequency{ + "12h": RdbFrequencyOneTwoh, + "1h": RdbFrequencyOneh, + "6h": RdbFrequencySixh, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RdbFrequency(input) + return &out, nil +} + +type ResourceState string + +const ( + ResourceStateCreateFailed ResourceState = "CreateFailed" + ResourceStateCreating ResourceState = "Creating" + ResourceStateDeleteFailed ResourceState = "DeleteFailed" + ResourceStateDeleting ResourceState = "Deleting" + ResourceStateDisableFailed ResourceState = "DisableFailed" + ResourceStateDisabled ResourceState = "Disabled" + ResourceStateDisabling ResourceState = "Disabling" + ResourceStateEnableFailed ResourceState = "EnableFailed" + ResourceStateEnabling ResourceState = "Enabling" + ResourceStateRunning ResourceState = "Running" + ResourceStateUpdateFailed ResourceState = "UpdateFailed" + ResourceStateUpdating ResourceState = "Updating" +) + +func PossibleValuesForResourceState() []string { + return []string{ + string(ResourceStateCreateFailed), + string(ResourceStateCreating), + string(ResourceStateDeleteFailed), + string(ResourceStateDeleting), + string(ResourceStateDisableFailed), + string(ResourceStateDisabled), + string(ResourceStateDisabling), + string(ResourceStateEnableFailed), + string(ResourceStateEnabling), + string(ResourceStateRunning), + string(ResourceStateUpdateFailed), + string(ResourceStateUpdating), + } +} + +func parseResourceState(input string) (*ResourceState, error) { + vals := map[string]ResourceState{ + "createfailed": ResourceStateCreateFailed, + "creating": ResourceStateCreating, + "deletefailed": ResourceStateDeleteFailed, + "deleting": ResourceStateDeleting, + "disablefailed": ResourceStateDisableFailed, + "disabled": ResourceStateDisabled, + "disabling": ResourceStateDisabling, + "enablefailed": ResourceStateEnableFailed, + "enabling": ResourceStateEnabling, + "running": ResourceStateRunning, + "updatefailed": ResourceStateUpdateFailed, + "updating": ResourceStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceState(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameEnterpriseEFiveZero SkuName = "Enterprise_E50" + SkuNameEnterpriseEOneHundred SkuName = "Enterprise_E100" + SkuNameEnterpriseEOneZero SkuName = "Enterprise_E10" + SkuNameEnterpriseETwoZero SkuName = "Enterprise_E20" + SkuNameEnterpriseFlashFOneFiveHundred SkuName = "EnterpriseFlash_F1500" + SkuNameEnterpriseFlashFSevenHundred SkuName = "EnterpriseFlash_F700" + SkuNameEnterpriseFlashFThreeHundred SkuName = "EnterpriseFlash_F300" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameEnterpriseEFiveZero), + string(SkuNameEnterpriseEOneHundred), + string(SkuNameEnterpriseEOneZero), + string(SkuNameEnterpriseETwoZero), + string(SkuNameEnterpriseFlashFOneFiveHundred), + string(SkuNameEnterpriseFlashFSevenHundred), + string(SkuNameEnterpriseFlashFThreeHundred), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "enterprise_e50": SkuNameEnterpriseEFiveZero, + "enterprise_e100": SkuNameEnterpriseEOneHundred, + "enterprise_e10": SkuNameEnterpriseEOneZero, + "enterprise_e20": SkuNameEnterpriseETwoZero, + "enterpriseflash_f1500": SkuNameEnterpriseFlashFOneFiveHundred, + "enterpriseflash_f700": SkuNameEnterpriseFlashFSevenHundred, + "enterpriseflash_f300": SkuNameEnterpriseFlashFThreeHundred, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} + +type TlsVersion string + +const ( + TlsVersionOnePointOne TlsVersion = "1.1" + TlsVersionOnePointTwo TlsVersion = "1.2" + TlsVersionOnePointZero TlsVersion = "1.0" +) + +func PossibleValuesForTlsVersion() []string { + return []string{ + string(TlsVersionOnePointOne), + string(TlsVersionOnePointTwo), + string(TlsVersionOnePointZero), + } +} + +func parseTlsVersion(input string) (*TlsVersion, error) { + vals := map[string]TlsVersion{ + "1.1": TlsVersionOnePointOne, + "1.2": TlsVersionOnePointTwo, + "1.0": TlsVersionOnePointZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TlsVersion(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/id_database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_database.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/id_database.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_database.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/id_redisenterprise.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_redisenterprise.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/id_redisenterprise.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_redisenterprise.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_create_autorest.go new file mode 100644 index 00000000000..13e63cea423 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_create_autorest.go @@ -0,0 +1,79 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c RedisEnterpriseClient) Create(ctx context.Context, id RedisEnterpriseId, input Cluster) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c RedisEnterpriseClient) CreateThenPoll(ctx context.Context, id RedisEnterpriseId, input Cluster) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c RedisEnterpriseClient) preparerForCreate(ctx context.Context, id RedisEnterpriseId, input Cluster) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c RedisEnterpriseClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasescreate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasescreate_autorest.go similarity index 82% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasescreate_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasescreate_autorest.go index da21f43c918..9e25be35dd1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasescreate_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasescreate_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type DatabasesCreateResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesCreateOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // DatabasesCreate ... -func (c RedisEnterpriseClient) DatabasesCreate(ctx context.Context, id DatabaseId, input Database) (result DatabasesCreateResponse, err error) { +func (c RedisEnterpriseClient) DatabasesCreate(ctx context.Context, id DatabaseId, input Database) (result DatabasesCreateOperationResponse, err error) { req, err := c.preparerForDatabasesCreate(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "DatabasesCreate", nil, "Failure preparing request") @@ -64,12 +67,13 @@ func (c RedisEnterpriseClient) preparerForDatabasesCreate(ctx context.Context, i // senderForDatabasesCreate sends the DatabasesCreate request. The method will close the // http.Response Body if it receives an error. -func (c RedisEnterpriseClient) senderForDatabasesCreate(ctx context.Context, req *http.Request) (future DatabasesCreateResponse, err error) { +func (c RedisEnterpriseClient) senderForDatabasesCreate(ctx context.Context, req *http.Request) (future DatabasesCreateOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesdelete_autorest.go similarity index 82% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesdelete_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesdelete_autorest.go index ef8ce6deb34..27f6d03cc51 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesdelete_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesdelete_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type DatabasesDeleteResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesDeleteOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // DatabasesDelete ... -func (c RedisEnterpriseClient) DatabasesDelete(ctx context.Context, id DatabaseId) (result DatabasesDeleteResponse, err error) { +func (c RedisEnterpriseClient) DatabasesDelete(ctx context.Context, id DatabaseId) (result DatabasesDeleteOperationResponse, err error) { req, err := c.preparerForDatabasesDelete(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "DatabasesDelete", nil, "Failure preparing request") @@ -63,12 +66,13 @@ func (c RedisEnterpriseClient) preparerForDatabasesDelete(ctx context.Context, i // senderForDatabasesDelete sends the DatabasesDelete request. The method will close the // http.Response Body if it receives an error. -func (c RedisEnterpriseClient) senderForDatabasesDelete(ctx context.Context, req *http.Request) (future DatabasesDeleteResponse, err error) { +func (c RedisEnterpriseClient) senderForDatabasesDelete(ctx context.Context, req *http.Request) (future DatabasesDeleteOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesexport_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesexport_autorest.go similarity index 84% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesexport_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesexport_autorest.go index 18a15e938de..a354474337c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesexport_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesexport_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type DatabasesExportResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesExportOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // DatabasesExport ... -func (c RedisEnterpriseClient) DatabasesExport(ctx context.Context, id DatabaseId, input ExportClusterParameters) (result DatabasesExportResponse, err error) { +func (c RedisEnterpriseClient) DatabasesExport(ctx context.Context, id DatabaseId, input ExportClusterParameters) (result DatabasesExportOperationResponse, err error) { req, err := c.preparerForDatabasesExport(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "DatabasesExport", nil, "Failure preparing request") @@ -64,12 +67,13 @@ func (c RedisEnterpriseClient) preparerForDatabasesExport(ctx context.Context, i // senderForDatabasesExport sends the DatabasesExport request. The method will close the // http.Response Body if it receives an error. -func (c RedisEnterpriseClient) senderForDatabasesExport(ctx context.Context, req *http.Request) (future DatabasesExportResponse, err error) { +func (c RedisEnterpriseClient) senderForDatabasesExport(ctx context.Context, req *http.Request) (future DatabasesExportOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesforceunlink_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesforceunlink_autorest.go similarity index 86% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesforceunlink_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesforceunlink_autorest.go index dac2a5a072b..2bc1a9daa87 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesforceunlink_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesforceunlink_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type DatabasesForceUnlinkResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesForceUnlinkOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // DatabasesForceUnlink ... -func (c RedisEnterpriseClient) DatabasesForceUnlink(ctx context.Context, id DatabaseId, input ForceUnlinkParameters) (result DatabasesForceUnlinkResponse, err error) { +func (c RedisEnterpriseClient) DatabasesForceUnlink(ctx context.Context, id DatabaseId, input ForceUnlinkParameters) (result DatabasesForceUnlinkOperationResponse, err error) { req, err := c.preparerForDatabasesForceUnlink(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "DatabasesForceUnlink", nil, "Failure preparing request") @@ -64,12 +67,13 @@ func (c RedisEnterpriseClient) preparerForDatabasesForceUnlink(ctx context.Conte // senderForDatabasesForceUnlink sends the DatabasesForceUnlink request. The method will close the // http.Response Body if it receives an error. -func (c RedisEnterpriseClient) senderForDatabasesForceUnlink(ctx context.Context, req *http.Request) (future DatabasesForceUnlinkResponse, err error) { +func (c RedisEnterpriseClient) senderForDatabasesForceUnlink(ctx context.Context, req *http.Request) (future DatabasesForceUnlinkOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesget_autorest.go similarity index 85% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesget_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesget_autorest.go index 708cca55e0f..96762014431 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesget_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesget_autorest.go @@ -8,13 +8,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type DatabasesGetResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesGetOperationResponse struct { HttpResponse *http.Response Model *Database } // DatabasesGet ... -func (c RedisEnterpriseClient) DatabasesGet(ctx context.Context, id DatabaseId) (result DatabasesGetResponse, err error) { +func (c RedisEnterpriseClient) DatabasesGet(ctx context.Context, id DatabaseId) (result DatabasesGetOperationResponse, err error) { req, err := c.preparerForDatabasesGet(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "DatabasesGet", nil, "Failure preparing request") @@ -53,12 +56,13 @@ func (c RedisEnterpriseClient) preparerForDatabasesGet(ctx context.Context, id D // responderForDatabasesGet handles the response to the DatabasesGet request. The method always // closes the http.Response Body. -func (c RedisEnterpriseClient) responderForDatabasesGet(resp *http.Response) (result DatabasesGetResponse, err error) { +func (c RedisEnterpriseClient) responderForDatabasesGet(resp *http.Response) (result DatabasesGetOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesimport_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesimport_autorest.go similarity index 84% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesimport_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesimport_autorest.go index 97fd8b97bc7..14789c3422a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesimport_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesimport_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type DatabasesImportResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesImportOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // DatabasesImport ... -func (c RedisEnterpriseClient) DatabasesImport(ctx context.Context, id DatabaseId, input ImportClusterParameters) (result DatabasesImportResponse, err error) { +func (c RedisEnterpriseClient) DatabasesImport(ctx context.Context, id DatabaseId, input ImportClusterParameters) (result DatabasesImportOperationResponse, err error) { req, err := c.preparerForDatabasesImport(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "DatabasesImport", nil, "Failure preparing request") @@ -64,12 +67,13 @@ func (c RedisEnterpriseClient) preparerForDatabasesImport(ctx context.Context, i // senderForDatabasesImport sends the DatabasesImport request. The method will close the // http.Response Body if it receives an error. -func (c RedisEnterpriseClient) senderForDatabasesImport(ctx context.Context, req *http.Request) (future DatabasesImportResponse, err error) { +func (c RedisEnterpriseClient) senderForDatabasesImport(ctx context.Context, req *http.Request) (future DatabasesImportOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databaseslistbycluster_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databaseslistbycluster_autorest.go similarity index 87% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databaseslistbycluster_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databaseslistbycluster_autorest.go index 20a1198b8dd..65ff784e56b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databaseslistbycluster_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databaseslistbycluster_autorest.go @@ -10,23 +10,26 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type DatabasesListByClusterResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesListByClusterOperationResponse struct { HttpResponse *http.Response Model *[]Database nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (DatabasesListByClusterResponse, error) + nextPageFunc func(ctx context.Context, nextLink string) (DatabasesListByClusterOperationResponse, error) } type DatabasesListByClusterCompleteResult struct { Items []Database } -func (r DatabasesListByClusterResponse) HasMore() bool { +func (r DatabasesListByClusterOperationResponse) HasMore() bool { return r.nextLink != nil } -func (r DatabasesListByClusterResponse) LoadMore(ctx context.Context) (resp DatabasesListByClusterResponse, err error) { +func (r DatabasesListByClusterOperationResponse) LoadMore(ctx context.Context) (resp DatabasesListByClusterOperationResponse, err error) { if !r.HasMore() { err = fmt.Errorf("no more pages returned") return @@ -35,7 +38,7 @@ func (r DatabasesListByClusterResponse) LoadMore(ctx context.Context) (resp Data } // DatabasesListByCluster ... -func (c RedisEnterpriseClient) DatabasesListByCluster(ctx context.Context, id RedisEnterpriseId) (resp DatabasesListByClusterResponse, err error) { +func (c RedisEnterpriseClient) DatabasesListByCluster(ctx context.Context, id RedisEnterpriseId) (resp DatabasesListByClusterOperationResponse, err error) { req, err := c.preparerForDatabasesListByCluster(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "DatabasesListByCluster", nil, "Failure preparing request") @@ -56,50 +59,6 @@ func (c RedisEnterpriseClient) DatabasesListByCluster(ctx context.Context, id Re return } -// DatabasesListByClusterComplete retrieves all of the results into a single object -func (c RedisEnterpriseClient) DatabasesListByClusterComplete(ctx context.Context, id RedisEnterpriseId) (DatabasesListByClusterCompleteResult, error) { - return c.DatabasesListByClusterCompleteMatchingPredicate(ctx, id, DatabasePredicate{}) -} - -// DatabasesListByClusterCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c RedisEnterpriseClient) DatabasesListByClusterCompleteMatchingPredicate(ctx context.Context, id RedisEnterpriseId, predicate DatabasePredicate) (resp DatabasesListByClusterCompleteResult, err error) { - items := make([]Database, 0) - - page, err := c.DatabasesListByCluster(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := DatabasesListByClusterCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForDatabasesListByCluster prepares the DatabasesListByCluster request. func (c RedisEnterpriseClient) preparerForDatabasesListByCluster(ctx context.Context, id RedisEnterpriseId) (*http.Request, error) { queryParameters := map[string]interface{}{ @@ -142,7 +101,7 @@ func (c RedisEnterpriseClient) preparerForDatabasesListByClusterWithNextLink(ctx // responderForDatabasesListByCluster handles the response to the DatabasesListByCluster request. The method always // closes the http.Response Body. -func (c RedisEnterpriseClient) responderForDatabasesListByCluster(resp *http.Response) (result DatabasesListByClusterResponse, err error) { +func (c RedisEnterpriseClient) responderForDatabasesListByCluster(resp *http.Response) (result DatabasesListByClusterOperationResponse, err error) { type page struct { Values []Database `json:"value"` NextLink *string `json:"nextLink"` @@ -157,7 +116,7 @@ func (c RedisEnterpriseClient) responderForDatabasesListByCluster(resp *http.Res result.Model = &respObj.Values result.nextLink = respObj.NextLink if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result DatabasesListByClusterResponse, err error) { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result DatabasesListByClusterOperationResponse, err error) { req, err := c.preparerForDatabasesListByClusterWithNextLink(ctx, nextLink) if err != nil { err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "DatabasesListByCluster", nil, "Failure preparing request") @@ -181,3 +140,47 @@ func (c RedisEnterpriseClient) responderForDatabasesListByCluster(resp *http.Res } return } + +// DatabasesListByClusterComplete retrieves all of the results into a single object +func (c RedisEnterpriseClient) DatabasesListByClusterComplete(ctx context.Context, id RedisEnterpriseId) (DatabasesListByClusterCompleteResult, error) { + return c.DatabasesListByClusterCompleteMatchingPredicate(ctx, id, DatabaseOperationPredicate{}) +} + +// DatabasesListByClusterCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RedisEnterpriseClient) DatabasesListByClusterCompleteMatchingPredicate(ctx context.Context, id RedisEnterpriseId, predicate DatabaseOperationPredicate) (resp DatabasesListByClusterCompleteResult, err error) { + items := make([]Database, 0) + + page, err := c.DatabasesListByCluster(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := DatabasesListByClusterCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databaseslistkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databaseslistkeys_autorest.go similarity index 85% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databaseslistkeys_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databaseslistkeys_autorest.go index 0d6ba1e7b2f..7fcf48684b2 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databaseslistkeys_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databaseslistkeys_autorest.go @@ -9,13 +9,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type DatabasesListKeysResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesListKeysOperationResponse struct { HttpResponse *http.Response Model *AccessKeys } // DatabasesListKeys ... -func (c RedisEnterpriseClient) DatabasesListKeys(ctx context.Context, id DatabaseId) (result DatabasesListKeysResponse, err error) { +func (c RedisEnterpriseClient) DatabasesListKeys(ctx context.Context, id DatabaseId) (result DatabasesListKeysOperationResponse, err error) { req, err := c.preparerForDatabasesListKeys(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "DatabasesListKeys", nil, "Failure preparing request") @@ -54,12 +57,13 @@ func (c RedisEnterpriseClient) preparerForDatabasesListKeys(ctx context.Context, // responderForDatabasesListKeys handles the response to the DatabasesListKeys request. The method always // closes the http.Response Body. -func (c RedisEnterpriseClient) responderForDatabasesListKeys(resp *http.Response) (result DatabasesListKeysResponse, err error) { +func (c RedisEnterpriseClient) responderForDatabasesListKeys(resp *http.Response) (result DatabasesListKeysOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesregeneratekey_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesregeneratekey_autorest.go similarity index 86% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesregeneratekey_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesregeneratekey_autorest.go index 312b8ca2d12..288c6ecda34 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesregeneratekey_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesregeneratekey_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type DatabasesRegenerateKeyResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesRegenerateKeyOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // DatabasesRegenerateKey ... -func (c RedisEnterpriseClient) DatabasesRegenerateKey(ctx context.Context, id DatabaseId, input RegenerateKeyParameters) (result DatabasesRegenerateKeyResponse, err error) { +func (c RedisEnterpriseClient) DatabasesRegenerateKey(ctx context.Context, id DatabaseId, input RegenerateKeyParameters) (result DatabasesRegenerateKeyOperationResponse, err error) { req, err := c.preparerForDatabasesRegenerateKey(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "DatabasesRegenerateKey", nil, "Failure preparing request") @@ -64,12 +67,13 @@ func (c RedisEnterpriseClient) preparerForDatabasesRegenerateKey(ctx context.Con // senderForDatabasesRegenerateKey sends the DatabasesRegenerateKey request. The method will close the // http.Response Body if it receives an error. -func (c RedisEnterpriseClient) senderForDatabasesRegenerateKey(ctx context.Context, req *http.Request) (future DatabasesRegenerateKeyResponse, err error) { +func (c RedisEnterpriseClient) senderForDatabasesRegenerateKey(ctx context.Context, req *http.Request) (future DatabasesRegenerateKeyOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesupdate_autorest.go similarity index 85% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesupdate_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesupdate_autorest.go index 7de76bb70b8..36549fef900 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_databasesupdate_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_databasesupdate_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type DatabasesUpdateResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesUpdateOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // DatabasesUpdate ... -func (c RedisEnterpriseClient) DatabasesUpdate(ctx context.Context, id DatabaseId, input DatabaseUpdate) (result DatabasesUpdateResponse, err error) { +func (c RedisEnterpriseClient) DatabasesUpdate(ctx context.Context, id DatabaseId, input DatabaseUpdate) (result DatabasesUpdateOperationResponse, err error) { req, err := c.preparerForDatabasesUpdate(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "DatabasesUpdate", nil, "Failure preparing request") @@ -64,12 +67,13 @@ func (c RedisEnterpriseClient) preparerForDatabasesUpdate(ctx context.Context, i // senderForDatabasesUpdate sends the DatabasesUpdate request. The method will close the // http.Response Body if it receives an error. -func (c RedisEnterpriseClient) senderForDatabasesUpdate(ctx context.Context, req *http.Request) (future DatabasesUpdateResponse, err error) { +func (c RedisEnterpriseClient) senderForDatabasesUpdate(ctx context.Context, req *http.Request) (future DatabasesUpdateOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_delete_autorest.go new file mode 100644 index 00000000000..c4e10ec0530 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_delete_autorest.go @@ -0,0 +1,78 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c RedisEnterpriseClient) Delete(ctx context.Context, id RedisEnterpriseId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c RedisEnterpriseClient) DeleteThenPoll(ctx context.Context, id RedisEnterpriseId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c RedisEnterpriseClient) preparerForDelete(ctx context.Context, id RedisEnterpriseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c RedisEnterpriseClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_get_autorest.go new file mode 100644 index 00000000000..f3bd33b95c8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_get_autorest.go @@ -0,0 +1,68 @@ +package redisenterprise + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Cluster +} + +// Get ... +func (c RedisEnterpriseClient) Get(ctx context.Context, id RedisEnterpriseId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c RedisEnterpriseClient) preparerForGet(ctx context.Context, id RedisEnterpriseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c RedisEnterpriseClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_list_autorest.go new file mode 100644 index 00000000000..daade762428 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_list_autorest.go @@ -0,0 +1,187 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Cluster + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Cluster +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c RedisEnterpriseClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c RedisEnterpriseClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Cache/redisEnterprise", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c RedisEnterpriseClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c RedisEnterpriseClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Cluster `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c RedisEnterpriseClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ClusterOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RedisEnterpriseClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ClusterOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Cluster, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..2240557de0b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]Cluster + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []Cluster +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c RedisEnterpriseClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c RedisEnterpriseClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Cache/redisEnterprise", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c RedisEnterpriseClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c RedisEnterpriseClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []Cluster `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c RedisEnterpriseClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ClusterOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RedisEnterpriseClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ClusterOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]Cluster, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_update_autorest.go new file mode 100644 index 00000000000..b5ee5a889a9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/method_update_autorest.go @@ -0,0 +1,79 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c RedisEnterpriseClient) Update(ctx context.Context, id RedisEnterpriseId, input ClusterUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c RedisEnterpriseClient) UpdateThenPoll(ctx context.Context, id RedisEnterpriseId, input ClusterUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c RedisEnterpriseClient) preparerForUpdate(ctx context.Context, id RedisEnterpriseId, input ClusterUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c RedisEnterpriseClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_accesskeys.go new file mode 100644 index 00000000000..79566de711f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_accesskeys.go @@ -0,0 +1,9 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeys struct { + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_cluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_cluster.go new file mode 100644 index 00000000000..f451a888057 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_cluster.go @@ -0,0 +1,15 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Cluster struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ClusterProperties `json:"properties,omitempty"` + Sku Sku `json:"sku"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *[]string `json:"zones,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_clusterproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_clusterproperties.go new file mode 100644 index 00000000000..fdb6cd9df57 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_clusterproperties.go @@ -0,0 +1,13 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterProperties struct { + HostName *string `json:"hostName,omitempty"` + MinimumTlsVersion *TlsVersion `json:"minimumTlsVersion,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RedisVersion *string `json:"redisVersion,omitempty"` + ResourceState *ResourceState `json:"resourceState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_clusterupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_clusterupdate.go new file mode 100644 index 00000000000..264d7e437f2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_clusterupdate.go @@ -0,0 +1,10 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterUpdate struct { + Properties *ClusterProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_database.go new file mode 100644 index 00000000000..dd20d0b355a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_database.go @@ -0,0 +1,11 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Database struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DatabaseProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_databaseproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_databaseproperties.go new file mode 100644 index 00000000000..c8ca12b1385 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_databaseproperties.go @@ -0,0 +1,16 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseProperties struct { + ClientProtocol *Protocol `json:"clientProtocol,omitempty"` + ClusteringPolicy *ClusteringPolicy `json:"clusteringPolicy,omitempty"` + EvictionPolicy *EvictionPolicy `json:"evictionPolicy,omitempty"` + GeoReplication *DatabasePropertiesGeoReplication `json:"geoReplication,omitempty"` + Modules *[]Module `json:"modules,omitempty"` + Persistence *Persistence `json:"persistence,omitempty"` + Port *int64 `json:"port,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + ResourceState *ResourceState `json:"resourceState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_databasepropertiesgeoreplication.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_databasepropertiesgeoreplication.go new file mode 100644 index 00000000000..3244185bf85 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_databasepropertiesgeoreplication.go @@ -0,0 +1,9 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasePropertiesGeoReplication struct { + GroupNickname *string `json:"groupNickname,omitempty"` + LinkedDatabases *[]LinkedDatabase `json:"linkedDatabases,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_databaseupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_databaseupdate.go new file mode 100644 index 00000000000..aff0488e608 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_databaseupdate.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseUpdate struct { + Properties *DatabaseProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_exportclusterparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_exportclusterparameters.go new file mode 100644 index 00000000000..d6ba54aa230 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_exportclusterparameters.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportClusterParameters struct { + SasUri string `json:"sasUri"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_forceunlinkparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_forceunlinkparameters.go new file mode 100644 index 00000000000..7bf82a13709 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_forceunlinkparameters.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForceUnlinkParameters struct { + Ids []string `json:"ids"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_importclusterparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_importclusterparameters.go new file mode 100644 index 00000000000..11e13cd4dc4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_importclusterparameters.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImportClusterParameters struct { + SasUris []string `json:"sasUris"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_linkeddatabase.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_linkeddatabase.go new file mode 100644 index 00000000000..02abc0422ce --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_linkeddatabase.go @@ -0,0 +1,9 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkedDatabase struct { + Id *string `json:"id,omitempty"` + State *LinkState `json:"state,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_module.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_module.go new file mode 100644 index 00000000000..99bd8473a0f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_module.go @@ -0,0 +1,10 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Module struct { + Args *string `json:"args,omitempty"` + Name string `json:"name"` + Version *string `json:"version,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_persistence.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_persistence.go new file mode 100644 index 00000000000..3b7b30f2fb9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_persistence.go @@ -0,0 +1,11 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Persistence struct { + AofEnabled *bool `json:"aofEnabled,omitempty"` + AofFrequency *AofFrequency `json:"aofFrequency,omitempty"` + RdbEnabled *bool `json:"rdbEnabled,omitempty"` + RdbFrequency *RdbFrequency `json:"rdbFrequency,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_privateendpoint.go new file mode 100644 index 00000000000..e15699fe1d1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_privateendpoint.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_privateendpointconnection.go new file mode 100644 index 00000000000..5da2f77534d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..9ebfbe2d3c2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_privatelinkserviceconnectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..abb658aee84 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_regeneratekeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_regeneratekeyparameters.go new file mode 100644 index 00000000000..2d44026dd91 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_regeneratekeyparameters.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyParameters struct { + KeyType AccessKeyType `json:"keyType"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_sku.go new file mode 100644 index 00000000000..740c3615e0c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/model_sku.go @@ -0,0 +1,9 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name SkuName `json:"name"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/predicates.go new file mode 100644 index 00000000000..b40e6054b78 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/predicates.go @@ -0,0 +1,52 @@ +package redisenterprise + +type ClusterOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ClusterOperationPredicate) Matches(input Cluster) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type DatabaseOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DatabaseOperationPredicate) Matches(input Database) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/version.go new file mode 100644 index 00000000000..60498332607 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise/version.go @@ -0,0 +1,12 @@ +package redisenterprise + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-01-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/redisenterprise/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/README.md new file mode 100644 index 00000000000..69642329ad2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/README.md @@ -0,0 +1,197 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections` Documentation + +The `hybridconnections` SDK allows for interaction with the Azure Resource Manager Service `relay` (API Version `2017-04-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections" +``` + + +### Client Initialization + +```go +client := hybridconnections.NewHybridConnectionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `HybridConnectionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := hybridconnections.NewHybridConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "hybridConnectionValue") + +payload := hybridconnections.HybridConnection{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `HybridConnectionsClient.CreateOrUpdateAuthorizationRule` + +```go +ctx := context.TODO() +id := hybridconnections.NewHybridConnectionAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "hybridConnectionValue", "authorizationRuleValue") + +payload := hybridconnections.AuthorizationRule{ + // ... +} + + +read, err := client.CreateOrUpdateAuthorizationRule(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `HybridConnectionsClient.Delete` + +```go +ctx := context.TODO() +id := hybridconnections.NewHybridConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "hybridConnectionValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `HybridConnectionsClient.DeleteAuthorizationRule` + +```go +ctx := context.TODO() +id := hybridconnections.NewHybridConnectionAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "hybridConnectionValue", "authorizationRuleValue") + +read, err := client.DeleteAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `HybridConnectionsClient.Get` + +```go +ctx := context.TODO() +id := hybridconnections.NewHybridConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "hybridConnectionValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `HybridConnectionsClient.GetAuthorizationRule` + +```go +ctx := context.TODO() +id := hybridconnections.NewHybridConnectionAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "hybridConnectionValue", "authorizationRuleValue") + +read, err := client.GetAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `HybridConnectionsClient.ListAuthorizationRules` + +```go +ctx := context.TODO() +id := hybridconnections.NewHybridConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "hybridConnectionValue") + +// alternatively `client.ListAuthorizationRules(ctx, id)` can be used to do batched pagination +items, err := client.ListAuthorizationRulesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `HybridConnectionsClient.ListByNamespace` + +```go +ctx := context.TODO() +id := hybridconnections.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +// alternatively `client.ListByNamespace(ctx, id)` can be used to do batched pagination +items, err := client.ListByNamespaceComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `HybridConnectionsClient.ListKeys` + +```go +ctx := context.TODO() +id := hybridconnections.NewHybridConnectionAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "hybridConnectionValue", "authorizationRuleValue") + +read, err := client.ListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `HybridConnectionsClient.RegenerateKeys` + +```go +ctx := context.TODO() +id := hybridconnections.NewHybridConnectionAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "hybridConnectionValue", "authorizationRuleValue") + +payload := hybridconnections.RegenerateAccessKeyParameters{ + // ... +} + + +read, err := client.RegenerateKeys(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/client.go new file mode 100644 index 00000000000..b2529360ef3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/client.go @@ -0,0 +1,18 @@ +package hybridconnections + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HybridConnectionsClient struct { + Client autorest.Client + baseUri string +} + +func NewHybridConnectionsClientWithBaseURI(endpoint string) HybridConnectionsClient { + return HybridConnectionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/constants.go new file mode 100644 index 00000000000..356096a5c0c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/constants.go @@ -0,0 +1,65 @@ +package hybridconnections + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessRights string + +const ( + AccessRightsListen AccessRights = "Listen" + AccessRightsManage AccessRights = "Manage" + AccessRightsSend AccessRights = "Send" +) + +func PossibleValuesForAccessRights() []string { + return []string{ + string(AccessRightsListen), + string(AccessRightsManage), + string(AccessRightsSend), + } +} + +func parseAccessRights(input string) (*AccessRights, error) { + vals := map[string]AccessRights{ + "listen": AccessRightsListen, + "manage": AccessRightsManage, + "send": AccessRightsSend, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessRights(input) + return &out, nil +} + +type KeyType string + +const ( + KeyTypePrimaryKey KeyType = "PrimaryKey" + KeyTypeSecondaryKey KeyType = "SecondaryKey" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypePrimaryKey), + string(KeyTypeSecondaryKey), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "primarykey": KeyTypePrimaryKey, + "secondarykey": KeyTypeSecondaryKey, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/id_hybridconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/id_hybridconnection.go similarity index 90% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/id_hybridconnection.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/id_hybridconnection.go index 38233f8f7b7..6c514812593 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/id_hybridconnection.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/id_hybridconnection.go @@ -112,15 +112,15 @@ func (id HybridConnectionId) ID() string { // Segments returns a slice of Resource ID Segments which comprise this Hybrid Connection ID func (id HybridConnectionId) Segments() []resourceids.Segment { return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftRelay", "Microsoft.Relay", "Microsoft.Relay"), - resourceids.StaticSegment("namespaces", "namespaces", "namespaces"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftRelay", "Microsoft.Relay", "Microsoft.Relay"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), - resourceids.StaticSegment("hybridConnections", "hybridConnections", "hybridConnections"), + resourceids.StaticSegment("staticHybridConnections", "hybridConnections", "hybridConnections"), resourceids.UserSpecifiedSegment("hybridConnectionName", "hybridConnectionValue"), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/id_hybridconnectionauthorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/id_hybridconnectionauthorizationrule.go similarity index 90% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/id_hybridconnectionauthorizationrule.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/id_hybridconnectionauthorizationrule.go index 857c0c60078..7dfc111d88a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/id_hybridconnectionauthorizationrule.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/id_hybridconnectionauthorizationrule.go @@ -122,17 +122,17 @@ func (id HybridConnectionAuthorizationRuleId) ID() string { // Segments returns a slice of Resource ID Segments which comprise this Hybrid Connection Authorization Rule ID func (id HybridConnectionAuthorizationRuleId) Segments() []resourceids.Segment { return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftRelay", "Microsoft.Relay", "Microsoft.Relay"), - resourceids.StaticSegment("namespaces", "namespaces", "namespaces"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftRelay", "Microsoft.Relay", "Microsoft.Relay"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), - resourceids.StaticSegment("hybridConnections", "hybridConnections", "hybridConnections"), + resourceids.StaticSegment("staticHybridConnections", "hybridConnections", "hybridConnections"), resourceids.UserSpecifiedSegment("hybridConnectionName", "hybridConnectionValue"), - resourceids.StaticSegment("authorizationRules", "authorizationRules", "authorizationRules"), + resourceids.StaticSegment("staticAuthorizationRules", "authorizationRules", "authorizationRules"), resourceids.UserSpecifiedSegment("authorizationRuleName", "authorizationRuleValue"), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/id_namespace.go new file mode 100644 index 00000000000..d4168ee8b8e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/id_namespace.go @@ -0,0 +1,124 @@ +package hybridconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NamespaceId{} + +// NamespaceId is a struct representing the Resource ID for a Namespace +type NamespaceId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string +} + +// NewNamespaceID returns a new NamespaceId struct +func NewNamespaceID(subscriptionId string, resourceGroupName string, namespaceName string) NamespaceId { + return NamespaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + } +} + +// ParseNamespaceID parses 'input' into a NamespaceId +func ParseNamespaceID(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNamespaceIDInsensitively parses 'input' case-insensitively into a NamespaceId +// note: this method should only be used for API response data and not user input +func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID +func ValidateNamespaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNamespaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Namespace ID +func (id NamespaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Relay/namespaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Namespace ID +func (id NamespaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftRelay", "Microsoft.Relay", "Microsoft.Relay"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + } +} + +// String returns a human-readable description of this Namespace ID +func (id NamespaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + } + return fmt.Sprintf("Namespace (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_createorupdate_autorest.go new file mode 100644 index 00000000000..dfe8081b9f0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package hybridconnections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *HybridConnection +} + +// CreateOrUpdate ... +func (c HybridConnectionsClient) CreateOrUpdate(ctx context.Context, id HybridConnectionId, input HybridConnection) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c HybridConnectionsClient) preparerForCreateOrUpdate(ctx context.Context, id HybridConnectionId, input HybridConnection) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c HybridConnectionsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_createorupdateauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_createorupdateauthorizationrule_autorest.go new file mode 100644 index 00000000000..2eacea331e4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_createorupdateauthorizationrule_autorest.go @@ -0,0 +1,69 @@ +package hybridconnections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *AuthorizationRule +} + +// CreateOrUpdateAuthorizationRule ... +func (c HybridConnectionsClient) CreateOrUpdateAuthorizationRule(ctx context.Context, id HybridConnectionAuthorizationRuleId, input AuthorizationRule) (result CreateOrUpdateAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdateAuthorizationRule(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "CreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdateAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "CreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdateAuthorizationRule prepares the CreateOrUpdateAuthorizationRule request. +func (c HybridConnectionsClient) preparerForCreateOrUpdateAuthorizationRule(ctx context.Context, id HybridConnectionAuthorizationRuleId, input AuthorizationRule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdateAuthorizationRule handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (c HybridConnectionsClient) responderForCreateOrUpdateAuthorizationRule(resp *http.Response) (result CreateOrUpdateAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_delete_autorest.go new file mode 100644 index 00000000000..fed5efbc8c2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_delete_autorest.go @@ -0,0 +1,66 @@ +package hybridconnections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c HybridConnectionsClient) Delete(ctx context.Context, id HybridConnectionId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c HybridConnectionsClient) preparerForDelete(ctx context.Context, id HybridConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c HybridConnectionsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_deleteauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_deleteauthorizationrule_autorest.go new file mode 100644 index 00000000000..d68bada1bd9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_deleteauthorizationrule_autorest.go @@ -0,0 +1,66 @@ +package hybridconnections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response +} + +// DeleteAuthorizationRule ... +func (c HybridConnectionsClient) DeleteAuthorizationRule(ctx context.Context, id HybridConnectionAuthorizationRuleId) (result DeleteAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForDeleteAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDeleteAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDeleteAuthorizationRule prepares the DeleteAuthorizationRule request. +func (c HybridConnectionsClient) preparerForDeleteAuthorizationRule(ctx context.Context, id HybridConnectionAuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDeleteAuthorizationRule handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (c HybridConnectionsClient) responderForDeleteAuthorizationRule(resp *http.Response) (result DeleteAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_get_autorest.go new file mode 100644 index 00000000000..e74e23ef7e3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_get_autorest.go @@ -0,0 +1,68 @@ +package hybridconnections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *HybridConnection +} + +// Get ... +func (c HybridConnectionsClient) Get(ctx context.Context, id HybridConnectionId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c HybridConnectionsClient) preparerForGet(ctx context.Context, id HybridConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c HybridConnectionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_getauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_getauthorizationrule_autorest.go new file mode 100644 index 00000000000..66dfe02f779 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_getauthorizationrule_autorest.go @@ -0,0 +1,68 @@ +package hybridconnections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *AuthorizationRule +} + +// GetAuthorizationRule ... +func (c HybridConnectionsClient) GetAuthorizationRule(ctx context.Context, id HybridConnectionAuthorizationRuleId) (result GetAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForGetAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "GetAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "GetAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetAuthorizationRule prepares the GetAuthorizationRule request. +func (c HybridConnectionsClient) preparerForGetAuthorizationRule(ctx context.Context, id HybridConnectionAuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetAuthorizationRule handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (c HybridConnectionsClient) responderForGetAuthorizationRule(resp *http.Response) (result GetAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_listauthorizationrules_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_listauthorizationrules_autorest.go new file mode 100644 index 00000000000..23c40087266 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_listauthorizationrules_autorest.go @@ -0,0 +1,186 @@ +package hybridconnections + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAuthorizationRulesOperationResponse struct { + HttpResponse *http.Response + Model *[]AuthorizationRule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListAuthorizationRulesOperationResponse, error) +} + +type ListAuthorizationRulesCompleteResult struct { + Items []AuthorizationRule +} + +func (r ListAuthorizationRulesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListAuthorizationRulesOperationResponse) LoadMore(ctx context.Context) (resp ListAuthorizationRulesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListAuthorizationRules ... +func (c HybridConnectionsClient) ListAuthorizationRules(ctx context.Context, id HybridConnectionId) (resp ListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForListAuthorizationRules(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListAuthorizationRules", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListAuthorizationRules(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListAuthorizationRules", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListAuthorizationRules prepares the ListAuthorizationRules request. +func (c HybridConnectionsClient) preparerForListAuthorizationRules(ctx context.Context, id HybridConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/authorizationRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListAuthorizationRulesWithNextLink prepares the ListAuthorizationRules request with the given nextLink token. +func (c HybridConnectionsClient) preparerForListAuthorizationRulesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListAuthorizationRules handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (c HybridConnectionsClient) responderForListAuthorizationRules(resp *http.Response) (result ListAuthorizationRulesOperationResponse, err error) { + type page struct { + Values []AuthorizationRule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForListAuthorizationRulesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListAuthorizationRules", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListAuthorizationRules(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListAuthorizationRules", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListAuthorizationRulesComplete retrieves all of the results into a single object +func (c HybridConnectionsClient) ListAuthorizationRulesComplete(ctx context.Context, id HybridConnectionId) (ListAuthorizationRulesCompleteResult, error) { + return c.ListAuthorizationRulesCompleteMatchingPredicate(ctx, id, AuthorizationRuleOperationPredicate{}) +} + +// ListAuthorizationRulesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c HybridConnectionsClient) ListAuthorizationRulesCompleteMatchingPredicate(ctx context.Context, id HybridConnectionId, predicate AuthorizationRuleOperationPredicate) (resp ListAuthorizationRulesCompleteResult, err error) { + items := make([]AuthorizationRule, 0) + + page, err := c.ListAuthorizationRules(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListAuthorizationRulesCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_listbynamespace_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_listbynamespace_autorest.go new file mode 100644 index 00000000000..1062f8d85d5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_listbynamespace_autorest.go @@ -0,0 +1,186 @@ +package hybridconnections + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByNamespaceOperationResponse struct { + HttpResponse *http.Response + Model *[]HybridConnection + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByNamespaceOperationResponse, error) +} + +type ListByNamespaceCompleteResult struct { + Items []HybridConnection +} + +func (r ListByNamespaceOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByNamespaceOperationResponse) LoadMore(ctx context.Context) (resp ListByNamespaceOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByNamespace ... +func (c HybridConnectionsClient) ListByNamespace(ctx context.Context, id NamespaceId) (resp ListByNamespaceOperationResponse, err error) { + req, err := c.preparerForListByNamespace(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListByNamespace", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListByNamespace", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByNamespace(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListByNamespace", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByNamespace prepares the ListByNamespace request. +func (c HybridConnectionsClient) preparerForListByNamespace(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/hybridConnections", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByNamespaceWithNextLink prepares the ListByNamespace request with the given nextLink token. +func (c HybridConnectionsClient) preparerForListByNamespaceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByNamespace handles the response to the ListByNamespace request. The method always +// closes the http.Response Body. +func (c HybridConnectionsClient) responderForListByNamespace(resp *http.Response) (result ListByNamespaceOperationResponse, err error) { + type page struct { + Values []HybridConnection `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByNamespaceOperationResponse, err error) { + req, err := c.preparerForListByNamespaceWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListByNamespace", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListByNamespace", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByNamespace(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListByNamespace", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByNamespaceComplete retrieves all of the results into a single object +func (c HybridConnectionsClient) ListByNamespaceComplete(ctx context.Context, id NamespaceId) (ListByNamespaceCompleteResult, error) { + return c.ListByNamespaceCompleteMatchingPredicate(ctx, id, HybridConnectionOperationPredicate{}) +} + +// ListByNamespaceCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c HybridConnectionsClient) ListByNamespaceCompleteMatchingPredicate(ctx context.Context, id NamespaceId, predicate HybridConnectionOperationPredicate) (resp ListByNamespaceCompleteResult, err error) { + items := make([]HybridConnection, 0) + + page, err := c.ListByNamespace(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByNamespaceCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_listkeys_autorest.go new file mode 100644 index 00000000000..2156a9c6838 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_listkeys_autorest.go @@ -0,0 +1,69 @@ +package hybridconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeysOperationResponse struct { + HttpResponse *http.Response + Model *AccessKeys +} + +// ListKeys ... +func (c HybridConnectionsClient) ListKeys(ctx context.Context, id HybridConnectionAuthorizationRuleId) (result ListKeysOperationResponse, err error) { + req, err := c.preparerForListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListKeys prepares the ListKeys request. +func (c HybridConnectionsClient) preparerForListKeys(ctx context.Context, id HybridConnectionAuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListKeys handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (c HybridConnectionsClient) responderForListKeys(resp *http.Response) (result ListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_regeneratekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_regeneratekeys_autorest.go new file mode 100644 index 00000000000..f036fe194c4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/method_regeneratekeys_autorest.go @@ -0,0 +1,70 @@ +package hybridconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeysOperationResponse struct { + HttpResponse *http.Response + Model *AccessKeys +} + +// RegenerateKeys ... +func (c HybridConnectionsClient) RegenerateKeys(ctx context.Context, id HybridConnectionAuthorizationRuleId, input RegenerateAccessKeyParameters) (result RegenerateKeysOperationResponse, err error) { + req, err := c.preparerForRegenerateKeys(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "RegenerateKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRegenerateKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "RegenerateKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRegenerateKeys prepares the RegenerateKeys request. +func (c HybridConnectionsClient) preparerForRegenerateKeys(ctx context.Context, id HybridConnectionAuthorizationRuleId, input RegenerateAccessKeyParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKeys", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRegenerateKeys handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (c HybridConnectionsClient) responderForRegenerateKeys(resp *http.Response) (result RegenerateKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_accesskeys.go new file mode 100644 index 00000000000..f573ba19e68 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_accesskeys.go @@ -0,0 +1,12 @@ +package hybridconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeys struct { + KeyName *string `json:"keyName,omitempty"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_authorizationrule.go new file mode 100644 index 00000000000..b3c9c42b357 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_authorizationrule.go @@ -0,0 +1,11 @@ +package hybridconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties AuthorizationRuleProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_authorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_authorizationruleproperties.go new file mode 100644 index 00000000000..36c926eb178 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_authorizationruleproperties.go @@ -0,0 +1,8 @@ +package hybridconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationRuleProperties struct { + Rights []AccessRights `json:"rights"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_hybridconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_hybridconnection.go new file mode 100644 index 00000000000..ad7627fbb9a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_hybridconnection.go @@ -0,0 +1,11 @@ +package hybridconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HybridConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *HybridConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_hybridconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_hybridconnectionproperties.go new file mode 100644 index 00000000000..fe435bceb76 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_hybridconnectionproperties.go @@ -0,0 +1,42 @@ +package hybridconnections + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HybridConnectionProperties struct { + CreatedAt *string `json:"createdAt,omitempty"` + ListenerCount *int64 `json:"listenerCount,omitempty"` + RequiresClientAuthorization *bool `json:"requiresClientAuthorization,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` + UserMetadata *string `json:"userMetadata,omitempty"` +} + +func (o *HybridConnectionProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *HybridConnectionProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *HybridConnectionProperties) GetUpdatedAtAsTime() (*time.Time, error) { + if o.UpdatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpdatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *HybridConnectionProperties) SetUpdatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpdatedAt = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_regenerateaccesskeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_regenerateaccesskeyparameters.go new file mode 100644 index 00000000000..92a9ec4dbfa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/model_regenerateaccesskeyparameters.go @@ -0,0 +1,9 @@ +package hybridconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateAccessKeyParameters struct { + Key *string `json:"key,omitempty"` + KeyType KeyType `json:"keyType"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/predicates.go new file mode 100644 index 00000000000..648affd3176 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/predicates.go @@ -0,0 +1,47 @@ +package hybridconnections + +type AuthorizationRuleOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p AuthorizationRuleOperationPredicate) Matches(input AuthorizationRule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type HybridConnectionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p HybridConnectionOperationPredicate) Matches(input HybridConnection) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/version.go new file mode 100644 index 00000000000..8961e438afc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections/version.go @@ -0,0 +1,12 @@ +package hybridconnections + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/hybridconnections/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/README.md new file mode 100644 index 00000000000..1641c59df31 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/README.md @@ -0,0 +1,248 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces` Documentation + +The `namespaces` SDK allows for interaction with the Azure Resource Manager Service `relay` (API Version `2017-04-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces" +``` + + +### Client Initialization + +```go +client := namespaces.NewNamespacesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NamespacesClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := namespaces.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := namespaces.CheckNameAvailability{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +payload := namespaces.RelayNamespace{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `NamespacesClient.CreateOrUpdateAuthorizationRule` + +```go +ctx := context.TODO() +id := namespaces.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +payload := namespaces.AuthorizationRule{ + // ... +} + + +read, err := client.CreateOrUpdateAuthorizationRule(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.Delete` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `NamespacesClient.DeleteAuthorizationRule` + +```go +ctx := context.TODO() +id := namespaces.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +read, err := client.DeleteAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.Get` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.GetAuthorizationRule` + +```go +ctx := context.TODO() +id := namespaces.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +read, err := client.GetAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.List` + +```go +ctx := context.TODO() +id := namespaces.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NamespacesClient.ListAuthorizationRules` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +// alternatively `client.ListAuthorizationRules(ctx, id)` can be used to do batched pagination +items, err := client.ListAuthorizationRulesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NamespacesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := namespaces.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NamespacesClient.ListKeys` + +```go +ctx := context.TODO() +id := namespaces.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +read, err := client.ListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.RegenerateKeys` + +```go +ctx := context.TODO() +id := namespaces.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +payload := namespaces.RegenerateAccessKeyParameters{ + // ... +} + + +read, err := client.RegenerateKeys(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.Update` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +payload := namespaces.RelayUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/client.go new file mode 100644 index 00000000000..bf25155c419 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/client.go @@ -0,0 +1,18 @@ +package namespaces + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesClient struct { + Client autorest.Client + baseUri string +} + +func NewNamespacesClientWithBaseURI(endpoint string) NamespacesClient { + return NamespacesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/constants.go new file mode 100644 index 00000000000..4987e03c5d8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/constants.go @@ -0,0 +1,195 @@ +package namespaces + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessRights string + +const ( + AccessRightsListen AccessRights = "Listen" + AccessRightsManage AccessRights = "Manage" + AccessRightsSend AccessRights = "Send" +) + +func PossibleValuesForAccessRights() []string { + return []string{ + string(AccessRightsListen), + string(AccessRightsManage), + string(AccessRightsSend), + } +} + +func parseAccessRights(input string) (*AccessRights, error) { + vals := map[string]AccessRights{ + "listen": AccessRightsListen, + "manage": AccessRightsManage, + "send": AccessRightsSend, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessRights(input) + return &out, nil +} + +type KeyType string + +const ( + KeyTypePrimaryKey KeyType = "PrimaryKey" + KeyTypeSecondaryKey KeyType = "SecondaryKey" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypePrimaryKey), + string(KeyTypeSecondaryKey), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "primarykey": KeyTypePrimaryKey, + "secondarykey": KeyTypeSecondaryKey, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} + +type ProvisioningStateEnum string + +const ( + ProvisioningStateEnumCreated ProvisioningStateEnum = "Created" + ProvisioningStateEnumDeleted ProvisioningStateEnum = "Deleted" + ProvisioningStateEnumFailed ProvisioningStateEnum = "Failed" + ProvisioningStateEnumSucceeded ProvisioningStateEnum = "Succeeded" + ProvisioningStateEnumUnknown ProvisioningStateEnum = "Unknown" + ProvisioningStateEnumUpdating ProvisioningStateEnum = "Updating" +) + +func PossibleValuesForProvisioningStateEnum() []string { + return []string{ + string(ProvisioningStateEnumCreated), + string(ProvisioningStateEnumDeleted), + string(ProvisioningStateEnumFailed), + string(ProvisioningStateEnumSucceeded), + string(ProvisioningStateEnumUnknown), + string(ProvisioningStateEnumUpdating), + } +} + +func parseProvisioningStateEnum(input string) (*ProvisioningStateEnum, error) { + vals := map[string]ProvisioningStateEnum{ + "created": ProvisioningStateEnumCreated, + "deleted": ProvisioningStateEnumDeleted, + "failed": ProvisioningStateEnumFailed, + "succeeded": ProvisioningStateEnumSucceeded, + "unknown": ProvisioningStateEnumUnknown, + "updating": ProvisioningStateEnumUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningStateEnum(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameStandard SkuName = "Standard" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameStandard), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "standard": SkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} + +type UnavailableReason string + +const ( + UnavailableReasonInvalidName UnavailableReason = "InvalidName" + UnavailableReasonNameInLockdown UnavailableReason = "NameInLockdown" + UnavailableReasonNameInUse UnavailableReason = "NameInUse" + UnavailableReasonNone UnavailableReason = "None" + UnavailableReasonSubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" + UnavailableReasonTooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" +) + +func PossibleValuesForUnavailableReason() []string { + return []string{ + string(UnavailableReasonInvalidName), + string(UnavailableReasonNameInLockdown), + string(UnavailableReasonNameInUse), + string(UnavailableReasonNone), + string(UnavailableReasonSubscriptionIsDisabled), + string(UnavailableReasonTooManyNamespaceInCurrentSubscription), + } +} + +func parseUnavailableReason(input string) (*UnavailableReason, error) { + vals := map[string]UnavailableReason{ + "invalidname": UnavailableReasonInvalidName, + "nameinlockdown": UnavailableReasonNameInLockdown, + "nameinuse": UnavailableReasonNameInUse, + "none": UnavailableReasonNone, + "subscriptionisdisabled": UnavailableReasonSubscriptionIsDisabled, + "toomanynamespaceincurrentsubscription": UnavailableReasonTooManyNamespaceInCurrentSubscription, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UnavailableReason(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/id_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/id_authorizationrule.go new file mode 100644 index 00000000000..b8fbf9da21e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/id_authorizationrule.go @@ -0,0 +1,137 @@ +package namespaces + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AuthorizationRuleId{} + +// AuthorizationRuleId is a struct representing the Resource ID for a Authorization Rule +type AuthorizationRuleId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + AuthorizationRuleName string +} + +// NewAuthorizationRuleID returns a new AuthorizationRuleId struct +func NewAuthorizationRuleID(subscriptionId string, resourceGroupName string, namespaceName string, authorizationRuleName string) AuthorizationRuleId { + return AuthorizationRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + AuthorizationRuleName: authorizationRuleName, + } +} + +// ParseAuthorizationRuleID parses 'input' into a AuthorizationRuleId +func ParseAuthorizationRuleID(input string) (*AuthorizationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(AuthorizationRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AuthorizationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAuthorizationRuleIDInsensitively parses 'input' case-insensitively into a AuthorizationRuleId +// note: this method should only be used for API response data and not user input +func ParseAuthorizationRuleIDInsensitively(input string) (*AuthorizationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(AuthorizationRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AuthorizationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAuthorizationRuleID checks that 'input' can be parsed as a Authorization Rule ID +func ValidateAuthorizationRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAuthorizationRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Authorization Rule ID +func (id AuthorizationRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Relay/namespaces/%s/authorizationRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.AuthorizationRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Authorization Rule ID +func (id AuthorizationRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftRelay", "Microsoft.Relay", "Microsoft.Relay"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticAuthorizationRules", "authorizationRules", "authorizationRules"), + resourceids.UserSpecifiedSegment("authorizationRuleName", "authorizationRuleValue"), + } +} + +// String returns a human-readable description of this Authorization Rule ID +func (id AuthorizationRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Authorization Rule Name: %q", id.AuthorizationRuleName), + } + return fmt.Sprintf("Authorization Rule (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/id_namespace.go new file mode 100644 index 00000000000..dc3282cb57d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/id_namespace.go @@ -0,0 +1,124 @@ +package namespaces + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NamespaceId{} + +// NamespaceId is a struct representing the Resource ID for a Namespace +type NamespaceId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string +} + +// NewNamespaceID returns a new NamespaceId struct +func NewNamespaceID(subscriptionId string, resourceGroupName string, namespaceName string) NamespaceId { + return NamespaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + } +} + +// ParseNamespaceID parses 'input' into a NamespaceId +func ParseNamespaceID(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNamespaceIDInsensitively parses 'input' case-insensitively into a NamespaceId +// note: this method should only be used for API response data and not user input +func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID +func ValidateNamespaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNamespaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Namespace ID +func (id NamespaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Relay/namespaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Namespace ID +func (id NamespaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftRelay", "Microsoft.Relay", "Microsoft.Relay"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + } +} + +// String returns a human-readable description of this Namespace ID +func (id NamespaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + } + return fmt.Sprintf("Namespace (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_checknameavailability_autorest.go new file mode 100644 index 00000000000..67ba0ea69f0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_checknameavailability_autorest.go @@ -0,0 +1,71 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameAvailabilityResult +} + +// CheckNameAvailability ... +func (c NamespacesClient) CheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckNameAvailability) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c NamespacesClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckNameAvailability) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Relay/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_createorupdate_autorest.go new file mode 100644 index 00000000000..09581fdbbbf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c NamespacesClient) CreateOrUpdate(ctx context.Context, id NamespaceId, input RelayNamespace) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c NamespacesClient) CreateOrUpdateThenPoll(ctx context.Context, id NamespaceId, input RelayNamespace) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c NamespacesClient) preparerForCreateOrUpdate(ctx context.Context, id NamespaceId, input RelayNamespace) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c NamespacesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_createorupdateauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_createorupdateauthorizationrule_autorest.go new file mode 100644 index 00000000000..427b471540d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_createorupdateauthorizationrule_autorest.go @@ -0,0 +1,69 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *AuthorizationRule +} + +// CreateOrUpdateAuthorizationRule ... +func (c NamespacesClient) CreateOrUpdateAuthorizationRule(ctx context.Context, id AuthorizationRuleId, input AuthorizationRule) (result CreateOrUpdateAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdateAuthorizationRule(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdateAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdateAuthorizationRule prepares the CreateOrUpdateAuthorizationRule request. +func (c NamespacesClient) preparerForCreateOrUpdateAuthorizationRule(ctx context.Context, id AuthorizationRuleId, input AuthorizationRule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdateAuthorizationRule handles the response to the CreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForCreateOrUpdateAuthorizationRule(resp *http.Response) (result CreateOrUpdateAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_delete_autorest.go new file mode 100644 index 00000000000..968dfe754f2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_delete_autorest.go @@ -0,0 +1,78 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c NamespacesClient) Delete(ctx context.Context, id NamespaceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c NamespacesClient) DeleteThenPoll(ctx context.Context, id NamespaceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c NamespacesClient) preparerForDelete(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c NamespacesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_deleteauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_deleteauthorizationrule_autorest.go new file mode 100644 index 00000000000..92336c4b4a0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_deleteauthorizationrule_autorest.go @@ -0,0 +1,66 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response +} + +// DeleteAuthorizationRule ... +func (c NamespacesClient) DeleteAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (result DeleteAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForDeleteAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDeleteAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDeleteAuthorizationRule prepares the DeleteAuthorizationRule request. +func (c NamespacesClient) preparerForDeleteAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDeleteAuthorizationRule handles the response to the DeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForDeleteAuthorizationRule(resp *http.Response) (result DeleteAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_get_autorest.go new file mode 100644 index 00000000000..1ab016389fc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_get_autorest.go @@ -0,0 +1,68 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *RelayNamespace +} + +// Get ... +func (c NamespacesClient) Get(ctx context.Context, id NamespaceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c NamespacesClient) preparerForGet(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_getauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_getauthorizationrule_autorest.go new file mode 100644 index 00000000000..24a7f00cb69 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_getauthorizationrule_autorest.go @@ -0,0 +1,68 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *AuthorizationRule +} + +// GetAuthorizationRule ... +func (c NamespacesClient) GetAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (result GetAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForGetAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "GetAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "GetAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetAuthorizationRule prepares the GetAuthorizationRule request. +func (c NamespacesClient) preparerForGetAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetAuthorizationRule handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForGetAuthorizationRule(resp *http.Response) (result GetAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_list_autorest.go new file mode 100644 index 00000000000..f5067719cee --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_list_autorest.go @@ -0,0 +1,187 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]RelayNamespace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []RelayNamespace +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c NamespacesClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c NamespacesClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Relay/namespaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c NamespacesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []RelayNamespace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c NamespacesClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, RelayNamespaceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NamespacesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate RelayNamespaceOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]RelayNamespace, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_listauthorizationrules_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_listauthorizationrules_autorest.go new file mode 100644 index 00000000000..39e6b9d4eca --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_listauthorizationrules_autorest.go @@ -0,0 +1,186 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAuthorizationRulesOperationResponse struct { + HttpResponse *http.Response + Model *[]AuthorizationRule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListAuthorizationRulesOperationResponse, error) +} + +type ListAuthorizationRulesCompleteResult struct { + Items []AuthorizationRule +} + +func (r ListAuthorizationRulesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListAuthorizationRulesOperationResponse) LoadMore(ctx context.Context) (resp ListAuthorizationRulesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListAuthorizationRules ... +func (c NamespacesClient) ListAuthorizationRules(ctx context.Context, id NamespaceId) (resp ListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForListAuthorizationRules(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListAuthorizationRules(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListAuthorizationRules prepares the ListAuthorizationRules request. +func (c NamespacesClient) preparerForListAuthorizationRules(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/authorizationRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListAuthorizationRulesWithNextLink prepares the ListAuthorizationRules request with the given nextLink token. +func (c NamespacesClient) preparerForListAuthorizationRulesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListAuthorizationRules handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForListAuthorizationRules(resp *http.Response) (result ListAuthorizationRulesOperationResponse, err error) { + type page struct { + Values []AuthorizationRule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForListAuthorizationRulesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListAuthorizationRules(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListAuthorizationRulesComplete retrieves all of the results into a single object +func (c NamespacesClient) ListAuthorizationRulesComplete(ctx context.Context, id NamespaceId) (ListAuthorizationRulesCompleteResult, error) { + return c.ListAuthorizationRulesCompleteMatchingPredicate(ctx, id, AuthorizationRuleOperationPredicate{}) +} + +// ListAuthorizationRulesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NamespacesClient) ListAuthorizationRulesCompleteMatchingPredicate(ctx context.Context, id NamespaceId, predicate AuthorizationRuleOperationPredicate) (resp ListAuthorizationRulesCompleteResult, err error) { + items := make([]AuthorizationRule, 0) + + page, err := c.ListAuthorizationRules(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListAuthorizationRulesCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..e1248f2d5aa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]RelayNamespace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []RelayNamespace +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c NamespacesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c NamespacesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Relay/namespaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c NamespacesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []RelayNamespace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c NamespacesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, RelayNamespaceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NamespacesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate RelayNamespaceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]RelayNamespace, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_listkeys_autorest.go new file mode 100644 index 00000000000..5dfd71ec198 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_listkeys_autorest.go @@ -0,0 +1,69 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeysOperationResponse struct { + HttpResponse *http.Response + Model *AccessKeys +} + +// ListKeys ... +func (c NamespacesClient) ListKeys(ctx context.Context, id AuthorizationRuleId) (result ListKeysOperationResponse, err error) { + req, err := c.preparerForListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListKeys prepares the ListKeys request. +func (c NamespacesClient) preparerForListKeys(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListKeys handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForListKeys(resp *http.Response) (result ListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_regeneratekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_regeneratekeys_autorest.go new file mode 100644 index 00000000000..4f9dd06f42a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_regeneratekeys_autorest.go @@ -0,0 +1,70 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeysOperationResponse struct { + HttpResponse *http.Response + Model *AccessKeys +} + +// RegenerateKeys ... +func (c NamespacesClient) RegenerateKeys(ctx context.Context, id AuthorizationRuleId, input RegenerateAccessKeyParameters) (result RegenerateKeysOperationResponse, err error) { + req, err := c.preparerForRegenerateKeys(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "RegenerateKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRegenerateKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "RegenerateKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRegenerateKeys prepares the RegenerateKeys request. +func (c NamespacesClient) preparerForRegenerateKeys(ctx context.Context, id AuthorizationRuleId, input RegenerateAccessKeyParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKeys", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRegenerateKeys handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForRegenerateKeys(resp *http.Response) (result RegenerateKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_update_autorest.go new file mode 100644 index 00000000000..3e61f227e84 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/method_update_autorest.go @@ -0,0 +1,69 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *RelayNamespace +} + +// Update ... +func (c NamespacesClient) Update(ctx context.Context, id NamespaceId, input RelayUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c NamespacesClient) preparerForUpdate(ctx context.Context, id NamespaceId, input RelayUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_accesskeys.go new file mode 100644 index 00000000000..a8919219780 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_accesskeys.go @@ -0,0 +1,12 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeys struct { + KeyName *string `json:"keyName,omitempty"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_authorizationrule.go new file mode 100644 index 00000000000..4057d8d8eb9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_authorizationrule.go @@ -0,0 +1,11 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties AuthorizationRuleProperties `json:"properties"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_authorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_authorizationruleproperties.go new file mode 100644 index 00000000000..e6cec03a30e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_authorizationruleproperties.go @@ -0,0 +1,8 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationRuleProperties struct { + Rights []AccessRights `json:"rights"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_checknameavailability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_checknameavailability.go new file mode 100644 index 00000000000..611253e0b83 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_checknameavailability.go @@ -0,0 +1,8 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailability struct { + Name string `json:"name"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_checknameavailabilityresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_checknameavailabilityresult.go new file mode 100644 index 00000000000..9d301c5d67a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_checknameavailabilityresult.go @@ -0,0 +1,10 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityResult struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *UnavailableReason `json:"reason,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_regenerateaccesskeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_regenerateaccesskeyparameters.go new file mode 100644 index 00000000000..532b4e96d6e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_regenerateaccesskeyparameters.go @@ -0,0 +1,9 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateAccessKeyParameters struct { + Key *string `json:"key,omitempty"` + KeyType KeyType `json:"keyType"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_relaynamespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_relaynamespace.go similarity index 75% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_relaynamespace.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_relaynamespace.go index ba18a25b67f..102817138a4 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_relaynamespace.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_relaynamespace.go @@ -1,5 +1,8 @@ package namespaces +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type RelayNamespace struct { Id *string `json:"id,omitempty"` Location string `json:"location"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_relaynamespaceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_relaynamespaceproperties.go new file mode 100644 index 00000000000..e20be2b13a9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_relaynamespaceproperties.go @@ -0,0 +1,42 @@ +package namespaces + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RelayNamespaceProperties struct { + CreatedAt *string `json:"createdAt,omitempty"` + MetricId *string `json:"metricId,omitempty"` + ProvisioningState *ProvisioningStateEnum `json:"provisioningState,omitempty"` + ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` +} + +func (o *RelayNamespaceProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *RelayNamespaceProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *RelayNamespaceProperties) GetUpdatedAtAsTime() (*time.Time, error) { + if o.UpdatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpdatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *RelayNamespaceProperties) SetUpdatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpdatedAt = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_relayupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_relayupdateparameters.go new file mode 100644 index 00000000000..576bf9cab54 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_relayupdateparameters.go @@ -0,0 +1,13 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RelayUpdateParameters struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RelayNamespaceProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_sku.go new file mode 100644 index 00000000000..8c986423e93 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/model_sku.go @@ -0,0 +1,9 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name SkuName `json:"name"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/predicates.go new file mode 100644 index 00000000000..ac8f41f60de --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/predicates.go @@ -0,0 +1,52 @@ +package namespaces + +type AuthorizationRuleOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p AuthorizationRuleOperationPredicate) Matches(input AuthorizationRule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type RelayNamespaceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p RelayNamespaceOperationPredicate) Matches(input RelayNamespace) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/version.go new file mode 100644 index 00000000000..a1c5b4cbe80 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces/version.go @@ -0,0 +1,12 @@ +package namespaces + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2017-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/namespaces/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/README.md new file mode 100644 index 00000000000..b173f26cdd2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/README.md @@ -0,0 +1,52 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys` Documentation + +The `adminkeys` SDK allows for interaction with the Azure Resource Manager Service `search` (API Version `2020-03-13`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys" +``` + + +### Client Initialization + +```go +client := adminkeys.NewAdminKeysClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AdminKeysClient.Get` + +```go +ctx := context.TODO() +id := adminkeys.NewSearchServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue") + +read, err := client.Get(ctx, id, adminkeys.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AdminKeysClient.Regenerate` + +```go +ctx := context.TODO() +id := adminkeys.NewKeyKindID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue", "primary") + +read, err := client.Regenerate(ctx, id, adminkeys.DefaultRegenerateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/client.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/client.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/client.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/constants.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/constants.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/constants.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/id_keykind.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/id_keykind.go similarity index 97% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/id_keykind.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/id_keykind.go index f879fda81ac..2fe9c7e515d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/id_keykind.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/id_keykind.go @@ -50,8 +50,8 @@ func ParseKeyKindID(input string) (*KeyKindId, error) { return nil, fmt.Errorf("the segment 'searchServiceName' was not found in the resource id %q", input) } - if v, constFound := parsed.Parsed["keyKind"]; true { - if !constFound { + if v, ok := parsed.Parsed["keyKind"]; true { + if !ok { return nil, fmt.Errorf("the segment 'keyKind' was not found in the resource id %q", input) } @@ -89,8 +89,8 @@ func ParseKeyKindIDInsensitively(input string) (*KeyKindId, error) { return nil, fmt.Errorf("the segment 'searchServiceName' was not found in the resource id %q", input) } - if v, constFound := parsed.Parsed["keyKind"]; true { - if !constFound { + if v, ok := parsed.Parsed["keyKind"]; true { + if !ok { return nil, fmt.Errorf("the segment 'keyKind' was not found in the resource id %q", input) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/id_searchservice.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/id_searchservice.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/id_searchservice.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/id_searchservice.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/method_get_autorest.go new file mode 100644 index 00000000000..e1c436a672c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/method_get_autorest.go @@ -0,0 +1,98 @@ +package adminkeys + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *AdminKeyResult +} + +type GetOperationOptions struct { + XMsClientRequestId *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.XMsClientRequestId != nil { + out["x-ms-client-request-id"] = *o.XMsClientRequestId + } + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Get ... +func (c AdminKeysClient) Get(ctx context.Context, id SearchServiceId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "adminkeys.AdminKeysClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "adminkeys.AdminKeysClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "adminkeys.AdminKeysClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c AdminKeysClient) preparerForGet(ctx context.Context, id SearchServiceId, options GetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/listAdminKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c AdminKeysClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/method_regenerate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/method_regenerate_autorest.go similarity index 94% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/method_regenerate_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/method_regenerate_autorest.go index 783f572627e..dd68ca8dce0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/method_regenerate_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/method_regenerate_autorest.go @@ -8,6 +8,9 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type RegenerateOperationResponse struct { HttpResponse *http.Response Model *AdminKeyResult @@ -89,5 +92,6 @@ func (c AdminKeysClient) responderForRegenerate(resp *http.Response) (result Reg autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/model_adminkeyresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/model_adminkeyresult.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/model_adminkeyresult.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/model_adminkeyresult.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/version.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/version.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys/version.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/README.md new file mode 100644 index 00000000000..5e2d9375cdb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/README.md @@ -0,0 +1,69 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys` Documentation + +The `querykeys` SDK allows for interaction with the Azure Resource Manager Service `search` (API Version `2020-03-13`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys" +``` + + +### Client Initialization + +```go +client := querykeys.NewQueryKeysClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `QueryKeysClient.Create` + +```go +ctx := context.TODO() +id := querykeys.NewCreateQueryKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue", "nameValue") + +read, err := client.Create(ctx, id, querykeys.DefaultCreateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `QueryKeysClient.Delete` + +```go +ctx := context.TODO() +id := querykeys.NewDeleteQueryKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue", "keyValue") + +read, err := client.Delete(ctx, id, querykeys.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `QueryKeysClient.ListBySearchService` + +```go +ctx := context.TODO() +id := querykeys.NewSearchServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue") + +// alternatively `client.ListBySearchService(ctx, id, querykeys.DefaultListBySearchServiceOperationOptions())` can be used to do batched pagination +items, err := client.ListBySearchServiceComplete(ctx, id, querykeys.DefaultListBySearchServiceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/client.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/client.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/client.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/id_createquerykey.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/id_createquerykey.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/id_createquerykey.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/id_createquerykey.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/id_deletequerykey.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/id_deletequerykey.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/id_deletequerykey.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/id_deletequerykey.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/id_searchservice.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/id_searchservice.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/id_searchservice.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/id_searchservice.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/method_create_autorest.go new file mode 100644 index 00000000000..c01659951c3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/method_create_autorest.go @@ -0,0 +1,97 @@ +package querykeys + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + HttpResponse *http.Response + Model *QueryKey +} + +type CreateOperationOptions struct { + XMsClientRequestId *string +} + +func DefaultCreateOperationOptions() CreateOperationOptions { + return CreateOperationOptions{} +} + +func (o CreateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.XMsClientRequestId != nil { + out["x-ms-client-request-id"] = *o.XMsClientRequestId + } + + return out +} + +func (o CreateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Create ... +func (c QueryKeysClient) Create(ctx context.Context, id CreateQueryKeyId, options CreateOperationOptions) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "querykeys.QueryKeysClient", "Create", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "querykeys.QueryKeysClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "querykeys.QueryKeysClient", "Create", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreate prepares the Create request. +func (c QueryKeysClient) preparerForCreate(ctx context.Context, id CreateQueryKeyId, options CreateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreate handles the response to the Create request. The method always +// closes the http.Response Body. +func (c QueryKeysClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/method_delete_autorest.go new file mode 100644 index 00000000000..b89ee1e68fc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/method_delete_autorest.go @@ -0,0 +1,95 @@ +package querykeys + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + XMsClientRequestId *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.XMsClientRequestId != nil { + out["x-ms-client-request-id"] = *o.XMsClientRequestId + } + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Delete ... +func (c QueryKeysClient) Delete(ctx context.Context, id DeleteQueryKeyId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "querykeys.QueryKeysClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "querykeys.QueryKeysClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "querykeys.QueryKeysClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c QueryKeysClient) preparerForDelete(ctx context.Context, id DeleteQueryKeyId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c QueryKeysClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/method_listbysearchservice_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/method_listbysearchservice_autorest.go similarity index 97% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/method_listbysearchservice_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/method_listbysearchservice_autorest.go index fa43e3f0f3a..da48dbc7680 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/method_listbysearchservice_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/method_listbysearchservice_autorest.go @@ -10,6 +10,9 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ListBySearchServiceOperationResponse struct { HttpResponse *http.Response Model *[]QueryKey @@ -80,50 +83,6 @@ func (c QueryKeysClient) ListBySearchService(ctx context.Context, id SearchServi return } -// ListBySearchServiceComplete retrieves all of the results into a single object -func (c QueryKeysClient) ListBySearchServiceComplete(ctx context.Context, id SearchServiceId, options ListBySearchServiceOperationOptions) (ListBySearchServiceCompleteResult, error) { - return c.ListBySearchServiceCompleteMatchingPredicate(ctx, id, options, QueryKeyOperationPredicate{}) -} - -// ListBySearchServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c QueryKeysClient) ListBySearchServiceCompleteMatchingPredicate(ctx context.Context, id SearchServiceId, options ListBySearchServiceOperationOptions, predicate QueryKeyOperationPredicate) (resp ListBySearchServiceCompleteResult, err error) { - items := make([]QueryKey, 0) - - page, err := c.ListBySearchService(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListBySearchServiceCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForListBySearchService prepares the ListBySearchService request. func (c QueryKeysClient) preparerForListBySearchService(ctx context.Context, id SearchServiceId, options ListBySearchServiceOperationOptions) (*http.Request, error) { queryParameters := map[string]interface{}{ @@ -210,3 +169,47 @@ func (c QueryKeysClient) responderForListBySearchService(resp *http.Response) (r } return } + +// ListBySearchServiceComplete retrieves all of the results into a single object +func (c QueryKeysClient) ListBySearchServiceComplete(ctx context.Context, id SearchServiceId, options ListBySearchServiceOperationOptions) (ListBySearchServiceCompleteResult, error) { + return c.ListBySearchServiceCompleteMatchingPredicate(ctx, id, options, QueryKeyOperationPredicate{}) +} + +// ListBySearchServiceCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c QueryKeysClient) ListBySearchServiceCompleteMatchingPredicate(ctx context.Context, id SearchServiceId, options ListBySearchServiceOperationOptions, predicate QueryKeyOperationPredicate) (resp ListBySearchServiceCompleteResult, err error) { + items := make([]QueryKey, 0) + + page, err := c.ListBySearchService(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySearchServiceCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/model_querykey.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/model_querykey.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/model_querykey.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/model_querykey.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/predicates.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/predicates.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/predicates.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/version.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/version.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys/version.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/README.md new file mode 100644 index 00000000000..612d82b5c93 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/README.md @@ -0,0 +1,145 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services` Documentation + +The `services` SDK allows for interaction with the Azure Resource Manager Service `search` (API Version `2020-03-13`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services" +``` + + +### Client Initialization + +```go +client := services.NewServicesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServicesClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := services.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := services.CheckNameAvailabilityInput{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload, services.DefaultCheckNameAvailabilityOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServicesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := services.NewSearchServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue") + +payload := services.SearchService{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload, services.DefaultCreateOrUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServicesClient.Delete` + +```go +ctx := context.TODO() +id := services.NewSearchServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue") + +read, err := client.Delete(ctx, id, services.DefaultDeleteOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServicesClient.Get` + +```go +ctx := context.TODO() +id := services.NewSearchServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue") + +read, err := client.Get(ctx, id, services.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServicesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := services.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id, services.DefaultListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id, services.DefaultListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ServicesClient.ListBySubscription` + +```go +ctx := context.TODO() +id := services.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id, services.DefaultListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id, services.DefaultListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ServicesClient.Update` + +```go +ctx := context.TODO() +id := services.NewSearchServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "searchServiceValue") + +payload := services.SearchService{ + // ... +} + + +read, err := client.Update(ctx, id, payload, services.DefaultUpdateOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/client.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/client.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/client.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/constants.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/constants.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/constants.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/id_searchservice.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/id_searchservice.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/id_searchservice.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/id_searchservice.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_checknameavailability_autorest.go new file mode 100644 index 00000000000..c828d0d24d1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_checknameavailability_autorest.go @@ -0,0 +1,100 @@ +package services + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameAvailabilityOutput +} + +type CheckNameAvailabilityOperationOptions struct { + XMsClientRequestId *string +} + +func DefaultCheckNameAvailabilityOperationOptions() CheckNameAvailabilityOperationOptions { + return CheckNameAvailabilityOperationOptions{} +} + +func (o CheckNameAvailabilityOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.XMsClientRequestId != nil { + out["x-ms-client-request-id"] = *o.XMsClientRequestId + } + + return out +} + +func (o CheckNameAvailabilityOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// CheckNameAvailability ... +func (c ServicesClient) CheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckNameAvailabilityInput, options CheckNameAvailabilityOperationOptions) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c ServicesClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckNameAvailabilityInput, options CheckNameAvailabilityOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Search/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c ServicesClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_createorupdate_autorest.go new file mode 100644 index 00000000000..083d9d9e387 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_createorupdate_autorest.go @@ -0,0 +1,108 @@ +package services + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type CreateOrUpdateOperationOptions struct { + XMsClientRequestId *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.XMsClientRequestId != nil { + out["x-ms-client-request-id"] = *o.XMsClientRequestId + } + + return out +} + +func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// CreateOrUpdate ... +func (c ServicesClient) CreateOrUpdate(ctx context.Context, id SearchServiceId, input SearchService, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ServicesClient) CreateOrUpdateThenPoll(ctx context.Context, id SearchServiceId, input SearchService, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ServicesClient) preparerForCreateOrUpdate(ctx context.Context, id SearchServiceId, input SearchService, options CreateOrUpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ServicesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_delete_autorest.go new file mode 100644 index 00000000000..222b9e5cca0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_delete_autorest.go @@ -0,0 +1,95 @@ +package services + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + XMsClientRequestId *string +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.XMsClientRequestId != nil { + out["x-ms-client-request-id"] = *o.XMsClientRequestId + } + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Delete ... +func (c ServicesClient) Delete(ctx context.Context, id SearchServiceId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ServicesClient) preparerForDelete(ctx context.Context, id SearchServiceId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ServicesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_get_autorest.go new file mode 100644 index 00000000000..2efe8337c1b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_get_autorest.go @@ -0,0 +1,97 @@ +package services + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *SearchService +} + +type GetOperationOptions struct { + XMsClientRequestId *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.XMsClientRequestId != nil { + out["x-ms-client-request-id"] = *o.XMsClientRequestId + } + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Get ... +func (c ServicesClient) Get(ctx context.Context, id SearchServiceId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ServicesClient) preparerForGet(ctx context.Context, id SearchServiceId, options GetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ServicesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..1e1bd5bcb51 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_listbyresourcegroup_autorest.go @@ -0,0 +1,216 @@ +package services + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]SearchService + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []SearchService +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByResourceGroupOperationOptions struct { + XMsClientRequestId *string +} + +func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { + return ListByResourceGroupOperationOptions{} +} + +func (o ListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.XMsClientRequestId != nil { + out["x-ms-client-request-id"] = *o.XMsClientRequestId + } + + return out +} + +func (o ListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// ListByResourceGroup ... +func (c ServicesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ServicesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Search/searchServices", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c ServicesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ServicesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []SearchService `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c ServicesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, SearchServiceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ServicesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate SearchServiceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]SearchService, 0) + + page, err := c.ListByResourceGroup(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..3f5d2c62d6c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_listbysubscription_autorest.go @@ -0,0 +1,216 @@ +package services + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]SearchService + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []SearchService +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListBySubscriptionOperationOptions struct { + XMsClientRequestId *string +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.XMsClientRequestId != nil { + out["x-ms-client-request-id"] = *o.XMsClientRequestId + } + + return out +} + +func (o ListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// ListBySubscription ... +func (c ServicesClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c ServicesClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Search/searchServices", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c ServicesClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c ServicesClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []SearchService `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c ServicesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, SearchServiceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ServicesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions, predicate SearchServiceOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]SearchService, 0) + + page, err := c.ListBySubscription(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_update_autorest.go new file mode 100644 index 00000000000..db83003397c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/method_update_autorest.go @@ -0,0 +1,98 @@ +package services + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *SearchService +} + +type UpdateOperationOptions struct { + XMsClientRequestId *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.XMsClientRequestId != nil { + out["x-ms-client-request-id"] = *o.XMsClientRequestId + } + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Update ... +func (c ServicesClient) Update(ctx context.Context, id SearchServiceId, input SearchService, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "services.ServicesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ServicesClient) preparerForUpdate(ctx context.Context, id SearchServiceId, input SearchService, options UpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ServicesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_checknameavailabilityinput.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_checknameavailabilityinput.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_checknameavailabilityinput.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_checknameavailabilityinput.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_checknameavailabilityoutput.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_checknameavailabilityoutput.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_checknameavailabilityoutput.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_checknameavailabilityoutput.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_iprule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_iprule.go new file mode 100644 index 00000000000..f05c1d347f1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_iprule.go @@ -0,0 +1,8 @@ +package services + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IPRule struct { + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_networkruleset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_networkruleset.go new file mode 100644 index 00000000000..31dc556cd59 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_networkruleset.go @@ -0,0 +1,8 @@ +package services + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkRuleSet struct { + IPRules *[]IPRule `json:"ipRules,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_privateendpointconnection.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_privateendpointconnection.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_privateendpointconnection.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_privateendpointconnectionproperties.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_privateendpointconnectionproperties.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_privateendpointconnectionproperties.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_privateendpointconnectionpropertiesprivateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_privateendpointconnectionpropertiesprivateendpoint.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_privateendpointconnectionpropertiesprivateendpoint.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_privateendpointconnectionpropertiesprivateendpoint.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_privateendpointconnectionpropertiesprivatelinkserviceconnectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_privateendpointconnectionpropertiesprivatelinkserviceconnectionstate.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_privateendpointconnectionpropertiesprivatelinkserviceconnectionstate.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_privateendpointconnectionpropertiesprivatelinkserviceconnectionstate.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_searchservice.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_searchservice.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_searchservice.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_searchservice.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_searchserviceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_searchserviceproperties.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_searchserviceproperties.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_searchserviceproperties.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_sku.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_sku.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/model_sku.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/predicates.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/predicates.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/predicates.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/version.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/version.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services/version.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/README.md new file mode 100644 index 00000000000..266cf8709d2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/README.md @@ -0,0 +1,197 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs` Documentation + +The `disasterrecoveryconfigs` SDK allows for interaction with the Azure Resource Manager Service `servicebus` (API Version `2021-06-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs" +``` + + +### Client Initialization + +```go +client := disasterrecoveryconfigs.NewDisasterRecoveryConfigsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.BreakPairing` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") + +read, err := client.BreakPairing(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +payload := disasterrecoveryconfigs.CheckNameAvailability{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") + +payload := disasterrecoveryconfigs.ArmDisasterRecovery{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.Delete` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.FailOver` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") + +payload := disasterrecoveryconfigs.FailoverProperties{ + // ... +} + + +read, err := client.FailOver(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.Get` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.GetAuthorizationRule` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +read, err := client.GetAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.List` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.ListAuthorizationRules` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "aliasValue") + +// alternatively `client.ListAuthorizationRules(ctx, id)` can be used to do batched pagination +items, err := client.ListAuthorizationRulesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DisasterRecoveryConfigsClient.ListKeys` + +```go +ctx := context.TODO() +id := disasterrecoveryconfigs.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +read, err := client.ListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/client.go new file mode 100644 index 00000000000..92bd0f75168 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/client.go @@ -0,0 +1,18 @@ +package disasterrecoveryconfigs + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DisasterRecoveryConfigsClient struct { + Client autorest.Client + baseUri string +} + +func NewDisasterRecoveryConfigsClientWithBaseURI(endpoint string) DisasterRecoveryConfigsClient { + return DisasterRecoveryConfigsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/constants.go new file mode 100644 index 00000000000..06c06cd30fc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/constants.go @@ -0,0 +1,139 @@ +package disasterrecoveryconfigs + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessRights string + +const ( + AccessRightsListen AccessRights = "Listen" + AccessRightsManage AccessRights = "Manage" + AccessRightsSend AccessRights = "Send" +) + +func PossibleValuesForAccessRights() []string { + return []string{ + string(AccessRightsListen), + string(AccessRightsManage), + string(AccessRightsSend), + } +} + +func parseAccessRights(input string) (*AccessRights, error) { + vals := map[string]AccessRights{ + "listen": AccessRightsListen, + "manage": AccessRightsManage, + "send": AccessRightsSend, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessRights(input) + return &out, nil +} + +type ProvisioningStateDR string + +const ( + ProvisioningStateDRAccepted ProvisioningStateDR = "Accepted" + ProvisioningStateDRFailed ProvisioningStateDR = "Failed" + ProvisioningStateDRSucceeded ProvisioningStateDR = "Succeeded" +) + +func PossibleValuesForProvisioningStateDR() []string { + return []string{ + string(ProvisioningStateDRAccepted), + string(ProvisioningStateDRFailed), + string(ProvisioningStateDRSucceeded), + } +} + +func parseProvisioningStateDR(input string) (*ProvisioningStateDR, error) { + vals := map[string]ProvisioningStateDR{ + "accepted": ProvisioningStateDRAccepted, + "failed": ProvisioningStateDRFailed, + "succeeded": ProvisioningStateDRSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningStateDR(input) + return &out, nil +} + +type RoleDisasterRecovery string + +const ( + RoleDisasterRecoveryPrimary RoleDisasterRecovery = "Primary" + RoleDisasterRecoveryPrimaryNotReplicating RoleDisasterRecovery = "PrimaryNotReplicating" + RoleDisasterRecoverySecondary RoleDisasterRecovery = "Secondary" +) + +func PossibleValuesForRoleDisasterRecovery() []string { + return []string{ + string(RoleDisasterRecoveryPrimary), + string(RoleDisasterRecoveryPrimaryNotReplicating), + string(RoleDisasterRecoverySecondary), + } +} + +func parseRoleDisasterRecovery(input string) (*RoleDisasterRecovery, error) { + vals := map[string]RoleDisasterRecovery{ + "primary": RoleDisasterRecoveryPrimary, + "primarynotreplicating": RoleDisasterRecoveryPrimaryNotReplicating, + "secondary": RoleDisasterRecoverySecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RoleDisasterRecovery(input) + return &out, nil +} + +type UnavailableReason string + +const ( + UnavailableReasonInvalidName UnavailableReason = "InvalidName" + UnavailableReasonNameInLockdown UnavailableReason = "NameInLockdown" + UnavailableReasonNameInUse UnavailableReason = "NameInUse" + UnavailableReasonNone UnavailableReason = "None" + UnavailableReasonSubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" + UnavailableReasonTooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" +) + +func PossibleValuesForUnavailableReason() []string { + return []string{ + string(UnavailableReasonInvalidName), + string(UnavailableReasonNameInLockdown), + string(UnavailableReasonNameInUse), + string(UnavailableReasonNone), + string(UnavailableReasonSubscriptionIsDisabled), + string(UnavailableReasonTooManyNamespaceInCurrentSubscription), + } +} + +func parseUnavailableReason(input string) (*UnavailableReason, error) { + vals := map[string]UnavailableReason{ + "invalidname": UnavailableReasonInvalidName, + "nameinlockdown": UnavailableReasonNameInLockdown, + "nameinuse": UnavailableReasonNameInUse, + "none": UnavailableReasonNone, + "subscriptionisdisabled": UnavailableReasonSubscriptionIsDisabled, + "toomanynamespaceincurrentsubscription": UnavailableReasonTooManyNamespaceInCurrentSubscription, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UnavailableReason(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_authorizationrule.go new file mode 100644 index 00000000000..31f8873ab15 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_authorizationrule.go @@ -0,0 +1,137 @@ +package disasterrecoveryconfigs + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AuthorizationRuleId{} + +// AuthorizationRuleId is a struct representing the Resource ID for a Authorization Rule +type AuthorizationRuleId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + AuthorizationRuleName string +} + +// NewAuthorizationRuleID returns a new AuthorizationRuleId struct +func NewAuthorizationRuleID(subscriptionId string, resourceGroupName string, namespaceName string, authorizationRuleName string) AuthorizationRuleId { + return AuthorizationRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + AuthorizationRuleName: authorizationRuleName, + } +} + +// ParseAuthorizationRuleID parses 'input' into a AuthorizationRuleId +func ParseAuthorizationRuleID(input string) (*AuthorizationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(AuthorizationRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AuthorizationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAuthorizationRuleIDInsensitively parses 'input' case-insensitively into a AuthorizationRuleId +// note: this method should only be used for API response data and not user input +func ParseAuthorizationRuleIDInsensitively(input string) (*AuthorizationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(AuthorizationRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AuthorizationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAuthorizationRuleID checks that 'input' can be parsed as a Authorization Rule ID +func ValidateAuthorizationRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAuthorizationRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Authorization Rule ID +func (id AuthorizationRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/authorizationRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.AuthorizationRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Authorization Rule ID +func (id AuthorizationRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticAuthorizationRules", "authorizationRules", "authorizationRules"), + resourceids.UserSpecifiedSegment("authorizationRuleName", "authorizationRuleValue"), + } +} + +// String returns a human-readable description of this Authorization Rule ID +func (id AuthorizationRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Authorization Rule Name: %q", id.AuthorizationRuleName), + } + return fmt.Sprintf("Authorization Rule (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go new file mode 100644 index 00000000000..71d68d16ba3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go @@ -0,0 +1,137 @@ +package disasterrecoveryconfigs + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DisasterRecoveryConfigId{} + +// DisasterRecoveryConfigId is a struct representing the Resource ID for a Disaster Recovery Config +type DisasterRecoveryConfigId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + Alias string +} + +// NewDisasterRecoveryConfigID returns a new DisasterRecoveryConfigId struct +func NewDisasterRecoveryConfigID(subscriptionId string, resourceGroupName string, namespaceName string, alias string) DisasterRecoveryConfigId { + return DisasterRecoveryConfigId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + Alias: alias, + } +} + +// ParseDisasterRecoveryConfigID parses 'input' into a DisasterRecoveryConfigId +func ParseDisasterRecoveryConfigID(input string) (*DisasterRecoveryConfigId, error) { + parser := resourceids.NewParserFromResourceIdType(DisasterRecoveryConfigId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DisasterRecoveryConfigId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.Alias, ok = parsed.Parsed["alias"]; !ok { + return nil, fmt.Errorf("the segment 'alias' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDisasterRecoveryConfigIDInsensitively parses 'input' case-insensitively into a DisasterRecoveryConfigId +// note: this method should only be used for API response data and not user input +func ParseDisasterRecoveryConfigIDInsensitively(input string) (*DisasterRecoveryConfigId, error) { + parser := resourceids.NewParserFromResourceIdType(DisasterRecoveryConfigId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DisasterRecoveryConfigId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.Alias, ok = parsed.Parsed["alias"]; !ok { + return nil, fmt.Errorf("the segment 'alias' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDisasterRecoveryConfigID checks that 'input' can be parsed as a Disaster Recovery Config ID +func ValidateDisasterRecoveryConfigID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDisasterRecoveryConfigID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Disaster Recovery Config ID +func (id DisasterRecoveryConfigId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/disasterRecoveryConfigs/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.Alias) +} + +// Segments returns a slice of Resource ID Segments which comprise this Disaster Recovery Config ID +func (id DisasterRecoveryConfigId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticDisasterRecoveryConfigs", "disasterRecoveryConfigs", "disasterRecoveryConfigs"), + resourceids.UserSpecifiedSegment("alias", "aliasValue"), + } +} + +// String returns a human-readable description of this Disaster Recovery Config ID +func (id DisasterRecoveryConfigId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Alias: %q", id.Alias), + } + return fmt.Sprintf("Disaster Recovery Config (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_namespace.go new file mode 100644 index 00000000000..2b4c2f95346 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_namespace.go @@ -0,0 +1,124 @@ +package disasterrecoveryconfigs + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NamespaceId{} + +// NamespaceId is a struct representing the Resource ID for a Namespace +type NamespaceId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string +} + +// NewNamespaceID returns a new NamespaceId struct +func NewNamespaceID(subscriptionId string, resourceGroupName string, namespaceName string) NamespaceId { + return NamespaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + } +} + +// ParseNamespaceID parses 'input' into a NamespaceId +func ParseNamespaceID(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNamespaceIDInsensitively parses 'input' case-insensitively into a NamespaceId +// note: this method should only be used for API response data and not user input +func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID +func ValidateNamespaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNamespaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Namespace ID +func (id NamespaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Namespace ID +func (id NamespaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + } +} + +// String returns a human-readable description of this Namespace ID +func (id NamespaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + } + return fmt.Sprintf("Namespace (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_breakpairing_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_breakpairing_autorest.go new file mode 100644 index 00000000000..4a8d52a71e9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_breakpairing_autorest.go @@ -0,0 +1,67 @@ +package disasterrecoveryconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BreakPairingOperationResponse struct { + HttpResponse *http.Response +} + +// BreakPairing ... +func (c DisasterRecoveryConfigsClient) BreakPairing(ctx context.Context, id DisasterRecoveryConfigId) (result BreakPairingOperationResponse, err error) { + req, err := c.preparerForBreakPairing(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "BreakPairing", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "BreakPairing", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForBreakPairing(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "BreakPairing", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForBreakPairing prepares the BreakPairing request. +func (c DisasterRecoveryConfigsClient) preparerForBreakPairing(ctx context.Context, id DisasterRecoveryConfigId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/breakPairing", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForBreakPairing handles the response to the BreakPairing request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForBreakPairing(resp *http.Response) (result BreakPairingOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_checknameavailability_autorest.go new file mode 100644 index 00000000000..fcaeecddafc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_checknameavailability_autorest.go @@ -0,0 +1,70 @@ +package disasterrecoveryconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameAvailabilityResult +} + +// CheckNameAvailability ... +func (c DisasterRecoveryConfigsClient) CheckNameAvailability(ctx context.Context, id NamespaceId, input CheckNameAvailability) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c DisasterRecoveryConfigsClient) preparerForCheckNameAvailability(ctx context.Context, id NamespaceId, input CheckNameAvailability) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/disasterRecoveryConfigs/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_createorupdate_autorest.go new file mode 100644 index 00000000000..3f67b7cfe66 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package disasterrecoveryconfigs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *ArmDisasterRecovery +} + +// CreateOrUpdate ... +func (c DisasterRecoveryConfigsClient) CreateOrUpdate(ctx context.Context, id DisasterRecoveryConfigId, input ArmDisasterRecovery) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c DisasterRecoveryConfigsClient) preparerForCreateOrUpdate(ctx context.Context, id DisasterRecoveryConfigId, input ArmDisasterRecovery) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_delete_autorest.go new file mode 100644 index 00000000000..da4788c183a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_delete_autorest.go @@ -0,0 +1,66 @@ +package disasterrecoveryconfigs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c DisasterRecoveryConfigsClient) Delete(ctx context.Context, id DisasterRecoveryConfigId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c DisasterRecoveryConfigsClient) preparerForDelete(ctx context.Context, id DisasterRecoveryConfigId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_failover_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_failover_autorest.go new file mode 100644 index 00000000000..3ab413cb9f2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_failover_autorest.go @@ -0,0 +1,68 @@ +package disasterrecoveryconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FailOverOperationResponse struct { + HttpResponse *http.Response +} + +// FailOver ... +func (c DisasterRecoveryConfigsClient) FailOver(ctx context.Context, id DisasterRecoveryConfigId, input FailoverProperties) (result FailOverOperationResponse, err error) { + req, err := c.preparerForFailOver(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "FailOver", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "FailOver", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForFailOver(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "FailOver", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForFailOver prepares the FailOver request. +func (c DisasterRecoveryConfigsClient) preparerForFailOver(ctx context.Context, id DisasterRecoveryConfigId, input FailoverProperties) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/failover", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForFailOver handles the response to the FailOver request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForFailOver(resp *http.Response) (result FailOverOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_get_autorest.go new file mode 100644 index 00000000000..9bfdb91343b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_get_autorest.go @@ -0,0 +1,68 @@ +package disasterrecoveryconfigs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ArmDisasterRecovery +} + +// Get ... +func (c DisasterRecoveryConfigsClient) Get(ctx context.Context, id DisasterRecoveryConfigId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DisasterRecoveryConfigsClient) preparerForGet(ctx context.Context, id DisasterRecoveryConfigId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_getauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_getauthorizationrule_autorest.go new file mode 100644 index 00000000000..8d87a8c3e4e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_getauthorizationrule_autorest.go @@ -0,0 +1,68 @@ +package disasterrecoveryconfigs + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *SBAuthorizationRule +} + +// GetAuthorizationRule ... +func (c DisasterRecoveryConfigsClient) GetAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (result GetAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForGetAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "GetAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "GetAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "GetAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetAuthorizationRule prepares the GetAuthorizationRule request. +func (c DisasterRecoveryConfigsClient) preparerForGetAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetAuthorizationRule handles the response to the GetAuthorizationRule request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForGetAuthorizationRule(resp *http.Response) (result GetAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_list_autorest.go new file mode 100644 index 00000000000..8c260919410 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_list_autorest.go @@ -0,0 +1,186 @@ +package disasterrecoveryconfigs + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]ArmDisasterRecovery + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []ArmDisasterRecovery +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c DisasterRecoveryConfigsClient) List(ctx context.Context, id NamespaceId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c DisasterRecoveryConfigsClient) preparerForList(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/disasterRecoveryConfigs", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c DisasterRecoveryConfigsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []ArmDisasterRecovery `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c DisasterRecoveryConfigsClient) ListComplete(ctx context.Context, id NamespaceId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ArmDisasterRecoveryOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DisasterRecoveryConfigsClient) ListCompleteMatchingPredicate(ctx context.Context, id NamespaceId, predicate ArmDisasterRecoveryOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]ArmDisasterRecovery, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_listauthorizationrules_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_listauthorizationrules_autorest.go new file mode 100644 index 00000000000..15c372a6dbb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_listauthorizationrules_autorest.go @@ -0,0 +1,186 @@ +package disasterrecoveryconfigs + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAuthorizationRulesOperationResponse struct { + HttpResponse *http.Response + Model *[]SBAuthorizationRule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListAuthorizationRulesOperationResponse, error) +} + +type ListAuthorizationRulesCompleteResult struct { + Items []SBAuthorizationRule +} + +func (r ListAuthorizationRulesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListAuthorizationRulesOperationResponse) LoadMore(ctx context.Context) (resp ListAuthorizationRulesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListAuthorizationRules ... +func (c DisasterRecoveryConfigsClient) ListAuthorizationRules(ctx context.Context, id DisasterRecoveryConfigId) (resp ListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForListAuthorizationRules(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "ListAuthorizationRules", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListAuthorizationRules(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "ListAuthorizationRules", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListAuthorizationRules prepares the ListAuthorizationRules request. +func (c DisasterRecoveryConfigsClient) preparerForListAuthorizationRules(ctx context.Context, id DisasterRecoveryConfigId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/authorizationRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListAuthorizationRulesWithNextLink prepares the ListAuthorizationRules request with the given nextLink token. +func (c DisasterRecoveryConfigsClient) preparerForListAuthorizationRulesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListAuthorizationRules handles the response to the ListAuthorizationRules request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForListAuthorizationRules(resp *http.Response) (result ListAuthorizationRulesOperationResponse, err error) { + type page struct { + Values []SBAuthorizationRule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForListAuthorizationRulesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "ListAuthorizationRules", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "ListAuthorizationRules", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListAuthorizationRules(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "ListAuthorizationRules", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListAuthorizationRulesComplete retrieves all of the results into a single object +func (c DisasterRecoveryConfigsClient) ListAuthorizationRulesComplete(ctx context.Context, id DisasterRecoveryConfigId) (ListAuthorizationRulesCompleteResult, error) { + return c.ListAuthorizationRulesCompleteMatchingPredicate(ctx, id, SBAuthorizationRuleOperationPredicate{}) +} + +// ListAuthorizationRulesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c DisasterRecoveryConfigsClient) ListAuthorizationRulesCompleteMatchingPredicate(ctx context.Context, id DisasterRecoveryConfigId, predicate SBAuthorizationRuleOperationPredicate) (resp ListAuthorizationRulesCompleteResult, err error) { + items := make([]SBAuthorizationRule, 0) + + page, err := c.ListAuthorizationRules(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListAuthorizationRulesCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_listkeys_autorest.go new file mode 100644 index 00000000000..dceb8e569f5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/method_listkeys_autorest.go @@ -0,0 +1,69 @@ +package disasterrecoveryconfigs + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeysOperationResponse struct { + HttpResponse *http.Response + Model *AccessKeys +} + +// ListKeys ... +func (c DisasterRecoveryConfigsClient) ListKeys(ctx context.Context, id AuthorizationRuleId) (result ListKeysOperationResponse, err error) { + req, err := c.preparerForListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "ListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "ListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "ListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListKeys prepares the ListKeys request. +func (c DisasterRecoveryConfigsClient) preparerForListKeys(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListKeys handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (c DisasterRecoveryConfigsClient) responderForListKeys(resp *http.Response) (result ListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_accesskeys.go new file mode 100644 index 00000000000..b3e1e8186bf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_accesskeys.go @@ -0,0 +1,14 @@ +package disasterrecoveryconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeys struct { + AliasPrimaryConnectionString *string `json:"aliasPrimaryConnectionString,omitempty"` + AliasSecondaryConnectionString *string `json:"aliasSecondaryConnectionString,omitempty"` + KeyName *string `json:"keyName,omitempty"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_armdisasterrecovery.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_armdisasterrecovery.go new file mode 100644 index 00000000000..1300a4b02e9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_armdisasterrecovery.go @@ -0,0 +1,16 @@ +package disasterrecoveryconfigs + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArmDisasterRecovery struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ArmDisasterRecoveryProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_armdisasterrecoveryproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_armdisasterrecoveryproperties.go new file mode 100644 index 00000000000..233aac5a3e8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_armdisasterrecoveryproperties.go @@ -0,0 +1,12 @@ +package disasterrecoveryconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ArmDisasterRecoveryProperties struct { + AlternateName *string `json:"alternateName,omitempty"` + PartnerNamespace *string `json:"partnerNamespace,omitempty"` + PendingReplicationOperationsCount *int64 `json:"pendingReplicationOperationsCount,omitempty"` + ProvisioningState *ProvisioningStateDR `json:"provisioningState,omitempty"` + Role *RoleDisasterRecovery `json:"role,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_checknameavailability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_checknameavailability.go new file mode 100644 index 00000000000..ce3efaa22e3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_checknameavailability.go @@ -0,0 +1,8 @@ +package disasterrecoveryconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailability struct { + Name string `json:"name"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_checknameavailabilityresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_checknameavailabilityresult.go new file mode 100644 index 00000000000..5704fc33d00 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_checknameavailabilityresult.go @@ -0,0 +1,10 @@ +package disasterrecoveryconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityResult struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *UnavailableReason `json:"reason,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_failoverproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_failoverproperties.go new file mode 100644 index 00000000000..b9f9dc735b7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_failoverproperties.go @@ -0,0 +1,8 @@ +package disasterrecoveryconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FailoverProperties struct { + Properties *FailoverPropertiesProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_failoverpropertiesproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_failoverpropertiesproperties.go new file mode 100644 index 00000000000..1d6aa6a722a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_failoverpropertiesproperties.go @@ -0,0 +1,8 @@ +package disasterrecoveryconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FailoverPropertiesProperties struct { + IsSafeFailover *bool `json:"IsSafeFailover,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_sbauthorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_sbauthorizationrule.go new file mode 100644 index 00000000000..71eeb750ccb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_sbauthorizationrule.go @@ -0,0 +1,16 @@ +package disasterrecoveryconfigs + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBAuthorizationRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SBAuthorizationRuleProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_sbauthorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_sbauthorizationruleproperties.go new file mode 100644 index 00000000000..eb27b8c1a6c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/model_sbauthorizationruleproperties.go @@ -0,0 +1,8 @@ +package disasterrecoveryconfigs + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBAuthorizationRuleProperties struct { + Rights []AccessRights `json:"rights"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/predicates.go new file mode 100644 index 00000000000..b8bdab69f2b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/predicates.go @@ -0,0 +1,47 @@ +package disasterrecoveryconfigs + +type ArmDisasterRecoveryOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ArmDisasterRecoveryOperationPredicate) Matches(input ArmDisasterRecovery) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type SBAuthorizationRuleOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SBAuthorizationRuleOperationPredicate) Matches(input SBAuthorizationRule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/version.go new file mode 100644 index 00000000000..36f568cd68c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/version.go @@ -0,0 +1,12 @@ +package disasterrecoveryconfigs + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/disasterrecoveryconfigs/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/README.md new file mode 100644 index 00000000000..9f7abbbb6d4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/README.md @@ -0,0 +1,195 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces` Documentation + +The `namespaces` SDK allows for interaction with the Azure Resource Manager Service `servicebus` (API Version `2021-06-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" +``` + + +### Client Initialization + +```go +client := namespaces.NewNamespacesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NamespacesClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := namespaces.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := namespaces.CheckNameAvailability{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +payload := namespaces.SBNamespace{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `NamespacesClient.CreateOrUpdateNetworkRuleSet` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +payload := namespaces.NetworkRuleSet{ + // ... +} + + +read, err := client.CreateOrUpdateNetworkRuleSet(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.Delete` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `NamespacesClient.Get` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.GetNetworkRuleSet` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +read, err := client.GetNetworkRuleSet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesClient.List` + +```go +ctx := context.TODO() +id := namespaces.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NamespacesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := namespaces.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NamespacesClient.ListNetworkRuleSets` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +// alternatively `client.ListNetworkRuleSets(ctx, id)` can be used to do batched pagination +items, err := client.ListNetworkRuleSetsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NamespacesClient.Update` + +```go +ctx := context.TODO() +id := namespaces.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +payload := namespaces.SBNamespaceUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/client.go new file mode 100644 index 00000000000..bf25155c419 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/client.go @@ -0,0 +1,18 @@ +package namespaces + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesClient struct { + Client autorest.Client + baseUri string +} + +func NewNamespacesClientWithBaseURI(endpoint string) NamespacesClient { + return NamespacesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/constants.go new file mode 100644 index 00000000000..20327b00897 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/constants.go @@ -0,0 +1,288 @@ +package namespaces + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DefaultAction string + +const ( + DefaultActionAllow DefaultAction = "Allow" + DefaultActionDeny DefaultAction = "Deny" +) + +func PossibleValuesForDefaultAction() []string { + return []string{ + string(DefaultActionAllow), + string(DefaultActionDeny), + } +} + +func parseDefaultAction(input string) (*DefaultAction, error) { + vals := map[string]DefaultAction{ + "allow": DefaultActionAllow, + "deny": DefaultActionDeny, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DefaultAction(input) + return &out, nil +} + +type EndPointProvisioningState string + +const ( + EndPointProvisioningStateCanceled EndPointProvisioningState = "Canceled" + EndPointProvisioningStateCreating EndPointProvisioningState = "Creating" + EndPointProvisioningStateDeleting EndPointProvisioningState = "Deleting" + EndPointProvisioningStateFailed EndPointProvisioningState = "Failed" + EndPointProvisioningStateSucceeded EndPointProvisioningState = "Succeeded" + EndPointProvisioningStateUpdating EndPointProvisioningState = "Updating" +) + +func PossibleValuesForEndPointProvisioningState() []string { + return []string{ + string(EndPointProvisioningStateCanceled), + string(EndPointProvisioningStateCreating), + string(EndPointProvisioningStateDeleting), + string(EndPointProvisioningStateFailed), + string(EndPointProvisioningStateSucceeded), + string(EndPointProvisioningStateUpdating), + } +} + +func parseEndPointProvisioningState(input string) (*EndPointProvisioningState, error) { + vals := map[string]EndPointProvisioningState{ + "canceled": EndPointProvisioningStateCanceled, + "creating": EndPointProvisioningStateCreating, + "deleting": EndPointProvisioningStateDeleting, + "failed": EndPointProvisioningStateFailed, + "succeeded": EndPointProvisioningStateSucceeded, + "updating": EndPointProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EndPointProvisioningState(input) + return &out, nil +} + +type KeySource string + +const ( + KeySourceMicrosoftPointKeyVault KeySource = "Microsoft.KeyVault" +) + +func PossibleValuesForKeySource() []string { + return []string{ + string(KeySourceMicrosoftPointKeyVault), + } +} + +func parseKeySource(input string) (*KeySource, error) { + vals := map[string]KeySource{ + "microsoft.keyvault": KeySourceMicrosoftPointKeyVault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeySource(input) + return &out, nil +} + +type NetworkRuleIPAction string + +const ( + NetworkRuleIPActionAllow NetworkRuleIPAction = "Allow" +) + +func PossibleValuesForNetworkRuleIPAction() []string { + return []string{ + string(NetworkRuleIPActionAllow), + } +} + +func parseNetworkRuleIPAction(input string) (*NetworkRuleIPAction, error) { + vals := map[string]NetworkRuleIPAction{ + "allow": NetworkRuleIPActionAllow, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkRuleIPAction(input) + return &out, nil +} + +type PrivateLinkConnectionStatus string + +const ( + PrivateLinkConnectionStatusApproved PrivateLinkConnectionStatus = "Approved" + PrivateLinkConnectionStatusDisconnected PrivateLinkConnectionStatus = "Disconnected" + PrivateLinkConnectionStatusPending PrivateLinkConnectionStatus = "Pending" + PrivateLinkConnectionStatusRejected PrivateLinkConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkConnectionStatus() []string { + return []string{ + string(PrivateLinkConnectionStatusApproved), + string(PrivateLinkConnectionStatusDisconnected), + string(PrivateLinkConnectionStatusPending), + string(PrivateLinkConnectionStatusRejected), + } +} + +func parsePrivateLinkConnectionStatus(input string) (*PrivateLinkConnectionStatus, error) { + vals := map[string]PrivateLinkConnectionStatus{ + "approved": PrivateLinkConnectionStatusApproved, + "disconnected": PrivateLinkConnectionStatusDisconnected, + "pending": PrivateLinkConnectionStatusPending, + "rejected": PrivateLinkConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkConnectionStatus(input) + return &out, nil +} + +type PublicNetworkAccessFlag string + +const ( + PublicNetworkAccessFlagDisabled PublicNetworkAccessFlag = "Disabled" + PublicNetworkAccessFlagEnabled PublicNetworkAccessFlag = "Enabled" +) + +func PossibleValuesForPublicNetworkAccessFlag() []string { + return []string{ + string(PublicNetworkAccessFlagDisabled), + string(PublicNetworkAccessFlagEnabled), + } +} + +func parsePublicNetworkAccessFlag(input string) (*PublicNetworkAccessFlag, error) { + vals := map[string]PublicNetworkAccessFlag{ + "disabled": PublicNetworkAccessFlagDisabled, + "enabled": PublicNetworkAccessFlagEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccessFlag(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameBasic SkuName = "Basic" + SkuNamePremium SkuName = "Premium" + SkuNameStandard SkuName = "Standard" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameBasic), + string(SkuNamePremium), + string(SkuNameStandard), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "basic": SkuNameBasic, + "premium": SkuNamePremium, + "standard": SkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} + +type SkuTier string + +const ( + SkuTierBasic SkuTier = "Basic" + SkuTierPremium SkuTier = "Premium" + SkuTierStandard SkuTier = "Standard" +) + +func PossibleValuesForSkuTier() []string { + return []string{ + string(SkuTierBasic), + string(SkuTierPremium), + string(SkuTierStandard), + } +} + +func parseSkuTier(input string) (*SkuTier, error) { + vals := map[string]SkuTier{ + "basic": SkuTierBasic, + "premium": SkuTierPremium, + "standard": SkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuTier(input) + return &out, nil +} + +type UnavailableReason string + +const ( + UnavailableReasonInvalidName UnavailableReason = "InvalidName" + UnavailableReasonNameInLockdown UnavailableReason = "NameInLockdown" + UnavailableReasonNameInUse UnavailableReason = "NameInUse" + UnavailableReasonNone UnavailableReason = "None" + UnavailableReasonSubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" + UnavailableReasonTooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" +) + +func PossibleValuesForUnavailableReason() []string { + return []string{ + string(UnavailableReasonInvalidName), + string(UnavailableReasonNameInLockdown), + string(UnavailableReasonNameInUse), + string(UnavailableReasonNone), + string(UnavailableReasonSubscriptionIsDisabled), + string(UnavailableReasonTooManyNamespaceInCurrentSubscription), + } +} + +func parseUnavailableReason(input string) (*UnavailableReason, error) { + vals := map[string]UnavailableReason{ + "invalidname": UnavailableReasonInvalidName, + "nameinlockdown": UnavailableReasonNameInLockdown, + "nameinuse": UnavailableReasonNameInUse, + "none": UnavailableReasonNone, + "subscriptionisdisabled": UnavailableReasonSubscriptionIsDisabled, + "toomanynamespaceincurrentsubscription": UnavailableReasonTooManyNamespaceInCurrentSubscription, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UnavailableReason(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/id_namespace.go new file mode 100644 index 00000000000..5157c14e197 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/id_namespace.go @@ -0,0 +1,124 @@ +package namespaces + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NamespaceId{} + +// NamespaceId is a struct representing the Resource ID for a Namespace +type NamespaceId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string +} + +// NewNamespaceID returns a new NamespaceId struct +func NewNamespaceID(subscriptionId string, resourceGroupName string, namespaceName string) NamespaceId { + return NamespaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + } +} + +// ParseNamespaceID parses 'input' into a NamespaceId +func ParseNamespaceID(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNamespaceIDInsensitively parses 'input' case-insensitively into a NamespaceId +// note: this method should only be used for API response data and not user input +func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID +func ValidateNamespaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNamespaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Namespace ID +func (id NamespaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Namespace ID +func (id NamespaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + } +} + +// String returns a human-readable description of this Namespace ID +func (id NamespaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + } + return fmt.Sprintf("Namespace (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_checknameavailability_autorest.go new file mode 100644 index 00000000000..ba52d279246 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_checknameavailability_autorest.go @@ -0,0 +1,71 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameAvailabilityResult +} + +// CheckNameAvailability ... +func (c NamespacesClient) CheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckNameAvailability) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c NamespacesClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckNameAvailability) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ServiceBus/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_createorupdate_autorest.go new file mode 100644 index 00000000000..dd5c74b4b2f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c NamespacesClient) CreateOrUpdate(ctx context.Context, id NamespaceId, input SBNamespace) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c NamespacesClient) CreateOrUpdateThenPoll(ctx context.Context, id NamespaceId, input SBNamespace) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c NamespacesClient) preparerForCreateOrUpdate(ctx context.Context, id NamespaceId, input SBNamespace) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c NamespacesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_createorupdatenetworkruleset_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_createorupdatenetworkruleset_autorest.go new file mode 100644 index 00000000000..5c25e67a347 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_createorupdatenetworkruleset_autorest.go @@ -0,0 +1,70 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateNetworkRuleSetOperationResponse struct { + HttpResponse *http.Response + Model *NetworkRuleSet +} + +// CreateOrUpdateNetworkRuleSet ... +func (c NamespacesClient) CreateOrUpdateNetworkRuleSet(ctx context.Context, id NamespaceId, input NetworkRuleSet) (result CreateOrUpdateNetworkRuleSetOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdateNetworkRuleSet(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdateNetworkRuleSet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdateNetworkRuleSet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdateNetworkRuleSet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdateNetworkRuleSet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdateNetworkRuleSet prepares the CreateOrUpdateNetworkRuleSet request. +func (c NamespacesClient) preparerForCreateOrUpdateNetworkRuleSet(ctx context.Context, id NamespaceId, input NetworkRuleSet) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/networkRuleSets/default", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdateNetworkRuleSet handles the response to the CreateOrUpdateNetworkRuleSet request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForCreateOrUpdateNetworkRuleSet(resp *http.Response) (result CreateOrUpdateNetworkRuleSetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_delete_autorest.go new file mode 100644 index 00000000000..968dfe754f2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_delete_autorest.go @@ -0,0 +1,78 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c NamespacesClient) Delete(ctx context.Context, id NamespaceId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c NamespacesClient) DeleteThenPoll(ctx context.Context, id NamespaceId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c NamespacesClient) preparerForDelete(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c NamespacesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_get_autorest.go new file mode 100644 index 00000000000..54e7e06d307 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_get_autorest.go @@ -0,0 +1,68 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *SBNamespace +} + +// Get ... +func (c NamespacesClient) Get(ctx context.Context, id NamespaceId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c NamespacesClient) preparerForGet(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_getnetworkruleset_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_getnetworkruleset_autorest.go new file mode 100644 index 00000000000..ce51bb141b1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_getnetworkruleset_autorest.go @@ -0,0 +1,69 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetNetworkRuleSetOperationResponse struct { + HttpResponse *http.Response + Model *NetworkRuleSet +} + +// GetNetworkRuleSet ... +func (c NamespacesClient) GetNetworkRuleSet(ctx context.Context, id NamespaceId) (result GetNetworkRuleSetOperationResponse, err error) { + req, err := c.preparerForGetNetworkRuleSet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "GetNetworkRuleSet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "GetNetworkRuleSet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGetNetworkRuleSet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "GetNetworkRuleSet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGetNetworkRuleSet prepares the GetNetworkRuleSet request. +func (c NamespacesClient) preparerForGetNetworkRuleSet(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/networkRuleSets/default", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGetNetworkRuleSet handles the response to the GetNetworkRuleSet request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForGetNetworkRuleSet(resp *http.Response) (result GetNetworkRuleSetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_list_autorest.go new file mode 100644 index 00000000000..718a613dd9c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_list_autorest.go @@ -0,0 +1,187 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]SBNamespace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []SBNamespace +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c NamespacesClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c NamespacesClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ServiceBus/namespaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c NamespacesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []SBNamespace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c NamespacesClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, SBNamespaceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NamespacesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate SBNamespaceOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]SBNamespace, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..079db544744 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]SBNamespace + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []SBNamespace +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c NamespacesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c NamespacesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ServiceBus/namespaces", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c NamespacesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []SBNamespace `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c NamespacesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, SBNamespaceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NamespacesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate SBNamespaceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]SBNamespace, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_listnetworkrulesets_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_listnetworkrulesets_autorest.go new file mode 100644 index 00000000000..0310c543727 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_listnetworkrulesets_autorest.go @@ -0,0 +1,186 @@ +package namespaces + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListNetworkRuleSetsOperationResponse struct { + HttpResponse *http.Response + Model *[]NetworkRuleSet + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListNetworkRuleSetsOperationResponse, error) +} + +type ListNetworkRuleSetsCompleteResult struct { + Items []NetworkRuleSet +} + +func (r ListNetworkRuleSetsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListNetworkRuleSetsOperationResponse) LoadMore(ctx context.Context) (resp ListNetworkRuleSetsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListNetworkRuleSets ... +func (c NamespacesClient) ListNetworkRuleSets(ctx context.Context, id NamespaceId) (resp ListNetworkRuleSetsOperationResponse, err error) { + req, err := c.preparerForListNetworkRuleSets(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListNetworkRuleSets", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListNetworkRuleSets", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListNetworkRuleSets(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListNetworkRuleSets", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListNetworkRuleSets prepares the ListNetworkRuleSets request. +func (c NamespacesClient) preparerForListNetworkRuleSets(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/networkRuleSets", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListNetworkRuleSetsWithNextLink prepares the ListNetworkRuleSets request with the given nextLink token. +func (c NamespacesClient) preparerForListNetworkRuleSetsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListNetworkRuleSets handles the response to the ListNetworkRuleSets request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForListNetworkRuleSets(resp *http.Response) (result ListNetworkRuleSetsOperationResponse, err error) { + type page struct { + Values []NetworkRuleSet `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListNetworkRuleSetsOperationResponse, err error) { + req, err := c.preparerForListNetworkRuleSetsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListNetworkRuleSets", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListNetworkRuleSets", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListNetworkRuleSets(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListNetworkRuleSets", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListNetworkRuleSetsComplete retrieves all of the results into a single object +func (c NamespacesClient) ListNetworkRuleSetsComplete(ctx context.Context, id NamespaceId) (ListNetworkRuleSetsCompleteResult, error) { + return c.ListNetworkRuleSetsCompleteMatchingPredicate(ctx, id, NetworkRuleSetOperationPredicate{}) +} + +// ListNetworkRuleSetsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NamespacesClient) ListNetworkRuleSetsCompleteMatchingPredicate(ctx context.Context, id NamespaceId, predicate NetworkRuleSetOperationPredicate) (resp ListNetworkRuleSetsCompleteResult, err error) { + items := make([]NetworkRuleSet, 0) + + page, err := c.ListNetworkRuleSets(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListNetworkRuleSetsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_update_autorest.go new file mode 100644 index 00000000000..14cdf13d14d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/method_update_autorest.go @@ -0,0 +1,69 @@ +package namespaces + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *SBNamespace +} + +// Update ... +func (c NamespacesClient) Update(ctx context.Context, id NamespaceId, input SBNamespaceUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c NamespacesClient) preparerForUpdate(ctx context.Context, id NamespaceId, input SBNamespaceUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c NamespacesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_checknameavailability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_checknameavailability.go new file mode 100644 index 00000000000..611253e0b83 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_checknameavailability.go @@ -0,0 +1,8 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailability struct { + Name string `json:"name"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_checknameavailabilityresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_checknameavailabilityresult.go new file mode 100644 index 00000000000..9d301c5d67a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_checknameavailabilityresult.go @@ -0,0 +1,10 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityResult struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *UnavailableReason `json:"reason,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_connectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_connectionstate.go new file mode 100644 index 00000000000..022aa980deb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_connectionstate.go @@ -0,0 +1,9 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectionState struct { + Description *string `json:"description,omitempty"` + Status *PrivateLinkConnectionStatus `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_encryption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_encryption.go new file mode 100644 index 00000000000..c33fdbc6fad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_encryption.go @@ -0,0 +1,10 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Encryption struct { + KeySource *KeySource `json:"keySource,omitempty"` + KeyVaultProperties *[]KeyVaultProperties `json:"keyVaultProperties,omitempty"` + RequireInfrastructureEncryption *bool `json:"requireInfrastructureEncryption,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_keyvaultproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_keyvaultproperties.go new file mode 100644 index 00000000000..b0dfb9a4e06 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_keyvaultproperties.go @@ -0,0 +1,11 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultProperties struct { + Identity *UserAssignedIdentityProperties `json:"identity,omitempty"` + KeyName *string `json:"keyName,omitempty"` + KeyVaultUri *string `json:"keyVaultUri,omitempty"` + KeyVersion *string `json:"keyVersion,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_networkruleset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_networkruleset.go new file mode 100644 index 00000000000..de435f2efd1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_networkruleset.go @@ -0,0 +1,16 @@ +package namespaces + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkRuleSet struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *NetworkRuleSetProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_networkrulesetproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_networkrulesetproperties.go new file mode 100644 index 00000000000..a787f87184d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_networkrulesetproperties.go @@ -0,0 +1,12 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkRuleSetProperties struct { + DefaultAction *DefaultAction `json:"defaultAction,omitempty"` + IPRules *[]NWRuleSetIPRules `json:"ipRules,omitempty"` + PublicNetworkAccess *PublicNetworkAccessFlag `json:"publicNetworkAccess,omitempty"` + TrustedServiceAccessEnabled *bool `json:"trustedServiceAccessEnabled,omitempty"` + VirtualNetworkRules *[]NWRuleSetVirtualNetworkRules `json:"virtualNetworkRules,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_nwrulesetiprules.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_nwrulesetiprules.go new file mode 100644 index 00000000000..0cd59cd53dc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_nwrulesetiprules.go @@ -0,0 +1,9 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NWRuleSetIPRules struct { + Action *NetworkRuleIPAction `json:"action,omitempty"` + IPMask *string `json:"ipMask,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_nwrulesetvirtualnetworkrules.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_nwrulesetvirtualnetworkrules.go new file mode 100644 index 00000000000..284f1c7eaba --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_nwrulesetvirtualnetworkrules.go @@ -0,0 +1,9 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NWRuleSetVirtualNetworkRules struct { + IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` + Subnet *Subnet `json:"subnet,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_privateendpoint.go new file mode 100644 index 00000000000..3dec0387e5f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_privateendpoint.go @@ -0,0 +1,8 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_privateendpointconnection.go new file mode 100644 index 00000000000..d60671cf999 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_privateendpointconnection.go @@ -0,0 +1,16 @@ +package namespaces + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..e0aa15c5957 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *ConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *EndPointProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_sbnamespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_sbnamespace.go new file mode 100644 index 00000000000..396988a40b8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_sbnamespace.go @@ -0,0 +1,21 @@ +package namespaces + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBNamespace struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *SBNamespaceProperties `json:"properties,omitempty"` + Sku *SBSku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_sbnamespaceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_sbnamespaceproperties.go new file mode 100644 index 00000000000..8d542149d69 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_sbnamespaceproperties.go @@ -0,0 +1,47 @@ +package namespaces + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBNamespaceProperties struct { + CreatedAt *string `json:"createdAt,omitempty"` + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + Encryption *Encryption `json:"encryption,omitempty"` + MetricId *string `json:"metricId,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` + Status *string `json:"status,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` +} + +func (o *SBNamespaceProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SBNamespaceProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *SBNamespaceProperties) GetUpdatedAtAsTime() (*time.Time, error) { + if o.UpdatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpdatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SBNamespaceProperties) SetUpdatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpdatedAt = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_sbnamespaceupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_sbnamespaceupdateparameters.go new file mode 100644 index 00000000000..777d5348737 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_sbnamespaceupdateparameters.go @@ -0,0 +1,19 @@ +package namespaces + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBNamespaceUpdateParameters struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SBNamespaceProperties `json:"properties,omitempty"` + Sku *SBSku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_sbsku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_sbsku.go new file mode 100644 index 00000000000..66999401376 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_sbsku.go @@ -0,0 +1,10 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBSku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name SkuName `json:"name"` + Tier *SkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_subnet.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_subnet.go new file mode 100644 index 00000000000..41882948008 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_subnet.go @@ -0,0 +1,8 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Subnet struct { + Id string `json:"id"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_userassignedidentityproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_userassignedidentityproperties.go new file mode 100644 index 00000000000..0685aa3ea14 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/model_userassignedidentityproperties.go @@ -0,0 +1,8 @@ +package namespaces + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserAssignedIdentityProperties struct { + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/predicates.go new file mode 100644 index 00000000000..b944fa7149b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/predicates.go @@ -0,0 +1,52 @@ +package namespaces + +type NetworkRuleSetOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p NetworkRuleSetOperationPredicate) Matches(input NetworkRuleSet) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type SBNamespaceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p SBNamespaceOperationPredicate) Matches(input SBNamespace) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/version.go new file mode 100644 index 00000000000..90d6cc83354 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces/version.go @@ -0,0 +1,12 @@ +package namespaces + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/namespaces/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/README.md new file mode 100644 index 00000000000..d0b6b63a623 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule` Documentation + +The `namespacesauthorizationrule` SDK allows for interaction with the Azure Resource Manager Service `servicebus` (API Version `2021-06-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule" +``` + + +### Client Initialization + +```go +client := namespacesauthorizationrule.NewNamespacesAuthorizationRuleClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NamespacesAuthorizationRuleClient.NamespacesCreateOrUpdateAuthorizationRule` + +```go +ctx := context.TODO() +id := namespacesauthorizationrule.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +payload := namespacesauthorizationrule.SBAuthorizationRule{ + // ... +} + + +read, err := client.NamespacesCreateOrUpdateAuthorizationRule(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesAuthorizationRuleClient.NamespacesDeleteAuthorizationRule` + +```go +ctx := context.TODO() +id := namespacesauthorizationrule.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +read, err := client.NamespacesDeleteAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesAuthorizationRuleClient.NamespacesGetAuthorizationRule` + +```go +ctx := context.TODO() +id := namespacesauthorizationrule.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +read, err := client.NamespacesGetAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesAuthorizationRuleClient.NamespacesListAuthorizationRules` + +```go +ctx := context.TODO() +id := namespacesauthorizationrule.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +// alternatively `client.NamespacesListAuthorizationRules(ctx, id)` can be used to do batched pagination +items, err := client.NamespacesListAuthorizationRulesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NamespacesAuthorizationRuleClient.NamespacesListKeys` + +```go +ctx := context.TODO() +id := namespacesauthorizationrule.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +read, err := client.NamespacesListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NamespacesAuthorizationRuleClient.NamespacesRegenerateKeys` + +```go +ctx := context.TODO() +id := namespacesauthorizationrule.NewAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "authorizationRuleValue") + +payload := namespacesauthorizationrule.RegenerateAccessKeyParameters{ + // ... +} + + +read, err := client.NamespacesRegenerateKeys(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/client.go new file mode 100644 index 00000000000..e4aacfdfcd6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/client.go @@ -0,0 +1,18 @@ +package namespacesauthorizationrule + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesAuthorizationRuleClient struct { + Client autorest.Client + baseUri string +} + +func NewNamespacesAuthorizationRuleClientWithBaseURI(endpoint string) NamespacesAuthorizationRuleClient { + return NamespacesAuthorizationRuleClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/constants.go new file mode 100644 index 00000000000..9e833425f0b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/constants.go @@ -0,0 +1,65 @@ +package namespacesauthorizationrule + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessRights string + +const ( + AccessRightsListen AccessRights = "Listen" + AccessRightsManage AccessRights = "Manage" + AccessRightsSend AccessRights = "Send" +) + +func PossibleValuesForAccessRights() []string { + return []string{ + string(AccessRightsListen), + string(AccessRightsManage), + string(AccessRightsSend), + } +} + +func parseAccessRights(input string) (*AccessRights, error) { + vals := map[string]AccessRights{ + "listen": AccessRightsListen, + "manage": AccessRightsManage, + "send": AccessRightsSend, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessRights(input) + return &out, nil +} + +type KeyType string + +const ( + KeyTypePrimaryKey KeyType = "PrimaryKey" + KeyTypeSecondaryKey KeyType = "SecondaryKey" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypePrimaryKey), + string(KeyTypeSecondaryKey), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "primarykey": KeyTypePrimaryKey, + "secondarykey": KeyTypeSecondaryKey, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/id_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/id_authorizationrule.go new file mode 100644 index 00000000000..efd5e0b02d9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/id_authorizationrule.go @@ -0,0 +1,137 @@ +package namespacesauthorizationrule + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AuthorizationRuleId{} + +// AuthorizationRuleId is a struct representing the Resource ID for a Authorization Rule +type AuthorizationRuleId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + AuthorizationRuleName string +} + +// NewAuthorizationRuleID returns a new AuthorizationRuleId struct +func NewAuthorizationRuleID(subscriptionId string, resourceGroupName string, namespaceName string, authorizationRuleName string) AuthorizationRuleId { + return AuthorizationRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + AuthorizationRuleName: authorizationRuleName, + } +} + +// ParseAuthorizationRuleID parses 'input' into a AuthorizationRuleId +func ParseAuthorizationRuleID(input string) (*AuthorizationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(AuthorizationRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AuthorizationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAuthorizationRuleIDInsensitively parses 'input' case-insensitively into a AuthorizationRuleId +// note: this method should only be used for API response data and not user input +func ParseAuthorizationRuleIDInsensitively(input string) (*AuthorizationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(AuthorizationRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AuthorizationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAuthorizationRuleID checks that 'input' can be parsed as a Authorization Rule ID +func ValidateAuthorizationRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAuthorizationRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Authorization Rule ID +func (id AuthorizationRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/authorizationRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.AuthorizationRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Authorization Rule ID +func (id AuthorizationRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticAuthorizationRules", "authorizationRules", "authorizationRules"), + resourceids.UserSpecifiedSegment("authorizationRuleName", "authorizationRuleValue"), + } +} + +// String returns a human-readable description of this Authorization Rule ID +func (id AuthorizationRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Authorization Rule Name: %q", id.AuthorizationRuleName), + } + return fmt.Sprintf("Authorization Rule (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/id_namespace.go new file mode 100644 index 00000000000..f0bc18d1dbb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/id_namespace.go @@ -0,0 +1,124 @@ +package namespacesauthorizationrule + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NamespaceId{} + +// NamespaceId is a struct representing the Resource ID for a Namespace +type NamespaceId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string +} + +// NewNamespaceID returns a new NamespaceId struct +func NewNamespaceID(subscriptionId string, resourceGroupName string, namespaceName string) NamespaceId { + return NamespaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + } +} + +// ParseNamespaceID parses 'input' into a NamespaceId +func ParseNamespaceID(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNamespaceIDInsensitively parses 'input' case-insensitively into a NamespaceId +// note: this method should only be used for API response data and not user input +func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID +func ValidateNamespaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNamespaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Namespace ID +func (id NamespaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Namespace ID +func (id NamespaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + } +} + +// String returns a human-readable description of this Namespace ID +func (id NamespaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + } + return fmt.Sprintf("Namespace (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespacescreateorupdateauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespacescreateorupdateauthorizationrule_autorest.go new file mode 100644 index 00000000000..3907ae8e0b3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespacescreateorupdateauthorizationrule_autorest.go @@ -0,0 +1,69 @@ +package namespacesauthorizationrule + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesCreateOrUpdateAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *SBAuthorizationRule +} + +// NamespacesCreateOrUpdateAuthorizationRule ... +func (c NamespacesAuthorizationRuleClient) NamespacesCreateOrUpdateAuthorizationRule(ctx context.Context, id AuthorizationRuleId, input SBAuthorizationRule) (result NamespacesCreateOrUpdateAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForNamespacesCreateOrUpdateAuthorizationRule(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesCreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesCreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForNamespacesCreateOrUpdateAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesCreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForNamespacesCreateOrUpdateAuthorizationRule prepares the NamespacesCreateOrUpdateAuthorizationRule request. +func (c NamespacesAuthorizationRuleClient) preparerForNamespacesCreateOrUpdateAuthorizationRule(ctx context.Context, id AuthorizationRuleId, input SBAuthorizationRule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForNamespacesCreateOrUpdateAuthorizationRule handles the response to the NamespacesCreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (c NamespacesAuthorizationRuleClient) responderForNamespacesCreateOrUpdateAuthorizationRule(resp *http.Response) (result NamespacesCreateOrUpdateAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespacesdeleteauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespacesdeleteauthorizationrule_autorest.go new file mode 100644 index 00000000000..045435876a7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespacesdeleteauthorizationrule_autorest.go @@ -0,0 +1,66 @@ +package namespacesauthorizationrule + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesDeleteAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response +} + +// NamespacesDeleteAuthorizationRule ... +func (c NamespacesAuthorizationRuleClient) NamespacesDeleteAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (result NamespacesDeleteAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForNamespacesDeleteAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesDeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesDeleteAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForNamespacesDeleteAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesDeleteAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForNamespacesDeleteAuthorizationRule prepares the NamespacesDeleteAuthorizationRule request. +func (c NamespacesAuthorizationRuleClient) preparerForNamespacesDeleteAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForNamespacesDeleteAuthorizationRule handles the response to the NamespacesDeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (c NamespacesAuthorizationRuleClient) responderForNamespacesDeleteAuthorizationRule(resp *http.Response) (result NamespacesDeleteAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespacesgetauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespacesgetauthorizationrule_autorest.go new file mode 100644 index 00000000000..ca4ec7bf7b9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespacesgetauthorizationrule_autorest.go @@ -0,0 +1,68 @@ +package namespacesauthorizationrule + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesGetAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *SBAuthorizationRule +} + +// NamespacesGetAuthorizationRule ... +func (c NamespacesAuthorizationRuleClient) NamespacesGetAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (result NamespacesGetAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForNamespacesGetAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesGetAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesGetAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForNamespacesGetAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesGetAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForNamespacesGetAuthorizationRule prepares the NamespacesGetAuthorizationRule request. +func (c NamespacesAuthorizationRuleClient) preparerForNamespacesGetAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForNamespacesGetAuthorizationRule handles the response to the NamespacesGetAuthorizationRule request. The method always +// closes the http.Response Body. +func (c NamespacesAuthorizationRuleClient) responderForNamespacesGetAuthorizationRule(resp *http.Response) (result NamespacesGetAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespaceslistauthorizationrules_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespaceslistauthorizationrules_autorest.go new file mode 100644 index 00000000000..02b0a38a0ea --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespaceslistauthorizationrules_autorest.go @@ -0,0 +1,186 @@ +package namespacesauthorizationrule + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesListAuthorizationRulesOperationResponse struct { + HttpResponse *http.Response + Model *[]SBAuthorizationRule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (NamespacesListAuthorizationRulesOperationResponse, error) +} + +type NamespacesListAuthorizationRulesCompleteResult struct { + Items []SBAuthorizationRule +} + +func (r NamespacesListAuthorizationRulesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r NamespacesListAuthorizationRulesOperationResponse) LoadMore(ctx context.Context) (resp NamespacesListAuthorizationRulesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// NamespacesListAuthorizationRules ... +func (c NamespacesAuthorizationRuleClient) NamespacesListAuthorizationRules(ctx context.Context, id NamespaceId) (resp NamespacesListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForNamespacesListAuthorizationRules(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesListAuthorizationRules", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForNamespacesListAuthorizationRules(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesListAuthorizationRules", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForNamespacesListAuthorizationRules prepares the NamespacesListAuthorizationRules request. +func (c NamespacesAuthorizationRuleClient) preparerForNamespacesListAuthorizationRules(ctx context.Context, id NamespaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/authorizationRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForNamespacesListAuthorizationRulesWithNextLink prepares the NamespacesListAuthorizationRules request with the given nextLink token. +func (c NamespacesAuthorizationRuleClient) preparerForNamespacesListAuthorizationRulesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForNamespacesListAuthorizationRules handles the response to the NamespacesListAuthorizationRules request. The method always +// closes the http.Response Body. +func (c NamespacesAuthorizationRuleClient) responderForNamespacesListAuthorizationRules(resp *http.Response) (result NamespacesListAuthorizationRulesOperationResponse, err error) { + type page struct { + Values []SBAuthorizationRule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result NamespacesListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForNamespacesListAuthorizationRulesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesListAuthorizationRules", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesListAuthorizationRules", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForNamespacesListAuthorizationRules(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesListAuthorizationRules", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// NamespacesListAuthorizationRulesComplete retrieves all of the results into a single object +func (c NamespacesAuthorizationRuleClient) NamespacesListAuthorizationRulesComplete(ctx context.Context, id NamespaceId) (NamespacesListAuthorizationRulesCompleteResult, error) { + return c.NamespacesListAuthorizationRulesCompleteMatchingPredicate(ctx, id, SBAuthorizationRuleOperationPredicate{}) +} + +// NamespacesListAuthorizationRulesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NamespacesAuthorizationRuleClient) NamespacesListAuthorizationRulesCompleteMatchingPredicate(ctx context.Context, id NamespaceId, predicate SBAuthorizationRuleOperationPredicate) (resp NamespacesListAuthorizationRulesCompleteResult, err error) { + items := make([]SBAuthorizationRule, 0) + + page, err := c.NamespacesListAuthorizationRules(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := NamespacesListAuthorizationRulesCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespaceslistkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespaceslistkeys_autorest.go new file mode 100644 index 00000000000..27810e96585 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespaceslistkeys_autorest.go @@ -0,0 +1,69 @@ +package namespacesauthorizationrule + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesListKeysOperationResponse struct { + HttpResponse *http.Response + Model *AccessKeys +} + +// NamespacesListKeys ... +func (c NamespacesAuthorizationRuleClient) NamespacesListKeys(ctx context.Context, id AuthorizationRuleId) (result NamespacesListKeysOperationResponse, err error) { + req, err := c.preparerForNamespacesListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForNamespacesListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForNamespacesListKeys prepares the NamespacesListKeys request. +func (c NamespacesAuthorizationRuleClient) preparerForNamespacesListKeys(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForNamespacesListKeys handles the response to the NamespacesListKeys request. The method always +// closes the http.Response Body. +func (c NamespacesAuthorizationRuleClient) responderForNamespacesListKeys(resp *http.Response) (result NamespacesListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespacesregeneratekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespacesregeneratekeys_autorest.go new file mode 100644 index 00000000000..083feae5b8e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/method_namespacesregeneratekeys_autorest.go @@ -0,0 +1,70 @@ +package namespacesauthorizationrule + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NamespacesRegenerateKeysOperationResponse struct { + HttpResponse *http.Response + Model *AccessKeys +} + +// NamespacesRegenerateKeys ... +func (c NamespacesAuthorizationRuleClient) NamespacesRegenerateKeys(ctx context.Context, id AuthorizationRuleId, input RegenerateAccessKeyParameters) (result NamespacesRegenerateKeysOperationResponse, err error) { + req, err := c.preparerForNamespacesRegenerateKeys(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesRegenerateKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesRegenerateKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForNamespacesRegenerateKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "namespacesauthorizationrule.NamespacesAuthorizationRuleClient", "NamespacesRegenerateKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForNamespacesRegenerateKeys prepares the NamespacesRegenerateKeys request. +func (c NamespacesAuthorizationRuleClient) preparerForNamespacesRegenerateKeys(ctx context.Context, id AuthorizationRuleId, input RegenerateAccessKeyParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKeys", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForNamespacesRegenerateKeys handles the response to the NamespacesRegenerateKeys request. The method always +// closes the http.Response Body. +func (c NamespacesAuthorizationRuleClient) responderForNamespacesRegenerateKeys(resp *http.Response) (result NamespacesRegenerateKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/model_accesskeys.go new file mode 100644 index 00000000000..7c9ec150477 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/model_accesskeys.go @@ -0,0 +1,14 @@ +package namespacesauthorizationrule + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeys struct { + AliasPrimaryConnectionString *string `json:"aliasPrimaryConnectionString,omitempty"` + AliasSecondaryConnectionString *string `json:"aliasSecondaryConnectionString,omitempty"` + KeyName *string `json:"keyName,omitempty"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/model_regenerateaccesskeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/model_regenerateaccesskeyparameters.go new file mode 100644 index 00000000000..ec4bc454a57 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/model_regenerateaccesskeyparameters.go @@ -0,0 +1,9 @@ +package namespacesauthorizationrule + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateAccessKeyParameters struct { + Key *string `json:"key,omitempty"` + KeyType KeyType `json:"keyType"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/model_sbauthorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/model_sbauthorizationrule.go new file mode 100644 index 00000000000..dc46cb0f367 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/model_sbauthorizationrule.go @@ -0,0 +1,16 @@ +package namespacesauthorizationrule + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBAuthorizationRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SBAuthorizationRuleProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/model_sbauthorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/model_sbauthorizationruleproperties.go new file mode 100644 index 00000000000..ef02ce30456 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/model_sbauthorizationruleproperties.go @@ -0,0 +1,8 @@ +package namespacesauthorizationrule + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBAuthorizationRuleProperties struct { + Rights []AccessRights `json:"rights"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/predicates.go new file mode 100644 index 00000000000..a9141050f2a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/predicates.go @@ -0,0 +1,24 @@ +package namespacesauthorizationrule + +type SBAuthorizationRuleOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SBAuthorizationRuleOperationPredicate) Matches(input SBAuthorizationRule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/version.go new file mode 100644 index 00000000000..885c529038e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/version.go @@ -0,0 +1,12 @@ +package namespacesauthorizationrule + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/namespacesauthorizationrule/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/README.md new file mode 100644 index 00000000000..0e4e9288f7e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues` Documentation + +The `queues` SDK allows for interaction with the Azure Resource Manager Service `servicebus` (API Version `2021-06-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues" +``` + + +### Client Initialization + +```go +client := queues.NewQueuesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `QueuesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := queues.NewQueueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "queueValue") + +payload := queues.SBQueue{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `QueuesClient.Delete` + +```go +ctx := context.TODO() +id := queues.NewQueueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "queueValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `QueuesClient.Get` + +```go +ctx := context.TODO() +id := queues.NewQueueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "queueValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `QueuesClient.ListByNamespace` + +```go +ctx := context.TODO() +id := queues.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +// alternatively `client.ListByNamespace(ctx, id, queues.DefaultListByNamespaceOperationOptions())` can be used to do batched pagination +items, err := client.ListByNamespaceComplete(ctx, id, queues.DefaultListByNamespaceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/client.go new file mode 100644 index 00000000000..9f002f842f1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/client.go @@ -0,0 +1,18 @@ +package queues + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueuesClient struct { + Client autorest.Client + baseUri string +} + +func NewQueuesClientWithBaseURI(endpoint string) QueuesClient { + return QueuesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/constants.go new file mode 100644 index 00000000000..a7102ca2f17 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/constants.go @@ -0,0 +1,55 @@ +package queues + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EntityStatus string + +const ( + EntityStatusActive EntityStatus = "Active" + EntityStatusCreating EntityStatus = "Creating" + EntityStatusDeleting EntityStatus = "Deleting" + EntityStatusDisabled EntityStatus = "Disabled" + EntityStatusReceiveDisabled EntityStatus = "ReceiveDisabled" + EntityStatusRenaming EntityStatus = "Renaming" + EntityStatusRestoring EntityStatus = "Restoring" + EntityStatusSendDisabled EntityStatus = "SendDisabled" + EntityStatusUnknown EntityStatus = "Unknown" +) + +func PossibleValuesForEntityStatus() []string { + return []string{ + string(EntityStatusActive), + string(EntityStatusCreating), + string(EntityStatusDeleting), + string(EntityStatusDisabled), + string(EntityStatusReceiveDisabled), + string(EntityStatusRenaming), + string(EntityStatusRestoring), + string(EntityStatusSendDisabled), + string(EntityStatusUnknown), + } +} + +func parseEntityStatus(input string) (*EntityStatus, error) { + vals := map[string]EntityStatus{ + "active": EntityStatusActive, + "creating": EntityStatusCreating, + "deleting": EntityStatusDeleting, + "disabled": EntityStatusDisabled, + "receivedisabled": EntityStatusReceiveDisabled, + "renaming": EntityStatusRenaming, + "restoring": EntityStatusRestoring, + "senddisabled": EntityStatusSendDisabled, + "unknown": EntityStatusUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EntityStatus(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/id_namespace.go new file mode 100644 index 00000000000..03c340b86d4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/id_namespace.go @@ -0,0 +1,124 @@ +package queues + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NamespaceId{} + +// NamespaceId is a struct representing the Resource ID for a Namespace +type NamespaceId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string +} + +// NewNamespaceID returns a new NamespaceId struct +func NewNamespaceID(subscriptionId string, resourceGroupName string, namespaceName string) NamespaceId { + return NamespaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + } +} + +// ParseNamespaceID parses 'input' into a NamespaceId +func ParseNamespaceID(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNamespaceIDInsensitively parses 'input' case-insensitively into a NamespaceId +// note: this method should only be used for API response data and not user input +func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID +func ValidateNamespaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNamespaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Namespace ID +func (id NamespaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Namespace ID +func (id NamespaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + } +} + +// String returns a human-readable description of this Namespace ID +func (id NamespaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + } + return fmt.Sprintf("Namespace (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/id_queue.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/id_queue.go new file mode 100644 index 00000000000..db105521f86 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/id_queue.go @@ -0,0 +1,137 @@ +package queues + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = QueueId{} + +// QueueId is a struct representing the Resource ID for a Queue +type QueueId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + QueueName string +} + +// NewQueueID returns a new QueueId struct +func NewQueueID(subscriptionId string, resourceGroupName string, namespaceName string, queueName string) QueueId { + return QueueId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + QueueName: queueName, + } +} + +// ParseQueueID parses 'input' into a QueueId +func ParseQueueID(input string) (*QueueId, error) { + parser := resourceids.NewParserFromResourceIdType(QueueId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := QueueId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { + return nil, fmt.Errorf("the segment 'queueName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseQueueIDInsensitively parses 'input' case-insensitively into a QueueId +// note: this method should only be used for API response data and not user input +func ParseQueueIDInsensitively(input string) (*QueueId, error) { + parser := resourceids.NewParserFromResourceIdType(QueueId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := QueueId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { + return nil, fmt.Errorf("the segment 'queueName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateQueueID checks that 'input' can be parsed as a Queue ID +func ValidateQueueID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseQueueID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Queue ID +func (id QueueId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/queues/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.QueueName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Queue ID +func (id QueueId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticQueues", "queues", "queues"), + resourceids.UserSpecifiedSegment("queueName", "queueValue"), + } +} + +// String returns a human-readable description of this Queue ID +func (id QueueId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Queue Name: %q", id.QueueName), + } + return fmt.Sprintf("Queue (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/method_createorupdate_autorest.go new file mode 100644 index 00000000000..fdf0cc2a387 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package queues + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *SBQueue +} + +// CreateOrUpdate ... +func (c QueuesClient) CreateOrUpdate(ctx context.Context, id QueueId, input SBQueue) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.QueuesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.QueuesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.QueuesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c QueuesClient) preparerForCreateOrUpdate(ctx context.Context, id QueueId, input SBQueue) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c QueuesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/method_delete_autorest.go new file mode 100644 index 00000000000..301d080c94d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/method_delete_autorest.go @@ -0,0 +1,66 @@ +package queues + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c QueuesClient) Delete(ctx context.Context, id QueueId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.QueuesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.QueuesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.QueuesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c QueuesClient) preparerForDelete(ctx context.Context, id QueueId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c QueuesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/method_get_autorest.go new file mode 100644 index 00000000000..b64080bde71 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/method_get_autorest.go @@ -0,0 +1,68 @@ +package queues + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *SBQueue +} + +// Get ... +func (c QueuesClient) Get(ctx context.Context, id QueueId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.QueuesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.QueuesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.QueuesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c QueuesClient) preparerForGet(ctx context.Context, id QueueId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c QueuesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/method_listbynamespace_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/method_listbynamespace_autorest.go new file mode 100644 index 00000000000..a3a53f1cfaf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/method_listbynamespace_autorest.go @@ -0,0 +1,220 @@ +package queues + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByNamespaceOperationResponse struct { + HttpResponse *http.Response + Model *[]SBQueue + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByNamespaceOperationResponse, error) +} + +type ListByNamespaceCompleteResult struct { + Items []SBQueue +} + +func (r ListByNamespaceOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByNamespaceOperationResponse) LoadMore(ctx context.Context) (resp ListByNamespaceOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByNamespaceOperationOptions struct { + Skip *int64 + Top *int64 +} + +func DefaultListByNamespaceOperationOptions() ListByNamespaceOperationOptions { + return ListByNamespaceOperationOptions{} +} + +func (o ListByNamespaceOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByNamespaceOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Skip != nil { + out["$skip"] = *o.Skip + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListByNamespace ... +func (c QueuesClient) ListByNamespace(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions) (resp ListByNamespaceOperationResponse, err error) { + req, err := c.preparerForListByNamespace(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.QueuesClient", "ListByNamespace", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.QueuesClient", "ListByNamespace", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByNamespace(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.QueuesClient", "ListByNamespace", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByNamespace prepares the ListByNamespace request. +func (c QueuesClient) preparerForListByNamespace(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/queues", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByNamespaceWithNextLink prepares the ListByNamespace request with the given nextLink token. +func (c QueuesClient) preparerForListByNamespaceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByNamespace handles the response to the ListByNamespace request. The method always +// closes the http.Response Body. +func (c QueuesClient) responderForListByNamespace(resp *http.Response) (result ListByNamespaceOperationResponse, err error) { + type page struct { + Values []SBQueue `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByNamespaceOperationResponse, err error) { + req, err := c.preparerForListByNamespaceWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.QueuesClient", "ListByNamespace", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.QueuesClient", "ListByNamespace", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByNamespace(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "queues.QueuesClient", "ListByNamespace", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByNamespaceComplete retrieves all of the results into a single object +func (c QueuesClient) ListByNamespaceComplete(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions) (ListByNamespaceCompleteResult, error) { + return c.ListByNamespaceCompleteMatchingPredicate(ctx, id, options, SBQueueOperationPredicate{}) +} + +// ListByNamespaceCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c QueuesClient) ListByNamespaceCompleteMatchingPredicate(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions, predicate SBQueueOperationPredicate) (resp ListByNamespaceCompleteResult, err error) { + items := make([]SBQueue, 0) + + page, err := c.ListByNamespace(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByNamespaceCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/model_messagecountdetails.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/model_messagecountdetails.go new file mode 100644 index 00000000000..9bd16f13f68 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/model_messagecountdetails.go @@ -0,0 +1,12 @@ +package queues + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MessageCountDetails struct { + ActiveMessageCount *int64 `json:"activeMessageCount,omitempty"` + DeadLetterMessageCount *int64 `json:"deadLetterMessageCount,omitempty"` + ScheduledMessageCount *int64 `json:"scheduledMessageCount,omitempty"` + TransferDeadLetterMessageCount *int64 `json:"transferDeadLetterMessageCount,omitempty"` + TransferMessageCount *int64 `json:"transferMessageCount,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/model_sbqueue.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/model_sbqueue.go new file mode 100644 index 00000000000..9a8f302b7e8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/model_sbqueue.go @@ -0,0 +1,16 @@ +package queues + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBQueue struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SBQueueProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/model_sbqueueproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/model_sbqueueproperties.go new file mode 100644 index 00000000000..ed1ff71a7fc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/model_sbqueueproperties.go @@ -0,0 +1,71 @@ +package queues + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBQueueProperties struct { + AccessedAt *string `json:"accessedAt,omitempty"` + AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` + CountDetails *MessageCountDetails `json:"countDetails,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"` + DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` + DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"` + EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` + EnableExpress *bool `json:"enableExpress,omitempty"` + EnablePartitioning *bool `json:"enablePartitioning,omitempty"` + ForwardDeadLetteredMessagesTo *string `json:"forwardDeadLetteredMessagesTo,omitempty"` + ForwardTo *string `json:"forwardTo,omitempty"` + LockDuration *string `json:"lockDuration,omitempty"` + MaxDeliveryCount *int64 `json:"maxDeliveryCount,omitempty"` + MaxMessageSizeInKilobytes *int64 `json:"maxMessageSizeInKilobytes,omitempty"` + MaxSizeInMegabytes *int64 `json:"maxSizeInMegabytes,omitempty"` + MessageCount *int64 `json:"messageCount,omitempty"` + RequiresDuplicateDetection *bool `json:"requiresDuplicateDetection,omitempty"` + RequiresSession *bool `json:"requiresSession,omitempty"` + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` + Status *EntityStatus `json:"status,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` +} + +func (o *SBQueueProperties) GetAccessedAtAsTime() (*time.Time, error) { + if o.AccessedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.AccessedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SBQueueProperties) SetAccessedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.AccessedAt = &formatted +} + +func (o *SBQueueProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SBQueueProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *SBQueueProperties) GetUpdatedAtAsTime() (*time.Time, error) { + if o.UpdatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpdatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SBQueueProperties) SetUpdatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpdatedAt = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/predicates.go new file mode 100644 index 00000000000..0a185409828 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/predicates.go @@ -0,0 +1,24 @@ +package queues + +type SBQueueOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SBQueueOperationPredicate) Matches(input SBQueue) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/version.go new file mode 100644 index 00000000000..49e5f391bc3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues/version.go @@ -0,0 +1,12 @@ +package queues + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/queues/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/README.md new file mode 100644 index 00000000000..5f09a842c30 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule` Documentation + +The `queuesauthorizationrule` SDK allows for interaction with the Azure Resource Manager Service `servicebus` (API Version `2021-06-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule" +``` + + +### Client Initialization + +```go +client := queuesauthorizationrule.NewQueuesAuthorizationRuleClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `QueuesAuthorizationRuleClient.QueuesCreateOrUpdateAuthorizationRule` + +```go +ctx := context.TODO() +id := queuesauthorizationrule.NewQueueAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "queueValue", "authorizationRuleValue") + +payload := queuesauthorizationrule.SBAuthorizationRule{ + // ... +} + + +read, err := client.QueuesCreateOrUpdateAuthorizationRule(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `QueuesAuthorizationRuleClient.QueuesDeleteAuthorizationRule` + +```go +ctx := context.TODO() +id := queuesauthorizationrule.NewQueueAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "queueValue", "authorizationRuleValue") + +read, err := client.QueuesDeleteAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `QueuesAuthorizationRuleClient.QueuesGetAuthorizationRule` + +```go +ctx := context.TODO() +id := queuesauthorizationrule.NewQueueAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "queueValue", "authorizationRuleValue") + +read, err := client.QueuesGetAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `QueuesAuthorizationRuleClient.QueuesListAuthorizationRules` + +```go +ctx := context.TODO() +id := queuesauthorizationrule.NewQueueID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "queueValue") + +// alternatively `client.QueuesListAuthorizationRules(ctx, id)` can be used to do batched pagination +items, err := client.QueuesListAuthorizationRulesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `QueuesAuthorizationRuleClient.QueuesListKeys` + +```go +ctx := context.TODO() +id := queuesauthorizationrule.NewQueueAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "queueValue", "authorizationRuleValue") + +read, err := client.QueuesListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `QueuesAuthorizationRuleClient.QueuesRegenerateKeys` + +```go +ctx := context.TODO() +id := queuesauthorizationrule.NewQueueAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "queueValue", "authorizationRuleValue") + +payload := queuesauthorizationrule.RegenerateAccessKeyParameters{ + // ... +} + + +read, err := client.QueuesRegenerateKeys(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/client.go new file mode 100644 index 00000000000..2f12c809683 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/client.go @@ -0,0 +1,18 @@ +package queuesauthorizationrule + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueuesAuthorizationRuleClient struct { + Client autorest.Client + baseUri string +} + +func NewQueuesAuthorizationRuleClientWithBaseURI(endpoint string) QueuesAuthorizationRuleClient { + return QueuesAuthorizationRuleClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/constants.go new file mode 100644 index 00000000000..376d0d9c771 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/constants.go @@ -0,0 +1,65 @@ +package queuesauthorizationrule + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessRights string + +const ( + AccessRightsListen AccessRights = "Listen" + AccessRightsManage AccessRights = "Manage" + AccessRightsSend AccessRights = "Send" +) + +func PossibleValuesForAccessRights() []string { + return []string{ + string(AccessRightsListen), + string(AccessRightsManage), + string(AccessRightsSend), + } +} + +func parseAccessRights(input string) (*AccessRights, error) { + vals := map[string]AccessRights{ + "listen": AccessRightsListen, + "manage": AccessRightsManage, + "send": AccessRightsSend, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessRights(input) + return &out, nil +} + +type KeyType string + +const ( + KeyTypePrimaryKey KeyType = "PrimaryKey" + KeyTypeSecondaryKey KeyType = "SecondaryKey" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypePrimaryKey), + string(KeyTypeSecondaryKey), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "primarykey": KeyTypePrimaryKey, + "secondarykey": KeyTypeSecondaryKey, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/id_queue.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/id_queue.go new file mode 100644 index 00000000000..349e72ef938 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/id_queue.go @@ -0,0 +1,137 @@ +package queuesauthorizationrule + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = QueueId{} + +// QueueId is a struct representing the Resource ID for a Queue +type QueueId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + QueueName string +} + +// NewQueueID returns a new QueueId struct +func NewQueueID(subscriptionId string, resourceGroupName string, namespaceName string, queueName string) QueueId { + return QueueId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + QueueName: queueName, + } +} + +// ParseQueueID parses 'input' into a QueueId +func ParseQueueID(input string) (*QueueId, error) { + parser := resourceids.NewParserFromResourceIdType(QueueId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := QueueId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { + return nil, fmt.Errorf("the segment 'queueName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseQueueIDInsensitively parses 'input' case-insensitively into a QueueId +// note: this method should only be used for API response data and not user input +func ParseQueueIDInsensitively(input string) (*QueueId, error) { + parser := resourceids.NewParserFromResourceIdType(QueueId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := QueueId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { + return nil, fmt.Errorf("the segment 'queueName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateQueueID checks that 'input' can be parsed as a Queue ID +func ValidateQueueID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseQueueID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Queue ID +func (id QueueId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/queues/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.QueueName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Queue ID +func (id QueueId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticQueues", "queues", "queues"), + resourceids.UserSpecifiedSegment("queueName", "queueValue"), + } +} + +// String returns a human-readable description of this Queue ID +func (id QueueId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Queue Name: %q", id.QueueName), + } + return fmt.Sprintf("Queue (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/id_queueauthorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/id_queueauthorizationrule.go new file mode 100644 index 00000000000..34fc91ea4a6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/id_queueauthorizationrule.go @@ -0,0 +1,150 @@ +package queuesauthorizationrule + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = QueueAuthorizationRuleId{} + +// QueueAuthorizationRuleId is a struct representing the Resource ID for a Queue Authorization Rule +type QueueAuthorizationRuleId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + QueueName string + AuthorizationRuleName string +} + +// NewQueueAuthorizationRuleID returns a new QueueAuthorizationRuleId struct +func NewQueueAuthorizationRuleID(subscriptionId string, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) QueueAuthorizationRuleId { + return QueueAuthorizationRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + QueueName: queueName, + AuthorizationRuleName: authorizationRuleName, + } +} + +// ParseQueueAuthorizationRuleID parses 'input' into a QueueAuthorizationRuleId +func ParseQueueAuthorizationRuleID(input string) (*QueueAuthorizationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(QueueAuthorizationRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := QueueAuthorizationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { + return nil, fmt.Errorf("the segment 'queueName' was not found in the resource id %q", input) + } + + if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseQueueAuthorizationRuleIDInsensitively parses 'input' case-insensitively into a QueueAuthorizationRuleId +// note: this method should only be used for API response data and not user input +func ParseQueueAuthorizationRuleIDInsensitively(input string) (*QueueAuthorizationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(QueueAuthorizationRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := QueueAuthorizationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { + return nil, fmt.Errorf("the segment 'queueName' was not found in the resource id %q", input) + } + + if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateQueueAuthorizationRuleID checks that 'input' can be parsed as a Queue Authorization Rule ID +func ValidateQueueAuthorizationRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseQueueAuthorizationRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Queue Authorization Rule ID +func (id QueueAuthorizationRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/queues/%s/authorizationRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.QueueName, id.AuthorizationRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Queue Authorization Rule ID +func (id QueueAuthorizationRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticQueues", "queues", "queues"), + resourceids.UserSpecifiedSegment("queueName", "queueValue"), + resourceids.StaticSegment("staticAuthorizationRules", "authorizationRules", "authorizationRules"), + resourceids.UserSpecifiedSegment("authorizationRuleName", "authorizationRuleValue"), + } +} + +// String returns a human-readable description of this Queue Authorization Rule ID +func (id QueueAuthorizationRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Queue Name: %q", id.QueueName), + fmt.Sprintf("Authorization Rule Name: %q", id.AuthorizationRuleName), + } + return fmt.Sprintf("Queue Authorization Rule (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queuescreateorupdateauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queuescreateorupdateauthorizationrule_autorest.go new file mode 100644 index 00000000000..d953056a6b9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queuescreateorupdateauthorizationrule_autorest.go @@ -0,0 +1,69 @@ +package queuesauthorizationrule + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueuesCreateOrUpdateAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *SBAuthorizationRule +} + +// QueuesCreateOrUpdateAuthorizationRule ... +func (c QueuesAuthorizationRuleClient) QueuesCreateOrUpdateAuthorizationRule(ctx context.Context, id QueueAuthorizationRuleId, input SBAuthorizationRule) (result QueuesCreateOrUpdateAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForQueuesCreateOrUpdateAuthorizationRule(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesCreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesCreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForQueuesCreateOrUpdateAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesCreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForQueuesCreateOrUpdateAuthorizationRule prepares the QueuesCreateOrUpdateAuthorizationRule request. +func (c QueuesAuthorizationRuleClient) preparerForQueuesCreateOrUpdateAuthorizationRule(ctx context.Context, id QueueAuthorizationRuleId, input SBAuthorizationRule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForQueuesCreateOrUpdateAuthorizationRule handles the response to the QueuesCreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (c QueuesAuthorizationRuleClient) responderForQueuesCreateOrUpdateAuthorizationRule(resp *http.Response) (result QueuesCreateOrUpdateAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queuesdeleteauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queuesdeleteauthorizationrule_autorest.go new file mode 100644 index 00000000000..db2808ae307 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queuesdeleteauthorizationrule_autorest.go @@ -0,0 +1,66 @@ +package queuesauthorizationrule + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueuesDeleteAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response +} + +// QueuesDeleteAuthorizationRule ... +func (c QueuesAuthorizationRuleClient) QueuesDeleteAuthorizationRule(ctx context.Context, id QueueAuthorizationRuleId) (result QueuesDeleteAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForQueuesDeleteAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesDeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesDeleteAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForQueuesDeleteAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesDeleteAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForQueuesDeleteAuthorizationRule prepares the QueuesDeleteAuthorizationRule request. +func (c QueuesAuthorizationRuleClient) preparerForQueuesDeleteAuthorizationRule(ctx context.Context, id QueueAuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForQueuesDeleteAuthorizationRule handles the response to the QueuesDeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (c QueuesAuthorizationRuleClient) responderForQueuesDeleteAuthorizationRule(resp *http.Response) (result QueuesDeleteAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queuesgetauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queuesgetauthorizationrule_autorest.go new file mode 100644 index 00000000000..be575d4703e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queuesgetauthorizationrule_autorest.go @@ -0,0 +1,68 @@ +package queuesauthorizationrule + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueuesGetAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *SBAuthorizationRule +} + +// QueuesGetAuthorizationRule ... +func (c QueuesAuthorizationRuleClient) QueuesGetAuthorizationRule(ctx context.Context, id QueueAuthorizationRuleId) (result QueuesGetAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForQueuesGetAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesGetAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesGetAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForQueuesGetAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesGetAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForQueuesGetAuthorizationRule prepares the QueuesGetAuthorizationRule request. +func (c QueuesAuthorizationRuleClient) preparerForQueuesGetAuthorizationRule(ctx context.Context, id QueueAuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForQueuesGetAuthorizationRule handles the response to the QueuesGetAuthorizationRule request. The method always +// closes the http.Response Body. +func (c QueuesAuthorizationRuleClient) responderForQueuesGetAuthorizationRule(resp *http.Response) (result QueuesGetAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queueslistauthorizationrules_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queueslistauthorizationrules_autorest.go new file mode 100644 index 00000000000..f34013aefd5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queueslistauthorizationrules_autorest.go @@ -0,0 +1,186 @@ +package queuesauthorizationrule + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueuesListAuthorizationRulesOperationResponse struct { + HttpResponse *http.Response + Model *[]SBAuthorizationRule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (QueuesListAuthorizationRulesOperationResponse, error) +} + +type QueuesListAuthorizationRulesCompleteResult struct { + Items []SBAuthorizationRule +} + +func (r QueuesListAuthorizationRulesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r QueuesListAuthorizationRulesOperationResponse) LoadMore(ctx context.Context) (resp QueuesListAuthorizationRulesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// QueuesListAuthorizationRules ... +func (c QueuesAuthorizationRuleClient) QueuesListAuthorizationRules(ctx context.Context, id QueueId) (resp QueuesListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForQueuesListAuthorizationRules(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesListAuthorizationRules", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForQueuesListAuthorizationRules(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesListAuthorizationRules", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForQueuesListAuthorizationRules prepares the QueuesListAuthorizationRules request. +func (c QueuesAuthorizationRuleClient) preparerForQueuesListAuthorizationRules(ctx context.Context, id QueueId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/authorizationRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForQueuesListAuthorizationRulesWithNextLink prepares the QueuesListAuthorizationRules request with the given nextLink token. +func (c QueuesAuthorizationRuleClient) preparerForQueuesListAuthorizationRulesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForQueuesListAuthorizationRules handles the response to the QueuesListAuthorizationRules request. The method always +// closes the http.Response Body. +func (c QueuesAuthorizationRuleClient) responderForQueuesListAuthorizationRules(resp *http.Response) (result QueuesListAuthorizationRulesOperationResponse, err error) { + type page struct { + Values []SBAuthorizationRule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result QueuesListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForQueuesListAuthorizationRulesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesListAuthorizationRules", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesListAuthorizationRules", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForQueuesListAuthorizationRules(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesListAuthorizationRules", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// QueuesListAuthorizationRulesComplete retrieves all of the results into a single object +func (c QueuesAuthorizationRuleClient) QueuesListAuthorizationRulesComplete(ctx context.Context, id QueueId) (QueuesListAuthorizationRulesCompleteResult, error) { + return c.QueuesListAuthorizationRulesCompleteMatchingPredicate(ctx, id, SBAuthorizationRuleOperationPredicate{}) +} + +// QueuesListAuthorizationRulesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c QueuesAuthorizationRuleClient) QueuesListAuthorizationRulesCompleteMatchingPredicate(ctx context.Context, id QueueId, predicate SBAuthorizationRuleOperationPredicate) (resp QueuesListAuthorizationRulesCompleteResult, err error) { + items := make([]SBAuthorizationRule, 0) + + page, err := c.QueuesListAuthorizationRules(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := QueuesListAuthorizationRulesCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queueslistkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queueslistkeys_autorest.go new file mode 100644 index 00000000000..8f134398b56 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queueslistkeys_autorest.go @@ -0,0 +1,69 @@ +package queuesauthorizationrule + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueuesListKeysOperationResponse struct { + HttpResponse *http.Response + Model *AccessKeys +} + +// QueuesListKeys ... +func (c QueuesAuthorizationRuleClient) QueuesListKeys(ctx context.Context, id QueueAuthorizationRuleId) (result QueuesListKeysOperationResponse, err error) { + req, err := c.preparerForQueuesListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForQueuesListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForQueuesListKeys prepares the QueuesListKeys request. +func (c QueuesAuthorizationRuleClient) preparerForQueuesListKeys(ctx context.Context, id QueueAuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForQueuesListKeys handles the response to the QueuesListKeys request. The method always +// closes the http.Response Body. +func (c QueuesAuthorizationRuleClient) responderForQueuesListKeys(resp *http.Response) (result QueuesListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queuesregeneratekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queuesregeneratekeys_autorest.go new file mode 100644 index 00000000000..9f87730b62a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/method_queuesregeneratekeys_autorest.go @@ -0,0 +1,70 @@ +package queuesauthorizationrule + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type QueuesRegenerateKeysOperationResponse struct { + HttpResponse *http.Response + Model *AccessKeys +} + +// QueuesRegenerateKeys ... +func (c QueuesAuthorizationRuleClient) QueuesRegenerateKeys(ctx context.Context, id QueueAuthorizationRuleId, input RegenerateAccessKeyParameters) (result QueuesRegenerateKeysOperationResponse, err error) { + req, err := c.preparerForQueuesRegenerateKeys(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesRegenerateKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesRegenerateKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForQueuesRegenerateKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "queuesauthorizationrule.QueuesAuthorizationRuleClient", "QueuesRegenerateKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForQueuesRegenerateKeys prepares the QueuesRegenerateKeys request. +func (c QueuesAuthorizationRuleClient) preparerForQueuesRegenerateKeys(ctx context.Context, id QueueAuthorizationRuleId, input RegenerateAccessKeyParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKeys", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForQueuesRegenerateKeys handles the response to the QueuesRegenerateKeys request. The method always +// closes the http.Response Body. +func (c QueuesAuthorizationRuleClient) responderForQueuesRegenerateKeys(resp *http.Response) (result QueuesRegenerateKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/model_accesskeys.go new file mode 100644 index 00000000000..6483a26ef74 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/model_accesskeys.go @@ -0,0 +1,14 @@ +package queuesauthorizationrule + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeys struct { + AliasPrimaryConnectionString *string `json:"aliasPrimaryConnectionString,omitempty"` + AliasSecondaryConnectionString *string `json:"aliasSecondaryConnectionString,omitempty"` + KeyName *string `json:"keyName,omitempty"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/model_regenerateaccesskeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/model_regenerateaccesskeyparameters.go new file mode 100644 index 00000000000..b6a32491737 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/model_regenerateaccesskeyparameters.go @@ -0,0 +1,9 @@ +package queuesauthorizationrule + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateAccessKeyParameters struct { + Key *string `json:"key,omitempty"` + KeyType KeyType `json:"keyType"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/model_sbauthorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/model_sbauthorizationrule.go new file mode 100644 index 00000000000..13f457c7814 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/model_sbauthorizationrule.go @@ -0,0 +1,16 @@ +package queuesauthorizationrule + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBAuthorizationRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SBAuthorizationRuleProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/model_sbauthorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/model_sbauthorizationruleproperties.go new file mode 100644 index 00000000000..c4ccb568d3f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/model_sbauthorizationruleproperties.go @@ -0,0 +1,8 @@ +package queuesauthorizationrule + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBAuthorizationRuleProperties struct { + Rights []AccessRights `json:"rights"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/predicates.go new file mode 100644 index 00000000000..721dce865ed --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/predicates.go @@ -0,0 +1,24 @@ +package queuesauthorizationrule + +type SBAuthorizationRuleOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SBAuthorizationRuleOperationPredicate) Matches(input SBAuthorizationRule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/version.go new file mode 100644 index 00000000000..65270c408ff --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/version.go @@ -0,0 +1,12 @@ +package queuesauthorizationrule + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/queuesauthorizationrule/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/README.md new file mode 100644 index 00000000000..80162617b4f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/README.md @@ -0,0 +1,74 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules` Documentation + +The `rules` SDK allows for interaction with the Azure Resource Manager Service `servicebus` (API Version `2021-06-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules" +``` + + +### Client Initialization + +```go +client := rules.NewRulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RulesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := rules.NewRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue", "subscriptionValue", "ruleValue") + +payload := rules.Rule{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RulesClient.Delete` + +```go +ctx := context.TODO() +id := rules.NewRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue", "subscriptionValue", "ruleValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RulesClient.ListBySubscriptions` + +```go +ctx := context.TODO() +id := rules.NewSubscriptions2ID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue", "subscriptionValue") + +// alternatively `client.ListBySubscriptions(ctx, id, rules.DefaultListBySubscriptionsOperationOptions())` can be used to do batched pagination +items, err := client.ListBySubscriptionsComplete(ctx, id, rules.DefaultListBySubscriptionsOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/client.go new file mode 100644 index 00000000000..7e1e300eef3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/client.go @@ -0,0 +1,18 @@ +package rules + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RulesClient struct { + Client autorest.Client + baseUri string +} + +func NewRulesClientWithBaseURI(endpoint string) RulesClient { + return RulesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/constants.go new file mode 100644 index 00000000000..06236708fc2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/constants.go @@ -0,0 +1,34 @@ +package rules + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FilterType string + +const ( + FilterTypeCorrelationFilter FilterType = "CorrelationFilter" + FilterTypeSqlFilter FilterType = "SqlFilter" +) + +func PossibleValuesForFilterType() []string { + return []string{ + string(FilterTypeCorrelationFilter), + string(FilterTypeSqlFilter), + } +} + +func parseFilterType(input string) (*FilterType, error) { + vals := map[string]FilterType{ + "correlationfilter": FilterTypeCorrelationFilter, + "sqlfilter": FilterTypeSqlFilter, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FilterType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/id_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/id_rule.go new file mode 100644 index 00000000000..0b106b55094 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/id_rule.go @@ -0,0 +1,163 @@ +package rules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RuleId{} + +// RuleId is a struct representing the Resource ID for a Rule +type RuleId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + TopicName string + SubscriptionName string + RuleName string +} + +// NewRuleID returns a new RuleId struct +func NewRuleID(subscriptionId string, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string) RuleId { + return RuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + TopicName: topicName, + SubscriptionName: subscriptionName, + RuleName: ruleName, + } +} + +// ParseRuleID parses 'input' into a RuleId +func ParseRuleID(input string) (*RuleId, error) { + parser := resourceids.NewParserFromResourceIdType(RuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionName' was not found in the resource id %q", input) + } + + if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { + return nil, fmt.Errorf("the segment 'ruleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRuleIDInsensitively parses 'input' case-insensitively into a RuleId +// note: this method should only be used for API response data and not user input +func ParseRuleIDInsensitively(input string) (*RuleId, error) { + parser := resourceids.NewParserFromResourceIdType(RuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionName' was not found in the resource id %q", input) + } + + if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { + return nil, fmt.Errorf("the segment 'ruleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRuleID checks that 'input' can be parsed as a Rule ID +func ValidateRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Rule ID +func (id RuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/topics/%s/subscriptions/%s/rules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.TopicName, id.SubscriptionName, id.RuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Rule ID +func (id RuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticTopics", "topics", "topics"), + resourceids.UserSpecifiedSegment("topicName", "topicValue"), + resourceids.StaticSegment("staticSubscriptions2", "subscriptions", "subscriptions"), + resourceids.UserSpecifiedSegment("subscriptionName", "subscriptionValue"), + resourceids.StaticSegment("staticRules", "rules", "rules"), + resourceids.UserSpecifiedSegment("ruleName", "ruleValue"), + } +} + +// String returns a human-readable description of this Rule ID +func (id RuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Topic Name: %q", id.TopicName), + fmt.Sprintf("Subscription Name: %q", id.SubscriptionName), + fmt.Sprintf("Rule Name: %q", id.RuleName), + } + return fmt.Sprintf("Rule (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/id_subscriptions2.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/id_subscriptions2.go new file mode 100644 index 00000000000..827ea878169 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/id_subscriptions2.go @@ -0,0 +1,150 @@ +package rules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = Subscriptions2Id{} + +// Subscriptions2Id is a struct representing the Resource ID for a Subscriptions 2 +type Subscriptions2Id struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + TopicName string + SubscriptionName string +} + +// NewSubscriptions2ID returns a new Subscriptions2Id struct +func NewSubscriptions2ID(subscriptionId string, resourceGroupName string, namespaceName string, topicName string, subscriptionName string) Subscriptions2Id { + return Subscriptions2Id{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + TopicName: topicName, + SubscriptionName: subscriptionName, + } +} + +// ParseSubscriptions2ID parses 'input' into a Subscriptions2Id +func ParseSubscriptions2ID(input string) (*Subscriptions2Id, error) { + parser := resourceids.NewParserFromResourceIdType(Subscriptions2Id{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := Subscriptions2Id{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSubscriptions2IDInsensitively parses 'input' case-insensitively into a Subscriptions2Id +// note: this method should only be used for API response data and not user input +func ParseSubscriptions2IDInsensitively(input string) (*Subscriptions2Id, error) { + parser := resourceids.NewParserFromResourceIdType(Subscriptions2Id{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := Subscriptions2Id{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSubscriptions2ID checks that 'input' can be parsed as a Subscriptions 2 ID +func ValidateSubscriptions2ID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSubscriptions2ID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Subscriptions 2 ID +func (id Subscriptions2Id) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/topics/%s/subscriptions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.TopicName, id.SubscriptionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Subscriptions 2 ID +func (id Subscriptions2Id) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticTopics", "topics", "topics"), + resourceids.UserSpecifiedSegment("topicName", "topicValue"), + resourceids.StaticSegment("staticSubscriptions2", "subscriptions", "subscriptions"), + resourceids.UserSpecifiedSegment("subscriptionName", "subscriptionValue"), + } +} + +// String returns a human-readable description of this Subscriptions 2 ID +func (id Subscriptions2Id) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Topic Name: %q", id.TopicName), + fmt.Sprintf("Subscription Name: %q", id.SubscriptionName), + } + return fmt.Sprintf("Subscriptions 2 (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/method_createorupdate_autorest.go new file mode 100644 index 00000000000..2415da0ad25 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package rules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Rule +} + +// CreateOrUpdate ... +func (c RulesClient) CreateOrUpdate(ctx context.Context, id RuleId, input Rule) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c RulesClient) preparerForCreateOrUpdate(ctx context.Context, id RuleId, input Rule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c RulesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/method_delete_autorest.go new file mode 100644 index 00000000000..fe7ff00dc78 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/method_delete_autorest.go @@ -0,0 +1,66 @@ +package rules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c RulesClient) Delete(ctx context.Context, id RuleId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c RulesClient) preparerForDelete(ctx context.Context, id RuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c RulesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/method_listbysubscriptions_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/method_listbysubscriptions_autorest.go new file mode 100644 index 00000000000..6a73c40dd46 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/method_listbysubscriptions_autorest.go @@ -0,0 +1,220 @@ +package rules + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionsOperationResponse struct { + HttpResponse *http.Response + Model *[]Rule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionsOperationResponse, error) +} + +type ListBySubscriptionsCompleteResult struct { + Items []Rule +} + +func (r ListBySubscriptionsOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionsOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionsOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListBySubscriptionsOperationOptions struct { + Skip *int64 + Top *int64 +} + +func DefaultListBySubscriptionsOperationOptions() ListBySubscriptionsOperationOptions { + return ListBySubscriptionsOperationOptions{} +} + +func (o ListBySubscriptionsOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListBySubscriptionsOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Skip != nil { + out["$skip"] = *o.Skip + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListBySubscriptions ... +func (c RulesClient) ListBySubscriptions(ctx context.Context, id Subscriptions2Id, options ListBySubscriptionsOperationOptions) (resp ListBySubscriptionsOperationResponse, err error) { + req, err := c.preparerForListBySubscriptions(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "ListBySubscriptions", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "ListBySubscriptions", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscriptions(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "ListBySubscriptions", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscriptions prepares the ListBySubscriptions request. +func (c RulesClient) preparerForListBySubscriptions(ctx context.Context, id Subscriptions2Id, options ListBySubscriptionsOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/rules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionsWithNextLink prepares the ListBySubscriptions request with the given nextLink token. +func (c RulesClient) preparerForListBySubscriptionsWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscriptions handles the response to the ListBySubscriptions request. The method always +// closes the http.Response Body. +func (c RulesClient) responderForListBySubscriptions(resp *http.Response) (result ListBySubscriptionsOperationResponse, err error) { + type page struct { + Values []Rule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionsOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionsWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "ListBySubscriptions", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "ListBySubscriptions", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscriptions(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "rules.RulesClient", "ListBySubscriptions", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionsComplete retrieves all of the results into a single object +func (c RulesClient) ListBySubscriptionsComplete(ctx context.Context, id Subscriptions2Id, options ListBySubscriptionsOperationOptions) (ListBySubscriptionsCompleteResult, error) { + return c.ListBySubscriptionsCompleteMatchingPredicate(ctx, id, options, RuleOperationPredicate{}) +} + +// ListBySubscriptionsCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c RulesClient) ListBySubscriptionsCompleteMatchingPredicate(ctx context.Context, id Subscriptions2Id, options ListBySubscriptionsOperationOptions, predicate RuleOperationPredicate) (resp ListBySubscriptionsCompleteResult, err error) { + items := make([]Rule, 0) + + page, err := c.ListBySubscriptions(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionsCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/model_action.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/model_action.go new file mode 100644 index 00000000000..5583dfbfe78 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/model_action.go @@ -0,0 +1,10 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Action struct { + CompatibilityLevel *int64 `json:"compatibilityLevel,omitempty"` + RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"` + SqlExpression *string `json:"sqlExpression,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/model_correlationfilter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/model_correlationfilter.go new file mode 100644 index 00000000000..a2daf069968 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/model_correlationfilter.go @@ -0,0 +1,17 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CorrelationFilter struct { + ContentType *string `json:"contentType,omitempty"` + CorrelationId *string `json:"correlationId,omitempty"` + Label *string `json:"label,omitempty"` + MessageId *string `json:"messageId,omitempty"` + Properties *map[string]string `json:"properties,omitempty"` + ReplyTo *string `json:"replyTo,omitempty"` + ReplyToSessionId *string `json:"replyToSessionId,omitempty"` + RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"` + SessionId *string `json:"sessionId,omitempty"` + To *string `json:"to,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/model_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/model_rule.go new file mode 100644 index 00000000000..7c81240b66e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/model_rule.go @@ -0,0 +1,16 @@ +package rules + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Rule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *Ruleproperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/model_ruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/model_ruleproperties.go new file mode 100644 index 00000000000..96bf533f35f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/model_ruleproperties.go @@ -0,0 +1,11 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Ruleproperties struct { + Action *Action `json:"action,omitempty"` + CorrelationFilter *CorrelationFilter `json:"correlationFilter,omitempty"` + FilterType *FilterType `json:"filterType,omitempty"` + SqlFilter *SqlFilter `json:"sqlFilter,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/model_sqlfilter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/model_sqlfilter.go new file mode 100644 index 00000000000..fc16bab7c6a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/model_sqlfilter.go @@ -0,0 +1,10 @@ +package rules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SqlFilter struct { + CompatibilityLevel *int64 `json:"compatibilityLevel,omitempty"` + RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"` + SqlExpression *string `json:"sqlExpression,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/predicates.go new file mode 100644 index 00000000000..c9b9b4dc5d6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/predicates.go @@ -0,0 +1,24 @@ +package rules + +type RuleOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p RuleOperationPredicate) Matches(input Rule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/version.go new file mode 100644 index 00000000000..e9a07c4c058 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules/version.go @@ -0,0 +1,12 @@ +package rules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/rules/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/README.md new file mode 100644 index 00000000000..08287c5e5dc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/README.md @@ -0,0 +1,106 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions` Documentation + +The `subscriptions` SDK allows for interaction with the Azure Resource Manager Service `servicebus` (API Version `2021-06-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions" +``` + + +### Client Initialization + +```go +client := subscriptions.NewSubscriptionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SubscriptionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := subscriptions.NewSubscriptions2ID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue", "subscriptionValue") + +payload := subscriptions.SBSubscription{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SubscriptionsClient.Delete` + +```go +ctx := context.TODO() +id := subscriptions.NewSubscriptions2ID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue", "subscriptionValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SubscriptionsClient.Get` + +```go +ctx := context.TODO() +id := subscriptions.NewSubscriptions2ID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue", "subscriptionValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SubscriptionsClient.ListByTopic` + +```go +ctx := context.TODO() +id := subscriptions.NewTopicID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue") + +// alternatively `client.ListByTopic(ctx, id, subscriptions.DefaultListByTopicOperationOptions())` can be used to do batched pagination +items, err := client.ListByTopicComplete(ctx, id, subscriptions.DefaultListByTopicOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SubscriptionsClient.RulesGet` + +```go +ctx := context.TODO() +id := subscriptions.NewRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue", "subscriptionValue", "ruleValue") + +read, err := client.RulesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/client.go new file mode 100644 index 00000000000..da1257d5d97 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/client.go @@ -0,0 +1,18 @@ +package subscriptions + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionsClient struct { + Client autorest.Client + baseUri string +} + +func NewSubscriptionsClientWithBaseURI(endpoint string) SubscriptionsClient { + return SubscriptionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/constants.go new file mode 100644 index 00000000000..971bb325a5f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/constants.go @@ -0,0 +1,83 @@ +package subscriptions + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EntityStatus string + +const ( + EntityStatusActive EntityStatus = "Active" + EntityStatusCreating EntityStatus = "Creating" + EntityStatusDeleting EntityStatus = "Deleting" + EntityStatusDisabled EntityStatus = "Disabled" + EntityStatusReceiveDisabled EntityStatus = "ReceiveDisabled" + EntityStatusRenaming EntityStatus = "Renaming" + EntityStatusRestoring EntityStatus = "Restoring" + EntityStatusSendDisabled EntityStatus = "SendDisabled" + EntityStatusUnknown EntityStatus = "Unknown" +) + +func PossibleValuesForEntityStatus() []string { + return []string{ + string(EntityStatusActive), + string(EntityStatusCreating), + string(EntityStatusDeleting), + string(EntityStatusDisabled), + string(EntityStatusReceiveDisabled), + string(EntityStatusRenaming), + string(EntityStatusRestoring), + string(EntityStatusSendDisabled), + string(EntityStatusUnknown), + } +} + +func parseEntityStatus(input string) (*EntityStatus, error) { + vals := map[string]EntityStatus{ + "active": EntityStatusActive, + "creating": EntityStatusCreating, + "deleting": EntityStatusDeleting, + "disabled": EntityStatusDisabled, + "receivedisabled": EntityStatusReceiveDisabled, + "renaming": EntityStatusRenaming, + "restoring": EntityStatusRestoring, + "senddisabled": EntityStatusSendDisabled, + "unknown": EntityStatusUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EntityStatus(input) + return &out, nil +} + +type FilterType string + +const ( + FilterTypeCorrelationFilter FilterType = "CorrelationFilter" + FilterTypeSqlFilter FilterType = "SqlFilter" +) + +func PossibleValuesForFilterType() []string { + return []string{ + string(FilterTypeCorrelationFilter), + string(FilterTypeSqlFilter), + } +} + +func parseFilterType(input string) (*FilterType, error) { + vals := map[string]FilterType{ + "correlationfilter": FilterTypeCorrelationFilter, + "sqlfilter": FilterTypeSqlFilter, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FilterType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_rule.go new file mode 100644 index 00000000000..ad54fab384d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_rule.go @@ -0,0 +1,163 @@ +package subscriptions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = RuleId{} + +// RuleId is a struct representing the Resource ID for a Rule +type RuleId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + TopicName string + SubscriptionName string + RuleName string +} + +// NewRuleID returns a new RuleId struct +func NewRuleID(subscriptionId string, resourceGroupName string, namespaceName string, topicName string, subscriptionName string, ruleName string) RuleId { + return RuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + TopicName: topicName, + SubscriptionName: subscriptionName, + RuleName: ruleName, + } +} + +// ParseRuleID parses 'input' into a RuleId +func ParseRuleID(input string) (*RuleId, error) { + parser := resourceids.NewParserFromResourceIdType(RuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionName' was not found in the resource id %q", input) + } + + if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { + return nil, fmt.Errorf("the segment 'ruleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseRuleIDInsensitively parses 'input' case-insensitively into a RuleId +// note: this method should only be used for API response data and not user input +func ParseRuleIDInsensitively(input string) (*RuleId, error) { + parser := resourceids.NewParserFromResourceIdType(RuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := RuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionName' was not found in the resource id %q", input) + } + + if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { + return nil, fmt.Errorf("the segment 'ruleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateRuleID checks that 'input' can be parsed as a Rule ID +func ValidateRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Rule ID +func (id RuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/topics/%s/subscriptions/%s/rules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.TopicName, id.SubscriptionName, id.RuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Rule ID +func (id RuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticTopics", "topics", "topics"), + resourceids.UserSpecifiedSegment("topicName", "topicValue"), + resourceids.StaticSegment("staticSubscriptions2", "subscriptions", "subscriptions"), + resourceids.UserSpecifiedSegment("subscriptionName", "subscriptionValue"), + resourceids.StaticSegment("staticRules", "rules", "rules"), + resourceids.UserSpecifiedSegment("ruleName", "ruleValue"), + } +} + +// String returns a human-readable description of this Rule ID +func (id RuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Topic Name: %q", id.TopicName), + fmt.Sprintf("Subscription Name: %q", id.SubscriptionName), + fmt.Sprintf("Rule Name: %q", id.RuleName), + } + return fmt.Sprintf("Rule (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_subscriptions2.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_subscriptions2.go new file mode 100644 index 00000000000..a29559cdc8a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_subscriptions2.go @@ -0,0 +1,150 @@ +package subscriptions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = Subscriptions2Id{} + +// Subscriptions2Id is a struct representing the Resource ID for a Subscriptions 2 +type Subscriptions2Id struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + TopicName string + SubscriptionName string +} + +// NewSubscriptions2ID returns a new Subscriptions2Id struct +func NewSubscriptions2ID(subscriptionId string, resourceGroupName string, namespaceName string, topicName string, subscriptionName string) Subscriptions2Id { + return Subscriptions2Id{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + TopicName: topicName, + SubscriptionName: subscriptionName, + } +} + +// ParseSubscriptions2ID parses 'input' into a Subscriptions2Id +func ParseSubscriptions2ID(input string) (*Subscriptions2Id, error) { + parser := resourceids.NewParserFromResourceIdType(Subscriptions2Id{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := Subscriptions2Id{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSubscriptions2IDInsensitively parses 'input' case-insensitively into a Subscriptions2Id +// note: this method should only be used for API response data and not user input +func ParseSubscriptions2IDInsensitively(input string) (*Subscriptions2Id, error) { + parser := resourceids.NewParserFromResourceIdType(Subscriptions2Id{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := Subscriptions2Id{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSubscriptions2ID checks that 'input' can be parsed as a Subscriptions 2 ID +func ValidateSubscriptions2ID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSubscriptions2ID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Subscriptions 2 ID +func (id Subscriptions2Id) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/topics/%s/subscriptions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.TopicName, id.SubscriptionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Subscriptions 2 ID +func (id Subscriptions2Id) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticTopics", "topics", "topics"), + resourceids.UserSpecifiedSegment("topicName", "topicValue"), + resourceids.StaticSegment("staticSubscriptions2", "subscriptions", "subscriptions"), + resourceids.UserSpecifiedSegment("subscriptionName", "subscriptionValue"), + } +} + +// String returns a human-readable description of this Subscriptions 2 ID +func (id Subscriptions2Id) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Topic Name: %q", id.TopicName), + fmt.Sprintf("Subscription Name: %q", id.SubscriptionName), + } + return fmt.Sprintf("Subscriptions 2 (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_topic.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_topic.go new file mode 100644 index 00000000000..3c57014bca0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_topic.go @@ -0,0 +1,137 @@ +package subscriptions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = TopicId{} + +// TopicId is a struct representing the Resource ID for a Topic +type TopicId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + TopicName string +} + +// NewTopicID returns a new TopicId struct +func NewTopicID(subscriptionId string, resourceGroupName string, namespaceName string, topicName string) TopicId { + return TopicId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + TopicName: topicName, + } +} + +// ParseTopicID parses 'input' into a TopicId +func ParseTopicID(input string) (*TopicId, error) { + parser := resourceids.NewParserFromResourceIdType(TopicId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TopicId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseTopicIDInsensitively parses 'input' case-insensitively into a TopicId +// note: this method should only be used for API response data and not user input +func ParseTopicIDInsensitively(input string) (*TopicId, error) { + parser := resourceids.NewParserFromResourceIdType(TopicId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TopicId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateTopicID checks that 'input' can be parsed as a Topic ID +func ValidateTopicID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseTopicID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Topic ID +func (id TopicId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/topics/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.TopicName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Topic ID +func (id TopicId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticTopics", "topics", "topics"), + resourceids.UserSpecifiedSegment("topicName", "topicValue"), + } +} + +// String returns a human-readable description of this Topic ID +func (id TopicId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Topic Name: %q", id.TopicName), + } + return fmt.Sprintf("Topic (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/method_createorupdate_autorest.go new file mode 100644 index 00000000000..d630ffff1d7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package subscriptions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *SBSubscription +} + +// CreateOrUpdate ... +func (c SubscriptionsClient) CreateOrUpdate(ctx context.Context, id Subscriptions2Id, input SBSubscription) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c SubscriptionsClient) preparerForCreateOrUpdate(ctx context.Context, id Subscriptions2Id, input SBSubscription) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c SubscriptionsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/method_delete_autorest.go new file mode 100644 index 00000000000..4a02e266257 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/method_delete_autorest.go @@ -0,0 +1,66 @@ +package subscriptions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c SubscriptionsClient) Delete(ctx context.Context, id Subscriptions2Id) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c SubscriptionsClient) preparerForDelete(ctx context.Context, id Subscriptions2Id) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c SubscriptionsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/method_get_autorest.go new file mode 100644 index 00000000000..dbeaa5cc644 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/method_get_autorest.go @@ -0,0 +1,68 @@ +package subscriptions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *SBSubscription +} + +// Get ... +func (c SubscriptionsClient) Get(ctx context.Context, id Subscriptions2Id) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c SubscriptionsClient) preparerForGet(ctx context.Context, id Subscriptions2Id) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c SubscriptionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/method_listbytopic_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/method_listbytopic_autorest.go new file mode 100644 index 00000000000..eda66172c4f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/method_listbytopic_autorest.go @@ -0,0 +1,220 @@ +package subscriptions + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByTopicOperationResponse struct { + HttpResponse *http.Response + Model *[]SBSubscription + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByTopicOperationResponse, error) +} + +type ListByTopicCompleteResult struct { + Items []SBSubscription +} + +func (r ListByTopicOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByTopicOperationResponse) LoadMore(ctx context.Context) (resp ListByTopicOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByTopicOperationOptions struct { + Skip *int64 + Top *int64 +} + +func DefaultListByTopicOperationOptions() ListByTopicOperationOptions { + return ListByTopicOperationOptions{} +} + +func (o ListByTopicOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByTopicOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Skip != nil { + out["$skip"] = *o.Skip + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListByTopic ... +func (c SubscriptionsClient) ListByTopic(ctx context.Context, id TopicId, options ListByTopicOperationOptions) (resp ListByTopicOperationResponse, err error) { + req, err := c.preparerForListByTopic(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "ListByTopic", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "ListByTopic", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByTopic(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "ListByTopic", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByTopic prepares the ListByTopic request. +func (c SubscriptionsClient) preparerForListByTopic(ctx context.Context, id TopicId, options ListByTopicOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/subscriptions", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByTopicWithNextLink prepares the ListByTopic request with the given nextLink token. +func (c SubscriptionsClient) preparerForListByTopicWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByTopic handles the response to the ListByTopic request. The method always +// closes the http.Response Body. +func (c SubscriptionsClient) responderForListByTopic(resp *http.Response) (result ListByTopicOperationResponse, err error) { + type page struct { + Values []SBSubscription `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByTopicOperationResponse, err error) { + req, err := c.preparerForListByTopicWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "ListByTopic", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "ListByTopic", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByTopic(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "ListByTopic", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByTopicComplete retrieves all of the results into a single object +func (c SubscriptionsClient) ListByTopicComplete(ctx context.Context, id TopicId, options ListByTopicOperationOptions) (ListByTopicCompleteResult, error) { + return c.ListByTopicCompleteMatchingPredicate(ctx, id, options, SBSubscriptionOperationPredicate{}) +} + +// ListByTopicCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SubscriptionsClient) ListByTopicCompleteMatchingPredicate(ctx context.Context, id TopicId, options ListByTopicOperationOptions, predicate SBSubscriptionOperationPredicate) (resp ListByTopicCompleteResult, err error) { + items := make([]SBSubscription, 0) + + page, err := c.ListByTopic(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByTopicCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/method_rulesget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/method_rulesget_autorest.go new file mode 100644 index 00000000000..0d6aa0da43d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/method_rulesget_autorest.go @@ -0,0 +1,68 @@ +package subscriptions + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RulesGetOperationResponse struct { + HttpResponse *http.Response + Model *Rule +} + +// RulesGet ... +func (c SubscriptionsClient) RulesGet(ctx context.Context, id RuleId) (result RulesGetOperationResponse, err error) { + req, err := c.preparerForRulesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "RulesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "RulesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRulesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "subscriptions.SubscriptionsClient", "RulesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRulesGet prepares the RulesGet request. +func (c SubscriptionsClient) preparerForRulesGet(ctx context.Context, id RuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRulesGet handles the response to the RulesGet request. The method always +// closes the http.Response Body. +func (c SubscriptionsClient) responderForRulesGet(resp *http.Response) (result RulesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_action.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_action.go new file mode 100644 index 00000000000..305f58fb92c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_action.go @@ -0,0 +1,10 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Action struct { + CompatibilityLevel *int64 `json:"compatibilityLevel,omitempty"` + RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"` + SqlExpression *string `json:"sqlExpression,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_correlationfilter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_correlationfilter.go new file mode 100644 index 00000000000..7caba4aa70d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_correlationfilter.go @@ -0,0 +1,17 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CorrelationFilter struct { + ContentType *string `json:"contentType,omitempty"` + CorrelationId *string `json:"correlationId,omitempty"` + Label *string `json:"label,omitempty"` + MessageId *string `json:"messageId,omitempty"` + Properties *map[string]string `json:"properties,omitempty"` + ReplyTo *string `json:"replyTo,omitempty"` + ReplyToSessionId *string `json:"replyToSessionId,omitempty"` + RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"` + SessionId *string `json:"sessionId,omitempty"` + To *string `json:"to,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_messagecountdetails.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_messagecountdetails.go new file mode 100644 index 00000000000..72c8d97e6af --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_messagecountdetails.go @@ -0,0 +1,12 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MessageCountDetails struct { + ActiveMessageCount *int64 `json:"activeMessageCount,omitempty"` + DeadLetterMessageCount *int64 `json:"deadLetterMessageCount,omitempty"` + ScheduledMessageCount *int64 `json:"scheduledMessageCount,omitempty"` + TransferDeadLetterMessageCount *int64 `json:"transferDeadLetterMessageCount,omitempty"` + TransferMessageCount *int64 `json:"transferMessageCount,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_rule.go new file mode 100644 index 00000000000..f4af4e85a27 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_rule.go @@ -0,0 +1,16 @@ +package subscriptions + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Rule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *Ruleproperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_ruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_ruleproperties.go new file mode 100644 index 00000000000..05dd1c71de3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_ruleproperties.go @@ -0,0 +1,11 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Ruleproperties struct { + Action *Action `json:"action,omitempty"` + CorrelationFilter *CorrelationFilter `json:"correlationFilter,omitempty"` + FilterType *FilterType `json:"filterType,omitempty"` + SqlFilter *SqlFilter `json:"sqlFilter,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_sbclientaffineproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_sbclientaffineproperties.go new file mode 100644 index 00000000000..8a8832d705a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_sbclientaffineproperties.go @@ -0,0 +1,10 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBClientAffineProperties struct { + ClientId *string `json:"clientId,omitempty"` + IsDurable *bool `json:"isDurable,omitempty"` + IsShared *bool `json:"isShared,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_sbsubscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_sbsubscription.go new file mode 100644 index 00000000000..7079232703e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_sbsubscription.go @@ -0,0 +1,16 @@ +package subscriptions + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBSubscription struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SBSubscriptionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_sbsubscriptionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_sbsubscriptionproperties.go new file mode 100644 index 00000000000..fae0f41f9b7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_sbsubscriptionproperties.go @@ -0,0 +1,68 @@ +package subscriptions + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBSubscriptionProperties struct { + AccessedAt *string `json:"accessedAt,omitempty"` + AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` + ClientAffineProperties *SBClientAffineProperties `json:"clientAffineProperties,omitempty"` + CountDetails *MessageCountDetails `json:"countDetails,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + DeadLetteringOnFilterEvaluationExceptions *bool `json:"deadLetteringOnFilterEvaluationExceptions,omitempty"` + DeadLetteringOnMessageExpiration *bool `json:"deadLetteringOnMessageExpiration,omitempty"` + DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` + DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"` + EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` + ForwardDeadLetteredMessagesTo *string `json:"forwardDeadLetteredMessagesTo,omitempty"` + ForwardTo *string `json:"forwardTo,omitempty"` + IsClientAffine *bool `json:"isClientAffine,omitempty"` + LockDuration *string `json:"lockDuration,omitempty"` + MaxDeliveryCount *int64 `json:"maxDeliveryCount,omitempty"` + MessageCount *int64 `json:"messageCount,omitempty"` + RequiresSession *bool `json:"requiresSession,omitempty"` + Status *EntityStatus `json:"status,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` +} + +func (o *SBSubscriptionProperties) GetAccessedAtAsTime() (*time.Time, error) { + if o.AccessedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.AccessedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SBSubscriptionProperties) SetAccessedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.AccessedAt = &formatted +} + +func (o *SBSubscriptionProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SBSubscriptionProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *SBSubscriptionProperties) GetUpdatedAtAsTime() (*time.Time, error) { + if o.UpdatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpdatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SBSubscriptionProperties) SetUpdatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpdatedAt = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_sqlfilter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_sqlfilter.go new file mode 100644 index 00000000000..2980ee7e2ad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/model_sqlfilter.go @@ -0,0 +1,10 @@ +package subscriptions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SqlFilter struct { + CompatibilityLevel *int64 `json:"compatibilityLevel,omitempty"` + RequiresPreprocessing *bool `json:"requiresPreprocessing,omitempty"` + SqlExpression *string `json:"sqlExpression,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/predicates.go new file mode 100644 index 00000000000..755e5d7fc26 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/predicates.go @@ -0,0 +1,24 @@ +package subscriptions + +type SBSubscriptionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SBSubscriptionOperationPredicate) Matches(input SBSubscription) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/version.go new file mode 100644 index 00000000000..0ee9e9513ad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions/version.go @@ -0,0 +1,12 @@ +package subscriptions + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/subscriptions/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/README.md new file mode 100644 index 00000000000..bff215cc2cc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics` Documentation + +The `topics` SDK allows for interaction with the Azure Resource Manager Service `servicebus` (API Version `2021-06-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics" +``` + + +### Client Initialization + +```go +client := topics.NewTopicsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `TopicsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := topics.NewTopicID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue") + +payload := topics.SBTopic{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TopicsClient.Delete` + +```go +ctx := context.TODO() +id := topics.NewTopicID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TopicsClient.Get` + +```go +ctx := context.TODO() +id := topics.NewTopicID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TopicsClient.ListByNamespace` + +```go +ctx := context.TODO() +id := topics.NewNamespaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue") + +// alternatively `client.ListByNamespace(ctx, id, topics.DefaultListByNamespaceOperationOptions())` can be used to do batched pagination +items, err := client.ListByNamespaceComplete(ctx, id, topics.DefaultListByNamespaceOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/client.go new file mode 100644 index 00000000000..d5c9fa35879 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/client.go @@ -0,0 +1,18 @@ +package topics + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TopicsClient struct { + Client autorest.Client + baseUri string +} + +func NewTopicsClientWithBaseURI(endpoint string) TopicsClient { + return TopicsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/constants.go new file mode 100644 index 00000000000..07f1029faba --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/constants.go @@ -0,0 +1,55 @@ +package topics + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EntityStatus string + +const ( + EntityStatusActive EntityStatus = "Active" + EntityStatusCreating EntityStatus = "Creating" + EntityStatusDeleting EntityStatus = "Deleting" + EntityStatusDisabled EntityStatus = "Disabled" + EntityStatusReceiveDisabled EntityStatus = "ReceiveDisabled" + EntityStatusRenaming EntityStatus = "Renaming" + EntityStatusRestoring EntityStatus = "Restoring" + EntityStatusSendDisabled EntityStatus = "SendDisabled" + EntityStatusUnknown EntityStatus = "Unknown" +) + +func PossibleValuesForEntityStatus() []string { + return []string{ + string(EntityStatusActive), + string(EntityStatusCreating), + string(EntityStatusDeleting), + string(EntityStatusDisabled), + string(EntityStatusReceiveDisabled), + string(EntityStatusRenaming), + string(EntityStatusRestoring), + string(EntityStatusSendDisabled), + string(EntityStatusUnknown), + } +} + +func parseEntityStatus(input string) (*EntityStatus, error) { + vals := map[string]EntityStatus{ + "active": EntityStatusActive, + "creating": EntityStatusCreating, + "deleting": EntityStatusDeleting, + "disabled": EntityStatusDisabled, + "receivedisabled": EntityStatusReceiveDisabled, + "renaming": EntityStatusRenaming, + "restoring": EntityStatusRestoring, + "senddisabled": EntityStatusSendDisabled, + "unknown": EntityStatusUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EntityStatus(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/id_namespace.go new file mode 100644 index 00000000000..dd4c6ad0327 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/id_namespace.go @@ -0,0 +1,124 @@ +package topics + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NamespaceId{} + +// NamespaceId is a struct representing the Resource ID for a Namespace +type NamespaceId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string +} + +// NewNamespaceID returns a new NamespaceId struct +func NewNamespaceID(subscriptionId string, resourceGroupName string, namespaceName string) NamespaceId { + return NamespaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + } +} + +// ParseNamespaceID parses 'input' into a NamespaceId +func ParseNamespaceID(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNamespaceIDInsensitively parses 'input' case-insensitively into a NamespaceId +// note: this method should only be used for API response data and not user input +func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { + parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NamespaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID +func ValidateNamespaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNamespaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Namespace ID +func (id NamespaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Namespace ID +func (id NamespaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + } +} + +// String returns a human-readable description of this Namespace ID +func (id NamespaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + } + return fmt.Sprintf("Namespace (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/id_topic.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/id_topic.go new file mode 100644 index 00000000000..fd9ec22d0b4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/id_topic.go @@ -0,0 +1,137 @@ +package topics + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = TopicId{} + +// TopicId is a struct representing the Resource ID for a Topic +type TopicId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + TopicName string +} + +// NewTopicID returns a new TopicId struct +func NewTopicID(subscriptionId string, resourceGroupName string, namespaceName string, topicName string) TopicId { + return TopicId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + TopicName: topicName, + } +} + +// ParseTopicID parses 'input' into a TopicId +func ParseTopicID(input string) (*TopicId, error) { + parser := resourceids.NewParserFromResourceIdType(TopicId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TopicId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseTopicIDInsensitively parses 'input' case-insensitively into a TopicId +// note: this method should only be used for API response data and not user input +func ParseTopicIDInsensitively(input string) (*TopicId, error) { + parser := resourceids.NewParserFromResourceIdType(TopicId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TopicId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateTopicID checks that 'input' can be parsed as a Topic ID +func ValidateTopicID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseTopicID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Topic ID +func (id TopicId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/topics/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.TopicName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Topic ID +func (id TopicId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticTopics", "topics", "topics"), + resourceids.UserSpecifiedSegment("topicName", "topicValue"), + } +} + +// String returns a human-readable description of this Topic ID +func (id TopicId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Topic Name: %q", id.TopicName), + } + return fmt.Sprintf("Topic (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/method_createorupdate_autorest.go new file mode 100644 index 00000000000..bab465039bb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package topics + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *SBTopic +} + +// CreateOrUpdate ... +func (c TopicsClient) CreateOrUpdate(ctx context.Context, id TopicId, input SBTopic) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "topics.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "topics.TopicsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "topics.TopicsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c TopicsClient) preparerForCreateOrUpdate(ctx context.Context, id TopicId, input SBTopic) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c TopicsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/method_delete_autorest.go new file mode 100644 index 00000000000..9abdfc2088c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/method_delete_autorest.go @@ -0,0 +1,66 @@ +package topics + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c TopicsClient) Delete(ctx context.Context, id TopicId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "topics.TopicsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "topics.TopicsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "topics.TopicsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c TopicsClient) preparerForDelete(ctx context.Context, id TopicId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c TopicsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/method_get_autorest.go new file mode 100644 index 00000000000..d66109ae476 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/method_get_autorest.go @@ -0,0 +1,68 @@ +package topics + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *SBTopic +} + +// Get ... +func (c TopicsClient) Get(ctx context.Context, id TopicId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "topics.TopicsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "topics.TopicsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "topics.TopicsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c TopicsClient) preparerForGet(ctx context.Context, id TopicId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c TopicsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/method_listbynamespace_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/method_listbynamespace_autorest.go new file mode 100644 index 00000000000..5b3257c8eec --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/method_listbynamespace_autorest.go @@ -0,0 +1,220 @@ +package topics + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByNamespaceOperationResponse struct { + HttpResponse *http.Response + Model *[]SBTopic + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByNamespaceOperationResponse, error) +} + +type ListByNamespaceCompleteResult struct { + Items []SBTopic +} + +func (r ListByNamespaceOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByNamespaceOperationResponse) LoadMore(ctx context.Context) (resp ListByNamespaceOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type ListByNamespaceOperationOptions struct { + Skip *int64 + Top *int64 +} + +func DefaultListByNamespaceOperationOptions() ListByNamespaceOperationOptions { + return ListByNamespaceOperationOptions{} +} + +func (o ListByNamespaceOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListByNamespaceOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Skip != nil { + out["$skip"] = *o.Skip + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// ListByNamespace ... +func (c TopicsClient) ListByNamespace(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions) (resp ListByNamespaceOperationResponse, err error) { + req, err := c.preparerForListByNamespace(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "topics.TopicsClient", "ListByNamespace", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "topics.TopicsClient", "ListByNamespace", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByNamespace(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "topics.TopicsClient", "ListByNamespace", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByNamespace prepares the ListByNamespace request. +func (c TopicsClient) preparerForListByNamespace(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/topics", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByNamespaceWithNextLink prepares the ListByNamespace request with the given nextLink token. +func (c TopicsClient) preparerForListByNamespaceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByNamespace handles the response to the ListByNamespace request. The method always +// closes the http.Response Body. +func (c TopicsClient) responderForListByNamespace(resp *http.Response) (result ListByNamespaceOperationResponse, err error) { + type page struct { + Values []SBTopic `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByNamespaceOperationResponse, err error) { + req, err := c.preparerForListByNamespaceWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "topics.TopicsClient", "ListByNamespace", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "topics.TopicsClient", "ListByNamespace", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByNamespace(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "topics.TopicsClient", "ListByNamespace", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByNamespaceComplete retrieves all of the results into a single object +func (c TopicsClient) ListByNamespaceComplete(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions) (ListByNamespaceCompleteResult, error) { + return c.ListByNamespaceCompleteMatchingPredicate(ctx, id, options, SBTopicOperationPredicate{}) +} + +// ListByNamespaceCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c TopicsClient) ListByNamespaceCompleteMatchingPredicate(ctx context.Context, id NamespaceId, options ListByNamespaceOperationOptions, predicate SBTopicOperationPredicate) (resp ListByNamespaceCompleteResult, err error) { + items := make([]SBTopic, 0) + + page, err := c.ListByNamespace(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByNamespaceCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/model_messagecountdetails.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/model_messagecountdetails.go new file mode 100644 index 00000000000..4035d658e9c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/model_messagecountdetails.go @@ -0,0 +1,12 @@ +package topics + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MessageCountDetails struct { + ActiveMessageCount *int64 `json:"activeMessageCount,omitempty"` + DeadLetterMessageCount *int64 `json:"deadLetterMessageCount,omitempty"` + ScheduledMessageCount *int64 `json:"scheduledMessageCount,omitempty"` + TransferDeadLetterMessageCount *int64 `json:"transferDeadLetterMessageCount,omitempty"` + TransferMessageCount *int64 `json:"transferMessageCount,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/model_sbtopic.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/model_sbtopic.go new file mode 100644 index 00000000000..8143c623d4e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/model_sbtopic.go @@ -0,0 +1,16 @@ +package topics + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBTopic struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SBTopicProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/model_sbtopicproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/model_sbtopicproperties.go new file mode 100644 index 00000000000..ef51e8fe89f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/model_sbtopicproperties.go @@ -0,0 +1,66 @@ +package topics + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBTopicProperties struct { + AccessedAt *string `json:"accessedAt,omitempty"` + AutoDeleteOnIdle *string `json:"autoDeleteOnIdle,omitempty"` + CountDetails *MessageCountDetails `json:"countDetails,omitempty"` + CreatedAt *string `json:"createdAt,omitempty"` + DefaultMessageTimeToLive *string `json:"defaultMessageTimeToLive,omitempty"` + DuplicateDetectionHistoryTimeWindow *string `json:"duplicateDetectionHistoryTimeWindow,omitempty"` + EnableBatchedOperations *bool `json:"enableBatchedOperations,omitempty"` + EnableExpress *bool `json:"enableExpress,omitempty"` + EnablePartitioning *bool `json:"enablePartitioning,omitempty"` + MaxMessageSizeInKilobytes *int64 `json:"maxMessageSizeInKilobytes,omitempty"` + MaxSizeInMegabytes *int64 `json:"maxSizeInMegabytes,omitempty"` + RequiresDuplicateDetection *bool `json:"requiresDuplicateDetection,omitempty"` + SizeInBytes *int64 `json:"sizeInBytes,omitempty"` + Status *EntityStatus `json:"status,omitempty"` + SubscriptionCount *int64 `json:"subscriptionCount,omitempty"` + SupportOrdering *bool `json:"supportOrdering,omitempty"` + UpdatedAt *string `json:"updatedAt,omitempty"` +} + +func (o *SBTopicProperties) GetAccessedAtAsTime() (*time.Time, error) { + if o.AccessedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.AccessedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SBTopicProperties) SetAccessedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.AccessedAt = &formatted +} + +func (o *SBTopicProperties) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SBTopicProperties) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *SBTopicProperties) GetUpdatedAtAsTime() (*time.Time, error) { + if o.UpdatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.UpdatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SBTopicProperties) SetUpdatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.UpdatedAt = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/predicates.go new file mode 100644 index 00000000000..0a1a4cf85b2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/predicates.go @@ -0,0 +1,24 @@ +package topics + +type SBTopicOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SBTopicOperationPredicate) Matches(input SBTopic) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/version.go new file mode 100644 index 00000000000..f30136ef355 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics/version.go @@ -0,0 +1,12 @@ +package topics + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/topics/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/README.md new file mode 100644 index 00000000000..9f43c536d69 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/README.md @@ -0,0 +1,127 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule` Documentation + +The `topicsauthorizationrule` SDK allows for interaction with the Azure Resource Manager Service `servicebus` (API Version `2021-06-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule" +``` + + +### Client Initialization + +```go +client := topicsauthorizationrule.NewTopicsAuthorizationRuleClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `TopicsAuthorizationRuleClient.TopicsCreateOrUpdateAuthorizationRule` + +```go +ctx := context.TODO() +id := topicsauthorizationrule.NewTopicAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue", "authorizationRuleValue") + +payload := topicsauthorizationrule.SBAuthorizationRule{ + // ... +} + + +read, err := client.TopicsCreateOrUpdateAuthorizationRule(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TopicsAuthorizationRuleClient.TopicsDeleteAuthorizationRule` + +```go +ctx := context.TODO() +id := topicsauthorizationrule.NewTopicAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue", "authorizationRuleValue") + +read, err := client.TopicsDeleteAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TopicsAuthorizationRuleClient.TopicsGetAuthorizationRule` + +```go +ctx := context.TODO() +id := topicsauthorizationrule.NewTopicAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue", "authorizationRuleValue") + +read, err := client.TopicsGetAuthorizationRule(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TopicsAuthorizationRuleClient.TopicsListAuthorizationRules` + +```go +ctx := context.TODO() +id := topicsauthorizationrule.NewTopicID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue") + +// alternatively `client.TopicsListAuthorizationRules(ctx, id)` can be used to do batched pagination +items, err := client.TopicsListAuthorizationRulesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `TopicsAuthorizationRuleClient.TopicsListKeys` + +```go +ctx := context.TODO() +id := topicsauthorizationrule.NewTopicAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue", "authorizationRuleValue") + +read, err := client.TopicsListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `TopicsAuthorizationRuleClient.TopicsRegenerateKeys` + +```go +ctx := context.TODO() +id := topicsauthorizationrule.NewTopicAuthorizationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "namespaceValue", "topicValue", "authorizationRuleValue") + +payload := topicsauthorizationrule.RegenerateAccessKeyParameters{ + // ... +} + + +read, err := client.TopicsRegenerateKeys(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/client.go new file mode 100644 index 00000000000..271398331b7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/client.go @@ -0,0 +1,18 @@ +package topicsauthorizationrule + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TopicsAuthorizationRuleClient struct { + Client autorest.Client + baseUri string +} + +func NewTopicsAuthorizationRuleClientWithBaseURI(endpoint string) TopicsAuthorizationRuleClient { + return TopicsAuthorizationRuleClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/constants.go new file mode 100644 index 00000000000..36f8229f806 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/constants.go @@ -0,0 +1,65 @@ +package topicsauthorizationrule + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessRights string + +const ( + AccessRightsListen AccessRights = "Listen" + AccessRightsManage AccessRights = "Manage" + AccessRightsSend AccessRights = "Send" +) + +func PossibleValuesForAccessRights() []string { + return []string{ + string(AccessRightsListen), + string(AccessRightsManage), + string(AccessRightsSend), + } +} + +func parseAccessRights(input string) (*AccessRights, error) { + vals := map[string]AccessRights{ + "listen": AccessRightsListen, + "manage": AccessRightsManage, + "send": AccessRightsSend, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessRights(input) + return &out, nil +} + +type KeyType string + +const ( + KeyTypePrimaryKey KeyType = "PrimaryKey" + KeyTypeSecondaryKey KeyType = "SecondaryKey" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypePrimaryKey), + string(KeyTypeSecondaryKey), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "primarykey": KeyTypePrimaryKey, + "secondarykey": KeyTypeSecondaryKey, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/id_topic.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/id_topic.go new file mode 100644 index 00000000000..909935c8ca7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/id_topic.go @@ -0,0 +1,137 @@ +package topicsauthorizationrule + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = TopicId{} + +// TopicId is a struct representing the Resource ID for a Topic +type TopicId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + TopicName string +} + +// NewTopicID returns a new TopicId struct +func NewTopicID(subscriptionId string, resourceGroupName string, namespaceName string, topicName string) TopicId { + return TopicId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + TopicName: topicName, + } +} + +// ParseTopicID parses 'input' into a TopicId +func ParseTopicID(input string) (*TopicId, error) { + parser := resourceids.NewParserFromResourceIdType(TopicId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TopicId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseTopicIDInsensitively parses 'input' case-insensitively into a TopicId +// note: this method should only be used for API response data and not user input +func ParseTopicIDInsensitively(input string) (*TopicId, error) { + parser := resourceids.NewParserFromResourceIdType(TopicId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TopicId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateTopicID checks that 'input' can be parsed as a Topic ID +func ValidateTopicID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseTopicID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Topic ID +func (id TopicId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/topics/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.TopicName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Topic ID +func (id TopicId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticTopics", "topics", "topics"), + resourceids.UserSpecifiedSegment("topicName", "topicValue"), + } +} + +// String returns a human-readable description of this Topic ID +func (id TopicId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Topic Name: %q", id.TopicName), + } + return fmt.Sprintf("Topic (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/id_topicauthorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/id_topicauthorizationrule.go new file mode 100644 index 00000000000..349c1a5a24a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/id_topicauthorizationrule.go @@ -0,0 +1,150 @@ +package topicsauthorizationrule + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = TopicAuthorizationRuleId{} + +// TopicAuthorizationRuleId is a struct representing the Resource ID for a Topic Authorization Rule +type TopicAuthorizationRuleId struct { + SubscriptionId string + ResourceGroupName string + NamespaceName string + TopicName string + AuthorizationRuleName string +} + +// NewTopicAuthorizationRuleID returns a new TopicAuthorizationRuleId struct +func NewTopicAuthorizationRuleID(subscriptionId string, resourceGroupName string, namespaceName string, topicName string, authorizationRuleName string) TopicAuthorizationRuleId { + return TopicAuthorizationRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NamespaceName: namespaceName, + TopicName: topicName, + AuthorizationRuleName: authorizationRuleName, + } +} + +// ParseTopicAuthorizationRuleID parses 'input' into a TopicAuthorizationRuleId +func ParseTopicAuthorizationRuleID(input string) (*TopicAuthorizationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(TopicAuthorizationRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TopicAuthorizationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseTopicAuthorizationRuleIDInsensitively parses 'input' case-insensitively into a TopicAuthorizationRuleId +// note: this method should only be used for API response data and not user input +func ParseTopicAuthorizationRuleIDInsensitively(input string) (*TopicAuthorizationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(TopicAuthorizationRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := TopicAuthorizationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { + return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) + } + + if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { + return nil, fmt.Errorf("the segment 'topicName' was not found in the resource id %q", input) + } + + if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { + return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateTopicAuthorizationRuleID checks that 'input' can be parsed as a Topic Authorization Rule ID +func ValidateTopicAuthorizationRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseTopicAuthorizationRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Topic Authorization Rule ID +func (id TopicAuthorizationRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/topics/%s/authorizationRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.TopicName, id.AuthorizationRuleName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Topic Authorization Rule ID +func (id TopicAuthorizationRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceBus", "Microsoft.ServiceBus", "Microsoft.ServiceBus"), + resourceids.StaticSegment("staticNamespaces", "namespaces", "namespaces"), + resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), + resourceids.StaticSegment("staticTopics", "topics", "topics"), + resourceids.UserSpecifiedSegment("topicName", "topicValue"), + resourceids.StaticSegment("staticAuthorizationRules", "authorizationRules", "authorizationRules"), + resourceids.UserSpecifiedSegment("authorizationRuleName", "authorizationRuleValue"), + } +} + +// String returns a human-readable description of this Topic Authorization Rule ID +func (id TopicAuthorizationRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Namespace Name: %q", id.NamespaceName), + fmt.Sprintf("Topic Name: %q", id.TopicName), + fmt.Sprintf("Authorization Rule Name: %q", id.AuthorizationRuleName), + } + return fmt.Sprintf("Topic Authorization Rule (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicscreateorupdateauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicscreateorupdateauthorizationrule_autorest.go new file mode 100644 index 00000000000..9f7bfa84e71 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicscreateorupdateauthorizationrule_autorest.go @@ -0,0 +1,69 @@ +package topicsauthorizationrule + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TopicsCreateOrUpdateAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *SBAuthorizationRule +} + +// TopicsCreateOrUpdateAuthorizationRule ... +func (c TopicsAuthorizationRuleClient) TopicsCreateOrUpdateAuthorizationRule(ctx context.Context, id TopicAuthorizationRuleId, input SBAuthorizationRule) (result TopicsCreateOrUpdateAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForTopicsCreateOrUpdateAuthorizationRule(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsCreateOrUpdateAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsCreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForTopicsCreateOrUpdateAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsCreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForTopicsCreateOrUpdateAuthorizationRule prepares the TopicsCreateOrUpdateAuthorizationRule request. +func (c TopicsAuthorizationRuleClient) preparerForTopicsCreateOrUpdateAuthorizationRule(ctx context.Context, id TopicAuthorizationRuleId, input SBAuthorizationRule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForTopicsCreateOrUpdateAuthorizationRule handles the response to the TopicsCreateOrUpdateAuthorizationRule request. The method always +// closes the http.Response Body. +func (c TopicsAuthorizationRuleClient) responderForTopicsCreateOrUpdateAuthorizationRule(resp *http.Response) (result TopicsCreateOrUpdateAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicsdeleteauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicsdeleteauthorizationrule_autorest.go new file mode 100644 index 00000000000..66ecbcd74c6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicsdeleteauthorizationrule_autorest.go @@ -0,0 +1,66 @@ +package topicsauthorizationrule + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TopicsDeleteAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response +} + +// TopicsDeleteAuthorizationRule ... +func (c TopicsAuthorizationRuleClient) TopicsDeleteAuthorizationRule(ctx context.Context, id TopicAuthorizationRuleId) (result TopicsDeleteAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForTopicsDeleteAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsDeleteAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsDeleteAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForTopicsDeleteAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsDeleteAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForTopicsDeleteAuthorizationRule prepares the TopicsDeleteAuthorizationRule request. +func (c TopicsAuthorizationRuleClient) preparerForTopicsDeleteAuthorizationRule(ctx context.Context, id TopicAuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForTopicsDeleteAuthorizationRule handles the response to the TopicsDeleteAuthorizationRule request. The method always +// closes the http.Response Body. +func (c TopicsAuthorizationRuleClient) responderForTopicsDeleteAuthorizationRule(resp *http.Response) (result TopicsDeleteAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicsgetauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicsgetauthorizationrule_autorest.go new file mode 100644 index 00000000000..02f07673be2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicsgetauthorizationrule_autorest.go @@ -0,0 +1,68 @@ +package topicsauthorizationrule + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TopicsGetAuthorizationRuleOperationResponse struct { + HttpResponse *http.Response + Model *SBAuthorizationRule +} + +// TopicsGetAuthorizationRule ... +func (c TopicsAuthorizationRuleClient) TopicsGetAuthorizationRule(ctx context.Context, id TopicAuthorizationRuleId) (result TopicsGetAuthorizationRuleOperationResponse, err error) { + req, err := c.preparerForTopicsGetAuthorizationRule(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsGetAuthorizationRule", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsGetAuthorizationRule", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForTopicsGetAuthorizationRule(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsGetAuthorizationRule", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForTopicsGetAuthorizationRule prepares the TopicsGetAuthorizationRule request. +func (c TopicsAuthorizationRuleClient) preparerForTopicsGetAuthorizationRule(ctx context.Context, id TopicAuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForTopicsGetAuthorizationRule handles the response to the TopicsGetAuthorizationRule request. The method always +// closes the http.Response Body. +func (c TopicsAuthorizationRuleClient) responderForTopicsGetAuthorizationRule(resp *http.Response) (result TopicsGetAuthorizationRuleOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicslistauthorizationrules_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicslistauthorizationrules_autorest.go new file mode 100644 index 00000000000..be10b275338 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicslistauthorizationrules_autorest.go @@ -0,0 +1,186 @@ +package topicsauthorizationrule + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TopicsListAuthorizationRulesOperationResponse struct { + HttpResponse *http.Response + Model *[]SBAuthorizationRule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (TopicsListAuthorizationRulesOperationResponse, error) +} + +type TopicsListAuthorizationRulesCompleteResult struct { + Items []SBAuthorizationRule +} + +func (r TopicsListAuthorizationRulesOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r TopicsListAuthorizationRulesOperationResponse) LoadMore(ctx context.Context) (resp TopicsListAuthorizationRulesOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// TopicsListAuthorizationRules ... +func (c TopicsAuthorizationRuleClient) TopicsListAuthorizationRules(ctx context.Context, id TopicId) (resp TopicsListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForTopicsListAuthorizationRules(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsListAuthorizationRules", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsListAuthorizationRules", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForTopicsListAuthorizationRules(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsListAuthorizationRules", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForTopicsListAuthorizationRules prepares the TopicsListAuthorizationRules request. +func (c TopicsAuthorizationRuleClient) preparerForTopicsListAuthorizationRules(ctx context.Context, id TopicId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/authorizationRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForTopicsListAuthorizationRulesWithNextLink prepares the TopicsListAuthorizationRules request with the given nextLink token. +func (c TopicsAuthorizationRuleClient) preparerForTopicsListAuthorizationRulesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForTopicsListAuthorizationRules handles the response to the TopicsListAuthorizationRules request. The method always +// closes the http.Response Body. +func (c TopicsAuthorizationRuleClient) responderForTopicsListAuthorizationRules(resp *http.Response) (result TopicsListAuthorizationRulesOperationResponse, err error) { + type page struct { + Values []SBAuthorizationRule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result TopicsListAuthorizationRulesOperationResponse, err error) { + req, err := c.preparerForTopicsListAuthorizationRulesWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsListAuthorizationRules", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsListAuthorizationRules", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForTopicsListAuthorizationRules(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsListAuthorizationRules", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// TopicsListAuthorizationRulesComplete retrieves all of the results into a single object +func (c TopicsAuthorizationRuleClient) TopicsListAuthorizationRulesComplete(ctx context.Context, id TopicId) (TopicsListAuthorizationRulesCompleteResult, error) { + return c.TopicsListAuthorizationRulesCompleteMatchingPredicate(ctx, id, SBAuthorizationRuleOperationPredicate{}) +} + +// TopicsListAuthorizationRulesCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c TopicsAuthorizationRuleClient) TopicsListAuthorizationRulesCompleteMatchingPredicate(ctx context.Context, id TopicId, predicate SBAuthorizationRuleOperationPredicate) (resp TopicsListAuthorizationRulesCompleteResult, err error) { + items := make([]SBAuthorizationRule, 0) + + page, err := c.TopicsListAuthorizationRules(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := TopicsListAuthorizationRulesCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicslistkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicslistkeys_autorest.go new file mode 100644 index 00000000000..03e8db4e594 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicslistkeys_autorest.go @@ -0,0 +1,69 @@ +package topicsauthorizationrule + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TopicsListKeysOperationResponse struct { + HttpResponse *http.Response + Model *AccessKeys +} + +// TopicsListKeys ... +func (c TopicsAuthorizationRuleClient) TopicsListKeys(ctx context.Context, id TopicAuthorizationRuleId) (result TopicsListKeysOperationResponse, err error) { + req, err := c.preparerForTopicsListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForTopicsListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForTopicsListKeys prepares the TopicsListKeys request. +func (c TopicsAuthorizationRuleClient) preparerForTopicsListKeys(ctx context.Context, id TopicAuthorizationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForTopicsListKeys handles the response to the TopicsListKeys request. The method always +// closes the http.Response Body. +func (c TopicsAuthorizationRuleClient) responderForTopicsListKeys(resp *http.Response) (result TopicsListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicsregeneratekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicsregeneratekeys_autorest.go new file mode 100644 index 00000000000..623a6f24dd8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/method_topicsregeneratekeys_autorest.go @@ -0,0 +1,70 @@ +package topicsauthorizationrule + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TopicsRegenerateKeysOperationResponse struct { + HttpResponse *http.Response + Model *AccessKeys +} + +// TopicsRegenerateKeys ... +func (c TopicsAuthorizationRuleClient) TopicsRegenerateKeys(ctx context.Context, id TopicAuthorizationRuleId, input RegenerateAccessKeyParameters) (result TopicsRegenerateKeysOperationResponse, err error) { + req, err := c.preparerForTopicsRegenerateKeys(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsRegenerateKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsRegenerateKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForTopicsRegenerateKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "topicsauthorizationrule.TopicsAuthorizationRuleClient", "TopicsRegenerateKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForTopicsRegenerateKeys prepares the TopicsRegenerateKeys request. +func (c TopicsAuthorizationRuleClient) preparerForTopicsRegenerateKeys(ctx context.Context, id TopicAuthorizationRuleId, input RegenerateAccessKeyParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKeys", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForTopicsRegenerateKeys handles the response to the TopicsRegenerateKeys request. The method always +// closes the http.Response Body. +func (c TopicsAuthorizationRuleClient) responderForTopicsRegenerateKeys(resp *http.Response) (result TopicsRegenerateKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/model_accesskeys.go new file mode 100644 index 00000000000..88589044cc6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/model_accesskeys.go @@ -0,0 +1,14 @@ +package topicsauthorizationrule + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeys struct { + AliasPrimaryConnectionString *string `json:"aliasPrimaryConnectionString,omitempty"` + AliasSecondaryConnectionString *string `json:"aliasSecondaryConnectionString,omitempty"` + KeyName *string `json:"keyName,omitempty"` + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/model_regenerateaccesskeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/model_regenerateaccesskeyparameters.go new file mode 100644 index 00000000000..30ff1e93bdb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/model_regenerateaccesskeyparameters.go @@ -0,0 +1,9 @@ +package topicsauthorizationrule + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateAccessKeyParameters struct { + Key *string `json:"key,omitempty"` + KeyType KeyType `json:"keyType"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/model_sbauthorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/model_sbauthorizationrule.go new file mode 100644 index 00000000000..09528bbcee5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/model_sbauthorizationrule.go @@ -0,0 +1,16 @@ +package topicsauthorizationrule + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBAuthorizationRule struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SBAuthorizationRuleProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/model_sbauthorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/model_sbauthorizationruleproperties.go new file mode 100644 index 00000000000..eb1e1b6eeab --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/model_sbauthorizationruleproperties.go @@ -0,0 +1,8 @@ +package topicsauthorizationrule + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SBAuthorizationRuleProperties struct { + Rights []AccessRights `json:"rights"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/predicates.go new file mode 100644 index 00000000000..0d5880d8427 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/predicates.go @@ -0,0 +1,24 @@ +package topicsauthorizationrule + +type SBAuthorizationRuleOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SBAuthorizationRuleOperationPredicate) Matches(input SBAuthorizationRule) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/version.go new file mode 100644 index 00000000000..744b13fb7f3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/version.go @@ -0,0 +1,12 @@ +package topicsauthorizationrule + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-06-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/topicsauthorizationrule/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/README.md new file mode 100644 index 00000000000..72af79eb273 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/README.md @@ -0,0 +1,120 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster` Documentation + +The `managedcluster` SDK allows for interaction with the Azure Resource Manager Service `servicefabricmanagedcluster` (API Version `2021-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster" +``` + + +### Client Initialization + +```go +client := managedcluster.NewManagedClusterClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ManagedClusterClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := managedcluster.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := managedcluster.ManagedCluster{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ManagedClusterClient.Delete` + +```go +ctx := context.TODO() +id := managedcluster.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ManagedClusterClient.Get` + +```go +ctx := context.TODO() +id := managedcluster.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedClusterClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := managedcluster.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ManagedClusterClient.ListBySubscription` + +```go +ctx := context.TODO() +id := managedcluster.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ManagedClusterClient.Update` + +```go +ctx := context.TODO() +id := managedcluster.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := managedcluster.ManagedClusterUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/client.go new file mode 100644 index 00000000000..52b5b623754 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/client.go @@ -0,0 +1,18 @@ +package managedcluster + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedClusterClient struct { + Client autorest.Client + baseUri string +} + +func NewManagedClusterClientWithBaseURI(endpoint string) ManagedClusterClient { + return ManagedClusterClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/constants.go new file mode 100644 index 00000000000..919c6fccb49 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/constants.go @@ -0,0 +1,374 @@ +package managedcluster + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Access string + +const ( + AccessAllow Access = "allow" + AccessDeny Access = "deny" +) + +func PossibleValuesForAccess() []string { + return []string{ + string(AccessAllow), + string(AccessDeny), + } +} + +func parseAccess(input string) (*Access, error) { + vals := map[string]Access{ + "allow": AccessAllow, + "deny": AccessDeny, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Access(input) + return &out, nil +} + +type AddonFeatures string + +const ( + AddonFeaturesBackupRestoreService AddonFeatures = "BackupRestoreService" + AddonFeaturesDnsService AddonFeatures = "DnsService" + AddonFeaturesResourceMonitorService AddonFeatures = "ResourceMonitorService" +) + +func PossibleValuesForAddonFeatures() []string { + return []string{ + string(AddonFeaturesBackupRestoreService), + string(AddonFeaturesDnsService), + string(AddonFeaturesResourceMonitorService), + } +} + +func parseAddonFeatures(input string) (*AddonFeatures, error) { + vals := map[string]AddonFeatures{ + "backuprestoreservice": AddonFeaturesBackupRestoreService, + "dnsservice": AddonFeaturesDnsService, + "resourcemonitorservice": AddonFeaturesResourceMonitorService, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AddonFeatures(input) + return &out, nil +} + +type ClusterState string + +const ( + ClusterStateBaselineUpgrade ClusterState = "BaselineUpgrade" + ClusterStateDeploying ClusterState = "Deploying" + ClusterStateReady ClusterState = "Ready" + ClusterStateUpgradeFailed ClusterState = "UpgradeFailed" + ClusterStateUpgrading ClusterState = "Upgrading" + ClusterStateWaitingForNodes ClusterState = "WaitingForNodes" +) + +func PossibleValuesForClusterState() []string { + return []string{ + string(ClusterStateBaselineUpgrade), + string(ClusterStateDeploying), + string(ClusterStateReady), + string(ClusterStateUpgradeFailed), + string(ClusterStateUpgrading), + string(ClusterStateWaitingForNodes), + } +} + +func parseClusterState(input string) (*ClusterState, error) { + vals := map[string]ClusterState{ + "baselineupgrade": ClusterStateBaselineUpgrade, + "deploying": ClusterStateDeploying, + "ready": ClusterStateReady, + "upgradefailed": ClusterStateUpgradeFailed, + "upgrading": ClusterStateUpgrading, + "waitingfornodes": ClusterStateWaitingForNodes, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterState(input) + return &out, nil +} + +type ClusterUpgradeCadence string + +const ( + ClusterUpgradeCadenceWaveOne ClusterUpgradeCadence = "Wave1" + ClusterUpgradeCadenceWaveTwo ClusterUpgradeCadence = "Wave2" + ClusterUpgradeCadenceWaveZero ClusterUpgradeCadence = "Wave0" +) + +func PossibleValuesForClusterUpgradeCadence() []string { + return []string{ + string(ClusterUpgradeCadenceWaveOne), + string(ClusterUpgradeCadenceWaveTwo), + string(ClusterUpgradeCadenceWaveZero), + } +} + +func parseClusterUpgradeCadence(input string) (*ClusterUpgradeCadence, error) { + vals := map[string]ClusterUpgradeCadence{ + "wave1": ClusterUpgradeCadenceWaveOne, + "wave2": ClusterUpgradeCadenceWaveTwo, + "wave0": ClusterUpgradeCadenceWaveZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterUpgradeCadence(input) + return &out, nil +} + +type ClusterUpgradeMode string + +const ( + ClusterUpgradeModeAutomatic ClusterUpgradeMode = "Automatic" + ClusterUpgradeModeManual ClusterUpgradeMode = "Manual" +) + +func PossibleValuesForClusterUpgradeMode() []string { + return []string{ + string(ClusterUpgradeModeAutomatic), + string(ClusterUpgradeModeManual), + } +} + +func parseClusterUpgradeMode(input string) (*ClusterUpgradeMode, error) { + vals := map[string]ClusterUpgradeMode{ + "automatic": ClusterUpgradeModeAutomatic, + "manual": ClusterUpgradeModeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterUpgradeMode(input) + return &out, nil +} + +type Direction string + +const ( + DirectionInbound Direction = "inbound" + DirectionOutbound Direction = "outbound" +) + +func PossibleValuesForDirection() []string { + return []string{ + string(DirectionInbound), + string(DirectionOutbound), + } +} + +func parseDirection(input string) (*Direction, error) { + vals := map[string]Direction{ + "inbound": DirectionInbound, + "outbound": DirectionOutbound, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Direction(input) + return &out, nil +} + +type ManagedResourceProvisioningState string + +const ( + ManagedResourceProvisioningStateCanceled ManagedResourceProvisioningState = "Canceled" + ManagedResourceProvisioningStateCreated ManagedResourceProvisioningState = "Created" + ManagedResourceProvisioningStateCreating ManagedResourceProvisioningState = "Creating" + ManagedResourceProvisioningStateDeleted ManagedResourceProvisioningState = "Deleted" + ManagedResourceProvisioningStateDeleting ManagedResourceProvisioningState = "Deleting" + ManagedResourceProvisioningStateFailed ManagedResourceProvisioningState = "Failed" + ManagedResourceProvisioningStateNone ManagedResourceProvisioningState = "None" + ManagedResourceProvisioningStateOther ManagedResourceProvisioningState = "Other" + ManagedResourceProvisioningStateSucceeded ManagedResourceProvisioningState = "Succeeded" + ManagedResourceProvisioningStateUpdating ManagedResourceProvisioningState = "Updating" +) + +func PossibleValuesForManagedResourceProvisioningState() []string { + return []string{ + string(ManagedResourceProvisioningStateCanceled), + string(ManagedResourceProvisioningStateCreated), + string(ManagedResourceProvisioningStateCreating), + string(ManagedResourceProvisioningStateDeleted), + string(ManagedResourceProvisioningStateDeleting), + string(ManagedResourceProvisioningStateFailed), + string(ManagedResourceProvisioningStateNone), + string(ManagedResourceProvisioningStateOther), + string(ManagedResourceProvisioningStateSucceeded), + string(ManagedResourceProvisioningStateUpdating), + } +} + +func parseManagedResourceProvisioningState(input string) (*ManagedResourceProvisioningState, error) { + vals := map[string]ManagedResourceProvisioningState{ + "canceled": ManagedResourceProvisioningStateCanceled, + "created": ManagedResourceProvisioningStateCreated, + "creating": ManagedResourceProvisioningStateCreating, + "deleted": ManagedResourceProvisioningStateDeleted, + "deleting": ManagedResourceProvisioningStateDeleting, + "failed": ManagedResourceProvisioningStateFailed, + "none": ManagedResourceProvisioningStateNone, + "other": ManagedResourceProvisioningStateOther, + "succeeded": ManagedResourceProvisioningStateSucceeded, + "updating": ManagedResourceProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ManagedResourceProvisioningState(input) + return &out, nil +} + +type NsgProtocol string + +const ( + NsgProtocolAh NsgProtocol = "ah" + NsgProtocolEsp NsgProtocol = "esp" + NsgProtocolHttp NsgProtocol = "http" + NsgProtocolHttps NsgProtocol = "https" + NsgProtocolIcmp NsgProtocol = "icmp" + NsgProtocolTcp NsgProtocol = "tcp" + NsgProtocolUdp NsgProtocol = "udp" +) + +func PossibleValuesForNsgProtocol() []string { + return []string{ + string(NsgProtocolAh), + string(NsgProtocolEsp), + string(NsgProtocolHttp), + string(NsgProtocolHttps), + string(NsgProtocolIcmp), + string(NsgProtocolTcp), + string(NsgProtocolUdp), + } +} + +func parseNsgProtocol(input string) (*NsgProtocol, error) { + vals := map[string]NsgProtocol{ + "ah": NsgProtocolAh, + "esp": NsgProtocolEsp, + "http": NsgProtocolHttp, + "https": NsgProtocolHttps, + "icmp": NsgProtocolIcmp, + "tcp": NsgProtocolTcp, + "udp": NsgProtocolUdp, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NsgProtocol(input) + return &out, nil +} + +type ProbeProtocol string + +const ( + ProbeProtocolHttp ProbeProtocol = "http" + ProbeProtocolHttps ProbeProtocol = "https" + ProbeProtocolTcp ProbeProtocol = "tcp" +) + +func PossibleValuesForProbeProtocol() []string { + return []string{ + string(ProbeProtocolHttp), + string(ProbeProtocolHttps), + string(ProbeProtocolTcp), + } +} + +func parseProbeProtocol(input string) (*ProbeProtocol, error) { + vals := map[string]ProbeProtocol{ + "http": ProbeProtocolHttp, + "https": ProbeProtocolHttps, + "tcp": ProbeProtocolTcp, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProbeProtocol(input) + return &out, nil +} + +type Protocol string + +const ( + ProtocolTcp Protocol = "tcp" + ProtocolUdp Protocol = "udp" +) + +func PossibleValuesForProtocol() []string { + return []string{ + string(ProtocolTcp), + string(ProtocolUdp), + } +} + +func parseProtocol(input string) (*Protocol, error) { + vals := map[string]Protocol{ + "tcp": ProtocolTcp, + "udp": ProtocolUdp, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Protocol(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameBasic SkuName = "Basic" + SkuNameStandard SkuName = "Standard" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameBasic), + string(SkuNameStandard), + } +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "basic": SkuNameBasic, + "standard": SkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/id_managedcluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/id_managedcluster.go new file mode 100644 index 00000000000..87f17263375 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/id_managedcluster.go @@ -0,0 +1,124 @@ +package managedcluster + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ManagedClusterId{} + +// ManagedClusterId is a struct representing the Resource ID for a Managed Cluster +type ManagedClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewManagedClusterID returns a new ManagedClusterId struct +func NewManagedClusterID(subscriptionId string, resourceGroupName string, clusterName string) ManagedClusterId { + return ManagedClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseManagedClusterID parses 'input' into a ManagedClusterId +func ParseManagedClusterID(input string) (*ManagedClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagedClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagedClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseManagedClusterIDInsensitively parses 'input' case-insensitively into a ManagedClusterId +// note: this method should only be used for API response data and not user input +func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagedClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagedClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateManagedClusterID checks that 'input' can be parsed as a Managed Cluster ID +func ValidateManagedClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseManagedClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Managed Cluster ID +func (id ManagedClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceFabric/managedClusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Managed Cluster ID +func (id ManagedClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceFabric", "Microsoft.ServiceFabric", "Microsoft.ServiceFabric"), + resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Managed Cluster ID +func (id ManagedClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Managed Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate_autorest.go new file mode 100644 index 00000000000..3bd629f36d5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package managedcluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c ManagedClusterClient) CreateOrUpdate(ctx context.Context, id ManagedClusterId, input ManagedCluster) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ManagedClusterClient) CreateOrUpdateThenPoll(ctx context.Context, id ManagedClusterId, input ManagedCluster) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ManagedClusterClient) preparerForCreateOrUpdate(ctx context.Context, id ManagedClusterId, input ManagedCluster) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ManagedClusterClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete_autorest.go new file mode 100644 index 00000000000..68b47184164 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_delete_autorest.go @@ -0,0 +1,78 @@ +package managedcluster + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ManagedClusterClient) Delete(ctx context.Context, id ManagedClusterId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ManagedClusterClient) DeleteThenPoll(ctx context.Context, id ManagedClusterId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ManagedClusterClient) preparerForDelete(ctx context.Context, id ManagedClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ManagedClusterClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_get_autorest.go new file mode 100644 index 00000000000..e81b8d3b20b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_get_autorest.go @@ -0,0 +1,68 @@ +package managedcluster + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ManagedCluster +} + +// Get ... +func (c ManagedClusterClient) Get(ctx context.Context, id ManagedClusterId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ManagedClusterClient) preparerForGet(ctx context.Context, id ManagedClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ManagedClusterClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..aa3e398b648 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package managedcluster + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]ManagedCluster + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []ManagedCluster +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c ManagedClusterClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ManagedClusterClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ServiceFabric/managedClusters", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c ManagedClusterClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ManagedClusterClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []ManagedCluster `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c ManagedClusterClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ManagedClusterClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ManagedClusterOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]ManagedCluster, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..42722389796 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package managedcluster + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]ManagedCluster + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []ManagedCluster +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c ManagedClusterClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c ManagedClusterClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ServiceFabric/managedClusters", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c ManagedClusterClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c ManagedClusterClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []ManagedCluster `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c ManagedClusterClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ManagedClusterOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ManagedClusterClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ManagedClusterOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]ManagedCluster, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_update_autorest.go new file mode 100644 index 00000000000..c11f0beae5b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/method_update_autorest.go @@ -0,0 +1,69 @@ +package managedcluster + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *ManagedCluster +} + +// Update ... +func (c ManagedClusterClient) Update(ctx context.Context, id ManagedClusterId, input ManagedClusterUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ManagedClusterClient) preparerForUpdate(ctx context.Context, id ManagedClusterId, input ManagedClusterUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ManagedClusterClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_applicationtypeversionscleanuppolicy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_applicationtypeversionscleanuppolicy.go new file mode 100644 index 00000000000..c99ec72c444 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_applicationtypeversionscleanuppolicy.go @@ -0,0 +1,8 @@ +package managedcluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationTypeVersionsCleanupPolicy struct { + MaxUnusedVersionsToKeep int64 `json:"maxUnusedVersionsToKeep"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_azureactivedirectory.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_azureactivedirectory.go new file mode 100644 index 00000000000..4652ddc32fc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_azureactivedirectory.go @@ -0,0 +1,10 @@ +package managedcluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureActiveDirectory struct { + ClientApplication *string `json:"clientApplication,omitempty"` + ClusterApplication *string `json:"clusterApplication,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_clientcertificate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_clientcertificate.go new file mode 100644 index 00000000000..76ae210078d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_clientcertificate.go @@ -0,0 +1,11 @@ +package managedcluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClientCertificate struct { + CommonName *string `json:"commonName,omitempty"` + IsAdmin bool `json:"isAdmin"` + IssuerThumbprint *string `json:"issuerThumbprint,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_loadbalancingrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_loadbalancingrule.go new file mode 100644 index 00000000000..c030eaad21f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_loadbalancingrule.go @@ -0,0 +1,13 @@ +package managedcluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LoadBalancingRule struct { + BackendPort int64 `json:"backendPort"` + FrontendPort int64 `json:"frontendPort"` + ProbePort *int64 `json:"probePort,omitempty"` + ProbeProtocol ProbeProtocol `json:"probeProtocol"` + ProbeRequestPath *string `json:"probeRequestPath,omitempty"` + Protocol Protocol `json:"protocol"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_managedcluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_managedcluster.go similarity index 79% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_managedcluster.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_managedcluster.go index ca8c97ffd30..143b0d34ac6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_managedcluster.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_managedcluster.go @@ -1,5 +1,8 @@ package managedcluster +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ManagedCluster struct { Etag *string `json:"etag,omitempty"` Id *string `json:"id,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_managedclusterproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_managedclusterproperties.go similarity index 92% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_managedclusterproperties.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_managedclusterproperties.go index a9f0e017fd2..db07badc23b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_managedclusterproperties.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_managedclusterproperties.go @@ -1,5 +1,8 @@ package managedcluster +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ManagedClusterProperties struct { AddonFeatures *[]AddonFeatures `json:"addonFeatures,omitempty"` AdminPassword *string `json:"adminPassword,omitempty"` @@ -20,7 +23,7 @@ type ManagedClusterProperties struct { FabricSettings *[]SettingsSectionDescription `json:"fabricSettings,omitempty"` Fqdn *string `json:"fqdn,omitempty"` HttpGatewayConnectionPort *int64 `json:"httpGatewayConnectionPort,omitempty"` - Ipv4Address *string `json:"ipv4Address,omitempty"` + IPv4Address *string `json:"ipv4Address,omitempty"` LoadBalancingRules *[]LoadBalancingRule `json:"loadBalancingRules,omitempty"` NetworkSecurityRules *[]NetworkSecurityRule `json:"networkSecurityRules,omitempty"` ProvisioningState *ManagedResourceProvisioningState `json:"provisioningState,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_managedclusterupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_managedclusterupdateparameters.go new file mode 100644 index 00000000000..1d326fe666e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_managedclusterupdateparameters.go @@ -0,0 +1,8 @@ +package managedcluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedClusterUpdateParameters struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_networksecurityrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_networksecurityrule.go similarity index 82% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_networksecurityrule.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_networksecurityrule.go index 69355a7230e..1f54e3367e0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_networksecurityrule.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_networksecurityrule.go @@ -1,5 +1,8 @@ package managedcluster +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type NetworkSecurityRule struct { Access Access `json:"access"` Description *string `json:"description,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_settingsparameterdescription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_settingsparameterdescription.go new file mode 100644 index 00000000000..0dc2d1760ae --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_settingsparameterdescription.go @@ -0,0 +1,9 @@ +package managedcluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SettingsParameterDescription struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_settingssectiondescription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_settingssectiondescription.go new file mode 100644 index 00000000000..6af0cbf636a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_settingssectiondescription.go @@ -0,0 +1,9 @@ +package managedcluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SettingsSectionDescription struct { + Name string `json:"name"` + Parameters []SettingsParameterDescription `json:"parameters"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_sku.go new file mode 100644 index 00000000000..f92824762c9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_sku.go @@ -0,0 +1,8 @@ +package managedcluster + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name SkuName `json:"name"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_systemdata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_systemdata.go new file mode 100644 index 00000000000..a7a0bde5974 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/model_systemdata.go @@ -0,0 +1,43 @@ +package managedcluster + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SystemData struct { + CreatedAt *string `json:"createdAt,omitempty"` + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByType *string `json:"createdByType,omitempty"` + LastModifiedAt *string `json:"lastModifiedAt,omitempty"` + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + LastModifiedByType *string `json:"lastModifiedByType,omitempty"` +} + +func (o *SystemData) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SystemData) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *SystemData) GetLastModifiedAtAsTime() (*time.Time, error) { + if o.LastModifiedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModifiedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SystemData) SetLastModifiedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModifiedAt = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/predicates.go new file mode 100644 index 00000000000..88f9e87fe2d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/predicates.go @@ -0,0 +1,34 @@ +package managedcluster + +type ManagedClusterOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p ManagedClusterOperationPredicate) Matches(input ManagedCluster) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/version.go new file mode 100644 index 00000000000..795d386419d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/version.go @@ -0,0 +1,12 @@ +package managedcluster + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/managedcluster/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/README.md new file mode 100644 index 00000000000..cae29ca93c8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/README.md @@ -0,0 +1,154 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype` Documentation + +The `nodetype` SDK allows for interaction with the Azure Resource Manager Service `servicefabricmanagedcluster` (API Version `2021-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype" +``` + + +### Client Initialization + +```go +client := nodetype.NewNodeTypeClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NodeTypeClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "nodeTypeValue") + +payload := nodetype.NodeType{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `NodeTypeClient.Delete` + +```go +ctx := context.TODO() +id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "nodeTypeValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `NodeTypeClient.DeleteNode` + +```go +ctx := context.TODO() +id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "nodeTypeValue") + +payload := nodetype.NodeTypeActionParameters{ + // ... +} + + +if err := client.DeleteNodeThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `NodeTypeClient.Get` + +```go +ctx := context.TODO() +id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "nodeTypeValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NodeTypeClient.ListByManagedClusters` + +```go +ctx := context.TODO() +id := nodetype.NewManagedClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +// alternatively `client.ListByManagedClusters(ctx, id)` can be used to do batched pagination +items, err := client.ListByManagedClustersComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NodeTypeClient.Reimage` + +```go +ctx := context.TODO() +id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "nodeTypeValue") + +payload := nodetype.NodeTypeActionParameters{ + // ... +} + + +if err := client.ReimageThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `NodeTypeClient.Restart` + +```go +ctx := context.TODO() +id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "nodeTypeValue") + +payload := nodetype.NodeTypeActionParameters{ + // ... +} + + +if err := client.RestartThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `NodeTypeClient.Update` + +```go +ctx := context.TODO() +id := nodetype.NewNodeTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "nodeTypeValue") + +payload := nodetype.NodeTypeUpdateParameters{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/client.go new file mode 100644 index 00000000000..ed9d423c3ce --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/client.go @@ -0,0 +1,18 @@ +package nodetype + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NodeTypeClient struct { + Client autorest.Client + baseUri string +} + +func NewNodeTypeClientWithBaseURI(endpoint string) NodeTypeClient { + return NodeTypeClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/constants.go new file mode 100644 index 00000000000..4f842369e30 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/constants.go @@ -0,0 +1,89 @@ +package nodetype + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskType string + +const ( + DiskTypePremiumLRS DiskType = "Premium_LRS" + DiskTypeStandardLRS DiskType = "Standard_LRS" + DiskTypeStandardSSDLRS DiskType = "StandardSSD_LRS" +) + +func PossibleValuesForDiskType() []string { + return []string{ + string(DiskTypePremiumLRS), + string(DiskTypeStandardLRS), + string(DiskTypeStandardSSDLRS), + } +} + +func parseDiskType(input string) (*DiskType, error) { + vals := map[string]DiskType{ + "premium_lrs": DiskTypePremiumLRS, + "standard_lrs": DiskTypeStandardLRS, + "standardssd_lrs": DiskTypeStandardSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskType(input) + return &out, nil +} + +type ManagedResourceProvisioningState string + +const ( + ManagedResourceProvisioningStateCanceled ManagedResourceProvisioningState = "Canceled" + ManagedResourceProvisioningStateCreated ManagedResourceProvisioningState = "Created" + ManagedResourceProvisioningStateCreating ManagedResourceProvisioningState = "Creating" + ManagedResourceProvisioningStateDeleted ManagedResourceProvisioningState = "Deleted" + ManagedResourceProvisioningStateDeleting ManagedResourceProvisioningState = "Deleting" + ManagedResourceProvisioningStateFailed ManagedResourceProvisioningState = "Failed" + ManagedResourceProvisioningStateNone ManagedResourceProvisioningState = "None" + ManagedResourceProvisioningStateOther ManagedResourceProvisioningState = "Other" + ManagedResourceProvisioningStateSucceeded ManagedResourceProvisioningState = "Succeeded" + ManagedResourceProvisioningStateUpdating ManagedResourceProvisioningState = "Updating" +) + +func PossibleValuesForManagedResourceProvisioningState() []string { + return []string{ + string(ManagedResourceProvisioningStateCanceled), + string(ManagedResourceProvisioningStateCreated), + string(ManagedResourceProvisioningStateCreating), + string(ManagedResourceProvisioningStateDeleted), + string(ManagedResourceProvisioningStateDeleting), + string(ManagedResourceProvisioningStateFailed), + string(ManagedResourceProvisioningStateNone), + string(ManagedResourceProvisioningStateOther), + string(ManagedResourceProvisioningStateSucceeded), + string(ManagedResourceProvisioningStateUpdating), + } +} + +func parseManagedResourceProvisioningState(input string) (*ManagedResourceProvisioningState, error) { + vals := map[string]ManagedResourceProvisioningState{ + "canceled": ManagedResourceProvisioningStateCanceled, + "created": ManagedResourceProvisioningStateCreated, + "creating": ManagedResourceProvisioningStateCreating, + "deleted": ManagedResourceProvisioningStateDeleted, + "deleting": ManagedResourceProvisioningStateDeleting, + "failed": ManagedResourceProvisioningStateFailed, + "none": ManagedResourceProvisioningStateNone, + "other": ManagedResourceProvisioningStateOther, + "succeeded": ManagedResourceProvisioningStateSucceeded, + "updating": ManagedResourceProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ManagedResourceProvisioningState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_managedcluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_managedcluster.go new file mode 100644 index 00000000000..df7bd340bd3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_managedcluster.go @@ -0,0 +1,124 @@ +package nodetype + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ManagedClusterId{} + +// ManagedClusterId is a struct representing the Resource ID for a Managed Cluster +type ManagedClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewManagedClusterID returns a new ManagedClusterId struct +func NewManagedClusterID(subscriptionId string, resourceGroupName string, clusterName string) ManagedClusterId { + return ManagedClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseManagedClusterID parses 'input' into a ManagedClusterId +func ParseManagedClusterID(input string) (*ManagedClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagedClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagedClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseManagedClusterIDInsensitively parses 'input' case-insensitively into a ManagedClusterId +// note: this method should only be used for API response data and not user input +func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagedClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagedClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateManagedClusterID checks that 'input' can be parsed as a Managed Cluster ID +func ValidateManagedClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseManagedClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Managed Cluster ID +func (id ManagedClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceFabric/managedClusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Managed Cluster ID +func (id ManagedClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceFabric", "Microsoft.ServiceFabric", "Microsoft.ServiceFabric"), + resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Managed Cluster ID +func (id ManagedClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Managed Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/id_nodetype.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_nodetype.go similarity index 89% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/id_nodetype.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_nodetype.go index c55236297b2..f1ce2f8796c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/id_nodetype.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_nodetype.go @@ -112,15 +112,15 @@ func (id NodeTypeId) ID() string { // Segments returns a slice of Resource ID Segments which comprise this Node Type ID func (id NodeTypeId) Segments() []resourceids.Segment { return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftServiceFabric", "Microsoft.ServiceFabric", "Microsoft.ServiceFabric"), - resourceids.StaticSegment("managedClusters", "managedClusters", "managedClusters"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceFabric", "Microsoft.ServiceFabric", "Microsoft.ServiceFabric"), + resourceids.StaticSegment("staticManagedClusters", "managedClusters", "managedClusters"), resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), - resourceids.StaticSegment("nodeTypes", "nodeTypes", "nodeTypes"), + resourceids.StaticSegment("staticNodeTypes", "nodeTypes", "nodeTypes"), resourceids.UserSpecifiedSegment("nodeTypeName", "nodeTypeValue"), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate_autorest.go new file mode 100644 index 00000000000..00fe962834a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package nodetype + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c NodeTypeClient) CreateOrUpdate(ctx context.Context, id NodeTypeId, input NodeType) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c NodeTypeClient) CreateOrUpdateThenPoll(ctx context.Context, id NodeTypeId, input NodeType) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c NodeTypeClient) preparerForCreateOrUpdate(ctx context.Context, id NodeTypeId, input NodeType) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c NodeTypeClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete_autorest.go new file mode 100644 index 00000000000..557f0a902b0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_delete_autorest.go @@ -0,0 +1,78 @@ +package nodetype + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c NodeTypeClient) Delete(ctx context.Context, id NodeTypeId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c NodeTypeClient) DeleteThenPoll(ctx context.Context, id NodeTypeId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c NodeTypeClient) preparerForDelete(ctx context.Context, id NodeTypeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c NodeTypeClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_deletenode_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode_autorest.go similarity index 83% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_deletenode_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode_autorest.go index a9102f94edd..b49d2f9e6d7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_deletenode_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_deletenode_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type DeleteNodeResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteNodeOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // DeleteNode ... -func (c NodeTypeClient) DeleteNode(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (result DeleteNodeResponse, err error) { +func (c NodeTypeClient) DeleteNode(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (result DeleteNodeOperationResponse, err error) { req, err := c.preparerForDeleteNode(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "DeleteNode", nil, "Failure preparing request") @@ -64,12 +67,13 @@ func (c NodeTypeClient) preparerForDeleteNode(ctx context.Context, id NodeTypeId // senderForDeleteNode sends the DeleteNode request. The method will close the // http.Response Body if it receives an error. -func (c NodeTypeClient) senderForDeleteNode(ctx context.Context, req *http.Request) (future DeleteNodeResponse, err error) { +func (c NodeTypeClient) senderForDeleteNode(ctx context.Context, req *http.Request) (future DeleteNodeOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_get_autorest.go new file mode 100644 index 00000000000..f862c9383f8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_get_autorest.go @@ -0,0 +1,68 @@ +package nodetype + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *NodeType +} + +// Get ... +func (c NodeTypeClient) Get(ctx context.Context, id NodeTypeId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c NodeTypeClient) preparerForGet(ctx context.Context, id NodeTypeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c NodeTypeClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_listbymanagedclusters_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_listbymanagedclusters_autorest.go similarity index 87% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_listbymanagedclusters_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_listbymanagedclusters_autorest.go index 05a168f928b..6c118c65367 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_listbymanagedclusters_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_listbymanagedclusters_autorest.go @@ -10,23 +10,26 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type ListByManagedClustersResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByManagedClustersOperationResponse struct { HttpResponse *http.Response Model *[]NodeType nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByManagedClustersResponse, error) + nextPageFunc func(ctx context.Context, nextLink string) (ListByManagedClustersOperationResponse, error) } type ListByManagedClustersCompleteResult struct { Items []NodeType } -func (r ListByManagedClustersResponse) HasMore() bool { +func (r ListByManagedClustersOperationResponse) HasMore() bool { return r.nextLink != nil } -func (r ListByManagedClustersResponse) LoadMore(ctx context.Context) (resp ListByManagedClustersResponse, err error) { +func (r ListByManagedClustersOperationResponse) LoadMore(ctx context.Context) (resp ListByManagedClustersOperationResponse, err error) { if !r.HasMore() { err = fmt.Errorf("no more pages returned") return @@ -35,7 +38,7 @@ func (r ListByManagedClustersResponse) LoadMore(ctx context.Context) (resp ListB } // ListByManagedClusters ... -func (c NodeTypeClient) ListByManagedClusters(ctx context.Context, id ManagedClusterId) (resp ListByManagedClustersResponse, err error) { +func (c NodeTypeClient) ListByManagedClusters(ctx context.Context, id ManagedClusterId) (resp ListByManagedClustersOperationResponse, err error) { req, err := c.preparerForListByManagedClusters(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "ListByManagedClusters", nil, "Failure preparing request") @@ -56,50 +59,6 @@ func (c NodeTypeClient) ListByManagedClusters(ctx context.Context, id ManagedClu return } -// ListByManagedClustersComplete retrieves all of the results into a single object -func (c NodeTypeClient) ListByManagedClustersComplete(ctx context.Context, id ManagedClusterId) (ListByManagedClustersCompleteResult, error) { - return c.ListByManagedClustersCompleteMatchingPredicate(ctx, id, NodeTypePredicate{}) -} - -// ListByManagedClustersCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c NodeTypeClient) ListByManagedClustersCompleteMatchingPredicate(ctx context.Context, id ManagedClusterId, predicate NodeTypePredicate) (resp ListByManagedClustersCompleteResult, err error) { - items := make([]NodeType, 0) - - page, err := c.ListByManagedClusters(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByManagedClustersCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForListByManagedClusters prepares the ListByManagedClusters request. func (c NodeTypeClient) preparerForListByManagedClusters(ctx context.Context, id ManagedClusterId) (*http.Request, error) { queryParameters := map[string]interface{}{ @@ -142,7 +101,7 @@ func (c NodeTypeClient) preparerForListByManagedClustersWithNextLink(ctx context // responderForListByManagedClusters handles the response to the ListByManagedClusters request. The method always // closes the http.Response Body. -func (c NodeTypeClient) responderForListByManagedClusters(resp *http.Response) (result ListByManagedClustersResponse, err error) { +func (c NodeTypeClient) responderForListByManagedClusters(resp *http.Response) (result ListByManagedClustersOperationResponse, err error) { type page struct { Values []NodeType `json:"value"` NextLink *string `json:"nextLink"` @@ -157,7 +116,7 @@ func (c NodeTypeClient) responderForListByManagedClusters(resp *http.Response) ( result.Model = &respObj.Values result.nextLink = respObj.NextLink if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByManagedClustersResponse, err error) { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByManagedClustersOperationResponse, err error) { req, err := c.preparerForListByManagedClustersWithNextLink(ctx, nextLink) if err != nil { err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "ListByManagedClusters", nil, "Failure preparing request") @@ -181,3 +140,47 @@ func (c NodeTypeClient) responderForListByManagedClusters(resp *http.Response) ( } return } + +// ListByManagedClustersComplete retrieves all of the results into a single object +func (c NodeTypeClient) ListByManagedClustersComplete(ctx context.Context, id ManagedClusterId) (ListByManagedClustersCompleteResult, error) { + return c.ListByManagedClustersCompleteMatchingPredicate(ctx, id, NodeTypeOperationPredicate{}) +} + +// ListByManagedClustersCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NodeTypeClient) ListByManagedClustersCompleteMatchingPredicate(ctx context.Context, id ManagedClusterId, predicate NodeTypeOperationPredicate) (resp ListByManagedClustersCompleteResult, err error) { + items := make([]NodeType, 0) + + page, err := c.ListByManagedClusters(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByManagedClustersCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_reimage_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage_autorest.go similarity index 83% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_reimage_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage_autorest.go index dd7f99d0bac..63939de7f6b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_reimage_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_reimage_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type ReimageResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReimageOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // Reimage ... -func (c NodeTypeClient) Reimage(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (result ReimageResponse, err error) { +func (c NodeTypeClient) Reimage(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (result ReimageOperationResponse, err error) { req, err := c.preparerForReimage(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Reimage", nil, "Failure preparing request") @@ -64,12 +67,13 @@ func (c NodeTypeClient) preparerForReimage(ctx context.Context, id NodeTypeId, i // senderForReimage sends the Reimage request. The method will close the // http.Response Body if it receives an error. -func (c NodeTypeClient) senderForReimage(ctx context.Context, req *http.Request) (future ReimageResponse, err error) { +func (c NodeTypeClient) senderForReimage(ctx context.Context, req *http.Request) (future ReimageOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart_autorest.go new file mode 100644 index 00000000000..1eb428135ea --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_restart_autorest.go @@ -0,0 +1,79 @@ +package nodetype + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestartOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Restart ... +func (c NodeTypeClient) Restart(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (result RestartOperationResponse, err error) { + req, err := c.preparerForRestart(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Restart", nil, "Failure preparing request") + return + } + + result, err = c.senderForRestart(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Restart", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// RestartThenPoll performs Restart then polls until it's completed +func (c NodeTypeClient) RestartThenPoll(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) error { + result, err := c.Restart(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Restart: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Restart: %+v", err) + } + + return nil +} + +// preparerForRestart prepares the Restart request. +func (c NodeTypeClient) preparerForRestart(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/restart", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForRestart sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (c NodeTypeClient) senderForRestart(ctx context.Context, req *http.Request) (future RestartOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_update_autorest.go new file mode 100644 index 00000000000..a0f77c73908 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/method_update_autorest.go @@ -0,0 +1,69 @@ +package nodetype + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *NodeType +} + +// Update ... +func (c NodeTypeClient) Update(ctx context.Context, id NodeTypeId, input NodeTypeUpdateParameters) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c NodeTypeClient) preparerForUpdate(ctx context.Context, id NodeTypeId, input NodeTypeUpdateParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c NodeTypeClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_endpointrangedescription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_endpointrangedescription.go new file mode 100644 index 00000000000..e7a7d9370b4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_endpointrangedescription.go @@ -0,0 +1,9 @@ +package nodetype + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointRangeDescription struct { + EndPort int64 `json:"endPort"` + StartPort int64 `json:"startPort"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_nodetype.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_nodetype.go new file mode 100644 index 00000000000..7e85decacf8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_nodetype.go @@ -0,0 +1,13 @@ +package nodetype + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NodeType struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *NodeTypeProperties `json:"properties,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_nodetypeactionparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_nodetypeactionparameters.go new file mode 100644 index 00000000000..0c13f5a41e8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_nodetypeactionparameters.go @@ -0,0 +1,9 @@ +package nodetype + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NodeTypeActionParameters struct { + Force *bool `json:"force,omitempty"` + Nodes []string `json:"nodes"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_nodetypeproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_nodetypeproperties.go new file mode 100644 index 00000000000..c1cfb9579e2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_nodetypeproperties.go @@ -0,0 +1,30 @@ +package nodetype + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NodeTypeProperties struct { + ApplicationPorts *EndpointRangeDescription `json:"applicationPorts,omitempty"` + Capacities *map[string]string `json:"capacities,omitempty"` + DataDiskSizeGB int64 `json:"dataDiskSizeGB"` + DataDiskType *DiskType `json:"dataDiskType,omitempty"` + EphemeralPorts *EndpointRangeDescription `json:"ephemeralPorts,omitempty"` + IsPrimary bool `json:"isPrimary"` + IsStateless *bool `json:"isStateless,omitempty"` + MultiplePlacementGroups *bool `json:"multiplePlacementGroups,omitempty"` + PlacementProperties *map[string]string `json:"placementProperties,omitempty"` + ProvisioningState *ManagedResourceProvisioningState `json:"provisioningState,omitempty"` + VmExtensions *[]VMSSExtension `json:"vmExtensions,omitempty"` + VmImageOffer *string `json:"vmImageOffer,omitempty"` + VmImagePublisher *string `json:"vmImagePublisher,omitempty"` + VmImageSku *string `json:"vmImageSku,omitempty"` + VmImageVersion *string `json:"vmImageVersion,omitempty"` + VmInstanceCount int64 `json:"vmInstanceCount"` + VmManagedIdentity *identity.UserAssignedList `json:"vmManagedIdentity,omitempty"` + VmSecrets *[]VaultSecretGroup `json:"vmSecrets,omitempty"` + VmSize *string `json:"vmSize,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_nodetypeupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_nodetypeupdateparameters.go new file mode 100644 index 00000000000..4c793985b7b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_nodetypeupdateparameters.go @@ -0,0 +1,8 @@ +package nodetype + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NodeTypeUpdateParameters struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_subresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_subresource.go new file mode 100644 index 00000000000..0db3d206902 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_subresource.go @@ -0,0 +1,8 @@ +package nodetype + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_systemdata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_systemdata.go new file mode 100644 index 00000000000..a09c384add5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_systemdata.go @@ -0,0 +1,43 @@ +package nodetype + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SystemData struct { + CreatedAt *string `json:"createdAt,omitempty"` + CreatedBy *string `json:"createdBy,omitempty"` + CreatedByType *string `json:"createdByType,omitempty"` + LastModifiedAt *string `json:"lastModifiedAt,omitempty"` + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + LastModifiedByType *string `json:"lastModifiedByType,omitempty"` +} + +func (o *SystemData) GetCreatedAtAsTime() (*time.Time, error) { + if o.CreatedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SystemData) SetCreatedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedAt = &formatted +} + +func (o *SystemData) GetLastModifiedAtAsTime() (*time.Time, error) { + if o.LastModifiedAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModifiedAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *SystemData) SetLastModifiedAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModifiedAt = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_vaultcertificate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_vaultcertificate.go new file mode 100644 index 00000000000..eff0354e640 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_vaultcertificate.go @@ -0,0 +1,9 @@ +package nodetype + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultCertificate struct { + CertificateStore string `json:"certificateStore"` + CertificateUrl string `json:"certificateUrl"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_vaultsecretgroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_vaultsecretgroup.go new file mode 100644 index 00000000000..fc99643c0c1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_vaultsecretgroup.go @@ -0,0 +1,9 @@ +package nodetype + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultSecretGroup struct { + SourceVault SubResource `json:"sourceVault"` + VaultCertificates []VaultCertificate `json:"vaultCertificates"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_vmssextension.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_vmssextension.go new file mode 100644 index 00000000000..f63f087f1a0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_vmssextension.go @@ -0,0 +1,9 @@ +package nodetype + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSSExtension struct { + Name string `json:"name"` + Properties VMSSExtensionProperties `json:"properties"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_vmssextensionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_vmssextensionproperties.go similarity index 81% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_vmssextensionproperties.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_vmssextensionproperties.go index f7a7bb1a9e1..84851563ec0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_vmssextensionproperties.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/model_vmssextensionproperties.go @@ -1,5 +1,8 @@ package nodetype +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type VMSSExtensionProperties struct { AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/predicates.go new file mode 100644 index 00000000000..4b7f5e27329 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/predicates.go @@ -0,0 +1,24 @@ +package nodetype + +type NodeTypeOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p NodeTypeOperationPredicate) Matches(input NodeType) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/version.go new file mode 100644 index 00000000000..fe315c18281 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/version.go @@ -0,0 +1,12 @@ +package nodetype + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/nodetype/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/README.md new file mode 100644 index 00000000000..a44f8950928 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/README.md @@ -0,0 +1,488 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr` Documentation + +The `signalr` SDK allows for interaction with the Azure Resource Manager Service `signalr` (API Version `2022-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr" +``` + + +### Client Initialization + +```go +client := signalr.NewSignalRClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SignalRClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := signalr.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +payload := signalr.NameAvailabilityParameters{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignalRClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +payload := signalr.SignalRResource{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SignalRClient.CustomCertificatesCreateOrUpdate` + +```go +ctx := context.TODO() +id := signalr.NewCustomCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "certificateValue") + +payload := signalr.CustomCertificate{ + // ... +} + + +if err := client.CustomCertificatesCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SignalRClient.CustomCertificatesDelete` + +```go +ctx := context.TODO() +id := signalr.NewCustomCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "certificateValue") + +read, err := client.CustomCertificatesDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignalRClient.CustomCertificatesGet` + +```go +ctx := context.TODO() +id := signalr.NewCustomCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "certificateValue") + +read, err := client.CustomCertificatesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignalRClient.CustomCertificatesList` + +```go +ctx := context.TODO() +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +// alternatively `client.CustomCertificatesList(ctx, id)` can be used to do batched pagination +items, err := client.CustomCertificatesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SignalRClient.CustomDomainsCreateOrUpdate` + +```go +ctx := context.TODO() +id := signalr.NewCustomDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "nameValue") + +payload := signalr.CustomDomain{ + // ... +} + + +if err := client.CustomDomainsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SignalRClient.CustomDomainsDelete` + +```go +ctx := context.TODO() +id := signalr.NewCustomDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "nameValue") + +if err := client.CustomDomainsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SignalRClient.CustomDomainsGet` + +```go +ctx := context.TODO() +id := signalr.NewCustomDomainID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "nameValue") + +read, err := client.CustomDomainsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignalRClient.CustomDomainsList` + +```go +ctx := context.TODO() +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +// alternatively `client.CustomDomainsList(ctx, id)` can be used to do batched pagination +items, err := client.CustomDomainsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SignalRClient.Delete` + +```go +ctx := context.TODO() +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SignalRClient.Get` + +```go +ctx := context.TODO() +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignalRClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := signalr.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SignalRClient.ListBySubscription` + +```go +ctx := context.TODO() +id := signalr.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SignalRClient.ListKeys` + +```go +ctx := context.TODO() +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +read, err := client.ListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignalRClient.ListSkus` + +```go +ctx := context.TODO() +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +read, err := client.ListSkus(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignalRClient.PrivateEndpointConnectionsDelete` + +```go +ctx := context.TODO() +id := signalr.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue") + +if err := client.PrivateEndpointConnectionsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SignalRClient.PrivateEndpointConnectionsGet` + +```go +ctx := context.TODO() +id := signalr.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue") + +read, err := client.PrivateEndpointConnectionsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignalRClient.PrivateEndpointConnectionsList` + +```go +ctx := context.TODO() +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +// alternatively `client.PrivateEndpointConnectionsList(ctx, id)` can be used to do batched pagination +items, err := client.PrivateEndpointConnectionsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SignalRClient.PrivateEndpointConnectionsUpdate` + +```go +ctx := context.TODO() +id := signalr.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue") + +payload := signalr.PrivateEndpointConnection{ + // ... +} + + +read, err := client.PrivateEndpointConnectionsUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignalRClient.PrivateLinkResourcesList` + +```go +ctx := context.TODO() +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +// alternatively `client.PrivateLinkResourcesList(ctx, id)` can be used to do batched pagination +items, err := client.PrivateLinkResourcesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SignalRClient.RegenerateKey` + +```go +ctx := context.TODO() +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +payload := signalr.RegenerateKeyParameters{ + // ... +} + + +if err := client.RegenerateKeyThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SignalRClient.Restart` + +```go +ctx := context.TODO() +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +if err := client.RestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SignalRClient.SharedPrivateLinkResourcesCreateOrUpdate` + +```go +ctx := context.TODO() +id := signalr.NewSharedPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "sharedPrivateLinkResourceValue") + +payload := signalr.SharedPrivateLinkResource{ + // ... +} + + +if err := client.SharedPrivateLinkResourcesCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SignalRClient.SharedPrivateLinkResourcesDelete` + +```go +ctx := context.TODO() +id := signalr.NewSharedPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "sharedPrivateLinkResourceValue") + +if err := client.SharedPrivateLinkResourcesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SignalRClient.SharedPrivateLinkResourcesGet` + +```go +ctx := context.TODO() +id := signalr.NewSharedPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "sharedPrivateLinkResourceValue") + +read, err := client.SharedPrivateLinkResourcesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SignalRClient.SharedPrivateLinkResourcesList` + +```go +ctx := context.TODO() +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +// alternatively `client.SharedPrivateLinkResourcesList(ctx, id)` can be used to do batched pagination +items, err := client.SharedPrivateLinkResourcesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SignalRClient.Update` + +```go +ctx := context.TODO() +id := signalr.NewSignalRID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue") + +payload := signalr.SignalRResource{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SignalRClient.UsagesList` + +```go +ctx := context.TODO() +id := signalr.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +// alternatively `client.UsagesList(ctx, id)` can be used to do batched pagination +items, err := client.UsagesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/client.go new file mode 100644 index 00000000000..a0a2bfe8d75 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/client.go @@ -0,0 +1,18 @@ +package signalr + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SignalRClient struct { + Client autorest.Client + baseUri string +} + +func NewSignalRClientWithBaseURI(endpoint string) SignalRClient { + return SignalRClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/constants.go new file mode 100644 index 00000000000..1319917bb21 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/constants.go @@ -0,0 +1,374 @@ +package signalr + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ACLAction string + +const ( + ACLActionAllow ACLAction = "Allow" + ACLActionDeny ACLAction = "Deny" +) + +func PossibleValuesForACLAction() []string { + return []string{ + string(ACLActionAllow), + string(ACLActionDeny), + } +} + +func parseACLAction(input string) (*ACLAction, error) { + vals := map[string]ACLAction{ + "allow": ACLActionAllow, + "deny": ACLActionDeny, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ACLAction(input) + return &out, nil +} + +type FeatureFlags string + +const ( + FeatureFlagsEnableConnectivityLogs FeatureFlags = "EnableConnectivityLogs" + FeatureFlagsEnableLiveTrace FeatureFlags = "EnableLiveTrace" + FeatureFlagsEnableMessagingLogs FeatureFlags = "EnableMessagingLogs" + FeatureFlagsServiceMode FeatureFlags = "ServiceMode" +) + +func PossibleValuesForFeatureFlags() []string { + return []string{ + string(FeatureFlagsEnableConnectivityLogs), + string(FeatureFlagsEnableLiveTrace), + string(FeatureFlagsEnableMessagingLogs), + string(FeatureFlagsServiceMode), + } +} + +func parseFeatureFlags(input string) (*FeatureFlags, error) { + vals := map[string]FeatureFlags{ + "enableconnectivitylogs": FeatureFlagsEnableConnectivityLogs, + "enablelivetrace": FeatureFlagsEnableLiveTrace, + "enablemessaginglogs": FeatureFlagsEnableMessagingLogs, + "servicemode": FeatureFlagsServiceMode, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FeatureFlags(input) + return &out, nil +} + +type KeyType string + +const ( + KeyTypePrimary KeyType = "Primary" + KeyTypeSalt KeyType = "Salt" + KeyTypeSecondary KeyType = "Secondary" +) + +func PossibleValuesForKeyType() []string { + return []string{ + string(KeyTypePrimary), + string(KeyTypeSalt), + string(KeyTypeSecondary), + } +} + +func parseKeyType(input string) (*KeyType, error) { + vals := map[string]KeyType{ + "primary": KeyTypePrimary, + "salt": KeyTypeSalt, + "secondary": KeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := KeyType(input) + return &out, nil +} + +type PrivateLinkServiceConnectionStatus string + +const ( + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateLinkServiceConnectionStatus() []string { + return []string{ + string(PrivateLinkServiceConnectionStatusApproved), + string(PrivateLinkServiceConnectionStatusDisconnected), + string(PrivateLinkServiceConnectionStatusPending), + string(PrivateLinkServiceConnectionStatusRejected), + } +} + +func parsePrivateLinkServiceConnectionStatus(input string) (*PrivateLinkServiceConnectionStatus, error) { + vals := map[string]PrivateLinkServiceConnectionStatus{ + "approved": PrivateLinkServiceConnectionStatusApproved, + "disconnected": PrivateLinkServiceConnectionStatusDisconnected, + "pending": PrivateLinkServiceConnectionStatusPending, + "rejected": PrivateLinkServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateLinkServiceConnectionStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUnknown ProvisioningState = "Unknown" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUnknown), + string(ProvisioningStateUpdating), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + "unknown": ProvisioningStateUnknown, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type ScaleType string + +const ( + ScaleTypeAutomatic ScaleType = "Automatic" + ScaleTypeManual ScaleType = "Manual" + ScaleTypeNone ScaleType = "None" +) + +func PossibleValuesForScaleType() []string { + return []string{ + string(ScaleTypeAutomatic), + string(ScaleTypeManual), + string(ScaleTypeNone), + } +} + +func parseScaleType(input string) (*ScaleType, error) { + vals := map[string]ScaleType{ + "automatic": ScaleTypeAutomatic, + "manual": ScaleTypeManual, + "none": ScaleTypeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ScaleType(input) + return &out, nil +} + +type ServiceKind string + +const ( + ServiceKindRawWebSockets ServiceKind = "RawWebSockets" + ServiceKindSignalR ServiceKind = "SignalR" +) + +func PossibleValuesForServiceKind() []string { + return []string{ + string(ServiceKindRawWebSockets), + string(ServiceKindSignalR), + } +} + +func parseServiceKind(input string) (*ServiceKind, error) { + vals := map[string]ServiceKind{ + "rawwebsockets": ServiceKindRawWebSockets, + "signalr": ServiceKindSignalR, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServiceKind(input) + return &out, nil +} + +type SharedPrivateLinkResourceStatus string + +const ( + SharedPrivateLinkResourceStatusApproved SharedPrivateLinkResourceStatus = "Approved" + SharedPrivateLinkResourceStatusDisconnected SharedPrivateLinkResourceStatus = "Disconnected" + SharedPrivateLinkResourceStatusPending SharedPrivateLinkResourceStatus = "Pending" + SharedPrivateLinkResourceStatusRejected SharedPrivateLinkResourceStatus = "Rejected" + SharedPrivateLinkResourceStatusTimeout SharedPrivateLinkResourceStatus = "Timeout" +) + +func PossibleValuesForSharedPrivateLinkResourceStatus() []string { + return []string{ + string(SharedPrivateLinkResourceStatusApproved), + string(SharedPrivateLinkResourceStatusDisconnected), + string(SharedPrivateLinkResourceStatusPending), + string(SharedPrivateLinkResourceStatusRejected), + string(SharedPrivateLinkResourceStatusTimeout), + } +} + +func parseSharedPrivateLinkResourceStatus(input string) (*SharedPrivateLinkResourceStatus, error) { + vals := map[string]SharedPrivateLinkResourceStatus{ + "approved": SharedPrivateLinkResourceStatusApproved, + "disconnected": SharedPrivateLinkResourceStatusDisconnected, + "pending": SharedPrivateLinkResourceStatusPending, + "rejected": SharedPrivateLinkResourceStatusRejected, + "timeout": SharedPrivateLinkResourceStatusTimeout, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SharedPrivateLinkResourceStatus(input) + return &out, nil +} + +type SignalRRequestType string + +const ( + SignalRRequestTypeClientConnection SignalRRequestType = "ClientConnection" + SignalRRequestTypeRESTAPI SignalRRequestType = "RESTAPI" + SignalRRequestTypeServerConnection SignalRRequestType = "ServerConnection" + SignalRRequestTypeTrace SignalRRequestType = "Trace" +) + +func PossibleValuesForSignalRRequestType() []string { + return []string{ + string(SignalRRequestTypeClientConnection), + string(SignalRRequestTypeRESTAPI), + string(SignalRRequestTypeServerConnection), + string(SignalRRequestTypeTrace), + } +} + +func parseSignalRRequestType(input string) (*SignalRRequestType, error) { + vals := map[string]SignalRRequestType{ + "clientconnection": SignalRRequestTypeClientConnection, + "restapi": SignalRRequestTypeRESTAPI, + "serverconnection": SignalRRequestTypeServerConnection, + "trace": SignalRRequestTypeTrace, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SignalRRequestType(input) + return &out, nil +} + +type SignalRSkuTier string + +const ( + SignalRSkuTierBasic SignalRSkuTier = "Basic" + SignalRSkuTierFree SignalRSkuTier = "Free" + SignalRSkuTierPremium SignalRSkuTier = "Premium" + SignalRSkuTierStandard SignalRSkuTier = "Standard" +) + +func PossibleValuesForSignalRSkuTier() []string { + return []string{ + string(SignalRSkuTierBasic), + string(SignalRSkuTierFree), + string(SignalRSkuTierPremium), + string(SignalRSkuTierStandard), + } +} + +func parseSignalRSkuTier(input string) (*SignalRSkuTier, error) { + vals := map[string]SignalRSkuTier{ + "basic": SignalRSkuTierBasic, + "free": SignalRSkuTierFree, + "premium": SignalRSkuTierPremium, + "standard": SignalRSkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SignalRSkuTier(input) + return &out, nil +} + +type UpstreamAuthType string + +const ( + UpstreamAuthTypeManagedIdentity UpstreamAuthType = "ManagedIdentity" + UpstreamAuthTypeNone UpstreamAuthType = "None" +) + +func PossibleValuesForUpstreamAuthType() []string { + return []string{ + string(UpstreamAuthTypeManagedIdentity), + string(UpstreamAuthTypeNone), + } +} + +func parseUpstreamAuthType(input string) (*UpstreamAuthType, error) { + vals := map[string]UpstreamAuthType{ + "managedidentity": UpstreamAuthTypeManagedIdentity, + "none": UpstreamAuthTypeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpstreamAuthType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_customcertificate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_customcertificate.go new file mode 100644 index 00000000000..1d3417f5965 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_customcertificate.go @@ -0,0 +1,137 @@ +package signalr + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = CustomCertificateId{} + +// CustomCertificateId is a struct representing the Resource ID for a Custom Certificate +type CustomCertificateId struct { + SubscriptionId string + ResourceGroupName string + ResourceName string + CertificateName string +} + +// NewCustomCertificateID returns a new CustomCertificateId struct +func NewCustomCertificateID(subscriptionId string, resourceGroupName string, resourceName string, certificateName string) CustomCertificateId { + return CustomCertificateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceName: resourceName, + CertificateName: certificateName, + } +} + +// ParseCustomCertificateID parses 'input' into a CustomCertificateId +func ParseCustomCertificateID(input string) (*CustomCertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(CustomCertificateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CustomCertificateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { + return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseCustomCertificateIDInsensitively parses 'input' case-insensitively into a CustomCertificateId +// note: this method should only be used for API response data and not user input +func ParseCustomCertificateIDInsensitively(input string) (*CustomCertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(CustomCertificateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CustomCertificateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { + return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateCustomCertificateID checks that 'input' can be parsed as a Custom Certificate ID +func ValidateCustomCertificateID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCustomCertificateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Custom Certificate ID +func (id CustomCertificateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/signalR/%s/customCertificates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.CertificateName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Custom Certificate ID +func (id CustomCertificateId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), + resourceids.StaticSegment("staticSignalR", "signalR", "signalR"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.StaticSegment("staticCustomCertificates", "customCertificates", "customCertificates"), + resourceids.UserSpecifiedSegment("certificateName", "certificateValue"), + } +} + +// String returns a human-readable description of this Custom Certificate ID +func (id CustomCertificateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Certificate Name: %q", id.CertificateName), + } + return fmt.Sprintf("Custom Certificate (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_customdomain.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_customdomain.go new file mode 100644 index 00000000000..f0b35317144 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_customdomain.go @@ -0,0 +1,137 @@ +package signalr + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = CustomDomainId{} + +// CustomDomainId is a struct representing the Resource ID for a Custom Domain +type CustomDomainId struct { + SubscriptionId string + ResourceGroupName string + ResourceName string + Name string +} + +// NewCustomDomainID returns a new CustomDomainId struct +func NewCustomDomainID(subscriptionId string, resourceGroupName string, resourceName string, name string) CustomDomainId { + return CustomDomainId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceName: resourceName, + Name: name, + } +} + +// ParseCustomDomainID parses 'input' into a CustomDomainId +func ParseCustomDomainID(input string) (*CustomDomainId, error) { + parser := resourceids.NewParserFromResourceIdType(CustomDomainId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CustomDomainId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + if id.Name, ok = parsed.Parsed["name"]; !ok { + return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseCustomDomainIDInsensitively parses 'input' case-insensitively into a CustomDomainId +// note: this method should only be used for API response data and not user input +func ParseCustomDomainIDInsensitively(input string) (*CustomDomainId, error) { + parser := resourceids.NewParserFromResourceIdType(CustomDomainId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CustomDomainId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + if id.Name, ok = parsed.Parsed["name"]; !ok { + return nil, fmt.Errorf("the segment 'name' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateCustomDomainID checks that 'input' can be parsed as a Custom Domain ID +func ValidateCustomDomainID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCustomDomainID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Custom Domain ID +func (id CustomDomainId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/signalR/%s/customDomains/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.Name) +} + +// Segments returns a slice of Resource ID Segments which comprise this Custom Domain ID +func (id CustomDomainId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), + resourceids.StaticSegment("staticSignalR", "signalR", "signalR"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.StaticSegment("staticCustomDomains", "customDomains", "customDomains"), + resourceids.UserSpecifiedSegment("name", "nameValue"), + } +} + +// String returns a human-readable description of this Custom Domain ID +func (id CustomDomainId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Name: %q", id.Name), + } + return fmt.Sprintf("Custom Domain (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_location.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_location.go new file mode 100644 index 00000000000..d20f653e488 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_location.go @@ -0,0 +1,111 @@ +package signalr + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + Location string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, location string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + Location: location, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.Location, ok = parsed.Parsed["location"]; !ok { + return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.SignalRService/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("location", "locationValue"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location: %q", id.Location), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/id_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_privateendpointconnection.go similarity index 90% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/id_privateendpointconnection.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_privateendpointconnection.go index 1deb956dce5..c1d221118f1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/id_privateendpointconnection.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_privateendpointconnection.go @@ -112,15 +112,15 @@ func (id PrivateEndpointConnectionId) ID() string { // Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID func (id PrivateEndpointConnectionId) Segments() []resourceids.Segment { return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), - resourceids.StaticSegment("signalR", "signalR", "signalR"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), + resourceids.StaticSegment("staticSignalR", "signalR", "signalR"), resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), - resourceids.StaticSegment("privateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), + resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionValue"), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_sharedprivatelinkresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_sharedprivatelinkresource.go new file mode 100644 index 00000000000..71f3719e21b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_sharedprivatelinkresource.go @@ -0,0 +1,137 @@ +package signalr + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SharedPrivateLinkResourceId{} + +// SharedPrivateLinkResourceId is a struct representing the Resource ID for a Shared Private Link Resource +type SharedPrivateLinkResourceId struct { + SubscriptionId string + ResourceGroupName string + ResourceName string + SharedPrivateLinkResourceName string +} + +// NewSharedPrivateLinkResourceID returns a new SharedPrivateLinkResourceId struct +func NewSharedPrivateLinkResourceID(subscriptionId string, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string) SharedPrivateLinkResourceId { + return SharedPrivateLinkResourceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ResourceName: resourceName, + SharedPrivateLinkResourceName: sharedPrivateLinkResourceName, + } +} + +// ParseSharedPrivateLinkResourceID parses 'input' into a SharedPrivateLinkResourceId +func ParseSharedPrivateLinkResourceID(input string) (*SharedPrivateLinkResourceId, error) { + parser := resourceids.NewParserFromResourceIdType(SharedPrivateLinkResourceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SharedPrivateLinkResourceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + if id.SharedPrivateLinkResourceName, ok = parsed.Parsed["sharedPrivateLinkResourceName"]; !ok { + return nil, fmt.Errorf("the segment 'sharedPrivateLinkResourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSharedPrivateLinkResourceIDInsensitively parses 'input' case-insensitively into a SharedPrivateLinkResourceId +// note: this method should only be used for API response data and not user input +func ParseSharedPrivateLinkResourceIDInsensitively(input string) (*SharedPrivateLinkResourceId, error) { + parser := resourceids.NewParserFromResourceIdType(SharedPrivateLinkResourceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SharedPrivateLinkResourceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) + } + + if id.SharedPrivateLinkResourceName, ok = parsed.Parsed["sharedPrivateLinkResourceName"]; !ok { + return nil, fmt.Errorf("the segment 'sharedPrivateLinkResourceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSharedPrivateLinkResourceID checks that 'input' can be parsed as a Shared Private Link Resource ID +func ValidateSharedPrivateLinkResourceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSharedPrivateLinkResourceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Shared Private Link Resource ID +func (id SharedPrivateLinkResourceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/signalR/%s/sharedPrivateLinkResources/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName, id.SharedPrivateLinkResourceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Shared Private Link Resource ID +func (id SharedPrivateLinkResourceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), + resourceids.StaticSegment("staticSignalR", "signalR", "signalR"), + resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), + resourceids.StaticSegment("staticSharedPrivateLinkResources", "sharedPrivateLinkResources", "sharedPrivateLinkResources"), + resourceids.UserSpecifiedSegment("sharedPrivateLinkResourceName", "sharedPrivateLinkResourceValue"), + } +} + +// String returns a human-readable description of this Shared Private Link Resource ID +func (id SharedPrivateLinkResourceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Resource Name: %q", id.ResourceName), + fmt.Sprintf("Shared Private Link Resource Name: %q", id.SharedPrivateLinkResourceName), + } + return fmt.Sprintf("Shared Private Link Resource (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/id_signalr.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_signalr.go similarity index 89% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/id_signalr.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_signalr.go index 007ec6a5a3b..93eac723401 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/id_signalr.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/id_signalr.go @@ -102,13 +102,13 @@ func (id SignalRId) ID() string { // Segments returns a slice of Resource ID Segments which comprise this Signal R ID func (id SignalRId) Segments() []resourceids.Segment { return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), - resourceids.StaticSegment("signalR", "signalR", "signalR"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), + resourceids.StaticSegment("staticSignalR", "signalR", "signalR"), resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_checknameavailability_autorest.go new file mode 100644 index 00000000000..292929ad85d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_checknameavailability_autorest.go @@ -0,0 +1,70 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *NameAvailability +} + +// CheckNameAvailability ... +func (c SignalRClient) CheckNameAvailability(ctx context.Context, id LocationId, input NameAvailabilityParameters) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c SignalRClient) preparerForCheckNameAvailability(ctx context.Context, id LocationId, input NameAvailabilityParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c SignalRClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_createorupdate_autorest.go new file mode 100644 index 00000000000..df51e499d01 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c SignalRClient) CreateOrUpdate(ctx context.Context, id SignalRId, input SignalRResource) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c SignalRClient) CreateOrUpdateThenPoll(ctx context.Context, id SignalRId, input SignalRResource) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c SignalRClient) preparerForCreateOrUpdate(ctx context.Context, id SignalRId, input SignalRResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c SignalRClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customcertificatescreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customcertificatescreateorupdate_autorest.go new file mode 100644 index 00000000000..ac74e2c8e92 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customcertificatescreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomCertificatesCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CustomCertificatesCreateOrUpdate ... +func (c SignalRClient) CustomCertificatesCreateOrUpdate(ctx context.Context, id CustomCertificateId, input CustomCertificate) (result CustomCertificatesCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCustomCertificatesCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomCertificatesCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCustomCertificatesCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomCertificatesCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CustomCertificatesCreateOrUpdateThenPoll performs CustomCertificatesCreateOrUpdate then polls until it's completed +func (c SignalRClient) CustomCertificatesCreateOrUpdateThenPoll(ctx context.Context, id CustomCertificateId, input CustomCertificate) error { + result, err := c.CustomCertificatesCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CustomCertificatesCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CustomCertificatesCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCustomCertificatesCreateOrUpdate prepares the CustomCertificatesCreateOrUpdate request. +func (c SignalRClient) preparerForCustomCertificatesCreateOrUpdate(ctx context.Context, id CustomCertificateId, input CustomCertificate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCustomCertificatesCreateOrUpdate sends the CustomCertificatesCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c SignalRClient) senderForCustomCertificatesCreateOrUpdate(ctx context.Context, req *http.Request) (future CustomCertificatesCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customcertificatesdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customcertificatesdelete_autorest.go new file mode 100644 index 00000000000..c171ed1da9a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customcertificatesdelete_autorest.go @@ -0,0 +1,66 @@ +package signalr + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomCertificatesDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// CustomCertificatesDelete ... +func (c SignalRClient) CustomCertificatesDelete(ctx context.Context, id CustomCertificateId) (result CustomCertificatesDeleteOperationResponse, err error) { + req, err := c.preparerForCustomCertificatesDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomCertificatesDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomCertificatesDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCustomCertificatesDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomCertificatesDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCustomCertificatesDelete prepares the CustomCertificatesDelete request. +func (c SignalRClient) preparerForCustomCertificatesDelete(ctx context.Context, id CustomCertificateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCustomCertificatesDelete handles the response to the CustomCertificatesDelete request. The method always +// closes the http.Response Body. +func (c SignalRClient) responderForCustomCertificatesDelete(resp *http.Response) (result CustomCertificatesDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customcertificatesget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customcertificatesget_autorest.go new file mode 100644 index 00000000000..fcf68547a1b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customcertificatesget_autorest.go @@ -0,0 +1,68 @@ +package signalr + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomCertificatesGetOperationResponse struct { + HttpResponse *http.Response + Model *CustomCertificate +} + +// CustomCertificatesGet ... +func (c SignalRClient) CustomCertificatesGet(ctx context.Context, id CustomCertificateId) (result CustomCertificatesGetOperationResponse, err error) { + req, err := c.preparerForCustomCertificatesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomCertificatesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomCertificatesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCustomCertificatesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomCertificatesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCustomCertificatesGet prepares the CustomCertificatesGet request. +func (c SignalRClient) preparerForCustomCertificatesGet(ctx context.Context, id CustomCertificateId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCustomCertificatesGet handles the response to the CustomCertificatesGet request. The method always +// closes the http.Response Body. +func (c SignalRClient) responderForCustomCertificatesGet(resp *http.Response) (result CustomCertificatesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customcertificateslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customcertificateslist_autorest.go new file mode 100644 index 00000000000..42456f640ad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customcertificateslist_autorest.go @@ -0,0 +1,186 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomCertificatesListOperationResponse struct { + HttpResponse *http.Response + Model *[]CustomCertificate + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (CustomCertificatesListOperationResponse, error) +} + +type CustomCertificatesListCompleteResult struct { + Items []CustomCertificate +} + +func (r CustomCertificatesListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r CustomCertificatesListOperationResponse) LoadMore(ctx context.Context) (resp CustomCertificatesListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// CustomCertificatesList ... +func (c SignalRClient) CustomCertificatesList(ctx context.Context, id SignalRId) (resp CustomCertificatesListOperationResponse, err error) { + req, err := c.preparerForCustomCertificatesList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomCertificatesList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomCertificatesList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForCustomCertificatesList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomCertificatesList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForCustomCertificatesList prepares the CustomCertificatesList request. +func (c SignalRClient) preparerForCustomCertificatesList(ctx context.Context, id SignalRId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/customCertificates", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForCustomCertificatesListWithNextLink prepares the CustomCertificatesList request with the given nextLink token. +func (c SignalRClient) preparerForCustomCertificatesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCustomCertificatesList handles the response to the CustomCertificatesList request. The method always +// closes the http.Response Body. +func (c SignalRClient) responderForCustomCertificatesList(resp *http.Response) (result CustomCertificatesListOperationResponse, err error) { + type page struct { + Values []CustomCertificate `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result CustomCertificatesListOperationResponse, err error) { + req, err := c.preparerForCustomCertificatesListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomCertificatesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomCertificatesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCustomCertificatesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomCertificatesList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// CustomCertificatesListComplete retrieves all of the results into a single object +func (c SignalRClient) CustomCertificatesListComplete(ctx context.Context, id SignalRId) (CustomCertificatesListCompleteResult, error) { + return c.CustomCertificatesListCompleteMatchingPredicate(ctx, id, CustomCertificateOperationPredicate{}) +} + +// CustomCertificatesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SignalRClient) CustomCertificatesListCompleteMatchingPredicate(ctx context.Context, id SignalRId, predicate CustomCertificateOperationPredicate) (resp CustomCertificatesListCompleteResult, err error) { + items := make([]CustomCertificate, 0) + + page, err := c.CustomCertificatesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := CustomCertificatesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customdomainscreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customdomainscreateorupdate_autorest.go new file mode 100644 index 00000000000..3a7ac111f9b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customdomainscreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomDomainsCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CustomDomainsCreateOrUpdate ... +func (c SignalRClient) CustomDomainsCreateOrUpdate(ctx context.Context, id CustomDomainId, input CustomDomain) (result CustomDomainsCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCustomDomainsCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomDomainsCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCustomDomainsCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomDomainsCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CustomDomainsCreateOrUpdateThenPoll performs CustomDomainsCreateOrUpdate then polls until it's completed +func (c SignalRClient) CustomDomainsCreateOrUpdateThenPoll(ctx context.Context, id CustomDomainId, input CustomDomain) error { + result, err := c.CustomDomainsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CustomDomainsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CustomDomainsCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCustomDomainsCreateOrUpdate prepares the CustomDomainsCreateOrUpdate request. +func (c SignalRClient) preparerForCustomDomainsCreateOrUpdate(ctx context.Context, id CustomDomainId, input CustomDomain) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCustomDomainsCreateOrUpdate sends the CustomDomainsCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c SignalRClient) senderForCustomDomainsCreateOrUpdate(ctx context.Context, req *http.Request) (future CustomDomainsCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customdomainsdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customdomainsdelete_autorest.go new file mode 100644 index 00000000000..89e9169c92f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customdomainsdelete_autorest.go @@ -0,0 +1,78 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomDomainsDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CustomDomainsDelete ... +func (c SignalRClient) CustomDomainsDelete(ctx context.Context, id CustomDomainId) (result CustomDomainsDeleteOperationResponse, err error) { + req, err := c.preparerForCustomDomainsDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomDomainsDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForCustomDomainsDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomDomainsDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CustomDomainsDeleteThenPoll performs CustomDomainsDelete then polls until it's completed +func (c SignalRClient) CustomDomainsDeleteThenPoll(ctx context.Context, id CustomDomainId) error { + result, err := c.CustomDomainsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing CustomDomainsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CustomDomainsDelete: %+v", err) + } + + return nil +} + +// preparerForCustomDomainsDelete prepares the CustomDomainsDelete request. +func (c SignalRClient) preparerForCustomDomainsDelete(ctx context.Context, id CustomDomainId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCustomDomainsDelete sends the CustomDomainsDelete request. The method will close the +// http.Response Body if it receives an error. +func (c SignalRClient) senderForCustomDomainsDelete(ctx context.Context, req *http.Request) (future CustomDomainsDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customdomainsget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customdomainsget_autorest.go new file mode 100644 index 00000000000..c4125f78776 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customdomainsget_autorest.go @@ -0,0 +1,68 @@ +package signalr + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomDomainsGetOperationResponse struct { + HttpResponse *http.Response + Model *CustomDomain +} + +// CustomDomainsGet ... +func (c SignalRClient) CustomDomainsGet(ctx context.Context, id CustomDomainId) (result CustomDomainsGetOperationResponse, err error) { + req, err := c.preparerForCustomDomainsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomDomainsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomDomainsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCustomDomainsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomDomainsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCustomDomainsGet prepares the CustomDomainsGet request. +func (c SignalRClient) preparerForCustomDomainsGet(ctx context.Context, id CustomDomainId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCustomDomainsGet handles the response to the CustomDomainsGet request. The method always +// closes the http.Response Body. +func (c SignalRClient) responderForCustomDomainsGet(resp *http.Response) (result CustomDomainsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customdomainslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customdomainslist_autorest.go new file mode 100644 index 00000000000..51f55391623 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_customdomainslist_autorest.go @@ -0,0 +1,186 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomDomainsListOperationResponse struct { + HttpResponse *http.Response + Model *[]CustomDomain + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (CustomDomainsListOperationResponse, error) +} + +type CustomDomainsListCompleteResult struct { + Items []CustomDomain +} + +func (r CustomDomainsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r CustomDomainsListOperationResponse) LoadMore(ctx context.Context) (resp CustomDomainsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// CustomDomainsList ... +func (c SignalRClient) CustomDomainsList(ctx context.Context, id SignalRId) (resp CustomDomainsListOperationResponse, err error) { + req, err := c.preparerForCustomDomainsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomDomainsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomDomainsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForCustomDomainsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomDomainsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForCustomDomainsList prepares the CustomDomainsList request. +func (c SignalRClient) preparerForCustomDomainsList(ctx context.Context, id SignalRId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/customDomains", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForCustomDomainsListWithNextLink prepares the CustomDomainsList request with the given nextLink token. +func (c SignalRClient) preparerForCustomDomainsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCustomDomainsList handles the response to the CustomDomainsList request. The method always +// closes the http.Response Body. +func (c SignalRClient) responderForCustomDomainsList(resp *http.Response) (result CustomDomainsListOperationResponse, err error) { + type page struct { + Values []CustomDomain `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result CustomDomainsListOperationResponse, err error) { + req, err := c.preparerForCustomDomainsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomDomainsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomDomainsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCustomDomainsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CustomDomainsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// CustomDomainsListComplete retrieves all of the results into a single object +func (c SignalRClient) CustomDomainsListComplete(ctx context.Context, id SignalRId) (CustomDomainsListCompleteResult, error) { + return c.CustomDomainsListCompleteMatchingPredicate(ctx, id, CustomDomainOperationPredicate{}) +} + +// CustomDomainsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SignalRClient) CustomDomainsListCompleteMatchingPredicate(ctx context.Context, id SignalRId, predicate CustomDomainOperationPredicate) (resp CustomDomainsListCompleteResult, err error) { + items := make([]CustomDomain, 0) + + page, err := c.CustomDomainsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := CustomDomainsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_delete_autorest.go new file mode 100644 index 00000000000..a0aa9b75e28 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_delete_autorest.go @@ -0,0 +1,78 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c SignalRClient) Delete(ctx context.Context, id SignalRId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c SignalRClient) DeleteThenPoll(ctx context.Context, id SignalRId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c SignalRClient) preparerForDelete(ctx context.Context, id SignalRId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c SignalRClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_get_autorest.go new file mode 100644 index 00000000000..55f483b3e1e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_get_autorest.go @@ -0,0 +1,68 @@ +package signalr + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *SignalRResource +} + +// Get ... +func (c SignalRClient) Get(ctx context.Context, id SignalRId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c SignalRClient) preparerForGet(ctx context.Context, id SignalRId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c SignalRClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..cb0fc415b8a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]SignalRResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []SignalRResource +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c SignalRClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c SignalRClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.SignalRService/signalR", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c SignalRClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c SignalRClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []SignalRResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c SignalRClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, SignalRResourceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SignalRClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate SignalRResourceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]SignalRResource, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..c4b4975b294 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_listbysubscription_autorest.go @@ -0,0 +1,187 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]SignalRResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) +} + +type ListBySubscriptionCompleteResult struct { + Items []SignalRResource +} + +func (r ListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySubscription ... +func (c SignalRClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c SignalRClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.SignalRService/signalR", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. +func (c SignalRClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c SignalRClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + type page struct { + Values []SignalRResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySubscriptionComplete retrieves all of the results into a single object +func (c SignalRClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, SignalRResourceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SignalRClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate SignalRResourceOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { + items := make([]SignalRResource, 0) + + page, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_listkeys_autorest.go new file mode 100644 index 00000000000..6c89992f013 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_listkeys_autorest.go @@ -0,0 +1,69 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeysOperationResponse struct { + HttpResponse *http.Response + Model *SignalRKeys +} + +// ListKeys ... +func (c SignalRClient) ListKeys(ctx context.Context, id SignalRId) (result ListKeysOperationResponse, err error) { + req, err := c.preparerForListKeys(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListKeys prepares the ListKeys request. +func (c SignalRClient) preparerForListKeys(ctx context.Context, id SignalRId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListKeys handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (c SignalRClient) responderForListKeys(resp *http.Response) (result ListKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_listskus_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_listskus_autorest.go new file mode 100644 index 00000000000..f05bb5740d6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_listskus_autorest.go @@ -0,0 +1,69 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSkusOperationResponse struct { + HttpResponse *http.Response + Model *SkuList +} + +// ListSkus ... +func (c SignalRClient) ListSkus(ctx context.Context, id SignalRId) (result ListSkusOperationResponse, err error) { + req, err := c.preparerForListSkus(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListSkus", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListSkus", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListSkus(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListSkus", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListSkus prepares the ListSkus request. +func (c SignalRClient) preparerForListSkus(ctx context.Context, id SignalRId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/skus", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListSkus handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (c SignalRClient) responderForListSkus(resp *http.Response) (result ListSkusOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_privateendpointconnectionsdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_privateendpointconnectionsdelete_autorest.go similarity index 84% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_privateendpointconnectionsdelete_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_privateendpointconnectionsdelete_autorest.go index 2c81d50fa3a..73899e28852 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_privateendpointconnectionsdelete_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_privateendpointconnectionsdelete_autorest.go @@ -10,13 +10,16 @@ import ( "github.com/hashicorp/go-azure-helpers/polling" ) -type PrivateEndpointConnectionsDeleteResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionsDeleteOperationResponse struct { Poller polling.LongRunningPoller HttpResponse *http.Response } // PrivateEndpointConnectionsDelete ... -func (c SignalRClient) PrivateEndpointConnectionsDelete(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionsDeleteResponse, err error) { +func (c SignalRClient) PrivateEndpointConnectionsDelete(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionsDeleteOperationResponse, err error) { req, err := c.preparerForPrivateEndpointConnectionsDelete(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "PrivateEndpointConnectionsDelete", nil, "Failure preparing request") @@ -53,6 +56,7 @@ func (c SignalRClient) preparerForPrivateEndpointConnectionsDelete(ctx context.C } preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), autorest.AsDelete(), autorest.WithBaseURL(c.baseUri), autorest.WithPath(id.ID()), @@ -62,12 +66,13 @@ func (c SignalRClient) preparerForPrivateEndpointConnectionsDelete(ctx context.C // senderForPrivateEndpointConnectionsDelete sends the PrivateEndpointConnectionsDelete request. The method will close the // http.Response Body if it receives an error. -func (c SignalRClient) senderForPrivateEndpointConnectionsDelete(ctx context.Context, req *http.Request) (future PrivateEndpointConnectionsDeleteResponse, err error) { +func (c SignalRClient) senderForPrivateEndpointConnectionsDelete(ctx context.Context, req *http.Request) (future PrivateEndpointConnectionsDeleteOperationResponse, err error) { var resp *http.Response resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) if err != nil { return } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_privateendpointconnectionsget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_privateendpointconnectionsget_autorest.go similarity index 85% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_privateendpointconnectionsget_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_privateendpointconnectionsget_autorest.go index 0555d1a26a7..17fce1fa439 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_privateendpointconnectionsget_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_privateendpointconnectionsget_autorest.go @@ -8,13 +8,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type PrivateEndpointConnectionsGetResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionsGetOperationResponse struct { HttpResponse *http.Response Model *PrivateEndpointConnection } // PrivateEndpointConnectionsGet ... -func (c SignalRClient) PrivateEndpointConnectionsGet(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionsGetResponse, err error) { +func (c SignalRClient) PrivateEndpointConnectionsGet(ctx context.Context, id PrivateEndpointConnectionId) (result PrivateEndpointConnectionsGetOperationResponse, err error) { req, err := c.preparerForPrivateEndpointConnectionsGet(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "PrivateEndpointConnectionsGet", nil, "Failure preparing request") @@ -53,12 +56,13 @@ func (c SignalRClient) preparerForPrivateEndpointConnectionsGet(ctx context.Cont // responderForPrivateEndpointConnectionsGet handles the response to the PrivateEndpointConnectionsGet request. The method always // closes the http.Response Body. -func (c SignalRClient) responderForPrivateEndpointConnectionsGet(resp *http.Response) (result PrivateEndpointConnectionsGetResponse, err error) { +func (c SignalRClient) responderForPrivateEndpointConnectionsGet(resp *http.Response) (result PrivateEndpointConnectionsGetOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_privateendpointconnectionslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_privateendpointconnectionslist_autorest.go new file mode 100644 index 00000000000..a4ceffbc54f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_privateendpointconnectionslist_autorest.go @@ -0,0 +1,186 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionsListOperationResponse struct { + HttpResponse *http.Response + Model *[]PrivateEndpointConnection + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (PrivateEndpointConnectionsListOperationResponse, error) +} + +type PrivateEndpointConnectionsListCompleteResult struct { + Items []PrivateEndpointConnection +} + +func (r PrivateEndpointConnectionsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r PrivateEndpointConnectionsListOperationResponse) LoadMore(ctx context.Context) (resp PrivateEndpointConnectionsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// PrivateEndpointConnectionsList ... +func (c SignalRClient) PrivateEndpointConnectionsList(ctx context.Context, id SignalRId) (resp PrivateEndpointConnectionsListOperationResponse, err error) { + req, err := c.preparerForPrivateEndpointConnectionsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "PrivateEndpointConnectionsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "PrivateEndpointConnectionsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForPrivateEndpointConnectionsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "PrivateEndpointConnectionsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForPrivateEndpointConnectionsList prepares the PrivateEndpointConnectionsList request. +func (c SignalRClient) preparerForPrivateEndpointConnectionsList(ctx context.Context, id SignalRId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/privateEndpointConnections", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForPrivateEndpointConnectionsListWithNextLink prepares the PrivateEndpointConnectionsList request with the given nextLink token. +func (c SignalRClient) preparerForPrivateEndpointConnectionsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPrivateEndpointConnectionsList handles the response to the PrivateEndpointConnectionsList request. The method always +// closes the http.Response Body. +func (c SignalRClient) responderForPrivateEndpointConnectionsList(resp *http.Response) (result PrivateEndpointConnectionsListOperationResponse, err error) { + type page struct { + Values []PrivateEndpointConnection `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result PrivateEndpointConnectionsListOperationResponse, err error) { + req, err := c.preparerForPrivateEndpointConnectionsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "PrivateEndpointConnectionsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "PrivateEndpointConnectionsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPrivateEndpointConnectionsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "PrivateEndpointConnectionsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// PrivateEndpointConnectionsListComplete retrieves all of the results into a single object +func (c SignalRClient) PrivateEndpointConnectionsListComplete(ctx context.Context, id SignalRId) (PrivateEndpointConnectionsListCompleteResult, error) { + return c.PrivateEndpointConnectionsListCompleteMatchingPredicate(ctx, id, PrivateEndpointConnectionOperationPredicate{}) +} + +// PrivateEndpointConnectionsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SignalRClient) PrivateEndpointConnectionsListCompleteMatchingPredicate(ctx context.Context, id SignalRId, predicate PrivateEndpointConnectionOperationPredicate) (resp PrivateEndpointConnectionsListCompleteResult, err error) { + items := make([]PrivateEndpointConnection, 0) + + page, err := c.PrivateEndpointConnectionsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := PrivateEndpointConnectionsListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_privateendpointconnectionsupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_privateendpointconnectionsupdate_autorest.go similarity index 87% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_privateendpointconnectionsupdate_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_privateendpointconnectionsupdate_autorest.go index 5f63bb3312a..fd59b1fbe0b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_privateendpointconnectionsupdate_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_privateendpointconnectionsupdate_autorest.go @@ -8,13 +8,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type PrivateEndpointConnectionsUpdateResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionsUpdateOperationResponse struct { HttpResponse *http.Response Model *PrivateEndpointConnection } // PrivateEndpointConnectionsUpdate ... -func (c SignalRClient) PrivateEndpointConnectionsUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result PrivateEndpointConnectionsUpdateResponse, err error) { +func (c SignalRClient) PrivateEndpointConnectionsUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result PrivateEndpointConnectionsUpdateOperationResponse, err error) { req, err := c.preparerForPrivateEndpointConnectionsUpdate(ctx, id, input) if err != nil { err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "PrivateEndpointConnectionsUpdate", nil, "Failure preparing request") @@ -54,12 +57,13 @@ func (c SignalRClient) preparerForPrivateEndpointConnectionsUpdate(ctx context.C // responderForPrivateEndpointConnectionsUpdate handles the response to the PrivateEndpointConnectionsUpdate request. The method always // closes the http.Response Body. -func (c SignalRClient) responderForPrivateEndpointConnectionsUpdate(resp *http.Response) (result PrivateEndpointConnectionsUpdateResponse, err error) { +func (c SignalRClient) responderForPrivateEndpointConnectionsUpdate(resp *http.Response) (result PrivateEndpointConnectionsUpdateOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_privatelinkresourceslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_privatelinkresourceslist_autorest.go similarity index 87% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_privatelinkresourceslist_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_privatelinkresourceslist_autorest.go index 46412f62904..e55b5ce3fbf 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_privatelinkresourceslist_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_privatelinkresourceslist_autorest.go @@ -10,23 +10,26 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type PrivateLinkResourcesListResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkResourcesListOperationResponse struct { HttpResponse *http.Response Model *[]PrivateLinkResource nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (PrivateLinkResourcesListResponse, error) + nextPageFunc func(ctx context.Context, nextLink string) (PrivateLinkResourcesListOperationResponse, error) } type PrivateLinkResourcesListCompleteResult struct { Items []PrivateLinkResource } -func (r PrivateLinkResourcesListResponse) HasMore() bool { +func (r PrivateLinkResourcesListOperationResponse) HasMore() bool { return r.nextLink != nil } -func (r PrivateLinkResourcesListResponse) LoadMore(ctx context.Context) (resp PrivateLinkResourcesListResponse, err error) { +func (r PrivateLinkResourcesListOperationResponse) LoadMore(ctx context.Context) (resp PrivateLinkResourcesListOperationResponse, err error) { if !r.HasMore() { err = fmt.Errorf("no more pages returned") return @@ -35,7 +38,7 @@ func (r PrivateLinkResourcesListResponse) LoadMore(ctx context.Context) (resp Pr } // PrivateLinkResourcesList ... -func (c SignalRClient) PrivateLinkResourcesList(ctx context.Context, id SignalRId) (resp PrivateLinkResourcesListResponse, err error) { +func (c SignalRClient) PrivateLinkResourcesList(ctx context.Context, id SignalRId) (resp PrivateLinkResourcesListOperationResponse, err error) { req, err := c.preparerForPrivateLinkResourcesList(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "PrivateLinkResourcesList", nil, "Failure preparing request") @@ -56,50 +59,6 @@ func (c SignalRClient) PrivateLinkResourcesList(ctx context.Context, id SignalRI return } -// PrivateLinkResourcesListComplete retrieves all of the results into a single object -func (c SignalRClient) PrivateLinkResourcesListComplete(ctx context.Context, id SignalRId) (PrivateLinkResourcesListCompleteResult, error) { - return c.PrivateLinkResourcesListCompleteMatchingPredicate(ctx, id, PrivateLinkResourcePredicate{}) -} - -// PrivateLinkResourcesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SignalRClient) PrivateLinkResourcesListCompleteMatchingPredicate(ctx context.Context, id SignalRId, predicate PrivateLinkResourcePredicate) (resp PrivateLinkResourcesListCompleteResult, err error) { - items := make([]PrivateLinkResource, 0) - - page, err := c.PrivateLinkResourcesList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := PrivateLinkResourcesListCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForPrivateLinkResourcesList prepares the PrivateLinkResourcesList request. func (c SignalRClient) preparerForPrivateLinkResourcesList(ctx context.Context, id SignalRId) (*http.Request, error) { queryParameters := map[string]interface{}{ @@ -142,7 +101,7 @@ func (c SignalRClient) preparerForPrivateLinkResourcesListWithNextLink(ctx conte // responderForPrivateLinkResourcesList handles the response to the PrivateLinkResourcesList request. The method always // closes the http.Response Body. -func (c SignalRClient) responderForPrivateLinkResourcesList(resp *http.Response) (result PrivateLinkResourcesListResponse, err error) { +func (c SignalRClient) responderForPrivateLinkResourcesList(resp *http.Response) (result PrivateLinkResourcesListOperationResponse, err error) { type page struct { Values []PrivateLinkResource `json:"value"` NextLink *string `json:"nextLink"` @@ -157,7 +116,7 @@ func (c SignalRClient) responderForPrivateLinkResourcesList(resp *http.Response) result.Model = &respObj.Values result.nextLink = respObj.NextLink if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result PrivateLinkResourcesListResponse, err error) { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result PrivateLinkResourcesListOperationResponse, err error) { req, err := c.preparerForPrivateLinkResourcesListWithNextLink(ctx, nextLink) if err != nil { err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "PrivateLinkResourcesList", nil, "Failure preparing request") @@ -181,3 +140,47 @@ func (c SignalRClient) responderForPrivateLinkResourcesList(resp *http.Response) } return } + +// PrivateLinkResourcesListComplete retrieves all of the results into a single object +func (c SignalRClient) PrivateLinkResourcesListComplete(ctx context.Context, id SignalRId) (PrivateLinkResourcesListCompleteResult, error) { + return c.PrivateLinkResourcesListCompleteMatchingPredicate(ctx, id, PrivateLinkResourceOperationPredicate{}) +} + +// PrivateLinkResourcesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SignalRClient) PrivateLinkResourcesListCompleteMatchingPredicate(ctx context.Context, id SignalRId, predicate PrivateLinkResourceOperationPredicate) (resp PrivateLinkResourcesListCompleteResult, err error) { + items := make([]PrivateLinkResource, 0) + + page, err := c.PrivateLinkResourcesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := PrivateLinkResourcesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_regeneratekey_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_regeneratekey_autorest.go new file mode 100644 index 00000000000..493d3dc9684 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_regeneratekey_autorest.go @@ -0,0 +1,79 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// RegenerateKey ... +func (c SignalRClient) RegenerateKey(ctx context.Context, id SignalRId, input RegenerateKeyParameters) (result RegenerateKeyOperationResponse, err error) { + req, err := c.preparerForRegenerateKey(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + result, err = c.senderForRegenerateKey(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "RegenerateKey", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// RegenerateKeyThenPoll performs RegenerateKey then polls until it's completed +func (c SignalRClient) RegenerateKeyThenPoll(ctx context.Context, id SignalRId, input RegenerateKeyParameters) error { + result, err := c.RegenerateKey(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RegenerateKey: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after RegenerateKey: %+v", err) + } + + return nil +} + +// preparerForRegenerateKey prepares the RegenerateKey request. +func (c SignalRClient) preparerForRegenerateKey(ctx context.Context, id SignalRId, input RegenerateKeyParameters) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/regenerateKey", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForRegenerateKey sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (c SignalRClient) senderForRegenerateKey(ctx context.Context, req *http.Request) (future RegenerateKeyOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_restart_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_restart_autorest.go new file mode 100644 index 00000000000..c1d9ae14be6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_restart_autorest.go @@ -0,0 +1,78 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestartOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Restart ... +func (c SignalRClient) Restart(ctx context.Context, id SignalRId) (result RestartOperationResponse, err error) { + req, err := c.preparerForRestart(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Restart", nil, "Failure preparing request") + return + } + + result, err = c.senderForRestart(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Restart", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// RestartThenPoll performs Restart then polls until it's completed +func (c SignalRClient) RestartThenPoll(ctx context.Context, id SignalRId) error { + result, err := c.Restart(ctx, id) + if err != nil { + return fmt.Errorf("performing Restart: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Restart: %+v", err) + } + + return nil +} + +// preparerForRestart prepares the Restart request. +func (c SignalRClient) preparerForRestart(ctx context.Context, id SignalRId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/restart", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForRestart sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (c SignalRClient) senderForRestart(ctx context.Context, req *http.Request) (future RestartOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_sharedprivatelinkresourcescreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_sharedprivatelinkresourcescreateorupdate_autorest.go new file mode 100644 index 00000000000..bc806a9b73d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_sharedprivatelinkresourcescreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedPrivateLinkResourcesCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// SharedPrivateLinkResourcesCreateOrUpdate ... +func (c SignalRClient) SharedPrivateLinkResourcesCreateOrUpdate(ctx context.Context, id SharedPrivateLinkResourceId, input SharedPrivateLinkResource) (result SharedPrivateLinkResourcesCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForSharedPrivateLinkResourcesCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "SharedPrivateLinkResourcesCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForSharedPrivateLinkResourcesCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "SharedPrivateLinkResourcesCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// SharedPrivateLinkResourcesCreateOrUpdateThenPoll performs SharedPrivateLinkResourcesCreateOrUpdate then polls until it's completed +func (c SignalRClient) SharedPrivateLinkResourcesCreateOrUpdateThenPoll(ctx context.Context, id SharedPrivateLinkResourceId, input SharedPrivateLinkResource) error { + result, err := c.SharedPrivateLinkResourcesCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing SharedPrivateLinkResourcesCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after SharedPrivateLinkResourcesCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForSharedPrivateLinkResourcesCreateOrUpdate prepares the SharedPrivateLinkResourcesCreateOrUpdate request. +func (c SignalRClient) preparerForSharedPrivateLinkResourcesCreateOrUpdate(ctx context.Context, id SharedPrivateLinkResourceId, input SharedPrivateLinkResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForSharedPrivateLinkResourcesCreateOrUpdate sends the SharedPrivateLinkResourcesCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c SignalRClient) senderForSharedPrivateLinkResourcesCreateOrUpdate(ctx context.Context, req *http.Request) (future SharedPrivateLinkResourcesCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_sharedprivatelinkresourcesdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_sharedprivatelinkresourcesdelete_autorest.go new file mode 100644 index 00000000000..94f01fed123 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_sharedprivatelinkresourcesdelete_autorest.go @@ -0,0 +1,78 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedPrivateLinkResourcesDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// SharedPrivateLinkResourcesDelete ... +func (c SignalRClient) SharedPrivateLinkResourcesDelete(ctx context.Context, id SharedPrivateLinkResourceId) (result SharedPrivateLinkResourcesDeleteOperationResponse, err error) { + req, err := c.preparerForSharedPrivateLinkResourcesDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "SharedPrivateLinkResourcesDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForSharedPrivateLinkResourcesDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "SharedPrivateLinkResourcesDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// SharedPrivateLinkResourcesDeleteThenPoll performs SharedPrivateLinkResourcesDelete then polls until it's completed +func (c SignalRClient) SharedPrivateLinkResourcesDeleteThenPoll(ctx context.Context, id SharedPrivateLinkResourceId) error { + result, err := c.SharedPrivateLinkResourcesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing SharedPrivateLinkResourcesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after SharedPrivateLinkResourcesDelete: %+v", err) + } + + return nil +} + +// preparerForSharedPrivateLinkResourcesDelete prepares the SharedPrivateLinkResourcesDelete request. +func (c SignalRClient) preparerForSharedPrivateLinkResourcesDelete(ctx context.Context, id SharedPrivateLinkResourceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForSharedPrivateLinkResourcesDelete sends the SharedPrivateLinkResourcesDelete request. The method will close the +// http.Response Body if it receives an error. +func (c SignalRClient) senderForSharedPrivateLinkResourcesDelete(ctx context.Context, req *http.Request) (future SharedPrivateLinkResourcesDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_sharedprivatelinkresourcesget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_sharedprivatelinkresourcesget_autorest.go new file mode 100644 index 00000000000..29a8c06b489 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_sharedprivatelinkresourcesget_autorest.go @@ -0,0 +1,68 @@ +package signalr + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedPrivateLinkResourcesGetOperationResponse struct { + HttpResponse *http.Response + Model *SharedPrivateLinkResource +} + +// SharedPrivateLinkResourcesGet ... +func (c SignalRClient) SharedPrivateLinkResourcesGet(ctx context.Context, id SharedPrivateLinkResourceId) (result SharedPrivateLinkResourcesGetOperationResponse, err error) { + req, err := c.preparerForSharedPrivateLinkResourcesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "SharedPrivateLinkResourcesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "SharedPrivateLinkResourcesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSharedPrivateLinkResourcesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "SharedPrivateLinkResourcesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSharedPrivateLinkResourcesGet prepares the SharedPrivateLinkResourcesGet request. +func (c SignalRClient) preparerForSharedPrivateLinkResourcesGet(ctx context.Context, id SharedPrivateLinkResourceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSharedPrivateLinkResourcesGet handles the response to the SharedPrivateLinkResourcesGet request. The method always +// closes the http.Response Body. +func (c SignalRClient) responderForSharedPrivateLinkResourcesGet(resp *http.Response) (result SharedPrivateLinkResourcesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_sharedprivatelinkresourceslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_sharedprivatelinkresourceslist_autorest.go new file mode 100644 index 00000000000..77089157d1d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_sharedprivatelinkresourceslist_autorest.go @@ -0,0 +1,186 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedPrivateLinkResourcesListOperationResponse struct { + HttpResponse *http.Response + Model *[]SharedPrivateLinkResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (SharedPrivateLinkResourcesListOperationResponse, error) +} + +type SharedPrivateLinkResourcesListCompleteResult struct { + Items []SharedPrivateLinkResource +} + +func (r SharedPrivateLinkResourcesListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r SharedPrivateLinkResourcesListOperationResponse) LoadMore(ctx context.Context) (resp SharedPrivateLinkResourcesListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// SharedPrivateLinkResourcesList ... +func (c SignalRClient) SharedPrivateLinkResourcesList(ctx context.Context, id SignalRId) (resp SharedPrivateLinkResourcesListOperationResponse, err error) { + req, err := c.preparerForSharedPrivateLinkResourcesList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "SharedPrivateLinkResourcesList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "SharedPrivateLinkResourcesList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForSharedPrivateLinkResourcesList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "SharedPrivateLinkResourcesList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForSharedPrivateLinkResourcesList prepares the SharedPrivateLinkResourcesList request. +func (c SignalRClient) preparerForSharedPrivateLinkResourcesList(ctx context.Context, id SignalRId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/sharedPrivateLinkResources", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForSharedPrivateLinkResourcesListWithNextLink prepares the SharedPrivateLinkResourcesList request with the given nextLink token. +func (c SignalRClient) preparerForSharedPrivateLinkResourcesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSharedPrivateLinkResourcesList handles the response to the SharedPrivateLinkResourcesList request. The method always +// closes the http.Response Body. +func (c SignalRClient) responderForSharedPrivateLinkResourcesList(resp *http.Response) (result SharedPrivateLinkResourcesListOperationResponse, err error) { + type page struct { + Values []SharedPrivateLinkResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result SharedPrivateLinkResourcesListOperationResponse, err error) { + req, err := c.preparerForSharedPrivateLinkResourcesListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "SharedPrivateLinkResourcesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "SharedPrivateLinkResourcesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSharedPrivateLinkResourcesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "SharedPrivateLinkResourcesList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// SharedPrivateLinkResourcesListComplete retrieves all of the results into a single object +func (c SignalRClient) SharedPrivateLinkResourcesListComplete(ctx context.Context, id SignalRId) (SharedPrivateLinkResourcesListCompleteResult, error) { + return c.SharedPrivateLinkResourcesListCompleteMatchingPredicate(ctx, id, SharedPrivateLinkResourceOperationPredicate{}) +} + +// SharedPrivateLinkResourcesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SignalRClient) SharedPrivateLinkResourcesListCompleteMatchingPredicate(ctx context.Context, id SignalRId, predicate SharedPrivateLinkResourceOperationPredicate) (resp SharedPrivateLinkResourcesListCompleteResult, err error) { + items := make([]SharedPrivateLinkResource, 0) + + page, err := c.SharedPrivateLinkResourcesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := SharedPrivateLinkResourcesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_update_autorest.go new file mode 100644 index 00000000000..f90077a5bf5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_update_autorest.go @@ -0,0 +1,79 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c SignalRClient) Update(ctx context.Context, id SignalRId, input SignalRResource) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c SignalRClient) UpdateThenPoll(ctx context.Context, id SignalRId, input SignalRResource) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c SignalRClient) preparerForUpdate(ctx context.Context, id SignalRId, input SignalRResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c SignalRClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_usageslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_usageslist_autorest.go new file mode 100644 index 00000000000..d19e73baa15 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/method_usageslist_autorest.go @@ -0,0 +1,186 @@ +package signalr + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UsagesListOperationResponse struct { + HttpResponse *http.Response + Model *[]SignalRUsage + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (UsagesListOperationResponse, error) +} + +type UsagesListCompleteResult struct { + Items []SignalRUsage +} + +func (r UsagesListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r UsagesListOperationResponse) LoadMore(ctx context.Context) (resp UsagesListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// UsagesList ... +func (c SignalRClient) UsagesList(ctx context.Context, id LocationId) (resp UsagesListOperationResponse, err error) { + req, err := c.preparerForUsagesList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "UsagesList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "UsagesList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForUsagesList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "UsagesList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForUsagesList prepares the UsagesList request. +func (c SignalRClient) preparerForUsagesList(ctx context.Context, id LocationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/usages", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForUsagesListWithNextLink prepares the UsagesList request with the given nextLink token. +func (c SignalRClient) preparerForUsagesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUsagesList handles the response to the UsagesList request. The method always +// closes the http.Response Body. +func (c SignalRClient) responderForUsagesList(resp *http.Response) (result UsagesListOperationResponse, err error) { + type page struct { + Values []SignalRUsage `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result UsagesListOperationResponse, err error) { + req, err := c.preparerForUsagesListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "UsagesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "UsagesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUsagesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "UsagesList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// UsagesListComplete retrieves all of the results into a single object +func (c SignalRClient) UsagesListComplete(ctx context.Context, id LocationId) (UsagesListCompleteResult, error) { + return c.UsagesListCompleteMatchingPredicate(ctx, id, SignalRUsageOperationPredicate{}) +} + +// UsagesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SignalRClient) UsagesListCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate SignalRUsageOperationPredicate) (resp UsagesListCompleteResult, err error) { + items := make([]SignalRUsage, 0) + + page, err := c.UsagesList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := UsagesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_customcertificate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_customcertificate.go new file mode 100644 index 00000000000..d6ff9633aa0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_customcertificate.go @@ -0,0 +1,16 @@ +package signalr + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomCertificate struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties CustomCertificateProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_customcertificateproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_customcertificateproperties.go new file mode 100644 index 00000000000..95b0e37cbc8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_customcertificateproperties.go @@ -0,0 +1,11 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomCertificateProperties struct { + KeyVaultBaseUri string `json:"keyVaultBaseUri"` + KeyVaultSecretName string `json:"keyVaultSecretName"` + KeyVaultSecretVersion *string `json:"keyVaultSecretVersion,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_customdomain.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_customdomain.go new file mode 100644 index 00000000000..07cf8a4002e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_customdomain.go @@ -0,0 +1,16 @@ +package signalr + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomDomain struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties CustomDomainProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_customdomainproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_customdomainproperties.go new file mode 100644 index 00000000000..c084ddc8155 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_customdomainproperties.go @@ -0,0 +1,10 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomDomainProperties struct { + CustomCertificate ResourceReference `json:"customCertificate"` + DomainName string `json:"domainName"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_livetracecategory.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_livetracecategory.go new file mode 100644 index 00000000000..eaf0b128ba7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_livetracecategory.go @@ -0,0 +1,9 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LiveTraceCategory struct { + Enabled *string `json:"enabled,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_livetraceconfiguration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_livetraceconfiguration.go new file mode 100644 index 00000000000..62766225faf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_livetraceconfiguration.go @@ -0,0 +1,9 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LiveTraceConfiguration struct { + Categories *[]LiveTraceCategory `json:"categories,omitempty"` + Enabled *string `json:"enabled,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_managedidentitysettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_managedidentitysettings.go new file mode 100644 index 00000000000..05ada7009e8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_managedidentitysettings.go @@ -0,0 +1,8 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedIdentitySettings struct { + Resource *string `json:"resource,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_nameavailability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_nameavailability.go new file mode 100644 index 00000000000..1c5d9874121 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_nameavailability.go @@ -0,0 +1,10 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NameAvailability struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *string `json:"reason,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_nameavailabilityparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_nameavailabilityparameters.go new file mode 100644 index 00000000000..e555e38d3e0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_nameavailabilityparameters.go @@ -0,0 +1,9 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NameAvailabilityParameters struct { + Name string `json:"name"` + Type string `json:"type"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_networkacl.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_networkacl.go new file mode 100644 index 00000000000..4527c32d44e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_networkacl.go @@ -0,0 +1,9 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkACL struct { + Allow *[]SignalRRequestType `json:"allow,omitempty"` + Deny *[]SignalRRequestType `json:"deny,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privateendpoint.go new file mode 100644 index 00000000000..386ec10fcc5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privateendpoint.go @@ -0,0 +1,8 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privateendpointacl.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privateendpointacl.go new file mode 100644 index 00000000000..023e23531e9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privateendpointacl.go @@ -0,0 +1,10 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointACL struct { + Allow *[]SignalRRequestType `json:"allow,omitempty"` + Deny *[]SignalRRequestType `json:"deny,omitempty"` + Name string `json:"name"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privateendpointconnection.go new file mode 100644 index 00000000000..f82669103c5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privateendpointconnection.go @@ -0,0 +1,16 @@ +package signalr + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..4f579802977 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privateendpointconnectionproperties.go @@ -0,0 +1,11 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + GroupIds *[]string `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privatelinkresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privatelinkresource.go new file mode 100644 index 00000000000..066fc50b9d4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privatelinkresource.go @@ -0,0 +1,11 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privatelinkresourceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privatelinkresourceproperties.go new file mode 100644 index 00000000000..15661eded28 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privatelinkresourceproperties.go @@ -0,0 +1,11 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkResourceProperties struct { + GroupId *string `json:"groupId,omitempty"` + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` + ShareablePrivateLinkResourceTypes *[]ShareablePrivateLinkResourceType `json:"shareablePrivateLinkResourceTypes,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privatelinkserviceconnectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..943f9ca6832 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateLinkServiceConnectionStatus `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_regeneratekeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_regeneratekeyparameters.go new file mode 100644 index 00000000000..13b82dd658c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_regeneratekeyparameters.go @@ -0,0 +1,8 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyParameters struct { + KeyType *KeyType `json:"keyType,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_resourcelogcategory.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_resourcelogcategory.go new file mode 100644 index 00000000000..d43e44612c0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_resourcelogcategory.go @@ -0,0 +1,9 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceLogCategory struct { + Enabled *string `json:"enabled,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_resourcelogconfiguration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_resourcelogconfiguration.go new file mode 100644 index 00000000000..34bfdaaa1e4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_resourcelogconfiguration.go @@ -0,0 +1,8 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceLogConfiguration struct { + Categories *[]ResourceLogCategory `json:"categories,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_resourcereference.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_resourcereference.go new file mode 100644 index 00000000000..7a2971d96a8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_resourcereference.go @@ -0,0 +1,8 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_resourcesku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_resourcesku.go new file mode 100644 index 00000000000..e05ec7fcdc7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_resourcesku.go @@ -0,0 +1,12 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSku struct { + Capacity *int64 `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name string `json:"name"` + Size *string `json:"size,omitempty"` + Tier *SignalRSkuTier `json:"tier,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_serverlessupstreamsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_serverlessupstreamsettings.go new file mode 100644 index 00000000000..7248ea8446b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_serverlessupstreamsettings.go @@ -0,0 +1,8 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerlessUpstreamSettings struct { + Templates *[]UpstreamTemplate `json:"templates,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_shareableprivatelinkresourceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_shareableprivatelinkresourceproperties.go new file mode 100644 index 00000000000..acc48625575 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_shareableprivatelinkresourceproperties.go @@ -0,0 +1,10 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ShareablePrivateLinkResourceProperties struct { + Description *string `json:"description,omitempty"` + GroupId *string `json:"groupId,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_shareableprivatelinkresourcetype.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_shareableprivatelinkresourcetype.go new file mode 100644 index 00000000000..18407d00fe3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_shareableprivatelinkresourcetype.go @@ -0,0 +1,9 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ShareablePrivateLinkResourceType struct { + Name *string `json:"name,omitempty"` + Properties *ShareablePrivateLinkResourceProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_sharedprivatelinkresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_sharedprivatelinkresource.go new file mode 100644 index 00000000000..6c5aab1998b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_sharedprivatelinkresource.go @@ -0,0 +1,16 @@ +package signalr + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedPrivateLinkResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SharedPrivateLinkResourceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_sharedprivatelinkresourceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_sharedprivatelinkresourceproperties.go new file mode 100644 index 00000000000..425fbc50526 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_sharedprivatelinkresourceproperties.go @@ -0,0 +1,12 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SharedPrivateLinkResourceProperties struct { + GroupId string `json:"groupId"` + PrivateLinkResourceId string `json:"privateLinkResourceId"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RequestMessage *string `json:"requestMessage,omitempty"` + Status *SharedPrivateLinkResourceStatus `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrcorssettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrcorssettings.go new file mode 100644 index 00000000000..aa046d4b367 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrcorssettings.go @@ -0,0 +1,8 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SignalRCorsSettings struct { + AllowedOrigins *[]string `json:"allowedOrigins,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrfeature.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrfeature.go new file mode 100644 index 00000000000..506f4ec0e67 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrfeature.go @@ -0,0 +1,10 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SignalRFeature struct { + Flag FeatureFlags `json:"flag"` + Properties *map[string]string `json:"properties,omitempty"` + Value string `json:"value"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrkeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrkeys.go new file mode 100644 index 00000000000..70821e28a59 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrkeys.go @@ -0,0 +1,11 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SignalRKeys struct { + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrnetworkacls.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrnetworkacls.go new file mode 100644 index 00000000000..05050a335b8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrnetworkacls.go @@ -0,0 +1,10 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SignalRNetworkACLs struct { + DefaultAction *ACLAction `json:"defaultAction,omitempty"` + PrivateEndpoints *[]PrivateEndpointACL `json:"privateEndpoints,omitempty"` + PublicNetwork *NetworkACL `json:"publicNetwork,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrproperties.go new file mode 100644 index 00000000000..39d0b709f8b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrproperties.go @@ -0,0 +1,26 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SignalRProperties struct { + Cors *SignalRCorsSettings `json:"cors,omitempty"` + DisableAadAuth *bool `json:"disableAadAuth,omitempty"` + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + ExternalIP *string `json:"externalIP,omitempty"` + Features *[]SignalRFeature `json:"features,omitempty"` + HostName *string `json:"hostName,omitempty"` + HostNamePrefix *string `json:"hostNamePrefix,omitempty"` + LiveTraceConfiguration *LiveTraceConfiguration `json:"liveTraceConfiguration,omitempty"` + NetworkACLs *SignalRNetworkACLs `json:"networkACLs,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess *string `json:"publicNetworkAccess,omitempty"` + PublicPort *int64 `json:"publicPort,omitempty"` + ResourceLogConfiguration *ResourceLogConfiguration `json:"resourceLogConfiguration,omitempty"` + ServerPort *int64 `json:"serverPort,omitempty"` + SharedPrivateLinkResources *[]SharedPrivateLinkResource `json:"sharedPrivateLinkResources,omitempty"` + Tls *SignalRTlsSettings `json:"tls,omitempty"` + Upstream *ServerlessUpstreamSettings `json:"upstream,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrresource.go new file mode 100644 index 00000000000..cb8f23323bf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrresource.go @@ -0,0 +1,22 @@ +package signalr + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SignalRResource struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemOrUserAssignedMap `json:"identity,omitempty"` + Kind *ServiceKind `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SignalRProperties `json:"properties,omitempty"` + Sku *ResourceSku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrtlssettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrtlssettings.go new file mode 100644 index 00000000000..94dbfbda5e6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrtlssettings.go @@ -0,0 +1,8 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SignalRTlsSettings struct { + ClientCertEnabled *bool `json:"clientCertEnabled,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrusage.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrusage.go new file mode 100644 index 00000000000..2bd863e5aff --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrusage.go @@ -0,0 +1,12 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SignalRUsage struct { + CurrentValue *int64 `json:"currentValue,omitempty"` + Id *string `json:"id,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Name *SignalRUsageName `json:"name,omitempty"` + Unit *string `json:"unit,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrusagename.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrusagename.go new file mode 100644 index 00000000000..f9a475cc7c1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_signalrusagename.go @@ -0,0 +1,9 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SignalRUsageName struct { + LocalizedValue *string `json:"localizedValue,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_sku.go new file mode 100644 index 00000000000..0b2efca5d62 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_sku.go @@ -0,0 +1,10 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *SkuCapacity `json:"capacity,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + Sku *ResourceSku `json:"sku,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_skucapacity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_skucapacity.go new file mode 100644 index 00000000000..3ac0d557740 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_skucapacity.go @@ -0,0 +1,12 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuCapacity struct { + AllowedValues *[]int64 `json:"allowedValues,omitempty"` + Default *int64 `json:"default,omitempty"` + Maximum *int64 `json:"maximum,omitempty"` + Minimum *int64 `json:"minimum,omitempty"` + ScaleType *ScaleType `json:"scaleType,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_skulist.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_skulist.go new file mode 100644 index 00000000000..70410fb96c8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_skulist.go @@ -0,0 +1,9 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuList struct { + NextLink *string `json:"nextLink,omitempty"` + Value *[]Sku `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_upstreamauthsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_upstreamauthsettings.go new file mode 100644 index 00000000000..e5418bfaecf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_upstreamauthsettings.go @@ -0,0 +1,9 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpstreamAuthSettings struct { + ManagedIdentity *ManagedIdentitySettings `json:"managedIdentity,omitempty"` + Type *UpstreamAuthType `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_upstreamtemplate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_upstreamtemplate.go new file mode 100644 index 00000000000..476b1dd7cde --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/model_upstreamtemplate.go @@ -0,0 +1,12 @@ +package signalr + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpstreamTemplate struct { + Auth *UpstreamAuthSettings `json:"auth,omitempty"` + CategoryPattern *string `json:"categoryPattern,omitempty"` + EventPattern *string `json:"eventPattern,omitempty"` + HubPattern *string `json:"hubPattern,omitempty"` + UrlTemplate string `json:"urlTemplate"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/predicates.go new file mode 100644 index 00000000000..e99a7eefcbb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/predicates.go @@ -0,0 +1,172 @@ +package signalr + +type CustomCertificateOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p CustomCertificateOperationPredicate) Matches(input CustomCertificate) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type CustomDomainOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p CustomDomainOperationPredicate) Matches(input CustomDomain) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type PrivateEndpointConnectionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p PrivateEndpointConnectionOperationPredicate) Matches(input PrivateEndpointConnection) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type PrivateLinkResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p PrivateLinkResourceOperationPredicate) Matches(input PrivateLinkResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type SharedPrivateLinkResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p SharedPrivateLinkResourceOperationPredicate) Matches(input SharedPrivateLinkResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type SignalRResourceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p SignalRResourceOperationPredicate) Matches(input SignalRResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} + +type SignalRUsageOperationPredicate struct { + CurrentValue *int64 + Id *string + Limit *int64 + Unit *string +} + +func (p SignalRUsageOperationPredicate) Matches(input SignalRUsage) bool { + + if p.CurrentValue != nil && (input.CurrentValue == nil && *p.CurrentValue != *input.CurrentValue) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Limit != nil && (input.Limit == nil && *p.Limit != *input.Limit) { + return false + } + + if p.Unit != nil && (input.Unit == nil && *p.Unit != *input.Unit) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/version.go new file mode 100644 index 00000000000..7ee51955822 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr/version.go @@ -0,0 +1,12 @@ +package signalr + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-02-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/signalr/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/README.md new file mode 100644 index 00000000000..9a487f25458 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/README.md @@ -0,0 +1,157 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines` Documentation + +The `sqlvirtualmachines` SDK allows for interaction with the Azure Resource Manager Service `sqlvirtualmachine` (API Version `2022-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines" +``` + + +### Client Initialization + +```go +client := sqlvirtualmachines.NewSqlVirtualMachinesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SqlVirtualMachinesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := sqlvirtualmachines.NewSqlVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sqlVirtualMachineValue") + +payload := sqlvirtualmachines.SqlVirtualMachine{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SqlVirtualMachinesClient.Delete` + +```go +ctx := context.TODO() +id := sqlvirtualmachines.NewSqlVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sqlVirtualMachineValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SqlVirtualMachinesClient.Get` + +```go +ctx := context.TODO() +id := sqlvirtualmachines.NewSqlVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sqlVirtualMachineValue") + +read, err := client.Get(ctx, id, sqlvirtualmachines.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SqlVirtualMachinesClient.List` + +```go +ctx := context.TODO() +id := sqlvirtualmachines.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SqlVirtualMachinesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := sqlvirtualmachines.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SqlVirtualMachinesClient.ListBySqlVmGroup` + +```go +ctx := context.TODO() +id := sqlvirtualmachines.NewSqlVirtualMachineGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sqlVirtualMachineGroupValue") + +// alternatively `client.ListBySqlVmGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListBySqlVmGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SqlVirtualMachinesClient.Redeploy` + +```go +ctx := context.TODO() +id := sqlvirtualmachines.NewSqlVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sqlVirtualMachineValue") + +if err := client.RedeployThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SqlVirtualMachinesClient.StartAssessment` + +```go +ctx := context.TODO() +id := sqlvirtualmachines.NewSqlVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sqlVirtualMachineValue") + +if err := client.StartAssessmentThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SqlVirtualMachinesClient.Update` + +```go +ctx := context.TODO() +id := sqlvirtualmachines.NewSqlVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sqlVirtualMachineValue") + +payload := sqlvirtualmachines.SqlVirtualMachineUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/client.go new file mode 100644 index 00000000000..3ef65baa033 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/client.go @@ -0,0 +1,18 @@ +package sqlvirtualmachines + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SqlVirtualMachinesClient struct { + Client autorest.Client + baseUri string +} + +func NewSqlVirtualMachinesClientWithBaseURI(endpoint string) SqlVirtualMachinesClient { + return SqlVirtualMachinesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/constants.go new file mode 100644 index 00000000000..8d1f12b1d9f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/constants.go @@ -0,0 +1,417 @@ +package sqlvirtualmachines + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssessmentDayOfWeek string + +const ( + AssessmentDayOfWeekFriday AssessmentDayOfWeek = "Friday" + AssessmentDayOfWeekMonday AssessmentDayOfWeek = "Monday" + AssessmentDayOfWeekSaturday AssessmentDayOfWeek = "Saturday" + AssessmentDayOfWeekSunday AssessmentDayOfWeek = "Sunday" + AssessmentDayOfWeekThursday AssessmentDayOfWeek = "Thursday" + AssessmentDayOfWeekTuesday AssessmentDayOfWeek = "Tuesday" + AssessmentDayOfWeekWednesday AssessmentDayOfWeek = "Wednesday" +) + +func PossibleValuesForAssessmentDayOfWeek() []string { + return []string{ + string(AssessmentDayOfWeekFriday), + string(AssessmentDayOfWeekMonday), + string(AssessmentDayOfWeekSaturday), + string(AssessmentDayOfWeekSunday), + string(AssessmentDayOfWeekThursday), + string(AssessmentDayOfWeekTuesday), + string(AssessmentDayOfWeekWednesday), + } +} + +func parseAssessmentDayOfWeek(input string) (*AssessmentDayOfWeek, error) { + vals := map[string]AssessmentDayOfWeek{ + "friday": AssessmentDayOfWeekFriday, + "monday": AssessmentDayOfWeekMonday, + "saturday": AssessmentDayOfWeekSaturday, + "sunday": AssessmentDayOfWeekSunday, + "thursday": AssessmentDayOfWeekThursday, + "tuesday": AssessmentDayOfWeekTuesday, + "wednesday": AssessmentDayOfWeekWednesday, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AssessmentDayOfWeek(input) + return &out, nil +} + +type AutoBackupDaysOfWeek string + +const ( + AutoBackupDaysOfWeekFriday AutoBackupDaysOfWeek = "Friday" + AutoBackupDaysOfWeekMonday AutoBackupDaysOfWeek = "Monday" + AutoBackupDaysOfWeekSaturday AutoBackupDaysOfWeek = "Saturday" + AutoBackupDaysOfWeekSunday AutoBackupDaysOfWeek = "Sunday" + AutoBackupDaysOfWeekThursday AutoBackupDaysOfWeek = "Thursday" + AutoBackupDaysOfWeekTuesday AutoBackupDaysOfWeek = "Tuesday" + AutoBackupDaysOfWeekWednesday AutoBackupDaysOfWeek = "Wednesday" +) + +func PossibleValuesForAutoBackupDaysOfWeek() []string { + return []string{ + string(AutoBackupDaysOfWeekFriday), + string(AutoBackupDaysOfWeekMonday), + string(AutoBackupDaysOfWeekSaturday), + string(AutoBackupDaysOfWeekSunday), + string(AutoBackupDaysOfWeekThursday), + string(AutoBackupDaysOfWeekTuesday), + string(AutoBackupDaysOfWeekWednesday), + } +} + +func parseAutoBackupDaysOfWeek(input string) (*AutoBackupDaysOfWeek, error) { + vals := map[string]AutoBackupDaysOfWeek{ + "friday": AutoBackupDaysOfWeekFriday, + "monday": AutoBackupDaysOfWeekMonday, + "saturday": AutoBackupDaysOfWeekSaturday, + "sunday": AutoBackupDaysOfWeekSunday, + "thursday": AutoBackupDaysOfWeekThursday, + "tuesday": AutoBackupDaysOfWeekTuesday, + "wednesday": AutoBackupDaysOfWeekWednesday, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutoBackupDaysOfWeek(input) + return &out, nil +} + +type BackupScheduleType string + +const ( + BackupScheduleTypeAutomated BackupScheduleType = "Automated" + BackupScheduleTypeManual BackupScheduleType = "Manual" +) + +func PossibleValuesForBackupScheduleType() []string { + return []string{ + string(BackupScheduleTypeAutomated), + string(BackupScheduleTypeManual), + } +} + +func parseBackupScheduleType(input string) (*BackupScheduleType, error) { + vals := map[string]BackupScheduleType{ + "automated": BackupScheduleTypeAutomated, + "manual": BackupScheduleTypeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BackupScheduleType(input) + return &out, nil +} + +type ConnectivityType string + +const ( + ConnectivityTypeLOCAL ConnectivityType = "LOCAL" + ConnectivityTypePRIVATE ConnectivityType = "PRIVATE" + ConnectivityTypePUBLIC ConnectivityType = "PUBLIC" +) + +func PossibleValuesForConnectivityType() []string { + return []string{ + string(ConnectivityTypeLOCAL), + string(ConnectivityTypePRIVATE), + string(ConnectivityTypePUBLIC), + } +} + +func parseConnectivityType(input string) (*ConnectivityType, error) { + vals := map[string]ConnectivityType{ + "local": ConnectivityTypeLOCAL, + "private": ConnectivityTypePRIVATE, + "public": ConnectivityTypePUBLIC, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConnectivityType(input) + return &out, nil +} + +type DayOfWeek string + +const ( + DayOfWeekEveryday DayOfWeek = "Everyday" + DayOfWeekFriday DayOfWeek = "Friday" + DayOfWeekMonday DayOfWeek = "Monday" + DayOfWeekSaturday DayOfWeek = "Saturday" + DayOfWeekSunday DayOfWeek = "Sunday" + DayOfWeekThursday DayOfWeek = "Thursday" + DayOfWeekTuesday DayOfWeek = "Tuesday" + DayOfWeekWednesday DayOfWeek = "Wednesday" +) + +func PossibleValuesForDayOfWeek() []string { + return []string{ + string(DayOfWeekEveryday), + string(DayOfWeekFriday), + string(DayOfWeekMonday), + string(DayOfWeekSaturday), + string(DayOfWeekSunday), + string(DayOfWeekThursday), + string(DayOfWeekTuesday), + string(DayOfWeekWednesday), + } +} + +func parseDayOfWeek(input string) (*DayOfWeek, error) { + vals := map[string]DayOfWeek{ + "everyday": DayOfWeekEveryday, + "friday": DayOfWeekFriday, + "monday": DayOfWeekMonday, + "saturday": DayOfWeekSaturday, + "sunday": DayOfWeekSunday, + "thursday": DayOfWeekThursday, + "tuesday": DayOfWeekTuesday, + "wednesday": DayOfWeekWednesday, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DayOfWeek(input) + return &out, nil +} + +type DiskConfigurationType string + +const ( + DiskConfigurationTypeADD DiskConfigurationType = "ADD" + DiskConfigurationTypeEXTEND DiskConfigurationType = "EXTEND" + DiskConfigurationTypeNEW DiskConfigurationType = "NEW" +) + +func PossibleValuesForDiskConfigurationType() []string { + return []string{ + string(DiskConfigurationTypeADD), + string(DiskConfigurationTypeEXTEND), + string(DiskConfigurationTypeNEW), + } +} + +func parseDiskConfigurationType(input string) (*DiskConfigurationType, error) { + vals := map[string]DiskConfigurationType{ + "add": DiskConfigurationTypeADD, + "extend": DiskConfigurationTypeEXTEND, + "new": DiskConfigurationTypeNEW, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskConfigurationType(input) + return &out, nil +} + +type FullBackupFrequencyType string + +const ( + FullBackupFrequencyTypeDaily FullBackupFrequencyType = "Daily" + FullBackupFrequencyTypeWeekly FullBackupFrequencyType = "Weekly" +) + +func PossibleValuesForFullBackupFrequencyType() []string { + return []string{ + string(FullBackupFrequencyTypeDaily), + string(FullBackupFrequencyTypeWeekly), + } +} + +func parseFullBackupFrequencyType(input string) (*FullBackupFrequencyType, error) { + vals := map[string]FullBackupFrequencyType{ + "daily": FullBackupFrequencyTypeDaily, + "weekly": FullBackupFrequencyTypeWeekly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := FullBackupFrequencyType(input) + return &out, nil +} + +type SqlImageSku string + +const ( + SqlImageSkuDeveloper SqlImageSku = "Developer" + SqlImageSkuEnterprise SqlImageSku = "Enterprise" + SqlImageSkuExpress SqlImageSku = "Express" + SqlImageSkuStandard SqlImageSku = "Standard" + SqlImageSkuWeb SqlImageSku = "Web" +) + +func PossibleValuesForSqlImageSku() []string { + return []string{ + string(SqlImageSkuDeveloper), + string(SqlImageSkuEnterprise), + string(SqlImageSkuExpress), + string(SqlImageSkuStandard), + string(SqlImageSkuWeb), + } +} + +func parseSqlImageSku(input string) (*SqlImageSku, error) { + vals := map[string]SqlImageSku{ + "developer": SqlImageSkuDeveloper, + "enterprise": SqlImageSkuEnterprise, + "express": SqlImageSkuExpress, + "standard": SqlImageSkuStandard, + "web": SqlImageSkuWeb, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SqlImageSku(input) + return &out, nil +} + +type SqlManagementMode string + +const ( + SqlManagementModeFull SqlManagementMode = "Full" + SqlManagementModeLightWeight SqlManagementMode = "LightWeight" + SqlManagementModeNoAgent SqlManagementMode = "NoAgent" +) + +func PossibleValuesForSqlManagementMode() []string { + return []string{ + string(SqlManagementModeFull), + string(SqlManagementModeLightWeight), + string(SqlManagementModeNoAgent), + } +} + +func parseSqlManagementMode(input string) (*SqlManagementMode, error) { + vals := map[string]SqlManagementMode{ + "full": SqlManagementModeFull, + "lightweight": SqlManagementModeLightWeight, + "noagent": SqlManagementModeNoAgent, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SqlManagementMode(input) + return &out, nil +} + +type SqlServerLicenseType string + +const ( + SqlServerLicenseTypeAHUB SqlServerLicenseType = "AHUB" + SqlServerLicenseTypeDR SqlServerLicenseType = "DR" + SqlServerLicenseTypePAYG SqlServerLicenseType = "PAYG" +) + +func PossibleValuesForSqlServerLicenseType() []string { + return []string{ + string(SqlServerLicenseTypeAHUB), + string(SqlServerLicenseTypeDR), + string(SqlServerLicenseTypePAYG), + } +} + +func parseSqlServerLicenseType(input string) (*SqlServerLicenseType, error) { + vals := map[string]SqlServerLicenseType{ + "ahub": SqlServerLicenseTypeAHUB, + "dr": SqlServerLicenseTypeDR, + "payg": SqlServerLicenseTypePAYG, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SqlServerLicenseType(input) + return &out, nil +} + +type SqlWorkloadType string + +const ( + SqlWorkloadTypeDW SqlWorkloadType = "DW" + SqlWorkloadTypeGENERAL SqlWorkloadType = "GENERAL" + SqlWorkloadTypeOLTP SqlWorkloadType = "OLTP" +) + +func PossibleValuesForSqlWorkloadType() []string { + return []string{ + string(SqlWorkloadTypeDW), + string(SqlWorkloadTypeGENERAL), + string(SqlWorkloadTypeOLTP), + } +} + +func parseSqlWorkloadType(input string) (*SqlWorkloadType, error) { + vals := map[string]SqlWorkloadType{ + "dw": SqlWorkloadTypeDW, + "general": SqlWorkloadTypeGENERAL, + "oltp": SqlWorkloadTypeOLTP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SqlWorkloadType(input) + return &out, nil +} + +type StorageWorkloadType string + +const ( + StorageWorkloadTypeDW StorageWorkloadType = "DW" + StorageWorkloadTypeGENERAL StorageWorkloadType = "GENERAL" + StorageWorkloadTypeOLTP StorageWorkloadType = "OLTP" +) + +func PossibleValuesForStorageWorkloadType() []string { + return []string{ + string(StorageWorkloadTypeDW), + string(StorageWorkloadTypeGENERAL), + string(StorageWorkloadTypeOLTP), + } +} + +func parseStorageWorkloadType(input string) (*StorageWorkloadType, error) { + vals := map[string]StorageWorkloadType{ + "dw": StorageWorkloadTypeDW, + "general": StorageWorkloadTypeGENERAL, + "oltp": StorageWorkloadTypeOLTP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageWorkloadType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/id_sqlvirtualmachine.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/id_sqlvirtualmachine.go new file mode 100644 index 00000000000..63e3fa17c73 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/id_sqlvirtualmachine.go @@ -0,0 +1,124 @@ +package sqlvirtualmachines + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SqlVirtualMachineId{} + +// SqlVirtualMachineId is a struct representing the Resource ID for a Sql Virtual Machine +type SqlVirtualMachineId struct { + SubscriptionId string + ResourceGroupName string + SqlVirtualMachineName string +} + +// NewSqlVirtualMachineID returns a new SqlVirtualMachineId struct +func NewSqlVirtualMachineID(subscriptionId string, resourceGroupName string, sqlVirtualMachineName string) SqlVirtualMachineId { + return SqlVirtualMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SqlVirtualMachineName: sqlVirtualMachineName, + } +} + +// ParseSqlVirtualMachineID parses 'input' into a SqlVirtualMachineId +func ParseSqlVirtualMachineID(input string) (*SqlVirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(SqlVirtualMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SqlVirtualMachineId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.SqlVirtualMachineName, ok = parsed.Parsed["sqlVirtualMachineName"]; !ok { + return nil, fmt.Errorf("the segment 'sqlVirtualMachineName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSqlVirtualMachineIDInsensitively parses 'input' case-insensitively into a SqlVirtualMachineId +// note: this method should only be used for API response data and not user input +func ParseSqlVirtualMachineIDInsensitively(input string) (*SqlVirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(SqlVirtualMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SqlVirtualMachineId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.SqlVirtualMachineName, ok = parsed.Parsed["sqlVirtualMachineName"]; !ok { + return nil, fmt.Errorf("the segment 'sqlVirtualMachineName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSqlVirtualMachineID checks that 'input' can be parsed as a Sql Virtual Machine ID +func ValidateSqlVirtualMachineID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSqlVirtualMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sql Virtual Machine ID +func (id SqlVirtualMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SqlVirtualMachineName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sql Virtual Machine ID +func (id SqlVirtualMachineId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftSqlVirtualMachine", "Microsoft.SqlVirtualMachine", "Microsoft.SqlVirtualMachine"), + resourceids.StaticSegment("staticSqlVirtualMachines", "sqlVirtualMachines", "sqlVirtualMachines"), + resourceids.UserSpecifiedSegment("sqlVirtualMachineName", "sqlVirtualMachineValue"), + } +} + +// String returns a human-readable description of this Sql Virtual Machine ID +func (id SqlVirtualMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Sql Virtual Machine Name: %q", id.SqlVirtualMachineName), + } + return fmt.Sprintf("Sql Virtual Machine (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/id_sqlvirtualmachinegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/id_sqlvirtualmachinegroup.go new file mode 100644 index 00000000000..7ffca29c7d9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/id_sqlvirtualmachinegroup.go @@ -0,0 +1,124 @@ +package sqlvirtualmachines + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SqlVirtualMachineGroupId{} + +// SqlVirtualMachineGroupId is a struct representing the Resource ID for a Sql Virtual Machine Group +type SqlVirtualMachineGroupId struct { + SubscriptionId string + ResourceGroupName string + SqlVirtualMachineGroupName string +} + +// NewSqlVirtualMachineGroupID returns a new SqlVirtualMachineGroupId struct +func NewSqlVirtualMachineGroupID(subscriptionId string, resourceGroupName string, sqlVirtualMachineGroupName string) SqlVirtualMachineGroupId { + return SqlVirtualMachineGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SqlVirtualMachineGroupName: sqlVirtualMachineGroupName, + } +} + +// ParseSqlVirtualMachineGroupID parses 'input' into a SqlVirtualMachineGroupId +func ParseSqlVirtualMachineGroupID(input string) (*SqlVirtualMachineGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(SqlVirtualMachineGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SqlVirtualMachineGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.SqlVirtualMachineGroupName, ok = parsed.Parsed["sqlVirtualMachineGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'sqlVirtualMachineGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSqlVirtualMachineGroupIDInsensitively parses 'input' case-insensitively into a SqlVirtualMachineGroupId +// note: this method should only be used for API response data and not user input +func ParseSqlVirtualMachineGroupIDInsensitively(input string) (*SqlVirtualMachineGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(SqlVirtualMachineGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SqlVirtualMachineGroupId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.SqlVirtualMachineGroupName, ok = parsed.Parsed["sqlVirtualMachineGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'sqlVirtualMachineGroupName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSqlVirtualMachineGroupID checks that 'input' can be parsed as a Sql Virtual Machine Group ID +func ValidateSqlVirtualMachineGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSqlVirtualMachineGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sql Virtual Machine Group ID +func (id SqlVirtualMachineGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SqlVirtualMachineGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sql Virtual Machine Group ID +func (id SqlVirtualMachineGroupId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftSqlVirtualMachine", "Microsoft.SqlVirtualMachine", "Microsoft.SqlVirtualMachine"), + resourceids.StaticSegment("staticSqlVirtualMachineGroups", "sqlVirtualMachineGroups", "sqlVirtualMachineGroups"), + resourceids.UserSpecifiedSegment("sqlVirtualMachineGroupName", "sqlVirtualMachineGroupValue"), + } +} + +// String returns a human-readable description of this Sql Virtual Machine Group ID +func (id SqlVirtualMachineGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Sql Virtual Machine Group Name: %q", id.SqlVirtualMachineGroupName), + } + return fmt.Sprintf("Sql Virtual Machine Group (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_createorupdate_autorest.go new file mode 100644 index 00000000000..4a2718a8cce --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package sqlvirtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c SqlVirtualMachinesClient) CreateOrUpdate(ctx context.Context, id SqlVirtualMachineId, input SqlVirtualMachine) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c SqlVirtualMachinesClient) CreateOrUpdateThenPoll(ctx context.Context, id SqlVirtualMachineId, input SqlVirtualMachine) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c SqlVirtualMachinesClient) preparerForCreateOrUpdate(ctx context.Context, id SqlVirtualMachineId, input SqlVirtualMachine) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c SqlVirtualMachinesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_delete_autorest.go new file mode 100644 index 00000000000..2d92155074c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_delete_autorest.go @@ -0,0 +1,78 @@ +package sqlvirtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c SqlVirtualMachinesClient) Delete(ctx context.Context, id SqlVirtualMachineId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c SqlVirtualMachinesClient) DeleteThenPoll(ctx context.Context, id SqlVirtualMachineId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c SqlVirtualMachinesClient) preparerForDelete(ctx context.Context, id SqlVirtualMachineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c SqlVirtualMachinesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_get_autorest.go new file mode 100644 index 00000000000..e0beb4ed54a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_get_autorest.go @@ -0,0 +1,97 @@ +package sqlvirtualmachines + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *SqlVirtualMachine +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o GetOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Expand != nil { + out["$expand"] = *o.Expand + } + + return out +} + +// Get ... +func (c SqlVirtualMachinesClient) Get(ctx context.Context, id SqlVirtualMachineId, options GetOperationOptions) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c SqlVirtualMachinesClient) preparerForGet(ctx context.Context, id SqlVirtualMachineId, options GetOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c SqlVirtualMachinesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_list_autorest.go new file mode 100644 index 00000000000..a765feeab37 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_list_autorest.go @@ -0,0 +1,187 @@ +package sqlvirtualmachines + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]SqlVirtualMachine + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []SqlVirtualMachine +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c SqlVirtualMachinesClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c SqlVirtualMachinesClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c SqlVirtualMachinesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c SqlVirtualMachinesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []SqlVirtualMachine `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c SqlVirtualMachinesClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, SqlVirtualMachineOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SqlVirtualMachinesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate SqlVirtualMachineOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]SqlVirtualMachine, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..d500636c970 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_listbyresourcegroup_autorest.go @@ -0,0 +1,187 @@ +package sqlvirtualmachines + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]SqlVirtualMachine + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) +} + +type ListByResourceGroupCompleteResult struct { + Items []SqlVirtualMachine +} + +func (r ListByResourceGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListByResourceGroup ... +func (c SqlVirtualMachinesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListByResourceGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c SqlVirtualMachinesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. +func (c SqlVirtualMachinesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c SqlVirtualMachinesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + type page struct { + Values []SqlVirtualMachine `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListByResourceGroupComplete retrieves all of the results into a single object +func (c SqlVirtualMachinesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, SqlVirtualMachineOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SqlVirtualMachinesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate SqlVirtualMachineOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { + items := make([]SqlVirtualMachine, 0) + + page, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListByResourceGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_listbysqlvmgroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_listbysqlvmgroup_autorest.go new file mode 100644 index 00000000000..c26c03240c8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_listbysqlvmgroup_autorest.go @@ -0,0 +1,186 @@ +package sqlvirtualmachines + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySqlVmGroupOperationResponse struct { + HttpResponse *http.Response + Model *[]SqlVirtualMachine + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListBySqlVmGroupOperationResponse, error) +} + +type ListBySqlVmGroupCompleteResult struct { + Items []SqlVirtualMachine +} + +func (r ListBySqlVmGroupOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListBySqlVmGroupOperationResponse) LoadMore(ctx context.Context) (resp ListBySqlVmGroupOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// ListBySqlVmGroup ... +func (c SqlVirtualMachinesClient) ListBySqlVmGroup(ctx context.Context, id SqlVirtualMachineGroupId) (resp ListBySqlVmGroupOperationResponse, err error) { + req, err := c.preparerForListBySqlVmGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "ListBySqlVmGroup", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "ListBySqlVmGroup", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForListBySqlVmGroup(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "ListBySqlVmGroup", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForListBySqlVmGroup prepares the ListBySqlVmGroup request. +func (c SqlVirtualMachinesClient) preparerForListBySqlVmGroup(ctx context.Context, id SqlVirtualMachineGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/sqlVirtualMachines", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListBySqlVmGroupWithNextLink prepares the ListBySqlVmGroup request with the given nextLink token. +func (c SqlVirtualMachinesClient) preparerForListBySqlVmGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySqlVmGroup handles the response to the ListBySqlVmGroup request. The method always +// closes the http.Response Body. +func (c SqlVirtualMachinesClient) responderForListBySqlVmGroup(resp *http.Response) (result ListBySqlVmGroupOperationResponse, err error) { + type page struct { + Values []SqlVirtualMachine `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySqlVmGroupOperationResponse, err error) { + req, err := c.preparerForListBySqlVmGroupWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "ListBySqlVmGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "ListBySqlVmGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySqlVmGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "ListBySqlVmGroup", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListBySqlVmGroupComplete retrieves all of the results into a single object +func (c SqlVirtualMachinesClient) ListBySqlVmGroupComplete(ctx context.Context, id SqlVirtualMachineGroupId) (ListBySqlVmGroupCompleteResult, error) { + return c.ListBySqlVmGroupCompleteMatchingPredicate(ctx, id, SqlVirtualMachineOperationPredicate{}) +} + +// ListBySqlVmGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c SqlVirtualMachinesClient) ListBySqlVmGroupCompleteMatchingPredicate(ctx context.Context, id SqlVirtualMachineGroupId, predicate SqlVirtualMachineOperationPredicate) (resp ListBySqlVmGroupCompleteResult, err error) { + items := make([]SqlVirtualMachine, 0) + + page, err := c.ListBySqlVmGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListBySqlVmGroupCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_redeploy_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_redeploy_autorest.go new file mode 100644 index 00000000000..742e4a8c959 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_redeploy_autorest.go @@ -0,0 +1,78 @@ +package sqlvirtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RedeployOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Redeploy ... +func (c SqlVirtualMachinesClient) Redeploy(ctx context.Context, id SqlVirtualMachineId) (result RedeployOperationResponse, err error) { + req, err := c.preparerForRedeploy(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "Redeploy", nil, "Failure preparing request") + return + } + + result, err = c.senderForRedeploy(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "Redeploy", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// RedeployThenPoll performs Redeploy then polls until it's completed +func (c SqlVirtualMachinesClient) RedeployThenPoll(ctx context.Context, id SqlVirtualMachineId) error { + result, err := c.Redeploy(ctx, id) + if err != nil { + return fmt.Errorf("performing Redeploy: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Redeploy: %+v", err) + } + + return nil +} + +// preparerForRedeploy prepares the Redeploy request. +func (c SqlVirtualMachinesClient) preparerForRedeploy(ctx context.Context, id SqlVirtualMachineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/redeploy", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForRedeploy sends the Redeploy request. The method will close the +// http.Response Body if it receives an error. +func (c SqlVirtualMachinesClient) senderForRedeploy(ctx context.Context, req *http.Request) (future RedeployOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_startassessment_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_startassessment_autorest.go new file mode 100644 index 00000000000..aa095cd8f6b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_startassessment_autorest.go @@ -0,0 +1,78 @@ +package sqlvirtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StartAssessmentOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// StartAssessment ... +func (c SqlVirtualMachinesClient) StartAssessment(ctx context.Context, id SqlVirtualMachineId) (result StartAssessmentOperationResponse, err error) { + req, err := c.preparerForStartAssessment(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "StartAssessment", nil, "Failure preparing request") + return + } + + result, err = c.senderForStartAssessment(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "StartAssessment", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// StartAssessmentThenPoll performs StartAssessment then polls until it's completed +func (c SqlVirtualMachinesClient) StartAssessmentThenPoll(ctx context.Context, id SqlVirtualMachineId) error { + result, err := c.StartAssessment(ctx, id) + if err != nil { + return fmt.Errorf("performing StartAssessment: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after StartAssessment: %+v", err) + } + + return nil +} + +// preparerForStartAssessment prepares the StartAssessment request. +func (c SqlVirtualMachinesClient) preparerForStartAssessment(ctx context.Context, id SqlVirtualMachineId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/startAssessment", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForStartAssessment sends the StartAssessment request. The method will close the +// http.Response Body if it receives an error. +func (c SqlVirtualMachinesClient) senderForStartAssessment(ctx context.Context, req *http.Request) (future StartAssessmentOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_update_autorest.go new file mode 100644 index 00000000000..4bac54bbc3b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/method_update_autorest.go @@ -0,0 +1,79 @@ +package sqlvirtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c SqlVirtualMachinesClient) Update(ctx context.Context, id SqlVirtualMachineId, input SqlVirtualMachineUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "sqlvirtualmachines.SqlVirtualMachinesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c SqlVirtualMachinesClient) UpdateThenPoll(ctx context.Context, id SqlVirtualMachineId, input SqlVirtualMachineUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c SqlVirtualMachinesClient) preparerForUpdate(ctx context.Context, id SqlVirtualMachineId, input SqlVirtualMachineUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c SqlVirtualMachinesClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_additionalfeaturesserverconfigurations.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_additionalfeaturesserverconfigurations.go new file mode 100644 index 00000000000..8f469a40bda --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_additionalfeaturesserverconfigurations.go @@ -0,0 +1,8 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalFeaturesServerConfigurations struct { + IsRServicesEnabled *bool `json:"isRServicesEnabled,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_assessmentsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_assessmentsettings.go new file mode 100644 index 00000000000..5f36ba97057 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_assessmentsettings.go @@ -0,0 +1,10 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssessmentSettings struct { + Enable *bool `json:"enable,omitempty"` + RunImmediately *bool `json:"runImmediately,omitempty"` + Schedule *Schedule `json:"schedule,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_autobackupsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_autobackupsettings.go new file mode 100644 index 00000000000..250c4f55347 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_autobackupsettings.go @@ -0,0 +1,21 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutoBackupSettings struct { + BackupScheduleType *BackupScheduleType `json:"backupScheduleType,omitempty"` + BackupSystemDbs *bool `json:"backupSystemDbs,omitempty"` + DaysOfWeek *[]AutoBackupDaysOfWeek `json:"daysOfWeek,omitempty"` + Enable *bool `json:"enable,omitempty"` + EnableEncryption *bool `json:"enableEncryption,omitempty"` + FullBackupFrequency *FullBackupFrequencyType `json:"fullBackupFrequency,omitempty"` + FullBackupStartTime *int64 `json:"fullBackupStartTime,omitempty"` + FullBackupWindowHours *int64 `json:"fullBackupWindowHours,omitempty"` + LogBackupFrequency *int64 `json:"logBackupFrequency,omitempty"` + Password *string `json:"password,omitempty"` + RetentionPeriod *int64 `json:"retentionPeriod,omitempty"` + StorageAccessKey *string `json:"storageAccessKey,omitempty"` + StorageAccountUrl *string `json:"storageAccountUrl,omitempty"` + StorageContainerName *string `json:"storageContainerName,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_autopatchingsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_autopatchingsettings.go new file mode 100644 index 00000000000..b806f14e493 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_autopatchingsettings.go @@ -0,0 +1,11 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutoPatchingSettings struct { + DayOfWeek *DayOfWeek `json:"dayOfWeek,omitempty"` + Enable *bool `json:"enable,omitempty"` + MaintenanceWindowDuration *int64 `json:"maintenanceWindowDuration,omitempty"` + MaintenanceWindowStartingHour *int64 `json:"maintenanceWindowStartingHour,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_keyvaultcredentialsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_keyvaultcredentialsettings.go new file mode 100644 index 00000000000..e5407cb7381 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_keyvaultcredentialsettings.go @@ -0,0 +1,12 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultCredentialSettings struct { + AzureKeyVaultUrl *string `json:"azureKeyVaultUrl,omitempty"` + CredentialName *string `json:"credentialName,omitempty"` + Enable *bool `json:"enable,omitempty"` + ServicePrincipalName *string `json:"servicePrincipalName,omitempty"` + ServicePrincipalSecret *string `json:"servicePrincipalSecret,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_schedule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_schedule.go new file mode 100644 index 00000000000..daf17d8673a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_schedule.go @@ -0,0 +1,12 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Schedule struct { + DayOfWeek *AssessmentDayOfWeek `json:"dayOfWeek,omitempty"` + Enable *bool `json:"enable,omitempty"` + MonthlyOccurrence *int64 `json:"monthlyOccurrence,omitempty"` + StartTime *string `json:"startTime,omitempty"` + WeeklyInterval *int64 `json:"weeklyInterval,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_serverconfigurationsmanagementsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_serverconfigurationsmanagementsettings.go new file mode 100644 index 00000000000..2fed73a9736 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_serverconfigurationsmanagementsettings.go @@ -0,0 +1,12 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServerConfigurationsManagementSettings struct { + AdditionalFeaturesServerConfigurations *AdditionalFeaturesServerConfigurations `json:"additionalFeaturesServerConfigurations,omitempty"` + SqlConnectivityUpdateSettings *SqlConnectivityUpdateSettings `json:"sqlConnectivityUpdateSettings,omitempty"` + SqlInstanceSettings *SQLInstanceSettings `json:"sqlInstanceSettings,omitempty"` + SqlStorageUpdateSettings *SqlStorageUpdateSettings `json:"sqlStorageUpdateSettings,omitempty"` + SqlWorkloadTypeUpdateSettings *SqlWorkloadTypeUpdateSettings `json:"sqlWorkloadTypeUpdateSettings,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlconnectivityupdatesettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlconnectivityupdatesettings.go new file mode 100644 index 00000000000..fd63d6e4fc1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlconnectivityupdatesettings.go @@ -0,0 +1,11 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SqlConnectivityUpdateSettings struct { + ConnectivityType *ConnectivityType `json:"connectivityType,omitempty"` + Port *int64 `json:"port,omitempty"` + SqlAuthUpdatePassword *string `json:"sqlAuthUpdatePassword,omitempty"` + SqlAuthUpdateUserName *string `json:"sqlAuthUpdateUserName,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlinstancesettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlinstancesettings.go new file mode 100644 index 00000000000..b6da449b41d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlinstancesettings.go @@ -0,0 +1,14 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SQLInstanceSettings struct { + Collation *string `json:"collation,omitempty"` + IsIfiEnabled *bool `json:"isIfiEnabled,omitempty"` + IsLpimEnabled *bool `json:"isLpimEnabled,omitempty"` + IsOptimizeForAdHocWorkloadsEnabled *bool `json:"isOptimizeForAdHocWorkloadsEnabled,omitempty"` + MaxDop *int64 `json:"maxDop,omitempty"` + MaxServerMemoryMB *int64 `json:"maxServerMemoryMB,omitempty"` + MinServerMemoryMB *int64 `json:"minServerMemoryMB,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlstoragesettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlstoragesettings.go new file mode 100644 index 00000000000..35834170e43 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlstoragesettings.go @@ -0,0 +1,9 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SQLStorageSettings struct { + DefaultFilePath *string `json:"defaultFilePath,omitempty"` + Luns *[]int64 `json:"luns,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlstorageupdatesettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlstorageupdatesettings.go new file mode 100644 index 00000000000..a5186fd3711 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlstorageupdatesettings.go @@ -0,0 +1,10 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SqlStorageUpdateSettings struct { + DiskConfigurationType *DiskConfigurationType `json:"diskConfigurationType,omitempty"` + DiskCount *int64 `json:"diskCount,omitempty"` + StartingDeviceId *int64 `json:"startingDeviceId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqltempdbsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqltempdbsettings.go new file mode 100644 index 00000000000..8d2805d7d04 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqltempdbsettings.go @@ -0,0 +1,16 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SQLTempDbSettings struct { + DataFileCount *int64 `json:"dataFileCount,omitempty"` + DataFileSize *int64 `json:"dataFileSize,omitempty"` + DataGrowth *int64 `json:"dataGrowth,omitempty"` + DefaultFilePath *string `json:"defaultFilePath,omitempty"` + LogFileSize *int64 `json:"logFileSize,omitempty"` + LogGrowth *int64 `json:"logGrowth,omitempty"` + Luns *[]int64 `json:"luns,omitempty"` + PersistFolder *bool `json:"persistFolder,omitempty"` + PersistFolderPath *string `json:"persistFolderPath,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlvirtualmachine.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlvirtualmachine.go new file mode 100644 index 00000000000..ce1f470b893 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlvirtualmachine.go @@ -0,0 +1,20 @@ +package sqlvirtualmachines + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SqlVirtualMachine struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *SqlVirtualMachineProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlvirtualmachineproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlvirtualmachineproperties.go new file mode 100644 index 00000000000..dcfedd2aaa1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlvirtualmachineproperties.go @@ -0,0 +1,22 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SqlVirtualMachineProperties struct { + AssessmentSettings *AssessmentSettings `json:"assessmentSettings,omitempty"` + AutoBackupSettings *AutoBackupSettings `json:"autoBackupSettings,omitempty"` + AutoPatchingSettings *AutoPatchingSettings `json:"autoPatchingSettings,omitempty"` + KeyVaultCredentialSettings *KeyVaultCredentialSettings `json:"keyVaultCredentialSettings,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ServerConfigurationsManagementSettings *ServerConfigurationsManagementSettings `json:"serverConfigurationsManagementSettings,omitempty"` + SqlImageOffer *string `json:"sqlImageOffer,omitempty"` + SqlImageSku *SqlImageSku `json:"sqlImageSku,omitempty"` + SqlManagement *SqlManagementMode `json:"sqlManagement,omitempty"` + SqlServerLicenseType *SqlServerLicenseType `json:"sqlServerLicenseType,omitempty"` + SqlVirtualMachineGroupResourceId *string `json:"sqlVirtualMachineGroupResourceId,omitempty"` + StorageConfigurationSettings *StorageConfigurationSettings `json:"storageConfigurationSettings,omitempty"` + VirtualMachineResourceId *string `json:"virtualMachineResourceId,omitempty"` + WsfcDomainCredentials *WsfcDomainCredentials `json:"wsfcDomainCredentials,omitempty"` + WsfcStaticIP *string `json:"wsfcStaticIp,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlvirtualmachineupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlvirtualmachineupdate.go new file mode 100644 index 00000000000..b02b09b0aaa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlvirtualmachineupdate.go @@ -0,0 +1,8 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SqlVirtualMachineUpdate struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlworkloadtypeupdatesettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlworkloadtypeupdatesettings.go new file mode 100644 index 00000000000..118f0cf2f1f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_sqlworkloadtypeupdatesettings.go @@ -0,0 +1,8 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SqlWorkloadTypeUpdateSettings struct { + SqlWorkloadType *SqlWorkloadType `json:"sqlWorkloadType,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_storageconfigurationsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_storageconfigurationsettings.go new file mode 100644 index 00000000000..411be81ea52 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_storageconfigurationsettings.go @@ -0,0 +1,13 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageConfigurationSettings struct { + DiskConfigurationType *DiskConfigurationType `json:"diskConfigurationType,omitempty"` + SqlDataSettings *SQLStorageSettings `json:"sqlDataSettings,omitempty"` + SqlLogSettings *SQLStorageSettings `json:"sqlLogSettings,omitempty"` + SqlSystemDbOnDataDisk *bool `json:"sqlSystemDbOnDataDisk,omitempty"` + SqlTempDbSettings *SQLTempDbSettings `json:"sqlTempDbSettings,omitempty"` + StorageWorkloadType *StorageWorkloadType `json:"storageWorkloadType,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_wsfcdomaincredentials.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_wsfcdomaincredentials.go new file mode 100644 index 00000000000..abefce4cde6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/model_wsfcdomaincredentials.go @@ -0,0 +1,10 @@ +package sqlvirtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WsfcDomainCredentials struct { + ClusterBootstrapAccountPassword *string `json:"clusterBootstrapAccountPassword,omitempty"` + ClusterOperatorAccountPassword *string `json:"clusterOperatorAccountPassword,omitempty"` + SqlServiceAccountPassword *string `json:"sqlServiceAccountPassword,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/predicates.go new file mode 100644 index 00000000000..aebf91be722 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/predicates.go @@ -0,0 +1,29 @@ +package sqlvirtualmachines + +type SqlVirtualMachineOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p SqlVirtualMachineOperationPredicate) Matches(input SqlVirtualMachine) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/version.go new file mode 100644 index 00000000000..88a926cafa3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/version.go @@ -0,0 +1,12 @@ +package sqlvirtualmachines + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-02-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/sqlvirtualmachines/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/README.md new file mode 100644 index 00000000000..f317f67ddbb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/README.md @@ -0,0 +1,89 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies` Documentation + +The `objectreplicationpolicies` SDK allows for interaction with the Azure Resource Manager Service `storage` (API Version `2021-04-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies" +``` + + +### Client Initialization + +```go +client := objectreplicationpolicies.NewObjectReplicationPoliciesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ObjectReplicationPoliciesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := objectreplicationpolicies.NewObjectReplicationPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "objectReplicationPolicyIdValue") + +payload := objectreplicationpolicies.ObjectReplicationPolicy{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ObjectReplicationPoliciesClient.Delete` + +```go +ctx := context.TODO() +id := objectreplicationpolicies.NewObjectReplicationPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "objectReplicationPolicyIdValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ObjectReplicationPoliciesClient.Get` + +```go +ctx := context.TODO() +id := objectreplicationpolicies.NewObjectReplicationPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "objectReplicationPolicyIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ObjectReplicationPoliciesClient.List` + +```go +ctx := context.TODO() +id := objectreplicationpolicies.NewStorageAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/client.go new file mode 100644 index 00000000000..d85f5f511ab --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/client.go @@ -0,0 +1,18 @@ +package objectreplicationpolicies + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ObjectReplicationPoliciesClient struct { + Client autorest.Client + baseUri string +} + +func NewObjectReplicationPoliciesClientWithBaseURI(endpoint string) ObjectReplicationPoliciesClient { + return ObjectReplicationPoliciesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/id_objectreplicationpolicies.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/id_objectreplicationpolicies.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/id_objectreplicationpolicies.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/id_objectreplicationpolicies.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/id_storageaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/id_storageaccount.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/id_storageaccount.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/id_storageaccount.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/method_createorupdate_autorest.go new file mode 100644 index 00000000000..c10d3bf1159 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package objectreplicationpolicies + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *ObjectReplicationPolicy +} + +// CreateOrUpdate ... +func (c ObjectReplicationPoliciesClient) CreateOrUpdate(ctx context.Context, id ObjectReplicationPoliciesId, input ObjectReplicationPolicy) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ObjectReplicationPoliciesClient) preparerForCreateOrUpdate(ctx context.Context, id ObjectReplicationPoliciesId, input ObjectReplicationPolicy) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ObjectReplicationPoliciesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/method_delete_autorest.go new file mode 100644 index 00000000000..922a0586bc4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/method_delete_autorest.go @@ -0,0 +1,66 @@ +package objectreplicationpolicies + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ObjectReplicationPoliciesClient) Delete(ctx context.Context, id ObjectReplicationPoliciesId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ObjectReplicationPoliciesClient) preparerForDelete(ctx context.Context, id ObjectReplicationPoliciesId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ObjectReplicationPoliciesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/method_get_autorest.go new file mode 100644 index 00000000000..9dc4b16a2c8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/method_get_autorest.go @@ -0,0 +1,68 @@ +package objectreplicationpolicies + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ObjectReplicationPolicy +} + +// Get ... +func (c ObjectReplicationPoliciesClient) Get(ctx context.Context, id ObjectReplicationPoliciesId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ObjectReplicationPoliciesClient) preparerForGet(ctx context.Context, id ObjectReplicationPoliciesId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ObjectReplicationPoliciesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/method_list_autorest.go new file mode 100644 index 00000000000..75691a3a274 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/method_list_autorest.go @@ -0,0 +1,69 @@ +package objectreplicationpolicies + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *ObjectReplicationPolicies +} + +// List ... +func (c ObjectReplicationPoliciesClient) List(ctx context.Context, id StorageAccountId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c ObjectReplicationPoliciesClient) preparerForList(ctx context.Context, id StorageAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/objectReplicationPolicies", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ObjectReplicationPoliciesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicies.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicies.go new file mode 100644 index 00000000000..e9617fd29cd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicies.go @@ -0,0 +1,8 @@ +package objectreplicationpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ObjectReplicationPolicies struct { + Value *[]ObjectReplicationPolicy `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicy.go new file mode 100644 index 00000000000..5d8e7ab7bc4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicy.go @@ -0,0 +1,11 @@ +package objectreplicationpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ObjectReplicationPolicy struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ObjectReplicationPolicyProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyfilter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyfilter.go new file mode 100644 index 00000000000..e324d04d5a4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyfilter.go @@ -0,0 +1,9 @@ +package objectreplicationpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ObjectReplicationPolicyFilter struct { + MinCreationTime *string `json:"minCreationTime,omitempty"` + PrefixMatch *[]string `json:"prefixMatch,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyproperties.go new file mode 100644 index 00000000000..1bc675c903f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyproperties.go @@ -0,0 +1,30 @@ +package objectreplicationpolicies + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ObjectReplicationPolicyProperties struct { + DestinationAccount string `json:"destinationAccount"` + EnabledTime *string `json:"enabledTime,omitempty"` + PolicyId *string `json:"policyId,omitempty"` + Rules *[]ObjectReplicationPolicyRule `json:"rules,omitempty"` + SourceAccount string `json:"sourceAccount"` +} + +func (o *ObjectReplicationPolicyProperties) GetEnabledTimeAsTime() (*time.Time, error) { + if o.EnabledTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EnabledTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ObjectReplicationPolicyProperties) SetEnabledTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EnabledTime = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyrule.go new file mode 100644 index 00000000000..8bbb947ff39 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyrule.go @@ -0,0 +1,11 @@ +package objectreplicationpolicies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ObjectReplicationPolicyRule struct { + DestinationContainer string `json:"destinationContainer"` + Filters *ObjectReplicationPolicyFilter `json:"filters,omitempty"` + RuleId *string `json:"ruleId,omitempty"` + SourceContainer string `json:"sourceContainer"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/version.go new file mode 100644 index 00000000000..fec2341a232 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies/version.go @@ -0,0 +1,12 @@ +package objectreplicationpolicies + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-04-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/objectreplicationpolicies/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/README.md new file mode 100644 index 00000000000..c6a336922f8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/README.md @@ -0,0 +1,94 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints` Documentation + +The `endpoints` SDK allows for interaction with the Azure Resource Manager Service `trafficmanager` (API Version `2018-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints" +``` + + +### Client Initialization + +```go +client := endpoints.NewEndpointsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `EndpointsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue", "AzureEndpoints", "endpointValue") + +payload := endpoints.Endpoint{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EndpointsClient.Delete` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue", "AzureEndpoints", "endpointValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EndpointsClient.Get` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue", "AzureEndpoints", "endpointValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EndpointsClient.Update` + +```go +ctx := context.TODO() +id := endpoints.NewEndpointTypeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue", "AzureEndpoints", "endpointValue") + +payload := endpoints.Endpoint{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/client.go new file mode 100644 index 00000000000..6c305c6e8ca --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/client.go @@ -0,0 +1,18 @@ +package endpoints + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointsClient struct { + Client autorest.Client + baseUri string +} + +func NewEndpointsClientWithBaseURI(endpoint string) EndpointsClient { + return EndpointsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/constants.go new file mode 100644 index 00000000000..202519d0c58 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/constants.go @@ -0,0 +1,105 @@ +package endpoints + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointMonitorStatus string + +const ( + EndpointMonitorStatusCheckingEndpoint EndpointMonitorStatus = "CheckingEndpoint" + EndpointMonitorStatusDegraded EndpointMonitorStatus = "Degraded" + EndpointMonitorStatusDisabled EndpointMonitorStatus = "Disabled" + EndpointMonitorStatusInactive EndpointMonitorStatus = "Inactive" + EndpointMonitorStatusOnline EndpointMonitorStatus = "Online" + EndpointMonitorStatusStopped EndpointMonitorStatus = "Stopped" +) + +func PossibleValuesForEndpointMonitorStatus() []string { + return []string{ + string(EndpointMonitorStatusCheckingEndpoint), + string(EndpointMonitorStatusDegraded), + string(EndpointMonitorStatusDisabled), + string(EndpointMonitorStatusInactive), + string(EndpointMonitorStatusOnline), + string(EndpointMonitorStatusStopped), + } +} + +func parseEndpointMonitorStatus(input string) (*EndpointMonitorStatus, error) { + vals := map[string]EndpointMonitorStatus{ + "checkingendpoint": EndpointMonitorStatusCheckingEndpoint, + "degraded": EndpointMonitorStatusDegraded, + "disabled": EndpointMonitorStatusDisabled, + "inactive": EndpointMonitorStatusInactive, + "online": EndpointMonitorStatusOnline, + "stopped": EndpointMonitorStatusStopped, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EndpointMonitorStatus(input) + return &out, nil +} + +type EndpointStatus string + +const ( + EndpointStatusDisabled EndpointStatus = "Disabled" + EndpointStatusEnabled EndpointStatus = "Enabled" +) + +func PossibleValuesForEndpointStatus() []string { + return []string{ + string(EndpointStatusDisabled), + string(EndpointStatusEnabled), + } +} + +func parseEndpointStatus(input string) (*EndpointStatus, error) { + vals := map[string]EndpointStatus{ + "disabled": EndpointStatusDisabled, + "enabled": EndpointStatusEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EndpointStatus(input) + return &out, nil +} + +type EndpointType string + +const ( + EndpointTypeAzureEndpoints EndpointType = "AzureEndpoints" + EndpointTypeExternalEndpoints EndpointType = "ExternalEndpoints" + EndpointTypeNestedEndpoints EndpointType = "NestedEndpoints" +) + +func PossibleValuesForEndpointType() []string { + return []string{ + string(EndpointTypeAzureEndpoints), + string(EndpointTypeExternalEndpoints), + string(EndpointTypeNestedEndpoints), + } +} + +func parseEndpointType(input string) (*EndpointType, error) { + vals := map[string]EndpointType{ + "azureendpoints": EndpointTypeAzureEndpoints, + "externalendpoints": EndpointTypeExternalEndpoints, + "nestedendpoints": EndpointTypeNestedEndpoints, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EndpointType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/id_endpointtype.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/id_endpointtype.go similarity index 97% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/id_endpointtype.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/id_endpointtype.go index 885e160fc26..d4c4f917d8e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/id_endpointtype.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/id_endpointtype.go @@ -52,8 +52,8 @@ func ParseEndpointTypeID(input string) (*EndpointTypeId, error) { return nil, fmt.Errorf("the segment 'profileName' was not found in the resource id %q", input) } - if v, constFound := parsed.Parsed["endpointType"]; true { - if !constFound { + if v, ok := parsed.Parsed["endpointType"]; true { + if !ok { return nil, fmt.Errorf("the segment 'endpointType' was not found in the resource id %q", input) } @@ -95,8 +95,8 @@ func ParseEndpointTypeIDInsensitively(input string) (*EndpointTypeId, error) { return nil, fmt.Errorf("the segment 'profileName' was not found in the resource id %q", input) } - if v, constFound := parsed.Parsed["endpointType"]; true { - if !constFound { + if v, ok := parsed.Parsed["endpointType"]; true { + if !ok { return nil, fmt.Errorf("the segment 'endpointType' was not found in the resource id %q", input) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/method_createorupdate_autorest.go new file mode 100644 index 00000000000..562902bf61f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package endpoints + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Endpoint +} + +// CreateOrUpdate ... +func (c EndpointsClient) CreateOrUpdate(ctx context.Context, id EndpointTypeId, input Endpoint) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c EndpointsClient) preparerForCreateOrUpdate(ctx context.Context, id EndpointTypeId, input Endpoint) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c EndpointsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/method_delete_autorest.go new file mode 100644 index 00000000000..96c74574993 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/method_delete_autorest.go @@ -0,0 +1,68 @@ +package endpoints + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + Model *DeleteOperationResult +} + +// Delete ... +func (c EndpointsClient) Delete(ctx context.Context, id EndpointTypeId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c EndpointsClient) preparerForDelete(ctx context.Context, id EndpointTypeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c EndpointsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/method_get_autorest.go new file mode 100644 index 00000000000..c77dce43a2b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/method_get_autorest.go @@ -0,0 +1,68 @@ +package endpoints + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Endpoint +} + +// Get ... +func (c EndpointsClient) Get(ctx context.Context, id EndpointTypeId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c EndpointsClient) preparerForGet(ctx context.Context, id EndpointTypeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c EndpointsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/method_update_autorest.go new file mode 100644 index 00000000000..3eedd41d201 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/method_update_autorest.go @@ -0,0 +1,69 @@ +package endpoints + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Endpoint +} + +// Update ... +func (c EndpointsClient) Update(ctx context.Context, id EndpointTypeId, input Endpoint) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c EndpointsClient) preparerForUpdate(ctx context.Context, id EndpointTypeId, input Endpoint) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c EndpointsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/model_deleteoperationresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/model_deleteoperationresult.go new file mode 100644 index 00000000000..89a21b61ea7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/model_deleteoperationresult.go @@ -0,0 +1,8 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResult struct { + Boolean *bool `json:"boolean,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/model_endpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/model_endpoint.go new file mode 100644 index 00000000000..07a25cb21fe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/model_endpoint.go @@ -0,0 +1,11 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Endpoint struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *EndpointProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/model_endpointproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/model_endpointproperties.go new file mode 100644 index 00000000000..6912f7280d3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/model_endpointproperties.go @@ -0,0 +1,20 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointProperties struct { + CustomHeaders *[]EndpointPropertiesCustomHeadersInlined `json:"customHeaders,omitempty"` + EndpointLocation *string `json:"endpointLocation,omitempty"` + EndpointMonitorStatus *EndpointMonitorStatus `json:"endpointMonitorStatus,omitempty"` + EndpointStatus *EndpointStatus `json:"endpointStatus,omitempty"` + GeoMapping *[]string `json:"geoMapping,omitempty"` + MinChildEndpoints *int64 `json:"minChildEndpoints,omitempty"` + MinChildEndpointsIPv4 *int64 `json:"minChildEndpointsIPv4,omitempty"` + MinChildEndpointsIPv6 *int64 `json:"minChildEndpointsIPv6,omitempty"` + Priority *int64 `json:"priority,omitempty"` + Subnets *[]EndpointPropertiesSubnetsInlined `json:"subnets,omitempty"` + Target *string `json:"target,omitempty"` + TargetResourceId *string `json:"targetResourceId,omitempty"` + Weight *int64 `json:"weight,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/model_endpointpropertiescustomheadersinlined.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/model_endpointpropertiescustomheadersinlined.go new file mode 100644 index 00000000000..02128e55d59 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/model_endpointpropertiescustomheadersinlined.go @@ -0,0 +1,9 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointPropertiesCustomHeadersInlined struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/model_endpointpropertiessubnetsinlined.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/model_endpointpropertiessubnetsinlined.go new file mode 100644 index 00000000000..e32160c0491 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/model_endpointpropertiessubnetsinlined.go @@ -0,0 +1,10 @@ +package endpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointPropertiesSubnetsInlined struct { + First *string `json:"first,omitempty"` + Last *string `json:"last,omitempty"` + Scope *int64 `json:"scope,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/version.go new file mode 100644 index 00000000000..a53308e8ea0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints/version.go @@ -0,0 +1,12 @@ +package endpoints + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/endpoints/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/README.md new file mode 100644 index 00000000000..b222e2e2618 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/README.md @@ -0,0 +1,36 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies` Documentation + +The `geographichierarchies` SDK allows for interaction with the Azure Resource Manager Service `trafficmanager` (API Version `2018-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies" +``` + + +### Client Initialization + +```go +client := geographichierarchies.NewGeographicHierarchiesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `GeographicHierarchiesClient.GetDefault` + +```go +ctx := context.TODO() + + +read, err := client.GetDefault(ctx) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/client.go new file mode 100644 index 00000000000..763bd52bb6c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/client.go @@ -0,0 +1,18 @@ +package geographichierarchies + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GeographicHierarchiesClient struct { + Client autorest.Client + baseUri string +} + +func NewGeographicHierarchiesClientWithBaseURI(endpoint string) GeographicHierarchiesClient { + return GeographicHierarchiesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/method_getdefault_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/method_getdefault_autorest.go similarity index 86% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/method_getdefault_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/method_getdefault_autorest.go index aaa17f58872..e5f5620df8b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/method_getdefault_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/method_getdefault_autorest.go @@ -8,13 +8,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type GetDefaultResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetDefaultOperationResponse struct { HttpResponse *http.Response Model *TrafficManagerGeographicHierarchy } // GetDefault ... -func (c GeographicHierarchiesClient) GetDefault(ctx context.Context) (result GetDefaultResponse, err error) { +func (c GeographicHierarchiesClient) GetDefault(ctx context.Context) (result GetDefaultOperationResponse, err error) { req, err := c.preparerForGetDefault(ctx) if err != nil { err = autorest.NewErrorWithError(err, "geographichierarchies.GeographicHierarchiesClient", "GetDefault", nil, "Failure preparing request") @@ -53,12 +56,13 @@ func (c GeographicHierarchiesClient) preparerForGetDefault(ctx context.Context) // responderForGetDefault handles the response to the GetDefault request. The method always // closes the http.Response Body. -func (c GeographicHierarchiesClient) responderForGetDefault(resp *http.Response) (result GetDefaultResponse, err error) { +func (c GeographicHierarchiesClient) responderForGetDefault(resp *http.Response) (result GetDefaultOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/model_geographichierarchyproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/model_geographichierarchyproperties.go new file mode 100644 index 00000000000..7b6134946e3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/model_geographichierarchyproperties.go @@ -0,0 +1,8 @@ +package geographichierarchies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GeographicHierarchyProperties struct { + GeographicHierarchy *Region `json:"geographicHierarchy,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/model_region.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/model_region.go new file mode 100644 index 00000000000..65d3e17d823 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/model_region.go @@ -0,0 +1,10 @@ +package geographichierarchies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Region struct { + Code *string `json:"code,omitempty"` + Name *string `json:"name,omitempty"` + Regions *[]Region `json:"regions,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/model_trafficmanagergeographichierarchy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/model_trafficmanagergeographichierarchy.go new file mode 100644 index 00000000000..b9f3ba69e90 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/model_trafficmanagergeographichierarchy.go @@ -0,0 +1,11 @@ +package geographichierarchies + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TrafficManagerGeographicHierarchy struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *GeographicHierarchyProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/version.go new file mode 100644 index 00000000000..d29c4332a4e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies/version.go @@ -0,0 +1,12 @@ +package geographichierarchies + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/geographichierarchies/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/README.md new file mode 100644 index 00000000000..e86d49e478c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/README.md @@ -0,0 +1,146 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles` Documentation + +The `profiles` SDK allows for interaction with the Azure Resource Manager Service `trafficmanager` (API Version `2018-08-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles" +``` + + +### Client Initialization + +```go +client := profiles.NewProfilesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ProfilesClient.CheckTrafficManagerRelativeDnsNameAvailability` + +```go +ctx := context.TODO() + +payload := profiles.CheckTrafficManagerRelativeDnsNameAvailabilityParameters{ + // ... +} + + +read, err := client.CheckTrafficManagerRelativeDnsNameAvailability(ctx, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProfilesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := profiles.NewTrafficManagerProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue") + +payload := profiles.Profile{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProfilesClient.Delete` + +```go +ctx := context.TODO() +id := profiles.NewTrafficManagerProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProfilesClient.Get` + +```go +ctx := context.TODO() +id := profiles.NewTrafficManagerProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProfilesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := profiles.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.ListByResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProfilesClient.ListBySubscription` + +```go +ctx := context.TODO() +id := profiles.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.ListBySubscription(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProfilesClient.Update` + +```go +ctx := context.TODO() +id := profiles.NewTrafficManagerProfileID("12345678-1234-9876-4563-123456789012", "example-resource-group", "profileValue") + +payload := profiles.Profile{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/client.go new file mode 100644 index 00000000000..a99722efb6c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/client.go @@ -0,0 +1,18 @@ +package profiles + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProfilesClient struct { + Client autorest.Client + baseUri string +} + +func NewProfilesClientWithBaseURI(endpoint string) ProfilesClient { + return ProfilesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/constants.go new file mode 100644 index 00000000000..ec50b473752 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/constants.go @@ -0,0 +1,272 @@ +package profiles + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AllowedEndpointRecordType string + +const ( + AllowedEndpointRecordTypeAny AllowedEndpointRecordType = "Any" + AllowedEndpointRecordTypeDomainName AllowedEndpointRecordType = "DomainName" + AllowedEndpointRecordTypeIPvFourAddress AllowedEndpointRecordType = "IPv4Address" + AllowedEndpointRecordTypeIPvSixAddress AllowedEndpointRecordType = "IPv6Address" +) + +func PossibleValuesForAllowedEndpointRecordType() []string { + return []string{ + string(AllowedEndpointRecordTypeAny), + string(AllowedEndpointRecordTypeDomainName), + string(AllowedEndpointRecordTypeIPvFourAddress), + string(AllowedEndpointRecordTypeIPvSixAddress), + } +} + +func parseAllowedEndpointRecordType(input string) (*AllowedEndpointRecordType, error) { + vals := map[string]AllowedEndpointRecordType{ + "any": AllowedEndpointRecordTypeAny, + "domainname": AllowedEndpointRecordTypeDomainName, + "ipv4address": AllowedEndpointRecordTypeIPvFourAddress, + "ipv6address": AllowedEndpointRecordTypeIPvSixAddress, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AllowedEndpointRecordType(input) + return &out, nil +} + +type EndpointMonitorStatus string + +const ( + EndpointMonitorStatusCheckingEndpoint EndpointMonitorStatus = "CheckingEndpoint" + EndpointMonitorStatusDegraded EndpointMonitorStatus = "Degraded" + EndpointMonitorStatusDisabled EndpointMonitorStatus = "Disabled" + EndpointMonitorStatusInactive EndpointMonitorStatus = "Inactive" + EndpointMonitorStatusOnline EndpointMonitorStatus = "Online" + EndpointMonitorStatusStopped EndpointMonitorStatus = "Stopped" +) + +func PossibleValuesForEndpointMonitorStatus() []string { + return []string{ + string(EndpointMonitorStatusCheckingEndpoint), + string(EndpointMonitorStatusDegraded), + string(EndpointMonitorStatusDisabled), + string(EndpointMonitorStatusInactive), + string(EndpointMonitorStatusOnline), + string(EndpointMonitorStatusStopped), + } +} + +func parseEndpointMonitorStatus(input string) (*EndpointMonitorStatus, error) { + vals := map[string]EndpointMonitorStatus{ + "checkingendpoint": EndpointMonitorStatusCheckingEndpoint, + "degraded": EndpointMonitorStatusDegraded, + "disabled": EndpointMonitorStatusDisabled, + "inactive": EndpointMonitorStatusInactive, + "online": EndpointMonitorStatusOnline, + "stopped": EndpointMonitorStatusStopped, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EndpointMonitorStatus(input) + return &out, nil +} + +type EndpointStatus string + +const ( + EndpointStatusDisabled EndpointStatus = "Disabled" + EndpointStatusEnabled EndpointStatus = "Enabled" +) + +func PossibleValuesForEndpointStatus() []string { + return []string{ + string(EndpointStatusDisabled), + string(EndpointStatusEnabled), + } +} + +func parseEndpointStatus(input string) (*EndpointStatus, error) { + vals := map[string]EndpointStatus{ + "disabled": EndpointStatusDisabled, + "enabled": EndpointStatusEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EndpointStatus(input) + return &out, nil +} + +type MonitorProtocol string + +const ( + MonitorProtocolHTTP MonitorProtocol = "HTTP" + MonitorProtocolHTTPS MonitorProtocol = "HTTPS" + MonitorProtocolTCP MonitorProtocol = "TCP" +) + +func PossibleValuesForMonitorProtocol() []string { + return []string{ + string(MonitorProtocolHTTP), + string(MonitorProtocolHTTPS), + string(MonitorProtocolTCP), + } +} + +func parseMonitorProtocol(input string) (*MonitorProtocol, error) { + vals := map[string]MonitorProtocol{ + "http": MonitorProtocolHTTP, + "https": MonitorProtocolHTTPS, + "tcp": MonitorProtocolTCP, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MonitorProtocol(input) + return &out, nil +} + +type ProfileMonitorStatus string + +const ( + ProfileMonitorStatusCheckingEndpoints ProfileMonitorStatus = "CheckingEndpoints" + ProfileMonitorStatusDegraded ProfileMonitorStatus = "Degraded" + ProfileMonitorStatusDisabled ProfileMonitorStatus = "Disabled" + ProfileMonitorStatusInactive ProfileMonitorStatus = "Inactive" + ProfileMonitorStatusOnline ProfileMonitorStatus = "Online" +) + +func PossibleValuesForProfileMonitorStatus() []string { + return []string{ + string(ProfileMonitorStatusCheckingEndpoints), + string(ProfileMonitorStatusDegraded), + string(ProfileMonitorStatusDisabled), + string(ProfileMonitorStatusInactive), + string(ProfileMonitorStatusOnline), + } +} + +func parseProfileMonitorStatus(input string) (*ProfileMonitorStatus, error) { + vals := map[string]ProfileMonitorStatus{ + "checkingendpoints": ProfileMonitorStatusCheckingEndpoints, + "degraded": ProfileMonitorStatusDegraded, + "disabled": ProfileMonitorStatusDisabled, + "inactive": ProfileMonitorStatusInactive, + "online": ProfileMonitorStatusOnline, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProfileMonitorStatus(input) + return &out, nil +} + +type ProfileStatus string + +const ( + ProfileStatusDisabled ProfileStatus = "Disabled" + ProfileStatusEnabled ProfileStatus = "Enabled" +) + +func PossibleValuesForProfileStatus() []string { + return []string{ + string(ProfileStatusDisabled), + string(ProfileStatusEnabled), + } +} + +func parseProfileStatus(input string) (*ProfileStatus, error) { + vals := map[string]ProfileStatus{ + "disabled": ProfileStatusDisabled, + "enabled": ProfileStatusEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProfileStatus(input) + return &out, nil +} + +type TrafficRoutingMethod string + +const ( + TrafficRoutingMethodGeographic TrafficRoutingMethod = "Geographic" + TrafficRoutingMethodMultiValue TrafficRoutingMethod = "MultiValue" + TrafficRoutingMethodPerformance TrafficRoutingMethod = "Performance" + TrafficRoutingMethodPriority TrafficRoutingMethod = "Priority" + TrafficRoutingMethodSubnet TrafficRoutingMethod = "Subnet" + TrafficRoutingMethodWeighted TrafficRoutingMethod = "Weighted" +) + +func PossibleValuesForTrafficRoutingMethod() []string { + return []string{ + string(TrafficRoutingMethodGeographic), + string(TrafficRoutingMethodMultiValue), + string(TrafficRoutingMethodPerformance), + string(TrafficRoutingMethodPriority), + string(TrafficRoutingMethodSubnet), + string(TrafficRoutingMethodWeighted), + } +} + +func parseTrafficRoutingMethod(input string) (*TrafficRoutingMethod, error) { + vals := map[string]TrafficRoutingMethod{ + "geographic": TrafficRoutingMethodGeographic, + "multivalue": TrafficRoutingMethodMultiValue, + "performance": TrafficRoutingMethodPerformance, + "priority": TrafficRoutingMethodPriority, + "subnet": TrafficRoutingMethodSubnet, + "weighted": TrafficRoutingMethodWeighted, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TrafficRoutingMethod(input) + return &out, nil +} + +type TrafficViewEnrollmentStatus string + +const ( + TrafficViewEnrollmentStatusDisabled TrafficViewEnrollmentStatus = "Disabled" + TrafficViewEnrollmentStatusEnabled TrafficViewEnrollmentStatus = "Enabled" +) + +func PossibleValuesForTrafficViewEnrollmentStatus() []string { + return []string{ + string(TrafficViewEnrollmentStatusDisabled), + string(TrafficViewEnrollmentStatusEnabled), + } +} + +func parseTrafficViewEnrollmentStatus(input string) (*TrafficViewEnrollmentStatus, error) { + vals := map[string]TrafficViewEnrollmentStatus{ + "disabled": TrafficViewEnrollmentStatusDisabled, + "enabled": TrafficViewEnrollmentStatusEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TrafficViewEnrollmentStatus(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/id_trafficmanagerprofile.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/id_trafficmanagerprofile.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/id_trafficmanagerprofile.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/id_trafficmanagerprofile.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_checktrafficmanagerrelativednsnameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_checktrafficmanagerrelativednsnameavailability_autorest.go similarity index 88% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_checktrafficmanagerrelativednsnameavailability_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_checktrafficmanagerrelativednsnameavailability_autorest.go index ae8e3879ef9..1cc71e88da7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_checktrafficmanagerrelativednsnameavailability_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_checktrafficmanagerrelativednsnameavailability_autorest.go @@ -8,13 +8,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type CheckTrafficManagerRelativeDnsNameAvailabilityResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckTrafficManagerRelativeDnsNameAvailabilityOperationResponse struct { HttpResponse *http.Response Model *TrafficManagerNameAvailability } // CheckTrafficManagerRelativeDnsNameAvailability ... -func (c ProfilesClient) CheckTrafficManagerRelativeDnsNameAvailability(ctx context.Context, input CheckTrafficManagerRelativeDnsNameAvailabilityParameters) (result CheckTrafficManagerRelativeDnsNameAvailabilityResponse, err error) { +func (c ProfilesClient) CheckTrafficManagerRelativeDnsNameAvailability(ctx context.Context, input CheckTrafficManagerRelativeDnsNameAvailabilityParameters) (result CheckTrafficManagerRelativeDnsNameAvailabilityOperationResponse, err error) { req, err := c.preparerForCheckTrafficManagerRelativeDnsNameAvailability(ctx, input) if err != nil { err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "CheckTrafficManagerRelativeDnsNameAvailability", nil, "Failure preparing request") @@ -54,12 +57,13 @@ func (c ProfilesClient) preparerForCheckTrafficManagerRelativeDnsNameAvailabilit // responderForCheckTrafficManagerRelativeDnsNameAvailability handles the response to the CheckTrafficManagerRelativeDnsNameAvailability request. The method always // closes the http.Response Body. -func (c ProfilesClient) responderForCheckTrafficManagerRelativeDnsNameAvailability(resp *http.Response) (result CheckTrafficManagerRelativeDnsNameAvailabilityResponse, err error) { +func (c ProfilesClient) responderForCheckTrafficManagerRelativeDnsNameAvailability(resp *http.Response) (result CheckTrafficManagerRelativeDnsNameAvailabilityOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_createorupdate_autorest.go new file mode 100644 index 00000000000..0afeb87048f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package profiles + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *Profile +} + +// CreateOrUpdate ... +func (c ProfilesClient) CreateOrUpdate(ctx context.Context, id TrafficManagerProfileId, input Profile) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ProfilesClient) preparerForCreateOrUpdate(ctx context.Context, id TrafficManagerProfileId, input Profile) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ProfilesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_delete_autorest.go new file mode 100644 index 00000000000..9a848341148 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_delete_autorest.go @@ -0,0 +1,68 @@ +package profiles + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + Model *DeleteOperationResult +} + +// Delete ... +func (c ProfilesClient) Delete(ctx context.Context, id TrafficManagerProfileId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ProfilesClient) preparerForDelete(ctx context.Context, id TrafficManagerProfileId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ProfilesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_get_autorest.go new file mode 100644 index 00000000000..87e2d5e3570 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_get_autorest.go @@ -0,0 +1,68 @@ +package profiles + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Profile +} + +// Get ... +func (c ProfilesClient) Get(ctx context.Context, id TrafficManagerProfileId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ProfilesClient) preparerForGet(ctx context.Context, id TrafficManagerProfileId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ProfilesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_listbyresourcegroup_autorest.go new file mode 100644 index 00000000000..4366a308919 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_listbyresourcegroup_autorest.go @@ -0,0 +1,70 @@ +package profiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *ProfileListResult +} + +// ListByResourceGroup ... +func (c ProfilesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ProfilesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/trafficManagerProfiles", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ProfilesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_listbysubscription_autorest.go new file mode 100644 index 00000000000..fbe9ff0da0d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_listbysubscription_autorest.go @@ -0,0 +1,70 @@ +package profiles + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *ProfileListResult +} + +// ListBySubscription ... +func (c ProfilesClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "ListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListBySubscription prepares the ListBySubscription request. +func (c ProfilesClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/trafficManagerProfiles", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListBySubscription handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (c ProfilesClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_update_autorest.go new file mode 100644 index 00000000000..5a86bf294c0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/method_update_autorest.go @@ -0,0 +1,69 @@ +package profiles + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *Profile +} + +// Update ... +func (c ProfilesClient) Update(ctx context.Context, id TrafficManagerProfileId, input Profile) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ProfilesClient) preparerForUpdate(ctx context.Context, id TrafficManagerProfileId, input Profile) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ProfilesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_checktrafficmanagerrelativednsnameavailabilityparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_checktrafficmanagerrelativednsnameavailabilityparameters.go new file mode 100644 index 00000000000..cccfc04bb70 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_checktrafficmanagerrelativednsnameavailabilityparameters.go @@ -0,0 +1,9 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckTrafficManagerRelativeDnsNameAvailabilityParameters struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_deleteoperationresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_deleteoperationresult.go new file mode 100644 index 00000000000..816d65a4236 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_deleteoperationresult.go @@ -0,0 +1,8 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResult struct { + Boolean *bool `json:"boolean,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_dnsconfig.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_dnsconfig.go new file mode 100644 index 00000000000..263e0710dc7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_dnsconfig.go @@ -0,0 +1,10 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DnsConfig struct { + Fqdn *string `json:"fqdn,omitempty"` + RelativeName *string `json:"relativeName,omitempty"` + Ttl *int64 `json:"ttl,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_endpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_endpoint.go new file mode 100644 index 00000000000..baae7196b7b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_endpoint.go @@ -0,0 +1,11 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Endpoint struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *EndpointProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_endpointproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_endpointproperties.go new file mode 100644 index 00000000000..786310beba9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_endpointproperties.go @@ -0,0 +1,20 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointProperties struct { + CustomHeaders *[]EndpointPropertiesCustomHeadersInlined `json:"customHeaders,omitempty"` + EndpointLocation *string `json:"endpointLocation,omitempty"` + EndpointMonitorStatus *EndpointMonitorStatus `json:"endpointMonitorStatus,omitempty"` + EndpointStatus *EndpointStatus `json:"endpointStatus,omitempty"` + GeoMapping *[]string `json:"geoMapping,omitempty"` + MinChildEndpoints *int64 `json:"minChildEndpoints,omitempty"` + MinChildEndpointsIPv4 *int64 `json:"minChildEndpointsIPv4,omitempty"` + MinChildEndpointsIPv6 *int64 `json:"minChildEndpointsIPv6,omitempty"` + Priority *int64 `json:"priority,omitempty"` + Subnets *[]EndpointPropertiesSubnetsInlined `json:"subnets,omitempty"` + Target *string `json:"target,omitempty"` + TargetResourceId *string `json:"targetResourceId,omitempty"` + Weight *int64 `json:"weight,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_endpointpropertiescustomheadersinlined.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_endpointpropertiescustomheadersinlined.go new file mode 100644 index 00000000000..a3dae2aaef1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_endpointpropertiescustomheadersinlined.go @@ -0,0 +1,9 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointPropertiesCustomHeadersInlined struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_endpointpropertiessubnetsinlined.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_endpointpropertiessubnetsinlined.go new file mode 100644 index 00000000000..ec1cd3e2446 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_endpointpropertiessubnetsinlined.go @@ -0,0 +1,10 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EndpointPropertiesSubnetsInlined struct { + First *string `json:"first,omitempty"` + Last *string `json:"last,omitempty"` + Scope *int64 `json:"scope,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_monitorconfig.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_monitorconfig.go similarity index 86% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_monitorconfig.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_monitorconfig.go index 6da454d8124..49606661088 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_monitorconfig.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_monitorconfig.go @@ -1,5 +1,8 @@ package profiles +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type MonitorConfig struct { CustomHeaders *[]MonitorConfigCustomHeadersInlined `json:"customHeaders,omitempty"` ExpectedStatusCodeRanges *[]MonitorConfigExpectedStatusCodeRangesInlined `json:"expectedStatusCodeRanges,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_monitorconfigcustomheadersinlined.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_monitorconfigcustomheadersinlined.go new file mode 100644 index 00000000000..0a2490c719a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_monitorconfigcustomheadersinlined.go @@ -0,0 +1,9 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorConfigCustomHeadersInlined struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_monitorconfigexpectedstatuscoderangesinlined.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_monitorconfigexpectedstatuscoderangesinlined.go new file mode 100644 index 00000000000..3f10db9a484 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_monitorconfigexpectedstatuscoderangesinlined.go @@ -0,0 +1,9 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitorConfigExpectedStatusCodeRangesInlined struct { + Max *int64 `json:"max,omitempty"` + Min *int64 `json:"min,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_profile.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_profile.go new file mode 100644 index 00000000000..fb0ba98d180 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_profile.go @@ -0,0 +1,13 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Profile struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ProfileProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_profilelistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_profilelistresult.go new file mode 100644 index 00000000000..b8242878c91 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_profilelistresult.go @@ -0,0 +1,8 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProfileListResult struct { + Value *[]Profile `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_profileproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_profileproperties.go similarity index 83% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_profileproperties.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_profileproperties.go index 01e019c0a18..411ff16e6c8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_profileproperties.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_profileproperties.go @@ -1,5 +1,8 @@ package profiles +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ProfileProperties struct { AllowedEndpointRecordTypes *[]AllowedEndpointRecordType `json:"allowedEndpointRecordTypes,omitempty"` DnsConfig *DnsConfig `json:"dnsConfig,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_trafficmanagernameavailability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_trafficmanagernameavailability.go new file mode 100644 index 00000000000..d90da83c581 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/model_trafficmanagernameavailability.go @@ -0,0 +1,12 @@ +package profiles + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TrafficManagerNameAvailability struct { + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *string `json:"reason,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/version.go new file mode 100644 index 00000000000..660e41e5df6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles/version.go @@ -0,0 +1,12 @@ +package profiles + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2018-08-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/profiles/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/README.md new file mode 100644 index 00000000000..8d9c12144a8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules` Documentation + +The `edgemodules` SDK allows for interaction with the Azure Resource Manager Service `videoanalyzer` (API Version `2021-05-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules" +``` + + +### Client Initialization + +```go +client := edgemodules.NewEdgeModulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `EdgeModulesClient.EdgeModulesCreateOrUpdate` + +```go +ctx := context.TODO() +id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "edgeModuleValue") + +payload := edgemodules.EdgeModuleEntity{ + // ... +} + + +read, err := client.EdgeModulesCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EdgeModulesClient.EdgeModulesDelete` + +```go +ctx := context.TODO() +id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "edgeModuleValue") + +read, err := client.EdgeModulesDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EdgeModulesClient.EdgeModulesGet` + +```go +ctx := context.TODO() +id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "edgeModuleValue") + +read, err := client.EdgeModulesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `EdgeModulesClient.EdgeModulesList` + +```go +ctx := context.TODO() +id := edgemodules.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +// alternatively `client.EdgeModulesList(ctx, id, edgemodules.DefaultEdgeModulesListOperationOptions())` can be used to do batched pagination +items, err := client.EdgeModulesListComplete(ctx, id, edgemodules.DefaultEdgeModulesListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `EdgeModulesClient.EdgeModulesListProvisioningToken` + +```go +ctx := context.TODO() +id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "edgeModuleValue") + +payload := edgemodules.ListProvisioningTokenInput{ + // ... +} + + +read, err := client.EdgeModulesListProvisioningToken(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/client.go new file mode 100644 index 00000000000..d0e00fc9f5b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/client.go @@ -0,0 +1,18 @@ +package edgemodules + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdgeModulesClient struct { + Client autorest.Client + baseUri string +} + +func NewEdgeModulesClientWithBaseURI(endpoint string) EdgeModulesClient { + return EdgeModulesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_edgemodule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule.go similarity index 99% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_edgemodule.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule.go index 10fa71d5b91..3b094b76bd6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_edgemodule.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule.go @@ -1,4 +1,4 @@ -package videoanalyzer +package edgemodules import ( "fmt" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer.go new file mode 100644 index 00000000000..191685e5479 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer.go @@ -0,0 +1,124 @@ +package edgemodules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VideoAnalyzerId{} + +// VideoAnalyzerId is a struct representing the Resource ID for a Video Analyzer +type VideoAnalyzerId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewVideoAnalyzerID returns a new VideoAnalyzerId struct +func NewVideoAnalyzerID(subscriptionId string, resourceGroupName string, accountName string) VideoAnalyzerId { + return VideoAnalyzerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseVideoAnalyzerID parses 'input' into a VideoAnalyzerId +func ParseVideoAnalyzerID(input string) (*VideoAnalyzerId, error) { + parser := resourceids.NewParserFromResourceIdType(VideoAnalyzerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VideoAnalyzerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVideoAnalyzerIDInsensitively parses 'input' case-insensitively into a VideoAnalyzerId +// note: this method should only be used for API response data and not user input +func ParseVideoAnalyzerIDInsensitively(input string) (*VideoAnalyzerId, error) { + parser := resourceids.NewParserFromResourceIdType(VideoAnalyzerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VideoAnalyzerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVideoAnalyzerID checks that 'input' can be parsed as a Video Analyzer ID +func ValidateVideoAnalyzerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVideoAnalyzerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Video Analyzer ID +func (id VideoAnalyzerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Video Analyzer ID +func (id VideoAnalyzerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), + resourceids.StaticSegment("staticVideoAnalyzers", "videoAnalyzers", "videoAnalyzers"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Video Analyzer ID +func (id VideoAnalyzerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Video Analyzer (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_edgemodulescreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_edgemodulescreateorupdate_autorest.go new file mode 100644 index 00000000000..3e66660b15d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_edgemodulescreateorupdate_autorest.go @@ -0,0 +1,69 @@ +package edgemodules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdgeModulesCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *EdgeModuleEntity +} + +// EdgeModulesCreateOrUpdate ... +func (c EdgeModulesClient) EdgeModulesCreateOrUpdate(ctx context.Context, id EdgeModuleId, input EdgeModuleEntity) (result EdgeModulesCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForEdgeModulesCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesCreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForEdgeModulesCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesCreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForEdgeModulesCreateOrUpdate prepares the EdgeModulesCreateOrUpdate request. +func (c EdgeModulesClient) preparerForEdgeModulesCreateOrUpdate(ctx context.Context, id EdgeModuleId, input EdgeModuleEntity) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForEdgeModulesCreateOrUpdate handles the response to the EdgeModulesCreateOrUpdate request. The method always +// closes the http.Response Body. +func (c EdgeModulesClient) responderForEdgeModulesCreateOrUpdate(resp *http.Response) (result EdgeModulesCreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_edgemodulesdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_edgemodulesdelete_autorest.go new file mode 100644 index 00000000000..142b4cce69c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_edgemodulesdelete_autorest.go @@ -0,0 +1,66 @@ +package edgemodules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdgeModulesDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// EdgeModulesDelete ... +func (c EdgeModulesClient) EdgeModulesDelete(ctx context.Context, id EdgeModuleId) (result EdgeModulesDeleteOperationResponse, err error) { + req, err := c.preparerForEdgeModulesDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForEdgeModulesDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForEdgeModulesDelete prepares the EdgeModulesDelete request. +func (c EdgeModulesClient) preparerForEdgeModulesDelete(ctx context.Context, id EdgeModuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForEdgeModulesDelete handles the response to the EdgeModulesDelete request. The method always +// closes the http.Response Body. +func (c EdgeModulesClient) responderForEdgeModulesDelete(resp *http.Response) (result EdgeModulesDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_edgemodulesget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_edgemodulesget_autorest.go new file mode 100644 index 00000000000..7456b2b1537 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_edgemodulesget_autorest.go @@ -0,0 +1,68 @@ +package edgemodules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdgeModulesGetOperationResponse struct { + HttpResponse *http.Response + Model *EdgeModuleEntity +} + +// EdgeModulesGet ... +func (c EdgeModulesClient) EdgeModulesGet(ctx context.Context, id EdgeModuleId) (result EdgeModulesGetOperationResponse, err error) { + req, err := c.preparerForEdgeModulesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForEdgeModulesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForEdgeModulesGet prepares the EdgeModulesGet request. +func (c EdgeModulesClient) preparerForEdgeModulesGet(ctx context.Context, id EdgeModuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForEdgeModulesGet handles the response to the EdgeModulesGet request. The method always +// closes the http.Response Body. +func (c EdgeModulesClient) responderForEdgeModulesGet(resp *http.Response) (result EdgeModulesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_edgemoduleslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_edgemoduleslist_autorest.go new file mode 100644 index 00000000000..9d99a07be6a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_edgemoduleslist_autorest.go @@ -0,0 +1,225 @@ +package edgemodules + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdgeModulesListOperationResponse struct { + HttpResponse *http.Response + Model *[]EdgeModuleEntity + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (EdgeModulesListOperationResponse, error) +} + +type EdgeModulesListCompleteResult struct { + Items []EdgeModuleEntity +} + +func (r EdgeModulesListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r EdgeModulesListOperationResponse) LoadMore(ctx context.Context) (resp EdgeModulesListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +type EdgeModulesListOperationOptions struct { + Filter *string + Orderby *string + Top *int64 +} + +func DefaultEdgeModulesListOperationOptions() EdgeModulesListOperationOptions { + return EdgeModulesListOperationOptions{} +} + +func (o EdgeModulesListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o EdgeModulesListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Orderby != nil { + out["$orderby"] = *o.Orderby + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// EdgeModulesList ... +func (c EdgeModulesClient) EdgeModulesList(ctx context.Context, id VideoAnalyzerId, options EdgeModulesListOperationOptions) (resp EdgeModulesListOperationResponse, err error) { + req, err := c.preparerForEdgeModulesList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForEdgeModulesList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForEdgeModulesList prepares the EdgeModulesList request. +func (c EdgeModulesClient) preparerForEdgeModulesList(ctx context.Context, id VideoAnalyzerId, options EdgeModulesListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/edgeModules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForEdgeModulesListWithNextLink prepares the EdgeModulesList request with the given nextLink token. +func (c EdgeModulesClient) preparerForEdgeModulesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForEdgeModulesList handles the response to the EdgeModulesList request. The method always +// closes the http.Response Body. +func (c EdgeModulesClient) responderForEdgeModulesList(resp *http.Response) (result EdgeModulesListOperationResponse, err error) { + type page struct { + Values []EdgeModuleEntity `json:"value"` + NextLink *string `json:"@nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result EdgeModulesListOperationResponse, err error) { + req, err := c.preparerForEdgeModulesListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForEdgeModulesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// EdgeModulesListComplete retrieves all of the results into a single object +func (c EdgeModulesClient) EdgeModulesListComplete(ctx context.Context, id VideoAnalyzerId, options EdgeModulesListOperationOptions) (EdgeModulesListCompleteResult, error) { + return c.EdgeModulesListCompleteMatchingPredicate(ctx, id, options, EdgeModuleEntityOperationPredicate{}) +} + +// EdgeModulesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c EdgeModulesClient) EdgeModulesListCompleteMatchingPredicate(ctx context.Context, id VideoAnalyzerId, options EdgeModulesListOperationOptions, predicate EdgeModuleEntityOperationPredicate) (resp EdgeModulesListCompleteResult, err error) { + items := make([]EdgeModuleEntity, 0) + + page, err := c.EdgeModulesList(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := EdgeModulesListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_edgemoduleslistprovisioningtoken_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_edgemoduleslistprovisioningtoken_autorest.go new file mode 100644 index 00000000000..b519ad431c2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_edgemoduleslistprovisioningtoken_autorest.go @@ -0,0 +1,70 @@ +package edgemodules + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdgeModulesListProvisioningTokenOperationResponse struct { + HttpResponse *http.Response + Model *EdgeModuleProvisioningToken +} + +// EdgeModulesListProvisioningToken ... +func (c EdgeModulesClient) EdgeModulesListProvisioningToken(ctx context.Context, id EdgeModuleId, input ListProvisioningTokenInput) (result EdgeModulesListProvisioningTokenOperationResponse, err error) { + req, err := c.preparerForEdgeModulesListProvisioningToken(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesListProvisioningToken", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesListProvisioningToken", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForEdgeModulesListProvisioningToken(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "edgemodules.EdgeModulesClient", "EdgeModulesListProvisioningToken", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForEdgeModulesListProvisioningToken prepares the EdgeModulesListProvisioningToken request. +func (c EdgeModulesClient) preparerForEdgeModulesListProvisioningToken(ctx context.Context, id EdgeModuleId, input ListProvisioningTokenInput) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listProvisioningToken", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForEdgeModulesListProvisioningToken handles the response to the EdgeModulesListProvisioningToken request. The method always +// closes the http.Response Body. +func (c EdgeModulesClient) responderForEdgeModulesListProvisioningToken(resp *http.Response) (result EdgeModulesListProvisioningTokenOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleentity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleentity.go new file mode 100644 index 00000000000..d1a3fa65bcb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleentity.go @@ -0,0 +1,16 @@ +package edgemodules + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdgeModuleEntity struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *EdgeModuleProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleproperties.go new file mode 100644 index 00000000000..dd298c382ab --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleproperties.go @@ -0,0 +1,8 @@ +package edgemodules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdgeModuleProperties struct { + EdgeModuleId *string `json:"edgeModuleId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleprovisioningtoken.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleprovisioningtoken.go new file mode 100644 index 00000000000..86022d2bf16 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleprovisioningtoken.go @@ -0,0 +1,27 @@ +package edgemodules + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EdgeModuleProvisioningToken struct { + ExpirationDate *string `json:"expirationDate,omitempty"` + Token *string `json:"token,omitempty"` +} + +func (o *EdgeModuleProvisioningToken) GetExpirationDateAsTime() (*time.Time, error) { + if o.ExpirationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ExpirationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *EdgeModuleProvisioningToken) SetExpirationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationDate = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_listprovisioningtokeninput.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_listprovisioningtokeninput.go new file mode 100644 index 00000000000..ae06f6b8fde --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_listprovisioningtokeninput.go @@ -0,0 +1,23 @@ +package edgemodules + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListProvisioningTokenInput struct { + ExpirationDate string `json:"expirationDate"` +} + +func (o *ListProvisioningTokenInput) GetExpirationDateAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.ExpirationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *ListProvisioningTokenInput) SetExpirationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationDate = formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/predicates.go new file mode 100644 index 00000000000..ef178480279 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/predicates.go @@ -0,0 +1,24 @@ +package edgemodules + +type EdgeModuleEntityOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p EdgeModuleEntityOperationPredicate) Matches(input EdgeModuleEntity) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/version.go new file mode 100644 index 00000000000..037c0dfcd38 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/version.go @@ -0,0 +1,12 @@ +package edgemodules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-05-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/edgemodules/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/README.md new file mode 100644 index 00000000000..b460d0b5783 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/README.md @@ -0,0 +1,168 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers` Documentation + +The `videoanalyzers` SDK allows for interaction with the Azure Resource Manager Service `videoanalyzer` (API Version `2021-05-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers" +``` + + +### Client Initialization + +```go +client := videoanalyzers.NewVideoAnalyzersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VideoAnalyzersClient.LocationsCheckNameAvailability` + +```go +ctx := context.TODO() +id := videoanalyzers.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +payload := videoanalyzers.CheckNameAvailabilityRequest{ + // ... +} + + +read, err := client.LocationsCheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VideoAnalyzersClient.VideoAnalyzersCreateOrUpdate` + +```go +ctx := context.TODO() +id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := videoanalyzers.VideoAnalyzer{ + // ... +} + + +read, err := client.VideoAnalyzersCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VideoAnalyzersClient.VideoAnalyzersDelete` + +```go +ctx := context.TODO() +id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.VideoAnalyzersDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VideoAnalyzersClient.VideoAnalyzersGet` + +```go +ctx := context.TODO() +id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.VideoAnalyzersGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VideoAnalyzersClient.VideoAnalyzersList` + +```go +ctx := context.TODO() +id := videoanalyzers.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.VideoAnalyzersList(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VideoAnalyzersClient.VideoAnalyzersListBySubscription` + +```go +ctx := context.TODO() +id := videoanalyzers.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.VideoAnalyzersListBySubscription(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VideoAnalyzersClient.VideoAnalyzersSyncStorageKeys` + +```go +ctx := context.TODO() +id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := videoanalyzers.SyncStorageKeysInput{ + // ... +} + + +read, err := client.VideoAnalyzersSyncStorageKeys(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VideoAnalyzersClient.VideoAnalyzersUpdate` + +```go +ctx := context.TODO() +id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := videoanalyzers.VideoAnalyzerUpdate{ + // ... +} + + +read, err := client.VideoAnalyzersUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/client.go new file mode 100644 index 00000000000..115344c04b7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/client.go @@ -0,0 +1,18 @@ +package videoanalyzers + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VideoAnalyzersClient struct { + Client autorest.Client + baseUri string +} + +func NewVideoAnalyzersClientWithBaseURI(endpoint string) VideoAnalyzersClient { + return VideoAnalyzersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/constants.go new file mode 100644 index 00000000000..9c9b8fcb36a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/constants.go @@ -0,0 +1,87 @@ +package videoanalyzers + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountEncryptionKeyType string + +const ( + AccountEncryptionKeyTypeCustomerKey AccountEncryptionKeyType = "CustomerKey" + AccountEncryptionKeyTypeSystemKey AccountEncryptionKeyType = "SystemKey" +) + +func PossibleValuesForAccountEncryptionKeyType() []string { + return []string{ + string(AccountEncryptionKeyTypeCustomerKey), + string(AccountEncryptionKeyTypeSystemKey), + } +} + +func parseAccountEncryptionKeyType(input string) (*AccountEncryptionKeyType, error) { + vals := map[string]AccountEncryptionKeyType{ + "customerkey": AccountEncryptionKeyTypeCustomerKey, + "systemkey": AccountEncryptionKeyTypeSystemKey, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccountEncryptionKeyType(input) + return &out, nil +} + +type CheckNameAvailabilityReason string + +const ( + CheckNameAvailabilityReasonAlreadyExists CheckNameAvailabilityReason = "AlreadyExists" + CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" +) + +func PossibleValuesForCheckNameAvailabilityReason() []string { + return []string{ + string(CheckNameAvailabilityReasonAlreadyExists), + string(CheckNameAvailabilityReasonInvalid), + } +} + +func parseCheckNameAvailabilityReason(input string) (*CheckNameAvailabilityReason, error) { + vals := map[string]CheckNameAvailabilityReason{ + "alreadyexists": CheckNameAvailabilityReasonAlreadyExists, + "invalid": CheckNameAvailabilityReasonInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CheckNameAvailabilityReason(input) + return &out, nil +} + +type VideoAnalyzerEndpointType string + +const ( + VideoAnalyzerEndpointTypeClientApi VideoAnalyzerEndpointType = "ClientApi" +) + +func PossibleValuesForVideoAnalyzerEndpointType() []string { + return []string{ + string(VideoAnalyzerEndpointTypeClientApi), + } +} + +func parseVideoAnalyzerEndpointType(input string) (*VideoAnalyzerEndpointType, error) { + vals := map[string]VideoAnalyzerEndpointType{ + "clientapi": VideoAnalyzerEndpointTypeClientApi, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VideoAnalyzerEndpointType(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_location.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_location.go new file mode 100644 index 00000000000..8405bc97c96 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_location.go @@ -0,0 +1,111 @@ +package videoanalyzers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Media/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer.go new file mode 100644 index 00000000000..9f86b938430 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer.go @@ -0,0 +1,124 @@ +package videoanalyzers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VideoAnalyzerId{} + +// VideoAnalyzerId is a struct representing the Resource ID for a Video Analyzer +type VideoAnalyzerId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewVideoAnalyzerID returns a new VideoAnalyzerId struct +func NewVideoAnalyzerID(subscriptionId string, resourceGroupName string, accountName string) VideoAnalyzerId { + return VideoAnalyzerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseVideoAnalyzerID parses 'input' into a VideoAnalyzerId +func ParseVideoAnalyzerID(input string) (*VideoAnalyzerId, error) { + parser := resourceids.NewParserFromResourceIdType(VideoAnalyzerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VideoAnalyzerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVideoAnalyzerIDInsensitively parses 'input' case-insensitively into a VideoAnalyzerId +// note: this method should only be used for API response data and not user input +func ParseVideoAnalyzerIDInsensitively(input string) (*VideoAnalyzerId, error) { + parser := resourceids.NewParserFromResourceIdType(VideoAnalyzerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VideoAnalyzerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVideoAnalyzerID checks that 'input' can be parsed as a Video Analyzer ID +func ValidateVideoAnalyzerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVideoAnalyzerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Video Analyzer ID +func (id VideoAnalyzerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Video Analyzer ID +func (id VideoAnalyzerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), + resourceids.StaticSegment("staticVideoAnalyzers", "videoAnalyzers", "videoAnalyzers"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Video Analyzer ID +func (id VideoAnalyzerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Video Analyzer (%s)", strings.Join(components, "\n")) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_locationschecknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_locationschecknameavailability_autorest.go new file mode 100644 index 00000000000..a2c647e30ee --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_locationschecknameavailability_autorest.go @@ -0,0 +1,70 @@ +package videoanalyzers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LocationsCheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameAvailabilityResponse +} + +// LocationsCheckNameAvailability ... +func (c VideoAnalyzersClient) LocationsCheckNameAvailability(ctx context.Context, id LocationId, input CheckNameAvailabilityRequest) (result LocationsCheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForLocationsCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "LocationsCheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "LocationsCheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForLocationsCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "LocationsCheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForLocationsCheckNameAvailability prepares the LocationsCheckNameAvailability request. +func (c VideoAnalyzersClient) preparerForLocationsCheckNameAvailability(ctx context.Context, id LocationId, input CheckNameAvailabilityRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForLocationsCheckNameAvailability handles the response to the LocationsCheckNameAvailability request. The method always +// closes the http.Response Body. +func (c VideoAnalyzersClient) responderForLocationsCheckNameAvailability(resp *http.Response) (result LocationsCheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerscreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerscreateorupdate_autorest.go new file mode 100644 index 00000000000..a993d2730dc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerscreateorupdate_autorest.go @@ -0,0 +1,69 @@ +package videoanalyzers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VideoAnalyzersCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *VideoAnalyzer +} + +// VideoAnalyzersCreateOrUpdate ... +func (c VideoAnalyzersClient) VideoAnalyzersCreateOrUpdate(ctx context.Context, id VideoAnalyzerId, input VideoAnalyzer) (result VideoAnalyzersCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForVideoAnalyzersCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersCreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForVideoAnalyzersCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersCreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForVideoAnalyzersCreateOrUpdate prepares the VideoAnalyzersCreateOrUpdate request. +func (c VideoAnalyzersClient) preparerForVideoAnalyzersCreateOrUpdate(ctx context.Context, id VideoAnalyzerId, input VideoAnalyzer) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForVideoAnalyzersCreateOrUpdate handles the response to the VideoAnalyzersCreateOrUpdate request. The method always +// closes the http.Response Body. +func (c VideoAnalyzersClient) responderForVideoAnalyzersCreateOrUpdate(resp *http.Response) (result VideoAnalyzersCreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersdelete_autorest.go new file mode 100644 index 00000000000..4d24a307e25 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersdelete_autorest.go @@ -0,0 +1,66 @@ +package videoanalyzers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VideoAnalyzersDeleteOperationResponse struct { + HttpResponse *http.Response +} + +// VideoAnalyzersDelete ... +func (c VideoAnalyzersClient) VideoAnalyzersDelete(ctx context.Context, id VideoAnalyzerId) (result VideoAnalyzersDeleteOperationResponse, err error) { + req, err := c.preparerForVideoAnalyzersDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersDelete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersDelete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForVideoAnalyzersDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersDelete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForVideoAnalyzersDelete prepares the VideoAnalyzersDelete request. +func (c VideoAnalyzersClient) preparerForVideoAnalyzersDelete(ctx context.Context, id VideoAnalyzerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForVideoAnalyzersDelete handles the response to the VideoAnalyzersDelete request. The method always +// closes the http.Response Body. +func (c VideoAnalyzersClient) responderForVideoAnalyzersDelete(resp *http.Response) (result VideoAnalyzersDeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersget_autorest.go new file mode 100644 index 00000000000..ba3a4446c7c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersget_autorest.go @@ -0,0 +1,68 @@ +package videoanalyzers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VideoAnalyzersGetOperationResponse struct { + HttpResponse *http.Response + Model *VideoAnalyzer +} + +// VideoAnalyzersGet ... +func (c VideoAnalyzersClient) VideoAnalyzersGet(ctx context.Context, id VideoAnalyzerId) (result VideoAnalyzersGetOperationResponse, err error) { + req, err := c.preparerForVideoAnalyzersGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForVideoAnalyzersGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForVideoAnalyzersGet prepares the VideoAnalyzersGet request. +func (c VideoAnalyzersClient) preparerForVideoAnalyzersGet(ctx context.Context, id VideoAnalyzerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForVideoAnalyzersGet handles the response to the VideoAnalyzersGet request. The method always +// closes the http.Response Body. +func (c VideoAnalyzersClient) responderForVideoAnalyzersGet(resp *http.Response) (result VideoAnalyzersGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerslist_autorest.go new file mode 100644 index 00000000000..fa6b56028fd --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerslist_autorest.go @@ -0,0 +1,70 @@ +package videoanalyzers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VideoAnalyzersListOperationResponse struct { + HttpResponse *http.Response + Model *VideoAnalyzerCollection +} + +// VideoAnalyzersList ... +func (c VideoAnalyzersClient) VideoAnalyzersList(ctx context.Context, id commonids.ResourceGroupId) (result VideoAnalyzersListOperationResponse, err error) { + req, err := c.preparerForVideoAnalyzersList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForVideoAnalyzersList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersList", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForVideoAnalyzersList prepares the VideoAnalyzersList request. +func (c VideoAnalyzersClient) preparerForVideoAnalyzersList(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Media/videoAnalyzers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForVideoAnalyzersList handles the response to the VideoAnalyzersList request. The method always +// closes the http.Response Body. +func (c VideoAnalyzersClient) responderForVideoAnalyzersList(resp *http.Response) (result VideoAnalyzersListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerslistbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerslistbysubscription_autorest.go new file mode 100644 index 00000000000..ff1762177b3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerslistbysubscription_autorest.go @@ -0,0 +1,70 @@ +package videoanalyzers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VideoAnalyzersListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *VideoAnalyzerCollection +} + +// VideoAnalyzersListBySubscription ... +func (c VideoAnalyzersClient) VideoAnalyzersListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result VideoAnalyzersListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForVideoAnalyzersListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForVideoAnalyzersListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForVideoAnalyzersListBySubscription prepares the VideoAnalyzersListBySubscription request. +func (c VideoAnalyzersClient) preparerForVideoAnalyzersListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Media/videoAnalyzers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForVideoAnalyzersListBySubscription handles the response to the VideoAnalyzersListBySubscription request. The method always +// closes the http.Response Body. +func (c VideoAnalyzersClient) responderForVideoAnalyzersListBySubscription(resp *http.Response) (result VideoAnalyzersListBySubscriptionOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerssyncstoragekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerssyncstoragekeys_autorest.go new file mode 100644 index 00000000000..da5895bcc27 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerssyncstoragekeys_autorest.go @@ -0,0 +1,68 @@ +package videoanalyzers + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VideoAnalyzersSyncStorageKeysOperationResponse struct { + HttpResponse *http.Response +} + +// VideoAnalyzersSyncStorageKeys ... +func (c VideoAnalyzersClient) VideoAnalyzersSyncStorageKeys(ctx context.Context, id VideoAnalyzerId, input SyncStorageKeysInput) (result VideoAnalyzersSyncStorageKeysOperationResponse, err error) { + req, err := c.preparerForVideoAnalyzersSyncStorageKeys(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersSyncStorageKeys", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersSyncStorageKeys", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForVideoAnalyzersSyncStorageKeys(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersSyncStorageKeys", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForVideoAnalyzersSyncStorageKeys prepares the VideoAnalyzersSyncStorageKeys request. +func (c VideoAnalyzersClient) preparerForVideoAnalyzersSyncStorageKeys(ctx context.Context, id VideoAnalyzerId, input SyncStorageKeysInput) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/syncStorageKeys", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForVideoAnalyzersSyncStorageKeys handles the response to the VideoAnalyzersSyncStorageKeys request. The method always +// closes the http.Response Body. +func (c VideoAnalyzersClient) responderForVideoAnalyzersSyncStorageKeys(resp *http.Response) (result VideoAnalyzersSyncStorageKeysOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersupdate_autorest.go new file mode 100644 index 00000000000..8ab7536c06b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersupdate_autorest.go @@ -0,0 +1,69 @@ +package videoanalyzers + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VideoAnalyzersUpdateOperationResponse struct { + HttpResponse *http.Response + Model *VideoAnalyzer +} + +// VideoAnalyzersUpdate ... +func (c VideoAnalyzersClient) VideoAnalyzersUpdate(ctx context.Context, id VideoAnalyzerId, input VideoAnalyzerUpdate) (result VideoAnalyzersUpdateOperationResponse, err error) { + req, err := c.preparerForVideoAnalyzersUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForVideoAnalyzersUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "videoanalyzers.VideoAnalyzersClient", "VideoAnalyzersUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForVideoAnalyzersUpdate prepares the VideoAnalyzersUpdate request. +func (c VideoAnalyzersClient) preparerForVideoAnalyzersUpdate(ctx context.Context, id VideoAnalyzerId, input VideoAnalyzerUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForVideoAnalyzersUpdate handles the response to the VideoAnalyzersUpdate request. The method always +// closes the http.Response Body. +func (c VideoAnalyzersClient) responderForVideoAnalyzersUpdate(resp *http.Response) (result VideoAnalyzersUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_accountencryption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_accountencryption.go new file mode 100644 index 00000000000..34f08dfc82f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_accountencryption.go @@ -0,0 +1,11 @@ +package videoanalyzers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountEncryption struct { + Identity *ResourceIdentity `json:"identity,omitempty"` + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` + Status *string `json:"status,omitempty"` + Type AccountEncryptionKeyType `json:"type"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_checknameavailabilityrequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_checknameavailabilityrequest.go new file mode 100644 index 00000000000..a53efdc08c7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_checknameavailabilityrequest.go @@ -0,0 +1,9 @@ +package videoanalyzers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityRequest struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_checknameavailabilityresponse.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_checknameavailabilityresponse.go new file mode 100644 index 00000000000..6bc73d1afbb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_checknameavailabilityresponse.go @@ -0,0 +1,10 @@ +package videoanalyzers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityResponse struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *CheckNameAvailabilityReason `json:"reason,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_endpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_endpoint.go new file mode 100644 index 00000000000..22788237336 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_endpoint.go @@ -0,0 +1,9 @@ +package videoanalyzers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Endpoint struct { + EndpointUrl *string `json:"endpointUrl,omitempty"` + Type VideoAnalyzerEndpointType `json:"type"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_keyvaultproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_keyvaultproperties.go new file mode 100644 index 00000000000..ef30930b304 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_keyvaultproperties.go @@ -0,0 +1,9 @@ +package videoanalyzers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultProperties struct { + CurrentKeyIdentifier *string `json:"currentKeyIdentifier,omitempty"` + KeyIdentifier string `json:"keyIdentifier"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_resourceidentity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_resourceidentity.go new file mode 100644 index 00000000000..a5a1ef99e41 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_resourceidentity.go @@ -0,0 +1,8 @@ +package videoanalyzers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceIdentity struct { + UserAssignedIdentity string `json:"userAssignedIdentity"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_storageaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_storageaccount.go new file mode 100644 index 00000000000..d450687d423 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_storageaccount.go @@ -0,0 +1,10 @@ +package videoanalyzers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageAccount struct { + Id *string `json:"id,omitempty"` + Identity *ResourceIdentity `json:"identity,omitempty"` + Status *string `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_syncstoragekeysinput.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_syncstoragekeysinput.go new file mode 100644 index 00000000000..c38b61caf49 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_syncstoragekeysinput.go @@ -0,0 +1,8 @@ +package videoanalyzers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SyncStorageKeysInput struct { + Id *string `json:"id,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_userassignedmanagedidentity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_userassignedmanagedidentity.go new file mode 100644 index 00000000000..dc30c306f3c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_userassignedmanagedidentity.go @@ -0,0 +1,9 @@ +package videoanalyzers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserAssignedManagedIdentity struct { + ClientId *string `json:"clientId,omitempty"` + PrincipalId *string `json:"principalId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzer.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzer.go new file mode 100644 index 00000000000..30326d20579 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzer.go @@ -0,0 +1,19 @@ +package videoanalyzers + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VideoAnalyzer struct { + Id *string `json:"id,omitempty"` + Identity *VideoAnalyzerIdentity `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VideoAnalyzerPropertiesUpdate `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzercollection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzercollection.go new file mode 100644 index 00000000000..100e14e5a13 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzercollection.go @@ -0,0 +1,8 @@ +package videoanalyzers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VideoAnalyzerCollection struct { + Value *[]VideoAnalyzer `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzeridentity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzeridentity.go new file mode 100644 index 00000000000..ac2da6867b3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzeridentity.go @@ -0,0 +1,9 @@ +package videoanalyzers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VideoAnalyzerIdentity struct { + Type string `json:"type"` + UserAssignedIdentities *map[string]UserAssignedManagedIdentity `json:"userAssignedIdentities,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzerpropertiesupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzerpropertiesupdate.go new file mode 100644 index 00000000000..59fcd01795c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzerpropertiesupdate.go @@ -0,0 +1,10 @@ +package videoanalyzers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VideoAnalyzerPropertiesUpdate struct { + Encryption *AccountEncryption `json:"encryption,omitempty"` + Endpoints *[]Endpoint `json:"endpoints,omitempty"` + StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzerupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzerupdate.go new file mode 100644 index 00000000000..47556dbbd88 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzerupdate.go @@ -0,0 +1,10 @@ +package videoanalyzers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VideoAnalyzerUpdate struct { + Identity *VideoAnalyzerIdentity `json:"identity,omitempty"` + Properties *VideoAnalyzerPropertiesUpdate `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/version.go new file mode 100644 index 00000000000..275b8e34c2e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/version.go @@ -0,0 +1,12 @@ +package videoanalyzers + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-05-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/videoanalyzers/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/README.md new file mode 100644 index 00000000000..d434ad485f4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations` Documentation + +The `authorizations` SDK allows for interaction with the Azure Resource Manager Service `vmware` (API Version `2020-03-20`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations" +``` + + +### Client Initialization + +```go +client := authorizations.NewAuthorizationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AuthorizationsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := authorizations.NewAuthorizationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue", "authorizationValue") + +payload := authorizations.ExpressRouteAuthorization{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AuthorizationsClient.Delete` + +```go +ctx := context.TODO() +id := authorizations.NewAuthorizationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue", "authorizationValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AuthorizationsClient.Get` + +```go +ctx := context.TODO() +id := authorizations.NewAuthorizationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue", "authorizationValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AuthorizationsClient.List` + +```go +ctx := context.TODO() +id := authorizations.NewPrivateCloudID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/client.go new file mode 100644 index 00000000000..b7da5521b01 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/client.go @@ -0,0 +1,18 @@ +package authorizations + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizationsClient struct { + Client autorest.Client + baseUri string +} + +func NewAuthorizationsClientWithBaseURI(endpoint string) AuthorizationsClient { + return AuthorizationsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/constants.go new file mode 100644 index 00000000000..119aad8e2f1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/constants.go @@ -0,0 +1,37 @@ +package authorizations + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExpressRouteAuthorizationProvisioningState string + +const ( + ExpressRouteAuthorizationProvisioningStateFailed ExpressRouteAuthorizationProvisioningState = "Failed" + ExpressRouteAuthorizationProvisioningStateSucceeded ExpressRouteAuthorizationProvisioningState = "Succeeded" + ExpressRouteAuthorizationProvisioningStateUpdating ExpressRouteAuthorizationProvisioningState = "Updating" +) + +func PossibleValuesForExpressRouteAuthorizationProvisioningState() []string { + return []string{ + string(ExpressRouteAuthorizationProvisioningStateFailed), + string(ExpressRouteAuthorizationProvisioningStateSucceeded), + string(ExpressRouteAuthorizationProvisioningStateUpdating), + } +} + +func parseExpressRouteAuthorizationProvisioningState(input string) (*ExpressRouteAuthorizationProvisioningState, error) { + vals := map[string]ExpressRouteAuthorizationProvisioningState{ + "failed": ExpressRouteAuthorizationProvisioningStateFailed, + "succeeded": ExpressRouteAuthorizationProvisioningStateSucceeded, + "updating": ExpressRouteAuthorizationProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExpressRouteAuthorizationProvisioningState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/id_authorization.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/id_authorization.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/id_authorization.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/id_authorization.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/id_privatecloud.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/id_privatecloud.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/id_privatecloud.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/id_privatecloud.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_createorupdate_autorest.go new file mode 100644 index 00000000000..ad84c9aae97 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package authorizations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c AuthorizationsClient) CreateOrUpdate(ctx context.Context, id AuthorizationId, input ExpressRouteAuthorization) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c AuthorizationsClient) CreateOrUpdateThenPoll(ctx context.Context, id AuthorizationId, input ExpressRouteAuthorization) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c AuthorizationsClient) preparerForCreateOrUpdate(ctx context.Context, id AuthorizationId, input ExpressRouteAuthorization) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c AuthorizationsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_delete_autorest.go new file mode 100644 index 00000000000..05d083a7202 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_delete_autorest.go @@ -0,0 +1,78 @@ +package authorizations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c AuthorizationsClient) Delete(ctx context.Context, id AuthorizationId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c AuthorizationsClient) DeleteThenPoll(ctx context.Context, id AuthorizationId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c AuthorizationsClient) preparerForDelete(ctx context.Context, id AuthorizationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c AuthorizationsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_get_autorest.go new file mode 100644 index 00000000000..611e5dbc73a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_get_autorest.go @@ -0,0 +1,68 @@ +package authorizations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ExpressRouteAuthorization +} + +// Get ... +func (c AuthorizationsClient) Get(ctx context.Context, id AuthorizationId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c AuthorizationsClient) preparerForGet(ctx context.Context, id AuthorizationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c AuthorizationsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_list_autorest.go new file mode 100644 index 00000000000..bb6006caffe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/method_list_autorest.go @@ -0,0 +1,186 @@ +package authorizations + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]ExpressRouteAuthorization + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []ExpressRouteAuthorization +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c AuthorizationsClient) List(ctx context.Context, id PrivateCloudId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c AuthorizationsClient) preparerForList(ctx context.Context, id PrivateCloudId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/authorizations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c AuthorizationsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c AuthorizationsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []ExpressRouteAuthorization `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c AuthorizationsClient) ListComplete(ctx context.Context, id PrivateCloudId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ExpressRouteAuthorizationOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AuthorizationsClient) ListCompleteMatchingPredicate(ctx context.Context, id PrivateCloudId, predicate ExpressRouteAuthorizationOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]ExpressRouteAuthorization, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/model_expressrouteauthorization.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/model_expressrouteauthorization.go new file mode 100644 index 00000000000..d084133a61e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/model_expressrouteauthorization.go @@ -0,0 +1,11 @@ +package authorizations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExpressRouteAuthorization struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ExpressRouteAuthorizationProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/model_expressrouteauthorizationproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/model_expressrouteauthorizationproperties.go new file mode 100644 index 00000000000..a90f91310ec --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/model_expressrouteauthorizationproperties.go @@ -0,0 +1,10 @@ +package authorizations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExpressRouteAuthorizationProperties struct { + ExpressRouteAuthorizationId *string `json:"expressRouteAuthorizationId,omitempty"` + ExpressRouteAuthorizationKey *string `json:"expressRouteAuthorizationKey,omitempty"` + ProvisioningState *ExpressRouteAuthorizationProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/predicates.go new file mode 100644 index 00000000000..63a15378103 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/predicates.go @@ -0,0 +1,24 @@ +package authorizations + +type ExpressRouteAuthorizationOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ExpressRouteAuthorizationOperationPredicate) Matches(input ExpressRouteAuthorization) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/version.go new file mode 100644 index 00000000000..a2ced400b40 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations/version.go @@ -0,0 +1,12 @@ +package authorizations + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-03-20" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/authorizations/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/README.md new file mode 100644 index 00000000000..931cc65014c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters` Documentation + +The `clusters` SDK allows for interaction with the Azure Resource Manager Service `vmware` (API Version `2020-03-20`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters" +``` + + +### Client Initialization + +```go +client := clusters.NewClustersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ClustersClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue", "clusterValue") + +payload := clusters.Cluster{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClustersClient.Delete` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue", "clusterValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClustersClient.Get` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue", "clusterValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClustersClient.List` + +```go +ctx := context.TODO() +id := clusters.NewPrivateCloudID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ClustersClient.Update` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue", "clusterValue") + +payload := clusters.ClusterUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/client.go new file mode 100644 index 00000000000..1e6fabf8cba --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/client.go @@ -0,0 +1,18 @@ +package clusters + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClustersClient struct { + Client autorest.Client + baseUri string +} + +func NewClustersClientWithBaseURI(endpoint string) ClustersClient { + return ClustersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/constants.go new file mode 100644 index 00000000000..bff8f45efae --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/constants.go @@ -0,0 +1,43 @@ +package clusters + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterProvisioningState string + +const ( + ClusterProvisioningStateCancelled ClusterProvisioningState = "Cancelled" + ClusterProvisioningStateDeleting ClusterProvisioningState = "Deleting" + ClusterProvisioningStateFailed ClusterProvisioningState = "Failed" + ClusterProvisioningStateSucceeded ClusterProvisioningState = "Succeeded" + ClusterProvisioningStateUpdating ClusterProvisioningState = "Updating" +) + +func PossibleValuesForClusterProvisioningState() []string { + return []string{ + string(ClusterProvisioningStateCancelled), + string(ClusterProvisioningStateDeleting), + string(ClusterProvisioningStateFailed), + string(ClusterProvisioningStateSucceeded), + string(ClusterProvisioningStateUpdating), + } +} + +func parseClusterProvisioningState(input string) (*ClusterProvisioningState, error) { + vals := map[string]ClusterProvisioningState{ + "cancelled": ClusterProvisioningStateCancelled, + "deleting": ClusterProvisioningStateDeleting, + "failed": ClusterProvisioningStateFailed, + "succeeded": ClusterProvisioningStateSucceeded, + "updating": ClusterProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterProvisioningState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/id_cluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/id_cluster.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/id_cluster.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/id_cluster.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/id_privatecloud.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/id_privatecloud.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/id_privatecloud.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/id_privatecloud.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_createorupdate_autorest.go new file mode 100644 index 00000000000..1e25becc0a4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c ClustersClient) CreateOrUpdate(ctx context.Context, id ClusterId, input Cluster) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ClustersClient) CreateOrUpdateThenPoll(ctx context.Context, id ClusterId, input Cluster) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ClustersClient) preparerForCreateOrUpdate(ctx context.Context, id ClusterId, input Cluster) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ClustersClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_delete_autorest.go new file mode 100644 index 00000000000..285ecf817e5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_delete_autorest.go @@ -0,0 +1,78 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ClustersClient) Delete(ctx context.Context, id ClusterId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ClustersClient) DeleteThenPoll(ctx context.Context, id ClusterId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ClustersClient) preparerForDelete(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ClustersClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_get_autorest.go new file mode 100644 index 00000000000..2957d3dd8de --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_get_autorest.go @@ -0,0 +1,68 @@ +package clusters + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Cluster +} + +// Get ... +func (c ClustersClient) Get(ctx context.Context, id ClusterId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ClustersClient) preparerForGet(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_list_autorest.go new file mode 100644 index 00000000000..0d73a89a9da --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_list_autorest.go @@ -0,0 +1,186 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Cluster + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Cluster +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c ClustersClient) List(ctx context.Context, id PrivateCloudId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c ClustersClient) preparerForList(ctx context.Context, id PrivateCloudId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/clusters", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c ClustersClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Cluster `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c ClustersClient) ListComplete(ctx context.Context, id PrivateCloudId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ClusterOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ClustersClient) ListCompleteMatchingPredicate(ctx context.Context, id PrivateCloudId, predicate ClusterOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Cluster, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_update_autorest.go new file mode 100644 index 00000000000..e710aa964e7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/method_update_autorest.go @@ -0,0 +1,79 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c ClustersClient) Update(ctx context.Context, id ClusterId, input ClusterUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ClustersClient) UpdateThenPoll(ctx context.Context, id ClusterId, input ClusterUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c ClustersClient) preparerForUpdate(ctx context.Context, id ClusterId, input ClusterUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c ClustersClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_cluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_cluster.go new file mode 100644 index 00000000000..01f966a166d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_cluster.go @@ -0,0 +1,12 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Cluster struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties ClusterProperties `json:"properties"` + Sku Sku `json:"sku"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterproperties.go new file mode 100644 index 00000000000..8644b5b74e9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterproperties.go @@ -0,0 +1,11 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterProperties struct { + ClusterId *int64 `json:"clusterId,omitempty"` + ClusterSize int64 `json:"clusterSize"` + Hosts *[]string `json:"hosts,omitempty"` + ProvisioningState *ClusterProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterupdate.go new file mode 100644 index 00000000000..8efeffc2e52 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterupdate.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterUpdate struct { + Properties *ClusterUpdateProperties `json:"properties,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterupdateproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterupdateproperties.go new file mode 100644 index 00000000000..21250bcc6e7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_clusterupdateproperties.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterUpdateProperties struct { + ClusterSize *int64 `json:"clusterSize,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_sku.go new file mode 100644 index 00000000000..5df972a0ee8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/model_sku.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name string `json:"name"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/predicates.go new file mode 100644 index 00000000000..a661726c897 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/predicates.go @@ -0,0 +1,24 @@ +package clusters + +type ClusterOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p ClusterOperationPredicate) Matches(input Cluster) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/version.go new file mode 100644 index 00000000000..69aa5d35400 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters/version.go @@ -0,0 +1,12 @@ +package clusters + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-03-20" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/clusters/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/README.md new file mode 100644 index 00000000000..d97c222a520 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/README.md @@ -0,0 +1,132 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds` Documentation + +The `privateclouds` SDK allows for interaction with the Azure Resource Manager Service `vmware` (API Version `2020-03-20`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" +``` + + +### Client Initialization + +```go +client := privateclouds.NewPrivateCloudsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateCloudsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := privateclouds.NewPrivateCloudID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue") + +payload := privateclouds.PrivateCloud{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateCloudsClient.Delete` + +```go +ctx := context.TODO() +id := privateclouds.NewPrivateCloudID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateCloudsClient.Get` + +```go +ctx := context.TODO() +id := privateclouds.NewPrivateCloudID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateCloudsClient.List` + +```go +ctx := context.TODO() +id := privateclouds.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `PrivateCloudsClient.ListAdminCredentials` + +```go +ctx := context.TODO() +id := privateclouds.NewPrivateCloudID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue") + +read, err := client.ListAdminCredentials(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateCloudsClient.ListInSubscription` + +```go +ctx := context.TODO() +id := privateclouds.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListInSubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListInSubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `PrivateCloudsClient.Update` + +```go +ctx := context.TODO() +id := privateclouds.NewPrivateCloudID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateCloudValue") + +payload := privateclouds.PrivateCloudUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/client.go new file mode 100644 index 00000000000..ac21fbe62be --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/client.go @@ -0,0 +1,18 @@ +package privateclouds + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateCloudsClient struct { + Client autorest.Client + baseUri string +} + +func NewPrivateCloudsClientWithBaseURI(endpoint string) PrivateCloudsClient { + return PrivateCloudsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/constants.go new file mode 100644 index 00000000000..d3059c253c4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/constants.go @@ -0,0 +1,142 @@ +package privateclouds + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterProvisioningState string + +const ( + ClusterProvisioningStateCancelled ClusterProvisioningState = "Cancelled" + ClusterProvisioningStateDeleting ClusterProvisioningState = "Deleting" + ClusterProvisioningStateFailed ClusterProvisioningState = "Failed" + ClusterProvisioningStateSucceeded ClusterProvisioningState = "Succeeded" + ClusterProvisioningStateUpdating ClusterProvisioningState = "Updating" +) + +func PossibleValuesForClusterProvisioningState() []string { + return []string{ + string(ClusterProvisioningStateCancelled), + string(ClusterProvisioningStateDeleting), + string(ClusterProvisioningStateFailed), + string(ClusterProvisioningStateSucceeded), + string(ClusterProvisioningStateUpdating), + } +} + +func parseClusterProvisioningState(input string) (*ClusterProvisioningState, error) { + vals := map[string]ClusterProvisioningState{ + "cancelled": ClusterProvisioningStateCancelled, + "deleting": ClusterProvisioningStateDeleting, + "failed": ClusterProvisioningStateFailed, + "succeeded": ClusterProvisioningStateSucceeded, + "updating": ClusterProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterProvisioningState(input) + return &out, nil +} + +type InternetEnum string + +const ( + InternetEnumDisabled InternetEnum = "Disabled" + InternetEnumEnabled InternetEnum = "Enabled" +) + +func PossibleValuesForInternetEnum() []string { + return []string{ + string(InternetEnumDisabled), + string(InternetEnumEnabled), + } +} + +func parseInternetEnum(input string) (*InternetEnum, error) { + vals := map[string]InternetEnum{ + "disabled": InternetEnumDisabled, + "enabled": InternetEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InternetEnum(input) + return &out, nil +} + +type PrivateCloudProvisioningState string + +const ( + PrivateCloudProvisioningStateBuilding PrivateCloudProvisioningState = "Building" + PrivateCloudProvisioningStateCancelled PrivateCloudProvisioningState = "Cancelled" + PrivateCloudProvisioningStateDeleting PrivateCloudProvisioningState = "Deleting" + PrivateCloudProvisioningStateFailed PrivateCloudProvisioningState = "Failed" + PrivateCloudProvisioningStatePending PrivateCloudProvisioningState = "Pending" + PrivateCloudProvisioningStateSucceeded PrivateCloudProvisioningState = "Succeeded" + PrivateCloudProvisioningStateUpdating PrivateCloudProvisioningState = "Updating" +) + +func PossibleValuesForPrivateCloudProvisioningState() []string { + return []string{ + string(PrivateCloudProvisioningStateBuilding), + string(PrivateCloudProvisioningStateCancelled), + string(PrivateCloudProvisioningStateDeleting), + string(PrivateCloudProvisioningStateFailed), + string(PrivateCloudProvisioningStatePending), + string(PrivateCloudProvisioningStateSucceeded), + string(PrivateCloudProvisioningStateUpdating), + } +} + +func parsePrivateCloudProvisioningState(input string) (*PrivateCloudProvisioningState, error) { + vals := map[string]PrivateCloudProvisioningState{ + "building": PrivateCloudProvisioningStateBuilding, + "cancelled": PrivateCloudProvisioningStateCancelled, + "deleting": PrivateCloudProvisioningStateDeleting, + "failed": PrivateCloudProvisioningStateFailed, + "pending": PrivateCloudProvisioningStatePending, + "succeeded": PrivateCloudProvisioningStateSucceeded, + "updating": PrivateCloudProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateCloudProvisioningState(input) + return &out, nil +} + +type SslEnum string + +const ( + SslEnumDisabled SslEnum = "Disabled" + SslEnumEnabled SslEnum = "Enabled" +) + +func PossibleValuesForSslEnum() []string { + return []string{ + string(SslEnumDisabled), + string(SslEnumEnabled), + } +} + +func parseSslEnum(input string) (*SslEnum, error) { + vals := map[string]SslEnum{ + "disabled": SslEnumDisabled, + "enabled": SslEnumEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SslEnum(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/id_privatecloud.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/id_privatecloud.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/id_privatecloud.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/id_privatecloud.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_createorupdate_autorest.go new file mode 100644 index 00000000000..554983a1f61 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package privateclouds + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c PrivateCloudsClient) CreateOrUpdate(ctx context.Context, id PrivateCloudId, input PrivateCloud) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c PrivateCloudsClient) CreateOrUpdateThenPoll(ctx context.Context, id PrivateCloudId, input PrivateCloud) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c PrivateCloudsClient) preparerForCreateOrUpdate(ctx context.Context, id PrivateCloudId, input PrivateCloud) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateCloudsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_delete_autorest.go new file mode 100644 index 00000000000..4670d907934 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_delete_autorest.go @@ -0,0 +1,78 @@ +package privateclouds + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c PrivateCloudsClient) Delete(ctx context.Context, id PrivateCloudId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c PrivateCloudsClient) DeleteThenPoll(ctx context.Context, id PrivateCloudId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c PrivateCloudsClient) preparerForDelete(ctx context.Context, id PrivateCloudId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateCloudsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_get_autorest.go new file mode 100644 index 00000000000..d05983cf3d6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_get_autorest.go @@ -0,0 +1,68 @@ +package privateclouds + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *PrivateCloud +} + +// Get ... +func (c PrivateCloudsClient) Get(ctx context.Context, id PrivateCloudId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c PrivateCloudsClient) preparerForGet(ctx context.Context, id PrivateCloudId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c PrivateCloudsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_list_autorest.go new file mode 100644 index 00000000000..e3dc8416950 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_list_autorest.go @@ -0,0 +1,187 @@ +package privateclouds + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]PrivateCloud + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []PrivateCloud +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c PrivateCloudsClient) List(ctx context.Context, id commonids.ResourceGroupId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c PrivateCloudsClient) preparerForList(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AVS/privateClouds", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c PrivateCloudsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c PrivateCloudsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []PrivateCloud `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c PrivateCloudsClient) ListComplete(ctx context.Context, id commonids.ResourceGroupId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, PrivateCloudOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PrivateCloudsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate PrivateCloudOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]PrivateCloud, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_listadmincredentials_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_listadmincredentials_autorest.go similarity index 84% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_listadmincredentials_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_listadmincredentials_autorest.go index cb252ccc6d5..74d8f2cf7ad 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_listadmincredentials_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_listadmincredentials_autorest.go @@ -9,13 +9,16 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) -type ListAdminCredentialsResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListAdminCredentialsOperationResponse struct { HttpResponse *http.Response Model *AdminCredentials } // ListAdminCredentials ... -func (c PrivateCloudsClient) ListAdminCredentials(ctx context.Context, id PrivateCloudId) (result ListAdminCredentialsResponse, err error) { +func (c PrivateCloudsClient) ListAdminCredentials(ctx context.Context, id PrivateCloudId) (result ListAdminCredentialsOperationResponse, err error) { req, err := c.preparerForListAdminCredentials(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "ListAdminCredentials", nil, "Failure preparing request") @@ -54,12 +57,13 @@ func (c PrivateCloudsClient) preparerForListAdminCredentials(ctx context.Context // responderForListAdminCredentials handles the response to the ListAdminCredentials request. The method always // closes the http.Response Body. -func (c PrivateCloudsClient) responderForListAdminCredentials(resp *http.Response) (result ListAdminCredentialsResponse, err error) { +func (c PrivateCloudsClient) responderForListAdminCredentials(resp *http.Response) (result ListAdminCredentialsOperationResponse, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_listinsubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_listinsubscription_autorest.go similarity index 83% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_listinsubscription_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_listinsubscription_autorest.go index 2671b8f12d4..d5eb4718623 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_listinsubscription_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_listinsubscription_autorest.go @@ -8,25 +8,29 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" ) -type ListInSubscriptionResponse struct { +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListInSubscriptionOperationResponse struct { HttpResponse *http.Response Model *[]PrivateCloud nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListInSubscriptionResponse, error) + nextPageFunc func(ctx context.Context, nextLink string) (ListInSubscriptionOperationResponse, error) } type ListInSubscriptionCompleteResult struct { Items []PrivateCloud } -func (r ListInSubscriptionResponse) HasMore() bool { +func (r ListInSubscriptionOperationResponse) HasMore() bool { return r.nextLink != nil } -func (r ListInSubscriptionResponse) LoadMore(ctx context.Context) (resp ListInSubscriptionResponse, err error) { +func (r ListInSubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListInSubscriptionOperationResponse, err error) { if !r.HasMore() { err = fmt.Errorf("no more pages returned") return @@ -35,7 +39,7 @@ func (r ListInSubscriptionResponse) LoadMore(ctx context.Context) (resp ListInSu } // ListInSubscription ... -func (c PrivateCloudsClient) ListInSubscription(ctx context.Context, id SubscriptionId) (resp ListInSubscriptionResponse, err error) { +func (c PrivateCloudsClient) ListInSubscription(ctx context.Context, id commonids.SubscriptionId) (resp ListInSubscriptionOperationResponse, err error) { req, err := c.preparerForListInSubscription(ctx, id) if err != nil { err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "ListInSubscription", nil, "Failure preparing request") @@ -56,52 +60,8 @@ func (c PrivateCloudsClient) ListInSubscription(ctx context.Context, id Subscrip return } -// ListInSubscriptionComplete retrieves all of the results into a single object -func (c PrivateCloudsClient) ListInSubscriptionComplete(ctx context.Context, id SubscriptionId) (ListInSubscriptionCompleteResult, error) { - return c.ListInSubscriptionCompleteMatchingPredicate(ctx, id, PrivateCloudPredicate{}) -} - -// ListInSubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c PrivateCloudsClient) ListInSubscriptionCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate PrivateCloudPredicate) (resp ListInSubscriptionCompleteResult, err error) { - items := make([]PrivateCloud, 0) - - page, err := c.ListInSubscription(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListInSubscriptionCompleteResult{ - Items: items, - } - return out, nil -} - // preparerForListInSubscription prepares the ListInSubscription request. -func (c PrivateCloudsClient) preparerForListInSubscription(ctx context.Context, id SubscriptionId) (*http.Request, error) { +func (c PrivateCloudsClient) preparerForListInSubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { queryParameters := map[string]interface{}{ "api-version": defaultApiVersion, } @@ -142,7 +102,7 @@ func (c PrivateCloudsClient) preparerForListInSubscriptionWithNextLink(ctx conte // responderForListInSubscription handles the response to the ListInSubscription request. The method always // closes the http.Response Body. -func (c PrivateCloudsClient) responderForListInSubscription(resp *http.Response) (result ListInSubscriptionResponse, err error) { +func (c PrivateCloudsClient) responderForListInSubscription(resp *http.Response) (result ListInSubscriptionOperationResponse, err error) { type page struct { Values []PrivateCloud `json:"value"` NextLink *string `json:"nextLink"` @@ -157,7 +117,7 @@ func (c PrivateCloudsClient) responderForListInSubscription(resp *http.Response) result.Model = &respObj.Values result.nextLink = respObj.NextLink if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListInSubscriptionResponse, err error) { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListInSubscriptionOperationResponse, err error) { req, err := c.preparerForListInSubscriptionWithNextLink(ctx, nextLink) if err != nil { err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "ListInSubscription", nil, "Failure preparing request") @@ -181,3 +141,47 @@ func (c PrivateCloudsClient) responderForListInSubscription(resp *http.Response) } return } + +// ListInSubscriptionComplete retrieves all of the results into a single object +func (c PrivateCloudsClient) ListInSubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListInSubscriptionCompleteResult, error) { + return c.ListInSubscriptionCompleteMatchingPredicate(ctx, id, PrivateCloudOperationPredicate{}) +} + +// ListInSubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c PrivateCloudsClient) ListInSubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate PrivateCloudOperationPredicate) (resp ListInSubscriptionCompleteResult, err error) { + items := make([]PrivateCloud, 0) + + page, err := c.ListInSubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListInSubscriptionCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_update_autorest.go new file mode 100644 index 00000000000..c96a6eaacd6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/method_update_autorest.go @@ -0,0 +1,79 @@ +package privateclouds + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c PrivateCloudsClient) Update(ctx context.Context, id PrivateCloudId, input PrivateCloudUpdate) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c PrivateCloudsClient) UpdateThenPoll(ctx context.Context, id PrivateCloudId, input PrivateCloudUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c PrivateCloudsClient) preparerForUpdate(ctx context.Context, id PrivateCloudId, input PrivateCloudUpdate) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c PrivateCloudsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_admincredentials.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_admincredentials.go new file mode 100644 index 00000000000..317e242c198 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_admincredentials.go @@ -0,0 +1,11 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdminCredentials struct { + NsxtPassword *string `json:"nsxtPassword,omitempty"` + NsxtUsername *string `json:"nsxtUsername,omitempty"` + VcenterPassword *string `json:"vcenterPassword,omitempty"` + VcenterUsername *string `json:"vcenterUsername,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_circuit.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_circuit.go new file mode 100644 index 00000000000..3b8c02e35ad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_circuit.go @@ -0,0 +1,11 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Circuit struct { + ExpressRouteID *string `json:"expressRouteID,omitempty"` + ExpressRoutePrivatePeeringID *string `json:"expressRoutePrivatePeeringID,omitempty"` + PrimarySubnet *string `json:"primarySubnet,omitempty"` + SecondarySubnet *string `json:"secondarySubnet,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_endpoints.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_endpoints.go new file mode 100644 index 00000000000..a41c0cd0c6a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_endpoints.go @@ -0,0 +1,10 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Endpoints struct { + HcxCloudManager *string `json:"hcxCloudManager,omitempty"` + NsxtManager *string `json:"nsxtManager,omitempty"` + Vcsa *string `json:"vcsa,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_identitysource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_identitysource.go similarity index 79% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_identitysource.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_identitysource.go index 928e501c918..7e2b7c4d999 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_identitysource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_identitysource.go @@ -1,5 +1,8 @@ package privateclouds +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type IdentitySource struct { Alias *string `json:"alias,omitempty"` BaseGroupDN *string `json:"baseGroupDN,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_managementcluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_managementcluster.go new file mode 100644 index 00000000000..2b8e3db38e1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_managementcluster.go @@ -0,0 +1,11 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagementCluster struct { + ClusterId *int64 `json:"clusterId,omitempty"` + ClusterSize int64 `json:"clusterSize"` + Hosts *[]string `json:"hosts,omitempty"` + ProvisioningState *ClusterProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloud.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloud.go new file mode 100644 index 00000000000..24291a3476e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloud.go @@ -0,0 +1,14 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateCloud struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties PrivateCloudProperties `json:"properties"` + Sku Sku `json:"sku"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_privatecloudproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudproperties.go similarity index 89% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_privatecloudproperties.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudproperties.go index 4048f429bad..02866a02dc0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_privatecloudproperties.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudproperties.go @@ -1,5 +1,8 @@ package privateclouds +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type PrivateCloudProperties struct { Circuit *Circuit `json:"circuit,omitempty"` Endpoints *Endpoints `json:"endpoints,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudupdate.go new file mode 100644 index 00000000000..140b298787e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudupdate.go @@ -0,0 +1,9 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateCloudUpdate struct { + Properties *PrivateCloudUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudupdateproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudupdateproperties.go new file mode 100644 index 00000000000..8d5a5601b60 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_privatecloudupdateproperties.go @@ -0,0 +1,10 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateCloudUpdateProperties struct { + IdentitySources *[]IdentitySource `json:"identitySources,omitempty"` + Internet *InternetEnum `json:"internet,omitempty"` + ManagementCluster *ManagementCluster `json:"managementCluster,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_sku.go new file mode 100644 index 00000000000..506b9aee2d0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/model_sku.go @@ -0,0 +1,8 @@ +package privateclouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Name string `json:"name"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/predicates.go new file mode 100644 index 00000000000..30d7f7d026e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/predicates.go @@ -0,0 +1,29 @@ +package privateclouds + +type PrivateCloudOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p PrivateCloudOperationPredicate) Matches(input PrivateCloud) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/version.go new file mode 100644 index 00000000000..7a3d40cf8e5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds/version.go @@ -0,0 +1,12 @@ +package privateclouds + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-03-20" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/privateclouds/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/README.md new file mode 100644 index 00000000000..2d1e438b42d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/README.md @@ -0,0 +1,152 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections` Documentation + +The `connections` SDK allows for interaction with the Azure Resource Manager Service `web` (API Version `2016-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections" +``` + + +### Client Initialization + +```go +client := connections.NewConnectionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ConnectionsClient.ConfirmConsentCode` + +```go +ctx := context.TODO() +id := connections.NewConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "connectionValue") + +payload := connections.ConfirmConsentCodeDefinition{ + // ... +} + + +read, err := client.ConfirmConsentCode(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConnectionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := connections.NewConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "connectionValue") + +payload := connections.ApiConnectionDefinition{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConnectionsClient.Delete` + +```go +ctx := context.TODO() +id := connections.NewConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "connectionValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConnectionsClient.Get` + +```go +ctx := context.TODO() +id := connections.NewConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "connectionValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConnectionsClient.List` + +```go +ctx := context.TODO() +id := connections.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.List(ctx, id, connections.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConnectionsClient.ListConsentLinks` + +```go +ctx := context.TODO() +id := connections.NewConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "connectionValue") + +payload := connections.ListConsentLinksDefinition{ + // ... +} + + +read, err := client.ListConsentLinks(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ConnectionsClient.Update` + +```go +ctx := context.TODO() +id := connections.NewConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "connectionValue") + +payload := connections.ApiConnectionDefinition{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/client.go new file mode 100644 index 00000000000..60dc2ebd15e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/client.go @@ -0,0 +1,18 @@ +package connections + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectionsClient struct { + Client autorest.Client + baseUri string +} + +func NewConnectionsClientWithBaseURI(endpoint string) ConnectionsClient { + return ConnectionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/constants.go new file mode 100644 index 00000000000..effd8664188 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/constants.go @@ -0,0 +1,37 @@ +package connections + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkState string + +const ( + LinkStateAuthenticated LinkState = "Authenticated" + LinkStateError LinkState = "Error" + LinkStateUnauthenticated LinkState = "Unauthenticated" +) + +func PossibleValuesForLinkState() []string { + return []string{ + string(LinkStateAuthenticated), + string(LinkStateError), + string(LinkStateUnauthenticated), + } +} + +func parseLinkState(input string) (*LinkState, error) { + vals := map[string]LinkState{ + "authenticated": LinkStateAuthenticated, + "error": LinkStateError, + "unauthenticated": LinkStateUnauthenticated, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinkState(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/id_connection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/id_connection.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/id_connection.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/id_connection.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_confirmconsentcode_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_confirmconsentcode_autorest.go similarity index 93% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_confirmconsentcode_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_confirmconsentcode_autorest.go index 248f5f1e912..b646e40521a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_confirmconsentcode_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_confirmconsentcode_autorest.go @@ -9,6 +9,9 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ConfirmConsentCodeOperationResponse struct { HttpResponse *http.Response Model *ConfirmConsentCodeDefinition @@ -62,5 +65,6 @@ func (c ConnectionsClient) responderForConfirmConsentCode(resp *http.Response) ( autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_createorupdate_autorest.go new file mode 100644 index 00000000000..09efa338eab --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package connections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *ApiConnectionDefinition +} + +// CreateOrUpdate ... +func (c ConnectionsClient) CreateOrUpdate(ctx context.Context, id ConnectionId, input ApiConnectionDefinition) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ConnectionsClient) preparerForCreateOrUpdate(ctx context.Context, id ConnectionId, input ApiConnectionDefinition) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c ConnectionsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_delete_autorest.go new file mode 100644 index 00000000000..d28a83ac6a8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_delete_autorest.go @@ -0,0 +1,66 @@ +package connections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response +} + +// Delete ... +func (c ConnectionsClient) Delete(ctx context.Context, id ConnectionId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c ConnectionsClient) preparerForDelete(ctx context.Context, id ConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c ConnectionsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_get_autorest.go new file mode 100644 index 00000000000..c2dc83d1692 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_get_autorest.go @@ -0,0 +1,68 @@ +package connections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ApiConnectionDefinition +} + +// Get ... +func (c ConnectionsClient) Get(ctx context.Context, id ConnectionId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ConnectionsClient) preparerForGet(ctx context.Context, id ConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ConnectionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_list_autorest.go new file mode 100644 index 00000000000..f6e3e97a165 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_list_autorest.go @@ -0,0 +1,104 @@ +package connections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *ApiConnectionDefinitionCollection +} + +type ListOperationOptions struct { + Filter *string + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o ListOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.Filter != nil { + out["$filter"] = *o.Filter + } + + if o.Top != nil { + out["$top"] = *o.Top + } + + return out +} + +// List ... +func (c ConnectionsClient) List(ctx context.Context, id commonids.ResourceGroupId, options ListOperationOptions) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c ConnectionsClient) preparerForList(ctx context.Context, id commonids.ResourceGroupId, options ListOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Web/connections", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ConnectionsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_listconsentlinks_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_listconsentlinks_autorest.go similarity index 93% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_listconsentlinks_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_listconsentlinks_autorest.go index 8fd54bcf3c0..04c12602d59 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_listconsentlinks_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_listconsentlinks_autorest.go @@ -9,6 +9,9 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ListConsentLinksOperationResponse struct { HttpResponse *http.Response Model *ConsentLinkCollection @@ -62,5 +65,6 @@ func (c ConnectionsClient) responderForListConsentLinks(resp *http.Response) (re autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_update_autorest.go new file mode 100644 index 00000000000..e652f3c3cec --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/method_update_autorest.go @@ -0,0 +1,69 @@ +package connections + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + HttpResponse *http.Response + Model *ApiConnectionDefinition +} + +// Update ... +func (c ConnectionsClient) Update(ctx context.Context, id ConnectionId, input ApiConnectionDefinition) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Update", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Update", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForUpdate prepares the Update request. +func (c ConnectionsClient) preparerForUpdate(ctx context.Context, id ConnectionId, input ApiConnectionDefinition) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForUpdate handles the response to the Update request. The method always +// closes the http.Response Body. +func (c ConnectionsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_apiconnectiondefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_apiconnectiondefinition.go similarity index 78% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_apiconnectiondefinition.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_apiconnectiondefinition.go index 13ae1bc6f44..e7d55f7bd4e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_apiconnectiondefinition.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_apiconnectiondefinition.go @@ -1,5 +1,8 @@ package connections +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ApiConnectionDefinition struct { Etag *string `json:"etag,omitempty"` Id *string `json:"id,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_apiconnectiondefinitioncollection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_apiconnectiondefinitioncollection.go new file mode 100644 index 00000000000..75b62d73bc7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_apiconnectiondefinitioncollection.go @@ -0,0 +1,8 @@ +package connections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiConnectionDefinitionCollection struct { + Value *[]ApiConnectionDefinition `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_apiconnectiondefinitionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_apiconnectiondefinitionproperties.go new file mode 100644 index 00000000000..c07c119eb10 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_apiconnectiondefinitionproperties.go @@ -0,0 +1,46 @@ +package connections + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiConnectionDefinitionProperties struct { + Api *ApiReference `json:"api,omitempty"` + ChangedTime *string `json:"changedTime,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` + CustomParameterValues *map[string]string `json:"customParameterValues,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + NonSecretParameterValues *map[string]string `json:"nonSecretParameterValues,omitempty"` + ParameterValues *map[string]string `json:"parameterValues,omitempty"` + Statuses *[]ConnectionStatusDefinition `json:"statuses,omitempty"` + TestLinks *[]ApiConnectionTestLink `json:"testLinks,omitempty"` +} + +func (o *ApiConnectionDefinitionProperties) GetChangedTimeAsTime() (*time.Time, error) { + if o.ChangedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ChangedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ApiConnectionDefinitionProperties) SetChangedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ChangedTime = &formatted +} + +func (o *ApiConnectionDefinitionProperties) GetCreatedTimeAsTime() (*time.Time, error) { + if o.CreatedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ApiConnectionDefinitionProperties) SetCreatedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTime = &formatted +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_apiconnectiontestlink.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_apiconnectiontestlink.go new file mode 100644 index 00000000000..c704209e689 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_apiconnectiontestlink.go @@ -0,0 +1,9 @@ +package connections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiConnectionTestLink struct { + Method *string `json:"method,omitempty"` + RequestUri *string `json:"requestUri,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_apireference.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_apireference.go similarity index 75% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_apireference.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_apireference.go index 5d14b905d6f..3e052d79e5a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_apireference.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_apireference.go @@ -1,5 +1,8 @@ package connections +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ApiReference struct { BrandColor *string `json:"brandColor,omitempty"` Description *string `json:"description,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_confirmconsentcodedefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_confirmconsentcodedefinition.go new file mode 100644 index 00000000000..60d0a321a72 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_confirmconsentcodedefinition.go @@ -0,0 +1,10 @@ +package connections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfirmConsentCodeDefinition struct { + Code *string `json:"code,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_connectionerror.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_connectionerror.go similarity index 76% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_connectionerror.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_connectionerror.go index b37c668b7e0..bd5d7c51bb5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_connectionerror.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_connectionerror.go @@ -1,5 +1,8 @@ package connections +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ConnectionError struct { Etag *string `json:"etag,omitempty"` Id *string `json:"id,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_connectionerrorproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_connectionerrorproperties.go new file mode 100644 index 00000000000..bad3e413f09 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_connectionerrorproperties.go @@ -0,0 +1,9 @@ +package connections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectionErrorProperties struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_connectionstatusdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_connectionstatusdefinition.go new file mode 100644 index 00000000000..6e9a90e02e8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_connectionstatusdefinition.go @@ -0,0 +1,10 @@ +package connections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectionStatusDefinition struct { + Error *ConnectionError `json:"error,omitempty"` + Status *string `json:"status,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_consentlinkcollection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_consentlinkcollection.go new file mode 100644 index 00000000000..ad69db0f398 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_consentlinkcollection.go @@ -0,0 +1,8 @@ +package connections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConsentLinkCollection struct { + Value *[]ConsentLinkDefinition `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_consentlinkdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_consentlinkdefinition.go new file mode 100644 index 00000000000..9d0e9fd6b4c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_consentlinkdefinition.go @@ -0,0 +1,11 @@ +package connections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConsentLinkDefinition struct { + DisplayName *string `json:"displayName,omitempty"` + FirstPartyLoginUri *string `json:"firstPartyLoginUri,omitempty"` + Link *string `json:"link,omitempty"` + Status *LinkState `json:"status,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_consentlinkparameterdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_consentlinkparameterdefinition.go new file mode 100644 index 00000000000..250a5ef3070 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_consentlinkparameterdefinition.go @@ -0,0 +1,11 @@ +package connections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConsentLinkParameterDefinition struct { + ObjectId *string `json:"objectId,omitempty"` + ParameterName *string `json:"parameterName,omitempty"` + RedirectUrl *string `json:"redirectUrl,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_listconsentlinksdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_listconsentlinksdefinition.go new file mode 100644 index 00000000000..550b8684b14 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/model_listconsentlinksdefinition.go @@ -0,0 +1,8 @@ +package connections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListConsentLinksDefinition struct { + Parameters *[]ConsentLinkParameterDefinition `json:"parameters,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/version.go new file mode 100644 index 00000000000..dc9f5850fc3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections/version.go @@ -0,0 +1,12 @@ +package connections + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2016-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/connections/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/README.md new file mode 100644 index 00000000000..4f0b184c7b7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/README.md @@ -0,0 +1,52 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis` Documentation + +The `managedapis` SDK allows for interaction with the Azure Resource Manager Service `web` (API Version `2016-06-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis" +``` + + +### Client Initialization + +```go +client := managedapis.NewManagedAPIsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ManagedAPIsClient.ManagedApisGet` + +```go +ctx := context.TODO() +id := managedapis.NewManagedApiID("12345678-1234-9876-4563-123456789012", "locationValue", "apiValue") + +read, err := client.ManagedApisGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedAPIsClient.ManagedApisList` + +```go +ctx := context.TODO() +id := managedapis.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +read, err := client.ManagedApisList(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/client.go new file mode 100644 index 00000000000..ecbd2e21b90 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/client.go @@ -0,0 +1,18 @@ +package managedapis + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedAPIsClient struct { + Client autorest.Client + baseUri string +} + +func NewManagedAPIsClientWithBaseURI(endpoint string) ManagedAPIsClient { + return ManagedAPIsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/constants.go new file mode 100644 index 00000000000..d675883dcab --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/constants.go @@ -0,0 +1,117 @@ +package managedapis + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiType string + +const ( + ApiTypeNotSpecified ApiType = "NotSpecified" + ApiTypeRest ApiType = "Rest" + ApiTypeSoap ApiType = "Soap" +) + +func PossibleValuesForApiType() []string { + return []string{ + string(ApiTypeNotSpecified), + string(ApiTypeRest), + string(ApiTypeSoap), + } +} + +func parseApiType(input string) (*ApiType, error) { + vals := map[string]ApiType{ + "notspecified": ApiTypeNotSpecified, + "rest": ApiTypeRest, + "soap": ApiTypeSoap, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ApiType(input) + return &out, nil +} + +type ConnectionParameterType string + +const ( + ConnectionParameterTypeArray ConnectionParameterType = "array" + ConnectionParameterTypeBool ConnectionParameterType = "bool" + ConnectionParameterTypeConnection ConnectionParameterType = "connection" + ConnectionParameterTypeInt ConnectionParameterType = "int" + ConnectionParameterTypeOauthSetting ConnectionParameterType = "oauthSetting" + ConnectionParameterTypeObject ConnectionParameterType = "object" + ConnectionParameterTypeSecureobject ConnectionParameterType = "secureobject" + ConnectionParameterTypeSecurestring ConnectionParameterType = "securestring" + ConnectionParameterTypeString ConnectionParameterType = "string" +) + +func PossibleValuesForConnectionParameterType() []string { + return []string{ + string(ConnectionParameterTypeArray), + string(ConnectionParameterTypeBool), + string(ConnectionParameterTypeConnection), + string(ConnectionParameterTypeInt), + string(ConnectionParameterTypeOauthSetting), + string(ConnectionParameterTypeObject), + string(ConnectionParameterTypeSecureobject), + string(ConnectionParameterTypeSecurestring), + string(ConnectionParameterTypeString), + } +} + +func parseConnectionParameterType(input string) (*ConnectionParameterType, error) { + vals := map[string]ConnectionParameterType{ + "array": ConnectionParameterTypeArray, + "bool": ConnectionParameterTypeBool, + "connection": ConnectionParameterTypeConnection, + "int": ConnectionParameterTypeInt, + "oauthsetting": ConnectionParameterTypeOauthSetting, + "object": ConnectionParameterTypeObject, + "secureobject": ConnectionParameterTypeSecureobject, + "securestring": ConnectionParameterTypeSecurestring, + "string": ConnectionParameterTypeString, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConnectionParameterType(input) + return &out, nil +} + +type WsdlImportMethod string + +const ( + WsdlImportMethodNotSpecified WsdlImportMethod = "NotSpecified" + WsdlImportMethodSoapPassThrough WsdlImportMethod = "SoapPassThrough" + WsdlImportMethodSoapToRest WsdlImportMethod = "SoapToRest" +) + +func PossibleValuesForWsdlImportMethod() []string { + return []string{ + string(WsdlImportMethodNotSpecified), + string(WsdlImportMethodSoapPassThrough), + string(WsdlImportMethodSoapToRest), + } +} + +func parseWsdlImportMethod(input string) (*WsdlImportMethod, error) { + vals := map[string]WsdlImportMethod{ + "notspecified": WsdlImportMethodNotSpecified, + "soappassthrough": WsdlImportMethodSoapPassThrough, + "soaptorest": WsdlImportMethodSoapToRest, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WsdlImportMethod(input) + return &out, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/id_location.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/id_location.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/id_location.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/id_location.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/id_managedapi.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/id_managedapi.go similarity index 100% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/id_managedapi.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/id_managedapi.go diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/method_managedapisget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/method_managedapisget_autorest.go similarity index 93% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/method_managedapisget_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/method_managedapisget_autorest.go index b71e1b7bec7..45728b10f99 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/method_managedapisget_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/method_managedapisget_autorest.go @@ -8,6 +8,9 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ManagedApisGetOperationResponse struct { HttpResponse *http.Response Model *ManagedApiDefinition @@ -60,5 +63,6 @@ func (c ManagedAPIsClient) responderForManagedApisGet(resp *http.Response) (resu autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/method_managedapislist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/method_managedapislist_autorest.go similarity index 93% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/method_managedapislist_autorest.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/method_managedapislist_autorest.go index aca1fceda9f..e1d2eea4aa1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/method_managedapislist_autorest.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/method_managedapislist_autorest.go @@ -9,6 +9,9 @@ import ( "github.com/Azure/go-autorest/autorest/azure" ) +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ManagedApisListOperationResponse struct { HttpResponse *http.Response Model *ManagedApiDefinitionCollection @@ -61,5 +64,6 @@ func (c ManagedAPIsClient) responderForManagedApisList(resp *http.Response) (res autorest.ByUnmarshallingJSON(&result.Model), autorest.ByClosing()) result.HttpResponse = resp + return } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apioauthsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apioauthsettings.go similarity index 80% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apioauthsettings.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apioauthsettings.go index f395f716385..44096c56d0d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apioauthsettings.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apioauthsettings.go @@ -1,5 +1,8 @@ package managedapis +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ApiOAuthSettings struct { ClientId *string `json:"clientId,omitempty"` ClientSecret *string `json:"clientSecret,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apioauthsettingsparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apioauthsettingsparameter.go new file mode 100644 index 00000000000..c74c6c2bad0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apioauthsettingsparameter.go @@ -0,0 +1,10 @@ +package managedapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiOAuthSettingsParameter struct { + Options *interface{} `json:"options,omitempty"` + UiDefinition *interface{} `json:"uiDefinition,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourcebackendservice.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourcebackendservice.go new file mode 100644 index 00000000000..32a46dfc3d8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourcebackendservice.go @@ -0,0 +1,8 @@ +package managedapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiResourceBackendService struct { + ServiceUrl *string `json:"serviceUrl,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourcedefinitions.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourcedefinitions.go new file mode 100644 index 00000000000..665603f9399 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourcedefinitions.go @@ -0,0 +1,9 @@ +package managedapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiResourceDefinitions struct { + ModifiedSwaggerUrl *string `json:"modifiedSwaggerUrl,omitempty"` + OriginalSwaggerUrl *string `json:"originalSwaggerUrl,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourcegeneralinformation.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourcegeneralinformation.go new file mode 100644 index 00000000000..d80741da9fc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourcegeneralinformation.go @@ -0,0 +1,12 @@ +package managedapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiResourceGeneralInformation struct { + Description *string `json:"description,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + IconUrl *string `json:"iconUrl,omitempty"` + ReleaseTag *string `json:"releaseTag,omitempty"` + TermsOfUseUrl *string `json:"termsOfUseUrl,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourcemetadata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourcemetadata.go similarity index 78% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourcemetadata.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourcemetadata.go index 6276730778d..a73762f5a23 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourcemetadata.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourcemetadata.go @@ -1,5 +1,8 @@ package managedapis +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ApiResourceMetadata struct { ApiType *ApiType `json:"apiType,omitempty"` BrandColor *string `json:"brandColor,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourcepolicies.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourcepolicies.go new file mode 100644 index 00000000000..17deddd7968 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourcepolicies.go @@ -0,0 +1,9 @@ +package managedapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiResourcePolicies struct { + Content *string `json:"content,omitempty"` + ContentLink *string `json:"contentLink,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourceproperties.go similarity index 86% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourceproperties.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourceproperties.go index 13715bdac6d..69ff1ac1dc2 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourceproperties.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_apiresourceproperties.go @@ -1,5 +1,8 @@ package managedapis +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ApiResourceProperties struct { ApiDefinitionUrl *string `json:"apiDefinitionUrl,omitempty"` ApiDefinitions *ApiResourceDefinitions `json:"apiDefinitions,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_connectionparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_connectionparameter.go new file mode 100644 index 00000000000..4af6754fd25 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_connectionparameter.go @@ -0,0 +1,9 @@ +package managedapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConnectionParameter struct { + OAuthSettings *ApiOAuthSettings `json:"oAuthSettings,omitempty"` + Type *ConnectionParameterType `json:"type,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_managedapidefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_managedapidefinition.go similarity index 75% rename from terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_managedapidefinition.go rename to terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_managedapidefinition.go index c6e3d372ff0..4a25a4ef0ad 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_managedapidefinition.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_managedapidefinition.go @@ -1,5 +1,8 @@ package managedapis +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + type ManagedApiDefinition struct { Etag *string `json:"etag,omitempty"` Id *string `json:"id,omitempty"` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_managedapidefinitioncollection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_managedapidefinitioncollection.go new file mode 100644 index 00000000000..b5cdfb69b27 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_managedapidefinitioncollection.go @@ -0,0 +1,8 @@ +package managedapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedApiDefinitionCollection struct { + Value *[]ManagedApiDefinition `json:"value,omitempty"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_wsdlservice.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_wsdlservice.go new file mode 100644 index 00000000000..b4b83e44e39 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/model_wsdlservice.go @@ -0,0 +1,9 @@ +package managedapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WsdlService struct { + EndpointQualifiedNames *[]string `json:"endpointQualifiedNames,omitempty"` + QualifiedName string `json:"qualifiedName"` +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/version.go new file mode 100644 index 00000000000..ef8a838ad43 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis/version.go @@ -0,0 +1,12 @@ +package managedapis + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2016-06-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/managedapis/%s", defaultApiVersion) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-version/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-version/CHANGELOG.md index 094550020e9..5f16dd140c3 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-version/CHANGELOG.md +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-version/CHANGELOG.md @@ -1,3 +1,16 @@ +# 1.6.0 (June 28, 2022) + +FEATURES: + +- Add `Prerelease` function to `Constraint` to return true if the version includes a prerelease field ([#100](https://github.com/hashicorp/go-version/pull/100)) + +# 1.5.0 (May 18, 2022) + +FEATURES: + +- Use `encoding` `TextMarshaler` & `TextUnmarshaler` instead of JSON equivalents ([#95](https://github.com/hashicorp/go-version/pull/95)) +- Add JSON handlers to allow parsing from/to JSON ([#93](https://github.com/hashicorp/go-version/pull/93)) + # 1.4.0 (January 5, 2022) FEATURES: diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-version/constraint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-version/constraint.go index 1d880902810..da5d1aca148 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/go-version/constraint.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/go-version/constraint.go @@ -163,6 +163,12 @@ func (c *Constraint) Check(v *Version) bool { return c.f(v, c.check) } +// Prerelease returns true if the version underlying this constraint +// contains a prerelease field. +func (c *Constraint) Prerelease() bool { + return len(c.check.Prerelease()) > 0 +} + func (c *Constraint) String() string { return c.original } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/hc-install/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/hc-install/README.md index 87c06a20346..eb287ff0fc7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/hc-install/README.md +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/hc-install/README.md @@ -31,7 +31,7 @@ The `Installer` offers a few high-level methods: The `Installer` methods accept number of different `Source` types. Each comes with different trade-offs described below. - - `fs.{AnyVersion,ExactVersion}` - Finds a binary in `$PATH` (or additional paths) + - `fs.{AnyVersion,ExactVersion,Version}` - Finds a binary in `$PATH` (or additional paths) - **Pros:** - This is most convenient when you already have the product installed on your system which you already manage. diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/hc-install/fs/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/hc-install/fs/version.go new file mode 100644 index 00000000000..26633b8afc8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/hc-install/fs/version.go @@ -0,0 +1,97 @@ +package fs + +import ( + "context" + "fmt" + "log" + "path/filepath" + "time" + + "github.com/hashicorp/go-version" + "github.com/hashicorp/hc-install/errors" + "github.com/hashicorp/hc-install/internal/src" + "github.com/hashicorp/hc-install/internal/validators" + "github.com/hashicorp/hc-install/product" +) + +// Version finds the first executable binary of the product name +// which matches the version constraint within system $PATH and any declared ExtraPaths +// (which are *appended* to any directories in $PATH) +type Version struct { + Product product.Product + Constraints version.Constraints + ExtraPaths []string + Timeout time.Duration + + logger *log.Logger +} + +func (*Version) IsSourceImpl() src.InstallSrcSigil { + return src.InstallSrcSigil{} +} + +func (v *Version) SetLogger(logger *log.Logger) { + v.logger = logger +} + +func (v *Version) log() *log.Logger { + if v.logger == nil { + return discardLogger + } + return v.logger +} + +func (v *Version) Validate() error { + if !validators.IsBinaryNameValid(v.Product.BinaryName()) { + return fmt.Errorf("invalid binary name: %q", v.Product.BinaryName()) + } + if len(v.Constraints) == 0 { + return fmt.Errorf("undeclared version constraints") + } + if v.Product.GetVersion == nil { + return fmt.Errorf("undeclared version getter") + } + return nil +} + +func (v *Version) Find(ctx context.Context) (string, error) { + timeout := defaultTimeout + if v.Timeout > 0 { + timeout = v.Timeout + } + ctx, cancelFunc := context.WithTimeout(ctx, timeout) + defer cancelFunc() + + execPath, err := findFile(lookupDirs(v.ExtraPaths), v.Product.BinaryName(), func(file string) error { + err := checkExecutable(file) + if err != nil { + return err + } + + ver, err := v.Product.GetVersion(ctx, file) + if err != nil { + return err + } + + for _, vc := range v.Constraints { + if !vc.Check(ver) { + return fmt.Errorf("version (%s) doesn't meet constraints %s", ver, vc.String()) + } + } + + return nil + }) + if err != nil { + return "", errors.SkippableErr(err) + } + + if !filepath.IsAbs(execPath) { + var err error + execPath, err = filepath.Abs(execPath) + if err != nil { + return "", errors.SkippableErr(err) + } + } + + return execPath, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/hc-install/product/vault.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/hc-install/product/vault.go new file mode 100644 index 00000000000..d03bc4fabc2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/hc-install/product/vault.go @@ -0,0 +1,54 @@ +package product + +import ( + "context" + "fmt" + "os/exec" + "regexp" + "runtime" + "strings" + + "github.com/hashicorp/go-version" + "github.com/hashicorp/hc-install/internal/build" +) + +var ( + vaultVersionOutputRe = regexp.MustCompile(`Vault ` + simpleVersionRe) + v1_17 = version.Must(version.NewVersion("1.17")) +) + +var Vault = Product{ + Name: "vault", + BinaryName: func() string { + if runtime.GOOS == "windows" { + return "vault.exe" + } + return "vault" + }, + GetVersion: func(ctx context.Context, path string) (*version.Version, error) { + cmd := exec.CommandContext(ctx, path, "version") + + out, err := cmd.Output() + if err != nil { + return nil, err + } + + stdout := strings.TrimSpace(string(out)) + + submatches := vaultVersionOutputRe.FindStringSubmatch(stdout) + if len(submatches) != 2 { + return nil, fmt.Errorf("unexpected number of version matches %d for %s", len(submatches), stdout) + } + v, err := version.NewVersion(submatches[1]) + if err != nil { + return nil, fmt.Errorf("unable to parse version %q: %w", submatches[1], err) + } + + return v, err + }, + BuildInstructions: &BuildInstructions{ + GitRepoURL: "https://github.com/hashicorp/vault.git", + PreCloneCheck: &build.GoIsInstalled{}, + Build: &build.GoBuild{Version: v1_17}, + }, +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/hcl/v2/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/hcl/v2/CHANGELOG.md index aa6faaf2fb0..9f6c23b1cdf 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/hcl/v2/CHANGELOG.md +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/hcl/v2/CHANGELOG.md @@ -1,5 +1,16 @@ # HCL Changelog +## v2.13.0 (June 22, 2022) + +### Enhancements + +* hcl: `hcl.Diagnostic` how has an additional field `Extra` which is intended for carrying arbitrary supporting data ("extra information") related to the diagnostic message, intended to allow diagnostic renderers to optionally tailor the presentation of messages for particular situations. ([#539](https://github.com/hashicorp/hcl/pull/539)) +* hclsyntax: When an error occurs during a function call, the returned diagnostics will include _extra information_ (as described in the previous point) about which function was being called and, if the message is about an error returned by the function itself, that raw `error` value without any post-processing. ([#539](https://github.com/hashicorp/hcl/pull/539)) + +### Bugs Fixed + +* hclwrite: Fixed a potential data race for any situation where `hclwrite.Format` runs concurrently with itself. ([#534](https://github.com/hashicorp/hcl/pull/534)) + ## v2.12.0 (April 22, 2022) ### Enhancements diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/hcl/v2/diagnostic.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/hcl/v2/diagnostic.go index c80535b7a73..bcf4eb39c03 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/hcl/v2/diagnostic.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/hcl/v2/diagnostic.go @@ -63,6 +63,28 @@ type Diagnostic struct { // case of colliding names. Expression Expression EvalContext *EvalContext + + // Extra is an extension point for additional machine-readable information + // about this problem. + // + // Recipients of diagnostic objects may type-assert this value with + // specific interface types they know about to discover if any additional + // information is available that is interesting for their use-case. + // + // Extra is always considered to be optional extra information and so a + // diagnostic message should still always be fully described (from the + // perspective of a human who understands the language the messages are + // written in) by the other fields in case a particular recipient. + // + // Functions that return diagnostics with Extra populated should typically + // document that they place values implementing a particular interface, + // rather than a concrete type, and define that interface such that its + // methods can dynamically indicate a lack of support at runtime even + // if the interface happens to be statically available. An Extra + // type that wraps other Extra values should additionally implement + // interface DiagnosticExtraUnwrapper to return the value they are wrapping + // so that callers can access inner values to type-assert against. + Extra interface{} } // Diagnostics is a list of Diagnostic instances. @@ -141,3 +163,24 @@ type DiagnosticWriter interface { WriteDiagnostic(*Diagnostic) error WriteDiagnostics(Diagnostics) error } + +// DiagnosticExtraUnwrapper is an interface implemented by values in the +// Extra field of Diagnostic when they are wrapping another "Extra" value that +// was generated downstream. +// +// Diagnostic recipients which want to examine "Extra" values to sniff for +// particular types of extra data can either type-assert this interface +// directly and repeatedly unwrap until they recieve nil, or can use the +// helper function DiagnosticExtra. +type DiagnosticExtraUnwrapper interface { + // If the reciever is wrapping another "diagnostic extra" value, returns + // that value. Otherwise returns nil to indicate dynamically that nothing + // is wrapped. + // + // The "nothing is wrapped" condition can be signalled either by this + // method returning nil or by a type not implementing this interface at all. + // + // Implementers should never create unwrap "cycles" where a nested extra + // value returns a value that was also wrapping it. + UnwrapDiagnosticExtra() interface{} +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/hcl/v2/diagnostic_typeparams.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/hcl/v2/diagnostic_typeparams.go new file mode 100644 index 00000000000..6994e2336dc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/hcl/v2/diagnostic_typeparams.go @@ -0,0 +1,39 @@ +//go:build go1.18 +// +build go1.18 + +package hcl + +// This file contains additional diagnostics-related symbols that use the +// Go 1.18 type parameters syntax and would therefore be incompatible with +// Go 1.17 and earlier. + +// DiagnosticExtra attempts to retrieve an "extra value" of type T from the +// given diagnostic, if either the diag.Extra field directly contains a value +// of that type or the value implements DiagnosticExtraUnwrapper and directly +// or indirectly returns a value of that type. +// +// Type T should typically be an interface type, so that code which generates +// diagnostics can potentially return different implementations of the same +// interface dynamically as needed. +// +// If a value of type T is found, returns that value and true to indicate +// success. Otherwise, returns the zero value of T and false to indicate +// failure. +func DiagnosticExtra[T any](diag *Diagnostic) (T, bool) { + extra := diag.Extra + var zero T + + for { + if ret, ok := extra.(T); ok { + return ret, true + } + + if unwrap, ok := extra.(DiagnosticExtraUnwrapper); ok { + // If our "extra" implements DiagnosticExtraUnwrapper then we'll + // unwrap one level and try this again. + extra = unwrap.UnwrapDiagnosticExtra() + } else { + return zero, false + } + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression.go index 2706998f8d5..358fd5d5108 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression.go @@ -26,7 +26,7 @@ type Expression interface { } // Assert that Expression implements hcl.Expression -var assertExprImplExpr hcl.Expression = Expression(nil) +var _ hcl.Expression = Expression(nil) // ParenthesesExpr represents an expression written in grouping // parentheses. @@ -270,6 +270,10 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti } } + diagExtra := functionCallDiagExtra{ + calledFunctionName: e.Name, + } + params := f.Params() varParam := f.VarParam() @@ -297,6 +301,7 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti Context: e.Range().Ptr(), Expression: expandExpr, EvalContext: ctx, + Extra: &diagExtra, }) return cty.DynamicVal, diags } @@ -311,6 +316,7 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti Context: e.Range().Ptr(), Expression: expandExpr, EvalContext: ctx, + Extra: &diagExtra, }) return cty.DynamicVal, diags } @@ -342,6 +348,7 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti Context: e.Range().Ptr(), Expression: expandExpr, EvalContext: ctx, + Extra: &diagExtra, }) return cty.DynamicVal, diags } @@ -365,6 +372,7 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti Context: e.Range().Ptr(), Expression: e, EvalContext: ctx, + Extra: &diagExtra, }, } } @@ -382,6 +390,7 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti Context: e.Range().Ptr(), Expression: e, EvalContext: ctx, + Extra: &diagExtra, }, } } @@ -426,6 +435,7 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti Context: e.Range().Ptr(), Expression: argExpr, EvalContext: ctx, + Extra: &diagExtra, }) } } @@ -442,6 +452,10 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti resultVal, err := f.Call(argVals) if err != nil { + // For errors in the underlying call itself we also return the raw + // call error via an extra method on our "diagnostic extra" value. + diagExtra.functionCallError = err + switch terr := err.(type) { case function.ArgError: i := terr.Index @@ -479,6 +493,7 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti Subject: e.Range().Ptr(), Expression: e, EvalContext: ctx, + Extra: &diagExtra, }) default: // This is the most degenerate case of all, where the @@ -497,6 +512,7 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti Context: e.Range().Ptr(), Expression: e, EvalContext: ctx, + Extra: &diagExtra, }) } } else { @@ -515,6 +531,7 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti Context: e.Range().Ptr(), Expression: argExpr, EvalContext: ctx, + Extra: &diagExtra, }) } @@ -530,6 +547,7 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti Context: e.Range().Ptr(), Expression: e, EvalContext: ctx, + Extra: &diagExtra, }) } @@ -562,6 +580,39 @@ func (e *FunctionCallExpr) ExprCall() *hcl.StaticCall { return ret } +// FunctionCallDiagExtra is an interface implemented by the value in the "Extra" +// field of some diagnostics returned by FunctionCallExpr.Value, giving +// cooperating callers access to some machine-readable information about the +// call that a diagnostic relates to. +type FunctionCallDiagExtra interface { + // CalledFunctionName returns the name of the function being called at + // the time the diagnostic was generated, if any. Returns an empty string + // if there is no known called function. + CalledFunctionName() string + + // FunctionCallError returns the error value returned by the implementation + // of the function being called, if any. Returns nil if the diagnostic was + // not returned in response to a call error. + // + // Some errors related to calling functions are generated by HCL itself + // rather than by the underlying function, in which case this method + // will return nil. + FunctionCallError() error +} + +type functionCallDiagExtra struct { + calledFunctionName string + functionCallError error +} + +func (e *functionCallDiagExtra) CalledFunctionName() string { + return e.calledFunctionName +} + +func (e *functionCallDiagExtra) FunctionCallError() error { + return e.functionCallError +} + type ConditionalExpr struct { Condition Expression TrueResult Expression diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/internal/version/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/internal/version/version.go index 2b19c59ea65..164c0fd6b65 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/internal/version/version.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/internal/version/version.go @@ -1,6 +1,6 @@ package version -const version = "0.16.1" +const version = "0.17.2" // ModuleVersion returns the current version of the github.com/hashicorp/terraform-exec Go module. // This is a function to allow for future possible enhancement using debug.BuildInfo. diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/cmd.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/cmd.go index 83abd22d551..56393a006c1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/cmd.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/cmd.go @@ -1,9 +1,11 @@ package tfexec import ( + "bufio" "bytes" "context" "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -17,10 +19,12 @@ import ( const ( checkpointDisableEnvVar = "CHECKPOINT_DISABLE" cliArgsEnvVar = "TF_CLI_ARGS" - logEnvVar = "TF_LOG" inputEnvVar = "TF_INPUT" automationEnvVar = "TF_IN_AUTOMATION" + logEnvVar = "TF_LOG" + logCoreEnvVar = "TF_LOG_CORE" logPathEnvVar = "TF_LOG_PATH" + logProviderEnvVar = "TF_LOG_PROVIDER" reattachEnvVar = "TF_REATTACH_PROVIDERS" appendUserAgentEnvVar = "TF_APPEND_USER_AGENT" workspaceEnvVar = "TF_WORKSPACE" @@ -35,8 +39,10 @@ var prohibitedEnvVars = []string{ cliArgsEnvVar, inputEnvVar, automationEnvVar, - logPathEnvVar, logEnvVar, + logCoreEnvVar, + logPathEnvVar, + logProviderEnvVar, reattachEnvVar, appendUserAgentEnvVar, workspaceEnvVar, @@ -146,11 +152,14 @@ func (tf *Terraform) buildEnv(mergeEnv map[string]string) []string { if tf.logPath == "" { // so logging can't pollute our stderr output env[logEnvVar] = "" + env[logCoreEnvVar] = "" env[logPathEnvVar] = "" + env[logProviderEnvVar] = "" } else { + env[logEnvVar] = tf.log + env[logCoreEnvVar] = tf.logCore env[logPathEnvVar] = tf.logPath - // Log levels other than TRACE are currently unreliable, the CLI recommends using TRACE only. - env[logEnvVar] = "TRACE" + env[logProviderEnvVar] = tf.logProvider } // constant automation override env vars @@ -171,7 +180,7 @@ func (tf *Terraform) buildEnv(mergeEnv map[string]string) []string { } func (tf *Terraform) buildTerraformCmd(ctx context.Context, mergeEnv map[string]string, args ...string) *exec.Cmd { - cmd := exec.Command(tf.execPath, args...) + cmd := exec.CommandContext(ctx, tf.execPath, args...) cmd.Env = tf.buildEnv(mergeEnv) cmd.Dir = tf.workingDir @@ -230,3 +239,36 @@ func mergeWriters(writers ...io.Writer) io.Writer { } return io.MultiWriter(compact...) } + +func writeOutput(ctx context.Context, r io.ReadCloser, w io.Writer) error { + // ReadBytes will block until bytes are read, which can cause a delay in + // returning even if the command's context has been canceled. Use a separate + // goroutine to prompt ReadBytes to return on cancel + closeCtx, closeCancel := context.WithCancel(ctx) + defer closeCancel() + go func() { + select { + case <-ctx.Done(): + r.Close() + case <-closeCtx.Done(): + return + } + }() + + buf := bufio.NewReader(r) + for { + line, err := buf.ReadBytes('\n') + if len(line) > 0 { + if _, err := w.Write(line); err != nil { + return err + } + } + if err != nil { + if errors.Is(err, io.EOF) { + return nil + } + + return err + } + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/cmd_default.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/cmd_default.go index 08a65bcde47..6d7b768ee7c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/cmd_default.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/cmd_default.go @@ -7,26 +7,12 @@ import ( "context" "os/exec" "strings" + "sync" ) func (tf *Terraform) runTerraformCmd(ctx context.Context, cmd *exec.Cmd) error { var errBuf strings.Builder - cmd.Stdout = mergeWriters(cmd.Stdout, tf.stdout) - cmd.Stderr = mergeWriters(cmd.Stderr, tf.stderr, &errBuf) - - go func() { - <-ctx.Done() - if ctx.Err() == context.DeadlineExceeded || ctx.Err() == context.Canceled { - if cmd != nil && cmd.Process != nil && cmd.ProcessState != nil { - err := cmd.Process.Kill() - if err != nil { - tf.logger.Printf("error from kill: %s", err) - } - } - } - }() - // check for early cancellation select { case <-ctx.Done(): @@ -34,7 +20,52 @@ func (tf *Terraform) runTerraformCmd(ctx context.Context, cmd *exec.Cmd) error { default: } - err := cmd.Run() + // Read stdout / stderr logs from pipe instead of setting cmd.Stdout and + // cmd.Stderr because it can cause hanging when killing the command + // https://github.com/golang/go/issues/23019 + stdoutWriter := mergeWriters(cmd.Stdout, tf.stdout) + stderrWriter := mergeWriters(tf.stderr, &errBuf) + + cmd.Stderr = nil + cmd.Stdout = nil + + stdoutPipe, err := cmd.StdoutPipe() + if err != nil { + return err + } + + stderrPipe, err := cmd.StderrPipe() + if err != nil { + return err + } + + err = cmd.Start() + if err == nil && ctx.Err() != nil { + err = ctx.Err() + } + if err != nil { + return tf.wrapExitError(ctx, err, "") + } + + var errStdout, errStderr error + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + errStdout = writeOutput(ctx, stdoutPipe, stdoutWriter) + }() + + wg.Add(1) + go func() { + defer wg.Done() + errStderr = writeOutput(ctx, stderrPipe, stderrWriter) + }() + + // Reads from pipes must be completed before calling cmd.Wait(). Otherwise + // can cause a race condition + wg.Wait() + + err = cmd.Wait() if err == nil && ctx.Err() != nil { err = ctx.Err() } @@ -42,5 +73,13 @@ func (tf *Terraform) runTerraformCmd(ctx context.Context, cmd *exec.Cmd) error { return tf.wrapExitError(ctx, err, errBuf.String()) } + // Return error if there was an issue reading the std out/err + if errStdout != nil && ctx.Err() != nil { + return tf.wrapExitError(ctx, errStdout, errBuf.String()) + } + if errStderr != nil && ctx.Err() != nil { + return tf.wrapExitError(ctx, errStderr, errBuf.String()) + } + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/cmd_linux.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/cmd_linux.go index 7cbdcb96f12..6fa40e0aa31 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/cmd_linux.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/cmd_linux.go @@ -4,15 +4,13 @@ import ( "context" "os/exec" "strings" + "sync" "syscall" ) func (tf *Terraform) runTerraformCmd(ctx context.Context, cmd *exec.Cmd) error { var errBuf strings.Builder - cmd.Stdout = mergeWriters(cmd.Stdout, tf.stdout) - cmd.Stderr = mergeWriters(cmd.Stderr, tf.stderr, &errBuf) - cmd.SysProcAttr = &syscall.SysProcAttr{ // kill children if parent is dead Pdeathsig: syscall.SIGKILL, @@ -20,21 +18,6 @@ func (tf *Terraform) runTerraformCmd(ctx context.Context, cmd *exec.Cmd) error { Setpgid: true, } - go func() { - <-ctx.Done() - if ctx.Err() == context.DeadlineExceeded || ctx.Err() == context.Canceled { - if cmd != nil && cmd.Process != nil && cmd.ProcessState != nil { - // send SIGINT to process group - err := syscall.Kill(-cmd.Process.Pid, syscall.SIGINT) - if err != nil { - tf.logger.Printf("error from SIGINT: %s", err) - } - } - - // TODO: send a kill if it doesn't respond for a bit? - } - }() - // check for early cancellation select { case <-ctx.Done(): @@ -42,7 +25,52 @@ func (tf *Terraform) runTerraformCmd(ctx context.Context, cmd *exec.Cmd) error { default: } - err := cmd.Run() + // Read stdout / stderr logs from pipe instead of setting cmd.Stdout and + // cmd.Stderr because it can cause hanging when killing the command + // https://github.com/golang/go/issues/23019 + stdoutWriter := mergeWriters(cmd.Stdout, tf.stdout) + stderrWriter := mergeWriters(tf.stderr, &errBuf) + + cmd.Stderr = nil + cmd.Stdout = nil + + stdoutPipe, err := cmd.StdoutPipe() + if err != nil { + return err + } + + stderrPipe, err := cmd.StderrPipe() + if err != nil { + return err + } + + err = cmd.Start() + if err == nil && ctx.Err() != nil { + err = ctx.Err() + } + if err != nil { + return tf.wrapExitError(ctx, err, "") + } + + var errStdout, errStderr error + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + errStdout = writeOutput(ctx, stdoutPipe, stdoutWriter) + }() + + wg.Add(1) + go func() { + defer wg.Done() + errStderr = writeOutput(ctx, stderrPipe, stderrWriter) + }() + + // Reads from pipes must be completed before calling cmd.Wait(). Otherwise + // can cause a race condition + wg.Wait() + + err = cmd.Wait() if err == nil && ctx.Err() != nil { err = ctx.Err() } @@ -50,5 +78,13 @@ func (tf *Terraform) runTerraformCmd(ctx context.Context, cmd *exec.Cmd) error { return tf.wrapExitError(ctx, err, errBuf.String()) } + // Return error if there was an issue reading the std out/err + if errStdout != nil && ctx.Err() != nil { + return tf.wrapExitError(ctx, errStdout, errBuf.String()) + } + if errStderr != nil && ctx.Err() != nil { + return tf.wrapExitError(ctx, errStderr, errBuf.String()) + } + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/state_pull.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/state_pull.go new file mode 100644 index 00000000000..11b6b9c77f0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/state_pull.go @@ -0,0 +1,55 @@ +package tfexec + +import ( + "bytes" + "context" + "os/exec" +) + +type statePullConfig struct { + reattachInfo ReattachInfo +} + +var defaultStatePullConfig = statePullConfig{} + +type StatePullOption interface { + configureShow(*statePullConfig) +} + +func (opt *ReattachOption) configureStatePull(conf *statePullConfig) { + conf.reattachInfo = opt.info +} + +func (tf *Terraform) StatePull(ctx context.Context, opts ...StatePullOption) (string, error) { + c := defaultStatePullConfig + + for _, o := range opts { + o.configureShow(&c) + } + + mergeEnv := map[string]string{} + if c.reattachInfo != nil { + reattachStr, err := c.reattachInfo.marshalString() + if err != nil { + return "", err + } + mergeEnv[reattachEnvVar] = reattachStr + } + + cmd := tf.statePullCmd(ctx, mergeEnv) + + var ret bytes.Buffer + cmd.Stdout = &ret + err := tf.runTerraformCmd(ctx, cmd) + if err != nil { + return "", err + } + + return ret.String(), nil +} + +func (tf *Terraform) statePullCmd(ctx context.Context, mergeEnv map[string]string) *exec.Cmd { + args := []string{"state", "pull"} + + return tf.buildTerraformCmd(ctx, mergeEnv, args...) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/state_push.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/state_push.go new file mode 100644 index 00000000000..14e55a2eb3f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/state_push.go @@ -0,0 +1,67 @@ +package tfexec + +import ( + "context" + "os/exec" + "strconv" +) + +type statePushConfig struct { + force bool + lock bool + lockTimeout string +} + +var defaultStatePushOptions = statePushConfig{ + lock: false, + lockTimeout: "0s", +} + +// StatePushCmdOption represents options used in the Refresh method. +type StatePushCmdOption interface { + configureStatePush(*statePushConfig) +} + +func (opt *ForceOption) configureStatePush(conf *statePushConfig) { + conf.force = opt.force +} + +func (opt *LockOption) configureStatePush(conf *statePushConfig) { + conf.lock = opt.lock +} + +func (opt *LockTimeoutOption) configureStatePush(conf *statePushConfig) { + conf.lockTimeout = opt.timeout +} + +func (tf *Terraform) StatePush(ctx context.Context, path string, opts ...StatePushCmdOption) error { + cmd, err := tf.statePushCmd(ctx, path, opts...) + if err != nil { + return err + } + return tf.runTerraformCmd(ctx, cmd) +} + +func (tf *Terraform) statePushCmd(ctx context.Context, path string, opts ...StatePushCmdOption) (*exec.Cmd, error) { + c := defaultStatePushOptions + + for _, o := range opts { + o.configureStatePush(&c) + } + + args := []string{"state", "push"} + + if c.force { + args = append(args, "-force") + } + + args = append(args, "-lock="+strconv.FormatBool(c.lock)) + + if c.lockTimeout != "" { + args = append(args, "-lock-timeout="+c.lockTimeout) + } + + args = append(args, path) + + return tf.buildTerraformCmd(ctx, nil, args...), nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/terraform.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/terraform.go index 2ad143a41a2..bb8be17d581 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/terraform.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-exec/tfexec/terraform.go @@ -48,11 +48,22 @@ type Terraform struct { skipProviderVerify bool env map[string]string - stdout io.Writer - stderr io.Writer - logger printfer + stdout io.Writer + stderr io.Writer + logger printfer + + // TF_LOG environment variable, defaults to TRACE if logPath is set. + log string + + // TF_LOG_CORE environment variable + logCore string + + // TF_LOG_PATH environment variable logPath string + // TF_LOG_PROVIDER environment variable + logProvider string + versionLock sync.Mutex execVersion *version.Version provVersions map[string]*version.Version @@ -122,10 +133,58 @@ func (tf *Terraform) SetStderr(w io.Writer) { tf.stderr = w } +// SetLog sets the TF_LOG environment variable for Terraform CLI execution. +// This must be combined with a call to SetLogPath to take effect. +// +// This is only compatible with Terraform CLI 0.15.0 or later as setting the +// log level was unreliable in earlier versions. It will default to TRACE when +// SetLogPath is called on versions 0.14.11 and earlier, or if SetLogCore and +// SetLogProvider have not been called before SetLogPath on versions 0.15.0 and +// later. +func (tf *Terraform) SetLog(log string) error { + err := tf.compatible(context.Background(), tf0_15_0, nil) + if err != nil { + return err + } + tf.log = log + return nil +} + +// SetLogCore sets the TF_LOG_CORE environment variable for Terraform CLI +// execution. This must be combined with a call to SetLogPath to take effect. +// +// This is only compatible with Terraform CLI 0.15.0 or later. +func (tf *Terraform) SetLogCore(logCore string) error { + err := tf.compatible(context.Background(), tf0_15_0, nil) + if err != nil { + return err + } + tf.logCore = logCore + return nil +} + // SetLogPath sets the TF_LOG_PATH environment variable for Terraform CLI // execution. func (tf *Terraform) SetLogPath(path string) error { tf.logPath = path + // Prevent setting the log path without enabling logging + if tf.log == "" && tf.logCore == "" && tf.logProvider == "" { + tf.log = "TRACE" + } + return nil +} + +// SetLogProvider sets the TF_LOG_PROVIDER environment variable for Terraform +// CLI execution. This must be combined with a call to SetLogPath to take +// effect. +// +// This is only compatible with Terraform CLI 0.15.0 or later. +func (tf *Terraform) SetLogProvider(logProvider string) error { + err := tf.compatible(context.Background(), tf0_15_0, nil) + if err != nil { + return err + } + tf.logProvider = logProvider return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/context.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/context.go index a35258a8efe..38ef4e35e25 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/context.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/context.go @@ -22,12 +22,19 @@ func InitContext(ctx context.Context, sdkOpts tfsdklog.Options, providerOpts tfl ctx = tfsdklog.NewRootSDKLogger(ctx, append(tfsdklog.Options{ tfsdklog.WithLevelFromEnv(EnvTfLogSdk), }, sdkOpts...)...) + ctx = ProtoSubsystemContext(ctx, sdkOpts) + ctx = tfsdklog.NewRootProviderLogger(ctx, providerOpts...) + + return ctx +} + +// ProtoSubsystemContext adds the proto subsystem to the SDK logger context. +func ProtoSubsystemContext(ctx context.Context, sdkOpts tfsdklog.Options) context.Context { ctx = tfsdklog.NewSubsystem(ctx, SubsystemProto, append(tfsdklog.Options{ // All calls are through the Protocol* helper functions tfsdklog.WithAdditionalLocationOffset(1), tfsdklog.WithLevelFromEnv(EnvTfLogSdkProto), }, sdkOpts...)...) - ctx = tfsdklog.NewRootProviderLogger(ctx, providerOpts...) return ctx } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/keys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/keys.go index 3d7af9611ec..ce803d752bd 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/keys.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/keys.go @@ -5,9 +5,30 @@ package logging // Practitioners or tooling reading logs may be depending on these keys, so be // conscious of that when changing them. const ( + // Attribute of the diagnostic being logged. + KeyDiagnosticAttribute = "diagnostic_attribute" + + // Number of the error diagnostics. + KeyDiagnosticErrorCount = "diagnostic_error_count" + + // Severity of the diagnostic being logged. + KeyDiagnosticSeverity = "diagnostic_severity" + + // Detail of the diagnostic being logged. + KeyDiagnosticDetail = "diagnostic_detail" + + // Summary of the diagnostic being logged. + KeyDiagnosticSummary = "diagnostic_summary" + + // Number of the warning diagnostics. + KeyDiagnosticWarningCount = "diagnostic_warning_count" + // Underlying error string KeyError = "error" + // Duration in milliseconds for the RPC request + KeyRequestDurationMs = "tf_req_duration_ms" + // A unique ID for the RPC request KeyRequestID = "tf_req_id" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/protocol.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/protocol.go index 9f9c2808c6e..21a392a3caa 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/protocol.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/protocol.go @@ -16,6 +16,11 @@ func ProtocolError(ctx context.Context, msg string, additionalFields ...map[stri tfsdklog.SubsystemError(ctx, SubsystemProto, msg, additionalFields...) } +// ProtocolWarn emits a protocol subsystem log at WARN level. +func ProtocolWarn(ctx context.Context, msg string, additionalFields ...map[string]interface{}) { + tfsdklog.SubsystemWarn(ctx, SubsystemProto, msg, additionalFields...) +} + // ProtocolTrace emits a protocol subsystem log at TRACE level. func ProtocolTrace(ctx context.Context, msg string, additionalFields ...map[string]interface{}) { tfsdklog.SubsystemTrace(ctx, SubsystemProto, msg, additionalFields...) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/provider.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/provider.go index 6c68504c1f8..b40763c6e17 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/provider.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/internal/logging/provider.go @@ -8,8 +8,7 @@ import ( ) func ProviderLoggerName(providerAddress string) string { - provider, err := tfaddr.ParseRawProviderSourceString(providerAddress) - + provider, err := tfaddr.ParseProviderSource(providerAddress) if err != nil { log.Printf("[ERROR] Error parsing provider name %q: %s", providerAddress, err) return "" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/diag/diagnostics.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/diag/diagnostics.go new file mode 100644 index 00000000000..1032f7d4fae --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/diag/diagnostics.go @@ -0,0 +1,82 @@ +package diag + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-go/internal/logging" + "github.com/hashicorp/terraform-plugin-go/tfprotov5" +) + +// Diagnostics is a collection of Diagnostic. +type Diagnostics []*tfprotov5.Diagnostic + +// ErrorCount returns the number of error severity diagnostics. +func (d Diagnostics) ErrorCount() int { + var result int + + for _, diagnostic := range d { + if diagnostic == nil { + continue + } + + if diagnostic.Severity != tfprotov5.DiagnosticSeverityError { + continue + } + + result++ + } + + return result +} + +// Log will log every diagnostic: +// +// - Error severity at ERROR level +// - Warning severity at WARN level +// - Invalid/Unknown severity at WARN level +// +func (d Diagnostics) Log(ctx context.Context) { + for _, diagnostic := range d { + if diagnostic == nil { + continue + } + + diagnosticFields := map[string]interface{}{ + logging.KeyDiagnosticDetail: diagnostic.Detail, + logging.KeyDiagnosticSeverity: diagnostic.Severity.String(), + logging.KeyDiagnosticSummary: diagnostic.Summary, + } + + if diagnostic.Attribute != nil { + diagnosticFields[logging.KeyDiagnosticAttribute] = diagnostic.Attribute.String() + } + + switch diagnostic.Severity { + case tfprotov5.DiagnosticSeverityError: + logging.ProtocolError(ctx, "Response contains error diagnostic", diagnosticFields) + case tfprotov5.DiagnosticSeverityWarning: + logging.ProtocolWarn(ctx, "Response contains warning diagnostic", diagnosticFields) + default: + logging.ProtocolWarn(ctx, "Response contains unknown diagnostic", diagnosticFields) + } + } +} + +// WarningCount returns the number of warning severity diagnostics. +func (d Diagnostics) WarningCount() int { + var result int + + for _, diagnostic := range d { + if diagnostic == nil { + continue + } + + if diagnostic.Severity != tfprotov5.DiagnosticSeverityWarning { + continue + } + + result++ + } + + return result +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/diag/doc.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/diag/doc.go new file mode 100644 index 00000000000..0c73dab12fe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/diag/doc.go @@ -0,0 +1,3 @@ +// Package diag contains diagnostics helpers. These implementations are +// intentionally outside the public API. +package diag diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tf5serverlogging/context_keys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tf5serverlogging/context_keys.go new file mode 100644 index 00000000000..cc72fe4bbf6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tf5serverlogging/context_keys.go @@ -0,0 +1,8 @@ +package tf5serverlogging + +// Context key types. +// Reference: https://staticcheck.io/docs/checks/#SA1029 + +// ContextKeyDownstreamRequestStartTime is a context.Context key to store the +// time.Time when the server began a downstream request. +type ContextKeyDownstreamRequestStartTime struct{} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tf5serverlogging/doc.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tf5serverlogging/doc.go new file mode 100644 index 00000000000..e77a831c03e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tf5serverlogging/doc.go @@ -0,0 +1,3 @@ +// Package tf5serverlogging contains logging functionality specific to +// tf5server and tfprotov5 types. +package tf5serverlogging diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tf5serverlogging/downstream_request.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tf5serverlogging/downstream_request.go new file mode 100644 index 00000000000..eeec76e8c93 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tf5serverlogging/downstream_request.go @@ -0,0 +1,40 @@ +package tf5serverlogging + +import ( + "context" + "time" + + "github.com/hashicorp/terraform-plugin-go/internal/logging" + "github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/diag" +) + +// DownstreamRequest sets a request duration start time context key and +// generates a TRACE "Sending request downstream" log. +func DownstreamRequest(ctx context.Context) context.Context { + requestStart := time.Now() + ctx = context.WithValue(ctx, ContextKeyDownstreamRequestStartTime{}, requestStart) + + logging.ProtocolTrace(ctx, "Sending request downstream") + + return ctx +} + +// DownstreamResponse generates the following logging: +// +// - TRACE "Received downstream response" log with request duration and +// diagnostic severity counts +// - Per-diagnostic logs +// +func DownstreamResponse(ctx context.Context, diagnostics diag.Diagnostics) { + responseFields := map[string]interface{}{ + logging.KeyDiagnosticErrorCount: diagnostics.ErrorCount(), + logging.KeyDiagnosticWarningCount: diagnostics.WarningCount(), + } + + if requestStart, ok := ctx.Value(ContextKeyDownstreamRequestStartTime{}).(time.Time); ok { + responseFields[logging.KeyRequestDurationMs] = time.Since(requestStart).Milliseconds() + } + + logging.ProtocolTrace(ctx, "Received downstream response", responseFields) + diagnostics.Log(ctx) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/resource.go index 5f954996543..b86a045e957 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/resource.go @@ -128,6 +128,9 @@ type ReadResourceRequest struct { // Private is any provider-defined private state stored with the // resource. It is used for keeping state with the resource that is not // meant to be included when calculating diffs. + // + // To ensure private state data is preserved, copy any necessary data to + // the ReadResourceResponse type Private field. Private []byte // ProviderMeta supplies the provider metadata configuration for the @@ -215,6 +218,9 @@ type PlanResourceChangeRequest struct { // PriorPrivate is any provider-defined private state stored with the // resource. It is used for keeping state with the resource that is not // meant to be included when calculating diffs. + // + // To ensure private state data is preserved, copy any necessary data to + // the PlanResourceChangeResponse type PlannedPrivate field. PriorPrivate []byte // ProviderMeta supplies the provider metadata configuration for the @@ -283,6 +289,10 @@ type PlanResourceChangeResponse struct { // like sent with requests for this resource. This state will be // associated with the resource, but will not be considered when // calculating diffs. + // + // This private state data will be sent in the ApplyResourceChange RPC, in + // relation to the types of this package, the ApplyResourceChangeRequest + // type PlannedPrivate field. PlannedPrivate []byte // Diagnostics report errors or warnings related to determining the @@ -344,6 +354,13 @@ type ApplyResourceChangeRequest struct { // PlannedPrivate is any provider-defined private state stored with the // resource. It is used for keeping state with the resource that is not // meant to be included when calculating diffs. + // + // This private state data is sourced from the PlanResourceChange RPC, in + // relation to the types in this package, the PlanResourceChangeResponse + // type PlannedPrivate field. + // + // To ensure private state data is preserved, copy any necessary data to + // the ApplyResourceChangeResponse type Private field. PlannedPrivate []byte // ProviderMeta supplies the provider metadata configuration for the diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server/server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server/server.go index 9ec7abefb11..3b48ae6c982 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server/server.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server/server.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-go/internal/logging" "github.com/hashicorp/terraform-plugin-go/tfprotov5" "github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/fromproto" + "github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tf5serverlogging" "github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5" "github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/toproto" "google.golang.org/grpc" @@ -494,13 +495,13 @@ func (s *server) GetSchema(ctx context.Context, req *tfplugin5.GetProviderSchema logging.ProtocolError(ctx, "Error converting request from protobuf", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf5serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.GetProviderSchema(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf5serverlogging.DownstreamResponse(ctx, resp.Diagnostics) ret, err := toproto.GetProviderSchema_Response(resp) if err != nil { logging.ProtocolError(ctx, "Error converting response to protobuf", map[string]interface{}{logging.KeyError: err}) @@ -522,13 +523,13 @@ func (s *server) PrepareProviderConfig(ctx context.Context, req *tfplugin5.Prepa return nil, err } logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "Config", r.Config) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf5serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.PrepareProviderConfig(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf5serverlogging.DownstreamResponse(ctx, resp.Diagnostics) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Response", "PreparedConfig", resp.PreparedConfig) ret, err := toproto.PrepareProviderConfig_Response(resp) if err != nil { @@ -551,13 +552,13 @@ func (s *server) Configure(ctx context.Context, req *tfplugin5.Configure_Request return nil, err } logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "Config", r.Config) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf5serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.ConfigureProvider(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf5serverlogging.DownstreamResponse(ctx, resp.Diagnostics) ret, err := toproto.Configure_Response(resp) if err != nil { logging.ProtocolError(ctx, "Error converting response to protobuf", map[string]interface{}{logging.KeyError: err}) @@ -591,13 +592,13 @@ func (s *server) Stop(ctx context.Context, req *tfplugin5.Stop_Request) (*tfplug logging.ProtocolError(ctx, "Error converting request from protobuf", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf5serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.StopProvider(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf5serverlogging.DownstreamResponse(ctx, nil) logging.ProtocolTrace(ctx, "Closing all our contexts") s.stop() logging.ProtocolTrace(ctx, "Closed all our contexts") @@ -623,13 +624,13 @@ func (s *server) ValidateDataSourceConfig(ctx context.Context, req *tfplugin5.Va return nil, err } logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "Config", r.Config) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf5serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.ValidateDataSourceConfig(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf5serverlogging.DownstreamResponse(ctx, resp.Diagnostics) ret, err := toproto.ValidateDataSourceConfig_Response(resp) if err != nil { logging.ProtocolError(ctx, "Error converting response to protobuf", map[string]interface{}{logging.KeyError: err}) @@ -653,13 +654,13 @@ func (s *server) ReadDataSource(ctx context.Context, req *tfplugin5.ReadDataSour } logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "Config", r.Config) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "ProviderMeta", r.ProviderMeta) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf5serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.ReadDataSource(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf5serverlogging.DownstreamResponse(ctx, resp.Diagnostics) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Response", "State", resp.State) ret, err := toproto.ReadDataSource_Response(resp) if err != nil { @@ -683,13 +684,13 @@ func (s *server) ValidateResourceTypeConfig(ctx context.Context, req *tfplugin5. return nil, err } logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "Config", r.Config) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf5serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.ValidateResourceTypeConfig(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf5serverlogging.DownstreamResponse(ctx, resp.Diagnostics) ret, err := toproto.ValidateResourceTypeConfig_Response(resp) if err != nil { logging.ProtocolError(ctx, "Error converting response to protobuf", map[string]interface{}{logging.KeyError: err}) @@ -711,13 +712,13 @@ func (s *server) UpgradeResourceState(ctx context.Context, req *tfplugin5.Upgrad logging.ProtocolError(ctx, "Error converting request from protobuf", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf5serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.UpgradeResourceState(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf5serverlogging.DownstreamResponse(ctx, resp.Diagnostics) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Response", "UpgradedState", resp.UpgradedState) ret, err := toproto.UpgradeResourceState_Response(resp) if err != nil { @@ -742,13 +743,13 @@ func (s *server) ReadResource(ctx context.Context, req *tfplugin5.ReadResource_R } logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "CurrentState", r.CurrentState) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "ProviderMeta", r.ProviderMeta) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf5serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.ReadResource(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf5serverlogging.DownstreamResponse(ctx, resp.Diagnostics) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Response", "NewState", resp.NewState) ret, err := toproto.ReadResource_Response(resp) if err != nil { @@ -775,13 +776,13 @@ func (s *server) PlanResourceChange(ctx context.Context, req *tfplugin5.PlanReso logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "PriorState", r.PriorState) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "ProposedNewState", r.ProposedNewState) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "ProviderMeta", r.ProviderMeta) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf5serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.PlanResourceChange(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf5serverlogging.DownstreamResponse(ctx, resp.Diagnostics) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Response", "PlannedState", resp.PlannedState) ret, err := toproto.PlanResourceChange_Response(resp) if err != nil { @@ -808,13 +809,13 @@ func (s *server) ApplyResourceChange(ctx context.Context, req *tfplugin5.ApplyRe logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "PlannedState", r.PlannedState) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "Config", r.Config) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "Config", r.Config) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf5serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.ApplyResourceChange(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf5serverlogging.DownstreamResponse(ctx, resp.Diagnostics) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Response", "NewState", resp.NewState) ret, err := toproto.ApplyResourceChange_Response(resp) if err != nil { @@ -837,13 +838,13 @@ func (s *server) ImportResourceState(ctx context.Context, req *tfplugin5.ImportR logging.ProtocolError(ctx, "Error converting request from protobuf", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf5serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.ImportResourceState(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf5serverlogging.DownstreamResponse(ctx, resp.Diagnostics) for _, importedResource := range resp.ImportedResources { logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Response_ImportedResource", "State", importedResource.State) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/diag/diagnostics.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/diag/diagnostics.go new file mode 100644 index 00000000000..543a36232fa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/diag/diagnostics.go @@ -0,0 +1,82 @@ +package diag + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-go/internal/logging" + "github.com/hashicorp/terraform-plugin-go/tfprotov6" +) + +// Diagnostics is a collection of Diagnostic. +type Diagnostics []*tfprotov6.Diagnostic + +// ErrorCount returns the number of error severity diagnostics. +func (d Diagnostics) ErrorCount() int { + var result int + + for _, diagnostic := range d { + if diagnostic == nil { + continue + } + + if diagnostic.Severity != tfprotov6.DiagnosticSeverityError { + continue + } + + result++ + } + + return result +} + +// Log will log every diagnostic: +// +// - Error severity at ERROR level +// - Warning severity at WARN level +// - Invalid/Unknown severity at WARN level +// +func (d Diagnostics) Log(ctx context.Context) { + for _, diagnostic := range d { + if diagnostic == nil { + continue + } + + diagnosticFields := map[string]interface{}{ + logging.KeyDiagnosticDetail: diagnostic.Detail, + logging.KeyDiagnosticSeverity: diagnostic.Severity.String(), + logging.KeyDiagnosticSummary: diagnostic.Summary, + } + + if diagnostic.Attribute != nil { + diagnosticFields[logging.KeyDiagnosticAttribute] = diagnostic.Attribute.String() + } + + switch diagnostic.Severity { + case tfprotov6.DiagnosticSeverityError: + logging.ProtocolError(ctx, "Response contains error diagnostic", diagnosticFields) + case tfprotov6.DiagnosticSeverityWarning: + logging.ProtocolWarn(ctx, "Response contains warning diagnostic", diagnosticFields) + default: + logging.ProtocolWarn(ctx, "Response contains unknown diagnostic", diagnosticFields) + } + } +} + +// WarningCount returns the number of warning severity diagnostics. +func (d Diagnostics) WarningCount() int { + var result int + + for _, diagnostic := range d { + if diagnostic == nil { + continue + } + + if diagnostic.Severity != tfprotov6.DiagnosticSeverityWarning { + continue + } + + result++ + } + + return result +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/diag/doc.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/diag/doc.go new file mode 100644 index 00000000000..0c73dab12fe --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/diag/doc.go @@ -0,0 +1,3 @@ +// Package diag contains diagnostics helpers. These implementations are +// intentionally outside the public API. +package diag diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tf6serverlogging/context_keys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tf6serverlogging/context_keys.go new file mode 100644 index 00000000000..15386cd2cc2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tf6serverlogging/context_keys.go @@ -0,0 +1,8 @@ +package tf6serverlogging + +// Context key types. +// Reference: https://staticcheck.io/docs/checks/#SA1029 + +// ContextKeyDownstreamRequestStartTime is a context.Context key to store the +// time.Time when the server began a downstream request. +type ContextKeyDownstreamRequestStartTime struct{} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tf6serverlogging/doc.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tf6serverlogging/doc.go new file mode 100644 index 00000000000..167a61825ac --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tf6serverlogging/doc.go @@ -0,0 +1,3 @@ +// Package tf5serverlogging contains logging functionality specific to +// tf5server and tfprotov5 types. +package tf6serverlogging diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tf6serverlogging/downstream_request.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tf6serverlogging/downstream_request.go new file mode 100644 index 00000000000..c47df9b457f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tf6serverlogging/downstream_request.go @@ -0,0 +1,40 @@ +package tf6serverlogging + +import ( + "context" + "time" + + "github.com/hashicorp/terraform-plugin-go/internal/logging" + "github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/diag" +) + +// DownstreamRequest sets a request duration start time context key and +// generates a TRACE "Sending request downstream" log. +func DownstreamRequest(ctx context.Context) context.Context { + requestStart := time.Now() + ctx = context.WithValue(ctx, ContextKeyDownstreamRequestStartTime{}, requestStart) + + logging.ProtocolTrace(ctx, "Sending request downstream") + + return ctx +} + +// DownstreamResponse generates the following logging: +// +// - TRACE "Received downstream response" log with request duration and +// diagnostic severity counts +// - Per-diagnostic logs +// +func DownstreamResponse(ctx context.Context, diagnostics diag.Diagnostics) { + responseFields := map[string]interface{}{ + logging.KeyDiagnosticErrorCount: diagnostics.ErrorCount(), + logging.KeyDiagnosticWarningCount: diagnostics.WarningCount(), + } + + if requestStart, ok := ctx.Value(ContextKeyDownstreamRequestStartTime{}).(time.Time); ok { + responseFields[logging.KeyRequestDurationMs] = time.Since(requestStart).Milliseconds() + } + + logging.ProtocolTrace(ctx, "Received downstream response", responseFields) + diagnostics.Log(ctx) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/resource.go index 3250f195486..2768bb526e8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/resource.go @@ -125,6 +125,9 @@ type ReadResourceRequest struct { // Private is any provider-defined private state stored with the // resource. It is used for keeping state with the resource that is not // meant to be included when calculating diffs. + // + // To ensure private state data is preserved, copy any necessary data to + // the ReadResourceResponse type Private field. Private []byte // ProviderMeta supplies the provider metadata configuration for the @@ -212,6 +215,9 @@ type PlanResourceChangeRequest struct { // PriorPrivate is any provider-defined private state stored with the // resource. It is used for keeping state with the resource that is not // meant to be included when calculating diffs. + // + // To ensure private state data is preserved, copy any necessary data to + // the PlanResourceChangeResponse type PlannedPrivate field. PriorPrivate []byte // ProviderMeta supplies the provider metadata configuration for the @@ -280,6 +286,10 @@ type PlanResourceChangeResponse struct { // like sent with requests for this resource. This state will be // associated with the resource, but will not be considered when // calculating diffs. + // + // This private state data will be sent in the ApplyResourceChange RPC, in + // relation to the types of this package, the ApplyResourceChangeRequest + // type PlannedPrivate field. PlannedPrivate []byte // Diagnostics report errors or warnings related to determining the @@ -341,6 +351,13 @@ type ApplyResourceChangeRequest struct { // PlannedPrivate is any provider-defined private state stored with the // resource. It is used for keeping state with the resource that is not // meant to be included when calculating diffs. + // + // This private state data is sourced from the PlanResourceChange RPC, in + // relation to the types in this package, the PlanResourceChangeResponse + // type PlannedPrivate field. + // + // To ensure private state data is preserved, copy any necessary data to + // the ApplyResourceChangeResponse type Private field. PlannedPrivate []byte // ProviderMeta supplies the provider metadata configuration for the diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server/server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server/server.go index 4ed9ece6046..d4369e21fc5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server/server.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server/server.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-go/internal/logging" "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/fromproto" + "github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tf6serverlogging" "github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6" "github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/toproto" "google.golang.org/grpc" @@ -494,13 +495,13 @@ func (s *server) GetProviderSchema(ctx context.Context, req *tfplugin6.GetProvid logging.ProtocolError(ctx, "Error converting request from protobuf", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf6serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.GetProviderSchema(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf6serverlogging.DownstreamResponse(ctx, resp.Diagnostics) ret, err := toproto.GetProviderSchema_Response(resp) if err != nil { logging.ProtocolError(ctx, "Error converting response to protobuf", map[string]interface{}{logging.KeyError: err}) @@ -522,13 +523,13 @@ func (s *server) ConfigureProvider(ctx context.Context, req *tfplugin6.Configure return nil, err } logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "Config", r.Config) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf6serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.ConfigureProvider(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf6serverlogging.DownstreamResponse(ctx, resp.Diagnostics) ret, err := toproto.Configure_Response(resp) if err != nil { logging.ProtocolError(ctx, "Error converting response to protobuf", map[string]interface{}{logging.KeyError: err}) @@ -549,13 +550,13 @@ func (s *server) ValidateProviderConfig(ctx context.Context, req *tfplugin6.Vali return nil, err } logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "Config", r.Config) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf6serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.ValidateProviderConfig(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf6serverlogging.DownstreamResponse(ctx, resp.Diagnostics) ret, err := toproto.ValidateProviderConfig_Response(resp) if err != nil { logging.ProtocolError(ctx, "Error converting response to protobuf", map[string]interface{}{logging.KeyError: err}) @@ -589,13 +590,13 @@ func (s *server) Stop(ctx context.Context, req *tfplugin6.StopProvider_Request) logging.ProtocolError(ctx, "Error converting request from protobuf", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf6serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.StopProvider(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf6serverlogging.DownstreamResponse(ctx, nil) logging.ProtocolTrace(ctx, "Closing all our contexts") s.stop() logging.ProtocolTrace(ctx, "Closed all our contexts") @@ -621,13 +622,13 @@ func (s *server) ValidateDataResourceConfig(ctx context.Context, req *tfplugin6. return nil, err } logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "Config", r.Config) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf6serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.ValidateDataResourceConfig(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf6serverlogging.DownstreamResponse(ctx, resp.Diagnostics) ret, err := toproto.ValidateDataResourceConfig_Response(resp) if err != nil { logging.ProtocolError(ctx, "Error converting response to protobuf", map[string]interface{}{logging.KeyError: err}) @@ -651,13 +652,13 @@ func (s *server) ReadDataSource(ctx context.Context, req *tfplugin6.ReadDataSour } logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "Config", r.Config) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "ProviderMeta", r.ProviderMeta) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf6serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.ReadDataSource(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf6serverlogging.DownstreamResponse(ctx, resp.Diagnostics) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Response", "State", resp.State) ret, err := toproto.ReadDataSource_Response(resp) if err != nil { @@ -681,13 +682,13 @@ func (s *server) ValidateResourceConfig(ctx context.Context, req *tfplugin6.Vali return nil, err } logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "Config", r.Config) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf6serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.ValidateResourceConfig(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf6serverlogging.DownstreamResponse(ctx, resp.Diagnostics) ret, err := toproto.ValidateResourceConfig_Response(resp) if err != nil { logging.ProtocolError(ctx, "Error converting response to protobuf", map[string]interface{}{logging.KeyError: err}) @@ -709,13 +710,13 @@ func (s *server) UpgradeResourceState(ctx context.Context, req *tfplugin6.Upgrad logging.ProtocolError(ctx, "Error converting request from protobuf", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf6serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.UpgradeResourceState(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf6serverlogging.DownstreamResponse(ctx, resp.Diagnostics) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Response", "UpgradedState", resp.UpgradedState) ret, err := toproto.UpgradeResourceState_Response(resp) if err != nil { @@ -740,13 +741,13 @@ func (s *server) ReadResource(ctx context.Context, req *tfplugin6.ReadResource_R } logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "CurrentState", r.CurrentState) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "ProviderMeta", r.ProviderMeta) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf6serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.ReadResource(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf6serverlogging.DownstreamResponse(ctx, resp.Diagnostics) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Response", "NewState", resp.NewState) ret, err := toproto.ReadResource_Response(resp) if err != nil { @@ -773,13 +774,13 @@ func (s *server) PlanResourceChange(ctx context.Context, req *tfplugin6.PlanReso logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "PriorState", r.PriorState) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "ProposedNewState", r.ProposedNewState) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "ProviderMeta", r.ProviderMeta) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf6serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.PlanResourceChange(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf6serverlogging.DownstreamResponse(ctx, resp.Diagnostics) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Response", "PlannedState", resp.PlannedState) ret, err := toproto.PlanResourceChange_Response(resp) if err != nil { @@ -806,13 +807,13 @@ func (s *server) ApplyResourceChange(ctx context.Context, req *tfplugin6.ApplyRe logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "PlannedState", r.PlannedState) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "Config", r.Config) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Request", "Config", r.Config) - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf6serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.ApplyResourceChange(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf6serverlogging.DownstreamResponse(ctx, resp.Diagnostics) logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Response", "NewState", resp.NewState) ret, err := toproto.ApplyResourceChange_Response(resp) if err != nil { @@ -835,13 +836,13 @@ func (s *server) ImportResourceState(ctx context.Context, req *tfplugin6.ImportR logging.ProtocolError(ctx, "Error converting request from protobuf", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Calling downstream") + ctx = tf6serverlogging.DownstreamRequest(ctx) resp, err := s.downstream.ImportResourceState(ctx, r) if err != nil { logging.ProtocolError(ctx, "Error from downstream", map[string]interface{}{logging.KeyError: err}) return nil, err } - logging.ProtocolTrace(ctx, "Called downstream") + tf6serverlogging.DownstreamResponse(ctx, resp.Diagnostics) for _, importedResource := range resp.ImportedResources { logging.ProtocolData(ctx, s.protocolDataDir, rpc, "Response_ImportedResource", "State", importedResource.State) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing.go index 8047a2cdc85..8cb4dbaa664 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing.go @@ -237,6 +237,7 @@ func runSweeperWithRegion(region string, s *Sweeper, sweepers map[string]*Sweepe depSweeper, ok := sweepers[dep] if !ok { + log.Printf("[ERROR] Sweeper (%s) has dependency (%s), but that sweeper was not found", s.Name, dep) return fmt.Errorf("sweeper (%s) has dependency (%s), but that sweeper was not found", s.Name, dep) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging/keys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging/keys.go index 2ba548f61d5..03931b02473 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging/keys.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/logging/keys.go @@ -31,6 +31,15 @@ const ( // The TestStep number of the test being executed. Starts at 1. KeyTestStepNumber = "test_step_number" + // The Terraform CLI logging level (TF_LOG) used for an acceptance test. + KeyTestTerraformLogLevel = "test_terraform_log_level" + + // The Terraform CLI logging level (TF_LOG_CORE) used for an acceptance test. + KeyTestTerraformLogCoreLevel = "test_terraform_log_core_level" + + // The Terraform CLI logging level (TF_LOG_PROVIDER) used for an acceptance test. + KeyTestTerraformLogProviderLevel = "test_terraform_log_provider_level" + // The path to the Terraform CLI logging file used for an acceptance test. // // This should match where the rest of the acceptance test logs are going diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/environment_variables.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/environment_variables.go index ac75151a4e8..6fd001a07d0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/environment_variables.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/environment_variables.go @@ -10,6 +10,24 @@ const ( // CLI installation, if installation is required. EnvTfAccTempDir = "TF_ACC_TEMP_DIR" + // Environment variable with level to filter Terraform logs during + // acceptance testing. This value sets TF_LOG in a safe manner when + // executing Terraform CLI commands, which would otherwise interfere + // with the testing framework using TF_LOG to set the Go standard library + // log package level. + // + // This value takes precedence over TF_LOG_CORE, due to precedence rules + // in the Terraform core code, so it is not possible to set this to a level + // and also TF_LOG_CORE=OFF. Use TF_LOG_CORE and TF_LOG_PROVIDER in that + // case instead. + // + // If not set, but TF_ACC_LOG_PATH or TF_LOG_PATH_MASK is set, it defaults + // to TRACE. If Terraform CLI is version 0.14 or earlier, it will have no + // separate affect from the TF_ACC_LOG_PATH or TF_LOG_PATH_MASK behavior, + // as those earlier versions of Terraform are unreliable with the logging + // level being outside TRACE. + EnvTfAccLog = "TF_ACC_LOG" + // Environment variable with path to save Terraform logs during acceptance // testing. This value sets TF_LOG_PATH in a safe manner when executing // Terraform CLI commands, which would otherwise be ignored since it could @@ -18,6 +36,17 @@ const ( // If TF_LOG_PATH_MASK is set, it takes precedence over this value. EnvTfAccLogPath = "TF_ACC_LOG_PATH" + // Environment variable with level to filter Terraform core logs during + // acceptance testing. This value sets TF_LOG_CORE separate from + // TF_LOG_PROVIDER when calling Terraform. + // + // This value has no affect when TF_ACC_LOG is set (which sets Terraform's + // TF_LOG), due to precedence rules in the Terraform core code. Use + // TF_LOG_CORE and TF_LOG_PROVIDER in that case instead. + // + // If not set, defaults to TF_ACC_LOG behaviors. + EnvTfLogCore = "TF_LOG_CORE" + // Environment variable with path containing the string %s, which is // replaced with the test name, to save separate Terraform logs during // acceptance testing. This value sets TF_LOG_PATH in a safe manner when @@ -27,6 +56,22 @@ const ( // Takes precedence over TF_ACC_LOG_PATH. EnvTfLogPathMask = "TF_LOG_PATH_MASK" + // Environment variable with level to filter Terraform provider logs during + // acceptance testing. This value sets TF_LOG_PROVIDER separate from + // TF_LOG_CORE. + // + // During testing, this only affects external providers whose logging goes + // through Terraform. The logging for the provider under test is controlled + // by the testing framework as it is running the provider code. Provider + // code using the Go standard library log package is controlled by TF_LOG + // for historical compatibility. + // + // This value takes precedence over TF_ACC_LOG for external provider logs, + // due to rules in the Terraform core code. + // + // If not set, defaults to TF_ACC_LOG behaviors. + EnvTfLogProvider = "TF_LOG_PROVIDER" + // Environment variable with acceptance testing Terraform CLI version to // download from releases.hashicorp.com, checksum verify, and install. The // value can be any valid Terraform CLI version, such as 1.1.6, with or diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/helper.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/helper.go index d5aecd87bce..0411eae0a87 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/helper.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest/helper.go @@ -139,9 +139,94 @@ func (h *Helper) NewWorkingDir(ctx context.Context, t TestControl) (*WorkingDir, return nil, fmt.Errorf("unable to disable terraform-exec provider verification: %w", err) } + tfAccLog := os.Getenv(EnvTfAccLog) + tfAccLogPath := os.Getenv(EnvTfAccLogPath) + tfLogCore := os.Getenv(EnvTfLogCore) + tfLogPathMask := os.Getenv(EnvTfLogPathMask) + tfLogProvider := os.Getenv(EnvTfLogProvider) + + if tfAccLog != "" && tfLogCore != "" { + err = fmt.Errorf( + "Invalid environment variable configuration. Cannot set both TF_ACC_LOG and TF_LOG_CORE. " + + "Use TF_LOG_CORE and TF_LOG_PROVIDER to separately control the Terraform CLI logging subsystems. " + + "To control the Go standard library log package for the provider under test, use TF_LOG.", + ) + logging.HelperResourceError(ctx, err.Error()) + return nil, err + } + + if tfAccLog != "" { + logging.HelperResourceTrace( + ctx, + fmt.Sprintf("Setting terraform-exec log level via %s environment variable, if Terraform CLI is version 0.15 or later", EnvTfAccLog), + map[string]interface{}{logging.KeyTestTerraformLogLevel: tfAccLog}, + ) + + err := tf.SetLog(tfAccLog) + + if err != nil { + if !errors.As(err, new(*tfexec.ErrVersionMismatch)) { + logging.HelperResourceError( + ctx, + "Unable to set terraform-exec log level", + map[string]interface{}{logging.KeyError: err.Error()}, + ) + return nil, fmt.Errorf("unable to set terraform-exec log level (%s): %w", tfAccLog, err) + } + + logging.HelperResourceWarn( + ctx, + fmt.Sprintf("Unable to set terraform-exec log level via %s environment variable, as Terraform CLI is version 0.14 or earlier. It will default to TRACE.", EnvTfAccLog), + map[string]interface{}{logging.KeyTestTerraformLogLevel: "TRACE"}, + ) + } + } + + if tfLogCore != "" { + logging.HelperResourceTrace( + ctx, + fmt.Sprintf("Setting terraform-exec core log level via %s environment variable, if Terraform CLI is version 0.15 or later", EnvTfLogCore), + map[string]interface{}{ + logging.KeyTestTerraformLogCoreLevel: tfLogCore, + }, + ) + + err := tf.SetLogCore(tfLogCore) + + if err != nil { + logging.HelperResourceError( + ctx, + "Unable to set terraform-exec core log level", + map[string]interface{}{logging.KeyError: err.Error()}, + ) + return nil, fmt.Errorf("unable to set terraform-exec core log level (%s): %w", tfLogCore, err) + } + } + + if tfLogProvider != "" { + logging.HelperResourceTrace( + ctx, + fmt.Sprintf("Setting terraform-exec provider log level via %s environment variable, if Terraform CLI is version 0.15 or later", EnvTfLogProvider), + map[string]interface{}{ + logging.KeyTestTerraformLogCoreLevel: tfLogProvider, + }, + ) + + err := tf.SetLogProvider(tfLogProvider) + + if err != nil { + logging.HelperResourceError( + ctx, + "Unable to set terraform-exec provider log level", + map[string]interface{}{logging.KeyError: err.Error()}, + ) + return nil, fmt.Errorf("unable to set terraform-exec provider log level (%s): %w", tfLogProvider, err) + } + } + var logPath, logPathEnvVar string - if tfAccLogPath := os.Getenv(EnvTfAccLogPath); tfAccLogPath != "" { + if tfAccLogPath != "" { logPath = tfAccLogPath logPathEnvVar = EnvTfAccLogPath } @@ -149,7 +234,7 @@ func (h *Helper) NewWorkingDir(ctx context.Context, t TestControl) (*WorkingDir, // Similar to helper/logging.LogOutput() and // terraform-plugin-log/tfsdklog.RegisterTestSink(), the TF_LOG_PATH_MASK // environment variable should take precedence over TF_ACC_LOG_PATH. - if tfLogPathMask := os.Getenv(EnvTfLogPathMask); tfLogPathMask != "" { + if tfLogPathMask != "" { // Escape special characters which may appear if we have subtests testName := strings.Replace(t.Name(), "/", "__", -1) logPath = fmt.Sprintf(tfLogPathMask, testName) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/.go-version b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/.go-version index 5ce8b395998..8e8b0a9335a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/.go-version +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/.go-version @@ -1 +1 @@ -1.18.1 \ No newline at end of file +1.18.5 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/CHANGELOG-v2.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/CHANGELOG-v2.md index dedcf63ee7d..0c4f2b69361 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/CHANGELOG-v2.md +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/CHANGELOG-v2.md @@ -4136,7 +4136,7 @@ NOTES: FEATURES: -* **Custom Timeouts:** - all resources within the Azure Provider now allow configuring custom timeouts - please [see Terraform's Timeout documentation](https://www.terraform.io/docs/configuration/resources.html#operation-timeouts) and the documentation in each data source resource for more information. +* **Custom Timeouts:** - all resources within the Azure Provider now allow configuring custom timeouts - please [see Terraform's Timeout documentation](https://www.terraform.io/language/resources/syntax#operation-timeouts) and the documentation in each data source resource for more information. * **Requires Import:** The Azure Provider now checks for the presence of an existing resource prior to creating it - which means that if you try and create a resource which already exists (without importing it) you'll be prompted to import this into the state. * **New Data Source:** `azurerm_app_service_environment` ([#5508](https://github.com/hashicorp/terraform-provider-azurerm/issues/5508)) * **New Data Source:** `azurerm_eventhub_authorization_rule` ([#5805](https://github.com/hashicorp/terraform-provider-azurerm/issues/5805)) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/CHANGELOG.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/CHANGELOG.md index 10ba3d6142e..da9298e6028 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/CHANGELOG.md +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/CHANGELOG.md @@ -1,12 +1,379 @@ -## 3.11.0 (Unreleased) +## 3.19.1 (August 19, 2022) + +BUG FIXES: + +* `azurerm_dns_a_record` - parse resource IDs insensitively in the read functions due to casing on the dnsZones segment ([#18048](https://github.com/hashicorp/terraform-provider-azurerm/issues/18048)) +* `azurerm_dns_aaaa_record` - parse resource IDs insensitively in the read functions due to casing on the dnsZones segment ([#18048](https://github.com/hashicorp/terraform-provider-azurerm/issues/18048)) +* `azurerm_dns_caa_record` - parse resource IDs insensitively in the read functions due to casing on the dnsZones segment ([#18048](https://github.com/hashicorp/terraform-provider-azurerm/issues/18048)) +* `azurerm_dns_cname_record` - parse resource IDs insensitively in the read functions due to casing on the dnsZones segment ([#18048](https://github.com/hashicorp/terraform-provider-azurerm/issues/18048)) +* `azurerm_dns_mx_record` - parse resource IDs insensitively in the read functions due to casing on the dnsZones segment ([#18048](https://github.com/hashicorp/terraform-provider-azurerm/issues/18048)) +* `azurerm_dns_ns_record` - parse resource IDs insensitively in the read functions due to casing on the dnsZones segment ([#18048](https://github.com/hashicorp/terraform-provider-azurerm/issues/18048)) +* `azurerm_dns_ptr_record` - parse resource IDs insensitively in the read functions due to casing on the dnsZones segment ([#18048](https://github.com/hashicorp/terraform-provider-azurerm/issues/18048)) +* `azurerm_dns_srv_record` - parse resource IDs insensitively in the read functions due to casing on the dnsZones segment ([#18048](https://github.com/hashicorp/terraform-provider-azurerm/issues/18048)) +* `azurerm_dns_txt_record` - parse resource IDs insensitively in the read functions due to casing on the dnsZones segment ([#18048](https://github.com/hashicorp/terraform-provider-azurerm/issues/18048)) +* `azurerm_dns_zone` - parse resource IDs insensitively in the read functions due to casing on the dnsZones segment ([#18048](https://github.com/hashicorp/terraform-provider-azurerm/issues/18048)) + +## 3.19.0 (August 18, 2022) + +FEATURES: + +* **New Data Source**: `azurerm_dns_a_record` ([#17477](https://github.com/hashicorp/terraform-provider-azurerm/issues/17477)) +* **New Data Source**: `azurerm_dns_aaaa_record` ([#17477](https://github.com/hashicorp/terraform-provider-azurerm/issues/17477)) +* **New Data Source**: `azurerm_dns_caa_record` ([#17477](https://github.com/hashicorp/terraform-provider-azurerm/issues/17477)) +* **New Data Source**: `azurerm_dns_cname_record` ([#17477](https://github.com/hashicorp/terraform-provider-azurerm/issues/17477)) +* **New Data Source**: `azurerm_dns_mx_record` ([#17477](https://github.com/hashicorp/terraform-provider-azurerm/issues/17477)) +* **New Data Source**: `azurerm_dns_ns_record` ([#17477](https://github.com/hashicorp/terraform-provider-azurerm/issues/17477)) +* **New Data Source**: `azurerm_dns_ptr_record` ([#17477](https://github.com/hashicorp/terraform-provider-azurerm/issues/17477)) +* **New Data Source**: `azurerm_dns_soa_record` ([#17477](https://github.com/hashicorp/terraform-provider-azurerm/issues/17477)) +* **New Data Source**: `azurerm_dns_srv_record` ([#17477](https://github.com/hashicorp/terraform-provider-azurerm/issues/17477)) +* **New Data Source**: `azurerm_dns_txt_record` ([#17477](https://github.com/hashicorp/terraform-provider-azurerm/issues/17477)) +* **New Data Source**: `azurerm_private_dns_a_record` ([#18036](https://github.com/hashicorp/terraform-provider-azurerm/issues/18036)) +* **New Data Source**: `azurerm_private_dns_aaaa_record` ([#18036](https://github.com/hashicorp/terraform-provider-azurerm/issues/18036)) +* **New Data Source**: `azurerm_private_dns_cname_record` ([#18036](https://github.com/hashicorp/terraform-provider-azurerm/issues/18036)) +* **New Data Source**: `azurerm_private_dns_mx_record` ([#18036](https://github.com/hashicorp/terraform-provider-azurerm/issues/18036)) +* **New Data Source**: `azurerm_private_dns_ptr_record` ([#18036](https://github.com/hashicorp/terraform-provider-azurerm/issues/18036)) +* **New Data Source**: `azurerm_private_dns_soa_record` ([#18036](https://github.com/hashicorp/terraform-provider-azurerm/issues/18036)) +* **New Data Source**: `azurerm_private_dns_srv_record` ([#18036](https://github.com/hashicorp/terraform-provider-azurerm/issues/18036)) +* **New Data Source**: `azurerm_private_dns_txt_record` ([#18036](https://github.com/hashicorp/terraform-provider-azurerm/issues/18036)) +* **New Resource**: `azurerm_eventhub_namespace_schema_group` ([#17635](https://github.com/hashicorp/terraform-provider-azurerm/issues/17635)) +* **New Resource**: `azurerm_cdn_frontdoor_firewall_policy` ([#17715](https://github.com/hashicorp/terraform-provider-azurerm/issues/17715)) +* **New Resource**: `azurerm_cdn_frontdoor_security_policy` ([#17715](https://github.com/hashicorp/terraform-provider-azurerm/issues/17715)) +* **New Resource**: `azurerm_data_factory_flowlet_data_flow` ([#16987](https://github.com/hashicorp/terraform-provider-azurerm/issues/16987)) + +ENHANCEMENTS: + +* Dependencies: update `go-azure-helpers` to `v0.39.1` ([#18015](https://github.com/hashicorp/terraform-provider-azurerm/issues/18015)) +* Dependencies: update `go-azure-sdk` to `v0.20220815.1092453` ([#17998](https://github.com/hashicorp/terraform-provider-azurerm/issues/17998)) +* Dependencies: `dedicated_host_*` to use `hashicorp/go-azure-sdk` ([#17616](https://github.com/hashicorp/terraform-provider-azurerm/issues/17616)) +* Dependencies: `dataprotection`: updating to use `hashicorp/go-azure-sdk` ([#17700](https://github.com/hashicorp/terraform-provider-azurerm/issues/17700)) +* Dependencies: `dns` - updating to use `hashicorp/go-azure-sdk` ([#17986](https://github.com/hashicorp/terraform-provider-azurerm/issues/17986)) +* Dependencies: `maintenance` - updating to use `hashicorp/go-azure-sdk` ([#17954](https://github.com/hashicorp/terraform-provider-azurerm/issues/17954)) +* Data Source: `azurerm_images` - now uses a logical id ([#17766](https://github.com/hashicorp/terraform-provider-azurerm/issues/17766)) +* Data Source: `azurerm_management_group` - now exports the `management_group_ids`, `all_management_group_ids`, and `all_subscription_ids` attributes ([#16208](https://github.com/hashicorp/terraform-provider-azurerm/issues/16208)) +* `azurerm_active_directory_domain_service` - support for the `kerberos_armoring_enabled` and `kerberos_rc4_encryption_enabled` properties ([#17853](https://github.com/hashicorp/terraform-provider-azurerm/issues/17853)) +* `azurerm_application_gateway` - support for the `global` block ([#17651](https://github.com/hashicorp/terraform-provider-azurerm/issues/17651)) +* `azurerm_application_gateway` - support for `components` in `rewrite_rule_set.rewrite_rule.url` ([#13899](https://github.com/hashicorp/terraform-provider-azurerm/issues/13899)) +* `azurerm_automation_account` - support for the `private_endpoint_connection` property ([#17934](https://github.com/hashicorp/terraform-provider-azurerm/issues/17934)) +* `azurerm_automation_account` - support for the `encryption` block and `local_authentication_enabled` property ([#17454](https://github.com/hashicorp/terraform-provider-azurerm/issues/17454)) +* `azurerm_batch_account` - support for the `storage_account_authentication_mode`, `storage_account_node_identit`, and `allowed_authentication_modes` properties ([#16758](https://github.com/hashicorp/terraform-provider-azurerm/issues/16758)) +* `azurerm_batch_pool` - support for identity referencees in container registries ([#17416](https://github.com/hashicorp/terraform-provider-azurerm/issues/17416)) +* `azurerm_data_factory_data_flow` - support for the `flowlet` block ([#16987](https://github.com/hashicorp/terraform-provider-azurerm/issues/16987)) +* `azurerm_data_factory_integration_runtime_azure_ssis` - support for the `express_vnet_injection` property ([#17756](https://github.com/hashicorp/terraform-provider-azurerm/issues/17756)) +* `azurerm_firewall_policy_resource` - support for the `private_ranges` and `allow_sql_redirect` properties ([#17842](https://github.com/hashicorp/terraform-provider-azurerm/issues/17842)) +* `azurerm_key_vault` - support for the `public_network_access_enabled` property ([#17552](https://github.com/hashicorp/terraform-provider-azurerm/issues/17552)) +* `azurerm_linux_virtual_machine` - now supports delete Eviction policies ([#17226](https://github.com/hashicorp/terraform-provider-azurerm/issues/17226)) +* `azurerm_linux_virtual_machine_scale_set` - now supports delete Eviction policies ([#17226](https://github.com/hashicorp/terraform-provider-azurerm/issues/17226)) +* `azurerm_mssql_elastic_pool` - support for the `maintenance_configuration_name` property ([#17790](https://github.com/hashicorp/terraform-provider-azurerm/issues/17790)) +* `azurerm_mssql_server` - support `Disabled` for the `minimum_tls_version` property ([#16595](https://github.com/hashicorp/terraform-provider-azurerm/issues/16595)) +* `azurerm_spring_cloud_app` - support the `public_endpoint_enabled` property ([#17630](https://github.com/hashicorp/terraform-provider-azurerm/issues/17630)) +* `azurerm_spring_cloud_gateway_route_config` - support for the `open_api;azurerm_spring_cloud_service` and `log_stream_public_endpoint_enabledread_timeout_seconds` properties ([#17630](https://github.com/hashicorp/terraform-provider-azurerm/issues/17630)) +* `azurerm_shared_image` - support for the `architecture` property ([#17250](https://github.com/hashicorp/terraform-provider-azurerm/issues/17250)) +* `azurerm_storage_account` - support for the `default_to_oauth_authentication` property ([#17116](https://github.com/hashicorp/terraform-provider-azurerm/issues/17116)) +* `azurerm_storage_table_entity` - support for specifying data types on entity properties ([#15782](https://github.com/hashicorp/terraform-provider-azurerm/issues/15782)) +* `azurerm_shared_image_version` - support for `blob_uri` and `storage_account_id` ([#17768](https://github.com/hashicorp/terraform-provider-azurerm/issues/17768)) +* `azurerm_windows_virtual_machine` - now supports delete Eviction policies ([#17226](https://github.com/hashicorp/terraform-provider-azurerm/issues/17226)) +* `azurerm_windows_virtual_machine_scale_set` - now supports delete Eviction policies ([#17226](https://github.com/hashicorp/terraform-provider-azurerm/issues/17226)) +* `azurerm_web_application_firewall_policy` - support for the `excluded_rule_set` property ([#17757](https://github.com/hashicorp/terraform-provider-azurerm/issues/17757)) +* `azurerm_log_analytics_workspace` - support for the `cmk_for_query_forced` property ([#17365](https://github.com/hashicorp/terraform-provider-azurerm/issues/17365)) +* `azurerm_lb_backend_address_pool_address` - support for the `backend_address_ip_configuration_id` property ([#17770](https://github.com/hashicorp/terraform-provider-azurerm/issues/17770)) + +BUG FIXES: + +* Data Source: `azurerm_windows_web_app` - add missing schema definition for 'virtual_network_subnet_id' ([#18028](https://github.com/hashicorp/terraform-provider-azurerm/issues/18028)) +* `azurerm_cdn_endpoint_custom_domain` - deprecating the `key_vault_certificate_id` property in favour of the `key_vault_secret_id` property withing the `user_managed https_allows` block ([#17114](https://github.com/hashicorp/terraform-provider-azurerm/issues/17114)) +* `azurerm_data_protection_backup_policy_postgresql_resource` - prevent a crash when given an empty criteria block ([#17904](https://github.com/hashicorp/terraform-provider-azurerm/issues/17904)) +* `azurerm_disk_encryption_set` - prevent an issue during creation when the disk encryption set and key vault are in different subscriptions ([#17964](https://github.com/hashicorp/terraform-provider-azurerm/issues/17964)) +* `azurerm_windows_function_app` fix a bug with setting values for `WindowsFxString` ([#18014](https://github.com/hashicorp/terraform-provider-azurerm/issues/18014)) +* `azurerm_windows_function_app_slot` - fix a bug with setting values for `WindowsFxString` ([#18014](https://github.com/hashicorp/terraform-provider-azurerm/issues/18014)) +* `azurerm_linux_function_app` - correctly send `WEBSITE_CONTENTSHARE` and `WEBSITE_CONTENTAZUREFILECONNECTIONSTRING` ([#18035](https://github.com/hashicorp/terraform-provider-azurerm/issues/18035)) +* `azurerm_linux_function_app` - fix content settings when `storage_uses_managed_identity` is set to `true` ([#18035](https://github.com/hashicorp/terraform-provider-azurerm/issues/18035)) +* `azurerm_linux_function_app_slot` - correctly send `WEBSITE_CONTENTSHARE` and `WEBSITE_CONTENTAZUREFILECONNECTIONSTRING` ([#18035](https://github.com/hashicorp/terraform-provider-azurerm/issues/18035)) +* `azurerm_linux_function_app_slot` - fix content settings when `storage_uses_managed_identity` is set to `true` ([#18035](https://github.com/hashicorp/terraform-provider-azurerm/issues/18035)) +* `azurerm_windows_function_app` - correctly send `WEBSITE_CONTENTSHARE` and `WEBSITE_CONTENTAZUREFILECONNECTIONSTRING` ([#18035](https://github.com/hashicorp/terraform-provider-azurerm/issues/18035)) +* `azurerm_windows_function_app` - fix content settings when `storage_uses_managed_identity` is set to `true` ([#18035](https://github.com/hashicorp/terraform-provider-azurerm/issues/18035)) +* `azurerm_windows_function_app_slot` - correctly send `WEBSITE_CONTENTSHARE` and `WEBSITE_CONTENTAZUREFILECONNECTIONSTRING` ([#18035](https://github.com/hashicorp/terraform-provider-azurerm/issues/18035)) +* `azurerm_windows_function_app_slot` - fix content settings when `storage_uses_managed_identity` is set to `true` ([#18035](https://github.com/hashicorp/terraform-provider-azurerm/issues/18035)) + +## 3.18.0 (August 11, 2022) + +FEATURES: + +* **New Resource**: `azurerm_monitor_data_collection_endpoint` ([#17684](https://github.com/hashicorp/terraform-provider-azurerm/issues/17684)) + +ENHANCEMENTS: + +* dependencies: updating `github.com/hashicorp/go-azure-sdk` to `v0.20220809.1122626` ([#17905](https://github.com/hashicorp/terraform-provider-azurerm/issues/17905)) +* storage: updating to use API Version `2021-09-01` ([#17523](https://github.com/hashicorp/terraform-provider-azurerm/issues/17523)) +* `azurerm_express_route_circuit_peering` - support for the `ipv4_enabled` and `gateway_manager_etag` properties ([#17338](https://github.com/hashicorp/terraform-provider-azurerm/issues/17338)) +* `azurerm_site_recovery_replicated_vm` - support for the `target_disk_encryption` block ([#15783](https://github.com/hashicorp/terraform-provider-azurerm/issues/15783)) +* `azurerm_subnet` - deprecate `enforce_private_link_endpoint_network_policies` property in favour of `private_endpoint_network_policies_enabled` ([#17464](https://github.com/hashicorp/terraform-provider-azurerm/issues/17464)) +* `azurerm_subnet` - deprecate `enforce_private_link_service_network_policies` property in favour of `private_link_service_network_policies_enabled` ([#17464](https://github.com/hashicorp/terraform-provider-azurerm/issues/17464)) +* `azurerm_servicebus_subscription` - support for the `client_scoped_subscription_enabled` property and the `client_scoped_subscription` block ([#17101](https://github.com/hashicorp/terraform-provider-azurerm/issues/17101)) + +BUG FIXES: + +* `azurerm_backup_policy_vm` - now prevents crash when `frequency` is set to Hourly and, `hour_interval` and `hour_duration`are not set ([#17880](https://github.com/hashicorp/terraform-provider-azurerm/issues/17880)) +* Data Source: `azurerm_blueprint_definition` - Fix `version` property output ([#16299](https://github.com/hashicorp/terraform-provider-azurerm/issues/16299)) + +## 3.17.0 (August 04, 2022) + +ENHANCEMENTS: + +* domainservice: updating to use API Version `2021-05-01` ([#17737](https://github.com/hashicorp/terraform-provider-azurerm/issues/17737)) +* Data Source: `azurerm_proximity_placement_group` - refactoring to use `hashicorp/go-azure-sdk` ([#17776](https://github.com/hashicorp/terraform-provider-azurerm/issues/17776)) +* `azurerm_api_management` - update the `sku_name` property validation to accept newer Premium SKUs ([#17887](https://github.com/hashicorp/terraform-provider-azurerm/issues/17887)) +* `azurerm_firewall` - the property `sku_tier` is now updateable ([#17577](https://github.com/hashicorp/terraform-provider-azurerm/issues/17577)) +* `azurerm_linux_virtual_machine_scale_set` - the property `instances` is now Optional and defaults to `0` ([#17836](https://github.com/hashicorp/terraform-provider-azurerm/issues/17836)) +* `azurerm_log_analytics_cluster` - updated validation for the `size_gb` property ([#17780](https://github.com/hashicorp/terraform-provider-azurerm/issues/17780)) +* `azurerm_proximity_placement_group` - refactoring to use `hashicorp/go-azure-sdk` ([#17776](https://github.com/hashicorp/terraform-provider-azurerm/issues/17776)) +* `azurerm_shared_image` - improved validation for the `publisher`, `offer` and `sku` properties in the `identifier` block ([#17547](https://github.com/hashicorp/terraform-provider-azurerm/issues/17547)) +* `azurerm_subnet` - support for the service delegation `Microsoft.Orbital/orbitalGateway` ([#17854](https://github.com/hashicorp/terraform-provider-azurerm/issues/17854)) +* `azurerm_eventhub_namespace` - support for the `local_authentication_enabled`, `public_network_access_enabled`, and `minimum_tls_version` properties ([#17194](https://github.com/hashicorp/terraform-provider-azurerm/issues/17194)) + +BUG FIXES: + +* Data Source: `azurerm_private_dns_zone` - returning the correct Resource ID when not specifying the `resource_group_name` ([#17729](https://github.com/hashicorp/terraform-provider-azurerm/issues/17729)) + +## 3.16.0 (July 28, 2022) + +FEATURES: + +* **New Resource**: `azurerm_datadog_monitor` ([#16131](https://github.com/hashicorp/terraform-provider-azurerm/issues/16131)) +* **New Resource**: `azurerm_kusto_cluster_managed_private_endpoint` ([#17667](https://github.com/hashicorp/terraform-provider-azurerm/issues/17667)) +* **New Resource**: `azurerm_log_analytics_query_pack` ([#17685](https://github.com/hashicorp/terraform-provider-azurerm/issues/17685)) +* **New Resource**: `azurerm_logz_sub_account_tag_rule` ([#17557](https://github.com/hashicorp/terraform-provider-azurerm/issues/17557)) +* **New Resource**: `azurerm_signalr_shared_private_link_resource` ([#16187](https://github.com/hashicorp/terraform-provider-azurerm/issues/16187)) ENHANCEMENTS: -* batch: updating to use API Version `2022-01-01` [GH-17219] +* dependencies: updating to version `v0.20220725.1163004` of `github.com/hashicorp/go-azure-sdk` ([#17753](https://github.com/hashicorp/terraform-provider-azurerm/issues/17753)) +* automationaccount: updating to use `hashicorp/go-azure-sdk` ([#17347](https://github.com/hashicorp/terraform-provider-azurerm/issues/17347)) +* Data Source: `azurerm_linux_function_app` - support the `virtual_network_subnet_id` property for for vNet integration ([#17494](https://github.com/hashicorp/terraform-provider-azurerm/issues/17494)) +* Data Source: `azurerm_windows_function_app` - support the `virtual_network_subnet_id` property for for vNet integration ([#17572](https://github.com/hashicorp/terraform-provider-azurerm/issues/17572)) +* Data Source: `azurerm_windows_web_app` - support the `virtual_network_subnet_id` property for for vNet integration ([#17576](https://github.com/hashicorp/terraform-provider-azurerm/issues/17576)) +* `eventhub`: updating all data sources/resources onto single API Version `2021-11-01` ([#17719](https://github.com/hashicorp/terraform-provider-azurerm/issues/17719)) +* `azurerm_bot_service_azure_bot` - support for the `streaming_endpoint_enabled` property ([#17423](https://github.com/hashicorp/terraform-provider-azurerm/issues/17423)) +* `azurerm_cognitive_account` - support for the `custom_question_answering_search_service_key` property ([#17683](https://github.com/hashicorp/terraform-provider-azurerm/issues/17683)) +* `asurerm_iothub_dps_certificate` - support for the `is_verified` property ([#17106](https://github.com/hashicorp/terraform-provider-azurerm/issues/17106)) +* `azurerm_linux_web_app`  - the `virtual_network_subnet_id` property is no longer `ForceNew` ([#17584](https://github.com/hashicorp/terraform-provider-azurerm/issues/17584)) +* `azurerm_linux_web_app_slot` - the `virtual_network_subnet_id` property is no longer `ForceNew` ([#17584](https://github.com/hashicorp/terraform-provider-azurerm/issues/17584)) +* `azurerm_linux_function_app` support the `virtual_network_subnet_id` property for for vNet integration ([#17494](https://github.com/hashicorp/terraform-provider-azurerm/issues/17494)) +* `azurerm_linux_function_app_slot` support the `virtual_network_subnet_id` property for for vNet integration ([#17494](https://github.com/hashicorp/terraform-provider-azurerm/issues/17494)) +* `azurerm_stream_analytics_stream_input_eventhub` - support for the `authentication_mode` property ([#17739](https://github.com/hashicorp/terraform-provider-azurerm/issues/17739)) +* `azurerm_windows_function_app` support the `virtual_network_subnet_id` property for for vNet integration ([#17572](https://github.com/hashicorp/terraform-provider-azurerm/issues/17572)) +* `azurerm_windows_function_app_slot` support the `virtual_network_subnet_id` property for for vNet integration ([#17572](https://github.com/hashicorp/terraform-provider-azurerm/issues/17572)) +* `azurerm_windows_web_app` support the `virtual_network_subnet_id` property for for vNet integration ([#17576](https://github.com/hashicorp/terraform-provider-azurerm/issues/17576)) +* `azurerm_windows_web_app_slot` support the `virtual_network_subnet_id` property for for vNet integration ([#17576](https://github.com/hashicorp/terraform-provider-azurerm/issues/17576)) BUG FIXES: -* `azurerm_shared_image_*` - Fix validation for `gallery_name` [GH-17201] +* `azurerm_linux_function_app` - fix casing bug with the `linux_fx_string` property for Node apps ([#17789](https://github.com/hashicorp/terraform-provider-azurerm/issues/17789)) +* `azurerm_linux_function_app_slot` - fix casing bug with the `linux_fx_string` property for Node apps ([#17789](https://github.com/hashicorp/terraform-provider-azurerm/issues/17789)) +* `azurerm_resource_group_template_deployment` - fixing a bug where the same Resource Provider defined in different casings would cause the API Version to not be identified ([#17707](https://github.com/hashicorp/terraform-provider-azurerm/issues/17707)) + +## 3.15.1 (July 25, 2022) + +BUG FIXES: + +* `data.azurerm_servicebus_queue` - fix a regression around `namespace_id` ([#17755](https://github.com/hashicorp/terraform-provider-azurerm/issues/17755)) +* `azurerm_postgresql_aad_administrator` - fix the state migration ([#17732](https://github.com/hashicorp/terraform-provider-azurerm/issues/17732)) +* `azurerm_postgresql_server` - fix a regression around `id` ([#17755](https://github.com/hashicorp/terraform-provider-azurerm/issues/17755)) + +## 3.15.0 (July 21, 2022) + +FEATURES: + +* **New Data Source**: `azurerm_cdn_frontdoor_origin_group` ([#17089](https://github.com/hashicorp/terraform-provider-azurerm/issues/17089)) +* **New Data Source**: `azurerm_cdn_frontdoor_origin` ([#17089](https://github.com/hashicorp/terraform-provider-azurerm/issues/17089)) +* **New Resource**: `azurerm_cdn_frontdoor_origin_group` ([#17089](https://github.com/hashicorp/terraform-provider-azurerm/issues/17089)) +* **New Resource**: `azurerm_cdn_frontdoor_origin` ([#17089](https://github.com/hashicorp/terraform-provider-azurerm/issues/17089)) +* **New Resource**: `azurerm_application_insights_workbook` ([#17368](https://github.com/hashicorp/terraform-provider-azurerm/issues/17368)) +* **New Resource**: `azurerm_monitor_data_collection_rule` ([#17342](https://github.com/hashicorp/terraform-provider-azurerm/issues/17342)) +* **New Resource**: `azurerm_route_server` ([#16578](https://github.com/hashicorp/terraform-provider-azurerm/issues/16578)) +* **New Resource**: `azurerm_route_server_bgp_connection` ([#16578](https://github.com/hashicorp/terraform-provider-azurerm/issues/16578)) +* **New Resource**: `azurerm_web_pubsub_private_link_resource` ([#15550](https://github.com/hashicorp/terraform-provider-azurerm/issues/15550)) + +ENHANCEMENTS: + +* dependencies: updating to `v0.20220715.1071215` of `github.com/hashicorp/go-azure-sdk` ([#17645](https://github.com/hashicorp/terraform-provider-azurerm/issues/17645)) +* domainservice: to use `hashicorp/go-azure-sdk` ([#17595](https://github.com/hashicorp/terraform-provider-azurerm/issues/17595)) +* servicebus: refactoring to use `hashicorp/go-azure-sdk` ([#17628](https://github.com/hashicorp/terraform-provider-azurerm/issues/17628)) +* postgres: refactoring to use `hashicorp/go-azure-sdk` ([#17625](https://github.com/hashicorp/terraform-provider-azurerm/issues/17625)) +* `azurerm_kusto_cluster_resource` - support for the `allowed_fqdns`, `allowed_ip_ranges`, and `outbound_network_access_restricted` properties ([#17581](https://github.com/hashicorp/terraform-provider-azurerm/issues/17581)) +* `azurerm_storage_account` - supports for the `change_feed_retention_in_days` property ([#17130](https://github.com/hashicorp/terraform-provider-azurerm/issues/17130)) + +## 3.14.0 (July 14, 2022) + +FEATURES: + +* **New Resource**: `azurerm_application_insights_workbook_template` ([#17433](https://github.com/hashicorp/terraform-provider-azurerm/issues/17433)) +* **New Resource**: `azurerm_gallery_application` ([#17394](https://github.com/hashicorp/terraform-provider-azurerm/issues/17394)) +* **New Resource**: `azurerm_gallery_application_version` ([#17394](https://github.com/hashicorp/terraform-provider-azurerm/issues/17394)) + +ENHANCEMENTS: + +* dependencies: updating to `v0.20220712.1111122` of `github.com/hashicorp/go-azure-sdk` ([#17606](https://github.com/hashicorp/terraform-provider-azurerm/issues/17606)) +* dependencies: updating to `v0.37.0` of `github.com/hashicorp/go-azure-helpers` ([#17588](https://github.com/hashicorp/terraform-provider-azurerm/issues/17588)) +* dependencies: updating to `v2.18.0` of `github.com/hashicorp/terraform-plugin-sdk` ([#17141](https://github.com/hashicorp/terraform-provider-azurerm/issues/17141)) +* appconfiguration: updating to use API Version `2022-05-01` ([#17467](https://github.com/hashicorp/terraform-provider-azurerm/issues/17467)) +* spring: updating to use API Version `2022-05-01-preview` ([#17467](https://github.com/hashicorp/terraform-provider-azurerm/issues/17467)) +* databricks: refactoring to use `hashicorp/go-azure-sdk` ([#17475](https://github.com/hashicorp/terraform-provider-azurerm/issues/17475)) +* lighthouse: refactoring to use `hashicorp/go-azure-sdk` ([#17590](https://github.com/hashicorp/terraform-provider-azurerm/issues/17590)) +* policyremediation: updated to use version `2021-10-01` ([#17298](https://github.com/hashicorp/terraform-provider-azurerm/issues/17298)) +* signalr: refactoring to use `hashicorp/go-azure-sdk` ([#17463](https://github.com/hashicorp/terraform-provider-azurerm/issues/17463)) +* storage: refactoring `objectreplicationpolicy` to use `hashicorp/go-azure-sdk` ([#17471](https://github.com/hashicorp/terraform-provider-azurerm/issues/17471)) +* Data Source: `azurerm_availability_set` - updating to use `hashicorp/go-azure-sdk` ([#17608](https://github.com/hashicorp/terraform-provider-azurerm/issues/17608)) +* Data Source: `azurerm_ssh_public_key` - refactoring to use `hashicorp/go-azure-sdk` ([#17609](https://github.com/hashicorp/terraform-provider-azurerm/issues/17609)) +* `azurerm_availability_set` - updating to use `hashicorp/go-azure-sdk` ([#17608](https://github.com/hashicorp/terraform-provider-azurerm/issues/17608)) +* `azurerm_container_group` - support for the `http_headers` property ([#17519](https://github.com/hashicorp/terraform-provider-azurerm/issues/17519)) +* `azurerm_dashboard` - refactoring to use `hashicorp/go-azure-sdk` ([#17598](https://github.com/hashicorp/terraform-provider-azurerm/issues/17598)) +* `azurerm_kusto_cluster` - support for the `public_ip_address` property ([#17520](https://github.com/hashicorp/terraform-provider-azurerm/issues/17520)) +* `azurerm_kusto_script` - support for the `script_content` property ([#17522](https://github.com/hashicorp/terraform-provider-azurerm/issues/17522)) +* `azurerm_kusto_iothub_data_connection` - support for the `database_routing_type` property ([#17526](https://github.com/hashicorp/terraform-provider-azurerm/issues/17526)) +* `azurerm_kusto_eventhub_data_connection` - support for the `database_routing_type` property ([#17525](https://github.com/hashicorp/terraform-provider-azurerm/issues/17525)) +* `azurerm_kusto_eventgrid_data_connection` - support for the `database_routing_type`, `eventgrid_resource_id`, and `managed_identity_resource_id` properties ([#17524](https://github.com/hashicorp/terraform-provider-azurerm/issues/17524)) +* `azurerm_kubernetes_cluster` - support for the `host_group_id` property ([#17496](https://github.com/hashicorp/terraform-provider-azurerm/issues/17496)) +* `azurerm_kubernetes_cluster_node_pool` - support for the `host_group_id` property ([#17496](https://github.com/hashicorp/terraform-provider-azurerm/issues/17496)) +* `azurerm_linux_virtual_machine_scale_set` - support for `capacity_reservation_group_id` property ([#17530](https://github.com/hashicorp/terraform-provider-azurerm/issues/17530)) +* `azurerm_linux_virtual_machine_scale_set` - support for the `placement` property for os disks ([#17013](https://github.com/hashicorp/terraform-provider-azurerm/issues/17013)) +* `azurerm_orchestrated_virtual_machine_scale_set` - support for the `placement` property for os disks ([#17013](https://github.com/hashicorp/terraform-provider-azurerm/issues/17013)) +* `azurerm_shared_image` - support for the `end_of_life_date` `disk_types_not_allowed`, `max_recommended_vcpu_count`, `max_recommended_vcpu_count`, `max_recommended_memory_in_gb`, `min_recommended_memory_in_gb` ([#17300](https://github.com/hashicorp/terraform-provider-azurerm/issues/17300)) +* `azurerm_signalr_service` - Add support for `live_trace` ([#17629](https://github.com/hashicorp/terraform-provider-azurerm/issues/17629)) +* `azurerm_ssh_public_key` - refactoring to use `hashicorp/go-azure-sdk` ([#17609](https://github.com/hashicorp/terraform-provider-azurerm/issues/17609)) +* `azurerm_stream_analytics_output_blob` - support for the `authentication_mode` property ([#16652](https://github.com/hashicorp/terraform-provider-azurerm/issues/16652)) +* `azurerm_windows_virtual_machine_scale_set` - support for `capacity_reservation_group_id` property ([#17530](https://github.com/hashicorp/terraform-provider-azurerm/issues/17530)) +* `azurerm_windows_virtual_machine_scale_set` - support for the `placement` property for os disks ([#17013](https://github.com/hashicorp/terraform-provider-azurerm/issues/17013)) + +BUG FIXES: + +* `azurerm_api_management` - correct set the API Management Cipher `TLS_RSA_WITH_3DES_EDE_CBC_SHA` ([#17554](https://github.com/hashicorp/terraform-provider-azurerm/issues/17554)) +* `azurerm_dev_test_lab_schedule` - deleting the schedule during deletion ([#17614](https://github.com/hashicorp/terraform-provider-azurerm/issues/17614)) +* `azurerm_linux_function_app` - set the `default_hostname` properly on read ([#17498](https://github.com/hashicorp/terraform-provider-azurerm/issues/17498)) +* `azurerm_linux_function_app_slot` - set the `default_hostname` properly on read ([#17498](https://github.com/hashicorp/terraform-provider-azurerm/issues/17498)) +* `azurerm_windows_function_app` - set the `default_hostname` properly on read ([#17498](https://github.com/hashicorp/terraform-provider-azurerm/issues/17498)) +* `azurerm_windows_function_app` - correctly create function apps when custom handlers are used ([#17498](https://github.com/hashicorp/terraform-provider-azurerm/issues/17498)) +* `azurerm_windows_function_app_slot` - set the `default_hostname` properly on read ([#17498](https://github.com/hashicorp/terraform-provider-azurerm/issues/17498)) +* `azurerm_windows_function_app_slot` - correctly create function apps when custom handlers are used ([#17498](https://github.com/hashicorp/terraform-provider-azurerm/issues/17498)) + +## 3.13.0 (July 08, 2022) + +FEATURES: + +* **New Data Source**: `azurerm_public_maintenance_configurations` ([#16810](https://github.com/hashicorp/terraform-provider-azurerm/issues/16810)) +* **New Resource**: `azurerm_fluid_relay_server` ([#17238](https://github.com/hashicorp/terraform-provider-azurerm/issues/17238)) +* **New Resource**: `azurerm_logz_sub_account` ([#16581](https://github.com/hashicorp/terraform-provider-azurerm/issues/16581)) + +ENHANCEMENTS: + +* azurestackhci: refactoring to use `hashicorp/go-azure-sdk` ([#17469](https://github.com/hashicorp/terraform-provider-azurerm/issues/17469)) +* containerinstance: refactoring to use `hashicorp/go-azure-sdk` ([#17499](https://github.com/hashicorp/terraform-provider-azurerm/issues/17499)) +* eventhub: refactoring to use `hashicorp/go-azure-sdk` ([#17445](https://github.com/hashicorp/terraform-provider-azurerm/issues/17445)) +* hardwaresecuritymodules: refactoring to use `hashicorp/go-azure-sdk` ([#17470](https://github.com/hashicorp/terraform-provider-azurerm/issues/17470)) +* netapp: refactoring to use `hashicorp/go-azure-sdk` ([#17465](https://github.com/hashicorp/terraform-provider-azurerm/issues/17465)) +* privatedns: refactoring to use `hashicorp/go-azure-sdk` ([#17436](https://github.com/hashicorp/terraform-provider-azurerm/issues/17436)) +* Data Source: `azurerm_container_registry` - add support for the `data_endpoint_enabled` property ([#17466](https://github.com/hashicorp/terraform-provider-azurerm/issues/17466)) +* `azurerm_hdinsight_kafka_cluster` -support for the `network` block ([#17259](https://github.com/hashicorp/terraform-provider-azurerm/issues/17259)) +* `azurerm_key_vault_certificate` - will now correctly recover certificates on import ([#17415](https://github.com/hashicorp/terraform-provider-azurerm/issues/17415)) +* `azurerm_kubernetes_clusterl`- support for the `capacity_reservation_group_id` property ([#17395](https://github.com/hashicorp/terraform-provider-azurerm/issues/17395)) +* `azurerm_kubernetes_node_pool`- support for the `capacity_reservation_group_id` property ([#17395](https://github.com/hashicorp/terraform-provider-azurerm/issues/17395)) +* `azurerm_linux_virtual_machine` - support for the `capacity_reservation_group_id` property ([#17236](https://github.com/hashicorp/terraform-provider-azurerm/issues/17236)) +* `azurerm_spring_cloud_deployment` - support for the `addon_json` property ([#16984](https://github.com/hashicorp/terraform-provider-azurerm/issues/16984)) +* `azurerm_synapse_integration_runtime_azure` - the `location` property now supports `Auto Resolve` ([#17111](https://github.com/hashicorp/terraform-provider-azurerm/issues/17111)) +* `azurerm_windows_virtual_machine` - support for the `capacity_reservation_group_id` property ([#17236](https://github.com/hashicorp/terraform-provider-azurerm/issues/17236)) + +BUG FIXES: + +* `azurerm_application_gateway` - the `request_routing_rule.x.priority` property is now optional ([#17380](https://github.com/hashicorp/terraform-provider-azurerm/issues/17380)) + +## 3.12.0 (June 30, 2022) + +FEATURES: + +* **New Resource**: `azurerm_active_directory_domain_service_trust` ([#17045](https://github.com/hashicorp/terraform-provider-azurerm/issues/17045)) +* **New Resource**: `azurerm_data_protection_resource_guard` ([#17325](https://github.com/hashicorp/terraform-provider-azurerm/issues/17325)) +* **New Resource**: `azurerm_spring_cloud_api_portal_custom_domain` ([#16966](https://github.com/hashicorp/terraform-provider-azurerm/issues/16966)) + +ENHANCEMENTS: + +* dependencies: updating to `v0.20220628.1190740` of `github.com/hashicorp/go-azure-sdk` ([#17399](https://github.com/hashicorp/terraform-provider-azurerm/issues/17399)) +* appservice: replacing usages of `ioutil` with `io` ([#17392](https://github.com/hashicorp/terraform-provider-azurerm/issues/17392)) +* containerservice: updated to use version `2022-03-02-preview` ([#17084](https://github.com/hashicorp/terraform-provider-azurerm/issues/17084)) +* elastic: refactoring to use `hashicorp/go-azure-sdk` ([#17431](https://github.com/hashicorp/terraform-provider-azurerm/issues/17431)) +* loadtest: refactoring to use `hashicorp/go-azure-sdk` ([#17432](https://github.com/hashicorp/terraform-provider-azurerm/issues/17432)) +* maps: refactoring to use `hashicorp/go-azure-sdk` ([#17434](https://github.com/hashicorp/terraform-provider-azurerm/issues/17434)) +* mixedreality: switching to use `hashicorp/go-azure-sdk` ([#17417](https://github.com/hashicorp/terraform-provider-azurerm/issues/17417)) +* msi: refactoring to use `hashicorp/go-azure-sdk` ([#17430](https://github.com/hashicorp/terraform-provider-azurerm/issues/17430)) +* powerbi: refactoring to use `hashicorp/go-azure-sdk` ([#17435](https://github.com/hashicorp/terraform-provider-azurerm/issues/17435)) +* purview: refactoring to use `hashicorp/go-azure-sdk` ([#17419](https://github.com/hashicorp/terraform-provider-azurerm/issues/17419)) +* redisenterprise: refactoring to use `hashicorp/go-azure-sdk` ([#17387](https://github.com/hashicorp/terraform-provider-azurerm/issues/17387)) +* relay: refactoring to use `hashicorp/go-azure-sdk` ([#17385](https://github.com/hashicorp/terraform-provider-azurerm/issues/17385)) +* search: refactoring to use `hashicorp/go-azure-sdk` ([#17386](https://github.com/hashicorp/terraform-provider-azurerm/issues/17386)) +* servicefabricmanaged: refactoring to use `hashicorp/go-azure-sdk` ([#17384](https://github.com/hashicorp/terraform-provider-azurerm/issues/17384)) +* trafficmanager: refactoring to use `hashicorp/go-azure-sdk` ([#17383](https://github.com/hashicorp/terraform-provider-azurerm/issues/17383)) +* videoanalyzer: refactoring to use `hashicorp/go-azure-sdk` ([#17382](https://github.com/hashicorp/terraform-provider-azurerm/issues/17382)) +* vmware: refactoring to use `hashicorp/go-azure-sdk` ([#17381](https://github.com/hashicorp/terraform-provider-azurerm/issues/17381)) +* Data Source: `azurerm_key_vault_key` - exporting the `resource_id` and `resource_versionless_id` attributes ([#17424](https://github.com/hashicorp/terraform-provider-azurerm/issues/17424)) +* Data Source: `azurerm_key_vault_secret` - exporting the `resource_id` and `resource_versionless_id` attributes ([#17424](https://github.com/hashicorp/terraform-provider-azurerm/issues/17424)) +* Data Source: `azurerm_spatial_anchors_account` - exposing the `tags` attribute ([#17417](https://github.com/hashicorp/terraform-provider-azurerm/issues/17417)) +* `azurerm_bot_service_azure_bot` - support new bot type with the `microsoft_app_msi_id`, `microsoft_app_tenant_id`, and `microsoft_app_type` properties ([#17077](https://github.com/hashicorp/terraform-provider-azurerm/issues/17077)) +* `azurerm_bot_channels_registration` - support for the `streaming_endpoint_enabled` property ([#17369](https://github.com/hashicorp/terraform-provider-azurerm/issues/17369)) +* `azurerm_data_factory` - support for the `purview_id` property ([#17001](https://github.com/hashicorp/terraform-provider-azurerm/issues/17001)) +* `azurerm_digital_twins_instance` - support for the `identity` block ([#17076](https://github.com/hashicorp/terraform-provider-azurerm/issues/17076)) +* `azurerm_key_vault_key` - exporting the `resource_id` and `resource_versionless_id` attributes ([#17424](https://github.com/hashicorp/terraform-provider-azurerm/issues/17424)) +* `azurerm_key_vault_secret` - exporting the `resource_id` and `resource_versionless_id` attributes ([#17424](https://github.com/hashicorp/terraform-provider-azurerm/issues/17424)) +* `azurerm_kubernetes_cluster` - support for version aliases ([#17084](https://github.com/hashicorp/terraform-provider-azurerm/issues/17084)) +* `azurerm_linux_web_app` - support for the `virtual_network_subnet_id` property ([#17354](https://github.com/hashicorp/terraform-provider-azurerm/issues/17354)) +* `azurerm_linux_web_app_slot` - support for the `virtual_network_subnet_id` property ([#17354](https://github.com/hashicorp/terraform-provider-azurerm/issues/17354)) +* `azurerm_private_link_service` - support for the `fqdns` property ([#17366](https://github.com/hashicorp/terraform-provider-azurerm/issues/17366)) +* `azurerm_shared_image_version` - support `Premium_LRS` for the `storage_account_type` property ([#17390](https://github.com/hashicorp/terraform-provider-azurerm/issues/17390)) +* `azurerm_shared_image_version` - support for the `disk_encryption_set_id`, `end_of_life_date`, and `replication_mode` properties ([#17295](https://github.com/hashicorp/terraform-provider-azurerm/issues/17295)) +* `azurerm_static_site_custom_domain` - the `validation_type` propety is now optional ([#15849](https://github.com/hashicorp/terraform-provider-azurerm/issues/15849)) +* `azurerm_vpn_site` - support for the `o365_policy` block ([#16820](https://github.com/hashicorp/terraform-provider-azurerm/issues/16820)) + +BUG FIXES: + +* Data Source: `azurerm_key_vault` - caching the Key Vault URI when the Key Vault has been retrieved ([#17407](https://github.com/hashicorp/terraform-provider-azurerm/issues/17407)) +* `azurerm_application_gateway` - prevent a crash when the `waf_configuration` block is removed ([#17241](https://github.com/hashicorp/terraform-provider-azurerm/issues/17241)) +* `azurerm_data_factory_dataset_snowflake` - ensuring `schema` is sent to the API to fix a UI bug in the Azure Data Factory Portal ([#17346](https://github.com/hashicorp/terraform-provider-azurerm/issues/17346)) +* `azurerm_data_factory_linked_service_azure_file_storage` - corredctly assign `user_id`([#17398](https://github.com/hashicorp/terraform-provider-azurerm/issues/17398)) +* `azurerm_key_vault` - ensuring that `soft_delete_enabled` is explicitly set when `purge_protection_enabled` is set ([#16368](https://github.com/hashicorp/terraform-provider-azurerm/issues/16368)) +* `azurerm_linux_function_app` - correctly validate the `app_setting_names` and `connection_string_names` properties within the `sticky_settings` block ([#17209](https://github.com/hashicorp/terraform-provider-azurerm/issues/17209)) +* `azurerm_linux_web_app` - correctly configure `auto_heal` and `slow_request` ([#17296](https://github.com/hashicorp/terraform-provider-azurerm/issues/17296)) +* `azurerm_linux_web_app` - correctly validate the `app_setting_names` and `connection_string_names` properties within the `sticky_settings` block ([#17209](https://github.com/hashicorp/terraform-provider-azurerm/issues/17209)) +* `azurerm_management_group_policy_assignment` - the `name` property can no longer contain `/` ([#16484](https://github.com/hashicorp/terraform-provider-azurerm/issues/16484)) +* `azurerm_policy_assignment` - the `name` property can no longer contain `/` ([#16484](https://github.com/hashicorp/terraform-provider-azurerm/issues/16484)) +* `azurerm_resource_group_policy_assignment` - the `name` property can no longer contain `/` ([#16484](https://github.com/hashicorp/terraform-provider-azurerm/issues/16484)) +* `azurerm_subscription_policy_assignment` - the `name` property can no longer contain `/` ([#16484](https://github.com/hashicorp/terraform-provider-azurerm/issues/16484)) +* `azurerm_windows_function_app` - correctly validate the `app_setting_names` and `connection_string_names` properties within the `sticky_settings` block ([#17209](https://github.com/hashicorp/terraform-provider-azurerm/issues/17209)) +* `azurerm_windows_web_app` - correctly configure `auto_heal` and `slow_request` ([#17296](https://github.com/hashicorp/terraform-provider-azurerm/issues/17296)) +* `azurerm_windows_web_app` - correctly validate the `app_setting_names` and `connection_string_names` properties within the `sticky_settings` block ([#17209](https://github.com/hashicorp/terraform-provider-azurerm/issues/17209)) + +## 3.11.0 (June 23, 2022) + +FEATURES: + +* **New Data Source**: `azurerm_management_group_template_deployment` ([#14524](https://github.com/hashicorp/terraform-provider-azurerm/issues/14524)) +* **New Data Source**: `azurerm_policy_assignment` ([#16527](https://github.com/hashicorp/terraform-provider-azurerm/issues/16527)) +* **New Data Source**: `azurerm_resource_group_template_deployment` ([#14524](https://github.com/hashicorp/terraform-provider-azurerm/issues/14524)) +* **New Data Source**: `azurerm_subscription_template_deployment` ([#14524](https://github.com/hashicorp/terraform-provider-azurerm/issues/14524)) +* **New Data Source**: `azurerm_tenant_template_deployment` ([#14524](https://github.com/hashicorp/terraform-provider-azurerm/issues/14524)) + +ENHANCEMENTS: + +* dependencies: updating to `v0.20220623.1064317` of `github.com/hashicorp/go-azure-sdk` ([#17348](https://github.com/hashicorp/terraform-provider-azurerm/issues/17348)) +* batch: updating to use API Version `2022-01-01` ([#17219](https://github.com/hashicorp/terraform-provider-azurerm/issues/17219)) +* confidentialledger: updating to use API Version `2022-05-13` ([#17146](https://github.com/hashicorp/terraform-provider-azurerm/issues/17146)) +* desktopvirtualization: refactoring to use `hashicorp/go-azure-sdk` ([#17340](https://github.com/hashicorp/terraform-provider-azurerm/issues/17340)) +* Data Source: `azurerm_managed_disk` - exporting the `disk_access_id` attribute ([#17270](https://github.com/hashicorp/terraform-provider-azurerm/issues/17270)) +* Data Source: `azurerm_managed_disk` - exporting the `network_access_policy` attribute ([#17270](https://github.com/hashicorp/terraform-provider-azurerm/issues/17270)) +* Data Source: `azurerm_storage_account` - add support for the `identity` property ([#17215](https://github.com/hashicorp/terraform-provider-azurerm/issues/17215)) + +BUG FIXES: + +* Data Source: `azurerm_mysql_flexible_server` - generate the correct terraform resource ID ([#17301](https://github.com/hashicorp/terraform-provider-azurerm/issues/17301)) +* `azurerm_shared_image` - the `privacy_statement_uri`, `publisher`, `offer`, and `sku` fields are now ForceNew ([#17289](https://github.com/hashicorp/terraform-provider-azurerm/issues/17289)) +* `azurerm_shared_image_*` - correctly validate the `gallery_name` property ([#17201](https://github.com/hashicorp/terraform-provider-azurerm/issues/17201)) +* `azurerm_time_series_insights_gen2_environment` - correctly order `id_properties` ([#17234](https://github.com/hashicorp/terraform-provider-azurerm/issues/17234)) ## 3.10.0 (June 09, 2022) @@ -17,7 +384,6 @@ FEATURES: * **New Resource**: `azurerm_capacity_reservation` ([#16464](https://github.com/hashicorp/terraform-provider-azurerm/issues/16464)) * **New Resource**: `azurerm_cdn_frontdoor_rule_set` ([#17094](https://github.com/hashicorp/terraform-provider-azurerm/issues/17094)) - ENHANCEMENTS: * `azurerm_cosmosdb_cassandra_cluster` - support for the `authentication_method`, `client_certificate`, `external_gossip_certificate`, `external_seed_node`, `identity`, `repair_enabled` and `version` properties ([#16799](https://github.com/hashicorp/terraform-provider-azurerm/issues/16799)) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/DEVELOPER.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/DEVELOPER.md index 90328c60d93..2809df0638f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/DEVELOPER.md +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/DEVELOPER.md @@ -3,6 +3,10 @@ * [Terraform (Core)](https://www.terraform.io/downloads.html) - version 1.x (0.12.x and above are compatible however 1.x is recommended) * [Go](https://golang.org/doc/install) version 1.18.x (to build the provider plugin) +## Contributor Guides + +A Collection of guides geared towards contributors can be found in the [`/contributing`](https://github.com/hashicorp/terraform-provider-azurerm/tree/main/contributing) directory of this repository. + ### On Windows If you're on Windows you'll also need: diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/README.md index 564ae78d3e1..764ae6ad4c3 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/README.md +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/README.md @@ -58,6 +58,6 @@ resource "azurerm_virtual_network" "example" { * [Learn more about Terraform and the AzureRM Provider on HashiCorp Learn](https://learn.hashicorp.com/collections/terraform/azure-get-started). * [Additional examples can be found in the `./examples` folder within this repository](https://github.com/hashicorp/terraform-provider-azurerm/tree/main/examples). -## Developing the Provider +## Developing & Contributing to the Provider -See [DEVELOPER.md](DEVELOPER.md). +The [DEVELOPER.md](DEVELOPER.md) file is a basic outline on how to build and develop the provider while more detailed guides geared towards contributors can be found in the [`/contributing`] (https://github.com/hashicorp/terraform-provider-azurerm/tree/main/contributing) directory of this repository. diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/helpers/azure/resource_group.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/helpers/azure/resource_group.go index 6fa712ecd79..a9c494287a0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/helpers/azure/resource_group.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/helpers/azure/resource_group.go @@ -3,7 +3,6 @@ package azure import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/clients/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/clients/client.go index f460294421c..e39ae857ecd 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/clients/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/clients/client.go @@ -5,6 +5,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/validation" + dns_v2018_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01" "github.com/hashicorp/terraform-provider-azurerm/internal/common" "github.com/hashicorp/terraform-provider-azurerm/internal/features" aadb2c "github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/client" @@ -35,6 +36,7 @@ import ( datamigration "github.com/hashicorp/terraform-provider-azurerm/internal/services/databasemigration/client" databoxedge "github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/client" databricks "github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/client" + datadog "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/client" datafactory "github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/client" dataprotection "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/client" datashare "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/client" @@ -48,6 +50,7 @@ import ( eventgrid "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid/client" eventhub "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/client" firewall "github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/client" + fluidrelay "github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/client" frontdoor "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/client" hdinsight "github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/client" healthcare "github.com/hashicorp/terraform-provider-azurerm/internal/services/healthcare/client" @@ -146,6 +149,7 @@ type Client struct { DatabaseMigration *datamigration.Client DataBricks *databricks.Client DataboxEdge *databoxedge.Client + Datadog *datadog.Client DataFactory *datafactory.Client DataProtection *dataprotection.Client DataShare *datashare.Client @@ -153,12 +157,13 @@ type Client struct { DevTestLabs *devtestlabs.Client DigitalTwins *digitaltwins.Client Disks *disks.Client - Dns *dns.Client + Dns *dns_v2018_05_01.Client DomainServices *domainservices.Client Elastic *elastic.Client EventGrid *eventgrid.Client Eventhub *eventhub.Client Firewall *firewall.Client + FluidRelay *fluidrelay.Client Frontdoor *frontdoor.Client HPCCache *hpccache.Client HSM *hsm.Client @@ -259,6 +264,7 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error client.DatabaseMigration = datamigration.NewClient(o) client.DataBricks = databricks.NewClient(o) client.DataboxEdge = databoxedge.NewClient(o) + client.Datadog = datadog.NewClient(o) client.DataFactory = datafactory.NewClient(o) client.DataProtection = dataprotection.NewClient(o) client.DataShare = datashare.NewClient(o) @@ -272,6 +278,7 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error client.EventGrid = eventgrid.NewClient(o) client.Eventhub = eventhub.NewClient(o) client.Firewall = firewall.NewClient(o) + client.FluidRelay = fluidrelay.NewClient(o) client.Frontdoor = frontdoor.NewClient(o) client.HPCCache = hpccache.NewClient(o) client.HSM = hsm.NewClient(o) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/features/three_point_oh.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/features/three_point_oh.go deleted file mode 100644 index e338de46649..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/features/three_point_oh.go +++ /dev/null @@ -1,18 +0,0 @@ -package features - -// nolint gocritic -// DeprecatedInThreePointOh returns the deprecation message if the provider -// is running in 3.0 mode - otherwise is returns an empty string (such that -// this deprecation should be ignored). -// -// This will be used to signify resources which will be Deprecated in 3.0, -// but not Removed (which will happen in a later, presumably 4.x release). -func DeprecatedInThreePointOh(deprecationMessage string) string { - return deprecationMessage -} - -// ThreePointOh returns whether this provider is running in 3.0 mode -// that is to say - the final 3.0 release -func ThreePointOh() bool { - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/identity/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/identity/README.md deleted file mode 100644 index f888731d067..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/identity/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Identity - -This package is deprecated - please use the Identity Schema types in [commonschema](https://github.com/hashicorp/go-azure-helpers/tree/main/resourcemanager/commonschema) and the Expand/Flatten functions from [the `identity` package](https://github.com/hashicorp/go-azure-helpers/tree/main/resourcemanager/identity). diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/identity/schema.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/identity/schema.go deleted file mode 100644 index 93c9f04956a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/identity/schema.go +++ /dev/null @@ -1,22 +0,0 @@ -package identity - -import ( - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" -) - -type Type string - -type ExpandedConfig struct { - // Type is the type of User Assigned Identity, either `None`, `SystemAssigned`, `UserAssigned` - // or `SystemAssigned, UserAssigned` - Type Type `tfschema:"type"` - PrincipalId string `tfschema:"principal_id"` - TenantId string `tfschema:"tenant_id"` - UserAssignedIdentityIds []string `tfschema:"identity_ids"` -} - -type Identity interface { - Expand(input []interface{}) (*ExpandedConfig, error) - Flatten(input *ExpandedConfig) []interface{} - Schema() *pluginsdk.Schema -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/identity/sdk.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/identity/sdk.go deleted file mode 100644 index a073e8b95e2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/identity/sdk.go +++ /dev/null @@ -1,278 +0,0 @@ -package identity - -type userAssignedIdentity struct { - ResourceId *string `json:"resourceId,omitempty"` - userAssignedIdentityInfo -} - -type userAssignedIdentityInfo struct { - ClientId *string `json:"clientId,omitempty"` - PrincipalId *string `json:"principalId,omitempty"` -} - -type ExpandedConfigCaster interface { - ToExpandedConfig() ExpandedConfig - FromExpandedConfig(ExpandedConfig) -} - -var _ ExpandedConfigCaster = &SystemAssignedIdentity{} - -type SystemAssignedIdentity struct { - Type Type `json:"type,omitempty"` - TenantId *string `json:"tenantId,omitempty"` - PrincipalId *string `json:"principalId,omitempty"` -} - -func (s *SystemAssignedIdentity) ToExpandedConfig() ExpandedConfig { - if s == nil { - return ExpandedConfig{} - } - principalId := "" - if s.PrincipalId != nil { - principalId = *s.PrincipalId - } - tenantId := "" - if s.TenantId != nil { - tenantId = *s.TenantId - } - return ExpandedConfig{ - Type: s.Type, - PrincipalId: principalId, - TenantId: tenantId, - } -} - -func (s *SystemAssignedIdentity) FromExpandedConfig(config ExpandedConfig) { - if s == nil { - return - } - *s = SystemAssignedIdentity{ - Type: config.Type, - TenantId: &config.TenantId, - PrincipalId: &config.PrincipalId, - } -} - -var _ ExpandedConfigCaster = &UserAssignedIdentityList{} - -type UserAssignedIdentityList struct { - Type Type `json:"type,omitempty"` - UserAssignedIdentities *[]userAssignedIdentity `json:"userAssignedIdentities"` -} - -func (u *UserAssignedIdentityList) ToExpandedConfig() ExpandedConfig { - if u == nil { - return ExpandedConfig{} - } - out := ExpandedConfig{ - Type: u.Type, - } - - if u.UserAssignedIdentities == nil { - return out - } - - var identities []string - for _, id := range *u.UserAssignedIdentities { - if id.ResourceId == nil { - continue - } - identities = append(identities, *id.PrincipalId) - } - out.UserAssignedIdentityIds = identities - - return out -} - -func (u *UserAssignedIdentityList) FromExpandedConfig(config ExpandedConfig) { - if u == nil { - return - } - *u = UserAssignedIdentityList{ - Type: config.Type, - } - - if len(config.UserAssignedIdentityIds) == 0 { - return - } - - var identities []userAssignedIdentity - for _, id := range config.UserAssignedIdentityIds { - identities = append(identities, userAssignedIdentity{ - ResourceId: &id, - }) - } - u.UserAssignedIdentities = &identities -} - -var _ ExpandedConfigCaster = &UserAssignedIdentityMap{} - -type UserAssignedIdentityMap struct { - Type Type `json:"type,omitempty"` - UserAssignedIdentities map[string]*userAssignedIdentityInfo `json:"userAssignedIdentities"` -} - -func (u *UserAssignedIdentityMap) ToExpandedConfig() ExpandedConfig { - if u == nil { - return ExpandedConfig{} - } - out := ExpandedConfig{ - Type: u.Type, - } - - var identities []string - for k := range u.UserAssignedIdentities { - identities = append(identities, k) - } - - out.UserAssignedIdentityIds = identities - - return out -} - -func (u *UserAssignedIdentityMap) FromExpandedConfig(config ExpandedConfig) { - if u == nil { - return - } - - *u = UserAssignedIdentityMap{ - Type: config.Type, - } - - if len(config.UserAssignedIdentityIds) == 0 { - return - } - - u.UserAssignedIdentities = map[string]*userAssignedIdentityInfo{} - for _, id := range config.UserAssignedIdentityIds { - // The user assigned identity information is not used by the provider. So simply assign the value to nil. - u.UserAssignedIdentities[id] = &userAssignedIdentityInfo{ClientId: nil, PrincipalId: nil} - } -} - -var _ ExpandedConfigCaster = &SystemUserAssignedIdentityList{} - -type SystemUserAssignedIdentityList struct { - Type Type `json:"type,omitempty"` - TenantId *string `json:"tenantId,omitempty"` - PrincipalId *string `json:"principalId,omitempty"` - UserAssignedIdentities *[]userAssignedIdentity `json:"userAssignedIdentities"` -} - -func (s *SystemUserAssignedIdentityList) ToExpandedConfig() ExpandedConfig { - if s == nil { - return ExpandedConfig{} - } - principalId := "" - if s.PrincipalId != nil { - principalId = *s.PrincipalId - } - tenantId := "" - if s.TenantId != nil { - tenantId = *s.TenantId - } - - out := ExpandedConfig{ - Type: s.Type, - PrincipalId: principalId, - TenantId: tenantId, - } - - if s.UserAssignedIdentities == nil { - return out - } - - var identities []string - for _, id := range *s.UserAssignedIdentities { - if id.ResourceId == nil { - continue - } - identities = append(identities, *id.ResourceId) - } - out.UserAssignedIdentityIds = identities - - return out -} - -func (s *SystemUserAssignedIdentityList) FromExpandedConfig(config ExpandedConfig) { - if s == nil { - return - } - - *s = SystemUserAssignedIdentityList{ - Type: config.Type, - TenantId: &config.TenantId, - PrincipalId: &config.PrincipalId, - } - - if len(config.UserAssignedIdentityIds) == 0 { - return - } - - var identities []userAssignedIdentity - for _, id := range config.UserAssignedIdentityIds { - identities = append(identities, userAssignedIdentity{ - ResourceId: &id, - }) - } - s.UserAssignedIdentities = &identities -} - -var _ ExpandedConfigCaster = &SystemUserAssignedIdentityMap{} - -type SystemUserAssignedIdentityMap struct { - Type Type `json:"type,omitempty"` - TenantId *string `json:"tenantId,omitempty"` - PrincipalId *string `json:"principalId,omitempty"` - UserAssignedIdentities map[string]*userAssignedIdentityInfo `json:"userAssignedIdentities"` -} - -func (s *SystemUserAssignedIdentityMap) ToExpandedConfig() ExpandedConfig { - if s == nil { - return ExpandedConfig{} - } - principalId := "" - if s.PrincipalId != nil { - principalId = *s.PrincipalId - } - tenantId := "" - if s.TenantId != nil { - tenantId = *s.TenantId - } - - out := ExpandedConfig{ - Type: s.Type, - PrincipalId: principalId, - TenantId: tenantId, - } - - var identities []string - for k := range s.UserAssignedIdentities { - identities = append(identities, k) - } - out.UserAssignedIdentityIds = identities - - return out -} - -func (s *SystemUserAssignedIdentityMap) FromExpandedConfig(config ExpandedConfig) { - if s == nil { - return - } - - *s = SystemUserAssignedIdentityMap{ - Type: config.Type, - TenantId: &config.TenantId, - PrincipalId: &config.PrincipalId, - } - - if len(config.UserAssignedIdentityIds) == 0 { - return - } - - s.UserAssignedIdentities = map[string]*userAssignedIdentityInfo{} - for _, id := range config.UserAssignedIdentityIds { - // The user assigned identity information is not used by the provider. So simply assign the value to nil. - s.UserAssignedIdentities[id] = &userAssignedIdentityInfo{ClientId: nil, PrincipalId: nil} - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/provider/services.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/provider/services.go index ca6cd4ec388..84c85dc8d6e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/provider/services.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/provider/services.go @@ -31,6 +31,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/databasemigration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge" "github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory" "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare" @@ -44,6 +45,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub" "github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay" "github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor" "github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight" "github.com/hashicorp/terraform-provider-azurerm/internal/services/healthcare" @@ -113,17 +115,23 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { aadb2c.Registration{}, apimanagement.Registration{}, appconfiguration.Registration{}, + applicationinsights.Registration{}, appservice.Registration{}, batch.Registration{}, bot.Registration{}, + compute.Registration{}, consumption.Registration{}, containers.Registration{}, costmanagement.Registration{}, disks.Registration{}, + domainservices.Registration{}, eventhub.Registration{}, + fluidrelay.Registration{}, keyvault.Registration{}, loadbalancer.Registration{}, loadtest.Registration{}, + loganalytics.Registration{}, + monitor.Registration{}, mssql.Registration{}, policy.Registration{}, resource.Registration{}, @@ -162,6 +170,7 @@ func SupportedUntypedServices() []sdk.UntypedServiceRegistration { cosmos.Registration{}, customproviders.Registration{}, databricks.Registration{}, + datadog.Registration{}, datafactory.Registration{}, databasemigration.Registration{}, databoxedge.Registration{}, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/sdk/resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/sdk/resource.go index 301af4b672f..12fb5662159 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/sdk/resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/sdk/resource.go @@ -11,13 +11,23 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) -type resourceBase interface { +// resourceWithPluginSdkSchema defines the Arguments and Attributes for this resource +// using the types defined in Plugin SDKv2 +type resourceWithPluginSdkSchema interface { // Arguments is a list of user-configurable (that is: Required, Optional, or Optional and Computed) // arguments for this Resource Arguments() map[string]*schema.Schema // Attributes is a list of read-only (e.g. Computed-only) attributes Attributes() map[string]*schema.Schema +} + +type resourceBase interface { + // resourceWithPluginSdkSchema ensure that the Arguments and Attributes are sourced + // from Plugin SDKv2 for now - longer term we'll likely introduce a `Typed Schema` + // which will cross-compile down to both the Plugin SDKv2 and Plugin Framework, but + // that's a story for another day. + resourceWithPluginSdkSchema // ModelObject is an instance of the object the Schema is decoded/encoded into ModelObject() interface{} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/aadb2c_directory_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/aadb2c_directory_data_source.go index 23f3d39ce35..662bc28c2ab 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/aadb2c_directory_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/aadb2c_directory_data_source.go @@ -7,9 +7,8 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -39,7 +38,7 @@ func (r AadB2cDirectoryDataSource) ModelObject() interface{} { } func (r AadB2cDirectoryDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return validate.B2CDirectoryID + return tenants.ValidateB2CDirectoryID } func (r AadB2cDirectoryDataSource) Arguments() map[string]*pluginsdk.Schema { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/aadb2c_directory_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/aadb2c_directory_resource.go index e3bdc28465d..fc4c044e737 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/aadb2c_directory_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/aadb2c_directory_resource.go @@ -6,10 +6,10 @@ import ( "net/http" "time" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -44,7 +44,7 @@ func (r AadB2cDirectoryResource) ModelObject() interface{} { } func (r AadB2cDirectoryResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return validate.B2CDirectoryID + return tenants.ValidateB2CDirectoryID } func (r AadB2cDirectoryResource) Arguments() map[string]*pluginsdk.Schema { @@ -160,7 +160,7 @@ func (r AadB2cDirectoryResource) Create() sdk.ResourceFunc { } metadata.Logger.Infof("Domain name availability check for %s", id) - availabilityResult, err := client.CheckNameAvailability(ctx, tenants.NewSubscriptionID(subscriptionId), tenants.CheckNameAvailabilityRequest{ + availabilityResult, err := client.CheckNameAvailability(ctx, commonids.NewSubscriptionID(subscriptionId), tenants.CheckNameAvailabilityRequest{ Name: &model.DomainName, CountryCode: &model.CountryCode, }) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/client/client.go index 5783e0551cc..90b8f5531cc 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/client/client.go @@ -1,8 +1,8 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/client.go deleted file mode 100644 index 4db63e86e66..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package tenants - -import "github.com/Azure/go-autorest/autorest" - -type TenantsClient struct { - Client autorest.Client - baseUri string -} - -func NewTenantsClientWithBaseURI(endpoint string) TenantsClient { - return TenantsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/constants.go deleted file mode 100644 index 735197e778a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/constants.go +++ /dev/null @@ -1,124 +0,0 @@ -package tenants - -import "strings" - -type BillingType string - -const ( - BillingTypeAuths BillingType = "auths" - BillingTypeMonthlyActiveUsers BillingType = "mau" -) - -func PossibleValuesForBillingType() []string { - return []string{ - string(BillingTypeAuths), - string(BillingTypeMonthlyActiveUsers), - } -} - -func parseBillingType(input string) (*BillingType, error) { - vals := map[string]BillingType{ - "auths": BillingTypeAuths, - "mau": BillingTypeMonthlyActiveUsers, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := BillingType(input) - return &out, nil -} - -type Location string - -const ( - LocationAsiaPacific Location = "Asia Pacific" - LocationAustralia Location = "Australia" - LocationEurope Location = "Europe" - LocationGlobal Location = "Global" - LocationUnitedStates Location = "United States" -) - -func PossibleValuesForLocation() []string { - return []string{ - string(LocationAsiaPacific), - string(LocationAustralia), - string(LocationEurope), - string(LocationGlobal), - string(LocationUnitedStates), - } -} - -func parseLocation(input string) (*Location, error) { - vals := map[string]Location{ - "asia pacific": LocationAsiaPacific, - "australia": LocationAustralia, - "europe": LocationEurope, - "global": LocationGlobal, - "united states": LocationUnitedStates, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Location(input) - return &out, nil -} - -type SkuName string - -const ( - SkuNamePremiumP1 SkuName = "PremiumP1" - SkuNamePremiumP2 SkuName = "PremiumP2" - SkuNameStandard SkuName = "Standard" -) - -func PossibleValuesForSkuName() []string { - return []string{ - string(SkuNamePremiumP1), - string(SkuNamePremiumP2), - string(SkuNameStandard), - } -} - -func parseSkuName(input string) (*SkuName, error) { - vals := map[string]SkuName{ - "premiump1": SkuNamePremiumP1, - "premiump2": SkuNamePremiumP2, - "standard": SkuNameStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SkuName(input) - return &out, nil -} - -type SkuTier string - -const ( - SkuTierA0 SkuTier = "A0" -) - -func PossibleValuesForSkuTier() []string { - return []string{ - string(SkuTierA0), - } -} - -func parseSkuTier(input string) (*SkuTier, error) { - vals := map[string]SkuTier{ - "a0": SkuTierA0, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SkuTier(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/id_resourcegroup.go deleted file mode 100644 index 12a29d402fe..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package tenants - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroup string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroup string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroup' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroup", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group: %q", id.ResourceGroup), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/id_subscription.go deleted file mode 100644 index 6930ba6ad66..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package tenants - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_checknameavailability_autorest.go deleted file mode 100644 index 57cb39ff5ea..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_checknameavailability_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package tenants - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CheckNameAvailabilityResponse struct { - HttpResponse *http.Response - Model *CheckNameAvailabilityResult -} - -// CheckNameAvailability ... -func (c TenantsClient) CheckNameAvailability(ctx context.Context, id SubscriptionId, input CheckNameAvailabilityRequest) (result CheckNameAvailabilityResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c TenantsClient) preparerForCheckNameAvailability(ctx context.Context, id SubscriptionId, input CheckNameAvailabilityRequest) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AzureActiveDirectory/checkNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c TenantsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_create_autorest.go deleted file mode 100644 index 235d5a68b94..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_create_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package tenants - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Create ... -func (c TenantsClient) Create(ctx context.Context, id B2CDirectoryId, input CreateTenant) (result CreateResponse, err error) { - req, err := c.preparerForCreate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateThenPoll performs Create then polls until it's completed -func (c TenantsClient) CreateThenPoll(ctx context.Context, id B2CDirectoryId, input CreateTenant) error { - result, err := c.Create(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} - -// preparerForCreate prepares the Create request. -func (c TenantsClient) preparerForCreate(ctx context.Context, id B2CDirectoryId, input CreateTenant) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreate sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (c TenantsClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_delete_autorest.go deleted file mode 100644 index 550cec4b785..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_delete_autorest.go +++ /dev/null @@ -1,73 +0,0 @@ -package tenants - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c TenantsClient) Delete(ctx context.Context, id B2CDirectoryId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c TenantsClient) DeleteThenPoll(ctx context.Context, id B2CDirectoryId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c TenantsClient) preparerForDelete(ctx context.Context, id B2CDirectoryId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c TenantsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_get_autorest.go deleted file mode 100644 index 126186719e5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package tenants - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *Tenant -} - -// Get ... -func (c TenantsClient) Get(ctx context.Context, id B2CDirectoryId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c TenantsClient) preparerForGet(ctx context.Context, id B2CDirectoryId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c TenantsClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 4e1bf15fc56..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package tenants - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *[]Tenant - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []Tenant -} - -func (r ListByResourceGroupResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c TenantsClient) ListByResourceGroup(ctx context.Context, id ResourceGroupId) (resp ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c TenantsClient) ListByResourceGroupComplete(ctx context.Context, id ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, TenantPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c TenantsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate TenantPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]Tenant, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c TenantsClient) preparerForListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AzureActiveDirectory/b2cDirectories", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c TenantsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c TenantsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - type page struct { - Values []Tenant `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_listbysubscription_autorest.go deleted file mode 100644 index 68605bb461f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_listbysubscription_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package tenants - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListBySubscriptionResponse struct { - HttpResponse *http.Response - Model *[]Tenant - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []Tenant -} - -func (r ListBySubscriptionResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListBySubscriptionResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListBySubscription ... -func (c TenantsClient) ListBySubscription(ctx context.Context, id SubscriptionId) (resp ListBySubscriptionResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c TenantsClient) ListBySubscriptionComplete(ctx context.Context, id SubscriptionId) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, TenantPredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c TenantsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate TenantPredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]Tenant, 0) - - page, err := c.ListBySubscription(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c TenantsClient) preparerForListBySubscription(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AzureActiveDirectory/b2cDirectories", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c TenantsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListBySubscription handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (c TenantsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionResponse, err error) { - type page struct { - Values []Tenant `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionResponse, err error) { - req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_update_autorest.go deleted file mode 100644 index 5e5fde96026..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/method_update_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package tenants - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UpdateResponse struct { - HttpResponse *http.Response - Model *Tenant -} - -// Update ... -func (c TenantsClient) Update(ctx context.Context, id B2CDirectoryId, input UpdateTenant) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "tenants.TenantsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c TenantsClient) preparerForUpdate(ctx context.Context, id B2CDirectoryId, input UpdateTenant) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c TenantsClient) responderForUpdate(resp *http.Response) (result UpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_billingconfig.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_billingconfig.go deleted file mode 100644 index 11da0bda66f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_billingconfig.go +++ /dev/null @@ -1,6 +0,0 @@ -package tenants - -type BillingConfig struct { - BillingType *BillingType `json:"billingType,omitempty"` - EffectiveStartDateUtc *string `json:"effectiveStartDateUtc,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_checknameavailabilityrequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_checknameavailabilityrequest.go deleted file mode 100644 index 96fc9554609..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_checknameavailabilityrequest.go +++ /dev/null @@ -1,6 +0,0 @@ -package tenants - -type CheckNameAvailabilityRequest struct { - CountryCode *string `json:"countryCode,omitempty"` - Name *string `json:"name,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_checknameavailabilityresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_checknameavailabilityresult.go deleted file mode 100644 index 9b2f8447d7a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_checknameavailabilityresult.go +++ /dev/null @@ -1,7 +0,0 @@ -package tenants - -type CheckNameAvailabilityResult struct { - Message *string `json:"message,omitempty"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason *string `json:"reason,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_createtenant.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_createtenant.go deleted file mode 100644 index 204caf6f161..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_createtenant.go +++ /dev/null @@ -1,8 +0,0 @@ -package tenants - -type CreateTenant struct { - Location Location `json:"location"` - Properties TenantPropertiesForCreate `json:"properties"` - Sku Sku `json:"sku"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_createtenantproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_createtenantproperties.go deleted file mode 100644 index bb2e6417e9b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_createtenantproperties.go +++ /dev/null @@ -1,6 +0,0 @@ -package tenants - -type CreateTenantProperties struct { - CountryCode string `json:"countryCode"` - DisplayName string `json:"displayName"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_sku.go deleted file mode 100644 index b6e98f5e5b7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_sku.go +++ /dev/null @@ -1,6 +0,0 @@ -package tenants - -type Sku struct { - Name SkuName `json:"name"` - Tier SkuTier `json:"tier"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_tenant.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_tenant.go deleted file mode 100644 index 93be19daea4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_tenant.go +++ /dev/null @@ -1,11 +0,0 @@ -package tenants - -type Tenant struct { - Id *string `json:"id,omitempty"` - Location *Location `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *TenantProperties `json:"properties,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_tenantproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_tenantproperties.go deleted file mode 100644 index 735bd05f711..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_tenantproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package tenants - -type TenantProperties struct { - BillingConfig *BillingConfig `json:"billingConfig,omitempty"` - CountryCode *string `json:"countryCode,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - TenantId *string `json:"tenantId,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_tenantpropertiesforcreate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_tenantpropertiesforcreate.go deleted file mode 100644 index 75700ee51ba..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_tenantpropertiesforcreate.go +++ /dev/null @@ -1,5 +0,0 @@ -package tenants - -type TenantPropertiesForCreate struct { - CreateTenantProperties CreateTenantProperties `json:"createTenantProperties"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_updatetenant.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_updatetenant.go deleted file mode 100644 index f9c67c66a92..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_updatetenant.go +++ /dev/null @@ -1,7 +0,0 @@ -package tenants - -type UpdateTenant struct { - Properties UpdateTenantProperties `json:"properties"` - Sku Sku `json:"sku"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_updatetenantproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_updatetenantproperties.go deleted file mode 100644 index 7bebae70f9e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/model_updatetenantproperties.go +++ /dev/null @@ -1,5 +0,0 @@ -package tenants - -type UpdateTenantProperties struct { - BillingConfig *BillingConfig `json:"billingConfig,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/predicates.go deleted file mode 100644 index e69357135eb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/predicates.go +++ /dev/null @@ -1,24 +0,0 @@ -package tenants - -type TenantPredicate struct { - Id *string - Name *string - Type *string -} - -func (p TenantPredicate) Matches(input Tenant) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/version.go deleted file mode 100644 index 915e4df30f7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package tenants - -import "fmt" - -const defaultApiVersion = "2021-04-01-preview" - -func userAgent() string { - return fmt.Sprintf("pandora/tenants/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/validate/directory_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/validate/directory_id.go deleted file mode 100644 index c9494b0cb33..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/validate/directory_id.go +++ /dev/null @@ -1,21 +0,0 @@ -package validate - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants" -) - -func B2CDirectoryID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := tenants.ParseB2CDirectoryID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/analysis_services_server_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/analysis_services_server_resource.go index 9150d3e8ee7..ce6723425ff 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/analysis_services_server_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/analysis_services_server_resource.go @@ -11,11 +11,11 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers" "github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -107,7 +107,7 @@ func resourceAnalysisServicesServer() *pluginsdk.Resource { }, }, }, - Set: hashAnalysisServicesServerIpv4FirewallRule, + Set: hashAnalysisServicesServerIPv4FirewallRule, }, "querypool_connection_mode": { @@ -197,8 +197,8 @@ func resourceAnalysisServicesServerRead(d *pluginsdk.ResourceData, meta interfac return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.ServerName) + d.Set("resource_group_name", id.ResourceGroupName) if model := server.Model; model != nil { d.Set("location", location.Normalize(model.Location)) @@ -323,7 +323,7 @@ func expandAnalysisServicesServerProperties(d *pluginsdk.ResourceData) *servers. AsAdministrators: adminUsers, } - serverProperties.IpV4FirewallSettings = expandAnalysisServicesServerFirewallSettings(d) + serverProperties.IPV4FirewallSettings = expandAnalysisServicesServerFirewallSettings(d) if querypoolConnectionMode, ok := d.GetOk("querypool_connection_mode"); ok { connectionMode := servers.ConnectionMode(querypoolConnectionMode.(string)) @@ -344,7 +344,7 @@ func expandAnalysisServicesServerMutableProperties(d *pluginsdk.ResourceData) *s AsAdministrators: adminUsers, } - serverProperties.IpV4FirewallSettings = expandAnalysisServicesServerFirewallSettings(d) + serverProperties.IPV4FirewallSettings = expandAnalysisServicesServerFirewallSettings(d) connectionMode := servers.ConnectionMode(d.Get("querypool_connection_mode").(string)) serverProperties.QuerypoolConnectionMode = &connectionMode @@ -393,11 +393,11 @@ func expandAnalysisServicesServerFirewallSettings(d *pluginsdk.ResourceData) *se } func flattenAnalysisServicesServerFirewallSettings(serverProperties *servers.AnalysisServicesServerProperties) (*bool, *pluginsdk.Set) { - if serverProperties == nil || serverProperties.IpV4FirewallSettings == nil { - return utils.Bool(false), pluginsdk.NewSet(hashAnalysisServicesServerIpv4FirewallRule, make([]interface{}, 0)) + if serverProperties == nil || serverProperties.IPV4FirewallSettings == nil { + return utils.Bool(false), pluginsdk.NewSet(hashAnalysisServicesServerIPv4FirewallRule, make([]interface{}, 0)) } - firewallSettings := serverProperties.IpV4FirewallSettings + firewallSettings := serverProperties.IPV4FirewallSettings enablePowerBi := utils.Bool(false) if firewallSettings.EnablePowerBIService != nil { @@ -424,10 +424,10 @@ func flattenAnalysisServicesServerFirewallSettings(serverProperties *servers.Ana } } - return enablePowerBi, pluginsdk.NewSet(hashAnalysisServicesServerIpv4FirewallRule, fwRules) + return enablePowerBi, pluginsdk.NewSet(hashAnalysisServicesServerIPv4FirewallRule, fwRules) } -func hashAnalysisServicesServerIpv4FirewallRule(v interface{}) int { +func hashAnalysisServicesServerIPv4FirewallRule(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/client/client.go index 657531ad59d..775ea1e7b80 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/client/client.go @@ -1,8 +1,8 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/client.go deleted file mode 100644 index b36c2be58b4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package servers - -import "github.com/Azure/go-autorest/autorest" - -type ServersClient struct { - Client autorest.Client - baseUri string -} - -func NewServersClientWithBaseURI(endpoint string) ServersClient { - return ServersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/constants.go deleted file mode 100644 index e1be284fc7b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/constants.go +++ /dev/null @@ -1,70 +0,0 @@ -package servers - -type ConnectionMode string - -const ( - ConnectionModeAll ConnectionMode = "All" - ConnectionModeReadOnly ConnectionMode = "ReadOnly" -) - -type ManagedMode int64 - -const ( - ManagedModeOne ManagedMode = 1 - ManagedModeZero ManagedMode = 0 -) - -type ProvisioningState string - -const ( - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStatePaused ProvisioningState = "Paused" - ProvisioningStatePausing ProvisioningState = "Pausing" - ProvisioningStatePreparing ProvisioningState = "Preparing" - ProvisioningStateProvisioning ProvisioningState = "Provisioning" - ProvisioningStateResuming ProvisioningState = "Resuming" - ProvisioningStateScaling ProvisioningState = "Scaling" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateSuspended ProvisioningState = "Suspended" - ProvisioningStateSuspending ProvisioningState = "Suspending" - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -type ServerMonitorMode int64 - -const ( - ServerMonitorModeOne ServerMonitorMode = 1 - ServerMonitorModeZero ServerMonitorMode = 0 -) - -type SkuTier string - -const ( - SkuTierBasic SkuTier = "Basic" - SkuTierDevelopment SkuTier = "Development" - SkuTierStandard SkuTier = "Standard" -) - -type State string - -const ( - StateDeleting State = "Deleting" - StateFailed State = "Failed" - StatePaused State = "Paused" - StatePausing State = "Pausing" - StatePreparing State = "Preparing" - StateProvisioning State = "Provisioning" - StateResuming State = "Resuming" - StateScaling State = "Scaling" - StateSucceeded State = "Succeeded" - StateSuspended State = "Suspended" - StateSuspending State = "Suspending" - StateUpdating State = "Updating" -) - -type Status int64 - -const ( - StatusZero Status = 0 -) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/id_location.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/id_location.go deleted file mode 100644 index 183565b79b7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/id_location.go +++ /dev/null @@ -1,95 +0,0 @@ -package servers - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type LocationId struct { - SubscriptionId string - Name string -} - -func NewLocationID(subscriptionId, name string) LocationId { - return LocationId{ - SubscriptionId: subscriptionId, - Name: name, - } -} - -func (id LocationId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Location", segmentsStr) -} - -func (id LocationId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.AnalysisServices/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Name) -} - -// ParseLocationID parses a Location ID into an LocationId struct -func ParseLocationID(input string) (*LocationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := LocationId{ - SubscriptionId: id.SubscriptionID, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.Name, err = id.PopSegment("locations"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// ParseLocationIDInsensitively parses an Location ID into an LocationId struct, insensitively -// This should only be used to parse an ID for rewriting to a consistent casing, -// the ParseLocationID method should be used instead for validation etc. -func ParseLocationIDInsensitively(input string) (*LocationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := LocationId{ - SubscriptionId: id.SubscriptionID, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - // find the correct casing for the 'locations' segment - locationsKey := "locations" - for key := range id.Path { - if strings.EqualFold(key, locationsKey) { - locationsKey = key - break - } - } - if resourceId.Name, err = id.PopSegment(locationsKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/id_operationstatuse.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/id_operationstatuse.go deleted file mode 100644 index 9cc64e47b55..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/id_operationstatuse.go +++ /dev/null @@ -1,113 +0,0 @@ -package servers - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type OperationstatuseId struct { - SubscriptionId string - LocationName string - Name string -} - -func NewOperationstatuseID(subscriptionId, locationName, name string) OperationstatuseId { - return OperationstatuseId{ - SubscriptionId: subscriptionId, - LocationName: locationName, - Name: name, - } -} - -func (id OperationstatuseId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Location Name %q", id.LocationName), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Operationstatuse", segmentsStr) -} - -func (id OperationstatuseId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.AnalysisServices/locations/%s/operationstatuses/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.Name) -} - -// ParseOperationstatuseID parses a Operationstatuse ID into an OperationstatuseId struct -func ParseOperationstatuseID(input string) (*OperationstatuseId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := OperationstatuseId{ - SubscriptionId: id.SubscriptionID, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.LocationName, err = id.PopSegment("locations"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("operationstatuses"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// ParseOperationstatuseIDInsensitively parses an Operationstatuse ID into an OperationstatuseId struct, insensitively -// This should only be used to parse an ID for rewriting to a consistent casing, -// the ParseOperationstatuseID method should be used instead for validation etc. -func ParseOperationstatuseIDInsensitively(input string) (*OperationstatuseId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := OperationstatuseId{ - SubscriptionId: id.SubscriptionID, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - // find the correct casing for the 'locations' segment - locationsKey := "locations" - for key := range id.Path { - if strings.EqualFold(key, locationsKey) { - locationsKey = key - break - } - } - if resourceId.LocationName, err = id.PopSegment(locationsKey); err != nil { - return nil, err - } - - // find the correct casing for the 'operationstatuses' segment - operationstatusesKey := "operationstatuses" - for key := range id.Path { - if strings.EqualFold(key, operationstatusesKey) { - operationstatusesKey = key - break - } - } - if resourceId.Name, err = id.PopSegment(operationstatusesKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/id_resourcegroup.go deleted file mode 100644 index a5febaf48ee..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/id_resourcegroup.go +++ /dev/null @@ -1,89 +0,0 @@ -package servers - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ResourceGroupId struct { - SubscriptionId string - ResourceGroup string -} - -func NewResourceGroupID(subscriptionId, resourceGroup string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - } -} - -func (id ResourceGroupId) String() string { - segments := []string{ - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Resource Group", segmentsStr) -} - -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup) -} - -// ParseResourceGroupID parses a ResourceGroup ID into an ResourceGroupId struct -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ResourceGroupId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// ParseResourceGroupIDInsensitively parses an ResourceGroup ID into an ResourceGroupId struct, insensitively -// This should only be used to parse an ID for rewriting to a consistent casing, -// the ParseResourceGroupID method should be used instead for validation etc. -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ResourceGroupId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/id_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/id_server.go deleted file mode 100644 index b5bfa49e65d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/id_server.go +++ /dev/null @@ -1,108 +0,0 @@ -package servers - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ServerId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewServerID(subscriptionId, resourceGroup, name string) ServerId { - return ServerId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ServerId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Server", segmentsStr) -} - -func (id ServerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AnalysisServices/servers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ParseServerID parses a Server ID into an ServerId struct -func ParseServerID(input string) (*ServerId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ServerId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("servers"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// ParseServerIDInsensitively parses an Server ID into an ServerId struct, insensitively -// This should only be used to parse an ID for rewriting to a consistent casing, -// the ParseServerID method should be used instead for validation etc. -func ParseServerIDInsensitively(input string) (*ServerId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ServerId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'servers' segment - serversKey := "servers" - for key := range id.Path { - if strings.EqualFold(key, serversKey) { - serversKey = key - break - } - } - if resourceId.Name, err = id.PopSegment(serversKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/id_subscription.go deleted file mode 100644 index 653164989bb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/id_subscription.go +++ /dev/null @@ -1,75 +0,0 @@ -package servers - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type SubscriptionId struct { - SubscriptionId string -} - -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -func (id SubscriptionId) String() string { - segments := []string{} - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Subscription", segmentsStr) -} - -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// ParseSubscriptionID parses a Subscription ID into an SubscriptionId struct -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := SubscriptionId{ - SubscriptionId: id.SubscriptionID, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// ParseSubscriptionIDInsensitively parses an Subscription ID into an SubscriptionId struct, insensitively -// This should only be used to parse an ID for rewriting to a consistent casing, -// the ParseSubscriptionID method should be used instead for validation etc. -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := SubscriptionId{ - SubscriptionId: id.SubscriptionID, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_checknameavailability_autorest.go deleted file mode 100644 index 1d7d378ec01..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_checknameavailability_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package servers - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CheckNameAvailabilityResponse struct { - HttpResponse *http.Response - Model *CheckServerNameAvailabilityResult -} - -// CheckNameAvailability ... -func (c ServersClient) CheckNameAvailability(ctx context.Context, id LocationId, input CheckServerNameAvailabilityParameters) (result CheckNameAvailabilityResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c ServersClient) preparerForCheckNameAvailability(ctx context.Context, id LocationId, input CheckServerNameAvailabilityParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/checkNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c ServersClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_create_autorest.go deleted file mode 100644 index e342c4cc036..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_create_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package servers - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Create ... -func (c ServersClient) Create(ctx context.Context, id ServerId, input AnalysisServicesServer) (result CreateResponse, err error) { - req, err := c.preparerForCreate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "Create", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateThenPoll performs Create then polls until it's completed -func (c ServersClient) CreateThenPoll(ctx context.Context, id ServerId, input AnalysisServicesServer) error { - result, err := c.Create(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} - -// preparerForCreate prepares the Create request. -func (c ServersClient) preparerForCreate(ctx context.Context, id ServerId, input AnalysisServicesServer) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreate sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (c ServersClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_delete_autorest.go deleted file mode 100644 index d9d1588e7dc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_delete_autorest.go +++ /dev/null @@ -1,73 +0,0 @@ -package servers - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c ServersClient) Delete(ctx context.Context, id ServerId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c ServersClient) DeleteThenPoll(ctx context.Context, id ServerId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c ServersClient) preparerForDelete(ctx context.Context, id ServerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c ServersClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_getdetails_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_getdetails_autorest.go deleted file mode 100644 index 450b2b6b406..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_getdetails_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package servers - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetDetailsResponse struct { - HttpResponse *http.Response - Model *AnalysisServicesServer -} - -// GetDetails ... -func (c ServersClient) GetDetails(ctx context.Context, id ServerId) (result GetDetailsResponse, err error) { - req, err := c.preparerForGetDetails(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "GetDetails", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "GetDetails", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetDetails(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "GetDetails", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetDetails prepares the GetDetails request. -func (c ServersClient) preparerForGetDetails(ctx context.Context, id ServerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetDetails handles the response to the GetDetails request. The method always -// closes the http.Response Body. -func (c ServersClient) responderForGetDetails(resp *http.Response) (result GetDetailsResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_list_autorest.go deleted file mode 100644 index f4cebc7f736..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_list_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package servers - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListResponse struct { - HttpResponse *http.Response - Model *AnalysisServicesServers -} - -// List ... -func (c ServersClient) List(ctx context.Context, id SubscriptionId) (result ListResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c ServersClient) preparerForList(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AnalysisServices/servers", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c ServersClient) responderForList(resp *http.Response) (result ListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_listbyresourcegroup_autorest.go deleted file mode 100644 index c879cf6a3ed..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package servers - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *AnalysisServicesServers -} - -// ListByResourceGroup ... -func (c ServersClient) ListByResourceGroup(ctx context.Context, id ResourceGroupId) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c ServersClient) preparerForListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AnalysisServices/servers", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c ServersClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_listoperationstatuses_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_listoperationstatuses_autorest.go deleted file mode 100644 index b73422840ed..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_listoperationstatuses_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package servers - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListOperationStatusesResponse struct { - HttpResponse *http.Response - Model *OperationStatus -} - -// ListOperationStatuses ... -func (c ServersClient) ListOperationStatuses(ctx context.Context, id OperationstatuseId) (result ListOperationStatusesResponse, err error) { - req, err := c.preparerForListOperationStatuses(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListOperationStatuses", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListOperationStatuses", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListOperationStatuses(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "ListOperationStatuses", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListOperationStatuses prepares the ListOperationStatuses request. -func (c ServersClient) preparerForListOperationStatuses(ctx context.Context, id OperationstatuseId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListOperationStatuses handles the response to the ListOperationStatuses request. The method always -// closes the http.Response Body. -func (c ServersClient) responderForListOperationStatuses(resp *http.Response) (result ListOperationStatusesResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_resume_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_resume_autorest.go deleted file mode 100644 index 3e8948b778e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_resume_autorest.go +++ /dev/null @@ -1,74 +0,0 @@ -package servers - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type ResumeResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Resume ... -func (c ServersClient) Resume(ctx context.Context, id ServerId) (result ResumeResponse, err error) { - req, err := c.preparerForResume(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "Resume", nil, "Failure preparing request") - return - } - - result, err = c.senderForResume(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "Resume", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ResumeThenPoll performs Resume then polls until it's completed -func (c ServersClient) ResumeThenPoll(ctx context.Context, id ServerId) error { - result, err := c.Resume(ctx, id) - if err != nil { - return fmt.Errorf("performing Resume: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Resume: %+v", err) - } - - return nil -} - -// preparerForResume prepares the Resume request. -func (c ServersClient) preparerForResume(ctx context.Context, id ServerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/resume", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForResume sends the Resume request. The method will close the -// http.Response Body if it receives an error. -func (c ServersClient) senderForResume(ctx context.Context, req *http.Request) (future ResumeResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_suspend_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_suspend_autorest.go deleted file mode 100644 index 42925c4cf1f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_suspend_autorest.go +++ /dev/null @@ -1,74 +0,0 @@ -package servers - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type SuspendResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Suspend ... -func (c ServersClient) Suspend(ctx context.Context, id ServerId) (result SuspendResponse, err error) { - req, err := c.preparerForSuspend(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "Suspend", nil, "Failure preparing request") - return - } - - result, err = c.senderForSuspend(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "Suspend", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// SuspendThenPoll performs Suspend then polls until it's completed -func (c ServersClient) SuspendThenPoll(ctx context.Context, id ServerId) error { - result, err := c.Suspend(ctx, id) - if err != nil { - return fmt.Errorf("performing Suspend: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Suspend: %+v", err) - } - - return nil -} - -// preparerForSuspend prepares the Suspend request. -func (c ServersClient) preparerForSuspend(ctx context.Context, id ServerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/suspend", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForSuspend sends the Suspend request. The method will close the -// http.Response Body if it receives an error. -func (c ServersClient) senderForSuspend(ctx context.Context, req *http.Request) (future SuspendResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_update_autorest.go deleted file mode 100644 index 20e1ef0924e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/method_update_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package servers - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type UpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c ServersClient) Update(ctx context.Context, id ServerId, input AnalysisServicesServerUpdateParameters) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "servers.ServersClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c ServersClient) UpdateThenPoll(ctx context.Context, id ServerId, input AnalysisServicesServerUpdateParameters) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c ServersClient) preparerForUpdate(ctx context.Context, id ServerId, input AnalysisServicesServerUpdateParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c ServersClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_analysisservicesservermutableproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_analysisservicesservermutableproperties.go deleted file mode 100644 index 8bafd6f51f1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_analysisservicesservermutableproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package servers - -type AnalysisServicesServerMutableProperties struct { - AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"` - BackupBlobContainerUri *string `json:"backupBlobContainerUri,omitempty"` - GatewayDetails *GatewayDetails `json:"gatewayDetails,omitempty"` - IpV4FirewallSettings *IPv4FirewallSettings `json:"ipV4FirewallSettings,omitempty"` - ManagedMode *ManagedMode `json:"managedMode,omitempty"` - QuerypoolConnectionMode *ConnectionMode `json:"querypoolConnectionMode,omitempty"` - ServerMonitorMode *ServerMonitorMode `json:"serverMonitorMode,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_analysisservicesservers.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_analysisservicesservers.go deleted file mode 100644 index 7a9adc75952..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_analysisservicesservers.go +++ /dev/null @@ -1,5 +0,0 @@ -package servers - -type AnalysisServicesServers struct { - Value []AnalysisServicesServer `json:"value"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_analysisservicesserverupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_analysisservicesserverupdateparameters.go deleted file mode 100644 index 2d1995dcd5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_analysisservicesserverupdateparameters.go +++ /dev/null @@ -1,7 +0,0 @@ -package servers - -type AnalysisServicesServerUpdateParameters struct { - Properties *AnalysisServicesServerMutableProperties `json:"properties,omitempty"` - Sku *ResourceSku `json:"sku,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_checkservernameavailabilityparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_checkservernameavailabilityparameters.go deleted file mode 100644 index 36d9fe394eb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_checkservernameavailabilityparameters.go +++ /dev/null @@ -1,6 +0,0 @@ -package servers - -type CheckServerNameAvailabilityParameters struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_checkservernameavailabilityresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_checkservernameavailabilityresult.go deleted file mode 100644 index 76c5c08b676..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_checkservernameavailabilityresult.go +++ /dev/null @@ -1,7 +0,0 @@ -package servers - -type CheckServerNameAvailabilityResult struct { - Message *string `json:"message,omitempty"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason *string `json:"reason,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_erroradditionalinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_erroradditionalinfo.go deleted file mode 100644 index b062cc22502..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_erroradditionalinfo.go +++ /dev/null @@ -1,6 +0,0 @@ -package servers - -type ErrorAdditionalInfo struct { - Info *interface{} `json:"info,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_errordetail.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_errordetail.go deleted file mode 100644 index b73053f9e90..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_errordetail.go +++ /dev/null @@ -1,12 +0,0 @@ -package servers - -type ErrorDetail struct { - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` - Code *string `json:"code,omitempty"` - Details *[]ErrorDetail `json:"details,omitempty"` - HttpStatusCode *int64 `json:"httpStatusCode,omitempty"` - Message *string `json:"message,omitempty"` - SubCode *int64 `json:"subCode,omitempty"` - Target *string `json:"target,omitempty"` - TimeStamp *string `json:"timeStamp,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_gatewaydetails.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_gatewaydetails.go deleted file mode 100644 index d9d3d995444..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_gatewaydetails.go +++ /dev/null @@ -1,7 +0,0 @@ -package servers - -type GatewayDetails struct { - DmtsClusterUri *string `json:"dmtsClusterUri,omitempty"` - GatewayObjectId *string `json:"gatewayObjectId,omitempty"` - GatewayResourceId *string `json:"gatewayResourceId,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_gatewayliststatuslive.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_gatewayliststatuslive.go deleted file mode 100644 index 346ab6e42fe..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_gatewayliststatuslive.go +++ /dev/null @@ -1,5 +0,0 @@ -package servers - -type GatewayListStatusLive struct { - Status *Status `json:"status,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_ipv4firewallrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_ipv4firewallrule.go deleted file mode 100644 index e771a1bfad8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_ipv4firewallrule.go +++ /dev/null @@ -1,7 +0,0 @@ -package servers - -type IPv4FirewallRule struct { - FirewallRuleName *string `json:"firewallRuleName,omitempty"` - RangeEnd *string `json:"rangeEnd,omitempty"` - RangeStart *string `json:"rangeStart,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_ipv4firewallsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_ipv4firewallsettings.go deleted file mode 100644 index edfc10f91e8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_ipv4firewallsettings.go +++ /dev/null @@ -1,6 +0,0 @@ -package servers - -type IPv4FirewallSettings struct { - EnablePowerBIService *bool `json:"enablePowerBIService,omitempty"` - FirewallRules *[]IPv4FirewallRule `json:"firewallRules,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_operationstatus.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_operationstatus.go deleted file mode 100644 index a6a78b749f6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_operationstatus.go +++ /dev/null @@ -1,10 +0,0 @@ -package servers - -type OperationStatus struct { - EndTime *string `json:"endTime,omitempty"` - Error *ErrorDetail `json:"error,omitempty"` - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - StartTime *string `json:"startTime,omitempty"` - Status *string `json:"status,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_resourcesku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_resourcesku.go deleted file mode 100644 index 0fccb12fe21..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_resourcesku.go +++ /dev/null @@ -1,7 +0,0 @@ -package servers - -type ResourceSku struct { - Capacity *int64 `json:"capacity,omitempty"` - Name string `json:"name"` - Tier *SkuTier `json:"tier,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_serveradministrators.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_serveradministrators.go deleted file mode 100644 index 78f35210e6d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_serveradministrators.go +++ /dev/null @@ -1,5 +0,0 @@ -package servers - -type ServerAdministrators struct { - Members *[]string `json:"members,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_skudetailsforexistingresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_skudetailsforexistingresource.go deleted file mode 100644 index 82920bb66da..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_skudetailsforexistingresource.go +++ /dev/null @@ -1,6 +0,0 @@ -package servers - -type SkuDetailsForExistingResource struct { - ResourceType *string `json:"resourceType,omitempty"` - Sku *ResourceSku `json:"sku,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_skuenumerationforexistingresourceresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_skuenumerationforexistingresourceresult.go deleted file mode 100644 index ddcf39d6bc8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/model_skuenumerationforexistingresourceresult.go +++ /dev/null @@ -1,5 +0,0 @@ -package servers - -type SkuEnumerationForExistingResourceResult struct { - Value *[]SkuDetailsForExistingResource `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/version.go deleted file mode 100644 index 54ad20e6aaa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package servers - -import "fmt" - -const defaultApiVersion = "2017-08-01" - -func userAgent() string { - return fmt.Sprintf("pandora/servers/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/validate/server_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/validate/server_id.go index 313b91d11c4..8667abb94be 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/validate/server_id.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/validate/server_id.go @@ -3,7 +3,7 @@ package validate import ( "fmt" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers" + "github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers" ) func ServerID(input interface{}, key string) (warnings []string, errors []error) { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/api_management_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/api_management_resource.go index 52ed5e5df59..76615c5a0f7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/api_management_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/api_management_resource.go @@ -36,7 +36,7 @@ var ( apimFrontendProtocolSsl3 = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30" apimFrontendProtocolTls10 = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10" apimFrontendProtocolTls11 = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11" - apimTripleDesCiphers = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168" + apimTripleDesCiphers = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_3DES_EDE_CBC_SHA" apimHttp2Protocol = "Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2" apimTlsEcdheEcdsaWithAes256CbcShaCiphers = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" apimTlsEcdheEcdsaWithAes128CbcShaCiphers = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate/api_management_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate/api_management_sku.go index e73eab34876..0616c65f6a8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate/api_management_sku.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate/api_management_sku.go @@ -9,7 +9,7 @@ import ( func ApimSkuName() pluginsdk.SchemaValidateFunc { return validation.StringMatch( - regexp.MustCompile(`^Consumption_0$|^Basic_(1|2)$|^Developer_1$|^Premium_([1-9]|10)$|^Standard_[1-4]$`), + regexp.MustCompile(`^Consumption_0$|^Basic_(1|2)$|^Developer_1$|^Premium_([1-9][0-9]{0,1})$|^Standard_[1-4]$`), `This is not a valid Api Management sku name.`, ) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/app_configuration_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/app_configuration_data_source.go index d4f07249837..8b4e2235591 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/app_configuration_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/app_configuration_data_source.go @@ -8,8 +8,8 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/app_configuration_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/app_configuration_resource.go index fd80aad466b..ce4b3054605 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/app_configuration_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/app_configuration_resource.go @@ -6,17 +6,15 @@ import ( "strings" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - legacyIdentity "github.com/hashicorp/terraform-provider-azurerm/internal/identity" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -201,7 +199,7 @@ func resourceAppConfigurationCreate(d *pluginsdk.ResourceData, meta interface{}) Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - identity, err := expandAppConfigurationIdentity(d.Get("identity").([]interface{})) + identity, err := identity.ExpandSystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } @@ -234,7 +232,7 @@ func resourceAppConfigurationUpdate(d *pluginsdk.ResourceData, meta interface{}) } if d.HasChange("identity") { - identity, err := expandAppConfigurationIdentity(d.Get("identity").([]interface{})) + identity, err := identity.ExpandSystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } @@ -290,7 +288,7 @@ func resourceAppConfigurationRead(d *pluginsdk.ResourceData, meta interface{}) e d.Set("secondary_read_key", accessKeys.secondaryReadKey) d.Set("secondary_write_key", accessKeys.secondaryWriteKey) - flattenedIdentity, err := flattenAppConfigurationIdentity(model.Identity) + flattenedIdentity, err := identity.FlattenSystemAndUserAssignedMap(model.Identity) if err != nil { return fmt.Errorf("flattening `identity`: %+v", err) } @@ -390,50 +388,3 @@ func flattenAppConfigurationAccessKey(input configurationstores.ApiKey) []interf }, } } - -func expandAppConfigurationIdentity(input []interface{}) (*legacyIdentity.SystemUserAssignedIdentityMap, error) { - expanded, err := identity.ExpandSystemAndUserAssignedMap(input) - if err != nil { - return nil, err - } - - transform := legacyIdentity.ExpandedConfig{ - Type: legacyIdentity.Type(string(expanded.Type)), - PrincipalId: expanded.PrincipalId, - TenantId: expanded.TenantId, - } - if expanded.Type == identity.TypeUserAssigned || expanded.Type == identity.TypeSystemAssignedUserAssigned { - transform.UserAssignedIdentityIds = make([]string, 0) - for k := range expanded.IdentityIds { - transform.UserAssignedIdentityIds = append(transform.UserAssignedIdentityIds, k) - } - } - out := legacyIdentity.SystemUserAssignedIdentityMap{} - out.FromExpandedConfig(transform) - return &out, nil -} - -func flattenAppConfigurationIdentity(input *legacyIdentity.SystemUserAssignedIdentityMap) (*[]interface{}, error) { - var transform *identity.SystemAndUserAssignedMap - - if input != nil { - transform = &identity.SystemAndUserAssignedMap{ - Type: identity.Type(string(input.Type)), - IdentityIds: make(map[string]identity.UserAssignedIdentityDetails), - } - if input.PrincipalId != nil { - transform.PrincipalId = *input.PrincipalId - } - if input.TenantId != nil { - transform.TenantId = *input.TenantId - } - for k, v := range input.UserAssignedIdentities { - transform.IdentityIds[k] = identity.UserAssignedIdentityDetails{ - ClientId: v.ClientId, - PrincipalId: v.PrincipalId, - } - } - } - - return identity.FlattenSystemAndUserAssignedMap(transform) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/client/client.go index 1213920e91a..5b12976a67f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/client/client.go @@ -4,12 +4,11 @@ import ( "context" "fmt" - "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/Azure/go-autorest/autorest" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores" "github.com/hashicorp/terraform-provider-azurerm/internal/common" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/1.0/appconfiguration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/client.go deleted file mode 100644 index ac4377b23a6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package configurationstores - -import "github.com/Azure/go-autorest/autorest" - -type ConfigurationStoresClient struct { - Client autorest.Client - baseUri string -} - -func NewConfigurationStoresClientWithBaseURI(endpoint string) ConfigurationStoresClient { - return ConfigurationStoresClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/constants.go deleted file mode 100644 index e0200039083..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/constants.go +++ /dev/null @@ -1,141 +0,0 @@ -package configurationstores - -import "strings" - -type ActionsRequired string - -const ( - ActionsRequiredNone ActionsRequired = "None" - ActionsRequiredRecreate ActionsRequired = "Recreate" -) - -func PossibleValuesForActionsRequired() []string { - return []string{ - "None", - "Recreate", - } -} - -func parseActionsRequired(input string) (*ActionsRequired, error) { - vals := map[string]ActionsRequired{ - "none": "None", - "recreate": "Recreate", - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // it could be a new value - best effort convert this - v := input - - out := ActionsRequired(v) - return &out, nil -} - -type ConnectionStatus string - -const ( - ConnectionStatusApproved ConnectionStatus = "Approved" - ConnectionStatusDisconnected ConnectionStatus = "Disconnected" - ConnectionStatusPending ConnectionStatus = "Pending" - ConnectionStatusRejected ConnectionStatus = "Rejected" -) - -func PossibleValuesForConnectionStatus() []string { - return []string{ - "Approved", - "Disconnected", - "Pending", - "Rejected", - } -} - -func parseConnectionStatus(input string) (*ConnectionStatus, error) { - vals := map[string]ConnectionStatus{ - "approved": "Approved", - "disconnected": "Disconnected", - "pending": "Pending", - "rejected": "Rejected", - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // it could be a new value - best effort convert this - v := input - - out := ConnectionStatus(v) - return &out, nil -} - -type ProvisioningState string - -const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -func PossibleValuesForProvisioningState() []string { - return []string{ - "Canceled", - "Creating", - "Deleting", - "Failed", - "Succeeded", - "Updating", - } -} - -func parseProvisioningState(input string) (*ProvisioningState, error) { - vals := map[string]ProvisioningState{ - "canceled": "Canceled", - "creating": "Creating", - "deleting": "Deleting", - "failed": "Failed", - "succeeded": "Succeeded", - "updating": "Updating", - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // it could be a new value - best effort convert this - v := input - - out := ProvisioningState(v) - return &out, nil -} - -type PublicNetworkAccess string - -const ( - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -func PossibleValuesForPublicNetworkAccess() []string { - return []string{ - "Disabled", - "Enabled", - } -} - -func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { - vals := map[string]PublicNetworkAccess{ - "disabled": "Disabled", - "enabled": "Enabled", - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // it could be a new value - best effort convert this - v := input - - out := PublicNetworkAccess(v) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/id_resourcegroup.go deleted file mode 100644 index aab2f00448b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package configurationstores - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/id_subscription.go deleted file mode 100644 index f39d80c53f5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package configurationstores - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_create_autorest.go deleted file mode 100644 index 78b3ada60b0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_create_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package configurationstores - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Create ... -func (c ConfigurationStoresClient) Create(ctx context.Context, id ConfigurationStoreId, input ConfigurationStore) (result CreateResponse, err error) { - req, err := c.preparerForCreate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Create", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateThenPoll performs Create then polls until it's completed -func (c ConfigurationStoresClient) CreateThenPoll(ctx context.Context, id ConfigurationStoreId, input ConfigurationStore) error { - result, err := c.Create(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} - -// preparerForCreate prepares the Create request. -func (c ConfigurationStoresClient) preparerForCreate(ctx context.Context, id ConfigurationStoreId, input ConfigurationStore) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreate sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (c ConfigurationStoresClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_delete_autorest.go deleted file mode 100644 index 91970e50477..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_delete_autorest.go +++ /dev/null @@ -1,73 +0,0 @@ -package configurationstores - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c ConfigurationStoresClient) Delete(ctx context.Context, id ConfigurationStoreId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c ConfigurationStoresClient) DeleteThenPoll(ctx context.Context, id ConfigurationStoreId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c ConfigurationStoresClient) preparerForDelete(ctx context.Context, id ConfigurationStoreId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c ConfigurationStoresClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_get_autorest.go deleted file mode 100644 index ea7ed1dddfb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package configurationstores - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *ConfigurationStore -} - -// Get ... -func (c ConfigurationStoresClient) Get(ctx context.Context, id ConfigurationStoreId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ConfigurationStoresClient) preparerForGet(ctx context.Context, id ConfigurationStoreId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ConfigurationStoresClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_list_autorest.go deleted file mode 100644 index d64e75707b8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_list_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package configurationstores - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListResponse struct { - HttpResponse *http.Response - Model *[]ConfigurationStore - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListResponse, error) -} - -type ListCompleteResult struct { - Items []ConfigurationStore -} - -func (r ListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListResponse) LoadMore(ctx context.Context) (resp ListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c ConfigurationStoresClient) List(ctx context.Context, id SubscriptionId) (resp ListResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c ConfigurationStoresClient) ListComplete(ctx context.Context, id SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, ConfigurationStorePredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ConfigurationStoresClient) ListCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate ConfigurationStorePredicate) (resp ListCompleteResult, err error) { - items := make([]ConfigurationStore, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForList prepares the List request. -func (c ConfigurationStoresClient) preparerForList(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AppConfiguration/configurationStores", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c ConfigurationStoresClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c ConfigurationStoresClient) responderForList(resp *http.Response) (result ListResponse, err error) { - type page struct { - Values []ConfigurationStore `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_listbyresourcegroup_autorest.go deleted file mode 100644 index de9ed78100f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package configurationstores - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *[]ConfigurationStore - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []ConfigurationStore -} - -func (r ListByResourceGroupResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c ConfigurationStoresClient) ListByResourceGroup(ctx context.Context, id ResourceGroupId) (resp ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c ConfigurationStoresClient) ListByResourceGroupComplete(ctx context.Context, id ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ConfigurationStorePredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ConfigurationStoresClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate ConfigurationStorePredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]ConfigurationStore, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c ConfigurationStoresClient) preparerForListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AppConfiguration/configurationStores", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c ConfigurationStoresClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c ConfigurationStoresClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - type page struct { - Values []ConfigurationStore `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_listkeys_autorest.go deleted file mode 100644 index b92965de4eb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_listkeys_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package configurationstores - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListKeysResponse struct { - HttpResponse *http.Response - Model *[]ApiKey - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListKeysResponse, error) -} - -type ListKeysCompleteResult struct { - Items []ApiKey -} - -func (r ListKeysResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListKeysResponse) LoadMore(ctx context.Context) (resp ListKeysResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListKeys ... -func (c ConfigurationStoresClient) ListKeys(ctx context.Context, id ConfigurationStoreId) (resp ListKeysResponse, err error) { - req, err := c.preparerForListKeys(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListKeys", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListKeys", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListKeys(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListKeys", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListKeysComplete retrieves all of the results into a single object -func (c ConfigurationStoresClient) ListKeysComplete(ctx context.Context, id ConfigurationStoreId) (ListKeysCompleteResult, error) { - return c.ListKeysCompleteMatchingPredicate(ctx, id, ApiKeyPredicate{}) -} - -// ListKeysCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ConfigurationStoresClient) ListKeysCompleteMatchingPredicate(ctx context.Context, id ConfigurationStoreId, predicate ApiKeyPredicate) (resp ListKeysCompleteResult, err error) { - items := make([]ApiKey, 0) - - page, err := c.ListKeys(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListKeysCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListKeys prepares the ListKeys request. -func (c ConfigurationStoresClient) preparerForListKeys(ctx context.Context, id ConfigurationStoreId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListKeysWithNextLink prepares the ListKeys request with the given nextLink token. -func (c ConfigurationStoresClient) preparerForListKeysWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListKeys handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (c ConfigurationStoresClient) responderForListKeys(resp *http.Response) (result ListKeysResponse, err error) { - type page struct { - Values []ApiKey `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListKeysResponse, err error) { - req, err := c.preparerForListKeysWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListKeys", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_listkeyvalue_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_listkeyvalue_autorest.go deleted file mode 100644 index 76a11fe9659..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_listkeyvalue_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package configurationstores - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListKeyValueResponse struct { - HttpResponse *http.Response - Model *KeyValue -} - -// ListKeyValue ... -func (c ConfigurationStoresClient) ListKeyValue(ctx context.Context, id ConfigurationStoreId, input ListKeyValueParameters) (result ListKeyValueResponse, err error) { - req, err := c.preparerForListKeyValue(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListKeyValue", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListKeyValue", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListKeyValue(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "ListKeyValue", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListKeyValue prepares the ListKeyValue request. -func (c ConfigurationStoresClient) preparerForListKeyValue(ctx context.Context, id ConfigurationStoreId, input ListKeyValueParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listKeyValue", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListKeyValue handles the response to the ListKeyValue request. The method always -// closes the http.Response Body. -func (c ConfigurationStoresClient) responderForListKeyValue(resp *http.Response) (result ListKeyValueResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_regeneratekey_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_regeneratekey_autorest.go deleted file mode 100644 index 87cab23bedd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_regeneratekey_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package configurationstores - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type RegenerateKeyResponse struct { - HttpResponse *http.Response - Model *ApiKey -} - -// RegenerateKey ... -func (c ConfigurationStoresClient) RegenerateKey(ctx context.Context, id ConfigurationStoreId, input RegenerateKeyParameters) (result RegenerateKeyResponse, err error) { - req, err := c.preparerForRegenerateKey(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "RegenerateKey", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegenerateKey(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "RegenerateKey", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegenerateKey prepares the RegenerateKey request. -func (c ConfigurationStoresClient) preparerForRegenerateKey(ctx context.Context, id ConfigurationStoreId, input RegenerateKeyParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regenerateKey", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegenerateKey handles the response to the RegenerateKey request. The method always -// closes the http.Response Body. -func (c ConfigurationStoresClient) responderForRegenerateKey(resp *http.Response) (result RegenerateKeyResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_update_autorest.go deleted file mode 100644 index 810ebbff1b6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/method_update_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package configurationstores - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type UpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c ConfigurationStoresClient) Update(ctx context.Context, id ConfigurationStoreId, input ConfigurationStoreUpdateParameters) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "configurationstores.ConfigurationStoresClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c ConfigurationStoresClient) UpdateThenPoll(ctx context.Context, id ConfigurationStoreId, input ConfigurationStoreUpdateParameters) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c ConfigurationStoresClient) preparerForUpdate(ctx context.Context, id ConfigurationStoreId, input ConfigurationStoreUpdateParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c ConfigurationStoresClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_apikey.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_apikey.go deleted file mode 100644 index bb0e143a81f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_apikey.go +++ /dev/null @@ -1,10 +0,0 @@ -package configurationstores - -type ApiKey struct { - ConnectionString *string `json:"connectionString,omitempty"` - Id *string `json:"id,omitempty"` - LastModified *string `json:"lastModified,omitempty"` - Name *string `json:"name,omitempty"` - ReadOnly *bool `json:"readOnly,omitempty"` - Value *string `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_configurationstore.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_configurationstore.go deleted file mode 100644 index 1820aba72c8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_configurationstore.go +++ /dev/null @@ -1,16 +0,0 @@ -package configurationstores - -import ( - "github.com/hashicorp/terraform-provider-azurerm/internal/identity" -) - -type ConfigurationStore struct { - Id *string `json:"id,omitempty"` - Identity *identity.SystemUserAssignedIdentityMap `json:"identity,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *ConfigurationStoreProperties `json:"properties,omitempty"` - Sku Sku `json:"sku"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_configurationstoreproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_configurationstoreproperties.go deleted file mode 100644 index f00d6bf9647..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_configurationstoreproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package configurationstores - -type ConfigurationStoreProperties struct { - CreationDate *string `json:"creationDate,omitempty"` - Encryption *EncryptionProperties `json:"encryption,omitempty"` - Endpoint *string `json:"endpoint,omitempty"` - PrivateEndpointConnections *[]PrivateEndpointConnectionReference `json:"privateEndpointConnections,omitempty"` - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` - PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_configurationstorepropertiesupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_configurationstorepropertiesupdateparameters.go deleted file mode 100644 index 96ada82f5c6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_configurationstorepropertiesupdateparameters.go +++ /dev/null @@ -1,6 +0,0 @@ -package configurationstores - -type ConfigurationStorePropertiesUpdateParameters struct { - Encryption *EncryptionProperties `json:"encryption,omitempty"` - PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_configurationstoreupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_configurationstoreupdateparameters.go deleted file mode 100644 index a4968eeaa8c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_configurationstoreupdateparameters.go +++ /dev/null @@ -1,12 +0,0 @@ -package configurationstores - -import ( - "github.com/hashicorp/terraform-provider-azurerm/internal/identity" -) - -type ConfigurationStoreUpdateParameters struct { - Identity *identity.SystemUserAssignedIdentityMap `json:"identity,omitempty"` - Properties *ConfigurationStorePropertiesUpdateParameters `json:"properties,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_encryptionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_encryptionproperties.go deleted file mode 100644 index e53ec95700f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_encryptionproperties.go +++ /dev/null @@ -1,5 +0,0 @@ -package configurationstores - -type EncryptionProperties struct { - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_keyvalue.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_keyvalue.go deleted file mode 100644 index ac880dd9eff..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_keyvalue.go +++ /dev/null @@ -1,12 +0,0 @@ -package configurationstores - -type KeyValue struct { - ContentType *string `json:"contentType,omitempty"` - ETag *string `json:"eTag,omitempty"` - Key *string `json:"key,omitempty"` - Label *string `json:"label,omitempty"` - LastModified *string `json:"lastModified,omitempty"` - Locked *bool `json:"locked,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Value *string `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_keyvaultproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_keyvaultproperties.go deleted file mode 100644 index d013eaf7a73..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_keyvaultproperties.go +++ /dev/null @@ -1,6 +0,0 @@ -package configurationstores - -type KeyVaultProperties struct { - IdentityClientId *string `json:"identityClientId,omitempty"` - KeyIdentifier *string `json:"keyIdentifier,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_listkeyvalueparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_listkeyvalueparameters.go deleted file mode 100644 index ee7c8b4738c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_listkeyvalueparameters.go +++ /dev/null @@ -1,6 +0,0 @@ -package configurationstores - -type ListKeyValueParameters struct { - Key string `json:"key"` - Label *string `json:"label,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_privateendpoint.go deleted file mode 100644 index 91860fa0d07..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_privateendpoint.go +++ /dev/null @@ -1,5 +0,0 @@ -package configurationstores - -type PrivateEndpoint struct { - Id *string `json:"id,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_privateendpointconnectionproperties.go deleted file mode 100644 index 85fa5c76899..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_privateendpointconnectionproperties.go +++ /dev/null @@ -1,7 +0,0 @@ -package configurationstores - -type PrivateEndpointConnectionProperties struct { - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_privateendpointconnectionreference.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_privateendpointconnectionreference.go deleted file mode 100644 index 9a6c75dc801..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_privateendpointconnectionreference.go +++ /dev/null @@ -1,8 +0,0 @@ -package configurationstores - -type PrivateEndpointConnectionReference struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_privatelinkserviceconnectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_privatelinkserviceconnectionstate.go deleted file mode 100644 index e42c185e084..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_privatelinkserviceconnectionstate.go +++ /dev/null @@ -1,7 +0,0 @@ -package configurationstores - -type PrivateLinkServiceConnectionState struct { - ActionsRequired *ActionsRequired `json:"actionsRequired,omitempty"` - Description *string `json:"description,omitempty"` - Status *ConnectionStatus `json:"status,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_regeneratekeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_regeneratekeyparameters.go deleted file mode 100644 index 6d9a37f0a50..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_regeneratekeyparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package configurationstores - -type RegenerateKeyParameters struct { - Id *string `json:"id,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_sku.go deleted file mode 100644 index 6a4664e6af2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/model_sku.go +++ /dev/null @@ -1,5 +0,0 @@ -package configurationstores - -type Sku struct { - Name string `json:"name"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/predicates.go deleted file mode 100644 index c9694906656..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/predicates.go +++ /dev/null @@ -1,67 +0,0 @@ -package configurationstores - -type ApiKeyPredicate struct { - ConnectionString *string - Id *string - LastModified *string - Name *string - ReadOnly *bool - Value *string -} - -func (p ApiKeyPredicate) Matches(input ApiKey) bool { - - if p.ConnectionString != nil && (input.ConnectionString == nil && *p.ConnectionString != *input.ConnectionString) { - return false - } - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.LastModified != nil && (input.LastModified == nil && *p.LastModified != *input.LastModified) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.ReadOnly != nil && (input.ReadOnly == nil && *p.ReadOnly != *input.ReadOnly) { - return false - } - - if p.Value != nil && (input.Value == nil && *p.Value != *input.Value) { - return false - } - - return true -} - -type ConfigurationStorePredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p ConfigurationStorePredicate) Matches(input ConfigurationStore) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/version.go deleted file mode 100644 index e5aea194ad3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package configurationstores - -import "fmt" - -const defaultApiVersion = "2020-06-01" - -func userAgent() string { - return fmt.Sprintf("pandora/configurationstores/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/application_insights_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/application_insights_resource.go index 9c27deaa553..4f5c8e5491a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/application_insights_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/application_insights_resource.go @@ -77,6 +77,7 @@ func resourceApplicationInsights() *pluginsdk.Resource { "workspace_id": { Type: pluginsdk.TypeString, Optional: true, + ForceNew: true, ValidateFunc: azure.ValidateResourceIDOrEmpty, }, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/application_insights_workbook_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/application_insights_workbook_resource.go new file mode 100644 index 00000000000..51fbb666fc4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/application_insights_workbook_resource.go @@ -0,0 +1,331 @@ +package applicationinsights + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + workbooks "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type ApplicationInsightsWorkbookModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Category string `tfschema:"category"` + Description string `tfschema:"description"` + DisplayName string `tfschema:"display_name"` + Location string `tfschema:"location"` + DataJson string `tfschema:"data_json"` + SourceId string `tfschema:"source_id"` + StorageContainerId string `tfschema:"storage_container_id"` + Tags map[string]string `tfschema:"tags"` +} + +type ApplicationInsightsWorkbookResource struct{} + +var _ sdk.ResourceWithUpdate = ApplicationInsightsWorkbookResource{} + +func (r ApplicationInsightsWorkbookResource) ResourceType() string { + return "azurerm_application_insights_workbook" +} + +func (r ApplicationInsightsWorkbookResource) ModelObject() interface{} { + return &ApplicationInsightsWorkbookModel{} +} + +func (r ApplicationInsightsWorkbookResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return workbooks.ValidateWorkbookID +} + +func (r ApplicationInsightsWorkbookResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.All( + validation.IsUUID, + validate.StringDoesNotContainUpperCaseLetter, + ), + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "display_name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "data_json": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsJSON, + DiffSuppressFunc: pluginsdk.SuppressJsonDiff, + }, + + "source_id": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "azure monitor", + ValidateFunc: validate.StringDoesNotContainUpperCaseLetter, + }, + + "category": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "workbook", + ValidateFunc: validation.StringIsNotEmpty, + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "identity": commonschema.SystemAssignedUserAssignedIdentityOptionalForceNew(), + + "storage_container_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + RequiredWith: []string{ + "identity", + }, + }, + + "tags": { + Type: pluginsdk.TypeMap, + Optional: true, + ValidateFunc: validate.WorkbookTags, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + } +} + +func (r ApplicationInsightsWorkbookResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r ApplicationInsightsWorkbookResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model ApplicationInsightsWorkbookModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.AppInsights.WorkbookClient + subscriptionId := metadata.Client.Account.SubscriptionId + id := workbooks.NewWorkbookID(subscriptionId, model.ResourceGroupName, model.Name) + existing, err := client.WorkbooksGet(ctx, id, workbooks.WorkbooksGetOperationOptions{CanFetchContent: utils.Bool(true)}) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + identityValue, err := identity.ExpandLegacySystemAndUserAssignedMap(metadata.ResourceData.Get("identity").([]interface{})) + if err != nil { + return fmt.Errorf("expanding `identity`: %+v", err) + } + + kindValue := workbooks.WorkbookSharedTypeKindShared + properties := &workbooks.Workbook{ + Identity: identityValue, + Kind: &kindValue, + Location: utils.String(location.Normalize(model.Location)), + Properties: &workbooks.WorkbookProperties{ + Category: model.Category, + DisplayName: model.DisplayName, + SerializedData: model.DataJson, + SourceId: &model.SourceId, + }, + + Tags: &model.Tags, + } + + if model.Description != "" { + properties.Properties.Description = &model.Description + } + + if model.StorageContainerId != "" { + properties.Properties.StorageUri = &model.StorageContainerId + } + + if _, err := client.WorkbooksCreateOrUpdate(ctx, id, *properties, workbooks.WorkbooksCreateOrUpdateOperationOptions{SourceId: &model.SourceId}); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r ApplicationInsightsWorkbookResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AppInsights.WorkbookClient + + id, err := workbooks.ParseWorkbookID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model ApplicationInsightsWorkbookModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + resp, err := client.WorkbooksGet(ctx, *id, workbooks.WorkbooksGetOperationOptions{CanFetchContent: utils.Bool(true)}) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := resp.Model + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + if metadata.ResourceData.HasChange("category") { + properties.Properties.Category = model.Category + } + + if metadata.ResourceData.HasChange("description") { + properties.Properties.Description = &model.Description + } + + if metadata.ResourceData.HasChange("display_name") { + properties.Properties.DisplayName = model.DisplayName + } + + if metadata.ResourceData.HasChange("data_json") { + properties.Properties.SerializedData = model.DataJson + } + + if metadata.ResourceData.HasChange("tags") { + properties.Tags = &model.Tags + } + + if _, err := client.WorkbooksCreateOrUpdate(ctx, *id, *properties, workbooks.WorkbooksCreateOrUpdateOperationOptions{SourceId: &model.SourceId}); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r ApplicationInsightsWorkbookResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AppInsights.WorkbookClient + + id, err := workbooks.ParseWorkbookID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.WorkbooksGet(ctx, *id, workbooks.WorkbooksGetOperationOptions{CanFetchContent: utils.Bool(true)}) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + state := ApplicationInsightsWorkbookModel{ + Name: id.ResourceName, + ResourceGroupName: id.ResourceGroupName, + Location: location.NormalizeNilable(model.Location), + } + + identityValue, err := identity.FlattenLegacySystemAndUserAssignedMap(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + + if err := metadata.ResourceData.Set("identity", identityValue); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } + + if properties := model.Properties; properties != nil { + state.Category = properties.Category + + if properties.Description != nil { + state.Description = *properties.Description + } + + state.DisplayName = properties.DisplayName + + state.DataJson = properties.SerializedData + + if properties.SourceId != nil { + state.SourceId = *properties.SourceId + } + + if properties.StorageUri != nil { + state.StorageContainerId = *properties.StorageUri + } + } + + if model.Tags != nil { + // The backend returns a tags with key `hidden-title` by default. Since it has the same value with `display_name` and will cause inconsistency with user's configuration, remove it as a workaround. + if _, ok := (*model.Tags)["hidden-title"]; ok { + delete(*model.Tags, "hidden-title") + } + + state.Tags = *model.Tags + } + + return metadata.Encode(&state) + }, + } +} + +func (r ApplicationInsightsWorkbookResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AppInsights.WorkbookClient + + id, err := workbooks.ParseWorkbookID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.WorkbooksDelete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/application_insights_workbook_template_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/application_insights_workbook_template_resource.go new file mode 100644 index 00000000000..881d0254e2c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/application_insights_workbook_template_resource.go @@ -0,0 +1,433 @@ +package applicationinsights + +import ( + "context" + "encoding/json" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + workbooktemplates "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type ApplicationInsightsWorkbookTemplateModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Author string `tfschema:"author"` + Galleries []WorkbookTemplateGalleryModel `tfschema:"galleries"` + Localized string `tfschema:"localized"` + Location string `tfschema:"location"` + Priority int64 `tfschema:"priority"` + Tags map[string]string `tfschema:"tags"` + TemplateData string `tfschema:"template_data"` +} + +type WorkbookTemplateGalleryModel struct { + Name string `tfschema:"name"` + Category string `tfschema:"category"` + Order int64 `tfschema:"order"` + ResourceType string `tfschema:"resource_type"` + Type string `tfschema:"type"` +} + +type ApplicationInsightsWorkbookTemplateResource struct{} + +var _ sdk.ResourceWithUpdate = ApplicationInsightsWorkbookTemplateResource{} + +func (r ApplicationInsightsWorkbookTemplateResource) ResourceType() string { + return "azurerm_application_insights_workbook_template" +} + +func (r ApplicationInsightsWorkbookTemplateResource) ModelObject() interface{} { + return &ApplicationInsightsWorkbookTemplateModel{} +} + +func (r ApplicationInsightsWorkbookTemplateResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return workbooktemplates.ValidateWorkbookTemplateID +} + +func (r ApplicationInsightsWorkbookTemplateResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "template_data": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsJSON, + DiffSuppressFunc: pluginsdk.SuppressJsonDiff, + }, + + "galleries": { + Type: pluginsdk.TypeList, + Required: true, + MinItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "category": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "order": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 0, + }, + + "resource_type": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + Default: "Azure Monitor", + }, + + "type": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + Default: "workbook", + }, + }, + }, + }, + + "author": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "localized": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "priority": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 0, + }, + + "tags": commonschema.Tags(), + } +} + +func (r ApplicationInsightsWorkbookTemplateResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r ApplicationInsightsWorkbookTemplateResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model ApplicationInsightsWorkbookTemplateModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.AppInsights.WorkbookTemplateClient + subscriptionId := metadata.Client.Account.SubscriptionId + id := workbooktemplates.NewWorkbookTemplateID(subscriptionId, model.ResourceGroupName, model.Name) + existing, err := client.WorkbookTemplatesGet(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + var templateDataValue interface{} + err = json.Unmarshal([]byte(model.TemplateData), &templateDataValue) + if err != nil { + return err + } + + properties := &workbooktemplates.WorkbookTemplate{ + Location: location.Normalize(model.Location), + Properties: &workbooktemplates.WorkbookTemplateProperties{ + Priority: &model.Priority, + TemplateData: templateDataValue, + }, + + Tags: &model.Tags, + } + + if model.Author != "" { + properties.Properties.Author = &model.Author + } + + if model.Localized != "" { + var localizedValue map[string][]workbooktemplates.WorkbookTemplateLocalizedGallery + if err := json.Unmarshal([]byte(model.Localized), &localizedValue); err != nil { + return err + } + + properties.Properties.Localized = &localizedValue + } + + galleriesValue, err := expandWorkbookTemplateGalleryModel(model.Galleries) + if err != nil { + return err + } + + if galleriesValue != nil { + properties.Properties.Galleries = *galleriesValue + } + + if _, err := client.WorkbookTemplatesCreateOrUpdate(ctx, id, *properties); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r ApplicationInsightsWorkbookTemplateResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AppInsights.WorkbookTemplateClient + + id, err := workbooktemplates.ParseWorkbookTemplateID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model ApplicationInsightsWorkbookTemplateModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + resp, err := client.WorkbookTemplatesGet(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := resp.Model + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + if metadata.ResourceData.HasChange("author") { + properties.Properties.Author = &model.Author + } + + if metadata.ResourceData.HasChange("galleries") { + galleriesValue, err := expandWorkbookTemplateGalleryModel(model.Galleries) + if err != nil { + return err + } + + if galleriesValue != nil { + properties.Properties.Galleries = *galleriesValue + } + } + + if metadata.ResourceData.HasChange("priority") { + properties.Properties.Priority = &model.Priority + } + + if metadata.ResourceData.HasChange("template_data") { + var templateDataValue interface{} + err := json.Unmarshal([]byte(model.TemplateData), &templateDataValue) + if err != nil { + return err + } + + properties.Properties.TemplateData = templateDataValue + } + + if metadata.ResourceData.HasChange("localized") { + var localizedValue map[string][]workbooktemplates.WorkbookTemplateLocalizedGallery + if err := json.Unmarshal([]byte(model.Localized), &localizedValue); err != nil { + return err + } + + properties.Properties.Localized = &localizedValue + } + + if metadata.ResourceData.HasChange("tags") { + properties.Tags = &model.Tags + } + + if _, err := client.WorkbookTemplatesCreateOrUpdate(ctx, *id, *properties); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r ApplicationInsightsWorkbookTemplateResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AppInsights.WorkbookTemplateClient + + id, err := workbooktemplates.ParseWorkbookTemplateID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.WorkbookTemplatesGet(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + state := ApplicationInsightsWorkbookTemplateModel{ + Name: id.ResourceName, + ResourceGroupName: id.ResourceGroupName, + Location: location.Normalize(model.Location), + } + + if properties := model.Properties; properties != nil { + if properties.Author != nil { + state.Author = *properties.Author + } + + galleriesValue, err := flattenWorkbookTemplateGalleryModel(&properties.Galleries) + if err != nil { + return err + } + + state.Galleries = galleriesValue + + if properties.Priority != nil { + state.Priority = *properties.Priority + } + + if properties.TemplateData != nil { + templateDataValue, err := json.Marshal(properties.TemplateData) + if err != nil { + return err + } + + state.TemplateData = string(templateDataValue) + } + + if properties.Localized != nil { + localizedValue, err := json.Marshal(properties.Localized) + if err != nil { + return err + } + + state.Localized = string(localizedValue) + } + } + + if model.Tags != nil { + state.Tags = *model.Tags + } + + return metadata.Encode(&state) + }, + } +} + +func (r ApplicationInsightsWorkbookTemplateResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.AppInsights.WorkbookTemplateClient + + id, err := workbooktemplates.ParseWorkbookTemplateID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.WorkbookTemplatesDelete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} + +func expandWorkbookTemplateGalleryModel(inputList []WorkbookTemplateGalleryModel) (*[]workbooktemplates.WorkbookTemplateGallery, error) { + var outputList []workbooktemplates.WorkbookTemplateGallery + for _, input := range inputList { + output := workbooktemplates.WorkbookTemplateGallery{ + Category: utils.String(input.Category), + Name: utils.String(input.Name), + Order: utils.Int64(input.Order), + ResourceType: utils.String(input.ResourceType), + Type: utils.String(input.Type), + } + + outputList = append(outputList, output) + } + + return &outputList, nil +} + +func flattenWorkbookTemplateGalleryModel(inputList *[]workbooktemplates.WorkbookTemplateGallery) ([]WorkbookTemplateGalleryModel, error) { + var outputList []WorkbookTemplateGalleryModel + if inputList == nil { + return outputList, nil + } + + for _, input := range *inputList { + output := WorkbookTemplateGalleryModel{} + + if input.Category != nil { + output.Category = *input.Category + } + + if input.Name != nil { + output.Name = *input.Name + } + + if input.Order != nil { + output.Order = *input.Order + } + + if input.ResourceType != nil { + output.ResourceType = *input.ResourceType + } + + if input.Type != nil { + output.Type = *input.Type + } + + outputList = append(outputList, output) + } + + return outputList, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/client/client.go index 4907c213e53..0746f0d7e62 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/client/client.go @@ -2,6 +2,8 @@ package client import ( "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights" + workbooktemplates "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis" + workbooks "github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis" "github.com/hashicorp/terraform-provider-azurerm/internal/common" "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/azuresdkhacks" ) @@ -13,6 +15,8 @@ type Client struct { WebTestsClient *azuresdkhacks.WebTestsClient BillingClient *insights.ComponentCurrentBillingFeaturesClient SmartDetectionRuleClient *insights.ProactiveDetectionConfigurationsClient + WorkbookClient *workbooks.WorkbooksAPIsClient + WorkbookTemplateClient *workbooktemplates.WorkbookTemplatesAPIsClient } func NewClient(o *common.ClientOptions) *Client { @@ -35,6 +39,12 @@ func NewClient(o *common.ClientOptions) *Client { smartDetectionRuleClient := insights.NewProactiveDetectionConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&smartDetectionRuleClient.Client, o.ResourceManagerAuthorizer) + workbookClient := workbooks.NewWorkbooksAPIsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&workbookClient.Client, o.ResourceManagerAuthorizer) + + workbookTemplateClient := workbooktemplates.NewWorkbookTemplatesAPIsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&workbookTemplateClient.Client, o.ResourceManagerAuthorizer) + return &Client{ AnalyticsItemsClient: &analyticsItemsClient, APIKeysClient: &apiKeysClient, @@ -42,5 +52,7 @@ func NewClient(o *common.ClientOptions) *Client { WebTestsClient: &webTestsWorkaroundClient, BillingClient: &billingClient, SmartDetectionRuleClient: &smartDetectionRuleClient, + WorkbookClient: &workbookClient, + WorkbookTemplateClient: &workbookTemplateClient, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/registration.go index 061f12d459d..ff545e173a3 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/registration.go @@ -7,7 +7,10 @@ import ( type Registration struct{} -var _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +var ( + _ sdk.TypedServiceRegistrationWithAGitHubLabel = Registration{} + _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +) func (r Registration) AssociatedGitHubLabel() string { return "service/application-insights" @@ -42,3 +45,16 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { "azurerm_application_insights_web_test": resourceApplicationInsightsWebTests(), } } + +// DataSources returns a list of Data Sources supported by this Service +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{} +} + +// Resources returns a list of Resources supported by this Service +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + ApplicationInsightsWorkbookResource{}, + ApplicationInsightsWorkbookTemplateResource{}, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate/workbook_name.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate/workbook_name.go new file mode 100644 index 00000000000..68f1d61b4ff --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate/workbook_name.go @@ -0,0 +1,21 @@ +package validate + +import ( + "fmt" + "strings" +) + +func StringDoesNotContainUpperCaseLetter(input interface{}, k string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %q to be string", k)) + return + } + + if strings.ToLower(v) != v { + errors = append(errors, fmt.Errorf("expected value of %s to not contain any uppercase letter", k)) + return + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate/workbook_tags.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate/workbook_tags.go new file mode 100644 index 00000000000..3eccb45d3bc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate/workbook_tags.go @@ -0,0 +1,21 @@ +package validate + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/tags" +) + +func WorkbookTags(i interface{}, k string) (warnings []string, errors []error) { + warnings, errors = tags.Validate(i, k) + if len(errors) > 0 { + return + } + + tagsMap := i.(map[string]interface{}) + if _, ok := tagsMap["hidden-title"]; ok { + errors = append(errors, fmt.Errorf("a tag with the key `hidden-title` should not be used to set the display name. Please Use `display_name` instead")) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/function_app_hybrid_connection_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/function_app_hybrid_connection_resource.go index 87b9c2b9879..356456b9fd7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/function_app_hybrid_connection_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/function_app_hybrid_connection_resource.go @@ -7,15 +7,14 @@ import ( "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections" + "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate" - relayParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -221,7 +220,7 @@ func (r FunctionAppHybridConnectionResource) Read() sdk.ResourceFunc { if appHybridConn.ServiceBusNamespace != "" && appHybridConn.SendKeyName != "" { relayNamespaceClient := metadata.Client.Relay.NamespacesClient - relayId, err := relayParse.HybridConnectionID(appHybridConn.RelayId) + relayId, err := hybridconnections.ParseHybridConnectionID(appHybridConn.RelayId) if err != nil { return err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/function_app_schema.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/function_app_schema.go index 2fbe57223e0..8844f5a64df 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/function_app_schema.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/function_app_schema.go @@ -1551,7 +1551,7 @@ func ExpandSiteConfigLinuxFunctionApp(siteConfig []SiteConfigLinuxFunctionApp, e if linuxAppStack.NodeVersion != "" { appSettings = updateOrAppendAppSettings(appSettings, "FUNCTIONS_WORKER_RUNTIME", "node", false) appSettings = updateOrAppendAppSettings(appSettings, "WEBSITE_NODE_DEFAULT_VERSION", linuxAppStack.NodeVersion, false) - expanded.LinuxFxVersion = utils.String(fmt.Sprintf("Node|%s", linuxAppStack.NodeVersion)) + expanded.LinuxFxVersion = utils.String(fmt.Sprintf("NODE|%s", linuxAppStack.NodeVersion)) } if linuxAppStack.PythonVersion != "" { @@ -1683,6 +1683,10 @@ func ExpandSiteConfigLinuxFunctionApp(siteConfig []SiteConfigLinuxFunctionApp, e expanded.VnetRouteAllEnabled = utils.Bool(linuxSiteConfig.VnetRouteAllEnabled) } + if metadata.ResourceData.HasChange("site_config.0.elastic_instance_minimum") { + expanded.MinimumElasticInstanceCount = utils.Int32(int32(linuxSiteConfig.ElasticInstanceMinimum)) + } + expanded.AppSettings = &appSettings return expanded, nil @@ -1794,36 +1798,36 @@ func ExpandSiteConfigWindowsFunctionApp(siteConfig []SiteConfigWindowsFunctionAp if windowsAppStack.DotNetVersion != "" { if windowsAppStack.DotNetIsolated { appSettings = updateOrAppendAppSettings(appSettings, "FUNCTIONS_WORKER_RUNTIME", "dotnet-isolated", false) - windowsSiteConfig.WindowsFxVersion = fmt.Sprintf("DOTNET-ISOLATED|%s", windowsAppStack.DotNetVersion) + expanded.WindowsFxVersion = utils.String(fmt.Sprintf("DOTNET-ISOLATED|%s", windowsAppStack.DotNetVersion)) } else { appSettings = updateOrAppendAppSettings(appSettings, "FUNCTIONS_WORKER_RUNTIME", "dotnet", false) - windowsSiteConfig.WindowsFxVersion = fmt.Sprintf("DOTNET|%s", windowsAppStack.DotNetVersion) + expanded.WindowsFxVersion = utils.String(fmt.Sprintf("DOTNET|%s", windowsAppStack.DotNetVersion)) } } if windowsAppStack.NodeVersion != "" { appSettings = updateOrAppendAppSettings(appSettings, "FUNCTIONS_WORKER_RUNTIME", "node", false) appSettings = updateOrAppendAppSettings(appSettings, "WEBSITE_NODE_DEFAULT_VERSION", windowsAppStack.NodeVersion, false) - windowsSiteConfig.WindowsFxVersion = fmt.Sprintf("Node|%s", windowsAppStack.NodeVersion) + expanded.WindowsFxVersion = utils.String(fmt.Sprintf("Node|%s", windowsAppStack.NodeVersion)) } if windowsAppStack.JavaVersion != "" { appSettings = updateOrAppendAppSettings(appSettings, "FUNCTIONS_WORKER_RUNTIME", "java", false) - windowsSiteConfig.WindowsFxVersion = fmt.Sprintf("Java|%s", windowsAppStack.JavaVersion) + expanded.WindowsFxVersion = utils.String(fmt.Sprintf("Java|%s", windowsAppStack.JavaVersion)) } if windowsAppStack.PowerShellCoreVersion != "" { appSettings = updateOrAppendAppSettings(appSettings, "FUNCTIONS_WORKER_RUNTIME", "powershell", false) - windowsSiteConfig.WindowsFxVersion = fmt.Sprintf("PowerShell|%s", windowsAppStack.PowerShellCoreVersion) + expanded.WindowsFxVersion = utils.String(fmt.Sprintf("PowerShell|%s", windowsAppStack.PowerShellCoreVersion)) } if windowsAppStack.CustomHandler { appSettings = updateOrAppendAppSettings(appSettings, "FUNCTIONS_WORKER_RUNTIME", "custom", false) - windowsSiteConfig.WindowsFxVersion = "" // Custom needs an explicit empty string here + expanded.WindowsFxVersion = utils.String("") // Custom needs an explicit empty string here } } else { appSettings = updateOrAppendAppSettings(appSettings, "FUNCTIONS_WORKER_RUNTIME", "", true) - windowsSiteConfig.WindowsFxVersion = "" + expanded.WindowsFxVersion = utils.String("") } if metadata.ResourceData.HasChange("site_config.0.vnet_route_all_enabled") { @@ -1915,6 +1919,10 @@ func ExpandSiteConfigWindowsFunctionApp(siteConfig []SiteConfigWindowsFunctionAp expanded.VnetRouteAllEnabled = utils.Bool(windowsSiteConfig.VnetRouteAllEnabled) } + if metadata.ResourceData.HasChange("site_config.0.elastic_instance_minimum") { + expanded.MinimumElasticInstanceCount = utils.Int32(int32(windowsSiteConfig.ElasticInstanceMinimum)) + } + expanded.AppSettings = &appSettings return expanded, nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/function_app_slot_schema.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/function_app_slot_schema.go index dd213469737..7c714e60ddd 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/function_app_slot_schema.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/function_app_slot_schema.go @@ -734,14 +734,14 @@ func ExpandSiteConfigWindowsFunctionAppSlot(siteConfig []SiteConfigWindowsFuncti Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), Value: utils.String("dotnet-isolated"), }) - windowsSlotSiteConfig.WindowsFxVersion = fmt.Sprintf("DOTNET-ISOLATED|%s", windowsAppStack.DotNetVersion) + expanded.WindowsFxVersion = utils.String(fmt.Sprintf("DOTNET-ISOLATED|%s", windowsAppStack.DotNetVersion)) } else { appSettings = append(appSettings, web.NameValuePair{ Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), Value: utils.String("dotnet"), }) - windowsSlotSiteConfig.WindowsFxVersion = fmt.Sprintf("DOTNET|%s", windowsAppStack.DotNetVersion) + expanded.WindowsFxVersion = utils.String(fmt.Sprintf("DOTNET|%s", windowsAppStack.DotNetVersion)) } } @@ -754,7 +754,7 @@ func ExpandSiteConfigWindowsFunctionAppSlot(siteConfig []SiteConfigWindowsFuncti Name: utils.String("WEBSITE_NODE_DEFAULT_VERSION"), Value: utils.String(windowsAppStack.NodeVersion), }) - windowsSlotSiteConfig.WindowsFxVersion = fmt.Sprintf("Node|%s", windowsAppStack.NodeVersion) + expanded.WindowsFxVersion = utils.String(fmt.Sprintf("Node|%s", windowsAppStack.NodeVersion)) } if windowsAppStack.JavaVersion != "" { @@ -762,7 +762,7 @@ func ExpandSiteConfigWindowsFunctionAppSlot(siteConfig []SiteConfigWindowsFuncti Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), Value: utils.String("java"), }) - windowsSlotSiteConfig.WindowsFxVersion = fmt.Sprintf("Java|%s", windowsAppStack.JavaVersion) + expanded.WindowsFxVersion = utils.String(fmt.Sprintf("Java|%s", windowsAppStack.JavaVersion)) } if windowsAppStack.PowerShellCoreVersion != "" { @@ -770,7 +770,7 @@ func ExpandSiteConfigWindowsFunctionAppSlot(siteConfig []SiteConfigWindowsFuncti Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), Value: utils.String("powershell"), }) - windowsSlotSiteConfig.WindowsFxVersion = fmt.Sprintf("PowerShell|%s", windowsAppStack.PowerShellCoreVersion) + expanded.WindowsFxVersion = utils.String(fmt.Sprintf("PowerShell|%s", windowsAppStack.PowerShellCoreVersion)) } if windowsAppStack.CustomHandler { @@ -778,14 +778,14 @@ func ExpandSiteConfigWindowsFunctionAppSlot(siteConfig []SiteConfigWindowsFuncti Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), Value: utils.String("custom"), }) - windowsSlotSiteConfig.WindowsFxVersion = "" // Custom needs an explicit empty string here + expanded.WindowsFxVersion = utils.String("") // Custom needs an explicit empty string here } } else { appSettings = append(appSettings, web.NameValuePair{ Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), Value: utils.String(""), }) - windowsSlotSiteConfig.WindowsFxVersion = "" + expanded.WindowsFxVersion = utils.String("") } } @@ -951,6 +951,7 @@ func ExpandSiteConfigLinuxFunctionAppSlot(siteConfig []SiteConfigLinuxFunctionAp if len(siteConfig) == 0 { return nil, nil } + expanded := &web.SiteConfig{} if existing != nil { expanded = existing @@ -1029,92 +1030,91 @@ func ExpandSiteConfigLinuxFunctionAppSlot(siteConfig []SiteConfigLinuxFunctionAp expanded.AppCommandLine = utils.String(linuxSlotSiteConfig.AppCommandLine) } - if metadata.ResourceData.HasChange("site_config.0.application_stack") && len(linuxSlotSiteConfig.ApplicationStack) > 0 { - if len(linuxSlotSiteConfig.ApplicationStack) > 0 { - linuxAppStack := linuxSlotSiteConfig.ApplicationStack[0] - if linuxAppStack.DotNetVersion != "" { - if linuxAppStack.DotNetIsolated { - appSettings = append(appSettings, web.NameValuePair{ - Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), - Value: utils.String("dotnet-isolated"), - }) - linuxSlotSiteConfig.LinuxFxVersion = fmt.Sprintf("DOTNET-ISOLATED|%s", linuxAppStack.DotNetVersion) - } else { - appSettings = append(appSettings, web.NameValuePair{ - Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), - Value: utils.String("dotnet"), - }) - linuxSlotSiteConfig.LinuxFxVersion = fmt.Sprintf("DOTNET|%s", linuxAppStack.DotNetVersion) - } - } - - if linuxAppStack.NodeVersion != "" { + if len(linuxSlotSiteConfig.ApplicationStack) > 0 { + linuxAppStack := linuxSlotSiteConfig.ApplicationStack[0] + if linuxAppStack.DotNetVersion != "" { + if linuxAppStack.DotNetIsolated { appSettings = append(appSettings, web.NameValuePair{ Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), - Value: utils.String("node"), + Value: utils.String("dotnet-isolated"), }) - appSettings = append(appSettings, web.NameValuePair{ - Name: utils.String("WEBSITE_NODE_DEFAULT_VERSION"), - Value: utils.String(linuxAppStack.NodeVersion), - }) - linuxSlotSiteConfig.LinuxFxVersion = fmt.Sprintf("Node|%s", linuxAppStack.NodeVersion) - } - - if linuxAppStack.PythonVersion != "" { + expanded.LinuxFxVersion = utils.String(fmt.Sprintf("DOTNET-ISOLATED|%s", linuxAppStack.DotNetVersion)) + } else { appSettings = append(appSettings, web.NameValuePair{ Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), - Value: utils.String("python"), + Value: utils.String("dotnet"), }) - linuxSlotSiteConfig.LinuxFxVersion = fmt.Sprintf("Python|%s", linuxAppStack.PythonVersion) + expanded.LinuxFxVersion = utils.String(fmt.Sprintf("DOTNET|%s", linuxAppStack.DotNetVersion)) } + } - if linuxAppStack.JavaVersion != "" { - appSettings = append(appSettings, web.NameValuePair{ - Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), - Value: utils.String("java"), - }) - linuxSlotSiteConfig.LinuxFxVersion = fmt.Sprintf("Java|%s", linuxAppStack.JavaVersion) - } + if linuxAppStack.NodeVersion != "" { + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), + Value: utils.String("node"), + }) + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("WEBSITE_NODE_DEFAULT_VERSION"), + Value: utils.String(linuxAppStack.NodeVersion), + }) + expanded.LinuxFxVersion = utils.String(fmt.Sprintf("NODE|%s", linuxAppStack.NodeVersion)) + } - if linuxAppStack.PowerShellCoreVersion != "" { - appSettings = append(appSettings, web.NameValuePair{ - Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), - Value: utils.String("powershell"), - }) - linuxSlotSiteConfig.LinuxFxVersion = fmt.Sprintf("PowerShell|%s", linuxAppStack.PowerShellCoreVersion) - } + if linuxAppStack.PythonVersion != "" { + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), + Value: utils.String("python"), + }) + expanded.LinuxFxVersion = utils.String(fmt.Sprintf("Python|%s", linuxAppStack.PythonVersion)) + } - if linuxAppStack.CustomHandler { - appSettings = append(appSettings, web.NameValuePair{ - Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), - Value: utils.String("custom"), - }) - linuxSlotSiteConfig.LinuxFxVersion = "" // Custom needs an explicit empty string here - } + if linuxAppStack.JavaVersion != "" { + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), + Value: utils.String("java"), + }) + expanded.LinuxFxVersion = utils.String(fmt.Sprintf("Java|%s", linuxAppStack.JavaVersion)) + } - if linuxAppStack.Docker != nil && len(linuxAppStack.Docker) == 1 { - dockerConfig := linuxAppStack.Docker[0] - appSettings = append(appSettings, web.NameValuePair{ - Name: utils.String("DOCKER_REGISTRY_SERVER_URL"), - Value: utils.String(dockerConfig.RegistryURL), - }) - appSettings = append(appSettings, web.NameValuePair{ - Name: utils.String("DOCKER_REGISTRY_SERVER_USERNAME"), - Value: utils.String(dockerConfig.RegistryUsername), - }) - appSettings = append(appSettings, web.NameValuePair{ - Name: utils.String("DOCKER_REGISTRY_SERVER_PASSWORD"), - Value: utils.String(dockerConfig.RegistryPassword), - }) - linuxSlotSiteConfig.LinuxFxVersion = fmt.Sprintf("DOCKER|%s/%s:%s", dockerConfig.RegistryURL, dockerConfig.ImageName, dockerConfig.ImageTag) - } - } else { + if linuxAppStack.PowerShellCoreVersion != "" { appSettings = append(appSettings, web.NameValuePair{ Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), - Value: utils.String(""), + Value: utils.String("powershell"), + }) + expanded.LinuxFxVersion = utils.String(fmt.Sprintf("PowerShell|%s", linuxAppStack.PowerShellCoreVersion)) + } + + if linuxAppStack.CustomHandler { + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), + Value: utils.String("custom"), }) - linuxSlotSiteConfig.LinuxFxVersion = "" + expanded.LinuxFxVersion = utils.String("") // Custom needs an explicit empty string here } + + if linuxAppStack.Docker != nil && len(linuxAppStack.Docker) == 1 { + dockerConfig := linuxAppStack.Docker[0] + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("DOCKER_REGISTRY_SERVER_URL"), + Value: utils.String(dockerConfig.RegistryURL), + }) + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("DOCKER_REGISTRY_SERVER_USERNAME"), + Value: utils.String(dockerConfig.RegistryUsername), + }) + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("DOCKER_REGISTRY_SERVER_PASSWORD"), + Value: utils.String(dockerConfig.RegistryPassword), + }) + expanded.LinuxFxVersion = utils.String(fmt.Sprintf("DOCKER|%s/%s:%s", dockerConfig.RegistryURL, dockerConfig.ImageName, dockerConfig.ImageTag)) + } + + } else { + appSettings = append(appSettings, web.NameValuePair{ + Name: utils.String("FUNCTIONS_WORKER_RUNTIME"), + Value: utils.String(""), + }) + expanded.LinuxFxVersion = utils.String("") } expanded.AcrUseManagedIdentityCreds = utils.Bool(linuxSlotSiteConfig.UseManagedIdentityACR) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/fx_strings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/fx_strings.go index 58e9868d0e9..eae7b2db00e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/fx_strings.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/fx_strings.go @@ -53,7 +53,7 @@ func decodeApplicationStackLinux(fxString string) ApplicationStackLinux { } func EncodeFunctionAppLinuxFxVersion(input []ApplicationStackLinuxFunctionApp) *string { - if len(input) == 0 { + if len(input) == 0 || input[0].CustomHandler { return utils.String("") } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/hybrid_connection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/hybrid_connection.go index 19e7f8a3acd..ae5cc9d0d42 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/hybrid_connection.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/hybrid_connection.go @@ -4,9 +4,9 @@ import ( "context" "fmt" + "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces" ) func GetSendKeyValue(ctx context.Context, metadata sdk.ResourceMetaData, id parse.AppHybridConnectionId, sendKeyName string) (*string, error) { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/publish_app.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/publish_app.go index e86cdef298f..6c8777b5831 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/publish_app.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/publish_app.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "os" "time" @@ -182,7 +182,7 @@ func checkZipDeploymentStatusRefresh(r *http.Request) pluginsdk.StateRefreshFunc if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusAccepted { return nil, "", fmt.Errorf("failed to read Zip Deployment status: %s", resp.Status) } - respBody, err := ioutil.ReadAll(resp.Body) + respBody, err := io.ReadAll(resp.Body) if err != nil { return nil, "", fmt.Errorf("reading status response body for Zip Deploy") } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/service_plan.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/service_plan.go index 1a8efd3ab99..2477ec4c4aa 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/service_plan.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/service_plan.go @@ -26,7 +26,6 @@ var appServicePlanSkus = []string{ var freeSkus = []string{ "F1", - "FREE", } var sharedSkus = []string{ diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/shared_schema.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/shared_schema.go index cf752a860da..f7be2aa54c3 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/shared_schema.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/shared_schema.go @@ -5,7 +5,6 @@ import ( "strings" "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" - appserviceValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -1554,7 +1553,7 @@ func StickySettingsSchema() *pluginsdk.Schema { Optional: true, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, - ValidateFunc: appserviceValidate.AppSettingName, + ValidateFunc: validation.StringIsNotEmpty, }, AtLeastOneOf: []string{ "sticky_settings.0.app_setting_names", @@ -1568,7 +1567,7 @@ func StickySettingsSchema() *pluginsdk.Schema { Optional: true, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, - ValidateFunc: appserviceValidate.AppSettingName, + ValidateFunc: validation.StringIsNotEmpty, }, AtLeastOneOf: []string{ "sticky_settings.0.app_setting_names", diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/web_app_schema.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/web_app_schema.go index 27a72fae605..a4e51d19dc8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/web_app_schema.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers/web_app_schema.go @@ -8,6 +8,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" apimValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -867,6 +868,7 @@ type ApplicationStackWindows struct { } // Version information for the below validations was taken in part from - https://github.com/Azure/app-service-linux-docs/tree/master/Runtime_Support +// There is no 3.0 version of .netFramework, setting the property to this value causing app to be broke. func windowsApplicationStackSchema() *pluginsdk.Schema { return &pluginsdk.Schema{ Type: pluginsdk.TypeList, @@ -878,12 +880,24 @@ func windowsApplicationStackSchema() *pluginsdk.Schema { "dotnet_version": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - "v3.0", - "v4.0", - "v5.0", - "v6.0", - }, false), + ValidateFunc: func() pluginsdk.SchemaValidateFunc { + if !features.FourPointOh() { + return validation.StringInSlice([]string{ + "v2.0", + "v3.0", + "core3.1", + "v4.0", + "v5.0", + "v6.0"}, false) + } + return validation.StringInSlice([]string{ + "v2.0", + "core3.1", + "v4.0", + "v5.0", + "v6.0", + }, false) + }(), AtLeastOneOf: []string{ "site_config.0.application_stack.0.docker_container_name", "site_config.0.application_stack.0.dotnet_version", @@ -1717,6 +1731,7 @@ func autoHealTriggerSchemaWindows() *pluginsdk.Schema { "slow_request": { Type: pluginsdk.TypeList, Optional: true, + MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "time_taken": { @@ -1925,6 +1940,7 @@ func autoHealTriggerSchemaLinux() *pluginsdk.Schema { "slow_request": { Type: pluginsdk.TypeList, Optional: true, + MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "time_taken": { @@ -2854,7 +2870,7 @@ func httpLogBlobStorageSchemaComputed() *pluginsdk.Schema { } } -func ExpandSiteConfigWindows(siteConfig []SiteConfigWindows, existing *web.SiteConfig, metadata sdk.ResourceMetaData) (*web.SiteConfig, *string, error) { +func ExpandSiteConfigWindows(siteConfig []SiteConfigWindows, existing *web.SiteConfig, metadata sdk.ResourceMetaData, servicePlan web.AppServicePlan) (*web.SiteConfig, *string, error) { if len(siteConfig) == 0 { return nil, nil, nil } @@ -2868,6 +2884,16 @@ func ExpandSiteConfigWindows(siteConfig []SiteConfigWindows, existing *web.SiteC winSiteConfig := siteConfig[0] + if servicePlan.Sku != nil && servicePlan.Sku.Name != nil { + if isFreeOrSharedServicePlan(*servicePlan.Sku.Name) { + if winSiteConfig.AlwaysOn == true { + return nil, nil, fmt.Errorf("always_on cannot be set to true when using Free, F1, D1 Sku") + } + if expanded.AlwaysOn != nil && *expanded.AlwaysOn == true { + return nil, nil, fmt.Errorf("always_on feature has to be turned off before switching to a free/shared Sku") + } + } + } expanded.AlwaysOn = utils.Bool(winSiteConfig.AlwaysOn) if metadata.ResourceData.HasChange("site_config.0.api_management_api_id") { @@ -2890,6 +2916,9 @@ func ExpandSiteConfigWindows(siteConfig []SiteConfigWindows, existing *web.SiteC if len(winSiteConfig.ApplicationStack) == 1 { winAppStack := winSiteConfig.ApplicationStack[0] expanded.NetFrameworkVersion = utils.String(winAppStack.NetFrameworkVersion) + if winAppStack.CurrentStack == "dotnetcore" { + expanded.NetFrameworkVersion = nil + } expanded.PhpVersion = utils.String(winAppStack.PhpVersion) expanded.NodeVersion = utils.String(winAppStack.NodeVersion) expanded.PythonVersion = utils.String(winAppStack.PythonVersion) @@ -3010,7 +3039,7 @@ func ExpandSiteConfigWindows(siteConfig []SiteConfigWindows, existing *web.SiteC return expanded, ¤tStack, nil } -func ExpandSiteConfigLinux(siteConfig []SiteConfigLinux, existing *web.SiteConfig, metadata sdk.ResourceMetaData) (*web.SiteConfig, error) { +func ExpandSiteConfigLinux(siteConfig []SiteConfigLinux, existing *web.SiteConfig, metadata sdk.ResourceMetaData, servicePlan web.AppServicePlan) (*web.SiteConfig, error) { if len(siteConfig) == 0 { return nil, nil } @@ -3021,6 +3050,16 @@ func ExpandSiteConfigLinux(siteConfig []SiteConfigLinux, existing *web.SiteConfi linuxSiteConfig := siteConfig[0] + if servicePlan.Sku != nil && servicePlan.Sku.Name != nil { + if isFreeOrSharedServicePlan(*servicePlan.Sku.Name) { + if linuxSiteConfig.AlwaysOn == true { + return nil, fmt.Errorf("always_on cannot be set to true when using Free, F1, D1 Sku") + } + if expanded.AlwaysOn != nil && *expanded.AlwaysOn == true { + return nil, fmt.Errorf("always_on feature has to be turned off before switching to a free/shared Sku") + } + } + } expanded.AlwaysOn = utils.Bool(linuxSiteConfig.AlwaysOn) if metadata.ResourceData.HasChange("site_config.0.api_management_api_id") { @@ -3854,6 +3893,17 @@ func expandAutoHealSettingsWindows(autoHealSettings []AutoHealSettingWindows) *w } } + if len(triggers.SlowRequests) == 1 { + result.Triggers.SlowRequests = &web.SlowRequestsBasedTrigger{ + TimeTaken: utils.String(triggers.SlowRequests[0].TimeTaken), + TimeInterval: utils.String(triggers.SlowRequests[0].Interval), + Count: utils.Int32(int32(triggers.SlowRequests[0].Count)), + } + if triggers.SlowRequests[0].Path != "" { + result.Triggers.SlowRequests.Path = utils.String(triggers.SlowRequests[0].Path) + } + } + if triggers.PrivateMemoryKB != 0 { result.Triggers.PrivateBytesInKB = utils.Int32(int32(triggers.PrivateMemoryKB)) } @@ -4028,6 +4078,17 @@ func expandAutoHealSettingsLinux(autoHealSettings []AutoHealSettingLinux) *web.A } } + if len(triggers.SlowRequests) == 1 { + result.Triggers.SlowRequests = &web.SlowRequestsBasedTrigger{ + TimeTaken: utils.String(triggers.SlowRequests[0].TimeTaken), + TimeInterval: utils.String(triggers.SlowRequests[0].Interval), + Count: utils.Int32(int32(triggers.SlowRequests[0].Count)), + } + if triggers.SlowRequests[0].Path != "" { + result.Triggers.SlowRequests.Path = utils.String(triggers.SlowRequests[0].Path) + } + } + if len(triggers.StatusCodes) > 0 { statusCodeTriggers := make([]web.StatusCodesBasedTrigger, 0) statusCodeRangeTriggers := make([]web.StatusCodesRangeBasedTrigger, 0) @@ -4187,3 +4248,18 @@ func DisabledLogsConfig() *web.SiteLogsConfig { }, } } + +func isFreeOrSharedServicePlan(inputSKU string) bool { + result := false + for _, sku := range freeSkus { + if inputSKU == sku { + result = true + } + } + for _, sku := range sharedSkus { + if inputSKU == sku { + result = true + } + } + return result +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_function_app_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_function_app_data_source.go index e52185a7795..5bc87d01745 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_function_app_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_function_app_data_source.go @@ -47,6 +47,7 @@ type LinuxFunctionAppDataSourceModel struct { SiteConfig []helpers.SiteConfigLinuxFunctionApp `tfschema:"site_config"` StickySettings []helpers.StickySettings `tfschema:"sticky_settings"` Tags map[string]string `tfschema:"tags"` + VirtualNetworkSubnetID string `tfschema:"virtual_network_subnet_id"` CustomDomainVerificationId string `tfschema:"custom_domain_verification_id"` DefaultHostname string `tfschema:"default_hostname"` @@ -219,6 +220,11 @@ func (d LinuxFunctionAppDataSource) Attributes() map[string]*pluginsdk.Schema { "site_credential": helpers.SiteCredentialSchema(), "sticky_settings": helpers.StickySettingsComputedSchema(), + + "virtual_network_subnet_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, } } @@ -295,16 +301,28 @@ func (d LinuxFunctionAppDataSource) Read() sdk.ResourceFunc { } state := LinuxFunctionAppDataSourceModel{ - Name: id.SiteName, - ResourceGroup: id.ResourceGroup, - ServicePlanId: utils.NormalizeNilableString(props.ServerFarmID), - Location: location.NormalizeNilable(functionApp.Location), - Enabled: utils.NormaliseNilableBool(functionApp.Enabled), - ClientCertMode: string(functionApp.ClientCertMode), - DailyMemoryTimeQuota: int(utils.NormaliseNilableInt32(props.DailyMemoryTimeQuota)), - StickySettings: helpers.FlattenStickySettings(stickySettings.SlotConfigNames), - Tags: tags.ToTypedObject(functionApp.Tags), - Kind: utils.NormalizeNilableString(functionApp.Kind), + Name: id.SiteName, + ResourceGroup: id.ResourceGroup, + ServicePlanId: utils.NormalizeNilableString(props.ServerFarmID), + Location: location.NormalizeNilable(functionApp.Location), + Enabled: utils.NormaliseNilableBool(functionApp.Enabled), + ClientCertMode: string(functionApp.ClientCertMode), + DailyMemoryTimeQuota: int(utils.NormaliseNilableInt32(props.DailyMemoryTimeQuota)), + StickySettings: helpers.FlattenStickySettings(stickySettings.SlotConfigNames), + Tags: tags.ToTypedObject(functionApp.Tags), + Kind: utils.NormalizeNilableString(functionApp.Kind), + CustomDomainVerificationId: utils.NormalizeNilableString(props.CustomDomainVerificationID), + DefaultHostname: utils.NormalizeNilableString(functionApp.DefaultHostName), + } + + if v := props.OutboundIPAddresses; v != nil { + state.OutboundIPAddresses = *v + state.OutboundIPAddressList = strings.Split(*v, ",") + } + + if v := props.PossibleOutboundIPAddresses; v != nil { + state.PossibleOutboundIPAddresses = *v + state.PossibleOutboundIPAddressList = strings.Split(*v, ",") } configResp, err := client.GetConfiguration(ctx, id.ResourceGroup, id.SiteName) @@ -332,6 +350,7 @@ func (d LinuxFunctionAppDataSource) Read() sdk.ResourceFunc { state.HttpsOnly = utils.NormaliseNilableBool(functionApp.HTTPSOnly) state.ClientCertEnabled = utils.NormaliseNilableBool(functionApp.ClientCertEnabled) + state.VirtualNetworkSubnetID = utils.NormalizeNilableString(functionApp.VirtualNetworkSubnetID) metadata.SetID(id) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_function_app_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_function_app_resource.go index 7c2afbcd617..3ea480a09c6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_function_app_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_function_app_resource.go @@ -9,6 +9,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" "github.com/google/uuid" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" @@ -17,7 +18,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate" kvValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" + networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -54,6 +55,7 @@ type LinuxFunctionAppModel struct { KeyVaultReferenceIdentityID string `tfschema:"key_vault_reference_identity_id"` SiteConfig []helpers.SiteConfigLinuxFunctionApp `tfschema:"site_config"` Tags map[string]string `tfschema:"tags"` + VirtualNetworkSubnetID string `tfschema:"virtual_network_subnet_id"` // Computed CustomDomainVerificationId string `tfschema:"custom_domain_verification_id"` @@ -234,7 +236,7 @@ func (r LinuxFunctionAppResource) Arguments() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, Description: "The User Assigned Identity to use for Key Vault access.", }, @@ -243,6 +245,12 @@ func (r LinuxFunctionAppResource) Arguments() map[string]*pluginsdk.Schema { "sticky_settings": helpers.StickySettingsSchema(), "tags": tags.Schema(), + + "virtual_network_subnet_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: networkValidate.SubnetID, + }, } } @@ -321,22 +329,12 @@ func (r LinuxFunctionAppResource) Create() sdk.ResourceFunc { return fmt.Errorf("reading %s: %+v", servicePlanId, err) } - sendContentSettings := !functionApp.ForceDisableContentShare - if planSku := servicePlan.Sku; planSku != nil && planSku.Tier != nil { - switch tier := *planSku.Tier; strings.ToLower(tier) { - case "dynamic": // Consumption Plan modifications to request - sendContentSettings = false - case "elastic": // ElasticPremium Plan modifications to request? - case "basic": // App Service Plan modifications to request? - sendContentSettings = false - case "standard": - sendContentSettings = false - case "premiumv2", "premiumv3": - sendContentSettings = false - } - } else { - return fmt.Errorf("determining plan type for Linux %s: %v", id, err) + var planSKU *string + if sku := servicePlan.Sku; sku != nil && sku.Name != nil { + planSKU = sku.Name } + // Only send for ElasticPremium + sendContentSettings := helpers.PlanIsElastic(planSKU) && !functionApp.ForceDisableContentShare existing, err := client.Get(ctx, id.ResourceGroup, id.SiteName) if err != nil && !utils.ResponseWasNotFound(existing.Response) { @@ -413,12 +411,18 @@ func (r LinuxFunctionAppResource) Create() sdk.ResourceFunc { if functionApp.AppSettings == nil { functionApp.AppSettings = make(map[string]string) } - suffix := uuid.New().String()[0:4] - if _, present := functionApp.AppSettings["WEBSITE_CONTENTSHARE"]; !present { - functionApp.AppSettings["WEBSITE_CONTENTSHARE"] = fmt.Sprintf("%s-%s", strings.ToLower(functionApp.Name), suffix) - } - if _, present := functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"]; !present { - functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"] = storageString + if !functionApp.StorageUsesMSI { + suffix := uuid.New().String()[0:4] + if _, present := functionApp.AppSettings["WEBSITE_CONTENTSHARE"]; !present { + functionApp.AppSettings["WEBSITE_CONTENTSHARE"] = fmt.Sprintf("%s-%s", strings.ToLower(functionApp.Name), suffix) + } + if _, present := functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"]; !present { + functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"] = storageString + } + } else { + if _, present := functionApp.AppSettings["AzureWebJobsStorage__accountName"]; !present { + functionApp.AppSettings["AzureWebJobsStorage__accountName"] = storageString + } } } @@ -450,6 +454,10 @@ func (r LinuxFunctionAppResource) Create() sdk.ResourceFunc { siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = utils.String(functionApp.KeyVaultReferenceIdentityID) } + if functionApp.VirtualNetworkSubnetID != "" { + siteEnvelope.SiteProperties.VirtualNetworkSubnetID = utils.String(functionApp.VirtualNetworkSubnetID) + } + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.SiteName, siteEnvelope) if err != nil { return fmt.Errorf("creating Linux %s: %+v", id, err) @@ -591,6 +599,18 @@ func (r LinuxFunctionAppResource) Read() sdk.ResourceFunc { Tags: tags.ToTypedObject(functionApp.Tags), Kind: utils.NormalizeNilableString(functionApp.Kind), KeyVaultReferenceIdentityID: utils.NormalizeNilableString(props.KeyVaultReferenceIdentity), + CustomDomainVerificationId: utils.NormalizeNilableString(props.CustomDomainVerificationID), + DefaultHostname: utils.NormalizeNilableString(props.DefaultHostName), + } + + if v := props.OutboundIPAddresses; v != nil { + state.OutboundIPAddresses = *v + state.OutboundIPAddressList = strings.Split(*v, ",") + } + + if v := props.PossibleOutboundIPAddresses; v != nil { + state.PossibleOutboundIPAddresses = *v + state.PossibleOutboundIPAddressList = strings.Split(*v, ",") } configResp, err := client.GetConfiguration(ctx, id.ResourceGroup, id.SiteName) @@ -619,6 +639,10 @@ func (r LinuxFunctionAppResource) Read() sdk.ResourceFunc { state.HttpsOnly = utils.NormaliseNilableBool(functionApp.HTTPSOnly) state.ClientCertEnabled = utils.NormaliseNilableBool(functionApp.ClientCertEnabled) + if subnetId := utils.NormalizeNilableString(props.VirtualNetworkSubnetID); subnetId != "" { + state.VirtualNetworkSubnetID = subnetId + } + if err := metadata.Encode(&state); err != nil { return fmt.Errorf("encoding: %+v", err) } @@ -685,7 +709,7 @@ func (r LinuxFunctionAppResource) Update() sdk.ResourceFunc { } // Only send for ElasticPremium - sendContentSettings := helpers.PlanIsElastic(planSKU) + sendContentSettings := helpers.PlanIsElastic(planSKU) && !state.ForceDisableContentShare // Some service plan updates are allowed - see customiseDiff for exceptions if metadata.ResourceData.HasChange("service_plan_id") { @@ -700,6 +724,19 @@ func (r LinuxFunctionAppResource) Update() sdk.ResourceFunc { existing.SiteProperties.HTTPSOnly = utils.Bool(state.HttpsOnly) } + if metadata.ResourceData.HasChange("virtual_network_subnet_id") { + subnetId := metadata.ResourceData.Get("virtual_network_subnet_id").(string) + if subnetId == "" { + if _, err := client.DeleteSwiftVirtualNetwork(ctx, id.ResourceGroup, id.SiteName); err != nil { + return fmt.Errorf("removing `virtual_network_subnet_id` association for %s: %+v", *id, err) + } + var empty *string + existing.SiteProperties.VirtualNetworkSubnetID = empty + } else { + existing.SiteProperties.VirtualNetworkSubnetID = utils.String(subnetId) + } + } + if metadata.ResourceData.HasChange("client_certificate_enabled") { existing.SiteProperties.ClientCertEnabled = utils.Bool(state.ClientCertEnabled) } @@ -975,10 +1012,11 @@ func (m *LinuxFunctionAppModel) unpackLinuxFunctionAppSettings(input web.StringD } case "WEBSITE_HTTPLOGGING_RETENTION_DAYS": case "FUNCTIONS_WORKER_RUNTIME": - if len(m.SiteConfig) > 0 && len(m.SiteConfig[0].ApplicationStack) > 0 { - m.SiteConfig[0].ApplicationStack[0].CustomHandler = strings.EqualFold(*v, "custom") + if len(m.SiteConfig) > 0 && len(m.SiteConfig[0].ApplicationStack) == 0 { + if *v == "custom" { + m.SiteConfig[0].ApplicationStack = []helpers.ApplicationStackLinuxFunctionApp{{CustomHandler: true}} + } } - if _, ok := metadata.ResourceData.GetOk("app_settings.FUNCTIONS_WORKER_RUNTIME"); ok { appSettings[k] = utils.NormalizeNilableString(v) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_function_app_slot_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_function_app_slot_resource.go index a57f8c38153..4920f56de73 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_function_app_slot_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_function_app_slot_resource.go @@ -9,13 +9,14 @@ import ( "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" "github.com/google/uuid" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate" kvValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" + networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -47,6 +48,7 @@ type LinuxFunctionAppSlotModel struct { KeyVaultReferenceIdentityID string `tfschema:"key_vault_reference_identity_id"` SiteConfig []helpers.SiteConfigLinuxFunctionAppSlot `tfschema:"site_config"` Tags map[string]string `tfschema:"tags"` + VirtualNetworkSubnetID string `tfschema:"virtual_network_subnet_id"` CustomDomainVerificationId string `tfschema:"custom_domain_verification_id"` DefaultHostname string `tfschema:"default_hostname"` Kind string `tfschema:"kind"` @@ -217,13 +219,19 @@ func (r LinuxFunctionAppSlotResource) Arguments() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, Description: "The User Assigned Identity to use for Key Vault access.", }, "site_config": helpers.SiteConfigSchemaLinuxFunctionAppSlot(), "tags": tags.Schema(), + + "virtual_network_subnet_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: networkValidate.SubnetID, + }, } } @@ -317,22 +325,12 @@ func (r LinuxFunctionAppSlotResource) Create() sdk.ResourceFunc { return fmt.Errorf("reading %s: %+v", servicePlanId, err) } - sendContentSettings := !functionAppSlot.ForceDisableContentShare - if planSku := servicePlan.Sku; planSku != nil && planSku.Tier != nil { - switch tier := *planSku.Tier; strings.ToLower(tier) { - case "dynamic": // Consumption Plan modifications to request - sendContentSettings = false - case "elastic": // ElasticPremium Plan modifications to request? - case "basic": // App Service Plan modifications to request? - sendContentSettings = false - case "standard": - sendContentSettings = false - case "premiumv2", "premiumv3": - sendContentSettings = false - } - } else { - return fmt.Errorf("determining plan type for Linux %s: %v", id, err) + var planSKU *string + if sku := servicePlan.Sku; sku != nil && sku.Name != nil { + planSKU = sku.Name } + // Only send for ElasticPremium + sendContentSettings := helpers.PlanIsElastic(planSKU) && !functionAppSlot.ForceDisableContentShare existing, err := client.GetSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) if err != nil && !utils.ResponseWasNotFound(existing.Response) { @@ -408,12 +406,18 @@ func (r LinuxFunctionAppSlotResource) Create() sdk.ResourceFunc { if functionAppSlot.AppSettings == nil { functionAppSlot.AppSettings = make(map[string]string) } - suffix := uuid.New().String()[0:4] - if _, present := functionAppSlot.AppSettings["WEBSITE_CONTENTSHARE"]; !present { - functionAppSlot.AppSettings["WEBSITE_CONTENTSHARE"] = fmt.Sprintf("%s-%s", strings.ToLower(functionAppSlot.Name), suffix) - } - if _, present := functionAppSlot.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"]; !present { - functionAppSlot.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"] = storageString + if !functionAppSlot.StorageUsesMSI { + suffix := uuid.New().String()[0:4] + if _, present := functionAppSlot.AppSettings["WEBSITE_CONTENTSHARE"]; !present { + functionAppSlot.AppSettings["WEBSITE_CONTENTSHARE"] = fmt.Sprintf("%s-%s", strings.ToLower(functionAppSlot.Name), suffix) + } + if _, present := functionAppSlot.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"]; !present { + functionAppSlot.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"] = storageString + } + } else { + if _, present := functionAppSlot.AppSettings["AzureWebJobsStorage__accountName"]; !present { + functionAppSlot.AppSettings["AzureWebJobsStorage__accountName"] = storageString + } } } @@ -445,6 +449,10 @@ func (r LinuxFunctionAppSlotResource) Create() sdk.ResourceFunc { siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = utils.String(functionAppSlot.KeyVaultReferenceIdentityID) } + if functionAppSlot.VirtualNetworkSubnetID != "" { + siteEnvelope.SiteProperties.VirtualNetworkSubnetID = utils.String(functionAppSlot.VirtualNetworkSubnetID) + } + future, err := client.CreateOrUpdateSlot(ctx, id.ResourceGroup, id.SiteName, siteEnvelope, id.SlotName) if err != nil { return fmt.Errorf("creating Linux %s: %+v", id, err) @@ -567,6 +575,8 @@ func (r LinuxFunctionAppSlotResource) Read() sdk.ResourceFunc { Tags: tags.ToTypedObject(functionApp.Tags), Kind: utils.NormalizeNilableString(functionApp.Kind), KeyVaultReferenceIdentityID: utils.NormalizeNilableString(props.KeyVaultReferenceIdentity), + CustomDomainVerificationId: utils.NormalizeNilableString(props.CustomDomainVerificationID), + DefaultHostname: utils.NormalizeNilableString(props.DefaultHostName), } configResp, err := client.GetConfigurationSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) @@ -595,6 +605,10 @@ func (r LinuxFunctionAppSlotResource) Read() sdk.ResourceFunc { state.HttpsOnly = utils.NormaliseNilableBool(functionApp.HTTPSOnly) state.ClientCertEnabled = utils.NormaliseNilableBool(functionApp.ClientCertEnabled) + if subnetId := utils.NormalizeNilableString(props.VirtualNetworkSubnetID); subnetId != "" { + state.VirtualNetworkSubnetID = subnetId + } + if err := metadata.Encode(&state); err != nil { return fmt.Errorf("encoding: %+v", err) } @@ -660,7 +674,7 @@ func (r LinuxFunctionAppSlotResource) Update() sdk.ResourceFunc { return err } - sendContentSettings := !helpers.PlanIsElastic(planSKU) + sendContentSettings := helpers.PlanIsElastic(planSKU) && !state.ForceDisableContentShare if metadata.ResourceData.HasChange("enabled") { existing.SiteProperties.Enabled = utils.Bool(state.Enabled) @@ -694,6 +708,19 @@ func (r LinuxFunctionAppSlotResource) Update() sdk.ResourceFunc { existing.Tags = tags.FromTypedObject(state.Tags) } + if metadata.ResourceData.HasChange("virtual_network_subnet_id") { + subnetId := metadata.ResourceData.Get("virtual_network_subnet_id").(string) + if subnetId == "" { + if _, err := client.DeleteSwiftVirtualNetworkSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName); err != nil { + return fmt.Errorf("removing `virtual_network_subnet_id` association for %s: %+v", *id, err) + } + var empty *string + existing.SiteProperties.VirtualNetworkSubnetID = empty + } else { + existing.SiteProperties.VirtualNetworkSubnetID = utils.String(subnetId) + } + } + storageString := state.StorageAccountName if !state.StorageUsesMSI { if state.StorageKeyVaultSecretID != "" { @@ -822,8 +849,10 @@ func (m *LinuxFunctionAppSlotModel) unpackLinuxFunctionAppSettings(input web.Str case "WEBSITE_HTTPLOGGING_RETENTION_DAYS": case "FUNCTIONS_WORKER_RUNTIME": - if m.SiteConfig[0].ApplicationStack != nil { - m.SiteConfig[0].ApplicationStack[0].CustomHandler = strings.EqualFold(*v, "custom") + if len(m.SiteConfig) > 0 && len(m.SiteConfig[0].ApplicationStack) == 0 { + if *v == "custom" { + m.SiteConfig[0].ApplicationStack = []helpers.ApplicationStackLinuxFunctionApp{{CustomHandler: true}} + } } if _, ok := metadata.ResourceData.GetOk("app_settings.FUNCTIONS_WORKER_RUNTIME"); ok { appSettings[k] = utils.NormalizeNilableString(v) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_web_app_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_web_app_data_source.go index 90d57b3e2fc..b0420a35142 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_web_app_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_web_app_data_source.go @@ -48,6 +48,7 @@ type LinuxWebAppDataSourceModel struct { PossibleOutboundIPAddresses string `tfschema:"possible_outbound_ip_addresses"` PossibleOutboundIPAddressList []string `tfschema:"possible_outbound_ip_address_list"` SiteCredentials []helpers.SiteCredential `tfschema:"site_credential"` + VirtualNetworkSubnetID string `tfschema:"virtual_network_subnet_id"` } var _ sdk.DataSource = LinuxWebAppDataSource{} @@ -188,6 +189,11 @@ func (r LinuxWebAppDataSource) Attributes() map[string]*pluginsdk.Schema { "sticky_settings": helpers.StickySettingsComputedSchema(), "tags": tags.SchemaDataSource(), + + "virtual_network_subnet_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_web_app_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_web_app_resource.go index 203be6aca66..99a4c7d911b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_web_app_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_web_app_resource.go @@ -8,6 +8,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" @@ -15,7 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" + networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -38,6 +39,7 @@ type LinuxWebAppModel struct { ClientCertMode string `tfschema:"client_certificate_mode"` Enabled bool `tfschema:"enabled"` HttpsOnly bool `tfschema:"https_only"` + VirtualNetworkSubnetID string `tfschema:"virtual_network_subnet_id"` KeyVaultReferenceIdentityID string `tfschema:"key_vault_reference_identity_id"` LogsConfig []helpers.LogsConfig `tfschema:"logs"` SiteConfig []helpers.SiteConfigLinux `tfschema:"site_config"` @@ -128,13 +130,19 @@ func (r LinuxWebAppResource) Arguments() map[string]*pluginsdk.Schema { Default: false, }, + "virtual_network_subnet_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: networkValidate.SubnetID, + }, + "identity": commonschema.SystemAssignedUserAssignedIdentityOptional(), "key_vault_reference_identity_id": { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, "logs": helpers.LogsConfigSchema(), @@ -286,7 +294,7 @@ func (r LinuxWebAppResource) Create() sdk.ResourceFunc { return fmt.Errorf("the Site Name %q failed the availability check: %+v", id.SiteName, *checkName.Message) } - siteConfig, err := helpers.ExpandSiteConfigLinux(webApp.SiteConfig, nil, metadata) + siteConfig, err := helpers.ExpandSiteConfigLinux(webApp.SiteConfig, nil, metadata, servicePlan) if err != nil { return err } @@ -311,6 +319,10 @@ func (r LinuxWebAppResource) Create() sdk.ResourceFunc { }, } + if webApp.VirtualNetworkSubnetID != "" { + siteEnvelope.SiteProperties.VirtualNetworkSubnetID = utils.String(webApp.VirtualNetworkSubnetID) + } + if webApp.KeyVaultReferenceIdentityID != "" { siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = utils.String(webApp.KeyVaultReferenceIdentityID) } @@ -494,6 +506,10 @@ func (r LinuxWebAppResource) Read() sdk.ResourceFunc { Tags: tags.ToTypedObject(webApp.Tags), } + if subnetId := utils.NormalizeNilableString(props.VirtualNetworkSubnetID); subnetId != "" { + state.VirtualNetworkSubnetID = subnetId + } + var healthCheckCount *int state.AppSettings, healthCheckCount = helpers.FlattenAppSettings(appSettings) @@ -574,6 +590,7 @@ func (r LinuxWebAppResource) Update() sdk.ResourceFunc { Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.AppService.WebAppsClient + servicePlanClient := metadata.Client.AppService.ServicePlanClient id, err := parse.WebAppID(metadata.ResourceData.Id()) if err != nil { @@ -592,9 +609,26 @@ func (r LinuxWebAppResource) Update() sdk.ResourceFunc { return fmt.Errorf("reading Linux %s: %v", id, err) } + var serviceFarmId string + servicePlanChange := false + if existing.SiteProperties.ServerFarmID != nil { + serviceFarmId = *existing.ServerFarmID + } if metadata.ResourceData.HasChange("service_plan_id") { - existing.SiteProperties.ServerFarmID = utils.String(state.ServicePlanId) + serviceFarmId = state.ServicePlanId + existing.SiteProperties.ServerFarmID = utils.String(serviceFarmId) + servicePlanChange = true } + servicePlanId, err := parse.ServicePlanID(serviceFarmId) + if err != nil { + return err + } + + servicePlan, err := servicePlanClient.Get(ctx, servicePlanId.ResourceGroup, servicePlanId.ServerfarmName) + if err != nil { + return fmt.Errorf("reading App %s: %+v", servicePlanId, err) + } + if metadata.ResourceData.HasChange("enabled") { existing.SiteProperties.Enabled = utils.Bool(state.Enabled) } @@ -627,14 +661,27 @@ func (r LinuxWebAppResource) Update() sdk.ResourceFunc { existing.Tags = tags.FromTypedObject(state.Tags) } - if metadata.ResourceData.HasChange("site_config") { - siteConfig, err := helpers.ExpandSiteConfigLinux(state.SiteConfig, existing.SiteConfig, metadata) + if metadata.ResourceData.HasChange("site_config") || servicePlanChange { + siteConfig, err := helpers.ExpandSiteConfigLinux(state.SiteConfig, existing.SiteConfig, metadata, servicePlan) if err != nil { return fmt.Errorf("expanding Site Config for Linux %s: %+v", id, err) } existing.SiteConfig = siteConfig } + if metadata.ResourceData.HasChange("virtual_network_subnet_id") { + subnetId := metadata.ResourceData.Get("virtual_network_subnet_id").(string) + if subnetId == "" { + if _, err := client.DeleteSwiftVirtualNetwork(ctx, id.ResourceGroup, id.SiteName); err != nil { + return fmt.Errorf("removing `virtual_network_subnet_id` association for %s: %+v", *id, err) + } + var empty *string + existing.SiteProperties.VirtualNetworkSubnetID = empty + } else { + existing.SiteProperties.VirtualNetworkSubnetID = utils.String(subnetId) + } + } + updateFuture, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.SiteName, existing) if err != nil { return fmt.Errorf("updating Linux %s: %+v", id, err) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_web_app_slot_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_web_app_slot_resource.go index 581919de5dd..f0d164243ef 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_web_app_slot_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/linux_web_app_slot_resource.go @@ -7,14 +7,14 @@ import ( "strings" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" + networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -50,6 +50,7 @@ type LinuxWebAppSlotModel struct { PossibleOutboundIPAddresses string `tfschema:"possible_outbound_ip_addresses"` PossibleOutboundIPAddressList []string `tfschema:"possible_outbound_ip_address_list"` SiteCredentials []helpers.SiteCredential `tfschema:"site_credential"` + VirtualNetworkSubnetID string `tfschema:"virtual_network_subnet_id"` } var _ sdk.ResourceWithUpdate = LinuxWebAppSlotResource{} @@ -131,13 +132,19 @@ func (r LinuxWebAppSlotResource) Arguments() map[string]*pluginsdk.Schema { Default: false, }, + "virtual_network_subnet_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: networkValidate.SubnetID, + }, + "identity": commonschema.SystemAssignedUserAssignedIdentityOptional(), "key_vault_reference_identity_id": { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, "logs": helpers.LogsConfigSchema(), @@ -279,6 +286,10 @@ func (r LinuxWebAppSlotResource) Create() sdk.ResourceFunc { }, } + if webAppSlot.VirtualNetworkSubnetID != "" { + siteEnvelope.SiteProperties.VirtualNetworkSubnetID = utils.String(webAppSlot.VirtualNetworkSubnetID) + } + if webAppSlot.KeyVaultReferenceIdentityID != "" { siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = utils.String(webAppSlot.KeyVaultReferenceIdentityID) } @@ -443,6 +454,10 @@ func (r LinuxWebAppSlotResource) Read() sdk.ResourceFunc { Tags: tags.ToTypedObject(webApp.Tags), } + if subnetId := utils.NormalizeNilableString(props.VirtualNetworkSubnetID); subnetId != "" { + state.VirtualNetworkSubnetID = subnetId + } + var healthCheckCount *int state.AppSettings, healthCheckCount = helpers.FlattenAppSettings(appSettings) @@ -577,6 +592,19 @@ func (r LinuxWebAppSlotResource) Update() sdk.ResourceFunc { existing.SiteConfig = siteConfig } + if metadata.ResourceData.HasChange("virtual_network_subnet_id") { + subnetId := metadata.ResourceData.Get("virtual_network_subnet_id").(string) + if subnetId == "" { + if _, err := client.DeleteSwiftVirtualNetworkSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName); err != nil { + return fmt.Errorf("removing `virtual_network_subnet_id` association for %s: %+v", *id, err) + } + var empty *string + existing.SiteProperties.VirtualNetworkSubnetID = empty + } else { + existing.SiteProperties.VirtualNetworkSubnetID = utils.String(subnetId) + } + } + updateFuture, err := client.CreateOrUpdateSlot(ctx, id.ResourceGroup, id.SiteName, existing, id.SlotName) if err != nil { return fmt.Errorf("updating Linux %s: %+v", id, err) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate/app_setting_name.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate/app_setting_name.go deleted file mode 100644 index 21c2129ecac..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate/app_setting_name.go +++ /dev/null @@ -1,20 +0,0 @@ -package validate - -import ( - "fmt" - "regexp" -) - -func AppSettingName(i interface{}, k string) (warnings []string, errors []error) { - v, ok := i.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", k)) - return - } - - if matched := regexp.MustCompile(`^[0-9a-zA-Z._]+$`).Match([]byte(v)); !matched { - errors = append(errors, fmt.Errorf("%q may only contain alphanumeric characters, periods and underscores", k)) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/web_app_hybrid_connection_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/web_app_hybrid_connection_resource.go index ca34a974147..b3800e2a0b0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/web_app_hybrid_connection_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/web_app_hybrid_connection_resource.go @@ -7,15 +7,14 @@ import ( "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections" + "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate" - relayParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -144,7 +143,7 @@ func (r WebAppHybridConnectionResource) Create() sdk.ResourceFunc { if err != nil { return err } - relayId, err := relayParse.HybridConnectionID(appHybridConn.RelayId) + relayId, err := hybridconnections.ParseHybridConnectionID(appHybridConn.RelayId) if err != nil { return err } @@ -221,7 +220,7 @@ func (r WebAppHybridConnectionResource) Read() sdk.ResourceFunc { if appHybridConn.ServiceBusNamespace != "" && appHybridConn.SendKeyName != "" { relayNamespaceClient := metadata.Client.Relay.NamespacesClient - relayId, err := relayParse.HybridConnectionID(appHybridConn.RelayId) + relayId, err := hybridconnections.ParseHybridConnectionID(appHybridConn.RelayId) if err != nil { return err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_function_app_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_function_app_data_source.go index b7d2a30cbbc..88eaf7125e6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_function_app_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_function_app_data_source.go @@ -47,6 +47,7 @@ type WindowsFunctionAppDataSourceModel struct { SiteConfig []helpers.SiteConfigWindowsFunctionApp `tfschema:"site_config"` StickySettings []helpers.StickySettings `tfschema:"sticky_settings"` Tags map[string]string `tfschema:"tags"` + VirtualNetworkSubnetId string `tfschema:"virtual_network_subnet_id"` CustomDomainVerificationId string `tfschema:"custom_domain_verification_id"` DefaultHostname string `tfschema:"default_hostname"` @@ -216,6 +217,11 @@ func (d WindowsFunctionAppDataSource) Attributes() map[string]*pluginsdk.Schema "identity": commonschema.SystemAssignedUserAssignedIdentityComputed(), "tags": tags.SchemaDataSource(), + + "virtual_network_subnet_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, } } @@ -256,6 +262,18 @@ func (d WindowsFunctionAppDataSource) Read() sdk.ResourceFunc { functionApp.Tags = tags.ToTypedObject(existing.Tags) functionApp.Kind = utils.NormalizeNilableString(existing.Kind) functionApp.CustomDomainVerificationId = utils.NormalizeNilableString(props.CustomDomainVerificationID) + functionApp.DefaultHostname = utils.NormalizeNilableString(props.DefaultHostName) + functionApp.VirtualNetworkSubnetId = utils.NormalizeNilableString(props.VirtualNetworkSubnetID) + + if v := props.OutboundIPAddresses; v != nil { + functionApp.OutboundIPAddresses = *v + functionApp.OutboundIPAddressList = strings.Split(*v, ",") + } + + if v := props.PossibleOutboundIPAddresses; v != nil { + functionApp.PossibleOutboundIPAddresses = *v + functionApp.PossibleOutboundIPAddressList = strings.Split(*v, ",") + } appSettingsResp, err := client.ListApplicationSettings(ctx, id.ResourceGroup, id.SiteName) if err != nil { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_function_app_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_function_app_resource.go index 1efdffc725c..246ce171bde 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_function_app_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_function_app_resource.go @@ -9,6 +9,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" "github.com/google/uuid" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" @@ -17,7 +18,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate" kvValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" + networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -54,6 +55,7 @@ type WindowsFunctionAppModel struct { KeyVaultReferenceIdentityID string `tfschema:"key_vault_reference_identity_id"` SiteConfig []helpers.SiteConfigWindowsFunctionApp `tfschema:"site_config"` Tags map[string]string `tfschema:"tags"` + VirtualNetworkSubnetID string `tfschema:"virtual_network_subnet_id"` // Computed CustomDomainVerificationId string `tfschema:"custom_domain_verification_id"` @@ -234,7 +236,7 @@ func (r WindowsFunctionAppResource) Arguments() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, Description: "The User Assigned Identity to use for Key Vault access.", }, @@ -243,6 +245,12 @@ func (r WindowsFunctionAppResource) Arguments() map[string]*pluginsdk.Schema { "sticky_settings": helpers.StickySettingsSchema(), "tags": tags.Schema(), + + "virtual_network_subnet_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: networkValidate.SubnetID, + }, } } @@ -321,21 +329,12 @@ func (r WindowsFunctionAppResource) Create() sdk.ResourceFunc { return fmt.Errorf("reading %s: %+v", servicePlanId, err) } - sendContentSettings := !functionApp.ForceDisableContentShare - if planSku := servicePlan.Sku; planSku != nil && planSku.Tier != nil { - switch tier := *planSku.Tier; strings.ToLower(tier) { - case "dynamic": - case "elastic": - case "basic": - sendContentSettings = false - case "standard": - sendContentSettings = false - case "premiumv2", "premiumv3": - sendContentSettings = false - } - } else { - return fmt.Errorf("determining plan type for Windows %s: %v", id, err) + var planSKU *string + if sku := servicePlan.Sku; sku != nil && sku.Name != nil { + planSKU = sku.Name } + // Only send for Dynamic and ElasticPremium + sendContentSettings := (helpers.PlanIsConsumption(planSKU) || helpers.PlanIsElastic(planSKU)) && !functionApp.ForceDisableContentShare existing, err := client.Get(ctx, id.ResourceGroup, id.SiteName) if err != nil && !utils.ResponseWasNotFound(existing.Response) { @@ -411,12 +410,18 @@ func (r WindowsFunctionAppResource) Create() sdk.ResourceFunc { if functionApp.AppSettings == nil { functionApp.AppSettings = make(map[string]string) } - suffix := uuid.New().String()[0:4] - if _, present := functionApp.AppSettings["WEBSITE_CONTENTSHARE"]; !present { - functionApp.AppSettings["WEBSITE_CONTENTSHARE"] = fmt.Sprintf("%s-%s", strings.ToLower(functionApp.Name), suffix) - } - if _, present := functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"]; !present { - functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"] = storageString + if !functionApp.StorageUsesMSI { + suffix := uuid.New().String()[0:4] + if _, present := functionApp.AppSettings["WEBSITE_CONTENTSHARE"]; !present { + functionApp.AppSettings["WEBSITE_CONTENTSHARE"] = fmt.Sprintf("%s-%s", strings.ToLower(functionApp.Name), suffix) + } + if _, present := functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"]; !present { + functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"] = storageString + } + } else { + if _, present := functionApp.AppSettings["AzureWebJobsStorage__accountName"]; !present { + functionApp.AppSettings["AzureWebJobsStorage__accountName"] = storageString + } } } @@ -444,6 +449,10 @@ func (r WindowsFunctionAppResource) Create() sdk.ResourceFunc { }, } + if functionApp.VirtualNetworkSubnetID != "" { + siteEnvelope.SiteProperties.VirtualNetworkSubnetID = utils.String(functionApp.VirtualNetworkSubnetID) + } + if functionApp.KeyVaultReferenceIdentityID != "" { siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = utils.String(functionApp.KeyVaultReferenceIdentityID) } @@ -590,6 +599,17 @@ func (r WindowsFunctionAppResource) Read() sdk.ResourceFunc { Kind: utils.NormalizeNilableString(functionApp.Kind), KeyVaultReferenceIdentityID: utils.NormalizeNilableString(props.KeyVaultReferenceIdentity), CustomDomainVerificationId: utils.NormalizeNilableString(props.CustomDomainVerificationID), + DefaultHostname: utils.NormalizeNilableString(props.DefaultHostName), + } + + if v := props.OutboundIPAddresses; v != nil { + state.OutboundIPAddresses = *v + state.OutboundIPAddressList = strings.Split(*v, ",") + } + + if v := props.PossibleOutboundIPAddresses; v != nil { + state.PossibleOutboundIPAddresses = *v + state.PossibleOutboundIPAddressList = strings.Split(*v, ",") } configResp, err := client.GetConfiguration(ctx, id.ResourceGroup, id.SiteName) @@ -618,6 +638,10 @@ func (r WindowsFunctionAppResource) Read() sdk.ResourceFunc { state.HttpsOnly = utils.NormaliseNilableBool(functionApp.HTTPSOnly) state.ClientCertEnabled = utils.NormaliseNilableBool(functionApp.ClientCertEnabled) + if subnetId := utils.NormalizeNilableString(functionApp.VirtualNetworkSubnetID); subnetId != "" { + state.VirtualNetworkSubnetID = subnetId + } + if err := metadata.Encode(&state); err != nil { return fmt.Errorf("encoding: %+v", err) } @@ -682,7 +706,9 @@ func (r WindowsFunctionAppResource) Update() sdk.ResourceFunc { if err != nil { return err } - sendContentSettings := !helpers.PlanIsAppPlan(planSKU) + + // Only send for Dynamic and ElasticPremium + sendContentSettings := (helpers.PlanIsConsumption(planSKU) || helpers.PlanIsElastic(planSKU)) && !state.ForceDisableContentShare // Some service plan updates are allowed - see customiseDiff for exceptions if metadata.ResourceData.HasChange("service_plan_id") { @@ -721,6 +747,19 @@ func (r WindowsFunctionAppResource) Update() sdk.ResourceFunc { existing.Tags = tags.FromTypedObject(state.Tags) } + if metadata.ResourceData.HasChange("virtual_network_subnet_id") { + subnetId := metadata.ResourceData.Get("virtual_network_subnet_id").(string) + if subnetId == "" { + if _, err := client.DeleteSwiftVirtualNetwork(ctx, id.ResourceGroup, id.SiteName); err != nil { + return fmt.Errorf("removing `virtual_network_subnet_id` association for %s: %+v", *id, err) + } + var empty *string + existing.SiteProperties.VirtualNetworkSubnetID = empty + } else { + existing.SiteProperties.VirtualNetworkSubnetID = utils.String(subnetId) + } + } + storageString := state.StorageAccountName if !state.StorageUsesMSI { if state.StorageKeyVaultSecretID != "" { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_function_app_slot_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_function_app_slot_resource.go index 2689679b5b5..3a47b06699e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_function_app_slot_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_function_app_slot_resource.go @@ -9,13 +9,14 @@ import ( "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" "github.com/google/uuid" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate" kvValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" + networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -55,6 +56,7 @@ type WindowsFunctionAppSlotModel struct { PossibleOutboundIPAddresses string `tfschema:"possible_outbound_ip_addresses"` PossibleOutboundIPAddressList []string `tfschema:"possible_outbound_ip_address_list"` SiteCredentials []helpers.SiteCredential `tfschema:"site_credential"` + VirtualNetworkSubnetID string `tfschema:"virtual_network_subnet_id"` } var _ sdk.ResourceWithUpdate = WindowsFunctionAppSlotResource{} @@ -217,13 +219,19 @@ func (r WindowsFunctionAppSlotResource) Arguments() map[string]*pluginsdk.Schema Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, Description: "The User Assigned Identity to use for Key Vault access.", }, "site_config": helpers.SiteConfigSchemaWindowsFunctionAppSlot(), "tags": tags.Schema(), + + "virtual_network_subnet_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: networkValidate.SubnetID, + }, } } @@ -324,21 +332,14 @@ func (r WindowsFunctionAppSlotResource) Create() sdk.ResourceFunc { return fmt.Errorf("reading %s: %+v", servicePlanId, err) } - sendContentSettings := !functionAppSlot.ForceDisableContentShare - if planSku := servicePlan.Sku; planSku != nil && planSku.Tier != nil { - switch tier := *planSku.Tier; strings.ToLower(tier) { - case "dynamic": - case "elastic": - case "basic": - sendContentSettings = false - case "standard": - sendContentSettings = false - case "premiumv2", "premiumv3": - sendContentSettings = false - } + var planSKU *string + if sku := servicePlan.Sku; sku != nil && sku.Name != nil { + planSKU = sku.Name } else { - return fmt.Errorf("determining plan type for Windows %s: %v", id, err) + return fmt.Errorf("could not determine Service Plan SKU type") } + // Only send for Dynamic and ElasticPremium + sendContentSettings := (helpers.PlanIsConsumption(planSKU) || helpers.PlanIsElastic(planSKU)) && !functionAppSlot.ForceDisableContentShare existing, err := client.GetSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) if err != nil && !utils.ResponseWasNotFound(existing.Response) { @@ -414,12 +415,18 @@ func (r WindowsFunctionAppSlotResource) Create() sdk.ResourceFunc { if functionAppSlot.AppSettings == nil { functionAppSlot.AppSettings = make(map[string]string) } - suffix := uuid.New().String()[0:4] - if _, present := functionAppSlot.AppSettings["WEBSITE_CONTENTSHARE"]; !present { - functionAppSlot.AppSettings["WEBSITE_CONTENTSHARE"] = fmt.Sprintf("%s-%s", strings.ToLower(functionAppSlot.Name), suffix) - } - if _, present := functionAppSlot.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"]; !present { - functionAppSlot.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"] = storageString + if !functionAppSlot.StorageUsesMSI { + suffix := uuid.New().String()[0:4] + if _, present := functionAppSlot.AppSettings["WEBSITE_CONTENTSHARE"]; !present { + functionAppSlot.AppSettings["WEBSITE_CONTENTSHARE"] = fmt.Sprintf("%s-%s", strings.ToLower(functionAppSlot.Name), suffix) + } + if _, present := functionAppSlot.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"]; !present { + functionAppSlot.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"] = storageString + } + } else { + if _, present := functionAppSlot.AppSettings["AzureWebJobsStorage__accountName"]; !present { + functionAppSlot.AppSettings["AzureWebJobsStorage__accountName"] = storageString + } } } @@ -447,6 +454,10 @@ func (r WindowsFunctionAppSlotResource) Create() sdk.ResourceFunc { }, } + if functionAppSlot.VirtualNetworkSubnetID != "" { + siteEnvelope.SiteProperties.VirtualNetworkSubnetID = utils.String(functionAppSlot.VirtualNetworkSubnetID) + } + if functionAppSlot.KeyVaultReferenceIdentityID != "" { siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = utils.String(functionAppSlot.KeyVaultReferenceIdentityID) } @@ -511,18 +522,18 @@ func (r WindowsFunctionAppSlotResource) Read() sdk.ResourceFunc { if err != nil { return err } - functionAppSlot, err := client.GetSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) + functionApp, err := client.GetSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) if err != nil { - if utils.ResponseWasNotFound(functionAppSlot.Response) { + if utils.ResponseWasNotFound(functionApp.Response) { return metadata.MarkAsGone(id) } return fmt.Errorf("reading Windows %s: %+v", id, err) } - if functionAppSlot.SiteProperties == nil { + if functionApp.SiteProperties == nil { return fmt.Errorf("reading properties of Windows %s", id) } - props := *functionAppSlot.SiteProperties + props := *functionApp.SiteProperties appSettingsResp, err := client.ListApplicationSettingsSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) if err != nil { @@ -567,13 +578,14 @@ func (r WindowsFunctionAppSlotResource) Read() sdk.ResourceFunc { state := WindowsFunctionAppSlotModel{ Name: id.SlotName, FunctionAppID: parse.NewFunctionAppID(id.SubscriptionId, id.ResourceGroup, id.SiteName).ID(), - Enabled: utils.NormaliseNilableBool(functionAppSlot.Enabled), - ClientCertMode: string(functionAppSlot.ClientCertMode), + Enabled: utils.NormaliseNilableBool(functionApp.Enabled), + ClientCertMode: string(functionApp.ClientCertMode), DailyMemoryTimeQuota: int(utils.NormaliseNilableInt32(props.DailyMemoryTimeQuota)), - Tags: tags.ToTypedObject(functionAppSlot.Tags), - Kind: utils.NormalizeNilableString(functionAppSlot.Kind), + Tags: tags.ToTypedObject(functionApp.Tags), + Kind: utils.NormalizeNilableString(functionApp.Kind), KeyVaultReferenceIdentityID: utils.NormalizeNilableString(props.KeyVaultReferenceIdentity), CustomDomainVerificationId: utils.NormalizeNilableString(props.CustomDomainVerificationID), + DefaultHostname: utils.NormalizeNilableString(props.DefaultHostName), } configResp, err := client.GetConfigurationSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName) @@ -599,14 +611,18 @@ func (r WindowsFunctionAppSlotResource) Read() sdk.ResourceFunc { state.SiteConfig[0].AppServiceLogs = helpers.FlattenFunctionAppAppServiceLogs(logs) - state.HttpsOnly = utils.NormaliseNilableBool(functionAppSlot.HTTPSOnly) - state.ClientCertEnabled = utils.NormaliseNilableBool(functionAppSlot.ClientCertEnabled) + state.HttpsOnly = utils.NormaliseNilableBool(functionApp.HTTPSOnly) + state.ClientCertEnabled = utils.NormaliseNilableBool(functionApp.ClientCertEnabled) + + if subnetId := utils.NormalizeNilableString(props.VirtualNetworkSubnetID); subnetId != "" { + state.VirtualNetworkSubnetID = subnetId + } if err := metadata.Encode(&state); err != nil { return fmt.Errorf("encoding: %+v", err) } - flattenedIdentity, err := flattenIdentity(functionAppSlot.Identity) + flattenedIdentity, err := flattenIdentity(functionApp.Identity) if err != nil { return fmt.Errorf("flattening `identity`: %+v", err) } @@ -666,7 +682,9 @@ func (r WindowsFunctionAppSlotResource) Update() sdk.ResourceFunc { if err != nil { return err } - sendContentSettings := !helpers.PlanIsAppPlan(planSKU) + + // Only send for Dynamic and ElasticPremium + sendContentSettings := (helpers.PlanIsConsumption(planSKU) || helpers.PlanIsElastic(planSKU)) && !state.ForceDisableContentShare // Some service plan updates are allowed - see customiseDiff for exceptions if metadata.ResourceData.HasChange("enabled") { @@ -701,6 +719,19 @@ func (r WindowsFunctionAppSlotResource) Update() sdk.ResourceFunc { existing.Tags = tags.FromTypedObject(state.Tags) } + if metadata.ResourceData.HasChange("virtual_network_subnet_id") { + subnetId := metadata.ResourceData.Get("virtual_network_subnet_id").(string) + if subnetId == "" { + if _, err := client.DeleteSwiftVirtualNetworkSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName); err != nil { + return fmt.Errorf("removing `virtual_network_subnet_id` association for %s: %+v", *id, err) + } + var empty *string + existing.SiteProperties.VirtualNetworkSubnetID = empty + } else { + existing.SiteProperties.VirtualNetworkSubnetID = utils.String(subnetId) + } + } + storageString := state.StorageAccountName if !state.StorageUsesMSI { if state.StorageKeyVaultSecretID != "" { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_web_app_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_web_app_data_source.go index 48a9d59ef9f..f4641f72659 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_web_app_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_web_app_data_source.go @@ -46,6 +46,7 @@ type WindowsWebAppDataSourceModel struct { PossibleOutboundIPAddressList []string `tfschema:"possible_outbound_ip_address_list"` SiteCredentials []helpers.SiteCredential `tfschema:"site_credential"` Tags map[string]string `tfschema:"tags"` + VirtualNetworkSubnetID string `tfschema:"virtual_network_subnet_id"` } var _ sdk.DataSource = WindowsWebAppDataSource{} @@ -172,6 +173,11 @@ func (d WindowsWebAppDataSource) Attributes() map[string]*pluginsdk.Schema { "storage_account": helpers.StorageAccountSchemaComputed(), + "virtual_network_subnet_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "tags": tags.SchemaDataSource(), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_web_app_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_web_app_resource.go index 4e8e19dae8d..fbfa9bd52ce 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_web_app_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_web_app_resource.go @@ -7,6 +7,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" @@ -14,7 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" + networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -52,6 +53,7 @@ type WindowsWebAppModel struct { SiteCredentials []helpers.SiteCredential `tfschema:"site_credential"` ZipDeployFile string `tfschema:"zip_deploy_file"` Tags map[string]string `tfschema:"tags"` + VirtualNetworkSubnetID string `tfschema:"virtual_network_subnet_id"` } var _ sdk.ResourceWithCustomImporter = WindowsWebAppResource{} @@ -131,7 +133,7 @@ func (r WindowsWebAppResource) Arguments() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, "logs": helpers.LogsConfigSchema(), @@ -151,6 +153,12 @@ func (r WindowsWebAppResource) Arguments() map[string]*pluginsdk.Schema { }, "tags": tags.Schema(), + + "virtual_network_subnet_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: networkValidate.SubnetID, + }, } } @@ -282,7 +290,7 @@ func (r WindowsWebAppResource) Create() sdk.ResourceFunc { return fmt.Errorf("the Site Name %q failed the availability check: %+v", id.SiteName, *checkName.Message) } - siteConfig, currentStack, err := helpers.ExpandSiteConfigWindows(webApp.SiteConfig, nil, metadata) + siteConfig, currentStack, err := helpers.ExpandSiteConfigWindows(webApp.SiteConfig, nil, metadata, servicePlan) if err != nil { return err } @@ -313,6 +321,10 @@ func (r WindowsWebAppResource) Create() sdk.ResourceFunc { siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = utils.String(webApp.KeyVaultReferenceIdentityID) } + if webApp.VirtualNetworkSubnetID != "" { + siteEnvelope.SiteProperties.VirtualNetworkSubnetID = utils.String(webApp.VirtualNetworkSubnetID) + } + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.SiteName, siteEnvelope) if err != nil { return fmt.Errorf("creating Windows %s: %+v", id, err) @@ -510,6 +522,10 @@ func (r WindowsWebAppResource) Read() sdk.ResourceFunc { Tags: tags.ToTypedObject(webApp.Tags), } + if subnetId := utils.NormalizeNilableString(props.VirtualNetworkSubnetID); subnetId != "" { + state.VirtualNetworkSubnetID = subnetId + } + var healthCheckCount *int state.AppSettings, healthCheckCount = helpers.FlattenAppSettings(appSettings) @@ -584,6 +600,7 @@ func (r WindowsWebAppResource) Update() sdk.ResourceFunc { Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.AppService.WebAppsClient + servicePlanClient := metadata.Client.AppService.ServicePlanClient id, err := parse.WebAppID(metadata.ResourceData.Id()) if err != nil { @@ -602,9 +619,26 @@ func (r WindowsWebAppResource) Update() sdk.ResourceFunc { return fmt.Errorf("reading Windows %s: %v", id, err) } + var serviceFarmId string + servicePlanChange := false + if existing.SiteProperties.ServerFarmID != nil { + serviceFarmId = *existing.ServerFarmID + } if metadata.ResourceData.HasChange("service_plan_id") { - existing.SiteProperties.ServerFarmID = utils.String(state.ServicePlanId) + serviceFarmId = state.ServicePlanId + existing.SiteProperties.ServerFarmID = utils.String(serviceFarmId) + servicePlanChange = true + } + servicePlanId, err := parse.ServicePlanID(serviceFarmId) + if err != nil { + return err } + + servicePlan, err := servicePlanClient.Get(ctx, servicePlanId.ResourceGroup, servicePlanId.ServerfarmName) + if err != nil { + return fmt.Errorf("reading App %s: %+v", servicePlanId, err) + } + if metadata.ResourceData.HasChange("enabled") { existing.SiteProperties.Enabled = utils.Bool(state.Enabled) } @@ -637,9 +671,27 @@ func (r WindowsWebAppResource) Update() sdk.ResourceFunc { existing.Tags = tags.FromTypedObject(state.Tags) } + if metadata.ResourceData.HasChange("virtual_network_subnet_id") { + subnetId := metadata.ResourceData.Get("virtual_network_subnet_id").(string) + if subnetId == "" { + if _, err := client.DeleteSwiftVirtualNetwork(ctx, id.ResourceGroup, id.SiteName); err != nil { + return fmt.Errorf("removing `virtual_network_subnet_id` association for %s: %+v", *id, err) + } + var empty *string + existing.SiteProperties.VirtualNetworkSubnetID = empty + } else { + existing.SiteProperties.VirtualNetworkSubnetID = utils.String(subnetId) + } + } + currentStack := "" - if metadata.ResourceData.HasChange("site_config") { - siteConfig, stack, err := helpers.ExpandSiteConfigWindows(state.SiteConfig, existing.SiteConfig, metadata) + stateConfig := state.SiteConfig[0] + if len(stateConfig.ApplicationStack) == 1 { + currentStack = stateConfig.ApplicationStack[0].CurrentStack + } + + if metadata.ResourceData.HasChange("site_config") || servicePlanChange { + siteConfig, stack, err := helpers.ExpandSiteConfigWindows(state.SiteConfig, existing.SiteConfig, metadata, servicePlan) if err != nil { return fmt.Errorf("expanding Site Config for Windows %s: %+v", id, err) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_web_app_slot_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_web_app_slot_resource.go index 819c40f93e7..de51b5def48 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_web_app_slot_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/windows_web_app_slot_resource.go @@ -7,12 +7,13 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" + networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -47,6 +48,7 @@ type WindowsWebAppSlotModel struct { SiteCredentials []helpers.SiteCredential `tfschema:"site_credential"` ZipDeployFile string `tfschema:"zip_deploy_file"` Tags map[string]string `tfschema:"tags"` + VirtualNetworkSubnetID string `tfschema:"virtual_network_subnet_id"` } var _ sdk.ResourceWithUpdate = WindowsWebAppSlotResource{} @@ -135,7 +137,7 @@ func (r WindowsWebAppSlotResource) Arguments() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, "logs": helpers.LogsConfigSchema(), @@ -153,6 +155,12 @@ func (r WindowsWebAppSlotResource) Arguments() map[string]*pluginsdk.Schema { }, "tags": tags.Schema(), + + "virtual_network_subnet_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: networkValidate.SubnetID, + }, } } @@ -272,6 +280,10 @@ func (r WindowsWebAppSlotResource) Create() sdk.ResourceFunc { siteEnvelope.SiteProperties.KeyVaultReferenceIdentity = utils.String(webAppSlot.KeyVaultReferenceIdentityID) } + if webAppSlot.VirtualNetworkSubnetID != "" { + siteEnvelope.SiteProperties.VirtualNetworkSubnetID = utils.String(webAppSlot.VirtualNetworkSubnetID) + } + future, err := client.CreateOrUpdateSlot(ctx, id.ResourceGroup, id.SiteName, siteEnvelope, id.SlotName) if err != nil { return fmt.Errorf("creating Windows %s: %+v", id, err) @@ -450,6 +462,10 @@ func (r WindowsWebAppSlotResource) Read() sdk.ResourceFunc { Tags: tags.ToTypedObject(webApp.Tags), } + if subnetId := utils.NormalizeNilableString(props.VirtualNetworkSubnetID); subnetId != "" { + state.VirtualNetworkSubnetID = subnetId + } + var healthCheckCount *int state.AppSettings, healthCheckCount = helpers.FlattenAppSettings(appSettings) @@ -571,6 +587,11 @@ func (r WindowsWebAppSlotResource) Update() sdk.ResourceFunc { } currentStack := "" + stateConfig := state.SiteConfig[0] + if len(stateConfig.ApplicationStack) == 1 { + currentStack = stateConfig.ApplicationStack[0].CurrentStack + } + if metadata.ResourceData.HasChange("site_config") { siteConfig, stack, err := helpers.ExpandSiteConfigWindowsWebAppSlot(state.SiteConfig, existing.SiteConfig, metadata) if err != nil { @@ -580,6 +601,19 @@ func (r WindowsWebAppSlotResource) Update() sdk.ResourceFunc { existing.SiteConfig = siteConfig } + if metadata.ResourceData.HasChange("virtual_network_subnet_id") { + subnetId := metadata.ResourceData.Get("virtual_network_subnet_id").(string) + if subnetId == "" { + if _, err := client.DeleteSwiftVirtualNetworkSlot(ctx, id.ResourceGroup, id.SiteName, id.SlotName); err != nil { + return fmt.Errorf("removing `virtual_network_subnet_id` association for %s: %+v", *id, err) + } + var empty *string + existing.SiteProperties.VirtualNetworkSubnetID = empty + } else { + existing.SiteProperties.VirtualNetworkSubnetID = utils.String(subnetId) + } + } + updateFuture, err := client.CreateOrUpdateSlot(ctx, id.ResourceGroup, id.SiteName, existing, id.SlotName) if err != nil { return fmt.Errorf("updating Windows %s: %+v", id, err) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/attestation_provider_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/attestation_provider_data_source.go index 0957c034af1..67fe30be144 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/attestation_provider_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/attestation_provider_data_source.go @@ -8,9 +8,8 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" ) @@ -66,7 +65,7 @@ func dataSourceArmAttestationProviderRead(d *pluginsdk.ResourceData, meta interf return fmt.Errorf("retrieving %s: %+v", id, err) } - d.SetId(parse.NewProviderID(subscriptionId, resourceGroup, name).ID()) + d.SetId(id.ID()) d.Set("name", name) d.Set("resource_group_name", resourceGroup) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/attestation_provider_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/attestation_provider_resource.go index a2a07b01b60..9e30cc505cc 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/attestation_provider_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/attestation_provider_resource.go @@ -11,11 +11,9 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders" "github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -36,7 +34,7 @@ func resourceAttestationProvider() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ProviderID(id) + _, err := attestationproviders.ParseAttestationProvidersID(id) return err }), @@ -48,9 +46,9 @@ func resourceAttestationProvider() *pluginsdk.Resource { ValidateFunc: validate.AttestationProviderName, }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), - "location": azure.SchemaLocation(), + "location": commonschema.Location(), "policy_signing_certificate_data": { Type: pluginsdk.TypeString, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/client/client.go index 3e5bfb9e505..e002cf8f858 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/client/client.go @@ -1,8 +1,8 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/parse/provider.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/parse/provider.go deleted file mode 100644 index ecdfa22a5e0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/parse/provider.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ProviderId struct { - SubscriptionId string - ResourceGroup string - AttestationProviderName string -} - -func NewProviderID(subscriptionId, resourceGroup, attestationProviderName string) ProviderId { - return ProviderId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - AttestationProviderName: attestationProviderName, - } -} - -func (id ProviderId) String() string { - segments := []string{ - fmt.Sprintf("Attestation Provider Name %q", id.AttestationProviderName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Provider", segmentsStr) -} - -func (id ProviderId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Attestation/attestationProviders/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.AttestationProviderName) -} - -// ProviderID parses a Provider ID into an ProviderId struct -func ProviderID(input string) (*ProviderId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ProviderId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.AttestationProviderName, err = id.PopSegment("attestationProviders"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/resourceids.go deleted file mode 100644 index 576b3b17ee4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/resourceids.go +++ /dev/null @@ -1,3 +0,0 @@ -package attestation - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Provider -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Attestation/attestationProviders/provider1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/client.go deleted file mode 100644 index b9d153a570c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package attestationproviders - -import "github.com/Azure/go-autorest/autorest" - -type AttestationProvidersClient struct { - Client autorest.Client - baseUri string -} - -func NewAttestationProvidersClientWithBaseURI(endpoint string) AttestationProvidersClient { - return AttestationProvidersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/constants.go deleted file mode 100644 index a2f64c82f55..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/constants.go +++ /dev/null @@ -1,141 +0,0 @@ -package attestationproviders - -import "strings" - -type AttestationServiceStatus string - -const ( - AttestationServiceStatusError AttestationServiceStatus = "Error" - AttestationServiceStatusNotReady AttestationServiceStatus = "NotReady" - AttestationServiceStatusReady AttestationServiceStatus = "Ready" -) - -func PossibleValuesForAttestationServiceStatus() []string { - return []string{ - "Error", - "NotReady", - "Ready", - } -} - -func parseAttestationServiceStatus(input string) (*AttestationServiceStatus, error) { - vals := map[string]AttestationServiceStatus{ - "error": "Error", - "notready": "NotReady", - "ready": "Ready", - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // it could be a new value - best effort convert this - v := input - - out := AttestationServiceStatus(v) - return &out, nil -} - -type CreatedByType string - -const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" -) - -func PossibleValuesForCreatedByType() []string { - return []string{ - "Application", - "Key", - "ManagedIdentity", - "User", - } -} - -func parseCreatedByType(input string) (*CreatedByType, error) { - vals := map[string]CreatedByType{ - "application": "Application", - "key": "Key", - "managedidentity": "ManagedIdentity", - "user": "User", - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // it could be a new value - best effort convert this - v := input - - out := CreatedByType(v) - return &out, nil -} - -type PrivateEndpointConnectionProvisioningState string - -const ( - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" -) - -func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { - return []string{ - "Creating", - "Deleting", - "Failed", - "Succeeded", - } -} - -func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { - vals := map[string]PrivateEndpointConnectionProvisioningState{ - "creating": "Creating", - "deleting": "Deleting", - "failed": "Failed", - "succeeded": "Succeeded", - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // it could be a new value - best effort convert this - v := input - - out := PrivateEndpointConnectionProvisioningState(v) - return &out, nil -} - -type PrivateEndpointServiceConnectionStatus string - -const ( - PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" - PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" -) - -func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { - return []string{ - "Approved", - "Pending", - "Rejected", - } -} - -func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { - vals := map[string]PrivateEndpointServiceConnectionStatus{ - "approved": "Approved", - "pending": "Pending", - "rejected": "Rejected", - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // it could be a new value - best effort convert this - v := input - - out := PrivateEndpointServiceConnectionStatus(v) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/id_location.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/id_location.go deleted file mode 100644 index 1946e9c5801..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/id_location.go +++ /dev/null @@ -1,111 +0,0 @@ -package attestationproviders - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = LocationId{} - -// LocationId is a struct representing the Resource ID for a Location -type LocationId struct { - SubscriptionId string - Location string -} - -// NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { - return LocationId{ - SubscriptionId: subscriptionId, - Location: location, - } -} - -// ParseLocationID parses 'input' into a LocationId -func ParseLocationID(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId -// note: this method should only be used for API response data and not user input -func ParseLocationIDInsensitively(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateLocationID checks that 'input' can be parsed as a Location ID -func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseLocationID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Location ID -func (id LocationId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.Attestation/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) -} - -// Segments returns a slice of Resource ID Segments which comprise this Location ID -func (id LocationId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftAttestation", "Microsoft.Attestation", "Microsoft.Attestation"), - resourceids.StaticSegment("locations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), - } -} - -// String returns a human-readable description of this Location ID -func (id LocationId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), - } - return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/id_resourcegroup.go deleted file mode 100644 index 93fa3d5df50..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package attestationproviders - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/id_subscription.go deleted file mode 100644 index 462f3998058..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package attestationproviders - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_create_autorest.go deleted file mode 100644 index 4335f84bef4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_create_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package attestationproviders - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateResponse struct { - HttpResponse *http.Response - Model *AttestationProviders -} - -// Create ... -func (c AttestationProvidersClient) Create(ctx context.Context, id AttestationProvidersId, input AttestationServiceCreationParams) (result CreateResponse, err error) { - req, err := c.preparerForCreate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Create", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Create", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreate prepares the Create request. -func (c AttestationProvidersClient) preparerForCreate(ctx context.Context, id AttestationProvidersId, input AttestationServiceCreationParams) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreate handles the response to the Create request. The method always -// closes the http.Response Body. -func (c AttestationProvidersClient) responderForCreate(resp *http.Response) (result CreateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_delete_autorest.go deleted file mode 100644 index 6f347638178..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_delete_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package attestationproviders - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c AttestationProvidersClient) Delete(ctx context.Context, id AttestationProvidersId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c AttestationProvidersClient) preparerForDelete(ctx context.Context, id AttestationProvidersId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c AttestationProvidersClient) responderForDelete(resp *http.Response) (result DeleteResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_get_autorest.go deleted file mode 100644 index 339da9f413f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package attestationproviders - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *AttestationProviders -} - -// Get ... -func (c AttestationProvidersClient) Get(ctx context.Context, id AttestationProvidersId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c AttestationProvidersClient) preparerForGet(ctx context.Context, id AttestationProvidersId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c AttestationProvidersClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_list_autorest.go deleted file mode 100644 index 6f3d056122a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_list_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package attestationproviders - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListResponse struct { - HttpResponse *http.Response - Model *AttestationProviderListResult -} - -// List ... -func (c AttestationProvidersClient) List(ctx context.Context, id SubscriptionId) (result ListResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c AttestationProvidersClient) preparerForList(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Attestation/attestationProviders", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c AttestationProvidersClient) responderForList(resp *http.Response) (result ListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 12bc66f0a1d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package attestationproviders - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *AttestationProviderListResult -} - -// ListByResourceGroup ... -func (c AttestationProvidersClient) ListByResourceGroup(ctx context.Context, id ResourceGroupId) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c AttestationProvidersClient) preparerForListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Attestation/attestationProviders", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c AttestationProvidersClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_update_autorest.go deleted file mode 100644 index 69ad9c66edb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/method_update_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package attestationproviders - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UpdateResponse struct { - HttpResponse *http.Response - Model *AttestationProviders -} - -// Update ... -func (c AttestationProvidersClient) Update(ctx context.Context, id AttestationProvidersId, input AttestationServicePatchParams) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "attestationproviders.AttestationProvidersClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c AttestationProvidersClient) preparerForUpdate(ctx context.Context, id AttestationProvidersId, input AttestationServicePatchParams) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c AttestationProvidersClient) responderForUpdate(resp *http.Response) (result UpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_attestationproviderlistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_attestationproviderlistresult.go deleted file mode 100644 index f0c0ed4b4d2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_attestationproviderlistresult.go +++ /dev/null @@ -1,6 +0,0 @@ -package attestationproviders - -type AttestationProviderListResult struct { - SystemData *SystemData `json:"systemData,omitempty"` - Value *[]AttestationProviders `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_attestationproviders.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_attestationproviders.go deleted file mode 100644 index 166dbeaecea..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_attestationproviders.go +++ /dev/null @@ -1,11 +0,0 @@ -package attestationproviders - -type AttestationProviders struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *StatusResult `json:"properties,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_attestationservicecreationparams.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_attestationservicecreationparams.go deleted file mode 100644 index 5b4e296e487..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_attestationservicecreationparams.go +++ /dev/null @@ -1,7 +0,0 @@ -package attestationproviders - -type AttestationServiceCreationParams struct { - Location string `json:"location"` - Properties AttestationServiceCreationSpecificParams `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_attestationservicecreationspecificparams.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_attestationservicecreationspecificparams.go deleted file mode 100644 index 109a68ba3cc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_attestationservicecreationspecificparams.go +++ /dev/null @@ -1,5 +0,0 @@ -package attestationproviders - -type AttestationServiceCreationSpecificParams struct { - PolicySigningCertificates *JsonWebKeySet `json:"policySigningCertificates,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_attestationservicepatchparams.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_attestationservicepatchparams.go deleted file mode 100644 index 57b01a3bca5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_attestationservicepatchparams.go +++ /dev/null @@ -1,5 +0,0 @@ -package attestationproviders - -type AttestationServicePatchParams struct { - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_jsonwebkeyset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_jsonwebkeyset.go deleted file mode 100644 index 1b1b18bef40..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_jsonwebkeyset.go +++ /dev/null @@ -1,5 +0,0 @@ -package attestationproviders - -type JsonWebKeySet struct { - Keys *[]JsonWebKey `json:"keys,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_privateendpoint.go deleted file mode 100644 index 136858e080c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_privateendpoint.go +++ /dev/null @@ -1,5 +0,0 @@ -package attestationproviders - -type PrivateEndpoint struct { - Id *string `json:"id,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_privateendpointconnection.go deleted file mode 100644 index 6f7d31e5b69..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_privateendpointconnection.go +++ /dev/null @@ -1,8 +0,0 @@ -package attestationproviders - -type PrivateEndpointConnection struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_privateendpointconnectionproperties.go deleted file mode 100644 index 00da893663e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_privateendpointconnectionproperties.go +++ /dev/null @@ -1,7 +0,0 @@ -package attestationproviders - -type PrivateEndpointConnectionProperties struct { - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` - ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_privatelinkserviceconnectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_privatelinkserviceconnectionstate.go deleted file mode 100644 index 5164feb2b14..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_privatelinkserviceconnectionstate.go +++ /dev/null @@ -1,7 +0,0 @@ -package attestationproviders - -type PrivateLinkServiceConnectionState struct { - ActionsRequired *string `json:"actionsRequired,omitempty"` - Description *string `json:"description,omitempty"` - Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_statusresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_statusresult.go deleted file mode 100644 index 6a41b6a05ad..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_statusresult.go +++ /dev/null @@ -1,8 +0,0 @@ -package attestationproviders - -type StatusResult struct { - AttestUri *string `json:"attestUri,omitempty"` - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - Status *AttestationServiceStatus `json:"status,omitempty"` - TrustModel *string `json:"trustModel,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_systemdata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_systemdata.go deleted file mode 100644 index 74e105ed353..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/model_systemdata.go +++ /dev/null @@ -1,10 +0,0 @@ -package attestationproviders - -type SystemData struct { - CreatedAt *string `json:"createdAt,omitempty"` - CreatedBy *string `json:"createdBy,omitempty"` - CreatedByType *CreatedByType `json:"createdByType,omitempty"` - LastModifiedAt *string `json:"lastModifiedAt,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/version.go deleted file mode 100644 index 0956b89af65..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package attestationproviders - -import "fmt" - -const defaultApiVersion = "2020-10-01" - -func userAgent() string { - return fmt.Sprintf("pandora/attestationproviders/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/validate/provider_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/validate/provider_id.go deleted file mode 100644 index 4315b67e89b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/validate/provider_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/parse" -) - -func ProviderID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ProviderID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/automation_account_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/automation_account_data_source.go index e5646692b0d..6e5ef6c19e2 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/automation_account_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/automation_account_data_source.go @@ -4,9 +4,10 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -40,6 +41,22 @@ func dataSourceAutomationAccount() *pluginsdk.Resource { Type: pluginsdk.TypeString, Computed: true, }, + "private_endpoint_connection": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, }, } } @@ -47,21 +64,23 @@ func dataSourceAutomationAccount() *pluginsdk.Resource { func dataSourceAutomationAccountRead(d *pluginsdk.ResourceData, meta interface{}) error { iclient := meta.(*clients.Client).Automation.AgentRegistrationInfoClient client := meta.(*clients.Client).Automation.AccountClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewAutomationAccountID(client.SubscriptionID, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := automationaccount.NewAutomationAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retreiving %s: %+v", id, err) } d.SetId(id.ID()) - iresp, err := iclient.Get(ctx, id.ResourceGroup, id.Name) + iresp, err := iclient.Get(ctx, id.ResourceGroupName, id.AutomationAccountName) if err != nil { if utils.ResponseWasNotFound(iresp.Response) { return fmt.Errorf("%q Account Registration Information was not found", id) @@ -73,5 +92,21 @@ func dataSourceAutomationAccountRead(d *pluginsdk.ResourceData, meta interface{} d.Set("secondary_key", iresp.Keys.Secondary) } d.Set("endpoint", iresp.Endpoint) + if resp.Model != nil && resp.Model.Properties != nil { + d.Set("private_endpoint_connection", flattenPrivateEndpointConnections(resp.Model.Properties.PrivateEndpointConnections)) + } return nil } + +func flattenPrivateEndpointConnections(conns *[]automationaccount.PrivateEndpointConnection) (res []interface{}) { + if conns == nil || len(*conns) == 0 { + return + } + for _, con := range *conns { + res = append(res, map[string]interface{}{ + "id": con.Id, + "name": con.Name, + }) + } + return res +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/automation_account_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/automation_account_resource.go index 18e665f53bc..21483628e35 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/automation_account_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/automation_account_resource.go @@ -5,14 +5,18 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/automation/mgmt/2020-01-13-preview/automation" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/validate" + keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" + keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -27,7 +31,7 @@ func resourceAutomationAccount() *pluginsdk.Resource { Update: resourceAutomationAccountUpdate, Delete: resourceAutomationAccountDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.AutomationAccountID(id) + _, err := automationaccount.ParseAutomationAccountID(id) return err }), @@ -51,16 +55,50 @@ func resourceAutomationAccount() *pluginsdk.Resource { "resource_group_name": commonschema.ResourceGroupName(), "sku_name": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(automation.SkuNameEnumBasic), - string(automation.SkuNameEnumFree), - }, false), + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(automationaccount.PossibleValuesForSkuNameEnum(), false), }, "identity": commonschema.SystemAssignedUserAssignedIdentityOptional(), + "encryption": { + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*schema.Schema{ + "user_assigned_identity_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, + }, + + "key_source": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice( + automationaccount.PossibleValuesForEncryptionKeySourceType(), + false, + ), + }, + + "key_vault_key_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: keyVaultValidate.NestedItemIdWithOptionalVersion, + }, + }, + }, + }, + + "local_authentication_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + "tags": tags.Schema(), "dsc_server_endpoint": { @@ -82,6 +120,22 @@ func resourceAutomationAccount() *pluginsdk.Resource { Optional: true, Default: true, }, + "private_endpoint_connection": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, }, } } @@ -92,35 +146,51 @@ func resourceAutomationAccountCreate(d *pluginsdk.ResourceData, meta interface{} ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewAutomationAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := automationaccount.NewAutomationAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_automation_account", id.ID()) } - identity, err := expandAutomationAccountIdentity(d.Get("identity").([]interface{}), true) + identityVal, err := identity.ExpandSystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } - parameters := automation.AccountCreateOrUpdateParameters{ - AccountCreateOrUpdateProperties: &automation.AccountCreateOrUpdateProperties{ - Sku: &automation.Sku{ - Name: automation.SkuNameEnum(d.Get("sku_name").(string)), + parameters := automationaccount.AutomationAccountCreateOrUpdateParameters{ + Properties: &automationaccount.AutomationAccountCreateOrUpdateProperties{ + Sku: &automationaccount.Sku{ + Name: automationaccount.SkuNameEnum(d.Get("sku_name").(string)), }, PublicNetworkAccess: utils.Bool(d.Get("public_network_access_enabled").(bool)), }, Location: utils.String(location.Normalize(d.Get("location").(string))), - Identity: identity, - Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, parameters); err != nil { + if localAuth := d.Get("local_authentication_enabled").(bool); localAuth == false { + parameters.Properties.DisableLocalAuth = utils.Bool(true) + } + if encryption := d.Get("encryption").([]interface{}); len(encryption) > 0 { + enc, err := expandEncryption(encryption[0].(map[string]interface{})) + if err != nil { + return fmt.Errorf("expanding `encryption`: %v", err) + } + parameters.Properties.Encryption = enc + } + // for create account do not set identity property (even TypeNone is not allowed), or api will response error + if identityVal.Type != identity.TypeNone { + parameters.Identity = identityVal + } + if tagsVal := expandTags(d.Get("tags").(map[string]interface{})); tagsVal != nil { + parameters.Tags = &tagsVal + } + + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -133,27 +203,42 @@ func resourceAutomationAccountUpdate(d *pluginsdk.ResourceData, meta interface{} ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AutomationAccountID(d.Id()) + id, err := automationaccount.ParseAutomationAccountID(d.Id()) if err != nil { return err } - identity, err := expandAutomationAccountIdentity(d.Get("identity").([]interface{}), false) + identity, err := identity.ExpandSystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } - parameters := automation.AccountUpdateParameters{ - AccountUpdateProperties: &automation.AccountUpdateProperties{ - Sku: &automation.Sku{ - Name: automation.SkuNameEnum(d.Get("sku_name").(string)), + parameters := automationaccount.AutomationAccountUpdateParameters{ + Properties: &automationaccount.AutomationAccountUpdateProperties{ + Sku: &automationaccount.Sku{ + Name: automationaccount.SkuNameEnum(d.Get("sku_name").(string)), }, PublicNetworkAccess: utils.Bool(d.Get("public_network_access_enabled").(bool)), }, Location: utils.String(location.Normalize(d.Get("location").(string))), Identity: identity, - Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - if _, err := client.Update(ctx, id.ResourceGroup, id.Name, parameters); err != nil { + if localAuth := d.Get("local_authentication_enabled").(bool); localAuth == false { + parameters.Properties.DisableLocalAuth = utils.Bool(true) + } + + if encryption := d.Get("encryption").([]interface{}); len(encryption) > 0 { + enc, err := expandEncryption(encryption[0].(map[string]interface{})) + if err != nil { + return fmt.Errorf("expanding `encryption`: %v", err) + } + parameters.Properties.Encryption = enc + } + + if tagsVal := expandTags(d.Get("tags").(map[string]interface{})); tagsVal != nil { + parameters.Tags = &tagsVal + } + + if _, err := client.Update(ctx, *id, parameters); err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } @@ -166,14 +251,14 @@ func resourceAutomationAccountRead(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AutomationAccountID(d.Id()) + id, err := automationaccount.ParseAutomationAccountID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -182,9 +267,9 @@ func resourceAutomationAccountRead(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("retrieving %s: %+v", *id, err) } - keysResp, err := registrationClient.Get(ctx, id.ResourceGroup, id.Name) + keysResp, err := registrationClient.Get(ctx, id.ResourceGroupName, id.AutomationAccountName) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] Agent Registration Info for %s was not found - removing from state!", *id) d.SetId("") return nil @@ -193,27 +278,42 @@ func resourceAutomationAccountRead(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("retrieving Registration Info for %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.AutomationAccountName) + d.Set("resource_group_name", id.ResourceGroupName) + + d.Set("location", location.NormalizeNilable(resp.Model.Location)) publicNetworkAccessEnabled := true - if resp.PublicNetworkAccess != nil { - publicNetworkAccessEnabled = *resp.PublicNetworkAccess + if resp.Model == nil || resp.Model.Properties == nil { + return fmt.Errorf("retrieving Automation Account got empty Model") + } + prop := resp.Model.Properties + if prop.PublicNetworkAccess != nil { + publicNetworkAccessEnabled = *prop.PublicNetworkAccess } d.Set("public_network_access_enabled", publicNetworkAccessEnabled) skuName := "" - if sku := resp.Sku; sku != nil { - skuName = string(resp.Sku.Name) + if sku := prop.Sku; sku != nil { + skuName = string(prop.Sku.Name) } d.Set("sku_name", skuName) + localAuthEnabled := true + if val := prop.DisableLocalAuth; val != nil && *val == true { + localAuthEnabled = false + } + d.Set("local_authentication_enabled", localAuthEnabled) + + if err := d.Set("encryption", flattenEncryption(prop.Encryption)); err != nil { + return fmt.Errorf("setting `encryption`: %+v", err) + } + d.Set("dsc_server_endpoint", keysResp.Endpoint) if keys := keysResp.Keys; keys != nil { d.Set("dsc_primary_access_key", keys.Primary) d.Set("dsc_secondary_access_key", keys.Secondary) } - identity, err := flattenAutomationAccountIdentity(resp.Identity) + identity, err := identity.FlattenSystemAndUserAssignedMap(resp.Model.Identity) if err != nil { return fmt.Errorf("flattening `identity`: %+v", err) } @@ -221,7 +321,14 @@ func resourceAutomationAccountRead(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("setting `identity`: %+v", err) } - return tags.FlattenAndSet(d, resp.Tags) + if resp.Model != nil && resp.Model.Properties != nil { + d.Set("private_endpoint_connection", flattenPrivateEndpointConnections(resp.Model.Properties.PrivateEndpointConnections)) + } + + if resp.Model.Tags != nil { + return flattenAndSetTags(d, *resp.Model.Tags) + } + return nil } func resourceAutomationAccountDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -229,14 +336,14 @@ func resourceAutomationAccountDelete(d *pluginsdk.ResourceData, meta interface{} ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AutomationAccountID(d.Id()) + id, err := automationaccount.ParseAutomationAccountID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.Name) + resp, err := client.Delete(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp) { + if response.WasNotFound(resp.HttpResponse) { return nil } @@ -246,57 +353,50 @@ func resourceAutomationAccountDelete(d *pluginsdk.ResourceData, meta interface{} return nil } -func expandAutomationAccountIdentity(input []interface{}, newResource bool) (*automation.Identity, error) { - expanded, err := identity.ExpandSystemAndUserAssignedMap(input) - if err != nil { - return nil, err +func expandEncryption(encMap map[string]interface{}) (*automationaccount.EncryptionProperties, error) { + var id interface{} + id, ok := encMap["user_assigned_identity_id"].(string) + if !ok { + return nil, fmt.Errorf("read encryption user identity id error") } - - if newResource && expanded.Type == identity.TypeNone { - return nil, nil + prop := &automationaccount.EncryptionProperties{ + Identity: &automationaccount.EncryptionPropertiesIdentity{ + UserAssignedIdentity: &id, + }, } - - out := automation.Identity{ - Type: automation.ResourceIdentityType(string(expanded.Type)), + if val, ok := encMap["key_source"].(string); ok && val != "" { + prop.KeySource = (*automationaccount.EncryptionKeySourceType)(&val) } - - if len(expanded.IdentityIds) > 0 { - ids := make(map[string]*automation.IdentityUserAssignedIdentitiesValue) - - for k := range expanded.IdentityIds { - ids[k] = &automation.IdentityUserAssignedIdentitiesValue{ - // intentionally empty - } + if keyIdStr := encMap["key_vault_key_id"].(string); keyIdStr != "" { + keyId, err := keyVaultParse.ParseOptionallyVersionedNestedItemID(keyIdStr) + if err != nil { + return nil, err + } + prop.KeyVaultProperties = &automationaccount.KeyVaultProperties{ + KeyName: utils.String(keyId.Name), + KeyVersion: utils.String(keyId.Version), + KeyvaultUri: utils.String(keyId.KeyVaultBaseUrl), } - - out.UserAssignedIdentities = ids } - - return &out, nil + return prop, nil } -func flattenAutomationAccountIdentity(input *automation.Identity) (*[]interface{}, error) { - var transformed *identity.SystemAndUserAssignedMap - if input != nil { - transformed = &identity.SystemAndUserAssignedMap{ - Type: identity.Type(string(input.Type)), - IdentityIds: make(map[string]identity.UserAssignedIdentityDetails), - } - if input.PrincipalID != nil { - transformed.PrincipalId = *input.PrincipalID - } - if input.TenantID != nil { - transformed.TenantId = *input.TenantID - } - if input.UserAssignedIdentities != nil { - for k, v := range input.UserAssignedIdentities { - transformed.IdentityIds[k] = identity.UserAssignedIdentityDetails{ - ClientId: v.ClientID, - PrincipalId: v.PrincipalID, - } - } +func flattenEncryption(encryption *automationaccount.EncryptionProperties) (res []interface{}) { + if encryption == nil { + return + } + item := map[string]interface{}{} + if encryption.KeySource != nil { + item["key_source"] = (string)(*encryption.KeySource) + } + if encryption.Identity != nil && encryption.Identity.UserAssignedIdentity != nil { + item["user_assigned_identity_id"] = (*encryption.Identity.UserAssignedIdentity).(string) + } + if keyProp := encryption.KeyVaultProperties; keyProp != nil { + keyVaultKeyId, err := keyVaultParse.NewNestedItemID(*keyProp.KeyvaultUri, "keys", *keyProp.KeyName, *keyProp.KeyVersion) + if err == nil { + item["key_vault_key_id"] = keyVaultKeyId.ID() } } - - return identity.FlattenSystemAndUserAssignedMap(transformed) + return []interface{}{item} } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/client/client.go index ab9d59911c7..152ed6a1d3c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/client/client.go @@ -2,11 +2,12 @@ package client import ( "github.com/Azure/azure-sdk-for-go/services/preview/automation/mgmt/2020-01-13-preview/automation" + "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - AccountClient *automation.AccountClient + AccountClient *automationaccount.AutomationAccountClient AgentRegistrationInfoClient *automation.AgentRegistrationInformationClient CertificateClient *automation.CertificateClient ConnectionClient *automation.ConnectionClient @@ -24,7 +25,7 @@ type Client struct { } func NewClient(o *common.ClientOptions) *Client { - accountClient := automation.NewAccountClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + accountClient := automationaccount.NewAutomationAccountClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&accountClient.Client, o.ResourceManagerAuthorizer) agentRegistrationInfoClient := automation.NewAgentRegistrationInformationClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/transition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/transition.go new file mode 100644 index 00000000000..abffe49b903 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/transition.go @@ -0,0 +1,50 @@ +package automation + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +func tagValueToString(v interface{}) (string, error) { + switch value := v.(type) { + case string: + return value, nil + case int: + return fmt.Sprintf("%d", value), nil + default: + return "", fmt.Errorf("unknown tag type %T in tag value", value) + } +} + +func expandTags(tagsMap map[string]interface{}) map[string]string { + output := make(map[string]string, len(tagsMap)) + + for i, v := range tagsMap { + // Validate should have ignored this error already + value, _ := tagValueToString(v) + output[i] = value + } + + return output +} + +func flattenTags(tagMap map[string]string) map[string]interface{} { + // If tagsMap is nil, len(tagsMap) will be 0. + output := make(map[string]interface{}, len(tagMap)) + + for i, v := range tagMap { + output[i] = v + } + + return output +} + +func flattenAndSetTags(d *pluginsdk.ResourceData, tagMap map[string]string) error { + flattened := flattenTags(tagMap) + if err := d.Set("tags", flattened); err != nil { + return fmt.Errorf("setting `tags`: %s", err) + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/client/client.go index bc7f4e1d232..6499bc61533 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/client/client.go @@ -1,16 +1,16 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci" + "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - ClusterClient *azurestackhci.ClustersClient + ClusterClient *clusters.ClustersClient } func NewClient(o *common.ClientOptions) *Client { - clusterClient := azurestackhci.NewClustersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + clusterClient := clusters.NewClustersClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&clusterClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/parse/cluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/parse/cluster.go deleted file mode 100644 index 832b548f6e1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/parse/cluster.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ClusterId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewClusterID(subscriptionId, resourceGroup, name string) ClusterId { - return ClusterId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ClusterId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Cluster", segmentsStr) -} - -func (id ClusterId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AzureStackHCI/clusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ClusterID parses a Cluster ID into an ClusterId struct -func ClusterID(input string) (*ClusterId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ClusterId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("clusters"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/resourceids.go deleted file mode 100644 index ec451ad1ecc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/resourceids.go +++ /dev/null @@ -1,3 +0,0 @@ -package azurestackhci - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Cluster -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AzureStackHCI/clusters/cluster1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/stack_hci_cluster_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/stack_hci_cluster_resource.go index 9d98280fbf3..7b93ebabafa 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/stack_hci_cluster_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/stack_hci_cluster_resource.go @@ -5,18 +5,17 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceArmStackHCICluster() *pluginsdk.Resource { @@ -34,7 +33,7 @@ func resourceArmStackHCICluster() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ClusterID(id) + _, err := clusters.ParseClusterID(id) return err }), @@ -46,9 +45,9 @@ func resourceArmStackHCICluster() *pluginsdk.Resource { ValidateFunc: validate.ClusterName, }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), - "location": azure.SchemaLocation(), + "location": commonschema.Location(), "client_id": { Type: pluginsdk.TypeString, @@ -65,7 +64,7 @@ func resourceArmStackHCICluster() *pluginsdk.Resource { ValidateFunc: validation.IsUUID, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -73,42 +72,38 @@ func resourceArmStackHCICluster() *pluginsdk.Resource { func resourceArmStackHCIClusterCreate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).AzureStackHCI.ClusterClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId - tenantId := meta.(*clients.Client).Account.TenantId ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - resourceGroup := d.Get("resource_group_name").(string) - - id := parse.NewClusterID(subscriptionId, resourceGroup, name) - - existing, err := client.Get(ctx, resourceGroup, name) + id := clusters.NewClusterID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for present of existing Azure Stack HCI Cluster %q (Resource Group %q): %+v", name, resourceGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_stack_hci_cluster", id.ID()) } - cluster := azurestackhci.Cluster{ - Location: utils.String(location.Normalize(d.Get("location").(string))), - ClusterProperties: &azurestackhci.ClusterProperties{ - AadClientID: utils.String(d.Get("client_id").(string)), + cluster := clusters.Cluster{ + Location: location.Normalize(d.Get("location").(string)), + Properties: &clusters.ClusterProperties{ + AadClientId: d.Get("client_id").(string), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } if v, ok := d.GetOk("tenant_id"); ok { - cluster.ClusterProperties.AadTenantID = utils.String(v.(string)) + cluster.Properties.AadTenantId = v.(string) } else { - cluster.ClusterProperties.AadTenantID = utils.String(tenantId) + tenantId := meta.(*clients.Client).Account.TenantId + cluster.Properties.AadTenantId = tenantId } - if _, err := client.Create(ctx, resourceGroup, name, cluster); err != nil { - return fmt.Errorf("creating Azure Stack HCI Cluster %q (Resource Group %q): %+v", name, resourceGroup, err) + if _, err := client.Create(ctx, id, cluster); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } d.SetId(id.ID()) @@ -121,32 +116,39 @@ func resourceArmStackHCIClusterRead(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ClusterID(d.Id()) + id, err := clusters.ParseClusterID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] Azure Stack HCI Cluster %q does not exist - removing from state", d.Id()) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Azure Stack HCI Cluster %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.ClusterName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + + if props := model.Properties; props != nil { + d.Set("client_id", props.AadClientId) + d.Set("tenant_id", props.AadTenantId) + } - if props := resp.ClusterProperties; props != nil { - d.Set("client_id", props.AadClientID) - d.Set("tenant_id", props.AadTenantID) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceArmStackHCIClusterUpdate(d *pluginsdk.ResourceData, meta interface{}) error { @@ -154,19 +156,19 @@ func resourceArmStackHCIClusterUpdate(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ClusterID(d.Id()) + id, err := clusters.ParseClusterID(d.Id()) if err != nil { return err } - cluster := azurestackhci.ClusterUpdate{} + cluster := clusters.ClusterUpdate{} if d.HasChange("tags") { cluster.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) } - if _, err := client.Update(ctx, id.ResourceGroup, id.Name, cluster); err != nil { - return fmt.Errorf("updating Azure Stack HCI Cluster %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if _, err := client.Update(ctx, *id, cluster); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } return resourceArmStackHCIClusterRead(d, meta) @@ -177,13 +179,13 @@ func resourceArmStackHCIClusterDelete(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ClusterID(d.Id()) + id, err := clusters.ParseClusterID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.Name); err != nil { - return fmt.Errorf("deleting Azure Stack HCI Cluster %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/validate/cluster_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/validate/cluster_id.go deleted file mode 100644 index 2ae99483186..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/validate/cluster_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/parse" -) - -func ClusterID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ClusterID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_account_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_account_resource.go index 8837d0c5810..e2d2df2a78b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_account_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_account_resource.go @@ -3,10 +3,12 @@ package batch import ( "fmt" "log" + "strings" "time" "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" @@ -15,6 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" + storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -56,8 +59,39 @@ func resourceBatchAccount() *pluginsdk.Resource { "storage_account_id": { Type: pluginsdk.TypeString, Optional: true, - Computed: true, - ValidateFunc: azure.ValidateResourceIDOrEmpty, + ValidateFunc: storageValidate.StorageAccountID, + RequiredWith: []string{"storage_account_authentication_mode"}, + }, + + "storage_account_authentication_mode": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(batch.AutoStorageAuthenticationModeStorageKeys), + string(batch.AutoStorageAuthenticationModeBatchAccountManagedIdentity), + }, false), + RequiredWith: []string{"storage_account_id"}, + }, + + "storage_account_node_identity": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, + RequiredWith: []string{"storage_account_id"}, + }, + + "allowed_authentication_modes": { + Type: pluginsdk.TypeSet, + Optional: true, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + string(batch.AuthenticationModeSharedKey), + string(batch.AuthenticationModeAAD), + string(batch.AuthenticationModeTaskAuthenticationToken), + }, false), + }, }, "pool_allocation_mode": { @@ -174,9 +208,10 @@ func resourceBatchAccountCreate(d *pluginsdk.ResourceData, meta interface{}) err parameters := batch.AccountCreateParameters{ Location: &location, AccountCreateProperties: &batch.AccountCreateProperties{ - PoolAllocationMode: batch.PoolAllocationMode(poolAllocationMode), - PublicNetworkAccess: batch.PublicNetworkAccessTypeEnabled, - Encryption: encryption, + PoolAllocationMode: batch.PoolAllocationMode(poolAllocationMode), + PublicNetworkAccess: batch.PublicNetworkAccessTypeEnabled, + Encryption: encryption, + AllowedAuthenticationModes: expandAllowedAuthenticationModes(d.Get("allowed_authentication_modes").(*pluginsdk.Set).List()), }, Identity: identity, Tags: tags.Expand(t), @@ -199,11 +234,37 @@ func resourceBatchAccountCreate(d *pluginsdk.ResourceData, meta interface{}) err } parameters.KeyVaultReference = keyVaultReference + + if v, ok := d.GetOk("allowed_authentication_modes"); ok { + authModes := v.(*pluginsdk.Set).List() + for _, mode := range authModes { + if batch.AuthenticationMode(mode.(string)) == batch.AuthenticationModeSharedKey { + return fmt.Errorf("creating %s: When setting pool allocation mode to UserSubscription, `allowed_authentication_modes=[StorageKeys]` is not allowed. ", id) + } + } + } + } + + authMode := d.Get("storage_account_authentication_mode").(string) + if batch.AutoStorageAuthenticationMode(authMode) == batch.AutoStorageAuthenticationModeBatchAccountManagedIdentity && + identity.Type == batch.ResourceIdentityTypeNone { + return fmt.Errorf(" storage_account_authentication_mode=`BatchAccountManagedIdentity` can only be set when identity.type is `SystemAssigned` or `UserAssigned`") } if storageAccountId != "" { + if authMode == "" { + return fmt.Errorf("`storage_account_authentication_mode` is required when `storage_account_id` ") + } parameters.AccountCreateProperties.AutoStorage = &batch.AutoStorageBaseProperties{ - StorageAccountID: &storageAccountId, + StorageAccountID: &storageAccountId, + AuthenticationMode: batch.AutoStorageAuthenticationMode(authMode), + } + } + + nodeIdentity := d.Get("storage_account_node_identity").(string) + if nodeIdentity != "" { + parameters.AccountCreateProperties.AutoStorage.NodeIdentityReference = &batch.ComputeNodeIdentityReference{ + ResourceID: utils.String(nodeIdentity), } } @@ -259,7 +320,15 @@ func resourceBatchAccountRead(d *pluginsdk.ResourceData, meta interface{}) error if props := resp.AccountProperties; props != nil { d.Set("account_endpoint", props.AccountEndpoint) if autoStorage := props.AutoStorage; autoStorage != nil { - d.Set("storage_account_id", autoStorage.StorageAccountID) + d.Set("storage_account_id", *autoStorage.StorageAccountID) + d.Set("storage_account_authentication_mode", autoStorage.AuthenticationMode) + + if autoStorage.NodeIdentityReference != nil { + d.Set("storage_account_node_identity", autoStorage.NodeIdentityReference.ResourceID) + } + } else { + d.Set("storage_account_authentication_mode", "") + d.Set("storage_account_id", "") } if props.PublicNetworkAccess != "" { @@ -271,9 +340,14 @@ func resourceBatchAccountRead(d *pluginsdk.ResourceData, meta interface{}) error if err := d.Set("encryption", flattenEncryption(props.Encryption)); err != nil { return fmt.Errorf("setting `encryption`: %+v", err) } + + if err := d.Set("allowed_authentication_modes", flattenAllowedAuthenticationModes(props.AllowedAuthenticationModes)); err != nil { + return fmt.Errorf("setting `allowed_authentication_modes`: %+v", err) + } } - if d.Get("pool_allocation_mode").(string) == string(batch.PoolAllocationModeBatchService) { + if d.Get("pool_allocation_mode").(string) == string(batch.PoolAllocationModeBatchService) && + isShardKeyAllowed(d.Get("allowed_authentication_modes").(*pluginsdk.Set).List()) { keys, err := client.GetKeys(ctx, id.ResourceGroup, id.BatchAccountName) if err != nil { return fmt.Errorf("Cannot read keys for Batch account %q (resource group %q): %v", id.BatchAccountName, id.ResourceGroup, err) @@ -298,7 +372,6 @@ func resourceBatchAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) err return err } - storageAccountId := d.Get("storage_account_id").(string) t := d.Get("tags").(map[string]interface{}) identity, err := expandBatchAccountIdentity(d.Get("identity").([]interface{})) @@ -311,15 +384,56 @@ func resourceBatchAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) err parameters := batch.AccountUpdateParameters{ AccountUpdateProperties: &batch.AccountUpdateProperties{ - AutoStorage: &batch.AutoStorageBaseProperties{ - StorageAccountID: &storageAccountId, - }, Encryption: encryption, }, Identity: identity, Tags: tags.Expand(t), } + if d.HasChange("allowed_authentication_modes") { + allowedAuthModes := d.Get("allowed_authentication_modes").(*pluginsdk.Set).List() + if len(allowedAuthModes) == 0 { + parameters.AllowedAuthenticationModes = &[]batch.AuthenticationMode{} // remove all modes need explicit set it to empty array not nil + } else { + parameters.AllowedAuthenticationModes = expandAllowedAuthenticationModes(d.Get("allowed_authentication_modes").(*pluginsdk.Set).List()) + } + + } + + if d.HasChange("storage_account_id") { + if v, ok := d.GetOk("storage_account_id"); ok { + parameters.AccountUpdateProperties.AutoStorage = &batch.AutoStorageBaseProperties{ + StorageAccountID: utils.String(v.(string)), + } + } else { + // remove the storage account from the batch account + parameters.AccountUpdateProperties.AutoStorage = &batch.AutoStorageBaseProperties{ + StorageAccountID: nil, + } + } + } + + authMode := d.Get("storage_account_authentication_mode").(string) + if batch.AutoStorageAuthenticationMode(authMode) == batch.AutoStorageAuthenticationModeBatchAccountManagedIdentity && + identity.Type == batch.ResourceIdentityTypeNone { + return fmt.Errorf(" storage_account_authentication_mode=`BatchAccountManagedIdentity` can only be set when identity.type is `SystemAssigned` or `UserAssigned`") + } + + storageAccountId := d.Get("storage_account_id").(string) + if storageAccountId != "" { + parameters.AutoStorage = &batch.AutoStorageBaseProperties{ + StorageAccountID: &storageAccountId, + AuthenticationMode: batch.AutoStorageAuthenticationMode(authMode), + } + } + + nodeIdentity := d.Get("storage_account_node_identity").(string) + if nodeIdentity != "" { + parameters.AutoStorage.NodeIdentityReference = &batch.ComputeNodeIdentityReference{ + ResourceID: utils.String(nodeIdentity), + } + } + if _, err = client.Update(ctx, id.ResourceGroup, id.BatchAccountName, parameters); err != nil { return fmt.Errorf("updating Batch account %q (Resource Group %q): %+v", id.BatchAccountName, id.ResourceGroup, err) } @@ -419,6 +533,30 @@ func expandEncryption(e []interface{}) *batch.EncryptionProperties { return &encryptionProperty } +func expandAllowedAuthenticationModes(input []interface{}) *[]batch.AuthenticationMode { + if len(input) == 0 { + return nil + } + + allowedAuthModes := make([]batch.AuthenticationMode, 0) + for _, mode := range input { + allowedAuthModes = append(allowedAuthModes, batch.AuthenticationMode(mode.(string))) + } + return &allowedAuthModes +} + +func flattenAllowedAuthenticationModes(input *[]batch.AuthenticationMode) []string { + if input == nil || len(*input) == 0 { + return []string{} + } + + allowedAuthModes := make([]string, 0) + for _, mode := range *input { + allowedAuthModes = append(allowedAuthModes, string(mode)) + } + return allowedAuthModes +} + func flattenEncryption(encryptionProperties *batch.EncryptionProperties) []interface{} { if encryptionProperties == nil || encryptionProperties.KeySource == batch.KeySourceMicrosoftBatch { return []interface{}{} @@ -430,3 +568,15 @@ func flattenEncryption(encryptionProperties *batch.EncryptionProperties) []inter }, } } + +func isShardKeyAllowed(input []interface{}) bool { + if len(input) == 0 { + return false + } + for _, authMod := range input { + if strings.EqualFold(authMod.(string), string(batch.AuthenticationModeSharedKey)) { + return true + } + } + return false +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_pool.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_pool.go index 85faf6ee25e..f4b9784d597 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_pool.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_pool.go @@ -7,6 +7,7 @@ import ( "strings" "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -252,15 +253,13 @@ func flattenBatchPoolContainerRegistry(d *pluginsdk.ResourceData, armContainerRe } if userName := armContainerRegistry.UserName; userName != nil { result["user_name"] = *userName + // Locate the password only if user_name is defined + result["password"] = findBatchPoolContainerRegistryPassword(d, result["registry_server"].(string), result["user_name"].(string)) } - - // If we didn't specify a registry server and user name, just return what we have now rather than trying to locate the password - if len(result) != 2 { - return result + if identity := armContainerRegistry.IdentityReference; identity != nil { + result["user_assigned_identity_id"] = identity.ResourceID } - result["password"] = findBatchPoolContainerRegistryPassword(d, result["registry_server"].(string), result["user_name"].(string)) - return result } @@ -363,11 +362,23 @@ func expandBatchPoolContainerRegistry(ref map[string]interface{}) (*batch.Contai return nil, fmt.Errorf("Error: container registry reference should be defined") } - containerRegistry := batch.ContainerRegistry{ - RegistryServer: utils.String(ref["registry_server"].(string)), - UserName: utils.String(ref["user_name"].(string)), - Password: utils.String(ref["password"].(string)), + containerRegistry := batch.ContainerRegistry{} + + if v := ref["registry_server"]; v != nil && v != "" { + containerRegistry.RegistryServer = pointer.FromString(v.(string)) + } + if v := ref["user_name"]; v != nil && v != "" { + containerRegistry.UserName = pointer.FromString(v.(string)) } + if v := ref["password"]; v != nil && v != "" { + containerRegistry.Password = pointer.FromString(v.(string)) + } + if v := ref["user_assigned_identity_id"]; v != nil && v != "" { + containerRegistry.IdentityReference = &batch.ComputeNodeIdentityReference{ + ResourceID: pointer.FromString(v.(string)), + } + } + return &containerRegistry, nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_pool_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_pool_data_source.go index 35f859e26c0..a72e7eba485 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_pool_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_pool_data_source.go @@ -144,6 +144,10 @@ func dataSourceBatchPool() *pluginsdk.Resource { Type: pluginsdk.TypeString, Computed: true, }, + "user_assigned_identity_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, "user_name": { Type: pluginsdk.TypeString, Computed: true, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_pool_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_pool_resource.go index 3094dabea01..fe71ed78677 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_pool_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/batch_pool_resource.go @@ -10,6 +10,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" @@ -159,15 +160,22 @@ func resourceBatchPool() *pluginsdk.Resource { ForceNew: true, ValidateFunc: validation.StringIsNotEmpty, }, + "user_assigned_identity_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, + Description: "The User Assigned Identity to use for Container Registry access.", + }, "user_name": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, ForceNew: true, ValidateFunc: validation.StringIsNotEmpty, }, "password": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, ForceNew: true, Sensitive: true, ValidateFunc: validation.StringIsNotEmpty, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/blueprints/blueprint_definition_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/blueprints/blueprint_definition_data_source.go index e8285ed16c8..d76986f3bbb 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/blueprints/blueprint_definition_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/blueprints/blueprint_definition_data_source.go @@ -77,6 +77,7 @@ func dataSourceBlueprintDefinition() *pluginsdk.Resource { func dataSourceBlueprintDefinitionRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Blueprints.BlueprintsClient + publishedClient := meta.(*clients.Client).Blueprints.PublishedBlueprintsClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -112,9 +113,20 @@ func dataSourceBlueprintDefinitionRead(d *pluginsdk.ResourceData, meta interface d.Set("target_scope", resp.TargetScope) - if resp.Versions != nil { - d.Set("versions", resp.Versions) + versionList := make([]string, 0) + versions, err := publishedClient.List(ctx, scope, name) + if err != nil { + return fmt.Errorf("listing blue print versions for %s error: %+v", *resp.ID, err) } + for _, version := range versions.Values() { + if version.PublishedBlueprintProperties == nil || version.Name == nil { + continue + } + versionList = append(versionList, *version.Name) + } + + d.Set("versions", versionList) + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/bot_channels_registration_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/bot_channels_registration_resource.go index 58c7c054ae2..2b7a77d94ff 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/bot_channels_registration_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/bot_channels_registration_resource.go @@ -146,6 +146,12 @@ func resourceBotChannelsRegistration() *pluginsdk.Resource { ValidateFunc: validate.BotChannelRegistrationIconUrl, }, + "streaming_endpoint_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + "public_network_access_enabled": { Type: pluginsdk.TypeBool, Optional: true, @@ -211,6 +217,7 @@ func resourceBotChannelsRegistrationCreate(d *pluginsdk.ResourceData, meta inter DeveloperAppInsightsApplicationID: utils.String(d.Get("developer_app_insights_application_id").(string)), IconURL: utils.String(d.Get("icon_url").(string)), IsCmekEnabled: utils.Bool(false), + IsStreamingSupported: utils.Bool(d.Get("streaming_endpoint_enabled").(bool)), }, Location: utils.String(d.Get("location").(string)), Sku: &botservice.Sku{ @@ -287,6 +294,7 @@ func resourceBotChannelsRegistrationRead(d *pluginsdk.ResourceData, meta interfa d.Set("developer_app_insights_key", props.DeveloperAppInsightKey) d.Set("developer_app_insights_application_id", props.DeveloperAppInsightsApplicationID) d.Set("icon_url", props.IconURL) + d.Set("streaming_endpoint_enabled", props.IsStreamingSupported) // `PublicNetworkAccess` is empty string when `public_network_access_enabled` or `isolated_network_enabled` isn't specified. So `public_network_access_enabled` and `isolated_network_enabled` shouldn't be set at this time to avoid diff if props.PublicNetworkAccess != "" { @@ -329,6 +337,7 @@ func resourceBotChannelsRegistrationUpdate(d *pluginsdk.ResourceData, meta inter DeveloperAppInsightsApplicationID: utils.String(d.Get("developer_app_insights_application_id").(string)), IconURL: utils.String(d.Get("icon_url").(string)), IsCmekEnabled: utils.Bool(false), + IsStreamingSupported: utils.Bool(d.Get("streaming_endpoint_enabled").(bool)), }, Location: utils.String(d.Get("location").(string)), Sku: &botservice.Sku{ diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/bot_service_base_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/bot_service_base_resource.go index 73c14c5eb56..1ad13f33532 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/bot_service_base_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/bot/bot_service_base_resource.go @@ -6,6 +6,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" @@ -78,6 +79,31 @@ func (br botBaseResource) arguments(fields map[string]*pluginsdk.Schema) map[str ValidateFunc: validation.IsUUID, }, + "microsoft_app_msi_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, + }, + + "microsoft_app_tenant_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IsUUID, + }, + + "microsoft_app_type": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(botservice.MsaAppTypeMultiTenant), + string(botservice.MsaAppTypeSingleTenant), + string(botservice.MsaAppTypeUserAssignedMSI), + }, false), + }, + "luis_app_ids": { Type: pluginsdk.TypeList, Optional: true, @@ -94,6 +120,12 @@ func (br botBaseResource) arguments(fields map[string]*pluginsdk.Schema) map[str ValidateFunc: validation.StringIsNotEmpty, }, + "streaming_endpoint_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + "tags": tags.Schema(), } @@ -147,10 +179,23 @@ func (br botBaseResource) createFunc(resourceName, botKind string) sdk.ResourceF DeveloperAppInsightsApplicationID: utils.String(metadata.ResourceData.Get("developer_app_insights_application_id").(string)), LuisAppIds: utils.ExpandStringSlice(metadata.ResourceData.Get("luis_app_ids").([]interface{})), LuisKey: utils.String(metadata.ResourceData.Get("luis_key").(string)), + IsStreamingSupported: utils.Bool(metadata.ResourceData.Get("streaming_endpoint_enabled").(bool)), }, Tags: tags.Expand(metadata.ResourceData.Get("tags").(map[string]interface{})), } + if v, ok := metadata.ResourceData.GetOk("microsoft_app_type"); ok { + props.Properties.MsaAppType = botservice.MsaAppType(v.(string)) + } + + if v, ok := metadata.ResourceData.GetOk("microsoft_app_tenant_id"); ok { + props.Properties.MsaAppTenantID = utils.String(v.(string)) + } + + if v, ok := metadata.ResourceData.GetOk("microsoft_app_msi_id"); ok { + props.Properties.MsaAppMSIResourceID = utils.String(v.(string)) + } + if _, err := client.Create(ctx, id.ResourceGroup, id.Name, props); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -229,11 +274,35 @@ func (br botBaseResource) readFunc() sdk.ResourceFunc { } metadata.ResourceData.Set("developer_app_insights_application_id", appInsightsId) + msaAppType := "" + if v := props.MsaAppType; v != "" { + msaAppType = string(v) + } + metadata.ResourceData.Set("microsoft_app_type", msaAppType) + + msaAppTenantId := "" + if v := props.MsaAppTenantID; v != nil { + msaAppTenantId = *v + } + metadata.ResourceData.Set("microsoft_app_tenant_id", msaAppTenantId) + + msaAppMSIId := "" + if v := props.MsaAppMSIResourceID; v != nil { + msaAppMSIId = *v + } + metadata.ResourceData.Set("microsoft_app_msi_id", msaAppMSIId) + var luisAppIds []string if v := props.LuisAppIds; v != nil { luisAppIds = *v } metadata.ResourceData.Set("luis_app_ids", utils.FlattenStringSlice(&luisAppIds)) + + streamingEndpointEnabled := false + if v := props.IsStreamingSupported; v != nil { + streamingEndpointEnabled = *v + } + metadata.ResourceData.Set("streaming_endpoint_enabled", streamingEndpointEnabled) } return nil @@ -303,6 +372,10 @@ func (br botBaseResource) updateFunc() sdk.ResourceFunc { existing.Properties.LuisKey = utils.String(metadata.ResourceData.Get("luis_key").(string)) } + if metadata.ResourceData.HasChange("streaming_endpoint_enabled") { + existing.Properties.IsStreamingSupported = utils.Bool(metadata.ResourceData.Get("streaming_endpoint_enabled").(bool)) + } + if _, err := client.Update(ctx, id.ResourceGroup, id.Name, existing); err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_endpoint_custom_domain_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_endpoint_custom_domain_resource.go index 72a4d2a7747..3dc453544d5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_endpoint_custom_domain_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_endpoint_custom_domain_resource.go @@ -9,6 +9,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" keyvaultClient "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/client" @@ -21,6 +22,112 @@ import ( ) func resourceArmCdnEndpointCustomDomain() *pluginsdk.Resource { + schema := map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.CdnEndpointCustomDomainName(), + }, + + "cdn_endpoint_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.EndpointID, + }, + + "host_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "cdn_managed_https": { + Type: pluginsdk.TypeList, + Optional: true, + MinItems: 1, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "certificate_type": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.CertificateTypeShared), + string(cdn.CertificateTypeDedicated), + }, false), + }, + "protocol_type": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.ProtocolTypeServerNameIndication), + string(cdn.ProtocolTypeIPBased), + }, false), + }, + "tls_version": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.MinimumTLSVersionTLS10), + string(cdn.MinimumTLSVersionTLS12), + string(cdn.MinimumTLSVersionNone), + }, false), + Default: string(cdn.MinimumTLSVersionTLS12), + }, + }, + }, + ConflictsWith: []string{"user_managed_https"}, + }, + + "user_managed_https": { + Type: pluginsdk.TypeList, + Optional: true, + MinItems: 1, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "tls_version": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.MinimumTLSVersionTLS10), + string(cdn.MinimumTLSVersionTLS12), + string(cdn.MinimumTLSVersionNone), + }, false), + Default: string(cdn.MinimumTLSVersionTLS12), + }, + }, + }, + ConflictsWith: []string{"cdn_managed_https"}, + }, + } + if !features.FourPointOhBeta() { + schema["user_managed_https"].Elem.(*pluginsdk.Resource).Schema["key_vault_certificate_id"] = &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ValidateFunc: keyvaultValidate.NestedItemIdWithOptionalVersion, + ExactlyOneOf: []string{"user_managed_https.0.key_vault_certificate_id", "user_managed_https.0.key_vault_secret_id"}, + Deprecated: "This is deprecated in favor of `key_vault_secret_id` as the service is actually looking for a secret, not a certificate", + } + + schema["user_managed_https"].Elem.(*pluginsdk.Resource).Schema["key_vault_secret_id"] = &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ValidateFunc: keyvaultValidate.NestedItemIdWithOptionalVersion, + ExactlyOneOf: []string{"user_managed_https.0.key_vault_certificate_id", "user_managed_https.0.key_vault_secret_id"}, + } + } else { + schema["user_managed_https"].Elem.(*pluginsdk.Resource).Schema["key_vault_secret_id"] = &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: keyvaultValidate.NestedItemIdWithOptionalVersion, + } + } + return &pluginsdk.Resource{ Create: resourceArmCdnEndpointCustomDomainCreate, Read: resourceArmCdnEndpointCustomDomainRead, @@ -39,92 +146,7 @@ func resourceArmCdnEndpointCustomDomain() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(12 * time.Hour), }, - Schema: map[string]*pluginsdk.Schema{ - "name": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validate.CdnEndpointCustomDomainName(), - }, - - "cdn_endpoint_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validate.EndpointID, - }, - - "host_name": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "cdn_managed_https": { - Type: pluginsdk.TypeList, - Optional: true, - MinItems: 1, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "certificate_type": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.CertificateTypeShared), - string(cdn.CertificateTypeDedicated), - }, false), - }, - "protocol_type": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.ProtocolTypeServerNameIndication), - string(cdn.ProtocolTypeIPBased), - }, false), - }, - "tls_version": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.MinimumTLSVersionTLS10), - string(cdn.MinimumTLSVersionTLS12), - string(cdn.MinimumTLSVersionNone), - }, false), - Default: string(cdn.MinimumTLSVersionTLS12), - }, - }, - }, - ConflictsWith: []string{"user_managed_https"}, - }, - - "user_managed_https": { - Type: pluginsdk.TypeList, - Optional: true, - MinItems: 1, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "key_vault_certificate_id": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: keyvaultValidate.NestedItemIdWithOptionalVersion, - }, - "tls_version": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cdn.MinimumTLSVersionTLS10), - string(cdn.MinimumTLSVersionTLS12), - string(cdn.MinimumTLSVersionNone), - }, false), - Default: string(cdn.MinimumTLSVersionTLS12), - }, - }, - }, - ConflictsWith: []string{"cdn_managed_https"}, - }, - }, + Schema: schema, } } @@ -168,6 +190,8 @@ func resourceArmCdnEndpointCustomDomainCreate(d *pluginsdk.ResourceData, meta in return fmt.Errorf("waiting for creation of %q: %+v", id, err) } + d.SetId(id.ID()) + // Enable https if specified var params cdn.BasicCustomDomainHTTPSParameters if v, ok := d.GetOk("user_managed_https"); ok { @@ -201,8 +225,6 @@ func resourceArmCdnEndpointCustomDomainCreate(d *pluginsdk.ResourceData, meta in } } - d.SetId(id.ID()) - return resourceArmCdnEndpointCustomDomainRead(d, meta) } @@ -351,12 +373,21 @@ func resourceArmCdnEndpointCustomDomainRead(d *pluginsdk.ResourceData, meta inte case cdn.UserManagedHTTPSParameters: var isVersioned bool if b := d.Get("user_managed_https").([]interface{}); len(b) == 1 { - if certIdRaw := b[0].(map[string]interface{})["key_vault_certificate_id"].(string); certIdRaw != "" { - certId, err := keyvaultParse.ParseOptionallyVersionedNestedItemID(certIdRaw) + b := b[0].(map[string]interface{}) + + secretIdRaw := b["key_vault_secret_id"].(string) + if !features.FourPointOhBeta() { + if secretIdRaw == "" { + secretIdRaw = b["key_vault_certificate_id"].(string) + } + } + + if secretIdRaw != "" { + id, err := keyvaultParse.ParseOptionallyVersionedNestedItemID(secretIdRaw) if err != nil { - return fmt.Errorf("parsing Key Vault Certificate Id %q: %v", certIdRaw, err) + return fmt.Errorf("parsing Key Vault Secret Id %q: %v", secretIdRaw, err) } - isVersioned = certId.Version != "" + isVersioned = id.Version != "" } } settings, err := flattenArmCdnEndpointCustomDomainUserManagedHttpsSettings(ctx, params, keyVaultsClient, isVersioned) @@ -422,17 +453,24 @@ func expandArmCdnEndpointCustomDomainUserManagedHttpsSettings(ctx context.Contex raw := input[0].(map[string]interface{}) - keyVaultCertId, err := keyvaultParse.ParseOptionallyVersionedNestedItemID(raw["key_vault_certificate_id"].(string)) + idLiteral := raw["key_vault_secret_id"].(string) + if !features.FourPointOhBeta() { + if idLiteral == "" { + idLiteral = raw["key_vault_certificate_id"].(string) + } + } + + keyVaultSecretId, err := keyvaultParse.ParseOptionallyVersionedNestedItemID(idLiteral) if err != nil { return nil, err } - keyVaultIdRaw, err := clients.KeyVault.KeyVaultIDFromBaseUrl(ctx, clients.Resource, keyVaultCertId.KeyVaultBaseUrl) + keyVaultIdRaw, err := clients.KeyVault.KeyVaultIDFromBaseUrl(ctx, clients.Resource, keyVaultSecretId.KeyVaultBaseUrl) if err != nil { - return nil, fmt.Errorf("retrieving the Resource ID the Key Vault at URL %q: %s", keyVaultCertId.KeyVaultBaseUrl, err) + return nil, fmt.Errorf("retrieving the Resource ID the Key Vault at URL %q: %s", keyVaultSecretId.KeyVaultBaseUrl, err) } if keyVaultIdRaw == nil { - return nil, fmt.Errorf("unexpected nil Key Vault ID retrieved at URL %q", keyVaultCertId.KeyVaultBaseUrl) + return nil, fmt.Errorf("unexpected nil Key Vault ID retrieved at URL %q", keyVaultSecretId.KeyVaultBaseUrl) } keyVaultId, err := keyvaultParse.VaultID(*keyVaultIdRaw) if err != nil { @@ -445,8 +483,8 @@ func expandArmCdnEndpointCustomDomainUserManagedHttpsSettings(ctx context.Contex SubscriptionID: &keyVaultId.SubscriptionId, ResourceGroupName: &keyVaultId.ResourceGroup, VaultName: &keyVaultId.Name, - SecretName: &keyVaultCertId.Name, - SecretVersion: &keyVaultCertId.Version, + SecretName: &keyVaultSecretId.Name, + SecretVersion: &keyVaultSecretId.Version, UpdateRule: utils.String("NoAction"), DeleteRule: utils.String("NoAction"), }, @@ -507,31 +545,50 @@ func flattenArmCdnEndpointCustomDomainUserManagedHttpsSettings(ctx context.Conte keyVaultId := keyvaultParse.NewVaultID(subscriptionId, resourceGroupName, vaultName) keyVaultBaseUrl, err := keyVaultsClient.BaseUriForKeyVault(ctx, keyVaultId) if err != nil { - return nil, fmt.Errorf("looking up Key Vault Certificate %q vault url from id %q: %+v", vaultName, keyVaultId, err) + return nil, fmt.Errorf("looking up Key Vault Secret %q vault url from id %q: %+v", vaultName, keyVaultId, err) } - cert, err := keyVaultsClient.ManagementClient.GetCertificate(ctx, *keyVaultBaseUrl, secretName, secretVersion) + + secret, err := keyVaultsClient.ManagementClient.GetSecret(ctx, *keyVaultBaseUrl, secretName, secretVersion) if err != nil { return nil, err } - if cert.ID == nil { - return nil, fmt.Errorf("unexpected null Key Vault Certificate retrieved for Key Vault %s / Secret Name %s / Secret Version %s", keyVaultId, secretName, secretVersion) + if secret.ID == nil { + return nil, fmt.Errorf("unexpected null Key Vault Secret retrieved for Key Vault %s / Secret Name %s / Secret Version %s", keyVaultId, secretName, secretVersion) } - certId, err := keyvaultParse.ParseOptionallyVersionedNestedItemID(*cert.ID) + secretId, err := keyvaultParse.ParseOptionallyVersionedNestedItemID(*secret.ID) if err != nil { return nil, err } - certIdLiteral := certId.ID() + secretIdLiteral := secretId.ID() if !isVersioned { - certIdLiteral = certId.VersionlessID() + secretIdLiteral = secretId.VersionlessID() } - return []interface{}{ - map[string]interface{}{ - "key_vault_certificate_id": certIdLiteral, - "tls_version": string(input.MinimumTLSVersion), - }, - }, nil + m := map[string]interface{}{ + "key_vault_secret_id": secretIdLiteral, + "tls_version": string(input.MinimumTLSVersion), + } + + if features.FourPointOhBeta() { + return []interface{}{m}, nil + } + + // We try to retrieve the certificate with the given secret name and version. If it returns error, then we tolerate the error and simply setting empty string for the certificate id. + // As in this case, the users might be using a secret rather than a certificate. + var certIdLiteral string + cert, err := keyVaultsClient.ManagementClient.GetCertificate(ctx, *keyVaultBaseUrl, secretName, secretVersion) + if err == nil && cert.ID != nil { + certId, err := keyvaultParse.ParseOptionallyVersionedNestedItemID(*cert.ID) + if err == nil { + } + certIdLiteral = certId.ID() + if !isVersioned { + certIdLiteral = certId.VersionlessID() + } + } + m["key_vault_certificate_id"] = certIdLiteral + return []interface{}{m}, nil } func enableArmCdnEndpointCustomDomainHttps(ctx context.Context, client *cdn.CustomDomainsClient, id parse.CustomDomainId, params cdn.BasicCustomDomainHTTPSParameters) error { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_endpoint_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_endpoint_data_source.go index bedaf8e6c11..5ec6bebae23 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_endpoint_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_endpoint_data_source.go @@ -5,7 +5,6 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_endpoint_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_endpoint_resource.go index 5787357a21a..f05993cd111 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_endpoint_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_endpoint_resource.go @@ -4,9 +4,8 @@ import ( "fmt" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go new file mode 100644 index 00000000000..7dad3bf00b0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_firewall_policy_resource.go @@ -0,0 +1,1094 @@ +package cdn + +import ( + "fmt" + "log" + "time" + + "github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceCdnFrontDoorFirewallPolicy() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceCdnFrontDoorFirewallPolicyCreate, + Read: resourceCdnFrontDoorFirewallPolicyRead, + Update: resourceCdnFrontDoorFirewallPolicyUpdate, + Delete: resourceCdnFrontDoorFirewallPolicyDelete, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.FrontDoorFirewallPolicyID(id) + return err + }), + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Update: pluginsdk.DefaultTimeout(30 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.FrontDoorFirewallPolicyName, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "sku_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(frontdoor.SkuNameStandardAzureFrontDoor), + string(frontdoor.SkuNamePremiumAzureFrontDoor), + }, false), + }, + + "mode": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(frontdoor.PolicyModeDetection), + string(frontdoor.PolicyModePrevention), + }, false), + }, + + "enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "redirect_url": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.IsURLWithScheme([]string{"http", "https"}), + }, + + "custom_block_response_status_code": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntInSlice([]int{ + 200, + 403, + 405, + 406, + 429, + }), + }, + + "custom_block_response_body": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsBase64, + }, + + "custom_rule": { + Type: pluginsdk.TypeList, + MaxItems: 100, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "priority": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 1, + }, + + "type": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(frontdoor.RuleTypeMatchRule), + string(frontdoor.RuleTypeRateLimitRule), + }, false), + }, + + "rate_limit_duration_in_minutes": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 1, + }, + + "rate_limit_threshold": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 10, + }, + + "action": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(frontdoor.ActionTypeAllow), + string(frontdoor.ActionTypeBlock), + string(frontdoor.ActionTypeLog), + string(frontdoor.ActionTypeRedirect), + }, false), + }, + + "match_condition": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 10, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "match_variable": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(frontdoor.MatchVariableCookies), + string(frontdoor.MatchVariablePostArgs), + string(frontdoor.MatchVariableQueryString), + string(frontdoor.MatchVariableRemoteAddr), + string(frontdoor.MatchVariableRequestBody), + string(frontdoor.MatchVariableRequestHeader), + string(frontdoor.MatchVariableRequestMethod), + string(frontdoor.MatchVariableRequestURI), + string(frontdoor.MatchVariableSocketAddr), + }, false), + }, + + "match_values": { + Type: pluginsdk.TypeList, + Required: true, + MaxItems: 600, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringLenBetween(1, 256), + }, + }, + + "operator": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(frontdoor.OperatorAny), + string(frontdoor.OperatorBeginsWith), + string(frontdoor.OperatorContains), + string(frontdoor.OperatorEndsWith), + string(frontdoor.OperatorEqual), + string(frontdoor.OperatorGeoMatch), + string(frontdoor.OperatorGreaterThan), + string(frontdoor.OperatorGreaterThanOrEqual), + string(frontdoor.OperatorIPMatch), + string(frontdoor.OperatorLessThan), + string(frontdoor.OperatorLessThanOrEqual), + string(frontdoor.OperatorRegEx), + }, false), + }, + + "selector": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "negation_condition": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "transforms": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 5, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + string(frontdoor.TransformTypeLowercase), + string(frontdoor.TransformTypeRemoveNulls), + string(frontdoor.TransformTypeTrim), + string(frontdoor.TransformTypeUppercase), + string(frontdoor.TransformTypeURLDecode), + string(frontdoor.TransformTypeURLEncode), + }, false), + }, + }, + }, + }, + }, + }, + }, + }, + + "managed_rule": { + Type: pluginsdk.TypeList, + MaxItems: 100, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "type": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "version": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "action": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(frontdoor.ActionTypeAllow), + string(frontdoor.ActionTypeLog), + string(frontdoor.ActionTypeBlock), + string(frontdoor.ActionTypeRedirect), + }, false), + }, + + "exclusion": { + Type: pluginsdk.TypeList, + MaxItems: 100, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "match_variable": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(frontdoor.ManagedRuleExclusionMatchVariableQueryStringArgNames), + string(frontdoor.ManagedRuleExclusionMatchVariableRequestBodyPostArgNames), + string(frontdoor.ManagedRuleExclusionMatchVariableRequestCookieNames), + string(frontdoor.ManagedRuleExclusionMatchVariableRequestHeaderNames), + }, false), + }, + "operator": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorContains), + string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEndsWith), + string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEquals), + string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEqualsAny), + string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorStartsWith), + }, false), + }, + "selector": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "override": { + Type: pluginsdk.TypeList, + MaxItems: 100, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "rule_group_name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "exclusion": { + Type: pluginsdk.TypeList, + MaxItems: 100, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "match_variable": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(frontdoor.ManagedRuleExclusionMatchVariableQueryStringArgNames), + string(frontdoor.ManagedRuleExclusionMatchVariableRequestBodyPostArgNames), + string(frontdoor.ManagedRuleExclusionMatchVariableRequestCookieNames), + string(frontdoor.ManagedRuleExclusionMatchVariableRequestHeaderNames), + }, false), + }, + "operator": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorContains), + string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEndsWith), + string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEquals), + string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEqualsAny), + string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorStartsWith), + }, false), + }, + "selector": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "rule": { + Type: pluginsdk.TypeList, + MaxItems: 1000, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "rule_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "exclusion": { + Type: pluginsdk.TypeList, + MaxItems: 100, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "match_variable": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(frontdoor.ManagedRuleExclusionMatchVariableQueryStringArgNames), + string(frontdoor.ManagedRuleExclusionMatchVariableRequestBodyPostArgNames), + string(frontdoor.ManagedRuleExclusionMatchVariableRequestCookieNames), + string(frontdoor.ManagedRuleExclusionMatchVariableRequestHeaderNames), + }, false), + }, + "operator": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorContains), + string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEndsWith), + string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEquals), + string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorEqualsAny), + string(frontdoor.ManagedRuleExclusionSelectorMatchOperatorStartsWith), + }, false), + }, + "selector": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "action": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(frontdoor.ActionTypeAllow), + string(frontdoor.ActionTypeLog), + string(frontdoor.ActionTypeBlock), + string(frontdoor.ActionTypeRedirect), + }, false), + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + + "frontend_endpoint_ids": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "tags": commonschema.Tags(), + }, + } +} + +func resourceCdnFrontDoorFirewallPolicyCreate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorLegacyFirewallPoliciesClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) + defer cancel() + + name := d.Get("name").(string) + resourceGroup := d.Get("resource_group_name").(string) + + log.Printf("[INFO] preparing args for Cdn Frontdoor %q Firewall Policy(Resource Group: %q)", name, resourceGroup) + id := parse.NewFrontDoorFirewallPolicyID(subscriptionId, resourceGroup, name) + + if d.IsNewResource() { + existing, err := client.Get(ctx, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + } + + if !utils.ResponseWasNotFound(existing.Response) { + return tf.ImportAsExistsError("azurerm_cdn_frontdoor_firewall_policy", id.ID()) + } + } + + enabled := frontdoor.PolicyEnabledStateDisabled + + if d.Get("enabled").(bool) { + enabled = frontdoor.PolicyEnabledStateEnabled + } + + sku := d.Get("sku_name").(string) + mode := frontdoor.PolicyMode(d.Get("mode").(string)) + redirectUrl := d.Get("redirect_url").(string) + customBlockResponseStatusCode := d.Get("custom_block_response_status_code").(int) + customBlockResponseBody := d.Get("custom_block_response_body").(string) + customRules := d.Get("custom_rule").([]interface{}) + managedRules := expandCdnFrontDoorFirewallManagedRules(d.Get("managed_rule").([]interface{})) + + if sku != string(frontdoor.SkuNamePremiumAzureFrontDoor) && managedRules != nil { + return fmt.Errorf("the `managed_rule` field is only supported with the %q sku, got %q", frontdoor.SkuNamePremiumAzureFrontDoor, sku) + } + + t := d.Get("tags").(map[string]interface{}) + + payload := frontdoor.WebApplicationFirewallPolicy{ + Location: utils.String(location.Normalize("Global")), + Sku: &frontdoor.Sku{ + Name: frontdoor.SkuName(sku), + }, + WebApplicationFirewallPolicyProperties: &frontdoor.WebApplicationFirewallPolicyProperties{ + PolicySettings: &frontdoor.PolicySettings{ + EnabledState: enabled, + Mode: mode, + }, + CustomRules: expandCdnFrontDoorFirewallCustomRules(customRules), + }, + Tags: expandFrontDoorTags(tags.Expand(t)), + } + + if managedRules != nil { + payload.WebApplicationFirewallPolicyProperties.ManagedRules = managedRules + } + + if redirectUrl != "" { + payload.WebApplicationFirewallPolicyProperties.PolicySettings.RedirectURL = utils.String(redirectUrl) + } + + if customBlockResponseBody != "" { + payload.WebApplicationFirewallPolicyProperties.PolicySettings.CustomBlockResponseBody = utils.String(customBlockResponseBody) + } + + if customBlockResponseStatusCode > 0 { + payload.WebApplicationFirewallPolicyProperties.PolicySettings.CustomBlockResponseStatusCode = utils.Int32(int32(customBlockResponseStatusCode)) + } + + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName, payload) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the creation of %s: %+v", id, err) + } + + d.SetId(id.ID()) + return resourceCdnFrontDoorFirewallPolicyRead(d, meta) +} + +func resourceCdnFrontDoorFirewallPolicyUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorLegacyFirewallPoliciesClient + ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.FrontDoorFirewallPolicyID(d.Id()) + if err != nil { + return err + } + + existing, err := client.Get(ctx, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + if existing.Sku == nil { + return fmt.Errorf("retrieving %s: `sku` was nil", *id) + } + + if existing.WebApplicationFirewallPolicyProperties == nil { + return fmt.Errorf("retrieving %s: `properties` was nil", *id) + } + + props := *existing.WebApplicationFirewallPolicyProperties + + if d.HasChanges("custom_block_response_body", "custom_block_response_status_code", "enabled", "mode", "redirect_url") { + enabled := frontdoor.PolicyEnabledStateDisabled + if d.Get("enabled").(bool) { + enabled = frontdoor.PolicyEnabledStateEnabled + } + props.PolicySettings = &frontdoor.PolicySettings{ + EnabledState: enabled, + Mode: frontdoor.PolicyMode(d.Get("mode").(string)), + } + + if redirectUrl := d.Get("redirect_url").(string); redirectUrl != "" { + props.PolicySettings.RedirectURL = utils.String(redirectUrl) + } + + if body := d.Get("custom_block_response_body").(string); body != "" { + props.PolicySettings.CustomBlockResponseBody = utils.String(body) + } + + if statusCode := d.Get("custom_block_response_status_code").(int); statusCode > 0 { + props.PolicySettings.CustomBlockResponseStatusCode = utils.Int32(int32(statusCode)) + } + } + + if d.HasChange("custom_rule") { + props.CustomRules = expandCdnFrontDoorFirewallCustomRules(d.Get("custom_rule").([]interface{})) + } + + if d.HasChange("managed_rule") { + managedRules := expandCdnFrontDoorFirewallManagedRules(d.Get("managed_rule").([]interface{})) + if existing.Sku.Name != frontdoor.SkuNamePremiumAzureFrontDoor && managedRules != nil { + return fmt.Errorf("the `managed_rule` field is only supported when using the sku %q, got %q", frontdoor.SkuNamePremiumAzureFrontDoor, existing.Sku.Name) + } + if managedRules != nil { + props.ManagedRules = managedRules + } + } + + if d.HasChange("tags") { + t := d.Get("tags").(map[string]interface{}) + existing.Tags = expandFrontDoorTags(tags.Expand(t)) + } + + existing.WebApplicationFirewallPolicyProperties = &props + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName, existing) + if err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the update of %s: %+v", *id, err) + } + + return resourceCdnFrontDoorFirewallPolicyRead(d, meta) +} + +func resourceCdnFrontDoorFirewallPolicyRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorLegacyFirewallPoliciesClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.FrontDoorFirewallPolicyID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + log.Printf("[INFO] Cdn Frontdoor Firewall Policy %q does not exist - removing from state", d.Id()) + d.SetId("") + return nil + } + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + d.Set("name", id.FrontDoorWebApplicationFirewallPolicyName) + d.Set("resource_group_name", id.ResourceGroup) + + skuName := "" + if sku := resp.Sku; sku != nil { + skuName = string(sku.Name) + } + d.Set("sku_name", skuName) + + if properties := resp.WebApplicationFirewallPolicyProperties; properties != nil { + if policy := properties.PolicySettings; policy != nil { + d.Set("enabled", policy.EnabledState == frontdoor.PolicyEnabledStateEnabled) + d.Set("mode", string(policy.Mode)) + d.Set("redirect_url", policy.RedirectURL) + d.Set("custom_block_response_status_code", policy.CustomBlockResponseStatusCode) + d.Set("custom_block_response_body", policy.CustomBlockResponseBody) + } + + if err := d.Set("custom_rule", flattenCdnFrontDoorFirewallCustomRules(properties.CustomRules)); err != nil { + return fmt.Errorf("flattening `custom_rule`: %+v", err) + } + + if err := d.Set("frontend_endpoint_ids", flattenFrontendEndpointLinkSlice(properties.FrontendEndpointLinks)); err != nil { + return fmt.Errorf("flattening `frontend_endpoint_ids`: %+v", err) + } + + if err := d.Set("managed_rule", flattenCdnFrontDoorFirewallManagedRules(properties.ManagedRules)); err != nil { + return fmt.Errorf("flattening `managed_rule`: %+v", err) + } + } + + if err := tags.FlattenAndSet(d, flattenFrontDoorTags(resp.Tags)); err != nil { + return err + } + + return nil +} + +func resourceCdnFrontDoorFirewallPolicyDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorLegacyFirewallPoliciesClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.FrontDoorFirewallPolicyID(d.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName) + if err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) + } + + return nil +} + +func expandCdnFrontDoorFirewallCustomRules(input []interface{}) *frontdoor.CustomRuleList { + if len(input) == 0 { + return nil + } + + output := make([]frontdoor.CustomRule, 0) + + for _, cr := range input { + custom := cr.(map[string]interface{}) + + enabled := frontdoor.CustomRuleEnabledStateDisabled + if custom["enabled"].(bool) { + enabled = frontdoor.CustomRuleEnabledStateEnabled + } + + name := custom["name"].(string) + priority := int32(custom["priority"].(int)) + ruleType := custom["type"].(string) + rateLimitDurationInMinutes := int32(custom["rate_limit_duration_in_minutes"].(int)) + rateLimitThreshold := int32(custom["rate_limit_threshold"].(int)) + matchConditions := expandCdnFrontDoorFirewallMatchConditions(custom["match_condition"].([]interface{})) + action := custom["action"].(string) + + output = append(output, frontdoor.CustomRule{ + Name: utils.String(name), + Priority: &priority, + EnabledState: enabled, + RuleType: frontdoor.RuleType(ruleType), + RateLimitDurationInMinutes: utils.Int32(rateLimitDurationInMinutes), + RateLimitThreshold: utils.Int32(rateLimitThreshold), + MatchConditions: &matchConditions, + Action: frontdoor.ActionType(action), + }) + } + + return &frontdoor.CustomRuleList{ + Rules: &output, + } +} + +func expandCdnFrontDoorFirewallMatchConditions(input []interface{}) []frontdoor.MatchCondition { + result := make([]frontdoor.MatchCondition, 0) + if len(input) == 0 { + return nil + } + + for _, v := range input { + match := v.(map[string]interface{}) + + matchVariable := match["match_variable"].(string) + selector := match["selector"].(string) + operator := match["operator"].(string) + negateCondition := match["negation_condition"].(bool) + matchValues := match["match_values"].([]interface{}) + transforms := match["transforms"].([]interface{}) + + matchCondition := frontdoor.MatchCondition{ + Operator: frontdoor.Operator(operator), + NegateCondition: &negateCondition, + MatchValue: utils.ExpandStringSlice(matchValues), + Transforms: expandCdnFrontDoorFirewallTransforms(transforms), + } + + if matchVariable != "" { + matchCondition.MatchVariable = frontdoor.MatchVariable(matchVariable) + } + if selector != "" { + matchCondition.Selector = utils.String(selector) + } + + result = append(result, matchCondition) + } + + return result +} + +func expandCdnFrontDoorFirewallTransforms(input []interface{}) *[]frontdoor.TransformType { + result := make([]frontdoor.TransformType, 0) + if len(input) == 0 { + return nil + } + + for _, v := range input { + result = append(result, frontdoor.TransformType(v.(string))) + } + + return &result +} + +func expandCdnFrontDoorFirewallManagedRules(input []interface{}) *frontdoor.ManagedRuleSetList { + if len(input) == 0 { + return nil + } + + result := make([]frontdoor.ManagedRuleSet, 0) + for _, mr := range input { + managedRule := mr.(map[string]interface{}) + + ruleType := managedRule["type"].(string) + version := managedRule["version"].(string) + action := managedRule["action"].(string) + overrides := managedRule["override"].([]interface{}) + exclusions := expandCdnFrontDoorFirewallManagedRuleGroupExclusion(managedRule["exclusion"].([]interface{})) + ruleGroupOverrides := expandCdnFrontDoorFirewallManagedRuleGroupOverride(overrides) + + managedRuleSet := frontdoor.ManagedRuleSet{ + Exclusions: exclusions, + RuleSetVersion: &version, + RuleGroupOverrides: ruleGroupOverrides, + RuleSetType: &ruleType, + } + + if action != "" { + managedRuleSet.RuleSetAction = frontdoor.ManagedRuleSetActionType(action) + } + + result = append(result, managedRuleSet) + } + + return &frontdoor.ManagedRuleSetList{ + ManagedRuleSets: &result, + } +} + +func expandCdnFrontDoorFirewallManagedRuleGroupExclusion(input []interface{}) *[]frontdoor.ManagedRuleExclusion { + results := make([]frontdoor.ManagedRuleExclusion, 0) + if len(input) == 0 { + return nil + } + + for _, v := range input { + exclusion := v.(map[string]interface{}) + + matchVariable := exclusion["match_variable"].(string) + operator := exclusion["operator"].(string) + selector := exclusion["selector"].(string) + + results = append(results, frontdoor.ManagedRuleExclusion{ + MatchVariable: frontdoor.ManagedRuleExclusionMatchVariable(matchVariable), + SelectorMatchOperator: frontdoor.ManagedRuleExclusionSelectorMatchOperator(operator), + Selector: &selector, + }) + } + + return &results +} + +func expandCdnFrontDoorFirewallManagedRuleGroupOverride(input []interface{}) *[]frontdoor.ManagedRuleGroupOverride { + result := make([]frontdoor.ManagedRuleGroupOverride, 0) + if len(input) == 0 { + return nil + } + + for _, v := range input { + override := v.(map[string]interface{}) + + exclusions := expandCdnFrontDoorFirewallManagedRuleGroupExclusion(override["exclusion"].([]interface{})) + ruleGroupName := override["rule_group_name"].(string) + rules := expandCdnFrontDoorFirewallRuleOverride(override["rule"].([]interface{})) + + result = append(result, frontdoor.ManagedRuleGroupOverride{ + Exclusions: exclusions, + RuleGroupName: &ruleGroupName, + Rules: rules, + }) + } + + return &result +} + +func expandCdnFrontDoorFirewallRuleOverride(input []interface{}) *[]frontdoor.ManagedRuleOverride { + result := make([]frontdoor.ManagedRuleOverride, 0) + if len(input) == 0 { + return nil + } + + for _, v := range input { + rule := v.(map[string]interface{}) + + enabled := frontdoor.ManagedRuleEnabledStateDisabled + if rule["enabled"].(bool) { + enabled = frontdoor.ManagedRuleEnabledStateEnabled + } + ruleId := rule["rule_id"].(string) + action := frontdoor.ActionType(rule["action"].(string)) + exclusions := expandCdnFrontDoorFirewallManagedRuleGroupExclusion(rule["exclusion"].([]interface{})) + + result = append(result, frontdoor.ManagedRuleOverride{ + RuleID: &ruleId, + EnabledState: enabled, + Action: action, + Exclusions: exclusions, + }) + } + + return &result +} + +func flattenCdnFrontDoorFirewallCustomRules(input *frontdoor.CustomRuleList) []interface{} { + if input == nil || input.Rules == nil { + return []interface{}{} + } + + results := make([]interface{}, 0) + for _, v := range *input.Rules { + action := "" + if v.Action != "" { + action = string(v.Action) + } + + enabled := false + if v.EnabledState != "" { + enabled = v.EnabledState == frontdoor.CustomRuleEnabledStateEnabled + } + + name := "" + if v.Name != nil { + name = *v.Name + } + + priority := 0 + if v.Priority != nil { + priority = int(*v.Priority) + } + + rateLimitDurationInMinutes := 0 + if v.RateLimitDurationInMinutes != nil { + rateLimitDurationInMinutes = int(*v.RateLimitDurationInMinutes) + } + + rateLimitThreshold := 0 + if v.RateLimitThreshold != nil { + rateLimitThreshold = int(*v.RateLimitThreshold) + } + + ruleType := "" + if v.RuleType != "" { + ruleType = string(v.RuleType) + } + + results = append(results, map[string]interface{}{ + "action": action, + "enabled": enabled, + "match_condition": flattenCdnFrontDoorFirewallMatchConditions(v.MatchConditions), + "rate_limit_duration_in_minutes": rateLimitDurationInMinutes, + "rate_limit_threshold": rateLimitThreshold, + "priority": priority, + "name": name, + "type": ruleType, + }) + } + + return results +} + +func flattenCdnFrontDoorFirewallMatchConditions(input *[]frontdoor.MatchCondition) []interface{} { + if input == nil { + return []interface{}{} + } + + results := make([]interface{}, 0) + for _, v := range *input { + selector := "" + if v.Selector != nil { + selector = *v.Selector + } + + negateCondition := false + if v.NegateCondition != nil { + negateCondition = *v.NegateCondition + } + + results = append(results, map[string]interface{}{ + "match_variable": string(v.MatchVariable), + "match_values": v.MatchValue, + "negation_condition": negateCondition, + "operator": string(v.Operator), + "selector": selector, + "transforms": flattenTransformSlice(v.Transforms), + }) + } + + return results +} + +func flattenCdnFrontDoorFirewallManagedRules(input *frontdoor.ManagedRuleSetList) []interface{} { + if input == nil || input.ManagedRuleSets == nil { + return []interface{}{} + } + + results := make([]interface{}, 0) + for _, r := range *input.ManagedRuleSets { + ruleSetType := "" + if r.RuleSetType != nil { + ruleSetType = *r.RuleSetType + } + + ruleSetVersion := "" + if r.RuleSetVersion != nil { + ruleSetVersion = *r.RuleSetVersion + } + + ruleSetAction := "" + if r.RuleSetAction != "" { + ruleSetAction = string(r.RuleSetAction) + } + + results = append(results, map[string]interface{}{ + "exclusion": flattenCdnFrontDoorFirewallExclusions(r.Exclusions), + "override": flattenCdnFrontDoorFirewallOverrides(r.RuleGroupOverrides), + "type": ruleSetType, + "version": ruleSetVersion, + "action": ruleSetAction, + }) + } + + return results +} + +func flattenCdnFrontDoorFirewallExclusions(input *[]frontdoor.ManagedRuleExclusion) []interface{} { + if input == nil { + return []interface{}{} + } + + results := make([]interface{}, 0) + for _, v := range *input { + matchVariable := "" + if v.MatchVariable != "" { + matchVariable = string(v.MatchVariable) + } + + operator := "" + if v.SelectorMatchOperator != "" { + operator = string(v.SelectorMatchOperator) + } + + selector := "" + if v.Selector != nil { + selector = *v.Selector + } + + results = append(results, map[string]interface{}{ + "match_variable": matchVariable, + "operator": operator, + "selector": selector, + }) + } + + return results +} + +func flattenCdnFrontDoorFirewallOverrides(input *[]frontdoor.ManagedRuleGroupOverride) []interface{} { + if input == nil { + return []interface{}{} + } + + results := make([]interface{}, 0) + for _, v := range *input { + ruleGroupName := "" + if v.RuleGroupName != nil { + ruleGroupName = *v.RuleGroupName + } + + results = append(results, map[string]interface{}{ + "rule_group_name": ruleGroupName, + "exclusion": flattenCdnFrontDoorFirewallExclusions(v.Exclusions), + "rule": flattenCdnFrontDoorFirewallRules(v.Rules), + }) + } + + return results +} + +func flattenCdnFrontDoorFirewallRules(input *[]frontdoor.ManagedRuleOverride) []interface{} { + if input == nil { + return []interface{}{} + } + + results := make([]interface{}, 0) + for _, v := range *input { + action := "" + if v.Action != "" { + action = string(v.Action) + } + + enabled := false + if v.EnabledState != "" { + enabled = v.EnabledState == frontdoor.ManagedRuleEnabledStateEnabled + } + + ruleId := "" + if v.RuleID != nil { + ruleId = *v.RuleID + } + + results = append(results, map[string]interface{}{ + "action": action, + "enabled": enabled, + "exclusion": flattenCdnFrontDoorFirewallExclusions(v.Exclusions), + "rule_id": ruleId, + }) + } + + return results +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_helpers.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_helpers.go index 1f8b655f051..ef922d70f69 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_helpers.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_helpers.go @@ -1,6 +1,9 @@ package cdn -import "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" +import ( + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" + "github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor" +) func expandEnabledBool(isEnabled bool) cdn.EnabledState { if isEnabled { @@ -13,3 +16,59 @@ func expandEnabledBool(isEnabled bool) cdn.EnabledState { func flattenEnabledBool(input cdn.EnabledState) bool { return input == cdn.EnabledStateEnabled } + +func expandFrontDoorTags(tagMap *map[string]string) map[string]*string { + t := make(map[string]*string) + + if tagMap != nil { + for k, v := range *tagMap { + tagKey := k + tagValue := v + t[tagKey] = &tagValue + } + } + + return t +} + +func flattenFrontDoorTags(tagMap map[string]*string) *map[string]string { + t := make(map[string]string) + + for k, v := range tagMap { + tagKey := k + tagValue := v + if tagValue == nil { + continue + } + t[tagKey] = *tagValue + } + + return &t +} + +func flattenTransformSlice(input *[]frontdoor.TransformType) []interface{} { + result := make([]interface{}, 0) + + if input != nil { + for _, item := range *input { + result = append(result, string(item)) + } + } + return result +} + +func flattenFrontendEndpointLinkSlice(input *[]frontdoor.FrontendEndpointLink) []interface{} { + result := make([]interface{}, 0) + + if input != nil { + for _, item := range *input { + if item.ID == nil { + continue + } + + result = append(result, *item.ID) + } + } + + return result +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_origin_group_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_origin_group_data_source.go new file mode 100644 index 00000000000..2e5b07e9dee --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_origin_group_data_source.go @@ -0,0 +1,144 @@ +package cdn + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func dataSourceCdnFrontDoorOriginGroup() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceCdnFrontDoorOriginGroupRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.FrontDoorOriginGroupName, + }, + + "profile_name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.FrontDoorName, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + // Computed + "cdn_frontdoor_profile_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "health_probe": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "interval_in_seconds": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "path": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "protocol": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "request_type": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "load_balancing": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "additional_latency_in_milliseconds": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "sample_size": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "successful_samples_required": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + }, + }, + }, + + "restore_traffic_time_to_healed_or_new_endpoint_in_minutes": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "session_affinity_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + }, + } +} + +func dataSourceCdnFrontDoorOriginGroupRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorOriginGroupsClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id := parse.NewFrontDoorOriginGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("profile_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.OriginGroupName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("%s was not found", id) + } + + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + d.SetId(id.ID()) + d.Set("name", id.OriginGroupName) + d.Set("profile_name", id.ProfileName) + d.Set("resource_group_name", id.ResourceGroup) + d.Set("cdn_frontdoor_profile_id", parse.NewFrontDoorProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName).ID()) + + if props := resp.AFDOriginGroupProperties; props != nil { + if err := d.Set("health_probe", flattenCdnFrontDoorOriginGroupHealthProbeParameters(props.HealthProbeSettings)); err != nil { + return fmt.Errorf("setting `health_probe`: %+v", err) + } + + if err := d.Set("load_balancing", flattenCdnFrontDoorOriginGroupLoadBalancingSettingsParameters(props.LoadBalancingSettings)); err != nil { + return fmt.Errorf("setting `load_balancing`: %+v", err) + } + + d.Set("session_affinity_enabled", flattenEnabledBool(props.SessionAffinityState)) + d.Set("restore_traffic_time_to_healed_or_new_endpoint_in_minutes", props.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes) + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_origin_group_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_origin_group_resource.go new file mode 100644 index 00000000000..4d38f2b1bad --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_origin_group_resource.go @@ -0,0 +1,381 @@ +package cdn + +import ( + "fmt" + "time" + + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceCdnFrontDoorOriginGroup() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceCdnFrontDoorOriginGroupCreate, + Read: resourceCdnFrontDoorOriginGroupRead, + Update: resourceCdnFrontDoorOriginGroupUpdate, + Delete: resourceCdnFrontDoorOriginGroupDelete, + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Update: pluginsdk.DefaultTimeout(30 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.FrontDoorOriginGroupID(id) + return err + }), + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.FrontDoorOriginGroupName, + }, + + "cdn_frontdoor_profile_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.FrontDoorProfileID, + }, + + "load_balancing": { + Type: pluginsdk.TypeList, + Required: true, + MaxItems: 1, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "additional_latency_in_milliseconds": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 50, + ValidateFunc: validation.IntBetween(0, 1000), + }, + + "sample_size": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 4, + ValidateFunc: validation.IntBetween(0, 255), + }, + + "successful_samples_required": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 3, + ValidateFunc: validation.IntBetween(0, 255), + }, + }, + }, + }, + + // Optional + "health_probe": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "protocol": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.ProbeProtocolHTTP), + string(cdn.ProbeProtocolHTTPS), + }, false), + }, + + "request_type": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(cdn.HealthProbeRequestTypeHEAD), + ValidateFunc: validation.StringInSlice([]string{ + string(cdn.HealthProbeRequestTypeGET), + string(cdn.HealthProbeRequestTypeHEAD), + }, false), + }, + + "interval_in_seconds": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(5, 31536000), + }, + + "path": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "/", + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "session_affinity_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "restore_traffic_time_to_healed_or_new_endpoint_in_minutes": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 10, + ValidateFunc: validation.IntBetween(0, 50), + }, + }, + } +} + +func resourceCdnFrontDoorOriginGroupCreate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorOriginGroupsClient + ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) + defer cancel() + + profileId, err := parse.FrontDoorProfileID(d.Get("cdn_frontdoor_profile_id").(string)) + if err != nil { + return err + } + + id := parse.NewFrontDoorOriginGroupID(profileId.SubscriptionId, profileId.ResourceGroup, profileId.ProfileName, d.Get("name").(string)) + existing, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.OriginGroupName) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + } + + if !utils.ResponseWasNotFound(existing.Response) { + return tf.ImportAsExistsError("azurerm_cdn_frontdoor_origin_group", id.ID()) + } + + props := cdn.AFDOriginGroup{ + AFDOriginGroupProperties: &cdn.AFDOriginGroupProperties{ + HealthProbeSettings: expandCdnFrontDoorOriginGroupHealthProbeParameters(d.Get("health_probe").([]interface{})), + LoadBalancingSettings: expandCdnFrontDoorOriginGroupLoadBalancingSettingsParameters(d.Get("load_balancing").([]interface{})), + SessionAffinityState: expandEnabledBool(d.Get("session_affinity_enabled").(bool)), + TrafficRestorationTimeToHealedOrNewEndpointsInMinutes: utils.Int32(int32(d.Get("restore_traffic_time_to_healed_or_new_endpoint_in_minutes").(int))), + }, + } + + future, err := client.Create(ctx, id.ResourceGroup, id.ProfileName, id.OriginGroupName, props) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the creation of %s: %+v", id, err) + } + + d.SetId(id.ID()) + return resourceCdnFrontDoorOriginGroupRead(d, meta) +} + +func resourceCdnFrontDoorOriginGroupRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorOriginGroupsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.FrontDoorOriginGroupID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.OriginGroupName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + d.SetId("") + return nil + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + d.Set("name", id.OriginGroupName) + d.Set("cdn_frontdoor_profile_id", parse.NewFrontDoorProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName).ID()) + + if props := resp.AFDOriginGroupProperties; props != nil { + if err := d.Set("health_probe", flattenCdnFrontDoorOriginGroupHealthProbeParameters(props.HealthProbeSettings)); err != nil { + return fmt.Errorf("setting `health_probe`: %+v", err) + } + + if err := d.Set("load_balancing", flattenCdnFrontDoorOriginGroupLoadBalancingSettingsParameters(props.LoadBalancingSettings)); err != nil { + return fmt.Errorf("setting `load_balancing`: %+v", err) + } + + d.Set("session_affinity_enabled", flattenEnabledBool(props.SessionAffinityState)) + d.Set("restore_traffic_time_to_healed_or_new_endpoint_in_minutes", props.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes) + } + + return nil +} + +func resourceCdnFrontDoorOriginGroupUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorOriginGroupsClient + ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.FrontDoorOriginGroupID(d.Id()) + if err != nil { + return err + } + + params := &cdn.AFDOriginGroupUpdatePropertiesParameters{} + + if d.HasChange("health_probe") { + params.HealthProbeSettings = expandCdnFrontDoorOriginGroupHealthProbeParameters(d.Get("health_probe").([]interface{})) + } + + if d.HasChange("load_balancing") { + params.LoadBalancingSettings = expandCdnFrontDoorOriginGroupLoadBalancingSettingsParameters(d.Get("load_balancing").([]interface{})) + } + + if d.HasChange("restore_traffic_time_to_healed_or_new_endpoint_in_minutes") { + params.TrafficRestorationTimeToHealedOrNewEndpointsInMinutes = utils.Int32(int32(d.Get("restore_traffic_time_to_healed_or_new_endpoint_in_minutes").(int))) + } + + if d.HasChange("session_affinity_enabled") { + params.SessionAffinityState = expandEnabledBool(d.Get("session_affinity_enabled").(bool)) + } + + payload := cdn.AFDOriginGroupUpdateParameters{ + AFDOriginGroupUpdatePropertiesParameters: params, + } + + future, err := client.Update(ctx, id.ResourceGroup, id.ProfileName, id.OriginGroupName, payload) + if err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the update of %s: %+v", *id, err) + } + + return resourceCdnFrontDoorOriginGroupRead(d, meta) +} + +func resourceCdnFrontDoorOriginGroupDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorOriginGroupsClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.FrontDoorOriginGroupID(d.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.ProfileName, id.OriginGroupName) + if err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) + } + return nil +} + +func expandCdnFrontDoorOriginGroupHealthProbeParameters(input []interface{}) *cdn.HealthProbeParameters { + if len(input) == 0 || input[0] == nil { + return nil + } + + v := input[0].(map[string]interface{}) + + probeProtocolValue := cdn.ProbeProtocol(v["protocol"].(string)) + probeRequestTypeValue := cdn.HealthProbeRequestType(v["request_type"].(string)) + return &cdn.HealthProbeParameters{ + ProbeIntervalInSeconds: utils.Int32(int32(v["interval_in_seconds"].(int))), + ProbePath: utils.String(v["path"].(string)), + ProbeProtocol: probeProtocolValue, + ProbeRequestType: probeRequestTypeValue, + } +} + +func expandCdnFrontDoorOriginGroupLoadBalancingSettingsParameters(input []interface{}) *cdn.LoadBalancingSettingsParameters { + if len(input) == 0 || input[0] == nil { + return nil + } + + v := input[0].(map[string]interface{}) + + return &cdn.LoadBalancingSettingsParameters{ + AdditionalLatencyInMilliseconds: utils.Int32(int32(v["additional_latency_in_milliseconds"].(int))), + SampleSize: utils.Int32(int32(v["sample_size"].(int))), + SuccessfulSamplesRequired: utils.Int32(int32(v["successful_samples_required"].(int))), + } +} + +func flattenCdnFrontDoorOriginGroupLoadBalancingSettingsParameters(input *cdn.LoadBalancingSettingsParameters) []interface{} { + if input == nil { + return []interface{}{} + } + + additionalLatencyInMilliseconds := 0 + if input.AdditionalLatencyInMilliseconds != nil { + additionalLatencyInMilliseconds = int(*input.AdditionalLatencyInMilliseconds) + } + + sampleSize := 0 + if input.SampleSize != nil { + sampleSize = int(*input.SampleSize) + } + + successfulSamplesRequired := 0 + if input.SuccessfulSamplesRequired != nil { + successfulSamplesRequired = int(*input.SuccessfulSamplesRequired) + } + return []interface{}{ + map[string]interface{}{ + "additional_latency_in_milliseconds": additionalLatencyInMilliseconds, + "sample_size": sampleSize, + "successful_samples_required": successfulSamplesRequired, + }, + } +} + +func flattenCdnFrontDoorOriginGroupHealthProbeParameters(input *cdn.HealthProbeParameters) []interface{} { + if input == nil { + return []interface{}{} + } + + intervalInSeconds := 0 + if input.ProbeIntervalInSeconds != nil { + intervalInSeconds = int(*input.ProbeIntervalInSeconds) + } + + path := "" + if input.ProbePath != nil { + path = *input.ProbePath + } + + protocol := "" + if input.ProbeProtocol != "" { + protocol = string(input.ProbeProtocol) + } + + requestType := "" + if input.ProbeRequestType != "" { + requestType = string(input.ProbeRequestType) + } + + return []interface{}{ + map[string]interface{}{ + "interval_in_seconds": intervalInSeconds, + "path": path, + "protocol": protocol, + "request_type": requestType, + }, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_origin_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_origin_resource.go new file mode 100644 index 00000000000..57488160ad2 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_origin_resource.go @@ -0,0 +1,455 @@ +package cdn + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" + privateLinkServiceParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceCdnFrontDoorOrigin() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceCdnFrontDoorOriginCreate, + Read: resourceCdnFrontDoorOriginRead, + Update: resourceCdnFrontDoorOriginUpdate, + Delete: resourceCdnFrontDoorOriginDelete, + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Update: pluginsdk.DefaultTimeout(30 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.FrontDoorOriginID(id) + return err + }), + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.FrontDoorOriginName, + }, + + "cdn_frontdoor_origin_group_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.FrontDoorOriginGroupID, + }, + + "host_name": { + Type: pluginsdk.TypeString, + // HostName cannot be null or empty. + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "certificate_name_check_enabled": { + Type: pluginsdk.TypeBool, + Required: true, + }, + + "health_probes_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "http_port": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 80, + ValidateFunc: validation.IntBetween(1, 65535), + }, + + "https_port": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 443, + ValidateFunc: validation.IntBetween(1, 65535), + }, + + // Must be a valid domain name, IPv4 or IPv6 IP Address + "origin_host_header": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.Any(validation.IsIPv6Address, validation.IsIPv4Address, validation.StringIsNotEmpty), + }, + + "priority": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 1, + ValidateFunc: validation.IntBetween(1, 5), + }, + + "private_link": { + Type: pluginsdk.TypeList, + MaxItems: 1, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "location": commonschema.Location(), + + "private_link_target_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: azure.ValidateResourceID, + }, + + "request_message": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "Access request for CDN FrontDoor Private Link Origin", + ValidateFunc: validation.StringLenBetween(1, 140), + }, + + "target_type": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + "blob", + "blob_secondary", + "sites", + "web", + }, false), + }, + }, + }, + }, + + "weight": { + Type: pluginsdk.TypeInt, + Optional: true, + Default: 500, + ValidateFunc: validation.IntBetween(1, 1000), + }, + }, + } +} + +func resourceCdnFrontDoorOriginCreate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorOriginsClient + profileClient := meta.(*clients.Client).Cdn.FrontDoorProfileClient + ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) + defer cancel() + + originGroupId, err := parse.FrontDoorOriginGroupID(d.Get("cdn_frontdoor_origin_group_id").(string)) + if err != nil { + return err + } + + id := parse.NewFrontDoorOriginID(originGroupId.SubscriptionId, originGroupId.ResourceGroup, originGroupId.ProfileName, originGroupId.OriginGroupName, d.Get("name").(string)) + existing, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.OriginGroupName, id.OriginName) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + } + + if !utils.ResponseWasNotFound(existing.Response) { + return tf.ImportAsExistsError("azurerm_cdn_frontdoor_origin", id.ID()) + } + + // I need to get the profile SKU so I know if it is valid or not to define a private link as + // private links are only allowed in the premium sku... + profileId := parse.NewFrontDoorProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName) + + profile, err := profileClient.Get(ctx, profileId.ResourceGroup, profileId.ProfileName) + if err != nil { + if utils.ResponseWasNotFound(profile.Response) { + return fmt.Errorf("retrieving parent %s: not found", profileId) + } + + return fmt.Errorf("retrieving parent %s: %+v", profileId, err) + } + + if profile.Sku == nil { + return fmt.Errorf("retrieving parent %s: `sku` was nil", profileId) + } + skuName := profile.Sku.Name + + enableCertNameCheck := d.Get("certificate_name_check_enabled").(bool) + props := &cdn.AFDOriginProperties{ + EnabledState: expandEnabledBool(d.Get("health_probes_enabled").(bool)), + EnforceCertificateNameCheck: utils.Bool(enableCertNameCheck), + HostName: utils.String(d.Get("host_name").(string)), + HTTPPort: utils.Int32(int32(d.Get("http_port").(int))), + HTTPSPort: utils.Int32(int32(d.Get("https_port").(int))), + Priority: utils.Int32(int32(d.Get("priority").(int))), + Weight: utils.Int32(int32(d.Get("weight").(int))), + } + + if originHostHeader := d.Get("origin_host_header").(string); originHostHeader != "" { + props.OriginHostHeader = utils.String(originHostHeader) + } + + expanded, err := expandPrivateLinkSettings(d.Get("private_link").([]interface{}), skuName, enableCertNameCheck) + if err != nil { + return err + } + props.SharedPrivateLinkResource = expanded + + payload := cdn.AFDOrigin{ + AFDOriginProperties: props, + } + + future, err := client.Create(ctx, id.ResourceGroup, id.ProfileName, id.OriginGroupName, id.OriginName, payload) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the creation of %s: %+v", id, err) + } + + d.SetId(id.ID()) + return resourceCdnFrontDoorOriginRead(d, meta) +} + +func resourceCdnFrontDoorOriginRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorOriginsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.FrontDoorOriginID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.OriginGroupName, id.OriginName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + d.SetId("") + return nil + } + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + d.Set("name", id.OriginName) + d.Set("cdn_frontdoor_origin_group_id", parse.NewFrontDoorOriginGroupID(id.SubscriptionId, id.ResourceGroup, id.ProfileName, id.OriginGroupName).ID()) + + if props := resp.AFDOriginProperties; props != nil { + if err := d.Set("private_link", flattenPrivateLinkSettings(props.SharedPrivateLinkResource)); err != nil { + return fmt.Errorf("setting `private_link`: %+v", err) + } + + d.Set("certificate_name_check_enabled", props.EnforceCertificateNameCheck) + d.Set("health_probes_enabled", flattenEnabledBool(props.EnabledState)) + d.Set("host_name", props.HostName) + d.Set("http_port", props.HTTPPort) + d.Set("https_port", props.HTTPSPort) + d.Set("origin_host_header", props.OriginHostHeader) + d.Set("priority", props.Priority) + d.Set("weight", props.Weight) + } + + return nil +} + +func resourceCdnFrontDoorOriginUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorOriginsClient + profileClient := meta.(*clients.Client).Cdn.FrontDoorProfileClient + ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.FrontDoorOriginID(d.Id()) + if err != nil { + return err + } + + params := cdn.AFDOriginUpdatePropertiesParameters{} + + if d.HasChange("certificate_name_check_enabled") { + params.EnforceCertificateNameCheck = utils.Bool(d.Get("certificate_name_check_enabled").(bool)) + } + if d.HasChange("health_probes_enabled") { + params.EnabledState = expandEnabledBool(d.Get("health_probes_enabled").(bool)) + } + if d.HasChange("host_name") { + params.HostName = utils.String(d.Get("host_name").(string)) + } + if d.HasChange("http_port") { + params.HTTPPort = utils.Int32(int32(d.Get("http_port").(int))) + } + if d.HasChange("https_port") { + params.HTTPSPort = utils.Int32(int32(d.Get("https_port").(int))) + } + if d.HasChange("origin_host_header") { + params.OriginHostHeader = utils.String(d.Get("origin_host_header").(string)) + } + if d.HasChange("private_link") { + // I need to get the profile SKU so I know if it is valid or not to define a private link as + // private links are only allowed in the premium sku... + profileId := parse.NewFrontDoorProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName) + profile, err := profileClient.Get(ctx, profileId.ResourceGroup, profileId.ProfileName) + if err != nil { + if utils.ResponseWasNotFound(profile.Response) { + return fmt.Errorf("retrieving parent %s: not found", profileId) + } + + return fmt.Errorf("retrieving parent %s: %+v", profileId, err) + } + if profile.Sku == nil { + return fmt.Errorf("retrieving parent %s: `sku` was nil", profileId) + } + skuName := profile.Sku.Name + + enableCertNameCheck := d.Get("certificate_name_check_enabled").(bool) + privateLinkSettings, err := expandPrivateLinkSettings(d.Get("private_link").([]interface{}), skuName, enableCertNameCheck) + if err != nil { + return err + } + params.SharedPrivateLinkResource = privateLinkSettings + } + if d.HasChange("priority") { + params.Priority = utils.Int32(int32(d.Get("priority").(int))) + } + if d.HasChange("weight") { + params.Weight = utils.Int32(int32(d.Get("weight").(int))) + } + + payload := cdn.AFDOriginUpdateParameters{ + AFDOriginUpdatePropertiesParameters: ¶ms, + } + future, err := client.Update(ctx, id.ResourceGroup, id.ProfileName, id.OriginGroupName, id.OriginName, payload) + if err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the update of %s: %+v", *id, err) + } + + return resourceCdnFrontDoorOriginRead(d, meta) +} + +func resourceCdnFrontDoorOriginDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorOriginsClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.FrontDoorOriginID(d.Id()) + if err != nil { + return err + } + + // @tombuildsstuff: JC/WS to dig into if we need to conditionally remove the Private Link + // via an Update before deletion - presumably we'd also need a Lock on the private link resource + + /* + original: + // TODO: Check to see if there is a Load Balancer Private Link connected, + // if so disconnect the Private Link association with the Frontdoor Origin + // else the destroy will fail because the Private Link Service has an active + // Private Link Endpoint connection... + + // It looks like Frontdoor does remove the Private link, I just need to poll here until it is removed... + // Investigate this further... + // WS: There is a bug in the service code, for only the load balancer scenario, the private link connection is not removed until the + // origin is totally destroyed. The workaround for this issue is to put a depends_on the private link service to the origin so the origin + // will be deleted first before the private link service is destroyed. + */ + + future, err := client.Delete(ctx, id.ResourceGroup, id.ProfileName, id.OriginGroupName, id.OriginName) + if err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) + } + + return nil +} + +func expandPrivateLinkSettings(input []interface{}, skuName cdn.SkuName, enableCertNameCheck bool) (*cdn.SharedPrivateLinkResourceProperties, error) { + if len(input) == 0 { + // TODO: Should this return an empty object? + // WS: This cannot return an empty object, the service team requires this to be set to nil else you will get the following error during creation: + // Property 'AfdOrigin.SharedPrivateLinkResource.PrivateLink' is required but it was not set; Property 'AfdOrigin.SharedPrivateLinkResource.RequestMessage' is required but it was not set + return nil, nil + } + + if skuName != cdn.SkuNamePremiumAzureFrontDoor { + return nil, fmt.Errorf("the `private_link` field can only be configured when the Frontdoor Profile is using a %q SKU, got %q", cdn.SkuNamePremiumAzureFrontDoor, skuName) + } + + if !enableCertNameCheck { + return nil, fmt.Errorf("the `private_link` field can only be configured when `certificate_name_check_enabled` is set to `true`") + } + + // Check if this a Load Balancer Private Link or not, the Load Balancer Private Link requires + // that you stand up your own Private Link Service, which is why I am attempting to parse a + // Private Link Service ID here... + settings := input[0].(map[string]interface{}) + targetType := settings["target_type"].(string) + _, err := privateLinkServiceParse.PrivateLinkServiceID(settings["private_link_target_id"].(string)) + if err != nil && targetType == "" { + // It is not a Load Balancer and the Target Type is empty, which is invalid... + return nil, fmt.Errorf("either `private_link` or `target_type` must be specified") + } + + config := input[0].(map[string]interface{}) + + resourceId := config["private_link_target_id"].(string) + location := location.Normalize(config["location"].(string)) + groupId := config["target_type"].(string) + requestMessage := config["request_message"].(string) + + return &cdn.SharedPrivateLinkResourceProperties{ + PrivateLink: &cdn.ResourceReference{ + ID: utils.String(resourceId), + }, + GroupID: utils.String(groupId), + PrivateLinkLocation: utils.String(location), + RequestMessage: utils.String(requestMessage), + }, nil +} + +func flattenPrivateLinkSettings(input *cdn.SharedPrivateLinkResourceProperties) []interface{} { + if input == nil { + return []interface{}{} + } + + privateLinkTargetId := "" + if input.PrivateLink != nil && input.PrivateLink.ID != nil { + privateLinkTargetId = *input.PrivateLink.ID + } + + requestMessage := "" + if input.RequestMessage != nil { + requestMessage = *input.RequestMessage + } + + targetType := "" + if input.GroupID != nil { + targetType = *input.GroupID + } + + return []interface{}{ + map[string]interface{}{ + "location": location.NormalizeNilable(input.PrivateLinkLocation), + "private_link_target_id": privateLinkTargetId, + "request_message": requestMessage, + "target_type": targetType, + }, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_security_policy_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_security_policy_resource.go new file mode 100644 index 00000000000..493d02081da --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/cdn_frontdoor_security_policy_resource.go @@ -0,0 +1,281 @@ +package cdn + +import ( + "fmt" + "strings" + "time" + + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + cdnfrontdoorsecurityparams "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/frontdoorsecurityparams" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceCdnFrontDoorSecurityPolicy() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceCdnFrontdoorSecurityPolicyCreate, + Read: resourceCdnFrontdoorSecurityPolicyRead, + Delete: resourceCdnFrontdoorSecurityPolicyDelete, + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.FrontDoorSecurityPolicyID(id) + return err + }), + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "cdn_frontdoor_profile_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.FrontDoorProfileID, + }, + + "security_policies": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + + "firewall": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + + "cdn_frontdoor_firewall_policy_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.FrontDoorFirewallPolicyID, + }, + + "association": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + + // NOTE: The max number of domains vary depending on sku: 100 Standard, 500 Premium + "domain": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 500, + + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "cdn_frontdoor_domain_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.FrontDoorSecurityPolicyDomainID, + }, + + "active": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + }, + }, + }, + + // NOTE: Per the service team the only acceptable value as of GA is "/*" + "patterns_to_match": { + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + "/*", + }, false), + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func resourceCdnFrontdoorSecurityPolicyCreate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorSecurityPoliciesClient + ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) + defer cancel() + + // NOTE: The profile id is used to retrieve properties from the related profile that must match in this security policy + profileId, err := parse.FrontDoorProfileID(d.Get("cdn_frontdoor_profile_id").(string)) + if err != nil { + return err + } + + securityPolicyName := d.Get("name").(string) + id := parse.NewFrontDoorSecurityPolicyID(profileId.SubscriptionId, profileId.ResourceGroup, profileId.ProfileName, securityPolicyName) + + existing, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.SecurityPolicyName) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + } + + if !utils.ResponseWasNotFound(existing.Response) { + return tf.ImportAsExistsError("azurerm_cdn_frontdoor_security_policy", id.ID()) + } + + profileClient := meta.(*clients.Client).Cdn.FrontDoorProfileClient + profile, err := profileClient.Get(ctx, profileId.ResourceGroup, profileId.ProfileName) + if err != nil { + return fmt.Errorf("unable to retrieve the %q from the linked %q: %+v", "sku_name", "azurerm_cdn_frontdoor_profile", err) + } + + if profile.Sku == nil { + return fmt.Errorf("retreving the parent %q: `sku` was nil", *profileId) + } + + isStandardSku := strings.HasPrefix(strings.ToLower(string(profile.Sku.Name)), "standard") + + params, err := cdnfrontdoorsecurityparams.ExpandCdnFrontdoorFirewallPolicyParameters(d.Get("security_policies").([]interface{}), isStandardSku) + if err != nil { + return fmt.Errorf("expanding %q: %+v", "security_policies", err) + } + + props := cdn.SecurityPolicy{ + SecurityPolicyProperties: &cdn.SecurityPolicyProperties{ + Parameters: params, + }, + } + + future, err := client.Create(ctx, id.ResourceGroup, id.ProfileName, id.SecurityPolicyName, props) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the creation of %s: %+v", id, err) + } + + d.SetId(id.ID()) + return resourceCdnFrontdoorSecurityPolicyRead(d, meta) +} + +func resourceCdnFrontdoorSecurityPolicyRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorSecurityPoliciesClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.FrontDoorSecurityPolicyID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.ProfileName, id.SecurityPolicyName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + d.SetId("") + return nil + } + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + d.Set("name", id.SecurityPolicyName) + d.Set("cdn_frontdoor_profile_id", parse.NewFrontDoorProfileID(id.SubscriptionId, id.ResourceGroup, id.ProfileName).ID()) + + if props := resp.SecurityPolicyProperties; props != nil { + waf, ok := props.Parameters.AsSecurityPolicyWebApplicationFirewallParameters() + if !ok { + return fmt.Errorf("flattening %s: %s", id, "expected security policy web application firewall parameters") + } + + // we know it's a firewall policy at this point, + // create the objects to hold the policy data + associations := make([]interface{}, 0) + + wafPolicyId := "" + if waf.WafPolicy != nil && waf.WafPolicy.ID != nil { + wafPolicyId = *waf.WafPolicy.ID + } + + if waf.Associations != nil { + for _, item := range *waf.Associations { + associations = append(associations, map[string]interface{}{ + "domain": cdnfrontdoorsecurityparams.FlattenSecurityPoliciesActivatedResourceReference(item.Domains), + "patterns_to_match": utils.FlattenStringSlice(item.PatternsToMatch), + }) + } + } + + securityPolicy := []interface{}{ + map[string]interface{}{ + "firewall": []interface{}{ + map[string]interface{}{ + "association": associations, + "cdn_frontdoor_firewall_policy_id": wafPolicyId, + }, + }, + }, + } + + d.Set("security_policies", securityPolicy) + } + + return nil +} + +func resourceCdnFrontdoorSecurityPolicyDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Cdn.FrontDoorSecurityPoliciesClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.FrontDoorSecurityPolicyID(d.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.ProfileName, id.SecurityPolicyName) + if err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/client/client.go index f805f89c9e1..bf75b270da9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/client/client.go @@ -8,20 +8,20 @@ import ( ) type Client struct { - FrontDoorEndpointsClient *cdnFrontDoorSdk.AFDEndpointsClient - FrontDoorOriginGroupsClient *cdnFrontDoorSdk.AFDOriginGroupsClient - FrontDoorOriginsClient *cdnFrontDoorSdk.AFDOriginsClient - FrontDoorCustomDomainsClient *cdnFrontDoorSdk.AFDCustomDomainsClient - FrontDoorSecurityPoliciesClient *cdnFrontDoorSdk.SecurityPoliciesClient - FrontDoorRoutesClient *cdnFrontDoorSdk.RoutesClient - FrontDoorRulesClient *cdnFrontDoorSdk.RulesClient - FrontDoorProfileClient *cdnFrontDoorSdk.ProfilesClient - FrontDoorSecretsClient *cdnFrontDoorSdk.SecretsClient - FrontDoorRuleSetsClient *cdnFrontDoorSdk.RuleSetsClient - FrontDoorLegacyPoliciesClient *frontdoor.PoliciesClient - CustomDomainsClient *cdnSdk.CustomDomainsClient - EndpointsClient *cdnSdk.EndpointsClient - ProfilesClient *cdnSdk.ProfilesClient + FrontDoorEndpointsClient *cdnFrontDoorSdk.AFDEndpointsClient + FrontDoorOriginGroupsClient *cdnFrontDoorSdk.AFDOriginGroupsClient + FrontDoorOriginsClient *cdnFrontDoorSdk.AFDOriginsClient + FrontDoorCustomDomainsClient *cdnFrontDoorSdk.AFDCustomDomainsClient + FrontDoorSecurityPoliciesClient *cdnFrontDoorSdk.SecurityPoliciesClient + FrontDoorRoutesClient *cdnFrontDoorSdk.RoutesClient + FrontDoorRulesClient *cdnFrontDoorSdk.RulesClient + FrontDoorProfileClient *cdnFrontDoorSdk.ProfilesClient + FrontDoorSecretsClient *cdnFrontDoorSdk.SecretsClient + FrontDoorRuleSetsClient *cdnFrontDoorSdk.RuleSetsClient + FrontDoorLegacyFirewallPoliciesClient *frontdoor.PoliciesClient + CustomDomainsClient *cdnSdk.CustomDomainsClient + EndpointsClient *cdnSdk.EndpointsClient + ProfilesClient *cdnSdk.ProfilesClient } func NewClient(o *common.ClientOptions) *Client { @@ -40,8 +40,8 @@ func NewClient(o *common.ClientOptions) *Client { frontDoorPolicySecurityPoliciesClient := cdnFrontDoorSdk.NewSecurityPoliciesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&frontDoorPolicySecurityPoliciesClient.Client, o.ResourceManagerAuthorizer) - frontDoorLegacyPoliciesClient := frontdoor.NewPoliciesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&frontDoorLegacyPoliciesClient.Client, o.ResourceManagerAuthorizer) + frontDoorLegacyFirewallPoliciesClient := frontdoor.NewPoliciesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&frontDoorLegacyFirewallPoliciesClient.Client, o.ResourceManagerAuthorizer) frontDoorRoutesClient := cdnFrontDoorSdk.NewRoutesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&frontDoorRoutesClient.Client, o.ResourceManagerAuthorizer) @@ -68,19 +68,19 @@ func NewClient(o *common.ClientOptions) *Client { o.ConfigureClient(&profilesClient.Client, o.ResourceManagerAuthorizer) return &Client{ - FrontDoorEndpointsClient: &frontDoorEndpointsClient, - FrontDoorOriginGroupsClient: &frontDoorOriginGroupsClient, - FrontDoorOriginsClient: &frontDoorOriginsClient, - FrontDoorCustomDomainsClient: &frontDoorCustomDomainsClient, - FrontDoorSecurityPoliciesClient: &frontDoorPolicySecurityPoliciesClient, - FrontDoorRoutesClient: &frontDoorRoutesClient, - FrontDoorRulesClient: &frontDoorRulesClient, - FrontDoorProfileClient: &frontDoorProfilesClient, - FrontDoorSecretsClient: &frontDoorPolicySecretsClient, - FrontDoorRuleSetsClient: &frontDoorRuleSetsClient, - FrontDoorLegacyPoliciesClient: &frontDoorLegacyPoliciesClient, - CustomDomainsClient: &customDomainsClient, - EndpointsClient: &endpointsClient, - ProfilesClient: &profilesClient, + FrontDoorEndpointsClient: &frontDoorEndpointsClient, + FrontDoorOriginGroupsClient: &frontDoorOriginGroupsClient, + FrontDoorOriginsClient: &frontDoorOriginsClient, + FrontDoorCustomDomainsClient: &frontDoorCustomDomainsClient, + FrontDoorSecurityPoliciesClient: &frontDoorPolicySecurityPoliciesClient, + FrontDoorRoutesClient: &frontDoorRoutesClient, + FrontDoorRulesClient: &frontDoorRulesClient, + FrontDoorProfileClient: &frontDoorProfilesClient, + FrontDoorSecretsClient: &frontDoorPolicySecretsClient, + FrontDoorRuleSetsClient: &frontDoorRuleSetsClient, + FrontDoorLegacyFirewallPoliciesClient: &frontDoorLegacyFirewallPoliciesClient, + CustomDomainsClient: &customDomainsClient, + EndpointsClient: &endpointsClient, + ProfilesClient: &profilesClient, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/frontdoorsecurityparams/cdn_frontdoor_security_params.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/frontdoorsecurityparams/cdn_frontdoor_security_params.go new file mode 100644 index 00000000000..f3daa9df11c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/frontdoorsecurityparams/cdn_frontdoor_security_params.go @@ -0,0 +1,110 @@ +package cdnfrontdoorsecurityparams + +import ( + "fmt" + + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type CdnFrontdoorSecurityParameters struct { + TypeName cdn.Type + ConfigName string +} + +type CdnFrontdoorSecurityMappings struct { + Firewall CdnFrontdoorSecurityParameters +} + +func ExpandCdnFrontdoorFirewallPolicyParameters(input []interface{}, isStandardSku bool) (*cdn.SecurityPolicyWebApplicationFirewallParameters, error) { + results := cdn.SecurityPolicyWebApplicationFirewallParameters{} + if len(input) == 0 { + return &results, nil + } + + associations := make([]cdn.SecurityPolicyWebApplicationFirewallAssociation, 0) + + // pull off only the firewall policy from the security_policies list + policyType := input[0].(map[string]interface{}) + firewallPolicy := policyType["firewall"].([]interface{}) + v := firewallPolicy[0].(map[string]interface{}) + + if id := v["cdn_frontdoor_firewall_policy_id"].(string); id != "" { + results.WafPolicy = &cdn.ResourceReference{ + ID: utils.String(id), + } + } + + configAssociations := v["association"].([]interface{}) + + for _, item := range configAssociations { + v := item.(map[string]interface{}) + domains := expandSecurityPoliciesActivatedResourceReference(v["domain"].([]interface{})) + + if isStandardSku { + if len(*domains) > 100 { + return &results, fmt.Errorf("the %q sku is only allowed to have 100 or less domains associated with the firewall policy, got %d", cdn.SkuNameStandardAzureFrontDoor, len(*domains)) + } + } else { + if len(*domains) > 500 { + return &results, fmt.Errorf("the %q sku is only allowed to have 500 or less domains associated with the firewall policy, got %d", cdn.SkuNamePremiumAzureFrontDoor, len(*domains)) + } + } + + association := cdn.SecurityPolicyWebApplicationFirewallAssociation{ + Domains: domains, + PatternsToMatch: utils.ExpandStringSlice(v["patterns_to_match"].([]interface{})), + } + + associations = append(associations, association) + } + + results.Associations = &associations + + return &results, nil +} + +func expandSecurityPoliciesActivatedResourceReference(input []interface{}) *[]cdn.ActivatedResourceReference { + results := make([]cdn.ActivatedResourceReference, 0) + if len(input) == 0 { + return &results + } + + for _, item := range input { + v := item.(map[string]interface{}) + + if id := v["cdn_frontdoor_domain_id"].(string); id != "" { + results = append(results, cdn.ActivatedResourceReference{ + ID: utils.String(id), + }) + } + } + + return &results +} + +func FlattenSecurityPoliciesActivatedResourceReference(input *[]cdn.ActivatedResourceReference) []interface{} { + results := make([]interface{}, 0) + if input == nil { + return results + } + + for _, item := range *input { + frontDoorDomainId := "" + if item.ID != nil { + frontDoorDomainId = *item.ID + } + + active := false + if item.IsActive != nil { + active = *item.IsActive + } + + results = append(results, map[string]interface{}{ + "active": active, + "cdn_frontdoor_domain_id": frontDoorDomainId, + }) + } + + return results +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/front_door_custom_domain.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/front_door_custom_domain.go new file mode 100644 index 00000000000..4d13da872b6 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/front_door_custom_domain.go @@ -0,0 +1,131 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type FrontDoorCustomDomainId struct { + SubscriptionId string + ResourceGroup string + ProfileName string + CustomDomainName string +} + +func NewFrontDoorCustomDomainID(subscriptionId, resourceGroup, profileName, customDomainName string) FrontDoorCustomDomainId { + return FrontDoorCustomDomainId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + ProfileName: profileName, + CustomDomainName: customDomainName, + } +} + +func (id FrontDoorCustomDomainId) String() string { + segments := []string{ + fmt.Sprintf("Custom Domain Name %q", id.CustomDomainName), + fmt.Sprintf("Profile Name %q", id.ProfileName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Front Door Custom Domain", segmentsStr) +} + +func (id FrontDoorCustomDomainId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s/customDomains/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ProfileName, id.CustomDomainName) +} + +// FrontDoorCustomDomainID parses a FrontDoorCustomDomain ID into an FrontDoorCustomDomainId struct +func FrontDoorCustomDomainID(input string) (*FrontDoorCustomDomainId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FrontDoorCustomDomainId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.ProfileName, err = id.PopSegment("profiles"); err != nil { + return nil, err + } + if resourceId.CustomDomainName, err = id.PopSegment("customDomains"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} + +// FrontDoorCustomDomainIDInsensitively parses an FrontDoorCustomDomain ID into an FrontDoorCustomDomainId struct, insensitively +// This should only be used to parse an ID for rewriting, the FrontDoorCustomDomainID +// method should be used instead for validation etc. +// +// Whilst this may seem strange, this enables Terraform have consistent casing +// which works around issues in Core, whilst handling broken API responses. +func FrontDoorCustomDomainIDInsensitively(input string) (*FrontDoorCustomDomainId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FrontDoorCustomDomainId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + // find the correct casing for the 'profiles' segment + profilesKey := "profiles" + for key := range id.Path { + if strings.EqualFold(key, profilesKey) { + profilesKey = key + break + } + } + if resourceId.ProfileName, err = id.PopSegment(profilesKey); err != nil { + return nil, err + } + + // find the correct casing for the 'customDomains' segment + customDomainsKey := "customDomains" + for key := range id.Path { + if strings.EqualFold(key, customDomainsKey) { + customDomainsKey = key + break + } + } + if resourceId.CustomDomainName, err = id.PopSegment(customDomainsKey); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/front_door_firewall_policy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/front_door_firewall_policy.go new file mode 100644 index 00000000000..89aed188c84 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/front_door_firewall_policy.go @@ -0,0 +1,113 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type FrontDoorFirewallPolicyId struct { + SubscriptionId string + ResourceGroup string + FrontDoorWebApplicationFirewallPolicyName string +} + +func NewFrontDoorFirewallPolicyID(subscriptionId, resourceGroup, frontDoorWebApplicationFirewallPolicyName string) FrontDoorFirewallPolicyId { + return FrontDoorFirewallPolicyId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + FrontDoorWebApplicationFirewallPolicyName: frontDoorWebApplicationFirewallPolicyName, + } +} + +func (id FrontDoorFirewallPolicyId) String() string { + segments := []string{ + fmt.Sprintf("Front Door Web Application Firewall Policy Name %q", id.FrontDoorWebApplicationFirewallPolicyName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Front Door Firewall Policy", segmentsStr) +} + +func (id FrontDoorFirewallPolicyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.FrontDoorWebApplicationFirewallPolicyName) +} + +// FrontDoorFirewallPolicyID parses a FrontDoorFirewallPolicy ID into an FrontDoorFirewallPolicyId struct +func FrontDoorFirewallPolicyID(input string) (*FrontDoorFirewallPolicyId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FrontDoorFirewallPolicyId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.FrontDoorWebApplicationFirewallPolicyName, err = id.PopSegment("frontDoorWebApplicationFirewallPolicies"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} + +// FrontDoorFirewallPolicyIDInsensitively parses an FrontDoorFirewallPolicy ID into an FrontDoorFirewallPolicyId struct, insensitively +// This should only be used to parse an ID for rewriting, the FrontDoorFirewallPolicyID +// method should be used instead for validation etc. +// +// Whilst this may seem strange, this enables Terraform have consistent casing +// which works around issues in Core, whilst handling broken API responses. +func FrontDoorFirewallPolicyIDInsensitively(input string) (*FrontDoorFirewallPolicyId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FrontDoorFirewallPolicyId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + // find the correct casing for the 'frontDoorWebApplicationFirewallPolicies' segment + frontDoorWebApplicationFirewallPoliciesKey := "frontDoorWebApplicationFirewallPolicies" + for key := range id.Path { + if strings.EqualFold(key, frontDoorWebApplicationFirewallPoliciesKey) { + frontDoorWebApplicationFirewallPoliciesKey = key + break + } + } + if resourceId.FrontDoorWebApplicationFirewallPolicyName, err = id.PopSegment(frontDoorWebApplicationFirewallPoliciesKey); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/front_door_origin.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/front_door_origin.go new file mode 100644 index 00000000000..ac7a7444942 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/front_door_origin.go @@ -0,0 +1,149 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type FrontDoorOriginId struct { + SubscriptionId string + ResourceGroup string + ProfileName string + OriginGroupName string + OriginName string +} + +func NewFrontDoorOriginID(subscriptionId, resourceGroup, profileName, originGroupName, originName string) FrontDoorOriginId { + return FrontDoorOriginId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + ProfileName: profileName, + OriginGroupName: originGroupName, + OriginName: originName, + } +} + +func (id FrontDoorOriginId) String() string { + segments := []string{ + fmt.Sprintf("Origin Name %q", id.OriginName), + fmt.Sprintf("Origin Group Name %q", id.OriginGroupName), + fmt.Sprintf("Profile Name %q", id.ProfileName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Front Door Origin", segmentsStr) +} + +func (id FrontDoorOriginId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s/originGroups/%s/origins/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ProfileName, id.OriginGroupName, id.OriginName) +} + +// FrontDoorOriginID parses a FrontDoorOrigin ID into an FrontDoorOriginId struct +func FrontDoorOriginID(input string) (*FrontDoorOriginId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FrontDoorOriginId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.ProfileName, err = id.PopSegment("profiles"); err != nil { + return nil, err + } + if resourceId.OriginGroupName, err = id.PopSegment("originGroups"); err != nil { + return nil, err + } + if resourceId.OriginName, err = id.PopSegment("origins"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} + +// FrontDoorOriginIDInsensitively parses an FrontDoorOrigin ID into an FrontDoorOriginId struct, insensitively +// This should only be used to parse an ID for rewriting, the FrontDoorOriginID +// method should be used instead for validation etc. +// +// Whilst this may seem strange, this enables Terraform have consistent casing +// which works around issues in Core, whilst handling broken API responses. +func FrontDoorOriginIDInsensitively(input string) (*FrontDoorOriginId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FrontDoorOriginId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + // find the correct casing for the 'profiles' segment + profilesKey := "profiles" + for key := range id.Path { + if strings.EqualFold(key, profilesKey) { + profilesKey = key + break + } + } + if resourceId.ProfileName, err = id.PopSegment(profilesKey); err != nil { + return nil, err + } + + // find the correct casing for the 'originGroups' segment + originGroupsKey := "originGroups" + for key := range id.Path { + if strings.EqualFold(key, originGroupsKey) { + originGroupsKey = key + break + } + } + if resourceId.OriginGroupName, err = id.PopSegment(originGroupsKey); err != nil { + return nil, err + } + + // find the correct casing for the 'origins' segment + originsKey := "origins" + for key := range id.Path { + if strings.EqualFold(key, originsKey) { + originsKey = key + break + } + } + if resourceId.OriginName, err = id.PopSegment(originsKey); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/front_door_origin_group.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/front_door_origin_group.go new file mode 100644 index 00000000000..fe1739596e7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/front_door_origin_group.go @@ -0,0 +1,131 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type FrontDoorOriginGroupId struct { + SubscriptionId string + ResourceGroup string + ProfileName string + OriginGroupName string +} + +func NewFrontDoorOriginGroupID(subscriptionId, resourceGroup, profileName, originGroupName string) FrontDoorOriginGroupId { + return FrontDoorOriginGroupId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + ProfileName: profileName, + OriginGroupName: originGroupName, + } +} + +func (id FrontDoorOriginGroupId) String() string { + segments := []string{ + fmt.Sprintf("Origin Group Name %q", id.OriginGroupName), + fmt.Sprintf("Profile Name %q", id.ProfileName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Front Door Origin Group", segmentsStr) +} + +func (id FrontDoorOriginGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s/originGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ProfileName, id.OriginGroupName) +} + +// FrontDoorOriginGroupID parses a FrontDoorOriginGroup ID into an FrontDoorOriginGroupId struct +func FrontDoorOriginGroupID(input string) (*FrontDoorOriginGroupId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FrontDoorOriginGroupId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.ProfileName, err = id.PopSegment("profiles"); err != nil { + return nil, err + } + if resourceId.OriginGroupName, err = id.PopSegment("originGroups"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} + +// FrontDoorOriginGroupIDInsensitively parses an FrontDoorOriginGroup ID into an FrontDoorOriginGroupId struct, insensitively +// This should only be used to parse an ID for rewriting, the FrontDoorOriginGroupID +// method should be used instead for validation etc. +// +// Whilst this may seem strange, this enables Terraform have consistent casing +// which works around issues in Core, whilst handling broken API responses. +func FrontDoorOriginGroupIDInsensitively(input string) (*FrontDoorOriginGroupId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FrontDoorOriginGroupId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + // find the correct casing for the 'profiles' segment + profilesKey := "profiles" + for key := range id.Path { + if strings.EqualFold(key, profilesKey) { + profilesKey = key + break + } + } + if resourceId.ProfileName, err = id.PopSegment(profilesKey); err != nil { + return nil, err + } + + // find the correct casing for the 'originGroups' segment + originGroupsKey := "originGroups" + for key := range id.Path { + if strings.EqualFold(key, originGroupsKey) { + originGroupsKey = key + break + } + } + if resourceId.OriginGroupName, err = id.PopSegment(originGroupsKey); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/front_door_security_policy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/front_door_security_policy.go new file mode 100644 index 00000000000..fa64a9954c4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/front_door_security_policy.go @@ -0,0 +1,131 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type FrontDoorSecurityPolicyId struct { + SubscriptionId string + ResourceGroup string + ProfileName string + SecurityPolicyName string +} + +func NewFrontDoorSecurityPolicyID(subscriptionId, resourceGroup, profileName, securityPolicyName string) FrontDoorSecurityPolicyId { + return FrontDoorSecurityPolicyId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + ProfileName: profileName, + SecurityPolicyName: securityPolicyName, + } +} + +func (id FrontDoorSecurityPolicyId) String() string { + segments := []string{ + fmt.Sprintf("Security Policy Name %q", id.SecurityPolicyName), + fmt.Sprintf("Profile Name %q", id.ProfileName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Front Door Security Policy", segmentsStr) +} + +func (id FrontDoorSecurityPolicyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s/securityPolicies/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ProfileName, id.SecurityPolicyName) +} + +// FrontDoorSecurityPolicyID parses a FrontDoorSecurityPolicy ID into an FrontDoorSecurityPolicyId struct +func FrontDoorSecurityPolicyID(input string) (*FrontDoorSecurityPolicyId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FrontDoorSecurityPolicyId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.ProfileName, err = id.PopSegment("profiles"); err != nil { + return nil, err + } + if resourceId.SecurityPolicyName, err = id.PopSegment("securityPolicies"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} + +// FrontDoorSecurityPolicyIDInsensitively parses an FrontDoorSecurityPolicy ID into an FrontDoorSecurityPolicyId struct, insensitively +// This should only be used to parse an ID for rewriting, the FrontDoorSecurityPolicyID +// method should be used instead for validation etc. +// +// Whilst this may seem strange, this enables Terraform have consistent casing +// which works around issues in Core, whilst handling broken API responses. +func FrontDoorSecurityPolicyIDInsensitively(input string) (*FrontDoorSecurityPolicyId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FrontDoorSecurityPolicyId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + // find the correct casing for the 'profiles' segment + profilesKey := "profiles" + for key := range id.Path { + if strings.EqualFold(key, profilesKey) { + profilesKey = key + break + } + } + if resourceId.ProfileName, err = id.PopSegment(profilesKey); err != nil { + return nil, err + } + + // find the correct casing for the 'securityPolicies' segment + securityPoliciesKey := "securityPolicies" + for key := range id.Path { + if strings.EqualFold(key, securityPoliciesKey) { + securityPoliciesKey = key + break + } + } + if resourceId.SecurityPolicyName, err = id.PopSegment(securityPoliciesKey); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/frontdoor_custom_domain.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/frontdoor_custom_domain.go new file mode 100644 index 00000000000..3e7576e45d0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse/frontdoor_custom_domain.go @@ -0,0 +1,131 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type FrontdoorCustomDomainId struct { + SubscriptionId string + ResourceGroup string + ProfileName string + CustomDomainName string +} + +func NewFrontdoorCustomDomainID(subscriptionId, resourceGroup, profileName, customDomainName string) FrontdoorCustomDomainId { + return FrontdoorCustomDomainId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + ProfileName: profileName, + CustomDomainName: customDomainName, + } +} + +func (id FrontdoorCustomDomainId) String() string { + segments := []string{ + fmt.Sprintf("Custom Domain Name %q", id.CustomDomainName), + fmt.Sprintf("Profile Name %q", id.ProfileName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Frontdoor Custom Domain", segmentsStr) +} + +func (id FrontdoorCustomDomainId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cdn/profiles/%s/customDomains/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ProfileName, id.CustomDomainName) +} + +// FrontdoorCustomDomainID parses a FrontdoorCustomDomain ID into an FrontdoorCustomDomainId struct +func FrontdoorCustomDomainID(input string) (*FrontdoorCustomDomainId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FrontdoorCustomDomainId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.ProfileName, err = id.PopSegment("profiles"); err != nil { + return nil, err + } + if resourceId.CustomDomainName, err = id.PopSegment("customDomains"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} + +// FrontdoorCustomDomainIDInsensitively parses an FrontdoorCustomDomain ID into an FrontdoorCustomDomainId struct, insensitively +// This should only be used to parse an ID for rewriting, the FrontdoorCustomDomainID +// method should be used instead for validation etc. +// +// Whilst this may seem strange, this enables Terraform have consistent casing +// which works around issues in Core, whilst handling broken API responses. +func FrontdoorCustomDomainIDInsensitively(input string) (*FrontdoorCustomDomainId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FrontdoorCustomDomainId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + // find the correct casing for the 'profiles' segment + profilesKey := "profiles" + for key := range id.Path { + if strings.EqualFold(key, profilesKey) { + profilesKey = key + break + } + } + if resourceId.ProfileName, err = id.PopSegment(profilesKey); err != nil { + return nil, err + } + + // find the correct casing for the 'customDomains' segment + customDomainsKey := "customDomains" + for key := range id.Path { + if strings.EqualFold(key, customDomainsKey) { + customDomainsKey = key + break + } + } + if resourceId.CustomDomainName, err = id.PopSegment(customDomainsKey); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/registration.go index daa1eff667f..84356b8e519 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/registration.go @@ -32,9 +32,10 @@ func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { "azurerm_cdn_profile": dataSourceCdnProfile(), // FrontDoor - "azurerm_cdn_frontdoor_endpoint": dataSourceCdnFrontDoorEndpoint(), - "azurerm_cdn_frontdoor_profile": dataSourceCdnFrontDoorProfile(), - "azurerm_cdn_frontdoor_rule_set": dataSourceCdnFrontDoorRuleSet(), + "azurerm_cdn_frontdoor_endpoint": dataSourceCdnFrontDoorEndpoint(), + "azurerm_cdn_frontdoor_origin_group": dataSourceCdnFrontDoorOriginGroup(), + "azurerm_cdn_frontdoor_profile": dataSourceCdnFrontDoorProfile(), + "azurerm_cdn_frontdoor_rule_set": dataSourceCdnFrontDoorRuleSet(), } } @@ -47,8 +48,12 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { "azurerm_cdn_profile": resourceCdnProfile(), // FrontDoor - "azurerm_cdn_frontdoor_endpoint": resourceCdnFrontDoorEndpoint(), - "azurerm_cdn_frontdoor_profile": resourceCdnFrontDoorProfile(), - "azurerm_cdn_frontdoor_rule_set": resourceCdnFrontDoorRuleSet(), + "azurerm_cdn_frontdoor_endpoint": resourceCdnFrontDoorEndpoint(), + "azurerm_cdn_frontdoor_firewall_policy": resourceCdnFrontDoorFirewallPolicy(), + "azurerm_cdn_frontdoor_origin": resourceCdnFrontDoorOrigin(), + "azurerm_cdn_frontdoor_origin_group": resourceCdnFrontDoorOriginGroup(), + "azurerm_cdn_frontdoor_profile": resourceCdnFrontDoorProfile(), + "azurerm_cdn_frontdoor_rule_set": resourceCdnFrontDoorRuleSet(), + "azurerm_cdn_frontdoor_security_policy": resourceCdnFrontDoorSecurityPolicy(), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/resourceids.go index 8c08a9e353f..fe6e58d9c0c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/resourceids.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/resourceids.go @@ -6,7 +6,12 @@ package cdn //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=CustomDomain -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/endpoints/endpoint1/customDomains/domain1 // CDN FrontDoor -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorEndpoint -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/endpoint1 -rewrite=true -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorProfile -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/profile1 -rewrite=true -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorRuleSet -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/profile1/ruleSets/ruleSet1 -rewrite=true -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/profile1/ruleSets/ruleSet1/rules/rule1 -rewrite=true +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorCustomDomain -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/customDomains/customDomain1 -rewrite=true +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorEndpoint -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/afdEndpoints/endpoint1 -rewrite=true +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorFirewallPolicy -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/policy1 -rewrite=true +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorOrigin -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/originGroups/originGroup1/origins/origin1 -rewrite=true +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorOriginGroup -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/originGroups/originGroup1 -rewrite=true +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorProfile -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1 -rewrite=true +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorRuleSet -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/ruleSets/ruleSet1 -rewrite=true +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/ruleSets/ruleSet1/rules/rule1 -rewrite=true +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FrontDoorSecurityPolicy -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Cdn/profiles/profile1/securityPolicies/securityPolicy1 -rewrite=true diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/cdn.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/cdn.go index 54034e4a9e9..daf4c329b8e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/cdn.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/cdn.go @@ -12,21 +12,21 @@ import ( func EndpointDeliveryRuleName() pluginsdk.SchemaValidateFunc { return validation.StringMatch( regexp.MustCompile("^[a-zA-Z][a-zA-Z0-9]*$"), - "The Delivery Rule Name must start with a letter any may only contain letters and numbers.", + "the Delivery Rule Name must start with a letter any may only contain letters and numbers", ) } func RuleActionCacheExpirationDuration() pluginsdk.SchemaValidateFunc { return validation.StringMatch( regexp.MustCompile(`^(\d+\.)?([0-1][0-9]|[2][0-3]):[0-5][0-9]:[0-5][0-9]$`), - "The Cache duration must be in this format [d.]hh:mm:ss.", + "the Cache duration must be in this format [d.]hh:mm:ss", ) } func RuleActionUrlRedirectPath() pluginsdk.SchemaValidateFunc { return validation.StringMatch( regexp.MustCompile("^(/.*)?$"), - "The Url Redirect Path must start with a slash.", + "the Url Redirect Path must start with a slash", ) } @@ -35,19 +35,19 @@ func RuleActionUrlRedirectQueryString() pluginsdk.SchemaValidateFunc { querystring := i.(string) if len(querystring) > 100 { - return nil, []error{fmt.Errorf("The Url Query String's max length is 100.")} + return nil, []error{fmt.Errorf("the Url Query String's max length is 100")} } re := regexp.MustCompile("^[?&]") if re.MatchString(querystring) { - return nil, []error{fmt.Errorf("The Url Query String must not start with a question mark or ampersand.")} + return nil, []error{fmt.Errorf("the Url Query String must not start with a question mark or ampersand")} } kvre := regexp.MustCompile("^[^?&]+=[^?&]+$") kvs := strings.Split(querystring, "&") for _, kv := range kvs { if len(kv) > 0 && !kvre.MatchString(kv) { - return nil, []error{fmt.Errorf("The Url Query String must be in = format and separated by an ampersand.")} + return nil, []error{fmt.Errorf("the Url Query String must be in = format and separated by an ampersand")} } } @@ -58,20 +58,20 @@ func RuleActionUrlRedirectQueryString() pluginsdk.SchemaValidateFunc { func RuleActionUrlRedirectFragment() pluginsdk.SchemaValidateFunc { return validation.StringMatch( regexp.MustCompile("^([^#].*)?$"), - "The Url Fragment must not start with a hash.", + "the Url Fragment must not start with a hash.", ) } func RuleActionUrlRewriteSourcePattern() pluginsdk.SchemaValidateFunc { return validation.StringMatch( regexp.MustCompile("^/[^\n]{0,259}$"), - "The Url Rewrite Source Pattern must start with a slash and can not have more than 260 characters.", + "the Url Rewrite Source Pattern must start with a slash and can not have more than 260 characters", ) } func RuleActionUrlRewriteDestination() pluginsdk.SchemaValidateFunc { return validation.StringMatch( regexp.MustCompile("^/[^\n]{0,259}$"), - "The Url Rewrite Destination must start with a slash and can not have more than 260 characters.", + "the Url Rewrite Destination must start with a slash and can not have more than 260 characters", ) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_custom_domain_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_custom_domain_id.go new file mode 100644 index 00000000000..e549b2f4120 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_custom_domain_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" +) + +func FrontDoorCustomDomainID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.FrontDoorCustomDomainID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_firewall_policy_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_firewall_policy_id.go new file mode 100644 index 00000000000..8835e3e0baa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_firewall_policy_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" +) + +func FrontDoorFirewallPolicyID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.FrontDoorFirewallPolicyID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_firewall_policy_name.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_firewall_policy_name.go new file mode 100644 index 00000000000..5ceb879a49a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_firewall_policy_name.go @@ -0,0 +1,15 @@ +package validate + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" +) + +func FrontDoorFirewallPolicyName(i interface{}, k string) (_ []string, errors []error) { + if m, regexErrs := validate.RegExHelper(i, k, `(^[a-zA-Z])([\da-zA-Z]{0,127})$`); !m { + return nil, append(regexErrs, fmt.Errorf(`%q must be between 1 and 128 characters in length, must begin with a letter and may only contain letters and numbers`, k)) + } + + return nil, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_origin_group_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_origin_group_id.go new file mode 100644 index 00000000000..9ea19a01282 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_origin_group_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" +) + +func FrontDoorOriginGroupID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.FrontDoorOriginGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_origin_group_name.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_origin_group_name.go new file mode 100644 index 00000000000..85c209b935f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_origin_group_name.go @@ -0,0 +1,15 @@ +package validate + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" +) + +func FrontDoorOriginGroupName(i interface{}, k string) (_ []string, errors []error) { + if m, regexErrs := validate.RegExHelper(i, k, `^[\da-zA-Z][-\da-zA-Z]{0,88}[\da-zA-Z]$`); !m { + return nil, append(regexErrs, fmt.Errorf(`%q must be between 2 and 90 characters in length, begin with a letter or number, end with a letter or number and may contain only letters, numbers and hyphens, got %q`, k, i)) + } + + return nil, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_origin_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_origin_id.go new file mode 100644 index 00000000000..f20ff81b846 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_origin_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" +) + +func FrontDoorOriginID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.FrontDoorOriginID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_origin_name.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_origin_name.go new file mode 100644 index 00000000000..4fd1a1c8648 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_origin_name.go @@ -0,0 +1,15 @@ +package validate + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" +) + +func FrontDoorOriginName(i interface{}, k string) (_ []string, errors []error) { + if m, regexErrs := validate.RegExHelper(i, k, `^[\da-zA-Z][-\da-zA-Z]{0,88}[\da-zA-Z]$`); !m { + return nil, append(regexErrs, fmt.Errorf(`%q must be between 2 and 90 characters in length, begin with a letter or number, end with a letter or number and may contain only letters, numbers and hyphens, got %q`, k, i)) + } + + return nil, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_security_policy_domain_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_security_policy_domain_id.go new file mode 100644 index 00000000000..a3e14075010 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_security_policy_domain_id.go @@ -0,0 +1,24 @@ +package validate + +import ( + "fmt" +) + +func FrontDoorSecurityPolicyDomainID(i interface{}, k string) (_ []string, errors []error) { + _, ok := i.(string) + if !ok { + return nil, []error{fmt.Errorf("%q is invalid: expected type of %q to be string", "domain", k)} + } + + var err []error + + if _, err = FrontDoorCustomDomainID(i, k); err == nil { + return nil, nil + } + + if _, err = FrontDoorEndpointID(i, k); err == nil { + return nil, nil + } + + return nil, []error{fmt.Errorf("%q is invalid: the %q needs to be a valid Frontdoor Custom Domain ID or a Frontdoor Endpoint ID: %+v", "domain", k, err)} +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_security_policy_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_security_policy_id.go new file mode 100644 index 00000000000..1dab539a208 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_security_policy_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse" +) + +func FrontDoorSecurityPolicyID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.FrontDoorSecurityPolicyID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_validation_helpers.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_validation_helpers.go new file mode 100644 index 00000000000..f7bf1019546 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate/front_door_validation_helpers.go @@ -0,0 +1,163 @@ +package validate + +import ( + "fmt" + "strings" + + "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn" + "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" +) + +func CdnFrontDoorRouteName(i interface{}, k string) (_ []string, errors []error) { + if m, regexErrs := validate.RegExHelper(i, k, `^[\da-zA-Z][-\da-zA-Z]{0,88}[\da-zA-Z]$`); !m { + return nil, append(regexErrs, fmt.Errorf(`%q must be between 2 and 90 characters begin with a letter or number, end with a letter or number and may contain only letters, numbers or hyphens, got %q`, k, i)) + } + + return nil, nil +} + +func CdnFrontDoorCacheDuration(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + return nil, []error{fmt.Errorf("expected type of %q to be string", k)} + } + + if strings.HasPrefix(v, "0.") { + return nil, []error{fmt.Errorf(`%q must not begin with %q if the duration is less than 1 day. If the %q is less than 1 day it should be in the HH:MM:SS format, got %q`, k, "0.", k, v)} + } + + if m, _ := validate.RegExHelper(i, k, `^([1-9]|([1-9][0-9])|([1-3][0-6][0-5])).((?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d))$|^((?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d))$`); !m { + return nil, []error{fmt.Errorf(`%q must be between in the d.HH:MM:SS or HH:MM:SS format and must be equal to or lower than %q, got %q`, k, "365.23:59:59", v)} + } + + if v == "00:00:00" { + return nil, []error{fmt.Errorf(`%q must be longer than zero seconds, got %q`, k, v)} + } + + return nil, nil +} + +func CdnFrontDoorUrlPathConditionMatchValue(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + return nil, []error{fmt.Errorf("expected type of %q to be string", k)} + } + + if strings.HasPrefix(v, "/") { + return nil, []error{fmt.Errorf(`%q must not begin with the URLs leading slash(e.g. /), got %q`, k, v)} + } + + return nil, nil +} + +func CdnFrontDoorCustomDomainName(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + return nil, []error{fmt.Errorf("expected type of %q to be string", k)} + } + + if m, _ := validate.RegExHelper(i, k, `^[a-zA-Z0-9][a-zA-Z0-9-]{0,258}[a-zA-Z0-9]$`); !m { + return nil, []error{fmt.Errorf(`%q must be between 2 and 260 characters in length, must begin with a letter or number, end with a letter or number and contain only letters, numbers and hyphens, got %q`, k, v)} + } + + return nil, nil +} + +func CdnFrontDoorSecretName(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + return nil, []error{fmt.Errorf("expected type of %q to be string", k)} + } + + if m, _ := validate.RegExHelper(i, k, `^[a-zA-Z0-9][a-zA-Z0-9-]{0,258}[a-zA-Z0-9]$`); !m { + return nil, []error{fmt.Errorf(`%q must be between 2 and 260 characters in length, must begin with a letter or number, end with a letter or number and contain only letters, numbers and hyphens, got %q`, k, v)} + } + + return nil, nil +} + +func CdnFrontDoorActionsBlock(actions []cdn.BasicDeliveryRuleAction) error { + routeConfigurationOverride := false + responseHeader := false + requestHeader := false + urlRewrite := false + urlRedirect := false + + for _, rule := range actions { + if !routeConfigurationOverride { + _, routeConfigurationOverride = rule.AsDeliveryRuleRouteConfigurationOverrideAction() + } + + if !responseHeader { + _, responseHeader = rule.AsDeliveryRuleResponseHeaderAction() + } + + if !requestHeader { + _, requestHeader = rule.AsDeliveryRuleRequestHeaderAction() + } + + if !urlRewrite { + _, urlRewrite = rule.AsURLRewriteAction() + } + + if !urlRedirect { + _, urlRedirect = rule.AsURLRedirectAction() + } + } + + if urlRedirect && urlRewrite { + return fmt.Errorf("the %q and the %q are both present in the %q match block", "url_redirect_action", "url_rewrite_action", "actions") + } + + return nil +} + +func CdnFrontDoorRuleName(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + return nil, []error{fmt.Errorf("expected type of %q to be string", k)} + } + + if m, _ := validate.RegExHelper(i, k, `^[a-zA-Z][\da-zA-Z]{0,259}$`); !m { + return nil, []error{fmt.Errorf(`%q must be between 1 and 260 characters in length, begin with a letter and may contain only letters and numbers, got %q`, k, v)} + } + + return nil, nil +} + +func CdnFrontDoorUrlRedirectActionQueryString(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + return nil, []error{fmt.Errorf("%q is invalid: expected type of %q to be string", "url_redirect_action", k)} + } + + // Query string must be in = format. ? and & will be added automatically so do not include them. + if v != "" { + if strings.ContainsAny(v, "?&") { + return nil, []error{fmt.Errorf("%q is invalid: %q must not include the %q or the %q characters in the %q field. They will be automatically added by Frontdoor, got %q", "url_redirect_action", k, "?", "&", "query_string", v)} + } + + if m, _ := validate.RegExHelper(i, k, `^(\b[\da-zA-Z\-\._~]*)(={1})((\b[\da-zA-Z\-\._~]*)|(\{{1}\b(socket_ip|client_ip|client_port|hostname|geo_country|http_method|http_version|query_string|request_scheme|request_uri|ssl_protocol|server_port|url_path){1}\}){1})$`); !m { + return nil, []error{fmt.Errorf("%q is invalid: %q must be in the = or ={action_server_variable} format, got %q", "url_redirect_action", k, v)} + } + } else { + return nil, []error{fmt.Errorf("%q is invalid: %q must not be empty, got %q", "url_redirect_action", k, v)} + } + + return nil, nil +} + +func CdnFrontDoorUrlRedirectActionDestinationPath(i interface{}, k string) (_ []string, errors []error) { + v, ok := i.(string) + if !ok { + return nil, []error{fmt.Errorf("%q is invalid: expected type of %q to be string", "url_redirect_action", k)} + } + + if v != "" { + if !strings.HasPrefix(v, "/") { + return nil, []error{fmt.Errorf("%q is invalid: %q must begin with a %q, got %q. If you are trying to preserve the incoming path leave the %q value empty", "url_redirect_action", k, "/", v, "destination_path")} + } + } + + return nil, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/client/client.go index fd8fbeb04c7..df1f1557055 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/client/client.go @@ -1,8 +1,8 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/cognitive_account_customer_managed_key_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/cognitive_account_customer_managed_key_resource.go index a4337d261f2..806f73cc9d4 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/cognitive_account_customer_managed_key_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/cognitive_account_customer_managed_key_resource.go @@ -4,10 +4,10 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/validate" keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/cognitive_account_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/cognitive_account_data_source.go index daab670b32c..bdea0c74474 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/cognitive_account_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/cognitive_account_data_source.go @@ -7,9 +7,9 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" ) @@ -64,7 +64,7 @@ func dataSourceCognitiveAccount() *pluginsdk.Resource { Sensitive: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.Tags(), }, } } @@ -111,7 +111,7 @@ func dataSourceCognitiveAccountRead(d *pluginsdk.ResourceData, meta interface{}) d.Set("endpoint", props.Endpoint) } - return tags.FlattenAndSet(d, flattenTags(model.Tags)) + return tags.FlattenAndSet(d, model.Tags) } return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/cognitive_account_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/cognitive_account_resource.go index b6fbc841532..ad3ae85214c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/cognitive_account_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/cognitive_account_resource.go @@ -10,20 +10,19 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts" + search "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" commonValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - legacyIdentity "github.com/hashicorp/terraform-provider-azurerm/internal/identity" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network" networkParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/set" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -50,7 +49,239 @@ func resourceCognitiveAccount() *pluginsdk.Resource { return err }), - Schema: resourceCognitiveAccountSchema(), + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.CognitiveServicesAccountName(), + }, + + "location": azure.SchemaLocation(), + + "resource_group_name": azure.SchemaResourceGroupName(), + + "kind": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + "Academic", + "AnomalyDetector", + "Bing.Autosuggest", + "Bing.Autosuggest.v7", + "Bing.CustomSearch", + "Bing.Search", + "Bing.Search.v7", + "Bing.Speech", + "Bing.SpellCheck", + "Bing.SpellCheck.v7", + "CognitiveServices", + "ComputerVision", + "ContentModerator", + "CustomSpeech", + "CustomVision.Prediction", + "CustomVision.Training", + "Emotion", + "Face", + "FormRecognizer", + "ImmersiveReader", + "LUIS", + "LUIS.Authoring", + "MetricsAdvisor", + "OpenAI", + "Personalizer", + "QnAMaker", + "Recommendations", + "SpeakerRecognition", + "Speech", + "SpeechServices", + "SpeechTranslation", + "TextAnalytics", + "TextTranslation", + "WebLM", + }, false), + }, + + "sku_name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + "F0", "F1", "S0", "S", "S1", "S2", "S3", "S4", "S5", "S6", "P0", "P1", "P2", "E0", + }, false), + }, + + "custom_subdomain_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "fqdns": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + + "identity": commonschema.SystemAssignedUserAssignedIdentityOptional(), + + "local_auth_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "metrics_advisor_aad_client_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IsUUID, + }, + + "metrics_advisor_aad_tenant_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IsUUID, + }, + + "metrics_advisor_super_user_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "metrics_advisor_website_name": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "network_acls": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + RequiredWith: []string{"custom_subdomain_name"}, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "default_action": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(cognitiveservicesaccounts.NetworkRuleActionAllow), + string(cognitiveservicesaccounts.NetworkRuleActionDeny), + }, false), + }, + "ip_rules": { + Type: pluginsdk.TypeSet, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.Any( + commonValidate.IPv4Address, + commonValidate.CIDR, + ), + }, + Set: set.HashIPv4AddressOrCIDR, + }, + + "virtual_network_rules": { + Type: pluginsdk.TypeSet, + Optional: true, + ConfigMode: pluginsdk.SchemaConfigModeAuto, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "subnet_id": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "ignore_missing_vnet_service_endpoint": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + }, + }, + }, + }, + }, + }, + "outbound_network_access_restricted": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "public_network_access_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "qna_runtime_endpoint": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.IsURLWithHTTPorHTTPS, + }, + + "custom_question_answering_search_service_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: search.ValidateSearchServiceID, + }, + + "custom_question_answering_search_service_key": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "storage": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "storage_account_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: storageValidate.StorageAccountID, + }, + + "identity_client_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.IsUUID, + }, + }, + }, + }, + + "tags": commonschema.Tags(), + + "endpoint": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "primary_access_key": { + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, + }, + + "secondary_access_key": { + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, + }, + }, } } @@ -122,10 +353,10 @@ func resourceCognitiveAccountCreate(d *pluginsdk.ResourceData, meta interface{}) RestrictOutboundNetworkAccess: utils.Bool(d.Get("outbound_network_access_restricted").(bool)), DisableLocalAuth: utils.Bool(!d.Get("local_auth_enabled").(bool)), }, - Tags: expandTags(d.Get("tags").(map[string]interface{})), + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - identity, err := expandCognitiveAccountIdentity(d.Get("identity").([]interface{})) + identity, err := identity.ExpandSystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } @@ -205,10 +436,10 @@ func resourceCognitiveAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) RestrictOutboundNetworkAccess: utils.Bool(d.Get("outbound_network_access_restricted").(bool)), DisableLocalAuth: utils.Bool(!d.Get("local_auth_enabled").(bool)), }, - Tags: expandTags(d.Get("tags").(map[string]interface{})), + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } identityRaw := d.Get("identity").([]interface{}) - identity, err := expandCognitiveAccountIdentity(identityRaw) + identity, err := identity.ExpandSystemAndUserAssignedMap(identityRaw) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } @@ -275,7 +506,7 @@ func resourceCognitiveAccountRead(d *pluginsdk.ResourceData, meta interface{}) e d.Set("sku_name", sku.Name) } - identity, err := flattenCognitiveAccountIdentity(model.Identity) + identity, err := identity.FlattenSystemAndUserAssignedMap(model.Identity) if err != nil { return err } @@ -320,7 +551,7 @@ func resourceCognitiveAccountRead(d *pluginsdk.ResourceData, meta interface{}) e d.Set("local_auth_enabled", localAuthEnabled) } - return tags.FlattenAndSet(d, flattenTags(model.Tags)) + return tags.FlattenAndSet(d, model.Tags) } return nil } @@ -412,10 +643,10 @@ func expandCognitiveAccountNetworkAcls(d *pluginsdk.ResourceData) (*cognitiveser defaultAction := cognitiveservicesaccounts.NetworkRuleAction(v["default_action"].(string)) ipRulesRaw := v["ip_rules"].(*pluginsdk.Set) - ipRules := make([]cognitiveservicesaccounts.IpRule, 0) + ipRules := make([]cognitiveservicesaccounts.IPRule, 0) for _, v := range ipRulesRaw.List() { - rule := cognitiveservicesaccounts.IpRule{ + rule := cognitiveservicesaccounts.IPRule{ Value: v.(string), } ipRules = append(ipRules, rule) @@ -436,7 +667,7 @@ func expandCognitiveAccountNetworkAcls(d *pluginsdk.ResourceData) (*cognitiveser ruleSet := cognitiveservicesaccounts.NetworkRuleSet{ DefaultAction: &defaultAction, - IpRules: &ipRules, + IPRules: &ipRules, VirtualNetworkRules: &networkRules, } return &ruleSet, subnetIds @@ -457,28 +688,6 @@ func expandCognitiveAccountStorage(input []interface{}) *[]cognitiveservicesacco return &results } -func expandCognitiveAccountIdentity(input []interface{}) (*legacyIdentity.SystemUserAssignedIdentityMap, error) { - expanded, err := identity.ExpandSystemAndUserAssignedMap(input) - if err != nil { - return nil, err - } - - intermediate := legacyIdentity.ExpandedConfig{ - Type: legacyIdentity.Type(string(expanded.Type)), - } - - if expanded.Type == identity.TypeUserAssigned || expanded.Type == identity.TypeSystemAssignedUserAssigned { - intermediate.UserAssignedIdentityIds = make([]string, 0) - for k := range expanded.IdentityIds { - intermediate.UserAssignedIdentityIds = append(intermediate.UserAssignedIdentityIds, k) - } - } - - out := legacyIdentity.SystemUserAssignedIdentityMap{} - out.FromExpandedConfig(intermediate) - return &out, nil -} - func expandCognitiveAccountAPIProperties(d *pluginsdk.ResourceData) (*cognitiveservicesaccounts.ApiProperties, error) { props := cognitiveservicesaccounts.ApiProperties{} kind := d.Get("kind") @@ -496,6 +705,13 @@ func expandCognitiveAccountAPIProperties(d *pluginsdk.ResourceData) (*cognitives return nil, fmt.Errorf("the Search Service ID `custom_question_answering_search_service_id` can only be set when kind is set to `TextAnalytics`") } } + if v, ok := d.GetOk("custom_question_answering_search_service_key"); ok { + if kind == "TextAnalytics" { + props.QnaAzureSearchEndpointKey = utils.String(v.(string)) + } else { + return nil, fmt.Errorf("the Search Service Key `custom_question_answering_search_service_key` can only be set when kind is set to `TextAnalytics`") + } + } if v, ok := d.GetOk("metrics_advisor_aad_client_id"); ok { if kind == "MetricsAdvisor" { props.AadClientId = utils.String(v.(string)) @@ -533,8 +749,8 @@ func flattenCognitiveAccountNetworkAcls(input *cognitiveservicesaccounts.Network } ipRules := make([]interface{}, 0) - if input.IpRules != nil { - for _, v := range *input.IpRules { + if input.IPRules != nil { + for _, v := range *input.IPRules { ipRules = append(ipRules, v.Value) } } @@ -581,254 +797,3 @@ func flattenCognitiveAccountStorage(input *[]cognitiveservicesaccounts.UserOwned } return results } - -func flattenCognitiveAccountIdentity(input *legacyIdentity.SystemUserAssignedIdentityMap) (*[]interface{}, error) { - var transform *identity.SystemAndUserAssignedMap - - if input != nil { - expanded := input.ToExpandedConfig() - transform = &identity.SystemAndUserAssignedMap{ - Type: identity.Type(string(expanded.Type)), - IdentityIds: make(map[string]identity.UserAssignedIdentityDetails), - TenantId: expanded.TenantId, - PrincipalId: expanded.PrincipalId, - } - for _, k := range expanded.UserAssignedIdentityIds { - transform.IdentityIds[k] = identity.UserAssignedIdentityDetails{ - // TODO: populate me once the SDK is updated - } - } - } - - return identity.FlattenSystemAndUserAssignedMap(transform) -} - -func resourceCognitiveAccountSchema() map[string]*pluginsdk.Schema { - schema := map[string]*pluginsdk.Schema{ - "name": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validate.CognitiveServicesAccountName(), - }, - - "location": azure.SchemaLocation(), - - "resource_group_name": azure.SchemaResourceGroupName(), - - "kind": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - "Academic", - "AnomalyDetector", - "Bing.Autosuggest", - "Bing.Autosuggest.v7", - "Bing.CustomSearch", - "Bing.Search", - "Bing.Search.v7", - "Bing.Speech", - "Bing.SpellCheck", - "Bing.SpellCheck.v7", - "CognitiveServices", - "ComputerVision", - "ContentModerator", - "CustomSpeech", - "CustomVision.Prediction", - "CustomVision.Training", - "Emotion", - "Face", - "FormRecognizer", - "ImmersiveReader", - "LUIS", - "LUIS.Authoring", - "MetricsAdvisor", - "Personalizer", - "QnAMaker", - "Recommendations", - "SpeakerRecognition", - "Speech", - "SpeechServices", - "SpeechTranslation", - "TextAnalytics", - "TextTranslation", - "WebLM", - }, false), - }, - - "sku_name": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - "F0", "F1", "S0", "S", "S1", "S2", "S3", "S4", "S5", "S6", "P0", "P1", "P2", "E0", - }, false), - }, - - "custom_subdomain_name": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "fqdns": { - Type: pluginsdk.TypeList, - Optional: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - ValidateFunc: validation.StringIsNotEmpty, - }, - }, - - "identity": commonschema.SystemAssignedUserAssignedIdentityOptional(), - - "local_auth_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Default: true, - }, - - "metrics_advisor_aad_client_id": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IsUUID, - }, - - "metrics_advisor_aad_tenant_id": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: validation.IsUUID, - }, - - "metrics_advisor_super_user_name": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "metrics_advisor_website_name": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "network_acls": { - Type: pluginsdk.TypeList, - Optional: true, - MaxItems: 1, - RequiredWith: []string{"custom_subdomain_name"}, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "default_action": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(cognitiveservicesaccounts.NetworkRuleActionAllow), - string(cognitiveservicesaccounts.NetworkRuleActionDeny), - }, false), - }, - "ip_rules": { - Type: pluginsdk.TypeSet, - Optional: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - ValidateFunc: validation.Any( - commonValidate.IPv4Address, - commonValidate.CIDR, - ), - }, - Set: set.HashIPv4AddressOrCIDR, - }, - - "virtual_network_rules": { - Type: pluginsdk.TypeSet, - Optional: true, - ConfigMode: pluginsdk.SchemaConfigModeAuto, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "subnet_id": { - Type: pluginsdk.TypeString, - Required: true, - }, - - "ignore_missing_vnet_service_endpoint": { - Type: pluginsdk.TypeBool, - Optional: true, - Default: false, - }, - }, - }, - }, - }, - }, - }, - "outbound_network_access_restricted": { - Type: pluginsdk.TypeBool, - Optional: true, - Default: false, - }, - - "public_network_access_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Default: true, - }, - - "qna_runtime_endpoint": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.IsURLWithHTTPorHTTPS, - }, - - "custom_question_answering_search_service_id": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: services.ValidateSearchServiceID, - }, - - "storage": { - Type: pluginsdk.TypeList, - Optional: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "storage_account_id": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: storageValidate.StorageAccountID, - }, - - "identity_client_id": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.IsUUID, - }, - }, - }, - }, - - "tags": tags.Schema(), - - "endpoint": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "primary_access_key": { - Type: pluginsdk.TypeString, - Computed: true, - Sensitive: true, - }, - - "secondary_access_key": { - Type: pluginsdk.TypeString, - Computed: true, - Sensitive: true, - }, - } - return schema -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/client.go deleted file mode 100644 index 92d18e46ab0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package cognitiveservicesaccounts - -import "github.com/Azure/go-autorest/autorest" - -type CognitiveServicesAccountsClient struct { - Client autorest.Client - baseUri string -} - -func NewCognitiveServicesAccountsClientWithBaseURI(endpoint string) CognitiveServicesAccountsClient { - return CognitiveServicesAccountsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/constants.go deleted file mode 100644 index c9f2ac9b065..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/constants.go +++ /dev/null @@ -1,427 +0,0 @@ -package cognitiveservicesaccounts - -import "strings" - -type CreatedByType string - -const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" -) - -func PossibleValuesForCreatedByType() []string { - return []string{ - string(CreatedByTypeApplication), - string(CreatedByTypeKey), - string(CreatedByTypeManagedIdentity), - string(CreatedByTypeUser), - } -} - -func parseCreatedByType(input string) (*CreatedByType, error) { - vals := map[string]CreatedByType{ - "application": CreatedByTypeApplication, - "key": CreatedByTypeKey, - "managedidentity": CreatedByTypeManagedIdentity, - "user": CreatedByTypeUser, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CreatedByType(input) - return &out, nil -} - -type KeyName string - -const ( - KeyNameKeyOne KeyName = "Key1" - KeyNameKeyTwo KeyName = "Key2" -) - -func PossibleValuesForKeyName() []string { - return []string{ - string(KeyNameKeyOne), - string(KeyNameKeyTwo), - } -} - -func parseKeyName(input string) (*KeyName, error) { - vals := map[string]KeyName{ - "key1": KeyNameKeyOne, - "key2": KeyNameKeyTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeyName(input) - return &out, nil -} - -type KeySource string - -const ( - KeySourceMicrosoftPointCognitiveServices KeySource = "Microsoft.CognitiveServices" - KeySourceMicrosoftPointKeyVault KeySource = "Microsoft.KeyVault" -) - -func PossibleValuesForKeySource() []string { - return []string{ - string(KeySourceMicrosoftPointCognitiveServices), - string(KeySourceMicrosoftPointKeyVault), - } -} - -func parseKeySource(input string) (*KeySource, error) { - vals := map[string]KeySource{ - "microsoft.cognitiveservices": KeySourceMicrosoftPointCognitiveServices, - "microsoft.keyvault": KeySourceMicrosoftPointKeyVault, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeySource(input) - return &out, nil -} - -type NetworkRuleAction string - -const ( - NetworkRuleActionAllow NetworkRuleAction = "Allow" - NetworkRuleActionDeny NetworkRuleAction = "Deny" -) - -func PossibleValuesForNetworkRuleAction() []string { - return []string{ - string(NetworkRuleActionAllow), - string(NetworkRuleActionDeny), - } -} - -func parseNetworkRuleAction(input string) (*NetworkRuleAction, error) { - vals := map[string]NetworkRuleAction{ - "allow": NetworkRuleActionAllow, - "deny": NetworkRuleActionDeny, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := NetworkRuleAction(input) - return &out, nil -} - -type PrivateEndpointConnectionProvisioningState string - -const ( - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" -) - -func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { - return []string{ - string(PrivateEndpointConnectionProvisioningStateCreating), - string(PrivateEndpointConnectionProvisioningStateDeleting), - string(PrivateEndpointConnectionProvisioningStateFailed), - string(PrivateEndpointConnectionProvisioningStateSucceeded), - } -} - -func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { - vals := map[string]PrivateEndpointConnectionProvisioningState{ - "creating": PrivateEndpointConnectionProvisioningStateCreating, - "deleting": PrivateEndpointConnectionProvisioningStateDeleting, - "failed": PrivateEndpointConnectionProvisioningStateFailed, - "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PrivateEndpointConnectionProvisioningState(input) - return &out, nil -} - -type PrivateEndpointServiceConnectionStatus string - -const ( - PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" - PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" -) - -func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { - return []string{ - string(PrivateEndpointServiceConnectionStatusApproved), - string(PrivateEndpointServiceConnectionStatusPending), - string(PrivateEndpointServiceConnectionStatusRejected), - } -} - -func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { - vals := map[string]PrivateEndpointServiceConnectionStatus{ - "approved": PrivateEndpointServiceConnectionStatusApproved, - "pending": PrivateEndpointServiceConnectionStatusPending, - "rejected": PrivateEndpointServiceConnectionStatusRejected, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PrivateEndpointServiceConnectionStatus(input) - return &out, nil -} - -type ProvisioningState string - -const ( - ProvisioningStateAccepted ProvisioningState = "Accepted" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateMoving ProvisioningState = "Moving" - ProvisioningStateResolvingDNS ProvisioningState = "ResolvingDNS" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -func PossibleValuesForProvisioningState() []string { - return []string{ - string(ProvisioningStateAccepted), - string(ProvisioningStateCreating), - string(ProvisioningStateDeleting), - string(ProvisioningStateFailed), - string(ProvisioningStateMoving), - string(ProvisioningStateResolvingDNS), - string(ProvisioningStateSucceeded), - } -} - -func parseProvisioningState(input string) (*ProvisioningState, error) { - vals := map[string]ProvisioningState{ - "accepted": ProvisioningStateAccepted, - "creating": ProvisioningStateCreating, - "deleting": ProvisioningStateDeleting, - "failed": ProvisioningStateFailed, - "moving": ProvisioningStateMoving, - "resolvingdns": ProvisioningStateResolvingDNS, - "succeeded": ProvisioningStateSucceeded, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProvisioningState(input) - return &out, nil -} - -type PublicNetworkAccess string - -const ( - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -func PossibleValuesForPublicNetworkAccess() []string { - return []string{ - string(PublicNetworkAccessDisabled), - string(PublicNetworkAccessEnabled), - } -} - -func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { - vals := map[string]PublicNetworkAccess{ - "disabled": PublicNetworkAccessDisabled, - "enabled": PublicNetworkAccessEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PublicNetworkAccess(input) - return &out, nil -} - -type QuotaUsageStatus string - -const ( - QuotaUsageStatusBlocked QuotaUsageStatus = "Blocked" - QuotaUsageStatusInOverage QuotaUsageStatus = "InOverage" - QuotaUsageStatusIncluded QuotaUsageStatus = "Included" - QuotaUsageStatusUnknown QuotaUsageStatus = "Unknown" -) - -func PossibleValuesForQuotaUsageStatus() []string { - return []string{ - string(QuotaUsageStatusBlocked), - string(QuotaUsageStatusInOverage), - string(QuotaUsageStatusIncluded), - string(QuotaUsageStatusUnknown), - } -} - -func parseQuotaUsageStatus(input string) (*QuotaUsageStatus, error) { - vals := map[string]QuotaUsageStatus{ - "blocked": QuotaUsageStatusBlocked, - "inoverage": QuotaUsageStatusInOverage, - "included": QuotaUsageStatusIncluded, - "unknown": QuotaUsageStatusUnknown, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := QuotaUsageStatus(input) - return &out, nil -} - -type ResourceSkuRestrictionsReasonCode string - -const ( - ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription ResourceSkuRestrictionsReasonCode = "NotAvailableForSubscription" - ResourceSkuRestrictionsReasonCodeQuotaId ResourceSkuRestrictionsReasonCode = "QuotaId" -) - -func PossibleValuesForResourceSkuRestrictionsReasonCode() []string { - return []string{ - string(ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription), - string(ResourceSkuRestrictionsReasonCodeQuotaId), - } -} - -func parseResourceSkuRestrictionsReasonCode(input string) (*ResourceSkuRestrictionsReasonCode, error) { - vals := map[string]ResourceSkuRestrictionsReasonCode{ - "notavailableforsubscription": ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription, - "quotaid": ResourceSkuRestrictionsReasonCodeQuotaId, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ResourceSkuRestrictionsReasonCode(input) - return &out, nil -} - -type ResourceSkuRestrictionsType string - -const ( - ResourceSkuRestrictionsTypeLocation ResourceSkuRestrictionsType = "Location" - ResourceSkuRestrictionsTypeZone ResourceSkuRestrictionsType = "Zone" -) - -func PossibleValuesForResourceSkuRestrictionsType() []string { - return []string{ - string(ResourceSkuRestrictionsTypeLocation), - string(ResourceSkuRestrictionsTypeZone), - } -} - -func parseResourceSkuRestrictionsType(input string) (*ResourceSkuRestrictionsType, error) { - vals := map[string]ResourceSkuRestrictionsType{ - "location": ResourceSkuRestrictionsTypeLocation, - "zone": ResourceSkuRestrictionsTypeZone, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ResourceSkuRestrictionsType(input) - return &out, nil -} - -type SkuTier string - -const ( - SkuTierBasic SkuTier = "Basic" - SkuTierEnterprise SkuTier = "Enterprise" - SkuTierFree SkuTier = "Free" - SkuTierPremium SkuTier = "Premium" - SkuTierStandard SkuTier = "Standard" -) - -func PossibleValuesForSkuTier() []string { - return []string{ - string(SkuTierBasic), - string(SkuTierEnterprise), - string(SkuTierFree), - string(SkuTierPremium), - string(SkuTierStandard), - } -} - -func parseSkuTier(input string) (*SkuTier, error) { - vals := map[string]SkuTier{ - "basic": SkuTierBasic, - "enterprise": SkuTierEnterprise, - "free": SkuTierFree, - "premium": SkuTierPremium, - "standard": SkuTierStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SkuTier(input) - return &out, nil -} - -type UnitType string - -const ( - UnitTypeBytes UnitType = "Bytes" - UnitTypeBytesPerSecond UnitType = "BytesPerSecond" - UnitTypeCount UnitType = "Count" - UnitTypeCountPerSecond UnitType = "CountPerSecond" - UnitTypeMilliseconds UnitType = "Milliseconds" - UnitTypePercent UnitType = "Percent" - UnitTypeSeconds UnitType = "Seconds" -) - -func PossibleValuesForUnitType() []string { - return []string{ - string(UnitTypeBytes), - string(UnitTypeBytesPerSecond), - string(UnitTypeCount), - string(UnitTypeCountPerSecond), - string(UnitTypeMilliseconds), - string(UnitTypePercent), - string(UnitTypeSeconds), - } -} - -func parseUnitType(input string) (*UnitType, error) { - vals := map[string]UnitType{ - "bytes": UnitTypeBytes, - "bytespersecond": UnitTypeBytesPerSecond, - "count": UnitTypeCount, - "countpersecond": UnitTypeCountPerSecond, - "milliseconds": UnitTypeMilliseconds, - "percent": UnitTypePercent, - "seconds": UnitTypeSeconds, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := UnitType(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/id_account.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/id_account.go deleted file mode 100644 index c0ead3452d2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/id_account.go +++ /dev/null @@ -1,124 +0,0 @@ -package cognitiveservicesaccounts - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = AccountId{} - -// AccountId is a struct representing the Resource ID for a Account -type AccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string -} - -// NewAccountID returns a new AccountId struct -func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { - return AccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - } -} - -// ParseAccountID parses 'input' into a AccountId -func ParseAccountID(input string) (*AccountId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AccountId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId -// note: this method should only be used for API response data and not user input -func ParseAccountIDInsensitively(input string) (*AccountId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AccountId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateAccountID checks that 'input' can be parsed as a Account ID -func ValidateAccountID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseAccountID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Account ID -func (id AccountId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.CognitiveServices/accounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Account ID -func (id AccountId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftCognitiveServices", "Microsoft.CognitiveServices", "Microsoft.CognitiveServices"), - resourceids.StaticSegment("accounts", "accounts", "accounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - } -} - -// String returns a human-readable description of this Account ID -func (id AccountId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - } - return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/id_location.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/id_location.go deleted file mode 100644 index f9fa484bd49..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/id_location.go +++ /dev/null @@ -1,111 +0,0 @@ -package cognitiveservicesaccounts - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = LocationId{} - -// LocationId is a struct representing the Resource ID for a Location -type LocationId struct { - SubscriptionId string - Location string -} - -// NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { - return LocationId{ - SubscriptionId: subscriptionId, - Location: location, - } -} - -// ParseLocationID parses 'input' into a LocationId -func ParseLocationID(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId -// note: this method should only be used for API response data and not user input -func ParseLocationIDInsensitively(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateLocationID checks that 'input' can be parsed as a Location ID -func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseLocationID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Location ID -func (id LocationId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.CognitiveServices/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) -} - -// Segments returns a slice of Resource ID Segments which comprise this Location ID -func (id LocationId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftCognitiveServices", "Microsoft.CognitiveServices", "Microsoft.CognitiveServices"), - resourceids.StaticSegment("locations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), - } -} - -// String returns a human-readable description of this Location ID -func (id LocationId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), - } - return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/id_resourcegroup.go deleted file mode 100644 index a6e8d486e69..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package cognitiveservicesaccounts - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/id_subscription.go deleted file mode 100644 index f61561cdc40..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package cognitiveservicesaccounts - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountsdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountsdelete_autorest.go deleted file mode 100644 index 2d713053488..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountsdelete_autorest.go +++ /dev/null @@ -1,73 +0,0 @@ -package cognitiveservicesaccounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type AccountsDeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// AccountsDelete ... -func (c CognitiveServicesAccountsClient) AccountsDelete(ctx context.Context, id AccountId) (result AccountsDeleteResponse, err error) { - req, err := c.preparerForAccountsDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsDelete", nil, "Failure preparing request") - return - } - - result, err = c.senderForAccountsDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsDelete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// AccountsDeleteThenPoll performs AccountsDelete then polls until it's completed -func (c CognitiveServicesAccountsClient) AccountsDeleteThenPoll(ctx context.Context, id AccountId) error { - result, err := c.AccountsDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing AccountsDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after AccountsDelete: %+v", err) - } - - return nil -} - -// preparerForAccountsDelete prepares the AccountsDelete request. -func (c CognitiveServicesAccountsClient) preparerForAccountsDelete(ctx context.Context, id AccountId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForAccountsDelete sends the AccountsDelete request. The method will close the -// http.Response Body if it receives an error. -func (c CognitiveServicesAccountsClient) senderForAccountsDelete(ctx context.Context, req *http.Request) (future AccountsDeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountsget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountsget_autorest.go deleted file mode 100644 index db2d4e138c3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountsget_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package cognitiveservicesaccounts - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type AccountsGetResponse struct { - HttpResponse *http.Response - Model *Account -} - -// AccountsGet ... -func (c CognitiveServicesAccountsClient) AccountsGet(ctx context.Context, id AccountId) (result AccountsGetResponse, err error) { - req, err := c.preparerForAccountsGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAccountsGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAccountsGet prepares the AccountsGet request. -func (c CognitiveServicesAccountsClient) preparerForAccountsGet(ctx context.Context, id AccountId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAccountsGet handles the response to the AccountsGet request. The method always -// closes the http.Response Body. -func (c CognitiveServicesAccountsClient) responderForAccountsGet(resp *http.Response) (result AccountsGetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountslist_autorest.go deleted file mode 100644 index 0d3061122a4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountslist_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package cognitiveservicesaccounts - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type AccountsListResponse struct { - HttpResponse *http.Response - Model *[]Account - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (AccountsListResponse, error) -} - -type AccountsListCompleteResult struct { - Items []Account -} - -func (r AccountsListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r AccountsListResponse) LoadMore(ctx context.Context) (resp AccountsListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// AccountsList ... -func (c CognitiveServicesAccountsClient) AccountsList(ctx context.Context, id SubscriptionId) (resp AccountsListResponse, err error) { - req, err := c.preparerForAccountsList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForAccountsList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// AccountsListComplete retrieves all of the results into a single object -func (c CognitiveServicesAccountsClient) AccountsListComplete(ctx context.Context, id SubscriptionId) (AccountsListCompleteResult, error) { - return c.AccountsListCompleteMatchingPredicate(ctx, id, AccountPredicate{}) -} - -// AccountsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c CognitiveServicesAccountsClient) AccountsListCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate AccountPredicate) (resp AccountsListCompleteResult, err error) { - items := make([]Account, 0) - - page, err := c.AccountsList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := AccountsListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForAccountsList prepares the AccountsList request. -func (c CognitiveServicesAccountsClient) preparerForAccountsList(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.CognitiveServices/accounts", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForAccountsListWithNextLink prepares the AccountsList request with the given nextLink token. -func (c CognitiveServicesAccountsClient) preparerForAccountsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAccountsList handles the response to the AccountsList request. The method always -// closes the http.Response Body. -func (c CognitiveServicesAccountsClient) responderForAccountsList(resp *http.Response) (result AccountsListResponse, err error) { - type page struct { - Values []Account `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result AccountsListResponse, err error) { - req, err := c.preparerForAccountsListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAccountsList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountslistusages_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountslistusages_autorest.go deleted file mode 100644 index 1ee7a7fa350..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountslistusages_autorest.go +++ /dev/null @@ -1,87 +0,0 @@ -package cognitiveservicesaccounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type AccountsListUsagesResponse struct { - HttpResponse *http.Response - Model *UsageListResult -} - -type AccountsListUsagesOptions struct { - Filter *string -} - -func DefaultAccountsListUsagesOptions() AccountsListUsagesOptions { - return AccountsListUsagesOptions{} -} - -func (o AccountsListUsagesOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - return out -} - -// AccountsListUsages ... -func (c CognitiveServicesAccountsClient) AccountsListUsages(ctx context.Context, id AccountId, options AccountsListUsagesOptions) (result AccountsListUsagesResponse, err error) { - req, err := c.preparerForAccountsListUsages(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsListUsages", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsListUsages", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAccountsListUsages(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsListUsages", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAccountsListUsages prepares the AccountsListUsages request. -func (c CognitiveServicesAccountsClient) preparerForAccountsListUsages(ctx context.Context, id AccountId, options AccountsListUsagesOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/usages", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAccountsListUsages handles the response to the AccountsListUsages request. The method always -// closes the http.Response Body. -func (c CognitiveServicesAccountsClient) responderForAccountsListUsages(resp *http.Response) (result AccountsListUsagesResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountsupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountsupdate_autorest.go deleted file mode 100644 index f387f750265..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/method_accountsupdate_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package cognitiveservicesaccounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type AccountsUpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// AccountsUpdate ... -func (c CognitiveServicesAccountsClient) AccountsUpdate(ctx context.Context, id AccountId, input Account) (result AccountsUpdateResponse, err error) { - req, err := c.preparerForAccountsUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForAccountsUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "cognitiveservicesaccounts.CognitiveServicesAccountsClient", "AccountsUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// AccountsUpdateThenPoll performs AccountsUpdate then polls until it's completed -func (c CognitiveServicesAccountsClient) AccountsUpdateThenPoll(ctx context.Context, id AccountId, input Account) error { - result, err := c.AccountsUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing AccountsUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after AccountsUpdate: %+v", err) - } - - return nil -} - -// preparerForAccountsUpdate prepares the AccountsUpdate request. -func (c CognitiveServicesAccountsClient) preparerForAccountsUpdate(ctx context.Context, id AccountId, input Account) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForAccountsUpdate sends the AccountsUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c CognitiveServicesAccountsClient) senderForAccountsUpdate(ctx context.Context, req *http.Request) (future AccountsUpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_account.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_account.go deleted file mode 100644 index 1d75f2cdb52..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_account.go +++ /dev/null @@ -1,19 +0,0 @@ -package cognitiveservicesaccounts - -import ( - "github.com/hashicorp/terraform-provider-azurerm/internal/identity" -) - -type Account struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Identity *identity.SystemUserAssignedIdentityMap `json:"identity,omitempty"` - Kind *string `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *AccountProperties `json:"properties,omitempty"` - Sku *Sku `json:"sku,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_accountproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_accountproperties.go deleted file mode 100644 index dde97bf1bd0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_accountproperties.go +++ /dev/null @@ -1,26 +0,0 @@ -package cognitiveservicesaccounts - -type AccountProperties struct { - AllowedFqdnList *[]string `json:"allowedFqdnList,omitempty"` - ApiProperties *ApiProperties `json:"apiProperties,omitempty"` - CallRateLimit *CallRateLimit `json:"callRateLimit,omitempty"` - Capabilities *[]SkuCapability `json:"capabilities,omitempty"` - CustomSubDomainName *string `json:"customSubDomainName,omitempty"` - DateCreated *string `json:"dateCreated,omitempty"` - DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` - Encryption *Encryption `json:"encryption,omitempty"` - Endpoint *string `json:"endpoint,omitempty"` - Endpoints *map[string]string `json:"endpoints,omitempty"` - InternalId *string `json:"internalId,omitempty"` - IsMigrated *bool `json:"isMigrated,omitempty"` - MigrationToken *string `json:"migrationToken,omitempty"` - NetworkAcls *NetworkRuleSet `json:"networkAcls,omitempty"` - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` - PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - QuotaLimit *QuotaLimit `json:"quotaLimit,omitempty"` - Restore *bool `json:"restore,omitempty"` - RestrictOutboundNetworkAccess *bool `json:"restrictOutboundNetworkAccess,omitempty"` - SkuChangeInfo *SkuChangeInfo `json:"skuChangeInfo,omitempty"` - UserOwnedStorage *[]UserOwnedStorage `json:"userOwnedStorage,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_accountsku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_accountsku.go deleted file mode 100644 index e2484c4f469..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_accountsku.go +++ /dev/null @@ -1,6 +0,0 @@ -package cognitiveservicesaccounts - -type AccountSku struct { - ResourceType *string `json:"resourceType,omitempty"` - Sku *Sku `json:"sku,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_accountskulistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_accountskulistresult.go deleted file mode 100644 index 5cc6b8e66a1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_accountskulistresult.go +++ /dev/null @@ -1,5 +0,0 @@ -package cognitiveservicesaccounts - -type AccountSkuListResult struct { - Value *[]AccountSku `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_apikeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_apikeys.go deleted file mode 100644 index cfc4e7b5653..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_apikeys.go +++ /dev/null @@ -1,6 +0,0 @@ -package cognitiveservicesaccounts - -type ApiKeys struct { - Key1 *string `json:"key1,omitempty"` - Key2 *string `json:"key2,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_callratelimit.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_callratelimit.go deleted file mode 100644 index 61cb46602b5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_callratelimit.go +++ /dev/null @@ -1,7 +0,0 @@ -package cognitiveservicesaccounts - -type CallRateLimit struct { - Count *float64 `json:"count,omitempty"` - RenewalPeriod *float64 `json:"renewalPeriod,omitempty"` - Rules *[]ThrottlingRule `json:"rules,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_checkdomainavailabilityparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_checkdomainavailabilityparameter.go deleted file mode 100644 index b69132a75d9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_checkdomainavailabilityparameter.go +++ /dev/null @@ -1,6 +0,0 @@ -package cognitiveservicesaccounts - -type CheckDomainAvailabilityParameter struct { - SubdomainName string `json:"subdomainName"` - Type string `json:"type"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_checkskuavailabilityparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_checkskuavailabilityparameter.go deleted file mode 100644 index 3d533f9ee93..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_checkskuavailabilityparameter.go +++ /dev/null @@ -1,7 +0,0 @@ -package cognitiveservicesaccounts - -type CheckSkuAvailabilityParameter struct { - Kind string `json:"kind"` - Skus []string `json:"skus"` - Type string `json:"type"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_domainavailability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_domainavailability.go deleted file mode 100644 index f546378f5cb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_domainavailability.go +++ /dev/null @@ -1,8 +0,0 @@ -package cognitiveservicesaccounts - -type DomainAvailability struct { - IsSubdomainAvailable *bool `json:"isSubdomainAvailable,omitempty"` - Reason *string `json:"reason,omitempty"` - SubdomainName *string `json:"subdomainName,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_encryption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_encryption.go deleted file mode 100644 index e3ae4f9e706..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_encryption.go +++ /dev/null @@ -1,6 +0,0 @@ -package cognitiveservicesaccounts - -type Encryption struct { - KeySource *KeySource `json:"keySource,omitempty"` - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_iprule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_iprule.go deleted file mode 100644 index df5160dbcaa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_iprule.go +++ /dev/null @@ -1,5 +0,0 @@ -package cognitiveservicesaccounts - -type IpRule struct { - Value string `json:"value"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_keyvaultproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_keyvaultproperties.go deleted file mode 100644 index a0fa6b03fa1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_keyvaultproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package cognitiveservicesaccounts - -type KeyVaultProperties struct { - IdentityClientId *string `json:"identityClientId,omitempty"` - KeyName *string `json:"keyName,omitempty"` - KeyVaultUri *string `json:"keyVaultUri,omitempty"` - KeyVersion *string `json:"keyVersion,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_metricname.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_metricname.go deleted file mode 100644 index 3564aea1c3c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_metricname.go +++ /dev/null @@ -1,6 +0,0 @@ -package cognitiveservicesaccounts - -type MetricName struct { - LocalizedValue *string `json:"localizedValue,omitempty"` - Value *string `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_networkruleset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_networkruleset.go deleted file mode 100644 index 5ac28bbbd09..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_networkruleset.go +++ /dev/null @@ -1,7 +0,0 @@ -package cognitiveservicesaccounts - -type NetworkRuleSet struct { - DefaultAction *NetworkRuleAction `json:"defaultAction,omitempty"` - IpRules *[]IpRule `json:"ipRules,omitempty"` - VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_privateendpoint.go deleted file mode 100644 index 5e371594072..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_privateendpoint.go +++ /dev/null @@ -1,5 +0,0 @@ -package cognitiveservicesaccounts - -type PrivateEndpoint struct { - Id *string `json:"id,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_privateendpointconnection.go deleted file mode 100644 index 4d691414c29..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_privateendpointconnection.go +++ /dev/null @@ -1,11 +0,0 @@ -package cognitiveservicesaccounts - -type PrivateEndpointConnection struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_privateendpointconnectionproperties.go deleted file mode 100644 index c2214d60ad8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_privateendpointconnectionproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package cognitiveservicesaccounts - -type PrivateEndpointConnectionProperties struct { - GroupIds *[]string `json:"groupIds,omitempty"` - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` - ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_privatelinkserviceconnectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_privatelinkserviceconnectionstate.go deleted file mode 100644 index 7d97b004cfc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_privatelinkserviceconnectionstate.go +++ /dev/null @@ -1,7 +0,0 @@ -package cognitiveservicesaccounts - -type PrivateLinkServiceConnectionState struct { - ActionsRequired *string `json:"actionsRequired,omitempty"` - Description *string `json:"description,omitempty"` - Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_quotalimit.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_quotalimit.go deleted file mode 100644 index 5b7cef856b9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_quotalimit.go +++ /dev/null @@ -1,7 +0,0 @@ -package cognitiveservicesaccounts - -type QuotaLimit struct { - Count *float64 `json:"count,omitempty"` - RenewalPeriod *float64 `json:"renewalPeriod,omitempty"` - Rules *[]ThrottlingRule `json:"rules,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_regeneratekeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_regeneratekeyparameters.go deleted file mode 100644 index 19eaafcbb68..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_regeneratekeyparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package cognitiveservicesaccounts - -type RegenerateKeyParameters struct { - KeyName KeyName `json:"keyName"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_requestmatchpattern.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_requestmatchpattern.go deleted file mode 100644 index 4f69c379b3d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_requestmatchpattern.go +++ /dev/null @@ -1,6 +0,0 @@ -package cognitiveservicesaccounts - -type RequestMatchPattern struct { - Method *string `json:"method,omitempty"` - Path *string `json:"path,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_resourcesku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_resourcesku.go deleted file mode 100644 index 2bcd1e62584..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_resourcesku.go +++ /dev/null @@ -1,10 +0,0 @@ -package cognitiveservicesaccounts - -type ResourceSku struct { - Kind *string `json:"kind,omitempty"` - Locations *[]string `json:"locations,omitempty"` - Name *string `json:"name,omitempty"` - ResourceType *string `json:"resourceType,omitempty"` - Restrictions *[]ResourceSkuRestrictions `json:"restrictions,omitempty"` - Tier *string `json:"tier,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_resourceskurestrictioninfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_resourceskurestrictioninfo.go deleted file mode 100644 index e0ee82c6e41..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_resourceskurestrictioninfo.go +++ /dev/null @@ -1,6 +0,0 @@ -package cognitiveservicesaccounts - -type ResourceSkuRestrictionInfo struct { - Locations *[]string `json:"locations,omitempty"` - Zones *[]string `json:"zones,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_resourceskurestrictions.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_resourceskurestrictions.go deleted file mode 100644 index da2468d341b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_resourceskurestrictions.go +++ /dev/null @@ -1,8 +0,0 @@ -package cognitiveservicesaccounts - -type ResourceSkuRestrictions struct { - ReasonCode *ResourceSkuRestrictionsReasonCode `json:"reasonCode,omitempty"` - RestrictionInfo *ResourceSkuRestrictionInfo `json:"restrictionInfo,omitempty"` - Type *ResourceSkuRestrictionsType `json:"type,omitempty"` - Values *[]string `json:"values,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_sku.go deleted file mode 100644 index ab01f1483a1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_sku.go +++ /dev/null @@ -1,9 +0,0 @@ -package cognitiveservicesaccounts - -type Sku struct { - Capacity *int64 `json:"capacity,omitempty"` - Family *string `json:"family,omitempty"` - Name string `json:"name"` - Size *string `json:"size,omitempty"` - Tier *SkuTier `json:"tier,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_skuavailability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_skuavailability.go deleted file mode 100644 index f88611419fe..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_skuavailability.go +++ /dev/null @@ -1,10 +0,0 @@ -package cognitiveservicesaccounts - -type SkuAvailability struct { - Kind *string `json:"kind,omitempty"` - Message *string `json:"message,omitempty"` - Reason *string `json:"reason,omitempty"` - SkuAvailable *bool `json:"skuAvailable,omitempty"` - SkuName *string `json:"skuName,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_skuavailabilitylistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_skuavailabilitylistresult.go deleted file mode 100644 index 91745b4b6b1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_skuavailabilitylistresult.go +++ /dev/null @@ -1,5 +0,0 @@ -package cognitiveservicesaccounts - -type SkuAvailabilityListResult struct { - Value *[]SkuAvailability `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_skucapability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_skucapability.go deleted file mode 100644 index 93836d0f5ae..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_skucapability.go +++ /dev/null @@ -1,6 +0,0 @@ -package cognitiveservicesaccounts - -type SkuCapability struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_skuchangeinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_skuchangeinfo.go deleted file mode 100644 index a537d76a8af..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_skuchangeinfo.go +++ /dev/null @@ -1,7 +0,0 @@ -package cognitiveservicesaccounts - -type SkuChangeInfo struct { - CountOfDowngrades *float64 `json:"countOfDowngrades,omitempty"` - CountOfUpgradesAfterDowngrades *float64 `json:"countOfUpgradesAfterDowngrades,omitempty"` - LastChangeDate *string `json:"lastChangeDate,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_systemdata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_systemdata.go deleted file mode 100644 index 0aec1722354..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_systemdata.go +++ /dev/null @@ -1,10 +0,0 @@ -package cognitiveservicesaccounts - -type SystemData struct { - CreatedAt *string `json:"createdAt,omitempty"` - CreatedBy *string `json:"createdBy,omitempty"` - CreatedByType *CreatedByType `json:"createdByType,omitempty"` - LastModifiedAt *string `json:"lastModifiedAt,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_usage.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_usage.go deleted file mode 100644 index ec3620eac6e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_usage.go +++ /dev/null @@ -1,11 +0,0 @@ -package cognitiveservicesaccounts - -type Usage struct { - CurrentValue *float64 `json:"currentValue,omitempty"` - Limit *float64 `json:"limit,omitempty"` - Name *MetricName `json:"name,omitempty"` - NextResetTime *string `json:"nextResetTime,omitempty"` - QuotaPeriod *string `json:"quotaPeriod,omitempty"` - Status *QuotaUsageStatus `json:"status,omitempty"` - Unit *UnitType `json:"unit,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_usagelistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_usagelistresult.go deleted file mode 100644 index 80bce4409b6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_usagelistresult.go +++ /dev/null @@ -1,5 +0,0 @@ -package cognitiveservicesaccounts - -type UsageListResult struct { - Value *[]Usage `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_userownedstorage.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_userownedstorage.go deleted file mode 100644 index ec12258aebf..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_userownedstorage.go +++ /dev/null @@ -1,6 +0,0 @@ -package cognitiveservicesaccounts - -type UserOwnedStorage struct { - IdentityClientId *string `json:"identityClientId,omitempty"` - ResourceId *string `json:"resourceId,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_virtualnetworkrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_virtualnetworkrule.go deleted file mode 100644 index c4150de70ee..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/model_virtualnetworkrule.go +++ /dev/null @@ -1,7 +0,0 @@ -package cognitiveservicesaccounts - -type VirtualNetworkRule struct { - Id string `json:"id"` - IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` - State *string `json:"state,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/predicates.go deleted file mode 100644 index c69371afb19..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/predicates.go +++ /dev/null @@ -1,67 +0,0 @@ -package cognitiveservicesaccounts - -type AccountPredicate struct { - Etag *string - Id *string - Kind *string - Location *string - Name *string - Type *string -} - -func (p AccountPredicate) Matches(input Account) bool { - - if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { - return false - } - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Kind != nil && (input.Kind == nil && *p.Kind != *input.Kind) { - return false - } - - if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} - -type ResourceSkuPredicate struct { - Kind *string - Name *string - ResourceType *string - Tier *string -} - -func (p ResourceSkuPredicate) Matches(input ResourceSku) bool { - - if p.Kind != nil && (input.Kind == nil && *p.Kind != *input.Kind) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.ResourceType != nil && (input.ResourceType == nil && *p.ResourceType != *input.ResourceType) { - return false - } - - if p.Tier != nil && (input.Tier == nil && *p.Tier != *input.Tier) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/version.go deleted file mode 100644 index 277b9b6b9ff..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package cognitiveservicesaccounts - -import "fmt" - -const defaultApiVersion = "2021-04-30" - -func userAgent() string { - return fmt.Sprintf("pandora/cognitiveservicesaccounts/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/transition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/transition.go deleted file mode 100644 index f5fb60d850f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/transition.go +++ /dev/null @@ -1,23 +0,0 @@ -package cognitive - -import "github.com/hashicorp/terraform-provider-azurerm/utils" - -func expandTags(input map[string]interface{}) *map[string]string { - output := make(map[string]string) - for k, v := range input { - output[k] = v.(string) - } - return &output -} - -func flattenTags(input *map[string]string) map[string]*string { - output := make(map[string]*string) - - if input != nil { - for k, v := range *input { - output[k] = utils.String(v) - } - } - - return output -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/client/client.go index e2869158158..cd718144738 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/client/client.go @@ -1,16 +1,16 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication" + "github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - ServiceClient *communication.ServiceClient + ServiceClient *communicationservice.CommunicationServiceClient } func NewClient(o *common.ClientOptions) *Client { - serviceClient := communication.NewServiceClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + serviceClient := communicationservice.NewCommunicationServiceClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&serviceClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/communication_service_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/communication_service_resource.go index a94f15cb208..5c28d1335ab 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/communication_service_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/communication_service_resource.go @@ -5,14 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -34,7 +35,7 @@ func resourceArmCommunicationService() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.CommunicationServiceID(id) + _, err := communicationservice.ParseCommunicationServiceID(id) return err }), @@ -49,7 +50,8 @@ func resourceArmCommunicationService() *pluginsdk.Resource { "resource_group_name": azure.SchemaResourceGroupName(), "data_location": { - Type: pluginsdk.TypeString, + Type: pluginsdk.TypeString, + // TODO: should this become Required and remove the default in 4.0? Optional: true, Default: "United States", ValidateFunc: validation.StringInSlice([]string{ @@ -61,7 +63,7 @@ func resourceArmCommunicationService() *pluginsdk.Resource { }, false), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "primary_connection_string": { Type: pluginsdk.TypeString, @@ -95,39 +97,33 @@ func resourceArmCommunicationServiceCreateUpdate(d *pluginsdk.ResourceData, meta name := d.Get("name").(string) resourceGroup := d.Get("resource_group_name").(string) - id := parse.NewCommunicationServiceID(subscriptionId, resourceGroup, name) - + id := communicationservice.NewCommunicationServiceID(subscriptionId, resourceGroup, name) if d.IsNewResource() { - existing, err := client.Get(ctx, resourceGroup, name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_communication_service", id.ID()) } } - parameter := communication.ServiceResource{ + parameter := communicationservice.CommunicationServiceResource{ // The location is always `global` from the Azure Portal Location: utils.String(location.Normalize("global")), - ServiceProperties: &communication.ServiceProperties{ - DataLocation: utils.String(d.Get("data_location").(string)), + Properties: &communicationservice.CommunicationServiceProperties{ + DataLocation: d.Get("data_location").(string), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.CreateOrUpdate(ctx, resourceGroup, name, ¶meter) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, parameter); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for create/update of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceArmCommunicationServiceRead(d, meta) @@ -138,14 +134,14 @@ func resourceArmCommunicationServiceRead(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CommunicationServiceID(d.Id()) + id, err := communicationservice.ParseCommunicationServiceID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state", *id) d.SetId("") return nil @@ -154,30 +150,32 @@ func resourceArmCommunicationServiceRead(d *pluginsdk.ResourceData, meta interfa return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - - if props := resp.ServiceProperties; props != nil { - d.Set("data_location", props.DataLocation) + keysResp, err := client.ListKeys(ctx, *id) + if err != nil { + return fmt.Errorf("listing keys for %s: %+v", *id, err) } - keysResp, err := client.ListKeys(ctx, id.ResourceGroup, id.Name) - if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] %s was not found - removing from state", *id) - d.SetId("") - return nil + d.Set("name", id.CommunicationServiceName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("data_location", props.DataLocation) } - return fmt.Errorf("retrieving %s: %+v", *id, err) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } - d.Set("primary_connection_string", keysResp.PrimaryConnectionString) - d.Set("secondary_connection_string", keysResp.SecondaryConnectionString) - d.Set("primary_key", keysResp.PrimaryKey) - d.Set("secondary_key", keysResp.SecondaryKey) + if model := keysResp.Model; model != nil { + d.Set("primary_connection_string", model.PrimaryConnectionString) + d.Set("secondary_connection_string", model.SecondaryConnectionString) + d.Set("primary_key", model.PrimaryKey) + d.Set("secondary_key", model.SecondaryKey) + } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceArmCommunicationServiceDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -185,19 +183,14 @@ func resourceArmCommunicationServiceDelete(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CommunicationServiceID(d.Id()) + id, err := communicationservice.ParseCommunicationServiceID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { + if err := client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/parse/communication_service.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/parse/communication_service.go deleted file mode 100644 index 5245cde9fe7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/parse/communication_service.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type CommunicationServiceId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewCommunicationServiceID(subscriptionId, resourceGroup, name string) CommunicationServiceId { - return CommunicationServiceId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id CommunicationServiceId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Communication Service", segmentsStr) -} - -func (id CommunicationServiceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Communication/CommunicationServices/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// CommunicationServiceID parses a CommunicationService ID into an CommunicationServiceId struct -func CommunicationServiceID(input string) (*CommunicationServiceId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := CommunicationServiceId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("CommunicationServices"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/resourceids.go deleted file mode 100644 index 86fd08005b0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/resourceids.go +++ /dev/null @@ -1,3 +0,0 @@ -package communication - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=CommunicationService -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Communication/CommunicationServices/communicationService1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/validate/communication_service_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/validate/communication_service_id.go deleted file mode 100644 index 8d3127c7571..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/validate/communication_service_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/parse" -) - -func CommunicationServiceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.CommunicationServiceID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/availability_set_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/availability_set_data_source.go index 7836f9e6c75..4b396fb1a7a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/availability_set_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/availability_set_data_source.go @@ -2,19 +2,18 @@ package compute import ( "fmt" - "strconv" "strings" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceAvailabilitySet() *pluginsdk.Resource { @@ -26,26 +25,23 @@ func dataSourceAvailabilitySet() *pluginsdk.Resource { }, Schema: map[string]*pluginsdk.Schema{ - "resource_group_name": commonschema.ResourceGroupNameForDataSource(), - "name": { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringIsNotEmpty, }, - "location": { - Type: pluginsdk.TypeString, - Computed: true, - }, + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "location": commonschema.LocationComputed(), "platform_update_domain_count": { - Type: pluginsdk.TypeString, + Type: pluginsdk.TypeInt, Computed: true, }, "platform_fault_domain_count": { - Type: pluginsdk.TypeString, + Type: pluginsdk.TypeInt, Computed: true, }, @@ -54,7 +50,7 @@ func dataSourceAvailabilitySet() *pluginsdk.Resource { Computed: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -65,31 +61,35 @@ func dataSourceAvailabilitySetRead(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewAvailabilitySetID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := availabilitysets.NewAvailabilitySetID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } - return fmt.Errorf("making Read request on %s: %+v", id, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } - if resp.Sku != nil && resp.Sku.Name != nil { - d.Set("managed", strings.EqualFold(*resp.Sku.Name, "Aligned")) - } - if props := resp.AvailabilitySetProperties; props != nil { - if v := props.PlatformUpdateDomainCount; v != nil { - d.Set("platform_update_domain_count", strconv.Itoa(int(*v))) + + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + managed := false + if model.Sku != nil && model.Sku.Name != nil { + managed = strings.EqualFold(*model.Sku.Name, "Aligned") } - if v := props.PlatformFaultDomainCount; v != nil { - d.Set("platform_fault_domain_count", strconv.Itoa(int(*v))) + d.Set("managed", managed) + + if props := model.Properties; props != nil { + d.Set("platform_fault_domain_count", props.PlatformFaultDomainCount) + d.Set("platform_update_domain_count", props.PlatformUpdateDomainCount) + } + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err } } - return tags.FlattenAndSet(d, resp.Tags) + + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/availability_set_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/availability_set_resource.go index ec3a64de462..10ca440f418 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/availability_set_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/availability_set_resource.go @@ -7,12 +7,13 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -27,7 +28,7 @@ func resourceAvailabilitySet() *pluginsdk.Resource { Update: resourceAvailabilitySetCreateUpdate, Delete: resourceAvailabilitySetDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.AvailabilitySetID(id) + _, err := availabilitysets.ParseAvailabilitySetID(id) return err }), @@ -49,9 +50,9 @@ func resourceAvailabilitySet() *pluginsdk.Resource { ), }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), - "location": azure.SchemaLocation(), + "location": commonschema.Location(), "platform_update_domain_count": { Type: pluginsdk.TypeInt, @@ -88,7 +89,7 @@ func resourceAvailabilitySet() *pluginsdk.Resource { DiffSuppressFunc: suppress.CaseDifference, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -99,58 +100,53 @@ func resourceAvailabilitySetCreateUpdate(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[INFO] preparing arguments for AzureRM Availability Set creation.") - id := parse.NewAvailabilitySetID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - + id := availabilitysets.NewAvailabilitySetID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_availability_set", id.ID()) } } - location := azure.NormalizeLocation(d.Get("location").(string)) updateDomainCount := d.Get("platform_update_domain_count").(int) faultDomainCount := d.Get("platform_fault_domain_count").(int) managed := d.Get("managed").(bool) t := d.Get("tags").(map[string]interface{}) - availSet := compute.AvailabilitySet{ - Name: &id.Name, - Location: &location, - AvailabilitySetProperties: &compute.AvailabilitySetProperties{ - PlatformFaultDomainCount: utils.Int32(int32(faultDomainCount)), - PlatformUpdateDomainCount: utils.Int32(int32(updateDomainCount)), + payload := availabilitysets.AvailabilitySet{ + Location: location.Normalize(d.Get("location").(string)), + Properties: &availabilitysets.AvailabilitySetProperties{ + PlatformFaultDomainCount: utils.Int64(int64(faultDomainCount)), + PlatformUpdateDomainCount: utils.Int64(int64(updateDomainCount)), }, Tags: tags.Expand(t), } if v, ok := d.GetOk("proximity_placement_group_id"); ok { - availSet.AvailabilitySetProperties.ProximityPlacementGroup = &compute.SubResource{ - ID: utils.String(v.(string)), + payload.Properties.ProximityPlacementGroup = &availabilitysets.SubResource{ + Id: utils.String(v.(string)), } } if managed { n := "Aligned" - availSet.Sku = &compute.Sku{ + payload.Sku = &availabilitysets.Sku{ Name: &n, } } - _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, availSet) + _, err := client.CreateOrUpdate(ctx, id, payload) if err != nil { - return err + return fmt.Errorf("creating/updating %s: %+v", id, err) } d.SetId(id.ID()) - return resourceAvailabilitySetRead(d, meta) } @@ -159,39 +155,47 @@ func resourceAvailabilitySetRead(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AvailabilitySetID(d.Id()) + id, err := availabilitysets.ParseAvailabilitySetID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("making Read request on Azure Availability Set %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", resp.Name) - d.Set("resource_group_name", id.ResourceGroup) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } - if resp.Sku != nil && resp.Sku.Name != nil { - d.Set("managed", strings.EqualFold(*resp.Sku.Name, "Aligned")) - } + d.Set("name", id.AvailabilitySetName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + managed := false + if model.Sku != nil && model.Sku.Name != nil { + managed = strings.EqualFold(*model.Sku.Name, "Aligned") + } + d.Set("managed", managed) - if props := resp.AvailabilitySetProperties; props != nil { - d.Set("platform_update_domain_count", props.PlatformUpdateDomainCount) - d.Set("platform_fault_domain_count", props.PlatformFaultDomainCount) + if props := model.Properties; props != nil { + d.Set("platform_update_domain_count", props.PlatformUpdateDomainCount) + d.Set("platform_fault_domain_count", props.PlatformFaultDomainCount) - if proximityPlacementGroup := props.ProximityPlacementGroup; proximityPlacementGroup != nil { - d.Set("proximity_placement_group_id", proximityPlacementGroup.ID) + if proximityPlacementGroup := props.ProximityPlacementGroup; proximityPlacementGroup != nil { + d.Set("proximity_placement_group_id", proximityPlacementGroup.Id) + } + } + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceAvailabilitySetDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -199,11 +203,14 @@ func resourceAvailabilitySetDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AvailabilitySetID(d.Id()) + id, err := availabilitysets.ParseAvailabilitySetID(d.Id()) if err != nil { return err } - _, err = client.Delete(ctx, id.ResourceGroup, id.Name) - return err + if _, err = client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/client/client.go index d7deed8d6df..d3cf4358d2d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/client/client.go @@ -3,39 +3,46 @@ package client import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" "github.com/Azure/azure-sdk-for-go/services/marketplaceordering/mgmt/2015-06-01/marketplaceordering" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - AvailabilitySetsClient *compute.AvailabilitySetsClient - CapacityReservationsClient *compute.CapacityReservationsClient - CapacityReservationGroupsClient *compute.CapacityReservationGroupsClient - DedicatedHostsClient *compute.DedicatedHostsClient - DedicatedHostGroupsClient *compute.DedicatedHostGroupsClient - DisksClient *compute.DisksClient - DiskAccessClient *compute.DiskAccessesClient - DiskEncryptionSetsClient *compute.DiskEncryptionSetsClient - GalleriesClient *compute.GalleriesClient - GalleryImagesClient *compute.GalleryImagesClient - GalleryImageVersionsClient *compute.GalleryImageVersionsClient - ProximityPlacementGroupsClient *compute.ProximityPlacementGroupsClient - MarketplaceAgreementsClient *marketplaceordering.MarketplaceAgreementsClient - ImagesClient *compute.ImagesClient - SnapshotsClient *compute.SnapshotsClient - UsageClient *compute.UsageClient - VMExtensionImageClient *compute.VirtualMachineExtensionImagesClient - VMExtensionClient *compute.VirtualMachineExtensionsClient - VMScaleSetClient *compute.VirtualMachineScaleSetsClient - VMScaleSetExtensionsClient *compute.VirtualMachineScaleSetExtensionsClient - VMScaleSetRollingUpgradesClient *compute.VirtualMachineScaleSetRollingUpgradesClient - VMScaleSetVMsClient *compute.VirtualMachineScaleSetVMsClient - VMClient *compute.VirtualMachinesClient - VMImageClient *compute.VirtualMachineImagesClient - SSHPublicKeysClient *compute.SSHPublicKeysClient + AvailabilitySetsClient *availabilitysets.AvailabilitySetsClient + CapacityReservationsClient *compute.CapacityReservationsClient + CapacityReservationGroupsClient *compute.CapacityReservationGroupsClient + DedicatedHostsClient *dedicatedhosts.DedicatedHostsClient + DedicatedHostGroupsClient *dedicatedhostgroups.DedicatedHostGroupsClient + DisksClient *compute.DisksClient + DiskAccessClient *compute.DiskAccessesClient + DiskEncryptionSetsClient *compute.DiskEncryptionSetsClient + GalleriesClient *compute.GalleriesClient + GalleryApplicationsClient *compute.GalleryApplicationsClient + GalleryApplicationVersionsClient *compute.GalleryApplicationVersionsClient + GalleryImagesClient *compute.GalleryImagesClient + GalleryImageVersionsClient *compute.GalleryImageVersionsClient + ImagesClient *compute.ImagesClient + MarketplaceAgreementsClient *marketplaceordering.MarketplaceAgreementsClient + ProximityPlacementGroupsClient *proximityplacementgroups.ProximityPlacementGroupsClient + SSHPublicKeysClient *sshpublickeys.SshPublicKeysClient + SnapshotsClient *compute.SnapshotsClient + UsageClient *compute.UsageClient + VMExtensionImageClient *compute.VirtualMachineExtensionImagesClient + VMExtensionClient *compute.VirtualMachineExtensionsClient + VMScaleSetClient *compute.VirtualMachineScaleSetsClient + VMScaleSetExtensionsClient *compute.VirtualMachineScaleSetExtensionsClient + VMScaleSetRollingUpgradesClient *compute.VirtualMachineScaleSetRollingUpgradesClient + VMScaleSetVMsClient *compute.VirtualMachineScaleSetVMsClient + VMClient *compute.VirtualMachinesClient + VMImageClient *compute.VirtualMachineImagesClient } func NewClient(o *common.ClientOptions) *Client { - availabilitySetsClient := compute.NewAvailabilitySetsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + availabilitySetsClient := availabilitysets.NewAvailabilitySetsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&availabilitySetsClient.Client, o.ResourceManagerAuthorizer) capacityReservationsClient := compute.NewCapacityReservationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) @@ -44,10 +51,10 @@ func NewClient(o *common.ClientOptions) *Client { capacityReservationGroupsClient := compute.NewCapacityReservationGroupsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&capacityReservationGroupsClient.Client, o.ResourceManagerAuthorizer) - dedicatedHostsClient := compute.NewDedicatedHostsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + dedicatedHostsClient := dedicatedhosts.NewDedicatedHostsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&dedicatedHostsClient.Client, o.ResourceManagerAuthorizer) - dedicatedHostGroupsClient := compute.NewDedicatedHostGroupsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + dedicatedHostGroupsClient := dedicatedhostgroups.NewDedicatedHostGroupsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&dedicatedHostGroupsClient.Client, o.ResourceManagerAuthorizer) disksClient := compute.NewDisksClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) @@ -62,6 +69,12 @@ func NewClient(o *common.ClientOptions) *Client { galleriesClient := compute.NewGalleriesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&galleriesClient.Client, o.ResourceManagerAuthorizer) + galleryApplicationsClient := compute.NewGalleryApplicationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&galleryApplicationsClient.Client, o.ResourceManagerAuthorizer) + + galleryApplicationVersionsClient := compute.NewGalleryApplicationVersionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&galleryApplicationVersionsClient.Client, o.ResourceManagerAuthorizer) + galleryImagesClient := compute.NewGalleryImagesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&galleryImagesClient.Client, o.ResourceManagerAuthorizer) @@ -74,12 +87,15 @@ func NewClient(o *common.ClientOptions) *Client { marketplaceAgreementsClient := marketplaceordering.NewMarketplaceAgreementsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&marketplaceAgreementsClient.Client, o.ResourceManagerAuthorizer) - proximityPlacementGroupsClient := compute.NewProximityPlacementGroupsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + proximityPlacementGroupsClient := proximityplacementgroups.NewProximityPlacementGroupsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&proximityPlacementGroupsClient.Client, o.ResourceManagerAuthorizer) snapshotsClient := compute.NewSnapshotsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&snapshotsClient.Client, o.ResourceManagerAuthorizer) + sshPublicKeysClient := sshpublickeys.NewSshPublicKeysClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&sshPublicKeysClient.Client, o.ResourceManagerAuthorizer) + usageClient := compute.NewUsageClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&usageClient.Client, o.ResourceManagerAuthorizer) @@ -107,34 +123,33 @@ func NewClient(o *common.ClientOptions) *Client { vmClient := compute.NewVirtualMachinesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&vmClient.Client, o.ResourceManagerAuthorizer) - sshPublicKeysClient := compute.NewSSHPublicKeysClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&sshPublicKeysClient.Client, o.ResourceManagerAuthorizer) - return &Client{ - AvailabilitySetsClient: &availabilitySetsClient, - CapacityReservationsClient: &capacityReservationsClient, - CapacityReservationGroupsClient: &capacityReservationGroupsClient, - DedicatedHostsClient: &dedicatedHostsClient, - DedicatedHostGroupsClient: &dedicatedHostGroupsClient, - DisksClient: &disksClient, - DiskAccessClient: &diskAccessClient, - DiskEncryptionSetsClient: &diskEncryptionSetsClient, - GalleriesClient: &galleriesClient, - GalleryImagesClient: &galleryImagesClient, - GalleryImageVersionsClient: &galleryImageVersionsClient, - ImagesClient: &imagesClient, - MarketplaceAgreementsClient: &marketplaceAgreementsClient, - ProximityPlacementGroupsClient: &proximityPlacementGroupsClient, - SnapshotsClient: &snapshotsClient, - UsageClient: &usageClient, - VMExtensionImageClient: &vmExtensionImageClient, - VMExtensionClient: &vmExtensionClient, - VMScaleSetClient: &vmScaleSetClient, - VMScaleSetExtensionsClient: &vmScaleSetExtensionsClient, - VMScaleSetRollingUpgradesClient: &vmScaleSetRollingUpgradesClient, - VMScaleSetVMsClient: &vmScaleSetVMsClient, - VMClient: &vmClient, - VMImageClient: &vmImageClient, - SSHPublicKeysClient: &sshPublicKeysClient, + AvailabilitySetsClient: &availabilitySetsClient, + CapacityReservationsClient: &capacityReservationsClient, + CapacityReservationGroupsClient: &capacityReservationGroupsClient, + DedicatedHostsClient: &dedicatedHostsClient, + DedicatedHostGroupsClient: &dedicatedHostGroupsClient, + DisksClient: &disksClient, + DiskAccessClient: &diskAccessClient, + DiskEncryptionSetsClient: &diskEncryptionSetsClient, + GalleriesClient: &galleriesClient, + GalleryApplicationsClient: &galleryApplicationsClient, + GalleryApplicationVersionsClient: &galleryApplicationVersionsClient, + GalleryImagesClient: &galleryImagesClient, + GalleryImageVersionsClient: &galleryImageVersionsClient, + ImagesClient: &imagesClient, + MarketplaceAgreementsClient: &marketplaceAgreementsClient, + ProximityPlacementGroupsClient: &proximityPlacementGroupsClient, + SSHPublicKeysClient: &sshPublicKeysClient, + SnapshotsClient: &snapshotsClient, + UsageClient: &usageClient, + VMExtensionImageClient: &vmExtensionImageClient, + VMExtensionClient: &vmExtensionClient, + VMScaleSetClient: &vmScaleSetClient, + VMScaleSetExtensionsClient: &vmScaleSetExtensionsClient, + VMScaleSetRollingUpgradesClient: &vmScaleSetRollingUpgradesClient, + VMScaleSetVMsClient: &vmScaleSetVMsClient, + VMClient: &vmClient, + VMImageClient: &vmImageClient, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_data_source.go index 6b2f2ff5c86..04b8ec950f0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_data_source.go @@ -4,15 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceDedicatedHost() *pluginsdk.Resource { @@ -40,7 +40,7 @@ func dataSourceDedicatedHost() *pluginsdk.Resource { "location": commonschema.LocationComputed(), - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -51,22 +51,29 @@ func dataSourceDedicatedHostRead(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewDedicatedHostID(subscriptionId, d.Get("resource_group_name").(string), d.Get("dedicated_host_group_name").(string), d.Get("name").(string)) + id := dedicatedhosts.NewHostID(subscriptionId, d.Get("resource_group_name").(string), d.Get("dedicated_host_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.HostGroupName, id.HostName, "") + resp, err := client.Get(ctx, id, dedicatedhosts.DefaultGetOperationOptions()) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } + return fmt.Errorf("reading %s: %+v", id, err) } d.SetId(id.ID()) d.Set("name", id.HostName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("dedicated_host_group_name", id.HostGroupName) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } + } - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_group_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_group_data_source.go index 322429c23bf..0446ea8c1a9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_group_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_group_data_source.go @@ -5,16 +5,16 @@ import ( "regexp" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceDedicatedHostGroup() *pluginsdk.Resource { @@ -59,10 +59,10 @@ func dataSourceDedicatedHostGroupRead(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewDedicatedHostGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.HostGroupName, "") + id := dedicatedhostgroups.NewHostGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id, dedicatedhostgroups.DefaultGetOperationOptions()) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("reading %s: %+v", id, err) @@ -71,20 +71,21 @@ func dataSourceDedicatedHostGroupRead(d *pluginsdk.ResourceData, meta interface{ d.SetId(id.ID()) d.Set("name", id.HostGroupName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - d.Set("location", location.NormalizeNilable(resp.Location)) - d.Set("zones", zones.Flatten(resp.Zones)) + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + d.Set("zones", zones.Flatten(model.Zones)) - if props := resp.DedicatedHostGroupProperties; props != nil { - d.Set("automatic_placement_enabled", props.SupportAutomaticPlacement) + if props := model.Properties; props != nil { + d.Set("automatic_placement_enabled", props.SupportAutomaticPlacement) + d.Set("platform_fault_domain_count", props.PlatformFaultDomainCount) + } - platformFaultDomainCount := 0 - if props.PlatformFaultDomainCount != nil { - platformFaultDomainCount = int(*props.PlatformFaultDomainCount) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err } - d.Set("platform_fault_domain_count", platformFaultDomainCount) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_group_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_group_resource.go index 06de97bed5f..f8eba877674 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_group_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_group_resource.go @@ -5,15 +5,14 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -28,7 +27,7 @@ func resourceDedicatedHostGroup() *pluginsdk.Resource { Delete: resourceDedicatedHostGroupDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.HostGroupID(id) + _, err := dedicatedhostgroups.ParseHostGroupID(id) return err }), @@ -47,11 +46,9 @@ func resourceDedicatedHostGroup() *pluginsdk.Resource { ValidateFunc: validate.DedicatedHostGroupName(), }, - "location": azure.SchemaLocation(), + "resource_group_name": commonschema.ResourceGroupName(), - // There's a bug in the Azure API where this is returned in upper-case - // BUG: https://github.com/Azure/azure-rest-api-specs/issues/8068 - "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), + "location": commonschema.Location(), "platform_fault_domain_count": { Type: pluginsdk.TypeInt, @@ -68,7 +65,7 @@ func resourceDedicatedHostGroup() *pluginsdk.Resource { }, "zone": commonschema.ZoneSingleOptionalForceNew(), - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -79,48 +76,45 @@ func resourceDedicatedHostGroupCreate(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewHostGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - + id := dedicatedhostgroups.NewHostGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name, "") + existing, err := client.Get(ctx, id, dedicatedhostgroups.DefaultGetOperationOptions()) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_dedicated_host_group", id.ID()) } } - location := azure.NormalizeLocation(d.Get("location").(string)) platformFaultDomainCount := d.Get("platform_fault_domain_count").(int) t := d.Get("tags").(map[string]interface{}) - parameters := compute.DedicatedHostGroup{ - Location: utils.String(location), - DedicatedHostGroupProperties: &compute.DedicatedHostGroupProperties{ - PlatformFaultDomainCount: utils.Int32(int32(platformFaultDomainCount)), + payload := dedicatedhostgroups.DedicatedHostGroup{ + Location: location.Normalize(d.Get("location").(string)), + Properties: &dedicatedhostgroups.DedicatedHostGroupProperties{ + PlatformFaultDomainCount: int64(platformFaultDomainCount), }, Tags: tags.Expand(t), } if zone, ok := d.GetOk("zone"); ok { - parameters.Zones = &[]string{ + payload.Zones = &[]string{ zone.(string), } } if v, ok := d.GetOk("automatic_placement_enabled"); ok { - parameters.DedicatedHostGroupProperties.SupportAutomaticPlacement = utils.Bool(v.(bool)) + payload.Properties.SupportAutomaticPlacement = utils.Bool(v.(bool)) } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, payload); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } d.SetId(id.ID()) - return resourceDedicatedHostGroupRead(d, meta) } @@ -129,44 +123,45 @@ func resourceDedicatedHostGroupRead(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.HostGroupID(d.Id()) + id, err := dedicatedhostgroups.ParseHostGroupID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name, "") + resp, err := client.Get(ctx, *id, dedicatedhostgroups.DefaultGetOperationOptions()) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] Dedicated Host Group %q does not exist - removing from state", d.Id()) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %q was not found - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("reading Dedicated Host Group %q (: %+v", id.String(), err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.HostGroupName) + d.Set("resource_group_name", id.ResourceGroupName) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) - zone := "" - if resp.Zones != nil && len(*resp.Zones) > 0 { - z := *resp.Zones - zone = z[0] - } - d.Set("zone", zone) + zone := "" + if model.Zones != nil && len(*model.Zones) > 0 { + z := *model.Zones + zone = z[0] + } + d.Set("zone", zone) - if props := resp.DedicatedHostGroupProperties; props != nil { - platformFaultDomainCount := 0 - if props.PlatformFaultDomainCount != nil { - platformFaultDomainCount = int(*props.PlatformFaultDomainCount) + if props := model.Properties; props != nil { + d.Set("platform_fault_domain_count", props.PlatformFaultDomainCount) + d.Set("automatic_placement_enabled", props.SupportAutomaticPlacement) } - d.Set("platform_fault_domain_count", platformFaultDomainCount) - d.Set("automatic_placement_enabled", props.SupportAutomaticPlacement) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceDedicatedHostGroupUpdate(d *pluginsdk.ResourceData, meta interface{}) error { @@ -174,16 +169,17 @@ func resourceDedicatedHostGroupUpdate(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - resourceGroupName := d.Get("resource_group_name").(string) - t := d.Get("tags").(map[string]interface{}) + id, err := dedicatedhostgroups.ParseHostGroupID(d.Id()) + if err != nil { + return err + } - parameters := compute.DedicatedHostGroupUpdate{ - Tags: tags.Expand(t), + payload := dedicatedhostgroups.DedicatedHostGroupUpdate{ + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - if _, err := client.Update(ctx, resourceGroupName, name, parameters); err != nil { - return fmt.Errorf("updating Dedicated Host Group %q (Resource Group %q): %+v", name, resourceGroupName, err) + if _, err := client.Update(ctx, *id, payload); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } return resourceDedicatedHostGroupRead(d, meta) @@ -194,13 +190,13 @@ func resourceDedicatedHostGroupDelete(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.HostGroupID(d.Id()) + id, err := dedicatedhostgroups.ParseHostGroupID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.Name); err != nil { - return fmt.Errorf("deleting Dedicated Host Group %q : %+v", id.String(), err) + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_resource.go index f1d02c1e534..2dc6307bf4d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/dedicated_host_resource.go @@ -6,14 +6,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -28,7 +29,7 @@ func resourceDedicatedHost() *pluginsdk.Resource { Delete: resourceDedicatedHostDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DedicatedHostID(id) + _, err := dedicatedhosts.ParseHostID(id) return err }), @@ -47,48 +48,62 @@ func resourceDedicatedHost() *pluginsdk.Resource { ValidateFunc: validate.DedicatedHostName(), }, - "location": azure.SchemaLocation(), - "dedicated_host_group_id": { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.DedicatedHostGroupID, + ValidateFunc: dedicatedhostgroups.ValidateHostGroupID, }, + "location": commonschema.Location(), + "sku_name": { Type: pluginsdk.TypeString, ForceNew: true, Required: true, ValidateFunc: validation.StringInSlice([]string{ - "DSv3-Type1", - "DSv3-Type2", - "DSv4-Type1", - "ESv3-Type1", - "ESv3-Type2", - "FSv2-Type2", + "DADSv5-Type1", "DASv4-Type1", + "DASv4-Type2", + "DASv5-Type1", "DCSv2-Type1", "DDSv4-Type1", + "DDSv4-Type2", + "DDSv5-Type1", "DSv3-Type1", "DSv3-Type2", "DSv3-Type3", "DSv3-Type4", "DSv4-Type1", + "DSv4-Type2", + "DSv5-Type1", + "EADSv5-Type1", "EASv4-Type1", + "EASv4-Type2", + "EASv5-Type1", "EDSv4-Type1", + "EDSv4-Type2", + "EDSv5-Type1", "ESv3-Type1", "ESv3-Type2", "ESv3-Type3", "ESv3-Type4", "ESv4-Type1", + "ESv4-Type2", + "ESv5-Type1", "FSv2-Type2", "FSv2-Type3", + "FSv2-Type4", + "FXmds-Type1", "LSv2-Type1", + "MDMSv2MedMem-Type1", + "MDSv2MedMem-Type1", + "MMSv2MedMem-Type1", "MS-Type1", "MSm-Type1", "MSmv2-Type1", "MSv2-Type1", + "MSv2MedMem-Type1", "NVASv4-Type1", "NVSv3-Type1", }, false), @@ -110,14 +125,15 @@ func resourceDedicatedHost() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(compute.DedicatedHostLicenseTypesNone), - string(compute.DedicatedHostLicenseTypesWindowsServerHybrid), - string(compute.DedicatedHostLicenseTypesWindowsServerPerpetual), + // TODO: remove `None` in 4.0 in favour of this field being set to an empty string (since it's optional) + string(dedicatedhosts.DedicatedHostLicenseTypesNone), + string(dedicatedhosts.DedicatedHostLicenseTypesWindowsServerHybrid), + string(dedicatedhosts.DedicatedHostLicenseTypesWindowsServerPerpetual), }, false), - Default: string(compute.DedicatedHostLicenseTypesNone), + Default: string(dedicatedhosts.DedicatedHostLicenseTypesNone), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -127,102 +143,90 @@ func resourceDedicatedHostCreate(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - hostGroupId, err := parse.DedicatedHostGroupID(d.Get("dedicated_host_group_id").(string)) + hostGroupId, err := dedicatedhostgroups.ParseHostGroupID(d.Get("dedicated_host_group_id").(string)) if err != nil { return err } - id := parse.NewDedicatedHostID(hostGroupId.SubscriptionId, hostGroupId.ResourceGroup, hostGroupId.HostGroupName, d.Get("name").(string)) + id := dedicatedhosts.NewHostID(hostGroupId.SubscriptionId, hostGroupId.ResourceGroupName, hostGroupId.HostGroupName, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.HostGroupName, id.HostName, "") + existing, err := client.Get(ctx, id, dedicatedhosts.DefaultGetOperationOptions()) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_dedicated_host", id.ID()) } } - parameters := compute.DedicatedHost{ - Location: utils.String(azure.NormalizeLocation(d.Get("location").(string))), - DedicatedHostProperties: &compute.DedicatedHostProperties{ + licenseType := dedicatedhosts.DedicatedHostLicenseTypes(d.Get("license_type").(string)) + payload := dedicatedhosts.DedicatedHost{ + Location: location.Normalize(d.Get("location").(string)), + Properties: &dedicatedhosts.DedicatedHostProperties{ AutoReplaceOnFailure: utils.Bool(d.Get("auto_replace_on_failure").(bool)), - LicenseType: compute.DedicatedHostLicenseTypes(d.Get("license_type").(string)), - PlatformFaultDomain: utils.Int32(int32(d.Get("platform_fault_domain").(int))), + LicenseType: &licenseType, + PlatformFaultDomain: utils.Int64(int64(d.Get("platform_fault_domain").(int))), }, - Sku: &compute.Sku{ + Sku: dedicatedhosts.Sku{ Name: utils.String(d.Get("sku_name").(string)), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.HostGroupName, id.HostName, parameters) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } d.SetId(id.ID()) return resourceDedicatedHostRead(d, meta) } func resourceDedicatedHostRead(d *pluginsdk.ResourceData, meta interface{}) error { - groupsClient := meta.(*clients.Client).Compute.DedicatedHostGroupsClient hostsClient := meta.(*clients.Client).Compute.DedicatedHostsClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DedicatedHostID(d.Id()) + id, err := dedicatedhosts.ParseHostID(d.Id()) if err != nil { return err } - hostGroupId := parse.NewDedicatedHostGroupID(id.SubscriptionId, id.ResourceGroup, id.HostGroupName) - group, err := groupsClient.Get(ctx, hostGroupId.ResourceGroup, hostGroupId.HostGroupName, "") + resp, err := hostsClient.Get(ctx, *id, dedicatedhosts.DefaultGetOperationOptions()) if err != nil { - if utils.ResponseWasNotFound(group.Response) { - log.Printf("[INFO] Parent %s does not exist - removing from state", hostGroupId) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s was not found - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving %s: %+v", hostGroupId, err) - } - - resp, err := hostsClient.Get(ctx, id.ResourceGroup, id.HostGroupName, id.HostName, "") - if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] Dedicated Host %q does not exist - removing from state", d.Id()) - d.SetId("") - return nil - } - - return fmt.Errorf("retrieving Dedicated Host %q (Host Group Name %q / Resource Group %q): %+v", id.HostName, id.HostGroupName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("name", id.HostName) - d.Set("dedicated_host_group_id", hostGroupId.ID()) + d.Set("dedicated_host_group_id", dedicatedhostgroups.NewHostGroupID(id.SubscriptionId, id.ResourceGroupName, id.HostGroupName).ID()) + + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + d.Set("sku_name", model.Sku.Name) + if props := model.Properties; props != nil { + d.Set("auto_replace_on_failure", props.AutoReplaceOnFailure) + d.Set("license_type", props.LicenseType) + + platformFaultDomain := 0 + if props.PlatformFaultDomain != nil { + platformFaultDomain = int(*props.PlatformFaultDomain) + } + d.Set("platform_fault_domain", platformFaultDomain) + } - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } - d.Set("sku_name", resp.Sku.Name) - if props := resp.DedicatedHostProperties; props != nil { - d.Set("auto_replace_on_failure", props.AutoReplaceOnFailure) - d.Set("license_type", props.LicenseType) - - platformFaultDomain := 0 - if props.PlatformFaultDomain != nil { - platformFaultDomain = int(*props.PlatformFaultDomain) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err } - d.Set("platform_fault_domain", platformFaultDomain) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceDedicatedHostUpdate(d *pluginsdk.ResourceData, meta interface{}) error { @@ -230,25 +234,30 @@ func resourceDedicatedHostUpdate(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DedicatedHostID(d.Id()) + id, err := dedicatedhosts.ParseHostID(d.Id()) if err != nil { return err } - parameters := compute.DedicatedHostUpdate{ - DedicatedHostProperties: &compute.DedicatedHostProperties{ - AutoReplaceOnFailure: utils.Bool(d.Get("auto_replace_on_failure").(bool)), - LicenseType: compute.DedicatedHostLicenseTypes(d.Get("license_type").(string)), - }, - Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + payload := dedicatedhosts.DedicatedHostUpdate{} + + if d.HasChanges("auto_replace_on_failure", "license_type") { + payload.Properties = &dedicatedhosts.DedicatedHostProperties{} + if d.HasChange("auto_replace_on_failure") { + payload.Properties.AutoReplaceOnFailure = utils.Bool(d.Get("auto_replace_on_failure").(bool)) + } + if d.HasChange("license_type") { + licenseType := dedicatedhosts.DedicatedHostLicenseTypes(d.Get("license_type").(string)) + payload.Properties.LicenseType = &licenseType + } } - future, err := client.Update(ctx, id.ResourceGroup, id.HostGroupName, id.HostName, parameters) - if err != nil { - return fmt.Errorf("updating %s: %+v", *id, err) + if d.HasChange("tags") { + payload.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of %s: %+v", *id, err) + + if err := client.UpdateThenPoll(ctx, *id, payload); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } return resourceDedicatedHostRead(d, meta) @@ -259,22 +268,15 @@ func resourceDedicatedHostDelete(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DedicatedHostID(d.Id()) + id, err := dedicatedhosts.ParseHostID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.HostGroupName, id.HostName) - if err != nil { + if err := client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - } - // API has bug, which appears to be eventually consistent. Tracked by this issue: https://github.com/Azure/azure-rest-api-specs/issues/8137 log.Printf("[DEBUG] Waiting for %s to be fully deleted..", *id) stateConf := &pluginsdk.StateChangeConf{ @@ -293,11 +295,11 @@ func resourceDedicatedHostDelete(d *pluginsdk.ResourceData, meta interface{}) er return nil } -func dedicatedHostDeletedRefreshFunc(ctx context.Context, client *compute.DedicatedHostsClient, id parse.DedicatedHostId) pluginsdk.StateRefreshFunc { +func dedicatedHostDeletedRefreshFunc(ctx context.Context, client *dedicatedhosts.DedicatedHostsClient, id dedicatedhosts.HostId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.HostGroupName, id.HostName, "") + res, err := client.Get(ctx, id, dedicatedhosts.DefaultGetOperationOptions()) if err != nil { - if utils.ResponseWasNotFound(res.Response) { + if response.WasNotFound(res.HttpResponse) { return "NotFound", "NotFound", nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/disk_encryption_set_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/disk_encryption_set_resource.go index 8c6adc8be55..588ce592955 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/disk_encryption_set_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/disk_encryption_set_resource.go @@ -114,11 +114,14 @@ func resourceDiskEncryptionSetCreate(d *pluginsdk.ResourceData, meta interface{} if err != nil { return fmt.Errorf("validating Key Vault Key %q for Disk Encryption Set: %+v", keyVaultKeyId, err) } - if !keyVaultDetails.softDeleteEnabled { - return fmt.Errorf("validating Key Vault %q (Resource Group %q) for Disk Encryption Set: Soft Delete must be enabled but it isn't!", keyVaultDetails.keyVaultName, keyVaultDetails.resourceGroupName) - } - if !keyVaultDetails.purgeProtectionEnabled { - return fmt.Errorf("validating Key Vault %q (Resource Group %q) for Disk Encryption Set: Purge Protection must be enabled but it isn't!", keyVaultDetails.keyVaultName, keyVaultDetails.resourceGroupName) + + if keyVaultDetails != nil { + if !keyVaultDetails.softDeleteEnabled { + return fmt.Errorf("validating Key Vault %q (Resource Group %q) for Disk Encryption Set: Soft Delete must be enabled but it isn't!", keyVaultDetails.keyVaultName, keyVaultDetails.resourceGroupName) + } + if !keyVaultDetails.purgeProtectionEnabled { + return fmt.Errorf("validating Key Vault %q (Resource Group %q) for Disk Encryption Set: Purge Protection must be enabled but it isn't!", keyVaultDetails.keyVaultName, keyVaultDetails.resourceGroupName) + } } location := azure.NormalizeLocation(d.Get("location").(string)) @@ -136,9 +139,6 @@ func resourceDiskEncryptionSetCreate(d *pluginsdk.ResourceData, meta interface{} EncryptionSetProperties: &compute.EncryptionSetProperties{ ActiveKey: &compute.KeyForDiskEncryptionSet{ KeyURL: utils.String(keyVaultKeyId), - SourceVault: &compute.SourceVault{ - ID: utils.String(keyVaultDetails.keyVaultId), - }, }, RotationToLatestKeyVersionEnabled: utils.Bool(rotationToLatestKeyVersionEnabled), EncryptionType: compute.DiskEncryptionSetType(encryptionType), @@ -147,6 +147,12 @@ func resourceDiskEncryptionSetCreate(d *pluginsdk.ResourceData, meta interface{} Tags: tags.Expand(t), } + if keyVaultDetails != nil { + params.EncryptionSetProperties.ActiveKey.SourceVault = &compute.SourceVault{ + ID: utils.String(keyVaultDetails.keyVaultId), + } + } + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, params) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) @@ -231,20 +237,27 @@ func resourceDiskEncryptionSetUpdate(d *pluginsdk.ResourceData, meta interface{} if err != nil { return fmt.Errorf("validating Key Vault Key %q for Disk Encryption Set: %+v", keyVaultKeyId, err) } - if !keyVaultDetails.softDeleteEnabled { - return fmt.Errorf("validating Key Vault %q (Resource Group %q) for Disk Encryption Set: Soft Delete must be enabled but it isn't!", keyVaultDetails.keyVaultName, keyVaultDetails.resourceGroupName) - } - if !keyVaultDetails.purgeProtectionEnabled { - return fmt.Errorf("validating Key Vault %q (Resource Group %q) for Disk Encryption Set: Purge Protection must be enabled but it isn't!", keyVaultDetails.keyVaultName, keyVaultDetails.resourceGroupName) + + if keyVaultDetails != nil { + if !keyVaultDetails.softDeleteEnabled { + return fmt.Errorf("validating Key Vault %q (Resource Group %q) for Disk Encryption Set: Soft Delete must be enabled but it isn't!", keyVaultDetails.keyVaultName, keyVaultDetails.resourceGroupName) + } + if !keyVaultDetails.purgeProtectionEnabled { + return fmt.Errorf("validating Key Vault %q (Resource Group %q) for Disk Encryption Set: Purge Protection must be enabled but it isn't!", keyVaultDetails.keyVaultName, keyVaultDetails.resourceGroupName) + } } + update.DiskEncryptionSetUpdateProperties = &compute.DiskEncryptionSetUpdateProperties{ ActiveKey: &compute.KeyForDiskEncryptionSet{ KeyURL: utils.String(keyVaultKeyId), - SourceVault: &compute.SourceVault{ - ID: utils.String(keyVaultDetails.keyVaultId), - }, }, } + + if keyVaultDetails != nil { + update.DiskEncryptionSetUpdateProperties.ActiveKey.SourceVault = &compute.SourceVault{ + ID: utils.String(keyVaultDetails.keyVaultId), + } + } } if d.HasChange("auto_key_rotation_enabled") { @@ -335,7 +348,7 @@ func diskEncryptionSetRetrieveKeyVault(ctx context.Context, keyVaultsClient *cli return nil, fmt.Errorf("retrieving the Resource ID the Key Vault at URL %q: %s", keyVaultKeyId.KeyVaultBaseUrl, err) } if keyVaultID == nil { - return nil, fmt.Errorf("Unable to determine the Resource ID for the Key Vault at URL %q", keyVaultKeyId.KeyVaultBaseUrl) + return nil, nil } parsedKeyVaultID, err := keyVaultParse.VaultID(*keyVaultID) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/gallery_application_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/gallery_application_resource.go new file mode 100644 index 00000000000..57b336896d8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/gallery_application_resource.go @@ -0,0 +1,362 @@ +package compute + +import ( + "context" + "fmt" + "time" + + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" + "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tags" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type GalleryApplicationResource struct{} + +var ( + _ sdk.ResourceWithUpdate = GalleryApplicationResource{} + _ sdk.ResourceWithCustomizeDiff = GalleryApplicationResource{} +) + +type GalleryApplicationModel struct { + Name string `tfschema:"name"` + GalleryId string `tfschema:"gallery_id"` + Location string `tfschema:"location"` + SupportedOSType string `tfschema:"supported_os_type"` + Description string `tfschema:"description"` + EndOfLifeDate string `tfschema:"end_of_life_date"` + Eula string `tfschema:"eula"` + PrivacyStatementURI string `tfschema:"privacy_statement_uri"` + ReleaseNoteURI string `tfschema:"release_note_uri"` + Tags map[string]string `tfschema:"tags"` +} + +func (r GalleryApplicationResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.GalleryApplicationName, + }, + + "gallery_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.SharedImageGalleryID, + }, + + "location": commonschema.Location(), + + "supported_os_type": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(compute.OperatingSystemTypesWindows), + string(compute.OperatingSystemTypesLinux), + }, false), + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + }, + + "end_of_life_date": { + Type: pluginsdk.TypeString, + Optional: true, + DiffSuppressFunc: suppress.RFC3339Time, + ValidateFunc: validation.IsRFC3339Time, + }, + + "eula": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "privacy_statement_uri": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "release_note_uri": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "tags": tags.Schema(), + } +} + +func (r GalleryApplicationResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r GalleryApplicationResource) ResourceType() string { + return "azurerm_gallery_application" +} + +func (r GalleryApplicationResource) ModelObject() interface{} { + return &GalleryApplicationModel{} +} + +func (r GalleryApplicationResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.GalleryApplicationID +} + +func (r GalleryApplicationResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var state GalleryApplicationModel + if err := metadata.Decode(&state); err != nil { + return err + } + + client := metadata.Client.Compute.GalleryApplicationsClient + subscriptionId := metadata.Client.Account.SubscriptionId + + galleryId, err := parse.SharedImageGalleryID(state.GalleryId) + if err != nil { + return err + } + + id := parse.NewGalleryApplicationID(subscriptionId, galleryId.ResourceGroup, galleryId.GalleryName, state.Name) + + existing, err := client.Get(ctx, id.ResourceGroup, id.GalleryName, id.ApplicationName) + if err != nil && !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for the presence of existing %q: %+v", id, err) + } + if !utils.ResponseWasNotFound(existing.Response) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + input := compute.GalleryApplication{ + Location: utils.String(location.Normalize(state.Location)), + GalleryApplicationProperties: &compute.GalleryApplicationProperties{ + SupportedOSType: compute.OperatingSystemTypes(state.SupportedOSType), + }, + Tags: tags.FromTypedObject(state.Tags), + } + + if state.Description != "" { + input.GalleryApplicationProperties.Description = utils.String(state.Description) + } + + if state.EndOfLifeDate != "" { + endOfLifeDate, _ := time.Parse(time.RFC3339, state.EndOfLifeDate) + input.GalleryApplicationProperties.EndOfLifeDate = &date.Time{ + Time: endOfLifeDate, + } + } + + if state.Eula != "" { + input.GalleryApplicationProperties.Eula = utils.String(state.Eula) + } + + if state.PrivacyStatementURI != "" { + input.GalleryApplicationProperties.PrivacyStatementURI = utils.String(state.PrivacyStatementURI) + } + + if state.ReleaseNoteURI != "" { + input.GalleryApplicationProperties.ReleaseNoteURI = utils.String(state.ReleaseNoteURI) + } + + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.GalleryName, id.ApplicationName, input) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for creation of %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + Timeout: 30 * time.Minute, + } +} + +func (r GalleryApplicationResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Compute.GalleryApplicationsClient + id, err := parse.GalleryApplicationID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.GalleryName, id.ApplicationName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + metadata.Logger.Infof("%q was not found - removing from state!", *id) + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + galleryId := parse.NewSharedImageGalleryID(id.SubscriptionId, id.ResourceGroup, id.GalleryName) + + state := &GalleryApplicationModel{ + Name: id.ApplicationName, + GalleryId: galleryId.ID(), + Location: location.NormalizeNilable(resp.Location), + Tags: tags.ToTypedObject(resp.Tags), + } + + if props := resp.GalleryApplicationProperties; props != nil { + if v := props.Description; v != nil { + state.Description = *props.Description + } + + if v := props.EndOfLifeDate; v != nil { + state.EndOfLifeDate = props.EndOfLifeDate.Format(time.RFC3339) + } + + if v := props.Eula; v != nil { + state.Eula = *props.Eula + } + + if v := props.PrivacyStatementURI; v != nil { + state.PrivacyStatementURI = *props.PrivacyStatementURI + } + + if v := props.ReleaseNoteURI; v != nil { + state.ReleaseNoteURI = *props.ReleaseNoteURI + } + + state.SupportedOSType = string(props.SupportedOSType) + } + + return metadata.Encode(state) + }, + Timeout: 5 * time.Minute, + } +} + +func (r GalleryApplicationResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + id, err := parse.GalleryApplicationID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var state GalleryApplicationModel + if err := metadata.Decode(&state); err != nil { + return err + } + + client := metadata.Client.Compute.GalleryApplicationsClient + existing, err := client.Get(ctx, id.ResourceGroup, id.GalleryName, id.ApplicationName) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + if metadata.ResourceData.HasChange("description") { + existing.GalleryApplicationProperties.Description = utils.String(state.Description) + } + + if metadata.ResourceData.HasChange("end_of_life_date") { + endOfLifeDate, _ := time.Parse(time.RFC3339, state.EndOfLifeDate) + existing.GalleryApplicationProperties.EndOfLifeDate = &date.Time{ + Time: endOfLifeDate, + } + } + + if metadata.ResourceData.HasChange("eula") { + existing.GalleryApplicationProperties.Eula = utils.String(state.Eula) + } + + if metadata.ResourceData.HasChange("privacy_statement_uri") { + existing.GalleryApplicationProperties.PrivacyStatementURI = utils.String(state.PrivacyStatementURI) + } + + if metadata.ResourceData.HasChange("release_note_uri") { + existing.GalleryApplicationProperties.ReleaseNoteURI = utils.String(state.ReleaseNoteURI) + } + + if metadata.ResourceData.HasChange("tags") { + existing.Tags = tags.FromTypedObject(state.Tags) + } + + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.GalleryName, id.ApplicationName, existing) + if err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for update of %s: %+v", id, err) + } + + return nil + }, + Timeout: 30 * time.Minute, + } +} + +func (r GalleryApplicationResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Compute.GalleryApplicationsClient + id, err := parse.GalleryApplicationID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.GalleryName, id.ApplicationName) + if err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for deletion of %s: %+v", id, err) + } + return nil + }, + Timeout: 30 * time.Minute, + } +} + +func (r GalleryApplicationResource) CustomizeDiff() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + rd := metadata.ResourceDiff + + if oldVal, newVal := rd.GetChange("end_of_life_date"); oldVal.(string) != "" && newVal.(string) == "" { + if err := rd.ForceNew("end_of_life_date"); err != nil { + return err + } + } + + if oldVal, newVal := rd.GetChange("privacy_statement_uri"); oldVal.(string) != "" && newVal.(string) == "" { + if err := rd.ForceNew("privacy_statement_uri"); err != nil { + return err + } + } + + if oldVal, newVal := rd.GetChange("release_note_uri"); oldVal.(string) != "" && newVal.(string) == "" { + if err := rd.ForceNew("release_note_uri"); err != nil { + return err + } + } + + return nil + }, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/gallery_application_version_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/gallery_application_version_resource.go new file mode 100644 index 00000000000..da570e50b71 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/gallery_application_version_resource.go @@ -0,0 +1,568 @@ +package compute + +import ( + "context" + "fmt" + "time" + + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" + "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tags" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type GalleryApplicationVersionResource struct{} + +var ( + _ sdk.ResourceWithUpdate = GalleryApplicationVersionResource{} + _ sdk.ResourceWithCustomizeDiff = GalleryApplicationVersionResource{} +) + +type GalleryApplicationVersionModel struct { + Name string `tfschema:"name"` + GalleryApplicationId string `tfschema:"gallery_application_id"` + Location string `tfschema:"location"` + EnableHealthCheck bool `tfschema:"enable_health_check"` + EndOfLifeDate string `tfschema:"end_of_life_date"` + ExcludeFromLatest bool `tfschema:"exclude_from_latest"` + ManageAction []ManageAction `tfschema:"manage_action"` + Source []Source `tfschema:"source"` + TargetRegion []TargetRegion `tfschema:"target_region"` + Tags map[string]string `tfschema:"tags"` +} + +type Source struct { + MediaLink string `tfschema:"media_link"` + DefaultConfigurationLink string `tfschema:"default_configuration_link"` +} + +type ManageAction struct { + Install string `tfschema:"install"` + Remove string `tfschema:"remove"` + Update string `tfschema:"update"` +} + +type TargetRegion struct { + Name string `tfschema:"name"` + RegionalReplicaCount int `tfschema:"regional_replica_count"` + StorageAccountType string `tfschema:"storage_account_type"` +} + +func (r GalleryApplicationVersionResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.GalleryApplicationVersionName, + }, + + "gallery_application_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.GalleryApplicationID, + }, + + "location": commonschema.Location(), + + "enable_health_check": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "end_of_life_date": { + Type: pluginsdk.TypeString, + Optional: true, + DiffSuppressFunc: suppress.RFC3339Time, + ValidateFunc: validation.IsRFC3339Time, + }, + + "exclude_from_latest": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "manage_action": { + Type: pluginsdk.TypeList, + Required: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "install": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 4096), + }, + + "remove": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 4096), + }, + + "update": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 4096), + }, + }, + }, + }, + + "source": { + Type: pluginsdk.TypeList, + Required: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "media_link": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.IsURLWithScheme([]string{"http", "https"}), + }, + + "default_configuration_link": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IsURLWithScheme([]string{"http", "https"}), + }, + }, + }, + }, + + "target_region": { + // This needs to be a `TypeList` due to the `StateFunc` on the nested property `name` + // See: https://github.com/hashicorp/terraform-plugin-sdk/issues/160 + Type: pluginsdk.TypeList, + Required: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + StateFunc: location.StateFunc, + DiffSuppressFunc: location.DiffSuppressFunc, + }, + + "regional_replica_count": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1, 10), + }, + + "storage_account_type": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(compute.StorageAccountTypePremiumLRS), + string(compute.StorageAccountTypeStandardLRS), + string(compute.StorageAccountTypeStandardZRS), + }, false), + Default: string(compute.StorageAccountTypeStandardLRS), + }, + }, + }, + }, + + "tags": tags.Schema(), + } +} + +func (r GalleryApplicationVersionResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r GalleryApplicationVersionResource) ResourceType() string { + return "azurerm_gallery_application_version" +} + +func (r GalleryApplicationVersionResource) ModelObject() interface{} { + return &GalleryApplicationVersionModel{} +} + +func (r GalleryApplicationVersionResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.GalleryApplicationVersionID +} + +func (r GalleryApplicationVersionResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var state GalleryApplicationVersionModel + if err := metadata.Decode(&state); err != nil { + return err + } + + client := metadata.Client.Compute.GalleryApplicationVersionsClient + subscriptionId := metadata.Client.Account.SubscriptionId + + galleryApplicationId, err := parse.GalleryApplicationID(state.GalleryApplicationId) + if err != nil { + return err + } + + id := parse.NewGalleryApplicationVersionID(subscriptionId, galleryApplicationId.ResourceGroup, galleryApplicationId.GalleryName, galleryApplicationId.ApplicationName, state.Name) + existing, err := client.Get(ctx, id.ResourceGroup, id.GalleryName, id.ApplicationName, id.VersionName, "") + if err != nil && !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for the presence of existing %q: %+v", id, err) + } + if !utils.ResponseWasNotFound(existing.Response) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + input := compute.GalleryApplicationVersion{ + Location: utils.String(location.Normalize(state.Location)), + GalleryApplicationVersionProperties: &compute.GalleryApplicationVersionProperties{ + PublishingProfile: &compute.GalleryApplicationVersionPublishingProfile{ + EnableHealthCheck: utils.Bool(state.EnableHealthCheck), + ExcludeFromLatest: utils.Bool(state.ExcludeFromLatest), + ManageActions: expandGalleryApplicationVersionManageAction(state.ManageAction), + Source: expandGalleryApplicationVersionSource(state.Source), + TargetRegions: expandGalleryApplicationVersionTargetRegion(state.TargetRegion), + }, + }, + Tags: tags.FromTypedObject(state.Tags), + } + + if state.EndOfLifeDate != "" { + endOfLifeDate, _ := time.Parse(time.RFC3339, state.EndOfLifeDate) + input.GalleryApplicationVersionProperties.PublishingProfile.EndOfLifeDate = &date.Time{ + Time: endOfLifeDate, + } + } + + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.GalleryName, id.ApplicationName, id.VersionName, input) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for creation of %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + Timeout: 30 * time.Minute, + } +} + +func (r GalleryApplicationVersionResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Compute.GalleryApplicationVersionsClient + id, err := parse.GalleryApplicationVersionID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.GalleryName, id.ApplicationName, id.VersionName, "") + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + metadata.Logger.Infof("%q was not found - removing from state!", *id) + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + galleryApplicationId := parse.NewGalleryApplicationID(id.SubscriptionId, id.ResourceGroup, id.GalleryName, id.ApplicationName) + + state := &GalleryApplicationVersionModel{ + Name: id.VersionName, + GalleryApplicationId: galleryApplicationId.ID(), + Location: location.NormalizeNilable(resp.Location), + Tags: tags.ToTypedObject(resp.Tags), + } + + if props := resp.GalleryApplicationVersionProperties; props != nil { + if publishingProfile := props.PublishingProfile; publishingProfile != nil { + if publishingProfile.EnableHealthCheck != nil { + state.EnableHealthCheck = *publishingProfile.EnableHealthCheck + } + + if publishingProfile.EndOfLifeDate != nil { + state.EndOfLifeDate = publishingProfile.EndOfLifeDate.Format(time.RFC3339) + } + + if publishingProfile.ExcludeFromLatest != nil { + state.ExcludeFromLatest = *publishingProfile.ExcludeFromLatest + } + + if publishingProfile.ManageActions != nil { + state.ManageAction = flattenGalleryApplicationVersionManageAction(publishingProfile.ManageActions) + } + + if publishingProfile.Source != nil { + state.Source = flattenGalleryApplicationVersionSource(publishingProfile.Source) + } + + if publishingProfile.TargetRegions != nil { + state.TargetRegion = flattenGalleryApplicationVersionTargetRegion(publishingProfile.TargetRegions) + } + } + } + + return metadata.Encode(state) + }, + Timeout: 5 * time.Minute, + } +} + +func (r GalleryApplicationVersionResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + id, err := parse.GalleryApplicationVersionID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var state GalleryApplicationVersionModel + if err := metadata.Decode(&state); err != nil { + return err + } + + client := metadata.Client.Compute.GalleryApplicationVersionsClient + existing, err := client.Get(ctx, id.ResourceGroup, id.GalleryName, id.ApplicationName, id.VersionName, "") + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + if existing.PublishingProfile == nil { + existing.PublishingProfile = &compute.GalleryApplicationVersionPublishingProfile{} + } + + if metadata.ResourceData.HasChange("enable_health_check") { + existing.PublishingProfile.EnableHealthCheck = utils.Bool(state.EnableHealthCheck) + } + + if metadata.ResourceData.HasChange("end_of_life_date") { + endOfLifeDate, _ := time.Parse(time.RFC3339, state.EndOfLifeDate) + existing.GalleryApplicationVersionProperties.PublishingProfile.EndOfLifeDate = &date.Time{ + Time: endOfLifeDate, + } + } + + if metadata.ResourceData.HasChange("exclude_from_latest") { + existing.PublishingProfile.ExcludeFromLatest = utils.Bool(state.ExcludeFromLatest) + } + + if metadata.ResourceData.HasChange("manage_actions") { + existing.GalleryApplicationVersionProperties.PublishingProfile.ManageActions = expandGalleryApplicationVersionManageAction(state.ManageAction) + } + if metadata.ResourceData.HasChange("source") { + existing.GalleryApplicationVersionProperties.PublishingProfile.Source = expandGalleryApplicationVersionSource(state.Source) + } + + if metadata.ResourceData.HasChange("target_region") { + existing.GalleryApplicationVersionProperties.PublishingProfile.TargetRegions = expandGalleryApplicationVersionTargetRegion(state.TargetRegion) + } + + if metadata.ResourceData.HasChange("tags") { + existing.Tags = tags.FromTypedObject(state.Tags) + } + + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.GalleryName, id.ApplicationName, id.VersionName, existing) + if err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for update of %s: %+v", id, err) + } + + return nil + }, + Timeout: 30 * time.Minute, + } +} + +func (r GalleryApplicationVersionResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Compute.GalleryApplicationVersionsClient + id, err := parse.GalleryApplicationVersionID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.GalleryName, id.ApplicationName, id.VersionName) + if err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for deletion of %s: %+v", id, err) + } + + metadata.Logger.Infof("Waiting for %s to be eventually deleted", *id) + timeout, _ := ctx.Deadline() + stateConf := &pluginsdk.StateChangeConf{ + Pending: []string{"Exists"}, + Target: []string{"NotFound"}, + Refresh: galleryApplicationVersionDeleteStateRefreshFunc(ctx, client, *id), + MinTimeout: 10 * time.Second, + ContinuousTargetOccurence: 10, + Timeout: time.Until(timeout), + } + + if _, err := stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for %s to be deleted: %+v", *id, err) + } + + return nil + }, + Timeout: 30 * time.Minute, + } +} + +func (r GalleryApplicationVersionResource) CustomizeDiff() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + rd := metadata.ResourceDiff + + if oldVal, newVal := rd.GetChange("end_of_life_date"); oldVal.(string) != "" && newVal.(string) == "" { + if err := rd.ForceNew("end_of_life_date"); err != nil { + return err + } + } + + return nil + }, + } +} + +func expandGalleryApplicationVersionManageAction(input []ManageAction) *compute.UserArtifactManage { + if len(input) == 0 { + return &compute.UserArtifactManage{} + } + v := input[0] + return &compute.UserArtifactManage{ + Install: utils.String(v.Install), + Remove: utils.String(v.Remove), + Update: utils.String(v.Update), + } +} + +func flattenGalleryApplicationVersionManageAction(input *compute.UserArtifactManage) []ManageAction { + if input == nil { + return nil + } + + obj := ManageAction{} + + if input.Install != nil { + obj.Install = *input.Install + } + + if input.Remove != nil { + obj.Remove = *input.Remove + } + + if input.Update != nil { + obj.Update = *input.Update + } + + return []ManageAction{obj} +} + +func expandGalleryApplicationVersionSource(input []Source) *compute.UserArtifactSource { + if len(input) == 0 { + return &compute.UserArtifactSource{} + } + v := input[0] + return &compute.UserArtifactSource{ + MediaLink: utils.String(v.MediaLink), + DefaultConfigurationLink: utils.String(v.DefaultConfigurationLink), + } +} + +func flattenGalleryApplicationVersionSource(input *compute.UserArtifactSource) []Source { + if input == nil { + return nil + } + + obj := Source{} + + if input.MediaLink != nil { + obj.MediaLink = *input.MediaLink + } + + if input.DefaultConfigurationLink != nil { + obj.DefaultConfigurationLink = *input.DefaultConfigurationLink + } + + return []Source{obj} +} + +func expandGalleryApplicationVersionTargetRegion(input []TargetRegion) *[]compute.TargetRegion { + results := make([]compute.TargetRegion, 0) + for _, item := range input { + results = append(results, compute.TargetRegion{ + Name: utils.String(location.Normalize(item.Name)), + RegionalReplicaCount: utils.Int32(int32(item.RegionalReplicaCount)), + StorageAccountType: compute.StorageAccountType(item.StorageAccountType), + }) + } + return &results +} + +func flattenGalleryApplicationVersionTargetRegion(input *[]compute.TargetRegion) []TargetRegion { + if input == nil { + return nil + } + + results := make([]TargetRegion, 0) + + for _, item := range *input { + obj := TargetRegion{} + + if item.Name != nil { + obj.Name = location.Normalize(*item.Name) + } + + if item.RegionalReplicaCount != nil { + obj.RegionalReplicaCount = int(*item.RegionalReplicaCount) + } + + if item.StorageAccountType != "" { + obj.StorageAccountType = string(item.StorageAccountType) + } + results = append(results, obj) + } + return results +} + +func galleryApplicationVersionDeleteStateRefreshFunc(ctx context.Context, client *compute.GalleryApplicationVersionsClient, id parse.GalleryApplicationVersionId) pluginsdk.StateRefreshFunc { + // Whilst the Gallery Application Version is deleted quickly, it appears it's not actually finished replicating at this time + // so the deletion of the parent Gallery Application fails with "can not delete until nested resources are deleted" + // ergo we need to poll on this for a bit, see https://github.com/Azure/azure-rest-api-specs/issues/19686 + return func() (interface{}, string, error) { + res, err := client.Get(ctx, id.ResourceGroup, id.GalleryName, id.ApplicationName, id.VersionName, "") + if err != nil { + if utils.ResponseWasNotFound(res.Response) { + return "NotFound", "NotFound", nil + } + + return nil, "", fmt.Errorf("failed to poll to check if the Gallery Application Version has been deleted: %+v", err) + } + + return res, "Exists", nil + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/images_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/images_data_source.go index 89c211e6084..9c3a022519f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/images_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/images_data_source.go @@ -3,6 +3,7 @@ package compute import ( "context" "fmt" + "sort" "time" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" @@ -139,7 +140,23 @@ func dataSourceImagesRead(d *pluginsdk.ResourceData, meta interface{}) error { return fmt.Errorf("no images were found that match the specified tags") } - d.SetId(time.Now().UTC().String()) + tagsId := "" + tagKeys := make([]string, 0, len(filterTags)) + for key := range filterTags { + tagKeys = append(tagKeys, key) + } + sort.Strings(tagKeys) + for _, key := range tagKeys { + value := "" + if v, ok := filterTags[key]; ok && v != nil { + value = *v + } + tagsId += fmt.Sprintf("[%s:%s]", key, value) + } + if tagsId == "" { + tagsId = "[]" + } + d.SetId(fmt.Sprintf("resourceGroups/%s/tags/%s/images", resourceGroup, tagsId)) d.Set("resource_group_name", resourceGroup) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/linux_virtual_machine_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/linux_virtual_machine_resource.go index b8494189274..6fb2e691f43 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/linux_virtual_machine_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/linux_virtual_machine_resource.go @@ -7,11 +7,14 @@ import ( "strings" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" @@ -108,12 +111,12 @@ func resourceLinuxVirtualMachine() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ForceNew: true, - ValidateFunc: computeValidate.AvailabilitySetID, - // the Compute/VM API is broken and returns the Resource Group name in UPPERCASE :shrug: + ValidateFunc: availabilitysets.ValidateAvailabilitySetID, + // the Compute/VM API is broken and returns the Availability Set name in UPPERCASE :shrug: + // tracked by https://github.com/Azure/azure-rest-api-specs/issues/19424 DiffSuppressFunc: suppress.CaseDifference, - // TODO: raise a GH issue for the broken API - // availability_set_id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG-200122113424880096/providers/Microsoft.Compute/availabilitySets/ACCTESTAVSET-200122113424880096" => "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG-200122113424880096/providers/Microsoft.Compute/availabilitySets/acctestavset-200122113424880096" (forces new resource) ConflictsWith: []string{ + "capacity_reservation_group_id", "virtual_machine_scale_set_id", "zone", }, @@ -121,6 +124,19 @@ func resourceLinuxVirtualMachine() *pluginsdk.Resource { "boot_diagnostics": bootDiagnosticsSchema(), + "capacity_reservation_group_id": { + Type: pluginsdk.TypeString, + Optional: true, + // the Compute/VM API is broken and returns the Resource Group name in UPPERCASE + // tracked by https://github.com/Azure/azure-rest-api-specs/issues/19424 + DiffSuppressFunc: suppress.CaseDifference, + ValidateFunc: computeValidate.CapacityReservationGroupID, + ConflictsWith: []string{ + "availability_set_id", + "proximity_placement_group_id", + }, + }, + "computer_name": { Type: pluginsdk.TypeString, Optional: true, @@ -137,23 +153,21 @@ func resourceLinuxVirtualMachine() *pluginsdk.Resource { "dedicated_host_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: computeValidate.DedicatedHostID, + ValidateFunc: dedicatedhosts.ValidateHostID, // the Compute/VM API is broken and returns the Resource Group name in UPPERCASE :shrug: - // same for `dedicated_host_group_id` + // tracked by https://github.com/Azure/azure-rest-api-specs/issues/19424 DiffSuppressFunc: suppress.CaseDifference, ConflictsWith: []string{ "dedicated_host_group_id", }, - // TODO: raise a GH issue for the broken API - // /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/TOM-MANUAL/providers/Microsoft.Compute/hostGroups/tom-hostgroup/hosts/tom-manual-host - }, "dedicated_host_group_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: computeValidate.DedicatedHostGroupID, + ValidateFunc: dedicatedhostgroups.ValidateHostGroupID, // the Compute/VM API is broken and returns the Resource Group name in UPPERCASE + // tracked by https://github.com/Azure/azure-rest-api-specs/issues/19424 DiffSuppressFunc: suppress.CaseDifference, ConflictsWith: []string{ "dedicated_host_id", @@ -180,8 +194,8 @@ func resourceLinuxVirtualMachine() *pluginsdk.Resource { Optional: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - // NOTE: whilst Delete is an option here, it's only applicable for VMSS string(compute.VirtualMachineEvictionPolicyTypesDeallocate), + string(compute.VirtualMachineEvictionPolicyTypesDelete), }, false), }, @@ -243,9 +257,13 @@ func resourceLinuxVirtualMachine() *pluginsdk.Resource { "proximity_placement_group_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: computeValidate.ProximityPlacementGroupID, + ValidateFunc: proximityplacementgroups.ValidateProximityPlacementGroupID, // the Compute/VM API is broken and returns the Resource Group name in UPPERCASE :shrug: + // tracked by https://github.com/Azure/azure-rest-api-specs/issues/19424 DiffSuppressFunc: suppress.CaseDifference, + ConflictsWith: []string{ + "capacity_reservation_group_id", + }, }, "secret": linuxSecretSchema(), @@ -543,6 +561,14 @@ func resourceLinuxVirtualMachineCreate(d *pluginsdk.ResourceData, meta interface } } + if v, ok := d.GetOk("capacity_reservation_group_id"); ok { + params.CapacityReservation = &compute.CapacityReservationProfile{ + CapacityReservationGroup: &compute.SubResource{ + ID: utils.String(v.(string)), + }, + } + } + if v, ok := d.GetOk("custom_data"); ok { params.OsProfile.CustomData = utils.String(v.(string)) } @@ -687,6 +713,12 @@ func resourceLinuxVirtualMachineRead(d *pluginsdk.ResourceData, meta interface{} } d.Set("availability_set_id", availabilitySetId) + capacityReservationGroupId := "" + if props.CapacityReservation != nil && props.CapacityReservation.CapacityReservationGroup != nil && props.CapacityReservation.CapacityReservationGroup.ID != nil { + capacityReservationGroupId = *props.CapacityReservation.CapacityReservationGroup.ID + } + d.Set("capacity_reservation_group_id", capacityReservationGroupId) + licenseType := "" if props.LicenseType != nil { licenseType = *props.LicenseType @@ -944,6 +976,23 @@ func resourceLinuxVirtualMachineUpdate(d *pluginsdk.ResourceData, meta interface } } + if d.HasChange("capacity_reservation_group_id") { + shouldUpdate = true + shouldDeallocate = true + + if v, ok := d.GetOk("capacity_reservation_group_id"); ok { + update.CapacityReservation = &compute.CapacityReservationProfile{ + CapacityReservationGroup: &compute.SubResource{ + ID: utils.String(v.(string)), + }, + } + } else { + update.CapacityReservation = &compute.CapacityReservationProfile{ + CapacityReservationGroup: &compute.SubResource{}, + } + } + } + if d.HasChange("dedicated_host_id") { shouldUpdate = true diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/linux_virtual_machine_scale_set_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/linux_virtual_machine_scale_set_resource.go index 5dc54a09822..34cd02e9d63 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/linux_virtual_machine_scale_set_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/linux_virtual_machine_scale_set_resource.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" @@ -193,6 +194,17 @@ func resourceLinuxVirtualMachineScaleSetCreate(d *pluginsdk.ResourceData, meta i }, } + if v, ok := d.GetOk("capacity_reservation_group_id"); ok { + if d.Get("single_placement_group").(bool) { + return fmt.Errorf("`single_placement_group` must be set to `false` when `capacity_reservation_group_id` is specified") + } + virtualMachineProfile.CapacityReservation = &compute.CapacityReservationProfile{ + CapacityReservationGroup: &compute.SubResource{ + ID: utils.String(v.(string)), + }, + } + } + hasHealthExtension := false if vmExtensionsRaw, ok := d.GetOk("extension"); ok { virtualMachineProfile.ExtensionProfile, hasHealthExtension, err = expandVirtualMachineScaleSetExtensions(vmExtensionsRaw.(*pluginsdk.Set).List()) @@ -806,6 +818,12 @@ func resourceLinuxVirtualMachineScaleSetRead(d *pluginsdk.ResourceData, meta int return fmt.Errorf("setting `boot_diagnostics`: %+v", err) } + capacityReservationGroupId := "" + if profile.CapacityReservation != nil && profile.CapacityReservation.CapacityReservationGroup != nil && profile.CapacityReservation.CapacityReservationGroup.ID != nil { + capacityReservationGroupId = *profile.CapacityReservation.CapacityReservationGroup.ID + } + d.Set("capacity_reservation_group_id", capacityReservationGroupId) + // defaulted since BillingProfile isn't returned if it's unset maxBidPrice := float64(-1.0) if profile.BillingProfile != nil && profile.BillingProfile.MaxPrice != nil { @@ -1041,7 +1059,8 @@ func resourceLinuxVirtualMachineScaleSetSchema() map[string]*pluginsdk.Schema { "instances": { Type: pluginsdk.TypeInt, - Required: true, + Optional: true, + Default: 0, ValidateFunc: validation.IntAtLeast(0), }, @@ -1070,6 +1089,16 @@ func resourceLinuxVirtualMachineScaleSetSchema() map[string]*pluginsdk.Schema { "boot_diagnostics": bootDiagnosticsSchema(), + "capacity_reservation_group_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validate.CapacityReservationGroupID, + ConflictsWith: []string{ + "proximity_placement_group_id", + }, + }, + "computer_name_prefix": { Type: pluginsdk.TypeString, Optional: true, @@ -1176,9 +1205,12 @@ func resourceLinuxVirtualMachineScaleSetSchema() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Optional: true, ForceNew: true, - ValidateFunc: validate.ProximityPlacementGroupID, + ValidateFunc: proximityplacementgroups.ValidateProximityPlacementGroupID, // the Compute API is broken and returns the Resource Group name in UPPERCASE :shrug:, github issue: https://github.com/Azure/azure-rest-api-specs/issues/10016 DiffSuppressFunc: suppress.CaseDifference, + ConflictsWith: []string{ + "capacity_reservation_group_id", + }, }, "rolling_upgrade_policy": VirtualMachineScaleSetRollingUpgradePolicySchema(), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/managed_disk_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/managed_disk_data_source.go index 1f213a73f32..8d0a1dc6c66 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/managed_disk_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/managed_disk_data_source.go @@ -35,6 +35,11 @@ func dataSourceManagedDisk() *pluginsdk.Resource { Computed: true, }, + "disk_access_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "disk_encryption_set_id": { Type: pluginsdk.TypeString, Computed: true, @@ -55,11 +60,64 @@ func dataSourceManagedDisk() *pluginsdk.Resource { Computed: true, }, + "encryption_settings": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "disk_encryption_key": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "secret_url": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "source_vault_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + "key_encryption_key": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "key_url": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "source_vault_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + }, + }, + }, + "image_reference_id": { Type: pluginsdk.TypeString, Computed: true, }, + "network_access_policy": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "os_type": { Type: pluginsdk.TypeString, Computed: true, @@ -135,6 +193,13 @@ func dataSourceManagedDiskRead(d *pluginsdk.ResourceData, meta interface{}) erro d.Set("storage_account_id", creationData.StorageAccountID) } + diskAccessId := "" + if props.DiskAccessID != nil { + diskAccessId = *props.DiskAccessID + } + d.Set("disk_access_id", diskAccessId) + + d.Set("network_access_policy", string(props.NetworkAccessPolicy)) d.Set("disk_size_gb", props.DiskSizeGB) d.Set("disk_iops_read_write", props.DiskIOPSReadWrite) d.Set("disk_mbps_read_write", props.DiskMBpsReadWrite) @@ -145,6 +210,10 @@ func dataSourceManagedDiskRead(d *pluginsdk.ResourceData, meta interface{}) erro diskEncryptionSetId = *props.Encryption.DiskEncryptionSetID } d.Set("disk_encryption_set_id", diskEncryptionSetId) + + if err := d.Set("encryption_settings", flattenManagedDiskEncryptionSettings(props.EncryptionSettingsCollection)); err != nil { + return fmt.Errorf("setting `encryption_settings`: %+v", err) + } } return tags.FlattenAndSet(d, resp.Tags) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/managed_disk_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/managed_disk_resource.go index 8d9bc832f9a..82037cf3d45 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/managed_disk_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/managed_disk_resource.go @@ -6,10 +6,9 @@ import ( "strings" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/orchestrated_virtual_machine_scale_set.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/orchestrated_virtual_machine_scale_set.go index 7dc2482a549..3ea461927e5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/orchestrated_virtual_machine_scale_set.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/orchestrated_virtual_machine_scale_set.go @@ -559,7 +559,16 @@ func OrchestratedVirtualMachineScaleSetOSDiskSchema() *pluginsdk.Schema { string(compute.DiffDiskOptionsLocal), }, false), }, - }, + "placement": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + Default: string(compute.DiffDiskPlacementCacheDisk), + ValidateFunc: validation.StringInSlice([]string{ + string(compute.DiffDiskPlacementCacheDisk), + string(compute.DiffDiskPlacementResourceDisk), + }, false), + }}, }, }, @@ -1211,7 +1220,8 @@ func ExpandOrchestratedVirtualMachineScaleSetOSDisk(input []interface{}, osType if diffDiskSettingsRaw := raw["diff_disk_settings"].([]interface{}); len(diffDiskSettingsRaw) > 0 { diffDiskRaw := diffDiskSettingsRaw[0].(map[string]interface{}) disk.DiffDiskSettings = &compute.DiffDiskSettings{ - Option: compute.DiffDiskOptions(diffDiskRaw["option"].(string)), + Option: compute.DiffDiskOptions(diffDiskRaw["option"].(string)), + Placement: compute.DiffDiskPlacement(diffDiskRaw["placement"].(string)), } } @@ -1781,7 +1791,8 @@ func FlattenOrchestratedVirtualMachineScaleSetOSDisk(input *compute.VirtualMachi diffDiskSettings := make([]interface{}, 0) if input.DiffDiskSettings != nil { diffDiskSettings = append(diffDiskSettings, map[string]interface{}{ - "option": string(input.DiffDiskSettings.Option), + "option": string(input.DiffDiskSettings.Option), + "placement": string(input.DiffDiskSettings.Placement), }) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/orchestrated_virtual_machine_scale_set_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/orchestrated_virtual_machine_scale_set_resource.go index 0a67b3bfc9f..8032d50aef3 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/orchestrated_virtual_machine_scale_set_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/orchestrated_virtual_machine_scale_set_resource.go @@ -7,13 +7,11 @@ import ( "strings" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/availability_set.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/availability_set.go deleted file mode 100644 index bae234450ab..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/availability_set.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type AvailabilitySetId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewAvailabilitySetID(subscriptionId, resourceGroup, name string) AvailabilitySetId { - return AvailabilitySetId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id AvailabilitySetId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Availability Set", segmentsStr) -} - -func (id AvailabilitySetId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/availabilitySets/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// AvailabilitySetID parses a AvailabilitySet ID into an AvailabilitySetId struct -func AvailabilitySetID(input string) (*AvailabilitySetId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := AvailabilitySetId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("availabilitySets"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/dedicated_host.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/dedicated_host.go deleted file mode 100644 index f9c7816b810..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/dedicated_host.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DedicatedHostId struct { - SubscriptionId string - ResourceGroup string - HostGroupName string - HostName string -} - -func NewDedicatedHostID(subscriptionId, resourceGroup, hostGroupName, hostName string) DedicatedHostId { - return DedicatedHostId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - HostGroupName: hostGroupName, - HostName: hostName, - } -} - -func (id DedicatedHostId) String() string { - segments := []string{ - fmt.Sprintf("Host Name %q", id.HostName), - fmt.Sprintf("Host Group Name %q", id.HostGroupName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Dedicated Host", segmentsStr) -} - -func (id DedicatedHostId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/hostGroups/%s/hosts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.HostGroupName, id.HostName) -} - -// DedicatedHostID parses a DedicatedHost ID into an DedicatedHostId struct -func DedicatedHostID(input string) (*DedicatedHostId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DedicatedHostId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.HostGroupName, err = id.PopSegment("hostGroups"); err != nil { - return nil, err - } - if resourceId.HostName, err = id.PopSegment("hosts"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/dedicated_host_group.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/dedicated_host_group.go deleted file mode 100644 index 453a86e5019..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/dedicated_host_group.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DedicatedHostGroupId struct { - SubscriptionId string - ResourceGroup string - HostGroupName string -} - -func NewDedicatedHostGroupID(subscriptionId, resourceGroup, hostGroupName string) DedicatedHostGroupId { - return DedicatedHostGroupId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - HostGroupName: hostGroupName, - } -} - -func (id DedicatedHostGroupId) String() string { - segments := []string{ - fmt.Sprintf("Host Group Name %q", id.HostGroupName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Dedicated Host Group", segmentsStr) -} - -func (id DedicatedHostGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/hostGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.HostGroupName) -} - -// DedicatedHostGroupID parses a DedicatedHostGroup ID into an DedicatedHostGroupId struct -func DedicatedHostGroupID(input string) (*DedicatedHostGroupId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DedicatedHostGroupId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.HostGroupName, err = id.PopSegment("hostGroups"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/gallery_application.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/gallery_application.go new file mode 100644 index 00000000000..f3fdc29f5e8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/gallery_application.go @@ -0,0 +1,75 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type GalleryApplicationId struct { + SubscriptionId string + ResourceGroup string + GalleryName string + ApplicationName string +} + +func NewGalleryApplicationID(subscriptionId, resourceGroup, galleryName, applicationName string) GalleryApplicationId { + return GalleryApplicationId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + GalleryName: galleryName, + ApplicationName: applicationName, + } +} + +func (id GalleryApplicationId) String() string { + segments := []string{ + fmt.Sprintf("Application Name %q", id.ApplicationName), + fmt.Sprintf("Gallery Name %q", id.GalleryName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Gallery Application", segmentsStr) +} + +func (id GalleryApplicationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/galleries/%s/applications/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.GalleryName, id.ApplicationName) +} + +// GalleryApplicationID parses a GalleryApplication ID into an GalleryApplicationId struct +func GalleryApplicationID(input string) (*GalleryApplicationId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := GalleryApplicationId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.GalleryName, err = id.PopSegment("galleries"); err != nil { + return nil, err + } + if resourceId.ApplicationName, err = id.PopSegment("applications"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/gallery_application_version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/gallery_application_version.go new file mode 100644 index 00000000000..5e5e6d2f085 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/gallery_application_version.go @@ -0,0 +1,81 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type GalleryApplicationVersionId struct { + SubscriptionId string + ResourceGroup string + GalleryName string + ApplicationName string + VersionName string +} + +func NewGalleryApplicationVersionID(subscriptionId, resourceGroup, galleryName, applicationName, versionName string) GalleryApplicationVersionId { + return GalleryApplicationVersionId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + GalleryName: galleryName, + ApplicationName: applicationName, + VersionName: versionName, + } +} + +func (id GalleryApplicationVersionId) String() string { + segments := []string{ + fmt.Sprintf("Version Name %q", id.VersionName), + fmt.Sprintf("Application Name %q", id.ApplicationName), + fmt.Sprintf("Gallery Name %q", id.GalleryName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Gallery Application Version", segmentsStr) +} + +func (id GalleryApplicationVersionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/galleries/%s/applications/%s/versions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.GalleryName, id.ApplicationName, id.VersionName) +} + +// GalleryApplicationVersionID parses a GalleryApplicationVersion ID into an GalleryApplicationVersionId struct +func GalleryApplicationVersionID(input string) (*GalleryApplicationVersionId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := GalleryApplicationVersionId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.GalleryName, err = id.PopSegment("galleries"); err != nil { + return nil, err + } + if resourceId.ApplicationName, err = id.PopSegment("applications"); err != nil { + return nil, err + } + if resourceId.VersionName, err = id.PopSegment("versions"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/proximity_placement_group.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/proximity_placement_group.go deleted file mode 100644 index abb24fffd41..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse/proximity_placement_group.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ProximityPlacementGroupId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewProximityPlacementGroupID(subscriptionId, resourceGroup, name string) ProximityPlacementGroupId { - return ProximityPlacementGroupId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ProximityPlacementGroupId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Proximity Placement Group", segmentsStr) -} - -func (id ProximityPlacementGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/proximityPlacementGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ProximityPlacementGroupID parses a ProximityPlacementGroup ID into an ProximityPlacementGroupId struct -func ProximityPlacementGroupID(input string) (*ProximityPlacementGroupId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ProximityPlacementGroupId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("proximityPlacementGroups"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/proximity_placement_group_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/proximity_placement_group_data_source.go index e81b41cf9e2..1827f152292 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/proximity_placement_group_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/proximity_placement_group_data_source.go @@ -4,15 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceProximityPlacementGroup() *pluginsdk.Resource { @@ -34,7 +34,7 @@ func dataSourceProximityPlacementGroup() *pluginsdk.Resource { "location": commonschema.LocationComputed(), - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -45,19 +45,25 @@ func dataSourceProximityPlacementGroupRead(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewProximityPlacementGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := proximityplacementgroups.NewProximityPlacementGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name, "") + resp, err := client.Get(ctx, id, proximityplacementgroups.DefaultGetOperationOptions()) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } - return fmt.Errorf("making Read request on %s: %+v", id, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) - d.Set("location", location.NormalizeNilable(resp.Location)) - return tags.FlattenAndSet(d, resp.Tags) + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } + } + + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/proximity_placement_group_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/proximity_placement_group_resource.go index 1de0703a126..01039f9abd6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/proximity_placement_group_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/proximity_placement_group_resource.go @@ -2,19 +2,18 @@ package compute import ( "fmt" - "log" "time" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceProximityPlacementGroup() *pluginsdk.Resource { @@ -25,7 +24,7 @@ func resourceProximityPlacementGroup() *pluginsdk.Resource { Delete: resourceProximityPlacementGroupDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ProximityPlacementGroupID(id) + _, err := proximityplacementgroups.ParseProximityPlacementGroupID(id) return err }), @@ -44,11 +43,11 @@ func resourceProximityPlacementGroup() *pluginsdk.Resource { ValidateFunc: validation.StringIsNotEmpty, }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), - "location": azure.SchemaLocation(), + "location": commonschema.Location(), - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -59,32 +58,28 @@ func resourceProximityPlacementGroupCreateUpdate(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[INFO] preparing arguments for AzureRM Proximity Placement Group creation.") - - id := parse.NewProximityPlacementGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := proximityplacementgroups.NewProximityPlacementGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name, "") + existing, err := client.Get(ctx, id, proximityplacementgroups.DefaultGetOperationOptions()) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing %s: %s", id, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_proximity_placement_group", id.ID()) } } - ppg := compute.ProximityPlacementGroup{ - Name: &id.Name, - Location: utils.String(azure.NormalizeLocation(d.Get("location").(string))), + payload := proximityplacementgroups.ProximityPlacementGroup{ + Location: location.Normalize(d.Get("location").(string)), Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, ppg) - if err != nil { - return err + if _, err := client.CreateOrUpdate(ctx, id, payload); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } d.SetId(id.ID()) @@ -97,27 +92,31 @@ func resourceProximityPlacementGroupRead(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ProximityPlacementGroupID(d.Id()) + id, err := proximityplacementgroups.ParseProximityPlacementGroupID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name, "") + resp, err := client.Get(ctx, *id, proximityplacementgroups.DefaultGetOperationOptions()) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("making Read request on Proximity Placement Group %q : %+v", id.String(), err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) + if model := resp.Model; model != nil { + d.Set("name", id.ProximityPlacementGroupName) + d.Set("resource_group_name", id.ResourceGroupName) + + d.Set("location", location.Normalize(model.Location)) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceProximityPlacementGroupDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -125,11 +124,14 @@ func resourceProximityPlacementGroupDelete(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ProximityPlacementGroupID(d.Id()) + id, err := proximityplacementgroups.ParseProximityPlacementGroupID(d.Id()) if err != nil { return err } - _, err = client.Delete(ctx, id.ResourceGroup, id.Name) - return err + if _, err = client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/registration.go index e9e6caa24eb..77a24894293 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/registration.go @@ -1,6 +1,7 @@ package compute import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -74,3 +75,14 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { return resources } + +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{} +} + +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + GalleryApplicationResource{}, + GalleryApplicationVersionResource{}, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/resourceids.go index 75cc0253c84..1ef1ea274ea 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/resourceids.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/resourceids.go @@ -1,14 +1,12 @@ package compute -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AvailabilitySet -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/availabilitySets/set1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=CapacityReservationGroup -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroup1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=CapacityReservation -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroup1/capacityReservations/capacityReservation1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DedicatedHostGroup -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/hostGroups/hostGroup1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DedicatedHost -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/hostGroups/hostGroup1/hosts/host1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DiskEncryptionSet -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/diskEncryptionSets/set1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=GalleryApplication -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/galleries/gallery1/applications/galleryApplication1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=GalleryApplicationVersion -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/galleries/gallery1/applications/galleryApplication1/versions/galleryApplicationVersion1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Image -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/images/image1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ManagedDisk -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/disks/disk1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ProximityPlacementGroup -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/proximityPlacementGroups/group1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SharedImage -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/galleries/gallery1/images/image1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SharedImageGallery -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/galleries/gallery1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SharedImageVersion -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/galleries/gallery1/images/image1/versions/version1 @@ -22,5 +20,4 @@ package compute //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DataDisk -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Compute/virtualMachines/machine1/dataDisks/disk1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Snapshot -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Compute/snapshots/snapshot1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Plan -id=/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.MarketplaceOrdering/agreements/agreement1/offers/offer1/plans/hourly -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ProximityPlacementGroup -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Compute/proximityPlacementGroups/proximityPlacementGroup1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=HostGroup -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Compute/hostGroups/hostgroup1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_data_source.go index 2dbf49fe820..c211c418f29 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_data_source.go @@ -41,6 +41,11 @@ func dataSourceSharedImage() *pluginsdk.Resource { "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + "architecture": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "os_type": { Type: pluginsdk.TypeString, Computed: true, @@ -131,6 +136,7 @@ func dataSourceSharedImageRead(d *pluginsdk.ResourceData, meta interface{}) erro d.Set("description", props.Description) d.Set("eula", props.Eula) d.Set("os_type", string(props.OsType)) + d.Set("architecture", string(props.Architecture)) d.Set("specialized", props.OsState == compute.OperatingSystemStateTypesSpecialized) d.Set("hyper_v_generation", string(props.HyperVGeneration)) d.Set("privacy_statement_uri", props.PrivacyStatementURI) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_resource.go index 66a6bd78ad4..12211d5cf04 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_resource.go @@ -8,6 +8,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" + "github.com/Azure/go-autorest/autorest/date" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -15,6 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -58,6 +60,17 @@ func resourceSharedImage() *pluginsdk.Resource { "resource_group_name": azure.SchemaResourceGroupName(), + "architecture": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(compute.ArchitectureTypesX64), + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(compute.ArchitectureTypesX64), + string(compute.ArchitectureTypesArm64), + }, false), + }, + "os_type": { Type: pluginsdk.TypeString, Required: true, @@ -68,6 +81,25 @@ func resourceSharedImage() *pluginsdk.Resource { }, false), }, + "disk_types_not_allowed": { + Type: pluginsdk.TypeSet, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + string(compute.DiskStorageAccountTypesStandardLRS), + string(compute.DiskStorageAccountTypesPremiumLRS), + }, false), + }, + }, + + "end_of_life_date": { + Type: pluginsdk.TypeString, + Optional: true, + DiffSuppressFunc: suppress.RFC3339Time, + ValidateFunc: validation.IsRFC3339Time, + }, + "hyper_v_generation": { Type: pluginsdk.TypeString, Optional: true, @@ -86,16 +118,22 @@ func resourceSharedImage() *pluginsdk.Resource { Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "publisher": { - Type: pluginsdk.TypeString, - Required: true, + Type: pluginsdk.TypeString, + ForceNew: true, + Required: true, + ValidateFunc: validate.SharedImageIdentifierAttribute, }, "offer": { - Type: pluginsdk.TypeString, - Required: true, + Type: pluginsdk.TypeString, + ForceNew: true, + Required: true, + ValidateFunc: validate.SharedImageIdentifierAttribute, }, "sku": { - Type: pluginsdk.TypeString, - Required: true, + Type: pluginsdk.TypeString, + ForceNew: true, + Required: true, + ValidateFunc: validate.SharedImageIdentifierAttribute, }, }, }, @@ -142,9 +180,34 @@ func resourceSharedImage() *pluginsdk.Resource { "privacy_statement_uri": { Type: pluginsdk.TypeString, + ForceNew: true, Optional: true, }, + "max_recommended_vcpu_count": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 80), + }, + + "min_recommended_vcpu_count": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 80), + }, + + "max_recommended_memory_in_gb": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 640), + }, + + "min_recommended_memory_in_gb": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 640), + }, + "release_note_uri": { Type: pluginsdk.TypeString, Optional: true, @@ -170,6 +233,12 @@ func resourceSharedImage() *pluginsdk.Resource { "tags": tags.Schema(), }, + + CustomizeDiff: pluginsdk.CustomDiffWithAll( + pluginsdk.ForceNewIfChange("end_of_life_date", func(ctx context.Context, old, new, meta interface{}) bool { + return old.(string) != "" && new.(string) == "" + }), + ), } } @@ -209,21 +278,36 @@ func resourceSharedImageCreateUpdate(d *pluginsdk.ResourceData, meta interface{} }) } + recommended, err := expandGalleryImageRecommended(d) + if err != nil { + return err + } + image := compute.GalleryImage{ Location: utils.String(azure.NormalizeLocation(d.Get("location").(string))), GalleryImageProperties: &compute.GalleryImageProperties{ Description: utils.String(d.Get("description").(string)), + Disallowed: expandGalleryImageDisallowed(d), Identifier: expandGalleryImageIdentifier(d), PrivacyStatementURI: utils.String(d.Get("privacy_statement_uri").(string)), ReleaseNoteURI: utils.String(d.Get("release_note_uri").(string)), + Architecture: compute.Architecture(d.Get("architecture").(string)), OsType: compute.OperatingSystemTypes(d.Get("os_type").(string)), HyperVGeneration: compute.HyperVGeneration(d.Get("hyper_v_generation").(string)), PurchasePlan: expandGalleryImagePurchasePlan(d.Get("purchase_plan").([]interface{})), Features: &features, + Recommended: recommended, }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } + if v, ok := d.GetOk("end_of_life_date"); ok { + endOfLifeDate, _ := time.Parse(time.RFC3339, v.(string)) + image.GalleryImageProperties.EndOfLifeDate = &date.Time{ + Time: endOfLifeDate, + } + } + if v, ok := d.GetOk("eula"); ok { image.GalleryImageProperties.Eula = utils.String(v.(string)) } @@ -278,8 +362,52 @@ func resourceSharedImageRead(d *pluginsdk.ResourceData, meta interface{}) error if props := resp.GalleryImageProperties; props != nil { d.Set("description", props.Description) + + diskTypesNotAllowed := make([]string, 0) + if disallowed := props.Disallowed; disallowed != nil { + if disallowed.DiskTypes != nil { + for _, v := range *disallowed.DiskTypes { + diskTypesNotAllowed = append(diskTypesNotAllowed, v) + } + } + } + d.Set("disk_types_not_allowed", diskTypesNotAllowed) + + if v := props.EndOfLifeDate; v != nil { + d.Set("end_of_life_date", props.EndOfLifeDate.Format(time.RFC3339)) + } + d.Set("eula", props.Eula) + + maxRecommendedVcpuCount := 0 + minRecommendedVcpuCount := 0 + maxRecommendedMemoryInGB := 0 + minRecommendedMemoryInGB := 0 + if recommended := props.Recommended; recommended != nil { + if vcpus := recommended.VCPUs; vcpus != nil { + if vcpus.Max != nil { + maxRecommendedVcpuCount = int(*vcpus.Max) + } + if vcpus.Min != nil { + minRecommendedVcpuCount = int(*vcpus.Min) + } + } + if memory := recommended.Memory; memory != nil { + if memory.Max != nil { + maxRecommendedMemoryInGB = int(*memory.Max) + } + if memory.Min != nil { + minRecommendedMemoryInGB = int(*memory.Min) + } + } + } + d.Set("max_recommended_vcpu_count", maxRecommendedVcpuCount) + d.Set("min_recommended_vcpu_count", minRecommendedVcpuCount) + d.Set("max_recommended_memory_in_gb", maxRecommendedMemoryInGB) + d.Set("min_recommended_memory_in_gb", minRecommendedMemoryInGB) + d.Set("os_type", string(props.OsType)) + d.Set("architecture", string(props.Architecture)) d.Set("specialized", props.OsState == compute.OperatingSystemStateTypesSpecialized) d.Set("hyper_v_generation", string(props.HyperVGeneration)) d.Set("privacy_statement_uri", props.PrivacyStatementURI) @@ -465,3 +593,49 @@ func flattenGalleryImagePurchasePlan(input *compute.ImagePurchasePlan) []interfa }, } } + +func expandGalleryImageDisallowed(d *pluginsdk.ResourceData) *compute.Disallowed { + diskTypesNotAllowedRaw := d.Get("disk_types_not_allowed").(*pluginsdk.Set).List() + + diskTypesNotAllowed := make([]string, 0) + for _, v := range diskTypesNotAllowedRaw { + diskTypesNotAllowed = append(diskTypesNotAllowed, v.(string)) + } + + return &compute.Disallowed{ + DiskTypes: &diskTypesNotAllowed, + } +} + +func expandGalleryImageRecommended(d *pluginsdk.ResourceData) (*compute.RecommendedMachineConfiguration, error) { + result := &compute.RecommendedMachineConfiguration{ + VCPUs: &compute.ResourceRange{}, + Memory: &compute.ResourceRange{}, + } + + maxVcpuCount := d.Get("max_recommended_vcpu_count").(int) + minVcpuCount := d.Get("min_recommended_vcpu_count").(int) + if maxVcpuCount != 0 && minVcpuCount != 0 && maxVcpuCount < minVcpuCount { + return nil, fmt.Errorf("`max_recommended_vcpu_count` must be greater than or equal to `min_recommended_vcpu_count`") + } + if maxVcpuCount != 0 { + result.VCPUs.Max = utils.Int32(int32(maxVcpuCount)) + } + if minVcpuCount != 0 { + result.VCPUs.Min = utils.Int32(int32(minVcpuCount)) + } + + maxMemory := d.Get("max_recommended_memory_in_gb").(int) + minMemory := d.Get("min_recommended_memory_in_gb").(int) + if maxMemory != 0 && minMemory != 0 && maxMemory < minMemory { + return nil, fmt.Errorf("`max_recommended_memory_in_gb` must be greater than or equal to `min_recommended_memory_in_gb`") + } + if maxMemory != 0 { + result.Memory.Max = utils.Int32(int32(maxMemory)) + } + if minMemory != 0 { + result.Memory.Min = utils.Int32(int32(minMemory)) + } + + return result, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_version_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_version_data_source.go index 3a4c415d721..68cf07227af 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_version_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_version_data_source.go @@ -5,10 +5,9 @@ import ( "fmt" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" @@ -118,8 +117,14 @@ func dataSourceSharedImageVersionRead(d *pluginsdk.ResourceData, meta interface{ return err } - d.SetId(id.ID()) - d.Set("name", image.Name) + name := "" + if image.Name != nil { + name = *image.Name + } + + exactId := parse.NewSharedImageVersionID(subscriptionId, id.ResourceGroup, id.GalleryName, id.ImageName, name) + d.SetId(exactId.ID()) + d.Set("name", name) d.Set("image_name", id.ImageName) d.Set("gallery_name", id.GalleryName) d.Set("resource_group_name", id.ResourceGroup) @@ -163,34 +168,40 @@ func obtainImage(client *compute.GalleryImageVersionsClient, ctx context.Context switch galleryImageVersionName { case "latest": - images, err := client.ListByGalleryImage(ctx, resourceGroup, galleryName, galleryImageName) + imagesIterator, err := client.ListByGalleryImageComplete(ctx, resourceGroup, galleryName, galleryImageName) if err != nil { - if utils.ResponseWasNotFound(images.Response().Response) { + if utils.ResponseWasNotFound(imagesIterator.Response().Response) { return nil, notFoundError } return nil, fmt.Errorf("retrieving Shared Image Versions (Image %q / Gallery %q / Resource Group %q): %+v", galleryImageName, galleryName, resourceGroup, err) } + images := make([]compute.GalleryImageVersion, 0) + for imagesIterator.NotDone() { + images = append(images, imagesIterator.Value()) + if err := imagesIterator.NextWithContext(ctx); err != nil { + return nil, fmt.Errorf("listing Shared Image Versions (Image %q / Gallery %q / Resource Group %q): %+v", galleryImageName, galleryName, resourceGroup, err) + } + } + // the last image in the list is the latest version - if len(images.Values()) > 0 { - values := images.Values() - var errs []error + if len(images) > 0 { if sortBySemVer { - values, errs = sortSharedImageVersions(values) + var errs []error + images, errs = sortSharedImageVersions(images) if len(errs) > 0 { return nil, fmt.Errorf("parsing version(s): %v", errs) } } - image := values[len(values)-1] + image := images[len(images)-1] return &image, nil } - return nil, notFoundError case "recent": - images, err := client.ListByGalleryImage(ctx, resourceGroup, galleryName, galleryImageName) + imagesIterator, err := client.ListByGalleryImageComplete(ctx, resourceGroup, galleryName, galleryImageName) if err != nil { - if utils.ResponseWasNotFound(images.Response().Response) { + if utils.ResponseWasNotFound(imagesIterator.Response().Response) { return nil, notFoundError } return nil, fmt.Errorf("retrieving Shared Image Versions (Image %q / Gallery %q / Resource Group %q): %+v", galleryImageName, galleryName, resourceGroup, err) @@ -198,13 +209,18 @@ func obtainImage(client *compute.GalleryImageVersionsClient, ctx context.Context var image *compute.GalleryImageVersion var recentDate *time.Time // compare dates until we find the image that was updated most recently - for _, currImage := range images.Values() { + for imagesIterator.NotDone() { + currImage := imagesIterator.Value() if profile := currImage.PublishingProfile; profile != nil { if profile.PublishedDate != nil && (recentDate == nil || profile.PublishedDate.Time.After(*recentDate)) { recentDate = &profile.PublishedDate.Time image = &currImage } } + + if err := imagesIterator.NextWithContext(ctx); err != nil { + return nil, fmt.Errorf("listing Shared Image Versions (Image %q / Gallery %q / Resource Group %q): %+v", galleryImageName, galleryName, resourceGroup, err) + } } if image != nil { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_version_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_version_resource.go index 89d608bec2a..361f6dbbb1f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_version_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/shared_image_version_resource.go @@ -7,14 +7,17 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" + "github.com/Azure/go-autorest/autorest/date" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" + storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -66,7 +69,9 @@ func resourceSharedImageVersion() *pluginsdk.Resource { "resource_group_name": azure.SchemaResourceGroupName(), "target_region": { - Type: pluginsdk.TypeSet, + // This needs to be a `TypeList` due to the `StateFunc` on the nested property `name` + // See: https://github.com/hashicorp/terraform-plugin-sdk/issues/160 + Type: pluginsdk.TypeList, Required: true, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ @@ -82,6 +87,13 @@ func resourceSharedImageVersion() *pluginsdk.Resource { Required: true, }, + "disk_encryption_set_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validate.DiskEncryptionSetID, + }, + // The Service API doesn't support to update `storage_account_type`. So it has to recreate the resource for updating `storage_account_type`. // However, `ForceNew` cannot be used since resource would be recreated while adding or removing `target_region`. // And `CustomizeDiff` also cannot be used since it doesn't support in a `Set`. @@ -90,6 +102,7 @@ func resourceSharedImageVersion() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ + string(compute.StorageAccountTypePremiumLRS), string(compute.StorageAccountTypeStandardLRS), string(compute.StorageAccountTypeStandardZRS), }, false), @@ -99,11 +112,35 @@ func resourceSharedImageVersion() *pluginsdk.Resource { }, }, + "blob_uri": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.IsURLWithScheme([]string{"http", "https"}), + RequiredWith: []string{"storage_account_id"}, + ExactlyOneOf: []string{"blob_uri", "os_disk_snapshot_id", "managed_image_id"}, + }, + + "storage_account_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + RequiredWith: []string{"blob_uri"}, + ValidateFunc: storageValidate.StorageAccountID, + }, + + "end_of_life_date": { + Type: pluginsdk.TypeString, + Optional: true, + DiffSuppressFunc: suppress.RFC3339Time, + ValidateFunc: validation.IsRFC3339Time, + }, + "os_disk_snapshot_id": { Type: pluginsdk.TypeString, Optional: true, ForceNew: true, - ExactlyOneOf: []string{"os_disk_snapshot_id", "managed_image_id"}, + ExactlyOneOf: []string{"blob_uri", "os_disk_snapshot_id", "managed_image_id"}, // TODO -- add a validation function when snapshot has its own validation function }, @@ -115,7 +152,18 @@ func resourceSharedImageVersion() *pluginsdk.Resource { validate.ImageID, validate.VirtualMachineID, ), - ExactlyOneOf: []string{"os_disk_snapshot_id", "managed_image_id"}, + ExactlyOneOf: []string{"blob_uri", "os_disk_snapshot_id", "managed_image_id"}, + }, + + "replication_mode": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(compute.ReplicationModeFull), + string(compute.ReplicationModeShallow), + }, false), + Default: compute.ReplicationModeFull, }, "exclude_from_latest": { @@ -126,6 +174,12 @@ func resourceSharedImageVersion() *pluginsdk.Resource { "tags": tags.Schema(), }, + + CustomizeDiff: pluginsdk.CustomDiffWithAll( + pluginsdk.ForceNewIfChange("end_of_life_date", func(ctx context.Context, old, new, meta interface{}) bool { + return old.(string) != "" && new.(string) == "" + }), + ), } } @@ -150,18 +204,31 @@ func resourceSharedImageVersionCreateUpdate(d *pluginsdk.ResourceData, meta inte } } + targetRegions, err := expandSharedImageVersionTargetRegions(d) + if err != nil { + return err + } + version := compute.GalleryImageVersion{ Location: utils.String(azure.NormalizeLocation(d.Get("location").(string))), GalleryImageVersionProperties: &compute.GalleryImageVersionProperties{ PublishingProfile: &compute.GalleryImageVersionPublishingProfile{ ExcludeFromLatest: utils.Bool(d.Get("exclude_from_latest").(bool)), - TargetRegions: expandSharedImageVersionTargetRegions(d), + ReplicationMode: compute.ReplicationMode(d.Get("replication_mode").(string)), + TargetRegions: targetRegions, }, StorageProfile: &compute.GalleryImageVersionStorageProfile{}, }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } + if v, ok := d.GetOk("end_of_life_date"); ok { + endOfLifeDate, _ := time.Parse(time.RFC3339, v.(string)) + version.GalleryImageVersionProperties.PublishingProfile.EndOfLifeDate = &date.Time{ + Time: endOfLifeDate, + } + } + if v, ok := d.GetOk("managed_image_id"); ok { version.GalleryImageVersionProperties.StorageProfile.Source = &compute.GalleryArtifactVersionSource{ ID: utils.String(v.(string)), @@ -176,6 +243,15 @@ func resourceSharedImageVersionCreateUpdate(d *pluginsdk.ResourceData, meta inte } } + if v, ok := d.GetOk("blob_uri"); ok { + version.GalleryImageVersionProperties.StorageProfile.OsDiskImage = &compute.GalleryOSDiskImage{ + Source: &compute.GalleryArtifactVersionSource{ + ID: utils.String(d.Get("storage_account_id").(string)), + URI: utils.String(v.(string)), + }, + } + } + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.GalleryName, id.ImageName, id.VersionName, version) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) @@ -221,8 +297,18 @@ func resourceSharedImageVersionRead(d *pluginsdk.ResourceData, meta interface{}) if props := resp.GalleryImageVersionProperties; props != nil { if profile := props.PublishingProfile; profile != nil { + if v := profile.EndOfLifeDate; v != nil { + d.Set("end_of_life_date", profile.EndOfLifeDate.Format(time.RFC3339)) + } + d.Set("exclude_from_latest", profile.ExcludeFromLatest) + replicationMode := string(compute.ReplicationModeFull) + if profile.ReplicationMode != "" { + replicationMode = string(profile.ReplicationMode) + } + d.Set("replication_mode", replicationMode) + if err := d.Set("target_region", flattenSharedImageVersionTargetRegions(profile.TargetRegions)); err != nil { return fmt.Errorf("setting `target_region`: %+v", err) } @@ -233,11 +319,24 @@ func resourceSharedImageVersionRead(d *pluginsdk.ResourceData, meta interface{}) d.Set("managed_image_id", source.ID) } + blobURI := "" + if profile.OsDiskImage != nil && profile.OsDiskImage.Source != nil && profile.OsDiskImage.Source.URI != nil { + blobURI = *profile.OsDiskImage.Source.URI + } + d.Set("blob_uri", blobURI) + osDiskSnapShotID := "" + storageAccountID := "" if profile.OsDiskImage != nil && profile.OsDiskImage.Source != nil && profile.OsDiskImage.Source.ID != nil { - osDiskSnapShotID = *profile.OsDiskImage.Source.ID + sourceID := *profile.OsDiskImage.Source.ID + if blobURI == "" { + osDiskSnapShotID = sourceID + } else { + storageAccountID = sourceID + } } d.Set("os_disk_snapshot_id", osDiskSnapShotID) + d.Set("storage_account_id", storageAccountID) } } @@ -300,26 +399,40 @@ func sharedImageVersionDeleteStateRefreshFunc(ctx context.Context, client *compu } } -func expandSharedImageVersionTargetRegions(d *pluginsdk.ResourceData) *[]compute.TargetRegion { - vs := d.Get("target_region").(*pluginsdk.Set) +func expandSharedImageVersionTargetRegions(d *pluginsdk.ResourceData) (*[]compute.TargetRegion, error) { + vs := d.Get("target_region").([]interface{}) results := make([]compute.TargetRegion, 0) - for _, v := range vs.List() { + for _, v := range vs { input := v.(map[string]interface{}) name := input["name"].(string) regionalReplicaCount := input["regional_replica_count"].(int) storageAccountType := input["storage_account_type"].(string) + diskEncryptionSetId := input["disk_encryption_set_id"].(string) output := compute.TargetRegion{ Name: utils.String(name), RegionalReplicaCount: utils.Int32(int32(regionalReplicaCount)), StorageAccountType: compute.StorageAccountType(storageAccountType), } + + if diskEncryptionSetId != "" { + if d.Get("replication_mode").(string) == string(compute.ReplicationModeShallow) { + return nil, fmt.Errorf("`disk_encryption_set_id` cannot be used when `replication_mode` is `Shallow`") + } + + output.Encryption = &compute.EncryptionImages{ + OsDiskImage: &compute.OSDiskImageEncryption{ + DiskEncryptionSetID: utils.String(diskEncryptionSetId), + }, + } + } + results = append(results, output) } - return &results + return &results, nil } func flattenSharedImageVersionTargetRegions(input *[]compute.TargetRegion) []interface{} { @@ -339,6 +452,12 @@ func flattenSharedImageVersionTargetRegions(input *[]compute.TargetRegion) []int output["storage_account_type"] = string(v.StorageAccountType) + diskEncryptionSetId := "" + if v.Encryption != nil && v.Encryption.OsDiskImage != nil && v.Encryption.OsDiskImage.DiskEncryptionSetID != nil { + diskEncryptionSetId = *v.Encryption.OsDiskImage.DiskEncryptionSetID + } + output["disk_encryption_set_id"] = diskEncryptionSetId + results = append(results, output) } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/ssh_public_key_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/ssh_public_key_data_source.go index 84e13f26e5d..372f0982db1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/ssh_public_key_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/ssh_public_key_data_source.go @@ -5,14 +5,14 @@ import ( "regexp" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceSshPublicKey() *pluginsdk.Resource { @@ -40,7 +40,7 @@ func dataSourceSshPublicKey() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -51,11 +51,10 @@ func dataSourceSshPublicKeyRead(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewSSHPublicKeyID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := sshpublickeys.NewSshPublicKeyID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("making Read request on %s: %s", id, err) @@ -63,17 +62,23 @@ func dataSourceSshPublicKeyRead(d *pluginsdk.ResourceData, meta interface{}) err d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.SshPublicKeyName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + var publicKey *string + if props := model.Properties; props.PublicKey != nil { + publicKey, err = NormalizeSSHKey(*props.PublicKey) + if err != nil { + return fmt.Errorf("normalising public key: %+v", err) + } + } + d.Set("public_key", publicKey) - var publicKey *string - if props := resp.SSHPublicKeyResourceProperties; props.PublicKey != nil { - publicKey, err = NormalizeSSHKey(*props.PublicKey) - if err != nil { - return fmt.Errorf("normalising public key: %+v", err) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err } } - d.Set("public_key", publicKey) - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/ssh_public_key_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/ssh_public_key_resource.go index 3704b57c1ad..b1cfae13813 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/ssh_public_key_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/ssh_public_key_resource.go @@ -6,14 +6,14 @@ import ( "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -28,7 +28,7 @@ func resourceSshPublicKey() *pluginsdk.Resource { Delete: resourceSshPublicKeyDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.SSHPublicKeyID(id) + _, err := sshpublickeys.ParseSshPublicKeyID(id) return err }), @@ -49,12 +49,10 @@ func resourceSshPublicKey() *pluginsdk.Resource { "Public SSH Key name must be 1 - 128 characters long, can contain letters, numbers, underscores, and hyphens (but the first and last character must be a letter or number).", ), }, - // We have to ignore case due to incorrect capitalisation of resource group name in - // ID in the response we get from the API request. - // Related issue: https://github.com/Azure/azure-rest-api-specs/issues/13491 - "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), - "location": azure.SchemaLocation(), + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), "public_key": { Type: pluginsdk.TypeString, @@ -63,7 +61,7 @@ func resourceSshPublicKey() *pluginsdk.Resource { ValidateFunc: validate.SSHKey, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -74,35 +72,28 @@ func resourceSshPublicKeyCreate(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewSSHPublicKeyID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - public_key := d.Get("public_key").(string) - - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := sshpublickeys.NewSshPublicKeyID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("checking for existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(resp.Response) { - return tf.ImportAsExistsError("azurerm_ssh_public_key", *resp.ID) + if !response.WasNotFound(resp.HttpResponse) { + return tf.ImportAsExistsError("azurerm_ssh_public_key", id.ID()) } - location := azure.NormalizeLocation(d.Get("location").(string)) - - t := d.Get("tags").(map[string]interface{}) - - params := compute.SSHPublicKeyResource{ - Name: utils.String(id.Name), - Location: utils.String(location), - Tags: tags.Expand(t), - SSHPublicKeyResourceProperties: &compute.SSHPublicKeyResourceProperties{ - PublicKey: utils.String(public_key), + payload := sshpublickeys.SshPublicKeyResource{ + Location: location.Normalize(d.Get("location").(string)), + Properties: &sshpublickeys.SshPublicKeyResourceProperties{ + PublicKey: utils.String(d.Get("public_key").(string)), }, + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - if _, err := client.Create(ctx, id.ResourceGroup, id.Name, params); err != nil { - return fmt.Errorf("creating SSH Public Key %s: %+v", id, err) + if _, err := client.Create(ctx, id, payload); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } d.SetId(id.ID()) @@ -115,33 +106,38 @@ func resourceSshPublicKeyRead(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SSHPublicKeyID(d.Id()) + id, err := sshpublickeys.ParseSshPublicKeyID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] SSH Public Key %q was not found in Resource Group %q - removing from state!", id.Name, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving SSH Public Key %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + d.Set("name", id.SshPublicKeyName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + + if props := model.Properties; props != nil { + d.Set("public_key", props.PublicKey) + } - if props := resp.SSHPublicKeyResourceProperties; props != nil { - d.Set("public_key", props.PublicKey) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceSshPublicKeyUpdate(d *pluginsdk.ResourceData, meta interface{}) error { @@ -149,44 +145,35 @@ func resourceSshPublicKeyUpdate(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SSHPublicKeyID(d.Id()) + id, err := sshpublickeys.ParseSshPublicKeyID(d.Id()) if err != nil { return err } - log.Printf("[DEBUG] Retrieving SSH Public Key %q (Resource Group %q)..", id.Name, id.ResourceGroup) - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(existing.Response) { + if response.WasNotFound(existing.HttpResponse) { return nil } - return fmt.Errorf("retrieving SSH Public Key %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - props := compute.SSHPublicKeyResourceProperties{} - + payload := sshpublickeys.SshPublicKeyUpdateResource{} if d.HasChange("public_key") { - props.PublicKey = utils.String(d.Get("public_key").(string)) - } - - update := compute.SSHPublicKeyUpdateResource{ - SSHPublicKeyResourceProperties: &props, + payload.Properties = &sshpublickeys.SshPublicKeyResourceProperties{ + PublicKey: utils.String(d.Get("public_key").(string)), + } } - if d.HasChange("tags") { tagsRaw := d.Get("tags").(map[string]interface{}) - update.Tags = tags.Expand(tagsRaw) + payload.Tags = tags.Expand(tagsRaw) } - log.Printf("[DEBUG] Updating SSH Public Key %q (Resource Group %q)..", id.Name, id.ResourceGroup) - - if _, err := client.Update(ctx, id.ResourceGroup, id.Name, update); err != nil { - return fmt.Errorf("updating SSH Public Key %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if _, err := client.Update(ctx, *id, payload); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } - log.Printf("[DEBUG] Updated SSH Public Key %q (Resource Group %q).", id.Name, id.ResourceGroup) - return resourceSshPublicKeyRead(d, meta) } @@ -195,31 +182,14 @@ func resourceSshPublicKeyDelete(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SSHPublicKeyID(d.Id()) + id, err := sshpublickeys.ParseSshPublicKeyID(d.Id()) if err != nil { return err } - log.Printf("[DEBUG] Retrieving SSH Public Key %q (Resource Group %q)..", id.Name, id.ResourceGroup) - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) - if err != nil { - if utils.ResponseWasNotFound(existing.Response) { - return nil - } - - return fmt.Errorf("retrieving SSH Public Key %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - - log.Printf("[DEBUG] Deleting SSH Public Key %q (Resource Group %q)..", id.Name, id.ResourceGroup) - resp, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { - if response.WasNotFound(resp.Response) { - return nil - } - return fmt.Errorf("deleting SSH Public Key %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } - log.Printf("[DEBUG] Deleted SSH Public Key %q (Resource Group %q).", id.Name, id.ResourceGroup) - return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/availability_set_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/availability_set_id.go deleted file mode 100644 index d065878bd36..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/availability_set_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" -) - -func AvailabilitySetID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.AvailabilitySetID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/compute.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/compute.go index 6b2910f6c78..8889538ad3b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/compute.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/compute.go @@ -3,6 +3,7 @@ package validate import ( "fmt" "regexp" + "strings" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -40,6 +41,25 @@ func SharedImageName(v interface{}, k string) (warnings []string, errors []error return warnings, errors } +func SharedImageIdentifierAttribute(v interface{}, k string) (warnings []string, errors []error) { + value := v.(string) + + length := len(value) + if length > 128 { + errors = append(errors, fmt.Errorf("%s can be up to 128 characters, currently %d.", k, length)) + } + + if strings.HasSuffix(value, ".") { + errors = append(errors, fmt.Errorf("%q can not end with a '.', got %q", k, value)) + } + + if !regexp.MustCompile(`^[A-Za-z0-9._-]+$`).MatchString(value) { + errors = append(errors, fmt.Errorf("%s can only contain alphanumeric, full stops, dashes and underscores. Got %q.", k, value)) + } + + return warnings, errors +} + func SharedImageVersionName(v interface{}, k string) (warnings []string, errors []error) { value := v.(string) @@ -50,6 +70,31 @@ func SharedImageVersionName(v interface{}, k string) (warnings []string, errors return warnings, errors } +func GalleryApplicationName(v interface{}, k string) (warnings []string, errors []error) { + value := v.(string) + + if !regexp.MustCompile(`^[A-Za-z0-9._-]+$`).MatchString(value) { + errors = append(errors, fmt.Errorf("%s can only contain alphanumeric, full stops, dashes and underscores. Got %q.", k, value)) + } + + length := len(value) + if length > 80 { + errors = append(errors, fmt.Errorf("%s can be up to 80 characters, currently %d.", k, length)) + } + + return warnings, errors +} + +func GalleryApplicationVersionName(v interface{}, k string) (warnings []string, errors []error) { + value := v.(string) + + if !regexp.MustCompile(`^([0-9]{1,10}\.[0-9]{1,10}\.[0-9]{1,10})$`).MatchString(value) && value != "latest" && value != "recent" { + errors = append(errors, fmt.Errorf("Expected %s to be in the format `1.2.3`, `latest`, or `recent` but got %q.", k, value)) + } + + return warnings, errors +} + // VirtualMachineTimeZone returns a case-sensitive validation function for the Time Zones for a Virtual Machine func VirtualMachineTimeZone() pluginsdk.SchemaValidateFunc { return virtualMachineTimeZone(false) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/dedicated_host_group_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/dedicated_host_group_id.go deleted file mode 100644 index 94f6c944dcc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/dedicated_host_group_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" -) - -func DedicatedHostGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DedicatedHostGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/dedicated_host_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/dedicated_host_id.go deleted file mode 100644 index 2aaf7be23fd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/dedicated_host_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" -) - -func DedicatedHostID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DedicatedHostID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/gallery_application_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/gallery_application_id.go new file mode 100644 index 00000000000..74d3c84c52d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/gallery_application_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" +) + +func GalleryApplicationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.GalleryApplicationID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/gallery_application_version_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/gallery_application_version_id.go new file mode 100644 index 00000000000..4865352012e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/gallery_application_version_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" +) + +func GalleryApplicationVersionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.GalleryApplicationVersionID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/proximity_placement_group_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/proximity_placement_group_id.go deleted file mode 100644 index 2c48bb9ad7a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate/proximity_placement_group_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" -) - -func ProximityPlacementGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ProximityPlacementGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_extension_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_extension_resource.go index 11300b08bef..101c02955d6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_extension_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_extension_resource.go @@ -40,6 +40,10 @@ func resourceVirtualMachineExtension() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, + ValidateFunc: validation.All( + validation.StringIsNotEmpty, + validation.StringDoesNotContainAny("/"), + ), }, "virtual_machine_id": { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_scale_set.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_scale_set.go index 3bc59ecf488..b018a8765e8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_scale_set.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_scale_set.go @@ -4,9 +4,8 @@ import ( "bytes" "fmt" - identity "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" + identity "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" @@ -1101,6 +1100,16 @@ func VirtualMachineScaleSetOSDiskSchema() *pluginsdk.Schema { string(compute.DiffDiskOptionsLocal), }, false), }, + "placement": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + Default: string(compute.DiffDiskPlacementCacheDisk), + ValidateFunc: validation.StringInSlice([]string{ + string(compute.DiffDiskPlacementCacheDisk), + string(compute.DiffDiskPlacementResourceDisk), + }, false), + }, }, }, }, @@ -1153,8 +1162,9 @@ func VirtualMachineScaleSetOSDiskSchema() *pluginsdk.Schema { func ExpandVirtualMachineScaleSetOSDisk(input []interface{}, osType compute.OperatingSystemTypes) (*compute.VirtualMachineScaleSetOSDisk, error) { raw := input[0].(map[string]interface{}) + caching := raw["caching"].(string) disk := compute.VirtualMachineScaleSetOSDisk{ - Caching: compute.CachingTypes(raw["caching"].(string)), + Caching: compute.CachingTypes(caching), ManagedDisk: &compute.VirtualMachineScaleSetManagedDiskParameters{ StorageAccountType: compute.StorageAccountTypes(raw["storage_account_type"].(string)), }, @@ -1191,9 +1201,15 @@ func ExpandVirtualMachineScaleSetOSDisk(input []interface{}, osType compute.Oper } if diffDiskSettingsRaw := raw["diff_disk_settings"].([]interface{}); len(diffDiskSettingsRaw) > 0 { + if caching != string(compute.CachingTypesReadOnly) { + // Restriction per https://docs.microsoft.com/azure/virtual-machines/ephemeral-os-disks-deploy#vm-template-deployment + return nil, fmt.Errorf("`diff_disk_settings` can only be set when `caching` is set to `ReadOnly`") + } + diffDiskRaw := diffDiskSettingsRaw[0].(map[string]interface{}) disk.DiffDiskSettings = &compute.DiffDiskSettings{ - Option: compute.DiffDiskOptions(diffDiskRaw["option"].(string)), + Option: compute.DiffDiskOptions(diffDiskRaw["option"].(string)), + Placement: compute.DiffDiskPlacement(diffDiskRaw["placement"].(string)), } } @@ -1231,7 +1247,8 @@ func FlattenVirtualMachineScaleSetOSDisk(input *compute.VirtualMachineScaleSetOS diffDiskSettings := make([]interface{}, 0) if input.DiffDiskSettings != nil { diffDiskSettings = append(diffDiskSettings, map[string]interface{}{ - "option": string(input.DiffDiskSettings.Option), + "option": string(input.DiffDiskSettings.Option), + "placement": string(input.DiffDiskSettings.Placement), }) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_scale_set_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_scale_set_data_source.go index 014d9176279..9c6c88c6c9c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_scale_set_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_scale_set_data_source.go @@ -1,13 +1,17 @@ package compute import ( + "context" "fmt" "time" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" + networkParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -36,12 +40,79 @@ func dataSourceVirtualMachineScaleSet() *pluginsdk.Resource { "network_interface": VirtualMachineScaleSetNetworkInterfaceSchemaForDataSource(), "identity": commonschema.SystemAssignedUserAssignedIdentityComputed(), + + "instances": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "computer_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "instance_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "latest_model_applied": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "private_ip_address": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "private_ip_addresses": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "public_ip_address": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "public_ip_addresses": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "virtual_machine_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "zone": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, }, } } func dataSourceVirtualMachineScaleSetRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Compute.VMScaleSetClient + instancesClient := meta.(*clients.Client).Compute.VMScaleSetVMsClient + networkInterfacesClient := meta.(*clients.Client).Network.InterfacesClient + publicIPAddressesClient := meta.(*clients.Client).Network.PublicIPsClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -82,5 +153,130 @@ func dataSourceVirtualMachineScaleSetRead(d *pluginsdk.ResourceData, meta interf return fmt.Errorf("setting `identity`: %+v", err) } + instances := make([]interface{}, 0) + result, err := instancesClient.ListComplete(ctx, id.ResourceGroup, id.Name, "", "", "") + if err != nil { + return fmt.Errorf("listing VM Instances for Virtual Machine Scale Set %q (Resource Group %q): %+v", id.ResourceGroup, id.Name, err) + } + + for result.NotDone() { + instance := result.Value() + if instance.InstanceID != nil { + nics, err := networkInterfacesClient.ListVirtualMachineScaleSetVMNetworkInterfacesComplete(ctx, id.ResourceGroup, id.Name, *instance.InstanceID) + if err != nil { + return fmt.Errorf("listing Network Interfaces for VM Instance %q for Virtual Machine Scale Set %q (Resource Group %q): %+v", *instance.InstanceID, id.ResourceGroup, id.Name, err) + } + + networkInterfaces := make([]network.Interface, 0) + for nics.NotDone() { + networkInterfaces = append(networkInterfaces, nics.Value()) + if err := nics.NextWithContext(ctx); err != nil { + return fmt.Errorf("listing next page of Network Interfaces for VM Instance %q of Virtual Machine Scale Set %q (Resource Group %q): %v", *instance.InstanceID, id.ResourceGroup, id.Name, err) + } + } + + connectionInfo, err := getVirtualMachineScaleSetVMConnectionInfo(ctx, networkInterfaces, id.ResourceGroup, id.Name, *instance.InstanceID, publicIPAddressesClient) + if err != nil { + return err + } + + flattenedInstances := flattenVirtualMachineScaleSetVM(instance, connectionInfo) + instances = append(instances, flattenedInstances) + } + + if err := result.NextWithContext(ctx); err != nil { + return fmt.Errorf("listing next page VM Instances for Virtual Machine Scale Set %q (Resource Group %q): %+v", id.ResourceGroup, id.Name, err) + } + } + if err := d.Set("instances", instances); err != nil { + return fmt.Errorf("setting `instances`: %+v", err) + } + return nil } + +func getVirtualMachineScaleSetVMConnectionInfo(ctx context.Context, networkInterfaces []network.Interface, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, publicIPAddressesClient *network.PublicIPAddressesClient) (*connectionInfo, error) { + if len(networkInterfaces) == 0 { + return nil, nil + } + + primaryPublicAddress := "" + primaryPrivateAddress := "" + publicIPAddresses := make([]string, 0) + privateIPAddresses := make([]string, 0) + + for _, nic := range networkInterfaces { + for _, config := range *nic.IPConfigurations { + if props := config.InterfaceIPConfigurationPropertiesFormat; props != nil { + if pip := props.PublicIPAddress; pip != nil { + pipID, err := networkParse.VirtualMachineScaleSetPublicIPAddressID(*pip.ID) + if err != nil { + return nil, err + } + + publicIPAddress, err := publicIPAddressesClient.GetVirtualMachineScaleSetPublicIPAddress(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, pipID.NetworkInterfaceName, pipID.IpConfigurationName, pipID.PublicIPAddressName, "") + if err != nil { + return nil, fmt.Errorf("reading Public IP Address for VM Instance %q for Virtual Machine Scale Set %q (Resource Group %q): %+v", virtualmachineIndex, virtualMachineScaleSetName, resourceGroupName, err) + } + + if *nic.Primary && *props.Primary { + primaryPublicAddress = *publicIPAddress.IPAddress + } + publicIPAddresses = append(publicIPAddresses, *publicIPAddress.IPAddress) + } + + if props.PrivateIPAddress != nil { + if *nic.Primary && *props.Primary { + primaryPrivateAddress = *props.PrivateIPAddress + } + privateIPAddresses = append(privateIPAddresses, *props.PrivateIPAddress) + } + } + } + } + + if primaryPublicAddress == "" && len(publicIPAddresses) > 0 { + primaryPublicAddress = publicIPAddresses[0] + } + + if primaryPrivateAddress == "" && len(privateIPAddresses) > 0 { + primaryPrivateAddress = privateIPAddresses[0] + } + + return &connectionInfo{ + primaryPublicAddress: primaryPublicAddress, + publicAddresses: publicIPAddresses, + primaryPrivateAddress: primaryPrivateAddress, + privateAddresses: privateIPAddresses, + }, nil +} + +func flattenVirtualMachineScaleSetVM(input compute.VirtualMachineScaleSetVM, connectionInfo *connectionInfo) map[string]interface{} { + output := make(map[string]interface{}) + output["name"] = *input.Name + output["instance_id"] = *input.InstanceID + output["latest_model_applied"] = *input.LatestModelApplied + output["virtual_machine_id"] = *input.VMID + + props := *input.VirtualMachineScaleSetVMProperties + if profile := props.OsProfile; profile != nil { + output["computer_name"] = profile.ComputerName + } + + zone := "" + if input.Zones != nil { + if zones := *input.Zones; len(zones) > 0 { + zone = zones[0] + } + } + output["zone"] = zone + + if connectionInfo != nil { + output["private_ip_address"] = connectionInfo.primaryPrivateAddress + output["private_ip_addresses"] = connectionInfo.privateAddresses + output["public_ip_address"] = connectionInfo.primaryPublicAddress + output["public_ip_addresses"] = connectionInfo.publicAddresses + } + + return output +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_scale_set_extension_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_scale_set_extension_resource.go index 21f653ade4f..d023c04909d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_scale_set_extension_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/virtual_machine_scale_set_extension_resource.go @@ -39,10 +39,13 @@ func resourceVirtualMachineScaleSetExtension() *pluginsdk.Resource { Schema: map[string]*pluginsdk.Schema{ "name": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.All( + validation.StringIsNotEmpty, + validation.StringDoesNotContainAny("/"), + ), }, "virtual_machine_scale_set_id": { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/windows_virtual_machine_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/windows_virtual_machine_resource.go index 808b5f82876..1bdd33e700e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/windows_virtual_machine_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/windows_virtual_machine_resource.go @@ -7,11 +7,14 @@ import ( "strings" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" @@ -109,12 +112,12 @@ func resourceWindowsVirtualMachine() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ForceNew: true, - ValidateFunc: computeValidate.AvailabilitySetID, - // the Compute/VM API is broken and returns the Resource Group name in UPPERCASE :shrug: + ValidateFunc: availabilitysets.ValidateAvailabilitySetID, + // the Compute/VM API is broken and returns the Availability Set name in UPPERCASE :shrug: + // tracked by https://github.com/Azure/azure-rest-api-specs/issues/19424 DiffSuppressFunc: suppress.CaseDifference, - // TODO: raise a GH issue for the broken API - // availability_set_id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG-200122113424880096/providers/Microsoft.Compute/availabilitySets/ACCTESTAVSET-200122113424880096" => "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/acctestRG-200122113424880096/providers/Microsoft.Compute/availabilitySets/acctestavset-200122113424880096" (forces new resource) ConflictsWith: []string{ + "capacity_reservation_group_id", "virtual_machine_scale_set_id", "zone", }, @@ -122,6 +125,19 @@ func resourceWindowsVirtualMachine() *pluginsdk.Resource { "boot_diagnostics": bootDiagnosticsSchema(), + "capacity_reservation_group_id": { + Type: pluginsdk.TypeString, + Optional: true, + // the Compute/VM API is broken and returns the Resource Group name in UPPERCASE + // tracked by https://github.com/Azure/azure-rest-api-specs/issues/19424 + DiffSuppressFunc: suppress.CaseDifference, + ValidateFunc: computeValidate.CapacityReservationGroupID, + ConflictsWith: []string{ + "availability_set_id", + "proximity_placement_group_id", + }, + }, + "computer_name": { Type: pluginsdk.TypeString, Optional: true, @@ -138,22 +154,21 @@ func resourceWindowsVirtualMachine() *pluginsdk.Resource { "dedicated_host_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: computeValidate.DedicatedHostID, + ValidateFunc: dedicatedhosts.ValidateHostID, // the Compute/VM API is broken and returns the Resource Group name in UPPERCASE :shrug: - // same for `dedicated_host_group_id` + // tracked by https://github.com/Azure/azure-rest-api-specs/issues/19424 DiffSuppressFunc: suppress.CaseDifference, ConflictsWith: []string{ "dedicated_host_group_id", }, - // TODO: raise a GH issue for the broken API - // /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/TOM-MANUAL/providers/Microsoft.Compute/hostGroups/tom-hostgroup/hosts/tom-manual-host }, "dedicated_host_group_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: computeValidate.DedicatedHostGroupID, + ValidateFunc: dedicatedhostgroups.ValidateHostGroupID, // the Compute/VM API is broken and returns the Resource Group name in UPPERCASE + // tracked by https://github.com/Azure/azure-rest-api-specs/issues/19424 DiffSuppressFunc: suppress.CaseDifference, ConflictsWith: []string{ "dedicated_host_id", @@ -181,8 +196,8 @@ func resourceWindowsVirtualMachine() *pluginsdk.Resource { Optional: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - // NOTE: whilst Delete is an option here, it's only applicable for VMSS string(compute.VirtualMachineEvictionPolicyTypesDeallocate), + string(compute.VirtualMachineEvictionPolicyTypesDelete), }, false), }, @@ -259,9 +274,13 @@ func resourceWindowsVirtualMachine() *pluginsdk.Resource { "proximity_placement_group_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: computeValidate.ProximityPlacementGroupID, + ValidateFunc: proximityplacementgroups.ValidateProximityPlacementGroupID, // the Compute/VM API is broken and returns the Resource Group name in UPPERCASE :shrug: + // tracked by https://github.com/Azure/azure-rest-api-specs/issues/19424 DiffSuppressFunc: suppress.CaseDifference, + ConflictsWith: []string{ + "capacity_reservation_group_id", + }, }, "secret": windowsSecretSchema(), @@ -542,6 +561,14 @@ func resourceWindowsVirtualMachineCreate(d *pluginsdk.ResourceData, meta interfa } } + if v, ok := d.GetOk("capacity_reservation_group_id"); ok { + params.CapacityReservation = &compute.CapacityReservationProfile{ + CapacityReservationGroup: &compute.SubResource{ + ID: utils.String(v.(string)), + }, + } + } + if v, ok := d.GetOk("custom_data"); ok { params.OsProfile.CustomData = utils.String(v.(string)) } @@ -743,6 +770,12 @@ func resourceWindowsVirtualMachineRead(d *pluginsdk.ResourceData, meta interface } d.Set("availability_set_id", availabilitySetId) + capacityReservationGroupId := "" + if props.CapacityReservation != nil && props.CapacityReservation.CapacityReservationGroup != nil && props.CapacityReservation.CapacityReservationGroup.ID != nil { + capacityReservationGroupId = *props.CapacityReservation.CapacityReservationGroup.ID + } + d.Set("capacity_reservation_group_id", capacityReservationGroupId) + if err := d.Set("boot_diagnostics", flattenBootDiagnostics(props.DiagnosticsProfile)); err != nil { return fmt.Errorf("setting `boot_diagnostics`: %+v", err) } @@ -1038,6 +1071,23 @@ func resourceWindowsVirtualMachineUpdate(d *pluginsdk.ResourceData, meta interfa update.Identity = identity } + if d.HasChange("capacity_reservation_group_id") { + shouldUpdate = true + shouldDeallocate = true + + if v, ok := d.GetOk("capacity_reservation_group_id"); ok { + update.CapacityReservation = &compute.CapacityReservationProfile{ + CapacityReservationGroup: &compute.SubResource{ + ID: utils.String(v.(string)), + }, + } + } else { + update.CapacityReservation = &compute.CapacityReservationProfile{ + CapacityReservationGroup: &compute.SubResource{}, + } + } + } + if d.HasChange("dedicated_host_id") { shouldUpdate = true diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/windows_virtual_machine_scale_set_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/windows_virtual_machine_scale_set_resource.go index ffdaea49b38..dd05a1f7416 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/windows_virtual_machine_scale_set_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/windows_virtual_machine_scale_set_resource.go @@ -5,19 +5,16 @@ import ( "log" "time" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" - - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" computeValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -194,6 +191,17 @@ func resourceWindowsVirtualMachineScaleSetCreate(d *pluginsdk.ResourceData, meta }, } + if v, ok := d.GetOk("capacity_reservation_group_id"); ok { + if d.Get("single_placement_group").(bool) { + return fmt.Errorf("`single_placement_group` must be set to `false` when `capacity_reservation_group_id` is specified") + } + virtualMachineProfile.CapacityReservation = &compute.CapacityReservationProfile{ + CapacityReservationGroup: &compute.SubResource{ + ID: utils.String(v.(string)), + }, + } + } + hasHealthExtension := false if vmExtensionsRaw, ok := d.GetOk("extension"); ok { virtualMachineProfile.ExtensionProfile, hasHealthExtension, err = expandVirtualMachineScaleSetExtensions(vmExtensionsRaw.(*pluginsdk.Set).List()) @@ -842,6 +850,12 @@ func resourceWindowsVirtualMachineScaleSetRead(d *pluginsdk.ResourceData, meta i return fmt.Errorf("setting `boot_diagnostics`: %+v", err) } + capacityReservationGroupId := "" + if profile.CapacityReservation != nil && profile.CapacityReservation.CapacityReservationGroup != nil && profile.CapacityReservation.CapacityReservationGroup.ID != nil { + capacityReservationGroupId = *profile.CapacityReservation.CapacityReservationGroup.ID + } + d.Set("capacity_reservation_group_id", capacityReservationGroupId) + // defaulted since BillingProfile isn't returned if it's unset maxBidPrice := float64(-1.0) if profile.BillingProfile != nil && profile.BillingProfile.MaxPrice != nil { @@ -1105,6 +1119,16 @@ func resourceWindowsVirtualMachineScaleSetSchema() map[string]*pluginsdk.Schema "boot_diagnostics": bootDiagnosticsSchema(), + "capacity_reservation_group_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: computeValidate.CapacityReservationGroupID, + ConflictsWith: []string{ + "proximity_placement_group_id", + }, + }, + "computer_name_prefix": { Type: pluginsdk.TypeString, Optional: true, @@ -1232,6 +1256,9 @@ func resourceWindowsVirtualMachineScaleSetSchema() map[string]*pluginsdk.Schema ValidateFunc: azure.ValidateResourceID, // the Compute API is broken and returns the Resource Group name in UPPERCASE :shrug:, github issue: https://github.com/Azure/azure-rest-api-specs/issues/10016 DiffSuppressFunc: suppress.CaseDifference, + ConflictsWith: []string{ + "capacity_reservation_group_id", + }, }, "rolling_upgrade_policy": VirtualMachineScaleSetRollingUpgradePolicySchema(), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/client/client.go index f1ec8c01aa5..bf22190ca81 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/client/client.go @@ -1,12 +1,12 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger" ) type Client struct { - ConfidentialLedgereClient *confidentialledger.ConfidentialLedgerClient + ConfidentialLedgerClient *confidentialledger.ConfidentialLedgerClient options *common.ClientOptions } @@ -16,7 +16,7 @@ func NewClient(o *common.ClientOptions) *Client { o.ConfigureClient(&confidentialLedgerClient.Client, o.ResourceManagerAuthorizer) return &Client{ - ConfidentialLedgereClient: &confidentialLedgerClient, - options: o, + ConfidentialLedgerClient: &confidentialLedgerClient, + options: o, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/confidential_ledger_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/confidential_ledger_data_source.go index 29466ae4287..ff782751113 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/confidential_ledger_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/confidential_ledger_data_source.go @@ -4,13 +4,12 @@ import ( "fmt" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger" "github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -95,7 +94,7 @@ func dataSourceConfidentialLedger() *pluginsdk.Resource { } func dataSourceConfidentialLedgerRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ConfidentialLedger.ConfidentialLedgereClient + client := meta.(*clients.Client).ConfidentialLedger.ConfidentialLedgerClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/confidential_ledger_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/confidential_ledger_resource.go index 0c5c08634fc..8fd72b41355 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/confidential_ledger_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/confidential_ledger_resource.go @@ -9,9 +9,9 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger" "github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -130,7 +130,7 @@ func resourceConfidentialLedger() *pluginsdk.Resource { } func resourceConfidentialLedgerCreate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ConfidentialLedger.ConfidentialLedgereClient + client := meta.(*clients.Client).ConfidentialLedger.ConfidentialLedgerClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -169,7 +169,7 @@ func resourceConfidentialLedgerCreate(d *pluginsdk.ResourceData, meta interface{ } func resourceConfidentialLedgerRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ConfidentialLedger.ConfidentialLedgereClient + client := meta.(*clients.Client).ConfidentialLedger.ConfidentialLedgerClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -220,7 +220,7 @@ func resourceConfidentialLedgerRead(d *pluginsdk.ResourceData, meta interface{}) } func resourceConfidentialLedgerUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ConfidentialLedger.ConfidentialLedgereClient + client := meta.(*clients.Client).ConfidentialLedger.ConfidentialLedgerClient ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -272,7 +272,7 @@ func resourceConfidentialLedgerUpdate(d *pluginsdk.ResourceData, meta interface{ } func resourceConfidentialLedgerDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ConfidentialLedger.ConfidentialLedgereClient + client := meta.(*clients.Client).ConfidentialLedger.ConfidentialLedgerClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/client.go deleted file mode 100644 index 0385597571e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package confidentialledger - -import "github.com/Azure/go-autorest/autorest" - -type ConfidentialLedgerClient struct { - Client autorest.Client - baseUri string -} - -func NewConfidentialLedgerClientWithBaseURI(endpoint string) ConfidentialLedgerClient { - return ConfidentialLedgerClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/constants.go deleted file mode 100644 index 9b4b8e019d2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/constants.go +++ /dev/null @@ -1,142 +0,0 @@ -package confidentialledger - -import "strings" - -type CreatedByType string - -const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" -) - -func PossibleValuesForCreatedByType() []string { - return []string{ - string(CreatedByTypeApplication), - string(CreatedByTypeKey), - string(CreatedByTypeManagedIdentity), - string(CreatedByTypeUser), - } -} - -func parseCreatedByType(input string) (*CreatedByType, error) { - vals := map[string]CreatedByType{ - "application": CreatedByTypeApplication, - "key": CreatedByTypeKey, - "managedidentity": CreatedByTypeManagedIdentity, - "user": CreatedByTypeUser, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CreatedByType(input) - return &out, nil -} - -type LedgerRoleName string - -const ( - LedgerRoleNameAdministrator LedgerRoleName = "Administrator" - LedgerRoleNameContributor LedgerRoleName = "Contributor" - LedgerRoleNameReader LedgerRoleName = "Reader" -) - -func PossibleValuesForLedgerRoleName() []string { - return []string{ - string(LedgerRoleNameAdministrator), - string(LedgerRoleNameContributor), - string(LedgerRoleNameReader), - } -} - -func parseLedgerRoleName(input string) (*LedgerRoleName, error) { - vals := map[string]LedgerRoleName{ - "administrator": LedgerRoleNameAdministrator, - "contributor": LedgerRoleNameContributor, - "reader": LedgerRoleNameReader, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := LedgerRoleName(input) - return &out, nil -} - -type LedgerType string - -const ( - LedgerTypePrivate LedgerType = "Private" - LedgerTypePublic LedgerType = "Public" - LedgerTypeUnknown LedgerType = "Unknown" -) - -func PossibleValuesForLedgerType() []string { - return []string{ - string(LedgerTypePrivate), - string(LedgerTypePublic), - string(LedgerTypeUnknown), - } -} - -func parseLedgerType(input string) (*LedgerType, error) { - vals := map[string]LedgerType{ - "private": LedgerTypePrivate, - "public": LedgerTypePublic, - "unknown": LedgerTypeUnknown, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := LedgerType(input) - return &out, nil -} - -type ProvisioningState string - -const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUnknown ProvisioningState = "Unknown" - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -func PossibleValuesForProvisioningState() []string { - return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), - string(ProvisioningStateDeleting), - string(ProvisioningStateFailed), - string(ProvisioningStateSucceeded), - string(ProvisioningStateUnknown), - string(ProvisioningStateUpdating), - } -} - -func parseProvisioningState(input string) (*ProvisioningState, error) { - vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, - "deleting": ProvisioningStateDeleting, - "failed": ProvisioningStateFailed, - "succeeded": ProvisioningStateSucceeded, - "unknown": ProvisioningStateUnknown, - "updating": ProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProvisioningState(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/model_aadbasedsecurityprincipal.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/model_aadbasedsecurityprincipal.go deleted file mode 100644 index d72951b6c6a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/model_aadbasedsecurityprincipal.go +++ /dev/null @@ -1,7 +0,0 @@ -package confidentialledger - -type AADBasedSecurityPrincipal struct { - LedgerRoleName *LedgerRoleName `json:"ledgerRoleName,omitempty"` - PrincipalId *string `json:"principalId,omitempty"` - TenantId *string `json:"tenantId,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/model_certbasedsecurityprincipal.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/model_certbasedsecurityprincipal.go deleted file mode 100644 index aed3c7a7c10..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/model_certbasedsecurityprincipal.go +++ /dev/null @@ -1,6 +0,0 @@ -package confidentialledger - -type CertBasedSecurityPrincipal struct { - Cert *string `json:"cert,omitempty"` - LedgerRoleName *LedgerRoleName `json:"ledgerRoleName,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/model_confidentialledger.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/model_confidentialledger.go deleted file mode 100644 index 2f519e0c08e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/model_confidentialledger.go +++ /dev/null @@ -1,11 +0,0 @@ -package confidentialledger - -type ConfidentialLedger struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *LedgerProperties `json:"properties,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/model_systemdata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/model_systemdata.go deleted file mode 100644 index df19fdb8bcd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/model_systemdata.go +++ /dev/null @@ -1,40 +0,0 @@ -package confidentialledger - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type SystemData struct { - CreatedAt *string `json:"createdAt,omitempty"` - CreatedBy *string `json:"createdBy,omitempty"` - CreatedByType *CreatedByType `json:"createdByType,omitempty"` - LastModifiedAt *string `json:"lastModifiedAt,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` -} - -func (o SystemData) GetCreatedAtAsTime() (*time.Time, error) { - if o.CreatedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o SystemData) SetCreatedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreatedAt = &formatted -} - -func (o SystemData) GetLastModifiedAtAsTime() (*time.Time, error) { - if o.LastModifiedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModifiedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o SystemData) SetLastModifiedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModifiedAt = &formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/version.go deleted file mode 100644 index 544e3f2b9d0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package confidentialledger - -import "fmt" - -const defaultApiVersion = "2021-05-13-preview" - -func userAgent() string { - return fmt.Sprintf("pandora/confidentialledger/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/api_connection_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/api_connection_resource.go index 89b59c00356..8913198f27d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/api_connection_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/api_connection_resource.go @@ -9,11 +9,11 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections" + "github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/client/client.go index 85d4ee4251d..9aa39db1d20 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/client/client.go @@ -1,9 +1,9 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections" + "github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/managed_api_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/managed_api_data_source.go index 229623e4e65..69daf5ab1be 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/managed_api_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/managed_api_data_source.go @@ -4,14 +4,13 @@ import ( "fmt" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/client.go deleted file mode 100644 index 6334c402c6c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package connections - -import "github.com/Azure/go-autorest/autorest" - -type ConnectionsClient struct { - Client autorest.Client - baseUri string -} - -func NewConnectionsClientWithBaseURI(endpoint string) ConnectionsClient { - return ConnectionsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/constants.go deleted file mode 100644 index 86041f42188..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/constants.go +++ /dev/null @@ -1,34 +0,0 @@ -package connections - -import "strings" - -type LinkState string - -const ( - LinkStateAuthenticated LinkState = "Authenticated" - LinkStateError LinkState = "Error" - LinkStateUnauthenticated LinkState = "Unauthenticated" -) - -func PossibleValuesForLinkState() []string { - return []string{ - string(LinkStateAuthenticated), - string(LinkStateError), - string(LinkStateUnauthenticated), - } -} - -func parseLinkState(input string) (*LinkState, error) { - vals := map[string]LinkState{ - "authenticated": LinkStateAuthenticated, - "error": LinkStateError, - "unauthenticated": LinkStateUnauthenticated, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := LinkState(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_createorupdate_autorest.go deleted file mode 100644 index 37e72b50f2f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_createorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package connections - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiConnectionDefinition -} - -// CreateOrUpdate ... -func (c ConnectionsClient) CreateOrUpdate(ctx context.Context, id ConnectionId, input ApiConnectionDefinition) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ConnectionsClient) preparerForCreateOrUpdate(ctx context.Context, id ConnectionId, input ApiConnectionDefinition) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ConnectionsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_delete_autorest.go deleted file mode 100644 index 2ce5e8aa702..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_delete_autorest.go +++ /dev/null @@ -1,62 +0,0 @@ -package connections - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c ConnectionsClient) Delete(ctx context.Context, id ConnectionId) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ConnectionsClient) preparerForDelete(ctx context.Context, id ConnectionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ConnectionsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_get_autorest.go deleted file mode 100644 index 46391b0f373..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package connections - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ApiConnectionDefinition -} - -// Get ... -func (c ConnectionsClient) Get(ctx context.Context, id ConnectionId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ConnectionsClient) preparerForGet(ctx context.Context, id ConnectionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ConnectionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_list_autorest.go deleted file mode 100644 index b76a8b4e6ea..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_list_autorest.go +++ /dev/null @@ -1,100 +0,0 @@ -package connections - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *ApiConnectionDefinitionCollection -} - -type ListOperationOptions struct { - Filter *string - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c ConnectionsClient) List(ctx context.Context, id commonids.ResourceGroupId, options ListOperationOptions) (result ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c ConnectionsClient) preparerForList(ctx context.Context, id commonids.ResourceGroupId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Web/connections", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c ConnectionsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_update_autorest.go deleted file mode 100644 index d9f3424199d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/method_update_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package connections - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *ApiConnectionDefinition -} - -// Update ... -func (c ConnectionsClient) Update(ctx context.Context, id ConnectionId, input ApiConnectionDefinition) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "connections.ConnectionsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ConnectionsClient) preparerForUpdate(ctx context.Context, id ConnectionId, input ApiConnectionDefinition) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ConnectionsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_apiconnectiondefinitioncollection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_apiconnectiondefinitioncollection.go deleted file mode 100644 index ca4c041a8ec..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_apiconnectiondefinitioncollection.go +++ /dev/null @@ -1,5 +0,0 @@ -package connections - -type ApiConnectionDefinitionCollection struct { - Value *[]ApiConnectionDefinition `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_apiconnectiondefinitionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_apiconnectiondefinitionproperties.go deleted file mode 100644 index 0d9e3852f8b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_apiconnectiondefinitionproperties.go +++ /dev/null @@ -1,43 +0,0 @@ -package connections - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type ApiConnectionDefinitionProperties struct { - Api *ApiReference `json:"api,omitempty"` - ChangedTime *string `json:"changedTime,omitempty"` - CreatedTime *string `json:"createdTime,omitempty"` - CustomParameterValues *map[string]string `json:"customParameterValues,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - NonSecretParameterValues *map[string]string `json:"nonSecretParameterValues,omitempty"` - ParameterValues *map[string]string `json:"parameterValues,omitempty"` - Statuses *[]ConnectionStatusDefinition `json:"statuses,omitempty"` - TestLinks *[]ApiConnectionTestLink `json:"testLinks,omitempty"` -} - -func (o ApiConnectionDefinitionProperties) GetChangedTimeAsTime() (*time.Time, error) { - if o.ChangedTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.ChangedTime, "2006-01-02T15:04:05Z07:00") -} - -func (o ApiConnectionDefinitionProperties) SetChangedTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ChangedTime = &formatted -} - -func (o ApiConnectionDefinitionProperties) GetCreatedTimeAsTime() (*time.Time, error) { - if o.CreatedTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreatedTime, "2006-01-02T15:04:05Z07:00") -} - -func (o ApiConnectionDefinitionProperties) SetCreatedTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreatedTime = &formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_apiconnectiontestlink.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_apiconnectiontestlink.go deleted file mode 100644 index 88af238de86..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_apiconnectiontestlink.go +++ /dev/null @@ -1,6 +0,0 @@ -package connections - -type ApiConnectionTestLink struct { - Method *string `json:"method,omitempty"` - RequestUri *string `json:"requestUri,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_confirmconsentcodedefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_confirmconsentcodedefinition.go deleted file mode 100644 index 617de0d87ee..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_confirmconsentcodedefinition.go +++ /dev/null @@ -1,7 +0,0 @@ -package connections - -type ConfirmConsentCodeDefinition struct { - Code *string `json:"code,omitempty"` - ObjectId *string `json:"objectId,omitempty"` - TenantId *string `json:"tenantId,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_connectionerrorproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_connectionerrorproperties.go deleted file mode 100644 index bbecdd25828..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_connectionerrorproperties.go +++ /dev/null @@ -1,6 +0,0 @@ -package connections - -type ConnectionErrorProperties struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_connectionstatusdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_connectionstatusdefinition.go deleted file mode 100644 index 6c44fcf91d2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_connectionstatusdefinition.go +++ /dev/null @@ -1,7 +0,0 @@ -package connections - -type ConnectionStatusDefinition struct { - Error *ConnectionError `json:"error,omitempty"` - Status *string `json:"status,omitempty"` - Target *string `json:"target,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_consentlinkcollection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_consentlinkcollection.go deleted file mode 100644 index e49dde15b8d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_consentlinkcollection.go +++ /dev/null @@ -1,5 +0,0 @@ -package connections - -type ConsentLinkCollection struct { - Value *[]ConsentLinkDefinition `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_consentlinkdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_consentlinkdefinition.go deleted file mode 100644 index 450871bf4ba..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_consentlinkdefinition.go +++ /dev/null @@ -1,8 +0,0 @@ -package connections - -type ConsentLinkDefinition struct { - DisplayName *string `json:"displayName,omitempty"` - FirstPartyLoginUri *string `json:"firstPartyLoginUri,omitempty"` - Link *string `json:"link,omitempty"` - Status *LinkState `json:"status,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_consentlinkparameterdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_consentlinkparameterdefinition.go deleted file mode 100644 index 20298736678..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_consentlinkparameterdefinition.go +++ /dev/null @@ -1,8 +0,0 @@ -package connections - -type ConsentLinkParameterDefinition struct { - ObjectId *string `json:"objectId,omitempty"` - ParameterName *string `json:"parameterName,omitempty"` - RedirectUrl *string `json:"redirectUrl,omitempty"` - TenantId *string `json:"tenantId,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_listconsentlinksdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_listconsentlinksdefinition.go deleted file mode 100644 index 47911901b56..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/model_listconsentlinksdefinition.go +++ /dev/null @@ -1,5 +0,0 @@ -package connections - -type ListConsentLinksDefinition struct { - Parameters *[]ConsentLinkParameterDefinition `json:"parameters,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/version.go deleted file mode 100644 index bb2ca15f1eb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package connections - -import "fmt" - -const defaultApiVersion = "2016-06-01" - -func userAgent() string { - return fmt.Sprintf("pandora/connections/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/client.go deleted file mode 100644 index 7b4e03c6228..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package managedapis - -import "github.com/Azure/go-autorest/autorest" - -type ManagedAPIsClient struct { - Client autorest.Client - baseUri string -} - -func NewManagedAPIsClientWithBaseURI(endpoint string) ManagedAPIsClient { - return ManagedAPIsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/constants.go deleted file mode 100644 index d510491b206..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/constants.go +++ /dev/null @@ -1,114 +0,0 @@ -package managedapis - -import "strings" - -type ApiType string - -const ( - ApiTypeNotSpecified ApiType = "NotSpecified" - ApiTypeRest ApiType = "Rest" - ApiTypeSoap ApiType = "Soap" -) - -func PossibleValuesForApiType() []string { - return []string{ - string(ApiTypeNotSpecified), - string(ApiTypeRest), - string(ApiTypeSoap), - } -} - -func parseApiType(input string) (*ApiType, error) { - vals := map[string]ApiType{ - "notspecified": ApiTypeNotSpecified, - "rest": ApiTypeRest, - "soap": ApiTypeSoap, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ApiType(input) - return &out, nil -} - -type ConnectionParameterType string - -const ( - ConnectionParameterTypeArray ConnectionParameterType = "array" - ConnectionParameterTypeBool ConnectionParameterType = "bool" - ConnectionParameterTypeConnection ConnectionParameterType = "connection" - ConnectionParameterTypeInt ConnectionParameterType = "int" - ConnectionParameterTypeOauthSetting ConnectionParameterType = "oauthSetting" - ConnectionParameterTypeObject ConnectionParameterType = "object" - ConnectionParameterTypeSecureobject ConnectionParameterType = "secureobject" - ConnectionParameterTypeSecurestring ConnectionParameterType = "securestring" - ConnectionParameterTypeString ConnectionParameterType = "string" -) - -func PossibleValuesForConnectionParameterType() []string { - return []string{ - string(ConnectionParameterTypeArray), - string(ConnectionParameterTypeBool), - string(ConnectionParameterTypeConnection), - string(ConnectionParameterTypeInt), - string(ConnectionParameterTypeOauthSetting), - string(ConnectionParameterTypeObject), - string(ConnectionParameterTypeSecureobject), - string(ConnectionParameterTypeSecurestring), - string(ConnectionParameterTypeString), - } -} - -func parseConnectionParameterType(input string) (*ConnectionParameterType, error) { - vals := map[string]ConnectionParameterType{ - "array": ConnectionParameterTypeArray, - "bool": ConnectionParameterTypeBool, - "connection": ConnectionParameterTypeConnection, - "int": ConnectionParameterTypeInt, - "oauthsetting": ConnectionParameterTypeOauthSetting, - "object": ConnectionParameterTypeObject, - "secureobject": ConnectionParameterTypeSecureobject, - "securestring": ConnectionParameterTypeSecurestring, - "string": ConnectionParameterTypeString, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ConnectionParameterType(input) - return &out, nil -} - -type WsdlImportMethod string - -const ( - WsdlImportMethodNotSpecified WsdlImportMethod = "NotSpecified" - WsdlImportMethodSoapPassThrough WsdlImportMethod = "SoapPassThrough" - WsdlImportMethodSoapToRest WsdlImportMethod = "SoapToRest" -) - -func PossibleValuesForWsdlImportMethod() []string { - return []string{ - string(WsdlImportMethodNotSpecified), - string(WsdlImportMethodSoapPassThrough), - string(WsdlImportMethodSoapToRest), - } -} - -func parseWsdlImportMethod(input string) (*WsdlImportMethod, error) { - vals := map[string]WsdlImportMethod{ - "notspecified": WsdlImportMethodNotSpecified, - "soappassthrough": WsdlImportMethodSoapPassThrough, - "soaptorest": WsdlImportMethodSoapToRest, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := WsdlImportMethod(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apioauthsettingsparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apioauthsettingsparameter.go deleted file mode 100644 index bdd99a97b0f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apioauthsettingsparameter.go +++ /dev/null @@ -1,7 +0,0 @@ -package managedapis - -type ApiOAuthSettingsParameter struct { - Options *interface{} `json:"options,omitempty"` - UiDefinition *interface{} `json:"uiDefinition,omitempty"` - Value *string `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourcebackendservice.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourcebackendservice.go deleted file mode 100644 index 323d91c8a9d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourcebackendservice.go +++ /dev/null @@ -1,5 +0,0 @@ -package managedapis - -type ApiResourceBackendService struct { - ServiceUrl *string `json:"serviceUrl,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourcedefinitions.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourcedefinitions.go deleted file mode 100644 index 46f0af517b7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourcedefinitions.go +++ /dev/null @@ -1,6 +0,0 @@ -package managedapis - -type ApiResourceDefinitions struct { - ModifiedSwaggerUrl *string `json:"modifiedSwaggerUrl,omitempty"` - OriginalSwaggerUrl *string `json:"originalSwaggerUrl,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourcegeneralinformation.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourcegeneralinformation.go deleted file mode 100644 index 0b04acb05c6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourcegeneralinformation.go +++ /dev/null @@ -1,9 +0,0 @@ -package managedapis - -type ApiResourceGeneralInformation struct { - Description *string `json:"description,omitempty"` - DisplayName *string `json:"displayName,omitempty"` - IconUrl *string `json:"iconUrl,omitempty"` - ReleaseTag *string `json:"releaseTag,omitempty"` - TermsOfUseUrl *string `json:"termsOfUseUrl,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourcepolicies.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourcepolicies.go deleted file mode 100644 index 68b2e9bb103..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_apiresourcepolicies.go +++ /dev/null @@ -1,6 +0,0 @@ -package managedapis - -type ApiResourcePolicies struct { - Content *string `json:"content,omitempty"` - ContentLink *string `json:"contentLink,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_connectionparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_connectionparameter.go deleted file mode 100644 index 7f94c62573d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_connectionparameter.go +++ /dev/null @@ -1,6 +0,0 @@ -package managedapis - -type ConnectionParameter struct { - OAuthSettings *ApiOAuthSettings `json:"oAuthSettings,omitempty"` - Type *ConnectionParameterType `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_managedapidefinitioncollection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_managedapidefinitioncollection.go deleted file mode 100644 index ad818e34601..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_managedapidefinitioncollection.go +++ /dev/null @@ -1,5 +0,0 @@ -package managedapis - -type ManagedApiDefinitionCollection struct { - Value *[]ManagedApiDefinition `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_wsdlservice.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_wsdlservice.go deleted file mode 100644 index 203933a4522..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/model_wsdlservice.go +++ /dev/null @@ -1,6 +0,0 @@ -package managedapis - -type WsdlService struct { - EndpointQualifiedNames *[]string `json:"endpointQualifiedNames,omitempty"` - QualifiedName string `json:"qualifiedName"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/version.go deleted file mode 100644 index 63f9bd108fe..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package managedapis - -import "fmt" - -const defaultApiVersion = "2016-06-01" - -func userAgent() string { - return fmt.Sprintf("pandora/managedapis/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/client/client.go index 60902ef6611..f9d963845a9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/client/client.go @@ -1,19 +1,19 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance" legacy "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice" legacyacr "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry" "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-08-01-preview/containerregistry" - "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice" + "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice" "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { AgentPoolsClient *containerservice.AgentPoolsClient ContainerRegistryAgentPoolsClient *containerregistry.AgentPoolsClient - GroupsClient *containerinstance.ContainerGroupsClient + ContainerInstanceClient *containerinstance.ContainerInstanceClient KubernetesClustersClient *containerservice.ManagedClustersClient MaintenanceConfigurationsClient *containerservice.MaintenanceConfigurationsClient RegistriesClient *containerregistry.RegistriesClient @@ -50,8 +50,8 @@ func NewClient(o *common.ClientOptions) *Client { tasksClient := legacyacr.NewTasksClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&tasksClient.Client, o.ResourceManagerAuthorizer) - groupsClient := containerinstance.NewContainerGroupsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&groupsClient.Client, o.ResourceManagerAuthorizer) + containerInstanceClient := containerinstance.NewContainerInstanceClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&containerInstanceClient.Client, o.ResourceManagerAuthorizer) // AKS kubernetesClustersClient := containerservice.NewManagedClustersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) @@ -73,7 +73,7 @@ func NewClient(o *common.ClientOptions) *Client { AgentPoolsClient: &agentPoolsClient, ContainerRegistryAgentPoolsClient: ®istryAgentPoolsClient, KubernetesClustersClient: &kubernetesClustersClient, - GroupsClient: &groupsClient, + ContainerInstanceClient: &containerInstanceClient, MaintenanceConfigurationsClient: &maintenanceConfigurationsClient, RegistriesClient: ®istriesClient, WebhooksClient: &webhooksClient, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/container_group_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/container_group_data_source.go index 00cf207bb79..79b2373df6d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/container_group_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/container_group_data_source.go @@ -4,15 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceContainerGroup() *pluginsdk.Resource { @@ -44,22 +44,22 @@ func dataSourceContainerGroup() *pluginsdk.Resource { Computed: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } func dataSourceContainerGroupRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Containers.GroupsClient + client := meta.(*clients.Client).Containers.ContainerInstanceClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewContainerGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := containerinstance.NewContainerGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.ContainerGroupsGet(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } @@ -67,16 +67,20 @@ func dataSourceContainerGroupRead(d *pluginsdk.ResourceData, meta interface{}) e } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.ContainerGroupName) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.ContainerGroupProperties; props != nil { + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } + props := model.Properties if address := props.IPAddress; address != nil { d.Set("ip_address", address.IP) d.Set("fqdn", address.Fqdn) } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/container_group_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/container_group_resource.go index 51f1ea2f248..b224c326fff 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/container_group_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/container_group_resource.go @@ -8,21 +8,22 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse" keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" networkParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -36,7 +37,7 @@ func resourceContainerGroup() *pluginsdk.Resource { Delete: resourceContainerGroupDelete, Update: resourceContainerGroupUpdate, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ContainerGroupID(id) + _, err := containerinstance.ParseContainerGroupID(id) return err }), @@ -55,9 +56,9 @@ func resourceContainerGroup() *pluginsdk.Resource { ValidateFunc: validation.StringIsNotEmpty, }, - "location": azure.SchemaLocation(), + "location": commonschema.Location(), - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), "ip_address_type": { Type: pluginsdk.TypeString, @@ -122,7 +123,7 @@ func resourceContainerGroup() *pluginsdk.Resource { "identity": commonschema.SystemAssignedUserAssignedIdentityOptional(), - "tags": tags.Schema(), + "tags": commonschema.Tags(), "restart_policy": { Type: pluginsdk.TypeString, @@ -291,6 +292,44 @@ func resourceContainerGroup() *pluginsdk.Resource { }, }, + "cpu_limit": { + Type: pluginsdk.TypeFloat, + Optional: true, + ValidateFunc: validation.FloatAtLeast(0.0), + }, + + "memory_limit": { + Type: pluginsdk.TypeFloat, + Optional: true, + ValidateFunc: validation.FloatAtLeast(0.0), + }, + + //lintignore:XS003 + "gpu_limit": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "count": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntAtLeast(0), + }, + + "sku": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + "K80", + "P100", + "V100", + }, false), + }, + }, + }, + }, + "ports": { Type: pluginsdk.TypeSet, Optional: true, @@ -569,30 +608,29 @@ func containerVolumeSchema() *pluginsdk.Schema { } func resourceContainerGroupCreate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Containers.GroupsClient + client := meta.(*clients.Client).Containers.ContainerInstanceClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewContainerGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := containerinstance.NewContainerGroupID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.ContainerGroupsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_container_group", id.ID()) } } - location := azure.NormalizeLocation(d.Get("location").(string)) + location := location.Normalize(d.Get("location").(string)) OSType := d.Get("os_type").(string) IPAddressType := d.Get("ip_address_type").(string) - t := d.Get("tags").(map[string]interface{}) - restartPolicy := d.Get("restart_policy").(string) + restartPolicy := containerinstance.ContainerGroupRestartPolicy(d.Get("restart_policy").(string)) diagnosticsRaw := d.Get("diagnostics").([]interface{}) diagnostics := expandContainerGroupDiagnostics(diagnosticsRaw) dnsConfig := d.Get("dns_config").([]interface{}) @@ -614,25 +652,25 @@ func resourceContainerGroupCreate(d *pluginsdk.ResourceData, meta interface{}) e } containerGroup := containerinstance.ContainerGroup{ - Name: utils.String(id.Name), + Name: pointer.FromString(id.ContainerGroupName), Location: &location, - Tags: tags.Expand(t), - ContainerGroupProperties: &containerinstance.ContainerGroupProperties{ + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + Properties: containerinstance.ContainerGroupProperties{ InitContainers: initContainers, Containers: containers, Diagnostics: diagnostics, - RestartPolicy: containerinstance.ContainerGroupRestartPolicy(restartPolicy), + RestartPolicy: &restartPolicy, OsType: containerinstance.OperatingSystemTypes(OSType), Volumes: &containerGroupVolumes, ImageRegistryCredentials: expandContainerImageRegistryCredentials(d), - DNSConfig: expandContainerGroupDnsConfig(dnsConfig), + DnsConfig: expandContainerGroupDnsConfig(dnsConfig), }, } // Container Groups with OS Type Windows do not support managed identities but the API also does not accept Identity Type: None // https://github.com/Azure/azure-rest-api-specs/issues/18122 if OSType != string(containerinstance.OperatingSystemTypesWindows) { - expandedIdentity, err := expandContainerGroupIdentity(d.Get("identity").([]interface{})) + expandedIdentity, err := identity.ExpandSystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } @@ -640,13 +678,13 @@ func resourceContainerGroupCreate(d *pluginsdk.ResourceData, meta interface{}) e } if IPAddressType != "None" { - containerGroup.ContainerGroupProperties.IPAddress = &containerinstance.IPAddress{ + containerGroup.Properties.IPAddress = &containerinstance.IPAddress{ Ports: containerGroupPorts, Type: containerinstance.ContainerGroupIPAddressType(IPAddressType), } if dnsNameLabel := d.Get("dns_name_label").(string); dnsNameLabel != "" { - containerGroup.ContainerGroupProperties.IPAddress.DNSNameLabel = &dnsNameLabel + containerGroup.Properties.IPAddress.DnsNameLabel = &dnsNameLabel } } @@ -663,8 +701,8 @@ func resourceContainerGroupCreate(d *pluginsdk.ResourceData, meta interface{}) e if strings.ToLower(OSType) != "linux" { return fmt.Errorf("Currently only Linux containers can be deployed to virtual networks") } - containerGroup.ContainerGroupProperties.NetworkProfile = &containerinstance.ContainerGroupNetworkProfile{ - ID: &networkProfileIDNorm, + containerGroup.Properties.NetworkProfile = &containerinstance.ContainerGroupNetworkProfile{ + Id: networkProfileIDNorm, } } @@ -673,20 +711,15 @@ func resourceContainerGroupCreate(d *pluginsdk.ResourceData, meta interface{}) e if err != nil { return fmt.Errorf("parsing Key Vault Key ID: %+v", err) } - containerGroup.ContainerGroupProperties.EncryptionProperties = &containerinstance.EncryptionProperties{ - VaultBaseURL: utils.String(keyId.KeyVaultBaseUrl), - KeyName: utils.String(keyId.Name), - KeyVersion: utils.String(keyId.Version), + containerGroup.Properties.EncryptionProperties = &containerinstance.EncryptionProperties{ + VaultBaseUrl: keyId.KeyVaultBaseUrl, + KeyName: keyId.Name, + KeyVersion: keyId.Version, } } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, containerGroup) - if err != nil { - return fmt.Errorf("creating/updating %s: %+v", id, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) + if err := client.ContainerGroupsCreateOrUpdateThenPoll(ctx, id, containerGroup); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } d.SetId(id.ID()) @@ -694,11 +727,11 @@ func resourceContainerGroupCreate(d *pluginsdk.ResourceData, meta interface{}) e } func resourceContainerGroupUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Containers.GroupsClient + client := meta.(*clients.Client).Containers.ContainerInstanceClient ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ContainerGroupID(d.Id()) + id, err := containerinstance.ParseContainerGroupID(d.Id()) if err != nil { return err } @@ -709,7 +742,7 @@ func resourceContainerGroupUpdate(d *pluginsdk.ResourceData, meta interface{}) e Tags: tags.Expand(t), } - if _, err := client.Update(ctx, id.ResourceGroup, id.Name, parameters); err != nil { + if _, err := client.ContainerGroupsUpdate(ctx, *id, parameters); err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } @@ -717,18 +750,18 @@ func resourceContainerGroupUpdate(d *pluginsdk.ResourceData, meta interface{}) e } func resourceContainerGroupRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Containers.GroupsClient + client := meta.(*clients.Client).Containers.ContainerInstanceClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ContainerGroupID(d.Id()) + id, err := containerinstance.ParseContainerGroupID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.ContainerGroupsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -736,26 +769,29 @@ func resourceContainerGroupRead(d *pluginsdk.ResourceData, meta interface{}) err return err } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + d.Set("name", id.ContainerGroupName) + d.Set("resource_group_name", id.ResourceGroupName) - identity, err := flattenContainerGroupIdentity(resp.Identity) - if err != nil { - return fmt.Errorf("flattening `identity`: %+v", err) - } - if err := d.Set("identity", identity); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) - } + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + identity, err := identity.FlattenSystemAndUserAssignedMap(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + if err := d.Set("identity", identity); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } - if props := resp.ContainerGroupProperties; props != nil { - containerConfigs := flattenContainerGroupContainers(d, resp.Containers, props.Volumes) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } + + props := model.Properties + containerConfigs := flattenContainerGroupContainers(d, &props.Containers, props.Volumes) if err := d.Set("container", containerConfigs); err != nil { return fmt.Errorf("setting `container`: %+v", err) } - initContainerConfigs := flattenContainerGroupInitContainers(d, resp.InitContainers, props.Volumes) + initContainerConfigs := flattenContainerGroupInitContainers(d, props.InitContainers, props.Volumes) if err := d.Set("init_container", initContainerConfigs); err != nil { return fmt.Errorf("setting `init_container`: %+v", err) } @@ -767,18 +803,23 @@ func resourceContainerGroupRead(d *pluginsdk.ResourceData, meta interface{}) err if address := props.IPAddress; address != nil { d.Set("ip_address_type", address.Type) d.Set("ip_address", address.IP) - exposedPorts := make([]interface{}, len(*resp.ContainerGroupProperties.IPAddress.Ports)) - for i := range *resp.ContainerGroupProperties.IPAddress.Ports { - exposedPorts[i] = (*resp.ContainerGroupProperties.IPAddress.Ports)[i] + exposedPorts := make([]interface{}, len(address.Ports)) + for i := range address.Ports { + exposedPorts[i] = (address.Ports)[i] } d.Set("exposed_port", flattenPorts(exposedPorts)) - d.Set("dns_name_label", address.DNSNameLabel) + d.Set("dns_name_label", address.DnsNameLabel) d.Set("fqdn", address.Fqdn) } - d.Set("restart_policy", string(props.RestartPolicy)) + restartPolicy := "" + if props.RestartPolicy != nil { + restartPolicy = string(*props.RestartPolicy) + } + d.Set("restart_policy", restartPolicy) + d.Set("os_type", string(props.OsType)) - d.Set("dns_config", flattenContainerGroupDnsConfig(resp.DNSConfig)) + d.Set("dns_config", flattenContainerGroupDnsConfig(props.DnsConfig)) if err := d.Set("diagnostics", flattenContainerGroupDiagnostics(d, props.Diagnostics)); err != nil { return fmt.Errorf("setting `diagnostics`: %+v", err) @@ -786,19 +827,17 @@ func resourceContainerGroupRead(d *pluginsdk.ResourceData, meta interface{}) err if kvProps := props.EncryptionProperties; kvProps != nil { var keyVaultUri, keyName, keyVersion string - if kvProps.VaultBaseURL != nil && *kvProps.VaultBaseURL != "" { - keyVaultUri = *kvProps.VaultBaseURL + if kvProps.VaultBaseUrl != "" { + keyVaultUri = kvProps.VaultBaseUrl } else { return fmt.Errorf("empty value returned for Key Vault URI") } - if kvProps.KeyName != nil && *kvProps.KeyName != "" { - keyName = *kvProps.KeyName + if kvProps.KeyName != "" { + keyName = kvProps.KeyName } else { return fmt.Errorf("empty value returned for Key Vault Key Name") } - if kvProps.KeyVersion != nil { - keyVersion = *kvProps.KeyVersion - } + keyVersion = kvProps.KeyVersion keyId, err := keyVaultParse.NewNestedItemID(keyVaultUri, "keys", keyName, keyVersion) if err != nil { return err @@ -807,7 +846,7 @@ func resourceContainerGroupRead(d *pluginsdk.ResourceData, meta interface{}) err } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func flattenPorts(ports []interface{}) *pluginsdk.Set { @@ -817,15 +856,19 @@ func flattenPorts(ports []interface{}) *pluginsdk.Set { port := make(map[string]interface{}) switch t := p.(type) { case containerinstance.Port: - if v := t.Port; v != nil { - port["port"] = int(*v) + port["port"] = int(t.Port) + proto := "" + if t.Protocol != nil { + proto = string(*t.Protocol) } - port["protocol"] = string(t.Protocol) + port["protocol"] = proto case containerinstance.ContainerPort: - if v := t.Port; v != nil { - port["port"] = int(*v) + port["port"] = int(t.Port) + proto := "" + if t.Protocol != nil { + proto = string(*t.Protocol) } - port["protocol"] = string(t.Protocol) + port["protocol"] = proto } flatPorts = append(flatPorts, port) } @@ -835,35 +878,35 @@ func flattenPorts(ports []interface{}) *pluginsdk.Set { } func resourceContainerGroupDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Containers.GroupsClient + client := meta.(*clients.Client).Containers.ContainerInstanceClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ContainerGroupID(d.Id()) + id, err := containerinstance.ParseContainerGroupID(d.Id()) if err != nil { return err } networkProfileId := "" - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.ContainerGroupsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(existing.Response) { + if response.WasNotFound(existing.HttpResponse) { // already deleted return nil } - return fmt.Errorf("retrieving Container Group %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %q: %+v", id, err) } - if props := existing.ContainerGroupProperties; props != nil { + if model := existing.Model; model != nil { + props := model.Properties if profile := props.NetworkProfile; profile != nil { - if profile.ID != nil { - id, err := networkParse.NetworkProfileID(*profile.ID) - if err != nil { - return err - } - networkProfileId = id.ID() + id, err := networkParse.NetworkProfileID(profile.Id) + if err != nil { + return err } + networkProfileId = id.ID() + // Avoid parallel deletion if "network_profile_id" is given. (not sure whether this is necessary) // See: https://github.com/hashicorp/terraform-provider-azurerm/issues/15025 locks.ByID(networkProfileId) @@ -871,12 +914,8 @@ func resourceContainerGroupDelete(d *pluginsdk.ResourceData, meta interface{}) e } } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { - return fmt.Errorf("deleting Container Group %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of Container Group %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err := client.ContainerGroupsDeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %q: %+v", id, err) } if networkProfileId != "" { @@ -887,11 +926,11 @@ func resourceContainerGroupDelete(d *pluginsdk.ResourceData, meta interface{}) e } // TODO: remove when https://github.com/Azure/azure-sdk-for-go/issues/5082 has been fixed - log.Printf("[DEBUG] Waiting for Container Group %q (Resource Group %q) to be finish deleting", id.Name, id.ResourceGroup) + log.Printf("[DEBUG] Waiting for %q to be finish deleting", id) stateConf := &pluginsdk.StateChangeConf{ Pending: []string{"Attached"}, Target: []string{"Detached"}, - Refresh: containerGroupEnsureDetachedFromNetworkProfileRefreshFunc(ctx, networkProfileClient, networkProfileId.ResourceGroup, networkProfileId.Name, id.ResourceGroup, id.Name), + Refresh: containerGroupEnsureDetachedFromNetworkProfileRefreshFunc(ctx, networkProfileClient, networkProfileId.ResourceGroup, networkProfileId.Name, id.ResourceGroupName, id.ContainerGroupName), MinTimeout: 15 * time.Second, ContinuousTargetOccurence: 5, Timeout: d.Timeout(pluginsdk.TimeoutDelete), @@ -899,7 +938,7 @@ func resourceContainerGroupDelete(d *pluginsdk.ResourceData, meta interface{}) e } if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for Container Group %q (Resource Group %q) to finish deleting: %s", id.Name, id.ResourceGroup, err) + return fmt.Errorf("waiting for %q to finish deleting: %s", id, err) } } @@ -925,16 +964,16 @@ func containerGroupEnsureDetachedFromNetworkProfileRefreshFunc(ctx context.Conte continue } - parsedId, err := parse.ContainerGroupID(*nicProps.Container.ID) + parsedId, err := containerinstance.ParseContainerGroupID(*nicProps.Container.ID) if err != nil { return nil, "", err } - if parsedId.ResourceGroup != containerResourceGroupName { + if parsedId.ResourceGroupName != containerResourceGroupName { continue } - if parsedId.Name == "" || parsedId.Name != containerName { + if parsedId.ContainerGroupName == "" || parsedId.ContainerGroupName != containerName { continue } @@ -963,9 +1002,9 @@ func expandContainerGroupInitContainers(d *pluginsdk.ResourceData, addedEmptyDir image := data["image"].(string) container := containerinstance.InitContainerDefinition{ - Name: utils.String(name), - InitContainerPropertiesDefinition: &containerinstance.InitContainerPropertiesDefinition{ - Image: utils.String(image), + Name: name, + Properties: containerinstance.InitContainerPropertiesDefinition{ + Image: pointer.FromString(image), }, } @@ -987,7 +1026,7 @@ func expandContainerGroupInitContainers(d *pluginsdk.ResourceData, addedEmptyDir *envVars = append(*envVars, *secEnvVars...) // Set both secure and non secure environment variables - container.EnvironmentVariables = envVars + container.Properties.EnvironmentVariables = envVars if v, ok := data["commands"]; ok { c := v.([]interface{}) @@ -996,7 +1035,7 @@ func expandContainerGroupInitContainers(d *pluginsdk.ResourceData, addedEmptyDir command = append(command, v.(string)) } - container.Command = &command + container.Properties.Command = &command } if v, ok := data["volume"]; ok { @@ -1004,7 +1043,7 @@ func expandContainerGroupInitContainers(d *pluginsdk.ResourceData, addedEmptyDir if err != nil { return nil, nil, err } - container.VolumeMounts = volumeMounts + container.Properties.VolumeMounts = volumeMounts expandedContainerGroupVolumes, err := expandContainerVolume(v, addedEmptyDirs, containerGroupVolumes) if err != nil { @@ -1019,7 +1058,7 @@ func expandContainerGroupInitContainers(d *pluginsdk.ResourceData, addedEmptyDir return &containers, containerGroupVolumes, nil } -func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs map[string]bool) (*[]containerinstance.Container, *[]containerinstance.Port, []containerinstance.Volume, error) { +func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs map[string]bool) ([]containerinstance.Container, []containerinstance.Port, []containerinstance.Volume, error) { containersConfig := d.Get("container").([]interface{}) containers := make([]containerinstance.Container, 0) containerInstancePorts := make([]containerinstance.Port, 0) @@ -1035,13 +1074,13 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma memory := data["memory"].(float64) container := containerinstance.Container{ - Name: utils.String(name), - ContainerProperties: &containerinstance.ContainerProperties{ - Image: utils.String(image), - Resources: &containerinstance.ResourceRequirements{ - Requests: &containerinstance.ResourceRequests{ - MemoryInGB: utils.Float(memory), - CPU: utils.Float(cpu), + Name: name, + Properties: containerinstance.ContainerProperties{ + Image: image, + Resources: containerinstance.ResourceRequirements{ + Requests: containerinstance.ResourceRequests{ + MemoryInGB: memory, + Cpu: cpu, }, }, }, @@ -1058,31 +1097,58 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma gpuSku := containerinstance.GpuSku(v["sku"].(string)) gpus := containerinstance.GpuResource{ - Count: &gpuCount, + Count: int64(gpuCount), Sku: gpuSku, } - container.Resources.Requests.Gpu = &gpus + container.Properties.Resources.Requests.Gpu = &gpus } } + cpuLimit := data["cpu_limit"].(float64) + memLimit := data["memory_limit"].(float64) + gpuLimit := data["gpu_limit"].([]interface{}) + + if !(cpuLimit == 0.0 && memLimit == 0.0 && len(gpuLimit) == 0) { + limits := &containerinstance.ResourceLimits{} + if cpuLimit != 0.0 { + limits.Cpu = &cpuLimit + } + if memLimit != 0.0 { + limits.MemoryInGB = &memLimit + } + if len(gpuLimit) == 1 && gpuLimit[0] != nil { + v := gpuLimit[0].(map[string]interface{}) + limits.Gpu = &containerinstance.GpuResource{} + if v := int64(v["count"].(int)); v != 0 { + limits.Gpu.Count = v + } + if v := containerinstance.GpuSku(v["sku"].(string)); v != "" { + limits.Gpu.Sku = v + } + } + container.Properties.Resources.Limits = limits + } + if v, ok := data["ports"].(*pluginsdk.Set); ok && len(v.List()) > 0 { var ports []containerinstance.ContainerPort for _, v := range v.List() { portObj := v.(map[string]interface{}) - port := int32(portObj["port"].(int)) + port := int64(portObj["port"].(int)) proto := portObj["protocol"].(string) + containerProtocol := containerinstance.ContainerNetworkProtocol(proto) ports = append(ports, containerinstance.ContainerPort{ - Port: &port, - Protocol: containerinstance.ContainerNetworkProtocol(proto), + Port: port, + Protocol: &containerProtocol, }) + groupProtocol := containerinstance.ContainerGroupNetworkProtocol(proto) containerInstancePorts = append(containerInstancePorts, containerinstance.Port{ - Port: &port, - Protocol: containerinstance.ContainerGroupNetworkProtocol(proto), + Port: port, + Protocol: &groupProtocol, }) } - container.Ports = &ports + container.Properties.Ports = &ports } // Set both sensitive and non-secure environment variables @@ -1103,7 +1169,7 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma *envVars = append(*envVars, *secEnvVars...) // Set both secure and non secure environment variables - container.EnvironmentVariables = envVars + container.Properties.EnvironmentVariables = envVars if v, ok := data["commands"]; ok { c := v.([]interface{}) @@ -1112,7 +1178,7 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma command = append(command, v.(string)) } - container.Command = &command + container.Properties.Command = &command } if v, ok := data["volume"]; ok { @@ -1120,7 +1186,7 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma if err != nil { return nil, nil, nil, err } - container.VolumeMounts = volumeMounts + container.Properties.VolumeMounts = volumeMounts expandedContainerGroupVolumes, err := expandContainerVolume(v, addedEmptyDirs, containerGroupVolumes) if err != nil { @@ -1130,11 +1196,11 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma } if v, ok := data["liveness_probe"]; ok { - container.ContainerProperties.LivenessProbe = expandContainerProbe(v) + container.Properties.LivenessProbe = expandContainerProbe(v) } if v, ok := data["readiness_probe"]; ok { - container.ContainerProperties.ReadinessProbe = expandContainerProbe(v) + container.Properties.ReadinessProbe = expandContainerProbe(v) } containers = append(containers, container) @@ -1143,20 +1209,25 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma // Determine ports to be exposed on the group level, based on exposed_ports // and on what ports have been exposed on individual containers. if v, ok := d.Get("exposed_port").(*pluginsdk.Set); ok && len(v.List()) > 0 { - cgpMap := make(map[int32]map[containerinstance.ContainerGroupNetworkProtocol]bool) + cgpMap := make(map[int64]map[containerinstance.ContainerGroupNetworkProtocol]bool) for _, p := range containerInstancePorts { - if val, ok := cgpMap[*p.Port]; ok { - val[p.Protocol] = true - cgpMap[*p.Port] = val + if p.Protocol == nil { + continue + } + protocol := *p.Protocol + + if val, ok := cgpMap[p.Port]; ok { + val[protocol] = true + cgpMap[p.Port] = val } else { - protoMap := map[containerinstance.ContainerGroupNetworkProtocol]bool{p.Protocol: true} - cgpMap[*p.Port] = protoMap + protoMap := map[containerinstance.ContainerGroupNetworkProtocol]bool{protocol: true} + cgpMap[p.Port] = protoMap } } for _, p := range v.List() { portConfig := p.(map[string]interface{}) - port := int32(portConfig["port"].(int)) + port := int64(portConfig["port"].(int)) proto := portConfig["protocol"].(string) if !cgpMap[port][containerinstance.ContainerGroupNetworkProtocol(proto)] { return nil, nil, nil, fmt.Errorf("Port %d/%s is not exposed on any individual container in the container group.\n"+ @@ -1164,16 +1235,17 @@ func expandContainerGroupContainers(d *pluginsdk.ResourceData, addedEmptyDirs ma "and protocol. Any ports exposed on the container group must also be exposed on an individual container.", port, proto, port, proto) } + portProtocol := containerinstance.ContainerGroupNetworkProtocol(proto) containerGroupPorts = append(containerGroupPorts, containerinstance.Port{ - Port: &port, - Protocol: containerinstance.ContainerGroupNetworkProtocol(proto), + Port: port, + Protocol: &portProtocol, }) } } else { containerGroupPorts = containerInstancePorts // remove in 3.0 of the provider } - return &containers, &containerGroupPorts, containerGroupVolumes, nil + return containers, containerGroupPorts, containerGroupVolumes, nil } func expandContainerVolume(v interface{}, addedEmptyDirs map[string]bool, containerGroupVolumes []containerinstance.Volume) ([]containerinstance.Volume, error) { @@ -1184,12 +1256,12 @@ func expandContainerVolume(v interface{}, addedEmptyDirs map[string]bool, contai if containerVolumes != nil { for _, cgVol := range *containerVolumes { if cgVol.EmptyDir != nil { - if addedEmptyDirs[*cgVol.Name] { + if addedEmptyDirs[cgVol.Name] { // empty_dir-volumes are allowed to overlap across containers, in fact that is their primary purpose, // but the containerGroup must not declare same name of such volumes twice. continue } - addedEmptyDirs[*cgVol.Name] = true + addedEmptyDirs[cgVol.Name] = true } containerGroupVolumes = append(containerGroupVolumes, cgVol) } @@ -1204,8 +1276,8 @@ func expandContainerEnvironmentVariables(input interface{}, secure bool) *[]cont if secure { for k, v := range envVars { ev := containerinstance.EnvironmentVariable{ - Name: utils.String(k), - SecureValue: utils.String(v.(string)), + Name: k, + SecureValue: pointer.FromString(v.(string)), } output = append(output, ev) @@ -1213,8 +1285,8 @@ func expandContainerEnvironmentVariables(input interface{}, secure bool) *[]cont } else { for k, v := range envVars { ev := containerinstance.EnvironmentVariable{ - Name: utils.String(k), - Value: utils.String(v.(string)), + Name: k, + Value: pointer.FromString(v.(string)), } output = append(output, ev) @@ -1223,27 +1295,6 @@ func expandContainerEnvironmentVariables(input interface{}, secure bool) *[]cont return &output } -func expandContainerGroupIdentity(input []interface{}) (*containerinstance.ContainerGroupIdentity, error) { - expanded, err := identity.ExpandSystemAndUserAssignedMap(input) - if err != nil { - return nil, err - } - - out := containerinstance.ContainerGroupIdentity{ - Type: containerinstance.ResourceIdentityType(string(expanded.Type)), - } - if expanded.Type == identity.TypeUserAssigned || expanded.Type == identity.TypeSystemAssignedUserAssigned { - out.UserAssignedIdentities = make(map[string]*containerinstance.ContainerGroupIdentityUserAssignedIdentitiesValue) - for k := range expanded.IdentityIds { - out.UserAssignedIdentities[k] = &containerinstance.ContainerGroupIdentityUserAssignedIdentitiesValue{ - // intentionally empty - } - } - } - - return &out, nil -} - func expandContainerImageRegistryCredentials(d *pluginsdk.ResourceData) *[]containerinstance.ImageRegistryCredential { credsRaw := d.Get("image_registry_credential").([]interface{}) if len(credsRaw) == 0 { @@ -1256,9 +1307,9 @@ func expandContainerImageRegistryCredentials(d *pluginsdk.ResourceData) *[]conta credConfig := c.(map[string]interface{}) output = append(output, containerinstance.ImageRegistryCredential{ - Server: utils.String(credConfig["server"].(string)), - Password: utils.String(credConfig["password"].(string)), - Username: utils.String(credConfig["username"].(string)), + Server: credConfig["server"].(string), + Password: pointer.FromString(credConfig["password"].(string)), + Username: credConfig["username"].(string), }) } @@ -1287,15 +1338,15 @@ func expandSingleContainerVolume(input interface{}) (*[]containerinstance.Volume storageAccountKey := volumeConfig["storage_account_key"].(string) vm := containerinstance.VolumeMount{ - Name: utils.String(name), - MountPath: utils.String(mountPath), - ReadOnly: utils.Bool(readOnly), + Name: name, + MountPath: mountPath, + ReadOnly: pointer.FromBool(readOnly), } volumeMounts = append(volumeMounts, vm) cv := containerinstance.Volume{ - Name: utils.String(name), + Name: name, } secret := expandSecrets(volumeConfig["secret"].(map[string]interface{})) @@ -1307,7 +1358,8 @@ func expandSingleContainerVolume(input interface{}) (*[]containerinstance.Volume if shareName != "" || storageAccountName != "" || storageAccountKey != "" || secret != nil || gitRepoVolume != nil { return nil, nil, fmt.Errorf("only one of `empty_dir` volume, `git_repo` volume, `secret` volume or storage account volume (`share_name`, `storage_account_name`, and `storage_account_key`) can be specified") } - cv.EmptyDir = map[string]string{} + var m interface{} = map[string]string{} + cv.EmptyDir = &m case gitRepoVolume != nil: if shareName != "" || storageAccountName != "" || storageAccountKey != "" || secret != nil { return nil, nil, fmt.Errorf("only one of `empty_dir` volume, `git_repo` volume, `secret` volume or storage account volume (`share_name`, `storage_account_name`, and `storage_account_key`) can be specified") @@ -1317,7 +1369,7 @@ func expandSingleContainerVolume(input interface{}) (*[]containerinstance.Volume if shareName != "" || storageAccountName != "" || storageAccountKey != "" { return nil, nil, fmt.Errorf("only one of `empty_dir` volume, `git_repo` volume, `secret` volume or storage account volume (`share_name`, `storage_account_name`, and `storage_account_key`) can be specified") } - cv.Secret = secret + cv.Secret = &secret default: if shareName == "" && storageAccountName == "" && storageAccountKey == "" { return nil, nil, fmt.Errorf("only one of `empty_dir` volume, `git_repo` volume, `secret` volume or storage account volume (`share_name`, `storage_account_name`, and `storage_account_key`) can be specified") @@ -1325,10 +1377,10 @@ func expandSingleContainerVolume(input interface{}) (*[]containerinstance.Volume return nil, nil, fmt.Errorf("when using a storage account volume, all of `share_name`, `storage_account_name`, `storage_account_key` must be specified") } cv.AzureFile = &containerinstance.AzureFileVolume{ - ShareName: utils.String(shareName), - ReadOnly: utils.Bool(readOnly), - StorageAccountName: utils.String(storageAccountName), - StorageAccountKey: utils.String(storageAccountKey), + ShareName: shareName, + ReadOnly: pointer.FromBool(readOnly), + StorageAccountName: storageAccountName, + StorageAccountKey: pointer.FromString(storageAccountKey), } } @@ -1344,25 +1396,25 @@ func expandGitRepoVolume(input []interface{}) *containerinstance.GitRepoVolume { } v := input[0].(map[string]interface{}) gitRepoVolume := &containerinstance.GitRepoVolume{ - Repository: utils.String(v["url"].(string)), + Repository: v["url"].(string), } if directory := v["directory"].(string); directory != "" { - gitRepoVolume.Directory = utils.String(directory) + gitRepoVolume.Directory = pointer.FromString(directory) } if revision := v["revision"].(string); revision != "" { - gitRepoVolume.Revision = utils.String(revision) + gitRepoVolume.Revision = pointer.FromString(revision) } return gitRepoVolume } -func expandSecrets(secretsMap map[string]interface{}) map[string]*string { +func expandSecrets(secretsMap map[string]interface{}) map[string]string { if len(secretsMap) == 0 { return nil } - output := make(map[string]*string, len(secretsMap)) + output := make(map[string]string, len(secretsMap)) for name, value := range secretsMap { - output[name] = utils.String(value.(string)) + output[name] = value.(string) } return output @@ -1383,23 +1435,23 @@ func expandContainerProbe(input interface{}) *containerinstance.ContainerProbe { probeConfig := p.(map[string]interface{}) if v := probeConfig["initial_delay_seconds"].(int); v > 0 { - probe.InitialDelaySeconds = utils.Int32(int32(v)) + probe.InitialDelaySeconds = pointer.FromInt64(int64(v)) } if v := probeConfig["period_seconds"].(int); v > 0 { - probe.PeriodSeconds = utils.Int32(int32(v)) + probe.PeriodSeconds = pointer.FromInt64(int64(v)) } if v := probeConfig["failure_threshold"].(int); v > 0 { - probe.FailureThreshold = utils.Int32(int32(v)) + probe.FailureThreshold = pointer.FromInt64(int64(v)) } if v := probeConfig["success_threshold"].(int); v > 0 { - probe.SuccessThreshold = utils.Int32(int32(v)) + probe.SuccessThreshold = pointer.FromInt64(int64(v)) } if v := probeConfig["timeout_seconds"].(int); v > 0 { - probe.TimeoutSeconds = utils.Int32(int32(v)) + probe.TimeoutSeconds = pointer.FromInt64(int64(v)) } commands := probeConfig["exec"].([]interface{}) @@ -1422,10 +1474,12 @@ func expandContainerProbe(input interface{}) *containerinstance.ContainerProbe { port := x["port"].(int) scheme := x["scheme"].(string) - probe.HTTPGet = &containerinstance.ContainerHTTPGet{ - Path: utils.String(path), - Port: utils.Int32(int32(port)), - Scheme: containerinstance.Scheme(scheme), + httpGetScheme := containerinstance.Scheme(scheme) + probe.HttpGet = &containerinstance.ContainerHttpGet{ + Path: pointer.FromString(path), + Port: int64(port), + Scheme: &httpGetScheme, + HttpHeaders: expandContainerProbeHttpHeaders(x["http_headers"].(map[string]interface{})), } } } @@ -1433,29 +1487,40 @@ func expandContainerProbe(input interface{}) *containerinstance.ContainerProbe { return &probe } -func flattenContainerGroupIdentity(input *containerinstance.ContainerGroupIdentity) (*[]interface{}, error) { - var transform *identity.SystemAndUserAssignedMap +func expandContainerProbeHttpHeaders(input map[string]interface{}) *[]containerinstance.HttpHeader { + if len(input) == 0 { + return nil + } - if input != nil { - transform = &identity.SystemAndUserAssignedMap{ - Type: identity.Type(string(input.Type)), - IdentityIds: make(map[string]identity.UserAssignedIdentityDetails), - } - if input.PrincipalID != nil { - transform.PrincipalId = *input.PrincipalID + headers := []containerinstance.HttpHeader{} + for k, v := range input { + header := containerinstance.HttpHeader{ + Name: pointer.FromString(k), + Value: pointer.FromString(v.(string)), } - if input.TenantID != nil { - transform.TenantId = *input.TenantID + headers = append(headers, header) + } + return &headers +} + +func flattenContainerProbeHttpHeaders(input *[]containerinstance.HttpHeader) map[string]interface{} { + if input == nil { + return nil + } + + output := map[string]interface{}{} + for _, header := range *input { + name := "" + if header.Name != nil { + name = *header.Name } - for k, v := range input.UserAssignedIdentities { - transform.IdentityIds[k] = identity.UserAssignedIdentityDetails{ - ClientId: v.ClientID, - PrincipalId: v.PrincipalID, - } + value := "" + if header.Value != nil { + value = *header.Value } + output[name] = value } - - return identity.FlattenSystemAndUserAssignedMap(transform) + return output } func flattenContainerImageRegistryCredentials(d *pluginsdk.ResourceData, input *[]containerinstance.ImageRegistryCredential) []interface{} { @@ -1467,17 +1532,13 @@ func flattenContainerImageRegistryCredentials(d *pluginsdk.ResourceData, input * output := make([]interface{}, 0) for i, cred := range *input { credConfig := make(map[string]interface{}) - if cred.Server != nil { - credConfig["server"] = *cred.Server - } - if cred.Username != nil { - credConfig["username"] = *cred.Username - } + credConfig["server"] = cred.Server + credConfig["username"] = cred.Username if len(configsOld) > i { data := configsOld[i].(map[string]interface{}) oldServer := data["server"].(string) - if cred.Server != nil && *cred.Server == oldServer { + if cred.Server == oldServer { if v, ok := d.GetOk(fmt.Sprintf("image_registry_credential.%d.password", i)); ok { credConfig["password"] = v.(string) } @@ -1502,8 +1563,7 @@ func flattenContainerGroupInitContainers(d *pluginsdk.ResourceData, initContaine containerCfg := make([]interface{}, 0, len(*initContainers)) for _, container := range *initContainers { - // TODO fix this crash point - name := *container.Name + name := container.Name // get index from name index := nameIndexMap[name] @@ -1511,26 +1571,26 @@ func flattenContainerGroupInitContainers(d *pluginsdk.ResourceData, initContaine containerConfig := make(map[string]interface{}) containerConfig["name"] = name - if v := container.Image; v != nil { + if v := container.Properties.Image; v != nil { containerConfig["image"] = *v } - if container.EnvironmentVariables != nil { - if len(*container.EnvironmentVariables) > 0 { - containerConfig["environment_variables"] = flattenContainerEnvironmentVariables(container.EnvironmentVariables, false, d, index) - containerConfig["secure_environment_variables"] = flattenContainerEnvironmentVariables(container.EnvironmentVariables, true, d, index) + if container.Properties.EnvironmentVariables != nil { + if len(*container.Properties.EnvironmentVariables) > 0 { + containerConfig["environment_variables"] = flattenContainerEnvironmentVariables(container.Properties.EnvironmentVariables, false, d, index) + containerConfig["secure_environment_variables"] = flattenContainerEnvironmentVariables(container.Properties.EnvironmentVariables, true, d, index) } } commands := make([]string, 0) - if command := container.Command; command != nil { + if command := container.Properties.Command; command != nil { commands = *command } containerConfig["commands"] = commands - if containerGroupVolumes != nil && container.VolumeMounts != nil { + if containerGroupVolumes != nil && container.Properties.VolumeMounts != nil { containersConfigRaw := d.Get("container").([]interface{}) - flattenContainerVolume(containerConfig, containersConfigRaw, *container.Name, container.VolumeMounts, containerGroupVolumes) + flattenContainerVolume(containerConfig, containersConfigRaw, container.Name, container.Properties.VolumeMounts, containerGroupVolumes) } containerCfg = append(containerCfg, containerConfig) } @@ -1548,8 +1608,7 @@ func flattenContainerGroupContainers(d *pluginsdk.ResourceData, containers *[]co containerCfg := make([]interface{}, 0, len(*containers)) for _, container := range *containers { - // TODO fix this crash point - name := *container.Name + name := container.Name // get index from name index := nameIndexMap[name] @@ -1557,58 +1616,68 @@ func flattenContainerGroupContainers(d *pluginsdk.ResourceData, containers *[]co containerConfig := make(map[string]interface{}) containerConfig["name"] = name - if v := container.Image; v != nil { - containerConfig["image"] = *v + containerConfig["image"] = container.Properties.Image + + resources := container.Properties.Resources + resourceRequests := resources.Requests + containerConfig["cpu"] = resourceRequests.Cpu + containerConfig["memory"] = resourceRequests.MemoryInGB + + gpus := make([]interface{}, 0) + if v := resourceRequests.Gpu; v != nil { + gpu := make(map[string]interface{}) + gpu["count"] = v.Count + gpu["sku"] = string(v.Sku) + gpus = append(gpus, gpu) } + containerConfig["gpu"] = gpus - if resources := container.Resources; resources != nil { - if resourceRequests := resources.Requests; resourceRequests != nil { - if v := resourceRequests.CPU; v != nil { - containerConfig["cpu"] = *v - } - if v := resourceRequests.MemoryInGB; v != nil { - containerConfig["memory"] = *v - } + if resourceLimits := resources.Limits; resourceLimits != nil { + if v := resourceLimits.Cpu; v != nil { + containerConfig["cpu_limit"] = *v + } + if v := resourceLimits.MemoryInGB; v != nil { + containerConfig["memory_limit"] = *v + } - gpus := make([]interface{}, 0) - if v := resourceRequests.Gpu; v != nil { - gpu := make(map[string]interface{}) - if v.Count != nil { - gpu["count"] = *v.Count - } - gpu["sku"] = string(v.Sku) - gpus = append(gpus, gpu) - } - containerConfig["gpu"] = gpus + gpus := make([]interface{}, 0) + if v := resourceLimits.Gpu; v != nil { + gpu := make(map[string]interface{}) + gpu["count"] = v.Count + gpu["sku"] = string(v.Sku) + gpus = append(gpus, gpu) } + containerConfig["gpu_limit"] = gpus } - containerPorts := make([]interface{}, len(*container.Ports)) - for i := range *container.Ports { - containerPorts[i] = (*container.Ports)[i] + containerPorts := make([]interface{}, len(*container.Properties.Ports)) + if container.Properties.Ports != nil { + for i := range *container.Properties.Ports { + containerPorts[i] = (*container.Properties.Ports)[i] + } } containerConfig["ports"] = flattenPorts(containerPorts) - if container.EnvironmentVariables != nil { - if len(*container.EnvironmentVariables) > 0 { - containerConfig["environment_variables"] = flattenContainerEnvironmentVariables(container.EnvironmentVariables, false, d, index) - containerConfig["secure_environment_variables"] = flattenContainerEnvironmentVariables(container.EnvironmentVariables, true, d, index) + if container.Properties.EnvironmentVariables != nil { + if len(*container.Properties.EnvironmentVariables) > 0 { + containerConfig["environment_variables"] = flattenContainerEnvironmentVariables(container.Properties.EnvironmentVariables, false, d, index) + containerConfig["secure_environment_variables"] = flattenContainerEnvironmentVariables(container.Properties.EnvironmentVariables, true, d, index) } } commands := make([]string, 0) - if command := container.Command; command != nil { + if command := container.Properties.Command; command != nil { commands = *command } containerConfig["commands"] = commands - if containerGroupVolumes != nil && container.VolumeMounts != nil { + if containerGroupVolumes != nil && container.Properties.VolumeMounts != nil { containersConfigRaw := d.Get("container").([]interface{}) - flattenContainerVolume(containerConfig, containersConfigRaw, *container.Name, container.VolumeMounts, containerGroupVolumes) + flattenContainerVolume(containerConfig, containersConfigRaw, container.Name, container.Properties.VolumeMounts, containerGroupVolumes) } - containerConfig["liveness_probe"] = flattenContainerProbes(container.LivenessProbe) - containerConfig["readiness_probe"] = flattenContainerProbes(container.ReadinessProbe) + containerConfig["liveness_probe"] = flattenContainerProbes(container.Properties.LivenessProbe) + containerConfig["readiness_probe"] = flattenContainerProbes(container.Properties.ReadinessProbe) containerCfg = append(containerCfg, containerConfig) } @@ -1640,12 +1709,8 @@ func flattenContainerVolume(containerConfig map[string]interface{}, containersCo for _, vm := range *volumeMounts { volumeConfig := make(map[string]interface{}) - if vm.Name != nil { - volumeConfig["name"] = *vm.Name - } - if vm.MountPath != nil { - volumeConfig["mount_path"] = *vm.MountPath - } + volumeConfig["name"] = vm.Name + volumeConfig["mount_path"] = vm.MountPath if vm.ReadOnly != nil { volumeConfig["read_only"] = *vm.ReadOnly } @@ -1654,18 +1719,10 @@ func flattenContainerVolume(containerConfig map[string]interface{}, containersCo // and use the data if containerGroupVolumes != nil { for _, cgv := range *containerGroupVolumes { - if cgv.Name == nil || vm.Name == nil { - continue - } - - if *cgv.Name == *vm.Name { + if cgv.Name == vm.Name { if file := cgv.AzureFile; file != nil { - if file.ShareName != nil { - volumeConfig["share_name"] = *file.ShareName - } - if file.StorageAccountName != nil { - volumeConfig["storage_account_name"] = *file.StorageAccountName - } + volumeConfig["share_name"] = file.ShareName + volumeConfig["storage_account_name"] = file.StorageAccountName // skip storage_account_key, is always nil } @@ -1684,7 +1741,7 @@ func flattenContainerVolume(containerConfig map[string]interface{}, containersCo for _, cvr := range *containerVolumesConfig { cv := cvr.(map[string]interface{}) rawName := cv["name"].(string) - if vm.Name != nil && *vm.Name == rawName { + if vm.Name == rawName { storageAccountKey := cv["storage_account_key"].(string) volumeConfig["storage_account_key"] = storageAccountKey volumeConfig["secret"] = cv["secret"] @@ -1707,16 +1764,16 @@ func flattenContainerEnvironmentVariables(input *[]containerinstance.Environment if isSecure { for _, envVar := range *input { - if envVar.Name != nil && envVar.Value == nil { - envVarValue := d.Get(fmt.Sprintf("container.%d.secure_environment_variables.%s", oldContainerIndex, *envVar.Name)) - output[*envVar.Name] = envVarValue + if envVar.Value == nil { + envVarValue := d.Get(fmt.Sprintf("container.%d.secure_environment_variables.%s", oldContainerIndex, envVar.Name)) + output[envVar.Name] = envVarValue } } } else { for _, envVar := range *input { - if envVar.Name != nil && envVar.Value != nil { - log.Printf("[DEBUG] NOT SECURE: Name: %s - Value: %s", *envVar.Name, *envVar.Value) - output[*envVar.Name] = *envVar.Value + if envVar.Value != nil { + log.Printf("[DEBUG] NOT SECURE: Name: %s - Value: %s", envVar.Name, *envVar.Value) + output[envVar.Name] = *envVar.Value } } } @@ -1735,9 +1792,7 @@ func flattenGitRepoVolume(input *containerinstance.GitRepoVolume) []interface{} if input.Revision != nil { revision = *input.Revision } - if input.Repository != nil { - repository = *input.Repository - } + repository = input.Repository return []interface{}{ map[string]interface{}{ "url": repository, @@ -1760,21 +1815,14 @@ func flattenContainerProbes(input *containerinstance.ContainerProbe) []interface } httpGets := make([]interface{}, 0) - if get := input.HTTPGet; get != nil { + if get := input.HttpGet; get != nil { httpGet := make(map[string]interface{}) - if v := get.Path; v != nil { httpGet["path"] = *v } - - if v := get.Port; v != nil { - httpGet["port"] = *v - } - - if get.Scheme != "" { - httpGet["scheme"] = get.Scheme - } - + httpGet["port"] = get.Port + httpGet["scheme"] = get.Scheme + httpGet["http_headers"] = flattenContainerProbeHttpHeaders(get.HttpHeaders) httpGets = append(httpGets, httpGet) } output["http_get"] = httpGets @@ -1817,21 +1865,22 @@ func expandContainerGroupDiagnostics(input []interface{}) *containerinstance.Con workspaceKey := analyticsV["workspace_key"].(string) logAnalytics := containerinstance.LogAnalytics{ - WorkspaceID: utils.String(workspaceId), - WorkspaceKey: utils.String(workspaceKey), + WorkspaceId: workspaceId, + WorkspaceKey: workspaceKey, } if logType := analyticsV["log_type"].(string); logType != "" { - logAnalytics.LogType = containerinstance.LogAnalyticsLogType(logType) + t := containerinstance.LogAnalyticsLogType(logType) + logAnalytics.LogType = &t metadataMap := analyticsV["metadata"].(map[string]interface{}) - metadata := make(map[string]*string) + metadata := make(map[string]string) for k, v := range metadataMap { strValue := v.(string) - metadata[k] = &strValue + metadata[k] = strValue } - logAnalytics.Metadata = metadata + logAnalytics.Metadata = &metadata } return &containerinstance.ContainerGroupDiagnostics{LogAnalytics: &logAnalytics} @@ -1847,17 +1896,20 @@ func flattenContainerGroupDiagnostics(d *pluginsdk.ResourceData, input *containe if la := input.LogAnalytics; la != nil { output := make(map[string]interface{}) - output["log_type"] = string(la.LogType) + logType := "" + if la.LogType != nil { + logType = string(*la.LogType) + } + output["log_type"] = logType metadata := make(map[string]interface{}) - for k, v := range la.Metadata { - metadata[k] = *v + if la.Metadata != nil { + for k, v := range *la.Metadata { + metadata[k] = v + } } output["metadata"] = metadata - - if la.WorkspaceID != nil { - output["workspace_id"] = *la.WorkspaceID - } + output["workspace_id"] = la.WorkspaceId // the existing config may not exist at Import time, protect against it. workspaceKey := "" @@ -1893,7 +1945,7 @@ func resourceContainerGroupPortsHash(v interface{}) int { return pluginsdk.HashString(buf.String()) } -func flattenContainerGroupDnsConfig(input *containerinstance.DNSConfiguration) []interface{} { +func flattenContainerGroupDnsConfig(input *containerinstance.DnsConfiguration) []interface{} { output := make(map[string]interface{}) if input == nil { @@ -1913,18 +1965,12 @@ func flattenContainerGroupDnsConfig(input *containerinstance.DNSConfiguration) [ options = strings.Fields(*input.Options) } output["options"] = options - - // Nameservers is already an array from the API - var nameservers []string - if input.NameServers != nil { - nameservers = *input.NameServers - } - output["nameservers"] = nameservers + output["nameservers"] = input.NameServers return []interface{}{output} } -func expandContainerGroupDnsConfig(input interface{}) *containerinstance.DNSConfiguration { +func expandContainerGroupDnsConfig(input interface{}) *containerinstance.DnsConfiguration { dnsConfigRaw := input.([]interface{}) if len(dnsConfigRaw) > 0 { config := dnsConfigRaw[0].(map[string]interface{}) @@ -1942,10 +1988,10 @@ func expandContainerGroupDnsConfig(input interface{}) *containerinstance.DNSConf searchDomains = append(searchDomains, v.(string)) } - return &containerinstance.DNSConfiguration{ - Options: utils.String(strings.Join(options, " ")), - SearchDomains: utils.String(strings.Join(searchDomains, " ")), - NameServers: &nameservers, + return &containerinstance.DnsConfiguration{ + Options: pointer.FromString(strings.Join(options, " ")), + SearchDomains: pointer.FromString(strings.Join(searchDomains, " ")), + NameServers: nameservers, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/container_registry_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/container_registry_data_source.go index e6a5e470c74..dfc47c4d0bc 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/container_registry_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/container_registry_data_source.go @@ -53,6 +53,7 @@ func dataSourceContainerRegistryRead(d *pluginsdk.ResourceData, meta interface{} if props := resp.RegistryProperties; props != nil { d.Set("admin_enabled", resp.AdminUserEnabled) d.Set("login_server", resp.LoginServer) + d.Set("data_endpoint_enabled", props.DataEndpointEnabled) } if sku := resp.Sku; sku != nil { @@ -105,6 +106,11 @@ func dataSourceContainerRegistrySchema() map[string]*pluginsdk.Schema { Computed: true, }, + "data_endpoint_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "login_server": { Type: pluginsdk.TypeString, Computed: true, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_addons.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_addons.go index 59b6307c8a5..b99aca774c9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_addons.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_addons.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice" + "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice" "github.com/Azure/go-autorest/autorest/azure" commonValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" containerValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/validate" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_data_source.go index df9712f3610..d2e5131835a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_data_source.go @@ -5,7 +5,8 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice" + "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" @@ -14,7 +15,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes" "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse" laparse "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/parse" - msiparse "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -1121,7 +1121,7 @@ func flattenKubernetesClusterDataSourceIdentityProfile(profile map[string]*conta userAssignedIdentityId := "" if resourceid := kubeletidentity.ResourceID; resourceid != nil { - parsedId, err := msiparse.UserAssignedIdentityIDInsensitively(*resourceid) + parsedId, err := commonids.ParseUserAssignedIdentityIDInsensitively(*resourceid) if err != nil { return nil, err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_node_pool_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_node_pool_data_source.go index abfe5bf865a..8b0e38ba852 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_node_pool_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_node_pool_data_source.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice" + "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_node_pool_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_node_pool_resource.go index ad5fa953d21..611a67904d0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_node_pool_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_node_pool_resource.go @@ -6,9 +6,10 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice" + "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" @@ -80,7 +81,21 @@ func resourceKubernetesClusterNodePool() *pluginsdk.Resource { ValidateFunc: validation.StringIsNotEmpty, }, + "host_group_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: computeValidate.HostGroupID, + }, + // Optional + "capacity_reservation_group_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: computeValidate.CapacityReservationGroupID, + }, + "enable_auto_scaling": { Type: pluginsdk.TypeBool, Optional: true, @@ -255,7 +270,7 @@ func resourceKubernetesClusterNodePool() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ForceNew: true, - ValidateFunc: computeValidate.ProximityPlacementGroupID, + ValidateFunc: proximityplacementgroups.ValidateProximityPlacementGroupID, }, "spot_max_price": { @@ -461,6 +476,14 @@ func resourceKubernetesClusterNodePoolCreate(d *pluginsdk.ResourceData, meta int profile.VnetSubnetID = utils.String(vnetSubnetID) } + if hostGroupID := d.Get("host_group_id").(string); hostGroupID != "" { + profile.HostGroupID = utils.String(hostGroupID) + } + + if capacityReservationGroupId := d.Get("capacity_reservation_group_id").(string); capacityReservationGroupId != "" { + profile.CapacityReservationGroupID = utils.String(capacityReservationGroupId) + } + maxCount := d.Get("max_count").(int) minCount := d.Get("min_count").(int) @@ -827,6 +850,8 @@ func resourceKubernetesClusterNodePoolRead(d *pluginsdk.ResourceData, meta inter d.Set("vnet_subnet_id", props.VnetSubnetID) d.Set("vm_size", props.VMSize) + d.Set("host_group_id", props.HostGroupID) + d.Set("capacity_reservation_group_id", props.CapacityReservationGroupID) if err := d.Set("upgrade_settings", flattenUpgradeSettings(props.UpgradeSettings)); err != nil { return fmt.Errorf("setting `upgrade_settings`: %+v", err) @@ -846,7 +871,9 @@ func resourceKubernetesClusterNodePoolDelete(d *pluginsdk.ResourceData, meta int return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ManagedClusterName, id.AgentPoolName) + ignorePodDisruptionBudget := true + + future, err := client.Delete(ctx, id.ResourceGroup, id.ManagedClusterName, id.AgentPoolName, &ignorePodDisruptionBudget) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_resource.go index 1c1d2e194cd..9c796f5e9d0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_resource.go @@ -8,10 +8,12 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice" + "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice" "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" @@ -23,9 +25,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse" containerValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/validate" logAnalyticsValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/validate" - msiparse "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/parse" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -279,7 +278,7 @@ func resourceKubernetesCluster() *pluginsdk.Resource { "kubelet_identity.0.object_id", "identity.0.identity_ids", }, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, }, }, @@ -1723,12 +1722,7 @@ func resourceKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{}) d.Set("private_fqdn", props.PrivateFQDN) d.Set("portal_fqdn", props.AzurePortalFQDN) d.Set("disk_encryption_set_id", props.DiskEncryptionSetID) - // CurrentKubernetesVersion contains the actual version the Managed Cluster is running after upgrading - // KubernetesVersion now seems to contain the initial version the cluster was created with d.Set("kubernetes_version", props.KubernetesVersion) - if v := props.CurrentKubernetesVersion; v != nil { - d.Set("kubernetes_version", v) - } d.Set("node_resource_group", props.NodeResourceGroup) d.Set("enable_pod_security_policy", props.EnablePodSecurityPolicy) d.Set("local_account_disabled", props.DisableLocalAccounts) @@ -1911,7 +1905,9 @@ func resourceKubernetesClusterDelete(d *pluginsdk.ResourceData, meta interface{} } } - future, err := client.Delete(ctx, id.ResourceGroup, id.ManagedClusterName) + ignorePodDisruptionBudget := true + + future, err := client.Delete(ctx, id.ResourceGroup, id.ManagedClusterName, &ignorePodDisruptionBudget) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } @@ -2016,7 +2012,7 @@ func flattenKubernetesClusterIdentityProfile(profile map[string]*containerservic userAssignedIdentityId := "" if resourceid := kubeletidentity.ResourceID; resourceid != nil { - parsedId, err := msiparse.UserAssignedIdentityIDInsensitively(*resourceid) + parsedId, err := commonids.ParseUserAssignedIdentityIDInsensitively(*resourceid) if err != nil { return nil, err } @@ -2907,7 +2903,9 @@ func expandKubernetesClusterHttpProxyConfig(input []interface{}) *containerservi httpProxyConfig.HTTPProxy = utils.String(config["http_proxy"].(string)) httpProxyConfig.HTTPSProxy = utils.String(config["https_proxy"].(string)) - httpProxyConfig.TrustedCa = utils.String(config["trusted_ca"].(string)) + if value := config["trusted_ca"].(string); len(value) != 0 { + httpProxyConfig.TrustedCa = utils.String(value) + } noProxyRaw := config["no_proxy"].(*pluginsdk.Set).List() httpProxyConfig.NoProxy = utils.ExpandStringSlice(noProxyRaw) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_validate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_validate.go index d5e5db25579..b40d95ef479 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_validate.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_cluster_validate.go @@ -6,7 +6,7 @@ import ( "net/http" "strings" - "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice" + "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice" "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/client" "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -272,8 +272,10 @@ func validateNodePoolSupportsVersion(ctx context.Context, client *client.Client, continue } - supportedVersions = append(supportedVersions, *version.KubernetesVersion) - if *version.KubernetesVersion == desiredNodePoolVersion { + v := *version.KubernetesVersion + supportedVersions = append(supportedVersions, v) + // alias versions (major.minor) are also fine as the latest supported GA patch version is chosen automatically in this case + if v == desiredNodePoolVersion || v[:strings.LastIndex(v, ".")] == desiredNodePoolVersion { versionExists = true } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_nodepool.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_nodepool.go index 18d2cfe1e20..3171c321bc1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_nodepool.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/kubernetes_nodepool.go @@ -6,7 +6,9 @@ import ( "strconv" "strings" - "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups" + + "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -54,6 +56,13 @@ func SchemaDefaultNodePool() *pluginsdk.Schema { ValidateFunc: validation.StringIsNotEmpty, }, + "capacity_reservation_group_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: computeValidate.CapacityReservationGroupID, + }, + // TODO 4.0: change this from enable_* to *_enabled "enable_auto_scaling": { Type: pluginsdk.TypeBool, @@ -209,7 +218,7 @@ func SchemaDefaultNodePool() *pluginsdk.Schema { Type: pluginsdk.TypeString, Optional: true, ForceNew: true, - ValidateFunc: computeValidate.ProximityPlacementGroupID, + ValidateFunc: proximityplacementgroups.ValidateProximityPlacementGroupID, }, "only_critical_addons_enabled": { Type: pluginsdk.TypeBool, @@ -217,6 +226,13 @@ func SchemaDefaultNodePool() *pluginsdk.Schema { ForceNew: true, }, + "host_group_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: computeValidate.HostGroupID, + }, + "upgrade_settings": upgradeSettingsSchema(), } @@ -701,6 +717,10 @@ func ExpandDefaultNodePool(d *pluginsdk.ResourceData) (*[]containerservice.Manag profile.VnetSubnetID = utils.String(vnetSubnetID) } + if hostGroupID := raw["host_group_id"].(string); hostGroupID != "" { + profile.HostGroupID = utils.String(hostGroupID) + } + if orchestratorVersion := raw["orchestrator_version"].(string); orchestratorVersion != "" { profile.OrchestratorVersion = utils.String(orchestratorVersion) } @@ -709,6 +729,10 @@ func ExpandDefaultNodePool(d *pluginsdk.ResourceData) (*[]containerservice.Manag profile.ProximityPlacementGroupID = utils.String(proximityPlacementGroupId) } + if capacityReservationGroupId := raw["capacity_reservation_group_id"].(string); capacityReservationGroupId != "" { + profile.CapacityReservationGroupID = utils.String(capacityReservationGroupId) + } + count := raw["node_count"].(int) maxCount := raw["max_count"].(int) minCount := raw["min_count"].(int) @@ -1041,6 +1065,11 @@ func FlattenDefaultNodePool(input *[]containerservice.ManagedClusterAgentPoolPro vnetSubnetId = *agentPool.VnetSubnetID } + hostGroupID := "" + if agentPool.HostGroupID != nil { + hostGroupID = *agentPool.HostGroupID + } + orchestratorVersion := "" if agentPool.OrchestratorVersion != nil { orchestratorVersion = *agentPool.OrchestratorVersion @@ -1055,6 +1084,10 @@ func FlattenDefaultNodePool(input *[]containerservice.ManagedClusterAgentPoolPro if agentPool.VMSize != nil { vmSize = *agentPool.VMSize } + capacityReservationGroupId := "" + if agentPool.CapacityReservationGroupID != nil { + capacityReservationGroupId = *agentPool.CapacityReservationGroupID + } upgradeSettings := flattenUpgradeSettings(agentPool.UpgradeSettings) linuxOSConfig, err := flattenAgentPoolLinuxOSConfig(agentPool.LinuxOSConfig) @@ -1063,35 +1096,37 @@ func FlattenDefaultNodePool(input *[]containerservice.ManagedClusterAgentPoolPro } out := map[string]interface{}{ - "enable_auto_scaling": enableAutoScaling, - "enable_node_public_ip": enableNodePublicIP, - "enable_host_encryption": enableHostEncryption, - "fips_enabled": enableFIPS, - "kubelet_disk_type": string(agentPool.KubeletDiskType), - "max_count": maxCount, - "max_pods": maxPods, - "min_count": minCount, - "name": name, - "node_count": count, - "node_labels": nodeLabels, - "node_public_ip_prefix_id": nodePublicIPPrefixID, - "node_taints": []string{}, - "os_disk_size_gb": osDiskSizeGB, - "os_disk_type": string(osDiskType), - "os_sku": string(agentPool.OsSKU), - "tags": tags.Flatten(agentPool.Tags), - "type": string(agentPool.Type), - "ultra_ssd_enabled": enableUltraSSD, - "vm_size": vmSize, - "pod_subnet_id": podSubnetId, - "orchestrator_version": orchestratorVersion, - "proximity_placement_group_id": proximityPlacementGroupId, - "upgrade_settings": upgradeSettings, - "vnet_subnet_id": vnetSubnetId, - "only_critical_addons_enabled": criticalAddonsEnabled, - "kubelet_config": flattenAgentPoolKubeletConfig(agentPool.KubeletConfig), - "linux_os_config": linuxOSConfig, - "zones": zones.Flatten(agentPool.AvailabilityZones), + "enable_auto_scaling": enableAutoScaling, + "enable_node_public_ip": enableNodePublicIP, + "enable_host_encryption": enableHostEncryption, + "fips_enabled": enableFIPS, + "host_group_id": hostGroupID, + "kubelet_disk_type": string(agentPool.KubeletDiskType), + "max_count": maxCount, + "max_pods": maxPods, + "min_count": minCount, + "name": name, + "node_count": count, + "node_labels": nodeLabels, + "node_public_ip_prefix_id": nodePublicIPPrefixID, + "node_taints": []string{}, + "os_disk_size_gb": osDiskSizeGB, + "os_disk_type": string(osDiskType), + "os_sku": string(agentPool.OsSKU), + "tags": tags.Flatten(agentPool.Tags), + "type": string(agentPool.Type), + "ultra_ssd_enabled": enableUltraSSD, + "vm_size": vmSize, + "pod_subnet_id": podSubnetId, + "orchestrator_version": orchestratorVersion, + "proximity_placement_group_id": proximityPlacementGroupId, + "upgrade_settings": upgradeSettings, + "vnet_subnet_id": vnetSubnetId, + "only_critical_addons_enabled": criticalAddonsEnabled, + "kubelet_config": flattenAgentPoolKubeletConfig(agentPool.KubeletConfig), + "linux_os_config": linuxOSConfig, + "zones": zones.Flatten(agentPool.AvailabilityZones), + "capacity_reservation_group_id": capacityReservationGroupId, } return &[]interface{}{ diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse/container_group.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse/container_group.go deleted file mode 100644 index 8b531bdf208..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse/container_group.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ContainerGroupId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewContainerGroupID(subscriptionId, resourceGroup, name string) ContainerGroupId { - return ContainerGroupId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ContainerGroupId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Container Group", segmentsStr) -} - -func (id ContainerGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ContainerInstance/containerGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ContainerGroupID parses a ContainerGroup ID into an ContainerGroupId struct -func ContainerGroupID(input string) (*ContainerGroupId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ContainerGroupId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("containerGroups"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/probe.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/probe.go index b9ac2e7a45f..cddb1e44410 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/probe.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/probe.go @@ -53,6 +53,14 @@ func SchemaContainerGroupProbe() *pluginsdk.Schema { "Https", }, false), }, + "http_headers": { + Type: pluginsdk.TypeMap, + Optional: true, + ForceNew: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, }, }, }, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/resourceids.go index de37bee4a54..6e9486c5541 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/resourceids.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/resourceids.go @@ -3,7 +3,6 @@ package containers //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name ContainerRegistryAgentPool -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerRegistry/registries/registry1/agentPools/agent_pool1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Cluster -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerService/managedClusters/cluster1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NodePool -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerService/managedClusters/cluster1/agentPools/pool1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ContainerGroup -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerInstance/containerGroups/containerGroup1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ContainerRegistryScopeMap -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerRegistry/registries/registry1/scopeMaps/scopeMap1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ContainerRegistryTask -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.ContainerRegistry/registries/registry1/tasks/task1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ContainerRegistryToken -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ContainerRegistry/registries/registry1/tokens/token1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/validate/container_group_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/validate/container_group_id.go deleted file mode 100644 index c767bc2a334..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/validate/container_group_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/parse" -) - -func ContainerGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ContainerGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_account_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_account_data_source.go index 23cb7c0497f..c0482f713b0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_account_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_account_data_source.go @@ -227,7 +227,7 @@ func dataSourceCosmosDbAccountRead(d *pluginsdk.ResourceData, meta interface{}) if props := resp.DatabaseAccountGetProperties; props != nil { d.Set("offer_type", string(props.DatabaseAccountOfferType)) - d.Set("ip_range_filter", common.CosmosDBIpRulesToIpRangeFilter(props.IPRules)) + d.Set("ip_range_filter", common.CosmosDBIpRulesToIpRangeFilterThreePointOh(props.IPRules)) d.Set("endpoint", props.DocumentEndpoint) d.Set("is_virtual_network_filter_enabled", resp.IsVirtualNetworkFilterEnabled) d.Set("enable_free_tier", resp.EnableFreeTier) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_account_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_account_resource.go index 6670d766720..9802b91ade3 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_account_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_account_resource.go @@ -10,13 +10,12 @@ import ( "strings" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2021-10-15/documentdb" "github.com/Azure/go-autorest/autorest/date" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -1349,7 +1348,7 @@ func flattenAzureRmCosmosDBAccountGeoLocations(account *documentdb.DatabaseAccou locationSet := pluginsdk.Set{ F: resourceAzureRMCosmosDBAccountGeoLocationHash, } - if account == nil { + if account == nil || *account.FailoverPolicies == nil { return &locationSet } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_cassandra_cluster_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_cassandra_cluster_resource.go index 2a988f2f21f..eef97f9e351 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_cassandra_cluster_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_cassandra_cluster_resource.go @@ -292,10 +292,13 @@ func resourceCassandraClusterUpdate(d *pluginsdk.ResourceData, meta interface{}) } // Though there is update method but Service API complains it isn't implemented - _, err = client.CreateUpdate(ctx, id.ResourceGroup, id.Name, body) + future, err := client.CreateUpdate(ctx, id.ResourceGroup, id.Name, body) if err != nil { return fmt.Errorf("updating %q: %+v", id, err) } + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for update of %q: %+v", id, err) + } // Issue: https://github.com/Azure/azure-rest-api-specs/issues/19021 // There is a long running issue on updating this resource. diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_cassandra_datacenter_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_cassandra_datacenter_resource.go index f32ecef312e..e2cc64b701d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_cassandra_datacenter_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/cosmosdb_cassandra_datacenter_resource.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "log" - "strconv" "time" "github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2021-10-15/documentdb" @@ -16,6 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/validate" + keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -36,10 +36,10 @@ func resourceCassandraDatacenter() *pluginsdk.Resource { }), Timeouts: &pluginsdk.ResourceTimeout{ - Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Create: pluginsdk.DefaultTimeout(60 * time.Minute), Read: pluginsdk.DefaultTimeout(5 * time.Minute), - Update: pluginsdk.DefaultTimeout(30 * time.Minute), - Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + Update: pluginsdk.DefaultTimeout(60 * time.Minute), + Delete: pluginsdk.DefaultTimeout(60 * time.Minute), }, Schema: map[string]*pluginsdk.Schema{ @@ -66,6 +66,31 @@ func resourceCassandraDatacenter() *pluginsdk.Resource { ValidateFunc: networkValidate.SubnetID, }, + "backup_storage_customer_key_uri": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: keyVaultValidate.NestedItemId, + }, + + "base64_encoded_yaml_fragment": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "disk_sku": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "P30", + ValidateFunc: validation.StringIsNotEmpty, + }, + + "managed_disk_customer_key_uri": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: keyVaultValidate.NestedItemId, + }, + "node_count": { Type: pluginsdk.TypeInt, Optional: true, @@ -116,10 +141,23 @@ func resourceCassandraDatacenterCreate(d *pluginsdk.ResourceData, meta interface Sku: utils.String(d.Get("sku_name").(string)), AvailabilityZone: utils.Bool(d.Get("availability_zones_enabled").(bool)), DiskCapacity: utils.Int32(int32(d.Get("disk_count").(int))), + DiskSku: utils.String(d.Get("disk_sku").(string)), DataCenterLocation: utils.String(azure.NormalizeLocation(d.Get("location").(string))), }, } + if v, ok := d.GetOk("backup_storage_customer_key_uri"); ok { + body.Properties.BackupStorageCustomerKeyURI = utils.String(v.(string)) + } + + if v, ok := d.GetOk("base64_encoded_yaml_fragment"); ok { + body.Properties.Base64EncodedCassandraYamlFragment = utils.String(v.(string)) + } + + if v, ok := d.GetOk("managed_disk_customer_key_uri"); ok { + body.Properties.ManagedDiskCustomerKeyURI = utils.String(v.(string)) + } + future, err := client.CreateUpdate(ctx, id.ResourceGroup, id.CassandraClusterName, id.DataCenterName, body) if err != nil { return fmt.Errorf("creating %q: %+v", id, err) @@ -161,8 +199,12 @@ func resourceCassandraDatacenterRead(d *pluginsdk.ResourceData, meta interface{} if res := props; res != nil { d.Set("delegated_management_subnet_id", props.DelegatedSubnetID) d.Set("location", location.NormalizeNilable(props.DataCenterLocation)) + d.Set("backup_storage_customer_key_uri", props.BackupStorageCustomerKeyURI) + d.Set("base64_encoded_yaml_fragment", props.Base64EncodedCassandraYamlFragment) + d.Set("managed_disk_customer_key_uri", props.ManagedDiskCustomerKeyURI) d.Set("node_count", props.NodeCount) d.Set("disk_count", int(*props.DiskCapacity)) + d.Set("disk_sku", props.DiskSku) d.Set("sku_name", props.Sku) d.Set("availability_zones_enabled", props.AvailabilityZone) } @@ -185,9 +227,22 @@ func resourceCassandraDatacenterUpdate(d *pluginsdk.ResourceData, meta interface DelegatedSubnetID: utils.String(d.Get("delegated_management_subnet_id").(string)), NodeCount: utils.Int32(int32(d.Get("node_count").(int))), DataCenterLocation: utils.String(azure.NormalizeLocation(d.Get("location").(string))), + DiskSku: utils.String(d.Get("disk_sku").(string)), }, } + if v, ok := d.GetOk("backup_storage_customer_key_uri"); ok { + body.Properties.BackupStorageCustomerKeyURI = utils.String(v.(string)) + } + + if v, ok := d.GetOk("base64_encoded_yaml_fragment"); ok { + body.Properties.Base64EncodedCassandraYamlFragment = utils.String(v.(string)) + } + + if v, ok := d.GetOk("managed_disk_customer_key_uri"); ok { + body.Properties.ManagedDiskCustomerKeyURI = utils.String(v.(string)) + } + future, err := client.CreateUpdate(ctx, id.ResourceGroup, id.CassandraClusterName, id.DataCenterName, body) if err != nil { return fmt.Errorf("updating %q: %+v", id, err) @@ -197,21 +252,21 @@ func resourceCassandraDatacenterUpdate(d *pluginsdk.ResourceData, meta interface return fmt.Errorf("waiting on update for %q: %+v", id, err) } - // In case the node_count is changed, we need to further poll the node count until the update takes effect. - if d.HasChange("node_count") { - oldNodeCountRaw, _ := d.GetChange("node_count") - oldNodeCount := oldNodeCountRaw.(int) - stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{"-1", strconv.Itoa(oldNodeCount)}, - Target: []string{strconv.Itoa(d.Get("node_count").(int))}, - Refresh: cassandraDatacenterStateRefreshFunc(ctx, client, *id), - MinTimeout: 30 * time.Second, - Timeout: d.Timeout(pluginsdk.TimeoutUpdate), - } + // Issue: https://github.com/Azure/azure-rest-api-specs/issues/19078 + // There is a long running issue on updating this resource. + // The API cannot update the property after WaitForCompletionRef is returned. + // It has to wait a while after that. Then the property can be updated successfully. + stateConf := &pluginsdk.StateChangeConf{ + Delay: 1 * time.Minute, + Pending: []string{string(documentdb.ManagedCassandraProvisioningStateUpdating)}, + Target: []string{string(documentdb.ManagedCassandraProvisioningStateSucceeded)}, + Refresh: cassandraDatacenterStateRefreshFunc(ctx, client, *id), + MinTimeout: 15 * time.Second, + Timeout: d.Timeout(pluginsdk.TimeoutUpdate), + } - if _, err = stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for the updating of node_count in %q to take effect: %+v", id, err) - } + if _, err := stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for update of %s: %+v", id, err) } return resourceCassandraDatacenterRead(d, meta) @@ -244,18 +299,14 @@ func resourceCassandraDatacenterDelete(d *pluginsdk.ResourceData, meta interface func cassandraDatacenterStateRefreshFunc(ctx context.Context, client *documentdb.CassandraDataCentersClient, id parse.CassandraDatacenterId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - nodeCount := "-1" - resp, err := client.Get(ctx, id.ResourceGroup, id.CassandraClusterName, id.DataCenterName) + res, err := client.Get(ctx, id.ResourceGroup, id.CassandraClusterName, id.DataCenterName) if err != nil { - return resp, nodeCount, fmt.Errorf("retrieving %q while waiting for node count to update: %+v", id, err) + return nil, "", fmt.Errorf("polling for %s: %+v", id, err) } - if props := resp.Properties; props != nil { - if props.NodeCount != nil { - nodeCount = strconv.Itoa(int(*props.NodeCount)) - } + if res.Properties != nil && res.Properties.ProvisioningState != "" { + return res, string(res.Properties.ProvisioningState), nil } - - return resp, nodeCount, nil + return nil, "", fmt.Errorf("unable to read provisioning state") } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/costmanagement/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/costmanagement/client/client.go index 7aad7f59b17..a72e8e4735e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/costmanagement/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/costmanagement/client/client.go @@ -1,16 +1,16 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement" + "github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - ExportClient *costmanagement.ExportsClient + ExportClient *exports.ExportsClient } func NewClient(o *common.ClientOptions) *Client { - ExportClient := costmanagement.NewExportsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + ExportClient := exports.NewExportsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&ExportClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/costmanagement/export_base_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/costmanagement/export_base_resource.go index cb8ea970ab3..5595512d990 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/costmanagement/export_base_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/costmanagement/export_base_resource.go @@ -5,11 +5,10 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement" - "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/costmanagement/parse" storageParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -31,10 +30,10 @@ func (br costManagementExportBaseResource) arguments(fields map[string]*pluginsd Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(costmanagement.RecurrenceTypeDaily), - string(costmanagement.RecurrenceTypeWeekly), - string(costmanagement.RecurrenceTypeMonthly), - string(costmanagement.RecurrenceTypeAnnually), + string(exports.RecurrenceTypeDaily), + string(exports.RecurrenceTypeWeekly), + string(exports.RecurrenceTypeMonthly), + string(exports.RecurrenceTypeAnnually), }, false), }, @@ -82,9 +81,9 @@ func (br costManagementExportBaseResource) arguments(fields map[string]*pluginsd Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(costmanagement.ExportTypeActualCost), - string(costmanagement.ExportTypeAmortizedCost), - string(costmanagement.ExportTypeUsage), + string(exports.ExportTypeActualCost), + string(exports.ExportTypeAmortizedCost), + string(exports.ExportTypeUsage), }, false), }, @@ -92,12 +91,12 @@ func (br costManagementExportBaseResource) arguments(fields map[string]*pluginsd Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(costmanagement.Custom), - string(costmanagement.BillingMonthToDate), - string(costmanagement.TheLastBillingMonth), - string(costmanagement.TheLastMonth), - string(costmanagement.WeekToDate), - string(costmanagement.MonthToDate), + string(exports.TimeframeTypeCustom), + string(exports.TimeframeTypeBillingMonthToDate), + string(exports.TimeframeTypeTheLastBillingMonth), + string(exports.TimeframeTypeTheLastMonth), + string(exports.TimeframeTypeWeekToDate), + string(exports.TimeframeTypeMonthToDate), }, false), }, }, @@ -121,15 +120,16 @@ func (br costManagementExportBaseResource) createFunc(resourceName, scopeFieldNa Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.CostManagement.ExportClient - id := parse.NewCostManagementExportId(metadata.ResourceData.Get(scopeFieldName).(string), metadata.ResourceData.Get("name").(string)) - existing, err := client.Get(ctx, id.Scope, id.Name, "") + id := exports.NewScopedExportID(metadata.ResourceData.Get(scopeFieldName).(string), metadata.ResourceData.Get("name").(string)) + var opts exports.GetOperationOptions + existing, err := client.Get(ctx, id, opts) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError(resourceName, id.ID()) } @@ -149,46 +149,48 @@ func (br costManagementExportBaseResource) readFunc(scopeFieldName string) sdk.R Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.CostManagement.ExportClient - id, err := parse.CostManagementExportID(metadata.ResourceData.Id()) + id, err := exports.ParseScopedExportID(metadata.ResourceData.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.Scope, id.Name, "") + var opts exports.GetOperationOptions + resp, err := client.Get(ctx, *id, opts) if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return metadata.MarkAsGone(id) } return fmt.Errorf("reading %s: %+v", *id, err) } - metadata.ResourceData.Set("name", id.Name) + metadata.ResourceData.Set("name", id.ExportName) //lintignore:R001 metadata.ResourceData.Set(scopeFieldName, id.Scope) - if schedule := resp.Schedule; schedule != nil { - if recurrencePeriod := schedule.RecurrencePeriod; recurrencePeriod != nil { - metadata.ResourceData.Set("recurrence_period_start_date", recurrencePeriod.From.Format(time.RFC3339)) - metadata.ResourceData.Set("recurrence_period_end_date", recurrencePeriod.To.Format(time.RFC3339)) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + if schedule := props.Schedule; schedule != nil { + if recurrencePeriod := schedule.RecurrencePeriod; recurrencePeriod != nil { + metadata.ResourceData.Set("recurrence_period_start_date", recurrencePeriod.From) + metadata.ResourceData.Set("recurrence_period_end_date", recurrencePeriod.To) + } + status := *schedule.Status == exports.StatusTypeActive + + metadata.ResourceData.Set("active", status) + metadata.ResourceData.Set("recurrence_type", schedule.Recurrence) + } + + exportDeliveryInfo, err := flattenExportDataStorageLocation(&props.DeliveryInfo) + if err != nil { + return fmt.Errorf("flattening `export_data_storage_location`: %+v", err) + } + if err := metadata.ResourceData.Set("export_data_storage_location", exportDeliveryInfo); err != nil { + return fmt.Errorf("setting `export_data_storage_location`: %+v", err) + } + if err := metadata.ResourceData.Set("export_data_options", flattenExportDefinition(&props.Definition)); err != nil { + return fmt.Errorf("setting `export_data_options`: %+v", err) + } } - - status := schedule.Status == costmanagement.Active - - metadata.ResourceData.Set("active", status) - metadata.ResourceData.Set("recurrence_type", schedule.Recurrence) - } - - exportDeliveryInfo, err := flattenExportDataStorageLocation(resp.DeliveryInfo) - if err != nil { - return fmt.Errorf("flattening `export_data_storage_location`: %+v", err) - } - - if err := metadata.ResourceData.Set("export_data_storage_location", exportDeliveryInfo); err != nil { - return fmt.Errorf("setting `export_data_storage_location`: %+v", err) - } - - if err := metadata.ResourceData.Set("export_data_options", flattenExportDefinition(resp.Definition)); err != nil { - return fmt.Errorf("setting `export_data_options`: %+v", err) } return nil @@ -202,12 +204,12 @@ func (br costManagementExportBaseResource) deleteFunc() sdk.ResourceFunc { Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.CostManagement.ExportClient - id, err := parse.CostManagementExportID(metadata.ResourceData.Id()) + id, err := exports.ParseScopedExportID(metadata.ResourceData.Id()) if err != nil { return err } - if _, err = client.Delete(ctx, id.Scope, id.Name); err != nil { + if _, err = client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } @@ -222,20 +224,25 @@ func (br costManagementExportBaseResource) updateFunc() sdk.ResourceFunc { Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.CostManagement.ExportClient - id, err := parse.CostManagementExportID(metadata.ResourceData.Id()) + id, err := exports.ParseScopedExportID(metadata.ResourceData.Id()) if err != nil { return err } // Update operation requires latest eTag to be set in the request. - resp, err := client.Get(ctx, id.Scope, id.Name, "") + var opts exports.GetOperationOptions + resp, err := client.Get(ctx, *id, opts) if err != nil { return fmt.Errorf("reading %s: %+v", *id, err) } - if resp.ETag == nil { - return fmt.Errorf("add %s: etag was nil", *id) + + if model := resp.Model; model != nil { + if model.ETag == nil { + return fmt.Errorf("add %s: etag was nil", *id) + } } - if err := createOrUpdateCostManagementExport(ctx, client, metadata, *id, resp.ETag); err != nil { + + if err := createOrUpdateCostManagementExport(ctx, client, metadata, *id, resp.Model.ETag); err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } @@ -244,13 +251,10 @@ func (br costManagementExportBaseResource) updateFunc() sdk.ResourceFunc { } } -func createOrUpdateCostManagementExport(ctx context.Context, client *costmanagement.ExportsClient, metadata sdk.ResourceMetaData, id parse.CostManagementExportId, etag *string) error { - from, _ := time.Parse(time.RFC3339, metadata.ResourceData.Get("recurrence_period_start_date").(string)) - to, _ := time.Parse(time.RFC3339, metadata.ResourceData.Get("recurrence_period_end_date").(string)) - - status := costmanagement.Active +func createOrUpdateCostManagementExport(ctx context.Context, client *exports.ExportsClient, metadata sdk.ResourceMetaData, id exports.ScopedExportId, etag *string) error { + status := exports.StatusTypeActive if v := metadata.ResourceData.Get("active"); !v.(bool) { - status = costmanagement.Inactive + status = exports.StatusTypeInactive } deliveryInfo, err := expandExportDataStorageLocation(metadata.ResourceData.Get("export_data_storage_location").([]interface{})) @@ -258,29 +262,31 @@ func createOrUpdateCostManagementExport(ctx context.Context, client *costmanagem return fmt.Errorf("expanding `export_data_storage_location`: %+v", err) } - props := costmanagement.Export{ + format := exports.FormatTypeCsv + recurrenceType := exports.RecurrenceType(metadata.ResourceData.Get("recurrence_type").(string)) + props := exports.Export{ ETag: etag, - ExportProperties: &costmanagement.ExportProperties{ - Schedule: &costmanagement.ExportSchedule{ - Recurrence: costmanagement.RecurrenceType(metadata.ResourceData.Get("recurrence_type").(string)), - RecurrencePeriod: &costmanagement.ExportRecurrencePeriod{ - From: &date.Time{Time: from}, - To: &date.Time{Time: to}, + Properties: &exports.ExportProperties{ + Schedule: &exports.ExportSchedule{ + Recurrence: &recurrenceType, + RecurrencePeriod: &exports.ExportRecurrencePeriod{ + From: metadata.ResourceData.Get("recurrence_period_start_date").(string), + To: utils.String(metadata.ResourceData.Get("recurrence_period_end_date").(string)), }, - Status: status, + Status: &status, }, - DeliveryInfo: deliveryInfo, - Format: costmanagement.Csv, - Definition: expandExportDefinition(metadata.ResourceData.Get("export_data_options").([]interface{})), + DeliveryInfo: *deliveryInfo, + Format: &format, + Definition: *expandExportDefinition(metadata.ResourceData.Get("export_data_options").([]interface{})), }, } - _, err = client.CreateOrUpdate(ctx, id.Scope, id.Name, props) + _, err = client.CreateOrUpdate(ctx, id, props) return err } -func expandExportDataStorageLocation(input []interface{}) (*costmanagement.ExportDeliveryInfo, error) { +func expandExportDataStorageLocation(input []interface{}) (*exports.ExportDeliveryInfo, error) { if len(input) == 0 || input[0] == nil { return nil, nil } @@ -293,10 +299,10 @@ func expandExportDataStorageLocation(input []interface{}) (*costmanagement.Expor storageId := storageParse.NewStorageAccountID(containerId.SubscriptionId, containerId.ResourceGroup, containerId.StorageAccountName) - deliveryInfo := &costmanagement.ExportDeliveryInfo{ - Destination: &costmanagement.ExportDeliveryDestination{ - ResourceID: utils.String(storageId.ID()), - Container: utils.String(containerId.ContainerName), + deliveryInfo := &exports.ExportDeliveryInfo{ + Destination: exports.ExportDeliveryDestination{ + ResourceId: utils.String(storageId.ID()), + Container: containerId.ContainerName, RootFolderPath: utils.String(attrs["root_folder_path"].(string)), }, } @@ -304,22 +310,22 @@ func expandExportDataStorageLocation(input []interface{}) (*costmanagement.Expor return deliveryInfo, nil } -func expandExportDefinition(input []interface{}) *costmanagement.ExportDefinition { +func expandExportDefinition(input []interface{}) *exports.ExportDefinition { if len(input) == 0 || input[0] == nil { return nil } attrs := input[0].(map[string]interface{}) - definitionInfo := &costmanagement.ExportDefinition{ - Type: costmanagement.ExportType(attrs["type"].(string)), - Timeframe: costmanagement.TimeframeType(attrs["time_frame"].(string)), + definitionInfo := &exports.ExportDefinition{ + Type: exports.ExportType(attrs["type"].(string)), + Timeframe: exports.TimeframeType(attrs["time_frame"].(string)), } return definitionInfo } -func flattenExportDataStorageLocation(input *costmanagement.ExportDeliveryInfo) ([]interface{}, error) { - if input == nil || input.Destination == nil { +func flattenExportDataStorageLocation(input *exports.ExportDeliveryInfo) ([]interface{}, error) { + if input == nil { return []interface{}{}, nil } @@ -327,7 +333,7 @@ func flattenExportDataStorageLocation(input *costmanagement.ExportDeliveryInfo) var err error var storageAccountId *storageParse.StorageAccountId - if v := destination.ResourceID; v != nil { + if v := destination.ResourceId; v != nil { storageAccountId, err = storageParse.StorageAccountID(*v) if err != nil { return nil, err @@ -335,8 +341,8 @@ func flattenExportDataStorageLocation(input *costmanagement.ExportDeliveryInfo) } containerId := "" - if v := destination.Container; v != nil && storageAccountId != nil { - containerId = storageParse.NewStorageContainerResourceManagerID(storageAccountId.SubscriptionId, storageAccountId.ResourceGroup, storageAccountId.Name, "default", *v).ID() + if v := destination.Container; v != "" && storageAccountId != nil { + containerId = storageParse.NewStorageContainerResourceManagerID(storageAccountId.SubscriptionId, storageAccountId.ResourceGroup, storageAccountId.Name, "default", v).ID() } rootFolderPath := "" @@ -352,7 +358,7 @@ func flattenExportDataStorageLocation(input *costmanagement.ExportDeliveryInfo) }, nil } -func flattenExportDefinition(input *costmanagement.ExportDefinition) []interface{} { +func flattenExportDefinition(input *exports.ExportDefinition) []interface{} { if input == nil { return []interface{}{} } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/databox_edge_order_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/databox_edge_order_resource.go index 9905dddcacb..b26cb2012aa 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/databox_edge_order_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/databox_edge_order_resource.go @@ -264,7 +264,7 @@ func resourceOrderCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) erro ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewDeviceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("device_name").(string)) + id := parse.NewOrderID(subscriptionId, d.Get("resource_group_name").(string), d.Get("device_name").(string), "default") if d.IsNewResource() { // SDK method: Get(ctx context.Context, deviceName string, resourceGroupName string) existing, err := client.Get(ctx, id.DataBoxEdgeDeviceName, id.ResourceGroup) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/client/client.go index dd07f577301..080f71dd5d0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/client/client.go @@ -1,8 +1,8 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_customer_managed_key_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_customer_managed_key_resource.go index 2aac0e734e2..5165572d617 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_customer_managed_key_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_customer_managed_key_resource.go @@ -8,12 +8,11 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/migration" keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -35,37 +34,32 @@ func resourceDatabricksWorkspaceCustomerManagedKey() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceIdThen(func(id string) error { - _, err := parse.CustomerManagedKeyID(id) + _, err := workspaces.ParseWorkspaceID(id) return err }, func(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) ([]*pluginsdk.ResourceData, error) { - client := meta.(*clients.Client).DataBricks.WorkspacesClient - // validate that the passed ID is a valid CMK configuration ID - customManagedKey, err := parse.CustomerManagedKeyID(d.Id()) + id, err := workspaces.ParseWorkspaceID(d.Id()) if err != nil { - return []*pluginsdk.ResourceData{d}, fmt.Errorf("parsing Databricks workspace customer managed key ID %q for import: %v", d.Id(), err) - } - - // convert the passed custom Managed Key ID to a valid workspace ID - workspace := workspaces.NewWorkspaceID(customManagedKey.SubscriptionId, customManagedKey.ResourceGroup, customManagedKey.CustomerMangagedKeyName) - - // validate that the workspace exists - if _, err = client.Get(ctx, workspace); err != nil { - return []*pluginsdk.ResourceData{d}, fmt.Errorf("retrieving the Databricks workspace customer managed key configuration(ID: %q) for workspace (ID: %q): %s", customManagedKey.ID(), workspace.ID(), err) + return []*pluginsdk.ResourceData{d}, err } // set the new values for the CMK resource - d.SetId(customManagedKey.ID()) - d.Set("workspace_id", workspace.ID()) + d.SetId(id.ID()) + d.Set("workspace_id", id.ID()) return []*pluginsdk.ResourceData{d}, nil }), + SchemaVersion: 1, + StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ + 0: migration.CustomerManagedKeyV0ToV1{}, + }), + Schema: map[string]*pluginsdk.Schema{ "workspace_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validate.WorkspaceID, + ValidateFunc: workspaces.ValidateWorkspaceID, }, // Make this key vault key id and abstract everything from the string... @@ -81,7 +75,6 @@ func resourceDatabricksWorkspaceCustomerManagedKey() *pluginsdk.Resource { func databricksWorkspaceCustomerManagedKeyCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { workspaceClient := meta.(*clients.Client).DataBricks.WorkspacesClient keyVaultsClient := meta.(*clients.Client).KeyVault - subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -124,11 +117,9 @@ func databricksWorkspaceCustomerManagedKeyCreateUpdate(d *pluginsdk.ResourceData return fmt.Errorf("retrieving the Resource ID for the Key Vault at URL %q: %+v", key.KeyVaultBaseUrl, err) } - resourceID := parse.NewCustomerManagedKeyID(subscriptionId, id.ResourceGroupName, id.WorkspaceName) - if d.IsNewResource() { if workspace.Model != nil && workspace.Model.Properties.Parameters != nil && workspace.Model.Properties.Parameters.Encryption != nil { - return tf.ImportAsExistsError("azurerm_databricks_workspace_customer_managed_key", resourceID.ID()) + return tf.ImportAsExistsError("azurerm_databricks_workspace_customer_managed_key", id.ID()) } } @@ -149,13 +140,13 @@ func databricksWorkspaceCustomerManagedKeyCreateUpdate(d *pluginsdk.ResourceData }, } - props := getProps(workspace.Model, params) + props := getProps(*workspace.Model, params) if err = workspaceClient.CreateOrUpdateThenPoll(ctx, *id, props); err != nil { - return fmt.Errorf("creating/updating %s: %+v", resourceID, err) + return fmt.Errorf("creating/updating Customer Managed Key for %s: %+v", *id, err) } - d.SetId(resourceID.ID()) + d.SetId(id.ID()) return databricksWorkspaceCustomerManagedKeyRead(d, meta) } @@ -164,14 +155,12 @@ func databricksWorkspaceCustomerManagedKeyRead(d *pluginsdk.ResourceData, meta i ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CustomerManagedKeyID(d.Id()) + id, err := workspaces.ParseWorkspaceID(d.Id()) if err != nil { return err } - workspaceId := workspaces.NewWorkspaceID(id.SubscriptionId, id.ResourceGroup, id.CustomerMangagedKeyName) - - resp, err := client.Get(ctx, workspaceId) + resp, err := client.Get(ctx, *id) if err != nil { if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state", *id) @@ -207,11 +196,12 @@ func databricksWorkspaceCustomerManagedKeyRead(d *pluginsdk.ResourceData, meta i } if strings.EqualFold(keySource, string(workspaces.KeySourceMicrosoftPointKeyvault)) && (keyName == "" || keyVersion == "" || keyVaultURI == "") { - return fmt.Errorf("%s: `Workspace.WorkspaceProperties.Parameters.Encryption.Value(s)` were nil", *id) + d.SetId("") + return nil } d.SetId(id.ID()) - d.Set("workspace_id", workspaceId.ID()) + d.Set("workspace_id", id.ID()) if keyVaultURI != "" { key, err := keyVaultParse.NewNestedItemID(keyVaultURI, "keys", keyName, keyVersion) @@ -228,25 +218,17 @@ func databricksWorkspaceCustomerManagedKeyDelete(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CustomerManagedKeyID(d.Id()) + id, err := workspaces.ParseWorkspaceID(d.Id()) if err != nil { return err } - workspaceID := workspaces.NewWorkspaceID(id.SubscriptionId, id.ResourceGroup, id.CustomerMangagedKeyName) - // Not sure if I should also lock the key vault here too - locks.ByName(workspaceID.WorkspaceName, "azurerm_databricks_workspace") - defer locks.UnlockByName(workspaceID.WorkspaceName, "azurerm_databricks_workspace") + locks.ByName(id.WorkspaceName, "azurerm_databricks_workspace") + defer locks.UnlockByName(id.WorkspaceName, "azurerm_databricks_workspace") - workspace, err := client.Get(ctx, workspaceID) + workspace, err := client.Get(ctx, *id) if err != nil { - if response.WasNotFound(workspace.HttpResponse) { - log.Printf("[DEBUG] %s was not found - removing from state", *id) - d.SetId("") - return nil - } - return fmt.Errorf("retrieving %s: %+v", *id, err) } @@ -265,16 +247,16 @@ func databricksWorkspaceCustomerManagedKeyDelete(d *pluginsdk.ResourceData, meta }, } - props := getProps(workspace.Model, params) + props := getProps(*workspace.Model, params) - if err = client.CreateOrUpdateThenPoll(ctx, workspaceID, props); err != nil { - return fmt.Errorf("creating/updating %s: %+v", workspaceID, err) + if err = client.CreateOrUpdateThenPoll(ctx, *id, props); err != nil { + return fmt.Errorf("removing Customer Managed Key from %s: %+v", *id, err) } return nil } -func getProps(workspace *workspaces.Workspace, params *workspaces.WorkspaceCustomParameters) workspaces.Workspace { +func getProps(workspace workspaces.Workspace, params *workspaces.WorkspaceCustomParameters) workspaces.Workspace { props := workspaces.Workspace{ Location: workspace.Location, Sku: workspace.Sku, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_workspace_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_workspace_data_source.go index 472478a12e7..0534c147196 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_workspace_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_workspace_data_source.go @@ -7,8 +7,8 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_workspace_private_endpoint_connection_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_workspace_private_endpoint_connection_data_source.go index f56c5750a69..7e6dac9bfb7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_workspace_private_endpoint_connection_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_workspace_private_endpoint_connection_data_source.go @@ -5,9 +5,9 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_workspace_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_workspace_resource.go index ea760699eb6..01284e50000 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_workspace_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_workspace_resource.go @@ -11,12 +11,11 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces" "github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/validate" keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" @@ -44,7 +43,7 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.WorkspaceID(id) + _, err := workspaces.ParseWorkspaceID(id) return err }), @@ -685,7 +684,7 @@ func flattenWorkspaceCustomParameters(input *workspaces.WorkspaceCustomParameter parameters["nat_gateway_name"] = v.Value } - if v := input.PublicIpName; v != nil { + if v := input.PublicIPName; v != nil { parameters["public_ip_name"] = v.Value } @@ -705,7 +704,7 @@ func flattenWorkspaceCustomParameters(input *workspaces.WorkspaceCustomParameter parameters["machine_learning_workspace_id"] = v.Value } - if v := input.EnableNoPublicIp; v != nil { + if v := input.EnableNoPublicIP; v != nil { parameters["no_public_ip"] = v.Value } @@ -780,7 +779,7 @@ func expandWorkspaceCustomParameters(input []interface{}, customerManagedKeyEnab } if v, ok := config["public_ip_name"].(string); ok && v != "" { - parameters.PublicIpName = &workspaces.WorkspaceCustomStringParameter{ + parameters.PublicIPName = &workspaces.WorkspaceCustomStringParameter{ Value: v, } } @@ -810,7 +809,7 @@ func expandWorkspaceCustomParameters(input []interface{}, customerManagedKeyEnab } if v, ok := config["no_public_ip"].(bool); ok { - parameters.EnableNoPublicIp = &workspaces.WorkspaceCustomBooleanParameter{ + parameters.EnableNoPublicIP = &workspaces.WorkspaceCustomBooleanParameter{ Value: v, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/migration/customer_managed_key.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/migration/customer_managed_key.go new file mode 100644 index 00000000000..dc10bb2bb6a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/migration/customer_managed_key.go @@ -0,0 +1,101 @@ +package migration + +import ( + "context" + "fmt" + "log" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ pluginsdk.StateUpgrade = CustomerManagedKeyV0ToV1{} + +type CustomerManagedKeyV0ToV1 struct { +} + +func (c CustomerManagedKeyV0ToV1) Schema() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "workspace_id": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "key_vault_key_id": { + Type: pluginsdk.TypeString, + Required: true, + }, + } +} + +func (c CustomerManagedKeyV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { + return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + // previously CustomerManagedKey used a virtual Resource ID - however this had a typo in the final segment `Mangaged` + // whilst we could look to update this to remove the typo - since other Customer Managed Key resources use the + // ID of the Parent resource being changed, we're going to update it to that instead. + + oldIdRaw := rawState["id"].(string) + oldId, err := parseLegacyCustomerManagedKeyId(oldIdRaw) + if err != nil { + return nil, fmt.Errorf("parsing existing Resource ID %q: %+v", oldIdRaw, err) + } + + newId := workspaces.NewWorkspaceID(oldId.SubscriptionId, oldId.ResourceGroup, oldId.CustomerMangagedKeyName) + log.Printf("[DEBUG] Updating the Resource ID from %q to %q", oldIdRaw, newId.ID()) + rawState["id"] = newId.ID() + + return rawState, nil + } +} + +type legacyCustomerManagedKeyId struct { + SubscriptionId string + ResourceGroup string + CustomerMangagedKeyName string +} + +func (id legacyCustomerManagedKeyId) String() string { + segments := []string{ + fmt.Sprintf("Customer Mangaged Key Name %q", id.CustomerMangagedKeyName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Customer Managed Key", segmentsStr) +} + +func (id legacyCustomerManagedKeyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/customerMangagedKey/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.CustomerMangagedKeyName) +} + +func parseLegacyCustomerManagedKeyId(input string) (*legacyCustomerManagedKeyId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := legacyCustomerManagedKeyId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.CustomerMangagedKeyName, err = id.PopSegment("customerMangagedKey"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/parse/customer_managed_key.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/parse/customer_managed_key.go deleted file mode 100644 index 9701181c301..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/parse/customer_managed_key.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type CustomerManagedKeyId struct { - SubscriptionId string - ResourceGroup string - CustomerMangagedKeyName string -} - -func NewCustomerManagedKeyID(subscriptionId, resourceGroup, customerMangagedKeyName string) CustomerManagedKeyId { - return CustomerManagedKeyId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - CustomerMangagedKeyName: customerMangagedKeyName, - } -} - -func (id CustomerManagedKeyId) String() string { - segments := []string{ - fmt.Sprintf("Customer Mangaged Key Name %q", id.CustomerMangagedKeyName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Customer Managed Key", segmentsStr) -} - -func (id CustomerManagedKeyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/customerMangagedKey/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.CustomerMangagedKeyName) -} - -// CustomerManagedKeyID parses a CustomerManagedKey ID into an CustomerManagedKeyId struct -func CustomerManagedKeyID(input string) (*CustomerManagedKeyId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := CustomerManagedKeyId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.CustomerMangagedKeyName, err = id.PopSegment("customerMangagedKey"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/parse/workspace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/parse/workspace.go deleted file mode 100644 index fb16669d65b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/parse/workspace.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type WorkspaceId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewWorkspaceID(subscriptionId, resourceGroup, name string) WorkspaceId { - return WorkspaceId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id WorkspaceId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Workspace", segmentsStr) -} - -func (id WorkspaceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Databricks/workspaces/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// WorkspaceID parses a Workspace ID into an WorkspaceId struct -func WorkspaceID(input string) (*WorkspaceId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := WorkspaceId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("workspaces"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/resourceids.go deleted file mode 100644 index 4f7244e9f07..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/resourceids.go +++ /dev/null @@ -1,4 +0,0 @@ -package databricks - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Workspace -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Databricks/workspaces/workspace1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=CustomerManagedKey -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Databricks/customerMangagedKey/workspace1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/client.go deleted file mode 100644 index bc9eafbb30e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package workspaces - -import "github.com/Azure/go-autorest/autorest" - -type WorkspacesClient struct { - Client autorest.Client - baseUri string -} - -func NewWorkspacesClientWithBaseURI(endpoint string) WorkspacesClient { - return WorkspacesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/constants.go deleted file mode 100644 index 41092abb3df..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/constants.go +++ /dev/null @@ -1,306 +0,0 @@ -package workspaces - -import "strings" - -type CreatedByType string - -const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" -) - -func PossibleValuesForCreatedByType() []string { - return []string{ - string(CreatedByTypeApplication), - string(CreatedByTypeKey), - string(CreatedByTypeManagedIdentity), - string(CreatedByTypeUser), - } -} - -func parseCreatedByType(input string) (*CreatedByType, error) { - vals := map[string]CreatedByType{ - "application": CreatedByTypeApplication, - "key": CreatedByTypeKey, - "managedidentity": CreatedByTypeManagedIdentity, - "user": CreatedByTypeUser, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CreatedByType(input) - return &out, nil -} - -type CustomParameterType string - -const ( - CustomParameterTypeBool CustomParameterType = "Bool" - CustomParameterTypeObject CustomParameterType = "Object" - CustomParameterTypeString CustomParameterType = "String" -) - -func PossibleValuesForCustomParameterType() []string { - return []string{ - string(CustomParameterTypeBool), - string(CustomParameterTypeObject), - string(CustomParameterTypeString), - } -} - -func parseCustomParameterType(input string) (*CustomParameterType, error) { - vals := map[string]CustomParameterType{ - "bool": CustomParameterTypeBool, - "object": CustomParameterTypeObject, - "string": CustomParameterTypeString, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CustomParameterType(input) - return &out, nil -} - -type EncryptionKeySource string - -const ( - EncryptionKeySourceMicrosoftPointKeyvault EncryptionKeySource = "Microsoft.Keyvault" -) - -func PossibleValuesForEncryptionKeySource() []string { - return []string{ - string(EncryptionKeySourceMicrosoftPointKeyvault), - } -} - -func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { - vals := map[string]EncryptionKeySource{ - "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyvault, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionKeySource(input) - return &out, nil -} - -type KeySource string - -const ( - KeySourceDefault KeySource = "Default" - KeySourceMicrosoftPointKeyvault KeySource = "Microsoft.Keyvault" -) - -func PossibleValuesForKeySource() []string { - return []string{ - string(KeySourceDefault), - string(KeySourceMicrosoftPointKeyvault), - } -} - -func parseKeySource(input string) (*KeySource, error) { - vals := map[string]KeySource{ - "default": KeySourceDefault, - "microsoft.keyvault": KeySourceMicrosoftPointKeyvault, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeySource(input) - return &out, nil -} - -type PrivateEndpointConnectionProvisioningState string - -const ( - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" - PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" -) - -func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { - return []string{ - string(PrivateEndpointConnectionProvisioningStateCreating), - string(PrivateEndpointConnectionProvisioningStateDeleting), - string(PrivateEndpointConnectionProvisioningStateFailed), - string(PrivateEndpointConnectionProvisioningStateSucceeded), - string(PrivateEndpointConnectionProvisioningStateUpdating), - } -} - -func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { - vals := map[string]PrivateEndpointConnectionProvisioningState{ - "creating": PrivateEndpointConnectionProvisioningStateCreating, - "deleting": PrivateEndpointConnectionProvisioningStateDeleting, - "failed": PrivateEndpointConnectionProvisioningStateFailed, - "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, - "updating": PrivateEndpointConnectionProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PrivateEndpointConnectionProvisioningState(input) - return &out, nil -} - -type PrivateLinkServiceConnectionStatus string - -const ( - PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" - PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" - PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" - PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" -) - -func PossibleValuesForPrivateLinkServiceConnectionStatus() []string { - return []string{ - string(PrivateLinkServiceConnectionStatusApproved), - string(PrivateLinkServiceConnectionStatusDisconnected), - string(PrivateLinkServiceConnectionStatusPending), - string(PrivateLinkServiceConnectionStatusRejected), - } -} - -func parsePrivateLinkServiceConnectionStatus(input string) (*PrivateLinkServiceConnectionStatus, error) { - vals := map[string]PrivateLinkServiceConnectionStatus{ - "approved": PrivateLinkServiceConnectionStatusApproved, - "disconnected": PrivateLinkServiceConnectionStatusDisconnected, - "pending": PrivateLinkServiceConnectionStatusPending, - "rejected": PrivateLinkServiceConnectionStatusRejected, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PrivateLinkServiceConnectionStatus(input) - return &out, nil -} - -type ProvisioningState string - -const ( - ProvisioningStateAccepted ProvisioningState = "Accepted" - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreated ProvisioningState = "Created" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleted ProvisioningState = "Deleted" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateReady ProvisioningState = "Ready" - ProvisioningStateRunning ProvisioningState = "Running" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -func PossibleValuesForProvisioningState() []string { - return []string{ - string(ProvisioningStateAccepted), - string(ProvisioningStateCanceled), - string(ProvisioningStateCreated), - string(ProvisioningStateCreating), - string(ProvisioningStateDeleted), - string(ProvisioningStateDeleting), - string(ProvisioningStateFailed), - string(ProvisioningStateReady), - string(ProvisioningStateRunning), - string(ProvisioningStateSucceeded), - string(ProvisioningStateUpdating), - } -} - -func parseProvisioningState(input string) (*ProvisioningState, error) { - vals := map[string]ProvisioningState{ - "accepted": ProvisioningStateAccepted, - "canceled": ProvisioningStateCanceled, - "created": ProvisioningStateCreated, - "creating": ProvisioningStateCreating, - "deleted": ProvisioningStateDeleted, - "deleting": ProvisioningStateDeleting, - "failed": ProvisioningStateFailed, - "ready": ProvisioningStateReady, - "running": ProvisioningStateRunning, - "succeeded": ProvisioningStateSucceeded, - "updating": ProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProvisioningState(input) - return &out, nil -} - -type PublicNetworkAccess string - -const ( - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -func PossibleValuesForPublicNetworkAccess() []string { - return []string{ - string(PublicNetworkAccessDisabled), - string(PublicNetworkAccessEnabled), - } -} - -func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { - vals := map[string]PublicNetworkAccess{ - "disabled": PublicNetworkAccessDisabled, - "enabled": PublicNetworkAccessEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PublicNetworkAccess(input) - return &out, nil -} - -type RequiredNsgRules string - -const ( - RequiredNsgRulesAllRules RequiredNsgRules = "AllRules" - RequiredNsgRulesNoAzureDatabricksRules RequiredNsgRules = "NoAzureDatabricksRules" - RequiredNsgRulesNoAzureServiceRules RequiredNsgRules = "NoAzureServiceRules" -) - -func PossibleValuesForRequiredNsgRules() []string { - return []string{ - string(RequiredNsgRulesAllRules), - string(RequiredNsgRulesNoAzureDatabricksRules), - string(RequiredNsgRulesNoAzureServiceRules), - } -} - -func parseRequiredNsgRules(input string) (*RequiredNsgRules, error) { - vals := map[string]RequiredNsgRules{ - "allrules": RequiredNsgRulesAllRules, - "noazuredatabricksrules": RequiredNsgRulesNoAzureDatabricksRules, - "noazureservicerules": RequiredNsgRulesNoAzureServiceRules, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RequiredNsgRules(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/id_resourcegroup.go deleted file mode 100644 index 0b0d1fa8154..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package workspaces - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/id_subscription.go deleted file mode 100644 index ab714d957ec..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package workspaces - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_createorupdate_autorest.go deleted file mode 100644 index d354068f861..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_createorupdate_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package workspaces - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateOrUpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c WorkspacesClient) CreateOrUpdate(ctx context.Context, id WorkspaceId, input Workspace) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c WorkspacesClient) CreateOrUpdateThenPoll(ctx context.Context, id WorkspaceId, input Workspace) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c WorkspacesClient) preparerForCreateOrUpdate(ctx context.Context, id WorkspaceId, input Workspace) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c WorkspacesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_delete_autorest.go deleted file mode 100644 index ab1a23d09d9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_delete_autorest.go +++ /dev/null @@ -1,73 +0,0 @@ -package workspaces - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c WorkspacesClient) Delete(ctx context.Context, id WorkspaceId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c WorkspacesClient) DeleteThenPoll(ctx context.Context, id WorkspaceId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c WorkspacesClient) preparerForDelete(ctx context.Context, id WorkspaceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c WorkspacesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_get_autorest.go deleted file mode 100644 index 2402fbbfb14..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package workspaces - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *Workspace -} - -// Get ... -func (c WorkspacesClient) Get(ctx context.Context, id WorkspaceId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c WorkspacesClient) preparerForGet(ctx context.Context, id WorkspaceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c WorkspacesClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 1a7bb7f994b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package workspaces - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *[]Workspace - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []Workspace -} - -func (r ListByResourceGroupResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c WorkspacesClient) ListByResourceGroup(ctx context.Context, id ResourceGroupId) (resp ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c WorkspacesClient) ListByResourceGroupComplete(ctx context.Context, id ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, WorkspacePredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c WorkspacesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate WorkspacePredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]Workspace, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c WorkspacesClient) preparerForListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Databricks/workspaces", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c WorkspacesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c WorkspacesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - type page struct { - Values []Workspace `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_listbysubscription_autorest.go deleted file mode 100644 index d0ff80aa2cb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_listbysubscription_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package workspaces - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListBySubscriptionResponse struct { - HttpResponse *http.Response - Model *[]Workspace - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []Workspace -} - -func (r ListBySubscriptionResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListBySubscriptionResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListBySubscription ... -func (c WorkspacesClient) ListBySubscription(ctx context.Context, id SubscriptionId) (resp ListBySubscriptionResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c WorkspacesClient) ListBySubscriptionComplete(ctx context.Context, id SubscriptionId) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, WorkspacePredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c WorkspacesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate WorkspacePredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]Workspace, 0) - - page, err := c.ListBySubscription(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c WorkspacesClient) preparerForListBySubscription(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Databricks/workspaces", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c WorkspacesClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListBySubscription handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (c WorkspacesClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionResponse, err error) { - type page struct { - Values []Workspace `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionResponse, err error) { - req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_update_autorest.go deleted file mode 100644 index 608c8eca22a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/method_update_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package workspaces - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type UpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c WorkspacesClient) Update(ctx context.Context, id WorkspaceId, input WorkspaceUpdate) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "workspaces.WorkspacesClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c WorkspacesClient) UpdateThenPoll(ctx context.Context, id WorkspaceId, input WorkspaceUpdate) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c WorkspacesClient) preparerForUpdate(ctx context.Context, id WorkspaceId, input WorkspaceUpdate) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c WorkspacesClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_createdby.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_createdby.go deleted file mode 100644 index a3d0468ac48..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_createdby.go +++ /dev/null @@ -1,7 +0,0 @@ -package workspaces - -type CreatedBy struct { - ApplicationId *string `json:"applicationId,omitempty"` - Oid *string `json:"oid,omitempty"` - Puid *string `json:"puid,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_encryption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_encryption.go deleted file mode 100644 index 3b9fc919195..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_encryption.go +++ /dev/null @@ -1,8 +0,0 @@ -package workspaces - -type Encryption struct { - KeyName *string `json:"KeyName,omitempty"` - KeySource *KeySource `json:"keySource,omitempty"` - Keyvaulturi *string `json:"keyvaulturi,omitempty"` - Keyversion *string `json:"keyversion,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_encryptionentitiesdefinition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_encryptionentitiesdefinition.go deleted file mode 100644 index 8b577c633df..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_encryptionentitiesdefinition.go +++ /dev/null @@ -1,5 +0,0 @@ -package workspaces - -type EncryptionEntitiesDefinition struct { - ManagedServices *EncryptionV2 `json:"managedServices,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_encryptionv2.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_encryptionv2.go deleted file mode 100644 index 51efdf53915..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_encryptionv2.go +++ /dev/null @@ -1,6 +0,0 @@ -package workspaces - -type EncryptionV2 struct { - KeySource EncryptionKeySource `json:"keySource"` - KeyVaultProperties *EncryptionV2KeyVaultProperties `json:"keyVaultProperties,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_encryptionv2keyvaultproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_encryptionv2keyvaultproperties.go deleted file mode 100644 index 1a48d6356c6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_encryptionv2keyvaultproperties.go +++ /dev/null @@ -1,7 +0,0 @@ -package workspaces - -type EncryptionV2KeyVaultProperties struct { - KeyName string `json:"keyName"` - KeyVaultUri string `json:"keyVaultUri"` - KeyVersion string `json:"keyVersion"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_managedidentityconfiguration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_managedidentityconfiguration.go deleted file mode 100644 index b060054f808..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_managedidentityconfiguration.go +++ /dev/null @@ -1,7 +0,0 @@ -package workspaces - -type ManagedIdentityConfiguration struct { - PrincipalId *string `json:"principalId,omitempty"` - TenantId *string `json:"tenantId,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_privateendpoint.go deleted file mode 100644 index 9faada2651e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_privateendpoint.go +++ /dev/null @@ -1,5 +0,0 @@ -package workspaces - -type PrivateEndpoint struct { - Id *string `json:"id,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_privateendpointconnection.go deleted file mode 100644 index 4d77c6768dc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_privateendpointconnection.go +++ /dev/null @@ -1,8 +0,0 @@ -package workspaces - -type PrivateEndpointConnection struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties PrivateEndpointConnectionProperties `json:"properties"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_privateendpointconnectionproperties.go deleted file mode 100644 index bd4a99978da..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_privateendpointconnectionproperties.go +++ /dev/null @@ -1,7 +0,0 @@ -package workspaces - -type PrivateEndpointConnectionProperties struct { - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` - ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_privatelinkserviceconnectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_privatelinkserviceconnectionstate.go deleted file mode 100644 index 873afa7399f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_privatelinkserviceconnectionstate.go +++ /dev/null @@ -1,7 +0,0 @@ -package workspaces - -type PrivateLinkServiceConnectionState struct { - ActionRequired *string `json:"actionRequired,omitempty"` - Description *string `json:"description,omitempty"` - Status PrivateLinkServiceConnectionStatus `json:"status"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_sku.go deleted file mode 100644 index 90546165345..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_sku.go +++ /dev/null @@ -1,6 +0,0 @@ -package workspaces - -type Sku struct { - Name string `json:"name"` - Tier *string `json:"tier,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_systemdata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_systemdata.go deleted file mode 100644 index c7da0009ca7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_systemdata.go +++ /dev/null @@ -1,40 +0,0 @@ -package workspaces - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type SystemData struct { - CreatedAt *string `json:"createdAt,omitempty"` - CreatedBy *string `json:"createdBy,omitempty"` - CreatedByType *CreatedByType `json:"createdByType,omitempty"` - LastModifiedAt *string `json:"lastModifiedAt,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` -} - -func (o SystemData) GetCreatedAtAsTime() (*time.Time, error) { - if o.CreatedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o SystemData) SetCreatedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreatedAt = &formatted -} - -func (o SystemData) GetLastModifiedAtAsTime() (*time.Time, error) { - if o.LastModifiedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModifiedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o SystemData) SetLastModifiedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModifiedAt = &formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspace.go deleted file mode 100644 index 229d83eb488..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspace.go +++ /dev/null @@ -1,12 +0,0 @@ -package workspaces - -type Workspace struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties WorkspaceProperties `json:"properties"` - Sku *Sku `json:"sku,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspacecustombooleanparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspacecustombooleanparameter.go deleted file mode 100644 index a1427c18108..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspacecustombooleanparameter.go +++ /dev/null @@ -1,6 +0,0 @@ -package workspaces - -type WorkspaceCustomBooleanParameter struct { - Type *CustomParameterType `json:"type,omitempty"` - Value bool `json:"value"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspacecustomobjectparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspacecustomobjectparameter.go deleted file mode 100644 index 31772ef198c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspacecustomobjectparameter.go +++ /dev/null @@ -1,6 +0,0 @@ -package workspaces - -type WorkspaceCustomObjectParameter struct { - Type *CustomParameterType `json:"type,omitempty"` - Value interface{} `json:"value"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspacecustomstringparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspacecustomstringparameter.go deleted file mode 100644 index 350be8e16f2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspacecustomstringparameter.go +++ /dev/null @@ -1,6 +0,0 @@ -package workspaces - -type WorkspaceCustomStringParameter struct { - Type *CustomParameterType `json:"type,omitempty"` - Value string `json:"value"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspaceencryptionparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspaceencryptionparameter.go deleted file mode 100644 index 038ccecdccc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspaceencryptionparameter.go +++ /dev/null @@ -1,6 +0,0 @@ -package workspaces - -type WorkspaceEncryptionParameter struct { - Type *CustomParameterType `json:"type,omitempty"` - Value *Encryption `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspaceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspaceproperties.go deleted file mode 100644 index 34a8dd6b8ba..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspaceproperties.go +++ /dev/null @@ -1,37 +0,0 @@ -package workspaces - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type WorkspaceProperties struct { - Authorizations *[]WorkspaceProviderAuthorization `json:"authorizations,omitempty"` - CreatedBy *CreatedBy `json:"createdBy,omitempty"` - CreatedDateTime *string `json:"createdDateTime,omitempty"` - Encryption *WorkspacePropertiesEncryption `json:"encryption,omitempty"` - ManagedResourceGroupId string `json:"managedResourceGroupId"` - Parameters *WorkspaceCustomParameters `json:"parameters,omitempty"` - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` - PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - RequiredNsgRules *RequiredNsgRules `json:"requiredNsgRules,omitempty"` - StorageAccountIdentity *ManagedIdentityConfiguration `json:"storageAccountIdentity,omitempty"` - UiDefinitionUri *string `json:"uiDefinitionUri,omitempty"` - UpdatedBy *CreatedBy `json:"updatedBy,omitempty"` - WorkspaceId *string `json:"workspaceId,omitempty"` - WorkspaceUrl *string `json:"workspaceUrl,omitempty"` -} - -func (o WorkspaceProperties) GetCreatedDateTimeAsTime() (*time.Time, error) { - if o.CreatedDateTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreatedDateTime, "2006-01-02T15:04:05Z07:00") -} - -func (o WorkspaceProperties) SetCreatedDateTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreatedDateTime = &formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspacepropertiesencryption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspacepropertiesencryption.go deleted file mode 100644 index 44bf74ed862..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspacepropertiesencryption.go +++ /dev/null @@ -1,5 +0,0 @@ -package workspaces - -type WorkspacePropertiesEncryption struct { - Entities EncryptionEntitiesDefinition `json:"entities"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspaceproviderauthorization.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspaceproviderauthorization.go deleted file mode 100644 index 4ca91d2f860..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspaceproviderauthorization.go +++ /dev/null @@ -1,6 +0,0 @@ -package workspaces - -type WorkspaceProviderAuthorization struct { - PrincipalId string `json:"principalId"` - RoleDefinitionId string `json:"roleDefinitionId"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspaceupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspaceupdate.go deleted file mode 100644 index dbecfc4e4d0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/model_workspaceupdate.go +++ /dev/null @@ -1,5 +0,0 @@ -package workspaces - -type WorkspaceUpdate struct { - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/predicates.go deleted file mode 100644 index 160831d74d8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/predicates.go +++ /dev/null @@ -1,29 +0,0 @@ -package workspaces - -type WorkspacePredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p WorkspacePredicate) Matches(input Workspace) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/version.go deleted file mode 100644 index 18c8cf80e51..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package workspaces - -import "fmt" - -const defaultApiVersion = "2021-04-01-preview" - -func userAgent() string { - return fmt.Sprintf("pandora/workspaces/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/validate/customer_managed_key_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/validate/customer_managed_key_id.go deleted file mode 100644 index b3269a57a7e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/validate/customer_managed_key_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/parse" -) - -func CustomerManagedKeyID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.CustomerManagedKeyID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/validate/workspace_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/validate/workspace_id.go deleted file mode 100644 index af131b512ef..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/validate/workspace_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/parse" -) - -func WorkspaceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.WorkspaceID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/client/client.go new file mode 100644 index 00000000000..8cc3beea0e7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/client/client.go @@ -0,0 +1,19 @@ +package client + +import ( + "github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +type Client struct { + MonitorsClient *datadog.MonitorsClient +} + +func NewClient(o *common.ClientOptions) *Client { + monitorsClient := datadog.NewMonitorsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&monitorsClient.Client, o.ResourceManagerAuthorizer) + + return &Client{ + MonitorsClient: &monitorsClient, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/datadog_monitors_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/datadog_monitors_resource.go new file mode 100644 index 00000000000..9c38057eaa0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/datadog_monitors_resource.go @@ -0,0 +1,429 @@ +package datadog + +import ( + "fmt" + "log" + "time" + + "github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tags" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceDatadogMonitor() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceDatadogMonitorCreate, + Read: resourceDatadogMonitorRead, + Update: resourceDatadogMonitorUpdate, + Delete: resourceDatadogMonitorDelete, + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Update: pluginsdk.DefaultTimeout(30 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.DatadogMonitorID(id) + return err + }), + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.DatadogMonitorsName, + }, + + "resource_group_name": azure.SchemaResourceGroupName(), + + "location": azure.SchemaLocation(), + + "datadog_organization": { + Type: pluginsdk.TypeList, + Required: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "api_key": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + Sensitive: true, + }, + + "application_key": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + Sensitive: true, + }, + + "enterprise_app_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + }, + + "linking_auth_code": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + Sensitive: true, + }, + + "linking_client_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + Sensitive: true, + }, + + "redirect_uri": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + }, + + "id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "identity": commonschema.SystemAssignedIdentityOptional(), + + "sku_name": { + Type: pluginsdk.TypeString, + Required: true, + DiffSuppressFunc: SkuNameDiffSuppress, + }, + + "user": { + Type: pluginsdk.TypeList, + Required: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.DatadogUsersName, + }, + + "email": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.DatadogMonitorsEmailAddress, + }, + + "phone_number": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validate.DatadogMonitorsPhoneNumber, + }, + }, + }, + }, + + "monitoring_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "marketplace_subscription_status": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": tags.Schema(), + }, + } +} + +func resourceDatadogMonitorCreate(d *pluginsdk.ResourceData, meta interface{}) error { + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + client := meta.(*clients.Client).Datadog.MonitorsClient + ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) + defer cancel() + + name := d.Get("name").(string) + resourceGroup := d.Get("resource_group_name").(string) + + id := parse.NewDatadogMonitorID(subscriptionId, resourceGroup, name) + + existing, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + } + if !utils.ResponseWasNotFound(existing.Response) { + return tf.ImportAsExistsError("azurerm_datadog_monitor", id.ID()) + } + + monitoringStatus := datadog.MonitoringStatusDisabled + if d.Get("monitoring_enabled").(bool) { + monitoringStatus = datadog.MonitoringStatusEnabled + } + + body := datadog.MonitorResource{ + Location: utils.String(location.Normalize(d.Get("location").(string))), + Identity: expandMonitorIdentityProperties(d.Get("identity").([]interface{})), + Sku: &datadog.ResourceSku{ + Name: utils.String(d.Get("sku_name").(string)), + }, + Properties: &datadog.MonitorProperties{ + DatadogOrganizationProperties: expandMonitorOrganizationProperties(d.Get("datadog_organization").([]interface{})), + UserInfo: expandMonitorUserInfo(d.Get("user").([]interface{})), + MonitoringStatus: monitoringStatus, + }, + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + } + future, err := client.Create(ctx, resourceGroup, name, &body) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for creation of %s: %+v", id, err) + } + + d.SetId(id.ID()) + return resourceDatadogMonitorRead(d, meta) +} + +func resourceDatadogMonitorRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Datadog.MonitorsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.DatadogMonitorID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.MonitorName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + log.Printf("[INFO] Datadog monitor %q does not exist - removing from state", d.Id()) + d.SetId("") + return nil + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + d.Set("name", id.MonitorName) + d.Set("resource_group_name", id.ResourceGroup) + d.Set("location", location.NormalizeNilable(resp.Location)) + if err := d.Set("identity", flattenMonitorIdentityProperties(resp.Identity)); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } + if props := resp.Properties; props != nil { + if err := d.Set("datadog_organization", flattenMonitorOrganizationProperties(props.DatadogOrganizationProperties, d)); err != nil { + return fmt.Errorf("setting `datadog_organization`: %+v", err) + } + d.Set("monitoring_enabled", props.MonitoringStatus == datadog.MonitoringStatusEnabled) + d.Set("marketplace_subscription_status", props.MarketplaceSubscriptionStatus) + } + if resp.Sku != nil { + d.Set("sku_name", *resp.Sku.Name) + } + + return tags.FlattenAndSet(d, resp.Tags) +} + +func resourceDatadogMonitorUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Datadog.MonitorsClient + ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.DatadogMonitorID(d.Id()) + if err != nil { + return err + } + + body := datadog.MonitorResourceUpdateParameters{ + Properties: &datadog.MonitorUpdateProperties{}, + } + if d.HasChange("sku_name") { + body.Sku = &datadog.ResourceSku{Name: utils.String(d.Get("sku_name").(string))} + } + if d.HasChange("monitoring_enabled") { + monitoringStatus := datadog.MonitoringStatusDisabled + if d.Get("monitoring_enabled").(bool) { + monitoringStatus = datadog.MonitoringStatusEnabled + } + body.Properties.MonitoringStatus = monitoringStatus + } + if d.HasChange("tags") { + body.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) + } + + future, err := client.Update(ctx, id.ResourceGroup, id.MonitorName, &body) + if err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for updating of %s: %+v", id, err) + } + return resourceDatadogMonitorRead(d, meta) +} + +func resourceDatadogMonitorDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Datadog.MonitorsClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.DatadogMonitorID(d.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.MonitorName) + if err != nil { + return fmt.Errorf("deleting of %s: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for deletion of %s: %+v", id, err) + } + return nil +} + +func SkuNameDiffSuppress(_, old, new string, _ *pluginsdk.ResourceData) bool { + // During creating, accepts any sku name. + if old == "" { + return false + } + // Sku name of the datadog monitor has two kinds: + // - Concrete sku: E.g. "payg_v2_Monthly". These will be returned unchanged by API. + // - Linked sku: The value is named "Linked". This will be accepted and changed by the API, which will then return you the linked concrete sku. + if new == "Linked" { + return true + } + return old == new +} + +func expandMonitorIdentityProperties(input []interface{}) *datadog.IdentityProperties { + if len(input) == 0 { + return nil + } + v := input[0].(map[string]interface{}) + return &datadog.IdentityProperties{ + Type: datadog.ManagedIdentityTypes(v["type"].(string)), + } +} + +func expandMonitorOrganizationProperties(input []interface{}) *datadog.OrganizationProperties { + if len(input) == 0 || input[0] == nil { + return nil + } + v := input[0].(map[string]interface{}) + return &datadog.OrganizationProperties{ + LinkingAuthCode: utils.String(v["linking_auth_code"].(string)), + LinkingClientID: utils.String(v["linking_client_id"].(string)), + RedirectURI: utils.String(v["redirect_uri"].(string)), + APIKey: utils.String(v["api_key"].(string)), + ApplicationKey: utils.String(v["application_key"].(string)), + EnterpriseAppID: utils.String(v["enterprise_app_id"].(string)), + } +} + +func expandMonitorUserInfo(input []interface{}) *datadog.UserInfo { + if len(input) == 0 || input[0] == nil { + return nil + } + v := input[0].(map[string]interface{}) + return &datadog.UserInfo{ + Name: utils.String(v["name"].(string)), + EmailAddress: utils.String(v["email"].(string)), + PhoneNumber: utils.String(v["phone_number"].(string)), + } +} + +func flattenMonitorIdentityProperties(input *datadog.IdentityProperties) []interface{} { + if input == nil { + return make([]interface{}, 0) + } + + var t datadog.ManagedIdentityTypes + if input.Type != "" { + t = input.Type + } + var principalId string + if input.PrincipalID != nil { + principalId = *input.PrincipalID + } + var tenantId string + if input.TenantID != nil { + tenantId = *input.TenantID + } + return []interface{}{ + map[string]interface{}{ + "type": t, + "principal_id": principalId, + "tenant_id": tenantId, + }, + } +} + +func flattenMonitorOrganizationProperties(input *datadog.OrganizationProperties, d *pluginsdk.ResourceData) []interface{} { + + organisationProperties := d.Get("datadog_organization").([]interface{}) + if len(organisationProperties) == 0 { + return make([]interface{}, 0) + } + v := organisationProperties[0].(map[string]interface{}) + + var name string + if input.Name != nil { + name = *input.Name + } + var id string + if input.ID != nil { + id = *input.ID + } + var redirectUri string + if input.RedirectURI != nil { + redirectUri = *input.RedirectURI + } + var enterpriseAppID string + if input.EnterpriseAppID != nil { + enterpriseAppID = *input.EnterpriseAppID + } + return []interface{}{ + map[string]interface{}{ + "name": name, + "api_key": utils.String(v["api_key"].(string)), + "application_key": utils.String(v["application_key"].(string)), + "enterprise_app_id": enterpriseAppID, + "linking_auth_code": utils.String(v["linking_auth_code"].(string)), + "linking_client_id": utils.String(v["linking_client_id"].(string)), + "redirect_uri": redirectUri, + "id": id, + }, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/parse/datadog_monitor.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/parse/datadog_monitor.go new file mode 100644 index 00000000000..9f0a8418058 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/parse/datadog_monitor.go @@ -0,0 +1,69 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type DatadogMonitorId struct { + SubscriptionId string + ResourceGroup string + MonitorName string +} + +func NewDatadogMonitorID(subscriptionId, resourceGroup, monitorName string) DatadogMonitorId { + return DatadogMonitorId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + MonitorName: monitorName, + } +} + +func (id DatadogMonitorId) String() string { + segments := []string{ + fmt.Sprintf("Monitor Name %q", id.MonitorName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Datadog Monitor", segmentsStr) +} + +func (id DatadogMonitorId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Datadog/monitors/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.MonitorName) +} + +// DatadogMonitorID parses a DatadogMonitor ID into an DatadogMonitorId struct +func DatadogMonitorID(input string) (*DatadogMonitorId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := DatadogMonitorId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.MonitorName, err = id.PopSegment("monitors"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/registration.go new file mode 100644 index 00000000000..d583e5fcc60 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/registration.go @@ -0,0 +1,29 @@ +package datadog + +import "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + +type Registration struct{} + +// Name is the name of this Service +func (r Registration) Name() string { + return "Datadog" +} + +// WebsiteCategories returns a list of categories which can be used for the sidebar +func (r Registration) WebsiteCategories() []string { + return []string{ + "Datadog", + } +} + +// SupportedDataSources returns the supported Data Sources supported by this Service +func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { + return map[string]*pluginsdk.Resource{} +} + +// SupportedResources returns the supported Resources supported by this Service +func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { + return map[string]*pluginsdk.Resource{ + "azurerm_datadog_monitor": resourceDatadogMonitor(), + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/resourceids.go new file mode 100644 index 00000000000..cfc4642478c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/resourceids.go @@ -0,0 +1,3 @@ +package datadog + +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DatadogMonitor -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Datadog/monitors/monitor1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate/datadog_email_address.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate/datadog_email_address.go new file mode 100644 index 00000000000..acbe29fea3c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate/datadog_email_address.go @@ -0,0 +1,19 @@ +package validate + +import ( + "fmt" + "regexp" +) + +func DatadogMonitorsEmailAddress(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + if !regexp.MustCompile(`^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$`).MatchString(v) { + errors = append(errors, fmt.Errorf("expected value of %s not match regular expression, got %v", k, v)) + return + } + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate/datadog_monitor_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate/datadog_monitor_id.go new file mode 100644 index 00000000000..7626bf021d7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate/datadog_monitor_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/parse" +) + +func DatadogMonitorID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.DatadogMonitorID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate/datadog_monitor_name.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate/datadog_monitor_name.go new file mode 100644 index 00000000000..593d2ee6f7c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate/datadog_monitor_name.go @@ -0,0 +1,20 @@ +package validate + +import ( + "fmt" + "regexp" +) + +func DatadogMonitorsName(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + + if !regexp.MustCompile(`^[a-zA-Z0-9_-]{2,32}$`).MatchString(v) { + errors = append(errors, fmt.Errorf("%q must be between 2 and 32 characters in length, can only contain alphanumeric characters, underscore and hyphen symbols", k)) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate/datadog_phone_number.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate/datadog_phone_number.go new file mode 100644 index 00000000000..6f178ada2de --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate/datadog_phone_number.go @@ -0,0 +1,18 @@ +package validate + +import ( + "fmt" +) + +func DatadogMonitorsPhoneNumber(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + if len(v) > 40 { + errors = append(errors, fmt.Errorf("length should be less than %d", 40)) + return + } + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate/datadog_users_name.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate/datadog_users_name.go new file mode 100644 index 00000000000..0359ed04094 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate/datadog_users_name.go @@ -0,0 +1,22 @@ +package validate + +import ( + "fmt" +) + +func DatadogUsersName(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + return + } + if len(v) == 0 { + errors = append(errors, fmt.Errorf("length cannot be %d", 0)) + return + } + if len(v) > 50 { + errors = append(errors, fmt.Errorf("length should be less than %d", 40)) + return + } + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_data_flow.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_data_flow.go index 322036a4598..38a35d2f48f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_data_flow.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_data_flow.go @@ -48,6 +48,35 @@ func SchemaForDataFlowSourceAndSink() *pluginsdk.Schema { }, }, + "flowlet": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "parameters": { + Type: pluginsdk.TypeMap, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "dataset_parameters": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + "linked_service": { Type: pluginsdk.TypeList, Optional: true, @@ -139,6 +168,35 @@ func SchemaForDataFlowSourceTransformation() *pluginsdk.Schema { }, }, + "flowlet": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "parameters": { + Type: pluginsdk.TypeMap, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "dataset_parameters": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + "linked_service": { Type: pluginsdk.TypeList, Optional: true, @@ -180,6 +238,7 @@ func expandDataFactoryDataFlowSource(input []interface{}) *[]datafactory.DataFlo Dataset: expandDataFactoryDatasetReference(raw["dataset"].([]interface{})), LinkedService: expandDataFactoryLinkedServiceReference(raw["linked_service"].([]interface{})), SchemaLinkedService: expandDataFactoryLinkedServiceReference(raw["schema_linked_service"].([]interface{})), + Flowlet: expandDataFactoryDataFlowReference(raw["flowlet"].([]interface{})), }) } return &result @@ -199,6 +258,7 @@ func expandDataFactoryDataFlowSink(input []interface{}) *[]datafactory.DataFlowS Dataset: expandDataFactoryDatasetReference(raw["dataset"].([]interface{})), LinkedService: expandDataFactoryLinkedServiceReference(raw["linked_service"].([]interface{})), SchemaLinkedService: expandDataFactoryLinkedServiceReference(raw["schema_linked_service"].([]interface{})), + Flowlet: expandDataFactoryDataFlowReference(raw["flowlet"].([]interface{})), }) } return &result @@ -217,6 +277,7 @@ func expandDataFactoryDataFlowTransformation(input []interface{}) *[]datafactory Name: utils.String(raw["name"].(string)), Dataset: expandDataFactoryDatasetReference(raw["dataset"].([]interface{})), LinkedService: expandDataFactoryLinkedServiceReference(raw["linked_service"].([]interface{})), + Flowlet: expandDataFactoryDataFlowReference(raw["flowlet"].([]interface{})), }) } return &result @@ -248,6 +309,20 @@ func expandDataFactoryLinkedServiceReference(input []interface{}) *datafactory.L } } +func expandDataFactoryDataFlowReference(input []interface{}) *datafactory.DataFlowReference { + if len(input) == 0 || input[0] == nil { + return nil + } + + raw := input[0].(map[string]interface{}) + return &datafactory.DataFlowReference{ + Type: utils.String("DataFlowReference"), + ReferenceName: utils.String(raw["name"].(string)), + Parameters: raw["parameters"].(map[string]interface{}), + DatasetParameters: utils.String(raw["dataset_parameters"].(string)), + } +} + func flattenDataFactoryDataFlowSource(input *[]datafactory.DataFlowSource) []interface{} { if input == nil { return []interface{}{} @@ -269,6 +344,7 @@ func flattenDataFactoryDataFlowSource(input *[]datafactory.DataFlowSource) []int "dataset": flattenDataFactoryDatasetReference(v.Dataset), "linked_service": flattenDataFactoryLinkedServiceReference(v.LinkedService), "schema_linked_service": flattenDataFactoryLinkedServiceReference(v.SchemaLinkedService), + "flowlet": flattenDataFactoryDataFlowReference(v.Flowlet), }) } return result @@ -295,6 +371,7 @@ func flattenDataFactoryDataFlowSink(input *[]datafactory.DataFlowSink) []interfa "dataset": flattenDataFactoryDatasetReference(v.Dataset), "linked_service": flattenDataFactoryLinkedServiceReference(v.LinkedService), "schema_linked_service": flattenDataFactoryLinkedServiceReference(v.SchemaLinkedService), + "flowlet": flattenDataFactoryDataFlowReference(v.Flowlet), }) } return result @@ -320,6 +397,7 @@ func flattenDataFactoryDataFlowTransformation(input *[]datafactory.Transformatio "description": description, "dataset": flattenDataFactoryDatasetReference(v.Dataset), "linked_service": flattenDataFactoryLinkedServiceReference(v.LinkedService), + "flowlet": flattenDataFactoryDataFlowReference(v.Flowlet), }) } return result @@ -360,3 +438,22 @@ func flattenDataFactoryLinkedServiceReference(input *datafactory.LinkedServiceRe }, } } + +func flattenDataFactoryDataFlowReference(input *datafactory.DataFlowReference) []interface{} { + if input == nil { + return []interface{}{} + } + + name := "" + if input.ReferenceName != nil { + name = *input.ReferenceName + } + + return []interface{}{ + map[string]interface{}{ + "name": name, + "parameters": input.Parameters, + "dataset_parameters": input.DatasetParameters, + }, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_dataset_snowflake_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_dataset_snowflake_resource.go index 51ccaf0ac22..3641c876e91 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_dataset_snowflake_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_dataset_snowflake_resource.go @@ -212,6 +212,7 @@ func resourceDataFactoryDatasetSnowflakeCreateUpdate(d *pluginsdk.ResourceData, SnowflakeDatasetTypeProperties: &snowflakeDatasetProperties, LinkedServiceName: linkedService, Description: &description, + Schema: make([]interface{}, 0), } if v, ok := d.GetOk("folder"); ok { @@ -225,10 +226,8 @@ func resourceDataFactoryDatasetSnowflakeCreateUpdate(d *pluginsdk.ResourceData, snowflakeTableset.Parameters = expandDataFactoryParameters(v.(map[string]interface{})) } - if v, ok := d.GetOk("annotations"); ok { - annotations := v.([]interface{}) - snowflakeTableset.Annotations = &annotations - } + annotations := d.Get("annotations").([]interface{}) + snowflakeTableset.Annotations = &annotations if v, ok := d.GetOk("additional_properties"); ok { snowflakeTableset.AdditionalProperties = v.(map[string]interface{}) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_flowlet_data_flow_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_flowlet_data_flow_resource.go new file mode 100644 index 00000000000..1c53b51cd1f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_flowlet_data_flow_resource.go @@ -0,0 +1,233 @@ +package datafactory + +import ( + "fmt" + "time" + + "github.com/Azure/azure-sdk-for-go/services/datafactory/mgmt/2018-06-01/datafactory" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceDataFactoryFlowletDataFlow() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceDataFactoryFlowletDataFlowCreateUpdate, + Read: resourceDataFactoryFlowletDataFlowRead, + Update: resourceDataFactoryFlowletDataFlowCreateUpdate, + Delete: resourceDataFactoryFlowletDataFlowDelete, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.DataFlowID(id) + return err + }), + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Update: pluginsdk.DefaultTimeout(30 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "data_factory_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.DataFactoryID, + }, + + "script": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + AtLeastOneOf: []string{"script", "script_lines"}, + }, + + "script_lines": { + Type: pluginsdk.TypeList, + Optional: true, + AtLeastOneOf: []string{"script", "script_lines"}, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + + "source": SchemaForDataFlowSourceAndSink(), + + "sink": SchemaForDataFlowSourceAndSink(), + + "transformation": SchemaForDataFlowSourceTransformation(), + + "annotations": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "folder": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + } +} + +func resourceDataFactoryFlowletDataFlowCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).DataFactory.DataFlowClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + dataFactoryId, err := parse.DataFactoryID(d.Get("data_factory_id").(string)) + if err != nil { + return err + } + + id := parse.NewDataFlowID(subscriptionId, dataFactoryId.ResourceGroup, dataFactoryId.FactoryName, d.Get("name").(string)) + if d.IsNewResource() { + existing, err := client.Get(ctx, id.ResourceGroup, id.FactoryName, id.Name, "") + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + + if !utils.ResponseWasNotFound(existing.Response) { + return tf.ImportAsExistsError("azurerm_data_factory_flowlet_data_flow", id.ID()) + } + } + + flowLet := datafactory.Flowlet{ + FlowletTypeProperties: &datafactory.FlowletTypeProperties{ + Script: utils.String(d.Get("script").(string)), + Sinks: expandDataFactoryDataFlowSink(d.Get("sink").([]interface{})), + Sources: expandDataFactoryDataFlowSource(d.Get("source").([]interface{})), + Transformations: expandDataFactoryDataFlowTransformation(d.Get("transformation").([]interface{})), + }, + Description: utils.String(d.Get("description").(string)), + Type: datafactory.TypeBasicDataFlowTypeFlowlet, + } + + if v, ok := d.GetOk("annotations"); ok { + annotations := v.([]interface{}) + flowLet.Annotations = &annotations + } + + if v, ok := d.GetOk("folder"); ok { + flowLet.Folder = &datafactory.DataFlowFolder{ + Name: utils.String(v.(string)), + } + } + + if v, ok := d.GetOk("script_lines"); ok { + flowLet.ScriptLines = utils.ExpandStringSlice(v.([]interface{})) + } + + dataFlow := datafactory.DataFlowResource{ + Properties: &flowLet, + } + + if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.FactoryName, id.Name, dataFlow, ""); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) + } + + d.SetId(id.ID()) + + return resourceDataFactoryFlowletDataFlowRead(d, meta) +} + +func resourceDataFactoryFlowletDataFlowRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).DataFactory.DataFlowClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.DataFlowID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.FactoryName, id.Name, "") + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + d.SetId("") + return nil + } + + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + flowLet, ok := resp.Properties.AsFlowlet() + if !ok { + return fmt.Errorf("classifying type of %s: Expected: %q", id, datafactory.TypeBasicDataFlowTypeFlowlet) + } + + d.Set("name", id.Name) + d.Set("data_factory_id", parse.NewDataFactoryID(id.SubscriptionId, id.ResourceGroup, id.FactoryName).ID()) + d.Set("description", flowLet.Description) + + if err := d.Set("annotations", flattenDataFactoryAnnotations(flowLet.Annotations)); err != nil { + return fmt.Errorf("setting `annotations`: %+v", err) + } + + folder := "" + if flowLet.Folder != nil && flowLet.Folder.Name != nil { + folder = *flowLet.Folder.Name + } + d.Set("folder", folder) + + if prop := flowLet.FlowletTypeProperties; prop != nil { + d.Set("script", prop.Script) + d.Set("script_lines", prop.ScriptLines) + + if err := d.Set("source", flattenDataFactoryDataFlowSource(prop.Sources)); err != nil { + return fmt.Errorf("setting `source`: %+v", err) + } + if err := d.Set("sink", flattenDataFactoryDataFlowSink(prop.Sinks)); err != nil { + return fmt.Errorf("setting `sink`: %+v", err) + } + if err := d.Set("transformation", flattenDataFactoryDataFlowTransformation(prop.Transformations)); err != nil { + return fmt.Errorf("setting `transformation`: %+v", err) + } + } + + return nil +} + +func resourceDataFactoryFlowletDataFlowDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).DataFactory.DataFlowClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.DataFlowID(d.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, id.ResourceGroup, id.FactoryName, id.Name); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_integration_runtime_azure_ssis_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_integration_runtime_azure_ssis_resource.go index 2dfb91140b6..78aa78d2a01 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_integration_runtime_azure_ssis_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_integration_runtime_azure_ssis_resource.go @@ -111,6 +111,21 @@ func resourceDataFactoryIntegrationRuntimeAzureSsis() *pluginsdk.Resource { }, false), }, + "express_vnet_integration": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "subnet_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: networkValidate.SubnetID, + }, + }, + }, + }, + "license_type": { Type: pluginsdk.TypeString, Optional: true, @@ -450,8 +465,9 @@ func resourceDataFactoryIntegrationRuntimeAzureSsisCreateUpdate(d *pluginsdk.Res Description: &description, Type: datafactory.TypeBasicIntegrationRuntimeTypeManaged, ManagedIntegrationRuntimeTypeProperties: &datafactory.ManagedIntegrationRuntimeTypeProperties{ - ComputeProperties: expandDataFactoryIntegrationRuntimeAzureSsisComputeProperties(d), - SsisProperties: expandDataFactoryIntegrationRuntimeAzureSsisProperties(d), + ComputeProperties: expandDataFactoryIntegrationRuntimeAzureSsisComputeProperties(d), + SsisProperties: expandDataFactoryIntegrationRuntimeAzureSsisProperties(d), + CustomerVirtualNetwork: expandDataFactoryIntegrationRuntimeCustomerVirtualNetwork(d.Get("express_vnet_integration").([]interface{})), }, } @@ -552,6 +568,10 @@ func resourceDataFactoryIntegrationRuntimeAzureSsisRead(d *pluginsdk.ResourceDat } } + if err := d.Set("express_vnet_integration", flattenDataFactoryIntegrationRuntimeCustomerVnetIntegration(managedIntegrationRuntime.CustomerVirtualNetwork)); err != nil { + return fmt.Errorf("setting `express_vnet_integration`: %+v", err) + } + return nil } @@ -797,6 +817,16 @@ func expandDataFactoryIntegrationRuntimeAzureSsisKeyVaultSecretReference(input [ return reference } +func expandDataFactoryIntegrationRuntimeCustomerVirtualNetwork(input []interface{}) *datafactory.IntegrationRuntimeCustomerVirtualNetwork { + if len(input) == 0 || input[0] == nil { + return nil + } + raw := input[0].(map[string]interface{}) + return &datafactory.IntegrationRuntimeCustomerVirtualNetwork{ + SubnetID: utils.String(raw["subnet_id"].(string)), + } +} + func flattenDataFactoryIntegrationRuntimeAzureSsisVnetIntegration(vnetProperties *datafactory.IntegrationRuntimeVNetProperties) []interface{} { if vnetProperties == nil { return []interface{}{} @@ -1047,6 +1077,21 @@ func flattenDataFactoryIntegrationRuntimeAzureSsisKeyVaultSecretReference(input } } +func flattenDataFactoryIntegrationRuntimeCustomerVnetIntegration(input *datafactory.IntegrationRuntimeCustomerVirtualNetwork) []interface{} { + if input == nil { + return []interface{}{} + } + subnetId := "" + if input.SubnetID != nil { + subnetId = *input.SubnetID + } + return []interface{}{ + map[string]interface{}{ + "subnet_id": subnetId, + }, + } +} + func readBackSensitiveValue(input []interface{}, propertyName string, filters map[string]string) string { if len(input) == 0 { return "" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_integration_runtime_managed_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_integration_runtime_managed_resource.go index feff0181a1a..80c0685c3d2 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_integration_runtime_managed_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_integration_runtime_managed_resource.go @@ -9,7 +9,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -30,7 +29,7 @@ func resourceDataFactoryIntegrationRuntimeManaged() *pluginsdk.Resource { return err }), - DeprecationMessage: features.DeprecatedInThreePointOh("The resource 'azurerm_data_factory_integration_runtime_managed' has been superseded by the 'azurerm_data_factory_integration_runtime_azure_ssis'."), + DeprecationMessage: "The resource 'azurerm_data_factory_integration_runtime_managed' has been superseded by the 'azurerm_data_factory_integration_runtime_azure_ssis'.", Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_linked_service_azure_databricks_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_linked_service_azure_databricks_resource.go index fa90f551856..7b8e8c55860 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_linked_service_azure_databricks_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_linked_service_azure_databricks_resource.go @@ -7,9 +7,9 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/datafactory/mgmt/2018-06-01/datafactory" + "github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - databricksValidator "github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -56,7 +56,7 @@ func resourceDataFactoryLinkedServiceAzureDatabricks() *pluginsdk.Resource { "msi_work_space_resource_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: databricksValidator.WorkspaceID, + ValidateFunc: workspaces.ValidateWorkspaceID, ExactlyOneOf: []string{"access_token", "msi_work_space_resource_id", "key_vault_password"}, }, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_linked_service_azure_file_storage_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_linked_service_azure_file_storage_resource.go index 8e70155a364..2f291937179 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_linked_service_azure_file_storage_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_linked_service_azure_file_storage_resource.go @@ -174,7 +174,7 @@ func resourceDataFactoryLinkedServiceAzureFileStorageCreateUpdate(d *pluginsdk.R }, FileShare: d.Get("file_share").(string), Host: d.Get("host").(string), - UserID: d.Get("connection_string").(string), + UserID: d.Get("user_id").(string), } password := d.Get("password").(string) @@ -267,6 +267,10 @@ func resourceDataFactoryLinkedServiceAzureFileStorageRead(d *pluginsdk.ResourceD } } + if fileStorage.UserID != nil { + d.Set("user_id", fileStorage.UserID.(string)) + } + annotations := flattenDataFactoryAnnotations(fileStorage.Annotations) if err := d.Set("annotations", annotations); err != nil { return fmt.Errorf("setting `annotations` for Data Factory Azure File Storage %s: %+v", *id, err) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_managed_private_endpoint_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_managed_private_endpoint_resource.go index 0f4f969c1a9..62f14b35278 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_managed_private_endpoint_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_managed_private_endpoint_resource.go @@ -69,6 +69,7 @@ func resourceDataFactoryManagedPrivateEndpoint() *pluginsdk.Resource { "fqdns": { Type: pluginsdk.TypeList, Optional: true, + Computed: true, ForceNew: true, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_resource.go index e4c3600393e..fa2005c4363 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/data_factory_resource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -188,6 +189,12 @@ func resourceDataFactory() *pluginsdk.Resource { Default: true, }, + "purview_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: account.ValidateAccountID, + }, + "customer_managed_key_id": { Type: pluginsdk.TypeString, Optional: true, @@ -248,6 +255,12 @@ func resourceDataFactoryCreateUpdate(d *pluginsdk.ResourceData, meta interface{} Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } + if purviewId, ok := d.GetOk("purview_id"); ok { + dataFactory.FactoryProperties.PurviewConfiguration = &datafactory.PurviewConfiguration{ + PurviewResourceID: utils.String(purviewId.(string)), + } + } + if keyVaultKeyID, ok := d.GetOk("customer_managed_key_id"); ok { keyVaultKey, err := keyVaultParse.ParseOptionallyVersionedNestedItemID(keyVaultKeyID.(string)) if err != nil { @@ -391,6 +404,10 @@ func resourceDataFactoryRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("public_network_enabled", resp.PublicNetworkAccess == datafactory.PublicNetworkAccessEnabled) } + if resp.PurviewConfiguration != nil { + d.Set("purview_id", resp.PurviewConfiguration.PurviewResourceID) + } + managedVirtualNetworkEnabled := false managedVirtualNetworkName, err := getManagedVirtualNetworkName(ctx, managedVirtualNetworksClient, id.ResourceGroup, id.FactoryName) if err != nil { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/registration.go index 8fdf99b3706..c7aed15ca4d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/registration.go @@ -37,6 +37,7 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ "azurerm_data_factory": resourceDataFactory(), "azurerm_data_factory_data_flow": resourceDataFactoryDataFlow(), + "azurerm_data_factory_flowlet_data_flow": resourceDataFactoryFlowletDataFlow(), "azurerm_data_factory_dataset_azure_blob": resourceDataFactoryDatasetAzureBlob(), "azurerm_data_factory_dataset_binary": resourceDataFactoryDatasetBinary(), "azurerm_data_factory_dataset_cosmosdb_sqlapi": resourceDataFactoryDatasetCosmosDbSQLAPI(), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/client/client.go index cc9af0891f1..9bb86b301bc 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/client/client.go @@ -1,29 +1,37 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances" + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies" + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults" + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection" ) type Client struct { - BackupVaultClient *dataprotection.BackupVaultsClient - BackupPolicyClient *dataprotection.BackupPoliciesClient - BackupInstanceClient *dataprotection.BackupInstancesClient + BackupVaultClient *backupvaults.BackupVaultsClient + BackupPolicyClient *backuppolicies.BackupPoliciesClient + BackupInstanceClient *backupinstances.BackupInstancesClient + ResourceGuardClient *resourceguards.ResourceGuardsClient } func NewClient(o *common.ClientOptions) *Client { - backupVaultClient := dataprotection.NewBackupVaultsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + backupVaultClient := backupvaults.NewBackupVaultsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&backupVaultClient.Client, o.ResourceManagerAuthorizer) - backupPolicyClient := dataprotection.NewBackupPoliciesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + backupPolicyClient := backuppolicies.NewBackupPoliciesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&backupPolicyClient.Client, o.ResourceManagerAuthorizer) - backupInstanceClient := dataprotection.NewBackupInstancesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + backupInstanceClient := backupinstances.NewBackupInstancesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&backupInstanceClient.Client, o.ResourceManagerAuthorizer) + resourceGuardClient := resourceguards.NewResourceGuardsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&resourceGuardClient.Client, o.ResourceManagerAuthorizer) + return &Client{ BackupVaultClient: &backupVaultClient, BackupPolicyClient: &backupPolicyClient, BackupInstanceClient: &backupInstanceClient, + ResourceGuardClient: &resourceGuardClient, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_instance_blob_storage_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_instance_blob_storage_resource.go index edc3dda2f98..205189a59e5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_instance_blob_storage_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_instance_blob_storage_resource.go @@ -8,12 +8,11 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances" + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate" storageParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -37,7 +36,7 @@ func resourceDataProtectionBackupInstanceBlobStorage() *schema.Resource { }, Importer: azSchema.ValidateResourceIDPriorToImport(func(id string) error { - _, err := parse.BackupInstanceID(id) + _, err := backupinstances.ParseBackupInstanceID(id) return err }), @@ -54,7 +53,7 @@ func resourceDataProtectionBackupInstanceBlobStorage() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.BackupVaultID, + ValidateFunc: backupinstances.ValidateBackupVaultID, }, "storage_account_id": { @@ -67,7 +66,7 @@ func resourceDataProtectionBackupInstanceBlobStorage() *schema.Resource { "backup_policy_id": { Type: schema.TypeString, Required: true, - ValidateFunc: validate.BackupPolicyID, + ValidateFunc: backuppolicies.ValidateBackupPoliciesID, }, }, } @@ -80,59 +79,55 @@ func resourceDataProtectionBackupInstanceBlobStorageCreateUpdate(d *schema.Resou defer cancel() name := d.Get("name").(string) - vaultId, _ := parse.BackupVaultID(d.Get("vault_id").(string)) - id := parse.NewBackupInstanceID(subscriptionId, vaultId.ResourceGroup, vaultId.Name, name) + vaultId, _ := backupinstances.ParseBackupVaultID(d.Get("vault_id").(string)) + id := backupinstances.NewBackupInstanceID(subscriptionId, vaultId.ResourceGroupName, vaultId.VaultName, name) if d.IsNewResource() { - existing, err := client.Get(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing DataProtection BackupInstance (%q): %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_data_protection_backup_instance_blob_storage", id.ID()) } } storageAccountId, _ := storageParse.StorageAccountID(d.Get("storage_account_id").(string)) location := location.Normalize(d.Get("location").(string)) - policyId, _ := parse.BackupPolicyID(d.Get("backup_policy_id").(string)) + policyId, _ := backuppolicies.ParseBackupPoliciesID(d.Get("backup_policy_id").(string)) - parameters := dataprotection.BackupInstanceResource{ - Properties: &dataprotection.BackupInstance{ - DataSourceInfo: &dataprotection.Datasource{ + parameters := backupinstances.BackupInstanceResource{ + Properties: &backupinstances.BackupInstance{ + DataSourceInfo: backupinstances.Datasource{ DatasourceType: utils.String("Microsoft.Storage/storageAccounts/blobServices"), ObjectType: utils.String("Datasource"), - ResourceID: utils.String(storageAccountId.ID()), + ResourceID: storageAccountId.ID(), ResourceLocation: utils.String(location), ResourceName: utils.String(storageAccountId.Name), ResourceType: utils.String("Microsoft.Storage/storageAccounts"), - ResourceURI: utils.String(storageAccountId.ID()), + ResourceUri: utils.String(storageAccountId.ID()), }, - FriendlyName: utils.String(id.Name), - PolicyInfo: &dataprotection.PolicyInfo{ - PolicyID: utils.String(policyId.ID()), + FriendlyName: utils.String(id.BackupInstanceName), + PolicyInfo: backupinstances.PolicyInfo{ + PolicyId: policyId.ID(), }, }, } - future, err := client.CreateOrUpdate(ctx, id.BackupVaultName, id.ResourceGroup, id.Name, parameters) + err := client.CreateOrUpdateThenPoll(ctx, id, parameters) if err != nil { return fmt.Errorf("creating/updating DataProtection BackupInstance (%q): %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of the DataProtection BackupInstance (%q): %+v", id, err) - } - deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") } stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{string(dataprotection.StatusConfiguringProtection), "UpdatingProtection"}, - Target: []string{string(dataprotection.StatusProtectionConfigured)}, + Pending: []string{string(backupinstances.StatusConfiguringProtection), "UpdatingProtection"}, + Target: []string{string(backupinstances.StatusProtectionConfigured)}, Refresh: policyProtectionStateRefreshFunc(ctx, client, id), MinTimeout: 1 * time.Minute, Timeout: time.Until(deadline), @@ -151,30 +146,29 @@ func resourceDataProtectionBackupInstanceBlobStorageRead(d *schema.ResourceData, ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackupInstanceID(d.Id()) + id, err := backupinstances.ParseBackupInstanceID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] dataprotection %q does not exist - removing from state", d.Id()) d.SetId("") return nil } return fmt.Errorf("retrieving DataProtection BackupInstance (%q): %+v", id, err) } - vaultId := parse.NewBackupVaultID(id.SubscriptionId, id.ResourceGroup, id.BackupVaultName) - d.Set("name", id.Name) + vaultId := backupinstances.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.VaultName) + d.Set("name", id.BackupInstanceName) d.Set("vault_id", vaultId.ID()) - if props := resp.Properties; props != nil { - if props.DataSourceInfo != nil { + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("storage_account_id", props.DataSourceInfo.ResourceID) d.Set("location", props.DataSourceInfo.ResourceLocation) - } - if props.PolicyInfo != nil { - d.Set("backup_policy_id", props.PolicyInfo.PolicyID) + d.Set("backup_policy_id", props.PolicyInfo.PolicyId) } } return nil @@ -185,21 +179,15 @@ func resourceDataProtectionBackupInstanceBlobStorageDelete(d *schema.ResourceDat ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackupInstanceID(d.Id()) + id, err := backupinstances.ParseBackupInstanceID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + err = client.DeleteThenPoll(ctx, *id) if err != nil { - if response.WasNotFound(future.Response()) { - return nil - } - return fmt.Errorf("deleting DataProtection BackupInstance (%q): %+v", id, err) + return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of the DataProtection BackupInstance (%q): %+v", id.Name, err) - } return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_instance_disk_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_instance_disk_resource.go index 640bbe4cb38..3e427ab86ef 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_instance_disk_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_instance_disk_resource.go @@ -5,17 +5,17 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances" + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" computeParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" computeValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate" resourceParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" azSchema "github.com/hashicorp/terraform-provider-azurerm/internal/tf/schema" @@ -38,7 +38,7 @@ func resourceDataProtectionBackupInstanceDisk() *schema.Resource { }, Importer: azSchema.ValidateResourceIDPriorToImport(func(id string) error { - _, err := parse.BackupInstanceID(id) + _, err := backupinstances.ParseBackupInstanceID(id) return err }), @@ -55,7 +55,7 @@ func resourceDataProtectionBackupInstanceDisk() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.BackupVaultID, + ValidateFunc: backupinstances.ValidateBackupVaultID, }, "disk_id": { @@ -70,7 +70,7 @@ func resourceDataProtectionBackupInstanceDisk() *schema.Resource { "backup_policy_id": { Type: schema.TypeString, Required: true, - ValidateFunc: validate.BackupPolicyID, + ValidateFunc: backuppolicies.ValidateBackupPoliciesID, }, }, } @@ -83,46 +83,45 @@ func resourceDataProtectionBackupInstanceDiskCreateUpdate(d *schema.ResourceData defer cancel() name := d.Get("name").(string) - vaultId, _ := parse.BackupVaultID(d.Get("vault_id").(string)) - id := parse.NewBackupInstanceID(subscriptionId, vaultId.ResourceGroup, vaultId.Name, name) + vaultId, _ := backupinstances.ParseBackupVaultID(d.Get("vault_id").(string)) + id := backupinstances.NewBackupInstanceID(subscriptionId, vaultId.ResourceGroupName, vaultId.VaultName, name) if d.IsNewResource() { - existing, err := client.Get(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing DataProtection BackupInstance (%q): %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_data_protection_backup_instance_disk", id.ID()) } } diskId, _ := computeParse.ManagedDiskID(d.Get("disk_id").(string)) location := location.Normalize(d.Get("location").(string)) - policyId, _ := parse.BackupPolicyID(d.Get("backup_policy_id").(string)) + policyId, _ := backuppolicies.ParseBackupPoliciesID(d.Get("backup_policy_id").(string)) snapshotResourceGroupId := resourceParse.NewResourceGroupID(subscriptionId, d.Get("snapshot_resource_group_name").(string)) - parameters := dataprotection.BackupInstanceResource{ - Properties: &dataprotection.BackupInstance{ - DataSourceInfo: &dataprotection.Datasource{ + parameters := backupinstances.BackupInstanceResource{ + Properties: &backupinstances.BackupInstance{ + DataSourceInfo: backupinstances.Datasource{ DatasourceType: utils.String("Microsoft.Compute/disks"), ObjectType: utils.String("Datasource"), - ResourceID: utils.String(diskId.ID()), + ResourceID: diskId.ID(), ResourceLocation: utils.String(location), ResourceName: utils.String(diskId.DiskName), ResourceType: utils.String("Microsoft.Compute/disks"), - ResourceURI: utils.String(diskId.ID()), + ResourceUri: utils.String(diskId.ID()), }, - FriendlyName: utils.String(id.Name), - PolicyInfo: &dataprotection.PolicyInfo{ - PolicyID: utils.String(policyId.ID()), - PolicyParameters: &dataprotection.PolicyParameters{ - DataStoreParametersList: &[]dataprotection.BasicDataStoreParameters{ - dataprotection.AzureOperationalStoreParameters{ - ResourceGroupID: utils.String(snapshotResourceGroupId.ID()), - DataStoreType: dataprotection.DataStoreTypesOperationalStore, - ObjectType: dataprotection.ObjectTypeBasicDataStoreParametersObjectTypeAzureOperationalStoreParameters, + FriendlyName: utils.String(id.BackupInstanceName), + PolicyInfo: backupinstances.PolicyInfo{ + PolicyId: policyId.ID(), + PolicyParameters: &backupinstances.PolicyParameters{ + DataStoreParametersList: &[]backupinstances.DataStoreParameters{ + backupinstances.AzureOperationalStoreParameters{ + ResourceGroupId: utils.String(snapshotResourceGroupId.ID()), + DataStoreType: backupinstances.DataStoreTypesOperationalStore, }, }, }, @@ -130,22 +129,18 @@ func resourceDataProtectionBackupInstanceDiskCreateUpdate(d *schema.ResourceData }, } - future, err := client.CreateOrUpdate(ctx, id.BackupVaultName, id.ResourceGroup, id.Name, parameters) + err := client.CreateOrUpdateThenPoll(ctx, id, parameters) if err != nil { return fmt.Errorf("creating/updating DataProtection BackupInstance (%q): %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of the DataProtection BackupInstance (%q): %+v", id, err) - } - deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") } stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{string(dataprotection.StatusConfiguringProtection)}, - Target: []string{string(dataprotection.StatusProtectionConfigured)}, + Pending: []string{string(backupinstances.StatusConfiguringProtection)}, + Target: []string{string(backupinstances.StatusProtectionConfigured)}, Refresh: policyProtectionStateRefreshFunc(ctx, client, id), MinTimeout: 1 * time.Minute, Timeout: time.Until(deadline), @@ -164,39 +159,39 @@ func resourceDataProtectionBackupInstanceDiskRead(d *schema.ResourceData, meta i ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackupInstanceID(d.Id()) + id, err := backupinstances.ParseBackupInstanceID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] dataprotection %q does not exist - removing from state", d.Id()) d.SetId("") return nil } return fmt.Errorf("retrieving DataProtection BackupInstance (%q): %+v", id, err) } - vaultId := parse.NewBackupVaultID(id.SubscriptionId, id.ResourceGroup, id.BackupVaultName) - d.Set("name", id.Name) + vaultId := backupinstances.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.VaultName) + d.Set("name", id.BackupInstanceName) d.Set("vault_id", vaultId.ID()) - if props := resp.Properties; props != nil { - if props.DataSourceInfo != nil { + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { d.Set("disk_id", props.DataSourceInfo.ResourceID) d.Set("location", props.DataSourceInfo.ResourceLocation) - } - if props.PolicyInfo != nil { - d.Set("backup_policy_id", props.PolicyInfo.PolicyID) + + d.Set("backup_policy_id", props.PolicyInfo.PolicyId) if props.PolicyInfo.PolicyParameters != nil && props.PolicyInfo.PolicyParameters.DataStoreParametersList != nil && len(*props.PolicyInfo.PolicyParameters.DataStoreParametersList) > 0 { - if parameter, ok := (*props.PolicyInfo.PolicyParameters.DataStoreParametersList)[0].AsAzureOperationalStoreParameters(); ok { - if parameter.ResourceGroupID != nil { - resourceGroupId, err := resourceParse.ResourceGroupID(*parameter.ResourceGroupID) - if err != nil { - return err - } - d.Set("snapshot_resource_group_name", resourceGroupId.ResourceGroup) + parameter := (*props.PolicyInfo.PolicyParameters.DataStoreParametersList)[0].(backupinstances.AzureOperationalStoreParameters) + + if parameter.ResourceGroupId != nil { + resourceGroupId, err := resourceParse.ResourceGroupID(*parameter.ResourceGroupId) + if err != nil { + return err } + d.Set("snapshot_resource_group_name", resourceGroupId.ResourceGroup) } } } @@ -209,18 +204,15 @@ func resourceDataProtectionBackupInstanceDiskDelete(d *schema.ResourceData, meta ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackupInstanceID(d.Id()) + id, err := backupinstances.ParseBackupInstanceID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting DataProtection BackupInstance (%q): %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of the DataProtection BackupInstance (%q): %+v", id.Name, err) - } return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource.go index 4a514e2f396..f61bc4f73b0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_instance_postgresql_resource.go @@ -6,17 +6,17 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances" + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - postgresParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" - postgresValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" azSchema "github.com/hashicorp/terraform-provider-azurerm/internal/tf/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -38,7 +38,7 @@ func resourceDataProtectionBackupInstancePostgreSQL() *pluginsdk.Resource { }, Importer: azSchema.ValidateResourceIDPriorToImport(func(id string) error { - _, err := parse.BackupInstanceID(id) + _, err := backupinstances.ParseBackupInstanceID(id) return err }), @@ -55,20 +55,20 @@ func resourceDataProtectionBackupInstancePostgreSQL() *pluginsdk.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.BackupVaultID, + ValidateFunc: backupinstances.ValidateBackupVaultID, }, "database_id": { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: postgresValidate.DatabaseID, + ValidateFunc: databases.ValidateDatabaseID, }, "backup_policy_id": { Type: schema.TypeString, Required: true, - ValidateFunc: validate.BackupPolicyID, + ValidateFunc: backuppolicies.ValidateBackupPoliciesID, }, "database_credential_key_vault_secret_id": { @@ -87,71 +87,66 @@ func resourceDataProtectionBackupInstancePostgreSQLCreateUpdate(d *schema.Resour defer cancel() name := d.Get("name").(string) - vaultId, _ := parse.BackupVaultID(d.Get("vault_id").(string)) + vaultId, _ := backupinstances.ParseBackupVaultID(d.Get("vault_id").(string)) - id := parse.NewBackupInstanceID(subscriptionId, vaultId.ResourceGroup, vaultId.Name, name) + id := backupinstances.NewBackupInstanceID(subscriptionId, vaultId.ResourceGroupName, vaultId.VaultName, name) if d.IsNewResource() { - existing, err := client.Get(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing DataProtection BackupInstance (%q): %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_data_protection_backup_instance_postgresql", id.ID()) } } - databaseId, _ := postgresParse.DatabaseID(d.Get("database_id").(string)) + databaseId, _ := databases.ParseDatabaseID(d.Get("database_id").(string)) location := location.Normalize(d.Get("location").(string)) - serverId := postgresParse.NewServerID(databaseId.SubscriptionId, databaseId.ResourceGroup, databaseId.ServerName) - policyId, _ := parse.BackupPolicyID(d.Get("backup_policy_id").(string)) + serverId := servers.NewServerID(databaseId.SubscriptionId, databaseId.ResourceGroupName, databaseId.ServerName) + policyId, _ := backuppolicies.ParseBackupPoliciesID(d.Get("backup_policy_id").(string)) - parameters := dataprotection.BackupInstanceResource{ - Properties: &dataprotection.BackupInstance{ - DataSourceInfo: &dataprotection.Datasource{ + parameters := backupinstances.BackupInstanceResource{ + Properties: &backupinstances.BackupInstance{ + DataSourceInfo: backupinstances.Datasource{ DatasourceType: utils.String("Microsoft.DBforPostgreSQL/servers/databases"), ObjectType: utils.String("Datasource"), - ResourceID: utils.String(databaseId.ID()), + ResourceID: databaseId.ID(), ResourceLocation: utils.String(location), - ResourceName: utils.String(databaseId.Name), + ResourceName: utils.String(databaseId.DatabaseName), ResourceType: utils.String("Microsoft.DBforPostgreSQL/servers/databases"), - ResourceURI: utils.String(""), + ResourceUri: utils.String(""), }, - DataSourceSetInfo: &dataprotection.DatasourceSet{ + DataSourceSetInfo: &backupinstances.DatasourceSet{ DatasourceType: utils.String("Microsoft.DBForPostgreSQL/servers"), ObjectType: utils.String("DatasourceSet"), - ResourceID: utils.String(serverId.ID()), + ResourceID: serverId.ID(), ResourceLocation: utils.String(location), - ResourceName: utils.String(serverId.Name), + ResourceName: utils.String(serverId.ServerName), ResourceType: utils.String("Microsoft.DBForPostgreSQL/servers"), - ResourceURI: utils.String(""), + ResourceUri: utils.String(""), }, - FriendlyName: utils.String(id.Name), - PolicyInfo: &dataprotection.PolicyInfo{ - PolicyID: utils.String(policyId.ID()), + FriendlyName: utils.String(id.BackupInstanceName), + PolicyInfo: backupinstances.PolicyInfo{ + PolicyId: policyId.ID(), }, }, } if v, ok := d.GetOk("database_credential_key_vault_secret_id"); ok { - parameters.Properties.DatasourceAuthCredentials = &dataprotection.SecretStoreBasedAuthCredentials{ - SecretStoreResource: &dataprotection.SecretStoreResource{ - URI: utils.String(v.(string)), - SecretStoreType: dataprotection.SecretStoreTypeAzureKeyVault, + parameters.Properties.DatasourceAuthCredentials = backupinstances.SecretStoreBasedAuthCredentials{ + SecretStoreResource: &backupinstances.SecretStoreResource{ + Uri: utils.String(v.(string)), + SecretStoreType: backupinstances.SecretStoreTypeAzureKeyVault, }, - ObjectType: dataprotection.ObjectTypeSecretStoreBasedAuthCredentials, } } - future, err := client.CreateOrUpdate(ctx, id.BackupVaultName, id.ResourceGroup, id.Name, parameters) + err := client.CreateOrUpdateThenPoll(ctx, id, parameters) if err != nil { - return fmt.Errorf("creating/updating DataProtection BackupInstance (%q): %+v", id, err) - } - - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of the DataProtection BackupInstance (%q): %+v", id, err) + return fmt.Errorf("creating/updating %s: %+v", id, err) } deadline, ok := ctx.Deadline() @@ -159,8 +154,8 @@ func resourceDataProtectionBackupInstancePostgreSQLCreateUpdate(d *schema.Resour return fmt.Errorf("context had no deadline") } stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{string(dataprotection.StatusConfiguringProtection), "UpdatingProtection"}, - Target: []string{string(dataprotection.StatusProtectionConfigured)}, + Pending: []string{string(backupinstances.StatusConfiguringProtection), "UpdatingProtection"}, + Target: []string{string(backupinstances.StatusProtectionConfigured)}, Refresh: policyProtectionStateRefreshFunc(ctx, client, id), MinTimeout: 1 * time.Minute, Timeout: time.Until(deadline), @@ -179,35 +174,34 @@ func resourceDataProtectionBackupInstancePostgreSQLRead(d *schema.ResourceData, ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackupInstanceID(d.Id()) + id, err := backupinstances.ParseBackupInstanceID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] dataprotection %q does not exist - removing from state", d.Id()) d.SetId("") return nil } return fmt.Errorf("retrieving DataProtection BackupInstance (%q): %+v", id, err) } - vaultId := parse.NewBackupVaultID(id.SubscriptionId, id.ResourceGroup, id.BackupVaultName) - d.Set("name", id.Name) + vaultId := backupinstances.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.VaultName) + d.Set("name", id.BackupInstanceName) d.Set("vault_id", vaultId.ID()) - if props := resp.Properties; props != nil { - if props.DataSourceInfo != nil { + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { d.Set("database_id", props.DataSourceInfo.ResourceID) d.Set("location", props.DataSourceInfo.ResourceLocation) - } - if props.PolicyInfo != nil { - d.Set("backup_policy_id", props.PolicyInfo.PolicyID) - } - if props.DatasourceAuthCredentials != nil { - if credential, ok := props.DatasourceAuthCredentials.AsSecretStoreBasedAuthCredentials(); ok { + d.Set("backup_policy_id", props.PolicyInfo.PolicyId) + + if props.DatasourceAuthCredentials != nil { + credential := props.DatasourceAuthCredentials.(backupinstances.SecretStoreBasedAuthCredentials) if credential.SecretStoreResource != nil { - d.Set("database_credential_key_vault_secret_id", credential.SecretStoreResource.URI) + d.Set("database_credential_key_vault_secret_id", credential.SecretStoreResource.Uri) } } else { log.Printf("[DEBUG] Skipping setting database_credential_key_vault_secret_id since this DatasourceAuthCredentials is not supported") @@ -222,32 +216,29 @@ func resourceDataProtectionBackupInstancePostgreSQLDelete(d *schema.ResourceData ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackupInstanceID(d.Id()) + id, err := backupinstances.ParseBackupInstanceID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting DataProtection BackupInstance (%q): %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of the DataProtection BackupInstance (%q): %+v", id.Name, err) - } return nil } -func policyProtectionStateRefreshFunc(ctx context.Context, client *dataprotection.BackupInstancesClient, id parse.BackupInstanceId) pluginsdk.StateRefreshFunc { +func policyProtectionStateRefreshFunc(ctx context.Context, client *backupinstances.BackupInstancesClient, id backupinstances.BackupInstanceId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + res, err := client.Get(ctx, id) if err != nil { return nil, "", fmt.Errorf("retrieving DataProtection BackupInstance (%q): %+v", id, err) } - if res.Properties == nil || res.Properties.ProtectionStatus == nil { + if res.Model == nil || res.Model.Properties == nil || res.Model.Properties.ProtectionStatus == nil || res.Model.Properties.ProtectionStatus.Status == nil { return nil, "", fmt.Errorf("reading DataProtection BackupInstance (%q) protection status: %+v", id, err) } - return res, string(res.Properties.ProtectionStatus.Status), nil + return res, string(*res.Model.Properties.ProtectionStatus.Status), nil } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_policy_blob_storage_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_policy_blob_storage_resource.go index 6c01d0500c3..bbfdf86d6d8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_policy_blob_storage_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_policy_blob_storage_resource.go @@ -6,13 +6,12 @@ import ( "regexp" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" helperValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate" azSchema "github.com/hashicorp/terraform-provider-azurerm/internal/tf/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -33,7 +32,7 @@ func resourceDataProtectionBackupPolicyBlobStorage() *schema.Resource { }, Importer: azSchema.ValidateResourceIDPriorToImport(func(id string) error { - _, err := parse.BackupPolicyID(id) + _, err := backuppolicies.ParseBackupPoliciesID(id) return err }), @@ -52,7 +51,7 @@ func resourceDataProtectionBackupPolicyBlobStorage() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.BackupVaultID, + ValidateFunc: backuppolicies.ValidateBackupVaultID, }, "retention_duration": { @@ -72,47 +71,44 @@ func resourceDataProtectionBackupPolicyBlobStorageCreate(d *schema.ResourceData, defer cancel() name := d.Get("name").(string) - vaultId, _ := parse.BackupVaultID(d.Get("vault_id").(string)) - id := parse.NewBackupPolicyID(subscriptionId, vaultId.ResourceGroup, vaultId.Name, name) + vaultId, _ := backuppolicies.ParseBackupVaultID(d.Get("vault_id").(string)) + id := backuppolicies.NewBackupPoliciesID(subscriptionId, vaultId.ResourceGroupName, vaultId.VaultName, name) - existing, err := client.Get(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing DataProtection BackupPolicy (%q): %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_data_protection_backup_policy_blob_storage", id.ID()) } - parameters := dataprotection.BaseBackupPolicyResource{ - Properties: &dataprotection.BackupPolicy{ - PolicyRules: &[]dataprotection.BasicBasePolicyRule{ - dataprotection.AzureRetentionRule{ - Name: utils.String("Default"), - ObjectType: dataprotection.ObjectTypeBasicBasePolicyRuleObjectTypeAzureRetentionRule, - IsDefault: utils.Bool(true), - Lifecycles: &[]dataprotection.SourceLifeCycle{ + parameters := backuppolicies.BaseBackupPolicyResource{ + Properties: &backuppolicies.BackupPolicy{ + PolicyRules: []backuppolicies.BasePolicyRule{ + backuppolicies.AzureRetentionRule{ + Name: "Default", + IsDefault: utils.Bool(true), + Lifecycles: []backuppolicies.SourceLifeCycle{ { - DeleteAfter: dataprotection.AbsoluteDeleteOption{ - Duration: utils.String(d.Get("retention_duration").(string)), - ObjectType: dataprotection.ObjectTypeBasicDeleteOptionObjectTypeAbsoluteDeleteOption, + DeleteAfter: backuppolicies.AbsoluteDeleteOption{ + Duration: d.Get("retention_duration").(string), }, - SourceDataStore: &dataprotection.DataStoreInfoBase{ + SourceDataStore: backuppolicies.DataStoreInfoBase{ DataStoreType: "OperationalStore", - ObjectType: utils.String("DataStoreInfoBase"), + ObjectType: "DataStoreInfoBase", }, - TargetDataStoreCopySettings: &[]dataprotection.TargetCopySetting{}, + TargetDataStoreCopySettings: &[]backuppolicies.TargetCopySetting{}, }, }, }, }, - DatasourceTypes: &[]string{"Microsoft.Storage/storageAccounts/blobServices"}, - ObjectType: dataprotection.ObjectTypeBasicBaseBackupPolicyObjectTypeBackupPolicy, + DatasourceTypes: []string{"Microsoft.Storage/storageAccounts/blobServices"}, }, } - if _, err := client.CreateOrUpdate(ctx, id.BackupVaultName, id.ResourceGroup, id.Name, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating DataProtection BackupPolicy (%q): %+v", id, err) } @@ -125,27 +121,29 @@ func resourceDataProtectionBackupPolicyBlobStorageRead(d *schema.ResourceData, m ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackupPolicyID(d.Id()) + id, err := backuppolicies.ParseBackupPoliciesID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] dataprotection %q does not exist - removing from state", d.Id()) d.SetId("") return nil } return fmt.Errorf("retrieving DataProtection BackupPolicy (%q): %+v", id, err) } - vaultId := parse.NewBackupVaultID(id.SubscriptionId, id.ResourceGroup, id.BackupVaultName) - d.Set("name", id.Name) + vaultId := backuppolicies.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.VaultName) + d.Set("name", id.BackupPolicyName) d.Set("vault_id", vaultId.ID()) - if resp.Properties != nil { - if props, ok := resp.Properties.AsBackupPolicy(); ok { - if err := d.Set("retention_duration", flattenBackupPolicyBlobStorageDefaultRetentionRuleDuration(props.PolicyRules)); err != nil { - return fmt.Errorf("setting `default_retention_duration`: %+v", err) + if resp.Model != nil { + if resp.Model.Properties != nil { + if props, ok := resp.Model.Properties.(backuppolicies.BackupPolicy); ok { + if err := d.Set("retention_duration", flattenBackupPolicyBlobStorageDefaultRetentionRuleDuration(props.PolicyRules)); err != nil { + return fmt.Errorf("setting `default_retention_duration`: %+v", err) + } } } } @@ -157,13 +155,13 @@ func resourceDataProtectionBackupPolicyBlobStorageDelete(d *schema.ResourceData, ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackupPolicyID(d.Id()) + id, err := backuppolicies.ParseBackupPoliciesID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.BackupVaultName, id.ResourceGroup, id.Name); err != nil { - if utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id); err != nil { + if response.WasNotFound(resp.HttpResponse) { return nil } @@ -172,16 +170,16 @@ func resourceDataProtectionBackupPolicyBlobStorageDelete(d *schema.ResourceData, return nil } -func flattenBackupPolicyBlobStorageDefaultRetentionRuleDuration(input *[]dataprotection.BasicBasePolicyRule) interface{} { +func flattenBackupPolicyBlobStorageDefaultRetentionRuleDuration(input []backuppolicies.BasePolicyRule) interface{} { if input == nil { return nil } - for _, item := range *input { - if retentionRule, ok := item.AsAzureRetentionRule(); ok && retentionRule.IsDefault != nil && *retentionRule.IsDefault { - if retentionRule.Lifecycles != nil && len(*retentionRule.Lifecycles) > 0 { - if deleteOption, ok := (*retentionRule.Lifecycles)[0].DeleteAfter.AsAbsoluteDeleteOption(); ok { - return *deleteOption.Duration + for _, item := range input { + if retentionRule, ok := item.(backuppolicies.AzureRetentionRule); ok && retentionRule.IsDefault != nil && *retentionRule.IsDefault { + if retentionRule.Lifecycles != nil && len(retentionRule.Lifecycles) > 0 { + if deleteOption, ok := (retentionRule.Lifecycles)[0].DeleteAfter.(backuppolicies.AbsoluteDeleteOption); ok { + return deleteOption.Duration } } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_policy_disk_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_policy_disk_resource.go index 4c2a209cf35..60dd2cf3716 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_policy_disk_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_policy_disk_resource.go @@ -7,13 +7,12 @@ import ( "strings" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" helperValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate" azSchema "github.com/hashicorp/terraform-provider-azurerm/internal/tf/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -34,7 +33,7 @@ func resourceDataProtectionBackupPolicyDisk() *schema.Resource { }, Importer: azSchema.ValidateResourceIDPriorToImport(func(id string) error { - _, err := parse.BackupPolicyID(id) + _, err := backuppolicies.ParseBackupPoliciesID(id) return err }), @@ -53,7 +52,7 @@ func resourceDataProtectionBackupPolicyDisk() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.BackupVaultID, + ValidateFunc: backuppolicies.ValidateBackupVaultID, }, "backup_repeating_time_intervals": { @@ -104,8 +103,8 @@ func resourceDataProtectionBackupPolicyDisk() *schema.Resource { Optional: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(dataprotection.AbsoluteMarkerFirstOfDay), - string(dataprotection.AbsoluteMarkerFirstOfWeek), + string(backuppolicies.AbsoluteMarkerFirstOfDay), + string(backuppolicies.AbsoluteMarkerFirstOfWeek), }, false), }, }, @@ -131,33 +130,32 @@ func resourceDataProtectionBackupPolicyDiskCreate(d *schema.ResourceData, meta i defer cancel() name := d.Get("name").(string) - vaultId, _ := parse.BackupVaultID(d.Get("vault_id").(string)) - id := parse.NewBackupPolicyID(subscriptionId, vaultId.ResourceGroup, vaultId.Name, name) + vaultId, _ := backuppolicies.ParseBackupVaultID(d.Get("vault_id").(string)) + id := backuppolicies.NewBackupPoliciesID(subscriptionId, vaultId.ResourceGroupName, vaultId.VaultName, name) - existing, err := client.Get(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing DataProtection BackupPolicy (%q): %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_data_protection_backup_policy_disk", id.ID()) } taggingCriteria := expandBackupPolicyDiskTaggingCriteriaArray(d.Get("retention_rule").([]interface{})) - policyRules := make([]dataprotection.BasicBasePolicyRule, 0) + policyRules := make([]backuppolicies.BasePolicyRule, 0) policyRules = append(policyRules, expandBackupPolicyDiskAzureBackupRuleArray(d.Get("backup_repeating_time_intervals").([]interface{}), taggingCriteria)...) policyRules = append(policyRules, expandBackupPolicyDiskDefaultAzureRetentionRule(d.Get("default_retention_duration"))) policyRules = append(policyRules, expandBackupPolicyDiskAzureRetentionRuleArray(d.Get("retention_rule").([]interface{}))...) - parameters := dataprotection.BaseBackupPolicyResource{ - Properties: &dataprotection.BackupPolicy{ - PolicyRules: &policyRules, - DatasourceTypes: &[]string{"Microsoft.Compute/disks"}, - ObjectType: dataprotection.ObjectTypeBasicBaseBackupPolicyObjectTypeBackupPolicy, + parameters := backuppolicies.BaseBackupPolicyResource{ + Properties: &backuppolicies.BackupPolicy{ + PolicyRules: policyRules, + DatasourceTypes: []string{"Microsoft.Compute/disks"}, }, } - if _, err := client.CreateOrUpdate(ctx, id.BackupVaultName, id.ResourceGroup, id.Name, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating DataProtection BackupPolicy (%q): %+v", id, err) } @@ -170,33 +168,35 @@ func resourceDataProtectionBackupPolicyDiskRead(d *schema.ResourceData, meta int ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackupPolicyID(d.Id()) + id, err := backuppolicies.ParseBackupPoliciesID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] dataprotection %q does not exist - removing from state", d.Id()) d.SetId("") return nil } return fmt.Errorf("retrieving DataProtection BackupPolicy (%q): %+v", id, err) } - vaultId := parse.NewBackupVaultID(id.SubscriptionId, id.ResourceGroup, id.BackupVaultName) - d.Set("name", id.Name) + vaultId := backuppolicies.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.VaultName) + d.Set("name", id.BackupPolicyName) d.Set("vault_id", vaultId.ID()) - if resp.Properties != nil { - if props, ok := resp.Properties.AsBackupPolicy(); ok { - if err := d.Set("backup_repeating_time_intervals", flattenBackupPolicyDiskBackupRuleArray(props.PolicyRules)); err != nil { - return fmt.Errorf("setting `backup_repeating_time_intervals`: %+v", err) - } - if err := d.Set("default_retention_duration", flattenBackupPolicyDiskDefaultRetentionRuleDuration(props.PolicyRules)); err != nil { - return fmt.Errorf("setting `default_retention_duration`: %+v", err) - } - if err := d.Set("retention_rule", flattenBackupPolicyDiskRetentionRuleArray(props.PolicyRules)); err != nil { - return fmt.Errorf("setting `retention_rule`: %+v", err) + if resp.Model != nil { + if resp.Model.Properties != nil { + if props, ok := resp.Model.Properties.(backuppolicies.BackupPolicy); ok { + if err := d.Set("backup_repeating_time_intervals", flattenBackupPolicyDiskBackupRuleArray(&props.PolicyRules)); err != nil { + return fmt.Errorf("setting `backup_repeating_time_intervals`: %+v", err) + } + if err := d.Set("default_retention_duration", flattenBackupPolicyDiskDefaultRetentionRuleDuration(&props.PolicyRules)); err != nil { + return fmt.Errorf("setting `default_retention_duration`: %+v", err) + } + if err := d.Set("retention_rule", flattenBackupPolicyDiskRetentionRuleArray(&props.PolicyRules)); err != nil { + return fmt.Errorf("setting `retention_rule`: %+v", err) + } } } } @@ -208,13 +208,13 @@ func resourceDataProtectionBackupPolicyDiskDelete(d *schema.ResourceData, meta i ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackupPolicyID(d.Id()) + id, err := backuppolicies.ParseBackupPoliciesID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.BackupVaultName, id.ResourceGroup, id.Name); err != nil { - if utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id); err != nil { + if response.WasNotFound(resp.HttpResponse) { return nil } @@ -223,50 +223,45 @@ func resourceDataProtectionBackupPolicyDiskDelete(d *schema.ResourceData, meta i return nil } -func expandBackupPolicyDiskAzureBackupRuleArray(input []interface{}, taggingCriteria *[]dataprotection.TaggingCriteria) []dataprotection.BasicBasePolicyRule { - results := make([]dataprotection.BasicBasePolicyRule, 0) +func expandBackupPolicyDiskAzureBackupRuleArray(input []interface{}, taggingCriteria *[]backuppolicies.TaggingCriteria) []backuppolicies.BasePolicyRule { + results := make([]backuppolicies.BasePolicyRule, 0) - results = append(results, dataprotection.AzureBackupRule{ - Name: utils.String("BackupIntervals"), - ObjectType: dataprotection.ObjectTypeBasicBasePolicyRuleObjectTypeAzureBackupRule, - DataStore: &dataprotection.DataStoreInfoBase{ - DataStoreType: dataprotection.DataStoreTypesOperationalStore, - ObjectType: utils.String("DataStoreInfoBase"), + results = append(results, backuppolicies.AzureBackupRule{ + Name: "BackupIntervals", + DataStore: backuppolicies.DataStoreInfoBase{ + DataStoreType: backuppolicies.DataStoreTypesOperationalStore, + ObjectType: "DataStoreInfoBase", }, - BackupParameters: &dataprotection.AzureBackupParams{ - BackupType: utils.String("Incremental"), - ObjectType: dataprotection.ObjectTypeBasicBackupParametersObjectTypeAzureBackupParams, + BackupParameters: &backuppolicies.AzureBackupParams{ + BackupType: "Incremental", }, - Trigger: dataprotection.ScheduleBasedTriggerContext{ - Schedule: &dataprotection.BackupSchedule{ - RepeatingTimeIntervals: utils.ExpandStringSlice(input), + Trigger: backuppolicies.ScheduleBasedTriggerContext{ + Schedule: backuppolicies.BackupSchedule{ + RepeatingTimeIntervals: *utils.ExpandStringSlice(input), }, - TaggingCriteria: taggingCriteria, - ObjectType: dataprotection.ObjectTypeBasicTriggerContextObjectTypeScheduleBasedTriggerContext, + TaggingCriteria: *taggingCriteria, }, }) return results } -func expandBackupPolicyDiskAzureRetentionRuleArray(input []interface{}) []dataprotection.BasicBasePolicyRule { - results := make([]dataprotection.BasicBasePolicyRule, 0) +func expandBackupPolicyDiskAzureRetentionRuleArray(input []interface{}) []backuppolicies.BasePolicyRule { + results := make([]backuppolicies.BasePolicyRule, 0) for _, item := range input { v := item.(map[string]interface{}) - results = append(results, dataprotection.AzureRetentionRule{ - Name: utils.String(v["name"].(string)), - ObjectType: dataprotection.ObjectTypeBasicBasePolicyRuleObjectTypeAzureRetentionRule, - IsDefault: utils.Bool(false), - Lifecycles: &[]dataprotection.SourceLifeCycle{ + results = append(results, backuppolicies.AzureRetentionRule{ + Name: v["name"].(string), + IsDefault: utils.Bool(false), + Lifecycles: []backuppolicies.SourceLifeCycle{ { - DeleteAfter: dataprotection.AbsoluteDeleteOption{ - Duration: utils.String(v["duration"].(string)), - ObjectType: dataprotection.ObjectTypeBasicDeleteOptionObjectTypeAbsoluteDeleteOption, + DeleteAfter: backuppolicies.AbsoluteDeleteOption{ + Duration: v["duration"].(string), }, - SourceDataStore: &dataprotection.DataStoreInfoBase{ + SourceDataStore: backuppolicies.DataStoreInfoBase{ DataStoreType: "OperationalStore", - ObjectType: utils.String("DataStoreInfoBase"), + ObjectType: "DataStoreInfoBase", }, - TargetDataStoreCopySettings: &[]dataprotection.TargetCopySetting{}, + TargetDataStoreCopySettings: &[]backuppolicies.TargetCopySetting{}, }, }, }) @@ -274,81 +269,76 @@ func expandBackupPolicyDiskAzureRetentionRuleArray(input []interface{}) []datapr return results } -func expandBackupPolicyDiskDefaultAzureRetentionRule(input interface{}) dataprotection.BasicBasePolicyRule { - return dataprotection.AzureRetentionRule{ - Name: utils.String("Default"), - ObjectType: dataprotection.ObjectTypeBasicBasePolicyRuleObjectTypeAzureRetentionRule, - IsDefault: utils.Bool(true), - Lifecycles: &[]dataprotection.SourceLifeCycle{ +func expandBackupPolicyDiskDefaultAzureRetentionRule(input interface{}) backuppolicies.BasePolicyRule { + return backuppolicies.AzureRetentionRule{ + Name: "Default", + IsDefault: utils.Bool(true), + Lifecycles: []backuppolicies.SourceLifeCycle{ { - DeleteAfter: dataprotection.AbsoluteDeleteOption{ - Duration: utils.String(input.(string)), - ObjectType: dataprotection.ObjectTypeBasicDeleteOptionObjectTypeAbsoluteDeleteOption, + DeleteAfter: backuppolicies.AbsoluteDeleteOption{ + Duration: input.(string), }, - SourceDataStore: &dataprotection.DataStoreInfoBase{ + SourceDataStore: backuppolicies.DataStoreInfoBase{ DataStoreType: "OperationalStore", - ObjectType: utils.String("DataStoreInfoBase"), + ObjectType: "DataStoreInfoBase", }, - TargetDataStoreCopySettings: &[]dataprotection.TargetCopySetting{}, + TargetDataStoreCopySettings: &[]backuppolicies.TargetCopySetting{}, }, }, } } -func expandBackupPolicyDiskTaggingCriteriaArray(input []interface{}) *[]dataprotection.TaggingCriteria { - results := []dataprotection.TaggingCriteria{ +func expandBackupPolicyDiskTaggingCriteriaArray(input []interface{}) *[]backuppolicies.TaggingCriteria { + results := []backuppolicies.TaggingCriteria{ { Criteria: nil, - IsDefault: utils.Bool(true), - TaggingPriority: utils.Int64(99), - TagInfo: &dataprotection.RetentionTag{ - ID: utils.String("Default_"), - TagName: utils.String("Default"), + IsDefault: true, + TaggingPriority: 99, + TagInfo: backuppolicies.RetentionTag{ + Id: utils.String("Default_"), + TagName: "Default", }, }, } for _, item := range input { v := item.(map[string]interface{}) - results = append(results, dataprotection.TaggingCriteria{ + results = append(results, backuppolicies.TaggingCriteria{ Criteria: expandBackupPolicyDiskCriteriaArray(v["criteria"].([]interface{})), - IsDefault: utils.Bool(false), - TaggingPriority: utils.Int64(int64(v["priority"].(int))), - TagInfo: &dataprotection.RetentionTag{ - ID: utils.String(v["name"].(string) + "_"), - TagName: utils.String(v["name"].(string)), + IsDefault: false, + TaggingPriority: int64(v["priority"].(int)), + TagInfo: backuppolicies.RetentionTag{ + Id: utils.String(v["name"].(string) + "_"), + TagName: v["name"].(string), }, }) } return &results } -func expandBackupPolicyDiskCriteriaArray(input []interface{}) *[]dataprotection.BasicBackupCriteria { - results := make([]dataprotection.BasicBackupCriteria, 0) +func expandBackupPolicyDiskCriteriaArray(input []interface{}) *[]backuppolicies.BackupCriteria { + results := make([]backuppolicies.BackupCriteria, 0) for _, item := range input { v := item.(map[string]interface{}) - var absoluteCriteria []dataprotection.AbsoluteMarker + var absoluteCriteria []backuppolicies.AbsoluteMarker if absoluteCriteriaRaw := v["absolute_criteria"].(string); len(absoluteCriteriaRaw) > 0 { - absoluteCriteria = []dataprotection.AbsoluteMarker{dataprotection.AbsoluteMarker(absoluteCriteriaRaw)} + absoluteCriteria = []backuppolicies.AbsoluteMarker{backuppolicies.AbsoluteMarker(absoluteCriteriaRaw)} } - results = append(results, dataprotection.ScheduleBasedBackupCriteria{ + results = append(results, backuppolicies.ScheduleBasedBackupCriteria{ AbsoluteCriteria: &absoluteCriteria, - ObjectType: dataprotection.ObjectTypeBasicBackupCriteriaObjectTypeScheduleBasedBackupCriteria, }) } return &results } -func flattenBackupPolicyDiskBackupRuleArray(input *[]dataprotection.BasicBasePolicyRule) []interface{} { +func flattenBackupPolicyDiskBackupRuleArray(input *[]backuppolicies.BasePolicyRule) []interface{} { if input == nil { return make([]interface{}, 0) } for _, item := range *input { - if backupRule, ok := item.AsAzureBackupRule(); ok { + if backupRule, ok := item.(backuppolicies.AzureBackupRule); ok { if backupRule.Trigger != nil { - if scheduleBasedTrigger, ok := backupRule.Trigger.AsScheduleBasedTriggerContext(); ok { - if scheduleBasedTrigger.Schedule != nil { - return utils.FlattenStringSlice(scheduleBasedTrigger.Schedule.RepeatingTimeIntervals) - } + if scheduleBasedTrigger, ok := backupRule.Trigger.(backuppolicies.ScheduleBasedTriggerContext); ok { + return utils.FlattenStringSlice(&scheduleBasedTrigger.Schedule.RepeatingTimeIntervals) } } } @@ -356,16 +346,16 @@ func flattenBackupPolicyDiskBackupRuleArray(input *[]dataprotection.BasicBasePol return make([]interface{}, 0) } -func flattenBackupPolicyDiskDefaultRetentionRuleDuration(input *[]dataprotection.BasicBasePolicyRule) interface{} { +func flattenBackupPolicyDiskDefaultRetentionRuleDuration(input *[]backuppolicies.BasePolicyRule) interface{} { if input == nil { return nil } for _, item := range *input { - if retentionRule, ok := item.AsAzureRetentionRule(); ok && retentionRule.IsDefault != nil && *retentionRule.IsDefault { - if retentionRule.Lifecycles != nil && len(*retentionRule.Lifecycles) > 0 { - if deleteOption, ok := (*retentionRule.Lifecycles)[0].DeleteAfter.AsAbsoluteDeleteOption(); ok { - return *deleteOption.Duration + if retentionRule, ok := item.(backuppolicies.AzureRetentionRule); ok && retentionRule.IsDefault != nil && *retentionRule.IsDefault { + if retentionRule.Lifecycles != nil && len(retentionRule.Lifecycles) > 0 { + if deleteOption, ok := (retentionRule.Lifecycles)[0].DeleteAfter.(backuppolicies.AbsoluteDeleteOption); ok { + return deleteOption.Duration } } } @@ -373,41 +363,38 @@ func flattenBackupPolicyDiskDefaultRetentionRuleDuration(input *[]dataprotection return nil } -func flattenBackupPolicyDiskRetentionRuleArray(input *[]dataprotection.BasicBasePolicyRule) []interface{} { +func flattenBackupPolicyDiskRetentionRuleArray(input *[]backuppolicies.BasePolicyRule) []interface{} { results := make([]interface{}, 0) if input == nil { return results } - var taggingCriterias []dataprotection.TaggingCriteria + var taggingCriterias []backuppolicies.TaggingCriteria for _, item := range *input { - if backupRule, ok := item.AsAzureBackupRule(); ok { - if trigger, ok := backupRule.Trigger.AsScheduleBasedTriggerContext(); ok { + if backupRule, ok := item.(backuppolicies.AzureBackupRule); ok { + if trigger, ok := backupRule.Trigger.(backuppolicies.ScheduleBasedTriggerContext); ok { if trigger.TaggingCriteria != nil { - taggingCriterias = *trigger.TaggingCriteria + taggingCriterias = trigger.TaggingCriteria } } } } for _, item := range *input { - if retentionRule, ok := item.AsAzureRetentionRule(); ok && (retentionRule.IsDefault == nil || !*retentionRule.IsDefault) { - var name string - if retentionRule.Name != nil { - name = *retentionRule.Name - } + if retentionRule, ok := item.(backuppolicies.AzureRetentionRule); ok && (retentionRule.IsDefault == nil || !*retentionRule.IsDefault) { + name := retentionRule.Name var taggingPriority int64 var taggingCriteria []interface{} for _, criteria := range taggingCriterias { - if criteria.TagInfo != nil && criteria.TagInfo.TagName != nil && strings.EqualFold(*criteria.TagInfo.TagName, name) { - taggingPriority = *criteria.TaggingPriority + if strings.EqualFold(criteria.TagInfo.TagName, name) { + taggingPriority = criteria.TaggingPriority taggingCriteria = flattenBackupPolicyDiskBackupCriteriaArray(criteria.Criteria) } } var duration string - if retentionRule.Lifecycles != nil && len(*retentionRule.Lifecycles) > 0 { - if deleteOption, ok := (*retentionRule.Lifecycles)[0].DeleteAfter.AsAbsoluteDeleteOption(); ok { - duration = *deleteOption.Duration + if retentionRule.Lifecycles != nil && len(retentionRule.Lifecycles) > 0 { + if deleteOption, ok := (retentionRule.Lifecycles)[0].DeleteAfter.(backuppolicies.AbsoluteDeleteOption); ok { + duration = deleteOption.Duration } } results = append(results, map[string]interface{}{ @@ -421,14 +408,14 @@ func flattenBackupPolicyDiskRetentionRuleArray(input *[]dataprotection.BasicBase return results } -func flattenBackupPolicyDiskBackupCriteriaArray(input *[]dataprotection.BasicBackupCriteria) []interface{} { +func flattenBackupPolicyDiskBackupCriteriaArray(input *[]backuppolicies.BackupCriteria) []interface{} { results := make([]interface{}, 0) if input == nil { return results } for _, item := range *input { - if criteria, ok := item.AsScheduleBasedBackupCriteria(); ok { + if criteria, ok := item.(backuppolicies.ScheduleBasedBackupCriteria); ok { var absoluteCriteria string if criteria.AbsoluteCriteria != nil && len(*criteria.AbsoluteCriteria) > 0 { absoluteCriteria = string((*criteria.AbsoluteCriteria)[0]) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_policy_postgresql_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_policy_postgresql_resource.go index 7d4a3ecf50f..45ff75ddcd5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_policy_postgresql_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_policy_postgresql_resource.go @@ -7,13 +7,12 @@ import ( "strings" "time" - "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -34,7 +33,7 @@ func resourceDataProtectionBackupPolicyPostgreSQL() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.BackupPolicyID(id) + _, err := backuppolicies.ParseBackupPoliciesID(id) return err }), @@ -105,11 +104,11 @@ func resourceDataProtectionBackupPolicyPostgreSQL() *pluginsdk.Resource { Optional: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(dataprotection.AbsoluteMarkerAllBackup), - string(dataprotection.AbsoluteMarkerFirstOfDay), - string(dataprotection.AbsoluteMarkerFirstOfMonth), - string(dataprotection.AbsoluteMarkerFirstOfWeek), - string(dataprotection.AbsoluteMarkerFirstOfYear), + string(backuppolicies.AbsoluteMarkerAllBackup), + string(backuppolicies.AbsoluteMarkerFirstOfDay), + string(backuppolicies.AbsoluteMarkerFirstOfMonth), + string(backuppolicies.AbsoluteMarkerFirstOfWeek), + string(backuppolicies.AbsoluteMarkerFirstOfYear), }, false), }, @@ -154,11 +153,11 @@ func resourceDataProtectionBackupPolicyPostgreSQL() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - string(dataprotection.WeekNumberFirst), - string(dataprotection.WeekNumberSecond), - string(dataprotection.WeekNumberThird), - string(dataprotection.WeekNumberFourth), - string(dataprotection.WeekNumberLast), + string(backuppolicies.WeekNumberFirst), + string(backuppolicies.WeekNumberSecond), + string(backuppolicies.WeekNumberThird), + string(backuppolicies.WeekNumberFourth), + string(backuppolicies.WeekNumberLast), }, false), }, }, @@ -188,32 +187,35 @@ func resourceDataProtectionBackupPolicyPostgreSQLCreate(d *pluginsdk.ResourceDat resourceGroup := d.Get("resource_group_name").(string) vaultName := d.Get("vault_name").(string) - id := parse.NewBackupPolicyID(subscriptionId, resourceGroup, vaultName, name) + id := backuppolicies.NewBackupPoliciesID(subscriptionId, resourceGroup, vaultName, name) - existing, err := client.Get(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing DataProtection BackupPolicy (%q): %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_data_protection_backup_policy_postgresql", id.ID()) } - taggingCriteria := expandBackupPolicyPostgreSQLTaggingCriteriaArray(d.Get("retention_rule").([]interface{})) - policyRules := make([]dataprotection.BasicBasePolicyRule, 0) + taggingCriteria, err := expandBackupPolicyPostgreSQLTaggingCriteriaArray(d.Get("retention_rule").([]interface{})) + if err != nil { + return err + } + + policyRules := make([]backuppolicies.BasePolicyRule, 0) policyRules = append(policyRules, expandBackupPolicyPostgreSQLAzureBackupRuleArray(d.Get("backup_repeating_time_intervals").([]interface{}), taggingCriteria)...) policyRules = append(policyRules, expandBackupPolicyPostgreSQLDefaultAzureRetentionRule(d.Get("default_retention_duration"))) policyRules = append(policyRules, expandBackupPolicyPostgreSQLAzureRetentionRuleArray(d.Get("retention_rule").([]interface{}))...) - parameters := dataprotection.BaseBackupPolicyResource{ - Properties: &dataprotection.BackupPolicy{ - PolicyRules: &policyRules, - DatasourceTypes: &[]string{"Microsoft.DBforPostgreSQL/servers/databases"}, - ObjectType: dataprotection.ObjectTypeBasicBaseBackupPolicyObjectTypeBackupPolicy, + parameters := backuppolicies.BaseBackupPolicyResource{ + Properties: &backuppolicies.BackupPolicy{ + PolicyRules: policyRules, + DatasourceTypes: []string{"Microsoft.DBforPostgreSQL/servers/databases"}, }, } - if _, err := client.CreateOrUpdate(ctx, id.BackupVaultName, id.ResourceGroup, id.Name, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating DataProtection BackupPolicy (%q): %+v", id, err) } @@ -226,33 +228,36 @@ func resourceDataProtectionBackupPolicyPostgreSQLRead(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackupPolicyID(d.Id()) + id, err := backuppolicies.ParseBackupPoliciesID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.BackupVaultName, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] dataprotection %q does not exist - removing from state", d.Id()) d.SetId("") return nil } return fmt.Errorf("retrieving DataProtection BackupPolicy (%q): %+v", id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("vault_name", id.BackupVaultName) - if resp.Properties != nil { - if props, ok := resp.Properties.AsBackupPolicy(); ok { - if err := d.Set("backup_repeating_time_intervals", flattenBackupPolicyPostgreSQLBackupRuleArray(props.PolicyRules)); err != nil { - return fmt.Errorf("setting `backup_rule`: %+v", err) - } - if err := d.Set("default_retention_duration", flattenBackupPolicyPostgreSQLDefaultRetentionRuleDuration(props.PolicyRules)); err != nil { - return fmt.Errorf("setting `default_retention_duration`: %+v", err) - } - if err := d.Set("retention_rule", flattenBackupPolicyPostgreSQLRetentionRuleArray(props.PolicyRules)); err != nil { - return fmt.Errorf("setting `retention_rule`: %+v", err) + d.Set("name", id.BackupPolicyName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("vault_name", id.VaultName) + + if resp.Model != nil { + if resp.Model.Properties != nil { + if props, ok := resp.Model.Properties.(backuppolicies.BackupPolicy); ok { + if err := d.Set("backup_repeating_time_intervals", flattenBackupPolicyPostgreSQLBackupRuleArray(&props.PolicyRules)); err != nil { + return fmt.Errorf("setting `backup_rule`: %+v", err) + } + if err := d.Set("default_retention_duration", flattenBackupPolicyPostgreSQLDefaultRetentionRuleDuration(&props.PolicyRules)); err != nil { + return fmt.Errorf("setting `default_retention_duration`: %+v", err) + } + if err := d.Set("retention_rule", flattenBackupPolicyPostgreSQLRetentionRuleArray(&props.PolicyRules)); err != nil { + return fmt.Errorf("setting `retention_rule`: %+v", err) + } } } } @@ -264,13 +269,13 @@ func resourceDataProtectionBackupPolicyPostgreSQLDelete(d *pluginsdk.ResourceDat ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackupPolicyID(d.Id()) + id, err := backuppolicies.ParseBackupPoliciesID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.BackupVaultName, id.ResourceGroup, id.Name); err != nil { - if utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id); err != nil { + if response.WasNotFound(resp.HttpResponse) { return nil } @@ -279,50 +284,45 @@ func resourceDataProtectionBackupPolicyPostgreSQLDelete(d *pluginsdk.ResourceDat return nil } -func expandBackupPolicyPostgreSQLAzureBackupRuleArray(input []interface{}, taggingCriteria *[]dataprotection.TaggingCriteria) []dataprotection.BasicBasePolicyRule { - results := make([]dataprotection.BasicBasePolicyRule, 0) - results = append(results, dataprotection.AzureBackupRule{ - Name: utils.String("BackupIntervals"), - ObjectType: dataprotection.ObjectTypeBasicBasePolicyRuleObjectTypeAzureBackupRule, - DataStore: &dataprotection.DataStoreInfoBase{ - DataStoreType: dataprotection.DataStoreTypesVaultStore, - ObjectType: utils.String("DataStoreInfoBase"), +func expandBackupPolicyPostgreSQLAzureBackupRuleArray(input []interface{}, taggingCriteria *[]backuppolicies.TaggingCriteria) []backuppolicies.BasePolicyRule { + results := make([]backuppolicies.BasePolicyRule, 0) + results = append(results, backuppolicies.AzureBackupRule{ + Name: "BackupIntervals", + DataStore: backuppolicies.DataStoreInfoBase{ + DataStoreType: backuppolicies.DataStoreTypesVaultStore, + ObjectType: "DataStoreInfoBase", }, - BackupParameters: &dataprotection.AzureBackupParams{ - BackupType: utils.String("Full"), - ObjectType: dataprotection.ObjectTypeBasicBackupParametersObjectTypeAzureBackupParams, + BackupParameters: &backuppolicies.AzureBackupParams{ + BackupType: "Full", }, - Trigger: dataprotection.ScheduleBasedTriggerContext{ - Schedule: &dataprotection.BackupSchedule{ - RepeatingTimeIntervals: utils.ExpandStringSlice(input), + Trigger: backuppolicies.ScheduleBasedTriggerContext{ + Schedule: backuppolicies.BackupSchedule{ + RepeatingTimeIntervals: *utils.ExpandStringSlice(input), }, - TaggingCriteria: taggingCriteria, - ObjectType: dataprotection.ObjectTypeBasicTriggerContextObjectTypeScheduleBasedTriggerContext, + TaggingCriteria: *taggingCriteria, }, }) return results } -func expandBackupPolicyPostgreSQLAzureRetentionRuleArray(input []interface{}) []dataprotection.BasicBasePolicyRule { - results := make([]dataprotection.BasicBasePolicyRule, 0) +func expandBackupPolicyPostgreSQLAzureRetentionRuleArray(input []interface{}) []backuppolicies.BasePolicyRule { + results := make([]backuppolicies.BasePolicyRule, 0) for _, item := range input { v := item.(map[string]interface{}) - results = append(results, dataprotection.AzureRetentionRule{ - Name: utils.String(v["name"].(string)), - ObjectType: dataprotection.ObjectTypeBasicBasePolicyRuleObjectTypeAzureRetentionRule, - IsDefault: utils.Bool(false), - Lifecycles: &[]dataprotection.SourceLifeCycle{ + results = append(results, backuppolicies.AzureRetentionRule{ + Name: v["name"].(string), + IsDefault: utils.Bool(false), + Lifecycles: []backuppolicies.SourceLifeCycle{ { - DeleteAfter: dataprotection.AbsoluteDeleteOption{ - Duration: utils.String(v["duration"].(string)), - ObjectType: dataprotection.ObjectTypeBasicDeleteOptionObjectTypeAbsoluteDeleteOption, + DeleteAfter: backuppolicies.AbsoluteDeleteOption{ + Duration: v["duration"].(string), }, - SourceDataStore: &dataprotection.DataStoreInfoBase{ + SourceDataStore: backuppolicies.DataStoreInfoBase{ DataStoreType: "VaultStore", - ObjectType: utils.String("DataStoreInfoBase"), + ObjectType: "DataStoreInfoBase", }, - TargetDataStoreCopySettings: &[]dataprotection.TargetCopySetting{}, + TargetDataStoreCopySettings: &[]backuppolicies.TargetCopySetting{}, }, }, }) @@ -330,119 +330,122 @@ func expandBackupPolicyPostgreSQLAzureRetentionRuleArray(input []interface{}) [] return results } -func expandBackupPolicyPostgreSQLDefaultAzureRetentionRule(input interface{}) dataprotection.BasicBasePolicyRule { - return dataprotection.AzureRetentionRule{ - Name: utils.String("Default"), - ObjectType: dataprotection.ObjectTypeBasicBasePolicyRuleObjectTypeAzureRetentionRule, - IsDefault: utils.Bool(true), - Lifecycles: &[]dataprotection.SourceLifeCycle{ +func expandBackupPolicyPostgreSQLDefaultAzureRetentionRule(input interface{}) backuppolicies.BasePolicyRule { + return backuppolicies.AzureRetentionRule{ + Name: "Default", + IsDefault: utils.Bool(true), + Lifecycles: []backuppolicies.SourceLifeCycle{ { - DeleteAfter: dataprotection.AbsoluteDeleteOption{ - Duration: utils.String(input.(string)), - ObjectType: dataprotection.ObjectTypeBasicDeleteOptionObjectTypeAbsoluteDeleteOption, + DeleteAfter: backuppolicies.AbsoluteDeleteOption{ + Duration: input.(string), }, - SourceDataStore: &dataprotection.DataStoreInfoBase{ + SourceDataStore: backuppolicies.DataStoreInfoBase{ DataStoreType: "VaultStore", - ObjectType: utils.String("DataStoreInfoBase"), + ObjectType: "DataStoreInfoBase", }, - TargetDataStoreCopySettings: &[]dataprotection.TargetCopySetting{}, + TargetDataStoreCopySettings: &[]backuppolicies.TargetCopySetting{}, }, }, } } -func expandBackupPolicyPostgreSQLTaggingCriteriaArray(input []interface{}) *[]dataprotection.TaggingCriteria { - results := []dataprotection.TaggingCriteria{ +func expandBackupPolicyPostgreSQLTaggingCriteriaArray(input []interface{}) (*[]backuppolicies.TaggingCriteria, error) { + results := []backuppolicies.TaggingCriteria{ + { Criteria: nil, - IsDefault: utils.Bool(true), - TaggingPriority: utils.Int64(99), - TagInfo: &dataprotection.RetentionTag{ - ID: utils.String("Default_"), - TagName: utils.String("Default"), + IsDefault: true, + TaggingPriority: 99, + TagInfo: backuppolicies.RetentionTag{ + Id: utils.String("Default_"), + TagName: "Default", }, }, } for _, item := range input { v := item.(map[string]interface{}) - results = append(results, dataprotection.TaggingCriteria{ - Criteria: expandBackupPolicyPostgreSQLCriteriaArray(v["criteria"].([]interface{})), - IsDefault: utils.Bool(false), - TaggingPriority: utils.Int64(int64(v["priority"].(int))), - TagInfo: &dataprotection.RetentionTag{ - ID: utils.String(v["name"].(string) + "_"), - TagName: utils.String(v["name"].(string)), + result := backuppolicies.TaggingCriteria{ + IsDefault: false, + TaggingPriority: int64(v["priority"].(int)), + TagInfo: backuppolicies.RetentionTag{ + Id: utils.String(v["name"].(string) + "_"), + TagName: v["name"].(string), }, - }) + } + + criteria, err := expandBackupPolicyPostgreSQLCriteriaArray(v["criteria"].([]interface{})) + if err != nil { + return nil, err + } + result.Criteria = criteria + + results = append(results, result) } - return &results + return &results, nil } -func expandBackupPolicyPostgreSQLCriteriaArray(input []interface{}) *[]dataprotection.BasicBackupCriteria { - results := make([]dataprotection.BasicBackupCriteria, 0) +func expandBackupPolicyPostgreSQLCriteriaArray(input []interface{}) (*[]backuppolicies.BackupCriteria, error) { + if len(input) == 0 || input[0] == nil { + return nil, fmt.Errorf("criteria is a required field, cannot leave blank") + } + results := make([]backuppolicies.BackupCriteria, 0) + for _, item := range input { v := item.(map[string]interface{}) - var absoluteCriteria []dataprotection.AbsoluteMarker + var absoluteCriteria []backuppolicies.AbsoluteMarker if absoluteCriteriaRaw := v["absolute_criteria"].(string); len(absoluteCriteriaRaw) > 0 { - absoluteCriteria = []dataprotection.AbsoluteMarker{dataprotection.AbsoluteMarker(absoluteCriteriaRaw)} + absoluteCriteria = []backuppolicies.AbsoluteMarker{backuppolicies.AbsoluteMarker(absoluteCriteriaRaw)} } - var daysOfWeek []dataprotection.DayOfWeek + var daysOfWeek []backuppolicies.DayOfWeek if v["days_of_week"].(*pluginsdk.Set).Len() > 0 { - daysOfWeek = make([]dataprotection.DayOfWeek, 0) + daysOfWeek = make([]backuppolicies.DayOfWeek, 0) for _, value := range v["days_of_week"].(*pluginsdk.Set).List() { - daysOfWeek = append(daysOfWeek, dataprotection.DayOfWeek(value.(string))) + daysOfWeek = append(daysOfWeek, backuppolicies.DayOfWeek(value.(string))) } } - var monthsOfYear []dataprotection.Month + var monthsOfYear []backuppolicies.Month if v["months_of_year"].(*pluginsdk.Set).Len() > 0 { - monthsOfYear = make([]dataprotection.Month, 0) + monthsOfYear = make([]backuppolicies.Month, 0) for _, value := range v["months_of_year"].(*pluginsdk.Set).List() { - monthsOfYear = append(monthsOfYear, dataprotection.Month(value.(string))) + monthsOfYear = append(monthsOfYear, backuppolicies.Month(value.(string))) } } - var weeksOfMonth []dataprotection.WeekNumber + var weeksOfMonth []backuppolicies.WeekNumber if v["weeks_of_month"].(*pluginsdk.Set).Len() > 0 { - weeksOfMonth = make([]dataprotection.WeekNumber, 0) + weeksOfMonth = make([]backuppolicies.WeekNumber, 0) for _, value := range v["weeks_of_month"].(*pluginsdk.Set).List() { - weeksOfMonth = append(weeksOfMonth, dataprotection.WeekNumber(value.(string))) + weeksOfMonth = append(weeksOfMonth, backuppolicies.WeekNumber(value.(string))) } } - var scheduleTimes []date.Time + var scheduleTimes *[]string if v["scheduled_backup_times"].(*pluginsdk.Set).Len() > 0 { - scheduleTimes = make([]date.Time, 0) - for _, value := range v["scheduled_backup_times"].(*pluginsdk.Set).List() { - t, _ := time.Parse(time.RFC3339, value.(string)) - scheduleTimes = append(scheduleTimes, date.Time{Time: t}) - } + scheduleTimes = utils.ExpandStringSlice(v["scheduled_backup_times"].(*pluginsdk.Set).List()) } - results = append(results, dataprotection.ScheduleBasedBackupCriteria{ + results = append(results, backuppolicies.ScheduleBasedBackupCriteria{ AbsoluteCriteria: &absoluteCriteria, DaysOfMonth: nil, DaysOfTheWeek: &daysOfWeek, MonthsOfYear: &monthsOfYear, - ScheduleTimes: &scheduleTimes, + ScheduleTimes: scheduleTimes, WeeksOfTheMonth: &weeksOfMonth, - ObjectType: dataprotection.ObjectTypeBasicBackupCriteriaObjectTypeScheduleBasedBackupCriteria, }) } - return &results + return &results, nil } -func flattenBackupPolicyPostgreSQLBackupRuleArray(input *[]dataprotection.BasicBasePolicyRule) []interface{} { +func flattenBackupPolicyPostgreSQLBackupRuleArray(input *[]backuppolicies.BasePolicyRule) []interface{} { if input == nil { return make([]interface{}, 0) } for _, item := range *input { - if backupRule, ok := item.AsAzureBackupRule(); ok { + if backupRule, ok := item.(backuppolicies.AzureBackupRule); ok { if backupRule.Trigger != nil { - if scheduleBasedTrigger, ok := backupRule.Trigger.AsScheduleBasedTriggerContext(); ok { - if scheduleBasedTrigger.Schedule != nil { - return utils.FlattenStringSlice(scheduleBasedTrigger.Schedule.RepeatingTimeIntervals) - } + if scheduleBasedTrigger, ok := backupRule.Trigger.(backuppolicies.ScheduleBasedTriggerContext); ok { + return utils.FlattenStringSlice(&scheduleBasedTrigger.Schedule.RepeatingTimeIntervals) } } } @@ -450,16 +453,16 @@ func flattenBackupPolicyPostgreSQLBackupRuleArray(input *[]dataprotection.BasicB return make([]interface{}, 0) } -func flattenBackupPolicyPostgreSQLDefaultRetentionRuleDuration(input *[]dataprotection.BasicBasePolicyRule) interface{} { +func flattenBackupPolicyPostgreSQLDefaultRetentionRuleDuration(input *[]backuppolicies.BasePolicyRule) interface{} { if input == nil { return nil } for _, item := range *input { - if retentionRule, ok := item.AsAzureRetentionRule(); ok && retentionRule.IsDefault != nil && *retentionRule.IsDefault { - if retentionRule.Lifecycles != nil && len(*retentionRule.Lifecycles) > 0 { - if deleteOption, ok := (*retentionRule.Lifecycles)[0].DeleteAfter.AsAbsoluteDeleteOption(); ok { - return *deleteOption.Duration + if retentionRule, ok := item.(backuppolicies.AzureRetentionRule); ok && retentionRule.IsDefault != nil && *retentionRule.IsDefault { + if retentionRule.Lifecycles != nil && len(retentionRule.Lifecycles) > 0 { + if deleteOption, ok := (retentionRule.Lifecycles)[0].DeleteAfter.(backuppolicies.AbsoluteDeleteOption); ok { + return deleteOption.Duration } } } @@ -467,41 +470,38 @@ func flattenBackupPolicyPostgreSQLDefaultRetentionRuleDuration(input *[]dataprot return nil } -func flattenBackupPolicyPostgreSQLRetentionRuleArray(input *[]dataprotection.BasicBasePolicyRule) []interface{} { +func flattenBackupPolicyPostgreSQLRetentionRuleArray(input *[]backuppolicies.BasePolicyRule) []interface{} { results := make([]interface{}, 0) if input == nil { return results } - var taggingCriterias []dataprotection.TaggingCriteria + var taggingCriterias []backuppolicies.TaggingCriteria for _, item := range *input { - if backupRule, ok := item.AsAzureBackupRule(); ok { - if trigger, ok := backupRule.Trigger.AsScheduleBasedTriggerContext(); ok { + if backupRule, ok := item.(backuppolicies.AzureBackupRule); ok { + if trigger, ok := backupRule.Trigger.(backuppolicies.ScheduleBasedTriggerContext); ok { if trigger.TaggingCriteria != nil { - taggingCriterias = *trigger.TaggingCriteria + taggingCriterias = trigger.TaggingCriteria } } } } for _, item := range *input { - if retentionRule, ok := item.AsAzureRetentionRule(); ok && (retentionRule.IsDefault == nil || !*retentionRule.IsDefault) { - var name string - if retentionRule.Name != nil { - name = *retentionRule.Name - } + if retentionRule, ok := item.(backuppolicies.AzureRetentionRule); ok && (retentionRule.IsDefault == nil || !*retentionRule.IsDefault) { + name := retentionRule.Name var taggingPriority int64 var taggingCriteria []interface{} for _, criteria := range taggingCriterias { - if criteria.TagInfo != nil && criteria.TagInfo.TagName != nil && strings.EqualFold(*criteria.TagInfo.TagName, name) { - taggingPriority = *criteria.TaggingPriority + if strings.EqualFold(criteria.TagInfo.TagName, name) { + taggingPriority = criteria.TaggingPriority taggingCriteria = flattenBackupPolicyPostgreSQLBackupCriteriaArray(criteria.Criteria) } } var duration string - if retentionRule.Lifecycles != nil && len(*retentionRule.Lifecycles) > 0 { - if deleteOption, ok := (*retentionRule.Lifecycles)[0].DeleteAfter.AsAbsoluteDeleteOption(); ok { - duration = *deleteOption.Duration + if retentionRule.Lifecycles != nil && len(retentionRule.Lifecycles) > 0 { + if deleteOption, ok := (retentionRule.Lifecycles)[0].DeleteAfter.(backuppolicies.AbsoluteDeleteOption); ok { + duration = deleteOption.Duration } } results = append(results, map[string]interface{}{ @@ -515,14 +515,14 @@ func flattenBackupPolicyPostgreSQLRetentionRuleArray(input *[]dataprotection.Bas return results } -func flattenBackupPolicyPostgreSQLBackupCriteriaArray(input *[]dataprotection.BasicBackupCriteria) []interface{} { +func flattenBackupPolicyPostgreSQLBackupCriteriaArray(input *[]backuppolicies.BackupCriteria) []interface{} { results := make([]interface{}, 0) if input == nil { return results } for _, item := range *input { - if criteria, ok := item.AsScheduleBasedBackupCriteria(); ok { + if criteria, ok := item.(backuppolicies.ScheduleBasedBackupCriteria); ok { var absoluteCriteria string if criteria.AbsoluteCriteria != nil && len(*criteria.AbsoluteCriteria) > 0 { absoluteCriteria = string((*criteria.AbsoluteCriteria)[0]) @@ -552,7 +552,7 @@ func flattenBackupPolicyPostgreSQLBackupCriteriaArray(input *[]dataprotection.Ba if criteria.ScheduleTimes != nil { scheduleTimes = make([]string, 0) for _, item := range *criteria.ScheduleTimes { - scheduleTimes = append(scheduleTimes, item.String()) + scheduleTimes = append(scheduleTimes, item) } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_vault_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_vault_data_source.go index 9efe7a7a14b..e64b9b9d848 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_vault_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_vault_data_source.go @@ -6,17 +6,16 @@ import ( "regexp" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceDataProtectionBackupVault() *pluginsdk.Resource { @@ -28,7 +27,7 @@ func dataSourceDataProtectionBackupVault() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.BackupVaultID(id) + _, err := backupvaults.ParseBackupVaultID(id) return err }), @@ -72,11 +71,11 @@ func dataSourceDataProtectionBackupVaultRead(d *pluginsdk.ResourceData, meta int name := d.Get("name").(string) resourceGroup := d.Get("resource_group_name").(string) - id := parse.NewBackupVaultID(subscriptionId, resourceGroup, name) + id := backupvaults.NewBackupVaultID(subscriptionId, resourceGroup, name) - resp, err := client.Get(ctx, id.Name, id.ResourceGroup) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] DataProtection BackupVault %q does not exist - removing from state", d.Id()) d.SetId("") return nil @@ -85,32 +84,40 @@ func dataSourceDataProtectionBackupVaultRead(d *pluginsdk.ResourceData, meta int } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - if props := resp.Properties; props != nil { - if props.StorageSettings != nil && len(*props.StorageSettings) > 0 { - d.Set("datastore_type", (*props.StorageSettings)[0].DatastoreType) - d.Set("redundancy", (*props.StorageSettings)[0].Type) + d.Set("name", id.VaultName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) + + props := model.Properties + if props.StorageSettings != nil && len(props.StorageSettings) > 0 { + d.Set("datastore_type", (props.StorageSettings)[0].DatastoreType) + d.Set("redundancy", (props.StorageSettings)[0].Type) + } + + if err = d.Set("identity", dataSourceFlattenBackupVaultDppIdentityDetails(model.Identity)); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } + + if err = tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + return err } } - if err := d.Set("identity", dataSourceFlattenBackupVaultDppIdentityDetails(resp.Identity)); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) - } - return tags.FlattenAndSet(d, resp.Tags) + return nil } -func dataSourceFlattenBackupVaultDppIdentityDetails(input *dataprotection.DppIdentityDetails) []interface{} { +func dataSourceFlattenBackupVaultDppIdentityDetails(input *backupvaults.DppIdentityDetails) []interface{} { var config *identity.SystemAssigned if input != nil { principalId := "" - if input.PrincipalID != nil { - principalId = *input.PrincipalID + if input.PrincipalId != nil { + principalId = *input.PrincipalId } tenantId := "" - if input.TenantID != nil { - tenantId = *input.TenantID + if input.TenantId != nil { + tenantId = *input.TenantId } config = &identity.SystemAssigned{ Type: identity.Type(*input.Type), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_vault_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_vault_resource.go index 67e5be458aa..96dfc7f637a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_vault_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_backup_vault_resource.go @@ -6,14 +6,14 @@ import ( "regexp" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -36,7 +36,7 @@ func resourceDataProtectionBackupVault() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.BackupVaultID(id) + _, err := backupvaults.ParseBackupVaultIDInsensitively(id) return err }), @@ -60,9 +60,9 @@ func resourceDataProtectionBackupVault() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(dataprotection.StorageSettingStoreTypesArchiveStore), - string(dataprotection.StorageSettingStoreTypesSnapshotStore), - string(dataprotection.StorageSettingStoreTypesVaultStore), + string(backupvaults.StorageSettingStoreTypesArchiveStore), + string(backupvaults.StorageSettingStoreTypesSnapshotStore), + string(backupvaults.StorageSettingStoreTypesVaultStore), }, false), }, @@ -71,8 +71,8 @@ func resourceDataProtectionBackupVault() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(dataprotection.StorageSettingTypesGeoRedundant), - string(dataprotection.StorageSettingTypesLocallyRedundant), + string(backupvaults.StorageSettingTypesGeoRedundant), + string(backupvaults.StorageSettingTypesLocallyRedundant), }, false), }, @@ -92,16 +92,16 @@ func resourceDataProtectionBackupVaultCreateUpdate(d *pluginsdk.ResourceData, me name := d.Get("name").(string) resourceGroup := d.Get("resource_group_name").(string) - id := parse.NewBackupVaultID(subscriptionId, resourceGroup, name) + id := backupvaults.NewBackupVaultID(subscriptionId, resourceGroup, name) if d.IsNewResource() { - existing, err := client.Get(ctx, id.Name, id.ResourceGroup) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing DataProtection BackupVault (%q): %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_data_protection_backup_vault", id.ID()) } } @@ -111,28 +111,27 @@ func resourceDataProtectionBackupVaultCreateUpdate(d *pluginsdk.ResourceData, me return fmt.Errorf("expanding `identity`: %+v", err) } - parameters := dataprotection.BackupVaultResource{ - Location: utils.String(location.Normalize(d.Get("location").(string))), - Properties: &dataprotection.BackupVault{ - StorageSettings: &[]dataprotection.StorageSetting{ + datastoreType := backupvaults.StorageSettingStoreTypes(d.Get("datastore_type").(string)) + storageSettingType := backupvaults.StorageSettingTypes(d.Get("redundancy").(string)) + + parameters := backupvaults.BackupVaultResource{ + Location: location.Normalize(d.Get("location").(string)), + Properties: backupvaults.BackupVault{ + StorageSettings: []backupvaults.StorageSetting{ { - DatastoreType: dataprotection.StorageSettingStoreTypes(d.Get("datastore_type").(string)), - Type: dataprotection.StorageSettingTypes(d.Get("redundancy").(string)), + DatastoreType: &datastoreType, + Type: &storageSettingType, }, }, }, Identity: expandedIdentity, - Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + Tags: expandTags(d.Get("tags").(map[string]interface{})), } - future, err := client.CreateOrUpdate(ctx, id.Name, id.ResourceGroup, parameters) + err = client.CreateOrUpdateThenPoll(ctx, id, parameters) if err != nil { return fmt.Errorf("creating DataProtection BackupVault (%q): %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of the DataProtection BackupVault (%q): %+v", id, err) - } - d.SetId(id.ID()) return resourceDataProtectionBackupVaultRead(d, meta) } @@ -142,33 +141,40 @@ func resourceDataProtectionBackupVaultRead(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackupVaultID(d.Id()) + id, err := backupvaults.ParseBackupVaultID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.Name, id.ResourceGroup) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] DataProtection BackupVault %q does not exist - removing from state", d.Id()) d.SetId("") return nil } return fmt.Errorf("retrieving DataProtection BackupVault (%q): %+v", id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - if props := resp.Properties; props != nil { - if props.StorageSettings != nil && len(*props.StorageSettings) > 0 { - d.Set("datastore_type", (*props.StorageSettings)[0].DatastoreType) - d.Set("redundancy", (*props.StorageSettings)[0].Type) + d.Set("name", id.VaultName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) + props := model.Properties + if props.StorageSettings != nil && len(props.StorageSettings) > 0 { + d.Set("datastore_type", (props.StorageSettings)[0].DatastoreType) + d.Set("redundancy", (props.StorageSettings)[0].Type) + } + + if err = d.Set("identity", flattenBackupVaultDppIdentityDetails(model.Identity)); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } + if err = tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + return err } } - if err := d.Set("identity", flattenBackupVaultDppIdentityDetails(resp.Identity)); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) - } - return tags.FlattenAndSet(d, resp.Tags) + + return nil } func resourceDataProtectionBackupVaultDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -176,13 +182,13 @@ func resourceDataProtectionBackupVaultDelete(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.BackupVaultID(d.Id()) + id, err := backupvaults.ParseBackupVaultID(d.Id()) if err != nil { return err } - if resp, err := client.Delete(ctx, id.Name, id.ResourceGroup); err != nil { - if utils.ResponseWasNotFound(resp) { + if resp, err := client.Delete(ctx, *id); err != nil { + if response.WasNotFound(resp.HttpResponse) { return nil } return fmt.Errorf("deleting DataProtection BackupVault (%q): %+v", id, err) @@ -190,28 +196,28 @@ func resourceDataProtectionBackupVaultDelete(d *pluginsdk.ResourceData, meta int return nil } -func expandBackupVaultDppIdentityDetails(input []interface{}) (*dataprotection.DppIdentityDetails, error) { +func expandBackupVaultDppIdentityDetails(input []interface{}) (*backupvaults.DppIdentityDetails, error) { config, err := identity.ExpandSystemAssigned(input) if err != nil { return nil, err } - return &dataprotection.DppIdentityDetails{ + return &backupvaults.DppIdentityDetails{ Type: utils.String(string(config.Type)), }, nil } -func flattenBackupVaultDppIdentityDetails(input *dataprotection.DppIdentityDetails) []interface{} { +func flattenBackupVaultDppIdentityDetails(input *backupvaults.DppIdentityDetails) []interface{} { var config *identity.SystemAssigned if input != nil { principalId := "" - if input.PrincipalID != nil { - principalId = *input.PrincipalID + if input.PrincipalId != nil { + principalId = *input.PrincipalId } tenantId := "" - if input.TenantID != nil { - tenantId = *input.TenantID + if input.TenantId != nil { + tenantId = *input.TenantId } config = &identity.SystemAssigned{ Type: identity.Type(*input.Type), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_resource_guard_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_resource_guard_resource.go new file mode 100644 index 00000000000..95c310d7a96 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/data_protection_resource_guard_resource.go @@ -0,0 +1,158 @@ +package dataprotection + +import ( + "fmt" + "log" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceDataProtectionResourceGuard() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceDataProtectionResourceGuardCreateUpdate, + Read: resourceDataProtectionResourceGuardRead, + Update: resourceDataProtectionResourceGuardCreateUpdate, + Delete: resourceDataProtectionResourceGuardDelete, + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Update: pluginsdk.DefaultTimeout(30 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := resourceguards.ParseResourceGuardID(id) + return err + }), + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.ResourceGuardName, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "vault_critical_operation_exclusion_list": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + + "tags": commonschema.Tags(), + }, + } +} + +func resourceDataProtectionResourceGuardCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + client := meta.(*clients.Client).DataProtection.ResourceGuardClient + ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id := resourceguards.NewResourceGuardID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + + if d.IsNewResource() { + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_data_protection_resource_guard", id.ID()) + } + } + + parameters := resourceguards.ResourceGuardResource{ + Location: utils.String(location.Normalize(d.Get("location").(string))), + Properties: &resourceguards.ResourceGuard{ + VaultCriticalOperationExclusionList: utils.ExpandStringSlice(d.Get("vault_critical_operation_exclusion_list").([]interface{})), + }, + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + } + + if _, err := client.Put(ctx, id, parameters); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) + } + + if d.IsNewResource() { + d.SetId(id.ID()) + } + + return resourceDataProtectionResourceGuardRead(d, meta) +} + +func resourceDataProtectionResourceGuardRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).DataProtection.ResourceGuardClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := resourceguards.ParseResourceGuardID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *id) + d.SetId("") + return nil + } + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + d.Set("name", id.ResourceGuardsName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(*model.Location)) + + props := model.Properties + d.Set("vault_critical_operation_exclusion_list", utils.FlattenStringSlice(props.VaultCriticalOperationExclusionList)) + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } + } + + return nil +} + +func resourceDataProtectionResourceGuardDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).DataProtection.ResourceGuardClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := resourceguards.ParseResourceGuardID(d.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/backupinstances.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/backupinstances.go deleted file mode 100644 index 20d27ac0997..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/backupinstances.go +++ /dev/null @@ -1,927 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" -) - -// BackupInstancesClient is the open API 2.0 Specs for Azure Data Protection service -type BackupInstancesClient struct { - BaseClient -} - -// NewBackupInstancesClient creates an instance of the BackupInstancesClient client. -func NewBackupInstancesClient(subscriptionID string) BackupInstancesClient { - return NewBackupInstancesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupInstancesClientWithBaseURI creates an instance of the BackupInstancesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewBackupInstancesClientWithBaseURI(baseURI string, subscriptionID string) BackupInstancesClient { - return BackupInstancesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// AdhocBackup trigger adhoc backup -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -// backupInstanceName - the name of the backup instance -// parameters - request body for operation -func (client BackupInstancesClient) AdhocBackup(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters TriggerBackupRequest) (result BackupInstancesAdhocBackupFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupInstancesClient.AdhocBackup") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - { - TargetValue: parameters, - Constraints: []validation.Constraint{{ - Target: "parameters.BackupRuleOptions", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{ - {Target: "parameters.BackupRuleOptions.RuleName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.BackupRuleOptions.TriggerOption", Name: validation.Null, Rule: true, Chain: nil}, - }, - }}, - }, - }); err != nil { - return result, validation.NewError("dataprotection.BackupInstancesClient", "AdhocBackup", err.Error()) - } - - req, err := client.AdhocBackupPreparer(ctx, vaultName, resourceGroupName, backupInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "AdhocBackup", nil, "Failure preparing request") - return - } - - result, err = client.AdhocBackupSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "AdhocBackup", nil, "Failure sending request") - return - } - - return -} - -// AdhocBackupPreparer prepares the AdhocBackup request. -func (client BackupInstancesClient) AdhocBackupPreparer(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters TriggerBackupRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupInstanceName": autorest.Encode("path", backupInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AdhocBackupSender sends the AdhocBackup request. The method will close the -// http.Response Body if it receives an error. -func (client BackupInstancesClient) AdhocBackupSender(req *http.Request) (future BackupInstancesAdhocBackupFuture, err error) { - var resp *http.Response - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// AdhocBackupResponder handles the response to the AdhocBackup request. The method always -// closes the http.Response Body. -func (client BackupInstancesClient) AdhocBackupResponder(resp *http.Response) (result OperationJobExtendedInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate create or update a backup instance in a backup vault -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -// backupInstanceName - the name of the backup instance -// parameters - request body for operation -func (client BackupInstancesClient) CreateOrUpdate(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters BackupInstanceResource) (result BackupInstancesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupInstancesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - { - TargetValue: parameters, - Constraints: []validation.Constraint{{ - Target: "parameters.Properties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{ - { - Target: "parameters.Properties.DataSourceInfo", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.DataSourceInfo.ResourceID", Name: validation.Null, Rule: true, Chain: nil}}, - }, - { - Target: "parameters.Properties.DataSourceSetInfo", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.DataSourceSetInfo.ResourceID", Name: validation.Null, Rule: true, Chain: nil}}, - }, - { - Target: "parameters.Properties.PolicyInfo", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.PolicyInfo.PolicyID", Name: validation.Null, Rule: true, Chain: nil}}, - }, - { - Target: "parameters.Properties.ProtectionStatus", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{ - { - Target: "parameters.Properties.ProtectionStatus.ErrorDetails", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{ - { - Target: "parameters.Properties.ProtectionStatus.ErrorDetails.InnerError", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.ProtectionStatus.ErrorDetails.InnerError.EmbeddedInnerError", Name: validation.Null, Rule: false, Chain: nil}}, - }, - }, - }, - }, - }, - { - Target: "parameters.Properties.ProtectionErrorDetails", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{ - { - Target: "parameters.Properties.ProtectionErrorDetails.InnerError", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.Properties.ProtectionErrorDetails.InnerError.EmbeddedInnerError", Name: validation.Null, Rule: false, Chain: nil}}, - }, - }, - }, - {Target: "parameters.Properties.ObjectType", Name: validation.Null, Rule: true, Chain: nil}, - }, - }}, - }, - }); err != nil { - return result, validation.NewError("dataprotection.BackupInstancesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, vaultName, resourceGroupName, backupInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "CreateOrUpdate", nil, "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client BackupInstancesClient) CreateOrUpdatePreparer(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters BackupInstanceResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupInstanceName": autorest.Encode("path", backupInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client BackupInstancesClient) CreateOrUpdateSender(req *http.Request) (future BackupInstancesCreateOrUpdateFuture, err error) { - var resp *http.Response - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client BackupInstancesClient) CreateOrUpdateResponder(resp *http.Response) (result BackupInstanceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a backup instance in a backup vault -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -// backupInstanceName - the name of the backup instance -func (client BackupInstancesClient) Delete(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string) (result BackupInstancesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupInstancesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, vaultName, resourceGroupName, backupInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "Delete", nil, "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client BackupInstancesClient) DeletePreparer(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupInstanceName": autorest.Encode("path", backupInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client BackupInstancesClient) DeleteSender(req *http.Request) (future BackupInstancesDeleteFuture, err error) { - var resp *http.Response - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client BackupInstancesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a backup instance with name in a backup vault -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -// backupInstanceName - the name of the backup instance -func (client BackupInstancesClient) Get(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string) (result BackupInstanceResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupInstancesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, vaultName, resourceGroupName, backupInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupInstancesClient) GetPreparer(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupInstanceName": autorest.Encode("path", backupInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client BackupInstancesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client BackupInstancesClient) GetResponder(resp *http.Response) (result BackupInstanceResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a backup instances belonging to a backup vault -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client BackupInstancesClient) List(ctx context.Context, vaultName string, resourceGroupName string) (result BackupInstanceResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupInstancesClient.List") - defer func() { - sc := -1 - if result.birl.Response.Response != nil { - sc = result.birl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, vaultName, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.birl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "List", resp, "Failure sending request") - return - } - - result.birl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "List", resp, "Failure responding to request") - return - } - if result.birl.hasNextLink() && result.birl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client BackupInstancesClient) ListPreparer(ctx context.Context, vaultName string, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client BackupInstancesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client BackupInstancesClient) ListResponder(resp *http.Response) (result BackupInstanceResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client BackupInstancesClient) listNextResults(ctx context.Context, lastResults BackupInstanceResourceList) (result BackupInstanceResourceList, err error) { - req, err := lastResults.backupInstanceResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client BackupInstancesClient) ListComplete(ctx context.Context, vaultName string, resourceGroupName string) (result BackupInstanceResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupInstancesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, vaultName, resourceGroupName) - return -} - -// TriggerRehydrate rehydrate recovery point for restore for a BackupInstance -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -// vaultName - the name of the backup vault. -// parameters - request body for operation -func (client BackupInstancesClient) TriggerRehydrate(ctx context.Context, resourceGroupName string, vaultName string, parameters AzureBackupRehydrationRequest, backupInstanceName string) (result BackupInstancesTriggerRehydrateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupInstancesClient.TriggerRehydrate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - { - TargetValue: parameters, - Constraints: []validation.Constraint{ - {Target: "parameters.RecoveryPointID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.RehydrationRetentionDuration", Name: validation.Null, Rule: true, Chain: nil}, - }, - }, - }); err != nil { - return result, validation.NewError("dataprotection.BackupInstancesClient", "TriggerRehydrate", err.Error()) - } - - req, err := client.TriggerRehydratePreparer(ctx, resourceGroupName, vaultName, parameters, backupInstanceName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "TriggerRehydrate", nil, "Failure preparing request") - return - } - - result, err = client.TriggerRehydrateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "TriggerRehydrate", nil, "Failure sending request") - return - } - - return -} - -// TriggerRehydratePreparer prepares the TriggerRehydrate request. -func (client BackupInstancesClient) TriggerRehydratePreparer(ctx context.Context, resourceGroupName string, vaultName string, parameters AzureBackupRehydrationRequest, backupInstanceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupInstanceName": autorest.Encode("path", backupInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// TriggerRehydrateSender sends the TriggerRehydrate request. The method will close the -// http.Response Body if it receives an error. -func (client BackupInstancesClient) TriggerRehydrateSender(req *http.Request) (future BackupInstancesTriggerRehydrateFuture, err error) { - var resp *http.Response - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// TriggerRehydrateResponder handles the response to the TriggerRehydrate request. The method always -// closes the http.Response Body. -func (client BackupInstancesClient) TriggerRehydrateResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// TriggerRestore triggers restore for a BackupInstance -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -// backupInstanceName - the name of the backup instance -// parameters - request body for operation -func (client BackupInstancesClient) TriggerRestore(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters BasicAzureBackupRestoreRequest) (result BackupInstancesTriggerRestoreFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupInstancesClient.TriggerRestore") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.TriggerRestorePreparer(ctx, vaultName, resourceGroupName, backupInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "TriggerRestore", nil, "Failure preparing request") - return - } - - result, err = client.TriggerRestoreSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "TriggerRestore", nil, "Failure sending request") - return - } - - return -} - -// TriggerRestorePreparer prepares the TriggerRestore request. -func (client BackupInstancesClient) TriggerRestorePreparer(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters BasicAzureBackupRestoreRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupInstanceName": autorest.Encode("path", backupInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// TriggerRestoreSender sends the TriggerRestore request. The method will close the -// http.Response Body if it receives an error. -func (client BackupInstancesClient) TriggerRestoreSender(req *http.Request) (future BackupInstancesTriggerRestoreFuture, err error) { - var resp *http.Response - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// TriggerRestoreResponder handles the response to the TriggerRestore request. The method always -// closes the http.Response Body. -func (client BackupInstancesClient) TriggerRestoreResponder(resp *http.Response) (result OperationJobExtendedInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ValidateForBackup validate whether adhoc backup will be successful or not -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -// parameters - request body for operation -func (client BackupInstancesClient) ValidateForBackup(ctx context.Context, vaultName string, resourceGroupName string, parameters ValidateForBackupRequest) (result BackupInstancesValidateForBackupFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupInstancesClient.ValidateForBackup") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - { - TargetValue: parameters, - Constraints: []validation.Constraint{{ - Target: "parameters.BackupInstance", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{ - { - Target: "parameters.BackupInstance.DataSourceInfo", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.BackupInstance.DataSourceInfo.ResourceID", Name: validation.Null, Rule: true, Chain: nil}}, - }, - { - Target: "parameters.BackupInstance.DataSourceSetInfo", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.BackupInstance.DataSourceSetInfo.ResourceID", Name: validation.Null, Rule: true, Chain: nil}}, - }, - { - Target: "parameters.BackupInstance.PolicyInfo", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.BackupInstance.PolicyInfo.PolicyID", Name: validation.Null, Rule: true, Chain: nil}}, - }, - { - Target: "parameters.BackupInstance.ProtectionStatus", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{ - { - Target: "parameters.BackupInstance.ProtectionStatus.ErrorDetails", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{ - { - Target: "parameters.BackupInstance.ProtectionStatus.ErrorDetails.InnerError", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.BackupInstance.ProtectionStatus.ErrorDetails.InnerError.EmbeddedInnerError", Name: validation.Null, Rule: false, Chain: nil}}, - }, - }, - }, - }, - }, - { - Target: "parameters.BackupInstance.ProtectionErrorDetails", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{ - { - Target: "parameters.BackupInstance.ProtectionErrorDetails.InnerError", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.BackupInstance.ProtectionErrorDetails.InnerError.EmbeddedInnerError", Name: validation.Null, Rule: false, Chain: nil}}, - }, - }, - }, - {Target: "parameters.BackupInstance.ObjectType", Name: validation.Null, Rule: true, Chain: nil}, - }, - }}, - }, - }); err != nil { - return result, validation.NewError("dataprotection.BackupInstancesClient", "ValidateForBackup", err.Error()) - } - - req, err := client.ValidateForBackupPreparer(ctx, vaultName, resourceGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "ValidateForBackup", nil, "Failure preparing request") - return - } - - result, err = client.ValidateForBackupSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "ValidateForBackup", nil, "Failure sending request") - return - } - - return -} - -// ValidateForBackupPreparer prepares the ValidateForBackup request. -func (client BackupInstancesClient) ValidateForBackupPreparer(ctx context.Context, vaultName string, resourceGroupName string, parameters ValidateForBackupRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ValidateForBackupSender sends the ValidateForBackup request. The method will close the -// http.Response Body if it receives an error. -func (client BackupInstancesClient) ValidateForBackupSender(req *http.Request) (future BackupInstancesValidateForBackupFuture, err error) { - var resp *http.Response - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ValidateForBackupResponder handles the response to the ValidateForBackup request. The method always -// closes the http.Response Body. -func (client BackupInstancesClient) ValidateForBackupResponder(resp *http.Response) (result OperationJobExtendedInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ValidateForRestore validates if Restore can be triggered for a DataSource -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -// backupInstanceName - the name of the backup instance -// parameters - request body for operation -func (client BackupInstancesClient) ValidateForRestore(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters ValidateRestoreRequestObject) (result BackupInstancesValidateForRestoreFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupInstancesClient.ValidateForRestore") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ValidateForRestorePreparer(ctx, vaultName, resourceGroupName, backupInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "ValidateForRestore", nil, "Failure preparing request") - return - } - - result, err = client.ValidateForRestoreSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesClient", "ValidateForRestore", nil, "Failure sending request") - return - } - - return -} - -// ValidateForRestorePreparer prepares the ValidateForRestore request. -func (client BackupInstancesClient) ValidateForRestorePreparer(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters ValidateRestoreRequestObject) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupInstanceName": autorest.Encode("path", backupInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ValidateForRestoreSender sends the ValidateForRestore request. The method will close the -// http.Response Body if it receives an error. -func (client BackupInstancesClient) ValidateForRestoreSender(req *http.Request) (future BackupInstancesValidateForRestoreFuture, err error) { - var resp *http.Response - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ValidateForRestoreResponder handles the response to the ValidateForRestore request. The method always -// closes the http.Response Body. -func (client BackupInstancesClient) ValidateForRestoreResponder(resp *http.Response) (result OperationJobExtendedInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/backuppolicies.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/backuppolicies.go deleted file mode 100644 index 4f730fb6f7e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/backuppolicies.go +++ /dev/null @@ -1,384 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" -) - -// BackupPoliciesClient is the open API 2.0 Specs for Azure Data Protection service -type BackupPoliciesClient struct { - BaseClient -} - -// NewBackupPoliciesClient creates an instance of the BackupPoliciesClient client. -func NewBackupPoliciesClient(subscriptionID string) BackupPoliciesClient { - return NewBackupPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupPoliciesClientWithBaseURI creates an instance of the BackupPoliciesClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupPoliciesClient { - return BackupPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate sends the create or update request. -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -// backupPolicyName - name of the policy -// parameters - request body for operation -func (client BackupPoliciesClient) CreateOrUpdate(ctx context.Context, vaultName string, resourceGroupName string, backupPolicyName string, parameters BaseBackupPolicyResource) (result BaseBackupPolicyResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, vaultName, resourceGroupName, backupPolicyName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.BackupPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client BackupPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, vaultName string, resourceGroupName string, backupPolicyName string, parameters BaseBackupPolicyResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupPolicyName": autorest.Encode("path", backupPolicyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client BackupPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client BackupPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result BaseBackupPolicyResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete sends the delete request. -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client BackupPoliciesClient) Delete(ctx context.Context, vaultName string, resourceGroupName string, backupPolicyName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, vaultName, resourceGroupName, backupPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupPoliciesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dataprotection.BackupPoliciesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupPoliciesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client BackupPoliciesClient) DeletePreparer(ctx context.Context, vaultName string, resourceGroupName string, backupPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupPolicyName": autorest.Encode("path", backupPolicyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client BackupPoliciesClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client BackupPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a backup policy belonging to a backup vault -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client BackupPoliciesClient) Get(ctx context.Context, vaultName string, resourceGroupName string, backupPolicyName string) (result BaseBackupPolicyResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, vaultName, resourceGroupName, backupPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.BackupPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupPoliciesClient) GetPreparer(ctx context.Context, vaultName string, resourceGroupName string, backupPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupPolicyName": autorest.Encode("path", backupPolicyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client BackupPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client BackupPoliciesClient) GetResponder(resp *http.Response) (result BaseBackupPolicyResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns list of backup policies belonging to a backup vault -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client BackupPoliciesClient) List(ctx context.Context, vaultName string, resourceGroupName string) (result BaseBackupPolicyResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.List") - defer func() { - sc := -1 - if result.bbprl.Response.Response != nil { - sc = result.bbprl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, vaultName, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupPoliciesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.bbprl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.BackupPoliciesClient", "List", resp, "Failure sending request") - return - } - - result.bbprl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupPoliciesClient", "List", resp, "Failure responding to request") - return - } - if result.bbprl.hasNextLink() && result.bbprl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client BackupPoliciesClient) ListPreparer(ctx context.Context, vaultName string, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client BackupPoliciesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client BackupPoliciesClient) ListResponder(resp *http.Response) (result BaseBackupPolicyResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client BackupPoliciesClient) listNextResults(ctx context.Context, lastResults BaseBackupPolicyResourceList) (result BaseBackupPolicyResourceList, err error) { - req, err := lastResults.baseBackupPolicyResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dataprotection.BackupPoliciesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dataprotection.BackupPoliciesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupPoliciesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client BackupPoliciesClient) ListComplete(ctx context.Context, vaultName string, resourceGroupName string) (result BaseBackupPolicyResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, vaultName, resourceGroupName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/backupvaultoperationresults.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/backupvaultoperationresults.go deleted file mode 100644 index 7433a739992..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/backupvaultoperationresults.go +++ /dev/null @@ -1,110 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" -) - -// BackupVaultOperationResultsClient is the open API 2.0 Specs for Azure Data Protection service -type BackupVaultOperationResultsClient struct { - BaseClient -} - -// NewBackupVaultOperationResultsClient creates an instance of the BackupVaultOperationResultsClient client. -func NewBackupVaultOperationResultsClient(subscriptionID string) BackupVaultOperationResultsClient { - return NewBackupVaultOperationResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupVaultOperationResultsClientWithBaseURI creates an instance of the BackupVaultOperationResultsClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewBackupVaultOperationResultsClientWithBaseURI(baseURI string, subscriptionID string) BackupVaultOperationResultsClient { - return BackupVaultOperationResultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get sends the get request. -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client BackupVaultOperationResultsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, operationID string) (result BackupVaultResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupVaultOperationResultsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, vaultName, resourceGroupName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultOperationResultsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultOperationResultsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultOperationResultsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupVaultOperationResultsClient) GetPreparer(ctx context.Context, vaultName string, resourceGroupName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client BackupVaultOperationResultsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client BackupVaultOperationResultsClient) GetResponder(resp *http.Response) (result BackupVaultResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/backupvaults.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/backupvaults.go deleted file mode 100644 index 38a2ad1943e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/backupvaults.go +++ /dev/null @@ -1,666 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" -) - -// BackupVaultsClient is the open API 2.0 Specs for Azure Data Protection service -type BackupVaultsClient struct { - BaseClient -} - -// NewBackupVaultsClient creates an instance of the BackupVaultsClient client. -func NewBackupVaultsClient(subscriptionID string) BackupVaultsClient { - return NewBackupVaultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupVaultsClientWithBaseURI creates an instance of the BackupVaultsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewBackupVaultsClientWithBaseURI(baseURI string, subscriptionID string) BackupVaultsClient { - return BackupVaultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability sends the check name availability request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -// location - the location in which uniqueness will be verified. -// parameters - check name availability request -func (client BackupVaultsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, location string, parameters CheckNameAvailabilityRequest) (result CheckNameAvailabilityResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupVaultsClient.CheckNameAvailability") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, location, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckNameAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client BackupVaultsClient) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, location string, parameters CheckNameAvailabilityRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client BackupVaultsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client BackupVaultsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a BackupVault resource belonging to a resource group. -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -// parameters - request body for operation -func (client BackupVaultsClient) CreateOrUpdate(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupVaultResource) (result BackupVaultsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupVaultsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - { - TargetValue: parameters, - Constraints: []validation.Constraint{{ - Target: "parameters.Properties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Properties.StorageSettings", Name: validation.Null, Rule: true, Chain: nil}}, - }}, - }, - }); err != nil { - return result, validation.NewError("dataprotection.BackupVaultsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, vaultName, resourceGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "CreateOrUpdate", nil, "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client BackupVaultsClient) CreateOrUpdatePreparer(ctx context.Context, vaultName string, resourceGroupName string, parameters BackupVaultResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client BackupVaultsClient) CreateOrUpdateSender(req *http.Request) (future BackupVaultsCreateOrUpdateFuture, err error) { - var resp *http.Response - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client BackupVaultsClient) CreateOrUpdateResponder(resp *http.Response) (result BackupVaultResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a BackupVault resource from the resource group. -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client BackupVaultsClient) Delete(ctx context.Context, vaultName string, resourceGroupName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupVaultsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, vaultName, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client BackupVaultsClient) DeletePreparer(ctx context.Context, vaultName string, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client BackupVaultsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client BackupVaultsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns a resource belonging to a resource group. -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client BackupVaultsClient) Get(ctx context.Context, vaultName string, resourceGroupName string) (result BackupVaultResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupVaultsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, vaultName, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupVaultsClient) GetPreparer(ctx context.Context, vaultName string, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client BackupVaultsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client BackupVaultsClient) GetResponder(resp *http.Response) (result BackupVaultResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetInResourceGroup returns resource collection belonging to a resource group. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client BackupVaultsClient) GetInResourceGroup(ctx context.Context, resourceGroupName string) (result BackupVaultResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupVaultsClient.GetInResourceGroup") - defer func() { - sc := -1 - if result.bvrl.Response.Response != nil { - sc = result.bvrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.getInResourceGroupNextResults - req, err := client.GetInResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "GetInResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.GetInResourceGroupSender(req) - if err != nil { - result.bvrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "GetInResourceGroup", resp, "Failure sending request") - return - } - - result.bvrl, err = client.GetInResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "GetInResourceGroup", resp, "Failure responding to request") - return - } - if result.bvrl.hasNextLink() && result.bvrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// GetInResourceGroupPreparer prepares the GetInResourceGroup request. -func (client BackupVaultsClient) GetInResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetInResourceGroupSender sends the GetInResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client BackupVaultsClient) GetInResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetInResourceGroupResponder handles the response to the GetInResourceGroup request. The method always -// closes the http.Response Body. -func (client BackupVaultsClient) GetInResourceGroupResponder(resp *http.Response) (result BackupVaultResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// getInResourceGroupNextResults retrieves the next set of results, if any. -func (client BackupVaultsClient) getInResourceGroupNextResults(ctx context.Context, lastResults BackupVaultResourceList) (result BackupVaultResourceList, err error) { - req, err := lastResults.backupVaultResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "getInResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.GetInResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "getInResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.GetInResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "getInResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// GetInResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client BackupVaultsClient) GetInResourceGroupComplete(ctx context.Context, resourceGroupName string) (result BackupVaultResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupVaultsClient.GetInResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.GetInResourceGroup(ctx, resourceGroupName) - return -} - -// GetInSubscription returns resource collection belonging to a subscription. -func (client BackupVaultsClient) GetInSubscription(ctx context.Context) (result BackupVaultResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupVaultsClient.GetInSubscription") - defer func() { - sc := -1 - if result.bvrl.Response.Response != nil { - sc = result.bvrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.getInSubscriptionNextResults - req, err := client.GetInSubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "GetInSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.GetInSubscriptionSender(req) - if err != nil { - result.bvrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "GetInSubscription", resp, "Failure sending request") - return - } - - result.bvrl, err = client.GetInSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "GetInSubscription", resp, "Failure responding to request") - return - } - if result.bvrl.hasNextLink() && result.bvrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// GetInSubscriptionPreparer prepares the GetInSubscription request. -func (client BackupVaultsClient) GetInSubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetInSubscriptionSender sends the GetInSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client BackupVaultsClient) GetInSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetInSubscriptionResponder handles the response to the GetInSubscription request. The method always -// closes the http.Response Body. -func (client BackupVaultsClient) GetInSubscriptionResponder(resp *http.Response) (result BackupVaultResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// getInSubscriptionNextResults retrieves the next set of results, if any. -func (client BackupVaultsClient) getInSubscriptionNextResults(ctx context.Context, lastResults BackupVaultResourceList) (result BackupVaultResourceList, err error) { - req, err := lastResults.backupVaultResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "getInSubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.GetInSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "getInSubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.GetInSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "getInSubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// GetInSubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client BackupVaultsClient) GetInSubscriptionComplete(ctx context.Context) (result BackupVaultResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupVaultsClient.GetInSubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.GetInSubscription(ctx) - return -} - -// Update updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -// parameters - request body for operation -func (client BackupVaultsClient) Update(ctx context.Context, vaultName string, resourceGroupName string, parameters PatchResourceRequestInput) (result BackupVaultsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupVaultsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, vaultName, resourceGroupName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsClient", "Update", nil, "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BackupVaultsClient) UpdatePreparer(ctx context.Context, vaultName string, resourceGroupName string, parameters PatchResourceRequestInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client BackupVaultsClient) UpdateSender(req *http.Request) (future BackupVaultsUpdateFuture, err error) { - var resp *http.Response - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client BackupVaultsClient) UpdateResponder(resp *http.Response) (result BackupVaultResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/client.go deleted file mode 100644 index 64d725f2bae..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package dataprotection implements the Azure ARM Dataprotection service API version 2021-07-01. -// -// Open API 2.0 Specs for Azure Data Protection service -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Dataprotection - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Dataprotection. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/dataprotection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/dataprotection.go deleted file mode 100644 index 57e523220de..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/dataprotection.go +++ /dev/null @@ -1,108 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" -) - -// Client is the open API 2.0 Specs for Azure Data Protection service -type Client struct { - BaseClient -} - -// NewClient creates an instance of the Client client. -func NewClient(subscriptionID string) Client { - return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting -// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewClientWithBaseURI(baseURI string, subscriptionID string) Client { - return Client{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckFeatureSupport sends the check feature support request. -// Parameters: -// parameters - feature support request object -func (client Client) CheckFeatureSupport(ctx context.Context, location string, parameters BasicFeatureValidationRequestBase) (result FeatureValidationResponseBaseModel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckFeatureSupport") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CheckFeatureSupportPreparer(ctx, location, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.Client", "CheckFeatureSupport", nil, "Failure preparing request") - return - } - - resp, err := client.CheckFeatureSupportSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.Client", "CheckFeatureSupport", resp, "Failure sending request") - return - } - - result, err = client.CheckFeatureSupportResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.Client", "CheckFeatureSupport", resp, "Failure responding to request") - return - } - - return -} - -// CheckFeatureSupportPreparer prepares the CheckFeatureSupport request. -func (client Client) CheckFeatureSupportPreparer(ctx context.Context, location string, parameters BasicFeatureValidationRequestBase) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckFeatureSupportSender sends the CheckFeatureSupport request. The method will close the -// http.Response Body if it receives an error. -func (client Client) CheckFeatureSupportSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckFeatureSupportResponder handles the response to the CheckFeatureSupport request. The method always -// closes the http.Response Body. -func (client Client) CheckFeatureSupportResponder(resp *http.Response) (result FeatureValidationResponseBaseModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/enums.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/enums.go deleted file mode 100644 index 9da554a4ddd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/enums.go +++ /dev/null @@ -1,690 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AbsoluteMarker enumerates the values for absolute marker. -type AbsoluteMarker string - -const ( - // AbsoluteMarkerAllBackup ... - AbsoluteMarkerAllBackup AbsoluteMarker = "AllBackup" - // AbsoluteMarkerFirstOfDay ... - AbsoluteMarkerFirstOfDay AbsoluteMarker = "FirstOfDay" - // AbsoluteMarkerFirstOfMonth ... - AbsoluteMarkerFirstOfMonth AbsoluteMarker = "FirstOfMonth" - // AbsoluteMarkerFirstOfWeek ... - AbsoluteMarkerFirstOfWeek AbsoluteMarker = "FirstOfWeek" - // AbsoluteMarkerFirstOfYear ... - AbsoluteMarkerFirstOfYear AbsoluteMarker = "FirstOfYear" -) - -// PossibleAbsoluteMarkerValues returns an array of possible values for the AbsoluteMarker const type. -func PossibleAbsoluteMarkerValues() []AbsoluteMarker { - return []AbsoluteMarker{AbsoluteMarkerAllBackup, AbsoluteMarkerFirstOfDay, AbsoluteMarkerFirstOfMonth, AbsoluteMarkerFirstOfWeek, AbsoluteMarkerFirstOfYear} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// CurrentProtectionState enumerates the values for current protection state. -type CurrentProtectionState string - -const ( - // CurrentProtectionStateBackupSchedulesSuspended ... - CurrentProtectionStateBackupSchedulesSuspended CurrentProtectionState = "BackupSchedulesSuspended" - // CurrentProtectionStateConfiguringProtection ... - CurrentProtectionStateConfiguringProtection CurrentProtectionState = "ConfiguringProtection" - // CurrentProtectionStateConfiguringProtectionFailed ... - CurrentProtectionStateConfiguringProtectionFailed CurrentProtectionState = "ConfiguringProtectionFailed" - // CurrentProtectionStateInvalid ... - CurrentProtectionStateInvalid CurrentProtectionState = "Invalid" - // CurrentProtectionStateNotProtected ... - CurrentProtectionStateNotProtected CurrentProtectionState = "NotProtected" - // CurrentProtectionStateProtectionConfigured ... - CurrentProtectionStateProtectionConfigured CurrentProtectionState = "ProtectionConfigured" - // CurrentProtectionStateProtectionError ... - CurrentProtectionStateProtectionError CurrentProtectionState = "ProtectionError" - // CurrentProtectionStateProtectionStopped ... - CurrentProtectionStateProtectionStopped CurrentProtectionState = "ProtectionStopped" - // CurrentProtectionStateRetentionSchedulesSuspended ... - CurrentProtectionStateRetentionSchedulesSuspended CurrentProtectionState = "RetentionSchedulesSuspended" - // CurrentProtectionStateSoftDeleted ... - CurrentProtectionStateSoftDeleted CurrentProtectionState = "SoftDeleted" - // CurrentProtectionStateSoftDeleting ... - CurrentProtectionStateSoftDeleting CurrentProtectionState = "SoftDeleting" - // CurrentProtectionStateUpdatingProtection ... - CurrentProtectionStateUpdatingProtection CurrentProtectionState = "UpdatingProtection" -) - -// PossibleCurrentProtectionStateValues returns an array of possible values for the CurrentProtectionState const type. -func PossibleCurrentProtectionStateValues() []CurrentProtectionState { - return []CurrentProtectionState{CurrentProtectionStateBackupSchedulesSuspended, CurrentProtectionStateConfiguringProtection, CurrentProtectionStateConfiguringProtectionFailed, CurrentProtectionStateInvalid, CurrentProtectionStateNotProtected, CurrentProtectionStateProtectionConfigured, CurrentProtectionStateProtectionError, CurrentProtectionStateProtectionStopped, CurrentProtectionStateRetentionSchedulesSuspended, CurrentProtectionStateSoftDeleted, CurrentProtectionStateSoftDeleting, CurrentProtectionStateUpdatingProtection} -} - -// DataStoreTypes enumerates the values for data store types. -type DataStoreTypes string - -const ( - // DataStoreTypesArchiveStore ... - DataStoreTypesArchiveStore DataStoreTypes = "ArchiveStore" - // DataStoreTypesOperationalStore ... - DataStoreTypesOperationalStore DataStoreTypes = "OperationalStore" - // DataStoreTypesVaultStore ... - DataStoreTypesVaultStore DataStoreTypes = "VaultStore" -) - -// PossibleDataStoreTypesValues returns an array of possible values for the DataStoreTypes const type. -func PossibleDataStoreTypesValues() []DataStoreTypes { - return []DataStoreTypes{DataStoreTypesArchiveStore, DataStoreTypesOperationalStore, DataStoreTypesVaultStore} -} - -// DayOfWeek enumerates the values for day of week. -type DayOfWeek string - -const ( - // DayOfWeekFriday ... - DayOfWeekFriday DayOfWeek = "Friday" - // DayOfWeekMonday ... - DayOfWeekMonday DayOfWeek = "Monday" - // DayOfWeekSaturday ... - DayOfWeekSaturday DayOfWeek = "Saturday" - // DayOfWeekSunday ... - DayOfWeekSunday DayOfWeek = "Sunday" - // DayOfWeekThursday ... - DayOfWeekThursday DayOfWeek = "Thursday" - // DayOfWeekTuesday ... - DayOfWeekTuesday DayOfWeek = "Tuesday" - // DayOfWeekWednesday ... - DayOfWeekWednesday DayOfWeek = "Wednesday" -) - -// PossibleDayOfWeekValues returns an array of possible values for the DayOfWeek const type. -func PossibleDayOfWeekValues() []DayOfWeek { - return []DayOfWeek{DayOfWeekFriday, DayOfWeekMonday, DayOfWeekSaturday, DayOfWeekSunday, DayOfWeekThursday, DayOfWeekTuesday, DayOfWeekWednesday} -} - -// FeatureSupportStatus enumerates the values for feature support status. -type FeatureSupportStatus string - -const ( - // FeatureSupportStatusAlphaPreview ... - FeatureSupportStatusAlphaPreview FeatureSupportStatus = "AlphaPreview" - // FeatureSupportStatusGenerallyAvailable ... - FeatureSupportStatusGenerallyAvailable FeatureSupportStatus = "GenerallyAvailable" - // FeatureSupportStatusInvalid ... - FeatureSupportStatusInvalid FeatureSupportStatus = "Invalid" - // FeatureSupportStatusNotSupported ... - FeatureSupportStatusNotSupported FeatureSupportStatus = "NotSupported" - // FeatureSupportStatusPrivatePreview ... - FeatureSupportStatusPrivatePreview FeatureSupportStatus = "PrivatePreview" - // FeatureSupportStatusPublicPreview ... - FeatureSupportStatusPublicPreview FeatureSupportStatus = "PublicPreview" -) - -// PossibleFeatureSupportStatusValues returns an array of possible values for the FeatureSupportStatus const type. -func PossibleFeatureSupportStatusValues() []FeatureSupportStatus { - return []FeatureSupportStatus{FeatureSupportStatusAlphaPreview, FeatureSupportStatusGenerallyAvailable, FeatureSupportStatusInvalid, FeatureSupportStatusNotSupported, FeatureSupportStatusPrivatePreview, FeatureSupportStatusPublicPreview} -} - -// FeatureType enumerates the values for feature type. -type FeatureType string - -const ( - // FeatureTypeDataSourceType ... - FeatureTypeDataSourceType FeatureType = "DataSourceType" - // FeatureTypeInvalid ... - FeatureTypeInvalid FeatureType = "Invalid" -) - -// PossibleFeatureTypeValues returns an array of possible values for the FeatureType const type. -func PossibleFeatureTypeValues() []FeatureType { - return []FeatureType{FeatureTypeDataSourceType, FeatureTypeInvalid} -} - -// Month enumerates the values for month. -type Month string - -const ( - // MonthApril ... - MonthApril Month = "April" - // MonthAugust ... - MonthAugust Month = "August" - // MonthDecember ... - MonthDecember Month = "December" - // MonthFebruary ... - MonthFebruary Month = "February" - // MonthJanuary ... - MonthJanuary Month = "January" - // MonthJuly ... - MonthJuly Month = "July" - // MonthJune ... - MonthJune Month = "June" - // MonthMarch ... - MonthMarch Month = "March" - // MonthMay ... - MonthMay Month = "May" - // MonthNovember ... - MonthNovember Month = "November" - // MonthOctober ... - MonthOctober Month = "October" - // MonthSeptember ... - MonthSeptember Month = "September" -) - -// PossibleMonthValues returns an array of possible values for the Month const type. -func PossibleMonthValues() []Month { - return []Month{MonthApril, MonthAugust, MonthDecember, MonthFebruary, MonthJanuary, MonthJuly, MonthJune, MonthMarch, MonthMay, MonthNovember, MonthOctober, MonthSeptember} -} - -// ObjectType enumerates the values for object type. -type ObjectType string - -const ( - // ObjectTypeAuthCredentials ... - ObjectTypeAuthCredentials ObjectType = "AuthCredentials" - // ObjectTypeSecretStoreBasedAuthCredentials ... - ObjectTypeSecretStoreBasedAuthCredentials ObjectType = "SecretStoreBasedAuthCredentials" -) - -// PossibleObjectTypeValues returns an array of possible values for the ObjectType const type. -func PossibleObjectTypeValues() []ObjectType { - return []ObjectType{ObjectTypeAuthCredentials, ObjectTypeSecretStoreBasedAuthCredentials} -} - -// ObjectTypeBasicAzureBackupRecoveryPoint enumerates the values for object type basic azure backup recovery -// point. -type ObjectTypeBasicAzureBackupRecoveryPoint string - -const ( - // ObjectTypeBasicAzureBackupRecoveryPointObjectTypeAzureBackupDiscreteRecoveryPoint ... - ObjectTypeBasicAzureBackupRecoveryPointObjectTypeAzureBackupDiscreteRecoveryPoint ObjectTypeBasicAzureBackupRecoveryPoint = "AzureBackupDiscreteRecoveryPoint" - // ObjectTypeBasicAzureBackupRecoveryPointObjectTypeAzureBackupRecoveryPoint ... - ObjectTypeBasicAzureBackupRecoveryPointObjectTypeAzureBackupRecoveryPoint ObjectTypeBasicAzureBackupRecoveryPoint = "AzureBackupRecoveryPoint" -) - -// PossibleObjectTypeBasicAzureBackupRecoveryPointValues returns an array of possible values for the ObjectTypeBasicAzureBackupRecoveryPoint const type. -func PossibleObjectTypeBasicAzureBackupRecoveryPointValues() []ObjectTypeBasicAzureBackupRecoveryPoint { - return []ObjectTypeBasicAzureBackupRecoveryPoint{ObjectTypeBasicAzureBackupRecoveryPointObjectTypeAzureBackupDiscreteRecoveryPoint, ObjectTypeBasicAzureBackupRecoveryPointObjectTypeAzureBackupRecoveryPoint} -} - -// ObjectTypeBasicAzureBackupRestoreRequest enumerates the values for object type basic azure backup restore -// request. -type ObjectTypeBasicAzureBackupRestoreRequest string - -const ( - // ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryPointBasedRestoreRequest ... - ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryPointBasedRestoreRequest ObjectTypeBasicAzureBackupRestoreRequest = "AzureBackupRecoveryPointBasedRestoreRequest" - // ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryTimeBasedRestoreRequest ... - ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryTimeBasedRestoreRequest ObjectTypeBasicAzureBackupRestoreRequest = "AzureBackupRecoveryTimeBasedRestoreRequest" - // ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreRequest ... - ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreRequest ObjectTypeBasicAzureBackupRestoreRequest = "AzureBackupRestoreRequest" - // ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreWithRehydrationRequest ... - ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreWithRehydrationRequest ObjectTypeBasicAzureBackupRestoreRequest = "AzureBackupRestoreWithRehydrationRequest" -) - -// PossibleObjectTypeBasicAzureBackupRestoreRequestValues returns an array of possible values for the ObjectTypeBasicAzureBackupRestoreRequest const type. -func PossibleObjectTypeBasicAzureBackupRestoreRequestValues() []ObjectTypeBasicAzureBackupRestoreRequest { - return []ObjectTypeBasicAzureBackupRestoreRequest{ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryPointBasedRestoreRequest, ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryTimeBasedRestoreRequest, ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreRequest, ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreWithRehydrationRequest} -} - -// ObjectTypeBasicBackupCriteria enumerates the values for object type basic backup criteria. -type ObjectTypeBasicBackupCriteria string - -const ( - // ObjectTypeBasicBackupCriteriaObjectTypeBackupCriteria ... - ObjectTypeBasicBackupCriteriaObjectTypeBackupCriteria ObjectTypeBasicBackupCriteria = "BackupCriteria" - // ObjectTypeBasicBackupCriteriaObjectTypeScheduleBasedBackupCriteria ... - ObjectTypeBasicBackupCriteriaObjectTypeScheduleBasedBackupCriteria ObjectTypeBasicBackupCriteria = "ScheduleBasedBackupCriteria" -) - -// PossibleObjectTypeBasicBackupCriteriaValues returns an array of possible values for the ObjectTypeBasicBackupCriteria const type. -func PossibleObjectTypeBasicBackupCriteriaValues() []ObjectTypeBasicBackupCriteria { - return []ObjectTypeBasicBackupCriteria{ObjectTypeBasicBackupCriteriaObjectTypeBackupCriteria, ObjectTypeBasicBackupCriteriaObjectTypeScheduleBasedBackupCriteria} -} - -// ObjectTypeBasicBackupParameters enumerates the values for object type basic backup parameters. -type ObjectTypeBasicBackupParameters string - -const ( - // ObjectTypeBasicBackupParametersObjectTypeAzureBackupParams ... - ObjectTypeBasicBackupParametersObjectTypeAzureBackupParams ObjectTypeBasicBackupParameters = "AzureBackupParams" - // ObjectTypeBasicBackupParametersObjectTypeBackupParameters ... - ObjectTypeBasicBackupParametersObjectTypeBackupParameters ObjectTypeBasicBackupParameters = "BackupParameters" -) - -// PossibleObjectTypeBasicBackupParametersValues returns an array of possible values for the ObjectTypeBasicBackupParameters const type. -func PossibleObjectTypeBasicBackupParametersValues() []ObjectTypeBasicBackupParameters { - return []ObjectTypeBasicBackupParameters{ObjectTypeBasicBackupParametersObjectTypeAzureBackupParams, ObjectTypeBasicBackupParametersObjectTypeBackupParameters} -} - -// ObjectTypeBasicBaseBackupPolicy enumerates the values for object type basic base backup policy. -type ObjectTypeBasicBaseBackupPolicy string - -const ( - // ObjectTypeBasicBaseBackupPolicyObjectTypeBackupPolicy ... - ObjectTypeBasicBaseBackupPolicyObjectTypeBackupPolicy ObjectTypeBasicBaseBackupPolicy = "BackupPolicy" - // ObjectTypeBasicBaseBackupPolicyObjectTypeBaseBackupPolicy ... - ObjectTypeBasicBaseBackupPolicyObjectTypeBaseBackupPolicy ObjectTypeBasicBaseBackupPolicy = "BaseBackupPolicy" -) - -// PossibleObjectTypeBasicBaseBackupPolicyValues returns an array of possible values for the ObjectTypeBasicBaseBackupPolicy const type. -func PossibleObjectTypeBasicBaseBackupPolicyValues() []ObjectTypeBasicBaseBackupPolicy { - return []ObjectTypeBasicBaseBackupPolicy{ObjectTypeBasicBaseBackupPolicyObjectTypeBackupPolicy, ObjectTypeBasicBaseBackupPolicyObjectTypeBaseBackupPolicy} -} - -// ObjectTypeBasicBasePolicyRule enumerates the values for object type basic base policy rule. -type ObjectTypeBasicBasePolicyRule string - -const ( - // ObjectTypeBasicBasePolicyRuleObjectTypeAzureBackupRule ... - ObjectTypeBasicBasePolicyRuleObjectTypeAzureBackupRule ObjectTypeBasicBasePolicyRule = "AzureBackupRule" - // ObjectTypeBasicBasePolicyRuleObjectTypeAzureRetentionRule ... - ObjectTypeBasicBasePolicyRuleObjectTypeAzureRetentionRule ObjectTypeBasicBasePolicyRule = "AzureRetentionRule" - // ObjectTypeBasicBasePolicyRuleObjectTypeBasePolicyRule ... - ObjectTypeBasicBasePolicyRuleObjectTypeBasePolicyRule ObjectTypeBasicBasePolicyRule = "BasePolicyRule" -) - -// PossibleObjectTypeBasicBasePolicyRuleValues returns an array of possible values for the ObjectTypeBasicBasePolicyRule const type. -func PossibleObjectTypeBasicBasePolicyRuleValues() []ObjectTypeBasicBasePolicyRule { - return []ObjectTypeBasicBasePolicyRule{ObjectTypeBasicBasePolicyRuleObjectTypeAzureBackupRule, ObjectTypeBasicBasePolicyRuleObjectTypeAzureRetentionRule, ObjectTypeBasicBasePolicyRuleObjectTypeBasePolicyRule} -} - -// ObjectTypeBasicCopyOption enumerates the values for object type basic copy option. -type ObjectTypeBasicCopyOption string - -const ( - // ObjectTypeBasicCopyOptionObjectTypeCopyOnExpiryOption ... - ObjectTypeBasicCopyOptionObjectTypeCopyOnExpiryOption ObjectTypeBasicCopyOption = "CopyOnExpiryOption" - // ObjectTypeBasicCopyOptionObjectTypeCopyOption ... - ObjectTypeBasicCopyOptionObjectTypeCopyOption ObjectTypeBasicCopyOption = "CopyOption" - // ObjectTypeBasicCopyOptionObjectTypeCustomCopyOption ... - ObjectTypeBasicCopyOptionObjectTypeCustomCopyOption ObjectTypeBasicCopyOption = "CustomCopyOption" - // ObjectTypeBasicCopyOptionObjectTypeImmediateCopyOption ... - ObjectTypeBasicCopyOptionObjectTypeImmediateCopyOption ObjectTypeBasicCopyOption = "ImmediateCopyOption" -) - -// PossibleObjectTypeBasicCopyOptionValues returns an array of possible values for the ObjectTypeBasicCopyOption const type. -func PossibleObjectTypeBasicCopyOptionValues() []ObjectTypeBasicCopyOption { - return []ObjectTypeBasicCopyOption{ObjectTypeBasicCopyOptionObjectTypeCopyOnExpiryOption, ObjectTypeBasicCopyOptionObjectTypeCopyOption, ObjectTypeBasicCopyOptionObjectTypeCustomCopyOption, ObjectTypeBasicCopyOptionObjectTypeImmediateCopyOption} -} - -// ObjectTypeBasicDataStoreParameters enumerates the values for object type basic data store parameters. -type ObjectTypeBasicDataStoreParameters string - -const ( - // ObjectTypeBasicDataStoreParametersObjectTypeAzureOperationalStoreParameters ... - ObjectTypeBasicDataStoreParametersObjectTypeAzureOperationalStoreParameters ObjectTypeBasicDataStoreParameters = "AzureOperationalStoreParameters" - // ObjectTypeBasicDataStoreParametersObjectTypeDataStoreParameters ... - ObjectTypeBasicDataStoreParametersObjectTypeDataStoreParameters ObjectTypeBasicDataStoreParameters = "DataStoreParameters" -) - -// PossibleObjectTypeBasicDataStoreParametersValues returns an array of possible values for the ObjectTypeBasicDataStoreParameters const type. -func PossibleObjectTypeBasicDataStoreParametersValues() []ObjectTypeBasicDataStoreParameters { - return []ObjectTypeBasicDataStoreParameters{ObjectTypeBasicDataStoreParametersObjectTypeAzureOperationalStoreParameters, ObjectTypeBasicDataStoreParametersObjectTypeDataStoreParameters} -} - -// ObjectTypeBasicDeleteOption enumerates the values for object type basic delete option. -type ObjectTypeBasicDeleteOption string - -const ( - // ObjectTypeBasicDeleteOptionObjectTypeAbsoluteDeleteOption ... - ObjectTypeBasicDeleteOptionObjectTypeAbsoluteDeleteOption ObjectTypeBasicDeleteOption = "AbsoluteDeleteOption" - // ObjectTypeBasicDeleteOptionObjectTypeDeleteOption ... - ObjectTypeBasicDeleteOptionObjectTypeDeleteOption ObjectTypeBasicDeleteOption = "DeleteOption" -) - -// PossibleObjectTypeBasicDeleteOptionValues returns an array of possible values for the ObjectTypeBasicDeleteOption const type. -func PossibleObjectTypeBasicDeleteOptionValues() []ObjectTypeBasicDeleteOption { - return []ObjectTypeBasicDeleteOption{ObjectTypeBasicDeleteOptionObjectTypeAbsoluteDeleteOption, ObjectTypeBasicDeleteOptionObjectTypeDeleteOption} -} - -// ObjectTypeBasicFeatureValidationRequestBase enumerates the values for object type basic feature validation -// request base. -type ObjectTypeBasicFeatureValidationRequestBase string - -const ( - // ObjectTypeBasicFeatureValidationRequestBaseObjectTypeFeatureValidationRequest ... - ObjectTypeBasicFeatureValidationRequestBaseObjectTypeFeatureValidationRequest ObjectTypeBasicFeatureValidationRequestBase = "FeatureValidationRequest" - // ObjectTypeBasicFeatureValidationRequestBaseObjectTypeFeatureValidationRequestBase ... - ObjectTypeBasicFeatureValidationRequestBaseObjectTypeFeatureValidationRequestBase ObjectTypeBasicFeatureValidationRequestBase = "FeatureValidationRequestBase" -) - -// PossibleObjectTypeBasicFeatureValidationRequestBaseValues returns an array of possible values for the ObjectTypeBasicFeatureValidationRequestBase const type. -func PossibleObjectTypeBasicFeatureValidationRequestBaseValues() []ObjectTypeBasicFeatureValidationRequestBase { - return []ObjectTypeBasicFeatureValidationRequestBase{ObjectTypeBasicFeatureValidationRequestBaseObjectTypeFeatureValidationRequest, ObjectTypeBasicFeatureValidationRequestBaseObjectTypeFeatureValidationRequestBase} -} - -// ObjectTypeBasicFeatureValidationResponseBase enumerates the values for object type basic feature validation -// response base. -type ObjectTypeBasicFeatureValidationResponseBase string - -const ( - // ObjectTypeBasicFeatureValidationResponseBaseObjectTypeFeatureValidationResponse ... - ObjectTypeBasicFeatureValidationResponseBaseObjectTypeFeatureValidationResponse ObjectTypeBasicFeatureValidationResponseBase = "FeatureValidationResponse" - // ObjectTypeBasicFeatureValidationResponseBaseObjectTypeFeatureValidationResponseBase ... - ObjectTypeBasicFeatureValidationResponseBaseObjectTypeFeatureValidationResponseBase ObjectTypeBasicFeatureValidationResponseBase = "FeatureValidationResponseBase" -) - -// PossibleObjectTypeBasicFeatureValidationResponseBaseValues returns an array of possible values for the ObjectTypeBasicFeatureValidationResponseBase const type. -func PossibleObjectTypeBasicFeatureValidationResponseBaseValues() []ObjectTypeBasicFeatureValidationResponseBase { - return []ObjectTypeBasicFeatureValidationResponseBase{ObjectTypeBasicFeatureValidationResponseBaseObjectTypeFeatureValidationResponse, ObjectTypeBasicFeatureValidationResponseBaseObjectTypeFeatureValidationResponseBase} -} - -// ObjectTypeBasicItemLevelRestoreCriteria enumerates the values for object type basic item level restore -// criteria. -type ObjectTypeBasicItemLevelRestoreCriteria string - -const ( - // ObjectTypeBasicItemLevelRestoreCriteriaObjectTypeItemLevelRestoreCriteria ... - ObjectTypeBasicItemLevelRestoreCriteriaObjectTypeItemLevelRestoreCriteria ObjectTypeBasicItemLevelRestoreCriteria = "ItemLevelRestoreCriteria" - // ObjectTypeBasicItemLevelRestoreCriteriaObjectTypeRangeBasedItemLevelRestoreCriteria ... - ObjectTypeBasicItemLevelRestoreCriteriaObjectTypeRangeBasedItemLevelRestoreCriteria ObjectTypeBasicItemLevelRestoreCriteria = "RangeBasedItemLevelRestoreCriteria" -) - -// PossibleObjectTypeBasicItemLevelRestoreCriteriaValues returns an array of possible values for the ObjectTypeBasicItemLevelRestoreCriteria const type. -func PossibleObjectTypeBasicItemLevelRestoreCriteriaValues() []ObjectTypeBasicItemLevelRestoreCriteria { - return []ObjectTypeBasicItemLevelRestoreCriteria{ObjectTypeBasicItemLevelRestoreCriteriaObjectTypeItemLevelRestoreCriteria, ObjectTypeBasicItemLevelRestoreCriteriaObjectTypeRangeBasedItemLevelRestoreCriteria} -} - -// ObjectTypeBasicOperationExtendedInfo enumerates the values for object type basic operation extended info. -type ObjectTypeBasicOperationExtendedInfo string - -const ( - // ObjectTypeBasicOperationExtendedInfoObjectTypeOperationExtendedInfo ... - ObjectTypeBasicOperationExtendedInfoObjectTypeOperationExtendedInfo ObjectTypeBasicOperationExtendedInfo = "OperationExtendedInfo" - // ObjectTypeBasicOperationExtendedInfoObjectTypeOperationJobExtendedInfo ... - ObjectTypeBasicOperationExtendedInfoObjectTypeOperationJobExtendedInfo ObjectTypeBasicOperationExtendedInfo = "OperationJobExtendedInfo" -) - -// PossibleObjectTypeBasicOperationExtendedInfoValues returns an array of possible values for the ObjectTypeBasicOperationExtendedInfo const type. -func PossibleObjectTypeBasicOperationExtendedInfoValues() []ObjectTypeBasicOperationExtendedInfo { - return []ObjectTypeBasicOperationExtendedInfo{ObjectTypeBasicOperationExtendedInfoObjectTypeOperationExtendedInfo, ObjectTypeBasicOperationExtendedInfoObjectTypeOperationJobExtendedInfo} -} - -// ObjectTypeBasicRestoreTargetInfoBase enumerates the values for object type basic restore target info base. -type ObjectTypeBasicRestoreTargetInfoBase string - -const ( - // ObjectTypeBasicRestoreTargetInfoBaseObjectTypeItemLevelRestoreTargetInfo ... - ObjectTypeBasicRestoreTargetInfoBaseObjectTypeItemLevelRestoreTargetInfo ObjectTypeBasicRestoreTargetInfoBase = "ItemLevelRestoreTargetInfo" - // ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreFilesTargetInfo ... - ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreFilesTargetInfo ObjectTypeBasicRestoreTargetInfoBase = "RestoreFilesTargetInfo" - // ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfo ... - ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfo ObjectTypeBasicRestoreTargetInfoBase = "RestoreTargetInfo" - // ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfoBase ... - ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfoBase ObjectTypeBasicRestoreTargetInfoBase = "RestoreTargetInfoBase" -) - -// PossibleObjectTypeBasicRestoreTargetInfoBaseValues returns an array of possible values for the ObjectTypeBasicRestoreTargetInfoBase const type. -func PossibleObjectTypeBasicRestoreTargetInfoBaseValues() []ObjectTypeBasicRestoreTargetInfoBase { - return []ObjectTypeBasicRestoreTargetInfoBase{ObjectTypeBasicRestoreTargetInfoBaseObjectTypeItemLevelRestoreTargetInfo, ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreFilesTargetInfo, ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfo, ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfoBase} -} - -// ObjectTypeBasicTriggerContext enumerates the values for object type basic trigger context. -type ObjectTypeBasicTriggerContext string - -const ( - // ObjectTypeBasicTriggerContextObjectTypeAdhocBasedTriggerContext ... - ObjectTypeBasicTriggerContextObjectTypeAdhocBasedTriggerContext ObjectTypeBasicTriggerContext = "AdhocBasedTriggerContext" - // ObjectTypeBasicTriggerContextObjectTypeScheduleBasedTriggerContext ... - ObjectTypeBasicTriggerContextObjectTypeScheduleBasedTriggerContext ObjectTypeBasicTriggerContext = "ScheduleBasedTriggerContext" - // ObjectTypeBasicTriggerContextObjectTypeTriggerContext ... - ObjectTypeBasicTriggerContextObjectTypeTriggerContext ObjectTypeBasicTriggerContext = "TriggerContext" -) - -// PossibleObjectTypeBasicTriggerContextValues returns an array of possible values for the ObjectTypeBasicTriggerContext const type. -func PossibleObjectTypeBasicTriggerContextValues() []ObjectTypeBasicTriggerContext { - return []ObjectTypeBasicTriggerContext{ObjectTypeBasicTriggerContextObjectTypeAdhocBasedTriggerContext, ObjectTypeBasicTriggerContextObjectTypeScheduleBasedTriggerContext, ObjectTypeBasicTriggerContextObjectTypeTriggerContext} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateProvisioning ... - ProvisioningStateProvisioning ProvisioningState = "Provisioning" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUnknown ... - ProvisioningStateUnknown ProvisioningState = "Unknown" - // ProvisioningStateUpdating ... - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateFailed, ProvisioningStateProvisioning, ProvisioningStateSucceeded, ProvisioningStateUnknown, ProvisioningStateUpdating} -} - -// RehydrationPriority enumerates the values for rehydration priority. -type RehydrationPriority string - -const ( - // RehydrationPriorityHigh ... - RehydrationPriorityHigh RehydrationPriority = "High" - // RehydrationPriorityInvalid ... - RehydrationPriorityInvalid RehydrationPriority = "Invalid" - // RehydrationPriorityStandard ... - RehydrationPriorityStandard RehydrationPriority = "Standard" -) - -// PossibleRehydrationPriorityValues returns an array of possible values for the RehydrationPriority const type. -func PossibleRehydrationPriorityValues() []RehydrationPriority { - return []RehydrationPriority{RehydrationPriorityHigh, RehydrationPriorityInvalid, RehydrationPriorityStandard} -} - -// RehydrationStatus enumerates the values for rehydration status. -type RehydrationStatus string - -const ( - // RehydrationStatusCOMPLETED ... - RehydrationStatusCOMPLETED RehydrationStatus = "COMPLETED" - // RehydrationStatusCREATEINPROGRESS ... - RehydrationStatusCREATEINPROGRESS RehydrationStatus = "CREATE_IN_PROGRESS" - // RehydrationStatusDELETED ... - RehydrationStatusDELETED RehydrationStatus = "DELETED" - // RehydrationStatusDELETEINPROGRESS ... - RehydrationStatusDELETEINPROGRESS RehydrationStatus = "DELETE_IN_PROGRESS" - // RehydrationStatusFAILED ... - RehydrationStatusFAILED RehydrationStatus = "FAILED" -) - -// PossibleRehydrationStatusValues returns an array of possible values for the RehydrationStatus const type. -func PossibleRehydrationStatusValues() []RehydrationStatus { - return []RehydrationStatus{RehydrationStatusCOMPLETED, RehydrationStatusCREATEINPROGRESS, RehydrationStatusDELETED, RehydrationStatusDELETEINPROGRESS, RehydrationStatusFAILED} -} - -// ResourceMoveState enumerates the values for resource move state. -type ResourceMoveState string - -const ( - // ResourceMoveStateCommitFailed ... - ResourceMoveStateCommitFailed ResourceMoveState = "CommitFailed" - // ResourceMoveStateCommitTimedout ... - ResourceMoveStateCommitTimedout ResourceMoveState = "CommitTimedout" - // ResourceMoveStateCriticalFailure ... - ResourceMoveStateCriticalFailure ResourceMoveState = "CriticalFailure" - // ResourceMoveStateFailed ... - ResourceMoveStateFailed ResourceMoveState = "Failed" - // ResourceMoveStateInProgress ... - ResourceMoveStateInProgress ResourceMoveState = "InProgress" - // ResourceMoveStateMoveSucceeded ... - ResourceMoveStateMoveSucceeded ResourceMoveState = "MoveSucceeded" - // ResourceMoveStatePartialSuccess ... - ResourceMoveStatePartialSuccess ResourceMoveState = "PartialSuccess" - // ResourceMoveStatePrepareFailed ... - ResourceMoveStatePrepareFailed ResourceMoveState = "PrepareFailed" - // ResourceMoveStatePrepareTimedout ... - ResourceMoveStatePrepareTimedout ResourceMoveState = "PrepareTimedout" - // ResourceMoveStateUnknown ... - ResourceMoveStateUnknown ResourceMoveState = "Unknown" -) - -// PossibleResourceMoveStateValues returns an array of possible values for the ResourceMoveState const type. -func PossibleResourceMoveStateValues() []ResourceMoveState { - return []ResourceMoveState{ResourceMoveStateCommitFailed, ResourceMoveStateCommitTimedout, ResourceMoveStateCriticalFailure, ResourceMoveStateFailed, ResourceMoveStateInProgress, ResourceMoveStateMoveSucceeded, ResourceMoveStatePartialSuccess, ResourceMoveStatePrepareFailed, ResourceMoveStatePrepareTimedout, ResourceMoveStateUnknown} -} - -// RestoreSourceDataStoreType enumerates the values for restore source data store type. -type RestoreSourceDataStoreType string - -const ( - // RestoreSourceDataStoreTypeArchiveStore ... - RestoreSourceDataStoreTypeArchiveStore RestoreSourceDataStoreType = "ArchiveStore" - // RestoreSourceDataStoreTypeOperationalStore ... - RestoreSourceDataStoreTypeOperationalStore RestoreSourceDataStoreType = "OperationalStore" - // RestoreSourceDataStoreTypeVaultStore ... - RestoreSourceDataStoreTypeVaultStore RestoreSourceDataStoreType = "VaultStore" -) - -// PossibleRestoreSourceDataStoreTypeValues returns an array of possible values for the RestoreSourceDataStoreType const type. -func PossibleRestoreSourceDataStoreTypeValues() []RestoreSourceDataStoreType { - return []RestoreSourceDataStoreType{RestoreSourceDataStoreTypeArchiveStore, RestoreSourceDataStoreTypeOperationalStore, RestoreSourceDataStoreTypeVaultStore} -} - -// RestoreTargetLocationType enumerates the values for restore target location type. -type RestoreTargetLocationType string - -const ( - // RestoreTargetLocationTypeAzureBlobs ... - RestoreTargetLocationTypeAzureBlobs RestoreTargetLocationType = "AzureBlobs" - // RestoreTargetLocationTypeAzureFiles ... - RestoreTargetLocationTypeAzureFiles RestoreTargetLocationType = "AzureFiles" - // RestoreTargetLocationTypeInvalid ... - RestoreTargetLocationTypeInvalid RestoreTargetLocationType = "Invalid" -) - -// PossibleRestoreTargetLocationTypeValues returns an array of possible values for the RestoreTargetLocationType const type. -func PossibleRestoreTargetLocationTypeValues() []RestoreTargetLocationType { - return []RestoreTargetLocationType{RestoreTargetLocationTypeAzureBlobs, RestoreTargetLocationTypeAzureFiles, RestoreTargetLocationTypeInvalid} -} - -// SecretStoreType enumerates the values for secret store type. -type SecretStoreType string - -const ( - // SecretStoreTypeAzureKeyVault ... - SecretStoreTypeAzureKeyVault SecretStoreType = "AzureKeyVault" - // SecretStoreTypeInvalid ... - SecretStoreTypeInvalid SecretStoreType = "Invalid" -) - -// PossibleSecretStoreTypeValues returns an array of possible values for the SecretStoreType const type. -func PossibleSecretStoreTypeValues() []SecretStoreType { - return []SecretStoreType{SecretStoreTypeAzureKeyVault, SecretStoreTypeInvalid} -} - -// SourceDataStoreType enumerates the values for source data store type. -type SourceDataStoreType string - -const ( - // SourceDataStoreTypeArchiveStore ... - SourceDataStoreTypeArchiveStore SourceDataStoreType = "ArchiveStore" - // SourceDataStoreTypeSnapshotStore ... - SourceDataStoreTypeSnapshotStore SourceDataStoreType = "SnapshotStore" - // SourceDataStoreTypeVaultStore ... - SourceDataStoreTypeVaultStore SourceDataStoreType = "VaultStore" -) - -// PossibleSourceDataStoreTypeValues returns an array of possible values for the SourceDataStoreType const type. -func PossibleSourceDataStoreTypeValues() []SourceDataStoreType { - return []SourceDataStoreType{SourceDataStoreTypeArchiveStore, SourceDataStoreTypeSnapshotStore, SourceDataStoreTypeVaultStore} -} - -// Status enumerates the values for status. -type Status string - -const ( - // StatusConfiguringProtection ... - StatusConfiguringProtection Status = "ConfiguringProtection" - // StatusConfiguringProtectionFailed ... - StatusConfiguringProtectionFailed Status = "ConfiguringProtectionFailed" - // StatusProtectionConfigured ... - StatusProtectionConfigured Status = "ProtectionConfigured" - // StatusProtectionStopped ... - StatusProtectionStopped Status = "ProtectionStopped" - // StatusSoftDeleted ... - StatusSoftDeleted Status = "SoftDeleted" - // StatusSoftDeleting ... - StatusSoftDeleting Status = "SoftDeleting" -) - -// PossibleStatusValues returns an array of possible values for the Status const type. -func PossibleStatusValues() []Status { - return []Status{StatusConfiguringProtection, StatusConfiguringProtectionFailed, StatusProtectionConfigured, StatusProtectionStopped, StatusSoftDeleted, StatusSoftDeleting} -} - -// StorageSettingStoreTypes enumerates the values for storage setting store types. -type StorageSettingStoreTypes string - -const ( - // StorageSettingStoreTypesArchiveStore ... - StorageSettingStoreTypesArchiveStore StorageSettingStoreTypes = "ArchiveStore" - // StorageSettingStoreTypesSnapshotStore ... - StorageSettingStoreTypesSnapshotStore StorageSettingStoreTypes = "SnapshotStore" - // StorageSettingStoreTypesVaultStore ... - StorageSettingStoreTypesVaultStore StorageSettingStoreTypes = "VaultStore" -) - -// PossibleStorageSettingStoreTypesValues returns an array of possible values for the StorageSettingStoreTypes const type. -func PossibleStorageSettingStoreTypesValues() []StorageSettingStoreTypes { - return []StorageSettingStoreTypes{StorageSettingStoreTypesArchiveStore, StorageSettingStoreTypesSnapshotStore, StorageSettingStoreTypesVaultStore} -} - -// StorageSettingTypes enumerates the values for storage setting types. -type StorageSettingTypes string - -const ( - // StorageSettingTypesGeoRedundant ... - StorageSettingTypesGeoRedundant StorageSettingTypes = "GeoRedundant" - // StorageSettingTypesLocallyRedundant ... - StorageSettingTypesLocallyRedundant StorageSettingTypes = "LocallyRedundant" -) - -// PossibleStorageSettingTypesValues returns an array of possible values for the StorageSettingTypes const type. -func PossibleStorageSettingTypesValues() []StorageSettingTypes { - return []StorageSettingTypes{StorageSettingTypesGeoRedundant, StorageSettingTypesLocallyRedundant} -} - -// WeekNumber enumerates the values for week number. -type WeekNumber string - -const ( - // WeekNumberFirst ... - WeekNumberFirst WeekNumber = "First" - // WeekNumberFourth ... - WeekNumberFourth WeekNumber = "Fourth" - // WeekNumberLast ... - WeekNumberLast WeekNumber = "Last" - // WeekNumberSecond ... - WeekNumberSecond WeekNumber = "Second" - // WeekNumberThird ... - WeekNumberThird WeekNumber = "Third" -) - -// PossibleWeekNumberValues returns an array of possible values for the WeekNumber const type. -func PossibleWeekNumberValues() []WeekNumber { - return []WeekNumber{WeekNumberFirst, WeekNumberFourth, WeekNumberLast, WeekNumberSecond, WeekNumberThird} -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/exportjobs.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/exportjobs.go deleted file mode 100644 index c99af74ac9d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/exportjobs.go +++ /dev/null @@ -1,109 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" -) - -// ExportJobsClient is the open API 2.0 Specs for Azure Data Protection service -type ExportJobsClient struct { - BaseClient -} - -// NewExportJobsClient creates an instance of the ExportJobsClient client. -func NewExportJobsClient(subscriptionID string) ExportJobsClient { - return NewExportJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExportJobsClientWithBaseURI creates an instance of the ExportJobsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewExportJobsClientWithBaseURI(baseURI string, subscriptionID string) ExportJobsClient { - return ExportJobsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Trigger triggers export of jobs and returns an OperationID to track. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -// vaultName - the name of the backup vault. -func (client ExportJobsClient) Trigger(ctx context.Context, resourceGroupName string, vaultName string) (result ExportJobsTriggerFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportJobsClient.Trigger") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.TriggerPreparer(ctx, resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ExportJobsClient", "Trigger", nil, "Failure preparing request") - return - } - - result, err = client.TriggerSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ExportJobsClient", "Trigger", nil, "Failure sending request") - return - } - - return -} - -// TriggerPreparer prepares the Trigger request. -func (client ExportJobsClient) TriggerPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// TriggerSender sends the Trigger request. The method will close the -// http.Response Body if it receives an error. -func (client ExportJobsClient) TriggerSender(req *http.Request) (future ExportJobsTriggerFuture, err error) { - var resp *http.Response - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// TriggerResponder handles the response to the Trigger request. The method always -// closes the http.Response Body. -func (client ExportJobsClient) TriggerResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/exportjobsoperationresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/exportjobsoperationresult.go deleted file mode 100644 index 03e70773d69..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/exportjobsoperationresult.go +++ /dev/null @@ -1,113 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" -) - -// ExportJobsOperationResultClient is the open API 2.0 Specs for Azure Data Protection service -type ExportJobsOperationResultClient struct { - BaseClient -} - -// NewExportJobsOperationResultClient creates an instance of the ExportJobsOperationResultClient client. -func NewExportJobsOperationResultClient(subscriptionID string) ExportJobsOperationResultClient { - return NewExportJobsOperationResultClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExportJobsOperationResultClientWithBaseURI creates an instance of the ExportJobsOperationResultClient client -// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign -// clouds, Azure stack). -func NewExportJobsOperationResultClientWithBaseURI(baseURI string, subscriptionID string) ExportJobsOperationResultClient { - return ExportJobsOperationResultClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it -// also contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized -// format. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -// vaultName - the name of the backup vault. -// operationID - operationID which represents the export job. -func (client ExportJobsOperationResultClient) Get(ctx context.Context, resourceGroupName string, vaultName string, operationID string) (result ExportJobsResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportJobsOperationResultClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, vaultName, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ExportJobsOperationResultClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ExportJobsOperationResultClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ExportJobsOperationResultClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExportJobsOperationResultClient) GetPreparer(ctx context.Context, resourceGroupName string, vaultName string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "operationId": autorest.Encode("path", operationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/operations/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ExportJobsOperationResultClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ExportJobsOperationResultClient) GetResponder(resp *http.Response) (result ExportJobsResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/jobs.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/jobs.go deleted file mode 100644 index e35e5a3f896..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/jobs.go +++ /dev/null @@ -1,228 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" -) - -// JobsClient is the open API 2.0 Specs for Azure Data Protection service -type JobsClient struct { - BaseClient -} - -// NewJobsClient creates an instance of the JobsClient client. -func NewJobsClient(subscriptionID string) JobsClient { - return NewJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewJobsClientWithBaseURI creates an instance of the JobsClient client using a custom endpoint. Use this when -// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient { - return JobsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a job with id in a backup vault -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -// vaultName - the name of the backup vault. -// jobID - the Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). -func (client JobsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, jobID string) (result AzureBackupJobResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, vaultName, jobID) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.JobsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.JobsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.JobsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client JobsClient) GetPreparer(ctx context.Context, resourceGroupName string, vaultName string, jobID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "jobId": autorest.Encode("path", jobID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client JobsClient) GetResponder(resp *http.Response) (result AzureBackupJobResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns list of jobs belonging to a backup vault -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -// vaultName - the name of the backup vault. -func (client JobsClient) List(ctx context.Context, resourceGroupName string, vaultName string) (result AzureBackupJobResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.List") - defer func() { - sc := -1 - if result.abjrl.Response.Response != nil { - sc = result.abjrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, vaultName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.JobsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.abjrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.JobsClient", "List", resp, "Failure sending request") - return - } - - result.abjrl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.JobsClient", "List", resp, "Failure responding to request") - return - } - if result.abjrl.hasNextLink() && result.abjrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client JobsClient) ListPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client JobsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client JobsClient) ListResponder(resp *http.Response) (result AzureBackupJobResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client JobsClient) listNextResults(ctx context.Context, lastResults AzureBackupJobResourceList) (result AzureBackupJobResourceList, err error) { - req, err := lastResults.azureBackupJobResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dataprotection.JobsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dataprotection.JobsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.JobsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client JobsClient) ListComplete(ctx context.Context, resourceGroupName string, vaultName string) (result AzureBackupJobResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, vaultName) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/models.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/models.go deleted file mode 100644 index b42f4600761..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/models.go +++ /dev/null @@ -1,6462 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/dataprotection/mgmt/2021-07-01/dataprotection" - -// AbsoluteDeleteOption delete option with duration -type AbsoluteDeleteOption struct { - // Duration - Duration of deletion after given timespan - Duration *string `json:"duration,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicDeleteOptionObjectTypeDeleteOption', 'ObjectTypeBasicDeleteOptionObjectTypeAbsoluteDeleteOption' - ObjectType ObjectTypeBasicDeleteOption `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for AbsoluteDeleteOption. -func (ado AbsoluteDeleteOption) MarshalJSON() ([]byte, error) { - ado.ObjectType = ObjectTypeBasicDeleteOptionObjectTypeAbsoluteDeleteOption - objectMap := make(map[string]interface{}) - if ado.Duration != nil { - objectMap["duration"] = ado.Duration - } - if ado.ObjectType != "" { - objectMap["objectType"] = ado.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAbsoluteDeleteOption is the BasicDeleteOption implementation for AbsoluteDeleteOption. -func (ado AbsoluteDeleteOption) AsAbsoluteDeleteOption() (*AbsoluteDeleteOption, bool) { - return &ado, true -} - -// AsDeleteOption is the BasicDeleteOption implementation for AbsoluteDeleteOption. -func (ado AbsoluteDeleteOption) AsDeleteOption() (*DeleteOption, bool) { - return nil, false -} - -// AsBasicDeleteOption is the BasicDeleteOption implementation for AbsoluteDeleteOption. -func (ado AbsoluteDeleteOption) AsBasicDeleteOption() (BasicDeleteOption, bool) { - return &ado, true -} - -// AdHocBackupRuleOptions adhoc backup rules -type AdHocBackupRuleOptions struct { - RuleName *string `json:"ruleName,omitempty"` - TriggerOption *AdhocBackupTriggerOption `json:"triggerOption,omitempty"` -} - -// AdhocBackupTriggerOption adhoc backup trigger option -type AdhocBackupTriggerOption struct { - RetentionTagOverride *string `json:"retentionTagOverride,omitempty"` -} - -// AdhocBasedTaggingCriteria adhoc backup tagging criteria -type AdhocBasedTaggingCriteria struct { - // TagInfo - Retention tag information - TagInfo *RetentionTag `json:"tagInfo,omitempty"` -} - -// AdhocBasedTriggerContext adhoc trigger context -type AdhocBasedTriggerContext struct { - // TaggingCriteria - Tagging Criteria containing retention tag for adhoc backup. - TaggingCriteria *AdhocBasedTaggingCriteria `json:"taggingCriteria,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicTriggerContextObjectTypeTriggerContext', 'ObjectTypeBasicTriggerContextObjectTypeAdhocBasedTriggerContext', 'ObjectTypeBasicTriggerContextObjectTypeScheduleBasedTriggerContext' - ObjectType ObjectTypeBasicTriggerContext `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for AdhocBasedTriggerContext. -func (abtc AdhocBasedTriggerContext) MarshalJSON() ([]byte, error) { - abtc.ObjectType = ObjectTypeBasicTriggerContextObjectTypeAdhocBasedTriggerContext - objectMap := make(map[string]interface{}) - if abtc.TaggingCriteria != nil { - objectMap["taggingCriteria"] = abtc.TaggingCriteria - } - if abtc.ObjectType != "" { - objectMap["objectType"] = abtc.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAdhocBasedTriggerContext is the BasicTriggerContext implementation for AdhocBasedTriggerContext. -func (abtc AdhocBasedTriggerContext) AsAdhocBasedTriggerContext() (*AdhocBasedTriggerContext, bool) { - return &abtc, true -} - -// AsScheduleBasedTriggerContext is the BasicTriggerContext implementation for AdhocBasedTriggerContext. -func (abtc AdhocBasedTriggerContext) AsScheduleBasedTriggerContext() (*ScheduleBasedTriggerContext, bool) { - return nil, false -} - -// AsTriggerContext is the BasicTriggerContext implementation for AdhocBasedTriggerContext. -func (abtc AdhocBasedTriggerContext) AsTriggerContext() (*TriggerContext, bool) { - return nil, false -} - -// AsBasicTriggerContext is the BasicTriggerContext implementation for AdhocBasedTriggerContext. -func (abtc AdhocBasedTriggerContext) AsBasicTriggerContext() (BasicTriggerContext, bool) { - return &abtc, true -} - -// BasicAuthCredentials base class for different types of authentication credentials. -type BasicAuthCredentials interface { - AsSecretStoreBasedAuthCredentials() (*SecretStoreBasedAuthCredentials, bool) - AsAuthCredentials() (*AuthCredentials, bool) -} - -// AuthCredentials base class for different types of authentication credentials. -type AuthCredentials struct { - // ObjectType - Possible values include: 'ObjectTypeAuthCredentials', 'ObjectTypeSecretStoreBasedAuthCredentials' - ObjectType ObjectType `json:"objectType,omitempty"` -} - -func unmarshalBasicAuthCredentials(body []byte) (BasicAuthCredentials, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeSecretStoreBasedAuthCredentials): - var ssbac SecretStoreBasedAuthCredentials - err := json.Unmarshal(body, &ssbac) - return ssbac, err - default: - var ac AuthCredentials - err := json.Unmarshal(body, &ac) - return ac, err - } -} - -func unmarshalBasicAuthCredentialsArray(body []byte) ([]BasicAuthCredentials, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - acArray := make([]BasicAuthCredentials, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ac, err := unmarshalBasicAuthCredentials(*rawMessage) - if err != nil { - return nil, err - } - acArray[index] = ac - } - return acArray, nil -} - -// MarshalJSON is the custom marshaler for AuthCredentials. -func (ac AuthCredentials) MarshalJSON() ([]byte, error) { - ac.ObjectType = ObjectTypeAuthCredentials - objectMap := make(map[string]interface{}) - if ac.ObjectType != "" { - objectMap["objectType"] = ac.ObjectType - } - return json.Marshal(objectMap) -} - -// AsSecretStoreBasedAuthCredentials is the BasicAuthCredentials implementation for AuthCredentials. -func (ac AuthCredentials) AsSecretStoreBasedAuthCredentials() (*SecretStoreBasedAuthCredentials, bool) { - return nil, false -} - -// AsAuthCredentials is the BasicAuthCredentials implementation for AuthCredentials. -func (ac AuthCredentials) AsAuthCredentials() (*AuthCredentials, bool) { - return &ac, true -} - -// AsBasicAuthCredentials is the BasicAuthCredentials implementation for AuthCredentials. -func (ac AuthCredentials) AsBasicAuthCredentials() (BasicAuthCredentials, bool) { - return &ac, true -} - -// AzureBackupDiscreteRecoveryPoint azure backup discrete RecoveryPoint -type AzureBackupDiscreteRecoveryPoint struct { - FriendlyName *string `json:"friendlyName,omitempty"` - RecoveryPointDataStoresDetails *[]RecoveryPointDataStoreDetails `json:"recoveryPointDataStoresDetails,omitempty"` - RecoveryPointTime *date.Time `json:"recoveryPointTime,omitempty"` - PolicyName *string `json:"policyName,omitempty"` - PolicyVersion *string `json:"policyVersion,omitempty"` - RecoveryPointID *string `json:"recoveryPointId,omitempty"` - RecoveryPointType *string `json:"recoveryPointType,omitempty"` - RetentionTagName *string `json:"retentionTagName,omitempty"` - RetentionTagVersion *string `json:"retentionTagVersion,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicAzureBackupRecoveryPointObjectTypeAzureBackupRecoveryPoint', 'ObjectTypeBasicAzureBackupRecoveryPointObjectTypeAzureBackupDiscreteRecoveryPoint' - ObjectType ObjectTypeBasicAzureBackupRecoveryPoint `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureBackupDiscreteRecoveryPoint. -func (abdrp AzureBackupDiscreteRecoveryPoint) MarshalJSON() ([]byte, error) { - abdrp.ObjectType = ObjectTypeBasicAzureBackupRecoveryPointObjectTypeAzureBackupDiscreteRecoveryPoint - objectMap := make(map[string]interface{}) - if abdrp.FriendlyName != nil { - objectMap["friendlyName"] = abdrp.FriendlyName - } - if abdrp.RecoveryPointDataStoresDetails != nil { - objectMap["recoveryPointDataStoresDetails"] = abdrp.RecoveryPointDataStoresDetails - } - if abdrp.RecoveryPointTime != nil { - objectMap["recoveryPointTime"] = abdrp.RecoveryPointTime - } - if abdrp.PolicyName != nil { - objectMap["policyName"] = abdrp.PolicyName - } - if abdrp.PolicyVersion != nil { - objectMap["policyVersion"] = abdrp.PolicyVersion - } - if abdrp.RecoveryPointID != nil { - objectMap["recoveryPointId"] = abdrp.RecoveryPointID - } - if abdrp.RecoveryPointType != nil { - objectMap["recoveryPointType"] = abdrp.RecoveryPointType - } - if abdrp.RetentionTagName != nil { - objectMap["retentionTagName"] = abdrp.RetentionTagName - } - if abdrp.RetentionTagVersion != nil { - objectMap["retentionTagVersion"] = abdrp.RetentionTagVersion - } - if abdrp.ObjectType != "" { - objectMap["objectType"] = abdrp.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAzureBackupDiscreteRecoveryPoint is the BasicAzureBackupRecoveryPoint implementation for AzureBackupDiscreteRecoveryPoint. -func (abdrp AzureBackupDiscreteRecoveryPoint) AsAzureBackupDiscreteRecoveryPoint() (*AzureBackupDiscreteRecoveryPoint, bool) { - return &abdrp, true -} - -// AsAzureBackupRecoveryPoint is the BasicAzureBackupRecoveryPoint implementation for AzureBackupDiscreteRecoveryPoint. -func (abdrp AzureBackupDiscreteRecoveryPoint) AsAzureBackupRecoveryPoint() (*AzureBackupRecoveryPoint, bool) { - return nil, false -} - -// AsBasicAzureBackupRecoveryPoint is the BasicAzureBackupRecoveryPoint implementation for AzureBackupDiscreteRecoveryPoint. -func (abdrp AzureBackupDiscreteRecoveryPoint) AsBasicAzureBackupRecoveryPoint() (BasicAzureBackupRecoveryPoint, bool) { - return &abdrp, true -} - -// AzureBackupFindRestorableTimeRangesRequest list Restore Ranges Request -type AzureBackupFindRestorableTimeRangesRequest struct { - // SourceDataStoreType - Gets or sets the type of the source data store. Possible values include: 'RestoreSourceDataStoreTypeOperationalStore', 'RestoreSourceDataStoreTypeVaultStore', 'RestoreSourceDataStoreTypeArchiveStore' - SourceDataStoreType RestoreSourceDataStoreType `json:"sourceDataStoreType,omitempty"` - // StartTime - Start time for the List Restore Ranges request. ISO 8601 format. - StartTime *string `json:"startTime,omitempty"` - // EndTime - End time for the List Restore Ranges request. ISO 8601 format. - EndTime *string `json:"endTime,omitempty"` -} - -// AzureBackupFindRestorableTimeRangesRequestResource list Restore Ranges Request -type AzureBackupFindRestorableTimeRangesRequestResource struct { - // Content - AzureBackupFindRestorableTimeRangesRequestResource content - Content *AzureBackupFindRestorableTimeRangesRequest `json:"content,omitempty"` - SubscriptionID *string `json:"subscriptionId,omitempty"` - URI *string `json:"uri,omitempty"` - Headers map[string][]string `json:"headers"` - SupportedGroupVersions *[]string `json:"supportedGroupVersions,omitempty"` - CultureInfo *string `json:"cultureInfo,omitempty"` - Parameters map[string]*string `json:"parameters"` - HTTPMethod *string `json:"httpMethod,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureBackupFindRestorableTimeRangesRequestResource. -func (abfrtrrr AzureBackupFindRestorableTimeRangesRequestResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if abfrtrrr.Content != nil { - objectMap["content"] = abfrtrrr.Content - } - if abfrtrrr.SubscriptionID != nil { - objectMap["subscriptionId"] = abfrtrrr.SubscriptionID - } - if abfrtrrr.URI != nil { - objectMap["uri"] = abfrtrrr.URI - } - if abfrtrrr.Headers != nil { - objectMap["headers"] = abfrtrrr.Headers - } - if abfrtrrr.SupportedGroupVersions != nil { - objectMap["supportedGroupVersions"] = abfrtrrr.SupportedGroupVersions - } - if abfrtrrr.CultureInfo != nil { - objectMap["cultureInfo"] = abfrtrrr.CultureInfo - } - if abfrtrrr.Parameters != nil { - objectMap["parameters"] = abfrtrrr.Parameters - } - if abfrtrrr.HTTPMethod != nil { - objectMap["httpMethod"] = abfrtrrr.HTTPMethod - } - return json.Marshal(objectMap) -} - -// AzureBackupFindRestorableTimeRangesResponse list Restore Ranges Response -type AzureBackupFindRestorableTimeRangesResponse struct { - // RestorableTimeRanges - Returns the Restore Ranges available on the Backup Instance. - RestorableTimeRanges *[]RestorableTimeRange `json:"restorableTimeRanges,omitempty"` - ObjectType *string `json:"objectType,omitempty"` -} - -// AzureBackupFindRestorableTimeRangesResponseResource list Restore Ranges Response -type AzureBackupFindRestorableTimeRangesResponseResource struct { - autorest.Response `json:"-"` - // Properties - AzureBackupFindRestorableTimeRangesResponseResource properties - Properties *AzureBackupFindRestorableTimeRangesResponse `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureBackupFindRestorableTimeRangesResponseResource. -func (abfrtrrr AzureBackupFindRestorableTimeRangesResponseResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if abfrtrrr.Properties != nil { - objectMap["properties"] = abfrtrrr.Properties - } - if abfrtrrr.SystemData != nil { - objectMap["systemData"] = abfrtrrr.SystemData - } - return json.Marshal(objectMap) -} - -// AzureBackupJob azureBackup Job Class -type AzureBackupJob struct { - // ActivityID - Job Activity Id - ActivityID *string `json:"activityID,omitempty"` - // BackupInstanceFriendlyName - Name of the Backup Instance - BackupInstanceFriendlyName *string `json:"backupInstanceFriendlyName,omitempty"` - // BackupInstanceID - READ-ONLY; ARM ID of the Backup Instance - BackupInstanceID *string `json:"backupInstanceId,omitempty"` - // DataSourceID - ARM ID of the DataSource - DataSourceID *string `json:"dataSourceId,omitempty"` - // DataSourceLocation - Location of the DataSource - DataSourceLocation *string `json:"dataSourceLocation,omitempty"` - // DataSourceName - User Friendly Name of the DataSource - DataSourceName *string `json:"dataSourceName,omitempty"` - // DataSourceSetName - Data Source Set Name of the DataSource - DataSourceSetName *string `json:"dataSourceSetName,omitempty"` - // DataSourceType - Type of DataSource - DataSourceType *string `json:"dataSourceType,omitempty"` - // Duration - Total run time of the job. ISO 8601 format. - Duration *string `json:"duration,omitempty"` - // EndTime - READ-ONLY; EndTime of the job(in UTC) - EndTime *date.Time `json:"endTime,omitempty"` - // ErrorDetails - READ-ONLY; A List, detailing the errors related to the job - ErrorDetails *[]UserFacingError `json:"errorDetails,omitempty"` - // ExtendedInfo - READ-ONLY; Extended Information about the job - ExtendedInfo *JobExtendedInfo `json:"extendedInfo,omitempty"` - // IsUserTriggered - Indicated that whether the job is adhoc(true) or scheduled(false) - IsUserTriggered *bool `json:"isUserTriggered,omitempty"` - // Operation - It indicates the type of Job i.e. Backup:full/log/diff ;Restore:ALR/OLR; Tiering:Backup/Archive ; Management:ConfigureProtection/UnConfigure - Operation *string `json:"operation,omitempty"` - // OperationCategory - It indicates the type of Job i.e. Backup/Restore/Tiering/Management - OperationCategory *string `json:"operationCategory,omitempty"` - // PolicyID - READ-ONLY; ARM ID of the policy - PolicyID *string `json:"policyId,omitempty"` - // PolicyName - READ-ONLY; Name of the policy - PolicyName *string `json:"policyName,omitempty"` - // ProgressEnabled - Indicated whether progress is enabled for the job - ProgressEnabled *bool `json:"progressEnabled,omitempty"` - // ProgressURL - READ-ONLY; Url which contains job's progress - ProgressURL *string `json:"progressUrl,omitempty"` - // RestoreType - READ-ONLY; It indicates the sub type of operation i.e. in case of Restore it can be ALR/OLR - RestoreType *string `json:"restoreType,omitempty"` - // SourceResourceGroup - Resource Group Name of the Datasource - SourceResourceGroup *string `json:"sourceResourceGroup,omitempty"` - // SourceSubscriptionID - SubscriptionId corresponding to the DataSource - SourceSubscriptionID *string `json:"sourceSubscriptionID,omitempty"` - // StartTime - StartTime of the job(in UTC) - StartTime *date.Time `json:"startTime,omitempty"` - // Status - Status of the job like InProgress/Success/Failed/Cancelled/SuccessWithWarning - Status *string `json:"status,omitempty"` - // SubscriptionID - Subscription Id of the corresponding backup vault - SubscriptionID *string `json:"subscriptionId,omitempty"` - // SupportedActions - List of supported actions - SupportedActions *[]string `json:"supportedActions,omitempty"` - // VaultName - Name of the vault - VaultName *string `json:"vaultName,omitempty"` - Etag *string `json:"etag,omitempty"` - SourceDataStoreName *string `json:"sourceDataStoreName,omitempty"` - DestinationDataStoreName *string `json:"destinationDataStoreName,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureBackupJob. -func (abj AzureBackupJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if abj.ActivityID != nil { - objectMap["activityID"] = abj.ActivityID - } - if abj.BackupInstanceFriendlyName != nil { - objectMap["backupInstanceFriendlyName"] = abj.BackupInstanceFriendlyName - } - if abj.DataSourceID != nil { - objectMap["dataSourceId"] = abj.DataSourceID - } - if abj.DataSourceLocation != nil { - objectMap["dataSourceLocation"] = abj.DataSourceLocation - } - if abj.DataSourceName != nil { - objectMap["dataSourceName"] = abj.DataSourceName - } - if abj.DataSourceSetName != nil { - objectMap["dataSourceSetName"] = abj.DataSourceSetName - } - if abj.DataSourceType != nil { - objectMap["dataSourceType"] = abj.DataSourceType - } - if abj.Duration != nil { - objectMap["duration"] = abj.Duration - } - if abj.IsUserTriggered != nil { - objectMap["isUserTriggered"] = abj.IsUserTriggered - } - if abj.Operation != nil { - objectMap["operation"] = abj.Operation - } - if abj.OperationCategory != nil { - objectMap["operationCategory"] = abj.OperationCategory - } - if abj.ProgressEnabled != nil { - objectMap["progressEnabled"] = abj.ProgressEnabled - } - if abj.SourceResourceGroup != nil { - objectMap["sourceResourceGroup"] = abj.SourceResourceGroup - } - if abj.SourceSubscriptionID != nil { - objectMap["sourceSubscriptionID"] = abj.SourceSubscriptionID - } - if abj.StartTime != nil { - objectMap["startTime"] = abj.StartTime - } - if abj.Status != nil { - objectMap["status"] = abj.Status - } - if abj.SubscriptionID != nil { - objectMap["subscriptionId"] = abj.SubscriptionID - } - if abj.SupportedActions != nil { - objectMap["supportedActions"] = abj.SupportedActions - } - if abj.VaultName != nil { - objectMap["vaultName"] = abj.VaultName - } - if abj.Etag != nil { - objectMap["etag"] = abj.Etag - } - if abj.SourceDataStoreName != nil { - objectMap["sourceDataStoreName"] = abj.SourceDataStoreName - } - if abj.DestinationDataStoreName != nil { - objectMap["destinationDataStoreName"] = abj.DestinationDataStoreName - } - return json.Marshal(objectMap) -} - -// AzureBackupJobResource azureBackup Job Resource Class -type AzureBackupJobResource struct { - autorest.Response `json:"-"` - // Properties - AzureBackupJobResource properties - Properties *AzureBackupJob `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureBackupJobResource. -func (abjr AzureBackupJobResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if abjr.Properties != nil { - objectMap["properties"] = abjr.Properties - } - if abjr.SystemData != nil { - objectMap["systemData"] = abjr.SystemData - } - return json.Marshal(objectMap) -} - -// AzureBackupJobResourceList list of AzureBackup Job resources -type AzureBackupJobResourceList struct { - autorest.Response `json:"-"` - // Value - List of resources. - Value *[]AzureBackupJobResource `json:"value,omitempty"` - // NextLink - The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// AzureBackupJobResourceListIterator provides access to a complete listing of AzureBackupJobResource -// values. -type AzureBackupJobResourceListIterator struct { - i int - page AzureBackupJobResourceListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AzureBackupJobResourceListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureBackupJobResourceListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AzureBackupJobResourceListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AzureBackupJobResourceListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AzureBackupJobResourceListIterator) Response() AzureBackupJobResourceList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AzureBackupJobResourceListIterator) Value() AzureBackupJobResource { - if !iter.page.NotDone() { - return AzureBackupJobResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AzureBackupJobResourceListIterator type. -func NewAzureBackupJobResourceListIterator(page AzureBackupJobResourceListPage) AzureBackupJobResourceListIterator { - return AzureBackupJobResourceListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (abjrl AzureBackupJobResourceList) IsEmpty() bool { - return abjrl.Value == nil || len(*abjrl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (abjrl AzureBackupJobResourceList) hasNextLink() bool { - return abjrl.NextLink != nil && len(*abjrl.NextLink) != 0 -} - -// azureBackupJobResourceListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (abjrl AzureBackupJobResourceList) azureBackupJobResourceListPreparer(ctx context.Context) (*http.Request, error) { - if !abjrl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(abjrl.NextLink))) -} - -// AzureBackupJobResourceListPage contains a page of AzureBackupJobResource values. -type AzureBackupJobResourceListPage struct { - fn func(context.Context, AzureBackupJobResourceList) (AzureBackupJobResourceList, error) - abjrl AzureBackupJobResourceList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AzureBackupJobResourceListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureBackupJobResourceListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.abjrl) - if err != nil { - return err - } - page.abjrl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AzureBackupJobResourceListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AzureBackupJobResourceListPage) NotDone() bool { - return !page.abjrl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AzureBackupJobResourceListPage) Response() AzureBackupJobResourceList { - return page.abjrl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AzureBackupJobResourceListPage) Values() []AzureBackupJobResource { - if page.abjrl.IsEmpty() { - return nil - } - return *page.abjrl.Value -} - -// Creates a new instance of the AzureBackupJobResourceListPage type. -func NewAzureBackupJobResourceListPage(cur AzureBackupJobResourceList, getNextPage func(context.Context, AzureBackupJobResourceList) (AzureBackupJobResourceList, error)) AzureBackupJobResourceListPage { - return AzureBackupJobResourceListPage{ - fn: getNextPage, - abjrl: cur, - } -} - -// AzureBackupParams azure backup parameters -type AzureBackupParams struct { - // BackupType - BackupType ; Full/Incremental etc - BackupType *string `json:"backupType,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicBackupParametersObjectTypeBackupParameters', 'ObjectTypeBasicBackupParametersObjectTypeAzureBackupParams' - ObjectType ObjectTypeBasicBackupParameters `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureBackupParams. -func (abp AzureBackupParams) MarshalJSON() ([]byte, error) { - abp.ObjectType = ObjectTypeBasicBackupParametersObjectTypeAzureBackupParams - objectMap := make(map[string]interface{}) - if abp.BackupType != nil { - objectMap["backupType"] = abp.BackupType - } - if abp.ObjectType != "" { - objectMap["objectType"] = abp.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAzureBackupParams is the BasicBackupParameters implementation for AzureBackupParams. -func (abp AzureBackupParams) AsAzureBackupParams() (*AzureBackupParams, bool) { - return &abp, true -} - -// AsBackupParameters is the BasicBackupParameters implementation for AzureBackupParams. -func (abp AzureBackupParams) AsBackupParameters() (*BackupParameters, bool) { - return nil, false -} - -// AsBasicBackupParameters is the BasicBackupParameters implementation for AzureBackupParams. -func (abp AzureBackupParams) AsBasicBackupParameters() (BasicBackupParameters, bool) { - return &abp, true -} - -// BasicAzureBackupRecoveryPoint azure backup recoveryPoint -type BasicAzureBackupRecoveryPoint interface { - AsAzureBackupDiscreteRecoveryPoint() (*AzureBackupDiscreteRecoveryPoint, bool) - AsAzureBackupRecoveryPoint() (*AzureBackupRecoveryPoint, bool) -} - -// AzureBackupRecoveryPoint azure backup recoveryPoint -type AzureBackupRecoveryPoint struct { - // ObjectType - Possible values include: 'ObjectTypeBasicAzureBackupRecoveryPointObjectTypeAzureBackupRecoveryPoint', 'ObjectTypeBasicAzureBackupRecoveryPointObjectTypeAzureBackupDiscreteRecoveryPoint' - ObjectType ObjectTypeBasicAzureBackupRecoveryPoint `json:"objectType,omitempty"` -} - -func unmarshalBasicAzureBackupRecoveryPoint(body []byte) (BasicAzureBackupRecoveryPoint, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicAzureBackupRecoveryPointObjectTypeAzureBackupDiscreteRecoveryPoint): - var abdrp AzureBackupDiscreteRecoveryPoint - err := json.Unmarshal(body, &abdrp) - return abdrp, err - default: - var abrp AzureBackupRecoveryPoint - err := json.Unmarshal(body, &abrp) - return abrp, err - } -} - -func unmarshalBasicAzureBackupRecoveryPointArray(body []byte) ([]BasicAzureBackupRecoveryPoint, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - abrpArray := make([]BasicAzureBackupRecoveryPoint, len(rawMessages)) - - for index, rawMessage := range rawMessages { - abrp, err := unmarshalBasicAzureBackupRecoveryPoint(*rawMessage) - if err != nil { - return nil, err - } - abrpArray[index] = abrp - } - return abrpArray, nil -} - -// MarshalJSON is the custom marshaler for AzureBackupRecoveryPoint. -func (abrp AzureBackupRecoveryPoint) MarshalJSON() ([]byte, error) { - abrp.ObjectType = ObjectTypeBasicAzureBackupRecoveryPointObjectTypeAzureBackupRecoveryPoint - objectMap := make(map[string]interface{}) - if abrp.ObjectType != "" { - objectMap["objectType"] = abrp.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAzureBackupDiscreteRecoveryPoint is the BasicAzureBackupRecoveryPoint implementation for AzureBackupRecoveryPoint. -func (abrp AzureBackupRecoveryPoint) AsAzureBackupDiscreteRecoveryPoint() (*AzureBackupDiscreteRecoveryPoint, bool) { - return nil, false -} - -// AsAzureBackupRecoveryPoint is the BasicAzureBackupRecoveryPoint implementation for AzureBackupRecoveryPoint. -func (abrp AzureBackupRecoveryPoint) AsAzureBackupRecoveryPoint() (*AzureBackupRecoveryPoint, bool) { - return &abrp, true -} - -// AsBasicAzureBackupRecoveryPoint is the BasicAzureBackupRecoveryPoint implementation for AzureBackupRecoveryPoint. -func (abrp AzureBackupRecoveryPoint) AsBasicAzureBackupRecoveryPoint() (BasicAzureBackupRecoveryPoint, bool) { - return &abrp, true -} - -// BasicAzureBackupRecoveryPointBasedRestoreRequest azure backup recoveryPoint based restore request -type BasicAzureBackupRecoveryPointBasedRestoreRequest interface { - AsAzureBackupRestoreWithRehydrationRequest() (*AzureBackupRestoreWithRehydrationRequest, bool) - AsAzureBackupRecoveryPointBasedRestoreRequest() (*AzureBackupRecoveryPointBasedRestoreRequest, bool) -} - -// AzureBackupRecoveryPointBasedRestoreRequest azure backup recoveryPoint based restore request -type AzureBackupRecoveryPointBasedRestoreRequest struct { - RecoveryPointID *string `json:"recoveryPointId,omitempty"` - // RestoreTargetInfo - Gets or sets the restore target information. - RestoreTargetInfo BasicRestoreTargetInfoBase `json:"restoreTargetInfo,omitempty"` - // SourceDataStoreType - Gets or sets the type of the source data store. Possible values include: 'SourceDataStoreTypeArchiveStore', 'SourceDataStoreTypeSnapshotStore', 'SourceDataStoreTypeVaultStore' - SourceDataStoreType SourceDataStoreType `json:"sourceDataStoreType,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreRequest', 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryPointBasedRestoreRequest', 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreWithRehydrationRequest', 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryTimeBasedRestoreRequest' - ObjectType ObjectTypeBasicAzureBackupRestoreRequest `json:"objectType,omitempty"` -} - -func unmarshalBasicAzureBackupRecoveryPointBasedRestoreRequest(body []byte) (BasicAzureBackupRecoveryPointBasedRestoreRequest, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreWithRehydrationRequest): - var abrwrr AzureBackupRestoreWithRehydrationRequest - err := json.Unmarshal(body, &abrwrr) - return abrwrr, err - default: - var abrpbrr AzureBackupRecoveryPointBasedRestoreRequest - err := json.Unmarshal(body, &abrpbrr) - return abrpbrr, err - } -} - -func unmarshalBasicAzureBackupRecoveryPointBasedRestoreRequestArray(body []byte) ([]BasicAzureBackupRecoveryPointBasedRestoreRequest, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - abrpbrrArray := make([]BasicAzureBackupRecoveryPointBasedRestoreRequest, len(rawMessages)) - - for index, rawMessage := range rawMessages { - abrpbrr, err := unmarshalBasicAzureBackupRecoveryPointBasedRestoreRequest(*rawMessage) - if err != nil { - return nil, err - } - abrpbrrArray[index] = abrpbrr - } - return abrpbrrArray, nil -} - -// MarshalJSON is the custom marshaler for AzureBackupRecoveryPointBasedRestoreRequest. -func (abrpbrr AzureBackupRecoveryPointBasedRestoreRequest) MarshalJSON() ([]byte, error) { - abrpbrr.ObjectType = ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryPointBasedRestoreRequest - objectMap := make(map[string]interface{}) - if abrpbrr.RecoveryPointID != nil { - objectMap["recoveryPointId"] = abrpbrr.RecoveryPointID - } - objectMap["restoreTargetInfo"] = abrpbrr.RestoreTargetInfo - if abrpbrr.SourceDataStoreType != "" { - objectMap["sourceDataStoreType"] = abrpbrr.SourceDataStoreType - } - if abrpbrr.ObjectType != "" { - objectMap["objectType"] = abrpbrr.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAzureBackupRecoveryPointBasedRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRecoveryPointBasedRestoreRequest. -func (abrpbrr AzureBackupRecoveryPointBasedRestoreRequest) AsAzureBackupRecoveryPointBasedRestoreRequest() (*AzureBackupRecoveryPointBasedRestoreRequest, bool) { - return &abrpbrr, true -} - -// AsBasicAzureBackupRecoveryPointBasedRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRecoveryPointBasedRestoreRequest. -func (abrpbrr AzureBackupRecoveryPointBasedRestoreRequest) AsBasicAzureBackupRecoveryPointBasedRestoreRequest() (BasicAzureBackupRecoveryPointBasedRestoreRequest, bool) { - return &abrpbrr, true -} - -// AsAzureBackupRestoreWithRehydrationRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRecoveryPointBasedRestoreRequest. -func (abrpbrr AzureBackupRecoveryPointBasedRestoreRequest) AsAzureBackupRestoreWithRehydrationRequest() (*AzureBackupRestoreWithRehydrationRequest, bool) { - return nil, false -} - -// AsAzureBackupRecoveryTimeBasedRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRecoveryPointBasedRestoreRequest. -func (abrpbrr AzureBackupRecoveryPointBasedRestoreRequest) AsAzureBackupRecoveryTimeBasedRestoreRequest() (*AzureBackupRecoveryTimeBasedRestoreRequest, bool) { - return nil, false -} - -// AsAzureBackupRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRecoveryPointBasedRestoreRequest. -func (abrpbrr AzureBackupRecoveryPointBasedRestoreRequest) AsAzureBackupRestoreRequest() (*AzureBackupRestoreRequest, bool) { - return nil, false -} - -// AsBasicAzureBackupRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRecoveryPointBasedRestoreRequest. -func (abrpbrr AzureBackupRecoveryPointBasedRestoreRequest) AsBasicAzureBackupRestoreRequest() (BasicAzureBackupRestoreRequest, bool) { - return &abrpbrr, true -} - -// UnmarshalJSON is the custom unmarshaler for AzureBackupRecoveryPointBasedRestoreRequest struct. -func (abrpbrr *AzureBackupRecoveryPointBasedRestoreRequest) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "recoveryPointId": - if v != nil { - var recoveryPointID string - err = json.Unmarshal(*v, &recoveryPointID) - if err != nil { - return err - } - abrpbrr.RecoveryPointID = &recoveryPointID - } - case "restoreTargetInfo": - if v != nil { - restoreTargetInfo, err := unmarshalBasicRestoreTargetInfoBase(*v) - if err != nil { - return err - } - abrpbrr.RestoreTargetInfo = restoreTargetInfo - } - case "sourceDataStoreType": - if v != nil { - var sourceDataStoreType SourceDataStoreType - err = json.Unmarshal(*v, &sourceDataStoreType) - if err != nil { - return err - } - abrpbrr.SourceDataStoreType = sourceDataStoreType - } - case "objectType": - if v != nil { - var objectType ObjectTypeBasicAzureBackupRestoreRequest - err = json.Unmarshal(*v, &objectType) - if err != nil { - return err - } - abrpbrr.ObjectType = objectType - } - } - } - - return nil -} - -// AzureBackupRecoveryPointResource azure backup recoveryPoint resource -type AzureBackupRecoveryPointResource struct { - autorest.Response `json:"-"` - // Properties - AzureBackupRecoveryPointResource properties - Properties BasicAzureBackupRecoveryPoint `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureBackupRecoveryPointResource. -func (abrpr AzureBackupRecoveryPointResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = abrpr.Properties - if abrpr.SystemData != nil { - objectMap["systemData"] = abrpr.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AzureBackupRecoveryPointResource struct. -func (abrpr *AzureBackupRecoveryPointResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - properties, err := unmarshalBasicAzureBackupRecoveryPoint(*v) - if err != nil { - return err - } - abrpr.Properties = properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - abrpr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - abrpr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - abrpr.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - abrpr.SystemData = &systemData - } - } - } - - return nil -} - -// AzureBackupRecoveryPointResourceList azure backup recoveryPoint resource list -type AzureBackupRecoveryPointResourceList struct { - autorest.Response `json:"-"` - // Value - List of resources. - Value *[]AzureBackupRecoveryPointResource `json:"value,omitempty"` - // NextLink - The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// AzureBackupRecoveryPointResourceListIterator provides access to a complete listing of -// AzureBackupRecoveryPointResource values. -type AzureBackupRecoveryPointResourceListIterator struct { - i int - page AzureBackupRecoveryPointResourceListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AzureBackupRecoveryPointResourceListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureBackupRecoveryPointResourceListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AzureBackupRecoveryPointResourceListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AzureBackupRecoveryPointResourceListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AzureBackupRecoveryPointResourceListIterator) Response() AzureBackupRecoveryPointResourceList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AzureBackupRecoveryPointResourceListIterator) Value() AzureBackupRecoveryPointResource { - if !iter.page.NotDone() { - return AzureBackupRecoveryPointResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AzureBackupRecoveryPointResourceListIterator type. -func NewAzureBackupRecoveryPointResourceListIterator(page AzureBackupRecoveryPointResourceListPage) AzureBackupRecoveryPointResourceListIterator { - return AzureBackupRecoveryPointResourceListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (abrprl AzureBackupRecoveryPointResourceList) IsEmpty() bool { - return abrprl.Value == nil || len(*abrprl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (abrprl AzureBackupRecoveryPointResourceList) hasNextLink() bool { - return abrprl.NextLink != nil && len(*abrprl.NextLink) != 0 -} - -// azureBackupRecoveryPointResourceListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (abrprl AzureBackupRecoveryPointResourceList) azureBackupRecoveryPointResourceListPreparer(ctx context.Context) (*http.Request, error) { - if !abrprl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(abrprl.NextLink))) -} - -// AzureBackupRecoveryPointResourceListPage contains a page of AzureBackupRecoveryPointResource values. -type AzureBackupRecoveryPointResourceListPage struct { - fn func(context.Context, AzureBackupRecoveryPointResourceList) (AzureBackupRecoveryPointResourceList, error) - abrprl AzureBackupRecoveryPointResourceList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AzureBackupRecoveryPointResourceListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AzureBackupRecoveryPointResourceListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.abrprl) - if err != nil { - return err - } - page.abrprl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AzureBackupRecoveryPointResourceListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AzureBackupRecoveryPointResourceListPage) NotDone() bool { - return !page.abrprl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AzureBackupRecoveryPointResourceListPage) Response() AzureBackupRecoveryPointResourceList { - return page.abrprl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AzureBackupRecoveryPointResourceListPage) Values() []AzureBackupRecoveryPointResource { - if page.abrprl.IsEmpty() { - return nil - } - return *page.abrprl.Value -} - -// Creates a new instance of the AzureBackupRecoveryPointResourceListPage type. -func NewAzureBackupRecoveryPointResourceListPage(cur AzureBackupRecoveryPointResourceList, getNextPage func(context.Context, AzureBackupRecoveryPointResourceList) (AzureBackupRecoveryPointResourceList, error)) AzureBackupRecoveryPointResourceListPage { - return AzureBackupRecoveryPointResourceListPage{ - fn: getNextPage, - abrprl: cur, - } -} - -// AzureBackupRecoveryTimeBasedRestoreRequest azureBackup RecoveryPointTime Based Restore Request -type AzureBackupRecoveryTimeBasedRestoreRequest struct { - // RecoveryPointTime - The recovery time in ISO 8601 format example - 2020-08-14T17:30:00.0000000Z. - RecoveryPointTime *string `json:"recoveryPointTime,omitempty"` - // RestoreTargetInfo - Gets or sets the restore target information. - RestoreTargetInfo BasicRestoreTargetInfoBase `json:"restoreTargetInfo,omitempty"` - // SourceDataStoreType - Gets or sets the type of the source data store. Possible values include: 'SourceDataStoreTypeArchiveStore', 'SourceDataStoreTypeSnapshotStore', 'SourceDataStoreTypeVaultStore' - SourceDataStoreType SourceDataStoreType `json:"sourceDataStoreType,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreRequest', 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryPointBasedRestoreRequest', 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreWithRehydrationRequest', 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryTimeBasedRestoreRequest' - ObjectType ObjectTypeBasicAzureBackupRestoreRequest `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureBackupRecoveryTimeBasedRestoreRequest. -func (abrtbrr AzureBackupRecoveryTimeBasedRestoreRequest) MarshalJSON() ([]byte, error) { - abrtbrr.ObjectType = ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryTimeBasedRestoreRequest - objectMap := make(map[string]interface{}) - if abrtbrr.RecoveryPointTime != nil { - objectMap["recoveryPointTime"] = abrtbrr.RecoveryPointTime - } - objectMap["restoreTargetInfo"] = abrtbrr.RestoreTargetInfo - if abrtbrr.SourceDataStoreType != "" { - objectMap["sourceDataStoreType"] = abrtbrr.SourceDataStoreType - } - if abrtbrr.ObjectType != "" { - objectMap["objectType"] = abrtbrr.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAzureBackupRecoveryPointBasedRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRecoveryTimeBasedRestoreRequest. -func (abrtbrr AzureBackupRecoveryTimeBasedRestoreRequest) AsAzureBackupRecoveryPointBasedRestoreRequest() (*AzureBackupRecoveryPointBasedRestoreRequest, bool) { - return nil, false -} - -// AsBasicAzureBackupRecoveryPointBasedRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRecoveryTimeBasedRestoreRequest. -func (abrtbrr AzureBackupRecoveryTimeBasedRestoreRequest) AsBasicAzureBackupRecoveryPointBasedRestoreRequest() (BasicAzureBackupRecoveryPointBasedRestoreRequest, bool) { - return nil, false -} - -// AsAzureBackupRestoreWithRehydrationRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRecoveryTimeBasedRestoreRequest. -func (abrtbrr AzureBackupRecoveryTimeBasedRestoreRequest) AsAzureBackupRestoreWithRehydrationRequest() (*AzureBackupRestoreWithRehydrationRequest, bool) { - return nil, false -} - -// AsAzureBackupRecoveryTimeBasedRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRecoveryTimeBasedRestoreRequest. -func (abrtbrr AzureBackupRecoveryTimeBasedRestoreRequest) AsAzureBackupRecoveryTimeBasedRestoreRequest() (*AzureBackupRecoveryTimeBasedRestoreRequest, bool) { - return &abrtbrr, true -} - -// AsAzureBackupRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRecoveryTimeBasedRestoreRequest. -func (abrtbrr AzureBackupRecoveryTimeBasedRestoreRequest) AsAzureBackupRestoreRequest() (*AzureBackupRestoreRequest, bool) { - return nil, false -} - -// AsBasicAzureBackupRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRecoveryTimeBasedRestoreRequest. -func (abrtbrr AzureBackupRecoveryTimeBasedRestoreRequest) AsBasicAzureBackupRestoreRequest() (BasicAzureBackupRestoreRequest, bool) { - return &abrtbrr, true -} - -// UnmarshalJSON is the custom unmarshaler for AzureBackupRecoveryTimeBasedRestoreRequest struct. -func (abrtbrr *AzureBackupRecoveryTimeBasedRestoreRequest) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "recoveryPointTime": - if v != nil { - var recoveryPointTime string - err = json.Unmarshal(*v, &recoveryPointTime) - if err != nil { - return err - } - abrtbrr.RecoveryPointTime = &recoveryPointTime - } - case "restoreTargetInfo": - if v != nil { - restoreTargetInfo, err := unmarshalBasicRestoreTargetInfoBase(*v) - if err != nil { - return err - } - abrtbrr.RestoreTargetInfo = restoreTargetInfo - } - case "sourceDataStoreType": - if v != nil { - var sourceDataStoreType SourceDataStoreType - err = json.Unmarshal(*v, &sourceDataStoreType) - if err != nil { - return err - } - abrtbrr.SourceDataStoreType = sourceDataStoreType - } - case "objectType": - if v != nil { - var objectType ObjectTypeBasicAzureBackupRestoreRequest - err = json.Unmarshal(*v, &objectType) - if err != nil { - return err - } - abrtbrr.ObjectType = objectType - } - } - } - - return nil -} - -// AzureBackupRehydrationRequest azure Backup Rehydrate Request -type AzureBackupRehydrationRequest struct { - // RecoveryPointID - Id of the recovery point to be recovered - RecoveryPointID *string `json:"recoveryPointId,omitempty"` - // RehydrationPriority - Priority to be used for rehydration. Values High or Standard. Possible values include: 'RehydrationPriorityInvalid', 'RehydrationPriorityHigh', 'RehydrationPriorityStandard' - RehydrationPriority RehydrationPriority `json:"rehydrationPriority,omitempty"` - // RehydrationRetentionDuration - Retention duration in ISO 8601 format i.e P10D . - RehydrationRetentionDuration *string `json:"rehydrationRetentionDuration,omitempty"` -} - -// BasicAzureBackupRestoreRequest azure backup restore request -type BasicAzureBackupRestoreRequest interface { - AsAzureBackupRecoveryPointBasedRestoreRequest() (*AzureBackupRecoveryPointBasedRestoreRequest, bool) - AsBasicAzureBackupRecoveryPointBasedRestoreRequest() (BasicAzureBackupRecoveryPointBasedRestoreRequest, bool) - AsAzureBackupRestoreWithRehydrationRequest() (*AzureBackupRestoreWithRehydrationRequest, bool) - AsAzureBackupRecoveryTimeBasedRestoreRequest() (*AzureBackupRecoveryTimeBasedRestoreRequest, bool) - AsAzureBackupRestoreRequest() (*AzureBackupRestoreRequest, bool) -} - -// AzureBackupRestoreRequest azure backup restore request -type AzureBackupRestoreRequest struct { - // RestoreTargetInfo - Gets or sets the restore target information. - RestoreTargetInfo BasicRestoreTargetInfoBase `json:"restoreTargetInfo,omitempty"` - // SourceDataStoreType - Gets or sets the type of the source data store. Possible values include: 'SourceDataStoreTypeArchiveStore', 'SourceDataStoreTypeSnapshotStore', 'SourceDataStoreTypeVaultStore' - SourceDataStoreType SourceDataStoreType `json:"sourceDataStoreType,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreRequest', 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryPointBasedRestoreRequest', 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreWithRehydrationRequest', 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryTimeBasedRestoreRequest' - ObjectType ObjectTypeBasicAzureBackupRestoreRequest `json:"objectType,omitempty"` -} - -func unmarshalBasicAzureBackupRestoreRequest(body []byte) (BasicAzureBackupRestoreRequest, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryPointBasedRestoreRequest): - var abrpbrr AzureBackupRecoveryPointBasedRestoreRequest - err := json.Unmarshal(body, &abrpbrr) - return abrpbrr, err - case string(ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreWithRehydrationRequest): - var abrwrr AzureBackupRestoreWithRehydrationRequest - err := json.Unmarshal(body, &abrwrr) - return abrwrr, err - case string(ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryTimeBasedRestoreRequest): - var abrtbrr AzureBackupRecoveryTimeBasedRestoreRequest - err := json.Unmarshal(body, &abrtbrr) - return abrtbrr, err - default: - var abrr AzureBackupRestoreRequest - err := json.Unmarshal(body, &abrr) - return abrr, err - } -} - -func unmarshalBasicAzureBackupRestoreRequestArray(body []byte) ([]BasicAzureBackupRestoreRequest, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - abrrArray := make([]BasicAzureBackupRestoreRequest, len(rawMessages)) - - for index, rawMessage := range rawMessages { - abrr, err := unmarshalBasicAzureBackupRestoreRequest(*rawMessage) - if err != nil { - return nil, err - } - abrrArray[index] = abrr - } - return abrrArray, nil -} - -// MarshalJSON is the custom marshaler for AzureBackupRestoreRequest. -func (abrr AzureBackupRestoreRequest) MarshalJSON() ([]byte, error) { - abrr.ObjectType = ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreRequest - objectMap := make(map[string]interface{}) - objectMap["restoreTargetInfo"] = abrr.RestoreTargetInfo - if abrr.SourceDataStoreType != "" { - objectMap["sourceDataStoreType"] = abrr.SourceDataStoreType - } - if abrr.ObjectType != "" { - objectMap["objectType"] = abrr.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAzureBackupRecoveryPointBasedRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRestoreRequest. -func (abrr AzureBackupRestoreRequest) AsAzureBackupRecoveryPointBasedRestoreRequest() (*AzureBackupRecoveryPointBasedRestoreRequest, bool) { - return nil, false -} - -// AsBasicAzureBackupRecoveryPointBasedRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRestoreRequest. -func (abrr AzureBackupRestoreRequest) AsBasicAzureBackupRecoveryPointBasedRestoreRequest() (BasicAzureBackupRecoveryPointBasedRestoreRequest, bool) { - return nil, false -} - -// AsAzureBackupRestoreWithRehydrationRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRestoreRequest. -func (abrr AzureBackupRestoreRequest) AsAzureBackupRestoreWithRehydrationRequest() (*AzureBackupRestoreWithRehydrationRequest, bool) { - return nil, false -} - -// AsAzureBackupRecoveryTimeBasedRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRestoreRequest. -func (abrr AzureBackupRestoreRequest) AsAzureBackupRecoveryTimeBasedRestoreRequest() (*AzureBackupRecoveryTimeBasedRestoreRequest, bool) { - return nil, false -} - -// AsAzureBackupRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRestoreRequest. -func (abrr AzureBackupRestoreRequest) AsAzureBackupRestoreRequest() (*AzureBackupRestoreRequest, bool) { - return &abrr, true -} - -// AsBasicAzureBackupRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRestoreRequest. -func (abrr AzureBackupRestoreRequest) AsBasicAzureBackupRestoreRequest() (BasicAzureBackupRestoreRequest, bool) { - return &abrr, true -} - -// UnmarshalJSON is the custom unmarshaler for AzureBackupRestoreRequest struct. -func (abrr *AzureBackupRestoreRequest) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "restoreTargetInfo": - if v != nil { - restoreTargetInfo, err := unmarshalBasicRestoreTargetInfoBase(*v) - if err != nil { - return err - } - abrr.RestoreTargetInfo = restoreTargetInfo - } - case "sourceDataStoreType": - if v != nil { - var sourceDataStoreType SourceDataStoreType - err = json.Unmarshal(*v, &sourceDataStoreType) - if err != nil { - return err - } - abrr.SourceDataStoreType = sourceDataStoreType - } - case "objectType": - if v != nil { - var objectType ObjectTypeBasicAzureBackupRestoreRequest - err = json.Unmarshal(*v, &objectType) - if err != nil { - return err - } - abrr.ObjectType = objectType - } - } - } - - return nil -} - -// AzureBackupRestoreWithRehydrationRequest azureBackup Restore with Rehydration Request -type AzureBackupRestoreWithRehydrationRequest struct { - // RehydrationPriority - Priority to be used for rehydration. Values High or Standard. Possible values include: 'RehydrationPriorityInvalid', 'RehydrationPriorityHigh', 'RehydrationPriorityStandard' - RehydrationPriority RehydrationPriority `json:"rehydrationPriority,omitempty"` - // RehydrationRetentionDuration - Retention duration in ISO 8601 format i.e P10D . - RehydrationRetentionDuration *string `json:"rehydrationRetentionDuration,omitempty"` - RecoveryPointID *string `json:"recoveryPointId,omitempty"` - // RestoreTargetInfo - Gets or sets the restore target information. - RestoreTargetInfo BasicRestoreTargetInfoBase `json:"restoreTargetInfo,omitempty"` - // SourceDataStoreType - Gets or sets the type of the source data store. Possible values include: 'SourceDataStoreTypeArchiveStore', 'SourceDataStoreTypeSnapshotStore', 'SourceDataStoreTypeVaultStore' - SourceDataStoreType SourceDataStoreType `json:"sourceDataStoreType,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreRequest', 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryPointBasedRestoreRequest', 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreWithRehydrationRequest', 'ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRecoveryTimeBasedRestoreRequest' - ObjectType ObjectTypeBasicAzureBackupRestoreRequest `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureBackupRestoreWithRehydrationRequest. -func (abrwrr AzureBackupRestoreWithRehydrationRequest) MarshalJSON() ([]byte, error) { - abrwrr.ObjectType = ObjectTypeBasicAzureBackupRestoreRequestObjectTypeAzureBackupRestoreWithRehydrationRequest - objectMap := make(map[string]interface{}) - if abrwrr.RehydrationPriority != "" { - objectMap["rehydrationPriority"] = abrwrr.RehydrationPriority - } - if abrwrr.RehydrationRetentionDuration != nil { - objectMap["rehydrationRetentionDuration"] = abrwrr.RehydrationRetentionDuration - } - if abrwrr.RecoveryPointID != nil { - objectMap["recoveryPointId"] = abrwrr.RecoveryPointID - } - objectMap["restoreTargetInfo"] = abrwrr.RestoreTargetInfo - if abrwrr.SourceDataStoreType != "" { - objectMap["sourceDataStoreType"] = abrwrr.SourceDataStoreType - } - if abrwrr.ObjectType != "" { - objectMap["objectType"] = abrwrr.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAzureBackupRecoveryPointBasedRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRestoreWithRehydrationRequest. -func (abrwrr AzureBackupRestoreWithRehydrationRequest) AsAzureBackupRecoveryPointBasedRestoreRequest() (*AzureBackupRecoveryPointBasedRestoreRequest, bool) { - return nil, false -} - -// AsBasicAzureBackupRecoveryPointBasedRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRestoreWithRehydrationRequest. -func (abrwrr AzureBackupRestoreWithRehydrationRequest) AsBasicAzureBackupRecoveryPointBasedRestoreRequest() (BasicAzureBackupRecoveryPointBasedRestoreRequest, bool) { - return &abrwrr, true -} - -// AsAzureBackupRestoreWithRehydrationRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRestoreWithRehydrationRequest. -func (abrwrr AzureBackupRestoreWithRehydrationRequest) AsAzureBackupRestoreWithRehydrationRequest() (*AzureBackupRestoreWithRehydrationRequest, bool) { - return &abrwrr, true -} - -// AsAzureBackupRecoveryTimeBasedRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRestoreWithRehydrationRequest. -func (abrwrr AzureBackupRestoreWithRehydrationRequest) AsAzureBackupRecoveryTimeBasedRestoreRequest() (*AzureBackupRecoveryTimeBasedRestoreRequest, bool) { - return nil, false -} - -// AsAzureBackupRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRestoreWithRehydrationRequest. -func (abrwrr AzureBackupRestoreWithRehydrationRequest) AsAzureBackupRestoreRequest() (*AzureBackupRestoreRequest, bool) { - return nil, false -} - -// AsBasicAzureBackupRestoreRequest is the BasicAzureBackupRestoreRequest implementation for AzureBackupRestoreWithRehydrationRequest. -func (abrwrr AzureBackupRestoreWithRehydrationRequest) AsBasicAzureBackupRestoreRequest() (BasicAzureBackupRestoreRequest, bool) { - return &abrwrr, true -} - -// UnmarshalJSON is the custom unmarshaler for AzureBackupRestoreWithRehydrationRequest struct. -func (abrwrr *AzureBackupRestoreWithRehydrationRequest) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "rehydrationPriority": - if v != nil { - var rehydrationPriority RehydrationPriority - err = json.Unmarshal(*v, &rehydrationPriority) - if err != nil { - return err - } - abrwrr.RehydrationPriority = rehydrationPriority - } - case "rehydrationRetentionDuration": - if v != nil { - var rehydrationRetentionDuration string - err = json.Unmarshal(*v, &rehydrationRetentionDuration) - if err != nil { - return err - } - abrwrr.RehydrationRetentionDuration = &rehydrationRetentionDuration - } - case "recoveryPointId": - if v != nil { - var recoveryPointID string - err = json.Unmarshal(*v, &recoveryPointID) - if err != nil { - return err - } - abrwrr.RecoveryPointID = &recoveryPointID - } - case "restoreTargetInfo": - if v != nil { - restoreTargetInfo, err := unmarshalBasicRestoreTargetInfoBase(*v) - if err != nil { - return err - } - abrwrr.RestoreTargetInfo = restoreTargetInfo - } - case "sourceDataStoreType": - if v != nil { - var sourceDataStoreType SourceDataStoreType - err = json.Unmarshal(*v, &sourceDataStoreType) - if err != nil { - return err - } - abrwrr.SourceDataStoreType = sourceDataStoreType - } - case "objectType": - if v != nil { - var objectType ObjectTypeBasicAzureBackupRestoreRequest - err = json.Unmarshal(*v, &objectType) - if err != nil { - return err - } - abrwrr.ObjectType = objectType - } - } - } - - return nil -} - -// AzureBackupRule azure backup rule -type AzureBackupRule struct { - BackupParameters BasicBackupParameters `json:"backupParameters,omitempty"` - DataStore *DataStoreInfoBase `json:"dataStore,omitempty"` - Trigger BasicTriggerContext `json:"trigger,omitempty"` - Name *string `json:"name,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicBasePolicyRuleObjectTypeBasePolicyRule', 'ObjectTypeBasicBasePolicyRuleObjectTypeAzureBackupRule', 'ObjectTypeBasicBasePolicyRuleObjectTypeAzureRetentionRule' - ObjectType ObjectTypeBasicBasePolicyRule `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureBackupRule. -func (abr AzureBackupRule) MarshalJSON() ([]byte, error) { - abr.ObjectType = ObjectTypeBasicBasePolicyRuleObjectTypeAzureBackupRule - objectMap := make(map[string]interface{}) - objectMap["backupParameters"] = abr.BackupParameters - if abr.DataStore != nil { - objectMap["dataStore"] = abr.DataStore - } - objectMap["trigger"] = abr.Trigger - if abr.Name != nil { - objectMap["name"] = abr.Name - } - if abr.ObjectType != "" { - objectMap["objectType"] = abr.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAzureBackupRule is the BasicBasePolicyRule implementation for AzureBackupRule. -func (abr AzureBackupRule) AsAzureBackupRule() (*AzureBackupRule, bool) { - return &abr, true -} - -// AsAzureRetentionRule is the BasicBasePolicyRule implementation for AzureBackupRule. -func (abr AzureBackupRule) AsAzureRetentionRule() (*AzureRetentionRule, bool) { - return nil, false -} - -// AsBasePolicyRule is the BasicBasePolicyRule implementation for AzureBackupRule. -func (abr AzureBackupRule) AsBasePolicyRule() (*BasePolicyRule, bool) { - return nil, false -} - -// AsBasicBasePolicyRule is the BasicBasePolicyRule implementation for AzureBackupRule. -func (abr AzureBackupRule) AsBasicBasePolicyRule() (BasicBasePolicyRule, bool) { - return &abr, true -} - -// UnmarshalJSON is the custom unmarshaler for AzureBackupRule struct. -func (abr *AzureBackupRule) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "backupParameters": - if v != nil { - backupParameters, err := unmarshalBasicBackupParameters(*v) - if err != nil { - return err - } - abr.BackupParameters = backupParameters - } - case "dataStore": - if v != nil { - var dataStore DataStoreInfoBase - err = json.Unmarshal(*v, &dataStore) - if err != nil { - return err - } - abr.DataStore = &dataStore - } - case "trigger": - if v != nil { - trigger, err := unmarshalBasicTriggerContext(*v) - if err != nil { - return err - } - abr.Trigger = trigger - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - abr.Name = &name - } - case "objectType": - if v != nil { - var objectType ObjectTypeBasicBasePolicyRule - err = json.Unmarshal(*v, &objectType) - if err != nil { - return err - } - abr.ObjectType = objectType - } - } - } - - return nil -} - -// AzureOperationalStoreParameters parameters for Operational-Tier DataStore -type AzureOperationalStoreParameters struct { - // ResourceGroupID - Gets or sets the Snapshot Resource Group Uri. - ResourceGroupID *string `json:"resourceGroupId,omitempty"` - // DataStoreType - type of datastore; Operational/Vault/Archive. Possible values include: 'DataStoreTypesOperationalStore', 'DataStoreTypesVaultStore', 'DataStoreTypesArchiveStore' - DataStoreType DataStoreTypes `json:"dataStoreType,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicDataStoreParametersObjectTypeDataStoreParameters', 'ObjectTypeBasicDataStoreParametersObjectTypeAzureOperationalStoreParameters' - ObjectType ObjectTypeBasicDataStoreParameters `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureOperationalStoreParameters. -func (aosp AzureOperationalStoreParameters) MarshalJSON() ([]byte, error) { - aosp.ObjectType = ObjectTypeBasicDataStoreParametersObjectTypeAzureOperationalStoreParameters - objectMap := make(map[string]interface{}) - if aosp.ResourceGroupID != nil { - objectMap["resourceGroupId"] = aosp.ResourceGroupID - } - if aosp.DataStoreType != "" { - objectMap["dataStoreType"] = aosp.DataStoreType - } - if aosp.ObjectType != "" { - objectMap["objectType"] = aosp.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAzureOperationalStoreParameters is the BasicDataStoreParameters implementation for AzureOperationalStoreParameters. -func (aosp AzureOperationalStoreParameters) AsAzureOperationalStoreParameters() (*AzureOperationalStoreParameters, bool) { - return &aosp, true -} - -// AsDataStoreParameters is the BasicDataStoreParameters implementation for AzureOperationalStoreParameters. -func (aosp AzureOperationalStoreParameters) AsDataStoreParameters() (*DataStoreParameters, bool) { - return nil, false -} - -// AsBasicDataStoreParameters is the BasicDataStoreParameters implementation for AzureOperationalStoreParameters. -func (aosp AzureOperationalStoreParameters) AsBasicDataStoreParameters() (BasicDataStoreParameters, bool) { - return &aosp, true -} - -// AzureRetentionRule azure retention rule -type AzureRetentionRule struct { - IsDefault *bool `json:"isDefault,omitempty"` - Lifecycles *[]SourceLifeCycle `json:"lifecycles,omitempty"` - Name *string `json:"name,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicBasePolicyRuleObjectTypeBasePolicyRule', 'ObjectTypeBasicBasePolicyRuleObjectTypeAzureBackupRule', 'ObjectTypeBasicBasePolicyRuleObjectTypeAzureRetentionRule' - ObjectType ObjectTypeBasicBasePolicyRule `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureRetentionRule. -func (arr AzureRetentionRule) MarshalJSON() ([]byte, error) { - arr.ObjectType = ObjectTypeBasicBasePolicyRuleObjectTypeAzureRetentionRule - objectMap := make(map[string]interface{}) - if arr.IsDefault != nil { - objectMap["isDefault"] = arr.IsDefault - } - if arr.Lifecycles != nil { - objectMap["lifecycles"] = arr.Lifecycles - } - if arr.Name != nil { - objectMap["name"] = arr.Name - } - if arr.ObjectType != "" { - objectMap["objectType"] = arr.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAzureBackupRule is the BasicBasePolicyRule implementation for AzureRetentionRule. -func (arr AzureRetentionRule) AsAzureBackupRule() (*AzureBackupRule, bool) { - return nil, false -} - -// AsAzureRetentionRule is the BasicBasePolicyRule implementation for AzureRetentionRule. -func (arr AzureRetentionRule) AsAzureRetentionRule() (*AzureRetentionRule, bool) { - return &arr, true -} - -// AsBasePolicyRule is the BasicBasePolicyRule implementation for AzureRetentionRule. -func (arr AzureRetentionRule) AsBasePolicyRule() (*BasePolicyRule, bool) { - return nil, false -} - -// AsBasicBasePolicyRule is the BasicBasePolicyRule implementation for AzureRetentionRule. -func (arr AzureRetentionRule) AsBasicBasePolicyRule() (BasicBasePolicyRule, bool) { - return &arr, true -} - -// BasicBackupCriteria backupCriteria base class -type BasicBackupCriteria interface { - AsScheduleBasedBackupCriteria() (*ScheduleBasedBackupCriteria, bool) - AsBackupCriteria() (*BackupCriteria, bool) -} - -// BackupCriteria backupCriteria base class -type BackupCriteria struct { - // ObjectType - Possible values include: 'ObjectTypeBasicBackupCriteriaObjectTypeBackupCriteria', 'ObjectTypeBasicBackupCriteriaObjectTypeScheduleBasedBackupCriteria' - ObjectType ObjectTypeBasicBackupCriteria `json:"objectType,omitempty"` -} - -func unmarshalBasicBackupCriteria(body []byte) (BasicBackupCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicBackupCriteriaObjectTypeScheduleBasedBackupCriteria): - var sbbc ScheduleBasedBackupCriteria - err := json.Unmarshal(body, &sbbc) - return sbbc, err - default: - var bc BackupCriteria - err := json.Unmarshal(body, &bc) - return bc, err - } -} - -func unmarshalBasicBackupCriteriaArray(body []byte) ([]BasicBackupCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - bcArray := make([]BasicBackupCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - bc, err := unmarshalBasicBackupCriteria(*rawMessage) - if err != nil { - return nil, err - } - bcArray[index] = bc - } - return bcArray, nil -} - -// MarshalJSON is the custom marshaler for BackupCriteria. -func (bc BackupCriteria) MarshalJSON() ([]byte, error) { - bc.ObjectType = ObjectTypeBasicBackupCriteriaObjectTypeBackupCriteria - objectMap := make(map[string]interface{}) - if bc.ObjectType != "" { - objectMap["objectType"] = bc.ObjectType - } - return json.Marshal(objectMap) -} - -// AsScheduleBasedBackupCriteria is the BasicBackupCriteria implementation for BackupCriteria. -func (bc BackupCriteria) AsScheduleBasedBackupCriteria() (*ScheduleBasedBackupCriteria, bool) { - return nil, false -} - -// AsBackupCriteria is the BasicBackupCriteria implementation for BackupCriteria. -func (bc BackupCriteria) AsBackupCriteria() (*BackupCriteria, bool) { - return &bc, true -} - -// AsBasicBackupCriteria is the BasicBackupCriteria implementation for BackupCriteria. -func (bc BackupCriteria) AsBasicBackupCriteria() (BasicBackupCriteria, bool) { - return &bc, true -} - -// BackupInstance backup Instance -type BackupInstance struct { - // FriendlyName - Gets or sets the Backup Instance friendly name. - FriendlyName *string `json:"friendlyName,omitempty"` - // DataSourceInfo - Gets or sets the data source information. - DataSourceInfo *Datasource `json:"dataSourceInfo,omitempty"` - // DataSourceSetInfo - Gets or sets the data source set information. - DataSourceSetInfo *DatasourceSet `json:"dataSourceSetInfo,omitempty"` - // PolicyInfo - Gets or sets the policy information. - PolicyInfo *PolicyInfo `json:"policyInfo,omitempty"` - // ProtectionStatus - READ-ONLY; Specifies the protection status of the resource - ProtectionStatus *ProtectionStatusDetails `json:"protectionStatus,omitempty"` - // CurrentProtectionState - READ-ONLY; Specifies the current protection state of the resource. Possible values include: 'CurrentProtectionStateInvalid', 'CurrentProtectionStateNotProtected', 'CurrentProtectionStateConfiguringProtection', 'CurrentProtectionStateProtectionConfigured', 'CurrentProtectionStateBackupSchedulesSuspended', 'CurrentProtectionStateRetentionSchedulesSuspended', 'CurrentProtectionStateProtectionStopped', 'CurrentProtectionStateProtectionError', 'CurrentProtectionStateConfiguringProtectionFailed', 'CurrentProtectionStateSoftDeleting', 'CurrentProtectionStateSoftDeleted', 'CurrentProtectionStateUpdatingProtection' - CurrentProtectionState CurrentProtectionState `json:"currentProtectionState,omitempty"` - // ProtectionErrorDetails - READ-ONLY; Specifies the protection error of the resource - ProtectionErrorDetails *UserFacingError `json:"protectionErrorDetails,omitempty"` - // ProvisioningState - READ-ONLY; Specifies the provisioning state of the resource i.e. provisioning/updating/Succeeded/Failed - ProvisioningState *string `json:"provisioningState,omitempty"` - // DatasourceAuthCredentials - Credentials to use to authenticate with data source provider. - DatasourceAuthCredentials BasicAuthCredentials `json:"datasourceAuthCredentials,omitempty"` - ObjectType *string `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupInstance. -func (bi BackupInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bi.FriendlyName != nil { - objectMap["friendlyName"] = bi.FriendlyName - } - if bi.DataSourceInfo != nil { - objectMap["dataSourceInfo"] = bi.DataSourceInfo - } - if bi.DataSourceSetInfo != nil { - objectMap["dataSourceSetInfo"] = bi.DataSourceSetInfo - } - if bi.PolicyInfo != nil { - objectMap["policyInfo"] = bi.PolicyInfo - } - objectMap["datasourceAuthCredentials"] = bi.DatasourceAuthCredentials - if bi.ObjectType != nil { - objectMap["objectType"] = bi.ObjectType - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackupInstance struct. -func (bi *BackupInstance) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "friendlyName": - if v != nil { - var friendlyName string - err = json.Unmarshal(*v, &friendlyName) - if err != nil { - return err - } - bi.FriendlyName = &friendlyName - } - case "dataSourceInfo": - if v != nil { - var dataSourceInfo Datasource - err = json.Unmarshal(*v, &dataSourceInfo) - if err != nil { - return err - } - bi.DataSourceInfo = &dataSourceInfo - } - case "dataSourceSetInfo": - if v != nil { - var dataSourceSetInfo DatasourceSet - err = json.Unmarshal(*v, &dataSourceSetInfo) - if err != nil { - return err - } - bi.DataSourceSetInfo = &dataSourceSetInfo - } - case "policyInfo": - if v != nil { - var policyInfo PolicyInfo - err = json.Unmarshal(*v, &policyInfo) - if err != nil { - return err - } - bi.PolicyInfo = &policyInfo - } - case "protectionStatus": - if v != nil { - var protectionStatus ProtectionStatusDetails - err = json.Unmarshal(*v, &protectionStatus) - if err != nil { - return err - } - bi.ProtectionStatus = &protectionStatus - } - case "currentProtectionState": - if v != nil { - var currentProtectionState CurrentProtectionState - err = json.Unmarshal(*v, ¤tProtectionState) - if err != nil { - return err - } - bi.CurrentProtectionState = currentProtectionState - } - case "protectionErrorDetails": - if v != nil { - var protectionErrorDetails UserFacingError - err = json.Unmarshal(*v, &protectionErrorDetails) - if err != nil { - return err - } - bi.ProtectionErrorDetails = &protectionErrorDetails - } - case "provisioningState": - if v != nil { - var provisioningState string - err = json.Unmarshal(*v, &provisioningState) - if err != nil { - return err - } - bi.ProvisioningState = &provisioningState - } - case "datasourceAuthCredentials": - if v != nil { - datasourceAuthCredentials, err := unmarshalBasicAuthCredentials(*v) - if err != nil { - return err - } - bi.DatasourceAuthCredentials = datasourceAuthCredentials - } - case "objectType": - if v != nil { - var objectType string - err = json.Unmarshal(*v, &objectType) - if err != nil { - return err - } - bi.ObjectType = &objectType - } - } - } - - return nil -} - -// BackupInstanceResource backupInstance Resource -type BackupInstanceResource struct { - autorest.Response `json:"-"` - // Properties - BackupInstanceResource properties - Properties *BackupInstance `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupInstanceResource. -func (bir BackupInstanceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bir.Properties != nil { - objectMap["properties"] = bir.Properties - } - if bir.SystemData != nil { - objectMap["systemData"] = bir.SystemData - } - return json.Marshal(objectMap) -} - -// BackupInstanceResourceList backupInstance Resource list response -type BackupInstanceResourceList struct { - autorest.Response `json:"-"` - // Value - List of resources. - Value *[]BackupInstanceResource `json:"value,omitempty"` - // NextLink - The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// BackupInstanceResourceListIterator provides access to a complete listing of BackupInstanceResource -// values. -type BackupInstanceResourceListIterator struct { - i int - page BackupInstanceResourceListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BackupInstanceResourceListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupInstanceResourceListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BackupInstanceResourceListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BackupInstanceResourceListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BackupInstanceResourceListIterator) Response() BackupInstanceResourceList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BackupInstanceResourceListIterator) Value() BackupInstanceResource { - if !iter.page.NotDone() { - return BackupInstanceResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BackupInstanceResourceListIterator type. -func NewBackupInstanceResourceListIterator(page BackupInstanceResourceListPage) BackupInstanceResourceListIterator { - return BackupInstanceResourceListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (birl BackupInstanceResourceList) IsEmpty() bool { - return birl.Value == nil || len(*birl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (birl BackupInstanceResourceList) hasNextLink() bool { - return birl.NextLink != nil && len(*birl.NextLink) != 0 -} - -// backupInstanceResourceListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (birl BackupInstanceResourceList) backupInstanceResourceListPreparer(ctx context.Context) (*http.Request, error) { - if !birl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(birl.NextLink))) -} - -// BackupInstanceResourceListPage contains a page of BackupInstanceResource values. -type BackupInstanceResourceListPage struct { - fn func(context.Context, BackupInstanceResourceList) (BackupInstanceResourceList, error) - birl BackupInstanceResourceList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BackupInstanceResourceListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupInstanceResourceListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.birl) - if err != nil { - return err - } - page.birl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BackupInstanceResourceListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BackupInstanceResourceListPage) NotDone() bool { - return !page.birl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BackupInstanceResourceListPage) Response() BackupInstanceResourceList { - return page.birl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BackupInstanceResourceListPage) Values() []BackupInstanceResource { - if page.birl.IsEmpty() { - return nil - } - return *page.birl.Value -} - -// Creates a new instance of the BackupInstanceResourceListPage type. -func NewBackupInstanceResourceListPage(cur BackupInstanceResourceList, getNextPage func(context.Context, BackupInstanceResourceList) (BackupInstanceResourceList, error)) BackupInstanceResourceListPage { - return BackupInstanceResourceListPage{ - fn: getNextPage, - birl: cur, - } -} - -// BackupInstancesAdhocBackupFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type BackupInstancesAdhocBackupFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupInstancesClient) (OperationJobExtendedInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupInstancesAdhocBackupFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupInstancesAdhocBackupFuture.Result. -func (future *BackupInstancesAdhocBackupFuture) result(client BackupInstancesClient) (ojei OperationJobExtendedInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesAdhocBackupFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ojei.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dataprotection.BackupInstancesAdhocBackupFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ojei.Response.Response, err = future.GetResult(sender); err == nil && ojei.Response.Response.StatusCode != http.StatusNoContent { - ojei, err = client.AdhocBackupResponder(ojei.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesAdhocBackupFuture", "Result", ojei.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupInstancesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type BackupInstancesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupInstancesClient) (BackupInstanceResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupInstancesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupInstancesCreateOrUpdateFuture.Result. -func (future *BackupInstancesCreateOrUpdateFuture) result(client BackupInstancesClient) (bir BackupInstanceResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bir.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dataprotection.BackupInstancesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bir.Response.Response, err = future.GetResult(sender); err == nil && bir.Response.Response.StatusCode != http.StatusNoContent { - bir, err = client.CreateOrUpdateResponder(bir.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesCreateOrUpdateFuture", "Result", bir.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupInstancesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BackupInstancesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupInstancesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupInstancesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupInstancesDeleteFuture.Result. -func (future *BackupInstancesDeleteFuture) result(client BackupInstancesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dataprotection.BackupInstancesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// BackupInstancesTriggerRehydrateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type BackupInstancesTriggerRehydrateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupInstancesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupInstancesTriggerRehydrateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupInstancesTriggerRehydrateFuture.Result. -func (future *BackupInstancesTriggerRehydrateFuture) result(client BackupInstancesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesTriggerRehydrateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dataprotection.BackupInstancesTriggerRehydrateFuture") - return - } - ar.Response = future.Response() - return -} - -// BackupInstancesTriggerRestoreFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type BackupInstancesTriggerRestoreFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupInstancesClient) (OperationJobExtendedInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupInstancesTriggerRestoreFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupInstancesTriggerRestoreFuture.Result. -func (future *BackupInstancesTriggerRestoreFuture) result(client BackupInstancesClient) (ojei OperationJobExtendedInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesTriggerRestoreFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ojei.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dataprotection.BackupInstancesTriggerRestoreFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ojei.Response.Response, err = future.GetResult(sender); err == nil && ojei.Response.Response.StatusCode != http.StatusNoContent { - ojei, err = client.TriggerRestoreResponder(ojei.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesTriggerRestoreFuture", "Result", ojei.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupInstancesValidateForBackupFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type BackupInstancesValidateForBackupFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupInstancesClient) (OperationJobExtendedInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupInstancesValidateForBackupFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupInstancesValidateForBackupFuture.Result. -func (future *BackupInstancesValidateForBackupFuture) result(client BackupInstancesClient) (ojei OperationJobExtendedInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesValidateForBackupFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ojei.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dataprotection.BackupInstancesValidateForBackupFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ojei.Response.Response, err = future.GetResult(sender); err == nil && ojei.Response.Response.StatusCode != http.StatusNoContent { - ojei, err = client.ValidateForBackupResponder(ojei.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesValidateForBackupFuture", "Result", ojei.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupInstancesValidateForRestoreFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type BackupInstancesValidateForRestoreFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupInstancesClient) (OperationJobExtendedInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupInstancesValidateForRestoreFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupInstancesValidateForRestoreFuture.Result. -func (future *BackupInstancesValidateForRestoreFuture) result(client BackupInstancesClient) (ojei OperationJobExtendedInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesValidateForRestoreFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ojei.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dataprotection.BackupInstancesValidateForRestoreFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if ojei.Response.Response, err = future.GetResult(sender); err == nil && ojei.Response.Response.StatusCode != http.StatusNoContent { - ojei, err = client.ValidateForRestoreResponder(ojei.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupInstancesValidateForRestoreFuture", "Result", ojei.Response.Response, "Failure responding to request") - } - } - return -} - -// BasicBackupParameters backupParameters base -type BasicBackupParameters interface { - AsAzureBackupParams() (*AzureBackupParams, bool) - AsBackupParameters() (*BackupParameters, bool) -} - -// BackupParameters backupParameters base -type BackupParameters struct { - // ObjectType - Possible values include: 'ObjectTypeBasicBackupParametersObjectTypeBackupParameters', 'ObjectTypeBasicBackupParametersObjectTypeAzureBackupParams' - ObjectType ObjectTypeBasicBackupParameters `json:"objectType,omitempty"` -} - -func unmarshalBasicBackupParameters(body []byte) (BasicBackupParameters, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicBackupParametersObjectTypeAzureBackupParams): - var abp AzureBackupParams - err := json.Unmarshal(body, &abp) - return abp, err - default: - var bp BackupParameters - err := json.Unmarshal(body, &bp) - return bp, err - } -} - -func unmarshalBasicBackupParametersArray(body []byte) ([]BasicBackupParameters, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - bpArray := make([]BasicBackupParameters, len(rawMessages)) - - for index, rawMessage := range rawMessages { - bp, err := unmarshalBasicBackupParameters(*rawMessage) - if err != nil { - return nil, err - } - bpArray[index] = bp - } - return bpArray, nil -} - -// MarshalJSON is the custom marshaler for BackupParameters. -func (bp BackupParameters) MarshalJSON() ([]byte, error) { - bp.ObjectType = ObjectTypeBasicBackupParametersObjectTypeBackupParameters - objectMap := make(map[string]interface{}) - if bp.ObjectType != "" { - objectMap["objectType"] = bp.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAzureBackupParams is the BasicBackupParameters implementation for BackupParameters. -func (bp BackupParameters) AsAzureBackupParams() (*AzureBackupParams, bool) { - return nil, false -} - -// AsBackupParameters is the BasicBackupParameters implementation for BackupParameters. -func (bp BackupParameters) AsBackupParameters() (*BackupParameters, bool) { - return &bp, true -} - -// AsBasicBackupParameters is the BasicBackupParameters implementation for BackupParameters. -func (bp BackupParameters) AsBasicBackupParameters() (BasicBackupParameters, bool) { - return &bp, true -} - -// BackupPolicy rule based backup policy -type BackupPolicy struct { - // PolicyRules - Policy rule dictionary that contains rules for each backuptype i.e Full/Incremental/Logs etc - PolicyRules *[]BasicBasePolicyRule `json:"policyRules,omitempty"` - // DatasourceTypes - Type of datasource for the backup management - DatasourceTypes *[]string `json:"datasourceTypes,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicBaseBackupPolicyObjectTypeBaseBackupPolicy', 'ObjectTypeBasicBaseBackupPolicyObjectTypeBackupPolicy' - ObjectType ObjectTypeBasicBaseBackupPolicy `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupPolicy. -func (bp BackupPolicy) MarshalJSON() ([]byte, error) { - bp.ObjectType = ObjectTypeBasicBaseBackupPolicyObjectTypeBackupPolicy - objectMap := make(map[string]interface{}) - if bp.PolicyRules != nil { - objectMap["policyRules"] = bp.PolicyRules - } - if bp.DatasourceTypes != nil { - objectMap["datasourceTypes"] = bp.DatasourceTypes - } - if bp.ObjectType != "" { - objectMap["objectType"] = bp.ObjectType - } - return json.Marshal(objectMap) -} - -// AsBackupPolicy is the BasicBaseBackupPolicy implementation for BackupPolicy. -func (bp BackupPolicy) AsBackupPolicy() (*BackupPolicy, bool) { - return &bp, true -} - -// AsBaseBackupPolicy is the BasicBaseBackupPolicy implementation for BackupPolicy. -func (bp BackupPolicy) AsBaseBackupPolicy() (*BaseBackupPolicy, bool) { - return nil, false -} - -// AsBasicBaseBackupPolicy is the BasicBaseBackupPolicy implementation for BackupPolicy. -func (bp BackupPolicy) AsBasicBaseBackupPolicy() (BasicBaseBackupPolicy, bool) { - return &bp, true -} - -// UnmarshalJSON is the custom unmarshaler for BackupPolicy struct. -func (bp *BackupPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "policyRules": - if v != nil { - policyRules, err := unmarshalBasicBasePolicyRuleArray(*v) - if err != nil { - return err - } - bp.PolicyRules = &policyRules - } - case "datasourceTypes": - if v != nil { - var datasourceTypes []string - err = json.Unmarshal(*v, &datasourceTypes) - if err != nil { - return err - } - bp.DatasourceTypes = &datasourceTypes - } - case "objectType": - if v != nil { - var objectType ObjectTypeBasicBaseBackupPolicy - err = json.Unmarshal(*v, &objectType) - if err != nil { - return err - } - bp.ObjectType = objectType - } - } - } - - return nil -} - -// BackupSchedule schedule for backup -type BackupSchedule struct { - // RepeatingTimeIntervals - ISO 8601 repeating time interval format - RepeatingTimeIntervals *[]string `json:"repeatingTimeIntervals,omitempty"` - // TimeZone - Time zone for a schedule. Example: Pacific Standard Time - TimeZone *string `json:"timeZone,omitempty"` -} - -// BackupVault backup Vault -type BackupVault struct { - // ProvisioningState - READ-ONLY; Provisioning state of the BackupVault resource. Possible values include: 'ProvisioningStateFailed', 'ProvisioningStateProvisioning', 'ProvisioningStateSucceeded', 'ProvisioningStateUnknown', 'ProvisioningStateUpdating' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ResourceMoveState - READ-ONLY; Resource move state for backup vault. Possible values include: 'ResourceMoveStateUnknown', 'ResourceMoveStateInProgress', 'ResourceMoveStatePrepareFailed', 'ResourceMoveStateCommitFailed', 'ResourceMoveStateFailed', 'ResourceMoveStatePrepareTimedout', 'ResourceMoveStateCommitTimedout', 'ResourceMoveStateCriticalFailure', 'ResourceMoveStatePartialSuccess', 'ResourceMoveStateMoveSucceeded' - ResourceMoveState ResourceMoveState `json:"resourceMoveState,omitempty"` - // ResourceMoveDetails - READ-ONLY; Resource move details for backup vault - ResourceMoveDetails *ResourceMoveDetails `json:"resourceMoveDetails,omitempty"` - // StorageSettings - Storage Settings - StorageSettings *[]StorageSetting `json:"storageSettings,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupVault. -func (bv BackupVault) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bv.StorageSettings != nil { - objectMap["storageSettings"] = bv.StorageSettings - } - return json.Marshal(objectMap) -} - -// BackupVaultResource backup Vault Resource -type BackupVaultResource struct { - autorest.Response `json:"-"` - // Properties - BackupVaultResource properties - Properties *BackupVault `json:"properties,omitempty"` - // ETag - Optional ETag. - ETag *string `json:"eTag,omitempty"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Identity - Input Managed Identity Details - Identity *DppIdentityDetails `json:"identity,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupVaultResource. -func (bvr BackupVaultResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bvr.Properties != nil { - objectMap["properties"] = bvr.Properties - } - if bvr.ETag != nil { - objectMap["eTag"] = bvr.ETag - } - if bvr.Identity != nil { - objectMap["identity"] = bvr.Identity - } - if bvr.Location != nil { - objectMap["location"] = bvr.Location - } - if bvr.Tags != nil { - objectMap["tags"] = bvr.Tags - } - if bvr.SystemData != nil { - objectMap["systemData"] = bvr.SystemData - } - return json.Marshal(objectMap) -} - -// BackupVaultResourceList list of BackupVault resources -type BackupVaultResourceList struct { - autorest.Response `json:"-"` - // Value - List of resources. - Value *[]BackupVaultResource `json:"value,omitempty"` - // NextLink - The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// BackupVaultResourceListIterator provides access to a complete listing of BackupVaultResource values. -type BackupVaultResourceListIterator struct { - i int - page BackupVaultResourceListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BackupVaultResourceListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupVaultResourceListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BackupVaultResourceListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BackupVaultResourceListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BackupVaultResourceListIterator) Response() BackupVaultResourceList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BackupVaultResourceListIterator) Value() BackupVaultResource { - if !iter.page.NotDone() { - return BackupVaultResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BackupVaultResourceListIterator type. -func NewBackupVaultResourceListIterator(page BackupVaultResourceListPage) BackupVaultResourceListIterator { - return BackupVaultResourceListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bvrl BackupVaultResourceList) IsEmpty() bool { - return bvrl.Value == nil || len(*bvrl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bvrl BackupVaultResourceList) hasNextLink() bool { - return bvrl.NextLink != nil && len(*bvrl.NextLink) != 0 -} - -// backupVaultResourceListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bvrl BackupVaultResourceList) backupVaultResourceListPreparer(ctx context.Context) (*http.Request, error) { - if !bvrl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bvrl.NextLink))) -} - -// BackupVaultResourceListPage contains a page of BackupVaultResource values. -type BackupVaultResourceListPage struct { - fn func(context.Context, BackupVaultResourceList) (BackupVaultResourceList, error) - bvrl BackupVaultResourceList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BackupVaultResourceListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupVaultResourceListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.bvrl) - if err != nil { - return err - } - page.bvrl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BackupVaultResourceListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BackupVaultResourceListPage) NotDone() bool { - return !page.bvrl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BackupVaultResourceListPage) Response() BackupVaultResourceList { - return page.bvrl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BackupVaultResourceListPage) Values() []BackupVaultResource { - if page.bvrl.IsEmpty() { - return nil - } - return *page.bvrl.Value -} - -// Creates a new instance of the BackupVaultResourceListPage type. -func NewBackupVaultResourceListPage(cur BackupVaultResourceList, getNextPage func(context.Context, BackupVaultResourceList) (BackupVaultResourceList, error)) BackupVaultResourceListPage { - return BackupVaultResourceListPage{ - fn: getNextPage, - bvrl: cur, - } -} - -// BackupVaultsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type BackupVaultsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupVaultsClient) (BackupVaultResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupVaultsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupVaultsCreateOrUpdateFuture.Result. -func (future *BackupVaultsCreateOrUpdateFuture) result(client BackupVaultsClient) (bvr BackupVaultResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bvr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dataprotection.BackupVaultsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bvr.Response.Response, err = future.GetResult(sender); err == nil && bvr.Response.Response.StatusCode != http.StatusNoContent { - bvr, err = client.CreateOrUpdateResponder(bvr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsCreateOrUpdateFuture", "Result", bvr.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupVaultsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BackupVaultsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupVaultsClient) (BackupVaultResource, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupVaultsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupVaultsUpdateFuture.Result. -func (future *BackupVaultsUpdateFuture) result(client BackupVaultsClient) (bvr BackupVaultResource, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bvr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dataprotection.BackupVaultsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bvr.Response.Response, err = future.GetResult(sender); err == nil && bvr.Response.Response.StatusCode != http.StatusNoContent { - bvr, err = client.UpdateResponder(bvr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.BackupVaultsUpdateFuture", "Result", bvr.Response.Response, "Failure responding to request") - } - } - return -} - -// BasicBaseBackupPolicy backupPolicy base -type BasicBaseBackupPolicy interface { - AsBackupPolicy() (*BackupPolicy, bool) - AsBaseBackupPolicy() (*BaseBackupPolicy, bool) -} - -// BaseBackupPolicy backupPolicy base -type BaseBackupPolicy struct { - // DatasourceTypes - Type of datasource for the backup management - DatasourceTypes *[]string `json:"datasourceTypes,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicBaseBackupPolicyObjectTypeBaseBackupPolicy', 'ObjectTypeBasicBaseBackupPolicyObjectTypeBackupPolicy' - ObjectType ObjectTypeBasicBaseBackupPolicy `json:"objectType,omitempty"` -} - -func unmarshalBasicBaseBackupPolicy(body []byte) (BasicBaseBackupPolicy, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicBaseBackupPolicyObjectTypeBackupPolicy): - var bp BackupPolicy - err := json.Unmarshal(body, &bp) - return bp, err - default: - var bbp BaseBackupPolicy - err := json.Unmarshal(body, &bbp) - return bbp, err - } -} - -func unmarshalBasicBaseBackupPolicyArray(body []byte) ([]BasicBaseBackupPolicy, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - bbpArray := make([]BasicBaseBackupPolicy, len(rawMessages)) - - for index, rawMessage := range rawMessages { - bbp, err := unmarshalBasicBaseBackupPolicy(*rawMessage) - if err != nil { - return nil, err - } - bbpArray[index] = bbp - } - return bbpArray, nil -} - -// MarshalJSON is the custom marshaler for BaseBackupPolicy. -func (bbp BaseBackupPolicy) MarshalJSON() ([]byte, error) { - bbp.ObjectType = ObjectTypeBasicBaseBackupPolicyObjectTypeBaseBackupPolicy - objectMap := make(map[string]interface{}) - if bbp.DatasourceTypes != nil { - objectMap["datasourceTypes"] = bbp.DatasourceTypes - } - if bbp.ObjectType != "" { - objectMap["objectType"] = bbp.ObjectType - } - return json.Marshal(objectMap) -} - -// AsBackupPolicy is the BasicBaseBackupPolicy implementation for BaseBackupPolicy. -func (bbp BaseBackupPolicy) AsBackupPolicy() (*BackupPolicy, bool) { - return nil, false -} - -// AsBaseBackupPolicy is the BasicBaseBackupPolicy implementation for BaseBackupPolicy. -func (bbp BaseBackupPolicy) AsBaseBackupPolicy() (*BaseBackupPolicy, bool) { - return &bbp, true -} - -// AsBasicBaseBackupPolicy is the BasicBaseBackupPolicy implementation for BaseBackupPolicy. -func (bbp BaseBackupPolicy) AsBasicBaseBackupPolicy() (BasicBaseBackupPolicy, bool) { - return &bbp, true -} - -// BaseBackupPolicyResource baseBackupPolicy resource -type BaseBackupPolicyResource struct { - autorest.Response `json:"-"` - // Properties - BaseBackupPolicyResource properties - Properties BasicBaseBackupPolicy `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for BaseBackupPolicyResource. -func (bbpr BaseBackupPolicyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["properties"] = bbpr.Properties - if bbpr.SystemData != nil { - objectMap["systemData"] = bbpr.SystemData - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BaseBackupPolicyResource struct. -func (bbpr *BaseBackupPolicyResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - properties, err := unmarshalBasicBaseBackupPolicy(*v) - if err != nil { - return err - } - bbpr.Properties = properties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bbpr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bbpr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bbpr.Type = &typeVar - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - bbpr.SystemData = &systemData - } - } - } - - return nil -} - -// BaseBackupPolicyResourceList list of BaseBackupPolicy resources -type BaseBackupPolicyResourceList struct { - autorest.Response `json:"-"` - // Value - List of resources. - Value *[]BaseBackupPolicyResource `json:"value,omitempty"` - // NextLink - The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// BaseBackupPolicyResourceListIterator provides access to a complete listing of BaseBackupPolicyResource -// values. -type BaseBackupPolicyResourceListIterator struct { - i int - page BaseBackupPolicyResourceListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *BaseBackupPolicyResourceListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseBackupPolicyResourceListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *BaseBackupPolicyResourceListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter BaseBackupPolicyResourceListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter BaseBackupPolicyResourceListIterator) Response() BaseBackupPolicyResourceList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter BaseBackupPolicyResourceListIterator) Value() BaseBackupPolicyResource { - if !iter.page.NotDone() { - return BaseBackupPolicyResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the BaseBackupPolicyResourceListIterator type. -func NewBaseBackupPolicyResourceListIterator(page BaseBackupPolicyResourceListPage) BaseBackupPolicyResourceListIterator { - return BaseBackupPolicyResourceListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (bbprl BaseBackupPolicyResourceList) IsEmpty() bool { - return bbprl.Value == nil || len(*bbprl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (bbprl BaseBackupPolicyResourceList) hasNextLink() bool { - return bbprl.NextLink != nil && len(*bbprl.NextLink) != 0 -} - -// baseBackupPolicyResourceListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (bbprl BaseBackupPolicyResourceList) baseBackupPolicyResourceListPreparer(ctx context.Context) (*http.Request, error) { - if !bbprl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(bbprl.NextLink))) -} - -// BaseBackupPolicyResourceListPage contains a page of BaseBackupPolicyResource values. -type BaseBackupPolicyResourceListPage struct { - fn func(context.Context, BaseBackupPolicyResourceList) (BaseBackupPolicyResourceList, error) - bbprl BaseBackupPolicyResourceList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *BaseBackupPolicyResourceListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseBackupPolicyResourceListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.bbprl) - if err != nil { - return err - } - page.bbprl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *BaseBackupPolicyResourceListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page BaseBackupPolicyResourceListPage) NotDone() bool { - return !page.bbprl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page BaseBackupPolicyResourceListPage) Response() BaseBackupPolicyResourceList { - return page.bbprl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page BaseBackupPolicyResourceListPage) Values() []BaseBackupPolicyResource { - if page.bbprl.IsEmpty() { - return nil - } - return *page.bbprl.Value -} - -// Creates a new instance of the BaseBackupPolicyResourceListPage type. -func NewBaseBackupPolicyResourceListPage(cur BaseBackupPolicyResourceList, getNextPage func(context.Context, BaseBackupPolicyResourceList) (BaseBackupPolicyResourceList, error)) BaseBackupPolicyResourceListPage { - return BaseBackupPolicyResourceListPage{ - fn: getNextPage, - bbprl: cur, - } -} - -// BasicBasePolicyRule basePolicy Rule -type BasicBasePolicyRule interface { - AsAzureBackupRule() (*AzureBackupRule, bool) - AsAzureRetentionRule() (*AzureRetentionRule, bool) - AsBasePolicyRule() (*BasePolicyRule, bool) -} - -// BasePolicyRule basePolicy Rule -type BasePolicyRule struct { - Name *string `json:"name,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicBasePolicyRuleObjectTypeBasePolicyRule', 'ObjectTypeBasicBasePolicyRuleObjectTypeAzureBackupRule', 'ObjectTypeBasicBasePolicyRuleObjectTypeAzureRetentionRule' - ObjectType ObjectTypeBasicBasePolicyRule `json:"objectType,omitempty"` -} - -func unmarshalBasicBasePolicyRule(body []byte) (BasicBasePolicyRule, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicBasePolicyRuleObjectTypeAzureBackupRule): - var abr AzureBackupRule - err := json.Unmarshal(body, &abr) - return abr, err - case string(ObjectTypeBasicBasePolicyRuleObjectTypeAzureRetentionRule): - var arr AzureRetentionRule - err := json.Unmarshal(body, &arr) - return arr, err - default: - var bpr BasePolicyRule - err := json.Unmarshal(body, &bpr) - return bpr, err - } -} - -func unmarshalBasicBasePolicyRuleArray(body []byte) ([]BasicBasePolicyRule, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - bprArray := make([]BasicBasePolicyRule, len(rawMessages)) - - for index, rawMessage := range rawMessages { - bpr, err := unmarshalBasicBasePolicyRule(*rawMessage) - if err != nil { - return nil, err - } - bprArray[index] = bpr - } - return bprArray, nil -} - -// MarshalJSON is the custom marshaler for BasePolicyRule. -func (bpr BasePolicyRule) MarshalJSON() ([]byte, error) { - bpr.ObjectType = ObjectTypeBasicBasePolicyRuleObjectTypeBasePolicyRule - objectMap := make(map[string]interface{}) - if bpr.Name != nil { - objectMap["name"] = bpr.Name - } - if bpr.ObjectType != "" { - objectMap["objectType"] = bpr.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAzureBackupRule is the BasicBasePolicyRule implementation for BasePolicyRule. -func (bpr BasePolicyRule) AsAzureBackupRule() (*AzureBackupRule, bool) { - return nil, false -} - -// AsAzureRetentionRule is the BasicBasePolicyRule implementation for BasePolicyRule. -func (bpr BasePolicyRule) AsAzureRetentionRule() (*AzureRetentionRule, bool) { - return nil, false -} - -// AsBasePolicyRule is the BasicBasePolicyRule implementation for BasePolicyRule. -func (bpr BasePolicyRule) AsBasePolicyRule() (*BasePolicyRule, bool) { - return &bpr, true -} - -// AsBasicBasePolicyRule is the BasicBasePolicyRule implementation for BasePolicyRule. -func (bpr BasePolicyRule) AsBasicBasePolicyRule() (BasicBasePolicyRule, bool) { - return &bpr, true -} - -// CheckNameAvailabilityRequest checkNameAvailability Request -type CheckNameAvailabilityRequest struct { - // Name - Resource name for which availability needs to be checked - Name *string `json:"name,omitempty"` - // Type - Describes the Resource type: Microsoft.DataProtection/BackupVaults - Type *string `json:"type,omitempty"` -} - -// CheckNameAvailabilityResult checkNameAvailability Result -type CheckNameAvailabilityResult struct { - autorest.Response `json:"-"` - // Message - Gets or sets the message. - Message *string `json:"message,omitempty"` - // NameAvailable - Gets or sets a value indicating whether [name available]. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Reason - Gets or sets the reason. - Reason *string `json:"reason,omitempty"` -} - -// ClientDiscoveryDisplay localized display information of an operation. -type ClientDiscoveryDisplay struct { - // Description - Description of the operation having details of what operation is about. - Description *string `json:"description,omitempty"` - // Operation - Operations Name itself. - Operation *string `json:"operation,omitempty"` - // Provider - Name of the provider for display purposes - Provider *string `json:"provider,omitempty"` - // Resource - ResourceType for which this Operation can be performed. - Resource *string `json:"resource,omitempty"` -} - -// ClientDiscoveryForLogSpecification class to represent shoebox log specification in json client -// discovery. -type ClientDiscoveryForLogSpecification struct { - // BlobDuration - blob duration of shoebox log specification - BlobDuration *string `json:"blobDuration,omitempty"` - // DisplayName - Localized display name - DisplayName *string `json:"displayName,omitempty"` - // Name - Name for shoebox log specification. - Name *string `json:"name,omitempty"` -} - -// ClientDiscoveryForProperties class to represent shoebox properties in json client discovery. -type ClientDiscoveryForProperties struct { - // ServiceSpecification - Operation properties. - ServiceSpecification *ClientDiscoveryForServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// ClientDiscoveryForServiceSpecification class to represent shoebox service specification in json client -// discovery. -type ClientDiscoveryForServiceSpecification struct { - // LogSpecifications - List of log specifications of this operation. - LogSpecifications *[]ClientDiscoveryForLogSpecification `json:"logSpecifications,omitempty"` -} - -// ClientDiscoveryResponse operations List response which contains list of available APIs. -type ClientDiscoveryResponse struct { - autorest.Response `json:"-"` - // NextLink - Link to the next chunk of Response. - NextLink *string `json:"nextLink,omitempty"` - // Value - List of available operations. - Value *[]ClientDiscoveryValueForSingleAPI `json:"value,omitempty"` -} - -// ClientDiscoveryResponseIterator provides access to a complete listing of -// ClientDiscoveryValueForSingleAPI values. -type ClientDiscoveryResponseIterator struct { - i int - page ClientDiscoveryResponsePage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ClientDiscoveryResponseIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClientDiscoveryResponseIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ClientDiscoveryResponseIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ClientDiscoveryResponseIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ClientDiscoveryResponseIterator) Response() ClientDiscoveryResponse { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ClientDiscoveryResponseIterator) Value() ClientDiscoveryValueForSingleAPI { - if !iter.page.NotDone() { - return ClientDiscoveryValueForSingleAPI{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ClientDiscoveryResponseIterator type. -func NewClientDiscoveryResponseIterator(page ClientDiscoveryResponsePage) ClientDiscoveryResponseIterator { - return ClientDiscoveryResponseIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cdr ClientDiscoveryResponse) IsEmpty() bool { - return cdr.Value == nil || len(*cdr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cdr ClientDiscoveryResponse) hasNextLink() bool { - return cdr.NextLink != nil && len(*cdr.NextLink) != 0 -} - -// clientDiscoveryResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cdr ClientDiscoveryResponse) clientDiscoveryResponsePreparer(ctx context.Context) (*http.Request, error) { - if !cdr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cdr.NextLink))) -} - -// ClientDiscoveryResponsePage contains a page of ClientDiscoveryValueForSingleAPI values. -type ClientDiscoveryResponsePage struct { - fn func(context.Context, ClientDiscoveryResponse) (ClientDiscoveryResponse, error) - cdr ClientDiscoveryResponse -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ClientDiscoveryResponsePage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClientDiscoveryResponsePage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cdr) - if err != nil { - return err - } - page.cdr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ClientDiscoveryResponsePage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ClientDiscoveryResponsePage) NotDone() bool { - return !page.cdr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ClientDiscoveryResponsePage) Response() ClientDiscoveryResponse { - return page.cdr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ClientDiscoveryResponsePage) Values() []ClientDiscoveryValueForSingleAPI { - if page.cdr.IsEmpty() { - return nil - } - return *page.cdr.Value -} - -// Creates a new instance of the ClientDiscoveryResponsePage type. -func NewClientDiscoveryResponsePage(cur ClientDiscoveryResponse, getNextPage func(context.Context, ClientDiscoveryResponse) (ClientDiscoveryResponse, error)) ClientDiscoveryResponsePage { - return ClientDiscoveryResponsePage{ - fn: getNextPage, - cdr: cur, - } -} - -// ClientDiscoveryValueForSingleAPI available operation details. -type ClientDiscoveryValueForSingleAPI struct { - // Display - Contains the localized display information for this particular operation - Display *ClientDiscoveryDisplay `json:"display,omitempty"` - // Name - Name of the Operation. - Name *string `json:"name,omitempty"` - // IsDataAction - Indicates whether the operation is a data action - IsDataAction *bool `json:"isDataAction,omitempty"` - // Origin - The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX - Origin *string `json:"origin,omitempty"` - // Properties - Properties for the given operation. - Properties *ClientDiscoveryForProperties `json:"properties,omitempty"` -} - -// CloudError an error response from Azure Backup. -type CloudError struct { - Error *Error `json:"error,omitempty"` -} - -// CopyOnExpiryOption copy on Expiry Option -type CopyOnExpiryOption struct { - // ObjectType - Possible values include: 'ObjectTypeBasicCopyOptionObjectTypeCopyOption', 'ObjectTypeBasicCopyOptionObjectTypeCopyOnExpiryOption', 'ObjectTypeBasicCopyOptionObjectTypeCustomCopyOption', 'ObjectTypeBasicCopyOptionObjectTypeImmediateCopyOption' - ObjectType ObjectTypeBasicCopyOption `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for CopyOnExpiryOption. -func (coeo CopyOnExpiryOption) MarshalJSON() ([]byte, error) { - coeo.ObjectType = ObjectTypeBasicCopyOptionObjectTypeCopyOnExpiryOption - objectMap := make(map[string]interface{}) - if coeo.ObjectType != "" { - objectMap["objectType"] = coeo.ObjectType - } - return json.Marshal(objectMap) -} - -// AsCopyOnExpiryOption is the BasicCopyOption implementation for CopyOnExpiryOption. -func (coeo CopyOnExpiryOption) AsCopyOnExpiryOption() (*CopyOnExpiryOption, bool) { - return &coeo, true -} - -// AsCustomCopyOption is the BasicCopyOption implementation for CopyOnExpiryOption. -func (coeo CopyOnExpiryOption) AsCustomCopyOption() (*CustomCopyOption, bool) { - return nil, false -} - -// AsImmediateCopyOption is the BasicCopyOption implementation for CopyOnExpiryOption. -func (coeo CopyOnExpiryOption) AsImmediateCopyOption() (*ImmediateCopyOption, bool) { - return nil, false -} - -// AsCopyOption is the BasicCopyOption implementation for CopyOnExpiryOption. -func (coeo CopyOnExpiryOption) AsCopyOption() (*CopyOption, bool) { - return nil, false -} - -// AsBasicCopyOption is the BasicCopyOption implementation for CopyOnExpiryOption. -func (coeo CopyOnExpiryOption) AsBasicCopyOption() (BasicCopyOption, bool) { - return &coeo, true -} - -// BasicCopyOption options to copy -type BasicCopyOption interface { - AsCopyOnExpiryOption() (*CopyOnExpiryOption, bool) - AsCustomCopyOption() (*CustomCopyOption, bool) - AsImmediateCopyOption() (*ImmediateCopyOption, bool) - AsCopyOption() (*CopyOption, bool) -} - -// CopyOption options to copy -type CopyOption struct { - // ObjectType - Possible values include: 'ObjectTypeBasicCopyOptionObjectTypeCopyOption', 'ObjectTypeBasicCopyOptionObjectTypeCopyOnExpiryOption', 'ObjectTypeBasicCopyOptionObjectTypeCustomCopyOption', 'ObjectTypeBasicCopyOptionObjectTypeImmediateCopyOption' - ObjectType ObjectTypeBasicCopyOption `json:"objectType,omitempty"` -} - -func unmarshalBasicCopyOption(body []byte) (BasicCopyOption, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicCopyOptionObjectTypeCopyOnExpiryOption): - var coeo CopyOnExpiryOption - err := json.Unmarshal(body, &coeo) - return coeo, err - case string(ObjectTypeBasicCopyOptionObjectTypeCustomCopyOption): - var cco CustomCopyOption - err := json.Unmarshal(body, &cco) - return cco, err - case string(ObjectTypeBasicCopyOptionObjectTypeImmediateCopyOption): - var ico ImmediateCopyOption - err := json.Unmarshal(body, &ico) - return ico, err - default: - var co CopyOption - err := json.Unmarshal(body, &co) - return co, err - } -} - -func unmarshalBasicCopyOptionArray(body []byte) ([]BasicCopyOption, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - coArray := make([]BasicCopyOption, len(rawMessages)) - - for index, rawMessage := range rawMessages { - co, err := unmarshalBasicCopyOption(*rawMessage) - if err != nil { - return nil, err - } - coArray[index] = co - } - return coArray, nil -} - -// MarshalJSON is the custom marshaler for CopyOption. -func (co CopyOption) MarshalJSON() ([]byte, error) { - co.ObjectType = ObjectTypeBasicCopyOptionObjectTypeCopyOption - objectMap := make(map[string]interface{}) - if co.ObjectType != "" { - objectMap["objectType"] = co.ObjectType - } - return json.Marshal(objectMap) -} - -// AsCopyOnExpiryOption is the BasicCopyOption implementation for CopyOption. -func (co CopyOption) AsCopyOnExpiryOption() (*CopyOnExpiryOption, bool) { - return nil, false -} - -// AsCustomCopyOption is the BasicCopyOption implementation for CopyOption. -func (co CopyOption) AsCustomCopyOption() (*CustomCopyOption, bool) { - return nil, false -} - -// AsImmediateCopyOption is the BasicCopyOption implementation for CopyOption. -func (co CopyOption) AsImmediateCopyOption() (*ImmediateCopyOption, bool) { - return nil, false -} - -// AsCopyOption is the BasicCopyOption implementation for CopyOption. -func (co CopyOption) AsCopyOption() (*CopyOption, bool) { - return &co, true -} - -// AsBasicCopyOption is the BasicCopyOption implementation for CopyOption. -func (co CopyOption) AsBasicCopyOption() (BasicCopyOption, bool) { - return &co, true -} - -// CustomCopyOption duration based custom options to copy -type CustomCopyOption struct { - // Duration - Data copied after given timespan - Duration *string `json:"duration,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicCopyOptionObjectTypeCopyOption', 'ObjectTypeBasicCopyOptionObjectTypeCopyOnExpiryOption', 'ObjectTypeBasicCopyOptionObjectTypeCustomCopyOption', 'ObjectTypeBasicCopyOptionObjectTypeImmediateCopyOption' - ObjectType ObjectTypeBasicCopyOption `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for CustomCopyOption. -func (cco CustomCopyOption) MarshalJSON() ([]byte, error) { - cco.ObjectType = ObjectTypeBasicCopyOptionObjectTypeCustomCopyOption - objectMap := make(map[string]interface{}) - if cco.Duration != nil { - objectMap["duration"] = cco.Duration - } - if cco.ObjectType != "" { - objectMap["objectType"] = cco.ObjectType - } - return json.Marshal(objectMap) -} - -// AsCopyOnExpiryOption is the BasicCopyOption implementation for CustomCopyOption. -func (cco CustomCopyOption) AsCopyOnExpiryOption() (*CopyOnExpiryOption, bool) { - return nil, false -} - -// AsCustomCopyOption is the BasicCopyOption implementation for CustomCopyOption. -func (cco CustomCopyOption) AsCustomCopyOption() (*CustomCopyOption, bool) { - return &cco, true -} - -// AsImmediateCopyOption is the BasicCopyOption implementation for CustomCopyOption. -func (cco CustomCopyOption) AsImmediateCopyOption() (*ImmediateCopyOption, bool) { - return nil, false -} - -// AsCopyOption is the BasicCopyOption implementation for CustomCopyOption. -func (cco CustomCopyOption) AsCopyOption() (*CopyOption, bool) { - return nil, false -} - -// AsBasicCopyOption is the BasicCopyOption implementation for CustomCopyOption. -func (cco CustomCopyOption) AsBasicCopyOption() (BasicCopyOption, bool) { - return &cco, true -} - -// Datasource datasource to be backed up -type Datasource struct { - // DatasourceType - DatasourceType of the resource. - DatasourceType *string `json:"datasourceType,omitempty"` - // ObjectType - Type of Datasource object, used to initialize the right inherited type - ObjectType *string `json:"objectType,omitempty"` - // ResourceID - Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure resources, this will be the ID created by backup service via Fabric/Vault. - ResourceID *string `json:"resourceID,omitempty"` - // ResourceLocation - Location of datasource. - ResourceLocation *string `json:"resourceLocation,omitempty"` - // ResourceName - Unique identifier of the resource in the context of parent. - ResourceName *string `json:"resourceName,omitempty"` - // ResourceType - Resource Type of Datasource. - ResourceType *string `json:"resourceType,omitempty"` - // ResourceURI - Uri of the resource. - ResourceURI *string `json:"resourceUri,omitempty"` -} - -// DatasourceSet datasourceSet details of datasource to be backed up -type DatasourceSet struct { - // DatasourceType - DatasourceType of the resource. - DatasourceType *string `json:"datasourceType,omitempty"` - // ObjectType - Type of Datasource object, used to initialize the right inherited type - ObjectType *string `json:"objectType,omitempty"` - // ResourceID - Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure resources, this will be the ID created by backup service via Fabric/Vault. - ResourceID *string `json:"resourceID,omitempty"` - // ResourceLocation - Location of datasource. - ResourceLocation *string `json:"resourceLocation,omitempty"` - // ResourceName - Unique identifier of the resource in the context of parent. - ResourceName *string `json:"resourceName,omitempty"` - // ResourceType - Resource Type of Datasource. - ResourceType *string `json:"resourceType,omitempty"` - // ResourceURI - Uri of the resource. - ResourceURI *string `json:"resourceUri,omitempty"` -} - -// DataStoreInfoBase dataStoreInfo base -type DataStoreInfoBase struct { - // DataStoreType - type of datastore; Operational/Vault/Archive. Possible values include: 'DataStoreTypesOperationalStore', 'DataStoreTypesVaultStore', 'DataStoreTypesArchiveStore' - DataStoreType DataStoreTypes `json:"dataStoreType,omitempty"` - // ObjectType - Type of Datasource object, used to initialize the right inherited type - ObjectType *string `json:"objectType,omitempty"` -} - -// BasicDataStoreParameters parameters for DataStore -type BasicDataStoreParameters interface { - AsAzureOperationalStoreParameters() (*AzureOperationalStoreParameters, bool) - AsDataStoreParameters() (*DataStoreParameters, bool) -} - -// DataStoreParameters parameters for DataStore -type DataStoreParameters struct { - // DataStoreType - type of datastore; Operational/Vault/Archive. Possible values include: 'DataStoreTypesOperationalStore', 'DataStoreTypesVaultStore', 'DataStoreTypesArchiveStore' - DataStoreType DataStoreTypes `json:"dataStoreType,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicDataStoreParametersObjectTypeDataStoreParameters', 'ObjectTypeBasicDataStoreParametersObjectTypeAzureOperationalStoreParameters' - ObjectType ObjectTypeBasicDataStoreParameters `json:"objectType,omitempty"` -} - -func unmarshalBasicDataStoreParameters(body []byte) (BasicDataStoreParameters, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicDataStoreParametersObjectTypeAzureOperationalStoreParameters): - var aosp AzureOperationalStoreParameters - err := json.Unmarshal(body, &aosp) - return aosp, err - default: - var dsp DataStoreParameters - err := json.Unmarshal(body, &dsp) - return dsp, err - } -} - -func unmarshalBasicDataStoreParametersArray(body []byte) ([]BasicDataStoreParameters, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - dspArray := make([]BasicDataStoreParameters, len(rawMessages)) - - for index, rawMessage := range rawMessages { - dsp, err := unmarshalBasicDataStoreParameters(*rawMessage) - if err != nil { - return nil, err - } - dspArray[index] = dsp - } - return dspArray, nil -} - -// MarshalJSON is the custom marshaler for DataStoreParameters. -func (dsp DataStoreParameters) MarshalJSON() ([]byte, error) { - dsp.ObjectType = ObjectTypeBasicDataStoreParametersObjectTypeDataStoreParameters - objectMap := make(map[string]interface{}) - if dsp.DataStoreType != "" { - objectMap["dataStoreType"] = dsp.DataStoreType - } - if dsp.ObjectType != "" { - objectMap["objectType"] = dsp.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAzureOperationalStoreParameters is the BasicDataStoreParameters implementation for DataStoreParameters. -func (dsp DataStoreParameters) AsAzureOperationalStoreParameters() (*AzureOperationalStoreParameters, bool) { - return nil, false -} - -// AsDataStoreParameters is the BasicDataStoreParameters implementation for DataStoreParameters. -func (dsp DataStoreParameters) AsDataStoreParameters() (*DataStoreParameters, bool) { - return &dsp, true -} - -// AsBasicDataStoreParameters is the BasicDataStoreParameters implementation for DataStoreParameters. -func (dsp DataStoreParameters) AsBasicDataStoreParameters() (BasicDataStoreParameters, bool) { - return &dsp, true -} - -// Day day of the week -type Day struct { - // Date - Date of the month - Date *int32 `json:"date,omitempty"` - // IsLast - Whether Date is last date of month - IsLast *bool `json:"isLast,omitempty"` -} - -// BasicDeleteOption delete Option -type BasicDeleteOption interface { - AsAbsoluteDeleteOption() (*AbsoluteDeleteOption, bool) - AsDeleteOption() (*DeleteOption, bool) -} - -// DeleteOption delete Option -type DeleteOption struct { - // Duration - Duration of deletion after given timespan - Duration *string `json:"duration,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicDeleteOptionObjectTypeDeleteOption', 'ObjectTypeBasicDeleteOptionObjectTypeAbsoluteDeleteOption' - ObjectType ObjectTypeBasicDeleteOption `json:"objectType,omitempty"` -} - -func unmarshalBasicDeleteOption(body []byte) (BasicDeleteOption, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicDeleteOptionObjectTypeAbsoluteDeleteOption): - var ado AbsoluteDeleteOption - err := json.Unmarshal(body, &ado) - return ado, err - default: - var do DeleteOption - err := json.Unmarshal(body, &do) - return do, err - } -} - -func unmarshalBasicDeleteOptionArray(body []byte) ([]BasicDeleteOption, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - doArray := make([]BasicDeleteOption, len(rawMessages)) - - for index, rawMessage := range rawMessages { - do, err := unmarshalBasicDeleteOption(*rawMessage) - if err != nil { - return nil, err - } - doArray[index] = do - } - return doArray, nil -} - -// MarshalJSON is the custom marshaler for DeleteOption. -func (do DeleteOption) MarshalJSON() ([]byte, error) { - do.ObjectType = ObjectTypeBasicDeleteOptionObjectTypeDeleteOption - objectMap := make(map[string]interface{}) - if do.Duration != nil { - objectMap["duration"] = do.Duration - } - if do.ObjectType != "" { - objectMap["objectType"] = do.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAbsoluteDeleteOption is the BasicDeleteOption implementation for DeleteOption. -func (do DeleteOption) AsAbsoluteDeleteOption() (*AbsoluteDeleteOption, bool) { - return nil, false -} - -// AsDeleteOption is the BasicDeleteOption implementation for DeleteOption. -func (do DeleteOption) AsDeleteOption() (*DeleteOption, bool) { - return &do, true -} - -// AsBasicDeleteOption is the BasicDeleteOption implementation for DeleteOption. -func (do DeleteOption) AsBasicDeleteOption() (BasicDeleteOption, bool) { - return &do, true -} - -// DppBaseResource base resource under Microsoft.DataProtection provider namespace -type DppBaseResource struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DppBaseResource. -func (dbr DppBaseResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// DppBaseResourceList base for all lists of V2 resources. -type DppBaseResourceList struct { - autorest.Response `json:"-"` - // Value - List of Dpp resources. - Value *[]DppBaseResource `json:"value,omitempty"` - // NextLink - The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// DppBaseResourceListIterator provides access to a complete listing of DppBaseResource values. -type DppBaseResourceListIterator struct { - i int - page DppBaseResourceListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *DppBaseResourceListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DppBaseResourceListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *DppBaseResourceListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DppBaseResourceListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter DppBaseResourceListIterator) Response() DppBaseResourceList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter DppBaseResourceListIterator) Value() DppBaseResource { - if !iter.page.NotDone() { - return DppBaseResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the DppBaseResourceListIterator type. -func NewDppBaseResourceListIterator(page DppBaseResourceListPage) DppBaseResourceListIterator { - return DppBaseResourceListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (dbrl DppBaseResourceList) IsEmpty() bool { - return dbrl.Value == nil || len(*dbrl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (dbrl DppBaseResourceList) hasNextLink() bool { - return dbrl.NextLink != nil && len(*dbrl.NextLink) != 0 -} - -// dppBaseResourceListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (dbrl DppBaseResourceList) dppBaseResourceListPreparer(ctx context.Context) (*http.Request, error) { - if !dbrl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(dbrl.NextLink))) -} - -// DppBaseResourceListPage contains a page of DppBaseResource values. -type DppBaseResourceListPage struct { - fn func(context.Context, DppBaseResourceList) (DppBaseResourceList, error) - dbrl DppBaseResourceList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *DppBaseResourceListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DppBaseResourceListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.dbrl) - if err != nil { - return err - } - page.dbrl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *DppBaseResourceListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DppBaseResourceListPage) NotDone() bool { - return !page.dbrl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page DppBaseResourceListPage) Response() DppBaseResourceList { - return page.dbrl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page DppBaseResourceListPage) Values() []DppBaseResource { - if page.dbrl.IsEmpty() { - return nil - } - return *page.dbrl.Value -} - -// Creates a new instance of the DppBaseResourceListPage type. -func NewDppBaseResourceListPage(cur DppBaseResourceList, getNextPage func(context.Context, DppBaseResourceList) (DppBaseResourceList, error)) DppBaseResourceListPage { - return DppBaseResourceListPage{ - fn: getNextPage, - dbrl: cur, - } -} - -// DppIdentityDetails identity details -type DppIdentityDetails struct { - // PrincipalID - READ-ONLY; The object ID of the service principal object for the managed identity that is used to grant role-based access to an Azure resource. - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; A Globally Unique Identifier (GUID) that represents the Azure AD tenant where the resource is now a member. - TenantID *string `json:"tenantId,omitempty"` - // Type - The identityType which can be either SystemAssigned or None - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DppIdentityDetails. -func (did DppIdentityDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if did.Type != nil { - objectMap["type"] = did.Type - } - return json.Marshal(objectMap) -} - -// DppResource resource class -type DppResource struct { - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for DppResource. -func (dr DppResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dr.SystemData != nil { - objectMap["systemData"] = dr.SystemData - } - return json.Marshal(objectMap) -} - -// DppResourceList listResource -type DppResourceList struct { - // NextLink - The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// DppTrackedResource ... -type DppTrackedResource struct { - // ETag - Optional ETag. - ETag *string `json:"eTag,omitempty"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Identity - Input Managed Identity Details - Identity *DppIdentityDetails `json:"identity,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for DppTrackedResource. -func (dtr DppTrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dtr.ETag != nil { - objectMap["eTag"] = dtr.ETag - } - if dtr.Identity != nil { - objectMap["identity"] = dtr.Identity - } - if dtr.Location != nil { - objectMap["location"] = dtr.Location - } - if dtr.Tags != nil { - objectMap["tags"] = dtr.Tags - } - if dtr.SystemData != nil { - objectMap["systemData"] = dtr.SystemData - } - return json.Marshal(objectMap) -} - -// DppTrackedResourceList ... -type DppTrackedResourceList struct { - // NextLink - The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// DppWorkerRequest ... -type DppWorkerRequest struct { - SubscriptionID *string `json:"subscriptionId,omitempty"` - URI *string `json:"uri,omitempty"` - Headers map[string][]string `json:"headers"` - SupportedGroupVersions *[]string `json:"supportedGroupVersions,omitempty"` - CultureInfo *string `json:"cultureInfo,omitempty"` - Parameters map[string]*string `json:"parameters"` - HTTPMethod *string `json:"httpMethod,omitempty"` -} - -// MarshalJSON is the custom marshaler for DppWorkerRequest. -func (dwr DppWorkerRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dwr.SubscriptionID != nil { - objectMap["subscriptionId"] = dwr.SubscriptionID - } - if dwr.URI != nil { - objectMap["uri"] = dwr.URI - } - if dwr.Headers != nil { - objectMap["headers"] = dwr.Headers - } - if dwr.SupportedGroupVersions != nil { - objectMap["supportedGroupVersions"] = dwr.SupportedGroupVersions - } - if dwr.CultureInfo != nil { - objectMap["cultureInfo"] = dwr.CultureInfo - } - if dwr.Parameters != nil { - objectMap["parameters"] = dwr.Parameters - } - if dwr.HTTPMethod != nil { - objectMap["httpMethod"] = dwr.HTTPMethod - } - return json.Marshal(objectMap) -} - -// Error the resource management error response. -type Error struct { - // AdditionalInfo - READ-ONLY; The error additional info. - AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` - // Code - READ-ONLY; The error code. - Code *string `json:"code,omitempty"` - // Details - READ-ONLY; The error details. - Details *[]Error `json:"details,omitempty"` - // Message - READ-ONLY; The error message. - Message *string `json:"message,omitempty"` - // Target - READ-ONLY; The error target. - Target *string `json:"target,omitempty"` -} - -// MarshalJSON is the custom marshaler for Error. -func (e Error) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorAdditionalInfo the resource management error additional info. -type ErrorAdditionalInfo struct { - // Info - READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty"` - // Type - READ-ONLY; The additional info type. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. -func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ExportJobsResult the result for export jobs containing blob details. -type ExportJobsResult struct { - autorest.Response `json:"-"` - // BlobURL - READ-ONLY; URL of the blob into which the serialized string of list of jobs is exported. - BlobURL *string `json:"blobUrl,omitempty"` - // BlobSasKey - READ-ONLY; SAS key to access the blob. - BlobSasKey *string `json:"blobSasKey,omitempty"` - // ExcelFileBlobURL - READ-ONLY; URL of the blob into which the ExcelFile is uploaded. - ExcelFileBlobURL *string `json:"excelFileBlobUrl,omitempty"` - // ExcelFileBlobSasKey - READ-ONLY; SAS key to access the ExcelFile blob. - ExcelFileBlobSasKey *string `json:"excelFileBlobSasKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for ExportJobsResult. -func (ejr ExportJobsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ExportJobsTriggerFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ExportJobsTriggerFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ExportJobsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ExportJobsTriggerFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ExportJobsTriggerFuture.Result. -func (future *ExportJobsTriggerFuture) result(client ExportJobsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ExportJobsTriggerFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("dataprotection.ExportJobsTriggerFuture") - return - } - ar.Response = future.Response() - return -} - -// FeatureValidationRequest base class for feature object -type FeatureValidationRequest struct { - // FeatureType - backup support feature type. Possible values include: 'FeatureTypeInvalid', 'FeatureTypeDataSourceType' - FeatureType FeatureType `json:"featureType,omitempty"` - // FeatureName - backup support feature name. - FeatureName *string `json:"featureName,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicFeatureValidationRequestBaseObjectTypeFeatureValidationRequestBase', 'ObjectTypeBasicFeatureValidationRequestBaseObjectTypeFeatureValidationRequest' - ObjectType ObjectTypeBasicFeatureValidationRequestBase `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for FeatureValidationRequest. -func (fvr FeatureValidationRequest) MarshalJSON() ([]byte, error) { - fvr.ObjectType = ObjectTypeBasicFeatureValidationRequestBaseObjectTypeFeatureValidationRequest - objectMap := make(map[string]interface{}) - if fvr.FeatureType != "" { - objectMap["featureType"] = fvr.FeatureType - } - if fvr.FeatureName != nil { - objectMap["featureName"] = fvr.FeatureName - } - if fvr.ObjectType != "" { - objectMap["objectType"] = fvr.ObjectType - } - return json.Marshal(objectMap) -} - -// AsFeatureValidationRequest is the BasicFeatureValidationRequestBase implementation for FeatureValidationRequest. -func (fvr FeatureValidationRequest) AsFeatureValidationRequest() (*FeatureValidationRequest, bool) { - return &fvr, true -} - -// AsFeatureValidationRequestBase is the BasicFeatureValidationRequestBase implementation for FeatureValidationRequest. -func (fvr FeatureValidationRequest) AsFeatureValidationRequestBase() (*FeatureValidationRequestBase, bool) { - return nil, false -} - -// AsBasicFeatureValidationRequestBase is the BasicFeatureValidationRequestBase implementation for FeatureValidationRequest. -func (fvr FeatureValidationRequest) AsBasicFeatureValidationRequestBase() (BasicFeatureValidationRequestBase, bool) { - return &fvr, true -} - -// BasicFeatureValidationRequestBase base class for Backup Feature support -type BasicFeatureValidationRequestBase interface { - AsFeatureValidationRequest() (*FeatureValidationRequest, bool) - AsFeatureValidationRequestBase() (*FeatureValidationRequestBase, bool) -} - -// FeatureValidationRequestBase base class for Backup Feature support -type FeatureValidationRequestBase struct { - // ObjectType - Possible values include: 'ObjectTypeBasicFeatureValidationRequestBaseObjectTypeFeatureValidationRequestBase', 'ObjectTypeBasicFeatureValidationRequestBaseObjectTypeFeatureValidationRequest' - ObjectType ObjectTypeBasicFeatureValidationRequestBase `json:"objectType,omitempty"` -} - -func unmarshalBasicFeatureValidationRequestBase(body []byte) (BasicFeatureValidationRequestBase, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicFeatureValidationRequestBaseObjectTypeFeatureValidationRequest): - var fvr FeatureValidationRequest - err := json.Unmarshal(body, &fvr) - return fvr, err - default: - var fvrb FeatureValidationRequestBase - err := json.Unmarshal(body, &fvrb) - return fvrb, err - } -} - -func unmarshalBasicFeatureValidationRequestBaseArray(body []byte) ([]BasicFeatureValidationRequestBase, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - fvrbArray := make([]BasicFeatureValidationRequestBase, len(rawMessages)) - - for index, rawMessage := range rawMessages { - fvrb, err := unmarshalBasicFeatureValidationRequestBase(*rawMessage) - if err != nil { - return nil, err - } - fvrbArray[index] = fvrb - } - return fvrbArray, nil -} - -// MarshalJSON is the custom marshaler for FeatureValidationRequestBase. -func (fvrb FeatureValidationRequestBase) MarshalJSON() ([]byte, error) { - fvrb.ObjectType = ObjectTypeBasicFeatureValidationRequestBaseObjectTypeFeatureValidationRequestBase - objectMap := make(map[string]interface{}) - if fvrb.ObjectType != "" { - objectMap["objectType"] = fvrb.ObjectType - } - return json.Marshal(objectMap) -} - -// AsFeatureValidationRequest is the BasicFeatureValidationRequestBase implementation for FeatureValidationRequestBase. -func (fvrb FeatureValidationRequestBase) AsFeatureValidationRequest() (*FeatureValidationRequest, bool) { - return nil, false -} - -// AsFeatureValidationRequestBase is the BasicFeatureValidationRequestBase implementation for FeatureValidationRequestBase. -func (fvrb FeatureValidationRequestBase) AsFeatureValidationRequestBase() (*FeatureValidationRequestBase, bool) { - return &fvrb, true -} - -// AsBasicFeatureValidationRequestBase is the BasicFeatureValidationRequestBase implementation for FeatureValidationRequestBase. -func (fvrb FeatureValidationRequestBase) AsBasicFeatureValidationRequestBase() (BasicFeatureValidationRequestBase, bool) { - return &fvrb, true -} - -// FeatureValidationResponse feature Validation Response -type FeatureValidationResponse struct { - // FeatureType - backup support feature type. Possible values include: 'FeatureTypeInvalid', 'FeatureTypeDataSourceType' - FeatureType FeatureType `json:"featureType,omitempty"` - // Features - Response features - Features *[]SupportedFeature `json:"features,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicFeatureValidationResponseBaseObjectTypeFeatureValidationResponseBase', 'ObjectTypeBasicFeatureValidationResponseBaseObjectTypeFeatureValidationResponse' - ObjectType ObjectTypeBasicFeatureValidationResponseBase `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for FeatureValidationResponse. -func (fvr FeatureValidationResponse) MarshalJSON() ([]byte, error) { - fvr.ObjectType = ObjectTypeBasicFeatureValidationResponseBaseObjectTypeFeatureValidationResponse - objectMap := make(map[string]interface{}) - if fvr.FeatureType != "" { - objectMap["featureType"] = fvr.FeatureType - } - if fvr.Features != nil { - objectMap["features"] = fvr.Features - } - if fvr.ObjectType != "" { - objectMap["objectType"] = fvr.ObjectType - } - return json.Marshal(objectMap) -} - -// AsFeatureValidationResponse is the BasicFeatureValidationResponseBase implementation for FeatureValidationResponse. -func (fvr FeatureValidationResponse) AsFeatureValidationResponse() (*FeatureValidationResponse, bool) { - return &fvr, true -} - -// AsFeatureValidationResponseBase is the BasicFeatureValidationResponseBase implementation for FeatureValidationResponse. -func (fvr FeatureValidationResponse) AsFeatureValidationResponseBase() (*FeatureValidationResponseBase, bool) { - return nil, false -} - -// AsBasicFeatureValidationResponseBase is the BasicFeatureValidationResponseBase implementation for FeatureValidationResponse. -func (fvr FeatureValidationResponse) AsBasicFeatureValidationResponseBase() (BasicFeatureValidationResponseBase, bool) { - return &fvr, true -} - -// BasicFeatureValidationResponseBase base class for Backup Feature support -type BasicFeatureValidationResponseBase interface { - AsFeatureValidationResponse() (*FeatureValidationResponse, bool) - AsFeatureValidationResponseBase() (*FeatureValidationResponseBase, bool) -} - -// FeatureValidationResponseBase base class for Backup Feature support -type FeatureValidationResponseBase struct { - autorest.Response `json:"-"` - // ObjectType - Possible values include: 'ObjectTypeBasicFeatureValidationResponseBaseObjectTypeFeatureValidationResponseBase', 'ObjectTypeBasicFeatureValidationResponseBaseObjectTypeFeatureValidationResponse' - ObjectType ObjectTypeBasicFeatureValidationResponseBase `json:"objectType,omitempty"` -} - -func unmarshalBasicFeatureValidationResponseBase(body []byte) (BasicFeatureValidationResponseBase, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicFeatureValidationResponseBaseObjectTypeFeatureValidationResponse): - var fvr FeatureValidationResponse - err := json.Unmarshal(body, &fvr) - return fvr, err - default: - var fvrb FeatureValidationResponseBase - err := json.Unmarshal(body, &fvrb) - return fvrb, err - } -} - -func unmarshalBasicFeatureValidationResponseBaseArray(body []byte) ([]BasicFeatureValidationResponseBase, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - fvrbArray := make([]BasicFeatureValidationResponseBase, len(rawMessages)) - - for index, rawMessage := range rawMessages { - fvrb, err := unmarshalBasicFeatureValidationResponseBase(*rawMessage) - if err != nil { - return nil, err - } - fvrbArray[index] = fvrb - } - return fvrbArray, nil -} - -// MarshalJSON is the custom marshaler for FeatureValidationResponseBase. -func (fvrb FeatureValidationResponseBase) MarshalJSON() ([]byte, error) { - fvrb.ObjectType = ObjectTypeBasicFeatureValidationResponseBaseObjectTypeFeatureValidationResponseBase - objectMap := make(map[string]interface{}) - if fvrb.ObjectType != "" { - objectMap["objectType"] = fvrb.ObjectType - } - return json.Marshal(objectMap) -} - -// AsFeatureValidationResponse is the BasicFeatureValidationResponseBase implementation for FeatureValidationResponseBase. -func (fvrb FeatureValidationResponseBase) AsFeatureValidationResponse() (*FeatureValidationResponse, bool) { - return nil, false -} - -// AsFeatureValidationResponseBase is the BasicFeatureValidationResponseBase implementation for FeatureValidationResponseBase. -func (fvrb FeatureValidationResponseBase) AsFeatureValidationResponseBase() (*FeatureValidationResponseBase, bool) { - return &fvrb, true -} - -// AsBasicFeatureValidationResponseBase is the BasicFeatureValidationResponseBase implementation for FeatureValidationResponseBase. -func (fvrb FeatureValidationResponseBase) AsBasicFeatureValidationResponseBase() (BasicFeatureValidationResponseBase, bool) { - return &fvrb, true -} - -// FeatureValidationResponseBaseModel ... -type FeatureValidationResponseBaseModel struct { - autorest.Response `json:"-"` - Value BasicFeatureValidationResponseBase `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for FeatureValidationResponseBaseModel struct. -func (fvrbm *FeatureValidationResponseBaseModel) UnmarshalJSON(body []byte) error { - fvrb, err := unmarshalBasicFeatureValidationResponseBase(body) - if err != nil { - return err - } - fvrbm.Value = fvrb - - return nil -} - -// ImmediateCopyOption immediate copy Option -type ImmediateCopyOption struct { - // ObjectType - Possible values include: 'ObjectTypeBasicCopyOptionObjectTypeCopyOption', 'ObjectTypeBasicCopyOptionObjectTypeCopyOnExpiryOption', 'ObjectTypeBasicCopyOptionObjectTypeCustomCopyOption', 'ObjectTypeBasicCopyOptionObjectTypeImmediateCopyOption' - ObjectType ObjectTypeBasicCopyOption `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ImmediateCopyOption. -func (ico ImmediateCopyOption) MarshalJSON() ([]byte, error) { - ico.ObjectType = ObjectTypeBasicCopyOptionObjectTypeImmediateCopyOption - objectMap := make(map[string]interface{}) - if ico.ObjectType != "" { - objectMap["objectType"] = ico.ObjectType - } - return json.Marshal(objectMap) -} - -// AsCopyOnExpiryOption is the BasicCopyOption implementation for ImmediateCopyOption. -func (ico ImmediateCopyOption) AsCopyOnExpiryOption() (*CopyOnExpiryOption, bool) { - return nil, false -} - -// AsCustomCopyOption is the BasicCopyOption implementation for ImmediateCopyOption. -func (ico ImmediateCopyOption) AsCustomCopyOption() (*CustomCopyOption, bool) { - return nil, false -} - -// AsImmediateCopyOption is the BasicCopyOption implementation for ImmediateCopyOption. -func (ico ImmediateCopyOption) AsImmediateCopyOption() (*ImmediateCopyOption, bool) { - return &ico, true -} - -// AsCopyOption is the BasicCopyOption implementation for ImmediateCopyOption. -func (ico ImmediateCopyOption) AsCopyOption() (*CopyOption, bool) { - return nil, false -} - -// AsBasicCopyOption is the BasicCopyOption implementation for ImmediateCopyOption. -func (ico ImmediateCopyOption) AsBasicCopyOption() (BasicCopyOption, bool) { - return &ico, true -} - -// InnerError inner Error -type InnerError struct { - // AdditionalInfo - Any Key value pairs that can be provided to the client for additional verbose information. - AdditionalInfo map[string]*string `json:"additionalInfo"` - // Code - Unique code for this error - Code *string `json:"code,omitempty"` - // EmbeddedInnerError - Child Inner Error, to allow Nesting. - EmbeddedInnerError *InnerError `json:"embeddedInnerError,omitempty"` -} - -// MarshalJSON is the custom marshaler for InnerError. -func (ie InnerError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ie.AdditionalInfo != nil { - objectMap["additionalInfo"] = ie.AdditionalInfo - } - if ie.Code != nil { - objectMap["code"] = ie.Code - } - if ie.EmbeddedInnerError != nil { - objectMap["embeddedInnerError"] = ie.EmbeddedInnerError - } - return json.Marshal(objectMap) -} - -// BasicItemLevelRestoreCriteria class to contain criteria for item level restore -type BasicItemLevelRestoreCriteria interface { - AsRangeBasedItemLevelRestoreCriteria() (*RangeBasedItemLevelRestoreCriteria, bool) - AsItemLevelRestoreCriteria() (*ItemLevelRestoreCriteria, bool) -} - -// ItemLevelRestoreCriteria class to contain criteria for item level restore -type ItemLevelRestoreCriteria struct { - // ObjectType - Possible values include: 'ObjectTypeBasicItemLevelRestoreCriteriaObjectTypeItemLevelRestoreCriteria', 'ObjectTypeBasicItemLevelRestoreCriteriaObjectTypeRangeBasedItemLevelRestoreCriteria' - ObjectType ObjectTypeBasicItemLevelRestoreCriteria `json:"objectType,omitempty"` -} - -func unmarshalBasicItemLevelRestoreCriteria(body []byte) (BasicItemLevelRestoreCriteria, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicItemLevelRestoreCriteriaObjectTypeRangeBasedItemLevelRestoreCriteria): - var rbilrc RangeBasedItemLevelRestoreCriteria - err := json.Unmarshal(body, &rbilrc) - return rbilrc, err - default: - var ilrc ItemLevelRestoreCriteria - err := json.Unmarshal(body, &ilrc) - return ilrc, err - } -} - -func unmarshalBasicItemLevelRestoreCriteriaArray(body []byte) ([]BasicItemLevelRestoreCriteria, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - ilrcArray := make([]BasicItemLevelRestoreCriteria, len(rawMessages)) - - for index, rawMessage := range rawMessages { - ilrc, err := unmarshalBasicItemLevelRestoreCriteria(*rawMessage) - if err != nil { - return nil, err - } - ilrcArray[index] = ilrc - } - return ilrcArray, nil -} - -// MarshalJSON is the custom marshaler for ItemLevelRestoreCriteria. -func (ilrc ItemLevelRestoreCriteria) MarshalJSON() ([]byte, error) { - ilrc.ObjectType = ObjectTypeBasicItemLevelRestoreCriteriaObjectTypeItemLevelRestoreCriteria - objectMap := make(map[string]interface{}) - if ilrc.ObjectType != "" { - objectMap["objectType"] = ilrc.ObjectType - } - return json.Marshal(objectMap) -} - -// AsRangeBasedItemLevelRestoreCriteria is the BasicItemLevelRestoreCriteria implementation for ItemLevelRestoreCriteria. -func (ilrc ItemLevelRestoreCriteria) AsRangeBasedItemLevelRestoreCriteria() (*RangeBasedItemLevelRestoreCriteria, bool) { - return nil, false -} - -// AsItemLevelRestoreCriteria is the BasicItemLevelRestoreCriteria implementation for ItemLevelRestoreCriteria. -func (ilrc ItemLevelRestoreCriteria) AsItemLevelRestoreCriteria() (*ItemLevelRestoreCriteria, bool) { - return &ilrc, true -} - -// AsBasicItemLevelRestoreCriteria is the BasicItemLevelRestoreCriteria implementation for ItemLevelRestoreCriteria. -func (ilrc ItemLevelRestoreCriteria) AsBasicItemLevelRestoreCriteria() (BasicItemLevelRestoreCriteria, bool) { - return &ilrc, true -} - -// ItemLevelRestoreTargetInfo restore target info for Item level restore operation -type ItemLevelRestoreTargetInfo struct { - // RestoreCriteria - Restore Criteria - RestoreCriteria *[]BasicItemLevelRestoreCriteria `json:"restoreCriteria,omitempty"` - // DatasourceInfo - Information of target DS - DatasourceInfo *Datasource `json:"datasourceInfo,omitempty"` - // DatasourceSetInfo - Information of target DS Set - DatasourceSetInfo *DatasourceSet `json:"datasourceSetInfo,omitempty"` - // DatasourceAuthCredentials - Credentials to use to authenticate with data source provider. - DatasourceAuthCredentials BasicAuthCredentials `json:"datasourceAuthCredentials,omitempty"` - // RecoveryOption - Recovery Option - RecoveryOption *string `json:"recoveryOption,omitempty"` - // RestoreLocation - Target Restore region - RestoreLocation *string `json:"restoreLocation,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfoBase', 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeItemLevelRestoreTargetInfo', 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreFilesTargetInfo', 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfo' - ObjectType ObjectTypeBasicRestoreTargetInfoBase `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ItemLevelRestoreTargetInfo. -func (ilrti ItemLevelRestoreTargetInfo) MarshalJSON() ([]byte, error) { - ilrti.ObjectType = ObjectTypeBasicRestoreTargetInfoBaseObjectTypeItemLevelRestoreTargetInfo - objectMap := make(map[string]interface{}) - if ilrti.RestoreCriteria != nil { - objectMap["restoreCriteria"] = ilrti.RestoreCriteria - } - if ilrti.DatasourceInfo != nil { - objectMap["datasourceInfo"] = ilrti.DatasourceInfo - } - if ilrti.DatasourceSetInfo != nil { - objectMap["datasourceSetInfo"] = ilrti.DatasourceSetInfo - } - objectMap["datasourceAuthCredentials"] = ilrti.DatasourceAuthCredentials - if ilrti.RecoveryOption != nil { - objectMap["recoveryOption"] = ilrti.RecoveryOption - } - if ilrti.RestoreLocation != nil { - objectMap["restoreLocation"] = ilrti.RestoreLocation - } - if ilrti.ObjectType != "" { - objectMap["objectType"] = ilrti.ObjectType - } - return json.Marshal(objectMap) -} - -// AsItemLevelRestoreTargetInfo is the BasicRestoreTargetInfoBase implementation for ItemLevelRestoreTargetInfo. -func (ilrti ItemLevelRestoreTargetInfo) AsItemLevelRestoreTargetInfo() (*ItemLevelRestoreTargetInfo, bool) { - return &ilrti, true -} - -// AsRestoreFilesTargetInfo is the BasicRestoreTargetInfoBase implementation for ItemLevelRestoreTargetInfo. -func (ilrti ItemLevelRestoreTargetInfo) AsRestoreFilesTargetInfo() (*RestoreFilesTargetInfo, bool) { - return nil, false -} - -// AsRestoreTargetInfo is the BasicRestoreTargetInfoBase implementation for ItemLevelRestoreTargetInfo. -func (ilrti ItemLevelRestoreTargetInfo) AsRestoreTargetInfo() (*RestoreTargetInfo, bool) { - return nil, false -} - -// AsRestoreTargetInfoBase is the BasicRestoreTargetInfoBase implementation for ItemLevelRestoreTargetInfo. -func (ilrti ItemLevelRestoreTargetInfo) AsRestoreTargetInfoBase() (*RestoreTargetInfoBase, bool) { - return nil, false -} - -// AsBasicRestoreTargetInfoBase is the BasicRestoreTargetInfoBase implementation for ItemLevelRestoreTargetInfo. -func (ilrti ItemLevelRestoreTargetInfo) AsBasicRestoreTargetInfoBase() (BasicRestoreTargetInfoBase, bool) { - return &ilrti, true -} - -// UnmarshalJSON is the custom unmarshaler for ItemLevelRestoreTargetInfo struct. -func (ilrti *ItemLevelRestoreTargetInfo) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "restoreCriteria": - if v != nil { - restoreCriteria, err := unmarshalBasicItemLevelRestoreCriteriaArray(*v) - if err != nil { - return err - } - ilrti.RestoreCriteria = &restoreCriteria - } - case "datasourceInfo": - if v != nil { - var datasourceInfo Datasource - err = json.Unmarshal(*v, &datasourceInfo) - if err != nil { - return err - } - ilrti.DatasourceInfo = &datasourceInfo - } - case "datasourceSetInfo": - if v != nil { - var datasourceSetInfo DatasourceSet - err = json.Unmarshal(*v, &datasourceSetInfo) - if err != nil { - return err - } - ilrti.DatasourceSetInfo = &datasourceSetInfo - } - case "datasourceAuthCredentials": - if v != nil { - datasourceAuthCredentials, err := unmarshalBasicAuthCredentials(*v) - if err != nil { - return err - } - ilrti.DatasourceAuthCredentials = datasourceAuthCredentials - } - case "recoveryOption": - if v != nil { - var recoveryOption string - err = json.Unmarshal(*v, &recoveryOption) - if err != nil { - return err - } - ilrti.RecoveryOption = &recoveryOption - } - case "restoreLocation": - if v != nil { - var restoreLocation string - err = json.Unmarshal(*v, &restoreLocation) - if err != nil { - return err - } - ilrti.RestoreLocation = &restoreLocation - } - case "objectType": - if v != nil { - var objectType ObjectTypeBasicRestoreTargetInfoBase - err = json.Unmarshal(*v, &objectType) - if err != nil { - return err - } - ilrti.ObjectType = objectType - } - } - } - - return nil -} - -// JobExtendedInfo extended Information about the job -type JobExtendedInfo struct { - // AdditionalDetails - Job's Additional Details - AdditionalDetails map[string]*string `json:"additionalDetails"` - // BackupInstanceState - READ-ONLY; State of the Backup Instance - BackupInstanceState *string `json:"backupInstanceState,omitempty"` - // DataTransferredInBytes - READ-ONLY; Number of bytes transferred - DataTransferredInBytes *float64 `json:"dataTransferredInBytes,omitempty"` - // RecoveryDestination - READ-ONLY; Destination where restore is done - RecoveryDestination *string `json:"recoveryDestination,omitempty"` - // SourceRecoverPoint - READ-ONLY; Details of the Source Recovery Point - SourceRecoverPoint *RestoreJobRecoveryPointDetails `json:"sourceRecoverPoint,omitempty"` - // SubTasks - READ-ONLY; List of Sub Tasks of the job - SubTasks *[]JobSubTask `json:"subTasks,omitempty"` - // TargetRecoverPoint - READ-ONLY; Details of the Target Recovery Point - TargetRecoverPoint *RestoreJobRecoveryPointDetails `json:"targetRecoverPoint,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobExtendedInfo. -func (jei JobExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jei.AdditionalDetails != nil { - objectMap["additionalDetails"] = jei.AdditionalDetails - } - return json.Marshal(objectMap) -} - -// JobSubTask details of Job's Sub Task -type JobSubTask struct { - // AdditionalDetails - Additional details of Sub Tasks - AdditionalDetails map[string]*string `json:"additionalDetails"` - // TaskID - Task Id of the Sub Task - TaskID *int32 `json:"taskId,omitempty"` - // TaskName - Name of the Sub Task - TaskName *string `json:"taskName,omitempty"` - // TaskProgress - READ-ONLY; Progress of the Sub Task - TaskProgress *string `json:"taskProgress,omitempty"` - // TaskStatus - Status of the Sub Task - TaskStatus *string `json:"taskStatus,omitempty"` -} - -// MarshalJSON is the custom marshaler for JobSubTask. -func (jst JobSubTask) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if jst.AdditionalDetails != nil { - objectMap["additionalDetails"] = jst.AdditionalDetails - } - if jst.TaskID != nil { - objectMap["taskId"] = jst.TaskID - } - if jst.TaskName != nil { - objectMap["taskName"] = jst.TaskName - } - if jst.TaskStatus != nil { - objectMap["taskStatus"] = jst.TaskStatus - } - return json.Marshal(objectMap) -} - -// BasicOperationExtendedInfo operation Extended Info -type BasicOperationExtendedInfo interface { - AsOperationJobExtendedInfo() (*OperationJobExtendedInfo, bool) - AsOperationExtendedInfo() (*OperationExtendedInfo, bool) -} - -// OperationExtendedInfo operation Extended Info -type OperationExtendedInfo struct { - // ObjectType - Possible values include: 'ObjectTypeBasicOperationExtendedInfoObjectTypeOperationExtendedInfo', 'ObjectTypeBasicOperationExtendedInfoObjectTypeOperationJobExtendedInfo' - ObjectType ObjectTypeBasicOperationExtendedInfo `json:"objectType,omitempty"` -} - -func unmarshalBasicOperationExtendedInfo(body []byte) (BasicOperationExtendedInfo, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicOperationExtendedInfoObjectTypeOperationJobExtendedInfo): - var ojei OperationJobExtendedInfo - err := json.Unmarshal(body, &ojei) - return ojei, err - default: - var oei OperationExtendedInfo - err := json.Unmarshal(body, &oei) - return oei, err - } -} - -func unmarshalBasicOperationExtendedInfoArray(body []byte) ([]BasicOperationExtendedInfo, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - oeiArray := make([]BasicOperationExtendedInfo, len(rawMessages)) - - for index, rawMessage := range rawMessages { - oei, err := unmarshalBasicOperationExtendedInfo(*rawMessage) - if err != nil { - return nil, err - } - oeiArray[index] = oei - } - return oeiArray, nil -} - -// MarshalJSON is the custom marshaler for OperationExtendedInfo. -func (oei OperationExtendedInfo) MarshalJSON() ([]byte, error) { - oei.ObjectType = ObjectTypeBasicOperationExtendedInfoObjectTypeOperationExtendedInfo - objectMap := make(map[string]interface{}) - if oei.ObjectType != "" { - objectMap["objectType"] = oei.ObjectType - } - return json.Marshal(objectMap) -} - -// AsOperationJobExtendedInfo is the BasicOperationExtendedInfo implementation for OperationExtendedInfo. -func (oei OperationExtendedInfo) AsOperationJobExtendedInfo() (*OperationJobExtendedInfo, bool) { - return nil, false -} - -// AsOperationExtendedInfo is the BasicOperationExtendedInfo implementation for OperationExtendedInfo. -func (oei OperationExtendedInfo) AsOperationExtendedInfo() (*OperationExtendedInfo, bool) { - return &oei, true -} - -// AsBasicOperationExtendedInfo is the BasicOperationExtendedInfo implementation for OperationExtendedInfo. -func (oei OperationExtendedInfo) AsBasicOperationExtendedInfo() (BasicOperationExtendedInfo, bool) { - return &oei, true -} - -// OperationJobExtendedInfo operation Job Extended Info -type OperationJobExtendedInfo struct { - autorest.Response `json:"-"` - // JobID - Arm Id of the job created for this operation. - JobID *string `json:"jobId,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicOperationExtendedInfoObjectTypeOperationExtendedInfo', 'ObjectTypeBasicOperationExtendedInfoObjectTypeOperationJobExtendedInfo' - ObjectType ObjectTypeBasicOperationExtendedInfo `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationJobExtendedInfo. -func (ojei OperationJobExtendedInfo) MarshalJSON() ([]byte, error) { - ojei.ObjectType = ObjectTypeBasicOperationExtendedInfoObjectTypeOperationJobExtendedInfo - objectMap := make(map[string]interface{}) - if ojei.JobID != nil { - objectMap["jobId"] = ojei.JobID - } - if ojei.ObjectType != "" { - objectMap["objectType"] = ojei.ObjectType - } - return json.Marshal(objectMap) -} - -// AsOperationJobExtendedInfo is the BasicOperationExtendedInfo implementation for OperationJobExtendedInfo. -func (ojei OperationJobExtendedInfo) AsOperationJobExtendedInfo() (*OperationJobExtendedInfo, bool) { - return &ojei, true -} - -// AsOperationExtendedInfo is the BasicOperationExtendedInfo implementation for OperationJobExtendedInfo. -func (ojei OperationJobExtendedInfo) AsOperationExtendedInfo() (*OperationExtendedInfo, bool) { - return nil, false -} - -// AsBasicOperationExtendedInfo is the BasicOperationExtendedInfo implementation for OperationJobExtendedInfo. -func (ojei OperationJobExtendedInfo) AsBasicOperationExtendedInfo() (BasicOperationExtendedInfo, bool) { - return &ojei, true -} - -// OperationResource operation Resource -type OperationResource struct { - autorest.Response `json:"-"` - // EndTime - End time of the operation - EndTime *date.Time `json:"endTime,omitempty"` - // Error - Required if status == failed or status == canceled. This is the OData v4 error format, used by the RPC and will go into the v2.2 Azure REST API guidelines. - // The full set of optional properties (e.g. inner errors / details) can be found in the "Error Response" section. - Error *Error `json:"error,omitempty"` - // ID - It should match what is used to GET the operation result - ID *string `json:"id,omitempty"` - // Name - It must match the last segment of the "id" field, and will typically be a GUID / system generated value - Name *string `json:"name,omitempty"` - // Properties - End time of the operation - Properties BasicOperationExtendedInfo `json:"properties,omitempty"` - // StartTime - Start time of the operation - StartTime *date.Time `json:"startTime,omitempty"` - Status *string `json:"status,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for OperationResource struct. -func (or *OperationResource) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "endTime": - if v != nil { - var endTime date.Time - err = json.Unmarshal(*v, &endTime) - if err != nil { - return err - } - or.EndTime = &endTime - } - case "error": - if v != nil { - var errorVar Error - err = json.Unmarshal(*v, &errorVar) - if err != nil { - return err - } - or.Error = &errorVar - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - or.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - or.Name = &name - } - case "properties": - if v != nil { - properties, err := unmarshalBasicOperationExtendedInfo(*v) - if err != nil { - return err - } - or.Properties = properties - } - case "startTime": - if v != nil { - var startTime date.Time - err = json.Unmarshal(*v, &startTime) - if err != nil { - return err - } - or.StartTime = &startTime - } - case "status": - if v != nil { - var status string - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - or.Status = &status - } - } - } - - return nil -} - -// PatchResourceRequestInput patch Request content for Microsoft.DataProtection resources -type PatchResourceRequestInput struct { - // Identity - Input Managed Identity Details - Identity *DppIdentityDetails `json:"identity,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for PatchResourceRequestInput. -func (prri PatchResourceRequestInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if prri.Identity != nil { - objectMap["identity"] = prri.Identity - } - if prri.Tags != nil { - objectMap["tags"] = prri.Tags - } - return json.Marshal(objectMap) -} - -// PolicyInfo policy Info in backupInstance -type PolicyInfo struct { - PolicyID *string `json:"policyId,omitempty"` - // PolicyVersion - READ-ONLY - PolicyVersion *string `json:"policyVersion,omitempty"` - // PolicyParameters - Policy parameters for the backup instance - PolicyParameters *PolicyParameters `json:"policyParameters,omitempty"` -} - -// MarshalJSON is the custom marshaler for PolicyInfo. -func (pi PolicyInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pi.PolicyID != nil { - objectMap["policyId"] = pi.PolicyID - } - if pi.PolicyParameters != nil { - objectMap["policyParameters"] = pi.PolicyParameters - } - return json.Marshal(objectMap) -} - -// PolicyParameters parameters in Policy -type PolicyParameters struct { - // DataStoreParametersList - Gets or sets the DataStore Parameters - DataStoreParametersList *[]BasicDataStoreParameters `json:"dataStoreParametersList,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for PolicyParameters struct. -func (pp *PolicyParameters) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "dataStoreParametersList": - if v != nil { - dataStoreParametersList, err := unmarshalBasicDataStoreParametersArray(*v) - if err != nil { - return err - } - pp.DataStoreParametersList = &dataStoreParametersList - } - } - } - - return nil -} - -// ProtectionStatusDetails protection status details -type ProtectionStatusDetails struct { - // ErrorDetails - Specifies the protection status error of the resource - ErrorDetails *UserFacingError `json:"errorDetails,omitempty"` - // Status - Specifies the protection status of the resource. Possible values include: 'StatusConfiguringProtection', 'StatusConfiguringProtectionFailed', 'StatusProtectionConfigured', 'StatusProtectionStopped', 'StatusSoftDeleted', 'StatusSoftDeleting' - Status Status `json:"status,omitempty"` -} - -// RangeBasedItemLevelRestoreCriteria item Level target info for restore operation -type RangeBasedItemLevelRestoreCriteria struct { - // MinMatchingValue - minimum value for range prefix match - MinMatchingValue *string `json:"minMatchingValue,omitempty"` - // MaxMatchingValue - maximum value for range prefix match - MaxMatchingValue *string `json:"maxMatchingValue,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicItemLevelRestoreCriteriaObjectTypeItemLevelRestoreCriteria', 'ObjectTypeBasicItemLevelRestoreCriteriaObjectTypeRangeBasedItemLevelRestoreCriteria' - ObjectType ObjectTypeBasicItemLevelRestoreCriteria `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for RangeBasedItemLevelRestoreCriteria. -func (rbilrc RangeBasedItemLevelRestoreCriteria) MarshalJSON() ([]byte, error) { - rbilrc.ObjectType = ObjectTypeBasicItemLevelRestoreCriteriaObjectTypeRangeBasedItemLevelRestoreCriteria - objectMap := make(map[string]interface{}) - if rbilrc.MinMatchingValue != nil { - objectMap["minMatchingValue"] = rbilrc.MinMatchingValue - } - if rbilrc.MaxMatchingValue != nil { - objectMap["maxMatchingValue"] = rbilrc.MaxMatchingValue - } - if rbilrc.ObjectType != "" { - objectMap["objectType"] = rbilrc.ObjectType - } - return json.Marshal(objectMap) -} - -// AsRangeBasedItemLevelRestoreCriteria is the BasicItemLevelRestoreCriteria implementation for RangeBasedItemLevelRestoreCriteria. -func (rbilrc RangeBasedItemLevelRestoreCriteria) AsRangeBasedItemLevelRestoreCriteria() (*RangeBasedItemLevelRestoreCriteria, bool) { - return &rbilrc, true -} - -// AsItemLevelRestoreCriteria is the BasicItemLevelRestoreCriteria implementation for RangeBasedItemLevelRestoreCriteria. -func (rbilrc RangeBasedItemLevelRestoreCriteria) AsItemLevelRestoreCriteria() (*ItemLevelRestoreCriteria, bool) { - return nil, false -} - -// AsBasicItemLevelRestoreCriteria is the BasicItemLevelRestoreCriteria implementation for RangeBasedItemLevelRestoreCriteria. -func (rbilrc RangeBasedItemLevelRestoreCriteria) AsBasicItemLevelRestoreCriteria() (BasicItemLevelRestoreCriteria, bool) { - return &rbilrc, true -} - -// RecoveryPointDataStoreDetails recoveryPoint datastore details -type RecoveryPointDataStoreDetails struct { - CreationTime *date.Time `json:"creationTime,omitempty"` - ExpiryTime *date.Time `json:"expiryTime,omitempty"` - ID *string `json:"id,omitempty"` - MetaData *string `json:"metaData,omitempty"` - State *string `json:"state,omitempty"` - Type *string `json:"type,omitempty"` - Visible *bool `json:"visible,omitempty"` - // RehydrationExpiryTime - READ-ONLY - RehydrationExpiryTime *date.Time `json:"rehydrationExpiryTime,omitempty"` - // RehydrationStatus - READ-ONLY; Possible values include: 'RehydrationStatusCREATEINPROGRESS', 'RehydrationStatusCOMPLETED', 'RehydrationStatusDELETEINPROGRESS', 'RehydrationStatusDELETED', 'RehydrationStatusFAILED' - RehydrationStatus RehydrationStatus `json:"rehydrationStatus,omitempty"` -} - -// MarshalJSON is the custom marshaler for RecoveryPointDataStoreDetails. -func (rpdsd RecoveryPointDataStoreDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rpdsd.CreationTime != nil { - objectMap["creationTime"] = rpdsd.CreationTime - } - if rpdsd.ExpiryTime != nil { - objectMap["expiryTime"] = rpdsd.ExpiryTime - } - if rpdsd.ID != nil { - objectMap["id"] = rpdsd.ID - } - if rpdsd.MetaData != nil { - objectMap["metaData"] = rpdsd.MetaData - } - if rpdsd.State != nil { - objectMap["state"] = rpdsd.State - } - if rpdsd.Type != nil { - objectMap["type"] = rpdsd.Type - } - if rpdsd.Visible != nil { - objectMap["visible"] = rpdsd.Visible - } - return json.Marshal(objectMap) -} - -// RecoveryPointsFilters ... -type RecoveryPointsFilters struct { - RestorePointDataStoreID *string `json:"restorePointDataStoreId,omitempty"` - IsVisible *bool `json:"isVisible,omitempty"` - StartDate *string `json:"startDate,omitempty"` - EndDate *string `json:"endDate,omitempty"` - ExtendedInfo *bool `json:"extendedInfo,omitempty"` - RestorePointState *string `json:"restorePointState,omitempty"` -} - -// ResourceGuard ... -type ResourceGuard struct { - // ProvisioningState - READ-ONLY; Provisioning state of the BackupVault resource. Possible values include: 'ProvisioningStateFailed', 'ProvisioningStateProvisioning', 'ProvisioningStateSucceeded', 'ProvisioningStateUnknown', 'ProvisioningStateUpdating' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // AllowAutoApprovals - READ-ONLY; This flag indicates whether auto approval is allowed or not. - AllowAutoApprovals *bool `json:"allowAutoApprovals,omitempty"` - // ResourceGuardOperations - READ-ONLY; {readonly} List of operation details those are protected by the ResourceGuard resource - ResourceGuardOperations *[]ResourceGuardOperation `json:"resourceGuardOperations,omitempty"` - // VaultCriticalOperationExclusionList - READ-ONLY; List of critical operations which are not protected by this resourceGuard - VaultCriticalOperationExclusionList *[]string `json:"vaultCriticalOperationExclusionList,omitempty"` - // Description - READ-ONLY; Description about the pre-req steps to perform all the critical operations. - Description *string `json:"description,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceGuard. -func (rg ResourceGuard) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceGuardOperation this class contains all the details about a critical operation. -type ResourceGuardOperation struct { - // VaultCriticalOperation - READ-ONLY; Name of the critical operation. - VaultCriticalOperation *string `json:"vaultCriticalOperation,omitempty"` - // RequestResourceType - READ-ONLY; Type of resource request. - RequestResourceType *string `json:"requestResourceType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceGuardOperation. -func (rgo ResourceGuardOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceGuardResource ... -type ResourceGuardResource struct { - autorest.Response `json:"-"` - // Properties - ResourceGuardResource properties - Properties *ResourceGuard `json:"properties,omitempty"` - // ETag - Optional ETag. - ETag *string `json:"eTag,omitempty"` - // ID - READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty"` - // Identity - Input Managed Identity Details - Identity *DppIdentityDetails `json:"identity,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Name - READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Type - READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... - Type *string `json:"type,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceGuardResource. -func (rgr ResourceGuardResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rgr.Properties != nil { - objectMap["properties"] = rgr.Properties - } - if rgr.ETag != nil { - objectMap["eTag"] = rgr.ETag - } - if rgr.Identity != nil { - objectMap["identity"] = rgr.Identity - } - if rgr.Location != nil { - objectMap["location"] = rgr.Location - } - if rgr.Tags != nil { - objectMap["tags"] = rgr.Tags - } - if rgr.SystemData != nil { - objectMap["systemData"] = rgr.SystemData - } - return json.Marshal(objectMap) -} - -// ResourceGuardResourceList list of ResourceGuard resources -type ResourceGuardResourceList struct { - autorest.Response `json:"-"` - // Value - List of resources. - Value *[]ResourceGuardResource `json:"value,omitempty"` - // NextLink - The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// ResourceGuardResourceListIterator provides access to a complete listing of ResourceGuardResource values. -type ResourceGuardResourceListIterator struct { - i int - page ResourceGuardResourceListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ResourceGuardResourceListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardResourceListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ResourceGuardResourceListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ResourceGuardResourceListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ResourceGuardResourceListIterator) Response() ResourceGuardResourceList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ResourceGuardResourceListIterator) Value() ResourceGuardResource { - if !iter.page.NotDone() { - return ResourceGuardResource{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ResourceGuardResourceListIterator type. -func NewResourceGuardResourceListIterator(page ResourceGuardResourceListPage) ResourceGuardResourceListIterator { - return ResourceGuardResourceListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rgrl ResourceGuardResourceList) IsEmpty() bool { - return rgrl.Value == nil || len(*rgrl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (rgrl ResourceGuardResourceList) hasNextLink() bool { - return rgrl.NextLink != nil && len(*rgrl.NextLink) != 0 -} - -// resourceGuardResourceListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rgrl ResourceGuardResourceList) resourceGuardResourceListPreparer(ctx context.Context) (*http.Request, error) { - if !rgrl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rgrl.NextLink))) -} - -// ResourceGuardResourceListPage contains a page of ResourceGuardResource values. -type ResourceGuardResourceListPage struct { - fn func(context.Context, ResourceGuardResourceList) (ResourceGuardResourceList, error) - rgrl ResourceGuardResourceList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ResourceGuardResourceListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardResourceListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.rgrl) - if err != nil { - return err - } - page.rgrl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ResourceGuardResourceListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ResourceGuardResourceListPage) NotDone() bool { - return !page.rgrl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ResourceGuardResourceListPage) Response() ResourceGuardResourceList { - return page.rgrl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ResourceGuardResourceListPage) Values() []ResourceGuardResource { - if page.rgrl.IsEmpty() { - return nil - } - return *page.rgrl.Value -} - -// Creates a new instance of the ResourceGuardResourceListPage type. -func NewResourceGuardResourceListPage(cur ResourceGuardResourceList, getNextPage func(context.Context, ResourceGuardResourceList) (ResourceGuardResourceList, error)) ResourceGuardResourceListPage { - return ResourceGuardResourceListPage{ - fn: getNextPage, - rgrl: cur, - } -} - -// ResourceMoveDetails resourceMoveDetails will be returned in response to GetResource call from ARM -type ResourceMoveDetails struct { - // OperationID - CorrelationId of latest ResourceMove operation attempted - OperationID *string `json:"operationId,omitempty"` - // StartTimeUtc - Start time in UTC of latest ResourceMove operation attempted. ISO 8601 format. - StartTimeUtc *string `json:"startTimeUtc,omitempty"` - // CompletionTimeUtc - Completion time in UTC of latest ResourceMove operation attempted. ISO 8601 format. - CompletionTimeUtc *string `json:"completionTimeUtc,omitempty"` - // SourceResourcePath - ARM resource path of source resource - SourceResourcePath *string `json:"sourceResourcePath,omitempty"` - // TargetResourcePath - ARM resource path of target resource used in latest ResourceMove operation - TargetResourcePath *string `json:"targetResourcePath,omitempty"` -} - -// RestorableTimeRange ... -type RestorableTimeRange struct { - // StartTime - Start time for the available restore range - StartTime *string `json:"startTime,omitempty"` - // EndTime - End time for the available restore range - EndTime *string `json:"endTime,omitempty"` - ObjectType *string `json:"objectType,omitempty"` -} - -// RestoreFilesTargetInfo class encapsulating restore as files target parameters -type RestoreFilesTargetInfo struct { - // TargetDetails - Destination of RestoreAsFiles operation, when destination is not a datasource - TargetDetails *TargetDetails `json:"targetDetails,omitempty"` - // RecoveryOption - Recovery Option - RecoveryOption *string `json:"recoveryOption,omitempty"` - // RestoreLocation - Target Restore region - RestoreLocation *string `json:"restoreLocation,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfoBase', 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeItemLevelRestoreTargetInfo', 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreFilesTargetInfo', 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfo' - ObjectType ObjectTypeBasicRestoreTargetInfoBase `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestoreFilesTargetInfo. -func (rfti RestoreFilesTargetInfo) MarshalJSON() ([]byte, error) { - rfti.ObjectType = ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreFilesTargetInfo - objectMap := make(map[string]interface{}) - if rfti.TargetDetails != nil { - objectMap["targetDetails"] = rfti.TargetDetails - } - if rfti.RecoveryOption != nil { - objectMap["recoveryOption"] = rfti.RecoveryOption - } - if rfti.RestoreLocation != nil { - objectMap["restoreLocation"] = rfti.RestoreLocation - } - if rfti.ObjectType != "" { - objectMap["objectType"] = rfti.ObjectType - } - return json.Marshal(objectMap) -} - -// AsItemLevelRestoreTargetInfo is the BasicRestoreTargetInfoBase implementation for RestoreFilesTargetInfo. -func (rfti RestoreFilesTargetInfo) AsItemLevelRestoreTargetInfo() (*ItemLevelRestoreTargetInfo, bool) { - return nil, false -} - -// AsRestoreFilesTargetInfo is the BasicRestoreTargetInfoBase implementation for RestoreFilesTargetInfo. -func (rfti RestoreFilesTargetInfo) AsRestoreFilesTargetInfo() (*RestoreFilesTargetInfo, bool) { - return &rfti, true -} - -// AsRestoreTargetInfo is the BasicRestoreTargetInfoBase implementation for RestoreFilesTargetInfo. -func (rfti RestoreFilesTargetInfo) AsRestoreTargetInfo() (*RestoreTargetInfo, bool) { - return nil, false -} - -// AsRestoreTargetInfoBase is the BasicRestoreTargetInfoBase implementation for RestoreFilesTargetInfo. -func (rfti RestoreFilesTargetInfo) AsRestoreTargetInfoBase() (*RestoreTargetInfoBase, bool) { - return nil, false -} - -// AsBasicRestoreTargetInfoBase is the BasicRestoreTargetInfoBase implementation for RestoreFilesTargetInfo. -func (rfti RestoreFilesTargetInfo) AsBasicRestoreTargetInfoBase() (BasicRestoreTargetInfoBase, bool) { - return &rfti, true -} - -// RestoreJobRecoveryPointDetails ... -type RestoreJobRecoveryPointDetails struct { - RecoveryPointID *string `json:"recoveryPointID,omitempty"` - RecoveryPointTime *date.Time `json:"recoveryPointTime,omitempty"` -} - -// RestoreTargetInfo class encapsulating restore target parameters -type RestoreTargetInfo struct { - // DatasourceInfo - Information of target DS - DatasourceInfo *Datasource `json:"datasourceInfo,omitempty"` - // DatasourceSetInfo - Information of target DS Set - DatasourceSetInfo *DatasourceSet `json:"datasourceSetInfo,omitempty"` - // DatasourceAuthCredentials - Credentials to use to authenticate with data source provider. - DatasourceAuthCredentials BasicAuthCredentials `json:"datasourceAuthCredentials,omitempty"` - // RecoveryOption - Recovery Option - RecoveryOption *string `json:"recoveryOption,omitempty"` - // RestoreLocation - Target Restore region - RestoreLocation *string `json:"restoreLocation,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfoBase', 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeItemLevelRestoreTargetInfo', 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreFilesTargetInfo', 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfo' - ObjectType ObjectTypeBasicRestoreTargetInfoBase `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestoreTargetInfo. -func (rti RestoreTargetInfo) MarshalJSON() ([]byte, error) { - rti.ObjectType = ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfo - objectMap := make(map[string]interface{}) - if rti.DatasourceInfo != nil { - objectMap["datasourceInfo"] = rti.DatasourceInfo - } - if rti.DatasourceSetInfo != nil { - objectMap["datasourceSetInfo"] = rti.DatasourceSetInfo - } - objectMap["datasourceAuthCredentials"] = rti.DatasourceAuthCredentials - if rti.RecoveryOption != nil { - objectMap["recoveryOption"] = rti.RecoveryOption - } - if rti.RestoreLocation != nil { - objectMap["restoreLocation"] = rti.RestoreLocation - } - if rti.ObjectType != "" { - objectMap["objectType"] = rti.ObjectType - } - return json.Marshal(objectMap) -} - -// AsItemLevelRestoreTargetInfo is the BasicRestoreTargetInfoBase implementation for RestoreTargetInfo. -func (rti RestoreTargetInfo) AsItemLevelRestoreTargetInfo() (*ItemLevelRestoreTargetInfo, bool) { - return nil, false -} - -// AsRestoreFilesTargetInfo is the BasicRestoreTargetInfoBase implementation for RestoreTargetInfo. -func (rti RestoreTargetInfo) AsRestoreFilesTargetInfo() (*RestoreFilesTargetInfo, bool) { - return nil, false -} - -// AsRestoreTargetInfo is the BasicRestoreTargetInfoBase implementation for RestoreTargetInfo. -func (rti RestoreTargetInfo) AsRestoreTargetInfo() (*RestoreTargetInfo, bool) { - return &rti, true -} - -// AsRestoreTargetInfoBase is the BasicRestoreTargetInfoBase implementation for RestoreTargetInfo. -func (rti RestoreTargetInfo) AsRestoreTargetInfoBase() (*RestoreTargetInfoBase, bool) { - return nil, false -} - -// AsBasicRestoreTargetInfoBase is the BasicRestoreTargetInfoBase implementation for RestoreTargetInfo. -func (rti RestoreTargetInfo) AsBasicRestoreTargetInfoBase() (BasicRestoreTargetInfoBase, bool) { - return &rti, true -} - -// UnmarshalJSON is the custom unmarshaler for RestoreTargetInfo struct. -func (rti *RestoreTargetInfo) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "datasourceInfo": - if v != nil { - var datasourceInfo Datasource - err = json.Unmarshal(*v, &datasourceInfo) - if err != nil { - return err - } - rti.DatasourceInfo = &datasourceInfo - } - case "datasourceSetInfo": - if v != nil { - var datasourceSetInfo DatasourceSet - err = json.Unmarshal(*v, &datasourceSetInfo) - if err != nil { - return err - } - rti.DatasourceSetInfo = &datasourceSetInfo - } - case "datasourceAuthCredentials": - if v != nil { - datasourceAuthCredentials, err := unmarshalBasicAuthCredentials(*v) - if err != nil { - return err - } - rti.DatasourceAuthCredentials = datasourceAuthCredentials - } - case "recoveryOption": - if v != nil { - var recoveryOption string - err = json.Unmarshal(*v, &recoveryOption) - if err != nil { - return err - } - rti.RecoveryOption = &recoveryOption - } - case "restoreLocation": - if v != nil { - var restoreLocation string - err = json.Unmarshal(*v, &restoreLocation) - if err != nil { - return err - } - rti.RestoreLocation = &restoreLocation - } - case "objectType": - if v != nil { - var objectType ObjectTypeBasicRestoreTargetInfoBase - err = json.Unmarshal(*v, &objectType) - if err != nil { - return err - } - rti.ObjectType = objectType - } - } - } - - return nil -} - -// BasicRestoreTargetInfoBase base class common to RestoreTargetInfo and RestoreFilesTargetInfo -type BasicRestoreTargetInfoBase interface { - AsItemLevelRestoreTargetInfo() (*ItemLevelRestoreTargetInfo, bool) - AsRestoreFilesTargetInfo() (*RestoreFilesTargetInfo, bool) - AsRestoreTargetInfo() (*RestoreTargetInfo, bool) - AsRestoreTargetInfoBase() (*RestoreTargetInfoBase, bool) -} - -// RestoreTargetInfoBase base class common to RestoreTargetInfo and RestoreFilesTargetInfo -type RestoreTargetInfoBase struct { - // RecoveryOption - Recovery Option - RecoveryOption *string `json:"recoveryOption,omitempty"` - // RestoreLocation - Target Restore region - RestoreLocation *string `json:"restoreLocation,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfoBase', 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeItemLevelRestoreTargetInfo', 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreFilesTargetInfo', 'ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfo' - ObjectType ObjectTypeBasicRestoreTargetInfoBase `json:"objectType,omitempty"` -} - -func unmarshalBasicRestoreTargetInfoBase(body []byte) (BasicRestoreTargetInfoBase, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicRestoreTargetInfoBaseObjectTypeItemLevelRestoreTargetInfo): - var ilrti ItemLevelRestoreTargetInfo - err := json.Unmarshal(body, &ilrti) - return ilrti, err - case string(ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreFilesTargetInfo): - var rfti RestoreFilesTargetInfo - err := json.Unmarshal(body, &rfti) - return rfti, err - case string(ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfo): - var rti RestoreTargetInfo - err := json.Unmarshal(body, &rti) - return rti, err - default: - var rtib RestoreTargetInfoBase - err := json.Unmarshal(body, &rtib) - return rtib, err - } -} - -func unmarshalBasicRestoreTargetInfoBaseArray(body []byte) ([]BasicRestoreTargetInfoBase, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - rtibArray := make([]BasicRestoreTargetInfoBase, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rtib, err := unmarshalBasicRestoreTargetInfoBase(*rawMessage) - if err != nil { - return nil, err - } - rtibArray[index] = rtib - } - return rtibArray, nil -} - -// MarshalJSON is the custom marshaler for RestoreTargetInfoBase. -func (rtib RestoreTargetInfoBase) MarshalJSON() ([]byte, error) { - rtib.ObjectType = ObjectTypeBasicRestoreTargetInfoBaseObjectTypeRestoreTargetInfoBase - objectMap := make(map[string]interface{}) - if rtib.RecoveryOption != nil { - objectMap["recoveryOption"] = rtib.RecoveryOption - } - if rtib.RestoreLocation != nil { - objectMap["restoreLocation"] = rtib.RestoreLocation - } - if rtib.ObjectType != "" { - objectMap["objectType"] = rtib.ObjectType - } - return json.Marshal(objectMap) -} - -// AsItemLevelRestoreTargetInfo is the BasicRestoreTargetInfoBase implementation for RestoreTargetInfoBase. -func (rtib RestoreTargetInfoBase) AsItemLevelRestoreTargetInfo() (*ItemLevelRestoreTargetInfo, bool) { - return nil, false -} - -// AsRestoreFilesTargetInfo is the BasicRestoreTargetInfoBase implementation for RestoreTargetInfoBase. -func (rtib RestoreTargetInfoBase) AsRestoreFilesTargetInfo() (*RestoreFilesTargetInfo, bool) { - return nil, false -} - -// AsRestoreTargetInfo is the BasicRestoreTargetInfoBase implementation for RestoreTargetInfoBase. -func (rtib RestoreTargetInfoBase) AsRestoreTargetInfo() (*RestoreTargetInfo, bool) { - return nil, false -} - -// AsRestoreTargetInfoBase is the BasicRestoreTargetInfoBase implementation for RestoreTargetInfoBase. -func (rtib RestoreTargetInfoBase) AsRestoreTargetInfoBase() (*RestoreTargetInfoBase, bool) { - return &rtib, true -} - -// AsBasicRestoreTargetInfoBase is the BasicRestoreTargetInfoBase implementation for RestoreTargetInfoBase. -func (rtib RestoreTargetInfoBase) AsBasicRestoreTargetInfoBase() (BasicRestoreTargetInfoBase, bool) { - return &rtib, true -} - -// RetentionTag retention tag -type RetentionTag struct { - // ETag - READ-ONLY; Retention Tag version. - ETag *string `json:"eTag,omitempty"` - // ID - READ-ONLY; Retention Tag version. - ID *string `json:"id,omitempty"` - // TagName - Retention Tag Name to relate it to retention rule. - TagName *string `json:"tagName,omitempty"` -} - -// MarshalJSON is the custom marshaler for RetentionTag. -func (rt RetentionTag) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rt.TagName != nil { - objectMap["tagName"] = rt.TagName - } - return json.Marshal(objectMap) -} - -// ScheduleBasedBackupCriteria schedule based backup criteria -type ScheduleBasedBackupCriteria struct { - // AbsoluteCriteria - it contains absolute values like "AllBackup" / "FirstOfDay" / "FirstOfWeek" / "FirstOfMonth" - // and should be part of AbsoluteMarker enum - AbsoluteCriteria *[]AbsoluteMarker `json:"absoluteCriteria,omitempty"` - // DaysOfMonth - This is day of the month from 1 to 28 other wise last of month - DaysOfMonth *[]Day `json:"daysOfMonth,omitempty"` - // DaysOfTheWeek - It should be Sunday/Monday/T..../Saturday - DaysOfTheWeek *[]DayOfWeek `json:"daysOfTheWeek,omitempty"` - // MonthsOfYear - It should be January/February/....../December - MonthsOfYear *[]Month `json:"monthsOfYear,omitempty"` - // ScheduleTimes - List of schedule times for backup - ScheduleTimes *[]date.Time `json:"scheduleTimes,omitempty"` - // WeeksOfTheMonth - It should be First/Second/Third/Fourth/Last - WeeksOfTheMonth *[]WeekNumber `json:"weeksOfTheMonth,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicBackupCriteriaObjectTypeBackupCriteria', 'ObjectTypeBasicBackupCriteriaObjectTypeScheduleBasedBackupCriteria' - ObjectType ObjectTypeBasicBackupCriteria `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduleBasedBackupCriteria. -func (sbbc ScheduleBasedBackupCriteria) MarshalJSON() ([]byte, error) { - sbbc.ObjectType = ObjectTypeBasicBackupCriteriaObjectTypeScheduleBasedBackupCriteria - objectMap := make(map[string]interface{}) - if sbbc.AbsoluteCriteria != nil { - objectMap["absoluteCriteria"] = sbbc.AbsoluteCriteria - } - if sbbc.DaysOfMonth != nil { - objectMap["daysOfMonth"] = sbbc.DaysOfMonth - } - if sbbc.DaysOfTheWeek != nil { - objectMap["daysOfTheWeek"] = sbbc.DaysOfTheWeek - } - if sbbc.MonthsOfYear != nil { - objectMap["monthsOfYear"] = sbbc.MonthsOfYear - } - if sbbc.ScheduleTimes != nil { - objectMap["scheduleTimes"] = sbbc.ScheduleTimes - } - if sbbc.WeeksOfTheMonth != nil { - objectMap["weeksOfTheMonth"] = sbbc.WeeksOfTheMonth - } - if sbbc.ObjectType != "" { - objectMap["objectType"] = sbbc.ObjectType - } - return json.Marshal(objectMap) -} - -// AsScheduleBasedBackupCriteria is the BasicBackupCriteria implementation for ScheduleBasedBackupCriteria. -func (sbbc ScheduleBasedBackupCriteria) AsScheduleBasedBackupCriteria() (*ScheduleBasedBackupCriteria, bool) { - return &sbbc, true -} - -// AsBackupCriteria is the BasicBackupCriteria implementation for ScheduleBasedBackupCriteria. -func (sbbc ScheduleBasedBackupCriteria) AsBackupCriteria() (*BackupCriteria, bool) { - return nil, false -} - -// AsBasicBackupCriteria is the BasicBackupCriteria implementation for ScheduleBasedBackupCriteria. -func (sbbc ScheduleBasedBackupCriteria) AsBasicBackupCriteria() (BasicBackupCriteria, bool) { - return &sbbc, true -} - -// ScheduleBasedTriggerContext schedule based trigger context -type ScheduleBasedTriggerContext struct { - // Schedule - Schedule for this backup - Schedule *BackupSchedule `json:"schedule,omitempty"` - // TaggingCriteria - List of tags that can be applicable for given schedule. - TaggingCriteria *[]TaggingCriteria `json:"taggingCriteria,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeBasicTriggerContextObjectTypeTriggerContext', 'ObjectTypeBasicTriggerContextObjectTypeAdhocBasedTriggerContext', 'ObjectTypeBasicTriggerContextObjectTypeScheduleBasedTriggerContext' - ObjectType ObjectTypeBasicTriggerContext `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScheduleBasedTriggerContext. -func (sbtc ScheduleBasedTriggerContext) MarshalJSON() ([]byte, error) { - sbtc.ObjectType = ObjectTypeBasicTriggerContextObjectTypeScheduleBasedTriggerContext - objectMap := make(map[string]interface{}) - if sbtc.Schedule != nil { - objectMap["schedule"] = sbtc.Schedule - } - if sbtc.TaggingCriteria != nil { - objectMap["taggingCriteria"] = sbtc.TaggingCriteria - } - if sbtc.ObjectType != "" { - objectMap["objectType"] = sbtc.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAdhocBasedTriggerContext is the BasicTriggerContext implementation for ScheduleBasedTriggerContext. -func (sbtc ScheduleBasedTriggerContext) AsAdhocBasedTriggerContext() (*AdhocBasedTriggerContext, bool) { - return nil, false -} - -// AsScheduleBasedTriggerContext is the BasicTriggerContext implementation for ScheduleBasedTriggerContext. -func (sbtc ScheduleBasedTriggerContext) AsScheduleBasedTriggerContext() (*ScheduleBasedTriggerContext, bool) { - return &sbtc, true -} - -// AsTriggerContext is the BasicTriggerContext implementation for ScheduleBasedTriggerContext. -func (sbtc ScheduleBasedTriggerContext) AsTriggerContext() (*TriggerContext, bool) { - return nil, false -} - -// AsBasicTriggerContext is the BasicTriggerContext implementation for ScheduleBasedTriggerContext. -func (sbtc ScheduleBasedTriggerContext) AsBasicTriggerContext() (BasicTriggerContext, bool) { - return &sbtc, true -} - -// SecretStoreBasedAuthCredentials secret store based authentication credentials. -type SecretStoreBasedAuthCredentials struct { - // SecretStoreResource - Secret store resource - SecretStoreResource *SecretStoreResource `json:"secretStoreResource,omitempty"` - // ObjectType - Possible values include: 'ObjectTypeAuthCredentials', 'ObjectTypeSecretStoreBasedAuthCredentials' - ObjectType ObjectType `json:"objectType,omitempty"` -} - -// MarshalJSON is the custom marshaler for SecretStoreBasedAuthCredentials. -func (ssbac SecretStoreBasedAuthCredentials) MarshalJSON() ([]byte, error) { - ssbac.ObjectType = ObjectTypeSecretStoreBasedAuthCredentials - objectMap := make(map[string]interface{}) - if ssbac.SecretStoreResource != nil { - objectMap["secretStoreResource"] = ssbac.SecretStoreResource - } - if ssbac.ObjectType != "" { - objectMap["objectType"] = ssbac.ObjectType - } - return json.Marshal(objectMap) -} - -// AsSecretStoreBasedAuthCredentials is the BasicAuthCredentials implementation for SecretStoreBasedAuthCredentials. -func (ssbac SecretStoreBasedAuthCredentials) AsSecretStoreBasedAuthCredentials() (*SecretStoreBasedAuthCredentials, bool) { - return &ssbac, true -} - -// AsAuthCredentials is the BasicAuthCredentials implementation for SecretStoreBasedAuthCredentials. -func (ssbac SecretStoreBasedAuthCredentials) AsAuthCredentials() (*AuthCredentials, bool) { - return nil, false -} - -// AsBasicAuthCredentials is the BasicAuthCredentials implementation for SecretStoreBasedAuthCredentials. -func (ssbac SecretStoreBasedAuthCredentials) AsBasicAuthCredentials() (BasicAuthCredentials, bool) { - return &ssbac, true -} - -// SecretStoreResource class representing a secret store resource. -type SecretStoreResource struct { - // URI - Uri to get to the resource - URI *string `json:"uri,omitempty"` - // SecretStoreType - Gets or sets the type of secret store. Possible values include: 'SecretStoreTypeInvalid', 'SecretStoreTypeAzureKeyVault' - SecretStoreType SecretStoreType `json:"secretStoreType,omitempty"` -} - -// SourceLifeCycle source LifeCycle -type SourceLifeCycle struct { - DeleteAfter BasicDeleteOption `json:"deleteAfter,omitempty"` - SourceDataStore *DataStoreInfoBase `json:"sourceDataStore,omitempty"` - TargetDataStoreCopySettings *[]TargetCopySetting `json:"targetDataStoreCopySettings,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for SourceLifeCycle struct. -func (slc *SourceLifeCycle) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "deleteAfter": - if v != nil { - deleteAfter, err := unmarshalBasicDeleteOption(*v) - if err != nil { - return err - } - slc.DeleteAfter = deleteAfter - } - case "sourceDataStore": - if v != nil { - var sourceDataStore DataStoreInfoBase - err = json.Unmarshal(*v, &sourceDataStore) - if err != nil { - return err - } - slc.SourceDataStore = &sourceDataStore - } - case "targetDataStoreCopySettings": - if v != nil { - var targetDataStoreCopySettings []TargetCopySetting - err = json.Unmarshal(*v, &targetDataStoreCopySettings) - if err != nil { - return err - } - slc.TargetDataStoreCopySettings = &targetDataStoreCopySettings - } - } - } - - return nil -} - -// StorageSetting storage setting -type StorageSetting struct { - // DatastoreType - Gets or sets the type of the datastore. Possible values include: 'StorageSettingStoreTypesArchiveStore', 'StorageSettingStoreTypesSnapshotStore', 'StorageSettingStoreTypesVaultStore' - DatastoreType StorageSettingStoreTypes `json:"datastoreType,omitempty"` - // Type - Gets or sets the type. Possible values include: 'StorageSettingTypesGeoRedundant', 'StorageSettingTypesLocallyRedundant' - Type StorageSettingTypes `json:"type,omitempty"` -} - -// SupportedFeature elements class for feature request -type SupportedFeature struct { - // FeatureName - support feature type. - FeatureName *string `json:"featureName,omitempty"` - // SupportStatus - feature support status. Possible values include: 'FeatureSupportStatusInvalid', 'FeatureSupportStatusNotSupported', 'FeatureSupportStatusAlphaPreview', 'FeatureSupportStatusPrivatePreview', 'FeatureSupportStatusPublicPreview', 'FeatureSupportStatusGenerallyAvailable' - SupportStatus FeatureSupportStatus `json:"supportStatus,omitempty"` - // ExposureControlledFeatures - support feature type. - ExposureControlledFeatures *[]string `json:"exposureControlledFeatures,omitempty"` -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The type of identity that last modified the resource. - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TaggingCriteria tagging criteria -type TaggingCriteria struct { - // Criteria - Criteria which decides whether the tag can be applied to a triggered backup. - Criteria *[]BasicBackupCriteria `json:"criteria,omitempty"` - // IsDefault - Specifies if tag is default. - IsDefault *bool `json:"isDefault,omitempty"` - // TaggingPriority - Retention Tag priority. - TaggingPriority *int64 `json:"taggingPriority,omitempty"` - // TagInfo - Retention tag information - TagInfo *RetentionTag `json:"tagInfo,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for TaggingCriteria struct. -func (tc *TaggingCriteria) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "criteria": - if v != nil { - criteria, err := unmarshalBasicBackupCriteriaArray(*v) - if err != nil { - return err - } - tc.Criteria = &criteria - } - case "isDefault": - if v != nil { - var isDefault bool - err = json.Unmarshal(*v, &isDefault) - if err != nil { - return err - } - tc.IsDefault = &isDefault - } - case "taggingPriority": - if v != nil { - var taggingPriority int64 - err = json.Unmarshal(*v, &taggingPriority) - if err != nil { - return err - } - tc.TaggingPriority = &taggingPriority - } - case "tagInfo": - if v != nil { - var tagInfo RetentionTag - err = json.Unmarshal(*v, &tagInfo) - if err != nil { - return err - } - tc.TagInfo = &tagInfo - } - } - } - - return nil -} - -// TargetCopySetting target copy settings -type TargetCopySetting struct { - // CopyAfter - It can be CustomCopyOption or ImmediateCopyOption. - CopyAfter BasicCopyOption `json:"copyAfter,omitempty"` - // DataStore - Info of target datastore - DataStore *DataStoreInfoBase `json:"dataStore,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for TargetCopySetting struct. -func (tcs *TargetCopySetting) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "copyAfter": - if v != nil { - copyAfter, err := unmarshalBasicCopyOption(*v) - if err != nil { - return err - } - tcs.CopyAfter = copyAfter - } - case "dataStore": - if v != nil { - var dataStore DataStoreInfoBase - err = json.Unmarshal(*v, &dataStore) - if err != nil { - return err - } - tcs.DataStore = &dataStore - } - } - } - - return nil -} - -// TargetDetails class encapsulating target details, used where the destination is not a datasource -type TargetDetails struct { - // FilePrefix - Restore operation may create multiple files inside location pointed by Url - // Below will be the common prefix for all of them - FilePrefix *string `json:"filePrefix,omitempty"` - // RestoreTargetLocationType - Denotes the target location where the data will be restored, - // string value for the enum {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}. Possible values include: 'RestoreTargetLocationTypeInvalid', 'RestoreTargetLocationTypeAzureBlobs', 'RestoreTargetLocationTypeAzureFiles' - RestoreTargetLocationType RestoreTargetLocationType `json:"restoreTargetLocationType,omitempty"` - // URL - Url denoting the restore destination. It can point to container / file share etc - URL *string `json:"url,omitempty"` -} - -// TriggerBackupRequest trigger backup request -type TriggerBackupRequest struct { - // BackupRuleOptions - Name for the Rule of the Policy which needs to be applied for this backup - BackupRuleOptions *AdHocBackupRuleOptions `json:"backupRuleOptions,omitempty"` -} - -// BasicTriggerContext trigger context -type BasicTriggerContext interface { - AsAdhocBasedTriggerContext() (*AdhocBasedTriggerContext, bool) - AsScheduleBasedTriggerContext() (*ScheduleBasedTriggerContext, bool) - AsTriggerContext() (*TriggerContext, bool) -} - -// TriggerContext trigger context -type TriggerContext struct { - // ObjectType - Possible values include: 'ObjectTypeBasicTriggerContextObjectTypeTriggerContext', 'ObjectTypeBasicTriggerContextObjectTypeAdhocBasedTriggerContext', 'ObjectTypeBasicTriggerContextObjectTypeScheduleBasedTriggerContext' - ObjectType ObjectTypeBasicTriggerContext `json:"objectType,omitempty"` -} - -func unmarshalBasicTriggerContext(body []byte) (BasicTriggerContext, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["objectType"] { - case string(ObjectTypeBasicTriggerContextObjectTypeAdhocBasedTriggerContext): - var abtc AdhocBasedTriggerContext - err := json.Unmarshal(body, &abtc) - return abtc, err - case string(ObjectTypeBasicTriggerContextObjectTypeScheduleBasedTriggerContext): - var sbtc ScheduleBasedTriggerContext - err := json.Unmarshal(body, &sbtc) - return sbtc, err - default: - var tc TriggerContext - err := json.Unmarshal(body, &tc) - return tc, err - } -} - -func unmarshalBasicTriggerContextArray(body []byte) ([]BasicTriggerContext, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - tcArray := make([]BasicTriggerContext, len(rawMessages)) - - for index, rawMessage := range rawMessages { - tc, err := unmarshalBasicTriggerContext(*rawMessage) - if err != nil { - return nil, err - } - tcArray[index] = tc - } - return tcArray, nil -} - -// MarshalJSON is the custom marshaler for TriggerContext. -func (tc TriggerContext) MarshalJSON() ([]byte, error) { - tc.ObjectType = ObjectTypeBasicTriggerContextObjectTypeTriggerContext - objectMap := make(map[string]interface{}) - if tc.ObjectType != "" { - objectMap["objectType"] = tc.ObjectType - } - return json.Marshal(objectMap) -} - -// AsAdhocBasedTriggerContext is the BasicTriggerContext implementation for TriggerContext. -func (tc TriggerContext) AsAdhocBasedTriggerContext() (*AdhocBasedTriggerContext, bool) { - return nil, false -} - -// AsScheduleBasedTriggerContext is the BasicTriggerContext implementation for TriggerContext. -func (tc TriggerContext) AsScheduleBasedTriggerContext() (*ScheduleBasedTriggerContext, bool) { - return nil, false -} - -// AsTriggerContext is the BasicTriggerContext implementation for TriggerContext. -func (tc TriggerContext) AsTriggerContext() (*TriggerContext, bool) { - return &tc, true -} - -// AsBasicTriggerContext is the BasicTriggerContext implementation for TriggerContext. -func (tc TriggerContext) AsBasicTriggerContext() (BasicTriggerContext, bool) { - return &tc, true -} - -// UserFacingError error object used by layers that have access to localized content, and propagate that to -// user -type UserFacingError struct { - // Code - Unique code for this error - Code *string `json:"code,omitempty"` - // Details - Additional related Errors - Details *[]UserFacingError `json:"details,omitempty"` - // InnerError - Inner Error - InnerError *InnerError `json:"innerError,omitempty"` - // IsRetryable - Whether the operation will be retryable or not - IsRetryable *bool `json:"isRetryable,omitempty"` - // IsUserError - Whether the operation is due to a user error or service error - IsUserError *bool `json:"isUserError,omitempty"` - // Properties - Any key value pairs that can be injected inside error object - Properties map[string]*string `json:"properties"` - Message *string `json:"message,omitempty"` - // RecommendedAction - RecommendedAction � localized. - RecommendedAction *[]string `json:"recommendedAction,omitempty"` - // Target - Target of the error. - Target *string `json:"target,omitempty"` -} - -// MarshalJSON is the custom marshaler for UserFacingError. -func (ufe UserFacingError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ufe.Code != nil { - objectMap["code"] = ufe.Code - } - if ufe.Details != nil { - objectMap["details"] = ufe.Details - } - if ufe.InnerError != nil { - objectMap["innerError"] = ufe.InnerError - } - if ufe.IsRetryable != nil { - objectMap["isRetryable"] = ufe.IsRetryable - } - if ufe.IsUserError != nil { - objectMap["isUserError"] = ufe.IsUserError - } - if ufe.Properties != nil { - objectMap["properties"] = ufe.Properties - } - if ufe.Message != nil { - objectMap["message"] = ufe.Message - } - if ufe.RecommendedAction != nil { - objectMap["recommendedAction"] = ufe.RecommendedAction - } - if ufe.Target != nil { - objectMap["target"] = ufe.Target - } - return json.Marshal(objectMap) -} - -// ValidateForBackupRequest validate for backup request -type ValidateForBackupRequest struct { - BackupInstance *BackupInstance `json:"backupInstance,omitempty"` -} - -// ValidateRestoreRequestObject validate restore request object -type ValidateRestoreRequestObject struct { - // RestoreRequestObject - Gets or sets the restore request object. - RestoreRequestObject BasicAzureBackupRestoreRequest `json:"restoreRequestObject,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for ValidateRestoreRequestObject struct. -func (vrro *ValidateRestoreRequestObject) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "restoreRequestObject": - if v != nil { - restoreRequestObject, err := unmarshalBasicAzureBackupRestoreRequest(*v) - if err != nil { - return err - } - vrro.RestoreRequestObject = restoreRequestObject - } - } - } - - return nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/operationresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/operationresult.go deleted file mode 100644 index f7a730cee05..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/operationresult.go +++ /dev/null @@ -1,105 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" -) - -// OperationResultClient is the open API 2.0 Specs for Azure Data Protection service -type OperationResultClient struct { - BaseClient -} - -// NewOperationResultClient creates an instance of the OperationResultClient client. -func NewOperationResultClient(subscriptionID string) OperationResultClient { - return NewOperationResultClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationResultClientWithBaseURI creates an instance of the OperationResultClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationResultClientWithBaseURI(baseURI string, subscriptionID string) OperationResultClient { - return OperationResultClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the operation result for a resource -func (client OperationResultClient) Get(ctx context.Context, operationID string, location string) (result OperationJobExtendedInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationResultClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, operationID, location) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.OperationResultClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.OperationResultClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.OperationResultClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client OperationResultClient) GetPreparer(ctx context.Context, operationID string, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "operationId": autorest.Encode("path", operationID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationResults/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client OperationResultClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client OperationResultClient) GetResponder(resp *http.Response) (result OperationJobExtendedInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/operations.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/operations.go deleted file mode 100644 index c2f1b1c58e0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/operations.go +++ /dev/null @@ -1,141 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" -) - -// OperationsClient is the open API 2.0 Specs for Azure Data Protection service -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List returns the list of available operations. -func (client OperationsClient) List(ctx context.Context) (result ClientDiscoveryResponsePage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.cdr.Response.Response != nil { - sc = result.cdr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.cdr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.cdr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.cdr.hasNextLink() && result.cdr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.DataProtection/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result ClientDiscoveryResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults ClientDiscoveryResponse) (result ClientDiscoveryResponse, err error) { - req, err := lastResults.clientDiscoveryResponsePreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dataprotection.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dataprotection.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result ClientDiscoveryResponseIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/operationstatus.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/operationstatus.go deleted file mode 100644 index f39eb64e434..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/operationstatus.go +++ /dev/null @@ -1,105 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" -) - -// OperationStatusClient is the open API 2.0 Specs for Azure Data Protection service -type OperationStatusClient struct { - BaseClient -} - -// NewOperationStatusClient creates an instance of the OperationStatusClient client. -func NewOperationStatusClient(subscriptionID string) OperationStatusClient { - return NewOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationStatusClientWithBaseURI creates an instance of the OperationStatusClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) OperationStatusClient { - return OperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get sends the get request. -func (client OperationStatusClient) Get(ctx context.Context, location string, operationID string) (result OperationResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, location, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.OperationStatusClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.OperationStatusClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.OperationStatusClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client OperationStatusClient) GetPreparer(ctx context.Context, location string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "operationId": autorest.Encode("path", operationID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus/{operationId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client OperationStatusClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client OperationStatusClient) GetResponder(resp *http.Response) (result OperationResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/recoverypoints.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/recoverypoints.go deleted file mode 100644 index 3b3cbbda7fb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/recoverypoints.go +++ /dev/null @@ -1,239 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" -) - -// RecoveryPointsClient is the open API 2.0 Specs for Azure Data Protection service -type RecoveryPointsClient struct { - BaseClient -} - -// NewRecoveryPointsClient creates an instance of the RecoveryPointsClient client. -func NewRecoveryPointsClient(subscriptionID string) RecoveryPointsClient { - return NewRecoveryPointsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRecoveryPointsClientWithBaseURI creates an instance of the RecoveryPointsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewRecoveryPointsClientWithBaseURI(baseURI string, subscriptionID string) RecoveryPointsClient { - return RecoveryPointsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a Recovery Point using recoveryPointId for a Datasource. -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -// backupInstanceName - the name of the backup instance -func (client RecoveryPointsClient) Get(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, recoveryPointID string) (result AzureBackupRecoveryPointResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoveryPointsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, vaultName, resourceGroupName, backupInstanceName, recoveryPointID) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.RecoveryPointsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.RecoveryPointsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.RecoveryPointsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client RecoveryPointsClient) GetPreparer(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, recoveryPointID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupInstanceName": autorest.Encode("path", backupInstanceName), - "recoveryPointId": autorest.Encode("path", recoveryPointID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client RecoveryPointsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client RecoveryPointsClient) GetResponder(resp *http.Response) (result AzureBackupRecoveryPointResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns a list of Recovery Points for a DataSource in a vault. -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -// backupInstanceName - the name of the backup instance -// filter - oData filter options. -// skipToken - skipToken Filter. -func (client RecoveryPointsClient) List(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, filter string, skipToken string) (result AzureBackupRecoveryPointResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoveryPointsClient.List") - defer func() { - sc := -1 - if result.abrprl.Response.Response != nil { - sc = result.abrprl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, vaultName, resourceGroupName, backupInstanceName, filter, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.RecoveryPointsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.abrprl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.RecoveryPointsClient", "List", resp, "Failure sending request") - return - } - - result.abrprl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.RecoveryPointsClient", "List", resp, "Failure responding to request") - return - } - if result.abrprl.hasNextLink() && result.abrprl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client RecoveryPointsClient) ListPreparer(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, filter string, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupInstanceName": autorest.Encode("path", backupInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client RecoveryPointsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client RecoveryPointsClient) ListResponder(resp *http.Response) (result AzureBackupRecoveryPointResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client RecoveryPointsClient) listNextResults(ctx context.Context, lastResults AzureBackupRecoveryPointResourceList) (result AzureBackupRecoveryPointResourceList, err error) { - req, err := lastResults.azureBackupRecoveryPointResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dataprotection.RecoveryPointsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dataprotection.RecoveryPointsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.RecoveryPointsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client RecoveryPointsClient) ListComplete(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, filter string, skipToken string) (result AzureBackupRecoveryPointResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RecoveryPointsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, vaultName, resourceGroupName, backupInstanceName, filter, skipToken) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/resourceguards.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/resourceguards.go deleted file mode 100644 index e745da009ab..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/resourceguards.go +++ /dev/null @@ -1,1730 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" -) - -// ResourceGuardsClient is the open API 2.0 Specs for Azure Data Protection service -type ResourceGuardsClient struct { - BaseClient -} - -// NewResourceGuardsClient creates an instance of the ResourceGuardsClient client. -func NewResourceGuardsClient(subscriptionID string) ResourceGuardsClient { - return NewResourceGuardsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewResourceGuardsClientWithBaseURI creates an instance of the ResourceGuardsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewResourceGuardsClientWithBaseURI(baseURI string, subscriptionID string) ResourceGuardsClient { - return ResourceGuardsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete sends the delete request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -// resourceGuardsName - the name of ResourceGuard -func (client ResourceGuardsClient) Delete(ctx context.Context, resourceGroupName string, resourceGuardsName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceGuardsName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ResourceGuardsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get sends the get request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -// resourceGuardsName - the name of ResourceGuard -func (client ResourceGuardsClient) Get(ctx context.Context, resourceGroupName string, resourceGuardsName string) (result ResourceGuardResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, resourceGuardsName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ResourceGuardsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) GetResponder(resp *http.Response) (result ResourceGuardResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetBackupSecurityPINRequestsObjects sends the get backup security pin requests objects request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client ResourceGuardsClient) GetBackupSecurityPINRequestsObjects(ctx context.Context, resourceGroupName string, resourceGuardsName string) (result DppBaseResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetBackupSecurityPINRequestsObjects") - defer func() { - sc := -1 - if result.dbrl.Response.Response != nil { - sc = result.dbrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.getBackupSecurityPINRequestsObjectsNextResults - req, err := client.GetBackupSecurityPINRequestsObjectsPreparer(ctx, resourceGroupName, resourceGuardsName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetBackupSecurityPINRequestsObjects", nil, "Failure preparing request") - return - } - - resp, err := client.GetBackupSecurityPINRequestsObjectsSender(req) - if err != nil { - result.dbrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetBackupSecurityPINRequestsObjects", resp, "Failure sending request") - return - } - - result.dbrl, err = client.GetBackupSecurityPINRequestsObjectsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetBackupSecurityPINRequestsObjects", resp, "Failure responding to request") - return - } - if result.dbrl.hasNextLink() && result.dbrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// GetBackupSecurityPINRequestsObjectsPreparer prepares the GetBackupSecurityPINRequestsObjects request. -func (client ResourceGuardsClient) GetBackupSecurityPINRequestsObjectsPreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetBackupSecurityPINRequestsObjectsSender sends the GetBackupSecurityPINRequestsObjects request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) GetBackupSecurityPINRequestsObjectsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetBackupSecurityPINRequestsObjectsResponder handles the response to the GetBackupSecurityPINRequestsObjects request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) GetBackupSecurityPINRequestsObjectsResponder(resp *http.Response) (result DppBaseResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// getBackupSecurityPINRequestsObjectsNextResults retrieves the next set of results, if any. -func (client ResourceGuardsClient) getBackupSecurityPINRequestsObjectsNextResults(ctx context.Context, lastResults DppBaseResourceList) (result DppBaseResourceList, err error) { - req, err := lastResults.dppBaseResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getBackupSecurityPINRequestsObjectsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.GetBackupSecurityPINRequestsObjectsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getBackupSecurityPINRequestsObjectsNextResults", resp, "Failure sending next results request") - } - result, err = client.GetBackupSecurityPINRequestsObjectsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getBackupSecurityPINRequestsObjectsNextResults", resp, "Failure responding to next results request") - } - return -} - -// GetBackupSecurityPINRequestsObjectsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ResourceGuardsClient) GetBackupSecurityPINRequestsObjectsComplete(ctx context.Context, resourceGroupName string, resourceGuardsName string) (result DppBaseResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetBackupSecurityPINRequestsObjects") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.GetBackupSecurityPINRequestsObjects(ctx, resourceGroupName, resourceGuardsName) - return -} - -// GetDefaultBackupSecurityPINRequestsObject sends the get default backup security pin requests object request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client ResourceGuardsClient) GetDefaultBackupSecurityPINRequestsObject(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string) (result DppBaseResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetDefaultBackupSecurityPINRequestsObject") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetDefaultBackupSecurityPINRequestsObjectPreparer(ctx, resourceGroupName, resourceGuardsName, requestName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultBackupSecurityPINRequestsObject", nil, "Failure preparing request") - return - } - - resp, err := client.GetDefaultBackupSecurityPINRequestsObjectSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultBackupSecurityPINRequestsObject", resp, "Failure sending request") - return - } - - result, err = client.GetDefaultBackupSecurityPINRequestsObjectResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultBackupSecurityPINRequestsObject", resp, "Failure responding to request") - return - } - - return -} - -// GetDefaultBackupSecurityPINRequestsObjectPreparer prepares the GetDefaultBackupSecurityPINRequestsObject request. -func (client ResourceGuardsClient) GetDefaultBackupSecurityPINRequestsObjectPreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "requestName": autorest.Encode("path", requestName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests/{requestName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDefaultBackupSecurityPINRequestsObjectSender sends the GetDefaultBackupSecurityPINRequestsObject request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) GetDefaultBackupSecurityPINRequestsObjectSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDefaultBackupSecurityPINRequestsObjectResponder handles the response to the GetDefaultBackupSecurityPINRequestsObject request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) GetDefaultBackupSecurityPINRequestsObjectResponder(resp *http.Response) (result DppBaseResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDefaultDeleteProtectedItemRequestsObject sends the get default delete protected item requests object request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client ResourceGuardsClient) GetDefaultDeleteProtectedItemRequestsObject(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string) (result DppBaseResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetDefaultDeleteProtectedItemRequestsObject") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetDefaultDeleteProtectedItemRequestsObjectPreparer(ctx, resourceGroupName, resourceGuardsName, requestName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultDeleteProtectedItemRequestsObject", nil, "Failure preparing request") - return - } - - resp, err := client.GetDefaultDeleteProtectedItemRequestsObjectSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultDeleteProtectedItemRequestsObject", resp, "Failure sending request") - return - } - - result, err = client.GetDefaultDeleteProtectedItemRequestsObjectResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultDeleteProtectedItemRequestsObject", resp, "Failure responding to request") - return - } - - return -} - -// GetDefaultDeleteProtectedItemRequestsObjectPreparer prepares the GetDefaultDeleteProtectedItemRequestsObject request. -func (client ResourceGuardsClient) GetDefaultDeleteProtectedItemRequestsObjectPreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "requestName": autorest.Encode("path", requestName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests/{requestName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDefaultDeleteProtectedItemRequestsObjectSender sends the GetDefaultDeleteProtectedItemRequestsObject request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) GetDefaultDeleteProtectedItemRequestsObjectSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDefaultDeleteProtectedItemRequestsObjectResponder handles the response to the GetDefaultDeleteProtectedItemRequestsObject request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) GetDefaultDeleteProtectedItemRequestsObjectResponder(resp *http.Response) (result DppBaseResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDefaultDeleteResourceGuardProxyRequestsObject sends the get default delete resource guard proxy requests object -// request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client ResourceGuardsClient) GetDefaultDeleteResourceGuardProxyRequestsObject(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string) (result DppBaseResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetDefaultDeleteResourceGuardProxyRequestsObject") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetDefaultDeleteResourceGuardProxyRequestsObjectPreparer(ctx, resourceGroupName, resourceGuardsName, requestName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultDeleteResourceGuardProxyRequestsObject", nil, "Failure preparing request") - return - } - - resp, err := client.GetDefaultDeleteResourceGuardProxyRequestsObjectSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultDeleteResourceGuardProxyRequestsObject", resp, "Failure sending request") - return - } - - result, err = client.GetDefaultDeleteResourceGuardProxyRequestsObjectResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultDeleteResourceGuardProxyRequestsObject", resp, "Failure responding to request") - return - } - - return -} - -// GetDefaultDeleteResourceGuardProxyRequestsObjectPreparer prepares the GetDefaultDeleteResourceGuardProxyRequestsObject request. -func (client ResourceGuardsClient) GetDefaultDeleteResourceGuardProxyRequestsObjectPreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "requestName": autorest.Encode("path", requestName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests/{requestName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDefaultDeleteResourceGuardProxyRequestsObjectSender sends the GetDefaultDeleteResourceGuardProxyRequestsObject request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) GetDefaultDeleteResourceGuardProxyRequestsObjectSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDefaultDeleteResourceGuardProxyRequestsObjectResponder handles the response to the GetDefaultDeleteResourceGuardProxyRequestsObject request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) GetDefaultDeleteResourceGuardProxyRequestsObjectResponder(resp *http.Response) (result DppBaseResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDefaultDisableSoftDeleteRequestsObject sends the get default disable soft delete requests object request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client ResourceGuardsClient) GetDefaultDisableSoftDeleteRequestsObject(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string) (result DppBaseResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetDefaultDisableSoftDeleteRequestsObject") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetDefaultDisableSoftDeleteRequestsObjectPreparer(ctx, resourceGroupName, resourceGuardsName, requestName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultDisableSoftDeleteRequestsObject", nil, "Failure preparing request") - return - } - - resp, err := client.GetDefaultDisableSoftDeleteRequestsObjectSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultDisableSoftDeleteRequestsObject", resp, "Failure sending request") - return - } - - result, err = client.GetDefaultDisableSoftDeleteRequestsObjectResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultDisableSoftDeleteRequestsObject", resp, "Failure responding to request") - return - } - - return -} - -// GetDefaultDisableSoftDeleteRequestsObjectPreparer prepares the GetDefaultDisableSoftDeleteRequestsObject request. -func (client ResourceGuardsClient) GetDefaultDisableSoftDeleteRequestsObjectPreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "requestName": autorest.Encode("path", requestName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests/{requestName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDefaultDisableSoftDeleteRequestsObjectSender sends the GetDefaultDisableSoftDeleteRequestsObject request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) GetDefaultDisableSoftDeleteRequestsObjectSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDefaultDisableSoftDeleteRequestsObjectResponder handles the response to the GetDefaultDisableSoftDeleteRequestsObject request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) GetDefaultDisableSoftDeleteRequestsObjectResponder(resp *http.Response) (result DppBaseResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDefaultUpdateProtectedItemRequestsObject sends the get default update protected item requests object request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client ResourceGuardsClient) GetDefaultUpdateProtectedItemRequestsObject(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string) (result DppBaseResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetDefaultUpdateProtectedItemRequestsObject") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetDefaultUpdateProtectedItemRequestsObjectPreparer(ctx, resourceGroupName, resourceGuardsName, requestName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultUpdateProtectedItemRequestsObject", nil, "Failure preparing request") - return - } - - resp, err := client.GetDefaultUpdateProtectedItemRequestsObjectSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultUpdateProtectedItemRequestsObject", resp, "Failure sending request") - return - } - - result, err = client.GetDefaultUpdateProtectedItemRequestsObjectResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultUpdateProtectedItemRequestsObject", resp, "Failure responding to request") - return - } - - return -} - -// GetDefaultUpdateProtectedItemRequestsObjectPreparer prepares the GetDefaultUpdateProtectedItemRequestsObject request. -func (client ResourceGuardsClient) GetDefaultUpdateProtectedItemRequestsObjectPreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "requestName": autorest.Encode("path", requestName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests/{requestName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDefaultUpdateProtectedItemRequestsObjectSender sends the GetDefaultUpdateProtectedItemRequestsObject request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) GetDefaultUpdateProtectedItemRequestsObjectSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDefaultUpdateProtectedItemRequestsObjectResponder handles the response to the GetDefaultUpdateProtectedItemRequestsObject request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) GetDefaultUpdateProtectedItemRequestsObjectResponder(resp *http.Response) (result DppBaseResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDefaultUpdateProtectionPolicyRequestsObject sends the get default update protection policy requests object -// request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client ResourceGuardsClient) GetDefaultUpdateProtectionPolicyRequestsObject(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string) (result DppBaseResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetDefaultUpdateProtectionPolicyRequestsObject") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetDefaultUpdateProtectionPolicyRequestsObjectPreparer(ctx, resourceGroupName, resourceGuardsName, requestName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultUpdateProtectionPolicyRequestsObject", nil, "Failure preparing request") - return - } - - resp, err := client.GetDefaultUpdateProtectionPolicyRequestsObjectSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultUpdateProtectionPolicyRequestsObject", resp, "Failure sending request") - return - } - - result, err = client.GetDefaultUpdateProtectionPolicyRequestsObjectResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDefaultUpdateProtectionPolicyRequestsObject", resp, "Failure responding to request") - return - } - - return -} - -// GetDefaultUpdateProtectionPolicyRequestsObjectPreparer prepares the GetDefaultUpdateProtectionPolicyRequestsObject request. -func (client ResourceGuardsClient) GetDefaultUpdateProtectionPolicyRequestsObjectPreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "requestName": autorest.Encode("path", requestName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests/{requestName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDefaultUpdateProtectionPolicyRequestsObjectSender sends the GetDefaultUpdateProtectionPolicyRequestsObject request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) GetDefaultUpdateProtectionPolicyRequestsObjectSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDefaultUpdateProtectionPolicyRequestsObjectResponder handles the response to the GetDefaultUpdateProtectionPolicyRequestsObject request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) GetDefaultUpdateProtectionPolicyRequestsObjectResponder(resp *http.Response) (result DppBaseResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetDeleteProtectedItemRequestsObjects sends the get delete protected item requests objects request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client ResourceGuardsClient) GetDeleteProtectedItemRequestsObjects(ctx context.Context, resourceGroupName string, resourceGuardsName string) (result DppBaseResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetDeleteProtectedItemRequestsObjects") - defer func() { - sc := -1 - if result.dbrl.Response.Response != nil { - sc = result.dbrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.getDeleteProtectedItemRequestsObjectsNextResults - req, err := client.GetDeleteProtectedItemRequestsObjectsPreparer(ctx, resourceGroupName, resourceGuardsName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDeleteProtectedItemRequestsObjects", nil, "Failure preparing request") - return - } - - resp, err := client.GetDeleteProtectedItemRequestsObjectsSender(req) - if err != nil { - result.dbrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDeleteProtectedItemRequestsObjects", resp, "Failure sending request") - return - } - - result.dbrl, err = client.GetDeleteProtectedItemRequestsObjectsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDeleteProtectedItemRequestsObjects", resp, "Failure responding to request") - return - } - if result.dbrl.hasNextLink() && result.dbrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// GetDeleteProtectedItemRequestsObjectsPreparer prepares the GetDeleteProtectedItemRequestsObjects request. -func (client ResourceGuardsClient) GetDeleteProtectedItemRequestsObjectsPreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDeleteProtectedItemRequestsObjectsSender sends the GetDeleteProtectedItemRequestsObjects request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) GetDeleteProtectedItemRequestsObjectsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDeleteProtectedItemRequestsObjectsResponder handles the response to the GetDeleteProtectedItemRequestsObjects request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) GetDeleteProtectedItemRequestsObjectsResponder(resp *http.Response) (result DppBaseResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// getDeleteProtectedItemRequestsObjectsNextResults retrieves the next set of results, if any. -func (client ResourceGuardsClient) getDeleteProtectedItemRequestsObjectsNextResults(ctx context.Context, lastResults DppBaseResourceList) (result DppBaseResourceList, err error) { - req, err := lastResults.dppBaseResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getDeleteProtectedItemRequestsObjectsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.GetDeleteProtectedItemRequestsObjectsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getDeleteProtectedItemRequestsObjectsNextResults", resp, "Failure sending next results request") - } - result, err = client.GetDeleteProtectedItemRequestsObjectsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getDeleteProtectedItemRequestsObjectsNextResults", resp, "Failure responding to next results request") - } - return -} - -// GetDeleteProtectedItemRequestsObjectsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ResourceGuardsClient) GetDeleteProtectedItemRequestsObjectsComplete(ctx context.Context, resourceGroupName string, resourceGuardsName string) (result DppBaseResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetDeleteProtectedItemRequestsObjects") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.GetDeleteProtectedItemRequestsObjects(ctx, resourceGroupName, resourceGuardsName) - return -} - -// GetDeleteResourceGuardProxyRequestsObjects sends the get delete resource guard proxy requests objects request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client ResourceGuardsClient) GetDeleteResourceGuardProxyRequestsObjects(ctx context.Context, resourceGroupName string, resourceGuardsName string) (result DppBaseResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetDeleteResourceGuardProxyRequestsObjects") - defer func() { - sc := -1 - if result.dbrl.Response.Response != nil { - sc = result.dbrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.getDeleteResourceGuardProxyRequestsObjectsNextResults - req, err := client.GetDeleteResourceGuardProxyRequestsObjectsPreparer(ctx, resourceGroupName, resourceGuardsName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDeleteResourceGuardProxyRequestsObjects", nil, "Failure preparing request") - return - } - - resp, err := client.GetDeleteResourceGuardProxyRequestsObjectsSender(req) - if err != nil { - result.dbrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDeleteResourceGuardProxyRequestsObjects", resp, "Failure sending request") - return - } - - result.dbrl, err = client.GetDeleteResourceGuardProxyRequestsObjectsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDeleteResourceGuardProxyRequestsObjects", resp, "Failure responding to request") - return - } - if result.dbrl.hasNextLink() && result.dbrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// GetDeleteResourceGuardProxyRequestsObjectsPreparer prepares the GetDeleteResourceGuardProxyRequestsObjects request. -func (client ResourceGuardsClient) GetDeleteResourceGuardProxyRequestsObjectsPreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDeleteResourceGuardProxyRequestsObjectsSender sends the GetDeleteResourceGuardProxyRequestsObjects request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) GetDeleteResourceGuardProxyRequestsObjectsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDeleteResourceGuardProxyRequestsObjectsResponder handles the response to the GetDeleteResourceGuardProxyRequestsObjects request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) GetDeleteResourceGuardProxyRequestsObjectsResponder(resp *http.Response) (result DppBaseResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// getDeleteResourceGuardProxyRequestsObjectsNextResults retrieves the next set of results, if any. -func (client ResourceGuardsClient) getDeleteResourceGuardProxyRequestsObjectsNextResults(ctx context.Context, lastResults DppBaseResourceList) (result DppBaseResourceList, err error) { - req, err := lastResults.dppBaseResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getDeleteResourceGuardProxyRequestsObjectsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.GetDeleteResourceGuardProxyRequestsObjectsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getDeleteResourceGuardProxyRequestsObjectsNextResults", resp, "Failure sending next results request") - } - result, err = client.GetDeleteResourceGuardProxyRequestsObjectsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getDeleteResourceGuardProxyRequestsObjectsNextResults", resp, "Failure responding to next results request") - } - return -} - -// GetDeleteResourceGuardProxyRequestsObjectsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ResourceGuardsClient) GetDeleteResourceGuardProxyRequestsObjectsComplete(ctx context.Context, resourceGroupName string, resourceGuardsName string) (result DppBaseResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetDeleteResourceGuardProxyRequestsObjects") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.GetDeleteResourceGuardProxyRequestsObjects(ctx, resourceGroupName, resourceGuardsName) - return -} - -// GetDisableSoftDeleteRequestsObjects sends the get disable soft delete requests objects request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client ResourceGuardsClient) GetDisableSoftDeleteRequestsObjects(ctx context.Context, resourceGroupName string, resourceGuardsName string) (result DppBaseResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetDisableSoftDeleteRequestsObjects") - defer func() { - sc := -1 - if result.dbrl.Response.Response != nil { - sc = result.dbrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.getDisableSoftDeleteRequestsObjectsNextResults - req, err := client.GetDisableSoftDeleteRequestsObjectsPreparer(ctx, resourceGroupName, resourceGuardsName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDisableSoftDeleteRequestsObjects", nil, "Failure preparing request") - return - } - - resp, err := client.GetDisableSoftDeleteRequestsObjectsSender(req) - if err != nil { - result.dbrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDisableSoftDeleteRequestsObjects", resp, "Failure sending request") - return - } - - result.dbrl, err = client.GetDisableSoftDeleteRequestsObjectsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetDisableSoftDeleteRequestsObjects", resp, "Failure responding to request") - return - } - if result.dbrl.hasNextLink() && result.dbrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// GetDisableSoftDeleteRequestsObjectsPreparer prepares the GetDisableSoftDeleteRequestsObjects request. -func (client ResourceGuardsClient) GetDisableSoftDeleteRequestsObjectsPreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDisableSoftDeleteRequestsObjectsSender sends the GetDisableSoftDeleteRequestsObjects request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) GetDisableSoftDeleteRequestsObjectsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDisableSoftDeleteRequestsObjectsResponder handles the response to the GetDisableSoftDeleteRequestsObjects request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) GetDisableSoftDeleteRequestsObjectsResponder(resp *http.Response) (result DppBaseResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// getDisableSoftDeleteRequestsObjectsNextResults retrieves the next set of results, if any. -func (client ResourceGuardsClient) getDisableSoftDeleteRequestsObjectsNextResults(ctx context.Context, lastResults DppBaseResourceList) (result DppBaseResourceList, err error) { - req, err := lastResults.dppBaseResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getDisableSoftDeleteRequestsObjectsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.GetDisableSoftDeleteRequestsObjectsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getDisableSoftDeleteRequestsObjectsNextResults", resp, "Failure sending next results request") - } - result, err = client.GetDisableSoftDeleteRequestsObjectsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getDisableSoftDeleteRequestsObjectsNextResults", resp, "Failure responding to next results request") - } - return -} - -// GetDisableSoftDeleteRequestsObjectsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ResourceGuardsClient) GetDisableSoftDeleteRequestsObjectsComplete(ctx context.Context, resourceGroupName string, resourceGuardsName string) (result DppBaseResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetDisableSoftDeleteRequestsObjects") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.GetDisableSoftDeleteRequestsObjects(ctx, resourceGroupName, resourceGuardsName) - return -} - -// GetResourcesInResourceGroup sends the get resources in resource group request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client ResourceGuardsClient) GetResourcesInResourceGroup(ctx context.Context, resourceGroupName string) (result ResourceGuardResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetResourcesInResourceGroup") - defer func() { - sc := -1 - if result.rgrl.Response.Response != nil { - sc = result.rgrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.getResourcesInResourceGroupNextResults - req, err := client.GetResourcesInResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetResourcesInResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.GetResourcesInResourceGroupSender(req) - if err != nil { - result.rgrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetResourcesInResourceGroup", resp, "Failure sending request") - return - } - - result.rgrl, err = client.GetResourcesInResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetResourcesInResourceGroup", resp, "Failure responding to request") - return - } - if result.rgrl.hasNextLink() && result.rgrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// GetResourcesInResourceGroupPreparer prepares the GetResourcesInResourceGroup request. -func (client ResourceGuardsClient) GetResourcesInResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetResourcesInResourceGroupSender sends the GetResourcesInResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) GetResourcesInResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResourcesInResourceGroupResponder handles the response to the GetResourcesInResourceGroup request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) GetResourcesInResourceGroupResponder(resp *http.Response) (result ResourceGuardResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// getResourcesInResourceGroupNextResults retrieves the next set of results, if any. -func (client ResourceGuardsClient) getResourcesInResourceGroupNextResults(ctx context.Context, lastResults ResourceGuardResourceList) (result ResourceGuardResourceList, err error) { - req, err := lastResults.resourceGuardResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getResourcesInResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.GetResourcesInResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getResourcesInResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.GetResourcesInResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getResourcesInResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// GetResourcesInResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ResourceGuardsClient) GetResourcesInResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ResourceGuardResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetResourcesInResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.GetResourcesInResourceGroup(ctx, resourceGroupName) - return -} - -// GetResourcesInSubscription sends the get resources in subscription request. -func (client ResourceGuardsClient) GetResourcesInSubscription(ctx context.Context) (result ResourceGuardResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetResourcesInSubscription") - defer func() { - sc := -1 - if result.rgrl.Response.Response != nil { - sc = result.rgrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.getResourcesInSubscriptionNextResults - req, err := client.GetResourcesInSubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetResourcesInSubscription", nil, "Failure preparing request") - return - } - - resp, err := client.GetResourcesInSubscriptionSender(req) - if err != nil { - result.rgrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetResourcesInSubscription", resp, "Failure sending request") - return - } - - result.rgrl, err = client.GetResourcesInSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetResourcesInSubscription", resp, "Failure responding to request") - return - } - if result.rgrl.hasNextLink() && result.rgrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// GetResourcesInSubscriptionPreparer prepares the GetResourcesInSubscription request. -func (client ResourceGuardsClient) GetResourcesInSubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetResourcesInSubscriptionSender sends the GetResourcesInSubscription request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) GetResourcesInSubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResourcesInSubscriptionResponder handles the response to the GetResourcesInSubscription request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) GetResourcesInSubscriptionResponder(resp *http.Response) (result ResourceGuardResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// getResourcesInSubscriptionNextResults retrieves the next set of results, if any. -func (client ResourceGuardsClient) getResourcesInSubscriptionNextResults(ctx context.Context, lastResults ResourceGuardResourceList) (result ResourceGuardResourceList, err error) { - req, err := lastResults.resourceGuardResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getResourcesInSubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.GetResourcesInSubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getResourcesInSubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.GetResourcesInSubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getResourcesInSubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// GetResourcesInSubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client ResourceGuardsClient) GetResourcesInSubscriptionComplete(ctx context.Context) (result ResourceGuardResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetResourcesInSubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.GetResourcesInSubscription(ctx) - return -} - -// GetUpdateProtectedItemRequestsObjects sends the get update protected item requests objects request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client ResourceGuardsClient) GetUpdateProtectedItemRequestsObjects(ctx context.Context, resourceGroupName string, resourceGuardsName string) (result DppBaseResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetUpdateProtectedItemRequestsObjects") - defer func() { - sc := -1 - if result.dbrl.Response.Response != nil { - sc = result.dbrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.getUpdateProtectedItemRequestsObjectsNextResults - req, err := client.GetUpdateProtectedItemRequestsObjectsPreparer(ctx, resourceGroupName, resourceGuardsName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetUpdateProtectedItemRequestsObjects", nil, "Failure preparing request") - return - } - - resp, err := client.GetUpdateProtectedItemRequestsObjectsSender(req) - if err != nil { - result.dbrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetUpdateProtectedItemRequestsObjects", resp, "Failure sending request") - return - } - - result.dbrl, err = client.GetUpdateProtectedItemRequestsObjectsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetUpdateProtectedItemRequestsObjects", resp, "Failure responding to request") - return - } - if result.dbrl.hasNextLink() && result.dbrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// GetUpdateProtectedItemRequestsObjectsPreparer prepares the GetUpdateProtectedItemRequestsObjects request. -func (client ResourceGuardsClient) GetUpdateProtectedItemRequestsObjectsPreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetUpdateProtectedItemRequestsObjectsSender sends the GetUpdateProtectedItemRequestsObjects request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) GetUpdateProtectedItemRequestsObjectsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetUpdateProtectedItemRequestsObjectsResponder handles the response to the GetUpdateProtectedItemRequestsObjects request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) GetUpdateProtectedItemRequestsObjectsResponder(resp *http.Response) (result DppBaseResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// getUpdateProtectedItemRequestsObjectsNextResults retrieves the next set of results, if any. -func (client ResourceGuardsClient) getUpdateProtectedItemRequestsObjectsNextResults(ctx context.Context, lastResults DppBaseResourceList) (result DppBaseResourceList, err error) { - req, err := lastResults.dppBaseResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getUpdateProtectedItemRequestsObjectsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.GetUpdateProtectedItemRequestsObjectsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getUpdateProtectedItemRequestsObjectsNextResults", resp, "Failure sending next results request") - } - result, err = client.GetUpdateProtectedItemRequestsObjectsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getUpdateProtectedItemRequestsObjectsNextResults", resp, "Failure responding to next results request") - } - return -} - -// GetUpdateProtectedItemRequestsObjectsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ResourceGuardsClient) GetUpdateProtectedItemRequestsObjectsComplete(ctx context.Context, resourceGroupName string, resourceGuardsName string) (result DppBaseResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetUpdateProtectedItemRequestsObjects") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.GetUpdateProtectedItemRequestsObjects(ctx, resourceGroupName, resourceGuardsName) - return -} - -// GetUpdateProtectionPolicyRequestsObjects sends the get update protection policy requests objects request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -func (client ResourceGuardsClient) GetUpdateProtectionPolicyRequestsObjects(ctx context.Context, resourceGroupName string, resourceGuardsName string) (result DppBaseResourceListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetUpdateProtectionPolicyRequestsObjects") - defer func() { - sc := -1 - if result.dbrl.Response.Response != nil { - sc = result.dbrl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.getUpdateProtectionPolicyRequestsObjectsNextResults - req, err := client.GetUpdateProtectionPolicyRequestsObjectsPreparer(ctx, resourceGroupName, resourceGuardsName) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetUpdateProtectionPolicyRequestsObjects", nil, "Failure preparing request") - return - } - - resp, err := client.GetUpdateProtectionPolicyRequestsObjectsSender(req) - if err != nil { - result.dbrl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetUpdateProtectionPolicyRequestsObjects", resp, "Failure sending request") - return - } - - result.dbrl, err = client.GetUpdateProtectionPolicyRequestsObjectsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "GetUpdateProtectionPolicyRequestsObjects", resp, "Failure responding to request") - return - } - if result.dbrl.hasNextLink() && result.dbrl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// GetUpdateProtectionPolicyRequestsObjectsPreparer prepares the GetUpdateProtectionPolicyRequestsObjects request. -func (client ResourceGuardsClient) GetUpdateProtectionPolicyRequestsObjectsPreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetUpdateProtectionPolicyRequestsObjectsSender sends the GetUpdateProtectionPolicyRequestsObjects request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) GetUpdateProtectionPolicyRequestsObjectsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetUpdateProtectionPolicyRequestsObjectsResponder handles the response to the GetUpdateProtectionPolicyRequestsObjects request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) GetUpdateProtectionPolicyRequestsObjectsResponder(resp *http.Response) (result DppBaseResourceList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// getUpdateProtectionPolicyRequestsObjectsNextResults retrieves the next set of results, if any. -func (client ResourceGuardsClient) getUpdateProtectionPolicyRequestsObjectsNextResults(ctx context.Context, lastResults DppBaseResourceList) (result DppBaseResourceList, err error) { - req, err := lastResults.dppBaseResourceListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getUpdateProtectionPolicyRequestsObjectsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.GetUpdateProtectionPolicyRequestsObjectsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getUpdateProtectionPolicyRequestsObjectsNextResults", resp, "Failure sending next results request") - } - result, err = client.GetUpdateProtectionPolicyRequestsObjectsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "getUpdateProtectionPolicyRequestsObjectsNextResults", resp, "Failure responding to next results request") - } - return -} - -// GetUpdateProtectionPolicyRequestsObjectsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ResourceGuardsClient) GetUpdateProtectionPolicyRequestsObjectsComplete(ctx context.Context, resourceGroupName string, resourceGuardsName string) (result DppBaseResourceListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.GetUpdateProtectionPolicyRequestsObjects") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.GetUpdateProtectionPolicyRequestsObjects(ctx, resourceGroupName, resourceGuardsName) - return -} - -// Patch sends the patch request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -// resourceGuardsName - the name of ResourceGuard -// parameters - request body for operation -func (client ResourceGuardsClient) Patch(ctx context.Context, resourceGroupName string, resourceGuardsName string, parameters PatchResourceRequestInput) (result ResourceGuardResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.Patch") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.PatchPreparer(ctx, resourceGroupName, resourceGuardsName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "Patch", nil, "Failure preparing request") - return - } - - resp, err := client.PatchSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "Patch", resp, "Failure sending request") - return - } - - result, err = client.PatchResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "Patch", resp, "Failure responding to request") - return - } - - return -} - -// PatchPreparer prepares the Patch request. -func (client ResourceGuardsClient) PatchPreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string, parameters PatchResourceRequestInput) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PatchSender sends the Patch request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) PatchSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// PatchResponder handles the response to the Patch request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) PatchResponder(resp *http.Response) (result ResourceGuardResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Put sends the put request. -// Parameters: -// resourceGroupName - the name of the resource group where the backup vault is present. -// resourceGuardsName - the name of ResourceGuard -// parameters - request body for operation -func (client ResourceGuardsClient) Put(ctx context.Context, resourceGroupName string, resourceGuardsName string, parameters ResourceGuardResource) (result ResourceGuardResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceGuardsClient.Put") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.PutPreparer(ctx, resourceGroupName, resourceGuardsName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "Put", nil, "Failure preparing request") - return - } - - resp, err := client.PutSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "Put", resp, "Failure sending request") - return - } - - result, err = client.PutResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.ResourceGuardsClient", "Put", resp, "Failure responding to request") - return - } - - return -} - -// PutPreparer prepares the Put request. -func (client ResourceGuardsClient) PutPreparer(ctx context.Context, resourceGroupName string, resourceGuardsName string, parameters ResourceGuardResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceGuardsName": autorest.Encode("path", resourceGuardsName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PutSender sends the Put request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceGuardsClient) PutSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// PutResponder handles the response to the Put request. The method always -// closes the http.Response Body. -func (client ResourceGuardsClient) PutResponder(resp *http.Response) (result ResourceGuardResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/restorabletimeranges.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/restorabletimeranges.go deleted file mode 100644 index 4450de5f4e3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/restorabletimeranges.go +++ /dev/null @@ -1,114 +0,0 @@ -package dataprotection - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" -) - -// RestorableTimeRangesClient is the open API 2.0 Specs for Azure Data Protection service -type RestorableTimeRangesClient struct { - BaseClient -} - -// NewRestorableTimeRangesClient creates an instance of the RestorableTimeRangesClient client. -func NewRestorableTimeRangesClient(subscriptionID string) RestorableTimeRangesClient { - return NewRestorableTimeRangesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewRestorableTimeRangesClientWithBaseURI creates an instance of the RestorableTimeRangesClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewRestorableTimeRangesClientWithBaseURI(baseURI string, subscriptionID string) RestorableTimeRangesClient { - return RestorableTimeRangesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Find sends the find request. -// Parameters: -// vaultName - the name of the backup vault. -// resourceGroupName - the name of the resource group where the backup vault is present. -// backupInstanceName - the name of the backup instance -// parameters - request body for operation -func (client RestorableTimeRangesClient) Find(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters AzureBackupFindRestorableTimeRangesRequest) (result AzureBackupFindRestorableTimeRangesResponseResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RestorableTimeRangesClient.Find") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.FindPreparer(ctx, vaultName, resourceGroupName, backupInstanceName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.RestorableTimeRangesClient", "Find", nil, "Failure preparing request") - return - } - - resp, err := client.FindSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "dataprotection.RestorableTimeRangesClient", "Find", resp, "Failure sending request") - return - } - - result, err = client.FindResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "dataprotection.RestorableTimeRangesClient", "Find", resp, "Failure responding to request") - return - } - - return -} - -// FindPreparer prepares the Find request. -func (client RestorableTimeRangesClient) FindPreparer(ctx context.Context, vaultName string, resourceGroupName string, backupInstanceName string, parameters AzureBackupFindRestorableTimeRangesRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "backupInstanceName": autorest.Encode("path", backupInstanceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vaultName": autorest.Encode("path", vaultName), - } - - const APIVersion = "2021-07-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// FindSender sends the Find request. The method will close the -// http.Response Body if it receives an error. -func (client RestorableTimeRangesClient) FindSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// FindResponder handles the response to the Find request. The method always -// closes the http.Response Body. -func (client RestorableTimeRangesClient) FindResponder(resp *http.Response) (result AzureBackupFindRestorableTimeRangesResponseResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/version.go deleted file mode 100644 index ca2052fa9fa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package dataprotection - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " dataprotection/2021-07-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse/backup_instance.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse/backup_instance.go deleted file mode 100644 index f257a1a68b9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse/backup_instance.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type BackupInstanceId struct { - SubscriptionId string - ResourceGroup string - BackupVaultName string - Name string -} - -func NewBackupInstanceID(subscriptionId, resourceGroup, backupVaultName, name string) BackupInstanceId { - return BackupInstanceId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - BackupVaultName: backupVaultName, - Name: name, - } -} - -func (id BackupInstanceId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Backup Vault Name %q", id.BackupVaultName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Backup Instance", segmentsStr) -} - -func (id BackupInstanceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/backupVaults/%s/backupInstances/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.BackupVaultName, id.Name) -} - -// BackupInstanceID parses a BackupInstance ID into an BackupInstanceId struct -func BackupInstanceID(input string) (*BackupInstanceId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := BackupInstanceId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.BackupVaultName, err = id.PopSegment("backupVaults"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("backupInstances"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse/backup_policy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse/backup_policy.go deleted file mode 100644 index 284f7e1e0f8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse/backup_policy.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type BackupPolicyId struct { - SubscriptionId string - ResourceGroup string - BackupVaultName string - Name string -} - -func NewBackupPolicyID(subscriptionId, resourceGroup, backupVaultName, name string) BackupPolicyId { - return BackupPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - BackupVaultName: backupVaultName, - Name: name, - } -} - -func (id BackupPolicyId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Backup Vault Name %q", id.BackupVaultName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Backup Policy", segmentsStr) -} - -func (id BackupPolicyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/backupVaults/%s/backupPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.BackupVaultName, id.Name) -} - -// BackupPolicyID parses a BackupPolicy ID into an BackupPolicyId struct -func BackupPolicyID(input string) (*BackupPolicyId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := BackupPolicyId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.BackupVaultName, err = id.PopSegment("backupVaults"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("backupPolicies"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse/backup_vault.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse/backup_vault.go deleted file mode 100644 index 60ebfef822d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse/backup_vault.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type BackupVaultId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewBackupVaultID(subscriptionId, resourceGroup, name string) BackupVaultId { - return BackupVaultId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id BackupVaultId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Backup Vault", segmentsStr) -} - -func (id BackupVaultId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DataProtection/backupVaults/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// BackupVaultID parses a BackupVault ID into an BackupVaultId struct -func BackupVaultID(input string) (*BackupVaultId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := BackupVaultId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("backupVaults"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/registration.go index 8c1c1d2acd6..78738341f30 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/registration.go @@ -42,5 +42,6 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { "azurerm_data_protection_backup_policy_disk": resourceDataProtectionBackupPolicyDisk(), "azurerm_data_protection_backup_policy_postgresql": resourceDataProtectionBackupPolicyPostgreSQL(), "azurerm_data_protection_backup_vault": resourceDataProtectionBackupVault(), + "azurerm_data_protection_resource_guard": resourceDataProtectionResourceGuard(), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/resourceids.go deleted file mode 100644 index 08d62122586..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/resourceids.go +++ /dev/null @@ -1,5 +0,0 @@ -package dataprotection - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=BackupVault -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.DataProtection/backupVaults/vault1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=BackupPolicy -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.DataProtection/backupVaults/vault1/backupPolicies/backupPolicy1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=BackupInstance -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.DataProtection/backupVaults/vault1/backupInstances/backupInstance1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/transition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/transition.go new file mode 100644 index 00000000000..f28fff4beb9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/transition.go @@ -0,0 +1,23 @@ +package dataprotection + +import "github.com/hashicorp/terraform-provider-azurerm/utils" + +func expandTags(input map[string]interface{}) *map[string]string { + output := make(map[string]string) + for k, v := range input { + output[k] = v.(string) + } + return &output +} + +func flattenTags(input *map[string]string) map[string]*string { + output := make(map[string]*string) + + if input != nil { + for k, v := range *input { + output[k] = utils.String(v) + } + } + + return output +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate/backup_instance_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate/backup_instance_id.go deleted file mode 100644 index 52a66795d02..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate/backup_instance_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse" -) - -func BackupInstanceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.BackupInstanceID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate/backup_policy_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate/backup_policy_id.go deleted file mode 100644 index 31b35c392b3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate/backup_policy_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse" -) - -func BackupPolicyID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.BackupPolicyID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate/backup_vault_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate/backup_vault_id.go deleted file mode 100644 index 0e7c5a727f1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate/backup_vault_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse" -) - -func BackupVaultID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.BackupVaultID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate/resource_guard_name.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate/resource_guard_name.go new file mode 100644 index 00000000000..111c21d5c2a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate/resource_guard_name.go @@ -0,0 +1,18 @@ +package validate + +import "fmt" + +func ResourceGuardName(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %q to be string", k)) + return warnings, errors + } + + if len(v) == 0 || len(v) > 260 { + errors = append(errors, fmt.Errorf("%s cannot be empty and must not exceed 260 characters", k)) + return warnings, errors + } + + return warnings, errors +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/data_share_account_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/data_share_account_data_source.go index 8399045c8e4..737bf54c4ba 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/data_share_account_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/data_share_account_data_source.go @@ -5,7 +5,6 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/validate" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/client/client.go index 3a2076d357e..96189869338 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/client/client.go @@ -1,55 +1,55 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - ApplicationGroupsClient *desktopvirtualization.ApplicationGroupsClient - ApplicationsClient *desktopvirtualization.ApplicationsClient - DesktopsClient *desktopvirtualization.DesktopsClient - HostPoolsClient *desktopvirtualization.HostPoolsClient - OperationsClient *desktopvirtualization.OperationsClient - SessionHostsClient *desktopvirtualization.SessionHostsClient - ScalingPlansClient *desktopvirtualization.ScalingPlansClient - WorkspacesClient *desktopvirtualization.WorkspacesClient + ApplicationGroupsClient *applicationgroup.ApplicationGroupClient + ApplicationsClient *application.ApplicationClient + DesktopsClient *desktop.DesktopClient + HostPoolsClient *hostpool.HostPoolClient + SessionHostsClient *sessionhost.SessionHostClient + ScalingPlansClient *scalingplan.ScalingPlanClient + WorkspacesClient *workspace.WorkspaceClient } -// NewClient - New client for desktop virtualization func NewClient(o *common.ClientOptions) *Client { - ApplicationGroupsClient := desktopvirtualization.NewApplicationGroupsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&ApplicationGroupsClient.Client, o.ResourceManagerAuthorizer) + applicationGroupsClient := applicationgroup.NewApplicationGroupClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&applicationGroupsClient.Client, o.ResourceManagerAuthorizer) - ApplicationsClient := desktopvirtualization.NewApplicationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&ApplicationsClient.Client, o.ResourceManagerAuthorizer) + applicationsClient := application.NewApplicationClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&applicationsClient.Client, o.ResourceManagerAuthorizer) - DesktopsClient := desktopvirtualization.NewDesktopsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&DesktopsClient.Client, o.ResourceManagerAuthorizer) + desktopsClient := desktop.NewDesktopClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&desktopsClient.Client, o.ResourceManagerAuthorizer) - HostPoolsClient := desktopvirtualization.NewHostPoolsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&HostPoolsClient.Client, o.ResourceManagerAuthorizer) + hostPoolsClient := hostpool.NewHostPoolClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&hostPoolsClient.Client, o.ResourceManagerAuthorizer) - OperationsClient := desktopvirtualization.NewOperationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&OperationsClient.Client, o.ResourceManagerAuthorizer) + sessionHostsClient := sessionhost.NewSessionHostClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&sessionHostsClient.Client, o.ResourceManagerAuthorizer) - SessionHostsClient := desktopvirtualization.NewSessionHostsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&SessionHostsClient.Client, o.ResourceManagerAuthorizer) + scalingPlansClient := scalingplan.NewScalingPlanClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&scalingPlansClient.Client, o.ResourceManagerAuthorizer) - ScalingPlansClient := desktopvirtualization.NewScalingPlansClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&ScalingPlansClient.Client, o.ResourceManagerAuthorizer) - - WorkspacesClient := desktopvirtualization.NewWorkspacesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&WorkspacesClient.Client, o.ResourceManagerAuthorizer) + workspacesClient := workspace.NewWorkspaceClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&workspacesClient.Client, o.ResourceManagerAuthorizer) return &Client{ - ApplicationGroupsClient: &ApplicationGroupsClient, - ApplicationsClient: &ApplicationsClient, - DesktopsClient: &DesktopsClient, - HostPoolsClient: &HostPoolsClient, - OperationsClient: &OperationsClient, - SessionHostsClient: &SessionHostsClient, - ScalingPlansClient: &ScalingPlansClient, - WorkspacesClient: &WorkspacesClient, + ApplicationGroupsClient: &applicationGroupsClient, + ApplicationsClient: &applicationsClient, + DesktopsClient: &desktopsClient, + HostPoolsClient: &hostPoolsClient, + SessionHostsClient: &sessionHostsClient, + ScalingPlansClient: &scalingPlansClient, + WorkspacesClient: &workspacesClient, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration/application_group_v0.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration/application_group_v0.go index 8548eefff1b..c493d41c076 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration/application_group_v0.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration/application_group_v0.go @@ -4,7 +4,8 @@ import ( "context" "log" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -66,7 +67,7 @@ func (ApplicationGroupV0ToV1) Schema() map[string]*pluginsdk.Schema { func (ApplicationGroupV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { oldId := rawState["id"].(string) - id, err := parse.ApplicationGroupIDInsensitively(oldId) + id, err := applicationgroup.ParseApplicationGroupIDInsensitively(oldId) if err != nil { return nil, err } @@ -75,7 +76,7 @@ func (ApplicationGroupV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { rawState["id"] = newId oldHostPoolId := rawState["host_pool_id"].(string) - hostPoolId, err := parse.HostPoolIDInsensitively(oldHostPoolId) + hostPoolId, err := hostpool.ParseHostPoolIDInsensitively(oldHostPoolId) if err != nil { return nil, err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration/host_pool_v0.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration/host_pool_v0.go index 7930dbccebf..9b69ed83750 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration/host_pool_v0.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration/host_pool_v0.go @@ -4,8 +4,8 @@ import ( "context" "log" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -106,7 +106,7 @@ func (HostPoolV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { oldId := rawState["id"].(string) - id, err := parse.HostPoolIDInsensitively(oldId) + id, err := hostpool.ParseHostPoolIDInsensitively(oldId) if err != nil { return nil, err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration/workspace_v0.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration/workspace_v0.go index 44bc8d016a2..85d5a2a0ec1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration/workspace_v0.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration/workspace_v0.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -56,7 +56,7 @@ func (WorkspaceV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { oldId := rawState["id"].(string) - id, err := parse.WorkspaceID(oldId) + id, err := workspace.ParseWorkspaceID(oldId) if err != nil { return nil, err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/application.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/application.go deleted file mode 100644 index b6cd6cbadf9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/application.go +++ /dev/null @@ -1,131 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ApplicationId struct { - SubscriptionId string - ResourceGroup string - ApplicationGroupName string - Name string -} - -func NewApplicationID(subscriptionId, resourceGroup, applicationGroupName, name string) ApplicationId { - return ApplicationId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ApplicationGroupName: applicationGroupName, - Name: name, - } -} - -func (id ApplicationId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Application Group Name %q", id.ApplicationGroupName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Application", segmentsStr) -} - -func (id ApplicationId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/applicationGroups/%s/applications/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ApplicationGroupName, id.Name) -} - -// ApplicationID parses a Application ID into an ApplicationId struct -func ApplicationID(input string) (*ApplicationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ApplicationId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ApplicationGroupName, err = id.PopSegment("applicationGroups"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("applications"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// ApplicationIDInsensitively parses an Application ID into an ApplicationId struct, insensitively -// This should only be used to parse an ID for rewriting, the ApplicationID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func ApplicationIDInsensitively(input string) (*ApplicationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ApplicationId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'applicationGroups' segment - applicationGroupsKey := "applicationGroups" - for key := range id.Path { - if strings.EqualFold(key, applicationGroupsKey) { - applicationGroupsKey = key - break - } - } - if resourceId.ApplicationGroupName, err = id.PopSegment(applicationGroupsKey); err != nil { - return nil, err - } - - // find the correct casing for the 'applications' segment - applicationsKey := "applications" - for key := range id.Path { - if strings.EqualFold(key, applicationsKey) { - applicationsKey = key - break - } - } - if resourceId.Name, err = id.PopSegment(applicationsKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/application_group.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/application_group.go deleted file mode 100644 index 4842c66bcd6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/application_group.go +++ /dev/null @@ -1,113 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ApplicationGroupId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewApplicationGroupID(subscriptionId, resourceGroup, name string) ApplicationGroupId { - return ApplicationGroupId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ApplicationGroupId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Application Group", segmentsStr) -} - -func (id ApplicationGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/applicationGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ApplicationGroupID parses a ApplicationGroup ID into an ApplicationGroupId struct -func ApplicationGroupID(input string) (*ApplicationGroupId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ApplicationGroupId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("applicationGroups"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// ApplicationGroupIDInsensitively parses an ApplicationGroup ID into an ApplicationGroupId struct, insensitively -// This should only be used to parse an ID for rewriting, the ApplicationGroupID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func ApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ApplicationGroupId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'applicationGroups' segment - applicationGroupsKey := "applicationGroups" - for key := range id.Path { - if strings.EqualFold(key, applicationGroupsKey) { - applicationGroupsKey = key - break - } - } - if resourceId.Name, err = id.PopSegment(applicationGroupsKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/host_pool.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/host_pool.go deleted file mode 100644 index 67e8e520716..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/host_pool.go +++ /dev/null @@ -1,113 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type HostPoolId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewHostPoolID(subscriptionId, resourceGroup, name string) HostPoolId { - return HostPoolId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id HostPoolId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Host Pool", segmentsStr) -} - -func (id HostPoolId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/hostPools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// HostPoolID parses a HostPool ID into an HostPoolId struct -func HostPoolID(input string) (*HostPoolId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := HostPoolId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("hostPools"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// HostPoolIDInsensitively parses an HostPool ID into an HostPoolId struct, insensitively -// This should only be used to parse an ID for rewriting, the HostPoolID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func HostPoolIDInsensitively(input string) (*HostPoolId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := HostPoolId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'hostPools' segment - hostPoolsKey := "hostPools" - for key := range id.Path { - if strings.EqualFold(key, hostPoolsKey) { - hostPoolsKey = key - break - } - } - if resourceId.Name, err = id.PopSegment(hostPoolsKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/scaling_plan.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/scaling_plan.go deleted file mode 100644 index 27bab2fc644..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/scaling_plan.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ScalingPlanId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewScalingPlanID(subscriptionId, resourceGroup, name string) ScalingPlanId { - return ScalingPlanId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ScalingPlanId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Scaling Plan", segmentsStr) -} - -func (id ScalingPlanId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/scalingPlans/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ScalingPlanID parses a ScalingPlan ID into an ScalingPlanId struct -func ScalingPlanID(input string) (*ScalingPlanId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ScalingPlanId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("scalingPlans"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/workspace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/workspace.go deleted file mode 100644 index 17f1d70cf22..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/workspace.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type WorkspaceId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewWorkspaceID(subscriptionId, resourceGroup, name string) WorkspaceId { - return WorkspaceId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id WorkspaceId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Workspace", segmentsStr) -} - -func (id WorkspaceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DesktopVirtualization/workspaces/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// WorkspaceID parses a Workspace ID into an WorkspaceId struct -func WorkspaceID(input string) (*WorkspaceId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := WorkspaceId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("workspaces"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/workspace_application_group_association.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/workspace_application_group_association.go index 238fcb082ab..a63eb02518e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/workspace_application_group_association.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse/workspace_application_group_association.go @@ -4,14 +4,16 @@ import ( "fmt" "strings" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace" "github.com/hashicorp/terraform-provider-azurerm/internal/resourceid" ) var _ resourceid.Formatter = WorkspaceApplicationGroupAssociationId{} type WorkspaceApplicationGroupAssociationId struct { - Workspace WorkspaceId - ApplicationGroup ApplicationGroupId + Workspace workspace.WorkspaceId + ApplicationGroup applicationgroup.ApplicationGroupId } func (id WorkspaceApplicationGroupAssociationId) ID() string { @@ -20,7 +22,7 @@ func (id WorkspaceApplicationGroupAssociationId) ID() string { return fmt.Sprintf("%s|%s", workspaceId, applicationGroupId) } -func NewWorkspaceApplicationGroupAssociationId(workspace WorkspaceId, applicationGroup ApplicationGroupId) WorkspaceApplicationGroupAssociationId { +func NewWorkspaceApplicationGroupAssociationId(workspace workspace.WorkspaceId, applicationGroup applicationgroup.ApplicationGroupId) WorkspaceApplicationGroupAssociationId { return WorkspaceApplicationGroupAssociationId{ Workspace: workspace, ApplicationGroup: applicationGroup, @@ -33,12 +35,12 @@ func WorkspaceApplicationGroupAssociationID(input string) (*WorkspaceApplication return nil, fmt.Errorf("expected an ID in the format {workspaceID}|{applicationGroupID} but got %q", input) } - workspaceId, err := WorkspaceID(segments[0]) + workspaceId, err := workspace.ParseWorkspaceID(segments[0]) if err != nil { return nil, fmt.Errorf("parsing Workspace ID for Workspace/Application Group Association %q: %+v", segments[0], err) } - applicationGroupId, err := ApplicationGroupID(segments[1]) + applicationGroupId, err := applicationgroup.ParseApplicationGroupID(segments[1]) if err != nil { return nil, fmt.Errorf("parsing Application Group ID for Workspace/Application Group Association %q: %+v", segments[1], err) } @@ -55,12 +57,12 @@ func WorkspaceApplicationGroupAssociationIDInsensitively(input string) (*Workspa return nil, fmt.Errorf("expected an ID in the format {workspaceID}|{applicationGroupID} but got %q", input) } - workspaceId, err := WorkspaceID(segments[0]) + workspaceId, err := workspace.ParseWorkspaceIDInsensitively(segments[0]) if err != nil { return nil, fmt.Errorf("parsing Workspace ID for Workspace/Application Group Association %q: %+v", segments[0], err) } - applicationGroupId, err := ApplicationGroupIDInsensitively(segments[1]) + applicationGroupId, err := applicationgroup.ParseApplicationGroupIDInsensitively(segments[1]) if err != nil { return nil, fmt.Errorf("parsing Application Group ID for Workspace/Application Group Association %q: %+v", segments[1], err) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/resourcesid.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/resourcesid.go index bdc39531133..2d0e0dfb93a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/resourcesid.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/resourcesid.go @@ -1,8 +1,3 @@ package desktopvirtualization -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ApplicationGroup -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1 -rewrite=true -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Application -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DesktopVirtualization/applicationGroups/applicationGroup1/applications/application1 -rewrite=true -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=HostPool -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DesktopVirtualization/hostPools/pool1 -rewrite=true -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Workspace -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DesktopVirtualization/workspaces/workspace1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ScalingPlan -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DesktopVirtualization/scalingPlans/plan1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=HostPoolRegistrationInfo -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DesktopVirtualization/hostPools/pool1/registrationInfo/default -rewrite=true diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/application_group_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/application_group_id.go deleted file mode 100644 index 587026669b2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/application_group_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" -) - -func ApplicationGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ApplicationGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/application_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/application_id.go deleted file mode 100644 index 6402094f94e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/application_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" -) - -func ApplicationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ApplicationID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/host_pool_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/host_pool_id.go deleted file mode 100644 index 6c3af7be094..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/host_pool_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" -) - -func HostPoolID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.HostPoolID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/host_pool_registration_info_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/host_pool_registration_info_id.go deleted file mode 100644 index aa4ddd74f36..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/host_pool_registration_info_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" -) - -func HostPoolRegistrationInfoID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.HostPoolRegistrationInfoID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/scaling_plan_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/scaling_plan_id.go deleted file mode 100644 index fe21bccfb1f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/scaling_plan_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" -) - -func ScalingPlanID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ScalingPlanID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/workspace_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/workspace_id.go deleted file mode 100644 index a1a33d87375..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate/workspace_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" -) - -func WorkspaceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.WorkspaceID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_application_group_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_application_group_resource.go index 639d2e83485..fce164d5d2a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_application_group_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_application_group_resource.go @@ -6,15 +6,18 @@ import ( "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -38,7 +41,7 @@ func resourceVirtualDesktopApplicationGroup() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApplicationGroupID(id) + _, err := applicationgroup.ParseApplicationGroupID(id) return err }), @@ -70,15 +73,15 @@ func resourceVirtualDesktopApplicationGroup() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(desktopvirtualization.ApplicationGroupTypeDesktop), - string(desktopvirtualization.ApplicationGroupTypeRemoteApp), + string(applicationgroup.ApplicationGroupTypeDesktop), + string(applicationgroup.ApplicationGroupTypeRemoteApp), }, false), }, "host_pool_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validate.HostPoolID, + ValidateFunc: hostpool.ValidateHostPoolID, }, "friendly_name": { @@ -99,7 +102,7 @@ func resourceVirtualDesktopApplicationGroup() *pluginsdk.Resource { ValidateFunc: validation.StringLenBetween(1, 512), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -119,62 +122,64 @@ func resourceVirtualDesktopApplicationGroupCreateUpdate(d *pluginsdk.ResourceDat ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - resourceId := parse.NewApplicationGroupID(subscriptionId, resourceGroup, name).ID() + id := applicationgroup.NewApplicationGroupID(subscriptionId, resourceGroup, name) if d.IsNewResource() { - existing, err := client.Get(ctx, resourceGroup, name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing Virtual Desktop Application Group %q (Resource Group %q): %s", name, resourceGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if existing.ApplicationGroupProperties != nil { - return tf.ImportAsExistsError("azurerm_virtual_desktop_application_group", resourceId) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_virtual_desktop_application_group", id.ID()) } } location := azure.NormalizeLocation(d.Get("location").(string)) t := d.Get("tags").(map[string]interface{}) - context := desktopvirtualization.ApplicationGroup{ + payload := applicationgroup.ApplicationGroup{ Location: &location, Tags: tags.Expand(t), - ApplicationGroupProperties: &desktopvirtualization.ApplicationGroupProperties{ - ApplicationGroupType: desktopvirtualization.ApplicationGroupType(d.Get("type").(string)), + Properties: applicationgroup.ApplicationGroupProperties{ + ApplicationGroupType: applicationgroup.ApplicationGroupType(d.Get("type").(string)), FriendlyName: utils.String(d.Get("friendly_name").(string)), Description: utils.String(d.Get("description").(string)), - HostPoolArmPath: utils.String(d.Get("host_pool_id").(string)), + HostPoolArmPath: d.Get("host_pool_id").(string), }, } - if _, err := client.CreateOrUpdate(ctx, resourceGroup, name, context); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, payload); err != nil { return fmt.Errorf("creating Virtual Desktop Application Group %q (Resource Group %q): %+v", name, resourceGroup, err) } - if desktopvirtualization.ApplicationGroupType(d.Get("type").(string)) == desktopvirtualization.ApplicationGroupTypeDesktop { + if applicationgroup.ApplicationGroupType(d.Get("type").(string)) == applicationgroup.ApplicationGroupTypeDesktop { if desktopFriendlyName := utils.String(d.Get("default_desktop_display_name").(string)); desktopFriendlyName != nil { desktopClient := meta.(*clients.Client).DesktopVirtualization.DesktopsClient // default desktop name created for Application Group is 'sessionDesktop' - desktop, err := desktopClient.Get(ctx, resourceGroup, name, "sessionDesktop") + desktopId := desktop.NewDesktopID(id.SubscriptionId, id.ResourceGroupName, id.ApplicationGroupName, "sessionDesktop") + model, err := desktopClient.Get(ctx, desktopId) if err != nil { - if !utils.ResponseWasNotFound(desktop.Response) { - return fmt.Errorf("checking for presence of default desktop in Application Group %q (Resource Group %q): %s", name, resourceGroup, err) + if !response.WasNotFound(model.HttpResponse) { + return fmt.Errorf("retrieving default desktop for %s: %+v", id, err) } } - desktopPatch := desktopvirtualization.DesktopPatch{ - DesktopPatchProperties: &desktopvirtualization.DesktopPatchProperties{ + desktopPatch := desktop.DesktopPatch{ + Properties: &desktop.DesktopPatchProperties{ FriendlyName: desktopFriendlyName, }, } - if _, err := desktopClient.Update(ctx, resourceGroup, name, "sessionDesktop", &desktopPatch); err != nil { - return fmt.Errorf("setting default desktop friendly name for Application Group %q (Resource Group %q): %+v", name, resourceGroup, err) + if _, err := desktopClient.Update(ctx, desktopId, desktopPatch); err != nil { + return fmt.Errorf("setting friendly name for default desktop %s: %+v", id, err) } } } - d.SetId(resourceId) + d.SetId(id.ID()) + return resourceVirtualDesktopApplicationGroupRead(d, meta) } @@ -183,75 +188,78 @@ func resourceVirtualDesktopApplicationGroupRead(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApplicationGroupID(d.Id()) + id, err := applicationgroup.ParseApplicationGroupID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Virtual Desktop Application Group %q was not found in Resource Group %q - removing from state!", id.Name, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Virtual Desktop Application Group %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.ApplicationGroupName) + d.Set("resource_group_name", id.ResourceGroupName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + + props := model.Properties - if props := resp.ApplicationGroupProperties; props != nil { d.Set("friendly_name", props.FriendlyName) d.Set("description", props.Description) d.Set("type", string(props.ApplicationGroupType)) - if props.ApplicationGroupType == desktopvirtualization.ApplicationGroupTypeDesktop { + defaultDesktopDisplayName := "" + if props.ApplicationGroupType == applicationgroup.ApplicationGroupTypeDesktop { desktopClient := meta.(*clients.Client).DesktopVirtualization.DesktopsClient // default desktop name created for Application Group is 'sessionDesktop' - desktop, err := desktopClient.Get(ctx, id.ResourceGroup, id.Name, "sessionDesktop") - // if the default desktop was found then set the display name attribute - if err == nil { - if desktopProps := desktop.DesktopProperties; desktopProps != nil { - d.Set("default_desktop_display_name", desktopProps.FriendlyName) + desktopId := desktop.NewDesktopID(id.SubscriptionId, id.ResourceGroupName, id.ApplicationGroupName, "sessionDesktop") + desktopResp, err := desktopClient.Get(ctx, desktopId) + if err != nil { + if !response.WasNotFound(desktopResp.HttpResponse) { + return fmt.Errorf("retrieving default desktop for %s: %+v", *id, err) } } - } - - hostPoolIdStr := "" - if props.HostPoolArmPath != nil { - hostPoolId, err := parse.HostPoolIDInsensitively(*props.HostPoolArmPath) - if err != nil { - return fmt.Errorf("parsing Host Pool ID %q: %+v", *props.HostPoolArmPath, err) + // if the default desktop was found then set the display name attribute + if desktopModel := desktopResp.Model; desktopModel != nil && desktopModel.Properties != nil && desktopModel.Properties.FriendlyName != nil { + defaultDesktopDisplayName = *desktopModel.Properties.FriendlyName } + } + d.Set("default_desktop_display_name", defaultDesktopDisplayName) - hostPoolIdStr = hostPoolId.ID() + hostPoolId, err := hostpool.ParseHostPoolIDInsensitively(props.HostPoolArmPath) + if err != nil { + return fmt.Errorf("parsing Host Pool ID %q: %+v", props.HostPoolArmPath, err) } - d.Set("host_pool_id", hostPoolIdStr) + d.Set("host_pool_id", hostPoolId.ID()) + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceVirtualDesktopApplicationGroupDelete(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).DesktopVirtualization.ApplicationGroupsClient - id, err := parse.ApplicationGroupID(d.Id()) + id, err := applicationgroup.ParseApplicationGroupID(d.Id()) if err != nil { return err } - locks.ByName(id.Name, applicationGroupType) - defer locks.UnlockByName(id.Name, applicationGroupType) + locks.ByName(id.ApplicationGroupName, applicationGroupType) + defer locks.UnlockByName(id.ApplicationGroupName, applicationGroupType) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - if _, err = client.Delete(ctx, id.ResourceGroup, id.Name); err != nil { - return fmt.Errorf("deleting Virtual Desktop Application Group %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if _, err = client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_application_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_application_resource.go index ce31660967c..b6846941f08 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_application_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_application_resource.go @@ -6,12 +6,12 @@ import ( "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -35,7 +35,7 @@ func resourceVirtualDesktopApplication() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApplicationID(id) + _, err := application.ParseApplicationID(id) return err }), @@ -59,7 +59,7 @@ func resourceVirtualDesktopApplication() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ApplicationGroupID, + ValidateFunc: applicationgroup.ValidateApplicationGroupID, }, "friendly_name": { @@ -84,9 +84,9 @@ func resourceVirtualDesktopApplication() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(desktopvirtualization.CommandLineSettingAllow), - string(desktopvirtualization.CommandLineSettingDoNotAllow), - string(desktopvirtualization.CommandLineSettingRequire), + string(application.CommandLineSettingAllow), + string(application.CommandLineSettingDoNotAllow), + string(application.CommandLineSettingRequire), }, false), }, @@ -120,47 +120,46 @@ func resourceVirtualDesktopApplicationCreateUpdate(d *pluginsdk.ResourceData, me log.Printf("[INFO] preparing arguments for Virtual Desktop Application creation") - name := d.Get("name").(string) - applicationGroup, _ := parse.ApplicationGroupID(d.Get("application_group_id").(string)) + applicationGroup, _ := applicationgroup.ParseApplicationGroupID(d.Get("application_group_id").(string)) + id := application.NewApplicationID(subscriptionId, applicationGroup.ResourceGroupName, applicationGroup.ApplicationGroupName, d.Get("name").(string)) - locks.ByName(name, applicationType) - defer locks.UnlockByName(name, applicationType) + locks.ByName(id.ApplicationName, applicationType) + defer locks.UnlockByName(id.ApplicationName, applicationType) ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - resourceId := parse.NewApplicationID(subscriptionId, applicationGroup.ResourceGroup, applicationGroup.Name, name).ID() if d.IsNewResource() { - existing, err := client.Get(ctx, applicationGroup.ResourceGroup, applicationGroup.Name, name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing Virtual Desktop Application %q (Application Group %q) (Resource Group %q): %s", name, applicationGroup.Name, applicationGroup.ResourceGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if existing.ApplicationProperties != nil { - return tf.ImportAsExistsError("azurerm_virtual_desktop_application", resourceId) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_virtual_desktop_application", id.ID()) } } - context := desktopvirtualization.Application{ - ApplicationProperties: &desktopvirtualization.ApplicationProperties{ + payload := application.Application{ + Properties: application.ApplicationProperties{ FriendlyName: utils.String(d.Get("friendly_name").(string)), Description: utils.String(d.Get("description").(string)), FilePath: utils.String(d.Get("path").(string)), - CommandLineSetting: desktopvirtualization.CommandLineSetting(d.Get("command_line_argument_policy").(string)), + CommandLineSetting: application.CommandLineSetting(d.Get("command_line_argument_policy").(string)), CommandLineArguments: utils.String(d.Get("command_line_arguments").(string)), ShowInPortal: utils.Bool(d.Get("show_in_portal").(bool)), IconPath: utils.String(d.Get("icon_path").(string)), - IconIndex: utils.Int32(int32(d.Get("icon_index").(int))), + IconIndex: utils.Int64(int64(d.Get("icon_index").(int))), }, } - if _, err := client.CreateOrUpdate(ctx, applicationGroup.ResourceGroup, applicationGroup.Name, name, context); err != nil { - return fmt.Errorf("creating Virtual Desktop Application %q (Application Group %q) (Resource Group %q): %+v", name, applicationGroup.Name, applicationGroup.ResourceGroup, err) + if _, err := client.CreateOrUpdate(ctx, id, payload); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - d.SetId(resourceId) + d.SetId(id.ID()) return resourceVirtualDesktopApplicationRead(d, meta) } @@ -169,36 +168,32 @@ func resourceVirtualDesktopApplicationRead(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApplicationID(d.Id()) + id, err := application.ParseApplicationID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ApplicationGroupName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Virtual Desktop Application %q was not found in Resource Group %q - removing from state!", id.Name, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Virtual Desktop Application %q (Application Group %q) (Resource Group %q): %+v", id.Name, id.ApplicationGroupName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - applicationGroup := parse.ApplicationGroupId{ - SubscriptionId: id.SubscriptionId, - ResourceGroup: id.ResourceGroup, - Name: id.ApplicationGroupName, - } + d.Set("name", id.ApplicationName) + d.Set("application_group_id", applicationgroup.NewApplicationGroupID(id.SubscriptionId, id.ResourceGroupName, id.ApplicationGroupName).ID()) - d.Set("name", id.Name) - d.Set("application_group_id", applicationGroup.ID()) + if model := resp.Model; model != nil { + props := model.Properties - if props := resp.ApplicationProperties; props != nil { d.Set("friendly_name", props.FriendlyName) d.Set("description", props.Description) d.Set("path", props.FilePath) - d.Set("command_line_argument_policy", props.CommandLineSetting) + d.Set("command_line_argument_policy", string(props.CommandLineSetting)) d.Set("command_line_arguments", props.CommandLineArguments) d.Set("show_in_portal", props.ShowInPortal) d.Set("icon_path", props.IconPath) @@ -211,18 +206,18 @@ func resourceVirtualDesktopApplicationRead(d *pluginsdk.ResourceData, meta inter func resourceVirtualDesktopApplicationDelete(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).DesktopVirtualization.ApplicationsClient - id, err := parse.ApplicationID(d.Id()) + id, err := application.ParseApplicationID(d.Id()) if err != nil { return err } - locks.ByName(id.Name, applicationType) - defer locks.UnlockByName(id.Name, applicationType) + locks.ByName(id.ApplicationName, applicationType) + defer locks.UnlockByName(id.ApplicationName, applicationType) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - if _, err = client.Delete(ctx, id.ResourceGroup, id.ApplicationGroupName, id.Name); err != nil { - return fmt.Errorf("deleting Virtual Desktop Application %q (Application Group %q) (Resource Group %q): %+v", id.Name, id.ApplicationGroupName, id.ResourceGroup, err) + if _, err = client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_host_pool_registration_info_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_host_pool_registration_info_resource.go index dfb2a0b42dd..16a4ce09d62 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_host_pool_registration_info_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_host_pool_registration_info_resource.go @@ -6,12 +6,11 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization" - "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -33,6 +32,7 @@ func resourceVirtualDesktopHostPoolRegistrationInfo() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + // TODO: we should refactor this to use the Host Pool ID instead, meaning we can remove this Virtual ID _, err := parse.HostPoolRegistrationInfoID(id) return err }), @@ -44,7 +44,7 @@ func resourceVirtualDesktopHostPoolRegistrationInfo() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.HostPoolID, + ValidateFunc: hostpool.ValidateHostPoolID, }, "expiration_date": { @@ -77,37 +77,36 @@ func resourceVirtualDesktopHostPoolRegistrationInfoCreateUpdate(d *pluginsdk.Res ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - hostpoolId, err := parse.HostPoolID(d.Get("hostpool_id").(string)) + hostPoolId, err := hostpool.ParseHostPoolID(d.Get("hostpool_id").(string)) if err != nil { return err } - locks.ByName(hostpoolId.Name, hostpoolResourceType) - defer locks.UnlockByName(hostpoolId.Name, hostpoolResourceType) + locks.ByName(hostPoolId.HostPoolName, hostPoolResourceType) + defer locks.UnlockByName(hostPoolId.HostPoolName, hostPoolResourceType) // This is a virtual resource so the last segment is hardcoded - id := parse.NewHostPoolRegistrationInfoID(hostpoolId.SubscriptionId, hostpoolId.ResourceGroup, hostpoolId.Name, "default") + id := parse.NewHostPoolRegistrationInfoID(hostPoolId.SubscriptionId, hostPoolId.ResourceGroupName, hostPoolId.HostPoolName, "default") - hostpool, err := client.Get(ctx, id.ResourceGroup, id.HostPoolName) + existing, err := client.Get(ctx, *hostPoolId) if err != nil { - if utils.ResponseWasNotFound(hostpool.Response) { - return fmt.Errorf("%s could not be found: %s", hostpoolId, err) + if response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("%s could not be found: %s", hostPoolId, err) } - return fmt.Errorf("reading %s: %s", hostpoolId, err) + return fmt.Errorf("reading %s: %s", hostPoolId, err) } - hostpoolPatch := &desktopvirtualization.HostPoolPatch{} - hostpoolPatch.HostPoolPatchProperties = &desktopvirtualization.HostPoolPatchProperties{} - hostpoolPatch.HostPoolPatchProperties.RegistrationInfo = &desktopvirtualization.RegistrationInfoPatch{} - - expdt, _ := date.ParseTime(time.RFC3339, d.Get("expiration_date").(string)) - hostpoolPatch.HostPoolPatchProperties.RegistrationInfo.ExpirationTime = &date.Time{ - Time: expdt, + tokenOperation := hostpool.RegistrationTokenOperationUpdate + payload := hostpool.HostPoolPatch{ + Properties: &hostpool.HostPoolPatchProperties{ + RegistrationInfo: &hostpool.RegistrationInfoPatch{ + ExpirationTime: utils.String(d.Get("expiration_date").(string)), + RegistrationTokenOperation: &tokenOperation, + }, + }, } - hostpoolPatch.HostPoolPatchProperties.RegistrationInfo.RegistrationTokenOperation = desktopvirtualization.RegistrationTokenOperationUpdate - - if _, err := client.Update(ctx, id.ResourceGroup, id.HostPoolName, hostpoolPatch); err != nil { - return fmt.Errorf("Creating Virtual Desktop Host Pool Registration Info %q (Resource Group %q): %+v", id.HostPoolName, id.ResourceGroup, err) + if _, err := client.Update(ctx, *hostPoolId, payload); err != nil { + return fmt.Errorf("updating registration token for %s: %+v", hostPoolId, err) } d.SetId(id.ID()) @@ -125,26 +124,27 @@ func resourceVirtualDesktopHostPoolRegistrationInfoRead(d *pluginsdk.ResourceDat return err } - resp, err := client.RetrieveRegistrationToken(ctx, id.ResourceGroup, id.HostPoolName) + hostPoolId := hostpool.NewHostPoolID(id.SubscriptionId, id.ResourceGroup, id.HostPoolName) + resp, err := client.RetrieveRegistrationToken(ctx, hostPoolId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Virtual Desktop Host Pool %q was not found in Resource Group %q - removing from state!", id.HostPoolName, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] Registration Token was not found for %s - removing from state!", hostPoolId) d.SetId("") return nil } - return fmt.Errorf("Making Read request on Virtual Desktop Host Pool %q (Resource Group %q): %+v", id.HostPoolName, id.ResourceGroup, err) + return fmt.Errorf("retrieving Registration Token for %s: %+v", hostPoolId, err) } - if resp.ExpirationTime == nil || resp.Token == nil { + if resp.Model == nil || resp.Model.ExpirationTime == nil || resp.Model.Token == nil { log.Printf("HostPool is missing registration info - marking as gone") d.SetId("") return nil } - d.Set("hostpool_id", parse.NewHostPoolID(id.SubscriptionId, id.ResourceGroup, id.HostPoolName).ID()) - d.Set("expiration_date", resp.ExpirationTime.Format(time.RFC3339)) - d.Set("token", resp.Token) + d.Set("hostpool_id", hostPoolId.ID()) + d.Set("expiration_date", resp.Model.ExpirationTime) + d.Set("token", resp.Model.Token) return nil } @@ -159,44 +159,48 @@ func resourceVirtualDesktopHostPoolRegistrationInfoDelete(d *pluginsdk.ResourceD return err } - hostpoolId := parse.NewHostPoolID(id.SubscriptionId, id.ResourceGroup, id.HostPoolName) + hostPoolId := hostpool.NewHostPoolID(id.SubscriptionId, id.ResourceGroup, id.HostPoolName) - locks.ByName(hostpoolId.Name, hostpoolResourceType) - defer locks.UnlockByName(hostpoolId.Name, hostpoolResourceType) + locks.ByName(hostPoolId.HostPoolName, hostPoolResourceType) + defer locks.UnlockByName(hostPoolId.HostPoolName, hostPoolResourceType) - resp, err := client.Get(ctx, id.ResourceGroup, id.HostPoolName) + resp, err := client.Get(ctx, hostPoolId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Virtual Desktop Host Pool %q was not found in Resource Group %q - removing from state!", id.HostPoolName, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", hostPoolId) d.SetId("") return nil } - return fmt.Errorf("Making Read request on Virtual Desktop Host Pool %q (Resource Group %q): %+v", id.HostPoolName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", hostPoolId, err) } - regInfo, err := client.RetrieveRegistrationToken(ctx, id.ResourceGroup, id.HostPoolName) + regInfo, err := client.RetrieveRegistrationToken(ctx, hostPoolId) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] Virtual Desktop Host Pool %q Registration Info was not found in Resource Group %q - removing from state!", id.HostPoolName, id.ResourceGroup) d.SetId("") return nil } - return fmt.Errorf("Making Read request on Virtual Desktop Host Pool %q (Resource Group %q): %+v", id.HostPoolName, id.ResourceGroup, err) + return fmt.Errorf("retrieving Registration Token for %s: %+v", hostPoolId, err) } - if regInfo.ExpirationTime == nil { - log.Printf("[INFO] RegistrationInfo for %s was nil, registrationInfo already deleted - removing %s from state", hostpoolId.ID(), id) + if regInfo.Model == nil || regInfo.Model.ExpirationTime == nil { + log.Printf("[INFO] RegistrationInfo for %s was nil, registrationInfo already deleted - removing from state", hostPoolId) return nil } - hostpoolPatch := &desktopvirtualization.HostPoolPatch{} - hostpoolPatch.HostPoolPatchProperties = &desktopvirtualization.HostPoolPatchProperties{} - hostpoolPatch.HostPoolPatchProperties.RegistrationInfo = &desktopvirtualization.RegistrationInfoPatch{} - hostpoolPatch.HostPoolPatchProperties.RegistrationInfo.RegistrationTokenOperation = desktopvirtualization.RegistrationTokenOperationDelete + tokenOperation := hostpool.RegistrationTokenOperationDelete + payload := hostpool.HostPoolPatch{ + Properties: &hostpool.HostPoolPatchProperties{ + RegistrationInfo: &hostpool.RegistrationInfoPatch{ + RegistrationTokenOperation: &tokenOperation, + }, + }, + } - if _, err := client.Update(ctx, id.ResourceGroup, id.HostPoolName, hostpoolPatch); err != nil { - return fmt.Errorf("deleting Virtual Desktop Host Pool Registration Info %q (Resource Group %q): %+v", id.HostPoolName, id.ResourceGroup, err) + if _, err := client.Update(ctx, hostPoolId, payload); err != nil { + return fmt.Errorf("removing Registration Token from %s: %+v", hostPoolId, err) } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_host_pool_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_host_pool_resource.go index b7c8422ccdc..5133c426912 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_host_pool_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_host_pool_resource.go @@ -5,22 +5,23 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" ) -var hostpoolResourceType = "azurerm_virtual_desktop_host_pool" +var hostPoolResourceType = "azurerm_virtual_desktop_host_pool" func resourceVirtualDesktopHostPool() *pluginsdk.Resource { return &pluginsdk.Resource{ @@ -37,7 +38,7 @@ func resourceVirtualDesktopHostPool() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.HostPoolID(id) + _, err := hostpool.ParseHostPoolID(id) return err }), @@ -63,8 +64,8 @@ func resourceVirtualDesktopHostPool() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(desktopvirtualization.HostPoolTypePersonal), - string(desktopvirtualization.HostPoolTypePooled), + string(hostpool.HostPoolTypePersonal), + string(hostpool.HostPoolTypePooled), }, false), }, @@ -73,9 +74,9 @@ func resourceVirtualDesktopHostPool() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(desktopvirtualization.LoadBalancerTypeBreadthFirst), - string(desktopvirtualization.LoadBalancerTypeDepthFirst), - string(desktopvirtualization.LoadBalancerTypePersistent), + string(hostpool.LoadBalancerTypeBreadthFirst), + string(hostpool.LoadBalancerTypeDepthFirst), + string(hostpool.LoadBalancerTypePersistent), }, false), }, @@ -107,8 +108,8 @@ func resourceVirtualDesktopHostPool() *pluginsdk.Resource { Optional: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(desktopvirtualization.PersonalDesktopAssignmentTypeAutomatic), - string(desktopvirtualization.PersonalDesktopAssignmentTypeDirect), + string(hostpool.PersonalDesktopAssignmentTypeAutomatic), + string(hostpool.PersonalDesktopAssignmentTypeDirect), }, false), }, @@ -131,14 +132,14 @@ func resourceVirtualDesktopHostPool() *pluginsdk.Resource { ForceNew: true, Description: "Preferred App Group type to display", ValidateFunc: validation.StringInSlice([]string{ - string(desktopvirtualization.PreferredAppGroupTypeDesktop), - string(desktopvirtualization.PreferredAppGroupTypeNone), - string(desktopvirtualization.PreferredAppGroupTypeRailApplications), + string(hostpool.PreferredAppGroupTypeDesktop), + string(hostpool.PreferredAppGroupTypeNone), + string(hostpool.PreferredAppGroupTypeRailApplications), }, false), - Default: string(desktopvirtualization.PreferredAppGroupTypeDesktop), + Default: string(hostpool.PreferredAppGroupTypeDesktop), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -149,36 +150,37 @@ func resourceVirtualDesktopHostPoolCreate(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewHostPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := hostpool.NewHostPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_virtual_desktop_host_pool", id.ID()) } - context := desktopvirtualization.HostPool{ + personalDesktopAssignmentType := hostpool.PersonalDesktopAssignmentType(d.Get("personal_desktop_assignment_type").(string)) + payload := hostpool.HostPool{ Location: utils.String(location.Normalize(d.Get("location").(string))), Tags: tags.Expand(d.Get("tags").(map[string]interface{})), - HostPoolProperties: &desktopvirtualization.HostPoolProperties{ - HostPoolType: desktopvirtualization.HostPoolType(d.Get("type").(string)), + Properties: hostpool.HostPoolProperties{ + HostPoolType: hostpool.HostPoolType(d.Get("type").(string)), FriendlyName: utils.String(d.Get("friendly_name").(string)), Description: utils.String(d.Get("description").(string)), ValidationEnvironment: utils.Bool(d.Get("validate_environment").(bool)), CustomRdpProperty: utils.String(d.Get("custom_rdp_properties").(string)), - MaxSessionLimit: utils.Int32(int32(d.Get("maximum_sessions_allowed").(int))), + MaxSessionLimit: utils.Int64(int64(d.Get("maximum_sessions_allowed").(int))), StartVMOnConnect: utils.Bool(d.Get("start_vm_on_connect").(bool)), - LoadBalancerType: desktopvirtualization.LoadBalancerType(d.Get("load_balancer_type").(string)), - PersonalDesktopAssignmentType: desktopvirtualization.PersonalDesktopAssignmentType(d.Get("personal_desktop_assignment_type").(string)), - PreferredAppGroupType: desktopvirtualization.PreferredAppGroupType(d.Get("preferred_app_group_type").(string)), + LoadBalancerType: hostpool.LoadBalancerType(d.Get("load_balancer_type").(string)), + PersonalDesktopAssignmentType: &personalDesktopAssignmentType, + PreferredAppGroupType: hostpool.PreferredAppGroupType(d.Get("preferred_app_group_type").(string)), }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, context); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, payload); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -191,53 +193,54 @@ func resourceVirtualDesktopHostPoolUpdate(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.HostPoolID(d.Id()) + id, err := hostpool.ParseHostPoolID(d.Id()) if err != nil { return err } - locks.ByName(id.Name, hostpoolResourceType) - defer locks.UnlockByName(id.Name, hostpoolResourceType) + locks.ByName(id.HostPoolName, hostPoolResourceType) + defer locks.UnlockByName(id.HostPoolName, hostPoolResourceType) - update := &desktopvirtualization.HostPoolPatch{} + payload := hostpool.HostPoolPatch{} if d.HasChange("tags") { - update.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) + payload.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) } if d.HasChanges("custom_rdp_properties", "description", "friendly_name", "maximum_sessions_allowed", "preferred_app_group_type", "start_vm_on_connect", "validate_environment") { - update.HostPoolPatchProperties = &desktopvirtualization.HostPoolPatchProperties{} + payload.Properties = &hostpool.HostPoolPatchProperties{} if d.HasChange("custom_rdp_properties") { - update.HostPoolPatchProperties.CustomRdpProperty = utils.String(d.Get("custom_rdp_properties").(string)) + payload.Properties.CustomRdpProperty = utils.String(d.Get("custom_rdp_properties").(string)) } if d.HasChange("description") { - update.HostPoolPatchProperties.Description = utils.String(d.Get("description").(string)) + payload.Properties.Description = utils.String(d.Get("description").(string)) } if d.HasChange("friendly_name") { - update.HostPoolPatchProperties.FriendlyName = utils.String(d.Get("friendly_name").(string)) + payload.Properties.FriendlyName = utils.String(d.Get("friendly_name").(string)) } if d.HasChange("maximum_sessions_allowed") { - update.HostPoolPatchProperties.MaxSessionLimit = utils.Int32(int32(d.Get("maximum_sessions_allowed").(int))) + payload.Properties.MaxSessionLimit = utils.Int64(int64(d.Get("maximum_sessions_allowed").(int))) } if d.HasChange("preferred_app_group_type") { - update.HostPoolPatchProperties.PreferredAppGroupType = desktopvirtualization.PreferredAppGroupType(d.Get("preferred_app_group_type").(string)) + preferredAppGroupType := hostpool.PreferredAppGroupType(d.Get("preferred_app_group_type").(string)) + payload.Properties.PreferredAppGroupType = &preferredAppGroupType } if d.HasChange("start_vm_on_connect") { - update.HostPoolPatchProperties.StartVMOnConnect = utils.Bool(d.Get("start_vm_on_connect").(bool)) + payload.Properties.StartVMOnConnect = utils.Bool(d.Get("start_vm_on_connect").(bool)) } if d.HasChange("validate_environment") { - update.HostPoolPatchProperties.ValidationEnvironment = utils.Bool(d.Get("validate_environment").(bool)) + payload.Properties.ValidationEnvironment = utils.Bool(d.Get("validate_environment").(bool)) } } - if _, err := client.Update(ctx, id.ResourceGroup, id.Name, update); err != nil { + if _, err := client.Update(ctx, *id, payload); err != nil { return fmt.Errorf("updating %s: %+v", id, err) } @@ -249,14 +252,14 @@ func resourceVirtualDesktopHostPoolRead(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.HostPoolID(d.Id()) + id, err := hostpool.ParseHostPoolID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -265,11 +268,16 @@ func resourceVirtualDesktopHostPoolRead(d *pluginsdk.ResourceData, meta interfac return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.HostPoolName) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.HostPoolProperties; props != nil { + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } + + props := model.Properties maxSessionLimit := 0 if props.MaxSessionLimit != nil { maxSessionLimit = int(*props.MaxSessionLimit) @@ -280,14 +288,18 @@ func resourceVirtualDesktopHostPoolRead(d *pluginsdk.ResourceData, meta interfac d.Set("friendly_name", props.FriendlyName) d.Set("maximum_sessions_allowed", maxSessionLimit) d.Set("load_balancer_type", string(props.LoadBalancerType)) - d.Set("personal_desktop_assignment_type", string(props.PersonalDesktopAssignmentType)) + personalDesktopAssignmentType := "" + if props.PersonalDesktopAssignmentType != nil { + personalDesktopAssignmentType = string(*props.PersonalDesktopAssignmentType) + } + d.Set("personal_desktop_assignment_type", personalDesktopAssignmentType) d.Set("preferred_app_group_type", string(props.PreferredAppGroupType)) d.Set("start_vm_on_connect", props.StartVMOnConnect) d.Set("type", string(props.HostPoolType)) d.Set("validate_environment", props.ValidationEnvironment) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceVirtualDesktopHostPoolDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -295,17 +307,18 @@ func resourceVirtualDesktopHostPoolDelete(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.HostPoolID(d.Id()) - - locks.ByName(id.Name, hostpoolResourceType) - defer locks.UnlockByName(id.Name, hostpoolResourceType) - + id, err := hostpool.ParseHostPoolID(d.Id()) if err != nil { return err } - forceDeleteSessionHost := utils.Bool(true) - if _, err = client.Delete(ctx, id.ResourceGroup, id.Name, forceDeleteSessionHost); err != nil { + locks.ByName(id.HostPoolName, hostPoolResourceType) + defer locks.UnlockByName(id.HostPoolName, hostPoolResourceType) + + options := hostpool.DeleteOperationOptions{ + Force: utils.Bool(true), + } + if _, err = client.Delete(ctx, *id, options); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_scaling_plan_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_scaling_plan_resource.go index 7ebfa0a73ee..4789161e4e6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_scaling_plan_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_scaling_plan_resource.go @@ -8,13 +8,15 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -36,7 +38,7 @@ func resourceVirtualDesktopScalingPlan() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ScalingPlanID(id) + _, err := scalingplan.ParseScalingPlanID(id) return err }), @@ -92,13 +94,13 @@ func resourceVirtualDesktopScalingPlan() *pluginsdk.Resource { Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, ValidateFunc: validation.StringInSlice([]string{ - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday", - "Sunday", + string(scalingplan.DaysOfWeekMonday), + string(scalingplan.DaysOfWeekTuesday), + string(scalingplan.DaysOfWeekWednesday), + string(scalingplan.DaysOfWeekThursday), + string(scalingplan.DaysOfWeekFriday), + string(scalingplan.DaysOfWeekSaturday), + string(scalingplan.DaysOfWeekSunday), }, false), }, }, @@ -113,8 +115,8 @@ func resourceVirtualDesktopScalingPlan() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(desktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - string(desktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), + string(scalingplan.SessionHostLoadBalancingAlgorithmBreadthFirst), + string(scalingplan.SessionHostLoadBalancingAlgorithmDepthFirst), }, false), }, @@ -140,8 +142,8 @@ func resourceVirtualDesktopScalingPlan() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(desktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - string(desktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), + string(scalingplan.SessionHostLoadBalancingAlgorithmBreadthFirst), + string(scalingplan.SessionHostLoadBalancingAlgorithmDepthFirst), }, false), }, @@ -155,8 +157,8 @@ func resourceVirtualDesktopScalingPlan() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(desktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - string(desktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), + string(scalingplan.SessionHostLoadBalancingAlgorithmBreadthFirst), + string(scalingplan.SessionHostLoadBalancingAlgorithmDepthFirst), }, false), }, @@ -181,8 +183,8 @@ func resourceVirtualDesktopScalingPlan() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(desktopvirtualization.StopHostsWhenZeroActiveSessions), - string(desktopvirtualization.StopHostsWhenZeroSessions), + string(scalingplan.StopHostsWhenZeroActiveSessions), + string(scalingplan.StopHostsWhenZeroSessions), }, false), }, @@ -206,8 +208,8 @@ func resourceVirtualDesktopScalingPlan() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(desktopvirtualization.SessionHostLoadBalancingAlgorithmBreadthFirst), - string(desktopvirtualization.SessionHostLoadBalancingAlgorithmDepthFirst), + string(scalingplan.SessionHostLoadBalancingAlgorithmBreadthFirst), + string(scalingplan.SessionHostLoadBalancingAlgorithmDepthFirst), }, false), }, }, @@ -222,7 +224,7 @@ func resourceVirtualDesktopScalingPlan() *pluginsdk.Resource { "hostpool_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validate.HostPoolID, + ValidateFunc: hostpool.ValidateHostPoolID, }, "scaling_plan_enabled": { Type: pluginsdk.TypeBool, @@ -232,7 +234,7 @@ func resourceVirtualDesktopScalingPlan() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -249,39 +251,40 @@ func resourceVirtualDesktopScalingPlanCreate(d *pluginsdk.ResourceData, meta int log.Printf("[INFO] preparing arguments for Virtual Desktop Scaling Plan create") - id := parse.NewScalingPlanID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := scalingplan.NewScalingPlanID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s): %+v", id, err) } } - if existing.ScalingPlanProperties != nil { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_virtual_desktop_scaling_plan", id.ID()) } } - location := azure.NormalizeLocation(d.Get("location").(string)) + location := location.Normalize(d.Get("location").(string)) t := d.Get("tags").(map[string]interface{}) - context := desktopvirtualization.ScalingPlan{ + hostPoolType := scalingplan.ScalingHostPoolTypePooled // Only one possible value for this + payload := scalingplan.ScalingPlan{ Name: utils.String(d.Get("name").(string)), Location: &location, Tags: tags.Expand(t), - ScalingPlanProperties: &desktopvirtualization.ScalingPlanProperties{ + Properties: &scalingplan.ScalingPlanProperties{ Description: utils.String(d.Get("description").(string)), FriendlyName: utils.String(d.Get("friendly_name").(string)), TimeZone: utils.String(d.Get("time_zone").(string)), - HostPoolType: desktopvirtualization.ScalingHostPoolTypePooled, // Only one possible value for this + HostPoolType: &hostPoolType, ExclusionTag: utils.String(d.Get("exclusion_tag").(string)), Schedules: expandScalingPlanSchedule(d.Get("schedule").([]interface{})), HostPoolReferences: expandScalingPlanHostpoolReference(d.Get("host_pool").([]interface{})), }, } - if _, err := client.Create(ctx, id.ResourceGroup, id.Name, context); err != nil { + if _, err := client.Create(ctx, id, payload); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -297,16 +300,16 @@ func resourceVirtualDesktopScalingPlanUpdate(d *pluginsdk.ResourceData, meta int log.Printf("[INFO] preparing arguments for Virtual Desktop Scaling Plan update") - id, err := parse.ScalingPlanID(d.Id()) + id, err := scalingplan.ParseScalingPlanID(d.Id()) if err != nil { return err } t := d.Get("tags").(map[string]interface{}) - context := desktopvirtualization.ScalingPlanPatch{ + payload := scalingplan.ScalingPlanPatch{ Tags: tags.Expand(t), - ScalingPlanPatchProperties: &desktopvirtualization.ScalingPlanPatchProperties{ + Properties: &scalingplan.ScalingPlanPatchProperties{ Description: utils.String(d.Get("description").(string)), FriendlyName: utils.String(d.Get("friendly_name").(string)), TimeZone: utils.String(d.Get("time_zone").(string)), @@ -316,7 +319,7 @@ func resourceVirtualDesktopScalingPlanUpdate(d *pluginsdk.ResourceData, meta int }, } - if _, err := client.Update(ctx, id.ResourceGroup, id.Name, &context); err != nil { + if _, err := client.Update(ctx, *id, payload); err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } @@ -328,14 +331,14 @@ func resourceVirtualDesktopScalingPlanRead(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ScalingPlanID(d.Id()) + id, err := scalingplan.ParseScalingPlanID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", id) d.SetId("") return nil @@ -343,22 +346,27 @@ func resourceVirtualDesktopScalingPlanRead(d *pluginsdk.ResourceData, meta inter return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + d.Set("name", id.ScalingPlanName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + + if props := model.Properties; props != nil { + d.Set("description", props.Description) + d.Set("friendly_name", props.FriendlyName) + d.Set("time_zone", props.TimeZone) + d.Set("exclusion_tag", props.ExclusionTag) + d.Set("schedule", flattenScalingPlanSchedule(props.Schedules)) + d.Set("host_pool", flattenScalingHostpoolReference(props.HostPoolReferences)) + } - if props := resp.ScalingPlanProperties; props != nil { - d.Set("description", props.Description) - d.Set("friendly_name", props.FriendlyName) - d.Set("time_zone", props.TimeZone) - d.Set("exclusion_tag", props.ExclusionTag) - d.Set("schedule", flattenScalingPlanSchedule(props.Schedules)) - d.Set("host_pool", flattenScalingHostpoolReference(props.HostPoolReferences)) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceVirtualDesktopScalingPlanDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -366,24 +374,24 @@ func resourceVirtualDesktopScalingPlanDelete(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ScalingPlanID(d.Id()) + id, err := scalingplan.ParseScalingPlanID(d.Id()) if err != nil { return err } - if _, err = client.Delete(ctx, id.ResourceGroup, id.Name); err != nil { + if _, err = client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } -func expandScalingPlanSchedule(input []interface{}) *[]desktopvirtualization.ScalingSchedule { +func expandScalingPlanSchedule(input []interface{}) *[]scalingplan.ScalingSchedule { if len(input) == 0 { return nil } - results := make([]desktopvirtualization.ScalingSchedule, 0) + results := make([]scalingplan.ScalingSchedule, 0) for _, item := range input { if item == nil { continue @@ -391,50 +399,55 @@ func expandScalingPlanSchedule(input []interface{}) *[]desktopvirtualization.Sca v := item.(map[string]interface{}) name := v["name"].(string) - daysOfWeek := v["days_of_week"].(*pluginsdk.Set).List() + daysOfWeekRaw := v["days_of_week"].(*pluginsdk.Set).List() + daysOfWeek := make([]scalingplan.DaysOfWeek, 0) + for _, weekday := range daysOfWeekRaw { + daysOfWeek = append(daysOfWeek, scalingplan.DaysOfWeek(weekday.(string))) + } + rampUpStartTime := v["ramp_up_start_time"].(string) - rampUpLoadBalancingAlgorithm := v["ramp_up_load_balancing_algorithm"].(string) + rampUpLoadBalancingAlgorithm := scalingplan.SessionHostLoadBalancingAlgorithm(v["ramp_up_load_balancing_algorithm"].(string)) rampUpMinimumHostsPct := v["ramp_up_minimum_hosts_percent"].(int) rampUpCapacityThresholdPct := v["ramp_up_capacity_threshold_percent"].(int) peakStartTime := v["peak_start_time"].(string) - peakLoadBalancingAlgorithm := v["peak_load_balancing_algorithm"].(string) + peakLoadBalancingAlgorithm := scalingplan.SessionHostLoadBalancingAlgorithm(v["peak_load_balancing_algorithm"].(string)) rampDownStartTime := v["ramp_down_start_time"].(string) - rampDownLoadBalancingAlgorithm := v["ramp_down_load_balancing_algorithm"].(string) + rampDownLoadBalancingAlgorithm := scalingplan.SessionHostLoadBalancingAlgorithm(v["ramp_down_load_balancing_algorithm"].(string)) rampDownMinimumHostsPct := v["ramp_down_minimum_hosts_percent"].(int) rampDownCapacityThresholdPct := v["ramp_down_capacity_threshold_percent"].(int) rampDownForceLogoffUsers := v["ramp_down_force_logoff_users"].(bool) - rampDownStopHostsWhen := v["ramp_down_stop_hosts_when"].(string) + rampDownStopHostsWhen := scalingplan.StopHostsWhen(v["ramp_down_stop_hosts_when"].(string)) rampDownWaitTimeMinutes := v["ramp_down_wait_time_minutes"].(int) rampDownNotificationMessage := v["ramp_down_notification_message"].(string) offPeakStartTime := v["off_peak_start_time"].(string) - offPeakLoadBalancingAlgorithm := v["off_peak_load_balancing_algorithm"].(string) + offPeakLoadBalancingAlgorithm := scalingplan.SessionHostLoadBalancingAlgorithm(v["off_peak_load_balancing_algorithm"].(string)) - results = append(results, desktopvirtualization.ScalingSchedule{ + results = append(results, scalingplan.ScalingSchedule{ Name: utils.String(name), - DaysOfWeek: utils.ExpandStringSlice(daysOfWeek), + DaysOfWeek: &daysOfWeek, RampUpStartTime: expandScalingPlanScheduleTime(rampUpStartTime), - RampUpLoadBalancingAlgorithm: desktopvirtualization.SessionHostLoadBalancingAlgorithm(rampUpLoadBalancingAlgorithm), - RampUpMinimumHostsPct: utils.Int32(int32(rampUpMinimumHostsPct)), - RampUpCapacityThresholdPct: utils.Int32(int32(rampUpCapacityThresholdPct)), + RampUpLoadBalancingAlgorithm: &rampUpLoadBalancingAlgorithm, + RampUpMinimumHostsPct: utils.Int64(int64(rampUpMinimumHostsPct)), + RampUpCapacityThresholdPct: utils.Int64(int64(rampUpCapacityThresholdPct)), PeakStartTime: expandScalingPlanScheduleTime(peakStartTime), - PeakLoadBalancingAlgorithm: desktopvirtualization.SessionHostLoadBalancingAlgorithm(peakLoadBalancingAlgorithm), + PeakLoadBalancingAlgorithm: &peakLoadBalancingAlgorithm, RampDownStartTime: expandScalingPlanScheduleTime(rampDownStartTime), - RampDownLoadBalancingAlgorithm: desktopvirtualization.SessionHostLoadBalancingAlgorithm(rampDownLoadBalancingAlgorithm), - RampDownMinimumHostsPct: utils.Int32(int32(rampDownMinimumHostsPct)), - RampDownCapacityThresholdPct: utils.Int32(int32(rampDownCapacityThresholdPct)), + RampDownLoadBalancingAlgorithm: &rampDownLoadBalancingAlgorithm, + RampDownMinimumHostsPct: utils.Int64(int64(rampDownMinimumHostsPct)), + RampDownCapacityThresholdPct: utils.Int64(int64(rampDownCapacityThresholdPct)), RampDownForceLogoffUsers: utils.Bool(rampDownForceLogoffUsers), - RampDownStopHostsWhen: desktopvirtualization.StopHostsWhen(rampDownStopHostsWhen), - RampDownWaitTimeMinutes: utils.Int32(int32(rampDownWaitTimeMinutes)), + RampDownStopHostsWhen: &rampDownStopHostsWhen, + RampDownWaitTimeMinutes: utils.Int64(int64(rampDownWaitTimeMinutes)), RampDownNotificationMessage: utils.String(rampDownNotificationMessage), OffPeakStartTime: expandScalingPlanScheduleTime(offPeakStartTime), - OffPeakLoadBalancingAlgorithm: desktopvirtualization.SessionHostLoadBalancingAlgorithm(offPeakLoadBalancingAlgorithm), + OffPeakLoadBalancingAlgorithm: &offPeakLoadBalancingAlgorithm, }) } return &results } -func expandScalingPlanScheduleTime(input string) *desktopvirtualization.Time { +func expandScalingPlanScheduleTime(input string) *scalingplan.Time { if len(input) == 0 { return nil } @@ -443,18 +456,18 @@ func expandScalingPlanScheduleTime(input string) *desktopvirtualization.Time { hour, _ := strconv.Atoi(time[0]) minute, _ := strconv.Atoi(time[1]) - return &desktopvirtualization.Time{ - Hour: utils.Int32(int32(hour)), - Minute: utils.Int32(int32(minute)), + return &scalingplan.Time{ + Hour: int64(hour), + Minute: int64(minute), } } -func expandScalingPlanHostpoolReference(input []interface{}) *[]desktopvirtualization.ScalingHostPoolReference { +func expandScalingPlanHostpoolReference(input []interface{}) *[]scalingplan.ScalingHostPoolReference { if len(input) == 0 { return nil } - results := make([]desktopvirtualization.ScalingHostPoolReference, 0) + results := make([]scalingplan.ScalingHostPoolReference, 0) for _, item := range input { if item == nil { continue @@ -464,7 +477,7 @@ func expandScalingPlanHostpoolReference(input []interface{}) *[]desktopvirtualiz hostPoolArmPath := v["hostpool_id"].(string) scalingPlanEnabled := v["scaling_plan_enabled"].(bool) - results = append(results, desktopvirtualization.ScalingHostPoolReference{ + results = append(results, scalingplan.ScalingHostPoolReference{ HostPoolArmPath: utils.String(hostPoolArmPath), ScalingPlanEnabled: utils.Bool(scalingPlanEnabled), }) @@ -472,7 +485,7 @@ func expandScalingPlanHostpoolReference(input []interface{}) *[]desktopvirtualiz return &results } -func flattenScalingPlanSchedule(input *[]desktopvirtualization.ScalingSchedule) []interface{} { +func flattenScalingPlanSchedule(input *[]scalingplan.ScalingSchedule) []interface{} { results := make([]interface{}, 0) if input == nil { return results @@ -484,30 +497,30 @@ func flattenScalingPlanSchedule(input *[]desktopvirtualization.ScalingSchedule) name = *item.Name } rampUpStartTime := "" - if item.RampUpStartTime != nil && item.RampUpStartTime.Hour != nil && item.RampUpStartTime.Minute != nil { - rampUpStartTime = fmt.Sprintf("%02d:%02d", *item.RampUpStartTime.Hour, *item.RampUpStartTime.Minute) + if item.RampUpStartTime != nil { + rampUpStartTime = fmt.Sprintf("%02d:%02d", item.RampUpStartTime.Hour, item.RampUpStartTime.Minute) } - rampUpMinimumHostsPct := int32(0) + rampUpMinimumHostsPct := int64(0) if item.RampUpMinimumHostsPct != nil { rampUpMinimumHostsPct = *item.RampUpMinimumHostsPct } - rampUpCapacityThresholdPct := int32(0) + rampUpCapacityThresholdPct := int64(0) if item.RampUpCapacityThresholdPct != nil { rampUpCapacityThresholdPct = *item.RampUpCapacityThresholdPct } peakStartTime := "" - if item.PeakStartTime != nil && item.PeakStartTime.Hour != nil && item.PeakStartTime.Minute != nil { - peakStartTime = fmt.Sprintf("%02d:%02d", *item.PeakStartTime.Hour, *item.PeakStartTime.Minute) + if item.PeakStartTime != nil { + peakStartTime = fmt.Sprintf("%02d:%02d", item.PeakStartTime.Hour, item.PeakStartTime.Minute) } rampDownStartTime := "" - if item.RampDownStartTime != nil && item.RampDownStartTime.Hour != nil && item.RampDownStartTime.Minute != nil { - rampDownStartTime = fmt.Sprintf("%02d:%02d", *item.RampDownStartTime.Hour, *item.RampDownStartTime.Minute) + if item.RampDownStartTime != nil { + rampDownStartTime = fmt.Sprintf("%02d:%02d", item.RampDownStartTime.Hour, item.RampDownStartTime.Minute) } - rampDownMinimumHostsPct := int32(0) + rampDownMinimumHostsPct := int64(0) if item.RampDownMinimumHostsPct != nil { rampDownMinimumHostsPct = *item.RampDownMinimumHostsPct } - rampDownCapacityThresholdPct := int32(0) + rampDownCapacityThresholdPct := int64(0) if item.RampDownCapacityThresholdPct != nil { rampDownCapacityThresholdPct = *item.RampDownCapacityThresholdPct } @@ -515,7 +528,7 @@ func flattenScalingPlanSchedule(input *[]desktopvirtualization.ScalingSchedule) if item.RampDownForceLogoffUsers != nil { rampDownForceLogoffUsers = *item.RampDownForceLogoffUsers } - rampDownWaitTimeMinutes := int32(0) + rampDownWaitTimeMinutes := int64(0) if item.RampDownWaitTimeMinutes != nil { rampDownWaitTimeMinutes = *item.RampDownWaitTimeMinutes } @@ -524,12 +537,19 @@ func flattenScalingPlanSchedule(input *[]desktopvirtualization.ScalingSchedule) rampDownNotificationMessage = *item.RampDownNotificationMessage } offPeakStartTime := "" - if item.OffPeakStartTime != nil && item.OffPeakStartTime.Hour != nil && item.OffPeakStartTime.Minute != nil { - offPeakStartTime = fmt.Sprintf("%02d:%02d", *item.OffPeakStartTime.Hour, *item.OffPeakStartTime.Minute) + if item.OffPeakStartTime != nil { + offPeakStartTime = fmt.Sprintf("%02d:%02d", item.OffPeakStartTime.Hour, item.OffPeakStartTime.Minute) } + daysOfWeek := make([]string, 0) + if item.DaysOfWeek != nil { + for _, weekday := range *item.DaysOfWeek { + daysOfWeek = append(daysOfWeek, string(weekday)) + } + } + results = append(results, map[string]interface{}{ "name": name, - "days_of_week": utils.FlattenStringSlice(item.DaysOfWeek), + "days_of_week": daysOfWeek, "ramp_up_start_time": rampUpStartTime, "ramp_up_load_balancing_algorithm": item.RampUpLoadBalancingAlgorithm, "ramp_up_minimum_hosts_percent": rampUpMinimumHostsPct, @@ -551,7 +571,7 @@ func flattenScalingPlanSchedule(input *[]desktopvirtualization.ScalingSchedule) return results } -func flattenScalingHostpoolReference(input *[]desktopvirtualization.ScalingHostPoolReference) []interface{} { +func flattenScalingHostpoolReference(input *[]scalingplan.ScalingHostPoolReference) []interface{} { results := make([]interface{}, 0) if input == nil { return results diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_workspace_application_group_association_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_workspace_application_group_association_resource.go index 57f4c0a9580..88a9a06acdf 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_workspace_application_group_association_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_workspace_application_group_association_resource.go @@ -6,16 +6,16 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceVirtualDesktopWorkspaceApplicationGroupAssociation() *pluginsdk.Resource { @@ -46,14 +46,14 @@ func resourceVirtualDesktopWorkspaceApplicationGroupAssociation() *pluginsdk.Res Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.WorkspaceID, + ValidateFunc: workspace.ValidateWorkspaceID, }, "application_group_id": { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ApplicationGroupID, + ValidateFunc: applicationgroup.ValidateApplicationGroupID, }, }, } @@ -65,46 +65,53 @@ func resourceVirtualDesktopWorkspaceApplicationGroupAssociationCreate(d *plugins defer cancel() log.Printf("[INFO] preparing arguments for Virtual Desktop Workspace <-> Application Group Association creation.") - workspaceId, err := parse.WorkspaceID(d.Get("workspace_id").(string)) + workspaceId, err := workspace.ParseWorkspaceID(d.Get("workspace_id").(string)) if err != nil { return err } - applicationGroupId, err := parse.ApplicationGroupID(d.Get("application_group_id").(string)) + applicationGroupId, err := applicationgroup.ParseApplicationGroupID(d.Get("application_group_id").(string)) if err != nil { return err } associationId := parse.NewWorkspaceApplicationGroupAssociationId(*workspaceId, *applicationGroupId).ID() - locks.ByName(workspaceId.Name, workspaceResourceType) - defer locks.UnlockByName(workspaceId.Name, workspaceResourceType) + locks.ByName(workspaceId.WorkspaceName, workspaceResourceType) + defer locks.UnlockByName(workspaceId.WorkspaceName, workspaceResourceType) - locks.ByName(applicationGroupId.Name, applicationGroupType) - defer locks.UnlockByName(applicationGroupId.Name, applicationGroupType) + locks.ByName(applicationGroupId.ApplicationGroupName, applicationGroupType) + defer locks.UnlockByName(applicationGroupId.ApplicationGroupName, applicationGroupType) - workspace, err := client.Get(ctx, workspaceId.ResourceGroup, workspaceId.Name) + existing, err := client.Get(ctx, *workspaceId) if err != nil { - if utils.ResponseWasNotFound(workspace.Response) { - return fmt.Errorf("Virtual Desktop Workspace %q (Resource Group %q) was not found", workspaceId.Name, workspaceId.ResourceGroup) + if response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("%s was not found", *workspaceId) } - return fmt.Errorf("retrieving Virtual Desktop Workspace for Association %q (Resource Group %q): %+v", workspaceId.Name, workspaceId.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *workspaceId, err) } + if existing.Model == nil { + return fmt.Errorf("retrieving %s: model was nil", *workspaceId) + } + model := *existing.Model applicationGroupAssociations := []string{} - if props := workspace.WorkspaceProperties; props != nil && props.ApplicationGroupReferences != nil { + if props := model.Properties; props != nil && props.ApplicationGroupReferences != nil { applicationGroupAssociations = *props.ApplicationGroupReferences } applicationGroupIdStr := applicationGroupId.ID() - if associationExists(workspace.WorkspaceProperties, applicationGroupIdStr) { + if associationExists(model.Properties, applicationGroupIdStr) { return tf.ImportAsExistsError("azurerm_virtual_desktop_workspace_application_group_association", associationId) } applicationGroupAssociations = append(applicationGroupAssociations, applicationGroupIdStr) - workspace.WorkspaceProperties.ApplicationGroupReferences = &applicationGroupAssociations - - if _, err = client.CreateOrUpdate(ctx, workspaceId.ResourceGroup, workspaceId.Name, workspace); err != nil { - return fmt.Errorf("creating association between Virtual Desktop Workspace %q (Resource Group %q) and Application Group %q (Resource Group %q): %+v", workspaceId.Name, workspaceId.ResourceGroup, applicationGroupId.Name, applicationGroupId.ResourceGroup, err) + payload := workspace.WorkspacePatch{ + Properties: &workspace.WorkspacePatchProperties{ + ApplicationGroupReferences: &applicationGroupAssociations, + }, + } + if _, err = client.Update(ctx, *workspaceId, payload); err != nil { + return fmt.Errorf("creating association between %s and %s: %+v", *workspaceId, *applicationGroupId, err) } d.SetId(associationId) @@ -113,6 +120,7 @@ func resourceVirtualDesktopWorkspaceApplicationGroupAssociationCreate(d *plugins func resourceVirtualDesktopWorkspaceApplicationGroupAssociationRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).DesktopVirtualization.WorkspacesClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -121,28 +129,29 @@ func resourceVirtualDesktopWorkspaceApplicationGroupAssociationRead(d *pluginsdk return err } - workspace, err := client.Get(ctx, id.Workspace.ResourceGroup, id.Workspace.Name) + workspace, err := client.Get(ctx, id.Workspace) if err != nil { - if utils.ResponseWasNotFound(workspace.Response) { - log.Printf("[DEBUG] Virtual Desktop Workspace %q was not found in Resource Group %q - removing from state!", id.Workspace.Name, id.Workspace.ResourceGroup) + if response.WasNotFound(workspace.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", id.Workspace) d.SetId("") return nil } - return fmt.Errorf("retrieving Virtual Desktop Desktop Workspace %q (Resource Group %q): %+v", id.Workspace.Name, id.Workspace.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id.Workspace, err) } + if model := workspace.Model; model != nil { + applicationGroupId := id.ApplicationGroup.ID() + exists := associationExists(model.Properties, applicationGroupId) + if !exists { + log.Printf("[DEBUG] Association between %s and %s was not found - removing from state!", id.Workspace, id.ApplicationGroup) + d.SetId("") + return nil + } - applicationGroupId := id.ApplicationGroup.ID() - exists := associationExists(workspace.WorkspaceProperties, applicationGroupId) - if !exists { - log.Printf("[DEBUG] Association between Virtual Desktop Workspace %q (Resource Group %q) and Application Group %q (Resource Group %q) was not found - removing from state!", id.Workspace.Name, id.Workspace.ResourceGroup, id.ApplicationGroup.Name, id.ApplicationGroup.ResourceGroup) - d.SetId("") - return nil + d.Set("workspace_id", id.Workspace.ID()) + d.Set("application_group_id", applicationGroupId) } - d.Set("workspace_id", id.Workspace.ID()) - d.Set("application_group_id", applicationGroupId) - return nil } @@ -156,25 +165,29 @@ func resourceVirtualDesktopWorkspaceApplicationGroupAssociationDelete(d *plugins return err } - locks.ByName(id.Workspace.Name, workspaceResourceType) - defer locks.UnlockByName(id.Workspace.Name, workspaceResourceType) + locks.ByName(id.Workspace.WorkspaceName, workspaceResourceType) + defer locks.UnlockByName(id.Workspace.WorkspaceName, workspaceResourceType) - locks.ByName(id.ApplicationGroup.Name, applicationGroupType) - defer locks.UnlockByName(id.ApplicationGroup.Name, applicationGroupType) + locks.ByName(id.ApplicationGroup.ApplicationGroupName, applicationGroupType) + defer locks.UnlockByName(id.ApplicationGroup.ApplicationGroupName, applicationGroupType) - workspace, err := client.Get(ctx, id.Workspace.ResourceGroup, id.Workspace.Name) + existing, err := client.Get(ctx, id.Workspace) if err != nil { - if utils.ResponseWasNotFound(workspace.Response) { - return fmt.Errorf("Virtual Desktop Workspace %q (Resource Group %q) was not found", id.Workspace.Name, id.Workspace.ResourceGroup) + if response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("%s was not found", id.Workspace) } - return fmt.Errorf("retrieving Virtual Desktop Workspace %q (Resource Group %q): %+v", id.Workspace.Name, id.Workspace.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id.Workspace, err) + } + if existing.Model == nil { + return fmt.Errorf("retrieving %s: model was nil", id.Workspace) } + model := *existing.Model applicationGroupReferences := []string{} applicationGroupId := id.ApplicationGroup.ID() - if workspace.WorkspaceProperties != nil && workspace.WorkspaceProperties.ApplicationGroupReferences != nil { - for _, referenceId := range *workspace.WorkspaceProperties.ApplicationGroupReferences { + if props := model.Properties; props != nil && props.ApplicationGroupReferences != nil { + for _, referenceId := range *props.ApplicationGroupReferences { if strings.EqualFold(referenceId, applicationGroupId) { continue } @@ -183,16 +196,19 @@ func resourceVirtualDesktopWorkspaceApplicationGroupAssociationDelete(d *plugins } } - workspace.WorkspaceProperties.ApplicationGroupReferences = &applicationGroupReferences - - if _, err = client.CreateOrUpdate(ctx, id.Workspace.ResourceGroup, id.Workspace.Name, workspace); err != nil { - return fmt.Errorf("removing association between Virtual Desktop Workspace %q (Resource Group %q) and Application Group %q (Resource Group %q): %+v", id.Workspace.Name, id.Workspace.ResourceGroup, id.ApplicationGroup.Name, id.ApplicationGroup.ResourceGroup, err) + payload := workspace.WorkspacePatch{ + Properties: &workspace.WorkspacePatchProperties{ + ApplicationGroupReferences: &applicationGroupReferences, + }, + } + if _, err = client.Update(ctx, id.Workspace, payload); err != nil { + return fmt.Errorf("removing association between %s and %s: %+v", id.Workspace, id.ApplicationGroup, err) } return nil } -func associationExists(props *desktopvirtualization.WorkspaceProperties, applicationGroupId string) bool { +func associationExists(props *workspace.WorkspaceProperties, applicationGroupId string) bool { if props == nil || props.ApplicationGroupReferences == nil { return false } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_workspace_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_workspace_resource.go index 0eb6161b64b..349faec4d87 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_workspace_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/virtual_desktop_workspace_resource.go @@ -5,14 +5,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -36,7 +38,7 @@ func resourceArmDesktopVirtualizationWorkspace() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.WorkspaceID(id) + _, err := workspace.ParseWorkspaceID(id) return err }), @@ -69,7 +71,7 @@ func resourceArmDesktopVirtualizationWorkspace() *pluginsdk.Resource { ValidateFunc: validation.StringLenBetween(1, 512), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -82,40 +84,37 @@ func resourceArmDesktopVirtualizationWorkspaceCreateUpdate(d *pluginsdk.Resource log.Printf("[INFO] preparing arguments for Virtual Desktop Workspace create/update") - name := d.Get("name").(string) - resourceGroup := d.Get("resource_group_name").(string) - - resourceId := parse.NewWorkspaceID(subscriptionId, resourceGroup, name).ID() + id := workspace.NewWorkspaceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, resourceGroup, name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing Virtual Desktop Workspace %q (Resource Group %q): %s", name, resourceGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if existing.WorkspaceProperties != nil { - return tf.ImportAsExistsError("azurerm_virtual_desktop_workspace", resourceId) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_virtual_desktop_workspace", id.ID()) } } location := azure.NormalizeLocation(d.Get("location").(string)) t := d.Get("tags").(map[string]interface{}) - context := desktopvirtualization.Workspace{ + payload := workspace.Workspace{ Location: &location, Tags: tags.Expand(t), - WorkspaceProperties: &desktopvirtualization.WorkspaceProperties{ + Properties: &workspace.WorkspaceProperties{ Description: utils.String(d.Get("description").(string)), FriendlyName: utils.String(d.Get("friendly_name").(string)), }, } - if _, err := client.CreateOrUpdate(ctx, resourceGroup, name, context); err != nil { - return fmt.Errorf("creating Virtual Desktop Workspace %q (Resource Group %q): %+v", name, resourceGroup, err) + if _, err := client.CreateOrUpdate(ctx, id, payload); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - d.SetId(resourceId) + d.SetId(id.ID()) return resourceArmDesktopVirtualizationWorkspaceRead(d, meta) } @@ -125,52 +124,56 @@ func resourceArmDesktopVirtualizationWorkspaceRead(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.WorkspaceID(d.Id()) + id, err := workspace.ParseWorkspaceID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Virtual Desktop Workspace %q was not found in Resource Group %q - removing from state!", id.Name, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Virtual Desktop Workspace %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.WorkspaceName) + d.Set("resource_group_name", id.ResourceGroupName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + + if props := model.Properties; props != nil { + d.Set("description", props.Description) + d.Set("friendly_name", props.FriendlyName) + } - if props := resp.WorkspaceProperties; props != nil { - d.Set("description", props.Description) - d.Set("friendly_name", props.FriendlyName) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceArmDesktopVirtualizationWorkspaceDelete(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).DesktopVirtualization.WorkspacesClient - id, err := parse.WorkspaceID(d.Id()) + id, err := workspace.ParseWorkspaceID(d.Id()) if err != nil { return err } - locks.ByName(id.Name, workspaceResourceType) - defer locks.UnlockByName(id.Name, workspaceResourceType) + locks.ByName(id.WorkspaceName, workspaceResourceType) + defer locks.UnlockByName(id.WorkspaceName, workspaceResourceType) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - if _, err = client.Delete(ctx, id.ResourceGroup, id.Name); err != nil { - return fmt.Errorf("deleting Desktop Virtualization Workspace %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if _, err = client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/dev_test_lab_schedule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/dev_test_lab_schedule_resource.go index afc322ea325..4d51ed51bc8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/dev_test_lab_schedule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/dev_test_lab_schedule_resource.go @@ -316,7 +316,7 @@ func resourceDevTestLabSchedulesRead(d *pluginsdk.ResourceData, meta interface{} } func resourceDevTestLabSchedulesDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Compute.VMExtensionClient + client := meta.(*clients.Client).DevTestLabs.LabSchedulesClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() @@ -325,12 +325,10 @@ func resourceDevTestLabSchedulesDelete(d *pluginsdk.ResourceData, meta interface return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.LabName, id.ScheduleName) - if err != nil { + if _, err := client.Delete(ctx, id.ResourceGroup, id.LabName, id.ScheduleName); err != nil { return err } - - return future.WaitForCompletionRef(ctx, client.Client) + return nil } func expandDevTestScheduleRecurrenceDaily(recurrence interface{}) *dtl.DayDetails { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/digital_twins_instance_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/digital_twins_instance_resource.go index 493a46c719e..65a0591670e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/digital_twins_instance_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/digitaltwins/digital_twins_instance_resource.go @@ -6,6 +6,8 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" @@ -54,6 +56,8 @@ func resourceDigitalTwinsInstance() *pluginsdk.Resource { Computed: true, }, + "identity": commonschema.SystemAssignedIdentityOptional(), + "tags": tags.Schema(), }, } @@ -80,8 +84,14 @@ func resourceDigitalTwinsInstanceCreate(d *pluginsdk.ResourceData, meta interfac return tf.ImportAsExistsError("azurerm_digital_twins_instance", id) } + expandedIdentity, err := expandDigitalTwinsInstanceIdentity(d.Get("identity").([]interface{})) + if err != nil { + return fmt.Errorf("expanding `identity`: %+v", err) + } + properties := digitaltwins.Description{ Location: utils.String(location.Normalize(d.Get("location").(string))), + Identity: expandedIdentity, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } @@ -130,6 +140,10 @@ func resourceDigitalTwinsInstanceRead(d *pluginsdk.ResourceData, meta interface{ d.Set("host_name", props.HostName) } + if err := d.Set("identity", flattenDigitalTwinsInstanceIdentity(resp.Identity)); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } + return tags.FlattenAndSet(d, resp.Tags) } @@ -145,6 +159,14 @@ func resourceDigitalTwinsInstanceUpdate(d *pluginsdk.ResourceData, meta interfac props := digitaltwins.PatchDescription{} + if d.HasChange("identity") { + expandedIdentity, err := expandDigitalTwinsInstanceIdentity(d.Get("identity").([]interface{})) + if err != nil { + return fmt.Errorf("expanding `identity`: %+v", err) + } + props.Identity = expandedIdentity + } + if d.HasChange("tags") { props.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) } @@ -182,3 +204,34 @@ func resourceDigitalTwinsInstanceDelete(d *pluginsdk.ResourceData, meta interfac return nil } + +func expandDigitalTwinsInstanceIdentity(input []interface{}) (*digitaltwins.Identity, error) { + expanded, err := identity.ExpandSystemAssigned(input) + if err != nil { + return nil, err + } + + result := digitaltwins.Identity{ + Type: digitaltwins.IdentityType(expanded.Type), + } + + return &result, nil +} + +func flattenDigitalTwinsInstanceIdentity(input *digitaltwins.Identity) []interface{} { + var transform *identity.SystemAssigned + + if input != nil { + transform = &identity.SystemAssigned{ + Type: identity.Type(string(input.Type)), + } + if input.PrincipalID != nil { + transform.PrincipalId = *input.PrincipalID + } + if input.TenantID != nil { + transform.TenantId = *input.TenantID + } + } + + return identity.FlattenSystemAssigned(transform) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/disks/disk_pool_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/disks/disk_pool_resource.go index d5f7422093d..2f537c33c80 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/disks/disk_pool_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/disks/disk_pool_resource.go @@ -6,12 +6,11 @@ import ( "strings" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" @@ -158,7 +157,7 @@ func (DiskPoolResource) Read() sdk.ResourceFunc { if model.Sku != nil { m.Sku = model.Sku.Name } - m.Tags = flattenTags(model.Tags) + m.Tags = tags.Flatten(model.Tags) m.Location = location.Normalize(model.Location) m.SubnetId = model.Properties.SubnetId diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/disks/transition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/disks/transition.go deleted file mode 100644 index 4177128e8af..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/disks/transition.go +++ /dev/null @@ -1,14 +0,0 @@ -package disks - -func flattenTags(input *map[string]string) map[string]interface{} { - output := make(map[string]interface{}) - - if input != nil { - for k, v := range *input { - val := v - output[k] = val - } - } - - return output -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/client/client.go index d1dc5bea72b..0f34c6a66b8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/client/client.go @@ -1,24 +1,14 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" + "github.com/Azure/go-autorest/autorest" + dns_v2018_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) -type Client struct { - RecordSetsClient *dns.RecordSetsClient - ZonesClient *dns.ZonesClient -} - -func NewClient(o *common.ClientOptions) *Client { - RecordSetsClient := dns.NewRecordSetsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&RecordSetsClient.Client, o.ResourceManagerAuthorizer) - - ZonesClient := dns.NewZonesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&ZonesClient.Client, o.ResourceManagerAuthorizer) - - return &Client{ - RecordSetsClient: &RecordSetsClient, - ZonesClient: &ZonesClient, - } +func NewClient(o *common.ClientOptions) *dns_v2018_05_01.Client { + client := dns_v2018_05_01.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) { + c.Authorizer = o.ResourceManagerAuthorizer + }) + return &client } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_a_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_a_record_data_source.go new file mode 100644 index 00000000000..097da348370 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_a_record_data_source.go @@ -0,0 +1,106 @@ +package dns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourceDnsARecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceDnsARecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "records": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, + Set: pluginsdk.HashString, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "target_resource_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourceDnsARecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).Dns.RecordSets + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeA, d.Get("name").(string)) + + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("records", flattenAzureRmDnsARecords(props.ARecords)); err != nil { + return fmt.Errorf("setting `records`: %+v", err) + } + + targetResourceId := "" + if props.TargetResource != nil && props.TargetResource.Id != nil { + targetResourceId = *props.TargetResource.Id + } + d.Set("target_resource_id", targetResourceId) + + return tags.FlattenAndSet(d, props.Metadata) + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_a_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_a_record_resource.go index 12b55baeaff..de9bf144acb 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_a_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_a_record_resource.go @@ -2,15 +2,15 @@ package dns import ( "fmt" - "net/http" "time" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -30,8 +30,14 @@ func resourceDnsARecord() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ARecordID(id) - return err + parsed, err := recordsets.ParseRecordTypeID(id) + if err != nil { + return err + } + if parsed.RecordType != recordsets.RecordTypeA { + return fmt.Errorf("this resource only supports 'A' records") + } + return nil }), Schema: map[string]*pluginsdk.Schema{ @@ -41,11 +47,12 @@ func resourceDnsARecord() *pluginsdk.Resource { ForceNew: true, }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), "zone_name": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, }, "records": { @@ -75,13 +82,13 @@ func resourceDnsARecord() *pluginsdk.Resource { // TODO: switch ConflictsWith for ExactlyOneOf when the Provider SDK's updated }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } func resourceDnsARecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) subscriptionId := meta.(*clients.Client).Account.SubscriptionId defer cancel() @@ -90,18 +97,17 @@ func resourceDnsARecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) resGroup := d.Get("resource_group_name").(string) zoneName := d.Get("zone_name").(string) - resourceId := parse.NewARecordID(subscriptionId, resGroup, zoneName, name) - + id := recordsets.NewRecordTypeID(subscriptionId, resGroup, zoneName, recordsets.RecordTypeA, name) if d.IsNewResource() { - existing, err := client.Get(ctx, resGroup, zoneName, name, dns.A) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing DNS A Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_dns_a_record", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_dns_a_record", id.ID()) } } @@ -110,18 +116,18 @@ func resourceDnsARecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) targetResourceId := d.Get("target_resource_id").(string) recordsRaw := d.Get("records").(*pluginsdk.Set).List() - parameters := dns.RecordSet{ + parameters := recordsets.RecordSet{ Name: &name, - RecordSetProperties: &dns.RecordSetProperties{ + Properties: &recordsets.RecordSetProperties{ Metadata: tags.Expand(t), TTL: &ttl, ARecords: expandAzureRmDnsARecords(recordsRaw), - TargetResource: &dns.SubResource{}, + TargetResource: &recordsets.SubResource{}, }, } if targetResourceId != "" { - parameters.RecordSetProperties.TargetResource.ID = utils.String(targetResourceId) + parameters.Properties.TargetResource.Id = utils.String(targetResourceId) } // TODO: this can be removed when the provider SDK is upgraded @@ -129,99 +135,105 @@ func resourceDnsARecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("One of either `records` or `target_resource_id` must be specified") } - eTag := "" - ifNoneMatch := "" // set to empty to allow updates to records after creation - if _, err := client.CreateOrUpdate(ctx, resGroup, zoneName, name, dns.A, parameters, eTag, ifNoneMatch); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, recordsets.DefaultCreateOrUpdateOperationOptions()); err != nil { return fmt.Errorf("creating/updating DNS A Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) return resourceDnsARecordRead(d, meta) } func resourceDnsARecordRead(d *pluginsdk.ResourceData, meta interface{}) error { - dnsClient := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ARecordID(d.Id()) + id, err := recordsets.ParseRecordTypeIDInsensitively(d.Id()) if err != nil { return err } - resp, err := dnsClient.Get(ctx, id.ResourceGroup, id.DnszoneName, id.AName, dns.A) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("reading DNS A record %s: %+v", id.AName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.AName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("zone_name", id.DnszoneName) + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) - d.Set("fqdn", resp.Fqdn) - d.Set("ttl", resp.TTL) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("fqdn", props.Fqdn) + d.Set("ttl", props.TTL) - if err := d.Set("records", flattenAzureRmDnsARecords(resp.ARecords)); err != nil { - return fmt.Errorf("setting `records`: %+v", err) - } + if err := d.Set("records", flattenAzureRmDnsARecords(props.ARecords)); err != nil { + return fmt.Errorf("setting `records`: %+v", err) + } + + targetResourceId := "" + if props.TargetResource != nil && props.TargetResource.Id != nil { + targetResourceId = *props.TargetResource.Id + } + d.Set("target_resource_id", targetResourceId) + + if err := tags.FlattenAndSet(d, props.Metadata); err != nil { + return err + } + } - targetResourceId := "" - if resp.TargetResource != nil && resp.TargetResource.ID != nil { - targetResourceId = *resp.TargetResource.ID } - d.Set("target_resource_id", targetResourceId) - return tags.FlattenAndSet(d, resp.Metadata) + return nil } func resourceDnsARecordDelete(d *pluginsdk.ResourceData, meta interface{}) error { - dnsClient := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ARecordID(d.Id()) + id, err := recordsets.ParseRecordTypeID(d.Id()) if err != nil { return err } - resp, err := dnsClient.Delete(ctx, id.ResourceGroup, id.DnszoneName, id.AName, dns.A, "") - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("deleting DNS A Record %s: %+v", id.AName, err) + if _, err := client.Delete(ctx, *id, recordsets.DefaultDeleteOperationOptions()); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } -func expandAzureRmDnsARecords(input []interface{}) *[]dns.ARecord { - records := make([]dns.ARecord, len(input)) +func expandAzureRmDnsARecords(input []interface{}) *[]recordsets.ARecord { + records := make([]recordsets.ARecord, len(input)) for i, v := range input { ipv4 := v.(string) - records[i] = dns.ARecord{ - Ipv4Address: &ipv4, + records[i] = recordsets.ARecord{ + IPv4Address: &ipv4, } } return &records } -func flattenAzureRmDnsARecords(records *[]dns.ARecord) []string { +func flattenAzureRmDnsARecords(records *[]recordsets.ARecord) []string { if records == nil { return []string{} } results := make([]string, 0) for _, record := range *records { - if record.Ipv4Address == nil { + if record.IPv4Address == nil { continue } - results = append(results, *record.Ipv4Address) + results = append(results, *record.IPv4Address) } return results diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_aaaa_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_aaaa_record_data_source.go new file mode 100644 index 00000000000..ea1bc66b4c8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_aaaa_record_data_source.go @@ -0,0 +1,107 @@ +package dns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/set" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourceDnsAAAARecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceDnsAAAARecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "records": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, + Set: set.HashIPv6Address, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "target_resource_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourceDnsAAAARecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).Dns.RecordSets + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeAAAA, d.Get("name").(string)) + + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("records", flattenAzureRmDnsAaaaRecords(props.AAAARecords)); err != nil { + return fmt.Errorf("setting `records`: %+v", err) + } + + targetResourceId := "" + if props.TargetResource != nil && props.TargetResource.Id != nil { + targetResourceId = *props.TargetResource.Id + } + d.Set("target_resource_id", targetResourceId) + + return tags.FlattenAndSet(d, props.Metadata) + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_aaaa_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_aaaa_record_resource.go index c8932efd587..1d99936fb82 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_aaaa_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_aaaa_record_resource.go @@ -2,15 +2,15 @@ package dns import ( "fmt" - "net/http" "time" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/set" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -33,8 +33,14 @@ func resourceDnsAAAARecord() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.AaaaRecordID(id) - return err + parsed, err := recordsets.ParseRecordTypeID(id) + if err != nil { + return err + } + if parsed.RecordType != recordsets.RecordTypeAAAA { + return fmt.Errorf("this resource only supports 'AAAA' records") + } + return nil }), Schema: map[string]*pluginsdk.Schema{ @@ -44,11 +50,12 @@ func resourceDnsAAAARecord() *pluginsdk.Resource { ForceNew: true, }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), "zone_name": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, }, "records": { @@ -72,7 +79,7 @@ func resourceDnsAAAARecord() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "target_resource_id": { Type: pluginsdk.TypeString, @@ -85,7 +92,7 @@ func resourceDnsAAAARecord() *pluginsdk.Resource { } func resourceDnsAaaaRecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) subscriptionId := meta.(*clients.Client).Account.SubscriptionId defer cancel() @@ -94,18 +101,17 @@ func resourceDnsAaaaRecordCreateUpdate(d *pluginsdk.ResourceData, meta interface resGroup := d.Get("resource_group_name").(string) zoneName := d.Get("zone_name").(string) - resourceId := parse.NewAaaaRecordID(subscriptionId, resGroup, zoneName, name) - + id := recordsets.NewRecordTypeID(subscriptionId, resGroup, zoneName, recordsets.RecordTypeAAAA, name) if d.IsNewResource() { - existing, err := client.Get(ctx, resGroup, zoneName, name, dns.AAAA) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing DNS AAAA Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_dns_aaaa_record", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_dns_aaaa_record", id.ID()) } } @@ -114,18 +120,18 @@ func resourceDnsAaaaRecordCreateUpdate(d *pluginsdk.ResourceData, meta interface recordsRaw := d.Get("records").(*pluginsdk.Set).List() targetResourceId := d.Get("target_resource_id").(string) - parameters := dns.RecordSet{ + parameters := recordsets.RecordSet{ Name: &name, - RecordSetProperties: &dns.RecordSetProperties{ + Properties: &recordsets.RecordSetProperties{ Metadata: tags.Expand(t), TTL: &ttl, - AaaaRecords: expandAzureRmDnsAaaaRecords(recordsRaw), - TargetResource: &dns.SubResource{}, + AAAARecords: expandAzureRmDnsAaaaRecords(recordsRaw), + TargetResource: &recordsets.SubResource{}, }, } if targetResourceId != "" { - parameters.RecordSetProperties.TargetResource.ID = utils.String(targetResourceId) + parameters.Properties.TargetResource.Id = utils.String(targetResourceId) } // TODO: this can be removed when the provider SDK is upgraded @@ -133,99 +139,103 @@ func resourceDnsAaaaRecordCreateUpdate(d *pluginsdk.ResourceData, meta interface return fmt.Errorf("One of either `records` or `target_resource_id` must be specified") } - eTag := "" - ifNoneMatch := "" // set to empty to allow updates to records after creation - if _, err := client.CreateOrUpdate(ctx, resGroup, zoneName, name, dns.AAAA, parameters, eTag, ifNoneMatch); err != nil { - return fmt.Errorf("creating/updating DNS AAAA Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) + if _, err := client.CreateOrUpdate(ctx, id, parameters, recordsets.DefaultCreateOrUpdateOperationOptions()); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - d.SetId(resourceId.ID()) - + d.SetId(id.ID()) return resourceDnsAaaaRecordRead(d, meta) } func resourceDnsAaaaRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { - dnsClient := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AaaaRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeIDInsensitively(d.Id()) if err != nil { return err } - resp, err := dnsClient.Get(ctx, id.ResourceGroup, id.DnszoneName, id.AAAAName, dns.AAAA) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("reading DNS AAAA record %s: %v", id.AAAAName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.AAAAName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("zone_name", id.DnszoneName) + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) - d.Set("fqdn", resp.Fqdn) - d.Set("ttl", resp.TTL) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("fqdn", props.Fqdn) + d.Set("ttl", props.TTL) - if err := d.Set("records", flattenAzureRmDnsAaaaRecords(resp.AaaaRecords)); err != nil { - return fmt.Errorf("setting `records`: %+v", err) - } + if err := d.Set("records", flattenAzureRmDnsAaaaRecords(props.AAAARecords)); err != nil { + return fmt.Errorf("setting `records`: %+v", err) + } + + targetResourceId := "" + if props.TargetResource != nil && props.TargetResource.Id != nil { + targetResourceId = *props.TargetResource.Id + } + d.Set("target_resource_id", targetResourceId) - targetResourceId := "" - if resp.TargetResource != nil && resp.TargetResource.ID != nil { - targetResourceId = *resp.TargetResource.ID + if err := tags.FlattenAndSet(d, props.Metadata); err != nil { + return err + } + } } - d.Set("target_resource_id", targetResourceId) - return tags.FlattenAndSet(d, resp.Metadata) + return nil } func resourceDnsAaaaRecordDelete(d *pluginsdk.ResourceData, meta interface{}) error { - dnsClient := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AaaaRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeID(d.Id()) if err != nil { return err } - resp, err := dnsClient.Delete(ctx, id.ResourceGroup, id.DnszoneName, id.AAAAName, dns.AAAA, "") - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("deleting DNS AAAA Record %s: %+v", id.AAAAName, err) + if _, err := client.Delete(ctx, *id, recordsets.DefaultDeleteOperationOptions()); err != nil { + return fmt.Errorf("deleting %s: %+v", id.RelativeRecordSetName, err) } return nil } -func expandAzureRmDnsAaaaRecords(input []interface{}) *[]dns.AaaaRecord { - records := make([]dns.AaaaRecord, len(input)) +func expandAzureRmDnsAaaaRecords(input []interface{}) *[]recordsets.AaaaRecord { + records := make([]recordsets.AaaaRecord, len(input)) for i, v := range input { ipv6 := NormalizeIPv6Address(v) - records[i] = dns.AaaaRecord{ - Ipv6Address: &ipv6, + records[i] = recordsets.AaaaRecord{ + IPv6Address: &ipv6, } } return &records } -func flattenAzureRmDnsAaaaRecords(records *[]dns.AaaaRecord) []string { +func flattenAzureRmDnsAaaaRecords(records *[]recordsets.AaaaRecord) []string { if records == nil { return []string{} } results := make([]string, 0) for _, record := range *records { - if record.Ipv6Address == nil { + if record.IPv6Address == nil { continue } - results = append(results, NormalizeIPv6Address(*record.Ipv6Address)) + results = append(results, NormalizeIPv6Address(*record.IPv6Address)) } return results } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_caa_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_caa_record_data_source.go new file mode 100644 index 00000000000..a8eea460c0e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_caa_record_data_source.go @@ -0,0 +1,112 @@ +package dns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourceDnsCaaRecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceDnsCaaRecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "record": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "flags": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "tag": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "value": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + Set: resourceDnsCaaRecordHash, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourceDnsCaaRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).Dns.RecordSets + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeCAA, d.Get("name").(string)) + + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("record", flattenAzureRmDnsCaaRecords(props.CaaRecords)); err != nil { + return err + } + + return tags.FlattenAndSet(d, props.Metadata) + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_caa_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_caa_record_resource.go index f11e333de4c..4482b980776 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_caa_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_caa_record_resource.go @@ -3,19 +3,17 @@ package dns import ( "bytes" "fmt" - "net/http" "time" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceDnsCaaRecord() *pluginsdk.Resource { @@ -33,8 +31,14 @@ func resourceDnsCaaRecord() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.CaaRecordID(id) - return err + parsed, err := recordsets.ParseRecordTypeID(id) + if err != nil { + return err + } + if parsed.RecordType != recordsets.RecordTypeCAA { + return fmt.Errorf("this resource only supports 'CAA' records") + } + return nil }), Schema: map[string]*pluginsdk.Schema{ @@ -44,11 +48,12 @@ func resourceDnsCaaRecord() *pluginsdk.Resource { ForceNew: true, }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), "zone_name": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, }, "record": { @@ -90,13 +95,13 @@ func resourceDnsCaaRecord() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } func resourceDnsCaaRecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) subscriptionId := meta.(*clients.Client).Account.SubscriptionId defer cancel() @@ -105,103 +110,122 @@ func resourceDnsCaaRecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{ resGroup := d.Get("resource_group_name").(string) zoneName := d.Get("zone_name").(string) - resourceId := parse.NewCaaRecordID(subscriptionId, resGroup, zoneName, name) - + id := recordsets.NewRecordTypeID(subscriptionId, resGroup, zoneName, recordsets.RecordTypeCAA, name) if d.IsNewResource() { - existing, err := client.Get(ctx, resGroup, zoneName, name, dns.CAA) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing DNS CAA Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_dns_caa_record", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_dns_caa_record", id.ID()) } } ttl := int64(d.Get("ttl").(int)) t := d.Get("tags").(map[string]interface{}) - parameters := dns.RecordSet{ + parameters := recordsets.RecordSet{ Name: &name, - RecordSetProperties: &dns.RecordSetProperties{ + Properties: &recordsets.RecordSetProperties{ Metadata: tags.Expand(t), TTL: &ttl, CaaRecords: expandAzureRmDnsCaaRecords(d), }, } - eTag := "" - ifNoneMatch := "" // set to empty to allow updates to records after creation - if _, err := client.CreateOrUpdate(ctx, resGroup, zoneName, name, dns.CAA, parameters, eTag, ifNoneMatch); err != nil { - return fmt.Errorf("creating/updating DNS CAA Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) + if _, err := client.CreateOrUpdate(ctx, id, parameters, recordsets.DefaultCreateOrUpdateOperationOptions()); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) return resourceDnsCaaRecordRead(d, meta) } func resourceDnsCaaRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CaaRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeIDInsensitively(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.DnszoneName, id.CAAName, dns.CAA) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("reading DNS CAA record %s: %v", id.CAAName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.CAAName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("zone_name", id.DnszoneName) + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) - d.Set("ttl", resp.TTL) - d.Set("fqdn", resp.Fqdn) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) - if err := d.Set("record", flattenAzureRmDnsCaaRecords(resp.CaaRecords)); err != nil { - return err + if err := d.Set("record", flattenAzureRmDnsCaaRecords(props.CaaRecords)); err != nil { + return err + } + if err := tags.FlattenAndSet(d, props.Metadata); err != nil { + return err + } + } } - return tags.FlattenAndSet(d, resp.Metadata) + + return nil } func resourceDnsCaaRecordDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CaaRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.DnszoneName, id.CAAName, dns.CAA, "") - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("deleting DNS CAA Record %s: %+v", id.CAAName, err) + if _, err := client.Delete(ctx, *id, recordsets.DefaultDeleteOperationOptions()); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } -func flattenAzureRmDnsCaaRecords(records *[]dns.CaaRecord) []map[string]interface{} { +func flattenAzureRmDnsCaaRecords(records *[]recordsets.CaaRecord) []map[string]interface{} { results := make([]map[string]interface{}, 0) if records != nil { for _, record := range *records { + flags := int64(0) + if record.Flags != nil { + flags = *record.Flags + } + + tag := "" + if record.Tag != nil { + tag = *record.Tag + } + + value := "" + if record.Value != nil { + value = *record.Value + } + results = append(results, map[string]interface{}{ - "flags": *record.Flags, - "tag": *record.Tag, - "value": *record.Value, + "flags": flags, + "tag": tag, + "value": value, }) } } @@ -209,23 +233,22 @@ func flattenAzureRmDnsCaaRecords(records *[]dns.CaaRecord) []map[string]interfac return results } -func expandAzureRmDnsCaaRecords(d *pluginsdk.ResourceData) *[]dns.CaaRecord { +func expandAzureRmDnsCaaRecords(d *pluginsdk.ResourceData) *[]recordsets.CaaRecord { recordStrings := d.Get("record").(*pluginsdk.Set).List() - records := make([]dns.CaaRecord, len(recordStrings)) + records := make([]recordsets.CaaRecord, 0) - for i, v := range recordStrings { + for _, v := range recordStrings { record := v.(map[string]interface{}) - flags := int32(record["flags"].(int)) + + flags := int64(record["flags"].(int)) tag := record["tag"].(string) value := record["value"].(string) - caaRecord := dns.CaaRecord{ + records = append(records, recordsets.CaaRecord{ Flags: &flags, Tag: &tag, Value: &value, - } - - records[i] = caaRecord + }) } return &records diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_cname_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_cname_record_data_source.go new file mode 100644 index 00000000000..eb66db443b4 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_cname_record_data_source.go @@ -0,0 +1,107 @@ +package dns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourceDnsCNameRecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceDnsCNameRecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "record": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "target_resource_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourceDnsCNameRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).Dns.RecordSets + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeCNAME, d.Get("name").(string)) + + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) + + cname := "" + if props.CNAMERecord != nil && props.CNAMERecord.Cname != nil { + cname = *props.CNAMERecord.Cname + } + d.Set("record", cname) + + targetResourceId := "" + if props.TargetResource != nil && props.TargetResource.Id != nil { + targetResourceId = *props.TargetResource.Id + } + d.Set("target_resource_id", targetResourceId) + + return tags.FlattenAndSet(d, props.Metadata) + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_cname_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_cname_record_resource.go index 7b9c40ac7d6..69c823cf19e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_cname_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_cname_record_resource.go @@ -2,15 +2,15 @@ package dns import ( "fmt" - "net/http" "time" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -31,8 +31,14 @@ func resourceDnsCNameRecord() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.CnameRecordID(id) - return err + parsed, err := recordsets.ParseRecordTypeID(id) + if err != nil { + return err + } + if parsed.RecordType != recordsets.RecordTypeCNAME { + return fmt.Errorf("this resource only supports 'CNAME' records") + } + return nil }), Schema: map[string]*pluginsdk.Schema{ @@ -42,11 +48,12 @@ func resourceDnsCNameRecord() *pluginsdk.Resource { ForceNew: true, }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), "zone_name": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, }, "record": { @@ -72,13 +79,13 @@ func resourceDnsCNameRecord() *pluginsdk.Resource { ConflictsWith: []string{"record"}, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } func resourceDnsCNameRecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) subscriptionId := meta.(*clients.Client).Account.SubscriptionId defer cancel() @@ -87,18 +94,17 @@ func resourceDnsCNameRecordCreateUpdate(d *pluginsdk.ResourceData, meta interfac resGroup := d.Get("resource_group_name").(string) zoneName := d.Get("zone_name").(string) - resourceId := parse.NewCnameRecordID(subscriptionId, resGroup, zoneName, name) - + id := recordsets.NewRecordTypeID(subscriptionId, resGroup, zoneName, recordsets.RecordTypeCNAME, name) if d.IsNewResource() { - existing, err := client.Get(ctx, resGroup, zoneName, name, dns.CNAME) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing DNS CNAME Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_dns_cname_record", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_dns_cname_record", id.ID()) } } @@ -107,22 +113,22 @@ func resourceDnsCNameRecordCreateUpdate(d *pluginsdk.ResourceData, meta interfac t := d.Get("tags").(map[string]interface{}) targetResourceId := d.Get("target_resource_id").(string) - parameters := dns.RecordSet{ + parameters := recordsets.RecordSet{ Name: &name, - RecordSetProperties: &dns.RecordSetProperties{ + Properties: &recordsets.RecordSetProperties{ Metadata: tags.Expand(t), TTL: &ttl, - CnameRecord: &dns.CnameRecord{}, - TargetResource: &dns.SubResource{}, + CNAMERecord: &recordsets.CnameRecord{}, + TargetResource: &recordsets.SubResource{}, }, } if record != "" { - parameters.RecordSetProperties.CnameRecord.Cname = utils.String(record) + parameters.Properties.CNAMERecord.Cname = utils.String(record) } if targetResourceId != "" { - parameters.RecordSetProperties.TargetResource.ID = utils.String(targetResourceId) + parameters.Properties.TargetResource.Id = utils.String(targetResourceId) } // TODO: this can be removed when the provider SDK is upgraded @@ -130,73 +136,76 @@ func resourceDnsCNameRecordCreateUpdate(d *pluginsdk.ResourceData, meta interfac return fmt.Errorf("One of either `record` or `target_resource_id` must be specified") } - eTag := "" - ifNoneMatch := "" // set to empty to allow updates to records after creation - if _, err := client.CreateOrUpdate(ctx, resGroup, zoneName, name, dns.CNAME, parameters, eTag, ifNoneMatch); err != nil { - return fmt.Errorf("creating/updating CNAME Record %q (DNS Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) + if _, err := client.CreateOrUpdate(ctx, id, parameters, recordsets.DefaultCreateOrUpdateOperationOptions()); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) return resourceDnsCNameRecordRead(d, meta) } func resourceDnsCNameRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { - dnsClient := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CnameRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeIDInsensitively(d.Id()) if err != nil { return err } - resp, err := dnsClient.Get(ctx, id.ResourceGroup, id.DnszoneName, id.CNAMEName, dns.CNAME) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("retrieving CNAME Record %s (DNS Zone %q / Resource Group %q): %+v", id.CNAMEName, id.DnszoneName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.CNAMEName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("zone_name", id.DnszoneName) + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) - d.Set("fqdn", resp.Fqdn) - d.Set("ttl", resp.TTL) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("fqdn", props.Fqdn) + d.Set("ttl", props.TTL) - if props := resp.RecordSetProperties; props != nil { - cname := "" - if props.CnameRecord != nil && props.CnameRecord.Cname != nil { - cname = *props.CnameRecord.Cname - } - d.Set("record", cname) + cname := "" + if props.CNAMERecord != nil && props.CNAMERecord.Cname != nil { + cname = *props.CNAMERecord.Cname + } + d.Set("record", cname) + + targetResourceId := "" + if props.TargetResource != nil && props.TargetResource.Id != nil { + targetResourceId = *props.TargetResource.Id + } + d.Set("target_resource_id", targetResourceId) - targetResourceId := "" - if props.TargetResource != nil && props.TargetResource.ID != nil { - targetResourceId = *props.TargetResource.ID + if err := tags.FlattenAndSet(d, props.Metadata); err != nil { + return err + } } - d.Set("target_resource_id", targetResourceId) } - return tags.FlattenAndSet(d, resp.Metadata) + return nil } func resourceDnsCNameRecordDelete(d *pluginsdk.ResourceData, meta interface{}) error { - dnsClient := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CnameRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeID(d.Id()) if err != nil { return err } - resp, err := dnsClient.Delete(ctx, id.ResourceGroup, id.DnszoneName, id.CNAMEName, dns.CNAME, "") - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("deleting CNAME Record %q (DNS Zone %q / Resource Group %q): %+v", id.CNAMEName, id.DnszoneName, id.ResourceGroup, err) + if _, err := client.Delete(ctx, *id, recordsets.DefaultDeleteOperationOptions()); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_mx_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_mx_record_data_source.go new file mode 100644 index 00000000000..7905f5d600c --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_mx_record_data_source.go @@ -0,0 +1,108 @@ +package dns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourceDnsMxRecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceDnsMxRecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Optional: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "record": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "preference": { + // TODO: this should become an Int + Type: pluginsdk.TypeString, + Computed: true, + }, + + "exchange": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + Set: resourceDnsMxRecordHash, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourceDnsMxRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).Dns.RecordSets + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeMX, d.Get("name").(string)) + + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("record", flattenAzureRmDnsMxRecords(props.MXRecords)); err != nil { + return err + } + + return tags.FlattenAndSet(d, props.Metadata) + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_mx_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_mx_record_resource.go index a74cd20754a..277e0e13a21 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_mx_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_mx_record_resource.go @@ -3,19 +3,17 @@ package dns import ( "bytes" "fmt" - "net/http" "strconv" "time" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceDnsMxRecord() *pluginsdk.Resource { @@ -33,8 +31,14 @@ func resourceDnsMxRecord() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.MxRecordID(id) - return err + parsed, err := recordsets.ParseRecordTypeID(id) + if err != nil { + return err + } + if parsed.RecordType != recordsets.RecordTypeMX { + return fmt.Errorf("this resource only supports 'MX' records") + } + return nil }), Schema: map[string]*pluginsdk.Schema{ @@ -45,11 +49,12 @@ func resourceDnsMxRecord() *pluginsdk.Resource { Default: "@", }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), "zone_name": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, }, "record": { @@ -82,13 +87,13 @@ func resourceDnsMxRecord() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } func resourceDnsMxRecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) subscriptionId := meta.(*clients.Client).Account.SubscriptionId defer cancel() @@ -97,87 +102,92 @@ func resourceDnsMxRecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{} resGroup := d.Get("resource_group_name").(string) zoneName := d.Get("zone_name").(string) - resourceId := parse.NewMxRecordID(subscriptionId, resGroup, zoneName, name) - + id := recordsets.NewRecordTypeID(subscriptionId, resGroup, zoneName, recordsets.RecordTypeMX, name) if d.IsNewResource() { - existing, err := client.Get(ctx, resGroup, zoneName, name, dns.MX) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing DNS MX Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_dns_mx_record", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_dns_mx_record", id.ID()) } } ttl := int64(d.Get("ttl").(int)) t := d.Get("tags").(map[string]interface{}) - parameters := dns.RecordSet{ + parameters := recordsets.RecordSet{ Name: &name, - RecordSetProperties: &dns.RecordSetProperties{ + Properties: &recordsets.RecordSetProperties{ Metadata: tags.Expand(t), TTL: &ttl, - MxRecords: expandAzureRmDnsMxRecords(d), + MXRecords: expandAzureRmDnsMxRecords(d), }, } - if _, err := client.CreateOrUpdate(ctx, resGroup, zoneName, name, dns.MX, parameters, "", ""); err != nil { - return fmt.Errorf("creating/updating DNS MX Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) + if _, err := client.CreateOrUpdate(ctx, id, parameters, recordsets.DefaultCreateOrUpdateOperationOptions()); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - d.SetId(resourceId.ID()) - + d.SetId(id.ID()) return resourceDnsMxRecordRead(d, meta) } func resourceDnsMxRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.MxRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeIDInsensitively(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.DnszoneName, id.MXName, dns.MX) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("reading DNS MX record %s: %v", id.MXName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.MXName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("zone_name", id.DnszoneName) + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) - d.Set("ttl", resp.TTL) - d.Set("fqdn", resp.Fqdn) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) - if err := d.Set("record", flattenAzureRmDnsMxRecords(resp.MxRecords)); err != nil { - return err + if err := d.Set("record", flattenAzureRmDnsMxRecords(props.MXRecords)); err != nil { + return err + } + if err := tags.FlattenAndSet(d, props.Metadata); err != nil { + return err + } + } } - return tags.FlattenAndSet(d, resp.Metadata) + + return nil } func resourceDnsMxRecordDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.MxRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.DnszoneName, id.MXName, dns.MX, "") - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("deleting DNS MX Record %s: %+v", id.MXName, err) + if _, err := client.Delete(ctx, *id, recordsets.DefaultDeleteOperationOptions()); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil @@ -186,16 +196,25 @@ func resourceDnsMxRecordDelete(d *pluginsdk.ResourceData, meta interface{}) erro // flatten creates an array of map where preference is a string to suit // the expectations of the ResourceData schema, so that this data can be // managed by Terradata state. -func flattenAzureRmDnsMxRecords(records *[]dns.MxRecord) []map[string]interface{} { +func flattenAzureRmDnsMxRecords(records *[]recordsets.MxRecord) []map[string]interface{} { results := make([]map[string]interface{}, 0) if records != nil { for _, record := range *records { - preferenceI32 := *record.Preference - preference := strconv.Itoa(int(preferenceI32)) + // TODO: convert this to use an int64 + preference := "" + if record.Preference != nil { + preference = strconv.Itoa(int(*record.Preference)) + } + + exchange := "" + if record.Exchange != nil { + exchange = *record.Exchange + } + results = append(results, map[string]interface{}{ "preference": preference, - "exchange": *record.Exchange, + "exchange": exchange, }) } } @@ -206,19 +225,18 @@ func flattenAzureRmDnsMxRecords(records *[]dns.MxRecord) []map[string]interface{ // expand creates an array of dns.MxRecord, that is, the array needed // by azure-sdk-for-go to manipulate azure resources, hence Preference // is an int32 -func expandAzureRmDnsMxRecords(d *pluginsdk.ResourceData) *[]dns.MxRecord { +func expandAzureRmDnsMxRecords(d *pluginsdk.ResourceData) *[]recordsets.MxRecord { recordStrings := d.Get("record").(*pluginsdk.Set).List() - records := make([]dns.MxRecord, len(recordStrings)) + records := make([]recordsets.MxRecord, len(recordStrings)) for i, v := range recordStrings { mxrecord := v.(map[string]interface{}) preference := mxrecord["preference"].(string) i64, _ := strconv.ParseInt(preference, 10, 32) - i32 := int32(i64) exchange := mxrecord["exchange"].(string) - records[i] = dns.MxRecord{ - Preference: &i32, + records[i] = recordsets.MxRecord{ + Preference: &i64, Exchange: &exchange, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_ns_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_ns_record_data_source.go new file mode 100644 index 00000000000..e2a2cfc6fe8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_ns_record_data_source.go @@ -0,0 +1,96 @@ +package dns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourceDnsNsRecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceDnsNsRecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "records": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourceDnsNsRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).Dns.RecordSets + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeNS, d.Get("name").(string)) + + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("records", flattenAzureRmDnsNsRecords(props.NSRecords)); err != nil { + return fmt.Errorf("settings `records`: %+v", err) + } + + return tags.FlattenAndSet(d, props.Metadata) + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_ns_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_ns_record_resource.go index afe07c4ba3b..d68c4415ed8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_ns_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_ns_record_resource.go @@ -2,15 +2,14 @@ package dns import ( "fmt" - "net/http" "time" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -30,8 +29,14 @@ func resourceDnsNsRecord() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.NsRecordID(id) - return err + parsed, err := recordsets.ParseRecordTypeID(id) + if err != nil { + return err + } + if parsed.RecordType != recordsets.RecordTypeNS { + return fmt.Errorf("this resource only supports 'NS' records") + } + return nil }), Schema: map[string]*pluginsdk.Schema{ @@ -41,7 +46,7 @@ func resourceDnsNsRecord() *pluginsdk.Resource { ForceNew: true, }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), "zone_name": { Type: pluginsdk.TypeString, @@ -67,13 +72,13 @@ func resourceDnsNsRecord() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } func resourceDnsNsRecordCreate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) subscriptionId := meta.(*clients.Client).Account.SubscriptionId defer cancel() @@ -82,17 +87,16 @@ func resourceDnsNsRecordCreate(d *pluginsdk.ResourceData, meta interface{}) erro resGroup := d.Get("resource_group_name").(string) zoneName := d.Get("zone_name").(string) - resourceId := parse.NewNsRecordID(subscriptionId, resGroup, zoneName, name) - - existing, err := client.Get(ctx, resGroup, zoneName, name, dns.NS) + id := recordsets.NewRecordTypeID(subscriptionId, resGroup, zoneName, recordsets.RecordTypeNS, name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing DNS NS Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_dns_ns_record", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_dns_ns_record", id.ID()) } ttl := int64(d.Get("ttl").(int)) @@ -101,123 +105,125 @@ func resourceDnsNsRecordCreate(d *pluginsdk.ResourceData, meta interface{}) erro recordsRaw := d.Get("records").([]interface{}) records := expandAzureRmDnsNsRecords(recordsRaw) - parameters := dns.RecordSet{ + parameters := recordsets.RecordSet{ Name: &name, - RecordSetProperties: &dns.RecordSetProperties{ + Properties: &recordsets.RecordSetProperties{ Metadata: tags.Expand(t), TTL: &ttl, - NsRecords: records, + NSRecords: records, }, } - eTag := "" - ifNoneMatch := "" // set to empty to allow updates to records after creation - if _, err := client.CreateOrUpdate(ctx, resGroup, zoneName, name, dns.NS, parameters, eTag, ifNoneMatch); err != nil { - return fmt.Errorf("creating DNS NS Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) + if _, err := client.CreateOrUpdate(ctx, id, parameters, recordsets.DefaultCreateOrUpdateOperationOptions()); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } - d.SetId(resourceId.ID()) - + d.SetId(id.ID()) return resourceDnsNsRecordRead(d, meta) } func resourceDnsNsRecordUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NsRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeID(d.Id()) if err != nil { return err } - existing, err := client.Get(ctx, id.ResourceGroup, id.DnszoneName, id.NSName, dns.NS) + existing, err := client.Get(ctx, *id) if err != nil { - return fmt.Errorf("retrieving NS %q (DNS Zone %q / Resource Group %q): %+v", id.NSName, id.DnszoneName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - - if existing.RecordSetProperties == nil { - return fmt.Errorf("retrieving NS %q (DNS Zone %q / Resource Group %q): `properties` was nil", id.NSName, id.DnszoneName, id.ResourceGroup) + if existing.Model == nil { + return fmt.Errorf("retrieving %s: `model` was nil", *id) + } + if existing.Model.Properties == nil { + return fmt.Errorf("retrieving %s: `properties` was nil", *id) } if d.HasChange("records") { recordsRaw := d.Get("records").([]interface{}) records := expandAzureRmDnsNsRecords(recordsRaw) - existing.RecordSetProperties.NsRecords = records + existing.Model.Properties.NSRecords = records } if d.HasChange("tags") { t := d.Get("tags").(map[string]interface{}) - existing.RecordSetProperties.Metadata = tags.Expand(t) + existing.Model.Properties.Metadata = tags.Expand(t) } if d.HasChange("ttl") { - existing.RecordSetProperties.TTL = utils.Int64(int64(d.Get("ttl").(int))) + existing.Model.Properties.TTL = utils.Int64(int64(d.Get("ttl").(int))) } - eTag := "" - ifNoneMatch := "" // set to empty to allow updates to records after creation - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.DnszoneName, id.NSName, dns.NS, existing, eTag, ifNoneMatch); err != nil { - return fmt.Errorf("updating DNS NS Record %q (Zone %q / Resource Group %q): %s", id.NSName, id.DnszoneName, id.ResourceGroup, err) + if _, err := client.Update(ctx, *id, *existing.Model, recordsets.DefaultUpdateOperationOptions()); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } return resourceDnsNsRecordRead(d, meta) } func resourceDnsNsRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { - dnsClient := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NsRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeIDInsensitively(d.Id()) if err != nil { return err } - resp, err := dnsClient.Get(ctx, id.ResourceGroup, id.DnszoneName, id.NSName, dns.NS) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("reading DNS NS record %s: %+v", id.NSName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.NSName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("zone_name", id.DnszoneName) + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) - d.Set("ttl", resp.TTL) - d.Set("fqdn", resp.Fqdn) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) - if props := resp.RecordSetProperties; props != nil { - if err := d.Set("records", flattenAzureRmDnsNsRecords(props.NsRecords)); err != nil { - return fmt.Errorf("settings `records`: %+v", err) + if err := d.Set("records", flattenAzureRmDnsNsRecords(props.NSRecords)); err != nil { + return fmt.Errorf("settings `records`: %+v", err) + } + + if err := tags.FlattenAndSet(d, props.Metadata); err != nil { + return err + } } } - return tags.FlattenAndSet(d, resp.Metadata) + return nil } func resourceDnsNsRecordDelete(d *pluginsdk.ResourceData, meta interface{}) error { - dnsClient := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NsRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeID(d.Id()) if err != nil { return err } - resp, err := dnsClient.Delete(ctx, id.ResourceGroup, id.DnszoneName, id.NSName, dns.NS, "") - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("deleting DNS NS Record %s: %+v", id.NSName, err) + if _, err := client.Delete(ctx, *id, recordsets.DefaultDeleteOperationOptions()); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } -func flattenAzureRmDnsNsRecords(records *[]dns.NsRecord) []interface{} { +func flattenAzureRmDnsNsRecords(records *[]recordsets.NsRecord) []interface{} { if records == nil { return []interface{}{} } @@ -234,16 +240,14 @@ func flattenAzureRmDnsNsRecords(records *[]dns.NsRecord) []interface{} { return results } -func expandAzureRmDnsNsRecords(input []interface{}) *[]dns.NsRecord { - records := make([]dns.NsRecord, len(input)) - for i, v := range input { +func expandAzureRmDnsNsRecords(input []interface{}) *[]recordsets.NsRecord { + records := make([]recordsets.NsRecord, 0) + for _, v := range input { record := v.(string) - nsRecord := dns.NsRecord{ + records = append(records, recordsets.NsRecord{ Nsdname: &record, - } - - records[i] = nsRecord + }) } return &records } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_ptr_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_ptr_record_data_source.go new file mode 100644 index 00000000000..b323c1a1906 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_ptr_record_data_source.go @@ -0,0 +1,95 @@ +package dns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourceDnsPtrRecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceDnsPtrRecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "records": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, + Set: pluginsdk.HashString, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourceDnsPtrRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).Dns.RecordSets + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypePTR, d.Get("name").(string)) + + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("records", flattenAzureRmDnsPtrRecords(props.PTRRecords)); err != nil { + return err + } + + return tags.FlattenAndSet(d, props.Metadata) + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_ptr_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_ptr_record_resource.go index de7e5c38e82..8b69bf27b4e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_ptr_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_ptr_record_resource.go @@ -2,18 +2,16 @@ package dns import ( "fmt" - "net/http" "time" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceDnsPtrRecord() *pluginsdk.Resource { @@ -31,8 +29,14 @@ func resourceDnsPtrRecord() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.PtrRecordID(id) - return err + parsed, err := recordsets.ParseRecordTypeID(id) + if err != nil { + return err + } + if parsed.RecordType != recordsets.RecordTypePTR { + return fmt.Errorf("this resource only supports 'PTR' records") + } + return nil }), Schema: map[string]*pluginsdk.Schema{ "name": { @@ -41,11 +45,12 @@ func resourceDnsPtrRecord() *pluginsdk.Resource { ForceNew: true, }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), "zone_name": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, }, "records": { @@ -65,13 +70,13 @@ func resourceDnsPtrRecord() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } func resourceDnsPtrRecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) subscriptionId := meta.(*clients.Client).Account.SubscriptionId defer cancel() @@ -80,104 +85,106 @@ func resourceDnsPtrRecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{ resGroup := d.Get("resource_group_name").(string) zoneName := d.Get("zone_name").(string) - resourceId := parse.NewPtrRecordID(subscriptionId, resGroup, zoneName, name) - + id := recordsets.NewRecordTypeID(subscriptionId, resGroup, zoneName, recordsets.RecordTypePTR, name) if d.IsNewResource() { - existing, err := client.Get(ctx, resGroup, zoneName, name, dns.PTR) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing DNS PTR Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_dns_ptr_record", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_dns_ptr_record", id.ID()) } } ttl := int64(d.Get("ttl").(int)) t := d.Get("tags").(map[string]interface{}) - parameters := dns.RecordSet{ - RecordSetProperties: &dns.RecordSetProperties{ + parameters := recordsets.RecordSet{ + Properties: &recordsets.RecordSetProperties{ Metadata: tags.Expand(t), TTL: &ttl, - PtrRecords: expandAzureRmDnsPtrRecords(d), + PTRRecords: expandAzureRmDnsPtrRecords(d), }, } - eTag := "" - ifNoneMatch := "" // set to empty to allow updates to records after creation - if _, err := client.CreateOrUpdate(ctx, resGroup, zoneName, name, dns.PTR, parameters, eTag, ifNoneMatch); err != nil { - return fmt.Errorf("creating/updating DNS PTR Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) + if _, err := client.CreateOrUpdate(ctx, id, parameters, recordsets.DefaultCreateOrUpdateOperationOptions()); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - d.SetId(resourceId.ID()) - + d.SetId(id.ID()) return resourceDnsPtrRecordRead(d, meta) } func resourceDnsPtrRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client) - dnsClient := client.Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.PtrRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeIDInsensitively(d.Id()) if err != nil { return err } - resp, err := dnsClient.Get(ctx, id.ResourceGroup, id.DnszoneName, id.PTRName, dns.PTR) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("reading DNS PTR record %s: %+v", id.PTRName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.PTRName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("zone_name", id.DnszoneName) - d.Set("ttl", resp.TTL) - d.Set("fqdn", resp.Fqdn) + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) - if err := d.Set("records", flattenAzureRmDnsPtrRecords(resp.PtrRecords)); err != nil { - return err + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("records", flattenAzureRmDnsPtrRecords(props.PTRRecords)); err != nil { + return err + } + if err := tags.FlattenAndSet(d, props.Metadata); err != nil { + return err + } + } } - return tags.FlattenAndSet(d, resp.Metadata) + + return nil } func resourceDnsPtrRecordDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client) - dnsClient := client.Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.PtrRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeID(d.Id()) if err != nil { return err } - resp, err := dnsClient.Delete(ctx, id.ResourceGroup, id.DnszoneName, id.PTRName, dns.PTR, "") - if err != nil { - if resp.StatusCode == http.StatusNotFound { - return nil - } - - return fmt.Errorf("deleting DNS PTR Record %s: %+v", id.PTRName, err) + if _, err := client.Delete(ctx, *id, recordsets.DefaultDeleteOperationOptions()); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } -func flattenAzureRmDnsPtrRecords(records *[]dns.PtrRecord) []string { +func flattenAzureRmDnsPtrRecords(records *[]recordsets.PtrRecord) []string { results := make([]string, 0) if records != nil { for _, record := range *records { + if record.Ptrdname == nil { + continue + } + results = append(results, *record.Ptrdname) } } @@ -185,15 +192,15 @@ func flattenAzureRmDnsPtrRecords(records *[]dns.PtrRecord) []string { return results } -func expandAzureRmDnsPtrRecords(d *pluginsdk.ResourceData) *[]dns.PtrRecord { +func expandAzureRmDnsPtrRecords(d *pluginsdk.ResourceData) *[]recordsets.PtrRecord { recordStrings := d.Get("records").(*pluginsdk.Set).List() - records := make([]dns.PtrRecord, len(recordStrings)) + records := make([]recordsets.PtrRecord, 0) - for i, v := range recordStrings { + for _, v := range recordStrings { fqdn := v.(string) - records[i] = dns.PtrRecord{ + records = append(records, recordsets.PtrRecord{ Ptrdname: &fqdn, - } + }) } return &records diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_soa_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_soa_record_data_source.go new file mode 100644 index 00000000000..119408e67a5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_soa_record_data_source.go @@ -0,0 +1,129 @@ +package dns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourceDnsSoaRecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceDnsSoaRecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "@", + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "email": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "host_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "expire_time": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "minimum_ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "refresh_time": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "retry_time": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "serial_number": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourceDnsSoaRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).Dns.RecordSets + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeSOA, "@") + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) + + if soaRecord := props.SOARecord; soaRecord != nil { + d.Set("email", soaRecord.Email) + d.Set("host_name", soaRecord.Host) + d.Set("expire_time", soaRecord.ExpireTime) + d.Set("minimum_ttl", soaRecord.MinimumTTL) + d.Set("refresh_time", soaRecord.RefreshTime) + d.Set("retry_time", soaRecord.RetryTime) + d.Set("serial_number", soaRecord.SerialNumber) + } + + return tags.FlattenAndSet(d, props.Metadata) + } + + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_srv_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_srv_record_data_source.go new file mode 100644 index 00000000000..504f8597c61 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_srv_record_data_source.go @@ -0,0 +1,116 @@ +package dns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourceDnsSrvRecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceDnsSrvRecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "record": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "priority": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "weight": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "port": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "target": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + Set: resourceDnsSrvRecordHash, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourceDnsSrvRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).Dns.RecordSets + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeSRV, d.Get("name").(string)) + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("record", flattenAzureRmDnsSrvRecords(props.SRVRecords)); err != nil { + return err + } + + return tags.FlattenAndSet(d, props.Metadata) + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_srv_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_srv_record_resource.go index 5616eaeb804..025fd126fd5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_srv_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_srv_record_resource.go @@ -3,18 +3,16 @@ package dns import ( "bytes" "fmt" - "net/http" "time" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceDnsSrvRecord() *pluginsdk.Resource { @@ -31,8 +29,14 @@ func resourceDnsSrvRecord() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.SrvRecordID(id) - return err + parsed, err := recordsets.ParseRecordTypeID(id) + if err != nil { + return err + } + if parsed.RecordType != recordsets.RecordTypeSRV { + return fmt.Errorf("this resource only supports 'SRV' records") + } + return nil }), Schema: map[string]*pluginsdk.Schema{ "name": { @@ -41,11 +45,12 @@ func resourceDnsSrvRecord() *pluginsdk.Resource { ForceNew: true, }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), "zone_name": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, }, "record": { @@ -87,13 +92,13 @@ func resourceDnsSrvRecord() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } func resourceDnsSrvRecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) subscriptionId := meta.(*clients.Client).Account.SubscriptionId defer cancel() @@ -102,103 +107,129 @@ func resourceDnsSrvRecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{ resGroup := d.Get("resource_group_name").(string) zoneName := d.Get("zone_name").(string) - resourceId := parse.NewSrvRecordID(subscriptionId, resGroup, zoneName, name) - + id := recordsets.NewRecordTypeID(subscriptionId, resGroup, zoneName, recordsets.RecordTypeSRV, name) if d.IsNewResource() { - existing, err := client.Get(ctx, resGroup, zoneName, name, dns.SRV) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing DNS SRV Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_dns_srv_record", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_dns_srv_record", id.ID()) } } ttl := int64(d.Get("ttl").(int)) t := d.Get("tags").(map[string]interface{}) - parameters := dns.RecordSet{ + parameters := recordsets.RecordSet{ Name: &name, - RecordSetProperties: &dns.RecordSetProperties{ + Properties: &recordsets.RecordSetProperties{ Metadata: tags.Expand(t), TTL: &ttl, - SrvRecords: expandAzureRmDnsSrvRecords(d), + SRVRecords: expandAzureRmDnsSrvRecords(d), }, } - eTag := "" - ifNoneMatch := "" // set to empty to allow updates to records after creation - if _, err := client.CreateOrUpdate(ctx, resGroup, zoneName, name, dns.SRV, parameters, eTag, ifNoneMatch); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters, recordsets.DefaultCreateOrUpdateOperationOptions()); err != nil { return fmt.Errorf("creating/updating DNS SRV Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) return resourceDnsSrvRecordRead(d, meta) } func resourceDnsSrvRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SrvRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeIDInsensitively(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.DnszoneName, id.SRVName, dns.SRV) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("reading DNS SRV record %s: %v", id.SRVName, err) + + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.SRVName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("zone_name", id.DnszoneName) - d.Set("ttl", resp.TTL) - d.Set("fqdn", resp.Fqdn) + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) - if err := d.Set("record", flattenAzureRmDnsSrvRecords(resp.SrvRecords)); err != nil { - return err + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("record", flattenAzureRmDnsSrvRecords(props.SRVRecords)); err != nil { + return err + } + if err := tags.FlattenAndSet(d, props.Metadata); err != nil { + return err + } + } } - return tags.FlattenAndSet(d, resp.Metadata) + + return nil } func resourceDnsSrvRecordDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SrvRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.DnszoneName, id.SRVName, dns.SRV, "") - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("deleting DNS SRV Record %s: %+v", id.SRVName, err) + if _, err := client.Delete(ctx, *id, recordsets.DefaultDeleteOperationOptions()); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } -func flattenAzureRmDnsSrvRecords(records *[]dns.SrvRecord) []map[string]interface{} { +func flattenAzureRmDnsSrvRecords(records *[]recordsets.SrvRecord) []map[string]interface{} { results := make([]map[string]interface{}, 0) if records != nil { for _, record := range *records { + port := int64(0) + if record.Port != nil { + port = *record.Port + } + + priority := int64(0) + if record.Priority != nil { + priority = *record.Priority + } + + target := "" + if record.Target != nil { + target = *record.Target + } + + weight := int64(0) + if record.Weight != nil { + weight = *record.Weight + } + results = append(results, map[string]interface{}{ - "priority": *record.Priority, - "weight": *record.Weight, - "port": *record.Port, - "target": *record.Target, + "port": port, + "priority": priority, + "target": target, + "weight": weight, }) } } @@ -206,25 +237,23 @@ func flattenAzureRmDnsSrvRecords(records *[]dns.SrvRecord) []map[string]interfac return results } -func expandAzureRmDnsSrvRecords(d *pluginsdk.ResourceData) *[]dns.SrvRecord { +func expandAzureRmDnsSrvRecords(d *pluginsdk.ResourceData) *[]recordsets.SrvRecord { recordStrings := d.Get("record").(*pluginsdk.Set).List() - records := make([]dns.SrvRecord, len(recordStrings)) + records := make([]recordsets.SrvRecord, 0) - for i, v := range recordStrings { + for _, v := range recordStrings { record := v.(map[string]interface{}) - priority := int32(record["priority"].(int)) - weight := int32(record["weight"].(int)) - port := int32(record["port"].(int)) + priority := int64(record["priority"].(int)) + weight := int64(record["weight"].(int)) + port := int64(record["port"].(int)) target := record["target"].(string) - srvRecord := dns.SrvRecord{ + records = append(records, recordsets.SrvRecord{ Priority: &priority, Weight: &weight, Port: &port, Target: &target, - } - - records[i] = srvRecord + }) } return &records diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_txt_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_txt_record_data_source.go new file mode 100644 index 00000000000..1168e6e66af --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_txt_record_data_source.go @@ -0,0 +1,102 @@ +package dns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourceDnsTxtRecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceDnsTxtRecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "record": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "value": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourceDnsTxtRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).Dns.RecordSets + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeTXT, d.Get("name").(string)) + + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("record", flattenAzureRmDnsTxtRecords(props.TXTRecords)); err != nil { + return err + } + + return tags.FlattenAndSet(d, props.Metadata) + + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_txt_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_txt_record_resource.go index 3d53d2cf318..24633b8627c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_txt_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_txt_record_resource.go @@ -2,20 +2,18 @@ package dns import ( "fmt" - "net/http" "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceDnsTxtRecord() *pluginsdk.Resource { @@ -32,8 +30,14 @@ func resourceDnsTxtRecord() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.TxtRecordID(id) - return err + parsed, err := recordsets.ParseRecordTypeID(id) + if err != nil { + return err + } + if parsed.RecordType != recordsets.RecordTypeTXT { + return fmt.Errorf("this resource only supports 'TXT' records") + } + return nil }), Schema: map[string]*pluginsdk.Schema{ "name": { @@ -42,11 +46,12 @@ func resourceDnsTxtRecord() *pluginsdk.Resource { ForceNew: true, }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), "zone_name": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, }, "record": { @@ -73,13 +78,13 @@ func resourceDnsTxtRecord() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } func resourceDnsTxtRecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) subscriptionId := meta.(*clients.Client).Account.SubscriptionId defer cancel() @@ -88,115 +93,120 @@ func resourceDnsTxtRecordCreateUpdate(d *pluginsdk.ResourceData, meta interface{ resGroup := d.Get("resource_group_name").(string) zoneName := d.Get("zone_name").(string) - resourceId := parse.NewTxtRecordID(subscriptionId, resGroup, zoneName, name) - + id := recordsets.NewRecordTypeID(subscriptionId, resGroup, zoneName, recordsets.RecordTypeTXT, name) if d.IsNewResource() { - existing, err := client.Get(ctx, resGroup, zoneName, name, dns.TXT) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing DNS TXT Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_dns_txt_record", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_dns_txt_record", id.ID()) } } ttl := int64(d.Get("ttl").(int)) t := d.Get("tags").(map[string]interface{}) - parameters := dns.RecordSet{ + parameters := recordsets.RecordSet{ Name: &name, - RecordSetProperties: &dns.RecordSetProperties{ + Properties: &recordsets.RecordSetProperties{ Metadata: tags.Expand(t), TTL: &ttl, - TxtRecords: expandAzureRmDnsTxtRecords(d), + TXTRecords: expandAzureRmDnsTxtRecords(d), }, } - eTag := "" - ifNoneMatch := "" // set to empty to allow updates to records after creation - if _, err := client.CreateOrUpdate(ctx, resGroup, zoneName, name, dns.TXT, parameters, eTag, ifNoneMatch); err != nil { - return fmt.Errorf("creating/updating DNS TXT Record %q (Zone %q / Resource Group %q): %s", name, zoneName, resGroup, err) + if _, err := client.CreateOrUpdate(ctx, id, parameters, recordsets.DefaultCreateOrUpdateOperationOptions()); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) return resourceDnsTxtRecordRead(d, meta) } func resourceDnsTxtRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.TxtRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeIDInsensitively(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.DnszoneName, id.TXTName, dns.TXT) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("reading DNS TXT record %s: %+v", id.TXTName, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.TXTName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("zone_name", id.DnszoneName) - d.Set("ttl", resp.TTL) - d.Set("fqdn", resp.Fqdn) + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.ZoneName) - if err := d.Set("record", flattenAzureRmDnsTxtRecords(resp.TxtRecords)); err != nil { - return err + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.TTL) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("record", flattenAzureRmDnsTxtRecords(props.TXTRecords)); err != nil { + return err + } + if err := tags.FlattenAndSet(d, props.Metadata); err != nil { + return err + } + } } - return tags.FlattenAndSet(d, resp.Metadata) + + return nil } func resourceDnsTxtRecordDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.TxtRecordID(d.Id()) + id, err := recordsets.ParseRecordTypeID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.DnszoneName, id.TXTName, dns.TXT, "") - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("deleting DNS TXT Record %s: %+v", id.TXTName, err) + if _, err := client.Delete(ctx, *id, recordsets.DefaultDeleteOperationOptions()); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } -func flattenAzureRmDnsTxtRecords(records *[]dns.TxtRecord) []map[string]interface{} { +func flattenAzureRmDnsTxtRecords(records *[]recordsets.TxtRecord) []map[string]interface{} { results := make([]map[string]interface{}, 0) if records != nil { for _, record := range *records { - txtRecord := make(map[string]interface{}) - + value := "" if v := record.Value; v != nil { - value := strings.Join(*v, "") - txtRecord["value"] = value + value = strings.Join(*v, "") } - results = append(results, txtRecord) + results = append(results, map[string]interface{}{ + "value": value, + }) } } return results } -func expandAzureRmDnsTxtRecords(d *pluginsdk.ResourceData) *[]dns.TxtRecord { +func expandAzureRmDnsTxtRecords(d *pluginsdk.ResourceData) *[]recordsets.TxtRecord { recordStrings := d.Get("record").(*pluginsdk.Set).List() - records := make([]dns.TxtRecord, len(recordStrings)) + records := make([]recordsets.TxtRecord, len(recordStrings)) segmentLen := 254 for i, v := range recordStrings { @@ -210,11 +220,9 @@ func expandAzureRmDnsTxtRecords(d *pluginsdk.ResourceData) *[]dns.TxtRecord { } value = append(value, v) - txtRecord := dns.TxtRecord{ + records[i] = recordsets.TxtRecord{ Value: &value, } - - records[i] = txtRecord } return &records diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_zone_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_zone_data_source.go index b931520edc8..bdd483ad11d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_zone_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_zone_data_source.go @@ -5,13 +5,14 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceDnsZone() *pluginsdk.Resource { @@ -29,6 +30,7 @@ func dataSourceDnsZone() *pluginsdk.Resource { }, "resource_group_name": { + // TODO: we need a CommonSchema type for this which doesn't have ForceNew Type: pluginsdk.TypeString, Optional: true, Computed: true, @@ -51,54 +53,53 @@ func dataSourceDnsZone() *pluginsdk.Resource { Set: pluginsdk.HashString, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } func dataSourceDnsZoneRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.ZonesClient - ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + client := meta.(*clients.Client).Dns.Zones subscriptionId := meta.(*clients.Client).Account.SubscriptionId - + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - resourceGroup := d.Get("resource_group_name").(string) - - var ( - resp dns.Zone - err error - ) - if resourceGroup != "" { - resp, err = client.Get(ctx, resourceGroup, name) + id := zones.NewDnsZoneID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + var zone *zones.Zone + if id.ResourceGroupName != "" { + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf("Error: DNS Zone %q (Resource Group %q) was not found", name, resourceGroup) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) } - return fmt.Errorf("reading DNS Zone %q (Resource Group %q): %+v", name, resourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } + + zone = resp.Model } else { - var zone *dns.Zone - zone, resourceGroup, err = findZone(client, ctx, name) + result, resourceGroupName, err := findZone(ctx, client, id.SubscriptionId, id.ZoneName) if err != nil { return err } - if zone == nil { - return fmt.Errorf("Error: DNS Zone %q was not found", name) + if resourceGroupName == nil { + return fmt.Errorf("unable to locate the Resource Group for DNS Zone %q in Subscription %q", id.ResourceGroupName, subscriptionId) } - resp = *zone + zone = result + id.ResourceGroupName = *resourceGroupName } - resourceId := parse.NewDnsZoneID(subscriptionId, resourceGroup, name) - d.SetId(resourceId.ID()) + if zone == nil { + return fmt.Errorf("retrieving %s: `model` was nil", id) + } + + d.SetId(id.ID()) - d.Set("name", name) - d.Set("resource_group_name", resourceGroup) + d.Set("name", id.ZoneName) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.ZoneProperties; props != nil { + if props := zone.Properties; props != nil { d.Set("number_of_record_sets", props.NumberOfRecordSets) d.Set("max_number_of_record_sets", props.MaxNumberOfRecordSets) @@ -111,36 +112,37 @@ func dataSourceDnsZoneRead(d *pluginsdk.ResourceData, meta interface{}) error { } } - return tags.FlattenAndSet(d, resp.Tags) + if err := tags.FlattenAndSet(d, zone.Tags); err != nil { + return err + } + + return nil } -func findZone(client *dns.ZonesClient, ctx context.Context, name string) (*dns.Zone, string, error) { - zonesIterator, err := client.ListComplete(ctx, nil) +func findZone(ctx context.Context, client *zones.ZonesClient, subscriptionId, name string) (*zones.Zone, *string, error) { + subscriptionResourceId := commonids.NewSubscriptionID(subscriptionId) + zonesIterator, err := client.ListComplete(ctx, subscriptionResourceId, zones.DefaultListOperationOptions()) if err != nil { - return nil, "", fmt.Errorf("listing DNS Zones: %+v", err) + return nil, nil, fmt.Errorf("listing DNS Zones: %+v", err) } - var found *dns.Zone - for zonesIterator.NotDone() { - zone := zonesIterator.Value() + var found zones.Zone + for _, zone := range zonesIterator.Items { if zone.Name != nil && *zone.Name == name { - if found != nil { - return nil, "", fmt.Errorf("found multiple DNS zones with name %q, please specify the resource group", name) + if found.Id != nil { + return nil, nil, fmt.Errorf("found multiple DNS zones with name %q, please specify the resource group", name) } - found = &zone - } - if err := zonesIterator.NextWithContext(ctx); err != nil { - return nil, "", fmt.Errorf("listing DNS Zones: %+v", err) + found = zone } } - if found == nil || found.ID == nil { - return nil, "", fmt.Errorf("could not find DNS zone with name: %q", name) + if found.Id == nil { + return nil, nil, fmt.Errorf("could not find DNS zone with name: %q", name) } - id, err := parse.DnsZoneID(*found.ID) + id, err := zones.ParseDnsZoneIDInsensitively(*found.Id) if err != nil { - return nil, "", fmt.Errorf("DNS zone id not valid: %+v", err) + return nil, nil, fmt.Errorf("parsing %q as a DNS Zone ID: %+v", *found.Id, err) } - return found, id.ResourceGroup, nil + return &found, &id.ResourceGroupName, nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_zone_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_zone_resource.go index 729fe806dc9..eccba9569d7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_zone_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/dns_zone_resource.go @@ -5,14 +5,16 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -39,7 +41,7 @@ func resourceDnsZone() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DnsZoneID(id) + _, err := zones.ParseDnsZoneID(id) return err }), Schema: map[string]*pluginsdk.Schema{ @@ -49,7 +51,7 @@ func resourceDnsZone() *pluginsdk.Resource { ForceNew: true, }, - "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), + "resource_group_name": commonschema.ResourceGroupName(), "number_of_record_sets": { Type: pluginsdk.TypeInt, @@ -130,7 +132,7 @@ func resourceDnsZone() *pluginsdk.Resource { ValidateFunc: validation.IntBetween(0, 2147483647), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "fqdn": { Type: pluginsdk.TypeString, @@ -140,145 +142,142 @@ func resourceDnsZone() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } func resourceDnsZoneCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.ZonesClient - recordSetsClient := meta.(*clients.Client).Dns.RecordSetsClient + client := meta.(*clients.Client).Dns.Zones + recordSetsClient := meta.(*clients.Client).Dns.RecordSets subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - resGroup := d.Get("resource_group_name").(string) - - resourceId := parse.NewDnsZoneID(subscriptionId, resGroup, name) - + id := zones.NewDnsZoneID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, resGroup, name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing DNS Zone %q (Resource Group %q): %s", name, resGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_dns_zone", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_dns_zone", id.ID()) } } - location := "global" t := d.Get("tags").(map[string]interface{}) - parameters := dns.Zone{ - Location: &location, + parameters := zones.Zone{ + Location: location.Normalize("global"), Tags: tags.Expand(t), } - etag := "" - ifNoneMatch := "" // set to empty to allow updates to records after creation - if _, err := client.CreateOrUpdate(ctx, resGroup, name, parameters, etag, ifNoneMatch); err != nil { - return fmt.Errorf("creating/updating DNS Zone %q (Resource Group %q): %s", name, resGroup, err) + if _, err := client.CreateOrUpdate(ctx, id, parameters, zones.DefaultCreateOrUpdateOperationOptions()); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } if v, ok := d.GetOk("soa_record"); ok { soaRecord := v.([]interface{})[0].(map[string]interface{}) - rsParameters := dns.RecordSet{ - RecordSetProperties: &dns.RecordSetProperties{ + rsParameters := recordsets.RecordSet{ + Properties: &recordsets.RecordSetProperties{ TTL: utils.Int64(int64(soaRecord["ttl"].(int))), Metadata: tags.Expand(soaRecord["tags"].(map[string]interface{})), - SoaRecord: expandArmDNSZoneSOARecord(soaRecord), + SOARecord: expandArmDNSZoneSOARecord(soaRecord), }, } - if len(name+strings.TrimSuffix(*rsParameters.RecordSetProperties.SoaRecord.Email, ".")) > 253 { + if len(id.ZoneName+strings.TrimSuffix(*rsParameters.Properties.SOARecord.Email, ".")) > 253 { return fmt.Errorf("`email` which is concatenated with DNS Zone `name` cannot exceed 253 characters excluding a trailing period") } - if _, err := recordSetsClient.CreateOrUpdate(ctx, resGroup, name, "@", dns.SOA, rsParameters, etag, ifNoneMatch); err != nil { - return fmt.Errorf("creating/updating DNS SOA Record @ (Zone %q / Resource Group %q): %s", name, resGroup, err) + soaRecordId := recordsets.NewRecordTypeID(id.SubscriptionId, id.ResourceGroupName, id.ZoneName, recordsets.RecordTypeSOA, "@") + if _, err := recordSetsClient.CreateOrUpdate(ctx, soaRecordId, rsParameters, recordsets.DefaultCreateOrUpdateOperationOptions()); err != nil { + return fmt.Errorf("creating/updating %s: %+v", soaRecordId, err) } } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) return resourceDnsZoneRead(d, meta) } func resourceDnsZoneRead(d *pluginsdk.ResourceData, meta interface{}) error { - zonesClient := meta.(*clients.Client).Dns.ZonesClient - recordSetsClient := meta.(*clients.Client).Dns.RecordSetsClient + zonesClient := meta.(*clients.Client).Dns.Zones + recordSetsClient := meta.(*clients.Client).Dns.RecordSets ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DnsZoneID(d.Id()) + id, err := zones.ParseDnsZoneIDInsensitively(d.Id()) if err != nil { return err } - resp, err := zonesClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := zonesClient.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("reading DNS Zone %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - - d.Set("number_of_record_sets", resp.NumberOfRecordSets) - d.Set("max_number_of_record_sets", resp.MaxNumberOfRecordSets) - - nameServers := make([]string, 0) - if s := resp.NameServers; s != nil { - nameServers = *s - } - if err := d.Set("name_servers", nameServers); err != nil { - return err - } - - rsResp, err := recordSetsClient.Get(ctx, id.ResourceGroup, id.Name, "@", dns.SOA) + soaRecord := recordsets.NewRecordTypeID(id.SubscriptionId, id.ResourceGroupName, id.ZoneName, recordsets.RecordTypeSOA, "@") + soaRecordResp, err := recordSetsClient.Get(ctx, soaRecord) if err != nil { - return fmt.Errorf("reading DNS SOA record @: %v", err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - if err := d.Set("soa_record", flattenArmDNSZoneSOARecord(&rsResp)); err != nil { + if err := d.Set("soa_record", flattenArmDNSZoneSOARecord(soaRecordResp.Model)); err != nil { return fmt.Errorf("setting `soa_record`: %+v", err) } - return tags.FlattenAndSet(d, resp.Tags) + d.Set("name", id.ZoneName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("number_of_record_sets", props.NumberOfRecordSets) + d.Set("max_number_of_record_sets", props.MaxNumberOfRecordSets) + + nameServers := make([]string, 0) + if s := props.NameServers; s != nil { + nameServers = *s + } + if err := d.Set("name_servers", nameServers); err != nil { + return err + } + } + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } + } + + return nil } func resourceDnsZoneDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).Dns.ZonesClient + client := meta.(*clients.Client).Dns.Zones ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DnsZoneID(d.Id()) + id, err := zones.ParseDnsZoneID(d.Id()) if err != nil { return err } - etag := "" - future, err := client.Delete(ctx, id.ResourceGroup, id.Name, etag) - if err != nil { - return fmt.Errorf("deleting DNS Zone %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the deletion of DNS Zone %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err := client.DeleteThenPoll(ctx, *id, zones.DefaultDeleteOperationOptions()); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } -func expandArmDNSZoneSOARecord(input map[string]interface{}) *dns.SoaRecord { - return &dns.SoaRecord{ +func expandArmDNSZoneSOARecord(input map[string]interface{}) *recordsets.SoaRecord { + return &recordsets.SoaRecord{ Email: utils.String(input["email"].(string)), Host: utils.String(input["host_name"].(string)), ExpireTime: utils.Int64(int64(input["expire_time"].(int))), @@ -289,75 +288,76 @@ func expandArmDNSZoneSOARecord(input map[string]interface{}) *dns.SoaRecord { } } -func flattenArmDNSZoneSOARecord(input *dns.RecordSet) []interface{} { - if input == nil { - return make([]interface{}, 0) - } - - ttl := 0 - if input.TTL != nil { - ttl = int(*input.TTL) - } - - metaData := make(map[string]interface{}) - if input.Metadata != nil { - metaData = tags.Flatten(input.Metadata) - } - - fqdn := "" - if input.Fqdn != nil { - fqdn = *input.Fqdn - } - - email := "" - hostName := "" - expireTime := 0 - minimumTTL := 0 - refreshTime := 0 - retryTime := 0 - serialNumber := 0 - if input.SoaRecord != nil { - if input.SoaRecord.Email != nil { - email = *input.SoaRecord.Email - } - - if input.SoaRecord.Host != nil { - hostName = *input.SoaRecord.Host - } - - if input.SoaRecord.ExpireTime != nil { - expireTime = int(*input.SoaRecord.ExpireTime) - } +func flattenArmDNSZoneSOARecord(input *recordsets.RecordSet) []interface{} { + output := make([]interface{}, 0) + if input != nil { + if props := input.Properties; props != nil { + ttl := 0 + if props.TTL != nil { + ttl = int(*props.TTL) + } - if input.SoaRecord.MinimumTTL != nil { - minimumTTL = int(*input.SoaRecord.MinimumTTL) - } + metaData := make(map[string]interface{}) + if props.Metadata != nil { + metaData = tags.Flatten(props.Metadata) + } - if input.SoaRecord.RefreshTime != nil { - refreshTime = int(*input.SoaRecord.RefreshTime) - } + fqdn := "" + if props.Fqdn != nil { + fqdn = *props.Fqdn + } - if input.SoaRecord.RetryTime != nil { - retryTime = int(*input.SoaRecord.RetryTime) - } + email := "" + hostName := "" + expireTime := 0 + minimumTTL := 0 + refreshTime := 0 + retryTime := 0 + serialNumber := 0 + if record := props.SOARecord; record != nil { + if record.Email != nil { + email = *record.Email + } + + if record.Host != nil { + hostName = *record.Host + } + + if record.ExpireTime != nil { + expireTime = int(*record.ExpireTime) + } + + if record.MinimumTTL != nil { + minimumTTL = int(*record.MinimumTTL) + } + + if record.RefreshTime != nil { + refreshTime = int(*record.RefreshTime) + } + + if record.RetryTime != nil { + retryTime = int(*record.RetryTime) + } + + if record.SerialNumber != nil { + serialNumber = int(*record.SerialNumber) + } + } - if input.SoaRecord.SerialNumber != nil { - serialNumber = int(*input.SoaRecord.SerialNumber) + output = append(output, map[string]interface{}{ + "email": email, + "host_name": hostName, + "expire_time": expireTime, + "minimum_ttl": minimumTTL, + "refresh_time": refreshTime, + "retry_time": retryTime, + "serial_number": serialNumber, + "ttl": ttl, + "tags": metaData, + "fqdn": fqdn, + }) } } - return []interface{}{ - map[string]interface{}{ - "email": email, - "host_name": hostName, - "expire_time": expireTime, - "minimum_ttl": minimumTTL, - "refresh_time": refreshTime, - "retry_time": retryTime, - "serial_number": serialNumber, - "ttl": ttl, - "tags": metaData, - "fqdn": fqdn, - }, - } + return output } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/migration/dns_zone_V0_to_V1.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/migration/dns_zone_V0_to_V1.go index 9222e7d66d4..d67a5af9c08 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/migration/dns_zone_V0_to_V1.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/migration/dns_zone_V0_to_V1.go @@ -5,8 +5,8 @@ import ( "fmt" "log" + "github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -129,20 +129,20 @@ func (DnsZoneV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { groupsClient := meta.(*clients.Client).Resource.GroupsClient oldId := rawState["id"].(string) - id, err := parse.DnsZoneID(oldId) + id, err := zones.ParseDnsZoneID(oldId) if err != nil { return rawState, err } - resGroup, err := groupsClient.Get(ctx, id.ResourceGroup) + resGroup, err := groupsClient.Get(ctx, id.ResourceGroupName) if err != nil { return rawState, err } if resGroup.Name == nil { - return rawState, fmt.Errorf("`name` was nil for Resource Group %q", id.ResourceGroup) + return rawState, fmt.Errorf("`name` was nil for Resource Group %q", id.ResourceGroupName) } resourceGroup := *resGroup.Name name := rawState["name"].(string) - newId := parse.NewDnsZoneID(id.SubscriptionId, resourceGroup, name).ID() + newId := zones.NewDnsZoneID(id.SubscriptionId, resourceGroup, name).ID() log.Printf("Updating `id` from %q to %q", oldId, newId) rawState["id"] = newId return rawState, nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/a_record.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/a_record.go deleted file mode 100644 index cc22cfdc3cd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/a_record.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ARecordId struct { - SubscriptionId string - ResourceGroup string - DnszoneName string - AName string -} - -func NewARecordID(subscriptionId, resourceGroup, dnszoneName, aName string) ARecordId { - return ARecordId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - DnszoneName: dnszoneName, - AName: aName, - } -} - -func (id ARecordId) String() string { - segments := []string{ - fmt.Sprintf("A Name %q", id.AName), - fmt.Sprintf("Dnszone Name %q", id.DnszoneName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "A Record", segmentsStr) -} - -func (id ARecordId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnszones/%s/A/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.DnszoneName, id.AName) -} - -// ARecordID parses a ARecord ID into an ARecordId struct -func ARecordID(input string) (*ARecordId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ARecordId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.DnszoneName, err = id.PopSegment("dnszones"); err != nil { - return nil, err - } - if resourceId.AName, err = id.PopSegment("A"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/aaaa_record.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/aaaa_record.go deleted file mode 100644 index 4c05e28108c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/aaaa_record.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type AaaaRecordId struct { - SubscriptionId string - ResourceGroup string - DnszoneName string - AAAAName string -} - -func NewAaaaRecordID(subscriptionId, resourceGroup, dnszoneName, aAAAName string) AaaaRecordId { - return AaaaRecordId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - DnszoneName: dnszoneName, - AAAAName: aAAAName, - } -} - -func (id AaaaRecordId) String() string { - segments := []string{ - fmt.Sprintf("A A A A Name %q", id.AAAAName), - fmt.Sprintf("Dnszone Name %q", id.DnszoneName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Aaaa Record", segmentsStr) -} - -func (id AaaaRecordId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnszones/%s/AAAA/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.DnszoneName, id.AAAAName) -} - -// AaaaRecordID parses a AaaaRecord ID into an AaaaRecordId struct -func AaaaRecordID(input string) (*AaaaRecordId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := AaaaRecordId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.DnszoneName, err = id.PopSegment("dnszones"); err != nil { - return nil, err - } - if resourceId.AAAAName, err = id.PopSegment("AAAA"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/caa_record.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/caa_record.go deleted file mode 100644 index 156be086f69..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/caa_record.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type CaaRecordId struct { - SubscriptionId string - ResourceGroup string - DnszoneName string - CAAName string -} - -func NewCaaRecordID(subscriptionId, resourceGroup, dnszoneName, cAAName string) CaaRecordId { - return CaaRecordId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - DnszoneName: dnszoneName, - CAAName: cAAName, - } -} - -func (id CaaRecordId) String() string { - segments := []string{ - fmt.Sprintf("C A A Name %q", id.CAAName), - fmt.Sprintf("Dnszone Name %q", id.DnszoneName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Caa Record", segmentsStr) -} - -func (id CaaRecordId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnszones/%s/CAA/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.DnszoneName, id.CAAName) -} - -// CaaRecordID parses a CaaRecord ID into an CaaRecordId struct -func CaaRecordID(input string) (*CaaRecordId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := CaaRecordId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.DnszoneName, err = id.PopSegment("dnszones"); err != nil { - return nil, err - } - if resourceId.CAAName, err = id.PopSegment("CAA"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/cname_record.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/cname_record.go deleted file mode 100644 index 1cdf96189e6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/cname_record.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type CnameRecordId struct { - SubscriptionId string - ResourceGroup string - DnszoneName string - CNAMEName string -} - -func NewCnameRecordID(subscriptionId, resourceGroup, dnszoneName, cNAMEName string) CnameRecordId { - return CnameRecordId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - DnszoneName: dnszoneName, - CNAMEName: cNAMEName, - } -} - -func (id CnameRecordId) String() string { - segments := []string{ - fmt.Sprintf("C N A M E Name %q", id.CNAMEName), - fmt.Sprintf("Dnszone Name %q", id.DnszoneName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Cname Record", segmentsStr) -} - -func (id CnameRecordId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnszones/%s/CNAME/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.DnszoneName, id.CNAMEName) -} - -// CnameRecordID parses a CnameRecord ID into an CnameRecordId struct -func CnameRecordID(input string) (*CnameRecordId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := CnameRecordId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.DnszoneName, err = id.PopSegment("dnszones"); err != nil { - return nil, err - } - if resourceId.CNAMEName, err = id.PopSegment("CNAME"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/dns_zone.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/dns_zone.go deleted file mode 100644 index 8f4564b18e9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/dns_zone.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DnsZoneId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewDnsZoneID(subscriptionId, resourceGroup, name string) DnsZoneId { - return DnsZoneId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id DnsZoneId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Dns Zone", segmentsStr) -} - -func (id DnsZoneId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnszones/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// DnsZoneID parses a DnsZone ID into an DnsZoneId struct -func DnsZoneID(input string) (*DnsZoneId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DnsZoneId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("dnszones"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/mx_record.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/mx_record.go deleted file mode 100644 index b1c6aa955c5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/mx_record.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type MxRecordId struct { - SubscriptionId string - ResourceGroup string - DnszoneName string - MXName string -} - -func NewMxRecordID(subscriptionId, resourceGroup, dnszoneName, mXName string) MxRecordId { - return MxRecordId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - DnszoneName: dnszoneName, - MXName: mXName, - } -} - -func (id MxRecordId) String() string { - segments := []string{ - fmt.Sprintf("M X Name %q", id.MXName), - fmt.Sprintf("Dnszone Name %q", id.DnszoneName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Mx Record", segmentsStr) -} - -func (id MxRecordId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnszones/%s/MX/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.DnszoneName, id.MXName) -} - -// MxRecordID parses a MxRecord ID into an MxRecordId struct -func MxRecordID(input string) (*MxRecordId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := MxRecordId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.DnszoneName, err = id.PopSegment("dnszones"); err != nil { - return nil, err - } - if resourceId.MXName, err = id.PopSegment("MX"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/ns_record.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/ns_record.go deleted file mode 100644 index dd8399f70f5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/ns_record.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type NsRecordId struct { - SubscriptionId string - ResourceGroup string - DnszoneName string - NSName string -} - -func NewNsRecordID(subscriptionId, resourceGroup, dnszoneName, nSName string) NsRecordId { - return NsRecordId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - DnszoneName: dnszoneName, - NSName: nSName, - } -} - -func (id NsRecordId) String() string { - segments := []string{ - fmt.Sprintf("N S Name %q", id.NSName), - fmt.Sprintf("Dnszone Name %q", id.DnszoneName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Ns Record", segmentsStr) -} - -func (id NsRecordId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnszones/%s/NS/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.DnszoneName, id.NSName) -} - -// NsRecordID parses a NsRecord ID into an NsRecordId struct -func NsRecordID(input string) (*NsRecordId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := NsRecordId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.DnszoneName, err = id.PopSegment("dnszones"); err != nil { - return nil, err - } - if resourceId.NSName, err = id.PopSegment("NS"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/ptr_record.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/ptr_record.go deleted file mode 100644 index e0b4965f0bd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/ptr_record.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type PtrRecordId struct { - SubscriptionId string - ResourceGroup string - DnszoneName string - PTRName string -} - -func NewPtrRecordID(subscriptionId, resourceGroup, dnszoneName, pTRName string) PtrRecordId { - return PtrRecordId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - DnszoneName: dnszoneName, - PTRName: pTRName, - } -} - -func (id PtrRecordId) String() string { - segments := []string{ - fmt.Sprintf("P T R Name %q", id.PTRName), - fmt.Sprintf("Dnszone Name %q", id.DnszoneName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Ptr Record", segmentsStr) -} - -func (id PtrRecordId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnszones/%s/PTR/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.DnszoneName, id.PTRName) -} - -// PtrRecordID parses a PtrRecord ID into an PtrRecordId struct -func PtrRecordID(input string) (*PtrRecordId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := PtrRecordId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.DnszoneName, err = id.PopSegment("dnszones"); err != nil { - return nil, err - } - if resourceId.PTRName, err = id.PopSegment("PTR"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/srv_record.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/srv_record.go deleted file mode 100644 index 2006f14bbd6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/srv_record.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type SrvRecordId struct { - SubscriptionId string - ResourceGroup string - DnszoneName string - SRVName string -} - -func NewSrvRecordID(subscriptionId, resourceGroup, dnszoneName, sRVName string) SrvRecordId { - return SrvRecordId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - DnszoneName: dnszoneName, - SRVName: sRVName, - } -} - -func (id SrvRecordId) String() string { - segments := []string{ - fmt.Sprintf("S R V Name %q", id.SRVName), - fmt.Sprintf("Dnszone Name %q", id.DnszoneName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Srv Record", segmentsStr) -} - -func (id SrvRecordId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnszones/%s/SRV/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.DnszoneName, id.SRVName) -} - -// SrvRecordID parses a SrvRecord ID into an SrvRecordId struct -func SrvRecordID(input string) (*SrvRecordId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := SrvRecordId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.DnszoneName, err = id.PopSegment("dnszones"); err != nil { - return nil, err - } - if resourceId.SRVName, err = id.PopSegment("SRV"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/txt_record.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/txt_record.go deleted file mode 100644 index 57b0bae2350..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse/txt_record.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type TxtRecordId struct { - SubscriptionId string - ResourceGroup string - DnszoneName string - TXTName string -} - -func NewTxtRecordID(subscriptionId, resourceGroup, dnszoneName, tXTName string) TxtRecordId { - return TxtRecordId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - DnszoneName: dnszoneName, - TXTName: tXTName, - } -} - -func (id TxtRecordId) String() string { - segments := []string{ - fmt.Sprintf("T X T Name %q", id.TXTName), - fmt.Sprintf("Dnszone Name %q", id.DnszoneName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Txt Record", segmentsStr) -} - -func (id TxtRecordId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/dnszones/%s/TXT/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.DnszoneName, id.TXTName) -} - -// TxtRecordID parses a TxtRecord ID into an TxtRecordId struct -func TxtRecordID(input string) (*TxtRecordId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := TxtRecordId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.DnszoneName, err = id.PopSegment("dnszones"); err != nil { - return nil, err - } - if resourceId.TXTName, err = id.PopSegment("TXT"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/registration.go index 4316c2bb110..34bd173367d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/registration.go @@ -28,7 +28,17 @@ func (r Registration) WebsiteCategories() []string { // SupportedDataSources returns the supported Data Sources supported by this Service func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ - "azurerm_dns_zone": dataSourceDnsZone(), + "azurerm_dns_a_record": dataSourceDnsARecord(), + "azurerm_dns_aaaa_record": dataSourceDnsAAAARecord(), + "azurerm_dns_caa_record": dataSourceDnsCaaRecord(), + "azurerm_dns_cname_record": dataSourceDnsCNameRecord(), + "azurerm_dns_mx_record": dataSourceDnsMxRecord(), + "azurerm_dns_ns_record": dataSourceDnsNsRecord(), + "azurerm_dns_ptr_record": dataSourceDnsPtrRecord(), + "azurerm_dns_soa_record": dataSourceDnsSoaRecord(), + "azurerm_dns_srv_record": dataSourceDnsSrvRecord(), + "azurerm_dns_txt_record": dataSourceDnsTxtRecord(), + "azurerm_dns_zone": dataSourceDnsZone(), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/resourceids.go deleted file mode 100644 index 4ad419bec34..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/resourceids.go +++ /dev/null @@ -1,12 +0,0 @@ -package dns - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DnsZone -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/dnszones/zone1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ARecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/dnszones/zone1/A/eh1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AaaaRecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/dnszones/zone1/AAAA/eheh1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=CaaRecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/dnszones/zone1/CAA/caa1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=CnameRecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/dnszones/zone1/CNAME/name1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=MxRecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/dnszones/zone1/MX/mx1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NsRecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/dnszones/zone1/NS/ns1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=PtrRecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/dnszones/zone1/PTR/ptr1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SrvRecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/dnszones/zone1/SRV/srv1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=TxtRecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/dnszones/zone1/TXT/txt1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/a_record_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/a_record_id.go deleted file mode 100644 index 6d70f11164a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/a_record_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" -) - -func ARecordID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ARecordID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/aaaa_record_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/aaaa_record_id.go deleted file mode 100644 index dd75910b3a7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/aaaa_record_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" -) - -func AaaaRecordID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.AaaaRecordID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/caa_record_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/caa_record_id.go deleted file mode 100644 index 4fd6b17485f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/caa_record_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" -) - -func CaaRecordID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.CaaRecordID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/cname_record_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/cname_record_id.go deleted file mode 100644 index a0a20845f32..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/cname_record_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" -) - -func CnameRecordID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.CnameRecordID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/dns_zone_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/dns_zone_id.go deleted file mode 100644 index 32e9b7d30b1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/dns_zone_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" -) - -func DnsZoneID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DnsZoneID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/mx_record_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/mx_record_id.go deleted file mode 100644 index 5bea8660e56..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/mx_record_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" -) - -func MxRecordID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.MxRecordID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/ns_record_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/ns_record_id.go deleted file mode 100644 index 6b808841c89..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/ns_record_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" -) - -func NsRecordID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.NsRecordID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/ptr_record_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/ptr_record_id.go deleted file mode 100644 index 444679b22c1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/ptr_record_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" -) - -func PtrRecordID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.PtrRecordID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/srv_record_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/srv_record_id.go deleted file mode 100644 index 988b99abfc2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/srv_record_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" -) - -func SrvRecordID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.SrvRecordID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/txt_record_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/txt_record_id.go deleted file mode 100644 index d4d2b6abad5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate/txt_record_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse" -) - -func TxtRecordID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.TxtRecordID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/active_directory_domain_service_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/active_directory_domain_service_data_source.go index 0785b42199a..d31b0bb164a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/active_directory_domain_service_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/active_directory_domain_service_data_source.go @@ -4,15 +4,15 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceActiveDirectoryDomainService() *pluginsdk.Resource { @@ -129,6 +129,16 @@ func dataSourceActiveDirectoryDomainService() *pluginsdk.Resource { Computed: true, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ + "kerberos_armoring_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "kerberos_rc4_encryption_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "ntlm_v1_enabled": { Type: pluginsdk.TypeBool, Computed: true, @@ -167,7 +177,7 @@ func dataSourceActiveDirectoryDomainService() *pluginsdk.Resource { Computed: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.Tags(), "tenant_id": { Type: pluginsdk.TypeString, @@ -220,32 +230,43 @@ func dataSourceActiveDirectoryDomainServiceReplicaSetSchema() map[string]*plugin func dataSourceActiveDirectoryDomainServiceRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).DomainServices.DomainServicesClient + subscrptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() name := d.Get("name").(string) resourceGroup := d.Get("resource_group_name").(string) - resp, err := client.Get(ctx, resourceGroup, name) + idsdk := domainservices.NewDomainServiceID(subscrptionId, resourceGroup, name) + + resp, err := client.Get(ctx, idsdk) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return nil } return err } - if resp.ID == nil { + model := resp.Model + if model == nil { + return fmt.Errorf("reading Domain Service: model was returned nil") + } + + if model.Id == nil { return fmt.Errorf("reading Domain Service: ID was returned nil") } - d.SetId(*resp.ID) + + d.SetId(idsdk.ID()) d.Set("name", name) d.Set("resource_group_name", resourceGroup) + d.Set("location", location.NormalizeNilable(model.Location)) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } - d.Set("location", location.NormalizeNilable(resp.Location)) - - if props := resp.DomainServiceProperties; props != nil { - d.Set("deployment_id", props.DeploymentID) + if props := model.Properties; props != nil { + d.Set("deployment_id", props.DeploymentId) domainConfigType := "" if v := props.DomainConfigurationType; v != nil { @@ -256,14 +277,14 @@ func dataSourceActiveDirectoryDomainServiceRead(d *pluginsdk.ResourceData, meta d.Set("domain_name", props.DomainName) d.Set("filtered_sync_enabled", false) - if props.FilteredSync == aad.FilteredSyncEnabled { + if props.FilteredSync != nil && *props.FilteredSync == domainservices.FilteredSyncEnabled { d.Set("filtered_sync_enabled", true) } - d.Set("resource_id", resp.ID) + d.Set("resource_id", model.Id) d.Set("sku", props.Sku) d.Set("sync_owner", props.SyncOwner) - d.Set("tenant_id", props.TenantID) + d.Set("tenant_id", props.TenantId) d.Set("version", props.Version) if err := d.Set("notifications", flattenDomainServiceNotifications(props.NotificationSettings)); err != nil { @@ -284,5 +305,5 @@ func dataSourceActiveDirectoryDomainServiceRead(d *pluginsdk.ResourceData, meta } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/active_directory_domain_service_replica_set_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/active_directory_domain_service_replica_set_resource.go index 9059a63e5fb..9d5a88fe02f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/active_directory_domain_service_replica_set_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/active_directory_domain_service_replica_set_resource.go @@ -5,8 +5,9 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -88,82 +89,90 @@ func resourceActiveDirectoryDomainServiceReplicaSetCreate(d *pluginsdk.ResourceD return fmt.Errorf("parsing ID for Domain Service Replica Set") } + idsdk := domainservices.NewDomainServiceID(domainServiceId.SubscriptionId, domainServiceId.ResourceGroup, domainServiceId.Name) + locks.ByName(domainServiceId.Name, DomainServiceResourceName) defer locks.UnlockByName(domainServiceId.Name, DomainServiceResourceName) - domainService, err := client.Get(ctx, domainServiceId.ResourceGroup, domainServiceId.Name) + domainService, err := client.Get(ctx, idsdk) if err != nil { - if utils.ResponseWasNotFound(domainService.Response) { + if response.WasNotFound(domainService.HttpResponse) { return fmt.Errorf("could not find %s: %s", domainServiceId, err) } return fmt.Errorf("reading %s: %s", domainServiceId, err) } - if domainService.DomainServiceProperties.ReplicaSets == nil || len(*domainService.DomainServiceProperties.ReplicaSets) == 0 { - return fmt.Errorf("reading %s: returned with missing replica set information, expected at least 1 replica set: %s", domainServiceId, err) + model := domainService.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", domainServiceId) + } + + if model.Properties == nil || model.Properties.ReplicaSets == nil || len(*model.Properties.ReplicaSets) == 0 { + return fmt.Errorf("reading %s: returned with missing replica set information, expected at least 1 replica set", domainServiceId) } subnetId := d.Get("subnet_id").(string) - replicaSets := *domainService.DomainServiceProperties.ReplicaSets + replicaSets := *model.Properties.ReplicaSets for _, r := range replicaSets { - if r.ReplicaSetID == nil { + if r.ReplicaSetId == nil { return fmt.Errorf("reading %s: a replica set was returned with a missing ReplicaSetID", domainServiceId) } - if r.SubnetID == nil { + if r.SubnetId == nil { return fmt.Errorf("reading %s: a replica set was returned with a missing SubnetID", domainServiceId) } // We assume that two replica sets cannot coexist in the same subnet - if strings.EqualFold(subnetId, *r.SubnetID) { + if strings.EqualFold(subnetId, *r.SubnetId) { // Generate an ID here since we only know it once we know the ReplicaSetID - id := parse.NewDomainServiceReplicaSetID(domainServiceId.SubscriptionId, domainServiceId.ResourceGroup, domainServiceId.Name, *r.ReplicaSetID) + id := parse.NewDomainServiceReplicaSetID(domainServiceId.SubscriptionId, domainServiceId.ResourceGroup, domainServiceId.Name, *r.ReplicaSetId) return tf.ImportAsExistsError("azurerm_active_directory_domain_service_replica_set", id.ID()) } } loc := location.Normalize(d.Get("location").(string)) - replicaSets = append(replicaSets, aad.ReplicaSet{ + replicaSets = append(replicaSets, domainservices.ReplicaSet{ Location: utils.String(loc), - SubnetID: utils.String(subnetId), + SubnetId: utils.String(subnetId), }) - domainService.DomainServiceProperties.ReplicaSets = &replicaSets + model.Properties.ReplicaSets = &replicaSets - future, err := client.CreateOrUpdate(ctx, domainServiceId.ResourceGroup, domainServiceId.Name, domainService) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, idsdk, *model); err != nil { return fmt.Errorf("creating/updating Replica Sets for %s: %+v", domainServiceId, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for Replica Sets for %s: %+v", domainServiceId, err) - } // We need to retrieve the domain service again to find out the new replica set ID - domainService, err = client.Get(ctx, domainServiceId.ResourceGroup, domainServiceId.Name) + domainService, err = client.Get(ctx, idsdk) if err != nil { - if utils.ResponseWasNotFound(domainService.Response) { + if response.WasNotFound(domainService.HttpResponse) { return fmt.Errorf("could not find %s: %s", domainServiceId, err) } return fmt.Errorf("reading %s: %s", domainServiceId, err) } - if domainService.DomainServiceProperties.ReplicaSets == nil || len(*domainService.DomainServiceProperties.ReplicaSets) == 0 { - return fmt.Errorf("reading %s: returned with missing replica set information, expected at least 1 replica set: %s", domainServiceId, err) + model = domainService.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", domainServiceId) + } + + if model.Properties == nil || model.Properties.ReplicaSets == nil || len(*model.Properties.ReplicaSets) == 0 { + return fmt.Errorf("reading %s: returned with missing replica set information, expected at least 1 replica set", domainServiceId) } var id parse.DomainServiceReplicaSetId // Assuming that two replica sets cannot coexist in the same subnet, we identify our new replica set by its SubnetID - for _, r := range *domainService.DomainServiceProperties.ReplicaSets { - if r.ReplicaSetID == nil { + for _, r := range *model.Properties.ReplicaSets { + if r.ReplicaSetId == nil { return fmt.Errorf("reading %s: a replica set was returned with a missing ReplicaSetID", domainServiceId) } - if r.SubnetID == nil { + if r.SubnetId == nil { return fmt.Errorf("reading %s: a replica set was returned with a missing SubnetID", domainServiceId) } - if strings.EqualFold(subnetId, *r.SubnetID) { + if strings.EqualFold(subnetId, *r.SubnetId) { // We found it! - id = parse.NewDomainServiceReplicaSetID(domainServiceId.SubscriptionId, domainServiceId.ResourceGroup, domainServiceId.Name, *r.ReplicaSetID) + id = parse.NewDomainServiceReplicaSetID(domainServiceId.SubscriptionId, domainServiceId.ResourceGroup, domainServiceId.Name, *r.ReplicaSetId) } } @@ -201,41 +210,48 @@ func resourceActiveDirectoryDomainServiceReplicaSetRead(d *pluginsdk.ResourceDat return err } - domainService, err := client.Get(ctx, id.ResourceGroup, id.DomainServiceName) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName) + + domainService, err := client.Get(ctx, idsdk) if err != nil { - if utils.ResponseWasNotFound(domainService.Response) { + if response.WasNotFound(domainService.HttpResponse) { d.SetId("") return nil } return err } - if domainService.DomainServiceProperties.ReplicaSets == nil || len(*domainService.DomainServiceProperties.ReplicaSets) == 0 { - return fmt.Errorf("reading %s: domain service returned with missing replica set information, expected at least 1 replica set: %s", id, err) + model := domainService.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", id) + } + + if model.Properties == nil || model.Properties.ReplicaSets == nil || len(*model.Properties.ReplicaSets) == 0 { + return fmt.Errorf("reading %s: returned with missing replica set information, expected at least 1 replica set", id) } var ( - domainControllerIpAddresses []string - externalAccessIpAddress string + domainControllerIPAddresses []string + externalAccessIPAddress string loc string serviceStatus string subnetId string ) - replicaSets := *domainService.DomainServiceProperties.ReplicaSets + replicaSets := *model.Properties.ReplicaSets for _, r := range replicaSets { - if r.ReplicaSetID == nil { + if r.ReplicaSetId == nil { return fmt.Errorf("reading %s: a replica set was returned with a missing ReplicaSetID", id) } // ReplicaSetName in the ID struct is really the replica set ID - if *r.ReplicaSetID == id.ReplicaSetName { + if *r.ReplicaSetId == id.ReplicaSetName { if r.DomainControllerIPAddress != nil { - domainControllerIpAddresses = *r.DomainControllerIPAddress + domainControllerIPAddresses = *r.DomainControllerIPAddress } if r.ExternalAccessIPAddress != nil { - externalAccessIpAddress = *r.ExternalAccessIPAddress + externalAccessIPAddress = *r.ExternalAccessIPAddress } if r.Location != nil { loc = location.NormalizeNilable(r.Location) @@ -243,14 +259,14 @@ func resourceActiveDirectoryDomainServiceReplicaSetRead(d *pluginsdk.ResourceDat if r.ServiceStatus != nil { serviceStatus = *r.ServiceStatus } - if r.SubnetID != nil { - subnetId = *r.SubnetID + if r.SubnetId != nil { + subnetId = *r.SubnetId } } } - d.Set("domain_controller_ip_addresses", domainControllerIpAddresses) - d.Set("external_access_ip_address", externalAccessIpAddress) + d.Set("domain_controller_ip_addresses", domainControllerIPAddresses) + d.Set("external_access_ip_address", externalAccessIPAddress) d.Set("location", loc) d.Set("service_status", serviceStatus) d.Set("subnet_id", subnetId) @@ -268,27 +284,34 @@ func resourceActiveDirectoryDomainServiceReplicaSetDelete(d *pluginsdk.ResourceD return err } - domainService, err := client.Get(ctx, id.ResourceGroup, id.DomainServiceName) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName) + + domainService, err := client.Get(ctx, idsdk) if err != nil { - if utils.ResponseWasNotFound(domainService.Response) { + if response.WasNotFound(domainService.HttpResponse) { return fmt.Errorf("deleting %s: domain service was not found: %s", id, err) } return err } - if domainService.DomainServiceProperties.ReplicaSets == nil || len(*domainService.DomainServiceProperties.ReplicaSets) == 0 { - return fmt.Errorf("deleting %s: domain service returned with missing replica set information, expected at least 1 replica set: %s", id, err) + model := domainService.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", id) } - replicaSets := *domainService.DomainServiceProperties.ReplicaSets + if model.Properties == nil || model.Properties.ReplicaSets == nil || len(*model.Properties.ReplicaSets) == 0 { + return fmt.Errorf("reading %s: returned with missing replica set information, expected at least 1 replica set", id) + } - newReplicaSets := make([]aad.ReplicaSet, 0) + replicaSets := *model.Properties.ReplicaSets + + newReplicaSets := make([]domainservices.ReplicaSet, 0) for _, r := range replicaSets { - if r.ReplicaSetID == nil { + if r.ReplicaSetId == nil { return fmt.Errorf("deleting %s: a replica set was returned with a missing ReplicaSetID", id) } - if *r.ReplicaSetID == id.ReplicaSetName { + if *r.ReplicaSetId == id.ReplicaSetName { continue } @@ -299,15 +322,11 @@ func resourceActiveDirectoryDomainServiceReplicaSetDelete(d *pluginsdk.ResourceD return fmt.Errorf("deleting %s: could not determine which replica set to remove", id) } - domainService.DomainServiceProperties.ReplicaSets = &newReplicaSets + model.Properties.ReplicaSets = &newReplicaSets - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.DomainServiceName, domainService) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, idsdk, *model); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", id, err) - } // Wait for all replica sets to become available with two domain controllers each before proceeding // Generate a partial DomainServiceId since we don't need to know the initial replica set ID here diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/active_directory_domain_service_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/active_directory_domain_service_resource.go index 102a41f641b..82e7b057121 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/active_directory_domain_service_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/active_directory_domain_service_resource.go @@ -7,18 +7,17 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/parse" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -54,9 +53,9 @@ func resourceActiveDirectoryDomainService() *pluginsdk.Resource { ValidateFunc: validation.StringIsNotEmpty, // TODO: proper validation }, - "location": azure.SchemaLocation(), + "location": commonschema.Location(), - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), "domain_name": { Type: pluginsdk.TypeString, @@ -211,6 +210,18 @@ func resourceActiveDirectoryDomainService() *pluginsdk.Resource { MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ + "kerberos_armoring_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "kerberos_rc4_encryption_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + "ntlm_v1_enabled": { Type: pluginsdk.TypeBool, Optional: true, @@ -254,7 +265,7 @@ func resourceActiveDirectoryDomainService() *pluginsdk.Resource { }, false), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "deployment_id": { Type: pluginsdk.TypeString, @@ -286,6 +297,7 @@ func resourceActiveDirectoryDomainService() *pluginsdk.Resource { func resourceActiveDirectoryDomainServiceCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).DomainServices.DomainServicesClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() @@ -300,18 +312,24 @@ func resourceActiveDirectoryDomainServiceCreateUpdate(d *pluginsdk.ResourceData, // know the ID of the first replica set. var id *parse.DomainServiceId + idsdk := domainservices.NewDomainServiceID(subscriptionId, resourceGroup, name) + if d.IsNewResource() { - existing, err := client.Get(ctx, resourceGroup, name) + existing, err := client.Get(ctx, idsdk) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", resourceErrorName, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { // Parse the replica sets and assume the first one returned to be the initial replica set // This is a best effort and the user can choose any replica set if they structure their config accordingly - props := existing.DomainServiceProperties + model := existing.Model + if model == nil { + return fmt.Errorf("checking for presence of existing %s: API response contained nil or missing model", resourceErrorName) + } + props := model.Properties if props == nil { return fmt.Errorf("checking for presence of existing %s: API response contained nil or missing properties", resourceErrorName) } @@ -320,7 +338,7 @@ func resourceActiveDirectoryDomainServiceCreateUpdate(d *pluginsdk.ResourceData, return fmt.Errorf("checking for presence of existing %s: API response contained nil or missing replica set details", resourceErrorName) } initialReplicaSetId := replicaSets[0].(map[string]interface{})["id"].(string) - id := parse.NewDomainServiceID(client.SubscriptionID, resourceGroup, name, initialReplicaSetId) + id := parse.NewDomainServiceID(subscriptionId, resourceGroup, name, initialReplicaSetId) return tf.ImportAsExistsError(DomainServiceResourceName, id.ID()) } @@ -336,16 +354,16 @@ func resourceActiveDirectoryDomainServiceCreateUpdate(d *pluginsdk.ResourceData, } loc := location.Normalize(d.Get("location").(string)) - filteredSync := aad.FilteredSyncDisabled + filteredSync := domainservices.FilteredSyncDisabled if d.Get("filtered_sync_enabled").(bool) { - filteredSync = aad.FilteredSyncDisabled + filteredSync = domainservices.FilteredSyncDisabled } - domainService := aad.DomainService{ - DomainServiceProperties: &aad.DomainServiceProperties{ + domainService := domainservices.DomainService{ + Properties: &domainservices.DomainServiceProperties{ DomainName: utils.String(d.Get("domain_name").(string)), DomainSecuritySettings: expandDomainServiceSecurity(d.Get("security").([]interface{})), - FilteredSync: filteredSync, + FilteredSync: &filteredSync, LdapsSettings: expandDomainServiceLdaps(d.Get("secure_ldap").([]interface{})), NotificationSettings: expandDomainServiceNotifications(d.Get("notifications").([]interface{})), Sku: utils.String(d.Get("sku").(string)), @@ -355,36 +373,36 @@ func resourceActiveDirectoryDomainServiceCreateUpdate(d *pluginsdk.ResourceData, } if v := d.Get("domain_configuration_type").(string); v != "" { - domainService.DomainServiceProperties.DomainConfigurationType = &v + domainService.Properties.DomainConfigurationType = &v } if d.IsNewResource() { // On resource creation, specify the initial replica set. // No provision is made for changing the initial replica set, it should remain intact for the resource to function properly - replicaSets := []aad.ReplicaSet{ + replicaSets := []domainservices.ReplicaSet{ { Location: utils.String(loc), - SubnetID: utils.String(d.Get("initial_replica_set.0.subnet_id").(string)), + SubnetId: utils.String(d.Get("initial_replica_set.0.subnet_id").(string)), }, } - domainService.DomainServiceProperties.ReplicaSets = &replicaSets + domainService.Properties.ReplicaSets = &replicaSets } - future, err := client.CreateOrUpdate(ctx, resourceGroup, name, domainService) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, idsdk, domainService); err != nil { return fmt.Errorf("creating/updating %s: %+v", resourceErrorName, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for %s: %+v", resourceErrorName, err) - } // Retrieve the domain service to discover the unique ID for the initial replica set, which should not subsequently change if d.IsNewResource() { - resp, err := client.Get(ctx, resourceGroup, name) + resp, err := client.Get(ctx, idsdk) if err != nil { return fmt.Errorf("retrieving %s after creating: %+v", resourceErrorName, err) } - props := resp.DomainServiceProperties + model := resp.Model + if model == nil { + return fmt.Errorf("%s returned with no model", resourceErrorName) + } + props := model.Properties if props == nil { return fmt.Errorf("%s returned with no properties", resourceErrorName) } @@ -399,7 +417,7 @@ func resourceActiveDirectoryDomainServiceCreateUpdate(d *pluginsdk.ResourceData, // Once we know the initial replica set ID, we can build a resource ID initialReplicaSetId := replicaSets[0].(map[string]interface{})["id"].(string) - newId := parse.NewDomainServiceID(client.SubscriptionID, resourceGroup, name, initialReplicaSetId) + newId := parse.NewDomainServiceID(subscriptionId, resourceGroup, name, initialReplicaSetId) id = &newId d.SetId(id.ID()) @@ -441,9 +459,11 @@ func resourceActiveDirectoryDomainServiceRead(d *pluginsdk.ResourceData, meta in return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.Name) + + resp, err := client.Get(ctx, idsdk) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -452,59 +472,64 @@ func resourceActiveDirectoryDomainServiceRead(d *pluginsdk.ResourceData, meta in d.Set("name", id.Name) d.Set("resource_group_name", id.ResourceGroup) - d.Set("resource_id", resp.ID) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + d.Set("resource_id", model.Id) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } - if props := resp.DomainServiceProperties; props != nil { - d.Set("deployment_id", props.DeploymentID) - d.Set("domain_name", props.DomainName) - d.Set("sync_owner", props.SyncOwner) - d.Set("tenant_id", props.TenantID) - d.Set("version", props.Version) - d.Set("domain_configuration_type", props.DomainConfigurationType) + if props := model.Properties; props != nil { + d.Set("deployment_id", props.DeploymentId) + d.Set("domain_name", props.DomainName) + d.Set("sync_owner", props.SyncOwner) + d.Set("tenant_id", props.TenantId) + d.Set("version", props.Version) + d.Set("domain_configuration_type", props.DomainConfigurationType) - d.Set("filtered_sync_enabled", false) - if props.FilteredSync == aad.FilteredSyncEnabled { - d.Set("filtered_sync_enabled", true) - } + d.Set("filtered_sync_enabled", false) + if props.FilteredSync != nil && *props.FilteredSync == domainservices.FilteredSyncEnabled { + d.Set("filtered_sync_enabled", true) + } - d.Set("sku", props.Sku) + d.Set("sku", props.Sku) - if err := d.Set("notifications", flattenDomainServiceNotifications(props.NotificationSettings)); err != nil { - return fmt.Errorf("setting `notifications`: %+v", err) - } + if err := d.Set("notifications", flattenDomainServiceNotifications(props.NotificationSettings)); err != nil { + return fmt.Errorf("setting `notifications`: %+v", err) + } - var initialReplicaSet interface{} - replicaSets := flattenDomainServiceReplicaSets(props.ReplicaSets) + var initialReplicaSet interface{} + replicaSets := flattenDomainServiceReplicaSets(props.ReplicaSets) - // Determine the initial replica set. This is why we need to include InitialReplicaSetId in the resource ID, - // without it we would not be able to reliably support importing. - for _, replicaSetRaw := range replicaSets { - replicaSet := replicaSetRaw.(map[string]interface{}) - if replicaSet["id"].(string) == id.InitialReplicaSetIdName { - initialReplicaSet = replicaSetRaw - break + // Determine the initial replica set. This is why we need to include InitialReplicaSetId in the resource ID, + // without it we would not be able to reliably support importing. + for _, replicaSetRaw := range replicaSets { + replicaSet := replicaSetRaw.(map[string]interface{}) + if replicaSet["id"].(string) == id.InitialReplicaSetIdName { + initialReplicaSet = replicaSetRaw + break + } + } + if initialReplicaSet == nil { + // It's safest to error out here, since we don't want to wipe the initial replica set from state if it was deleted manually + return fmt.Errorf("reading %s: could not determine initial replica set from API response", id) + } + if err := d.Set("initial_replica_set", []interface{}{initialReplicaSet}); err != nil { + return fmt.Errorf("setting `initial_replica_set`: %+v", err) } - } - if initialReplicaSet == nil { - // It's safest to error out here, since we don't want to wipe the initial replica set from state if it was deleted manually - return fmt.Errorf("reading %s: could not determine initial replica set from API response", id) - } - if err := d.Set("initial_replica_set", []interface{}{initialReplicaSet}); err != nil { - return fmt.Errorf("setting `initial_replica_set`: %+v", err) - } - if err := d.Set("secure_ldap", flattenDomainServiceLdaps(d, props.LdapsSettings, false)); err != nil { - return fmt.Errorf("setting `secure_ldap`: %+v", err) - } + if err := d.Set("secure_ldap", flattenDomainServiceLdaps(d, props.LdapsSettings, false)); err != nil { + return fmt.Errorf("setting `secure_ldap`: %+v", err) + } - if err := d.Set("security", flattenDomainServiceSecurity(props.DomainSecuritySettings)); err != nil { - return fmt.Errorf("setting `security`: %+v", err) + if err := d.Set("security", flattenDomainServiceSecurity(props.DomainSecuritySettings)); err != nil { + return fmt.Errorf("setting `security`: %+v", err) + } } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceActiveDirectoryDomainServiceDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -517,32 +542,28 @@ func resourceActiveDirectoryDomainServiceDelete(d *pluginsdk.ResourceData, meta return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { - return fmt.Errorf("deleting %s: %+v", id, err) - } + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.Name) - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for deletion of %s: %+v", id, err) - } + if err := client.DeleteThenPoll(ctx, idsdk); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } return nil } -func domainServiceControllerRefreshFunc(ctx context.Context, client *aad.DomainServicesClient, id parse.DomainServiceId, deleting bool) pluginsdk.StateRefreshFunc { +func domainServiceControllerRefreshFunc(ctx context.Context, client *domainservices.DomainServicesClient, id parse.DomainServiceId, deleting bool) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { log.Printf("[DEBUG] Waiting for domain controllers to deploy...") - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, idsdk) if err != nil { return nil, "error", err } - if resp.DomainServiceProperties == nil || resp.DomainServiceProperties.ReplicaSets == nil || len(*resp.DomainServiceProperties.ReplicaSets) == 0 { + if model := resp.Model; model == nil || model.Properties == nil || model.Properties.ReplicaSets == nil || len(*model.Properties.ReplicaSets) == 0 { return nil, "error", fmt.Errorf("API error: `replicaSets` was not returned") } // Loop through all replica sets and ensure they are running and each have two available domain controllers - for _, repl := range *resp.DomainServiceProperties.ReplicaSets { + for _, repl := range *resp.Model.Properties.ReplicaSets { if repl.ServiceStatus == nil { return resp, "pending", nil } @@ -565,29 +586,30 @@ func domainServiceControllerRefreshFunc(ctx context.Context, client *aad.DomainS } } -func expandDomainServiceLdaps(input []interface{}) (ldaps *aad.LdapsSettings) { - ldaps = &aad.LdapsSettings{ - Ldaps: aad.LdapsDisabled, +func expandDomainServiceLdaps(input []interface{}) (ldaps *domainservices.LdapsSettings) { + state := domainservices.LdapsDisabled + ldaps = &domainservices.LdapsSettings{ + Ldaps: &state, } if len(input) > 0 { v := input[0].(map[string]interface{}) if v["enabled"].(bool) { - ldaps.Ldaps = aad.LdapsEnabled + *ldaps.Ldaps = domainservices.LdapsEnabled } ldaps.PfxCertificate = utils.String(v["pfx_certificate"].(string)) ldaps.PfxCertificatePassword = utils.String(v["pfx_certificate_password"].(string)) + access := domainservices.ExternalAccessDisabled if v["external_access_enabled"].(bool) { - ldaps.ExternalAccess = aad.Enabled - } else { - ldaps.ExternalAccess = aad.Disabled + access = domainservices.ExternalAccessEnabled } + ldaps.ExternalAccess = &access } return } -func expandDomainServiceNotifications(input []interface{}) *aad.NotificationSettings { +func expandDomainServiceNotifications(input []interface{}) *domainservices.NotificationSettings { if len(input) == 0 { return nil } @@ -601,61 +623,71 @@ func expandDomainServiceNotifications(input []interface{}) *aad.NotificationSett } } - notifyDcAdmins := aad.NotifyDcAdminsDisabled + notifyDcAdmins := domainservices.NotifyDcAdminsDisabled if n, ok := v["notify_dc_admins"]; ok && n.(bool) { - notifyDcAdmins = aad.NotifyDcAdminsEnabled + notifyDcAdmins = domainservices.NotifyDcAdminsEnabled } - notifyGlobalAdmins := aad.NotifyGlobalAdminsDisabled + notifyGlobalAdmins := domainservices.NotifyGlobalAdminsDisabled if n, ok := v["notify_global_admins"]; ok && n.(bool) { - notifyGlobalAdmins = aad.NotifyGlobalAdminsEnabled + notifyGlobalAdmins = domainservices.NotifyGlobalAdminsEnabled } - return &aad.NotificationSettings{ + return &domainservices.NotificationSettings{ AdditionalRecipients: &additionalRecipients, - NotifyDcAdmins: notifyDcAdmins, - NotifyGlobalAdmins: notifyGlobalAdmins, + NotifyDcAdmins: ¬ifyDcAdmins, + NotifyGlobalAdmins: ¬ifyGlobalAdmins, } } -func expandDomainServiceSecurity(input []interface{}) *aad.DomainSecuritySettings { +func expandDomainServiceSecurity(input []interface{}) *domainservices.DomainSecuritySettings { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - ntlmV1 := aad.NtlmV1Disabled - syncKerberosPasswords := aad.SyncKerberosPasswordsDisabled - syncNtlmPasswords := aad.SyncNtlmPasswordsDisabled - syncOnPremPasswords := aad.SyncOnPremPasswordsDisabled - tlsV1 := aad.TLSV1Disabled + kerberosRc4Encryption := domainservices.KerberosRc4EncryptionDisabled + kerberosArmoring := domainservices.KerberosArmoringDisabled + ntlmV1 := domainservices.NtlmV1Disabled + syncKerberosPasswords := domainservices.SyncKerberosPasswordsDisabled + syncNtlmPasswords := domainservices.SyncNtlmPasswordsDisabled + syncOnPremPasswords := domainservices.SyncOnPremPasswordsDisabled + tlsV1 := domainservices.TlsV1Disabled + if v["kerberos_armoring_enabled"].(bool) { + kerberosArmoring = domainservices.KerberosArmoringEnabled + } + if v["kerberos_rc4_encryption_enabled"].(bool) { + kerberosRc4Encryption = domainservices.KerberosRc4EncryptionEnabled + } if v["ntlm_v1_enabled"].(bool) { - ntlmV1 = aad.NtlmV1Enabled + ntlmV1 = domainservices.NtlmV1Enabled } if v["sync_kerberos_passwords"].(bool) { - syncKerberosPasswords = aad.SyncKerberosPasswordsEnabled + syncKerberosPasswords = domainservices.SyncKerberosPasswordsEnabled } if v["sync_ntlm_passwords"].(bool) { - syncNtlmPasswords = aad.SyncNtlmPasswordsEnabled + syncNtlmPasswords = domainservices.SyncNtlmPasswordsEnabled } if v["sync_on_prem_passwords"].(bool) { - syncOnPremPasswords = aad.SyncOnPremPasswordsEnabled + syncOnPremPasswords = domainservices.SyncOnPremPasswordsEnabled } if v["tls_v1_enabled"].(bool) { - tlsV1 = aad.TLSV1Enabled + tlsV1 = domainservices.TlsV1Enabled } - return &aad.DomainSecuritySettings{ - NtlmV1: ntlmV1, - SyncKerberosPasswords: syncKerberosPasswords, - SyncNtlmPasswords: syncNtlmPasswords, - SyncOnPremPasswords: syncOnPremPasswords, - TLSV1: tlsV1, + return &domainservices.DomainSecuritySettings{ + KerberosArmoring: &kerberosArmoring, + KerberosRc4Encryption: &kerberosRc4Encryption, + NtlmV1: &ntlmV1, + SyncKerberosPasswords: &syncKerberosPasswords, + SyncNtlmPasswords: &syncNtlmPasswords, + SyncOnPremPasswords: &syncOnPremPasswords, + TlsV1: &tlsV1, } } -func flattenDomainServiceLdaps(d *pluginsdk.ResourceData, input *aad.LdapsSettings, dataSource bool) []interface{} { +func flattenDomainServiceLdaps(d *pluginsdk.ResourceData, input *domainservices.LdapsSettings, dataSource bool) []interface{} { result := map[string]interface{}{ "enabled": false, "external_access_enabled": false, @@ -677,14 +709,14 @@ func flattenDomainServiceLdaps(d *pluginsdk.ResourceData, input *aad.LdapsSettin } if input != nil { - if input.ExternalAccess == aad.Enabled { + if input.ExternalAccess != nil && *input.ExternalAccess == domainservices.ExternalAccessEnabled { result["external_access_enabled"] = true } - if input.Ldaps == aad.LdapsEnabled { + if input.Ldaps != nil && *input.Ldaps == domainservices.LdapsEnabled { result["enabled"] = true } if v := input.CertificateNotAfter; v != nil { - result["certificate_expiry"] = v.Format(time.RFC3339) + result["certificate_expiry"] = *v } if v := input.CertificateThumbprint; v != nil { result["certificate_thumbprint"] = *v @@ -697,7 +729,7 @@ func flattenDomainServiceLdaps(d *pluginsdk.ResourceData, input *aad.LdapsSettin return []interface{}{result} } -func flattenDomainServiceNotifications(input *aad.NotificationSettings) []interface{} { +func flattenDomainServiceNotifications(input *domainservices.NotificationSettings) []interface{} { if input == nil { return make([]interface{}, 0) } @@ -710,17 +742,17 @@ func flattenDomainServiceNotifications(input *aad.NotificationSettings) []interf if input.AdditionalRecipients != nil { result["additional_recipients"] = *input.AdditionalRecipients } - if input.NotifyDcAdmins == aad.NotifyDcAdminsEnabled { + if input.NotifyDcAdmins != nil && *input.NotifyDcAdmins == domainservices.NotifyDcAdminsEnabled { result["notify_dc_admins"] = true } - if input.NotifyGlobalAdmins == aad.NotifyGlobalAdminsEnabled { + if input.NotifyGlobalAdmins != nil && *input.NotifyGlobalAdmins == domainservices.NotifyGlobalAdminsEnabled { result["notify_global_admins"] = true } return []interface{}{result} } -func flattenDomainServiceReplicaSets(input *[]aad.ReplicaSet) (ret []interface{}) { +func flattenDomainServiceReplicaSets(input *[]domainservices.ReplicaSet) (ret []interface{}) { if input == nil { return } @@ -740,14 +772,14 @@ func flattenDomainServiceReplicaSets(input *[]aad.ReplicaSet) (ret []interface{} if in.ExternalAccessIPAddress != nil { repl["external_access_ip_address"] = *in.ExternalAccessIPAddress } - if in.ReplicaSetID != nil { - repl["id"] = *in.ReplicaSetID + if in.ReplicaSetId != nil { + repl["id"] = *in.ReplicaSetId } if in.ServiceStatus != nil { repl["service_status"] = *in.ServiceStatus } - if in.SubnetID != nil { - repl["subnet_id"] = *in.SubnetID + if in.SubnetId != nil { + repl["subnet_id"] = *in.SubnetId } ret = append(ret, repl) } @@ -755,31 +787,39 @@ func flattenDomainServiceReplicaSets(input *[]aad.ReplicaSet) (ret []interface{} return } -func flattenDomainServiceSecurity(input *aad.DomainSecuritySettings) []interface{} { +func flattenDomainServiceSecurity(input *domainservices.DomainSecuritySettings) []interface{} { if input == nil { return make([]interface{}, 0) } result := map[string]bool{ - "ntlm_v1_enabled": false, - "sync_kerberos_passwords": false, - "sync_ntlm_passwords": false, - "sync_on_prem_passwords": false, - "tls_v1_enabled": false, + "kerberos_armoring_enabled": false, + "kerberos_rc4_encryption_enabled": false, + "ntlm_v1_enabled": false, + "sync_kerberos_passwords": false, + "sync_ntlm_passwords": false, + "sync_on_prem_passwords": false, + "tls_v1_enabled": false, + } + if input.KerberosArmoring != nil && *input.KerberosArmoring == domainservices.KerberosArmoringEnabled { + result["kerberos_armoring_enabled"] = true + } + if input.KerberosRc4Encryption != nil && *input.KerberosRc4Encryption == domainservices.KerberosRc4EncryptionEnabled { + result["kerberos_rc4_encryption_enabled"] = true } - if input.NtlmV1 == aad.NtlmV1Enabled { + if input.NtlmV1 != nil && *input.NtlmV1 == domainservices.NtlmV1Enabled { result["ntlm_v1_enabled"] = true } - if input.SyncKerberosPasswords == aad.SyncKerberosPasswordsEnabled { + if input.SyncKerberosPasswords != nil && *input.SyncKerberosPasswords == domainservices.SyncKerberosPasswordsEnabled { result["sync_kerberos_passwords"] = true } - if input.SyncNtlmPasswords == aad.SyncNtlmPasswordsEnabled { + if input.SyncNtlmPasswords != nil && *input.SyncNtlmPasswords == domainservices.SyncNtlmPasswordsEnabled { result["sync_ntlm_passwords"] = true } - if input.SyncOnPremPasswords == aad.SyncOnPremPasswordsEnabled { + if input.SyncOnPremPasswords != nil && *input.SyncOnPremPasswords == domainservices.SyncOnPremPasswordsEnabled { result["sync_on_prem_passwords"] = true } - if input.TLSV1 == aad.TLSV1Enabled { + if input.TlsV1 != nil && *input.TlsV1 == domainservices.TlsV1Enabled { result["tls_v1_enabled"] = true } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/active_directory_domain_service_trust_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/active_directory_domain_service_trust_resource.go new file mode 100644 index 00000000000..f3082a2dc69 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/active_directory_domain_service_trust_resource.go @@ -0,0 +1,379 @@ +package domainservices + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type DomainServiceTrustResource struct{} + +var _ sdk.ResourceWithUpdate = DomainServiceTrustResource{} + +type DomainServiceTrustModel struct { + Name string `tfschema:"name"` + DomainServiceId string `tfschema:"domain_service_id"` + TrustedDomainFqdn string `tfschema:"trusted_domain_fqdn"` + TrustedDomainDnsIPs []string `tfschema:"trusted_domain_dns_ips"` + Password string `tfschema:"password"` +} + +func (r DomainServiceTrustResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "domain_service_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.DomainServiceID, + }, + "trusted_domain_fqdn": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "trusted_domain_dns_ips": { + Type: pluginsdk.TypeList, + Required: true, + MinItems: 2, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.IsIPAddress, + }, + }, + "password": { + Type: pluginsdk.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + } +} + +func (r DomainServiceTrustResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r DomainServiceTrustResource) ResourceType() string { + return "azurerm_active_directory_domain_service_trust" +} + +func (r DomainServiceTrustResource) ModelObject() interface{} { + return &DomainServiceTrustModel{} +} + +func (r DomainServiceTrustResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return validate.DomainServiceTrustID +} + +func (r DomainServiceTrustResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DomainServices.DomainServicesClient + + var plan DomainServiceTrustModel + if err := metadata.Decode(&plan); err != nil { + return fmt.Errorf("decoding %+v", err) + } + + dsid, err := parse.DomainServiceID(plan.DomainServiceId) + if err != nil { + return err + } + + id := parse.NewDomainServiceTrustID(dsid.SubscriptionId, dsid.ResourceGroup, dsid.Name, plan.Name) + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName) + + locks.ByName(id.DomainServiceName, DomainServiceResourceName) + defer locks.UnlockByName(id.DomainServiceName, DomainServiceResourceName) + + existing, err := client.Get(ctx, idsdk) + if err != nil { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + + model := existing.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", idsdk) + } + + existingTrusts := []domainservices.ForestTrust{} + if props := model.Properties; props != nil { + if fsettings := props.ResourceForestSettings; fsettings != nil { + if settings := fsettings.Settings; settings != nil { + existingTrusts = *settings + } + } + } + for _, setting := range existingTrusts { + if setting.FriendlyName != nil && *setting.FriendlyName == id.TrustName { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + } + + existingTrusts = append(existingTrusts, domainservices.ForestTrust{ + TrustedDomainFqdn: utils.String(plan.TrustedDomainFqdn), + TrustDirection: utils.String("Inbound"), + FriendlyName: utils.String(id.TrustName), + RemoteDnsIPs: utils.String(strings.Join(plan.TrustedDomainDnsIPs, ",")), + TrustPassword: utils.String(plan.Password), + }) + params := domainservices.DomainService{ + Properties: &domainservices.DomainServiceProperties{ + ResourceForestSettings: &domainservices.ResourceForestSettings{ + Settings: &existingTrusts, + }, + }, + } + + if err := client.UpdateThenPoll(ctx, idsdk, params); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r DomainServiceTrustResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DomainServices.DomainServicesClient + id, err := parse.DomainServiceTrustID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName) + + existing, err := client.Get(ctx, idsdk) + if err != nil { + if response.WasNotFound(existing.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %+v", idsdk, err) + } + + model := existing.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", idsdk) + } + + props := model.Properties + if props == nil { + return fmt.Errorf("checking for presence of existing %s: API response contained nil or missing properties", idsdk) + } + + existingTrusts := []domainservices.ForestTrust{} + if props != nil { + if fsettings := props.ResourceForestSettings; fsettings != nil { + if settings := fsettings.Settings; settings != nil { + existingTrusts = *settings + } + } + } + var trust *domainservices.ForestTrust + for _, setting := range existingTrusts { + existingTrust := setting + if setting.FriendlyName != nil && *setting.FriendlyName == id.TrustName { + trust = &existingTrust + } + } + if trust == nil { + return metadata.MarkAsGone(id) + } + + // Retrieve the initial replica set id to construct the domain service id. + replicaSets := flattenDomainServiceReplicaSets(props.ReplicaSets) + if len(replicaSets) == 0 { + return fmt.Errorf("checking for presence of existing %s: API response contained nil or missing replica set details", idsdk) + } + initialReplicaSetId := replicaSets[0].(map[string]interface{})["id"].(string) + dsid := parse.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName, initialReplicaSetId) + + var state DomainServiceTrustModel + if err := metadata.Decode(&state); err != nil { + return err + } + + data := DomainServiceTrustModel{ + DomainServiceId: dsid.ID(), + Name: id.TrustName, + // Setting the password from state as it is not returned by API. + Password: state.Password, + } + + if trust.TrustedDomainFqdn != nil { + data.TrustedDomainFqdn = *trust.TrustedDomainFqdn + } + + if trust.RemoteDnsIPs != nil { + data.TrustedDomainDnsIPs = strings.Split(*trust.RemoteDnsIPs, ",") + } + + return metadata.Encode(&data) + }, + } +} + +func (r DomainServiceTrustResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DomainServices.DomainServicesClient + + id, err := parse.DomainServiceTrustID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName) + + locks.ByName(id.DomainServiceName, DomainServiceResourceName) + defer locks.UnlockByName(id.DomainServiceName, DomainServiceResourceName) + + existing, err := client.Get(ctx, idsdk) + if err != nil { + if response.WasNotFound(existing.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %+v", idsdk, err) + } + + model := existing.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", idsdk) + } + existingTrusts := []domainservices.ForestTrust{} + if props := model.Properties; props != nil { + if fsettings := props.ResourceForestSettings; fsettings != nil { + if settings := fsettings.Settings; settings != nil { + existingTrusts = *settings + } + } + } + var found bool + newTrusts := []domainservices.ForestTrust{} + for _, trust := range existingTrusts { + if trust.FriendlyName != nil && *trust.FriendlyName == id.TrustName { + found = true + continue + } + newTrusts = append(newTrusts, trust) + } + + if !found { + return metadata.MarkAsGone(id) + } + + params := domainservices.DomainService{ + Properties: &domainservices.DomainServiceProperties{ + ResourceForestSettings: &domainservices.ResourceForestSettings{ + Settings: &newTrusts, + }, + }, + } + + if err := client.UpdateThenPoll(ctx, idsdk, params); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} + +func (r DomainServiceTrustResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.DomainServices.DomainServicesClient + + id, err := parse.DomainServiceTrustID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + idsdk := domainservices.NewDomainServiceID(id.SubscriptionId, id.ResourceGroup, id.DomainServiceName) + + locks.ByName(id.DomainServiceName, DomainServiceResourceName) + defer locks.UnlockByName(id.DomainServiceName, DomainServiceResourceName) + + existing, err := client.Get(ctx, idsdk) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", idsdk, err) + } + + model := existing.Model + if model == nil { + return fmt.Errorf("reading %s: returned with null model", idsdk) + } + + existingTrusts := []domainservices.ForestTrust{} + if props := model.Properties; props != nil { + if fsettings := props.ResourceForestSettings; fsettings != nil { + if settings := fsettings.Settings; settings != nil { + existingTrusts = *settings + } + } + } + + var plan DomainServiceTrustModel + if err := metadata.Decode(&plan); err != nil { + return err + } + + var found bool + newTrusts := []domainservices.ForestTrust{} + for _, trust := range existingTrusts { + if trust.FriendlyName != nil && *trust.FriendlyName == id.TrustName { + found = true + if metadata.ResourceData.HasChange("trusted_domain_fqdn") { + trust.TrustedDomainFqdn = utils.String(plan.TrustedDomainFqdn) + } + if metadata.ResourceData.HasChange("trusted_domain_dns_ips") { + trust.RemoteDnsIPs = utils.String(strings.Join(plan.TrustedDomainDnsIPs, ",")) + } + trust.TrustPassword = utils.String(plan.Password) + } + newTrusts = append(newTrusts, trust) + } + if !found { + return fmt.Errorf("%s not exists: %+v", id, err) + } + + params := domainservices.DomainService{ + Properties: &domainservices.DomainServiceProperties{ + ResourceForestSettings: &domainservices.ResourceForestSettings{ + Settings: &newTrusts, + }, + }, + } + + if err := client.UpdateThenPoll(ctx, idsdk, params); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + return nil + }, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/client/client.go index e3f16a08a10..e83f747a293 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/client/client.go @@ -1,16 +1,16 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad" + "github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - DomainServicesClient *aad.DomainServicesClient + DomainServicesClient *domainservices.DomainServicesClient } func NewClient(o *common.ClientOptions) *Client { - domainServicesClient := aad.NewDomainServicesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + domainServicesClient := domainservices.NewDomainServicesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&domainServicesClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/parse/domain_service_trust.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/parse/domain_service_trust.go new file mode 100644 index 00000000000..43032f19cf3 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/parse/domain_service_trust.go @@ -0,0 +1,75 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type DomainServiceTrustId struct { + SubscriptionId string + ResourceGroup string + DomainServiceName string + TrustName string +} + +func NewDomainServiceTrustID(subscriptionId, resourceGroup, domainServiceName, trustName string) DomainServiceTrustId { + return DomainServiceTrustId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + DomainServiceName: domainServiceName, + TrustName: trustName, + } +} + +func (id DomainServiceTrustId) String() string { + segments := []string{ + fmt.Sprintf("Trust Name %q", id.TrustName), + fmt.Sprintf("Domain Service Name %q", id.DomainServiceName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Domain Service Trust", segmentsStr) +} + +func (id DomainServiceTrustId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AAD/domainServices/%s/trusts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.DomainServiceName, id.TrustName) +} + +// DomainServiceTrustID parses a DomainServiceTrust ID into an DomainServiceTrustId struct +func DomainServiceTrustID(input string) (*DomainServiceTrustId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := DomainServiceTrustId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.DomainServiceName, err = id.PopSegment("domainServices"); err != nil { + return nil, err + } + if resourceId.TrustName, err = id.PopSegment("trusts"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/registration.go index e37ed1f64bd..b893861aebf 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/registration.go @@ -39,3 +39,13 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { "azurerm_active_directory_domain_service_replica_set": resourceActiveDirectoryDomainServiceReplicaSet(), } } + +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{} +} + +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + DomainServiceTrustResource{}, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/resourceids.go index a40b345f434..2fcafcd19b8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/resourceids.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/resourceids.go @@ -2,3 +2,4 @@ package domainservices //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DomainService -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AAD/domainServices/DomainService1/initialReplicaSetId/replicaSetID //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DomainServiceReplicaSet -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AAD/domainServices/DomainService1/replicaSets/replicaSetID +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DomainServiceTrust -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AAD/domainServices/DomainService1/trusts/trust1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/validate/domain_service_trust_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/validate/domain_service_trust_id.go new file mode 100644 index 00000000000..e1659d77d4b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/validate/domain_service_trust_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/parse" +) + +func DomainServiceTrustID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.DomainServiceTrustID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/client/client.go index f81b893fbdc..2da069deb30 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/client/client.go @@ -1,9 +1,9 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource" + "github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/elasticsearch_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/elasticsearch_data_source.go index eac1ce68b35..abc58e3d27a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/elasticsearch_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/elasticsearch_data_source.go @@ -8,10 +8,10 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource" + "github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules" "github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/elasticsearch_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/elasticsearch_resource.go index 217eaf83893..ea7f41dadf9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/elasticsearch_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/elasticsearch_resource.go @@ -5,15 +5,14 @@ import ( "log" "time" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules" - "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource" + "github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource" "github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/client.go deleted file mode 100644 index 87685bfe28c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package monitorsresource - -import "github.com/Azure/go-autorest/autorest" - -type MonitorsResourceClient struct { - Client autorest.Client - baseUri string -} - -func NewMonitorsResourceClientWithBaseURI(endpoint string) MonitorsResourceClient { - return MonitorsResourceClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/constants.go deleted file mode 100644 index eb470e798bd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/constants.go +++ /dev/null @@ -1,142 +0,0 @@ -package monitorsresource - -import "strings" - -type CreatedByType string - -const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" -) - -func PossibleValuesForCreatedByType() []string { - return []string{ - string(CreatedByTypeApplication), - string(CreatedByTypeKey), - string(CreatedByTypeManagedIdentity), - string(CreatedByTypeUser), - } -} - -func parseCreatedByType(input string) (*CreatedByType, error) { - vals := map[string]CreatedByType{ - "application": CreatedByTypeApplication, - "key": CreatedByTypeKey, - "managedidentity": CreatedByTypeManagedIdentity, - "user": CreatedByTypeUser, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CreatedByType(input) - return &out, nil -} - -type LiftrResourceCategories string - -const ( - LiftrResourceCategoriesMonitorLogs LiftrResourceCategories = "MonitorLogs" - LiftrResourceCategoriesUnknown LiftrResourceCategories = "Unknown" -) - -func PossibleValuesForLiftrResourceCategories() []string { - return []string{ - string(LiftrResourceCategoriesMonitorLogs), - string(LiftrResourceCategoriesUnknown), - } -} - -func parseLiftrResourceCategories(input string) (*LiftrResourceCategories, error) { - vals := map[string]LiftrResourceCategories{ - "monitorlogs": LiftrResourceCategoriesMonitorLogs, - "unknown": LiftrResourceCategoriesUnknown, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := LiftrResourceCategories(input) - return &out, nil -} - -type MonitoringStatus string - -const ( - MonitoringStatusDisabled MonitoringStatus = "Disabled" - MonitoringStatusEnabled MonitoringStatus = "Enabled" -) - -func PossibleValuesForMonitoringStatus() []string { - return []string{ - string(MonitoringStatusDisabled), - string(MonitoringStatusEnabled), - } -} - -func parseMonitoringStatus(input string) (*MonitoringStatus, error) { - vals := map[string]MonitoringStatus{ - "disabled": MonitoringStatusDisabled, - "enabled": MonitoringStatusEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := MonitoringStatus(input) - return &out, nil -} - -type ProvisioningState string - -const ( - ProvisioningStateAccepted ProvisioningState = "Accepted" - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleted ProvisioningState = "Deleted" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -func PossibleValuesForProvisioningState() []string { - return []string{ - string(ProvisioningStateAccepted), - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), - string(ProvisioningStateDeleted), - string(ProvisioningStateDeleting), - string(ProvisioningStateFailed), - string(ProvisioningStateNotSpecified), - string(ProvisioningStateSucceeded), - string(ProvisioningStateUpdating), - } -} - -func parseProvisioningState(input string) (*ProvisioningState, error) { - vals := map[string]ProvisioningState{ - "accepted": ProvisioningStateAccepted, - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, - "deleted": ProvisioningStateDeleted, - "deleting": ProvisioningStateDeleting, - "failed": ProvisioningStateFailed, - "notspecified": ProvisioningStateNotSpecified, - "succeeded": ProvisioningStateSucceeded, - "updating": ProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProvisioningState(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_companyinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_companyinfo.go deleted file mode 100644 index 0160e8a2132..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_companyinfo.go +++ /dev/null @@ -1,9 +0,0 @@ -package monitorsresource - -type CompanyInfo struct { - Business *string `json:"business,omitempty"` - Country *string `json:"country,omitempty"` - Domain *string `json:"domain,omitempty"` - EmployeesNumber *string `json:"employeesNumber,omitempty"` - State *string `json:"state,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_elasticclouduser.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_elasticclouduser.go deleted file mode 100644 index bb816ea50b4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_elasticclouduser.go +++ /dev/null @@ -1,7 +0,0 @@ -package monitorsresource - -type ElasticCloudUser struct { - ElasticCloudSsoDefaultUrl *string `json:"elasticCloudSsoDefaultUrl,omitempty"` - EmailAddress *string `json:"emailAddress,omitempty"` - Id *string `json:"id,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_elasticmonitorresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_elasticmonitorresource.go deleted file mode 100644 index be36fa4277f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_elasticmonitorresource.go +++ /dev/null @@ -1,17 +0,0 @@ -package monitorsresource - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" -) - -type ElasticMonitorResource struct { - Id *string `json:"id,omitempty"` - Identity *identity.SystemAssigned `json:"identity,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *MonitorProperties `json:"properties,omitempty"` - Sku *ResourceSku `json:"sku,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_elasticmonitorresourceupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_elasticmonitorresourceupdateparameters.go deleted file mode 100644 index da1382568ac..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_elasticmonitorresourceupdateparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package monitorsresource - -type ElasticMonitorResourceUpdateParameters struct { - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_elasticproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_elasticproperties.go deleted file mode 100644 index 9d710750b04..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_elasticproperties.go +++ /dev/null @@ -1,6 +0,0 @@ -package monitorsresource - -type ElasticProperties struct { - ElasticCloudDeployment *ElasticCloudDeployment `json:"elasticCloudDeployment,omitempty"` - ElasticCloudUser *ElasticCloudUser `json:"elasticCloudUser,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_resourcesku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_resourcesku.go deleted file mode 100644 index 3cb90dce09e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_resourcesku.go +++ /dev/null @@ -1,5 +0,0 @@ -package monitorsresource - -type ResourceSku struct { - Name string `json:"name"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_systemdata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_systemdata.go deleted file mode 100644 index bce9879bdb8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_systemdata.go +++ /dev/null @@ -1,40 +0,0 @@ -package monitorsresource - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type SystemData struct { - CreatedAt *string `json:"createdAt,omitempty"` - CreatedBy *string `json:"createdBy,omitempty"` - CreatedByType *CreatedByType `json:"createdByType,omitempty"` - LastModifiedAt *string `json:"lastModifiedAt,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` -} - -func (o SystemData) GetCreatedAtAsTime() (*time.Time, error) { - if o.CreatedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o SystemData) SetCreatedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreatedAt = &formatted -} - -func (o SystemData) GetLastModifiedAtAsTime() (*time.Time, error) { - if o.LastModifiedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModifiedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o SystemData) SetLastModifiedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModifiedAt = &formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_userinfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_userinfo.go deleted file mode 100644 index a5ca3413506..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/model_userinfo.go +++ /dev/null @@ -1,9 +0,0 @@ -package monitorsresource - -type UserInfo struct { - CompanyInfo *CompanyInfo `json:"companyInfo,omitempty"` - CompanyName *string `json:"companyName,omitempty"` - EmailAddress *string `json:"emailAddress,omitempty"` - FirstName *string `json:"firstName,omitempty"` - LastName *string `json:"lastName,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/version.go deleted file mode 100644 index 541ec56a057..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package monitorsresource - -import "fmt" - -const defaultApiVersion = "2020-07-01" - -func userAgent() string { - return fmt.Sprintf("pandora/monitorsresource/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/client.go deleted file mode 100644 index 5240d317139..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package rules - -import "github.com/Azure/go-autorest/autorest" - -type RulesClient struct { - Client autorest.Client - baseUri string -} - -func NewRulesClientWithBaseURI(endpoint string) RulesClient { - return RulesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/constants.go deleted file mode 100644 index 4f2789d74cf..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/constants.go +++ /dev/null @@ -1,114 +0,0 @@ -package rules - -import "strings" - -type CreatedByType string - -const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" -) - -func PossibleValuesForCreatedByType() []string { - return []string{ - string(CreatedByTypeApplication), - string(CreatedByTypeKey), - string(CreatedByTypeManagedIdentity), - string(CreatedByTypeUser), - } -} - -func parseCreatedByType(input string) (*CreatedByType, error) { - vals := map[string]CreatedByType{ - "application": CreatedByTypeApplication, - "key": CreatedByTypeKey, - "managedidentity": CreatedByTypeManagedIdentity, - "user": CreatedByTypeUser, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CreatedByType(input) - return &out, nil -} - -type ProvisioningState string - -const ( - ProvisioningStateAccepted ProvisioningState = "Accepted" - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleted ProvisioningState = "Deleted" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -func PossibleValuesForProvisioningState() []string { - return []string{ - string(ProvisioningStateAccepted), - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), - string(ProvisioningStateDeleted), - string(ProvisioningStateDeleting), - string(ProvisioningStateFailed), - string(ProvisioningStateNotSpecified), - string(ProvisioningStateSucceeded), - string(ProvisioningStateUpdating), - } -} - -func parseProvisioningState(input string) (*ProvisioningState, error) { - vals := map[string]ProvisioningState{ - "accepted": ProvisioningStateAccepted, - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, - "deleted": ProvisioningStateDeleted, - "deleting": ProvisioningStateDeleting, - "failed": ProvisioningStateFailed, - "notspecified": ProvisioningStateNotSpecified, - "succeeded": ProvisioningStateSucceeded, - "updating": ProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProvisioningState(input) - return &out, nil -} - -type TagAction string - -const ( - TagActionExclude TagAction = "Exclude" - TagActionInclude TagAction = "Include" -) - -func PossibleValuesForTagAction() []string { - return []string{ - string(TagActionExclude), - string(TagActionInclude), - } -} - -func parseTagAction(input string) (*TagAction, error) { - vals := map[string]TagAction{ - "exclude": TagActionExclude, - "include": TagActionInclude, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := TagAction(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/model_filteringtag.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/model_filteringtag.go deleted file mode 100644 index d55b98d6ca0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/model_filteringtag.go +++ /dev/null @@ -1,7 +0,0 @@ -package rules - -type FilteringTag struct { - Action *TagAction `json:"action,omitempty"` - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/model_logrules.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/model_logrules.go deleted file mode 100644 index a4c8706b82b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/model_logrules.go +++ /dev/null @@ -1,8 +0,0 @@ -package rules - -type LogRules struct { - FilteringTags *[]FilteringTag `json:"filteringTags,omitempty"` - SendAadLogs *bool `json:"sendAadLogs,omitempty"` - SendActivityLogs *bool `json:"sendActivityLogs,omitempty"` - SendSubscriptionLogs *bool `json:"sendSubscriptionLogs,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/model_monitoringtagrules.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/model_monitoringtagrules.go deleted file mode 100644 index 3a9b5e287d3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/model_monitoringtagrules.go +++ /dev/null @@ -1,9 +0,0 @@ -package rules - -type MonitoringTagRules struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *MonitoringTagRulesProperties `json:"properties,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/model_monitoringtagrulesproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/model_monitoringtagrulesproperties.go deleted file mode 100644 index 369405b7e34..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/model_monitoringtagrulesproperties.go +++ /dev/null @@ -1,6 +0,0 @@ -package rules - -type MonitoringTagRulesProperties struct { - LogRules *LogRules `json:"logRules,omitempty"` - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/model_systemdata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/model_systemdata.go deleted file mode 100644 index 559b614791f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/model_systemdata.go +++ /dev/null @@ -1,40 +0,0 @@ -package rules - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type SystemData struct { - CreatedAt *string `json:"createdAt,omitempty"` - CreatedBy *string `json:"createdBy,omitempty"` - CreatedByType *CreatedByType `json:"createdByType,omitempty"` - LastModifiedAt *string `json:"lastModifiedAt,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` -} - -func (o SystemData) GetCreatedAtAsTime() (*time.Time, error) { - if o.CreatedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o SystemData) SetCreatedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreatedAt = &formatted -} - -func (o SystemData) GetLastModifiedAtAsTime() (*time.Time, error) { - if o.LastModifiedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModifiedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o SystemData) SetLastModifiedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModifiedAt = &formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/version.go deleted file mode 100644 index 049bf83f2aa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package rules - -import "fmt" - -const defaultApiVersion = "2020-07-01" - -func userAgent() string { - return fmt.Sprintf("pandora/rules/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid/parse/event_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid/parse/event_subscription.go index 0325cda6adb..1efceb2c978 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid/parse/event_subscription.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid/parse/event_subscription.go @@ -5,7 +5,6 @@ import ( "strings" "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/client/client.go index 5c16fc8980b..dba63b7829a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/client/client.go @@ -1,16 +1,17 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces" ) type Client struct { @@ -23,6 +24,7 @@ type Client struct { NamespacesClient *namespaces.NamespacesClient NamespaceAuthorizationRulesClient *authorizationrulesnamespaces.AuthorizationRulesNamespacesClient NetworkRuleSetsClient *networkrulesets.NetworkRuleSetsClient + SchemaRegistryClient *schemaregistry.SchemaRegistryClient } func NewClient(o *common.ClientOptions) *Client { @@ -53,6 +55,9 @@ func NewClient(o *common.ClientOptions) *Client { networkRuleSetsClient := networkrulesets.NewNetworkRuleSetsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&networkRuleSetsClient.Client, o.ResourceManagerAuthorizer) + schemaRegistryClient := schemaregistry.NewSchemaRegistryClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&schemaRegistryClient.Client, o.ResourceManagerAuthorizer) + return &Client{ ClusterClient: &clustersClient, ConsumerGroupClient: &consumerGroupsClient, @@ -63,5 +68,6 @@ func NewClient(o *common.ClientOptions) *Client { NamespacesClient: &namespacesClient, NamespaceAuthorizationRulesClient: &namespaceAuthorizationRulesClient, NetworkRuleSetsClient: &networkRuleSetsClient, + SchemaRegistryClient: &schemaRegistryClient, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_authorization_rule_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_authorization_rule_data_source.go index 3dd7658bba3..64682d9972a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_authorization_rule_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_authorization_rule_data_source.go @@ -6,9 +6,9 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_authorization_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_authorization_rule_resource.go index 153d501b571..01794f6da18 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_authorization_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_authorization_rule_resource.go @@ -6,12 +6,13 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -29,6 +30,11 @@ func resourceEventHubAuthorizationRule() *pluginsdk.Resource { return err }), + SchemaVersion: 1, + StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ + 0: migration.EventHubAuthorizationRuleV0ToV1{}, + }), + Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), Read: pluginsdk.DefaultTimeout(5 * time.Minute), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_cluster_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_cluster_data_source.go index d6fc175959f..92e6ea95d60 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_cluster_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_cluster_data_source.go @@ -7,8 +7,8 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_cluster_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_cluster_resource.go index 013a2878ddc..3403c4c19d1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_cluster_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_cluster_resource.go @@ -11,10 +11,10 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_consumer_group_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_consumer_group_data_source.go index 80f6e20e0a0..815cdb33ca9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_consumer_group_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_consumer_group_data_source.go @@ -6,8 +6,8 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_consumer_group_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_consumer_group_resource.go index 15cac3c41e0..af86aab0114 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_consumer_group_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_consumer_group_resource.go @@ -6,10 +6,10 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_data_source.go index ff926524053..1dfc20e99d5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_data_source.go @@ -6,8 +6,8 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_authorization_rule_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_authorization_rule_data_source.go index c5b9cb3ceff..31109163d12 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_authorization_rule_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_authorization_rule_data_source.go @@ -6,8 +6,8 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_authorization_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_authorization_rule_resource.go index e79bebcd087..3f701cdbe90 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_authorization_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_authorization_rule_resource.go @@ -6,12 +6,12 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_customer_managed_key_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_customer_managed_key_resource.go index ed2bed13af2..6f342522950 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_customer_managed_key_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_customer_managed_key_resource.go @@ -7,10 +7,10 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces" keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_data_source.go index 1a8c4a70d28..c67c5d809f0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_data_source.go @@ -9,9 +9,9 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_disaster_recovery_config_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_disaster_recovery_config_resource.go index e3d6f586c3d..aa4489a14a4 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_disaster_recovery_config_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_disaster_recovery_config_resource.go @@ -8,12 +8,12 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_resource.go index bdfceb21df9..bf9ca2bddc4 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_resource.go @@ -14,14 +14,13 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - legacyIdentity "github.com/hashicorp/terraform-provider-azurerm/internal/identity" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -104,7 +103,7 @@ func resourceEventHubNamespace() *pluginsdk.Resource { ValidateFunc: eventhubsclusters.ValidateClusterID, }, - "identity": commonschema.SystemAssignedIdentityOptional(), + "identity": commonschema.SystemOrUserAssignedIdentityOptional(), "maximum_throughput_units": { Type: pluginsdk.TypeInt, @@ -191,6 +190,29 @@ func resourceEventHubNamespace() *pluginsdk.Resource { }, }, + "local_authentication_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "minimum_tls_version": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + string(namespaces.TlsVersionOnePointZero), + string(namespaces.TlsVersionOnePointOne), + string(namespaces.TlsVersionOnePointTwo), + }, false), + }, + + "public_network_access_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + "default_primary_connection_string_alias": { Type: pluginsdk.TypeString, Computed: true, @@ -229,22 +251,26 @@ func resourceEventHubNamespace() *pluginsdk.Resource { "tags": commonschema.Tags(), }, - CustomizeDiff: pluginsdk.CustomizeDiffShim(func(ctx context.Context, d *pluginsdk.ResourceDiff, v interface{}) error { - oldSku, newSku := d.GetChange("sku") - if d.HasChange("sku") { - if strings.EqualFold(newSku.(string), string(namespaces.SkuNamePremium)) || strings.EqualFold(oldSku.(string), string(namespaces.SkuTierPremium)) { - log.Printf("[DEBUG] cannot migrate a namespace from or to Premium SKU") - d.ForceNew("sku") - } - if strings.EqualFold(newSku.(string), string(namespaces.SkuTierPremium)) { - zoneRedundant := d.Get("zone_redundant").(bool) - if !zoneRedundant { - return fmt.Errorf("zone_redundant needs to be set to true when using premium SKU") + + CustomizeDiff: pluginsdk.CustomDiffWithAll( + pluginsdk.CustomizeDiffShim(func(ctx context.Context, d *pluginsdk.ResourceDiff, v interface{}) error { + oldSku, newSku := d.GetChange("sku") + if d.HasChange("sku") { + if strings.EqualFold(newSku.(string), string(namespaces.SkuNamePremium)) || strings.EqualFold(oldSku.(string), string(namespaces.SkuTierPremium)) { + log.Printf("[DEBUG] cannot migrate a namespace from or to Premium SKU") + d.ForceNew("sku") + } + if strings.EqualFold(newSku.(string), string(namespaces.SkuTierPremium)) { + zoneRedundant := d.Get("zone_redundant").(bool) + if !zoneRedundant { + return fmt.Errorf("zone_redundant needs to be set to true when using premium SKU") + } } } - } - return nil - }), + return nil + }), + pluginsdk.CustomizeDiffShim(eventhubTLSVersionDiff), + ), } } @@ -274,11 +300,21 @@ func resourceEventHubNamespaceCreate(d *pluginsdk.ResourceData, meta interface{} autoInflateEnabled := d.Get("auto_inflate_enabled").(bool) zoneRedundant := d.Get("zone_redundant").(bool) - identity, err := expandEventHubIdentity(d.Get("identity").([]interface{})) + identity, err := identity.ExpandSystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } + publicNetworkEnabled := namespaces.PublicNetworkAccessEnabled + if !d.Get("public_network_access_enabled").(bool) { + publicNetworkEnabled = namespaces.PublicNetworkAccessDisabled + } + + disableLocalAuth := false + if !d.Get("local_authentication_enabled").(bool) { + disableLocalAuth = true + } + parameters := namespaces.EHNamespace{ Location: &location, Sku: &namespaces.Sku{ @@ -293,6 +329,8 @@ func resourceEventHubNamespaceCreate(d *pluginsdk.ResourceData, meta interface{} Properties: &namespaces.EHNamespaceProperties{ IsAutoInflateEnabled: utils.Bool(autoInflateEnabled), ZoneRedundant: utils.Bool(zoneRedundant), + DisableLocalAuth: utils.Bool(disableLocalAuth), + PublicNetworkAccess: &publicNetworkEnabled, }, Tags: tags.Expand(t), } @@ -301,6 +339,11 @@ func resourceEventHubNamespaceCreate(d *pluginsdk.ResourceData, meta interface{} parameters.Properties.ClusterArmId = utils.String(v) } + if tlsValue := d.Get("minimum_tls_version").(string); tlsValue != "" { + minimumTls := namespaces.TlsVersion(tlsValue) + parameters.Properties.MinimumTlsVersion = &minimumTls + } + if v, ok := d.GetOk("maximum_throughput_units"); ok { parameters.Properties.MaximumThroughputUnits = utils.Int64(int64(v.(int))) } @@ -313,25 +356,19 @@ func resourceEventHubNamespaceCreate(d *pluginsdk.ResourceData, meta interface{} ruleSets, hasRuleSets := d.GetOk("network_rulesets") if hasRuleSets { + // cannot use network rulesets with the basic SKU + if parameters.Sku.Name == namespaces.SkuNameBasic { + return fmt.Errorf("network_rulesets cannot be used when the SKU is basic") + } + rulesets := networkrulesets.NetworkRuleSet{ Properties: expandEventHubNamespaceNetworkRuleset(ruleSets.([]interface{})), } - // cannot use network rulesets with the basic SKU - if parameters.Sku.Name != namespaces.SkuNameBasic { - ruleSetsClient := meta.(*clients.Client).Eventhub.NetworkRuleSetsClient - namespaceId := networkrulesets.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) - if _, err := ruleSetsClient.NamespacesCreateOrUpdateNetworkRuleSet(ctx, namespaceId, rulesets); err != nil { - return fmt.Errorf("setting network ruleset properties for %s: %+v", id, err) - } - } else if rulesets.Properties != nil { - props := rulesets.Properties - // so if the user has specified the non default rule sets throw a validation error - if *props.DefaultAction != networkrulesets.DefaultActionDeny || - (props.IpRules != nil && len(*props.IpRules) > 0) || - (props.VirtualNetworkRules != nil && len(*props.VirtualNetworkRules) > 0) { - return fmt.Errorf("network_rulesets cannot be used when the SKU is basic") - } + ruleSetsClient := meta.(*clients.Client).Eventhub.NetworkRuleSetsClient + namespaceId := networkrulesets.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) + if _, err := ruleSetsClient.NamespacesCreateOrUpdateNetworkRuleSet(ctx, namespaceId, rulesets); err != nil { + return fmt.Errorf("setting network ruleset properties for %s: %+v", id, err) } } @@ -354,7 +391,17 @@ func resourceEventHubNamespaceUpdate(d *pluginsdk.ResourceData, meta interface{} autoInflateEnabled := d.Get("auto_inflate_enabled").(bool) zoneRedundant := d.Get("zone_redundant").(bool) - identity, err := expandEventHubIdentity(d.Get("identity").([]interface{})) + publicNetworkEnabled := namespaces.PublicNetworkAccessEnabled + if !d.Get("public_network_access_enabled").(bool) { + publicNetworkEnabled = namespaces.PublicNetworkAccessDisabled + } + + disableLocalAuth := false + if !d.Get("local_authentication_enabled").(bool) { + disableLocalAuth = true + } + + identity, err := identity.ExpandSystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } @@ -373,6 +420,8 @@ func resourceEventHubNamespaceUpdate(d *pluginsdk.ResourceData, meta interface{} Properties: &namespaces.EHNamespaceProperties{ IsAutoInflateEnabled: utils.Bool(autoInflateEnabled), ZoneRedundant: utils.Bool(zoneRedundant), + DisableLocalAuth: utils.Bool(disableLocalAuth), + PublicNetworkAccess: &publicNetworkEnabled, }, Tags: tags.Expand(t), } @@ -381,6 +430,11 @@ func resourceEventHubNamespaceUpdate(d *pluginsdk.ResourceData, meta interface{} parameters.Properties.ClusterArmId = utils.String(v) } + if tlsValue := d.Get("minimum_tls_version").(string); tlsValue != "" { + minimumTls := namespaces.TlsVersion(tlsValue) + parameters.Properties.MinimumTlsVersion = &minimumTls + } + if v, ok := d.GetOk("maximum_throughput_units"); ok { parameters.Properties.MaximumThroughputUnits = utils.Int64(int64(v.(int))) } @@ -398,32 +452,37 @@ func resourceEventHubNamespaceUpdate(d *pluginsdk.ResourceData, meta interface{} return fmt.Errorf("updating %s: %+v", id, err) } - d.SetId(id.ID()) + if d.HasChange("network_rulesets") { + // cannot use network rulesets with the basic SKU + if parameters.Sku.Name == namespaces.SkuNameBasic { + return fmt.Errorf("network_rulesets cannot be used when the SKU is basic") + } - ruleSets, hasRuleSets := d.GetOk("network_rulesets") - if hasRuleSets { + ruleSets := d.Get("network_rulesets") rulesets := networkrulesets.NetworkRuleSet{ Properties: expandEventHubNamespaceNetworkRuleset(ruleSets.([]interface{})), } - // cannot use network rulesets with the basic SKU - if parameters.Sku.Name != namespaces.SkuNameBasic { - ruleSetsClient := meta.(*clients.Client).Eventhub.NetworkRuleSetsClient - namespaceId := networkrulesets.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) - if _, err := ruleSetsClient.NamespacesCreateOrUpdateNetworkRuleSet(ctx, namespaceId, rulesets); err != nil { - return fmt.Errorf("setting network ruleset properties for %s: %+v", id, err) - } - } else if rulesets.Properties != nil { - props := rulesets.Properties - // so if the user has specified the non default rule sets throw a validation error - if *props.DefaultAction != networkrulesets.DefaultActionDeny || - (props.IpRules != nil && len(*props.IpRules) > 0) || - (props.VirtualNetworkRules != nil && len(*props.VirtualNetworkRules) > 0) { - return fmt.Errorf("network_rulesets cannot be used when the SKU is basic") - } + ruleSetsClient := meta.(*clients.Client).Eventhub.NetworkRuleSetsClient + namespaceId := networkrulesets.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) + if _, err := ruleSetsClient.NamespacesCreateOrUpdateNetworkRuleSet(ctx, namespaceId, rulesets); err != nil { + return fmt.Errorf("setting network ruleset properties for %s: %+v", id, err) } } + deadline, _ := ctx.Deadline() + stateConf := &pluginsdk.StateChangeConf{ + Pending: []string{"Activating", "ActivatingIdentity", "Updating", "Pending"}, + Target: []string{"Succeeded"}, + Refresh: eventHubNamespaceProvisioningStateRefreshFunc(ctx, client, id), + Timeout: time.Until(deadline), + PollInterval: 10 * time.Second, + } + + if _, err := stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for %s to be updated: %+v", id, err) + } + return resourceEventHubNamespaceRead(d, meta) } @@ -459,7 +518,12 @@ func resourceEventHubNamespaceRead(d *pluginsdk.ResourceData, meta interface{}) d.Set("capacity", sku.Capacity) } - if err := d.Set("identity", flattenEventHubIdentity(model.Identity)); err != nil { + identity, err := identity.FlattenSystemAndUserAssignedMap(model.Identity) + if err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } + + if err := d.Set("identity", identity); err != nil { return fmt.Errorf("setting `identity`: %+v", err) } @@ -468,6 +532,22 @@ func resourceEventHubNamespaceRead(d *pluginsdk.ResourceData, meta interface{}) d.Set("maximum_throughput_units", int(*props.MaximumThroughputUnits)) d.Set("zone_redundant", props.ZoneRedundant) d.Set("dedicated_cluster_id", props.ClusterArmId) + + localAuthDisabled := false + if props.DisableLocalAuth != nil { + localAuthDisabled = *props.DisableLocalAuth + } + d.Set("local_authentication_enabled", !localAuthDisabled) + + publicNetworkAccess := true + if props.PublicNetworkAccess != nil && *props.PublicNetworkAccess == namespaces.PublicNetworkAccessDisabled { + publicNetworkAccess = false + } + d.Set("public_network_access_enabled", publicNetworkAccess) + + if props.MinimumTlsVersion != nil { + d.Set("minimum_tls_version", *props.MinimumTlsVersion) + } } if err := tags.FlattenAndSet(d, model.Tags); err != nil { @@ -564,6 +644,26 @@ func eventHubNamespaceStateStatusCodeRefreshFunc(ctx context.Context, client *na } } +func eventHubNamespaceProvisioningStateRefreshFunc(ctx context.Context, client *namespaces.NamespacesClient, id namespaces.NamespaceId) pluginsdk.StateRefreshFunc { + return func() (interface{}, string, error) { + res, err := client.Get(ctx, id) + + provisioningState := "Pending" + if err != nil { + if response.WasNotFound(res.HttpResponse) { + return res, provisioningState, nil + } + return nil, "Error", fmt.Errorf("polling for the provisioning state of %s: %+v", id, err) + } + + if res.Model != nil && res.Model.Properties != nil && res.Model.Properties.ProvisioningState != nil { + provisioningState = *res.Model.Properties.ProvisioningState + } + + return res, provisioningState, nil + } +} + func expandEventHubNamespaceNetworkRuleset(input []interface{}) *networkrulesets.NetworkRuleSetProperties { if len(input) == 0 { return nil @@ -602,11 +702,11 @@ func expandEventHubNamespaceNetworkRuleset(input []interface{}) *networkrulesets if v, ok := block["ip_rule"].([]interface{}); ok { if len(v) > 0 { - var rules []networkrulesets.NWRuleSetIpRules + var rules []networkrulesets.NWRuleSetIPRules for _, r := range v { rblock := r.(map[string]interface{}) - rules = append(rules, networkrulesets.NWRuleSetIpRules{ - IpMask: utils.String(rblock["ip_mask"].(string)), + rules = append(rules, networkrulesets.NWRuleSetIPRules{ + IPMask: utils.String(rblock["ip_mask"].(string)), Action: func() *networkrulesets.NetworkRuleIPAction { v := networkrulesets.NetworkRuleIPAction(rblock["action"].(string)) return &v @@ -614,14 +714,14 @@ func expandEventHubNamespaceNetworkRuleset(input []interface{}) *networkrulesets }) } - ruleset.IpRules = &rules + ruleset.IPRules = &rules } } return &ruleset } -func flattenEventHubNamespaceNetworkRuleset(ruleset networkrulesets.NamespacesGetNetworkRuleSetResponse) []interface{} { +func flattenEventHubNamespaceNetworkRuleset(ruleset networkrulesets.NamespacesGetNetworkRuleSetOperationResponse) []interface{} { if ruleset.Model == nil || ruleset.Model.Properties == nil { return nil } @@ -645,7 +745,7 @@ func flattenEventHubNamespaceNetworkRuleset(ruleset networkrulesets.NamespacesGe } } ipBlocks := make([]interface{}, 0) - if ipRules := ruleset.Model.Properties.IpRules; ipRules != nil { + if ipRules := ruleset.Model.Properties.IPRules; ipRules != nil { for _, ipRule := range *ipRules { block := make(map[string]interface{}) @@ -656,7 +756,7 @@ func flattenEventHubNamespaceNetworkRuleset(ruleset networkrulesets.NamespacesGe block["action"] = action - if v := ipRule.IpMask; v != nil { + if v := ipRule.IPMask; v != nil { block["ip_mask"] = *v } @@ -674,33 +774,6 @@ func flattenEventHubNamespaceNetworkRuleset(ruleset networkrulesets.NamespacesGe }} } -func expandEventHubIdentity(input []interface{}) (*legacyIdentity.SystemUserAssignedIdentityMap, error) { - expanded, err := identity.ExpandSystemAssigned(input) - if err != nil { - return nil, err - } - - result := legacyIdentity.SystemUserAssignedIdentityMap{ - Type: legacyIdentity.Type(string(expanded.Type)), - PrincipalId: &expanded.PrincipalId, - TenantId: &expanded.TenantId, - } - return &result, nil -} - -func flattenEventHubIdentity(input *legacyIdentity.SystemUserAssignedIdentityMap) []interface{} { - if input == nil { - return []interface{}{} - } - - legacyConfig := input.ToExpandedConfig() - return identity.FlattenSystemAssigned(&identity.SystemAssigned{ - Type: identity.Type(string(legacyConfig.Type)), - PrincipalId: legacyConfig.PrincipalId, - TenantId: legacyConfig.TenantId, - }) -} - // The resource id of subnet_id that's being returned by API is always lower case & // the default caseDiff suppress func is not working in TypeSet func resourceVnetRuleHash(v interface{}) int { @@ -716,3 +789,11 @@ func resourceVnetRuleHash(v interface{}) int { } return pluginsdk.HashString(buf.String()) } + +func eventhubTLSVersionDiff(ctx context.Context, d *pluginsdk.ResourceDiff, _ interface{}) (err error) { + old, new := d.GetChange("minimum_tls_version") + if old != "" && new == "" { + err = fmt.Errorf("`minimum_tls_version` has been set before, please set a valid value for this property ") + } + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_schema_registry_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_schema_registry_resource.go new file mode 100644 index 00000000000..a2e62d4bcc5 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_namespace_schema_registry_resource.go @@ -0,0 +1,180 @@ +package eventhub + +import ( + "fmt" + "log" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func resourceEventHubNamespaceSchemaRegistry() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceEventHubNamespaceSchemaRegistryCreateUpdate, + Read: resourceEventHubNamespaceSchemaRegistryRead, + // Update: resourceEventHubNamespaceSchemaRegistryCreateUpdate, + Delete: resourceEventHubNamespaceSchemaRegistryDelete, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := schemaregistry.ParseSchemaGroupID(id) + return err + }), + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + // Update: pluginsdk.DefaultTimeout(30 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.ValidateSchemaGroupName(), + }, + + "namespace_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: namespaces.ValidateNamespaceID, + }, + + "schema_compatibility": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(schemaregistry.SchemaCompatibilityNone), + string(schemaregistry.SchemaCompatibilityBackward), + string(schemaregistry.SchemaCompatibilityForward), + }, false), + }, + + "schema_type": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(schemaregistry.SchemaTypeUnknown), + string(schemaregistry.SchemaTypeAvro), + }, false), + }, + }, + } +} + +func resourceEventHubNamespaceSchemaRegistryCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Eventhub.SchemaRegistryClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + log.Printf("[INFO] preparing arguments for AzureRM EventHub Namespace Schema Registry creation.") + + namespaceId, err := namespaces.ParseNamespaceID(d.Get("namespace_id").(string)) + if err != nil { + return fmt.Errorf("parsing eventhub namespace %s error: %+v", namespaceId.ID(), err) + } + + id := schemaregistry.NewSchemaGroupID(subscriptionId, namespaceId.ResourceGroupName, namespaceId.NamespaceName, d.Get("name").(string)) + if d.IsNewResource() { + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + + if existing.Model != nil { + return tf.ImportAsExistsError("azurerm_eventhub_namespace_schema_group", id.ID()) + } + } + + schemaCompatibilityType := schemaregistry.SchemaCompatibility(d.Get("schema_compatibility").(string)) + schemaType := schemaregistry.SchemaType(d.Get("schema_type").(string)) + + parameters := schemaregistry.SchemaGroup{ + Properties: &schemaregistry.SchemaGroupProperties{ + SchemaCompatibility: &schemaCompatibilityType, + SchemaType: &schemaType, + }, + } + + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + d.SetId(id.ID()) + + return resourceEventHubNamespaceSchemaRegistryRead(d, meta) +} + +func resourceEventHubNamespaceSchemaRegistryRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Eventhub.SchemaRegistryClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := schemaregistry.ParseSchemaGroupID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + d.SetId("") + return nil + } + return fmt.Errorf("making Read request on %s: %+v", id, err) + } + + d.Set("name", id.SchemaGroupName) + + namespaceId := namespaces.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) + d.Set("namespace_id", namespaceId.ID()) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + if props.SchemaCompatibility != nil { + d.Set("schema_compatibility", string(*props.SchemaCompatibility)) + } + if props.SchemaType != nil { + d.Set("schema_type", string(*props.SchemaType)) + } + } + } + + return nil +} + +func resourceEventHubNamespaceSchemaRegistryDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Eventhub.SchemaRegistryClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := schemaregistry.ParseSchemaGroupID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Delete(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return nil + } + + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_resource.go index bf3b1501731..ffaa7ffb3e4 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/eventhub_resource.go @@ -5,13 +5,12 @@ import ( "log" "time" - "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" - "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/migration/consumer_group.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/migration/consumer_group.go index 8112b2ee5c1..0e3ec8e815e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/migration/consumer_group.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/migration/consumer_group.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/migration/eventhub_authorization_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/migration/eventhub_authorization_rule.go new file mode 100644 index 00000000000..52529b32322 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/migration/eventhub_authorization_rule.go @@ -0,0 +1,60 @@ +package migration + +import ( + "context" + "log" + + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ pluginsdk.StateUpgrade = EventHubAuthorizationRuleV0ToV1{} + +type EventHubAuthorizationRuleV0ToV1 struct{} + +func (EventHubAuthorizationRuleV0ToV1) Schema() map[string]*pluginsdk.Schema { + s := map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "namespace_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "eventhub_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "resource_group_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + } + return s +} + +func (EventHubAuthorizationRuleV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { + return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + + oldID := rawState["id"].(string) + + newID, err := eventhubs.ParseEventhubAuthorizationRuleIDInsensitively(oldID) + if err != nil { + return nil, err + } + + log.Printf("[DEBUG] Updating ID from %q to %q", oldID, newID) + + rawState["id"] = newID.ID() + + return rawState, nil + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/parse/eventhub.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/parse/eventhub.go deleted file mode 100644 index cadfb26e0ef..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/parse/eventhub.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type EventhubId struct { - SubscriptionId string - ResourceGroup string - NamespaceName string - Name string -} - -func NewEventhubID(subscriptionId, resourceGroup, namespaceName, name string) EventhubId { - return EventhubId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NamespaceName: namespaceName, - Name: name, - } -} - -func (id EventhubId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Namespace Name %q", id.NamespaceName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Eventhub", segmentsStr) -} - -func (id EventhubId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.EventHub/namespaces/%s/eventhubs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.Name) -} - -// EventhubID parses a Eventhub ID into an EventhubId struct -func EventhubID(input string) (*EventhubId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := EventhubId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NamespaceName, err = id.PopSegment("namespaces"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("eventhubs"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/registration.go index 19db6da0b32..0edb4cf9a9f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/registration.go @@ -46,6 +46,7 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { "azurerm_eventhub_namespace_customer_managed_key": resourceEventHubNamespaceCustomerManagedKey(), "azurerm_eventhub_namespace_disaster_recovery_config": resourceEventHubNamespaceDisasterRecoveryConfig(), "azurerm_eventhub_namespace": resourceEventHubNamespace(), + "azurerm_eventhub_namespace_schema_group": resourceEventHubNamespaceSchemaRegistry(), "azurerm_eventhub": resourceEventHub(), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/client.go deleted file mode 100644 index 971a6130cda..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package authorizationruleseventhubs - -import "github.com/Azure/go-autorest/autorest" - -type AuthorizationRulesEventHubsClient struct { - Client autorest.Client - baseUri string -} - -func NewAuthorizationRulesEventHubsClientWithBaseURI(endpoint string) AuthorizationRulesEventHubsClient { - return AuthorizationRulesEventHubsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/constants.go deleted file mode 100644 index 3f39c28428c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/constants.go +++ /dev/null @@ -1,62 +0,0 @@ -package authorizationruleseventhubs - -import "strings" - -type AccessRights string - -const ( - AccessRightsListen AccessRights = "Listen" - AccessRightsManage AccessRights = "Manage" - AccessRightsSend AccessRights = "Send" -) - -func PossibleValuesForAccessRights() []string { - return []string{ - string(AccessRightsListen), - string(AccessRightsManage), - string(AccessRightsSend), - } -} - -func parseAccessRights(input string) (*AccessRights, error) { - vals := map[string]AccessRights{ - "listen": AccessRightsListen, - "manage": AccessRightsManage, - "send": AccessRightsSend, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccessRights(input) - return &out, nil -} - -type KeyType string - -const ( - KeyTypePrimaryKey KeyType = "PrimaryKey" - KeyTypeSecondaryKey KeyType = "SecondaryKey" -) - -func PossibleValuesForKeyType() []string { - return []string{ - string(KeyTypePrimaryKey), - string(KeyTypeSecondaryKey), - } -} - -func parseKeyType(input string) (*KeyType, error) { - vals := map[string]KeyType{ - "primarykey": KeyTypePrimaryKey, - "secondarykey": KeyTypeSecondaryKey, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeyType(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/model_accesskeys.go deleted file mode 100644 index d0b2fc753c3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/model_accesskeys.go +++ /dev/null @@ -1,11 +0,0 @@ -package authorizationruleseventhubs - -type AccessKeys struct { - AliasPrimaryConnectionString *string `json:"aliasPrimaryConnectionString,omitempty"` - AliasSecondaryConnectionString *string `json:"aliasSecondaryConnectionString,omitempty"` - KeyName *string `json:"keyName,omitempty"` - PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/model_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/model_authorizationrule.go deleted file mode 100644 index a747d5013f2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/model_authorizationrule.go +++ /dev/null @@ -1,8 +0,0 @@ -package authorizationruleseventhubs - -type AuthorizationRule struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *AuthorizationRuleProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/model_authorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/model_authorizationruleproperties.go deleted file mode 100644 index 0b8b64c69a4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/model_authorizationruleproperties.go +++ /dev/null @@ -1,5 +0,0 @@ -package authorizationruleseventhubs - -type AuthorizationRuleProperties struct { - Rights []AccessRights `json:"rights"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/model_regenerateaccesskeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/model_regenerateaccesskeyparameters.go deleted file mode 100644 index f2734bdb613..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/model_regenerateaccesskeyparameters.go +++ /dev/null @@ -1,6 +0,0 @@ -package authorizationruleseventhubs - -type RegenerateAccessKeyParameters struct { - Key *string `json:"key,omitempty"` - KeyType KeyType `json:"keyType"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/predicates.go deleted file mode 100644 index 9534327e86b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/predicates.go +++ /dev/null @@ -1,24 +0,0 @@ -package authorizationruleseventhubs - -type AuthorizationRulePredicate struct { - Id *string - Name *string - Type *string -} - -func (p AuthorizationRulePredicate) Matches(input AuthorizationRule) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/version.go deleted file mode 100644 index 7bbf960fde4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package authorizationruleseventhubs - -import "fmt" - -const defaultApiVersion = "2017-04-01" - -func userAgent() string { - return fmt.Sprintf("pandora/authorizationruleseventhubs/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/client.go deleted file mode 100644 index 0d9867a6c6a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package authorizationrulesnamespaces - -import "github.com/Azure/go-autorest/autorest" - -type AuthorizationRulesNamespacesClient struct { - Client autorest.Client - baseUri string -} - -func NewAuthorizationRulesNamespacesClientWithBaseURI(endpoint string) AuthorizationRulesNamespacesClient { - return AuthorizationRulesNamespacesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/constants.go deleted file mode 100644 index 290585f6961..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/constants.go +++ /dev/null @@ -1,62 +0,0 @@ -package authorizationrulesnamespaces - -import "strings" - -type AccessRights string - -const ( - AccessRightsListen AccessRights = "Listen" - AccessRightsManage AccessRights = "Manage" - AccessRightsSend AccessRights = "Send" -) - -func PossibleValuesForAccessRights() []string { - return []string{ - string(AccessRightsListen), - string(AccessRightsManage), - string(AccessRightsSend), - } -} - -func parseAccessRights(input string) (*AccessRights, error) { - vals := map[string]AccessRights{ - "listen": AccessRightsListen, - "manage": AccessRightsManage, - "send": AccessRightsSend, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccessRights(input) - return &out, nil -} - -type KeyType string - -const ( - KeyTypePrimaryKey KeyType = "PrimaryKey" - KeyTypeSecondaryKey KeyType = "SecondaryKey" -) - -func PossibleValuesForKeyType() []string { - return []string{ - string(KeyTypePrimaryKey), - string(KeyTypeSecondaryKey), - } -} - -func parseKeyType(input string) (*KeyType, error) { - vals := map[string]KeyType{ - "primarykey": KeyTypePrimaryKey, - "secondarykey": KeyTypeSecondaryKey, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeyType(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespacescreateorupdateauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespacescreateorupdateauthorizationrule_autorest.go deleted file mode 100644 index 2ead6125905..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespacescreateorupdateauthorizationrule_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package authorizationrulesnamespaces - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type NamespacesCreateOrUpdateAuthorizationRuleResponse struct { - HttpResponse *http.Response - Model *AuthorizationRule -} - -// NamespacesCreateOrUpdateAuthorizationRule ... -func (c AuthorizationRulesNamespacesClient) NamespacesCreateOrUpdateAuthorizationRule(ctx context.Context, id AuthorizationRuleId, input AuthorizationRule) (result NamespacesCreateOrUpdateAuthorizationRuleResponse, err error) { - req, err := c.preparerForNamespacesCreateOrUpdateAuthorizationRule(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesCreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesCreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForNamespacesCreateOrUpdateAuthorizationRule(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesCreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForNamespacesCreateOrUpdateAuthorizationRule prepares the NamespacesCreateOrUpdateAuthorizationRule request. -func (c AuthorizationRulesNamespacesClient) preparerForNamespacesCreateOrUpdateAuthorizationRule(ctx context.Context, id AuthorizationRuleId, input AuthorizationRule) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForNamespacesCreateOrUpdateAuthorizationRule handles the response to the NamespacesCreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (c AuthorizationRulesNamespacesClient) responderForNamespacesCreateOrUpdateAuthorizationRule(resp *http.Response) (result NamespacesCreateOrUpdateAuthorizationRuleResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespacesdeleteauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespacesdeleteauthorizationrule_autorest.go deleted file mode 100644 index abe3bca421e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespacesdeleteauthorizationrule_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package authorizationrulesnamespaces - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type NamespacesDeleteAuthorizationRuleResponse struct { - HttpResponse *http.Response -} - -// NamespacesDeleteAuthorizationRule ... -func (c AuthorizationRulesNamespacesClient) NamespacesDeleteAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (result NamespacesDeleteAuthorizationRuleResponse, err error) { - req, err := c.preparerForNamespacesDeleteAuthorizationRule(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesDeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesDeleteAuthorizationRule", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForNamespacesDeleteAuthorizationRule(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesDeleteAuthorizationRule", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForNamespacesDeleteAuthorizationRule prepares the NamespacesDeleteAuthorizationRule request. -func (c AuthorizationRulesNamespacesClient) preparerForNamespacesDeleteAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForNamespacesDeleteAuthorizationRule handles the response to the NamespacesDeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (c AuthorizationRulesNamespacesClient) responderForNamespacesDeleteAuthorizationRule(resp *http.Response) (result NamespacesDeleteAuthorizationRuleResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespacesgetauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespacesgetauthorizationrule_autorest.go deleted file mode 100644 index ad92f77d388..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespacesgetauthorizationrule_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package authorizationrulesnamespaces - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type NamespacesGetAuthorizationRuleResponse struct { - HttpResponse *http.Response - Model *AuthorizationRule -} - -// NamespacesGetAuthorizationRule ... -func (c AuthorizationRulesNamespacesClient) NamespacesGetAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (result NamespacesGetAuthorizationRuleResponse, err error) { - req, err := c.preparerForNamespacesGetAuthorizationRule(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesGetAuthorizationRule", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesGetAuthorizationRule", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForNamespacesGetAuthorizationRule(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesGetAuthorizationRule", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForNamespacesGetAuthorizationRule prepares the NamespacesGetAuthorizationRule request. -func (c AuthorizationRulesNamespacesClient) preparerForNamespacesGetAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForNamespacesGetAuthorizationRule handles the response to the NamespacesGetAuthorizationRule request. The method always -// closes the http.Response Body. -func (c AuthorizationRulesNamespacesClient) responderForNamespacesGetAuthorizationRule(resp *http.Response) (result NamespacesGetAuthorizationRuleResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespaceslistauthorizationrules_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespaceslistauthorizationrules_autorest.go deleted file mode 100644 index e1fd6b268a1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespaceslistauthorizationrules_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package authorizationrulesnamespaces - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type NamespacesListAuthorizationRulesResponse struct { - HttpResponse *http.Response - Model *[]AuthorizationRule - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (NamespacesListAuthorizationRulesResponse, error) -} - -type NamespacesListAuthorizationRulesCompleteResult struct { - Items []AuthorizationRule -} - -func (r NamespacesListAuthorizationRulesResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r NamespacesListAuthorizationRulesResponse) LoadMore(ctx context.Context) (resp NamespacesListAuthorizationRulesResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// NamespacesListAuthorizationRules ... -func (c AuthorizationRulesNamespacesClient) NamespacesListAuthorizationRules(ctx context.Context, id NamespaceId) (resp NamespacesListAuthorizationRulesResponse, err error) { - req, err := c.preparerForNamespacesListAuthorizationRules(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListAuthorizationRules", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForNamespacesListAuthorizationRules(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListAuthorizationRules", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// NamespacesListAuthorizationRulesComplete retrieves all of the results into a single object -func (c AuthorizationRulesNamespacesClient) NamespacesListAuthorizationRulesComplete(ctx context.Context, id NamespaceId) (NamespacesListAuthorizationRulesCompleteResult, error) { - return c.NamespacesListAuthorizationRulesCompleteMatchingPredicate(ctx, id, AuthorizationRulePredicate{}) -} - -// NamespacesListAuthorizationRulesCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AuthorizationRulesNamespacesClient) NamespacesListAuthorizationRulesCompleteMatchingPredicate(ctx context.Context, id NamespaceId, predicate AuthorizationRulePredicate) (resp NamespacesListAuthorizationRulesCompleteResult, err error) { - items := make([]AuthorizationRule, 0) - - page, err := c.NamespacesListAuthorizationRules(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := NamespacesListAuthorizationRulesCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForNamespacesListAuthorizationRules prepares the NamespacesListAuthorizationRules request. -func (c AuthorizationRulesNamespacesClient) preparerForNamespacesListAuthorizationRules(ctx context.Context, id NamespaceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/authorizationRules", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForNamespacesListAuthorizationRulesWithNextLink prepares the NamespacesListAuthorizationRules request with the given nextLink token. -func (c AuthorizationRulesNamespacesClient) preparerForNamespacesListAuthorizationRulesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForNamespacesListAuthorizationRules handles the response to the NamespacesListAuthorizationRules request. The method always -// closes the http.Response Body. -func (c AuthorizationRulesNamespacesClient) responderForNamespacesListAuthorizationRules(resp *http.Response) (result NamespacesListAuthorizationRulesResponse, err error) { - type page struct { - Values []AuthorizationRule `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result NamespacesListAuthorizationRulesResponse, err error) { - req, err := c.preparerForNamespacesListAuthorizationRulesWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListAuthorizationRules", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListAuthorizationRules", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForNamespacesListAuthorizationRules(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListAuthorizationRules", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespaceslistkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespaceslistkeys_autorest.go deleted file mode 100644 index e53c912c8d3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespaceslistkeys_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package authorizationrulesnamespaces - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type NamespacesListKeysResponse struct { - HttpResponse *http.Response - Model *AccessKeys -} - -// NamespacesListKeys ... -func (c AuthorizationRulesNamespacesClient) NamespacesListKeys(ctx context.Context, id AuthorizationRuleId) (result NamespacesListKeysResponse, err error) { - req, err := c.preparerForNamespacesListKeys(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForNamespacesListKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesListKeys", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForNamespacesListKeys prepares the NamespacesListKeys request. -func (c AuthorizationRulesNamespacesClient) preparerForNamespacesListKeys(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForNamespacesListKeys handles the response to the NamespacesListKeys request. The method always -// closes the http.Response Body. -func (c AuthorizationRulesNamespacesClient) responderForNamespacesListKeys(resp *http.Response) (result NamespacesListKeysResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespacesregeneratekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespacesregeneratekeys_autorest.go deleted file mode 100644 index 3f419c69e47..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/method_namespacesregeneratekeys_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package authorizationrulesnamespaces - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type NamespacesRegenerateKeysResponse struct { - HttpResponse *http.Response - Model *AccessKeys -} - -// NamespacesRegenerateKeys ... -func (c AuthorizationRulesNamespacesClient) NamespacesRegenerateKeys(ctx context.Context, id AuthorizationRuleId, input RegenerateAccessKeyParameters) (result NamespacesRegenerateKeysResponse, err error) { - req, err := c.preparerForNamespacesRegenerateKeys(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesRegenerateKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesRegenerateKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForNamespacesRegenerateKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizationrulesnamespaces.AuthorizationRulesNamespacesClient", "NamespacesRegenerateKeys", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForNamespacesRegenerateKeys prepares the NamespacesRegenerateKeys request. -func (c AuthorizationRulesNamespacesClient) preparerForNamespacesRegenerateKeys(ctx context.Context, id AuthorizationRuleId, input RegenerateAccessKeyParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regenerateKeys", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForNamespacesRegenerateKeys handles the response to the NamespacesRegenerateKeys request. The method always -// closes the http.Response Body. -func (c AuthorizationRulesNamespacesClient) responderForNamespacesRegenerateKeys(resp *http.Response) (result NamespacesRegenerateKeysResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/model_accesskeys.go deleted file mode 100644 index 3056d6122af..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/model_accesskeys.go +++ /dev/null @@ -1,11 +0,0 @@ -package authorizationrulesnamespaces - -type AccessKeys struct { - AliasPrimaryConnectionString *string `json:"aliasPrimaryConnectionString,omitempty"` - AliasSecondaryConnectionString *string `json:"aliasSecondaryConnectionString,omitempty"` - KeyName *string `json:"keyName,omitempty"` - PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/model_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/model_authorizationrule.go deleted file mode 100644 index 61c25fbd284..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/model_authorizationrule.go +++ /dev/null @@ -1,8 +0,0 @@ -package authorizationrulesnamespaces - -type AuthorizationRule struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *AuthorizationRuleProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/model_authorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/model_authorizationruleproperties.go deleted file mode 100644 index 3414202343f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/model_authorizationruleproperties.go +++ /dev/null @@ -1,5 +0,0 @@ -package authorizationrulesnamespaces - -type AuthorizationRuleProperties struct { - Rights []AccessRights `json:"rights"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/model_regenerateaccesskeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/model_regenerateaccesskeyparameters.go deleted file mode 100644 index ea24513b1b5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/model_regenerateaccesskeyparameters.go +++ /dev/null @@ -1,6 +0,0 @@ -package authorizationrulesnamespaces - -type RegenerateAccessKeyParameters struct { - Key *string `json:"key,omitempty"` - KeyType KeyType `json:"keyType"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/predicates.go deleted file mode 100644 index 79c83719d5c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/predicates.go +++ /dev/null @@ -1,24 +0,0 @@ -package authorizationrulesnamespaces - -type AuthorizationRulePredicate struct { - Id *string - Name *string - Type *string -} - -func (p AuthorizationRulePredicate) Matches(input AuthorizationRule) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/version.go deleted file mode 100644 index c76054ce550..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package authorizationrulesnamespaces - -import "fmt" - -const defaultApiVersion = "2017-04-01" - -func userAgent() string { - return fmt.Sprintf("pandora/authorizationrulesnamespaces/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/client.go deleted file mode 100644 index 69aef5e26bc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package checknameavailabilitydisasterrecoveryconfigs - -import "github.com/Azure/go-autorest/autorest" - -type CheckNameAvailabilityDisasterRecoveryConfigsClient struct { - Client autorest.Client - baseUri string -} - -func NewCheckNameAvailabilityDisasterRecoveryConfigsClientWithBaseURI(endpoint string) CheckNameAvailabilityDisasterRecoveryConfigsClient { - return CheckNameAvailabilityDisasterRecoveryConfigsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/constants.go deleted file mode 100644 index de79bc3684f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/constants.go +++ /dev/null @@ -1,43 +0,0 @@ -package checknameavailabilitydisasterrecoveryconfigs - -import "strings" - -type UnavailableReason string - -const ( - UnavailableReasonInvalidName UnavailableReason = "InvalidName" - UnavailableReasonNameInLockdown UnavailableReason = "NameInLockdown" - UnavailableReasonNameInUse UnavailableReason = "NameInUse" - UnavailableReasonNone UnavailableReason = "None" - UnavailableReasonSubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" - UnavailableReasonTooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" -) - -func PossibleValuesForUnavailableReason() []string { - return []string{ - string(UnavailableReasonInvalidName), - string(UnavailableReasonNameInLockdown), - string(UnavailableReasonNameInUse), - string(UnavailableReasonNone), - string(UnavailableReasonSubscriptionIsDisabled), - string(UnavailableReasonTooManyNamespaceInCurrentSubscription), - } -} - -func parseUnavailableReason(input string) (*UnavailableReason, error) { - vals := map[string]UnavailableReason{ - "invalidname": UnavailableReasonInvalidName, - "nameinlockdown": UnavailableReasonNameInLockdown, - "nameinuse": UnavailableReasonNameInUse, - "none": UnavailableReasonNone, - "subscriptionisdisabled": UnavailableReasonSubscriptionIsDisabled, - "toomanynamespaceincurrentsubscription": UnavailableReasonTooManyNamespaceInCurrentSubscription, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := UnavailableReason(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/model_checknameavailabilityparameter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/model_checknameavailabilityparameter.go deleted file mode 100644 index 38ce1ff42f9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/model_checknameavailabilityparameter.go +++ /dev/null @@ -1,5 +0,0 @@ -package checknameavailabilitydisasterrecoveryconfigs - -type CheckNameAvailabilityParameter struct { - Name string `json:"name"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/model_checknameavailabilityresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/model_checknameavailabilityresult.go deleted file mode 100644 index 2cefe21adb8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/model_checknameavailabilityresult.go +++ /dev/null @@ -1,7 +0,0 @@ -package checknameavailabilitydisasterrecoveryconfigs - -type CheckNameAvailabilityResult struct { - Message *string `json:"message,omitempty"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason *UnavailableReason `json:"reason,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/version.go deleted file mode 100644 index cfbaca24f2f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package checknameavailabilitydisasterrecoveryconfigs - -import "fmt" - -const defaultApiVersion = "2017-04-01" - -func userAgent() string { - return fmt.Sprintf("pandora/checknameavailabilitydisasterrecoveryconfigs/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/client.go deleted file mode 100644 index d3f3bb758e6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package consumergroups - -import "github.com/Azure/go-autorest/autorest" - -type ConsumerGroupsClient struct { - Client autorest.Client - baseUri string -} - -func NewConsumerGroupsClientWithBaseURI(endpoint string) ConsumerGroupsClient { - return ConsumerGroupsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/method_createorupdate_autorest.go deleted file mode 100644 index 28d0a7430b0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/method_createorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package consumergroups - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateOrUpdateResponse struct { - HttpResponse *http.Response - Model *ConsumerGroup -} - -// CreateOrUpdate ... -func (c ConsumerGroupsClient) CreateOrUpdate(ctx context.Context, id ConsumerGroupId, input ConsumerGroup) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ConsumerGroupsClient) preparerForCreateOrUpdate(ctx context.Context, id ConsumerGroupId, input ConsumerGroup) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ConsumerGroupsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/method_delete_autorest.go deleted file mode 100644 index 3e653b9abf3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/method_delete_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package consumergroups - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c ConsumerGroupsClient) Delete(ctx context.Context, id ConsumerGroupId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ConsumerGroupsClient) preparerForDelete(ctx context.Context, id ConsumerGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ConsumerGroupsClient) responderForDelete(resp *http.Response) (result DeleteResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/method_get_autorest.go deleted file mode 100644 index e156f7b7daa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package consumergroups - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *ConsumerGroup -} - -// Get ... -func (c ConsumerGroupsClient) Get(ctx context.Context, id ConsumerGroupId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "consumergroups.ConsumerGroupsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ConsumerGroupsClient) preparerForGet(ctx context.Context, id ConsumerGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ConsumerGroupsClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/model_consumergroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/model_consumergroup.go deleted file mode 100644 index e279a28b1df..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/model_consumergroup.go +++ /dev/null @@ -1,8 +0,0 @@ -package consumergroups - -type ConsumerGroup struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *ConsumerGroupProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/model_consumergroupproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/model_consumergroupproperties.go deleted file mode 100644 index 4f669c46636..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/model_consumergroupproperties.go +++ /dev/null @@ -1,37 +0,0 @@ -package consumergroups - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type ConsumerGroupProperties struct { - CreatedAt *string `json:"createdAt,omitempty"` - UpdatedAt *string `json:"updatedAt,omitempty"` - UserMetadata *string `json:"userMetadata,omitempty"` -} - -func (o ConsumerGroupProperties) GetCreatedAtAsTime() (*time.Time, error) { - if o.CreatedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o ConsumerGroupProperties) SetCreatedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreatedAt = &formatted -} - -func (o ConsumerGroupProperties) GetUpdatedAtAsTime() (*time.Time, error) { - if o.UpdatedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.UpdatedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o ConsumerGroupProperties) SetUpdatedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.UpdatedAt = &formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/predicates.go deleted file mode 100644 index 3ac88adc9ed..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/predicates.go +++ /dev/null @@ -1,24 +0,0 @@ -package consumergroups - -type ConsumerGroupPredicate struct { - Id *string - Name *string - Type *string -} - -func (p ConsumerGroupPredicate) Matches(input ConsumerGroup) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/version.go deleted file mode 100644 index 51280f3d09d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package consumergroups - -import "fmt" - -const defaultApiVersion = "2017-04-01" - -func userAgent() string { - return fmt.Sprintf("pandora/consumergroups/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/client.go deleted file mode 100644 index 4d9aa02a3dd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package disasterrecoveryconfigs - -import "github.com/Azure/go-autorest/autorest" - -type DisasterRecoveryConfigsClient struct { - Client autorest.Client - baseUri string -} - -func NewDisasterRecoveryConfigsClientWithBaseURI(endpoint string) DisasterRecoveryConfigsClient { - return DisasterRecoveryConfigsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/constants.go deleted file mode 100644 index 352fe22ceeb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/constants.go +++ /dev/null @@ -1,65 +0,0 @@ -package disasterrecoveryconfigs - -import "strings" - -type ProvisioningStateDR string - -const ( - ProvisioningStateDRAccepted ProvisioningStateDR = "Accepted" - ProvisioningStateDRFailed ProvisioningStateDR = "Failed" - ProvisioningStateDRSucceeded ProvisioningStateDR = "Succeeded" -) - -func PossibleValuesForProvisioningStateDR() []string { - return []string{ - string(ProvisioningStateDRAccepted), - string(ProvisioningStateDRFailed), - string(ProvisioningStateDRSucceeded), - } -} - -func parseProvisioningStateDR(input string) (*ProvisioningStateDR, error) { - vals := map[string]ProvisioningStateDR{ - "accepted": ProvisioningStateDRAccepted, - "failed": ProvisioningStateDRFailed, - "succeeded": ProvisioningStateDRSucceeded, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProvisioningStateDR(input) - return &out, nil -} - -type RoleDisasterRecovery string - -const ( - RoleDisasterRecoveryPrimary RoleDisasterRecovery = "Primary" - RoleDisasterRecoveryPrimaryNotReplicating RoleDisasterRecovery = "PrimaryNotReplicating" - RoleDisasterRecoverySecondary RoleDisasterRecovery = "Secondary" -) - -func PossibleValuesForRoleDisasterRecovery() []string { - return []string{ - string(RoleDisasterRecoveryPrimary), - string(RoleDisasterRecoveryPrimaryNotReplicating), - string(RoleDisasterRecoverySecondary), - } -} - -func parseRoleDisasterRecovery(input string) (*RoleDisasterRecovery, error) { - vals := map[string]RoleDisasterRecovery{ - "primary": RoleDisasterRecoveryPrimary, - "primarynotreplicating": RoleDisasterRecoveryPrimaryNotReplicating, - "secondary": RoleDisasterRecoverySecondary, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RoleDisasterRecovery(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_breakpairing_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_breakpairing_autorest.go deleted file mode 100644 index 3ba757ed459..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_breakpairing_autorest.go +++ /dev/null @@ -1,63 +0,0 @@ -package disasterrecoveryconfigs - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type BreakPairingResponse struct { - HttpResponse *http.Response -} - -// BreakPairing ... -func (c DisasterRecoveryConfigsClient) BreakPairing(ctx context.Context, id DisasterRecoveryConfigId) (result BreakPairingResponse, err error) { - req, err := c.preparerForBreakPairing(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "BreakPairing", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "BreakPairing", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForBreakPairing(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "BreakPairing", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForBreakPairing prepares the BreakPairing request. -func (c DisasterRecoveryConfigsClient) preparerForBreakPairing(ctx context.Context, id DisasterRecoveryConfigId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/breakPairing", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForBreakPairing handles the response to the BreakPairing request. The method always -// closes the http.Response Body. -func (c DisasterRecoveryConfigsClient) responderForBreakPairing(resp *http.Response) (result BreakPairingResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_createorupdate_autorest.go deleted file mode 100644 index dab69562060..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_createorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package disasterrecoveryconfigs - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateOrUpdateResponse struct { - HttpResponse *http.Response - Model *ArmDisasterRecovery -} - -// CreateOrUpdate ... -func (c DisasterRecoveryConfigsClient) CreateOrUpdate(ctx context.Context, id DisasterRecoveryConfigId, input ArmDisasterRecovery) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c DisasterRecoveryConfigsClient) preparerForCreateOrUpdate(ctx context.Context, id DisasterRecoveryConfigId, input ArmDisasterRecovery) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c DisasterRecoveryConfigsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_delete_autorest.go deleted file mode 100644 index 320d68d6118..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_delete_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package disasterrecoveryconfigs - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c DisasterRecoveryConfigsClient) Delete(ctx context.Context, id DisasterRecoveryConfigId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c DisasterRecoveryConfigsClient) preparerForDelete(ctx context.Context, id DisasterRecoveryConfigId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c DisasterRecoveryConfigsClient) responderForDelete(resp *http.Response) (result DeleteResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_failover_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_failover_autorest.go deleted file mode 100644 index 5ae6747c234..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_failover_autorest.go +++ /dev/null @@ -1,63 +0,0 @@ -package disasterrecoveryconfigs - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type FailOverResponse struct { - HttpResponse *http.Response -} - -// FailOver ... -func (c DisasterRecoveryConfigsClient) FailOver(ctx context.Context, id DisasterRecoveryConfigId) (result FailOverResponse, err error) { - req, err := c.preparerForFailOver(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "FailOver", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "FailOver", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForFailOver(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "FailOver", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForFailOver prepares the FailOver request. -func (c DisasterRecoveryConfigsClient) preparerForFailOver(ctx context.Context, id DisasterRecoveryConfigId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/failover", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForFailOver handles the response to the FailOver request. The method always -// closes the http.Response Body. -func (c DisasterRecoveryConfigsClient) responderForFailOver(resp *http.Response) (result FailOverResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_get_autorest.go deleted file mode 100644 index 8c3ac7e3d10..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package disasterrecoveryconfigs - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *ArmDisasterRecovery -} - -// Get ... -func (c DisasterRecoveryConfigsClient) Get(ctx context.Context, id DisasterRecoveryConfigId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c DisasterRecoveryConfigsClient) preparerForGet(ctx context.Context, id DisasterRecoveryConfigId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c DisasterRecoveryConfigsClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_list_autorest.go deleted file mode 100644 index 320c8f8dfc0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/method_list_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package disasterrecoveryconfigs - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListResponse struct { - HttpResponse *http.Response - Model *[]ArmDisasterRecovery - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListResponse, error) -} - -type ListCompleteResult struct { - Items []ArmDisasterRecovery -} - -func (r ListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListResponse) LoadMore(ctx context.Context) (resp ListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c DisasterRecoveryConfigsClient) List(ctx context.Context, id NamespaceId) (resp ListResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c DisasterRecoveryConfigsClient) ListComplete(ctx context.Context, id NamespaceId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, ArmDisasterRecoveryPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c DisasterRecoveryConfigsClient) ListCompleteMatchingPredicate(ctx context.Context, id NamespaceId, predicate ArmDisasterRecoveryPredicate) (resp ListCompleteResult, err error) { - items := make([]ArmDisasterRecovery, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForList prepares the List request. -func (c DisasterRecoveryConfigsClient) preparerForList(ctx context.Context, id NamespaceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/disasterRecoveryConfigs", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c DisasterRecoveryConfigsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c DisasterRecoveryConfigsClient) responderForList(resp *http.Response) (result ListResponse, err error) { - type page struct { - Values []ArmDisasterRecovery `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "disasterrecoveryconfigs.DisasterRecoveryConfigsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/model_armdisasterrecovery.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/model_armdisasterrecovery.go deleted file mode 100644 index ad640bdfc81..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/model_armdisasterrecovery.go +++ /dev/null @@ -1,8 +0,0 @@ -package disasterrecoveryconfigs - -type ArmDisasterRecovery struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *ArmDisasterRecoveryProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/model_armdisasterrecoveryproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/model_armdisasterrecoveryproperties.go deleted file mode 100644 index 37d897cf4b7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/model_armdisasterrecoveryproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -package disasterrecoveryconfigs - -type ArmDisasterRecoveryProperties struct { - AlternateName *string `json:"alternateName,omitempty"` - PartnerNamespace *string `json:"partnerNamespace,omitempty"` - PendingReplicationOperationsCount *int64 `json:"pendingReplicationOperationsCount,omitempty"` - ProvisioningState *ProvisioningStateDR `json:"provisioningState,omitempty"` - Role *RoleDisasterRecovery `json:"role,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/predicates.go deleted file mode 100644 index 7fbef806986..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/predicates.go +++ /dev/null @@ -1,24 +0,0 @@ -package disasterrecoveryconfigs - -type ArmDisasterRecoveryPredicate struct { - Id *string - Name *string - Type *string -} - -func (p ArmDisasterRecoveryPredicate) Matches(input ArmDisasterRecovery) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/version.go deleted file mode 100644 index abe3a3d0807..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package disasterrecoveryconfigs - -import "fmt" - -const defaultApiVersion = "2017-04-01" - -func userAgent() string { - return fmt.Sprintf("pandora/disasterrecoveryconfigs/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/client.go deleted file mode 100644 index e1b02b6a55e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package eventhubs - -import "github.com/Azure/go-autorest/autorest" - -type EventHubsClient struct { - Client autorest.Client - baseUri string -} - -func NewEventHubsClientWithBaseURI(endpoint string) EventHubsClient { - return EventHubsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/constants.go deleted file mode 100644 index 5d87c4ea924..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/constants.go +++ /dev/null @@ -1,111 +0,0 @@ -package eventhubs - -import "strings" - -type AccessRights string - -const ( - AccessRightsListen AccessRights = "Listen" - AccessRightsManage AccessRights = "Manage" - AccessRightsSend AccessRights = "Send" -) - -func PossibleValuesForAccessRights() []string { - return []string{ - string(AccessRightsListen), - string(AccessRightsManage), - string(AccessRightsSend), - } -} - -func parseAccessRights(input string) (*AccessRights, error) { - vals := map[string]AccessRights{ - "listen": AccessRightsListen, - "manage": AccessRightsManage, - "send": AccessRightsSend, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccessRights(input) - return &out, nil -} - -type EncodingCaptureDescription string - -const ( - EncodingCaptureDescriptionAvro EncodingCaptureDescription = "Avro" - EncodingCaptureDescriptionAvroDeflate EncodingCaptureDescription = "AvroDeflate" -) - -func PossibleValuesForEncodingCaptureDescription() []string { - return []string{ - string(EncodingCaptureDescriptionAvro), - string(EncodingCaptureDescriptionAvroDeflate), - } -} - -func parseEncodingCaptureDescription(input string) (*EncodingCaptureDescription, error) { - vals := map[string]EncodingCaptureDescription{ - "avro": EncodingCaptureDescriptionAvro, - "avrodeflate": EncodingCaptureDescriptionAvroDeflate, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncodingCaptureDescription(input) - return &out, nil -} - -type EntityStatus string - -const ( - EntityStatusActive EntityStatus = "Active" - EntityStatusCreating EntityStatus = "Creating" - EntityStatusDeleting EntityStatus = "Deleting" - EntityStatusDisabled EntityStatus = "Disabled" - EntityStatusReceiveDisabled EntityStatus = "ReceiveDisabled" - EntityStatusRenaming EntityStatus = "Renaming" - EntityStatusRestoring EntityStatus = "Restoring" - EntityStatusSendDisabled EntityStatus = "SendDisabled" - EntityStatusUnknown EntityStatus = "Unknown" -) - -func PossibleValuesForEntityStatus() []string { - return []string{ - string(EntityStatusActive), - string(EntityStatusCreating), - string(EntityStatusDeleting), - string(EntityStatusDisabled), - string(EntityStatusReceiveDisabled), - string(EntityStatusRenaming), - string(EntityStatusRestoring), - string(EntityStatusSendDisabled), - string(EntityStatusUnknown), - } -} - -func parseEntityStatus(input string) (*EntityStatus, error) { - vals := map[string]EntityStatus{ - "active": EntityStatusActive, - "creating": EntityStatusCreating, - "deleting": EntityStatusDeleting, - "disabled": EntityStatusDisabled, - "receivedisabled": EntityStatusReceiveDisabled, - "renaming": EntityStatusRenaming, - "restoring": EntityStatusRestoring, - "senddisabled": EntityStatusSendDisabled, - "unknown": EntityStatusUnknown, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EntityStatus(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_createorupdate_autorest.go deleted file mode 100644 index 52d8de2d199..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_createorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package eventhubs - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateOrUpdateResponse struct { - HttpResponse *http.Response - Model *Eventhub -} - -// CreateOrUpdate ... -func (c EventHubsClient) CreateOrUpdate(ctx context.Context, id EventhubId, input Eventhub) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c EventHubsClient) preparerForCreateOrUpdate(ctx context.Context, id EventhubId, input Eventhub) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c EventHubsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_delete_autorest.go deleted file mode 100644 index 76179694261..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_delete_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package eventhubs - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c EventHubsClient) Delete(ctx context.Context, id EventhubId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c EventHubsClient) preparerForDelete(ctx context.Context, id EventhubId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c EventHubsClient) responderForDelete(resp *http.Response) (result DeleteResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_deleteauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_deleteauthorizationrule_autorest.go deleted file mode 100644 index 3afdf96220c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_deleteauthorizationrule_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package eventhubs - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteAuthorizationRuleResponse struct { - HttpResponse *http.Response -} - -// DeleteAuthorizationRule ... -func (c EventHubsClient) DeleteAuthorizationRule(ctx context.Context, id EventhubAuthorizationRuleId) (result DeleteAuthorizationRuleResponse, err error) { - req, err := c.preparerForDeleteAuthorizationRule(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDeleteAuthorizationRule(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDeleteAuthorizationRule prepares the DeleteAuthorizationRule request. -func (c EventHubsClient) preparerForDeleteAuthorizationRule(ctx context.Context, id EventhubAuthorizationRuleId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDeleteAuthorizationRule handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (c EventHubsClient) responderForDeleteAuthorizationRule(resp *http.Response) (result DeleteAuthorizationRuleResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_get_autorest.go deleted file mode 100644 index ab0524efd08..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package eventhubs - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *Eventhub -} - -// Get ... -func (c EventHubsClient) Get(ctx context.Context, id EventhubId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c EventHubsClient) preparerForGet(ctx context.Context, id EventhubId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c EventHubsClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_getauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_getauthorizationrule_autorest.go deleted file mode 100644 index 586ec245cc6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_getauthorizationrule_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package eventhubs - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetAuthorizationRuleResponse struct { - HttpResponse *http.Response - Model *AuthorizationRule -} - -// GetAuthorizationRule ... -func (c EventHubsClient) GetAuthorizationRule(ctx context.Context, id EventhubAuthorizationRuleId) (result GetAuthorizationRuleResponse, err error) { - req, err := c.preparerForGetAuthorizationRule(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "GetAuthorizationRule", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetAuthorizationRule(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "GetAuthorizationRule", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetAuthorizationRule prepares the GetAuthorizationRule request. -func (c EventHubsClient) preparerForGetAuthorizationRule(ctx context.Context, id EventhubAuthorizationRuleId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetAuthorizationRule handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (c EventHubsClient) responderForGetAuthorizationRule(resp *http.Response) (result GetAuthorizationRuleResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_listbynamespace_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_listbynamespace_autorest.go deleted file mode 100644 index d205211dcfd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/method_listbynamespace_autorest.go +++ /dev/null @@ -1,210 +0,0 @@ -package eventhubs - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByNamespaceResponse struct { - HttpResponse *http.Response - Model *[]Eventhub - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByNamespaceResponse, error) -} - -type ListByNamespaceCompleteResult struct { - Items []Eventhub -} - -func (r ListByNamespaceResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByNamespaceResponse) LoadMore(ctx context.Context) (resp ListByNamespaceResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByNamespaceOptions struct { - Skip *int64 - Top *int64 -} - -func DefaultListByNamespaceOptions() ListByNamespaceOptions { - return ListByNamespaceOptions{} -} - -func (o ListByNamespaceOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Skip != nil { - out["$skip"] = *o.Skip - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByNamespace ... -func (c EventHubsClient) ListByNamespace(ctx context.Context, id NamespaceId, options ListByNamespaceOptions) (resp ListByNamespaceResponse, err error) { - req, err := c.preparerForListByNamespace(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "ListByNamespace", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "ListByNamespace", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByNamespace(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "ListByNamespace", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByNamespaceComplete retrieves all of the results into a single object -func (c EventHubsClient) ListByNamespaceComplete(ctx context.Context, id NamespaceId, options ListByNamespaceOptions) (ListByNamespaceCompleteResult, error) { - return c.ListByNamespaceCompleteMatchingPredicate(ctx, id, options, EventhubPredicate{}) -} - -// ListByNamespaceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c EventHubsClient) ListByNamespaceCompleteMatchingPredicate(ctx context.Context, id NamespaceId, options ListByNamespaceOptions, predicate EventhubPredicate) (resp ListByNamespaceCompleteResult, err error) { - items := make([]Eventhub, 0) - - page, err := c.ListByNamespace(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByNamespaceCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByNamespace prepares the ListByNamespace request. -func (c EventHubsClient) preparerForListByNamespace(ctx context.Context, id NamespaceId, options ListByNamespaceOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/eventhubs", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByNamespaceWithNextLink prepares the ListByNamespace request with the given nextLink token. -func (c EventHubsClient) preparerForListByNamespaceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByNamespace handles the response to the ListByNamespace request. The method always -// closes the http.Response Body. -func (c EventHubsClient) responderForListByNamespace(resp *http.Response) (result ListByNamespaceResponse, err error) { - type page struct { - Values []Eventhub `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByNamespaceResponse, err error) { - req, err := c.preparerForListByNamespaceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "ListByNamespace", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "ListByNamespace", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByNamespace(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "eventhubs.EventHubsClient", "ListByNamespace", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_authorizationrule.go deleted file mode 100644 index a2e17cad8ae..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_authorizationrule.go +++ /dev/null @@ -1,8 +0,0 @@ -package eventhubs - -type AuthorizationRule struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *AuthorizationRuleProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_authorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_authorizationruleproperties.go deleted file mode 100644 index eb70fc07f37..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_authorizationruleproperties.go +++ /dev/null @@ -1,5 +0,0 @@ -package eventhubs - -type AuthorizationRuleProperties struct { - Rights []AccessRights `json:"rights"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_destination.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_destination.go deleted file mode 100644 index 85aecab3eca..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_destination.go +++ /dev/null @@ -1,6 +0,0 @@ -package eventhubs - -type Destination struct { - Name *string `json:"name,omitempty"` - Properties *DestinationProperties `json:"properties,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_destinationproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_destinationproperties.go deleted file mode 100644 index 49eccb893e1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_destinationproperties.go +++ /dev/null @@ -1,7 +0,0 @@ -package eventhubs - -type DestinationProperties struct { - ArchiveNameFormat *string `json:"archiveNameFormat,omitempty"` - BlobContainer *string `json:"blobContainer,omitempty"` - StorageAccountResourceId *string `json:"storageAccountResourceId,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_eventhub.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_eventhub.go deleted file mode 100644 index cc9b2e315b9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_eventhub.go +++ /dev/null @@ -1,8 +0,0 @@ -package eventhubs - -type Eventhub struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *EventhubProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_eventhubproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_eventhubproperties.go deleted file mode 100644 index 39d3521f1fa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/model_eventhubproperties.go +++ /dev/null @@ -1,41 +0,0 @@ -package eventhubs - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type EventhubProperties struct { - CaptureDescription *CaptureDescription `json:"captureDescription,omitempty"` - CreatedAt *string `json:"createdAt,omitempty"` - MessageRetentionInDays *int64 `json:"messageRetentionInDays,omitempty"` - PartitionCount *int64 `json:"partitionCount,omitempty"` - PartitionIds *[]string `json:"partitionIds,omitempty"` - Status *EntityStatus `json:"status,omitempty"` - UpdatedAt *string `json:"updatedAt,omitempty"` -} - -func (o EventhubProperties) GetCreatedAtAsTime() (*time.Time, error) { - if o.CreatedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o EventhubProperties) SetCreatedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreatedAt = &formatted -} - -func (o EventhubProperties) GetUpdatedAtAsTime() (*time.Time, error) { - if o.UpdatedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.UpdatedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o EventhubProperties) SetUpdatedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.UpdatedAt = &formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/predicates.go deleted file mode 100644 index e2f3af236f9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/predicates.go +++ /dev/null @@ -1,24 +0,0 @@ -package eventhubs - -type EventhubPredicate struct { - Id *string - Name *string - Type *string -} - -func (p EventhubPredicate) Matches(input Eventhub) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/version.go deleted file mode 100644 index dffa4edabc3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package eventhubs - -import "fmt" - -const defaultApiVersion = "2017-04-01" - -func userAgent() string { - return fmt.Sprintf("pandora/eventhubs/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/client.go deleted file mode 100644 index 74371b44710..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package eventhubsclusters - -import "github.com/Azure/go-autorest/autorest" - -type EventHubsClustersClient struct { - Client autorest.Client - baseUri string -} - -func NewEventHubsClustersClientWithBaseURI(endpoint string) EventHubsClustersClient { - return EventHubsClustersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/constants.go deleted file mode 100644 index 82a548afa35..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/constants.go +++ /dev/null @@ -1,28 +0,0 @@ -package eventhubsclusters - -import "strings" - -type ClusterSkuName string - -const ( - ClusterSkuNameDedicated ClusterSkuName = "Dedicated" -) - -func PossibleValuesForClusterSkuName() []string { - return []string{ - string(ClusterSkuNameDedicated), - } -} - -func parseClusterSkuName(input string) (*ClusterSkuName, error) { - vals := map[string]ClusterSkuName{ - "dedicated": ClusterSkuNameDedicated, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ClusterSkuName(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/id_resourcegroup.go deleted file mode 100644 index dbfb8cb27e6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package eventhubsclusters - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/model_cluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/model_cluster.go deleted file mode 100644 index 260e1a04fa6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/model_cluster.go +++ /dev/null @@ -1,11 +0,0 @@ -package eventhubsclusters - -type Cluster struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *ClusterProperties `json:"properties,omitempty"` - Sku *ClusterSku `json:"sku,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/model_clusterproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/model_clusterproperties.go deleted file mode 100644 index 79c14743034..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/model_clusterproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package eventhubsclusters - -type ClusterProperties struct { - CreatedAt *string `json:"createdAt,omitempty"` - MetricId *string `json:"metricId,omitempty"` - Status *string `json:"status,omitempty"` - UpdatedAt *string `json:"updatedAt,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/model_clustersku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/model_clustersku.go deleted file mode 100644 index 49f86a76394..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/model_clustersku.go +++ /dev/null @@ -1,6 +0,0 @@ -package eventhubsclusters - -type ClusterSku struct { - Capacity *int64 `json:"capacity,omitempty"` - Name ClusterSkuName `json:"name"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/predicates.go deleted file mode 100644 index 3d0e5f3d74f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/predicates.go +++ /dev/null @@ -1,29 +0,0 @@ -package eventhubsclusters - -type ClusterPredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p ClusterPredicate) Matches(input Cluster) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/version.go deleted file mode 100644 index 530a3e235a1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package eventhubsclusters - -import "fmt" - -const defaultApiVersion = "2018-01-01-preview" - -func userAgent() string { - return fmt.Sprintf("pandora/eventhubsclusters/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/client.go deleted file mode 100644 index 99e6e3100f6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package networkrulesets - -import "github.com/Azure/go-autorest/autorest" - -type NetworkRuleSetsClient struct { - Client autorest.Client - baseUri string -} - -func NewNetworkRuleSetsClientWithBaseURI(endpoint string) NetworkRuleSetsClient { - return NetworkRuleSetsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/constants.go deleted file mode 100644 index 974b1b393d8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/constants.go +++ /dev/null @@ -1,56 +0,0 @@ -package networkrulesets - -import "strings" - -type DefaultAction string - -const ( - DefaultActionAllow DefaultAction = "Allow" - DefaultActionDeny DefaultAction = "Deny" -) - -func PossibleValuesForDefaultAction() []string { - return []string{ - string(DefaultActionAllow), - string(DefaultActionDeny), - } -} - -func parseDefaultAction(input string) (*DefaultAction, error) { - vals := map[string]DefaultAction{ - "allow": DefaultActionAllow, - "deny": DefaultActionDeny, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DefaultAction(input) - return &out, nil -} - -type NetworkRuleIPAction string - -const ( - NetworkRuleIPActionAllow NetworkRuleIPAction = "Allow" -) - -func PossibleValuesForNetworkRuleIPAction() []string { - return []string{ - string(NetworkRuleIPActionAllow), - } -} - -func parseNetworkRuleIPAction(input string) (*NetworkRuleIPAction, error) { - vals := map[string]NetworkRuleIPAction{ - "allow": NetworkRuleIPActionAllow, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := NetworkRuleIPAction(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/model_networkruleset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/model_networkruleset.go deleted file mode 100644 index 4bd3ec511b7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/model_networkruleset.go +++ /dev/null @@ -1,8 +0,0 @@ -package networkrulesets - -type NetworkRuleSet struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *NetworkRuleSetProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/model_networkrulesetproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/model_networkrulesetproperties.go deleted file mode 100644 index 790b249d172..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/model_networkrulesetproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package networkrulesets - -type NetworkRuleSetProperties struct { - DefaultAction *DefaultAction `json:"defaultAction,omitempty"` - IpRules *[]NWRuleSetIpRules `json:"ipRules,omitempty"` - TrustedServiceAccessEnabled *bool `json:"trustedServiceAccessEnabled,omitempty"` - VirtualNetworkRules *[]NWRuleSetVirtualNetworkRules `json:"virtualNetworkRules,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/model_nwrulesetiprules.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/model_nwrulesetiprules.go deleted file mode 100644 index 647113a5953..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/model_nwrulesetiprules.go +++ /dev/null @@ -1,6 +0,0 @@ -package networkrulesets - -type NWRuleSetIpRules struct { - Action *NetworkRuleIPAction `json:"action,omitempty"` - IpMask *string `json:"ipMask,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/model_nwrulesetvirtualnetworkrules.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/model_nwrulesetvirtualnetworkrules.go deleted file mode 100644 index 4f422a1e632..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/model_nwrulesetvirtualnetworkrules.go +++ /dev/null @@ -1,6 +0,0 @@ -package networkrulesets - -type NWRuleSetVirtualNetworkRules struct { - IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` - Subnet *Subnet `json:"subnet,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/model_subnet.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/model_subnet.go deleted file mode 100644 index efae9614982..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/model_subnet.go +++ /dev/null @@ -1,5 +0,0 @@ -package networkrulesets - -type Subnet struct { - Id *string `json:"id,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/version.go deleted file mode 100644 index 4ad3252eb7d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package networkrulesets - -import "fmt" - -const defaultApiVersion = "2018-01-01-preview" - -func userAgent() string { - return fmt.Sprintf("pandora/networkrulesets/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/client.go deleted file mode 100644 index ab1ab10a48e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package namespaces - -import "github.com/Azure/go-autorest/autorest" - -type NamespacesClient struct { - Client autorest.Client - baseUri string -} - -func NewNamespacesClientWithBaseURI(endpoint string) NamespacesClient { - return NamespacesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/constants.go deleted file mode 100644 index adc3d1e811b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/constants.go +++ /dev/null @@ -1,198 +0,0 @@ -package namespaces - -import "strings" - -type CreatedByType string - -const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" -) - -func PossibleValuesForCreatedByType() []string { - return []string{ - string(CreatedByTypeApplication), - string(CreatedByTypeKey), - string(CreatedByTypeManagedIdentity), - string(CreatedByTypeUser), - } -} - -func parseCreatedByType(input string) (*CreatedByType, error) { - vals := map[string]CreatedByType{ - "application": CreatedByTypeApplication, - "key": CreatedByTypeKey, - "managedidentity": CreatedByTypeManagedIdentity, - "user": CreatedByTypeUser, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CreatedByType(input) - return &out, nil -} - -type EndPointProvisioningState string - -const ( - EndPointProvisioningStateCanceled EndPointProvisioningState = "Canceled" - EndPointProvisioningStateCreating EndPointProvisioningState = "Creating" - EndPointProvisioningStateDeleting EndPointProvisioningState = "Deleting" - EndPointProvisioningStateFailed EndPointProvisioningState = "Failed" - EndPointProvisioningStateSucceeded EndPointProvisioningState = "Succeeded" - EndPointProvisioningStateUpdating EndPointProvisioningState = "Updating" -) - -func PossibleValuesForEndPointProvisioningState() []string { - return []string{ - string(EndPointProvisioningStateCanceled), - string(EndPointProvisioningStateCreating), - string(EndPointProvisioningStateDeleting), - string(EndPointProvisioningStateFailed), - string(EndPointProvisioningStateSucceeded), - string(EndPointProvisioningStateUpdating), - } -} - -func parseEndPointProvisioningState(input string) (*EndPointProvisioningState, error) { - vals := map[string]EndPointProvisioningState{ - "canceled": EndPointProvisioningStateCanceled, - "creating": EndPointProvisioningStateCreating, - "deleting": EndPointProvisioningStateDeleting, - "failed": EndPointProvisioningStateFailed, - "succeeded": EndPointProvisioningStateSucceeded, - "updating": EndPointProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndPointProvisioningState(input) - return &out, nil -} - -type KeySource string - -const ( - KeySourceMicrosoftPointKeyVault KeySource = "Microsoft.KeyVault" -) - -func PossibleValuesForKeySource() []string { - return []string{ - string(KeySourceMicrosoftPointKeyVault), - } -} - -func parseKeySource(input string) (*KeySource, error) { - vals := map[string]KeySource{ - "microsoft.keyvault": KeySourceMicrosoftPointKeyVault, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeySource(input) - return &out, nil -} - -type PrivateLinkConnectionStatus string - -const ( - PrivateLinkConnectionStatusApproved PrivateLinkConnectionStatus = "Approved" - PrivateLinkConnectionStatusDisconnected PrivateLinkConnectionStatus = "Disconnected" - PrivateLinkConnectionStatusPending PrivateLinkConnectionStatus = "Pending" - PrivateLinkConnectionStatusRejected PrivateLinkConnectionStatus = "Rejected" -) - -func PossibleValuesForPrivateLinkConnectionStatus() []string { - return []string{ - string(PrivateLinkConnectionStatusApproved), - string(PrivateLinkConnectionStatusDisconnected), - string(PrivateLinkConnectionStatusPending), - string(PrivateLinkConnectionStatusRejected), - } -} - -func parsePrivateLinkConnectionStatus(input string) (*PrivateLinkConnectionStatus, error) { - vals := map[string]PrivateLinkConnectionStatus{ - "approved": PrivateLinkConnectionStatusApproved, - "disconnected": PrivateLinkConnectionStatusDisconnected, - "pending": PrivateLinkConnectionStatusPending, - "rejected": PrivateLinkConnectionStatusRejected, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PrivateLinkConnectionStatus(input) - return &out, nil -} - -type SkuName string - -const ( - SkuNameBasic SkuName = "Basic" - SkuNamePremium SkuName = "Premium" - SkuNameStandard SkuName = "Standard" -) - -func PossibleValuesForSkuName() []string { - return []string{ - string(SkuNameBasic), - string(SkuNamePremium), - string(SkuNameStandard), - } -} - -func parseSkuName(input string) (*SkuName, error) { - vals := map[string]SkuName{ - "basic": SkuNameBasic, - "premium": SkuNamePremium, - "standard": SkuNameStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SkuName(input) - return &out, nil -} - -type SkuTier string - -const ( - SkuTierBasic SkuTier = "Basic" - SkuTierPremium SkuTier = "Premium" - SkuTierStandard SkuTier = "Standard" -) - -func PossibleValuesForSkuTier() []string { - return []string{ - string(SkuTierBasic), - string(SkuTierPremium), - string(SkuTierStandard), - } -} - -func parseSkuTier(input string) (*SkuTier, error) { - vals := map[string]SkuTier{ - "basic": SkuTierBasic, - "premium": SkuTierPremium, - "standard": SkuTierStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SkuTier(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/id_resourcegroup.go deleted file mode 100644 index 0e91beee7e9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package namespaces - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/id_subscription.go deleted file mode 100644 index 8ff94dcec8f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package namespaces - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_createorupdate_autorest.go deleted file mode 100644 index 360a19fe60e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_createorupdate_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package namespaces - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateOrUpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c NamespacesClient) CreateOrUpdate(ctx context.Context, id NamespaceId, input EHNamespace) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c NamespacesClient) CreateOrUpdateThenPoll(ctx context.Context, id NamespaceId, input EHNamespace) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c NamespacesClient) preparerForCreateOrUpdate(ctx context.Context, id NamespaceId, input EHNamespace) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c NamespacesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_delete_autorest.go deleted file mode 100644 index 65644e85c63..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_delete_autorest.go +++ /dev/null @@ -1,73 +0,0 @@ -package namespaces - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c NamespacesClient) Delete(ctx context.Context, id NamespaceId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c NamespacesClient) DeleteThenPoll(ctx context.Context, id NamespaceId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c NamespacesClient) preparerForDelete(ctx context.Context, id NamespaceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c NamespacesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_get_autorest.go deleted file mode 100644 index a7e3cb318fb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package namespaces - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *EHNamespace -} - -// Get ... -func (c NamespacesClient) Get(ctx context.Context, id NamespaceId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c NamespacesClient) preparerForGet(ctx context.Context, id NamespaceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c NamespacesClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_list_autorest.go deleted file mode 100644 index 8c1e28f165e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_list_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package namespaces - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListResponse struct { - HttpResponse *http.Response - Model *[]EHNamespace - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListResponse, error) -} - -type ListCompleteResult struct { - Items []EHNamespace -} - -func (r ListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListResponse) LoadMore(ctx context.Context) (resp ListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c NamespacesClient) List(ctx context.Context, id SubscriptionId) (resp ListResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c NamespacesClient) ListComplete(ctx context.Context, id SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, EHNamespacePredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c NamespacesClient) ListCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate EHNamespacePredicate) (resp ListCompleteResult, err error) { - items := make([]EHNamespace, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForList prepares the List request. -func (c NamespacesClient) preparerForList(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.EventHub/namespaces", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c NamespacesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c NamespacesClient) responderForList(resp *http.Response) (result ListResponse, err error) { - type page struct { - Values []EHNamespace `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_listbyresourcegroup_autorest.go deleted file mode 100644 index f588a41af77..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package namespaces - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *[]EHNamespace - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []EHNamespace -} - -func (r ListByResourceGroupResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c NamespacesClient) ListByResourceGroup(ctx context.Context, id ResourceGroupId) (resp ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c NamespacesClient) ListByResourceGroupComplete(ctx context.Context, id ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, EHNamespacePredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c NamespacesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate EHNamespacePredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]EHNamespace, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c NamespacesClient) preparerForListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.EventHub/namespaces", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c NamespacesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c NamespacesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - type page struct { - Values []EHNamespace `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_update_autorest.go deleted file mode 100644 index c96f80cec82..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/method_update_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package namespaces - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UpdateResponse struct { - HttpResponse *http.Response - Model *EHNamespace -} - -// Update ... -func (c NamespacesClient) Update(ctx context.Context, id NamespaceId, input EHNamespace) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c NamespacesClient) preparerForUpdate(ctx context.Context, id NamespaceId, input EHNamespace) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c NamespacesClient) responderForUpdate(resp *http.Response) (result UpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_connectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_connectionstate.go deleted file mode 100644 index 138fa820d91..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_connectionstate.go +++ /dev/null @@ -1,6 +0,0 @@ -package namespaces - -type ConnectionState struct { - Description *string `json:"description,omitempty"` - Status *PrivateLinkConnectionStatus `json:"status,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_ehnamespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_ehnamespace.go deleted file mode 100644 index 63d9468e975..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_ehnamespace.go +++ /dev/null @@ -1,17 +0,0 @@ -package namespaces - -import ( - "github.com/hashicorp/terraform-provider-azurerm/internal/identity" -) - -type EHNamespace struct { - Id *string `json:"id,omitempty"` - Identity *identity.SystemUserAssignedIdentityMap `json:"identity,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *EHNamespaceProperties `json:"properties,omitempty"` - Sku *Sku `json:"sku,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_ehnamespaceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_ehnamespaceproperties.go deleted file mode 100644 index 52f594bee66..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_ehnamespaceproperties.go +++ /dev/null @@ -1,47 +0,0 @@ -package namespaces - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type EHNamespaceProperties struct { - ClusterArmId *string `json:"clusterArmId,omitempty"` - CreatedAt *string `json:"createdAt,omitempty"` - Encryption *Encryption `json:"encryption,omitempty"` - IsAutoInflateEnabled *bool `json:"isAutoInflateEnabled,omitempty"` - KafkaEnabled *bool `json:"kafkaEnabled,omitempty"` - MaximumThroughputUnits *int64 `json:"maximumThroughputUnits,omitempty"` - MetricId *string `json:"metricId,omitempty"` - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` - Status *string `json:"status,omitempty"` - UpdatedAt *string `json:"updatedAt,omitempty"` - ZoneRedundant *bool `json:"zoneRedundant,omitempty"` -} - -func (o EHNamespaceProperties) GetCreatedAtAsTime() (*time.Time, error) { - if o.CreatedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o EHNamespaceProperties) SetCreatedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreatedAt = &formatted -} - -func (o EHNamespaceProperties) GetUpdatedAtAsTime() (*time.Time, error) { - if o.UpdatedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.UpdatedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o EHNamespaceProperties) SetUpdatedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.UpdatedAt = &formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_encryption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_encryption.go deleted file mode 100644 index b8aa488c824..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_encryption.go +++ /dev/null @@ -1,7 +0,0 @@ -package namespaces - -type Encryption struct { - KeySource *KeySource `json:"keySource,omitempty"` - KeyVaultProperties *[]KeyVaultProperties `json:"keyVaultProperties,omitempty"` - RequireInfrastructureEncryption *bool `json:"requireInfrastructureEncryption,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_keyvaultproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_keyvaultproperties.go deleted file mode 100644 index aa274eeb683..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_keyvaultproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package namespaces - -type KeyVaultProperties struct { - Identity *UserAssignedIdentityProperties `json:"identity,omitempty"` - KeyName *string `json:"keyName,omitempty"` - KeyVaultUri *string `json:"keyVaultUri,omitempty"` - KeyVersion *string `json:"keyVersion,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_privateendpoint.go deleted file mode 100644 index 6e300adf7f0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_privateendpoint.go +++ /dev/null @@ -1,5 +0,0 @@ -package namespaces - -type PrivateEndpoint struct { - Id *string `json:"id,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_privateendpointconnection.go deleted file mode 100644 index 55a3f4fa39c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_privateendpointconnection.go +++ /dev/null @@ -1,9 +0,0 @@ -package namespaces - -type PrivateEndpointConnection struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_privateendpointconnectionproperties.go deleted file mode 100644 index 2f78e08f298..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_privateendpointconnectionproperties.go +++ /dev/null @@ -1,7 +0,0 @@ -package namespaces - -type PrivateEndpointConnectionProperties struct { - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - PrivateLinkServiceConnectionState *ConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - ProvisioningState *EndPointProvisioningState `json:"provisioningState,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_sku.go deleted file mode 100644 index d1f192b45e8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_sku.go +++ /dev/null @@ -1,7 +0,0 @@ -package namespaces - -type Sku struct { - Capacity *int64 `json:"capacity,omitempty"` - Name SkuName `json:"name"` - Tier *SkuTier `json:"tier,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_systemdata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_systemdata.go deleted file mode 100644 index 8314b07ee5d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_systemdata.go +++ /dev/null @@ -1,40 +0,0 @@ -package namespaces - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type SystemData struct { - CreatedAt *string `json:"createdAt,omitempty"` - CreatedBy *string `json:"createdBy,omitempty"` - CreatedByType *CreatedByType `json:"createdByType,omitempty"` - LastModifiedAt *string `json:"lastModifiedAt,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` -} - -func (o SystemData) GetCreatedAtAsTime() (*time.Time, error) { - if o.CreatedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o SystemData) SetCreatedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreatedAt = &formatted -} - -func (o SystemData) GetLastModifiedAtAsTime() (*time.Time, error) { - if o.LastModifiedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModifiedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o SystemData) SetLastModifiedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModifiedAt = &formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_userassignedidentityproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_userassignedidentityproperties.go deleted file mode 100644 index fbd80f5128f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/model_userassignedidentityproperties.go +++ /dev/null @@ -1,5 +0,0 @@ -package namespaces - -type UserAssignedIdentityProperties struct { - UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/predicates.go deleted file mode 100644 index 423e93df0f0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/predicates.go +++ /dev/null @@ -1,29 +0,0 @@ -package namespaces - -type EHNamespacePredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p EHNamespacePredicate) Matches(input EHNamespace) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/version.go deleted file mode 100644 index cf70f01b0f2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package namespaces - -import "fmt" - -const defaultApiVersion = "2021-01-01-preview" - -func userAgent() string { - return fmt.Sprintf("pandora/namespaces/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate/eventhub_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate/eventhub_id.go deleted file mode 100644 index a0c31ed43fa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate/eventhub_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/parse" -) - -func EventhubID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.EventhubID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate/eventhub_names.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate/eventhub_names.go index ed1d5b01801..09c0fe01af2 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate/eventhub_names.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate/eventhub_names.go @@ -35,3 +35,10 @@ func ValidateEventHubAuthorizationRuleName() pluginsdk.SchemaValidateFunc { "The authorization rule name can contain only letters, numbers, periods, hyphens and underscores. The name must start and end with a letter or number and be up to 60 characters long.", ) } + +func ValidateSchemaGroupName() pluginsdk.SchemaValidateFunc { + return validation.StringMatch( + regexp.MustCompile("^[a-zA-Z0-9]([-._a-zA-Z0-9]{0,254}[a-zA-Z0-9])?$"), + "The schema group name can contain only letters, numbers, periods (.), hyphens (-),and underscores (_), up to 256 characters, and it must begin and end with a letter or number.", + ) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/firewall_policy_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/firewall_policy_resource.go index 3371a139224..73d701b42af 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/firewall_policy_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/firewall_policy_resource.go @@ -20,6 +20,7 @@ import ( logAnalytiscValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -98,6 +99,12 @@ func resourceFirewallPolicyCreateUpdate(d *pluginsdk.ResourceData, meta interfac } } + if v, ok := d.GetOk("sql_redirect_allowed"); ok { + props.FirewallPolicyPropertiesFormat.SQL = &network.FirewallPolicySQL{ + AllowSQLRedirect: utils.Bool(v.(bool)), + } + } + if v, ok := d.GetOk("private_ip_ranges"); ok { privateIPRanges := utils.ExpandStringSlice(v.([]interface{})) props.FirewallPolicyPropertiesFormat.Snat = &network.FirewallPolicySNAT{ @@ -198,6 +205,12 @@ func resourceFirewallPolicyRead(d *pluginsdk.ResourceData, meta interface{}) err if err := d.Set("insights", flattenFirewallPolicyInsights(prop.Insights)); err != nil { return fmt.Errorf(`setting "insights": %+v`, err) } + + if prop.SQL != nil && prop.SQL.AllowSQLRedirect != nil { + if err := d.Set("sql_redirect_allowed", prop.SQL.AllowSQLRedirect); err != nil { + return fmt.Errorf("setting `sql_redirect_allowed`: %+v", err) + } + } } flattenedIdentity, err := flattenFirewallPolicyIdentity(resp.Identity) @@ -258,7 +271,7 @@ func expandFirewallPolicyDNSSetting(input []interface{}) *network.DNSSettings { raw := input[0].(map[string]interface{}) output := &network.DNSSettings{ - Servers: utils.ExpandStringSlice(raw["servers"].(*pluginsdk.Set).List()), + Servers: utils.ExpandStringSlice(raw["servers"].([]interface{})), EnableProxy: utils.Bool(raw["proxy_enabled"].(bool)), } @@ -297,10 +310,16 @@ func expandFirewallPolicyIntrusionDetection(input []interface{}) *network.Firewa }) } + var privateRanges []string + for _, v := range raw["private_ranges"].([]interface{}) { + privateRanges = append(privateRanges, v.(string)) + } + return &network.FirewallPolicyIntrusionDetection{ Mode: network.FirewallPolicyIntrusionDetectionStateType(raw["mode"].(string)), Configuration: &network.FirewallPolicyIntrusionDetectionConfiguration{ SignatureOverrides: &signatureOverrides, + PrivateRanges: &privateRanges, BypassTrafficSettings: &trafficBypass, }, } @@ -460,12 +479,12 @@ func flattenFirewallPolicyIntrusionDetection(input *network.FirewallPolicyIntrus description = *bypass.Description } - sourceAddresses := make([]string, 0) + var sourceAddresses []string if bypass.SourceAddresses != nil { sourceAddresses = *bypass.SourceAddresses } - destinationAddresses := make([]string, 0) + var destinationAddresses []string if bypass.DestinationAddresses != nil { destinationAddresses = *bypass.DestinationAddresses } @@ -497,12 +516,17 @@ func flattenFirewallPolicyIntrusionDetection(input *network.FirewallPolicyIntrus }) } } + var privateRanges []string + if privates := input.Configuration.PrivateRanges; privates != nil { + privateRanges = *privates + } return []interface{}{ map[string]interface{}{ "mode": string(input.Mode), "signature_overrides": signatureOverrides, "traffic_bypass": trafficBypass, + "private_ranges": privateRanges, }, } } @@ -635,7 +659,7 @@ func resourceFirewallPolicySchema() map[string]*pluginsdk.Schema { Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "servers": { - Type: pluginsdk.TypeSet, + Type: pluginsdk.TypeList, Optional: true, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, @@ -727,6 +751,13 @@ func resourceFirewallPolicySchema() map[string]*pluginsdk.Schema { }, }, }, + "private_ranges": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, "traffic_bypass": { Type: pluginsdk.TypeList, Optional: true, @@ -743,12 +774,14 @@ func resourceFirewallPolicySchema() map[string]*pluginsdk.Schema { "protocol": { Type: pluginsdk.TypeString, Required: true, + // protocol to be one of [ICMP ANY TCP UDP] but response may be "Any" + DiffSuppressFunc: suppress.CaseDifference, ValidateFunc: validation.StringInSlice([]string{ string(network.FirewallPolicyIntrusionDetectionProtocolICMP), string(network.FirewallPolicyIntrusionDetectionProtocolANY), string(network.FirewallPolicyIntrusionDetectionProtocolTCP), string(network.FirewallPolicyIntrusionDetectionProtocolUDP), - }, false), + }, true), }, "source_addresses": { Type: pluginsdk.TypeSet, @@ -851,6 +884,11 @@ func resourceFirewallPolicySchema() map[string]*pluginsdk.Schema { }, }, + "sql_redirect_allowed": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + "child_policies": { Type: pluginsdk.TypeList, Computed: true, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/firewall_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/firewall_resource.go index 6624a11d54c..843cb7b0a5e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/firewall_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/firewall_resource.go @@ -6,14 +6,11 @@ import ( "strings" "time" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -77,7 +74,6 @@ func resourceFirewall() *pluginsdk.Resource { "sku_tier": { Type: pluginsdk.TypeString, Required: true, - ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ string(network.AzureFirewallSkuTierPremium), string(network.AzureFirewallSkuTierStandard), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/client/client.go new file mode 100644 index 00000000000..1e50ecfde85 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/client/client.go @@ -0,0 +1,19 @@ +package client + +import ( + servers "github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +type Client struct { + ServerClient *servers.FluidRelayServersClient +} + +func NewClient(o *common.ClientOptions) *Client { + serverClient := servers.NewFluidRelayServersClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&serverClient.Client, o.ResourceManagerAuthorizer) + + return &Client{ + ServerClient: &serverClient, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/fluid_relay_servers_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/fluid_relay_servers_resource.go new file mode 100644 index 00000000000..a413906a7bf --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/fluid_relay_servers_resource.go @@ -0,0 +1,271 @@ +package fluidrelay + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type ServerModel struct { + Name string `tfschema:"name"` + ResourceGroup string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + StorageSKU string `tfschema:"storage_sku"` + FrsTenantId string `tfschema:"frs_tenant_id"` + OrdererEndpoints []string `tfschema:"orderer_endpoints"` + StorageEndpoints []string `tfschema:"storage_endpoints"` + Tags map[string]string `tfschema:"tags"` + Identity []identity.ModelSystemAssignedUserAssigned `tfschema:"identity"` +} + +func (s *ServerModel) flattenIdentity(input *identity.SystemAndUserAssignedMap) error { + if input == nil { + return nil + } + config := identity.SystemAndUserAssignedMap{ + Type: input.Type, + PrincipalId: input.PrincipalId, + TenantId: input.TenantId, + IdentityIds: make(map[string]identity.UserAssignedIdentityDetails), + } + for k, v := range input.IdentityIds { + config.IdentityIds[k] = identity.UserAssignedIdentityDetails{ + ClientId: v.ClientId, + PrincipalId: v.PrincipalId, + } + } + model, err := identity.FlattenSystemAndUserAssignedMapToModel(&config) + if err != nil { + return err + } + s.Identity = *model + return nil +} + +type Server struct{} + +var _ sdk.ResourceWithUpdate = (*Server)(nil) + +func (s Server) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.FluidRelayServerName, + }, + "resource_group_name": commonschema.ResourceGroupName(), + "location": commonschema.Location(), + "tags": commonschema.Tags(), + "identity": commonschema.SystemAssignedUserAssignedIdentityOptional(), + "storage_sku": { + // todo remove computed when https://github.com/Azure/azure-rest-api-specs/issues/19700 is fixed + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(fluidrelayservers.PossibleValuesForStorageSKU(), false), + }, + } +} + +func (s Server) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "frs_tenant_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "orderer_endpoints": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "storage_endpoints": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + } +} + +func (s Server) ModelObject() interface{} { + return &ServerModel{} +} + +func (s Server) ResourceType() string { + return "azurerm_fluid_relay_server" +} + +func (s Server) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, meta sdk.ResourceMetaData) (err error) { + client := meta.Client.FluidRelay.ServerClient + + var model ServerModel + if err = meta.Decode(&model); err != nil { + return err + } + + subscriptionID := meta.Client.Account.SubscriptionId + id := fluidrelayservers.NewFluidRelayServerID(subscriptionID, model.ResourceGroup, model.Name) + + existing, err := client.Get(ctx, id) + if !response.WasNotFound(existing.HttpResponse) { + if err != nil { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + + return meta.ResourceRequiresImport(s.ResourceType(), id) + } + + serverReq := fluidrelayservers.FluidRelayServer{ + Location: azure.NormalizeLocation(model.Location), + Name: utils.String(model.Name), + } + if model.Tags != nil { + serverReq.Tags = &model.Tags + } + serverReq.Properties = &fluidrelayservers.FluidRelayServerProperties{} + serverReq.Identity, err = identity.ExpandSystemAndUserAssignedMapFromModel(model.Identity) + if err != nil { + return fmt.Errorf("expanding user identities: %+v", err) + } + + if model.StorageSKU != "" { + serverReq.Properties.Storagesku = (*fluidrelayservers.StorageSKU)(&model.StorageSKU) + } + _, err = client.CreateOrUpdate(ctx, id, serverReq) + if err != nil { + return fmt.Errorf("creating %v err: %+v", id, err) + } + meta.SetID(id) + + return nil + }, + } +} + +func (s Server) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 10 * time.Minute, + Func: func(ctx context.Context, meta sdk.ResourceMetaData) (err error) { + client := meta.Client.FluidRelay.ServerClient + id, err := fluidrelayservers.ParseFluidRelayServerID(meta.ResourceData.Id()) + if err != nil { + return err + } + + var model ServerModel + if err = meta.Decode(&model); err != nil { + return fmt.Errorf("decoding err: %+v", err) + } + + var upd fluidrelayservers.FluidRelayServerUpdate + if meta.ResourceData.HasChange("tags") { + upd.Tags = &model.Tags + } + if meta.ResourceData.HasChange("identity") { + upd.Identity, err = identity.ExpandSystemAndUserAssignedMapFromModel(model.Identity) + if err != nil { + return fmt.Errorf("expanding user identities: %+v", err) + } + } + if _, err = client.Update(ctx, *id, upd); err != nil { + return fmt.Errorf("updating %s: %v", id, err) + } + + return nil + }, + } +} + +func (s Server) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, meta sdk.ResourceMetaData) error { + client := meta.Client.FluidRelay.ServerClient + + id, err := fluidrelayservers.ParseFluidRelayServerID(meta.ResourceData.Id()) + if err != nil { + return err + } + + server, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %v", id, err) + } + + model := server.Model + + output := &ServerModel{ + Name: id.FluidRelayServerName, + ResourceGroup: id.ResourceGroup, + Location: location.Normalize(model.Location), + } + if err = output.flattenIdentity(model.Identity); err != nil { + return fmt.Errorf("flattening `identity`: %v", err) + } + if server.Model.Tags != nil { + output.Tags = *server.Model.Tags + } + if prop := model.Properties; prop != nil { + if prop.FrsTenantId != nil { + output.FrsTenantId = *prop.FrsTenantId + } + if points := prop.FluidRelayEndpoints; points != nil { + if points.OrdererEndpoints != nil { + output.OrdererEndpoints = *points.OrdererEndpoints + } + if points.StorageEndpoints != nil { + output.StorageEndpoints = *points.StorageEndpoints + } + } + } + if val, ok := meta.ResourceData.GetOk("storage_sku"); ok { + output.StorageSKU = val.(string) + } + return meta.Encode(output) + }, + } +} + +func (s Server) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 10 * time.Minute, + Func: func(ctx context.Context, meta sdk.ResourceMetaData) error { + client := meta.Client.FluidRelay.ServerClient + + id, err := fluidrelayservers.ParseFluidRelayServerID(meta.ResourceData.Id()) + if err != nil { + return err + } + + meta.Logger.Infof("deleting %s", id) + if _, err := client.Delete(ctx, *id); err != nil { + return fmt.Errorf("delete %s: %v", id, err) + } + return nil + }, + } +} + +func (s Server) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return fluidrelayservers.ValidateFluidRelayServerID +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/parse/fluid_relay.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/parse/fluid_relay.go new file mode 100644 index 00000000000..1a256fc789e --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/parse/fluid_relay.go @@ -0,0 +1,69 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type FluidRelayId struct { + SubscriptionId string + ResourceGroup string + FluidRelayServerName string +} + +func NewFluidRelayID(subscriptionId, resourceGroup, fluidRelayServerName string) FluidRelayId { + return FluidRelayId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + FluidRelayServerName: fluidRelayServerName, + } +} + +func (id FluidRelayId) String() string { + segments := []string{ + fmt.Sprintf("Fluid Relay Server Name %q", id.FluidRelayServerName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Fluid Relay", segmentsStr) +} + +func (id FluidRelayId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.FluidRelay/fluidRelayServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.FluidRelayServerName) +} + +// FluidRelayID parses a FluidRelay ID into an FluidRelayId struct +func FluidRelayID(input string) (*FluidRelayId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FluidRelayId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.FluidRelayServerName, err = id.PopSegment("fluidRelayServers"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/parse/fluid_relay_servers.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/parse/fluid_relay_servers.go new file mode 100644 index 00000000000..05a91ba4b37 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/parse/fluid_relay_servers.go @@ -0,0 +1,69 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type FluidRelayServersId struct { + SubscriptionId string + ResourceGroup string + FluidRelayServerName string +} + +func NewFluidRelayServersID(subscriptionId, resourceGroup, fluidRelayServerName string) FluidRelayServersId { + return FluidRelayServersId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + FluidRelayServerName: fluidRelayServerName, + } +} + +func (id FluidRelayServersId) String() string { + segments := []string{ + fmt.Sprintf("Fluid Relay Server Name %q", id.FluidRelayServerName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Fluid Relay Servers", segmentsStr) +} + +func (id FluidRelayServersId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.FluidRelay/fluidRelayServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.FluidRelayServerName) +} + +// FluidRelayServersID parses a FluidRelayServers ID into an FluidRelayServersId struct +func FluidRelayServersID(input string) (*FluidRelayServersId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := FluidRelayServersId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.FluidRelayServerName, err = id.PopSegment("fluidRelayServers"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/registration.go new file mode 100644 index 00000000000..1dc2cd1f83d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/registration.go @@ -0,0 +1,29 @@ +package fluidrelay + +import "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + +type Registration struct{} + +func (r Registration) Name() string { + return "Fluid Relay" +} + +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{} +} + +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + Server{}, + } +} + +func (r Registration) WebsiteCategories() []string { + return []string{ + "Fluid Relay", + } +} + +var ( + _ sdk.TypedServiceRegistration = (*Registration)(nil) +) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/resourceids.go new file mode 100644 index 00000000000..84a7525948a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/resourceids.go @@ -0,0 +1,4 @@ +package fluidrelay + +// Fluid Relay IDs +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=FluidRelayServers -id=/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.FluidRelay/fluidRelayServers/server1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/validate/fluid_relay_servers_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/validate/fluid_relay_servers_id.go new file mode 100644 index 00000000000..d4aedcc5f49 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/validate/fluid_relay_servers_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/parse" +) + +func FluidRelayServersID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.FluidRelayServersID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/validate/server_name.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/validate/server_name.go new file mode 100644 index 00000000000..10aebff9c1a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/validate/server_name.go @@ -0,0 +1,21 @@ +package validate + +import ( + "fmt" + "regexp" +) + +var serverNameReg = regexp.MustCompile(`^[-0-9a-zA-Z]{1,50}$`) + +func FluidRelayServerName(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + // Name should contain only alphanumeric characters and hyphens, up to 50 characters long. + if !serverNameReg.MatchString(v) { + errors = append(errors, fmt.Errorf("Name should contain only alphanumeric characters and hyphens, up to 50 characters long.")) + } + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/common_hdinsight.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/common_hdinsight.go index be369070aaf..c8e10689a6d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/common_hdinsight.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/common_hdinsight.go @@ -321,6 +321,17 @@ func createHDInsightEdgeNodes(ctx context.Context, client *hdinsight.Application ApplicationType: utils.String("CustomApplication"), }, } + + if v, ok := input["https_endpoints"]; ok { + httpsEndpoints := expandHDInsightApplicationEdgeNodeHttpsEndpoints(v.([]interface{})) + application.Properties.HTTPSEndpoints = httpsEndpoints + } + + if v, ok := input["uninstall_script_actions"]; ok { + uninstallScriptActions := expandHDInsightApplicationEdgeNodeUninstallScriptActions(v.([]interface{})) + application.Properties.UninstallScriptActions = uninstallScriptActions + } + future, err := client.Create(ctx, resourceGroup, name, name, application) if err != nil { return fmt.Errorf("creating edge nodes for HDInsight Hadoop Cluster %q (Resource Group %q): %+v", name, resourceGroup, err) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/hdinsight_hadoop_cluster_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/hdinsight_hadoop_cluster_resource.go index bfdaeef76df..8795e7bebf9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/hdinsight_hadoop_cluster_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/hdinsight_hadoop_cluster_resource.go @@ -153,9 +153,18 @@ func resourceHDInsightHadoopCluster() *pluginsdk.Resource { Required: true, ValidateFunc: validation.StringIsNotEmpty, }, + "parameters": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, }, }, }, + + "https_endpoints": SchemaHDInsightsHttpsEndpoints(), + + "uninstall_script_actions": SchemaHDInsightsScriptActions(), }, }, }, @@ -485,7 +494,30 @@ func flattenHDInsightEdgeNode(roles []interface{}, props *hdinsight.ApplicationP for _, action := range *installScriptActions { actions["name"] = action.Name actions["uri"] = action.URI + actions["parameters"] = action.Parameters + } + } + + if uninstallScriptActions := props.UninstallScriptActions; uninstallScriptActions != nil && len(*uninstallScriptActions) != 0 { + uninstallActions := make(map[string]interface{}) + for _, uninstallAction := range *uninstallScriptActions { + actions["name"] = uninstallAction.Name + actions["uri"] = uninstallAction.URI + actions["parameters"] = uninstallAction.Parameters + } + edgeNode["uninstall_script_actions"] = []interface{}{uninstallActions} + } + + if HTTPSEndpoints := props.HTTPSEndpoints; HTTPSEndpoints != nil && len(*HTTPSEndpoints) != 0 { + httpsEndpoints := make(map[string]interface{}) + for _, HTTPSEndpoint := range *HTTPSEndpoints { + httpsEndpoints["access_modes"] = HTTPSEndpoint.AccessModes + httpsEndpoints["destination_port"] = HTTPSEndpoint.DestinationPort + httpsEndpoints["disable_gateway_auth"] = HTTPSEndpoint.DisableGatewayAuth + httpsEndpoints["private_ip_address"] = HTTPSEndpoint.PrivateIPAddress + httpsEndpoints["sub_domain_suffix"] = HTTPSEndpoint.SubDomainSuffix } + edgeNode["https_endpoints"] = []interface{}{httpsEndpoints} } edgeNode["install_script_action"] = []interface{}{actions} @@ -524,12 +556,69 @@ func expandHDInsightApplicationEdgeNodeInstallScriptActions(input []interface{}) name := val["name"].(string) uri := val["uri"].(string) + parameters := val["parameters"].(string) action := hdinsight.RuntimeScriptAction{ Name: utils.String(name), URI: utils.String(uri), // The only role available for edge nodes is edgenode - Roles: &[]string{"edgenode"}, + Parameters: utils.String(parameters), + Roles: &[]string{"edgenode"}, + } + + actions = append(actions, action) + } + + return &actions +} + +func expandHDInsightApplicationEdgeNodeHttpsEndpoints(input []interface{}) *[]hdinsight.ApplicationGetHTTPSEndpoint { + endpoints := make([]hdinsight.ApplicationGetHTTPSEndpoint, 0) + if len(input) == 0 || input[0] == nil { + return &endpoints + } + + for _, v := range input { + val := v.(map[string]interface{}) + + accessModes := val["access_modes"].([]string) + destinationPort := val["destination_port"].(int32) + disableGatewayAuth := val["disable_gateway_auth"].(bool) + privateIpAddress := val["private_ip_address"].(string) + subDomainSuffix := val["sub_domain_suffix"].(string) + + endPoint := hdinsight.ApplicationGetHTTPSEndpoint{ + AccessModes: &accessModes, + DestinationPort: utils.Int32(destinationPort), + PrivateIPAddress: utils.String(privateIpAddress), + SubDomainSuffix: utils.String(subDomainSuffix), + DisableGatewayAuth: utils.Bool(disableGatewayAuth), + } + + endpoints = append(endpoints, endPoint) + } + + return &endpoints +} + +func expandHDInsightApplicationEdgeNodeUninstallScriptActions(input []interface{}) *[]hdinsight.RuntimeScriptAction { + actions := make([]hdinsight.RuntimeScriptAction, 0) + if len(input) == 0 || input[0] == nil { + return &actions + } + + for _, v := range input { + val := v.(map[string]interface{}) + + name := val["name"].(string) + uri := val["uri"].(string) + parameters := val["parameters"].(string) + + action := hdinsight.RuntimeScriptAction{ + Name: utils.String(name), + URI: utils.String(uri), + Parameters: utils.String(parameters), + Roles: &[]string{"edgenode"}, } actions = append(actions, action) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/hdinsight_kafka_cluster_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/hdinsight_kafka_cluster_resource.go index b7c8bb358ed..5d2e867f098 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/hdinsight_kafka_cluster_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/hdinsight_kafka_cluster_resource.go @@ -84,6 +84,8 @@ func resourceHDInsightKafkaCluster() *pluginsdk.Resource { "metastores": SchemaHDInsightsExternalMetastores(), + "network": SchemaHDInsightsNetwork(), + "component_version": { Type: pluginsdk.TypeList, Required: true, @@ -212,6 +214,9 @@ func resourceHDInsightKafkaClusterCreate(d *pluginsdk.ResourceData, meta interfa return fmt.Errorf("failure expanding `storage_account`: %s", err) } + networkPropertiesRaw := d.Get("network").([]interface{}) + networkProperties := ExpandHDInsightsNetwork(networkPropertiesRaw) + kafkaRoles := hdInsightRoleDefinition{ HeadNodeDef: hdInsightKafkaClusterHeadNodeDefinition, WorkerNodeDef: hdInsightKafkaClusterWorkerNodeDefinition, @@ -244,6 +249,7 @@ func resourceHDInsightKafkaClusterCreate(d *pluginsdk.ResourceData, meta interfa OsType: hdinsight.OSTypeLinux, ClusterVersion: utils.String(clusterVersion), MinSupportedTLSVersion: utils.String(tls), + NetworkProperties: networkProperties, ClusterDefinition: &hdinsight.ClusterDefinition{ Kind: utils.String("Kafka"), ComponentVersion: componentVersions, @@ -401,6 +407,12 @@ func resourceHDInsightKafkaClusterRead(d *pluginsdk.ResourceData, meta interface d.Set("encryption_in_transit_enabled", props.EncryptionInTransitProperties.IsEncryptionInTransitEnabled) } + if props.NetworkProperties != nil { + if err := d.Set("network", FlattenHDInsightsNetwork(props.NetworkProperties)); err != nil { + return fmt.Errorf("flatten `network`: %+v", err) + } + } + monitor, err := extensionsClient.GetMonitoringStatus(ctx, resourceGroup, name) if err != nil { return fmt.Errorf("failed reading monitor configuration for HDInsight Hadoop Cluster %q (Resource Group %q): %+v", name, resourceGroup, err) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/schema.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/schema.go index fd6064119d7..a2744fa690a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/schema.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/schema.go @@ -7,9 +7,10 @@ import ( "strings" "github.com/Azure/azure-sdk-for-go/services/hdinsight/mgmt/2018-06-01/hdinsight" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/validate" - msiValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -272,7 +273,7 @@ func SchemaHDInsightsSecurityProfile() *pluginsdk.Schema { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: msiValidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, "cluster_users_group_dns": { @@ -289,6 +290,86 @@ func SchemaHDInsightsSecurityProfile() *pluginsdk.Schema { } } +func SchemaHDInsightsScriptActions() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + ForceNew: true, + MinItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "uri": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.IsURLWithHTTPorHTTPS, + }, + + "parameters": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + } +} + +func SchemaHDInsightsHttpsEndpoints() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "access_modes": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + + "destination_port": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: azValidate.PortNumber, + }, + + "disable_gateway_auth": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + + "private_ip_address": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.IsIPAddress, + }, + + "sub_domain_suffix": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + } +} + +type HttpEndpointModel struct { + AccessModes []string `tfschema:"access_modes"` + DestinationPort int32 `tfschema:"destination_port"` + DisableGatewayAuth bool `tfschema:"disable_gateway_auth"` + PrivateIpAddress string `tfschema:"private_ip_address"` + SubDomainSuffix string `tfschema:"sub_domain_suffix"` +} + func ExpandHDInsightsConfigurations(input []interface{}) map[string]interface{} { vs := input[0].(map[string]interface{}) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hpccache/hpc_cache_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hpccache/hpc_cache_resource.go index 0f2d82efd73..90024cb556c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hpccache/hpc_cache_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hpccache/hpc_cache_resource.go @@ -9,6 +9,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2021-09-01/storagecache" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" @@ -18,7 +19,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/client" keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - msiparse "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/parse" resourcesClient "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/client" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -741,7 +741,7 @@ func flattenStorageCacheIdentity(input *storagecache.CacheIdentity) (*[]interfac if input != nil { identityIds := map[string]identity.UserAssignedIdentityDetails{} for id := range input.UserAssignedIdentities { - parsedId, err := msiparse.UserAssignedIdentityIDInsensitively(id) + parsedId, err := commonids.ParseUserAssignedIdentityIDInsensitively(id) if err != nil { return nil, err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/client/client.go index 13be95df60a..149cdeff681 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/client/client.go @@ -1,16 +1,16 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules" + "github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - DedicatedHsmClient *hardwaresecuritymodules.DedicatedHsmClient + DedicatedHsmClient *dedicatedhsms.DedicatedHsmsClient } func NewClient(o *common.ClientOptions) *Client { - dedicatedHsmClient := hardwaresecuritymodules.NewDedicatedHsmClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + dedicatedHsmClient := dedicatedhsms.NewDedicatedHsmsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&dedicatedHsmClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/dedicated_hardware_security_module_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/dedicated_hardware_security_module_resource.go index 29dee70cbf9..80a38f2d14f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/dedicated_hardware_security_module_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/dedicated_hardware_security_module_resource.go @@ -5,20 +5,17 @@ import ( "log" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" - + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" + "github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/validate" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -40,7 +37,7 @@ func resourceDedicatedHardwareSecurityModule() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DedicatedHardwareSecurityModuleID(id) + _, err := dedicatedhsms.ParseDedicatedHSMID(id) return err }), @@ -61,7 +58,7 @@ func resourceDedicatedHardwareSecurityModule() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(hardwaresecuritymodules.SafeNetLunaNetworkHSMA790), + string(dedicatedhsms.SkuNameSafeNetLunaNetworkHSMASevenNineZero), }, false), }, @@ -103,7 +100,7 @@ func resourceDedicatedHardwareSecurityModule() *pluginsdk.Resource { "zones": commonschema.ZonesMultipleOptionalForceNew(), - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -114,48 +111,44 @@ func resourceDedicatedHardwareSecurityModuleCreate(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewDedicatedHardwareSecurityModuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.DedicatedHSMName) + id := dedicatedhsms.NewDedicatedHSMID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + existing, err := client.DedicatedHsmGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_dedicated_hardware_security_module", id.ID()) } - parameters := hardwaresecuritymodules.DedicatedHsm{ - Location: utils.String(location.Normalize(d.Get("location").(string))), - DedicatedHsmProperties: &hardwaresecuritymodules.DedicatedHsmProperties{ + skuName := dedicatedhsms.SkuName(d.Get("sku_name").(string)) + parameters := dedicatedhsms.DedicatedHsm{ + Location: location.Normalize(d.Get("location").(string)), + Properties: dedicatedhsms.DedicatedHsmProperties{ NetworkProfile: expandDedicatedHsmNetworkProfile(d.Get("network_profile").([]interface{})), }, - Sku: &hardwaresecuritymodules.Sku{ - Name: hardwaresecuritymodules.Name(d.Get("sku_name").(string)), + Sku: dedicatedhsms.Sku{ + Name: &skuName, }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } if v, ok := d.GetOk("stamp_id"); ok { - parameters.DedicatedHsmProperties.StampID = utils.String(v.(string)) + parameters.Properties.StampId = utils.String(v.(string)) } if v, ok := d.GetOk("zones"); ok { - zones := zones.Expand(v.(*schema.Set).List()) + zones := zones.Expand(v.(*pluginsdk.Set).List()) if len(zones) > 0 { parameters.Zones = &zones } } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.DedicatedHSMName, parameters) - if err != nil { + if err := client.DedicatedHsmCreateOrUpdateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceDedicatedHardwareSecurityModuleRead(d, meta) } @@ -165,39 +158,48 @@ func resourceDedicatedHardwareSecurityModuleRead(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DedicatedHardwareSecurityModuleID(d.Id()) + id, err := dedicatedhsms.ParseDedicatedHSMID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.DedicatedHSMName) + resp, err := client.DedicatedHsmGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] Dedicated Hardware Security Module %q does not exist - removing from state", d.Id()) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s was not found - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Dedicate Hardware Security Module %q (Resource Group %q): %+v", id.DedicatedHSMName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.DedicatedHSMName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - d.Set("zones", zones.Flatten(resp.Zones)) + d.Set("name", id.Name) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + d.Set("zones", zones.Flatten(model.Zones)) + + props := model.Properties - if props := resp.DedicatedHsmProperties; props != nil { if err := d.Set("network_profile", flattenDedicatedHsmNetworkProfile(props.NetworkProfile)); err != nil { return fmt.Errorf("setting network_profile: %+v", err) } - d.Set("stamp_id", props.StampID) - } + d.Set("stamp_id", props.StampId) + + skuName := "" + if model.Sku.Name != nil { + skuName = string(*model.Sku.Name) + } + d.Set("sku_name", skuName) - if sku := resp.Sku; sku != nil { - d.Set("sku_name", sku.Name) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceDedicatedHardwareSecurityModuleUpdate(d *pluginsdk.ResourceData, meta interface{}) error { @@ -205,23 +207,18 @@ func resourceDedicatedHardwareSecurityModuleUpdate(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DedicatedHardwareSecurityModuleID(d.Id()) + id, err := dedicatedhsms.ParseDedicatedHSMID(d.Id()) if err != nil { return err } - parameters := hardwaresecuritymodules.DedicatedHsmPatchParameters{} + parameters := dedicatedhsms.DedicatedHsmPatchParameters{} if d.HasChange("tags") { parameters.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) } - future, err := client.Update(ctx, id.ResourceGroup, id.DedicatedHSMName, parameters) - if err != nil { - return fmt.Errorf("updating Dedicate Hardware Security Module %q (Resource Group %q): %+v", id.DedicatedHSMName, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting on updating future for Dedicate Hardware Security Module %q (Resource Group %q): %+v", id.DedicatedHSMName, id.ResourceGroup, err) + if err := client.DedicatedHsmUpdateThenPoll(ctx, *id, parameters); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } return resourceDedicatedHardwareSecurityModuleRead(d, meta) @@ -232,33 +229,28 @@ func resourceDedicatedHardwareSecurityModuleDelete(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DedicatedHardwareSecurityModuleID(d.Id()) + id, err := dedicatedhsms.ParseDedicatedHSMID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.DedicatedHSMName) - if err != nil { - return fmt.Errorf("deleting Dedicated Hardware Security Module %q (Resource Group %q): %+v", id.DedicatedHSMName, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting on deleting future for Dedicated Hardware Security Module %q (Resource Group %q): %+v", id.DedicatedHSMName, id.ResourceGroup, err) + if err := client.DedicatedHsmDeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } return nil } -func expandDedicatedHsmNetworkProfile(input []interface{}) *hardwaresecuritymodules.NetworkProfile { +func expandDedicatedHsmNetworkProfile(input []interface{}) *dedicatedhsms.NetworkProfile { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - result := hardwaresecuritymodules.NetworkProfile{ - Subnet: &hardwaresecuritymodules.APIEntityReference{ - ID: utils.String(v["subnet_id"].(string)), + result := dedicatedhsms.NetworkProfile{ + Subnet: &dedicatedhsms.ApiEntityReference{ + Id: utils.String(v["subnet_id"].(string)), }, NetworkInterfaces: expandDedicatedHsmNetworkInterfacePrivateIPAddresses(v["network_interface_private_ip_addresses"].(*pluginsdk.Set).List()), } @@ -266,30 +258,28 @@ func expandDedicatedHsmNetworkProfile(input []interface{}) *hardwaresecuritymodu return &result } -func expandDedicatedHsmNetworkInterfacePrivateIPAddresses(input []interface{}) *[]hardwaresecuritymodules.NetworkInterface { - results := make([]hardwaresecuritymodules.NetworkInterface, 0) +func expandDedicatedHsmNetworkInterfacePrivateIPAddresses(input []interface{}) *[]dedicatedhsms.NetworkInterface { + results := make([]dedicatedhsms.NetworkInterface, 0) for _, item := range input { if item != nil { - result := hardwaresecuritymodules.NetworkInterface{ + results = append(results, dedicatedhsms.NetworkInterface{ PrivateIPAddress: utils.String(item.(string)), - } - - results = append(results, result) + }) } } return &results } -func flattenDedicatedHsmNetworkProfile(input *hardwaresecuritymodules.NetworkProfile) []interface{} { +func flattenDedicatedHsmNetworkProfile(input *dedicatedhsms.NetworkProfile) []interface{} { if input == nil { return make([]interface{}, 0) } var subnetId string - if input.Subnet != nil && input.Subnet.ID != nil { - subnetId = *input.Subnet.ID + if input.Subnet != nil && input.Subnet.Id != nil { + subnetId = *input.Subnet.Id } return []interface{}{ @@ -300,7 +290,7 @@ func flattenDedicatedHsmNetworkProfile(input *hardwaresecuritymodules.NetworkPro } } -func flattenDedicatedHsmNetworkInterfacePrivateIPAddresses(input *[]hardwaresecuritymodules.NetworkInterface) []interface{} { +func flattenDedicatedHsmNetworkInterfacePrivateIPAddresses(input *[]dedicatedhsms.NetworkInterface) []interface{} { results := make([]interface{}, 0) if input == nil { return results diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/parse/dedicated_hardware_security_module.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/parse/dedicated_hardware_security_module.go deleted file mode 100644 index 1cf41b84c5b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/parse/dedicated_hardware_security_module.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DedicatedHardwareSecurityModuleId struct { - SubscriptionId string - ResourceGroup string - DedicatedHSMName string -} - -func NewDedicatedHardwareSecurityModuleID(subscriptionId, resourceGroup, dedicatedHSMName string) DedicatedHardwareSecurityModuleId { - return DedicatedHardwareSecurityModuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - DedicatedHSMName: dedicatedHSMName, - } -} - -func (id DedicatedHardwareSecurityModuleId) String() string { - segments := []string{ - fmt.Sprintf("Dedicated H S M Name %q", id.DedicatedHSMName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Dedicated Hardware Security Module", segmentsStr) -} - -func (id DedicatedHardwareSecurityModuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.DedicatedHSMName) -} - -// DedicatedHardwareSecurityModuleID parses a DedicatedHardwareSecurityModule ID into an DedicatedHardwareSecurityModuleId struct -func DedicatedHardwareSecurityModuleID(input string) (*DedicatedHardwareSecurityModuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DedicatedHardwareSecurityModuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.DedicatedHSMName, err = id.PopSegment("dedicatedHSMs"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/resourceids.go deleted file mode 100644 index 378ff1bd583..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/resourceids.go +++ /dev/null @@ -1,3 +0,0 @@ -package hsm - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DedicatedHardwareSecurityModule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/hsm1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/validate/dedicated_hardware_security_module_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/validate/dedicated_hardware_security_module_id.go deleted file mode 100644 index 25a4435b45c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/validate/dedicated_hardware_security_module_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/parse" -) - -func DedicatedHardwareSecurityModuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DedicatedHardwareSecurityModuleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/client/client.go index bcf18e846a6..efbb05496bf 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/client/client.go @@ -1,16 +1,16 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral" + "github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - AppsClient *iotcentral.AppsClient + AppsClient *apps.AppsClient } func NewClient(o *common.ClientOptions) *Client { - AppsClient := iotcentral.NewAppsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + AppsClient := apps.NewAppsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&AppsClient.Client, o.ResourceManagerAuthorizer) return &Client{ AppsClient: &AppsClient, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/iotcentral_application_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/iotcentral_application_resource.go index 498ffff71cb..dc80563e045 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/iotcentral_application_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/iotcentral_application_resource.go @@ -4,20 +4,20 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceIotCentralApplication() *pluginsdk.Resource { @@ -28,7 +28,7 @@ func resourceIotCentralApplication() *pluginsdk.Resource { Delete: resourceIotCentralAppDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ApplicationID(id) + _, err := apps.ParseIotAppID(id) return err }), @@ -73,12 +73,11 @@ func resourceIotCentralApplication() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(iotcentral.F1), - string(iotcentral.S1), - string(iotcentral.ST1), - string(iotcentral.ST2), + string(apps.AppSkuSTOne), + string(apps.AppSkuSTTwo), + string(apps.AppSkuSTZero), }, false), - Default: iotcentral.ST1, + Default: string(apps.AppSkuSTOne), }, "template": { Type: pluginsdk.TypeString, @@ -87,7 +86,7 @@ func resourceIotCentralApplication() *pluginsdk.Resource { ValidateFunc: validate.ApplicationTemplateName, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -98,61 +97,56 @@ func resourceIotCentralAppCreate(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - resourceGroup := d.Get("resource_group_name").(string) - - id := parse.NewApplicationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - existing, err := client.Get(ctx, resourceGroup, name) + id := apps.NewIotAppID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_iotcentral_application", id.ID()) } - resp, err := client.CheckNameAvailability(ctx, iotcentral.OperationInputs{ - Name: utils.String(name), - }) + inputs := apps.OperationInputs{ + Name: id.ResourceName, + } + + resp, err := client.CheckNameAvailability(ctx, commonids.NewSubscriptionID(id.SubscriptionId), inputs) if err != nil { - return fmt.Errorf("checking if the name %q was globally available: %+v", id.IoTAppName, err) + return fmt.Errorf("checking if the name %q was globally available: %+v", id.ResourceName, err) } - if !*resp.NameAvailable { - return fmt.Errorf("the name %q cannot be used. Reason: %q Message: %q", name, *resp.Reason, *resp.Message) + if model := resp.Model; model != nil { + if !*model.NameAvailable { + return fmt.Errorf("the name %q cannot be used. Reason: %q Message: %q", id.ResourceName, *model.Reason, *model.Message) + } } displayName := d.Get("display_name").(string) if displayName == "" { - displayName = name + displayName = id.ResourceGroupName } subdomain := d.Get("sub_domain").(string) template := d.Get("template").(string) - location := d.Get("location").(string) - app := iotcentral.App{ - AppProperties: &iotcentral.AppProperties{ + app := apps.App{ + Properties: &apps.AppProperties{ DisplayName: &displayName, Subdomain: &subdomain, Template: &template, }, - Sku: &iotcentral.AppSkuInfo{ - Name: iotcentral.AppSku(d.Get("sku").(string)), + Sku: apps.AppSkuInfo{ + Name: apps.AppSku(d.Get("sku").(string)), }, - Location: &location, + Location: d.Get("location").(string), Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.IoTAppName, app) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, app); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceIotCentralAppRead(d, meta) } @@ -162,33 +156,29 @@ func resourceIotCentralAppUpdate(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApplicationID(d.Id()) + id, err := apps.ParseIotAppID(d.Id()) if err != nil { return err } displayName := d.Get("display_name").(string) if displayName == "" { - displayName = id.IoTAppName + displayName = id.ResourceName } subdomain := d.Get("sub_domain").(string) template := d.Get("template").(string) - appPatch := iotcentral.AppPatch{ + appPatch := apps.AppPatch{ Tags: tags.Expand(d.Get("tags").(map[string]interface{})), - AppProperties: &iotcentral.AppProperties{ + Properties: &apps.AppProperties{ DisplayName: &displayName, Subdomain: &subdomain, Template: &template, }, } - future, err := client.Update(ctx, id.ResourceGroup, id.IoTAppName, appPatch) - if err != nil { - return fmt.Errorf("updating %s: %+v", *id, err) - } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the update of %s: %+v", *id, err) + if err := client.UpdateThenPoll(ctx, *id, appPatch); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) } return resourceIotCentralAppRead(d, meta) @@ -199,35 +189,40 @@ func resourceIotCentralAppRead(d *pluginsdk.ResourceData, meta interface{}) erro ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApplicationID(d.Id()) + id, err := apps.ParseIotAppID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.IoTAppName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.IoTAppName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.ResourceName) + d.Set("resource_group_name", id.ResourceGroupName) - if err := d.Set("sku", resp.Sku.Name); err != nil { - return fmt.Errorf("setting `sku`: %+v", err) - } + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + + d.Set("sku", model.Sku.Name) - if props := resp.AppProperties; props != nil { - d.Set("sub_domain", props.Subdomain) - d.Set("display_name", props.DisplayName) - d.Set("template", props.Template) + if props := model.Properties; props != nil { + d.Set("sub_domain", props.Subdomain) + d.Set("display_name", props.DisplayName) + d.Set("template", props.Template) + } + + if err = tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceIotCentralAppDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -235,19 +230,13 @@ func resourceIotCentralAppDelete(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ApplicationID(d.Id()) + id, err := apps.ParseIotAppID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.IoTAppName) - if err != nil { - if !response.WasNotFound(resp.Response()) { - return fmt.Errorf("deleting %s: %+v", *id, err) - } - } - if err := resp.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) + if err = client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/migration/application.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/migration/application.go index 850cfaa1dda..f9f7d088de2 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/migration/application.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/migration/application.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/parse" + "github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -68,7 +68,7 @@ func (ApplicationV0ToV1) Schema() map[string]*pluginsdk.Schema { func (ApplicationV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { oldId := rawState["id"].(string) - id, err := parse.ApplicationIDInsensitively(oldId) + id, err := apps.ParseIotAppIDInsensitively(oldId) if err != nil { return rawState, err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/parse/application.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/parse/application.go deleted file mode 100644 index 7ab13676950..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/parse/application.go +++ /dev/null @@ -1,113 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ApplicationId struct { - SubscriptionId string - ResourceGroup string - IoTAppName string -} - -func NewApplicationID(subscriptionId, resourceGroup, ioTAppName string) ApplicationId { - return ApplicationId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - IoTAppName: ioTAppName, - } -} - -func (id ApplicationId) String() string { - segments := []string{ - fmt.Sprintf("Io T App Name %q", id.IoTAppName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Application", segmentsStr) -} - -func (id ApplicationId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.IoTCentral/ioTApps/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.IoTAppName) -} - -// ApplicationID parses a Application ID into an ApplicationId struct -func ApplicationID(input string) (*ApplicationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ApplicationId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.IoTAppName, err = id.PopSegment("ioTApps"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// ApplicationIDInsensitively parses an Application ID into an ApplicationId struct, insensitively -// This should only be used to parse an ID for rewriting, the ApplicationID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func ApplicationIDInsensitively(input string) (*ApplicationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ApplicationId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'ioTApps' segment - ioTAppsKey := "ioTApps" - for key := range id.Path { - if strings.EqualFold(key, ioTAppsKey) { - ioTAppsKey = key - break - } - } - if resourceId.IoTAppName, err = id.PopSegment(ioTAppsKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/resourceids.go deleted file mode 100644 index 9d8c8b0c0ba..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/resourceids.go +++ /dev/null @@ -1,3 +0,0 @@ -package iotcentral - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Application -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.IoTCentral/ioTApps/app1 -rewrite=true diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/validate/application_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/validate/application_id.go deleted file mode 100644 index 12adfd3c40a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/validate/application_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/parse" -) - -func ApplicationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ApplicationID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_dps_certificate_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_dps_certificate_resource.go index 272657dfa48..70c03919839 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_dps_certificate_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_dps_certificate_resource.go @@ -58,6 +58,13 @@ func resourceIotHubDPSCertificate() *pluginsdk.Resource { ValidateFunc: validation.StringIsNotEmpty, Sensitive: true, }, + + "is_verified": { + Type: pluginsdk.TypeBool, + Optional: true, + ForceNew: true, + Default: false, + }, }, } } @@ -87,6 +94,10 @@ func resourceIotHubDPSCertificateCreateUpdate(d *pluginsdk.ResourceData, meta in Certificate: utils.String(d.Get("certificate_content").(string)), } + if d.Get("is_verified").(bool) { + certificate.IsVerified = utils.Bool(true) + } + if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ProvisioningServiceName, id.CertificateName, certificate, ""); err != nil { return fmt.Errorf("creating/updating IoT Device Provisioning Service Certificate %s: %+v", id.String(), err) } @@ -119,6 +130,13 @@ func resourceIotHubDPSCertificateRead(d *pluginsdk.ResourceData, meta interface{ d.Set("resource_group_name", id.ResourceGroup) d.Set("iot_dps_name", id.ProvisioningServiceName) // We are unable to set `certificate_content` since it is not returned from the API + if props := resp.Properties; props != nil { + isVerified := false + if props.IsVerified != nil { + isVerified = *props.IsVerified + } + d.Set("is_verified", isVerified) + } return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_eventhub_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_eventhub_resource.go index e1e73e62c69..89dd6297d56 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_eventhub_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_eventhub_resource.go @@ -7,6 +7,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-07-02/devices" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -14,7 +15,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/parse" iothubValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/validate" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -76,7 +76,7 @@ func resourceIothubEndpointEventHubSchema() map[string]*pluginsdk.Schema { "identity_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, ConflictsWith: []string{"connection_string"}, }, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_servicebus_queue_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_servicebus_queue_resource.go index d6ba08783b5..1d550c497ca 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_servicebus_queue_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_servicebus_queue_resource.go @@ -7,13 +7,13 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-07-02/devices" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/parse" iothubValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/validate" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -76,7 +76,7 @@ func resourceIothubEndpointServicebusQueue() map[string]*pluginsdk.Schema { "identity_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, ConflictsWith: []string{"connection_string"}, }, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_servicebus_topic_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_servicebus_topic_resource.go index 0e194d576e9..0744e707a3b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_servicebus_topic_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_servicebus_topic_resource.go @@ -7,13 +7,13 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-07-02/devices" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/parse" iothubValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/validate" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -76,7 +76,7 @@ func resourceIothubEndpointServicebusTopicSchema() map[string]*pluginsdk.Schema "identity_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, ConflictsWith: []string{"connection_string"}, }, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_storage_container_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_storage_container_resource.go index 0f79ef2985d..7820b2bbdcf 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_storage_container_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_endpoint_storage_container_resource.go @@ -7,13 +7,13 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-07-02/devices" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/parse" iothubValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/validate" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -104,7 +104,7 @@ func resourceIothubEndpointStorageContainerSchema() map[string]*pluginsdk.Schema "identity_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, ConflictsWith: []string{"connection_string"}, }, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_resource.go index c9830bd2b00..5dae7537133 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/iothub_resource.go @@ -10,6 +10,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-07-02/devices" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" @@ -20,7 +21,6 @@ import ( eventhubValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/parse" iothubValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/validate" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" servicebusValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -193,7 +193,7 @@ func resourceIotHub() *pluginsdk.Resource { "identity_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, "notifications": { Type: pluginsdk.TypeBool, @@ -259,7 +259,7 @@ func resourceIotHub() *pluginsdk.Resource { "identity_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, "endpoint_uri": { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iottimeseriesinsights/iot_time_series_insights_gen2_environment_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iottimeseriesinsights/iot_time_series_insights_gen2_environment_resource.go index a7575f9946d..92a259cc59c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iottimeseriesinsights/iot_time_series_insights_gen2_environment_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/iottimeseriesinsights/iot_time_series_insights_gen2_environment_resource.go @@ -67,7 +67,7 @@ func resourceIoTTimeSeriesInsightsGen2Environment() *pluginsdk.Resource { ValidateFunc: azValidate.ISO8601Duration, }, "id_properties": { - Type: pluginsdk.TypeSet, + Type: pluginsdk.TypeList, Required: true, ForceNew: true, Elem: &pluginsdk.Schema{ @@ -146,7 +146,7 @@ func resourceIoTTimeSeriesInsightsGen2EnvironmentCreateUpdate(d *pluginsdk.Resou Tags: tags.Expand(t), Sku: sku, Gen2EnvironmentCreationProperties: ×eriesinsights.Gen2EnvironmentCreationProperties{ - TimeSeriesIDProperties: expandIdProperties(d.Get("id_properties").(*pluginsdk.Set).List()), + TimeSeriesIDProperties: expandIdProperties(d.Get("id_properties").([]interface{})), StorageConfiguration: expandStorage(d.Get("storage").([]interface{})), }, } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/access_policy_schema.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/access_policy_schema.go index 1acef77aeb1..1c1b1c76f9a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/access_policy_schema.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/access_policy_schema.go @@ -58,6 +58,10 @@ func keyPermissions() []string { "Update", "Verify", "WrapKey", + "Release", + "Rotate", + "GetRotationPolicy", + "SetRotationPolicy", } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_access_policy_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_access_policy_data_source.go index 35d9486554a..e71f4ae0511 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_access_policy_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_access_policy_data_source.go @@ -4,7 +4,10 @@ import ( "strings" "time" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" + "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2021-10-01/keyvault" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" ) @@ -60,8 +63,44 @@ func dataSourceKeyVaultAccessPolicy() *pluginsdk.Resource { func dataSourceKeyVaultAccessPolicyRead(d *pluginsdk.ResourceData, _ interface{}) error { name := d.Get("name").(string) - templateManagementPermissions := map[string][]string{ - "key": { + templateManagementPermissions := map[string][]string{} + if features.FourPointOh() { + templateManagementPermissions["key"] = []string{ + azure.TitleCase(string(keyvault.KeyPermissionsGet)), + azure.TitleCase(string(keyvault.KeyPermissionsList)), + azure.TitleCase(string(keyvault.KeyPermissionsUpdate)), + azure.TitleCase(string(keyvault.KeyPermissionsCreate)), + azure.TitleCase(string(keyvault.KeyPermissionsImport)), + azure.TitleCase(string(keyvault.KeyPermissionsDelete)), + azure.TitleCase(string(keyvault.KeyPermissionsRecover)), + azure.TitleCase(string(keyvault.KeyPermissionsBackup)), + azure.TitleCase(string(keyvault.KeyPermissionsRestore)), + } + templateManagementPermissions["secret"] = []string{ + azure.TitleCase(string(keyvault.SecretPermissionsGet)), + azure.TitleCase(string(keyvault.SecretPermissionsList)), + azure.TitleCase(string(keyvault.SecretPermissionsSet)), + azure.TitleCase(string(keyvault.SecretPermissionsDelete)), + azure.TitleCase(string(keyvault.SecretPermissionsRecover)), + azure.TitleCase(string(keyvault.SecretPermissionsBackup)), + azure.TitleCase(string(keyvault.SecretPermissionsRestore)), + } + templateManagementPermissions["certificate"] = []string{ + azure.TitleCase(string(keyvault.CertificatePermissionsGet)), + azure.TitleCase(string(keyvault.CertificatePermissionsList)), + azure.TitleCase(string(keyvault.CertificatePermissionsUpdate)), + azure.TitleCase(string(keyvault.CertificatePermissionsCreate)), + azure.TitleCase(string(keyvault.CertificatePermissionsImport)), + azure.TitleCase(string(keyvault.CertificatePermissionsDelete)), + azure.TitleCase(string(keyvault.CertificatePermissionsManagecontacts)), + azure.TitleCase(string(keyvault.CertificatePermissionsManageissuers)), + azure.TitleCase(string(keyvault.CertificatePermissionsGetissuers)), + azure.TitleCase(string(keyvault.CertificatePermissionsListissuers)), + azure.TitleCase(string(keyvault.CertificatePermissionsSetissuers)), + azure.TitleCase(string(keyvault.CertificatePermissionsDeleteissuers)), + } + } else { + templateManagementPermissions["key"] = []string{ string(keyvault.KeyPermissionsGet), string(keyvault.KeyPermissionsList), string(keyvault.KeyPermissionsUpdate), @@ -71,8 +110,8 @@ func dataSourceKeyVaultAccessPolicyRead(d *pluginsdk.ResourceData, _ interface{} string(keyvault.KeyPermissionsRecover), string(keyvault.KeyPermissionsBackup), string(keyvault.KeyPermissionsRestore), - }, - "secret": { + } + templateManagementPermissions["secret"] = []string{ string(keyvault.SecretPermissionsGet), string(keyvault.SecretPermissionsList), string(keyvault.SecretPermissionsSet), @@ -80,8 +119,8 @@ func dataSourceKeyVaultAccessPolicyRead(d *pluginsdk.ResourceData, _ interface{} string(keyvault.SecretPermissionsRecover), string(keyvault.SecretPermissionsBackup), string(keyvault.SecretPermissionsRestore), - }, - "certificate": { + } + templateManagementPermissions["certificate"] = []string{ string(keyvault.CertificatePermissionsGet), string(keyvault.CertificatePermissionsList), string(keyvault.CertificatePermissionsUpdate), @@ -94,7 +133,7 @@ func dataSourceKeyVaultAccessPolicyRead(d *pluginsdk.ResourceData, _ interface{} string(keyvault.CertificatePermissionsListissuers), string(keyvault.CertificatePermissionsSetissuers), string(keyvault.CertificatePermissionsDeleteissuers), - }, + } } d.SetId(name) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_access_policy_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_access_policy_resource.go index 41d4f29a62c..5353bc9bfb4 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_access_policy_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_access_policy_resource.go @@ -7,14 +7,13 @@ import ( "strings" "time" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" - "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2021-10-01/keyvault" "github.com/gofrs/uuid" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_certificate_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_certificate_data_source.go index a31aa2a3226..ba50254e577 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_certificate_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_certificate_data_source.go @@ -23,7 +23,8 @@ func dataSourceKeyVaultCertificate() *pluginsdk.Resource { Read: dataSourceKeyVaultCertificateRead, Timeouts: &pluginsdk.ResourceTimeout{ - Read: pluginsdk.DefaultTimeout(5 * time.Minute), + // TODO: Change this back to 5min, once https://github.com/hashicorp/terraform-provider-azurerm/issues/11059 is addressed. + Read: pluginsdk.DefaultTimeout(30 * time.Minute), }, Schema: map[string]*pluginsdk.Schema{ diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_certificate_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_certificate_resource.go index 9bd94e2ebea..81a987cfbd1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_certificate_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_certificate_resource.go @@ -41,7 +41,8 @@ func resourceKeyVaultCertificate() *pluginsdk.Resource { Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(60 * time.Minute), - Read: pluginsdk.DefaultTimeout(5 * time.Minute), + // TODO: Change this back to 5min, once https://github.com/hashicorp/terraform-provider-azurerm/issues/11059 is addressed. + Read: pluginsdk.DefaultTimeout(30 * time.Minute), Delete: pluginsdk.DefaultTimeout(30 * time.Minute), Update: pluginsdk.DefaultTimeout(30 * time.Minute), }, @@ -461,8 +462,14 @@ func resourceKeyVaultCertificateCreate(d *pluginsdk.ResourceData, meta interface CertificatePolicy: policy, Tags: tags.Expand(t), } - if _, err := client.ImportCertificate(ctx, *keyVaultBaseUrl, name, importParameters); err != nil { - return err + if resp, err := client.ImportCertificate(ctx, *keyVaultBaseUrl, name, importParameters); err != nil { + if meta.(*clients.Client).Features.KeyVault.RecoverSoftDeletedCerts && utils.ResponseWasConflict(resp.Response) { + if err = recoverDeletedCertificate(ctx, d, meta, *keyVaultBaseUrl, name); err != nil { + return err + } + } else { + return err + } } } else { // Generate new @@ -472,27 +479,9 @@ func resourceKeyVaultCertificateCreate(d *pluginsdk.ResourceData, meta interface } if resp, err := client.CreateCertificate(ctx, *keyVaultBaseUrl, name, parameters); err != nil { if meta.(*clients.Client).Features.KeyVault.RecoverSoftDeletedCerts && utils.ResponseWasConflict(resp.Response) { - recoveredCertificate, err := client.RecoverDeletedCertificate(ctx, *keyVaultBaseUrl, name) - if err != nil { + if err = recoverDeletedCertificate(ctx, d, meta, *keyVaultBaseUrl, name); err != nil { return err } - log.Printf("[DEBUG] Recovering Secret %q with ID: %q", name, *recoveredCertificate.ID) - if certificate := recoveredCertificate.ID; certificate != nil { - stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{"pending"}, - Target: []string{"available"}, - Refresh: keyVaultChildItemRefreshFunc(*certificate), - Delay: 30 * time.Second, - PollInterval: 10 * time.Second, - ContinuousTargetOccurence: 10, - Timeout: d.Timeout(pluginsdk.TimeoutCreate), - } - - if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for Key Vault Secret %q to become available: %s", name, err) - } - log.Printf("[DEBUG] Secret %q recovered with ID: %q", name, *recoveredCertificate.ID) - } } else { return err } @@ -529,6 +518,32 @@ func resourceKeyVaultCertificateCreate(d *pluginsdk.ResourceData, meta interface return resourceKeyVaultCertificateRead(d, meta) } +func recoverDeletedCertificate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}, keyVaultBaseUrl string, name string) error { + client := meta.(*clients.Client).KeyVault.ManagementClient + recoveredCertificate, err := client.RecoverDeletedCertificate(ctx, keyVaultBaseUrl, name) + if err != nil { + return err + } + log.Printf("[DEBUG] Recovering Secret %q with ID: %q", name, *recoveredCertificate.ID) + if certificate := recoveredCertificate.ID; certificate != nil { + stateConf := &pluginsdk.StateChangeConf{ + Pending: []string{"pending"}, + Target: []string{"available"}, + Refresh: keyVaultChildItemRefreshFunc(*certificate), + Delay: 30 * time.Second, + PollInterval: 10 * time.Second, + ContinuousTargetOccurence: 10, + Timeout: d.Timeout(pluginsdk.TimeoutCreate), + } + + if _, err := stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for Key Vault Secret %q to become available: %s", name, err) + } + log.Printf("[DEBUG] Secret %q recovered with ID: %q", name, *recoveredCertificate.ID) + } + return nil +} + func resourceKeyVaultCertificateUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*clients.Client).KeyVault.ManagementClient ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_data_source.go index a8cd44e76f7..ad03262f124 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_data_source.go @@ -155,6 +155,11 @@ func dataSourceKeyVault() *pluginsdk.Resource { Computed: true, }, + "public_network_access_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + "tags": tags.SchemaDataSource(), }, } @@ -190,7 +195,14 @@ func dataSourceKeyVaultRead(d *pluginsdk.ResourceData, meta interface{}) error { d.Set("enabled_for_template_deployment", props.EnabledForTemplateDeployment) d.Set("enable_rbac_authorization", props.EnableRbacAuthorization) d.Set("purge_protection_enabled", props.EnablePurgeProtection) + if v := props.PublicNetworkAccess; v != nil { + d.Set("public_network_access_enabled", *v == "Enabled") + } + d.Set("vault_uri", props.VaultURI) + if props.VaultURI != nil { + meta.(*clients.Client).KeyVault.AddToCache(id, *resp.Properties.VaultURI) + } if sku := props.Sku; sku != nil { if err := d.Set("sku_name", string(sku.Name)); err != nil { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_key_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_key_data_source.go index 663bbfb0251..40fb020bcdb 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_key_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_key_data_source.go @@ -24,7 +24,8 @@ func dataSourceKeyVaultKey() *pluginsdk.Resource { Read: dataSourceKeyVaultKeyRead, Timeouts: &pluginsdk.ResourceTimeout{ - Read: pluginsdk.DefaultTimeout(5 * time.Minute), + // TODO: Change this back to 5min, once https://github.com/hashicorp/terraform-provider-azurerm/issues/11059 is addressed. + Read: pluginsdk.DefaultTimeout(30 * time.Minute), }, Schema: map[string]*pluginsdk.Schema{ @@ -103,6 +104,16 @@ func dataSourceKeyVaultKey() *pluginsdk.Resource { Computed: true, }, + "resource_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "resource_versionless_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "tags": tags.SchemaDataSource(), }, } @@ -210,6 +221,9 @@ func dataSourceKeyVaultKeyRead(d *pluginsdk.ResourceData, meta interface{}) erro d.Set("version", parsedId.Version) + d.Set("resource_id", parse.NewKeyID(keyVaultId.SubscriptionId, keyVaultId.ResourceGroup, keyVaultId.Name, parsedId.Name, parsedId.Version).ID()) + d.Set("resource_versionless_id", parse.NewKeyVersionlessID(keyVaultId.SubscriptionId, keyVaultId.ResourceGroup, keyVaultId.Name, parsedId.Name).ID()) + return tags.FlattenAndSet(d, resp.Tags) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_key_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_key_resource.go index 8ed07944305..149d0baa0fe 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_key_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_key_resource.go @@ -42,7 +42,8 @@ func resourceKeyVaultKey() *pluginsdk.Resource { Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), - Read: pluginsdk.DefaultTimeout(5 * time.Minute), + // TODO: Change this back to 5min, once https://github.com/hashicorp/terraform-provider-azurerm/issues/11059 is addressed. + Read: pluginsdk.DefaultTimeout(30 * time.Minute), Update: pluginsdk.DefaultTimeout(30 * time.Minute), Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, @@ -179,6 +180,16 @@ func resourceKeyVaultKey() *pluginsdk.Resource { Computed: true, }, + "resource_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "resource_versionless_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "tags": tags.Schema(), }, } @@ -492,6 +503,9 @@ func resourceKeyVaultKeyRead(d *pluginsdk.ResourceData, meta interface{}) error } } + d.Set("resource_id", parse.NewKeyID(keyVaultId.SubscriptionId, keyVaultId.ResourceGroup, keyVaultId.Name, id.Name, id.Version).ID()) + d.Set("resource_versionless_id", parse.NewKeyVersionlessID(keyVaultId.SubscriptionId, keyVaultId.ResourceGroup, keyVaultId.Name, id.Name).ID()) + return tags.FlattenAndSet(d, resp.Tags) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_resource.go index ec544e1bfea..758dbf1985c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_resource.go @@ -187,6 +187,12 @@ func resourceKeyVault() *pluginsdk.Resource { }, }, + "public_network_access_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + "purge_protection_enabled": { Type: pluginsdk.TypeBool, Optional: true, @@ -317,6 +323,12 @@ func resourceKeyVaultCreate(d *pluginsdk.ResourceData, meta interface{}) error { Tags: tags.Expand(t), } + if d.Get("public_network_access_enabled").(bool) { + parameters.Properties.PublicNetworkAccess = utils.String("Enabled") + } else { + parameters.Properties.PublicNetworkAccess = utils.String("Disabled") + } + if purgeProtectionEnabled := d.Get("purge_protection_enabled").(bool); purgeProtectionEnabled { parameters.Properties.EnablePurgeProtection = utils.Bool(purgeProtectionEnabled) } @@ -514,6 +526,25 @@ func resourceKeyVaultUpdate(d *pluginsdk.ResourceData, meta interface{}) error { } update.Properties.EnablePurgeProtection = utils.Bool(newValue) + + if newValue { + // When the KV was created with a version prior to v2.42 and the `soft_delete_enabled` is set to false, setting `purge_protection_enabled` to `true` would not work when updating KV with v2.42 or later of terraform provider. + // This is because the `purge_protection_enabled` only works when soft delete is enabled. + // Since version v2.42 of the Azure Provider and later force the value of `soft_delete_enabled` to be true, we should set `EnableSoftDelete` to true when `purge_protection_enabled` is enabled to make sure it works in this case. + update.Properties.EnableSoftDelete = utils.Bool(true) + } + } + + if d.HasChange("public_network_access_enabled") { + if update.Properties == nil { + update.Properties = &keyvault.VaultPatchProperties{} + } + + if d.Get("public_network_access_enabled").(bool) { + update.Properties.PublicNetworkAccess = utils.String("Enabled") + } else { + update.Properties.PublicNetworkAccess = utils.String("Disabled") + } } if d.HasChange("sku_name") { @@ -631,6 +662,9 @@ func resourceKeyVaultRead(d *pluginsdk.ResourceData, meta interface{}) error { d.Set("enabled_for_template_deployment", props.EnabledForTemplateDeployment) d.Set("enable_rbac_authorization", props.EnableRbacAuthorization) d.Set("purge_protection_enabled", props.EnablePurgeProtection) + if v := props.PublicNetworkAccess; v != nil { + d.Set("public_network_access_enabled", *v == "Enabled") + } d.Set("vault_uri", props.VaultURI) // @tombuildsstuff: the API doesn't return this field if it's not configured diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_secret_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_secret_data_source.go index da2264444f9..45eae2cb926 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_secret_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_secret_data_source.go @@ -18,7 +18,8 @@ func dataSourceKeyVaultSecret() *pluginsdk.Resource { Read: dataSourceKeyVaultSecretRead, Timeouts: &pluginsdk.ResourceTimeout{ - Read: pluginsdk.DefaultTimeout(5 * time.Minute), + // TODO: Change this back to 5min, once https://github.com/hashicorp/terraform-provider-azurerm/issues/11059 is addressed. + Read: pluginsdk.DefaultTimeout(30 * time.Minute), }, Schema: map[string]*pluginsdk.Schema{ @@ -55,6 +56,16 @@ func dataSourceKeyVaultSecret() *pluginsdk.Resource { Computed: true, }, + "resource_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "resource_versionless_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "tags": tags.SchemaDataSource(), }, } @@ -101,5 +112,8 @@ func dataSourceKeyVaultSecretRead(d *pluginsdk.ResourceData, meta interface{}) e d.Set("content_type", resp.ContentType) d.Set("versionless_id", respID.VersionlessID()) + d.Set("resource_id", parse.NewSecretID(keyVaultId.SubscriptionId, keyVaultId.ResourceGroup, keyVaultId.Name, respID.Name, respID.Version).ID()) + d.Set("resource_versionless_id", parse.NewSecretVersionlessID(keyVaultId.SubscriptionId, keyVaultId.ResourceGroup, keyVaultId.Name, respID.Name).ID()) + return tags.FlattenAndSet(d, resp.Tags) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_secret_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_secret_resource.go index ef3bedd7e4c..73412443bb5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_secret_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/key_vault_secret_resource.go @@ -33,7 +33,8 @@ func resourceKeyVaultSecret() *pluginsdk.Resource { Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), - Read: pluginsdk.DefaultTimeout(5 * time.Minute), + // TODO: Change this back to 5min, once https://github.com/hashicorp/terraform-provider-azurerm/issues/11059 is addressed. + Read: pluginsdk.DefaultTimeout(30 * time.Minute), Update: pluginsdk.DefaultTimeout(30 * time.Minute), Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, @@ -86,6 +87,16 @@ func resourceKeyVaultSecret() *pluginsdk.Resource { Computed: true, }, + "resource_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "resource_versionless_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "tags": tags.SchemaWithMax(15), }, } @@ -358,6 +369,9 @@ func resourceKeyVaultSecretRead(d *pluginsdk.ResourceData, meta interface{}) err } } + d.Set("resource_id", parse.NewSecretID(keyVaultId.SubscriptionId, keyVaultId.ResourceGroup, keyVaultId.Name, id.Name, id.Version).ID()) + d.Set("resource_versionless_id", parse.NewSecretVersionlessID(keyVaultId.SubscriptionId, keyVaultId.ResourceGroup, keyVaultId.Name, id.Name).ID()) + return tags.FlattenAndSet(d, resp.Tags) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/migration/key_vault.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/migration/key_vault.go index 5bad96d4357..fcbf648f1a0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/migration/key_vault.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/migration/key_vault.go @@ -184,6 +184,10 @@ func (KeyVaultV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { outputKeyPermissions = append(outputKeyPermissions, "update") outputKeyPermissions = append(outputKeyPermissions, "verify") outputKeyPermissions = append(outputKeyPermissions, "wrapKey") + outputKeyPermissions = append(outputKeyPermissions, "release") + outputKeyPermissions = append(outputKeyPermissions, "rotate") + outputKeyPermissions = append(outputKeyPermissions, "getRotationPolicy") + outputKeyPermissions = append(outputKeyPermissions, "setRotationPolicy") break } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse/key.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse/key.go new file mode 100644 index 00000000000..52bc2ab4196 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse/key.go @@ -0,0 +1,81 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type KeyId struct { + SubscriptionId string + ResourceGroup string + VaultName string + Name string + VersionName string +} + +func NewKeyID(subscriptionId, resourceGroup, vaultName, name, versionName string) KeyId { + return KeyId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + VaultName: vaultName, + Name: name, + VersionName: versionName, + } +} + +func (id KeyId) String() string { + segments := []string{ + fmt.Sprintf("Version Name %q", id.VersionName), + fmt.Sprintf("Name %q", id.Name), + fmt.Sprintf("Vault Name %q", id.VaultName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Key", segmentsStr) +} + +func (id KeyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.KeyVault/vaults/%s/keys/%s/versions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.VaultName, id.Name, id.VersionName) +} + +// KeyID parses a Key ID into an KeyId struct +func KeyID(input string) (*KeyId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := KeyId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.VaultName, err = id.PopSegment("vaults"); err != nil { + return nil, err + } + if resourceId.Name, err = id.PopSegment("keys"); err != nil { + return nil, err + } + if resourceId.VersionName, err = id.PopSegment("versions"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse/key_versionless.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse/key_versionless.go new file mode 100644 index 00000000000..67bc90b57ea --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse/key_versionless.go @@ -0,0 +1,75 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type KeyVersionlessId struct { + SubscriptionId string + ResourceGroup string + VaultName string + KeyName string +} + +func NewKeyVersionlessID(subscriptionId, resourceGroup, vaultName, keyName string) KeyVersionlessId { + return KeyVersionlessId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + VaultName: vaultName, + KeyName: keyName, + } +} + +func (id KeyVersionlessId) String() string { + segments := []string{ + fmt.Sprintf("Key Name %q", id.KeyName), + fmt.Sprintf("Vault Name %q", id.VaultName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Key Versionless", segmentsStr) +} + +func (id KeyVersionlessId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.KeyVault/vaults/%s/keys/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.VaultName, id.KeyName) +} + +// KeyVersionlessID parses a KeyVersionless ID into an KeyVersionlessId struct +func KeyVersionlessID(input string) (*KeyVersionlessId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := KeyVersionlessId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.VaultName, err = id.PopSegment("vaults"); err != nil { + return nil, err + } + if resourceId.KeyName, err = id.PopSegment("keys"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse/secret.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse/secret.go new file mode 100644 index 00000000000..db4abcf0867 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse/secret.go @@ -0,0 +1,81 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type SecretId struct { + SubscriptionId string + ResourceGroup string + VaultName string + Name string + VersionName string +} + +func NewSecretID(subscriptionId, resourceGroup, vaultName, name, versionName string) SecretId { + return SecretId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + VaultName: vaultName, + Name: name, + VersionName: versionName, + } +} + +func (id SecretId) String() string { + segments := []string{ + fmt.Sprintf("Version Name %q", id.VersionName), + fmt.Sprintf("Name %q", id.Name), + fmt.Sprintf("Vault Name %q", id.VaultName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Secret", segmentsStr) +} + +func (id SecretId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.KeyVault/vaults/%s/secrets/%s/versions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.VaultName, id.Name, id.VersionName) +} + +// SecretID parses a Secret ID into an SecretId struct +func SecretID(input string) (*SecretId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := SecretId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.VaultName, err = id.PopSegment("vaults"); err != nil { + return nil, err + } + if resourceId.Name, err = id.PopSegment("secrets"); err != nil { + return nil, err + } + if resourceId.VersionName, err = id.PopSegment("versions"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse/secret_versionless.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse/secret_versionless.go new file mode 100644 index 00000000000..e2c5af352bc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse/secret_versionless.go @@ -0,0 +1,75 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type SecretVersionlessId struct { + SubscriptionId string + ResourceGroup string + VaultName string + SecretName string +} + +func NewSecretVersionlessID(subscriptionId, resourceGroup, vaultName, secretName string) SecretVersionlessId { + return SecretVersionlessId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + VaultName: vaultName, + SecretName: secretName, + } +} + +func (id SecretVersionlessId) String() string { + segments := []string{ + fmt.Sprintf("Secret Name %q", id.SecretName), + fmt.Sprintf("Vault Name %q", id.VaultName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Secret Versionless", segmentsStr) +} + +func (id SecretVersionlessId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.KeyVault/vaults/%s/secrets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.VaultName, id.SecretName) +} + +// SecretVersionlessID parses a SecretVersionless ID into an SecretVersionlessId struct +func SecretVersionlessID(input string) (*SecretVersionlessId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := SecretVersionlessId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.VaultName, err = id.PopSegment("vaults"); err != nil { + return nil, err + } + if resourceId.SecretName, err = id.PopSegment("secrets"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/resourceids.go index 6979b1b609a..b0d859a4cbb 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/resourceids.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/resourceids.go @@ -6,3 +6,7 @@ package keyvault // KeyVault Access Policies are Terraform specific, but can be either an Object ID or an Application ID //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AccessPolicyApplication -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1/objectId/object1/applicationId/application1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AccessPolicyObject -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1/objectId/object1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Key -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1/keys/key1/versions/version1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=KeyVersionless -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1/keys/key1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Secret -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1/secrets/secret1/versions/version1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SecretVersionless -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.KeyVault/vaults/vault1/secrets/secret1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate/key_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate/key_id.go new file mode 100644 index 00000000000..10b6874b3fb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate/key_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" +) + +func KeyID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.KeyID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate/key_versionless_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate/key_versionless_id.go new file mode 100644 index 00000000000..fdb7fbcaf39 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate/key_versionless_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" +) + +func KeyVersionlessID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.KeyVersionlessID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate/secret_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate/secret_id.go new file mode 100644 index 00000000000..668d352057d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate/secret_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" +) + +func SecretID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.SecretID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate/secret_versionless_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate/secret_versionless_id.go new file mode 100644 index 00000000000..1190a338838 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate/secret_versionless_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" +) + +func SecretVersionlessID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.SecretVersionlessID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/client/client.go index a1a8ff832d0..551eff602bb 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/client/client.go @@ -1,13 +1,14 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { AttachedDatabaseConfigurationsClient *kusto.AttachedDatabaseConfigurationsClient ClustersClient *kusto.ClustersClient + ClusterManagedPrivateEndpointClient *kusto.ManagedPrivateEndpointsClient ClusterPrincipalAssignmentsClient *kusto.ClusterPrincipalAssignmentsClient DatabasesClient *kusto.DatabasesClient DataConnectionsClient *kusto.DataConnectionsClient @@ -19,6 +20,9 @@ func NewClient(o *common.ClientOptions) *Client { ClustersClient := kusto.NewClustersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&ClustersClient.Client, o.ResourceManagerAuthorizer) + ClusterManagedPrivateEndpointClient := kusto.NewManagedPrivateEndpointsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&ClusterManagedPrivateEndpointClient.Client, o.ResourceManagerAuthorizer) + ClusterPrincipalAssignmentsClient := kusto.NewClusterPrincipalAssignmentsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&ClusterPrincipalAssignmentsClient.Client, o.ResourceManagerAuthorizer) @@ -39,6 +43,7 @@ func NewClient(o *common.ClientOptions) *Client { return &Client{ AttachedDatabaseConfigurationsClient: &AttachedDatabaseConfigurationsClient, ClustersClient: &ClustersClient, + ClusterManagedPrivateEndpointClient: &ClusterManagedPrivateEndpointClient, ClusterPrincipalAssignmentsClient: &ClusterPrincipalAssignmentsClient, DatabasesClient: &DatabasesClient, DataConnectionsClient: &DataConnectionsClient, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/identity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/identity.go index dd530e9d3cf..f74767d9ae5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/identity.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/identity.go @@ -1,7 +1,7 @@ package kusto import ( - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" "github.com/hashicorp/terraform-provider-azurerm/utils" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_attached_database_configuration_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_attached_database_configuration_resource.go index 0ec64135dae..d618c399eb0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_attached_database_configuration_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_attached_database_configuration_resource.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_cluster_customer_managed_key_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_cluster_customer_managed_key_resource.go index d754b8cb86f..0216be47c5c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_cluster_customer_managed_key_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_cluster_customer_managed_key_resource.go @@ -5,7 +5,8 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" @@ -13,7 +14,6 @@ import ( keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" - msiValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -68,7 +68,7 @@ func resourceKustoClusterCustomerManagedKey() *pluginsdk.Resource { "user_identity": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: msiValidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, }, } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_cluster_managed_private_endpoint_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_cluster_managed_private_endpoint_resource.go new file mode 100644 index 00000000000..b681e3aec05 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_cluster_managed_private_endpoint_resource.go @@ -0,0 +1,191 @@ +package kusto + +import ( + "fmt" + "time" + + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceKustoClusterManagedPrivateEndpoint() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceKustoClusterManagedPrivateEndpointCreateUpdate, + Read: resourceKustoClusterManagedPrivateEndpointRead, + Update: resourceKustoClusterManagedPrivateEndpointCreateUpdate, + Delete: resourceKustoClusterManagedPrivateEndpointDelete, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.ManagedPrivateEndpointsID(id) + return err + }), + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(60 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Update: pluginsdk.DefaultTimeout(60 * time.Minute), + Delete: pluginsdk.DefaultTimeout(60 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "resource_group_name": azure.SchemaResourceGroupName(), + + "cluster_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.ClusterName, + }, + + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "private_link_resource_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: azure.ValidateResourceID, + }, + + "group_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "private_link_resource_region": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "request_message": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + } +} + +func resourceKustoClusterManagedPrivateEndpointCreateUpdate(d *schema.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Kusto.ClusterManagedPrivateEndpointClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id := parse.NewManagedPrivateEndpointsID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("name").(string)) + if d.IsNewResource() { + managedPrivateEndpoint, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.ManagedPrivateEndpointName) + if err != nil { + if !utils.ResponseWasNotFound(managedPrivateEndpoint.Response) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + + if !utils.ResponseWasNotFound(managedPrivateEndpoint.Response) { + return tf.ImportAsExistsError("azurerm_kusto_cluster_managed_private_endpoint", id.ID()) + } + } + + managedPrivateEndpoint := kusto.ManagedPrivateEndpoint{ + ManagedPrivateEndpointProperties: &kusto.ManagedPrivateEndpointProperties{ + PrivateLinkResourceID: utils.String(d.Get("private_link_resource_id").(string)), + GroupID: utils.String(d.Get("group_id").(string)), + }, + } + + if v, ok := d.GetOk("private_link_resource_region"); ok { + managedPrivateEndpoint.PrivateLinkResourceRegion = utils.String(v.(string)) + } + + if v, ok := d.GetOk("request_message"); ok { + managedPrivateEndpoint.RequestMessage = utils.String(v.(string)) + } + + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ClusterName, id.ManagedPrivateEndpointName, managedPrivateEndpoint) + if err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) + } + + d.SetId(id.ID()) + return resourceKustoClusterManagedPrivateEndpointRead(d, meta) +} + +func resourceKustoClusterManagedPrivateEndpointRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Kusto.ClusterManagedPrivateEndpointClient + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.ManagedPrivateEndpointsID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.ManagedPrivateEndpointName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + d.SetId("") + return nil + } + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + d.Set("name", id.ManagedPrivateEndpointName) + d.Set("cluster_name", id.ClusterName) + d.Set("resource_group_name", id.ResourceGroup) + d.Set("private_link_resource_id", resp.PrivateLinkResourceID) + d.Set("group_id", resp.GroupID) + + if resp.PrivateLinkResourceRegion != nil { + d.Set("private_link_resource_region", resp.PrivateLinkResourceRegion) + } + + if resp.RequestMessage != nil { + d.Set("request_message", resp.RequestMessage) + } + + return nil +} + +func resourceKustoClusterManagedPrivateEndpointDelete(d *schema.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Kusto.ClusterManagedPrivateEndpointClient + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.ManagedPrivateEndpointsID(d.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.ClusterName, id.ManagedPrivateEndpointName) + + if err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_cluster_principal_assignment_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_cluster_principal_assignment_resource.go index 44fe3123387..4695c420ce5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_cluster_principal_assignment_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_cluster_principal_assignment_resource.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_cluster_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_cluster_resource.go index 83830c6c4e3..c366f2cb3a4 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_cluster_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_cluster_resource.go @@ -6,18 +6,16 @@ import ( "strings" "time" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto" - "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" @@ -77,23 +75,43 @@ func resourceKustoCluster() *pluginsdk.Resource { string(kusto.AzureSkuNameStandardD12V2), string(kusto.AzureSkuNameStandardD13V2), string(kusto.AzureSkuNameStandardD14V2), + string(kusto.AzureSkuNameStandardD16dV5), + string(kusto.AzureSkuNameStandardD32dV4), + string(kusto.AzureSkuNameStandardD32dV5), string(kusto.AzureSkuNameStandardDS13V21TBPS), string(kusto.AzureSkuNameStandardDS13V22TBPS), string(kusto.AzureSkuNameStandardDS14V23TBPS), string(kusto.AzureSkuNameStandardDS14V24TBPS), + string(kusto.AzureSkuNameStandardE16aV4), + string(kusto.AzureSkuNameStandardE16adsV5), string(kusto.AzureSkuNameStandardE16asV43TBPS), string(kusto.AzureSkuNameStandardE16asV44TBPS), - string(kusto.AzureSkuNameStandardE16aV4), + string(kusto.AzureSkuNameStandardE16asV53TBPS), + string(kusto.AzureSkuNameStandardE16asV54TBPS), + string(kusto.AzureSkuNameStandardE16sV43TBPS), + string(kusto.AzureSkuNameStandardE16sV44TBPS), + string(kusto.AzureSkuNameStandardE16sV53TBPS), + string(kusto.AzureSkuNameStandardE16sV54TBPS), string(kusto.AzureSkuNameStandardE2aV4), + string(kusto.AzureSkuNameStandardE2adsV5), string(kusto.AzureSkuNameStandardE4aV4), + string(kusto.AzureSkuNameStandardE4adsV5), string(kusto.AzureSkuNameStandardE64iV3), + string(kusto.AzureSkuNameStandardE80idsV4), + string(kusto.AzureSkuNameStandardE8aV4), + string(kusto.AzureSkuNameStandardE8adsV5), string(kusto.AzureSkuNameStandardE8asV41TBPS), string(kusto.AzureSkuNameStandardE8asV42TBPS), - string(kusto.AzureSkuNameStandardE8aV4), + string(kusto.AzureSkuNameStandardE8asV51TBPS), + string(kusto.AzureSkuNameStandardE8asV52TBPS), + string(kusto.AzureSkuNameStandardE8sV41TBPS), + string(kusto.AzureSkuNameStandardE8sV42TBPS), + string(kusto.AzureSkuNameStandardE8sV51TBPS), + string(kusto.AzureSkuNameStandardE8sV52TBPS), string(kusto.AzureSkuNameStandardL16s), + string(kusto.AzureSkuNameStandardL16sV2), string(kusto.AzureSkuNameStandardL4s), string(kusto.AzureSkuNameStandardL8s), - string(kusto.AzureSkuNameStandardL16sV2), string(kusto.AzureSkuNameStandardL8sV2), }, false), }, @@ -108,6 +126,24 @@ func resourceKustoCluster() *pluginsdk.Resource { }, }, + "allowed_fqdns": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + + "allowed_ip_ranges": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + "trusted_external_tenants": { Type: pluginsdk.TypeList, Optional: true, @@ -197,12 +233,28 @@ func resourceKustoCluster() *pluginsdk.Resource { Computed: true, }, + "public_ip_type": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(kusto.PublicIPTypeIPv4), + ValidateFunc: validation.StringInSlice([]string{ + string(kusto.PublicIPTypeIPv4), + string(kusto.PublicIPTypeDualStack), + }, false), + }, + "public_network_access_enabled": { Type: pluginsdk.TypeBool, Optional: true, Default: true, }, + "outbound_network_access_restricted": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + "double_encryption_enabled": { Type: pluginsdk.TypeBool, Optional: true, @@ -315,6 +367,7 @@ func resourceKustoClusterCreateUpdate(d *pluginsdk.ResourceData, meta interface{ EnablePurge: utils.Bool(d.Get("purge_enabled").(bool)), EngineType: engine, PublicNetworkAccess: publicNetworkAccess, + PublicIPType: kusto.PublicIPType(d.Get("public_ip_type").(string)), TrustedExternalTenants: expandTrustedExternalTenants(d.Get("trusted_external_tenants").([]interface{})), } @@ -323,6 +376,21 @@ func resourceKustoClusterCreateUpdate(d *pluginsdk.ResourceData, meta interface{ clusterProperties.VirtualNetworkConfiguration = vnet } + if v, ok := d.GetOk("allowed_fqdns"); ok { + clusterProperties.AllowedFqdnList, _ = expandKustoListString(v.([]interface{})) + } + + if v, ok := d.GetOk("allowed_ip_ranges"); ok { + clusterProperties.AllowedIPRangeList, _ = expandKustoListString(v.([]interface{})) + } + + clusterProperties.RestrictOutboundNetworkAccess = kusto.ClusterNetworkAccessFlagDisabled + if v, ok := d.GetOk("outbound_network_access_restricted"); ok { + if v.(bool) { + clusterProperties.RestrictOutboundNetworkAccess = kusto.ClusterNetworkAccessFlagEnabled + } + } + expandedIdentity, err := expandClusterIdentity(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) @@ -440,6 +508,8 @@ func resourceKustoClusterRead(d *pluginsdk.ResourceData, meta interface{}) error } if props := resp.ClusterProperties; props != nil { + d.Set("allowed_fqdns", props.AllowedFqdnList) + d.Set("allowed_ip_ranges", props.AllowedIPRangeList) d.Set("double_encryption_enabled", props.EnableDoubleEncryption) d.Set("trusted_external_tenants", flattenTrustedExternalTenants(props.TrustedExternalTenants)) d.Set("auto_stop_enabled", props.EnableAutoStop) @@ -451,6 +521,8 @@ func resourceKustoClusterRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("uri", props.URI) d.Set("data_ingestion_uri", props.DataIngestionURI) d.Set("engine", props.EngineType) + d.Set("public_ip_type", props.PublicIPType) + d.Set("outbound_network_access_restricted", props.RestrictOutboundNetworkAccess == kusto.ClusterNetworkAccessFlagEnabled) } return tags.FlattenAndSet(d, resp.Tags) @@ -517,6 +589,20 @@ func flattenOptimizedAutoScale(optimizedAutoScale *kusto.OptimizedAutoscale) []i } } +func expandKustoListString(input []interface{}) (*[]string, error) { + if input == nil || len(input) == 0 { + return nil, fmt.Errorf("list of string is empty") + } + + result := make([]string, 0) + + for _, v := range input { + result = append(result, v.(string)) + } + + return &result, nil +} + func expandKustoClusterSku(input []interface{}) (*kusto.AzureSku, error) { sku := input[0].(map[string]interface{}) name := sku["name"].(string) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_data_connection_import.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_data_connection_import.go index 146f3c816f8..c6f87a87302 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_data_connection_import.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_data_connection_import.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_database_principal_assignment_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_database_principal_assignment_resource.go index 26aeaafea3a..1d137e03b59 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_database_principal_assignment_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_database_principal_assignment_resource.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_database_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_database_resource.go index 3f59d7d2bdb..60eb46be401 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_database_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_database_resource.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_database_script_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_database_script_resource.go index fb373feda8b..dfa4e822a96 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_database_script_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_database_script_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" "github.com/hashicorp/go-uuid" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -51,28 +51,42 @@ func resourceKustoDatabaseScript() *pluginsdk.Resource { ValidateFunc: validate.DatabaseID, }, - "url": { + "continue_on_errors_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "force_an_update_when_value_changed": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, + Computed: true, ValidateFunc: validation.StringIsNotEmpty, }, - "sas_token": { + "url": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, + ExactlyOneOf: []string{"url", "script_content"}, + RequiredWith: []string{"sas_token"}, ValidateFunc: validation.StringIsNotEmpty, }, - "continue_on_errors_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Default: false, + "sas_token": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + RequiredWith: []string{"url"}, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, }, - "force_an_update_when_value_changed": { + "script_content": { Type: pluginsdk.TypeString, + ExactlyOneOf: []string{"url", "script_content"}, Optional: true, - Computed: true, + ForceNew: true, + Sensitive: true, ValidateFunc: validation.StringIsNotEmpty, }, }, @@ -109,12 +123,23 @@ func resourceKustoDatabaseScriptCreateUpdate(d *pluginsdk.ResourceData, meta int parameters := kusto.Script{ ScriptProperties: &kusto.ScriptProperties{ - ContinueOnErrors: utils.Bool(d.Get("continue_on_errors_enabled").(bool)), - ForceUpdateTag: utils.String(forceUpdateTag), - ScriptURL: utils.String(d.Get("url").(string)), - ScriptURLSasToken: utils.String(d.Get("sas_token").(string)), + ContinueOnErrors: utils.Bool(d.Get("continue_on_errors_enabled").(bool)), + ForceUpdateTag: utils.String(forceUpdateTag), }, } + + if scriptURL, ok := d.GetOk("url"); ok { + parameters.ScriptURL = utils.String(scriptURL.(string)) + } + + if scriptURLSasToken, ok := d.GetOk("sas_token"); ok { + parameters.ScriptURLSasToken = utils.String(scriptURLSasToken.(string)) + } + + if scriptContent, ok := d.GetOk("script_content"); ok { + parameters.ScriptContent = utils.String(scriptContent.(string)) + } + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name, parameters) if err != nil { return fmt.Errorf("creating %q: %+v", id, err) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_eventgrid_data_connection_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_eventgrid_data_connection_resource.go index 14e32ba5d23..75745801a5c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_eventgrid_data_connection_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_eventgrid_data_connection_resource.go @@ -5,12 +5,13 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs" eventhubValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" @@ -137,6 +138,33 @@ func resourceKustoEventGridDataConnection() *pluginsdk.Resource { string(kusto.EventGridDataFormatW3CLOGFILE), }, false), }, + + "database_routing_type": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + Default: string(kusto.DatabaseRoutingSingle), + ValidateFunc: validation.StringInSlice([]string{ + string(kusto.DatabaseRoutingSingle), + string(kusto.DatabaseRoutingMulti), + }, false), + }, + + "eventgrid_resource_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: azure.ValidateResourceID, + }, + + "managed_identity_resource_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.Any( + validation.StringIsEmpty, + validate.ClusterID, + commonids.ValidateUserAssignedIdentityID, + ), + }, }, } } @@ -186,6 +214,18 @@ func resourceKustoEventGridDataConnectionCreateUpdate(d *pluginsdk.ResourceData, dataConnection.EventGridConnectionProperties.DataFormat = kusto.EventGridDataFormat(df.(string)) } + if databaseRouting, ok := d.GetOk("database_routing_type"); ok { + dataConnection.DatabaseRouting = kusto.DatabaseRouting(databaseRouting.(string)) + } + + if eventGridRID, ok := d.GetOk("eventgrid_resource_id"); ok { + dataConnection.EventGridConnectionProperties.EventGridResourceID = utils.String(eventGridRID.(string)) + } + + if managedIdentityRID, ok := d.GetOk("managed_identity_resource_id"); ok { + dataConnection.EventGridConnectionProperties.ManagedIdentityResourceID = utils.String(managedIdentityRID.(string)) + } + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name, dataConnection) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) @@ -235,6 +275,9 @@ func resourceKustoEventGridDataConnectionRead(d *pluginsdk.ResourceData, meta in d.Set("table_name", props.TableName) d.Set("mapping_rule_name", props.MappingRuleName) d.Set("data_format", props.DataFormat) + d.Set("database_routing_type", props.DatabaseRouting) + d.Set("eventgrid_resource_id", props.EventGridResourceID) + d.Set("managed_identity_resource_id", props.ManagedIdentityResourceID) } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_eventhub_data_connection_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_eventhub_data_connection_resource.go index 9a536fe00a4..e5bf507ca3d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_eventhub_data_connection_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_eventhub_data_connection_resource.go @@ -5,15 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs" eventhubValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" - msiValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -113,7 +113,7 @@ func resourceKustoEventHubDataConnection() *pluginsdk.Resource { Optional: true, ValidateFunc: validation.Any( validate.ClusterID, - msiValidate.UserAssignedIdentityID, + commonids.ValidateUserAssignedIdentityID, ), }, @@ -141,6 +141,17 @@ func resourceKustoEventHubDataConnection() *pluginsdk.Resource { string(kusto.EventHubDataFormatTXT), }, false), }, + + "database_routing_type": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + Default: string(kusto.DatabaseRoutingSingle), + ValidateFunc: validation.StringInSlice([]string{ + string(kusto.DatabaseRoutingSingle), + string(kusto.DatabaseRoutingMulti), + }, false), + }, }, } } @@ -180,6 +191,10 @@ func resourceKustoEventHubDataConnectionCreateUpdate(d *pluginsdk.ResourceData, EventHubConnectionProperties: eventHubDataConnectionProperties, } + if databaseRouting, ok := d.GetOk("database_routing_type"); ok { + dataConnection1.DatabaseRouting = kusto.DatabaseRouting(databaseRouting.(string)) + } + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name, dataConnection1) if err != nil { return fmt.Errorf("creating or updating %s: %+v", id, err) @@ -229,6 +244,7 @@ func resourceKustoEventHubDataConnectionRead(d *pluginsdk.ResourceData, meta int d.Set("table_name", props.TableName) d.Set("mapping_rule_name", props.MappingRuleName) d.Set("data_format", props.DataFormat) + d.Set("database_routing_type", props.DatabaseRouting) d.Set("compression", props.Compression) d.Set("event_system_properties", props.EventSystemProperties) d.Set("identity_id", props.ManagedIdentityResourceID) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_iothub_data_connection_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_iothub_data_connection_resource.go index 218365f7fb4..8a70245a308 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_iothub_data_connection_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/kusto_iothub_data_connection_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" @@ -121,6 +121,17 @@ func resourceKustoIotHubDataConnection() *pluginsdk.Resource { }, false), }, + "database_routing_type": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + Default: string(kusto.DatabaseRoutingSingle), + ValidateFunc: validation.StringInSlice([]string{ + string(kusto.DatabaseRoutingSingle), + string(kusto.DatabaseRoutingMulti), + }, false), + }, + "event_system_properties": { Type: pluginsdk.TypeSet, Optional: true, @@ -173,6 +184,10 @@ func resourceKustoIotHubDataConnectionCreate(d *pluginsdk.ResourceData, meta int IotHubConnectionProperties: iotHubDataConnectionProperties, } + if databaseRouting, ok := d.GetOk("database_routing_type"); ok { + dataConnection.DatabaseRouting = kusto.DatabaseRouting(databaseRouting.(string)) + } + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name, dataConnection) if err != nil { return fmt.Errorf("creating or updating %s: %+v", id, err) @@ -218,6 +233,7 @@ func resourceKustoIotHubDataConnectionRead(d *pluginsdk.ResourceData, meta inter d.Set("table_name", props.TableName) d.Set("mapping_rule_name", props.MappingRuleName) d.Set("data_format", props.DataFormat) + d.Set("database_routing_type", props.DatabaseRouting) d.Set("shared_access_policy_name", props.SharedAccessPolicyName) d.Set("event_system_properties", utils.FlattenStringSlice(props.EventSystemProperties)) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse/managed_private_endpoints.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse/managed_private_endpoints.go new file mode 100644 index 00000000000..fd19db83447 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse/managed_private_endpoints.go @@ -0,0 +1,75 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type ManagedPrivateEndpointsId struct { + SubscriptionId string + ResourceGroup string + ClusterName string + ManagedPrivateEndpointName string +} + +func NewManagedPrivateEndpointsID(subscriptionId, resourceGroup, clusterName, managedPrivateEndpointName string) ManagedPrivateEndpointsId { + return ManagedPrivateEndpointsId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + ClusterName: clusterName, + ManagedPrivateEndpointName: managedPrivateEndpointName, + } +} + +func (id ManagedPrivateEndpointsId) String() string { + segments := []string{ + fmt.Sprintf("Managed Private Endpoint Name %q", id.ManagedPrivateEndpointName), + fmt.Sprintf("Cluster Name %q", id.ClusterName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Managed Private Endpoints", segmentsStr) +} + +func (id ManagedPrivateEndpointsId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/Clusters/%s/ManagedPrivateEndpoints/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ClusterName, id.ManagedPrivateEndpointName) +} + +// ManagedPrivateEndpointsID parses a ManagedPrivateEndpoints ID into an ManagedPrivateEndpointsId struct +func ManagedPrivateEndpointsID(input string) (*ManagedPrivateEndpointsId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := ManagedPrivateEndpointsId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.ClusterName, err = id.PopSegment("Clusters"); err != nil { + return nil, err + } + if resourceId.ManagedPrivateEndpointName, err = id.PopSegment("ManagedPrivateEndpoints"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/registration.go index a29f38799f8..fd4f6a9ecd7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/registration.go @@ -36,15 +36,16 @@ func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { // SupportedResources returns the supported Resources supported by this Service func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ - "azurerm_kusto_cluster": resourceKustoCluster(), - "azurerm_kusto_cluster_customer_managed_key": resourceKustoClusterCustomerManagedKey(), - "azurerm_kusto_cluster_principal_assignment": resourceKustoClusterPrincipalAssignment(), - "azurerm_kusto_database": resourceKustoDatabase(), - "azurerm_kusto_database_principal_assignment": resourceKustoDatabasePrincipalAssignment(), - "azurerm_kusto_eventgrid_data_connection": resourceKustoEventGridDataConnection(), - "azurerm_kusto_eventhub_data_connection": resourceKustoEventHubDataConnection(), - "azurerm_kusto_iothub_data_connection": resourceKustoIotHubDataConnection(), - "azurerm_kusto_attached_database_configuration": resourceKustoAttachedDatabaseConfiguration(), - "azurerm_kusto_script": resourceKustoDatabaseScript(), + "azurerm_kusto_cluster": resourceKustoCluster(), + "azurerm_kusto_cluster_customer_managed_key": resourceKustoClusterCustomerManagedKey(), + "azurerm_kusto_cluster_managed_private_endpoint": resourceKustoClusterManagedPrivateEndpoint(), + "azurerm_kusto_cluster_principal_assignment": resourceKustoClusterPrincipalAssignment(), + "azurerm_kusto_database": resourceKustoDatabase(), + "azurerm_kusto_database_principal_assignment": resourceKustoDatabasePrincipalAssignment(), + "azurerm_kusto_eventgrid_data_connection": resourceKustoEventGridDataConnection(), + "azurerm_kusto_eventhub_data_connection": resourceKustoEventHubDataConnection(), + "azurerm_kusto_iothub_data_connection": resourceKustoIotHubDataConnection(), + "azurerm_kusto_attached_database_configuration": resourceKustoAttachedDatabaseConfiguration(), + "azurerm_kusto_script": resourceKustoDatabaseScript(), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/resourceids.go index fc01d2e8ce5..9a619189f3c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/resourceids.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/resourceids.go @@ -8,3 +8,4 @@ package kusto //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DatabasePrincipalAssignment -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Kusto/Clusters/cluster1/Databases/database1/PrincipalAssignments/assignment1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=DataConnection -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Kusto/Clusters/cluster1/Databases/database1/DataConnections/connection1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Script -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Kusto/Clusters/cluster1/Databases/database1/Scripts/script1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ManagedPrivateEndpoints -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Kusto/Clusters/cluster1/ManagedPrivateEndpoints/endpoint1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate/managed_private_endpoints_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate/managed_private_endpoints_id.go new file mode 100644 index 00000000000..c6094925725 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate/managed_private_endpoints_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" +) + +func ManagedPrivateEndpointsID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.ManagedPrivateEndpointsID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/legacy/virtual_machine_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/legacy/virtual_machine_resource.go index 0b0663727fa..adf49caf0d2 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/legacy/virtual_machine_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/legacy/virtual_machine_resource.go @@ -9,18 +9,16 @@ import ( "strings" "time" - compute2 "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" + compute2 "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" - msiparse "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/parse" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" networkParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" intStor "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/client" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -157,7 +155,7 @@ func resourceVirtualMachine() *pluginsdk.Resource { MinItems: 1, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, }, }, @@ -1150,7 +1148,7 @@ func flattenAzureRmVirtualMachineIdentity(identity *compute.VirtualMachineIdenti } */ for key := range identity.UserAssignedIdentities { - parsedId, err := msiparse.UserAssignedIdentityIDInsensitively(key) + parsedId, err := commonids.ParseUserAssignedIdentityIDInsensitively(key) if err != nil { return nil, err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/legacy/virtual_machine_scale_set_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/legacy/virtual_machine_scale_set_resource.go index e3ca30c6b63..2f0b5cac22b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/legacy/virtual_machine_scale_set_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/legacy/virtual_machine_scale_set_resource.go @@ -9,6 +9,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" @@ -16,8 +17,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" validate2 "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" - msiparse "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/parse" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -92,7 +91,7 @@ func resourceVirtualMachineScaleSet() *pluginsdk.Resource { Optional: true, Elem: &pluginsdk.Schema{ Type: pluginsdk.TypeString, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, }, "principal_id": { @@ -1137,7 +1136,7 @@ func flattenAzureRmVirtualMachineScaleSetIdentity(identity *compute.VirtualMachi identityIds := make([]string, 0) if identity.UserAssignedIdentities != nil { for key := range identity.UserAssignedIdentities { - parsedId, err := msiparse.UserAssignedIdentityIDInsensitively(key) + parsedId, err := commonids.ParseUserAssignedIdentityIDInsensitively(key) if err != nil { return nil, err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/client/client.go index fe776a43577..e977d4d0fa7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/client/client.go @@ -1,24 +1,25 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices" + "github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments" + "github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - DefinitionsClient *managedservices.RegistrationDefinitionsClient - AssignmentsClient *managedservices.RegistrationAssignmentsClient + AssignmentsClient *registrationassignments.RegistrationAssignmentsClient + DefinitionsClient *registrationdefinitions.RegistrationDefinitionsClient } func NewClient(o *common.ClientOptions) *Client { - DefinitionsClient := managedservices.NewRegistrationDefinitionsClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&DefinitionsClient.Client, o.ResourceManagerAuthorizer) + assignmentsClient := registrationassignments.NewRegistrationAssignmentsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&assignmentsClient.Client, o.ResourceManagerAuthorizer) - AssignmentsClient := managedservices.NewRegistrationAssignmentsClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&AssignmentsClient.Client, o.ResourceManagerAuthorizer) + definitionsClient := registrationdefinitions.NewRegistrationDefinitionsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&definitionsClient.Client, o.ResourceManagerAuthorizer) return &Client{ - DefinitionsClient: &DefinitionsClient, - AssignmentsClient: &AssignmentsClient, + DefinitionsClient: &definitionsClient, + AssignmentsClient: &assignmentsClient, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/lighthouse_assignment_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/lighthouse_assignment_resource.go index 43bd5cac506..5ae5f27b77f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/lighthouse_assignment_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/lighthouse_assignment_resource.go @@ -6,12 +6,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments" + "github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions" "github.com/hashicorp/go-uuid" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -25,7 +25,7 @@ func resourceLighthouseAssignment() *pluginsdk.Resource { Delete: resourceLighthouseAssignmentDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.LighthouseAssignmentID(id) + _, err := registrationassignments.ParseScopedRegistrationAssignmentID(id) return err }), @@ -48,7 +48,7 @@ func resourceLighthouseAssignment() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.LighthouseDefinitionID, + ValidateFunc: registrationdefinitions.ValidateScopedRegistrationDefinitionID, }, "scope": { @@ -76,27 +76,26 @@ func resourceLighthouseAssignmentCreate(d *pluginsdk.ResourceData, meta interfac lighthouseAssignmentName = uuid } - id := parse.NewLighthouseAssignmentID(d.Get("scope").(string), lighthouseAssignmentName) - existing, err := client.Get(ctx, id.Scope, id.Name, utils.Bool(false)) + id := registrationassignments.NewScopedRegistrationAssignmentID(d.Get("scope").(string), lighthouseAssignmentName) + options := registrationassignments.GetOperationOptions{ + ExpandRegistrationDefinition: utils.Bool(false), + } + existing, err := client.Get(ctx, id, options) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - parameters := managedservices.RegistrationAssignment{ - Properties: &managedservices.RegistrationAssignmentProperties{ - RegistrationDefinitionID: utils.String(d.Get("lighthouse_definition_id").(string)), + parameters := registrationassignments.RegistrationAssignment{ + Properties: ®istrationassignments.RegistrationAssignmentProperties{ + RegistrationDefinitionId: d.Get("lighthouse_definition_id").(string), }, } - future, err := client.CreateOrUpdate(ctx, id.Scope, id.Name, parameters) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %q: %+v", id, err) - } d.SetId(id.ID()) return resourceLighthouseAssignmentRead(d, meta) @@ -107,14 +106,17 @@ func resourceLighthouseAssignmentRead(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.LighthouseAssignmentID(d.Id()) + id, err := registrationassignments.ParseScopedRegistrationAssignmentID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.Scope, id.Name, utils.Bool(false)) + options := registrationassignments.GetOperationOptions{ + ExpandRegistrationDefinition: utils.Bool(false), + } + resp, err := client.Get(ctx, *id, options) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[WARN] %s was not found - removing from state", *id) d.SetId("") return nil @@ -123,11 +125,13 @@ func resourceLighthouseAssignmentRead(d *pluginsdk.ResourceData, meta interface{ return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) + d.Set("name", id.RegistrationAssignmentId) d.Set("scope", id.Scope) - if props := resp.Properties; props != nil { - d.Set("lighthouse_definition_id", props.RegistrationDefinitionID) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("lighthouse_definition_id", props.RegistrationDefinitionId) + } } return nil @@ -138,45 +142,43 @@ func resourceLighthouseAssignmentDelete(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.LighthouseAssignmentID(d.Id()) + id, err := registrationassignments.ParseScopedRegistrationAssignmentID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.Scope, id.Name) - if err != nil { - return fmt.Errorf("deleting Lighthouse Assignment %q at Scope %q: %+v", id.Name, id.Scope, err) - } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %q: %+v", id, err) + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } stateConf := &pluginsdk.StateChangeConf{ Pending: []string{"Deleting"}, Target: []string{"Deleted"}, - Refresh: lighthouseAssignmentDeleteRefreshFunc(ctx, client, id.Scope, id.Name), + Refresh: lighthouseAssignmentDeleteRefreshFunc(ctx, client, *id), MinTimeout: 15 * time.Second, Timeout: d.Timeout(pluginsdk.TimeoutDelete), } if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for Lighthouse Assignment %q (Scope %q) to be deleted: %s", id.Name, id.Scope, err) + return err } return nil } -func lighthouseAssignmentDeleteRefreshFunc(ctx context.Context, client *managedservices.RegistrationAssignmentsClient, scope string, lighthouseAssignmentName string) pluginsdk.StateRefreshFunc { +func lighthouseAssignmentDeleteRefreshFunc(ctx context.Context, client *registrationassignments.RegistrationAssignmentsClient, id registrationassignments.ScopedRegistrationAssignmentId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - expandLighthouseDefinition := true - res, err := client.Get(ctx, scope, lighthouseAssignmentName, &expandLighthouseDefinition) + options := registrationassignments.GetOperationOptions{ + ExpandRegistrationDefinition: utils.Bool(true), + } + resp, err := client.Get(ctx, id, options) if err != nil { - if utils.ResponseWasNotFound(res.Response) { - return res, "Deleted", nil + if response.WasNotFound(resp.HttpResponse) { + return resp, "Deleted", nil } - return nil, "Error", fmt.Errorf("issuing read request in lighthouseAssignmentDeleteRefreshFunc to Lighthouse Assignment %q (Scope %q): %s", lighthouseAssignmentName, scope, err) + return nil, "Error", fmt.Errorf("polling to check the deletion of %s: %+v", id, err) } - return res, "Deleting", nil + return resp, "Deleting", nil } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/lighthouse_definition_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/lighthouse_definition_resource.go index 3cd3488d382..30f9762016f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/lighthouse_definition_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/lighthouse_definition_resource.go @@ -5,13 +5,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices" - frsUUID "github.com/gofrs/uuid" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions" "github.com/hashicorp/go-uuid" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -26,7 +25,7 @@ func resourceLighthouseDefinition() *pluginsdk.Resource { Delete: resourceLighthouseDefinitionDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.LighthouseDefinitionID(id) + _, err := registrationdefinitions.ParseScopedRegistrationDefinitionID(id) return err }), @@ -159,41 +158,34 @@ func resourceLighthouseDefinitionCreateUpdate(d *pluginsdk.ResourceData, meta in lighthouseDefinitionID = uuid } - id := parse.NewLighthouseDefinitionID(d.Get("scope").(string), lighthouseDefinitionID) + id := registrationdefinitions.NewScopedRegistrationDefinitionID(d.Get("scope").(string), lighthouseDefinitionID) if d.IsNewResource() { - existing, err := client.Get(ctx, id.Scope, id.LighthouseDefinitionID) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_lighthouse_definition", id.ID()) } } - authorizations, err := expandLighthouseDefinitionAuthorization(d.Get("authorization").(*pluginsdk.Set).List()) - if err != nil { - return err - } - parameters := managedservices.RegistrationDefinition{ + authorizations := expandLighthouseDefinitionAuthorization(d.Get("authorization").(*pluginsdk.Set).List()) + parameters := registrationdefinitions.RegistrationDefinition{ Plan: expandLighthouseDefinitionPlan(d.Get("plan").([]interface{})), - Properties: &managedservices.RegistrationDefinitionProperties{ + Properties: ®istrationdefinitions.RegistrationDefinitionProperties{ Description: utils.String(d.Get("description").(string)), Authorizations: authorizations, RegistrationDefinitionName: utils.String(d.Get("name").(string)), - ManagedByTenantID: utils.String(d.Get("managing_tenant_id").(string)), + ManagedByTenantId: d.Get("managing_tenant_id").(string), }, } // NOTE: this API call uses DefinitionId then Scope - check in the future - future, err := client.CreateOrUpdate(ctx, id.LighthouseDefinitionID, id.Scope, parameters) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %q: %+v", id, err) - } d.SetId(id.ID()) return resourceLighthouseDefinitionRead(d, meta) @@ -204,14 +196,14 @@ func resourceLighthouseDefinitionRead(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.LighthouseDefinitionID(d.Id()) + id, err := registrationdefinitions.ParseScopedRegistrationDefinitionID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.Scope, id.LighthouseDefinitionID) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[WARN] %s was not found - removing from state", *id) d.SetId("") return nil @@ -220,20 +212,22 @@ func resourceLighthouseDefinitionRead(d *pluginsdk.ResourceData, meta interface{ return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("lighthouse_definition_id", id.LighthouseDefinitionID) + d.Set("lighthouse_definition_id", id.RegistrationDefinitionId) d.Set("scope", id.Scope) - if err := d.Set("plan", flattenLighthouseDefinitionPlan(resp.Plan)); err != nil { - return fmt.Errorf("setting `plan`: %+v", err) - } + if model := resp.Model; model != nil { + if err := d.Set("plan", flattenLighthouseDefinitionPlan(model.Plan)); err != nil { + return fmt.Errorf("setting `plan`: %+v", err) + } - if props := resp.Properties; props != nil { - if err := d.Set("authorization", flattenLighthouseDefinitionAuthorization(props.Authorizations)); err != nil { - return fmt.Errorf("setting `authorization`: %+v", err) + if props := model.Properties; props != nil { + if err := d.Set("authorization", flattenLighthouseDefinitionAuthorization(props.Authorizations)); err != nil { + return fmt.Errorf("setting `authorization`: %+v", err) + } + d.Set("description", props.Description) + d.Set("name", props.RegistrationDefinitionName) + d.Set("managing_tenant_id", props.ManagedByTenantId) } - d.Set("description", props.Description) - d.Set("name", props.RegistrationDefinitionName) - d.Set("managing_tenant_id", props.ManagedByTenantID) } return nil @@ -244,129 +238,78 @@ func resourceLighthouseDefinitionDelete(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.LighthouseDefinitionID(d.Id()) + id, err := registrationdefinitions.ParseScopedRegistrationDefinitionID(d.Id()) if err != nil { return err } - if _, err = client.Delete(ctx, id.LighthouseDefinitionID, id.Scope); err != nil { + if _, err = client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } -func flattenLighthouseDefinitionAuthorization(input *[]managedservices.Authorization) []interface{} { +func flattenLighthouseDefinitionAuthorization(input []registrationdefinitions.Authorization) []interface{} { results := make([]interface{}, 0) - if input == nil { - return results - } - - for _, item := range *input { - principalID := "" - if item.PrincipalID != nil { - principalID = *item.PrincipalID - } - - roleDefinitionID := "" - if item.RoleDefinitionID != nil { - roleDefinitionID = *item.RoleDefinitionID - } - + for _, item := range input { principalIDDisplayName := "" - if item.PrincipalIDDisplayName != nil { - principalIDDisplayName = *item.PrincipalIDDisplayName + if item.PrincipalIdDisplayName != nil { + principalIDDisplayName = *item.PrincipalIdDisplayName } results = append(results, map[string]interface{}{ - "role_definition_id": roleDefinitionID, - "principal_id": principalID, + "role_definition_id": item.RoleDefinitionId, + "principal_id": item.PrincipalId, "principal_display_name": principalIDDisplayName, - "delegated_role_definition_ids": flattenLighthouseDefinitionAuthorizationDelegatedRoleDefinitionIds(item.DelegatedRoleDefinitionIds), + "delegated_role_definition_ids": utils.FlattenStringSlice(item.DelegatedRoleDefinitionIds), }) } return results } -func flattenLighthouseDefinitionAuthorizationDelegatedRoleDefinitionIds(input *[]frsUUID.UUID) []interface{} { - if input == nil { - return []interface{}{} - } - result := make([]interface{}, 0) - for _, item := range *input { - result = append(result, item.String()) - } - return result -} - -func expandLighthouseDefinitionAuthorization(input []interface{}) (*[]managedservices.Authorization, error) { - results := make([]managedservices.Authorization, 0) +func expandLighthouseDefinitionAuthorization(input []interface{}) []registrationdefinitions.Authorization { + results := make([]registrationdefinitions.Authorization, 0) for _, item := range input { v := item.(map[string]interface{}) - delegatedRoleDefinitionIds, err := expandLighthouseDefinitionAuthorizationDelegatedRoleDefinitionIds(v["delegated_role_definition_ids"].(*pluginsdk.Set).List()) - if err != nil { - return nil, err - } - result := managedservices.Authorization{ - RoleDefinitionID: utils.String(v["role_definition_id"].(string)), - PrincipalID: utils.String(v["principal_id"].(string)), - PrincipalIDDisplayName: utils.String(v["principal_display_name"].(string)), + delegatedRoleDefinitionIds := utils.ExpandStringSlice(v["delegated_role_definition_ids"].(*pluginsdk.Set).List()) + result := registrationdefinitions.Authorization{ + RoleDefinitionId: v["role_definition_id"].(string), + PrincipalId: v["principal_id"].(string), + PrincipalIdDisplayName: utils.String(v["principal_display_name"].(string)), DelegatedRoleDefinitionIds: delegatedRoleDefinitionIds, } results = append(results, result) } - return &results, nil -} - -func expandLighthouseDefinitionAuthorizationDelegatedRoleDefinitionIds(input []interface{}) (*[]frsUUID.UUID, error) { - result := make([]frsUUID.UUID, 0) - for _, item := range input { - id, err := frsUUID.FromString(item.(string)) - if err != nil { - return nil, fmt.Errorf("parsing %q as a UUID: %+v", item, err) - } - result = append(result, id) - } - return &result, nil + return results } -func expandLighthouseDefinitionPlan(input []interface{}) *managedservices.Plan { +func expandLighthouseDefinitionPlan(input []interface{}) *registrationdefinitions.Plan { if len(input) == 0 || input[0] == nil { return nil } + raw := input[0].(map[string]interface{}) - return &managedservices.Plan{ - Name: utils.String(raw["name"].(string)), - Publisher: utils.String(raw["publisher"].(string)), - Product: utils.String(raw["product"].(string)), - Version: utils.String(raw["version"].(string)), + return ®istrationdefinitions.Plan{ + Name: raw["name"].(string), + Publisher: raw["publisher"].(string), + Product: raw["product"].(string), + Version: raw["version"].(string), } } -func flattenLighthouseDefinitionPlan(input *managedservices.Plan) []interface{} { +func flattenLighthouseDefinitionPlan(input *registrationdefinitions.Plan) []interface{} { if input == nil { return []interface{}{} } - var name, publisher, product, version string - if input.Name != nil { - name = *input.Name - } - if input.Publisher != nil { - publisher = *input.Publisher - } - if input.Product != nil { - product = *input.Product - } - if input.Version != nil { - version = *input.Version - } + return []interface{}{ map[string]interface{}{ - "name": name, - "publisher": publisher, - "product": product, - "version": version, + "name": input.Name, + "publisher": input.Publisher, + "product": input.Product, + "version": input.Version, }, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/parse/lighthouse_assignment.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/parse/lighthouse_assignment.go deleted file mode 100644 index b76df2c5e0c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/parse/lighthouse_assignment.go +++ /dev/null @@ -1,50 +0,0 @@ -package parse - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = LighthouseAssignmentId{} - -type LighthouseAssignmentId struct { - Scope string - Name string -} - -func NewLighthouseAssignmentID(scope, name string) LighthouseAssignmentId { - return LighthouseAssignmentId{ - Scope: scope, - Name: name, - } -} - -func (id LighthouseAssignmentId) ID() string { - fmtStr := "%s/providers/Microsoft.ManagedServices/registrationAssignments/%s" - return fmt.Sprintf(fmtStr, id.Scope, id.Name) -} - -func (id LighthouseAssignmentId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Scope %q", id.Scope), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Lighthouse Assignment", segmentsStr) -} - -func LighthouseAssignmentID(id string) (*LighthouseAssignmentId, error) { - segments := strings.Split(id, "/providers/Microsoft.ManagedServices/registrationAssignments/") - if len(segments) != 2 { - return nil, fmt.Errorf("Expected ID to be in the format `{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{name} - got %d segments", len(segments)) - } - - lighthouseAssignmentId := LighthouseAssignmentId{ - Scope: segments[0], - Name: segments[1], - } - - return &lighthouseAssignmentId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/parse/lighthouse_definition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/parse/lighthouse_definition.go deleted file mode 100644 index 89ddd9aeb00..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/parse/lighthouse_definition.go +++ /dev/null @@ -1,51 +0,0 @@ -package parse - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = LighthouseDefinitionId{} - -type LighthouseDefinitionId struct { - Scope string - LighthouseDefinitionID string -} - -func NewLighthouseDefinitionID(scope, lighthouseDefinitionId string) LighthouseDefinitionId { - return LighthouseDefinitionId{ - Scope: scope, - LighthouseDefinitionID: lighthouseDefinitionId, - } -} - -func (id LighthouseDefinitionId) ID() string { - fmtStr := "%s/providers/Microsoft.ManagedServices/registrationDefinitions/%s" - return fmt.Sprintf(fmtStr, id.Scope, id.LighthouseDefinitionID) -} - -func (id LighthouseDefinitionId) String() string { - segments := []string{ - fmt.Sprintf("Lighthouse Definition ID %q", id.LighthouseDefinitionID), - fmt.Sprintf("Scope %q", id.Scope), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Lighthouse Assignment", segmentsStr) -} - -func LighthouseDefinitionID(id string) (*LighthouseDefinitionId, error) { - segments := strings.Split(id, "/providers/Microsoft.ManagedServices/registrationDefinitions/") - - if len(segments) != 2 { - return nil, fmt.Errorf("Expected ID to be in the format `{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{name} - got %d segments", len(segments)) - } - - lighthouseDefinitionId := LighthouseDefinitionId{ - Scope: segments[0], - LighthouseDefinitionID: segments[1], - } - - return &lighthouseDefinitionId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/validate/lighthouse_definition_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/validate/lighthouse_definition_id.go deleted file mode 100644 index 2d2f6a00fa4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/validate/lighthouse_definition_id.go +++ /dev/null @@ -1,22 +0,0 @@ -package validate - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/parse" -) - -func LighthouseDefinitionID(i interface{}, k string) (warnings []string, errors []error) { - v, ok := i.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected type of %q to be string", k)) - return - } - - if _, err := parse.LighthouseDefinitionID(v); err != nil { - errors = append(errors, fmt.Errorf("cannot parse %q as a resource id: %v", k, err)) - return - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/backend_address_pool_address_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/backend_address_pool_address_resource.go index e7f947cffa9..3bf77880bb6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/backend_address_pool_address_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/backend_address_pool_address_resource.go @@ -24,10 +24,41 @@ var ( type BackendAddressPoolAddressResource struct{} type BackendAddressPoolAddressModel struct { - Name string `tfschema:"name"` - BackendAddressPoolId string `tfschema:"backend_address_pool_id"` - VirtualNetworkId string `tfschema:"virtual_network_id"` - IPAddress string `tfschema:"ip_address"` + Name string `tfschema:"name"` + BackendAddressPoolId string `tfschema:"backend_address_pool_id"` + VirtualNetworkId string `tfschema:"virtual_network_id"` + IPAddress string `tfschema:"ip_address"` + FrontendIPConfiguration string `tfschema:"backend_address_ip_configuration_id"` + PortMapping []inboundNATRulePortMapping `tfschema:"inbound_nat_rule_port_mapping"` +} + +type inboundNATRulePortMapping struct { + Name string `tfschema:"inbound_nat_rule_name"` + FrontendPort int32 `tfschema:"frontend_port"` + BackendPort int32 `tfschema:"backend_port"` +} + +func portMapping() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "inbound_nat_rule_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "frontend_port": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "backend_port": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + }, + }, + } } func (r BackendAddressPoolAddressResource) Arguments() map[string]*pluginsdk.Schema { @@ -47,21 +78,35 @@ func (r BackendAddressPoolAddressResource) Arguments() map[string]*pluginsdk.Sch }, "virtual_network_id": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: networkValidate.VirtualNetworkID, + Type: pluginsdk.TypeString, + Optional: true, + RequiredWith: []string{"ip_address"}, + ConflictsWith: []string{"backend_address_ip_configuration_id"}, + ValidateFunc: networkValidate.VirtualNetworkID, + Description: "For regional load balancer, user needs to specify `virtual_network_id` and `ip_address`", }, "ip_address": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, + RequiredWith: []string{"virtual_network_id"}, ValidateFunc: validation.IsIPAddress, }, + + "backend_address_ip_configuration_id": { + Type: pluginsdk.TypeString, + Optional: true, + ConflictsWith: []string{"virtual_network_id"}, + ValidateFunc: validate.LoadBalancerFrontendIpConfigurationID, + Description: "For global load balancer, user needs to specify the `backend_address_ip_configuration_id` of the added regional load balancers", + }, } } func (r BackendAddressPoolAddressResource) Attributes() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{} + return map[string]*pluginsdk.Schema{ + "inbound_nat_rule_port_mapping": portMapping(), + } } func (r BackendAddressPoolAddressResource) ModelObject() interface{} { @@ -103,6 +148,11 @@ func (r BackendAddressPoolAddressResource) Create() sdk.ResourceFunc { if isBasicSku { return fmt.Errorf("Backend Addresses are not supported on Basic SKU Load Balancers") } + if lb.Sku != nil && lb.Sku.Tier == network.LoadBalancerSkuTierGlobal { + if model.FrontendIPConfiguration == "" { + return fmt.Errorf("Please set a Regional Backend Address Pool Addresses for the Global load balancer") + } + } id := parse.NewBackendAddressPoolAddressID(subscriptionId, poolId.ResourceGroup, poolId.LoadBalancerName, poolId.BackendAddressPoolName, model.Name) pool, err := client.Get(ctx, poolId.ResourceGroup, poolId.LoadBalancerName, poolId.BackendAddressPoolName) @@ -129,15 +179,26 @@ func (r BackendAddressPoolAddressResource) Create() sdk.ResourceFunc { } } - addresses = append(addresses, network.LoadBalancerBackendAddress{ - LoadBalancerBackendAddressPropertiesFormat: &network.LoadBalancerBackendAddressPropertiesFormat{ - IPAddress: utils.String(model.IPAddress), - VirtualNetwork: &network.SubResource{ - ID: utils.String(model.VirtualNetworkId), + if lb.Sku.Tier == network.LoadBalancerSkuTierGlobal { + addresses = append(addresses, network.LoadBalancerBackendAddress{ + Name: utils.String(id.AddressName), + LoadBalancerBackendAddressPropertiesFormat: &network.LoadBalancerBackendAddressPropertiesFormat{ + LoadBalancerFrontendIPConfiguration: &network.SubResource{ + ID: utils.String(model.FrontendIPConfiguration), + }, }, - }, - Name: utils.String(id.AddressName), - }) + }) + } else { + addresses = append(addresses, network.LoadBalancerBackendAddress{ + LoadBalancerBackendAddressPropertiesFormat: &network.LoadBalancerBackendAddressPropertiesFormat{ + IPAddress: utils.String(model.IPAddress), + VirtualNetwork: &network.SubResource{ + ID: utils.String(model.VirtualNetworkId), + }, + }, + Name: utils.String(id.AddressName), + }) + } pool.BackendAddressPoolPropertiesFormat.LoadBalancerBackendAddresses = &addresses metadata.Logger.Infof("adding %s..", id) @@ -160,6 +221,7 @@ func (r BackendAddressPoolAddressResource) Read() sdk.ResourceFunc { return sdk.ResourceFunc{ Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.LoadBalancers.LoadBalancerBackendAddressPoolsClient + lbClient := metadata.Client.LoadBalancers.LoadBalancersClient id, err := parse.BackendAddressPoolAddressID(metadata.ResourceData.Id()) if err != nil { return err @@ -173,6 +235,11 @@ func (r BackendAddressPoolAddressResource) Read() sdk.ResourceFunc { return fmt.Errorf("retrieving %s: `properties` was nil", *id) } + lb, err := lbClient.Get(ctx, id.ResourceGroup, id.LoadBalancerName, "") + if err != nil { + return fmt.Errorf("retrieving Load Balancer %q (Resource Group %q): %+v", id.LoadBalancerName, id.ResourceGroup, err) + } + var backendAddress *network.LoadBalancerBackendAddress if pool.BackendAddressPoolPropertiesFormat.LoadBalancerBackendAddresses != nil { for _, address := range *pool.BackendAddressPoolPropertiesFormat.LoadBalancerBackendAddresses { @@ -197,15 +264,40 @@ func (r BackendAddressPoolAddressResource) Read() sdk.ResourceFunc { } if props := backendAddress.LoadBalancerBackendAddressPropertiesFormat; props != nil { - if props.IPAddress != nil { - model.IPAddress = *props.IPAddress - } + if lb.Sku.Tier == network.LoadBalancerSkuTierGlobal { + if props.LoadBalancerFrontendIPConfiguration != nil && props.LoadBalancerFrontendIPConfiguration.ID != nil { + model.FrontendIPConfiguration = *props.LoadBalancerFrontendIPConfiguration.ID + } + } else { + if props.IPAddress != nil { + model.IPAddress = *props.IPAddress + } - if props.VirtualNetwork != nil && props.VirtualNetwork.ID != nil { - model.VirtualNetworkId = *props.VirtualNetwork.ID + if props.VirtualNetwork != nil && props.VirtualNetwork.ID != nil { + model.VirtualNetworkId = *props.VirtualNetwork.ID + } } } + var inboundNATRulePortMappingList []inboundNATRulePortMapping + if rules := backendAddress.LoadBalancerBackendAddressPropertiesFormat.InboundNatRulesPortMapping; rules != nil { + for _, rule := range *rules { + rulePortMapping := inboundNATRulePortMapping{} + + if rule.InboundNatRuleName != nil { + rulePortMapping.Name = *rule.InboundNatRuleName + } + if rule.FrontendPort != nil { + rulePortMapping.FrontendPort = *rule.FrontendPort + } + + if rule.BackendPort != nil { + rulePortMapping.BackendPort = *rule.BackendPort + } + inboundNATRulePortMappingList = append(inboundNATRulePortMappingList, rulePortMapping) + } + model.PortMapping = inboundNATRulePortMappingList + } return metadata.Encode(&model) }, Timeout: 5 * time.Minute, @@ -216,6 +308,7 @@ func (r BackendAddressPoolAddressResource) Delete() sdk.ResourceFunc { return sdk.ResourceFunc{ Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.LoadBalancers.LoadBalancerBackendAddressPoolsClient + lbClient := metadata.Client.LoadBalancers.LoadBalancersClient id, err := parse.BackendAddressPoolAddressID(metadata.ResourceData.Id()) if err != nil { return err @@ -232,6 +325,20 @@ func (r BackendAddressPoolAddressResource) Delete() sdk.ResourceFunc { return fmt.Errorf("retrieving %s: `properties` was nil", *id) } + timeout, _ := ctx.Deadline() + lbStatus := &pluginsdk.StateChangeConf{ + Pending: []string{string(network.ProvisioningStateUpdating)}, + Target: []string{string(network.ProvisioningStateSucceeded)}, + MinTimeout: 5 * time.Second, + Refresh: loadbalacnerProvisioningStatusRefreshFunc(ctx, lbClient, *id), + ContinuousTargetOccurence: 10, + Timeout: time.Until(timeout), + } + + if _, err := lbStatus.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for parent resource loadbalancer status to be ready error: %+v", err) + } + addresses := make([]network.LoadBalancerBackendAddress, 0) if pool.BackendAddressPoolPropertiesFormat.LoadBalancerBackendAddresses != nil { addresses = *pool.BackendAddressPoolPropertiesFormat.LoadBalancerBackendAddresses @@ -271,6 +378,7 @@ func (r BackendAddressPoolAddressResource) Update() sdk.ResourceFunc { return sdk.ResourceFunc{ Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.LoadBalancers.LoadBalancerBackendAddressPoolsClient + lbClient := metadata.Client.LoadBalancers.LoadBalancersClient id, err := parse.BackendAddressPoolAddressID(metadata.ResourceData.Id()) if err != nil { return err @@ -292,6 +400,11 @@ func (r BackendAddressPoolAddressResource) Update() sdk.ResourceFunc { return fmt.Errorf("retrieving %s: `properties` was nil", *id) } + lb, err := lbClient.Get(ctx, id.ResourceGroup, id.LoadBalancerName, "") + if err != nil { + return fmt.Errorf("retrieving Load Balancer %q (Resource Group %q): %+v", id.LoadBalancerName, id.ResourceGroup, err) + } + addresses := make([]network.LoadBalancerBackendAddress, 0) if pool.BackendAddressPoolPropertiesFormat.LoadBalancerBackendAddresses != nil { addresses = *pool.BackendAddressPoolPropertiesFormat.LoadBalancerBackendAddresses @@ -311,17 +424,43 @@ func (r BackendAddressPoolAddressResource) Update() sdk.ResourceFunc { return fmt.Errorf("%s was not found", *id) } - addresses[index] = network.LoadBalancerBackendAddress{ - LoadBalancerBackendAddressPropertiesFormat: &network.LoadBalancerBackendAddressPropertiesFormat{ - IPAddress: utils.String(model.IPAddress), - VirtualNetwork: &network.SubResource{ - ID: utils.String(model.VirtualNetworkId), + if lb.Sku.Tier == network.LoadBalancerSkuTierGlobal { + addresses[index] = network.LoadBalancerBackendAddress{ + Name: utils.String(model.Name), + LoadBalancerBackendAddressPropertiesFormat: &network.LoadBalancerBackendAddressPropertiesFormat{ + LoadBalancerFrontendIPConfiguration: &network.SubResource{ + ID: utils.String(model.FrontendIPConfiguration), + }, }, - }, - Name: utils.String(id.AddressName), + } + } else { + addresses[index] = network.LoadBalancerBackendAddress{ + LoadBalancerBackendAddressPropertiesFormat: &network.LoadBalancerBackendAddressPropertiesFormat{ + IPAddress: utils.String(model.IPAddress), + VirtualNetwork: &network.SubResource{ + ID: utils.String(model.VirtualNetworkId), + }, + }, + Name: utils.String(id.AddressName), + } } pool.BackendAddressPoolPropertiesFormat.LoadBalancerBackendAddresses = &addresses + timeout, _ := ctx.Deadline() + lbStatus := &pluginsdk.StateChangeConf{ + Pending: []string{string(network.ProvisioningStateUpdating)}, + Target: []string{string(network.ProvisioningStateSucceeded)}, + MinTimeout: 5 * time.Minute, + PollInterval: 10 * time.Second, + Refresh: loadbalacnerProvisioningStatusRefreshFunc(ctx, lbClient, *id), + ContinuousTargetOccurence: 10, + Timeout: time.Until(timeout), + } + + if _, err := lbStatus.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for parent resource loadbalancer status to be ready error: %+v", err) + } + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.LoadBalancerName, id.BackendAddressPoolName, pool) if err != nil { return fmt.Errorf("updating %s: %+v", *id, err) @@ -334,3 +473,13 @@ func (r BackendAddressPoolAddressResource) Update() sdk.ResourceFunc { Timeout: 30 * time.Minute, } } + +func loadbalacnerProvisioningStatusRefreshFunc(ctx context.Context, client *network.LoadBalancersClient, id parse.BackendAddressPoolAddressId) pluginsdk.StateRefreshFunc { + return func() (interface{}, string, error) { + lbClient, err := client.Get(ctx, id.ResourceGroup, id.LoadBalancerName, "") + if err != nil { + return nil, "", fmt.Errorf("retrieving load balancer error: %+v", err) + } + return lbClient, string(lbClient.ProvisioningState), nil + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/backend_address_pool_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/backend_address_pool_data_source.go index 3e9c744e86a..0b19f540b8e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/backend_address_pool_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/backend_address_pool_data_source.go @@ -53,6 +53,27 @@ func dataSourceArmLoadBalancerBackendAddressPool() *pluginsdk.Resource { Type: pluginsdk.TypeString, Computed: true, }, + + "inbound_nat_rule_port_mapping": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "inbound_nat_rule_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + "frontend_port": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "backend_port": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + }, + }, + }, }, }, }, @@ -85,6 +106,14 @@ func dataSourceArmLoadBalancerBackendAddressPool() *pluginsdk.Resource { Type: pluginsdk.TypeString, }, }, + + "inbound_nat_rules": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, }, } } @@ -155,6 +184,19 @@ func dataSourceArmLoadBalancerBackendAddressPoolRead(d *pluginsdk.ResourceData, if err := d.Set("outbound_rules", outboundRules); err != nil { return fmt.Errorf("setting `outbound_rules`: %v", err) } + + var inboundNATRules []string + if rules := props.InboundNatRules; rules != nil { + for _, rule := range *rules { + if rule.ID == nil { + continue + } + inboundNATRules = append(inboundNATRules, *rule.ID) + } + } + if err := d.Set("inbound_nat_rules", inboundNATRules); err != nil { + return fmt.Errorf("setting `inbound_nat_rules`: %v", err) + } } return nil @@ -177,6 +219,7 @@ func flattenArmLoadBalancerBackendAddresses(input *[]network.LoadBalancerBackend ipAddress string vnetId string ) + var inboundNATRulePortMappingList []interface{} if prop := e.LoadBalancerBackendAddressPropertiesFormat; prop != nil { if prop.IPAddress != nil { ipAddress = *prop.IPAddress @@ -184,12 +227,31 @@ func flattenArmLoadBalancerBackendAddresses(input *[]network.LoadBalancerBackend if prop.VirtualNetwork != nil && prop.VirtualNetwork.ID != nil { vnetId = *prop.VirtualNetwork.ID } + if prop.InboundNatRulesPortMapping != nil { + rules := prop.InboundNatRulesPortMapping + for _, rule := range *rules { + rulePortMapping := make(map[string]interface{}) + + if rule.InboundNatRuleName != nil { + rulePortMapping["inbound_nat_rule_name"] = *rule.InboundNatRuleName + } + if rule.FrontendPort != nil { + rulePortMapping["frontendPort"] = *rule.FrontendPort + } + + if rule.BackendPort != nil { + rulePortMapping["backendPort"] = *rule.BackendPort + } + inboundNATRulePortMappingList = append(inboundNATRulePortMappingList, rulePortMapping) + } + } } v := map[string]interface{}{ - "name": name, - "virtual_network_id": vnetId, - "ip_address": ipAddress, + "name": name, + "virtual_network_id": vnetId, + "ip_address": ipAddress, + "inbound_nat_rule_port_mapping": inboundNATRulePortMappingList, } output = append(output, v) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/backend_address_pool_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/backend_address_pool_resource.go index 53efb9f5046..c6e4407c413 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/backend_address_pool_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/backend_address_pool_resource.go @@ -109,6 +109,14 @@ func resourceArmLoadBalancerBackendAddressPool() *pluginsdk.Resource { }, }, + "inbound_nat_rules": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + "load_balancing_rules": { Type: pluginsdk.TypeList, Computed: true, @@ -312,6 +320,19 @@ func resourceArmLoadBalancerBackendAddressPoolRead(d *pluginsdk.ResourceData, me if err := d.Set("outbound_rules", outboundRules); err != nil { return fmt.Errorf("setting `outbound_rules`: %v", err) } + + var inboundNATRules []string + if rules := props.InboundNatRules; rules != nil { + for _, rule := range *rules { + if rule.ID == nil { + continue + } + inboundNATRules = append(inboundNATRules, *rule.ID) + } + } + if err := d.Set("inbound_nat_rules", inboundNATRules); err != nil { + return fmt.Errorf("setting `inbound_nat_rules`: %v", err) + } } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/loadbalancer_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/loadbalancer_resource.go index 7cceac28412..944e065427f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/loadbalancer_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/loadbalancer_resource.go @@ -6,22 +6,20 @@ import ( "strings" "time" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/state" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" - - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/state" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/nat_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/nat_rule_resource.go index 1dcfa6f1843..9a3468fe4b6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/nat_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/nat_rule_resource.go @@ -71,9 +71,10 @@ func resourceArmLoadBalancerNatRule() *pluginsdk.Resource { }, "frontend_port": { - Type: pluginsdk.TypeInt, - Required: true, - ValidateFunc: validate.PortNumberOrZero, + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validate.PortNumberOrZero, + ConflictsWith: []string{"frontend_port_start", "frontend_port_end", "backend_address_pool_id"}, }, "backend_port": { @@ -101,6 +102,30 @@ func resourceArmLoadBalancerNatRule() *pluginsdk.Resource { Optional: true, }, + "backend_address_pool_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: azure.ValidateResourceID, + ConflictsWith: []string{"frontend_port"}, + RequiredWith: []string{"frontend_port_start", "frontend_port_end"}, + }, + + "frontend_port_start": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validate.PortNumber, + RequiredWith: []string{"backend_address_pool_id", "frontend_port_end"}, + ConflictsWith: []string{"frontend_port"}, + }, + + "frontend_port_end": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validate.PortNumber, + RequiredWith: []string{"backend_address_pool_id", "frontend_port_start"}, + ConflictsWith: []string{"frontend_port"}, + }, + "idle_timeout_in_minutes": { Type: pluginsdk.TypeInt, Optional: true, @@ -241,11 +266,22 @@ func resourceArmLoadBalancerNatRuleRead(d *pluginsdk.ResourceData, meta interfac d.Set("frontend_ip_configuration_name", frontendIPConfigName) d.Set("frontend_ip_configuration_id", frontendIPConfigID) + if props.BackendAddressPool != nil && props.BackendAddressPool.ID != nil { + d.Set("backend_address_pool_id", *props.BackendAddressPool.ID) + } + frontendPort := 0 if props.FrontendPort != nil { frontendPort = int(*props.FrontendPort) + d.Set("frontend_port", frontendPort) + } + + if props.FrontendPortRangeStart != nil { + d.Set("frontend_port_start", int(*props.FrontendPortRangeStart)) + } + if props.FrontendPortRangeEnd != nil { + d.Set("frontend_port_end", int(*props.FrontendPortRangeEnd)) } - d.Set("frontend_port", frontendPort) idleTimeoutInMinutes := 0 if props.IdleTimeoutInMinutes != nil { @@ -305,11 +341,33 @@ func resourceArmLoadBalancerNatRuleDelete(d *pluginsdk.ResourceData, meta interf func expandAzureRmLoadBalancerNatRule(d *pluginsdk.ResourceData, lb *network.LoadBalancer, loadBalancerId parse.LoadBalancerId) (*network.InboundNatRule, error) { properties := network.InboundNatRulePropertiesFormat{ Protocol: network.TransportProtocol(d.Get("protocol").(string)), - FrontendPort: utils.Int32(int32(d.Get("frontend_port").(int))), BackendPort: utils.Int32(int32(d.Get("backend_port").(int))), EnableTCPReset: utils.Bool(d.Get("enable_tcp_reset").(bool)), } + backendAddressPoolSet, frontendPort := false, false + if port := d.Get("frontend_port"); port != "" { + frontendPort = true + } + if _, ok := d.GetOk("backend_address_pool_id"); ok { + backendAddressPoolSet = true + } + + if backendAddressPoolSet { + properties.FrontendPortRangeStart = utils.Int32(int32(d.Get("frontend_port_start").(int))) + properties.FrontendPortRangeEnd = utils.Int32(int32(d.Get("frontend_port_end").(int))) + properties.BackendAddressPool = &network.SubResource{ + ID: utils.String(d.Get("backend_address_pool_id").(string)), + } + } else { + if frontendPort { + properties.FrontendPort = utils.Int32(int32(d.Get("frontend_port").(int))) + } else { + properties.FrontendPortRangeStart = utils.Int32(int32(d.Get("frontend_port_start").(int))) + properties.FrontendPortRangeEnd = utils.Int32(int32(d.Get("frontend_port_end").(int))) + } + } + if v, ok := d.GetOk("enable_floating_ip"); ok { properties.EnableFloatingIP = utils.Bool(v.(bool)) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/rule_resource.go index 6f18a329afb..00f1cb05c96 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/rule_resource.go @@ -5,14 +5,13 @@ import ( "log" "time" - "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" - loadBalancerValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/validate" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse" + loadBalancerValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/client/client.go index 197896d1e61..a02b4d71cd4 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/client/client.go @@ -1,8 +1,8 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/load_test_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/load_test_resource.go index bad96bc72a7..8684fa1374f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/load_test_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/load_test_resource.go @@ -8,9 +8,9 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/client.go deleted file mode 100644 index 615a0e4c347..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package loadtests - -import "github.com/Azure/go-autorest/autorest" - -type LoadTestsClient struct { - Client autorest.Client - baseUri string -} - -func NewLoadTestsClientWithBaseURI(endpoint string) LoadTestsClient { - return LoadTestsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/constants.go deleted file mode 100644 index b57fc3017d1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/constants.go +++ /dev/null @@ -1,71 +0,0 @@ -package loadtests - -import "strings" - -type CreatedByType string - -const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" -) - -func PossibleValuesForCreatedByType() []string { - return []string{ - string(CreatedByTypeApplication), - string(CreatedByTypeKey), - string(CreatedByTypeManagedIdentity), - string(CreatedByTypeUser), - } -} - -func parseCreatedByType(input string) (*CreatedByType, error) { - vals := map[string]CreatedByType{ - "application": CreatedByTypeApplication, - "key": CreatedByTypeKey, - "managedidentity": CreatedByTypeManagedIdentity, - "user": CreatedByTypeUser, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CreatedByType(input) - return &out, nil -} - -type ResourceState string - -const ( - ResourceStateCanceled ResourceState = "Canceled" - ResourceStateDeleted ResourceState = "Deleted" - ResourceStateFailed ResourceState = "Failed" - ResourceStateSucceeded ResourceState = "Succeeded" -) - -func PossibleValuesForResourceState() []string { - return []string{ - string(ResourceStateCanceled), - string(ResourceStateDeleted), - string(ResourceStateFailed), - string(ResourceStateSucceeded), - } -} - -func parseResourceState(input string) (*ResourceState, error) { - vals := map[string]ResourceState{ - "canceled": ResourceStateCanceled, - "deleted": ResourceStateDeleted, - "failed": ResourceStateFailed, - "succeeded": ResourceStateSucceeded, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ResourceState(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/id_resourcegroup.go deleted file mode 100644 index de40c8e710d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package loadtests - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/id_subscription.go deleted file mode 100644 index eca81c8a708..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package loadtests - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_createorupdate_autorest.go deleted file mode 100644 index 26541a1ddfb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_createorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package loadtests - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateOrUpdateResponse struct { - HttpResponse *http.Response - Model *LoadTestResource -} - -// CreateOrUpdate ... -func (c LoadTestsClient) CreateOrUpdate(ctx context.Context, id LoadTestId, input LoadTestResource) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c LoadTestsClient) preparerForCreateOrUpdate(ctx context.Context, id LoadTestId, input LoadTestResource) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c LoadTestsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_delete_autorest.go deleted file mode 100644 index 9b8d450ddfe..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_delete_autorest.go +++ /dev/null @@ -1,73 +0,0 @@ -package loadtests - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c LoadTestsClient) Delete(ctx context.Context, id LoadTestId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c LoadTestsClient) DeleteThenPoll(ctx context.Context, id LoadTestId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c LoadTestsClient) preparerForDelete(ctx context.Context, id LoadTestId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c LoadTestsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_get_autorest.go deleted file mode 100644 index c8b624c179e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package loadtests - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *LoadTestResource -} - -// Get ... -func (c LoadTestsClient) Get(ctx context.Context, id LoadTestId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c LoadTestsClient) preparerForGet(ctx context.Context, id LoadTestId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c LoadTestsClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_listbyresourcegroup_autorest.go deleted file mode 100644 index de26e83e781..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package loadtests - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *[]LoadTestResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []LoadTestResource -} - -func (r ListByResourceGroupResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c LoadTestsClient) ListByResourceGroup(ctx context.Context, id ResourceGroupId) (resp ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c LoadTestsClient) ListByResourceGroupComplete(ctx context.Context, id ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, LoadTestResourcePredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c LoadTestsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate LoadTestResourcePredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]LoadTestResource, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c LoadTestsClient) preparerForListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.LoadTestService/loadTests", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c LoadTestsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c LoadTestsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - type page struct { - Values []LoadTestResource `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_listbysubscription_autorest.go deleted file mode 100644 index 8b6fa725db8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_listbysubscription_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package loadtests - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListBySubscriptionResponse struct { - HttpResponse *http.Response - Model *[]LoadTestResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []LoadTestResource -} - -func (r ListBySubscriptionResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListBySubscriptionResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListBySubscription ... -func (c LoadTestsClient) ListBySubscription(ctx context.Context, id SubscriptionId) (resp ListBySubscriptionResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c LoadTestsClient) ListBySubscriptionComplete(ctx context.Context, id SubscriptionId) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, LoadTestResourcePredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c LoadTestsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate LoadTestResourcePredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]LoadTestResource, 0) - - page, err := c.ListBySubscription(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c LoadTestsClient) preparerForListBySubscription(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.LoadTestService/loadTests", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c LoadTestsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListBySubscription handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (c LoadTestsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionResponse, err error) { - type page struct { - Values []LoadTestResource `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionResponse, err error) { - req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_update_autorest.go deleted file mode 100644 index 0b4964eaa6e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/method_update_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package loadtests - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UpdateResponse struct { - HttpResponse *http.Response - Model *LoadTestResource -} - -// Update ... -func (c LoadTestsClient) Update(ctx context.Context, id LoadTestId, input LoadTestResourcePatchRequestBody) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "loadtests.LoadTestsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c LoadTestsClient) preparerForUpdate(ctx context.Context, id LoadTestId, input LoadTestResourcePatchRequestBody) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c LoadTestsClient) responderForUpdate(resp *http.Response) (result UpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/model_loadtestproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/model_loadtestproperties.go deleted file mode 100644 index 48ab16ddac1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/model_loadtestproperties.go +++ /dev/null @@ -1,7 +0,0 @@ -package loadtests - -type LoadTestProperties struct { - DataPlaneURI *string `json:"dataPlaneURI,omitempty"` - Description *string `json:"description,omitempty"` - ProvisioningState *ResourceState `json:"provisioningState,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/model_loadtestresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/model_loadtestresource.go deleted file mode 100644 index 54fad11ac95..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/model_loadtestresource.go +++ /dev/null @@ -1,16 +0,0 @@ -package loadtests - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" -) - -type LoadTestResource struct { - Id *string `json:"id,omitempty"` - Identity *identity.SystemAssigned `json:"identity,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *LoadTestProperties `json:"properties,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/model_loadtestresourcepatchrequestbody.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/model_loadtestresourcepatchrequestbody.go deleted file mode 100644 index 3fe109d08e0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/model_loadtestresourcepatchrequestbody.go +++ /dev/null @@ -1,11 +0,0 @@ -package loadtests - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" -) - -type LoadTestResourcePatchRequestBody struct { - Identity *identity.SystemAssigned `json:"identity,omitempty"` - Properties *LoadTestResourcePatchRequestBodyProperties `json:"properties,omitempty"` - Tags *interface{} `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/model_loadtestresourcepatchrequestbodyproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/model_loadtestresourcepatchrequestbodyproperties.go deleted file mode 100644 index a8c331de9b6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/model_loadtestresourcepatchrequestbodyproperties.go +++ /dev/null @@ -1,5 +0,0 @@ -package loadtests - -type LoadTestResourcePatchRequestBodyProperties struct { - Description *string `json:"description,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/model_systemdata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/model_systemdata.go deleted file mode 100644 index 93df768764f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/model_systemdata.go +++ /dev/null @@ -1,40 +0,0 @@ -package loadtests - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type SystemData struct { - CreatedAt *string `json:"createdAt,omitempty"` - CreatedBy *string `json:"createdBy,omitempty"` - CreatedByType *CreatedByType `json:"createdByType,omitempty"` - LastModifiedAt *string `json:"lastModifiedAt,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` -} - -func (o SystemData) GetCreatedAtAsTime() (*time.Time, error) { - if o.CreatedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o SystemData) SetCreatedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreatedAt = &formatted -} - -func (o SystemData) GetLastModifiedAtAsTime() (*time.Time, error) { - if o.LastModifiedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModifiedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o SystemData) SetLastModifiedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModifiedAt = &formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/predicates.go deleted file mode 100644 index e238a7b39b6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/predicates.go +++ /dev/null @@ -1,29 +0,0 @@ -package loadtests - -type LoadTestResourcePredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p LoadTestResourcePredicate) Matches(input LoadTestResource) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/version.go deleted file mode 100644 index 44e651a5508..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package loadtests - -import "fmt" - -const defaultApiVersion = "2021-12-01-preview" - -func userAgent() string { - return fmt.Sprintf("pandora/loadtests/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/client/client.go index 844608189cd..ee112d396de 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/client/client.go @@ -3,6 +3,8 @@ package client import ( "github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2020-08-01/operationalinsights" "github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement" + "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks" + "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) @@ -12,11 +14,12 @@ type Client struct { DataSourcesClient *operationalinsights.DataSourcesClient LinkedServicesClient *operationalinsights.LinkedServicesClient LinkedStorageAccountClient *operationalinsights.LinkedStorageAccountsClient + QueryPacksClient *querypacks.QueryPacksClient SavedSearchesClient *operationalinsights.SavedSearchesClient SharedKeysClient *operationalinsights.SharedKeysClient SolutionsClient *operationsmanagement.SolutionsClient StorageInsightsClient *operationalinsights.StorageInsightConfigsClient - WorkspacesClient *operationalinsights.WorkspacesClient + WorkspacesClient *workspaces.WorkspacesClient } func NewClient(o *common.ClientOptions) *Client { @@ -29,7 +32,7 @@ func NewClient(o *common.ClientOptions) *Client { DataSourcesClient := operationalinsights.NewDataSourcesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&DataSourcesClient.Client, o.ResourceManagerAuthorizer) - WorkspacesClient := operationalinsights.NewWorkspacesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + WorkspacesClient := workspaces.NewWorkspacesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&WorkspacesClient.Client, o.ResourceManagerAuthorizer) SavedSearchesClient := operationalinsights.NewSavedSearchesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) @@ -50,12 +53,16 @@ func NewClient(o *common.ClientOptions) *Client { LinkedStorageAccountClient := operationalinsights.NewLinkedStorageAccountsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&LinkedStorageAccountClient.Client, o.ResourceManagerAuthorizer) + QueryPacksClient := querypacks.NewQueryPacksClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&QueryPacksClient.Client, o.ResourceManagerAuthorizer) + return &Client{ ClusterClient: &ClusterClient, DataExportClient: &DataExportClient, DataSourcesClient: &DataSourcesClient, LinkedServicesClient: &LinkedServicesClient, LinkedStorageAccountClient: &LinkedStorageAccountClient, + QueryPacksClient: &QueryPacksClient, SavedSearchesClient: &SavedSearchesClient, SharedKeysClient: &SharedKeysClient, SolutionsClient: &SolutionsClient, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_cluster_customer_managed_key_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_cluster_customer_managed_key_resource.go index 51b4b324dc3..4c34759829b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_cluster_customer_managed_key_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_cluster_customer_managed_key_resource.go @@ -5,13 +5,12 @@ import ( "log" "time" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/migration" - "github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2020-08-01/operationalinsights" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_cluster_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_cluster_resource.go index f2143acf801..b7c3f2532f7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_cluster_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_cluster_resource.go @@ -5,10 +5,9 @@ import ( "log" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2020-08-01/operationalinsights" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -54,17 +53,11 @@ func resourceLogAnalyticsCluster() *pluginsdk.Resource { "identity": commonschema.SystemAssignedIdentityRequiredForceNew(), - // Per the documentation cluster capacity must start at 1000 GB and can go above 3000 GB with an exception by Microsoft - // so I am not limiting the upperbound here by design - // https://docs.microsoft.com/en-us/azure/azure-monitor/platform/manage-cost-storage#log-analytics-dedicated-clusters "size_gb": { - Type: pluginsdk.TypeInt, - Optional: true, - Default: 1000, - ValidateFunc: validation.All( - validation.IntAtLeast(1000), - validation.IntDivisibleBy(100), - ), + Type: pluginsdk.TypeInt, + Optional: true, + Default: 1000, + ValidateFunc: validation.IntInSlice([]int{500, 1000, 2000, 5000}), }, "cluster_id": { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_data_export_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_data_export_resource.go index ea975f3c9f6..01feeeb602d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_data_export_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_data_export_resource.go @@ -3,9 +3,12 @@ package loganalytics import ( "fmt" "log" + "strings" "time" "github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2020-08-01/operationalinsights" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -107,16 +110,30 @@ func resourceOperationalinsightsDataExportCreateUpdate(d *pluginsdk.ResourceData } } + destinationId := d.Get("destination_resource_id").(string) + parameters := operationalinsights.DataExport{ DataExportProperties: &operationalinsights.DataExportProperties{ Destination: &operationalinsights.Destination{ - ResourceID: utils.String(d.Get("destination_resource_id").(string)), + ResourceID: utils.String(destinationId), }, TableNames: utils.ExpandStringSlice(d.Get("table_names").(*pluginsdk.Set).List()), Enable: utils.Bool(d.Get("enabled").(bool)), }, } + if strings.Contains(destinationId, "Microsoft.EventHub") { + eventhubId, err := eventhubs.ParseEventhubID(destinationId) + if err != nil { + return fmt.Errorf("parsing destination eventhub id error: %+v", err) + } + destinationId = namespaces.NewNamespaceID(eventhubId.SubscriptionId, eventhubId.ResourceGroupName, eventhubId.NamespaceName).ID() + parameters.DataExportProperties.Destination.ResourceID = utils.String(destinationId) + parameters.DataExportProperties.Destination.DestinationMetaData = &operationalinsights.DestinationMetaData{ + EventHubName: utils.String(eventhubId.EventHubName), + } + } + if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.WorkspaceName, id.DataexportName, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -149,7 +166,12 @@ func resourceOperationalinsightsDataExportRead(d *pluginsdk.ResourceData, meta i d.Set("workspace_resource_id", parse.NewLogAnalyticsWorkspaceID(id.SubscriptionId, id.ResourceGroup, id.WorkspaceName).ID()) if props := resp.DataExportProperties; props != nil { d.Set("export_rule_id", props.DataExportID) - d.Set("destination_resource_id", flattenDataExportDestination(props.Destination)) + + destinationId, err := flattenDataExportDestination(props.Destination) + if err != nil { + return fmt.Errorf("flattening destination ID error: %+v", err) + } + d.Set("destination_resource_id", destinationId) d.Set("enabled", props.Enable) d.Set("table_names", utils.FlattenStringSlice(props.TableNames)) } @@ -172,15 +194,26 @@ func resourceOperationalinsightsDataExportDelete(d *pluginsdk.ResourceData, meta return nil } -func flattenDataExportDestination(input *operationalinsights.Destination) string { +func flattenDataExportDestination(input *operationalinsights.Destination) (string, error) { if input == nil { - return "" + return "", nil } var resourceID string if input.ResourceID != nil { resourceID = *input.ResourceID + if input.Type == operationalinsights.TypeEventHub { + if input.DestinationMetaData != nil && input.DestinationMetaData.EventHubName != nil { + eventhubName := *input.DestinationMetaData.EventHubName + eventhubNamespaceId, err := eventhubs.ParseNamespaceID(resourceID) + eventhubId := eventhubs.NewEventhubID(eventhubNamespaceId.SubscriptionId, eventhubNamespaceId.ResourceGroupName, eventhubNamespaceId.NamespaceName, eventhubName) + if err != nil { + return "", fmt.Errorf("parsing destination eventhub namespace ID error") + } + resourceID = eventhubId.ID() + } + } } - return resourceID + return resourceID, nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_query_pack_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_query_pack_resource.go new file mode 100644 index 00000000000..75dff79e916 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_query_pack_resource.go @@ -0,0 +1,205 @@ +package loganalytics + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type LogAnalyticsQueryPackModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + Tags map[string]string `tfschema:"tags"` +} + +type LogAnalyticsQueryPackResource struct{} + +var _ sdk.ResourceWithUpdate = LogAnalyticsQueryPackResource{} + +func (r LogAnalyticsQueryPackResource) ResourceType() string { + return "azurerm_log_analytics_query_pack" +} + +func (r LogAnalyticsQueryPackResource) ModelObject() interface{} { + return &LogAnalyticsQueryPackModel{} +} + +func (r LogAnalyticsQueryPackResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return querypacks.ValidateQueryPackID +} + +func (r LogAnalyticsQueryPackResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "tags": commonschema.Tags(), + } +} + +func (r LogAnalyticsQueryPackResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r LogAnalyticsQueryPackResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model LogAnalyticsQueryPackModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + client := metadata.Client.LogAnalytics.QueryPacksClient + subscriptionId := metadata.Client.Account.SubscriptionId + + id := querypacks.NewQueryPackID(subscriptionId, model.ResourceGroupName, model.Name) + + existing, err := client.QueryPacksGet(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + properties := &querypacks.LogAnalyticsQueryPack{ + Location: location.Normalize(model.Location), + Properties: querypacks.LogAnalyticsQueryPackProperties{}, + Tags: &model.Tags, + } + + if resp, err := client.QueryPacksCreateOrUpdate(ctx, id, *properties); err != nil { + // update check logic once the issue https://github.com/Azure/azure-rest-api-specs/issues/19603 is fixed + if !response.WasStatusCode(resp.HttpResponse, http.StatusCreated) { + return fmt.Errorf("creating %s: %+v", id, err) + } + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r LogAnalyticsQueryPackResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.LogAnalytics.QueryPacksClient + + id, err := querypacks.ParseQueryPackID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model LogAnalyticsQueryPackModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + resp, err := client.QueryPacksGet(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + properties := resp.Model + if properties == nil { + return fmt.Errorf("retrieving %s: properties was nil", id) + } + + if metadata.ResourceData.HasChange("tags") { + properties.Tags = &model.Tags + } + + if resp, err := client.QueryPacksCreateOrUpdate(ctx, *id, *properties); err != nil { + // update check logic once the issue https://github.com/Azure/azure-rest-api-specs/issues/19603 is fixed + if !response.WasStatusCode(resp.HttpResponse, http.StatusCreated) { + return fmt.Errorf("updating %s: %+v", *id, err) + } + } + + return nil + }, + } +} + +func (r LogAnalyticsQueryPackResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.LogAnalytics.QueryPacksClient + + id, err := querypacks.ParseQueryPackID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.QueryPacksGet(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + model := resp.Model + if model == nil { + return fmt.Errorf("retrieving %s: model was nil", id) + } + + state := LogAnalyticsQueryPackModel{ + Name: id.QueryPackName, + ResourceGroupName: id.ResourceGroupName, + Location: location.NormalizeNilable(utils.String(model.Location)), + } + + if model.Tags != nil { + state.Tags = *model.Tags + } + + return metadata.Encode(&state) + }, + } +} + +func (r LogAnalyticsQueryPackResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.LogAnalytics.QueryPacksClient + + id, err := querypacks.ParseQueryPackID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if _, err := client.QueryPacksDelete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_saved_search_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_saved_search_resource.go index 53de455e050..d70bce3aacc 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_saved_search_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_saved_search_resource.go @@ -6,11 +6,10 @@ import ( "strings" "time" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/migration" - "github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2020-08-01/operationalinsights" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_workspace_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_workspace_data_source.go index cc77c47bce4..e1ebeb2937f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_workspace_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_workspace_data_source.go @@ -5,11 +5,12 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -65,7 +66,7 @@ func dataSourceLogAnalyticsWorkspace() *pluginsdk.Resource { Sensitive: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -79,32 +80,42 @@ func dataSourceLogAnalyticsWorkspaceRead(d *pluginsdk.ResourceData, meta interfa name := d.Get("name").(string) resGroup := d.Get("resource_group_name").(string) + id := workspaces.NewWorkspaceID(subscriptionId, resGroup, name) - resp, err := client.Get(ctx, resGroup, name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("log analytics workspaces %q (Resource Group %q) was not found", name, resGroup) } return fmt.Errorf("making Read request on AzureRM Log Analytics workspaces '%s': %+v", name, err) } - id := parse.NewLogAnalyticsWorkspaceID(subscriptionId, resGroup, name) d.SetId(id.ID()) - d.Set("name", resp.Name) - d.Set("resource_group_name", resGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.WorkspaceName) + d.Set("resource_group_name", id.ResourceGroupName) - d.Set("workspace_id", resp.CustomerID) - if sku := resp.Sku; sku != nil { - d.Set("sku", sku.Name) - } - d.Set("retention_in_days", resp.RetentionInDays) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) - if workspaceCapping := resp.WorkspaceCapping; workspaceCapping != nil { - d.Set("daily_quota_gb", resp.WorkspaceCapping.DailyQuotaGb) - } else { - d.Set("daily_quota_gb", utils.Float(-1)) + if props := model.Properties; props != nil { + d.Set("workspace_id", props.CustomerId) + + if sku := props.Sku; sku != nil { + d.Set("sku", sku.Name) + } + d.Set("retention_in_days", props.RetentionInDays) + + if workspaceCapping := props.WorkspaceCapping; workspaceCapping != nil { + d.Set("daily_quota_gb", workspaceCapping.DailyQuotaGb) + } else { + d.Set("daily_quota_gb", utils.Float(-1)) + } + } + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return fmt.Errorf("setting `tags`: %+v", err) + } } sharedKeys, err := sharedKeysClient.GetSharedKeys(ctx, resGroup, name) @@ -115,5 +126,5 @@ func dataSourceLogAnalyticsWorkspaceRead(d *pluginsdk.ResourceData, meta interfa d.Set("secondary_shared_key", sharedKeys.SecondarySharedKey) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_workspace_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_workspace_resource.go index fa4b6538c69..14bc7deec0c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_workspace_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/log_analytics_workspace_resource.go @@ -7,15 +7,15 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2020-08-01/operationalinsights" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -32,7 +32,7 @@ func resourceLogAnalyticsWorkspace() *pluginsdk.Resource { CustomizeDiff: pluginsdk.CustomizeDiffShim(resourceLogAnalyticsWorkspaceCustomDiff), Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.LogAnalyticsWorkspaceID(id) + _, err := workspaces.ParseWorkspaceID(id) return err }), @@ -61,6 +61,11 @@ func resourceLogAnalyticsWorkspace() *pluginsdk.Resource { "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), + "cmk_for_query_forced": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + "internet_ingestion_enabled": { Type: pluginsdk.TypeBool, Optional: true, @@ -79,13 +84,13 @@ func resourceLogAnalyticsWorkspace() *pluginsdk.Resource { Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{ - string(operationalinsights.WorkspaceSkuNameEnumFree), - string(operationalinsights.WorkspaceSkuNameEnumPerGB2018), - string(operationalinsights.WorkspaceSkuNameEnumPerNode), - string(operationalinsights.WorkspaceSkuNameEnumPremium), - string(operationalinsights.WorkspaceSkuNameEnumStandalone), - string(operationalinsights.WorkspaceSkuNameEnumStandard), - string(operationalinsights.WorkspaceSkuNameEnumCapacityReservation), + string(workspaces.WorkspaceSkuNameEnumFree), + string(workspaces.WorkspaceSkuNameEnumPerGBTwoZeroOneEight), + string(workspaces.WorkspaceSkuNameEnumPerNode), + string(workspaces.WorkspaceSkuNameEnumPremium), + string(workspaces.WorkspaceSkuNameEnumStandalone), + string(workspaces.WorkspaceSkuNameEnumStandard), + string(workspaces.WorkspaceSkuNameEnumCapacityReservation), "Unlimited", // TODO check if this is actually no longer valid, removed in v28.0.0 of the SDK }, false), }, @@ -129,7 +134,7 @@ func resourceLogAnalyticsWorkspace() *pluginsdk.Resource { Sensitive: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -164,52 +169,54 @@ func resourceLogAnalyticsWorkspaceCreateUpdate(d *pluginsdk.ResourceData, meta i var isLACluster bool name := d.Get("name").(string) resourceGroup := d.Get("resource_group_name").(string) - id := parse.NewLogAnalyticsWorkspaceID(subscriptionId, resourceGroup, name) + id := workspaces.NewWorkspaceID(subscriptionId, resourceGroup, name) if d.IsNewResource() { - existing, err := client.Get(ctx, resourceGroup, name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing Log Analytics Workspace %q (Resource Group %q): %s", name, resourceGroup, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_log_analytics_workspace", id.ID()) } } location := azure.NormalizeLocation(d.Get("location").(string)) skuName := d.Get("sku").(string) - sku := &operationalinsights.WorkspaceSku{ - Name: operationalinsights.WorkspaceSkuNameEnum(skuName), + sku := &workspaces.WorkspaceSku{ + Name: workspaces.WorkspaceSkuNameEnum(skuName), } // (@WodansSon) - If the workspace is connected to a cluster via the linked service resource // the workspace SKU cannot be modified since the linked service owns the sku value within // the workspace once it is linked if !d.IsNewResource() { - resp, err := client.Get(ctx, id.ResourceGroup, id.WorkspaceName) + resp, err := client.Get(ctx, id) if err == nil { - if azSku := resp.Sku; azSku != nil { - if strings.EqualFold(string(azSku.Name), "lacluster") { - isLACluster = true - log.Printf("[INFO] Log Analytics Workspace %q (Resource Group %q): SKU is linked to Log Analytics cluster", name, resourceGroup) + if resp.Model != nil && resp.Model.Properties != nil { + if azSku := resp.Model.Properties.Sku; azSku != nil { + if strings.EqualFold(string(azSku.Name), "lacluster") { + isLACluster = true + log.Printf("[INFO] Log Analytics Workspace %q (Resource Group %q): SKU is linked to Log Analytics cluster", name, resourceGroup) + } } } } } - internetIngestionEnabled := operationalinsights.Disabled + internetIngestionEnabled := workspaces.PublicNetworkAccessTypeDisabled if d.Get("internet_ingestion_enabled").(bool) { - internetIngestionEnabled = operationalinsights.Enabled + internetIngestionEnabled = workspaces.PublicNetworkAccessTypeEnabled } - internetQueryEnabled := operationalinsights.Disabled + internetQueryEnabled := workspaces.PublicNetworkAccessTypeDisabled if d.Get("internet_query_enabled").(bool) { - internetQueryEnabled = operationalinsights.Enabled + internetQueryEnabled = workspaces.PublicNetworkAccessTypeEnabled } - retentionInDays := int32(d.Get("retention_in_days").(int)) + retentionInDays := int64(d.Get("retention_in_days").(int)) t := d.Get("tags").(map[string]interface{}) @@ -217,26 +224,30 @@ func resourceLogAnalyticsWorkspaceCreateUpdate(d *pluginsdk.ResourceData, meta i sku.Name = "lacluster" } else if skuName == "" { // Default value if sku is not defined - sku.Name = operationalinsights.WorkspaceSkuNameEnumPerGB2018 + sku.Name = workspaces.WorkspaceSkuNameEnumPerGBTwoZeroOneEight } - parameters := operationalinsights.Workspace{ + parameters := workspaces.Workspace{ Name: &name, - Location: &location, + Location: location, Tags: tags.Expand(t), - WorkspaceProperties: &operationalinsights.WorkspaceProperties{ + Properties: &workspaces.WorkspaceProperties{ Sku: sku, - PublicNetworkAccessForIngestion: internetIngestionEnabled, - PublicNetworkAccessForQuery: internetQueryEnabled, + PublicNetworkAccessForIngestion: &internetIngestionEnabled, + PublicNetworkAccessForQuery: &internetQueryEnabled, RetentionInDays: &retentionInDays, }, } + if v, ok := d.GetOkExists("cmk_for_query_forced"); ok { + parameters.Properties.ForceCmkForQuery = utils.Bool(v.(bool)) + } + dailyQuotaGb, ok := d.GetOk("daily_quota_gb") - if ok && strings.EqualFold(skuName, string(operationalinsights.WorkspaceSkuNameEnumFree)) && (dailyQuotaGb != -1 && dailyQuotaGb != 0.5) { + if ok && strings.EqualFold(skuName, string(workspaces.WorkspaceSkuNameEnumFree)) && (dailyQuotaGb != -1 && dailyQuotaGb != 0.5) { return fmt.Errorf("`Free` tier SKU quota is not configurable and is hard set to 0.5GB") - } else if !strings.EqualFold(skuName, string(operationalinsights.WorkspaceSkuNameEnumFree)) { - parameters.WorkspaceProperties.WorkspaceCapping = &operationalinsights.WorkspaceCapping{ + } else if !strings.EqualFold(skuName, string(workspaces.WorkspaceSkuNameEnumFree)) { + parameters.Properties.WorkspaceCapping = &workspaces.WorkspaceCapping{ DailyQuotaGb: utils.Float(dailyQuotaGb.(float64)), } } @@ -244,24 +255,19 @@ func resourceLogAnalyticsWorkspaceCreateUpdate(d *pluginsdk.ResourceData, meta i propName := "reservation_capacity_in_gb_per_day" capacityReservationLevel, ok := d.GetOk(propName) if ok { - if strings.EqualFold(skuName, string(operationalinsights.WorkspaceSkuNameEnumCapacityReservation)) { - parameters.WorkspaceProperties.Sku.CapacityReservationLevel = utils.Int32((int32(capacityReservationLevel.(int)))) + if strings.EqualFold(skuName, string(workspaces.WorkspaceSkuNameEnumCapacityReservation)) { + parameters.Properties.Sku.CapacityReservationLevel = utils.Int64((int64(capacityReservationLevel.(int)))) } else { return fmt.Errorf("`%s` can only be used with the `CapacityReservation` SKU", propName) } } else { - if strings.EqualFold(skuName, string(operationalinsights.WorkspaceSkuNameEnumCapacityReservation)) { + if strings.EqualFold(skuName, string(workspaces.WorkspaceSkuNameEnumCapacityReservation)) { return fmt.Errorf("`%s` must be set when using the `CapacityReservation` SKU", propName) } } - future, err := client.CreateOrUpdate(ctx, resourceGroup, name, parameters) - if err != nil { - return err - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return err + if err := client.CreateOrUpdateThenPoll(ctx, id, parameters); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } d.SetId(id.ID()) @@ -274,55 +280,63 @@ func resourceLogAnalyticsWorkspaceRead(d *pluginsdk.ResourceData, meta interface sharedKeysClient := meta.(*clients.Client).LogAnalytics.SharedKeysClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.LogAnalyticsWorkspaceID(d.Id()) + id, err := workspaces.ParseWorkspaceID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.WorkspaceName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("making Read request on AzureRM Log Analytics workspaces '%s': %+v", id.WorkspaceName, err) } - d.Set("name", resp.Name) - d.Set("resource_group_name", id.ResourceGroup) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } - - d.Set("internet_ingestion_enabled", resp.PublicNetworkAccessForIngestion == operationalinsights.Enabled) - d.Set("internet_query_enabled", resp.PublicNetworkAccessForQuery == operationalinsights.Enabled) + d.Set("name", id.WorkspaceName) + d.Set("resource_group_name", id.ResourceGroupName) + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) + + if props := model.Properties; props != nil { + d.Set("internet_ingestion_enabled", *props.PublicNetworkAccessForIngestion == workspaces.PublicNetworkAccessTypeEnabled) + d.Set("internet_query_enabled", *props.PublicNetworkAccessForQuery == workspaces.PublicNetworkAccessTypeEnabled) + d.Set("workspace_id", props.CustomerId) + + skuName := "" + if sku := props.Sku; sku != nil { + for _, v := range workspaces.PossibleValuesForWorkspaceSkuNameEnum() { + if strings.EqualFold(v, string(sku.Name)) { + skuName = v + } + } - d.Set("workspace_id", resp.CustomerID) - skuName := "" - if sku := resp.Sku; sku != nil { - for _, v := range operationalinsights.PossibleSkuNameEnumValues() { - if strings.EqualFold(string(v), string(sku.Name)) { - skuName = string(v) + if capacityReservationLevel := sku.CapacityReservationLevel; capacityReservationLevel != nil { + d.Set("reservation_capacity_in_gb_per_day", capacityReservationLevel) + } + } + d.Set("sku", skuName) + + d.Set("cmk_for_query_forced", props.ForceCmkForQuery) + d.Set("retention_in_days", props.RetentionInDays) + + if props.Sku != nil && strings.EqualFold(string(props.Sku.Name), string(workspaces.WorkspaceSkuNameEnumFree)) { + // Special case for "Free" tier + d.Set("daily_quota_gb", utils.Float(0.5)) + } else if workspaceCapping := props.WorkspaceCapping; workspaceCapping != nil { + d.Set("daily_quota_gb", props.WorkspaceCapping.DailyQuotaGb) + } else { + d.Set("daily_quota_gb", utils.Float(-1)) } } - if capacityReservationLevel := sku.CapacityReservationLevel; capacityReservationLevel != nil { - d.Set("reservation_capacity_in_gb_per_day", capacityReservationLevel) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err } } - d.Set("sku", skuName) - - d.Set("retention_in_days", resp.RetentionInDays) - if resp.WorkspaceProperties != nil && resp.WorkspaceProperties.Sku != nil && strings.EqualFold(string(resp.WorkspaceProperties.Sku.Name), string(operationalinsights.WorkspaceSkuNameEnumFree)) { - // Special case for "Free" tier - d.Set("daily_quota_gb", utils.Float(0.5)) - } else if workspaceCapping := resp.WorkspaceCapping; workspaceCapping != nil { - d.Set("daily_quota_gb", resp.WorkspaceCapping.DailyQuotaGb) - } else { - d.Set("daily_quota_gb", utils.Float(-1)) - } - sharedKeys, err := sharedKeysClient.GetSharedKeys(ctx, id.ResourceGroup, id.WorkspaceName) + sharedKeys, err := sharedKeysClient.GetSharedKeys(ctx, id.ResourceGroupName, id.WorkspaceName) if err != nil { log.Printf("[ERROR] Unable to List Shared keys for Log Analytics workspaces %s: %+v", id.WorkspaceName, err) } else { @@ -330,27 +344,23 @@ func resourceLogAnalyticsWorkspaceRead(d *pluginsdk.ResourceData, meta interface d.Set("secondary_shared_key", sharedKeys.SecondarySharedKey) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceLogAnalyticsWorkspaceDelete(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).LogAnalytics.WorkspacesClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.LogAnalyticsWorkspaceID(d.Id()) + id, err := workspaces.ParseWorkspaceID(d.Id()) if err != nil { return err } PermanentlyDeleteOnDestroy := meta.(*clients.Client).Features.LogAnalyticsWorkspace.PermanentlyDeleteOnDestroy - future, err := client.Delete(ctx, id.ResourceGroup, id.WorkspaceName, utils.Bool(PermanentlyDeleteOnDestroy)) - if err != nil { - return fmt.Errorf("issuing AzureRM delete request for Log Analytics Workspaces '%s': %+v", id.WorkspaceName, err) + parameters := workspaces.DeleteOperationOptions{ + Force: utils.Bool(PermanentlyDeleteOnDestroy), } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for deletion of Log Analytics Worspace %q (Resource Group %q): %+v", id.WorkspaceName, id.ResourceGroup, err) - } + if err := client.DeleteThenPoll(ctx, *id, parameters); err != nil { + return fmt.Errorf("issuing AzureRM delete request for Log Analytics Workspaces '%s': %+v", id.WorkspaceName, err) } return nil @@ -358,7 +368,7 @@ func resourceLogAnalyticsWorkspaceDelete(d *pluginsdk.ResourceData, meta interfa func dailyQuotaGbDiffSuppressFunc(_, _, _ string, d *pluginsdk.ResourceData) bool { // (@jackofallops) - 'free' is a legacy special case that is always set to 0.5GB - if skuName := d.Get("sku").(string); strings.EqualFold(skuName, string(operationalinsights.WorkspaceSkuNameEnumFree)) { + if skuName := d.Get("sku").(string); strings.EqualFold(skuName, string(workspaces.WorkspaceSkuNameEnumFree)) { return true } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/migration/saved_search_v0_to_v1.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/migration/saved_search_v0_to_v1.go index 2e5cfc85b73..c73f122a480 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/migration/saved_search_v0_to_v1.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/migration/saved_search_v0_to_v1.go @@ -7,7 +7,6 @@ import ( "strings" "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/migration/workspace_v0_to_v1.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/migration/workspace_v0_to_v1.go index f35fc034823..4d3372058fd 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/migration/workspace_v0_to_v1.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/migration/workspace_v0_to_v1.go @@ -51,6 +51,11 @@ func workspaceSchemaForV0AndV1() map[string]*pluginsdk.Schema { ForceNew: true, }, + "cmk_for_query_forced": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + "internet_ingestion_enabled": { Type: pluginsdk.TypeBool, Optional: true, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/registration.go index 975f0e46ca6..1161e33c882 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/registration.go @@ -7,12 +7,25 @@ import ( type Registration struct{} -var _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +var ( + _ sdk.TypedServiceRegistration = Registration{} + _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +) func (r Registration) AssociatedGitHubLabel() string { return "service/log-analytics" } +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{} +} + +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + LogAnalyticsQueryPackResource{}, + } +} + // Name is the name of this Service func (r Registration) Name() string { return "Log Analytics" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/logic_app_standard_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/logic_app_standard_resource.go index dbea093deaf..7fe71b370b9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/logic_app_standard_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/logic_app_standard_resource.go @@ -7,11 +7,9 @@ import ( "strings" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/logic_app_workflow_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/logic_app_workflow_resource.go index 3b57d1101e8..8eb81b7cac8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/logic_app_workflow_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/logic_app_workflow_resource.go @@ -9,6 +9,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" @@ -17,7 +18,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logic/validate" - msiParser "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -881,7 +881,7 @@ func flattenLogicAppWorkflowIdentity(input *logic.ManagedServiceIdentity) (*[]in if input != nil { identityIds := map[string]identity.UserAssignedIdentityDetails{} for id := range input.UserAssignedIdentities { - parsedId, err := msiParser.UserAssignedIdentityIDInsensitively(id) + parsedId, err := commonids.ParseUserAssignedIdentityIDInsensitively(id) if err != nil { return nil, err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/client/client.go index f2dcd91a902..ee1d772446a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/client/client.go @@ -6,8 +6,10 @@ import ( ) type Client struct { - MonitorClient *logz.MonitorsClient - TagRuleClient *logz.TagRulesClient + MonitorClient *logz.MonitorsClient + TagRuleClient *logz.TagRulesClient + SubAccountClient *logz.SubAccountClient + SubAccountTagRuleClient *logz.SubAccountTagRulesClient } func NewClient(o *common.ClientOptions) *Client { @@ -17,8 +19,16 @@ func NewClient(o *common.ClientOptions) *Client { tagRuleClient := logz.NewTagRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&tagRuleClient.Client, o.ResourceManagerAuthorizer) + subAccountClient := logz.NewSubAccountClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&subAccountClient.Client, o.ResourceManagerAuthorizer) + + subAccountTagRuleClient := logz.NewSubAccountTagRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&subAccountTagRuleClient.Client, o.ResourceManagerAuthorizer) + return &Client{ - MonitorClient: &monitorClient, - TagRuleClient: &tagRuleClient, + MonitorClient: &monitorClient, + TagRuleClient: &tagRuleClient, + SubAccountClient: &subAccountClient, + SubAccountTagRuleClient: &subAccountTagRuleClient, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_common.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_common.go new file mode 100644 index 00000000000..2a603b2e4a8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_common.go @@ -0,0 +1,130 @@ +package logz + +import ( + "github.com/Azure/azure-sdk-for-go/services/logz/mgmt/2020-10-01/logz" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +const TagRuleName = "default" + +func SchemaUserInfo() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Required: true, + ForceNew: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "email": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "first_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 50), + }, + + "last_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 50), + }, + + "phone_number": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 40), + }, + }, + }, + } +} + +func expandUserInfo(input []interface{}) *logz.UserInfo { + if len(input) == 0 || input[0] == nil { + return nil + } + + v := input[0].(map[string]interface{}) + return &logz.UserInfo{ + FirstName: utils.String(v["first_name"].(string)), + LastName: utils.String(v["last_name"].(string)), + EmailAddress: utils.String(v["email"].(string)), + PhoneNumber: utils.String(v["phone_number"].(string)), + } +} + +func flattenUserInfo(input *logz.UserInfo) []interface{} { + if input == nil { + return make([]interface{}, 0) + } + + var firstName string + if input.FirstName != nil { + firstName = *input.FirstName + } + + var lastName string + if input.LastName != nil { + lastName = *input.LastName + } + + var email string + if input.EmailAddress != nil { + email = *input.EmailAddress + } + + var phoneNumber string + if input.PhoneNumber != nil { + phoneNumber = *input.PhoneNumber + } + + return []interface{}{ + map[string]interface{}{ + "first_name": firstName, + "last_name": lastName, + "email": email, + "phone_number": phoneNumber, + }, + } +} + +func schemaTagFilter() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 10, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "action": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + string(logz.TagActionInclude), + string(logz.TagActionExclude), + }, false), + }, + + "value": { + Type: pluginsdk.TypeString, + Optional: true, + }, + }, + }, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_monitor_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_monitor_resource.go index 896162b3b3e..cd95ca588fa 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_monitor_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_monitor_resource.go @@ -3,7 +3,6 @@ package logz import ( "fmt" "log" - "regexp" "time" "github.com/Azure/azure-sdk-for-go/services/logz/mgmt/2020-10-01/logz" @@ -13,6 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -42,13 +42,10 @@ func resourceLogzMonitor() *pluginsdk.Resource { Schema: map[string]*pluginsdk.Schema{ "name": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringMatch( - regexp.MustCompile(`^[\w\-]{1,32}$`), - `The name length must be from 1 to 32 characters. The name can only contain letters, numbers, hyphens and underscore.`, - ), + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.LogzMonitorName, }, "resource_group_name": azure.SchemaResourceGroupName(), @@ -126,43 +123,7 @@ func resourceLogzMonitor() *pluginsdk.Resource { }, }, - "user": { - Type: pluginsdk.TypeList, - Required: true, - ForceNew: true, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "email": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "first_name": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 50), - }, - - "last_name": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 50), - }, - - "phone_number": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 40), - }, - }, - }, - }, + "user": SchemaUserInfo(), "enabled": { Type: pluginsdk.TypeBool, @@ -204,7 +165,7 @@ func resourceLogzMonitorCreate(d *pluginsdk.ResourceData, meta interface{}) erro Properties: &logz.MonitorProperties{ LogzOrganizationProperties: expandMonitorOrganizationProperties(d), PlanData: expandMonitorPlanData(d.Get("plan").([]interface{})), - UserInfo: expandMonitorUserInfo(d.Get("user").([]interface{})), + UserInfo: expandUserInfo(d.Get("user").([]interface{})), MonitoringStatus: monitoringStatus, }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), @@ -255,7 +216,9 @@ func resourceLogzMonitorRead(d *pluginsdk.ResourceData, meta interface{}) error return fmt.Errorf("setting `plan`: %+v", err) } - d.Set("user", d.Get("user")) + if err := d.Set("user", flattenUserInfo(expandUserInfo(d.Get("user").([]interface{})))); err != nil { + return fmt.Errorf("setting `user`: %+v", err) + } } return tags.FlattenAndSet(d, resp.Tags) @@ -346,20 +309,6 @@ func expandMonitorPlanData(input []interface{}) *logz.PlanData { } } -func expandMonitorUserInfo(input []interface{}) *logz.UserInfo { - if len(input) == 0 || input[0] == nil { - return nil - } - - v := input[0].(map[string]interface{}) - return &logz.UserInfo{ - FirstName: utils.String(v["first_name"].(string)), - LastName: utils.String(v["last_name"].(string)), - EmailAddress: utils.String(v["email"].(string)), - PhoneNumber: utils.String(v["phone_number"].(string)), - } -} - func flattenMonitorOrganizationProperties(d *pluginsdk.ResourceData, input *logz.OrganizationProperties) { if input == nil { return diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_sub_account_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_sub_account_resource.go new file mode 100644 index 00000000000..8da494e0d7b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_sub_account_resource.go @@ -0,0 +1,246 @@ +package logz + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/Azure/azure-sdk-for-go/services/logz/mgmt/2020-10-01/logz" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tags" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceLogzSubAccount() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceLogzSubAccountCreate, + Read: resourceLogzSubAccountRead, + Update: resourceLogzSubAccountUpdate, + Delete: resourceLogzSubAccountDelete, + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Update: pluginsdk.DefaultTimeout(30 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.LogzSubAccountID(id) + return err + }), + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.LogzMonitorName, + }, + + "logz_monitor_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.LogzMonitorID, + }, + + "user": SchemaUserInfo(), + + "enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "tags": tags.Schema(), + }, + } +} +func resourceLogzSubAccountCreate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Logz.SubAccountClient + ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) + defer cancel() + + monitorId, err := parse.LogzMonitorID(d.Get("logz_monitor_id").(string)) + if err != nil { + return err + } + + id := parse.NewLogzSubAccountID(monitorId.SubscriptionId, monitorId.ResourceGroup, monitorId.MonitorName, d.Get("name").(string)) + existing, err := client.Get(ctx, id.ResourceGroup, id.MonitorName, id.AccountName) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + } + + if !utils.ResponseWasNotFound(existing.Response) { + return tf.ImportAsExistsError("azurerm_logz_sub_account", id.ID()) + } + + monitoringStatus := logz.MonitoringStatusDisabled + if d.Get("enabled").(bool) { + monitoringStatus = logz.MonitoringStatusEnabled + } + + monitorClient := meta.(*clients.Client).Logz.MonitorClient + resp, err := monitorClient.Get(ctx, monitorId.ResourceGroup, monitorId.MonitorName) + if err != nil { + return fmt.Errorf("checking for existing %s: %+v", monitorId, err) + } + + props := logz.MonitorResource{ + Location: resp.Location, + Properties: &logz.MonitorProperties{ + UserInfo: expandUserInfo(d.Get("user").([]interface{})), + MonitoringStatus: monitoringStatus, + }, + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + } + + if properties := resp.Properties; properties != nil { + props.Properties.PlanData = properties.PlanData + } + + future, err := client.Create(ctx, id.ResourceGroup, id.MonitorName, id.AccountName, &props) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for creation of the %s: %+v", id, err) + } + + d.SetId(id.ID()) + return resourceLogzSubAccountRead(d, meta) +} + +func resourceLogzSubAccountRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Logz.SubAccountClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.LogzSubAccountID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.MonitorName, id.AccountName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + log.Printf("[INFO] logz %q does not exist - removing from state", d.Id()) + d.SetId("") + return nil + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + d.Set("name", id.AccountName) + d.Set("logz_monitor_id", parse.NewLogzMonitorID(id.SubscriptionId, id.ResourceGroup, id.MonitorName).ID()) + + if props := resp.Properties; props != nil { + d.Set("enabled", props.MonitoringStatus == logz.MonitoringStatusEnabled) + if err := d.Set("user", flattenUserInfo(expandUserInfo(d.Get("user").([]interface{})))); err != nil { + return fmt.Errorf("setting `user`: %+v", err) + } + } + + return tags.FlattenAndSet(d, resp.Tags) +} + +func resourceLogzSubAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Logz.SubAccountClient + ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.LogzSubAccountID(d.Id()) + if err != nil { + return err + } + + props := logz.MonitorResourceUpdateParameters{ + Properties: &logz.MonitorUpdateProperties{}, + } + + if d.HasChange("enabled") { + monitoringStatus := logz.MonitoringStatusDisabled + if d.Get("enabled").(bool) { + monitoringStatus = logz.MonitoringStatusEnabled + } + props.Properties.MonitoringStatus = monitoringStatus + } + + if d.HasChange("tags") { + props.Tags = tags.Expand(d.Get("tags").(map[string]interface{})) + } + + if _, err := client.Update(ctx, id.ResourceGroup, id.MonitorName, id.AccountName, &props); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + return resourceLogzSubAccountRead(d, meta) +} + +func resourceLogzSubAccountDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Logz.SubAccountClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.LogzSubAccountID(d.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.MonitorName, id.AccountName) + if err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for deletion of the %s: %+v", id, err) + } + + // API has bug, which appears to be eventually consistent. Tracked by this issue: https://github.com/Azure/azure-rest-api-specs/issues/18572 + log.Printf("[DEBUG] Waiting for %s to be fully deleted..", *id) + deadline, ok := ctx.Deadline() + if !ok { + return fmt.Errorf("context had no deadline") + } + + stateConf := &pluginsdk.StateChangeConf{ + Pending: []string{"Exists"}, + Target: []string{"NotFound"}, + Refresh: subAccountDeletedRefreshFunc(ctx, client, *id), + MinTimeout: 10 * time.Second, + ContinuousTargetOccurence: 20, + Timeout: time.Until(deadline), + } + + if _, err = stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for %s to be fully deleted: %+v", *id, err) + } + + return nil +} + +func subAccountDeletedRefreshFunc(ctx context.Context, client *logz.SubAccountClient, id parse.LogzSubAccountId) pluginsdk.StateRefreshFunc { + return func() (interface{}, string, error) { + res, err := client.Get(ctx, id.ResourceGroup, id.MonitorName, id.AccountName) + if err != nil { + if utils.ResponseWasNotFound(res.Response) { + return "NotFound", "NotFound", nil + } + + return nil, "", fmt.Errorf("checking if %s has been deleted: %+v", id, err) + } + + return res, "Exists", nil + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_sub_account_tag_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_sub_account_tag_rule_resource.go new file mode 100644 index 00000000000..4cb65c0f719 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_sub_account_tag_rule_resource.go @@ -0,0 +1,154 @@ +package logz + +import ( + "fmt" + "log" + "time" + + "github.com/Azure/azure-sdk-for-go/services/logz/mgmt/2020-10-01/logz" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceLogzSubAccountTagRule() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceLogzSubAccountTagRuleCreateUpdate, + Read: resourceLogzSubAccountTagRuleRead, + Update: resourceLogzSubAccountTagRuleCreateUpdate, + Delete: resourceLogzSubAccountTagRuleDelete, + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Update: pluginsdk.DefaultTimeout(30 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.LogzSubAccountTagRuleID(id) + return err + }), + + Schema: map[string]*pluginsdk.Schema{ + "logz_sub_account_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.LogzSubAccountID, + }, + + "tag_filter": schemaTagFilter(), + + "send_aad_logs": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "send_activity_logs": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "send_subscription_logs": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + }, + } +} +func resourceLogzSubAccountTagRuleCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Logz.SubAccountTagRuleClient + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + subAccountId, err := parse.LogzSubAccountID(d.Get("logz_sub_account_id").(string)) + if err != nil { + return err + } + + id := parse.NewLogzSubAccountTagRuleID(subAccountId.SubscriptionId, subAccountId.ResourceGroup, subAccountId.MonitorName, subAccountId.AccountName, TagRuleName) + + if d.IsNewResource() { + existing, err := client.Get(ctx, id.ResourceGroup, id.MonitorName, id.AccountName, id.TagRuleName) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + } + if existing.ID != nil && *existing.ID != "" { + return tf.ImportAsExistsError("azurerm_logz_sub_account_tag_rule", *existing.ID) + } + } + + props := logz.MonitoringTagRules{ + Properties: &logz.MonitoringTagRulesProperties{ + LogRules: expandTagRuleLogRules(d), + }, + } + + if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.MonitorName, id.AccountName, id.TagRuleName, &props); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) + } + + d.SetId(id.ID()) + return resourceLogzSubAccountTagRuleRead(d, meta) +} + +func resourceLogzSubAccountTagRuleRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Logz.SubAccountTagRuleClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.LogzSubAccountTagRuleID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.MonitorName, id.AccountName, id.TagRuleName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + log.Printf("[INFO] logz %q does not exist - removing from state", d.Id()) + d.SetId("") + return nil + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + d.Set("logz_sub_account_id", parse.NewLogzSubAccountID(id.SubscriptionId, id.ResourceGroup, id.MonitorName, id.AccountName).ID()) + if props := resp.Properties; props != nil && props.LogRules != nil { + d.Set("send_aad_logs", props.LogRules.SendAadLogs) + d.Set("send_activity_logs", props.LogRules.SendActivityLogs) + d.Set("send_subscription_logs", props.LogRules.SendSubscriptionLogs) + + if err := d.Set("tag_filter", flattenTagRuleFilteringTagArray(props.LogRules.FilteringTags)); err != nil { + return fmt.Errorf("setting `tag_filter`: %+v", err) + } + } + + return nil +} + +func resourceLogzSubAccountTagRuleDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Logz.SubAccountTagRuleClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.LogzSubAccountTagRuleID(d.Id()) + if err != nil { + return err + } + + if _, err := client.Delete(ctx, id.ResourceGroup, id.MonitorName, id.AccountName, id.TagRuleName); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_tag_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_tag_rule_resource.go index 79bc8c858c5..8c282ca1f50 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_tag_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/logz_tag_rule_resource.go @@ -11,13 +11,10 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" ) -const tagRuleName = "default" - func resourceLogzTagRule() *pluginsdk.Resource { return &pluginsdk.Resource{ Create: resourceLogzTagRuleCreateUpdate, @@ -45,34 +42,7 @@ func resourceLogzTagRule() *pluginsdk.Resource { ValidateFunc: validate.LogzMonitorID, }, - "tag_filter": { - Type: pluginsdk.TypeList, - Optional: true, - MaxItems: 10, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "name": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "action": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(logz.TagActionInclude), - string(logz.TagActionExclude), - }, false), - }, - - "value": { - Type: pluginsdk.TypeString, - Optional: true, - }, - }, - }, - }, + "tag_filter": schemaTagFilter(), "send_aad_logs": { Type: pluginsdk.TypeBool, @@ -105,7 +75,7 @@ func resourceLogzTagRuleCreateUpdate(d *pluginsdk.ResourceData, meta interface{} return err } - id := parse.NewLogzTagRuleID(monitorId.SubscriptionId, monitorId.ResourceGroup, monitorId.MonitorName, tagRuleName) + id := parse.NewLogzTagRuleID(monitorId.SubscriptionId, monitorId.ResourceGroup, monitorId.MonitorName, TagRuleName) if d.IsNewResource() { existing, err := client.Get(ctx, id.ResourceGroup, id.MonitorName, id.TagRuleName) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/parse/logz_sub_account.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/parse/logz_sub_account.go new file mode 100644 index 00000000000..e2ad9624ceb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/parse/logz_sub_account.go @@ -0,0 +1,75 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type LogzSubAccountId struct { + SubscriptionId string + ResourceGroup string + MonitorName string + AccountName string +} + +func NewLogzSubAccountID(subscriptionId, resourceGroup, monitorName, accountName string) LogzSubAccountId { + return LogzSubAccountId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + MonitorName: monitorName, + AccountName: accountName, + } +} + +func (id LogzSubAccountId) String() string { + segments := []string{ + fmt.Sprintf("Account Name %q", id.AccountName), + fmt.Sprintf("Monitor Name %q", id.MonitorName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Logz Sub Account", segmentsStr) +} + +func (id LogzSubAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logz/monitors/%s/accounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.MonitorName, id.AccountName) +} + +// LogzSubAccountID parses a LogzSubAccount ID into an LogzSubAccountId struct +func LogzSubAccountID(input string) (*LogzSubAccountId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := LogzSubAccountId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.MonitorName, err = id.PopSegment("monitors"); err != nil { + return nil, err + } + if resourceId.AccountName, err = id.PopSegment("accounts"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/parse/logz_sub_account_tag_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/parse/logz_sub_account_tag_rule.go new file mode 100644 index 00000000000..763747b347b --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/parse/logz_sub_account_tag_rule.go @@ -0,0 +1,81 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type LogzSubAccountTagRuleId struct { + SubscriptionId string + ResourceGroup string + MonitorName string + AccountName string + TagRuleName string +} + +func NewLogzSubAccountTagRuleID(subscriptionId, resourceGroup, monitorName, accountName, tagRuleName string) LogzSubAccountTagRuleId { + return LogzSubAccountTagRuleId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + MonitorName: monitorName, + AccountName: accountName, + TagRuleName: tagRuleName, + } +} + +func (id LogzSubAccountTagRuleId) String() string { + segments := []string{ + fmt.Sprintf("Tag Rule Name %q", id.TagRuleName), + fmt.Sprintf("Account Name %q", id.AccountName), + fmt.Sprintf("Monitor Name %q", id.MonitorName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Logz Sub Account Tag Rule", segmentsStr) +} + +func (id LogzSubAccountTagRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Logz/monitors/%s/accounts/%s/tagRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.MonitorName, id.AccountName, id.TagRuleName) +} + +// LogzSubAccountTagRuleID parses a LogzSubAccountTagRule ID into an LogzSubAccountTagRuleId struct +func LogzSubAccountTagRuleID(input string) (*LogzSubAccountTagRuleId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := LogzSubAccountTagRuleId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.MonitorName, err = id.PopSegment("monitors"); err != nil { + return nil, err + } + if resourceId.AccountName, err = id.PopSegment("accounts"); err != nil { + return nil, err + } + if resourceId.TagRuleName, err = id.PopSegment("tagRules"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/registration.go index 3ec26f95d14..7255a703c8f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/registration.go @@ -33,7 +33,9 @@ func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { // SupportedResources returns the supported Resources supported by this Service func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ - "azurerm_logz_monitor": resourceLogzMonitor(), - "azurerm_logz_tag_rule": resourceLogzTagRule(), + "azurerm_logz_monitor": resourceLogzMonitor(), + "azurerm_logz_tag_rule": resourceLogzTagRule(), + "azurerm_logz_sub_account": resourceLogzSubAccount(), + "azurerm_logz_sub_account_tag_rule": resourceLogzSubAccountTagRule(), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/resourceids.go index e5304b99af0..657d0fc1e4f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/resourceids.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/resourceids.go @@ -2,3 +2,5 @@ package logz //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=LogzMonitor -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Logz/monitors/monitor1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=LogzTagRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Logz/monitors/monitor1/tagRules/ruleSet1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=LogzSubAccount -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Logz/monitors/monitor1/accounts/subAccount1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=LogzSubAccountTagRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.Logz/monitors/monitor1/accounts/subAccount1/tagRules/ruleSet1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/validate/logz_monitor_name.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/validate/logz_monitor_name.go new file mode 100644 index 00000000000..d43a00ad29f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/validate/logz_monitor_name.go @@ -0,0 +1,14 @@ +package validate + +import ( + "regexp" + + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +func LogzMonitorName(v interface{}, k string) (warnings []string, errors []error) { + return validation.StringMatch( + regexp.MustCompile(`^[\w\-]{1,32}$`), + `name must be between 1 and 32 characters in length and may contain only letters, numbers, hyphens and underscores`, + )(v, k) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/validate/logz_sub_account_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/validate/logz_sub_account_id.go new file mode 100644 index 00000000000..fa962d5037f --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/validate/logz_sub_account_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/parse" +) + +func LogzSubAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.LogzSubAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/validate/logz_sub_account_tag_rule_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/validate/logz_sub_account_tag_rule_id.go new file mode 100644 index 00000000000..41d6fb8afe9 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/validate/logz_sub_account_tag_rule_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/logz/parse" +) + +func LogzSubAccountTagRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.LogzSubAccountTagRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go index eafe10f7976..e9bb89b138b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/machine_learning_inference_cluster_resource.go @@ -5,7 +5,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/machinelearningservices/mgmt/2021-07-01/machinelearningservices" - "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice" + "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/machine_learning_workspace_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/machine_learning_workspace_resource.go index f58bfe13ded..75cc2ad9cb8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/machine_learning_workspace_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/machine_learning_workspace_resource.go @@ -17,7 +17,6 @@ import ( keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/validate" - msiValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -96,7 +95,7 @@ func resourceMachineLearningWorkspace() *pluginsdk.Resource { "primary_user_assigned_identity": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: msiValidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, "container_registry_id": { @@ -150,9 +149,10 @@ func resourceMachineLearningWorkspace() *pluginsdk.Resource { ValidateFunc: validation.IsURLWithHTTPorHTTPS, }, "user_assigned_identity_id": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: msiValidate.UserAssignedIdentityID, + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, + // TODO: remove this DiffSuppressFunc: suppress.CaseDifference, }, }, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/client/client.go index ae4c89f5b2d..5a2dd68526e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/client/client.go @@ -1,24 +1,31 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - ConfigurationsClient *maintenance.ConfigurationsClient - ConfigurationAssignmentsClient *maintenance.ConfigurationAssignmentsClient + ConfigurationsClient *maintenanceconfigurations.MaintenanceConfigurationsClient + ConfigurationAssignmentsClient *configurationassignments.ConfigurationAssignmentsClient + PublicConfigurationsClient *publicmaintenanceconfigurations.PublicMaintenanceConfigurationsClient } func NewClient(o *common.ClientOptions) *Client { - configurationsClient := maintenance.NewConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + configurationsClient := maintenanceconfigurations.NewMaintenanceConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&configurationsClient.Client, o.ResourceManagerAuthorizer) - configurationAssignmentsClient := maintenance.NewConfigurationAssignmentsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + configurationAssignmentsClient := configurationassignments.NewConfigurationAssignmentsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&configurationAssignmentsClient.Client, o.ResourceManagerAuthorizer) + publicConfigurationsClient := publicmaintenanceconfigurations.NewPublicMaintenanceConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&publicConfigurationsClient.Client, o.ResourceManagerAuthorizer) + return &Client{ ConfigurationsClient: &configurationsClient, ConfigurationAssignmentsClient: &configurationAssignmentsClient, + PublicConfigurationsClient: &publicConfigurationsClient, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_assignment_dedicated_host_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_assignment_dedicated_host_resource.go index 12959c05d2a..fb3e8747530 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_assignment_dedicated_host_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_assignment_dedicated_host_resource.go @@ -6,15 +6,15 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - parseCompute "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" - validateCompute "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -42,17 +42,18 @@ func resourceArmMaintenanceAssignmentDedicatedHost() *pluginsdk.Resource { "location": azure.SchemaLocation(), "maintenance_configuration_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validate.MaintenanceConfigurationID, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: maintenanceconfigurations.ValidateMaintenanceConfigurationID, + DiffSuppressFunc: suppress.CaseDifference, // TODO remove in 4.0 with a work around or when https://github.com/Azure/azure-rest-api-specs/issues/8653 is fixed }, "dedicated_host_id": { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validateCompute.DedicatedHostID, + ValidateFunc: dedicatedhosts.ValidateHostID, DiffSuppressFunc: suppress.CaseDifference, }, }, @@ -64,41 +65,48 @@ func resourceArmMaintenanceAssignmentDedicatedHostCreate(d *pluginsdk.ResourceDa ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() + configurationId, err := maintenanceconfigurations.ParseMaintenanceConfigurationID(d.Get("maintenance_configuration_id").(string)) + if err != nil { + return err + } + dedicatedHostIdRaw := d.Get("dedicated_host_id").(string) - dedicatedHostId, _ := parseCompute.DedicatedHostID(dedicatedHostIdRaw) + dedicatedHostId, _ := dedicatedhosts.ParseHostID(dedicatedHostIdRaw) + + existingList, err := getMaintenanceAssignmentDedicatedHost(ctx, client, *dedicatedHostId, dedicatedHostIdRaw) - existingList, err := getMaintenanceAssignmentDedicatedHost(ctx, client, dedicatedHostId, dedicatedHostIdRaw) if err != nil { return err } if existingList != nil && len(*existingList) > 0 { existing := (*existingList)[0] - if existing.ID != nil && *existing.ID != "" { - return tf.ImportAsExistsError("azurerm_maintenance_assignment_dedicated_host", *existing.ID) + if existing.Id != nil && *existing.Id != "" { + return tf.ImportAsExistsError("azurerm_maintenance_assignment_dedicated_host", configurationId.ID()) } } - maintenanceConfigurationID := d.Get("maintenance_configuration_id").(string) - configurationId, _ := parse.MaintenanceConfigurationIDInsensitively(maintenanceConfigurationID) - // set assignment name to configuration name - assignmentName := configurationId.Name - configurationAssignment := maintenance.ConfigurationAssignment{ + assignmentName := configurationId.ResourceName + configurationAssignment := configurationassignments.ConfigurationAssignment{ Name: utils.String(assignmentName), Location: utils.String(location.Normalize(d.Get("location").(string))), - ConfigurationAssignmentProperties: &maintenance.ConfigurationAssignmentProperties{ - MaintenanceConfigurationID: utils.String(maintenanceConfigurationID), - ResourceID: utils.String(dedicatedHostIdRaw), + Properties: &configurationassignments.ConfigurationAssignmentProperties{ + MaintenanceConfigurationId: utils.String(configurationId.ID()), + ResourceId: utils.String(dedicatedHostId.ID()), }, } // It may take a few minutes after starting a VM for it to become available to assign to a configuration + + id := configurationassignments.NewProviders2ConfigurationAssignmentID(dedicatedHostId.SubscriptionId, dedicatedHostId.ResourceGroupName, "Microsoft.Compute", "hostGroups", dedicatedHostId.HostGroupName, "hosts", dedicatedHostId.HostName, assignmentName) err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { - if _, err := client.CreateOrUpdateParent(ctx, dedicatedHostId.ResourceGroup, "Microsoft.Compute", "hostGroups", dedicatedHostId.HostGroupName, "hosts", dedicatedHostId.HostName, assignmentName, configurationAssignment); err != nil { + + if _, err := client.CreateOrUpdateParent(ctx, id, configurationAssignment); err != nil { + if strings.Contains(err.Error(), "It may take a few minutes after starting a VM for it to become available to assign to a configuration") { return pluginsdk.RetryableError(fmt.Errorf("expected VM is available to assign to a configuration but was in pending state, retrying")) } - return pluginsdk.NonRetryableError(fmt.Errorf("issuing creating request for Maintenance Assignment (Dedicated Host ID %q): %+v", dedicatedHostIdRaw, err)) + return pluginsdk.NonRetryableError(fmt.Errorf("issuing creating request for Maintenance Assignment (Dedicated Host ID %q): %+v", dedicatedHostId.ID(), err)) } return nil @@ -107,19 +115,8 @@ func resourceArmMaintenanceAssignmentDedicatedHostCreate(d *pluginsdk.ResourceDa return err } - resp, err := getMaintenanceAssignmentDedicatedHost(ctx, client, dedicatedHostId, dedicatedHostIdRaw) - if err != nil { - return err - } - if resp == nil || len(*resp) == 0 { - return fmt.Errorf("could not find Maintenance assignment (virtual machine scale set ID: %q)", dedicatedHostIdRaw) - } - assignment := (*resp)[0] - if assignment.ID == nil || *assignment.ID == "" { - return fmt.Errorf("empty or nil ID of Maintenance Assignment (Dedicated Host ID %q)", dedicatedHostIdRaw) - } + d.SetId(id.ID()) - d.SetId(*assignment.ID) return resourceArmMaintenanceAssignmentDedicatedHostRead(d, meta) } @@ -142,18 +139,22 @@ func resourceArmMaintenanceAssignmentDedicatedHostRead(d *pluginsdk.ResourceData return nil } assignment := (*resp)[0] - if assignment.ID == nil || *assignment.ID == "" { + if assignment.Id == nil || *assignment.Id == "" { return fmt.Errorf("empty or nil ID of Maintenance Assignment (Dedicated Host ID: %q", id.DedicatedHostIdRaw) } - dedicatedHostId := "" - if id.DedicatedHostId != nil { - dedicatedHostId = id.DedicatedHostId.ID() - } - d.Set("dedicated_host_id", dedicatedHostId) + d.Set("dedicated_host_id", id.DedicatedHostId.ID()) - if props := assignment.ConfigurationAssignmentProperties; props != nil { - d.Set("maintenance_configuration_id", props.MaintenanceConfigurationID) + if props := assignment.Properties; props != nil { + maintenanceConfigurationId := "" + if props.MaintenanceConfigurationId != nil { + parsedId, err := maintenanceconfigurations.ParseMaintenanceConfigurationIDInsensitively(*props.MaintenanceConfigurationId) + if err != nil { + return fmt.Errorf("parsing %q: %+v", *props.MaintenanceConfigurationId, err) + } + maintenanceConfigurationId = parsedId.ID() + } + d.Set("maintenance_configuration_id", maintenanceConfigurationId) } return nil } @@ -168,20 +169,26 @@ func resourceArmMaintenanceAssignmentDedicatedHostDelete(d *pluginsdk.ResourceDa return err } - if _, err := client.DeleteParent(ctx, id.DedicatedHostId.ResourceGroup, "Microsoft.Compute", "hostGroups", id.DedicatedHostId.HostGroupName, "hosts", id.DedicatedHostId.HostName, id.Name); err != nil { + providerConfigAssignmentId := configurationassignments.NewProviders2ConfigurationAssignmentID(id.DedicatedHostId.SubscriptionId, id.DedicatedHostId.ResourceGroupName, "Microsoft.Compute", "hostGroups", id.DedicatedHostId.HostGroupName, "hosts", id.DedicatedHostId.HostName, id.Name) + + if _, err := client.DeleteParent(ctx, providerConfigAssignmentId); err != nil { return fmt.Errorf("deleting Maintenance Assignment to resource %q: %+v", id.DedicatedHostIdRaw, err) } return nil } -func getMaintenanceAssignmentDedicatedHost(ctx context.Context, client *maintenance.ConfigurationAssignmentsClient, id *parseCompute.DedicatedHostId, dedicatedHostId string) (result *[]maintenance.ConfigurationAssignment, err error) { - resp, err := client.ListParent(ctx, id.ResourceGroup, "Microsoft.Compute", "hostGroups", id.HostGroupName, "hosts", id.HostName) +func getMaintenanceAssignmentDedicatedHost(ctx context.Context, client *configurationassignments.ConfigurationAssignmentsClient, hostId dedicatedhosts.HostId, dedicatedHostId string) (result *[]configurationassignments.ConfigurationAssignment, err error) { + + id := configurationassignments.NewResourceGroupProviderID(hostId.SubscriptionId, hostId.ResourceGroupName, "Microsoft.Compute", "hostGroups", hostId.HostGroupName, "hosts", hostId.HostName) + + resp, err := client.ListParent(ctx, id) + if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { err = fmt.Errorf("checking for presence of existing Maintenance assignment (Dedicated Host ID %q): %+v", dedicatedHostId, err) - return + return nil, err } } - return resp.Value, nil + return resp.Model.Value, nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_assignment_virtual_machine_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_assignment_virtual_machine_resource.go index b264e0bfed3..9b735287916 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_assignment_virtual_machine_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_assignment_virtual_machine_resource.go @@ -6,15 +6,16 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" parseCompute "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" validateCompute "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -42,10 +43,11 @@ func resourceArmMaintenanceAssignmentVirtualMachine() *pluginsdk.Resource { "location": azure.SchemaLocation(), "maintenance_configuration_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validate.MaintenanceConfigurationID, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: maintenanceconfigurations.ValidateMaintenanceConfigurationID, + DiffSuppressFunc: suppress.CaseDifference, // TODO remove in 4.0 with a work around or when https://github.com/Azure/azure-rest-api-specs/issues/8653 is fixed }, "virtual_machine_id": { @@ -53,7 +55,7 @@ func resourceArmMaintenanceAssignmentVirtualMachine() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validateCompute.VirtualMachineID, - DiffSuppressFunc: suppress.CaseDifference, + DiffSuppressFunc: suppress.CaseDifference, // TODO remove in 4.0 }, }, } @@ -64,41 +66,47 @@ func resourceArmMaintenanceAssignmentVirtualMachineCreate(d *pluginsdk.ResourceD ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - virtualMachineIdRaw := d.Get("virtual_machine_id").(string) - virtualMachineId, _ := parseCompute.VirtualMachineID(virtualMachineIdRaw) + virtualMachineId, err := parseCompute.VirtualMachineID(d.Get("virtual_machine_id").(string)) + if err != nil { + return err + } - existingList, err := getMaintenanceAssignmentVirtualMachine(ctx, client, virtualMachineId, virtualMachineIdRaw) + configurationId, err := maintenanceconfigurations.ParseMaintenanceConfigurationID(d.Get("maintenance_configuration_id").(string)) + if err != nil { + return err + } + + existingList, err := getMaintenanceAssignmentVirtualMachine(ctx, client, virtualMachineId, virtualMachineId.ID()) if err != nil { return err } if existingList != nil && len(*existingList) > 0 { existing := (*existingList)[0] - if existing.ID != nil && *existing.ID != "" { - return tf.ImportAsExistsError("azurerm_maintenance_assignment_virtual_machine", *existing.ID) + if existing.Id != nil && *existing.Id != "" { + return tf.ImportAsExistsError("azurerm_maintenance_assignment_virtual_machine", configurationId.ID()) } } - maintenanceConfigurationID := d.Get("maintenance_configuration_id").(string) - configurationId, _ := parse.MaintenanceConfigurationIDInsensitively(maintenanceConfigurationID) - // set assignment name to configuration name - assignmentName := configurationId.Name - configurationAssignment := maintenance.ConfigurationAssignment{ + assignmentName := configurationId.ResourceName + configurationAssignment := configurationassignments.ConfigurationAssignment{ Name: utils.String(assignmentName), Location: utils.String(location.Normalize(d.Get("location").(string))), - ConfigurationAssignmentProperties: &maintenance.ConfigurationAssignmentProperties{ - MaintenanceConfigurationID: utils.String(maintenanceConfigurationID), - ResourceID: utils.String(virtualMachineIdRaw), + Properties: &configurationassignments.ConfigurationAssignmentProperties{ + MaintenanceConfigurationId: utils.String(configurationId.ID()), + ResourceId: utils.String(virtualMachineId.ID()), }, } + id := configurationassignments.NewConfigurationAssignmentID(virtualMachineId.SubscriptionId, virtualMachineId.ResourceGroup, "Microsoft.Compute", "virtualMachines", virtualMachineId.Name, assignmentName) + // It may take a few minutes after starting a VM for it to become available to assign to a configuration err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *pluginsdk.RetryError { - if _, err := client.CreateOrUpdate(ctx, virtualMachineId.ResourceGroup, "Microsoft.Compute", "virtualMachines", virtualMachineId.Name, assignmentName, configurationAssignment); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, configurationAssignment); err != nil { if strings.Contains(err.Error(), "It may take a few minutes after starting a VM for it to become available to assign to a configuration") { return pluginsdk.RetryableError(fmt.Errorf("expected VM is available to assign to a configuration but was in pending state, retrying")) } - return pluginsdk.NonRetryableError(fmt.Errorf("issuing creating request for Maintenance Assignment (virtual machine ID %q): %+v", virtualMachineIdRaw, err)) + return pluginsdk.NonRetryableError(fmt.Errorf("issuing creating request for Maintenance Assignment (virtual machine ID %q): %+v", virtualMachineId.ID(), err)) } return nil @@ -107,19 +115,7 @@ func resourceArmMaintenanceAssignmentVirtualMachineCreate(d *pluginsdk.ResourceD return err } - resp, err := getMaintenanceAssignmentVirtualMachine(ctx, client, virtualMachineId, virtualMachineIdRaw) - if err != nil { - return err - } - if resp == nil || len(*resp) == 0 { - return fmt.Errorf("could not find Maintenance assignment (virtual machine ID: %q)", virtualMachineIdRaw) - } - assignment := (*resp)[0] - if assignment.ID == nil || *assignment.ID == "" { - return fmt.Errorf("empty or nil ID of Maintenance Assignment (virtual machine ID %q)", virtualMachineIdRaw) - } - - d.SetId(*assignment.ID) + d.SetId(id.ID()) return resourceArmMaintenanceAssignmentVirtualMachineRead(d, meta) } @@ -142,7 +138,7 @@ func resourceArmMaintenanceAssignmentVirtualMachineRead(d *pluginsdk.ResourceDat return nil } assignment := (*resp)[0] - if assignment.ID == nil || *assignment.ID == "" { + if assignment.Id == nil || *assignment.Id == "" { return fmt.Errorf("empty or nil ID of Maintenance Assignment (virtual machine ID id: %q", id.VirtualMachineIdRaw) } @@ -152,8 +148,16 @@ func resourceArmMaintenanceAssignmentVirtualMachineRead(d *pluginsdk.ResourceDat virtualMachineId = id.VirtualMachineId.ID() } d.Set("virtual_machine_id", virtualMachineId) - if props := assignment.ConfigurationAssignmentProperties; props != nil { - d.Set("maintenance_configuration_id", props.MaintenanceConfigurationID) + if props := assignment.Properties; props != nil { + maintenanceConfigurationId := "" + if props.MaintenanceConfigurationId != nil { + parsedId, err := maintenanceconfigurations.ParseMaintenanceConfigurationIDInsensitively(*props.MaintenanceConfigurationId) + if err != nil { + return fmt.Errorf("parsing %q: %+v", *props.MaintenanceConfigurationId, err) + } + maintenanceConfigurationId = parsedId.ID() + } + d.Set("maintenance_configuration_id", maintenanceConfigurationId) } return nil } @@ -163,25 +167,30 @@ func resourceArmMaintenanceAssignmentVirtualMachineDelete(d *pluginsdk.ResourceD ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.MaintenanceAssignmentVirtualMachineID(d.Id()) + vmId, err := parse.MaintenanceAssignmentVirtualMachineID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.VirtualMachineId.ResourceGroup, "Microsoft.Compute", "virtualMachines", id.VirtualMachineId.Name, id.Name); err != nil { - return fmt.Errorf("deleting Maintenance Assignment to resource %q: %+v", id.VirtualMachineIdRaw, err) + id := configurationassignments.NewConfigurationAssignmentID(vmId.VirtualMachineId.SubscriptionId, vmId.VirtualMachineId.ResourceGroup, "Microsoft.Compute", "virtualMachines", vmId.VirtualMachineId.Name, vmId.Name) + + if _, err := client.Delete(ctx, id); err != nil { + return fmt.Errorf("deleting Maintenance Assignment to resource %q: %+v", vmId.VirtualMachineIdRaw, err) } return nil } -func getMaintenanceAssignmentVirtualMachine(ctx context.Context, client *maintenance.ConfigurationAssignmentsClient, id *parseCompute.VirtualMachineId, virtualMachineId string) (result *[]maintenance.ConfigurationAssignment, err error) { - resp, err := client.List(ctx, id.ResourceGroup, "Microsoft.Compute", "virtualMachines", id.Name) +func getMaintenanceAssignmentVirtualMachine(ctx context.Context, client *configurationassignments.ConfigurationAssignmentsClient, vmId *parseCompute.VirtualMachineId, virtualMachineId string) (result *[]configurationassignments.ConfigurationAssignment, err error) { + + id := configurationassignments.NewProviderID(vmId.SubscriptionId, vmId.ResourceGroup, "Microsoft.Compute", "virtualMachines", vmId.Name) + resp, err := client.List(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { err = fmt.Errorf("checking for presence of existing Maintenance assignment (virtual machine ID: %q): %+v", virtualMachineId, err) return } } - return resp.Value, nil + + return resp.Model.Value, nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_assignment_virtual_machine_scale_set_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_assignment_virtual_machine_scale_set_resource.go index a98abe2ca8c..ad1f667c525 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_assignment_virtual_machine_scale_set_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_assignment_virtual_machine_scale_set_resource.go @@ -5,15 +5,16 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" parseCompute "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" validateCompute "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -41,10 +42,11 @@ func resourceArmMaintenanceAssignmentVirtualMachineScaleSet() *pluginsdk.Resourc "location": azure.SchemaLocation(), "maintenance_configuration_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validate.MaintenanceConfigurationID, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: maintenanceconfigurations.ValidateMaintenanceConfigurationID, + DiffSuppressFunc: suppress.CaseDifference, // TODO remove in 4.0 with a work around or when https://github.com/Azure/azure-rest-api-specs/issues/8653 is fixed }, "virtual_machine_scale_set_id": { @@ -52,7 +54,7 @@ func resourceArmMaintenanceAssignmentVirtualMachineScaleSet() *pluginsdk.Resourc Required: true, ForceNew: true, ValidateFunc: validateCompute.VirtualMachineScaleSetID, - DiffSuppressFunc: suppress.CaseDifference, + DiffSuppressFunc: suppress.CaseDifference, // TODO remove in 4.0 }, }, } @@ -63,52 +65,44 @@ func resourceArmMaintenanceAssignmentVirtualMachineScaleSetCreate(d *pluginsdk.R ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - virtualMachineScaleSetIdRaw := d.Get("virtual_machine_scale_set_id").(string) - virtualMachineScaleSetId, _ := parseCompute.VirtualMachineScaleSetID(virtualMachineScaleSetIdRaw) + virtualMachineScaleSetId, err := parseCompute.VirtualMachineScaleSetID(d.Get("virtual_machine_scale_set_id").(string)) + if err != nil { + return err + } - existingList, err := getMaintenanceAssignmentVirtualMachineScaleSet(ctx, client, virtualMachineScaleSetId, virtualMachineScaleSetIdRaw) + maintenanceConfigurationID, err := maintenanceconfigurations.ParseMaintenanceConfigurationID(d.Get("maintenance_configuration_id").(string)) + if err != nil { + return err + } + + configAssignmentId := configurationassignments.NewConfigurationAssignmentID(virtualMachineScaleSetId.SubscriptionId, virtualMachineScaleSetId.ResourceGroup, "Microsoft.Compute", "virtualMachineScaleSets", virtualMachineScaleSetId.Name, maintenanceConfigurationID.ResourceName) + + existingList, err := getMaintenanceAssignmentVirtualMachineScaleSet(ctx, client, virtualMachineScaleSetId) if err != nil { return err } if existingList != nil && len(*existingList) > 0 { existing := (*existingList)[0] - if existing.ID != nil && *existing.ID != "" { - return tf.ImportAsExistsError("azurerm_maintenance_assignment_virtual_machine_scale_set", *existing.ID) + if existing.Id != nil && *existing.Id != "" { + return tf.ImportAsExistsError("azurerm_maintenance_assignment_virtual_machine_scale_set", configAssignmentId.ID()) } } - maintenanceConfigurationID := d.Get("maintenance_configuration_id").(string) - configurationId, _ := parse.MaintenanceConfigurationIDInsensitively(maintenanceConfigurationID) - - // set assignment name to configuration name - assignmentName := configurationId.Name - configurationAssignment := maintenance.ConfigurationAssignment{ - Name: utils.String(assignmentName), + configurationAssignment := configurationassignments.ConfigurationAssignment{ + Name: utils.String(maintenanceConfigurationID.ResourceName), Location: utils.String(location.Normalize(d.Get("location").(string))), - ConfigurationAssignmentProperties: &maintenance.ConfigurationAssignmentProperties{ - MaintenanceConfigurationID: utils.String(maintenanceConfigurationID), - ResourceID: utils.String(virtualMachineScaleSetIdRaw), + Properties: &configurationassignments.ConfigurationAssignmentProperties{ + MaintenanceConfigurationId: utils.String(maintenanceConfigurationID.ID()), + ResourceId: utils.String(virtualMachineScaleSetId.ID()), }, } - _, err = client.CreateOrUpdate(ctx, virtualMachineScaleSetId.ResourceGroup, "Microsoft.Compute", "virtualMachineScaleSets", virtualMachineScaleSetId.Name, assignmentName, configurationAssignment) + _, err = client.CreateOrUpdate(ctx, configAssignmentId, configurationAssignment) if err != nil { return err } - resp, err := getMaintenanceAssignmentVirtualMachineScaleSet(ctx, client, virtualMachineScaleSetId, virtualMachineScaleSetIdRaw) - if err != nil { - return err - } - if resp == nil || len(*resp) == 0 { - return fmt.Errorf("could not find Maintenance assignment (virtual machine scale set ID: %q)", virtualMachineScaleSetIdRaw) - } - assignment := (*resp)[0] - if assignment.ID == nil || *assignment.ID == "" { - return fmt.Errorf("empty or nil ID of Maintenance Assignment (virtual machine scale set ID %q)", virtualMachineScaleSetIdRaw) - } - - d.SetId(*assignment.ID) + d.SetId(configAssignmentId.ID()) return resourceArmMaintenanceAssignmentVirtualMachineScaleSetRead(d, meta) } @@ -122,7 +116,7 @@ func resourceArmMaintenanceAssignmentVirtualMachineScaleSetRead(d *pluginsdk.Res return err } - resp, err := getMaintenanceAssignmentVirtualMachineScaleSet(ctx, client, id.VirtualMachineScaleSetId, id.VirtualMachineScaleSetIdRaw) + resp, err := getMaintenanceAssignmentVirtualMachineScaleSet(ctx, client, id.VirtualMachineScaleSetId) if err != nil { return err } @@ -131,7 +125,7 @@ func resourceArmMaintenanceAssignmentVirtualMachineScaleSetRead(d *pluginsdk.Res return nil } assignment := (*resp)[0] - if assignment.ID == nil || *assignment.ID == "" { + if assignment.Id == nil || *assignment.Id == "" { return fmt.Errorf("empty or nil ID of Maintenance Assignment (virtual machine scale set ID id: %q", id.VirtualMachineScaleSetIdRaw) } @@ -141,8 +135,16 @@ func resourceArmMaintenanceAssignmentVirtualMachineScaleSetRead(d *pluginsdk.Res virtualMachineScaleSetId = id.VirtualMachineScaleSetId.ID() } d.Set("virtual_machine_scale_set_id", virtualMachineScaleSetId) - if props := assignment.ConfigurationAssignmentProperties; props != nil { - d.Set("maintenance_configuration_id", props.MaintenanceConfigurationID) + if props := assignment.Properties; props != nil { + maintenanceConfigurationId := "" + if props.MaintenanceConfigurationId != nil { + parsedId, err := maintenanceconfigurations.ParseMaintenanceConfigurationIDInsensitively(*props.MaintenanceConfigurationId) + if err != nil { + return fmt.Errorf("parsing %q: %+v", *props.MaintenanceConfigurationId, err) + } + maintenanceConfigurationId = parsedId.ID() + } + d.Set("maintenance_configuration_id", maintenanceConfigurationId) } return nil } @@ -152,25 +154,30 @@ func resourceArmMaintenanceAssignmentVirtualMachineScaleSetDelete(d *pluginsdk.R ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.MaintenanceAssignmentVirtualMachineScaleSetID(d.Id()) + maintenanceAssignmentVmScaleSetId, err := parse.MaintenanceAssignmentVirtualMachineScaleSetID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.VirtualMachineScaleSetId.ResourceGroup, "Microsoft.Compute", "virtualMachineScaleSets", id.VirtualMachineScaleSetId.Name, id.Name); err != nil { - return fmt.Errorf("deleting Maintenance Assignment to resource %q: %+v", id.VirtualMachineScaleSetIdRaw, err) + id := configurationassignments.NewConfigurationAssignmentID(maintenanceAssignmentVmScaleSetId.VirtualMachineScaleSetId.SubscriptionId, maintenanceAssignmentVmScaleSetId.VirtualMachineScaleSetId.ResourceGroup, "Microsoft.Compute", "virtualMachineScaleSets", maintenanceAssignmentVmScaleSetId.VirtualMachineScaleSetId.Name, maintenanceAssignmentVmScaleSetId.Name) + + if _, err := client.Delete(ctx, id); err != nil { + return fmt.Errorf("deleting Maintenance Assignment to resource %q: %+v", maintenanceAssignmentVmScaleSetId.VirtualMachineScaleSetIdRaw, err) } return nil } -func getMaintenanceAssignmentVirtualMachineScaleSet(ctx context.Context, client *maintenance.ConfigurationAssignmentsClient, id *parseCompute.VirtualMachineScaleSetId, virtualMachineScaleSetId string) (result *[]maintenance.ConfigurationAssignment, err error) { - resp, err := client.List(ctx, id.ResourceGroup, "Microsoft.Compute", "virtualMachineScaleSets", id.Name) +func getMaintenanceAssignmentVirtualMachineScaleSet(ctx context.Context, client *configurationassignments.ConfigurationAssignmentsClient, vmScaleSetId *parseCompute.VirtualMachineScaleSetId) (result *[]configurationassignments.ConfigurationAssignment, err error) { + + id := configurationassignments.NewProviderID(vmScaleSetId.SubscriptionId, vmScaleSetId.ResourceGroup, "Microsoft.Compute", "virtualMachineScaleSets", vmScaleSetId.Name) + + resp, err := client.List(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { - err = fmt.Errorf("checking for presence of existing Maintenance assignment (virtual machine scale set ID: %q): %+v", virtualMachineScaleSetId, err) + if !response.WasNotFound(resp.HttpResponse) { + err = fmt.Errorf("checking for presence of existing Maintenance assignment (virtual machine scale set ID: %q): %+v", vmScaleSetId.ID(), err) return } } - return resp.Value, nil + return resp.Model.Value, nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_configuration_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_configuration_data_source.go index bc58a751ce0..f4bffb7fde7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_configuration_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_configuration_data_source.go @@ -4,15 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceMaintenanceConfiguration() *pluginsdk.Resource { @@ -92,10 +92,10 @@ func dataSourceArmMaintenanceConfigurationRead(d *pluginsdk.ResourceData, meta i ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewMaintenanceConfigurationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := maintenanceconfigurations.NewMaintenanceConfigurationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } @@ -103,20 +103,25 @@ func dataSourceArmMaintenanceConfigurationRead(d *pluginsdk.ResourceData, meta i } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - - if props := resp.ConfigurationProperties; props != nil { - d.Set("scope", props.MaintenanceScope) - d.Set("visibility", props.Visibility) - d.Set("properties", props.ExtensionProperties) - - window := flattenMaintenanceConfigurationWindow(props.Window) - if err := d.Set("window", window); err != nil { - return fmt.Errorf("setting `window`: %+v", err) + d.Set("name", id.ResourceName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("scope", props.MaintenanceScope) + d.Set("visibility", props.Visibility) + d.Set("properties", props.ExtensionProperties) + + window := flattenMaintenanceConfigurationWindow(props.MaintenanceWindow) + if err := d.Set("window", window); err != nil { + return fmt.Errorf("setting `window`: %+v", err) + } + } + d.Set("location", location.NormalizeNilable(model.Location)) + if err = tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + return err } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_configuration_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_configuration_resource.go index 59c7a00757b..94d3d90172f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_configuration_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/maintenance_configuration_resource.go @@ -6,13 +6,13 @@ import ( "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -41,7 +41,7 @@ func resourceArmMaintenanceConfiguration() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.MaintenanceConfigurationIDInsensitively(id) + _, err := maintenanceconfigurations.ParseMaintenanceConfigurationIDInsensitively(id) return err }), @@ -59,25 +59,23 @@ func resourceArmMaintenanceConfiguration() *pluginsdk.Resource { "scope": { Type: pluginsdk.TypeString, - Optional: true, - Default: "All", + Required: true, ValidateFunc: validation.StringInSlice([]string{ - "All", // All is still accepted by the API - string(maintenance.ScopeExtension), - string(maintenance.ScopeHost), - string(maintenance.ScopeInGuestPatch), - string(maintenance.ScopeOSImage), - string(maintenance.ScopeSQLDB), - string(maintenance.ScopeSQLManagedInstance), + string(maintenanceconfigurations.MaintenanceScopeExtension), + string(maintenanceconfigurations.MaintenanceScopeHost), + string(maintenanceconfigurations.MaintenanceScopeInGuestPatch), + string(maintenanceconfigurations.MaintenanceScopeOSImage), + string(maintenanceconfigurations.MaintenanceScopeSQLDB), + string(maintenanceconfigurations.MaintenanceScopeSQLManagedInstance), }, false), }, "visibility": { Type: pluginsdk.TypeString, Optional: true, - Default: string(maintenance.VisibilityCustom), + Default: string(maintenanceconfigurations.VisibilityCustom), ValidateFunc: validation.StringInSlice([]string{ - string(maintenance.VisibilityCustom), + string(maintenanceconfigurations.VisibilityCustom), // Creating public configurations doesn't appear to be supported, API returns `Public Maintenance Configuration must set correct properties` // string(maintenance.VisibilityPublic), }, false), @@ -139,40 +137,38 @@ func resourceArmMaintenanceConfigurationCreateUpdate(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewMaintenanceConfigurationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := maintenanceconfigurations.NewMaintenanceConfigurationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_maintenance_configuration", id.ID()) } } - scope := d.Get("scope").(string) - visibility := d.Get("visibility").(string) + scope := maintenanceconfigurations.MaintenanceScope(d.Get("scope").(string)) + visibility := maintenanceconfigurations.Visibility(d.Get("visibility").(string)) windowRaw := d.Get("window").([]interface{}) window := expandMaintenanceConfigurationWindow(windowRaw) - extensionProperties := utils.ExpandMapStringPtrString(d.Get("properties").(map[string]interface{})) - - configuration := maintenance.Configuration{ - Name: utils.String(id.Name), + configuration := maintenanceconfigurations.MaintenanceConfiguration{ + Name: utils.String(id.ResourceName), Location: utils.String(location.Normalize(d.Get("location").(string))), - ConfigurationProperties: &maintenance.ConfigurationProperties{ - MaintenanceScope: maintenance.Scope(scope), - Visibility: maintenance.Visibility(visibility), + Properties: &maintenanceconfigurations.MaintenanceConfigurationProperties{ + MaintenanceScope: &scope, + Visibility: &visibility, Namespace: utils.String("Microsoft.Maintenance"), - Window: window, - ExtensionProperties: extensionProperties, + MaintenanceWindow: window, + ExtensionProperties: expandExtensionProperties(d.Get("properties").(map[string]interface{})), }, - Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + Tags: expandTags(d.Get("tags").(map[string]interface{})), } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, configuration); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, configuration); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -185,14 +181,14 @@ func resourceArmMaintenanceConfigurationRead(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.MaintenanceConfigurationIDInsensitively(d.Id()) + id, err := maintenanceconfigurations.ParseMaintenanceConfigurationID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] maintenance %q does not exist - removing from state", d.Id()) d.SetId("") return nil @@ -200,20 +196,26 @@ func resourceArmMaintenanceConfigurationRead(d *pluginsdk.ResourceData, meta int return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - if props := resp.ConfigurationProperties; props != nil { - d.Set("scope", props.MaintenanceScope) - d.Set("visibility", props.Visibility) - d.Set("properties", props.ExtensionProperties) - - window := flattenMaintenanceConfigurationWindow(props.Window) - if err := d.Set("window", window); err != nil { - return fmt.Errorf("setting `window`: %+v", err) + d.Set("name", id.ResourceName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("scope", props.MaintenanceScope) + d.Set("visibility", props.Visibility) + d.Set("properties", props.ExtensionProperties) + + window := flattenMaintenanceConfigurationWindow(props.MaintenanceWindow) + if err := d.Set("window", window); err != nil { + return fmt.Errorf("setting `window`: %+v", err) + } + } + d.Set("location", location.NormalizeNilable(model.Location)) + if err = tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + return err } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceArmMaintenanceConfigurationDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -221,18 +223,18 @@ func resourceArmMaintenanceConfigurationDelete(d *pluginsdk.ResourceData, meta i ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.MaintenanceConfigurationIDInsensitively(d.Id()) + id, err := maintenanceconfigurations.ParseMaintenanceConfigurationIDInsensitively(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.Name); err != nil { + if _, err := client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } return nil } -func expandMaintenanceConfigurationWindow(input []interface{}) *maintenance.Window { +func expandMaintenanceConfigurationWindow(input []interface{}) *maintenanceconfigurations.MaintenanceWindow { if len(input) == 0 { return nil } @@ -243,7 +245,7 @@ func expandMaintenanceConfigurationWindow(input []interface{}) *maintenance.Wind duration := v["duration"].(string) timeZone := v["time_zone"].(string) recurEvery := v["recur_every"].(string) - window := maintenance.Window{ + window := maintenanceconfigurations.MaintenanceWindow{ StartDateTime: utils.String(startDateTime), ExpirationDateTime: utils.String(expirationDateTime), Duration: utils.String(duration), @@ -253,7 +255,7 @@ func expandMaintenanceConfigurationWindow(input []interface{}) *maintenance.Wind return &window } -func flattenMaintenanceConfigurationWindow(input *maintenance.Window) []interface{} { +func flattenMaintenanceConfigurationWindow(input *maintenanceconfigurations.MaintenanceWindow) []interface{} { results := make([]interface{}, 0) if v := input; v != nil { @@ -284,3 +286,11 @@ func flattenMaintenanceConfigurationWindow(input *maintenance.Window) []interfac return results } + +func expandExtensionProperties(input map[string]interface{}) *map[string]string { + output := make(map[string]string) + for k, v := range input { + output[k] = v.(string) + } + return &output +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/migration/configuration_v0_to_v1.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/migration/configuration_v0_to_v1.go index e446451fce9..02cfd60786e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/migration/configuration_v0_to_v1.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/migration/configuration_v0_to_v1.go @@ -4,8 +4,8 @@ import ( "context" "log" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -57,7 +57,7 @@ func (ConfigurationV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { name := rawState["name"].(string) resourceGroup := rawState["resource_group_name"].(string) - id := parse.NewMaintenanceConfigurationID(subscriptionId, resourceGroup, name) + id := maintenanceconfigurations.NewMaintenanceConfigurationID(subscriptionId, resourceGroup, name) rawState["id"] = id.ID() diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse/maintenance_assignment_dedicated_host.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse/maintenance_assignment_dedicated_host.go index 1aeb0b31897..0335b7f1d43 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse/maintenance_assignment_dedicated_host.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse/maintenance_assignment_dedicated_host.go @@ -4,11 +4,11 @@ import ( "fmt" "regexp" - parseCompute "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts" ) type MaintenanceAssignmentDedicatedHostId struct { - DedicatedHostId *parseCompute.DedicatedHostId + DedicatedHostId dedicatedhosts.HostId DedicatedHostIdRaw string Name string } @@ -20,13 +20,13 @@ func MaintenanceAssignmentDedicatedHostID(input string) (*MaintenanceAssignmentD } targetResourceId, name := groups[1], groups[2] - dedicatedHostID, err := parseCompute.DedicatedHostID(targetResourceId) + dedicatedHostID, err := dedicatedhosts.ParseHostIDInsensitively(targetResourceId) if err != nil { return nil, fmt.Errorf("parsing Maintenance Assignment Dedicated Host ID: %q: Expected valid Dedicated Host ID", input) } return &MaintenanceAssignmentDedicatedHostId{ - DedicatedHostId: dedicatedHostID, + DedicatedHostId: *dedicatedHostID, DedicatedHostIdRaw: targetResourceId, Name: name, }, nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse/maintenance_configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse/maintenance_configuration.go deleted file mode 100644 index 06a7602d2dd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse/maintenance_configuration.go +++ /dev/null @@ -1,113 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type MaintenanceConfigurationId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewMaintenanceConfigurationID(subscriptionId, resourceGroup, name string) MaintenanceConfigurationId { - return MaintenanceConfigurationId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id MaintenanceConfigurationId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Maintenance Configuration", segmentsStr) -} - -func (id MaintenanceConfigurationId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Maintenance/maintenanceConfigurations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// MaintenanceConfigurationID parses a MaintenanceConfiguration ID into an MaintenanceConfigurationId struct -func MaintenanceConfigurationID(input string) (*MaintenanceConfigurationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := MaintenanceConfigurationId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("maintenanceConfigurations"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// MaintenanceConfigurationIDInsensitively parses an MaintenanceConfiguration ID into an MaintenanceConfigurationId struct, insensitively -// This should only be used to parse an ID for rewriting, the MaintenanceConfigurationID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func MaintenanceConfigurationIDInsensitively(input string) (*MaintenanceConfigurationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := MaintenanceConfigurationId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'maintenanceConfigurations' segment - maintenanceConfigurationsKey := "maintenanceConfigurations" - for key := range id.Path { - if strings.EqualFold(key, maintenanceConfigurationsKey) { - maintenanceConfigurationsKey = key - break - } - } - if resourceId.Name, err = id.PopSegment(maintenanceConfigurationsKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse/public_maintenance_configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse/public_maintenance_configuration.go deleted file mode 100644 index da48a54c8c4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse/public_maintenance_configuration.go +++ /dev/null @@ -1,61 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type PublicMaintenanceConfigurationId struct { - SubscriptionId string - Name string -} - -func NewPublicMaintenanceConfigurationID(subscriptionId, name string) PublicMaintenanceConfigurationId { - return PublicMaintenanceConfigurationId{ - SubscriptionId: subscriptionId, - Name: name, - } -} - -func (id PublicMaintenanceConfigurationId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Public Maintenance Configuration", segmentsStr) -} - -func (id PublicMaintenanceConfigurationId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Name) -} - -// PublicMaintenanceConfigurationID parses a PublicMaintenanceConfiguration ID into an PublicMaintenanceConfigurationId struct -func PublicMaintenanceConfigurationID(input string) (*PublicMaintenanceConfigurationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := PublicMaintenanceConfigurationId{ - SubscriptionId: id.SubscriptionID, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.Name, err = id.PopSegment("publicMaintenanceConfigurations"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/public_maintenance_configurations_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/public_maintenance_configurations_data_source.go new file mode 100644 index 00000000000..dacbedc9ccc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/public_maintenance_configurations_data_source.go @@ -0,0 +1,231 @@ +package maintenance + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +const recurMondayToThursday = "Monday-Thursday" +const recurFridayToSunday = "Friday-Sunday" + +func dataSourcePublicMaintenanceConfigurations() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourcePublicMaintenanceConfigurationsRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + + "location": { + Type: pluginsdk.TypeString, + Optional: true, + StateFunc: azure.NormalizeLocation, + }, + + "scope": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(publicmaintenanceconfigurations.MaintenanceScopeExtension), + string(publicmaintenanceconfigurations.MaintenanceScopeHost), + string(publicmaintenanceconfigurations.MaintenanceScopeInGuestPatch), + string(publicmaintenanceconfigurations.MaintenanceScopeOSImage), + string(publicmaintenanceconfigurations.MaintenanceScopeSQLDB), + string(publicmaintenanceconfigurations.MaintenanceScopeSQLManagedInstance), + }, false), + }, + + "recur_every": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + recurMondayToThursday, + recurFridayToSunday, + }, false), + }, + + "configs": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "location": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "description": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "duration": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "maintenance_scope": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "time_zone": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "recur_every": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourcePublicMaintenanceConfigurationsRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Maintenance.PublicConfigurationsClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + subId := commonids.NewSubscriptionID(subscriptionId) + resp, err := client.List(ctx, subId) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("no Public Maintenance Configurations were found") + } + return fmt.Errorf("retrieving Public Maintenance Configurations: %+v", err) + } + + filteredPublicConfigs := make([]interface{}, 0) + + recurEveryFilter := d.Get("recur_every").(string) + if recurEveryFilter == recurFridayToSunday { + recurEveryFilter = "week Friday, Saturday, Sunday" + } else if recurEveryFilter == recurMondayToThursday { + recurEveryFilter = "week Monday, Tuesday, Wednesday, Thursday" + } + + locationFilter := azure.NormalizeLocation(d.Get("location").(string)) + scopeFilter := d.Get("scope").(string) + + if resp.Model != nil { + if resp.Model.Value != nil { + for _, maintenanceConfig := range *resp.Model.Value { + + var configLocation, configRecurEvery, configScope string + if maintenanceConfig.Location != nil { + configLocation = azure.NormalizeLocation(*maintenanceConfig.Location) + } + if props := maintenanceConfig.Properties; props != nil { + if props.MaintenanceWindow != nil && props.MaintenanceWindow.RecurEvery != nil { + configRecurEvery = *props.MaintenanceWindow.RecurEvery + } + + if props.MaintenanceScope != nil { + configScope = string(*props.MaintenanceScope) + } + } + + if locationFilter != "" && locationFilter != configLocation { + continue + } + if recurEveryFilter != "" && recurEveryFilter != configRecurEvery { + continue + } + if scopeFilter != "" && scopeFilter != configScope { + continue + } + + filteredPublicConfigs = append(filteredPublicConfigs, flattenPublicMaintenanceConfiguration(maintenanceConfig)) + } + } + } + if len(filteredPublicConfigs) == 0 { + return fmt.Errorf("no Public Maintenance Configurations were found") + } + + if err := d.Set("configs", filteredPublicConfigs); err != nil { + return fmt.Errorf("setting `configs`: %+v", err) + } + + d.SetId(time.Now().UTC().String()) + return nil +} + +func flattenPublicMaintenanceConfiguration(config publicmaintenanceconfigurations.MaintenanceConfiguration) map[string]interface{} { + output := make(map[string]interface{}) + + output["name"] = "" + if config.Name != nil { + output["name"] = *config.Name + } + + output["id"] = "" + if config.Id != nil { + output["id"] = *config.Id + } + + output["location"] = "" + if config.Location != nil { + output["location"] = azure.NormalizeLocation(*config.Location) + } + + var description, recurEvery, timeZone, duration, scope string + if props := config.Properties; props != nil { + if props.ExtensionProperties != nil { + extensionProperties := *props.ExtensionProperties + if configDescription, ok := extensionProperties["description"]; ok { + description = configDescription + } + } + + if config.Properties.MaintenanceScope != nil { + scope = string(*config.Properties.MaintenanceScope) + } + + if props.MaintenanceWindow != nil { + if props.MaintenanceWindow.RecurEvery != nil { + recurEvery = *props.MaintenanceWindow.RecurEvery + } + if props.MaintenanceWindow.TimeZone != nil { + timeZone = *props.MaintenanceWindow.TimeZone + } + if props.MaintenanceWindow.Duration != nil { + duration = *props.MaintenanceWindow.Duration + } + } + } + + output["description"] = description + output["recur_every"] = recurEvery + output["time_zone"] = timeZone + output["duration"] = duration + output["maintenance_scope"] = scope + + return output +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/registration.go index f73b3cf04a8..0bf99ffb28a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/registration.go @@ -25,7 +25,8 @@ func (r Registration) WebsiteCategories() []string { func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ - "azurerm_maintenance_configuration": dataSourceMaintenanceConfiguration(), + "azurerm_maintenance_configuration": dataSourceMaintenanceConfiguration(), + "azurerm_public_maintenance_configurations": dataSourcePublicMaintenanceConfigurations(), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/resourceids.go deleted file mode 100644 index 359b0603e7f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/resourceids.go +++ /dev/null @@ -1,4 +0,0 @@ -package maintenance - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=MaintenanceConfiguration -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Maintenance/maintenanceConfigurations/maintenanceConfiguration1 -rewrite=true -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=PublicMaintenanceConfiguration -id=/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/publicMaintenanceConfiguration1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/transition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/transition.go new file mode 100644 index 00000000000..4ff4895f843 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/transition.go @@ -0,0 +1,23 @@ +package maintenance + +import "github.com/hashicorp/terraform-provider-azurerm/utils" + +func expandTags(input map[string]interface{}) *map[string]string { + output := make(map[string]string) + for k, v := range input { + output[k] = v.(string) + } + return &output +} + +func flattenTags(input *map[string]string) map[string]*string { + output := make(map[string]*string) + + if input != nil { + for k, v := range *input { + output[k] = utils.String(v) + } + } + + return output +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/validate/maintenance_configuration_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/validate/maintenance_configuration_id.go deleted file mode 100644 index e4917c1f227..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/validate/maintenance_configuration_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse" -) - -func MaintenanceConfigurationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.MaintenanceConfigurationID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/validate/public_maintenance_configuration_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/validate/public_maintenance_configuration_id.go deleted file mode 100644 index 14898cb1595..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/validate/public_maintenance_configuration_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse" -) - -func PublicMaintenanceConfigurationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.PublicMaintenanceConfigurationID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/managementgroup/management_group_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/managementgroup/management_group_data_source.go index d69ec737f84..88b0de7ee32 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/managementgroup/management_group_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/managementgroup/management_group_data_source.go @@ -44,10 +44,27 @@ func dataSourceManagementGroup() *pluginsdk.Resource { }, "subscription_ids": { - Type: pluginsdk.TypeSet, + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, + }, + + "management_group_ids": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, + }, + + "all_subscription_ids": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, + }, + + "all_management_group_ids": { + Type: pluginsdk.TypeList, Computed: true, Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, - Set: pluginsdk.HashString, }, }, } @@ -90,11 +107,29 @@ func dataSourceManagementGroupRead(d *pluginsdk.ResourceData, meta interface{}) if props := resp.Properties; props != nil { d.Set("display_name", props.DisplayName) - subscriptionIds, err := flattenManagementGroupDataSourceSubscriptionIds(props.Children) - if err != nil { - return fmt.Errorf("flattening `subscription_ids`: %+v", err) + subscriptionIds := []interface{}{} + mgmtgroupIds := []interface{}{} + if err := flattenManagementGroupDataSourceChildren(&subscriptionIds, &mgmtgroupIds, props.Children, false); err != nil { + return fmt.Errorf("flattening direct children resources: %+v", err) + } + if err := d.Set("subscription_ids", subscriptionIds); err != nil { + return fmt.Errorf("setting `subscription_ids`: %v", err) + } + if err := d.Set("management_group_ids", mgmtgroupIds); err != nil { + return fmt.Errorf("setting `management_group_ids`: %v", err) + } + + subscriptionIds = []interface{}{} + mgmtgroupIds = []interface{}{} + if err := flattenManagementGroupDataSourceChildren(&subscriptionIds, &mgmtgroupIds, props.Children, true); err != nil { + return fmt.Errorf("flattening all children resources: %+v", err) + } + if err := d.Set("all_subscription_ids", subscriptionIds); err != nil { + return fmt.Errorf("setting `all_subscription_ids`: %v", err) + } + if err := d.Set("all_management_group_ids", mgmtgroupIds); err != nil { + return fmt.Errorf("setting `all_management_group_ids`: %v", err) } - d.Set("subscription_ids", subscriptionIds) parentId := "" if details := props.Details; details != nil { @@ -141,26 +176,37 @@ func getManagementGroupNameByDisplayName(ctx context.Context, client *management return results[0], nil } -func flattenManagementGroupDataSourceSubscriptionIds(input *[]managementgroups.ChildInfo) (*pluginsdk.Set, error) { - subscriptionIds := &pluginsdk.Set{F: pluginsdk.HashString} +func flattenManagementGroupDataSourceChildren(subscriptionIds, mgmtgroupIds *[]interface{}, input *[]managementgroups.ChildInfo, recursive bool) error { if input == nil { - return subscriptionIds, nil + return nil } for _, child := range *input { if child.ID == nil { continue } - - id, err := parseManagementGroupSubscriptionID(*child.ID) - if err != nil { - return nil, fmt.Errorf("Unable to parse child Subscription ID %+v", err) + switch child.Type { + case managementgroups.Type1MicrosoftManagementmanagementGroups: + id, err := parse.ManagementGroupID(*child.ID) + if err != nil { + return fmt.Errorf("Unable to parse child Management Group ID %+v", err) + } + *mgmtgroupIds = append(*mgmtgroupIds, id.ID()) + case managementgroups.Type1Subscriptions: + id, err := parseManagementGroupSubscriptionID(*child.ID) + if err != nil { + return fmt.Errorf("Unable to parse child Subscription ID %+v", err) + } + *subscriptionIds = append(*subscriptionIds, id.subscriptionId) + default: + continue } - - if id != nil { - subscriptionIds.Add(id.subscriptionId) + if recursive { + if err := flattenManagementGroupDataSourceChildren(subscriptionIds, mgmtgroupIds, child.Children, recursive); err != nil { + return err + } } } - return subscriptionIds, nil + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/client/client.go index 843706b9ce2..c58012a5b71 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/client/client.go @@ -1,9 +1,9 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/maps_account_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/maps_account_data_source.go index 29c53a8fc9a..3d4b9dc3f8b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/maps_account_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/maps_account_data_source.go @@ -5,11 +5,11 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts" "github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" ) @@ -29,14 +29,14 @@ func dataSourceMapsAccount() *pluginsdk.Resource { ValidateFunc: validate.AccountName(), }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), "sku_name": { Type: pluginsdk.TypeString, Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "x_ms_client_id": { Type: pluginsdk.TypeString, @@ -80,12 +80,12 @@ func dataSourceMapsAccountRead(d *pluginsdk.ResourceData, meta interface{}) erro d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { - d.Set("sku_name", model.Sku.Name) + d.Set("sku_name", string(model.Sku.Name)) if props := model.Properties; props != nil { d.Set("x_ms_client_id", props.UniqueId) } - if err := tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + if err := tags.FlattenAndSet(d, model.Tags); err != nil { return err } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/maps_account_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/maps_account_resource.go index 02e68e99b77..4160890b5c0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/maps_account_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/maps_account_resource.go @@ -5,14 +5,13 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts" "github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -45,20 +44,20 @@ func resourceMapsAccount() *pluginsdk.Resource { ValidateFunc: validate.AccountName(), }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), "sku_name": { Type: pluginsdk.TypeString, Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(maps.NameS0), - string(maps.NameS1), - string(maps.NameG2), + string(accounts.NameSZero), + string(accounts.NameSOne), + string(accounts.NameGTwo), }, false), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "x_ms_client_id": { Type: pluginsdk.TypeString, @@ -107,7 +106,7 @@ func resourceMapsAccountCreateUpdate(d *pluginsdk.ResourceData, meta interface{} Sku: accounts.Sku{ Name: accounts.Name(d.Get("sku_name").(string)), }, - Tags: expandTags(d.Get("tags").(map[string]interface{})), + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { @@ -145,12 +144,12 @@ func resourceMapsAccountRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("resource_group_name", id.ResourceGroupName) if model := resp.Model; model != nil { - d.Set("sku_name", model.Sku.Name) + d.Set("sku_name", string(model.Sku.Name)) if props := model.Properties; props != nil { d.Set("x_ms_client_id", props.UniqueId) } - if err := tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + if err := tags.FlattenAndSet(d, model.Tags); err != nil { return err } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/maps_creator_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/maps_creator_resource.go index bc266ca5fac..b61abca364c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/maps_creator_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/maps_creator_resource.go @@ -8,11 +8,10 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -89,9 +88,8 @@ func resourceMapsCreatorCreateUpdate(d *pluginsdk.ResourceData, meta interface{} } } - location := azure.NormalizeLocation(d.Get("location")) props := creators.Creator{ - Location: location, + Location: location.Normalize(d.Get("location").(string)), Properties: creators.CreatorProperties{ StorageUnits: int64(d.Get("storage_units").(int)), }, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/client.go deleted file mode 100644 index b53630d7e0e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package accounts - -import "github.com/Azure/go-autorest/autorest" - -type AccountsClient struct { - Client autorest.Client - baseUri string -} - -func NewAccountsClientWithBaseURI(endpoint string) AccountsClient { - return AccountsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/constants.go deleted file mode 100644 index 8a78feb2a4a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/constants.go +++ /dev/null @@ -1,124 +0,0 @@ -package accounts - -import "strings" - -type CreatedByType string - -const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" -) - -func PossibleValuesForCreatedByType() []string { - return []string{ - string(CreatedByTypeApplication), - string(CreatedByTypeKey), - string(CreatedByTypeManagedIdentity), - string(CreatedByTypeUser), - } -} - -func parseCreatedByType(input string) (*CreatedByType, error) { - vals := map[string]CreatedByType{ - "application": CreatedByTypeApplication, - "key": CreatedByTypeKey, - "managedidentity": CreatedByTypeManagedIdentity, - "user": CreatedByTypeUser, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CreatedByType(input) - return &out, nil -} - -type KeyType string - -const ( - KeyTypePrimary KeyType = "primary" - KeyTypeSecondary KeyType = "secondary" -) - -func PossibleValuesForKeyType() []string { - return []string{ - string(KeyTypePrimary), - string(KeyTypeSecondary), - } -} - -func parseKeyType(input string) (*KeyType, error) { - vals := map[string]KeyType{ - "primary": KeyTypePrimary, - "secondary": KeyTypeSecondary, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeyType(input) - return &out, nil -} - -type Kind string - -const ( - KindGenOne Kind = "Gen1" - KindGenTwo Kind = "Gen2" -) - -func PossibleValuesForKind() []string { - return []string{ - string(KindGenOne), - string(KindGenTwo), - } -} - -func parseKind(input string) (*Kind, error) { - vals := map[string]Kind{ - "gen1": KindGenOne, - "gen2": KindGenTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Kind(input) - return &out, nil -} - -type Name string - -const ( - NameGTwo Name = "G2" - NameSOne Name = "S1" - NameSZero Name = "S0" -) - -func PossibleValuesForName() []string { - return []string{ - string(NameGTwo), - string(NameSOne), - string(NameSZero), - } -} - -func parseName(input string) (*Name, error) { - vals := map[string]Name{ - "g2": NameGTwo, - "s1": NameSOne, - "s0": NameSZero, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Name(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/id_account.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/id_account.go deleted file mode 100644 index dcee34c86f3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/id_account.go +++ /dev/null @@ -1,124 +0,0 @@ -package accounts - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = AccountId{} - -// AccountId is a struct representing the Resource ID for a Account -type AccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string -} - -// NewAccountID returns a new AccountId struct -func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { - return AccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - } -} - -// ParseAccountID parses 'input' into a AccountId -func ParseAccountID(input string) (*AccountId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AccountId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId -// note: this method should only be used for API response data and not user input -func ParseAccountIDInsensitively(input string) (*AccountId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AccountId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateAccountID checks that 'input' can be parsed as a Account ID -func ValidateAccountID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseAccountID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Account ID -func (id AccountId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Maps/accounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Account ID -func (id AccountId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftMaps", "Microsoft.Maps", "Microsoft.Maps"), - resourceids.StaticSegment("accounts", "accounts", "accounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - } -} - -// String returns a human-readable description of this Account ID -func (id AccountId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - } - return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/id_resourcegroup.go deleted file mode 100644 index 701ad7475d2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package accounts - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/id_subscription.go deleted file mode 100644 index f95107ae71d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package accounts - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_createorupdate_autorest.go deleted file mode 100644 index 852c63e2e2f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_createorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package accounts - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateOrUpdateResponse struct { - HttpResponse *http.Response - Model *MapsAccount -} - -// CreateOrUpdate ... -func (c AccountsClient) CreateOrUpdate(ctx context.Context, id AccountId, input MapsAccount) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c AccountsClient) preparerForCreateOrUpdate(ctx context.Context, id AccountId, input MapsAccount) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_delete_autorest.go deleted file mode 100644 index 8fa3c451610..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_delete_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package accounts - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c AccountsClient) Delete(ctx context.Context, id AccountId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c AccountsClient) preparerForDelete(ctx context.Context, id AccountId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForDelete(resp *http.Response) (result DeleteResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_get_autorest.go deleted file mode 100644 index e20dcf88a31..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package accounts - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *MapsAccount -} - -// Get ... -func (c AccountsClient) Get(ctx context.Context, id AccountId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c AccountsClient) preparerForGet(ctx context.Context, id AccountId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 36e46653e04..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package accounts - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *[]MapsAccount - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []MapsAccount -} - -func (r ListByResourceGroupResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c AccountsClient) ListByResourceGroup(ctx context.Context, id ResourceGroupId) (resp ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c AccountsClient) ListByResourceGroupComplete(ctx context.Context, id ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, MapsAccountPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AccountsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate MapsAccountPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]MapsAccount, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c AccountsClient) preparerForListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Maps/accounts", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c AccountsClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - type page struct { - Values []MapsAccount `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_listbysubscription_autorest.go deleted file mode 100644 index d110c7d8dab..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_listbysubscription_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package accounts - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListBySubscriptionResponse struct { - HttpResponse *http.Response - Model *[]MapsAccount - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []MapsAccount -} - -func (r ListBySubscriptionResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListBySubscriptionResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListBySubscription ... -func (c AccountsClient) ListBySubscription(ctx context.Context, id SubscriptionId) (resp ListBySubscriptionResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c AccountsClient) ListBySubscriptionComplete(ctx context.Context, id SubscriptionId) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, MapsAccountPredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AccountsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate MapsAccountPredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]MapsAccount, 0) - - page, err := c.ListBySubscription(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c AccountsClient) preparerForListBySubscription(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Maps/accounts", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c AccountsClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListBySubscription handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionResponse, err error) { - type page struct { - Values []MapsAccount `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionResponse, err error) { - req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_listkeys_autorest.go deleted file mode 100644 index 42790f66bb0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_listkeys_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package accounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListKeysResponse struct { - HttpResponse *http.Response - Model *MapsAccountKeys -} - -// ListKeys ... -func (c AccountsClient) ListKeys(ctx context.Context, id AccountId) (result ListKeysResponse, err error) { - req, err := c.preparerForListKeys(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "ListKeys", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListKeys prepares the ListKeys request. -func (c AccountsClient) preparerForListKeys(ctx context.Context, id AccountId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListKeys handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForListKeys(resp *http.Response) (result ListKeysResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_regeneratekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_regeneratekeys_autorest.go deleted file mode 100644 index 6cbd78060c8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_regeneratekeys_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package accounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type RegenerateKeysResponse struct { - HttpResponse *http.Response - Model *MapsAccountKeys -} - -// RegenerateKeys ... -func (c AccountsClient) RegenerateKeys(ctx context.Context, id AccountId, input MapsKeySpecification) (result RegenerateKeysResponse, err error) { - req, err := c.preparerForRegenerateKeys(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "RegenerateKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegenerateKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "RegenerateKeys", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegenerateKeys prepares the RegenerateKeys request. -func (c AccountsClient) preparerForRegenerateKeys(ctx context.Context, id AccountId, input MapsKeySpecification) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regenerateKey", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegenerateKeys handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForRegenerateKeys(resp *http.Response) (result RegenerateKeysResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_update_autorest.go deleted file mode 100644 index d70440f1518..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/method_update_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package accounts - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UpdateResponse struct { - HttpResponse *http.Response - Model *MapsAccount -} - -// Update ... -func (c AccountsClient) Update(ctx context.Context, id AccountId, input MapsAccountUpdateParameters) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "accounts.AccountsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c AccountsClient) preparerForUpdate(ctx context.Context, id AccountId, input MapsAccountUpdateParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c AccountsClient) responderForUpdate(resp *http.Response) (result UpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_mapsaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_mapsaccount.go deleted file mode 100644 index d82e68c6a83..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_mapsaccount.go +++ /dev/null @@ -1,13 +0,0 @@ -package accounts - -type MapsAccount struct { - Id *string `json:"id,omitempty"` - Kind *Kind `json:"kind,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *MapsAccountProperties `json:"properties,omitempty"` - Sku Sku `json:"sku"` - SystemData *SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_mapsaccountkeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_mapsaccountkeys.go deleted file mode 100644 index 1bd4f166757..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_mapsaccountkeys.go +++ /dev/null @@ -1,8 +0,0 @@ -package accounts - -type MapsAccountKeys struct { - PrimaryKey *string `json:"primaryKey,omitempty"` - PrimaryKeyLastUpdated *string `json:"primaryKeyLastUpdated,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` - SecondaryKeyLastUpdated *string `json:"secondaryKeyLastUpdated,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_mapsaccountproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_mapsaccountproperties.go deleted file mode 100644 index 12703dd2ef5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_mapsaccountproperties.go +++ /dev/null @@ -1,7 +0,0 @@ -package accounts - -type MapsAccountProperties struct { - DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - UniqueId *string `json:"uniqueId,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_mapsaccountupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_mapsaccountupdateparameters.go deleted file mode 100644 index 26d831f445f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_mapsaccountupdateparameters.go +++ /dev/null @@ -1,8 +0,0 @@ -package accounts - -type MapsAccountUpdateParameters struct { - Kind *Kind `json:"kind,omitempty"` - Properties *MapsAccountProperties `json:"properties,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_mapskeyspecification.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_mapskeyspecification.go deleted file mode 100644 index 346328840c3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_mapskeyspecification.go +++ /dev/null @@ -1,5 +0,0 @@ -package accounts - -type MapsKeySpecification struct { - KeyType KeyType `json:"keyType"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_sku.go deleted file mode 100644 index 213db573ebf..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_sku.go +++ /dev/null @@ -1,6 +0,0 @@ -package accounts - -type Sku struct { - Name Name `json:"name"` - Tier *string `json:"tier,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_systemdata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_systemdata.go deleted file mode 100644 index 8bc1758a073..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/model_systemdata.go +++ /dev/null @@ -1,10 +0,0 @@ -package accounts - -type SystemData struct { - CreatedAt *string `json:"createdAt,omitempty"` - CreatedBy *string `json:"createdBy,omitempty"` - CreatedByType *CreatedByType `json:"createdByType,omitempty"` - LastModifiedAt *string `json:"lastModifiedAt,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/predicates.go deleted file mode 100644 index 05de8044727..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/predicates.go +++ /dev/null @@ -1,29 +0,0 @@ -package accounts - -type MapsAccountPredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p MapsAccountPredicate) Matches(input MapsAccount) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/version.go deleted file mode 100644 index 61fb0715ae5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package accounts - -import "fmt" - -const defaultApiVersion = "2021-02-01" - -func userAgent() string { - return fmt.Sprintf("pandora/accounts/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/client.go deleted file mode 100644 index f01bc96dccf..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package creators - -import "github.com/Azure/go-autorest/autorest" - -type CreatorsClient struct { - Client autorest.Client - baseUri string -} - -func NewCreatorsClientWithBaseURI(endpoint string) CreatorsClient { - return CreatorsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/id_account.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/id_account.go deleted file mode 100644 index eaf98848f56..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/id_account.go +++ /dev/null @@ -1,124 +0,0 @@ -package creators - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = AccountId{} - -// AccountId is a struct representing the Resource ID for a Account -type AccountId struct { - SubscriptionId string - ResourceGroupName string - AccountName string -} - -// NewAccountID returns a new AccountId struct -func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { - return AccountId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - } -} - -// ParseAccountID parses 'input' into a AccountId -func ParseAccountID(input string) (*AccountId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AccountId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId -// note: this method should only be used for API response data and not user input -func ParseAccountIDInsensitively(input string) (*AccountId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AccountId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateAccountID checks that 'input' can be parsed as a Account ID -func ValidateAccountID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseAccountID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Account ID -func (id AccountId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Maps/accounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Account ID -func (id AccountId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftMaps", "Microsoft.Maps", "Microsoft.Maps"), - resourceids.StaticSegment("accounts", "accounts", "accounts"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - } -} - -// String returns a human-readable description of this Account ID -func (id AccountId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - } - return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/method_createorupdate_autorest.go deleted file mode 100644 index acd0ca7ba9b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/method_createorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package creators - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateOrUpdateResponse struct { - HttpResponse *http.Response - Model *Creator -} - -// CreateOrUpdate ... -func (c CreatorsClient) CreateOrUpdate(ctx context.Context, id CreatorId, input Creator) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c CreatorsClient) preparerForCreateOrUpdate(ctx context.Context, id CreatorId, input Creator) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c CreatorsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/method_delete_autorest.go deleted file mode 100644 index 808983262e6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/method_delete_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package creators - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c CreatorsClient) Delete(ctx context.Context, id CreatorId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c CreatorsClient) preparerForDelete(ctx context.Context, id CreatorId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c CreatorsClient) responderForDelete(resp *http.Response) (result DeleteResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/method_get_autorest.go deleted file mode 100644 index cf25918e10f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package creators - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *Creator -} - -// Get ... -func (c CreatorsClient) Get(ctx context.Context, id CreatorId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c CreatorsClient) preparerForGet(ctx context.Context, id CreatorId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c CreatorsClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/method_update_autorest.go deleted file mode 100644 index 131d64d6ec4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/method_update_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package creators - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UpdateResponse struct { - HttpResponse *http.Response - Model *Creator -} - -// Update ... -func (c CreatorsClient) Update(ctx context.Context, id CreatorId, input CreatorUpdateParameters) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "creators.CreatorsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c CreatorsClient) preparerForUpdate(ctx context.Context, id CreatorId, input CreatorUpdateParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c CreatorsClient) responderForUpdate(resp *http.Response) (result UpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/model_creator.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/model_creator.go deleted file mode 100644 index c21ffc6c402..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/model_creator.go +++ /dev/null @@ -1,10 +0,0 @@ -package creators - -type Creator struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties CreatorProperties `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/model_creatorproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/model_creatorproperties.go deleted file mode 100644 index 29911060ce2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/model_creatorproperties.go +++ /dev/null @@ -1,6 +0,0 @@ -package creators - -type CreatorProperties struct { - ProvisioningState *string `json:"provisioningState,omitempty"` - StorageUnits int64 `json:"storageUnits"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/model_creatorupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/model_creatorupdateparameters.go deleted file mode 100644 index 9642bcb0d32..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/model_creatorupdateparameters.go +++ /dev/null @@ -1,6 +0,0 @@ -package creators - -type CreatorUpdateParameters struct { - Properties *CreatorProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/predicates.go deleted file mode 100644 index 5094dec93f8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/predicates.go +++ /dev/null @@ -1,29 +0,0 @@ -package creators - -type CreatorPredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p CreatorPredicate) Matches(input Creator) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/version.go deleted file mode 100644 index a938be04aeb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package creators - -import "fmt" - -const defaultApiVersion = "2021-02-01" - -func userAgent() string { - return fmt.Sprintf("pandora/creators/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/transition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/transition.go deleted file mode 100644 index 88c70ee8bfd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/transition.go +++ /dev/null @@ -1,23 +0,0 @@ -package maps - -import "github.com/hashicorp/terraform-provider-azurerm/utils" - -func expandTags(input map[string]interface{}) *map[string]string { - output := make(map[string]string) - for k, v := range input { - output[k] = v.(string) - } - return &output -} - -func flattenTags(input *map[string]string) map[string]*string { - output := make(map[string]*string) - - if input != nil { - for k, v := range *input { - output[k] = utils.String(v) - } - } - - return output -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/validate/account_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/validate/account_id.go deleted file mode 100644 index 31f007f620b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/validate/account_id.go +++ /dev/null @@ -1,21 +0,0 @@ -package validate - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts" -) - -func AccountID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := accounts.ParseAccountID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/client/client.go index 0e1cb2344c0..deba55b3309 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/client/client.go @@ -1,32 +1,36 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb" + "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations" + "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules" + "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers" + "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - ConfigurationsClient *mariadb.ConfigurationsClient - DatabasesClient *mariadb.DatabasesClient - FirewallRulesClient *mariadb.FirewallRulesClient - ServersClient *mariadb.ServersClient - VirtualNetworkRulesClient *mariadb.VirtualNetworkRulesClient + ConfigurationsClient *configurations.ConfigurationsClient + DatabasesClient *databases.DatabasesClient + FirewallRulesClient *firewallrules.FirewallRulesClient + ServersClient *servers.ServersClient + VirtualNetworkRulesClient *virtualnetworkrules.VirtualNetworkRulesClient } func NewClient(o *common.ClientOptions) *Client { - configurationsClient := mariadb.NewConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + configurationsClient := configurations.NewConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&configurationsClient.Client, o.ResourceManagerAuthorizer) - DatabasesClient := mariadb.NewDatabasesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + DatabasesClient := databases.NewDatabasesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&DatabasesClient.Client, o.ResourceManagerAuthorizer) - FirewallRulesClient := mariadb.NewFirewallRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + FirewallRulesClient := firewallrules.NewFirewallRulesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&FirewallRulesClient.Client, o.ResourceManagerAuthorizer) - ServersClient := mariadb.NewServersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + ServersClient := servers.NewServersClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&ServersClient.Client, o.ResourceManagerAuthorizer) - VirtualNetworkRulesClient := mariadb.NewVirtualNetworkRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + VirtualNetworkRulesClient := virtualnetworkrules.NewVirtualNetworkRulesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&VirtualNetworkRulesClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_configuration_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_configuration_resource.go index abedc306dec..f16ad132504 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_configuration_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_configuration_resource.go @@ -5,10 +5,10 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -22,7 +22,7 @@ func resourceMariaDbConfiguration() *pluginsdk.Resource { Read: resourceMariaDbConfigurationRead, Delete: resourceMariaDbConfigurationDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.MariaDBConfigurationID(id) + _, err := configurations.ParseConfigurationID(id) return err }), @@ -65,23 +65,17 @@ func resourceMariaDbConfigurationCreateUpdate(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[INFO] preparing arguments for AzureRM MariaDb Configuration creation.") - id := parse.NewMariaDBConfigurationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) + id := configurations.NewConfigurationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) value := d.Get("value").(string) - properties := mariadb.Configuration{ - ConfigurationProperties: &mariadb.ConfigurationProperties{ + properties := configurations.Configuration{ + Properties: &configurations.ConfigurationProperties{ Value: utils.String(value), }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.ConfigurationName, properties) - if err != nil { - return fmt.Errorf("issuing create/update request for %s: %v", id, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for create/update of %s: %v", id, err) + if err := client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } d.SetId(id.ID()) @@ -94,26 +88,35 @@ func resourceMariaDbConfigurationRead(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.MariaDBConfigurationID(d.Id()) + id, err := configurations.ParseConfigurationID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.ConfigurationName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[WARN] %s was not found", *id) d.SetId("") return nil } - return fmt.Errorf("making Read request on %s: %+v", *id, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("name", id.ConfigurationName) d.Set("server_name", id.ServerName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("value", resp.ConfigurationProperties.Value) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + value := "" + if v := props.Value; v != nil { + value = *v + } + d.Set("value", value) + } + } return nil } @@ -123,28 +126,37 @@ func resourceMariaDbConfigurationDelete(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.MariaDBConfigurationID(d.Id()) + id, err := configurations.ParseConfigurationID(d.Id()) if err != nil { return err } // "delete" = resetting this to the default value - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.ConfigurationName) + resp, err := client.Get(ctx, *id) if err != nil { return fmt.Errorf("retrieving %s: %+v", *id, err) } - properties := mariadb.Configuration{ - ConfigurationProperties: &mariadb.ConfigurationProperties{ + defaultValue := "" + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + if v := props.DefaultValue; v != nil { + defaultValue = *v + } + } + } + + properties := configurations.Configuration{ + Properties: &configurations.ConfigurationProperties{ // we can alternatively set `source: "system-default"` - Value: resp.DefaultValue, + Value: &defaultValue, }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.ConfigurationName, properties) - if err != nil { - return err + if err := client.CreateOrUpdateThenPoll(ctx, *id, properties); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } - return future.WaitForCompletionRef(ctx, client.Client) + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_database_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_database_resource.go index 4c3226a63ec..391a05b861d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_database_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_database_resource.go @@ -6,11 +6,11 @@ import ( "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -25,7 +25,7 @@ func resourceMariaDbDatabase() *pluginsdk.Resource { Delete: resourceMariaDbDatabaseDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.MariaDBDatabaseID(id) + _, err := databases.ParseDatabaseID(id) return err }), @@ -87,17 +87,17 @@ func resourceMariaDbDatabaseCreateUpdate(d *pluginsdk.ResourceData, meta interfa log.Printf("[INFO] preparing arguments for AzureRM MariaDB database creation") - id := parse.NewMariaDBDatabaseID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) + id := databases.NewDatabaseID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.DatabaseName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_mariadb_database", id.ID()) } } @@ -105,22 +105,17 @@ func resourceMariaDbDatabaseCreateUpdate(d *pluginsdk.ResourceData, meta interfa charset := d.Get("charset").(string) collation := d.Get("collation").(string) - properties := mariadb.Database{ - DatabaseProperties: &mariadb.DatabaseProperties{ + properties := databases.Database{ + Properties: &databases.DatabaseProperties{ Charset: utils.String(charset), Collation: utils.String(collation), }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.DatabaseName, properties) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for completion of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceMariaDbDatabaseRead(d, meta) @@ -131,31 +126,43 @@ func resourceMariaDbDatabaseRead(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.MariaDBDatabaseID(d.Id()) + id, err := databases.ParseDatabaseID(d.Id()) if err != nil { - return fmt.Errorf("cannot parse MariaDB database %q ID:\n%+v", d.Id(), err) + return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.DatabaseName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[WARN] %s was not found", *id) d.SetId("") return nil } - return fmt.Errorf("making read request on %s:\n%+v", *id, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("name", id.DatabaseName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("server_name", id.ServerName) - if properties := resp.DatabaseProperties; properties != nil { - d.Set("charset", properties.Charset) - d.Set("collation", properties.Collation) + charset := "" + collation := "" + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + if v := props.Charset; v != nil { + charset = *v + } + if v := props.Collation; v != nil { + collation = *v + } + } } + d.Set("charset", charset) + d.Set("collation", collation) + return nil } @@ -164,18 +171,13 @@ func resourceMariaDbDatabaseDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.MariaDBDatabaseID(d.Id()) - if err != nil { - return fmt.Errorf("cannot parse MariaDB database %q ID:\n%+v", d.Id(), err) - } - - future, err := client.Delete(ctx, id.ResourceGroup, id.ServerName, id.DatabaseName) + id, err := databases.ParseDatabaseID(d.Id()) if err != nil { - return fmt.Errorf("making delete request on %s:\n%+v", *id, err) + return err } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s:\n%+v", *id, err) + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_firewall_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_firewall_rule_resource.go index 50a217f3620..14a9a8fc64b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_firewall_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_firewall_rule_resource.go @@ -5,16 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceArmMariaDBFirewallRule() *pluginsdk.Resource { @@ -24,7 +23,7 @@ func resourceArmMariaDBFirewallRule() *pluginsdk.Resource { Update: resourceArmMariaDBFirewallRuleCreateUpdate, Delete: resourceArmMariaDBFirewallRuleDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.MariaDBFirewallRuleID(id) + _, err := firewallrules.ParseFirewallRuleID(id) return err }), @@ -75,37 +74,32 @@ func resourceArmMariaDBFirewallRuleCreateUpdate(d *pluginsdk.ResourceData, meta log.Printf("[INFO] preparing arguments for AzureRM MariaDB Firewall Rule creation.") - id := parse.NewMariaDBFirewallRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) + id := firewallrules.NewFirewallRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) startIPAddress := d.Get("start_ip_address").(string) endIPAddress := d.Get("end_ip_address").(string) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.FirewallRuleName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_mariadb_firewall_rule", id.ID()) } } - properties := mariadb.FirewallRule{ - FirewallRuleProperties: &mariadb.FirewallRuleProperties{ - StartIPAddress: utils.String(startIPAddress), - EndIPAddress: utils.String(endIPAddress), + properties := firewallrules.FirewallRule{ + Properties: firewallrules.FirewallRuleProperties{ + StartIPAddress: startIPAddress, + EndIPAddress: endIPAddress, }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.FirewallRuleName, properties) - if err != nil { - return fmt.Errorf("issuing create/update request for %s: %v", id, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting on create/update future for %s: %v", id, err) + if err := client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { + return fmt.Errorf("creating/updated %s: %v", id, err) } d.SetId(id.ID()) @@ -118,25 +112,28 @@ func resourceArmMariaDBFirewallRuleRead(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.MariaDBFirewallRuleID(d.Id()) + id, err := firewallrules.ParseFirewallRuleID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.FirewallRuleName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("making Read request on %s: %+v", *id, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("name", id.FirewallRuleName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("server_name", id.ServerName) - d.Set("start_ip_address", resp.StartIPAddress) - d.Set("end_ip_address", resp.EndIPAddress) + + if model := resp.Model; model != nil { + d.Set("start_ip_address", model.Properties.StartIPAddress) + d.Set("end_ip_address", model.Properties.EndIPAddress) + } return nil } @@ -146,15 +143,14 @@ func resourceArmMariaDBFirewallRuleDelete(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.MariaDBFirewallRuleID(d.Id()) + id, err := firewallrules.ParseFirewallRuleID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ServerName, id.FirewallRuleName) - if err != nil { - return err + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } - return future.WaitForCompletionRef(ctx, client.Client) + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_server_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_server_data_source.go index 287aef2f68e..180c47d9f7c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_server_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_server_data_source.go @@ -5,15 +5,15 @@ import ( "regexp" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceMariaDbServer() *pluginsdk.Resource { @@ -91,7 +91,7 @@ func dataSourceMariaDbServer() *pluginsdk.Resource { Computed: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -102,10 +102,10 @@ func dataSourceMariaDbServerRead(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := servers.NewServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } @@ -113,18 +113,45 @@ func dataSourceMariaDbServerRead(d *pluginsdk.ResourceData, meta interface{}) er } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) - if sku := resp.Sku; sku != nil { - d.Set("sku_name", sku.Name) - } + d.Set("name", id.ServerName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + + if sku := model.Sku; sku != nil { + d.Set("sku_name", sku.Name) + } - if props := resp.ServerProperties; props != nil { - d.Set("administrator_login", props.AdministratorLogin) - d.Set("fqdn", props.FullyQualifiedDomainName) - d.Set("ssl_enforcement", string(props.SslEnforcement)) - d.Set("version", string(props.Version)) + if props := model.Properties; props != nil { + adminLogin := "" + if v := props.AdministratorLogin; v != nil { + adminLogin = *v + } + + fqdn := "" + if v := props.FullyQualifiedDomainName; v != nil { + fqdn = *v + } + + sslEnforcement := "" + if v := props.SslEnforcement; v != nil { + sslEnforcement = string(*v) + } + + version := "" + if v := props.Version; v != nil { + version = string(*v) + } + + d.Set("administrator_login", adminLogin) + d.Set("fqdn", fqdn) + d.Set("ssl_enforcement", sslEnforcement) + d.Set("version", version) + } + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_server_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_server_resource.go index 3f31eee1774..424e5f58cf7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_server_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_server_resource.go @@ -8,14 +8,14 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb" - "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -30,7 +30,7 @@ func resourceMariaDbServer() *pluginsdk.Resource { Delete: resourceMariaDbServerDelete, Importer: pluginsdk.ImporterValidatingResourceIdThen(func(id string) error { - _, err := parse.ServerID(id) + _, err := servers.ParseServerID(id) return err }, func(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) ([]*pluginsdk.ResourceData, error) { d.Set("create_mode", "Default") @@ -42,7 +42,7 @@ func resourceMariaDbServer() *pluginsdk.Resource { }), Timeouts: &pluginsdk.ResourceTimeout{ - Create: pluginsdk.DefaultTimeout(60 * time.Minute), + Create: pluginsdk.DefaultTimeout(90 * time.Minute), Read: pluginsdk.DefaultTimeout(5 * time.Minute), Update: pluginsdk.DefaultTimeout(60 * time.Minute), Delete: pluginsdk.DefaultTimeout(60 * time.Minute), @@ -85,19 +85,19 @@ func resourceMariaDbServer() *pluginsdk.Resource { "create_mode": { Type: pluginsdk.TypeString, Optional: true, - Default: string(mariadb.CreateModeDefault), + Default: string(servers.CreateModeDefault), ValidateFunc: validation.StringInSlice([]string{ - string(mariadb.CreateModeDefault), - string(mariadb.CreateModeGeoRestore), - string(mariadb.CreateModePointInTimeRestore), - string(mariadb.CreateModeReplica), + string(servers.CreateModeDefault), + string(servers.CreateModeGeoRestore), + string(servers.CreateModePointInTimeRestore), + string(servers.CreateModeReplica), }, false), }, "creation_source_server_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: validate.ServerID, + ValidateFunc: servers.ValidateServerID, }, "fqdn": { @@ -160,7 +160,7 @@ func resourceMariaDbServer() *pluginsdk.Resource { ), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "version": { Type: pluginsdk.TypeString, @@ -181,45 +181,45 @@ func resourceMariaDbServerCreate(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := servers.NewServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_mariadb_server", id.ID()) } } location := azure.NormalizeLocation(d.Get("location").(string)) - mode := mariadb.CreateMode(d.Get("create_mode").(string)) + mode := servers.CreateMode(d.Get("create_mode").(string)) source := d.Get("creation_source_server_id").(string) - version := mariadb.ServerVersion(d.Get("version").(string)) + version := servers.ServerVersion(d.Get("version").(string)) sku, err := expandServerSkuName(d.Get("sku_name").(string)) if err != nil { return fmt.Errorf("expanding `sku_name`: %+v", err) } - publicAccess := mariadb.PublicNetworkAccessEnumEnabled + publicAccess := servers.PublicNetworkAccessEnumEnabled if v := d.Get("public_network_access_enabled"); !v.(bool) { - publicAccess = mariadb.PublicNetworkAccessEnumDisabled + publicAccess = servers.PublicNetworkAccessEnumDisabled } - ssl := mariadb.SslEnforcementEnumEnabled + ssl := servers.SslEnforcementEnumEnabled if v := d.Get("ssl_enforcement_enabled").(bool); !v { - ssl = mariadb.SslEnforcementEnumDisabled + ssl = servers.SslEnforcementEnumDisabled } storage := expandMariaDbStorageProfile(d) - var props mariadb.BasicServerPropertiesForCreate + var props servers.ServerPropertiesForCreate switch mode { - case mariadb.CreateModeDefault: + case servers.CreateModeDefault: admin := d.Get("administrator_login").(string) pass := d.Get("administrator_login_password").(string) @@ -234,68 +234,57 @@ func resourceMariaDbServerCreate(d *pluginsdk.ResourceData, meta interface{}) er return fmt.Errorf("`restore_point_in_time` cannot be set when `create_mode` is `default`") } - props = &mariadb.ServerPropertiesForDefaultCreate{ - AdministratorLogin: &admin, - AdministratorLoginPassword: &pass, - CreateMode: mode, - PublicNetworkAccess: publicAccess, - SslEnforcement: ssl, + props = servers.ServerPropertiesForDefaultCreate{ + AdministratorLogin: admin, + AdministratorLoginPassword: pass, + PublicNetworkAccess: &publicAccess, + SslEnforcement: &ssl, StorageProfile: storage, - Version: version, + Version: &version, } - case mariadb.CreateModePointInTimeRestore: + + case servers.CreateModePointInTimeRestore: v, ok := d.GetOk("restore_point_in_time") if !ok || v.(string) == "" { return fmt.Errorf("restore_point_in_time must be set when create_mode is PointInTimeRestore") } - time, _ := time.Parse(time.RFC3339, v.(string)) // should be validated by the schema - props = &mariadb.ServerPropertiesForRestore{ - CreateMode: mode, - SourceServerID: &source, - RestorePointInTime: &date.Time{ - Time: time, - }, - PublicNetworkAccess: publicAccess, - SslEnforcement: ssl, + props = &servers.ServerPropertiesForRestore{ + SourceServerId: source, + RestorePointInTime: v.(string), + PublicNetworkAccess: &publicAccess, + SslEnforcement: &ssl, StorageProfile: storage, - Version: version, + Version: &version, } - case mariadb.CreateModeGeoRestore: - props = &mariadb.ServerPropertiesForGeoRestore{ - CreateMode: mode, - SourceServerID: &source, - PublicNetworkAccess: publicAccess, - SslEnforcement: ssl, + case servers.CreateModeGeoRestore: + props = &servers.ServerPropertiesForGeoRestore{ + SourceServerId: source, + PublicNetworkAccess: &publicAccess, + SslEnforcement: &ssl, StorageProfile: storage, - Version: version, + Version: &version, } - case mariadb.CreateModeReplica: - props = &mariadb.ServerPropertiesForReplica{ - CreateMode: mode, - SourceServerID: &source, - PublicNetworkAccess: publicAccess, - SslEnforcement: ssl, - Version: version, + case servers.CreateModeReplica: + props = &servers.ServerPropertiesForReplica{ + SourceServerId: source, + PublicNetworkAccess: &publicAccess, + SslEnforcement: &ssl, + Version: &version, } } - server := mariadb.ServerForCreate{ - Location: &location, + server := servers.ServerForCreate{ + Location: location, Properties: props, Sku: sku, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.Create(ctx, id.ResourceGroup, id.Name, server) - if err != nil { + if err := client.CreateThenPoll(ctx, id, server); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the creation of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceMariaDbServerRead(d, meta) } @@ -307,7 +296,7 @@ func resourceMariaDbServerUpdate(d *pluginsdk.ResourceData, meta interface{}) er log.Printf("[INFO] preparing arguments for AzureRM MariaDB Server update.") - id, err := parse.ServerID(d.Id()) + id, err := servers.ParseServerID(d.Id()) if err != nil { return err } @@ -317,39 +306,34 @@ func resourceMariaDbServerUpdate(d *pluginsdk.ResourceData, meta interface{}) er return fmt.Errorf("expanding `sku_name`: %+v", err) } - publicAccess := mariadb.PublicNetworkAccessEnumEnabled + publicAccess := servers.PublicNetworkAccessEnumEnabled if v := d.Get("public_network_access_enabled").(bool); !v { - publicAccess = mariadb.PublicNetworkAccessEnumDisabled + publicAccess = servers.PublicNetworkAccessEnumDisabled } - ssl := mariadb.SslEnforcementEnumEnabled + ssl := servers.SslEnforcementEnumEnabled if v := d.Get("ssl_enforcement_enabled").(bool); !v { - ssl = mariadb.SslEnforcementEnumDisabled + ssl = servers.SslEnforcementEnumDisabled } storageProfile := expandMariaDbStorageProfile(d) - - properties := mariadb.ServerUpdateParameters{ - ServerUpdateParametersProperties: &mariadb.ServerUpdateParametersProperties{ + serverVersion := servers.ServerVersion(d.Get("version").(string)) + properties := servers.ServerUpdateParameters{ + Properties: &servers.ServerUpdateParametersProperties{ AdministratorLoginPassword: utils.String(d.Get("administrator_login_password").(string)), - PublicNetworkAccess: publicAccess, - SslEnforcement: ssl, + PublicNetworkAccess: &publicAccess, + SslEnforcement: &ssl, StorageProfile: storageProfile, - Version: mariadb.ServerVersion(d.Get("version").(string)), + Version: &serverVersion, }, Sku: sku, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.Update(ctx, id.ResourceGroup, id.Name, properties) - if err != nil { + if err := client.UpdateThenPoll(ctx, *id, properties); err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of %s: %+v", *id, err) - } - return resourceMariaDbServerRead(d, meta) } @@ -358,14 +342,14 @@ func resourceMariaDbServerRead(d *pluginsdk.ResourceData, meta interface{}) erro ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ServerID(d.Id()) + id, err := servers.ParseServerID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[WARN] %s was not found - removing from state", *id) d.SetId("") return nil @@ -374,35 +358,60 @@ func resourceMariaDbServerRead(d *pluginsdk.ResourceData, meta interface{}) erro return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.ServerName) + d.Set("resource_group_name", id.ResourceGroupName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) - if sku := resp.Sku; sku != nil { - d.Set("sku_name", sku.Name) - } - - if props := resp.ServerProperties; props != nil { - d.Set("administrator_login", props.AdministratorLogin) - d.Set("public_network_access_enabled", props.PublicNetworkAccess == mariadb.PublicNetworkAccessEnumEnabled) - d.Set("ssl_enforcement_enabled", props.SslEnforcement == mariadb.SslEnforcementEnumEnabled) - d.Set("version", string(props.Version)) - - if storage := props.StorageProfile; storage != nil { - d.Set("auto_grow_enabled", storage.StorageAutogrow == mariadb.StorageAutogrowEnabled) - d.Set("backup_retention_days", storage.BackupRetentionDays) - d.Set("geo_redundant_backup_enabled", storage.GeoRedundantBackup == mariadb.Enabled) - d.Set("storage_mb", storage.StorageMB) + if sku := model.Sku; sku != nil { + d.Set("sku_name", sku.Name) } - // Computed - d.Set("fqdn", props.FullyQualifiedDomainName) - } + if props := model.Properties; props != nil { + d.Set("administrator_login", props.AdministratorLogin) - return tags.FlattenAndSet(d, resp.Tags) + publicNetworkAccess := false + if props.PublicNetworkAccess != nil { + publicNetworkAccess = *props.PublicNetworkAccess == servers.PublicNetworkAccessEnumEnabled + } + d.Set("public_network_access_enabled", publicNetworkAccess) + + sslEnforcement := false + if props.SslEnforcement != nil { + sslEnforcement = *props.SslEnforcement == servers.SslEnforcementEnumEnabled + } + d.Set("ssl_enforcement_enabled", sslEnforcement) + + version := "" + if props.Version != nil { + version = string(*props.Version) + } + d.Set("version", version) + + if storage := props.StorageProfile; storage != nil { + autoGrow := false + if storage.StorageAutogrow != nil { + autoGrow = *storage.StorageAutogrow == servers.StorageAutogrowEnabled + } + d.Set("auto_grow_enabled", autoGrow) + + geoRedundant := false + if storage.GeoRedundantBackup != nil { + geoRedundant = *storage.GeoRedundantBackup == servers.GeoRedundantBackupEnabled + } + d.Set("geo_redundant_backup_enabled", geoRedundant) + d.Set("backup_retention_days", storage.BackupRetentionDays) + d.Set("storage_mb", storage.StorageMB) + + } + + // Computed + d.Set("fqdn", props.FullyQualifiedDomainName) + } + return tags.FlattenAndSet(d, model.Tags) + } + return nil } func resourceMariaDbServerDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -410,37 +419,32 @@ func resourceMariaDbServerDelete(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ServerID(d.Id()) + id, err := servers.ParseServerID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { + if err := client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) - } - return nil } -func expandServerSkuName(skuName string) (*mariadb.Sku, error) { +func expandServerSkuName(skuName string) (*servers.Sku, error) { parts := strings.Split(skuName, "_") if len(parts) != 3 { return nil, fmt.Errorf("sku_name (%s) has the wrong number of parts (%d) after splitting on _", skuName, len(parts)) } - var tier mariadb.SkuTier + var tier servers.SkuTier switch parts[0] { case "B": - tier = mariadb.Basic + tier = servers.SkuTierBasic case "GP": - tier = mariadb.GeneralPurpose + tier = servers.SkuTierGeneralPurpose case "MO": - tier = mariadb.MemoryOptimized + tier = servers.SkuTierMemoryOptimized default: return nil, fmt.Errorf("sku_name %s has unknown sku tier %s", skuName, parts[0]) } @@ -450,37 +454,39 @@ func expandServerSkuName(skuName string) (*mariadb.Sku, error) { return nil, fmt.Errorf("cannot convert `sku_name` %q capacity %s to int", skuName, parts[2]) } - return &mariadb.Sku{ - Name: utils.String(skuName), - Tier: tier, - Capacity: utils.Int32(int32(capacity)), + return &servers.Sku{ + Name: skuName, + Tier: &tier, + Capacity: utils.Int64(int64(capacity)), Family: utils.String(parts[1]), }, nil } -func expandMariaDbStorageProfile(d *pluginsdk.ResourceData) *mariadb.StorageProfile { - storage := mariadb.StorageProfile{} +func expandMariaDbStorageProfile(d *pluginsdk.ResourceData) *servers.StorageProfile { + storage := servers.StorageProfile{} // now override whatever we may have from the block with the top level properties if v, ok := d.GetOk("auto_grow_enabled"); ok { - storage.StorageAutogrow = mariadb.StorageAutogrowDisabled + autogrowEnabled := servers.StorageAutogrowDisabled if v.(bool) { - storage.StorageAutogrow = mariadb.StorageAutogrowEnabled + autogrowEnabled = servers.StorageAutogrowEnabled } + storage.StorageAutogrow = &autogrowEnabled } if v, ok := d.GetOk("backup_retention_days"); ok { - storage.BackupRetentionDays = utils.Int32(int32(v.(int))) + storage.BackupRetentionDays = utils.Int64(int64(v.(int))) } if v, ok := d.GetOk("geo_redundant_backup_enabled"); ok { - storage.GeoRedundantBackup = mariadb.Disabled + geoRedundantBackup := servers.GeoRedundantBackupDisabled if v.(bool) { - storage.GeoRedundantBackup = mariadb.Enabled + geoRedundantBackup = servers.GeoRedundantBackupEnabled } + storage.GeoRedundantBackup = &geoRedundantBackup } if v, ok := d.GetOk("storage_mb"); ok { - storage.StorageMB = utils.Int32(int32(v.(int))) + storage.StorageMB = utils.Int64(int64(v.(int))) } return &storage diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_virtual_network_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_virtual_network_rule_resource.go index c7af2b36673..00347fe4379 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_virtual_network_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/mariadb_virtual_network_rule_resource.go @@ -6,12 +6,11 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate" validate2 "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -26,7 +25,7 @@ func resourceMariaDbVirtualNetworkRule() *pluginsdk.Resource { Update: resourceMariaDbVirtualNetworkRuleCreateUpdate, Delete: resourceMariaDbVirtualNetworkRuleDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.MariaDBVirtualNetworkRuleID(id) + _, err := virtualnetworkrules.ParseVirtualNetworkRuleID(id) return err }), @@ -69,44 +68,40 @@ func resourceMariaDbVirtualNetworkRuleCreateUpdate(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewMariaDBVirtualNetworkRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) + id := virtualnetworkrules.NewVirtualNetworkRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) subnetId := d.Get("subnet_id").(string) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.VirtualNetworkRuleName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_mariadb_virtual_network_rule", id.ID()) } } - parameters := mariadb.VirtualNetworkRule{ - VirtualNetworkRuleProperties: &mariadb.VirtualNetworkRuleProperties{ - VirtualNetworkSubnetID: utils.String(subnetId), + parameters := virtualnetworkrules.VirtualNetworkRule{ + Properties: &virtualnetworkrules.VirtualNetworkRuleProperties{ + VirtualNetworkSubnetId: subnetId, IgnoreMissingVnetServiceEndpoint: utils.Bool(false), }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.VirtualNetworkRuleName, parameters) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %q: %+v", id, err) - } // Wait for the provisioning state to become ready log.Printf("[DEBUG] Waiting for %s to become ready", id) stateConf := &pluginsdk.StateChangeConf{ Pending: []string{"Initializing", "InProgress", "Unknown", "ResponseNotFound"}, Target: []string{"Ready"}, - Refresh: mariaDbVirtualNetworkStateStatusCodeRefreshFunc(ctx, client, id.ResourceGroup, id.ServerName, id.VirtualNetworkRuleName), + Refresh: mariaDbVirtualNetworkStateStatusCodeRefreshFunc(ctx, client, id), MinTimeout: 1 * time.Minute, ContinuousTargetOccurence: 5, } @@ -130,14 +125,14 @@ func resourceMariaDbVirtualNetworkRuleRead(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.MariaDBVirtualNetworkRuleID(d.Id()) + id, err := virtualnetworkrules.ParseVirtualNetworkRuleID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.VirtualNetworkRuleName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] Error reading MariaDb Virtual Network Rule %q - removing from state", d.Id()) d.SetId("") return nil @@ -147,11 +142,13 @@ func resourceMariaDbVirtualNetworkRuleRead(d *pluginsdk.ResourceData, meta inter } d.Set("name", id.VirtualNetworkRuleName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("server_name", id.ServerName) - if props := resp.VirtualNetworkRuleProperties; props != nil { - d.Set("subnet_id", props.VirtualNetworkSubnetID) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("subnet_id", props.VirtualNetworkSubnetId) + } } return nil @@ -162,44 +159,40 @@ func resourceMariaDbVirtualNetworkRuleDelete(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.MariaDBVirtualNetworkRuleID(d.Id()) + id, err := virtualnetworkrules.ParseVirtualNetworkRuleID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ServerName, id.VirtualNetworkRuleName) - if err != nil { + if err := client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - } - return nil } -func mariaDbVirtualNetworkStateStatusCodeRefreshFunc(ctx context.Context, client *mariadb.VirtualNetworkRulesClient, resourceGroup string, serverName string, name string) pluginsdk.StateRefreshFunc { +func mariaDbVirtualNetworkStateStatusCodeRefreshFunc(ctx context.Context, client *virtualnetworkrules.VirtualNetworkRulesClient, id virtualnetworkrules.VirtualNetworkRuleId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - resp, err := client.Get(ctx, resourceGroup, serverName, name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Retrieving MariaDb Virtual Network Rule %q (MariaDb Server: %q, Resource Group: %q) returned 404.", resourceGroup, serverName, name) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] Retrieving %s returned 404.", id) return nil, "ResponseNotFound", nil } - return nil, "", fmt.Errorf("polling for the state of the MariaDb Virtual Network Rule %q (MariaDb Server: %q, Resource Group: %q): %+v", name, serverName, resourceGroup, err) + return nil, "", fmt.Errorf("polling for the state of %s: %+v", id, err) } - if props := resp.VirtualNetworkRuleProperties; props != nil { - log.Printf("[DEBUG] Retrieving MariaDb Virtual Network Rule %q (MariaDb Server: %q, Resource Group: %q) returned Status %s", resourceGroup, serverName, name, props.State) - return resp, string(props.State), nil + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + log.Printf("[DEBUG] Retrieving %s returned Status %s", id, *props.State) + return resp, string(*props.State), nil + + } } // Valid response was returned but VirtualNetworkRuleProperties was nil. Basically the rule exists, but with no properties for some reason. Assume Unknown instead of returning error. - log.Printf("[DEBUG] Retrieving MariaDb Virtual Network Rule %q (MariaDb Server: %q, Resource Group: %q) returned empty VirtualNetworkRuleProperties", resourceGroup, serverName, name) + log.Printf("[DEBUG] Retrieving %s returned empty VirtualNetworkRuleProperties", id) return resp, "Unknown", nil } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse/maria_db_configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse/maria_db_configuration.go deleted file mode 100644 index 5f3140e2863..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse/maria_db_configuration.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type MariaDBConfigurationId struct { - SubscriptionId string - ResourceGroup string - ServerName string - ConfigurationName string -} - -func NewMariaDBConfigurationID(subscriptionId, resourceGroup, serverName, configurationName string) MariaDBConfigurationId { - return MariaDBConfigurationId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ServerName: serverName, - ConfigurationName: configurationName, - } -} - -func (id MariaDBConfigurationId) String() string { - segments := []string{ - fmt.Sprintf("Configuration Name %q", id.ConfigurationName), - fmt.Sprintf("Server Name %q", id.ServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Maria D B Configuration", segmentsStr) -} - -func (id MariaDBConfigurationId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s/configurations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.ConfigurationName) -} - -// MariaDBConfigurationID parses a MariaDBConfiguration ID into an MariaDBConfigurationId struct -func MariaDBConfigurationID(input string) (*MariaDBConfigurationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := MariaDBConfigurationId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { - return nil, err - } - if resourceId.ConfigurationName, err = id.PopSegment("configurations"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse/maria_db_database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse/maria_db_database.go deleted file mode 100644 index 6dd9d3339ac..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse/maria_db_database.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type MariaDBDatabaseId struct { - SubscriptionId string - ResourceGroup string - ServerName string - DatabaseName string -} - -func NewMariaDBDatabaseID(subscriptionId, resourceGroup, serverName, databaseName string) MariaDBDatabaseId { - return MariaDBDatabaseId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ServerName: serverName, - DatabaseName: databaseName, - } -} - -func (id MariaDBDatabaseId) String() string { - segments := []string{ - fmt.Sprintf("Database Name %q", id.DatabaseName), - fmt.Sprintf("Server Name %q", id.ServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Maria D B Database", segmentsStr) -} - -func (id MariaDBDatabaseId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s/databases/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.DatabaseName) -} - -// MariaDBDatabaseID parses a MariaDBDatabase ID into an MariaDBDatabaseId struct -func MariaDBDatabaseID(input string) (*MariaDBDatabaseId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := MariaDBDatabaseId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { - return nil, err - } - if resourceId.DatabaseName, err = id.PopSegment("databases"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse/maria_db_firewall_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse/maria_db_firewall_rule.go deleted file mode 100644 index 3153fd28394..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse/maria_db_firewall_rule.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type MariaDBFirewallRuleId struct { - SubscriptionId string - ResourceGroup string - ServerName string - FirewallRuleName string -} - -func NewMariaDBFirewallRuleID(subscriptionId, resourceGroup, serverName, firewallRuleName string) MariaDBFirewallRuleId { - return MariaDBFirewallRuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ServerName: serverName, - FirewallRuleName: firewallRuleName, - } -} - -func (id MariaDBFirewallRuleId) String() string { - segments := []string{ - fmt.Sprintf("Firewall Rule Name %q", id.FirewallRuleName), - fmt.Sprintf("Server Name %q", id.ServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Maria D B Firewall Rule", segmentsStr) -} - -func (id MariaDBFirewallRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s/firewallRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.FirewallRuleName) -} - -// MariaDBFirewallRuleID parses a MariaDBFirewallRule ID into an MariaDBFirewallRuleId struct -func MariaDBFirewallRuleID(input string) (*MariaDBFirewallRuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := MariaDBFirewallRuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { - return nil, err - } - if resourceId.FirewallRuleName, err = id.PopSegment("firewallRules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse/maria_db_virtual_network_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse/maria_db_virtual_network_rule.go deleted file mode 100644 index c1ef6a2c7d1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse/maria_db_virtual_network_rule.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type MariaDBVirtualNetworkRuleId struct { - SubscriptionId string - ResourceGroup string - ServerName string - VirtualNetworkRuleName string -} - -func NewMariaDBVirtualNetworkRuleID(subscriptionId, resourceGroup, serverName, virtualNetworkRuleName string) MariaDBVirtualNetworkRuleId { - return MariaDBVirtualNetworkRuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ServerName: serverName, - VirtualNetworkRuleName: virtualNetworkRuleName, - } -} - -func (id MariaDBVirtualNetworkRuleId) String() string { - segments := []string{ - fmt.Sprintf("Virtual Network Rule Name %q", id.VirtualNetworkRuleName), - fmt.Sprintf("Server Name %q", id.ServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Maria D B Virtual Network Rule", segmentsStr) -} - -func (id MariaDBVirtualNetworkRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s/virtualNetworkRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.VirtualNetworkRuleName) -} - -// MariaDBVirtualNetworkRuleID parses a MariaDBVirtualNetworkRule ID into an MariaDBVirtualNetworkRuleId struct -func MariaDBVirtualNetworkRuleID(input string) (*MariaDBVirtualNetworkRuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := MariaDBVirtualNetworkRuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { - return nil, err - } - if resourceId.VirtualNetworkRuleName, err = id.PopSegment("virtualNetworkRules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse/server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse/server.go deleted file mode 100644 index 20bc1f33fa3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse/server.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ServerId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewServerID(subscriptionId, resourceGroup, name string) ServerId { - return ServerId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ServerId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Server", segmentsStr) -} - -func (id ServerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforMariaDB/servers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ServerID parses a Server ID into an ServerId struct -func ServerID(input string) (*ServerId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ServerId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("servers"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/resourceids.go deleted file mode 100644 index da078e4831b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/resourceids.go +++ /dev/null @@ -1,7 +0,0 @@ -package mariadb - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Server -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMariaDB/servers/server1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=MariaDBFirewallRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMariaDB/servers/server1/firewallRules/firewallRule1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=MariaDBVirtualNetworkRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMariaDB/servers/server1/virtualNetworkRules/vnetrule1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=MariaDBConfiguration -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMariaDB/servers/server1/configurations/config1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=MariaDBDatabase -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DBforMariaDB/servers/server1/databases/db1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate/maria_db_configuration_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate/maria_db_configuration_id.go deleted file mode 100644 index cb4f33723c4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate/maria_db_configuration_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse" -) - -func MariaDBConfigurationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.MariaDBConfigurationID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate/maria_db_database_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate/maria_db_database_id.go deleted file mode 100644 index 72ace30d7ea..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate/maria_db_database_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse" -) - -func MariaDBDatabaseID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.MariaDBDatabaseID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate/maria_db_firewall_rule_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate/maria_db_firewall_rule_id.go deleted file mode 100644 index 469e95bf6ac..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate/maria_db_firewall_rule_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse" -) - -func MariaDBFirewallRuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.MariaDBFirewallRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate/maria_db_virtual_network_rule_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate/maria_db_virtual_network_rule_id.go deleted file mode 100644 index 8da930b85a6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate/maria_db_virtual_network_rule_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse" -) - -func MariaDBVirtualNetworkRuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.MariaDBVirtualNetworkRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate/server_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate/server_id.go deleted file mode 100644 index e3c03047109..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate/server_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse" -) - -func ServerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ServerID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/client/client.go index 2f1ea467ce6..f672f4d807c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/client/client.go @@ -1,16 +1,16 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality" + "github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - SpatialAnchorsAccountClient *mixedreality.SpatialAnchorsAccountsClient + SpatialAnchorsAccountClient *resource.ResourceClient } func NewClient(o *common.ClientOptions) *Client { - SpatialAnchorsAccountClient := mixedreality.NewSpatialAnchorsAccountsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + SpatialAnchorsAccountClient := resource.NewResourceClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&SpatialAnchorsAccountClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/parse/spatial_anchors_account.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/parse/spatial_anchors_account.go deleted file mode 100644 index b0de2b43502..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/parse/spatial_anchors_account.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type SpatialAnchorsAccountId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewSpatialAnchorsAccountID(subscriptionId, resourceGroup, name string) SpatialAnchorsAccountId { - return SpatialAnchorsAccountId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id SpatialAnchorsAccountId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Spatial Anchors Account", segmentsStr) -} - -func (id SpatialAnchorsAccountId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.MixedReality/spatialAnchorsAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// SpatialAnchorsAccountID parses a SpatialAnchorsAccount ID into an SpatialAnchorsAccountId struct -func SpatialAnchorsAccountID(input string) (*SpatialAnchorsAccountId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := SpatialAnchorsAccountId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("spatialAnchorsAccounts"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/resourceids.go deleted file mode 100644 index e3a9873453f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/resourceids.go +++ /dev/null @@ -1,3 +0,0 @@ -package mixedreality - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpatialAnchorsAccount -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.MixedReality/spatialAnchorsAccounts/Account1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/spatial_anchors_account_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/spatial_anchors_account_data_source.go index ea300a0eb26..7d70e175a1b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/spatial_anchors_account_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/spatial_anchors_account_data_source.go @@ -5,14 +5,15 @@ import ( "regexp" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceSpatialAnchorsAccount() *pluginsdk.Resource { @@ -46,6 +47,8 @@ func dataSourceSpatialAnchorsAccount() *pluginsdk.Resource { Type: pluginsdk.TypeString, Computed: true, }, + + "tags": commonschema.TagsDataSource(), }, } } @@ -56,27 +59,32 @@ func dataSourceSpatialAnchorsAccountRead(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - resourceGroup := d.Get("resource_group_name").(string) - - id := parse.NewSpatialAnchorsAccountID(subscriptionId, resourceGroup, name) - resp, err := client.Get(ctx, resourceGroup, name) + id := resource.NewSpatialAnchorsAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.SpatialAnchorsAccountsGet(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } + return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.AccountName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) - if props := resp.AccountProperties; props != nil { - d.Set("account_domain", props.AccountDomain) - d.Set("account_id", props.AccountID) + if props := model.Properties; props != nil { + d.Set("account_domain", props.AccountDomain) + d.Set("account_id", props.AccountId) + } + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/spatial_anchors_account_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/spatial_anchors_account_resource.go index 222f117705b..8c179bc26e4 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/spatial_anchors_account_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/spatial_anchors_account_resource.go @@ -5,27 +5,27 @@ import ( "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceSpatialAnchorsAccount() *pluginsdk.Resource { return &pluginsdk.Resource{ - Create: resourceSpatialAnchorsAccountCreateUpdate, + Create: resourceSpatialAnchorsAccountCreate, Read: resourceSpatialAnchorsAccountRead, - Update: resourceSpatialAnchorsAccountCreateUpdate, + Update: resourceSpatialAnchorsAccountUpdate, Delete: resourceSpatialAnchorsAccountDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.SpatialAnchorsAccountID(id) + _, err := resource.ParseSpatialAnchorsAccountID(id) return err }), @@ -61,41 +61,36 @@ func resourceSpatialAnchorsAccount() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } -func resourceSpatialAnchorsAccountCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { +func resourceSpatialAnchorsAccountCreate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).MixedReality.SpatialAnchorsAccountClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId - ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - location := azure.NormalizeLocation(d.Get("location").(string)) - t := d.Get("tags").(map[string]interface{}) - - id := parse.NewSpatialAnchorsAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) - if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing %s: %+v", id, err) - } + id := resource.NewSpatialAnchorsAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + existing, err := client.SpatialAnchorsAccountsGet(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } + } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_spatial_anchors_account", id.ID()) - } + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_spatial_anchors_account", id.ID()) } - account := mixedreality.SpatialAnchorsAccount{ - Location: &location, - Tags: tags.Expand(t), + account := resource.SpatialAnchorsAccount{ + Location: location.Normalize(d.Get("location").(string)), + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - if _, err := client.Create(ctx, id.ResourceGroup, id.Name, account); err != nil { - return fmt.Errorf("creating/updating %s: %+v", id, err) + if _, err := client.SpatialAnchorsAccountsCreate(ctx, id, account); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } d.SetId(id.ID()) @@ -107,14 +102,14 @@ func resourceSpatialAnchorsAccountRead(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SpatialAnchorsAccountID(d.Id()) + id, err := resource.ParseSpatialAnchorsAccountID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.SpatialAnchorsAccountsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -122,16 +117,46 @@ func resourceSpatialAnchorsAccountRead(d *pluginsdk.ResourceData, meta interface return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.AccountName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) + + if props := model.Properties; props != nil { + d.Set("account_domain", props.AccountDomain) + d.Set("account_id", props.AccountId) + } - if props := resp.AccountProperties; props != nil { - d.Set("account_domain", props.AccountDomain) - d.Set("account_id", props.AccountID) + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil +} + +func resourceSpatialAnchorsAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).MixedReality.SpatialAnchorsAccountClient + ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := resource.ParseSpatialAnchorsAccountID(d.Id()) + if err != nil { + return err + } + + account := resource.SpatialAnchorsAccount{ + Location: location.Normalize(d.Get("location").(string)), + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + } + + if _, err := client.SpatialAnchorsAccountsUpdate(ctx, *id, account); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + d.SetId(id.ID()) + return resourceSpatialAnchorsAccountRead(d, meta) } func resourceSpatialAnchorsAccountDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -139,14 +164,14 @@ func resourceSpatialAnchorsAccountDelete(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SpatialAnchorsAccountID(d.Id()) + id, err := resource.ParseSpatialAnchorsAccountID(d.Id()) if err != nil { return err } - response, err := client.Delete(ctx, id.ResourceGroup, id.Name) + resp, err := client.SpatialAnchorsAccountsDelete(ctx, *id) if err != nil { - if !utils.ResponseWasNotFound(response) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/client/client.go index 0d4f28d3172..8c74928316e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/client/client.go @@ -6,6 +6,8 @@ import ( "github.com/Azure/azure-sdk-for-go/services/preview/alertsmanagement/mgmt/2019-06-01-preview/alertsmanagement" classic "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-07-01-preview/insights" newActionGroupClient "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-09-01-preview/insights" + "github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints" + "github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) @@ -24,6 +26,8 @@ type Client struct { ActionGroupsClient *newActionGroupClient.ActionGroupsClient ActivityLogAlertsClient *insights.ActivityLogAlertsClient AlertRulesClient *classic.AlertRulesClient + DataCollectionRulesClient *datacollectionrules.DataCollectionRulesClient + DataCollectionEndpointsClient *datacollectionendpoints.DataCollectionEndpointsClient DiagnosticSettingsClient *classic.DiagnosticSettingsClient DiagnosticSettingsCategoryClient *classic.DiagnosticSettingsCategoryClient LogProfilesClient *classic.LogProfilesClient @@ -55,6 +59,12 @@ func NewClient(o *common.ClientOptions) *Client { AlertRulesClient := classic.NewAlertRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&AlertRulesClient.Client, o.ResourceManagerAuthorizer) + DataCollectionEndpointsClient := datacollectionendpoints.NewDataCollectionEndpointsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&DataCollectionEndpointsClient.Client, o.ResourceManagerAuthorizer) + + DataCollectionRulesClient := datacollectionrules.NewDataCollectionRulesClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&DataCollectionRulesClient.Client, o.ResourceManagerAuthorizer) + DiagnosticSettingsClient := classic.NewDiagnosticSettingsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&DiagnosticSettingsClient.Client, o.ResourceManagerAuthorizer) @@ -84,6 +94,8 @@ func NewClient(o *common.ClientOptions) *Client { ActionGroupsClient: &ActionGroupsClient, ActivityLogAlertsClient: &ActivityLogAlertsClient, AlertRulesClient: &AlertRulesClient, + DataCollectionRulesClient: &DataCollectionRulesClient, + DataCollectionEndpointsClient: &DataCollectionEndpointsClient, DiagnosticSettingsClient: &DiagnosticSettingsClient, DiagnosticSettingsCategoryClient: &DiagnosticSettingsCategoryClient, LogProfilesClient: &LogProfilesClient, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_aad_diagnostic_setting_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_aad_diagnostic_setting_resource.go index 81c15868a41..7cff87d3283 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_aad_diagnostic_setting_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_aad_diagnostic_setting_resource.go @@ -9,9 +9,9 @@ import ( "github.com/Azure/azure-sdk-for-go/services/aad/mgmt/2017-04-01/aad" "github.com/hashicorp/go-azure-helpers/lang/response" + authRuleParse "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - authRuleParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces" logAnalyticsParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/parse" logAnalyticsValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/parse" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_action_group_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_action_group_data_source.go index 778ce139b71..343fabad0d8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_action_group_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_action_group_data_source.go @@ -5,8 +5,8 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - eventHubValidation "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -316,7 +316,7 @@ func dataSourceMonitorActionGroup() *pluginsdk.Resource { "event_hub_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: eventHubValidation.EventhubID, + ValidateFunc: eventhubs.ValidateEventhubID, }, "tenant_id": { Type: pluginsdk.TypeString, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_action_group_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_action_group_resource.go index 4b5585372c0..fff9ae22787 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_action_group_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_action_group_resource.go @@ -7,11 +7,10 @@ import ( "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-09-01-preview/insights" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - eventHubParser "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/parse" - eventHubValidation "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/validate" @@ -386,7 +385,7 @@ func resourceMonitorActionGroup() *pluginsdk.Resource { "event_hub_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: eventHubValidation.EventhubID, + ValidateFunc: eventhubs.ValidateEventhubID, }, "tenant_id": { Type: pluginsdk.TypeString, @@ -735,7 +734,7 @@ func expandMonitorActionGroupEventHubReceiver(tenantId string, v []interface{}) for _, receiverValue := range v { val := receiverValue.(map[string]interface{}) - eventHubId, err := eventHubParser.EventhubID(*utils.String(val["event_hub_id"].(string))) + eventHubId, err := eventhubs.ParseEventhubID(*utils.String(val["event_hub_id"].(string))) if err != nil { return nil, err } @@ -743,7 +742,7 @@ func expandMonitorActionGroupEventHubReceiver(tenantId string, v []interface{}) receiver := insights.EventHubReceiver{ Name: utils.String(val["name"].(string)), EventHubNameSpace: &eventHubId.NamespaceName, - EventHubName: &eventHubId.Name, + EventHubName: &eventHubId.EventHubName, UseCommonAlertSchema: utils.Bool(val["use_common_alert_schema"].(bool)), } if v := val["tenant_id"].(string); v != "" { @@ -1027,7 +1026,7 @@ func flattenMonitorActionGroupEventHubReceiver(resourceGroup string, receivers * event_hub_name := *receiver.EventHubName subscription_id := *receiver.SubscriptionID - val["event_hub_id"] = eventHubParser.NewEventhubID(subscription_id, resourceGroup, event_hub_namespace, event_hub_name).ID() + val["event_hub_id"] = eventhubs.NewEventhubID(subscription_id, resourceGroup, event_hub_namespace, event_hub_name).ID() } if receiver.UseCommonAlertSchema != nil { val["use_common_alert_schema"] = *receiver.UseCommonAlertSchema diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_data_collection_endpoint_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_data_collection_endpoint_resource.go new file mode 100644 index 00000000000..d2ae907b4c1 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_data_collection_endpoint_resource.go @@ -0,0 +1,298 @@ +package monitor + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type DataCollectionEndpoint struct { + Description string `tfschema:"description"` + Kind string `tfschema:"kind"` + Name string `tfschema:"name"` + Location string `tfschema:"location"` + EnablePublicNetworkAccess bool `tfschema:"public_network_access_enabled"` + ResourceGroupName string `tfschema:"resource_group_name"` + Tags map[string]interface{} `tfschema:"tags"` +} + +type DataCollectionEndpointResource struct { +} + +func (r DataCollectionEndpointResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "public_network_access_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + }, + + "kind": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice( + datacollectionendpoints.PossibleValuesForKnownDataCollectionEndpointResourceKind(), false), + }, + + "tags": commonschema.Tags(), + } +} + +func (r DataCollectionEndpointResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r DataCollectionEndpointResource) ResourceType() string { + return "azurerm_monitor_data_collection_endpoint" +} + +func (r DataCollectionEndpointResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return datacollectionendpoints.ValidateDataCollectionEndpointID +} + +func (r DataCollectionEndpointResource) ModelObject() interface{} { + return &DataCollectionEndpoint{} +} + +func (r DataCollectionEndpointResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + metadata.Logger.Info("Decoding state..") + var state DataCollectionEndpoint + if err := metadata.Decode(&state); err != nil { + return err + } + + client := metadata.Client.Monitor.DataCollectionEndpointsClient + subscriptionId := metadata.Client.Account.SubscriptionId + + id := datacollectionendpoints.NewDataCollectionEndpointID(subscriptionId, state.ResourceGroupName, state.Name) + metadata.Logger.Infof("creating %s", id) + + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for the presence of an existing %s: %+v", id, err) + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + input := datacollectionendpoints.DataCollectionEndpointResource{ + Kind: expandDataCollectionEndpointKind(state.Kind), + Location: azure.NormalizeLocation(state.Location), + Name: utils.String(state.Name), + Properties: &datacollectionendpoints.DataCollectionEndpoint{ + Description: utils.String(state.Description), + NetworkAcls: &datacollectionendpoints.NetworkRuleSet{ + PublicNetworkAccess: expandDataCollectionEndpointPublicNetworkAccess(state.EnablePublicNetworkAccess), + }, + }, + Tags: tags.Expand(state.Tags), + } + + if _, err := client.Create(ctx, id, input); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + Timeout: 30 * time.Minute, + } +} + +func (r DataCollectionEndpointResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Monitor.DataCollectionEndpointsClient + id, err := datacollectionendpoints.ParseDataCollectionEndpointID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("retrieving %s", *id) + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + metadata.Logger.Infof("%s was not found - removing from state!", *id) + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + var enablePublicNetWorkAccess bool + var description, kind, location string + var tag map[string]interface{} + if model := resp.Model; model != nil { + kind = flattenDataCollectionEndpointKind(model.Kind) + location = azure.NormalizeLocation(model.Location) + tag = tags.Flatten(model.Tags) + if prop := model.Properties; prop != nil { + description = flattenDataCollectionEndpointDescription(prop.Description) + if networkAcls := prop.NetworkAcls; networkAcls != nil { + enablePublicNetWorkAccess = flattenDataCollectionEndpointPublicNetworkAccess(networkAcls.PublicNetworkAccess) + } + } + } + + return metadata.Encode(&DataCollectionEndpoint{ + Description: description, + Kind: kind, + Location: location, + Name: id.DataCollectionEndpointName, + EnablePublicNetworkAccess: enablePublicNetWorkAccess, + ResourceGroupName: id.ResourceGroupName, + Tags: tag, + }) + }, + Timeout: 5 * time.Minute, + } +} + +func (r DataCollectionEndpointResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + id, err := datacollectionendpoints.ParseDataCollectionEndpointID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("updating %s..", *id) + client := metadata.Client.Monitor.DataCollectionEndpointsClient + resp, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + if resp.Model == nil { + return fmt.Errorf("unexpected null model of %s", *id) + } + existing := resp.Model + if existing.Properties == nil { + return fmt.Errorf("unexpected null properties of %s", *id) + } + + var state DataCollectionEndpoint + if err := metadata.Decode(&state); err != nil { + return err + } + + if metadata.ResourceData.HasChange("description") { + existing.Properties.Description = utils.String(state.Description) + } + + if metadata.ResourceData.HasChange("kind") { + existing.Kind = expandDataCollectionEndpointKind(state.Kind) + } + + if metadata.ResourceData.HasChange("public_network_access") { + existing.Properties.NetworkAcls = &datacollectionendpoints.NetworkRuleSet{ + PublicNetworkAccess: expandDataCollectionEndpointPublicNetworkAccess(state.EnablePublicNetworkAccess), + } + } + + if metadata.ResourceData.HasChange("tags") { + existing.Tags = tags.Expand(state.Tags) + } + + if _, err := client.Create(ctx, *id, *existing); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + return nil + + }, + Timeout: 30 * time.Minute, + } +} + +func (r DataCollectionEndpointResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Monitor.DataCollectionEndpointsClient + id, err := datacollectionendpoints.ParseDataCollectionEndpointID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("deleting %s..", *id) + resp, err := client.Delete(ctx, *id) + if err != nil && !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + return nil + }, + Timeout: 30 * time.Minute, + } +} + +func expandDataCollectionEndpointKind(input string) *datacollectionendpoints.KnownDataCollectionEndpointResourceKind { + if input == "" { + return nil + } + + result := datacollectionendpoints.KnownDataCollectionEndpointResourceKind(input) + return &result +} + +func expandDataCollectionEndpointPublicNetworkAccess(input bool) *datacollectionendpoints.KnownPublicNetworkAccessOptions { + var result datacollectionendpoints.KnownPublicNetworkAccessOptions + if input { + result = datacollectionendpoints.KnownPublicNetworkAccessOptionsEnabled + } else { + result = datacollectionendpoints.KnownPublicNetworkAccessOptionsDisabled + } + return &result +} + +func flattenDataCollectionEndpointKind(input *datacollectionendpoints.KnownDataCollectionEndpointResourceKind) string { + if input == nil { + return "" + } + + return string(*input) +} + +func flattenDataCollectionEndpointDescription(input *string) string { + if input == nil { + return "" + } + + return *input +} + +func flattenDataCollectionEndpointPublicNetworkAccess(input *datacollectionendpoints.KnownPublicNetworkAccessOptions) bool { + if input == nil { + return false + } + var result bool + if *input == datacollectionendpoints.KnownPublicNetworkAccessOptionsEnabled { + result = true + } else if *input == datacollectionendpoints.KnownPublicNetworkAccessOptionsDisabled { + result = false + } + return result +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_data_collection_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_data_collection_rule_resource.go new file mode 100644 index 00000000000..0c8f17ee752 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_data_collection_rule_resource.go @@ -0,0 +1,1017 @@ +package monitor + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + logAnalyticsValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type DataCollectionRule struct { + DataFlows []DataFlow `tfschema:"data_flow"` + DataSources []DataSource `tfschema:"data_sources"` + Description string `tfschema:"description"` + Destinations []Destination `tfschema:"destinations"` + Kind string `tfschema:"kind"` + Name string `tfschema:"name"` + Location string `tfschema:"location"` + ResourceGroupName string `tfschema:"resource_group_name"` + Tags map[string]interface{} `tfschema:"tags"` +} + +type DataFlow struct { + Destinations []string `tfschema:"destinations"` + Streams []string `tfschema:"streams"` +} + +type DataSource struct { + Extensions []Extension `tfschema:"extension"` + PerformanceCounters []PerfCounter `tfschema:"performance_counter"` + Syslog []Syslog `tfschema:"syslog"` + WindowsEventLogs []WindowsEventLog `tfschema:"windows_event_log"` +} + +type Destination struct { + AzureMonitorMetrics []AzureMonitorMetric `tfschema:"azure_monitor_metrics"` + LogAnalytics []LogAnalytic `tfschema:"log_analytics"` +} + +type Extension struct { + ExtensionName string `tfschema:"extension_name"` + ExtensionSettings string `tfschema:"extension_json"` + InputDataSources []string `tfschema:"input_data_sources"` + Name string `tfschema:"name"` + Streams []string `tfschema:"streams"` +} + +type PerfCounter struct { + CounterSpecifiers []string `tfschema:"counter_specifiers"` + Name string `tfschema:"name"` + SamplingFrequencyInSeconds int64 `tfschema:"sampling_frequency_in_seconds"` + Streams []string `tfschema:"streams"` +} + +type Syslog struct { + FacilityNames []string `tfschema:"facility_names"` + LogLevels []string `tfschema:"log_levels"` + Name string `tfschema:"name"` +} + +type WindowsEventLog struct { + Name string `tfschema:"name"` + Streams []string `tfschema:"streams"` + XPathQueries []string `tfschema:"x_path_queries"` +} + +type AzureMonitorMetric struct { + Name string `tfschema:"name"` +} + +type LogAnalytic struct { + Name string `tfschema:"name"` + WorkspaceResourceId string `tfschema:"workspace_resource_id"` +} + +type DataCollectionRuleResource struct { +} + +func (r DataCollectionRuleResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "data_flow": { + Type: pluginsdk.TypeList, + Required: true, + MinItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "destinations": { + Type: pluginsdk.TypeList, + Required: true, + MinItems: 1, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + "streams": { + Type: pluginsdk.TypeList, + Required: true, + MinItems: 1, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice( + datacollectionrules.PossibleValuesForKnownDataFlowStreams(), false), + }, + }, + }, + }, + }, + + "destinations": { + Type: pluginsdk.TypeList, + Required: true, + MaxItems: 1, + MinItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*schema.Schema{ + "azure_monitor_metrics": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + AtLeastOneOf: []string{"destinations.0.azure_monitor_metrics", "destinations.0.log_analytics"}, + }, + "log_analytics": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "workspace_resource_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: logAnalyticsValidate.LogAnalyticsWorkspaceID, + }, + }, + }, + AtLeastOneOf: []string{"destinations.0.azure_monitor_metrics", "destinations.0.log_analytics"}, + }, + }, + }, + }, + + "data_sources": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "extension": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "extension_name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "streams": { + Type: pluginsdk.TypeList, + Required: true, + MinItems: 1, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice( + datacollectionrules.PossibleValuesForKnownExtensionDataSourceStreams(), + false), + }, + }, + "extension_json": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsJSON, + DiffSuppressFunc: pluginsdk.SuppressJsonDiff, + }, + "input_data_sources": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + }, + "performance_counter": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "sampling_frequency_in_seconds": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: validation.IntBetween(1, 300), + }, + "streams": { + Type: pluginsdk.TypeList, + Required: true, + MinItems: 1, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice( + datacollectionrules.PossibleValuesForKnownPerfCounterDataSourceStreams(), + false), + }, + }, + "counter_specifiers": { + Type: pluginsdk.TypeList, + Required: true, + MinItems: 1, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + }, + "syslog": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "facility_names": { + Type: pluginsdk.TypeList, + Required: true, + MinItems: 1, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice( + datacollectionrules.PossibleValuesForKnownSyslogDataSourceFacilityNames(), + false), + }, + }, + "log_levels": { + Type: pluginsdk.TypeList, + Required: true, + MinItems: 1, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice( + datacollectionrules.PossibleValuesForKnownSyslogDataSourceLogLevels(), false), + }, + }, + }, + }, + }, + "windows_event_log": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "streams": { + Type: pluginsdk.TypeList, + Required: true, + MinItems: 1, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice( + datacollectionrules.PossibleValuesForKnownWindowsEventLogDataSourceStreams(), + false), + }, + }, + "x_path_queries": { + Type: pluginsdk.TypeList, + Required: true, + MinItems: 1, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + }, + }, + }, + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + }, + + "kind": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice( + datacollectionrules.PossibleValuesForKnownDataCollectionRuleResourceKind(), false), + }, + + "tags": commonschema.Tags(), + } +} + +func (r DataCollectionRuleResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r DataCollectionRuleResource) ResourceType() string { + return "azurerm_monitor_data_collection_rule" +} + +func (r DataCollectionRuleResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return datacollectionrules.ValidateDataCollectionRuleID +} + +func (r DataCollectionRuleResource) ModelObject() interface{} { + return &DataCollectionRule{} +} + +func (r DataCollectionRuleResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + metadata.Logger.Info("Decoding state..") + var state DataCollectionRule + if err := metadata.Decode(&state); err != nil { + return err + } + + client := metadata.Client.Monitor.DataCollectionRulesClient + subscriptionId := metadata.Client.Account.SubscriptionId + + id := datacollectionrules.NewDataCollectionRuleID(subscriptionId, state.ResourceGroupName, state.Name) + metadata.Logger.Infof("creating %s", id) + + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for the presence of an existing %s: %+v", id, err) + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + dataSources, err := expandDataCollectionRuleDataSources(state.DataSources) + if err != nil { + return err + } + + input := datacollectionrules.DataCollectionRuleResource{ + Kind: expandDataCollectionRuleKind(state.Kind), + Location: azure.NormalizeLocation(state.Location), + Name: utils.String(state.Name), + Properties: &datacollectionrules.DataCollectionRule{ + DataFlows: expandDataCollectionRuleDataFlows(state.DataFlows), + DataSources: dataSources, + Description: utils.String(state.Description), + Destinations: expandDataCollectionRuleDestinations(state.Destinations), + }, + Tags: tags.Expand(state.Tags), + } + + if _, err := client.Create(ctx, id, input); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + Timeout: 30 * time.Minute, + } +} + +func (r DataCollectionRuleResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Monitor.DataCollectionRulesClient + id, err := datacollectionrules.ParseDataCollectionRuleID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("retrieving %s", *id) + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + metadata.Logger.Infof("%s was not found - removing from state!", *id) + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + var description, kind, location string + var tag map[string]interface{} + var dataFlows []DataFlow + var dataSources []DataSource + var destinations []Destination + + if model := resp.Model; model != nil { + kind = flattenDataCollectionRuleKind(model.Kind) + location = azure.NormalizeLocation(model.Location) + tag = tags.Flatten(model.Tags) + if prop := model.Properties; prop != nil { + description = flattenStringPtr(prop.Description) + dataFlows = flattenDataCollectionRuleDataFlows(prop.DataFlows) + dataSources = flattenDataCollectionRuleDataSources(prop.DataSources) + destinations = flattenDataCollectionRuleDestinations(prop.Destinations) + } + } + + return metadata.Encode(&DataCollectionRule{ + Name: id.DataCollectionRuleName, + ResourceGroupName: id.ResourceGroupName, + DataFlows: dataFlows, + DataSources: dataSources, + Description: description, + Destinations: destinations, + Kind: kind, + Location: location, + Tags: tag, + }) + }, + Timeout: 5 * time.Minute, + } +} + +func (r DataCollectionRuleResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + id, err := datacollectionrules.ParseDataCollectionRuleID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("updating %s..", *id) + client := metadata.Client.Monitor.DataCollectionRulesClient + resp, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + if resp.Model == nil { + return fmt.Errorf("unexpected null model of %s", *id) + } + existing := resp.Model + if existing.Properties == nil { + return fmt.Errorf("unexpected null properties of %s", *id) + } + + var state DataCollectionRule + if err := metadata.Decode(&state); err != nil { + return err + } + + if metadata.ResourceData.HasChange("kind") { + existing.Kind = expandDataCollectionRuleKind(state.Kind) + } + + if metadata.ResourceData.HasChange("tags") { + existing.Tags = tags.Expand(state.Tags) + } + + if metadata.ResourceData.HasChange("data_flow") { + existing.Properties.DataFlows = expandDataCollectionRuleDataFlows(state.DataFlows) + } + + if metadata.ResourceData.HasChange("data_sources") { + dataSource, err := expandDataCollectionRuleDataSources(state.DataSources) + if err != nil { + return err + } + existing.Properties.DataSources = dataSource + } + + if metadata.ResourceData.HasChange("description") { + existing.Properties.Description = utils.String(state.Description) + } + + if metadata.ResourceData.HasChange("destinations") { + existing.Properties.Destinations = expandDataCollectionRuleDestinations(state.Destinations) + } + + // otherwise Service will return an error: "The resource definition is invalid." + existing.SystemData = nil + + if _, err := client.Create(ctx, *id, *existing); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + return nil + + }, + Timeout: 30 * time.Minute, + } +} + +func (r DataCollectionRuleResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Monitor.DataCollectionRulesClient + id, err := datacollectionrules.ParseDataCollectionRuleID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("deleting %s..", *id) + resp, err := client.Delete(ctx, *id) + if err != nil && !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + return nil + }, + Timeout: 30 * time.Minute, + } +} + +func expandDataCollectionRuleKind(input string) *datacollectionrules.KnownDataCollectionRuleResourceKind { + if input == "" { + return nil + } + + result := datacollectionrules.KnownDataCollectionRuleResourceKind(input) + return &result +} + +func stringSlice(input []string) *[]string { + return &input +} + +func expandDataCollectionRuleDataFlows(input []DataFlow) *[]datacollectionrules.DataFlow { + if len(input) == 0 { + return nil + } + + result := make([]datacollectionrules.DataFlow, 0) + for _, v := range input { + result = append(result, datacollectionrules.DataFlow{ + Destinations: stringSlice(v.Destinations), + Streams: expandDataCollectionRuleDataFlowStreams(v.Streams), + }) + } + return &result +} + +func expandDataCollectionRuleDataFlowStreams(input []string) *[]datacollectionrules.KnownDataFlowStreams { + if len(input) == 0 { + return nil + } + + result := make([]datacollectionrules.KnownDataFlowStreams, 0) + for _, v := range input { + result = append(result, datacollectionrules.KnownDataFlowStreams(v)) + } + return &result +} + +func expandDataCollectionRuleDataSources(input []DataSource) (*datacollectionrules.DataSourcesSpec, error) { + if len(input) == 0 { + return nil, nil + } + + extension, err := expandDataCollectionRuleDataSourceExtensions(input[0].Extensions) + if err != nil { + return nil, err + } + return &datacollectionrules.DataSourcesSpec{ + Extensions: extension, + PerformanceCounters: expandDataCollectionRuleDataSourcePerfCounters(input[0].PerformanceCounters), + Syslog: expandDataCollectionRuleDataSourceSyslog(input[0].Syslog), + WindowsEventLogs: expandDataCollectionRuleDataSourceWindowsEventLogs(input[0].WindowsEventLogs), + }, nil + +} + +func expandDataCollectionRuleDataSourceExtensions(input []Extension) (*[]datacollectionrules.ExtensionDataSource, error) { + if len(input) == 0 { + return nil, nil + } + + result := make([]datacollectionrules.ExtensionDataSource, 0) + for _, v := range input { + var extensionSettings interface{} + if v.ExtensionSettings != "" { + settings, err := pluginsdk.ExpandJsonFromString(v.ExtensionSettings) + if err != nil { + return nil, err + } + extensionSettings = settings + } + + result = append(result, datacollectionrules.ExtensionDataSource{ + ExtensionName: v.ExtensionName, + ExtensionSettings: &extensionSettings, + InputDataSources: stringSlice(v.InputDataSources), + Name: utils.String(v.Name), + Streams: expandDataCollectionRuleDataSourceExtensionStreams(v.Streams), + }) + } + return &result, nil +} + +func expandDataCollectionRuleDataSourceExtensionStreams(input []string) *[]datacollectionrules.KnownExtensionDataSourceStreams { + if len(input) == 0 { + return nil + } + + result := make([]datacollectionrules.KnownExtensionDataSourceStreams, 0) + for _, v := range input { + result = append(result, datacollectionrules.KnownExtensionDataSourceStreams(v)) + } + return &result +} + +func expandDataCollectionRuleDataSourcePerfCounters(input []PerfCounter) *[]datacollectionrules.PerfCounterDataSource { + if len(input) == 0 { + return nil + } + + result := make([]datacollectionrules.PerfCounterDataSource, 0) + for _, v := range input { + result = append(result, datacollectionrules.PerfCounterDataSource{ + CounterSpecifiers: stringSlice(v.CounterSpecifiers), + Name: utils.String(v.Name), + SamplingFrequencyInSeconds: utils.Int64(v.SamplingFrequencyInSeconds), + Streams: expandDataCollectionRuleDataSourcePerfCounterStreams(v.Streams), + }) + } + return &result +} + +func expandDataCollectionRuleDataSourcePerfCounterStreams(input []string) *[]datacollectionrules.KnownPerfCounterDataSourceStreams { + if len(input) == 0 { + return nil + } + + result := make([]datacollectionrules.KnownPerfCounterDataSourceStreams, 0) + for _, v := range input { + result = append(result, datacollectionrules.KnownPerfCounterDataSourceStreams(v)) + } + return &result +} + +func expandDataCollectionRuleDataSourceSyslog(input []Syslog) *[]datacollectionrules.SyslogDataSource { + if len(input) == 0 { + return nil + } + + result := make([]datacollectionrules.SyslogDataSource, 0) + for _, v := range input { + result = append(result, datacollectionrules.SyslogDataSource{ + FacilityNames: expandDataCollectionRuleDataSourceSyslogFacilityNames(v.FacilityNames), + LogLevels: expandDataCollectionRuleDataSourceSyslogLogLevels(v.LogLevels), + Name: utils.String(v.Name), + Streams: &[]datacollectionrules.KnownSyslogDataSourceStreams{datacollectionrules.KnownSyslogDataSourceStreamsMicrosoftNegativeSyslog}, + }) + } + return &result +} + +func expandDataCollectionRuleDataSourceSyslogFacilityNames(input []string) *[]datacollectionrules.KnownSyslogDataSourceFacilityNames { + if len(input) == 0 { + return nil + } + + result := make([]datacollectionrules.KnownSyslogDataSourceFacilityNames, 0) + for _, v := range input { + result = append(result, datacollectionrules.KnownSyslogDataSourceFacilityNames(v)) + } + return &result +} + +func expandDataCollectionRuleDataSourceSyslogLogLevels(input []string) *[]datacollectionrules.KnownSyslogDataSourceLogLevels { + if len(input) == 0 { + return nil + } + + result := make([]datacollectionrules.KnownSyslogDataSourceLogLevels, 0) + for _, v := range input { + result = append(result, datacollectionrules.KnownSyslogDataSourceLogLevels(v)) + } + return &result +} + +func expandDataCollectionRuleDataSourceWindowsEventLogs(input []WindowsEventLog) *[]datacollectionrules.WindowsEventLogDataSource { + if len(input) == 0 { + return nil + } + + result := make([]datacollectionrules.WindowsEventLogDataSource, 0) + for _, v := range input { + result = append(result, datacollectionrules.WindowsEventLogDataSource{ + Name: utils.String(v.Name), + Streams: expandDataCollectionRuleDataSourceWindowsEventLogsStreams(v.Streams), + XPathQueries: stringSlice(v.XPathQueries), + }) + } + return &result +} + +func expandDataCollectionRuleDataSourceWindowsEventLogsStreams(input []string) *[]datacollectionrules.KnownWindowsEventLogDataSourceStreams { + if len(input) == 0 { + return nil + } + + result := make([]datacollectionrules.KnownWindowsEventLogDataSourceStreams, 0) + for _, v := range input { + result = append(result, datacollectionrules.KnownWindowsEventLogDataSourceStreams(v)) + } + return &result +} + +func expandDataCollectionRuleDestinations(input []Destination) *datacollectionrules.DestinationsSpec { + if len(input) == 0 { + return nil + } + + return &datacollectionrules.DestinationsSpec{ + AzureMonitorMetrics: expandDataCollectionRuleDestinationMetrics(input[0].AzureMonitorMetrics), + LogAnalytics: expandDataCollectionRuleDestinationLogAnalytics(input[0].LogAnalytics), + } +} + +func expandDataCollectionRuleDestinationMetrics(input []AzureMonitorMetric) *datacollectionrules.AzureMonitorMetricsDestination { + if len(input) == 0 { + return nil + } + + return &datacollectionrules.AzureMonitorMetricsDestination{ + Name: utils.String(input[0].Name), + } +} + +func expandDataCollectionRuleDestinationLogAnalytics(input []LogAnalytic) *[]datacollectionrules.LogAnalyticsDestination { + if len(input) == 0 { + return nil + } + + result := make([]datacollectionrules.LogAnalyticsDestination, 0) + for _, v := range input { + result = append(result, datacollectionrules.LogAnalyticsDestination{ + Name: utils.String(v.Name), + WorkspaceResourceId: utils.String(v.WorkspaceResourceId), + }) + } + return &result +} + +func flattenDataCollectionRuleKind(input *datacollectionrules.KnownDataCollectionRuleResourceKind) string { + if input == nil { + return "" + } + return string(*input) +} + +func flattenStringPtr(input *string) string { + if input == nil { + return "" + } + return *input +} + +func flattenStringSlicePtr(input *[]string) []string { + if input == nil { + return make([]string, 0) + } + return *input +} + +func flattenDataCollectionRuleDataFlows(input *[]datacollectionrules.DataFlow) []DataFlow { + if input == nil { + return make([]DataFlow, 0) + } + + result := make([]DataFlow, 0) + for _, v := range *input { + result = append(result, DataFlow{ + Destinations: flattenStringSlicePtr(v.Destinations), + Streams: flattenDataCollectionRuleDataFlowStreams(v.Streams), + }) + } + return result +} + +func flattenDataCollectionRuleDataFlowStreams(input *[]datacollectionrules.KnownDataFlowStreams) []string { + if input == nil { + return make([]string, 0) + } + + result := make([]string, 0) + for _, v := range *input { + result = append(result, string(v)) + } + return result +} + +func flattenDataCollectionRuleDataSources(input *datacollectionrules.DataSourcesSpec) []DataSource { + if input == nil { + return make([]DataSource, 0) + } + + return []DataSource{{ + Extensions: flattenDataCollectionRuleDataSourceExtensions(input.Extensions), + PerformanceCounters: flattenDataCollectionRuleDataSourcePerfCounters(input.PerformanceCounters), + Syslog: flattenDataCollectionRuleDataSourceSyslog(input.Syslog), + WindowsEventLogs: flattenDataCollectionRuleWindowsEventLogs(input.WindowsEventLogs), + }} +} + +func flattenDataCollectionRuleDataSourceExtensions(input *[]datacollectionrules.ExtensionDataSource) []Extension { + if input == nil { + return make([]Extension, 0) + } + + result := make([]Extension, 0) + for _, v := range *input { + extensionSettings := "" + if v.ExtensionSettings != nil { + settingString, _ := pluginsdk.FlattenJsonToString((*v.ExtensionSettings).(map[string]interface{})) + extensionSettings = settingString + } + result = append(result, Extension{ + ExtensionName: v.ExtensionName, + Name: flattenStringPtr(v.Name), + ExtensionSettings: extensionSettings, + InputDataSources: flattenStringSlicePtr(v.InputDataSources), + Streams: flattenDataCollectionRuleDataSourceExtensionStreams(v.Streams), + }) + } + return result +} + +func flattenDataCollectionRuleDataSourceExtensionStreams(input *[]datacollectionrules.KnownExtensionDataSourceStreams) []string { + if input == nil { + return make([]string, 0) + } + + result := make([]string, 0) + for _, v := range *input { + result = append(result, string(v)) + } + return result +} + +func flattenDataCollectionRuleDataSourcePerfCounters(input *[]datacollectionrules.PerfCounterDataSource) []PerfCounter { + if input == nil { + return make([]PerfCounter, 0) + } + + result := make([]PerfCounter, 0) + for _, v := range *input { + result = append(result, PerfCounter{ + Name: flattenStringPtr(v.Name), + CounterSpecifiers: flattenStringSlicePtr(v.CounterSpecifiers), + SamplingFrequencyInSeconds: utils.NormaliseNilableInt64(v.SamplingFrequencyInSeconds), + Streams: flattenDataCollectionRuleDataSourcePerfCounterStreams(v.Streams), + }) + } + return result +} + +func flattenDataCollectionRuleDataSourcePerfCounterStreams(input *[]datacollectionrules.KnownPerfCounterDataSourceStreams) []string { + if input == nil { + return make([]string, 0) + } + + result := make([]string, 0) + for _, v := range *input { + result = append(result, string(v)) + } + return result +} + +func flattenDataCollectionRuleDataSourceSyslog(input *[]datacollectionrules.SyslogDataSource) []Syslog { + if input == nil { + return make([]Syslog, 0) + } + + result := make([]Syslog, 0) + for _, v := range *input { + result = append(result, Syslog{ + Name: flattenStringPtr(v.Name), + FacilityNames: flattenDataCollectionRuleDataSourceSyslogFacilityNames(v.FacilityNames), + LogLevels: flattenDataCollectionRuleDataSourceSyslogLogLevels(v.LogLevels), + }) + } + return result +} + +func flattenDataCollectionRuleDataSourceSyslogFacilityNames(input *[]datacollectionrules.KnownSyslogDataSourceFacilityNames) []string { + if input == nil { + return make([]string, 0) + } + + result := make([]string, 0) + for _, v := range *input { + result = append(result, string(v)) + } + return result +} + +func flattenDataCollectionRuleDataSourceSyslogLogLevels(input *[]datacollectionrules.KnownSyslogDataSourceLogLevels) []string { + if input == nil { + return make([]string, 0) + } + + result := make([]string, 0) + for _, v := range *input { + result = append(result, string(v)) + } + return result +} + +func flattenDataCollectionRuleWindowsEventLogs(input *[]datacollectionrules.WindowsEventLogDataSource) []WindowsEventLog { + if input == nil { + return make([]WindowsEventLog, 0) + } + + result := make([]WindowsEventLog, 0) + for _, v := range *input { + result = append(result, WindowsEventLog{ + Name: flattenStringPtr(v.Name), + XPathQueries: flattenStringSlicePtr(v.XPathQueries), + Streams: flattenDataCollectionRuleWindowsEventLogStreams(v.Streams), + }) + } + return result +} + +func flattenDataCollectionRuleWindowsEventLogStreams(input *[]datacollectionrules.KnownWindowsEventLogDataSourceStreams) []string { + if input == nil { + return make([]string, 0) + } + + result := make([]string, 0) + for _, v := range *input { + result = append(result, string(v)) + } + return result +} + +func flattenDataCollectionRuleDestinations(input *datacollectionrules.DestinationsSpec) []Destination { + if input == nil { + return make([]Destination, 0) + } + + return []Destination{{ + AzureMonitorMetrics: flattenDataCollectionRuleDestinationMetrics(input.AzureMonitorMetrics), + LogAnalytics: flattenDataCollectionRuleDestinationLogAnalytics(input.LogAnalytics), + }} +} + +func flattenDataCollectionRuleDestinationMetrics(input *datacollectionrules.AzureMonitorMetricsDestination) []AzureMonitorMetric { + if input == nil { + return make([]AzureMonitorMetric, 0) + } + + return []AzureMonitorMetric{{ + Name: flattenStringPtr(input.Name), + }} +} + +func flattenDataCollectionRuleDestinationLogAnalytics(input *[]datacollectionrules.LogAnalyticsDestination) []LogAnalytic { + if input == nil { + return make([]LogAnalytic, 0) + } + + result := make([]LogAnalytic, 0) + for _, v := range *input { + result = append(result, LogAnalytic{ + Name: flattenStringPtr(v.Name), + WorkspaceResourceId: flattenStringPtr(v.WorkspaceResourceId), + }) + } + return result +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_diagnostic_setting_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_diagnostic_setting_resource.go index b0ce65f979c..7a57158dc53 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_diagnostic_setting_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_diagnostic_setting_resource.go @@ -9,10 +9,10 @@ import ( "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-07-01-preview/insights" "github.com/hashicorp/go-azure-helpers/lang/response" + authRuleParse "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - authRuleParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces" eventhubValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" logAnalyticsParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/parse" logAnalyticsValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/validate" @@ -195,7 +195,7 @@ func resourceMonitorDiagnosticSettingCreateUpdate(d *pluginsdk.ResourceData, met } if existing.ID != nil && *existing.ID != "" { - return tf.ImportAsExistsError("azurerm_monitor_diagnostic_setting", *existing.ID) + return tf.ImportAsExistsError("azurerm_monitor_diagnostic_setting", fmt.Sprintf("%s|%s", actualResourceId, name)) } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_metric_alert_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_metric_alert_resource.go index 17f8ae201cf..d1f9d286b9e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_metric_alert_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/monitor_metric_alert_resource.go @@ -951,6 +951,9 @@ func resourceMonitorMetricAlertActionHash(input interface{}) int { var buf bytes.Buffer if v, ok := input.(map[string]interface{}); ok { buf.WriteString(fmt.Sprintf("%s-", v["action_group_id"].(string))) + if m, ok := v["webhook_properties"].(map[string]interface{}); ok && m != nil { + buf.WriteString(fmt.Sprintf("%v-", m)) + } } return pluginsdk.HashString(buf.String()) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/registration.go index f908adc2525..e08ea8eba64 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/registration.go @@ -7,12 +7,26 @@ import ( type Registration struct{} -var _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +var ( + _ sdk.TypedServiceRegistration = Registration{} + _ sdk.UntypedServiceRegistrationWithAGitHubLabel = Registration{} +) func (r Registration) AssociatedGitHubLabel() string { return "service/monitor" } +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{} +} + +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + DataCollectionRuleResource{}, + DataCollectionEndpointResource{}, + } +} + // Name is the name of this Service func (r Registration) Name() string { return "Monitor" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/client/client.go index 17d72e8a21a..83207868b8b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/client/client.go @@ -1,19 +1,19 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity" ) type Client struct { - UserAssignedIdentitiesClient *managedidentity.ManagedIdentityClient + UserAssignedIdentitiesClient *managedidentities.ManagedIdentitiesClient } func NewClient(o *common.ClientOptions) *Client { - UserAssignedIdentitiesClient := managedidentity.NewManagedIdentityClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&UserAssignedIdentitiesClient.Client, o.ResourceManagerAuthorizer) + userAssignedIdentitiesClient := managedidentities.NewManagedIdentitiesClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&userAssignedIdentitiesClient.Client, o.ResourceManagerAuthorizer) return &Client{ - UserAssignedIdentitiesClient: &UserAssignedIdentitiesClient, + UserAssignedIdentitiesClient: &userAssignedIdentitiesClient, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/migration/user_assigned_identity_V0_to_V1.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/migration/user_assigned_identity_V0_to_V1.go index a6f450a66cf..a731e24f647 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/migration/user_assigned_identity_V0_to_V1.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/migration/user_assigned_identity_V0_to_V1.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/parse" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -53,7 +53,7 @@ func (UserAssignedIdentityV0ToV1) Schema() map[string]*pluginsdk.Schema { func (UserAssignedIdentityV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { oldId := rawState["id"].(string) - id, err := parse.UserAssignedIdentityIDInsensitively(oldId) + id, err := commonids.ParseUserAssignedIdentityIDInsensitively(oldId) if err != nil { return rawState, err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/parse/user_assigned_identity_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/parse/user_assigned_identity_id.go deleted file mode 100644 index ca3220cd6a0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/parse/user_assigned_identity_id.go +++ /dev/null @@ -1,15 +0,0 @@ -package parse - -import ( - "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity" -) - -// these are here primarily to enable migration over - -func UserAssignedIdentityID(input string) (*managedidentity.UserAssignedIdentitiesId, error) { - return managedidentity.ParseUserAssignedIdentitiesID(input) -} - -func UserAssignedIdentityIDInsensitively(input string) (*managedidentity.UserAssignedIdentitiesId, error) { - return managedidentity.ParseUserAssignedIdentitiesIDInsensitively(input) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/client.go deleted file mode 100644 index 90e17d76a5c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package managedidentity - -import "github.com/Azure/go-autorest/autorest" - -type ManagedIdentityClient struct { - Client autorest.Client - baseUri string -} - -func NewManagedIdentityClientWithBaseURI(endpoint string) ManagedIdentityClient { - return ManagedIdentityClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/id_resourcegroup.go deleted file mode 100644 index c149e996257..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package managedidentity - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/id_scope.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/id_scope.go deleted file mode 100644 index 714fb48ef45..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/id_scope.go +++ /dev/null @@ -1,95 +0,0 @@ -package managedidentity - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ScopeId{} - -// ScopeId is a struct representing the Resource ID for a Scope -type ScopeId struct { - Scope string -} - -// NewScopeID returns a new ScopeId struct -func NewScopeID(scope string) ScopeId { - return ScopeId{ - Scope: scope, - } -} - -// ParseScopeID parses 'input' into a ScopeId -func ParseScopeID(input string) (*ScopeId, error) { - parser := resourceids.NewParserFromResourceIdType(ScopeId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ScopeId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, fmt.Errorf("the segment 'scope' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseScopeIDInsensitively parses 'input' case-insensitively into a ScopeId -// note: this method should only be used for API response data and not user input -func ParseScopeIDInsensitively(input string) (*ScopeId, error) { - parser := resourceids.NewParserFromResourceIdType(ScopeId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ScopeId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, fmt.Errorf("the segment 'scope' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateScopeID checks that 'input' can be parsed as a Scope ID -func ValidateScopeID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseScopeID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Scope ID -func (id ScopeId) ID() string { - fmtString := "/%s" - return fmt.Sprintf(fmtString, strings.TrimPrefix(id.Scope, "/")) -} - -// Segments returns a slice of Resource ID Segments which comprise this Scope ID -func (id ScopeId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.ScopeSegment("scope", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group"), - } -} - -// String returns a human-readable description of this Scope ID -func (id ScopeId) String() string { - components := []string{ - fmt.Sprintf("Scope: %q", id.Scope), - } - return fmt.Sprintf("Scope (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/id_subscription.go deleted file mode 100644 index 9a41e2e9657..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package managedidentity - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/id_userassignedidentities.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/id_userassignedidentities.go deleted file mode 100644 index cbea35b941e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/id_userassignedidentities.go +++ /dev/null @@ -1,124 +0,0 @@ -package managedidentity - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = UserAssignedIdentitiesId{} - -// UserAssignedIdentitiesId is a struct representing the Resource ID for a User Assigned Identities -type UserAssignedIdentitiesId struct { - SubscriptionId string - ResourceGroupName string - ResourceName string -} - -// NewUserAssignedIdentitiesID returns a new UserAssignedIdentitiesId struct -func NewUserAssignedIdentitiesID(subscriptionId string, resourceGroupName string, resourceName string) UserAssignedIdentitiesId { - return UserAssignedIdentitiesId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ResourceName: resourceName, - } -} - -// ParseUserAssignedIdentitiesID parses 'input' into a UserAssignedIdentitiesId -func ParseUserAssignedIdentitiesID(input string) (*UserAssignedIdentitiesId, error) { - parser := resourceids.NewParserFromResourceIdType(UserAssignedIdentitiesId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := UserAssignedIdentitiesId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseUserAssignedIdentitiesIDInsensitively parses 'input' case-insensitively into a UserAssignedIdentitiesId -// note: this method should only be used for API response data and not user input -func ParseUserAssignedIdentitiesIDInsensitively(input string) (*UserAssignedIdentitiesId, error) { - parser := resourceids.NewParserFromResourceIdType(UserAssignedIdentitiesId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := UserAssignedIdentitiesId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ResourceName, ok = parsed.Parsed["resourceName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateUserAssignedIdentitiesID checks that 'input' can be parsed as a User Assigned Identities ID -func ValidateUserAssignedIdentitiesID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseUserAssignedIdentitiesID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted User Assigned Identities ID -func (id UserAssignedIdentitiesId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ManagedIdentity/userAssignedIdentities/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ResourceName) -} - -// Segments returns a slice of Resource ID Segments which comprise this User Assigned Identities ID -func (id UserAssignedIdentitiesId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftManagedIdentity", "Microsoft.ManagedIdentity", "Microsoft.ManagedIdentity"), - resourceids.StaticSegment("staticUserAssignedIdentities", "userAssignedIdentities", "userAssignedIdentities"), - resourceids.UserSpecifiedSegment("resourceName", "resourceValue"), - } -} - -// String returns a human-readable description of this User Assigned Identities ID -func (id UserAssignedIdentitiesId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Resource Name: %q", id.ResourceName), - } - return fmt.Sprintf("User Assigned Identities (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_systemassignedidentitiesgetbyscope_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_systemassignedidentitiesgetbyscope_autorest.go deleted file mode 100644 index 7ae4a121b3a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_systemassignedidentitiesgetbyscope_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package managedidentity - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type SystemAssignedIdentitiesGetByScopeResponse struct { - HttpResponse *http.Response - Model *SystemAssignedIdentity -} - -// SystemAssignedIdentitiesGetByScope ... -func (c ManagedIdentityClient) SystemAssignedIdentitiesGetByScope(ctx context.Context, id ScopeId) (result SystemAssignedIdentitiesGetByScopeResponse, err error) { - req, err := c.preparerForSystemAssignedIdentitiesGetByScope(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "SystemAssignedIdentitiesGetByScope", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "SystemAssignedIdentitiesGetByScope", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForSystemAssignedIdentitiesGetByScope(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "SystemAssignedIdentitiesGetByScope", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForSystemAssignedIdentitiesGetByScope prepares the SystemAssignedIdentitiesGetByScope request. -func (c ManagedIdentityClient) preparerForSystemAssignedIdentitiesGetByScope(ctx context.Context, id ScopeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ManagedIdentity/identities/default", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForSystemAssignedIdentitiesGetByScope handles the response to the SystemAssignedIdentitiesGetByScope request. The method always -// closes the http.Response Body. -func (c ManagedIdentityClient) responderForSystemAssignedIdentitiesGetByScope(resp *http.Response) (result SystemAssignedIdentitiesGetByScopeResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitiescreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitiescreateorupdate_autorest.go deleted file mode 100644 index 04a011409a7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitiescreateorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package managedidentity - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UserAssignedIdentitiesCreateOrUpdateResponse struct { - HttpResponse *http.Response - Model *Identity -} - -// UserAssignedIdentitiesCreateOrUpdate ... -func (c ManagedIdentityClient) UserAssignedIdentitiesCreateOrUpdate(ctx context.Context, id UserAssignedIdentitiesId, input Identity) (result UserAssignedIdentitiesCreateOrUpdateResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserAssignedIdentitiesCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserAssignedIdentitiesCreateOrUpdate prepares the UserAssignedIdentitiesCreateOrUpdate request. -func (c ManagedIdentityClient) preparerForUserAssignedIdentitiesCreateOrUpdate(ctx context.Context, id UserAssignedIdentitiesId, input Identity) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserAssignedIdentitiesCreateOrUpdate handles the response to the UserAssignedIdentitiesCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ManagedIdentityClient) responderForUserAssignedIdentitiesCreateOrUpdate(resp *http.Response) (result UserAssignedIdentitiesCreateOrUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitiesdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitiesdelete_autorest.go deleted file mode 100644 index d0b17ac3084..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitiesdelete_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package managedidentity - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UserAssignedIdentitiesDeleteResponse struct { - HttpResponse *http.Response -} - -// UserAssignedIdentitiesDelete ... -func (c ManagedIdentityClient) UserAssignedIdentitiesDelete(ctx context.Context, id UserAssignedIdentitiesId) (result UserAssignedIdentitiesDeleteResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserAssignedIdentitiesDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserAssignedIdentitiesDelete prepares the UserAssignedIdentitiesDelete request. -func (c ManagedIdentityClient) preparerForUserAssignedIdentitiesDelete(ctx context.Context, id UserAssignedIdentitiesId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserAssignedIdentitiesDelete handles the response to the UserAssignedIdentitiesDelete request. The method always -// closes the http.Response Body. -func (c ManagedIdentityClient) responderForUserAssignedIdentitiesDelete(resp *http.Response) (result UserAssignedIdentitiesDeleteResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitiesget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitiesget_autorest.go deleted file mode 100644 index 00f60fbf795..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitiesget_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package managedidentity - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UserAssignedIdentitiesGetResponse struct { - HttpResponse *http.Response - Model *Identity -} - -// UserAssignedIdentitiesGet ... -func (c ManagedIdentityClient) UserAssignedIdentitiesGet(ctx context.Context, id UserAssignedIdentitiesId) (result UserAssignedIdentitiesGetResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserAssignedIdentitiesGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserAssignedIdentitiesGet prepares the UserAssignedIdentitiesGet request. -func (c ManagedIdentityClient) preparerForUserAssignedIdentitiesGet(ctx context.Context, id UserAssignedIdentitiesId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserAssignedIdentitiesGet handles the response to the UserAssignedIdentitiesGet request. The method always -// closes the http.Response Body. -func (c ManagedIdentityClient) responderForUserAssignedIdentitiesGet(resp *http.Response) (result UserAssignedIdentitiesGetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitieslistbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitieslistbyresourcegroup_autorest.go deleted file mode 100644 index d5f362fd1c6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitieslistbyresourcegroup_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package managedidentity - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UserAssignedIdentitiesListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *[]Identity - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (UserAssignedIdentitiesListByResourceGroupResponse, error) -} - -type UserAssignedIdentitiesListByResourceGroupCompleteResult struct { - Items []Identity -} - -func (r UserAssignedIdentitiesListByResourceGroupResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r UserAssignedIdentitiesListByResourceGroupResponse) LoadMore(ctx context.Context) (resp UserAssignedIdentitiesListByResourceGroupResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// UserAssignedIdentitiesListByResourceGroup ... -func (c ManagedIdentityClient) UserAssignedIdentitiesListByResourceGroup(ctx context.Context, id ResourceGroupId) (resp UserAssignedIdentitiesListByResourceGroupResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForUserAssignedIdentitiesListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// UserAssignedIdentitiesListByResourceGroupComplete retrieves all of the results into a single object -func (c ManagedIdentityClient) UserAssignedIdentitiesListByResourceGroupComplete(ctx context.Context, id ResourceGroupId) (UserAssignedIdentitiesListByResourceGroupCompleteResult, error) { - return c.UserAssignedIdentitiesListByResourceGroupCompleteMatchingPredicate(ctx, id, IdentityPredicate{}) -} - -// UserAssignedIdentitiesListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedIdentityClient) UserAssignedIdentitiesListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate IdentityPredicate) (resp UserAssignedIdentitiesListByResourceGroupCompleteResult, err error) { - items := make([]Identity, 0) - - page, err := c.UserAssignedIdentitiesListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := UserAssignedIdentitiesListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForUserAssignedIdentitiesListByResourceGroup prepares the UserAssignedIdentitiesListByResourceGroup request. -func (c ManagedIdentityClient) preparerForUserAssignedIdentitiesListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ManagedIdentity/userAssignedIdentities", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForUserAssignedIdentitiesListByResourceGroupWithNextLink prepares the UserAssignedIdentitiesListByResourceGroup request with the given nextLink token. -func (c ManagedIdentityClient) preparerForUserAssignedIdentitiesListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserAssignedIdentitiesListByResourceGroup handles the response to the UserAssignedIdentitiesListByResourceGroup request. The method always -// closes the http.Response Body. -func (c ManagedIdentityClient) responderForUserAssignedIdentitiesListByResourceGroup(resp *http.Response) (result UserAssignedIdentitiesListByResourceGroupResponse, err error) { - type page struct { - Values []Identity `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result UserAssignedIdentitiesListByResourceGroupResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserAssignedIdentitiesListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitieslistbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitieslistbysubscription_autorest.go deleted file mode 100644 index 3923fb67206..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitieslistbysubscription_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package managedidentity - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UserAssignedIdentitiesListBySubscriptionResponse struct { - HttpResponse *http.Response - Model *[]Identity - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (UserAssignedIdentitiesListBySubscriptionResponse, error) -} - -type UserAssignedIdentitiesListBySubscriptionCompleteResult struct { - Items []Identity -} - -func (r UserAssignedIdentitiesListBySubscriptionResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r UserAssignedIdentitiesListBySubscriptionResponse) LoadMore(ctx context.Context) (resp UserAssignedIdentitiesListBySubscriptionResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// UserAssignedIdentitiesListBySubscription ... -func (c ManagedIdentityClient) UserAssignedIdentitiesListBySubscription(ctx context.Context, id SubscriptionId) (resp UserAssignedIdentitiesListBySubscriptionResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForUserAssignedIdentitiesListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// UserAssignedIdentitiesListBySubscriptionComplete retrieves all of the results into a single object -func (c ManagedIdentityClient) UserAssignedIdentitiesListBySubscriptionComplete(ctx context.Context, id SubscriptionId) (UserAssignedIdentitiesListBySubscriptionCompleteResult, error) { - return c.UserAssignedIdentitiesListBySubscriptionCompleteMatchingPredicate(ctx, id, IdentityPredicate{}) -} - -// UserAssignedIdentitiesListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedIdentityClient) UserAssignedIdentitiesListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate IdentityPredicate) (resp UserAssignedIdentitiesListBySubscriptionCompleteResult, err error) { - items := make([]Identity, 0) - - page, err := c.UserAssignedIdentitiesListBySubscription(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := UserAssignedIdentitiesListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForUserAssignedIdentitiesListBySubscription prepares the UserAssignedIdentitiesListBySubscription request. -func (c ManagedIdentityClient) preparerForUserAssignedIdentitiesListBySubscription(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ManagedIdentity/userAssignedIdentities", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForUserAssignedIdentitiesListBySubscriptionWithNextLink prepares the UserAssignedIdentitiesListBySubscription request with the given nextLink token. -func (c ManagedIdentityClient) preparerForUserAssignedIdentitiesListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserAssignedIdentitiesListBySubscription handles the response to the UserAssignedIdentitiesListBySubscription request. The method always -// closes the http.Response Body. -func (c ManagedIdentityClient) responderForUserAssignedIdentitiesListBySubscription(resp *http.Response) (result UserAssignedIdentitiesListBySubscriptionResponse, err error) { - type page struct { - Values []Identity `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result UserAssignedIdentitiesListBySubscriptionResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserAssignedIdentitiesListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitiesupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitiesupdate_autorest.go deleted file mode 100644 index c6d69a696f5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/method_userassignedidentitiesupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package managedidentity - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UserAssignedIdentitiesUpdateResponse struct { - HttpResponse *http.Response - Model *Identity -} - -// UserAssignedIdentitiesUpdate ... -func (c ManagedIdentityClient) UserAssignedIdentitiesUpdate(ctx context.Context, id UserAssignedIdentitiesId, input IdentityUpdate) (result UserAssignedIdentitiesUpdateResponse, err error) { - req, err := c.preparerForUserAssignedIdentitiesUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUserAssignedIdentitiesUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedidentity.ManagedIdentityClient", "UserAssignedIdentitiesUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUserAssignedIdentitiesUpdate prepares the UserAssignedIdentitiesUpdate request. -func (c ManagedIdentityClient) preparerForUserAssignedIdentitiesUpdate(ctx context.Context, id UserAssignedIdentitiesId, input IdentityUpdate) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUserAssignedIdentitiesUpdate handles the response to the UserAssignedIdentitiesUpdate request. The method always -// closes the http.Response Body. -func (c ManagedIdentityClient) responderForUserAssignedIdentitiesUpdate(resp *http.Response) (result UserAssignedIdentitiesUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/model_identity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/model_identity.go deleted file mode 100644 index 1e0db236f5c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/model_identity.go +++ /dev/null @@ -1,10 +0,0 @@ -package managedidentity - -type Identity struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *UserAssignedIdentityProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/model_identityupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/model_identityupdate.go deleted file mode 100644 index 1126bde5446..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/model_identityupdate.go +++ /dev/null @@ -1,10 +0,0 @@ -package managedidentity - -type IdentityUpdate struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *UserAssignedIdentityProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/model_systemassignedidentity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/model_systemassignedidentity.go deleted file mode 100644 index 2a20be5718d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/model_systemassignedidentity.go +++ /dev/null @@ -1,10 +0,0 @@ -package managedidentity - -type SystemAssignedIdentity struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *SystemAssignedIdentityProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/model_systemassignedidentityproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/model_systemassignedidentityproperties.go deleted file mode 100644 index dc2b0d17c62..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/model_systemassignedidentityproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package managedidentity - -type SystemAssignedIdentityProperties struct { - ClientId *string `json:"clientId,omitempty"` - ClientSecretUrl *string `json:"clientSecretUrl,omitempty"` - PrincipalId *string `json:"principalId,omitempty"` - TenantId *string `json:"tenantId,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/model_userassignedidentityproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/model_userassignedidentityproperties.go deleted file mode 100644 index 7fdb9dc19d6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/model_userassignedidentityproperties.go +++ /dev/null @@ -1,7 +0,0 @@ -package managedidentity - -type UserAssignedIdentityProperties struct { - ClientId *string `json:"clientId,omitempty"` - PrincipalId *string `json:"principalId,omitempty"` - TenantId *string `json:"tenantId,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/predicates.go deleted file mode 100644 index c82c517368a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/predicates.go +++ /dev/null @@ -1,29 +0,0 @@ -package managedidentity - -type IdentityPredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p IdentityPredicate) Matches(input Identity) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/version.go deleted file mode 100644 index 0d7c2758f12..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package managedidentity - -import "fmt" - -const defaultApiVersion = "2018-11-30" - -func userAgent() string { - return fmt.Sprintf("pandora/managedidentity/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/transition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/transition.go deleted file mode 100644 index 64b4a42fb49..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/transition.go +++ /dev/null @@ -1,23 +0,0 @@ -package msi - -import "github.com/hashicorp/terraform-provider-azurerm/utils" - -func expandTags(input map[string]interface{}) *map[string]string { - output := make(map[string]string) - for k, v := range input { - output[k] = v.(string) - } - return &output -} - -func flattenTags(input *map[string]string) map[string]*string { - output := make(map[string]*string) - - if input != nil { - for k, v := range *input { - output[k] = utils.String(v) - } - } - - return output -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/user_assigned_identity_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/user_assigned_identity_data_source.go index 6660330a41e..eefd4d4cca0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/user_assigned_identity_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/user_assigned_identity_data_source.go @@ -5,11 +5,11 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -49,7 +49,7 @@ func dataSourceArmUserAssignedIdentity() *pluginsdk.Resource { Computed: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -60,7 +60,7 @@ func dataSourceArmUserAssignedIdentityRead(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := managedidentity.NewUserAssignedIdentitiesID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := commonids.NewUserAssignedIdentityID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) resp, err := client.UserAssignedIdentitiesGet(ctx, id) if err != nil { if response.WasNotFound(resp.HttpResponse) { @@ -80,7 +80,7 @@ func dataSourceArmUserAssignedIdentityRead(d *pluginsdk.ResourceData, meta inter d.Set("tenant_id", props.TenantId) } - if err := tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + if err := tags.FlattenAndSet(d, model.Tags); err != nil { return err } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/user_assigned_identity_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/user_assigned_identity_resource.go index 9bc662f12a0..1b05a86330a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/user_assigned_identity_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/user_assigned_identity_resource.go @@ -6,13 +6,14 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -26,7 +27,7 @@ func resourceArmUserAssignedIdentity() *pluginsdk.Resource { Update: resourceArmUserAssignedIdentityCreateUpdate, Delete: resourceArmUserAssignedIdentityDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := managedidentity.ParseUserAssignedIdentitiesID(id) + _, err := commonids.ParseUserAssignedIdentityID(id) return err }), @@ -50,11 +51,11 @@ func resourceArmUserAssignedIdentity() *pluginsdk.Resource { ValidateFunc: validation.StringLenBetween(3, 128), }, - "resource_group_name": azure.SchemaResourceGroupName(), + "resource_group_name": commonschema.ResourceGroupName(), - "location": azure.SchemaLocation(), + "location": commonschema.Location(), - "tags": tags.Schema(), + "tags": commonschema.Tags(), "principal_id": { Type: pluginsdk.TypeString, @@ -82,10 +83,9 @@ func resourceArmUserAssignedIdentityCreateUpdate(d *pluginsdk.ResourceData, meta log.Printf("[INFO] preparing arguments for User Assigned Identity create/update.") - location := d.Get("location").(string) t := d.Get("tags").(map[string]interface{}) - resourceId := managedidentity.NewUserAssignedIdentitiesID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resourceId := commonids.NewUserAssignedIdentityID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { existing, err := client.UserAssignedIdentitiesGet(ctx, resourceId) if err != nil { @@ -99,10 +99,10 @@ func resourceArmUserAssignedIdentityCreateUpdate(d *pluginsdk.ResourceData, meta } } - identity := managedidentity.Identity{ + identity := managedidentities.Identity{ Name: utils.String(resourceId.ResourceName), - Location: location, - Tags: expandTags(t), + Location: location.Normalize(d.Get("location").(string)), + Tags: tags.Expand(t), } if _, err := client.UserAssignedIdentitiesCreateOrUpdate(ctx, resourceId, identity); err != nil { @@ -118,7 +118,7 @@ func resourceArmUserAssignedIdentityRead(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := managedidentity.ParseUserAssignedIdentitiesID(d.Id()) + id, err := commonids.ParseUserAssignedIdentityID(d.Id()) if err != nil { return err } @@ -144,7 +144,7 @@ func resourceArmUserAssignedIdentityRead(d *pluginsdk.ResourceData, meta interfa d.Set("tenant_id", props.TenantId) } - if err := tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + if err := tags.FlattenAndSet(d, model.Tags); err != nil { return err } } @@ -157,7 +157,7 @@ func resourceArmUserAssignedIdentityDelete(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := managedidentity.ParseUserAssignedIdentitiesID(d.Id()) + id, err := commonids.ParseUserAssignedIdentityID(d.Id()) if err != nil { return err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate/user_assigned_identity_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate/user_assigned_identity_id.go deleted file mode 100644 index 1b1d32e9b1a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate/user_assigned_identity_id.go +++ /dev/null @@ -1,21 +0,0 @@ -package validate - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity" -) - -func UserAssignedIdentityID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := managedidentity.ParseUserAssignedIdentitiesID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/client/client.go index dde42790c2a..7d81bdd3685 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/client/client.go @@ -2,7 +2,7 @@ package client import ( "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v5.0/sql" - "github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine" + "github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) @@ -39,7 +39,7 @@ type Client struct { ServerVulnerabilityAssessmentsClient *sql.ServerVulnerabilityAssessmentsClient ServersClient *sql.ServersClient TransparentDataEncryptionsClient *sql.TransparentDataEncryptionsClient - VirtualMachinesClient *sqlvirtualmachine.SQLVirtualMachinesClient + VirtualMachinesClient *sqlvirtualmachines.SqlVirtualMachinesClient VirtualNetworkRulesClient *sql.VirtualNetworkRulesClient } @@ -140,7 +140,7 @@ func NewClient(o *common.ClientOptions) *Client { transparentDataEncryptionsClient := sql.NewTransparentDataEncryptionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&transparentDataEncryptionsClient.Client, o.ResourceManagerAuthorizer) - virtualMachinesClient := sqlvirtualmachine.NewSQLVirtualMachinesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + virtualMachinesClient := sqlvirtualmachines.NewSqlVirtualMachinesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&virtualMachinesClient.Client, o.ResourceManagerAuthorizer) virtualNetworkRulesClient := sql.NewVirtualNetworkRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/helper/elasticpool.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/helper/elasticpool.go index b663747b90a..fe8821fd5e0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/helper/elasticpool.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/helper/elasticpool.go @@ -125,8 +125,8 @@ var getvCoreMaxGB = map[string]map[string]map[int]float64{ 2: 512, 4: 756, 6: 1536, - 8: 1536, - 10: 1536, + 8: 2048, + 10: 2048, 12: 2048, 14: 2048, 16: 2048, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_elasticpool_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_elasticpool_resource.go index c1bf7087513..f4cd9f70c53 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_elasticpool_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_elasticpool_resource.go @@ -8,6 +8,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v5.0/sql" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -114,6 +115,23 @@ func resourceMsSqlElasticPool() *pluginsdk.Resource { }, }, + "maintenance_configuration_name": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "SQL_Default", + ValidateFunc: validation.StringInSlice([]string{"SQL_Default", "SQL_EastUS_MI_1", "SQL_EastUS2_MI_1", "SQL_WestUS2_MI_1", "SQL_SoutheastAsia_MI_1", "SQL_AustraliaEast_MI_1", "SQL_NorthEurope_MI_1", "SQL_SouthCentralUS_MI_1", + "SQL_UKSouth_MI_1", "SQL_WestEurope_MI_1", "SQL_EastUS_MI_2", "SQL_EastUS2_MI_2", "SQL_WestUS2_MI_2", "SQL_SoutheastAsia_MI_2", "SQL_NorthEurope_MI_2", "SQL_SouthCentralUS_MI_2", + "SQL_UKSouth_MI_2", "SQL_WestEurope_MI_2", "SQL_AustraliaSoutheast_MI_1", "SQL_BrazilSouth_MI_1", "SQL_CanadaCentral_MI_1", "SQL_CanadaEast_MI_1", "SQL_CentralUS_MI_1", "SQL_EastAsia_MI_1", + "SQL_FranceCentral_MI_1", "SQL_GermanyWestCentral_MI_1", "SQL_CentralIndia_MI_1", "SQL_JapanEast_MI_1", "SQL_JapanWest_MI_1", "SQL_NorthCentralUS_MI_1", "SQL_UKWest_MI_1", "SQL_WestUS_MI_1", + "SQL_AustraliaSoutheast_MI_2", "SQL_BrazilSouth_MI_2", "SQL_CanadaCentral_MI_2", "SQL_CanadaEast_MI_2", "SQL_CentralUS_MI_2", "SQL_EastAsia_MI_2", "SQL_FranceCentral_MI_2", "SQL_GermanyWestCentral_MI_2", + "SQL_CentralIndia_MI_2", "SQL_JapanEast_MI_2", "SQL_JapanWest_MI_2", "SQL_NorthCentralUS_MI_2", "SQL_UKWest_MI_2", "SQL_WestUS_MI_2", "SQL_KoreaCentral_MI_1", "SQL_KoreaCentral_MI_2", + "SQL_WestCentralUS_MI_1", "SQL_WestCentralUS_MI_2", "SQL_UAENorth_MI_1", "SQL_SwitzerlandWest_MI_1", "SQL_SwitzerlandNorth_MI_1", "SQL_UAENorth_MI_2", "SQL_SwitzerlandWest_MI_2", + "SQL_SwitzerlandNorth_MI_2", "SQL_FranceSouth_MI_1", "SQL_FranceSouth_MI_2", "SQL_SouthAfricaNorth_MI_1", "SQL_KoreaSouth_MI_1", "SQL_UAECentral_MI_1", "SQL_SouthAfricaNorth_MI_2", + "SQL_KoreaSouth_MI_2", "SQL_UAECentral_MI_2", "SQL_SouthIndia_MI_1", "SQL_SouthIndia_MI_2", "SQL_AustraliaCentral_MI_1", "SQL_AustraliaCentral2_MI_1", "SQL_AustraliaCentral_MI_2", + "SQL_AustraliaCentral2_MI_2", "SQL_WestIndia_MI_1", "SQL_WestIndia_MI_2", "SQL_SouthAfricaWest_MI_1", "SQL_SouthAfricaWest_MI_2", "SQL_GermanyNorth_MI_1", "SQL_GermanyNorth_MI_2", "SQL_NorwayEast_MI_1", + "SQL_BrazilSoutheast_MI_1", "SQL_NorwayWest_MI_1", "SQL_WestUS3_MI_1", "SQL_NorwayEast_MI_2", "SQL_BrazilSoutheast_MI_2", "SQL_NorwayWest_MI_2", "SQL_WestUS3_MI_2"}, false), + }, + "per_database_settings": { Type: pluginsdk.TypeList, Required: true, @@ -206,15 +224,17 @@ func resourceMsSqlElasticPoolCreateUpdate(d *pluginsdk.ResourceData, meta interf sku := expandMsSqlElasticPoolSku(d) t := d.Get("tags").(map[string]interface{}) + maintenanceConfigId := publicmaintenanceconfigurations.NewPublicMaintenanceConfigurationID(subscriptionId, d.Get("maintenance_configuration_name").(string)) elasticPool := sql.ElasticPool{ Name: &id.Name, Location: &location, Sku: sku, Tags: tags.Expand(t), ElasticPoolProperties: &sql.ElasticPoolProperties{ - LicenseType: sql.ElasticPoolLicenseType(d.Get("license_type").(string)), - PerDatabaseSettings: expandMsSqlElasticPoolPerDatabaseSettings(d), - ZoneRedundant: utils.Bool(d.Get("zone_redundant").(bool)), + LicenseType: sql.ElasticPoolLicenseType(d.Get("license_type").(string)), + PerDatabaseSettings: expandMsSqlElasticPoolPerDatabaseSettings(d), + ZoneRedundant: utils.Bool(d.Get("zone_redundant").(bool)), + MaintenanceConfigurationID: utils.String(maintenanceConfigId.ID()), }, } @@ -288,6 +308,12 @@ func resourceMsSqlElasticPoolRead(d *pluginsdk.ResourceData, meta interface{}) e if err := d.Set("per_database_settings", flattenMsSqlElasticPoolPerDatabaseSettings(properties.PerDatabaseSettings)); err != nil { return fmt.Errorf("setting `per_database_settings`: %+v", err) } + + maintenanceConfigId, err := publicmaintenanceconfigurations.ParsePublicMaintenanceConfigurationID(*properties.MaintenanceConfigurationID) + if err != nil { + return err + } + d.Set("maintenance_configuration_name", maintenanceConfigId.ResourceName) } return tags.FlattenAndSet(d, resp.Tags) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_failover_group_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_failover_group_resource.go index bd6fbefd6c3..c62e1a4120a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_failover_group_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_failover_group_resource.go @@ -5,10 +5,9 @@ import ( "fmt" "time" + "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v5.0/sql" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - - "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v5.0/sql" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/parse" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_managed_instance_failover_group_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_managed_instance_failover_group_resource.go index 7b9e7f39711..3bd074a3151 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_managed_instance_failover_group_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_managed_instance_failover_group_resource.go @@ -232,6 +232,7 @@ func (r MsSqlManagedInstanceFailoverGroupResource) Update() sdk.ResourceFunc { Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.MSSQL.InstanceFailoverGroupsClient + instancesClient := metadata.Client.MSSQL.ManagedInstancesClient id, err := parse.InstanceFailoverGroupID(metadata.ResourceData.Id()) if err != nil { @@ -244,6 +245,21 @@ func (r MsSqlManagedInstanceFailoverGroupResource) Update() sdk.ResourceFunc { return err } + managedInstanceId, err := parse.ManagedInstanceID(state.ManagedInstanceId) + if err != nil { + return fmt.Errorf("parsing `managed_instance_id`: %v", err) + } + + partnerId, err := parse.ManagedInstanceID(state.PartnerManagedInstanceId) + if err != nil { + return err + } + + partner, err := instancesClient.Get(ctx, partnerId.ResourceGroup, partnerId.Name, "") + if err != nil || partner.Location == nil || *partner.Location == "" { + return fmt.Errorf("checking for existence and region of Partner of %q: %+v", id, err) + } + readOnlyFailoverPolicy := sql.ReadOnlyEndpointFailoverPolicyDisabled if state.ReadOnlyEndpointFailoverPolicyEnabled { readOnlyFailoverPolicy = sql.ReadOnlyEndpointFailoverPolicyEnabled @@ -255,6 +271,17 @@ func (r MsSqlManagedInstanceFailoverGroupResource) Update() sdk.ResourceFunc { FailoverPolicy: readOnlyFailoverPolicy, }, ReadWriteEndpoint: &sql.InstanceFailoverGroupReadWriteEndpoint{}, + PartnerRegions: &[]sql.PartnerRegionInfo{ + { + Location: partner.Location, + }, + }, + ManagedInstancePairs: &[]sql.ManagedInstancePairInfo{ + { + PrimaryManagedInstanceID: utils.String(managedInstanceId.ID()), + PartnerManagedInstanceID: utils.String(partnerId.ID()), + }, + }, }, } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_managed_instance_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_managed_instance_resource.go index c58934d5d11..b818c23bb82 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_managed_instance_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_managed_instance_resource.go @@ -11,10 +11,10 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - maintenanceParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/maintenance/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/validate" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" @@ -120,7 +120,7 @@ func (r MsSqlManagedInstanceResource) Arguments() map[string]*pluginsdk.Schema { "storage_size_in_gb": { Type: schema.TypeInt, Required: true, - ValidateFunc: validation.IntBetween(32, 8192), + ValidateFunc: validation.IntBetween(32, 16384), }, "subnet_id": { @@ -293,7 +293,7 @@ func (r MsSqlManagedInstanceResource) Create() sdk.ResourceFunc { return fmt.Errorf("expanding `sku_name` for SQL Managed Instance Server %q: %v", id.ID(), err) } - maintenanceConfigId := maintenanceParse.NewPublicMaintenanceConfigurationID(subscriptionId, model.MaintenanceConfigurationName) + maintenanceConfigId := publicmaintenanceconfigurations.NewPublicMaintenanceConfigurationID(subscriptionId, model.MaintenanceConfigurationName) parameters := sql.ManagedInstance{ Sku: sku, @@ -380,7 +380,7 @@ func (r MsSqlManagedInstanceResource) Update() sdk.ResourceFunc { } if metadata.ResourceData.HasChange("maintenance_configuration_name") { - maintenanceConfigId := maintenanceParse.NewPublicMaintenanceConfigurationID(id.SubscriptionId, state.MaintenanceConfigurationName) + maintenanceConfigId := publicmaintenanceconfigurations.NewPublicMaintenanceConfigurationID(id.SubscriptionId, state.MaintenanceConfigurationName) properties.MaintenanceConfigurationID = utils.String(maintenanceConfigId.ID()) } @@ -438,6 +438,8 @@ func (r MsSqlManagedInstanceResource) Read() sdk.ResourceFunc { // This value is not returned, so we'll just set whatever is in the state/config AdministratorLoginPassword: state.AdministratorLoginPassword, + // This value is not returned, so we'll just set whatever is in the state/config + DnsZonePartnerId: state.DnsZonePartnerId, } if sku := existing.Sku; sku != nil && sku.Name != nil { @@ -459,11 +461,11 @@ func (r MsSqlManagedInstanceResource) Read() sdk.ResourceFunc { model.Fqdn = *props.FullyQualifiedDomainName } if props.MaintenanceConfigurationID != nil { - maintenanceConfigId, err := maintenanceParse.PublicMaintenanceConfigurationID(*props.MaintenanceConfigurationID) + maintenanceConfigId, err := publicmaintenanceconfigurations.ParsePublicMaintenanceConfigurationID(*props.MaintenanceConfigurationID) if err != nil { return err } - model.MaintenanceConfigurationName = maintenanceConfigId.Name + model.MaintenanceConfigurationName = maintenanceConfigId.ResourceName } if props.MinimalTLSVersion != nil { model.MinimumTlsVersion = *props.MinimalTLSVersion diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_server_dns_alias_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_server_dns_alias_resource.go index 62a3f8a20f1..d8b9dbd4d4e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_server_dns_alias_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_server_dns_alias_resource.go @@ -131,9 +131,14 @@ func (m ServerDNSAliasResource) Delete() sdk.ResourceFunc { } metadata.Logger.Infof("deleting %s", id) client := metadata.Client.MSSQL.ServerDNSAliasClient - if _, err = client.Delete(ctx, id.ResourceGroup, id.ServerName, id.DnsAliaseName); err != nil { + future, err := client.Delete(ctx, id.ResourceGroup, id.ServerName, id.DnsAliaseName) + if err != nil { return fmt.Errorf("deleting %s: %v", id, err) } + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for deletion of %q: %+v", id, err) + } + return nil }, } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_server_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_server_resource.go index 4ee88df9e37..de679242eae 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_server_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_server_resource.go @@ -16,7 +16,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -136,9 +135,9 @@ func resourceMsSqlServer() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, RequiredWith: []string{ - "identity.0.identity_ids", + "identity", }, }, @@ -150,6 +149,7 @@ func resourceMsSqlServer() *pluginsdk.Resource { "1.0", "1.1", "1.2", + "Disabled", }, false), }, @@ -257,7 +257,7 @@ func resourceMsSqlServerCreate(d *pluginsdk.ResourceData, meta interface{}) erro props.ServerProperties.RestrictOutboundNetworkAccess = sql.ServerNetworkAccessFlagEnabled } - if v := d.Get("minimum_tls_version"); v.(string) != "" { + if v := d.Get("minimum_tls_version"); v.(string) != "Disabled" { props.ServerProperties.MinimalTLSVersion = utils.String(v.(string)) } @@ -347,7 +347,7 @@ func resourceMsSqlServerUpdate(d *pluginsdk.ResourceData, meta interface{}) erro props.ServerProperties.AdministratorLoginPassword = utils.String(adminPassword) } - if v := d.Get("minimum_tls_version"); v.(string) != "" { + if v := d.Get("minimum_tls_version"); v.(string) != "Disabled" { props.ServerProperties.MinimalTLSVersion = utils.String(v.(string)) } @@ -467,7 +467,11 @@ func resourceMsSqlServerRead(d *pluginsdk.ResourceData, meta interface{}) error d.Set("version", props.Version) d.Set("administrator_login", props.AdministratorLogin) d.Set("fully_qualified_domain_name", props.FullyQualifiedDomainName) - d.Set("minimum_tls_version", props.MinimalTLSVersion) + if v := props.MinimalTLSVersion; v == nil { + d.Set("minimum_tls_version", "Disabled") + } else { + d.Set("minimum_tls_version", props.MinimalTLSVersion) + } d.Set("public_network_access_enabled", props.PublicNetworkAccess == sql.ServerNetworkAccessFlagEnabled) d.Set("outbound_network_restriction_enabled", props.RestrictOutboundNetworkAccess == sql.ServerNetworkAccessFlagEnabled) primaryUserAssignedIdentityID := "" @@ -682,7 +686,7 @@ func flattenSqlServerRestorableDatabases(resp sql.RestorableDroppedDatabaseListR func msSqlMinimumTLSVersionDiff(ctx context.Context, d *pluginsdk.ResourceDiff, _ interface{}) (err error) { old, new := d.GetChange("minimum_tls_version") - if old != "" && new == "" { + if old != "" && old != "Disabled" && new == "Disabled" { err = fmt.Errorf("`minimum_tls_version` cannot be removed once set, please set a valid value for this property") } return diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_virtual_machine_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_virtual_machine_resource.go index e3f0ec7665a..19c25b180b1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_virtual_machine_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/mssql_virtual_machine_resource.go @@ -7,16 +7,16 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" parseCompute "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" computeValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/helper" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -34,7 +34,7 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { CustomizeDiff: pluginsdk.CustomizeDiffShim(resourceMsSqlVirtualMachineCustomDiff), Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.SqlVirtualMachineID(id) + _, err := sqlvirtualmachines.ParseSqlVirtualMachineID(id) return err }), @@ -58,9 +58,9 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(sqlvirtualmachine.SQLServerLicenseTypePAYG), - string(sqlvirtualmachine.SQLServerLicenseTypeAHUB), - string(sqlvirtualmachine.SQLServerLicenseTypeDR), + string(sqlvirtualmachines.SqlServerLicenseTypePAYG), + string(sqlvirtualmachines.SqlServerLicenseTypeAHUB), + string(sqlvirtualmachines.SqlServerLicenseTypeDR), }, false), }, @@ -94,8 +94,8 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { Required: true, DiffSuppressFunc: suppress.CaseDifference, ValidateFunc: validation.StringInSlice([]string{ - string(sqlvirtualmachine.FullBackupFrequencyTypeDaily), - string(sqlvirtualmachine.FullBackupFrequencyTypeWeekly), + string(sqlvirtualmachines.FullBackupFrequencyTypeDaily), + string(sqlvirtualmachines.FullBackupFrequencyTypeWeekly), }, false), }, @@ -156,13 +156,13 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(sqlvirtualmachine.DayOfWeekMonday), - string(sqlvirtualmachine.DayOfWeekTuesday), - string(sqlvirtualmachine.DayOfWeekWednesday), - string(sqlvirtualmachine.DayOfWeekThursday), - string(sqlvirtualmachine.DayOfWeekFriday), - string(sqlvirtualmachine.DayOfWeekSaturday), - string(sqlvirtualmachine.DayOfWeekSunday), + string(sqlvirtualmachines.DayOfWeekMonday), + string(sqlvirtualmachines.DayOfWeekTuesday), + string(sqlvirtualmachines.DayOfWeekWednesday), + string(sqlvirtualmachines.DayOfWeekThursday), + string(sqlvirtualmachines.DayOfWeekFriday), + string(sqlvirtualmachines.DayOfWeekSaturday), + string(sqlvirtualmachines.DayOfWeekSunday), }, false), }, @@ -237,11 +237,11 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { "sql_connectivity_type": { Type: pluginsdk.TypeString, Optional: true, - Default: string(sqlvirtualmachine.ConnectivityTypePRIVATE), + Default: string(sqlvirtualmachines.ConnectivityTypePRIVATE), ValidateFunc: validation.StringInSlice([]string{ - string(sqlvirtualmachine.ConnectivityTypeLOCAL), - string(sqlvirtualmachine.ConnectivityTypePRIVATE), - string(sqlvirtualmachine.ConnectivityTypePUBLIC), + string(sqlvirtualmachines.ConnectivityTypeLOCAL), + string(sqlvirtualmachines.ConnectivityTypePRIVATE), + string(sqlvirtualmachines.ConnectivityTypePUBLIC), }, false), }, @@ -269,18 +269,18 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(sqlvirtualmachine.DiskConfigurationTypeNEW), - string(sqlvirtualmachine.DiskConfigurationTypeEXTEND), - string(sqlvirtualmachine.DiskConfigurationTypeADD), + string(sqlvirtualmachines.DiskConfigurationTypeNEW), + string(sqlvirtualmachines.DiskConfigurationTypeEXTEND), + string(sqlvirtualmachines.DiskConfigurationTypeADD), }, false), }, "storage_workload_type": { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(sqlvirtualmachine.SQLWorkloadTypeGENERAL), - string(sqlvirtualmachine.SQLWorkloadTypeOLTP), - string(sqlvirtualmachine.SQLWorkloadTypeDW), + string(sqlvirtualmachines.SqlWorkloadTypeGENERAL), + string(sqlvirtualmachines.SqlWorkloadTypeOLTP), + string(sqlvirtualmachines.SqlWorkloadTypeDW), }, false), }, "data_settings": helper.StorageSettingSchema(), @@ -290,7 +290,7 @@ func resourceMsSqlVirtualMachine() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -327,69 +327,61 @@ func resourceMsSqlVirtualMachineCreateUpdate(d *pluginsdk.ResourceData, meta int if err != nil { return err } - id := parse.NewSqlVirtualMachineID(vmId.SubscriptionId, vmId.ResourceGroup, vmId.Name) + id := sqlvirtualmachines.NewSqlVirtualMachineID(vmId.SubscriptionId, vmId.ResourceGroup, vmId.Name) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name, "*") + existing, err := client.Get(ctx, id, sqlvirtualmachines.GetOperationOptions{Expand: utils.String("*")}) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for present of existing Sql Virtual Machine (Sql Virtual Machine Name %q / Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for present of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_mssql_virtual_machine", id.ID()) } } // get location from vm - respvm, err := vmclient.Get(ctx, id.ResourceGroup, id.Name, "") + respvm, err := vmclient.Get(ctx, id.ResourceGroupName, id.SqlVirtualMachineName, "") if err != nil { - return fmt.Errorf("making Read request on Azure Virtual Machine %s: %+v", id.Name, err) + return fmt.Errorf("making Read request on Azure Virtual Machine %s: %+v", id.SqlVirtualMachineName, err) } if *respvm.Location == "" { - return fmt.Errorf("Location is empty from making Read request on Azure Virtual Machine %s: %+v", id.Name, err) + return fmt.Errorf("location is empty from making Read request on Azure Virtual Machine %s: %+v", id.SqlVirtualMachineName, err) } - parameters := sqlvirtualmachine.SQLVirtualMachine{ - Location: utils.String(*respvm.Location), - Properties: &sqlvirtualmachine.Properties{ - VirtualMachineResourceID: utils.String(d.Get("virtual_machine_id").(string)), - SQLServerLicenseType: sqlvirtualmachine.SQLServerLicenseType(d.Get("sql_license_type").(string)), - SQLManagement: sqlvirtualmachine.SQLManagementModeFull, + connectivityType := sqlvirtualmachines.ConnectivityType(d.Get("sql_connectivity_type").(string)) + sqlManagement := sqlvirtualmachines.SqlManagementModeFull + sqlServerLicenseType := sqlvirtualmachines.SqlServerLicenseType(d.Get("sql_license_type").(string)) + + parameters := sqlvirtualmachines.SqlVirtualMachine{ + Location: *respvm.Location, + Properties: &sqlvirtualmachines.SqlVirtualMachineProperties{ AutoBackupSettings: expandSqlVirtualMachineAutoBackupSettings(d.Get("auto_backup").([]interface{})), AutoPatchingSettings: expandSqlVirtualMachineAutoPatchingSettings(d.Get("auto_patching").([]interface{})), KeyVaultCredentialSettings: expandSqlVirtualMachineKeyVaultCredential(d.Get("key_vault_credential").([]interface{})), - ServerConfigurationsManagementSettings: &sqlvirtualmachine.ServerConfigurationsManagementSettings{ - AdditionalFeaturesServerConfigurations: &sqlvirtualmachine.AdditionalFeaturesServerConfigurations{ + ServerConfigurationsManagementSettings: &sqlvirtualmachines.ServerConfigurationsManagementSettings{ + AdditionalFeaturesServerConfigurations: &sqlvirtualmachines.AdditionalFeaturesServerConfigurations{ IsRServicesEnabled: utils.Bool(d.Get("r_services_enabled").(bool)), }, - SQLConnectivityUpdateSettings: &sqlvirtualmachine.SQLConnectivityUpdateSettings{ - Port: utils.Int32(int32(d.Get("sql_connectivity_port").(int))), - ConnectivityType: sqlvirtualmachine.ConnectivityType(d.Get("sql_connectivity_type").(string)), - SQLAuthUpdatePassword: utils.String(d.Get("sql_connectivity_update_password").(string)), - SQLAuthUpdateUserName: utils.String(d.Get("sql_connectivity_update_username").(string)), + SqlConnectivityUpdateSettings: &sqlvirtualmachines.SqlConnectivityUpdateSettings{ + ConnectivityType: &connectivityType, + Port: utils.Int64(int64(d.Get("sql_connectivity_port").(int))), + SqlAuthUpdatePassword: utils.String(d.Get("sql_connectivity_update_password").(string)), + SqlAuthUpdateUserName: utils.String(d.Get("sql_connectivity_update_username").(string)), }, }, + SqlManagement: &sqlManagement, + SqlServerLicenseType: &sqlServerLicenseType, StorageConfigurationSettings: expandSqlVirtualMachineStorageConfigurationSettings(d.Get("storage_configuration").([]interface{})), + VirtualMachineResourceId: utils.String(d.Get("virtual_machine_id").(string)), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, parameters) - if err != nil { - return fmt.Errorf("creating Sql Virtual Machine (Sql Virtual Machine Name %q / Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of Sql Virtual Machine (Sql Virtual Machine Name %q / Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - - resp, err := client.Get(ctx, id.ResourceGroup, id.Name, "*") - if err != nil { - return fmt.Errorf("retrieving Sql Virtual Machine (Sql Virtual Machine Name %q / Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - if resp.ID == nil { - return fmt.Errorf("Cannot read Sql Virtual Machine (Sql Virtual Machine Name %q / Resource Group %q) ID", id.Name, id.ResourceGroup) + if err := client.CreateOrUpdateThenPoll(ctx, id, parameters); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } d.SetId(id.ID()) @@ -417,6 +409,29 @@ func resourceMsSqlVirtualMachineCreateUpdate(d *pluginsdk.ResourceData, meta int } } + // Wait for the auto patching settings to take effect + // See: https://github.com/Azure/azure-rest-api-specs/issues/12818 + if autoPatching := d.Get("auto_patching"); (d.IsNewResource() && len(autoPatching.([]interface{})) > 0) || (!d.IsNewResource() && d.HasChange("auto_patching")) { + log.Printf("[DEBUG] Waiting for SQL Virtual Machine %q AutoPatchingSettings to take effect", d.Id()) + stateConf := &pluginsdk.StateChangeConf{ + Pending: []string{"Retry", "Pending"}, + Target: []string{"Updated"}, + Refresh: resourceMsSqlVirtualMachineAutoPatchingSettingsRefreshFunc(ctx, client, d), + MinTimeout: 1 * time.Minute, + ContinuousTargetOccurence: 2, + } + + if d.IsNewResource() { + stateConf.Timeout = d.Timeout(pluginsdk.TimeoutCreate) + } else { + stateConf.Timeout = d.Timeout(pluginsdk.TimeoutUpdate) + } + + if _, err := stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for SQL Virtual Machine %q AutoPatchingSettings to take effect: %+v", d.Id(), err) + } + } + return resourceMsSqlVirtualMachineRead(d, meta) } @@ -425,58 +440,64 @@ func resourceMsSqlVirtualMachineRead(d *pluginsdk.ResourceData, meta interface{} ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SqlVirtualMachineID(d.Id()) + id, err := sqlvirtualmachines.ParseSqlVirtualMachineID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name, "*") + resp, err := client.Get(ctx, *id, sqlvirtualmachines.GetOperationOptions{Expand: utils.String("*")}) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] Sql Virtual Machine %q does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("reading Sql Virtual Machine (Sql Virtual Machine Name %q / Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("reading %s: %+v", id, err) } - if props := resp.Properties; props != nil { - d.Set("virtual_machine_id", props.VirtualMachineResourceID) - d.Set("sql_license_type", string(props.SQLServerLicenseType)) - if err := d.Set("auto_backup", flattenSqlVirtualMachineAutoBackup(props.AutoBackupSettings, d)); err != nil { - return fmt.Errorf("setting `auto_backup`: %+v", err) - } + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { - if err := d.Set("auto_patching", flattenSqlVirtualMachineAutoPatching(props.AutoPatchingSettings)); err != nil { - return fmt.Errorf("setting `auto_patching`: %+v", err) - } + d.Set("virtual_machine_id", props.VirtualMachineResourceId) + d.Set("sql_license_type", string(*props.SqlServerLicenseType)) + if err := d.Set("auto_backup", flattenSqlVirtualMachineAutoBackup(props.AutoBackupSettings, d)); err != nil { + return fmt.Errorf("setting `auto_backup`: %+v", err) + } - if err := d.Set("key_vault_credential", flattenSqlVirtualMachineKeyVaultCredential(props.KeyVaultCredentialSettings, d)); err != nil { - return fmt.Errorf("setting `key_vault_credential`: %+v", err) - } + if err := d.Set("auto_patching", flattenSqlVirtualMachineAutoPatching(props.AutoPatchingSettings)); err != nil { + return fmt.Errorf("setting `auto_patching`: %+v", err) + } - if mgmtSettings := props.ServerConfigurationsManagementSettings; mgmtSettings != nil { - if cfgs := mgmtSettings.AdditionalFeaturesServerConfigurations; cfgs != nil { - d.Set("r_services_enabled", mgmtSettings.AdditionalFeaturesServerConfigurations.IsRServicesEnabled) + if err := d.Set("key_vault_credential", flattenSqlVirtualMachineKeyVaultCredential(props.KeyVaultCredentialSettings, d)); err != nil { + return fmt.Errorf("setting `key_vault_credential`: %+v", err) } - if scus := mgmtSettings.SQLConnectivityUpdateSettings; scus != nil { - d.Set("sql_connectivity_port", mgmtSettings.SQLConnectivityUpdateSettings.Port) - d.Set("sql_connectivity_type", mgmtSettings.SQLConnectivityUpdateSettings.ConnectivityType) + + if mgmtSettings := props.ServerConfigurationsManagementSettings; mgmtSettings != nil { + if cfgs := mgmtSettings.AdditionalFeaturesServerConfigurations; cfgs != nil { + d.Set("r_services_enabled", mgmtSettings.AdditionalFeaturesServerConfigurations.IsRServicesEnabled) + } + if scus := mgmtSettings.SqlConnectivityUpdateSettings; scus != nil { + d.Set("sql_connectivity_port", mgmtSettings.SqlConnectivityUpdateSettings.Port) + d.Set("sql_connectivity_type", mgmtSettings.SqlConnectivityUpdateSettings.ConnectivityType) + } } - } - // `storage_configuration.0.storage_workload_type` is in a different spot than the rest of the `storage_configuration` - // so we'll grab that here and pass it along - storageWorkloadType := "" - if props.ServerConfigurationsManagementSettings != nil && props.ServerConfigurationsManagementSettings.SQLWorkloadTypeUpdateSettings != nil { - storageWorkloadType = string(props.ServerConfigurationsManagementSettings.SQLWorkloadTypeUpdateSettings.SQLWorkloadType) - } + // `storage_configuration.0.storage_workload_type` is in a different spot than the rest of the `storage_configuration` + // so we'll grab that here and pass it along + storageWorkloadType := "" + if props.ServerConfigurationsManagementSettings != nil && props.ServerConfigurationsManagementSettings.SqlWorkloadTypeUpdateSettings != nil && props.ServerConfigurationsManagementSettings.SqlWorkloadTypeUpdateSettings.SqlWorkloadType != nil { + storageWorkloadType = string(*props.ServerConfigurationsManagementSettings.SqlWorkloadTypeUpdateSettings.SqlWorkloadType) + } - if err := d.Set("storage_configuration", flattenSqlVirtualMachineStorageConfigurationSettings(props.StorageConfigurationSettings, storageWorkloadType)); err != nil { - return fmt.Errorf("setting `storage_configuration`: %+v", err) + if err := d.Set("storage_configuration", flattenSqlVirtualMachineStorageConfigurationSettings(props.StorageConfigurationSettings, storageWorkloadType)); err != nil { + return fmt.Errorf("setting `storage_configuration`: %+v", err) + } + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceMsSqlVirtualMachineDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -484,98 +505,93 @@ func resourceMsSqlVirtualMachineDelete(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SqlVirtualMachineID(d.Id()) + id, err := sqlvirtualmachines.ParseSqlVirtualMachineID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { - return fmt.Errorf("deleting Sql Virtual Machine (Sql Virtual Machine Name %q / Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for deleting Sql Virtual Machine (Sql Virtual Machine Name %q / Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } -func resourceMsSqlVirtualMachineAutoBackupSettingsRefreshFunc(ctx context.Context, client *sqlvirtualmachine.SQLVirtualMachinesClient, d *pluginsdk.ResourceData) pluginsdk.StateRefreshFunc { +func resourceMsSqlVirtualMachineAutoBackupSettingsRefreshFunc(ctx context.Context, client *sqlvirtualmachines.SqlVirtualMachinesClient, d *pluginsdk.ResourceData) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - id, err := parse.SqlVirtualMachineID(d.Id()) + id, err := sqlvirtualmachines.ParseSqlVirtualMachineID(d.Id()) if err != nil { return nil, "Error", err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name, "*") + resp, err := client.Get(ctx, *id, sqlvirtualmachines.GetOperationOptions{Expand: utils.String("*")}) if err != nil { return nil, "Retry", err } - if props := resp.Properties; props != nil { - autoBackupSettings := flattenSqlVirtualMachineAutoBackup(props.AutoBackupSettings, d) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + autoBackupSettings := flattenSqlVirtualMachineAutoBackup(props.AutoBackupSettings, d) - if len(autoBackupSettings) == 0 { - // auto backup was nil or disabled in the response - if v, ok := d.GetOk("auto_backup"); !ok || len(v.([]interface{})) == 0 { - // also disabled in the config - return resp, "Updated", nil + if len(autoBackupSettings) == 0 { + // auto backup was nil or disabled in the response + if v, ok := d.GetOk("auto_backup"); !ok || len(v.([]interface{})) == 0 { + // also disabled in the config + return resp, "Updated", nil + } + return resp, "Pending", nil } - return resp, "Pending", nil - } - if v, ok := d.GetOk("auto_backup"); !ok || len(v.([]interface{})) == 0 { - // still waiting for it to be disabled - return resp, "Pending", nil - } + if v, ok := d.GetOk("auto_backup"); !ok || len(v.([]interface{})) == 0 { + // still waiting for it to be disabled + return resp, "Pending", nil + } - // check each property in the auto_backup block for drift - for prop, val := range autoBackupSettings[0].(map[string]interface{}) { - v := d.Get(fmt.Sprintf("auto_backup.0.%s", prop)) - switch prop { - case "manual_schedule": - if m := val.([]interface{}); len(m) > 0 { - if b, ok := d.GetOk("auto_backup.0.manual_schedule"); !ok || len(b.([]interface{})) == 0 { - // manual schedule disabled in config but still showing in response - return resp, "Pending", nil - } - // check each property in the manual_schedule block for drift - for prop2, val2 := range m[0].(map[string]interface{}) { - v2 := d.Get(fmt.Sprintf("auto_backup.0.manual_schedule.0.%s", prop2)) - switch prop2 { - case "full_backup_frequency": - if !strings.EqualFold(v2.(string), val2.(string)) { - return resp, "Pending", nil - } - default: - if v2 != val2 { - return resp, "Pending", nil + // check each property in the auto_backup block for drift + for prop, val := range autoBackupSettings[0].(map[string]interface{}) { + v := d.Get(fmt.Sprintf("auto_backup.0.%s", prop)) + switch prop { + case "manual_schedule": + if m := val.([]interface{}); len(m) > 0 { + if b, ok := d.GetOk("auto_backup.0.manual_schedule"); !ok || len(b.([]interface{})) == 0 { + // manual schedule disabled in config but still showing in response + return resp, "Pending", nil + } + // check each property in the manual_schedule block for drift + for prop2, val2 := range m[0].(map[string]interface{}) { + v2 := d.Get(fmt.Sprintf("auto_backup.0.manual_schedule.0.%s", prop2)) + switch prop2 { + case "full_backup_frequency": + if !strings.EqualFold(v2.(string), val2.(string)) { + return resp, "Pending", nil + } + default: + if v2 != val2 { + return resp, "Pending", nil + } } } + } else if b, ok := d.GetOk("auto_backup.0.manual_schedule"); ok || len(b.([]interface{})) > 0 { + // manual schedule set in config but not reflecting in response + return resp, "Pending", nil + } + default: + if v != val { + return resp, "Pending", nil } - } else if b, ok := d.GetOk("auto_backup.0.manual_schedule"); ok || len(b.([]interface{})) > 0 { - // manual schedule set in config but not reflecting in response - return resp, "Pending", nil - } - default: - if v != val { - return resp, "Pending", nil } } - } - return resp, "Updated", nil + return resp, "Updated", nil + } } return resp, "Retry", nil } } -func expandSqlVirtualMachineAutoBackupSettings(input []interface{}) *sqlvirtualmachine.AutoBackupSettings { - ret := sqlvirtualmachine.AutoBackupSettings{ +func expandSqlVirtualMachineAutoBackupSettings(input []interface{}) *sqlvirtualmachines.AutoBackupSettings { + ret := sqlvirtualmachines.AutoBackupSettings{ Enable: utils.Bool(false), } @@ -584,10 +600,10 @@ func expandSqlVirtualMachineAutoBackupSettings(input []interface{}) *sqlvirtualm ret.Enable = utils.Bool(true) if v, ok := config["retention_period_in_days"]; ok { - ret.RetentionPeriod = utils.Int32(int32(v.(int))) + ret.RetentionPeriod = utils.Int64(int64(v.(int))) } if v, ok := config["storage_blob_endpoint"]; ok { - ret.StorageAccountURL = utils.String(v.(string)) + ret.StorageAccountUrl = utils.String(v.(string)) } if v, ok := config["storage_account_access_key"]; ok { ret.StorageAccessKey = utils.String(v.(string)) @@ -604,22 +620,25 @@ func expandSqlVirtualMachineAutoBackupSettings(input []interface{}) *sqlvirtualm ret.BackupSystemDbs = utils.Bool(v.(bool)) } - ret.BackupScheduleType = sqlvirtualmachine.BackupScheduleTypeAutomated + backupScheduleTypeAutomated := sqlvirtualmachines.BackupScheduleTypeAutomated + ret.BackupScheduleType = &backupScheduleTypeAutomated if v, ok := config["manual_schedule"]; ok && len(v.([]interface{})) > 0 { manualSchedule := v.([]interface{})[0].(map[string]interface{}) - ret.BackupScheduleType = sqlvirtualmachine.BackupScheduleTypeManual + backupScheduleTypeManual := sqlvirtualmachines.BackupScheduleTypeManual + ret.BackupScheduleType = &backupScheduleTypeManual if v, ok := manualSchedule["full_backup_frequency"]; ok { - ret.FullBackupFrequency = sqlvirtualmachine.FullBackupFrequencyType(v.(string)) + fullBackupFrequencyType := sqlvirtualmachines.FullBackupFrequencyType(v.(string)) + ret.FullBackupFrequency = &fullBackupFrequencyType } if v, ok := manualSchedule["full_backup_start_hour"]; ok { - ret.FullBackupStartTime = utils.Int32(int32(v.(int))) + ret.FullBackupStartTime = utils.Int64(int64(v.(int))) } if v, ok := manualSchedule["full_backup_window_in_hours"]; ok { - ret.FullBackupWindowHours = utils.Int32(int32(v.(int))) + ret.FullBackupWindowHours = utils.Int64(int64(v.(int))) } if v, ok := manualSchedule["log_backup_frequency_in_minutes"]; ok { - ret.LogBackupFrequency = utils.Int32(int32(v.(int))) + ret.LogBackupFrequency = utils.Int64(int64(v.(int))) } } } @@ -627,13 +646,13 @@ func expandSqlVirtualMachineAutoBackupSettings(input []interface{}) *sqlvirtualm return &ret } -func flattenSqlVirtualMachineAutoBackup(autoBackup *sqlvirtualmachine.AutoBackupSettings, d *pluginsdk.ResourceData) []interface{} { +func flattenSqlVirtualMachineAutoBackup(autoBackup *sqlvirtualmachines.AutoBackupSettings, d *pluginsdk.ResourceData) []interface{} { if autoBackup == nil || autoBackup.Enable == nil || !*autoBackup.Enable { return []interface{}{} } manualSchedule := make([]interface{}, 0) - if strings.EqualFold(string(autoBackup.BackupScheduleType), string(sqlvirtualmachine.BackupScheduleTypeManual)) { + if autoBackup.BackupScheduleType != nil && strings.EqualFold(string(*autoBackup.BackupScheduleType), string(sqlvirtualmachines.BackupScheduleTypeManual)) { var fullBackupStartHour int if autoBackup.FullBackupStartTime != nil { fullBackupStartHour = int(*autoBackup.FullBackupStartTime) @@ -653,9 +672,14 @@ func flattenSqlVirtualMachineAutoBackup(autoBackup *sqlvirtualmachine.AutoBackup } } + var fullBackupFrequency string + if autoBackup.FullBackupFrequency != nil { + fullBackupFrequency = string(*autoBackup.FullBackupFrequency) + } + manualSchedule = []interface{}{ map[string]interface{}{ - "full_backup_frequency": string(autoBackup.FullBackupFrequency), + "full_backup_frequency": fullBackupFrequency, "full_backup_start_hour": fullBackupStartHour, "full_backup_window_in_hours": fullBackupWindowHours, "log_backup_frequency_in_minutes": logBackupFrequency, @@ -687,60 +711,109 @@ func flattenSqlVirtualMachineAutoBackup(autoBackup *sqlvirtualmachine.AutoBackup } } -func expandSqlVirtualMachineAutoPatchingSettings(input []interface{}) *sqlvirtualmachine.AutoPatchingSettings { +func resourceMsSqlVirtualMachineAutoPatchingSettingsRefreshFunc(ctx context.Context, client *sqlvirtualmachines.SqlVirtualMachinesClient, d *pluginsdk.ResourceData) pluginsdk.StateRefreshFunc { + return func() (interface{}, string, error) { + id, err := sqlvirtualmachines.ParseSqlVirtualMachineID(d.Id()) + if err != nil { + return nil, "Error", err + } + + resp, err := client.Get(ctx, *id, sqlvirtualmachines.GetOperationOptions{Expand: utils.String("*")}) + if err != nil { + return nil, "Retry", err + } + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + autoPatchingSettings := flattenSqlVirtualMachineAutoPatching(props.AutoPatchingSettings) + + if len(autoPatchingSettings) == 0 { + if v, ok := d.GetOk("auto_patching"); !ok || len(v.([]interface{})) == 0 { + return resp, "Updated", nil + } + return resp, "Pending", nil + } + + if v, ok := d.GetOk("auto_patching"); !ok || len(v.([]interface{})) == 0 { + return resp, "Pending", nil + } + + for prop, val := range autoPatchingSettings[0].(map[string]interface{}) { + v := d.Get(fmt.Sprintf("auto_patching.0.%s", prop)) + if v != val { + return resp, "Pending", nil + } + } + + return resp, "Updated", nil + } + } + + return resp, "Retry", nil + } +} + +func expandSqlVirtualMachineAutoPatchingSettings(input []interface{}) *sqlvirtualmachines.AutoPatchingSettings { if len(input) == 0 { return nil } autoPatchingSetting := input[0].(map[string]interface{}) - return &sqlvirtualmachine.AutoPatchingSettings{ + dayOfWeek := sqlvirtualmachines.DayOfWeek(autoPatchingSetting["day_of_week"].(string)) + + return &sqlvirtualmachines.AutoPatchingSettings{ Enable: utils.Bool(true), - MaintenanceWindowDuration: utils.Int32(int32(autoPatchingSetting["maintenance_window_duration_in_minutes"].(int))), - MaintenanceWindowStartingHour: utils.Int32(int32(autoPatchingSetting["maintenance_window_starting_hour"].(int))), - DayOfWeek: sqlvirtualmachine.DayOfWeek(autoPatchingSetting["day_of_week"].(string)), + MaintenanceWindowDuration: utils.Int64(int64(autoPatchingSetting["maintenance_window_duration_in_minutes"].(int))), + MaintenanceWindowStartingHour: utils.Int64(int64(autoPatchingSetting["maintenance_window_starting_hour"].(int))), + DayOfWeek: &dayOfWeek, } } -func flattenSqlVirtualMachineAutoPatching(autoPatching *sqlvirtualmachine.AutoPatchingSettings) []interface{} { +func flattenSqlVirtualMachineAutoPatching(autoPatching *sqlvirtualmachines.AutoPatchingSettings) []interface{} { if autoPatching == nil || autoPatching.Enable == nil || !*autoPatching.Enable { return []interface{}{} } - var startHour int32 + var startHour int if autoPatching.MaintenanceWindowStartingHour != nil { - startHour = *autoPatching.MaintenanceWindowStartingHour + startHour = int(*autoPatching.MaintenanceWindowStartingHour) } - var duration int32 + var duration int if autoPatching.MaintenanceWindowDuration != nil { - duration = *autoPatching.MaintenanceWindowDuration + duration = int(*autoPatching.MaintenanceWindowDuration) + } + + var dayOfWeek string + if autoPatching.DayOfWeek != nil { + dayOfWeek = string(*autoPatching.DayOfWeek) } return []interface{}{ map[string]interface{}{ - "day_of_week": string(autoPatching.DayOfWeek), + "day_of_week": dayOfWeek, "maintenance_window_starting_hour": startHour, "maintenance_window_duration_in_minutes": duration, }, } } -func expandSqlVirtualMachineKeyVaultCredential(input []interface{}) *sqlvirtualmachine.KeyVaultCredentialSettings { +func expandSqlVirtualMachineKeyVaultCredential(input []interface{}) *sqlvirtualmachines.KeyVaultCredentialSettings { if len(input) == 0 { return nil } keyVaultCredentialSetting := input[0].(map[string]interface{}) - return &sqlvirtualmachine.KeyVaultCredentialSettings{ + return &sqlvirtualmachines.KeyVaultCredentialSettings{ Enable: utils.Bool(true), CredentialName: utils.String(keyVaultCredentialSetting["name"].(string)), - AzureKeyVaultURL: utils.String(keyVaultCredentialSetting["key_vault_url"].(string)), + AzureKeyVaultUrl: utils.String(keyVaultCredentialSetting["key_vault_url"].(string)), ServicePrincipalName: utils.String(keyVaultCredentialSetting["service_principal_name"].(string)), ServicePrincipalSecret: utils.String(keyVaultCredentialSetting["service_principal_secret"].(string)), } } -func flattenSqlVirtualMachineKeyVaultCredential(keyVault *sqlvirtualmachine.KeyVaultCredentialSettings, d *pluginsdk.ResourceData) []interface{} { +func flattenSqlVirtualMachineKeyVaultCredential(keyVault *sqlvirtualmachines.KeyVaultCredentialSettings, d *pluginsdk.ResourceData) []interface{} { if keyVault == nil || keyVault.Enable == nil || !*keyVault.Enable { return []interface{}{} } @@ -786,32 +859,40 @@ func mssqlVMCredentialNameDiffSuppressFunc(_, old, new string, _ *pluginsdk.Reso return false } -func expandSqlVirtualMachineStorageConfigurationSettings(input []interface{}) *sqlvirtualmachine.StorageConfigurationSettings { +func expandSqlVirtualMachineStorageConfigurationSettings(input []interface{}) *sqlvirtualmachines.StorageConfigurationSettings { if len(input) == 0 || input[0] == nil { return nil } storageSettings := input[0].(map[string]interface{}) - return &sqlvirtualmachine.StorageConfigurationSettings{ - DiskConfigurationType: sqlvirtualmachine.DiskConfigurationType(storageSettings["disk_type"].(string)), - StorageWorkloadType: sqlvirtualmachine.StorageWorkloadType(storageSettings["storage_workload_type"].(string)), - SQLDataSettings: expandSqlVirtualMachineDataStorageSettings(storageSettings["data_settings"].([]interface{})), - SQLLogSettings: expandSqlVirtualMachineDataStorageSettings(storageSettings["log_settings"].([]interface{})), - SQLTempDbSettings: expandSqlVirtualMachineTempDbSettings(storageSettings["temp_db_settings"].([]interface{})), + diskConfigurationType := sqlvirtualmachines.DiskConfigurationType(storageSettings["disk_type"].(string)) + storageWorkloadType := sqlvirtualmachines.StorageWorkloadType(storageSettings["storage_workload_type"].(string)) + + return &sqlvirtualmachines.StorageConfigurationSettings{ + DiskConfigurationType: &diskConfigurationType, + StorageWorkloadType: &storageWorkloadType, + SqlDataSettings: expandSqlVirtualMachineDataStorageSettings(storageSettings["data_settings"].([]interface{})), + SqlLogSettings: expandSqlVirtualMachineDataStorageSettings(storageSettings["log_settings"].([]interface{})), + SqlTempDbSettings: expandSqlVirtualMachineTempDbSettings(storageSettings["temp_db_settings"].([]interface{})), } } -func flattenSqlVirtualMachineStorageConfigurationSettings(input *sqlvirtualmachine.StorageConfigurationSettings, storageWorkloadType string) []interface{} { +func flattenSqlVirtualMachineStorageConfigurationSettings(input *sqlvirtualmachines.StorageConfigurationSettings, storageWorkloadType string) []interface{} { if input == nil { return []interface{}{} } + var diskType string + if input.DiskConfigurationType != nil { + diskType = string(*input.DiskConfigurationType) + } + output := map[string]interface{}{ "storage_workload_type": storageWorkloadType, - "disk_type": string(input.DiskConfigurationType), - "data_settings": flattenSqlVirtualMachineStorageSettings(input.SQLDataSettings), - "log_settings": flattenSqlVirtualMachineStorageSettings(input.SQLLogSettings), - "temp_db_settings": flattenSqlVirtualMachineTempDbSettings(input.SQLTempDbSettings), + "disk_type": diskType, + "data_settings": flattenSqlVirtualMachineStorageSettings(input.SqlDataSettings), + "log_settings": flattenSqlVirtualMachineStorageSettings(input.SqlLogSettings), + "temp_db_settings": flattenSqlVirtualMachineTempDbSettings(input.SqlTempDbSettings), } if output["storage_workload_type"].(string) == "" && output["disk_type"] == "" && @@ -824,30 +905,30 @@ func flattenSqlVirtualMachineStorageConfigurationSettings(input *sqlvirtualmachi return []interface{}{output} } -func expandSqlVirtualMachineDataStorageSettings(input []interface{}) *sqlvirtualmachine.SQLStorageSettings { +func expandSqlVirtualMachineDataStorageSettings(input []interface{}) *sqlvirtualmachines.SQLStorageSettings { if len(input) == 0 || input[0] == nil { return nil } dataStorageSettings := input[0].(map[string]interface{}) - return &sqlvirtualmachine.SQLStorageSettings{ + return &sqlvirtualmachines.SQLStorageSettings{ Luns: expandSqlVirtualMachineStorageSettingsLuns(dataStorageSettings["luns"].([]interface{})), DefaultFilePath: utils.String(dataStorageSettings["default_file_path"].(string)), } } -func expandSqlVirtualMachineStorageSettingsLuns(input []interface{}) *[]int32 { - expandedLuns := make([]int32, 0) +func expandSqlVirtualMachineStorageSettingsLuns(input []interface{}) *[]int64 { + expandedLuns := make([]int64, 0) for i := range input { if input[i] != nil { - expandedLuns = append(expandedLuns, int32(input[i].(int))) + expandedLuns = append(expandedLuns, int64(input[i].(int))) } } return &expandedLuns } -func flattenSqlVirtualMachineStorageSettings(input *sqlvirtualmachine.SQLStorageSettings) []interface{} { +func flattenSqlVirtualMachineStorageSettings(input *sqlvirtualmachines.SQLStorageSettings) []interface{} { if input == nil || input.Luns == nil { return []interface{}{} } @@ -864,19 +945,19 @@ func flattenSqlVirtualMachineStorageSettings(input *sqlvirtualmachine.SQLStorage return []interface{}{attrs} } -func expandSqlVirtualMachineTempDbSettings(input []interface{}) *sqlvirtualmachine.SQLTempDbSettings { +func expandSqlVirtualMachineTempDbSettings(input []interface{}) *sqlvirtualmachines.SQLTempDbSettings { if len(input) == 0 || input[0] == nil { return nil } dataStorageSettings := input[0].(map[string]interface{}) - return &sqlvirtualmachine.SQLTempDbSettings{ + return &sqlvirtualmachines.SQLTempDbSettings{ Luns: expandSqlVirtualMachineStorageSettingsLuns(dataStorageSettings["luns"].([]interface{})), DefaultFilePath: utils.String(dataStorageSettings["default_file_path"].(string)), } } -func flattenSqlVirtualMachineTempDbSettings(input *sqlvirtualmachine.SQLTempDbSettings) []interface{} { +func flattenSqlVirtualMachineTempDbSettings(input *sqlvirtualmachines.SQLTempDbSettings) []interface{} { if input == nil || input.Luns == nil { return []interface{}{} } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/mysql_flexible_server_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/mysql_flexible_server_data_source.go index 17f1e4f8898..12849d083ec 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/mysql_flexible_server_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/mysql_flexible_server_data_source.go @@ -173,7 +173,7 @@ func dataSourceMysqlFlexibleServerRead(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := parse.NewFlexibleServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) resp, err := client.Get(ctx, id.ResourceGroup, id.Name) if err != nil { if utils.ResponseWasNotFound(resp.Response) { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/mysql_flexible_server_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/mysql_flexible_server_resource.go index 8ae870efe8d..0e64cd1fa2a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/mysql_flexible_server_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/mysql_flexible_server_resource.go @@ -10,13 +10,13 @@ import ( "github.com/Azure/go-autorest/autorest/date" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/validate" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/client/client.go index 16c7c10fbee..8ff393abbfa 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/client/client.go @@ -1,39 +1,49 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - AccountClient *netapp.AccountsClient - PoolClient *netapp.PoolsClient - VolumeClient *netapp.VolumesClient - SnapshotClient *netapp.SnapshotsClient - SnapshotPoliciesClient *netapp.SnapshotPoliciesClient + AccountClient *netappaccounts.NetAppAccountsClient + PoolClient *capacitypools.CapacityPoolsClient + VolumeClient *volumes.VolumesClient + VolumeReplicationClient *volumesreplication.VolumesReplicationClient + SnapshotClient *snapshots.SnapshotsClient + SnapshotPoliciesClient *snapshotpolicy.SnapshotPolicyClient } func NewClient(o *common.ClientOptions) *Client { - accountClient := netapp.NewAccountsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + accountClient := netappaccounts.NewNetAppAccountsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&accountClient.Client, o.ResourceManagerAuthorizer) - poolClient := netapp.NewPoolsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + poolClient := capacitypools.NewCapacityPoolsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&poolClient.Client, o.ResourceManagerAuthorizer) - volumeClient := netapp.NewVolumesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + volumeClient := volumes.NewVolumesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&volumeClient.Client, o.ResourceManagerAuthorizer) - snapshotClient := netapp.NewSnapshotsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + volumeReplicationClient := volumesreplication.NewVolumesReplicationClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&volumeReplicationClient.Client, o.ResourceManagerAuthorizer) + + snapshotClient := snapshots.NewSnapshotsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&snapshotClient.Client, o.ResourceManagerAuthorizer) - snapshotPoliciesClient := netapp.NewSnapshotPoliciesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + snapshotPoliciesClient := snapshotpolicy.NewSnapshotPolicyClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&snapshotPoliciesClient.Client, o.ResourceManagerAuthorizer) return &Client{ - AccountClient: &accountClient, - PoolClient: &poolClient, - VolumeClient: &volumeClient, - SnapshotClient: &snapshotClient, - SnapshotPoliciesClient: &snapshotPoliciesClient, + AccountClient: &accountClient, + PoolClient: &poolClient, + VolumeClient: &volumeClient, + VolumeReplicationClient: &volumeReplicationClient, + SnapshotClient: &snapshotClient, + SnapshotPoliciesClient: &snapshotPoliciesClient, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_account_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_account_data_source.go index 7b4012061bf..27699a8203b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_account_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_account_data_source.go @@ -4,14 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceNetAppAccount() *pluginsdk.Resource { @@ -44,10 +44,10 @@ func dataSourceNetAppAccountRead(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName) + id := netappaccounts.NewNetAppAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.AccountsGet(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } @@ -55,10 +55,13 @@ func dataSourceNetAppAccountRead(d *pluginsdk.ResourceData, meta interface{}) er } d.SetId(id.ID()) - d.Set("name", id.NetAppAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.AccountName) + d.Set("resource_group_name", id.ResourceGroupName) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) + + } return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_account_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_account_resource.go index 4dc362e895b..ab1ab8e2cc9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_account_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_account_resource.go @@ -9,14 +9,15 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" netAppValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -37,7 +38,7 @@ func resourceNetAppAccount() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.AccountID(id) + _, err := netappaccounts.ParseNetAppAccountID(id) return err }), @@ -102,7 +103,7 @@ func resourceNetAppAccount() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -113,37 +114,30 @@ func resourceNetAppAccountCreate(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := netappaccounts.NewNetAppAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName) + existing, err := client.AccountsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_netapp_account", id.ID()) } } - location := azure.NormalizeLocation(d.Get("location").(string)) - activeDirectories := d.Get("active_directory").([]interface{}) - - accountParameters := netapp.Account{ - Location: utils.String(location), - AccountProperties: &netapp.AccountProperties{ - ActiveDirectories: expandNetAppActiveDirectories(activeDirectories), + accountParameters := netappaccounts.NetAppAccount{ + Location: azure.NormalizeLocation(d.Get("location").(string)), + Properties: &netappaccounts.AccountProperties{ + ActiveDirectories: expandNetAppActiveDirectories(d.Get("active_directory").([]interface{})), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.CreateOrUpdate(ctx, accountParameters, id.ResourceGroup, id.NetAppAccountName) - if err != nil { + if err := client.AccountsCreateOrUpdateThenPoll(ctx, id, accountParameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the creation of %s: %+v", id, err) - } // Wait for account to complete create if err := waitForAccountCreateOrUpdate(ctx, client, id); err != nil { @@ -159,21 +153,21 @@ func resourceNetAppAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AccountID(d.Id()) + id, err := netappaccounts.ParseNetAppAccountID(d.Id()) if err != nil { return err } shouldUpdate := false - update := netapp.AccountPatch{ - AccountProperties: &netapp.AccountProperties{}, + update := netappaccounts.NetAppAccountPatch{ + Properties: &netappaccounts.AccountProperties{}, } if d.HasChange("active_directory") { shouldUpdate = true activeDirectoriesRaw := d.Get("active_directory").([]interface{}) activeDirectories := expandNetAppActiveDirectories(activeDirectoriesRaw) - update.AccountProperties.ActiveDirectories = activeDirectories + update.Properties.ActiveDirectories = activeDirectories } if d.HasChange("tags") { @@ -183,16 +177,12 @@ func resourceNetAppAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) er } if shouldUpdate { - future, err := client.Update(ctx, update, id.ResourceGroup, id.NetAppAccountName) - if err != nil { - return fmt.Errorf("updating Account %q: %+v", id.NetAppAccountName, err) - } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the update of %s: %+v", id, err) + if err = client.AccountsUpdateThenPoll(ctx, *id, update); err != nil { + return fmt.Errorf("updating %s: %+v", id.ID(), err) } // Wait for account to complete update - if err := waitForAccountCreateOrUpdate(ctx, client, *id); err != nil { + if err = waitForAccountCreateOrUpdate(ctx, client, *id); err != nil { return err } } @@ -205,14 +195,14 @@ func resourceNetAppAccountRead(d *pluginsdk.ResourceData, meta interface{}) erro ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AccountID(d.Id()) + id, err := netappaccounts.ParseNetAppAccountID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName) + resp, err := client.AccountsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil @@ -220,14 +210,16 @@ func resourceNetAppAccountRead(d *pluginsdk.ResourceData, meta interface{}) erro return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.NetAppAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.AccountName) + d.Set("resource_group_name", id.ResourceGroupName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceNetAppAccountDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -235,30 +227,26 @@ func resourceNetAppAccountDelete(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AccountID(d.Id()) + id, err := netappaccounts.ParseNetAppAccountID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.NetAppAccountName) - if err != nil { + if err := client.AccountsDeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } return nil } -func expandNetAppActiveDirectories(input []interface{}) *[]netapp.ActiveDirectory { - results := make([]netapp.ActiveDirectory, 0) +func expandNetAppActiveDirectories(input []interface{}) *[]netappaccounts.ActiveDirectory { + results := make([]netappaccounts.ActiveDirectory, 0) for _, item := range input { v := item.(map[string]interface{}) dns := strings.Join(*utils.ExpandStringSlice(v["dns_servers"].([]interface{})), ",") - result := netapp.ActiveDirectory{ - DNS: utils.String(dns), + result := netappaccounts.ActiveDirectory{ + Dns: utils.String(dns), Domain: utils.String(v["domain"].(string)), OrganizationalUnit: utils.String(v["organizational_unit"].(string)), Password: utils.String(v["password"].(string)), @@ -271,7 +259,7 @@ func expandNetAppActiveDirectories(input []interface{}) *[]netapp.ActiveDirector return &results } -func waitForAccountCreateOrUpdate(ctx context.Context, client *netapp.AccountsClient, id parse.AccountId) error { +func waitForAccountCreateOrUpdate(ctx context.Context, client *netappaccounts.NetAppAccountsClient, id netappaccounts.NetAppAccountId) error { deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") @@ -293,15 +281,15 @@ func waitForAccountCreateOrUpdate(ctx context.Context, client *netapp.AccountsCl return nil } -func netappAccountStateRefreshFunc(ctx context.Context, client *netapp.AccountsClient, id parse.AccountId) pluginsdk.StateRefreshFunc { +func netappAccountStateRefreshFunc(ctx context.Context, client *netappaccounts.NetAppAccountsClient, id netappaccounts.NetAppAccountId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName) + res, err := client.AccountsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(res.Response) { - return nil, "", fmt.Errorf("retrieving NetApp Account %q (Resource Group %q): %s", id.NetAppAccountName, id.ResourceGroup, err) + if !response.WasNotFound(res.HttpResponse) { + return nil, "", fmt.Errorf("retrieving %s: %s", id.ID(), err) } } - return res, strconv.Itoa(res.StatusCode), nil + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_pool_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_pool_data_source.go index f5d2dde7fc1..28972ab23ba 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_pool_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_pool_data_source.go @@ -4,14 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceNetAppPool() *pluginsdk.Resource { @@ -58,10 +58,10 @@ func dataSourceNetAppPoolRead(d *pluginsdk.ResourceData, meta interface{}) error defer cancel() subscriptionId := meta.(*clients.Client).Account.SubscriptionId - id := parse.NewCapacityPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + id := capacitypools.NewCapacityPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + resp, err := client.PoolsGet(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } @@ -69,17 +69,14 @@ func dataSourceNetAppPoolRead(d *pluginsdk.ResourceData, meta interface{}) error } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("account_name", id.NetAppAccountName) - d.Set("resource_group_name", id.ResourceGroup) - - d.Set("location", location.NormalizeNilable(resp.Location)) - - if poolProperties := resp.PoolProperties; poolProperties != nil { - d.Set("service_level", string(poolProperties.ServiceLevel)) - if poolProperties.Size != nil { - d.Set("size_in_tb", *poolProperties.Size/1099511627776) - } + d.Set("name", id.PoolName) + d.Set("account_name", id.AccountName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) + d.Set("service_level", string(model.Properties.ServiceLevel)) + d.Set("size_in_tb", model.Properties.Size/1099511627776) } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_pool_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_pool_resource.go index 944ee8063cb..1c8839e7fdd 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_pool_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_pool_resource.go @@ -7,13 +7,14 @@ import ( "strconv" "time" - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -34,7 +35,7 @@ func resourceNetAppPool() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.CapacityPoolID(id) + _, err := capacitypools.ParseCapacityPoolID(id) return err }), @@ -62,9 +63,9 @@ func resourceNetAppPool() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(netapp.ServiceLevelPremium), - string(netapp.ServiceLevelStandard), - string(netapp.ServiceLevelUltra), + string(capacitypools.ServiceLevelPremium), + string(capacitypools.ServiceLevelStandard), + string(capacitypools.ServiceLevelUltra), }, false), }, @@ -79,12 +80,12 @@ func resourceNetAppPool() *pluginsdk.Resource { Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{ - string(netapp.QosTypeAuto), - string(netapp.QosTypeManual), + string(capacitypools.QosTypeAuto), + string(capacitypools.QosTypeManual), }, false), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -95,47 +96,42 @@ func resourceNetAppPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewCapacityPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + id := capacitypools.NewCapacityPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + existing, err := client.PoolsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_netapp_pool", id.ID()) } } - location := azure.NormalizeLocation(d.Get("location").(string)) - serviceLevel := d.Get("service_level").(string) sizeInTB := int64(d.Get("size_in_tb").(int)) sizeInMB := sizeInTB * 1024 * 1024 sizeInBytes := sizeInMB * 1024 * 1024 - capacityPoolParameters := netapp.CapacityPool{ - Location: utils.String(location), - PoolProperties: &netapp.PoolProperties{ - ServiceLevel: netapp.ServiceLevel(serviceLevel), - Size: utils.Int64(sizeInBytes), + capacityPoolParameters := capacitypools.CapacityPool{ + Location: azure.NormalizeLocation(d.Get("location").(string)), + Properties: capacitypools.PoolProperties{ + ServiceLevel: capacitypools.ServiceLevel(d.Get("service_level").(string)), + Size: sizeInBytes, }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } if qosType, ok := d.GetOk("qos_type"); ok { - capacityPoolParameters.PoolProperties.QosType = netapp.QosType(qosType.(string)) + qos := capacitypools.QosType(qosType.(string)) + capacityPoolParameters.Properties.QosType = &qos } - future, err := client.CreateOrUpdate(ctx, capacityPoolParameters, id.ResourceGroup, id.NetAppAccountName, id.Name) - if err != nil { + if err := client.PoolsCreateOrUpdateThenPoll(ctx, id, capacityPoolParameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - // Wait for pool to complete update + // Wait for pool to complete create if err := waitForPoolCreateOrUpdate(ctx, client, id); err != nil { return err } @@ -149,14 +145,14 @@ func resourceNetAppPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CapacityPoolID(d.Id()) + id, err := capacitypools.ParseCapacityPoolID(d.Id()) if err != nil { return err } shouldUpdate := false - update := netapp.CapacityPoolPatch{ - PoolPatchProperties: &netapp.PoolPatchProperties{}, + update := capacitypools.CapacityPoolPatch{ + Properties: &capacitypools.PoolPatchProperties{}, } if d.HasChange("size_in_tb") { @@ -166,13 +162,13 @@ func resourceNetAppPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error sizeInMB := sizeInTB * 1024 * 1024 sizeInBytes := sizeInMB * 1024 * 1024 - update.PoolPatchProperties.Size = utils.Int64(sizeInBytes) + update.Properties.Size = utils.Int64(sizeInBytes) } if d.HasChange("qos_type") { shouldUpdate = true - qosType := d.Get("qos_type") - update.PoolPatchProperties.QosType = netapp.QosType(qosType.(string)) + qosType := capacitypools.QosType(d.Get("qos_type").(string)) + update.Properties.QosType = &qosType } if d.HasChange("tags") { @@ -182,16 +178,12 @@ func resourceNetAppPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error } if shouldUpdate { - future, err := client.Update(ctx, update, id.ResourceGroup, id.NetAppAccountName, id.Name) - if err != nil { - return fmt.Errorf("updating Capacity Pool %q: %+v", id.Name, err) - } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the update of %s: %+v", id, err) + if err = client.PoolsUpdateThenPoll(ctx, *id, update); err != nil { + return fmt.Errorf("updating %s: %+v", id.ID(), err) } // Wait for pool to complete update - if err := waitForPoolCreateOrUpdate(ctx, client, *id); err != nil { + if err = waitForPoolCreateOrUpdate(ctx, client, *id); err != nil { return err } } @@ -204,14 +196,14 @@ func resourceNetAppPoolRead(d *pluginsdk.ResourceData, meta interface{}) error { ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CapacityPoolID(d.Id()) + id, err := capacitypools.ParseCapacityPoolID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + resp, err := client.PoolsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil @@ -219,26 +211,31 @@ func resourceNetAppPoolRead(d *pluginsdk.ResourceData, meta interface{}) error { return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("account_name", id.NetAppAccountName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } - if poolProperties := resp.PoolProperties; poolProperties != nil { + d.Set("name", id.PoolName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("account_name", id.AccountName) + + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) + + poolProperties := model.Properties d.Set("service_level", poolProperties.ServiceLevel) sizeInTB := int64(0) - if poolProperties.Size != nil { - sizeInBytes := *poolProperties.Size - sizeInMB := sizeInBytes / 1024 / 1024 - sizeInTB = sizeInMB / 1024 / 1024 - } + sizeInBytes := poolProperties.Size + sizeInMB := sizeInBytes / 1024 / 1024 + sizeInTB = sizeInMB / 1024 / 1024 d.Set("size_in_tb", int(sizeInTB)) - d.Set("qos_type", string(poolProperties.QosType)) + qosType := "" + if poolProperties.QosType != nil { + qosType = string(*poolProperties.QosType) + } + d.Set("qos_type", qosType) + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceNetAppPoolDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -246,18 +243,14 @@ func resourceNetAppPoolDelete(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CapacityPoolID(d.Id()) + id, err := capacitypools.ParseCapacityPoolID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) - if err != nil { + if err := client.PoolsDeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %q: %+v", id, err) - } // The resource NetApp Pool depends on the resource NetApp Account. // Although the delete API returns 404 which means the NetApp Pool resource has been deleted. @@ -286,20 +279,20 @@ func resourceNetAppPoolDelete(d *pluginsdk.ResourceData, meta interface{}) error return nil } -func netappPoolDeleteStateRefreshFunc(ctx context.Context, client *netapp.PoolsClient, id parse.CapacityPoolId) pluginsdk.StateRefreshFunc { +func netappPoolDeleteStateRefreshFunc(ctx context.Context, client *capacitypools.CapacityPoolsClient, id capacitypools.CapacityPoolId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + res, err := client.PoolsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(res.Response) { + if !response.WasNotFound(res.HttpResponse) { return nil, "", fmt.Errorf("retrieving %s: %+v", id, err) } } - return res, strconv.Itoa(res.StatusCode), nil + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil } } -func waitForPoolCreateOrUpdate(ctx context.Context, client *netapp.PoolsClient, id parse.CapacityPoolId) error { +func waitForPoolCreateOrUpdate(ctx context.Context, client *capacitypools.CapacityPoolsClient, id capacitypools.CapacityPoolId) error { deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") @@ -321,15 +314,15 @@ func waitForPoolCreateOrUpdate(ctx context.Context, client *netapp.PoolsClient, return nil } -func netappPoolStateRefreshFunc(ctx context.Context, client *netapp.PoolsClient, id parse.CapacityPoolId) pluginsdk.StateRefreshFunc { +func netappPoolStateRefreshFunc(ctx context.Context, client *capacitypools.CapacityPoolsClient, id capacitypools.CapacityPoolId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + res, err := client.PoolsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(res.Response) { - return nil, "", fmt.Errorf("retrieving NetApp Capacity Pool %q (Resource Group %q): %s", id.Name, id.ResourceGroup, err) + if !response.WasNotFound(res.HttpResponse) { + return nil, "", fmt.Errorf("retrieving %s: %s", id.ID(), err) } } - return res, strconv.Itoa(res.StatusCode), nil + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_data_source.go index 306338ab390..e5f7e540f7c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_data_source.go @@ -4,14 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceNetAppSnapshot() *pluginsdk.Resource { @@ -60,23 +60,25 @@ func dataSourceNetAppSnapshotRead(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewSnapshotID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("volume_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.Name) + id := snapshots.NewSnapshotID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("volume_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("account_name", id.NetAppAccountName) - d.Set("pool_name", id.CapacityPoolName) + d.Set("name", id.SnapshotName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("account_name", id.AccountName) + d.Set("pool_name", id.PoolName) d.Set("volume_name", id.VolumeName) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) + } return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_policy_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_policy_data_source.go index 5e449469091..227a1d90e9a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_policy_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_policy_data_source.go @@ -4,15 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceNetAppSnapshotPolicy() *pluginsdk.Resource { @@ -159,10 +159,10 @@ func dataSourceNetAppSnapshotPolicyRead(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewSnapshotPolicyID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + id := snapshotpolicy.NewSnapshotPoliciesID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + resp, err := client.SnapshotPoliciesGet(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) @@ -170,13 +170,14 @@ func dataSourceNetAppSnapshotPolicyRead(d *pluginsdk.ResourceData, meta interfac d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("account_name", id.NetAppAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.SnapshotPolicyName) + d.Set("account_name", id.AccountName) + d.Set("resource_group_name", id.ResourceGroupName) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) - if props := resp.SnapshotPolicyProperties; props != nil { + props := model.Properties d.Set("enabled", props.Enabled) if err := d.Set("hourly_schedule", flattenNetAppVolumeSnapshotPolicyHourlySchedule(props.HourlySchedule)); err != nil { return fmt.Errorf("setting `hourly_schedule`: %+v", err) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_policy_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_policy_resource.go index 78c363e8bc0..13e39b898c3 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_policy_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_policy_resource.go @@ -8,13 +8,14 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" netAppValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -35,7 +36,7 @@ func resourceNetAppSnapshotPolicy() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.SnapshotPolicyID(id) + _, err := snapshotpolicy.ParseSnapshotPoliciesID(id) return err }), @@ -189,68 +190,50 @@ func resourceNetAppSnapshotPolicy() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } func resourceNetAppSnapshotPolicyCreate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).NetApp.SnapshotPoliciesClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - resourceGroup := d.Get("resource_group_name").(string) - accountName := d.Get("account_name").(string) + id := snapshotpolicy.NewSnapshotPoliciesID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, resourceGroup, accountName, name) + existing, err := client.SnapshotPoliciesGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing NetApp SnapshotPolicy %q (Resource Group %q): %+v", name, resourceGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id.ID(), err) } } - if existing.ID != nil && *existing.ID != "" { - return tf.ImportAsExistsError("azurerm_netapp_snapshot_policy", *existing.ID) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_netapp_snapshot_policy", id.ID()) } } - location := azure.NormalizeLocation(d.Get("location").(string)) - - enabled := d.Get("enabled").(bool) - - hourlyScheduleRaw := d.Get("hourly_schedule").([]interface{}) - hourlySchedule := expandNetAppSnapshotPolicyHourlySchedule(hourlyScheduleRaw) - - dailyScheduleRaw := d.Get("daily_schedule").([]interface{}) - dailySchedule := expandNetAppSnapshotPolicyDailySchedule(dailyScheduleRaw) - - weeklyScheduleRaw := d.Get("weekly_schedule").([]interface{}) - weeklySchedule := expandNetAppSnapshotPolicyWeeklySchedule(weeklyScheduleRaw) - - monthlyScheduleRaw := d.Get("monthly_schedule").([]interface{}) - monthlySchedule := expandNetAppSnapshotPolicyMonthlySchedule(monthlyScheduleRaw) - - parameters := netapp.SnapshotPolicy{ - Location: utils.String(location), - Name: utils.String(name), - SnapshotPolicyProperties: &netapp.SnapshotPolicyProperties{ - HourlySchedule: hourlySchedule, - DailySchedule: dailySchedule, - WeeklySchedule: weeklySchedule, - MonthlySchedule: monthlySchedule, - Enabled: utils.Bool(enabled), + parameters := snapshotpolicy.SnapshotPolicy{ + Location: azure.NormalizeLocation(d.Get("location").(string)), + Name: utils.String(id.SnapshotPolicyName), + Properties: snapshotpolicy.SnapshotPolicyProperties{ + HourlySchedule: expandNetAppSnapshotPolicyHourlySchedule(d.Get("hourly_schedule").([]interface{})), + DailySchedule: expandNetAppSnapshotPolicyDailySchedule(d.Get("daily_schedule").([]interface{})), + WeeklySchedule: expandNetAppSnapshotPolicyWeeklySchedule(d.Get("weekly_schedule").([]interface{})), + MonthlySchedule: expandNetAppSnapshotPolicyMonthlySchedule(d.Get("monthly_schedule").([]interface{})), + Enabled: utils.Bool(d.Get("enabled").(bool)), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - if _, err := client.Create(ctx, parameters, resourceGroup, accountName, name); err != nil { - return fmt.Errorf("creating NetApp SnapshotPolicy %q (Resource Group %q): %+v", name, resourceGroup, err) + if _, err := client.SnapshotPoliciesCreate(ctx, id, parameters); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } // Waiting for snapshot policy be completely provisioned - id := parse.NewSnapshotPolicyID(client.SubscriptionID, resourceGroup, accountName, name) - log.Printf("[DEBUG] Waiting for NetApp Snapshot Policy Provisioning Service %q (Resource Group %q) to complete", id.Name, id.ResourceGroup) + log.Printf("[DEBUG] Waiting for %s to complete", id) if err := waitForSnapshotPolicyCreation(ctx, client, id, d.Timeout(pluginsdk.TimeoutDelete)); err != nil { return err } @@ -265,46 +248,26 @@ func resourceNetAppSnapshotPolicyUpdate(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - resourceGroup := d.Get("resource_group_name").(string) - accountName := d.Get("account_name").(string) - - location := azure.NormalizeLocation(d.Get("location").(string)) - - enabled := d.Get("enabled").(bool) - - hourlyScheduleRaw := d.Get("hourly_schedule").([]interface{}) - hourlySchedule := expandNetAppSnapshotPolicyHourlySchedule(hourlyScheduleRaw) - - dailyScheduleRaw := d.Get("daily_schedule").([]interface{}) - dailySchedule := expandNetAppSnapshotPolicyDailySchedule(dailyScheduleRaw) - - weeklyScheduleRaw := d.Get("weekly_schedule").([]interface{}) - weeklySchedule := expandNetAppSnapshotPolicyWeeklySchedule(weeklyScheduleRaw) - - monthlyScheduleRaw := d.Get("monthly_schedule").([]interface{}) - monthlySchedule := expandNetAppSnapshotPolicyMonthlySchedule(monthlyScheduleRaw) + id, err := snapshotpolicy.ParseSnapshotPoliciesID(d.Id()) + if err != nil { + return err + } - parameters := netapp.SnapshotPolicyPatch{ - Location: utils.String(location), - Name: utils.String(name), - SnapshotPolicyProperties: &netapp.SnapshotPolicyProperties{ - HourlySchedule: hourlySchedule, - DailySchedule: dailySchedule, - WeeklySchedule: weeklySchedule, - MonthlySchedule: monthlySchedule, - Enabled: utils.Bool(enabled), + parameters := snapshotpolicy.SnapshotPolicyPatch{ + Location: utils.String(azure.NormalizeLocation(d.Get("location").(string))), + Name: utils.String(id.SnapshotPolicyName), + Properties: &snapshotpolicy.SnapshotPolicyProperties{ + HourlySchedule: expandNetAppSnapshotPolicyHourlySchedule(d.Get("hourly_schedule").([]interface{})), + DailySchedule: expandNetAppSnapshotPolicyDailySchedule(d.Get("daily_schedule").([]interface{})), + WeeklySchedule: expandNetAppSnapshotPolicyWeeklySchedule(d.Get("weekly_schedule").([]interface{})), + MonthlySchedule: expandNetAppSnapshotPolicyMonthlySchedule(d.Get("monthly_schedule").([]interface{})), + Enabled: utils.Bool(d.Get("enabled").(bool)), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.Update(ctx, parameters, resourceGroup, accountName, name) - if err != nil { - return fmt.Errorf("updating NetApp SnapshotPolicy %q (Resource Group %q): %+v", name, resourceGroup, err) - } - - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %q (Resource Group %q): %+v", name, resourceGroup, err) + if err = client.SnapshotPoliciesUpdateThenPoll(ctx, *id, parameters); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) } return resourceNetAppSnapshotPolicyRead(d, meta) @@ -315,44 +278,47 @@ func resourceNetAppSnapshotPolicyRead(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SnapshotPolicyID(d.Id()) + id, err := snapshotpolicy.ParseSnapshotPoliciesID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + resp, err := client.SnapshotPoliciesGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] NetApp SnapshotPolicy %q does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("reading NetApp SnapshotPolicy %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("reading %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("account_name", id.NetAppAccountName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } - if props := resp.SnapshotPolicyProperties; props != nil { + d.Set("name", id.SnapshotPolicyName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("account_name", id.AccountName) + + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) + + props := model.Properties d.Set("enabled", props.Enabled) - if err := d.Set("hourly_schedule", flattenNetAppVolumeSnapshotPolicyHourlySchedule(props.HourlySchedule)); err != nil { + if err = d.Set("hourly_schedule", flattenNetAppVolumeSnapshotPolicyHourlySchedule(props.HourlySchedule)); err != nil { return fmt.Errorf("setting `hourly_schedule`: %+v", err) } - if err := d.Set("daily_schedule", flattenNetAppVolumeSnapshotPolicyDailySchedule(props.DailySchedule)); err != nil { + if err = d.Set("daily_schedule", flattenNetAppVolumeSnapshotPolicyDailySchedule(props.DailySchedule)); err != nil { return fmt.Errorf("setting `daily_schedule`: %+v", err) } - if err := d.Set("weekly_schedule", flattenNetAppVolumeSnapshotPolicyWeeklySchedule(props.WeeklySchedule)); err != nil { + if err = d.Set("weekly_schedule", flattenNetAppVolumeSnapshotPolicyWeeklySchedule(props.WeeklySchedule)); err != nil { return fmt.Errorf("setting `weekly_schedule`: %+v", err) } - if err := d.Set("monthly_schedule", flattenNetAppVolumeSnapshotPolicyMonthlySchedule(props.MonthlySchedule)); err != nil { + if err = d.Set("monthly_schedule", flattenNetAppVolumeSnapshotPolicyMonthlySchedule(props.MonthlySchedule)); err != nil { return fmt.Errorf("setting `monthly_schedule`: %+v", err) } + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceNetAppSnapshotPolicyDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -360,21 +326,17 @@ func resourceNetAppSnapshotPolicyDelete(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SnapshotPolicyID(d.Id()) + id, err := snapshotpolicy.ParseSnapshotPoliciesID(d.Id()) if err != nil { return err } // Deleting snapshot policy and waiting for it fo fully complete the operation - future, err := client.Delete(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) - if err != nil { - return fmt.Errorf("deleting NetApp Snapshot Policy %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err = client.SnapshotPoliciesDeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } - log.Printf("[DEBUG] Waiting for NetApp SnapshotPolicy Provisioning Service %q (Resource Group %q) to be deleted", id.Name, id.ResourceGroup) - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %q: %+v", id, err) - } + log.Printf("[DEBUG] Waiting for %s to be deleted", id) if err := waitForSnapshotPolicyDeletion(ctx, client, *id, d.Timeout(pluginsdk.TimeoutDelete)); err != nil { return err } @@ -382,98 +344,98 @@ func resourceNetAppSnapshotPolicyDelete(d *pluginsdk.ResourceData, meta interfac return nil } -func expandNetAppSnapshotPolicyHourlySchedule(input []interface{}) *netapp.HourlySchedule { +func expandNetAppSnapshotPolicyHourlySchedule(input []interface{}) *snapshotpolicy.HourlySchedule { if len(input) == 0 || input[0] == nil { - return &netapp.HourlySchedule{} + return &snapshotpolicy.HourlySchedule{} } - hourlyScheduleObject := netapp.HourlySchedule{} + hourlyScheduleObject := snapshotpolicy.HourlySchedule{} hourlyScheduleRaw := input[0].(map[string]interface{}) if v, ok := hourlyScheduleRaw["snapshots_to_keep"]; ok { - hourlyScheduleObject.SnapshotsToKeep = utils.Int32(int32(v.(int))) + hourlyScheduleObject.SnapshotsToKeep = utils.Int64(int64(v.(int))) } if v, ok := hourlyScheduleRaw["minute"]; ok { - hourlyScheduleObject.Minute = utils.Int32(int32(v.(int))) + hourlyScheduleObject.Minute = utils.Int64(int64(v.(int))) } return &hourlyScheduleObject } -func expandNetAppSnapshotPolicyDailySchedule(input []interface{}) *netapp.DailySchedule { +func expandNetAppSnapshotPolicyDailySchedule(input []interface{}) *snapshotpolicy.DailySchedule { if len(input) == 0 || input[0] == nil { - return &netapp.DailySchedule{} + return &snapshotpolicy.DailySchedule{} } - dailyScheduleObject := netapp.DailySchedule{} + dailyScheduleObject := snapshotpolicy.DailySchedule{} dailyScheduleRaw := input[0].(map[string]interface{}) if v, ok := dailyScheduleRaw["snapshots_to_keep"]; ok { - dailyScheduleObject.SnapshotsToKeep = utils.Int32(int32(v.(int))) + dailyScheduleObject.SnapshotsToKeep = utils.Int64(int64(v.(int))) } if v, ok := dailyScheduleRaw["hour"]; ok { - dailyScheduleObject.Hour = utils.Int32(int32(v.(int))) + dailyScheduleObject.Hour = utils.Int64(int64(v.(int))) } if v, ok := dailyScheduleRaw["minute"]; ok { - dailyScheduleObject.Minute = utils.Int32(int32(v.(int))) + dailyScheduleObject.Minute = utils.Int64(int64(v.(int))) } return &dailyScheduleObject } -func expandNetAppSnapshotPolicyWeeklySchedule(input []interface{}) *netapp.WeeklySchedule { +func expandNetAppSnapshotPolicyWeeklySchedule(input []interface{}) *snapshotpolicy.WeeklySchedule { if len(input) == 0 || input[0] == nil { - return &netapp.WeeklySchedule{} + return &snapshotpolicy.WeeklySchedule{} } - weeklyScheduleObject := netapp.WeeklySchedule{} + weeklyScheduleObject := snapshotpolicy.WeeklySchedule{} weeklyScheduleRaw := input[0].(map[string]interface{}) if v, ok := weeklyScheduleRaw["snapshots_to_keep"]; ok { - weeklyScheduleObject.SnapshotsToKeep = utils.Int32(int32(v.(int))) + weeklyScheduleObject.SnapshotsToKeep = utils.Int64(int64(v.(int))) } if _, ok := weeklyScheduleRaw["days_of_week"]; ok { weeklyScheduleObject.Day = utils.ExpandStringSliceWithDelimiter(weeklyScheduleRaw["days_of_week"].(*pluginsdk.Set).List(), ",") } if v, ok := weeklyScheduleRaw["hour"]; ok { - weeklyScheduleObject.Hour = utils.Int32(int32(v.(int))) + weeklyScheduleObject.Hour = utils.Int64(int64(v.(int))) } if v, ok := weeklyScheduleRaw["minute"]; ok { - weeklyScheduleObject.Minute = utils.Int32(int32(v.(int))) + weeklyScheduleObject.Minute = utils.Int64(int64(v.(int))) } return &weeklyScheduleObject } -func expandNetAppSnapshotPolicyMonthlySchedule(input []interface{}) *netapp.MonthlySchedule { +func expandNetAppSnapshotPolicyMonthlySchedule(input []interface{}) *snapshotpolicy.MonthlySchedule { if len(input) == 0 || input[0] == nil { - return &netapp.MonthlySchedule{} + return &snapshotpolicy.MonthlySchedule{} } - monthlyScheduleObject := netapp.MonthlySchedule{} + monthlyScheduleObject := snapshotpolicy.MonthlySchedule{} monthlyScheduleRaw := input[0].(map[string]interface{}) if v, ok := monthlyScheduleRaw["snapshots_to_keep"]; ok { - monthlyScheduleObject.SnapshotsToKeep = utils.Int32(int32(v.(int))) + monthlyScheduleObject.SnapshotsToKeep = utils.Int64(int64(v.(int))) } if _, ok := monthlyScheduleRaw["days_of_month"]; ok { monthlyScheduleObject.DaysOfMonth = utils.ExpandIntSliceWithDelimiter(monthlyScheduleRaw["days_of_month"].(*pluginsdk.Set).List(), ",") } if v, ok := monthlyScheduleRaw["hour"]; ok { - monthlyScheduleObject.Hour = utils.Int32(int32(v.(int))) + monthlyScheduleObject.Hour = utils.Int64(int64(v.(int))) } if v, ok := monthlyScheduleRaw["minute"]; ok { - monthlyScheduleObject.Minute = utils.Int32(int32(v.(int))) + monthlyScheduleObject.Minute = utils.Int64(int64(v.(int))) } return &monthlyScheduleObject } -func flattenNetAppVolumeSnapshotPolicyHourlySchedule(input *netapp.HourlySchedule) []interface{} { +func flattenNetAppVolumeSnapshotPolicyHourlySchedule(input *snapshotpolicy.HourlySchedule) []interface{} { if input == nil { return []interface{}{} } @@ -486,7 +448,7 @@ func flattenNetAppVolumeSnapshotPolicyHourlySchedule(input *netapp.HourlySchedul } } -func flattenNetAppVolumeSnapshotPolicyDailySchedule(input *netapp.DailySchedule) []interface{} { +func flattenNetAppVolumeSnapshotPolicyDailySchedule(input *snapshotpolicy.DailySchedule) []interface{} { if input == nil { return []interface{}{} } @@ -500,7 +462,7 @@ func flattenNetAppVolumeSnapshotPolicyDailySchedule(input *netapp.DailySchedule) } } -func flattenNetAppVolumeSnapshotPolicyWeeklySchedule(input *netapp.WeeklySchedule) []interface{} { +func flattenNetAppVolumeSnapshotPolicyWeeklySchedule(input *snapshotpolicy.WeeklySchedule) []interface{} { if input == nil { return []interface{}{} } @@ -522,7 +484,7 @@ func flattenNetAppVolumeSnapshotPolicyWeeklySchedule(input *netapp.WeeklySchedul } } -func flattenNetAppVolumeSnapshotPolicyMonthlySchedule(input *netapp.MonthlySchedule) []interface{} { +func flattenNetAppVolumeSnapshotPolicyMonthlySchedule(input *snapshotpolicy.MonthlySchedule) []interface{} { if input == nil { return []interface{}{} } @@ -545,7 +507,7 @@ func flattenNetAppVolumeSnapshotPolicyMonthlySchedule(input *netapp.MonthlySched } } -func waitForSnapshotPolicyCreation(ctx context.Context, client *netapp.SnapshotPoliciesClient, id parse.SnapshotPolicyId, timeout time.Duration) error { +func waitForSnapshotPolicyCreation(ctx context.Context, client *snapshotpolicy.SnapshotPolicyClient, id snapshotpolicy.SnapshotPoliciesId, timeout time.Duration) error { stateConf := &pluginsdk.StateChangeConf{ ContinuousTargetOccurence: 5, Delay: 10 * time.Second, @@ -557,13 +519,13 @@ func waitForSnapshotPolicyCreation(ctx context.Context, client *netapp.SnapshotP } if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting NetApp Volume Provisioning Service %q (Resource Group %q) to complete: %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("waiting for %s to complete: %+v", id, err) } return nil } -func waitForSnapshotPolicyDeletion(ctx context.Context, client *netapp.SnapshotPoliciesClient, id parse.SnapshotPolicyId, timeout time.Duration) error { +func waitForSnapshotPolicyDeletion(ctx context.Context, client *snapshotpolicy.SnapshotPolicyClient, id snapshotpolicy.SnapshotPoliciesId, timeout time.Duration) error { stateConf := &pluginsdk.StateChangeConf{ ContinuousTargetOccurence: 5, Delay: 10 * time.Second, @@ -575,21 +537,21 @@ func waitForSnapshotPolicyDeletion(ctx context.Context, client *netapp.SnapshotP } if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for NetApp SnapshotPolicy Provisioning Service %q (Resource Group %q) to be deleted: %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("waiting for %s to be deleted: %+v", id, err) } return nil } -func netappSnapshotPolicyStateRefreshFunc(ctx context.Context, client *netapp.SnapshotPoliciesClient, id parse.SnapshotPolicyId) pluginsdk.StateRefreshFunc { +func netappSnapshotPolicyStateRefreshFunc(ctx context.Context, client *snapshotpolicy.SnapshotPolicyClient, id snapshotpolicy.SnapshotPoliciesId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + res, err := client.SnapshotPoliciesGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(res.Response) { - return nil, "", fmt.Errorf("retrieving NetApp SnapshotPolicy %q (Resource Group %q): %s", id.Name, id.ResourceGroup, err) + if !response.WasNotFound(res.HttpResponse) { + return nil, "", fmt.Errorf("retrieving %s: %s", id, err) } } - return res, strconv.Itoa(res.StatusCode), nil + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_resource.go index 4c5f045af0f..1e0e016b620 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_snapshot_resource.go @@ -7,15 +7,14 @@ import ( "strconv" "time" - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceNetAppSnapshot() *pluginsdk.Resource { @@ -31,7 +30,7 @@ func resourceNetAppSnapshot() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.SnapshotID(id) + _, err := snapshots.ParseSnapshotID(id) return err }), @@ -77,32 +76,28 @@ func resourceNetAppSnapshotCreate(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewSnapshotID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("volume_name").(string), d.Get("name").(string)) + id := snapshots.NewSnapshotID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("volume_name").(string), d.Get("name").(string)) if d.IsNewResource() { - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("checking for presence of %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return tf.ImportAsExistsError("azurerm_netapp_snapshot", id.ID()) } } location := azure.NormalizeLocation(d.Get("location").(string)) - parameters := netapp.Snapshot{ - Location: utils.String(location), + parameters := snapshots.Snapshot{ + Location: location, } - future, err := client.Create(ctx, parameters, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.Name) - if err != nil { + if err := client.CreateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } d.SetId(id.ID()) return resourceNetAppSnapshotRead(d, meta) @@ -113,28 +108,29 @@ func resourceNetAppSnapshotRead(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SnapshotID(d.Id()) + id, err := snapshots.ParseSnapshotID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] NetApp Snapshots %q does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("reading NetApp Snapshots %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("reading %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("account_name", id.NetAppAccountName) - d.Set("pool_name", id.CapacityPoolName) + d.Set("name", id.SnapshotName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("account_name", id.AccountName) + d.Set("pool_name", id.PoolName) d.Set("volume_name", id.VolumeName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) + + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) } return nil @@ -145,13 +141,13 @@ func resourceNetAppSnapshotDelete(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SnapshotID(d.Id()) + id, err := snapshots.ParseSnapshotID(d.Id()) if err != nil { return err } - if _, err = client.Delete(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.Name); err != nil { - return fmt.Errorf("deleting NetApp Snapshot %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err = client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } // The resource NetApp Snapshot depends on the resource NetApp Volume. @@ -159,33 +155,33 @@ func resourceNetAppSnapshotDelete(d *pluginsdk.ResourceData, meta interface{}) e // Then it tries to immediately delete NetApp Volume but it still throws error `Can not delete resource before nested resources are deleted.` // In this case we're going to re-check status code again. // For more details, see related Bug: https://github.com/Azure/azure-sdk-for-go/issues/11475 - log.Printf("[DEBUG] Waiting for NetApp Snapshot %q (Resource Group %q) to be deleted", id.Name, id.ResourceGroup) + log.Printf("[DEBUG] Waiting for %s to be deleted", id) stateConf := &pluginsdk.StateChangeConf{ ContinuousTargetOccurence: 5, Delay: 10 * time.Second, MinTimeout: 10 * time.Second, Pending: []string{"200", "202"}, Target: []string{"204", "404"}, - Refresh: netappSnapshotDeleteStateRefreshFunc(ctx, client, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.Name), + Refresh: netappSnapshotDeleteStateRefreshFunc(ctx, client, *id), Timeout: d.Timeout(pluginsdk.TimeoutDelete), } if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for NetApp Snapshot %q (Resource Group %q) to be deleted: %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("waiting for %s to be deleted: %+v", id, err) } return nil } -func netappSnapshotDeleteStateRefreshFunc(ctx context.Context, client *netapp.SnapshotsClient, resourceGroupName string, accountName string, poolName string, volumeName string, name string) pluginsdk.StateRefreshFunc { +func netappSnapshotDeleteStateRefreshFunc(ctx context.Context, client *snapshots.SnapshotsClient, id snapshots.SnapshotId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, resourceGroupName, accountName, poolName, volumeName, name) + res, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(res.Response) { - return nil, "", fmt.Errorf("retrieving NetApp Snapshot %q (Resource Group %q): %s", name, resourceGroupName, err) + if !response.WasNotFound(res.HttpResponse) { + return nil, "", fmt.Errorf("retrieving %s: %s", id, err) } } - return res, strconv.Itoa(res.StatusCode), nil + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_volume_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_volume_data_source.go index 3d435a927db..b6413b4da7d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_volume_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_volume_data_source.go @@ -4,14 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceNetAppVolume() *pluginsdk.Resource { @@ -123,10 +123,10 @@ func dataSourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewVolumeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) + id := volumes.NewVolumeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) @@ -134,17 +134,18 @@ func dataSourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) err d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("pool_name", id.CapacityPoolName) - d.Set("account_name", id.NetAppAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.VolumeName) + d.Set("pool_name", id.PoolName) + d.Set("account_name", id.AccountName) + d.Set("resource_group_name", id.ResourceGroupName) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) - if props := resp.VolumeProperties; props != nil { + props := model.Properties d.Set("volume_path", props.CreationToken) d.Set("service_level", props.ServiceLevel) - d.Set("subnet_id", props.SubnetID) + d.Set("subnet_id", props.SubnetId) d.Set("network_features", props.NetworkFeatures) protocolTypes := make([]string, 0) @@ -155,9 +156,7 @@ func dataSourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) err d.Set("security_style", props.SecurityStyle) - if props.UsageThreshold != nil { - d.Set("storage_quota_in_gb", *props.UsageThreshold/1073741824) - } + d.Set("storage_quota_in_gb", props.UsageThreshold/1073741824) if err := d.Set("mount_ip_addresses", flattenNetAppVolumeMountIPAddresses(props.MountTargets)); err != nil { return fmt.Errorf("setting `mount_ip_addresses`: %+v", err) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_volume_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_volume_resource.go index 7ddde3a07f4..9bba80e9535 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_volume_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/netapp_volume_resource.go @@ -8,16 +8,18 @@ import ( "strings" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" netAppValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -38,7 +40,7 @@ func resourceNetAppVolume() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(60 * time.Minute), }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.VolumeID(id) + _, err := volumes.ParseVolumeID(id) return err }), @@ -80,9 +82,9 @@ func resourceNetAppVolume() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(netapp.ServiceLevelPremium), - string(netapp.ServiceLevelStandard), - string(netapp.ServiceLevelUltra), + string(volumes.ServiceLevelPremium), + string(volumes.ServiceLevelStandard), + string(volumes.ServiceLevelUltra), }, false), }, @@ -98,7 +100,7 @@ func resourceNetAppVolume() *pluginsdk.Resource { Optional: true, Computed: true, ForceNew: true, - ValidateFunc: netAppValidate.SnapshotID, + ValidateFunc: snapshots.ValidateSnapshotID, }, "network_features": { @@ -107,8 +109,8 @@ func resourceNetAppVolume() *pluginsdk.Resource { Computed: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(netapp.NetworkFeaturesBasic), - string(netapp.NetworkFeaturesStandard), + string(volumes.NetworkFeaturesBasic), + string(volumes.NetworkFeaturesStandard), }, false), }, @@ -206,7 +208,7 @@ func resourceNetAppVolume() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "mount_ip_addresses": { Type: pluginsdk.TypeList, @@ -283,28 +285,30 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewVolumeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("name").(string)) + id := volumes.NewVolumeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_netapp_volume", id.ID()) } } location := azure.NormalizeLocation(d.Get("location").(string)) volumePath := d.Get("volume_path").(string) - serviceLevel := d.Get("service_level").(string) + serviceLevel := volumes.ServiceLevel(d.Get("service_level").(string)) subnetID := d.Get("subnet_id").(string) - networkFeatures := d.Get("network_features").(string) - if networkFeatures == "" { - networkFeatures = string(netapp.NetworkFeaturesBasic) + var networkFeatures volumes.NetworkFeatures + networkFeaturesString := d.Get("network_features").(string) + if networkFeaturesString == "" { + networkFeatures = volumes.NetworkFeaturesBasic } + networkFeatures = volumes.NetworkFeatures(networkFeaturesString) protocols := d.Get("protocols").(*pluginsdk.Set).List() if len(protocols) == 0 { @@ -312,11 +316,11 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err } // Handling security style property - securityStyle := d.Get("security_style").(string) - if strings.EqualFold(securityStyle, "unix") && len(protocols) == 1 && strings.EqualFold(protocols[0].(string), "cifs") { + securityStyle := volumes.SecurityStyle(d.Get("security_style").(string)) + if strings.EqualFold(string(securityStyle), "unix") && len(protocols) == 1 && strings.EqualFold(protocols[0].(string), "cifs") { return fmt.Errorf("unix security style cannot be used in a CIFS enabled volume for %s", id) } - if strings.EqualFold(securityStyle, "ntfs") && len(protocols) == 1 && (strings.EqualFold(protocols[0].(string), "nfsv3") || strings.EqualFold(protocols[0].(string), "nfsv4.1")) { + if strings.EqualFold(string(securityStyle), "ntfs") && len(protocols) == 1 && (strings.EqualFold(protocols[0].(string), "nfsv3") || strings.EqualFold(protocols[0].(string), "nfsv4.1")) { return fmt.Errorf("ntfs security style cannot be used in a NFSv3/NFSv4.1 enabled volume for %s", id) } @@ -333,14 +337,20 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err authorizeReplication := false volumeType := "" - if dataProtectionReplication != nil && dataProtectionReplication.Replication != nil && strings.ToLower(string(dataProtectionReplication.Replication.EndpointType)) == "dst" { - authorizeReplication = true - volumeType = "DataProtection" + if dataProtectionReplication != nil && dataProtectionReplication.Replication != nil { + endpointType := "" + if dataProtectionReplication.Replication.EndpointType != nil { + endpointType = string(*dataProtectionReplication.Replication.EndpointType) + } + if strings.ToLower(endpointType) == "dst" { + authorizeReplication = true + volumeType = "DataProtection" + } } // Validating that snapshot policies are not being created in a data protection volume if dataProtectionSnapshotPolicy.Snapshot != nil && volumeType != "" { - return fmt.Errorf("snapshot policy cannot be enabled on a data protection volume, NetApp Volume %q (Resource Group %q)", id.Name, id.ResourceGroup) + return fmt.Errorf("snapshot policy cannot be enabled on a data protection volume, NetApp Volume %q (Resource Group %q)", id.VolumeName, id.ResourceGroupName) } snapshotDirectoryVisible := d.Get("snapshot_directory_visible").(bool) @@ -350,82 +360,70 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err snapshotID := "" if snapshotResourceID != "" { // Get snapshot ID GUID value - parsedSnapshotResourceID, err := parse.SnapshotID(snapshotResourceID) + parsedSnapshotResourceID, err := snapshots.ParseSnapshotID(snapshotResourceID) if err != nil { return fmt.Errorf("parsing snapshotResourceID %q: %+v", snapshotResourceID, err) } snapshotClient := meta.(*clients.Client).NetApp.SnapshotClient - snapshotResponse, err := snapshotClient.Get( - ctx, - parsedSnapshotResourceID.ResourceGroup, - parsedSnapshotResourceID.NetAppAccountName, - parsedSnapshotResourceID.CapacityPoolName, - parsedSnapshotResourceID.VolumeName, - parsedSnapshotResourceID.Name, - ) + _, err = snapshotClient.Get(ctx, *parsedSnapshotResourceID) if err != nil { - return fmt.Errorf("getting snapshot from NetApp Volume %q (Resource Group %q): %+v", parsedSnapshotResourceID.VolumeName, parsedSnapshotResourceID.ResourceGroup, err) + return fmt.Errorf("getting snapshot from %s: %+v", id, err) } - snapshotID = *snapshotResponse.SnapshotID + sourceVolumeId := volumes.NewVolumeID(parsedSnapshotResourceID.SubscriptionId, parsedSnapshotResourceID.ResourceGroupName, parsedSnapshotResourceID.AccountName, parsedSnapshotResourceID.PoolName, parsedSnapshotResourceID.VolumeName) // Validate if properties that cannot be changed matches (protocols, subnet_id, location, resource group, account_name, pool_name, service_level) - sourceVolume, err := client.Get( - ctx, - parsedSnapshotResourceID.ResourceGroup, - parsedSnapshotResourceID.NetAppAccountName, - parsedSnapshotResourceID.CapacityPoolName, - parsedSnapshotResourceID.VolumeName, - ) + sourceVolume, err := client.Get(ctx, sourceVolumeId) if err != nil { - return fmt.Errorf("getting source NetApp Volume (snapshot's parent resource) %q (Resource Group %q): %+v", parsedSnapshotResourceID.VolumeName, parsedSnapshotResourceID.ResourceGroup, err) + return fmt.Errorf("getting source NetApp Volume (snapshot's parent resource) %q (Resource Group %q): %+v", parsedSnapshotResourceID.VolumeName, parsedSnapshotResourceID.ResourceGroupName, err) } - parsedVolumeID, err := parse.VolumeID(*sourceVolume.ID) - if err != nil { - return fmt.Errorf("parsing Source Volume ID: %s", err) - } propertyMismatch := []string{} - if !ValidateSlicesEquality(*sourceVolume.ProtocolTypes, *utils.ExpandStringSlice(protocols), false) { - propertyMismatch = append(propertyMismatch, "protocols") - } - if !strings.EqualFold(*sourceVolume.SubnetID, subnetID) { - propertyMismatch = append(propertyMismatch, "subnet_id") - } - if !strings.EqualFold(*sourceVolume.Location, location) { - propertyMismatch = append(propertyMismatch, "location") - } - if !strings.EqualFold(string(sourceVolume.ServiceLevel), serviceLevel) { - propertyMismatch = append(propertyMismatch, "service_level") - } - if !strings.EqualFold(parsedVolumeID.ResourceGroup, id.ResourceGroup) { - propertyMismatch = append(propertyMismatch, "resource_group_name") - } - if !strings.EqualFold(parsedVolumeID.NetAppAccountName, id.NetAppAccountName) { - propertyMismatch = append(propertyMismatch, "account_name") - } - if !strings.EqualFold(parsedVolumeID.CapacityPoolName, id.CapacityPoolName) { - propertyMismatch = append(propertyMismatch, "pool_name") - } - if len(propertyMismatch) > 0 { - return fmt.Errorf("following NetApp Volume properties on new Volume from Snapshot does not match Snapshot's source %s: %s", id, strings.Join(propertyMismatch, ", ")) + if model := sourceVolume.Model; model != nil { + props := model.Properties + if !ValidateSlicesEquality(*props.ProtocolTypes, *utils.ExpandStringSlice(protocols), false) { + propertyMismatch = append(propertyMismatch, "protocols") + } + if !strings.EqualFold(props.SubnetId, subnetID) { + propertyMismatch = append(propertyMismatch, "subnet_id") + } + if !strings.EqualFold(model.Location, location) { + propertyMismatch = append(propertyMismatch, "location") + } + if volumeServiceLevel := props.ServiceLevel; volumeServiceLevel != nil { + if !strings.EqualFold(string(*props.ServiceLevel), string(serviceLevel)) { + propertyMismatch = append(propertyMismatch, "service_level") + } + } + if !strings.EqualFold(sourceVolumeId.ResourceGroupName, id.ResourceGroupName) { + propertyMismatch = append(propertyMismatch, "resource_group_name") + } + if !strings.EqualFold(sourceVolumeId.AccountName, id.AccountName) { + propertyMismatch = append(propertyMismatch, "account_name") + } + if !strings.EqualFold(sourceVolumeId.PoolName, id.PoolName) { + propertyMismatch = append(propertyMismatch, "pool_name") + } + if len(propertyMismatch) > 0 { + return fmt.Errorf("following NetApp Volume properties on new Volume from Snapshot does not match Snapshot's source %s: %s", id, strings.Join(propertyMismatch, ", ")) + } } } - parameters := netapp.Volume{ - Location: utils.String(location), - VolumeProperties: &netapp.VolumeProperties{ - CreationToken: utils.String(volumePath), - ServiceLevel: netapp.ServiceLevel(serviceLevel), - SubnetID: utils.String(subnetID), - NetworkFeatures: netapp.NetworkFeatures(networkFeatures), + parameters := volumes.Volume{ + Location: location, + Properties: volumes.VolumeProperties{ + CreationToken: volumePath, + ServiceLevel: &serviceLevel, + SubnetId: subnetID, + NetworkFeatures: &networkFeatures, ProtocolTypes: utils.ExpandStringSlice(protocols), - SecurityStyle: netapp.SecurityStyle(securityStyle), - UsageThreshold: utils.Int64(storageQuotaInGB), + SecurityStyle: &securityStyle, + UsageThreshold: storageQuotaInGB, ExportPolicy: exportPolicyRule, VolumeType: utils.String(volumeType), - SnapshotID: utils.String(snapshotID), - DataProtection: &netapp.VolumePropertiesDataProtection{ + SnapshotId: utils.String(snapshotID), + DataProtection: &volumes.VolumePropertiesDataProtection{ Replication: dataProtectionReplication.Replication, Snapshot: dataProtectionSnapshotPolicy.Snapshot, }, @@ -435,16 +433,12 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err } if throughputMibps, ok := d.GetOk("throughput_in_mibps"); ok { - parameters.VolumeProperties.ThroughputMibps = utils.Float(throughputMibps.(float64)) + parameters.Properties.ThroughputMibps = utils.Float(throughputMibps.(float64)) } - future, err := client.CreateOrUpdate(ctx, parameters, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the creation of %s: %+v", id, err) - } // Waiting for volume be completely provisioned if err := waitForVolumeCreateOrUpdate(ctx, client, id); err != nil { @@ -453,32 +447,22 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err // If this is a data replication secondary volume, authorize replication on primary volume if authorizeReplication { - replVolID, err := parse.VolumeID(*dataProtectionReplication.Replication.RemoteVolumeResourceID) + replicationClient := meta.(*clients.Client).NetApp.VolumeReplicationClient + replVolID, err := volumesreplication.ParseVolumeID(dataProtectionReplication.Replication.RemoteVolumeResourceId) if err != nil { return err } - future, err := client.AuthorizeReplication( - ctx, - replVolID.ResourceGroup, - replVolID.NetAppAccountName, - replVolID.CapacityPoolName, - replVolID.Name, - netapp.AuthorizeRequest{ - RemoteVolumeResourceID: utils.String(id.ID()), - }, - ) - if err != nil { + if err = replicationClient.VolumesAuthorizeReplicationThenPoll(ctx, *replVolID, volumesreplication.AuthorizeRequest{ + RemoteVolumeResourceId: utils.String(id.ID()), + }, + ); err != nil { return fmt.Errorf("cannot authorize volume replication: %v", err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("cannot get authorize volume replication future response: %v", err) - } - // Wait for volume replication authorization to complete - log.Printf("[DEBUG] Waiting for replication authorization on NetApp Volume Provisioning Service %q (Resource Group %q) to complete", id.Name, id.ResourceGroup) - if err := waitForReplAuthorization(ctx, client, id); err != nil { + log.Printf("[DEBUG] Waiting for replication authorization on %s to complete", id) + if err := waitForReplAuthorization(ctx, replicationClient, *replVolID); err != nil { return err } } @@ -493,27 +477,27 @@ func resourceNetAppVolumeUpdate(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VolumeID(d.Id()) + id, err := volumes.ParseVolumeID(d.Id()) if err != nil { return err } shouldUpdate := false - update := netapp.VolumePatch{ - VolumePatchProperties: &netapp.VolumePatchProperties{}, + update := volumes.VolumePatch{ + Properties: &volumes.VolumePatchProperties{}, } if d.HasChange("storage_quota_in_gb") { shouldUpdate = true storageQuotaInBytes := int64(d.Get("storage_quota_in_gb").(int) * 1073741824) - update.VolumePatchProperties.UsageThreshold = utils.Int64(storageQuotaInBytes) + update.Properties.UsageThreshold = utils.Int64(storageQuotaInBytes) } if d.HasChange("export_policy_rule") { shouldUpdate = true exportPolicyRuleRaw := d.Get("export_policy_rule").([]interface{}) exportPolicyRule := expandNetAppVolumeExportPolicyRulePatch(exportPolicyRuleRaw) - update.VolumePatchProperties.ExportPolicy = exportPolicyRule + update.Properties.ExportPolicy = exportPolicyRule } if d.HasChange("data_protection_snapshot_policy") { @@ -521,20 +505,20 @@ func resourceNetAppVolumeUpdate(d *pluginsdk.ResourceData, meta interface{}) err dataProtectionReplicationRaw := d.Get("data_protection_replication").([]interface{}) dataProtectionReplication := expandNetAppVolumeDataProtectionReplication(dataProtectionReplicationRaw) - if dataProtectionReplication != nil && dataProtectionReplication.Replication != nil && strings.ToLower(string(dataProtectionReplication.Replication.EndpointType)) == "dst" { - return fmt.Errorf("snapshot policy cannot be enabled on a data protection volume, NetApp Volume %q (Resource Group %q)", id.Name, id.ResourceGroup) + if dataProtectionReplication != nil && dataProtectionReplication.Replication != nil && dataProtectionReplication.Replication.EndpointType != nil && strings.ToLower(string(*dataProtectionReplication.Replication.EndpointType)) == "dst" { + return fmt.Errorf("snapshot policy cannot be enabled on a data protection volume, %s", id) } shouldUpdate = true dataProtectionSnapshotPolicyRaw := d.Get("data_protection_snapshot_policy").([]interface{}) dataProtectionSnapshotPolicy := expandNetAppVolumeDataProtectionSnapshotPolicyPatch(dataProtectionSnapshotPolicyRaw) - update.VolumePatchProperties.DataProtection = dataProtectionSnapshotPolicy + update.Properties.DataProtection = dataProtectionSnapshotPolicy } if d.HasChange("throughput_in_mibps") { shouldUpdate = true throughputMibps := d.Get("throughput_in_mibps") - update.VolumePatchProperties.ThroughputMibps = utils.Float(throughputMibps.(float64)) + update.Properties.ThroughputMibps = utils.Float(throughputMibps.(float64)) } if d.HasChange("tags") { @@ -544,12 +528,8 @@ func resourceNetAppVolumeUpdate(d *pluginsdk.ResourceData, meta interface{}) err } if shouldUpdate { - future, err := client.Update(ctx, update, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) - if err != nil { - return fmt.Errorf("updating Volume %q: %+v", id.Name, err) - } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the update of %s: %+v", id, err) + if err = client.UpdateThenPoll(ctx, *id, update); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) } // Wait for volume to complete update @@ -566,14 +546,14 @@ func resourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VolumeID(d.Id()) + id, err := volumes.ParseVolumeID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s was not found - removing from state", *id) d.SetId("") return nil @@ -581,25 +561,24 @@ func resourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) error return fmt.Errorf("reading %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("account_name", id.NetAppAccountName) - d.Set("pool_name", id.CapacityPoolName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } - if props := resp.VolumeProperties; props != nil { + d.Set("name", id.VolumeName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("account_name", id.AccountName) + d.Set("pool_name", id.PoolName) + + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) + + props := model.Properties d.Set("volume_path", props.CreationToken) d.Set("service_level", props.ServiceLevel) - d.Set("subnet_id", props.SubnetID) + d.Set("subnet_id", props.SubnetId) d.Set("network_features", props.NetworkFeatures) d.Set("protocols", props.ProtocolTypes) d.Set("security_style", props.SecurityStyle) d.Set("snapshot_directory_visible", props.SnapshotDirectoryVisible) d.Set("throughput_in_mibps", props.ThroughputMibps) - if props.UsageThreshold != nil { - d.Set("storage_quota_in_gb", *props.UsageThreshold/1073741824) - } + d.Set("storage_quota_in_gb", props.UsageThreshold/1073741824) if err := d.Set("export_policy_rule", flattenNetAppVolumeExportPolicyRule(props.ExportPolicy)); err != nil { return fmt.Errorf("setting `export_policy_rule`: %+v", err) } @@ -612,9 +591,10 @@ func resourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) error if err := d.Set("data_protection_snapshot_policy", flattenNetAppVolumeDataProtectionSnapshotPolicy(props.DataProtection)); err != nil { return fmt.Errorf("setting `data_protection_snapshot_policy`: %+v", err) } - } - return tags.FlattenAndSet(d, resp.Tags) + return tags.FlattenAndSet(d, model.Tags) + } + return nil } func resourceNetAppVolumeDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -622,7 +602,7 @@ func resourceNetAppVolumeDelete(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VolumeID(d.Id()) + id, err := volumes.ParseVolumeID(d.Id()) if err != nil { return err } @@ -631,82 +611,70 @@ func resourceNetAppVolumeDelete(d *pluginsdk.ResourceData, meta interface{}) err dataProtectionReplicationRaw := d.Get("data_protection_replication").([]interface{}) dataProtectionReplication := expandNetAppVolumeDataProtectionReplication(dataProtectionReplicationRaw) - if replicaVolumeId := id; dataProtectionReplication != nil && dataProtectionReplication.Replication != nil { - if dataProtectionReplication.Replication.RemoteVolumeResourceID == nil { - return fmt.Errorf("remote volume id was nil") + if dataProtectionReplication != nil && dataProtectionReplication.Replication != nil { + replicaVolumeId, err := volumesreplication.ParseVolumeID(id.ID()) + if err != nil { + return err } - - if strings.ToLower(string(dataProtectionReplication.Replication.EndpointType)) != "dst" { + if dataProtectionReplication.Replication.EndpointType != nil && strings.ToLower(string(*dataProtectionReplication.Replication.EndpointType)) != "dst" { // This is the case where primary volume started the deletion, in this case, to be consistent we will remove replication from secondary - replicaVolumeId, err = parse.VolumeID(*dataProtectionReplication.Replication.RemoteVolumeResourceID) + replicaVolumeId, err = volumesreplication.ParseVolumeID(dataProtectionReplication.Replication.RemoteVolumeResourceId) if err != nil { return err } } + replicationClient := meta.(*clients.Client).NetApp.VolumeReplicationClient // Checking replication status before deletion, it need to be broken before proceeding with deletion - if res, err := client.ReplicationStatusMethod(ctx, replicaVolumeId.ResourceGroup, replicaVolumeId.NetAppAccountName, replicaVolumeId.CapacityPoolName, replicaVolumeId.Name); err == nil { + if res, err := replicationClient.VolumesReplicationStatus(ctx, *replicaVolumeId); err == nil { // Wait for replication state = "mirrored" - if strings.ToLower(string(res.MirrorState)) == "uninitialized" { - if err := waitForReplMirrorState(ctx, client, *replicaVolumeId, "mirrored"); err != nil { - return fmt.Errorf("waiting for replica %s to become 'mirrored': %+v", *replicaVolumeId, err) + if model := res.Model; model != nil { + if model.MirrorState != nil && strings.ToLower(string(*model.MirrorState)) == "uninitialized" { + if err := waitForReplMirrorState(ctx, replicationClient, *replicaVolumeId, "mirrored"); err != nil { + return fmt.Errorf("waiting for replica %s to become 'mirrored': %+v", *replicaVolumeId, err) + } } } // Breaking replication - _, err = client.BreakReplication(ctx, - replicaVolumeId.ResourceGroup, - replicaVolumeId.NetAppAccountName, - replicaVolumeId.CapacityPoolName, - replicaVolumeId.Name, - &netapp.BreakReplicationRequest{ - ForceBreakReplication: utils.Bool(true), - }) - - if err != nil { + if err = replicationClient.VolumesBreakReplicationThenPoll(ctx, *replicaVolumeId, volumesreplication.BreakReplicationRequest{ + ForceBreakReplication: utils.Bool(true), + }); err != nil { return fmt.Errorf("breaking replication for %s: %+v", *replicaVolumeId, err) } // Waiting for replication be in broken state log.Printf("[DEBUG] Waiting for the replication of %s to be in broken state", *replicaVolumeId) - if err := waitForReplMirrorState(ctx, client, *replicaVolumeId, "broken"); err != nil { + if err := waitForReplMirrorState(ctx, replicationClient, *replicaVolumeId, "broken"); err != nil { return fmt.Errorf("waiting for the breaking of replication for %s: %+v", *replicaVolumeId, err) } } // Deleting replication and waiting for it to fully complete the operation - future, err := client.DeleteReplication(ctx, replicaVolumeId.ResourceGroup, replicaVolumeId.NetAppAccountName, replicaVolumeId.CapacityPoolName, replicaVolumeId.Name) - if err != nil { + if err = replicationClient.VolumesDeleteReplicationThenPoll(ctx, *replicaVolumeId); err != nil { return fmt.Errorf("deleting replicate %s: %+v", *replicaVolumeId, err) } - log.Printf("[DEBUG] Waiting for the replica of %s to be deleted", replicaVolumeId) - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the replica %s to be deleted: %+v", *replicaVolumeId, err) - } - if err := waitForReplicationDeletion(ctx, client, *replicaVolumeId); err != nil { + if err := waitForReplicationDeletion(ctx, replicationClient, *replicaVolumeId); err != nil { return fmt.Errorf("waiting for the replica %s to be deleted: %+v", *replicaVolumeId, err) } } // Deleting volume and waiting for it fo fully complete the operation - future, err := client.Delete(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name, utils.Bool(true)) - if err != nil { + if err = client.DeleteThenPoll(ctx, *id, volumes.DeleteOperationOptions{ + ForceDelete: utils.Bool(true), + }); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - log.Printf("[DEBUG] Waiting for %s to be deleted", *id) - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %q: %+v", id, err) - } - if err := waitForVolumeDeletion(ctx, client, *id); err != nil { + if err = waitForVolumeDeletion(ctx, client, *id); err != nil { return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) } return nil } -func waitForVolumeCreateOrUpdate(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId) error { +func waitForVolumeCreateOrUpdate(ctx context.Context, client *volumes.VolumesClient, id volumes.VolumeId) error { deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") @@ -728,7 +696,7 @@ func waitForVolumeCreateOrUpdate(ctx context.Context, client *netapp.VolumesClie return nil } -func waitForReplAuthorization(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId) error { +func waitForReplAuthorization(ctx context.Context, client *volumesreplication.VolumesReplicationClient, id volumesreplication.VolumeId) error { deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") @@ -744,13 +712,13 @@ func waitForReplAuthorization(ctx context.Context, client *netapp.VolumesClient, } if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for replication authorization NetApp Volume Provisioning Service %q (Resource Group %q) to complete: %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("waiting for replication authorization %s to complete: %+v", id, err) } return nil } -func waitForReplMirrorState(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId, desiredState string) error { +func waitForReplMirrorState(ctx context.Context, client *volumesreplication.VolumesReplicationClient, id volumesreplication.VolumeId, desiredState string) error { deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") @@ -772,7 +740,7 @@ func waitForReplMirrorState(ctx context.Context, client *netapp.VolumesClient, i return nil } -func waitForReplicationDeletion(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId) error { +func waitForReplicationDeletion(ctx context.Context, client *volumesreplication.VolumesReplicationClient, id volumesreplication.VolumeId) error { deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") @@ -795,7 +763,7 @@ func waitForReplicationDeletion(ctx context.Context, client *netapp.VolumesClien return nil } -func waitForVolumeDeletion(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId) error { +func waitForVolumeDeletion(ctx context.Context, client *volumes.VolumesClient, id volumes.VolumeId) error { deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") @@ -817,40 +785,40 @@ func waitForVolumeDeletion(ctx context.Context, client *netapp.VolumesClient, id return nil } -func netappVolumeStateRefreshFunc(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId) pluginsdk.StateRefreshFunc { +func netappVolumeStateRefreshFunc(ctx context.Context, client *volumes.VolumesClient, id volumes.VolumeId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) + res, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(res.Response) { - return nil, "", fmt.Errorf("retrieving NetApp Volume %q (Resource Group %q): %s", id.Name, id.ResourceGroup, err) + if !response.WasNotFound(res.HttpResponse) { + return nil, "", fmt.Errorf("retrieving %s: %s", id, err) } } - return res, strconv.Itoa(res.StatusCode), nil + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil } } -func netappVolumeReplicationMirrorStateRefreshFunc(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId, desiredState string) pluginsdk.StateRefreshFunc { +func netappVolumeReplicationMirrorStateRefreshFunc(ctx context.Context, client *volumesreplication.VolumesReplicationClient, id volumesreplication.VolumeId, desiredState string) pluginsdk.StateRefreshFunc { validStates := []string{"mirrored", "broken", "uninitialized"} return func() (interface{}, string, error) { // Possible Mirror States to be used as desiredStates: // mirrored, broken or uninitialized if !utils.SliceContainsValue(validStates, strings.ToLower(desiredState)) { - return nil, "", fmt.Errorf("Invalid desired mirror state was passed to check mirror replication state (%s), possible values: (%+v)", desiredState, netapp.PossibleMirrorStateValues()) + return nil, "", fmt.Errorf("Invalid desired mirror state was passed to check mirror replication state (%s), possible values: (%+v)", desiredState, volumesreplication.PossibleValuesForMirrorState()) } - res, err := client.ReplicationStatusMethod(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) + res, err := client.VolumesReplicationStatus(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(res.Response) { - return nil, "", fmt.Errorf("retrieving replication status information from NetApp Volume %q (Resource Group %q): %s", id.Name, id.ResourceGroup, err) + if !response.WasNotFound(res.HttpResponse) { + return nil, "", fmt.Errorf("retrieving replication status information from %s: %s", id, err) } } // TODO: fix this refresh function to use strings instead of fake status codes // Setting 200 as default response response := 200 - if strings.EqualFold(string(res.MirrorState), desiredState) { + if res.Model != nil && res.Model.MirrorState != nil && strings.EqualFold(string(*res.Model.MirrorState), desiredState) { // return 204 if state matches desired state response = 204 } @@ -859,28 +827,30 @@ func netappVolumeReplicationMirrorStateRefreshFunc(ctx context.Context, client * } } -func netappVolumeReplicationStateRefreshFunc(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId) pluginsdk.StateRefreshFunc { +func netappVolumeReplicationStateRefreshFunc(ctx context.Context, client *volumesreplication.VolumesReplicationClient, id volumesreplication.VolumeId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.ReplicationStatusMethod(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) + res, err := client.VolumesReplicationStatus(ctx, id) if err != nil { - if res.StatusCode == 400 && (strings.Contains(strings.ToLower(err.Error()), "deleting") || strings.Contains(strings.ToLower(err.Error()), "volume replication missing or deleted")) { - // This error can be ignored until a bug is fixed on RP side that it is returning 400 while the replication is in "Deleting" process - // TODO: remove this workaround when above bug is fixed - } else if !utils.ResponseWasNotFound(res.Response) { - return nil, "", fmt.Errorf("retrieving replication status from NetApp Volume %q (Resource Group %q): %s", id.Name, id.ResourceGroup, err) + if httpResponse := res.HttpResponse; httpResponse != nil { + if httpResponse.StatusCode == 400 && (strings.Contains(strings.ToLower(err.Error()), "deleting") || strings.Contains(strings.ToLower(err.Error()), "volume replication missing or deleted")) { + // This error can be ignored until a bug is fixed on RP side that it is returning 400 while the replication is in "Deleting" process + // TODO: remove this workaround when above bug is fixed + } else if !response.WasNotFound(httpResponse) { + return nil, "", fmt.Errorf("retrieving replication status from %s: %s", id, err) + } } } - return res, strconv.Itoa(res.StatusCode), nil + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil } } -func expandNetAppVolumeExportPolicyRule(input []interface{}) *netapp.VolumePropertiesExportPolicy { - results := make([]netapp.ExportPolicyRule, 0) +func expandNetAppVolumeExportPolicyRule(input []interface{}) *volumes.VolumePropertiesExportPolicy { + results := make([]volumes.ExportPolicyRule, 0) for _, item := range input { if item != nil { v := item.(map[string]interface{}) - ruleIndex := int32(v["rule_index"].(int)) + ruleIndex := int64(v["rule_index"].(int)) allowedClients := strings.Join(*utils.ExpandStringSlice(v["allowed_clients"].(*pluginsdk.Set).List()), ",") cifsEnabled := false @@ -909,12 +879,12 @@ func expandNetAppVolumeExportPolicyRule(input []interface{}) *netapp.VolumePrope unixReadWrite := v["unix_read_write"].(bool) rootAccessEnabled := v["root_access_enabled"].(bool) - result := netapp.ExportPolicyRule{ + result := volumes.ExportPolicyRule{ AllowedClients: utils.String(allowedClients), Cifs: utils.Bool(cifsEnabled), Nfsv3: utils.Bool(nfsv3Enabled), Nfsv41: utils.Bool(nfsv41Enabled), - RuleIndex: utils.Int32(ruleIndex), + RuleIndex: utils.Int64(ruleIndex), UnixReadOnly: utils.Bool(unixReadOnly), UnixReadWrite: utils.Bool(unixReadWrite), HasRootAccess: utils.Bool(rootAccessEnabled), @@ -924,17 +894,17 @@ func expandNetAppVolumeExportPolicyRule(input []interface{}) *netapp.VolumePrope } } - return &netapp.VolumePropertiesExportPolicy{ + return &volumes.VolumePropertiesExportPolicy{ Rules: &results, } } -func expandNetAppVolumeExportPolicyRulePatch(input []interface{}) *netapp.VolumePatchPropertiesExportPolicy { - results := make([]netapp.ExportPolicyRule, 0) +func expandNetAppVolumeExportPolicyRulePatch(input []interface{}) *volumes.VolumePatchPropertiesExportPolicy { + results := make([]volumes.ExportPolicyRule, 0) for _, item := range input { if item != nil { v := item.(map[string]interface{}) - ruleIndex := int32(v["rule_index"].(int)) + ruleIndex := int64(v["rule_index"].(int)) allowedClients := strings.Join(*utils.ExpandStringSlice(v["allowed_clients"].(*pluginsdk.Set).List()), ",") cifsEnabled := false @@ -963,12 +933,12 @@ func expandNetAppVolumeExportPolicyRulePatch(input []interface{}) *netapp.Volume unixReadWrite := v["unix_read_write"].(bool) rootAccessEnabled := v["root_access_enabled"].(bool) - result := netapp.ExportPolicyRule{ + result := volumes.ExportPolicyRule{ AllowedClients: utils.String(allowedClients), Cifs: utils.Bool(cifsEnabled), Nfsv3: utils.Bool(nfsv3Enabled), Nfsv41: utils.Bool(nfsv41Enabled), - RuleIndex: utils.Int32(ruleIndex), + RuleIndex: utils.Int64(ruleIndex), UnixReadOnly: utils.Bool(unixReadOnly), UnixReadWrite: utils.Bool(unixReadWrite), HasRootAccess: utils.Bool(rootAccessEnabled), @@ -978,82 +948,84 @@ func expandNetAppVolumeExportPolicyRulePatch(input []interface{}) *netapp.Volume } } - return &netapp.VolumePatchPropertiesExportPolicy{ + return &volumes.VolumePatchPropertiesExportPolicy{ Rules: &results, } } -func expandNetAppVolumeDataProtectionReplication(input []interface{}) *netapp.VolumePropertiesDataProtection { +func expandNetAppVolumeDataProtectionReplication(input []interface{}) *volumes.VolumePropertiesDataProtection { if len(input) == 0 || input[0] == nil { - return &netapp.VolumePropertiesDataProtection{} + return &volumes.VolumePropertiesDataProtection{} } - replicationObject := netapp.ReplicationObject{} + replicationObject := volumes.ReplicationObject{} replicationRaw := input[0].(map[string]interface{}) if v, ok := replicationRaw["endpoint_type"]; ok { - replicationObject.EndpointType = netapp.EndpointType(v.(string)) + endpointType := volumes.EndpointType(v.(string)) + replicationObject.EndpointType = &endpointType } if v, ok := replicationRaw["remote_volume_location"]; ok { replicationObject.RemoteVolumeRegion = utils.String(v.(string)) } if v, ok := replicationRaw["remote_volume_resource_id"]; ok { - replicationObject.RemoteVolumeResourceID = utils.String(v.(string)) + replicationObject.RemoteVolumeResourceId = v.(string) } if v, ok := replicationRaw["replication_frequency"]; ok { - replicationObject.ReplicationSchedule = netapp.ReplicationSchedule(translateTFSchedule(v.(string))) + replicationSchedule := volumes.ReplicationSchedule(translateTFSchedule(v.(string))) + replicationObject.ReplicationSchedule = &replicationSchedule } - return &netapp.VolumePropertiesDataProtection{ + return &volumes.VolumePropertiesDataProtection{ Replication: &replicationObject, } } -func expandNetAppVolumeDataProtectionSnapshotPolicy(input []interface{}) *netapp.VolumePropertiesDataProtection { +func expandNetAppVolumeDataProtectionSnapshotPolicy(input []interface{}) *volumes.VolumePropertiesDataProtection { if len(input) == 0 || input[0] == nil { - return &netapp.VolumePropertiesDataProtection{} + return &volumes.VolumePropertiesDataProtection{} } - snapshotObject := netapp.VolumeSnapshotProperties{} + snapshotObject := volumes.VolumeSnapshotProperties{} snapshotRaw := input[0].(map[string]interface{}) if v, ok := snapshotRaw["snapshot_policy_id"]; ok { - snapshotObject.SnapshotPolicyID = utils.String(v.(string)) + snapshotObject.SnapshotPolicyId = utils.String(v.(string)) } - return &netapp.VolumePropertiesDataProtection{ + return &volumes.VolumePropertiesDataProtection{ Snapshot: &snapshotObject, } } -func expandNetAppVolumeDataProtectionSnapshotPolicyPatch(input []interface{}) *netapp.VolumePatchPropertiesDataProtection { +func expandNetAppVolumeDataProtectionSnapshotPolicyPatch(input []interface{}) *volumes.VolumePatchPropertiesDataProtection { if len(input) == 0 || input[0] == nil { - return &netapp.VolumePatchPropertiesDataProtection{} + return &volumes.VolumePatchPropertiesDataProtection{} } - snapshotObject := netapp.VolumeSnapshotProperties{} + snapshotObject := volumes.VolumeSnapshotProperties{} snapshotRaw := input[0].(map[string]interface{}) if v, ok := snapshotRaw["snapshot_policy_id"]; ok { - snapshotObject.SnapshotPolicyID = utils.String(v.(string)) + snapshotObject.SnapshotPolicyId = utils.String(v.(string)) } - return &netapp.VolumePatchPropertiesDataProtection{ + return &volumes.VolumePatchPropertiesDataProtection{ Snapshot: &snapshotObject, } } -func flattenNetAppVolumeExportPolicyRule(input *netapp.VolumePropertiesExportPolicy) []interface{} { +func flattenNetAppVolumeExportPolicyRule(input *volumes.VolumePropertiesExportPolicy) []interface{} { results := make([]interface{}, 0) if input == nil || input.Rules == nil { return results } for _, item := range *input.Rules { - ruleIndex := int32(0) + ruleIndex := int64(0) if v := item.RuleIndex; v != nil { ruleIndex = *v } @@ -1105,7 +1077,7 @@ func flattenNetAppVolumeExportPolicyRule(input *netapp.VolumePropertiesExportPol return results } -func flattenNetAppVolumeMountIPAddresses(input *[]netapp.MountTargetProperties) []interface{} { +func flattenNetAppVolumeMountIPAddresses(input *[]volumes.MountTargetProperties) []interface{} { results := make([]interface{}, 0) if input == nil { return results @@ -1120,33 +1092,38 @@ func flattenNetAppVolumeMountIPAddresses(input *[]netapp.MountTargetProperties) return results } -func flattenNetAppVolumeDataProtectionReplication(input *netapp.VolumePropertiesDataProtection) []interface{} { - if input == nil || input.Replication == nil { +func flattenNetAppVolumeDataProtectionReplication(input *volumes.VolumePropertiesDataProtection) []interface{} { + if input == nil || input.Replication == nil || input.Replication.EndpointType == nil { return []interface{}{} } - if strings.ToLower(string(input.Replication.EndpointType)) == "" || strings.ToLower(string(input.Replication.EndpointType)) != "dst" { + if strings.ToLower(string(*input.Replication.EndpointType)) == "" || strings.ToLower(string(*input.Replication.EndpointType)) != "dst" { return []interface{}{} } + replicationFrequency := "" + if input.Replication.ReplicationSchedule != nil { + replicationFrequency = translateSDKSchedule(strings.ToLower(string(*input.Replication.ReplicationSchedule))) + } + return []interface{}{ map[string]interface{}{ - "endpoint_type": strings.ToLower(string(input.Replication.EndpointType)), + "endpoint_type": strings.ToLower(string(*input.Replication.EndpointType)), "remote_volume_location": location.NormalizeNilable(input.Replication.RemoteVolumeRegion), - "remote_volume_resource_id": input.Replication.RemoteVolumeResourceID, - "replication_frequency": translateSDKSchedule(strings.ToLower(string(input.Replication.ReplicationSchedule))), + "remote_volume_resource_id": input.Replication.RemoteVolumeResourceId, + "replication_frequency": replicationFrequency, }, } } -func flattenNetAppVolumeDataProtectionSnapshotPolicy(input *netapp.VolumePropertiesDataProtection) []interface{} { +func flattenNetAppVolumeDataProtectionSnapshotPolicy(input *volumes.VolumePropertiesDataProtection) []interface{} { if input == nil || input.Snapshot == nil { return []interface{}{} } return []interface{}{ map[string]interface{}{ - "snapshot_policy_id": input.Snapshot.SnapshotPolicyID, + "snapshot_policy_id": input.Snapshot.SnapshotPolicyId, }, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse/account.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse/account.go deleted file mode 100644 index bdda02573d6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse/account.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type AccountId struct { - SubscriptionId string - ResourceGroup string - NetAppAccountName string -} - -func NewAccountID(subscriptionId, resourceGroup, netAppAccountName string) AccountId { - return AccountId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NetAppAccountName: netAppAccountName, - } -} - -func (id AccountId) String() string { - segments := []string{ - fmt.Sprintf("Net App Account Name %q", id.NetAppAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Account", segmentsStr) -} - -func (id AccountId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetAppAccountName) -} - -// AccountID parses a Account ID into an AccountId struct -func AccountID(input string) (*AccountId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := AccountId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NetAppAccountName, err = id.PopSegment("netAppAccounts"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse/capacity_pool.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse/capacity_pool.go deleted file mode 100644 index 21aaba80444..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse/capacity_pool.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type CapacityPoolId struct { - SubscriptionId string - ResourceGroup string - NetAppAccountName string - Name string -} - -func NewCapacityPoolID(subscriptionId, resourceGroup, netAppAccountName, name string) CapacityPoolId { - return CapacityPoolId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NetAppAccountName: netAppAccountName, - Name: name, - } -} - -func (id CapacityPoolId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Net App Account Name %q", id.NetAppAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Capacity Pool", segmentsStr) -} - -func (id CapacityPoolId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetAppAccountName, id.Name) -} - -// CapacityPoolID parses a CapacityPool ID into an CapacityPoolId struct -func CapacityPoolID(input string) (*CapacityPoolId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := CapacityPoolId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NetAppAccountName, err = id.PopSegment("netAppAccounts"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("capacityPools"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse/snapshot.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse/snapshot.go deleted file mode 100644 index a12d38e21aa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse/snapshot.go +++ /dev/null @@ -1,87 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type SnapshotId struct { - SubscriptionId string - ResourceGroup string - NetAppAccountName string - CapacityPoolName string - VolumeName string - Name string -} - -func NewSnapshotID(subscriptionId, resourceGroup, netAppAccountName, capacityPoolName, volumeName, name string) SnapshotId { - return SnapshotId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - Name: name, - } -} - -func (id SnapshotId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Volume Name %q", id.VolumeName), - fmt.Sprintf("Capacity Pool Name %q", id.CapacityPoolName), - fmt.Sprintf("Net App Account Name %q", id.NetAppAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Snapshot", segmentsStr) -} - -func (id SnapshotId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/snapshots/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.Name) -} - -// SnapshotID parses a Snapshot ID into an SnapshotId struct -func SnapshotID(input string) (*SnapshotId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := SnapshotId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NetAppAccountName, err = id.PopSegment("netAppAccounts"); err != nil { - return nil, err - } - if resourceId.CapacityPoolName, err = id.PopSegment("capacityPools"); err != nil { - return nil, err - } - if resourceId.VolumeName, err = id.PopSegment("volumes"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("snapshots"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse/snapshot_policy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse/snapshot_policy.go deleted file mode 100644 index 17de0f50ed1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse/snapshot_policy.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type SnapshotPolicyId struct { - SubscriptionId string - ResourceGroup string - NetAppAccountName string - Name string -} - -func NewSnapshotPolicyID(subscriptionId, resourceGroup, netAppAccountName, name string) SnapshotPolicyId { - return SnapshotPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NetAppAccountName: netAppAccountName, - Name: name, - } -} - -func (id SnapshotPolicyId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Net App Account Name %q", id.NetAppAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Snapshot Policy", segmentsStr) -} - -func (id SnapshotPolicyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/snapshotPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetAppAccountName, id.Name) -} - -// SnapshotPolicyID parses a SnapshotPolicy ID into an SnapshotPolicyId struct -func SnapshotPolicyID(input string) (*SnapshotPolicyId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := SnapshotPolicyId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NetAppAccountName, err = id.PopSegment("netAppAccounts"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("snapshotPolicies"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse/volume.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse/volume.go deleted file mode 100644 index 30029b460d5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse/volume.go +++ /dev/null @@ -1,81 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type VolumeId struct { - SubscriptionId string - ResourceGroup string - NetAppAccountName string - CapacityPoolName string - Name string -} - -func NewVolumeID(subscriptionId, resourceGroup, netAppAccountName, capacityPoolName, name string) VolumeId { - return VolumeId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - Name: name, - } -} - -func (id VolumeId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Capacity Pool Name %q", id.CapacityPoolName), - fmt.Sprintf("Net App Account Name %q", id.NetAppAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Volume", segmentsStr) -} - -func (id VolumeId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) -} - -// VolumeID parses a Volume ID into an VolumeId struct -func VolumeID(input string) (*VolumeId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := VolumeId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NetAppAccountName, err = id.PopSegment("netAppAccounts"); err != nil { - return nil, err - } - if resourceId.CapacityPoolName, err = id.PopSegment("capacityPools"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("volumes"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/resourceids.go deleted file mode 100644 index 327b574023b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/resourceids.go +++ /dev/null @@ -1,7 +0,0 @@ -package netapp - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Account -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=CapacityPool -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Snapshot -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1/snapshots/snapshot1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SnapshotPolicy -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/snapshotPolicies/snapshotpolicy1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Volume -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate/account_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate/account_id.go deleted file mode 100644 index 9ad84a7c705..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate/account_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" -) - -func AccountID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.AccountID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate/capacity_pool_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate/capacity_pool_id.go deleted file mode 100644 index 461352e31b2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate/capacity_pool_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" -) - -func CapacityPoolID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.CapacityPoolID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate/snapshot_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate/snapshot_id.go deleted file mode 100644 index 1f5cea117a6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate/snapshot_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" -) - -func SnapshotID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.SnapshotID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate/snapshot_policy_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate/snapshot_policy_id.go deleted file mode 100644 index 33efd5e77ad..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate/snapshot_policy_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" -) - -func SnapshotPolicyID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.SnapshotPolicyID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate/volume_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate/volume_id.go deleted file mode 100644 index c96095fbc39..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate/volume_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" -) - -func VolumeID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.VolumeID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/application_gateway_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/application_gateway_data_source.go index 380f5c42c45..3d5c17636aa 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/application_gateway_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/application_gateway_data_source.go @@ -5,7 +5,6 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/application_gateway_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/application_gateway_resource.go index a57b3f46a4b..4ddbe76d764 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/application_gateway_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/application_gateway_resource.go @@ -325,6 +325,7 @@ func resourceApplicationGateway() *pluginsdk.Resource { "private_ip_address": { Type: pluginsdk.TypeString, Optional: true, + Computed: true, }, "public_ip_address_id": { @@ -409,6 +410,24 @@ func resourceApplicationGateway() *pluginsdk.Resource { }, }, + "global": { + Type: pluginsdk.TypeList, + MaxItems: 1, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "request_buffering_enabled": { + Type: pluginsdk.TypeBool, + Required: true, + }, + "response_buffering_enabled": { + Type: pluginsdk.TypeBool, + Required: true, + }, + }, + }, + }, + //lintignore:S016,S023 "http_listener": { Type: pluginsdk.TypeSet, @@ -663,7 +682,7 @@ func resourceApplicationGateway() *pluginsdk.Resource { "priority": { Type: pluginsdk.TypeInt, - Required: true, + Optional: true, ValidateFunc: validation.IntBetween(1, 20000), }, @@ -966,7 +985,7 @@ func resourceApplicationGateway() *pluginsdk.Resource { Schema: map[string]*pluginsdk.Schema{ "body": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, }, "status_code": { @@ -1092,6 +1111,17 @@ func resourceApplicationGateway() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, }, + + "components": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "path_only", + "query_string_only", + }, false), + }, + "reroute": { Type: pluginsdk.TypeBool, Optional: true, @@ -1561,6 +1591,11 @@ func resourceApplicationGatewayCreate(d *pluginsdk.ResourceData, meta interface{ gatewayIPConfigurations, stopApplicationGateway := expandApplicationGatewayIPConfigurations(d) + globalConfiguration, err := expandApplicationGatewayGlobalConfiguration(d.Get("global").([]interface{})) + if err != nil { + return fmt.Errorf("expanding `global`: %+v", err) + } + httpListeners, err := expandApplicationGatewayHTTPListeners(d, id.ID()) if err != nil { return fmt.Errorf("fail to expand `http_listener`: %+v", err) @@ -1585,6 +1620,7 @@ func resourceApplicationGatewayCreate(d *pluginsdk.ResourceData, meta interface{ FrontendIPConfigurations: expandApplicationGatewayFrontendIPConfigurations(d, id.ID()), FrontendPorts: expandApplicationGatewayFrontendPorts(d), GatewayIPConfigurations: gatewayIPConfigurations, + GlobalConfiguration: globalConfiguration, HTTPListeners: httpListeners, PrivateLinkConfigurations: expandApplicationGatewayPrivateLinkConfigurations(d), Probes: expandApplicationGatewayProbes(d), @@ -1793,6 +1829,15 @@ func resourceApplicationGatewayUpdate(d *pluginsdk.ResourceData, meta interface{ applicationGateway.ApplicationGatewayPropertiesFormat.GatewayIPConfigurations = gatewayIPConfigurations } + if d.HasChange("global") { + globalConfiguration, err := expandApplicationGatewayGlobalConfiguration(d.Get("global").([]interface{})) + if err != nil { + return fmt.Errorf("expanding `global`: %+v", err) + } + + applicationGateway.ApplicationGatewayPropertiesFormat.GlobalConfiguration = globalConfiguration + } + if d.HasChange("http_listener") { httpListeners, err := expandApplicationGatewayHTTPListeners(d, id.ID()) if err != nil { @@ -2052,6 +2097,10 @@ func resourceApplicationGatewayRead(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("setting `gateway_ip_configuration`: %+v", setErr) } + if setErr := d.Set("global", flattenApplicationGatewayGlobalConfiguration(props.GlobalConfiguration)); setErr != nil { + return fmt.Errorf("setting `global`: %+v", setErr) + } + if setErr := d.Set("private_endpoint_connection", flattenApplicationGatewayPrivateEndpoints(props.PrivateEndpointConnections)); setErr != nil { return fmt.Errorf("setting `private_endpoint_connection`: %+v", setErr) } @@ -2966,6 +3015,36 @@ func flattenApplicationGatewayIPConfigurations(input *[]network.ApplicationGatew return results } +func expandApplicationGatewayGlobalConfiguration(input []interface{}) (*network.ApplicationGatewayGlobalConfiguration, error) { + if len(input) == 0 { + return nil, nil + } + + v := input[0].(map[string]interface{}) + return &network.ApplicationGatewayGlobalConfiguration{ + EnableRequestBuffering: utils.Bool(v["request_buffering_enabled"].(bool)), + EnableResponseBuffering: utils.Bool(v["response_buffering_enabled"].(bool)), + }, nil +} + +func flattenApplicationGatewayGlobalConfiguration(input *network.ApplicationGatewayGlobalConfiguration) []interface{} { + if input == nil { + return nil + } + + output := make(map[string]interface{}) + + if input.EnableRequestBuffering != nil { + output["request_buffering_enabled"] = *input.EnableRequestBuffering + } + + if input.EnableResponseBuffering != nil { + output["response_buffering_enabled"] = *input.EnableResponseBuffering + } + + return []interface{}{output} +} + func expandApplicationGatewayFrontendPorts(d *pluginsdk.ResourceData) *[]network.ApplicationGatewayFrontendPort { vs := d.Get("frontend_port").(*pluginsdk.Set).List() results := make([]network.ApplicationGatewayFrontendPort, 0) @@ -3599,10 +3678,14 @@ func expandApplicationGatewayRewriteRuleSets(d *pluginsdk.ResourceData) (*[]netw if c["path"] == nil && c["query_string"] == nil { return nil, fmt.Errorf("At least one of `path` or `query_string` must be set") } - if c["path"] != nil { + components := "" + if c["components"] != nil { + components = c["components"].(string) + } + if c["path"] != nil && components != "query_string_only" { urlConfiguration.ModifiedPath = utils.String(c["path"].(string)) } - if c["query_string"] != nil { + if c["query_string"] != nil && components != "path_only" { urlConfiguration.ModifiedQueryString = utils.String(c["query_string"].(string)) } if c["reroute"] != nil { @@ -3733,20 +3816,36 @@ func flattenApplicationGatewayRewriteRuleSets(input *[]network.ApplicationGatewa if actionSet.URLConfiguration != nil { config := *actionSet.URLConfiguration - urlConfig := map[string]interface{}{} - + components := "" + path := "" if config.ModifiedPath != nil { - urlConfig["path"] = *config.ModifiedPath + path = *config.ModifiedPath } + queryString := "" if config.ModifiedQueryString != nil { - urlConfig["query_string"] = *config.ModifiedQueryString + queryString = *config.ModifiedQueryString + } + + if path != queryString { + if path != "" && queryString == "" { + components = "path_only" + } else if queryString != "" && path == "" { + components = "query_string_only" + } } + reroute := false if config.Reroute != nil { - urlConfig["reroute"] = *config.Reroute + reroute = *config.Reroute } - urlConfigs = append(urlConfigs, urlConfig) + + urlConfigs = append(urlConfigs, map[string]interface{}{ + "components": components, + "query_string": queryString, + "path": path, + "reroute": reroute, + }) } } ruleOutput["request_header_configuration"] = requestConfigs @@ -4444,6 +4543,9 @@ func flattenApplicationGatewayURLPathMaps(input *[]network.ApplicationGatewayURL func expandApplicationGatewayWafConfig(d *pluginsdk.ResourceData) *network.ApplicationGatewayWebApplicationFirewallConfiguration { vs := d.Get("waf_configuration").([]interface{}) + if len(vs) == 0 || vs[0] == nil { + return nil + } v := vs[0].(map[string]interface{}) enabled := v["enabled"].(bool) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/express_route_circuit_peering_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/express_route_circuit_peering_resource.go index 250c9b10e0e..e29705151b2 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/express_route_circuit_peering_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/express_route_circuit_peering_resource.go @@ -58,12 +58,24 @@ func resourceExpressRouteCircuitPeering() *pluginsdk.Resource { "primary_peer_address_prefix": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, + RequiredWith: []string{ + "secondary_peer_address_prefix", + }, }, "secondary_peer_address_prefix": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, + RequiredWith: []string{ + "primary_peer_address_prefix", + }, + }, + + "ipv4_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, }, "vlan_id": { @@ -119,7 +131,7 @@ func resourceExpressRouteCircuitPeering() *pluginsdk.Resource { Schema: map[string]*pluginsdk.Schema{ "microsoft_peering": { Type: pluginsdk.TypeList, - Required: true, + Optional: true, MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ @@ -159,6 +171,12 @@ func resourceExpressRouteCircuitPeering() *pluginsdk.Resource { Required: true, }, + "enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + "route_filter_id": { Type: pluginsdk.TypeString, Optional: true, @@ -188,6 +206,11 @@ func resourceExpressRouteCircuitPeering() *pluginsdk.Resource { Optional: true, ValidateFunc: azure.ValidateResourceID, }, + + "gateway_manager_etag": { + Type: pluginsdk.TypeString, + Computed: true, + }, }, } } @@ -228,20 +251,38 @@ func resourceExpressRouteCircuitPeeringCreateUpdate(d *pluginsdk.ResourceData, m parameters := network.ExpressRouteCircuitPeering{ ExpressRouteCircuitPeeringPropertiesFormat: &network.ExpressRouteCircuitPeeringPropertiesFormat{ - PeeringType: network.ExpressRoutePeeringType(id.PeeringName), - SharedKey: utils.String(sharedKey), - PrimaryPeerAddressPrefix: utils.String(primaryPeerAddressPrefix), - SecondaryPeerAddressPrefix: utils.String(secondaryPeerAddressPrefix), - AzureASN: utils.Int32(int32(azureASN)), - PeerASN: utils.Int64(int64(peerASN)), - VlanID: utils.Int32(int32(vlanId)), + PeeringType: network.ExpressRoutePeeringType(id.PeeringName), + SharedKey: utils.String(sharedKey), + AzureASN: utils.Int32(int32(azureASN)), + PeerASN: utils.Int64(int64(peerASN)), + VlanID: utils.Int32(int32(vlanId)), + GatewayManagerEtag: utils.String(d.Get("gateway_manager_etag").(string)), }, } + ipv4Enabled := d.Get("ipv4_enabled").(bool) + if ipv4Enabled { + parameters.ExpressRouteCircuitPeeringPropertiesFormat.State = network.ExpressRoutePeeringStateEnabled + } else { + parameters.ExpressRouteCircuitPeeringPropertiesFormat.State = network.ExpressRoutePeeringStateDisabled + } + + if !strings.EqualFold(primaryPeerAddressPrefix, "") { + parameters.PrimaryPeerAddressPrefix = utils.String(primaryPeerAddressPrefix) + } + + if !strings.EqualFold(secondaryPeerAddressPrefix, "") { + parameters.SecondaryPeerAddressPrefix = utils.String(secondaryPeerAddressPrefix) + } + if strings.EqualFold(id.PeeringName, string(network.ExpressRoutePeeringTypeMicrosoftPeering)) { peerings := d.Get("microsoft_peering_config").([]interface{}) - if len(peerings) == 0 { - return fmt.Errorf("`microsoft_peering_config` must be specified when `peering_type` is set to `MicrosoftPeering`") + if len(peerings) == 0 && primaryPeerAddressPrefix != "" { + return fmt.Errorf("`microsoft_peering_config` must be specified when config for Ipv4 and `peering_type` is set to `MicrosoftPeering`") + } + + if len(peerings) != 0 && (primaryPeerAddressPrefix == "" || secondaryPeerAddressPrefix == "") { + return fmt.Errorf("`primary_peer_address_prefix, secondary_peer_address_prefix` must be specified when config for Ipv4") } peeringConfig := expandExpressRouteCircuitPeeringMicrosoftConfig(peerings) @@ -252,23 +293,20 @@ func resourceExpressRouteCircuitPeeringCreateUpdate(d *pluginsdk.ResourceData, m ID: utils.String(route_filter_id), } } + } else if route_filter_id != "" { + return fmt.Errorf("`route_filter_id` may only be specified when `peering_type` is set to `MicrosoftPeering`") + } - ipv6Peering := d.Get("ipv6").([]interface{}) - ipv6PeeringConfig, err := expandExpressRouteCircuitIpv6PeeringConfig(ipv6Peering) - if err != nil { - return err - } - parameters.ExpressRouteCircuitPeeringPropertiesFormat.Ipv6PeeringConfig = ipv6PeeringConfig - } else { - if route_filter_id != "" { - return fmt.Errorf("`route_filter_id` may only be specified when `peering_type` is set to `MicrosoftPeering`") - } + ipv6Peering := d.Get("ipv6").([]interface{}) + if len(ipv6Peering) != 0 && id.PeeringName == string(network.ExpressRoutePeeringTypeAzurePublicPeering) { + return fmt.Errorf("`ipv6` may only be specified when `peering_type` is `MicrosoftPeering` or `AzurePrivatePeering`") + } - ipv6Peering := d.Get("ipv6").([]interface{}) - if len(ipv6Peering) != 0 { - return fmt.Errorf("`ipv6` may only be specified when `peering_type` is set to `MicrosoftPeering`") - } + ipv6PeeringConfig, err := expandExpressRouteCircuitIpv6PeeringConfig(ipv6Peering) + if err != nil { + return err } + parameters.ExpressRouteCircuitPeeringPropertiesFormat.Ipv6PeeringConfig = ipv6PeeringConfig future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ExpressRouteCircuitName, id.PeeringName, parameters) if err != nil { @@ -315,6 +353,8 @@ func resourceExpressRouteCircuitPeeringRead(d *pluginsdk.ResourceData, meta inte d.Set("primary_peer_address_prefix", props.PrimaryPeerAddressPrefix) d.Set("secondary_peer_address_prefix", props.SecondaryPeerAddressPrefix) d.Set("vlan_id", props.VlanID) + d.Set("gateway_manager_etag", props.GatewayManagerEtag) + d.Set("ipv4_enabled", props.State == network.ExpressRoutePeeringStateEnabled) routeFilterId := "" if props.RouteFilter != nil && props.RouteFilter.ID != nil { @@ -388,10 +428,24 @@ func expandExpressRouteCircuitIpv6PeeringConfig(input []interface{}) (*network.I v := input[0].(map[string]interface{}) peeringConfig := network.Ipv6ExpressRouteCircuitPeeringConfig{ - PrimaryPeerAddressPrefix: utils.String(v["primary_peer_address_prefix"].(string)), - SecondaryPeerAddressPrefix: utils.String(v["secondary_peer_address_prefix"].(string)), - MicrosoftPeeringConfig: expandExpressRouteCircuitPeeringMicrosoftConfig(v["microsoft_peering"].([]interface{})), + MicrosoftPeeringConfig: expandExpressRouteCircuitPeeringMicrosoftConfig(v["microsoft_peering"].([]interface{})), + State: network.ExpressRouteCircuitPeeringStateEnabled, } + + primaryPeerAddressPrefix := v["primary_peer_address_prefix"].(string) + secondaryPeerAddressPrefix := v["secondary_peer_address_prefix"].(string) + if !strings.EqualFold(primaryPeerAddressPrefix, "") { + peeringConfig.PrimaryPeerAddressPrefix = utils.String(primaryPeerAddressPrefix) + } + if !strings.EqualFold(secondaryPeerAddressPrefix, "") { + peeringConfig.SecondaryPeerAddressPrefix = utils.String(secondaryPeerAddressPrefix) + } + + ipv6Enabled := v["enabled"].(bool) + if !ipv6Enabled { + peeringConfig.State = network.ExpressRouteCircuitPeeringStateDisabled + } + routeFilterId := v["route_filter_id"].(string) if routeFilterId != "" { if _, err := parse.RouteFilterID(routeFilterId); err != nil { @@ -448,6 +502,7 @@ func flattenExpressRouteCircuitIpv6PeeringConfig(input *network.Ipv6ExpressRoute "primary_peer_address_prefix": primaryPeerAddressPrefix, "secondary_peer_address_prefix": secondaryPeerAddressPrefix, "route_filter_id": routeFilterId, + "enabled": input.State == network.ExpressRouteCircuitPeeringStateEnabled, }, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/network_interface_network_security_group_association_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/network_interface_network_security_group_association_resource.go index 55c4412e64e..13148458804 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/network_interface_network_security_group_association_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/network_interface_network_security_group_association_resource.go @@ -6,13 +6,12 @@ import ( "strings" "time" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/azuresdkhacks" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/azuresdkhacks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/network_interface_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/network_interface_resource.go index 2e2cd8db894..ed54d35b886 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/network_interface_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/network_interface_resource.go @@ -5,10 +5,9 @@ import ( "log" "time" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse/virtual_machine_scale_set_public_ip_address.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse/virtual_machine_scale_set_public_ip_address.go new file mode 100644 index 00000000000..9b4765ffbed --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse/virtual_machine_scale_set_public_ip_address.go @@ -0,0 +1,93 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type VirtualMachineScaleSetPublicIPAddressId struct { + SubscriptionId string + ResourceGroup string + VirtualMachineScaleSetName string + VirtualMachineName string + NetworkInterfaceName string + IpConfigurationName string + PublicIPAddressName string +} + +func NewVirtualMachineScaleSetPublicIPAddressID(subscriptionId, resourceGroup, virtualMachineScaleSetName, virtualMachineName, networkInterfaceName, ipConfigurationName, publicIPAddressName string) VirtualMachineScaleSetPublicIPAddressId { + return VirtualMachineScaleSetPublicIPAddressId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + VirtualMachineName: virtualMachineName, + NetworkInterfaceName: networkInterfaceName, + IpConfigurationName: ipConfigurationName, + PublicIPAddressName: publicIPAddressName, + } +} + +func (id VirtualMachineScaleSetPublicIPAddressId) String() string { + segments := []string{ + fmt.Sprintf("Public I P Address Name %q", id.PublicIPAddressName), + fmt.Sprintf("Ip Configuration Name %q", id.IpConfigurationName), + fmt.Sprintf("Network Interface Name %q", id.NetworkInterfaceName), + fmt.Sprintf("Virtual Machine Name %q", id.VirtualMachineName), + fmt.Sprintf("Virtual Machine Scale Set Name %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Virtual Machine Scale Set Public I P Address", segmentsStr) +} + +func (id VirtualMachineScaleSetPublicIPAddressId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%s/networkInterfaces/%s/ipConfigurations/%s/publicIPAddresses/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.VirtualMachineScaleSetName, id.VirtualMachineName, id.NetworkInterfaceName, id.IpConfigurationName, id.PublicIPAddressName) +} + +// VirtualMachineScaleSetPublicIPAddressID parses a VirtualMachineScaleSetPublicIPAddress ID into an VirtualMachineScaleSetPublicIPAddressId struct +func VirtualMachineScaleSetPublicIPAddressID(input string) (*VirtualMachineScaleSetPublicIPAddressId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := VirtualMachineScaleSetPublicIPAddressId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.VirtualMachineScaleSetName, err = id.PopSegment("virtualMachineScaleSets"); err != nil { + return nil, err + } + if resourceId.VirtualMachineName, err = id.PopSegment("virtualMachines"); err != nil { + return nil, err + } + if resourceId.NetworkInterfaceName, err = id.PopSegment("networkInterfaces"); err != nil { + return nil, err + } + if resourceId.IpConfigurationName, err = id.PopSegment("ipConfigurations"); err != nil { + return nil, err + } + if resourceId.PublicIPAddressName, err = id.PopSegment("publicIPAddresses"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/private_endpoint_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/private_endpoint_resource.go index 62c5bfe7ac6..548acbeadba 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/private_endpoint_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/private_endpoint_resource.go @@ -8,22 +8,22 @@ import ( "strings" "time" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + mariaDB "github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones" + "github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" cosmosParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/parse" - mariaDBParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse" mysqlParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" - postgresqlParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -283,6 +283,15 @@ func resourcePrivateEndpointCreate(d *pluginsdk.ResourceData, meta interface{}) Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } + err = validatePrivateLinkServiceId(*parameters.PrivateEndpointProperties.PrivateLinkServiceConnections) + if err != nil { + return err + } + err = validatePrivateLinkServiceId(*parameters.PrivateEndpointProperties.ManualPrivateLinkServiceConnections) + if err != nil { + return err + } + cosmosDbResIds := getCosmosDbResIdInPrivateServiceConnections(parameters.PrivateEndpointProperties) for _, cosmosDbResId := range cosmosDbResIds { log.Printf("[DEBUG] Add Lock For Private Endpoint %q, lock name: %q", id.Name, cosmosDbResId) @@ -290,17 +299,45 @@ func resourcePrivateEndpointCreate(d *pluginsdk.ResourceData, meta interface{}) //goland:noinspection GoDeferInLoop defer locks.UnlockByName(cosmosDbResId, "azurerm_private_endpoint") } + locks.ByName(subnetId, "azurerm_private_endpoint") + defer locks.UnlockByName(subnetId, "azurerm_private_endpoint") - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, parameters) - if err != nil { - if strings.EqualFold(err.Error(), "is missing required parameter 'group Id'") { - return fmt.Errorf("creating Private Endpoint %q (Resource Group %q) due to missing 'group Id', ensure that the 'subresource_names' type is populated: %+v", id.Name, id.ResourceGroup, err) - } else { - return fmt.Errorf("creating Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *resource.RetryError { + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, parameters) + if err != nil { + switch { + case strings.EqualFold(err.Error(), "is missing required parameter 'group Id'"): + { + return &resource.RetryError{ + Err: fmt.Errorf("creating Private Endpoint %q (Resource Group %q) due to missing 'group Id', ensure that the 'subresource_names' type is populated: %+v", id.Name, id.ResourceGroup, err), + Retryable: false, + } + } + case strings.Contains(err.Error(), "PrivateLinkServiceId Invalid private link service id"): + { + return &resource.RetryError{ + Err: fmt.Errorf("creating Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err), + Retryable: true, + } + } + default: + return &resource.RetryError{ + Err: fmt.Errorf("creating Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err), + Retryable: false, + } + } } - } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return &resource.RetryError{ + Err: fmt.Errorf("waiting for creation of Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err), + Retryable: false, + } + } + return nil + }) + if err != nil { + return err } d.SetId(id.ID()) @@ -318,6 +355,20 @@ func resourcePrivateEndpointCreate(d *pluginsdk.ResourceData, meta interface{}) return resourcePrivateEndpointRead(d, meta) } +func validatePrivateLinkServiceId(endpoints []network.PrivateLinkServiceConnection) error { + for _, connection := range endpoints { + _, errors := azure.ValidateResourceID(*connection.PrivateLinkServiceID, "PrivateLinkServiceID") + if len(errors) == 0 { + continue + } + _, errors = validate.PrivateConnectionResourceAlias(*connection.PrivateLinkServiceID, "PrivateLinkServiceID") + if len(errors) != 0 { + return fmt.Errorf("PrivateLinkServiceId Invalid: %q", *connection.PrivateLinkServiceID) + } + } + return nil +} + func getCosmosDbResIdInPrivateServiceConnections(p *network.PrivateEndpointProperties) []string { var ids []string exists := make(map[string]struct{}) @@ -380,16 +431,53 @@ func resourcePrivateEndpointUpdate(d *pluginsdk.ResourceData, meta interface{}) Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, parameters) + err = validatePrivateLinkServiceId(*parameters.PrivateEndpointProperties.PrivateLinkServiceConnections) if err != nil { - if strings.EqualFold(err.Error(), "is missing required parameter 'group Id'") { - return fmt.Errorf("updating Private Endpoint %q (Resource Group %q) due to missing 'group Id', ensure that the 'subresource_names' type is populated: %+v", id.Name, id.ResourceGroup, err) - } else { - return fmt.Errorf("updating Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } + return err } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + err = validatePrivateLinkServiceId(*parameters.PrivateEndpointProperties.ManualPrivateLinkServiceConnections) + if err != nil { + return err + } + + locks.ByName(subnetId, "azurerm_private_endpoint") + defer locks.UnlockByName(subnetId, "azurerm_private_endpoint") + + err = pluginsdk.Retry(d.Timeout(pluginsdk.TimeoutCreate), func() *resource.RetryError { + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, parameters) + if err != nil { + switch { + case strings.EqualFold(err.Error(), "is missing required parameter 'group Id'"): + { + return &resource.RetryError{ + Err: fmt.Errorf("updating Private Endpoint %q (Resource Group %q) due to missing 'group Id', ensure that the 'subresource_names' type is populated: %+v", id.Name, id.ResourceGroup, err), + Retryable: false, + } + } + case strings.Contains(err.Error(), "PrivateLinkServiceId Invalid private link service id"): + { + return &resource.RetryError{ + Err: fmt.Errorf("creating Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err), + Retryable: true, + } + } + default: + return &resource.RetryError{ + Err: fmt.Errorf("updating Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err), + } + } + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + return &resource.RetryError{ + Err: fmt.Errorf("waiting for update of Private Endpoint %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err), + Retryable: false, + } + } + return nil + }) + if err != nil { + return err } // 1 Private Endpoint can have 1 Private DNS Zone Group - so to update we need to Delete & Recreate @@ -548,6 +636,7 @@ func resourcePrivateEndpointDelete(d *pluginsdk.ResourceData, meta interface{}) } log.Printf("[DEBUG] Deleted the Private DNS Zone Group associated with Private Endpoint %q / Resource Group %q.", id.Name, id.ResourceGroup) + subnetId := d.Get("subnet_id").(string) privateServiceConnections := d.Get("private_service_connection").([]interface{}) parameters := network.PrivateEndpoint{ PrivateEndpointProperties: &network.PrivateEndpointProperties{ @@ -561,6 +650,8 @@ func resourcePrivateEndpointDelete(d *pluginsdk.ResourceData, meta interface{}) //goland:noinspection GoDeferInLoop defer locks.UnlockByName(cosmosDbResId, "azurerm_private_endpoint") } + locks.ByName(subnetId, "azurerm_private_endpoint") + defer locks.UnlockByName(subnetId, "azurerm_private_endpoint") log.Printf("[DEBUG] Deleting the Private Endpoint %q / Resource Group %q..", id.Name, id.ResourceGroup) future, err := client.Delete(ctx, id.ResourceGroup, id.Name) @@ -664,7 +755,7 @@ func flattenPrivateLinkEndpointServiceConnection(serviceConnections *[]network.P // There is a bug from service, the PE created from portal could be with the connection id for postgresql server "Microsoft.DBForPostgreSQL" instead of "Microsoft.DBforPostgreSQL" // and for Mysql and MariaDB if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.dbforpostgresql") { - if serverId, err := postgresqlParse.ServerID(privateConnectionId); err == nil { + if serverId, err := servers.ParseServerID(privateConnectionId); err == nil { privateConnectionId = serverId.ID() } } @@ -674,7 +765,7 @@ func flattenPrivateLinkEndpointServiceConnection(serviceConnections *[]network.P } } if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.dbformariadb") { - if serverId, err := mariaDBParse.ServerID(privateConnectionId); err == nil { + if serverId, err := mariaDB.ParseServerID(privateConnectionId); err == nil { privateConnectionId = serverId.ID() } } @@ -726,7 +817,7 @@ func flattenPrivateLinkEndpointServiceConnection(serviceConnections *[]network.P // There is a bug from service, the PE created from portal could be with the connection id for postgresql server "Microsoft.DBForPostgreSQL" instead of "Microsoft.DBforPostgreSQL" // and for Mysql and MariaDB if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.dbforpostgresql") { - if serverId, err := postgresqlParse.ServerID(privateConnectionId); err == nil { + if serverId, err := servers.ParseServerID(privateConnectionId); err == nil { privateConnectionId = serverId.ID() } } @@ -736,7 +827,7 @@ func flattenPrivateLinkEndpointServiceConnection(serviceConnections *[]network.P } } if strings.Contains(strings.ToLower(privateConnectionId), "microsoft.dbformariadb") { - if serverId, err := mariaDBParse.ServerID(privateConnectionId); err == nil { + if serverId, err := mariaDB.ParseServerID(privateConnectionId); err == nil { privateConnectionId = serverId.ID() } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/private_link_service_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/private_link_service_resource.go index 841326beff5..a67104feea7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/private_link_service_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/private_link_service_resource.go @@ -76,6 +76,15 @@ func resourcePrivateLinkService() *pluginsdk.Resource { Set: pluginsdk.HashString, }, + "fqdns": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + // Required by the API you can't create the resource without at least // one ip configuration once primary is set it is set forever unless // you destroy the resource and recreate it. @@ -190,6 +199,7 @@ func resourcePrivateLinkServiceCreateUpdate(d *pluginsdk.ResourceData, meta inte }, IPConfigurations: expandPrivateLinkServiceIPConfiguration(primaryIpConfiguration), LoadBalancerFrontendIPConfigurations: expandPrivateLinkServiceFrontendIPConfiguration(loadBalancerFrontendIpConfigurations), + Fqdns: utils.ExpandStringSlice(d.Get("fqdns").([]interface{})), }, Tags: tags.Expand(t), } @@ -271,6 +281,10 @@ func resourcePrivateLinkServiceRead(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("setting `visibility_subscription_ids`: %+v", err) } + if err := d.Set("fqdns", utils.FlattenStringSlice(props.Fqdns)); err != nil { + return fmt.Errorf("setting `fqdns`: %+v", err) + } + if err := d.Set("nat_ip_configuration", flattenPrivateLinkServiceIPConfiguration(props.IPConfigurations)); err != nil { return fmt.Errorf("setting `nat_ip_configuration`: %+v", err) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/registration.go index 9980984609b..87082130a4a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/registration.go @@ -93,6 +93,8 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { "azurerm_route_filter": resourceRouteFilter(), "azurerm_route_table": resourceRouteTable(), "azurerm_route": resourceRoute(), + "azurerm_route_server": resourceRouteServer(), + "azurerm_route_server_bgp_connection": resourceRouteServerBgpConnection(), "azurerm_virtual_hub_security_partner_provider": resourceVirtualHubSecurityPartnerProvider(), "azurerm_subnet_service_endpoint_storage_policy": resourceSubnetServiceEndpointStoragePolicy(), "azurerm_subnet_network_security_group_association": resourceSubnetNetworkSecurityGroupAssociation(), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/resourceids.go index bcd1ae1ebdd..793ef043451 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/resourceids.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/resourceids.go @@ -105,3 +105,6 @@ package network // Load balancer //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=InboundNatRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1/inboundNatRules/natrule1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=LoadBalancerBackendAddressPool -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1/backendAddressPools/backendAddressPool1 + +// Virtual Machine Scale Set +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=VirtualMachineScaleSetPublicIPAddress -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachineScaleSets/scaleSet1/virtualMachines/virtualMachine1/networkInterfaces/networkInterface1/ipConfigurations/ipConfiguration1/publicIPAddresses/publicIpAddress1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/route_server_bgp_connection_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/route_server_bgp_connection_resource.go new file mode 100644 index 00000000000..e88667a5b8d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/route_server_bgp_connection_resource.go @@ -0,0 +1,170 @@ +package network + +import ( + "fmt" + "log" + "time" + + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceRouteServerBgpConnection() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceRouteServerBgpConnectionCreate, + Read: resourceRouteServerBgpConnectionRead, + Delete: resourceRouteServerBgpConnectionDelete, + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.BgpConnectionID(id) + return err + }), + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "route_server_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.VirtualHubID, + }, + + "peer_asn": { + Type: pluginsdk.TypeInt, + Required: true, + ForceNew: true, + ValidateFunc: validation.IntAtLeast(0), + }, + + "peer_ip": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.IsIPv4Address, + }, + }, + } +} + +func resourceRouteServerBgpConnectionCreate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Network.VirtualHubBgpConnectionClient + ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) + defer cancel() + + routerServerId, err := parse.VirtualHubID(d.Get("route_server_id").(string)) + if err != nil { + return err + } + + locks.ByName(routerServerId.Name, "azurerm_route_server") + defer locks.UnlockByName(routerServerId.Name, "azurerm_route_server") + + id := parse.NewBgpConnectionID(routerServerId.SubscriptionId, routerServerId.ResourceGroup, routerServerId.Name, d.Get("name").(string)) + + if d.IsNewResource() { + existing, err := client.Get(ctx, id.ResourceGroup, id.VirtualHubName, id.Name) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + } + + if !utils.ResponseWasNotFound(existing.Response) { + return tf.ImportAsExistsError("azurerm_route_server_bgp_connection", id.ID()) + } + } + parameters := network.BgpConnection{ + Name: utils.String(d.Get("name").(string)), + BgpConnectionProperties: &network.BgpConnectionProperties{ + PeerAsn: utils.Int64(int64(d.Get("peer_asn").(int))), + PeerIP: utils.String(d.Get("peer_ip").(string)), + }, + } + + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.VirtualHubName, id.Name, parameters) + if err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting on creation/update future for %s: %+v", id, err) + } + + d.SetId(id.ID()) + return resourceRouteServerBgpConnectionRead(d, meta) +} + +func resourceRouteServerBgpConnectionRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Network.VirtualHubBgpConnectionClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.BgpConnectionID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.VirtualHubName, id.Name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + log.Printf("[INFO] BGP Connection %s does not exists", id) + d.SetId("") + return nil + } + + return fmt.Errorf("retrieving Route Server BGP Connection %s: %+v", id, err) + } + + d.Set("name", id.Name) + d.Set("route_server_id", parse.NewVirtualHubID(id.SubscriptionId, id.ResourceGroup, id.VirtualHubName).ID()) + + if props := resp.BgpConnectionProperties; props != nil { + if props.PeerAsn != nil { + d.Set("peer_asn", props.PeerAsn) + } + if props.PeerIP != nil { + d.Set("peer_ip", props.PeerIP) + } + } + return nil +} + +func resourceRouteServerBgpConnectionDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Network.VirtualHubBgpConnectionClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.BgpConnectionID(d.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.VirtualHubName, id.Name) + if err != nil { + return fmt.Errorf("deleting BGP Connection %s: %+v", id, err) + } + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting on deletion future for BGP Connection %s: %+v", id, err) + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/route_server_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/route_server_resource.go new file mode 100644 index 00000000000..01dd1855cb8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/route_server_resource.go @@ -0,0 +1,343 @@ +package network + +import ( + "context" + "fmt" + "log" + "strconv" + "time" + + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tags" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceRouteServer() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceRouteServerCreateUpdate, + Read: resourceRouteServerRead, + Update: resourceRouteServerCreateUpdate, + Delete: resourceRouteServerDelete, + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.VirtualHubID(id) + return err + }), + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(60 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Update: pluginsdk.DefaultTimeout(60 * time.Minute), + Delete: pluginsdk.DefaultTimeout(60 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.RouteServerName(), + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "sku": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"Standard"}, false), + }, + + "public_ip_address_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.PublicIpAddressID, + }, + + "subnet_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.SubnetID, + }, + + "branch_to_branch_traffic_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "virtual_router_ips": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "routing_state": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "virtual_router_asn": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "tags": commonschema.Tags(), + }, + } +} + +func resourceRouteServerCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + serverClient := meta.(*clients.Client).Network.VirtualHubClient + ipClient := meta.(*clients.Client).Network.VirtualHubIPClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id := parse.NewVirtualHubID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + + locks.ByName(id.Name, "azurerm_route_server") + defer locks.UnlockByName(id.Name, "azurerm_route_server") + + if d.IsNewResource() { + existing, err := serverClient.Get(ctx, id.ResourceGroup, id.Name) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for present of existing Route Server %q (Resource Group Name %q): %+v", id.Name, id.ResourceGroup, err) + } + } + if !utils.ResponseWasNotFound(existing.Response) { + return tf.ImportAsExistsError("azurerm_route_server", id.ID()) + } + } + + location := location.Normalize(d.Get("location").(string)) + t := tags.Expand(d.Get("tags").(map[string]interface{})) + + parameters := network.VirtualHub{ + Location: utils.String(location), + VirtualHubProperties: &network.VirtualHubProperties{ + Sku: utils.String(d.Get("sku").(string)), + AllowBranchToBranchTraffic: utils.Bool(d.Get("branch_to_branch_traffic_enabled").(bool)), + }, + Tags: t, + } + + if _, err := serverClient.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, parameters); err != nil { + return fmt.Errorf("creating Route Server %q (Resource Group Name %q): %+v", id.Name, id.ResourceGroup, err) + } + + timeout, _ := ctx.Deadline() + stateConf := &pluginsdk.StateChangeConf{ + Pending: []string{"Provisioning", "Updating"}, + Target: []string{"Succeeded", "Provisioned"}, + Refresh: routeServerCreateRefreshFunc(ctx, serverClient, id), + PollInterval: 15 * time.Second, + ContinuousTargetOccurence: 5, + Timeout: time.Until(timeout), + } + _, err := stateConf.WaitForStateContext(ctx) + if err != nil { + return fmt.Errorf("waiting for creation/update of Route Server %q (Resource Group Name %q): %+v", id.Name, id.ResourceGroup, err) + } + + ipConfigName := "ipConfig1" + ipConfigs := network.HubIPConfiguration{ + Name: utils.String(ipConfigName), + HubIPConfigurationPropertiesFormat: &network.HubIPConfigurationPropertiesFormat{ + PublicIPAddress: &network.PublicIPAddress{ + ID: utils.String(d.Get("public_ip_address_id").(string)), + }, + Subnet: &network.Subnet{ + ID: utils.String(d.Get("subnet_id").(string)), + }, + }, + } + + future, err := ipClient.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, ipConfigName, ipConfigs) + if err != nil { + return fmt.Errorf("creating/updating IP Configuration %q of Route Server %q (Resource Group Name %q): %+v", ipConfigName, id.Name, id.ResourceGroup, err) + } + + if err = future.WaitForCompletionRef(ctx, ipClient.Client); err != nil { + return fmt.Errorf("waiting on creation/update for IP Configuration %q of Route Server %q (Resource Group Name %q): %+v", ipConfigName, id.Name, id.ResourceGroup, err) + } + d.SetId(id.ID()) + + return resourceRouteServerRead(d, meta) +} + +func resourceRouteServerRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Network.VirtualHubClient + ipClient := meta.(*clients.Client).Network.VirtualHubIPClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.VirtualHubID(d.Id()) + if err != nil { + return err + } + + routeServer, err := client.Get(ctx, id.ResourceGroup, id.Name) + if err != nil { + if utils.ResponseWasNotFound(routeServer.Response) { + log.Printf("[INFO] Route Server %s does not exists - removing from state", d.Id()) + d.SetId("") + return nil + } + return fmt.Errorf("reading Route Server %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + } + + d.Set("name", id.Name) + d.Set("resource_group_name", id.ResourceGroup) + if location := routeServer.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) + } + if props := routeServer.VirtualHubProperties; props != nil { + d.Set("sku", props.Sku) + var virtualRouterIps *[]string + if props.VirtualRouterIps != nil { + virtualRouterIps = props.VirtualRouterIps + } + d.Set("virtual_router_ips", virtualRouterIps) + if props.AllowBranchToBranchTraffic != nil { + d.Set("branch_to_branch_traffic_enabled", props.AllowBranchToBranchTraffic) + } + if props.VirtualRouterAsn != nil { + d.Set("virtual_router_asn", props.VirtualRouterAsn) + } + d.Set("routing_state", string(props.RoutingState)) + } + + ipConfig, err := ipClient.List(ctx, id.ResourceGroup, id.Name) + if err != nil { + return fmt.Errorf("retrieving IP Config for Router Server %q (Resource Group Name %q): %+v", id.Name, id.ResourceGroup, err) + } + + for _, setting := range ipConfig.Values() { + if ipProps := setting.HubIPConfigurationPropertiesFormat; ipProps != nil { + if ipProps.PublicIPAddress != nil { + d.Set("public_ip_address_id", ipProps.PublicIPAddress.ID) + } + if ipProps.Subnet != nil { + d.Set("subnet_id", ipProps.Subnet.ID) + } + } + } + return tags.FlattenAndSet(d, routeServer.Tags) +} + +func resourceRouteServerDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Network.VirtualHubClient + ipClient := meta.(*clients.Client).Network.VirtualHubIPClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + routeServerId, err := parse.VirtualHubID(d.Id()) + if err != nil { + return err + } + + ipConfig, err := ipClient.List(ctx, routeServerId.ResourceGroup, routeServerId.Name) + if err != nil { + return fmt.Errorf("retrieving IP Config for Router Server %q (Resource Group Name %q): %+v", routeServerId.Name, routeServerId.ResourceGroup, err) + } + var ipName string + for _, setting := range ipConfig.Values() { + if setting.Name != nil { + ipName = *setting.Name + } + } + ipConfigId := parse.NewVirtualHubIpConfigurationID(routeServerId.SubscriptionId, routeServerId.ResourceGroup, routeServerId.Name, ipName) + + if ipConfig.Values() != nil { + if err := deleteRouteServerIpConfiguration(ctx, ipClient, ipConfigId); err != nil { + return err + } + } + + future, err := client.Delete(ctx, routeServerId.ResourceGroup, routeServerId.Name) + if err != nil { + return fmt.Errorf("deleting Route Server %q (Resource Group Name %q): %+v", routeServerId.Name, routeServerId.ResourceGroup, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + if !response.WasNotFound(future.Response()) { + return fmt.Errorf("waiting for Route Server %q (Resource Group Name %q): %+v", routeServerId.Name, routeServerId.ResourceGroup, err) + } + } + + return nil +} + +func deleteRouteServerIpConfiguration(ctx context.Context, client *network.VirtualHubIPConfigurationClient, id parse.VirtualHubIpConfigurationId) error { + future, err := client.Delete(ctx, id.ResourceGroup, id.VirtualHubName, id.IpConfigurationName) + if err != nil { + return fmt.Errorf("deleting Router Server IP Config %s for Route Server %q (Resource Group Name %q): %+v", id.IpConfigurationName, id.VirtualHubName, id.ResourceGroup, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + if !response.WasNotFound(future.Response()) { + return fmt.Errorf("waiting for deletion of Route Server IP Config %s: %+v", id.IpConfigurationName, err) + } + } + timeout, _ := ctx.Deadline() + stateConf := &pluginsdk.StateChangeConf{ + Pending: []string{"200"}, + Target: []string{"404"}, + Refresh: ipConfigStateRefreshFunc(ctx, client, id), + Timeout: time.Until(timeout), + } + + if _, err := stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for Router Server IP Config %s for Route Server %q (Resource Group Name %q): %+v", id.IpConfigurationName, id.VirtualHubName, id.ResourceGroup, err) + } + return nil +} + +func routeServerCreateRefreshFunc(ctx context.Context, client *network.VirtualHubsClient, id parse.VirtualHubId) pluginsdk.StateRefreshFunc { + return func() (interface{}, string, error) { + res, err := client.Get(ctx, id.ResourceGroup, id.Name) + if err != nil { + if utils.ResponseWasNotFound(res.Response) { + return nil, "", fmt.Errorf("Route Server %q (Resource Group Name %q) does not exists", id.Name, id.ResourceGroup) + } + return nil, "", fmt.Errorf("retrieving Route Server %q (Resource Group Name %q) error", id.Name, id.ResourceGroup) + } + + if res.VirtualHubProperties != nil { + return res, string(res.VirtualHubProperties.ProvisioningState), nil + } + return nil, "", fmt.Errorf("unable to read the provisioning state of this Route Server %q (Resource Group Name %q)", id.Name, id.ResourceGroup) + } +} + +func ipConfigStateRefreshFunc(ctx context.Context, client *network.VirtualHubIPConfigurationClient, id parse.VirtualHubIpConfigurationId) pluginsdk.StateRefreshFunc { + return func() (interface{}, string, error) { + res, err := client.Get(ctx, id.ResourceGroup, id.VirtualHubName, id.IpConfigurationName) + if err != nil { + if utils.ResponseWasNotFound(res.Response) { + return res, strconv.Itoa(res.StatusCode), nil + } + return nil, "", fmt.Errorf("polling for the status of route server ip config %s: %+v", id, err) + } + return res, strconv.Itoa(res.StatusCode), nil + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/subnet_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/subnet_data_source.go index 09fc30a119b..41dfe63549d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/subnet_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/subnet_data_source.go @@ -6,6 +6,7 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -14,7 +15,7 @@ import ( ) func dataSourceSubnet() *pluginsdk.Resource { - return &pluginsdk.Resource{ + resource := &pluginsdk.Resource{ Read: dataSourceSubnetRead, Timeouts: &pluginsdk.ResourceTimeout{ @@ -64,18 +65,31 @@ func dataSourceSubnet() *pluginsdk.Resource { Type: pluginsdk.TypeString, }, }, - - "enforce_private_link_endpoint_network_policies": { + "private_endpoint_network_policies_enabled": { Type: pluginsdk.TypeBool, Computed: true, }, - "enforce_private_link_service_network_policies": { + "private_link_service_network_policies_enabled": { Type: pluginsdk.TypeBool, Computed: true, }, }, } + + if !features.FourPointOhBeta() { + resource.Schema["enforce_private_link_endpoint_network_policies"] = &pluginsdk.Schema{ + Type: pluginsdk.TypeBool, + Computed: true, + } + + resource.Schema["enforce_private_link_service_network_policies"] = &pluginsdk.Schema{ + Type: pluginsdk.TypeBool, + Computed: true, + } + } + + return resource } func dataSourceSubnetRead(d *pluginsdk.ResourceData, meta interface{}) error { @@ -88,7 +102,7 @@ func dataSourceSubnetRead(d *pluginsdk.ResourceData, meta interface{}) error { resp, err := client.Get(ctx, id.ResourceGroup, id.VirtualNetworkName, id.Name, "") if err != nil { if utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf("Error: %s was not found", id) + return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } @@ -110,8 +124,13 @@ func dataSourceSubnetRead(d *pluginsdk.ResourceData, meta interface{}) error { d.Set("address_prefixes", utils.FlattenStringSlice(props.AddressPrefixes)) } - d.Set("enforce_private_link_endpoint_network_policies", flattenSubnetPrivateLinkNetworkPolicy(string(props.PrivateEndpointNetworkPolicies))) - d.Set("enforce_private_link_service_network_policies", flattenSubnetPrivateLinkNetworkPolicy(string(props.PrivateLinkServiceNetworkPolicies))) + if !features.FourPointOhBeta() { + d.Set("enforce_private_link_endpoint_network_policies", flattenEnforceSubnetNetworkPolicy(string(props.PrivateEndpointNetworkPolicies))) + d.Set("enforce_private_link_service_network_policies", flattenEnforceSubnetNetworkPolicy(string(props.PrivateLinkServiceNetworkPolicies))) + } + + d.Set("private_endpoint_network_policies_enabled", flattenSubnetNetworkPolicy(string(props.PrivateEndpointNetworkPolicies))) + d.Set("private_link_service_network_policies_enabled", flattenSubnetNetworkPolicy(string(props.PrivateLinkServiceNetworkPolicies))) networkSecurityGroupId := "" if props.NetworkSecurityGroup != nil && props.NetworkSecurityGroup.ID != nil { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/subnet_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/subnet_resource.go index e20cd28fd89..634857b0f37 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/subnet_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/subnet_resource.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" @@ -24,7 +25,7 @@ import ( var SubnetResourceName = "azurerm_subnet" func resourceSubnet() *pluginsdk.Resource { - return &pluginsdk.Resource{ + resource := &pluginsdk.Resource{ Create: resourceSubnetCreate, Read: resourceSubnetRead, Update: resourceSubnetUpdate, @@ -120,6 +121,7 @@ func resourceSubnet() *pluginsdk.Resource { "Microsoft.Logic/integrationServiceEnvironments", "Microsoft.MachineLearningServices/workspaces", "Microsoft.Netapp/volumes", + "Microsoft.Network/dnsResolvers", "Microsoft.Network/managedResolvers", "Microsoft.PowerPlatform/vnetaccesslinks", "Microsoft.ServiceFabricMesh/networks", @@ -130,6 +132,9 @@ func resourceSubnet() *pluginsdk.Resource { "Microsoft.Synapse/workspaces", "Microsoft.Web/hostingEnvironments", "Microsoft.Web/serverFarms", + "Microsoft.Orbital/orbitalGateways", + "NGINX.NGINXPLUS/nginxDeployments", + "PaloAltoNetworks.Cloudngfw/firewalls", }, false), }, @@ -156,19 +161,67 @@ func resourceSubnet() *pluginsdk.Resource { }, }, - "enforce_private_link_endpoint_network_policies": { - Type: pluginsdk.TypeBool, + "private_endpoint_network_policies_enabled": { + Type: pluginsdk.TypeBool, + Computed: func() bool { + return !features.FourPointOh() + }(), Optional: true, - Default: false, + Default: func() interface{} { + if !features.FourPointOh() { + return nil + } + return !features.FourPointOh() + }(), + ConflictsWith: func() []string { + if !features.FourPointOh() { + return []string{"enforce_private_link_endpoint_network_policies"} + } + return []string{} + }(), }, - "enforce_private_link_service_network_policies": { - Type: pluginsdk.TypeBool, + "private_link_service_network_policies_enabled": { + Type: pluginsdk.TypeBool, + Computed: func() bool { + return !features.FourPointOh() + }(), Optional: true, - Default: false, + Default: func() interface{} { + if !features.FourPointOh() { + return nil + } + return features.FourPointOh() + }(), + ConflictsWith: func() []string { + if !features.FourPointOh() { + return []string{"enforce_private_link_service_network_policies"} + } + return []string{} + }(), }, }, } + + if !features.FourPointOhBeta() { + resource.Schema["enforce_private_link_endpoint_network_policies"] = &pluginsdk.Schema{ + Type: pluginsdk.TypeBool, + Computed: true, + Optional: true, + Deprecated: "`enforce_private_link_endpoint_network_policies` will be removed in favour of the property `private_endpoint_network_policies_enabled` in version 4.0 of the AzureRM Provider", + ConflictsWith: []string{"private_endpoint_network_policies_enabled"}, + } + + resource.Schema["enforce_private_link_service_network_policies"] = &pluginsdk.Schema{ + Type: pluginsdk.TypeBool, + Computed: true, + Optional: true, + Deprecated: "`enforce_private_link_service_network_policies` will be removed in favour of the property `private_link_service_network_policies_enabled` in version 4.0 of the AzureRM Provider", + ConflictsWith: []string{"private_link_service_network_policies_enabled"}, + } + } + + return resource } // TODO: refactor the create/flatten functions @@ -211,10 +264,72 @@ func resourceSubnetCreate(d *pluginsdk.ResourceData, meta interface{}) error { // To enable private endpoints you must disable the network policies for the subnet because // Network policies like network security groups are not supported by private endpoints. - privateEndpointNetworkPolicies := d.Get("enforce_private_link_endpoint_network_policies").(bool) - privateLinkServiceNetworkPolicies := d.Get("enforce_private_link_service_network_policies").(bool) - properties.PrivateEndpointNetworkPolicies = network.VirtualNetworkPrivateEndpointNetworkPolicies(expandSubnetPrivateLinkNetworkPolicy(privateEndpointNetworkPolicies)) - properties.PrivateLinkServiceNetworkPolicies = network.VirtualNetworkPrivateLinkServiceNetworkPolicies(expandSubnetPrivateLinkNetworkPolicy(privateLinkServiceNetworkPolicies)) + var privateEndpointNetworkPolicies network.VirtualNetworkPrivateEndpointNetworkPolicies + var privateLinkServiceNetworkPolicies network.VirtualNetworkPrivateLinkServiceNetworkPolicies + + if features.FourPointOhBeta() { + privateEndpointNetworkPoliciesRaw := d.Get("private_endpoint_network_policies_enabled").(bool) + privateLinkServiceNetworkPoliciesRaw := d.Get("private_link_service_network_policies_enabled").(bool) + + privateEndpointNetworkPolicies = network.VirtualNetworkPrivateEndpointNetworkPolicies(expandSubnetNetworkPolicy(privateEndpointNetworkPoliciesRaw)) + privateLinkServiceNetworkPolicies = network.VirtualNetworkPrivateLinkServiceNetworkPolicies(expandSubnetNetworkPolicy(privateLinkServiceNetworkPoliciesRaw)) + } else { + var enforceOk bool + var enforceServiceOk bool + var enableOk bool + var enableServiceOk bool + var enforcePrivateEndpointNetworkPoliciesRaw bool + var enforcePrivateLinkServiceNetworkPoliciesRaw bool + var privateEndpointNetworkPoliciesRaw bool + var privateLinkServiceNetworkPoliciesRaw bool + + // Set the legacy default value since they are now computed optional + privateEndpointNetworkPolicies = network.VirtualNetworkPrivateEndpointNetworkPoliciesEnabled + privateLinkServiceNetworkPolicies = network.VirtualNetworkPrivateLinkServiceNetworkPoliciesEnabled + + // This is the only way I was able to figure out if the fields are actually in the config or not, + // which is needed here because these are all now optional computed fields... + if !pluginsdk.IsExplicitlyNullInConfig(d, "enforce_private_link_endpoint_network_policies") { + enforceOk = true + enforcePrivateEndpointNetworkPoliciesRaw = d.Get("enforce_private_link_endpoint_network_policies").(bool) + } + + if !pluginsdk.IsExplicitlyNullInConfig(d, "enforce_private_link_service_network_policies") { + enforceServiceOk = true + enforcePrivateLinkServiceNetworkPoliciesRaw = d.Get("enforce_private_link_service_network_policies").(bool) + } + + if !pluginsdk.IsExplicitlyNullInConfig(d, "private_endpoint_network_policies_enabled") { + enableOk = true + privateEndpointNetworkPoliciesRaw = d.Get("private_endpoint_network_policies_enabled").(bool) + } + + if !pluginsdk.IsExplicitlyNullInConfig(d, "private_link_service_network_policies_enabled") { + enableServiceOk = true + privateLinkServiceNetworkPoliciesRaw = d.Get("private_link_service_network_policies_enabled").(bool) + } + + // Only one of these values can be set since they conflict with each other + // if neither of them are set use the default values + if enforceOk || enableOk { + if enforceOk { + privateEndpointNetworkPolicies = network.VirtualNetworkPrivateEndpointNetworkPolicies(expandEnforceSubnetNetworkPolicy(enforcePrivateEndpointNetworkPoliciesRaw)) + } else if enableOk { + privateEndpointNetworkPolicies = network.VirtualNetworkPrivateEndpointNetworkPolicies(expandSubnetNetworkPolicy(privateEndpointNetworkPoliciesRaw)) + } + } + + if enforceServiceOk || enableServiceOk { + if enforceServiceOk { + privateLinkServiceNetworkPolicies = network.VirtualNetworkPrivateLinkServiceNetworkPolicies(expandEnforceSubnetNetworkPolicy(enforcePrivateLinkServiceNetworkPoliciesRaw)) + } else if enableServiceOk { + privateLinkServiceNetworkPolicies = network.VirtualNetworkPrivateLinkServiceNetworkPolicies(expandSubnetNetworkPolicy(privateLinkServiceNetworkPoliciesRaw)) + } + } + } + + properties.PrivateEndpointNetworkPolicies = privateEndpointNetworkPolicies + properties.PrivateLinkServiceNetworkPolicies = privateLinkServiceNetworkPolicies serviceEndpointPoliciesRaw := d.Get("service_endpoint_policy_ids").(*pluginsdk.Set).List() properties.ServiceEndpointPolicies = expandSubnetServiceEndpointPolicies(serviceEndpointPoliciesRaw) @@ -320,14 +435,50 @@ func resourceSubnetUpdate(d *pluginsdk.ResourceData, meta interface{}) error { props.Delegations = expandSubnetDelegation(delegationsRaw) } - if d.HasChange("enforce_private_link_endpoint_network_policies") { - v := d.Get("enforce_private_link_endpoint_network_policies").(bool) - props.PrivateEndpointNetworkPolicies = network.VirtualNetworkPrivateEndpointNetworkPolicies(expandSubnetPrivateLinkNetworkPolicy(v)) - } + if features.FourPointOhBeta() { + if d.HasChange("private_endpoint_network_policies_enabled") { + v := d.Get("private_endpoint_network_policies_enabled").(bool) + props.PrivateEndpointNetworkPolicies = network.VirtualNetworkPrivateEndpointNetworkPolicies(expandSubnetNetworkPolicy(v)) + } + + if d.HasChange("private_link_service_network_policies_enabled") { + v := d.Get("private_link_service_network_policies_enabled").(bool) + props.PrivateLinkServiceNetworkPolicies = network.VirtualNetworkPrivateLinkServiceNetworkPolicies(expandSubnetNetworkPolicy(v)) + } + } else { + // This is the best case we can do in this state since they are computed optional fields now + // If you remove the fields from the config they will just persist as they are, if you change + // one it will update it to the value that was changed and in the read the other value will be + // updated as well to reflect the new value so it is safe to toggle between which field you want + // to use to define this behavior... + var privateEndpointNetworkPolicies network.VirtualNetworkPrivateEndpointNetworkPolicies + var privateLinkServiceNetworkPolicies network.VirtualNetworkPrivateLinkServiceNetworkPolicies + + if d.HasChange("enforce_private_link_endpoint_network_policies") || d.HasChange("private_endpoint_network_policies_enabled") { + enforcePrivateEndpointNetworkPoliciesRaw := d.Get("enforce_private_link_endpoint_network_policies").(bool) + privateEndpointNetworkPoliciesRaw := d.Get("private_endpoint_network_policies_enabled").(bool) + + if d.HasChange("enforce_private_link_endpoint_network_policies") { + privateEndpointNetworkPolicies = network.VirtualNetworkPrivateEndpointNetworkPolicies(expandEnforceSubnetNetworkPolicy(enforcePrivateEndpointNetworkPoliciesRaw)) + } else if d.HasChange("private_endpoint_network_policies_enabled") { + privateEndpointNetworkPolicies = network.VirtualNetworkPrivateEndpointNetworkPolicies(expandSubnetNetworkPolicy(privateEndpointNetworkPoliciesRaw)) + } + + props.PrivateEndpointNetworkPolicies = privateEndpointNetworkPolicies + } - if d.HasChange("enforce_private_link_service_network_policies") { - v := d.Get("enforce_private_link_service_network_policies").(bool) - props.PrivateLinkServiceNetworkPolicies = network.VirtualNetworkPrivateLinkServiceNetworkPolicies(expandSubnetPrivateLinkNetworkPolicy(v)) + if d.HasChange("enforce_private_link_service_network_policies") || d.HasChange("private_link_service_network_policies_enabled") { + enforcePrivateLinkServiceNetworkPoliciesRaw := d.Get("enforce_private_link_service_network_policies").(bool) + privateLinkServiceNetworkPoliciesRaw := d.Get("private_link_service_network_policies_enabled").(bool) + + if d.HasChange("enforce_private_link_service_network_policies") { + privateLinkServiceNetworkPolicies = network.VirtualNetworkPrivateLinkServiceNetworkPolicies(expandEnforceSubnetNetworkPolicy(enforcePrivateLinkServiceNetworkPoliciesRaw)) + } else if d.HasChange("private_link_service_network_policies_enabled") { + privateLinkServiceNetworkPolicies = network.VirtualNetworkPrivateLinkServiceNetworkPolicies(expandSubnetNetworkPolicy(privateLinkServiceNetworkPoliciesRaw)) + } + + props.PrivateLinkServiceNetworkPolicies = privateLinkServiceNetworkPolicies + } } if d.HasChange("service_endpoints") { @@ -375,6 +526,7 @@ func resourceSubnetUpdate(d *pluginsdk.ResourceData, meta interface{}) error { MinTimeout: 1 * time.Minute, Timeout: time.Until(timeout), } + if _, err = vnetStateConf.WaitForStateContext(ctx); err != nil { return fmt.Errorf("waiting for provisioning state of virtual network for %s: %+v", id, err) } @@ -421,8 +573,13 @@ func resourceSubnetRead(d *pluginsdk.ResourceData, meta interface{}) error { return fmt.Errorf("flattening `delegation`: %+v", err) } - d.Set("enforce_private_link_endpoint_network_policies", flattenSubnetPrivateLinkNetworkPolicy(string(props.PrivateEndpointNetworkPolicies))) - d.Set("enforce_private_link_service_network_policies", flattenSubnetPrivateLinkNetworkPolicy(string(props.PrivateLinkServiceNetworkPolicies))) + if !features.FourPointOhBeta() { + d.Set("enforce_private_link_endpoint_network_policies", flattenEnforceSubnetNetworkPolicy(string(props.PrivateEndpointNetworkPolicies))) + d.Set("enforce_private_link_service_network_policies", flattenEnforceSubnetNetworkPolicy(string(props.PrivateLinkServiceNetworkPolicies))) + } + + d.Set("private_endpoint_network_policies_enabled", flattenSubnetNetworkPolicy(string(props.PrivateEndpointNetworkPolicies))) + d.Set("private_link_service_network_policies_enabled", flattenSubnetNetworkPolicy(string(props.PrivateLinkServiceNetworkPolicies))) serviceEndpoints := flattenSubnetServiceEndpoints(props.ServiceEndpoints) if err := d.Set("service_endpoints", serviceEndpoints); err != nil { @@ -565,24 +722,36 @@ func flattenSubnetDelegation(delegations *[]network.Delegation) []interface{} { return retDeles } -// TODO: confirm this logic below - -func expandSubnetPrivateLinkNetworkPolicy(enabled bool) string { +// TODO 4.0: Remove expandEnforceSubnetPrivateLinkNetworkPolicy function +func expandEnforceSubnetNetworkPolicy(enabled bool) string { // This is strange logic, but to get the schema to make sense for the end user // I exposed it with the same name that the Azure CLI does to be consistent // between the tool sets, which means true == Disabled. if enabled { - return "Disabled" + return string(network.VirtualNetworkPrivateEndpointNetworkPoliciesDisabled) + } + + return string(network.VirtualNetworkPrivateEndpointNetworkPoliciesEnabled) +} + +func expandSubnetNetworkPolicy(enabled bool) string { + if enabled { + return string(network.VirtualNetworkPrivateEndpointNetworkPoliciesEnabled) } - return "Enabled" + return string(network.VirtualNetworkPrivateEndpointNetworkPoliciesDisabled) } -func flattenSubnetPrivateLinkNetworkPolicy(input string) bool { +// TODO 4.0: Remove flattenEnforceSubnetPrivateLinkNetworkPolicy function +func flattenEnforceSubnetNetworkPolicy(input string) bool { // This is strange logic, but to get the schema to make sense for the end user // I exposed it with the same name that the Azure CLI does to be consistent // between the tool sets, which means true == Disabled. - return strings.EqualFold(input, "Disabled") + return strings.EqualFold(input, string(network.VirtualNetworkPrivateEndpointNetworkPoliciesDisabled)) +} + +func flattenSubnetNetworkPolicy(input string) bool { + return strings.EqualFold(input, string(network.VirtualNetworkPrivateEndpointNetworkPoliciesEnabled)) } func expandSubnetServiceEndpointPolicies(input []interface{}) *[]network.ServiceEndpointPolicy { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate/route_server_name.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate/route_server_name.go new file mode 100644 index 00000000000..6a26e46ebcc --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate/route_server_name.go @@ -0,0 +1,19 @@ +package validate + +import ( + "regexp" + + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +func RouteServerName() pluginsdk.SchemaValidateFunc { + return validation.All( + validation.StringIsNotEmpty, + validation.StringLenBetween(1, 80), + validation.StringMatch( + regexp.MustCompile(`^[A-Za-z\d][A-Za-z\d.\-_]*[A-Za-z\d_]$`), + "The name must begin with a letter or number, end with a letter, number or underscore, and may contain only letters, numbers, underscores, periods, or hyphens.", + ), + ) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate/virtual_machine_scale_set_public_ip_address_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate/virtual_machine_scale_set_public_ip_address_id.go new file mode 100644 index 00000000000..58a4f394a11 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate/virtual_machine_scale_set_public_ip_address_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" +) + +func VirtualMachineScaleSetPublicIPAddressID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.VirtualMachineScaleSetPublicIPAddressID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate/web_application_firewall_policy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate/web_application_firewall_policy.go index e26700cda70..6606ca2d962 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate/web_application_firewall_policy.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate/web_application_firewall_policy.go @@ -16,7 +16,7 @@ var ValidateWebApplicationFirewallPolicyRuleGroupName = validation.StringInSlice "crs_42_tight_security", "crs_45_trojans", "General", - "KNOWN-CVES", + "Known-CVEs", "REQUEST-911-METHOD-ENFORCEMENT", "REQUEST-913-SCANNER-DETECTION", "REQUEST-920-PROTOCOL-ENFORCEMENT", @@ -44,3 +44,11 @@ var ValidateWebApplicationFirewallPolicyRuleSetType = validation.StringInSlice([ "OWASP", "Microsoft_BotManagerRuleSet", }, false) + +var ValidateWebApplicationFirewallPolicyExclusionRuleSetVersion = validation.StringInSlice([]string{ + "3.2", +}, false) + +var ValidateWebApplicationFirewallPolicyExclusionRuleSetType = validation.StringInSlice([]string{ + "OWASP", +}, false) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/virtual_network_gateway_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/virtual_network_gateway_resource.go index 03fe08993c5..3a52544ed2c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/virtual_network_gateway_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/virtual_network_gateway_resource.go @@ -6,10 +6,9 @@ import ( "log" "time" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/virtual_network_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/virtual_network_resource.go index e636e4ee1b6..d29b8bd8500 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/virtual_network_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/virtual_network_resource.go @@ -8,10 +8,9 @@ import ( "net/http" "time" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/vpn_site_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/vpn_site_resource.go index 211a2ace68a..869faba4d22 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/vpn_site_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/vpn_site_resource.go @@ -137,6 +137,44 @@ func resourceVpnSite() *pluginsdk.Resource { }, }, + "o365_policy": { + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "traffic_category": { + Type: pluginsdk.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "allow_endpoint_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "default_endpoint_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "optimize_endpoint_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + }, + }, + }, + }, + }, + }, + "tags": tags.Schema(), }, } @@ -172,6 +210,7 @@ func resourceVpnSiteCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) er DeviceProperties: expandVpnSiteDeviceProperties(d), AddressSpace: expandVpnSiteAddressSpace(d.Get("address_cidrs").(*pluginsdk.Set).List()), VpnSiteLinks: expandVpnSiteLinks(d.Get("link").([]interface{})), + O365Policy: expandVpnSiteO365Policy(d.Get("o365_policy").([]interface{})), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } @@ -244,6 +283,9 @@ func resourceVpnSiteRead(d *pluginsdk.ResourceData, meta interface{}) error { if err := d.Set("link", flattenVpnSiteLinks(prop.VpnSiteLinks)); err != nil { return fmt.Errorf("setting `link`") } + if err := d.Set("o365_policy", flattenVpnSiteO365Policy(prop.O365Policy)); err != nil { + return fmt.Errorf("setting `o365_policy`") + } } return tags.FlattenAndSet(d, resp.Tags) @@ -447,3 +489,75 @@ func flattenVpnSiteVpnSiteBgpSettings(input *network.VpnLinkBgpSettings) []inter }, } } + +func expandVpnSiteO365Policy(input []interface{}) *network.O365PolicyProperties { + if len(input) == 0 || input[0] == nil { + return nil + } + + o365Policy := input[0].(map[string]interface{}) + + return &network.O365PolicyProperties{ + BreakOutCategories: expandVpnSiteO365TrafficCategoryPolicy(o365Policy["traffic_category"].([]interface{})), + } +} + +func expandVpnSiteO365TrafficCategoryPolicy(input []interface{}) *network.O365BreakOutCategoryPolicies { + if len(input) == 0 || input[0] == nil { + return nil + } + + trafficCategory := input[0].(map[string]interface{}) + + return &network.O365BreakOutCategoryPolicies{ + Allow: utils.Bool(trafficCategory["allow_endpoint_enabled"].(bool)), + Default: utils.Bool(trafficCategory["default_endpoint_enabled"].(bool)), + Optimize: utils.Bool(trafficCategory["optimize_endpoint_enabled"].(bool)), + } +} + +func flattenVpnSiteO365Policy(input *network.O365PolicyProperties) []interface{} { + if input == nil { + return []interface{}{} + } + + var trafficCategory []interface{} + if input.BreakOutCategories != nil { + trafficCategory = flattenVpnSiteO365TrafficCategoryPolicy(input.BreakOutCategories) + } + + return []interface{}{ + map[string]interface{}{ + "traffic_category": trafficCategory, + }, + } +} + +func flattenVpnSiteO365TrafficCategoryPolicy(input *network.O365BreakOutCategoryPolicies) []interface{} { + if input == nil { + return []interface{}{} + } + + isAllowed := false + if input.Allow != nil { + isAllowed = *input.Allow + } + + isDefault := false + if input.Default != nil { + isDefault = *input.Default + } + + isOptimized := false + if input.Optimize != nil { + isOptimized = *input.Optimize + } + + return []interface{}{ + map[string]interface{}{ + "allow_endpoint_enabled": isAllowed, + "default_endpoint_enabled": isDefault, + "optimize_endpoint_enabled": isOptimized, + }, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/web_application_firewall_policy_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/web_application_firewall_policy_resource.go index 610c741618a..3ca900514a6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/web_application_firewall_policy_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/web_application_firewall_policy_resource.go @@ -195,6 +195,47 @@ func resourceWebApplicationFirewallPolicy() *pluginsdk.Resource { string(network.OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith), }, false), }, + "excluded_rule_set": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "type": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "OWASP", + ValidateFunc: validate.ValidateWebApplicationFirewallPolicyExclusionRuleSetType, + }, + "version": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "3.2", + ValidateFunc: validate.ValidateWebApplicationFirewallPolicyExclusionRuleSetVersion, + }, + "rule_group": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "rule_group_name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.ValidateWebApplicationFirewallPolicyRuleGroupName, + }, + "excluded_rules": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + }, + }, + }, + }, + }, + }, }, }, }, @@ -475,6 +516,62 @@ func expandWebApplicationFirewallPolicyManagedRulesDefinition(input []interface{ } } +func expandWebApplicationFirewallPolicyExclusionManagedRules(input []interface{}) *[]network.ExclusionManagedRule { + results := make([]network.ExclusionManagedRule, 0) + for _, item := range input { + ruleID := item.(string) + + result := network.ExclusionManagedRule{ + RuleID: utils.String(ruleID), + } + + results = append(results, result) + } + return &results +} + +func expandWebApplicationFirewallPolicyExclusionManagedRuleGroup(input []interface{}) *[]network.ExclusionManagedRuleGroup { + results := make([]network.ExclusionManagedRuleGroup, 0) + for _, item := range input { + v := item.(map[string]interface{}) + + ruleGroupName := v["rule_group_name"].(string) + + result := network.ExclusionManagedRuleGroup{ + RuleGroupName: utils.String(ruleGroupName), + } + + if excludedRules := v["excluded_rules"].([]interface{}); len(excludedRules) > 0 { + result.Rules = expandWebApplicationFirewallPolicyExclusionManagedRules(excludedRules) + } + + results = append(results, result) + } + return &results +} + +func expandWebApplicationFirewallPolicyExclusionManagedRuleSet(input []interface{}) *[]network.ExclusionManagedRuleSet { + results := make([]network.ExclusionManagedRuleSet, 0) + for _, item := range input { + v := item.(map[string]interface{}) + + ruleSetType := v["type"].(string) + ruleSetVersion := v["version"].(string) + ruleGroups := make([]interface{}, 0) + if value, exists := v["rule_group"]; exists { + ruleGroups = value.([]interface{}) + } + result := network.ExclusionManagedRuleSet{ + RuleSetType: utils.String(ruleSetType), + RuleSetVersion: utils.String(ruleSetVersion), + RuleGroups: expandWebApplicationFirewallPolicyExclusionManagedRuleGroup(ruleGroups), + } + + results = append(results, result) + } + return &results +} + func expandWebApplicationFirewallPolicyExclusions(input []interface{}) *[]network.OwaspCrsExclusionEntry { results := make([]network.OwaspCrsExclusionEntry, 0) for _, item := range input { @@ -483,11 +580,13 @@ func expandWebApplicationFirewallPolicyExclusions(input []interface{}) *[]networ matchVariable := v["match_variable"].(string) selectorMatchOperator := v["selector_match_operator"].(string) selector := v["selector"].(string) + exclusionManagedRuleSets := v["excluded_rule_set"].([]interface{}) result := network.OwaspCrsExclusionEntry{ - MatchVariable: network.OwaspCrsExclusionEntryMatchVariable(matchVariable), - SelectorMatchOperator: network.OwaspCrsExclusionEntrySelectorMatchOperator(selectorMatchOperator), - Selector: utils.String(selector), + MatchVariable: network.OwaspCrsExclusionEntryMatchVariable(matchVariable), + SelectorMatchOperator: network.OwaspCrsExclusionEntrySelectorMatchOperator(selectorMatchOperator), + Selector: utils.String(selector), + ExclusionManagedRuleSets: expandWebApplicationFirewallPolicyExclusionManagedRuleSet(exclusionManagedRuleSets), } results = append(results, result) @@ -653,6 +752,57 @@ func flattenWebApplicationFirewallPolicyManagedRulesDefinition(input *network.Ma return results } +func flattenWebApplicationFirewallPolicyExclusionManagedRules(input *[]network.ExclusionManagedRule) []string { + results := make([]string, 0) + if input == nil || len(*input) == 0 { + return results + } + + for _, item := range *input { + if item.RuleID != nil { + v := *item.RuleID + results = append(results, v) + } + } + + return results +} + +func flattenWebApplicationFirewallPolicyExclusionManagedRuleGroups(input *[]network.ExclusionManagedRuleGroup) []interface{} { + results := make([]interface{}, 0) + if input == nil { + return results + } + + for _, item := range *input { + v := make(map[string]interface{}) + + v["rule_group_name"] = item.RuleGroupName + v["excluded_rules"] = flattenWebApplicationFirewallPolicyExclusionManagedRules(item.Rules) + + results = append(results, v) + } + return results +} + +func flattenWebApplicationFirewallPolicyExclusionManagedRuleSets(input *[]network.ExclusionManagedRuleSet) []interface{} { + results := make([]interface{}, 0) + if input == nil { + return results + } + + for _, item := range *input { + v := make(map[string]interface{}) + + v["type"] = item.RuleSetType + v["version"] = item.RuleSetVersion + v["rule_group"] = flattenWebApplicationFirewallPolicyExclusionManagedRuleGroups(item.RuleGroups) + + results = append(results, v) + } + return results +} + func flattenWebApplicationFirewallPolicyExclusions(input *[]network.OwaspCrsExclusionEntry) []interface{} { results := make([]interface{}, 0) if input == nil { @@ -668,7 +818,9 @@ func flattenWebApplicationFirewallPolicyExclusions(input *[]network.OwaspCrsExcl if selector != nil { v["selector"] = *selector } + v["selector_match_operator"] = string(item.SelectorMatchOperator) + v["excluded_rule_set"] = flattenWebApplicationFirewallPolicyExclusionManagedRuleSets(item.ExclusionManagedRuleSets) results = append(results, v) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/client/client.go index da5d87aa4d9..bed809a1047 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/client/client.go @@ -1,20 +1,21 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs" + "github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - HubsClient *notificationhubs.Client - NamespacesClient *notificationhubs.NamespacesClient + HubsClient *notificationhubs.NotificationHubsClient + NamespacesClient *namespaces.NamespacesClient } func NewClient(o *common.ClientOptions) *Client { - hubsClient := notificationhubs.NewClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + hubsClient := notificationhubs.NewNotificationHubsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&hubsClient.Client, o.ResourceManagerAuthorizer) - namespacesClient := notificationhubs.NewNamespacesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + namespacesClient := namespaces.NewNamespacesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&namespacesClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration/notification_hub_authorization_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration/notification_hub_authorization_rule_resource.go index f02531d3ca1..d6647d8fb63 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration/notification_hub_authorization_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration/notification_hub_authorization_rule_resource.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse" + "github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -71,7 +71,7 @@ func (NotificationHubAuthorizationRuleResourceV0ToV1) Schema() map[string]*plugi func (NotificationHubAuthorizationRuleResourceV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { oldIdRaw := rawState["id"].(string) - oldId, err := parse.NotificationHubAuthorizationRuleIDInsensitively(oldIdRaw) + oldId, err := notificationhubs.ParseNotificationHubAuthorizationRuleIDInsensitively(oldIdRaw) if err != nil { return rawState, fmt.Errorf("parsing ID %q to upgrade: %+v", oldIdRaw, err) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration/notification_hub_namespace_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration/notification_hub_namespace_resource.go index ae7fb36971a..959adaab826 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration/notification_hub_namespace_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration/notification_hub_namespace_resource.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse" + "github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -66,7 +66,7 @@ func (NotificationHubNamespaceResourceV0ToV1) Schema() map[string]*pluginsdk.Sch func (NotificationHubNamespaceResourceV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { oldIdRaw := rawState["id"].(string) - oldId, err := parse.NamespaceIDInsensitively(oldIdRaw) + oldId, err := namespaces.ParseNamespaceIDInsensitively(oldIdRaw) if err != nil { return rawState, fmt.Errorf("parsing ID %q to upgrade: %+v", oldIdRaw, err) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration/notification_hub_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration/notification_hub_resource.go index 2e935791465..a9993bd1c9c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration/notification_hub_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration/notification_hub_resource.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse" + "github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -101,7 +101,7 @@ func (NotificationHubResourceV0ToV1) Schema() map[string]*pluginsdk.Schema { func (NotificationHubResourceV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { oldIdRaw := rawState["id"].(string) - oldId, err := parse.NotificationHubIDInsensitively(oldIdRaw) + oldId, err := notificationhubs.ParseNotificationHubIDInsensitively(oldIdRaw) if err != nil { return rawState, fmt.Errorf("parsing ID %q to upgrade: %+v", oldIdRaw, err) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_authorization_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_authorization_rule_resource.go index e8a7d493c16..04338c703a9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_authorization_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_authorization_rule_resource.go @@ -5,16 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceNotificationHubAuthorizationRule() *pluginsdk.Resource { @@ -24,7 +23,7 @@ func resourceNotificationHubAuthorizationRule() *pluginsdk.Resource { Update: resourceNotificationHubAuthorizationRuleCreateUpdate, Delete: resourceNotificationHubAuthorizationRuleDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.NotificationHubAuthorizationRuleID(id) + _, err := notificationhubs.ParseNotificationHubAuthorizationRuleID(id) return err }), // TODO: customizeDiff for send+listen when manage selected @@ -99,16 +98,16 @@ func resourceNotificationHubAuthorizationRuleCreateUpdate(d *pluginsdk.ResourceD ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewNotificationHubAuthorizationRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("namespace_name").(string), d.Get("notification_hub_name").(string), d.Get("name").(string)) + id := notificationhubs.NewNotificationHubAuthorizationRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("namespace_name").(string), d.Get("notification_hub_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.GetAuthorizationRule(ctx, id.ResourceGroup, id.NamespaceName, id.NotificationHubName, id.AuthorizationRuleName) + existing, err := client.GetAuthorizationRule(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_notification_hub_authorization_rule", id.ID()) } } @@ -123,12 +122,12 @@ func resourceNotificationHubAuthorizationRuleCreateUpdate(d *pluginsdk.ResourceD send := d.Get("send").(bool) listen := d.Get("listen").(bool) parameters := notificationhubs.SharedAccessAuthorizationRuleCreateOrUpdateParameters{ - Properties: ¬ificationhubs.SharedAccessAuthorizationRuleProperties{ + Properties: notificationhubs.SharedAccessAuthorizationRuleProperties{ Rights: expandNotificationHubAuthorizationRuleRights(manage, send, listen), }, } - if _, err := client.CreateOrUpdateAuthorizationRule(ctx, id.ResourceGroup, id.NamespaceName, id.NotificationHubName, id.AuthorizationRuleName, parameters); err != nil { + if _, err := client.CreateOrUpdateAuthorizationRule(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -141,14 +140,14 @@ func resourceNotificationHubAuthorizationRuleRead(d *pluginsdk.ResourceData, met ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NotificationHubAuthorizationRuleID(d.Id()) + id, err := notificationhubs.ParseNotificationHubAuthorizationRuleID(d.Id()) if err != nil { return err } - resp, err := client.GetAuthorizationRule(ctx, id.ResourceGroup, id.NamespaceName, id.NotificationHubName, id.AuthorizationRuleName) + resp, err := client.GetAuthorizationRule(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state", *id) d.SetId("") return nil @@ -157,7 +156,7 @@ func resourceNotificationHubAuthorizationRuleRead(d *pluginsdk.ResourceData, met return fmt.Errorf("retrieving %s: %+v", *id, err) } - keysResp, err := client.ListKeys(ctx, id.ResourceGroup, id.NamespaceName, id.NotificationHubName, id.AuthorizationRuleName) + keysResp, err := client.ListKeys(ctx, *id) if err != nil { return fmt.Errorf("listing access keys for %s: %+v", *id, err) } @@ -165,17 +164,21 @@ func resourceNotificationHubAuthorizationRuleRead(d *pluginsdk.ResourceData, met d.Set("name", id.AuthorizationRuleName) d.Set("notification_hub_name", id.NotificationHubName) d.Set("namespace_name", id.NamespaceName) - d.Set("resource_group_name", id.ResourceGroup) - - if props := resp.SharedAccessAuthorizationRuleProperties; props != nil { - manage, send, listen := flattenNotificationHubAuthorizationRuleRights(props.Rights) - d.Set("manage", manage) - d.Set("send", send) - d.Set("listen", listen) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + manage, send, listen := flattenNotificationHubAuthorizationRuleRights(props.Rights) + d.Set("manage", manage) + d.Set("send", send) + d.Set("listen", listen) + } } - d.Set("primary_access_key", keysResp.PrimaryKey) - d.Set("secondary_access_key", keysResp.SecondaryKey) + if keysModel := keysResp.Model; keysModel != nil { + d.Set("primary_access_key", keysModel.PrimaryKey) + d.Set("secondary_access_key", keysModel.SecondaryKey) + } return nil } @@ -185,7 +188,7 @@ func resourceNotificationHubAuthorizationRuleDelete(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NotificationHubAuthorizationRuleID(d.Id()) + id, err := notificationhubs.ParseNotificationHubAuthorizationRuleID(d.Id()) if err != nil { return err } @@ -196,9 +199,9 @@ func resourceNotificationHubAuthorizationRuleDelete(d *pluginsdk.ResourceData, m locks.ByName(id.NamespaceName, notificationHubNamespaceResourceName) defer locks.UnlockByName(id.NamespaceName, notificationHubNamespaceResourceName) - resp, err := client.DeleteAuthorizationRule(ctx, id.ResourceGroup, id.NamespaceName, id.NotificationHubName, id.AuthorizationRuleName) + resp, err := client.DeleteAuthorizationRule(ctx, *id) if err != nil { - if !utils.ResponseWasNotFound(resp) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_data_source.go index 39eb264eec1..946f5fc24b5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_data_source.go @@ -4,15 +4,14 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceNotificationHub() *pluginsdk.Resource { @@ -83,7 +82,7 @@ func dataSourceNotificationHub() *pluginsdk.Resource { }, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -94,42 +93,48 @@ func dataSourceNotificationHubRead(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewNotificationHubID(subscriptionId, d.Get("resource_group_name").(string), d.Get("namespace_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.NamespaceName, id.Name) + id := notificationhubs.NewNotificationHubID(subscriptionId, d.Get("resource_group_name").(string), d.Get("namespace_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } - credentials, err := client.GetPnsCredentials(ctx, id.ResourceGroup, id.NamespaceName, id.Name) + credentials, err := client.GetPnsCredentials(ctx, id) if err != nil { return fmt.Errorf("retrieving credentials for %s: %+v", id, err) } d.SetId(id.ID()) - d.Set("name", id.Name) + d.Set("name", id.NotificationHubName) d.Set("namespace_name", id.NamespaceName) - d.Set("resource_group_name", id.ResourceGroup) - - d.Set("location", location.NormalizeNilable(resp.Location)) - - if props := credentials.PnsCredentialsProperties; props != nil { - apns := flattenNotificationHubsDataSourceAPNSCredentials(props.ApnsCredential) - if setErr := d.Set("apns_credential", apns); setErr != nil { - return fmt.Errorf("setting `apns_credential`: %+v", err) + d.Set("resource_group_name", id.ResourceGroupName) + + if credentialsModel := credentials.Model; credentialsModel != nil { + if props := credentialsModel.Properties; props != nil { + apns := flattenNotificationHubsDataSourceAPNSCredentials(props.ApnsCredential) + if setErr := d.Set("apns_credential", apns); setErr != nil { + return fmt.Errorf("setting `apns_credential`: %+v", err) + } + + gcm := flattenNotificationHubsDataSourceGCMCredentials(props.GcmCredential) + if setErr := d.Set("gcm_credential", gcm); setErr != nil { + return fmt.Errorf("setting `gcm_credential`: %+v", err) + } } + } - gcm := flattenNotificationHubsDataSourceGCMCredentials(props.GcmCredential) - if setErr := d.Set("gcm_credential", gcm); setErr != nil { - return fmt.Errorf("setting `gcm_credential`: %+v", err) - } + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + + return d.Set("tags", tags.Flatten(model.Tags)) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func flattenNotificationHubsDataSourceAPNSCredentials(input *notificationhubs.ApnsCredential) []interface{} { @@ -139,29 +144,31 @@ func flattenNotificationHubsDataSourceAPNSCredentials(input *notificationhubs.Ap output := make(map[string]interface{}) - if bundleId := input.AppName; bundleId != nil { - output["bundle_id"] = *bundleId - } + if props := input.Properties; props != nil { + if bundleId := props.AppName; bundleId != nil { + output["bundle_id"] = *bundleId + } - if endpoint := input.Endpoint; endpoint != nil { - applicationEndpoints := map[string]string{ - "https://api.push.apple.com:443/3/device": "Production", - "https://api.development.push.apple.com:443/3/device": "Sandbox", + if endpoint := props.Endpoint; endpoint != nil { + applicationEndpoints := map[string]string{ + "https://api.push.apple.com:443/3/device": "Production", + "https://api.development.push.apple.com:443/3/device": "Sandbox", + } + applicationMode := applicationEndpoints[*endpoint] + output["application_mode"] = applicationMode } - applicationMode := applicationEndpoints[*endpoint] - output["application_mode"] = applicationMode - } - if keyId := input.KeyID; keyId != nil { - output["key_id"] = *keyId - } + if keyId := props.KeyId; keyId != nil { + output["key_id"] = *keyId + } - if teamId := input.AppID; teamId != nil { - output["team_id"] = *teamId - } + if teamId := props.AppId; teamId != nil { + output["team_id"] = *teamId + } - if token := input.Token; token != nil { - output["token"] = *token + if token := props.Token; token != nil { + output["token"] = *token + } } return []interface{}{output} @@ -173,8 +180,8 @@ func flattenNotificationHubsDataSourceGCMCredentials(input *notificationhubs.Gcm } output := make(map[string]interface{}) - if props := input.GcmCredentialProperties; props != nil { - if apiKey := props.GoogleAPIKey; apiKey != nil { + if props := input.Properties; props != nil { + if apiKey := props.GoogleApiKey; apiKey != nil { output["api_key"] = *apiKey } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_namespace_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_namespace_data_source.go index 781e19f8c1e..dfec2057ac4 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_namespace_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_namespace_data_source.go @@ -4,15 +4,14 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceNotificationHubNamespace() *pluginsdk.Resource { @@ -56,7 +55,7 @@ func dataSourceNotificationHubNamespace() *pluginsdk.Resource { Computed: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), "servicebus_endpoint": { Type: pluginsdk.TypeString, @@ -72,10 +71,10 @@ func resourceArmDataSourceNotificationHubNamespaceRead(d *pluginsdk.ResourceData ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewNamespaceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := namespaces.NewNamespaceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } @@ -83,25 +82,29 @@ func resourceArmDataSourceNotificationHubNamespaceRead(d *pluginsdk.ResourceData } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.NamespaceName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + sku := flattenNotificationHubDataSourceNamespacesSku(model.Sku) + if err := d.Set("sku", sku); err != nil { + return fmt.Errorf("setting `sku`: %+v", err) + } - sku := flattenNotificationHubDataSourceNamespacesSku(resp.Sku) - if err := d.Set("sku", sku); err != nil { - return fmt.Errorf("setting `sku`: %+v", err) - } + if props := model.Properties; props != nil { + d.Set("enabled", props.Enabled) + d.Set("namespace_type", props.NamespaceType) + d.Set("servicebus_endpoint", props.ServiceBusEndpoint) + } - if props := resp.NamespaceProperties; props != nil { - d.Set("enabled", props.Enabled) - d.Set("namespace_type", props.NamespaceType) - d.Set("servicebus_endpoint", props.ServiceBusEndpoint) + return d.Set("tags", tags.Flatten(model.Tags)) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } -func flattenNotificationHubDataSourceNamespacesSku(input *notificationhubs.Sku) []interface{} { +func flattenNotificationHubDataSourceNamespacesSku(input *namespaces.Sku) []interface{} { outputs := make([]interface{}, 0) if input == nil { return outputs diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_namespace_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_namespace_resource.go index 11a3b84731b..db94bdcc906 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_namespace_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_namespace_resource.go @@ -7,15 +7,15 @@ import ( "strconv" "time" - "github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -31,7 +31,7 @@ func resourceNotificationHubNamespace() *pluginsdk.Resource { Update: resourceNotificationHubNamespaceCreateUpdate, Delete: resourceNotificationHubNamespaceDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.NamespaceID(id) + _, err := namespaces.ParseNamespaceID(id) return err }), @@ -62,9 +62,9 @@ func resourceNotificationHubNamespace() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(notificationhubs.SkuNameBasic), - string(notificationhubs.SkuNameFree), - string(notificationhubs.SkuNameStandard), + string(namespaces.SkuNameBasic), + string(namespaces.SkuNameFree), + string(namespaces.SkuNameStandard), }, false), }, @@ -78,12 +78,12 @@ func resourceNotificationHubNamespace() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(notificationhubs.NamespaceTypeMessaging), - string(notificationhubs.NamespaceTypeNotificationHub), + string(namespaces.NamespaceTypeMessaging), + string(namespaces.NamespaceTypeNotificationHub), }, false), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "servicebus_endpoint": { Type: pluginsdk.TypeString, @@ -99,34 +99,35 @@ func resourceNotificationHubNamespaceCreateUpdate(d *pluginsdk.ResourceData, met ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewNamespaceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := namespaces.NewNamespaceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_notification_hub_namespace", id.ID()) } } + namespaceType := namespaces.NamespaceType(d.Get("namespace_type").(string)) location := location.Normalize(d.Get("location").(string)) - parameters := notificationhubs.NamespaceCreateOrUpdateParameters{ - Location: utils.String(location), - Sku: ¬ificationhubs.Sku{ - Name: notificationhubs.SkuName(d.Get("sku_name").(string)), + parameters := namespaces.NamespaceCreateOrUpdateParameters{ + Location: location, + Sku: &namespaces.Sku{ + Name: namespaces.SkuName(d.Get("sku_name").(string)), }, - NamespaceProperties: ¬ificationhubs.NamespaceProperties{ + Properties: &namespaces.NamespaceProperties{ Region: utils.String(location), - NamespaceType: notificationhubs.NamespaceType(d.Get("namespace_type").(string)), + NamespaceType: &namespaceType, Enabled: utils.Bool(d.Get("enabled").(bool)), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -158,14 +159,14 @@ func resourceNotificationHubNamespaceRead(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NamespaceID(d.Id()) + id, err := namespaces.ParseNamespaceID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -174,22 +175,25 @@ func resourceNotificationHubNamespaceRead(d *pluginsdk.ResourceData, meta interf return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.NamespaceName) + d.Set("resource_group_name", id.ResourceGroupName) - skuName := "" - if resp.Sku != nil { - skuName = string(resp.Sku.Name) - } - d.Set("sku_name", skuName) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) - if props := resp.NamespaceProperties; props != nil { - d.Set("enabled", props.Enabled) - d.Set("servicebus_endpoint", props.ServiceBusEndpoint) - } + skuName := "" + if v := model.Sku; v != nil { + skuName = string(v.Name) + } + d.Set("sku_name", skuName) + if props := model.Properties; props != nil { + d.Set("enabled", props.Enabled) + d.Set("servicebus_endpoint", props.ServiceBusEndpoint) + } - return tags.FlattenAndSet(d, resp.Tags) + return tags.FlattenAndSet(d, model.Tags) + } + return nil } func resourceNotificationHubNamespaceDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -197,69 +201,38 @@ func resourceNotificationHubNamespaceDelete(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NamespaceID(d.Id()) + id, err := namespaces.ParseNamespaceID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) + future, err := client.Delete(ctx, *id) if err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("deleting Notification Hub Namespace %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if !response.WasNotFound(future.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) } } - // the future returned from the Delete method is broken 50% of the time - let's poll ourselves for now - // Related Bug: https://github.com/Azure/azure-sdk-for-go/issues/2254 - log.Printf("[DEBUG] Waiting for Notification Hub Namespace %q (Resource Group %q) to be deleted", id.Name, id.ResourceGroup) - stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{"200", "202"}, - Target: []string{"404"}, - Refresh: notificationHubNamespaceDeleteStateRefreshFunc(ctx, client, *id), - Timeout: d.Timeout(pluginsdk.TimeoutDelete), - } - if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for Notification Hub %q (Resource Group %q) to be deleted: %s", id.Name, id.ResourceGroup, err) + if err := future.Poller.PollUntilDone(); err != nil { + if !response.WasNotFound(future.Poller.HttpResponse) { + return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) + } } return nil } -func notificationHubNamespaceStateRefreshFunc(ctx context.Context, client *notificationhubs.NamespacesClient, id parse.NamespaceId) pluginsdk.StateRefreshFunc { +func notificationHubNamespaceStateRefreshFunc(ctx context.Context, client *namespaces.NamespacesClient, id namespaces.NamespaceId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(res.Response) { + if response.WasNotFound(resp.HttpResponse) { return nil, "404", nil } return nil, "", fmt.Errorf("retrieving %s: %+v", id, err) } - return res, strconv.Itoa(res.StatusCode), nil - } -} - -func notificationHubNamespaceDeleteStateRefreshFunc(ctx context.Context, client *notificationhubs.NamespacesClient, id parse.NamespaceId) pluginsdk.StateRefreshFunc { - return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.Name) - if err != nil { - if !utils.ResponseWasNotFound(res.Response) { - return nil, "", fmt.Errorf("retrieving %s: %+v", id, err) - } - } - - // Note: this exists as the Delete API only seems to work some of the time - // in this case we're going to try triggering the Deletion again, in-case it didn't work prior to this attepmpt - // Upstream Bug: https://github.com/Azure/azure-sdk-for-go/issues/2254 - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { - log.Printf("re-issuing deletion request for %s: %+v", id, err) - } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - log.Printf("waiting for re-issue deletion request for %s: %+v", id, err) - } - - return res, strconv.Itoa(res.StatusCode), nil + return resp, strconv.Itoa(resp.HttpResponse.StatusCode), nil } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_resource.go index 3c25300be2c..d3ffd0cbf11 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/notification_hub_resource.go @@ -7,14 +7,15 @@ import ( "strconv" "time" - "github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -38,7 +39,7 @@ func resourceNotificationHub() *pluginsdk.Resource { Delete: resourceNotificationHubDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.NotificationHubID(id) + _, err := notificationhubs.ParseNotificationHubID(id) return err }), @@ -146,7 +147,7 @@ func resourceNotificationHub() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -157,30 +158,30 @@ func resourceNotificationHubCreateUpdate(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewNotificationHubID(subscriptionId, d.Get("resource_group_name").(string), d.Get("namespace_name").(string), d.Get("name").(string)) + id := notificationhubs.NewNotificationHubID(subscriptionId, d.Get("resource_group_name").(string), d.Get("namespace_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.NamespaceName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_notification_hub", id.ID()) } } - parameters := notificationhubs.CreateOrUpdateParameters{ + parameters := notificationhubs.NotificationHubCreateOrUpdateParameters{ Location: utils.String(location.Normalize(d.Get("location").(string))), - Properties: ¬ificationhubs.Properties{ + Properties: notificationhubs.NotificationHubProperties{ ApnsCredential: expandNotificationHubsAPNSCredentials(d.Get("apns_credential").([]interface{})), GcmCredential: expandNotificationHubsGCMCredentials(d.Get("gcm_credential").([]interface{})), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.NamespaceName, id.Name, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -206,18 +207,18 @@ func resourceNotificationHubCreateUpdate(d *pluginsdk.ResourceData, meta interfa return resourceNotificationHubRead(d, meta) } -func notificationHubStateRefreshFunc(ctx context.Context, client *notificationhubs.Client, id parse.NotificationHubId) pluginsdk.StateRefreshFunc { +func notificationHubStateRefreshFunc(ctx context.Context, client *notificationhubs.NotificationHubsClient, id notificationhubs.NotificationHubId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.NamespaceName, id.Name) + res, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(res.Response) { + if response.WasNotFound(res.HttpResponse) { return nil, "404", nil } return nil, "", fmt.Errorf("retrieving %s: %+v", id, err) } - return res, strconv.Itoa(res.StatusCode), nil + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil } } @@ -226,14 +227,14 @@ func resourceNotificationHubRead(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NotificationHubID(d.Id()) + id, err := notificationhubs.ParseNotificationHubID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NamespaceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state", *id) d.SetId("") return nil @@ -242,29 +243,35 @@ func resourceNotificationHubRead(d *pluginsdk.ResourceData, meta interface{}) er return fmt.Errorf("retrieving %s: %+v", *id, err) } - credentials, err := client.GetPnsCredentials(ctx, id.ResourceGroup, id.NamespaceName, id.Name) + credentials, err := client.GetPnsCredentials(ctx, *id) if err != nil { return fmt.Errorf("retrieving credentials for %s: %+v", *id, err) } - d.Set("name", resp.Name) + d.Set("name", id.NotificationHubName) d.Set("namespace_name", id.NamespaceName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("resource_group_name", id.ResourceGroupName) - if props := credentials.PnsCredentialsProperties; props != nil { - apns := flattenNotificationHubsAPNSCredentials(props.ApnsCredential) - if setErr := d.Set("apns_credential", apns); setErr != nil { - return fmt.Errorf("setting `apns_credential`: %+v", setErr) + if credentialsModel := credentials.Model; credentialsModel != nil { + if props := credentialsModel.Properties; props != nil { + apns := flattenNotificationHubsAPNSCredentials(props.ApnsCredential) + if setErr := d.Set("apns_credential", apns); setErr != nil { + return fmt.Errorf("setting `apns_credential`: %+v", setErr) + } + gcm := flattenNotificationHubsGCMCredentials(props.GcmCredential) + if setErr := d.Set("gcm_credential", gcm); setErr != nil { + return fmt.Errorf("setting `gcm_credential`: %+v", setErr) + } } + } - gcm := flattenNotificationHubsGCMCredentials(props.GcmCredential) - if setErr := d.Set("gcm_credential", gcm); setErr != nil { - return fmt.Errorf("setting `gcm_credential`: %+v", setErr) - } + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + + return d.Set("tags", tags.Flatten(model.Tags)) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceNotificationHubDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -272,14 +279,14 @@ func resourceNotificationHubDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NotificationHubID(d.Id()) + id, err := notificationhubs.ParseNotificationHubID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.NamespaceName, id.Name) + resp, err := client.Delete(ctx, *id) if err != nil { - if !utils.ResponseWasNotFound(resp) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", *id, err) } } @@ -306,11 +313,11 @@ func expandNotificationHubsAPNSCredentials(inputs []interface{}) *notificationhu endpoint := applicationEndpoints[applicationMode] credentials := notificationhubs.ApnsCredential{ - ApnsCredentialProperties: ¬ificationhubs.ApnsCredentialProperties{ - AppID: utils.String(teamId), + Properties: ¬ificationhubs.ApnsCredentialProperties{ + AppId: utils.String(teamId), AppName: utils.String(bundleId), Endpoint: utils.String(endpoint), - KeyID: utils.String(keyId), + KeyId: utils.String(keyId), Token: utils.String(token), }, } @@ -324,29 +331,31 @@ func flattenNotificationHubsAPNSCredentials(input *notificationhubs.ApnsCredenti output := make(map[string]interface{}) - if bundleId := input.AppName; bundleId != nil { - output["bundle_id"] = *bundleId - } + if props := input.Properties; props != nil { + if bundleId := props.AppName; bundleId != nil { + output["bundle_id"] = *bundleId + } - if endpoint := input.Endpoint; endpoint != nil { - applicationEndpoints := map[string]string{ - apnsProductionEndpoint: apnsProductionName, - apnsSandboxEndpoint: apnsSandboxName, + if endpoint := props.Endpoint; endpoint != nil { + applicationEndpoints := map[string]string{ + apnsProductionEndpoint: apnsProductionName, + apnsSandboxEndpoint: apnsSandboxName, + } + applicationMode := applicationEndpoints[*endpoint] + output["application_mode"] = applicationMode } - applicationMode := applicationEndpoints[*endpoint] - output["application_mode"] = applicationMode - } - if keyId := input.KeyID; keyId != nil { - output["key_id"] = *keyId - } + if keyId := props.KeyId; keyId != nil { + output["key_id"] = *keyId + } - if teamId := input.AppID; teamId != nil { - output["team_id"] = *teamId - } + if teamId := props.AppId; teamId != nil { + output["team_id"] = *teamId + } - if token := input.Token; token != nil { - output["token"] = *token + if token := props.Token; token != nil { + output["token"] = *token + } } return []interface{}{output} @@ -360,8 +369,8 @@ func expandNotificationHubsGCMCredentials(inputs []interface{}) *notificationhub input := inputs[0].(map[string]interface{}) apiKey := input["api_key"].(string) credentials := notificationhubs.GcmCredential{ - GcmCredentialProperties: ¬ificationhubs.GcmCredentialProperties{ - GoogleAPIKey: utils.String(apiKey), + Properties: ¬ificationhubs.GcmCredentialProperties{ + GoogleApiKey: utils.String(apiKey), }, } return &credentials @@ -373,8 +382,8 @@ func flattenNotificationHubsGCMCredentials(input *notificationhubs.GcmCredential } output := make(map[string]interface{}) - if props := input.GcmCredentialProperties; props != nil { - if apiKey := props.GoogleAPIKey; apiKey != nil { + if props := input.Properties; props != nil { + if apiKey := props.GoogleApiKey; apiKey != nil { output["api_key"] = *apiKey } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse/namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse/namespace.go deleted file mode 100644 index c846b583027..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse/namespace.go +++ /dev/null @@ -1,113 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type NamespaceId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewNamespaceID(subscriptionId, resourceGroup, name string) NamespaceId { - return NamespaceId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id NamespaceId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Namespace", segmentsStr) -} - -func (id NamespaceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NotificationHubs/namespaces/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// NamespaceID parses a Namespace ID into an NamespaceId struct -func NamespaceID(input string) (*NamespaceId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := NamespaceId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("namespaces"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// NamespaceIDInsensitively parses an Namespace ID into an NamespaceId struct, insensitively -// This should only be used to parse an ID for rewriting, the NamespaceID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func NamespaceIDInsensitively(input string) (*NamespaceId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := NamespaceId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'namespaces' segment - namespacesKey := "namespaces" - for key := range id.Path { - if strings.EqualFold(key, namespacesKey) { - namespacesKey = key - break - } - } - if resourceId.Name, err = id.PopSegment(namespacesKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse/notification_hub.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse/notification_hub.go deleted file mode 100644 index 360755bfcbc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse/notification_hub.go +++ /dev/null @@ -1,131 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type NotificationHubId struct { - SubscriptionId string - ResourceGroup string - NamespaceName string - Name string -} - -func NewNotificationHubID(subscriptionId, resourceGroup, namespaceName, name string) NotificationHubId { - return NotificationHubId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NamespaceName: namespaceName, - Name: name, - } -} - -func (id NotificationHubId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Namespace Name %q", id.NamespaceName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Notification Hub", segmentsStr) -} - -func (id NotificationHubId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NotificationHubs/namespaces/%s/notificationHubs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.Name) -} - -// NotificationHubID parses a NotificationHub ID into an NotificationHubId struct -func NotificationHubID(input string) (*NotificationHubId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := NotificationHubId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NamespaceName, err = id.PopSegment("namespaces"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("notificationHubs"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// NotificationHubIDInsensitively parses an NotificationHub ID into an NotificationHubId struct, insensitively -// This should only be used to parse an ID for rewriting, the NotificationHubID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func NotificationHubIDInsensitively(input string) (*NotificationHubId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := NotificationHubId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'namespaces' segment - namespacesKey := "namespaces" - for key := range id.Path { - if strings.EqualFold(key, namespacesKey) { - namespacesKey = key - break - } - } - if resourceId.NamespaceName, err = id.PopSegment(namespacesKey); err != nil { - return nil, err - } - - // find the correct casing for the 'notificationHubs' segment - notificationHubsKey := "notificationHubs" - for key := range id.Path { - if strings.EqualFold(key, notificationHubsKey) { - notificationHubsKey = key - break - } - } - if resourceId.Name, err = id.PopSegment(notificationHubsKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse/notification_hub_authorization_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse/notification_hub_authorization_rule.go deleted file mode 100644 index 1cad41a2608..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse/notification_hub_authorization_rule.go +++ /dev/null @@ -1,149 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type NotificationHubAuthorizationRuleId struct { - SubscriptionId string - ResourceGroup string - NamespaceName string - NotificationHubName string - AuthorizationRuleName string -} - -func NewNotificationHubAuthorizationRuleID(subscriptionId, resourceGroup, namespaceName, notificationHubName, authorizationRuleName string) NotificationHubAuthorizationRuleId { - return NotificationHubAuthorizationRuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NamespaceName: namespaceName, - NotificationHubName: notificationHubName, - AuthorizationRuleName: authorizationRuleName, - } -} - -func (id NotificationHubAuthorizationRuleId) String() string { - segments := []string{ - fmt.Sprintf("Authorization Rule Name %q", id.AuthorizationRuleName), - fmt.Sprintf("Notification Hub Name %q", id.NotificationHubName), - fmt.Sprintf("Namespace Name %q", id.NamespaceName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Notification Hub Authorization Rule", segmentsStr) -} - -func (id NotificationHubAuthorizationRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NotificationHubs/namespaces/%s/notificationHubs/%s/authorizationRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.NotificationHubName, id.AuthorizationRuleName) -} - -// NotificationHubAuthorizationRuleID parses a NotificationHubAuthorizationRule ID into an NotificationHubAuthorizationRuleId struct -func NotificationHubAuthorizationRuleID(input string) (*NotificationHubAuthorizationRuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := NotificationHubAuthorizationRuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NamespaceName, err = id.PopSegment("namespaces"); err != nil { - return nil, err - } - if resourceId.NotificationHubName, err = id.PopSegment("notificationHubs"); err != nil { - return nil, err - } - if resourceId.AuthorizationRuleName, err = id.PopSegment("authorizationRules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// NotificationHubAuthorizationRuleIDInsensitively parses an NotificationHubAuthorizationRule ID into an NotificationHubAuthorizationRuleId struct, insensitively -// This should only be used to parse an ID for rewriting, the NotificationHubAuthorizationRuleID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func NotificationHubAuthorizationRuleIDInsensitively(input string) (*NotificationHubAuthorizationRuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := NotificationHubAuthorizationRuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'namespaces' segment - namespacesKey := "namespaces" - for key := range id.Path { - if strings.EqualFold(key, namespacesKey) { - namespacesKey = key - break - } - } - if resourceId.NamespaceName, err = id.PopSegment(namespacesKey); err != nil { - return nil, err - } - - // find the correct casing for the 'notificationHubs' segment - notificationHubsKey := "notificationHubs" - for key := range id.Path { - if strings.EqualFold(key, notificationHubsKey) { - notificationHubsKey = key - break - } - } - if resourceId.NotificationHubName, err = id.PopSegment(notificationHubsKey); err != nil { - return nil, err - } - - // find the correct casing for the 'authorizationRules' segment - authorizationRulesKey := "authorizationRules" - for key := range id.Path { - if strings.EqualFold(key, authorizationRulesKey) { - authorizationRulesKey = key - break - } - } - if resourceId.AuthorizationRuleName, err = id.PopSegment(authorizationRulesKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/resourceids.go deleted file mode 100644 index 335eb9093a4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/resourceids.go +++ /dev/null @@ -1,5 +0,0 @@ -package notificationhub - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Namespace -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NotificationHubs/namespaces/namespace1 -rewrite=true -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NotificationHub -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NotificationHubs/namespaces/namespace1/notificationHubs/hub1 -rewrite=true -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NotificationHubAuthorizationRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NotificationHubs/namespaces/namespace1/notificationHubs/hub1/authorizationRules/authorizationRule1 -rewrite=true diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_base_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_base_resource.go index 2f658da287a..e6e742e158a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_base_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_base_resource.go @@ -212,7 +212,8 @@ func (br assignmentBaseResource) updateFunc() sdk.ResourceFunc { } if existing.Identity != nil { update.Identity = &policy.Identity{ - Type: existing.Identity.Type, + Type: existing.Identity.Type, + UserAssignedIdentities: existing.Identity.UserAssignedIdentities, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_data_source.go new file mode 100644 index 00000000000..31e87a7dd34 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_data_source.go @@ -0,0 +1,274 @@ +package policy + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "time" + + "github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2021-06-01-preview/policy" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type AssignmentDataSource struct{} + +var _ sdk.DataSource = AssignmentDataSource{} + +type AssignmentDataSourceModel struct { + Name string `tfschema:"name"` + ScopeId string `tfschema:"scope_id"` + Description string `tfschema:"description"` + DisplayName string `tfschema:"display_name"` + Enforce bool `tfschema:"enforce"` + Identity []identity.ModelSystemAssignedUserAssigned `tfschema:"identity"` + Location string `tfschema:"location"` + Metadata string `tfschema:"metadata"` + NotScopes []string `tfschema:"not_scopes"` + NonComplianceMessage []NonComplianceMessage `tfschema:"non_compliance_message"` + Parameters string `tfschema:"parameters"` + PolicyDefinitionId string `tfschema:"policy_definition_id"` +} + +type NonComplianceMessage struct { + Content string `tfschema:"content"` + PolicyDefinitionReferenceId string `tfschema:"policy_definition_reference_id"` +} + +func (AssignmentDataSource) Arguments() map[string]*schema.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotWhiteSpace, + }, + "scope_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.Any( + commonids.ValidateManagementGroupID, + commonids.ValidateSubscriptionID, + commonids.ValidateResourceGroupID, + azure.ValidateResourceID, + ), + }, + } +} + +func (AssignmentDataSource) Attributes() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "description": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "display_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "enforce": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "identity": commonschema.SystemOrUserAssignedIdentityComputed(), + + "location": commonschema.LocationComputed(), + + "metadata": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "not_scopes": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "non_compliance_message": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "content": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "policy_definition_reference_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "parameters": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "policy_definition_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + } +} + +func (AssignmentDataSource) ModelObject() interface{} { + return &AssignmentDataSourceModel{} +} + +func (AssignmentDataSource) ResourceType() string { + return "azurerm_policy_assignment" +} + +func (AssignmentDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.Policy.AssignmentsClient + + var plan AssignmentDataSourceModel + if err := metadata.Decode(&plan); err != nil { + return fmt.Errorf("decoding %+v", err) + } + + id := parse.NewPolicyAssignmentId(plan.ScopeId, plan.Name) + resp, err := client.Get(ctx, id.Scope, id.Name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + model := AssignmentDataSourceModel{ + Name: id.Name, + ScopeId: id.Scope, + Location: location.NormalizeNilable(resp.Location), + } + + if err := model.flattenIdentity(resp.Identity); err != nil { + return fmt.Errorf("flatten `identity`: %v", err) + } + + if props := resp.AssignmentProperties; props != nil { + if v := props.Description; v != nil { + model.Description = *v + } + if v := props.DisplayName; v != nil { + model.DisplayName = *v + } + model.Enforce = props.EnforcementMode == policy.EnforcementModeDefault + model.Metadata = flattenJSON(props.Metadata) + if v := props.NotScopes; v != nil { + model.NotScopes = *v + } + model.flattenNonComplianceMessages(props.NonComplianceMessages) + if err := model.flattenParameter(props.Parameters); err != nil { + return fmt.Errorf("flatten `parameters`: %v", err) + } + if v := props.PolicyDefinitionID; v != nil { + model.PolicyDefinitionId = *v + } + } + + if err := metadata.Encode(&model); err != nil { + return fmt.Errorf("encoding %s: %+v", id, err) + } + + metadata.SetID(id) + + return nil + }, + } +} + +func (m *AssignmentDataSourceModel) flattenIdentity(input *policy.Identity) error { + if input == nil { + return nil + } + config := identity.SystemOrUserAssignedMap{ + Type: identity.Type(string(input.Type)), + IdentityIds: make(map[string]identity.UserAssignedIdentityDetails), + } + + if input.PrincipalID != nil { + config.PrincipalId = *input.PrincipalID + } + if input.TenantID != nil { + config.TenantId = *input.TenantID + } + for k, v := range input.UserAssignedIdentities { + config.IdentityIds[k] = identity.UserAssignedIdentityDetails{ + ClientId: v.ClientID, + PrincipalId: v.PrincipalID, + } + } + model, err := identity.FlattenSystemOrUserAssignedMapToModel(&config) + if err != nil { + return err + } + + m.Identity = *model + + return nil +} + +func (m *AssignmentDataSourceModel) flattenNonComplianceMessages(input *[]policy.NonComplianceMessage) { + if input == nil { + return + } + + m.NonComplianceMessage = make([]NonComplianceMessage, len(*input)) + for i, v := range *input { + content := "" + if v.Message != nil { + content = *v.Message + } + policyDefinitionReferenceId := "" + if v.PolicyDefinitionReferenceID != nil { + policyDefinitionReferenceId = *v.PolicyDefinitionReferenceID + } + m.NonComplianceMessage[i] = NonComplianceMessage{ + Content: content, + PolicyDefinitionReferenceId: policyDefinitionReferenceId, + } + } +} + +func (m *AssignmentDataSourceModel) flattenParameter(input map[string]*policy.ParameterValuesValue) error { + if len(input) == 0 { + return nil + } + + result, err := json.Marshal(input) + if err != nil { + return err + } + + compactJson := bytes.Buffer{} + if err := json.Compact(&compactJson, result); err != nil { + return err + } + + m.Parameters = compactJson.String() + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_management_group_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_management_group_resource.go index 006d65fed11..6480b40972c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_management_group_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_management_group_resource.go @@ -28,8 +28,9 @@ func (r ManagementGroupAssignmentResource) Arguments() map[string]*pluginsdk.Sch ForceNew: true, ValidateFunc: validation.All( validation.StringIsNotWhiteSpace, - validation.StringLenBetween(3, 24), // The policy assignment name length must not exceed '24' characters. + validation.StringLenBetween(3, 24), + validation.StringDoesNotContainAny("/"), ), }, } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_resource.go index f7c5927c41b..9fa138f3bfb 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_resource.go @@ -16,10 +16,13 @@ type ResourceAssignmentResource struct { func (r ResourceAssignmentResource) Arguments() map[string]*pluginsdk.Schema { schema := map[string]*pluginsdk.Schema{ "name": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotWhiteSpace, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.All( + validation.StringIsNotWhiteSpace, + validation.StringDoesNotContainAny("/"), + ), }, "resource_id": { // TODO: tests for this diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_resource_group_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_resource_group_resource.go index 96078a6f11b..bb51724a389 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_resource_group_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_resource_group_resource.go @@ -17,10 +17,13 @@ type ResourceGroupAssignmentResource struct { func (r ResourceGroupAssignmentResource) Arguments() map[string]*pluginsdk.Schema { schema := map[string]*pluginsdk.Schema{ "name": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotWhiteSpace, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.All( + validation.StringIsNotWhiteSpace, + validation.StringDoesNotContainAny("/"), + ), }, "resource_group_id": { Type: pluginsdk.TypeString, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_subscription_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_subscription_resource.go index f657534a81e..8551acbd40f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_subscription_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/assignment_subscription_resource.go @@ -17,10 +17,13 @@ type SubscriptionAssignmentResource struct { func (r SubscriptionAssignmentResource) Arguments() map[string]*pluginsdk.Schema { schema := map[string]*pluginsdk.Schema{ "name": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotWhiteSpace, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.All( + validation.StringIsNotWhiteSpace, + validation.StringDoesNotContainAny("/"), + ), }, "subscription_id": { Type: pluginsdk.TypeString, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/client/client.go index 5164a6f572f..2d57570ae7f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/client/client.go @@ -2,9 +2,9 @@ package client import ( "github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration" - "github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights" "github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2021-06-01-preview/policy" policyPreview "github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2021-06-01-preview/policy" + "github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) @@ -13,7 +13,7 @@ type Client struct { DefinitionsClient *policy.DefinitionsClient ExemptionsClient *policyPreview.ExemptionsClient SetDefinitionsClient *policy.SetDefinitionsClient - RemediationsClient *policyinsights.RemediationsClient + RemediationsClient *remediations.RemediationsClient GuestConfigurationAssignmentsClient *guestconfiguration.AssignmentsClient } @@ -30,7 +30,7 @@ func NewClient(o *common.ClientOptions) *Client { setDefinitionsClient := policy.NewSetDefinitionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&setDefinitionsClient.Client, o.ResourceManagerAuthorizer) - remediationsClient := policyinsights.NewRemediationsClientWithBaseURI(o.ResourceManagerEndpoint) + remediationsClient := remediations.NewRemediationsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&remediationsClient.Client, o.ResourceManagerAuthorizer) guestConfigurationAssignmentsClient := guestconfiguration.NewAssignmentsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/exemption_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/exemption_subscription.go index 5d9290b844f..ff3f22616e8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/exemption_subscription.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/exemption_subscription.go @@ -13,7 +13,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants" "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -108,7 +107,7 @@ func resourceArmSubscriptionPolicyExemptionCreateUpdate(d *pluginsdk.ResourceDat ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - subscriptionId, err := tenants.ParseSubscriptionID(d.Get("subscription_id").(string)) + subscriptionId, err := commonids.ParseSubscriptionID(d.Get("subscription_id").(string)) if err != nil { return err } @@ -177,7 +176,7 @@ func resourceArmSubscriptionPolicyExemptionRead(d *pluginsdk.ResourceData, meta return fmt.Errorf("reading Policy Exemption: %+v", err) } - subscriptionId := tenants.NewSubscriptionID(id.SubscriptionId) + subscriptionId := commonids.NewSubscriptionID(id.SubscriptionId) resp, err := client.Get(ctx, subscriptionId.ID(), id.PolicyExemptionName) if err != nil { @@ -226,7 +225,7 @@ func resourceArmSubscriptionPolicyExemptionDelete(d *pluginsdk.ResourceData, met return err } - subscriptionId := tenants.NewSubscriptionID(id.SubscriptionId) + subscriptionId := commonids.NewSubscriptionID(id.SubscriptionId) if _, err := client.Delete(ctx, subscriptionId.ID(), id.PolicyExemptionName); err != nil { return fmt.Errorf("deleting %s: %+v", id.ID(), err) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/registration.go index 88e39415e05..f22756c2fae 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/registration.go @@ -17,7 +17,9 @@ func (r Registration) AssociatedGitHubLabel() string { type Registration struct{} func (r Registration) DataSources() []sdk.DataSource { - return []sdk.DataSource{} + return []sdk.DataSource{ + AssignmentDataSource{}, + } } func (r Registration) Resources() []sdk.Resource { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_management_group.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_management_group.go index 0c9f14bd0bf..e1b86cc52ed 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_management_group.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_management_group.go @@ -6,13 +6,13 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - - managmentGroupParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/managementgroup/parse" - - "github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights" + "github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/features" + managmentGroupParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/managementgroup/parse" managmentGroupValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/managementgroup/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/validate" @@ -24,7 +24,7 @@ import ( ) func resourceArmManagementGroupPolicyRemediation() *pluginsdk.Resource { - return &pluginsdk.Resource{ + resource := &pluginsdk.Resource{ Create: resourceArmManagementGroupPolicyRemediationCreateUpdate, Read: resourceArmManagementGroupPolicyRemediationRead, Update: resourceArmManagementGroupPolicyRemediationCreateUpdate, @@ -81,18 +81,22 @@ func resourceArmManagementGroupPolicyRemediation() *pluginsdk.Resource { DiffSuppressFunc: suppress.CaseDifference, ValidateFunc: validate.PolicyDefinitionID, }, - - "resource_discovery_mode": { - Type: pluginsdk.TypeString, - Optional: true, - Default: string(policyinsights.ExistingNonCompliant), - ValidateFunc: validation.StringInSlice([]string{ - string(policyinsights.ExistingNonCompliant), - string(policyinsights.ReEvaluateCompliance), - }, false), - }, }, } + + if !features.FourPointOhBeta() { + resource.Schema["resource_discovery_mode"] = &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + Optional: true, + Default: string(remediations.ResourceDiscoveryModeExistingNonCompliant), + ValidateFunc: validation.StringInSlice([]string{ + string(remediations.ResourceDiscoveryModeExistingNonCompliant), + string(remediations.ResourceDiscoveryModeReEvaluateCompliance), + }, false), + Deprecated: "`resource_discovery_mode` will be removed in version 4.0 of the AzureRM Provider as evaluating compliance before remediation is only supported at subscription scope and below.", + } + } + return resource } func resourceArmManagementGroupPolicyRemediationCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { @@ -100,37 +104,37 @@ func resourceArmManagementGroupPolicyRemediationCreateUpdate(d *pluginsdk.Resour ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewResourcePolicyRemediationId(d.Get("management_group_id").(string), d.Get("name").(string)) - - managementGroupId, err := managmentGroupParse.ManagementGroupID(id.ResourceId) + managementID, err := managmentGroupParse.ManagementGroupID(d.Get("management_group_id").(string)) if err != nil { return err } + id := remediations.NewProviders2RemediationID(managementID.Name, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.GetAtManagementGroup(ctx, managementGroupId.Name, id.Name) + existing, err := client.RemediationsGetAtManagementGroup(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id.ID(), err) } } - if existing.ID != nil && *existing.ID != "" { - return tf.ImportAsExistsError("azurerm_management_group_policy_remediation", *existing.ID) + if existing.Model != nil && existing.Model.Id != nil && *existing.Model.Id != "" { + return tf.ImportAsExistsError("azurerm_management_group_policy_remediation", *existing.Model.Id) } } - parameters := policyinsights.Remediation{ - RemediationProperties: &policyinsights.RemediationProperties{ - Filters: &policyinsights.RemediationFilters{ + parameters := remediations.Remediation{ + Properties: &remediations.RemediationProperties{ + Filters: &remediations.RemediationFilters{ Locations: utils.ExpandStringSlice(d.Get("location_filters").([]interface{})), }, - PolicyAssignmentID: utils.String(d.Get("policy_assignment_id").(string)), - PolicyDefinitionReferenceID: utils.String(d.Get("policy_definition_id").(string)), - ResourceDiscoveryMode: policyinsights.ResourceDiscoveryMode(d.Get("resource_discovery_mode").(string)), + PolicyAssignmentId: utils.String(d.Get("policy_assignment_id").(string)), + PolicyDefinitionReferenceId: utils.String(d.Get("policy_definition_id").(string)), }, } + mode := remediations.ResourceDiscoveryMode(d.Get("resource_discovery_mode").(string)) + parameters.Properties.ResourceDiscoveryMode = &mode - if _, err := client.CreateOrUpdateAtManagementGroup(ctx, managementGroupId.Name, id.Name, parameters); err != nil { + if _, err := client.RemediationsCreateOrUpdateAtManagementGroup(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id.ID(), err) } @@ -144,19 +148,14 @@ func resourceArmManagementGroupPolicyRemediationRead(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ResourcePolicyRemediationID(d.Id()) + id, err := remediations.ParseProviders2RemediationID(d.Id()) if err != nil { return fmt.Errorf("reading Policy Remediation: %+v", err) } - managementGroupId, err := managmentGroupParse.ManagementGroupID(id.ResourceId) - if err != nil { - return err - } - - resp, err := client.GetAtManagementGroup(ctx, managementGroupId.Name, id.Name) + resp, err := client.RemediationsGetAtManagementGroup(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s does not exist - removing from state", id.ID()) d.SetId("") return nil @@ -164,10 +163,11 @@ func resourceArmManagementGroupPolicyRemediationRead(d *pluginsdk.ResourceData, return fmt.Errorf("reading %s: %+v", id.ID(), err) } - d.Set("name", id.Name) - d.Set("management_group_id", id.ResourceId) + d.Set("name", id.RemediationName) + managementGroupID := managmentGroupParse.NewManagementGroupId(id.ManagementGroupId) + d.Set("management_group_id", managementGroupID.ID()) - if props := resp.RemediationProperties; props != nil { + if props := resp.Model.Properties; props != nil { locations := []interface{}{} if filters := props.Filters; filters != nil { locations = utils.FlattenStringSlice(filters.Locations) @@ -176,9 +176,9 @@ func resourceArmManagementGroupPolicyRemediationRead(d *pluginsdk.ResourceData, return fmt.Errorf("setting `location_filters`: %+v", err) } - d.Set("policy_assignment_id", props.PolicyAssignmentID) - d.Set("policy_definition_id", props.PolicyDefinitionReferenceID) - d.Set("resource_discovery_mode", string(props.ResourceDiscoveryMode)) + d.Set("policy_assignment_id", props.PolicyAssignmentId) + d.Set("policy_definition_id", props.PolicyDefinitionReferenceId) + d.Set("resource_discovery_mode", props.ResourceDiscoveryMode) } return nil @@ -189,69 +189,51 @@ func resourceArmManagementGroupPolicyRemediationDelete(d *pluginsdk.ResourceData ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ResourcePolicyRemediationID(d.Id()) - if err != nil { - return err - } - - managementGroupId, err := managmentGroupParse.ManagementGroupID(id.ResourceId) + id, err := remediations.ParseProviders2RemediationID(d.Id()) if err != nil { return err } // we have to cancel the remediation first before deleting it when the resource_discovery_mode is set to ReEvaluateCompliance // therefore we first retrieve the remediation to see if the resource_discovery_mode is switched to ReEvaluateCompliance - existing, err := client.GetAtManagementGroup(ctx, managementGroupId.Name, id.Name) + existing, err := client.RemediationsGetAtManagementGroup(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(existing.Response) { + if response.WasNotFound(existing.HttpResponse) { return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - if existing.RemediationProperties != nil && existing.RemediationProperties.ResourceDiscoveryMode == policyinsights.ReEvaluateCompliance { - // Remediation can only be canceld when it is in "Evaluating" status, otherwise, API might raise error (e.g. canceling a "Completed" remediation returns 400). - if existing.RemediationProperties.ProvisioningState != nil && *existing.RemediationProperties.ProvisioningState == "Evaluating" { - log.Printf("[DEBUG] cancelling the remediation first before deleting it when `resource_discovery_mode` is set to `ReEvaluateCompliance`") - if _, err := client.CancelAtManagementGroup(ctx, managementGroupId.Name, id.Name); err != nil { - return fmt.Errorf("cancelling %s: %+v", id.ID(), err) - } - - log.Printf("[DEBUG] waiting for the %s to be canceled", id.ID()) - stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{"Cancelling"}, - Target: []string{ - "Succeeded", "Canceled", "Failed", - }, - Refresh: managementGroupPolicyRemediationCancellationRefreshFunc(ctx, client, *id, *managementGroupId), - MinTimeout: 10 * time.Second, - Timeout: d.Timeout(pluginsdk.TimeoutDelete), - } - - if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for %s to be canceled: %+v", id.ID(), err) - } - } + if err := waitRemediationToDelete(ctx, existing.Model.Properties, id.ID(), d.Timeout(pluginsdk.TimeoutDelete), + func() error { + _, err := client.RemediationsCancelAtManagementGroup(ctx, *id) + return err + }, + managementGroupPolicyRemediationCancellationRefreshFunc(ctx, client, *id), + ); err != nil { + return err } - _, err = client.DeleteAtManagementGroup(ctx, managementGroupId.Name, id.Name) + _, err = client.RemediationsDeleteAtManagementGroup(ctx, *id) return err } -func managementGroupPolicyRemediationCancellationRefreshFunc(ctx context.Context, client *policyinsights.RemediationsClient, id parse.ResourcePolicyRemediationId, managementGroupId managmentGroupParse.ManagementGroupId) pluginsdk.StateRefreshFunc { +func managementGroupPolicyRemediationCancellationRefreshFunc(ctx context.Context, + client *remediations.RemediationsClient, id remediations.Providers2RemediationId) pluginsdk.StateRefreshFunc { + return func() (interface{}, string, error) { - resp, err := client.GetAtManagementGroup(ctx, managementGroupId.Name, id.Name) + resp, err := client.RemediationsGetAtManagementGroup(ctx, id) if err != nil { return nil, "", fmt.Errorf("issuing read request for %s: %+v", id.ID(), err) } - if resp.RemediationProperties == nil { + if resp.Model.Properties == nil { return nil, "", fmt.Errorf("`properties` was nil") } - if resp.RemediationProperties.ProvisioningState == nil { + if resp.Model.Properties.ProvisioningState == nil { return nil, "", fmt.Errorf("`properties.ProvisioningState` was nil") } - return resp, *resp.RemediationProperties.ProvisioningState, nil + return resp, *resp.Model.Properties.ProvisioningState, nil } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_resource.go index 810673e1726..3744e6a9ce2 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_resource.go @@ -6,11 +6,10 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - + "github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" - - "github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/parse" @@ -84,10 +83,10 @@ func resourceArmResourcePolicyRemediation() *pluginsdk.Resource { "resource_discovery_mode": { Type: pluginsdk.TypeString, Optional: true, - Default: string(policyinsights.ExistingNonCompliant), + Default: string(remediations.ResourceDiscoveryModeExistingNonCompliant), ValidateFunc: validation.StringInSlice([]string{ - string(policyinsights.ExistingNonCompliant), - string(policyinsights.ReEvaluateCompliance), + string(remediations.ResourceDiscoveryModeExistingNonCompliant), + string(remediations.ResourceDiscoveryModeReEvaluateCompliance), }, false), }, }, @@ -101,32 +100,33 @@ func resourceArmResourcePolicyRemediationCreateUpdate(d *pluginsdk.ResourceData, resourceId := d.Get("resource_id").(string) - id := parse.NewResourcePolicyRemediationId(resourceId, d.Get("name").(string)) + id := remediations.NewScopedRemediationID(resourceId, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.GetAtResource(ctx, id.ResourceId, id.Name) + existing, err := client.RemediationsGetAtResource(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id.ID(), err) } } - if existing.ID != nil && *existing.ID != "" { - return tf.ImportAsExistsError("azurerm_resource_policy_remediation", *existing.ID) + if existing.Model != nil && existing.Model.Id != nil && *existing.Model.Id != "" { + return tf.ImportAsExistsError("azurerm_resource_policy_remediation", *existing.Model.Id) } } - parameters := policyinsights.Remediation{ - RemediationProperties: &policyinsights.RemediationProperties{ - Filters: &policyinsights.RemediationFilters{ + parameters := remediations.Remediation{ + Properties: &remediations.RemediationProperties{ + Filters: &remediations.RemediationFilters{ Locations: utils.ExpandStringSlice(d.Get("location_filters").([]interface{})), }, - PolicyAssignmentID: utils.String(d.Get("policy_assignment_id").(string)), - PolicyDefinitionReferenceID: utils.String(d.Get("policy_definition_id").(string)), - ResourceDiscoveryMode: policyinsights.ResourceDiscoveryMode(d.Get("resource_discovery_mode").(string)), + PolicyAssignmentId: utils.String(d.Get("policy_assignment_id").(string)), + PolicyDefinitionReferenceId: utils.String(d.Get("policy_definition_id").(string)), }, } + mode := remediations.ResourceDiscoveryMode(d.Get("resource_discovery_mode").(string)) + parameters.Properties.ResourceDiscoveryMode = &mode - if _, err := client.CreateOrUpdateAtResource(ctx, id.ResourceId, id.Name, parameters); err != nil { + if _, err := client.RemediationsCreateOrUpdateAtResource(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id.ID(), err) } @@ -140,14 +140,13 @@ func resourceArmResourcePolicyRemediationRead(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ResourcePolicyRemediationID(d.Id()) + id, err := remediations.ParseScopedRemediationID(d.Id()) if err != nil { - return fmt.Errorf("reading Policy Remediation: %+v", err) + return fmt.Errorf("parsing Policy Scoped Remediation ID: %+v", err) } - - resp, err := client.GetAtResource(ctx, id.ResourceId, id.Name) + resp, err := client.RemediationsGetAtResource(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s does not exist - removing from state", id.ID()) d.SetId("") return nil @@ -155,10 +154,10 @@ func resourceArmResourcePolicyRemediationRead(d *pluginsdk.ResourceData, meta in return fmt.Errorf("reading %s: %+v", id.ID(), err) } - d.Set("name", id.Name) + d.Set("name", id.RemediationName) d.Set("resource_id", id.ResourceId) - if props := resp.RemediationProperties; props != nil { + if props := resp.Model.Properties; props != nil { locations := []interface{}{} if filters := props.Filters; filters != nil { locations = utils.FlattenStringSlice(filters.Locations) @@ -167,9 +166,10 @@ func resourceArmResourcePolicyRemediationRead(d *pluginsdk.ResourceData, meta in return fmt.Errorf("setting `location_filters`: %+v", err) } - d.Set("policy_assignment_id", props.PolicyAssignmentID) - d.Set("policy_definition_id", props.PolicyDefinitionReferenceID) - d.Set("resource_discovery_mode", string(props.ResourceDiscoveryMode)) + d.Set("policy_assignment_id", props.PolicyAssignmentId) + d.Set("policy_definition_id", props.PolicyDefinitionReferenceId) + d.Set("resource_discovery_mode", utils.NormalizeNilableString((*string)(props.ResourceDiscoveryMode))) + } return nil @@ -180,64 +180,90 @@ func resourceArmResourcePolicyRemediationDelete(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ResourcePolicyRemediationID(d.Id()) + id, err := remediations.ParseScopedRemediationID(d.Id()) if err != nil { - return err + return fmt.Errorf("parsing Policy Scoped Remediation ID: %+v", err) } // we have to cancel the remediation first before deleting it when the resource_discovery_mode is set to ReEvaluateCompliance // therefore we first retrieve the remediation to see if the resource_discovery_mode is switched to ReEvaluateCompliance - existing, err := client.GetAtResource(ctx, id.ResourceId, id.Name) + existing, err := client.RemediationsGetAtResource(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(existing.Response) { + if response.WasNotFound(existing.HttpResponse) { return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - if existing.RemediationProperties != nil && existing.RemediationProperties.ResourceDiscoveryMode == policyinsights.ReEvaluateCompliance { - // Remediation can only be canceld when it is in "Evaluating" status, otherwise, API might raise error (e.g. canceling a "Completed" remediation returns 400). - if existing.RemediationProperties.ProvisioningState != nil && *existing.RemediationProperties.ProvisioningState == "Evaluating" { - log.Printf("[DEBUG] cancelling the remediation first before deleting it when `resource_discovery_mode` is set to `ReEvaluateCompliance`") - if _, err := client.CancelAtResource(ctx, id.ResourceId, id.Name); err != nil { - return fmt.Errorf("cancelling %s: %+v", id.ID(), err) - } - - log.Printf("[DEBUG] waiting for the %s to be canceled", id.ID()) - stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{"Cancelling"}, - Target: []string{ - "Succeeded", "Canceled", "Failed", - }, - Refresh: resourcePolicyRemediationCancellationRefreshFunc(ctx, client, *id), - MinTimeout: 10 * time.Second, - Timeout: d.Timeout(pluginsdk.TimeoutDelete), - } - - if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for %s to be canceled: %+v", id.ID(), err) - } - } + if err := waitRemediationToDelete(ctx, + existing.Model.Properties, + id.ID(), + d.Timeout(pluginsdk.TimeoutDelete), + func() error { + _, err := client.RemediationsCancelAtResource(ctx, *id) + return err + }, + resourcePolicyRemediationCancellationRefreshFunc(ctx, client, *id), + ); err != nil { + return err } - _, err = client.DeleteAtResource(ctx, id.ResourceId, id.Name) + _, err = client.RemediationsDeleteAtResource(ctx, *id) return err } -func resourcePolicyRemediationCancellationRefreshFunc(ctx context.Context, client *policyinsights.RemediationsClient, id parse.ResourcePolicyRemediationId) pluginsdk.StateRefreshFunc { +func resourcePolicyRemediationCancellationRefreshFunc(ctx context.Context, client *remediations.RemediationsClient, id remediations.ScopedRemediationId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - resp, err := client.GetAtResource(ctx, id.ResourceId, id.Name) + resp, err := client.RemediationsGetAtResource(ctx, id) if err != nil { return nil, "", fmt.Errorf("issuing read request for %s: %+v", id.ID(), err) } - if resp.RemediationProperties == nil { + if resp.Model.Properties == nil { return nil, "", fmt.Errorf("`properties` was nil") } - if resp.RemediationProperties.ProvisioningState == nil { + if resp.Model.Properties.ProvisioningState == nil { return nil, "", fmt.Errorf("`properties.ProvisioningState` was nil") } - return resp, *resp.RemediationProperties.ProvisioningState, nil + return resp, *resp.Model.Properties.ProvisioningState, nil + } +} + +// waitRemediationToDelete waits for the remediation to a status that allow to delete +func waitRemediationToDelete(ctx context.Context, + prop *remediations.RemediationProperties, + id string, + timeout time.Duration, + cancelFunc func() error, + refresh pluginsdk.StateRefreshFunc) error { + + if prop == nil { + return nil } + if mode := prop.ResourceDiscoveryMode; mode != nil && *mode == remediations.ResourceDiscoveryModeReEvaluateCompliance { + // Remediation can only be canceld when it is in "Evaluating" or "Accepted" status, otherwise, API might raise error (e.g. canceling a "Completed" remediation returns 400). + if state := prop.ProvisioningState; state != nil && (*state == "Evaluating" || *state == "Accepted") { + log.Printf("[DEBUG] cancelling the remediation first before deleting it when `resource_discovery_mode` is set to `ReEvaluateCompliance`") + if err := cancelFunc(); err != nil { + return fmt.Errorf("cancelling %s: %+v", id, err) + } + + log.Printf("[DEBUG] waiting for the %s to be canceled", id) + stateConf := &pluginsdk.StateChangeConf{ + Pending: []string{"Cancelling"}, + Target: []string{ + "Succeeded", "Canceled", "Failed", + }, + Refresh: refresh, + MinTimeout: 10 * time.Second, + Timeout: timeout, + } + + if _, err := stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for %s to be canceled: %+v", id, err) + } + } + } + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_resource_group.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_resource_group.go index e2d7646a78c..6d36c9ddf6f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_resource_group.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_resource_group.go @@ -6,9 +6,9 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - - "github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights" + "github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/parse" @@ -84,10 +84,10 @@ func resourceArmResourceGroupPolicyRemediation() *pluginsdk.Resource { "resource_discovery_mode": { Type: pluginsdk.TypeString, Optional: true, - Default: string(policyinsights.ExistingNonCompliant), + Default: string(remediations.ResourceDiscoveryModeExistingNonCompliant), ValidateFunc: validation.StringInSlice([]string{ - string(policyinsights.ExistingNonCompliant), - string(policyinsights.ReEvaluateCompliance), + string(remediations.ResourceDiscoveryModeExistingNonCompliant), + string(remediations.ResourceDiscoveryModeReEvaluateCompliance), }, false), }, }, @@ -104,32 +104,33 @@ func resourceArmResourceGroupPolicyRemediationCreateUpdate(d *pluginsdk.Resource return err } - id := parse.NewResourceGroupPolicyRemediationID(resourceGroupId.SubscriptionId, resourceGroupId.ResourceGroup, d.Get("name").(string)) + id := remediations.NewProviderRemediationID(resourceGroupId.SubscriptionId, resourceGroupId.ResourceGroup, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.GetAtResourceGroup(ctx, id.SubscriptionId, id.ResourceGroup, id.RemediationName) + existing, err := client.RemediationsGetAtResourceGroup(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id.ID(), err) } } - if existing.ID != nil && *existing.ID != "" { - return tf.ImportAsExistsError("azurerm_resource_group_policy_remediation", *existing.ID) + if existing.Model != nil && existing.Model.Id != nil && *existing.Model.Id != "" { + return tf.ImportAsExistsError("azurerm_resource_group_policy_remediation", *existing.Model.Id) } } - parameters := policyinsights.Remediation{ - RemediationProperties: &policyinsights.RemediationProperties{ - Filters: &policyinsights.RemediationFilters{ + parameters := remediations.Remediation{ + Properties: &remediations.RemediationProperties{ + Filters: &remediations.RemediationFilters{ Locations: utils.ExpandStringSlice(d.Get("location_filters").([]interface{})), }, - PolicyAssignmentID: utils.String(d.Get("policy_assignment_id").(string)), - PolicyDefinitionReferenceID: utils.String(d.Get("policy_definition_id").(string)), - ResourceDiscoveryMode: policyinsights.ResourceDiscoveryMode(d.Get("resource_discovery_mode").(string)), + PolicyAssignmentId: utils.String(d.Get("policy_assignment_id").(string)), + PolicyDefinitionReferenceId: utils.String(d.Get("policy_definition_id").(string)), }, } + mode := remediations.ResourceDiscoveryMode(d.Get("resource_discovery_mode").(string)) + parameters.Properties.ResourceDiscoveryMode = &mode - if _, err = client.CreateOrUpdateAtResourceGroup(ctx, id.SubscriptionId, id.ResourceGroup, id.RemediationName, parameters); err != nil { + if _, err = client.RemediationsCreateOrUpdateAtResourceGroup(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id.ID(), err) } @@ -143,16 +144,16 @@ func resourceArmResourceGroupPolicyRemediationRead(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ResourceGroupPolicyRemediationID(d.Id()) + id, err := remediations.ParseProviderRemediationID(d.Id()) if err != nil { return fmt.Errorf("reading Policy Remediation: %+v", err) } - resourceGroupId := resourceParse.NewResourceGroupID(id.SubscriptionId, id.ResourceGroup) + resourceGroupId := resourceParse.NewResourceGroupID(id.SubscriptionId, id.ResourceGroupName) - resp, err := client.GetAtResourceGroup(ctx, id.SubscriptionId, id.ResourceGroup, id.RemediationName) + resp, err := client.RemediationsGetAtResourceGroup(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s does not exist - removing from state", id.ID()) d.SetId("") return nil @@ -163,7 +164,7 @@ func resourceArmResourceGroupPolicyRemediationRead(d *pluginsdk.ResourceData, me d.Set("name", id.RemediationName) d.Set("resource_group_id", resourceGroupId.ID()) - if props := resp.RemediationProperties; props != nil { + if props := resp.Model.Properties; props != nil { locations := []interface{}{} if filters := props.Filters; filters != nil { locations = utils.FlattenStringSlice(filters.Locations) @@ -172,9 +173,10 @@ func resourceArmResourceGroupPolicyRemediationRead(d *pluginsdk.ResourceData, me return fmt.Errorf("setting `location_filters`: %+v", err) } - d.Set("policy_assignment_id", props.PolicyAssignmentID) - d.Set("policy_definition_id", props.PolicyDefinitionReferenceID) - d.Set("resource_discovery_mode", string(props.ResourceDiscoveryMode)) + d.Set("policy_assignment_id", props.PolicyAssignmentId) + d.Set("policy_definition_id", props.PolicyDefinitionReferenceId) + d.Set("resource_discovery_mode", utils.NormalizeNilableString((*string)(props.ResourceDiscoveryMode))) + } return nil @@ -185,64 +187,49 @@ func resourceArmResourceGroupPolicyRemediationDelete(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ResourceGroupPolicyRemediationID(d.Id()) + id, err := remediations.ParseProviderRemediationID(d.Id()) if err != nil { return err } // we have to cancel the remediation first before deleting it when the resource_discovery_mode is set to ReEvaluateCompliance // therefore we first retrieve the remediation to see if the resource_discovery_mode is switched to ReEvaluateCompliance - existing, err := client.GetAtResourceGroup(ctx, id.SubscriptionId, id.ResourceGroup, id.RemediationName) + existing, err := client.RemediationsGetAtResourceGroup(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(existing.Response) { + if response.WasNotFound(existing.HttpResponse) { return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - if existing.RemediationProperties != nil && existing.RemediationProperties.ResourceDiscoveryMode == policyinsights.ReEvaluateCompliance { - // Remediation can only be canceld when it is in "Evaluating" status, otherwise, API might raise error (e.g. canceling a "Completed" remediation returns 400). - if existing.RemediationProperties.ProvisioningState != nil && *existing.RemediationProperties.ProvisioningState == "Evaluating" { - log.Printf("[DEBUG] cancelling the remediation first before deleting it when `resource_discovery_mode` is set to `ReEvaluateCompliance`") - if _, err := client.CancelAtResourceGroup(ctx, id.SubscriptionId, id.ResourceGroup, id.RemediationName); err != nil { - return fmt.Errorf("cancelling %s: %+v", id.ID(), err) - } - - log.Printf("[DEBUG] waiting for the %s to be canceled", id.ID()) - stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{"Cancelling"}, - Target: []string{ - "Succeeded", "Canceled", "Failed", - }, - Refresh: resourceGroupPolicyRemediationCancellationRefreshFunc(ctx, client, *id), - MinTimeout: 10 * time.Second, - Timeout: d.Timeout(pluginsdk.TimeoutDelete), - } + if err := waitRemediationToDelete(ctx, existing.Model.Properties, id.ID(), d.Timeout(pluginsdk.TimeoutDelete), + func() error { + _, err := client.RemediationsCancelAtResourceGroup(ctx, *id) + return err + }, + resourceGroupPolicyRemediationCancellationRefreshFunc(ctx, client, *id), + ); err != nil { - if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for %s to be canceled: %+v", id.ID(), err) - } - } } - _, err = client.DeleteAtResourceGroup(ctx, id.SubscriptionId, id.ResourceGroup, id.RemediationName) + _, err = client.RemediationsDeleteAtResourceGroup(ctx, *id) return err } -func resourceGroupPolicyRemediationCancellationRefreshFunc(ctx context.Context, client *policyinsights.RemediationsClient, id parse.ResourceGroupPolicyRemediationId) pluginsdk.StateRefreshFunc { +func resourceGroupPolicyRemediationCancellationRefreshFunc(ctx context.Context, client *remediations.RemediationsClient, id remediations.ProviderRemediationId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - resp, err := client.GetAtResourceGroup(ctx, id.SubscriptionId, id.ResourceGroup, id.RemediationName) + resp, err := client.RemediationsGetAtResourceGroup(ctx, id) if err != nil { return nil, "", fmt.Errorf("issuing read request for %s: %+v", id.ID(), err) } - if resp.RemediationProperties == nil { + if resp.Model.Properties == nil { return nil, "", fmt.Errorf("`properties` was nil") } - if resp.RemediationProperties.ProvisioningState == nil { + if resp.Model.Properties.ProvisioningState == nil { return nil, "", fmt.Errorf("`properties.ProvisioningState` was nil") } - return resp, *resp.RemediationProperties.ProvisioningState, nil + return resp, *resp.Model.Properties.ProvisioningState, nil } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_subscription.go index c6ff1726c13..625d1fa6d39 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_subscription.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/remediation_subscription.go @@ -6,11 +6,10 @@ import ( "log" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" - - "github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/parse" @@ -84,10 +83,10 @@ func resourceArmSubscriptionPolicyRemediation() *pluginsdk.Resource { "resource_discovery_mode": { Type: pluginsdk.TypeString, Optional: true, - Default: string(policyinsights.ExistingNonCompliant), + Default: string(remediations.ResourceDiscoveryModeExistingNonCompliant), ValidateFunc: validation.StringInSlice([]string{ - string(policyinsights.ExistingNonCompliant), - string(policyinsights.ReEvaluateCompliance), + string(remediations.ResourceDiscoveryModeExistingNonCompliant), + string(remediations.ResourceDiscoveryModeReEvaluateCompliance), }, false), }, }, @@ -104,32 +103,33 @@ func resourceArmSubscriptionPolicyRemediationCreateUpdate(d *pluginsdk.ResourceD return err } - id := parse.NewSubscriptionPolicyRemediationID(subscriptionId.SubscriptionId, d.Get("name").(string)) + id := remediations.NewRemediationID(subscriptionId.SubscriptionId, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.GetAtSubscription(ctx, id.SubscriptionId, id.RemediationName) + existing, err := client.RemediationsGetAtSubscription(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id.ID(), err) } } - if existing.ID != nil && *existing.ID != "" { - return tf.ImportAsExistsError("azurerm_subscription_policy_remediation", *existing.ID) + if existing.Model != nil && existing.Model.Id != nil && *existing.Model.Id != "" { + return tf.ImportAsExistsError("azurerm_subscription_policy_remediation", *existing.Model.Id) } } - parameters := policyinsights.Remediation{ - RemediationProperties: &policyinsights.RemediationProperties{ - Filters: &policyinsights.RemediationFilters{ + parameters := remediations.Remediation{ + Properties: &remediations.RemediationProperties{ + Filters: &remediations.RemediationFilters{ Locations: utils.ExpandStringSlice(d.Get("location_filters").([]interface{})), }, - PolicyAssignmentID: utils.String(d.Get("policy_assignment_id").(string)), - PolicyDefinitionReferenceID: utils.String(d.Get("policy_definition_id").(string)), - ResourceDiscoveryMode: policyinsights.ResourceDiscoveryMode(d.Get("resource_discovery_mode").(string)), + PolicyAssignmentId: utils.String(d.Get("policy_assignment_id").(string)), + PolicyDefinitionReferenceId: utils.String(d.Get("policy_definition_id").(string)), }, } + mode := remediations.ResourceDiscoveryMode(d.Get("resource_discovery_mode").(string)) + parameters.Properties.ResourceDiscoveryMode = &mode - if _, err = client.CreateOrUpdateAtSubscription(ctx, id.SubscriptionId, id.RemediationName, parameters); err != nil { + if _, err = client.RemediationsCreateOrUpdateAtSubscription(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id.ID(), err) } @@ -143,16 +143,16 @@ func resourceArmSubscriptionPolicyRemediationRead(d *pluginsdk.ResourceData, met ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SubscriptionPolicyRemediationID(d.Id()) + id, err := remediations.ParseRemediationID(d.Id()) if err != nil { return fmt.Errorf("reading Policy Remediation: %+v", err) } subscriptionId := commonids.NewSubscriptionID(id.SubscriptionId) - resp, err := client.GetAtSubscription(ctx, id.SubscriptionId, id.RemediationName) + resp, err := client.RemediationsGetAtSubscription(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s does not exist - removing from state", id.ID()) d.SetId("") return nil @@ -163,7 +163,7 @@ func resourceArmSubscriptionPolicyRemediationRead(d *pluginsdk.ResourceData, met d.Set("name", id.RemediationName) d.Set("subscription_id", subscriptionId.ID()) - if props := resp.RemediationProperties; props != nil { + if props := resp.Model.Properties; props != nil { locations := []interface{}{} if filters := props.Filters; filters != nil { locations = utils.FlattenStringSlice(filters.Locations) @@ -172,9 +172,9 @@ func resourceArmSubscriptionPolicyRemediationRead(d *pluginsdk.ResourceData, met return fmt.Errorf("setting `location_filters`: %+v", err) } - d.Set("policy_assignment_id", props.PolicyAssignmentID) - d.Set("policy_definition_id", props.PolicyDefinitionReferenceID) - d.Set("resource_discovery_mode", string(props.ResourceDiscoveryMode)) + d.Set("policy_assignment_id", props.PolicyAssignmentId) + d.Set("policy_definition_id", props.PolicyDefinitionReferenceId) + d.Set("resource_discovery_mode", utils.NormalizeNilableString((*string)(props.ResourceDiscoveryMode))) } return nil @@ -185,64 +185,49 @@ func resourceArmSubscriptionPolicyRemediationDelete(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SubscriptionPolicyRemediationID(d.Id()) + id, err := remediations.ParseRemediationID(d.Id()) if err != nil { return err } // we have to cancel the remediation first before deleting it when the resource_discovery_mode is set to ReEvaluateCompliance // therefore we first retrieve the remediation to see if the resource_discovery_mode is switched to ReEvaluateCompliance - existing, err := client.GetAtSubscription(ctx, id.SubscriptionId, id.RemediationName) + existing, err := client.RemediationsGetAtSubscription(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(existing.Response) { + if response.WasNotFound(existing.HttpResponse) { return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - if existing.RemediationProperties != nil && existing.RemediationProperties.ResourceDiscoveryMode == policyinsights.ReEvaluateCompliance { - // Remediation can only be canceld when it is in "Evaluating" status, otherwise, API might raise error (e.g. canceling a "Completed" remediation returns 400). - if existing.RemediationProperties.ProvisioningState != nil && *existing.RemediationProperties.ProvisioningState == "Evaluating" { - log.Printf("[DEBUG] cancelling the remediation first before deleting it when `resource_discovery_mode` is set to `ReEvaluateCompliance`") - if _, err := client.CancelAtSubscription(ctx, id.SubscriptionId, id.RemediationName); err != nil { - return fmt.Errorf("cancelling %s: %+v", id.ID(), err) - } - - log.Printf("[DEBUG] waiting for the %s to be canceled", id.ID()) - stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{"Cancelling"}, - Target: []string{ - "Succeeded", "Canceled", "Failed", - }, - Refresh: subscriptionPolicyRemediationCancellationRefreshFunc(ctx, client, *id), - MinTimeout: 10 * time.Second, - Timeout: d.Timeout(pluginsdk.TimeoutDelete), - } - - if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for %s to be canceled: %+v", id.ID(), err) - } - } + if err := waitRemediationToDelete(ctx, existing.Model.Properties, id.ID(), d.Timeout(pluginsdk.TimeoutDelete), + func() error { + _, err := client.RemediationsCancelAtSubscription(ctx, *id) + return err + }, + subscriptionPolicyRemediationCancellationRefreshFunc(ctx, client, *id), + ); err != nil { + return err } - _, err = client.DeleteAtSubscription(ctx, id.SubscriptionId, id.RemediationName) + _, err = client.RemediationsDeleteAtSubscription(ctx, *id) return err } -func subscriptionPolicyRemediationCancellationRefreshFunc(ctx context.Context, client *policyinsights.RemediationsClient, id parse.SubscriptionPolicyRemediationId) pluginsdk.StateRefreshFunc { +func subscriptionPolicyRemediationCancellationRefreshFunc(ctx context.Context, client *remediations.RemediationsClient, id remediations.RemediationId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - resp, err := client.GetAtSubscription(ctx, id.SubscriptionId, id.RemediationName) + resp, err := client.RemediationsGetAtSubscription(ctx, id) if err != nil { return nil, "", fmt.Errorf("issuing read request for %s: %+v", id.ID(), err) } - if resp.RemediationProperties == nil { + if resp.Model.Properties == nil { return nil, "", fmt.Errorf("`properties` was nil") } - if resp.RemediationProperties.ProvisioningState == nil { + if resp.Model.Properties.ProvisioningState == nil { return nil, "", fmt.Errorf("`properties.ProvisioningState` was nil") } - return resp, *resp.RemediationProperties.ProvisioningState, nil + return resp, *resp.Model.Properties.ProvisioningState, nil } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/client/client.go index ff8f9133889..3c86f1bf01d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/client/client.go @@ -1,20 +1,21 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal" + "github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard" + "github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - DashboardsClient *portal.DashboardsClient - TenantConfigurationsClient *portal.TenantConfigurationsClient + DashboardsClient *dashboard.DashboardClient + TenantConfigurationsClient *tenantconfiguration.TenantConfigurationClient } func NewClient(o *common.ClientOptions) *Client { - dashboardsClient := portal.NewDashboardsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + dashboardsClient := dashboard.NewDashboardClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&dashboardsClient.Client, o.ResourceManagerAuthorizer) - tenantConfigurationsClient := portal.NewTenantConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + tenantConfigurationsClient := tenantconfiguration.NewTenantConfigurationClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&tenantConfigurationsClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/legacy_dashboard_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/legacy_dashboard_resource.go index 1d6d925772c..dcfa8c63138 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/legacy_dashboard_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/legacy_dashboard_resource.go @@ -6,16 +6,15 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" - - "github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal" - "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -49,9 +48,9 @@ func resourceLegacyDashboard() *pluginsdk.Resource { ForceNew: true, ValidateFunc: validate.DashboardName, }, - "resource_group_name": azure.SchemaResourceGroupName(), - "location": azure.SchemaLocation(), - "tags": tags.Schema(), + "resource_group_name": commonschema.ResourceGroupName(), + "location": commonschema.Location(), + "tags": commonschema.Tags(), "dashboard_properties": { Type: pluginsdk.TypeString, Optional: true, @@ -68,34 +67,34 @@ func resourceLegacyDashboardCreateUpdate(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewDashboardID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := dashboard.NewDashboardID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for the presence of an existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_dashboard", id.ID()) } } - dashboard := portal.Dashboard{ - Location: utils.String(location.Normalize(d.Get("location").(string))), + payload := dashboard.Dashboard{ + Location: location.Normalize(d.Get("location").(string)), Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - var dashboardProperties portal.DashboardProperties + var dashboardProperties dashboard.DashboardProperties dashboardPropsRaw := d.Get("dashboard_properties").(string) if err := json.Unmarshal([]byte(dashboardPropsRaw), &dashboardProperties); err != nil { return fmt.Errorf("parsing JSON: %+v", err) } - dashboard.DashboardProperties = &dashboardProperties + payload.Properties = &dashboardProperties - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, dashboard); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, payload); err != nil { return fmt.Errorf("creating/updating %s %+v", id, err) } @@ -108,34 +107,39 @@ func resourceLegacyDashboardRead(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DashboardID(d.Id()) + id, err := dashboard.ParseDashboardID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Dashboard %q was not found in Resource Group %q - removing from state", id.Name, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %q was not found - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Dashboard %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*resp.Location)) - } + d.Set("name", id.DashboardName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) - props, jsonErr := json.Marshal(resp.DashboardProperties) - if jsonErr != nil { - return fmt.Errorf("parsing JSON for Dashboard Properties: %+v", jsonErr) + props, jsonErr := json.Marshal(model.Properties) + if jsonErr != nil { + return fmt.Errorf("parsing JSON for Dashboard Properties: %+v", jsonErr) + } + d.Set("dashboard_properties", string(props)) + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } - d.Set("dashboard_properties", string(props)) - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceLegacyDashboardDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -143,15 +147,15 @@ func resourceLegacyDashboardDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DashboardID(d.Id()) + id, err := dashboard.ParseDashboardID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.Name) + resp, err := client.Delete(ctx, *id) if err != nil { - if !response.WasNotFound(resp.Response) { - return fmt.Errorf("deleting Dashboard %q (Resource Group %q): %+v", id.Name, id.Name, err) + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/portal_dashboard_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/portal_dashboard_data_source.go index 5b00419f4d9..50a4c1f5322 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/portal_dashboard_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/portal_dashboard_data_source.go @@ -3,15 +3,17 @@ package portal import ( "encoding/json" "fmt" + "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -47,7 +49,7 @@ func dataSourcePortalDashboard() *pluginsdk.Resource { Computed: true, StateFunc: utils.NormalizeJson, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -58,80 +60,67 @@ func dataSourcePortalDashboardRead(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) displayName, displayNameOk := d.GetOk("display_name") - resourceGroup := d.Get("resource_group_name").(string) - var dashboard portal.Dashboard + id := dashboard.NewDashboardID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + + props := dashboard.Dashboard{} if !displayNameOk { - var err error - dashboard, err = client.Get(ctx, resourceGroup, name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(dashboard.Response) { - return fmt.Errorf("portal Dashboard %q was not found in Resource Group %q", name, resourceGroup) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) } - return fmt.Errorf("retrieving Portal Dashboard %q (Resource Group %q): %+v", name, resourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id, err) + } + + if model := resp.Model; model != nil { + props = *model } } else { - dashboards := make([]portal.Dashboard, 0) + dashboards := make([]dashboard.Dashboard, 0) - iterator, err := client.ListByResourceGroupComplete(ctx, resourceGroup) + iterator, err := client.ListByResourceGroupComplete(ctx, commonids.NewResourceGroupID(id.SubscriptionId, id.ResourceGroupName)) if err != nil { - if utils.ResponseWasNotFound(iterator.Response().Response) { - return fmt.Errorf("no Portal Dashboards were found for Resource Group %q", resourceGroup) - } - return fmt.Errorf("getting list of Portal Dashboards (Resource Group %q): %+v", resourceGroup, err) + return fmt.Errorf("getting list of Portal Dashboards for %s: %+v", id, err) } - for iterator.NotDone() { - dashboard = iterator.Value() + log.Printf("portal_debug iterator: %+v", iterator.Items) - found := false - for k, v := range dashboard.Tags { - if k == "hidden-title" && *v == displayName { - found = true + for _, item := range iterator.Items { + tags := *item.Tags + for k, v := range tags { + if k == "hidden-title" && v == displayName { + dashboards = append(dashboards, item) break } } - - if found { - dashboards = append(dashboards, dashboard) - } - if err := iterator.NextWithContext(ctx); err != nil { - return err - } } if 1 > len(dashboards) { - return fmt.Errorf("no Portal Dashboards were found for Resource Group %q", resourceGroup) + return fmt.Errorf("no Portal Dashboards were found for %s", id) } if len(dashboards) > 1 { - return fmt.Errorf("multiple Portal Dashboards were found for Resource Group %q", resourceGroup) + return fmt.Errorf("multiple Portal Dashboards were found for %s", id) } - dashboard = dashboards[0] + props = dashboards[0] } - if dashboard.Name == nil { - return fmt.Errorf("portal Dashboard name is empty in Resource Group %s", resourceGroup) - } - - id := parse.NewDashboardID(subscriptionId, resourceGroup, *dashboard.Name) - d.SetId(id.ID()) - d.Set("name", name) + d.Set("name", id.DashboardName) d.Set("display_name", displayName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(dashboard.Location)) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("location", location.Normalize(props.Location)) - props, jsonErr := json.Marshal(dashboard.DashboardProperties) - if jsonErr != nil { - return fmt.Errorf("parsing JSON for Portal Dashboard Properties: %+v", jsonErr) + v, err := json.Marshal(props.Properties) + if err != nil { + return fmt.Errorf("parsing JSON for Portal Dashboard Properties: %+v", err) } - d.Set("dashboard_properties", string(props)) + d.Set("dashboard_properties", string(v)) - return tags.FlattenAndSet(d, dashboard.Tags) + return tags.FlattenAndSet(d, props.Tags) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/portal_dashboard_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/portal_dashboard_resource.go index 0c1e3719936..7fea37d349a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/portal_dashboard_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/portal_dashboard_resource.go @@ -6,16 +6,15 @@ import ( "log" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" - - "github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -29,7 +28,7 @@ func resourcePortalDashboard() *pluginsdk.Resource { Delete: resourcePortalDashboardDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DashboardID(id) + _, err := dashboard.ParseDashboardID(id) return err }), @@ -47,9 +46,13 @@ func resourcePortalDashboard() *pluginsdk.Resource { ForceNew: true, ValidateFunc: validate.DashboardName, }, + "resource_group_name": azure.SchemaResourceGroupName(), - "location": azure.SchemaLocation(), - "tags": tags.Schema(), + + "location": azure.SchemaLocation(), + + "tags": commonschema.Tags(), + "dashboard_properties": { Type: pluginsdk.TypeString, Optional: true, @@ -66,34 +69,35 @@ func resourcePortalDashboardCreateUpdate(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewDashboardID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := dashboard.NewDashboardID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for the presence of an existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_portal_dashboard", id.ID()) } } - dashboard := portal.Dashboard{ - Location: utils.String(location.Normalize(d.Get("location").(string))), + props := dashboard.Dashboard{ + Location: location.Normalize(d.Get("location").(string)), Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - var dashboardProperties portal.DashboardProperties + var dashboardProperties dashboard.DashboardProperties dashboardPropsRaw := d.Get("dashboard_properties").(string) if err := json.Unmarshal([]byte(dashboardPropsRaw), &dashboardProperties); err != nil { return fmt.Errorf("parsing JSON: %+v", err) } - dashboard.DashboardProperties = &dashboardProperties - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, dashboard); err != nil { + props.Properties = &dashboardProperties + + if _, err := client.CreateOrUpdate(ctx, id, props); err != nil { return fmt.Errorf("creating/updating %s %+v", id, err) } @@ -106,34 +110,39 @@ func resourcePortalDashboardRead(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DashboardID(d.Id()) + id, err := dashboard.ParseDashboardID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[DEBUG] Dashboard %q was not found in Resource Group %q - removing from state", id.Name, id.ResourceGroup) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[DEBUG] %s was not found - removing from state", *id) d.SetId("") return nil } - return fmt.Errorf("retrieving Dashboard %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*resp.Location)) - } + d.Set("name", id.DashboardName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) - props, jsonErr := json.Marshal(resp.DashboardProperties) - if jsonErr != nil { - return fmt.Errorf("parsing JSON for Dashboard Properties: %+v", jsonErr) + if props := model.Properties; props != nil { + v, err := json.Marshal(props) + if err != nil { + return fmt.Errorf("parsing JSON for Dashboard Properties: %+v", err) + } + d.Set("dashboard_properties", string(v)) + } + + return tags.FlattenAndSet(d, model.Tags) } - d.Set("dashboard_properties", string(props)) - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourcePortalDashboardDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -141,15 +150,15 @@ func resourcePortalDashboardDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DashboardID(d.Id()) + id, err := dashboard.ParseDashboardID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.Name) + resp, err := client.Delete(ctx, *id) if err != nil { - if !response.WasNotFound(resp.Response) { - return fmt.Errorf("deleting Dashboard %q (Resource Group %q): %+v", id.Name, id.Name, err) + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/portal_tenant_configuration_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/portal_tenant_configuration_resource.go index be24cef2646..1281fa1e6cd 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/portal_tenant_configuration_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/portal_tenant_configuration_resource.go @@ -5,7 +5,8 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/parse" @@ -48,28 +49,29 @@ func resourcePortalTenantConfigurationCreateUpdate(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() + // NOTE: we're using a Terraform-internal Resource ID here since the Go SDK no longer exposes one + // since this is an operation on a Tenant (which doesn't expose any configurable values). id := parse.NewPortalTenantConfigurationID("default") - if d.IsNewResource() { - existing, err := client.Get(ctx) + existing, err := client.TenantConfigurationsGet(ctx) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_portal_tenant_configuration", id.ID()) } } - parameters := portal.Configuration{ - ConfigurationProperties: &portal.ConfigurationProperties{ + parameters := tenantconfiguration.Configuration{ + Properties: &tenantconfiguration.ConfigurationProperties{ EnforcePrivateMarkdownStorage: utils.Bool(d.Get("private_markdown_storage_enforced").(bool)), }, } - if _, err := client.Create(ctx, parameters); err != nil { + if _, err := client.TenantConfigurationsCreate(ctx, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -88,9 +90,9 @@ func resourcePortalTenantConfigurationRead(d *pluginsdk.ResourceData, meta inter return err } - resp, err := client.Get(ctx) + resp, err := client.TenantConfigurationsGet(ctx) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s was not found - removing from state!", *id) d.SetId("") return nil @@ -98,8 +100,10 @@ func resourcePortalTenantConfigurationRead(d *pluginsdk.ResourceData, meta inter return fmt.Errorf("retrieving %s: %+v", *id, err) } - if props := resp.ConfigurationProperties; props != nil { - d.Set("private_markdown_storage_enforced", props.EnforcePrivateMarkdownStorage) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("private_markdown_storage_enforced", props.EnforcePrivateMarkdownStorage) + } } return nil @@ -115,7 +119,7 @@ func resourcePortalTenantConfigurationDelete(d *pluginsdk.ResourceData, meta int return err } - if _, err := client.Delete(ctx); err != nil { + if _, err := client.TenantConfigurationsDelete(ctx); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/client/client.go index eb9af7723fd..c90a0be97a1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/client/client.go @@ -1,65 +1,81 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys" + flexibleserverconfigurations "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations" + flexibleserverdatabases "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases" + flexibleserverfirewallrules "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart" + flexibleservers "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - ConfigurationsClient *postgresql.ConfigurationsClient - DatabasesClient *postgresql.DatabasesClient - FirewallRulesClient *postgresql.FirewallRulesClient - FlexibleServersClient *postgresqlflexibleservers.ServersClient - FlexibleServersConfigurationsClient *postgresqlflexibleservers.ConfigurationsClient - FlexibleServerFirewallRuleClient *postgresqlflexibleservers.FirewallRulesClient - FlexibleServerDatabaseClient *postgresqlflexibleservers.DatabasesClient - ServersClient *postgresql.ServersClient - ServerKeysClient *postgresql.ServerKeysClient - ServerSecurityAlertPoliciesClient *postgresql.ServerSecurityAlertPoliciesClient - VirtualNetworkRulesClient *postgresql.VirtualNetworkRulesClient - ServerAdministratorsClient *postgresql.ServerAdministratorsClient - ReplicasClient *postgresql.ReplicasClient + ConfigurationsClient *configurations.ConfigurationsClient + DatabasesClient *databases.DatabasesClient + FirewallRulesClient *firewallrules.FirewallRulesClient + FlexibleServersClient *flexibleservers.ServersClient + FlexibleServersConfigurationsClient *flexibleserverconfigurations.ConfigurationsClient + FlexibleServerFirewallRuleClient *flexibleserverfirewallrules.FirewallRulesClient + FlexibleServerDatabaseClient *flexibleserverdatabases.DatabasesClient + ServersClient *servers.ServersClient + ServerRestartClient *serverrestart.ServerRestartClient + ServerKeysClient *serverkeys.ServerKeysClient + ServerSecurityAlertPoliciesClient *serversecurityalertpolicies.ServerSecurityAlertPoliciesClient + VirtualNetworkRulesClient *virtualnetworkrules.VirtualNetworkRulesClient + ServerAdministratorsClient *serveradministrators.ServerAdministratorsClient + ReplicasClient *replicas.ReplicasClient } func NewClient(o *common.ClientOptions) *Client { - configurationsClient := postgresql.NewConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + configurationsClient := configurations.NewConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&configurationsClient.Client, o.ResourceManagerAuthorizer) - databasesClient := postgresql.NewDatabasesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + databasesClient := databases.NewDatabasesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&databasesClient.Client, o.ResourceManagerAuthorizer) - firewallRulesClient := postgresql.NewFirewallRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + firewallRulesClient := firewallrules.NewFirewallRulesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&firewallRulesClient.Client, o.ResourceManagerAuthorizer) - serversClient := postgresql.NewServersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + serversClient := servers.NewServersClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&serversClient.Client, o.ResourceManagerAuthorizer) - serverKeysClient := postgresql.NewServerKeysClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + serverKeysClient := serverkeys.NewServerKeysClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&serverKeysClient.Client, o.ResourceManagerAuthorizer) - serverSecurityAlertPoliciesClient := postgresql.NewServerSecurityAlertPoliciesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + serverSecurityAlertPoliciesClient := serversecurityalertpolicies.NewServerSecurityAlertPoliciesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&serverSecurityAlertPoliciesClient.Client, o.ResourceManagerAuthorizer) - virtualNetworkRulesClient := postgresql.NewVirtualNetworkRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + virtualNetworkRulesClient := virtualnetworkrules.NewVirtualNetworkRulesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&virtualNetworkRulesClient.Client, o.ResourceManagerAuthorizer) - serverAdministratorsClient := postgresql.NewServerAdministratorsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + serverAdministratorsClient := serveradministrators.NewServerAdministratorsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&serverAdministratorsClient.Client, o.ResourceManagerAuthorizer) - replicasClient := postgresql.NewReplicasClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + replicasClient := replicas.NewReplicasClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&replicasClient.Client, o.ResourceManagerAuthorizer) - flexibleServersClient := postgresqlflexibleservers.NewServersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + flexibleServersClient := flexibleservers.NewServersClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&flexibleServersClient.Client, o.ResourceManagerAuthorizer) - flexibleServerFirewallRuleClient := postgresqlflexibleservers.NewFirewallRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + restartServerClient := serverrestart.NewServerRestartClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&restartServerClient.Client, o.ResourceManagerAuthorizer) + + flexibleServerFirewallRuleClient := flexibleserverfirewallrules.NewFirewallRulesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&flexibleServerFirewallRuleClient.Client, o.ResourceManagerAuthorizer) - flexibleServerDatabaseClient := postgresqlflexibleservers.NewDatabasesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + flexibleServerDatabaseClient := flexibleserverdatabases.NewDatabasesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&flexibleServerDatabaseClient.Client, o.ResourceManagerAuthorizer) - flexibleServerConfigurationsClient := postgresqlflexibleservers.NewConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + flexibleServerConfigurationsClient := flexibleserverconfigurations.NewConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&flexibleServerConfigurationsClient.Client, o.ResourceManagerAuthorizer) return &Client{ @@ -68,6 +84,7 @@ func NewClient(o *common.ClientOptions) *Client { FirewallRulesClient: &firewallRulesClient, FlexibleServersConfigurationsClient: &flexibleServerConfigurationsClient, FlexibleServersClient: &flexibleServersClient, + ServerRestartClient: &restartServerClient, FlexibleServerFirewallRuleClient: &flexibleServerFirewallRuleClient, FlexibleServerDatabaseClient: &flexibleServerDatabaseClient, ServersClient: &serversClient, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/migration/postgresql_aad_administrator.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/migration/postgresql_aad_administrator.go new file mode 100644 index 00000000000..1f86dfff488 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/migration/postgresql_aad_administrator.go @@ -0,0 +1,69 @@ +package migration + +import ( + "context" + "log" + + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +var _ pluginsdk.StateUpgrade = PostgresqlAADAdministratorV0ToV1{} + +type PostgresqlAADAdministratorV0ToV1 struct{} + +func (PostgresqlAADAdministratorV0ToV1) Schema() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "server_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "resource_group_name": azure.SchemaResourceGroupName(), + + "login": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.AdminUsernames, + }, + + "object_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.IsUUID, + }, + + "tenant_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.IsUUID, + }, + } +} + +func (PostgresqlAADAdministratorV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { + return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + // old + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory + // new: + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName} + // summary: + // Remove administrators chunk + oldId := rawState["id"].(string) + id, err := parse.AzureActiveDirectoryAdministratorID(oldId) + if err != nil { + return rawState, err + } + + newId := serveradministrators.NewServerID(id.SubscriptionId, id.ResourceGroup, id.ServerName) + log.Printf("[DEBUG] Updating ID from %q to %q", oldId, newId) + rawState["id"] = newId.ID() + + return rawState, nil + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/migration/postgresql_database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/migration/postgresql_database.go new file mode 100644 index 00000000000..22a69c38a44 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/migration/postgresql_database.go @@ -0,0 +1,74 @@ +package migration + +import ( + "context" + "log" + "strings" + + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" +) + +var _ pluginsdk.StateUpgrade = PostgresqlDatabaseV0ToV1{} + +type PostgresqlDatabaseV0ToV1 struct{} + +func (PostgresqlDatabaseV0ToV1) Schema() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "resource_group_name": azure.SchemaResourceGroupName(), + + "server_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.ServerName, + }, + + "charset": { + Type: pluginsdk.TypeString, + Required: true, + DiffSuppressFunc: suppress.CaseDifference, + ForceNew: true, + }, + + "collation": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.DatabaseCollation, + }, + } +} + +func (PostgresqlDatabaseV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { + return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + // old + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/databases/{databaseName} + // new: + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName} + // summary: + // Check for `For` and swap to `for` + oldId := rawState["id"].(string) + if strings.Contains(oldId, "Microsoft.DBForPostgreSQL") { + modifiedId := strings.ReplaceAll(oldId, "Microsoft.DBForPostgreSQL", "Microsoft.DBforPostgreSQL") + + newId, err := databases.ParseDatabaseID(modifiedId) + if err != nil { + return rawState, err + } + log.Printf("[DEBUG] Updating ID from %q to %q", oldId, newId) + rawState["id"] = newId.ID() + } + + return rawState, nil + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/migration/postgresql_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/migration/postgresql_server.go new file mode 100644 index 00000000000..b7800d6d065 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/migration/postgresql_server.go @@ -0,0 +1,264 @@ +package migration + +import ( + "context" + "log" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" +) + +var _ pluginsdk.StateUpgrade = PostgresqlServerV0ToV1{} + +type PostgresqlServerV0ToV1 struct{} + +func (PostgresqlServerV0ToV1) Schema() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.ServerName, + }, + + "location": azure.SchemaLocation(), + + "resource_group_name": azure.SchemaResourceGroupName(), + + "sku_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "version": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(servers.PossibleValuesForServerVersion(), false), + }, + + "administrator_login": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.All(validation.StringIsNotWhiteSpace, validate.AdminUsernames), + }, + + "administrator_login_password": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + }, + + "auto_grow_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "backup_retention_days": { + Type: pluginsdk.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.IntBetween(7, 35), + }, + + "geo_redundant_backup_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + ForceNew: true, + Default: false, + }, + + "create_mode": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(servers.CreateModeDefault), + ValidateFunc: validation.StringInSlice(servers.PossibleValuesForCreateMode(), false), + }, + + "creation_source_server_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: servers.ValidateServerID, + }, + + "identity": commonschema.SystemAssignedIdentityOptional(), + + "infrastructure_encryption_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + ForceNew: true, + }, + + "public_network_access_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "restore_point_in_time": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.IsRFC3339Time, + }, + + "storage_mb": { + Type: pluginsdk.TypeInt, + Optional: true, + Computed: true, + ValidateFunc: validation.All( + validation.IntBetween(5120, 16777216), + validation.IntDivisibleBy(1024), + ), + }, + + "ssl_minimal_tls_version_enforced": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(servers.MinimalTlsVersionEnumTLSOneTwo), + ValidateFunc: validation.StringInSlice(servers.PossibleValuesForMinimalTlsVersionEnum(), false), + }, + + "ssl_enforcement_enabled": { + Type: pluginsdk.TypeBool, + Required: true, + }, + + "threat_detection_policy": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + AtLeastOneOf: []string{ + "threat_detection_policy.0.enabled", "threat_detection_policy.0.disabled_alerts", "threat_detection_policy.0.email_account_admins", + "threat_detection_policy.0.email_addresses", "threat_detection_policy.0.retention_days", "threat_detection_policy.0.storage_account_access_key", + "threat_detection_policy.0.storage_endpoint", + }, + }, + + "disabled_alerts": { + Type: pluginsdk.TypeSet, + Optional: true, + Set: pluginsdk.HashString, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + "Sql_Injection", + "Sql_Injection_Vulnerability", + "Access_Anomaly", + "Data_Exfiltration", + "Unsafe_Action", + }, false), + }, + AtLeastOneOf: []string{ + "threat_detection_policy.0.enabled", "threat_detection_policy.0.disabled_alerts", "threat_detection_policy.0.email_account_admins", + "threat_detection_policy.0.email_addresses", "threat_detection_policy.0.retention_days", "threat_detection_policy.0.storage_account_access_key", + "threat_detection_policy.0.storage_endpoint", + }, + }, + + "email_account_admins": { + Type: pluginsdk.TypeBool, + Optional: true, + AtLeastOneOf: []string{ + "threat_detection_policy.0.enabled", "threat_detection_policy.0.disabled_alerts", "threat_detection_policy.0.email_account_admins", + "threat_detection_policy.0.email_addresses", "threat_detection_policy.0.retention_days", "threat_detection_policy.0.storage_account_access_key", + "threat_detection_policy.0.storage_endpoint", + }, + }, + + "email_addresses": { + Type: pluginsdk.TypeSet, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + // todo email validation in code + }, + Set: pluginsdk.HashString, + AtLeastOneOf: []string{ + "threat_detection_policy.0.enabled", "threat_detection_policy.0.disabled_alerts", "threat_detection_policy.0.email_account_admins", + "threat_detection_policy.0.email_addresses", "threat_detection_policy.0.retention_days", "threat_detection_policy.0.storage_account_access_key", + "threat_detection_policy.0.storage_endpoint", + }, + }, + + "retention_days": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntAtLeast(0), + AtLeastOneOf: []string{ + "threat_detection_policy.0.enabled", "threat_detection_policy.0.disabled_alerts", "threat_detection_policy.0.email_account_admins", + "threat_detection_policy.0.email_addresses", "threat_detection_policy.0.retention_days", "threat_detection_policy.0.storage_account_access_key", + "threat_detection_policy.0.storage_endpoint", + }, + }, + + "storage_account_access_key": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + AtLeastOneOf: []string{ + "threat_detection_policy.0.enabled", "threat_detection_policy.0.disabled_alerts", "threat_detection_policy.0.email_account_admins", + "threat_detection_policy.0.email_addresses", "threat_detection_policy.0.retention_days", "threat_detection_policy.0.storage_account_access_key", + "threat_detection_policy.0.storage_endpoint", + }, + }, + + "storage_endpoint": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + AtLeastOneOf: []string{ + "threat_detection_policy.0.enabled", "threat_detection_policy.0.disabled_alerts", "threat_detection_policy.0.email_account_admins", + "threat_detection_policy.0.email_addresses", "threat_detection_policy.0.retention_days", "threat_detection_policy.0.storage_account_access_key", + "threat_detection_policy.0.storage_endpoint", + }, + }, + }, + }, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.Tags(), + } +} + +func (PostgresqlServerV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { + return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + // old + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName} + // new: + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName} + // summary: + // Check for `For` and swap to `for` + oldId := rawState["id"].(string) + if strings.Contains(oldId, "Microsoft.DBForPostgreSQL") { + modifiedId := strings.ReplaceAll(oldId, "Microsoft.DBForPostgreSQL", "Microsoft.DBforPostgreSQL") + + newId, err := servers.ParseServerID(modifiedId) + if err != nil { + return rawState, err + } + log.Printf("[DEBUG] Updating ID from %q to %q", oldId, newId) + rawState["id"] = newId.ID() + } + + return rawState, nil + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/configuration.go deleted file mode 100644 index 69dee5a0be6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/configuration.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ConfigurationId struct { - SubscriptionId string - ResourceGroup string - ServerName string - Name string -} - -func NewConfigurationID(subscriptionId, resourceGroup, serverName, name string) ConfigurationId { - return ConfigurationId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ServerName: serverName, - Name: name, - } -} - -func (id ConfigurationId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Server Name %q", id.ServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Configuration", segmentsStr) -} - -func (id ConfigurationId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/configurations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.Name) -} - -// ConfigurationID parses a Configuration ID into an ConfigurationId struct -func ConfigurationID(input string) (*ConfigurationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ConfigurationId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("configurations"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/database.go deleted file mode 100644 index 33e2dbf57aa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/database.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type DatabaseId struct { - SubscriptionId string - ResourceGroup string - ServerName string - Name string -} - -func NewDatabaseID(subscriptionId, resourceGroup, serverName, name string) DatabaseId { - return DatabaseId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ServerName: serverName, - Name: name, - } -} - -func (id DatabaseId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Server Name %q", id.ServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Database", segmentsStr) -} - -func (id DatabaseId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/databases/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.Name) -} - -// DatabaseID parses a Database ID into an DatabaseId struct -func DatabaseID(input string) (*DatabaseId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := DatabaseId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("databases"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/firewall_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/firewall_rule.go deleted file mode 100644 index d18754cb95d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/firewall_rule.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type FirewallRuleId struct { - SubscriptionId string - ResourceGroup string - ServerName string - Name string -} - -func NewFirewallRuleID(subscriptionId, resourceGroup, serverName, name string) FirewallRuleId { - return FirewallRuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ServerName: serverName, - Name: name, - } -} - -func (id FirewallRuleId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Server Name %q", id.ServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Firewall Rule", segmentsStr) -} - -func (id FirewallRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/firewallRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.Name) -} - -// FirewallRuleID parses a FirewallRule ID into an FirewallRuleId struct -func FirewallRuleID(input string) (*FirewallRuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := FirewallRuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("firewallRules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/flexible_server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/flexible_server.go deleted file mode 100644 index ae13a5c53a3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/flexible_server.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type FlexibleServerId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewFlexibleServerID(subscriptionId, resourceGroup, name string) FlexibleServerId { - return FlexibleServerId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id FlexibleServerId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Flexible Server", segmentsStr) -} - -func (id FlexibleServerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// FlexibleServerID parses a FlexibleServer ID into an FlexibleServerId struct -func FlexibleServerID(input string) (*FlexibleServerId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := FlexibleServerId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("flexibleServers"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/flexible_server_configuration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/flexible_server_configuration.go deleted file mode 100644 index 8667dc68fa2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/flexible_server_configuration.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type FlexibleServerConfigurationId struct { - SubscriptionId string - ResourceGroup string - FlexibleServerName string - ConfigurationName string -} - -func NewFlexibleServerConfigurationID(subscriptionId, resourceGroup, flexibleServerName, configurationName string) FlexibleServerConfigurationId { - return FlexibleServerConfigurationId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - FlexibleServerName: flexibleServerName, - ConfigurationName: configurationName, - } -} - -func (id FlexibleServerConfigurationId) String() string { - segments := []string{ - fmt.Sprintf("Configuration Name %q", id.ConfigurationName), - fmt.Sprintf("Flexible Server Name %q", id.FlexibleServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Flexible Server Configuration", segmentsStr) -} - -func (id FlexibleServerConfigurationId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s/configurations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.FlexibleServerName, id.ConfigurationName) -} - -// FlexibleServerConfigurationID parses a FlexibleServerConfiguration ID into an FlexibleServerConfigurationId struct -func FlexibleServerConfigurationID(input string) (*FlexibleServerConfigurationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := FlexibleServerConfigurationId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.FlexibleServerName, err = id.PopSegment("flexibleServers"); err != nil { - return nil, err - } - if resourceId.ConfigurationName, err = id.PopSegment("configurations"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/flexible_server_database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/flexible_server_database.go deleted file mode 100644 index 35515795781..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/flexible_server_database.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type FlexibleServerDatabaseId struct { - SubscriptionId string - ResourceGroup string - FlexibleServerName string - DatabaseName string -} - -func NewFlexibleServerDatabaseID(subscriptionId, resourceGroup, flexibleServerName, databaseName string) FlexibleServerDatabaseId { - return FlexibleServerDatabaseId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - FlexibleServerName: flexibleServerName, - DatabaseName: databaseName, - } -} - -func (id FlexibleServerDatabaseId) String() string { - segments := []string{ - fmt.Sprintf("Database Name %q", id.DatabaseName), - fmt.Sprintf("Flexible Server Name %q", id.FlexibleServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Flexible Server Database", segmentsStr) -} - -func (id FlexibleServerDatabaseId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s/databases/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.FlexibleServerName, id.DatabaseName) -} - -// FlexibleServerDatabaseID parses a FlexibleServerDatabase ID into an FlexibleServerDatabaseId struct -func FlexibleServerDatabaseID(input string) (*FlexibleServerDatabaseId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := FlexibleServerDatabaseId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.FlexibleServerName, err = id.PopSegment("flexibleServers"); err != nil { - return nil, err - } - if resourceId.DatabaseName, err = id.PopSegment("databases"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/flexible_server_firewall_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/flexible_server_firewall_rule.go deleted file mode 100644 index 7a3d935c4c5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/flexible_server_firewall_rule.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type FlexibleServerFirewallRuleId struct { - SubscriptionId string - ResourceGroup string - FlexibleServerName string - FirewallRuleName string -} - -func NewFlexibleServerFirewallRuleID(subscriptionId, resourceGroup, flexibleServerName, firewallRuleName string) FlexibleServerFirewallRuleId { - return FlexibleServerFirewallRuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - FlexibleServerName: flexibleServerName, - FirewallRuleName: firewallRuleName, - } -} - -func (id FlexibleServerFirewallRuleId) String() string { - segments := []string{ - fmt.Sprintf("Firewall Rule Name %q", id.FirewallRuleName), - fmt.Sprintf("Flexible Server Name %q", id.FlexibleServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Flexible Server Firewall Rule", segmentsStr) -} - -func (id FlexibleServerFirewallRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/flexibleServers/%s/firewallRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.FlexibleServerName, id.FirewallRuleName) -} - -// FlexibleServerFirewallRuleID parses a FlexibleServerFirewallRule ID into an FlexibleServerFirewallRuleId struct -func FlexibleServerFirewallRuleID(input string) (*FlexibleServerFirewallRuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := FlexibleServerFirewallRuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.FlexibleServerName, err = id.PopSegment("flexibleServers"); err != nil { - return nil, err - } - if resourceId.FirewallRuleName, err = id.PopSegment("firewallRules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/server.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/server.go deleted file mode 100644 index 17dc8a9e70c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/server.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ServerId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewServerID(subscriptionId, resourceGroup, name string) ServerId { - return ServerId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id ServerId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Server", segmentsStr) -} - -func (id ServerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// ServerID parses a Server ID into an ServerId struct -func ServerID(input string) (*ServerId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ServerId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("servers"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/server_key.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/server_key.go deleted file mode 100644 index 31da5fcb0ec..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/server_key.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ServerKeyId struct { - SubscriptionId string - ResourceGroup string - ServerName string - KeyName string -} - -func NewServerKeyID(subscriptionId, resourceGroup, serverName, keyName string) ServerKeyId { - return ServerKeyId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ServerName: serverName, - KeyName: keyName, - } -} - -func (id ServerKeyId) String() string { - segments := []string{ - fmt.Sprintf("Key Name %q", id.KeyName), - fmt.Sprintf("Server Name %q", id.ServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Server Key", segmentsStr) -} - -func (id ServerKeyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/keys/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.KeyName) -} - -// ServerKeyID parses a ServerKey ID into an ServerKeyId struct -func ServerKeyID(input string) (*ServerKeyId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ServerKeyId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { - return nil, err - } - if resourceId.KeyName, err = id.PopSegment("keys"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/virtual_network_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/virtual_network_rule.go deleted file mode 100644 index f080046b235..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse/virtual_network_rule.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type VirtualNetworkRuleId struct { - SubscriptionId string - ResourceGroup string - ServerName string - Name string -} - -func NewVirtualNetworkRuleID(subscriptionId, resourceGroup, serverName, name string) VirtualNetworkRuleId { - return VirtualNetworkRuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ServerName: serverName, - Name: name, - } -} - -func (id VirtualNetworkRuleId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Server Name %q", id.ServerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Virtual Network Rule", segmentsStr) -} - -func (id VirtualNetworkRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.DBforPostgreSQL/servers/%s/virtualNetworkRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ServerName, id.Name) -} - -// VirtualNetworkRuleID parses a VirtualNetworkRule ID into an VirtualNetworkRuleId struct -func VirtualNetworkRuleID(input string) (*VirtualNetworkRuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := VirtualNetworkRuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ServerName, err = id.PopSegment("servers"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("virtualNetworkRules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_aad_administrator_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_aad_administrator_resource.go index 6633b282824..f511851b250 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_aad_administrator_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_aad_administrator_resource.go @@ -5,17 +5,16 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql" - "github.com/gofrs/uuid" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourcePostgreSQLAdministrator() *pluginsdk.Resource { @@ -25,7 +24,7 @@ func resourcePostgreSQLAdministrator() *pluginsdk.Resource { Update: resourcePostgreSQLAdministratorCreateUpdate, Delete: resourcePostgreSQLAdministratorDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.AzureActiveDirectoryAdministratorID(id) + _, err := serveradministrators.ParseServerID(id) return err }), @@ -36,6 +35,11 @@ func resourcePostgreSQLAdministrator() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, + SchemaVersion: 1, + StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ + 0: migration.PostgresqlAADAdministratorV0ToV1{}, + }), + Schema: map[string]*pluginsdk.Schema{ "server_name": { Type: pluginsdk.TypeString, @@ -72,40 +76,32 @@ func resourcePostgreSQLAdministratorCreateUpdate(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - login := d.Get("login").(string) - objectId := uuid.FromStringOrNil(d.Get("object_id").(string)) - tenantId := uuid.FromStringOrNil(d.Get("tenant_id").(string)) - - id := parse.NewAzureActiveDirectoryAdministratorID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), "activeDirectory") + id := serveradministrators.NewServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServerName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_postgresql_active_directory_administrator", id.ID()) } } - parameters := postgresql.ServerAdministratorResource{ - ServerAdministratorProperties: &postgresql.ServerAdministratorProperties{ - AdministratorType: utils.String("ActiveDirectory"), - Login: utils.String(login), - Sid: &objectId, - TenantID: &tenantId, + parameters := serveradministrators.ServerAdministratorResource{ + Properties: &serveradministrators.ServerAdministratorProperties{ + AdministratorType: serveradministrators.AdministratorTypeActiveDirectory, + Login: d.Get("login").(string), + Sid: d.Get("object_id").(string), + TenantId: d.Get("tenant_id").(string), }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, parameters) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for create/update of %s: %+v", id, err) - } d.SetId(id.ID()) return nil @@ -116,14 +112,14 @@ func resourcePostgreSQLAdministratorRead(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AzureActiveDirectoryAdministratorID(d.Id()) + id, err := serveradministrators.ParseServerID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s was not found - removing from state", *id) d.SetId("") return nil @@ -132,23 +128,16 @@ func resourcePostgreSQLAdministratorRead(d *pluginsdk.ResourceData, meta interfa return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("server_name", id.ServerName) - if props := resp.ServerAdministratorProperties; props != nil { - d.Set("login", props.Login) - - objectId := "" - if props.Sid != nil { - objectId = props.Sid.String() + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("login", props.Login) + d.Set("object_id", props.Sid) + d.Set("tenant_id", props.TenantId) } - d.Set("object_id", objectId) - tenantId := "" - if props.TenantID != nil { - tenantId = props.TenantID.String() - } - d.Set("tenant_id", tenantId) } return nil @@ -159,18 +148,14 @@ func resourcePostgreSQLAdministratorDelete(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AzureActiveDirectoryAdministratorID(d.Id()) + id, err := serveradministrators.ParseServerID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ServerName) - if err != nil { + if err := client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_configuration_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_configuration_resource.go index d872bfcbf28..0b55f229df8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_configuration_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_configuration_resource.go @@ -5,11 +5,11 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -22,7 +22,7 @@ func resourcePostgreSQLConfiguration() *pluginsdk.Resource { Read: resourcePostgreSQLConfigurationRead, Delete: resourcePostgreSQLConfigurationDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ConfigurationID(id) + _, err := configurations.ParseConfigurationID(id) return err }), @@ -64,27 +64,22 @@ func resourcePostgreSQLConfigurationCreateUpdate(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewConfigurationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) + id := configurations.NewConfigurationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) // TODO: support RequiresImport - this is possible to tell if it's the non-default value from the API (see Delete) locks.ByName(id.ServerName, postgreSQLServerResourceName) defer locks.UnlockByName(id.ServerName, postgreSQLServerResourceName) - properties := postgresql.Configuration{ - ConfigurationProperties: &postgresql.ConfigurationProperties{ + properties := configurations.Configuration{ + Properties: &configurations.ConfigurationProperties{ Value: utils.String(d.Get("value").(string)), }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.Name, properties) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for create/update of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourcePostgreSQLConfigurationRead(d, meta) } @@ -94,14 +89,14 @@ func resourcePostgreSQLConfigurationRead(d *pluginsdk.ResourceData, meta interfa ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ConfigurationID(d.Id()) + id, err := configurations.ParseConfigurationID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[WARN] %s was not found - removing from state", *id) d.SetId("") return nil @@ -110,12 +105,14 @@ func resourcePostgreSQLConfigurationRead(d *pluginsdk.ResourceData, meta interfa return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) + d.Set("name", id.ConfigurationName) d.Set("server_name", id.ServerName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.ConfigurationProperties; props != nil { - d.Set("value", props.Value) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("value", props.Value) + } } return nil @@ -126,7 +123,7 @@ func resourcePostgreSQLConfigurationDelete(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ConfigurationID(d.Id()) + id, err := configurations.ParseConfigurationID(d.Id()) if err != nil { return err } @@ -135,26 +132,26 @@ func resourcePostgreSQLConfigurationDelete(d *pluginsdk.ResourceData, meta inter defer locks.UnlockByName(id.ServerName, postgreSQLServerResourceName) // "delete" = resetting this to the default value - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - return fmt.Errorf("retrieving Postgresql Configuration '%s': %+v", id.Name, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - properties := postgresql.Configuration{ - ConfigurationProperties: &postgresql.ConfigurationProperties{ + defaultValue := "" + if resp.Model != nil && resp.Model.Properties != nil && resp.Model.Properties.DefaultValue != nil { + defaultValue = *resp.Model.Properties.DefaultValue + } + + properties := configurations.Configuration{ + Properties: &configurations.ConfigurationProperties{ // we can alternatively set `source: "system-default"` - Value: resp.DefaultValue, + Value: &defaultValue, }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.Name, properties) - if err != nil { + if err = client.CreateOrUpdateThenPoll(ctx, *id, properties); err != nil { return fmt.Errorf("resetting %s to it's default value: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for %s to reset to it's default value: %+v", *id, err) - } - return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_database_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_database_resource.go index 31e01422f83..ac051f4eaf7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_database_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_database_resource.go @@ -5,11 +5,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -23,7 +24,7 @@ func resourcePostgreSQLDatabase() *pluginsdk.Resource { Read: resourcePostgreSQLDatabaseRead, Delete: resourcePostgreSQLDatabaseDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DatabaseID(id) + _, err := databases.ParseDatabaseID(id) return err }), @@ -34,6 +35,11 @@ func resourcePostgreSQLDatabase() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(60 * time.Minute), }, + SchemaVersion: 1, + StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ + 0: migration.PostgresqlDatabaseV0ToV1{}, + }), + Schema: map[string]*pluginsdk.Schema{ "name": { Type: pluginsdk.TypeString, @@ -73,34 +79,29 @@ func resourcePostgreSQLDatabaseCreate(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewDatabaseID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + id := databases.NewDatabaseID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_postgresql_database", id.ID()) } - properties := postgresql.Database{ - DatabaseProperties: &postgresql.DatabaseProperties{ + properties := databases.Database{ + Properties: &databases.DatabaseProperties{ Charset: utils.String(d.Get("charset").(string)), Collation: utils.String(d.Get("collation").(string)), }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.Name, properties) - if err != nil { + if err = client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for create/update of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourcePostgreSQLDatabaseRead(d, meta) } @@ -110,14 +111,14 @@ func resourcePostgreSQLDatabaseRead(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DatabaseID(d.Id()) + id, err := databases.ParseDatabaseID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[WARN] %s was not found - removing from state", *id) d.SetId("") return nil @@ -126,13 +127,15 @@ func resourcePostgreSQLDatabaseRead(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) + d.Set("name", id.DatabaseName) d.Set("server_name", id.ServerName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.DatabaseProperties; props != nil { - d.Set("charset", props.Charset) - d.Set("collation", props.Collation) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("charset", props.Charset) + d.Set("collation", props.Collation) + } } return nil @@ -143,19 +146,14 @@ func resourcePostgreSQLDatabaseDelete(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DatabaseID(d.Id()) + id, err := databases.ParseDatabaseID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ServerName, id.Name) - if err != nil { + if err = client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_firewall_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_firewall_rule_resource.go index 075dfb643ab..2dbc7304f92 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_firewall_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_firewall_rule_resource.go @@ -6,16 +6,15 @@ import ( "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourcePostgreSQLFirewallRule() *pluginsdk.Resource { @@ -24,7 +23,7 @@ func resourcePostgreSQLFirewallRule() *pluginsdk.Resource { Read: resourcePostgreSQLFirewallRuleRead, Delete: resourcePostgreSQLFirewallRuleDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.FirewallRuleID(id) + _, err := firewallrules.ParseFirewallRuleID(id) return err }), @@ -78,34 +77,29 @@ func resourcePostgreSQLFirewallRuleCreate(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewFirewallRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + id := firewallrules.NewFirewallRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_postgresql_firewall_rule", id.ID()) } - properties := postgresql.FirewallRule{ - FirewallRuleProperties: &postgresql.FirewallRuleProperties{ - StartIPAddress: utils.String(d.Get("start_ip_address").(string)), - EndIPAddress: utils.String(d.Get("end_ip_address").(string)), + properties := firewallrules.FirewallRule{ + Properties: firewallrules.FirewallRuleProperties{ + StartIPAddress: d.Get("start_ip_address").(string), + EndIPAddress: d.Get("end_ip_address").(string), }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.Name, properties) - if err != nil { + if err = client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for create/update of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourcePostgreSQLFirewallRuleRead(d, meta) } @@ -115,14 +109,14 @@ func resourcePostgreSQLFirewallRuleRead(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FirewallRuleID(d.Id()) + id, err := firewallrules.ParseFirewallRuleID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[WARN] %s was not found - removing from state", *id) d.SetId("") return nil @@ -131,13 +125,13 @@ func resourcePostgreSQLFirewallRuleRead(d *pluginsdk.ResourceData, meta interfac return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.FirewallRuleName) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("server_name", id.ServerName) - if props := resp.FirewallRuleProperties; props != nil { - d.Set("start_ip_address", props.StartIPAddress) - d.Set("end_ip_address", props.EndIPAddress) + if model := resp.Model; model != nil { + d.Set("start_ip_address", resp.Model.Properties.StartIPAddress) + d.Set("end_ip_address", resp.Model.Properties.EndIPAddress) } return nil @@ -148,19 +142,14 @@ func resourcePostgreSQLFirewallRuleDelete(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FirewallRuleID(d.Id()) + id, err := firewallrules.ParseFirewallRuleID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ServerName, id.Name) - if err != nil { + if err = client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_configuration_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_configuration_resource.go index ea5c7ac9a7e..2514a9eaf1a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_configuration_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_configuration_resource.go @@ -5,11 +5,10 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -31,7 +30,7 @@ func resourcePostgresqlFlexibleServerConfiguration() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.FlexibleServerConfigurationID(id) + _, err := configurations.ParseConfigurationID(id) return err }), @@ -47,7 +46,7 @@ func resourcePostgresqlFlexibleServerConfiguration() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.FlexibleServerID, + ValidateFunc: configurations.ValidateFlexibleServerID, }, "value": { @@ -67,33 +66,26 @@ func resourceFlexibleServerConfigurationUpdate(d *pluginsdk.ResourceData, meta i log.Printf("[INFO] preparing arguments for Azure Postgresql Flexible Server configuration creation.") - name := d.Get("name").(string) - serverId, err := parse.FlexibleServerID(d.Get("server_id").(string)) + serverId, err := configurations.ParseFlexibleServerID(d.Get("server_id").(string)) if err != nil { return err } + id := configurations.NewConfigurationID(subscriptionId, serverId.ResourceGroupName, serverId.ServerName, d.Get("name").(string)) - id := parse.NewFlexibleServerConfigurationID(subscriptionId, serverId.ResourceGroup, serverId.Name, name) + locks.ByName(id.ServerName, postgresqlFlexibleServerResourceName) + defer locks.UnlockByName(id.ServerName, postgresqlFlexibleServerResourceName) - locks.ByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) - defer locks.UnlockByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) - - props := postgresqlflexibleservers.Configuration{ - ConfigurationProperties: &postgresqlflexibleservers.ConfigurationProperties{ + props := configurations.Configuration{ + Properties: &configurations.ConfigurationProperties{ Value: utils.String(d.Get("value").(string)), Source: utils.String("user-override"), }, } - future, err := client.Update(ctx, serverId.ResourceGroup, serverId.Name, name, props) - if err != nil { + if err := client.UpdateThenPoll(ctx, id, props); err != nil { return fmt.Errorf("updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for create/update of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceFlexibleServerConfigurationRead(d, meta) @@ -105,14 +97,14 @@ func resourceFlexibleServerConfigurationRead(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FlexibleServerConfigurationID(d.Id()) + id, err := configurations.ParseConfigurationID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.FlexibleServerName, id.ConfigurationName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[WARN] %s was not found, removing from state", id) d.SetId("") return nil @@ -122,10 +114,10 @@ func resourceFlexibleServerConfigurationRead(d *pluginsdk.ResourceData, meta int } d.Set("name", id.ConfigurationName) - d.Set("server_id", parse.NewFlexibleServerID(subscriptionId, id.ResourceGroup, id.FlexibleServerName).ID()) + d.Set("server_id", configurations.NewFlexibleServerID(subscriptionId, id.ResourceGroupName, id.ServerName).ID()) - if props := resp.ConfigurationProperties; props != nil { - d.Set("value", props.Value) + if resp.Model != nil && resp.Model.Properties != nil { + d.Set("value", resp.Model.Properties.Value) } return nil @@ -136,34 +128,34 @@ func resourceFlexibleServerConfigurationDelete(d *pluginsdk.ResourceData, meta i ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FlexibleServerConfigurationID(d.Id()) + id, err := configurations.ParseConfigurationID(d.Id()) if err != nil { return err } - locks.ByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) - defer locks.UnlockByName(id.FlexibleServerName, postgresqlFlexibleServerResourceName) + locks.ByName(id.ServerName, postgresqlFlexibleServerResourceName) + defer locks.UnlockByName(id.ServerName, postgresqlFlexibleServerResourceName) - resp, err := client.Get(ctx, id.ResourceGroup, id.FlexibleServerName, id.ConfigurationName) + resp, err := client.Get(ctx, *id) if err != nil { return fmt.Errorf("retrieving %s: %+v", id, err) } - props := postgresqlflexibleservers.Configuration{ - ConfigurationProperties: &postgresqlflexibleservers.ConfigurationProperties{ - Value: resp.DefaultValue, + defaultValue := "" + if resp.Model != nil && resp.Model.Properties != nil && resp.Model.Properties.DefaultValue != nil { + defaultValue = *resp.Model.Properties.DefaultValue + } + + props := configurations.Configuration{ + Properties: &configurations.ConfigurationProperties{ + Value: &defaultValue, Source: utils.String("user-override"), }, } - future, err := client.Update(ctx, id.ResourceGroup, id.FlexibleServerName, id.ConfigurationName, props) - if err != nil { + if err = client.UpdateThenPoll(ctx, *id, props); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", id, err) - } - return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_data_source.go index c8eb4192896..968b30c54a2 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_data_source.go @@ -4,15 +4,14 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourcePostgresqlFlexibleServer() *pluginsdk.Resource { @@ -73,7 +72,7 @@ func dataSourcePostgresqlFlexibleServer() *pluginsdk.Resource { Computed: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -87,45 +86,56 @@ func dataSourceArmPostgresqlFlexibleServerRead(d *pluginsdk.ResourceData, meta i name := d.Get("name").(string) resourceGroup := d.Get("resource_group_name").(string) - id := parse.NewFlexibleServerID(subscriptionId, resourceGroup, name) + id := servers.NewFlexibleServerID(subscriptionId, resourceGroup, name) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf("Postgresqlflexibleservers Server %q does not exist", id.Name) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s does not exist", id) } - return fmt.Errorf("retrieving Postgresqlflexibleservers Server %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.ServerName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) + + if props := model.Properties; props != nil { + d.Set("administrator_login", props.AdministratorLogin) + d.Set("version", props.Version) + d.Set("fqdn", props.FullyQualifiedDomainName) + + if storage := props.Storage; storage != nil && storage.StorageSizeGB != nil { + d.Set("storage_mb", (*props.Storage.StorageSizeGB * 1024)) + } + + if backup := props.Backup; backup != nil { + d.Set("backup_retention_days", props.Backup.BackupRetentionDays) + } + + if network := props.Network; network != nil { + d.Set("delegated_subnet_id", network.DelegatedSubnetResourceId) + publicNetworkAccess := false + if network.PublicNetworkAccess != nil { + publicNetworkAccess = *network.PublicNetworkAccess == servers.ServerPublicNetworkAccessStateEnabled + } + d.Set("public_network_access_enabled", publicNetworkAccess) + } - if props := resp.ServerProperties; props != nil { - d.Set("administrator_login", props.AdministratorLogin) - d.Set("version", props.Version) - d.Set("fqdn", props.FullyQualifiedDomainName) - - if storage := props.Storage; storage != nil && storage.StorageSizeGB != nil { - d.Set("storage_mb", (*props.Storage.StorageSizeGB * 1024)) } - if backup := props.Backup; backup != nil { - d.Set("backup_retention_days", props.Backup.BackupRetentionDays) + sku, err := flattenFlexibleServerSku(model.Sku) + if err != nil { + return fmt.Errorf("flattening `sku_name`: %+v", err) } - if network := props.Network; network != nil { - d.Set("delegated_subnet_id", network.DelegatedSubnetResourceID) - d.Set("public_network_access_enabled", network.PublicNetworkAccess == postgresqlflexibleservers.ServerPublicNetworkAccessStateEnabled) - } - } + d.Set("sku_name", sku) - sku, err := flattenFlexibleServerSku(resp.Sku) - if err != nil { - return fmt.Errorf("flattening `sku_name` for PostgreSQL Flexible Server %s (Resource Group %q): %v", id.Name, id.ResourceGroup, err) + return tags.FlattenAndSet(d, model.Tags) } - d.Set("sku_name", sku) - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_database_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_database_resource.go index 3d88d980233..5e67ec8a363 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_database_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_database_resource.go @@ -5,10 +5,10 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -22,7 +22,7 @@ func resourcePostgresqlFlexibleServerDatabase() *pluginsdk.Resource { Read: resourcePostgresqlFlexibleServerDatabaseRead, Delete: resourcePostgresqlFlexibleServerDatabaseDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.FlexibleServerDatabaseID(id) + _, err := databases.ParseDatabaseID(id) return err }), @@ -44,7 +44,7 @@ func resourcePostgresqlFlexibleServerDatabase() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.FlexibleServerID, + ValidateFunc: databases.ValidateFlexibleServerID, }, "charset": { @@ -73,42 +73,36 @@ func resourcePostgresqlFlexibleServerDatabaseCreate(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - serverId, err := parse.FlexibleServerID(d.Get("server_id").(string)) + serverId, err := databases.ParseFlexibleServerID(d.Get("server_id").(string)) if err != nil { return err } - id := parse.NewFlexibleServerDatabaseID(subscriptionId, serverId.ResourceGroup, serverId.Name, name) + id := databases.NewDatabaseID(subscriptionId, serverId.ResourceGroupName, serverId.ServerName, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, serverId.ResourceGroup, serverId.Name, name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %q: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_postgresql_flexible_server_database", id.ID()) } } - properties := postgresqlflexibleservers.Database{ - DatabaseProperties: &postgresqlflexibleservers.DatabaseProperties{ + properties := databases.Database{ + Properties: &databases.DatabaseProperties{ Charset: utils.String(d.Get("charset").(string)), Collation: utils.String(d.Get("collation").(string)), }, } - future, err := client.Create(ctx, id.ResourceGroup, id.FlexibleServerName, id.DatabaseName, properties) - if err != nil { + if err = client.CreateThenPoll(ctx, id, properties); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourcePostgresqlFlexibleServerDatabaseRead(d, meta) } @@ -119,14 +113,14 @@ func resourcePostgresqlFlexibleServerDatabaseRead(d *pluginsdk.ResourceData, met ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FlexibleServerDatabaseID(d.Id()) + id, err := databases.ParseDatabaseID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.FlexibleServerName, id.DatabaseName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil @@ -134,11 +128,13 @@ func resourcePostgresqlFlexibleServerDatabaseRead(d *pluginsdk.ResourceData, met return fmt.Errorf("retrieving %s: %+v", *id, err) } d.Set("name", id.DatabaseName) - d.Set("server_id", parse.NewFlexibleServerID(subscriptionId, id.ResourceGroup, id.FlexibleServerName).ID()) + d.Set("server_id", databases.NewFlexibleServerID(subscriptionId, id.ResourceGroupName, id.ServerName).ID()) - if props := resp.DatabaseProperties; props != nil { - d.Set("charset", props.Charset) - d.Set("collation", props.Collation) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("charset", props.Charset) + d.Set("collation", props.Collation) + } } return nil @@ -149,19 +145,14 @@ func resourcePostgresqlFlexibleServerDatabaseDelete(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FlexibleServerDatabaseID(d.Id()) + id, err := databases.ParseDatabaseID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.FlexibleServerName, id.DatabaseName) - if err != nil { + if err = client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deleting of %s: %+v", *id, err) - } - return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go index b051ca083bf..6a2e282df01 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_firewall_rule_resource.go @@ -5,15 +5,14 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourcePostgresqlFlexibleServerFirewallRule() *pluginsdk.Resource { @@ -31,7 +30,7 @@ func resourcePostgresqlFlexibleServerFirewallRule() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.FlexibleServerFirewallRuleID(id) + _, err := firewallrules.ParseFirewallRuleID(id) return err }), @@ -47,7 +46,7 @@ func resourcePostgresqlFlexibleServerFirewallRule() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.FlexibleServerID, + ValidateFunc: firewallrules.ValidateFlexibleServerID, }, "end_ip_address": { @@ -71,42 +70,36 @@ func resourcePostgresqlFlexibleServerFirewallRuleCreateUpdate(d *pluginsdk.Resou ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - serverId, err := parse.FlexibleServerID(d.Get("server_id").(string)) + serverId, err := firewallrules.ParseFlexibleServerID(d.Get("server_id").(string)) if err != nil { return err } - id := parse.NewFlexibleServerFirewallRuleID(subscriptionId, serverId.ResourceGroup, serverId.Name, name) + id := firewallrules.NewFirewallRuleID(subscriptionId, serverId.ResourceGroupName, serverId.ServerName, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, serverId.ResourceGroup, serverId.Name, name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for present of existing %q: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_postgresql_flexible_server_firewall_rule", id.ID()) } } - properties := postgresqlflexibleservers.FirewallRule{ - FirewallRuleProperties: &postgresqlflexibleservers.FirewallRuleProperties{ - EndIPAddress: utils.String(d.Get("end_ip_address").(string)), - StartIPAddress: utils.String(d.Get("start_ip_address").(string)), + properties := firewallrules.FirewallRule{ + Properties: firewallrules.FirewallRuleProperties{ + EndIPAddress: d.Get("end_ip_address").(string), + StartIPAddress: d.Get("start_ip_address").(string), }, } - future, err := client.CreateOrUpdate(ctx, serverId.ResourceGroup, serverId.Name, name, properties) - if err != nil { + if err = client.CreateOrUpdateThenPoll(ctx, id, properties); err != nil { return fmt.Errorf("creating/updating %q: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the creation/ update of %q: %+v", id, err) - } - d.SetId(id.ID()) return resourcePostgresqlFlexibleServerFirewallRuleRead(d, meta) } @@ -117,14 +110,14 @@ func resourcePostgresqlFlexibleServerFirewallRuleRead(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FlexibleServerFirewallRuleID(d.Id()) + id, err := firewallrules.ParseFirewallRuleID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.FlexibleServerName, id.FirewallRuleName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] Postgresql Flexible Server Firewall Rule %q does not exist - removing from state", d.Id()) d.SetId("") return nil @@ -132,10 +125,11 @@ func resourcePostgresqlFlexibleServerFirewallRuleRead(d *pluginsdk.ResourceData, return fmt.Errorf("retrieving %q: %+v", id, err) } d.Set("name", id.FirewallRuleName) - d.Set("server_id", parse.NewFlexibleServerID(subscriptionId, id.ResourceGroup, id.FlexibleServerName).ID()) - if props := resp.FirewallRuleProperties; props != nil { - d.Set("end_ip_address", props.EndIPAddress) - d.Set("start_ip_address", props.StartIPAddress) + d.Set("server_id", firewallrules.NewFlexibleServerID(subscriptionId, id.ResourceGroupName, id.ServerName).ID()) + + if model := resp.Model; model != nil { + d.Set("end_ip_address", model.Properties.EndIPAddress) + d.Set("start_ip_address", model.Properties.StartIPAddress) } return nil } @@ -145,18 +139,14 @@ func resourcePostgresqlFlexibleServerFirewallRuleDelete(d *pluginsdk.ResourceDat ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FlexibleServerFirewallRuleID(d.Id()) + id, err := firewallrules.ParseFirewallRuleID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.FlexibleServerName, id.FirewallRuleName) - if err != nil { + if err = client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %q: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the delete of %q: %+v", id, err) - } return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_resource.go index 4e4936e69c5..9895739c00a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_flexible_server_resource.go @@ -6,18 +6,18 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers" - "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -46,7 +46,7 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.FlexibleServerID(id) + _, err := servers.ParseFlexibleServerID(id) return err }), @@ -92,15 +92,11 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { }, "version": { - Type: pluginsdk.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - string(postgresqlflexibleservers.ServerVersionOneOne), - string(postgresqlflexibleservers.ServerVersionOneTwo), - string(postgresqlflexibleservers.ServerVersionOneThree), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(servers.PossibleValuesForServerVersion(), false), }, "zone": commonschema.ZoneSingleOptional(), @@ -110,8 +106,8 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { Optional: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(postgresqlflexibleservers.CreateModeDefault), - string(postgresqlflexibleservers.CreateModePointInTimeRestore), + string(servers.CreateModeDefault), + string(servers.CreateModePointInTimeRestore), }, false), }, @@ -144,7 +140,7 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ForceNew: true, - ValidateFunc: validate.FlexibleServerID, + ValidateFunc: servers.ValidateFlexibleServerID, }, "maintenance_window": { @@ -201,7 +197,7 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(postgresqlflexibleservers.HighAvailabilityModeZoneRedundant), + string(servers.HighAvailabilityModeZoneRedundant), }, false), }, @@ -220,7 +216,7 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -234,21 +230,21 @@ func resourcePostgresqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta inte name := d.Get("name").(string) resourceGroup := d.Get("resource_group_name").(string) - id := parse.NewFlexibleServerID(subscriptionId, resourceGroup, name) + id := servers.NewFlexibleServerID(subscriptionId, resourceGroup, name) - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for present of existing Postgresql Flexible Server %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_postgresql_flexible_server", id.ID()) } createMode := d.Get("create_mode").(string) - if postgresqlflexibleservers.CreateMode(createMode) == postgresqlflexibleservers.CreateModePointInTimeRestore { + if servers.CreateMode(createMode) == servers.CreateModePointInTimeRestore { if _, ok := d.GetOk("source_server_id"); !ok { return fmt.Errorf("`source_server_id` is required when `create_mode` is `PointInTimeRestore`") } @@ -257,7 +253,7 @@ func resourcePostgresqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta inte } } - if createMode == "" || postgresqlflexibleservers.CreateMode(createMode) == postgresqlflexibleservers.CreateModeDefault { + if createMode == "" || servers.CreateMode(createMode) == servers.CreateModeDefault { if _, ok := d.GetOk("administrator_login"); !ok { return fmt.Errorf("`administrator_login` is required when `create_mode` is `Default`") } @@ -277,15 +273,18 @@ func resourcePostgresqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta inte sku, err := expandFlexibleServerSku(d.Get("sku_name").(string)) if err != nil { - return fmt.Errorf("expanding `sku_name` for PostgreSQL Flexible Server %s (Resource Group %q): %v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("expanding `sku_name` for %s: %v", id, err) } - parameters := postgresqlflexibleservers.Server{ - Location: utils.String(location.Normalize(d.Get("location").(string))), - ServerProperties: &postgresqlflexibleservers.ServerProperties{ - CreateMode: postgresqlflexibleservers.CreateMode(d.Get("create_mode").(string)), + createModeAttr := servers.CreateMode(createMode) + version := servers.ServerVersion(d.Get("version").(string)) + + parameters := servers.Server{ + Location: location.Normalize(d.Get("location").(string)), + Properties: &servers.ServerProperties{ + CreateMode: &createModeAttr, Network: expandArmServerNetwork(d), - Version: postgresqlflexibleservers.ServerVersion(d.Get("version").(string)), + Version: &version, Storage: expandArmServerStorage(d), HighAvailability: expandFlexibleServerHighAvailability(d.Get("high_availability").([]interface{}), true), Backup: expandArmServerBackup(d), @@ -295,19 +294,19 @@ func resourcePostgresqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta inte } if v, ok := d.GetOk("administrator_login"); ok && v.(string) != "" { - parameters.ServerProperties.AdministratorLogin = utils.String(v.(string)) + parameters.Properties.AdministratorLogin = utils.String(v.(string)) } if v, ok := d.GetOk("administrator_password"); ok && v.(string) != "" { - parameters.ServerProperties.AdministratorLoginPassword = utils.String(v.(string)) + parameters.Properties.AdministratorLoginPassword = utils.String(v.(string)) } if v, ok := d.GetOk("zone"); ok && v.(string) != "" { - parameters.ServerProperties.AvailabilityZone = utils.String(v.(string)) + parameters.Properties.AvailabilityZone = utils.String(v.(string)) } if v, ok := d.GetOk("source_server_id"); ok && v.(string) != "" { - parameters.SourceServerResourceID = utils.String(v.(string)) + parameters.Properties.SourceServerResourceId = utils.String(v.(string)) } pointInTimeUTC := d.Get("point_in_time_restore_time_in_utc").(string) @@ -316,32 +315,22 @@ func resourcePostgresqlFlexibleServerCreate(d *pluginsdk.ResourceData, meta inte if err != nil { return fmt.Errorf("unable to parse `point_in_time_restore_time_in_utc` value") } - parameters.ServerProperties.PointInTimeUTC = &date.Time{Time: v} + parameters.Properties.PointInTimeUTC = utils.String(v.String()) } - future, err := client.Create(ctx, id.ResourceGroup, id.Name, parameters) - if err != nil { - return fmt.Errorf("creating Postgresql Flexible Server %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of the Postgresql Flexible Server %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err = client.CreateThenPoll(ctx, id, parameters); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } // `maintenance_window` could only be updated with, could not be created with if v, ok := d.GetOk("maintenance_window"); ok { - mwParams := postgresqlflexibleservers.ServerForUpdate{ - ServerPropertiesForUpdate: &postgresqlflexibleservers.ServerPropertiesForUpdate{ + mwParams := servers.ServerForUpdate{ + Properties: &servers.ServerPropertiesForUpdate{ MaintenanceWindow: expandArmServerMaintenanceWindow(v.([]interface{})), }, } - mwFuture, err := client.Update(ctx, id.ResourceGroup, id.Name, mwParams) - if err != nil { - return fmt.Errorf("updating Postgresql Flexible Server %q maintenance window (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - - if err := mwFuture.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the update of the Postgresql Flexible Server %q maintenance window (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err = client.UpdateThenPoll(ctx, id, mwParams); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) } } @@ -355,63 +344,78 @@ func resourcePostgresqlFlexibleServerRead(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FlexibleServerID(d.Id()) + id, err := servers.ParseFlexibleServerID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] Postgresql Flexibleserver %q does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("retrieving Postgresql Flexible Server %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.ServerName) + d.Set("resource_group_name", id.ResourceGroupName) - if props := resp.ServerProperties; props != nil { - d.Set("administrator_login", props.AdministratorLogin) - d.Set("zone", props.AvailabilityZone) - d.Set("version", props.Version) - d.Set("fqdn", props.FullyQualifiedDomainName) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) - if network := props.Network; network != nil { - d.Set("public_network_access_enabled", network.PublicNetworkAccess == postgresqlflexibleservers.ServerPublicNetworkAccessStateEnabled) - d.Set("delegated_subnet_id", network.DelegatedSubnetResourceID) - d.Set("private_dns_zone_id", network.PrivateDNSZoneArmResourceID) - } + if props := model.Properties; props != nil { + d.Set("administrator_login", props.AdministratorLogin) + d.Set("zone", props.AvailabilityZone) + d.Set("version", props.Version) + d.Set("fqdn", props.FullyQualifiedDomainName) - if err := d.Set("maintenance_window", flattenArmServerMaintenanceWindow(props.MaintenanceWindow)); err != nil { - return fmt.Errorf("setting `maintenance_window`: %+v", err) - } + if network := props.Network; network != nil { + publicNetworkAccess := false + if network.PublicNetworkAccess != nil { + publicNetworkAccess = *network.PublicNetworkAccess == servers.ServerPublicNetworkAccessStateEnabled + } + d.Set("public_network_access_enabled", publicNetworkAccess) + d.Set("delegated_subnet_id", network.DelegatedSubnetResourceId) + d.Set("private_dns_zone_id", network.PrivateDnsZoneArmResourceId) + } - if storage := props.Storage; storage != nil && storage.StorageSizeGB != nil { - d.Set("storage_mb", (*storage.StorageSizeGB * 1024)) - } + if err := d.Set("maintenance_window", flattenArmServerMaintenanceWindow(props.MaintenanceWindow)); err != nil { + return fmt.Errorf("setting `maintenance_window`: %+v", err) + } + + if storage := props.Storage; storage != nil && storage.StorageSizeGB != nil { + d.Set("storage_mb", (*storage.StorageSizeGB * 1024)) + } - if backup := props.Backup; backup != nil { - d.Set("backup_retention_days", backup.BackupRetentionDays) - d.Set("geo_redundant_backup_enabled", backup.GeoRedundantBackup == postgresqlflexibleservers.GeoRedundantBackupEnumEnabled) + if backup := props.Backup; backup != nil { + d.Set("backup_retention_days", backup.BackupRetentionDays) + + geoRedundantBackup := false + if backup.GeoRedundantBackup != nil { + geoRedundantBackup = *backup.GeoRedundantBackup == servers.GeoRedundantBackupEnumEnabled + } + d.Set("geo_redundant_backup_enabled", geoRedundantBackup) + } + + if err := d.Set("high_availability", flattenFlexibleServerHighAvailability(props.HighAvailability)); err != nil { + return fmt.Errorf("setting `high_availability`: %+v", err) + } } - if err := d.Set("high_availability", flattenFlexibleServerHighAvailability(props.HighAvailability)); err != nil { - return fmt.Errorf("setting `high_availability`: %+v", err) + sku, err := flattenFlexibleServerSku(model.Sku) + if err != nil { + return fmt.Errorf("flattening `sku_name` for %s: %v", id, err) } - } - sku, err := flattenFlexibleServerSku(resp.Sku) - if err != nil { - return fmt.Errorf("flattening `sku_name` for PostgreSQL Flexible Server %s (Resource Group %q): %v", id.Name, id.ResourceGroup, err) - } + d.Set("sku_name", sku) - d.Set("sku_name", sku) + return tags.FlattenAndSet(d, model.Tags) - return tags.FlattenAndSet(d, resp.Tags) + } + + return nil } func resourcePostgresqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta interface{}) error { @@ -419,24 +423,24 @@ func resourcePostgresqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FlexibleServerID(d.Id()) + id, err := servers.ParseFlexibleServerID(d.Id()) if err != nil { return err } - parameters := postgresqlflexibleservers.ServerForUpdate{ - Location: utils.String(location.Normalize(d.Get("location").(string))), - ServerPropertiesForUpdate: &postgresqlflexibleservers.ServerPropertiesForUpdate{}, + parameters := servers.ServerForUpdate{ + Location: utils.String(location.Normalize(d.Get("location").(string))), + Properties: &servers.ServerPropertiesForUpdate{}, } var requireFailover bool // failover is only supported when `zone` and `high_availability.0.standby_availability_zone` are exchanged with each other if d.HasChanges("zone", "high_availability") { - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) - if err != nil { + resp, err := client.Get(ctx, *id) + if err != nil || resp.Model == nil { return err } - props := resp.ServerProperties + props := resp.Model.Properties if d.HasChange("zone") { @@ -460,9 +464,9 @@ func resourcePostgresqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta inte // changes can occur in high_availability.0.standby_availability_zone when zone has not changed in the case where a high_availability block has been newly added or a high_availability block is removed, meaning HA is now disabled } else if d.HasChange("high_availability.0.standby_availability_zone") { - if props != nil && props.HighAvailability != nil { + if props != nil && props.HighAvailability != nil && props.HighAvailability.Mode != nil { // if HA Mode is currently "ZoneRedundant" and is still set to "ZoneRedundant", high_availability.0.standby_availability_zone cannot be changed - if props.HighAvailability.Mode == postgresqlflexibleservers.HighAvailabilityModeZoneRedundant && !d.HasChange("high_availability.0.mode") { + if *props.HighAvailability.Mode == servers.HighAvailabilityModeZoneRedundant && !d.HasChange("high_availability.0.mode") { return fmt.Errorf("an existing `high_availability.0.standby_availability_zone` can only be changed when exchanged with the zone specified in `zone`") } // if high_availability.0.mode changes from "ZoneRedundant", an existing high_availability block has been removed as this is a required field @@ -472,25 +476,25 @@ func resourcePostgresqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta inte } if d.HasChange("administrator_password") { - parameters.ServerPropertiesForUpdate.AdministratorLoginPassword = utils.String(d.Get("administrator_password").(string)) + parameters.Properties.AdministratorLoginPassword = utils.String(d.Get("administrator_password").(string)) } if d.HasChange("storage_mb") { - parameters.ServerPropertiesForUpdate.Storage = expandArmServerStorage(d) + parameters.Properties.Storage = expandArmServerStorage(d) } if d.HasChange("backup_retention_days") { - parameters.ServerPropertiesForUpdate.Backup = expandArmServerBackup(d) + parameters.Properties.Backup = expandArmServerBackup(d) } if d.HasChange("maintenance_window") { - parameters.ServerPropertiesForUpdate.MaintenanceWindow = expandArmServerMaintenanceWindow(d.Get("maintenance_window").([]interface{})) + parameters.Properties.MaintenanceWindow = expandArmServerMaintenanceWindow(d.Get("maintenance_window").([]interface{})) } if d.HasChange("sku_name") { sku, err := expandFlexibleServerSku(d.Get("sku_name").(string)) if err != nil { - return fmt.Errorf("expanding `sku_name` for PostgreSQL Flexible Server %s (Resource Group %q): %v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("expanding `sku_name` for %s: %v", id, err) } parameters.Sku = sku } @@ -500,32 +504,26 @@ func resourcePostgresqlFlexibleServerUpdate(d *pluginsdk.ResourceData, meta inte } if d.HasChange("high_availability") { - parameters.HighAvailability = expandFlexibleServerHighAvailability(d.Get("high_availability").([]interface{}), false) - } - - future, err := client.Update(ctx, id.ResourceGroup, id.Name, parameters) - if err != nil { - return fmt.Errorf("updating Postgresql Flexible Server %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + parameters.Properties.HighAvailability = expandFlexibleServerHighAvailability(d.Get("high_availability").([]interface{}), false) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the update of the Postgresql Flexible Server %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err = client.UpdateThenPoll(ctx, *id, parameters); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) } if requireFailover { - restartParameters := &postgresqlflexibleservers.RestartParameter{ + restartClient := meta.(*clients.Client).Postgres.ServerRestartClient + + restartServerId := serverrestart.NewFlexibleServerID(id.SubscriptionId, id.ResourceGroupName, id.ServerName) + failoverMode := serverrestart.FailoverModePlannedFailover + restartParameters := serverrestart.RestartParameter{ RestartWithFailover: utils.Bool(true), - FailoverMode: postgresqlflexibleservers.FailoverModePlannedFailover, + FailoverMode: &failoverMode, } - future, err := client.Restart(ctx, id.ResourceGroup, id.Name, restartParameters) - if err != nil { + if err = restartClient.ServersRestartThenPoll(ctx, restartServerId, restartParameters); err != nil { return fmt.Errorf("failing over %s: %+v", *id, err) } - - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for failover of %s: %+v", *id, err) - } } return resourcePostgresqlFlexibleServerRead(d, meta) @@ -536,139 +534,135 @@ func resourcePostgresqlFlexibleServerDelete(d *pluginsdk.ResourceData, meta inte ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.FlexibleServerID(d.Id()) + id, err := servers.ParseFlexibleServerID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { - return fmt.Errorf("deleting Postgresql Flexible Server %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) - } - - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the deletion of the Postgresql Flexible Server %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err = client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } return nil } -func expandArmServerNetwork(d *pluginsdk.ResourceData) *postgresqlflexibleservers.Network { - network := postgresqlflexibleservers.Network{} +func expandArmServerNetwork(d *pluginsdk.ResourceData) *servers.Network { + network := servers.Network{} if v, ok := d.GetOk("delegated_subnet_id"); ok { - network.DelegatedSubnetResourceID = utils.String(v.(string)) + network.DelegatedSubnetResourceId = utils.String(v.(string)) } if v, ok := d.GetOk("private_dns_zone_id"); ok { - network.PrivateDNSZoneArmResourceID = utils.String(v.(string)) + network.PrivateDnsZoneArmResourceId = utils.String(v.(string)) } return &network } -func expandArmServerMaintenanceWindow(input []interface{}) *postgresqlflexibleservers.MaintenanceWindow { +func expandArmServerMaintenanceWindow(input []interface{}) *servers.MaintenanceWindow { if len(input) == 0 { - return &postgresqlflexibleservers.MaintenanceWindow{ + return &servers.MaintenanceWindow{ CustomWindow: utils.String(ServerMaintenanceWindowDisabled), } } v := input[0].(map[string]interface{}) - maintenanceWindow := postgresqlflexibleservers.MaintenanceWindow{ + maintenanceWindow := servers.MaintenanceWindow{ CustomWindow: utils.String(ServerMaintenanceWindowEnabled), - StartHour: utils.Int32(int32(v["start_hour"].(int))), - StartMinute: utils.Int32(int32(v["start_minute"].(int))), - DayOfWeek: utils.Int32(int32(v["day_of_week"].(int))), + StartHour: utils.Int64(int64(v["start_hour"].(int))), + StartMinute: utils.Int64(int64(v["start_minute"].(int))), + DayOfWeek: utils.Int64(int64(v["day_of_week"].(int))), } return &maintenanceWindow } -func expandArmServerStorage(d *pluginsdk.ResourceData) *postgresqlflexibleservers.Storage { - storage := postgresqlflexibleservers.Storage{} +func expandArmServerStorage(d *pluginsdk.ResourceData) *servers.Storage { + storage := servers.Storage{} if v, ok := d.GetOk("storage_mb"); ok { - storage.StorageSizeGB = utils.Int32(int32(v.(int) / 1024)) + storage.StorageSizeGB = utils.Int64(int64(v.(int) / 1024)) } return &storage } -func expandArmServerBackup(d *pluginsdk.ResourceData) *postgresqlflexibleservers.Backup { - backup := postgresqlflexibleservers.Backup{} +func expandArmServerBackup(d *pluginsdk.ResourceData) *servers.Backup { + backup := servers.Backup{} if v, ok := d.GetOk("backup_retention_days"); ok { - backup.BackupRetentionDays = utils.Int32(int32(v.(int))) + backup.BackupRetentionDays = utils.Int64(int64(v.(int))) } + geoRedundantEnabled := servers.GeoRedundantBackupEnumDisabled if geoRedundantBackupEnabled := d.Get("geo_redundant_backup_enabled").(bool); geoRedundantBackupEnabled { - backup.GeoRedundantBackup = postgresqlflexibleservers.GeoRedundantBackupEnumEnabled - } else { - backup.GeoRedundantBackup = postgresqlflexibleservers.GeoRedundantBackupEnumDisabled + geoRedundantEnabled = servers.GeoRedundantBackupEnumEnabled } + backup.GeoRedundantBackup = &geoRedundantEnabled + return &backup } -func expandFlexibleServerSku(name string) (*postgresqlflexibleservers.Sku, error) { +func expandFlexibleServerSku(name string) (*servers.Sku, error) { if name == "" { return nil, nil } parts := strings.SplitAfterN(name, "_", 2) - var tier postgresqlflexibleservers.SkuTier + var tier servers.SkuTier switch strings.TrimSuffix(parts[0], "_") { case "B": - tier = postgresqlflexibleservers.SkuTierBurstable + tier = servers.SkuTierBurstable case "GP": - tier = postgresqlflexibleservers.SkuTierGeneralPurpose + tier = servers.SkuTierGeneralPurpose case "MO": - tier = postgresqlflexibleservers.SkuTierMemoryOptimized + tier = servers.SkuTierMemoryOptimized default: return nil, fmt.Errorf("sku_name %s has unknown sku tier %s", name, parts[0]) } - return &postgresqlflexibleservers.Sku{ - Name: utils.String(parts[1]), + return &servers.Sku{ + Name: parts[1], Tier: tier, }, nil } -func flattenFlexibleServerSku(sku *postgresqlflexibleservers.Sku) (string, error) { - if sku == nil || sku.Name == nil || sku.Tier == "" { +func flattenFlexibleServerSku(sku *servers.Sku) (string, error) { + if sku == nil || sku.Tier == "" { return "", nil } var tier string switch sku.Tier { - case postgresqlflexibleservers.SkuTierBurstable: + case servers.SkuTierBurstable: tier = "B" - case postgresqlflexibleservers.SkuTierGeneralPurpose: + case servers.SkuTierGeneralPurpose: tier = "GP" - case postgresqlflexibleservers.SkuTierMemoryOptimized: + case servers.SkuTierMemoryOptimized: tier = "MO" default: return "", fmt.Errorf("sku_name has unknown sku tier %s", sku.Tier) } - return strings.Join([]string{tier, *sku.Name}, "_"), nil + return strings.Join([]string{tier, sku.Name}, "_"), nil } -func flattenArmServerMaintenanceWindow(input *postgresqlflexibleservers.MaintenanceWindow) []interface{} { - if input == nil || input.CustomWindow == nil || *input.CustomWindow == string(ServerMaintenanceWindowDisabled) { +func flattenArmServerMaintenanceWindow(input *servers.MaintenanceWindow) []interface{} { + if input == nil || input.CustomWindow == nil || *input.CustomWindow == ServerMaintenanceWindowDisabled { return make([]interface{}, 0) } - var dayOfWeek int32 + var dayOfWeek int64 if input.DayOfWeek != nil { dayOfWeek = *input.DayOfWeek } - var startHour int32 + var startHour int64 if input.StartHour != nil { startHour = *input.StartHour } - var startMinute int32 + var startMinute int64 if input.StartMinute != nil { startMinute = *input.StartMinute } @@ -681,17 +675,19 @@ func flattenArmServerMaintenanceWindow(input *postgresqlflexibleservers.Maintena } } -func expandFlexibleServerHighAvailability(inputs []interface{}, isCreate bool) *postgresqlflexibleservers.HighAvailability { +func expandFlexibleServerHighAvailability(inputs []interface{}, isCreate bool) *servers.HighAvailability { if len(inputs) == 0 || inputs[0] == nil { - return &postgresqlflexibleservers.HighAvailability{ - Mode: postgresqlflexibleservers.HighAvailabilityModeDisabled, + highAvailability := servers.HighAvailabilityModeDisabled + return &servers.HighAvailability{ + Mode: &highAvailability, } } input := inputs[0].(map[string]interface{}) - result := postgresqlflexibleservers.HighAvailability{ - Mode: postgresqlflexibleservers.HighAvailabilityMode(input["mode"].(string)), + mode := servers.HighAvailabilityMode(input["mode"].(string)) + result := servers.HighAvailability{ + Mode: &mode, } // service team confirmed it doesn't support to update `high_availability.0.standby_availability_zone` after the PostgreSQL Flexible Server resource is created @@ -704,8 +700,8 @@ func expandFlexibleServerHighAvailability(inputs []interface{}, isCreate bool) * return &result } -func flattenFlexibleServerHighAvailability(ha *postgresqlflexibleservers.HighAvailability) []interface{} { - if ha == nil || ha.Mode == postgresqlflexibleservers.HighAvailabilityModeDisabled { +func flattenFlexibleServerHighAvailability(ha *servers.HighAvailability) []interface{} { + if ha == nil || ha.Mode == nil || *ha.Mode == servers.HighAvailabilityModeDisabled { return []interface{}{} } @@ -716,7 +712,7 @@ func flattenFlexibleServerHighAvailability(ha *postgresqlflexibleservers.HighAva return []interface{}{ map[string]interface{}{ - "mode": string(ha.Mode), + "mode": string(*ha.Mode), "standby_availability_zone": zone, }, } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_server_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_server_data_source.go index 684e8007767..a4787299d11 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_server_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_server_data_source.go @@ -4,14 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourcePostgreSqlServer() *pluginsdk.Resource { @@ -57,7 +58,7 @@ func dataSourcePostgreSqlServer() *pluginsdk.Resource { "identity": commonschema.SystemAssignedIdentityComputed(), - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -68,10 +69,10 @@ func dataSourcePostgreSqlServerRead(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := servers.NewServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } @@ -79,23 +80,26 @@ func dataSourcePostgreSqlServerRead(d *pluginsdk.ResourceData, meta interface{}) } d.SetId(id.ID()) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } - if err := d.Set("identity", flattenServerIdentity(resp.Identity)); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) - } + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) - if props := resp.ServerProperties; props != nil { - d.Set("fqdn", props.FullyQualifiedDomainName) - d.Set("version", props.Version) - d.Set("administrator_login", props.AdministratorLogin) - } + if err := d.Set("identity", identity.FlattenSystemAssigned(model.Identity)); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } + + if props := model.Properties; props != nil { + d.Set("fqdn", props.FullyQualifiedDomainName) + d.Set("version", props.Version) + d.Set("administrator_login", props.AdministratorLogin) + } + + if sku := model.Sku; sku != nil { + d.Set("sku_name", sku.Name) + } - if sku := resp.Sku; sku != nil { - d.Set("sku_name", sku.Name) + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_server_key_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_server_key_resource.go index c44038a3d35..1d54ce9cd31 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_server_key_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_server_key_resource.go @@ -6,15 +6,14 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/client" keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" resourcesClient "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/client" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -29,7 +28,7 @@ func resourcePostgreSQLServerKey() *pluginsdk.Resource { Delete: resourcePostgreSQLServerKeyDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ServerKeyID(id) + _, err := serverkeys.ParseKeyID(id) return err }), @@ -45,7 +44,7 @@ func resourcePostgreSQLServerKey() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ServerID, + ValidateFunc: serverkeys.ValidateServerID, }, "key_vault_key_id": { @@ -84,31 +83,31 @@ func resourcePostgreSQLServerKeyCreateUpdate(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - serverId, err := parse.ServerID(d.Get("server_id").(string)) + serverId, err := serverkeys.ParseServerID(d.Get("server_id").(string)) if err != nil { return err } keyVaultKeyURI := d.Get("key_vault_key_id").(string) name, err := getPostgreSQLServerKeyName(ctx, keyVaultsClient, resourcesClient, keyVaultKeyURI) if err != nil { - return fmt.Errorf("cannot compose name for PostgreSQL Server Key (Resource Group %q / Server %q): %+v", serverId.ResourceGroup, serverId.Name, err) + return fmt.Errorf("cannot compose name for %s: %+v", serverId, err) } - locks.ByName(serverId.Name, postgreSQLServerResourceName) - defer locks.UnlockByName(serverId.Name, postgreSQLServerResourceName) + locks.ByName(serverId.ServerName, postgreSQLServerResourceName) + defer locks.UnlockByName(serverId.ServerName, postgreSQLServerResourceName) if d.IsNewResource() { // This resource is a singleton, but its name can be anything. // If you create a new key with different name with the old key, the service will not give you any warning but directly replace the old key with the new key. // Therefore sometimes you cannot get the old key using the GET API since you may not know the name of the old key - resp, err := keysClient.List(ctx, serverId.ResourceGroup, serverId.Name) + resp, err := keysClient.List(ctx, *serverId) if err != nil { - return fmt.Errorf("listing existing PostgreSQL Server Keys in Resource Group %q / Server %q: %+v", serverId.ResourceGroup, serverId.Name, err) + return fmt.Errorf("listing existing Keys in %s: %+v", serverId, err) } - keys := resp.Values() - if len(keys) >= 1 { - if rawId := keys[0].ID; rawId != nil && *rawId != "" { - id, err := parse.ServerKeyID(*rawId) + if resp.Model != nil && len(*resp.Model) >= 1 { + keys := *resp.Model + if rawId := keys[0].Id; rawId != nil && *rawId != "" { + id, err := serverkeys.ParseKeyID(*rawId) if err != nil { return fmt.Errorf("parsing existing Server Key ID %q: %+v", *rawId, err) } @@ -118,21 +117,17 @@ func resourcePostgreSQLServerKeyCreateUpdate(d *pluginsdk.ResourceData, meta int } } - param := postgresql.ServerKey{ - ServerKeyProperties: &postgresql.ServerKeyProperties{ - ServerKeyType: utils.String("AzureKeyVault"), - URI: utils.String(d.Get("key_vault_key_id").(string)), + param := serverkeys.ServerKey{ + Properties: &serverkeys.ServerKeyProperties{ + ServerKeyType: serverkeys.ServerKeyTypeAzureKeyVault, + Uri: utils.String(d.Get("key_vault_key_id").(string)), }, } - id := parse.NewServerKeyID(serverId.SubscriptionId, serverId.ResourceGroup, serverId.Name, *name) - future, err := keysClient.CreateOrUpdate(ctx, id.ServerName, id.KeyName, param, id.ResourceGroup) - if err != nil { + id := serverkeys.NewKeyID(serverId.SubscriptionId, serverId.ResourceGroupName, serverId.ServerName, *name) + if err = keysClient.CreateOrUpdateThenPoll(ctx, id, param); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, keysClient.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) - } d.SetId(id.ID()) return resourcePostgreSQLServerKeyRead(d, meta) @@ -143,14 +138,14 @@ func resourcePostgreSQLServerKeyRead(d *pluginsdk.ResourceData, meta interface{} ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ServerKeyID(d.Id()) + id, err := serverkeys.ParseKeyID(d.Id()) if err != nil { return err } - resp, err := keysClient.Get(ctx, id.ResourceGroup, id.ServerName, id.KeyName) + resp, err := keysClient.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[WARN] %s was not found - removing from state", *id) d.SetId("") return nil @@ -159,9 +154,9 @@ func resourcePostgreSQLServerKeyRead(d *pluginsdk.ResourceData, meta interface{} return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("server_id", parse.NewServerID(id.SubscriptionId, id.ResourceGroup, id.ServerName).ID()) - if props := resp.ServerKeyProperties; props != nil { - d.Set("key_vault_key_id", props.URI) + d.Set("server_id", serverkeys.NewServerID(id.SubscriptionId, id.ResourceGroupName, id.ServerName).ID()) + if resp.Model != nil && resp.Model.Properties != nil { + d.Set("key_vault_key_id", resp.Model.Properties.Uri) } return nil @@ -172,7 +167,7 @@ func resourcePostgreSQLServerKeyDelete(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ServerKeyID(d.Id()) + id, err := serverkeys.ParseKeyID(d.Id()) if err != nil { return err } @@ -180,13 +175,9 @@ func resourcePostgreSQLServerKeyDelete(d *pluginsdk.ResourceData, meta interface locks.ByName(id.ServerName, postgreSQLServerResourceName) defer locks.UnlockByName(id.ServerName, postgreSQLServerResourceName) - future, err := client.Delete(ctx, id.ServerName, id.KeyName, id.ResourceGroup) - if err != nil { + if err = client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_server_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_server_resource.go index 7df6d83f677..d65cb06779f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_server_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_server_resource.go @@ -8,18 +8,21 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql" - "github.com/Azure/go-autorest/autorest/date" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/migration" + + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -61,30 +64,34 @@ func resourcePostgreSQLServer() *pluginsdk.Resource { Delete: resourcePostgreSQLServerDelete, Importer: pluginsdk.ImporterValidatingResourceIdThen(func(id string) error { - _, err := parse.ServerID(id) + _, err := servers.ParseServerID(id) return err }, func(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) ([]*pluginsdk.ResourceData, error) { client := meta.(*clients.Client).Postgres.ServersClient - id, err := parse.ServerID(d.Id()) + id, err := servers.ParseServerID(d.Id()) if err != nil { return []*pluginsdk.ResourceData{d}, err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - return []*pluginsdk.ResourceData{d}, fmt.Errorf("reading PostgreSQL Server %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return []*pluginsdk.ResourceData{d}, fmt.Errorf("reading %s: %+v", id, err) } d.Set("create_mode", "Default") - if resp.ReplicationRole != nil && *resp.ReplicationRole != "Master" && *resp.ReplicationRole != "None" { - d.Set("create_mode", resp.ReplicationRole) - - sourceServerId, err := parse.ServerID(*resp.MasterServerID) - if err != nil { - return []*pluginsdk.ResourceData{d}, fmt.Errorf("parsing Postgres Main Server ID : %v", err) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + if props.ReplicationRole != nil && *props.ReplicationRole != "Master" && *props.ReplicationRole != "None" { + d.Set("create_mode", props.ReplicationRole) + + sourceServerId, err := servers.ParseServerID(*props.MasterServerId) + if err != nil { + return []*pluginsdk.ResourceData{d}, fmt.Errorf("parsing Postgres Main Server ID : %v", err) + } + d.Set("creation_source_server_id", sourceServerId.ID()) + } } - d.Set("creation_source_server_id", sourceServerId.ID()) } return []*pluginsdk.ResourceData{d}, nil @@ -97,6 +104,11 @@ func resourcePostgreSQLServer() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(60 * time.Minute), }, + SchemaVersion: 1, + StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ + 0: migration.PostgresqlServerV0ToV1{}, + }), + Schema: map[string]*pluginsdk.Schema{ "name": { Type: pluginsdk.TypeString, @@ -116,16 +128,10 @@ func resourcePostgreSQLServer() *pluginsdk.Resource { }, "version": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - string(postgresql.NineFullStopFive), - string(postgresql.NineFullStopSix), - string(postgresql.OneOne), - string(postgresql.OneZero), - string(postgresql.OneZeroFullStopZero), - }, false), + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(servers.PossibleValuesForServerVersion(), false), }, "administrator_login": { @@ -163,21 +169,16 @@ func resourcePostgreSQLServer() *pluginsdk.Resource { }, "create_mode": { - Type: pluginsdk.TypeString, - Optional: true, - Default: string(postgresql.CreateModeDefault), - ValidateFunc: validation.StringInSlice([]string{ - string(postgresql.CreateModeDefault), - string(postgresql.CreateModeGeoRestore), - string(postgresql.CreateModePointInTimeRestore), - string(postgresql.CreateModeReplica), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + Default: string(servers.CreateModeDefault), + ValidateFunc: validation.StringInSlice(servers.PossibleValuesForCreateMode(), false), }, "creation_source_server_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: validate.ServerID, + ValidateFunc: servers.ValidateServerID, }, "identity": commonschema.SystemAssignedIdentityOptional(), @@ -211,15 +212,10 @@ func resourcePostgreSQLServer() *pluginsdk.Resource { }, "ssl_minimal_tls_version_enforced": { - Type: pluginsdk.TypeString, - Optional: true, - Default: string(postgresql.TLS12), - ValidateFunc: validation.StringInSlice([]string{ - string(postgresql.TLSEnforcementDisabled), - string(postgresql.TLS10), - string(postgresql.TLS11), - string(postgresql.TLS12), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + Default: string(servers.MinimalTlsVersionEnumTLSOneTwo), + ValidateFunc: validation.StringInSlice(servers.PossibleValuesForMinimalTlsVersionEnum(), false), }, "ssl_enforcement_enabled": { @@ -331,7 +327,7 @@ func resourcePostgreSQLServer() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, CustomizeDiff: pluginsdk.CustomDiffWithAll( @@ -349,10 +345,10 @@ func resourcePostgreSQLServer() *pluginsdk.Resource { return false }), pluginsdk.ForceNewIfChange("create_mode", func(ctx context.Context, old, new, meta interface{}) bool { - oldMode := postgresql.CreateMode(old.(string)) - newMode := postgresql.CreateMode(new.(string)) + oldMode := servers.CreateMode(old.(string)) + newMode := servers.CreateMode(new.(string)) // Instance could not be changed from Default to Replica - if oldMode == postgresql.CreateModeDefault && newMode == postgresql.CreateModeReplica { + if oldMode == servers.CreateModeDefault && newMode == servers.CreateModeReplica { return true } return false @@ -370,52 +366,51 @@ func resourcePostgreSQLServerCreate(d *pluginsdk.ResourceData, meta interface{}) log.Printf("[INFO] preparing arguments for AzureRM PostgreSQL Server creation.") - id := parse.NewServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := servers.NewServerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_postgresql_server", id.ID()) } - mode := postgresql.CreateMode(d.Get("create_mode").(string)) + mode := servers.CreateMode(d.Get("create_mode").(string)) source := d.Get("creation_source_server_id").(string) - version := postgresql.ServerVersion(d.Get("version").(string)) + version := servers.ServerVersion(d.Get("version").(string)) sku, err := expandServerSkuName(d.Get("sku_name").(string)) if err != nil { return fmt.Errorf("expanding `sku_name`: %+v", err) } - infraEncrypt := postgresql.InfrastructureEncryptionEnabled + infraEncrypt := servers.InfrastructureEncryptionEnabled if v := d.Get("infrastructure_encryption_enabled"); !v.(bool) { - infraEncrypt = postgresql.InfrastructureEncryptionDisabled + infraEncrypt = servers.InfrastructureEncryptionDisabled } - publicAccess := postgresql.PublicNetworkAccessEnumEnabled + publicAccess := servers.PublicNetworkAccessEnumEnabled if v := d.Get("public_network_access_enabled"); !v.(bool) { - publicAccess = postgresql.PublicNetworkAccessEnumDisabled + publicAccess = servers.PublicNetworkAccessEnumDisabled } - ssl := postgresql.SslEnforcementEnumEnabled + ssl := servers.SslEnforcementEnumEnabled if v := d.Get("ssl_enforcement_enabled"); !v.(bool) { - ssl = postgresql.SslEnforcementEnumDisabled + ssl = servers.SslEnforcementEnumDisabled } - tlsMin := postgresql.MinimalTLSVersionEnum(d.Get("ssl_minimal_tls_version_enforced").(string)) - if ssl == postgresql.SslEnforcementEnumDisabled && tlsMin != postgresql.TLSEnforcementDisabled { + tlsMin := servers.MinimalTlsVersionEnum(d.Get("ssl_minimal_tls_version_enforced").(string)) + if ssl == servers.SslEnforcementEnumDisabled && tlsMin != servers.MinimalTlsVersionEnumTLSEnforcementDisabled { return fmt.Errorf("`ssl_minimal_tls_version_enforced` must be set to `TLSEnforcementDisabled` if `ssl_enforcement_enabled` is set to `false`") } storage := expandPostgreSQLStorageProfile(d) - - var props postgresql.BasicServerPropertiesForCreate + var props servers.ServerPropertiesForCreate switch mode { - case postgresql.CreateModeDefault: + case servers.CreateModeDefault: admin := d.Get("administrator_login").(string) pass := d.Get("administrator_login_password").(string) if admin == "" { @@ -430,89 +425,77 @@ func resourcePostgreSQLServerCreate(d *pluginsdk.ResourceData, meta interface{}) } // check admin - props = &postgresql.ServerPropertiesForDefaultCreate{ - AdministratorLogin: &admin, - AdministratorLoginPassword: &pass, - CreateMode: mode, - InfrastructureEncryption: infraEncrypt, - PublicNetworkAccess: publicAccess, - MinimalTLSVersion: tlsMin, - SslEnforcement: ssl, + props = servers.ServerPropertiesForDefaultCreate{ + AdministratorLogin: admin, + AdministratorLoginPassword: pass, + InfrastructureEncryption: &infraEncrypt, + PublicNetworkAccess: &publicAccess, + MinimalTlsVersion: &tlsMin, + SslEnforcement: &ssl, StorageProfile: storage, - Version: version, + Version: &version, } - case postgresql.CreateModePointInTimeRestore: + case servers.CreateModePointInTimeRestore: v, ok := d.GetOk("restore_point_in_time") if !ok || v.(string) == "" { return fmt.Errorf("restore_point_in_time must be set when create_mode is PointInTimeRestore") } - time, _ := time.Parse(time.RFC3339, v.(string)) // should be validated by the schema // d.GetOk cannot identify whether user sets the property that is bool type and has default value. So it has to identify it using `d.GetRawConfig()` if v := d.GetRawConfig().AsValueMap()["public_network_access_enabled"]; !v.IsNull() { return fmt.Errorf("`public_network_access_enabled` doesn't support PointInTimeRestore mode") } - props = &postgresql.ServerPropertiesForRestore{ - CreateMode: mode, - SourceServerID: &source, - RestorePointInTime: &date.Time{ - Time: time, - }, - InfrastructureEncryption: infraEncrypt, - MinimalTLSVersion: tlsMin, - SslEnforcement: ssl, + props = &servers.ServerPropertiesForRestore{ + SourceServerId: source, + RestorePointInTime: v.(string), + InfrastructureEncryption: &infraEncrypt, + MinimalTlsVersion: &tlsMin, + SslEnforcement: &ssl, StorageProfile: storage, - Version: version, - } - case postgresql.CreateModeGeoRestore: - props = &postgresql.ServerPropertiesForGeoRestore{ - CreateMode: mode, - SourceServerID: &source, - InfrastructureEncryption: infraEncrypt, - PublicNetworkAccess: publicAccess, - MinimalTLSVersion: tlsMin, - SslEnforcement: ssl, + Version: &version, + } + case servers.CreateModeGeoRestore: + props = &servers.ServerPropertiesForGeoRestore{ + SourceServerId: source, + InfrastructureEncryption: &infraEncrypt, + PublicNetworkAccess: &publicAccess, + MinimalTlsVersion: &tlsMin, + SslEnforcement: &ssl, StorageProfile: storage, - Version: version, + Version: &version, } - case postgresql.CreateModeReplica: - props = &postgresql.ServerPropertiesForReplica{ - CreateMode: mode, - SourceServerID: &source, - InfrastructureEncryption: infraEncrypt, - PublicNetworkAccess: publicAccess, - MinimalTLSVersion: tlsMin, - SslEnforcement: ssl, - Version: version, + case servers.CreateModeReplica: + props = &servers.ServerPropertiesForReplica{ + SourceServerId: source, + InfrastructureEncryption: &infraEncrypt, + PublicNetworkAccess: &publicAccess, + MinimalTlsVersion: &tlsMin, + SslEnforcement: &ssl, + Version: &version, } } - expandedIdentity, err := expandServerIdentity(d.Get("identity").([]interface{})) + expandedIdentity, err := identity.ExpandSystemAssigned(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } - server := postgresql.ServerForCreate{ + server := servers.ServerForCreate{ Identity: expandedIdentity, - Location: utils.String(location.Normalize(d.Get("location").(string))), + Location: location.Normalize(d.Get("location").(string)), Properties: props, Sku: sku, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.Create(ctx, id.ResourceGroup, id.Name, server) - if err != nil { + if err = client.CreateThenPoll(ctx, id, server); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - log.Printf("[DEBUG] Waiting for %s to become available", id) stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{string(postgresql.ServerStateInaccessible)}, - Target: []string{string(postgresql.ServerStateReady)}, + Pending: []string{string(servers.ServerStateInaccessible)}, + Target: []string{string(servers.ServerStateReady)}, Refresh: postgreSqlStateRefreshFunc(ctx, client, id), MinTimeout: 15 * time.Second, Timeout: d.Timeout(pluginsdk.TimeoutCreate), @@ -525,36 +508,28 @@ func resourcePostgreSQLServerCreate(d *pluginsdk.ResourceData, meta interface{}) d.SetId(id.ID()) if v, ok := d.GetOk("threat_detection_policy"); ok { + securityAlertId := serversecurityalertpolicies.NewServerID(id.SubscriptionId, id.ResourceGroupName, id.ServerName) alert := expandSecurityAlertPolicy(v) if alert != nil { - future, err := securityClient.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, *alert) - if err != nil { + if err = securityClient.CreateOrUpdateThenPoll(ctx, securityAlertId, *alert); err != nil { return fmt.Errorf("updataing security alert policy for %s: %v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of security alert policy for %s: %+v", id, err) - } } } // Issue tracking the REST API update failure: https://github.com/Azure/azure-rest-api-specs/issues/14117 - if mode == postgresql.CreateModeReplica { + if mode == servers.CreateModeReplica { log.Printf("[INFO] updating `public_network_access_enabled` for %s", id) - properties := postgresql.ServerUpdateParameters{ - ServerUpdateParametersProperties: &postgresql.ServerUpdateParametersProperties{ - PublicNetworkAccess: publicAccess, + properties := servers.ServerUpdateParameters{ + Properties: &servers.ServerUpdateParametersProperties{ + PublicNetworkAccess: &publicAccess, }, } - future, err := client.Update(ctx, id.ResourceGroup, id.Name, properties) - if err != nil { + if err = client.UpdateThenPoll(ctx, id, properties); err != nil { return fmt.Errorf("updating Public Network Access for Replica %q: %+v", id, err) } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of Public Network Access for Replica %q: %+v", id, err) - } } return resourcePostgreSQLServerRead(d, meta) @@ -569,22 +544,22 @@ func resourcePostgreSQLServerUpdate(d *pluginsdk.ResourceData, meta interface{}) // TODO: support for Delta updates - id, err := parse.ServerID(d.Id()) + id, err := servers.ParseServerID(d.Id()) if err != nil { return fmt.Errorf("parsing Postgres Server ID : %v", err) } // Locks for upscaling of replicas - mode := postgresql.CreateMode(d.Get("create_mode").(string)) + mode := servers.CreateMode(d.Get("create_mode").(string)) primaryID := id.String() - if mode == postgresql.CreateModeReplica { + if mode == servers.CreateModeReplica { primaryID = d.Get("creation_source_server_id").(string) // Wait for possible restarts triggered by scaling primary (and its replicas) log.Printf("[DEBUG] Waiting for %s to become available", *id) stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{string(postgresql.ServerStateInaccessible), "Restarting"}, - Target: []string{string(postgresql.ServerStateReady)}, + Pending: []string{string(servers.ServerStateInaccessible), "Restarting"}, + Target: []string{string(servers.ServerStateReady)}, Refresh: postgreSqlStateRefreshFunc(ctx, client, *id), MinTimeout: 15 * time.Second, Timeout: d.Timeout(pluginsdk.TimeoutCreate), @@ -602,121 +577,110 @@ func resourcePostgreSQLServerUpdate(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("expanding `sku_name`: %v", err) } - if d.HasChange("sku_name") && mode != postgresql.CreateModeReplica { + if d.HasChange("sku_name") && mode != servers.CreateModeReplica { oldRaw, newRaw := d.GetChange("sku_name") old := oldRaw.(string) new := newRaw.(string) if indexOfSku(old) < indexOfSku(new) { - listReplicas, err := replicasClient.ListByServer(ctx, id.ResourceGroup, id.Name) + replicasId := replicas.NewServerID(id.SubscriptionId, id.ResourceGroupName, id.ServerName) + listReplicas, err := replicasClient.ListByServer(ctx, replicasId) if err != nil { return fmt.Errorf("listing replicas for %s: %+v", *id, err) } - propertiesReplica := postgresql.ServerUpdateParameters{ + propertiesReplica := servers.ServerUpdateParameters{ Sku: sku, } - for _, replica := range *listReplicas.Value { - replicaId, err := parse.ServerID(*replica.ID) - if err != nil { - return fmt.Errorf("parsing Postgres Server Replica ID : %v", err) - } - future, err := client.Update(ctx, replicaId.ResourceGroup, replicaId.Name, propertiesReplica) - if err != nil { - return fmt.Errorf("updating SKU for Replica %s: %+v", *replicaId, err) - } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for SKU update for Replica %s: %+v", *replicaId, err) + if listReplicas.Model != nil && listReplicas.Model.Value != nil { + replicaList := *listReplicas.Model.Value + for _, replica := range replicaList { + replicaId, err := servers.ParseServerID(*replica.Id) + if err != nil { + return fmt.Errorf("parsing Postgres Server Replica ID : %v", err) + } + if err = client.UpdateThenPoll(ctx, *replicaId, propertiesReplica); err != nil { + return fmt.Errorf("updating SKU for Replica %s: %+v", *replicaId, err) + } } } } } - ssl := postgresql.SslEnforcementEnumEnabled + ssl := servers.SslEnforcementEnumEnabled if v := d.Get("ssl_enforcement_enabled"); !v.(bool) { - ssl = postgresql.SslEnforcementEnumDisabled + ssl = servers.SslEnforcementEnumDisabled } - tlsMin := postgresql.MinimalTLSVersionEnum(d.Get("ssl_minimal_tls_version_enforced").(string)) + tlsMin := servers.MinimalTlsVersionEnum(d.Get("ssl_minimal_tls_version_enforced").(string)) - if ssl == postgresql.SslEnforcementEnumDisabled && tlsMin != postgresql.TLSEnforcementDisabled { + if ssl == servers.SslEnforcementEnumDisabled && tlsMin != servers.MinimalTlsVersionEnumTLSEnforcementDisabled { return fmt.Errorf("`ssl_minimal_tls_version_enforced` must be set to `TLSEnforcementDisabled` if `ssl_enforcement_enabled` is set to `false`") } - expandedIdentity, err := expandServerIdentity(d.Get("identity").([]interface{})) + expandedIdentity, err := identity.ExpandSystemAssigned(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } - properties := postgresql.ServerUpdateParameters{ + serverVersion := servers.ServerVersion(d.Get("version").(string)) + properties := servers.ServerUpdateParameters{ Identity: expandedIdentity, - ServerUpdateParametersProperties: &postgresql.ServerUpdateParametersProperties{ - SslEnforcement: ssl, - MinimalTLSVersion: tlsMin, + Properties: &servers.ServerUpdateParametersProperties{ + SslEnforcement: &ssl, + MinimalTlsVersion: &tlsMin, StorageProfile: expandPostgreSQLStorageProfile(d), - Version: postgresql.ServerVersion(d.Get("version").(string)), + Version: &serverVersion, }, Sku: sku, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - if mode == postgresql.CreateModePointInTimeRestore { + if mode == servers.CreateModePointInTimeRestore { // d.GetOk cannot identify whether user sets the property that is bool type and has default value. So it has to identify it using `d.GetRawConfig()` if v := d.GetRawConfig().AsValueMap()["public_network_access_enabled"]; !v.IsNull() { return fmt.Errorf("`public_network_access_enabled` doesn't support PointInTimeRestore mode") } } else { - publicAccess := postgresql.PublicNetworkAccessEnumEnabled + publicAccess := servers.PublicNetworkAccessEnumEnabled if v := d.Get("public_network_access_enabled"); !v.(bool) { - publicAccess = postgresql.PublicNetworkAccessEnumDisabled + publicAccess = servers.PublicNetworkAccessEnumDisabled } - properties.ServerUpdateParametersProperties.PublicNetworkAccess = publicAccess + properties.Properties.PublicNetworkAccess = &publicAccess } oldCreateMode, newCreateMode := d.GetChange("create_mode") - replicaUpdatedToDefault := postgresql.CreateMode(oldCreateMode.(string)) == postgresql.CreateModeReplica && postgresql.CreateMode(newCreateMode.(string)) == postgresql.CreateModeDefault + replicaUpdatedToDefault := servers.CreateMode(oldCreateMode.(string)) == servers.CreateModeReplica && servers.CreateMode(newCreateMode.(string)) == servers.CreateModeDefault if replicaUpdatedToDefault { - properties.ServerUpdateParametersProperties.ReplicationRole = utils.String("None") + properties.Properties.ReplicationRole = utils.String("None") } // Update Admin Password in the separate call when Replication is stopped: https://github.com/Azure/azure-rest-api-specs/issues/16898 if d.HasChange("administrator_login_password") && !replicaUpdatedToDefault { - properties.ServerUpdateParametersProperties.AdministratorLoginPassword = utils.String(d.Get("administrator_login_password").(string)) + properties.Properties.AdministratorLoginPassword = utils.String(d.Get("administrator_login_password").(string)) } - future, err := client.Update(ctx, id.ResourceGroup, id.Name, properties) - if err != nil { + if err = client.UpdateThenPoll(ctx, *id, properties); err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of %s: %+v", *id, err) - } // Update Admin Password in a separate call when Replication is stopped: https://github.com/Azure/azure-rest-api-specs/issues/16898 if d.HasChange("administrator_login_password") && replicaUpdatedToDefault { - properties.ServerUpdateParametersProperties.AdministratorLoginPassword = utils.String(d.Get("administrator_login_password").(string)) + properties.Properties.AdministratorLoginPassword = utils.String(d.Get("administrator_login_password").(string)) - future, err := client.Update(ctx, id.ResourceGroup, id.Name, properties) - if err != nil { + if err = client.UpdateThenPoll(ctx, *id, properties); err != nil { return fmt.Errorf("updating Admin Password of %q: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for Admin Password update of %q: %+v", id, err) - } } if v, ok := d.GetOk("threat_detection_policy"); ok { alert := expandSecurityAlertPolicy(v) + securityId := serversecurityalertpolicies.NewServerID(id.SubscriptionId, id.ResourceGroupName, id.ServerName) if alert != nil { - future, err := securityClient.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, *alert) - if err != nil { + if err = securityClient.CreateOrUpdateThenPoll(ctx, securityId, *alert); err != nil { return fmt.Errorf("updating security alert policy for %s: %+v", *id, err) } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for update of security alert policy for %s: %+v", *id, err) - } } } @@ -729,14 +693,14 @@ func resourcePostgreSQLServerRead(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ServerID(d.Id()) + id, err := servers.ParseServerID(d.Id()) if err != nil { return fmt.Errorf("parsing Postgres Server ID : %v", err) } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[WARN] %s was not found - removing from state", *id) d.SetId("") return nil @@ -745,56 +709,95 @@ func resourcePostgreSQLServerRead(d *pluginsdk.ResourceData, meta interface{}) e return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.ServerName) + d.Set("resource_group_name", id.ResourceGroupName) - tier := postgresql.Basic - if sku := resp.Sku; sku != nil { - d.Set("sku_name", sku.Name) - tier = sku.Tier - } + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) - if err := d.Set("identity", flattenServerIdentity(resp.Identity)); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) - } + tier := servers.SkuTierBasic + if sku := model.Sku; sku != nil { + d.Set("sku_name", sku.Name) + if sku.Tier != nil { + tier = *sku.Tier + } + } - if props := resp.ServerProperties; props != nil { - d.Set("administrator_login", props.AdministratorLogin) - d.Set("ssl_minimal_tls_version_enforced", props.MinimalTLSVersion) - d.Set("version", string(props.Version)) + if err := d.Set("identity", identity.FlattenSystemAssigned(model.Identity)); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } - d.Set("infrastructure_encryption_enabled", props.InfrastructureEncryption == postgresql.InfrastructureEncryptionEnabled) - d.Set("public_network_access_enabled", props.PublicNetworkAccess == postgresql.PublicNetworkAccessEnumEnabled) - d.Set("ssl_enforcement_enabled", props.SslEnforcement == postgresql.SslEnforcementEnumEnabled) + if props := model.Properties; props != nil { + d.Set("administrator_login", props.AdministratorLogin) + d.Set("ssl_minimal_tls_version_enforced", props.MinimalTlsVersion) - if storage := props.StorageProfile; storage != nil { - d.Set("storage_mb", storage.StorageMB) - d.Set("backup_retention_days", storage.BackupRetentionDays) - d.Set("auto_grow_enabled", storage.StorageAutogrow == postgresql.StorageAutogrowEnabled) - d.Set("geo_redundant_backup_enabled", storage.GeoRedundantBackup == postgresql.Enabled) - } + version := "" + if props.Version != nil { + version = string(*props.Version) + } + d.Set("version", version) - // Computed - d.Set("fqdn", props.FullyQualifiedDomainName) - } + infrastructureEncryption := false + if props.InfrastructureEncryption != nil { + infrastructureEncryption = *props.InfrastructureEncryption == servers.InfrastructureEncryptionEnabled + } + d.Set("infrastructure_encryption_enabled", infrastructureEncryption) + + publicNetworkAccess := false + if props.PublicNetworkAccess != nil { + publicNetworkAccess = *props.PublicNetworkAccess == servers.PublicNetworkAccessEnumEnabled + } + d.Set("public_network_access_enabled", publicNetworkAccess) + + sslEnforcement := false + if props.SslEnforcement != nil { + sslEnforcement = *props.SslEnforcement == servers.SslEnforcementEnumEnabled + } + d.Set("ssl_enforcement_enabled", sslEnforcement) + + if storage := props.StorageProfile; storage != nil { + d.Set("storage_mb", storage.StorageMB) + d.Set("backup_retention_days", storage.BackupRetentionDays) + + autoGrow := false + if storage.StorageAutogrow != nil { + autoGrow = *storage.StorageAutogrow == servers.StorageAutogrowEnabled + } + d.Set("auto_grow_enabled", autoGrow) - // the basic does not support threat detection policies - if tier == postgresql.GeneralPurpose || tier == postgresql.MemoryOptimized { - secResp, err := securityClient.Get(ctx, id.ResourceGroup, id.Name) - if err != nil && !utils.ResponseWasNotFound(secResp.Response) { - return fmt.Errorf("making read request to postgres server security alert policy: %+v", err) + geoRedundant := false + if storage.GeoRedundantBackup != nil { + geoRedundant = *storage.GeoRedundantBackup == servers.GeoRedundantBackupEnabled + } + d.Set("geo_redundant_backup_enabled", geoRedundant) + } + + // Computed + d.Set("fqdn", props.FullyQualifiedDomainName) } - if !utils.ResponseWasNotFound(secResp.Response) { - block := flattenSecurityAlertPolicy(secResp.SecurityAlertPolicyProperties, d.Get("threat_detection_policy.0.storage_account_access_key").(string)) - if err := d.Set("threat_detection_policy", block); err != nil { - return fmt.Errorf("setting `threat_detection_policy`: %+v", err) + // the basic does not support threat detection policies + if tier == servers.SkuTierGeneralPurpose || tier == servers.SkuTierMemoryOptimized { + securityId := serversecurityalertpolicies.NewServerID(id.SubscriptionId, id.ResourceGroupName, id.ServerName) + secResp, err := securityClient.Get(ctx, securityId) + if err != nil && !response.WasNotFound(secResp.HttpResponse) { + return fmt.Errorf("making read request to postgres server security alert policy: %+v", err) + } + + if !response.WasNotFound(secResp.HttpResponse) { + if secResp.Model != nil { + block := flattenSecurityAlertPolicy(secResp.Model.Properties, d.Get("threat_detection_policy.0.storage_account_access_key").(string)) + if err := d.Set("threat_detection_policy", block); err != nil { + return fmt.Errorf("setting `threat_detection_policy`: %+v", err) + } + } } } + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourcePostgreSQLServerDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -802,20 +805,15 @@ func resourcePostgreSQLServerDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ServerID(d.Id()) + id, err := servers.ParseServerID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { + if err = client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - return nil } @@ -828,20 +826,20 @@ func indexOfSku(skuName string) int { return -1 // not found. } -func expandServerSkuName(skuName string) (*postgresql.Sku, error) { +func expandServerSkuName(skuName string) (*servers.Sku, error) { parts := strings.Split(skuName, "_") if len(parts) != 3 { return nil, fmt.Errorf("sku_name (%s) has the wrong number of parts (%d) after splitting on _", skuName, len(parts)) } - var tier postgresql.SkuTier + var tier servers.SkuTier switch parts[0] { case "B": - tier = postgresql.Basic + tier = servers.SkuTierBasic case "GP": - tier = postgresql.GeneralPurpose + tier = servers.SkuTierGeneralPurpose case "MO": - tier = postgresql.MemoryOptimized + tier = servers.SkuTierMemoryOptimized default: return nil, fmt.Errorf("sku_name %s has unknown sku tier %s", skuName, parts[0]) } @@ -851,44 +849,47 @@ func expandServerSkuName(skuName string) (*postgresql.Sku, error) { return nil, fmt.Errorf("cannot convert skuname %s capcity %s to int", skuName, parts[2]) } - return &postgresql.Sku{ - Name: utils.String(skuName), - Tier: tier, - Capacity: utils.Int32(int32(capacity)), + return &servers.Sku{ + Name: skuName, + Tier: &tier, + Capacity: utils.Int64(int64(capacity)), Family: utils.String(parts[1]), }, nil } -func expandPostgreSQLStorageProfile(d *pluginsdk.ResourceData) *postgresql.StorageProfile { - storage := postgresql.StorageProfile{} +func expandPostgreSQLStorageProfile(d *pluginsdk.ResourceData) *servers.StorageProfile { + storage := servers.StorageProfile{} // now override whatever we may have from the block with the top level properties if v, ok := d.GetOk("auto_grow_enabled"); ok { - storage.StorageAutogrow = postgresql.StorageAutogrowDisabled + autogrowEnabled := servers.StorageAutogrowDisabled if v.(bool) { - storage.StorageAutogrow = postgresql.StorageAutogrowEnabled + autogrowEnabled = servers.StorageAutogrowEnabled } + storage.StorageAutogrow = &autogrowEnabled } if v, ok := d.GetOk("backup_retention_days"); ok { - storage.BackupRetentionDays = utils.Int32(int32(v.(int))) + storage.BackupRetentionDays = utils.Int64(int64(v.(int))) } if v, ok := d.GetOk("geo_redundant_backup_enabled"); ok { - storage.GeoRedundantBackup = postgresql.Disabled + geoRedundantBackup := servers.GeoRedundantBackupDisabled + if v.(bool) { - storage.GeoRedundantBackup = postgresql.Enabled + geoRedundantBackup = servers.GeoRedundantBackupEnabled } + storage.GeoRedundantBackup = &geoRedundantBackup } if v, ok := d.GetOk("storage_mb"); ok { - storage.StorageMB = utils.Int32(int32(v.(int))) + storage.StorageMB = utils.Int64(int64(v.(int))) } return &storage } -func expandSecurityAlertPolicy(i interface{}) *postgresql.ServerSecurityAlertPolicy { +func expandSecurityAlertPolicy(i interface{}) *serversecurityalertpolicies.ServerSecurityAlertPolicy { slice := i.([]interface{}) if len(slice) == 0 { return nil @@ -896,12 +897,12 @@ func expandSecurityAlertPolicy(i interface{}) *postgresql.ServerSecurityAlertPol block := slice[0].(map[string]interface{}) - state := postgresql.ServerSecurityAlertPolicyStateEnabled + state := serversecurityalertpolicies.ServerSecurityAlertPolicyStateEnabled if !block["enabled"].(bool) { - state = postgresql.ServerSecurityAlertPolicyStateDisabled + state = serversecurityalertpolicies.ServerSecurityAlertPolicyStateDisabled } - props := &postgresql.SecurityAlertPolicyProperties{ + props := &serversecurityalertpolicies.SecurityAlertPolicyProperties{ State: state, } @@ -918,7 +919,7 @@ func expandSecurityAlertPolicy(i interface{}) *postgresql.ServerSecurityAlertPol } if v, ok := block["retention_days"]; ok { - props.RetentionDays = utils.Int32(int32(v.(int))) + props.RetentionDays = utils.Int64(int64(v.(int))) } if v, ok := block["storage_account_access_key"]; ok && v.(string) != "" { @@ -929,12 +930,12 @@ func expandSecurityAlertPolicy(i interface{}) *postgresql.ServerSecurityAlertPol props.StorageEndpoint = utils.String(v.(string)) } - return &postgresql.ServerSecurityAlertPolicy{ - SecurityAlertPolicyProperties: props, + return &serversecurityalertpolicies.ServerSecurityAlertPolicy{ + Properties: props, } } -func flattenSecurityAlertPolicy(props *postgresql.SecurityAlertPolicyProperties, accessKey string) interface{} { +func flattenSecurityAlertPolicy(props *serversecurityalertpolicies.SecurityAlertPolicyProperties, accessKey string) interface{} { if props == nil { return nil } @@ -946,13 +947,13 @@ func flattenSecurityAlertPolicy(props *postgresql.SecurityAlertPolicyProperties, props.StorageEndpoint != nil && *props.StorageEndpoint == "" && props.RetentionDays != nil && *props.RetentionDays == 0 && props.EmailAccountAdmins != nil && !*props.EmailAccountAdmins && - props.State == postgresql.ServerSecurityAlertPolicyStateDisabled { + props.State == serversecurityalertpolicies.ServerSecurityAlertPolicyStateDisabled { return nil } block := map[string]interface{}{} - block["enabled"] = props.State == postgresql.ServerSecurityAlertPolicyStateEnabled + block["enabled"] = props.State == serversecurityalertpolicies.ServerSecurityAlertPolicyStateEnabled block["disabled_alerts"] = flattenSecurityAlertPolicySet(props.DisabledAlerts) block["email_addresses"] = flattenSecurityAlertPolicySet(props.EmailAddresses) @@ -972,39 +973,6 @@ func flattenSecurityAlertPolicy(props *postgresql.SecurityAlertPolicyProperties, return []interface{}{block} } -func expandServerIdentity(input []interface{}) (*postgresql.ResourceIdentity, error) { - expanded, err := identity.ExpandSystemAssigned(input) - if err != nil { - return nil, err - } - - if expanded.Type == identity.TypeNone { - return nil, nil - } - - return &postgresql.ResourceIdentity{ - Type: postgresql.IdentityType(string(expanded.Type)), - }, nil -} - -func flattenServerIdentity(input *postgresql.ResourceIdentity) []interface{} { - var transition *identity.SystemAssigned - - if input != nil { - transition = &identity.SystemAssigned{ - Type: identity.Type(string(input.Type)), - } - if input.PrincipalID != nil { - transition.PrincipalId = input.PrincipalID.String() - } - if input.TenantID != nil { - transition.TenantId = input.TenantID.String() - } - } - - return identity.FlattenSystemAssigned(transition) -} - func flattenSecurityAlertPolicySet(input *[]string) []interface{} { if input == nil { return make([]interface{}, 0) @@ -1020,23 +988,23 @@ func flattenSecurityAlertPolicySet(input *[]string) []interface{} { return utils.FlattenStringSlice(input) } -func postgreSqlStateRefreshFunc(ctx context.Context, client *postgresql.ServersClient, id parse.ServerId) pluginsdk.StateRefreshFunc { +func postgreSqlStateRefreshFunc(ctx context.Context, client *servers.ServersClient, id servers.ServerId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.Name) - if !utils.ResponseWasNotFound(res.Response) && err != nil { + res, err := client.Get(ctx, id) + if !response.WasNotFound(res.HttpResponse) && err != nil { return nil, "", fmt.Errorf("retrieving status of %s: %+v", id, err) } // This is an issue with the RP, there is a 10 to 15 second lag before the // service will actually return the server - if utils.ResponseWasNotFound(res.Response) { - return res, string(postgresql.ServerStateInaccessible), nil + if response.WasNotFound(res.HttpResponse) { + return res, string(servers.ServerStateInaccessible), nil } - if res.ServerProperties != nil && res.ServerProperties.UserVisibleState != "" { - return res, string(res.ServerProperties.UserVisibleState), nil + if res.Model != nil && res.Model.Properties != nil && res.Model.Properties.UserVisibleState != nil && *res.Model.Properties.UserVisibleState != "" { + return res, string(*res.Model.Properties.UserVisibleState), nil } - return res, string(postgresql.ServerStateInaccessible), nil + return res, string(servers.ServerStateInaccessible), nil } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_virtual_network_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_virtual_network_rule_resource.go index 56db2624ee7..1e72e7443f6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_virtual_network_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/postgresql_virtual_network_rule_resource.go @@ -6,12 +6,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -25,7 +25,7 @@ func resourcePostgreSQLVirtualNetworkRule() *pluginsdk.Resource { Update: resourcePostgreSQLVirtualNetworkRuleCreateUpdate, Delete: resourcePostgreSQLVirtualNetworkRuleDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.VirtualNetworkRuleID(id) + _, err := virtualnetworkrules.ParseVirtualNetworkRuleID(id) return err }), @@ -74,38 +74,33 @@ func resourcePostgreSQLVirtualNetworkRuleCreateUpdate(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewVirtualNetworkRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) + id := virtualnetworkrules.NewVirtualNetworkRuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("server_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_postgresql_virtual_network_rule", id.ID()) } } - parameters := postgresql.VirtualNetworkRule{ - VirtualNetworkRuleProperties: &postgresql.VirtualNetworkRuleProperties{ - VirtualNetworkSubnetID: utils.String(d.Get("subnet_id").(string)), + parameters := virtualnetworkrules.VirtualNetworkRule{ + Properties: &virtualnetworkrules.VirtualNetworkRuleProperties{ + VirtualNetworkSubnetId: d.Get("subnet_id").(string), IgnoreMissingVnetServiceEndpoint: utils.Bool(d.Get("ignore_missing_vnet_service_endpoint").(bool)), }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ServerName, id.Name, parameters) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - // Wait for the provisioning state to become ready - log.Printf("[DEBUG] Waiting for %s to become ready: %+v", id, err) + log.Printf("[DEBUG] Waiting for %s to become ready", id) stateConf := &pluginsdk.StateChangeConf{ Pending: []string{"Initializing", "InProgress", "Unknown", "ResponseNotFound"}, Target: []string{"Ready"}, @@ -120,7 +115,7 @@ func resourcePostgreSQLVirtualNetworkRuleCreateUpdate(d *pluginsdk.ResourceData, stateConf.Timeout = d.Timeout(pluginsdk.TimeoutUpdate) } - if _, err = stateConf.WaitForStateContext(ctx); err != nil { + if _, err := stateConf.WaitForStateContext(ctx); err != nil { return fmt.Errorf("waiting for %s to be created or updated: %+v", id, err) } @@ -133,29 +128,31 @@ func resourcePostgreSQLVirtualNetworkRuleRead(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VirtualNetworkRuleID(d.Id()) + id, err := virtualnetworkrules.ParseVirtualNetworkRuleID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] Error reading PostgreSQL Virtual Network Rule %q - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("retrieving Virtual Network Rule %q (PostgreSQL Server %q / Resource Group %q): %+v", id.Name, id.ServerName, id.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.VirtualNetworkRuleName) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("server_name", id.ServerName) - if props := resp.VirtualNetworkRuleProperties; props != nil { - d.Set("subnet_id", props.VirtualNetworkSubnetID) - d.Set("ignore_missing_vnet_service_endpoint", props.IgnoreMissingVnetServiceEndpoint) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("subnet_id", props.VirtualNetworkSubnetId) + d.Set("ignore_missing_vnet_service_endpoint", props.IgnoreMissingVnetServiceEndpoint) + } } return nil @@ -166,28 +163,23 @@ func resourcePostgreSQLVirtualNetworkRuleDelete(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VirtualNetworkRuleID(d.Id()) + id, err := virtualnetworkrules.ParseVirtualNetworkRuleID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ServerName, id.Name) - if err != nil { - return fmt.Errorf("deleting PostgreSQL Virtual Network Rule %q (PostgreSQL Server: %q, Resource Group: %q): %+v", id.Name, id.ServerName, id.ResourceGroup, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of Virtual Network Rule %q (PostgreSQL Server %q / Resource Group %q): %+v", id.Name, id.ServerName, id.ResourceGroup, err) + if err := client.DeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } return nil } -func postgreSQLVirtualNetworkStateStatusCodeRefreshFunc(ctx context.Context, client *postgresql.VirtualNetworkRulesClient, id parse.VirtualNetworkRuleId) pluginsdk.StateRefreshFunc { +func postgreSQLVirtualNetworkStateStatusCodeRefreshFunc(ctx context.Context, client *virtualnetworkrules.VirtualNetworkRulesClient, id virtualnetworkrules.VirtualNetworkRuleId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - resp, err := client.Get(ctx, id.ResourceGroup, id.ServerName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] Retrieving %s returned 404.", id) return nil, "ResponseNotFound", nil } @@ -195,9 +187,11 @@ func postgreSQLVirtualNetworkStateStatusCodeRefreshFunc(ctx context.Context, cli return nil, "", fmt.Errorf("polling for the state of the %s: %+v", id, err) } - if props := resp.VirtualNetworkRuleProperties; props != nil { - log.Printf("[DEBUG] Retrieving %s returned Status %s", id, props.State) - return resp, string(props.State), nil + if model := resp.Model; model != nil { + if props := model.Properties; props != nil && props.State != nil { + log.Printf("[DEBUG] Retrieving %s returned Status %s", id, string(*props.State)) + return resp, string(*props.State), nil + } } // Valid response was returned but VirtualNetworkRuleProperties was nil. Basically the rule exists, but with no properties for some reason. Assume Unknown instead of returning error. diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/configuration_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/configuration_id.go deleted file mode 100644 index 5fbc75f538b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/configuration_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -) - -func ConfigurationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ConfigurationID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/database_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/database_id.go deleted file mode 100644 index 24a8ecbddcf..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/database_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -) - -func DatabaseID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.DatabaseID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/firewall_rule_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/firewall_rule_id.go deleted file mode 100644 index e0ded2db618..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/firewall_rule_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -) - -func FirewallRuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.FirewallRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/flexible_server_configuration_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/flexible_server_configuration_id.go deleted file mode 100644 index fc654717d92..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/flexible_server_configuration_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -) - -func FlexibleServerConfigurationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.FlexibleServerConfigurationID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/flexible_server_database_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/flexible_server_database_id.go deleted file mode 100644 index c899f3d7fc8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/flexible_server_database_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -) - -func FlexibleServerDatabaseID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.FlexibleServerDatabaseID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/flexible_server_firewall_rule_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/flexible_server_firewall_rule_id.go deleted file mode 100644 index 62063f69a97..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/flexible_server_firewall_rule_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -) - -func FlexibleServerFirewallRuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.FlexibleServerFirewallRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/flexible_server_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/flexible_server_id.go deleted file mode 100644 index 1b998295da2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/flexible_server_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -) - -func FlexibleServerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.FlexibleServerID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/server_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/server_id.go deleted file mode 100644 index a7864ea1966..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/server_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -) - -func ServerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ServerID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/server_key_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/server_key_id.go deleted file mode 100644 index fda821517df..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/server_key_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -) - -func ServerKeyID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ServerKeyID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/virtual_network_rule_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/virtual_network_rule_id.go deleted file mode 100644 index 550db479d5e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate/virtual_network_rule_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse" -) - -func VirtualNetworkRuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.VirtualNetworkRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/client/client.go index 731f9afbabe..8622e226fb6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/client/client.go @@ -1,8 +1,8 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/powerbi_embedded_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/powerbi_embedded_resource.go index 031fb942758..d68b47d8d85 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/powerbi_embedded_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/powerbi_embedded_resource.go @@ -9,10 +9,10 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities" "github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/client.go deleted file mode 100644 index 099213eb35e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package capacities - -import "github.com/Azure/go-autorest/autorest" - -type CapacitiesClient struct { - Client autorest.Client - baseUri string -} - -func NewCapacitiesClientWithBaseURI(endpoint string) CapacitiesClient { - return CapacitiesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/constants.go deleted file mode 100644 index 566d7842dc4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/constants.go +++ /dev/null @@ -1,212 +0,0 @@ -package capacities - -import "strings" - -type CapacityProvisioningState string - -const ( - CapacityProvisioningStateDeleting CapacityProvisioningState = "Deleting" - CapacityProvisioningStateFailed CapacityProvisioningState = "Failed" - CapacityProvisioningStatePaused CapacityProvisioningState = "Paused" - CapacityProvisioningStatePausing CapacityProvisioningState = "Pausing" - CapacityProvisioningStatePreparing CapacityProvisioningState = "Preparing" - CapacityProvisioningStateProvisioning CapacityProvisioningState = "Provisioning" - CapacityProvisioningStateResuming CapacityProvisioningState = "Resuming" - CapacityProvisioningStateScaling CapacityProvisioningState = "Scaling" - CapacityProvisioningStateSucceeded CapacityProvisioningState = "Succeeded" - CapacityProvisioningStateSuspended CapacityProvisioningState = "Suspended" - CapacityProvisioningStateSuspending CapacityProvisioningState = "Suspending" - CapacityProvisioningStateUpdating CapacityProvisioningState = "Updating" -) - -func PossibleValuesForCapacityProvisioningState() []string { - return []string{ - string(CapacityProvisioningStateDeleting), - string(CapacityProvisioningStateFailed), - string(CapacityProvisioningStatePaused), - string(CapacityProvisioningStatePausing), - string(CapacityProvisioningStatePreparing), - string(CapacityProvisioningStateProvisioning), - string(CapacityProvisioningStateResuming), - string(CapacityProvisioningStateScaling), - string(CapacityProvisioningStateSucceeded), - string(CapacityProvisioningStateSuspended), - string(CapacityProvisioningStateSuspending), - string(CapacityProvisioningStateUpdating), - } -} - -func parseCapacityProvisioningState(input string) (*CapacityProvisioningState, error) { - vals := map[string]CapacityProvisioningState{ - "deleting": CapacityProvisioningStateDeleting, - "failed": CapacityProvisioningStateFailed, - "paused": CapacityProvisioningStatePaused, - "pausing": CapacityProvisioningStatePausing, - "preparing": CapacityProvisioningStatePreparing, - "provisioning": CapacityProvisioningStateProvisioning, - "resuming": CapacityProvisioningStateResuming, - "scaling": CapacityProvisioningStateScaling, - "succeeded": CapacityProvisioningStateSucceeded, - "suspended": CapacityProvisioningStateSuspended, - "suspending": CapacityProvisioningStateSuspending, - "updating": CapacityProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CapacityProvisioningState(input) - return &out, nil -} - -type CapacitySkuTier string - -const ( - CapacitySkuTierAutoPremiumHost CapacitySkuTier = "AutoPremiumHost" - CapacitySkuTierPBIEAzure CapacitySkuTier = "PBIE_Azure" - CapacitySkuTierPremium CapacitySkuTier = "Premium" -) - -func PossibleValuesForCapacitySkuTier() []string { - return []string{ - string(CapacitySkuTierAutoPremiumHost), - string(CapacitySkuTierPBIEAzure), - string(CapacitySkuTierPremium), - } -} - -func parseCapacitySkuTier(input string) (*CapacitySkuTier, error) { - vals := map[string]CapacitySkuTier{ - "autopremiumhost": CapacitySkuTierAutoPremiumHost, - "pbie_azure": CapacitySkuTierPBIEAzure, - "premium": CapacitySkuTierPremium, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CapacitySkuTier(input) - return &out, nil -} - -type IdentityType string - -const ( - IdentityTypeApplication IdentityType = "Application" - IdentityTypeKey IdentityType = "Key" - IdentityTypeManagedIdentity IdentityType = "ManagedIdentity" - IdentityTypeUser IdentityType = "User" -) - -func PossibleValuesForIdentityType() []string { - return []string{ - string(IdentityTypeApplication), - string(IdentityTypeKey), - string(IdentityTypeManagedIdentity), - string(IdentityTypeUser), - } -} - -func parseIdentityType(input string) (*IdentityType, error) { - vals := map[string]IdentityType{ - "application": IdentityTypeApplication, - "key": IdentityTypeKey, - "managedidentity": IdentityTypeManagedIdentity, - "user": IdentityTypeUser, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := IdentityType(input) - return &out, nil -} - -type Mode string - -const ( - ModeGenOne Mode = "Gen1" - ModeGenTwo Mode = "Gen2" -) - -func PossibleValuesForMode() []string { - return []string{ - string(ModeGenOne), - string(ModeGenTwo), - } -} - -func parseMode(input string) (*Mode, error) { - vals := map[string]Mode{ - "gen1": ModeGenOne, - "gen2": ModeGenTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Mode(input) - return &out, nil -} - -type State string - -const ( - StateDeleting State = "Deleting" - StateFailed State = "Failed" - StatePaused State = "Paused" - StatePausing State = "Pausing" - StatePreparing State = "Preparing" - StateProvisioning State = "Provisioning" - StateResuming State = "Resuming" - StateScaling State = "Scaling" - StateSucceeded State = "Succeeded" - StateSuspended State = "Suspended" - StateSuspending State = "Suspending" - StateUpdating State = "Updating" -) - -func PossibleValuesForState() []string { - return []string{ - string(StateDeleting), - string(StateFailed), - string(StatePaused), - string(StatePausing), - string(StatePreparing), - string(StateProvisioning), - string(StateResuming), - string(StateScaling), - string(StateSucceeded), - string(StateSuspended), - string(StateSuspending), - string(StateUpdating), - } -} - -func parseState(input string) (*State, error) { - vals := map[string]State{ - "deleting": StateDeleting, - "failed": StateFailed, - "paused": StatePaused, - "pausing": StatePausing, - "preparing": StatePreparing, - "provisioning": StateProvisioning, - "resuming": StateResuming, - "scaling": StateScaling, - "succeeded": StateSucceeded, - "suspended": StateSuspended, - "suspending": StateSuspending, - "updating": StateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := State(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/id_location.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/id_location.go deleted file mode 100644 index 06db7f0ea42..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/id_location.go +++ /dev/null @@ -1,111 +0,0 @@ -package capacities - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = LocationId{} - -// LocationId is a struct representing the Resource ID for a Location -type LocationId struct { - SubscriptionId string - Location string -} - -// NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { - return LocationId{ - SubscriptionId: subscriptionId, - Location: location, - } -} - -// ParseLocationID parses 'input' into a LocationId -func ParseLocationID(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId -// note: this method should only be used for API response data and not user input -func ParseLocationIDInsensitively(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateLocationID checks that 'input' can be parsed as a Location ID -func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseLocationID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Location ID -func (id LocationId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.PowerBIDedicated/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) -} - -// Segments returns a slice of Resource ID Segments which comprise this Location ID -func (id LocationId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftPowerBIDedicated", "Microsoft.PowerBIDedicated", "Microsoft.PowerBIDedicated"), - resourceids.StaticSegment("locations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), - } -} - -// String returns a human-readable description of this Location ID -func (id LocationId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), - } - return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/id_resourcegroup.go deleted file mode 100644 index 7e9c16e2e16..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package capacities - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/id_subscription.go deleted file mode 100644 index c7798def111..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package capacities - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_checknameavailability_autorest.go deleted file mode 100644 index cff0240a812..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_checknameavailability_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package capacities - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CheckNameAvailabilityResponse struct { - HttpResponse *http.Response - Model *CheckCapacityNameAvailabilityResult -} - -// CheckNameAvailability ... -func (c CapacitiesClient) CheckNameAvailability(ctx context.Context, id LocationId, input CheckCapacityNameAvailabilityParameters) (result CheckNameAvailabilityResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c CapacitiesClient) preparerForCheckNameAvailability(ctx context.Context, id LocationId, input CheckCapacityNameAvailabilityParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/checkNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c CapacitiesClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_create_autorest.go deleted file mode 100644 index 0f3b11b07d2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_create_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package capacities - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Create ... -func (c CapacitiesClient) Create(ctx context.Context, id CapacitiesId, input DedicatedCapacity) (result CreateResponse, err error) { - req, err := c.preparerForCreate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateThenPoll performs Create then polls until it's completed -func (c CapacitiesClient) CreateThenPoll(ctx context.Context, id CapacitiesId, input DedicatedCapacity) error { - result, err := c.Create(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} - -// preparerForCreate prepares the Create request. -func (c CapacitiesClient) preparerForCreate(ctx context.Context, id CapacitiesId, input DedicatedCapacity) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreate sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (c CapacitiesClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_delete_autorest.go deleted file mode 100644 index 6d184d0bd28..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_delete_autorest.go +++ /dev/null @@ -1,73 +0,0 @@ -package capacities - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c CapacitiesClient) Delete(ctx context.Context, id CapacitiesId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c CapacitiesClient) DeleteThenPoll(ctx context.Context, id CapacitiesId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c CapacitiesClient) preparerForDelete(ctx context.Context, id CapacitiesId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c CapacitiesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_getdetails_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_getdetails_autorest.go deleted file mode 100644 index d2dd2e4147b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_getdetails_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package capacities - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetDetailsResponse struct { - HttpResponse *http.Response - Model *DedicatedCapacity -} - -// GetDetails ... -func (c CapacitiesClient) GetDetails(ctx context.Context, id CapacitiesId) (result GetDetailsResponse, err error) { - req, err := c.preparerForGetDetails(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "GetDetails", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "GetDetails", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetDetails(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "GetDetails", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetDetails prepares the GetDetails request. -func (c CapacitiesClient) preparerForGetDetails(ctx context.Context, id CapacitiesId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetDetails handles the response to the GetDetails request. The method always -// closes the http.Response Body. -func (c CapacitiesClient) responderForGetDetails(resp *http.Response) (result GetDetailsResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_list_autorest.go deleted file mode 100644 index 3fb267bb4ae..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_list_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package capacities - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListResponse struct { - HttpResponse *http.Response - Model *DedicatedCapacities -} - -// List ... -func (c CapacitiesClient) List(ctx context.Context, id SubscriptionId) (result ListResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c CapacitiesClient) preparerForList(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.PowerBIDedicated/capacities", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c CapacitiesClient) responderForList(resp *http.Response) (result ListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 6c43f337c70..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package capacities - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *DedicatedCapacities -} - -// ListByResourceGroup ... -func (c CapacitiesClient) ListByResourceGroup(ctx context.Context, id ResourceGroupId) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c CapacitiesClient) preparerForListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.PowerBIDedicated/capacities", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c CapacitiesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_resume_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_resume_autorest.go deleted file mode 100644 index b89d23fd716..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_resume_autorest.go +++ /dev/null @@ -1,74 +0,0 @@ -package capacities - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type ResumeResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Resume ... -func (c CapacitiesClient) Resume(ctx context.Context, id CapacitiesId) (result ResumeResponse, err error) { - req, err := c.preparerForResume(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Resume", nil, "Failure preparing request") - return - } - - result, err = c.senderForResume(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Resume", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// ResumeThenPoll performs Resume then polls until it's completed -func (c CapacitiesClient) ResumeThenPoll(ctx context.Context, id CapacitiesId) error { - result, err := c.Resume(ctx, id) - if err != nil { - return fmt.Errorf("performing Resume: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Resume: %+v", err) - } - - return nil -} - -// preparerForResume prepares the Resume request. -func (c CapacitiesClient) preparerForResume(ctx context.Context, id CapacitiesId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/resume", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForResume sends the Resume request. The method will close the -// http.Response Body if it receives an error. -func (c CapacitiesClient) senderForResume(ctx context.Context, req *http.Request) (future ResumeResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_suspend_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_suspend_autorest.go deleted file mode 100644 index a7da0c0842a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_suspend_autorest.go +++ /dev/null @@ -1,74 +0,0 @@ -package capacities - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type SuspendResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Suspend ... -func (c CapacitiesClient) Suspend(ctx context.Context, id CapacitiesId) (result SuspendResponse, err error) { - req, err := c.preparerForSuspend(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Suspend", nil, "Failure preparing request") - return - } - - result, err = c.senderForSuspend(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Suspend", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// SuspendThenPoll performs Suspend then polls until it's completed -func (c CapacitiesClient) SuspendThenPoll(ctx context.Context, id CapacitiesId) error { - result, err := c.Suspend(ctx, id) - if err != nil { - return fmt.Errorf("performing Suspend: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Suspend: %+v", err) - } - - return nil -} - -// preparerForSuspend prepares the Suspend request. -func (c CapacitiesClient) preparerForSuspend(ctx context.Context, id CapacitiesId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/suspend", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForSuspend sends the Suspend request. The method will close the -// http.Response Body if it receives an error. -func (c CapacitiesClient) senderForSuspend(ctx context.Context, req *http.Request) (future SuspendResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_update_autorest.go deleted file mode 100644 index 6104202e425..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/method_update_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package capacities - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type UpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c CapacitiesClient) Update(ctx context.Context, id CapacitiesId, input DedicatedCapacityUpdateParameters) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "capacities.CapacitiesClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c CapacitiesClient) UpdateThenPoll(ctx context.Context, id CapacitiesId, input DedicatedCapacityUpdateParameters) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c CapacitiesClient) preparerForUpdate(ctx context.Context, id CapacitiesId, input DedicatedCapacityUpdateParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c CapacitiesClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_capacitysku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_capacitysku.go deleted file mode 100644 index 20f4e2489f1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_capacitysku.go +++ /dev/null @@ -1,6 +0,0 @@ -package capacities - -type CapacitySku struct { - Name string `json:"name"` - Tier *CapacitySkuTier `json:"tier,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_checkcapacitynameavailabilityparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_checkcapacitynameavailabilityparameters.go deleted file mode 100644 index 7355f31623e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_checkcapacitynameavailabilityparameters.go +++ /dev/null @@ -1,6 +0,0 @@ -package capacities - -type CheckCapacityNameAvailabilityParameters struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_checkcapacitynameavailabilityresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_checkcapacitynameavailabilityresult.go deleted file mode 100644 index a72a5235aaf..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_checkcapacitynameavailabilityresult.go +++ /dev/null @@ -1,7 +0,0 @@ -package capacities - -type CheckCapacityNameAvailabilityResult struct { - Message *string `json:"message,omitempty"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason *string `json:"reason,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacities.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacities.go deleted file mode 100644 index 34932425afc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacities.go +++ /dev/null @@ -1,5 +0,0 @@ -package capacities - -type DedicatedCapacities struct { - Value []DedicatedCapacity `json:"value"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacity.go deleted file mode 100644 index 6bebbb07286..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacity.go +++ /dev/null @@ -1,12 +0,0 @@ -package capacities - -type DedicatedCapacity struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *DedicatedCapacityProperties `json:"properties,omitempty"` - Sku CapacitySku `json:"sku"` - SystemData *SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacityadministrators.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacityadministrators.go deleted file mode 100644 index ba65d273046..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacityadministrators.go +++ /dev/null @@ -1,5 +0,0 @@ -package capacities - -type DedicatedCapacityAdministrators struct { - Members *[]string `json:"members,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacitymutableproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacitymutableproperties.go deleted file mode 100644 index bed4d983b7b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacitymutableproperties.go +++ /dev/null @@ -1,6 +0,0 @@ -package capacities - -type DedicatedCapacityMutableProperties struct { - Administration *DedicatedCapacityAdministrators `json:"administration,omitempty"` - Mode *Mode `json:"mode,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacityproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacityproperties.go deleted file mode 100644 index ba982415d3f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacityproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package capacities - -type DedicatedCapacityProperties struct { - Administration *DedicatedCapacityAdministrators `json:"administration,omitempty"` - Mode *Mode `json:"mode,omitempty"` - ProvisioningState *CapacityProvisioningState `json:"provisioningState,omitempty"` - State *State `json:"state,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacityupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacityupdateparameters.go deleted file mode 100644 index 3fdfe2a2466..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_dedicatedcapacityupdateparameters.go +++ /dev/null @@ -1,7 +0,0 @@ -package capacities - -type DedicatedCapacityUpdateParameters struct { - Properties *DedicatedCapacityMutableProperties `json:"properties,omitempty"` - Sku *CapacitySku `json:"sku,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_skudetailsforexistingresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_skudetailsforexistingresource.go deleted file mode 100644 index d5a975c4399..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_skudetailsforexistingresource.go +++ /dev/null @@ -1,5 +0,0 @@ -package capacities - -type SkuDetailsForExistingResource struct { - Sku *CapacitySku `json:"sku,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_skuenumerationforexistingresourceresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_skuenumerationforexistingresourceresult.go deleted file mode 100644 index 5ba13e64a6d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_skuenumerationforexistingresourceresult.go +++ /dev/null @@ -1,5 +0,0 @@ -package capacities - -type SkuEnumerationForExistingResourceResult struct { - Value *[]SkuDetailsForExistingResource `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_systemdata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_systemdata.go deleted file mode 100644 index f6c63b0abe3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/model_systemdata.go +++ /dev/null @@ -1,10 +0,0 @@ -package capacities - -type SystemData struct { - CreatedAt *string `json:"createdAt,omitempty"` - CreatedBy *string `json:"createdBy,omitempty"` - CreatedByType *IdentityType `json:"createdByType,omitempty"` - LastModifiedAt *string `json:"lastModifiedAt,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - LastModifiedByType *IdentityType `json:"lastModifiedByType,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/version.go deleted file mode 100644 index f3b6be5e7ac..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package capacities - -import "fmt" - -const defaultApiVersion = "2021-01-01" - -func userAgent() string { - return fmt.Sprintf("pandora/capacities/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/validate/embedded_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/validate/embedded_id.go deleted file mode 100644 index 37e25a5a519..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/validate/embedded_id.go +++ /dev/null @@ -1,21 +0,0 @@ -package validate - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities" -) - -func EmbeddedID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := capacities.ParseCapacitiesID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/client/client.go index 99a0fb4a8a1..f57022714f5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/client/client.go @@ -1,10 +1,10 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_a_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_a_record_data_source.go new file mode 100644 index 00000000000..10a00a32012 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_a_record_data_source.go @@ -0,0 +1,95 @@ +package privatedns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourcePrivateDnsARecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourcePrivateDnsARecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "records": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, + Set: pluginsdk.HashString, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourcePrivateDnsARecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).PrivateDns.RecordSetsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeA, d.Get("name").(string)) + + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.PrivateZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.Ttl) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("records", flattenAzureRmPrivateDnsARecords(props.ARecords)); err != nil { + return fmt.Errorf("setting `records`: %+v", err) + } + + return tags.FlattenAndSet(d, props.Metadata) + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_a_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_a_record_resource.go index 94a23dd7417..6945e4e0c7b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_a_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_a_record_resource.go @@ -5,13 +5,15 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -49,12 +51,16 @@ func resourcePrivateDnsARecord() *pluginsdk.Resource { ValidateFunc: validate.LowerCasedString, }, + // TODO: in 4.0 make `name` case sensitive and replace `resource_group_name` and `zone_name` with `private_zone_id` + // TODO: make this case sensitive once the API's fixed https://github.com/Azure/azure-rest-api-specs/issues/6641 "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), "zone_name": { - Type: pluginsdk.TypeString, - Required: true, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, }, "records": { @@ -75,7 +81,7 @@ func resourcePrivateDnsARecord() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -103,7 +109,7 @@ func resourcePrivateDnsARecordCreateUpdate(d *pluginsdk.ResourceData, meta inter parameters := recordsets.RecordSet{ Name: utils.String(id.RelativeRecordSetName), Properties: &recordsets.RecordSetProperties{ - Metadata: expandTags(d.Get("tags").(map[string]interface{})), + Metadata: tags.Expand(d.Get("tags").(map[string]interface{})), Ttl: utils.Int64(int64(d.Get("ttl").(int))), ARecords: expandAzureRmPrivateDnsARecords(d), }, @@ -153,7 +159,7 @@ func resourcePrivateDnsARecordRead(d *pluginsdk.ResourceData, meta interface{}) return err } - return tags.FlattenAndSet(d, flattenTags(props.Metadata)) + return tags.FlattenAndSet(d, props.Metadata) } } @@ -186,11 +192,11 @@ func flattenAzureRmPrivateDnsARecords(records *[]recordsets.ARecord) []string { } for _, record := range *records { - if record.Ipv4Address == nil { + if record.IPv4Address == nil { continue } - results = append(results, *record.Ipv4Address) + results = append(results, *record.IPv4Address) } return results @@ -203,7 +209,7 @@ func expandAzureRmPrivateDnsARecords(d *pluginsdk.ResourceData) *[]recordsets.AR for i, v := range recordStrings { ipv4 := v.(string) records[i] = recordsets.ARecord{ - Ipv4Address: &ipv4, + IPv4Address: &ipv4, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_aaaa_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_aaaa_record_data_source.go new file mode 100644 index 00000000000..832b1a4bcca --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_aaaa_record_data_source.go @@ -0,0 +1,96 @@ +package privatedns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/set" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourcePrivateDnsAaaaRecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourcePrivateDnsAAAARecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "records": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, + Set: set.HashIPv6Address, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourcePrivateDnsAAAARecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).PrivateDns.RecordSetsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeAAAA, d.Get("name").(string)) + + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.PrivateZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.Ttl) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("records", flattenAzureRmPrivateDnsAaaaRecords(props.AaaaRecords)); err != nil { + return fmt.Errorf("setting `records`: %+v", err) + } + + return tags.FlattenAndSet(d, props.Metadata) + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_aaaa_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_aaaa_record_resource.go index 8824675b80f..c58eaed50d1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_aaaa_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_aaaa_record_resource.go @@ -5,12 +5,14 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -46,12 +48,16 @@ func resourcePrivateDnsAaaaRecord() *pluginsdk.Resource { ForceNew: true, }, + // TODO: in 4.0 make `name` case sensitive and replace `resource_group_name` and `zone_name` with `private_zone_id` + // TODO: make this case sensitive once the API's fixed https://github.com/Azure/azure-rest-api-specs/issues/6641 "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), "zone_name": { - Type: pluginsdk.TypeString, - Required: true, + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, }, "records": { @@ -71,7 +77,7 @@ func resourcePrivateDnsAaaaRecord() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -99,7 +105,7 @@ func resourcePrivateDnsAaaaRecordCreateUpdate(d *pluginsdk.ResourceData, meta in parameters := recordsets.RecordSet{ Name: utils.String(id.RelativeRecordSetName), Properties: &recordsets.RecordSetProperties{ - Metadata: expandTags(d.Get("tags").(map[string]interface{})), + Metadata: tags.Expand(d.Get("tags").(map[string]interface{})), Ttl: utils.Int64(int64(d.Get("ttl").(int))), AaaaRecords: expandAzureRmPrivateDnsAaaaRecords(d), }, @@ -149,7 +155,7 @@ func resourcePrivateDnsAaaaRecordRead(d *pluginsdk.ResourceData, meta interface{ return err } - return tags.FlattenAndSet(d, flattenTags(props.Metadata)) + return tags.FlattenAndSet(d, props.Metadata) } } @@ -182,11 +188,11 @@ func flattenAzureRmPrivateDnsAaaaRecords(records *[]recordsets.AaaaRecord) []str } for _, record := range *records { - if record.Ipv6Address == nil { + if record.IPv6Address == nil { continue } - results = append(results, *record.Ipv6Address) + results = append(results, *record.IPv6Address) } return results @@ -199,7 +205,7 @@ func expandAzureRmPrivateDnsAaaaRecords(d *pluginsdk.ResourceData) *[]recordsets for i, v := range recordStrings { ipv6 := v.(string) records[i] = recordsets.AaaaRecord{ - Ipv6Address: &ipv6, + IPv6Address: &ipv6, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_cname_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_cname_record_data_source.go new file mode 100644 index 00000000000..18f1b5a21fb --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_cname_record_data_source.go @@ -0,0 +1,101 @@ +package privatedns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourcePrivateDnsCNameRecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourcePrivateDnsCNameRecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "record": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "target_resource_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourcePrivateDnsCNameRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).PrivateDns.RecordSetsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeCNAME, d.Get("name").(string)) + + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.PrivateZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.Ttl) + d.Set("fqdn", props.Fqdn) + + cname := "" + if props.CnameRecord != nil && props.CnameRecord.Cname != nil { + cname = *props.CnameRecord.Cname + } + d.Set("record", cname) + + return tags.FlattenAndSet(d, props.Metadata) + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_cname_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_cname_record_resource.go index 10e6eaa7ad9..195a1f7be16 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_cname_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_cname_record_resource.go @@ -5,12 +5,13 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -50,6 +51,8 @@ func resourcePrivateDnsCNameRecord() *pluginsdk.Resource { ValidateFunc: validate.LowerCasedString, }, + // TODO: in 4.0 make `name` case sensitive and replace `resource_group_name` and `zone_name` with `private_zone_id` + // TODO: make this case sensitive once the API's fixed https://github.com/Azure/azure-rest-api-specs/issues/6641 "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), @@ -77,7 +80,7 @@ func resourcePrivateDnsCNameRecord() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -105,7 +108,7 @@ func resourcePrivateDnsCNameRecordCreateUpdate(d *pluginsdk.ResourceData, meta i parameters := recordsets.RecordSet{ Name: utils.String(id.RelativeRecordSetName), Properties: &recordsets.RecordSetProperties{ - Metadata: expandTags(d.Get("tags").(map[string]interface{})), + Metadata: tags.Expand(d.Get("tags").(map[string]interface{})), Ttl: utils.Int64(int64(d.Get("ttl").(int))), CnameRecord: &recordsets.CnameRecord{ Cname: utils.String(d.Get("record").(string)), @@ -158,7 +161,7 @@ func resourcePrivateDnsCNameRecordRead(d *pluginsdk.ResourceData, meta interface d.Set("record", record.Cname) } - return tags.FlattenAndSet(d, flattenTags(props.Metadata)) + return tags.FlattenAndSet(d, props.Metadata) } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_mx_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_mx_record_data_source.go new file mode 100644 index 00000000000..74114ebd393 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_mx_record_data_source.go @@ -0,0 +1,106 @@ +package privatedns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourcePrivateDnsMxRecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourcePrivateDnsMxRecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Optional: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "record": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "preference": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "exchange": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + Set: resourcePrivateDnsMxRecordHash, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourcePrivateDnsMxRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).PrivateDns.RecordSetsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeMX, d.Get("name").(string)) + + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.PrivateZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.Ttl) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("record", flattenAzureRmPrivateDnsMxRecords(props.MxRecords)); err != nil { + return err + } + + return tags.FlattenAndSet(d, props.Metadata) + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_mx_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_mx_record_resource.go index cd6b0af7c66..baacaf37710 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_mx_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_mx_record_resource.go @@ -1,16 +1,18 @@ package privatedns import ( + "bytes" "fmt" "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -52,6 +54,8 @@ func resourcePrivateDnsMxRecord() *pluginsdk.Resource { ValidateFunc: validate.LowerCasedString, }, + // TODO: in 4.0 make `name` case sensitive and replace `resource_group_name` and `zone_name` with `private_zone_id` + // TODO: make this case sensitive once the API's fixed https://github.com/Azure/azure-rest-api-specs/issues/6641 "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), @@ -93,7 +97,7 @@ func resourcePrivateDnsMxRecord() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -121,7 +125,7 @@ func resourcePrivateDnsMxRecordCreateUpdate(d *pluginsdk.ResourceData, meta inte parameters := recordsets.RecordSet{ Name: utils.String(id.RelativeRecordSetName), Properties: &recordsets.RecordSetProperties{ - Metadata: expandTags(d.Get("tags").(map[string]interface{})), + Metadata: tags.Expand(d.Get("tags").(map[string]interface{})), Ttl: utils.Int64(int64(d.Get("ttl").(int))), MxRecords: expandAzureRmPrivateDnsMxRecords(d), }, @@ -172,7 +176,7 @@ func resourcePrivateDnsMxRecordRead(d *pluginsdk.ResourceData, meta interface{}) return err } - return tags.FlattenAndSet(d, flattenTags(props.Metadata)) + return tags.FlattenAndSet(d, props.Metadata) } } @@ -237,3 +241,14 @@ func expandAzureRmPrivateDnsMxRecords(d *pluginsdk.ResourceData) *[]recordsets.M return &records } + +func resourcePrivateDnsMxRecordHash(v interface{}) int { + var buf bytes.Buffer + + if m, ok := v.(map[string]interface{}); ok { + buf.WriteString(fmt.Sprintf("%d-", m["preference"].(int))) + buf.WriteString(fmt.Sprintf("%s-", m["exchange"].(string))) + } + + return pluginsdk.HashString(buf.String()) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_ptr_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_ptr_record_data_source.go new file mode 100644 index 00000000000..810d513a56d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_ptr_record_data_source.go @@ -0,0 +1,95 @@ +package privatedns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourcePrivateDnsPtrRecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourcePrivateDnsPtrRecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "records": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, + Set: pluginsdk.HashString, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourcePrivateDnsPtrRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).PrivateDns.RecordSetsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypePTR, d.Get("name").(string)) + + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.PrivateZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.Ttl) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("records", flattenAzureRmPrivateDnsPtrRecords(props.PtrRecords)); err != nil { + return err + } + + return tags.FlattenAndSet(d, props.Metadata) + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_ptr_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_ptr_record_resource.go index ad46a2e78f2..8dcccb2dd7d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_ptr_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_ptr_record_resource.go @@ -5,12 +5,13 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -50,6 +51,8 @@ func resourcePrivateDnsPtrRecord() *pluginsdk.Resource { ValidateFunc: validate.LowerCasedString, }, + // TODO: in 4.0 make `name` case sensitive and replace `resource_group_name` and `zone_name` with `private_zone_id` + // TODO: make this case sensitive once the API's fixed https://github.com/Azure/azure-rest-api-specs/issues/6641 "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), @@ -78,7 +81,7 @@ func resourcePrivateDnsPtrRecord() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -106,7 +109,7 @@ func resourcePrivateDnsPtrRecordCreateUpdate(d *pluginsdk.ResourceData, meta int parameters := recordsets.RecordSet{ Name: utils.String(id.RelativeRecordSetName), Properties: &recordsets.RecordSetProperties{ - Metadata: expandTags(d.Get("tags").(map[string]interface{})), + Metadata: tags.Expand(d.Get("tags").(map[string]interface{})), Ttl: utils.Int64(int64(d.Get("ttl").(int))), PtrRecords: expandAzureRmPrivateDnsPtrRecords(d), }, @@ -158,7 +161,7 @@ func resourcePrivateDnsPtrRecordRead(d *pluginsdk.ResourceData, meta interface{} } } - return tags.FlattenAndSet(d, flattenTags(props.Metadata)) + return tags.FlattenAndSet(d, props.Metadata) } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_soa_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_soa_record_data_source.go new file mode 100644 index 00000000000..614ae5258ef --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_soa_record_data_source.go @@ -0,0 +1,129 @@ +package privatedns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourcePrivateDnsSoaRecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourcePrivateDnsSoaRecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Optional: true, + Default: "@", + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "email": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "host_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "expire_time": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "minimum_ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "refresh_time": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "retry_time": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "serial_number": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourcePrivateDnsSoaRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).PrivateDns.RecordSetsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeSOA, "@") + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.PrivateZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.Ttl) + d.Set("fqdn", props.Fqdn) + + if soaRecord := props.SoaRecord; soaRecord != nil { + d.Set("email", soaRecord.Email) + d.Set("host_name", soaRecord.Host) + d.Set("expire_time", soaRecord.ExpireTime) + d.Set("minimum_ttl", soaRecord.MinimumTtl) + d.Set("refresh_time", soaRecord.RefreshTime) + d.Set("retry_time", soaRecord.RetryTime) + d.Set("serial_number", soaRecord.SerialNumber) + } + + return tags.FlattenAndSet(d, props.Metadata) + } + + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_srv_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_srv_record_data_source.go new file mode 100644 index 00000000000..db4e79146ba --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_srv_record_data_source.go @@ -0,0 +1,116 @@ +package privatedns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourcePrivateDnsSrvRecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourcePrivateDnsSrvRecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "record": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "priority": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "weight": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "port": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "target": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + Set: resourcePrivateDnsSrvRecordHash, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourcePrivateDnsSrvRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).PrivateDns.RecordSetsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeSRV, d.Get("name").(string)) + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.PrivateZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.Ttl) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("record", flattenAzureRmPrivateDnsSrvRecords(props.SrvRecords)); err != nil { + return err + } + + return tags.FlattenAndSet(d, props.Metadata) + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_srv_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_srv_record_resource.go index dad85577e9c..24873f3bd75 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_srv_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_srv_record_resource.go @@ -1,16 +1,18 @@ package privatedns import ( + "bytes" "fmt" "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -50,6 +52,8 @@ func resourcePrivateDnsSrvRecord() *pluginsdk.Resource { ValidateFunc: validate.LowerCasedString, }, + // TODO: in 4.0 make `name` case sensitive and replace `resource_group_name` and `zone_name` with `private_zone_id` + // TODO: make this case sensitive once the API's fixed https://github.com/Azure/azure-rest-api-specs/issues/6641 "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), @@ -103,7 +107,7 @@ func resourcePrivateDnsSrvRecord() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -131,7 +135,7 @@ func resourcePrivateDnsSrvRecordCreateUpdate(d *pluginsdk.ResourceData, meta int parameters := recordsets.RecordSet{ Name: utils.String(id.RelativeRecordSetName), Properties: &recordsets.RecordSetProperties{ - Metadata: expandTags(d.Get("tags").(map[string]interface{})), + Metadata: tags.Expand(d.Get("tags").(map[string]interface{})), Ttl: utils.Int64(int64(d.Get("ttl").(int))), SrvRecords: expandAzureRmPrivateDnsSrvRecords(d), }, @@ -180,7 +184,7 @@ func resourcePrivateDnsSrvRecordRead(d *pluginsdk.ResourceData, meta interface{} return err } - return tags.FlattenAndSet(d, flattenTags(props.Metadata)) + return tags.FlattenAndSet(d, props.Metadata) } } @@ -249,3 +253,16 @@ func expandAzureRmPrivateDnsSrvRecords(d *pluginsdk.ResourceData) *[]recordsets. return &records } + +func resourcePrivateDnsSrvRecordHash(v interface{}) int { + var buf bytes.Buffer + + if m, ok := v.(map[string]interface{}); ok { + buf.WriteString(fmt.Sprintf("%d-", m["priority"].(int))) + buf.WriteString(fmt.Sprintf("%d-", m["weight"].(int))) + buf.WriteString(fmt.Sprintf("%d-", m["port"].(int))) + buf.WriteString(fmt.Sprintf("%s-", m["target"].(string))) + } + + return pluginsdk.HashString(buf.String()) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_txt_record_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_txt_record_data_source.go new file mode 100644 index 00000000000..e95913ac01a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_txt_record_data_source.go @@ -0,0 +1,102 @@ +package privatedns + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourcePrivateDnsTxtRecord() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourcePrivateDnsTxtRecordRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupNameForDataSource(), + + "zone_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "record": { + Type: pluginsdk.TypeSet, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "value": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + + "ttl": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "tags": commonschema.TagsDataSource(), + }, + } +} + +func dataSourcePrivateDnsTxtRecordRead(d *pluginsdk.ResourceData, meta interface{}) error { + recordSetsClient := meta.(*clients.Client).PrivateDns.RecordSetsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + + id := recordsets.NewRecordTypeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("zone_name").(string), recordsets.RecordTypeTXT, d.Get("name").(string)) + + resp, err := recordSetsClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("reading %s: %+v", id, err) + } + + d.SetId(id.ID()) + + d.Set("name", id.RelativeRecordSetName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("zone_name", id.PrivateZoneName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("ttl", props.Ttl) + d.Set("fqdn", props.Fqdn) + + if err := d.Set("record", flattenAzureRmPrivateDnsTxtRecords(props.TxtRecords)); err != nil { + return err + } + + return tags.FlattenAndSet(d, props.Metadata) + + } + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_txt_record_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_txt_record_resource.go index ca65864f496..60da922cbab 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_txt_record_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_txt_record_resource.go @@ -6,12 +6,13 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -50,6 +51,8 @@ func resourcePrivateDnsTxtRecord() *pluginsdk.Resource { ValidateFunc: validate.LowerCasedString, }, + // TODO: in 4.0 make `name` case sensitive and replace `resource_group_name` and `zone_name` with `private_zone_id` + // TODO: make this case sensitive once the API's fixed https://github.com/Azure/azure-rest-api-specs/issues/6641 "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), @@ -85,7 +88,7 @@ func resourcePrivateDnsTxtRecord() *pluginsdk.Resource { Computed: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -113,7 +116,7 @@ func resourcePrivateDnsTxtRecordCreateUpdate(d *pluginsdk.ResourceData, meta int parameters := recordsets.RecordSet{ Name: utils.String(id.RelativeRecordSetName), Properties: &recordsets.RecordSetProperties{ - Metadata: expandTags(d.Get("tags").(map[string]interface{})), + Metadata: tags.Expand(d.Get("tags").(map[string]interface{})), Ttl: utils.Int64(int64(d.Get("ttl").(int))), TxtRecords: expandAzureRmPrivateDnsTxtRecords(d), }, @@ -164,7 +167,7 @@ func resourcePrivateDnsTxtRecordRead(d *pluginsdk.ResourceData, meta interface{} return fmt.Errorf("setting `record`: %+v", err) } - return tags.FlattenAndSet(d, flattenTags(props.Metadata)) + return tags.FlattenAndSet(d, props.Metadata) } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_zone_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_zone_data_source.go index 4d14375fb03..6e112d3b3ef 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_zone_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_zone_data_source.go @@ -5,13 +5,12 @@ import ( "fmt" "time" - "github.com/hashicorp/go-azure-helpers/lang/response" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones" - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2020-06-01/resources" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" ) @@ -56,7 +55,7 @@ func dataSourcePrivateDnsZone() *pluginsdk.Resource { Computed: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.Tags(), }, } } @@ -67,12 +66,10 @@ func dataSourcePrivateDnsZoneRead(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - resourceGroup := d.Get("resource_group_name").(string) - id := privatezones.NewPrivateDnsZoneID(subscriptionId, resourceGroup, name) + id := privatezones.NewPrivateDnsZoneID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) var resp *privatezones.PrivateZone - if resourceGroup != "" { + if id.ResourceGroupName != "" { zone, err := client.Get(ctx, id) if err != nil || zone.Model == nil { if response.WasNotFound(zone.HttpResponse) { @@ -84,23 +81,23 @@ func dataSourcePrivateDnsZoneRead(d *pluginsdk.ResourceData, meta interface{}) e } else { resourcesClient := meta.(*clients.Client).Resource.ResourcesClient - zone, err := findPrivateZone(ctx, client, resourcesClient, name) + zone, err := findPrivateZone(ctx, client, resourcesClient, id.PrivateZoneName) if err != nil { return err } if zone == nil { - return fmt.Errorf("Private DNS Zone %q was not found", name) + return fmt.Errorf("%s was not found", id) } resp = &zone.zone - resourceGroup = zone.resourceGroup + id.ResourceGroupName = zone.resourceGroup } d.SetId(id.ID()) - d.Set("name", name) - d.Set("resource_group_name", resourceGroup) + d.Set("name", id.PrivateZoneName) + d.Set("resource_group_name", id.ResourceGroupName) if props := resp.Properties; props != nil { d.Set("number_of_record_sets", props.NumberOfRecordSets) @@ -109,7 +106,7 @@ func dataSourcePrivateDnsZoneRead(d *pluginsdk.ResourceData, meta interface{}) e d.Set("max_number_of_virtual_network_links_with_registration", props.MaxNumberOfVirtualNetworkLinksWithRegistration) } - return tags.FlattenAndSet(d, flattenTags(resp.Tags)) + return tags.FlattenAndSet(d, resp.Tags) } type privateDnsZone struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_zone_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_zone_resource.go index 357581d6471..765e6bb671f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_zone_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_zone_resource.go @@ -6,13 +6,14 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets" "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -44,6 +45,9 @@ func resourcePrivateDnsZone() *pluginsdk.Resource { ForceNew: true, }, + // TODO: this can become case-sensitive with a state migration + "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), + "number_of_record_sets": { Type: pluginsdk.TypeInt, Computed: true, @@ -64,8 +68,6 @@ func resourcePrivateDnsZone() *pluginsdk.Resource { Computed: true, }, - "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), - "soa_record": { Type: pluginsdk.TypeList, MaxItems: 1, @@ -115,7 +117,7 @@ func resourcePrivateDnsZone() *pluginsdk.Resource { ValidateFunc: validation.IntBetween(0, 2147483647), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "fqdn": { Type: pluginsdk.TypeString, @@ -141,7 +143,7 @@ func resourcePrivateDnsZone() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -169,7 +171,7 @@ func resourcePrivateDnsZoneCreateUpdate(d *pluginsdk.ResourceData, meta interfac parameters := privatezones.PrivateZone{ Location: utils.String("global"), - Tags: expandTags(d.Get("tags").(map[string]interface{})), + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } options := privatezones.CreateOrUpdateOperationOptions{ @@ -187,7 +189,7 @@ func resourcePrivateDnsZoneCreateUpdate(d *pluginsdk.ResourceData, meta interfac rsParameters := recordsets.RecordSet{ Properties: &recordsets.RecordSetProperties{ Ttl: utils.Int64(int64(soaRecordRaw["ttl"].(int))), - Metadata: expandTags(soaRecordRaw["tags"].(map[string]interface{})), + Metadata: tags.Expand(soaRecordRaw["tags"].(map[string]interface{})), SoaRecord: soaRecord, }, } @@ -250,7 +252,7 @@ func resourcePrivateDnsZoneRead(d *pluginsdk.ResourceData, meta interface{}) err d.Set("max_number_of_virtual_network_links_with_registration", props.MaxNumberOfVirtualNetworkLinksWithRegistration) } - if err = tags.FlattenAndSet(d, flattenTags(model.Tags)); err != nil { + if err = tags.FlattenAndSet(d, model.Tags); err != nil { return err } } @@ -303,7 +305,7 @@ func flattenPrivateDNSZoneSOARecord(input *recordsets.RecordSet) []interface{} { metaData := make(map[string]interface{}) if input.Properties.Metadata != nil { - metaData = tags.Flatten(flattenTags(input.Properties.Metadata)) + metaData = tags.Flatten(input.Properties.Metadata) } fqdn := "" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_zone_virtual_network_link_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_zone_virtual_network_link_resource.go index ac63f08a3f2..0484f8a31af 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_zone_virtual_network_link_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/private_dns_zone_virtual_network_link_resource.go @@ -6,11 +6,12 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -36,8 +37,8 @@ func resourcePrivateDnsZoneVirtualNetworkLink() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, - // TODO: these can become case-sensitive with a state migration Schema: map[string]*pluginsdk.Schema{ + // TODO: these can become case-sensitive with a state migration "name": { Type: pluginsdk.TypeString, Required: true, @@ -46,6 +47,7 @@ func resourcePrivateDnsZoneVirtualNetworkLink() *pluginsdk.Resource { DiffSuppressFunc: suppress.CaseDifference, }, + // TODO: in 4.0 switch this to `private_dns_zone_id` "private_dns_zone_name": { Type: pluginsdk.TypeString, Required: true, @@ -53,6 +55,9 @@ func resourcePrivateDnsZoneVirtualNetworkLink() *pluginsdk.Resource { ValidateFunc: validation.StringIsNotEmpty, }, + // TODO: make this case sensitive once the API's fixed https://github.com/Azure/azure-rest-api-specs/issues/10933 + "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), + "virtual_network_id": { Type: pluginsdk.TypeString, Required: true, @@ -66,10 +71,7 @@ func resourcePrivateDnsZoneVirtualNetworkLink() *pluginsdk.Resource { Default: false, }, - // TODO: make this case sensitive once the API's fixed https://github.com/Azure/azure-rest-api-specs/issues/10933 - "resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(), - - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -96,7 +98,7 @@ func resourcePrivateDnsZoneVirtualNetworkLinkCreateUpdate(d *pluginsdk.ResourceD parameters := virtualnetworklinks.VirtualNetworkLink{ Location: utils.String("global"), - Tags: expandTags(d.Get("tags").(map[string]interface{})), + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), Properties: &virtualnetworklinks.VirtualNetworkLinkProperties{ VirtualNetwork: &virtualnetworklinks.SubResource{ Id: utils.String(d.Get("virtual_network_id").(string)), @@ -149,7 +151,7 @@ func resourcePrivateDnsZoneVirtualNetworkLinkRead(d *pluginsdk.ResourceData, met d.Set("virtual_network_id", network.Id) } } - return tags.FlattenAndSet(d, flattenTags(model.Tags)) + return tags.FlattenAndSet(d, model.Tags) } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/registration.go index 26035b51507..40b0b0fd421 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/registration.go @@ -25,7 +25,15 @@ func (r Registration) WebsiteCategories() []string { // SupportedDataSources returns the supported Data Sources supported by this Service func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ - "azurerm_private_dns_zone": dataSourcePrivateDnsZone(), + "azurerm_private_dns_zone": dataSourcePrivateDnsZone(), + "azurerm_private_dns_a_record": dataSourcePrivateDnsARecord(), + "azurerm_private_dns_aaaa_record": dataSourcePrivateDnsAaaaRecord(), + "azurerm_private_dns_cname_record": dataSourcePrivateDnsCNameRecord(), + "azurerm_private_dns_mx_record": dataSourcePrivateDnsMxRecord(), + "azurerm_private_dns_ptr_record": dataSourcePrivateDnsPtrRecord(), + "azurerm_private_dns_soa_record": dataSourcePrivateDnsSoaRecord(), + "azurerm_private_dns_srv_record": dataSourcePrivateDnsSrvRecord(), + "azurerm_private_dns_txt_record": dataSourcePrivateDnsTxtRecord(), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/resourceids.go deleted file mode 100644 index d40038268c3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/resourceids.go +++ /dev/null @@ -1,12 +0,0 @@ -package privatedns - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=PrivateDnsZone -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=VirtualNetworkLink -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/virtualNetworkLinks/virtualNetworkLink1 - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ARecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/A/eh1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AaaaRecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/AAAA/eheh1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=CnameRecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/CNAME/name1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=MxRecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/MX/mx1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=PtrRecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/PTR/ptr1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SrvRecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/SRV/srv1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=TxtRecord -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/privateDnsZones/privateDnsZone1/TXT/txt1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_createorupdate_autorest.go deleted file mode 100644 index ee532f1ac4d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_createorupdate_autorest.go +++ /dev/null @@ -1,109 +0,0 @@ -package privatezones - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string - IfNoneMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - if o.IfNoneMatch != nil { - out["If-None-Match"] = *o.IfNoneMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c PrivateZonesClient) CreateOrUpdate(ctx context.Context, id PrivateDnsZoneId, input PrivateZone, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c PrivateZonesClient) CreateOrUpdateThenPoll(ctx context.Context, id PrivateDnsZoneId, input PrivateZone, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c PrivateZonesClient) preparerForCreateOrUpdate(ctx context.Context, id PrivateDnsZoneId, input PrivateZone, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c PrivateZonesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_delete_autorest.go deleted file mode 100644 index f5d377c8533..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_delete_autorest.go +++ /dev/null @@ -1,103 +0,0 @@ -package privatezones - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c PrivateZonesClient) Delete(ctx context.Context, id PrivateDnsZoneId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c PrivateZonesClient) DeleteThenPoll(ctx context.Context, id PrivateDnsZoneId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c PrivateZonesClient) preparerForDelete(ctx context.Context, id PrivateDnsZoneId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c PrivateZonesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_get_autorest.go deleted file mode 100644 index fd266062119..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package privatezones - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *PrivateZone -} - -// Get ... -func (c PrivateZonesClient) Get(ctx context.Context, id PrivateDnsZoneId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c PrivateZonesClient) preparerForGet(ctx context.Context, id PrivateDnsZoneId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c PrivateZonesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_list_autorest.go deleted file mode 100644 index 6850757c71b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_list_autorest.go +++ /dev/null @@ -1,213 +0,0 @@ -package privatezones - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]PrivateZone - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []PrivateZone -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c PrivateZonesClient) List(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c PrivateZonesClient) ListComplete(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, PrivateZoneOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c PrivateZonesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions, predicate PrivateZoneOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]PrivateZone, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForList prepares the List request. -func (c PrivateZonesClient) preparerForList(ctx context.Context, id commonids.SubscriptionId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/privateDnsZones", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c PrivateZonesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c PrivateZonesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []PrivateZone `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_listbyresourcegroup_autorest.go deleted file mode 100644 index a947c4fbf5d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,213 +0,0 @@ -package privatezones - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -type ListByResourceGroupOperationResponse struct { - HttpResponse *http.Response - Model *[]PrivateZone - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []PrivateZone -} - -func (r ListByResourceGroupOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByResourceGroupOperationOptions struct { - Top *int64 -} - -func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { - return ListByResourceGroupOperationOptions{} -} - -func (o ListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByResourceGroup ... -func (c PrivateZonesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c PrivateZonesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, PrivateZoneOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c PrivateZonesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate PrivateZoneOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]PrivateZone, 0) - - page, err := c.ListByResourceGroup(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c PrivateZonesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/privateDnsZones", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c PrivateZonesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c PrivateZonesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []PrivateZone `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_update_autorest.go deleted file mode 100644 index 0b452de5ffa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones/method_update_autorest.go +++ /dev/null @@ -1,104 +0,0 @@ -package privatezones - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type UpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c PrivateZonesClient) Update(ctx context.Context, id PrivateDnsZoneId, input PrivateZone, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "privatezones.PrivateZonesClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c PrivateZonesClient) UpdateThenPoll(ctx context.Context, id PrivateDnsZoneId, input PrivateZone, options UpdateOperationOptions) error { - result, err := c.Update(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c PrivateZonesClient) preparerForUpdate(ctx context.Context, id PrivateDnsZoneId, input PrivateZone, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c PrivateZonesClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/id_recordtype.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/id_recordtype.go deleted file mode 100644 index dda0d1ebe4a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/id_recordtype.go +++ /dev/null @@ -1,164 +0,0 @@ -package recordsets - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = RecordTypeId{} - -// RecordTypeId is a struct representing the Resource ID for a Record Type -type RecordTypeId struct { - SubscriptionId string - ResourceGroupName string - PrivateZoneName string - RecordType RecordType - RelativeRecordSetName string -} - -// NewRecordTypeID returns a new RecordTypeId struct -func NewRecordTypeID(subscriptionId string, resourceGroupName string, privateZoneName string, recordType RecordType, relativeRecordSetName string) RecordTypeId { - return RecordTypeId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - PrivateZoneName: privateZoneName, - RecordType: recordType, - RelativeRecordSetName: relativeRecordSetName, - } -} - -// ParseRecordTypeID parses 'input' into a RecordTypeId -func ParseRecordTypeID(input string) (*RecordTypeId, error) { - parser := resourceids.NewParserFromResourceIdType(RecordTypeId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := RecordTypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { - return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) - } - - if v, constFound := parsed.Parsed["recordType"]; true { - if !constFound { - return nil, fmt.Errorf("the segment 'recordType' was not found in the resource id %q", input) - } - - recordType, err := parseRecordType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.RecordType = *recordType - } - - if id.RelativeRecordSetName, ok = parsed.Parsed["relativeRecordSetName"]; !ok { - return nil, fmt.Errorf("the segment 'relativeRecordSetName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseRecordTypeIDInsensitively parses 'input' case-insensitively into a RecordTypeId -// note: this method should only be used for API response data and not user input -func ParseRecordTypeIDInsensitively(input string) (*RecordTypeId, error) { - parser := resourceids.NewParserFromResourceIdType(RecordTypeId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := RecordTypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.PrivateZoneName, ok = parsed.Parsed["privateZoneName"]; !ok { - return nil, fmt.Errorf("the segment 'privateZoneName' was not found in the resource id %q", input) - } - - if v, constFound := parsed.Parsed["recordType"]; true { - if !constFound { - return nil, fmt.Errorf("the segment 'recordType' was not found in the resource id %q", input) - } - - recordType, err := parseRecordType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.RecordType = *recordType - } - - if id.RelativeRecordSetName, ok = parsed.Parsed["relativeRecordSetName"]; !ok { - return nil, fmt.Errorf("the segment 'relativeRecordSetName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateRecordTypeID checks that 'input' can be parsed as a Record Type ID -func ValidateRecordTypeID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseRecordTypeID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Record Type ID -func (id RecordTypeId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/privateDnsZones/%s/%s/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateZoneName, string(id.RecordType), id.RelativeRecordSetName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Record Type ID -func (id RecordTypeId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetwork", "Microsoft.Network", "Microsoft.Network"), - resourceids.StaticSegment("staticPrivateDnsZones", "privateDnsZones", "privateDnsZones"), - resourceids.UserSpecifiedSegment("privateZoneName", "privateZoneValue"), - resourceids.ConstantSegment("recordType", PossibleValuesForRecordType(), "A"), - resourceids.UserSpecifiedSegment("relativeRecordSetName", "relativeRecordSetValue"), - } -} - -// String returns a human-readable description of this Record Type ID -func (id RecordTypeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Private Zone Name: %q", id.PrivateZoneName), - fmt.Sprintf("Record Type: %q", string(id.RecordType)), - fmt.Sprintf("Relative Record Set Name: %q", id.RelativeRecordSetName), - } - return fmt.Sprintf("Record Type (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_createorupdate_autorest.go deleted file mode 100644 index ae54ed8b2b5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_createorupdate_autorest.go +++ /dev/null @@ -1,99 +0,0 @@ -package recordsets - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - Model *RecordSet -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string - IfNoneMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - if o.IfNoneMatch != nil { - out["If-None-Match"] = *o.IfNoneMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c RecordSetsClient) CreateOrUpdate(ctx context.Context, id RecordTypeId, input RecordSet, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c RecordSetsClient) preparerForCreateOrUpdate(ctx context.Context, id RecordTypeId, input RecordSet, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c RecordSetsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_delete_autorest.go deleted file mode 100644 index ca1992e45b9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_delete_autorest.go +++ /dev/null @@ -1,91 +0,0 @@ -package recordsets - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c RecordSetsClient) Delete(ctx context.Context, id RecordTypeId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c RecordSetsClient) preparerForDelete(ctx context.Context, id RecordTypeId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c RecordSetsClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_get_autorest.go deleted file mode 100644 index 70ccc38344e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package recordsets - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *RecordSet -} - -// Get ... -func (c RecordSetsClient) Get(ctx context.Context, id RecordTypeId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c RecordSetsClient) preparerForGet(ctx context.Context, id RecordTypeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c RecordSetsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_list_autorest.go deleted file mode 100644 index 2cadb884829..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_list_autorest.go +++ /dev/null @@ -1,217 +0,0 @@ -package recordsets - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]RecordSet - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []RecordSet -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Recordsetnamesuffix *string - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Recordsetnamesuffix != nil { - out["$recordsetnamesuffix"] = *o.Recordsetnamesuffix - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c RecordSetsClient) List(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c RecordSetsClient) ListComplete(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, RecordSetOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c RecordSetsClient) ListCompleteMatchingPredicate(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions, predicate RecordSetOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]RecordSet, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForList prepares the List request. -func (c RecordSetsClient) preparerForList(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/aLL", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c RecordSetsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c RecordSetsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []RecordSet `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_listbytype_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_listbytype_autorest.go deleted file mode 100644 index 8ccea054102..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_listbytype_autorest.go +++ /dev/null @@ -1,217 +0,0 @@ -package recordsets - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByTypeOperationResponse struct { - HttpResponse *http.Response - Model *[]RecordSet - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByTypeOperationResponse, error) -} - -type ListByTypeCompleteResult struct { - Items []RecordSet -} - -func (r ListByTypeOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByTypeOperationResponse) LoadMore(ctx context.Context) (resp ListByTypeOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByTypeOperationOptions struct { - Recordsetnamesuffix *string - Top *int64 -} - -func DefaultListByTypeOperationOptions() ListByTypeOperationOptions { - return ListByTypeOperationOptions{} -} - -func (o ListByTypeOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByTypeOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Recordsetnamesuffix != nil { - out["$recordsetnamesuffix"] = *o.Recordsetnamesuffix - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// ListByType ... -func (c RecordSetsClient) ListByType(ctx context.Context, id PrivateZoneId, options ListByTypeOperationOptions) (resp ListByTypeOperationResponse, err error) { - req, err := c.preparerForListByType(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByType(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByTypeComplete retrieves all of the results into a single object -func (c RecordSetsClient) ListByTypeComplete(ctx context.Context, id PrivateZoneId, options ListByTypeOperationOptions) (ListByTypeCompleteResult, error) { - return c.ListByTypeCompleteMatchingPredicate(ctx, id, options, RecordSetOperationPredicate{}) -} - -// ListByTypeCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c RecordSetsClient) ListByTypeCompleteMatchingPredicate(ctx context.Context, id PrivateZoneId, options ListByTypeOperationOptions, predicate RecordSetOperationPredicate) (resp ListByTypeCompleteResult, err error) { - items := make([]RecordSet, 0) - - page, err := c.ListByType(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByTypeCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByType prepares the ListByType request. -func (c RecordSetsClient) preparerForListByType(ctx context.Context, id PrivateZoneId, options ListByTypeOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByTypeWithNextLink prepares the ListByType request with the given nextLink token. -func (c RecordSetsClient) preparerForListByTypeWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByType handles the response to the ListByType request. The method always -// closes the http.Response Body. -func (c RecordSetsClient) responderForListByType(resp *http.Response) (result ListByTypeOperationResponse, err error) { - type page struct { - Values []RecordSet `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByTypeOperationResponse, err error) { - req, err := c.preparerForListByTypeWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByType(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "ListByType", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_update_autorest.go deleted file mode 100644 index fc4a5342e91..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/method_update_autorest.go +++ /dev/null @@ -1,94 +0,0 @@ -package recordsets - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *RecordSet -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c RecordSetsClient) Update(ctx context.Context, id RecordTypeId, input RecordSet, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "recordsets.RecordSetsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c RecordSetsClient) preparerForUpdate(ctx context.Context, id RecordTypeId, input RecordSet, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c RecordSetsClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_aaaarecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_aaaarecord.go deleted file mode 100644 index c007fff4683..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_aaaarecord.go +++ /dev/null @@ -1,8 +0,0 @@ -package recordsets - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AaaaRecord struct { - Ipv6Address *string `json:"ipv6Address,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_arecord.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_arecord.go deleted file mode 100644 index 14d4f6ca848..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets/model_arecord.go +++ /dev/null @@ -1,8 +0,0 @@ -package recordsets - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ARecord struct { - Ipv4Address *string `json:"ipv4Address,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/method_createorupdate_autorest.go deleted file mode 100644 index 876a1bc40c8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/method_createorupdate_autorest.go +++ /dev/null @@ -1,109 +0,0 @@ -package virtualnetworklinks - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type CreateOrUpdateOperationOptions struct { - IfMatch *string - IfNoneMatch *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - if o.IfNoneMatch != nil { - out["If-None-Match"] = *o.IfNoneMatch - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c VirtualNetworkLinksClient) CreateOrUpdate(ctx context.Context, id VirtualNetworkLinkId, input VirtualNetworkLink, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c VirtualNetworkLinksClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualNetworkLinkId, input VirtualNetworkLink, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c VirtualNetworkLinksClient) preparerForCreateOrUpdate(ctx context.Context, id VirtualNetworkLinkId, input VirtualNetworkLink, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c VirtualNetworkLinksClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/method_delete_autorest.go deleted file mode 100644 index 4357d3bba19..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/method_delete_autorest.go +++ /dev/null @@ -1,103 +0,0 @@ -package virtualnetworklinks - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - IfMatch *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c VirtualNetworkLinksClient) Delete(ctx context.Context, id VirtualNetworkLinkId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c VirtualNetworkLinksClient) DeleteThenPoll(ctx context.Context, id VirtualNetworkLinkId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c VirtualNetworkLinksClient) preparerForDelete(ctx context.Context, id VirtualNetworkLinkId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c VirtualNetworkLinksClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/method_get_autorest.go deleted file mode 100644 index 2f94e36bc0f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package virtualnetworklinks - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *VirtualNetworkLink -} - -// Get ... -func (c VirtualNetworkLinksClient) Get(ctx context.Context, id VirtualNetworkLinkId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c VirtualNetworkLinksClient) preparerForGet(ctx context.Context, id VirtualNetworkLinkId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c VirtualNetworkLinksClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/method_list_autorest.go deleted file mode 100644 index f41d29d7fce..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/method_list_autorest.go +++ /dev/null @@ -1,212 +0,0 @@ -package virtualnetworklinks - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListOperationResponse struct { - HttpResponse *http.Response - Model *[]VirtualNetworkLink - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) -} - -type ListCompleteResult struct { - Items []VirtualNetworkLink -} - -func (r ListOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListOperationOptions struct { - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// List ... -func (c VirtualNetworkLinksClient) List(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions) (resp ListOperationResponse, err error) { - req, err := c.preparerForList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c VirtualNetworkLinksClient) ListComplete(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, VirtualNetworkLinkOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c VirtualNetworkLinksClient) ListCompleteMatchingPredicate(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions, predicate VirtualNetworkLinkOperationPredicate) (resp ListCompleteResult, err error) { - items := make([]VirtualNetworkLink, 0) - - page, err := c.List(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForList prepares the List request. -func (c VirtualNetworkLinksClient) preparerForList(ctx context.Context, id PrivateDnsZoneId, options ListOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/virtualNetworkLinks", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c VirtualNetworkLinksClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c VirtualNetworkLinksClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { - type page struct { - Values []VirtualNetworkLink `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/method_update_autorest.go deleted file mode 100644 index d54666fc445..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks/method_update_autorest.go +++ /dev/null @@ -1,104 +0,0 @@ -package virtualnetworklinks - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type UpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type UpdateOperationOptions struct { - IfMatch *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.IfMatch != nil { - out["If-Match"] = *o.IfMatch - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c VirtualNetworkLinksClient) Update(ctx context.Context, id VirtualNetworkLinkId, input VirtualNetworkLink, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "virtualnetworklinks.VirtualNetworkLinksClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c VirtualNetworkLinksClient) UpdateThenPoll(ctx context.Context, id VirtualNetworkLinkId, input VirtualNetworkLink, options UpdateOperationOptions) error { - result, err := c.Update(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c VirtualNetworkLinksClient) preparerForUpdate(ctx context.Context, id VirtualNetworkLinkId, input VirtualNetworkLink, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c VirtualNetworkLinksClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/transition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/transition.go deleted file mode 100644 index 58411c2ccaa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/transition.go +++ /dev/null @@ -1,23 +0,0 @@ -package privatedns - -import "github.com/hashicorp/terraform-provider-azurerm/utils" - -func expandTags(input map[string]interface{}) *map[string]string { - output := make(map[string]string) - for k, v := range input { - output[k] = v.(string) - } - return &output -} - -func flattenTags(input *map[string]string) map[string]*string { - output := make(map[string]*string) - - if input != nil { - for k, v := range *input { - output[k] = utils.String(v) - } - } - - return output -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/validate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/validate.go deleted file mode 100644 index 72d502ed618..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/validate.go +++ /dev/null @@ -1,32 +0,0 @@ -package privatedns - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" -) - -func ValidatePrivateDnsZoneGroupName(i interface{}, k string) (_ []string, errors []error) { - v, ok := i.(string) - if !ok { - return nil, append(errors, fmt.Errorf("expected type of %s to be string", k)) - } - - // The name attribute rules per the Nat Gateway service team are (Friday, October 18, 2019 4:20 PM): - // 1. Must not be empty. - // 2. Must be between 1 and 80 characters. - // 3. The attribute must: - // a) begin with a letter or number - // b) end with a letter, number or underscore - // c) may contain only letters, numbers, underscores, periods, or hyphens. - - if len(v) == 1 { - if m, _ := validate.RegExHelper(i, k, `^([a-zA-Z\d])`); !m { - errors = append(errors, fmt.Errorf("%s must begin with a letter or number", k)) - } - } else if m, _ := validate.RegExHelper(i, k, `^([a-zA-Z\d])([a-zA-Z\d-\_\.]{0,78})([a-zA-Z\d\_])$`); !m { - errors = append(errors, fmt.Errorf("%s must be between 1 - 80 characters long, begin with a letter or number, end with a letter, number or underscore, and may contain only letters, numbers, periods, hyphens or underscores", k)) - } - - return nil, errors -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/client/client.go index 8e3d14deba5..34b1964caae 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/client/client.go @@ -1,16 +1,16 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview" + "github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - AccountsClient *purview.AccountsClient + AccountsClient *account.AccountClient } func NewClient(o *common.ClientOptions) *Client { - accountsClient := purview.NewAccountsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + accountsClient := account.NewAccountClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&accountsClient.Client, o.ResourceManagerAuthorizer) return &Client{ diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/parse/account.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/parse/account.go deleted file mode 100644 index 50596c99854..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/parse/account.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type AccountId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewAccountID(subscriptionId, resourceGroup, name string) AccountId { - return AccountId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id AccountId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Account", segmentsStr) -} - -func (id AccountId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Purview/accounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// AccountID parses a Account ID into an AccountId struct -func AccountID(input string) (*AccountId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := AccountId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("accounts"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/purview_account_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/purview_account_resource.go index a603357a10b..6fcdd2f9a9a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/purview_account_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/purview_account_resource.go @@ -5,16 +5,16 @@ import ( "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -29,7 +29,7 @@ func resourcePurviewAccount() *pluginsdk.Resource { Delete: resourcePurviewAccountDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.AccountID(id) + _, err := account.ParseAccountID(id) return err }), @@ -50,55 +50,47 @@ func resourcePurviewAccountCreateUpdate(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - location := azure.NormalizeLocation(d.Get("location").(string)) - t := d.Get("tags").(map[string]interface{}) - - id := parse.NewAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := account.NewAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_purview_account", id.ID()) } } - account := purview.Account{ - AccountProperties: &purview.AccountProperties{}, - Location: &location, - Tags: tags.Expand(t), + purviewAccount := account.Account{ + Properties: &account.AccountProperties{}, + Location: utils.String(azure.NormalizeLocation(d.Get("location").(string))), + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - expandedIdentity, err := expandIdentity(d.Get("identity").([]interface{})) + expandedIdentity, err := identity.ExpandSystemOrUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } - account.Identity = expandedIdentity + purviewAccount.Identity = expandedIdentity + publicNetworkAccessEnabled := account.PublicNetworkAccessDisabled if d.Get("public_network_enabled").(bool) { - account.AccountProperties.PublicNetworkAccess = purview.PublicNetworkAccessEnabled - } else { - account.AccountProperties.PublicNetworkAccess = purview.PublicNetworkAccessDisabled + publicNetworkAccessEnabled = account.PublicNetworkAccessEnabled } + purviewAccount.Properties.PublicNetworkAccess = &publicNetworkAccessEnabled if v, ok := d.GetOk("managed_resource_group_name"); ok { - account.AccountProperties.ManagedResourceGroupName = utils.String(v.(string)) + purviewAccount.Properties.ManagedResourceGroupName = utils.String(v.(string)) } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, account) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, purviewAccount); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for create/update of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourcePurviewAccountRead(d, meta) } @@ -108,14 +100,14 @@ func resourcePurviewAccountRead(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AccountID(d.Id()) + id, err := account.ParseAccountID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -123,42 +115,61 @@ func resourcePurviewAccountRead(d *pluginsdk.ResourceData, meta interface{}) err return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.AccountName) + d.Set("resource_group_name", id.ResourceGroupName) - if err := d.Set("identity", flattenIdentity(resp.Identity)); err != nil { - return fmt.Errorf("flattening `identity`: %+v", err) - } + if model := resp.Model; model != nil { - if err := d.Set("managed_resources", flattenPurviewAccountManagedResources(resp.ManagedResources)); err != nil { - return fmt.Errorf("flattening `managed_resources`: %+v", err) - } + d.Set("location", location.NormalizeNilable(model.Location)) + + flattenedIdentity, err := identity.FlattenSystemOrUserAssignedMap(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + if err := d.Set("identity", flattenedIdentity); err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } - if props := resp.AccountProperties; props != nil { - d.Set("public_network_enabled", props.PublicNetworkAccess == purview.PublicNetworkAccessEnabled) + if props := model.Properties; props != nil { + if err := d.Set("managed_resources", flattenPurviewAccountManagedResources(props.ManagedResources)); err != nil { + return fmt.Errorf("flattening `managed_resources`: %+v", err) + } - managedResourceGroupName := "" - if props.ManagedResourceGroupName != nil { - managedResourceGroupName = *props.ManagedResourceGroupName + publicNetworkAccessEnabled := false + if props.PublicNetworkAccess != nil { + publicNetworkAccessEnabled = *props.PublicNetworkAccess == account.PublicNetworkAccessEnabled + } + d.Set("public_network_enabled", publicNetworkAccessEnabled) + + managedResourceGroupName := "" + if props.ManagedResourceGroupName != nil { + managedResourceGroupName = *props.ManagedResourceGroupName + } + d.Set("managed_resource_group_name", managedResourceGroupName) + + if endpoints := props.Endpoints; endpoints != nil { + d.Set("catalog_endpoint", endpoints.Catalog) + d.Set("guardian_endpoint", endpoints.Guardian) + d.Set("scan_endpoint", endpoints.Scan) + } } - d.Set("managed_resource_group_name", managedResourceGroupName) - if endpoints := resp.Endpoints; endpoints != nil { - d.Set("catalog_endpoint", endpoints.Catalog) - d.Set("guardian_endpoint", endpoints.Guardian) - d.Set("scan_endpoint", endpoints.Scan) + if err = tags.FlattenAndSet(d, model.Tags); err != nil { + return err } } - keys, err := client.ListKeys(ctx, id.ResourceGroup, id.Name) + keys, err := client.ListKeys(ctx, *id) if err != nil { return fmt.Errorf("retrieving Keys for %s: %+v", *id, err) } - d.Set("atlas_kafka_endpoint_primary_connection_string", keys.AtlasKafkaPrimaryEndpoint) - d.Set("atlas_kafka_endpoint_secondary_connection_string", keys.AtlasKafkaSecondaryEndpoint) - return tags.FlattenAndSet(d, resp.Tags) + if model := keys.Model; model != nil { + d.Set("atlas_kafka_endpoint_primary_connection_string", model.AtlasKafkaPrimaryEndpoint) + d.Set("atlas_kafka_endpoint_secondary_connection_string", model.AtlasKafkaSecondaryEndpoint) + } + + return nil } func resourcePurviewAccountDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -166,53 +177,20 @@ func resourcePurviewAccountDelete(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AccountID(d.Id()) + id, err := account.ParseAccountID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - return nil } -func expandIdentity(input []interface{}) (*purview.Identity, error) { - expanded, err := identity.ExpandSystemAssigned(input) - if err != nil { - return nil, err - } - - return &purview.Identity{ - Type: purview.Type(string(expanded.Type)), - }, nil -} - -func flattenIdentity(input *purview.Identity) interface{} { - var transition *identity.SystemAssigned - - if input != nil { - transition = &identity.SystemAssigned{ - Type: identity.Type(string(input.Type)), - } - if input.PrincipalID != nil { - transition.PrincipalId = *input.PrincipalID - } - if input.TenantID != nil { - transition.TenantId = *input.TenantID - } - } - - return identity.FlattenSystemAssigned(transition) -} - -func flattenPurviewAccountManagedResources(managedResources *purview.AccountPropertiesManagedResources) interface{} { +func flattenPurviewAccountManagedResources(managedResources *account.ManagedResources) interface{} { if managedResources == nil { return make([]interface{}, 0) } @@ -267,7 +245,7 @@ func resourcePurviewSchema() map[string]*pluginsdk.Schema { ValidateFunc: resourcegroups.ValidateName, }, - "identity": commonschema.SystemAssignedIdentityRequired(), + "identity": commonschema.SystemOrUserAssignedIdentityRequired(), "managed_resources": { Type: pluginsdk.TypeList, @@ -317,6 +295,6 @@ func resourcePurviewSchema() map[string]*pluginsdk.Schema { Sensitive: true, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/resourceids.go deleted file mode 100644 index 7e72a4eb176..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/resourceids.go +++ /dev/null @@ -1,3 +0,0 @@ -package purview - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Account -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Purview/accounts/account1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/validate/account_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/validate/account_id.go deleted file mode 100644 index dda8f9bed73..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/validate/account_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/parse" -) - -func AccountID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.AccountID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/backup_policy_vm_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/backup_policy_vm_data_source.go index 039b1f839cf..ec0dc90d045 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/backup_policy_vm_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/backup_policy_vm_data_source.go @@ -46,6 +46,10 @@ func dataSourceBackupPolicyVmRead(d *pluginsdk.ResourceData, meta interface{}) e return fmt.Errorf("making Read request on Backup Policy %q (Resource Group %q): %+v", name, resourceGroup, err) } + if protectionPolicy.ID == nil || *protectionPolicy.ID == "" { + return fmt.Errorf("retrieving Backup Policy VM %q (Vault Name %q /Resource Group %q): ID was nil or empty", name, vaultName, resourceGroup) + } + id := strings.Replace(*protectionPolicy.ID, "Subscriptions", "subscriptions", 1) d.SetId(id) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/backup_policy_vm_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/backup_policy_vm_resource.go index 1efd736e898..80c96013db1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/backup_policy_vm_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/backup_policy_vm_resource.go @@ -178,6 +178,10 @@ func resourceBackupProtectionPolicyVMCreateUpdate(d *pluginsdk.ResourceData, met return err } + if resp.ID == nil || *resp.ID == "" { + return fmt.Errorf("retrieving Backup Policy VM %q (Vault Name %q /Resource Group %q): ID was nil or empty", policyName, vaultName, resourceGroup) + } + id := strings.Replace(*resp.ID, "Subscriptions", "subscriptions", 1) d.SetId(id) @@ -349,6 +353,16 @@ func expandBackupProtectionPolicyVMSchedule(d *pluginsdk.ResourceData, times []d return nil, fmt.Errorf("`hour_duration` must be specified when `backup.0.frequency` is `Hourly`") } + if interval == 0 && duration == 0 { + return nil, fmt.Errorf("`hour_interval` and `hour_duration` must be specified when `backup.0.frequency` is `Hourly`") + } + if interval == 0 { + return nil, fmt.Errorf("`hour_interval` must be specified when `backup.0.frequency` is `Hourly`") + } + if duration == 0 { + return nil, fmt.Errorf("`hour_duration` must be specified when `backup.0.frequency` is `Hourly`") + } + if duration%interval != 0 { return nil, fmt.Errorf("`hour_duration` must be multiplier of `hour_interval`") } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/site_recovery_replicated_vm_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/site_recovery_replicated_vm_resource.go index bd15cf70175..539cba753f2 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/site_recovery_replicated_vm_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/site_recovery_replicated_vm_resource.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -186,6 +187,63 @@ func resourceSiteRecoveryReplicatedVM() *pluginsdk.Resource { ValidateFunc: azure.ValidateResourceID, DiffSuppressFunc: suppress.CaseDifference, }, + + "target_disk_encryption": { + Type: pluginsdk.TypeList, + ConfigMode: pluginsdk.SchemaConfigModeAttr, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "disk_encryption_key": { + Type: pluginsdk.TypeList, + ConfigMode: pluginsdk.SchemaConfigModeAttr, + Required: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "secret_url": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: keyVaultValidate.NestedItemId, + }, + + "vault_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: keyVaultValidate.VaultID, + }, + }, + }, + }, + "key_encryption_key": { + Type: pluginsdk.TypeList, + ConfigMode: pluginsdk.SchemaConfigModeAttr, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "key_url": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: keyVaultValidate.NestedItemId, + }, + + "vault_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: keyVaultValidate.VaultID, + }, + }, + }, + }, + }, + }, + }, }, }, }, @@ -291,6 +349,7 @@ func resourceSiteRecoveryReplicatedItemCreate(d *pluginsdk.ResourceData, meta in RecoveryReplicaDiskAccountType: &targetReplicaDiskType, RecoveryTargetDiskAccountType: &targetDiskType, RecoveryDiskEncryptionSetID: &targetEncryptionDiskSetID, + DiskEncryptionInfo: expandTargetDiskEncryption(diskInput["target_disk_encryption"].([]interface{})), }) } @@ -388,6 +447,7 @@ func resourceSiteRecoveryReplicatedItemUpdateInternal(ctx context.Context, d *pl DiskID: &diskId, RecoveryReplicaDiskAccountType: &targetReplicaDiskType, RecoveryTargetDiskAccountType: &targetDiskType, + DiskEncryptionInfo: expandTargetDiskEncryption(diskInput["target_disk_encryption"].([]interface{})), }) } @@ -515,6 +575,8 @@ func resourceSiteRecoveryReplicatedItemRead(d *pluginsdk.ResourceData, meta inte } diskOutput["target_disk_encryption_set_id"] = recoveryEncryptionSetId + diskOutput["target_disk_encryption"] = flattenTargetDiskEncryption(disk) + disksOutput = append(disksOutput, diskOutput) } d.Set("managed_disk", pluginsdk.NewSet(resourceSiteRecoveryReplicatedVMDiskHash, disksOutput)) @@ -653,3 +715,75 @@ func waitForReplicationToBeHealthyRefreshFunc(d *pluginsdk.ResourceData, meta in return resp, *resp.Properties.ReplicationHealth, nil } } + +func expandTargetDiskEncryption(diskEncryptionInfoList []interface{}) *siterecovery.DiskEncryptionInfo { + if len(diskEncryptionInfoList) == 0 { + return &siterecovery.DiskEncryptionInfo{} + } + diskEncryptionInfoMap := diskEncryptionInfoList[0].(map[string]interface{}) + + dek := diskEncryptionInfoMap["disk_encryption_key"].([]interface{})[0].(map[string]interface{}) + diskEncryptionInfo := &siterecovery.DiskEncryptionInfo{ + DiskEncryptionKeyInfo: &siterecovery.DiskEncryptionKeyInfo{ + SecretIdentifier: utils.String(dek["secret_url"].(string)), + KeyVaultResourceArmID: utils.String(dek["vault_id"].(string)), + }, + } + + if keyEncryptionKey := diskEncryptionInfoMap["key_encryption_key"].([]interface{}); len(keyEncryptionKey) > 0 { + kek := keyEncryptionKey[0].(map[string]interface{}) + diskEncryptionInfo.KeyEncryptionKeyInfo = &siterecovery.KeyEncryptionKeyInfo{ + KeyIdentifier: utils.String(kek["key_url"].(string)), + KeyVaultResourceArmID: utils.String(kek["vault_id"].(string)), + } + } + + return diskEncryptionInfo +} + +func flattenTargetDiskEncryption(disk siterecovery.A2AProtectedManagedDiskDetails) []interface{} { + secretUrl := "" + dekVaultId := "" + keyUrl := "" + kekVaultId := "" + + if disk.SecretIdentifier != nil { + secretUrl = *disk.SecretIdentifier + } + if disk.DekKeyVaultArmID != nil { + dekVaultId = *disk.DekKeyVaultArmID + } + if disk.KeyIdentifier != nil { + keyUrl = *disk.KeyIdentifier + } + if disk.KekKeyVaultArmID != nil { + kekVaultId = *disk.KekKeyVaultArmID + } + + if secretUrl == "" && dekVaultId == "" && keyUrl == "" && kekVaultId == "" { + return []interface{}{} + } + + diskEncryptionKeys := make([]interface{}, 0) + if secretUrl != "" || dekVaultId != "" { + diskEncryptionKeys = append(diskEncryptionKeys, map[string]interface{}{ + "secret_url": secretUrl, + "vault_id": dekVaultId, + }) + } + + keyEncryptionKeys := make([]interface{}, 0) + if keyUrl != "" || kekVaultId != "" { + keyEncryptionKeys = append(keyEncryptionKeys, map[string]interface{}{ + "key_url": keyUrl, + "vault_id": kekVaultId, + }) + } + + return []interface{}{ + map[string]interface{}{ + "disk_encryption_key": diskEncryptionKeys, + "key_encryption_key": keyEncryptionKeys, + }, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/client/client.go index 556a1fe7f2e..00865199ca0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/client/client.go @@ -1,9 +1,9 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/redis_enterprise_cluster_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/redis_enterprise_cluster_resource.go index 1d0e73f3f31..ef991006fc6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/redis_enterprise_cluster_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/redis_enterprise_cluster_resource.go @@ -13,12 +13,11 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise" "github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -139,7 +138,7 @@ func resourceRedisEnterpriseClusterCreate(d *pluginsdk.ResourceData, meta interf if err := validate.RedisEnterpriseClusterLocationZoneSupport(location); err != nil { return fmt.Errorf("%s: %s", id, err) } - zones := zones.Expand(v.(*schema.Set).List()) + zones := zones.Expand(v.(*pluginsdk.Set).List()) if len(zones) > 0 { parameters.Zones = &zones } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/redis_enterprise_database_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/redis_enterprise_database_data_source.go index 95179766f7f..c823cc34e67 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/redis_enterprise_database_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/redis_enterprise_database_data_source.go @@ -6,10 +6,10 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/features" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/redis_enterprise_database_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/redis_enterprise_database_resource.go index 16f8536b9a4..8656a6c28f3 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/redis_enterprise_database_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/redis_enterprise_database_resource.go @@ -9,11 +9,11 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/features" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise" "github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/client.go deleted file mode 100644 index 99bdded9cda..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package databases - -import "github.com/Azure/go-autorest/autorest" - -type DatabasesClient struct { - Client autorest.Client - baseUri string -} - -func NewDatabasesClientWithBaseURI(endpoint string) DatabasesClient { - return DatabasesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/constants.go deleted file mode 100644 index 5f200077942..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/constants.go +++ /dev/null @@ -1,327 +0,0 @@ -package databases - -import "strings" - -type AccessKeyType string - -const ( - AccessKeyTypePrimary AccessKeyType = "Primary" - AccessKeyTypeSecondary AccessKeyType = "Secondary" -) - -func PossibleValuesForAccessKeyType() []string { - return []string{ - string(AccessKeyTypePrimary), - string(AccessKeyTypeSecondary), - } -} - -func parseAccessKeyType(input string) (*AccessKeyType, error) { - vals := map[string]AccessKeyType{ - "primary": AccessKeyTypePrimary, - "secondary": AccessKeyTypeSecondary, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccessKeyType(input) - return &out, nil -} - -type AofFrequency string - -const ( - AofFrequencyAlways AofFrequency = "always" - AofFrequencyOnes AofFrequency = "1s" -) - -func PossibleValuesForAofFrequency() []string { - return []string{ - string(AofFrequencyAlways), - string(AofFrequencyOnes), - } -} - -func parseAofFrequency(input string) (*AofFrequency, error) { - vals := map[string]AofFrequency{ - "always": AofFrequencyAlways, - "1s": AofFrequencyOnes, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AofFrequency(input) - return &out, nil -} - -type ClusteringPolicy string - -const ( - ClusteringPolicyEnterpriseCluster ClusteringPolicy = "EnterpriseCluster" - ClusteringPolicyOSSCluster ClusteringPolicy = "OSSCluster" -) - -func PossibleValuesForClusteringPolicy() []string { - return []string{ - string(ClusteringPolicyEnterpriseCluster), - string(ClusteringPolicyOSSCluster), - } -} - -func parseClusteringPolicy(input string) (*ClusteringPolicy, error) { - vals := map[string]ClusteringPolicy{ - "enterprisecluster": ClusteringPolicyEnterpriseCluster, - "osscluster": ClusteringPolicyOSSCluster, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ClusteringPolicy(input) - return &out, nil -} - -type EvictionPolicy string - -const ( - EvictionPolicyAllKeysLFU EvictionPolicy = "AllKeysLFU" - EvictionPolicyAllKeysLRU EvictionPolicy = "AllKeysLRU" - EvictionPolicyAllKeysRandom EvictionPolicy = "AllKeysRandom" - EvictionPolicyNoEviction EvictionPolicy = "NoEviction" - EvictionPolicyVolatileLFU EvictionPolicy = "VolatileLFU" - EvictionPolicyVolatileLRU EvictionPolicy = "VolatileLRU" - EvictionPolicyVolatileRandom EvictionPolicy = "VolatileRandom" - EvictionPolicyVolatileTTL EvictionPolicy = "VolatileTTL" -) - -func PossibleValuesForEvictionPolicy() []string { - return []string{ - string(EvictionPolicyAllKeysLFU), - string(EvictionPolicyAllKeysLRU), - string(EvictionPolicyAllKeysRandom), - string(EvictionPolicyNoEviction), - string(EvictionPolicyVolatileLFU), - string(EvictionPolicyVolatileLRU), - string(EvictionPolicyVolatileRandom), - string(EvictionPolicyVolatileTTL), - } -} - -func parseEvictionPolicy(input string) (*EvictionPolicy, error) { - vals := map[string]EvictionPolicy{ - "allkeyslfu": EvictionPolicyAllKeysLFU, - "allkeyslru": EvictionPolicyAllKeysLRU, - "allkeysrandom": EvictionPolicyAllKeysRandom, - "noeviction": EvictionPolicyNoEviction, - "volatilelfu": EvictionPolicyVolatileLFU, - "volatilelru": EvictionPolicyVolatileLRU, - "volatilerandom": EvictionPolicyVolatileRandom, - "volatilettl": EvictionPolicyVolatileTTL, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EvictionPolicy(input) - return &out, nil -} - -type LinkState string - -const ( - LinkStateLinkFailed LinkState = "LinkFailed" - LinkStateLinked LinkState = "Linked" - LinkStateLinking LinkState = "Linking" - LinkStateUnlinkFailed LinkState = "UnlinkFailed" - LinkStateUnlinking LinkState = "Unlinking" -) - -func PossibleValuesForLinkState() []string { - return []string{ - string(LinkStateLinkFailed), - string(LinkStateLinked), - string(LinkStateLinking), - string(LinkStateUnlinkFailed), - string(LinkStateUnlinking), - } -} - -func parseLinkState(input string) (*LinkState, error) { - vals := map[string]LinkState{ - "linkfailed": LinkStateLinkFailed, - "linked": LinkStateLinked, - "linking": LinkStateLinking, - "unlinkfailed": LinkStateUnlinkFailed, - "unlinking": LinkStateUnlinking, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := LinkState(input) - return &out, nil -} - -type Protocol string - -const ( - ProtocolEncrypted Protocol = "Encrypted" - ProtocolPlaintext Protocol = "Plaintext" -) - -func PossibleValuesForProtocol() []string { - return []string{ - string(ProtocolEncrypted), - string(ProtocolPlaintext), - } -} - -func parseProtocol(input string) (*Protocol, error) { - vals := map[string]Protocol{ - "encrypted": ProtocolEncrypted, - "plaintext": ProtocolPlaintext, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Protocol(input) - return &out, nil -} - -type ProvisioningState string - -const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -func PossibleValuesForProvisioningState() []string { - return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), - string(ProvisioningStateDeleting), - string(ProvisioningStateFailed), - string(ProvisioningStateSucceeded), - string(ProvisioningStateUpdating), - } -} - -func parseProvisioningState(input string) (*ProvisioningState, error) { - vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, - "deleting": ProvisioningStateDeleting, - "failed": ProvisioningStateFailed, - "succeeded": ProvisioningStateSucceeded, - "updating": ProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProvisioningState(input) - return &out, nil -} - -type RdbFrequency string - -const ( - RdbFrequencyOneTwoh RdbFrequency = "12h" - RdbFrequencyOneh RdbFrequency = "1h" - RdbFrequencySixh RdbFrequency = "6h" -) - -func PossibleValuesForRdbFrequency() []string { - return []string{ - string(RdbFrequencyOneTwoh), - string(RdbFrequencyOneh), - string(RdbFrequencySixh), - } -} - -func parseRdbFrequency(input string) (*RdbFrequency, error) { - vals := map[string]RdbFrequency{ - "12h": RdbFrequencyOneTwoh, - "1h": RdbFrequencyOneh, - "6h": RdbFrequencySixh, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RdbFrequency(input) - return &out, nil -} - -type ResourceState string - -const ( - ResourceStateCreateFailed ResourceState = "CreateFailed" - ResourceStateCreating ResourceState = "Creating" - ResourceStateDeleteFailed ResourceState = "DeleteFailed" - ResourceStateDeleting ResourceState = "Deleting" - ResourceStateDisableFailed ResourceState = "DisableFailed" - ResourceStateDisabled ResourceState = "Disabled" - ResourceStateDisabling ResourceState = "Disabling" - ResourceStateEnableFailed ResourceState = "EnableFailed" - ResourceStateEnabling ResourceState = "Enabling" - ResourceStateRunning ResourceState = "Running" - ResourceStateUpdateFailed ResourceState = "UpdateFailed" - ResourceStateUpdating ResourceState = "Updating" -) - -func PossibleValuesForResourceState() []string { - return []string{ - string(ResourceStateCreateFailed), - string(ResourceStateCreating), - string(ResourceStateDeleteFailed), - string(ResourceStateDeleting), - string(ResourceStateDisableFailed), - string(ResourceStateDisabled), - string(ResourceStateDisabling), - string(ResourceStateEnableFailed), - string(ResourceStateEnabling), - string(ResourceStateRunning), - string(ResourceStateUpdateFailed), - string(ResourceStateUpdating), - } -} - -func parseResourceState(input string) (*ResourceState, error) { - vals := map[string]ResourceState{ - "createfailed": ResourceStateCreateFailed, - "creating": ResourceStateCreating, - "deletefailed": ResourceStateDeleteFailed, - "deleting": ResourceStateDeleting, - "disablefailed": ResourceStateDisableFailed, - "disabled": ResourceStateDisabled, - "disabling": ResourceStateDisabling, - "enablefailed": ResourceStateEnableFailed, - "enabling": ResourceStateEnabling, - "running": ResourceStateRunning, - "updatefailed": ResourceStateUpdateFailed, - "updating": ResourceStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ResourceState(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_create_autorest.go deleted file mode 100644 index 8ddb57c8a25..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_create_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package databases - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Create ... -func (c DatabasesClient) Create(ctx context.Context, id DatabaseId, input Database) (result CreateResponse, err error) { - req, err := c.preparerForCreate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateThenPoll performs Create then polls until it's completed -func (c DatabasesClient) CreateThenPoll(ctx context.Context, id DatabaseId, input Database) error { - result, err := c.Create(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} - -// preparerForCreate prepares the Create request. -func (c DatabasesClient) preparerForCreate(ctx context.Context, id DatabaseId, input Database) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreate sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (c DatabasesClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_delete_autorest.go deleted file mode 100644 index d14eb3b2aec..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_delete_autorest.go +++ /dev/null @@ -1,74 +0,0 @@ -package databases - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c DatabasesClient) Delete(ctx context.Context, id DatabaseId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c DatabasesClient) DeleteThenPoll(ctx context.Context, id DatabaseId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c DatabasesClient) preparerForDelete(ctx context.Context, id DatabaseId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c DatabasesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_get_autorest.go deleted file mode 100644 index dee18977683..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package databases - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *Database -} - -// Get ... -func (c DatabasesClient) Get(ctx context.Context, id DatabaseId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c DatabasesClient) preparerForGet(ctx context.Context, id DatabaseId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c DatabasesClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_listkeys_autorest.go deleted file mode 100644 index 76f54586bf3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_listkeys_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package databases - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListKeysResponse struct { - HttpResponse *http.Response - Model *AccessKeys -} - -// ListKeys ... -func (c DatabasesClient) ListKeys(ctx context.Context, id DatabaseId) (result ListKeysResponse, err error) { - req, err := c.preparerForListKeys(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListKeys", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListKeys prepares the ListKeys request. -func (c DatabasesClient) preparerForListKeys(ctx context.Context, id DatabaseId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListKeys handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (c DatabasesClient) responderForListKeys(resp *http.Response) (result ListKeysResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_regeneratekey_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_regeneratekey_autorest.go deleted file mode 100644 index f831e8e97e7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_regeneratekey_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package databases - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type RegenerateKeyResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// RegenerateKey ... -func (c DatabasesClient) RegenerateKey(ctx context.Context, id DatabaseId, input RegenerateKeyParameters) (result RegenerateKeyResponse, err error) { - req, err := c.preparerForRegenerateKey(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - result, err = c.senderForRegenerateKey(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "RegenerateKey", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RegenerateKeyThenPoll performs RegenerateKey then polls until it's completed -func (c DatabasesClient) RegenerateKeyThenPoll(ctx context.Context, id DatabaseId, input RegenerateKeyParameters) error { - result, err := c.RegenerateKey(ctx, id, input) - if err != nil { - return fmt.Errorf("performing RegenerateKey: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RegenerateKey: %+v", err) - } - - return nil -} - -// preparerForRegenerateKey prepares the RegenerateKey request. -func (c DatabasesClient) preparerForRegenerateKey(ctx context.Context, id DatabaseId, input RegenerateKeyParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regenerateKey", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRegenerateKey sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (c DatabasesClient) senderForRegenerateKey(ctx context.Context, req *http.Request) (future RegenerateKeyResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_update_autorest.go deleted file mode 100644 index 66516e2346d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/method_update_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package databases - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type UpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c DatabasesClient) Update(ctx context.Context, id DatabaseId, input DatabaseUpdate) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c DatabasesClient) UpdateThenPoll(ctx context.Context, id DatabaseId, input DatabaseUpdate) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c DatabasesClient) preparerForUpdate(ctx context.Context, id DatabaseId, input DatabaseUpdate) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c DatabasesClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_accesskeys.go deleted file mode 100644 index 356ad75ad01..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_accesskeys.go +++ /dev/null @@ -1,6 +0,0 @@ -package databases - -type AccessKeys struct { - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_database.go deleted file mode 100644 index 91c899457e9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_database.go +++ /dev/null @@ -1,8 +0,0 @@ -package databases - -type Database struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *DatabaseProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_databaseproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_databaseproperties.go deleted file mode 100644 index 4bba1ee0df8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_databaseproperties.go +++ /dev/null @@ -1,13 +0,0 @@ -package databases - -type DatabaseProperties struct { - ClientProtocol *Protocol `json:"clientProtocol,omitempty"` - ClusteringPolicy *ClusteringPolicy `json:"clusteringPolicy,omitempty"` - EvictionPolicy *EvictionPolicy `json:"evictionPolicy,omitempty"` - GeoReplication *DatabasePropertiesGeoReplication `json:"geoReplication,omitempty"` - Modules *[]Module `json:"modules,omitempty"` - Persistence *Persistence `json:"persistence,omitempty"` - Port *int64 `json:"port,omitempty"` - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` - ResourceState *ResourceState `json:"resourceState,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_databasepropertiesgeoreplication.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_databasepropertiesgeoreplication.go deleted file mode 100644 index 2f733e0880a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_databasepropertiesgeoreplication.go +++ /dev/null @@ -1,6 +0,0 @@ -package databases - -type DatabasePropertiesGeoReplication struct { - GroupNickname *string `json:"groupNickname,omitempty"` - LinkedDatabases *[]LinkedDatabase `json:"linkedDatabases,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_databaseupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_databaseupdate.go deleted file mode 100644 index 53f5fa8b86d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_databaseupdate.go +++ /dev/null @@ -1,5 +0,0 @@ -package databases - -type DatabaseUpdate struct { - Properties *DatabaseProperties `json:"properties,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_exportclusterparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_exportclusterparameters.go deleted file mode 100644 index 390dd6414dc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_exportclusterparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package databases - -type ExportClusterParameters struct { - SasUri string `json:"sasUri"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_forceunlinkparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_forceunlinkparameters.go deleted file mode 100644 index b442efa75e5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_forceunlinkparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package databases - -type ForceUnlinkParameters struct { - Ids []string `json:"ids"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_importclusterparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_importclusterparameters.go deleted file mode 100644 index f0207b25b5c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_importclusterparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package databases - -type ImportClusterParameters struct { - SasUris []string `json:"sasUris"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_linkeddatabase.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_linkeddatabase.go deleted file mode 100644 index 02da951e042..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_linkeddatabase.go +++ /dev/null @@ -1,6 +0,0 @@ -package databases - -type LinkedDatabase struct { - Id *string `json:"id,omitempty"` - State *LinkState `json:"state,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_module.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_module.go deleted file mode 100644 index e23fc2366b8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_module.go +++ /dev/null @@ -1,7 +0,0 @@ -package databases - -type Module struct { - Args *string `json:"args,omitempty"` - Name string `json:"name"` - Version *string `json:"version,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_persistence.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_persistence.go deleted file mode 100644 index cadef7b455b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_persistence.go +++ /dev/null @@ -1,8 +0,0 @@ -package databases - -type Persistence struct { - AofEnabled *bool `json:"aofEnabled,omitempty"` - AofFrequency *AofFrequency `json:"aofFrequency,omitempty"` - RdbEnabled *bool `json:"rdbEnabled,omitempty"` - RdbFrequency *RdbFrequency `json:"rdbFrequency,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_regeneratekeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_regeneratekeyparameters.go deleted file mode 100644 index e5e265d42e2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/model_regeneratekeyparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package databases - -type RegenerateKeyParameters struct { - KeyType AccessKeyType `json:"keyType"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/predicates.go deleted file mode 100644 index 8e70d0fdfa3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/predicates.go +++ /dev/null @@ -1,24 +0,0 @@ -package databases - -type DatabasePredicate struct { - Id *string - Name *string - Type *string -} - -func (p DatabasePredicate) Matches(input Database) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/version.go deleted file mode 100644 index 6eb0be5bf2f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package databases - -import "fmt" - -const defaultApiVersion = "2022-01-01" - -func userAgent() string { - return fmt.Sprintf("pandora/databases/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/client.go deleted file mode 100644 index e38fe5d733a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package redisenterprise - -import "github.com/Azure/go-autorest/autorest" - -type RedisEnterpriseClient struct { - Client autorest.Client - baseUri string -} - -func NewRedisEnterpriseClientWithBaseURI(endpoint string) RedisEnterpriseClient { - return RedisEnterpriseClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/constants.go deleted file mode 100644 index a4a40bd462d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/constants.go +++ /dev/null @@ -1,466 +0,0 @@ -package redisenterprise - -import "strings" - -type AccessKeyType string - -const ( - AccessKeyTypePrimary AccessKeyType = "Primary" - AccessKeyTypeSecondary AccessKeyType = "Secondary" -) - -func PossibleValuesForAccessKeyType() []string { - return []string{ - string(AccessKeyTypePrimary), - string(AccessKeyTypeSecondary), - } -} - -func parseAccessKeyType(input string) (*AccessKeyType, error) { - vals := map[string]AccessKeyType{ - "primary": AccessKeyTypePrimary, - "secondary": AccessKeyTypeSecondary, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccessKeyType(input) - return &out, nil -} - -type AofFrequency string - -const ( - AofFrequencyAlways AofFrequency = "always" - AofFrequencyOnes AofFrequency = "1s" -) - -func PossibleValuesForAofFrequency() []string { - return []string{ - string(AofFrequencyAlways), - string(AofFrequencyOnes), - } -} - -func parseAofFrequency(input string) (*AofFrequency, error) { - vals := map[string]AofFrequency{ - "always": AofFrequencyAlways, - "1s": AofFrequencyOnes, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AofFrequency(input) - return &out, nil -} - -type ClusteringPolicy string - -const ( - ClusteringPolicyEnterpriseCluster ClusteringPolicy = "EnterpriseCluster" - ClusteringPolicyOSSCluster ClusteringPolicy = "OSSCluster" -) - -func PossibleValuesForClusteringPolicy() []string { - return []string{ - string(ClusteringPolicyEnterpriseCluster), - string(ClusteringPolicyOSSCluster), - } -} - -func parseClusteringPolicy(input string) (*ClusteringPolicy, error) { - vals := map[string]ClusteringPolicy{ - "enterprisecluster": ClusteringPolicyEnterpriseCluster, - "osscluster": ClusteringPolicyOSSCluster, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ClusteringPolicy(input) - return &out, nil -} - -type EvictionPolicy string - -const ( - EvictionPolicyAllKeysLFU EvictionPolicy = "AllKeysLFU" - EvictionPolicyAllKeysLRU EvictionPolicy = "AllKeysLRU" - EvictionPolicyAllKeysRandom EvictionPolicy = "AllKeysRandom" - EvictionPolicyNoEviction EvictionPolicy = "NoEviction" - EvictionPolicyVolatileLFU EvictionPolicy = "VolatileLFU" - EvictionPolicyVolatileLRU EvictionPolicy = "VolatileLRU" - EvictionPolicyVolatileRandom EvictionPolicy = "VolatileRandom" - EvictionPolicyVolatileTTL EvictionPolicy = "VolatileTTL" -) - -func PossibleValuesForEvictionPolicy() []string { - return []string{ - string(EvictionPolicyAllKeysLFU), - string(EvictionPolicyAllKeysLRU), - string(EvictionPolicyAllKeysRandom), - string(EvictionPolicyNoEviction), - string(EvictionPolicyVolatileLFU), - string(EvictionPolicyVolatileLRU), - string(EvictionPolicyVolatileRandom), - string(EvictionPolicyVolatileTTL), - } -} - -func parseEvictionPolicy(input string) (*EvictionPolicy, error) { - vals := map[string]EvictionPolicy{ - "allkeyslfu": EvictionPolicyAllKeysLFU, - "allkeyslru": EvictionPolicyAllKeysLRU, - "allkeysrandom": EvictionPolicyAllKeysRandom, - "noeviction": EvictionPolicyNoEviction, - "volatilelfu": EvictionPolicyVolatileLFU, - "volatilelru": EvictionPolicyVolatileLRU, - "volatilerandom": EvictionPolicyVolatileRandom, - "volatilettl": EvictionPolicyVolatileTTL, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EvictionPolicy(input) - return &out, nil -} - -type LinkState string - -const ( - LinkStateLinkFailed LinkState = "LinkFailed" - LinkStateLinked LinkState = "Linked" - LinkStateLinking LinkState = "Linking" - LinkStateUnlinkFailed LinkState = "UnlinkFailed" - LinkStateUnlinking LinkState = "Unlinking" -) - -func PossibleValuesForLinkState() []string { - return []string{ - string(LinkStateLinkFailed), - string(LinkStateLinked), - string(LinkStateLinking), - string(LinkStateUnlinkFailed), - string(LinkStateUnlinking), - } -} - -func parseLinkState(input string) (*LinkState, error) { - vals := map[string]LinkState{ - "linkfailed": LinkStateLinkFailed, - "linked": LinkStateLinked, - "linking": LinkStateLinking, - "unlinkfailed": LinkStateUnlinkFailed, - "unlinking": LinkStateUnlinking, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := LinkState(input) - return &out, nil -} - -type PrivateEndpointConnectionProvisioningState string - -const ( - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" -) - -func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { - return []string{ - string(PrivateEndpointConnectionProvisioningStateCreating), - string(PrivateEndpointConnectionProvisioningStateDeleting), - string(PrivateEndpointConnectionProvisioningStateFailed), - string(PrivateEndpointConnectionProvisioningStateSucceeded), - } -} - -func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { - vals := map[string]PrivateEndpointConnectionProvisioningState{ - "creating": PrivateEndpointConnectionProvisioningStateCreating, - "deleting": PrivateEndpointConnectionProvisioningStateDeleting, - "failed": PrivateEndpointConnectionProvisioningStateFailed, - "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PrivateEndpointConnectionProvisioningState(input) - return &out, nil -} - -type PrivateEndpointServiceConnectionStatus string - -const ( - PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" - PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" -) - -func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { - return []string{ - string(PrivateEndpointServiceConnectionStatusApproved), - string(PrivateEndpointServiceConnectionStatusPending), - string(PrivateEndpointServiceConnectionStatusRejected), - } -} - -func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { - vals := map[string]PrivateEndpointServiceConnectionStatus{ - "approved": PrivateEndpointServiceConnectionStatusApproved, - "pending": PrivateEndpointServiceConnectionStatusPending, - "rejected": PrivateEndpointServiceConnectionStatusRejected, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PrivateEndpointServiceConnectionStatus(input) - return &out, nil -} - -type Protocol string - -const ( - ProtocolEncrypted Protocol = "Encrypted" - ProtocolPlaintext Protocol = "Plaintext" -) - -func PossibleValuesForProtocol() []string { - return []string{ - string(ProtocolEncrypted), - string(ProtocolPlaintext), - } -} - -func parseProtocol(input string) (*Protocol, error) { - vals := map[string]Protocol{ - "encrypted": ProtocolEncrypted, - "plaintext": ProtocolPlaintext, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Protocol(input) - return &out, nil -} - -type ProvisioningState string - -const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -func PossibleValuesForProvisioningState() []string { - return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), - string(ProvisioningStateDeleting), - string(ProvisioningStateFailed), - string(ProvisioningStateSucceeded), - string(ProvisioningStateUpdating), - } -} - -func parseProvisioningState(input string) (*ProvisioningState, error) { - vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, - "deleting": ProvisioningStateDeleting, - "failed": ProvisioningStateFailed, - "succeeded": ProvisioningStateSucceeded, - "updating": ProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProvisioningState(input) - return &out, nil -} - -type RdbFrequency string - -const ( - RdbFrequencyOneTwoh RdbFrequency = "12h" - RdbFrequencyOneh RdbFrequency = "1h" - RdbFrequencySixh RdbFrequency = "6h" -) - -func PossibleValuesForRdbFrequency() []string { - return []string{ - string(RdbFrequencyOneTwoh), - string(RdbFrequencyOneh), - string(RdbFrequencySixh), - } -} - -func parseRdbFrequency(input string) (*RdbFrequency, error) { - vals := map[string]RdbFrequency{ - "12h": RdbFrequencyOneTwoh, - "1h": RdbFrequencyOneh, - "6h": RdbFrequencySixh, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RdbFrequency(input) - return &out, nil -} - -type ResourceState string - -const ( - ResourceStateCreateFailed ResourceState = "CreateFailed" - ResourceStateCreating ResourceState = "Creating" - ResourceStateDeleteFailed ResourceState = "DeleteFailed" - ResourceStateDeleting ResourceState = "Deleting" - ResourceStateDisableFailed ResourceState = "DisableFailed" - ResourceStateDisabled ResourceState = "Disabled" - ResourceStateDisabling ResourceState = "Disabling" - ResourceStateEnableFailed ResourceState = "EnableFailed" - ResourceStateEnabling ResourceState = "Enabling" - ResourceStateRunning ResourceState = "Running" - ResourceStateUpdateFailed ResourceState = "UpdateFailed" - ResourceStateUpdating ResourceState = "Updating" -) - -func PossibleValuesForResourceState() []string { - return []string{ - string(ResourceStateCreateFailed), - string(ResourceStateCreating), - string(ResourceStateDeleteFailed), - string(ResourceStateDeleting), - string(ResourceStateDisableFailed), - string(ResourceStateDisabled), - string(ResourceStateDisabling), - string(ResourceStateEnableFailed), - string(ResourceStateEnabling), - string(ResourceStateRunning), - string(ResourceStateUpdateFailed), - string(ResourceStateUpdating), - } -} - -func parseResourceState(input string) (*ResourceState, error) { - vals := map[string]ResourceState{ - "createfailed": ResourceStateCreateFailed, - "creating": ResourceStateCreating, - "deletefailed": ResourceStateDeleteFailed, - "deleting": ResourceStateDeleting, - "disablefailed": ResourceStateDisableFailed, - "disabled": ResourceStateDisabled, - "disabling": ResourceStateDisabling, - "enablefailed": ResourceStateEnableFailed, - "enabling": ResourceStateEnabling, - "running": ResourceStateRunning, - "updatefailed": ResourceStateUpdateFailed, - "updating": ResourceStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ResourceState(input) - return &out, nil -} - -type SkuName string - -const ( - SkuNameEnterpriseEFiveZero SkuName = "Enterprise_E50" - SkuNameEnterpriseEOneZero SkuName = "Enterprise_E10" - SkuNameEnterpriseEOneZeroZero SkuName = "Enterprise_E100" - SkuNameEnterpriseETwoZero SkuName = "Enterprise_E20" - SkuNameEnterpriseFlashFOneFiveZeroZero SkuName = "EnterpriseFlash_F1500" - SkuNameEnterpriseFlashFSevenZeroZero SkuName = "EnterpriseFlash_F700" - SkuNameEnterpriseFlashFThreeZeroZero SkuName = "EnterpriseFlash_F300" -) - -func PossibleValuesForSkuName() []string { - return []string{ - string(SkuNameEnterpriseEFiveZero), - string(SkuNameEnterpriseEOneZero), - string(SkuNameEnterpriseEOneZeroZero), - string(SkuNameEnterpriseETwoZero), - string(SkuNameEnterpriseFlashFOneFiveZeroZero), - string(SkuNameEnterpriseFlashFSevenZeroZero), - string(SkuNameEnterpriseFlashFThreeZeroZero), - } -} - -func parseSkuName(input string) (*SkuName, error) { - vals := map[string]SkuName{ - "enterprise_e50": SkuNameEnterpriseEFiveZero, - "enterprise_e10": SkuNameEnterpriseEOneZero, - "enterprise_e100": SkuNameEnterpriseEOneZeroZero, - "enterprise_e20": SkuNameEnterpriseETwoZero, - "enterpriseflash_f1500": SkuNameEnterpriseFlashFOneFiveZeroZero, - "enterpriseflash_f700": SkuNameEnterpriseFlashFSevenZeroZero, - "enterpriseflash_f300": SkuNameEnterpriseFlashFThreeZeroZero, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SkuName(input) - return &out, nil -} - -type TlsVersion string - -const ( - TlsVersionOnePointOne TlsVersion = "1.1" - TlsVersionOnePointTwo TlsVersion = "1.2" - TlsVersionOnePointZero TlsVersion = "1.0" -) - -func PossibleValuesForTlsVersion() []string { - return []string{ - string(TlsVersionOnePointOne), - string(TlsVersionOnePointTwo), - string(TlsVersionOnePointZero), - } -} - -func parseTlsVersion(input string) (*TlsVersion, error) { - vals := map[string]TlsVersion{ - "1.1": TlsVersionOnePointOne, - "1.2": TlsVersionOnePointTwo, - "1.0": TlsVersionOnePointZero, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := TlsVersion(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_create_autorest.go deleted file mode 100644 index a55b54cf8ad..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_create_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package redisenterprise - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Create ... -func (c RedisEnterpriseClient) Create(ctx context.Context, id RedisEnterpriseId, input Cluster) (result CreateResponse, err error) { - req, err := c.preparerForCreate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Create", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateThenPoll performs Create then polls until it's completed -func (c RedisEnterpriseClient) CreateThenPoll(ctx context.Context, id RedisEnterpriseId, input Cluster) error { - result, err := c.Create(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} - -// preparerForCreate prepares the Create request. -func (c RedisEnterpriseClient) preparerForCreate(ctx context.Context, id RedisEnterpriseId, input Cluster) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreate sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (c RedisEnterpriseClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_delete_autorest.go deleted file mode 100644 index c38cbc3ff87..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_delete_autorest.go +++ /dev/null @@ -1,74 +0,0 @@ -package redisenterprise - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c RedisEnterpriseClient) Delete(ctx context.Context, id RedisEnterpriseId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c RedisEnterpriseClient) DeleteThenPoll(ctx context.Context, id RedisEnterpriseId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c RedisEnterpriseClient) preparerForDelete(ctx context.Context, id RedisEnterpriseId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c RedisEnterpriseClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_get_autorest.go deleted file mode 100644 index 4ba661142bd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package redisenterprise - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *Cluster -} - -// Get ... -func (c RedisEnterpriseClient) Get(ctx context.Context, id RedisEnterpriseId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c RedisEnterpriseClient) preparerForGet(ctx context.Context, id RedisEnterpriseId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c RedisEnterpriseClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_list_autorest.go deleted file mode 100644 index fb696c68d53..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_list_autorest.go +++ /dev/null @@ -1,184 +0,0 @@ -package redisenterprise - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -type ListResponse struct { - HttpResponse *http.Response - Model *[]Cluster - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListResponse, error) -} - -type ListCompleteResult struct { - Items []Cluster -} - -func (r ListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListResponse) LoadMore(ctx context.Context) (resp ListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c RedisEnterpriseClient) List(ctx context.Context, id commonids.SubscriptionId) (resp ListResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c RedisEnterpriseClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, ClusterPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c RedisEnterpriseClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ClusterPredicate) (resp ListCompleteResult, err error) { - items := make([]Cluster, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForList prepares the List request. -func (c RedisEnterpriseClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Cache/redisEnterprise", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c RedisEnterpriseClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c RedisEnterpriseClient) responderForList(resp *http.Response) (result ListResponse, err error) { - type page struct { - Values []Cluster `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 7d5b3d751e7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,184 +0,0 @@ -package redisenterprise - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *[]Cluster - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []Cluster -} - -func (r ListByResourceGroupResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c RedisEnterpriseClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (resp ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c RedisEnterpriseClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ClusterPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c RedisEnterpriseClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ClusterPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]Cluster, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c RedisEnterpriseClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Cache/redisEnterprise", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c RedisEnterpriseClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c RedisEnterpriseClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - type page struct { - Values []Cluster `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_update_autorest.go deleted file mode 100644 index b6132697278..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/method_update_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package redisenterprise - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type UpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c RedisEnterpriseClient) Update(ctx context.Context, id RedisEnterpriseId, input ClusterUpdate) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "redisenterprise.RedisEnterpriseClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c RedisEnterpriseClient) UpdateThenPoll(ctx context.Context, id RedisEnterpriseId, input ClusterUpdate) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c RedisEnterpriseClient) preparerForUpdate(ctx context.Context, id RedisEnterpriseId, input ClusterUpdate) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c RedisEnterpriseClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_accesskeys.go deleted file mode 100644 index 1df702dd4e7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_accesskeys.go +++ /dev/null @@ -1,6 +0,0 @@ -package redisenterprise - -type AccessKeys struct { - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_cluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_cluster.go deleted file mode 100644 index ae1f3ead775..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_cluster.go +++ /dev/null @@ -1,12 +0,0 @@ -package redisenterprise - -type Cluster struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *ClusterProperties `json:"properties,omitempty"` - Sku Sku `json:"sku"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` - Zones *[]string `json:"zones,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_clusterproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_clusterproperties.go deleted file mode 100644 index dc3870ca865..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_clusterproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package redisenterprise - -type ClusterProperties struct { - HostName *string `json:"hostName,omitempty"` - MinimumTlsVersion *TlsVersion `json:"minimumTlsVersion,omitempty"` - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` - RedisVersion *string `json:"redisVersion,omitempty"` - ResourceState *ResourceState `json:"resourceState,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_clusterupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_clusterupdate.go deleted file mode 100644 index 1bcb8c42d55..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_clusterupdate.go +++ /dev/null @@ -1,7 +0,0 @@ -package redisenterprise - -type ClusterUpdate struct { - Properties *ClusterProperties `json:"properties,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_database.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_database.go deleted file mode 100644 index 4b38033a958..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_database.go +++ /dev/null @@ -1,8 +0,0 @@ -package redisenterprise - -type Database struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *DatabaseProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_databaseproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_databaseproperties.go deleted file mode 100644 index 92bc7a5377b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_databaseproperties.go +++ /dev/null @@ -1,13 +0,0 @@ -package redisenterprise - -type DatabaseProperties struct { - ClientProtocol *Protocol `json:"clientProtocol,omitempty"` - ClusteringPolicy *ClusteringPolicy `json:"clusteringPolicy,omitempty"` - EvictionPolicy *EvictionPolicy `json:"evictionPolicy,omitempty"` - GeoReplication *DatabasePropertiesGeoReplication `json:"geoReplication,omitempty"` - Modules *[]Module `json:"modules,omitempty"` - Persistence *Persistence `json:"persistence,omitempty"` - Port *int64 `json:"port,omitempty"` - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` - ResourceState *ResourceState `json:"resourceState,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_databasepropertiesgeoreplication.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_databasepropertiesgeoreplication.go deleted file mode 100644 index eaf52f7fb46..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_databasepropertiesgeoreplication.go +++ /dev/null @@ -1,6 +0,0 @@ -package redisenterprise - -type DatabasePropertiesGeoReplication struct { - GroupNickname *string `json:"groupNickname,omitempty"` - LinkedDatabases *[]LinkedDatabase `json:"linkedDatabases,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_databaseupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_databaseupdate.go deleted file mode 100644 index d607de22177..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_databaseupdate.go +++ /dev/null @@ -1,5 +0,0 @@ -package redisenterprise - -type DatabaseUpdate struct { - Properties *DatabaseProperties `json:"properties,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_exportclusterparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_exportclusterparameters.go deleted file mode 100644 index d057282a827..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_exportclusterparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package redisenterprise - -type ExportClusterParameters struct { - SasUri string `json:"sasUri"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_forceunlinkparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_forceunlinkparameters.go deleted file mode 100644 index 7d11d396b54..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_forceunlinkparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package redisenterprise - -type ForceUnlinkParameters struct { - Ids []string `json:"ids"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_importclusterparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_importclusterparameters.go deleted file mode 100644 index a4cddfd19e6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_importclusterparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package redisenterprise - -type ImportClusterParameters struct { - SasUris []string `json:"sasUris"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_linkeddatabase.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_linkeddatabase.go deleted file mode 100644 index c216b10106f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_linkeddatabase.go +++ /dev/null @@ -1,6 +0,0 @@ -package redisenterprise - -type LinkedDatabase struct { - Id *string `json:"id,omitempty"` - State *LinkState `json:"state,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_module.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_module.go deleted file mode 100644 index eccbce6aff7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_module.go +++ /dev/null @@ -1,7 +0,0 @@ -package redisenterprise - -type Module struct { - Args *string `json:"args,omitempty"` - Name string `json:"name"` - Version *string `json:"version,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_persistence.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_persistence.go deleted file mode 100644 index 8666152b676..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_persistence.go +++ /dev/null @@ -1,8 +0,0 @@ -package redisenterprise - -type Persistence struct { - AofEnabled *bool `json:"aofEnabled,omitempty"` - AofFrequency *AofFrequency `json:"aofFrequency,omitempty"` - RdbEnabled *bool `json:"rdbEnabled,omitempty"` - RdbFrequency *RdbFrequency `json:"rdbFrequency,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_privateendpoint.go deleted file mode 100644 index df570da0164..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_privateendpoint.go +++ /dev/null @@ -1,5 +0,0 @@ -package redisenterprise - -type PrivateEndpoint struct { - Id *string `json:"id,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_privateendpointconnection.go deleted file mode 100644 index f4cbd5e47f9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_privateendpointconnection.go +++ /dev/null @@ -1,8 +0,0 @@ -package redisenterprise - -type PrivateEndpointConnection struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_privateendpointconnectionproperties.go deleted file mode 100644 index 197d3da189b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_privateendpointconnectionproperties.go +++ /dev/null @@ -1,7 +0,0 @@ -package redisenterprise - -type PrivateEndpointConnectionProperties struct { - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` - ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_privatelinkserviceconnectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_privatelinkserviceconnectionstate.go deleted file mode 100644 index 926598e9de8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_privatelinkserviceconnectionstate.go +++ /dev/null @@ -1,7 +0,0 @@ -package redisenterprise - -type PrivateLinkServiceConnectionState struct { - ActionsRequired *string `json:"actionsRequired,omitempty"` - Description *string `json:"description,omitempty"` - Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_regeneratekeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_regeneratekeyparameters.go deleted file mode 100644 index 55d142131e7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_regeneratekeyparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package redisenterprise - -type RegenerateKeyParameters struct { - KeyType AccessKeyType `json:"keyType"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_sku.go deleted file mode 100644 index 16e22e0c4f5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/model_sku.go +++ /dev/null @@ -1,6 +0,0 @@ -package redisenterprise - -type Sku struct { - Capacity *int64 `json:"capacity,omitempty"` - Name SkuName `json:"name"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/predicates.go deleted file mode 100644 index 3451ea28bb5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/predicates.go +++ /dev/null @@ -1,52 +0,0 @@ -package redisenterprise - -type ClusterPredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p ClusterPredicate) Matches(input Cluster) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} - -type DatabasePredicate struct { - Id *string - Name *string - Type *string -} - -func (p DatabasePredicate) Matches(input Database) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/version.go deleted file mode 100644 index c7dd7fdab50..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package redisenterprise - -import "fmt" - -const defaultApiVersion = "2022-01-01" - -func userAgent() string { - return fmt.Sprintf("pandora/redisenterprise/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/client/client.go index bda852db540..10fd8de3de5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/client/client.go @@ -1,9 +1,9 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections" + "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/internal.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/internal.go index 2399cc6b2c5..2bd6cb2ed88 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/internal.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/internal.go @@ -5,8 +5,8 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections" + "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/parse/hybrid_connection_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/parse/hybrid_connection_id.go deleted file mode 100644 index 03fbfebaafc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/parse/hybrid_connection_id.go +++ /dev/null @@ -1,9 +0,0 @@ -package parse - -import ( - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections" -) - -func HybridConnectionID(input string) (*hybridconnections.HybridConnectionId, error) { - return hybridconnections.ParseHybridConnectionID(input) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/parse/namespace_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/parse/namespace_id.go deleted file mode 100644 index ff4e9fc1948..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/parse/namespace_id.go +++ /dev/null @@ -1,9 +0,0 @@ -package parse - -import ( - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces" -) - -func NamespaceID(input string) (*namespaces.NamespaceId, error) { - return namespaces.ParseNamespaceID(input) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_hybrid_connection_authorization_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_hybrid_connection_authorization_rule_resource.go index d6c2935eef7..eb7713c3d74 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_hybrid_connection_authorization_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_hybrid_connection_authorization_rule_resource.go @@ -6,10 +6,10 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_hybrid_connection_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_hybrid_connection_resource.go index 2dd3b7e3ab7..3fbf7ac1498 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_hybrid_connection_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_hybrid_connection_resource.go @@ -7,10 +7,10 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_namespace_authorization_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_namespace_authorization_rule_resource.go index d2c5f849153..aa9c6ac3073 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_namespace_authorization_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_namespace_authorization_rule_resource.go @@ -6,10 +6,10 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_namespace_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_namespace_resource.go index 1e3d0fb29af..7881b0fb329 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_namespace_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/relay_namespace_resource.go @@ -10,10 +10,10 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/client.go deleted file mode 100644 index bd9a4705ff7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package hybridconnections - -import "github.com/Azure/go-autorest/autorest" - -type HybridConnectionsClient struct { - Client autorest.Client - baseUri string -} - -func NewHybridConnectionsClientWithBaseURI(endpoint string) HybridConnectionsClient { - return HybridConnectionsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/constants.go deleted file mode 100644 index 36221384643..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/constants.go +++ /dev/null @@ -1,62 +0,0 @@ -package hybridconnections - -import "strings" - -type AccessRights string - -const ( - AccessRightsListen AccessRights = "Listen" - AccessRightsManage AccessRights = "Manage" - AccessRightsSend AccessRights = "Send" -) - -func PossibleValuesForAccessRights() []string { - return []string{ - string(AccessRightsListen), - string(AccessRightsManage), - string(AccessRightsSend), - } -} - -func parseAccessRights(input string) (*AccessRights, error) { - vals := map[string]AccessRights{ - "listen": AccessRightsListen, - "manage": AccessRightsManage, - "send": AccessRightsSend, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccessRights(input) - return &out, nil -} - -type KeyType string - -const ( - KeyTypePrimaryKey KeyType = "PrimaryKey" - KeyTypeSecondaryKey KeyType = "SecondaryKey" -) - -func PossibleValuesForKeyType() []string { - return []string{ - string(KeyTypePrimaryKey), - string(KeyTypeSecondaryKey), - } -} - -func parseKeyType(input string) (*KeyType, error) { - vals := map[string]KeyType{ - "primarykey": KeyTypePrimaryKey, - "secondarykey": KeyTypeSecondaryKey, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeyType(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/id_namespace.go deleted file mode 100644 index 4c008d1056d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/id_namespace.go +++ /dev/null @@ -1,124 +0,0 @@ -package hybridconnections - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = NamespaceId{} - -// NamespaceId is a struct representing the Resource ID for a Namespace -type NamespaceId struct { - SubscriptionId string - ResourceGroupName string - NamespaceName string -} - -// NewNamespaceID returns a new NamespaceId struct -func NewNamespaceID(subscriptionId string, resourceGroupName string, namespaceName string) NamespaceId { - return NamespaceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NamespaceName: namespaceName, - } -} - -// ParseNamespaceID parses 'input' into a NamespaceId -func ParseNamespaceID(input string) (*NamespaceId, error) { - parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := NamespaceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseNamespaceIDInsensitively parses 'input' case-insensitively into a NamespaceId -// note: this method should only be used for API response data and not user input -func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { - parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := NamespaceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID -func ValidateNamespaceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseNamespaceID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Namespace ID -func (id NamespaceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Relay/namespaces/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Namespace ID -func (id NamespaceId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftRelay", "Microsoft.Relay", "Microsoft.Relay"), - resourceids.StaticSegment("namespaces", "namespaces", "namespaces"), - resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), - } -} - -// String returns a human-readable description of this Namespace ID -func (id NamespaceId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Namespace Name: %q", id.NamespaceName), - } - return fmt.Sprintf("Namespace (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_createorupdate_autorest.go deleted file mode 100644 index 6ead340b31b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_createorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package hybridconnections - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateOrUpdateResponse struct { - HttpResponse *http.Response - Model *HybridConnection -} - -// CreateOrUpdate ... -func (c HybridConnectionsClient) CreateOrUpdate(ctx context.Context, id HybridConnectionId, input HybridConnection) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c HybridConnectionsClient) preparerForCreateOrUpdate(ctx context.Context, id HybridConnectionId, input HybridConnection) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c HybridConnectionsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_createorupdateauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_createorupdateauthorizationrule_autorest.go deleted file mode 100644 index 156edac9b49..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_createorupdateauthorizationrule_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package hybridconnections - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateOrUpdateAuthorizationRuleResponse struct { - HttpResponse *http.Response - Model *AuthorizationRule -} - -// CreateOrUpdateAuthorizationRule ... -func (c HybridConnectionsClient) CreateOrUpdateAuthorizationRule(ctx context.Context, id HybridConnectionAuthorizationRuleId, input AuthorizationRule) (result CreateOrUpdateAuthorizationRuleResponse, err error) { - req, err := c.preparerForCreateOrUpdateAuthorizationRule(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "CreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdateAuthorizationRule(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "CreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdateAuthorizationRule prepares the CreateOrUpdateAuthorizationRule request. -func (c HybridConnectionsClient) preparerForCreateOrUpdateAuthorizationRule(ctx context.Context, id HybridConnectionAuthorizationRuleId, input AuthorizationRule) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdateAuthorizationRule handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (c HybridConnectionsClient) responderForCreateOrUpdateAuthorizationRule(resp *http.Response) (result CreateOrUpdateAuthorizationRuleResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_delete_autorest.go deleted file mode 100644 index b3cd13048cd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_delete_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package hybridconnections - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c HybridConnectionsClient) Delete(ctx context.Context, id HybridConnectionId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c HybridConnectionsClient) preparerForDelete(ctx context.Context, id HybridConnectionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c HybridConnectionsClient) responderForDelete(resp *http.Response) (result DeleteResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_deleteauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_deleteauthorizationrule_autorest.go deleted file mode 100644 index 6e09bf0926c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_deleteauthorizationrule_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package hybridconnections - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteAuthorizationRuleResponse struct { - HttpResponse *http.Response -} - -// DeleteAuthorizationRule ... -func (c HybridConnectionsClient) DeleteAuthorizationRule(ctx context.Context, id HybridConnectionAuthorizationRuleId) (result DeleteAuthorizationRuleResponse, err error) { - req, err := c.preparerForDeleteAuthorizationRule(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDeleteAuthorizationRule(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDeleteAuthorizationRule prepares the DeleteAuthorizationRule request. -func (c HybridConnectionsClient) preparerForDeleteAuthorizationRule(ctx context.Context, id HybridConnectionAuthorizationRuleId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDeleteAuthorizationRule handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (c HybridConnectionsClient) responderForDeleteAuthorizationRule(resp *http.Response) (result DeleteAuthorizationRuleResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_get_autorest.go deleted file mode 100644 index d90bf1c4fb6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package hybridconnections - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *HybridConnection -} - -// Get ... -func (c HybridConnectionsClient) Get(ctx context.Context, id HybridConnectionId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c HybridConnectionsClient) preparerForGet(ctx context.Context, id HybridConnectionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c HybridConnectionsClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_getauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_getauthorizationrule_autorest.go deleted file mode 100644 index e82d8178c7f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_getauthorizationrule_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package hybridconnections - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetAuthorizationRuleResponse struct { - HttpResponse *http.Response - Model *AuthorizationRule -} - -// GetAuthorizationRule ... -func (c HybridConnectionsClient) GetAuthorizationRule(ctx context.Context, id HybridConnectionAuthorizationRuleId) (result GetAuthorizationRuleResponse, err error) { - req, err := c.preparerForGetAuthorizationRule(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "GetAuthorizationRule", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetAuthorizationRule(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "GetAuthorizationRule", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetAuthorizationRule prepares the GetAuthorizationRule request. -func (c HybridConnectionsClient) preparerForGetAuthorizationRule(ctx context.Context, id HybridConnectionAuthorizationRuleId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetAuthorizationRule handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (c HybridConnectionsClient) responderForGetAuthorizationRule(resp *http.Response) (result GetAuthorizationRuleResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_listauthorizationrules_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_listauthorizationrules_autorest.go deleted file mode 100644 index 57c5a293b37..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_listauthorizationrules_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package hybridconnections - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListAuthorizationRulesResponse struct { - HttpResponse *http.Response - Model *[]AuthorizationRule - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListAuthorizationRulesResponse, error) -} - -type ListAuthorizationRulesCompleteResult struct { - Items []AuthorizationRule -} - -func (r ListAuthorizationRulesResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListAuthorizationRulesResponse) LoadMore(ctx context.Context) (resp ListAuthorizationRulesResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListAuthorizationRules ... -func (c HybridConnectionsClient) ListAuthorizationRules(ctx context.Context, id HybridConnectionId) (resp ListAuthorizationRulesResponse, err error) { - req, err := c.preparerForListAuthorizationRules(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListAuthorizationRules", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListAuthorizationRules(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListAuthorizationRules", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListAuthorizationRulesComplete retrieves all of the results into a single object -func (c HybridConnectionsClient) ListAuthorizationRulesComplete(ctx context.Context, id HybridConnectionId) (ListAuthorizationRulesCompleteResult, error) { - return c.ListAuthorizationRulesCompleteMatchingPredicate(ctx, id, AuthorizationRulePredicate{}) -} - -// ListAuthorizationRulesCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c HybridConnectionsClient) ListAuthorizationRulesCompleteMatchingPredicate(ctx context.Context, id HybridConnectionId, predicate AuthorizationRulePredicate) (resp ListAuthorizationRulesCompleteResult, err error) { - items := make([]AuthorizationRule, 0) - - page, err := c.ListAuthorizationRules(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListAuthorizationRulesCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListAuthorizationRules prepares the ListAuthorizationRules request. -func (c HybridConnectionsClient) preparerForListAuthorizationRules(ctx context.Context, id HybridConnectionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/authorizationRules", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListAuthorizationRulesWithNextLink prepares the ListAuthorizationRules request with the given nextLink token. -func (c HybridConnectionsClient) preparerForListAuthorizationRulesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListAuthorizationRules handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (c HybridConnectionsClient) responderForListAuthorizationRules(resp *http.Response) (result ListAuthorizationRulesResponse, err error) { - type page struct { - Values []AuthorizationRule `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListAuthorizationRulesResponse, err error) { - req, err := c.preparerForListAuthorizationRulesWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListAuthorizationRules", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListAuthorizationRules(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListAuthorizationRules", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_listbynamespace_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_listbynamespace_autorest.go deleted file mode 100644 index 5e05e5dee60..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_listbynamespace_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package hybridconnections - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByNamespaceResponse struct { - HttpResponse *http.Response - Model *[]HybridConnection - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByNamespaceResponse, error) -} - -type ListByNamespaceCompleteResult struct { - Items []HybridConnection -} - -func (r ListByNamespaceResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByNamespaceResponse) LoadMore(ctx context.Context) (resp ListByNamespaceResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByNamespace ... -func (c HybridConnectionsClient) ListByNamespace(ctx context.Context, id NamespaceId) (resp ListByNamespaceResponse, err error) { - req, err := c.preparerForListByNamespace(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListByNamespace", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListByNamespace", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByNamespace(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListByNamespace", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByNamespaceComplete retrieves all of the results into a single object -func (c HybridConnectionsClient) ListByNamespaceComplete(ctx context.Context, id NamespaceId) (ListByNamespaceCompleteResult, error) { - return c.ListByNamespaceCompleteMatchingPredicate(ctx, id, HybridConnectionPredicate{}) -} - -// ListByNamespaceCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c HybridConnectionsClient) ListByNamespaceCompleteMatchingPredicate(ctx context.Context, id NamespaceId, predicate HybridConnectionPredicate) (resp ListByNamespaceCompleteResult, err error) { - items := make([]HybridConnection, 0) - - page, err := c.ListByNamespace(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByNamespaceCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByNamespace prepares the ListByNamespace request. -func (c HybridConnectionsClient) preparerForListByNamespace(ctx context.Context, id NamespaceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/hybridConnections", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByNamespaceWithNextLink prepares the ListByNamespace request with the given nextLink token. -func (c HybridConnectionsClient) preparerForListByNamespaceWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByNamespace handles the response to the ListByNamespace request. The method always -// closes the http.Response Body. -func (c HybridConnectionsClient) responderForListByNamespace(resp *http.Response) (result ListByNamespaceResponse, err error) { - type page struct { - Values []HybridConnection `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByNamespaceResponse, err error) { - req, err := c.preparerForListByNamespaceWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListByNamespace", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListByNamespace", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByNamespace(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListByNamespace", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_listkeys_autorest.go deleted file mode 100644 index 67a48ff9a90..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_listkeys_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package hybridconnections - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListKeysResponse struct { - HttpResponse *http.Response - Model *AccessKeys -} - -// ListKeys ... -func (c HybridConnectionsClient) ListKeys(ctx context.Context, id HybridConnectionAuthorizationRuleId) (result ListKeysResponse, err error) { - req, err := c.preparerForListKeys(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "ListKeys", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListKeys prepares the ListKeys request. -func (c HybridConnectionsClient) preparerForListKeys(ctx context.Context, id HybridConnectionAuthorizationRuleId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListKeys handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (c HybridConnectionsClient) responderForListKeys(resp *http.Response) (result ListKeysResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_regeneratekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_regeneratekeys_autorest.go deleted file mode 100644 index b4c1cbc34a9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/method_regeneratekeys_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package hybridconnections - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type RegenerateKeysResponse struct { - HttpResponse *http.Response - Model *AccessKeys -} - -// RegenerateKeys ... -func (c HybridConnectionsClient) RegenerateKeys(ctx context.Context, id HybridConnectionAuthorizationRuleId, input RegenerateAccessKeyParameters) (result RegenerateKeysResponse, err error) { - req, err := c.preparerForRegenerateKeys(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "RegenerateKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegenerateKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "hybridconnections.HybridConnectionsClient", "RegenerateKeys", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegenerateKeys prepares the RegenerateKeys request. -func (c HybridConnectionsClient) preparerForRegenerateKeys(ctx context.Context, id HybridConnectionAuthorizationRuleId, input RegenerateAccessKeyParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regenerateKeys", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegenerateKeys handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (c HybridConnectionsClient) responderForRegenerateKeys(resp *http.Response) (result RegenerateKeysResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_accesskeys.go deleted file mode 100644 index 2b86cb7243c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_accesskeys.go +++ /dev/null @@ -1,9 +0,0 @@ -package hybridconnections - -type AccessKeys struct { - KeyName *string `json:"keyName,omitempty"` - PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_authorizationrule.go deleted file mode 100644 index 75035bdd25f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_authorizationrule.go +++ /dev/null @@ -1,8 +0,0 @@ -package hybridconnections - -type AuthorizationRule struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties AuthorizationRuleProperties `json:"properties"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_authorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_authorizationruleproperties.go deleted file mode 100644 index 0586cced84f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_authorizationruleproperties.go +++ /dev/null @@ -1,5 +0,0 @@ -package hybridconnections - -type AuthorizationRuleProperties struct { - Rights []AccessRights `json:"rights"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_hybridconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_hybridconnection.go deleted file mode 100644 index ca27b989afa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_hybridconnection.go +++ /dev/null @@ -1,8 +0,0 @@ -package hybridconnections - -type HybridConnection struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *HybridConnectionProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_hybridconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_hybridconnectionproperties.go deleted file mode 100644 index 55933ee4b62..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_hybridconnectionproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -package hybridconnections - -type HybridConnectionProperties struct { - CreatedAt *string `json:"createdAt,omitempty"` - ListenerCount *int64 `json:"listenerCount,omitempty"` - RequiresClientAuthorization *bool `json:"requiresClientAuthorization,omitempty"` - UpdatedAt *string `json:"updatedAt,omitempty"` - UserMetadata *string `json:"userMetadata,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_regenerateaccesskeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_regenerateaccesskeyparameters.go deleted file mode 100644 index 3eb16a34b13..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/model_regenerateaccesskeyparameters.go +++ /dev/null @@ -1,6 +0,0 @@ -package hybridconnections - -type RegenerateAccessKeyParameters struct { - Key *string `json:"key,omitempty"` - KeyType KeyType `json:"keyType"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/predicates.go deleted file mode 100644 index 6f8e25be714..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/predicates.go +++ /dev/null @@ -1,47 +0,0 @@ -package hybridconnections - -type AuthorizationRulePredicate struct { - Id *string - Name *string - Type *string -} - -func (p AuthorizationRulePredicate) Matches(input AuthorizationRule) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} - -type HybridConnectionPredicate struct { - Id *string - Name *string - Type *string -} - -func (p HybridConnectionPredicate) Matches(input HybridConnection) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/version.go deleted file mode 100644 index 259d827971c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package hybridconnections - -import "fmt" - -const defaultApiVersion = "2017-04-01" - -func userAgent() string { - return fmt.Sprintf("pandora/hybridconnections/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/client.go deleted file mode 100644 index ab1ab10a48e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package namespaces - -import "github.com/Azure/go-autorest/autorest" - -type NamespacesClient struct { - Client autorest.Client - baseUri string -} - -func NewNamespacesClientWithBaseURI(endpoint string) NamespacesClient { - return NamespacesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/constants.go deleted file mode 100644 index c3b3ef880d7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/constants.go +++ /dev/null @@ -1,192 +0,0 @@ -package namespaces - -import "strings" - -type AccessRights string - -const ( - AccessRightsListen AccessRights = "Listen" - AccessRightsManage AccessRights = "Manage" - AccessRightsSend AccessRights = "Send" -) - -func PossibleValuesForAccessRights() []string { - return []string{ - string(AccessRightsListen), - string(AccessRightsManage), - string(AccessRightsSend), - } -} - -func parseAccessRights(input string) (*AccessRights, error) { - vals := map[string]AccessRights{ - "listen": AccessRightsListen, - "manage": AccessRightsManage, - "send": AccessRightsSend, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccessRights(input) - return &out, nil -} - -type KeyType string - -const ( - KeyTypePrimaryKey KeyType = "PrimaryKey" - KeyTypeSecondaryKey KeyType = "SecondaryKey" -) - -func PossibleValuesForKeyType() []string { - return []string{ - string(KeyTypePrimaryKey), - string(KeyTypeSecondaryKey), - } -} - -func parseKeyType(input string) (*KeyType, error) { - vals := map[string]KeyType{ - "primarykey": KeyTypePrimaryKey, - "secondarykey": KeyTypeSecondaryKey, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeyType(input) - return &out, nil -} - -type ProvisioningStateEnum string - -const ( - ProvisioningStateEnumCreated ProvisioningStateEnum = "Created" - ProvisioningStateEnumDeleted ProvisioningStateEnum = "Deleted" - ProvisioningStateEnumFailed ProvisioningStateEnum = "Failed" - ProvisioningStateEnumSucceeded ProvisioningStateEnum = "Succeeded" - ProvisioningStateEnumUnknown ProvisioningStateEnum = "Unknown" - ProvisioningStateEnumUpdating ProvisioningStateEnum = "Updating" -) - -func PossibleValuesForProvisioningStateEnum() []string { - return []string{ - string(ProvisioningStateEnumCreated), - string(ProvisioningStateEnumDeleted), - string(ProvisioningStateEnumFailed), - string(ProvisioningStateEnumSucceeded), - string(ProvisioningStateEnumUnknown), - string(ProvisioningStateEnumUpdating), - } -} - -func parseProvisioningStateEnum(input string) (*ProvisioningStateEnum, error) { - vals := map[string]ProvisioningStateEnum{ - "created": ProvisioningStateEnumCreated, - "deleted": ProvisioningStateEnumDeleted, - "failed": ProvisioningStateEnumFailed, - "succeeded": ProvisioningStateEnumSucceeded, - "unknown": ProvisioningStateEnumUnknown, - "updating": ProvisioningStateEnumUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProvisioningStateEnum(input) - return &out, nil -} - -type SkuName string - -const ( - SkuNameStandard SkuName = "Standard" -) - -func PossibleValuesForSkuName() []string { - return []string{ - string(SkuNameStandard), - } -} - -func parseSkuName(input string) (*SkuName, error) { - vals := map[string]SkuName{ - "standard": SkuNameStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SkuName(input) - return &out, nil -} - -type SkuTier string - -const ( - SkuTierStandard SkuTier = "Standard" -) - -func PossibleValuesForSkuTier() []string { - return []string{ - string(SkuTierStandard), - } -} - -func parseSkuTier(input string) (*SkuTier, error) { - vals := map[string]SkuTier{ - "standard": SkuTierStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SkuTier(input) - return &out, nil -} - -type UnavailableReason string - -const ( - UnavailableReasonInvalidName UnavailableReason = "InvalidName" - UnavailableReasonNameInLockdown UnavailableReason = "NameInLockdown" - UnavailableReasonNameInUse UnavailableReason = "NameInUse" - UnavailableReasonNone UnavailableReason = "None" - UnavailableReasonSubscriptionIsDisabled UnavailableReason = "SubscriptionIsDisabled" - UnavailableReasonTooManyNamespaceInCurrentSubscription UnavailableReason = "TooManyNamespaceInCurrentSubscription" -) - -func PossibleValuesForUnavailableReason() []string { - return []string{ - string(UnavailableReasonInvalidName), - string(UnavailableReasonNameInLockdown), - string(UnavailableReasonNameInUse), - string(UnavailableReasonNone), - string(UnavailableReasonSubscriptionIsDisabled), - string(UnavailableReasonTooManyNamespaceInCurrentSubscription), - } -} - -func parseUnavailableReason(input string) (*UnavailableReason, error) { - vals := map[string]UnavailableReason{ - "invalidname": UnavailableReasonInvalidName, - "nameinlockdown": UnavailableReasonNameInLockdown, - "nameinuse": UnavailableReasonNameInUse, - "none": UnavailableReasonNone, - "subscriptionisdisabled": UnavailableReasonSubscriptionIsDisabled, - "toomanynamespaceincurrentsubscription": UnavailableReasonTooManyNamespaceInCurrentSubscription, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := UnavailableReason(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/id_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/id_authorizationrule.go deleted file mode 100644 index 51a0830fec1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/id_authorizationrule.go +++ /dev/null @@ -1,137 +0,0 @@ -package namespaces - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = AuthorizationRuleId{} - -// AuthorizationRuleId is a struct representing the Resource ID for a Authorization Rule -type AuthorizationRuleId struct { - SubscriptionId string - ResourceGroupName string - NamespaceName string - AuthorizationRuleName string -} - -// NewAuthorizationRuleID returns a new AuthorizationRuleId struct -func NewAuthorizationRuleID(subscriptionId string, resourceGroupName string, namespaceName string, authorizationRuleName string) AuthorizationRuleId { - return AuthorizationRuleId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NamespaceName: namespaceName, - AuthorizationRuleName: authorizationRuleName, - } -} - -// ParseAuthorizationRuleID parses 'input' into a AuthorizationRuleId -func ParseAuthorizationRuleID(input string) (*AuthorizationRuleId, error) { - parser := resourceids.NewParserFromResourceIdType(AuthorizationRuleId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AuthorizationRuleId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseAuthorizationRuleIDInsensitively parses 'input' case-insensitively into a AuthorizationRuleId -// note: this method should only be used for API response data and not user input -func ParseAuthorizationRuleIDInsensitively(input string) (*AuthorizationRuleId, error) { - parser := resourceids.NewParserFromResourceIdType(AuthorizationRuleId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AuthorizationRuleId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, fmt.Errorf("the segment 'authorizationRuleName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateAuthorizationRuleID checks that 'input' can be parsed as a Authorization Rule ID -func ValidateAuthorizationRuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseAuthorizationRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Authorization Rule ID -func (id AuthorizationRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Relay/namespaces/%s/authorizationRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.AuthorizationRuleName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Authorization Rule ID -func (id AuthorizationRuleId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftRelay", "Microsoft.Relay", "Microsoft.Relay"), - resourceids.StaticSegment("namespaces", "namespaces", "namespaces"), - resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), - resourceids.StaticSegment("authorizationRules", "authorizationRules", "authorizationRules"), - resourceids.UserSpecifiedSegment("authorizationRuleName", "authorizationRuleValue"), - } -} - -// String returns a human-readable description of this Authorization Rule ID -func (id AuthorizationRuleId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Namespace Name: %q", id.NamespaceName), - fmt.Sprintf("Authorization Rule Name: %q", id.AuthorizationRuleName), - } - return fmt.Sprintf("Authorization Rule (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/id_namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/id_namespace.go deleted file mode 100644 index 9d4640bc054..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/id_namespace.go +++ /dev/null @@ -1,124 +0,0 @@ -package namespaces - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = NamespaceId{} - -// NamespaceId is a struct representing the Resource ID for a Namespace -type NamespaceId struct { - SubscriptionId string - ResourceGroupName string - NamespaceName string -} - -// NewNamespaceID returns a new NamespaceId struct -func NewNamespaceID(subscriptionId string, resourceGroupName string, namespaceName string) NamespaceId { - return NamespaceId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NamespaceName: namespaceName, - } -} - -// ParseNamespaceID parses 'input' into a NamespaceId -func ParseNamespaceID(input string) (*NamespaceId, error) { - parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := NamespaceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseNamespaceIDInsensitively parses 'input' case-insensitively into a NamespaceId -// note: this method should only be used for API response data and not user input -func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { - parser := resourceids.NewParserFromResourceIdType(NamespaceId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := NamespaceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, fmt.Errorf("the segment 'namespaceName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID -func ValidateNamespaceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseNamespaceID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Namespace ID -func (id NamespaceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Relay/namespaces/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Namespace ID -func (id NamespaceId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftRelay", "Microsoft.Relay", "Microsoft.Relay"), - resourceids.StaticSegment("namespaces", "namespaces", "namespaces"), - resourceids.UserSpecifiedSegment("namespaceName", "namespaceValue"), - } -} - -// String returns a human-readable description of this Namespace ID -func (id NamespaceId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Namespace Name: %q", id.NamespaceName), - } - return fmt.Sprintf("Namespace (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/id_resourcegroup.go deleted file mode 100644 index 7df426d5c9f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package namespaces - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/id_subscription.go deleted file mode 100644 index e110fef6716..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package namespaces - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_checknameavailability_autorest.go deleted file mode 100644 index 633d42510f9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_checknameavailability_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package namespaces - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CheckNameAvailabilityResponse struct { - HttpResponse *http.Response - Model *CheckNameAvailabilityResult -} - -// CheckNameAvailability ... -func (c NamespacesClient) CheckNameAvailability(ctx context.Context, id SubscriptionId, input CheckNameAvailability) (result CheckNameAvailabilityResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c NamespacesClient) preparerForCheckNameAvailability(ctx context.Context, id SubscriptionId, input CheckNameAvailability) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Relay/checkNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c NamespacesClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_createorupdate_autorest.go deleted file mode 100644 index 287fa1a47e3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_createorupdate_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package namespaces - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateOrUpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c NamespacesClient) CreateOrUpdate(ctx context.Context, id NamespaceId, input RelayNamespace) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c NamespacesClient) CreateOrUpdateThenPoll(ctx context.Context, id NamespaceId, input RelayNamespace) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c NamespacesClient) preparerForCreateOrUpdate(ctx context.Context, id NamespaceId, input RelayNamespace) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c NamespacesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_createorupdateauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_createorupdateauthorizationrule_autorest.go deleted file mode 100644 index d434f7422fd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_createorupdateauthorizationrule_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package namespaces - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateOrUpdateAuthorizationRuleResponse struct { - HttpResponse *http.Response - Model *AuthorizationRule -} - -// CreateOrUpdateAuthorizationRule ... -func (c NamespacesClient) CreateOrUpdateAuthorizationRule(ctx context.Context, id AuthorizationRuleId, input AuthorizationRule) (result CreateOrUpdateAuthorizationRuleResponse, err error) { - req, err := c.preparerForCreateOrUpdateAuthorizationRule(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdateAuthorizationRule(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "CreateOrUpdateAuthorizationRule", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdateAuthorizationRule prepares the CreateOrUpdateAuthorizationRule request. -func (c NamespacesClient) preparerForCreateOrUpdateAuthorizationRule(ctx context.Context, id AuthorizationRuleId, input AuthorizationRule) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdateAuthorizationRule handles the response to the CreateOrUpdateAuthorizationRule request. The method always -// closes the http.Response Body. -func (c NamespacesClient) responderForCreateOrUpdateAuthorizationRule(resp *http.Response) (result CreateOrUpdateAuthorizationRuleResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_delete_autorest.go deleted file mode 100644 index 65644e85c63..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_delete_autorest.go +++ /dev/null @@ -1,73 +0,0 @@ -package namespaces - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c NamespacesClient) Delete(ctx context.Context, id NamespaceId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c NamespacesClient) DeleteThenPoll(ctx context.Context, id NamespaceId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c NamespacesClient) preparerForDelete(ctx context.Context, id NamespaceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c NamespacesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_deleteauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_deleteauthorizationrule_autorest.go deleted file mode 100644 index 3688b3251cf..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_deleteauthorizationrule_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package namespaces - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteAuthorizationRuleResponse struct { - HttpResponse *http.Response -} - -// DeleteAuthorizationRule ... -func (c NamespacesClient) DeleteAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (result DeleteAuthorizationRuleResponse, err error) { - req, err := c.preparerForDeleteAuthorizationRule(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "DeleteAuthorizationRule", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDeleteAuthorizationRule(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "DeleteAuthorizationRule", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDeleteAuthorizationRule prepares the DeleteAuthorizationRule request. -func (c NamespacesClient) preparerForDeleteAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDeleteAuthorizationRule handles the response to the DeleteAuthorizationRule request. The method always -// closes the http.Response Body. -func (c NamespacesClient) responderForDeleteAuthorizationRule(resp *http.Response) (result DeleteAuthorizationRuleResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_get_autorest.go deleted file mode 100644 index 3daccf8ab50..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package namespaces - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *RelayNamespace -} - -// Get ... -func (c NamespacesClient) Get(ctx context.Context, id NamespaceId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c NamespacesClient) preparerForGet(ctx context.Context, id NamespaceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c NamespacesClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_getauthorizationrule_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_getauthorizationrule_autorest.go deleted file mode 100644 index fd045623aec..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_getauthorizationrule_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package namespaces - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetAuthorizationRuleResponse struct { - HttpResponse *http.Response - Model *AuthorizationRule -} - -// GetAuthorizationRule ... -func (c NamespacesClient) GetAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (result GetAuthorizationRuleResponse, err error) { - req, err := c.preparerForGetAuthorizationRule(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "GetAuthorizationRule", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "GetAuthorizationRule", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGetAuthorizationRule(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "GetAuthorizationRule", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGetAuthorizationRule prepares the GetAuthorizationRule request. -func (c NamespacesClient) preparerForGetAuthorizationRule(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGetAuthorizationRule handles the response to the GetAuthorizationRule request. The method always -// closes the http.Response Body. -func (c NamespacesClient) responderForGetAuthorizationRule(resp *http.Response) (result GetAuthorizationRuleResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_list_autorest.go deleted file mode 100644 index 4771b672419..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_list_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package namespaces - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListResponse struct { - HttpResponse *http.Response - Model *[]RelayNamespace - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListResponse, error) -} - -type ListCompleteResult struct { - Items []RelayNamespace -} - -func (r ListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListResponse) LoadMore(ctx context.Context) (resp ListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c NamespacesClient) List(ctx context.Context, id SubscriptionId) (resp ListResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c NamespacesClient) ListComplete(ctx context.Context, id SubscriptionId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, RelayNamespacePredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c NamespacesClient) ListCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate RelayNamespacePredicate) (resp ListCompleteResult, err error) { - items := make([]RelayNamespace, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForList prepares the List request. -func (c NamespacesClient) preparerForList(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Relay/namespaces", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c NamespacesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c NamespacesClient) responderForList(resp *http.Response) (result ListResponse, err error) { - type page struct { - Values []RelayNamespace `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_listauthorizationrules_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_listauthorizationrules_autorest.go deleted file mode 100644 index 8a0ef3d3274..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_listauthorizationrules_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package namespaces - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListAuthorizationRulesResponse struct { - HttpResponse *http.Response - Model *[]AuthorizationRule - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListAuthorizationRulesResponse, error) -} - -type ListAuthorizationRulesCompleteResult struct { - Items []AuthorizationRule -} - -func (r ListAuthorizationRulesResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListAuthorizationRulesResponse) LoadMore(ctx context.Context) (resp ListAuthorizationRulesResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListAuthorizationRules ... -func (c NamespacesClient) ListAuthorizationRules(ctx context.Context, id NamespaceId) (resp ListAuthorizationRulesResponse, err error) { - req, err := c.preparerForListAuthorizationRules(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListAuthorizationRules(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListAuthorizationRulesComplete retrieves all of the results into a single object -func (c NamespacesClient) ListAuthorizationRulesComplete(ctx context.Context, id NamespaceId) (ListAuthorizationRulesCompleteResult, error) { - return c.ListAuthorizationRulesCompleteMatchingPredicate(ctx, id, AuthorizationRulePredicate{}) -} - -// ListAuthorizationRulesCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c NamespacesClient) ListAuthorizationRulesCompleteMatchingPredicate(ctx context.Context, id NamespaceId, predicate AuthorizationRulePredicate) (resp ListAuthorizationRulesCompleteResult, err error) { - items := make([]AuthorizationRule, 0) - - page, err := c.ListAuthorizationRules(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListAuthorizationRulesCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListAuthorizationRules prepares the ListAuthorizationRules request. -func (c NamespacesClient) preparerForListAuthorizationRules(ctx context.Context, id NamespaceId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/authorizationRules", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListAuthorizationRulesWithNextLink prepares the ListAuthorizationRules request with the given nextLink token. -func (c NamespacesClient) preparerForListAuthorizationRulesWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListAuthorizationRules handles the response to the ListAuthorizationRules request. The method always -// closes the http.Response Body. -func (c NamespacesClient) responderForListAuthorizationRules(resp *http.Response) (result ListAuthorizationRulesResponse, err error) { - type page struct { - Values []AuthorizationRule `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListAuthorizationRulesResponse, err error) { - req, err := c.preparerForListAuthorizationRulesWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListAuthorizationRules(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListAuthorizationRules", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_listbyresourcegroup_autorest.go deleted file mode 100644 index 79aacb75d6f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package namespaces - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *[]RelayNamespace - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []RelayNamespace -} - -func (r ListByResourceGroupResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c NamespacesClient) ListByResourceGroup(ctx context.Context, id ResourceGroupId) (resp ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c NamespacesClient) ListByResourceGroupComplete(ctx context.Context, id ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, RelayNamespacePredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c NamespacesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate RelayNamespacePredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]RelayNamespace, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c NamespacesClient) preparerForListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Relay/namespaces", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c NamespacesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c NamespacesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - type page struct { - Values []RelayNamespace `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_listkeys_autorest.go deleted file mode 100644 index 918bcd384ee..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_listkeys_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package namespaces - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListKeysResponse struct { - HttpResponse *http.Response - Model *AccessKeys -} - -// ListKeys ... -func (c NamespacesClient) ListKeys(ctx context.Context, id AuthorizationRuleId) (result ListKeysResponse, err error) { - req, err := c.preparerForListKeys(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "ListKeys", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListKeys prepares the ListKeys request. -func (c NamespacesClient) preparerForListKeys(ctx context.Context, id AuthorizationRuleId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListKeys handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (c NamespacesClient) responderForListKeys(resp *http.Response) (result ListKeysResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_regeneratekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_regeneratekeys_autorest.go deleted file mode 100644 index 8bca26bf2bb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_regeneratekeys_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package namespaces - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type RegenerateKeysResponse struct { - HttpResponse *http.Response - Model *AccessKeys -} - -// RegenerateKeys ... -func (c NamespacesClient) RegenerateKeys(ctx context.Context, id AuthorizationRuleId, input RegenerateAccessKeyParameters) (result RegenerateKeysResponse, err error) { - req, err := c.preparerForRegenerateKeys(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "RegenerateKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "RegenerateKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForRegenerateKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "RegenerateKeys", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForRegenerateKeys prepares the RegenerateKeys request. -func (c NamespacesClient) preparerForRegenerateKeys(ctx context.Context, id AuthorizationRuleId, input RegenerateAccessKeyParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regenerateKeys", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForRegenerateKeys handles the response to the RegenerateKeys request. The method always -// closes the http.Response Body. -func (c NamespacesClient) responderForRegenerateKeys(resp *http.Response) (result RegenerateKeysResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_update_autorest.go deleted file mode 100644 index aed14245eb4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/method_update_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package namespaces - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UpdateResponse struct { - HttpResponse *http.Response - Model *RelayNamespace -} - -// Update ... -func (c NamespacesClient) Update(ctx context.Context, id NamespaceId, input RelayUpdateParameters) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "namespaces.NamespacesClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c NamespacesClient) preparerForUpdate(ctx context.Context, id NamespaceId, input RelayUpdateParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c NamespacesClient) responderForUpdate(resp *http.Response) (result UpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_accesskeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_accesskeys.go deleted file mode 100644 index e1f36b76524..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_accesskeys.go +++ /dev/null @@ -1,9 +0,0 @@ -package namespaces - -type AccessKeys struct { - KeyName *string `json:"keyName,omitempty"` - PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_authorizationrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_authorizationrule.go deleted file mode 100644 index 8568c4d38b9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_authorizationrule.go +++ /dev/null @@ -1,8 +0,0 @@ -package namespaces - -type AuthorizationRule struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties AuthorizationRuleProperties `json:"properties"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_authorizationruleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_authorizationruleproperties.go deleted file mode 100644 index bc6b49a14d5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_authorizationruleproperties.go +++ /dev/null @@ -1,5 +0,0 @@ -package namespaces - -type AuthorizationRuleProperties struct { - Rights []AccessRights `json:"rights"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_checknameavailability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_checknameavailability.go deleted file mode 100644 index beb04ee2725..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_checknameavailability.go +++ /dev/null @@ -1,5 +0,0 @@ -package namespaces - -type CheckNameAvailability struct { - Name string `json:"name"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_checknameavailabilityresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_checknameavailabilityresult.go deleted file mode 100644 index 84d1100ca4e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_checknameavailabilityresult.go +++ /dev/null @@ -1,7 +0,0 @@ -package namespaces - -type CheckNameAvailabilityResult struct { - Message *string `json:"message,omitempty"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason *UnavailableReason `json:"reason,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_regenerateaccesskeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_regenerateaccesskeyparameters.go deleted file mode 100644 index b8e4cc372d0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_regenerateaccesskeyparameters.go +++ /dev/null @@ -1,6 +0,0 @@ -package namespaces - -type RegenerateAccessKeyParameters struct { - Key *string `json:"key,omitempty"` - KeyType KeyType `json:"keyType"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_relaynamespaceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_relaynamespaceproperties.go deleted file mode 100644 index 2c82afd54a4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_relaynamespaceproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -package namespaces - -type RelayNamespaceProperties struct { - CreatedAt *string `json:"createdAt,omitempty"` - MetricId *string `json:"metricId,omitempty"` - ProvisioningState *ProvisioningStateEnum `json:"provisioningState,omitempty"` - ServiceBusEndpoint *string `json:"serviceBusEndpoint,omitempty"` - UpdatedAt *string `json:"updatedAt,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_relayupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_relayupdateparameters.go deleted file mode 100644 index 02880823e0e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_relayupdateparameters.go +++ /dev/null @@ -1,10 +0,0 @@ -package namespaces - -type RelayUpdateParameters struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *RelayNamespaceProperties `json:"properties,omitempty"` - Sku *Sku `json:"sku,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_sku.go deleted file mode 100644 index dca6b93a013..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/model_sku.go +++ /dev/null @@ -1,6 +0,0 @@ -package namespaces - -type Sku struct { - Name SkuName `json:"name"` - Tier *SkuTier `json:"tier,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/predicates.go deleted file mode 100644 index 1cc0ca9847b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/predicates.go +++ /dev/null @@ -1,52 +0,0 @@ -package namespaces - -type AuthorizationRulePredicate struct { - Id *string - Name *string - Type *string -} - -func (p AuthorizationRulePredicate) Matches(input AuthorizationRule) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} - -type RelayNamespacePredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p RelayNamespacePredicate) Matches(input RelayNamespace) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/version.go deleted file mode 100644 index d18784f82e8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package namespaces - -import "fmt" - -const defaultApiVersion = "2017-04-01" - -func userAgent() string { - return fmt.Sprintf("pandora/namespaces/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/validate/hybrid_connection_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/validate/hybrid_connection_id.go deleted file mode 100644 index 2874aef77c0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/validate/hybrid_connection_id.go +++ /dev/null @@ -1,21 +0,0 @@ -package validate - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections" -) - -func HybridConnectionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := hybridconnections.ParseHybridConnectionID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/validate/namespace_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/validate/namespace_id.go deleted file mode 100644 index df94b576cba..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/validate/namespace_id.go +++ /dev/null @@ -1,21 +0,0 @@ -package validate - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces" -) - -func NamespaceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := namespaces.ParseNamespaceID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/management_group_template_deployment_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/management_group_template_deployment_data_source.go new file mode 100644 index 00000000000..a89243141f0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/management_group_template_deployment_data_source.go @@ -0,0 +1,76 @@ +package resource + +import ( + "fmt" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + mgValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/managementgroup/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func dataSourceManagementGroupTemplateDeployment() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceManagementGroupTemplateDeploymentRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.TemplateDeploymentName, + }, + + "management_group_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: mgValidate.ManagementGroupID, + }, + + // Computed + "output_content": { + Type: pluginsdk.TypeString, + Computed: true, + // NOTE: outputs can be strings, ints, objects etc - whilst using a nested object was considered + // parsing the JSON using `jsondecode` allows the users to interact with/map objects as required + }, + }, + } +} + +func dataSourceManagementGroupTemplateDeploymentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Resource.DeploymentsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + managementGroupId := d.Get("management_group_id").(string) + deploymentName := d.Get("name").(string) + + resp, err := client.GetAtManagementGroupScope(ctx, managementGroupId, deploymentName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("deployment %s in Management Group %s was not found", deploymentName, managementGroupId) + } + + return fmt.Errorf("retrieving Management Group Template Deployment %s in management group %s: %+v", deploymentName, managementGroupId, err) + } + + d.SetId(*resp.ID) + + if props := resp.Properties; props != nil { + flattenedOutputs, err := flattenTemplateDeploymentBody(props.Outputs) + if err != nil { + return fmt.Errorf("flattening `output_content`: %+v", err) + } + return d.Set("output_content", flattenedOutputs) + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/registration.go index 04e8a80cbfd..bb187c38f04 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/registration.go @@ -29,9 +29,13 @@ func (r Registration) WebsiteCategories() []string { // SupportedDataSources returns the supported Data Sources supported by this Service func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ - "azurerm_resources": dataSourceResources(), - "azurerm_resource_group": dataSourceResourceGroup(), - "azurerm_template_spec_version": dataSourceTemplateSpecVersion(), + "azurerm_resources": dataSourceResources(), + "azurerm_resource_group": dataSourceResourceGroup(), + "azurerm_template_spec_version": dataSourceTemplateSpecVersion(), + "azurerm_management_group_template_deployment": dataSourceManagementGroupTemplateDeployment(), + "azurerm_resource_group_template_deployment": dataSourceResourceGroupTemplateDeployment(), + "azurerm_subscription_template_deployment": dataSourceSubscriptionTemplateDeployment(), + "azurerm_tenant_template_deployment": dataSourceTenantTemplateDeployment(), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/resource_group_template_deployment_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/resource_group_template_deployment_data_source.go new file mode 100644 index 00000000000..787e8a01897 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/resource_group_template_deployment_data_source.go @@ -0,0 +1,75 @@ +package resource + +import ( + "fmt" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func dataSourceResourceGroupTemplateDeployment() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceResourceGroupTemplateDeploymentRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.TemplateDeploymentName, + }, + + "resource_group_name": azure.SchemaResourceGroupNameForDataSource(), + + // Computed + "output_content": { + Type: pluginsdk.TypeString, + Computed: true, + // NOTE: outputs can be strings, ints, objects etc - whilst using a nested object was considered + // parsing the JSON using `jsondecode` allows the users to interact with/map objects as required + }, + }, + } +} + +func dataSourceResourceGroupTemplateDeploymentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Resource.DeploymentsClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + resourceGroupName := d.Get("resource_group_name").(string) + deploymentName := d.Get("name").(string) + id := parse.NewResourceGroupTemplateDeploymentID(subscriptionId, resourceGroupName, deploymentName) + + resp, err := client.Get(ctx, id.ResourceGroup, id.DeploymentName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("template %s in resource Group %s was not found", deploymentName, resourceGroupName) + } + + return fmt.Errorf("retrieving Template Deployment %q (Resource Group %q): %+v", id.DeploymentName, id.ResourceGroup, err) + } + + d.SetId(id.ID()) + + if props := resp.Properties; props != nil { + flattenedOutputs, err := flattenTemplateDeploymentBody(props.Outputs) + if err != nil { + return fmt.Errorf("flattening `output_content`: %+v", err) + } + return d.Set("output_content", flattenedOutputs) + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/subscription_template_deployment_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/subscription_template_deployment_data_source.go new file mode 100644 index 00000000000..2f9c92fb6f8 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/subscription_template_deployment_data_source.go @@ -0,0 +1,68 @@ +package resource + +import ( + "fmt" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func dataSourceSubscriptionTemplateDeployment() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceSubscriptionTemplateDeploymentRead, + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.TemplateDeploymentName, + }, + + // Computed + "output_content": { + Type: pluginsdk.TypeString, + Computed: true, + // NOTE: outputs can be strings, ints, objects etc - whilst using a nested object was considered + // parsing the JSON using `jsondecode` allows the users to interact with/map objects as required + }, + }, + } +} + +func dataSourceSubscriptionTemplateDeploymentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Resource.DeploymentsClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) + defer cancel() + + id := parse.NewSubscriptionTemplateDeploymentID(subscriptionId, d.Get("name").(string)) + + resp, err := client.GetAtSubscriptionScope(ctx, id.DeploymentName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("template %s in subscription %s was not found", id.DeploymentName, subscriptionId) + } + + return fmt.Errorf("retrieving Subscription Template Deployment %q: %+v", id.DeploymentName, err) + } + + d.SetId(id.ID()) + + if props := resp.Properties; props != nil { + flattenedOutputs, err := flattenTemplateDeploymentBody(props.Outputs) + if err != nil { + return fmt.Errorf("flattening `output_content`: %+v", err) + } + return d.Set("output_content", flattenedOutputs) + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/template_deployment_common.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/template_deployment_common.go index b4ef6f83b55..07cb3ee6980 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/template_deployment_common.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/template_deployment_common.go @@ -6,6 +6,7 @@ import ( "fmt" "log" "net/http" + "regexp" "strings" providers "github.com/Azure/azure-sdk-for-go/profiles/2017-03-09/resources/mgmt/resources" @@ -172,16 +173,31 @@ func deleteItemsProvisionedByTemplate(ctx context.Context, client *client.Client return fmt.Errorf("parsing ID %q from Template Output to delete it: %+v", *nestedResource.ID, err) } - resourceProviderApiVersion, ok := (*resourceProviderApiVersions)[parsedId.Provider] + resourceProviderApiVersion, ok := (*resourceProviderApiVersions)[strings.ToLower(parsedId.Provider)] if !ok { - resourceProviderApiVersion, ok = (*resourceProviderApiVersions)[parsedId.SecondaryProvider] + resourceProviderApiVersion, ok = (*resourceProviderApiVersions)[strings.ToLower(parsedId.SecondaryProvider)] if !ok { - return fmt.Errorf("API version information for RP %q was not found", parsedId.Provider) + return fmt.Errorf("API version information for RP %q (%q) was not found - nestedResource=%q", parsedId.Provider, parsedId.SecondaryProvider, *nestedResource.ID) } } log.Printf("[DEBUG] Deleting Nested Resource %q..", *nestedResource.ID) future, err := resourcesClient.DeleteByID(ctx, *nestedResource.ID, resourceProviderApiVersion) + + // NOTE: resourceProviderApiVersion is gotten from one of resource types of the provider. + // When the provider has multiple resource types, it may cause API version mismatched. + // For such error, try to get available API version from error code. Ugly but this seems sufficient for now + if err != nil && strings.Contains(err.Error(), `Code="NoRegisteredProviderFound"`) { + apiPat := regexp.MustCompile(`\d{4}-\d{2}-\d{2}(-preview)*`) + matches := apiPat.FindAllStringSubmatch(err.Error(), -1) + for _, match := range matches { + if resourceProviderApiVersion != match[0] { + future, err = resourcesClient.DeleteByID(ctx, *nestedResource.ID, match[0]) + break + } + } + } + if err != nil { if resp := future.Response(); resp != nil && resp.StatusCode == http.StatusNotFound { log.Printf("[DEBUG] Nested Resource %q has been deleted.. continuing..", *nestedResource.ID) @@ -228,7 +244,7 @@ func determineResourceProviderAPIVersionsForResources(ctx context.Context, clien // NOTE: there's an enhancement in that not all RP's necessarily offer everything in every version // but the majority do, so this is likely sufficient for now - resourceProviderApiVersions[resourceProviderName] = *apiVersion + resourceProviderApiVersions[strings.ToLower(resourceProviderName)] = *apiVersion break } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/template_deployment_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/template_deployment_resource.go index fa66e06326d..772f44a54ec 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/template_deployment_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/template_deployment_resource.go @@ -13,7 +13,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -41,7 +40,7 @@ func resourceTemplateDeployment() *pluginsdk.Resource { 0: migration.TemplateDeploymentV0ToV1{}, }), - DeprecationMessage: features.DeprecatedInThreePointOh("The resource 'azurerm_template_deployment' has been superseded by the 'azurerm_resource_group_template_deployment' resource."), + DeprecationMessage: "The resource 'azurerm_template_deployment' has been superseded by the 'azurerm_resource_group_template_deployment' resource.", Schema: map[string]*pluginsdk.Schema{ "name": { @@ -268,10 +267,13 @@ func resourceTemplateDeploymentDelete(d *pluginsdk.ResourceData, meta interface{ if err != nil { return err } - - if _, err = client.Delete(ctx, id.ResourceGroup, id.DeploymentName); err != nil { + future, err := client.Delete(ctx, id.ResourceGroup, id.DeploymentName) + if err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for deletion of %q: %+v", id, err) + } if err := waitForTemplateDeploymentToBeDeleted(ctx, client, *id); err != nil { return fmt.Errorf("waiting for deletion of %s: %+v", id, err) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/tenant_template_deployment_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/tenant_template_deployment_data_source.go new file mode 100644 index 00000000000..2e8bd8e85a7 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/tenant_template_deployment_data_source.go @@ -0,0 +1,67 @@ +package resource + +import ( + "fmt" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func dataSourceTenantTemplateDeployment() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceTenantTemplateDeploymentRead, + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.TemplateDeploymentName, + }, + + // Computed + "output_content": { + Type: pluginsdk.TypeString, + Computed: true, + // NOTE: outputs can be strings, ints, objects etc - whilst using a nested object was considered + // parsing the JSON using `jsondecode` allows the users to interact with/map objects as required + }, + }, + } +} + +func dataSourceTenantTemplateDeploymentRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).Resource.DeploymentsClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id := parse.NewTenantTemplateDeploymentID(d.Get("name").(string)) + + resp, err := client.GetAtTenantScope(ctx, id.DeploymentName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("template %s in tenant was not found", id.DeploymentName) + } + + return fmt.Errorf("retrieving Tenant Template Deployment %q: %+v", id.DeploymentName, err) + } + + d.SetId(id.ID()) + + if props := resp.Properties; props != nil { + flattenedOutputs, err := flattenTemplateDeploymentBody(props.Outputs) + if err != nil { + return fmt.Errorf("flattening `output_content`: %+v", err) + } + return d.Set("output_content", flattenedOutputs) + } + + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/client/client.go index 1ac0dd373f6..b385a24d29a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/client/client.go @@ -1,10 +1,10 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys" + "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys" + "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/method_get_autorest.go deleted file mode 100644 index 92201ae1779..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys/method_get_autorest.go +++ /dev/null @@ -1,94 +0,0 @@ -package adminkeys - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *AdminKeyResult -} - -type GetOperationOptions struct { - XMsClientRequestId *string -} - -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} -} - -func (o GetOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.XMsClientRequestId != nil { - out["x-ms-client-request-id"] = *o.XMsClientRequestId - } - - return out -} - -func (o GetOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Get ... -func (c AdminKeysClient) Get(ctx context.Context, id SearchServiceId, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "adminkeys.AdminKeysClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "adminkeys.AdminKeysClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "adminkeys.AdminKeysClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c AdminKeysClient) preparerForGet(ctx context.Context, id SearchServiceId, options GetOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/listAdminKeys", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c AdminKeysClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/method_create_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/method_create_autorest.go deleted file mode 100644 index d49333f9e3d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/method_create_autorest.go +++ /dev/null @@ -1,93 +0,0 @@ -package querykeys - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateOperationResponse struct { - HttpResponse *http.Response - Model *QueryKey -} - -type CreateOperationOptions struct { - XMsClientRequestId *string -} - -func DefaultCreateOperationOptions() CreateOperationOptions { - return CreateOperationOptions{} -} - -func (o CreateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.XMsClientRequestId != nil { - out["x-ms-client-request-id"] = *o.XMsClientRequestId - } - - return out -} - -func (o CreateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Create ... -func (c QueryKeysClient) Create(ctx context.Context, id CreateQueryKeyId, options CreateOperationOptions) (result CreateOperationResponse, err error) { - req, err := c.preparerForCreate(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "querykeys.QueryKeysClient", "Create", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "querykeys.QueryKeysClient", "Create", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "querykeys.QueryKeysClient", "Create", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreate prepares the Create request. -func (c QueryKeysClient) preparerForCreate(ctx context.Context, id CreateQueryKeyId, options CreateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreate handles the response to the Create request. The method always -// closes the http.Response Body. -func (c QueryKeysClient) responderForCreate(resp *http.Response) (result CreateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/method_delete_autorest.go deleted file mode 100644 index 4e4c1b9c771..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys/method_delete_autorest.go +++ /dev/null @@ -1,91 +0,0 @@ -package querykeys - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - XMsClientRequestId *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.XMsClientRequestId != nil { - out["x-ms-client-request-id"] = *o.XMsClientRequestId - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c QueryKeysClient) Delete(ctx context.Context, id DeleteQueryKeyId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "querykeys.QueryKeysClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "querykeys.QueryKeysClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "querykeys.QueryKeysClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c QueryKeysClient) preparerForDelete(ctx context.Context, id DeleteQueryKeyId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c QueryKeysClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_checknameavailability_autorest.go deleted file mode 100644 index bafbef2235d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_checknameavailability_autorest.go +++ /dev/null @@ -1,96 +0,0 @@ -package services - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -type CheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - Model *CheckNameAvailabilityOutput -} - -type CheckNameAvailabilityOperationOptions struct { - XMsClientRequestId *string -} - -func DefaultCheckNameAvailabilityOperationOptions() CheckNameAvailabilityOperationOptions { - return CheckNameAvailabilityOperationOptions{} -} - -func (o CheckNameAvailabilityOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.XMsClientRequestId != nil { - out["x-ms-client-request-id"] = *o.XMsClientRequestId - } - - return out -} - -func (o CheckNameAvailabilityOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CheckNameAvailability ... -func (c ServicesClient) CheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckNameAvailabilityInput, options CheckNameAvailabilityOperationOptions) (result CheckNameAvailabilityOperationResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c ServicesClient) preparerForCheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input CheckNameAvailabilityInput, options CheckNameAvailabilityOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Search/checkNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c ServicesClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_createorupdate_autorest.go deleted file mode 100644 index ab594d179f5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_createorupdate_autorest.go +++ /dev/null @@ -1,104 +0,0 @@ -package services - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateOrUpdateOperationResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -type CreateOrUpdateOperationOptions struct { - XMsClientRequestId *string -} - -func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { - return CreateOrUpdateOperationOptions{} -} - -func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.XMsClientRequestId != nil { - out["x-ms-client-request-id"] = *o.XMsClientRequestId - } - - return out -} - -func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// CreateOrUpdate ... -func (c ServicesClient) CreateOrUpdate(ctx context.Context, id SearchServiceId, input SearchService, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ServicesClient) CreateOrUpdateThenPoll(ctx context.Context, id SearchServiceId, input SearchService, options CreateOrUpdateOperationOptions) error { - result, err := c.CreateOrUpdate(ctx, id, input, options) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ServicesClient) preparerForCreateOrUpdate(ctx context.Context, id SearchServiceId, input SearchService, options CreateOrUpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c ServicesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_delete_autorest.go deleted file mode 100644 index 6df12a407b6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_delete_autorest.go +++ /dev/null @@ -1,91 +0,0 @@ -package services - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteOperationResponse struct { - HttpResponse *http.Response -} - -type DeleteOperationOptions struct { - XMsClientRequestId *string -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.XMsClientRequestId != nil { - out["x-ms-client-request-id"] = *o.XMsClientRequestId - } - - return out -} - -func (o DeleteOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Delete ... -func (c ServicesClient) Delete(ctx context.Context, id SearchServiceId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { - req, err := c.preparerForDelete(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ServicesClient) preparerForDelete(ctx context.Context, id SearchServiceId, options DeleteOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ServicesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_get_autorest.go deleted file mode 100644 index db477a43abd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_get_autorest.go +++ /dev/null @@ -1,93 +0,0 @@ -package services - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *SearchService -} - -type GetOperationOptions struct { - XMsClientRequestId *string -} - -func DefaultGetOperationOptions() GetOperationOptions { - return GetOperationOptions{} -} - -func (o GetOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.XMsClientRequestId != nil { - out["x-ms-client-request-id"] = *o.XMsClientRequestId - } - - return out -} - -func (o GetOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Get ... -func (c ServicesClient) Get(ctx context.Context, id SearchServiceId, options GetOperationOptions) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ServicesClient) preparerForGet(ctx context.Context, id SearchServiceId, options GetOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ServicesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_listbyresourcegroup_autorest.go deleted file mode 100644 index c33813ccf80..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,213 +0,0 @@ -package services - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -type ListByResourceGroupOperationResponse struct { - HttpResponse *http.Response - Model *[]SearchService - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupOperationResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []SearchService -} - -func (r ListByResourceGroupOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupOperationResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByResourceGroupOperationOptions struct { - XMsClientRequestId *string -} - -func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { - return ListByResourceGroupOperationOptions{} -} - -func (o ListByResourceGroupOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.XMsClientRequestId != nil { - out["x-ms-client-request-id"] = *o.XMsClientRequestId - } - - return out -} - -func (o ListByResourceGroupOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// ListByResourceGroup ... -func (c ServicesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (resp ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c ServicesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, SearchServiceOperationPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ServicesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate SearchServiceOperationPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]SearchService, 0) - - page, err := c.ListByResourceGroup(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c ServicesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Search/searchServices", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c ServicesClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c ServicesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { - type page struct { - Values []SearchService `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupOperationResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_listbysubscription_autorest.go deleted file mode 100644 index febd82882b2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_listbysubscription_autorest.go +++ /dev/null @@ -1,213 +0,0 @@ -package services - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -type ListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - Model *[]SearchService - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionOperationResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []SearchService -} - -func (r ListBySubscriptionOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListBySubscriptionOperationOptions struct { - XMsClientRequestId *string -} - -func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { - return ListBySubscriptionOperationOptions{} -} - -func (o ListBySubscriptionOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.XMsClientRequestId != nil { - out["x-ms-client-request-id"] = *o.XMsClientRequestId - } - - return out -} - -func (o ListBySubscriptionOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// ListBySubscription ... -func (c ServicesClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (resp ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c ServicesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, SearchServiceOperationPredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ServicesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions, predicate SearchServiceOperationPredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]SearchService, 0) - - page, err := c.ListBySubscription(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c ServicesClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Search/searchServices", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c ServicesClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListBySubscription handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (c ServicesClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionOperationResponse, err error) { - type page struct { - Values []SearchService `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionOperationResponse, err error) { - req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_update_autorest.go deleted file mode 100644 index 9c3ed685b3c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/method_update_autorest.go +++ /dev/null @@ -1,94 +0,0 @@ -package services - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UpdateOperationResponse struct { - HttpResponse *http.Response - Model *SearchService -} - -type UpdateOperationOptions struct { - XMsClientRequestId *string -} - -func DefaultUpdateOperationOptions() UpdateOperationOptions { - return UpdateOperationOptions{} -} - -func (o UpdateOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - if o.XMsClientRequestId != nil { - out["x-ms-client-request-id"] = *o.XMsClientRequestId - } - - return out -} - -func (o UpdateOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -// Update ... -func (c ServicesClient) Update(ctx context.Context, id SearchServiceId, input SearchService, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input, options) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "services.ServicesClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ServicesClient) preparerForUpdate(ctx context.Context, id SearchServiceId, input SearchService, options UpdateOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ServicesClient) responderForUpdate(resp *http.Response) (result UpdateOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_iprule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_iprule.go deleted file mode 100644 index f5bae927d3b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_iprule.go +++ /dev/null @@ -1,8 +0,0 @@ -package services - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type IpRule struct { - Value *string `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_networkruleset.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_networkruleset.go deleted file mode 100644 index 26bd5d37299..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services/model_networkruleset.go +++ /dev/null @@ -1,8 +0,0 @@ -package services - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type NetworkRuleSet struct { - IpRules *[]IpRule `json:"ipRules,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/search_service_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/search_service_data_source.go index 316be98e5a7..4a927bd1e55 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/search_service_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/search_service_data_source.go @@ -7,11 +7,11 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys" + "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys" + "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/search_service_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/search_service_resource.go index edb1c0ea7a1..1d2f5f9f3bb 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/search_service_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/search/search_service_resource.go @@ -10,13 +10,13 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys" + "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys" + "github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -175,7 +175,7 @@ func resourceSearchServiceCreateUpdate(d *pluginsdk.ResourceData, meta interface Properties: &services.SearchServiceProperties{ PublicNetworkAccess: &publicNetworkAccess, NetworkRuleSet: &services.NetworkRuleSet{ - IpRules: expandSearchServiceIPRules(d.Get("allowed_ips").([]interface{})), + IPRules: expandSearchServiceIPRules(d.Get("allowed_ips").([]interface{})), }, }, Identity: expandedIdentity, @@ -335,15 +335,15 @@ func flattenSearchQueryKeys(input []querykeys.QueryKey) []interface{} { return results } -func expandSearchServiceIPRules(input []interface{}) *[]services.IpRule { - output := make([]services.IpRule, 0) +func expandSearchServiceIPRules(input []interface{}) *[]services.IPRule { + output := make([]services.IPRule, 0) if input == nil { return &output } for _, rule := range input { if rule != nil { - output = append(output, services.IpRule{ + output = append(output, services.IPRule{ Value: utils.String(rule.(string)), }) } @@ -353,11 +353,11 @@ func expandSearchServiceIPRules(input []interface{}) *[]services.IpRule { } func flattenSearchServiceIPRules(input *services.NetworkRuleSet) []interface{} { - if input == nil || *input.IpRules == nil || len(*input.IpRules) == 0 { + if input == nil || *input.IPRules == nil || len(*input.IPRules) == 0 { return nil } result := make([]interface{}, 0) - for _, rule := range *input.IpRules { + for _, rule := range *input.IPRules { result = append(result, rule.Value) } return result diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/securitycenter/security_center_server_vulnerability_assessment_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/securitycenter/security_center_server_vulnerability_assessment_resource.go index 321826e013d..e435b11ea82 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/securitycenter/security_center_server_vulnerability_assessment_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/securitycenter/security_center_server_vulnerability_assessment_resource.go @@ -6,9 +6,8 @@ import ( "strings" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v3.0/security" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -41,7 +40,7 @@ func resourceServerVulnerabilityAssessment() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(10 * time.Minute), }, - DeprecationMessage: `This resource has been deprecated in favour of the 'azurerm_security_center_vm_server_vulnerability_assessment' resource and will be removed in v4.0 of the AzureRM Provider`, + DeprecationMessage: `This resource has been deprecated in favour of the 'azurerm_security_center_server_vulnerability_assessment_virtual_machine' resource and will be removed in v4.0 of the AzureRM Provider`, Schema: map[string]*pluginsdk.Schema{ "virtual_machine_id": { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/client/client.go index 056875696da..e82bcbd8961 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/client/client.go @@ -1,44 +1,67 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - QueuesClient *servicebus.QueuesClient - DisasterRecoveryConfigsClient *servicebus.DisasterRecoveryConfigsClient - NamespacesClient *servicebus.NamespacesClient - TopicsClient *servicebus.TopicsClient - SubscriptionsClient *servicebus.SubscriptionsClient - SubscriptionRulesClient *servicebus.RulesClient + DisasterRecoveryConfigsClient *disasterrecoveryconfigs.DisasterRecoveryConfigsClient + NamespacesAuthClient *namespacesauthorizationrule.NamespacesAuthorizationRuleClient + NamespacesClient *namespaces.NamespacesClient + QueuesAuthClient *queuesauthorizationrule.QueuesAuthorizationRuleClient + QueuesClient *queues.QueuesClient + SubscriptionsClient *subscriptions.SubscriptionsClient + SubscriptionRulesClient *rules.RulesClient + TopicsAuthClient *topicsauthorizationrule.TopicsAuthorizationRuleClient + TopicsClient *topics.TopicsClient } func NewClient(o *common.ClientOptions) *Client { - QueuesClient := servicebus.NewQueuesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&QueuesClient.Client, o.ResourceManagerAuthorizer) - - DisasterRecoveryConfigsClient := servicebus.NewDisasterRecoveryConfigsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + DisasterRecoveryConfigsClient := disasterrecoveryconfigs.NewDisasterRecoveryConfigsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&DisasterRecoveryConfigsClient.Client, o.ResourceManagerAuthorizer) - NamespacesClient := servicebus.NewNamespacesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + NamespacesAuthClient := namespacesauthorizationrule.NewNamespacesAuthorizationRuleClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&NamespacesAuthClient.Client, o.ResourceManagerAuthorizer) + + NamespacesClient := namespaces.NewNamespacesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&NamespacesClient.Client, o.ResourceManagerAuthorizer) - TopicsClient := servicebus.NewTopicsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&TopicsClient.Client, o.ResourceManagerAuthorizer) + QueuesAuthClient := queuesauthorizationrule.NewQueuesAuthorizationRuleClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&QueuesAuthClient.Client, o.ResourceManagerAuthorizer) - SubscriptionsClient := servicebus.NewSubscriptionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + QueuesClient := queues.NewQueuesClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&QueuesClient.Client, o.ResourceManagerAuthorizer) + + SubscriptionsClient := subscriptions.NewSubscriptionsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&SubscriptionsClient.Client, o.ResourceManagerAuthorizer) - SubscriptionRulesClient := servicebus.NewRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + SubscriptionRulesClient := rules.NewRulesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&SubscriptionRulesClient.Client, o.ResourceManagerAuthorizer) + TopicsAuthClient := topicsauthorizationrule.NewTopicsAuthorizationRuleClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&TopicsAuthClient.Client, o.ResourceManagerAuthorizer) + + TopicsClient := topics.NewTopicsClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&TopicsClient.Client, o.ResourceManagerAuthorizer) + return &Client{ - QueuesClient: &QueuesClient, DisasterRecoveryConfigsClient: &DisasterRecoveryConfigsClient, + NamespacesAuthClient: &NamespacesAuthClient, NamespacesClient: &NamespacesClient, - TopicsClient: &TopicsClient, + QueuesAuthClient: &QueuesAuthClient, + QueuesClient: &QueuesClient, SubscriptionsClient: &SubscriptionsClient, SubscriptionRulesClient: &SubscriptionRulesClient, + TopicsAuthClient: &TopicsAuthClient, + TopicsClient: &TopicsClient, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/internal.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/internal.go index 22e15c42067..f60d399a055 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/internal.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/internal.go @@ -7,40 +7,42 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) -func expandAuthorizationRuleRights(d *pluginsdk.ResourceData) *[]servicebus.AccessRights { - rights := make([]servicebus.AccessRights, 0) +func expandAuthorizationRuleRights(d *pluginsdk.ResourceData) *[]namespacesauthorizationrule.AccessRights { + rights := make([]namespacesauthorizationrule.AccessRights, 0) if d.Get("listen").(bool) { - rights = append(rights, servicebus.AccessRightsListen) + rights = append(rights, namespacesauthorizationrule.AccessRightsListen) } if d.Get("send").(bool) { - rights = append(rights, servicebus.AccessRightsSend) + rights = append(rights, namespacesauthorizationrule.AccessRightsSend) } if d.Get("manage").(bool) { - rights = append(rights, servicebus.AccessRightsManage) + rights = append(rights, namespacesauthorizationrule.AccessRightsManage) } return &rights } -func flattenAuthorizationRuleRights(rights *[]servicebus.AccessRights) (listen, send, manage bool) { +func flattenAuthorizationRuleRights(rights *[]namespacesauthorizationrule.AccessRights) (listen, send, manage bool) { // zero (initial) value for a bool in go is false if rights != nil { for _, right := range *rights { switch right { - case servicebus.AccessRightsListen: + case namespacesauthorizationrule.AccessRightsListen: listen = true - case servicebus.AccessRightsSend: + case namespacesauthorizationrule.AccessRightsSend: send = true - case servicebus.AccessRightsManage: + case namespacesauthorizationrule.AccessRightsManage: manage = true default: log.Printf("[DEBUG] Unknown Authorization Rule Right '%s'", right) @@ -116,45 +118,51 @@ func authorizationRuleCustomizeDiff(ctx context.Context, d *pluginsdk.ResourceDi return nil } -func waitForPairedNamespaceReplication(ctx context.Context, meta interface{}, resourceGroup, namespaceName string, timeout time.Duration) error { +func waitForPairedNamespaceReplication(ctx context.Context, meta interface{}, id namespaces.NamespaceId, timeout time.Duration) error { namespaceClient := meta.(*clients.Client).ServiceBus.NamespacesClient - namespace, err := namespaceClient.Get(ctx, resourceGroup, namespaceName) + resp, err := namespaceClient.Get(ctx, id) - if !strings.EqualFold(string(namespace.Sku.Name), "Premium") { - return err + if model := resp.Model; model != nil { + if !strings.EqualFold(string(model.Sku.Name), "Premium") { + return err + } } disasterRecoveryClient := meta.(*clients.Client).ServiceBus.DisasterRecoveryConfigsClient - disasterRecoveryResponse, err := disasterRecoveryClient.List(ctx, resourceGroup, namespaceName) - if disasterRecoveryResponse.Values() == nil { + disasterRecoveryNamespaceId := disasterrecoveryconfigs.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) + disasterRecoveryResponse, err := disasterRecoveryClient.List(ctx, disasterRecoveryNamespaceId) + + if disasterRecoveryResponse.Model == nil { return err } - if len(disasterRecoveryResponse.Values()) != 1 { + if len(*disasterRecoveryResponse.Model) != 1 { return err } - aliasName := *disasterRecoveryResponse.Values()[0].Name + aliasName := (*disasterRecoveryResponse.Model)[0].Name + + disasterRecoveryConfigId := disasterrecoveryconfigs.NewDisasterRecoveryConfigID(disasterRecoveryNamespaceId.SubscriptionId, disasterRecoveryNamespaceId.ResourceGroupName, disasterRecoveryNamespaceId.NamespaceName, *aliasName) stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{string(servicebus.ProvisioningStateDRAccepted)}, - Target: []string{string(servicebus.ProvisioningStateDRSucceeded)}, + Pending: []string{string(disasterrecoveryconfigs.ProvisioningStateDRAccepted)}, + Target: []string{string(disasterrecoveryconfigs.ProvisioningStateDRSucceeded)}, MinTimeout: 30 * time.Second, Timeout: timeout, Refresh: func() (interface{}, string, error) { - read, err := disasterRecoveryClient.Get(ctx, resourceGroup, namespaceName, aliasName) + resp, err := disasterRecoveryClient.Get(ctx, disasterRecoveryConfigId) if err != nil { - return nil, "error", fmt.Errorf("wait read Service Bus Namespace Disaster Recovery Configs %q (Namespace %q / Resource Group %q): %v", aliasName, namespaceName, resourceGroup, err) + return nil, "error", fmt.Errorf("wait read for %s: %v", disasterRecoveryConfigId, err) } - if props := read.ArmDisasterRecoveryProperties; props != nil { - if props.ProvisioningState == servicebus.ProvisioningStateDRFailed { - return read, "failed", fmt.Errorf("replication for Service Bus Namespace Disaster Recovery Configs %q (Namespace %q / Resource Group %q) failed", aliasName, namespaceName, resourceGroup) + if model := resp.Model; model != nil { + if *model.Properties.ProvisioningState == disasterrecoveryconfigs.ProvisioningStateDRFailed { + return resp, "failed", fmt.Errorf("replication for %s failed", disasterRecoveryConfigId) } - return read, string(props.ProvisioningState), nil + return resp, string(*model.Properties.ProvisioningState), nil } - return read, "nil", fmt.Errorf("waiting for replication error Service Bus Namespace Disaster Recovery Configs %q (Namespace %q / Resource Group %q): provisioning state is nil", aliasName, namespaceName, resourceGroup) + return resp, "nil", fmt.Errorf("waiting for replication error for %s: provisioning state is nil", disasterRecoveryConfigId) }, } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration/namespace_auth_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration/namespace_auth_rule.go new file mode 100644 index 00000000000..2395be45974 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration/namespace_auth_rule.go @@ -0,0 +1,98 @@ +package migration + +import ( + "context" + + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +var _ pluginsdk.StateUpgrade = ServicebusNamespaceAuthRuleV0ToV1{} + +type ServicebusNamespaceAuthRuleV0ToV1 struct{} + +func (ServicebusNamespaceAuthRuleV0ToV1) Schema() map[string]*pluginsdk.Schema { + s := map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + //lintignore: S013 + "namespace_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "listen": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "send": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "manage": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "primary_key": { + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, + }, + + "primary_connection_string": { + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, + }, + + "secondary_key": { + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, + }, + + "secondary_connection_string": { + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, + }, + + "primary_connection_string_alias": { + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, + }, + + "secondary_connection_string_alias": { + Type: pluginsdk.TypeString, + Computed: true, + Sensitive: true, + }, + } + return s +} + +func (ServicebusNamespaceAuthRuleV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { + return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + + oldID := rawState["id"].(string) + + id, err := namespacesauthorizationrule.ParseAuthorizationRuleIDInsensitively(oldID) + if err != nil { + return nil, err + } + rawState["id"] = id.ID() + + return rawState, nil + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration/namespace_network_rule_set.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration/namespace_network_rule_set.go index 47cd705c7cb..6985a1d0067 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration/namespace_network_rule_set.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration/namespace_network_rule_set.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -70,7 +70,7 @@ func (NamespaceNetworkRuleSetV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { oldId = strings.TrimSuffix(oldId, "/networkrulesets/default") } - id, err := parse.NamespaceID(oldId) + id, err := namespaces.ParseNamespaceID(oldId) if err != nil { return nil, err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration/subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration/subscription.go index 3ef85891f0e..2931abf633a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration/subscription.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration/subscription.go @@ -3,7 +3,7 @@ package migration import ( "context" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -91,7 +91,7 @@ func (ServiceBusSubscriptionV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { oldId := rawState["id"].(string) - id, err := parse.SubscriptionID(oldId) + id, err := subscriptions.ParseSubscriptions2ID(oldId) if err != nil { return nil, err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/namespace.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/namespace.go deleted file mode 100644 index 45005b2d478..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/namespace.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type NamespaceId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewNamespaceID(subscriptionId, resourceGroup, name string) NamespaceId { - return NamespaceId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id NamespaceId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Namespace", segmentsStr) -} - -func (id NamespaceId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// NamespaceID parses a Namespace ID into an NamespaceId struct -func NamespaceID(input string) (*NamespaceId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := NamespaceId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("namespaces"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/namespace_authorization_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/namespace_authorization_rule.go deleted file mode 100644 index 325f8b07058..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/namespace_authorization_rule.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type NamespaceAuthorizationRuleId struct { - SubscriptionId string - ResourceGroup string - NamespaceName string - AuthorizationRuleName string -} - -func NewNamespaceAuthorizationRuleID(subscriptionId, resourceGroup, namespaceName, authorizationRuleName string) NamespaceAuthorizationRuleId { - return NamespaceAuthorizationRuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NamespaceName: namespaceName, - AuthorizationRuleName: authorizationRuleName, - } -} - -func (id NamespaceAuthorizationRuleId) String() string { - segments := []string{ - fmt.Sprintf("Authorization Rule Name %q", id.AuthorizationRuleName), - fmt.Sprintf("Namespace Name %q", id.NamespaceName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Namespace Authorization Rule", segmentsStr) -} - -func (id NamespaceAuthorizationRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/AuthorizationRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.AuthorizationRuleName) -} - -// NamespaceAuthorizationRuleID parses a NamespaceAuthorizationRule ID into an NamespaceAuthorizationRuleId struct -func NamespaceAuthorizationRuleID(input string) (*NamespaceAuthorizationRuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := NamespaceAuthorizationRuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NamespaceName, err = id.PopSegment("namespaces"); err != nil { - return nil, err - } - if resourceId.AuthorizationRuleName, err = id.PopSegment("AuthorizationRules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/namespace_disaster_recovery_config.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/namespace_disaster_recovery_config.go deleted file mode 100644 index a59b73a345c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/namespace_disaster_recovery_config.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type NamespaceDisasterRecoveryConfigId struct { - SubscriptionId string - ResourceGroup string - NamespaceName string - DisasterRecoveryConfigName string -} - -func NewNamespaceDisasterRecoveryConfigID(subscriptionId, resourceGroup, namespaceName, disasterRecoveryConfigName string) NamespaceDisasterRecoveryConfigId { - return NamespaceDisasterRecoveryConfigId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NamespaceName: namespaceName, - DisasterRecoveryConfigName: disasterRecoveryConfigName, - } -} - -func (id NamespaceDisasterRecoveryConfigId) String() string { - segments := []string{ - fmt.Sprintf("Disaster Recovery Config Name %q", id.DisasterRecoveryConfigName), - fmt.Sprintf("Namespace Name %q", id.NamespaceName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Namespace Disaster Recovery Config", segmentsStr) -} - -func (id NamespaceDisasterRecoveryConfigId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/disasterRecoveryConfigs/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.DisasterRecoveryConfigName) -} - -// NamespaceDisasterRecoveryConfigID parses a NamespaceDisasterRecoveryConfig ID into an NamespaceDisasterRecoveryConfigId struct -func NamespaceDisasterRecoveryConfigID(input string) (*NamespaceDisasterRecoveryConfigId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := NamespaceDisasterRecoveryConfigId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NamespaceName, err = id.PopSegment("namespaces"); err != nil { - return nil, err - } - if resourceId.DisasterRecoveryConfigName, err = id.PopSegment("disasterRecoveryConfigs"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/queue.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/queue.go deleted file mode 100644 index 9fa84b5d2c1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/queue.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type QueueId struct { - SubscriptionId string - ResourceGroup string - NamespaceName string - Name string -} - -func NewQueueID(subscriptionId, resourceGroup, namespaceName, name string) QueueId { - return QueueId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NamespaceName: namespaceName, - Name: name, - } -} - -func (id QueueId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Namespace Name %q", id.NamespaceName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Queue", segmentsStr) -} - -func (id QueueId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/queues/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.Name) -} - -// QueueID parses a Queue ID into an QueueId struct -func QueueID(input string) (*QueueId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := QueueId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NamespaceName, err = id.PopSegment("namespaces"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("queues"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/queue_authorization_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/queue_authorization_rule.go deleted file mode 100644 index ca370ef9a9b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/queue_authorization_rule.go +++ /dev/null @@ -1,81 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type QueueAuthorizationRuleId struct { - SubscriptionId string - ResourceGroup string - NamespaceName string - QueueName string - AuthorizationRuleName string -} - -func NewQueueAuthorizationRuleID(subscriptionId, resourceGroup, namespaceName, queueName, authorizationRuleName string) QueueAuthorizationRuleId { - return QueueAuthorizationRuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NamespaceName: namespaceName, - QueueName: queueName, - AuthorizationRuleName: authorizationRuleName, - } -} - -func (id QueueAuthorizationRuleId) String() string { - segments := []string{ - fmt.Sprintf("Authorization Rule Name %q", id.AuthorizationRuleName), - fmt.Sprintf("Queue Name %q", id.QueueName), - fmt.Sprintf("Namespace Name %q", id.NamespaceName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Queue Authorization Rule", segmentsStr) -} - -func (id QueueAuthorizationRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/queues/%s/authorizationRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.QueueName, id.AuthorizationRuleName) -} - -// QueueAuthorizationRuleID parses a QueueAuthorizationRule ID into an QueueAuthorizationRuleId struct -func QueueAuthorizationRuleID(input string) (*QueueAuthorizationRuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := QueueAuthorizationRuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NamespaceName, err = id.PopSegment("namespaces"); err != nil { - return nil, err - } - if resourceId.QueueName, err = id.PopSegment("queues"); err != nil { - return nil, err - } - if resourceId.AuthorizationRuleName, err = id.PopSegment("authorizationRules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/subscription.go deleted file mode 100644 index 702bfa8eb2f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/subscription.go +++ /dev/null @@ -1,81 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type SubscriptionId struct { - SubscriptionId string - ResourceGroup string - NamespaceName string - TopicName string - Name string -} - -func NewSubscriptionID(subscriptionId, resourceGroup, namespaceName, topicName, name string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NamespaceName: namespaceName, - TopicName: topicName, - Name: name, - } -} - -func (id SubscriptionId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Topic Name %q", id.TopicName), - fmt.Sprintf("Namespace Name %q", id.NamespaceName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Subscription", segmentsStr) -} - -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/topics/%s/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.TopicName, id.Name) -} - -// SubscriptionID parses a Subscription ID into an SubscriptionId struct -func SubscriptionID(input string) (*SubscriptionId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := SubscriptionId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NamespaceName, err = id.PopSegment("namespaces"); err != nil { - return nil, err - } - if resourceId.TopicName, err = id.PopSegment("topics"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("subscriptions"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/subscription_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/subscription_rule.go deleted file mode 100644 index b7efb103f4d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/subscription_rule.go +++ /dev/null @@ -1,87 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type SubscriptionRuleId struct { - SubscriptionId string - ResourceGroup string - NamespaceName string - TopicName string - SubscriptionName string - RuleName string -} - -func NewSubscriptionRuleID(subscriptionId, resourceGroup, namespaceName, topicName, subscriptionName, ruleName string) SubscriptionRuleId { - return SubscriptionRuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NamespaceName: namespaceName, - TopicName: topicName, - SubscriptionName: subscriptionName, - RuleName: ruleName, - } -} - -func (id SubscriptionRuleId) String() string { - segments := []string{ - fmt.Sprintf("Rule Name %q", id.RuleName), - fmt.Sprintf("Subscription Name %q", id.SubscriptionName), - fmt.Sprintf("Topic Name %q", id.TopicName), - fmt.Sprintf("Namespace Name %q", id.NamespaceName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Subscription Rule", segmentsStr) -} - -func (id SubscriptionRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/topics/%s/subscriptions/%s/rules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.TopicName, id.SubscriptionName, id.RuleName) -} - -// SubscriptionRuleID parses a SubscriptionRule ID into an SubscriptionRuleId struct -func SubscriptionRuleID(input string) (*SubscriptionRuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := SubscriptionRuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NamespaceName, err = id.PopSegment("namespaces"); err != nil { - return nil, err - } - if resourceId.TopicName, err = id.PopSegment("topics"); err != nil { - return nil, err - } - if resourceId.SubscriptionName, err = id.PopSegment("subscriptions"); err != nil { - return nil, err - } - if resourceId.RuleName, err = id.PopSegment("rules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/topic.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/topic.go deleted file mode 100644 index e3a5c82c6e5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/topic.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type TopicId struct { - SubscriptionId string - ResourceGroup string - NamespaceName string - Name string -} - -func NewTopicID(subscriptionId, resourceGroup, namespaceName, name string) TopicId { - return TopicId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NamespaceName: namespaceName, - Name: name, - } -} - -func (id TopicId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Namespace Name %q", id.NamespaceName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Topic", segmentsStr) -} - -func (id TopicId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/topics/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.Name) -} - -// TopicID parses a Topic ID into an TopicId struct -func TopicID(input string) (*TopicId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := TopicId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NamespaceName, err = id.PopSegment("namespaces"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("topics"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/topic_authorization_rule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/topic_authorization_rule.go deleted file mode 100644 index acfae9a687f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse/topic_authorization_rule.go +++ /dev/null @@ -1,81 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type TopicAuthorizationRuleId struct { - SubscriptionId string - ResourceGroup string - NamespaceName string - TopicName string - AuthorizationRuleName string -} - -func NewTopicAuthorizationRuleID(subscriptionId, resourceGroup, namespaceName, topicName, authorizationRuleName string) TopicAuthorizationRuleId { - return TopicAuthorizationRuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NamespaceName: namespaceName, - TopicName: topicName, - AuthorizationRuleName: authorizationRuleName, - } -} - -func (id TopicAuthorizationRuleId) String() string { - segments := []string{ - fmt.Sprintf("Authorization Rule Name %q", id.AuthorizationRuleName), - fmt.Sprintf("Topic Name %q", id.TopicName), - fmt.Sprintf("Namespace Name %q", id.NamespaceName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Topic Authorization Rule", segmentsStr) -} - -func (id TopicAuthorizationRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceBus/namespaces/%s/topics/%s/authorizationRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.TopicName, id.AuthorizationRuleName) -} - -// TopicAuthorizationRuleID parses a TopicAuthorizationRule ID into an TopicAuthorizationRuleId struct -func TopicAuthorizationRuleID(input string) (*TopicAuthorizationRuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := TopicAuthorizationRuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NamespaceName, err = id.PopSegment("namespaces"); err != nil { - return nil, err - } - if resourceId.TopicName, err = id.PopSegment("topics"); err != nil { - return nil, err - } - if resourceId.AuthorizationRuleName, err = id.PopSegment("authorizationRules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/resourceids.go deleted file mode 100644 index 42deadafb28..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/resourceids.go +++ /dev/null @@ -1,11 +0,0 @@ -package servicebus - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Queue -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceBus/namespaces/namespace1/queues/queue1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=QueueAuthorizationRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceBus/namespaces/namespace1/queues/queue1/authorizationRules/authorizationRule1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NamespaceDisasterRecoveryConfig -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceBus/namespaces/namespace1/disasterRecoveryConfigs/aliasName1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Namespace -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceBus/namespaces/namespace1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NamespaceAuthorizationRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceBus/namespaces/namespace1/AuthorizationRules/authorizationRule1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Subscription -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceBus/namespaces/namespace1/topics/topic1/subscriptions/subscription1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SubscriptionRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceBus/namespaces/namespace1/topics/topic1/subscriptions/subscription1/rules/rule1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Topic -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceBus/namespaces/namespace1/topics/topic1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=TopicAuthorizationRule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ServiceBus/namespaces/namespace1/topics/topic1/authorizationRules/authorizationRule1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_authorization_rule_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_authorization_rule_data_source.go index 019ef7714fa..fafe0128753 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_authorization_rule_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_authorization_rule_data_source.go @@ -4,14 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups" - + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceServiceBusNamespaceAuthorizationRule() *pluginsdk.Resource { @@ -31,7 +31,7 @@ func dataSourceServiceBusNamespaceAuthorizationRule() *pluginsdk.Resource { "namespace_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: validate.NamespaceID, + ValidateFunc: namespaces.ValidateNamespaceID, AtLeastOneOf: []string{"namespace_id", "resource_group_name", "namespace_name"}, }, @@ -89,7 +89,7 @@ func dataSourceServiceBusNamespaceAuthorizationRule() *pluginsdk.Resource { } func dataSourceServiceBusNamespaceAuthorizationRuleRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ServiceBus.NamespacesClient + client := meta.(*clients.Client).ServiceBus.NamespacesAuthClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -97,40 +97,42 @@ func dataSourceServiceBusNamespaceAuthorizationRuleRead(d *pluginsdk.ResourceDat var resourceGroup string var namespaceName string if v, ok := d.Get("namespace_id").(string); ok && v != "" { - namespaceId, err := parse.NamespaceID(v) + namespaceId, err := namespacesauthorizationrule.ParseNamespaceID(v) if err != nil { - return fmt.Errorf("parsing topic ID %q: %+v", v, err) + return err } - resourceGroup = namespaceId.ResourceGroup - namespaceName = namespaceId.Name + resourceGroup = namespaceId.ResourceGroupName + namespaceName = namespaceId.NamespaceName } else { resourceGroup = d.Get("resource_group_name").(string) namespaceName = d.Get("namespace_name").(string) } - name := d.Get("name").(string) - id := parse.NewNamespaceAuthorizationRuleID(subscriptionId, resourceGroup, namespaceName, name) + id := namespacesauthorizationrule.NewAuthorizationRuleID(subscriptionId, resourceGroup, namespaceName, d.Get("name").(string)) - resp, err := client.GetAuthorizationRule(ctx, id.ResourceGroup, id.NamespaceName, id.AuthorizationRuleName) + resp, err := client.NamespacesGetAuthorizationRule(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } - keysResp, err := client.ListKeys(ctx, id.ResourceGroup, id.NamespaceName, id.AuthorizationRuleName) + keysResp, err := client.NamespacesListKeys(ctx, id) if err != nil { return fmt.Errorf("listing keys for %s: %+v", id, err) } + if model := keysResp.Model; model != nil { + d.Set("primary_key", model.PrimaryKey) + d.Set("primary_connection_string", model.PrimaryConnectionString) + d.Set("secondary_key", model.SecondaryKey) + d.Set("secondary_connection_string", model.SecondaryConnectionString) + d.Set("primary_connection_string_alias", model.AliasPrimaryConnectionString) + d.Set("secondary_connection_string_alias", model.AliasSecondaryConnectionString) + } + d.SetId(id.ID()) - d.Set("primary_key", keysResp.PrimaryKey) - d.Set("primary_connection_string", keysResp.PrimaryConnectionString) - d.Set("secondary_key", keysResp.SecondaryKey) - d.Set("secondary_connection_string", keysResp.SecondaryConnectionString) - d.Set("primary_connection_string_alias", keysResp.AliasPrimaryConnectionString) - d.Set("secondary_connection_string_alias", keysResp.AliasSecondaryConnectionString) return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_authorization_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_authorization_rule_resource.go index 974716bd970..2fac3c86f25 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_authorization_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_authorization_rule_resource.go @@ -2,13 +2,14 @@ package servicebus import ( "fmt" - "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -23,7 +24,7 @@ func resourceServiceBusNamespaceAuthorizationRule() *pluginsdk.Resource { Delete: resourceServiceBusNamespaceAuthorizationRuleDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.NamespaceAuthorizationRuleID(id) + _, err := namespacesauthorizationrule.ParseAuthorizationRuleID(id) return err }), @@ -34,6 +35,11 @@ func resourceServiceBusNamespaceAuthorizationRule() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, + SchemaVersion: 1, + StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{ + 0: migration.ServicebusNamespaceAuthRuleV0ToV1{}, + }), + // function takes a schema map and adds the authorization rule properties to it Schema: resourceServiceBusNamespaceAuthorizationRuleSchema(), @@ -54,117 +60,122 @@ func resourceServiceBusNamespaceAuthorizationRuleSchema() map[string]*pluginsdk. Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.NamespaceID, + ValidateFunc: namespaces.ValidateNamespaceID, }, }) } func resourceServiceBusNamespaceAuthorizationRuleCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ServiceBus.NamespacesClient + client := meta.(*clients.Client).ServiceBus.NamespacesAuthClient ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[INFO] preparing arguments for ServiceBus Namespace Authorization Rule create/update.") - - var resourceId parse.NamespaceAuthorizationRuleId - if namespaceIdLit := d.Get("namespace_id").(string); namespaceIdLit != "" { - namespaceId, _ := parse.NamespaceID(namespaceIdLit) - resourceId = parse.NewNamespaceAuthorizationRuleID(namespaceId.SubscriptionId, namespaceId.ResourceGroup, namespaceId.Name, d.Get("name").(string)) + namespaceAuthId, err := namespacesauthorizationrule.ParseNamespaceID(d.Get("namespace_id").(string)) + if err != nil { + return err } + id := namespacesauthorizationrule.NewAuthorizationRuleID(namespaceAuthId.SubscriptionId, namespaceAuthId.ResourceGroupName, namespaceAuthId.NamespaceName, d.Get("name").(string)) + if d.IsNewResource() { - existing, err := client.GetAuthorizationRule(ctx, resourceId.ResourceGroup, resourceId.NamespaceName, resourceId.AuthorizationRuleName) + existing, err := client.NamespacesGetAuthorizationRule(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing %s: %+v", resourceId, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_servicebus_namespace_authorization_rule", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_servicebus_namespace_authorization_rule", id.ID()) } } - parameters := servicebus.SBAuthorizationRule{ - Name: utils.String(resourceId.AuthorizationRuleName), - SBAuthorizationRuleProperties: &servicebus.SBAuthorizationRuleProperties{ - Rights: expandAuthorizationRuleRights(d), + parameters := namespacesauthorizationrule.SBAuthorizationRule{ + Name: utils.String(id.AuthorizationRuleName), + Properties: &namespacesauthorizationrule.SBAuthorizationRuleProperties{ + Rights: *expandAuthorizationRuleRights(d), }, } - if _, err := client.CreateOrUpdateAuthorizationRule(ctx, resourceId.ResourceGroup, resourceId.NamespaceName, resourceId.AuthorizationRuleName, parameters); err != nil { - return fmt.Errorf("creating/updating %s: %+v", resourceId, err) + if _, err := client.NamespacesCreateOrUpdateAuthorizationRule(ctx, id, parameters); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) - if err := waitForPairedNamespaceReplication(ctx, meta, resourceId.ResourceGroup, resourceId.NamespaceName, d.Timeout(pluginsdk.TimeoutUpdate)); err != nil { - return fmt.Errorf("waiting for replication to complete for Service Bus Namespace Disaster Recovery Configs (Namespace %q / Resource Group %q): %s", resourceId.NamespaceName, resourceId.ResourceGroup, err) + namespaceId := namespaces.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) + if err := waitForPairedNamespaceReplication(ctx, meta, namespaceId, d.Timeout(pluginsdk.TimeoutUpdate)); err != nil { + return fmt.Errorf("waiting for replication to complete for %s: %+v", id, err) } return resourceServiceBusNamespaceAuthorizationRuleRead(d, meta) } func resourceServiceBusNamespaceAuthorizationRuleRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ServiceBus.NamespacesClient + client := meta.(*clients.Client).ServiceBus.NamespacesAuthClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NamespaceAuthorizationRuleID(d.Id()) + id, err := namespacesauthorizationrule.ParseAuthorizationRuleID(d.Id()) if err != nil { return err } - resp, err := client.GetAuthorizationRule(ctx, id.ResourceGroup, id.NamespaceName, id.AuthorizationRuleName) + resp, err := client.NamespacesGetAuthorizationRule(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - keysResp, err := client.ListKeys(ctx, id.ResourceGroup, id.NamespaceName, id.AuthorizationRuleName) + d.Set("name", id.AuthorizationRuleName) + d.Set("namespace_id", namespaces.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName).ID()) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + listen, send, manage := flattenAuthorizationRuleRights(&props.Rights) + d.Set("manage", manage) + d.Set("listen", listen) + d.Set("send", send) + } + } + + keysResp, err := client.NamespacesListKeys(ctx, *id) if err != nil { return fmt.Errorf("listing keys for %s: %+v", id, err) } - d.Set("name", id.AuthorizationRuleName) - d.Set("namespace_id", parse.NewNamespaceID(id.SubscriptionId, id.ResourceGroup, id.NamespaceName).ID()) - - if properties := resp.SBAuthorizationRuleProperties; properties != nil { - listen, send, manage := flattenAuthorizationRuleRights(properties.Rights) - d.Set("manage", manage) - d.Set("listen", listen) - d.Set("send", send) + if keysModel := keysResp.Model; keysModel != nil { + d.Set("primary_key", keysModel.PrimaryKey) + d.Set("primary_connection_string", keysModel.PrimaryConnectionString) + d.Set("secondary_key", keysModel.SecondaryKey) + d.Set("secondary_connection_string", keysModel.SecondaryConnectionString) + d.Set("primary_connection_string_alias", keysModel.AliasPrimaryConnectionString) + d.Set("secondary_connection_string_alias", keysModel.AliasSecondaryConnectionString) } - d.Set("primary_key", keysResp.PrimaryKey) - d.Set("primary_connection_string", keysResp.PrimaryConnectionString) - d.Set("secondary_key", keysResp.SecondaryKey) - d.Set("secondary_connection_string", keysResp.SecondaryConnectionString) - d.Set("primary_connection_string_alias", keysResp.AliasPrimaryConnectionString) - d.Set("secondary_connection_string_alias", keysResp.AliasSecondaryConnectionString) - return nil } func resourceServiceBusNamespaceAuthorizationRuleDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ServiceBus.NamespacesClient + client := meta.(*clients.Client).ServiceBus.NamespacesAuthClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NamespaceAuthorizationRuleID(d.Id()) + id, err := namespacesauthorizationrule.ParseAuthorizationRuleID(d.Id()) if err != nil { return err } - if _, err = client.DeleteAuthorizationRule(ctx, id.ResourceGroup, id.NamespaceName, id.AuthorizationRuleName); err != nil { + if _, err = client.NamespacesDeleteAuthorizationRule(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } - if err := waitForPairedNamespaceReplication(ctx, meta, id.ResourceGroup, id.NamespaceName, d.Timeout(pluginsdk.TimeoutUpdate)); err != nil { - return fmt.Errorf("waiting for replication to complete for Service Bus Namespace Disaster Recovery Configs (Namespace %q / Resource Group %q): %s", id.NamespaceName, id.ResourceGroup, err) + namespaceId := namespaces.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) + if err := waitForPairedNamespaceReplication(ctx, meta, namespaceId, d.Timeout(pluginsdk.TimeoutUpdate)); err != nil { + return fmt.Errorf("waiting for replication to complete for %s: %+v", *id, err) } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_data_source.go index 78d7af14472..115a53377a9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_data_source.go @@ -5,14 +5,15 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceServiceBusNamespace() *pluginsdk.Resource { @@ -82,15 +83,15 @@ func dataSourceServiceBusNamespace() *pluginsdk.Resource { func dataSourceServiceBusNamespaceRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).ServiceBus.NamespacesClient - clientStable := meta.(*clients.Client).ServiceBus.NamespacesClient + namespaceAuthClient := meta.(*clients.Client).ServiceBus.NamespacesAuthClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewNamespaceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := namespaces.NewNamespaceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } @@ -98,25 +99,31 @@ func dataSourceServiceBusNamespaceRead(d *pluginsdk.ResourceData, meta interface } d.SetId(id.ID()) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) - if sku := resp.Sku; sku != nil { - d.Set("sku", string(sku.Name)) - d.Set("capacity", sku.Capacity) - } + if sku := model.Sku; sku != nil { + d.Set("sku", string(sku.Name)) + d.Set("capacity", sku.Capacity) + } - if properties := resp.SBNamespaceProperties; properties != nil { - d.Set("zone_redundant", properties.ZoneRedundant) + if props := model.Properties; props != nil { + d.Set("zone_redundant", props.ZoneRedundant) + } } - keys, err := clientStable.ListKeys(ctx, id.ResourceGroup, id.Name, serviceBusNamespaceDefaultAuthorizationRule) + authRuleId := namespacesauthorizationrule.NewAuthorizationRuleID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, serviceBusNamespaceDefaultAuthorizationRule) + + keys, err := namespaceAuthClient.NamespacesListKeys(ctx, authRuleId) if err != nil { log.Printf("[WARN] listing default keys for %s: %+v", id, err) } else { - d.Set("default_primary_connection_string", keys.PrimaryConnectionString) - d.Set("default_secondary_connection_string", keys.SecondaryConnectionString) - d.Set("default_primary_key", keys.PrimaryKey) - d.Set("default_secondary_key", keys.SecondaryKey) + if keysModel := keys.Model; keysModel != nil { + d.Set("default_primary_connection_string", keysModel.PrimaryConnectionString) + d.Set("default_secondary_connection_string", keysModel.SecondaryConnectionString) + d.Set("default_primary_key", keysModel.PrimaryKey) + d.Set("default_secondary_key", keysModel.SecondaryKey) + } } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_data_source.go index 74220e7a374..0f1c0d071c3 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_data_source.go @@ -5,14 +5,14 @@ import ( "log" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" - + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceServiceBusNamespaceDisasterRecoveryConfig() *pluginsdk.Resource { @@ -32,7 +32,7 @@ func dataSourceServiceBusNamespaceDisasterRecoveryConfig() *pluginsdk.Resource { "namespace_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: validate.NamespaceID, + ValidateFunc: namespaces.ValidateNamespaceID, AtLeastOneOf: []string{"namespace_id", "resource_group_name", "namespace_name"}, }, @@ -91,42 +91,50 @@ func dataSourceServiceBusNamespaceDisasterRecoveryConfigRead(d *pluginsdk.Resour var resourceGroup string var namespaceName string if v, ok := d.Get("namespace_id").(string); ok && v != "" { - namespaceId, err := parse.NamespaceID(v) + namespaceId, err := disasterrecoveryconfigs.ParseNamespaceID(v) if err != nil { return fmt.Errorf("parsing topic ID %q: %+v", v, err) } - resourceGroup = namespaceId.ResourceGroup - namespaceName = namespaceId.Name + resourceGroup = namespaceId.ResourceGroupName + namespaceName = namespaceId.NamespaceName } else { resourceGroup = d.Get("resource_group_name").(string) namespaceName = d.Get("namespace_name").(string) } - name := d.Get("name").(string) - id := parse.NewNamespaceDisasterRecoveryConfigID(subscriptionId, resourceGroup, namespaceName, name) - resp, err := client.Get(ctx, id.ResourceGroup, id.NamespaceName, id.DisasterRecoveryConfigName) + id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID(subscriptionId, resourceGroup, namespaceName, d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.DisasterRecoveryConfigName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.Alias) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("namespace_name", id.NamespaceName) - d.Set("partner_namespace_id", resp.ArmDisasterRecoveryProperties.PartnerNamespace) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("partner_namespace_id", props.PartnerNamespace) + } + } + d.SetId(id.ID()) - keys, err := client.ListKeys(ctx, id.ResourceGroup, id.NamespaceName, id.DisasterRecoveryConfigName, serviceBusNamespaceDefaultAuthorizationRule) + authRuleId := disasterrecoveryconfigs.NewAuthorizationRuleID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, d.Get("name").(string)) + keys, err := client.ListKeys(ctx, authRuleId) if err != nil { log.Printf("[WARN] listing default keys for %s: %+v", id, err) } else { - d.Set("primary_connection_string_alias", keys.AliasPrimaryConnectionString) - d.Set("secondary_connection_string_alias", keys.AliasSecondaryConnectionString) - d.Set("default_primary_key", keys.PrimaryKey) - d.Set("default_secondary_key", keys.SecondaryKey) + if keysModel := keys.Model; keysModel != nil { + d.Set("primary_connection_string_alias", keysModel.AliasPrimaryConnectionString) + d.Set("secondary_connection_string_alias", keysModel.AliasSecondaryConnectionString) + d.Set("default_primary_key", keysModel.PrimaryKey) + d.Set("default_secondary_key", keysModel.SecondaryKey) + } } return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_resource.go index 2982366c816..2593ce4314f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_disaster_recovery_config_resource.go @@ -8,12 +8,12 @@ import ( "strconv" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -29,7 +29,7 @@ func resourceServiceBusNamespaceDisasterRecoveryConfig() *pluginsdk.Resource { Delete: resourceServiceBusNamespaceDisasterRecoveryConfigDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.NamespaceDisasterRecoveryConfigID(id) + _, err := disasterrecoveryconfigs.ParseDisasterRecoveryConfigID(id) return err }), @@ -91,34 +91,34 @@ func resourceServiceBusNamespaceDisasterRecoveryConfigCreate(d *pluginsdk.Resour ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - namespaceId, err := parse.NamespaceID(d.Get("primary_namespace_id").(string)) + namespaceId, err := disasterrecoveryconfigs.ParseNamespaceID(d.Get("primary_namespace_id").(string)) if err != nil { return err } partnerNamespaceId := d.Get("partner_namespace_id").(string) - id := parse.NewNamespaceDisasterRecoveryConfigID(namespaceId.SubscriptionId, namespaceId.ResourceGroup, namespaceId.Name, d.Get("name").(string)) + id := disasterrecoveryconfigs.NewDisasterRecoveryConfigID(namespaceId.SubscriptionId, namespaceId.ResourceGroupName, namespaceId.NamespaceName, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.NamespaceName, id.DisasterRecoveryConfigName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_servicebus_namespace_disaster_recovery_config", id.ID()) } } - parameters := servicebus.ArmDisasterRecovery{ - ArmDisasterRecoveryProperties: &servicebus.ArmDisasterRecoveryProperties{ + parameters := disasterrecoveryconfigs.ArmDisasterRecovery{ + Properties: &disasterrecoveryconfigs.ArmDisasterRecoveryProperties{ PartnerNamespace: utils.String(partnerNamespaceId), }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.NamespaceName, id.DisasterRecoveryConfigName, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -135,7 +135,7 @@ func resourceServiceBusNamespaceDisasterRecoveryConfigUpdate(d *pluginsdk.Resour ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NamespaceDisasterRecoveryConfigID(d.State().ID) + id, err := disasterrecoveryconfigs.ParseDisasterRecoveryConfigID(d.State().ID) if err != nil { return err } @@ -144,7 +144,7 @@ func resourceServiceBusNamespaceDisasterRecoveryConfigUpdate(d *pluginsdk.Resour defer locks.UnlockByName(id.NamespaceName, serviceBusNamespaceResourceName) if d.HasChange("partner_namespace_id") { - if _, err := client.BreakPairing(ctx, id.ResourceGroup, id.NamespaceName, id.DisasterRecoveryConfigName); err != nil { + if _, err := client.BreakPairing(ctx, *id); err != nil { return fmt.Errorf("breaking the pairing for %s: %+v", *id, err) } if err := resourceServiceBusNamespaceDisasterRecoveryConfigWaitForState(ctx, client, *id); err != nil { @@ -152,13 +152,13 @@ func resourceServiceBusNamespaceDisasterRecoveryConfigUpdate(d *pluginsdk.Resour } } - parameters := servicebus.ArmDisasterRecovery{ - ArmDisasterRecoveryProperties: &servicebus.ArmDisasterRecoveryProperties{ + parameters := disasterrecoveryconfigs.ArmDisasterRecovery{ + Properties: &disasterrecoveryconfigs.ArmDisasterRecoveryProperties{ PartnerNamespace: utils.String(d.Get("partner_namespace_id").(string)), }, } - if _, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.NamespaceName, id.DisasterRecoveryConfigName, parameters); err != nil { + if _, err := client.CreateOrUpdate(ctx, *id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", *id, err) } if err := resourceServiceBusNamespaceDisasterRecoveryConfigWaitForState(ctx, client, *id); err != nil { @@ -173,38 +173,44 @@ func resourceServiceBusNamespaceDisasterRecoveryConfigRead(d *pluginsdk.Resource ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NamespaceDisasterRecoveryConfigID(d.Id()) + id, err := disasterrecoveryconfigs.ParseDisasterRecoveryConfigID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NamespaceName, id.DisasterRecoveryConfigName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - primaryId := parse.NewNamespaceID(id.SubscriptionId, id.ResourceGroup, id.NamespaceName) + primaryId := disasterrecoveryconfigs.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) - d.Set("name", id.DisasterRecoveryConfigName) + d.Set("name", id.Alias) d.Set("primary_namespace_id", primaryId.ID()) - if props := resp.ArmDisasterRecoveryProperties; props != nil { - d.Set("partner_namespace_id", props.PartnerNamespace) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("partner_namespace_id", props.PartnerNamespace) + } } - keys, err := client.ListKeys(ctx, id.ResourceGroup, id.NamespaceName, id.DisasterRecoveryConfigName, serviceBusNamespaceDefaultAuthorizationRule) + authRuleId := disasterrecoveryconfigs.NewAuthorizationRuleID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.Alias) + + keys, err := client.ListKeys(ctx, authRuleId) if err != nil { log.Printf("[WARN] listing default keys for %s: %+v", id, err) } else { - d.Set("primary_connection_string_alias", keys.AliasPrimaryConnectionString) - d.Set("secondary_connection_string_alias", keys.AliasSecondaryConnectionString) - d.Set("default_primary_key", keys.PrimaryKey) - d.Set("default_secondary_key", keys.SecondaryKey) + if keysModel := keys.Model; keysModel != nil { + d.Set("primary_connection_string_alias", keysModel.AliasPrimaryConnectionString) + d.Set("secondary_connection_string_alias", keysModel.AliasSecondaryConnectionString) + d.Set("default_primary_key", keysModel.PrimaryKey) + d.Set("default_secondary_key", keysModel.SecondaryKey) + } } return nil @@ -215,17 +221,17 @@ func resourceServiceBusNamespaceDisasterRecoveryConfigDelete(d *pluginsdk.Resour ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NamespaceDisasterRecoveryConfigID(d.Id()) + id, err := disasterrecoveryconfigs.ParseDisasterRecoveryConfigID(d.Id()) if err != nil { return err } - breakPair, err := client.BreakPairing(ctx, id.ResourceGroup, id.NamespaceName, id.DisasterRecoveryConfigName) + breakPair, err := client.BreakPairing(ctx, *id) if err != nil { return fmt.Errorf("breaking pairing %s: %+v", id, err) } - if breakPair.StatusCode != http.StatusOK { + if breakPair.HttpResponse.StatusCode != http.StatusOK { return fmt.Errorf("breaking pairing for %s: %+v", *id, err) } @@ -233,7 +239,7 @@ func resourceServiceBusNamespaceDisasterRecoveryConfigDelete(d *pluginsdk.Resour return fmt.Errorf("waiting for the pairing to break for %s: %+v", *id, err) } - if _, err := client.Delete(ctx, id.ResourceGroup, id.NamespaceName, id.DisasterRecoveryConfigName); err != nil { + if _, err := client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } @@ -244,15 +250,15 @@ func resourceServiceBusNamespaceDisasterRecoveryConfigDelete(d *pluginsdk.Resour MinTimeout: 30 * time.Second, Timeout: d.Timeout(pluginsdk.TimeoutDelete), Refresh: func() (interface{}, string, error) { - resp, err := client.Get(ctx, id.ResourceGroup, id.NamespaceName, id.DisasterRecoveryConfigName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return resp, strconv.Itoa(resp.StatusCode), nil + if response.WasNotFound(resp.HttpResponse) { + return resp, strconv.Itoa(resp.HttpResponse.StatusCode), nil } return nil, "nil", fmt.Errorf("retrieving %s: %+v", *id, err) } - return resp, strconv.Itoa(resp.StatusCode), nil + return resp, strconv.Itoa(resp.HttpResponse.StatusCode), nil }, } @@ -260,6 +266,7 @@ func resourceServiceBusNamespaceDisasterRecoveryConfigDelete(d *pluginsdk.Resour return fmt.Errorf("waiting the deletion of %s: %v", *id, err) } + namespaceId := disasterrecoveryconfigs.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) // it can take some time for the name to become available again // this is mainly here to enable updating the resource in place nameFreeWait := &pluginsdk.StateChangeConf{ @@ -268,12 +275,18 @@ func resourceServiceBusNamespaceDisasterRecoveryConfigDelete(d *pluginsdk.Resour MinTimeout: 30 * time.Second, Timeout: d.Timeout(pluginsdk.TimeoutDelete), Refresh: func() (interface{}, string, error) { - resp, err := client.CheckNameAvailabilityMethod(ctx, id.ResourceGroup, id.NamespaceName, servicebus.CheckNameAvailability{Name: utils.String(id.DisasterRecoveryConfigName)}) + resp, err := client.CheckNameAvailability(ctx, namespaceId, disasterrecoveryconfigs.CheckNameAvailability{Name: id.Alias}) if err != nil { return resp, "Error", fmt.Errorf("checking for the status of %s: %+v", *id, err) } - return resp, string(resp.Reason), nil + reason := "" + if model := resp.Model; model != nil { + if v := model.Reason; v != nil { + reason = string(*v) + } + } + return resp, reason, nil }, } @@ -284,30 +297,32 @@ func resourceServiceBusNamespaceDisasterRecoveryConfigDelete(d *pluginsdk.Resour return nil } -func resourceServiceBusNamespaceDisasterRecoveryConfigWaitForState(ctx context.Context, client *servicebus.DisasterRecoveryConfigsClient, id parse.NamespaceDisasterRecoveryConfigId) error { +func resourceServiceBusNamespaceDisasterRecoveryConfigWaitForState(ctx context.Context, client *disasterrecoveryconfigs.DisasterRecoveryConfigsClient, id disasterrecoveryconfigs.DisasterRecoveryConfigId) error { deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") } stateConf := &pluginsdk.StateChangeConf{ - Pending: []string{string(servicebus.ProvisioningStateDRAccepted)}, - Target: []string{string(servicebus.ProvisioningStateDRSucceeded)}, + Pending: []string{string(disasterrecoveryconfigs.ProvisioningStateDRAccepted)}, + Target: []string{string(disasterrecoveryconfigs.ProvisioningStateDRSucceeded)}, MinTimeout: 30 * time.Second, Timeout: time.Until(deadline), Refresh: func() (interface{}, string, error) { - read, err := client.Get(ctx, id.ResourceGroup, id.NamespaceName, id.DisasterRecoveryConfigName) + resp, err := client.Get(ctx, id) if err != nil { return nil, "error", fmt.Errorf("retrieving %s: %+v", id, err) } - if props := read.ArmDisasterRecoveryProperties; props != nil { - if props.ProvisioningState == servicebus.ProvisioningStateDRFailed { - return read, "failed", fmt.Errorf("replication Failed for %s: %+v", id, err) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + if *props.ProvisioningState == disasterrecoveryconfigs.ProvisioningStateDRFailed { + return resp, "failed", fmt.Errorf("replication Failed for %s: %+v", id, err) + } + return resp, string(*props.ProvisioningState), nil } - return read, string(props.ProvisioningState), nil } - return read, "nil", fmt.Errorf("waiting on replication of %s: %+v", id, err) + return resp, "nil", fmt.Errorf("waiting on replication of %s: %+v", id, err) }, } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_network_rule_set_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_network_rule_set_resource.go index 110d3151053..53143bee98d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_network_rule_set_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_network_rule_set_resource.go @@ -6,13 +6,12 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" validateNetwork "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/set" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -29,7 +28,7 @@ func resourceServiceBusNamespaceNetworkRuleSet() *pluginsdk.Resource { Delete: resourceServiceBusNamespaceNetworkRuleSetDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.NamespaceID(id) + _, err := namespaces.ParseNamespaceID(id) return err }), @@ -56,16 +55,16 @@ func resourceServicebusNamespaceNetworkRuleSetSchema() map[string]*pluginsdk.Sch Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.NamespaceID, + ValidateFunc: namespaces.ValidateNamespaceID, }, "default_action": { Type: pluginsdk.TypeString, Optional: true, - Default: string(servicebus.DefaultActionAllow), + Default: string(namespaces.DefaultActionAllow), ValidateFunc: validation.StringInSlice([]string{ - string(servicebus.DefaultActionAllow), - string(servicebus.DefaultActionDeny), + string(namespaces.DefaultActionAllow), + string(namespaces.DefaultActionDeny), }, false), }, @@ -118,27 +117,29 @@ func resourceServiceBusNamespaceNetworkRuleSetCreateUpdate(d *pluginsdk.Resource ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NamespaceID(d.Get("namespace_id").(string)) + id, err := namespaces.ParseNamespaceID(d.Get("namespace_id").(string)) if err != nil { return err } if d.IsNewResource() { - existing, err := client.GetNetworkRuleSet(ctx, id.ResourceGroup, id.Name) + existing, err := client.GetNetworkRuleSet(ctx, *id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for the presence of existing %s: %+v", id, err) } } // This resource is unique to the corresponding service bus namespace. // It will be created automatically along with the namespace, therefore we check whether this resource is identical to a "deleted" one - if !CheckNetworkRuleNullified(existing) { - return tf.ImportAsExistsError("azurerm_servicebus_namespace_network_rule_set", id.ID()) + if model := existing.Model; model != nil { + if !CheckNetworkRuleNullified(*model) { + return tf.ImportAsExistsError("azurerm_servicebus_namespace_network_rule_set", id.ID()) + } } } - defaultAction := servicebus.DefaultAction(d.Get("default_action").(string)) + defaultAction := namespaces.DefaultAction(d.Get("default_action").(string)) vnetRule := expandServiceBusNamespaceVirtualNetworkRules(d.Get("network_rules").(*pluginsdk.Set).List()) ipRule := expandServiceBusNamespaceIPRules(d.Get("ip_rules").(*pluginsdk.Set).List()) publicNetworkAcc := "Disabled" @@ -147,21 +148,23 @@ func resourceServiceBusNamespaceNetworkRuleSetCreateUpdate(d *pluginsdk.Resource } // API doesn't accept "Deny" to be set for "default_action" if no "ip_rules" or "network_rules" is defined and returns no error message to the user - if defaultAction == servicebus.DefaultActionDeny && vnetRule == nil && ipRule == nil { + if defaultAction == namespaces.DefaultActionDeny && vnetRule == nil && ipRule == nil { return fmt.Errorf(" The default action of %s can only be set to `Allow` if no `ip_rules` or `network_rules` is set", id) } - parameters := servicebus.NetworkRuleSet{ - NetworkRuleSetProperties: &servicebus.NetworkRuleSetProperties{ - DefaultAction: defaultAction, + publicNetworkAccess := namespaces.PublicNetworkAccessFlag(publicNetworkAcc) + + parameters := namespaces.NetworkRuleSet{ + Properties: &namespaces.NetworkRuleSetProperties{ + DefaultAction: &defaultAction, VirtualNetworkRules: vnetRule, IPRules: ipRule, - PublicNetworkAccess: servicebus.PublicNetworkAccessFlag(publicNetworkAcc), + PublicNetworkAccess: &publicNetworkAccess, TrustedServiceAccessEnabled: utils.Bool(d.Get("trusted_services_allowed").(bool)), }, } - if _, err := client.CreateOrUpdateNetworkRuleSet(ctx, id.ResourceGroup, id.Name, parameters); err != nil { + if _, err := client.CreateOrUpdateNetworkRuleSet(ctx, *id, parameters); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -174,15 +177,15 @@ func resourceServiceBusNamespaceNetworkRuleSetRead(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NamespaceID(d.Id()) + id, err := namespaces.ParseNamespaceID(d.Id()) if err != nil { return err } - resp, err := client.GetNetworkRuleSet(ctx, id.ResourceGroup, id.Name) + resp, err := client.GetNetworkRuleSet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] Service Bus Namespace Network Rule Set %q does not exist - removing from state", d.Id()) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("%s was not found - removing from state", d.Id()) d.SetId("") return nil } @@ -190,17 +193,28 @@ func resourceServiceBusNamespaceNetworkRuleSetRead(d *pluginsdk.ResourceData, me } d.Set("namespace_id", id.ID()) - if props := resp.NetworkRuleSetProperties; props != nil { - d.Set("default_action", string(props.DefaultAction)) - d.Set("trusted_services_allowed", props.TrustedServiceAccessEnabled) - d.Set("public_network_access_enabled", strings.EqualFold(string(props.PublicNetworkAccess), "Enabled")) - if err := d.Set("network_rules", pluginsdk.NewSet(networkRuleHash, flattenServiceBusNamespaceVirtualNetworkRules(props.VirtualNetworkRules))); err != nil { - return fmt.Errorf("failed to set `network_rules`: %+v", err) - } + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + defaultAction := "" + if v := props.DefaultAction; v != nil { + defaultAction = string(*v) + } + d.Set("default_action", defaultAction) + d.Set("trusted_services_allowed", props.TrustedServiceAccessEnabled) + publicNetworkAccess := "Enabled" + if v := props.PublicNetworkAccess; v != nil { + publicNetworkAccess = string(*v) + } + d.Set("public_network_access_enabled", strings.EqualFold(publicNetworkAccess, "Enabled")) - if err := d.Set("ip_rules", flattenServiceBusNamespaceIPRules(props.IPRules)); err != nil { - return fmt.Errorf("failed to set `ip_rules`: %+v", err) + if err := d.Set("network_rules", pluginsdk.NewSet(networkRuleHash, flattenServiceBusNamespaceVirtualNetworkRules(props.VirtualNetworkRules))); err != nil { + return fmt.Errorf("failed to set `network_rules`: %+v", err) + } + + if err := d.Set("ip_rules", flattenServiceBusNamespaceIPRules(props.IPRules)); err != nil { + return fmt.Errorf("failed to set `ip_rules`: %+v", err) + } } } @@ -212,7 +226,7 @@ func resourceServiceBusNamespaceNetworkRuleSetDelete(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NamespaceID(d.Id()) + id, err := namespaces.ParseNamespaceID(d.Id()) if err != nil { return err } @@ -220,30 +234,31 @@ func resourceServiceBusNamespaceNetworkRuleSetDelete(d *pluginsdk.ResourceData, // A network rule is unique to a namespace, this rule cannot be deleted. // Therefore we here are just disabling it by setting the default_action to allow and remove all its rules and masks - parameters := servicebus.NetworkRuleSet{ - NetworkRuleSetProperties: &servicebus.NetworkRuleSetProperties{ - DefaultAction: servicebus.DefaultActionAllow, + defaultAction := namespaces.DefaultActionAllow + parameters := namespaces.NetworkRuleSet{ + Properties: &namespaces.NetworkRuleSetProperties{ + DefaultAction: &defaultAction, }, } - if _, err := client.CreateOrUpdateNetworkRuleSet(ctx, id.ResourceGroup, id.Name, parameters); err != nil { + if _, err := client.CreateOrUpdateNetworkRuleSet(ctx, *id, parameters); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } return nil } -func expandServiceBusNamespaceVirtualNetworkRules(input []interface{}) *[]servicebus.NWRuleSetVirtualNetworkRules { +func expandServiceBusNamespaceVirtualNetworkRules(input []interface{}) *[]namespaces.NWRuleSetVirtualNetworkRules { if len(input) == 0 { return nil } - result := make([]servicebus.NWRuleSetVirtualNetworkRules, 0) + result := make([]namespaces.NWRuleSetVirtualNetworkRules, 0) for _, v := range input { raw := v.(map[string]interface{}) - result = append(result, servicebus.NWRuleSetVirtualNetworkRules{ - Subnet: &servicebus.Subnet{ - ID: utils.String(raw["subnet_id"].(string)), + result = append(result, namespaces.NWRuleSetVirtualNetworkRules{ + Subnet: &namespaces.Subnet{ + Id: raw["subnet_id"].(string), }, IgnoreMissingVnetServiceEndpoint: utils.Bool(raw["ignore_missing_vnet_service_endpoint"].(bool)), }) @@ -252,7 +267,7 @@ func expandServiceBusNamespaceVirtualNetworkRules(input []interface{}) *[]servic return &result } -func flattenServiceBusNamespaceVirtualNetworkRules(input *[]servicebus.NWRuleSetVirtualNetworkRules) []interface{} { +func flattenServiceBusNamespaceVirtualNetworkRules(input *[]namespaces.NWRuleSetVirtualNetworkRules) []interface{} { result := make([]interface{}, 0) if input == nil { return result @@ -260,8 +275,8 @@ func flattenServiceBusNamespaceVirtualNetworkRules(input *[]servicebus.NWRuleSet for _, v := range *input { subnetId := "" - if v.Subnet != nil && v.Subnet.ID != nil { - subnetId = *v.Subnet.ID + if v.Subnet != nil && v.Subnet.Id != "" { + subnetId = v.Subnet.Id } ignore := false @@ -278,23 +293,24 @@ func flattenServiceBusNamespaceVirtualNetworkRules(input *[]servicebus.NWRuleSet return result } -func expandServiceBusNamespaceIPRules(input []interface{}) *[]servicebus.NWRuleSetIPRules { +func expandServiceBusNamespaceIPRules(input []interface{}) *[]namespaces.NWRuleSetIPRules { if len(input) == 0 { return nil } - result := make([]servicebus.NWRuleSetIPRules, 0) + action := namespaces.NetworkRuleIPActionAllow + result := make([]namespaces.NWRuleSetIPRules, 0) for _, v := range input { - result = append(result, servicebus.NWRuleSetIPRules{ + result = append(result, namespaces.NWRuleSetIPRules{ IPMask: utils.String(v.(string)), - Action: servicebus.NetworkRuleIPActionAllow, + Action: &action, }) } return &result } -func flattenServiceBusNamespaceIPRules(input *[]servicebus.NWRuleSetIPRules) []interface{} { +func flattenServiceBusNamespaceIPRules(input *[]namespaces.NWRuleSetIPRules) []interface{} { result := make([]interface{}, 0) if input == nil || len(*input) == 0 { return result @@ -317,21 +333,24 @@ func networkRuleHash(input interface{}) int { return set.HashStringIgnoreCase(v["subnet_id"]) } -func CheckNetworkRuleNullified(resp servicebus.NetworkRuleSet) bool { - if resp.ID == nil || *resp.ID == "" { - return true - } - if resp.NetworkRuleSetProperties == nil { +func CheckNetworkRuleNullified(resp namespaces.NetworkRuleSet) bool { + if resp.Id == nil || *resp.Id == "" { return true } - if resp.DefaultAction != servicebus.DefaultActionAllow { - return false - } - if resp.VirtualNetworkRules != nil && len(*resp.VirtualNetworkRules) > 0 { - return false - } - if resp.IPRules != nil && len(*resp.IPRules) > 0 { - return false + + if props := resp.Properties; props != nil { + if *props.DefaultAction != namespaces.DefaultActionAllow { + return false + } + + if props.VirtualNetworkRules != nil && len(*props.VirtualNetworkRules) > 0 { + return false + } + + if props.IPRules != nil && len(*props.IPRules) > 0 { + return false + } } + return true } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_resource.go index 98b7698e933..88accc246d9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_namespace_resource.go @@ -7,19 +7,20 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - msiValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -43,7 +44,7 @@ func resourceServiceBusNamespace() *pluginsdk.Resource { Delete: resourceServiceBusNamespaceDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.NamespaceID(id) + _, err := namespaces.ParseNamespaceID(id) return err }), @@ -77,9 +78,9 @@ func resourceServiceBusNamespace() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(servicebus.SkuNameBasic), - string(servicebus.SkuNameStandard), - string(servicebus.SkuNamePremium), + string(namespaces.SkuNameBasic), + string(namespaces.SkuNameStandard), + string(namespaces.SkuNamePremium), }, false), }, @@ -105,7 +106,7 @@ func resourceServiceBusNamespace() *pluginsdk.Resource { "identity_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: msiValidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, "infrastructure_encryption_enabled": { @@ -164,7 +165,7 @@ func resourceServiceBusNamespace() *pluginsdk.Resource { oldSku, newSku := diff.GetChange("sku") if diff.HasChange("sku") { - if strings.EqualFold(newSku.(string), string(servicebus.SkuNamePremium)) || strings.EqualFold(oldSku.(string), string(servicebus.SkuNamePremium)) { + if strings.EqualFold(newSku.(string), string(namespaces.SkuNamePremium)) || strings.EqualFold(oldSku.(string), string(namespaces.SkuNamePremium)) { log.Printf("[DEBUG] cannot migrate a namespace from or to Premium SKU") diff.ForceNew("sku") } @@ -186,130 +187,134 @@ func resourceServiceBusNamespaceCreateUpdate(d *pluginsdk.ResourceData, meta int sku := d.Get("sku").(string) t := d.Get("tags").(map[string]interface{}) - resourceId := parse.NewNamespaceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := namespaces.NewNamespaceID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, resourceId.ResourceGroup, resourceId.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing %s: %+v", resourceId, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_servicebus_namespace", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_servicebus_namespace", id.ID()) } } - identity, err := expandServiceBusNamespaceIdentity(d.Get("identity").([]interface{})) + identity, err := expandSystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } - parameters := servicebus.SBNamespace{ - Location: &location, + s := namespaces.SkuTier(sku) + parameters := namespaces.SBNamespace{ + Location: location, Identity: identity, - Sku: &servicebus.SBSku{ - Name: servicebus.SkuName(sku), - Tier: servicebus.SkuTier(sku), + Sku: &namespaces.SBSku{ + Name: namespaces.SkuName(sku), + Tier: &s, }, - SBNamespaceProperties: &servicebus.SBNamespaceProperties{ + Properties: &namespaces.SBNamespaceProperties{ ZoneRedundant: utils.Bool(d.Get("zone_redundant").(bool)), Encryption: expandServiceBusNamespaceEncryption(d.Get("customer_managed_key").([]interface{})), DisableLocalAuth: utils.Bool(!d.Get("local_auth_enabled").(bool)), }, - Tags: tags.Expand(t), + Tags: expandTags(t), } if capacity := d.Get("capacity"); capacity != nil { - if !strings.EqualFold(sku, string(servicebus.SkuNamePremium)) && capacity.(int) > 0 { + if !strings.EqualFold(sku, string(namespaces.SkuNamePremium)) && capacity.(int) > 0 { return fmt.Errorf("Service Bus SKU %q only supports `capacity` of 0", sku) } - if strings.EqualFold(sku, string(servicebus.SkuNamePremium)) && capacity.(int) == 0 { + if strings.EqualFold(sku, string(namespaces.SkuNamePremium)) && capacity.(int) == 0 { return fmt.Errorf("Service Bus SKU %q only supports `capacity` of 1, 2, 4, 8 or 16", sku) } - parameters.Sku.Capacity = utils.Int32(int32(capacity.(int))) + parameters.Sku.Capacity = utils.Int64(int64(capacity.(int))) } - future, err := client.CreateOrUpdate(ctx, resourceId.ResourceGroup, resourceId.Name, parameters) - if err != nil { - return fmt.Errorf("creating/updating %s: %+v", resourceId, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for create/update of %s: %+v", resourceId, err) + if err := client.CreateOrUpdateThenPoll(ctx, id, parameters); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) return resourceServiceBusNamespaceRead(d, meta) } func resourceServiceBusNamespaceRead(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).ServiceBus.NamespacesClient - clientStable := meta.(*clients.Client).ServiceBus.NamespacesClient + namespaceAuthClient := meta.(*clients.Client).ServiceBus.NamespacesAuthClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NamespaceID(d.Id()) + id, err := namespaces.ParseNamespaceID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.NamespaceName) + d.Set("resource_group_name", id.ResourceGroupName) - identity, err := flattenServiceBusNamespaceIdentity(resp.Identity) - if err != nil { - return fmt.Errorf("flattening `identity`: %+v", err) - } - if err := d.Set("identity", identity); err != nil { - return fmt.Errorf("setting `identity`: %+v", err) - } + if model := resp.Model; model != nil { + d.Set("location", location.Normalize(model.Location)) - if sku := resp.Sku; sku != nil { - skuName := "" - // the Azure API is inconsistent here, so rewrite this into the casing we expect - for _, v := range servicebus.PossibleSkuNameValues() { - if strings.EqualFold(string(v), string(sku.Name)) { - skuName = string(v) - } + d.Set("tags", flattenTags(model.Tags)) + + identity, err := identity.FlattenSystemAndUserAssignedMap(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + if err := d.Set("identity", identity); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) } - d.Set("sku", skuName) - d.Set("capacity", sku.Capacity) - } - if properties := resp.SBNamespaceProperties; properties != nil { - d.Set("zone_redundant", properties.ZoneRedundant) - if customerManagedKey, err := flattenServiceBusNamespaceEncryption(properties.Encryption); err == nil { - d.Set("customer_managed_key", customerManagedKey) + if sku := model.Sku; sku != nil { + skuName := "" + // the Azure API is inconsistent here, so rewrite this into the casing we expect + for _, v := range namespaces.PossibleValuesForSkuName() { + if strings.EqualFold(v, string(sku.Name)) { + skuName = v + } + } + d.Set("sku", skuName) + d.Set("capacity", sku.Capacity) } - localAuthEnabled := true - if properties.DisableLocalAuth != nil { - localAuthEnabled = !*properties.DisableLocalAuth + + if props := model.Properties; model != nil { + d.Set("zone_redundant", props.ZoneRedundant) + if customerManagedKey, err := flattenServiceBusNamespaceEncryption(props.Encryption); err == nil { + d.Set("customer_managed_key", customerManagedKey) + } + localAuthEnabled := true + if props.DisableLocalAuth != nil { + localAuthEnabled = !*props.DisableLocalAuth + } + d.Set("local_auth_enabled", localAuthEnabled) } - d.Set("local_auth_enabled", localAuthEnabled) } - keys, err := clientStable.ListKeys(ctx, id.ResourceGroup, id.Name, serviceBusNamespaceDefaultAuthorizationRule) + authRuleId := namespacesauthorizationrule.NewAuthorizationRuleID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, serviceBusNamespaceDefaultAuthorizationRule) + + keys, err := namespaceAuthClient.NamespacesListKeys(ctx, authRuleId) if err != nil { log.Printf("[WARN] listing default keys for %s: %+v", id, err) } else { - d.Set("default_primary_connection_string", keys.PrimaryConnectionString) - d.Set("default_secondary_connection_string", keys.SecondaryConnectionString) - d.Set("default_primary_key", keys.PrimaryKey) - d.Set("default_secondary_key", keys.SecondaryKey) + if keysModel := keys.Model; keysModel != nil { + d.Set("default_primary_connection_string", keysModel.PrimaryConnectionString) + d.Set("default_secondary_connection_string", keysModel.SecondaryConnectionString) + d.Set("default_primary_key", keysModel.PrimaryKey) + d.Set("default_secondary_key", keysModel.SecondaryKey) + } } - - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceServiceBusNamespaceDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -317,94 +322,42 @@ func resourceServiceBusNamespaceDelete(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.NamespaceID(d.Id()) + id, err := namespaces.ParseNamespaceID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) - if err != nil { + if err := client.DeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - if !response.WasNotFound(future.Response()) { - return fmt.Errorf("waiting for deletion of %s: %+v", id, err) - } - } - return nil } -func expandServiceBusNamespaceIdentity(input []interface{}) (*servicebus.Identity, error) { - expanded, err := identity.ExpandSystemAndUserAssignedMap(input) - if err != nil { - return nil, err - } - - out := servicebus.Identity{ - Type: servicebus.ManagedServiceIdentityType(string(expanded.Type)), - } - - if len(expanded.IdentityIds) > 0 { - out.UserAssignedIdentities = map[string]*servicebus.UserAssignedIdentity{} - for id := range expanded.IdentityIds { - out.UserAssignedIdentities[id] = &servicebus.UserAssignedIdentity{ - // intentionally empty - } - } - } - return &out, nil -} - -func expandServiceBusNamespaceEncryption(input []interface{}) *servicebus.Encryption { +func expandServiceBusNamespaceEncryption(input []interface{}) *namespaces.Encryption { if len(input) == 0 || input[0] == nil { return nil } v := input[0].(map[string]interface{}) keyId, _ := keyVaultParse.ParseOptionallyVersionedNestedItemID(v["key_vault_key_id"].(string)) - return &servicebus.Encryption{ - KeyVaultProperties: &[]servicebus.KeyVaultProperties{ + keySource := namespaces.KeySourceMicrosoftPointKeyVault + return &namespaces.Encryption{ + KeyVaultProperties: &[]namespaces.KeyVaultProperties{ { KeyName: utils.String(keyId.Name), KeyVersion: utils.String(keyId.Version), - KeyVaultURI: utils.String(keyId.KeyVaultBaseUrl), - Identity: &servicebus.UserAssignedIdentityProperties{ + KeyVaultUri: utils.String(keyId.KeyVaultBaseUrl), + Identity: &namespaces.UserAssignedIdentityProperties{ UserAssignedIdentity: utils.String(v["identity_id"].(string)), }, }, }, - KeySource: servicebus.KeySourceMicrosoftKeyVault, + KeySource: &keySource, RequireInfrastructureEncryption: utils.Bool(v["infrastructure_encryption_enabled"].(bool)), } } -func flattenServiceBusNamespaceIdentity(input *servicebus.Identity) (*[]interface{}, error) { - var transform *identity.SystemAndUserAssignedMap - - if input != nil { - transform = &identity.SystemAndUserAssignedMap{ - Type: identity.Type(string(input.Type)), - IdentityIds: make(map[string]identity.UserAssignedIdentityDetails), - } - if input.PrincipalID != nil { - transform.PrincipalId = *input.PrincipalID - } - if input.TenantID != nil { - transform.TenantId = *input.TenantID - } - for k, v := range input.UserAssignedIdentities { - transform.IdentityIds[k] = identity.UserAssignedIdentityDetails{ - ClientId: v.ClientID, - PrincipalId: v.PrincipalID, - } - } - } - - return identity.FlattenSystemAndUserAssignedMap(transform) -} - -func flattenServiceBusNamespaceEncryption(encryption *servicebus.Encryption) ([]interface{}, error) { +func flattenServiceBusNamespaceEncryption(encryption *namespaces.Encryption) ([]interface{}, error) { if encryption == nil { return []interface{}{}, nil } @@ -413,7 +366,7 @@ func flattenServiceBusNamespaceEncryption(encryption *servicebus.Encryption) ([] var identityId string if keyVaultProperties := encryption.KeyVaultProperties; keyVaultProperties != nil && len(*keyVaultProperties) != 0 { props := (*keyVaultProperties)[0] - keyVaultKeyId, err := keyVaultParse.NewNestedItemID(*props.KeyVaultURI, "keys", *props.KeyName, *props.KeyVersion) + keyVaultKeyId, err := keyVaultParse.NewNestedItemID(*props.KeyVaultUri, "keys", *props.KeyName, *props.KeyVersion) if err != nil { return nil, fmt.Errorf("parsing `key_vault_key_id`: %+v", err) } @@ -431,3 +384,44 @@ func flattenServiceBusNamespaceEncryption(encryption *servicebus.Encryption) ([] }, }, nil } + +func expandSystemAndUserAssignedMap(input []interface{}) (*identity.SystemAndUserAssignedMap, error) { + identityType := identity.TypeNone + identityIds := make(map[string]identity.UserAssignedIdentityDetails, 0) + + if len(input) > 0 { + raw := input[0].(map[string]interface{}) + typeRaw := raw["type"].(string) + if typeRaw == string(identity.TypeSystemAssigned) { + identityType = identity.TypeSystemAssigned + } + if typeRaw == string(identity.TypeSystemAssignedUserAssigned) { + identityType = identity.TypeSystemAssignedUserAssigned + } + if typeRaw == string(identity.TypeUserAssigned) { + identityType = identity.TypeUserAssigned + } + + identityIdsRaw := raw["identity_ids"].(*schema.Set).List() + for _, v := range identityIdsRaw { + identityIds[v.(string)] = identity.UserAssignedIdentityDetails{ + // intentionally empty since the expand shouldn't send these values + } + } + } + + if len(identityIds) > 0 && (identityType != identity.TypeSystemAssignedUserAssigned && identityType != identity.TypeUserAssigned) { + return nil, fmt.Errorf("`identity_ids` can only be specified when `type` is set to %q or %q", string(identity.TypeSystemAssignedUserAssigned), string(identity.TypeUserAssigned)) + } + + if len(identityIds) == 0 { + return &identity.SystemAndUserAssignedMap{ + Type: identityType, + }, nil + } + + return &identity.SystemAndUserAssignedMap{ + Type: identityType, + IdentityIds: identityIds, + }, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_authorization_rule_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_authorization_rule_data_source.go index a36230acbec..31cb5bfeca9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_authorization_rule_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_authorization_rule_data_source.go @@ -4,14 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups" - + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceServiceBusQueueAuthorizationRule() *pluginsdk.Resource { @@ -32,7 +32,7 @@ func dataSourceServiceBusQueueAuthorizationRule() *pluginsdk.Resource { "queue_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: validate.QueueID, + ValidateFunc: queues.ValidateQueueID, AtLeastOneOf: []string{"queue_id", "resource_group_name", "namespace_name", "queue_name"}, }, @@ -112,7 +112,7 @@ func dataSourceServiceBusQueueAuthorizationRule() *pluginsdk.Resource { } func dataSourceServiceBusQueueAuthorizationRuleRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ServiceBus.QueuesClient + client := meta.(*clients.Client).ServiceBus.QueuesAuthClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -121,53 +121,57 @@ func dataSourceServiceBusQueueAuthorizationRuleRead(d *pluginsdk.ResourceData, m var nsName string var queueName string if v, ok := d.Get("queue_id").(string); ok && v != "" { - queueId, err := parse.QueueID(v) + queueId, err := queuesauthorizationrule.ParseQueueID(v) if err != nil { return fmt.Errorf("parsing topic ID %q: %+v", v, err) } - rgName = queueId.ResourceGroup + rgName = queueId.ResourceGroupName nsName = queueId.NamespaceName - queueName = queueId.Name + queueName = queueId.QueueName } else { rgName = d.Get("resource_group_name").(string) nsName = d.Get("namespace_name").(string) queueName = d.Get("queue_name").(string) } - id := parse.NewQueueAuthorizationRuleID(subscriptionId, rgName, nsName, queueName, d.Get("name").(string)) - resp, err := client.GetAuthorizationRule(ctx, id.ResourceGroup, id.NamespaceName, id.QueueName, id.AuthorizationRuleName) + id := queuesauthorizationrule.NewQueueAuthorizationRuleID(subscriptionId, rgName, nsName, queueName, d.Get("name").(string)) + resp, err := client.QueuesGetAuthorizationRule(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } - keysResp, err := client.ListKeys(ctx, id.ResourceGroup, id.NamespaceName, id.QueueName, id.AuthorizationRuleName) - if err != nil { - return fmt.Errorf("listing keys for %s: %+v", id, err) - } - d.SetId(id.ID()) d.Set("name", id.AuthorizationRuleName) d.Set("queue_name", id.QueueName) d.Set("namespace_name", id.NamespaceName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("queue_id", parse.NewQueueID(id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.QueueName).ID()) - - if properties := resp.SBAuthorizationRuleProperties; properties != nil { - listen, send, manage := flattenAuthorizationRuleRights(properties.Rights) - d.Set("listen", listen) - d.Set("send", send) - d.Set("manage", manage) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("queue_id", queuesauthorizationrule.NewQueueID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.QueueName).ID()) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + listen, send, manage := flattenQueueAuthorizationRuleRights(&props.Rights) + d.Set("manage", manage) + d.Set("listen", listen) + d.Set("send", send) + } } - d.Set("primary_key", keysResp.PrimaryKey) - d.Set("primary_connection_string", keysResp.PrimaryConnectionString) - d.Set("secondary_key", keysResp.SecondaryKey) - d.Set("secondary_connection_string", keysResp.SecondaryConnectionString) - d.Set("primary_connection_string_alias", keysResp.AliasPrimaryConnectionString) - d.Set("secondary_connection_string_alias", keysResp.AliasSecondaryConnectionString) + keysResp, err := client.QueuesListKeys(ctx, id) + if err != nil { + return fmt.Errorf("listing keys for %s: %+v", id, err) + } + + if keysModel := keysResp.Model; keysModel != nil { + d.Set("primary_key", keysModel.PrimaryKey) + d.Set("primary_connection_string", keysModel.PrimaryConnectionString) + d.Set("secondary_key", keysModel.SecondaryKey) + d.Set("secondary_connection_string", keysModel.SecondaryConnectionString) + d.Set("primary_connection_string_alias", keysModel.AliasPrimaryConnectionString) + d.Set("secondary_connection_string_alias", keysModel.AliasSecondaryConnectionString) + } return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_authorization_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_authorization_rule_resource.go index 9004ea433a4..f8291ea0ca1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_authorization_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_authorization_rule_resource.go @@ -5,10 +5,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -23,7 +25,7 @@ func resourceServiceBusQueueAuthorizationRule() *pluginsdk.Resource { Delete: resourceServiceBusQueueAuthorizationRuleDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.QueueAuthorizationRuleID(id) + _, err := queuesauthorizationrule.ParseQueueAuthorizationRuleID(id) return err }), @@ -54,70 +56,69 @@ func resourceServiceBusqueueAuthorizationRuleSchema() map[string]*pluginsdk.Sche Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.QueueID, + ValidateFunc: queues.ValidateQueueID, }, }) } func resourceServiceBusQueueAuthorizationRuleCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ServiceBus.QueuesClient + client := meta.(*clients.Client).ServiceBus.QueuesAuthClient ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[INFO] preparing arguments for ServiceBus Queue Authorization Rule creation.") - - var resourceId parse.QueueAuthorizationRuleId - if queueIdLit := d.Get("queue_id").(string); queueIdLit != "" { - queueId, _ := parse.QueueID(queueIdLit) - resourceId = parse.NewQueueAuthorizationRuleID(queueId.SubscriptionId, queueId.ResourceGroup, queueId.NamespaceName, queueId.Name, d.Get("name").(string)) + queueId, err := queuesauthorizationrule.ParseQueueID(d.Get("queue_id").(string)) + if err != nil { + return err } + id := queuesauthorizationrule.NewQueueAuthorizationRuleID(queueId.SubscriptionId, queueId.ResourceGroupName, queueId.NamespaceName, queueId.QueueName, d.Get("name").(string)) + if d.IsNewResource() { - existing, err := client.GetAuthorizationRule(ctx, resourceId.ResourceGroup, resourceId.NamespaceName, resourceId.QueueName, resourceId.AuthorizationRuleName) + existing, err := client.QueuesGetAuthorizationRule(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing %s: %+v", resourceId, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_servicebus_queue_authorization_rule", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_servicebus_queue_authorization_rule", id.ID()) } } - parameters := servicebus.SBAuthorizationRule{ - Name: utils.String(resourceId.AuthorizationRuleName), - SBAuthorizationRuleProperties: &servicebus.SBAuthorizationRuleProperties{ - Rights: expandAuthorizationRuleRights(d), + parameters := queuesauthorizationrule.SBAuthorizationRule{ + Name: utils.String(id.AuthorizationRuleName), + Properties: &queuesauthorizationrule.SBAuthorizationRuleProperties{ + Rights: *expandQueueAuthorizationRuleRights(d), }, } - if _, err := client.CreateOrUpdateAuthorizationRule(ctx, resourceId.ResourceGroup, resourceId.NamespaceName, resourceId.QueueName, resourceId.AuthorizationRuleName, parameters); err != nil { - return fmt.Errorf("creating/updating %s: %+v", resourceId, err) + if _, err := client.QueuesCreateOrUpdateAuthorizationRule(ctx, id, parameters); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - d.SetId(resourceId.ID()) - - if err := waitForPairedNamespaceReplication(ctx, meta, resourceId.ResourceGroup, resourceId.NamespaceName, d.Timeout(pluginsdk.TimeoutUpdate)); err != nil { - return fmt.Errorf("waiting for replication to complete for Service Bus Namespace Disaster Recovery Configs (Namespace %q / Resource Group %q): %s", resourceId.NamespaceName, resourceId.ResourceGroup, err) + d.SetId(id.ID()) + namespaceId := namespaces.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) + if err := waitForPairedNamespaceReplication(ctx, meta, namespaceId, d.Timeout(pluginsdk.TimeoutUpdate)); err != nil { + return fmt.Errorf("waiting for replication to complete for %s: %+v", id, err) } return resourceServiceBusQueueAuthorizationRuleRead(d, meta) } func resourceServiceBusQueueAuthorizationRuleRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ServiceBus.QueuesClient + client := meta.(*clients.Client).ServiceBus.QueuesAuthClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.QueueAuthorizationRuleID(d.Id()) + id, err := queuesauthorizationrule.ParseQueueAuthorizationRuleID(d.Id()) if err != nil { return err } - resp, err := client.GetAuthorizationRule(ctx, id.ResourceGroup, id.NamespaceName, id.QueueName, id.AuthorizationRuleName) + resp, err := client.QueuesGetAuthorizationRule(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -125,48 +126,92 @@ func resourceServiceBusQueueAuthorizationRuleRead(d *pluginsdk.ResourceData, met return fmt.Errorf("retrieving %s: %+v", id, err) } - keysResp, err := client.ListKeys(ctx, id.ResourceGroup, id.NamespaceName, id.QueueName, id.AuthorizationRuleName) + d.Set("name", id.AuthorizationRuleName) + d.Set("queue_id", queuesauthorizationrule.NewQueueID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.QueueName).ID()) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + listen, send, manage := flattenQueueAuthorizationRuleRights(&props.Rights) + d.Set("manage", manage) + d.Set("listen", listen) + d.Set("send", send) + } + } + + keysResp, err := client.QueuesListKeys(ctx, *id) if err != nil { return fmt.Errorf("listing keys for %s: %+v", id, err) } - d.Set("name", id.AuthorizationRuleName) - d.Set("queue_id", parse.NewQueueID(id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.QueueName).ID()) - - if properties := resp.SBAuthorizationRuleProperties; properties != nil { - listen, send, manage := flattenAuthorizationRuleRights(properties.Rights) - d.Set("manage", manage) - d.Set("listen", listen) - d.Set("send", send) + if keysModel := keysResp.Model; keysModel != nil { + d.Set("primary_key", keysModel.PrimaryKey) + d.Set("primary_connection_string", keysModel.PrimaryConnectionString) + d.Set("secondary_key", keysModel.SecondaryKey) + d.Set("secondary_connection_string", keysModel.SecondaryConnectionString) + d.Set("primary_connection_string_alias", keysModel.AliasPrimaryConnectionString) + d.Set("secondary_connection_string_alias", keysModel.AliasSecondaryConnectionString) } - d.Set("primary_key", keysResp.PrimaryKey) - d.Set("primary_connection_string", keysResp.PrimaryConnectionString) - d.Set("secondary_key", keysResp.SecondaryKey) - d.Set("secondary_connection_string", keysResp.SecondaryConnectionString) - d.Set("primary_connection_string_alias", keysResp.AliasPrimaryConnectionString) - d.Set("secondary_connection_string_alias", keysResp.AliasSecondaryConnectionString) - return nil } func resourceServiceBusQueueAuthorizationRuleDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ServiceBus.QueuesClient + client := meta.(*clients.Client).ServiceBus.QueuesAuthClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.QueueAuthorizationRuleID(d.Id()) + id, err := queuesauthorizationrule.ParseQueueAuthorizationRuleID(d.Id()) if err != nil { return err } - if _, err = client.DeleteAuthorizationRule(ctx, id.ResourceGroup, id.NamespaceName, id.QueueName, id.AuthorizationRuleName); err != nil { + if _, err = client.QueuesDeleteAuthorizationRule(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } - if err := waitForPairedNamespaceReplication(ctx, meta, id.ResourceGroup, id.NamespaceName, d.Timeout(pluginsdk.TimeoutUpdate)); err != nil { - return fmt.Errorf("waiting for replication to complete for Service Bus Namespace Disaster Recovery Configs (Namespace %q / Resource Group %q): %s", id.NamespaceName, id.ResourceGroup, err) + namespaceId := namespaces.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) + if err := waitForPairedNamespaceReplication(ctx, meta, namespaceId, d.Timeout(pluginsdk.TimeoutUpdate)); err != nil { + return fmt.Errorf("waiting for replication to complete for %s: %+v", *id, err) } return nil } + +func expandQueueAuthorizationRuleRights(d *pluginsdk.ResourceData) *[]queuesauthorizationrule.AccessRights { + rights := make([]queuesauthorizationrule.AccessRights, 0) + + if d.Get("listen").(bool) { + rights = append(rights, queuesauthorizationrule.AccessRightsListen) + } + + if d.Get("send").(bool) { + rights = append(rights, queuesauthorizationrule.AccessRightsSend) + } + + if d.Get("manage").(bool) { + rights = append(rights, queuesauthorizationrule.AccessRightsManage) + } + + return &rights +} + +func flattenQueueAuthorizationRuleRights(rights *[]queuesauthorizationrule.AccessRights) (listen, send, manage bool) { + // zero (initial) value for a bool in go is false + + if rights != nil { + for _, right := range *rights { + switch right { + case queuesauthorizationrule.AccessRightsListen: + listen = true + case queuesauthorizationrule.AccessRightsSend: + send = true + case queuesauthorizationrule.AccessRightsManage: + manage = true + default: + log.Printf("[DEBUG] Unknown Authorization Rule Right '%s'", right) + } + } + } + + return listen, send, manage +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_data_source.go index b90bc5b3a9b..efd8e6bed96 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_data_source.go @@ -4,16 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups" - - "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" azValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceServiceBusQueue() *pluginsdk.Resource { @@ -34,22 +33,26 @@ func dataSourceServiceBusQueue() *pluginsdk.Resource { "namespace_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: validate.NamespaceID, + ValidateFunc: namespaces.ValidateNamespaceID, AtLeastOneOf: []string{"namespace_id", "resource_group_name", "namespace_name"}, }, + // TODO Remove in 4.0 "namespace_name": { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validate.NamespaceName, AtLeastOneOf: []string{"namespace_id", "resource_group_name", "namespace_name"}, + Deprecated: "`namespace_name` will be removed in favour of the property `namespace_id` in version 4.0 of the AzureRM Provider.", }, + // TODO Remove in 4.0 "resource_group_name": { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: resourcegroups.ValidateName, AtLeastOneOf: []string{"namespace_id", "resource_group_name", "namespace_name"}, + Deprecated: "`resource_group_name` will be removed in favour of the property `namespace_id` in version 4.0 of the AzureRM Provider.", }, "auto_delete_on_idle": { @@ -139,68 +142,70 @@ func dataSourceServiceBusQueueRead(d *pluginsdk.ResourceData, meta interface{}) subscriptionId := meta.(*clients.Client).Account.SubscriptionId defer cancel() - name := d.Get("name").(string) - var resourceGroup string var namespaceName string if v, ok := d.Get("namespace_id").(string); ok && v != "" { - namespaceId, err := parse.NamespaceID(v) + namespaceId, err := namespaces.ParseNamespaceID(d.Get("namespace_id").(string)) if err != nil { - return fmt.Errorf("parsing topic ID %q: %+v", v, err) + return err } - resourceGroup = namespaceId.ResourceGroup - namespaceName = namespaceId.Name + resourceGroup = namespaceId.ResourceGroupName + namespaceName = namespaceId.NamespaceName } else { resourceGroup = d.Get("resource_group_name").(string) namespaceName = d.Get("namespace_name").(string) } - id := parse.NewQueueID(subscriptionId, resourceGroup, namespaceName, name) - resp, err := client.Get(ctx, resourceGroup, namespaceName, name) + id := queues.NewQueueID(subscriptionId, resourceGroup, namespaceName, d.Get("name").(string)) + + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf("Service Bus Queue %q was not found in Resource Group %q Namespace %q", name, resourceGroup, namespaceName) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) } - return fmt.Errorf("making Read request on Azure Service Bus Queue %q in Resource Group %q Namespace %q: %v", name, resourceGroup, namespaceName, err) + return fmt.Errorf("retrieving %s: %v", id, err) } d.SetId(id.ID()) - if props := resp.SBQueueProperties; props != nil { - d.Set("auto_delete_on_idle", props.AutoDeleteOnIdle) - d.Set("dead_lettering_on_message_expiration", props.DeadLetteringOnMessageExpiration) - d.Set("default_message_ttl", props.DefaultMessageTimeToLive) - d.Set("duplicate_detection_history_time_window", props.DuplicateDetectionHistoryTimeWindow) - d.Set("enable_batched_operations", props.EnableBatchedOperations) - d.Set("enable_express", props.EnableExpress) - d.Set("enable_partitioning", props.EnablePartitioning) - d.Set("forward_dead_lettered_messages_to", props.ForwardDeadLetteredMessagesTo) - d.Set("forward_to", props.ForwardTo) - d.Set("lock_duration", props.LockDuration) - d.Set("max_delivery_count", props.MaxDeliveryCount) - d.Set("requires_duplicate_detection", props.RequiresDuplicateDetection) - d.Set("requires_session", props.RequiresSession) - d.Set("status", props.Status) - - if apiMaxSizeInMegabytes := props.MaxSizeInMegabytes; apiMaxSizeInMegabytes != nil { - maxSizeInMegabytes := int(*apiMaxSizeInMegabytes) - - // If the queue is NOT in a premium namespace (ie. it is Basic or Standard) and partitioning is enabled - // then the max size returned by the API will be 16 times greater than the value set. - if *props.EnablePartitioning { - namespacesClient := meta.(*clients.Client).ServiceBus.NamespacesClient - namespace, err := namespacesClient.Get(ctx, resourceGroup, namespaceName) - if err != nil { - return err + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("auto_delete_on_idle", props.AutoDeleteOnIdle) + d.Set("dead_lettering_on_message_expiration", props.DeadLetteringOnMessageExpiration) + d.Set("default_message_ttl", props.DefaultMessageTimeToLive) + d.Set("duplicate_detection_history_time_window", props.DuplicateDetectionHistoryTimeWindow) + d.Set("enable_batched_operations", props.EnableBatchedOperations) + d.Set("enable_express", props.EnableExpress) + d.Set("enable_partitioning", props.EnablePartitioning) + d.Set("forward_dead_lettered_messages_to", props.ForwardDeadLetteredMessagesTo) + d.Set("forward_to", props.ForwardTo) + d.Set("lock_duration", props.LockDuration) + d.Set("max_delivery_count", props.MaxDeliveryCount) + d.Set("requires_duplicate_detection", props.RequiresDuplicateDetection) + d.Set("requires_session", props.RequiresSession) + d.Set("status", props.Status) + + if apiMaxSizeInMegabytes := props.MaxSizeInMegabytes; apiMaxSizeInMegabytes != nil { + maxSizeInMegabytes := int(*apiMaxSizeInMegabytes) + + // If the queue is NOT in a premium namespace (ie. it is Basic or Standard) and partitioning is enabled + // then the max size returned by the API will be 16 times greater than the value set. + if *props.EnablePartitioning { + namespacesClient := meta.(*clients.Client).ServiceBus.NamespacesClient + namespaceId := namespaces.NewNamespaceID(subscriptionId, resourceGroup, namespaceName) + namespace, err := namespacesClient.Get(ctx, namespaceId) + if err != nil { + return err + } + + if nsModel := namespace.Model; nsModel != nil && nsModel.Sku.Name != namespaces.SkuNamePremium { + const partitionCount = 16 + maxSizeInMegabytes = int(*apiMaxSizeInMegabytes / partitionCount) + } } - if namespace.Sku.Name != servicebus.SkuNamePremium { - const partitionCount = 16 - maxSizeInMegabytes = int(*apiMaxSizeInMegabytes / partitionCount) - } + d.Set("max_size_in_megabytes", maxSizeInMegabytes) } - - d.Set("max_size_in_megabytes", maxSizeInMegabytes) } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_resource.go index 11b4f5cf883..a64a94ada41 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_queue_resource.go @@ -2,14 +2,14 @@ package servicebus import ( "fmt" - "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" azValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -25,7 +25,7 @@ func resourceServiceBusQueue() *pluginsdk.Resource { Delete: resourceServiceBusQueueDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.QueueID(id) + _, err := queues.ParseQueueID(id) return err }), @@ -54,7 +54,7 @@ func resourceServicebusQueueSchema() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: azValidate.NamespaceID, + ValidateFunc: namespaces.ValidateNamespaceID, }, // Optional @@ -163,16 +163,16 @@ func resourceServicebusQueueSchema() map[string]*pluginsdk.Schema { "status": { Type: pluginsdk.TypeString, Optional: true, - Default: string(servicebus.EntityStatusActive), + Default: string(queues.EntityStatusActive), ValidateFunc: validation.StringInSlice([]string{ - string(servicebus.EntityStatusActive), - string(servicebus.EntityStatusCreating), - string(servicebus.EntityStatusDeleting), - string(servicebus.EntityStatusDisabled), - string(servicebus.EntityStatusReceiveDisabled), - string(servicebus.EntityStatusRenaming), - string(servicebus.EntityStatusSendDisabled), - string(servicebus.EntityStatusUnknown), + string(queues.EntityStatusActive), + string(queues.EntityStatusCreating), + string(queues.EntityStatusDeleting), + string(queues.EntityStatusDisabled), + string(queues.EntityStatusReceiveDisabled), + string(queues.EntityStatusRenaming), + string(queues.EntityStatusSendDisabled), + string(queues.EntityStatusUnknown), }, false), }, } @@ -182,103 +182,120 @@ func resourceServiceBusQueueCreateUpdate(d *pluginsdk.ResourceData, meta interfa client := meta.(*clients.Client).ServiceBus.QueuesClient ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[INFO] preparing arguments for ServiceBus Queue creation/update.") - var resourceId parse.QueueId - if namespaceIdLit := d.Get("namespace_id").(string); namespaceIdLit != "" { - namespaceId, _ := parse.NamespaceID(namespaceIdLit) - resourceId = parse.NewQueueID(namespaceId.SubscriptionId, namespaceId.ResourceGroup, namespaceId.Name, d.Get("name").(string)) + namespaceId, err := namespaces.ParseNamespaceID(d.Get("namespace_id").(string)) + if err != nil { + return err } - deadLetteringOnMessageExpiration := d.Get("dead_lettering_on_message_expiration").(bool) - enableBatchedOperations := d.Get("enable_batched_operations").(bool) - enableExpress := d.Get("enable_express").(bool) - enablePartitioning := d.Get("enable_partitioning").(bool) - maxDeliveryCount := int32(d.Get("max_delivery_count").(int)) - maxSizeInMegabytes := int32(d.Get("max_size_in_megabytes").(int)) - requiresDuplicateDetection := d.Get("requires_duplicate_detection").(bool) - requiresSession := d.Get("requires_session").(bool) - status := servicebus.EntityStatus(d.Get("status").(string)) + id := queues.NewQueueID(namespaceId.SubscriptionId, namespaceId.ResourceGroupName, namespaceId.NamespaceName, d.Get("name").(string)) + + isPartitioningEnabled := false + if d.HasChange("enable_partitioning") { + existingQueue, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existingQueue.HttpResponse) { + return fmt.Errorf("retrieving %s: %+v", id, err) + } + } + + if model := existingQueue.Model; model != nil { + if props := model.Properties; props != nil { + if model.Id != nil && props.EnablePartitioning != nil && *props.EnablePartitioning { + isPartitioningEnabled = true + } + } + } + } if d.IsNewResource() { - existing, err := client.Get(ctx, resourceId.ResourceGroup, resourceId.NamespaceName, resourceId.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of %s: %+v", resourceId, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_servicebus_queue", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_servicebus_queue", id.ID()) } } - parameters := servicebus.SBQueue{ - Name: utils.String(resourceId.Name), - SBQueueProperties: &servicebus.SBQueueProperties{ - DeadLetteringOnMessageExpiration: &deadLetteringOnMessageExpiration, - EnableBatchedOperations: &enableBatchedOperations, - EnableExpress: &enableExpress, - EnablePartitioning: &enablePartitioning, - MaxDeliveryCount: &maxDeliveryCount, - MaxSizeInMegabytes: &maxSizeInMegabytes, - RequiresDuplicateDetection: &requiresDuplicateDetection, - RequiresSession: &requiresSession, - Status: status, + status := queues.EntityStatus(d.Get("status").(string)) + parameters := queues.SBQueue{ + Name: utils.String(id.QueueName), + Properties: &queues.SBQueueProperties{ + DeadLetteringOnMessageExpiration: utils.Bool(d.Get("dead_lettering_on_message_expiration").(bool)), + EnableBatchedOperations: utils.Bool(d.Get("enable_batched_operations").(bool)), + EnableExpress: utils.Bool(d.Get("enable_express").(bool)), + EnablePartitioning: utils.Bool(d.Get("enable_partitioning").(bool)), + MaxDeliveryCount: utils.Int64(int64(d.Get("max_delivery_count").(int))), + MaxSizeInMegabytes: utils.Int64(int64(d.Get("max_size_in_megabytes").(int))), + RequiresDuplicateDetection: utils.Bool(d.Get("requires_duplicate_detection").(bool)), + RequiresSession: utils.Bool(d.Get("requires_session").(bool)), + Status: &status, }, } if autoDeleteOnIdle := d.Get("auto_delete_on_idle").(string); autoDeleteOnIdle != "" { - parameters.SBQueueProperties.AutoDeleteOnIdle = &autoDeleteOnIdle + parameters.Properties.AutoDeleteOnIdle = &autoDeleteOnIdle } if defaultMessageTTL := d.Get("default_message_ttl").(string); defaultMessageTTL != "" { - parameters.SBQueueProperties.DefaultMessageTimeToLive = &defaultMessageTTL + parameters.Properties.DefaultMessageTimeToLive = &defaultMessageTTL } if duplicateDetectionHistoryTimeWindow := d.Get("duplicate_detection_history_time_window").(string); duplicateDetectionHistoryTimeWindow != "" { - parameters.SBQueueProperties.DuplicateDetectionHistoryTimeWindow = &duplicateDetectionHistoryTimeWindow + parameters.Properties.DuplicateDetectionHistoryTimeWindow = &duplicateDetectionHistoryTimeWindow } if forwardDeadLetteredMessagesTo := d.Get("forward_dead_lettered_messages_to").(string); forwardDeadLetteredMessagesTo != "" { - parameters.SBQueueProperties.ForwardDeadLetteredMessagesTo = &forwardDeadLetteredMessagesTo + parameters.Properties.ForwardDeadLetteredMessagesTo = &forwardDeadLetteredMessagesTo } if forwardTo := d.Get("forward_to").(string); forwardTo != "" { - parameters.SBQueueProperties.ForwardTo = &forwardTo + parameters.Properties.ForwardTo = &forwardTo } if lockDuration := d.Get("lock_duration").(string); lockDuration != "" { - parameters.SBQueueProperties.LockDuration = &lockDuration + parameters.Properties.LockDuration = &lockDuration } // We need to retrieve the namespace because Premium namespace works differently from Basic and Standard, // so it needs different rules applied to it. namespacesClient := meta.(*clients.Client).ServiceBus.NamespacesClient - namespace, err := namespacesClient.Get(ctx, resourceId.ResourceGroup, resourceId.NamespaceName) + namespace, err := namespacesClient.Get(ctx, *namespaceId) if err != nil { - return fmt.Errorf("retrieving ServiceBus Namespace %q (Resource Group %q): %+v", resourceId.NamespaceName, resourceId.ResourceGroup, err) + return fmt.Errorf("retrieving %s: %+v", *namespaceId, err) } + var sku namespaces.SkuName + if nsModel := namespace.Model; nsModel != nil { + sku = nsModel.Sku.Name + } // Enforce Premium namespace to have Express Entities disabled in Terraform since they are not supported for // Premium SKU. - if namespace.Sku.Name == servicebus.SkuNamePremium && d.Get("enable_express").(bool) { - return fmt.Errorf("ServiceBus Queue %q does not support Express Entities in Premium SKU and must be disabled", resourceId.Name) + if sku == namespaces.SkuNamePremium && d.Get("enable_express").(bool) { + return fmt.Errorf("%s does not support Express Entities in Premium SKU and must be disabled", id) + } + + if sku == namespaces.SkuNamePremium && d.Get("enable_partitioning").(bool) && !isPartitioningEnabled { + return fmt.Errorf("partitioning Entities is not supported in Premium SKU and must be disabled") } // output of `max_message_size_in_kilobytes` is also set in non-Premium namespaces, with a value of 256 if v, ok := d.GetOk("max_message_size_in_kilobytes"); ok && v.(int) != 256 { - if namespace.Sku.Name != servicebus.SkuNamePremium { - return fmt.Errorf("ServiceBus Queue %q does not support input on `max_message_size_in_kilobytes` in %s SKU and should be removed", resourceId.Name, namespace.Sku.Name) + if sku != namespaces.SkuNamePremium { + return fmt.Errorf("%s does not support input on `max_message_size_in_kilobytes` in %s SKU and should be removed", id, sku) } - parameters.SBQueueProperties.MaxMessageSizeInKilobytes = utils.Int64(int64(v.(int))) + parameters.Properties.MaxMessageSizeInKilobytes = utils.Int64(int64(v.(int))) } - if _, err = client.CreateOrUpdate(ctx, resourceId.ResourceGroup, resourceId.NamespaceName, resourceId.Name, parameters); err != nil { + if _, err = client.CreateOrUpdate(ctx, id, parameters); err != nil { return err } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) return resourceServiceBusQueueRead(d, meta) } @@ -287,62 +304,65 @@ func resourceServiceBusQueueRead(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.QueueID(d.Id()) + id, err := queues.ParseQueueID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NamespaceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Name) - d.Set("namespace_id", parse.NewNamespaceID(id.SubscriptionId, id.ResourceGroup, id.NamespaceName).ID()) - - if props := resp.SBQueueProperties; props != nil { - d.Set("auto_delete_on_idle", props.AutoDeleteOnIdle) - d.Set("dead_lettering_on_message_expiration", props.DeadLetteringOnMessageExpiration) - d.Set("default_message_ttl", props.DefaultMessageTimeToLive) - d.Set("duplicate_detection_history_time_window", props.DuplicateDetectionHistoryTimeWindow) - d.Set("enable_batched_operations", props.EnableBatchedOperations) - d.Set("enable_express", props.EnableExpress) - d.Set("enable_partitioning", props.EnablePartitioning) - d.Set("forward_dead_lettered_messages_to", props.ForwardDeadLetteredMessagesTo) - d.Set("forward_to", props.ForwardTo) - d.Set("lock_duration", props.LockDuration) - d.Set("max_delivery_count", props.MaxDeliveryCount) - d.Set("max_message_size_in_kilobytes", props.MaxMessageSizeInKilobytes) - d.Set("requires_duplicate_detection", props.RequiresDuplicateDetection) - d.Set("requires_session", props.RequiresSession) - d.Set("status", props.Status) - - if apiMaxSizeInMegabytes := props.MaxSizeInMegabytes; apiMaxSizeInMegabytes != nil { - maxSizeInMegabytes := int(*apiMaxSizeInMegabytes) - - // If the queue is NOT in a premium namespace (ie. it is Basic or Standard) and partitioning is enabled - // then the max size returned by the API will be 16 times greater than the value set. - if *props.EnablePartitioning { - namespacesClient := meta.(*clients.Client).ServiceBus.NamespacesClient - namespace, err := namespacesClient.Get(ctx, id.ResourceGroup, id.NamespaceName) - if err != nil { - return err + namespaceId := namespaces.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) + + d.Set("name", id.QueueName) + d.Set("namespace_id", namespaceId.ID()) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("auto_delete_on_idle", props.AutoDeleteOnIdle) + d.Set("dead_lettering_on_message_expiration", props.DeadLetteringOnMessageExpiration) + d.Set("default_message_ttl", props.DefaultMessageTimeToLive) + d.Set("duplicate_detection_history_time_window", props.DuplicateDetectionHistoryTimeWindow) + d.Set("enable_batched_operations", props.EnableBatchedOperations) + d.Set("enable_express", props.EnableExpress) + d.Set("enable_partitioning", props.EnablePartitioning) + d.Set("forward_dead_lettered_messages_to", props.ForwardDeadLetteredMessagesTo) + d.Set("forward_to", props.ForwardTo) + d.Set("lock_duration", props.LockDuration) + d.Set("max_delivery_count", props.MaxDeliveryCount) + d.Set("max_message_size_in_kilobytes", props.MaxMessageSizeInKilobytes) + d.Set("requires_duplicate_detection", props.RequiresDuplicateDetection) + d.Set("requires_session", props.RequiresSession) + d.Set("status", props.Status) + + if apiMaxSizeInMegabytes := props.MaxSizeInMegabytes; apiMaxSizeInMegabytes != nil { + maxSizeInMegabytes := int(*apiMaxSizeInMegabytes) + + // If the queue is NOT in a premium namespace (ie. it is Basic or Standard) and partitioning is enabled + // then the max size returned by the API will be 16 times greater than the value set. + if *props.EnablePartitioning { + namespacesClient := meta.(*clients.Client).ServiceBus.NamespacesClient + namespace, err := namespacesClient.Get(ctx, namespaceId) + if err != nil { + return err + } + + if nsModel := namespace.Model; nsModel != nil && nsModel.Sku.Name != namespaces.SkuNamePremium { + const partitionCount = 16 + maxSizeInMegabytes = int(*apiMaxSizeInMegabytes / partitionCount) + } } - if namespace.Sku.Name != servicebus.SkuNamePremium { - const partitionCount = 16 - maxSizeInMegabytes = int(*apiMaxSizeInMegabytes / partitionCount) - } + d.Set("max_size_in_megabytes", maxSizeInMegabytes) } - - d.Set("max_size_in_megabytes", maxSizeInMegabytes) } } - return nil } @@ -351,14 +371,14 @@ func resourceServiceBusQueueDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.QueueID(d.Id()) + id, err := queues.ParseQueueID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.NamespaceName, id.Name) + resp, err := client.Delete(ctx, *id) if err != nil { - if !utils.ResponseWasNotFound(resp) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", id, err) } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_subscription_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_subscription_data_source.go index 9fc5667917b..a0cd61b0236 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_subscription_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_subscription_data_source.go @@ -4,13 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceServiceBusSubscription() *pluginsdk.Resource { @@ -30,7 +31,7 @@ func dataSourceServiceBusSubscription() *pluginsdk.Resource { "topic_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: validate.TopicID, + ValidateFunc: topics.ValidateTopicID, AtLeastOneOf: []string{"topic_id", "resource_group_name", "namespace_name", "topic_name"}, }, @@ -119,23 +120,23 @@ func dataSourceServiceBusSubscriptionRead(d *pluginsdk.ResourceData, meta interf var nsName string var topicName string if v, ok := d.Get("topic_id").(string); ok && v != "" { - topicId, err := parse.TopicID(v) + topicId, err := subscriptions.ParseTopicID(v) if err != nil { return fmt.Errorf("parsing topic ID %q: %+v", v, err) } - rgName = topicId.ResourceGroup + rgName = topicId.ResourceGroupName nsName = topicId.NamespaceName - topicName = topicId.Name + topicName = topicId.TopicName } else { rgName = d.Get("resource_group_name").(string) nsName = d.Get("namespace_name").(string) topicName = d.Get("topic_name").(string) } - id := parse.NewSubscriptionID(subscriptionId, rgName, nsName, topicName, d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.NamespaceName, id.TopicName, id.Name) + id := subscriptions.NewSubscriptions2ID(subscriptionId, rgName, nsName, topicName, d.Get("name").(string)) + existing, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(existing.Response) { + if response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("%s was not found", id) } @@ -144,23 +145,25 @@ func dataSourceServiceBusSubscriptionRead(d *pluginsdk.ResourceData, meta interf d.SetId(id.ID()) - if props := existing.SBSubscriptionProperties; props != nil { - d.Set("auto_delete_on_idle", props.AutoDeleteOnIdle) - d.Set("default_message_ttl", props.DefaultMessageTimeToLive) - d.Set("lock_duration", props.LockDuration) - d.Set("dead_lettering_on_message_expiration", props.DeadLetteringOnMessageExpiration) - d.Set("dead_lettering_on_filter_evaluation_error", props.DeadLetteringOnFilterEvaluationExceptions) - d.Set("enable_batched_operations", props.EnableBatchedOperations) - d.Set("requires_session", props.RequiresSession) - d.Set("forward_dead_lettered_messages_to", props.ForwardDeadLetteredMessagesTo) - d.Set("forward_to", props.ForwardTo) - - maxDeliveryCount := 0 - if props.MaxDeliveryCount != nil { - maxDeliveryCount = int(*props.MaxDeliveryCount) + if model := existing.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("auto_delete_on_idle", props.AutoDeleteOnIdle) + d.Set("default_message_ttl", props.DefaultMessageTimeToLive) + d.Set("lock_duration", props.LockDuration) + d.Set("dead_lettering_on_message_expiration", props.DeadLetteringOnMessageExpiration) + d.Set("dead_lettering_on_filter_evaluation_error", props.DeadLetteringOnFilterEvaluationExceptions) + d.Set("enable_batched_operations", props.EnableBatchedOperations) + d.Set("requires_session", props.RequiresSession) + d.Set("forward_dead_lettered_messages_to", props.ForwardDeadLetteredMessagesTo) + d.Set("forward_to", props.ForwardTo) + + maxDeliveryCount := 0 + if props.MaxDeliveryCount != nil { + maxDeliveryCount = int(*props.MaxDeliveryCount) + } + + d.Set("max_delivery_count", maxDeliveryCount) } - - d.Set("max_delivery_count", maxDeliveryCount) } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_subscription_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_subscription_resource.go index ed1f7cba05f..70d9a755b86 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_subscription_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_subscription_resource.go @@ -3,13 +3,15 @@ package servicebus import ( "fmt" "log" + "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -30,7 +32,7 @@ func resourceServiceBusSubscription() *pluginsdk.Resource { }), Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.SubscriptionID(id) + _, err := subscriptions.ParseSubscriptions2ID(id) return err }), @@ -59,7 +61,7 @@ func resourceServicebusSubscriptionSchema() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.TopicID, + ValidateFunc: topics.ValidateTopicID, }, "auto_delete_on_idle": { @@ -122,13 +124,46 @@ func resourceServicebusSubscriptionSchema() map[string]*pluginsdk.Schema { "status": { Type: pluginsdk.TypeString, Optional: true, - Default: string(servicebus.EntityStatusActive), + Default: string(subscriptions.EntityStatusActive), ValidateFunc: validation.StringInSlice([]string{ - string(servicebus.EntityStatusActive), - string(servicebus.EntityStatusDisabled), - string(servicebus.EntityStatusReceiveDisabled), + string(subscriptions.EntityStatusActive), + string(subscriptions.EntityStatusDisabled), + string(subscriptions.EntityStatusReceiveDisabled), }, false), }, + + "client_scoped_subscription_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + + "client_scoped_subscription": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "client_id": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + }, + + "is_client_scoped_subscription_shareable": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + ForceNew: true, + }, + + "is_client_scoped_subscription_durable": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + }, + }, + }, } } @@ -138,61 +173,87 @@ func resourceServiceBusSubscriptionCreateUpdate(d *pluginsdk.ResourceData, meta defer cancel() log.Printf("[INFO] preparing arguments for ServiceBus Subscription creation.") - var resourceId parse.SubscriptionId + var id subscriptions.Subscriptions2Id + name := d.Get("name").(string) + + clientId := "" + var isSubShared bool + isClintScopedEnabled := d.Get("client_scoped_subscription_enabled").(bool) + if isClintScopedEnabled { + clientScopedSubsRawData := d.Get("client_scoped_subscription").([]interface{}) + if len(clientScopedSubsRawData) > 0 { + clientScopedSubsProps := clientScopedSubsRawData[0].(map[string]interface{}) + if clientScopedSubsProps["client_id"] != "" { + clientId = clientScopedSubsProps["client_id"].(string) + } + name = name + "$" + clientId + "$D" + + isSubShared = clientScopedSubsProps["is_client_scoped_subscription_shareable"].(bool) + } + } + if topicIdLit := d.Get("topic_id").(string); topicIdLit != "" { - topicId, _ := parse.TopicID(topicIdLit) - resourceId = parse.NewSubscriptionID(topicId.SubscriptionId, topicId.ResourceGroup, topicId.NamespaceName, topicId.Name, d.Get("name").(string)) + topicId, _ := subscriptions.ParseTopicID(topicIdLit) + id = subscriptions.NewSubscriptions2ID(topicId.SubscriptionId, topicId.ResourceGroupName, topicId.NamespaceName, topicId.TopicName, name) } if d.IsNewResource() { - existing, err := client.Get(ctx, resourceId.ResourceGroup, resourceId.NamespaceName, resourceId.TopicName, resourceId.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing %s: %+v", resourceId, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_servicebus_subscription", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_servicebus_subscription", id.ID()) } } - parameters := servicebus.SBSubscription{ - SBSubscriptionProperties: &servicebus.SBSubscriptionProperties{ + status := subscriptions.EntityStatus(d.Get("status").(string)) + parameters := subscriptions.SBSubscription{ + Properties: &subscriptions.SBSubscriptionProperties{ DeadLetteringOnMessageExpiration: utils.Bool(d.Get("dead_lettering_on_message_expiration").(bool)), DeadLetteringOnFilterEvaluationExceptions: utils.Bool(d.Get("dead_lettering_on_filter_evaluation_error").(bool)), EnableBatchedOperations: utils.Bool(d.Get("enable_batched_operations").(bool)), - MaxDeliveryCount: utils.Int32(int32(d.Get("max_delivery_count").(int))), + MaxDeliveryCount: utils.Int64(int64(d.Get("max_delivery_count").(int))), RequiresSession: utils.Bool(d.Get("requires_session").(bool)), - Status: servicebus.EntityStatus(d.Get("status").(string)), + Status: &status, + IsClientAffine: utils.Bool(isClintScopedEnabled), + ClientAffineProperties: &subscriptions.SBClientAffineProperties{}, }, } + if isClintScopedEnabled { + parameters.Properties.ClientAffineProperties.IsShared = &isSubShared + parameters.Properties.ClientAffineProperties.ClientId = &clientId + } + if autoDeleteOnIdle := d.Get("auto_delete_on_idle").(string); autoDeleteOnIdle != "" { - parameters.SBSubscriptionProperties.AutoDeleteOnIdle = &autoDeleteOnIdle + parameters.Properties.AutoDeleteOnIdle = &autoDeleteOnIdle } if lockDuration := d.Get("lock_duration").(string); lockDuration != "" { - parameters.SBSubscriptionProperties.LockDuration = &lockDuration + parameters.Properties.LockDuration = &lockDuration } if forwardTo := d.Get("forward_to").(string); forwardTo != "" { - parameters.SBSubscriptionProperties.ForwardTo = &forwardTo + parameters.Properties.ForwardTo = &forwardTo } if forwardDeadLetteredMessagesTo := d.Get("forward_dead_lettered_messages_to").(string); forwardDeadLetteredMessagesTo != "" { - parameters.SBSubscriptionProperties.ForwardDeadLetteredMessagesTo = &forwardDeadLetteredMessagesTo + parameters.Properties.ForwardDeadLetteredMessagesTo = &forwardDeadLetteredMessagesTo } if defaultMessageTtl := d.Get("default_message_ttl").(string); defaultMessageTtl != "" { - parameters.DefaultMessageTimeToLive = &defaultMessageTtl + parameters.Properties.DefaultMessageTimeToLive = &defaultMessageTtl } - if _, err := client.CreateOrUpdate(ctx, resourceId.ResourceGroup, resourceId.NamespaceName, resourceId.TopicName, resourceId.Name, parameters); err != nil { - return fmt.Errorf("creating/updating %s: %v", resourceId, err) + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { + return fmt.Errorf("creating/updating %s: %v", id, err) } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) return resourceServiceBusSubscriptionRead(d, meta) } @@ -201,40 +262,60 @@ func resourceServiceBusSubscriptionRead(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SubscriptionID(d.Id()) + id, err := subscriptions.ParseSubscriptions2ID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NamespaceName, id.TopicName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Name) - d.Set("topic_id", parse.NewTopicID(id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.TopicName).ID()) - - if props := resp.SBSubscriptionProperties; props != nil { - d.Set("auto_delete_on_idle", props.AutoDeleteOnIdle) - d.Set("default_message_ttl", props.DefaultMessageTimeToLive) - d.Set("lock_duration", props.LockDuration) - d.Set("dead_lettering_on_message_expiration", props.DeadLetteringOnMessageExpiration) - d.Set("dead_lettering_on_filter_evaluation_error", props.DeadLetteringOnFilterEvaluationExceptions) - d.Set("enable_batched_operations", props.EnableBatchedOperations) - d.Set("requires_session", props.RequiresSession) - d.Set("forward_to", props.ForwardTo) - d.Set("forward_dead_lettered_messages_to", props.ForwardDeadLetteredMessagesTo) - d.Set("status", utils.String(string(props.Status))) - - if count := props.MaxDeliveryCount; count != nil { - d.Set("max_delivery_count", int(*count)) + d.Set("topic_id", subscriptions.NewTopicID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.TopicName).ID()) + + clientScopedEnabled := false + userAssignedName := id.SubscriptionName + clientId := "" + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("auto_delete_on_idle", props.AutoDeleteOnIdle) + d.Set("default_message_ttl", props.DefaultMessageTimeToLive) + d.Set("lock_duration", props.LockDuration) + d.Set("dead_lettering_on_message_expiration", props.DeadLetteringOnMessageExpiration) + d.Set("dead_lettering_on_filter_evaluation_error", props.DeadLetteringOnFilterEvaluationExceptions) + d.Set("enable_batched_operations", props.EnableBatchedOperations) + d.Set("requires_session", props.RequiresSession) + d.Set("forward_to", props.ForwardTo) + d.Set("forward_dead_lettered_messages_to", props.ForwardDeadLetteredMessagesTo) + d.Set("status", utils.String(string(*props.Status))) + d.Set("client_scoped_subscription_enabled", props.IsClientAffine) + + if count := props.MaxDeliveryCount; count != nil { + d.Set("max_delivery_count", int(*count)) + } + if props.IsClientAffine != nil && *props.IsClientAffine { + if props.ClientAffineProperties.ClientId != nil { + clientId = *props.ClientAffineProperties.ClientId + } + clientScopedEnabled = true + } + d.Set("client_scoped_subscription", flattenServiceBusNamespaceClientScopedSubscription(props.ClientAffineProperties)) + } } + if clientScopedEnabled { + suffix := "$" + clientId + "$D" + userAssignedName = strings.TrimSuffix(userAssignedName, suffix) + } + d.Set("name", userAssignedName) + return nil } @@ -243,14 +324,43 @@ func resourceServiceBusSubscriptionDelete(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SubscriptionID(d.Id()) + id, err := subscriptions.ParseSubscriptions2ID(d.Id()) if err != nil { return err } - if _, err = client.Delete(ctx, id.ResourceGroup, id.NamespaceName, id.TopicName, id.Name); err != nil { + if _, err = client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } return nil } + +func flattenServiceBusNamespaceClientScopedSubscription(clientScopedSubsProps *subscriptions.SBClientAffineProperties) []interface{} { + if clientScopedSubsProps == nil { + return []interface{}{} + } + + var clientId string + var isShareable, isDurable bool + + if clientScopedSubsProps.ClientId != nil { + clientId = *clientScopedSubsProps.ClientId + } + + if clientScopedSubsProps.IsShared != nil { + isShareable = *clientScopedSubsProps.IsShared + } + + if clientScopedSubsProps.IsDurable != nil { + isDurable = *clientScopedSubsProps.IsDurable + } + + return []interface{}{ + map[string]interface{}{ + "client_id": clientId, + "is_client_scoped_subscription_shareable": isShareable, + "is_client_scoped_subscription_durable": isDurable, + }, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_subscription_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_subscription_rule_resource.go index 24835ba35e0..c0db5dd7b0c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_subscription_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_subscription_rule_resource.go @@ -5,11 +5,11 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress" @@ -26,7 +26,7 @@ func resourceServiceBusSubscriptionRule() *pluginsdk.Resource { Delete: resourceServiceBusSubscriptionRuleDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.SubscriptionRuleID(id) + _, err := rules.ParseRuleID(id) return err }), @@ -55,7 +55,7 @@ func resourceServicebusSubscriptionRuleSchema() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.SubscriptionID, + ValidateFunc: subscriptions.ValidateSubscriptions2ID, DiffSuppressFunc: suppress.CaseDifference, }, @@ -63,8 +63,8 @@ func resourceServicebusSubscriptionRuleSchema() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ - string(servicebus.FilterTypeSQLFilter), - string(servicebus.FilterTypeCorrelationFilter), + string(subscriptions.FilterTypeSqlFilter), + string(subscriptions.FilterTypeCorrelationFilter), }, false), }, @@ -79,6 +79,12 @@ func resourceServicebusSubscriptionRuleSchema() map[string]*pluginsdk.Schema { ValidateFunc: validate.SqlFilter, }, + // Reserved for future use, currently hard-coded to 20 + "sql_filter_compatibility_level": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "correlation_filter": { Type: pluginsdk.TypeList, Optional: true, @@ -178,108 +184,120 @@ func resourceServicebusSubscriptionRuleSchema() map[string]*pluginsdk.Schema { func resourceServiceBusSubscriptionRuleCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).ServiceBus.SubscriptionRulesClient + subscriptionClient := meta.(*clients.Client).ServiceBus.SubscriptionsClient ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() log.Printf("[INFO] preparing arguments for Azure Service Bus Subscription Rule creation.") filterType := d.Get("filter_type").(string) - var resourceId parse.SubscriptionRuleId + var id subscriptions.RuleId if subscriptionIdLit := d.Get("subscription_id").(string); subscriptionIdLit != "" { - subscriptionId, _ := parse.SubscriptionID(subscriptionIdLit) - resourceId = parse.NewSubscriptionRuleID(subscriptionId.SubscriptionId, - subscriptionId.ResourceGroup, + subscriptionId, _ := rules.ParseSubscriptions2ID(subscriptionIdLit) + id = subscriptions.NewRuleID(subscriptionId.SubscriptionId, + subscriptionId.ResourceGroupName, subscriptionId.NamespaceName, subscriptionId.TopicName, - subscriptionId.Name, + subscriptionId.SubscriptionName, d.Get("name").(string), ) } if d.IsNewResource() { - existing, err := client.Get(ctx, resourceId.ResourceGroup, resourceId.NamespaceName, resourceId.TopicName, resourceId.SubscriptionName, resourceId.RuleName) + existing, err := subscriptionClient.RulesGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing %s: %+v", resourceId, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_servicebus_subscription_rule", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_servicebus_subscription_rule", id.ID()) } } - rule := servicebus.Rule{ - Ruleproperties: &servicebus.Ruleproperties{ - FilterType: servicebus.FilterType(filterType), + filter := rules.FilterType(filterType) + rule := rules.Rule{ + Properties: &rules.Ruleproperties{ + FilterType: &filter, }, } if action := d.Get("action").(string); action != "" { - rule.Ruleproperties.Action = &servicebus.Action{ - SQLExpression: &action, + rule.Properties.Action = &rules.Action{ + SqlExpression: &action, } } - if rule.Ruleproperties.FilterType == servicebus.FilterTypeCorrelationFilter { + if *rule.Properties.FilterType == rules.FilterTypeCorrelationFilter { correlationFilter, err := expandAzureRmServiceBusCorrelationFilter(d) if err != nil { return fmt.Errorf("expanding `correlation_filter`: %+v", err) } - rule.Ruleproperties.CorrelationFilter = correlationFilter + rule.Properties.CorrelationFilter = correlationFilter } - if rule.Ruleproperties.FilterType == servicebus.FilterTypeSQLFilter { + if *rule.Properties.FilterType == rules.FilterTypeSqlFilter { sqlFilter := d.Get("sql_filter").(string) - rule.Ruleproperties.SQLFilter = &servicebus.SQLFilter{ - SQLExpression: &sqlFilter, + rule.Properties.SqlFilter = &rules.SqlFilter{ + SqlExpression: &sqlFilter, } } - if _, err := client.CreateOrUpdate(ctx, resourceId.ResourceGroup, resourceId.NamespaceName, resourceId.TopicName, resourceId.SubscriptionName, resourceId.RuleName, rule); err != nil { - return fmt.Errorf("creating/updating %s: %+v", resourceId, err) + // switch this around so that the rule id from subscription is generated for the get method + ruleId, err := rules.ParseRuleID(id.ID()) + if err != nil { + return err + } + if _, err := client.CreateOrUpdate(ctx, *ruleId, rule); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) return resourceServiceBusSubscriptionRuleRead(d, meta) } func resourceServiceBusSubscriptionRuleRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ServiceBus.SubscriptionRulesClient + client := meta.(*clients.Client).ServiceBus.SubscriptionsClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SubscriptionRuleID(d.Id()) + id, err := subscriptions.ParseRuleID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NamespaceName, id.TopicName, id.SubscriptionName, id.RuleName) + resp, err := client.RulesGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("subscription_id", parse.NewSubscriptionID(id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.TopicName, id.SubscriptionName).ID()) + d.Set("subscription_id", subscriptions.NewSubscriptions2ID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.TopicName, id.SubscriptionName).ID()) d.Set("name", id.RuleName) - if properties := resp.Ruleproperties; properties != nil { - d.Set("filter_type", properties.FilterType) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + d.Set("filter_type", props.FilterType) - if properties.Action != nil { - d.Set("action", properties.Action.SQLExpression) - } + if props.Action != nil { + d.Set("action", props.Action.SqlExpression) + } - if properties.SQLFilter != nil { - d.Set("sql_filter", properties.SQLFilter.SQLExpression) - } + if props.SqlFilter != nil { + d.Set("sql_filter", props.SqlFilter.SqlExpression) + if props.SqlFilter.CompatibilityLevel != nil { + d.Set("sql_filter_compatibility_level", props.SqlFilter.CompatibilityLevel) + } + } - if err := d.Set("correlation_filter", flattenAzureRmServiceBusCorrelationFilter(properties.CorrelationFilter)); err != nil { - return fmt.Errorf("setting `correlation_filter`: %+v", err) + if err := d.Set("correlation_filter", flattenAzureRmServiceBusCorrelationFilter(props.CorrelationFilter)); err != nil { + return fmt.Errorf("setting `correlation_filter`: %+v", err) + } } } @@ -291,14 +309,14 @@ func resourceServiceBusSubscriptionRuleDelete(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SubscriptionRuleID(d.Id()) + id, err := rules.ParseRuleID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.NamespaceName, id.TopicName, id.SubscriptionName, id.RuleName) + resp, err := client.Delete(ctx, *id) if err != nil { - if !response.WasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", id, err) } } @@ -306,7 +324,7 @@ func resourceServiceBusSubscriptionRuleDelete(d *pluginsdk.ResourceData, meta in return nil } -func expandAzureRmServiceBusCorrelationFilter(d *pluginsdk.ResourceData) (*servicebus.CorrelationFilter, error) { +func expandAzureRmServiceBusCorrelationFilter(d *pluginsdk.ResourceData) (*rules.CorrelationFilter, error) { configs := d.Get("correlation_filter").([]interface{}) if len(configs) == 0 { return nil, fmt.Errorf("`correlation_filter` is required when `filter_type` is set to `CorrelationFilter`") @@ -322,20 +340,21 @@ func expandAzureRmServiceBusCorrelationFilter(d *pluginsdk.ResourceData) (*servi replyToSessionID := config["reply_to_session_id"].(string) sessionID := config["session_id"].(string) to := config["to"].(string) - properties := utils.ExpandMapStringPtrString(config["properties"].(map[string]interface{})) - if contentType == "" && correlationID == "" && label == "" && messageID == "" && replyTo == "" && replyToSessionID == "" && sessionID == "" && to == "" && len(properties) == 0 { - return nil, fmt.Errorf("At least one property must be set in the `correlation_filter` block") + properties := expandProperties(config["properties"].(map[string]interface{})) + + if contentType == "" && correlationID == "" && label == "" && messageID == "" && replyTo == "" && replyToSessionID == "" && sessionID == "" && to == "" && len(*properties) == 0 { + return nil, fmt.Errorf("at least one property must be set in the `correlation_filter` block") } - correlationFilter := servicebus.CorrelationFilter{} + correlationFilter := rules.CorrelationFilter{} if correlationID != "" { - correlationFilter.CorrelationID = utils.String(correlationID) + correlationFilter.CorrelationId = utils.String(correlationID) } if messageID != "" { - correlationFilter.MessageID = utils.String(messageID) + correlationFilter.MessageId = utils.String(messageID) } if to != "" { @@ -351,37 +370,37 @@ func expandAzureRmServiceBusCorrelationFilter(d *pluginsdk.ResourceData) (*servi } if sessionID != "" { - correlationFilter.SessionID = utils.String(sessionID) + correlationFilter.SessionId = utils.String(sessionID) } if replyToSessionID != "" { - correlationFilter.ReplyToSessionID = utils.String(replyToSessionID) + correlationFilter.ReplyToSessionId = utils.String(replyToSessionID) } if contentType != "" { correlationFilter.ContentType = utils.String(contentType) } - if len(properties) > 0 { + if len(*properties) > 0 { correlationFilter.Properties = properties } return &correlationFilter, nil } -func flattenAzureRmServiceBusCorrelationFilter(input *servicebus.CorrelationFilter) []interface{} { +func flattenAzureRmServiceBusCorrelationFilter(input *subscriptions.CorrelationFilter) []interface{} { if input == nil { return []interface{}{} } filter := make(map[string]interface{}) - if input.CorrelationID != nil { - filter["correlation_id"] = *input.CorrelationID + if input.CorrelationId != nil { + filter["correlation_id"] = *input.CorrelationId } - if input.MessageID != nil { - filter["message_id"] = *input.MessageID + if input.MessageId != nil { + filter["message_id"] = *input.MessageId } if input.To != nil { @@ -396,12 +415,12 @@ func flattenAzureRmServiceBusCorrelationFilter(input *servicebus.CorrelationFilt filter["label"] = *input.Label } - if input.SessionID != nil { - filter["session_id"] = *input.SessionID + if input.SessionId != nil { + filter["session_id"] = *input.SessionId } - if input.ReplyToSessionID != nil { - filter["reply_to_session_id"] = *input.ReplyToSessionID + if input.ReplyToSessionId != nil { + filter["reply_to_session_id"] = *input.ReplyToSessionId } if input.ContentType != nil { @@ -409,8 +428,28 @@ func flattenAzureRmServiceBusCorrelationFilter(input *servicebus.CorrelationFilt } if input.Properties != nil { - filter["properties"] = utils.FlattenMapStringPtrString(input.Properties) + filter["properties"] = flattenProperties(input.Properties) } return []interface{}{filter} } + +func expandProperties(input map[string]interface{}) *map[string]string { + output := make(map[string]string) + for k, v := range input { + output[k] = v.(string) + } + return &output +} + +func flattenProperties(input *map[string]string) map[string]*string { + output := make(map[string]*string) + + if input != nil { + for k, v := range *input { + output[k] = utils.String(v) + } + } + + return output +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_authorization_rule_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_authorization_rule_data_source.go index dd3ab2fb543..584094358a5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_authorization_rule_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_authorization_rule_data_source.go @@ -4,14 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceServiceBusTopicAuthorizationRule() *pluginsdk.Resource { @@ -32,7 +33,7 @@ func dataSourceServiceBusTopicAuthorizationRule() *pluginsdk.Resource { "topic_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: validate.TopicID, + ValidateFunc: topics.ValidateTopicID, AtLeastOneOf: []string{"topic_id", "resource_group_name", "namespace_name", "queue_name"}, }, @@ -119,7 +120,7 @@ func dataSourceServiceBusTopicAuthorizationRule() *pluginsdk.Resource { } func dataSourceServiceBusTopicAuthorizationRuleRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ServiceBus.TopicsClient + client := meta.(*clients.Client).ServiceBus.TopicsAuthClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() @@ -128,29 +129,29 @@ func dataSourceServiceBusTopicAuthorizationRuleRead(d *pluginsdk.ResourceData, m var nsName string var topicName string if v, ok := d.Get("topic_id").(string); ok && v != "" { - topicId, err := parse.TopicID(v) + topicId, err := topicsauthorizationrule.ParseTopicID(v) if err != nil { return fmt.Errorf("parsing topic ID %q: %+v", v, err) } - rgName = topicId.ResourceGroup + rgName = topicId.ResourceGroupName nsName = topicId.NamespaceName - topicName = topicId.Name + topicName = topicId.TopicName } else { rgName = d.Get("resource_group_name").(string) nsName = d.Get("namespace_name").(string) topicName = d.Get("topic_name").(string) } - id := parse.NewTopicAuthorizationRuleID(subscriptionId, rgName, nsName, topicName, d.Get("name").(string)) - resp, err := client.GetAuthorizationRule(ctx, id.ResourceGroup, id.NamespaceName, id.TopicName, id.AuthorizationRuleName) + id := topicsauthorizationrule.NewTopicAuthorizationRuleID(subscriptionId, rgName, nsName, topicName, d.Get("name").(string)) + resp, err := client.TopicsGetAuthorizationRule(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } - keysResp, err := client.ListKeys(ctx, id.ResourceGroup, id.NamespaceName, id.TopicName, id.AuthorizationRuleName) + keysResp, err := client.TopicsListKeys(ctx, id) if err != nil { return fmt.Errorf("listing keys for %s: %+v", id, err) } @@ -159,21 +160,25 @@ func dataSourceServiceBusTopicAuthorizationRuleRead(d *pluginsdk.ResourceData, m d.Set("name", id.AuthorizationRuleName) d.Set("topic_name", id.TopicName) d.Set("namespace_name", id.NamespaceName) - d.Set("resource_group_name", id.ResourceGroup) - - if properties := resp.SBAuthorizationRuleProperties; properties != nil { - listen, send, manage := flattenAuthorizationRuleRights(properties.Rights) - d.Set("listen", listen) - d.Set("send", send) - d.Set("manage", manage) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + listen, send, manage := flattenTopicAuthorizationRuleRights(&props.Rights) + d.Set("listen", listen) + d.Set("send", send) + d.Set("manage", manage) + } } - d.Set("primary_key", keysResp.PrimaryKey) - d.Set("primary_connection_string", keysResp.PrimaryConnectionString) - d.Set("secondary_key", keysResp.SecondaryKey) - d.Set("secondary_connection_string", keysResp.SecondaryConnectionString) - d.Set("primary_connection_string_alias", keysResp.AliasPrimaryConnectionString) - d.Set("secondary_connection_string_alias", keysResp.AliasSecondaryConnectionString) + if model := keysResp.Model; model != nil { + d.Set("primary_key", model.PrimaryKey) + d.Set("primary_connection_string", model.PrimaryConnectionString) + d.Set("secondary_key", model.SecondaryKey) + d.Set("secondary_connection_string", model.SecondaryConnectionString) + d.Set("primary_connection_string_alias", model.AliasPrimaryConnectionString) + d.Set("secondary_connection_string_alias", model.AliasSecondaryConnectionString) + } return nil } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_authorization_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_authorization_rule_resource.go index 0b246eb5a34..bd66957eaa0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_authorization_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_authorization_rule_resource.go @@ -5,10 +5,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -23,7 +25,7 @@ func resourceServiceBusTopicAuthorizationRule() *pluginsdk.Resource { Delete: resourceServiceBusTopicAuthorizationRuleDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.TopicAuthorizationRuleID(id) + _, err := topicsauthorizationrule.ParseTopicAuthorizationRuleID(id) return err }), @@ -54,69 +56,73 @@ func resourceServiceBusTopicAuthorizationRuleSchema() map[string]*pluginsdk.Sche Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.TopicID, + ValidateFunc: topics.ValidateTopicID, }, } } func resourceServiceBusTopicAuthorizationRuleCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ServiceBus.TopicsClient + client := meta.(*clients.Client).ServiceBus.TopicsAuthClient ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() log.Printf("[INFO] preparing arguments for AzureRM ServiceBus Topic Authorization Rule creation.") - var resourceId parse.TopicAuthorizationRuleId + var id topicsauthorizationrule.TopicAuthorizationRuleId if topicIdLit := d.Get("topic_id").(string); topicIdLit != "" { - topicId, _ := parse.TopicID(topicIdLit) - resourceId = parse.NewTopicAuthorizationRuleID(topicId.SubscriptionId, topicId.ResourceGroup, topicId.NamespaceName, topicId.Name, d.Get("name").(string)) + topicId, err := topicsauthorizationrule.ParseTopicID(topicIdLit) + if err != nil { + return err + } + id = topicsauthorizationrule.NewTopicAuthorizationRuleID(topicId.SubscriptionId, topicId.ResourceGroupName, topicId.NamespaceName, topicId.TopicName, d.Get("name").(string)) } if d.IsNewResource() { - existing, err := client.GetAuthorizationRule(ctx, resourceId.ResourceGroup, resourceId.NamespaceName, resourceId.TopicName, resourceId.AuthorizationRuleName) + existing, err := client.TopicsGetAuthorizationRule(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing %s: %+v", resourceId, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_servicebus_topic_authorization_rule", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_servicebus_topic_authorization_rule", id.ID()) } } - parameters := servicebus.SBAuthorizationRule{ - Name: utils.String(resourceId.AuthorizationRuleName), - SBAuthorizationRuleProperties: &servicebus.SBAuthorizationRuleProperties{ - Rights: expandAuthorizationRuleRights(d), + parameters := topicsauthorizationrule.SBAuthorizationRule{ + Name: utils.String(id.AuthorizationRuleName), + Properties: &topicsauthorizationrule.SBAuthorizationRuleProperties{ + Rights: *expandTopicAuthorizationRuleRights(d), }, } - if _, err := client.CreateOrUpdateAuthorizationRule(ctx, resourceId.ResourceGroup, resourceId.NamespaceName, resourceId.TopicName, resourceId.AuthorizationRuleName, parameters); err != nil { - return fmt.Errorf("creating/updating %s: %+v", resourceId, err) + if _, err := client.TopicsCreateOrUpdateAuthorizationRule(ctx, id, parameters); err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) - if err := waitForPairedNamespaceReplication(ctx, meta, resourceId.ResourceGroup, resourceId.NamespaceName, d.Timeout(pluginsdk.TimeoutUpdate)); err != nil { - return fmt.Errorf("waiting for replication to complete for Service Bus Namespace Disaster Recovery Configs (Namespace %q / Resource Group %q): %s", resourceId.NamespaceName, resourceId.ResourceGroup, err) + namespaceId := namespaces.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) + if err := waitForPairedNamespaceReplication(ctx, meta, namespaceId, d.Timeout(pluginsdk.TimeoutUpdate)); err != nil { + return fmt.Errorf("waiting for replication to complete for %s: %+v", id, err) } return resourceServiceBusTopicAuthorizationRuleRead(d, meta) } func resourceServiceBusTopicAuthorizationRuleRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ServiceBus.TopicsClient + client := meta.(*clients.Client).ServiceBus.TopicsAuthClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.TopicAuthorizationRuleID(d.Id()) + id, err := topicsauthorizationrule.ParseTopicAuthorizationRuleID(d.Id()) if err != nil { return err } - resp, err := client.GetAuthorizationRule(ctx, id.ResourceGroup, id.NamespaceName, id.TopicName, id.AuthorizationRuleName) + resp, err := client.TopicsGetAuthorizationRule(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -124,47 +130,90 @@ func resourceServiceBusTopicAuthorizationRuleRead(d *pluginsdk.ResourceData, met } d.Set("name", id.AuthorizationRuleName) - d.Set("topic_id", parse.NewTopicID(id.SubscriptionId, id.ResourceGroup, id.NamespaceName, id.TopicName).ID()) - - if properties := resp.SBAuthorizationRuleProperties; properties != nil { - listen, send, manage := flattenAuthorizationRuleRights(properties.Rights) - d.Set("listen", listen) - d.Set("send", send) - d.Set("manage", manage) + d.Set("topic_id", topicsauthorizationrule.NewTopicID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName, id.TopicName).ID()) + + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + listen, send, manage := flattenTopicAuthorizationRuleRights(&props.Rights) + d.Set("listen", listen) + d.Set("send", send) + d.Set("manage", manage) + } } - keysResp, err := client.ListKeys(ctx, id.ResourceGroup, id.NamespaceName, id.TopicName, id.AuthorizationRuleName) + keysResp, err := client.TopicsListKeys(ctx, *id) if err != nil { return fmt.Errorf("listing keys for %s: %+v", id, err) } - d.Set("primary_key", keysResp.PrimaryKey) - d.Set("primary_connection_string", keysResp.PrimaryConnectionString) - d.Set("secondary_key", keysResp.SecondaryKey) - d.Set("secondary_connection_string", keysResp.SecondaryConnectionString) - d.Set("primary_connection_string_alias", keysResp.AliasPrimaryConnectionString) - d.Set("secondary_connection_string_alias", keysResp.AliasSecondaryConnectionString) + if model := keysResp.Model; model != nil { + d.Set("primary_key", model.PrimaryKey) + d.Set("primary_connection_string", model.PrimaryConnectionString) + d.Set("secondary_key", model.SecondaryKey) + d.Set("secondary_connection_string", model.SecondaryConnectionString) + d.Set("primary_connection_string_alias", model.AliasPrimaryConnectionString) + d.Set("secondary_connection_string_alias", model.AliasSecondaryConnectionString) + } return nil } func resourceServiceBusTopicAuthorizationRuleDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).ServiceBus.TopicsClient + client := meta.(*clients.Client).ServiceBus.TopicsAuthClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.TopicAuthorizationRuleID(d.Id()) + id, err := topicsauthorizationrule.ParseTopicAuthorizationRuleID(d.Id()) if err != nil { return err } - if _, err = client.DeleteAuthorizationRule(ctx, id.ResourceGroup, id.NamespaceName, id.TopicName, id.AuthorizationRuleName); err != nil { + if _, err = client.TopicsDeleteAuthorizationRule(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } - if err := waitForPairedNamespaceReplication(ctx, meta, id.ResourceGroup, id.NamespaceName, d.Timeout(pluginsdk.TimeoutUpdate)); err != nil { - return fmt.Errorf("waiting for replication to complete for Service Bus Namespace Disaster Recovery Configs (Namespace %q / Resource Group %q): %s", id.NamespaceName, id.ResourceGroup, err) + namespaceId := namespaces.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) + + if err := waitForPairedNamespaceReplication(ctx, meta, namespaceId, d.Timeout(pluginsdk.TimeoutUpdate)); err != nil { + return fmt.Errorf("waiting for replication to complete for Service Bus Namespace Disaster Recovery Configs (Namespace %q / Resource Group %q): %s", id.NamespaceName, id.ResourceGroupName, err) } return nil } + +func expandTopicAuthorizationRuleRights(d *pluginsdk.ResourceData) *[]topicsauthorizationrule.AccessRights { + rights := make([]topicsauthorizationrule.AccessRights, 0) + + if d.Get("listen").(bool) { + rights = append(rights, topicsauthorizationrule.AccessRightsListen) + } + + if d.Get("send").(bool) { + rights = append(rights, topicsauthorizationrule.AccessRightsSend) + } + + if d.Get("manage").(bool) { + rights = append(rights, topicsauthorizationrule.AccessRightsManage) + } + + return &rights +} + +func flattenTopicAuthorizationRuleRights(rights *[]topicsauthorizationrule.AccessRights) (listen, send, manage bool) { + if rights != nil { + for _, right := range *rights { + switch right { + case topicsauthorizationrule.AccessRightsListen: + listen = true + case topicsauthorizationrule.AccessRightsSend: + send = true + case topicsauthorizationrule.AccessRightsManage: + manage = true + default: + log.Printf("[DEBUG] Unknown Authorization Rule Right '%s'", right) + } + } + } + + return listen, send, manage +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_data_source.go index b90136ec390..192214d1248 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_data_source.go @@ -4,16 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups" - - "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" azValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceServiceBusTopic() *pluginsdk.Resource { @@ -34,7 +33,7 @@ func dataSourceServiceBusTopic() *pluginsdk.Resource { "namespace_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: validate.NamespaceID, + ValidateFunc: namespaces.ValidateNamespaceID, AtLeastOneOf: []string{"namespace_id", "resource_group_name", "namespace_name"}, }, @@ -114,67 +113,75 @@ func dataSourceServiceBusTopicRead(d *pluginsdk.ResourceData, meta interface{}) subscriptionId := meta.(*clients.Client).Account.SubscriptionId defer cancel() - name := d.Get("name").(string) - var resourceGroup string var namespaceName string if v, ok := d.Get("namespace_id").(string); ok && v != "" { - namespaceId, err := parse.NamespaceID(v) + namespaceId, err := topics.ParseNamespaceID(v) if err != nil { - return fmt.Errorf("parsing topic ID %q: %+v", v, err) + return err } - resourceGroup = namespaceId.ResourceGroup - namespaceName = namespaceId.Name + resourceGroup = namespaceId.ResourceGroupName + namespaceName = namespaceId.NamespaceName } else { resourceGroup = d.Get("resource_group_name").(string) namespaceName = d.Get("namespace_name").(string) } - id := parse.NewTopicID(subscriptionId, resourceGroup, namespaceName, name) - resp, err := client.Get(ctx, resourceGroup, namespaceName, name) + id := topics.NewTopicID(subscriptionId, resourceGroup, namespaceName, d.Get("name").(string)) + + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf("Service Bus Topic %q was not found in Resource Group %q Namespace %q", name, resourceGroup, namespaceName) + if response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("%s was not found", id) } - return fmt.Errorf("making Read request on Azure Service Bus Topic %q in Resource Group %q Namespace %q: %v", name, resourceGroup, namespaceName, err) + return fmt.Errorf("retrieving %s: %v", id, err) } d.SetId(id.ID()) - if props := resp.SBTopicProperties; props != nil { - d.Set("status", string(props.Status)) - d.Set("auto_delete_on_idle", props.AutoDeleteOnIdle) - d.Set("default_message_ttl", props.DefaultMessageTimeToLive) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + status := "" + if v := props.Status; v != nil { + status = string(*v) + } + d.Set("status", status) + d.Set("auto_delete_on_idle", props.AutoDeleteOnIdle) + d.Set("default_message_ttl", props.DefaultMessageTimeToLive) - if window := props.DuplicateDetectionHistoryTimeWindow; window != nil && *window != "" { - d.Set("duplicate_detection_history_time_window", window) - } + if window := props.DuplicateDetectionHistoryTimeWindow; window != nil && *window != "" { + d.Set("duplicate_detection_history_time_window", window) + } - d.Set("enable_batched_operations", props.EnableBatchedOperations) - d.Set("enable_express", props.EnableExpress) - d.Set("enable_partitioning", props.EnablePartitioning) - d.Set("requires_duplicate_detection", props.RequiresDuplicateDetection) - d.Set("support_ordering", props.SupportOrdering) - - if maxSizeMB := props.MaxSizeInMegabytes; maxSizeMB != nil { - maxSize := int(*props.MaxSizeInMegabytes) - - // if the topic is in a premium namespace and partitioning is enabled then the - // max size returned by the API will be 16 times greater than the value set - if partitioning := props.EnablePartitioning; partitioning != nil && *partitioning { - namespacesClient := meta.(*clients.Client).ServiceBus.NamespacesClient - namespace, err := namespacesClient.Get(ctx, resourceGroup, namespaceName) - if err != nil { - return err + d.Set("enable_batched_operations", props.EnableBatchedOperations) + d.Set("enable_express", props.EnableExpress) + d.Set("enable_partitioning", props.EnablePartitioning) + d.Set("requires_duplicate_detection", props.RequiresDuplicateDetection) + d.Set("support_ordering", props.SupportOrdering) + + if maxSizeMB := props.MaxSizeInMegabytes; maxSizeMB != nil { + maxSize := int(*props.MaxSizeInMegabytes) + + // if the topic is in a premium namespace and partitioning is enabled then the + // max size returned by the API will be 16 times greater than the value set + if partitioning := props.EnablePartitioning; partitioning != nil && *partitioning { + namespacesClient := meta.(*clients.Client).ServiceBus.NamespacesClient + namespaceId := namespaces.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) + namespace, err := namespacesClient.Get(ctx, namespaceId) + if err != nil { + return err + } + + if namespaceModel := namespace.Model; namespaceModel != nil { + if namespaceModel.Sku.Name != namespaces.SkuNamePremium { + const partitionCount = 16 + maxSize = int(*props.MaxSizeInMegabytes / partitionCount) + } + } } - if namespace.Sku.Name != servicebus.SkuNamePremium { - const partitionCount = 16 - maxSize = int(*props.MaxSizeInMegabytes / partitionCount) - } + d.Set("max_size_in_megabytes", maxSize) } - - d.Set("max_size_in_megabytes", maxSize) } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_resource.go index 8421c276c9b..12abeabfaa0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/servicebus_topic_resource.go @@ -5,11 +5,12 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" azValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -25,7 +26,7 @@ func resourceServiceBusTopic() *pluginsdk.Resource { Delete: resourceServiceBusTopicDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.TopicID(id) + _, err := topics.ParseTopicID(id) return err }), @@ -54,16 +55,16 @@ func resourceServiceBusTopicSchema() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: azValidate.NamespaceID, + ValidateFunc: namespaces.ValidateNamespaceID, }, "status": { Type: pluginsdk.TypeString, Optional: true, - Default: string(servicebus.EntityStatusActive), + Default: string(topics.EntityStatusActive), ValidateFunc: validation.StringInSlice([]string{ - string(servicebus.EntityStatusActive), - string(servicebus.EntityStatusDisabled), + string(topics.EntityStatusActive), + string(topics.EntityStatusDisabled), }, false), }, @@ -140,79 +141,78 @@ func resourceServiceBusTopicCreateUpdate(d *pluginsdk.ResourceData, meta interfa defer cancel() log.Printf("[INFO] preparing arguments for Azure ServiceBus Topic creation.") - status := d.Get("status").(string) - - enableBatchedOps := d.Get("enable_batched_operations").(bool) - enableExpress := d.Get("enable_express").(bool) - enablePartitioning := d.Get("enable_partitioning").(bool) - maxSize := int32(d.Get("max_size_in_megabytes").(int)) - requiresDuplicateDetection := d.Get("requires_duplicate_detection").(bool) - supportOrdering := d.Get("support_ordering").(bool) - - var resourceId parse.TopicId + var id topics.TopicId if namespaceIdLit := d.Get("namespace_id").(string); namespaceIdLit != "" { - namespaceId, _ := parse.NamespaceID(namespaceIdLit) - resourceId = parse.NewTopicID(namespaceId.SubscriptionId, namespaceId.ResourceGroup, namespaceId.Name, d.Get("name").(string)) + namespaceId, err := topics.ParseNamespaceID(namespaceIdLit) + if err != nil { + return err + } + id = topics.NewTopicID(namespaceId.SubscriptionId, namespaceId.ResourceGroupName, namespaceId.NamespaceName, d.Get("name").(string)) } if d.IsNewResource() { - existing, err := client.Get(ctx, resourceId.ResourceGroup, resourceId.NamespaceName, resourceId.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing %s: %+v", resourceId, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { - return tf.ImportAsExistsError("azurerm_service_fabric_cluster", resourceId.ID()) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_servicebus_topic", id.ID()) } } - parameters := servicebus.SBTopic{ - Name: utils.String(resourceId.Name), - SBTopicProperties: &servicebus.SBTopicProperties{ - Status: servicebus.EntityStatus(status), - EnableBatchedOperations: utils.Bool(enableBatchedOps), - EnableExpress: utils.Bool(enableExpress), - EnablePartitioning: utils.Bool(enablePartitioning), - MaxSizeInMegabytes: utils.Int32(maxSize), - RequiresDuplicateDetection: utils.Bool(requiresDuplicateDetection), - SupportOrdering: utils.Bool(supportOrdering), + status := topics.EntityStatus(d.Get("status").(string)) + parameters := topics.SBTopic{ + Name: utils.String(id.TopicName), + Properties: &topics.SBTopicProperties{ + Status: &status, + EnableBatchedOperations: utils.Bool(d.Get("enable_batched_operations").(bool)), + EnableExpress: utils.Bool(d.Get("enable_express").(bool)), + EnablePartitioning: utils.Bool(d.Get("enable_partitioning").(bool)), + MaxSizeInMegabytes: utils.Int64(int64(d.Get("max_size_in_megabytes").(int))), + RequiresDuplicateDetection: utils.Bool(d.Get("requires_duplicate_detection").(bool)), + SupportOrdering: utils.Bool(d.Get("support_ordering").(bool)), }, } if autoDeleteOnIdle := d.Get("auto_delete_on_idle").(string); autoDeleteOnIdle != "" { - parameters.SBTopicProperties.AutoDeleteOnIdle = utils.String(autoDeleteOnIdle) + parameters.Properties.AutoDeleteOnIdle = utils.String(autoDeleteOnIdle) } if defaultTTL := d.Get("default_message_ttl").(string); defaultTTL != "" { - parameters.SBTopicProperties.DefaultMessageTimeToLive = utils.String(defaultTTL) + parameters.Properties.DefaultMessageTimeToLive = utils.String(defaultTTL) } if duplicateWindow := d.Get("duplicate_detection_history_time_window").(string); duplicateWindow != "" { - parameters.SBTopicProperties.DuplicateDetectionHistoryTimeWindow = utils.String(duplicateWindow) + parameters.Properties.DuplicateDetectionHistoryTimeWindow = utils.String(duplicateWindow) } // We need to retrieve the namespace because Premium namespace works differently from Basic and Standard namespacesClient := meta.(*clients.Client).ServiceBus.NamespacesClient - namespace, err := namespacesClient.Get(ctx, resourceId.ResourceGroup, resourceId.NamespaceName) + namespaceId := namespaces.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) + resp, err := namespacesClient.Get(ctx, namespaceId) if err != nil { - return fmt.Errorf("retrieving ServiceBus Namespace %q (Resource Group %q): %+v", resourceId.NamespaceName, resourceId.ResourceGroup, err) + return fmt.Errorf("retrieving ServiceBus Namespace %q (Resource Group %q): %+v", id.NamespaceName, id.ResourceGroupName, err) } // output of `max_message_size_in_kilobytes` is also set in non-Premium namespaces, with a value of 256 if v, ok := d.GetOk("max_message_size_in_kilobytes"); ok && v.(int) != 256 { - if namespace.Sku.Name != servicebus.SkuNamePremium { - return fmt.Errorf("ServiceBus Topic %q does not support input on `max_message_size_in_kilobytes` in %s SKU and should be removed", resourceId.Name, namespace.Sku.Name) + if model := resp.Model; model != nil { + if model.Sku.Name != namespaces.SkuNamePremium { + return fmt.Errorf("%s does not support input on `max_message_size_in_kilobytes` in %s SKU and should be removed", id, model.Sku.Name) + } + parameters.Properties.MaxMessageSizeInKilobytes = utils.Int64(int64(v.(int))) } - parameters.SBTopicProperties.MaxMessageSizeInKilobytes = utils.Int64(int64(v.(int))) + } - if _, err := client.CreateOrUpdate(ctx, resourceId.ResourceGroup, resourceId.NamespaceName, resourceId.Name, parameters); err != nil { - return fmt.Errorf("creating/updating %s: %v", resourceId, err) + if _, err := client.CreateOrUpdate(ctx, id, parameters); err != nil { + return fmt.Errorf("creating/updating %s: %v", id, err) } - d.SetId(resourceId.ID()) + d.SetId(id.ID()) return resourceServiceBusTopicRead(d, meta) } @@ -221,58 +221,67 @@ func resourceServiceBusTopicRead(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.TopicID(d.Id()) + id, err := topics.ParseTopicID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NamespaceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Name) - d.Set("namespace_id", parse.NewNamespaceID(id.SubscriptionId, id.ResourceGroup, id.NamespaceName).ID()) + d.Set("name", id.TopicName) + d.Set("namespace_id", topics.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName).ID()) - if props := resp.SBTopicProperties; props != nil { - d.Set("status", string(props.Status)) - d.Set("auto_delete_on_idle", props.AutoDeleteOnIdle) - d.Set("default_message_ttl", props.DefaultMessageTimeToLive) + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { + status := "" + if v := props.Status; v != nil { + status = string(*v) + } + d.Set("status", status) + d.Set("auto_delete_on_idle", props.AutoDeleteOnIdle) + d.Set("default_message_ttl", props.DefaultMessageTimeToLive) - if window := props.DuplicateDetectionHistoryTimeWindow; window != nil && *window != "" { - d.Set("duplicate_detection_history_time_window", window) - } + if window := props.DuplicateDetectionHistoryTimeWindow; window != nil && *window != "" { + d.Set("duplicate_detection_history_time_window", window) + } - d.Set("enable_batched_operations", props.EnableBatchedOperations) - d.Set("enable_express", props.EnableExpress) - d.Set("enable_partitioning", props.EnablePartitioning) - d.Set("max_message_size_in_kilobytes", props.MaxMessageSizeInKilobytes) - d.Set("requires_duplicate_detection", props.RequiresDuplicateDetection) - d.Set("support_ordering", props.SupportOrdering) - - if maxSizeMB := props.MaxSizeInMegabytes; maxSizeMB != nil { - maxSize := int(*props.MaxSizeInMegabytes) - - // if the topic is in a premium namespace and partitioning is enabled then the - // max size returned by the API will be 16 times greater than the value set - if partitioning := props.EnablePartitioning; partitioning != nil && *partitioning { - namespacesClient := meta.(*clients.Client).ServiceBus.NamespacesClient - namespace, err := namespacesClient.Get(ctx, id.ResourceGroup, id.NamespaceName) - if err != nil { - return err + d.Set("enable_batched_operations", props.EnableBatchedOperations) + d.Set("enable_express", props.EnableExpress) + d.Set("enable_partitioning", props.EnablePartitioning) + d.Set("max_message_size_in_kilobytes", props.MaxMessageSizeInKilobytes) + d.Set("requires_duplicate_detection", props.RequiresDuplicateDetection) + d.Set("support_ordering", props.SupportOrdering) + + if maxSizeMB := props.MaxSizeInMegabytes; maxSizeMB != nil { + maxSize := int(*props.MaxSizeInMegabytes) + + // if the topic is in a premium namespace and partitioning is enabled then the + // max size returned by the API will be 16 times greater than the value set + if partitioning := props.EnablePartitioning; partitioning != nil && *partitioning { + namespacesClient := meta.(*clients.Client).ServiceBus.NamespacesClient + namespaceId := namespaces.NewNamespaceID(id.SubscriptionId, id.ResourceGroupName, id.NamespaceName) + namespaceResp, err := namespacesClient.Get(ctx, namespaceId) + if err != nil { + return err + } + + if namespaceModel := namespaceResp.Model; namespaceModel != nil { + if namespaceModel.Sku.Name != namespaces.SkuNamePremium { + const partitionCount = 16 + maxSize = int(*props.MaxSizeInMegabytes / partitionCount) + } + } } - if namespace.Sku.Name != servicebus.SkuNamePremium { - const partitionCount = 16 - maxSize = int(*props.MaxSizeInMegabytes / partitionCount) - } + d.Set("max_size_in_megabytes", maxSize) } - - d.Set("max_size_in_megabytes", maxSize) } } @@ -284,14 +293,14 @@ func resourceServiceBusTopicDelete(d *pluginsdk.ResourceData, meta interface{}) ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.TopicID(d.Id()) + id, err := topics.ParseTopicID(d.Id()) if err != nil { return err } - resp, err := client.Delete(ctx, id.ResourceGroup, id.NamespaceName, id.Name) + resp, err := client.Delete(ctx, *id) if err != nil { - if !utils.ResponseWasNotFound(resp) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("deleting %s: %+v", id, err) } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/transition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/transition.go new file mode 100644 index 00000000000..449c32f0299 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/transition.go @@ -0,0 +1,23 @@ +package servicebus + +import "github.com/hashicorp/terraform-provider-azurerm/utils" + +func expandTags(input map[string]interface{}) *map[string]string { + output := make(map[string]string) + for k, v := range input { + output[k] = v.(string) + } + return &output +} + +func flattenTags(input *map[string]string) map[string]*string { + output := make(map[string]*string) + + if input != nil { + for k, v := range *input { + output[k] = utils.String(v) + } + } + + return output +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/namespace_authorization_rule_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/namespace_authorization_rule_id.go deleted file mode 100644 index eebbfa60318..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/namespace_authorization_rule_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" -) - -func NamespaceAuthorizationRuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.NamespaceAuthorizationRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/namespace_disaster_recovery_config_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/namespace_disaster_recovery_config_id.go deleted file mode 100644 index f7172936f1c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/namespace_disaster_recovery_config_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" -) - -func NamespaceDisasterRecoveryConfigID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.NamespaceDisasterRecoveryConfigID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/namespace_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/namespace_id.go deleted file mode 100644 index 3f659acb776..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/namespace_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" -) - -func NamespaceID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.NamespaceID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/queue_authorization_rule_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/queue_authorization_rule_id.go deleted file mode 100644 index 1b353fa468c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/queue_authorization_rule_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" -) - -func QueueAuthorizationRuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.QueueAuthorizationRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/queue_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/queue_id.go deleted file mode 100644 index 4e2296d7e49..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/queue_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" -) - -func QueueID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.QueueID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/subscription_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/subscription_id.go deleted file mode 100644 index 2b4c61e583d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/subscription_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" -) - -func SubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.SubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/subscription_rule_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/subscription_rule_id.go deleted file mode 100644 index d175f3d5547..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/subscription_rule_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" -) - -func SubscriptionRuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.SubscriptionRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/topic_authorization_rule_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/topic_authorization_rule_id.go deleted file mode 100644 index ecf764e6852..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/topic_authorization_rule_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" -) - -func TopicAuthorizationRuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.TopicAuthorizationRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/topic_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/topic_id.go deleted file mode 100644 index 76d8988c430..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate/topic_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse" -) - -func TopicID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.TopicID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/client/client.go index f580b3cf456..c9bb4ba8455 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/client/client.go @@ -1,17 +1,14 @@ package client import ( - "github.com/Azure/go-autorest/autorest" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype" ) type Client struct { ManagedClusterClient *managedcluster.ManagedClusterClient NodeTypeClient *nodetype.NodeTypeClient - tokenFunc func(endpoint string) (autorest.Authorizer, error) - configureClientFunc func(c *autorest.Client, authorizer autorest.Authorizer) } func NewClient(o *common.ClientOptions) *Client { @@ -24,7 +21,5 @@ func NewClient(o *common.ClientOptions) *Client { return &Client{ ManagedClusterClient: &managedCluster, NodeTypeClient: &nodeType, - tokenFunc: o.TokenFunc, - configureClientFunc: o.ConfigureClient, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/parse/service_fabric_managed_cluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/parse/service_fabric_managed_cluster.go deleted file mode 100644 index 1bbbe3bfc5b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/parse/service_fabric_managed_cluster.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ServiceFabricManagedClusterId struct { - SubscriptionId string - ResourceGroup string - ManagedClusterName string -} - -func NewServiceFabricManagedClusterID(subscriptionId, resourceGroup, managedClusterName string) ServiceFabricManagedClusterId { - return ServiceFabricManagedClusterId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - ManagedClusterName: managedClusterName, - } -} - -func (id ServiceFabricManagedClusterId) String() string { - segments := []string{ - fmt.Sprintf("Managed Cluster Name %q", id.ManagedClusterName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Service Fabric Managed Cluster", segmentsStr) -} - -func (id ServiceFabricManagedClusterId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceFabric/managedClusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.ManagedClusterName) -} - -// ServiceFabricManagedClusterID parses a ServiceFabricManagedCluster ID into an ServiceFabricManagedClusterId struct -func ServiceFabricManagedClusterID(input string) (*ServiceFabricManagedClusterId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ServiceFabricManagedClusterId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.ManagedClusterName, err = id.PopSegment("managedClusters"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/resourceids.go deleted file mode 100644 index e72b2871afc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/resourceids.go +++ /dev/null @@ -1,3 +0,0 @@ -package servicefabricmanaged - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ServiceFabricManagedCluster -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.ServiceFabric/managedClusters/clusterValue diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/client.go deleted file mode 100644 index a07f232b459..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package managedcluster - -import "github.com/Azure/go-autorest/autorest" - -type ManagedClusterClient struct { - Client autorest.Client - baseUri string -} - -func NewManagedClusterClientWithBaseURI(endpoint string) ManagedClusterClient { - return ManagedClusterClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/constants.go deleted file mode 100644 index c296294985d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/constants.go +++ /dev/null @@ -1,371 +0,0 @@ -package managedcluster - -import "strings" - -type Access string - -const ( - AccessAllow Access = "allow" - AccessDeny Access = "deny" -) - -func PossibleValuesForAccess() []string { - return []string{ - string(AccessAllow), - string(AccessDeny), - } -} - -func parseAccess(input string) (*Access, error) { - vals := map[string]Access{ - "allow": AccessAllow, - "deny": AccessDeny, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Access(input) - return &out, nil -} - -type AddonFeatures string - -const ( - AddonFeaturesBackupRestoreService AddonFeatures = "BackupRestoreService" - AddonFeaturesDnsService AddonFeatures = "DnsService" - AddonFeaturesResourceMonitorService AddonFeatures = "ResourceMonitorService" -) - -func PossibleValuesForAddonFeatures() []string { - return []string{ - string(AddonFeaturesBackupRestoreService), - string(AddonFeaturesDnsService), - string(AddonFeaturesResourceMonitorService), - } -} - -func parseAddonFeatures(input string) (*AddonFeatures, error) { - vals := map[string]AddonFeatures{ - "backuprestoreservice": AddonFeaturesBackupRestoreService, - "dnsservice": AddonFeaturesDnsService, - "resourcemonitorservice": AddonFeaturesResourceMonitorService, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AddonFeatures(input) - return &out, nil -} - -type ClusterState string - -const ( - ClusterStateBaselineUpgrade ClusterState = "BaselineUpgrade" - ClusterStateDeploying ClusterState = "Deploying" - ClusterStateReady ClusterState = "Ready" - ClusterStateUpgradeFailed ClusterState = "UpgradeFailed" - ClusterStateUpgrading ClusterState = "Upgrading" - ClusterStateWaitingForNodes ClusterState = "WaitingForNodes" -) - -func PossibleValuesForClusterState() []string { - return []string{ - string(ClusterStateBaselineUpgrade), - string(ClusterStateDeploying), - string(ClusterStateReady), - string(ClusterStateUpgradeFailed), - string(ClusterStateUpgrading), - string(ClusterStateWaitingForNodes), - } -} - -func parseClusterState(input string) (*ClusterState, error) { - vals := map[string]ClusterState{ - "baselineupgrade": ClusterStateBaselineUpgrade, - "deploying": ClusterStateDeploying, - "ready": ClusterStateReady, - "upgradefailed": ClusterStateUpgradeFailed, - "upgrading": ClusterStateUpgrading, - "waitingfornodes": ClusterStateWaitingForNodes, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ClusterState(input) - return &out, nil -} - -type ClusterUpgradeCadence string - -const ( - ClusterUpgradeCadenceWaveOne ClusterUpgradeCadence = "Wave1" - ClusterUpgradeCadenceWaveTwo ClusterUpgradeCadence = "Wave2" - ClusterUpgradeCadenceWaveZero ClusterUpgradeCadence = "Wave0" -) - -func PossibleValuesForClusterUpgradeCadence() []string { - return []string{ - string(ClusterUpgradeCadenceWaveOne), - string(ClusterUpgradeCadenceWaveTwo), - string(ClusterUpgradeCadenceWaveZero), - } -} - -func parseClusterUpgradeCadence(input string) (*ClusterUpgradeCadence, error) { - vals := map[string]ClusterUpgradeCadence{ - "wave1": ClusterUpgradeCadenceWaveOne, - "wave2": ClusterUpgradeCadenceWaveTwo, - "wave0": ClusterUpgradeCadenceWaveZero, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ClusterUpgradeCadence(input) - return &out, nil -} - -type ClusterUpgradeMode string - -const ( - ClusterUpgradeModeAutomatic ClusterUpgradeMode = "Automatic" - ClusterUpgradeModeManual ClusterUpgradeMode = "Manual" -) - -func PossibleValuesForClusterUpgradeMode() []string { - return []string{ - string(ClusterUpgradeModeAutomatic), - string(ClusterUpgradeModeManual), - } -} - -func parseClusterUpgradeMode(input string) (*ClusterUpgradeMode, error) { - vals := map[string]ClusterUpgradeMode{ - "automatic": ClusterUpgradeModeAutomatic, - "manual": ClusterUpgradeModeManual, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ClusterUpgradeMode(input) - return &out, nil -} - -type Direction string - -const ( - DirectionInbound Direction = "inbound" - DirectionOutbound Direction = "outbound" -) - -func PossibleValuesForDirection() []string { - return []string{ - string(DirectionInbound), - string(DirectionOutbound), - } -} - -func parseDirection(input string) (*Direction, error) { - vals := map[string]Direction{ - "inbound": DirectionInbound, - "outbound": DirectionOutbound, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Direction(input) - return &out, nil -} - -type ManagedResourceProvisioningState string - -const ( - ManagedResourceProvisioningStateCanceled ManagedResourceProvisioningState = "Canceled" - ManagedResourceProvisioningStateCreated ManagedResourceProvisioningState = "Created" - ManagedResourceProvisioningStateCreating ManagedResourceProvisioningState = "Creating" - ManagedResourceProvisioningStateDeleted ManagedResourceProvisioningState = "Deleted" - ManagedResourceProvisioningStateDeleting ManagedResourceProvisioningState = "Deleting" - ManagedResourceProvisioningStateFailed ManagedResourceProvisioningState = "Failed" - ManagedResourceProvisioningStateNone ManagedResourceProvisioningState = "None" - ManagedResourceProvisioningStateOther ManagedResourceProvisioningState = "Other" - ManagedResourceProvisioningStateSucceeded ManagedResourceProvisioningState = "Succeeded" - ManagedResourceProvisioningStateUpdating ManagedResourceProvisioningState = "Updating" -) - -func PossibleValuesForManagedResourceProvisioningState() []string { - return []string{ - string(ManagedResourceProvisioningStateCanceled), - string(ManagedResourceProvisioningStateCreated), - string(ManagedResourceProvisioningStateCreating), - string(ManagedResourceProvisioningStateDeleted), - string(ManagedResourceProvisioningStateDeleting), - string(ManagedResourceProvisioningStateFailed), - string(ManagedResourceProvisioningStateNone), - string(ManagedResourceProvisioningStateOther), - string(ManagedResourceProvisioningStateSucceeded), - string(ManagedResourceProvisioningStateUpdating), - } -} - -func parseManagedResourceProvisioningState(input string) (*ManagedResourceProvisioningState, error) { - vals := map[string]ManagedResourceProvisioningState{ - "canceled": ManagedResourceProvisioningStateCanceled, - "created": ManagedResourceProvisioningStateCreated, - "creating": ManagedResourceProvisioningStateCreating, - "deleted": ManagedResourceProvisioningStateDeleted, - "deleting": ManagedResourceProvisioningStateDeleting, - "failed": ManagedResourceProvisioningStateFailed, - "none": ManagedResourceProvisioningStateNone, - "other": ManagedResourceProvisioningStateOther, - "succeeded": ManagedResourceProvisioningStateSucceeded, - "updating": ManagedResourceProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ManagedResourceProvisioningState(input) - return &out, nil -} - -type NsgProtocol string - -const ( - NsgProtocolAh NsgProtocol = "ah" - NsgProtocolEsp NsgProtocol = "esp" - NsgProtocolHttp NsgProtocol = "http" - NsgProtocolHttps NsgProtocol = "https" - NsgProtocolIcmp NsgProtocol = "icmp" - NsgProtocolTcp NsgProtocol = "tcp" - NsgProtocolUdp NsgProtocol = "udp" -) - -func PossibleValuesForNsgProtocol() []string { - return []string{ - string(NsgProtocolAh), - string(NsgProtocolEsp), - string(NsgProtocolHttp), - string(NsgProtocolHttps), - string(NsgProtocolIcmp), - string(NsgProtocolTcp), - string(NsgProtocolUdp), - } -} - -func parseNsgProtocol(input string) (*NsgProtocol, error) { - vals := map[string]NsgProtocol{ - "ah": NsgProtocolAh, - "esp": NsgProtocolEsp, - "http": NsgProtocolHttp, - "https": NsgProtocolHttps, - "icmp": NsgProtocolIcmp, - "tcp": NsgProtocolTcp, - "udp": NsgProtocolUdp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := NsgProtocol(input) - return &out, nil -} - -type ProbeProtocol string - -const ( - ProbeProtocolHttp ProbeProtocol = "http" - ProbeProtocolHttps ProbeProtocol = "https" - ProbeProtocolTcp ProbeProtocol = "tcp" -) - -func PossibleValuesForProbeProtocol() []string { - return []string{ - string(ProbeProtocolHttp), - string(ProbeProtocolHttps), - string(ProbeProtocolTcp), - } -} - -func parseProbeProtocol(input string) (*ProbeProtocol, error) { - vals := map[string]ProbeProtocol{ - "http": ProbeProtocolHttp, - "https": ProbeProtocolHttps, - "tcp": ProbeProtocolTcp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProbeProtocol(input) - return &out, nil -} - -type Protocol string - -const ( - ProtocolTcp Protocol = "tcp" - ProtocolUdp Protocol = "udp" -) - -func PossibleValuesForProtocol() []string { - return []string{ - string(ProtocolTcp), - string(ProtocolUdp), - } -} - -func parseProtocol(input string) (*Protocol, error) { - vals := map[string]Protocol{ - "tcp": ProtocolTcp, - "udp": ProtocolUdp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Protocol(input) - return &out, nil -} - -type SkuName string - -const ( - SkuNameBasic SkuName = "Basic" - SkuNameStandard SkuName = "Standard" -) - -func PossibleValuesForSkuName() []string { - return []string{ - string(SkuNameBasic), - string(SkuNameStandard), - } -} - -func parseSkuName(input string) (*SkuName, error) { - vals := map[string]SkuName{ - "basic": SkuNameBasic, - "standard": SkuNameStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SkuName(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/id_managedcluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/id_managedcluster.go deleted file mode 100644 index 80162381a76..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/id_managedcluster.go +++ /dev/null @@ -1,124 +0,0 @@ -package managedcluster - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ManagedClusterId{} - -// ManagedClusterId is a struct representing the Resource ID for a Managed Cluster -type ManagedClusterId struct { - SubscriptionId string - ResourceGroupName string - ClusterName string -} - -// NewManagedClusterID returns a new ManagedClusterId struct -func NewManagedClusterID(subscriptionId string, resourceGroupName string, clusterName string) ManagedClusterId { - return ManagedClusterId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ClusterName: clusterName, - } -} - -// ParseManagedClusterID parses 'input' into a ManagedClusterId -func ParseManagedClusterID(input string) (*ManagedClusterId, error) { - parser := resourceids.NewParserFromResourceIdType(ManagedClusterId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ManagedClusterId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseManagedClusterIDInsensitively parses 'input' case-insensitively into a ManagedClusterId -// note: this method should only be used for API response data and not user input -func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) { - parser := resourceids.NewParserFromResourceIdType(ManagedClusterId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ManagedClusterId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateManagedClusterID checks that 'input' can be parsed as a Managed Cluster ID -func ValidateManagedClusterID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseManagedClusterID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Managed Cluster ID -func (id ManagedClusterId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceFabric/managedClusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Managed Cluster ID -func (id ManagedClusterId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftServiceFabric", "Microsoft.ServiceFabric", "Microsoft.ServiceFabric"), - resourceids.StaticSegment("managedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), - } -} - -// String returns a human-readable description of this Managed Cluster ID -func (id ManagedClusterId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Cluster Name: %q", id.ClusterName), - } - return fmt.Sprintf("Managed Cluster (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/id_resourcegroup.go deleted file mode 100644 index 6f0c4feb3da..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package managedcluster - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/id_subscription.go deleted file mode 100644 index 5b46099b84d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package managedcluster - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_createorupdate_autorest.go deleted file mode 100644 index abd8f61305d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_createorupdate_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package managedcluster - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateOrUpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c ManagedClusterClient) CreateOrUpdate(ctx context.Context, id ManagedClusterId, input ManagedCluster) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ManagedClusterClient) CreateOrUpdateThenPoll(ctx context.Context, id ManagedClusterId, input ManagedCluster) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ManagedClusterClient) preparerForCreateOrUpdate(ctx context.Context, id ManagedClusterId, input ManagedCluster) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClusterClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_delete_autorest.go deleted file mode 100644 index 3811c405eb2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_delete_autorest.go +++ /dev/null @@ -1,73 +0,0 @@ -package managedcluster - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c ManagedClusterClient) Delete(ctx context.Context, id ManagedClusterId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c ManagedClusterClient) DeleteThenPoll(ctx context.Context, id ManagedClusterId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c ManagedClusterClient) preparerForDelete(ctx context.Context, id ManagedClusterId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c ManagedClusterClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_get_autorest.go deleted file mode 100644 index 8147764d235..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package managedcluster - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *ManagedCluster -} - -// Get ... -func (c ManagedClusterClient) Get(ctx context.Context, id ManagedClusterId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ManagedClusterClient) preparerForGet(ctx context.Context, id ManagedClusterId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ManagedClusterClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_listbyresourcegroup_autorest.go deleted file mode 100644 index cdd6cd404eb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package managedcluster - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *[]ManagedCluster - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []ManagedCluster -} - -func (r ListByResourceGroupResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c ManagedClusterClient) ListByResourceGroup(ctx context.Context, id ResourceGroupId) (resp ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c ManagedClusterClient) ListByResourceGroupComplete(ctx context.Context, id ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ManagedClusterPredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClusterClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate ManagedClusterPredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]ManagedCluster, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c ManagedClusterClient) preparerForListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ServiceFabric/managedClusters", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c ManagedClusterClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c ManagedClusterClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - type page struct { - Values []ManagedCluster `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_listbysubscription_autorest.go deleted file mode 100644 index 0db4e399047..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_listbysubscription_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package managedcluster - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListBySubscriptionResponse struct { - HttpResponse *http.Response - Model *[]ManagedCluster - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []ManagedCluster -} - -func (r ListBySubscriptionResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListBySubscriptionResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListBySubscription ... -func (c ManagedClusterClient) ListBySubscription(ctx context.Context, id SubscriptionId) (resp ListBySubscriptionResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c ManagedClusterClient) ListBySubscriptionComplete(ctx context.Context, id SubscriptionId) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ManagedClusterPredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ManagedClusterClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate ManagedClusterPredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]ManagedCluster, 0) - - page, err := c.ListBySubscription(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c ManagedClusterClient) preparerForListBySubscription(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ServiceFabric/managedClusters", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c ManagedClusterClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListBySubscription handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (c ManagedClusterClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionResponse, err error) { - type page struct { - Values []ManagedCluster `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionResponse, err error) { - req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_update_autorest.go deleted file mode 100644 index 5147b3def08..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/method_update_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package managedcluster - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UpdateResponse struct { - HttpResponse *http.Response - Model *ManagedCluster -} - -// Update ... -func (c ManagedClusterClient) Update(ctx context.Context, id ManagedClusterId, input ManagedClusterUpdateParameters) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "managedcluster.ManagedClusterClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ManagedClusterClient) preparerForUpdate(ctx context.Context, id ManagedClusterId, input ManagedClusterUpdateParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ManagedClusterClient) responderForUpdate(resp *http.Response) (result UpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_applicationtypeversionscleanuppolicy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_applicationtypeversionscleanuppolicy.go deleted file mode 100644 index bb5fb72780a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_applicationtypeversionscleanuppolicy.go +++ /dev/null @@ -1,5 +0,0 @@ -package managedcluster - -type ApplicationTypeVersionsCleanupPolicy struct { - MaxUnusedVersionsToKeep int64 `json:"maxUnusedVersionsToKeep"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_azureactivedirectory.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_azureactivedirectory.go deleted file mode 100644 index 9834de92a2e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_azureactivedirectory.go +++ /dev/null @@ -1,7 +0,0 @@ -package managedcluster - -type AzureActiveDirectory struct { - ClientApplication *string `json:"clientApplication,omitempty"` - ClusterApplication *string `json:"clusterApplication,omitempty"` - TenantId *string `json:"tenantId,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_clientcertificate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_clientcertificate.go deleted file mode 100644 index 8c78a28f443..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_clientcertificate.go +++ /dev/null @@ -1,8 +0,0 @@ -package managedcluster - -type ClientCertificate struct { - CommonName *string `json:"commonName,omitempty"` - IsAdmin bool `json:"isAdmin"` - IssuerThumbprint *string `json:"issuerThumbprint,omitempty"` - Thumbprint *string `json:"thumbprint,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_loadbalancingrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_loadbalancingrule.go deleted file mode 100644 index ff47ba33e5f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_loadbalancingrule.go +++ /dev/null @@ -1,10 +0,0 @@ -package managedcluster - -type LoadBalancingRule struct { - BackendPort int64 `json:"backendPort"` - FrontendPort int64 `json:"frontendPort"` - ProbePort *int64 `json:"probePort,omitempty"` - ProbeProtocol ProbeProtocol `json:"probeProtocol"` - ProbeRequestPath *string `json:"probeRequestPath,omitempty"` - Protocol Protocol `json:"protocol"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_managedclusterupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_managedclusterupdateparameters.go deleted file mode 100644 index 4fd40346aa2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_managedclusterupdateparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package managedcluster - -type ManagedClusterUpdateParameters struct { - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_settingsparameterdescription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_settingsparameterdescription.go deleted file mode 100644 index 01840a6221c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_settingsparameterdescription.go +++ /dev/null @@ -1,6 +0,0 @@ -package managedcluster - -type SettingsParameterDescription struct { - Name string `json:"name"` - Value string `json:"value"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_settingssectiondescription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_settingssectiondescription.go deleted file mode 100644 index bb72ef0df84..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_settingssectiondescription.go +++ /dev/null @@ -1,6 +0,0 @@ -package managedcluster - -type SettingsSectionDescription struct { - Name string `json:"name"` - Parameters []SettingsParameterDescription `json:"parameters"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_sku.go deleted file mode 100644 index fc4f77af2fa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_sku.go +++ /dev/null @@ -1,5 +0,0 @@ -package managedcluster - -type Sku struct { - Name SkuName `json:"name"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_systemdata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_systemdata.go deleted file mode 100644 index 732a3e017bd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/model_systemdata.go +++ /dev/null @@ -1,10 +0,0 @@ -package managedcluster - -type SystemData struct { - CreatedAt *string `json:"createdAt,omitempty"` - CreatedBy *string `json:"createdBy,omitempty"` - CreatedByType *string `json:"createdByType,omitempty"` - LastModifiedAt *string `json:"lastModifiedAt,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - LastModifiedByType *string `json:"lastModifiedByType,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/predicates.go deleted file mode 100644 index 7c80450fb38..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/predicates.go +++ /dev/null @@ -1,34 +0,0 @@ -package managedcluster - -type ManagedClusterPredicate struct { - Etag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p ManagedClusterPredicate) Matches(input ManagedCluster) bool { - - if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { - return false - } - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/version.go deleted file mode 100644 index 977c2b25e24..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package managedcluster - -import "fmt" - -const defaultApiVersion = "2021-05-01" - -func userAgent() string { - return fmt.Sprintf("pandora/managedcluster/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/client.go deleted file mode 100644 index 8d69658f792..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package nodetype - -import "github.com/Azure/go-autorest/autorest" - -type NodeTypeClient struct { - Client autorest.Client - baseUri string -} - -func NewNodeTypeClientWithBaseURI(endpoint string) NodeTypeClient { - return NodeTypeClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/constants.go deleted file mode 100644 index d3ee0d56e1a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/constants.go +++ /dev/null @@ -1,86 +0,0 @@ -package nodetype - -import "strings" - -type DiskType string - -const ( - DiskTypePremiumLRS DiskType = "Premium_LRS" - DiskTypeStandardLRS DiskType = "Standard_LRS" - DiskTypeStandardSSDLRS DiskType = "StandardSSD_LRS" -) - -func PossibleValuesForDiskType() []string { - return []string{ - string(DiskTypePremiumLRS), - string(DiskTypeStandardLRS), - string(DiskTypeStandardSSDLRS), - } -} - -func parseDiskType(input string) (*DiskType, error) { - vals := map[string]DiskType{ - "premium_lrs": DiskTypePremiumLRS, - "standard_lrs": DiskTypeStandardLRS, - "standardssd_lrs": DiskTypeStandardSSDLRS, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := DiskType(input) - return &out, nil -} - -type ManagedResourceProvisioningState string - -const ( - ManagedResourceProvisioningStateCanceled ManagedResourceProvisioningState = "Canceled" - ManagedResourceProvisioningStateCreated ManagedResourceProvisioningState = "Created" - ManagedResourceProvisioningStateCreating ManagedResourceProvisioningState = "Creating" - ManagedResourceProvisioningStateDeleted ManagedResourceProvisioningState = "Deleted" - ManagedResourceProvisioningStateDeleting ManagedResourceProvisioningState = "Deleting" - ManagedResourceProvisioningStateFailed ManagedResourceProvisioningState = "Failed" - ManagedResourceProvisioningStateNone ManagedResourceProvisioningState = "None" - ManagedResourceProvisioningStateOther ManagedResourceProvisioningState = "Other" - ManagedResourceProvisioningStateSucceeded ManagedResourceProvisioningState = "Succeeded" - ManagedResourceProvisioningStateUpdating ManagedResourceProvisioningState = "Updating" -) - -func PossibleValuesForManagedResourceProvisioningState() []string { - return []string{ - string(ManagedResourceProvisioningStateCanceled), - string(ManagedResourceProvisioningStateCreated), - string(ManagedResourceProvisioningStateCreating), - string(ManagedResourceProvisioningStateDeleted), - string(ManagedResourceProvisioningStateDeleting), - string(ManagedResourceProvisioningStateFailed), - string(ManagedResourceProvisioningStateNone), - string(ManagedResourceProvisioningStateOther), - string(ManagedResourceProvisioningStateSucceeded), - string(ManagedResourceProvisioningStateUpdating), - } -} - -func parseManagedResourceProvisioningState(input string) (*ManagedResourceProvisioningState, error) { - vals := map[string]ManagedResourceProvisioningState{ - "canceled": ManagedResourceProvisioningStateCanceled, - "created": ManagedResourceProvisioningStateCreated, - "creating": ManagedResourceProvisioningStateCreating, - "deleted": ManagedResourceProvisioningStateDeleted, - "deleting": ManagedResourceProvisioningStateDeleting, - "failed": ManagedResourceProvisioningStateFailed, - "none": ManagedResourceProvisioningStateNone, - "other": ManagedResourceProvisioningStateOther, - "succeeded": ManagedResourceProvisioningStateSucceeded, - "updating": ManagedResourceProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ManagedResourceProvisioningState(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/id_managedcluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/id_managedcluster.go deleted file mode 100644 index b33fd72d927..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/id_managedcluster.go +++ /dev/null @@ -1,124 +0,0 @@ -package nodetype - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ManagedClusterId{} - -// ManagedClusterId is a struct representing the Resource ID for a Managed Cluster -type ManagedClusterId struct { - SubscriptionId string - ResourceGroupName string - ClusterName string -} - -// NewManagedClusterID returns a new ManagedClusterId struct -func NewManagedClusterID(subscriptionId string, resourceGroupName string, clusterName string) ManagedClusterId { - return ManagedClusterId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - ClusterName: clusterName, - } -} - -// ParseManagedClusterID parses 'input' into a ManagedClusterId -func ParseManagedClusterID(input string) (*ManagedClusterId, error) { - parser := resourceids.NewParserFromResourceIdType(ManagedClusterId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ManagedClusterId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseManagedClusterIDInsensitively parses 'input' case-insensitively into a ManagedClusterId -// note: this method should only be used for API response data and not user input -func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) { - parser := resourceids.NewParserFromResourceIdType(ManagedClusterId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ManagedClusterId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateManagedClusterID checks that 'input' can be parsed as a Managed Cluster ID -func ValidateManagedClusterID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseManagedClusterID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Managed Cluster ID -func (id ManagedClusterId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceFabric/managedClusters/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Managed Cluster ID -func (id ManagedClusterId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftServiceFabric", "Microsoft.ServiceFabric", "Microsoft.ServiceFabric"), - resourceids.StaticSegment("managedClusters", "managedClusters", "managedClusters"), - resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), - } -} - -// String returns a human-readable description of this Managed Cluster ID -func (id ManagedClusterId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Cluster Name: %q", id.ClusterName), - } - return fmt.Sprintf("Managed Cluster (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_createorupdate_autorest.go deleted file mode 100644 index dcc35bdecda..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_createorupdate_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package nodetype - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateOrUpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c NodeTypeClient) CreateOrUpdate(ctx context.Context, id NodeTypeId, input NodeType) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c NodeTypeClient) CreateOrUpdateThenPoll(ctx context.Context, id NodeTypeId, input NodeType) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c NodeTypeClient) preparerForCreateOrUpdate(ctx context.Context, id NodeTypeId, input NodeType) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c NodeTypeClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_delete_autorest.go deleted file mode 100644 index 870dee74e94..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_delete_autorest.go +++ /dev/null @@ -1,73 +0,0 @@ -package nodetype - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c NodeTypeClient) Delete(ctx context.Context, id NodeTypeId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c NodeTypeClient) DeleteThenPoll(ctx context.Context, id NodeTypeId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c NodeTypeClient) preparerForDelete(ctx context.Context, id NodeTypeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c NodeTypeClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_get_autorest.go deleted file mode 100644 index 3f5c7063703..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package nodetype - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *NodeType -} - -// Get ... -func (c NodeTypeClient) Get(ctx context.Context, id NodeTypeId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c NodeTypeClient) preparerForGet(ctx context.Context, id NodeTypeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c NodeTypeClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_restart_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_restart_autorest.go deleted file mode 100644 index bfaa970cffd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_restart_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package nodetype - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type RestartResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Restart ... -func (c NodeTypeClient) Restart(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (result RestartResponse, err error) { - req, err := c.preparerForRestart(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Restart", nil, "Failure preparing request") - return - } - - result, err = c.senderForRestart(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Restart", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RestartThenPoll performs Restart then polls until it's completed -func (c NodeTypeClient) RestartThenPoll(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) error { - result, err := c.Restart(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Restart: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Restart: %+v", err) - } - - return nil -} - -// preparerForRestart prepares the Restart request. -func (c NodeTypeClient) preparerForRestart(ctx context.Context, id NodeTypeId, input NodeTypeActionParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/restart", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRestart sends the Restart request. The method will close the -// http.Response Body if it receives an error. -func (c NodeTypeClient) senderForRestart(ctx context.Context, req *http.Request) (future RestartResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_update_autorest.go deleted file mode 100644 index 6f2efc41a2a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/method_update_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package nodetype - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UpdateResponse struct { - HttpResponse *http.Response - Model *NodeType -} - -// Update ... -func (c NodeTypeClient) Update(ctx context.Context, id NodeTypeId, input NodeTypeUpdateParameters) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "nodetype.NodeTypeClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c NodeTypeClient) preparerForUpdate(ctx context.Context, id NodeTypeId, input NodeTypeUpdateParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c NodeTypeClient) responderForUpdate(resp *http.Response) (result UpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_endpointrangedescription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_endpointrangedescription.go deleted file mode 100644 index cd2d53b3ce7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_endpointrangedescription.go +++ /dev/null @@ -1,6 +0,0 @@ -package nodetype - -type EndpointRangeDescription struct { - EndPort int64 `json:"endPort"` - StartPort int64 `json:"startPort"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_nodetype.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_nodetype.go deleted file mode 100644 index a7816dad6ae..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_nodetype.go +++ /dev/null @@ -1,10 +0,0 @@ -package nodetype - -type NodeType struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *NodeTypeProperties `json:"properties,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_nodetypeactionparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_nodetypeactionparameters.go deleted file mode 100644 index ae10cefbc59..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_nodetypeactionparameters.go +++ /dev/null @@ -1,6 +0,0 @@ -package nodetype - -type NodeTypeActionParameters struct { - Force *bool `json:"force,omitempty"` - Nodes []string `json:"nodes"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_nodetypeproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_nodetypeproperties.go deleted file mode 100644 index afec4027b31..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_nodetypeproperties.go +++ /dev/null @@ -1,27 +0,0 @@ -package nodetype - -import ( - "github.com/hashicorp/terraform-provider-azurerm/internal/identity" -) - -type NodeTypeProperties struct { - ApplicationPorts *EndpointRangeDescription `json:"applicationPorts,omitempty"` - Capacities *map[string]string `json:"capacities,omitempty"` - DataDiskSizeGB int64 `json:"dataDiskSizeGB"` - DataDiskType *DiskType `json:"dataDiskType,omitempty"` - EphemeralPorts *EndpointRangeDescription `json:"ephemeralPorts,omitempty"` - IsPrimary bool `json:"isPrimary"` - IsStateless *bool `json:"isStateless,omitempty"` - MultiplePlacementGroups *bool `json:"multiplePlacementGroups,omitempty"` - PlacementProperties *map[string]string `json:"placementProperties,omitempty"` - ProvisioningState *ManagedResourceProvisioningState `json:"provisioningState,omitempty"` - VmExtensions *[]VMSSExtension `json:"vmExtensions,omitempty"` - VmImageOffer *string `json:"vmImageOffer,omitempty"` - VmImagePublisher *string `json:"vmImagePublisher,omitempty"` - VmImageSku *string `json:"vmImageSku,omitempty"` - VmImageVersion *string `json:"vmImageVersion,omitempty"` - VmInstanceCount int64 `json:"vmInstanceCount"` - VmManagedIdentity *identity.UserAssignedIdentityList `json:"vmManagedIdentity,omitempty"` - VmSecrets *[]VaultSecretGroup `json:"vmSecrets,omitempty"` - VmSize *string `json:"vmSize,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_nodetypeupdateparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_nodetypeupdateparameters.go deleted file mode 100644 index 458c1a38742..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_nodetypeupdateparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package nodetype - -type NodeTypeUpdateParameters struct { - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_subresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_subresource.go deleted file mode 100644 index ca12479da80..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_subresource.go +++ /dev/null @@ -1,5 +0,0 @@ -package nodetype - -type SubResource struct { - Id *string `json:"id,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_systemdata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_systemdata.go deleted file mode 100644 index 8f557f8baeb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_systemdata.go +++ /dev/null @@ -1,10 +0,0 @@ -package nodetype - -type SystemData struct { - CreatedAt *string `json:"createdAt,omitempty"` - CreatedBy *string `json:"createdBy,omitempty"` - CreatedByType *string `json:"createdByType,omitempty"` - LastModifiedAt *string `json:"lastModifiedAt,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - LastModifiedByType *string `json:"lastModifiedByType,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_vaultcertificate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_vaultcertificate.go deleted file mode 100644 index 7a38acb6f1a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_vaultcertificate.go +++ /dev/null @@ -1,6 +0,0 @@ -package nodetype - -type VaultCertificate struct { - CertificateStore string `json:"certificateStore"` - CertificateUrl string `json:"certificateUrl"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_vaultsecretgroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_vaultsecretgroup.go deleted file mode 100644 index b37642bfa1d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_vaultsecretgroup.go +++ /dev/null @@ -1,6 +0,0 @@ -package nodetype - -type VaultSecretGroup struct { - SourceVault SubResource `json:"sourceVault"` - VaultCertificates []VaultCertificate `json:"vaultCertificates"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_vmssextension.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_vmssextension.go deleted file mode 100644 index 7949d519367..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/model_vmssextension.go +++ /dev/null @@ -1,6 +0,0 @@ -package nodetype - -type VMSSExtension struct { - Name string `json:"name"` - Properties VMSSExtensionProperties `json:"properties"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/predicates.go deleted file mode 100644 index 236b661a2a3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/predicates.go +++ /dev/null @@ -1,24 +0,0 @@ -package nodetype - -type NodeTypePredicate struct { - Id *string - Name *string - Type *string -} - -func (p NodeTypePredicate) Matches(input NodeType) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/version.go deleted file mode 100644 index bfe8c178947..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package nodetype - -import "fmt" - -const defaultApiVersion = "2021-05-01" - -func userAgent() string { - return fmt.Sprintf("pandora/nodetype/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go index 22e699c34d8..211f952581b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go @@ -10,11 +10,10 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -312,7 +311,7 @@ func (k ClusterResource) Create() sdk.ResourceFunc { } } - deleteResponses := make([]nodetype.DeleteResponse, 0) + deleteResponses := make([]nodetype.DeleteOperationResponse, 0) // Delete the old nodetypes for _, nt := range toDelete { resp, err := nodeTypeClient.Delete(ctx, nodetype.NewNodeTypeID(subscriptionId, model.ResourceGroup, model.Name, nt)) @@ -342,7 +341,7 @@ func (k ClusterResource) Create() sdk.ResourceFunc { } // Send all Create NodeType requests, and store all responses to a list. - nodeTypeResponses := make([]nodetype.CreateOrUpdateResponse, len(model.NodeTypes)) + nodeTypeResponses := make([]nodetype.CreateOrUpdateOperationResponse, len(model.NodeTypes)) for idx, nt := range model.NodeTypes { nodeTypeProperties, err := expandNodeTypeProperties(&nt) if err != nil { @@ -494,7 +493,7 @@ func (k ClusterResource) Update() sdk.ResourceFunc { } } - deleteResponses := make([]nodetype.DeleteResponse, 0) + deleteResponses := make([]nodetype.DeleteOperationResponse, 0) // Delete the old nodetypes for _, nt := range toDelete { resp, err := nodeTypeClient.Delete(ctx, nodetype.NewNodeTypeID(subscriptionId, model.ResourceGroup, model.Name, nt)) @@ -524,7 +523,7 @@ func (k ClusterResource) Update() sdk.ResourceFunc { } // Send all Create NodeType requests, and store all responses to a list. - nodeTypeResponses := make([]nodetype.CreateOrUpdateResponse, len(model.NodeTypes)) + nodeTypeResponses := make([]nodetype.CreateOrUpdateOperationResponse, len(model.NodeTypes)) for idx, nt := range model.NodeTypes { nodeTypeProperties, err := expandNodeTypeProperties(&nt) if err != nil { @@ -646,7 +645,7 @@ func (k ClusterResource) CustomizeDiff() sdk.ResourceFunc { } func (k ClusterResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return validate.ServiceFabricManagedClusterID + return managedcluster.ValidateManagedClusterID } func flattenClusterProperties(cluster *managedcluster.ManagedCluster) *ClusterResourceModel { @@ -680,6 +679,7 @@ func flattenClusterProperties(cluster *managedcluster.ManagedCluster) *ClusterRe model.Username = properties.AdminUserName if aad := properties.AzureActiveDirectory; aad != nil { + model.Authentication = append(model.Authentication, Authentication{}) adModel := ADAuthentication{} adModel.ClientApp = utils.NormalizeNilableString(aad.ClientApplication) adModel.ClusterApp = utils.NormalizeNilableString(aad.ClusterApplication) @@ -700,6 +700,9 @@ func flattenClusterProperties(cluster *managedcluster.ManagedCluster) *ClusterRe Thumbprint: utils.NormalizeNilableString(client.Thumbprint), } } + if len(model.Authentication) == 0 { + model.Authentication = append(model.Authentication, Authentication{}) + } model.Authentication[0].CertAuthentication = certs } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/validate/service_fabric_managed_cluster_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/validate/service_fabric_managed_cluster_id.go deleted file mode 100644 index ef8c9877a9e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/validate/service_fabric_managed_cluster_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/parse" -) - -func ServiceFabricManagedClusterID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ServiceFabricManagedClusterID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/client/client.go index 9b39383375b..b2bc565fce2 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/client/client.go @@ -2,14 +2,16 @@ package client import ( "github.com/Azure/azure-sdk-for-go/services/webpubsub/mgmt/2021-10-01/webpubsub" + "github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr" ) type Client struct { - SignalRClient *signalr.SignalRClient - WebPubsubClient *webpubsub.Client - WebPubsubHubsClient *webpubsub.HubsClient + SignalRClient *signalr.SignalRClient + WebPubsubClient *webpubsub.Client + WebPubsubHubsClient *webpubsub.HubsClient + WebPubsubSharedPrivateLinkResourceClient *webpubsub.SharedPrivateLinkResourcesClient + WebPubsubPrivateLinkedResourceClient *webpubsub.PrivateLinkResourcesClient } func NewClient(o *common.ClientOptions) *Client { @@ -22,9 +24,17 @@ func NewClient(o *common.ClientOptions) *Client { webpubsubHubsClient := webpubsub.NewHubsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&webpubsubHubsClient.Client, o.ResourceManagerAuthorizer) + webPubsubSharedPrivateLinkResourceClient := webpubsub.NewSharedPrivateLinkResourcesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&webPubsubSharedPrivateLinkResourceClient.Client, o.ResourceManagerAuthorizer) + + webPubsubPrivateLinkResourceClient := webpubsub.NewPrivateLinkResourcesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&webPubsubPrivateLinkResourceClient.Client, o.ResourceManagerAuthorizer) + return &Client{ - SignalRClient: &signalRClient, - WebPubsubClient: &webpubsubClient, - WebPubsubHubsClient: &webpubsubHubsClient, + SignalRClient: &signalRClient, + WebPubsubClient: &webpubsubClient, + WebPubsubHubsClient: &webpubsubHubsClient, + WebPubsubSharedPrivateLinkResourceClient: &webPubsubSharedPrivateLinkResourceClient, + WebPubsubPrivateLinkedResourceClient: &webPubsubPrivateLinkResourceClient, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/migration/network_acl_v0_to_v1.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/migration/network_acl_v0_to_v1.go index be5bd304455..501da6dda57 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/migration/network_acl_v0_to_v1.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/migration/network_acl_v0_to_v1.go @@ -5,7 +5,7 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr" + "github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/migration/service_v0_to_v1.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/migration/service_v0_to_v1.go index f11229b91db..968d1a52109 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/migration/service_v0_to_v1.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/migration/service_v0_to_v1.go @@ -5,7 +5,7 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr" + "github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse/web_pubsub.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse/web_pubsub.go index 5bfe2e5e64e..532d5b9462e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse/web_pubsub.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse/web_pubsub.go @@ -33,7 +33,7 @@ func (id WebPubsubId) String() string { } func (id WebPubsubId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/WebPubSub/%s" + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/webPubSub/%s" return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.WebPubSubName) } @@ -57,7 +57,7 @@ func WebPubsubID(input string) (*WebPubsubId, error) { return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") } - if resourceId.WebPubSubName, err = id.PopSegment("WebPubSub"); err != nil { + if resourceId.WebPubSubName, err = id.PopSegment("webPubSub"); err != nil { return nil, err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse/web_pubsub_hub.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse/web_pubsub_hub.go index 619a9ea8780..5550771b412 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse/web_pubsub_hub.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse/web_pubsub_hub.go @@ -36,7 +36,7 @@ func (id WebPubsubHubId) String() string { } func (id WebPubsubHubId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/WebPubSub/%s/hubs/%s" + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/webPubSub/%s/hubs/%s" return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.WebPubSubName, id.HubName) } @@ -60,7 +60,7 @@ func WebPubsubHubID(input string) (*WebPubsubHubId, error) { return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") } - if resourceId.WebPubSubName, err = id.PopSegment("WebPubSub"); err != nil { + if resourceId.WebPubSubName, err = id.PopSegment("webPubSub"); err != nil { return nil, err } if resourceId.HubName, err = id.PopSegment("hubs"); err != nil { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse/web_pubsub_shared_private_link_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse/web_pubsub_shared_private_link_resource.go new file mode 100644 index 00000000000..f96e7c776aa --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse/web_pubsub_shared_private_link_resource.go @@ -0,0 +1,75 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type WebPubsubSharedPrivateLinkResourceId struct { + SubscriptionId string + ResourceGroup string + WebPubSubName string + SharedPrivateLinkResourceName string +} + +func NewWebPubsubSharedPrivateLinkResourceID(subscriptionId, resourceGroup, webPubSubName, sharedPrivateLinkResourceName string) WebPubsubSharedPrivateLinkResourceId { + return WebPubsubSharedPrivateLinkResourceId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + WebPubSubName: webPubSubName, + SharedPrivateLinkResourceName: sharedPrivateLinkResourceName, + } +} + +func (id WebPubsubSharedPrivateLinkResourceId) String() string { + segments := []string{ + fmt.Sprintf("Shared Private Link Resource Name %q", id.SharedPrivateLinkResourceName), + fmt.Sprintf("Web Pub Sub Name %q", id.WebPubSubName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Web Pubsub Shared Private Link Resource", segmentsStr) +} + +func (id WebPubsubSharedPrivateLinkResourceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.SignalRService/webPubSub/%s/sharedPrivateLinkResources/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.WebPubSubName, id.SharedPrivateLinkResourceName) +} + +// WebPubsubSharedPrivateLinkResourceID parses a WebPubsubSharedPrivateLinkResource ID into an WebPubsubSharedPrivateLinkResourceId struct +func WebPubsubSharedPrivateLinkResourceID(input string) (*WebPubsubSharedPrivateLinkResourceId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := WebPubsubSharedPrivateLinkResourceId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.WebPubSubName, err = id.PopSegment("webPubSub"); err != nil { + return nil, err + } + if resourceId.SharedPrivateLinkResourceName, err = id.PopSegment("sharedPrivateLinkResources"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/registration.go index 66258f075de..85c2fb7586c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/registration.go @@ -29,18 +29,21 @@ func (r Registration) WebsiteCategories() []string { // SupportedDataSources returns the supported Data Sources supported by this Service func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ - "azurerm_signalr_service": dataSourceArmSignalRService(), - "azurerm_web_pubsub": dataSourceWebPubsub(), + "azurerm_signalr_service": dataSourceArmSignalRService(), + "azurerm_web_pubsub": dataSourceWebPubsub(), + "azurerm_web_pubsub_private_link_resource": dataSourceWebPubsubPrivateLinkResource(), } } // SupportedResources returns the supported Resources supported by this Service func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ - "azurerm_signalr_service": resourceArmSignalRService(), - "azurerm_signalr_service_network_acl": resourceArmSignalRServiceNetworkACL(), - "azurerm_web_pubsub": resourceWebPubSub(), - "azurerm_web_pubsub_hub": resourceWebPubsubHub(), - "azurerm_web_pubsub_network_acl": resourceWebpubsubNetworkACL(), + "azurerm_signalr_service": resourceArmSignalRService(), + "azurerm_signalr_service_network_acl": resourceArmSignalRServiceNetworkACL(), + "azurerm_signalr_shared_private_link_resource": resourceSignalRSharedPrivateLinkResource(), + "azurerm_web_pubsub": resourceWebPubSub(), + "azurerm_web_pubsub_hub": resourceWebPubsubHub(), + "azurerm_web_pubsub_network_acl": resourceWebpubsubNetworkACL(), + "azurerm_web_pubsub_shared_private_link_resource": resourceWebpubsubSharedPrivateLinkService(), } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/resourceids.go index fde5e518291..6e26df08a2d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/resourceids.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/resourceids.go @@ -1,4 +1,5 @@ package signalr -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=WebPubsub -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.SignalRService/WebPubSub/Webpubsub1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=WebPubsubHub -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.SignalRService/WebPubSub/Webpubsub1/hubs/Webpubsubhub1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=WebPubsub -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.SignalRService/webPubSub/Webpubsub1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=WebPubsubHub -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.SignalRService/webPubSub/Webpubsub1/hubs/Webpubsubhub1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=WebPubsubSharedPrivateLinkResource -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.SignalRService/webPubSub/Webpubsub1/sharedPrivateLinkResources/resource1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/client.go deleted file mode 100644 index 947e8b90857..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package signalr - -import "github.com/Azure/go-autorest/autorest" - -type SignalRClient struct { - Client autorest.Client - baseUri string -} - -func NewSignalRClientWithBaseURI(endpoint string) SignalRClient { - return SignalRClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/constants.go deleted file mode 100644 index f6a3fdc741d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/constants.go +++ /dev/null @@ -1,269 +0,0 @@ -package signalr - -import "strings" - -type ACLAction string - -const ( - ACLActionAllow ACLAction = "Allow" - ACLActionDeny ACLAction = "Deny" -) - -func PossibleValuesForACLAction() []string { - return []string{ - string(ACLActionAllow), - string(ACLActionDeny), - } -} - -func parseACLAction(input string) (*ACLAction, error) { - vals := map[string]ACLAction{ - "allow": ACLActionAllow, - "deny": ACLActionDeny, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ACLAction(input) - return &out, nil -} - -type FeatureFlags string - -const ( - FeatureFlagsEnableConnectivityLogs FeatureFlags = "EnableConnectivityLogs" - FeatureFlagsEnableMessagingLogs FeatureFlags = "EnableMessagingLogs" - FeatureFlagsServiceMode FeatureFlags = "ServiceMode" -) - -func PossibleValuesForFeatureFlags() []string { - return []string{ - string(FeatureFlagsEnableConnectivityLogs), - string(FeatureFlagsEnableMessagingLogs), - string(FeatureFlagsServiceMode), - } -} - -func parseFeatureFlags(input string) (*FeatureFlags, error) { - vals := map[string]FeatureFlags{ - "enableconnectivitylogs": FeatureFlagsEnableConnectivityLogs, - "enablemessaginglogs": FeatureFlagsEnableMessagingLogs, - "servicemode": FeatureFlagsServiceMode, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FeatureFlags(input) - return &out, nil -} - -type KeyType string - -const ( - KeyTypePrimary KeyType = "Primary" - KeyTypeSecondary KeyType = "Secondary" -) - -func PossibleValuesForKeyType() []string { - return []string{ - string(KeyTypePrimary), - string(KeyTypeSecondary), - } -} - -func parseKeyType(input string) (*KeyType, error) { - vals := map[string]KeyType{ - "primary": KeyTypePrimary, - "secondary": KeyTypeSecondary, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeyType(input) - return &out, nil -} - -type PrivateLinkServiceConnectionStatus string - -const ( - PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" - PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" - PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" - PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" -) - -func PossibleValuesForPrivateLinkServiceConnectionStatus() []string { - return []string{ - string(PrivateLinkServiceConnectionStatusApproved), - string(PrivateLinkServiceConnectionStatusDisconnected), - string(PrivateLinkServiceConnectionStatusPending), - string(PrivateLinkServiceConnectionStatusRejected), - } -} - -func parsePrivateLinkServiceConnectionStatus(input string) (*PrivateLinkServiceConnectionStatus, error) { - vals := map[string]PrivateLinkServiceConnectionStatus{ - "approved": PrivateLinkServiceConnectionStatusApproved, - "disconnected": PrivateLinkServiceConnectionStatusDisconnected, - "pending": PrivateLinkServiceConnectionStatusPending, - "rejected": PrivateLinkServiceConnectionStatusRejected, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PrivateLinkServiceConnectionStatus(input) - return &out, nil -} - -type ProvisioningState string - -const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateMoving ProvisioningState = "Moving" - ProvisioningStateRunning ProvisioningState = "Running" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUnknown ProvisioningState = "Unknown" - ProvisioningStateUpdating ProvisioningState = "Updating" -) - -func PossibleValuesForProvisioningState() []string { - return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), - string(ProvisioningStateDeleting), - string(ProvisioningStateFailed), - string(ProvisioningStateMoving), - string(ProvisioningStateRunning), - string(ProvisioningStateSucceeded), - string(ProvisioningStateUnknown), - string(ProvisioningStateUpdating), - } -} - -func parseProvisioningState(input string) (*ProvisioningState, error) { - vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, - "deleting": ProvisioningStateDeleting, - "failed": ProvisioningStateFailed, - "moving": ProvisioningStateMoving, - "running": ProvisioningStateRunning, - "succeeded": ProvisioningStateSucceeded, - "unknown": ProvisioningStateUnknown, - "updating": ProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProvisioningState(input) - return &out, nil -} - -type ServiceKind string - -const ( - ServiceKindRawWebSockets ServiceKind = "RawWebSockets" - ServiceKindSignalR ServiceKind = "SignalR" -) - -func PossibleValuesForServiceKind() []string { - return []string{ - string(ServiceKindRawWebSockets), - string(ServiceKindSignalR), - } -} - -func parseServiceKind(input string) (*ServiceKind, error) { - vals := map[string]ServiceKind{ - "rawwebsockets": ServiceKindRawWebSockets, - "signalr": ServiceKindSignalR, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceKind(input) - return &out, nil -} - -type SignalRRequestType string - -const ( - SignalRRequestTypeClientConnection SignalRRequestType = "ClientConnection" - SignalRRequestTypeRESTAPI SignalRRequestType = "RESTAPI" - SignalRRequestTypeServerConnection SignalRRequestType = "ServerConnection" - SignalRRequestTypeTrace SignalRRequestType = "Trace" -) - -func PossibleValuesForSignalRRequestType() []string { - return []string{ - string(SignalRRequestTypeClientConnection), - string(SignalRRequestTypeRESTAPI), - string(SignalRRequestTypeServerConnection), - string(SignalRRequestTypeTrace), - } -} - -func parseSignalRRequestType(input string) (*SignalRRequestType, error) { - vals := map[string]SignalRRequestType{ - "clientconnection": SignalRRequestTypeClientConnection, - "restapi": SignalRRequestTypeRESTAPI, - "serverconnection": SignalRRequestTypeServerConnection, - "trace": SignalRRequestTypeTrace, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SignalRRequestType(input) - return &out, nil -} - -type SignalRSkuTier string - -const ( - SignalRSkuTierBasic SignalRSkuTier = "Basic" - SignalRSkuTierFree SignalRSkuTier = "Free" - SignalRSkuTierPremium SignalRSkuTier = "Premium" - SignalRSkuTierStandard SignalRSkuTier = "Standard" -) - -func PossibleValuesForSignalRSkuTier() []string { - return []string{ - string(SignalRSkuTierBasic), - string(SignalRSkuTierFree), - string(SignalRSkuTierPremium), - string(SignalRSkuTierStandard), - } -} - -func parseSignalRSkuTier(input string) (*SignalRSkuTier, error) { - vals := map[string]SignalRSkuTier{ - "basic": SignalRSkuTierBasic, - "free": SignalRSkuTierFree, - "premium": SignalRSkuTierPremium, - "standard": SignalRSkuTierStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SignalRSkuTier(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/id_location.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/id_location.go deleted file mode 100644 index d26267c3824..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/id_location.go +++ /dev/null @@ -1,111 +0,0 @@ -package signalr - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = LocationId{} - -// LocationId is a struct representing the Resource ID for a Location -type LocationId struct { - SubscriptionId string - Location string -} - -// NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, location string) LocationId { - return LocationId{ - SubscriptionId: subscriptionId, - Location: location, - } -} - -// ParseLocationID parses 'input' into a LocationId -func ParseLocationID(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId -// note: this method should only be used for API response data and not user input -func ParseLocationIDInsensitively(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.Location, ok = parsed.Parsed["location"]; !ok { - return nil, fmt.Errorf("the segment 'location' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateLocationID checks that 'input' can be parsed as a Location ID -func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseLocationID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Location ID -func (id LocationId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.SignalRService/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.Location) -} - -// Segments returns a slice of Resource ID Segments which comprise this Location ID -func (id LocationId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("providers", "providers", "providers"), - resourceids.ResourceProviderSegment("microsoftSignalRService", "Microsoft.SignalRService", "Microsoft.SignalRService"), - resourceids.StaticSegment("locations", "locations", "locations"), - resourceids.UserSpecifiedSegment("location", "locationValue"), - } -} - -// String returns a human-readable description of this Location ID -func (id LocationId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location: %q", id.Location), - } - return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/id_resourcegroup.go deleted file mode 100644 index 389d4913232..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package signalr - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("resourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/id_subscription.go deleted file mode 100644 index 6b09c60b369..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package signalr - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("subscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_checknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_checknameavailability_autorest.go deleted file mode 100644 index 7174f1912a1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_checknameavailability_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package signalr - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CheckNameAvailabilityResponse struct { - HttpResponse *http.Response - Model *NameAvailability -} - -// CheckNameAvailability ... -func (c SignalRClient) CheckNameAvailability(ctx context.Context, id LocationId, input NameAvailabilityParameters) (result CheckNameAvailabilityResponse, err error) { - req, err := c.preparerForCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCheckNameAvailability prepares the CheckNameAvailability request. -func (c SignalRClient) preparerForCheckNameAvailability(ctx context.Context, id LocationId, input NameAvailabilityParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/checkNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (c SignalRClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_createorupdate_autorest.go deleted file mode 100644 index 5d39d5f9472..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_createorupdate_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package signalr - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateOrUpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c SignalRClient) CreateOrUpdate(ctx context.Context, id SignalRId, input SignalRResource) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c SignalRClient) CreateOrUpdateThenPoll(ctx context.Context, id SignalRId, input SignalRResource) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c SignalRClient) preparerForCreateOrUpdate(ctx context.Context, id SignalRId, input SignalRResource) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c SignalRClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_delete_autorest.go deleted file mode 100644 index 6ca23b616fd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_delete_autorest.go +++ /dev/null @@ -1,73 +0,0 @@ -package signalr - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c SignalRClient) Delete(ctx context.Context, id SignalRId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c SignalRClient) DeleteThenPoll(ctx context.Context, id SignalRId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c SignalRClient) preparerForDelete(ctx context.Context, id SignalRId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c SignalRClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_get_autorest.go deleted file mode 100644 index ddd8202fe62..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package signalr - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *SignalRResource -} - -// Get ... -func (c SignalRClient) Get(ctx context.Context, id SignalRId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c SignalRClient) preparerForGet(ctx context.Context, id SignalRId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c SignalRClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_listbyresourcegroup_autorest.go deleted file mode 100644 index f7428dc3c56..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package signalr - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *[]SignalRResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByResourceGroupResponse, error) -} - -type ListByResourceGroupCompleteResult struct { - Items []SignalRResource -} - -func (r ListByResourceGroupResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByResourceGroupResponse) LoadMore(ctx context.Context) (resp ListByResourceGroupResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListByResourceGroup ... -func (c SignalRClient) ListByResourceGroup(ctx context.Context, id ResourceGroupId) (resp ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListByResourceGroup", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByResourceGroup(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListByResourceGroup", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListByResourceGroupComplete retrieves all of the results into a single object -func (c SignalRClient) ListByResourceGroupComplete(ctx context.Context, id ResourceGroupId) (ListByResourceGroupCompleteResult, error) { - return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, SignalRResourcePredicate{}) -} - -// ListByResourceGroupCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SignalRClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate SignalRResourcePredicate) (resp ListByResourceGroupCompleteResult, err error) { - items := make([]SignalRResource, 0) - - page, err := c.ListByResourceGroup(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByResourceGroupCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c SignalRClient) preparerForListByResourceGroup(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.SignalRService/signalR", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByResourceGroupWithNextLink prepares the ListByResourceGroup request with the given nextLink token. -func (c SignalRClient) preparerForListByResourceGroupWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c SignalRClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - type page struct { - Values []SignalRResource `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroupWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_listbysubscription_autorest.go deleted file mode 100644 index 405bb779048..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_listbysubscription_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package signalr - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListBySubscriptionResponse struct { - HttpResponse *http.Response - Model *[]SignalRResource - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListBySubscriptionResponse, error) -} - -type ListBySubscriptionCompleteResult struct { - Items []SignalRResource -} - -func (r ListBySubscriptionResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListBySubscriptionResponse) LoadMore(ctx context.Context) (resp ListBySubscriptionResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// ListBySubscription ... -func (c SignalRClient) ListBySubscription(ctx context.Context, id SubscriptionId) (resp ListBySubscriptionResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListBySubscription", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListBySubscription(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListBySubscription", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListBySubscriptionComplete retrieves all of the results into a single object -func (c SignalRClient) ListBySubscriptionComplete(ctx context.Context, id SubscriptionId) (ListBySubscriptionCompleteResult, error) { - return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, SignalRResourcePredicate{}) -} - -// ListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SignalRClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id SubscriptionId, predicate SignalRResourcePredicate) (resp ListBySubscriptionCompleteResult, err error) { - items := make([]SignalRResource, 0) - - page, err := c.ListBySubscription(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListBySubscriptionCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c SignalRClient) preparerForListBySubscription(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.SignalRService/signalR", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListBySubscriptionWithNextLink prepares the ListBySubscription request with the given nextLink token. -func (c SignalRClient) preparerForListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListBySubscription handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (c SignalRClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionResponse, err error) { - type page struct { - Values []SignalRResource `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListBySubscriptionResponse, err error) { - req, err := c.preparerForListBySubscriptionWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_listkeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_listkeys_autorest.go deleted file mode 100644 index 02f10f80fef..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_listkeys_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package signalr - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListKeysResponse struct { - HttpResponse *http.Response - Model *SignalRKeys -} - -// ListKeys ... -func (c SignalRClient) ListKeys(ctx context.Context, id SignalRId) (result ListKeysResponse, err error) { - req, err := c.preparerForListKeys(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "ListKeys", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListKeys prepares the ListKeys request. -func (c SignalRClient) preparerForListKeys(ctx context.Context, id SignalRId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listKeys", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListKeys handles the response to the ListKeys request. The method always -// closes the http.Response Body. -func (c SignalRClient) responderForListKeys(resp *http.Response) (result ListKeysResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_regeneratekey_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_regeneratekey_autorest.go deleted file mode 100644 index f0ea2f78bbf..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_regeneratekey_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package signalr - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type RegenerateKeyResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// RegenerateKey ... -func (c SignalRClient) RegenerateKey(ctx context.Context, id SignalRId, input RegenerateKeyParameters) (result RegenerateKeyResponse, err error) { - req, err := c.preparerForRegenerateKey(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "RegenerateKey", nil, "Failure preparing request") - return - } - - result, err = c.senderForRegenerateKey(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "RegenerateKey", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RegenerateKeyThenPoll performs RegenerateKey then polls until it's completed -func (c SignalRClient) RegenerateKeyThenPoll(ctx context.Context, id SignalRId, input RegenerateKeyParameters) error { - result, err := c.RegenerateKey(ctx, id, input) - if err != nil { - return fmt.Errorf("performing RegenerateKey: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after RegenerateKey: %+v", err) - } - - return nil -} - -// preparerForRegenerateKey prepares the RegenerateKey request. -func (c SignalRClient) preparerForRegenerateKey(ctx context.Context, id SignalRId, input RegenerateKeyParameters) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/regenerateKey", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRegenerateKey sends the RegenerateKey request. The method will close the -// http.Response Body if it receives an error. -func (c SignalRClient) senderForRegenerateKey(ctx context.Context, req *http.Request) (future RegenerateKeyResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_restart_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_restart_autorest.go deleted file mode 100644 index 80a04076dbc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_restart_autorest.go +++ /dev/null @@ -1,74 +0,0 @@ -package signalr - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type RestartResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Restart ... -func (c SignalRClient) Restart(ctx context.Context, id SignalRId) (result RestartResponse, err error) { - req, err := c.preparerForRestart(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Restart", nil, "Failure preparing request") - return - } - - result, err = c.senderForRestart(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Restart", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// RestartThenPoll performs Restart then polls until it's completed -func (c SignalRClient) RestartThenPoll(ctx context.Context, id SignalRId) error { - result, err := c.Restart(ctx, id) - if err != nil { - return fmt.Errorf("performing Restart: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Restart: %+v", err) - } - - return nil -} - -// preparerForRestart prepares the Restart request. -func (c SignalRClient) preparerForRestart(ctx context.Context, id SignalRId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/restart", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForRestart sends the Restart request. The method will close the -// http.Response Body if it receives an error. -func (c SignalRClient) senderForRestart(ctx context.Context, req *http.Request) (future RestartResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_update_autorest.go deleted file mode 100644 index 786ac49490a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_update_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package signalr - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type UpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c SignalRClient) Update(ctx context.Context, id SignalRId, input SignalRResource) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c SignalRClient) UpdateThenPoll(ctx context.Context, id SignalRId, input SignalRResource) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c SignalRClient) preparerForUpdate(ctx context.Context, id SignalRId, input SignalRResource) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c SignalRClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_usageslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_usageslist_autorest.go deleted file mode 100644 index 93c7cacb731..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/method_usageslist_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package signalr - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UsagesListResponse struct { - HttpResponse *http.Response - Model *[]SignalRUsage - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (UsagesListResponse, error) -} - -type UsagesListCompleteResult struct { - Items []SignalRUsage -} - -func (r UsagesListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r UsagesListResponse) LoadMore(ctx context.Context) (resp UsagesListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// UsagesList ... -func (c SignalRClient) UsagesList(ctx context.Context, id LocationId) (resp UsagesListResponse, err error) { - req, err := c.preparerForUsagesList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "UsagesList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "UsagesList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForUsagesList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "UsagesList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// UsagesListComplete retrieves all of the results into a single object -func (c SignalRClient) UsagesListComplete(ctx context.Context, id LocationId) (UsagesListCompleteResult, error) { - return c.UsagesListCompleteMatchingPredicate(ctx, id, SignalRUsagePredicate{}) -} - -// UsagesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c SignalRClient) UsagesListCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate SignalRUsagePredicate) (resp UsagesListCompleteResult, err error) { - items := make([]SignalRUsage, 0) - - page, err := c.UsagesList(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := UsagesListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForUsagesList prepares the UsagesList request. -func (c SignalRClient) preparerForUsagesList(ctx context.Context, id LocationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/usages", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForUsagesListWithNextLink prepares the UsagesList request with the given nextLink token. -func (c SignalRClient) preparerForUsagesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUsagesList handles the response to the UsagesList request. The method always -// closes the http.Response Body. -func (c SignalRClient) responderForUsagesList(resp *http.Response) (result UsagesListResponse, err error) { - type page struct { - Values []SignalRUsage `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result UsagesListResponse, err error) { - req, err := c.preparerForUsagesListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "UsagesList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "UsagesList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUsagesList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "signalr.SignalRClient", "UsagesList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_nameavailability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_nameavailability.go deleted file mode 100644 index 5c76895b55c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_nameavailability.go +++ /dev/null @@ -1,7 +0,0 @@ -package signalr - -type NameAvailability struct { - Message *string `json:"message,omitempty"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason *string `json:"reason,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_nameavailabilityparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_nameavailabilityparameters.go deleted file mode 100644 index d1f4cff95c7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_nameavailabilityparameters.go +++ /dev/null @@ -1,6 +0,0 @@ -package signalr - -type NameAvailabilityParameters struct { - Name string `json:"name"` - Type string `json:"type"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_networkacl.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_networkacl.go deleted file mode 100644 index a3b117296ab..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_networkacl.go +++ /dev/null @@ -1,6 +0,0 @@ -package signalr - -type NetworkACL struct { - Allow *[]SignalRRequestType `json:"allow,omitempty"` - Deny *[]SignalRRequestType `json:"deny,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privateendpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privateendpoint.go deleted file mode 100644 index 6092ba29e46..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privateendpoint.go +++ /dev/null @@ -1,5 +0,0 @@ -package signalr - -type PrivateEndpoint struct { - Id *string `json:"id,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privateendpointacl.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privateendpointacl.go deleted file mode 100644 index 09ac3647f05..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privateendpointacl.go +++ /dev/null @@ -1,7 +0,0 @@ -package signalr - -type PrivateEndpointACL struct { - Allow *[]SignalRRequestType `json:"allow,omitempty"` - Deny *[]SignalRRequestType `json:"deny,omitempty"` - Name string `json:"name"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privateendpointconnection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privateendpointconnection.go deleted file mode 100644 index b11e4ada71b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privateendpointconnection.go +++ /dev/null @@ -1,8 +0,0 @@ -package signalr - -type PrivateEndpointConnection struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privateendpointconnectionproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privateendpointconnectionproperties.go deleted file mode 100644 index c2ccb7b56ae..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privateendpointconnectionproperties.go +++ /dev/null @@ -1,7 +0,0 @@ -package signalr - -type PrivateEndpointConnectionProperties struct { - PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privatelinkresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privatelinkresource.go deleted file mode 100644 index 9b9be0c680c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privatelinkresource.go +++ /dev/null @@ -1,8 +0,0 @@ -package signalr - -type PrivateLinkResource struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privatelinkresourceproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privatelinkresourceproperties.go deleted file mode 100644 index 22234435294..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privatelinkresourceproperties.go +++ /dev/null @@ -1,7 +0,0 @@ -package signalr - -type PrivateLinkResourceProperties struct { - GroupId *string `json:"groupId,omitempty"` - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privatelinkserviceconnectionstate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privatelinkserviceconnectionstate.go deleted file mode 100644 index 66f28884f49..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_privatelinkserviceconnectionstate.go +++ /dev/null @@ -1,7 +0,0 @@ -package signalr - -type PrivateLinkServiceConnectionState struct { - ActionsRequired *string `json:"actionsRequired,omitempty"` - Description *string `json:"description,omitempty"` - Status *PrivateLinkServiceConnectionStatus `json:"status,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_regeneratekeyparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_regeneratekeyparameters.go deleted file mode 100644 index ed5892f3190..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_regeneratekeyparameters.go +++ /dev/null @@ -1,5 +0,0 @@ -package signalr - -type RegenerateKeyParameters struct { - KeyType *KeyType `json:"keyType,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_resourcesku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_resourcesku.go deleted file mode 100644 index b36582a9dfc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_resourcesku.go +++ /dev/null @@ -1,9 +0,0 @@ -package signalr - -type ResourceSku struct { - Capacity *int64 `json:"capacity,omitempty"` - Family *string `json:"family,omitempty"` - Name string `json:"name"` - Size *string `json:"size,omitempty"` - Tier *SignalRSkuTier `json:"tier,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_serverlessupstreamsettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_serverlessupstreamsettings.go deleted file mode 100644 index 35def0c34a3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_serverlessupstreamsettings.go +++ /dev/null @@ -1,5 +0,0 @@ -package signalr - -type ServerlessUpstreamSettings struct { - Templates *[]UpstreamTemplate `json:"templates,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrcorssettings.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrcorssettings.go deleted file mode 100644 index 3525e6670e7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrcorssettings.go +++ /dev/null @@ -1,5 +0,0 @@ -package signalr - -type SignalRCorsSettings struct { - AllowedOrigins *[]string `json:"allowedOrigins,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrfeature.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrfeature.go deleted file mode 100644 index c82f161ffa8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrfeature.go +++ /dev/null @@ -1,7 +0,0 @@ -package signalr - -type SignalRFeature struct { - Flag FeatureFlags `json:"flag"` - Properties *map[string]string `json:"properties,omitempty"` - Value string `json:"value"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrkeys.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrkeys.go deleted file mode 100644 index 84b347511db..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrkeys.go +++ /dev/null @@ -1,8 +0,0 @@ -package signalr - -type SignalRKeys struct { - PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` - PrimaryKey *string `json:"primaryKey,omitempty"` - SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` - SecondaryKey *string `json:"secondaryKey,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrnetworkacls.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrnetworkacls.go deleted file mode 100644 index bf85d1c39d6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrnetworkacls.go +++ /dev/null @@ -1,7 +0,0 @@ -package signalr - -type SignalRNetworkACLs struct { - DefaultAction *ACLAction `json:"defaultAction,omitempty"` - PrivateEndpoints *[]PrivateEndpointACL `json:"privateEndpoints,omitempty"` - PublicNetwork *NetworkACL `json:"publicNetwork,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrproperties.go deleted file mode 100644 index 84548ef785a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrproperties.go +++ /dev/null @@ -1,16 +0,0 @@ -package signalr - -type SignalRProperties struct { - Cors *SignalRCorsSettings `json:"cors,omitempty"` - ExternalIP *string `json:"externalIP,omitempty"` - Features *[]SignalRFeature `json:"features,omitempty"` - HostName *string `json:"hostName,omitempty"` - HostNamePrefix *string `json:"hostNamePrefix,omitempty"` - NetworkACLs *SignalRNetworkACLs `json:"networkACLs,omitempty"` - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` - PublicPort *int64 `json:"publicPort,omitempty"` - ServerPort *int64 `json:"serverPort,omitempty"` - Upstream *ServerlessUpstreamSettings `json:"upstream,omitempty"` - Version *string `json:"version,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrresource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrresource.go deleted file mode 100644 index 9165eed09f1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrresource.go +++ /dev/null @@ -1,12 +0,0 @@ -package signalr - -type SignalRResource struct { - Id *string `json:"id,omitempty"` - Kind *ServiceKind `json:"kind,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SignalRProperties `json:"properties,omitempty"` - Sku *ResourceSku `json:"sku,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrusage.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrusage.go deleted file mode 100644 index 6e83cb0b55e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrusage.go +++ /dev/null @@ -1,9 +0,0 @@ -package signalr - -type SignalRUsage struct { - CurrentValue *int64 `json:"currentValue,omitempty"` - Id *string `json:"id,omitempty"` - Limit *int64 `json:"limit,omitempty"` - Name *SignalRUsageName `json:"name,omitempty"` - Unit *string `json:"unit,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrusagename.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrusagename.go deleted file mode 100644 index e945c382bf4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_signalrusagename.go +++ /dev/null @@ -1,6 +0,0 @@ -package signalr - -type SignalRUsageName struct { - LocalizedValue *string `json:"localizedValue,omitempty"` - Value *string `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_upstreamtemplate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_upstreamtemplate.go deleted file mode 100644 index 43b6ef697bd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/model_upstreamtemplate.go +++ /dev/null @@ -1,8 +0,0 @@ -package signalr - -type UpstreamTemplate struct { - CategoryPattern *string `json:"categoryPattern,omitempty"` - EventPattern *string `json:"eventPattern,omitempty"` - HubPattern *string `json:"hubPattern,omitempty"` - UrlTemplate string `json:"urlTemplate"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/predicates.go deleted file mode 100644 index b5ff818357a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/predicates.go +++ /dev/null @@ -1,80 +0,0 @@ -package signalr - -type PrivateLinkResourcePredicate struct { - Id *string - Name *string - Type *string -} - -func (p PrivateLinkResourcePredicate) Matches(input PrivateLinkResource) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} - -type SignalRResourcePredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p SignalRResourcePredicate) Matches(input SignalRResource) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} - -type SignalRUsagePredicate struct { - CurrentValue *int64 - Id *string - Limit *int64 - Unit *string -} - -func (p SignalRUsagePredicate) Matches(input SignalRUsage) bool { - - if p.CurrentValue != nil && (input.CurrentValue == nil && *p.CurrentValue != *input.CurrentValue) { - return false - } - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Limit != nil && (input.Limit == nil && *p.Limit != *input.Limit) { - return false - } - - if p.Unit != nil && (input.Unit == nil && *p.Unit != *input.Unit) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/version.go deleted file mode 100644 index f86bfcf151b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package signalr - -import "fmt" - -const defaultApiVersion = "2020-05-01" - -func userAgent() string { - return fmt.Sprintf("pandora/signalr/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/signalr_service_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/signalr_service_data_source.go index 92d2ade7a45..2ab75c7b3f4 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/signalr_service_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/signalr_service_data_source.go @@ -8,8 +8,8 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/signalr_service_network_acl_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/signalr_service_network_acl_resource.go index ab6f5011201..b770192bc3e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/signalr_service_network_acl_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/signalr_service_network_acl_resource.go @@ -5,11 +5,11 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -197,6 +197,9 @@ func resourceSignalRServiceNetworkACLCreateUpdate(d *pluginsdk.ResourceData, met model.Properties.NetworkACLs = &networkACL } + // todo remove this when https://github.com/hashicorp/pandora/issues/1096 is fixed + model.SystemData = nil + if err := client.UpdateThenPoll(ctx, *id, model); err != nil { return fmt.Errorf("creating/updating NetworkACL for %s: %v", id, err) } @@ -299,6 +302,9 @@ func resourceSignalRServiceNetworkACLDelete(d *pluginsdk.ResourceData, meta inte model.Properties.NetworkACLs = networkACL } + // todo remove this when https://github.com/hashicorp/pandora/issues/1096 is fixed + model.SystemData = nil + if err := client.UpdateThenPoll(ctx, *id, model); err != nil { return fmt.Errorf("resetting the default Network ACL configuration for %s: %+v", *id, err) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/signalr_service_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/signalr_service_resource.go index 96d60beae93..5b933d64184 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/signalr_service_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/signalr_service_resource.go @@ -11,11 +11,12 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr" signalrValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -106,9 +107,10 @@ func resourceArmSignalRServiceCreate(d *pluginsdk.ResourceData, meta interface{} resourceType := signalr.SignalRResource{ Location: utils.String(location), Properties: &signalr.SignalRProperties{ - Cors: expandSignalRCors(cors), - Features: &expandedFeatures, - Upstream: expandUpstreamSettings(upstreamSettings), + Cors: expandSignalRCors(cors), + Features: &expandedFeatures, + Upstream: expandUpstreamSettings(upstreamSettings), + LiveTraceConfiguration: expandSignalRLiveTraceConfig(d.Get("live_trace").([]interface{})), }, Sku: expandSignalRServiceSku(sku), Tags: tags.Expand(d.Get("tags").(map[string]interface{})), @@ -195,6 +197,10 @@ func resourceArmSignalRServiceRead(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("setting `upstream_endpoint`: %+v", err) } + if err := d.Set("live_trace", flattenSignalRLiveTraceConfig(props.LiveTraceConfiguration)); err != nil { + return fmt.Errorf("setting `live_trace`:%+v", err) + } + if err := tags.FlattenAndSet(d, model.Tags); err != nil { return err } @@ -223,7 +229,7 @@ func resourceArmSignalRServiceUpdate(d *pluginsdk.ResourceData, meta interface{} resourceType := signalr.SignalRResource{} - if d.HasChanges("cors", "features", "upstream_endpoint", "connectivity_logs_enabled", "messaging_logs_enabled", "service_mode", "live_trace_enabled") { + if d.HasChanges("cors", "features", "upstream_endpoint", "connectivity_logs_enabled", "messaging_logs_enabled", "service_mode", "live_trace_enabled", "live_trace") { resourceType.Properties = &signalr.SignalRProperties{} if d.HasChange("cors") { @@ -231,6 +237,10 @@ func resourceArmSignalRServiceUpdate(d *pluginsdk.ResourceData, meta interface{} resourceType.Properties.Cors = expandSignalRCors(corsRaw) } + if d.HasChange("live_trace") { + resourceType.Properties.LiveTraceConfiguration = expandSignalRLiveTraceConfig(d.Get("live_trace").([]interface{})) + } + if d.HasChanges("connectivity_logs_enabled", "messaging_logs_enabled", "service_mode", "live_trace_enabled") { features := make([]signalr.SignalRFeature, 0) if d.HasChange("connectivity_logs_enabled") { @@ -457,6 +467,101 @@ func flattenSignalRServiceSku(input *signalr.ResourceSku) []interface{} { } } +func expandSignalRLiveTraceConfig(input []interface{}) *signalr.LiveTraceConfiguration { + resourceCategories := make([]signalr.LiveTraceCategory, 0) + if len(input) == 0 || input[0] == nil { + return nil + } + + v := input[0].(map[string]interface{}) + + enabled := "false" + if v["enabled"].(bool) { + enabled = "true" + } + + messageLogEnabled := "false" + if v["messaging_logs_enabled"].(bool) { + messageLogEnabled = "true" + } + resourceCategories = append(resourceCategories, signalr.LiveTraceCategory{ + Name: utils.String("MessagingLogs"), + Enabled: utils.String(messageLogEnabled), + }) + + connectivityLogEnabled := "false" + if v["connectivity_logs_enabled"].(bool) { + connectivityLogEnabled = "true" + } + resourceCategories = append(resourceCategories, signalr.LiveTraceCategory{ + Name: utils.String("ConnectivityLogs"), + Enabled: utils.String(connectivityLogEnabled), + }) + + httpLogEnabled := "false" + if v["http_request_logs_enabled"].(bool) { + httpLogEnabled = "true" + } + resourceCategories = append(resourceCategories, signalr.LiveTraceCategory{ + Name: utils.String("HttpRequestLogs"), + Enabled: utils.String(httpLogEnabled), + }) + + return &signalr.LiveTraceConfiguration{ + Enabled: &enabled, + Categories: &resourceCategories, + } +} + +func flattenSignalRLiveTraceConfig(input *signalr.LiveTraceConfiguration) []interface{} { + result := make([]interface{}, 0) + if input == nil { + return result + } + + var enabled bool + if input.Enabled != nil { + enabled = strings.EqualFold(*input.Enabled, "true") + } + + var ( + messagingLogEnabled bool + connectivityLogEnabled bool + httpLogsEnabled bool + ) + + if input.Categories != nil { + for _, item := range *input.Categories { + name := "" + if item.Name != nil { + name = *item.Name + } + + var cateEnabled string + if item.Enabled != nil { + cateEnabled = *item.Enabled + } + + switch name { + case "MessagingLogs": + messagingLogEnabled = strings.EqualFold(cateEnabled, "true") + case "ConnectivityLogs": + connectivityLogEnabled = strings.EqualFold(cateEnabled, "true") + case "HttpRequestLogs": + httpLogsEnabled = strings.EqualFold(cateEnabled, "true") + default: + continue + } + } + } + return []interface{}{map[string]interface{}{ + "enabled": enabled, + "messaging_logs_enabled": messagingLogEnabled, + "connectivity_logs_enabled": connectivityLogEnabled, + "http_request_logs_enabled": httpLogsEnabled, + }} +} + func resourceArmSignalRServiceSchema() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ "name": { @@ -508,9 +613,43 @@ func resourceArmSignalRServiceSchema() map[string]*pluginsdk.Schema { }, "live_trace_enabled": { - Type: pluginsdk.TypeBool, + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + Deprecated: "`live_trace_enabled` has been deprecated in favor of `live_trace` and will be removed in 4.0.", + }, + + "live_trace": { + Type: pluginsdk.TypeList, Optional: true, - Default: false, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + + "connectivity_logs_enabled": { + Type: pluginsdk.TypeBool, + Default: true, + Optional: true, + }, + + "messaging_logs_enabled": { + Type: pluginsdk.TypeBool, + Default: true, + Optional: true, + }, + + "http_request_logs_enabled": { + Type: pluginsdk.TypeBool, + Default: true, + Optional: true, + }, + }, + }, }, "service_mode": { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/signalr_shared_private_link_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/signalr_shared_private_link_resource.go new file mode 100644 index 00000000000..683154a89ce --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/signalr_shared_private_link_resource.go @@ -0,0 +1,177 @@ +package signalr + +import ( + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceSignalRSharedPrivateLinkResource() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceSignalRSharedPrivateLinkCreateUpdate, + Read: resourceSignalRSharedPrivateLinkRead, + Update: resourceSignalRSharedPrivateLinkCreateUpdate, + Delete: resourceSignalrSharedPrivateLinkDelete, + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Update: pluginsdk.DefaultTimeout(30 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := signalr.ParseSharedPrivateLinkResourceIDInsensitively(id) + return err + }), + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "signalr_service_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: signalr.ValidateSignalRID, + }, + + "sub_resource_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: networkValidate.PrivateLinkSubResourceName, + }, + + "target_resource_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: azure.ValidateResourceID, + }, + + "request_message": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "status": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + } +} + +func resourceSignalRSharedPrivateLinkCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).SignalR.SignalRClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + signalrID, err := signalr.ParseSignalRID(d.Get("signalr_service_id").(string)) + if err != nil { + return fmt.Errorf("parsing ID of %s: %+v", signalrID, err) + } + + id := signalr.NewSharedPrivateLinkResourceID(subscriptionId, signalrID.ResourceGroupName, signalrID.ResourceName, d.Get("name").(string)) + if d.IsNewResource() { + existing, err := client.SharedPrivateLinkResourcesGet(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %q: %+v", id, err) + } + } + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_signalr_shared_private_link_resource", id.ID()) + } + } + + parameters := signalr.SharedPrivateLinkResource{ + Properties: &signalr.SharedPrivateLinkResourceProperties{ + GroupId: d.Get("sub_resource_name").(string), + PrivateLinkResourceId: d.Get("target_resource_id").(string), + }, + } + + requestMessage := d.Get("request_message").(string) + if requestMessage != "" { + parameters.Properties.RequestMessage = utils.String(requestMessage) + } + + if err := client.SharedPrivateLinkResourcesCreateOrUpdateThenPoll(ctx, id, parameters); err != nil { + return fmt.Errorf("creating the shared private link for signalr %s: %+v", id, err) + } + + d.SetId(id.ID()) + return resourceSignalRSharedPrivateLinkRead(d, meta) +} + +func resourceSignalRSharedPrivateLinkRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).SignalR.SignalRClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := signalr.ParseSharedPrivateLinkResourceID(d.Id()) + if err != nil { + return err + } + + resp, err := client.SharedPrivateLinkResourcesGet(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + d.SetId("") + return fmt.Errorf("%s was not found", id) + } + return fmt.Errorf("retrieving shared private link %s: %+v", id, err) + } + + if model := resp.Model; model != nil { + d.Set("name", model.Name) + d.Set("signalr_service_id", signalr.NewSignalRID(id.SubscriptionId, id.ResourceGroupName, id.ResourceName).ID()) + + if props := model.Properties; props != nil { + d.Set("sub_resource_name", props.GroupId) + d.Set("target_resource_id", props.PrivateLinkResourceId) + + if props.RequestMessage != nil { + d.Set("request_message", props.RequestMessage) + } + + status := string(*props.Status) + d.Set("status", status) + } + } + return nil +} + +func resourceSignalrSharedPrivateLinkDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).SignalR.SignalRClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := signalr.ParseSharedPrivateLinkResourceIDInsensitively(d.Id()) + if err != nil { + return err + } + + if err := client.SharedPrivateLinkResourcesDeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/validate/web_pubsub_shared_private_link_resource_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/validate/web_pubsub_shared_private_link_resource_id.go new file mode 100644 index 00000000000..c3254d22ec0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/validate/web_pubsub_shared_private_link_resource_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse" +) + +func WebPubsubSharedPrivateLinkResourceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.WebPubsubSharedPrivateLinkResourceID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/web_pubsub_hub_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/web_pubsub_hub_resource.go index 2e35deb0870..18ad04406fb 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/web_pubsub_hub_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/web_pubsub_hub_resource.go @@ -7,9 +7,9 @@ import ( "github.com/Azure/azure-sdk-for-go/services/webpubsub/mgmt/2021-10-01/webpubsub" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - identityValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -94,7 +94,7 @@ func resourceWebPubsubHub() *pluginsdk.Resource { Required: true, ValidateFunc: validation.Any( validation.IsUUID, - identityValidate.UserAssignedIdentityID, + commonids.ValidateUserAssignedIdentityID, ), }, }, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/web_pubsub_private_linked_service_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/web_pubsub_private_linked_service_data_source.go new file mode 100644 index 00000000000..76c24b41d57 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/web_pubsub_private_linked_service_data_source.go @@ -0,0 +1,95 @@ +package signalr + +import ( + "fmt" + "time" + + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" +) + +func dataSourceWebPubsubPrivateLinkResource() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Read: dataSourceWebPubsubPrivateLinkResourceRead, + + Timeouts: &pluginsdk.ResourceTimeout{ + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + }, + + Schema: map[string]*pluginsdk.Schema{ + "web_pubsub_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.WebPubsubID, + }, + + "shared_private_link_resource_types": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "subresource_name": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "description": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceWebPubsubPrivateLinkResourceRead(d *pluginsdk.ResourceData, meta interface{}) error { + privateLinkResourceClient := meta.(*clients.Client).SignalR.WebPubsubPrivateLinkedResourceClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + webPubsubID, err := parse.WebPubsubID(d.Get("web_pubsub_id").(string)) + if err != nil { + return fmt.Errorf("parsing ID of %q: %+v", webPubsubID, err) + } + + resourceList, err := privateLinkResourceClient.List(ctx, webPubsubID.ResourceGroup, webPubsubID.WebPubSubName) + if err != nil { + return fmt.Errorf("retrieving Private Link Resource for Resource %s: %+v", webPubsubID, err) + } + + if resourceList.Values() == nil { + return fmt.Errorf("retrieving Private Link Resource for Resource %s: `resource value` was nil", webPubsubID) + } + + d.SetId(webPubsubID.ID()) + val := resourceList.Values() + + linkTypeList := make([]interface{}, 0) + + for _, v := range val { + if v.PrivateLinkResourceProperties != nil && v.PrivateLinkResourceProperties.ShareablePrivateLinkResourceTypes != nil { + for _, resource := range *v.PrivateLinkResourceProperties.ShareablePrivateLinkResourceTypes { + item := make(map[string]interface{}) + if props := resource.Properties; props != nil { + if props.GroupID != nil { + item["subresource_name"] = props.GroupID + } + if props.Description != nil { + item["description"] = props.Description + } + } + linkTypeList = append(linkTypeList, item) + } + } + } + + if err := d.Set("shared_private_link_resource_types", linkTypeList); err != nil { + return fmt.Errorf("setting `shared_private_link_resource_types` error: %+v", err) + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/web_pubsub_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/web_pubsub_resource.go index a39dc59aa92..cd59f324b9d 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/web_pubsub_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/web_pubsub_resource.go @@ -6,11 +6,10 @@ import ( "strings" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/Azure/azure-sdk-for-go/services/webpubsub/mgmt/2021-10-01/webpubsub" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/web_pubsub_shared_private_link_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/web_pubsub_shared_private_link_resource.go new file mode 100644 index 00000000000..85e78ee08f0 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/web_pubsub_shared_private_link_resource.go @@ -0,0 +1,189 @@ +package signalr + +import ( + "fmt" + "time" + + "github.com/Azure/azure-sdk-for-go/services/webpubsub/mgmt/2021-10-01/webpubsub" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceWebpubsubSharedPrivateLinkService() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceWebPubsubSharedPrivateLinkServiceCreateUpdate, + Read: resourceWebPubsubSharedPrivateLinkServiceRead, + Update: resourceWebPubsubSharedPrivateLinkServiceCreateUpdate, + Delete: resourceWebPubsubSharedPrivateLinkServiceDelete, + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Update: pluginsdk.DefaultTimeout(30 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.WebPubsubSharedPrivateLinkResourceID(id) + return err + }), + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "web_pubsub_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.WebPubsubID, + }, + + "subresource_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: networkValidate.PrivateLinkSubResourceName, + }, + + "target_resource_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: azure.ValidateResourceID, + }, + + "request_message": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "status": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + } +} + +func resourceWebPubsubSharedPrivateLinkServiceCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).SignalR.WebPubsubSharedPrivateLinkResourceClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + webPubsubID, err := parse.WebPubsubID(d.Get("web_pubsub_id").(string)) + if err != nil { + return fmt.Errorf("parsing ID of %q: %+v", webPubsubID, err) + } + + id := parse.NewWebPubsubSharedPrivateLinkResourceID(subscriptionId, webPubsubID.ResourceGroup, webPubsubID.WebPubSubName, d.Get("name").(string)) + + if d.IsNewResource() { + existing, err := client.Get(ctx, id.SharedPrivateLinkResourceName, id.ResourceGroup, id.WebPubSubName) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %q: %+v", id, err) + } + } + if !utils.ResponseWasNotFound(existing.Response) { + return tf.ImportAsExistsError("azurerm_web_pubsub_shared_private_link_resource", id.ID()) + } + } + + parameters := webpubsub.SharedPrivateLinkResource{ + SharedPrivateLinkResourceProperties: &webpubsub.SharedPrivateLinkResourceProperties{ + GroupID: utils.String(d.Get("subresource_name").(string)), + PrivateLinkResourceID: utils.String(d.Get("target_resource_id").(string)), + }, + } + + requestMessage := d.Get("request_message").(string) + if requestMessage != "" { + parameters.SharedPrivateLinkResourceProperties.RequestMessage = utils.String(requestMessage) + } + + if _, err := client.CreateOrUpdate(ctx, id.SharedPrivateLinkResourceName, parameters, id.ResourceGroup, id.WebPubSubName); err != nil { + return err + } + + d.SetId(id.ID()) + + return resourceWebPubsubSharedPrivateLinkServiceRead(d, meta) +} +func resourceWebPubsubSharedPrivateLinkServiceRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).SignalR.WebPubsubSharedPrivateLinkResourceClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.WebPubsubSharedPrivateLinkResourceID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.SharedPrivateLinkResourceName, id.ResourceGroup, id.WebPubSubName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + d.SetId("") + return fmt.Errorf("%q was not found", id) + } + return fmt.Errorf("making request on %q: %+v", id, err) + } + + d.Set("name", resp.Name) + d.Set("web_pubsub_id", parse.NewWebPubsubID(id.SubscriptionId, id.ResourceGroup, id.WebPubSubName).ID()) + + if props := resp.SharedPrivateLinkResourceProperties; props != nil { + if props.GroupID != nil { + d.Set("subresource_name", props.GroupID) + } + + if props.PrivateLinkResourceID != nil { + d.Set("target_resource_id", props.PrivateLinkResourceID) + } + + if props.RequestMessage != nil { + d.Set("request_message", props.RequestMessage) + } + + d.Set("status", props.Status) + } + + return nil +} +func resourceWebPubsubSharedPrivateLinkServiceDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).SignalR.WebPubsubSharedPrivateLinkResourceClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.WebPubsubSharedPrivateLinkResourceID(d.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.SharedPrivateLinkResourceName, id.ResourceGroup, id.WebPubSubName) + if err != nil { + return fmt.Errorf("deleting %q: %+v", id, err) + } + + if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + if !response.WasNotFound(future.Response()) { + return fmt.Errorf("waiting for deleting %q: %+v", id, err) + } + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/client/client.go index 01e748811db..9377d32c7ac 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/client/client.go @@ -1,12 +1,13 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { APIPortalClient *appplatform.APIPortalsClient + APIPortalCustomDomainClient *appplatform.APIPortalCustomDomainsClient AppsClient *appplatform.AppsClient BindingsClient *appplatform.BindingsClient BuildPackBindingClient *appplatform.BuildpackBindingClient @@ -30,6 +31,9 @@ func NewClient(o *common.ClientOptions) *Client { apiPortalClient := appplatform.NewAPIPortalsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&apiPortalClient.Client, o.ResourceManagerAuthorizer) + apiPortalCustomDomainClient := appplatform.NewAPIPortalCustomDomainsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + o.ConfigureClient(&apiPortalCustomDomainClient.Client, o.ResourceManagerAuthorizer) + appsClient := appplatform.NewAppsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&appsClient.Client, o.ResourceManagerAuthorizer) @@ -83,6 +87,7 @@ func NewClient(o *common.ClientOptions) *Client { return &Client{ APIPortalClient: &apiPortalClient, + APIPortalCustomDomainClient: &apiPortalCustomDomainClient, AppsClient: &appsClient, BindingsClient: &bindingsClient, BuildPackBindingClient: &buildpackBindingClient, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse/spring_cloud_api_portal_custom_domain.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse/spring_cloud_api_portal_custom_domain.go new file mode 100644 index 00000000000..d06955e0f61 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse/spring_cloud_api_portal_custom_domain.go @@ -0,0 +1,81 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type SpringCloudAPIPortalCustomDomainId struct { + SubscriptionId string + ResourceGroup string + SpringName string + ApiPortalName string + DomainName string +} + +func NewSpringCloudAPIPortalCustomDomainID(subscriptionId, resourceGroup, springName, apiPortalName, domainName string) SpringCloudAPIPortalCustomDomainId { + return SpringCloudAPIPortalCustomDomainId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + SpringName: springName, + ApiPortalName: apiPortalName, + DomainName: domainName, + } +} + +func (id SpringCloudAPIPortalCustomDomainId) String() string { + segments := []string{ + fmt.Sprintf("Domain Name %q", id.DomainName), + fmt.Sprintf("Api Portal Name %q", id.ApiPortalName), + fmt.Sprintf("Spring Name %q", id.SpringName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Spring Cloud A P I Portal Custom Domain", segmentsStr) +} + +func (id SpringCloudAPIPortalCustomDomainId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.AppPlatform/Spring/%s/apiPortals/%s/domains/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.SpringName, id.ApiPortalName, id.DomainName) +} + +// SpringCloudAPIPortalCustomDomainID parses a SpringCloudAPIPortalCustomDomain ID into an SpringCloudAPIPortalCustomDomainId struct +func SpringCloudAPIPortalCustomDomainID(input string) (*SpringCloudAPIPortalCustomDomainId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := SpringCloudAPIPortalCustomDomainId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.SpringName, err = id.PopSegment("Spring"); err != nil { + return nil, err + } + if resourceId.ApiPortalName, err = id.PopSegment("apiPortals"); err != nil { + return nil, err + } + if resourceId.DomainName, err = id.PopSegment("domains"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/registration.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/registration.go index 352986daffb..44698ffe348 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/registration.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/registration.go @@ -38,6 +38,7 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { return map[string]*pluginsdk.Resource{ "azurerm_spring_cloud_active_deployment": resourceSpringCloudActiveDeployment(), "azurerm_spring_cloud_api_portal": resourceSpringCloudAPIPortal(), + "azurerm_spring_cloud_api_portal_custom_domain": resourceSpringCloudAPIPortalCustomDomain(), "azurerm_spring_cloud_app": resourceSpringCloudApp(), "azurerm_spring_cloud_app_cosmosdb_association": resourceSpringCloudAppCosmosDBAssociation(), "azurerm_spring_cloud_app_mysql_association": resourceSpringCloudAppMysqlAssociation(), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/resourceids.go index c3a5a08605a..ad9d0fecb1b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/resourceids.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/resourceids.go @@ -3,6 +3,7 @@ package springcloud //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudApp -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/Spring/spring1/apps/app1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudAppAssociation -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/Spring/spring1/apps/app1/bindings/bind1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudAPIPortal -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/Spring/service1/apiPortals/apiPortal1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudAPIPortalCustomDomain -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/Spring/service1/apiPortals/apiPortal1/domains/domain1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudBuildServiceBuilder -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/Spring/service1/buildServices/buildService1/builders/builder1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudBuildPackBinding -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resourceGroup1/providers/Microsoft.AppPlatform/Spring/service1/buildServices/buildService1/builders/builder1/buildpackBindings/buildpackBinding1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SpringCloudDeployment -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.AppPlatform/Spring/spring1/apps/app1/deployments/deploy1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_active_deployment_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_active_deployment_resource.go index a0fbd4cea9a..edc009eb697 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_active_deployment_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_active_deployment_resource.go @@ -6,7 +6,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_api_portal_custom_domain_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_api_portal_custom_domain_resource.go new file mode 100644 index 00000000000..340b049fa1a --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_api_portal_custom_domain_resource.go @@ -0,0 +1,146 @@ +package springcloud + +import ( + "fmt" + "log" + "time" + + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +func resourceSpringCloudAPIPortalCustomDomain() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Create: resourceSpringCloudAPIPortalCustomDomainCreateUpdate, + Read: resourceSpringCloudAPIPortalCustomDomainRead, + Update: resourceSpringCloudAPIPortalCustomDomainCreateUpdate, + Delete: resourceSpringCloudAPIPortalCustomDomainDelete, + + Timeouts: &pluginsdk.ResourceTimeout{ + Create: pluginsdk.DefaultTimeout(30 * time.Minute), + Read: pluginsdk.DefaultTimeout(5 * time.Minute), + Update: pluginsdk.DefaultTimeout(30 * time.Minute), + Delete: pluginsdk.DefaultTimeout(30 * time.Minute), + }, + + Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { + _, err := parse.SpringCloudAPIPortalCustomDomainID(id) + return err + }), + + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + }, + + "spring_cloud_api_portal_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.SpringCloudAPIPortalID, + }, + + "thumbprint": { + Type: pluginsdk.TypeString, + Optional: true, + }, + }, + } +} +func resourceSpringCloudAPIPortalCustomDomainCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { + subscriptionId := meta.(*clients.Client).Account.SubscriptionId + client := meta.(*clients.Client).AppPlatform.APIPortalCustomDomainClient + ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) + defer cancel() + + portalId, err := parse.SpringCloudAPIPortalID(d.Get("spring_cloud_api_portal_id").(string)) + if err != nil { + return err + } + id := parse.NewSpringCloudAPIPortalCustomDomainID(subscriptionId, portalId.ResourceGroup, portalId.SpringName, portalId.ApiPortalName, d.Get("name").(string)) + + if d.IsNewResource() { + existing, err := client.Get(ctx, id.ResourceGroup, id.SpringName, id.ApiPortalName, id.DomainName) + if err != nil { + if !utils.ResponseWasNotFound(existing.Response) { + return fmt.Errorf("checking for existing %s: %+v", id, err) + } + } + if !utils.ResponseWasNotFound(existing.Response) { + return tf.ImportAsExistsError("azurerm_spring_cloud_api_portal_custom_domain", id.ID()) + } + } + + apiPortalCustomDomainResource := appplatform.APIPortalCustomDomainResource{ + Properties: &appplatform.APIPortalCustomDomainProperties{ + Thumbprint: utils.String(d.Get("thumbprint").(string)), + }, + } + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.SpringName, id.ApiPortalName, id.DomainName, apiPortalCustomDomainResource) + if err != nil { + return fmt.Errorf("creating/updating %s: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) + } + + d.SetId(id.ID()) + return resourceSpringCloudAPIPortalCustomDomainRead(d, meta) +} + +func resourceSpringCloudAPIPortalCustomDomainRead(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).AppPlatform.APIPortalCustomDomainClient + ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.SpringCloudAPIPortalCustomDomainID(d.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, id.ResourceGroup, id.SpringName, id.ApiPortalName, id.DomainName) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + log.Printf("[INFO] appplatform %q does not exist - removing from state", d.Id()) + d.SetId("") + return nil + } + return fmt.Errorf("retrieving %s: %+v", id, err) + } + d.Set("name", id.DomainName) + d.Set("spring_cloud_api_portal_id", parse.NewSpringCloudAPIPortalID(id.SubscriptionId, id.ResourceGroup, id.SpringName, id.ApiPortalName).ID()) + if props := resp.Properties; props != nil { + d.Set("thumbprint", props.Thumbprint) + } + return nil +} + +func resourceSpringCloudAPIPortalCustomDomainDelete(d *pluginsdk.ResourceData, meta interface{}) error { + client := meta.(*clients.Client).AppPlatform.APIPortalCustomDomainClient + ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) + defer cancel() + + id, err := parse.SpringCloudAPIPortalCustomDomainID(d.Id()) + if err != nil { + return err + } + + future, err := client.Delete(ctx, id.ResourceGroup, id.SpringName, id.ApiPortalName, id.DomainName) + if err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for deletion of %s: %+v", id, err) + } + return nil +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_api_portal_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_api_portal_resource.go index 2c0318c36c0..07b446d7048 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_api_portal_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_api_portal_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource.go index 56364ff99c6..b95d9ef2fe7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" cosmosValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/validate" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_mysql_association_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_mysql_association_resource.go index f072fd3b5b4..8f67a8979da 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_mysql_association_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_mysql_association_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" mysqlValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/validate" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_redis_association_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_redis_association_resource.go index 39c2a24a4ff..1ec7d468836 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_redis_association_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_redis_association_resource.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" redisValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/validate" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_resource.go index 0759a0c2c18..a1c348f5bfc 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_app_resource.go @@ -6,7 +6,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -145,6 +145,11 @@ func resourceSpringCloudApp() *pluginsdk.Resource { }, }, + "public_endpoint_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + "tls_enabled": { Type: pluginsdk.TypeBool, Optional: true, @@ -220,6 +225,12 @@ func resourceSpringCloudAppCreate(d *pluginsdk.ResourceData, meta interface{}) e // HTTPSOnly and PersistentDisk could only be set by update app.Properties.HTTPSOnly = utils.Bool(d.Get("https_only").(bool)) app.Properties.PersistentDisk = expandSpringCloudAppPersistentDisk(d.Get("persistent_disk").([]interface{})) + // VNetAddons.PublicEndpoint could only be set by update + if enabled := d.Get("public_endpoint_enabled").(bool); enabled { + app.Properties.VnetAddons = &appplatform.AppVNetAddons{ + PublicEndpoint: utils.Bool(enabled), + } + } future, err = client.CreateOrUpdate(ctx, id.ResourceGroup, id.SpringName, id.AppName, app) if err != nil { return fmt.Errorf("update %q: %+v", id, err) @@ -263,6 +274,11 @@ func resourceSpringCloudAppUpdate(d *pluginsdk.ResourceData, meta interface{}) e CustomPersistentDisks: expandAppCustomPersistentDiskResourceArray(d.Get("custom_persistent_disk").([]interface{}), *id), }, } + if enabled := d.Get("public_endpoint_enabled").(bool); enabled { + app.Properties.VnetAddons = &appplatform.AppVNetAddons{ + PublicEndpoint: utils.Bool(enabled), + } + } future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.SpringName, id.AppName, app) if err != nil { return fmt.Errorf("update %s: %+v", id, err) @@ -321,6 +337,9 @@ func resourceSpringCloudAppRead(d *pluginsdk.ResourceData, meta interface{}) err if err := d.Set("custom_persistent_disk", flattenAppCustomPersistentDiskResourceArray(prop.CustomPersistentDisks)); err != nil { return fmt.Errorf("setting `custom_persistent_disk`: %+v", err) } + if prop.VnetAddons != nil { + d.Set("public_endpoint_enabled", prop.VnetAddons.PublicEndpoint) + } } return nil diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_build_deployment_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_build_deployment_resource.go index a36712e5233..6cdb22f70da 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_build_deployment_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_build_deployment_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" @@ -56,6 +56,14 @@ func resourceSpringCloudBuildDeployment() *pluginsdk.Resource { ValidateFunc: validation.StringIsNotEmpty, }, + "addon_json": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringIsJSON, + DiffSuppressFunc: pluginsdk.SuppressJsonDiff, + }, + "environment_variables": { Type: pluginsdk.TypeMap, Optional: true, @@ -83,30 +91,16 @@ func resourceSpringCloudBuildDeployment() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "500m", - "1", - "2", - "3", - "4", - }, false), + // NOTE: we're intentionally not validating this field since additional values are possible when enabled by the service team + ValidateFunc: validation.StringIsNotEmpty, }, "memory": { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "512Mi", - "1Gi", - "2Gi", - "3Gi", - "4Gi", - "5Gi", - "6Gi", - "7Gi", - "8Gi", - }, false), + // NOTE: we're intentionally not validating this field since additional values are possible when enabled by the service team + ValidateFunc: validation.StringIsNotEmpty, }, }, }, @@ -149,6 +143,11 @@ func resourceSpringCloudBuildDeploymentCreateUpdate(d *pluginsdk.ResourceData, m return fmt.Errorf("invalid `sku` for Spring Cloud Service %q (Resource Group %q)", appId.SpringName, appId.ResourceGroup) } + addonConfig, err := expandSpringCloudAppAddon(d.Get("addon_json").(string)) + if err != nil { + return err + } + deployment := appplatform.DeploymentResource{ Sku: &appplatform.Sku{ Name: service.Sku.Name, @@ -160,6 +159,7 @@ func resourceSpringCloudBuildDeploymentCreateUpdate(d *pluginsdk.ResourceData, m BuildResultID: utils.String(d.Get("build_result_id").(string)), }, DeploymentSettings: &appplatform.DeploymentSettings{ + AddonConfigs: addonConfig, EnvironmentVariables: expandSpringCloudDeploymentEnvironmentVariables(d.Get("environment_variables").(map[string]interface{})), ResourceRequests: expandSpringCloudBuildDeploymentResourceRequests(d.Get("quota").([]interface{})), }, @@ -211,6 +211,9 @@ func resourceSpringCloudBuildDeploymentRead(d *pluginsdk.ResourceData, meta inte if err := d.Set("quota", flattenSpringCloudDeploymentResourceRequests(settings.ResourceRequests)); err != nil { return fmt.Errorf("setting `quota`: %+v", err) } + if err := d.Set("addon_json", flattenSpringCloudAppAddon(settings.AddonConfigs)); err != nil { + return fmt.Errorf("setting `addon_json`: %s", err) + } } if source, ok := resp.Properties.Source.AsBuildResultUserSourceInfo(); ok && source != nil { d.Set("build_result_id", source.BuildResultID) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_build_pack_binding_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_build_pack_binding_resource.go index 76143b73fb9..9a75723d0d8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_build_pack_binding_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_build_pack_binding_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_builder_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_builder_resource.go index a3caf8d5c93..290a93c4c2e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_builder_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_builder_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_certificate_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_certificate_resource.go index 62946bac055..75392c7f16c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_certificate_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_certificate_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_configuration_service_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_configuration_service_resource.go index ef087562159..2d15d984a48 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_configuration_service_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_configuration_service_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_container_deployment_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_container_deployment_resource.go index 6332c358bb3..0d4be752d36 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_container_deployment_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_container_deployment_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" @@ -62,6 +62,14 @@ func resourceSpringCloudContainerDeployment() *pluginsdk.Resource { ValidateFunc: validation.StringIsNotEmpty, }, + "addon_json": { + Type: pluginsdk.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringIsJSON, + DiffSuppressFunc: pluginsdk.SuppressJsonDiff, + }, + "arguments": { Type: pluginsdk.TypeList, Optional: true, @@ -115,30 +123,16 @@ func resourceSpringCloudContainerDeployment() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "500m", - "1", - "2", - "3", - "4", - }, false), + // NOTE: we're intentionally not validating this field since additional values are possible when enabled by the service team + ValidateFunc: validation.StringIsNotEmpty, }, "memory": { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "512Mi", - "1Gi", - "2Gi", - "3Gi", - "4Gi", - "5Gi", - "6Gi", - "7Gi", - "8Gi", - }, false), + // NOTE: we're intentionally not validating this field since additional values are possible when enabled by the service team + ValidateFunc: validation.StringIsNotEmpty, }, }, }, @@ -181,6 +175,11 @@ func resourceSpringCloudContainerDeploymentCreateUpdate(d *pluginsdk.ResourceDat return fmt.Errorf("invalid `sku` for Spring Cloud Service %q (Resource Group %q)", appId.SpringName, appId.ResourceGroup) } + addonConfig, err := expandSpringCloudAppAddon(d.Get("addon_json").(string)) + if err != nil { + return err + } + deployment := appplatform.DeploymentResource{ Sku: &appplatform.Sku{ Name: service.Sku.Name, @@ -198,6 +197,7 @@ func resourceSpringCloudContainerDeploymentCreateUpdate(d *pluginsdk.ResourceDat }, }, DeploymentSettings: &appplatform.DeploymentSettings{ + AddonConfigs: addonConfig, EnvironmentVariables: expandSpringCloudDeploymentEnvironmentVariables(d.Get("environment_variables").(map[string]interface{})), ResourceRequests: expandSpringCloudContainerDeploymentResourceRequests(d.Get("quota").([]interface{})), }, @@ -249,6 +249,9 @@ func resourceSpringCloudContainerDeploymentRead(d *pluginsdk.ResourceData, meta if err := d.Set("quota", flattenSpringCloudDeploymentResourceRequests(settings.ResourceRequests)); err != nil { return fmt.Errorf("setting `quota`: %+v", err) } + if err := d.Set("addon_json", flattenSpringCloudAppAddon(settings.AddonConfigs)); err != nil { + return fmt.Errorf("setting `addon_json`: %s", err) + } } if source, ok := resp.Properties.Source.AsCustomContainerUserSourceInfo(); ok && source != nil { if container := source.CustomContainer; container != nil { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_custom_domain_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_custom_domain_resource.go index d729a380345..af4272c5864 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_custom_domain_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_custom_domain_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_gateway_custom_domain_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_gateway_custom_domain_resource.go index fac14da63d7..e3dc44882e8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_gateway_custom_domain_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_gateway_custom_domain_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_gateway_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_gateway_resource.go index 398aac82662..eb99d0e8bd1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_gateway_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_gateway_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" @@ -182,30 +182,16 @@ func resourceSpringCloudGateway() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, Default: "1", - ValidateFunc: validation.StringInSlice([]string{ - "500m", - "1", - "2", - "3", - "4", - }, false), + // NOTE: we're intentionally not validating this field since additional values are possible when enabled by the service team + ValidateFunc: validation.StringIsNotEmpty, }, "memory": { Type: pluginsdk.TypeString, Optional: true, Default: "2Gi", - ValidateFunc: validation.StringInSlice([]string{ - "512Mi", - "1Gi", - "2Gi", - "3Gi", - "4Gi", - "5Gi", - "6Gi", - "7Gi", - "8Gi", - }, false), + // NOTE: we're intentionally not validating this field since additional values are possible when enabled by the service team + ValidateFunc: validation.StringIsNotEmpty, }, }, }, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_gateway_route_config_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_gateway_route_config_resource.go index c2639ed0a42..40ffec6ab0b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_gateway_route_config_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_gateway_route_config_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" @@ -49,6 +49,21 @@ func resourceSpringCloudGatewayRouteConfig() *pluginsdk.Resource { ValidateFunc: validate.SpringCloudGatewayID, }, + "open_api": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "uri": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.IsURLWithHTTPorHTTPS, + }, + }, + }, + }, + "spring_cloud_app_id": { Type: pluginsdk.TypeString, Optional: true, @@ -108,7 +123,7 @@ func resourceSpringCloudGatewayRouteConfig() *pluginsdk.Resource { "uri": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: validation.IsURLWithHTTPorHTTPS, + ValidateFunc: validation.StringIsNotEmpty, }, "classification_tags": { @@ -125,6 +140,7 @@ func resourceSpringCloudGatewayRouteConfig() *pluginsdk.Resource { }, } } + func resourceSpringCloudGatewayRouteConfigCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { subscriptionId := meta.(*clients.Client).Account.SubscriptionId client := meta.(*clients.Client).AppPlatform.GatewayRouteConfigClient @@ -153,6 +169,7 @@ func resourceSpringCloudGatewayRouteConfigCreateUpdate(d *pluginsdk.ResourceData Properties: &appplatform.GatewayRouteConfigProperties{ AppResourceID: utils.String(d.Get("spring_cloud_app_id").(string)), Routes: expandGatewayRouteConfigGatewayAPIRouteArray(d.Get("route").(*pluginsdk.Set).List()), + OpenAPI: expandGatewayRouteConfigOpenApi(d.Get("open_api").([]interface{})), }, } future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.SpringName, id.GatewayName, id.RouteConfigName, gatewayRouteConfigResource) @@ -194,6 +211,10 @@ func resourceSpringCloudGatewayRouteConfigRead(d *pluginsdk.ResourceData, meta i if err := d.Set("route", flattenGatewayRouteConfigGatewayAPIRouteArray(props.Routes)); err != nil { return fmt.Errorf("setting `route`: %+v", err) } + + if err := d.Set("open_api", flattenGatewayRouteConfigOpenApi(props.OpenAPI)); err != nil { + return fmt.Errorf("setting `open_api`: %+v", err) + } } return nil } @@ -283,3 +304,31 @@ func flattenGatewayRouteConfigGatewayAPIRouteArray(input *[]appplatform.GatewayA } return results } + +func expandGatewayRouteConfigOpenApi(input []interface{}) *appplatform.GatewayRouteConfigOpenAPIProperties { + if len(input) == 0 { + return nil + } + + config := input[0].(map[string]interface{}) + return &appplatform.GatewayRouteConfigOpenAPIProperties{ + URI: utils.String(config["uri"].(string)), + } +} + +func flattenGatewayRouteConfigOpenApi(input *appplatform.GatewayRouteConfigOpenAPIProperties) interface{} { + if input == nil { + return []interface{}{} + } + + uri := "" + if input.URI != nil { + uri = *input.URI + } + + return []interface{}{ + map[string]interface{}{ + "uri": uri, + }, + } +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_java_deployment_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_java_deployment_resource.go index 42380699ecb..788439f21be 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_java_deployment_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_java_deployment_resource.go @@ -6,7 +6,7 @@ import ( "strconv" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" @@ -356,13 +356,8 @@ func resourceSprintCloudJavaDeploymentSchema() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "500m", - "1", - "2", - "3", - "4", - }, false), + // NOTE: we're intentionally not validating this field since additional values are possible when enabled by the service team + ValidateFunc: validation.StringIsNotEmpty, }, // The value returned in GET will be recalculated by the service if the deprecated "memory_in_gb" is honored, so make this property as Computed. @@ -370,17 +365,8 @@ func resourceSprintCloudJavaDeploymentSchema() map[string]*pluginsdk.Schema { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "512Mi", - "1Gi", - "2Gi", - "3Gi", - "4Gi", - "5Gi", - "6Gi", - "7Gi", - "8Gi", - }, false), + // NOTE: we're intentionally not validating this field since additional values are possible when enabled by the service team + ValidateFunc: validation.StringIsNotEmpty, }, }, }, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_service_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_service_data_source.go index 0029b60f55a..dadceaa3a80 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_service_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_service_data_source.go @@ -172,19 +172,20 @@ func dataSourceSpringCloudServiceRead(d *pluginsdk.ResourceData, meta interface{ return fmt.Errorf("retrieving %s: %+v", id, err) } - configServer, err := configServersClient.Get(ctx, id.ResourceGroup, id.SpringName) - if err != nil { - return fmt.Errorf("retrieving config server configuration for %s: %+v", id, err) - } - d.SetId(id.ID()) d.Set("name", id.SpringName) d.Set("resource_group_name", id.ResourceGroup) d.Set("location", location.NormalizeNilable(resp.Location)) - if err := d.Set("config_server_git_setting", flattenSpringCloudConfigServerGitProperty(configServer.Properties, d)); err != nil { - return fmt.Errorf("setting `config_server_git_setting`: %+v", err) + if resp.Sku != nil && resp.Sku.Name != nil && *resp.Sku.Name != "E0" { + configServer, err := configServersClient.Get(ctx, id.ResourceGroup, id.SpringName) + if err != nil { + return fmt.Errorf("retrieving config server configuration for %s: %+v", id, err) + } + if err := d.Set("config_server_git_setting", flattenSpringCloudConfigServerGitProperty(configServer.Properties, d)); err != nil { + return fmt.Errorf("setting `config_server_git_setting`: %+v", err) + } } if props := resp.Properties; props != nil { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_service_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_service_resource.go index 12835ef6964..fa8388c1ddd 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_service_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_service_resource.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" @@ -80,6 +80,11 @@ func resourceSpringCloudService() *pluginsdk.Resource { }, false), }, + "log_stream_public_endpoint_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + "network": { Type: pluginsdk.TypeList, Optional: true, @@ -118,6 +123,12 @@ func resourceSpringCloudService() *pluginsdk.Resource { ForceNew: true, }, + "read_timeout_seconds": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntAtLeast(0), + }, + "service_runtime_network_resource_group": { Type: pluginsdk.TypeString, Optional: true, @@ -335,6 +346,12 @@ func resourceSpringCloudServiceCreate(d *pluginsdk.ResourceData, meta interface{ Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } + if enabled := d.Get("log_stream_public_endpoint_enabled").(bool); enabled { + resource.Properties.VnetAddons = &appplatform.ServiceVNetAddons{ + LogStreamPublicEndpoint: utils.Bool(enabled), + } + } + gitProperty, err := expandSpringCloudConfigServerGitProperty(d.Get("config_server_git_setting").([]interface{})) if err != nil { return err @@ -351,11 +368,18 @@ func resourceSpringCloudServiceCreate(d *pluginsdk.ResourceData, meta interface{ } d.SetId(id.ID()) - log.Printf("[DEBUG] Updating Config Server Settings for %s..", id) - if err := updateConfigServerSettings(ctx, configServersClient, id, gitProperty); err != nil { - return err + skuName := d.Get("sku_name").(string) + if skuName == "E0" && gitProperty != nil { + return fmt.Errorf("`config_server_git_setting` is not supported for sku `E0`") + } + + if skuName != "E0" { + log.Printf("[DEBUG] Updating Config Server Settings for %s..", id) + if err := updateConfigServerSettings(ctx, configServersClient, id, gitProperty); err != nil { + return err + } + log.Printf("[DEBUG] Updated Config Server Settings for %s.", id) } - log.Printf("[DEBUG] Updated Config Server Settings for %s.", id) log.Printf("[DEBUG] Updating Monitor Settings for %s..", id) monitorSettings := appplatform.MonitoringSettingResource{ @@ -439,12 +463,17 @@ func resourceSpringCloudServiceUpdate(d *pluginsdk.ResourceData, meta interface{ if err != nil { return err } - - log.Printf("[DEBUG] Updating Config Server Settings for %s..", *id) - if err := updateConfigServerSettings(ctx, configServersClient, *id, gitProperty); err != nil { - return err + skuName := d.Get("sku_name").(string) + if skuName == "E0" && gitProperty != nil { + return fmt.Errorf("`config_server_git_setting` is not supported for sku `E0`") + } + if skuName != "E0" { + log.Printf("[DEBUG] Updating Config Server Settings for %s..", *id) + if err := updateConfigServerSettings(ctx, configServersClient, *id, gitProperty); err != nil { + return err + } + log.Printf("[DEBUG] Updated Config Server Settings for %s.", *id) } - log.Printf("[DEBUG] Updated Config Server Settings for %s.", *id) } if d.HasChange("trace") { @@ -529,11 +558,6 @@ func resourceSpringCloudServiceRead(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("unable to read Spring Cloud Service %q (Resource Group %q): %+v", id.SpringName, id.ResourceGroup, err) } - configServer, err := configServersClient.Get(ctx, id.ResourceGroup, id.SpringName) - if err != nil { - return fmt.Errorf("retrieving config server settings for %s: %+v", id, err) - } - monitoringSettings, err := monitoringSettingsClient.Get(ctx, id.ResourceGroup, id.SpringName) if err != nil { return fmt.Errorf("retrieving monitoring settings for %s: %+v", id, err) @@ -574,8 +598,14 @@ func resourceSpringCloudServiceRead(d *pluginsdk.ResourceData, meta interface{}) d.Set("service_registry_id", "") } - if err := d.Set("config_server_git_setting", flattenSpringCloudConfigServerGitProperty(configServer.Properties, d)); err != nil { - return fmt.Errorf("setting `config_server_git_setting`: %+v", err) + if resp.Sku != nil && resp.Sku.Name != nil && *resp.Sku.Name != "E0" { + configServer, err := configServersClient.Get(ctx, id.ResourceGroup, id.SpringName) + if err != nil { + return fmt.Errorf("retrieving config server configuration for %s: %+v", id, err) + } + if err := d.Set("config_server_git_setting", flattenSpringCloudConfigServerGitProperty(configServer.Properties, d)); err != nil { + return fmt.Errorf("setting `config_server_git_setting`: %+v", err) + } } if err := d.Set("trace", flattenSpringCloudTrace(monitoringSettings.Properties)); err != nil { @@ -596,6 +626,12 @@ func resourceSpringCloudServiceRead(d *pluginsdk.ResourceData, meta interface{}) return fmt.Errorf("setting `required_network_traffic_rules`: %+v", err) } + if vnetAddons := props.VnetAddons; vnetAddons != nil { + if err := d.Set("log_stream_public_endpoint_enabled", utils.Bool(*vnetAddons.LogStreamPublicEndpoint)); err != nil { + return fmt.Errorf("setting `log_stream_public_endpoint_enabled`: %+v", err) + } + } + d.Set("zone_redundant", props.ZoneRedundant) } @@ -667,6 +703,9 @@ func expandSpringCloudNetwork(input []interface{}) *appplatform.NetworkProfile { ServiceRuntimeSubnetID: utils.String(v["service_runtime_subnet_id"].(string)), AppSubnetID: utils.String(v["app_subnet_id"].(string)), ServiceCidr: utils.String(strings.Join(*cidrRanges, ",")), + IngressConfig: &appplatform.IngressConfig{ + ReadTimeoutInSeconds: utils.Int32(int32(v["read_timeout_seconds"].(int))), + }, } if serviceRuntimeNetworkResourceGroup := v["service_runtime_network_resource_group"].(string); serviceRuntimeNetworkResourceGroup != "" { network.ServiceRuntimeNetworkResourceGroup = utils.String(serviceRuntimeNetworkResourceGroup) @@ -1035,6 +1074,7 @@ func flattenSpringCloudNetwork(input *appplatform.NetworkProfile) []interface{} } var serviceRuntimeSubnetID, appSubnetID, serviceRuntimeNetworkResourceGroup, appNetworkResourceGroup string + var readTimeoutInSeconds int32 var cidrRanges []interface{} if input.ServiceRuntimeSubnetID != nil { serviceRuntimeSubnetID = *input.ServiceRuntimeSubnetID @@ -1053,6 +1093,12 @@ func flattenSpringCloudNetwork(input *appplatform.NetworkProfile) []interface{} appNetworkResourceGroup = *input.AppNetworkResourceGroup } + if ingressConfig := input.IngressConfig; ingressConfig != nil { + if ingressConfig.ReadTimeoutInSeconds != nil { + readTimeoutInSeconds = *ingressConfig.ReadTimeoutInSeconds + } + } + if serviceRuntimeSubnetID == "" && appSubnetID == "" && serviceRuntimeNetworkResourceGroup == "" && appNetworkResourceGroup == "" && len(cidrRanges) == 0 { return []interface{}{} } @@ -1063,6 +1109,7 @@ func flattenSpringCloudNetwork(input *appplatform.NetworkProfile) []interface{} "service_runtime_subnet_id": serviceRuntimeSubnetID, "cidr_ranges": cidrRanges, "app_network_resource_group": appNetworkResourceGroup, + "read_timeout_seconds": readTimeoutInSeconds, "service_runtime_network_resource_group": serviceRuntimeNetworkResourceGroup, }, } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_storage_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_storage_resource.go index 785684dbd96..280b99c303c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_storage_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/spring_cloud_storage_resource.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/validate/spring_cloud_api_portal_custom_domain_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/validate/spring_cloud_api_portal_custom_domain_id.go new file mode 100644 index 00000000000..e29bac42840 --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/validate/spring_cloud_api_portal_custom_domain_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/parse" +) + +func SpringCloudAPIPortalCustomDomainID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.SpringCloudAPIPortalCustomDomainID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_administrator_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_administrator_resource.go index d1fc583be2b..b942de49677 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_administrator_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_administrator_resource.go @@ -11,7 +11,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -26,7 +25,7 @@ func resourceSqlAdministrator() *pluginsdk.Resource { Update: resourceSqlActiveDirectoryAdministratorCreateUpdate, Delete: resourceSqlActiveDirectoryAdministratorDelete, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_sql_active_directory_administrator` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azuread_administrator` block of the `azurerm_mssql_server` resource instead."), + DeprecationMessage: "The `azurerm_sql_active_directory_administrator` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azuread_administrator` block of the `azurerm_mssql_server` resource instead.", Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.AzureActiveDirectoryAdministratorID(id) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_database_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_database_data_source.go index 04ce5ab026a..16f5dde7447 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_database_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_database_data_source.go @@ -8,7 +8,6 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -20,7 +19,7 @@ func dataSourceSqlDatabase() *pluginsdk.Resource { return &pluginsdk.Resource{ Read: dataSourceArmSqlDatabaseRead, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_sql_database` data source is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_database` data source instead."), + DeprecationMessage: "The `azurerm_sql_database` data source is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_database` data source instead.", Timeouts: &pluginsdk.ResourceTimeout{ Read: pluginsdk.DefaultTimeout(5 * time.Minute), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_database_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_database_resource.go index 5139440e07e..493c67a3109 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_database_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_database_resource.go @@ -13,7 +13,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -31,7 +30,7 @@ func resourceSqlDatabase() *pluginsdk.Resource { Update: resourceSqlDatabaseCreateUpdate, Delete: resourceSqlDatabaseDelete, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_sql_database` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_database` resource instead."), + DeprecationMessage: "The `azurerm_sql_database` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_database` resource instead.", Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.DatabaseID(id) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_elasticpool_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_elasticpool_resource.go index 946112efe8f..402d911358f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_elasticpool_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_elasticpool_resource.go @@ -8,7 +8,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -25,7 +24,7 @@ func resourceSqlElasticPool() *pluginsdk.Resource { Update: resourceSqlElasticPoolCreateUpdate, Delete: resourceSqlElasticPoolDelete, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_sql_elasticpool_resource` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_elasticpool` resource instead."), + DeprecationMessage: "The `azurerm_sql_elasticpool_resource` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_elasticpool` resource instead.", Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.ElasticPoolID(id) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_failover_group_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_failover_group_resource.go index c8e7d342068..fcf6c2dded6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_failover_group_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_failover_group_resource.go @@ -10,7 +10,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -28,7 +27,7 @@ func resourceSqlFailoverGroup() *pluginsdk.Resource { Update: resourceSqlFailoverGroupCreateUpdate, Delete: resourceSqlFailoverGroupDelete, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_sql_failover_group` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_failover_group` resource instead."), + DeprecationMessage: "The `azurerm_sql_failover_group` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_failover_group` resource instead.", Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.FailoverGroupID(id) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_firewall_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_firewall_rule_resource.go index 5e32093bf56..2421ca7ca83 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_firewall_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_firewall_rule_resource.go @@ -9,7 +9,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -25,7 +24,7 @@ func resourceSqlFirewallRule() *pluginsdk.Resource { Update: resourceSqlFirewallRuleCreateUpdate, Delete: resourceSqlFirewallRuleDelete, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_sql_firewall_rule` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_firewall_rule` resource instead."), + DeprecationMessage: "The `azurerm_sql_firewall_rule` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_firewall_rule` resource instead.", Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.FirewallRuleID(id) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_database_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_database_resource.go index b455845fcb6..3449a71ece1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_database_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_database_resource.go @@ -10,7 +10,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -24,7 +23,7 @@ func resourceArmSqlManagedDatabase() *schema.Resource { Read: resourceArmSqlManagedDatabaseRead, Delete: resourceArmSqlManagedDatabaseDelete, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_sql_managed_database` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_managed_database` resource instead."), + DeprecationMessage: "The `azurerm_sql_managed_database` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_managed_database` resource instead.", Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.ManagedDatabaseID(id) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_administrator_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_administrator_resource.go index b762aa57194..6832883fc5a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_administrator_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_administrator_resource.go @@ -11,7 +11,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -26,7 +25,7 @@ func resourceSqlManagedInstanceAdministrator() *pluginsdk.Resource { Update: resourceSqlManagedInstanceActiveDirectoryAdministratorCreateUpdate, Delete: resourceSqlManagedInstanceActiveDirectoryAdministratorDelete, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_sql_managed_instance_active_directory_administrator` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_managed_instance_active_directory_administrator` resource instead."), + DeprecationMessage: "The `azurerm_sql_managed_instance_active_directory_administrator` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_managed_instance_active_directory_administrator` resource instead.", Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.ManagedInstanceAzureActiveDirectoryAdministratorID(id) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_data_source.go index 4b8b2645daa..fc125175bf8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_data_source.go @@ -8,7 +8,6 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -21,7 +20,7 @@ func dataSourceArmSqlMiServer() *schema.Resource { return &schema.Resource{ Read: dataSourceArmSqlMiServerRead, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_sql_managed_instance` data source is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_managed_instance` data source instead."), + DeprecationMessage: "The `azurerm_sql_managed_instance` data source is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_managed_instance` data source instead.", Timeouts: &schema.ResourceTimeout{ Read: schema.DefaultTimeout(5 * time.Minute), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_failover_group_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_failover_group_resource.go index ded051f7dbe..b8713252c63 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_failover_group_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_failover_group_resource.go @@ -10,7 +10,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -26,7 +25,7 @@ func resourceSqlInstanceFailoverGroup() *pluginsdk.Resource { Update: resourceSqlInstanceFailoverGroupCreateUpdate, Delete: resourceSqlInstanceFailoverGroupDelete, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_sql_managed_instance_failover_group` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_managed_instance_failover_group` resource instead."), + DeprecationMessage: "The `azurerm_sql_managed_instance_failover_group` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_managed_instance_failover_group` resource instead.", Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.InstanceFailoverGroupID(id) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_resource.go index d1fcf4d9e3e..ae680a4d0f9 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_managed_instance_resource.go @@ -15,7 +15,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -32,7 +31,7 @@ func resourceArmSqlMiServer() *schema.Resource { Update: resourceArmSqlMiServerCreateUpdate, Delete: resourceArmSqlMiServerDelete, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_sql_managed_instance` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_managed_instance` resource instead."), + DeprecationMessage: "The `azurerm_sql_managed_instance` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_managed_instance` resource instead.", Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.ManagedInstanceID(id) @@ -101,7 +100,7 @@ func resourceArmSqlMiServer() *schema.Resource { "storage_size_in_gb": { Type: schema.TypeInt, Required: true, - ValidateFunc: validation.IntBetween(32, 8192), + ValidateFunc: validation.IntBetween(32, 16384), }, "license_type": { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_server_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_server_data_source.go index 7483704c9e6..337c047bf7b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_server_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_server_data_source.go @@ -7,7 +7,6 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -19,7 +18,7 @@ func dataSourceSqlServer() *pluginsdk.Resource { return &pluginsdk.Resource{ Read: dataSourceArmSqlServerRead, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_sql_server` data source is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_server` data source instead."), + DeprecationMessage: "The `azurerm_sql_server` data source is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_server` data source instead.", Timeouts: &pluginsdk.ResourceTimeout{ Read: pluginsdk.DefaultTimeout(5 * time.Minute), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_server_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_server_resource.go index 9d551847669..d6f0338170e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_server_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_server_resource.go @@ -14,7 +14,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -31,7 +30,7 @@ func resourceSqlServer() *pluginsdk.Resource { Update: resourceSqlServerCreateUpdate, Delete: resourceSqlServerDelete, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_sql_server` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_server` resource instead."), + DeprecationMessage: "The `azurerm_sql_server` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_server` resource instead.", Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.ServerID(id) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_virtual_network_rule_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_virtual_network_rule_resource.go index cff48a85c4f..1d51a646013 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_virtual_network_rule_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/sql_virtual_network_rule_resource.go @@ -9,7 +9,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sql/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -24,7 +23,7 @@ func resourceSqlVirtualNetworkRule() *pluginsdk.Resource { Update: resourceSqlVirtualNetworkRuleCreateUpdate, Delete: resourceSqlVirtualNetworkRuleDelete, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_sql_virtual_network_rule` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_virtual_network_rule` resource instead."), + DeprecationMessage: "The `azurerm_sql_virtual_network_rule` resource is deprecated and will be removed in version 4.0 of the AzureRM provider. Please use the `azurerm_mssql_virtual_network_rule` resource instead.", Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.VirtualNetworkRuleID(id) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/client/client.go index ee85dccb171..3f6dc199164 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/client/client.go @@ -4,12 +4,12 @@ import ( "context" "fmt" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage" + "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage" "github.com/Azure/azure-sdk-for-go/services/storagesync/mgmt/2020-03-01/storagesync" "github.com/Azure/go-autorest/autorest" - az "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies" "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/shim" "github.com/tombuildsstuff/giovanni/storage/2019-12-12/blob/accounts" "github.com/tombuildsstuff/giovanni/storage/2019-12-12/blob/blobs" @@ -33,7 +33,7 @@ type Client struct { BlobInventoryPoliciesClient *storage.BlobInventoryPoliciesClient CloudEndpointsClient *storagesync.CloudEndpointsClient EncryptionScopesClient *storage.EncryptionScopesClient - Environment az.Environment + Environment azure.Environment FileServicesClient *storage.FileServicesClient ObjectReplicationClient *objectreplicationpolicies.ObjectReplicationPoliciesClient SyncServiceClient *storagesync.ServicesClient diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/client/helpers.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/client/helpers.go index 450830ff749..b5e71616a12 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/client/helpers.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/client/helpers.go @@ -6,7 +6,7 @@ import ( "log" "sync" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage" + "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage" "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse/object_replication.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse/object_replication.go index ed8712c5bab..fb30b5c638c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse/object_replication.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse/object_replication.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies" + "github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies" ) // This is manual for concat two ids are not supported in auto-generation diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/client.go deleted file mode 100644 index d2194ef313a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package objectreplicationpolicies - -import "github.com/Azure/go-autorest/autorest" - -type ObjectReplicationPoliciesClient struct { - Client autorest.Client - baseUri string -} - -func NewObjectReplicationPoliciesClientWithBaseURI(endpoint string) ObjectReplicationPoliciesClient { - return ObjectReplicationPoliciesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/method_createorupdate_autorest.go deleted file mode 100644 index 39c9230fb3d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/method_createorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package objectreplicationpolicies - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateOrUpdateResponse struct { - HttpResponse *http.Response - Model *ObjectReplicationPolicy -} - -// CreateOrUpdate ... -func (c ObjectReplicationPoliciesClient) CreateOrUpdate(ctx context.Context, id ObjectReplicationPoliciesId, input ObjectReplicationPolicy) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ObjectReplicationPoliciesClient) preparerForCreateOrUpdate(ctx context.Context, id ObjectReplicationPoliciesId, input ObjectReplicationPolicy) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ObjectReplicationPoliciesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/method_delete_autorest.go deleted file mode 100644 index a6a01d025c6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/method_delete_autorest.go +++ /dev/null @@ -1,62 +0,0 @@ -package objectreplicationpolicies - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteResponse struct { - HttpResponse *http.Response -} - -// Delete ... -func (c ObjectReplicationPoliciesClient) Delete(ctx context.Context, id ObjectReplicationPoliciesId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ObjectReplicationPoliciesClient) preparerForDelete(ctx context.Context, id ObjectReplicationPoliciesId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ObjectReplicationPoliciesClient) responderForDelete(resp *http.Response) (result DeleteResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/method_get_autorest.go deleted file mode 100644 index 34d0ce51179..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package objectreplicationpolicies - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *ObjectReplicationPolicy -} - -// Get ... -func (c ObjectReplicationPoliciesClient) Get(ctx context.Context, id ObjectReplicationPoliciesId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ObjectReplicationPoliciesClient) preparerForGet(ctx context.Context, id ObjectReplicationPoliciesId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ObjectReplicationPoliciesClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/method_list_autorest.go deleted file mode 100644 index 2250eb930ec..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/method_list_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package objectreplicationpolicies - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListResponse struct { - HttpResponse *http.Response - Model *ObjectReplicationPolicies -} - -// List ... -func (c ObjectReplicationPoliciesClient) List(ctx context.Context, id StorageAccountId) (result ListResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "objectreplicationpolicies.ObjectReplicationPoliciesClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForList prepares the List request. -func (c ObjectReplicationPoliciesClient) preparerForList(ctx context.Context, id StorageAccountId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/objectReplicationPolicies", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c ObjectReplicationPoliciesClient) responderForList(resp *http.Response) (result ListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicies.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicies.go deleted file mode 100644 index ad542be3f10..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicies.go +++ /dev/null @@ -1,5 +0,0 @@ -package objectreplicationpolicies - -type ObjectReplicationPolicies struct { - Value *[]ObjectReplicationPolicy `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicy.go deleted file mode 100644 index 80f0aa97cb5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -package objectreplicationpolicies - -type ObjectReplicationPolicy struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *ObjectReplicationPolicyProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyfilter.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyfilter.go deleted file mode 100644 index c974517a64b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyfilter.go +++ /dev/null @@ -1,6 +0,0 @@ -package objectreplicationpolicies - -type ObjectReplicationPolicyFilter struct { - MinCreationTime *string `json:"minCreationTime,omitempty"` - PrefixMatch *[]string `json:"prefixMatch,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyproperties.go deleted file mode 100644 index ca1698d5790..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyproperties.go +++ /dev/null @@ -1,27 +0,0 @@ -package objectreplicationpolicies - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type ObjectReplicationPolicyProperties struct { - DestinationAccount string `json:"destinationAccount"` - EnabledTime *string `json:"enabledTime,omitempty"` - PolicyId *string `json:"policyId,omitempty"` - Rules *[]ObjectReplicationPolicyRule `json:"rules,omitempty"` - SourceAccount string `json:"sourceAccount"` -} - -func (o ObjectReplicationPolicyProperties) GetEnabledTimeAsTime() (*time.Time, error) { - if o.EnabledTime == nil { - return nil, nil - } - return dates.ParseAsFormat(o.EnabledTime, "2006-01-02T15:04:05Z07:00") -} - -func (o ObjectReplicationPolicyProperties) SetEnabledTimeAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.EnabledTime = &formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyrule.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyrule.go deleted file mode 100644 index 52bbac57dd4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/model_objectreplicationpolicyrule.go +++ /dev/null @@ -1,8 +0,0 @@ -package objectreplicationpolicies - -type ObjectReplicationPolicyRule struct { - DestinationContainer string `json:"destinationContainer"` - Filters *ObjectReplicationPolicyFilter `json:"filters,omitempty"` - RuleId *string `json:"ruleId,omitempty"` - SourceContainer string `json:"sourceContainer"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/version.go deleted file mode 100644 index 23573198461..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package objectreplicationpolicies - -import "fmt" - -const defaultApiVersion = "2021-04-01" - -func userAgent() string { - return fmt.Sprintf("pandora/objectreplicationpolicies/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_customer_managed_key_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_customer_managed_key_resource.go index a1f0cf9036d..62463023a3e 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_customer_managed_key_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_customer_managed_key_resource.go @@ -5,13 +5,13 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage" + "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" storageParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -68,7 +68,7 @@ func resourceStorageAccountCustomerManagedKey() *pluginsdk.Resource { "user_assigned_identity_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, }, } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_data_source.go index 5ddc6193797..24862089d8f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_data_source.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage" + "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage" azautorest "github.com/Azure/go-autorest/autorest" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" @@ -38,6 +38,8 @@ func dataSourceStorageAccount() *pluginsdk.Resource { "location": commonschema.LocationComputed(), + "identity": commonschema.SystemAssignedUserAssignedIdentityComputed(), + "account_kind": { Type: pluginsdk.TypeString, Computed: true, @@ -419,5 +421,13 @@ func dataSourceStorageAccountRead(d *pluginsdk.ResourceData, meta interface{}) e d.Set("secondary_access_key", storageAccountKeys[1].Value) } + identity, err := flattenAzureRmStorageAccountIdentity(resp.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + if err := d.Set("identity", identity); err != nil { + return fmt.Errorf("setting `identity`: %+v", err) + } + return tags.FlattenAndSet(d, resp.Tags) } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_network_rules_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_network_rules_resource.go index 947c2c12653..7703062e853 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_network_rules_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_network_rules_resource.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage" + "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_resource.go index 3e187e498d8..d88f5c546d8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_account_resource.go @@ -9,15 +9,15 @@ import ( "strings" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" - "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage" + "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage" azautorest "github.com/Azure/go-autorest/autorest" autorestAzure "github.com/Azure/go-autorest/autorest/azure" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -25,7 +25,6 @@ import ( keyvault "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/client" keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - msiValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/network" vnetParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse" resource "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/client" @@ -237,7 +236,7 @@ func resourceStorageAccount() *pluginsdk.Resource { "user_assigned_identity_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: msiValidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, }, }, @@ -290,6 +289,12 @@ func resourceStorageAccount() *pluginsdk.Resource { Default: true, }, + "default_to_oauth_authentication": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + "network_rules": { Type: pluginsdk.TypeList, Optional: true, @@ -403,6 +408,12 @@ func resourceStorageAccount() *pluginsdk.Resource { Default: false, }, + "change_feed_retention_in_days": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 146000), + }, + "default_service_version": { Type: pluginsdk.TypeString, Optional: true, @@ -963,6 +974,7 @@ func resourceStorageAccountCreate(d *pluginsdk.ResourceData, meta interface{}) e nfsV3Enabled := d.Get("nfsv3_enabled").(bool) allowBlobPublicAccess := d.Get("allow_nested_items_to_be_public").(bool) allowSharedKeyAccess := d.Get("shared_access_key_enabled").(bool) + defaultToOAuthAuthentication := d.Get("default_to_oauth_authentication").(bool) crossTenantReplication := d.Get("cross_tenant_replication_enabled").(bool) accountTier := d.Get("account_tier").(string) @@ -978,12 +990,13 @@ func resourceStorageAccountCreate(d *pluginsdk.ResourceData, meta interface{}) e Tags: tags.Expand(t), Kind: storage.Kind(accountKind), AccountPropertiesCreateParameters: &storage.AccountPropertiesCreateParameters{ - EnableHTTPSTrafficOnly: &enableHTTPSTrafficOnly, - NetworkRuleSet: expandStorageAccountNetworkRules(d, tenantId), - IsHnsEnabled: &isHnsEnabled, - EnableNfsV3: &nfsV3Enabled, - AllowSharedKeyAccess: &allowSharedKeyAccess, - AllowCrossTenantReplication: &crossTenantReplication, + EnableHTTPSTrafficOnly: &enableHTTPSTrafficOnly, + NetworkRuleSet: expandStorageAccountNetworkRules(d, tenantId), + IsHnsEnabled: &isHnsEnabled, + EnableNfsV3: &nfsV3Enabled, + AllowSharedKeyAccess: &allowSharedKeyAccess, + DefaultToOAuthAuthentication: &defaultToOAuthAuthentication, + AllowCrossTenantReplication: &crossTenantReplication, }, } @@ -1173,7 +1186,7 @@ func resourceStorageAccountCreate(d *pluginsdk.ResourceData, meta interface{}) e } if v, ok := d.GetOk("blob_properties.0.container_delete_retention_policy"); ok { - blobProperties.ContainerDeleteRetentionPolicy = expandBlobPropertiesDeleteRetentionPolicy(v.([]interface{}), false) + blobProperties.ContainerDeleteRetentionPolicy = expandBlobPropertiesDeleteRetentionPolicy(v.([]interface{})) } if _, err = blobClient.SetServiceProperties(ctx, id.ResourceGroup, id.Name, *blobProperties); err != nil { @@ -1312,6 +1325,11 @@ func resourceStorageAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) e }, } + if d.HasChange("default_to_oauth_authentication") { + defaultToOAuthAuthentication := d.Get("default_to_oauth_authentication").(bool) + opts.AccountPropertiesUpdateParameters.DefaultToOAuthAuthentication = &defaultToOAuthAuthentication + } + if d.HasChange("cross_tenant_replication_enabled") { crossTenantReplication := d.Get("cross_tenant_replication_enabled").(bool) opts.AccountPropertiesUpdateParameters.AllowCrossTenantReplication = &crossTenantReplication @@ -1571,7 +1589,7 @@ func resourceStorageAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) e } if d.HasChange("blob_properties.0.container_delete_retention_policy") { - blobProperties.ContainerDeleteRetentionPolicy = expandBlobPropertiesDeleteRetentionPolicy(d.Get("blob_properties.0.container_delete_retention_policy").([]interface{}), true) + blobProperties.ContainerDeleteRetentionPolicy = expandBlobPropertiesDeleteRetentionPolicy(d.Get("blob_properties.0.container_delete_retention_policy").([]interface{})) } if _, err = blobClient.SetServiceProperties(ctx, id.ResourceGroup, id.Name, *blobProperties); err != nil { @@ -1813,6 +1831,12 @@ func resourceStorageAccountRead(d *pluginsdk.ResourceData, meta interface{}) err } d.Set("shared_access_key_enabled", allowSharedKeyAccess) + defaultToOAuthAuthentication := false + if props.DefaultToOAuthAuthentication != nil { + defaultToOAuthAuthentication = *props.DefaultToOAuthAuthentication + } + d.Set("default_to_oauth_authentication", defaultToOAuthAuthentication) + // Setting the encryption key type to "Service" in PUT. The following GET will not return the queue/table in the service list of its response. // So defaults to setting the encryption key type to "Service" if it is absent in the GET response. Also, define the default value as "Service" in the schema. var ( @@ -2323,7 +2347,7 @@ func expandBlobProperties(input []interface{}) *storage.BlobServiceProperties { v := input[0].(map[string]interface{}) deletePolicyRaw := v["delete_retention_policy"].([]interface{}) - props.BlobServicePropertiesProperties.DeleteRetentionPolicy = expandBlobPropertiesDeleteRetentionPolicy(deletePolicyRaw, true) + props.BlobServicePropertiesProperties.DeleteRetentionPolicy = expandBlobPropertiesDeleteRetentionPolicy(deletePolicyRaw) corsRaw := v["cors_rule"].([]interface{}) props.BlobServicePropertiesProperties.Cors = expandBlobPropertiesCors(corsRaw) @@ -2333,6 +2357,10 @@ func expandBlobProperties(input []interface{}) *storage.BlobServiceProperties { Enabled: utils.Bool(v["change_feed_enabled"].(bool)), } + if v := v["change_feed_retention_in_days"].(int); v != 0 { + props.ChangeFeed.RetentionInDays = utils.Int32((int32)(v)) + } + if version, ok := v["default_service_version"].(string); ok && version != "" { props.DefaultServiceVersion = utils.String(version) } @@ -2340,15 +2368,11 @@ func expandBlobProperties(input []interface{}) *storage.BlobServiceProperties { return &props } -func expandBlobPropertiesDeleteRetentionPolicy(input []interface{}, isupdate bool) *storage.DeleteRetentionPolicy { +func expandBlobPropertiesDeleteRetentionPolicy(input []interface{}) *storage.DeleteRetentionPolicy { result := storage.DeleteRetentionPolicy{ Enabled: utils.Bool(false), } - if (len(input) == 0 || input[0] == nil) && !isupdate { - return nil - } - - if (len(input) == 0 || input[0] == nil) && isupdate { + if len(input) == 0 || input[0] == nil { return &result } @@ -2410,7 +2434,7 @@ func expandShareProperties(input []interface{}) storage.FileServiceProperties { v := input[0].(map[string]interface{}) - props.FileServicePropertiesProperties.ShareDeleteRetentionPolicy = expandBlobPropertiesDeleteRetentionPolicy(v["retention_policy"].([]interface{}), false) + props.FileServicePropertiesProperties.ShareDeleteRetentionPolicy = expandBlobPropertiesDeleteRetentionPolicy(v["retention_policy"].([]interface{})) props.FileServicePropertiesProperties.Cors = expandBlobPropertiesCors(v["cors_rule"].([]interface{})) @@ -2791,13 +2815,18 @@ func flattenBlobProperties(input storage.BlobServiceProperties) []interface{} { flattenedContainerDeletePolicy = flattenBlobPropertiesDeleteRetentionPolicy(containerDeletePolicy) } - versioning, changeFeed := false, false + versioning, changeFeedEnabled, changeFeedRetentionInDays := false, false, 0 if input.BlobServicePropertiesProperties.IsVersioningEnabled != nil { versioning = *input.BlobServicePropertiesProperties.IsVersioningEnabled } - if v := input.BlobServicePropertiesProperties.ChangeFeed; v != nil && v.Enabled != nil { - changeFeed = *v.Enabled + if v := input.BlobServicePropertiesProperties.ChangeFeed; v != nil { + if v.Enabled != nil { + changeFeedEnabled = *v.Enabled + } + if v.RetentionInDays != nil { + changeFeedRetentionInDays = int(*v.RetentionInDays) + } } var defaultServiceVersion string @@ -2815,7 +2844,8 @@ func flattenBlobProperties(input storage.BlobServiceProperties) []interface{} { "cors_rule": flattenedCorsRules, "delete_retention_policy": flattenedDeletePolicy, "versioning_enabled": versioning, - "change_feed_enabled": changeFeed, + "change_feed_enabled": changeFeedEnabled, + "change_feed_retention_in_days": changeFeedRetentionInDays, "default_service_version": defaultServiceVersion, "last_access_time_enabled": LastAccessTimeTrackingPolicy, "container_delete_retention_policy": flattenedContainerDeletePolicy, @@ -3009,10 +3039,6 @@ func flattenShareProperties(input storage.FileServiceProperties) []interface{} { flattenedSMB = flattenedSharePropertiesSMB(protocol.Smb) } - if len(flattenedCorsRules) == 0 && len(flattenedDeletePolicy) == 0 && len(flattenedSMB) == 0 { - return []interface{}{} - } - return []interface{}{ map[string]interface{}{ "cors_rule": flattenedCorsRules, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_blob_inventory_policy_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_blob_inventory_policy_resource.go index 6e29db053b9..a182e338dea 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_blob_inventory_policy_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_blob_inventory_policy_resource.go @@ -6,7 +6,7 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage" + "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_encryption_scope_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_encryption_scope_resource.go index 4d81b896f49..e6438a84e58 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_encryption_scope_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_encryption_scope_resource.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage" + "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_management_policy_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_management_policy_data_source.go index fe9e6859252..5c7946a6621 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_management_policy_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_management_policy_data_source.go @@ -102,6 +102,18 @@ func dataSourceStorageManagementPolicy() *pluginsdk.Resource { Type: pluginsdk.TypeInt, Computed: true, }, + "tier_to_archive_after_days_since_last_access_time_greater_than": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "delete_after_days_since_last_access_time_greater_than": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + "tier_to_cool_after_days_since_last_access_time_greater_than": { + Type: pluginsdk.TypeInt, + Computed: true, + }, }, }, }, @@ -167,7 +179,7 @@ func dataSourceStorageManagementPolicyRead(d *pluginsdk.ResourceData, meta inter } id := parse.NewStorageAccountManagementPolicyID(storageAccountId.SubscriptionId, storageAccountId.ResourceGroup, storageAccountId.Name, "default") - resp, err := client.Get(ctx, id.ResourceGroup, id.ManagementPolicyName) + resp, err := client.Get(ctx, id.ResourceGroup, id.StorageAccountName) if err != nil { if utils.ResponseWasNotFound(resp.Response) { return fmt.Errorf("%s was not found", id) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_management_policy_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_management_policy_resource.go index 8c12307c4c4..a2e6c640927 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_management_policy_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_management_policy_resource.go @@ -3,10 +3,9 @@ package storage import ( "fmt" "log" - "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage" + "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" @@ -49,12 +48,9 @@ func resourceStorageManagementPolicy() *pluginsdk.Resource { Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "name": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringMatch( - regexp.MustCompile(`^[a-zA-Z0-9-]*$`), - "A rule name can contain any combination of alpha numeric characters.", - ), + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, }, "enabled": { Type: pluginsdk.TypeBool, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_object_replication_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_object_replication_resource.go index fb4a766eda9..f1aafae26bc 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_object_replication_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_object_replication_resource.go @@ -6,10 +6,10 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies" "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_table_entity_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_table_entity_resource.go index 4d250c360e7..679201b3c6c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_table_entity_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/storage_table_entity_resource.go @@ -3,6 +3,7 @@ package storage import ( "fmt" "log" + "strings" "time" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" @@ -163,7 +164,7 @@ func resourceStorageTableEntityRead(d *pluginsdk.ResourceData, meta interface{}) input := entities.GetEntityInput{ PartitionKey: id.PartitionKey, RowKey: id.RowKey, - MetaDataLevel: entities.NoMetaData, + MetaDataLevel: entities.FullMetaData, } result, err := client.Get(ctx, id.AccountName, id.TableName, input) @@ -223,5 +224,53 @@ func flattenEntity(entity map[string]interface{}) map[string]interface{} { delete(entity, "RowKey") delete(entity, "Timestamp") - return entity + result := map[string]interface{}{} + for k, v := range entity { + // skip ODATA annotation returned with fullmetadata + if strings.HasPrefix(k, "odata.") || strings.HasSuffix(k, "@odata.type") { + continue + } + if dtype, ok := entity[k+"@odata.type"]; ok { + switch dtype { + case "Edm.Boolean": + result[k] = fmt.Sprint(v) + case "Edm.Double": + result[k] = fmt.Sprintf("%f", v) + case "Edm.Int32": + fallthrough + case "Edm.Int64": + result[k] = fmt.Sprintf("%d", int64(v.(float64))) + case "Edm.String": + result[k] = v + default: + log.Printf("[WARN] key %q with unexpected @odata.type %q", k, dtype) + continue + } + + result[k+"@odata.type"] = dtype + } else { + // special handling for property types that do not require the annotation to be present + // https://docs.microsoft.com/en-us/rest/api/storageservices/payload-format-for-table-service-operations#property-types-in-a-json-feed + switch c := v.(type) { + case bool: + result[k] = fmt.Sprint(v) + result[k+"@odata.type"] = "Edm.Boolean" + case float64: + f64 := v.(float64) + if v == float64(int64(f64)) { + result[k] = fmt.Sprintf("%d", int64(f64)) + result[k+"@odata.type"] = "Edm.Int32" + } else { + result[k] = fmt.Sprintf("%f", v) + result[k+"@odata.type"] = "Edm.Double" + } + case string: + result[k] = v + default: + log.Printf("[WARN] key %q with unexpected type %T", k, c) + } + } + } + + return result } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/stream_analytics_output_blob_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/stream_analytics_output_blob_resource.go index 68758b495aa..6638b1254a8 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/stream_analytics_output_blob_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/stream_analytics_output_blob_resource.go @@ -64,13 +64,6 @@ func resourceStreamAnalyticsOutputBlob() *pluginsdk.Resource { Required: true, }, - "storage_account_key": { - Type: pluginsdk.TypeString, - Required: true, - Sensitive: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - "storage_account_name": { Type: pluginsdk.TypeString, Required: true, @@ -91,6 +84,16 @@ func resourceStreamAnalyticsOutputBlob() *pluginsdk.Resource { "serialization": schemaStreamAnalyticsOutputSerialization(), + "authentication_mode": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(streamanalytics.AuthenticationModeConnectionString), + ValidateFunc: validation.StringInSlice([]string{ + string(streamanalytics.AuthenticationModeConnectionString), + string(streamanalytics.AuthenticationModeMsi), + }, false), + }, + "batch_max_wait_time": { Type: pluginsdk.TypeString, Optional: true, @@ -101,6 +104,13 @@ func resourceStreamAnalyticsOutputBlob() *pluginsdk.Resource { Optional: true, ValidateFunc: validation.FloatBetween(0, 10000), }, + + "storage_account_key": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + }, }, } } @@ -129,7 +139,6 @@ func resourceStreamAnalyticsOutputBlobCreateUpdate(d *pluginsdk.ResourceData, me containerName := d.Get("storage_container_name").(string) dateFormat := d.Get("date_format").(string) pathPattern := d.Get("path_pattern").(string) - storageAccountKey := d.Get("storage_account_key").(string) storageAccountName := d.Get("storage_account_name").(string) timeFormat := d.Get("time_format").(string) @@ -147,14 +156,15 @@ func resourceStreamAnalyticsOutputBlobCreateUpdate(d *pluginsdk.ResourceData, me BlobOutputDataSourceProperties: &streamanalytics.BlobOutputDataSourceProperties{ StorageAccounts: &[]streamanalytics.StorageAccount{ { - AccountKey: utils.String(storageAccountKey), + AccountKey: getStorageAccountKey(d.Get("storage_account_key").(string)), AccountName: utils.String(storageAccountName), }, }, - Container: utils.String(containerName), - DateFormat: utils.String(dateFormat), - PathPattern: utils.String(pathPattern), - TimeFormat: utils.String(timeFormat), + Container: utils.String(containerName), + DateFormat: utils.String(dateFormat), + PathPattern: utils.String(pathPattern), + TimeFormat: utils.String(timeFormat), + AuthenticationMode: streamanalytics.AuthenticationMode(d.Get("authentication_mode").(string)), }, }, Serialization: serialization, @@ -223,6 +233,7 @@ func resourceStreamAnalyticsOutputBlobRead(d *pluginsdk.ResourceData, meta inter d.Set("path_pattern", v.PathPattern) d.Set("storage_container_name", v.Container) d.Set("time_format", v.TimeFormat) + d.Set("authentication_mode", v.AuthenticationMode) if accounts := v.StorageAccounts; accounts != nil && len(*accounts) > 0 { account := (*accounts)[0] @@ -257,3 +268,11 @@ func resourceStreamAnalyticsOutputBlobDelete(d *pluginsdk.ResourceData, meta int return nil } + +func getStorageAccountKey(input string) *string { + if input == "" { + return nil + } + + return utils.String(input) +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/stream_analytics_stream_input_eventhub_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/stream_analytics_stream_input_eventhub_resource.go index ceea43f8d46..3cdc193f346 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/stream_analytics_stream_input_eventhub_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/stream_analytics_stream_input_eventhub_resource.go @@ -89,6 +89,16 @@ func resourceStreamAnalyticsStreamInputEventHub() *pluginsdk.Resource { ValidateFunc: validation.StringIsNotEmpty, }, + "authentication_mode": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(streamanalytics.AuthenticationModeConnectionString), + ValidateFunc: validation.StringInSlice([]string{ + string(streamanalytics.AuthenticationModeMsi), + string(streamanalytics.AuthenticationModeConnectionString), + }, false), + }, + "serialization": schemaStreamAnalyticsStreamInputSerialization(), }, } @@ -127,6 +137,7 @@ func resourceStreamAnalyticsStreamInputEventHubCreateUpdate(d *pluginsdk.Resourc SharedAccessPolicyKey: utils.String(d.Get("shared_access_policy_key").(string)), SharedAccessPolicyName: utils.String(d.Get("shared_access_policy_name").(string)), ConsumerGroupName: utils.String(d.Get("eventhub_consumer_group_name").(string)), + AuthenticationMode: streamanalytics.AuthenticationMode(d.Get("authentication_mode").(string)), } props := streamanalytics.Input{ @@ -194,6 +205,7 @@ func resourceStreamAnalyticsStreamInputEventHubRead(d *pluginsdk.ResourceData, m d.Set("eventhub_name", eventHub.EventHubName) d.Set("servicebus_namespace", eventHub.ServiceBusNamespace) d.Set("shared_access_policy_name", eventHub.SharedAccessPolicyName) + d.Set("authentication_mode", eventHub.AuthenticationMode) consumerGroupName := "" if eventHub.ConsumerGroupName != nil { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/synapse_integration_runtime_azure_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/synapse_integration_runtime_azure_resource.go index a48e0e3a352..7191b27d034 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/synapse_integration_runtime_azure_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/synapse_integration_runtime_azure_resource.go @@ -6,6 +6,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/synapse/mgmt/2021-03-01/synapse" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -54,7 +55,17 @@ func resourceSynapseIntegrationRuntimeAzure() *pluginsdk.Resource { ValidateFunc: validate.WorkspaceID, }, - "location": azure.SchemaLocation(), + "location": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.Any( + location.EnhancedValidate, + validation.StringInSlice([]string{"AutoResolve"}, false), + ), + StateFunc: location.StateFunc, + DiffSuppressFunc: location.DiffSuppressFunc, + }, "compute_type": { Type: pluginsdk.TypeString, diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/synapse_workspace_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/synapse_workspace_resource.go index a96d91e07f0..e71372210f7 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/synapse_workspace_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/synapse_workspace_resource.go @@ -14,12 +14,12 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" networkValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate" - purviewValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -278,7 +278,7 @@ func resourceSynapseWorkspace() *pluginsdk.Resource { "purview_id": { Type: pluginsdk.TypeString, Optional: true, - ValidateFunc: purviewValidate.AccountID, + ValidateFunc: account.ValidateAccountID, }, "sql_identity_control_enabled": { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/azure_endpoint_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/azure_endpoint_resource.go index e7810a6e4bc..311c08de788 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/azure_endpoint_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/azure_endpoint_resource.go @@ -5,13 +5,12 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints" + "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" azSchema "github.com/hashicorp/terraform-provider-azurerm/internal/tf/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -57,7 +56,7 @@ func resourceAzureEndpoint() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.TrafficManagerProfileID, + ValidateFunc: profiles.ValidateTrafficManagerProfileID, }, "target_resource_id": { @@ -68,7 +67,8 @@ func resourceAzureEndpoint() *pluginsdk.Resource { "weight": { Type: pluginsdk.TypeInt, - Required: true, + Optional: true, + Computed: true, ValidateFunc: validation.IntBetween(1, 1000), }, @@ -143,12 +143,12 @@ func resourceAzureEndpointCreateUpdate(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - profileId, err := parse.TrafficManagerProfileID(d.Get("profile_id").(string)) + profileId, err := profiles.ParseTrafficManagerProfileID(d.Get("profile_id").(string)) if err != nil { return fmt.Errorf("parsing `profile_id`: %+v", err) } - id := endpoints.NewEndpointTypeID(profileId.SubscriptionId, profileId.ResourceGroup, profileId.Name, endpoints.EndpointTypeAzureEndpoints, d.Get("name").(string)) + id := endpoints.NewEndpointTypeID(profileId.SubscriptionId, profileId.ResourceGroupName, profileId.ProfileName, endpoints.EndpointTypeAzureEndpoints, d.Get("name").(string)) if d.IsNewResource() { existing, err := client.Get(ctx, id) if err != nil { @@ -175,7 +175,6 @@ func resourceAzureEndpointCreateUpdate(d *pluginsdk.ResourceData, meta interface EndpointStatus: &status, TargetResourceId: utils.String(d.Get("target_resource_id").(string)), Subnets: expandEndpointSubnetConfig(d.Get("subnet").([]interface{})), - Weight: utils.Int64(int64(d.Get("weight").(int))), }, } @@ -183,6 +182,10 @@ func resourceAzureEndpointCreateUpdate(d *pluginsdk.ResourceData, meta interface params.Properties.Priority = utils.Int64(int64(priority)) } + if weight := d.Get("weight").(int); weight != 0 { + params.Properties.Weight = utils.Int64(int64(weight)) + } + inputMappings := d.Get("geo_mappings").([]interface{}) geoMappings := make([]string, 0) for _, v := range inputMappings { @@ -220,7 +223,7 @@ func resourceAzureEndpointRead(d *pluginsdk.ResourceData, meta interface{}) erro } d.Set("name", id.EndpointName) - d.Set("profile_id", parse.NewTrafficManagerProfileID(id.SubscriptionId, id.ResourceGroupName, id.ProfileName).ID()) + d.Set("profile_id", profiles.NewTrafficManagerProfileID(id.SubscriptionId, id.ResourceGroupName, id.ProfileName).ID()) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/client/client.go index 53a2a5e7fa8..0df9b3f246a 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/client/client.go @@ -1,10 +1,10 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints" + "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies" + "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/endpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/endpoint.go index 87a37713a76..2de125a423f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/endpoint.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/endpoint.go @@ -1,7 +1,7 @@ package trafficmanager import ( - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints" + "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints" "github.com/hashicorp/terraform-provider-azurerm/utils" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/external_endpoint_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/external_endpoint_resource.go index 10913809c3e..ce759b9ed30 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/external_endpoint_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/external_endpoint_resource.go @@ -6,12 +6,11 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints" + "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" azSchema "github.com/hashicorp/terraform-provider-azurerm/internal/tf/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -57,7 +56,7 @@ func resourceExternalEndpoint() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.TrafficManagerProfileID, + ValidateFunc: profiles.ValidateTrafficManagerProfileID, }, "target": { @@ -68,7 +67,8 @@ func resourceExternalEndpoint() *pluginsdk.Resource { "weight": { Type: pluginsdk.TypeInt, - Required: true, + Optional: true, + Computed: true, ValidateFunc: validation.IntBetween(1, 1000), }, @@ -151,12 +151,12 @@ func resourceExternalEndpointCreateUpdate(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - profileId, err := parse.TrafficManagerProfileID(d.Get("profile_id").(string)) + profileId, err := profiles.ParseTrafficManagerProfileID(d.Get("profile_id").(string)) if err != nil { return fmt.Errorf("parsing `profile_id`: %+v", err) } - id := endpoints.NewEndpointTypeID(profileId.SubscriptionId, profileId.ResourceGroup, profileId.Name, endpoints.EndpointTypeExternalEndpoints, d.Get("name").(string)) + id := endpoints.NewEndpointTypeID(profileId.SubscriptionId, profileId.ResourceGroupName, profileId.ProfileName, endpoints.EndpointTypeExternalEndpoints, d.Get("name").(string)) if d.IsNewResource() { existing, err := client.Get(ctx, id) if err != nil { @@ -183,7 +183,6 @@ func resourceExternalEndpointCreateUpdate(d *pluginsdk.ResourceData, meta interf EndpointStatus: &status, Target: utils.String(d.Get("target").(string)), Subnets: expandEndpointSubnetConfig(d.Get("subnet").([]interface{})), - Weight: utils.Int64(int64(d.Get("weight").(int))), }, } @@ -191,6 +190,10 @@ func resourceExternalEndpointCreateUpdate(d *pluginsdk.ResourceData, meta interf params.Properties.Priority = utils.Int64(int64(priority)) } + if weight := d.Get("weight").(int); weight != 0 { + params.Properties.Weight = utils.Int64(int64(weight)) + } + if endpointLocation := d.Get("endpoint_location").(string); endpointLocation != "" { params.Properties.EndpointLocation = utils.String(endpointLocation) } @@ -232,7 +235,7 @@ func resourceExternalEndpointRead(d *pluginsdk.ResourceData, meta interface{}) e } d.Set("name", id.EndpointName) - d.Set("profile_id", parse.NewTrafficManagerProfileID(id.SubscriptionId, id.ResourceGroupName, id.ProfileName).ID()) + d.Set("profile_id", profiles.NewTrafficManagerProfileID(id.SubscriptionId, id.ResourceGroupName, id.ProfileName).ID()) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/nested_endpoint_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/nested_endpoint_resource.go index 6c3d2a1f6eb..0c88213af08 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/nested_endpoint_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/nested_endpoint_resource.go @@ -6,13 +6,12 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints" + "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" azSchema "github.com/hashicorp/terraform-provider-azurerm/internal/tf/schema" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -58,7 +57,7 @@ func resourceNestedEndpoint() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.TrafficManagerProfileID, + ValidateFunc: profiles.ValidateTrafficManagerProfileID, }, "target_resource_id": { @@ -69,7 +68,8 @@ func resourceNestedEndpoint() *pluginsdk.Resource { "weight": { Type: pluginsdk.TypeInt, - Required: true, + Optional: true, + Computed: true, ValidateFunc: validation.IntBetween(1, 1000), }, @@ -168,12 +168,12 @@ func resourceNestedEndpointCreateUpdate(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - profileId, err := parse.TrafficManagerProfileID(d.Get("profile_id").(string)) + profileId, err := profiles.ParseTrafficManagerProfileID(d.Get("profile_id").(string)) if err != nil { return fmt.Errorf("parsing `profile_id`: %+v", err) } - id := endpoints.NewEndpointTypeID(profileId.SubscriptionId, profileId.ResourceGroup, profileId.Name, endpoints.EndpointTypeNestedEndpoints, d.Get("name").(string)) + id := endpoints.NewEndpointTypeID(profileId.SubscriptionId, profileId.ResourceGroupName, profileId.ProfileName, endpoints.EndpointTypeNestedEndpoints, d.Get("name").(string)) if d.IsNewResource() { existing, err := client.Get(ctx, id) @@ -202,10 +202,13 @@ func resourceNestedEndpointCreateUpdate(d *pluginsdk.ResourceData, meta interfac MinChildEndpoints: utils.Int64(int64(d.Get("minimum_child_endpoints").(int))), TargetResourceId: utils.String(d.Get("target_resource_id").(string)), Subnets: expandEndpointSubnetConfig(d.Get("subnet").([]interface{})), - Weight: utils.Int64(int64(d.Get("weight").(int))), }, } + if weight := d.Get("weight").(int); weight != 0 { + params.Properties.Weight = utils.Int64(int64(weight)) + } + minChildEndpointsIPv4 := d.Get("minimum_required_child_endpoints_ipv4").(int) if minChildEndpointsIPv4 > 0 { params.Properties.MinChildEndpointsIPv4 = utils.Int64(int64(minChildEndpointsIPv4)) @@ -261,7 +264,7 @@ func resourceNestedEndpointRead(d *pluginsdk.ResourceData, meta interface{}) err } d.Set("name", id.EndpointName) - d.Set("profile_id", parse.NewTrafficManagerProfileID(id.SubscriptionId, id.ResourceGroupName, id.ProfileName).ID()) + d.Set("profile_id", profiles.NewTrafficManagerProfileID(id.SubscriptionId, id.ResourceGroupName, id.ProfileName).ID()) if model := resp.Model; model != nil { if props := model.Properties; props != nil { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse/azure_endpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse/azure_endpoint.go deleted file mode 100644 index 2c8c511b124..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse/azure_endpoint.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type AzureEndpointId struct { - SubscriptionId string - ResourceGroup string - TrafficManagerProfileName string - Name string -} - -func NewAzureEndpointID(subscriptionId, resourceGroup, trafficManagerProfileName, name string) AzureEndpointId { - return AzureEndpointId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - TrafficManagerProfileName: trafficManagerProfileName, - Name: name, - } -} - -func (id AzureEndpointId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Traffic Manager Profile Name %q", id.TrafficManagerProfileName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Azure Endpoint", segmentsStr) -} - -func (id AzureEndpointId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/trafficManagerProfiles/%s/azureEndpoints/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.TrafficManagerProfileName, id.Name) -} - -// AzureEndpointID parses a AzureEndpoint ID into an AzureEndpointId struct -func AzureEndpointID(input string) (*AzureEndpointId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := AzureEndpointId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.TrafficManagerProfileName, err = id.PopSegment("trafficManagerProfiles"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("azureEndpoints"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse/external_endpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse/external_endpoint.go deleted file mode 100644 index bfec9cf331b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse/external_endpoint.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type ExternalEndpointId struct { - SubscriptionId string - ResourceGroup string - TrafficManagerProfileName string - Name string -} - -func NewExternalEndpointID(subscriptionId, resourceGroup, trafficManagerProfileName, name string) ExternalEndpointId { - return ExternalEndpointId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - TrafficManagerProfileName: trafficManagerProfileName, - Name: name, - } -} - -func (id ExternalEndpointId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Traffic Manager Profile Name %q", id.TrafficManagerProfileName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "External Endpoint", segmentsStr) -} - -func (id ExternalEndpointId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/trafficManagerProfiles/%s/externalEndpoints/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.TrafficManagerProfileName, id.Name) -} - -// ExternalEndpointID parses a ExternalEndpoint ID into an ExternalEndpointId struct -func ExternalEndpointID(input string) (*ExternalEndpointId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := ExternalEndpointId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.TrafficManagerProfileName, err = id.PopSegment("trafficManagerProfiles"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("externalEndpoints"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse/nested_endpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse/nested_endpoint.go deleted file mode 100644 index 816b14e75c9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse/nested_endpoint.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type NestedEndpointId struct { - SubscriptionId string - ResourceGroup string - TrafficManagerProfileName string - Name string -} - -func NewNestedEndpointID(subscriptionId, resourceGroup, trafficManagerProfileName, name string) NestedEndpointId { - return NestedEndpointId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - TrafficManagerProfileName: trafficManagerProfileName, - Name: name, - } -} - -func (id NestedEndpointId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Traffic Manager Profile Name %q", id.TrafficManagerProfileName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Nested Endpoint", segmentsStr) -} - -func (id NestedEndpointId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/trafficManagerProfiles/%s/nestedEndpoints/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.TrafficManagerProfileName, id.Name) -} - -// NestedEndpointID parses a NestedEndpoint ID into an NestedEndpointId struct -func NestedEndpointID(input string) (*NestedEndpointId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := NestedEndpointId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.TrafficManagerProfileName, err = id.PopSegment("trafficManagerProfiles"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("nestedEndpoints"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse/traffic_manager_profile.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse/traffic_manager_profile.go deleted file mode 100644 index 8642f61d92c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse/traffic_manager_profile.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type TrafficManagerProfileId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewTrafficManagerProfileID(subscriptionId, resourceGroup, name string) TrafficManagerProfileId { - return TrafficManagerProfileId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id TrafficManagerProfileId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Traffic Manager Profile", segmentsStr) -} - -func (id TrafficManagerProfileId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/trafficManagerProfiles/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// TrafficManagerProfileID parses a TrafficManagerProfile ID into an TrafficManagerProfileId struct -func TrafficManagerProfileID(input string) (*TrafficManagerProfileId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := TrafficManagerProfileId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("trafficManagerProfiles"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/resourceids.go deleted file mode 100644 index f2f9ebb298a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/resourceids.go +++ /dev/null @@ -1,6 +0,0 @@ -package trafficmanager - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=AzureEndpoint -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/trafficManagerProfiles/trafficManagerProfile1/azureEndpoints/azureEndpoint1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ExternalEndpoint -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/trafficManagerProfiles/trafficManagerProfile1/externalEndpoints/externalEndpoint1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=NestedEndpoint -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/trafficManagerProfiles/trafficManagerProfile1/nestedEndpoints/nestedEndpoint1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=TrafficManagerProfile -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/trafficManagerProfiles/trafficManagerProfile1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/client.go deleted file mode 100644 index c08e2ef0e8c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package endpoints - -import "github.com/Azure/go-autorest/autorest" - -type EndpointsClient struct { - Client autorest.Client - baseUri string -} - -func NewEndpointsClientWithBaseURI(endpoint string) EndpointsClient { - return EndpointsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/constants.go deleted file mode 100644 index 49f6f381843..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/constants.go +++ /dev/null @@ -1,102 +0,0 @@ -package endpoints - -import "strings" - -type EndpointMonitorStatus string - -const ( - EndpointMonitorStatusCheckingEndpoint EndpointMonitorStatus = "CheckingEndpoint" - EndpointMonitorStatusDegraded EndpointMonitorStatus = "Degraded" - EndpointMonitorStatusDisabled EndpointMonitorStatus = "Disabled" - EndpointMonitorStatusInactive EndpointMonitorStatus = "Inactive" - EndpointMonitorStatusOnline EndpointMonitorStatus = "Online" - EndpointMonitorStatusStopped EndpointMonitorStatus = "Stopped" -) - -func PossibleValuesForEndpointMonitorStatus() []string { - return []string{ - string(EndpointMonitorStatusCheckingEndpoint), - string(EndpointMonitorStatusDegraded), - string(EndpointMonitorStatusDisabled), - string(EndpointMonitorStatusInactive), - string(EndpointMonitorStatusOnline), - string(EndpointMonitorStatusStopped), - } -} - -func parseEndpointMonitorStatus(input string) (*EndpointMonitorStatus, error) { - vals := map[string]EndpointMonitorStatus{ - "checkingendpoint": EndpointMonitorStatusCheckingEndpoint, - "degraded": EndpointMonitorStatusDegraded, - "disabled": EndpointMonitorStatusDisabled, - "inactive": EndpointMonitorStatusInactive, - "online": EndpointMonitorStatusOnline, - "stopped": EndpointMonitorStatusStopped, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointMonitorStatus(input) - return &out, nil -} - -type EndpointStatus string - -const ( - EndpointStatusDisabled EndpointStatus = "Disabled" - EndpointStatusEnabled EndpointStatus = "Enabled" -) - -func PossibleValuesForEndpointStatus() []string { - return []string{ - string(EndpointStatusDisabled), - string(EndpointStatusEnabled), - } -} - -func parseEndpointStatus(input string) (*EndpointStatus, error) { - vals := map[string]EndpointStatus{ - "disabled": EndpointStatusDisabled, - "enabled": EndpointStatusEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointStatus(input) - return &out, nil -} - -type EndpointType string - -const ( - EndpointTypeAzureEndpoints EndpointType = "AzureEndpoints" - EndpointTypeExternalEndpoints EndpointType = "ExternalEndpoints" - EndpointTypeNestedEndpoints EndpointType = "NestedEndpoints" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeAzureEndpoints), - string(EndpointTypeExternalEndpoints), - string(EndpointTypeNestedEndpoints), - } -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "azureendpoints": EndpointTypeAzureEndpoints, - "externalendpoints": EndpointTypeExternalEndpoints, - "nestedendpoints": EndpointTypeNestedEndpoints, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/method_createorupdate_autorest.go deleted file mode 100644 index af71e508e06..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/method_createorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package endpoints - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateOrUpdateResponse struct { - HttpResponse *http.Response - Model *Endpoint -} - -// CreateOrUpdate ... -func (c EndpointsClient) CreateOrUpdate(ctx context.Context, id EndpointTypeId, input Endpoint) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c EndpointsClient) preparerForCreateOrUpdate(ctx context.Context, id EndpointTypeId, input Endpoint) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c EndpointsClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/method_delete_autorest.go deleted file mode 100644 index 0a6231beedb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/method_delete_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package endpoints - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteResponse struct { - HttpResponse *http.Response - Model *DeleteOperationResult -} - -// Delete ... -func (c EndpointsClient) Delete(ctx context.Context, id EndpointTypeId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c EndpointsClient) preparerForDelete(ctx context.Context, id EndpointTypeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c EndpointsClient) responderForDelete(resp *http.Response) (result DeleteResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/method_get_autorest.go deleted file mode 100644 index 8653e263395..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package endpoints - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *Endpoint -} - -// Get ... -func (c EndpointsClient) Get(ctx context.Context, id EndpointTypeId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c EndpointsClient) preparerForGet(ctx context.Context, id EndpointTypeId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c EndpointsClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/method_update_autorest.go deleted file mode 100644 index 10824e5598a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/method_update_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package endpoints - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UpdateResponse struct { - HttpResponse *http.Response - Model *Endpoint -} - -// Update ... -func (c EndpointsClient) Update(ctx context.Context, id EndpointTypeId, input Endpoint) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "endpoints.EndpointsClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c EndpointsClient) preparerForUpdate(ctx context.Context, id EndpointTypeId, input Endpoint) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c EndpointsClient) responderForUpdate(resp *http.Response) (result UpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/model_deleteoperationresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/model_deleteoperationresult.go deleted file mode 100644 index 877bd01c557..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/model_deleteoperationresult.go +++ /dev/null @@ -1,5 +0,0 @@ -package endpoints - -type DeleteOperationResult struct { - Boolean *bool `json:"boolean,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/model_endpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/model_endpoint.go deleted file mode 100644 index 86d46874477..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/model_endpoint.go +++ /dev/null @@ -1,8 +0,0 @@ -package endpoints - -type Endpoint struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *EndpointProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/model_endpointproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/model_endpointproperties.go deleted file mode 100644 index 3e8f811f523..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/model_endpointproperties.go +++ /dev/null @@ -1,17 +0,0 @@ -package endpoints - -type EndpointProperties struct { - CustomHeaders *[]EndpointPropertiesCustomHeadersInlined `json:"customHeaders,omitempty"` - EndpointLocation *string `json:"endpointLocation,omitempty"` - EndpointMonitorStatus *EndpointMonitorStatus `json:"endpointMonitorStatus,omitempty"` - EndpointStatus *EndpointStatus `json:"endpointStatus,omitempty"` - GeoMapping *[]string `json:"geoMapping,omitempty"` - MinChildEndpoints *int64 `json:"minChildEndpoints,omitempty"` - MinChildEndpointsIPv4 *int64 `json:"minChildEndpointsIPv4,omitempty"` - MinChildEndpointsIPv6 *int64 `json:"minChildEndpointsIPv6,omitempty"` - Priority *int64 `json:"priority,omitempty"` - Subnets *[]EndpointPropertiesSubnetsInlined `json:"subnets,omitempty"` - Target *string `json:"target,omitempty"` - TargetResourceId *string `json:"targetResourceId,omitempty"` - Weight *int64 `json:"weight,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/model_endpointpropertiescustomheadersinlined.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/model_endpointpropertiescustomheadersinlined.go deleted file mode 100644 index e8d91cff0da..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/model_endpointpropertiescustomheadersinlined.go +++ /dev/null @@ -1,6 +0,0 @@ -package endpoints - -type EndpointPropertiesCustomHeadersInlined struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/model_endpointpropertiessubnetsinlined.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/model_endpointpropertiessubnetsinlined.go deleted file mode 100644 index daa31031957..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/model_endpointpropertiessubnetsinlined.go +++ /dev/null @@ -1,7 +0,0 @@ -package endpoints - -type EndpointPropertiesSubnetsInlined struct { - First *string `json:"first,omitempty"` - Last *string `json:"last,omitempty"` - Scope *int64 `json:"scope,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/version.go deleted file mode 100644 index e06982d2817..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package endpoints - -import "fmt" - -const defaultApiVersion = "2018-08-01" - -func userAgent() string { - return fmt.Sprintf("pandora/endpoints/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/client.go deleted file mode 100644 index aea786916d5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package geographichierarchies - -import "github.com/Azure/go-autorest/autorest" - -type GeographicHierarchiesClient struct { - Client autorest.Client - baseUri string -} - -func NewGeographicHierarchiesClientWithBaseURI(endpoint string) GeographicHierarchiesClient { - return GeographicHierarchiesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/model_geographichierarchyproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/model_geographichierarchyproperties.go deleted file mode 100644 index 2ba59f501fa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/model_geographichierarchyproperties.go +++ /dev/null @@ -1,5 +0,0 @@ -package geographichierarchies - -type GeographicHierarchyProperties struct { - GeographicHierarchy *Region `json:"geographicHierarchy,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/model_region.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/model_region.go deleted file mode 100644 index 739bd0b947e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/model_region.go +++ /dev/null @@ -1,7 +0,0 @@ -package geographichierarchies - -type Region struct { - Code *string `json:"code,omitempty"` - Name *string `json:"name,omitempty"` - Regions *[]Region `json:"regions,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/model_trafficmanagergeographichierarchy.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/model_trafficmanagergeographichierarchy.go deleted file mode 100644 index 0d36aa9d865..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/model_trafficmanagergeographichierarchy.go +++ /dev/null @@ -1,8 +0,0 @@ -package geographichierarchies - -type TrafficManagerGeographicHierarchy struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *GeographicHierarchyProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/version.go deleted file mode 100644 index b108523aaca..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package geographichierarchies - -import "fmt" - -const defaultApiVersion = "2018-08-01" - -func userAgent() string { - return fmt.Sprintf("pandora/geographichierarchies/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/client.go deleted file mode 100644 index fdc3312f7cb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package profiles - -import "github.com/Azure/go-autorest/autorest" - -type ProfilesClient struct { - Client autorest.Client - baseUri string -} - -func NewProfilesClientWithBaseURI(endpoint string) ProfilesClient { - return ProfilesClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/constants.go deleted file mode 100644 index 48a20d219b8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/constants.go +++ /dev/null @@ -1,269 +0,0 @@ -package profiles - -import "strings" - -type AllowedEndpointRecordType string - -const ( - AllowedEndpointRecordTypeAny AllowedEndpointRecordType = "Any" - AllowedEndpointRecordTypeDomainName AllowedEndpointRecordType = "DomainName" - AllowedEndpointRecordTypeIPvFourAddress AllowedEndpointRecordType = "IPv4Address" - AllowedEndpointRecordTypeIPvSixAddress AllowedEndpointRecordType = "IPv6Address" -) - -func PossibleValuesForAllowedEndpointRecordType() []string { - return []string{ - string(AllowedEndpointRecordTypeAny), - string(AllowedEndpointRecordTypeDomainName), - string(AllowedEndpointRecordTypeIPvFourAddress), - string(AllowedEndpointRecordTypeIPvSixAddress), - } -} - -func parseAllowedEndpointRecordType(input string) (*AllowedEndpointRecordType, error) { - vals := map[string]AllowedEndpointRecordType{ - "any": AllowedEndpointRecordTypeAny, - "domainname": AllowedEndpointRecordTypeDomainName, - "ipv4address": AllowedEndpointRecordTypeIPvFourAddress, - "ipv6address": AllowedEndpointRecordTypeIPvSixAddress, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AllowedEndpointRecordType(input) - return &out, nil -} - -type EndpointMonitorStatus string - -const ( - EndpointMonitorStatusCheckingEndpoint EndpointMonitorStatus = "CheckingEndpoint" - EndpointMonitorStatusDegraded EndpointMonitorStatus = "Degraded" - EndpointMonitorStatusDisabled EndpointMonitorStatus = "Disabled" - EndpointMonitorStatusInactive EndpointMonitorStatus = "Inactive" - EndpointMonitorStatusOnline EndpointMonitorStatus = "Online" - EndpointMonitorStatusStopped EndpointMonitorStatus = "Stopped" -) - -func PossibleValuesForEndpointMonitorStatus() []string { - return []string{ - string(EndpointMonitorStatusCheckingEndpoint), - string(EndpointMonitorStatusDegraded), - string(EndpointMonitorStatusDisabled), - string(EndpointMonitorStatusInactive), - string(EndpointMonitorStatusOnline), - string(EndpointMonitorStatusStopped), - } -} - -func parseEndpointMonitorStatus(input string) (*EndpointMonitorStatus, error) { - vals := map[string]EndpointMonitorStatus{ - "checkingendpoint": EndpointMonitorStatusCheckingEndpoint, - "degraded": EndpointMonitorStatusDegraded, - "disabled": EndpointMonitorStatusDisabled, - "inactive": EndpointMonitorStatusInactive, - "online": EndpointMonitorStatusOnline, - "stopped": EndpointMonitorStatusStopped, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointMonitorStatus(input) - return &out, nil -} - -type EndpointStatus string - -const ( - EndpointStatusDisabled EndpointStatus = "Disabled" - EndpointStatusEnabled EndpointStatus = "Enabled" -) - -func PossibleValuesForEndpointStatus() []string { - return []string{ - string(EndpointStatusDisabled), - string(EndpointStatusEnabled), - } -} - -func parseEndpointStatus(input string) (*EndpointStatus, error) { - vals := map[string]EndpointStatus{ - "disabled": EndpointStatusDisabled, - "enabled": EndpointStatusEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointStatus(input) - return &out, nil -} - -type MonitorProtocol string - -const ( - MonitorProtocolHTTP MonitorProtocol = "HTTP" - MonitorProtocolHTTPS MonitorProtocol = "HTTPS" - MonitorProtocolTCP MonitorProtocol = "TCP" -) - -func PossibleValuesForMonitorProtocol() []string { - return []string{ - string(MonitorProtocolHTTP), - string(MonitorProtocolHTTPS), - string(MonitorProtocolTCP), - } -} - -func parseMonitorProtocol(input string) (*MonitorProtocol, error) { - vals := map[string]MonitorProtocol{ - "http": MonitorProtocolHTTP, - "https": MonitorProtocolHTTPS, - "tcp": MonitorProtocolTCP, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := MonitorProtocol(input) - return &out, nil -} - -type ProfileMonitorStatus string - -const ( - ProfileMonitorStatusCheckingEndpoints ProfileMonitorStatus = "CheckingEndpoints" - ProfileMonitorStatusDegraded ProfileMonitorStatus = "Degraded" - ProfileMonitorStatusDisabled ProfileMonitorStatus = "Disabled" - ProfileMonitorStatusInactive ProfileMonitorStatus = "Inactive" - ProfileMonitorStatusOnline ProfileMonitorStatus = "Online" -) - -func PossibleValuesForProfileMonitorStatus() []string { - return []string{ - string(ProfileMonitorStatusCheckingEndpoints), - string(ProfileMonitorStatusDegraded), - string(ProfileMonitorStatusDisabled), - string(ProfileMonitorStatusInactive), - string(ProfileMonitorStatusOnline), - } -} - -func parseProfileMonitorStatus(input string) (*ProfileMonitorStatus, error) { - vals := map[string]ProfileMonitorStatus{ - "checkingendpoints": ProfileMonitorStatusCheckingEndpoints, - "degraded": ProfileMonitorStatusDegraded, - "disabled": ProfileMonitorStatusDisabled, - "inactive": ProfileMonitorStatusInactive, - "online": ProfileMonitorStatusOnline, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProfileMonitorStatus(input) - return &out, nil -} - -type ProfileStatus string - -const ( - ProfileStatusDisabled ProfileStatus = "Disabled" - ProfileStatusEnabled ProfileStatus = "Enabled" -) - -func PossibleValuesForProfileStatus() []string { - return []string{ - string(ProfileStatusDisabled), - string(ProfileStatusEnabled), - } -} - -func parseProfileStatus(input string) (*ProfileStatus, error) { - vals := map[string]ProfileStatus{ - "disabled": ProfileStatusDisabled, - "enabled": ProfileStatusEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProfileStatus(input) - return &out, nil -} - -type TrafficRoutingMethod string - -const ( - TrafficRoutingMethodGeographic TrafficRoutingMethod = "Geographic" - TrafficRoutingMethodMultiValue TrafficRoutingMethod = "MultiValue" - TrafficRoutingMethodPerformance TrafficRoutingMethod = "Performance" - TrafficRoutingMethodPriority TrafficRoutingMethod = "Priority" - TrafficRoutingMethodSubnet TrafficRoutingMethod = "Subnet" - TrafficRoutingMethodWeighted TrafficRoutingMethod = "Weighted" -) - -func PossibleValuesForTrafficRoutingMethod() []string { - return []string{ - string(TrafficRoutingMethodGeographic), - string(TrafficRoutingMethodMultiValue), - string(TrafficRoutingMethodPerformance), - string(TrafficRoutingMethodPriority), - string(TrafficRoutingMethodSubnet), - string(TrafficRoutingMethodWeighted), - } -} - -func parseTrafficRoutingMethod(input string) (*TrafficRoutingMethod, error) { - vals := map[string]TrafficRoutingMethod{ - "geographic": TrafficRoutingMethodGeographic, - "multivalue": TrafficRoutingMethodMultiValue, - "performance": TrafficRoutingMethodPerformance, - "priority": TrafficRoutingMethodPriority, - "subnet": TrafficRoutingMethodSubnet, - "weighted": TrafficRoutingMethodWeighted, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := TrafficRoutingMethod(input) - return &out, nil -} - -type TrafficViewEnrollmentStatus string - -const ( - TrafficViewEnrollmentStatusDisabled TrafficViewEnrollmentStatus = "Disabled" - TrafficViewEnrollmentStatusEnabled TrafficViewEnrollmentStatus = "Enabled" -) - -func PossibleValuesForTrafficViewEnrollmentStatus() []string { - return []string{ - string(TrafficViewEnrollmentStatusDisabled), - string(TrafficViewEnrollmentStatusEnabled), - } -} - -func parseTrafficViewEnrollmentStatus(input string) (*TrafficViewEnrollmentStatus, error) { - vals := map[string]TrafficViewEnrollmentStatus{ - "disabled": TrafficViewEnrollmentStatusDisabled, - "enabled": TrafficViewEnrollmentStatusEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := TrafficViewEnrollmentStatus(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_createorupdate_autorest.go deleted file mode 100644 index ada9d6bbf1f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_createorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package profiles - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type CreateOrUpdateResponse struct { - HttpResponse *http.Response - Model *Profile -} - -// CreateOrUpdate ... -func (c ProfilesClient) CreateOrUpdate(ctx context.Context, id TrafficManagerProfileId, input Profile) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ProfilesClient) preparerForCreateOrUpdate(ctx context.Context, id TrafficManagerProfileId, input Profile) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (c ProfilesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_delete_autorest.go deleted file mode 100644 index 6a7ecf0e2b7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_delete_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package profiles - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type DeleteResponse struct { - HttpResponse *http.Response - Model *DeleteOperationResult -} - -// Delete ... -func (c ProfilesClient) Delete(ctx context.Context, id TrafficManagerProfileId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Delete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Delete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForDelete prepares the Delete request. -func (c ProfilesClient) preparerForDelete(ctx context.Context, id TrafficManagerProfileId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForDelete handles the response to the Delete request. The method always -// closes the http.Response Body. -func (c ProfilesClient) responderForDelete(resp *http.Response) (result DeleteResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_get_autorest.go deleted file mode 100644 index 583ce12902e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package profiles - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *Profile -} - -// Get ... -func (c ProfilesClient) Get(ctx context.Context, id TrafficManagerProfileId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ProfilesClient) preparerForGet(ctx context.Context, id TrafficManagerProfileId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ProfilesClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_listbyresourcegroup_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_listbyresourcegroup_autorest.go deleted file mode 100644 index e6e540adcaa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_listbyresourcegroup_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package profiles - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -type ListByResourceGroupResponse struct { - HttpResponse *http.Response - Model *ProfileListResult -} - -// ListByResourceGroup ... -func (c ProfilesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupResponse, err error) { - req, err := c.preparerForListByResourceGroup(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByResourceGroup(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListByResourceGroup prepares the ListByResourceGroup request. -func (c ProfilesClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/trafficManagerProfiles", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (c ProfilesClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_listbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_listbysubscription_autorest.go deleted file mode 100644 index 5ce8bcf1f7b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_listbysubscription_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package profiles - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -) - -type ListBySubscriptionResponse struct { - HttpResponse *http.Response - Model *ProfileListResult -} - -// ListBySubscription ... -func (c ProfilesClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionResponse, err error) { - req, err := c.preparerForListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "ListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "ListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForListBySubscription prepares the ListBySubscription request. -func (c ProfilesClient) preparerForListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Network/trafficManagerProfiles", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListBySubscription handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (c ProfilesClient) responderForListBySubscription(resp *http.Response) (result ListBySubscriptionResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_update_autorest.go deleted file mode 100644 index 58150bb9a05..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/method_update_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package profiles - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type UpdateResponse struct { - HttpResponse *http.Response - Model *Profile -} - -// Update ... -func (c ProfilesClient) Update(ctx context.Context, id TrafficManagerProfileId, input Profile) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Update", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "profiles.ProfilesClient", "Update", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForUpdate prepares the Update request. -func (c ProfilesClient) preparerForUpdate(ctx context.Context, id TrafficManagerProfileId, input Profile) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForUpdate handles the response to the Update request. The method always -// closes the http.Response Body. -func (c ProfilesClient) responderForUpdate(resp *http.Response) (result UpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_checktrafficmanagerrelativednsnameavailabilityparameters.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_checktrafficmanagerrelativednsnameavailabilityparameters.go deleted file mode 100644 index ae243a44228..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_checktrafficmanagerrelativednsnameavailabilityparameters.go +++ /dev/null @@ -1,6 +0,0 @@ -package profiles - -type CheckTrafficManagerRelativeDnsNameAvailabilityParameters struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_deleteoperationresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_deleteoperationresult.go deleted file mode 100644 index 146e45d2a3c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_deleteoperationresult.go +++ /dev/null @@ -1,5 +0,0 @@ -package profiles - -type DeleteOperationResult struct { - Boolean *bool `json:"boolean,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_dnsconfig.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_dnsconfig.go deleted file mode 100644 index 64dfd2a0754..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_dnsconfig.go +++ /dev/null @@ -1,7 +0,0 @@ -package profiles - -type DnsConfig struct { - Fqdn *string `json:"fqdn,omitempty"` - RelativeName *string `json:"relativeName,omitempty"` - Ttl *int64 `json:"ttl,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_endpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_endpoint.go deleted file mode 100644 index ad85a2da5ff..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_endpoint.go +++ /dev/null @@ -1,8 +0,0 @@ -package profiles - -type Endpoint struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *EndpointProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_endpointproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_endpointproperties.go deleted file mode 100644 index abf056069db..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_endpointproperties.go +++ /dev/null @@ -1,17 +0,0 @@ -package profiles - -type EndpointProperties struct { - CustomHeaders *[]EndpointPropertiesCustomHeadersInlined `json:"customHeaders,omitempty"` - EndpointLocation *string `json:"endpointLocation,omitempty"` - EndpointMonitorStatus *EndpointMonitorStatus `json:"endpointMonitorStatus,omitempty"` - EndpointStatus *EndpointStatus `json:"endpointStatus,omitempty"` - GeoMapping *[]string `json:"geoMapping,omitempty"` - MinChildEndpoints *int64 `json:"minChildEndpoints,omitempty"` - MinChildEndpointsIPv4 *int64 `json:"minChildEndpointsIPv4,omitempty"` - MinChildEndpointsIPv6 *int64 `json:"minChildEndpointsIPv6,omitempty"` - Priority *int64 `json:"priority,omitempty"` - Subnets *[]EndpointPropertiesSubnetsInlined `json:"subnets,omitempty"` - Target *string `json:"target,omitempty"` - TargetResourceId *string `json:"targetResourceId,omitempty"` - Weight *int64 `json:"weight,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_endpointpropertiescustomheadersinlined.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_endpointpropertiescustomheadersinlined.go deleted file mode 100644 index c7458ae637e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_endpointpropertiescustomheadersinlined.go +++ /dev/null @@ -1,6 +0,0 @@ -package profiles - -type EndpointPropertiesCustomHeadersInlined struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_endpointpropertiessubnetsinlined.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_endpointpropertiessubnetsinlined.go deleted file mode 100644 index 9af896e651f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_endpointpropertiessubnetsinlined.go +++ /dev/null @@ -1,7 +0,0 @@ -package profiles - -type EndpointPropertiesSubnetsInlined struct { - First *string `json:"first,omitempty"` - Last *string `json:"last,omitempty"` - Scope *int64 `json:"scope,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_monitorconfigcustomheadersinlined.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_monitorconfigcustomheadersinlined.go deleted file mode 100644 index b7ec16387b3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_monitorconfigcustomheadersinlined.go +++ /dev/null @@ -1,6 +0,0 @@ -package profiles - -type MonitorConfigCustomHeadersInlined struct { - Name *string `json:"name,omitempty"` - Value *string `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_monitorconfigexpectedstatuscoderangesinlined.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_monitorconfigexpectedstatuscoderangesinlined.go deleted file mode 100644 index 07d98934fb8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_monitorconfigexpectedstatuscoderangesinlined.go +++ /dev/null @@ -1,6 +0,0 @@ -package profiles - -type MonitorConfigExpectedStatusCodeRangesInlined struct { - Max *int64 `json:"max,omitempty"` - Min *int64 `json:"min,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_profile.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_profile.go deleted file mode 100644 index f13b6f6556d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_profile.go +++ /dev/null @@ -1,10 +0,0 @@ -package profiles - -type Profile struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *ProfileProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_profilelistresult.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_profilelistresult.go deleted file mode 100644 index 4e0e77a74b9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_profilelistresult.go +++ /dev/null @@ -1,5 +0,0 @@ -package profiles - -type ProfileListResult struct { - Value *[]Profile `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_trafficmanagernameavailability.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_trafficmanagernameavailability.go deleted file mode 100644 index 5e40fe0aa74..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/model_trafficmanagernameavailability.go +++ /dev/null @@ -1,9 +0,0 @@ -package profiles - -type TrafficManagerNameAvailability struct { - Message *string `json:"message,omitempty"` - Name *string `json:"name,omitempty"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason *string `json:"reason,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/version.go deleted file mode 100644 index 6effe508bf9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package profiles - -import "fmt" - -const defaultApiVersion = "2018-08-01" - -func userAgent() string { - return fmt.Sprintf("pandora/profiles/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/traffic_manager_geographical_location_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/traffic_manager_geographical_location_data_source.go index dde7dbe53e2..99c8a8a9bcb 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/traffic_manager_geographical_location_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/traffic_manager_geographical_location_data_source.go @@ -5,8 +5,8 @@ import ( "strings" "time" + "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/traffic_manager_profile_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/traffic_manager_profile_data_source.go index 09187cfa0bf..ae8d9e094a0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/traffic_manager_profile_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/traffic_manager_profile_data_source.go @@ -7,8 +7,8 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/traffic_manager_profile_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/traffic_manager_profile_resource.go index d815eaf300b..3e2849f64a0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/traffic_manager_profile_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/traffic_manager_profile_resource.go @@ -10,10 +10,10 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles" "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate/azure_endpoint_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate/azure_endpoint_id.go deleted file mode 100644 index 88fc523856a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate/azure_endpoint_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse" -) - -func AzureEndpointID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.AzureEndpointID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate/external_endpoint_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate/external_endpoint_id.go deleted file mode 100644 index 61ba78a396d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate/external_endpoint_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse" -) - -func ExternalEndpointID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.ExternalEndpointID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate/nested_endpoint_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate/nested_endpoint_id.go deleted file mode 100644 index 01731b3215a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate/nested_endpoint_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse" -) - -func NestedEndpointID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.NestedEndpointID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate/traffic_manager_profile_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate/traffic_manager_profile_id.go deleted file mode 100644 index 11d213139ed..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate/traffic_manager_profile_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse" -) - -func TrafficManagerProfileID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.TrafficManagerProfileID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/client/client.go index 6a42143427f..a5379cc15cb 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/client/client.go @@ -1,20 +1,25 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules" + "github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer" ) type Client struct { - VideoAnalyzersClient *videoanalyzer.VideoAnalyzerClient + EdgeModuleClient *edgemodules.EdgeModulesClient + VideoAnalyzersClient *videoanalyzers.VideoAnalyzersClient } func NewClient(o *common.ClientOptions) *Client { - VideoAnalyzersClient := videoanalyzer.NewVideoAnalyzerClientWithBaseURI(o.ResourceManagerEndpoint) + edgeModulesClient := edgemodules.NewEdgeModulesClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&edgeModulesClient.Client, o.ResourceManagerAuthorizer) - o.ConfigureClient(&VideoAnalyzersClient.Client, o.ResourceManagerAuthorizer) + videoAnalyzersClient := videoanalyzers.NewVideoAnalyzersClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&videoAnalyzersClient.Client, o.ResourceManagerAuthorizer) return &Client{ - VideoAnalyzersClient: &VideoAnalyzersClient, + EdgeModuleClient: &edgeModulesClient, + VideoAnalyzersClient: &videoAnalyzersClient, } } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/parse/edge_module.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/parse/edge_module.go deleted file mode 100644 index 03aac8d8df0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/parse/edge_module.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type EdgeModuleId struct { - SubscriptionId string - ResourceGroup string - VideoAnalyzerName string - Name string -} - -func NewEdgeModuleID(subscriptionId, resourceGroup, videoAnalyzerName, name string) EdgeModuleId { - return EdgeModuleId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - VideoAnalyzerName: videoAnalyzerName, - Name: name, - } -} - -func (id EdgeModuleId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Video Analyzer Name %q", id.VideoAnalyzerName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Edge Module", segmentsStr) -} - -func (id EdgeModuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s/edgeModules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.VideoAnalyzerName, id.Name) -} - -// EdgeModuleID parses a EdgeModule ID into an EdgeModuleId struct -func EdgeModuleID(input string) (*EdgeModuleId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := EdgeModuleId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.VideoAnalyzerName, err = id.PopSegment("videoAnalyzers"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("edgeModules"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/parse/video_analyzer.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/parse/video_analyzer.go deleted file mode 100644 index 3921685e955..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/parse/video_analyzer.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type VideoAnalyzerId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewVideoAnalyzerID(subscriptionId, resourceGroup, name string) VideoAnalyzerId { - return VideoAnalyzerId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id VideoAnalyzerId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Video Analyzer", segmentsStr) -} - -func (id VideoAnalyzerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// VideoAnalyzerID parses a VideoAnalyzer ID into an VideoAnalyzerId struct -func VideoAnalyzerID(input string) (*VideoAnalyzerId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := VideoAnalyzerId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("videoAnalyzers"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/resourceids.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/resourceids.go deleted file mode 100644 index bd6ed899a77..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/resourceids.go +++ /dev/null @@ -1,4 +0,0 @@ -package videoanalyzer - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=VideoAnalyzer -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Media/videoAnalyzers/analyzer1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=EdgeModule -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Media/videoAnalyzers/analyzer1/edgeModules/edgemodule1 diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/client.go deleted file mode 100644 index 4bced2b1220..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package videoanalyzer - -import "github.com/Azure/go-autorest/autorest" - -type VideoAnalyzerClient struct { - Client autorest.Client - baseUri string -} - -func NewVideoAnalyzerClientWithBaseURI(endpoint string) VideoAnalyzerClient { - return VideoAnalyzerClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/constants.go deleted file mode 100644 index e5c22ea9ffd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/constants.go +++ /dev/null @@ -1,230 +0,0 @@ -package videoanalyzer - -import "strings" - -type AccessPolicyEccAlgo string - -const ( - AccessPolicyEccAlgoESFiveOneTwo AccessPolicyEccAlgo = "ES512" - AccessPolicyEccAlgoESThreeEightFour AccessPolicyEccAlgo = "ES384" - AccessPolicyEccAlgoESTwoFiveSix AccessPolicyEccAlgo = "ES256" -) - -func PossibleValuesForAccessPolicyEccAlgo() []string { - return []string{ - string(AccessPolicyEccAlgoESFiveOneTwo), - string(AccessPolicyEccAlgoESThreeEightFour), - string(AccessPolicyEccAlgoESTwoFiveSix), - } -} - -func parseAccessPolicyEccAlgo(input string) (*AccessPolicyEccAlgo, error) { - vals := map[string]AccessPolicyEccAlgo{ - "es512": AccessPolicyEccAlgoESFiveOneTwo, - "es384": AccessPolicyEccAlgoESThreeEightFour, - "es256": AccessPolicyEccAlgoESTwoFiveSix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccessPolicyEccAlgo(input) - return &out, nil -} - -type AccessPolicyRole string - -const ( - AccessPolicyRoleReader AccessPolicyRole = "Reader" -) - -func PossibleValuesForAccessPolicyRole() []string { - return []string{ - string(AccessPolicyRoleReader), - } -} - -func parseAccessPolicyRole(input string) (*AccessPolicyRole, error) { - vals := map[string]AccessPolicyRole{ - "reader": AccessPolicyRoleReader, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccessPolicyRole(input) - return &out, nil -} - -type AccessPolicyRsaAlgo string - -const ( - AccessPolicyRsaAlgoRSFiveOneTwo AccessPolicyRsaAlgo = "RS512" - AccessPolicyRsaAlgoRSThreeEightFour AccessPolicyRsaAlgo = "RS384" - AccessPolicyRsaAlgoRSTwoFiveSix AccessPolicyRsaAlgo = "RS256" -) - -func PossibleValuesForAccessPolicyRsaAlgo() []string { - return []string{ - string(AccessPolicyRsaAlgoRSFiveOneTwo), - string(AccessPolicyRsaAlgoRSThreeEightFour), - string(AccessPolicyRsaAlgoRSTwoFiveSix), - } -} - -func parseAccessPolicyRsaAlgo(input string) (*AccessPolicyRsaAlgo, error) { - vals := map[string]AccessPolicyRsaAlgo{ - "rs512": AccessPolicyRsaAlgoRSFiveOneTwo, - "rs384": AccessPolicyRsaAlgoRSThreeEightFour, - "rs256": AccessPolicyRsaAlgoRSTwoFiveSix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccessPolicyRsaAlgo(input) - return &out, nil -} - -type AccountEncryptionKeyType string - -const ( - AccountEncryptionKeyTypeCustomerKey AccountEncryptionKeyType = "CustomerKey" - AccountEncryptionKeyTypeSystemKey AccountEncryptionKeyType = "SystemKey" -) - -func PossibleValuesForAccountEncryptionKeyType() []string { - return []string{ - string(AccountEncryptionKeyTypeCustomerKey), - string(AccountEncryptionKeyTypeSystemKey), - } -} - -func parseAccountEncryptionKeyType(input string) (*AccountEncryptionKeyType, error) { - vals := map[string]AccountEncryptionKeyType{ - "customerkey": AccountEncryptionKeyTypeCustomerKey, - "systemkey": AccountEncryptionKeyTypeSystemKey, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccountEncryptionKeyType(input) - return &out, nil -} - -type CheckNameAvailabilityReason string - -const ( - CheckNameAvailabilityReasonAlreadyExists CheckNameAvailabilityReason = "AlreadyExists" - CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" -) - -func PossibleValuesForCheckNameAvailabilityReason() []string { - return []string{ - string(CheckNameAvailabilityReasonAlreadyExists), - string(CheckNameAvailabilityReasonInvalid), - } -} - -func parseCheckNameAvailabilityReason(input string) (*CheckNameAvailabilityReason, error) { - vals := map[string]CheckNameAvailabilityReason{ - "alreadyexists": CheckNameAvailabilityReasonAlreadyExists, - "invalid": CheckNameAvailabilityReasonInvalid, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CheckNameAvailabilityReason(input) - return &out, nil -} - -type CreatedByType string - -const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" -) - -func PossibleValuesForCreatedByType() []string { - return []string{ - string(CreatedByTypeApplication), - string(CreatedByTypeKey), - string(CreatedByTypeManagedIdentity), - string(CreatedByTypeUser), - } -} - -func parseCreatedByType(input string) (*CreatedByType, error) { - vals := map[string]CreatedByType{ - "application": CreatedByTypeApplication, - "key": CreatedByTypeKey, - "managedidentity": CreatedByTypeManagedIdentity, - "user": CreatedByTypeUser, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CreatedByType(input) - return &out, nil -} - -type VideoAnalyzerEndpointType string - -const ( - VideoAnalyzerEndpointTypeClientApi VideoAnalyzerEndpointType = "ClientApi" -) - -func PossibleValuesForVideoAnalyzerEndpointType() []string { - return []string{ - string(VideoAnalyzerEndpointTypeClientApi), - } -} - -func parseVideoAnalyzerEndpointType(input string) (*VideoAnalyzerEndpointType, error) { - vals := map[string]VideoAnalyzerEndpointType{ - "clientapi": VideoAnalyzerEndpointTypeClientApi, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VideoAnalyzerEndpointType(input) - return &out, nil -} - -type VideoType string - -const ( - VideoTypeArchive VideoType = "Archive" -) - -func PossibleValuesForVideoType() []string { - return []string{ - string(VideoTypeArchive), - } -} - -func parseVideoType(input string) (*VideoType, error) { - vals := map[string]VideoType{ - "archive": VideoTypeArchive, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VideoType(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_accesspolicies.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_accesspolicies.go deleted file mode 100644 index 858b038713c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_accesspolicies.go +++ /dev/null @@ -1,137 +0,0 @@ -package videoanalyzer - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = AccessPoliciesId{} - -// AccessPoliciesId is a struct representing the Resource ID for a Access Policies -type AccessPoliciesId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - AccessPolicyName string -} - -// NewAccessPoliciesID returns a new AccessPoliciesId struct -func NewAccessPoliciesID(subscriptionId string, resourceGroupName string, accountName string, accessPolicyName string) AccessPoliciesId { - return AccessPoliciesId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - AccessPolicyName: accessPolicyName, - } -} - -// ParseAccessPoliciesID parses 'input' into a AccessPoliciesId -func ParseAccessPoliciesID(input string) (*AccessPoliciesId, error) { - parser := resourceids.NewParserFromResourceIdType(AccessPoliciesId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AccessPoliciesId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.AccessPolicyName, ok = parsed.Parsed["accessPolicyName"]; !ok { - return nil, fmt.Errorf("the segment 'accessPolicyName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseAccessPoliciesIDInsensitively parses 'input' case-insensitively into a AccessPoliciesId -// note: this method should only be used for API response data and not user input -func ParseAccessPoliciesIDInsensitively(input string) (*AccessPoliciesId, error) { - parser := resourceids.NewParserFromResourceIdType(AccessPoliciesId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := AccessPoliciesId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.AccessPolicyName, ok = parsed.Parsed["accessPolicyName"]; !ok { - return nil, fmt.Errorf("the segment 'accessPolicyName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateAccessPoliciesID checks that 'input' can be parsed as a Access Policies ID -func ValidateAccessPoliciesID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseAccessPoliciesID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Access Policies ID -func (id AccessPoliciesId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s/accessPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.AccessPolicyName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Access Policies ID -func (id AccessPoliciesId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticVideoAnalyzers", "videoAnalyzers", "videoAnalyzers"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticAccessPolicies", "accessPolicies", "accessPolicies"), - resourceids.UserSpecifiedSegment("accessPolicyName", "accessPolicyValue"), - } -} - -// String returns a human-readable description of this Access Policies ID -func (id AccessPoliciesId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Access Policy Name: %q", id.AccessPolicyName), - } - return fmt.Sprintf("Access Policies (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_location.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_location.go deleted file mode 100644 index 2a9a9f71588..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_location.go +++ /dev/null @@ -1,111 +0,0 @@ -package videoanalyzer - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = LocationId{} - -// LocationId is a struct representing the Resource ID for a Location -type LocationId struct { - SubscriptionId string - LocationName string -} - -// NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, locationName string) LocationId { - return LocationId{ - SubscriptionId: subscriptionId, - LocationName: locationName, - } -} - -// ParseLocationID parses 'input' into a LocationId -func ParseLocationID(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId -// note: this method should only be used for API response data and not user input -func ParseLocationIDInsensitively(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateLocationID checks that 'input' can be parsed as a Location ID -func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseLocationID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Location ID -func (id LocationId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.Media/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Location ID -func (id LocationId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("locationName", "locationValue"), - } -} - -// String returns a human-readable description of this Location ID -func (id LocationId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location Name: %q", id.LocationName), - } - return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_resourcegroup.go deleted file mode 100644 index 81fcb1da957..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package videoanalyzer - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_subscription.go deleted file mode 100644 index 59eaf25c68d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package videoanalyzer - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_video.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_video.go deleted file mode 100644 index c6139ec3b38..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_video.go +++ /dev/null @@ -1,137 +0,0 @@ -package videoanalyzer - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = VideoId{} - -// VideoId is a struct representing the Resource ID for a Video -type VideoId struct { - SubscriptionId string - ResourceGroupName string - AccountName string - VideoName string -} - -// NewVideoID returns a new VideoId struct -func NewVideoID(subscriptionId string, resourceGroupName string, accountName string, videoName string) VideoId { - return VideoId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - VideoName: videoName, - } -} - -// ParseVideoID parses 'input' into a VideoId -func ParseVideoID(input string) (*VideoId, error) { - parser := resourceids.NewParserFromResourceIdType(VideoId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := VideoId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.VideoName, ok = parsed.Parsed["videoName"]; !ok { - return nil, fmt.Errorf("the segment 'videoName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseVideoIDInsensitively parses 'input' case-insensitively into a VideoId -// note: this method should only be used for API response data and not user input -func ParseVideoIDInsensitively(input string) (*VideoId, error) { - parser := resourceids.NewParserFromResourceIdType(VideoId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := VideoId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - if id.VideoName, ok = parsed.Parsed["videoName"]; !ok { - return nil, fmt.Errorf("the segment 'videoName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateVideoID checks that 'input' can be parsed as a Video ID -func ValidateVideoID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseVideoID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Video ID -func (id VideoId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s/videos/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.VideoName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Video ID -func (id VideoId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticVideoAnalyzers", "videoAnalyzers", "videoAnalyzers"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - resourceids.StaticSegment("staticVideos", "videos", "videos"), - resourceids.UserSpecifiedSegment("videoName", "videoValue"), - } -} - -// String returns a human-readable description of this Video ID -func (id VideoId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - fmt.Sprintf("Video Name: %q", id.VideoName), - } - return fmt.Sprintf("Video (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_videoanalyzer.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_videoanalyzer.go deleted file mode 100644 index 8eba6a0e47c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/id_videoanalyzer.go +++ /dev/null @@ -1,124 +0,0 @@ -package videoanalyzer - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = VideoAnalyzerId{} - -// VideoAnalyzerId is a struct representing the Resource ID for a Video Analyzer -type VideoAnalyzerId struct { - SubscriptionId string - ResourceGroupName string - AccountName string -} - -// NewVideoAnalyzerID returns a new VideoAnalyzerId struct -func NewVideoAnalyzerID(subscriptionId string, resourceGroupName string, accountName string) VideoAnalyzerId { - return VideoAnalyzerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - AccountName: accountName, - } -} - -// ParseVideoAnalyzerID parses 'input' into a VideoAnalyzerId -func ParseVideoAnalyzerID(input string) (*VideoAnalyzerId, error) { - parser := resourceids.NewParserFromResourceIdType(VideoAnalyzerId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := VideoAnalyzerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseVideoAnalyzerIDInsensitively parses 'input' case-insensitively into a VideoAnalyzerId -// note: this method should only be used for API response data and not user input -func ParseVideoAnalyzerIDInsensitively(input string) (*VideoAnalyzerId, error) { - parser := resourceids.NewParserFromResourceIdType(VideoAnalyzerId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := VideoAnalyzerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateVideoAnalyzerID checks that 'input' can be parsed as a Video Analyzer ID -func ValidateVideoAnalyzerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseVideoAnalyzerID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Video Analyzer ID -func (id VideoAnalyzerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Video Analyzer ID -func (id VideoAnalyzerId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticVideoAnalyzers", "videoAnalyzers", "videoAnalyzers"), - resourceids.UserSpecifiedSegment("accountName", "accountValue"), - } -} - -// String returns a human-readable description of this Video Analyzer ID -func (id VideoAnalyzerId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Account Name: %q", id.AccountName), - } - return fmt.Sprintf("Video Analyzer (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_accesspoliciescreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_accesspoliciescreateorupdate_autorest.go deleted file mode 100644 index dcf76b8bce1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_accesspoliciescreateorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package videoanalyzer - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type AccessPoliciesCreateOrUpdateResponse struct { - HttpResponse *http.Response - Model *AccessPolicyEntity -} - -// AccessPoliciesCreateOrUpdate ... -func (c VideoAnalyzerClient) AccessPoliciesCreateOrUpdate(ctx context.Context, id AccessPoliciesId, input AccessPolicyEntity) (result AccessPoliciesCreateOrUpdateResponse, err error) { - req, err := c.preparerForAccessPoliciesCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAccessPoliciesCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAccessPoliciesCreateOrUpdate prepares the AccessPoliciesCreateOrUpdate request. -func (c VideoAnalyzerClient) preparerForAccessPoliciesCreateOrUpdate(ctx context.Context, id AccessPoliciesId, input AccessPolicyEntity) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAccessPoliciesCreateOrUpdate handles the response to the AccessPoliciesCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForAccessPoliciesCreateOrUpdate(resp *http.Response) (result AccessPoliciesCreateOrUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_accesspoliciesdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_accesspoliciesdelete_autorest.go deleted file mode 100644 index 387585db0ff..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_accesspoliciesdelete_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package videoanalyzer - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type AccessPoliciesDeleteResponse struct { - HttpResponse *http.Response -} - -// AccessPoliciesDelete ... -func (c VideoAnalyzerClient) AccessPoliciesDelete(ctx context.Context, id AccessPoliciesId) (result AccessPoliciesDeleteResponse, err error) { - req, err := c.preparerForAccessPoliciesDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAccessPoliciesDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAccessPoliciesDelete prepares the AccessPoliciesDelete request. -func (c VideoAnalyzerClient) preparerForAccessPoliciesDelete(ctx context.Context, id AccessPoliciesId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAccessPoliciesDelete handles the response to the AccessPoliciesDelete request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForAccessPoliciesDelete(resp *http.Response) (result AccessPoliciesDeleteResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_accesspoliciesget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_accesspoliciesget_autorest.go deleted file mode 100644 index 9fa53dc1fbc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_accesspoliciesget_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package videoanalyzer - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type AccessPoliciesGetResponse struct { - HttpResponse *http.Response - Model *AccessPolicyEntity -} - -// AccessPoliciesGet ... -func (c VideoAnalyzerClient) AccessPoliciesGet(ctx context.Context, id AccessPoliciesId) (result AccessPoliciesGetResponse, err error) { - req, err := c.preparerForAccessPoliciesGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAccessPoliciesGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAccessPoliciesGet prepares the AccessPoliciesGet request. -func (c VideoAnalyzerClient) preparerForAccessPoliciesGet(ctx context.Context, id AccessPoliciesId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAccessPoliciesGet handles the response to the AccessPoliciesGet request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForAccessPoliciesGet(resp *http.Response) (result AccessPoliciesGetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_accesspolicieslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_accesspolicieslist_autorest.go deleted file mode 100644 index fea4af426bf..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_accesspolicieslist_autorest.go +++ /dev/null @@ -1,205 +0,0 @@ -package videoanalyzer - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type AccessPoliciesListResponse struct { - HttpResponse *http.Response - Model *[]AccessPolicyEntity - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (AccessPoliciesListResponse, error) -} - -type AccessPoliciesListCompleteResult struct { - Items []AccessPolicyEntity -} - -func (r AccessPoliciesListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r AccessPoliciesListResponse) LoadMore(ctx context.Context) (resp AccessPoliciesListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type AccessPoliciesListOptions struct { - Top *int64 -} - -func DefaultAccessPoliciesListOptions() AccessPoliciesListOptions { - return AccessPoliciesListOptions{} -} - -func (o AccessPoliciesListOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// AccessPoliciesList ... -func (c VideoAnalyzerClient) AccessPoliciesList(ctx context.Context, id VideoAnalyzerId, options AccessPoliciesListOptions) (resp AccessPoliciesListResponse, err error) { - req, err := c.preparerForAccessPoliciesList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForAccessPoliciesList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// AccessPoliciesListComplete retrieves all of the results into a single object -func (c VideoAnalyzerClient) AccessPoliciesListComplete(ctx context.Context, id VideoAnalyzerId, options AccessPoliciesListOptions) (AccessPoliciesListCompleteResult, error) { - return c.AccessPoliciesListCompleteMatchingPredicate(ctx, id, options, AccessPolicyEntityPredicate{}) -} - -// AccessPoliciesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c VideoAnalyzerClient) AccessPoliciesListCompleteMatchingPredicate(ctx context.Context, id VideoAnalyzerId, options AccessPoliciesListOptions, predicate AccessPolicyEntityPredicate) (resp AccessPoliciesListCompleteResult, err error) { - items := make([]AccessPolicyEntity, 0) - - page, err := c.AccessPoliciesList(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := AccessPoliciesListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForAccessPoliciesList prepares the AccessPoliciesList request. -func (c VideoAnalyzerClient) preparerForAccessPoliciesList(ctx context.Context, id VideoAnalyzerId, options AccessPoliciesListOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/accessPolicies", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForAccessPoliciesListWithNextLink prepares the AccessPoliciesList request with the given nextLink token. -func (c VideoAnalyzerClient) preparerForAccessPoliciesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAccessPoliciesList handles the response to the AccessPoliciesList request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForAccessPoliciesList(resp *http.Response) (result AccessPoliciesListResponse, err error) { - type page struct { - Values []AccessPolicyEntity `json:"value"` - NextLink *string `json:"@nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result AccessPoliciesListResponse, err error) { - req, err := c.preparerForAccessPoliciesListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAccessPoliciesList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_accesspoliciesupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_accesspoliciesupdate_autorest.go deleted file mode 100644 index a50ca140077..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_accesspoliciesupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package videoanalyzer - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type AccessPoliciesUpdateResponse struct { - HttpResponse *http.Response - Model *AccessPolicyEntity -} - -// AccessPoliciesUpdate ... -func (c VideoAnalyzerClient) AccessPoliciesUpdate(ctx context.Context, id AccessPoliciesId, input AccessPolicyEntity) (result AccessPoliciesUpdateResponse, err error) { - req, err := c.preparerForAccessPoliciesUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForAccessPoliciesUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "AccessPoliciesUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForAccessPoliciesUpdate prepares the AccessPoliciesUpdate request. -func (c VideoAnalyzerClient) preparerForAccessPoliciesUpdate(ctx context.Context, id AccessPoliciesId, input AccessPolicyEntity) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForAccessPoliciesUpdate handles the response to the AccessPoliciesUpdate request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForAccessPoliciesUpdate(resp *http.Response) (result AccessPoliciesUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_edgemodulescreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_edgemodulescreateorupdate_autorest.go deleted file mode 100644 index dfa060a08d0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_edgemodulescreateorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package videoanalyzer - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type EdgeModulesCreateOrUpdateResponse struct { - HttpResponse *http.Response - Model *EdgeModuleEntity -} - -// EdgeModulesCreateOrUpdate ... -func (c VideoAnalyzerClient) EdgeModulesCreateOrUpdate(ctx context.Context, id EdgeModuleId, input EdgeModuleEntity) (result EdgeModulesCreateOrUpdateResponse, err error) { - req, err := c.preparerForEdgeModulesCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForEdgeModulesCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForEdgeModulesCreateOrUpdate prepares the EdgeModulesCreateOrUpdate request. -func (c VideoAnalyzerClient) preparerForEdgeModulesCreateOrUpdate(ctx context.Context, id EdgeModuleId, input EdgeModuleEntity) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForEdgeModulesCreateOrUpdate handles the response to the EdgeModulesCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForEdgeModulesCreateOrUpdate(resp *http.Response) (result EdgeModulesCreateOrUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_edgemodulesdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_edgemodulesdelete_autorest.go deleted file mode 100644 index fc9361d96d8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_edgemodulesdelete_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package videoanalyzer - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type EdgeModulesDeleteResponse struct { - HttpResponse *http.Response -} - -// EdgeModulesDelete ... -func (c VideoAnalyzerClient) EdgeModulesDelete(ctx context.Context, id EdgeModuleId) (result EdgeModulesDeleteResponse, err error) { - req, err := c.preparerForEdgeModulesDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForEdgeModulesDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForEdgeModulesDelete prepares the EdgeModulesDelete request. -func (c VideoAnalyzerClient) preparerForEdgeModulesDelete(ctx context.Context, id EdgeModuleId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForEdgeModulesDelete handles the response to the EdgeModulesDelete request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForEdgeModulesDelete(resp *http.Response) (result EdgeModulesDeleteResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_edgemodulesget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_edgemodulesget_autorest.go deleted file mode 100644 index e9dcbf746bc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_edgemodulesget_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package videoanalyzer - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type EdgeModulesGetResponse struct { - HttpResponse *http.Response - Model *EdgeModuleEntity -} - -// EdgeModulesGet ... -func (c VideoAnalyzerClient) EdgeModulesGet(ctx context.Context, id EdgeModuleId) (result EdgeModulesGetResponse, err error) { - req, err := c.preparerForEdgeModulesGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForEdgeModulesGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForEdgeModulesGet prepares the EdgeModulesGet request. -func (c VideoAnalyzerClient) preparerForEdgeModulesGet(ctx context.Context, id EdgeModuleId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForEdgeModulesGet handles the response to the EdgeModulesGet request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForEdgeModulesGet(resp *http.Response) (result EdgeModulesGetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_edgemoduleslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_edgemoduleslist_autorest.go deleted file mode 100644 index b1c1218ea84..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_edgemoduleslist_autorest.go +++ /dev/null @@ -1,215 +0,0 @@ -package videoanalyzer - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type EdgeModulesListResponse struct { - HttpResponse *http.Response - Model *[]EdgeModuleEntity - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (EdgeModulesListResponse, error) -} - -type EdgeModulesListCompleteResult struct { - Items []EdgeModuleEntity -} - -func (r EdgeModulesListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r EdgeModulesListResponse) LoadMore(ctx context.Context) (resp EdgeModulesListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type EdgeModulesListOptions struct { - Filter *string - Orderby *string - Top *int64 -} - -func DefaultEdgeModulesListOptions() EdgeModulesListOptions { - return EdgeModulesListOptions{} -} - -func (o EdgeModulesListOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Orderby != nil { - out["$orderby"] = *o.Orderby - } - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// EdgeModulesList ... -func (c VideoAnalyzerClient) EdgeModulesList(ctx context.Context, id VideoAnalyzerId, options EdgeModulesListOptions) (resp EdgeModulesListResponse, err error) { - req, err := c.preparerForEdgeModulesList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForEdgeModulesList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// EdgeModulesListComplete retrieves all of the results into a single object -func (c VideoAnalyzerClient) EdgeModulesListComplete(ctx context.Context, id VideoAnalyzerId, options EdgeModulesListOptions) (EdgeModulesListCompleteResult, error) { - return c.EdgeModulesListCompleteMatchingPredicate(ctx, id, options, EdgeModuleEntityPredicate{}) -} - -// EdgeModulesListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c VideoAnalyzerClient) EdgeModulesListCompleteMatchingPredicate(ctx context.Context, id VideoAnalyzerId, options EdgeModulesListOptions, predicate EdgeModuleEntityPredicate) (resp EdgeModulesListCompleteResult, err error) { - items := make([]EdgeModuleEntity, 0) - - page, err := c.EdgeModulesList(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := EdgeModulesListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForEdgeModulesList prepares the EdgeModulesList request. -func (c VideoAnalyzerClient) preparerForEdgeModulesList(ctx context.Context, id VideoAnalyzerId, options EdgeModulesListOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/edgeModules", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForEdgeModulesListWithNextLink prepares the EdgeModulesList request with the given nextLink token. -func (c VideoAnalyzerClient) preparerForEdgeModulesListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForEdgeModulesList handles the response to the EdgeModulesList request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForEdgeModulesList(resp *http.Response) (result EdgeModulesListResponse, err error) { - type page struct { - Values []EdgeModuleEntity `json:"value"` - NextLink *string `json:"@nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result EdgeModulesListResponse, err error) { - req, err := c.preparerForEdgeModulesListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForEdgeModulesList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_edgemoduleslistprovisioningtoken_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_edgemoduleslistprovisioningtoken_autorest.go deleted file mode 100644 index dcfd9f1f11f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_edgemoduleslistprovisioningtoken_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package videoanalyzer - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type EdgeModulesListProvisioningTokenResponse struct { - HttpResponse *http.Response - Model *EdgeModuleProvisioningToken -} - -// EdgeModulesListProvisioningToken ... -func (c VideoAnalyzerClient) EdgeModulesListProvisioningToken(ctx context.Context, id EdgeModuleId, input ListProvisioningTokenInput) (result EdgeModulesListProvisioningTokenResponse, err error) { - req, err := c.preparerForEdgeModulesListProvisioningToken(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesListProvisioningToken", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesListProvisioningToken", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForEdgeModulesListProvisioningToken(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "EdgeModulesListProvisioningToken", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForEdgeModulesListProvisioningToken prepares the EdgeModulesListProvisioningToken request. -func (c VideoAnalyzerClient) preparerForEdgeModulesListProvisioningToken(ctx context.Context, id EdgeModuleId, input ListProvisioningTokenInput) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listProvisioningToken", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForEdgeModulesListProvisioningToken handles the response to the EdgeModulesListProvisioningToken request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForEdgeModulesListProvisioningToken(resp *http.Response) (result EdgeModulesListProvisioningTokenResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_locationschecknameavailability_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_locationschecknameavailability_autorest.go deleted file mode 100644 index 5a226b47521..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_locationschecknameavailability_autorest.go +++ /dev/null @@ -1,66 +0,0 @@ -package videoanalyzer - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type LocationsCheckNameAvailabilityResponse struct { - HttpResponse *http.Response - Model *CheckNameAvailabilityResponse -} - -// LocationsCheckNameAvailability ... -func (c VideoAnalyzerClient) LocationsCheckNameAvailability(ctx context.Context, id LocationId, input CheckNameAvailabilityRequest) (result LocationsCheckNameAvailabilityResponse, err error) { - req, err := c.preparerForLocationsCheckNameAvailability(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "LocationsCheckNameAvailability", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "LocationsCheckNameAvailability", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForLocationsCheckNameAvailability(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "LocationsCheckNameAvailability", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForLocationsCheckNameAvailability prepares the LocationsCheckNameAvailability request. -func (c VideoAnalyzerClient) preparerForLocationsCheckNameAvailability(ctx context.Context, id LocationId, input CheckNameAvailabilityRequest) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/checkNameAvailability", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForLocationsCheckNameAvailability handles the response to the LocationsCheckNameAvailability request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForLocationsCheckNameAvailability(resp *http.Response) (result LocationsCheckNameAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzerscreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzerscreateorupdate_autorest.go deleted file mode 100644 index 4590029f40f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzerscreateorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package videoanalyzer - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type VideoAnalyzersCreateOrUpdateResponse struct { - HttpResponse *http.Response - Model *VideoAnalyzer -} - -// VideoAnalyzersCreateOrUpdate ... -func (c VideoAnalyzerClient) VideoAnalyzersCreateOrUpdate(ctx context.Context, id VideoAnalyzerId, input VideoAnalyzer) (result VideoAnalyzersCreateOrUpdateResponse, err error) { - req, err := c.preparerForVideoAnalyzersCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForVideoAnalyzersCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForVideoAnalyzersCreateOrUpdate prepares the VideoAnalyzersCreateOrUpdate request. -func (c VideoAnalyzerClient) preparerForVideoAnalyzersCreateOrUpdate(ctx context.Context, id VideoAnalyzerId, input VideoAnalyzer) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForVideoAnalyzersCreateOrUpdate handles the response to the VideoAnalyzersCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForVideoAnalyzersCreateOrUpdate(resp *http.Response) (result VideoAnalyzersCreateOrUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzersdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzersdelete_autorest.go deleted file mode 100644 index c5b02afbebf..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzersdelete_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package videoanalyzer - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type VideoAnalyzersDeleteResponse struct { - HttpResponse *http.Response -} - -// VideoAnalyzersDelete ... -func (c VideoAnalyzerClient) VideoAnalyzersDelete(ctx context.Context, id VideoAnalyzerId) (result VideoAnalyzersDeleteResponse, err error) { - req, err := c.preparerForVideoAnalyzersDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForVideoAnalyzersDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForVideoAnalyzersDelete prepares the VideoAnalyzersDelete request. -func (c VideoAnalyzerClient) preparerForVideoAnalyzersDelete(ctx context.Context, id VideoAnalyzerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForVideoAnalyzersDelete handles the response to the VideoAnalyzersDelete request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForVideoAnalyzersDelete(resp *http.Response) (result VideoAnalyzersDeleteResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzersget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzersget_autorest.go deleted file mode 100644 index bebf6532d19..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzersget_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package videoanalyzer - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type VideoAnalyzersGetResponse struct { - HttpResponse *http.Response - Model *VideoAnalyzer -} - -// VideoAnalyzersGet ... -func (c VideoAnalyzerClient) VideoAnalyzersGet(ctx context.Context, id VideoAnalyzerId) (result VideoAnalyzersGetResponse, err error) { - req, err := c.preparerForVideoAnalyzersGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForVideoAnalyzersGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForVideoAnalyzersGet prepares the VideoAnalyzersGet request. -func (c VideoAnalyzerClient) preparerForVideoAnalyzersGet(ctx context.Context, id VideoAnalyzerId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForVideoAnalyzersGet handles the response to the VideoAnalyzersGet request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForVideoAnalyzersGet(resp *http.Response) (result VideoAnalyzersGetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzerslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzerslist_autorest.go deleted file mode 100644 index f89f771c378..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzerslist_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package videoanalyzer - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type VideoAnalyzersListResponse struct { - HttpResponse *http.Response - Model *VideoAnalyzerCollection -} - -// VideoAnalyzersList ... -func (c VideoAnalyzerClient) VideoAnalyzersList(ctx context.Context, id ResourceGroupId) (result VideoAnalyzersListResponse, err error) { - req, err := c.preparerForVideoAnalyzersList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForVideoAnalyzersList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersList", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForVideoAnalyzersList prepares the VideoAnalyzersList request. -func (c VideoAnalyzerClient) preparerForVideoAnalyzersList(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Media/videoAnalyzers", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForVideoAnalyzersList handles the response to the VideoAnalyzersList request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForVideoAnalyzersList(resp *http.Response) (result VideoAnalyzersListResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzerslistbysubscription_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzerslistbysubscription_autorest.go deleted file mode 100644 index f04b8474d8e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzerslistbysubscription_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package videoanalyzer - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type VideoAnalyzersListBySubscriptionResponse struct { - HttpResponse *http.Response - Model *VideoAnalyzerCollection -} - -// VideoAnalyzersListBySubscription ... -func (c VideoAnalyzerClient) VideoAnalyzersListBySubscription(ctx context.Context, id SubscriptionId) (result VideoAnalyzersListBySubscriptionResponse, err error) { - req, err := c.preparerForVideoAnalyzersListBySubscription(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersListBySubscription", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersListBySubscription", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForVideoAnalyzersListBySubscription(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersListBySubscription", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForVideoAnalyzersListBySubscription prepares the VideoAnalyzersListBySubscription request. -func (c VideoAnalyzerClient) preparerForVideoAnalyzersListBySubscription(ctx context.Context, id SubscriptionId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Media/videoAnalyzers", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForVideoAnalyzersListBySubscription handles the response to the VideoAnalyzersListBySubscription request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForVideoAnalyzersListBySubscription(resp *http.Response) (result VideoAnalyzersListBySubscriptionResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzerssyncstoragekeys_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzerssyncstoragekeys_autorest.go deleted file mode 100644 index d55667b83b0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzerssyncstoragekeys_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package videoanalyzer - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type VideoAnalyzersSyncStorageKeysResponse struct { - HttpResponse *http.Response -} - -// VideoAnalyzersSyncStorageKeys ... -func (c VideoAnalyzerClient) VideoAnalyzersSyncStorageKeys(ctx context.Context, id VideoAnalyzerId, input SyncStorageKeysInput) (result VideoAnalyzersSyncStorageKeysResponse, err error) { - req, err := c.preparerForVideoAnalyzersSyncStorageKeys(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersSyncStorageKeys", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersSyncStorageKeys", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForVideoAnalyzersSyncStorageKeys(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersSyncStorageKeys", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForVideoAnalyzersSyncStorageKeys prepares the VideoAnalyzersSyncStorageKeys request. -func (c VideoAnalyzerClient) preparerForVideoAnalyzersSyncStorageKeys(ctx context.Context, id VideoAnalyzerId, input SyncStorageKeysInput) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/syncStorageKeys", id.ID())), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForVideoAnalyzersSyncStorageKeys handles the response to the VideoAnalyzersSyncStorageKeys request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForVideoAnalyzersSyncStorageKeys(resp *http.Response) (result VideoAnalyzersSyncStorageKeysResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzersupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzersupdate_autorest.go deleted file mode 100644 index b1b7d656c95..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoanalyzersupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package videoanalyzer - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type VideoAnalyzersUpdateResponse struct { - HttpResponse *http.Response - Model *VideoAnalyzer -} - -// VideoAnalyzersUpdate ... -func (c VideoAnalyzerClient) VideoAnalyzersUpdate(ctx context.Context, id VideoAnalyzerId, input VideoAnalyzerUpdate) (result VideoAnalyzersUpdateResponse, err error) { - req, err := c.preparerForVideoAnalyzersUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForVideoAnalyzersUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideoAnalyzersUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForVideoAnalyzersUpdate prepares the VideoAnalyzersUpdate request. -func (c VideoAnalyzerClient) preparerForVideoAnalyzersUpdate(ctx context.Context, id VideoAnalyzerId, input VideoAnalyzerUpdate) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForVideoAnalyzersUpdate handles the response to the VideoAnalyzersUpdate request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForVideoAnalyzersUpdate(resp *http.Response) (result VideoAnalyzersUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoscreateorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoscreateorupdate_autorest.go deleted file mode 100644 index 8ab0aa31ee1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoscreateorupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package videoanalyzer - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type VideosCreateOrUpdateResponse struct { - HttpResponse *http.Response - Model *VideoEntity -} - -// VideosCreateOrUpdate ... -func (c VideoAnalyzerClient) VideosCreateOrUpdate(ctx context.Context, id VideoId, input VideoEntity) (result VideosCreateOrUpdateResponse, err error) { - req, err := c.preparerForVideosCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosCreateOrUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosCreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForVideosCreateOrUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosCreateOrUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForVideosCreateOrUpdate prepares the VideosCreateOrUpdate request. -func (c VideoAnalyzerClient) preparerForVideosCreateOrUpdate(ctx context.Context, id VideoId, input VideoEntity) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForVideosCreateOrUpdate handles the response to the VideosCreateOrUpdate request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForVideosCreateOrUpdate(resp *http.Response) (result VideosCreateOrUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videosdelete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videosdelete_autorest.go deleted file mode 100644 index a3175c704c0..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videosdelete_autorest.go +++ /dev/null @@ -1,61 +0,0 @@ -package videoanalyzer - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type VideosDeleteResponse struct { - HttpResponse *http.Response -} - -// VideosDelete ... -func (c VideoAnalyzerClient) VideosDelete(ctx context.Context, id VideoId) (result VideosDeleteResponse, err error) { - req, err := c.preparerForVideosDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosDelete", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosDelete", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForVideosDelete(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosDelete", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForVideosDelete prepares the VideosDelete request. -func (c VideoAnalyzerClient) preparerForVideosDelete(ctx context.Context, id VideoId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForVideosDelete handles the response to the VideosDelete request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForVideosDelete(resp *http.Response) (result VideosDeleteResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videosget_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videosget_autorest.go deleted file mode 100644 index a06dd8a73d3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videosget_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package videoanalyzer - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type VideosGetResponse struct { - HttpResponse *http.Response - Model *VideoEntity -} - -// VideosGet ... -func (c VideoAnalyzerClient) VideosGet(ctx context.Context, id VideoId) (result VideosGetResponse, err error) { - req, err := c.preparerForVideosGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosGet", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosGet", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForVideosGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosGet", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForVideosGet prepares the VideosGet request. -func (c VideoAnalyzerClient) preparerForVideosGet(ctx context.Context, id VideoId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForVideosGet handles the response to the VideosGet request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForVideosGet(resp *http.Response) (result VideosGetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoslist_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoslist_autorest.go deleted file mode 100644 index b65a779fe81..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videoslist_autorest.go +++ /dev/null @@ -1,205 +0,0 @@ -package videoanalyzer - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type VideosListResponse struct { - HttpResponse *http.Response - Model *[]VideoEntity - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (VideosListResponse, error) -} - -type VideosListCompleteResult struct { - Items []VideoEntity -} - -func (r VideosListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r VideosListResponse) LoadMore(ctx context.Context) (resp VideosListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type VideosListOptions struct { - Top *int64 -} - -func DefaultVideosListOptions() VideosListOptions { - return VideosListOptions{} -} - -func (o VideosListOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Top != nil { - out["$top"] = *o.Top - } - - return out -} - -// VideosList ... -func (c VideoAnalyzerClient) VideosList(ctx context.Context, id VideoAnalyzerId, options VideosListOptions) (resp VideosListResponse, err error) { - req, err := c.preparerForVideosList(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosList", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosList", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForVideosList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosList", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// VideosListComplete retrieves all of the results into a single object -func (c VideoAnalyzerClient) VideosListComplete(ctx context.Context, id VideoAnalyzerId, options VideosListOptions) (VideosListCompleteResult, error) { - return c.VideosListCompleteMatchingPredicate(ctx, id, options, VideoEntityPredicate{}) -} - -// VideosListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c VideoAnalyzerClient) VideosListCompleteMatchingPredicate(ctx context.Context, id VideoAnalyzerId, options VideosListOptions, predicate VideoEntityPredicate) (resp VideosListCompleteResult, err error) { - items := make([]VideoEntity, 0) - - page, err := c.VideosList(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := VideosListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForVideosList prepares the VideosList request. -func (c VideoAnalyzerClient) preparerForVideosList(ctx context.Context, id VideoAnalyzerId, options VideosListOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/videos", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForVideosListWithNextLink prepares the VideosList request with the given nextLink token. -func (c VideoAnalyzerClient) preparerForVideosListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForVideosList handles the response to the VideosList request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForVideosList(resp *http.Response) (result VideosListResponse, err error) { - type page struct { - Values []VideoEntity `json:"value"` - NextLink *string `json:"@nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result VideosListResponse, err error) { - req, err := c.preparerForVideosListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosList", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosList", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForVideosList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosList", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videosliststreamingtoken_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videosliststreamingtoken_autorest.go deleted file mode 100644 index f794e95f759..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videosliststreamingtoken_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package videoanalyzer - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type VideosListStreamingTokenResponse struct { - HttpResponse *http.Response - Model *VideoStreamingToken -} - -// VideosListStreamingToken ... -func (c VideoAnalyzerClient) VideosListStreamingToken(ctx context.Context, id VideoId) (result VideosListStreamingTokenResponse, err error) { - req, err := c.preparerForVideosListStreamingToken(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosListStreamingToken", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosListStreamingToken", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForVideosListStreamingToken(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosListStreamingToken", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForVideosListStreamingToken prepares the VideosListStreamingToken request. -func (c VideoAnalyzerClient) preparerForVideosListStreamingToken(ctx context.Context, id VideoId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/listStreamingToken", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForVideosListStreamingToken handles the response to the VideosListStreamingToken request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForVideosListStreamingToken(resp *http.Response) (result VideosListStreamingTokenResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videosupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videosupdate_autorest.go deleted file mode 100644 index f84bf9c532d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/method_videosupdate_autorest.go +++ /dev/null @@ -1,65 +0,0 @@ -package videoanalyzer - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type VideosUpdateResponse struct { - HttpResponse *http.Response - Model *VideoEntity -} - -// VideosUpdate ... -func (c VideoAnalyzerClient) VideosUpdate(ctx context.Context, id VideoId, input VideoEntity) (result VideosUpdateResponse, err error) { - req, err := c.preparerForVideosUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosUpdate", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosUpdate", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForVideosUpdate(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "videoanalyzer.VideoAnalyzerClient", "VideosUpdate", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForVideosUpdate prepares the VideosUpdate request. -func (c VideoAnalyzerClient) preparerForVideosUpdate(ctx context.Context, id VideoId, input VideoEntity) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForVideosUpdate handles the response to the VideosUpdate request. The method always -// closes the http.Response Body. -func (c VideoAnalyzerClient) responderForVideosUpdate(resp *http.Response) (result VideosUpdateResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_accesspolicyentity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_accesspolicyentity.go deleted file mode 100644 index 89df6403909..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_accesspolicyentity.go +++ /dev/null @@ -1,9 +0,0 @@ -package videoanalyzer - -type AccessPolicyEntity struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *AccessPolicyProperties `json:"properties,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_accesspolicyproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_accesspolicyproperties.go deleted file mode 100644 index 7f37b8d64ce..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_accesspolicyproperties.go +++ /dev/null @@ -1,37 +0,0 @@ -package videoanalyzer - -import ( - "encoding/json" - "fmt" -) - -type AccessPolicyProperties struct { - Authentication AuthenticationBase `json:"authentication"` - Role *AccessPolicyRole `json:"role,omitempty"` -} - -var _ json.Unmarshaler = &AccessPolicyProperties{} - -func (s *AccessPolicyProperties) UnmarshalJSON(bytes []byte) error { - type alias AccessPolicyProperties - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into AccessPolicyProperties: %+v", err) - } - - s.Role = decoded.Role - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling AccessPolicyProperties into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["authentication"]; ok { - impl, err := unmarshalAuthenticationBaseImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'Authentication' for 'AccessPolicyProperties': %+v", err) - } - s.Authentication = impl - } - return nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_accountencryption.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_accountencryption.go deleted file mode 100644 index df298a38cc9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_accountencryption.go +++ /dev/null @@ -1,8 +0,0 @@ -package videoanalyzer - -type AccountEncryption struct { - Identity *ResourceIdentity `json:"identity,omitempty"` - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` - Status *string `json:"status,omitempty"` - Type AccountEncryptionKeyType `json:"type"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_authenticationbase.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_authenticationbase.go deleted file mode 100644 index e81c2d00f09..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_authenticationbase.go +++ /dev/null @@ -1,45 +0,0 @@ -package videoanalyzer - -import ( - "encoding/json" - "fmt" - "strings" -) - -type AuthenticationBase interface { -} - -func unmarshalAuthenticationBaseImplementation(input []byte) (AuthenticationBase, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling AuthenticationBase into map[string]interface: %+v", err) - } - - value, ok := temp["@type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.VideoAnalyzer.JwtAuthentication") { - var out JwtAuthentication - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into JwtAuthentication: %+v", err) - } - return out, nil - } - - type RawAuthenticationBaseImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawAuthenticationBaseImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_checknameavailabilityrequest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_checknameavailabilityrequest.go deleted file mode 100644 index 37198842ffa..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_checknameavailabilityrequest.go +++ /dev/null @@ -1,6 +0,0 @@ -package videoanalyzer - -type CheckNameAvailabilityRequest struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_checknameavailabilityresponse.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_checknameavailabilityresponse.go deleted file mode 100644 index 47c99cfa8c5..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_checknameavailabilityresponse.go +++ /dev/null @@ -1,7 +0,0 @@ -package videoanalyzer - -type CheckNameAvailabilityResponse struct { - Message *string `json:"message,omitempty"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason *CheckNameAvailabilityReason `json:"reason,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_ecctokenkey.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_ecctokenkey.go deleted file mode 100644 index 3719b34c41b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_ecctokenkey.go +++ /dev/null @@ -1,41 +0,0 @@ -package videoanalyzer - -import ( - "encoding/json" - "fmt" -) - -var _ TokenKey = EccTokenKey{} - -type EccTokenKey struct { - Alg AccessPolicyEccAlgo `json:"alg"` - X string `json:"x"` - Y string `json:"y"` - - // Fields inherited from TokenKey - Kid string `json:"kid"` -} - -var _ json.Marshaler = EccTokenKey{} - -func (s EccTokenKey) MarshalJSON() ([]byte, error) { - type wrapper EccTokenKey - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling EccTokenKey: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling EccTokenKey: %+v", err) - } - decoded["@type"] = "#Microsoft.VideoAnalyzer.EccTokenKey" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling EccTokenKey: %+v", err) - } - - return encoded, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_edgemoduleentity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_edgemoduleentity.go deleted file mode 100644 index a332b9147ea..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_edgemoduleentity.go +++ /dev/null @@ -1,9 +0,0 @@ -package videoanalyzer - -type EdgeModuleEntity struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *EdgeModuleProperties `json:"properties,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_edgemoduleproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_edgemoduleproperties.go deleted file mode 100644 index d07ebec8d0a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_edgemoduleproperties.go +++ /dev/null @@ -1,5 +0,0 @@ -package videoanalyzer - -type EdgeModuleProperties struct { - EdgeModuleId *string `json:"edgeModuleId,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_edgemoduleprovisioningtoken.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_edgemoduleprovisioningtoken.go deleted file mode 100644 index 7bdcee7c0f7..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_edgemoduleprovisioningtoken.go +++ /dev/null @@ -1,24 +0,0 @@ -package videoanalyzer - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type EdgeModuleProvisioningToken struct { - ExpirationDate *string `json:"expirationDate,omitempty"` - Token *string `json:"token,omitempty"` -} - -func (o EdgeModuleProvisioningToken) GetExpirationDateAsTime() (*time.Time, error) { - if o.ExpirationDate == nil { - return nil, nil - } - return dates.ParseAsFormat(o.ExpirationDate, "2006-01-02T15:04:05Z07:00") -} - -func (o EdgeModuleProvisioningToken) SetExpirationDateAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ExpirationDate = &formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_endpoint.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_endpoint.go deleted file mode 100644 index 71ef1c8ecda..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_endpoint.go +++ /dev/null @@ -1,6 +0,0 @@ -package videoanalyzer - -type Endpoint struct { - EndpointUrl *string `json:"endpointUrl,omitempty"` - Type VideoAnalyzerEndpointType `json:"type"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_jwtauthentication.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_jwtauthentication.go deleted file mode 100644 index c9404467d78..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_jwtauthentication.go +++ /dev/null @@ -1,78 +0,0 @@ -package videoanalyzer - -import ( - "encoding/json" - "fmt" -) - -var _ AuthenticationBase = JwtAuthentication{} - -type JwtAuthentication struct { - Audiences *[]string `json:"audiences,omitempty"` - Claims *[]TokenClaim `json:"claims,omitempty"` - Issuers *[]string `json:"issuers,omitempty"` - Keys *[]TokenKey `json:"keys,omitempty"` - - // Fields inherited from AuthenticationBase -} - -var _ json.Marshaler = JwtAuthentication{} - -func (s JwtAuthentication) MarshalJSON() ([]byte, error) { - type wrapper JwtAuthentication - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling JwtAuthentication: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling JwtAuthentication: %+v", err) - } - decoded["@type"] = "#Microsoft.VideoAnalyzer.JwtAuthentication" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling JwtAuthentication: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &JwtAuthentication{} - -func (s *JwtAuthentication) UnmarshalJSON(bytes []byte) error { - type alias JwtAuthentication - var decoded alias - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling into JwtAuthentication: %+v", err) - } - - s.Audiences = decoded.Audiences - s.Claims = decoded.Claims - s.Issuers = decoded.Issuers - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling JwtAuthentication into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["keys"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling Keys into list []json.RawMessage: %+v", err) - } - - output := make([]TokenKey, 0) - for i, val := range listTemp { - impl, err := unmarshalTokenKeyImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'Keys' for 'JwtAuthentication': %+v", i, err) - } - output = append(output, impl) - } - s.Keys = &output - } - return nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_keyvaultproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_keyvaultproperties.go deleted file mode 100644 index fdead912842..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_keyvaultproperties.go +++ /dev/null @@ -1,6 +0,0 @@ -package videoanalyzer - -type KeyVaultProperties struct { - CurrentKeyIdentifier *string `json:"currentKeyIdentifier,omitempty"` - KeyIdentifier string `json:"keyIdentifier"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_listprovisioningtokeninput.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_listprovisioningtokeninput.go deleted file mode 100644 index ca8b5325b6d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_listprovisioningtokeninput.go +++ /dev/null @@ -1,20 +0,0 @@ -package videoanalyzer - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type ListProvisioningTokenInput struct { - ExpirationDate string `json:"expirationDate"` -} - -func (o ListProvisioningTokenInput) GetExpirationDateAsTime() (*time.Time, error) { - return dates.ParseAsFormat(&o.ExpirationDate, "2006-01-02T15:04:05Z07:00") -} - -func (o ListProvisioningTokenInput) SetExpirationDateAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ExpirationDate = formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_resourceidentity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_resourceidentity.go deleted file mode 100644 index 79801fdb776..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_resourceidentity.go +++ /dev/null @@ -1,5 +0,0 @@ -package videoanalyzer - -type ResourceIdentity struct { - UserAssignedIdentity string `json:"userAssignedIdentity"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_rsatokenkey.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_rsatokenkey.go deleted file mode 100644 index b7f76314b54..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_rsatokenkey.go +++ /dev/null @@ -1,41 +0,0 @@ -package videoanalyzer - -import ( - "encoding/json" - "fmt" -) - -var _ TokenKey = RsaTokenKey{} - -type RsaTokenKey struct { - Alg AccessPolicyRsaAlgo `json:"alg"` - E string `json:"e"` - N string `json:"n"` - - // Fields inherited from TokenKey - Kid string `json:"kid"` -} - -var _ json.Marshaler = RsaTokenKey{} - -func (s RsaTokenKey) MarshalJSON() ([]byte, error) { - type wrapper RsaTokenKey - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling RsaTokenKey: %+v", err) - } - - var decoded map[string]interface{} - if err := json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling RsaTokenKey: %+v", err) - } - decoded["@type"] = "#Microsoft.VideoAnalyzer.RsaTokenKey" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling RsaTokenKey: %+v", err) - } - - return encoded, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_storageaccount.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_storageaccount.go deleted file mode 100644 index a59d8a2d650..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_storageaccount.go +++ /dev/null @@ -1,7 +0,0 @@ -package videoanalyzer - -type StorageAccount struct { - Id *string `json:"id,omitempty"` - Identity *ResourceIdentity `json:"identity,omitempty"` - Status *string `json:"status,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_syncstoragekeysinput.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_syncstoragekeysinput.go deleted file mode 100644 index 77349128db8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_syncstoragekeysinput.go +++ /dev/null @@ -1,5 +0,0 @@ -package videoanalyzer - -type SyncStorageKeysInput struct { - Id *string `json:"id,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_systemdata.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_systemdata.go deleted file mode 100644 index d423bee06e6..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_systemdata.go +++ /dev/null @@ -1,40 +0,0 @@ -package videoanalyzer - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type SystemData struct { - CreatedAt *string `json:"createdAt,omitempty"` - CreatedBy *string `json:"createdBy,omitempty"` - CreatedByType *CreatedByType `json:"createdByType,omitempty"` - LastModifiedAt *string `json:"lastModifiedAt,omitempty"` - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` -} - -func (o SystemData) GetCreatedAtAsTime() (*time.Time, error) { - if o.CreatedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreatedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o SystemData) SetCreatedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreatedAt = &formatted -} - -func (o SystemData) GetLastModifiedAtAsTime() (*time.Time, error) { - if o.LastModifiedAt == nil { - return nil, nil - } - return dates.ParseAsFormat(o.LastModifiedAt, "2006-01-02T15:04:05Z07:00") -} - -func (o SystemData) SetLastModifiedAtAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.LastModifiedAt = &formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_tokenclaim.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_tokenclaim.go deleted file mode 100644 index 2f424601b93..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_tokenclaim.go +++ /dev/null @@ -1,6 +0,0 @@ -package videoanalyzer - -type TokenClaim struct { - Name string `json:"name"` - Value string `json:"value"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_tokenkey.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_tokenkey.go deleted file mode 100644 index aa245fd384a..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_tokenkey.go +++ /dev/null @@ -1,53 +0,0 @@ -package videoanalyzer - -import ( - "encoding/json" - "fmt" - "strings" -) - -type TokenKey interface { -} - -func unmarshalTokenKeyImplementation(input []byte) (TokenKey, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling TokenKey into map[string]interface: %+v", err) - } - - value, ok := temp["@type"].(string) - if !ok { - return nil, nil - } - - if strings.EqualFold(value, "#Microsoft.VideoAnalyzer.EccTokenKey") { - var out EccTokenKey - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into EccTokenKey: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.VideoAnalyzer.RsaTokenKey") { - var out RsaTokenKey - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into RsaTokenKey: %+v", err) - } - return out, nil - } - - type RawTokenKeyImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } - out := RawTokenKeyImpl{ - Type: value, - Values: temp, - } - return out, nil - -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_userassignedmanagedidentity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_userassignedmanagedidentity.go deleted file mode 100644 index 2331591602c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_userassignedmanagedidentity.go +++ /dev/null @@ -1,6 +0,0 @@ -package videoanalyzer - -type UserAssignedManagedIdentity struct { - ClientId *string `json:"clientId,omitempty"` - PrincipalId *string `json:"principalId,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoanalyzer.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoanalyzer.go deleted file mode 100644 index 319fcf7a424..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoanalyzer.go +++ /dev/null @@ -1,12 +0,0 @@ -package videoanalyzer - -type VideoAnalyzer struct { - Id *string `json:"id,omitempty"` - Identity *VideoAnalyzerIdentity `json:"identity,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *VideoAnalyzerPropertiesUpdate `json:"properties,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoanalyzercollection.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoanalyzercollection.go deleted file mode 100644 index 56283a303fe..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoanalyzercollection.go +++ /dev/null @@ -1,5 +0,0 @@ -package videoanalyzer - -type VideoAnalyzerCollection struct { - Value *[]VideoAnalyzer `json:"value,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoanalyzeridentity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoanalyzeridentity.go deleted file mode 100644 index 60812999d32..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoanalyzeridentity.go +++ /dev/null @@ -1,6 +0,0 @@ -package videoanalyzer - -type VideoAnalyzerIdentity struct { - Type string `json:"type"` - UserAssignedIdentities *map[string]UserAssignedManagedIdentity `json:"userAssignedIdentities,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoanalyzerpropertiesupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoanalyzerpropertiesupdate.go deleted file mode 100644 index 14b5a3a66f3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoanalyzerpropertiesupdate.go +++ /dev/null @@ -1,7 +0,0 @@ -package videoanalyzer - -type VideoAnalyzerPropertiesUpdate struct { - Encryption *AccountEncryption `json:"encryption,omitempty"` - Endpoints *[]Endpoint `json:"endpoints,omitempty"` - StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoanalyzerupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoanalyzerupdate.go deleted file mode 100644 index b787de694b9..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoanalyzerupdate.go +++ /dev/null @@ -1,7 +0,0 @@ -package videoanalyzer - -type VideoAnalyzerUpdate struct { - Identity *VideoAnalyzerIdentity `json:"identity,omitempty"` - Properties *VideoAnalyzerPropertiesUpdate `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoentity.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoentity.go deleted file mode 100644 index ce994e17a8c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoentity.go +++ /dev/null @@ -1,9 +0,0 @@ -package videoanalyzer - -type VideoEntity struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *VideoProperties `json:"properties,omitempty"` - SystemData *SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoflags.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoflags.go deleted file mode 100644 index a6bf457f096..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoflags.go +++ /dev/null @@ -1,7 +0,0 @@ -package videoanalyzer - -type VideoFlags struct { - CanStream bool `json:"canStream"` - HasData bool `json:"hasData"` - IsRecording bool `json:"isRecording"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videomediainfo.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videomediainfo.go deleted file mode 100644 index 2ffc9d6ac3b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videomediainfo.go +++ /dev/null @@ -1,5 +0,0 @@ -package videoanalyzer - -type VideoMediaInfo struct { - SegmentLength *string `json:"segmentLength,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoproperties.go deleted file mode 100644 index 7c9900e985c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videoproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package videoanalyzer - -type VideoProperties struct { - Description *string `json:"description,omitempty"` - Flags *VideoFlags `json:"flags,omitempty"` - MediaInfo *VideoMediaInfo `json:"mediaInfo,omitempty"` - Streaming *VideoStreaming `json:"streaming,omitempty"` - Title *string `json:"title,omitempty"` - Type *VideoType `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videostreaming.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videostreaming.go deleted file mode 100644 index 3ab61b4bedd..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videostreaming.go +++ /dev/null @@ -1,5 +0,0 @@ -package videoanalyzer - -type VideoStreaming struct { - ArchiveBaseUrl *string `json:"archiveBaseUrl,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videostreamingtoken.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videostreamingtoken.go deleted file mode 100644 index b8d8f55c523..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/model_videostreamingtoken.go +++ /dev/null @@ -1,24 +0,0 @@ -package videoanalyzer - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -type VideoStreamingToken struct { - ExpirationDate *string `json:"expirationDate,omitempty"` - Token *string `json:"token,omitempty"` -} - -func (o VideoStreamingToken) GetExpirationDateAsTime() (*time.Time, error) { - if o.ExpirationDate == nil { - return nil, nil - } - return dates.ParseAsFormat(o.ExpirationDate, "2006-01-02T15:04:05Z07:00") -} - -func (o VideoStreamingToken) SetExpirationDateAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ExpirationDate = &formatted -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/predicates.go deleted file mode 100644 index f7f31df1270..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/predicates.go +++ /dev/null @@ -1,70 +0,0 @@ -package videoanalyzer - -type AccessPolicyEntityPredicate struct { - Id *string - Name *string - Type *string -} - -func (p AccessPolicyEntityPredicate) Matches(input AccessPolicyEntity) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} - -type EdgeModuleEntityPredicate struct { - Id *string - Name *string - Type *string -} - -func (p EdgeModuleEntityPredicate) Matches(input EdgeModuleEntity) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} - -type VideoEntityPredicate struct { - Id *string - Name *string - Type *string -} - -func (p VideoEntityPredicate) Matches(input VideoEntity) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/version.go deleted file mode 100644 index 8c29432d7ff..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package videoanalyzer - -import "fmt" - -const defaultApiVersion = "2021-05-01-preview" - -func userAgent() string { - return fmt.Sprintf("pandora/videoanalyzer/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/transition.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/transition.go deleted file mode 100644 index d5fe3af8ec4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/transition.go +++ /dev/null @@ -1,23 +0,0 @@ -package videoanalyzer - -import "github.com/hashicorp/terraform-provider-azurerm/utils" - -func expandTags(input map[string]interface{}) *map[string]string { - output := make(map[string]string) - for k, v := range input { - output[k] = v.(string) - } - return &output -} - -func flattenTags(input *map[string]string) map[string]*string { - output := make(map[string]*string) - - if input != nil { - for k, v := range *input { - output[k] = utils.String(v) - } - } - - return output -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/validate/edge_module_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/validate/edge_module_id.go deleted file mode 100644 index 102ead44e00..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/validate/edge_module_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/parse" -) - -func EdgeModuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.EdgeModuleID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/validate/video_analyzer_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/validate/video_analyzer_id.go deleted file mode 100644 index 967a95e87c2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/validate/video_analyzer_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/parse" -) - -func VideoAnalyzerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.VideoAnalyzerID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/video_analyzer_edge_module_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/video_analyzer_edge_module_resource.go index 1605c7209aa..0333e43caae 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/video_analyzer_edge_module_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/video_analyzer_edge_module_resource.go @@ -7,10 +7,10 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer" "github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -30,7 +30,7 @@ func resourceVideoAnalyzerEdgeModule() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := videoanalyzer.ParseEdgeModuleID(id) + _, err := edgemodules.ParseEdgeModuleID(id) return err }), @@ -60,11 +60,11 @@ func resourceVideoAnalyzerEdgeModule() *pluginsdk.Resource { } func resourceVideoAnalyzerEdgeModuleCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).VideoAnalyzer.VideoAnalyzersClient + client := meta.(*clients.Client).VideoAnalyzer.EdgeModuleClient subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := videoanalyzer.NewEdgeModuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("video_analyzer_name").(string), d.Get("name").(string)) + id := edgemodules.NewEdgeModuleID(subscriptionId, d.Get("resource_group_name").(string), d.Get("video_analyzer_name").(string), d.Get("name").(string)) if d.IsNewResource() { existing, err := client.EdgeModulesGet(ctx, id) if err != nil { @@ -78,7 +78,7 @@ func resourceVideoAnalyzerEdgeModuleCreateUpdate(d *pluginsdk.ResourceData, meta } } - if _, err := client.EdgeModulesCreateOrUpdate(ctx, id, videoanalyzer.EdgeModuleEntity{}); err != nil { + if _, err := client.EdgeModulesCreateOrUpdate(ctx, id, edgemodules.EdgeModuleEntity{}); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -87,11 +87,11 @@ func resourceVideoAnalyzerEdgeModuleCreateUpdate(d *pluginsdk.ResourceData, meta } func resourceVideoAnalyzerEdgeModuleRead(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).VideoAnalyzer.VideoAnalyzersClient + client := meta.(*clients.Client).VideoAnalyzer.EdgeModuleClient ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := videoanalyzer.ParseEdgeModuleID(d.Id()) + id, err := edgemodules.ParseEdgeModuleID(d.Id()) if err != nil { return err } @@ -115,11 +115,11 @@ func resourceVideoAnalyzerEdgeModuleRead(d *pluginsdk.ResourceData, meta interfa } func resourceVideoAnalyzerEdgeModuleDelete(d *pluginsdk.ResourceData, meta interface{}) error { - client := meta.(*clients.Client).VideoAnalyzer.VideoAnalyzersClient + client := meta.(*clients.Client).VideoAnalyzer.EdgeModuleClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := videoanalyzer.ParseEdgeModuleID(d.Id()) + id, err := edgemodules.ParseEdgeModuleID(d.Id()) if err != nil { return err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/video_analyzer_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/video_analyzer_resource.go index 6bacb49466c..3fcacf3fb13 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/video_analyzer_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/video_analyzer_resource.go @@ -6,16 +6,15 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - msiparse "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/parse" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer" "github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -36,7 +35,7 @@ func resourceVideoAnalyzer() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := videoanalyzer.ParseVideoAnalyzerID(id) + _, err := videoanalyzers.ParseVideoAnalyzerID(id) return err }), @@ -69,7 +68,7 @@ func resourceVideoAnalyzer() *pluginsdk.Resource { "user_assigned_identity_id": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, }, }, @@ -88,7 +87,7 @@ func resourceVideoAnalyzerCreateUpdate(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := videoanalyzer.NewVideoAnalyzerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := videoanalyzers.NewVideoAnalyzerID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { existing, err := client.VideoAnalyzersGet(ctx, id) if err != nil { @@ -106,13 +105,13 @@ func resourceVideoAnalyzerCreateUpdate(d *pluginsdk.ResourceData, meta interface if err != nil { return err } - parameters := videoanalyzer.VideoAnalyzer{ - Properties: &videoanalyzer.VideoAnalyzerPropertiesUpdate{ + parameters := videoanalyzers.VideoAnalyzer{ + Properties: &videoanalyzers.VideoAnalyzerPropertiesUpdate{ StorageAccounts: expandVideoAnalyzerStorageAccounts(d), }, Location: azure.NormalizeLocation(d.Get("location").(string)), Identity: identity, - Tags: expandTags(d.Get("tags").(map[string]interface{})), + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } if _, err := client.VideoAnalyzersCreateOrUpdate(ctx, id, parameters); err != nil { @@ -128,7 +127,7 @@ func resourceVideoAnalyzerRead(d *pluginsdk.ResourceData, meta interface{}) erro ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := videoanalyzer.ParseVideoAnalyzerID(d.Id()) + id, err := videoanalyzers.ParseVideoAnalyzerID(d.Id()) if err != nil { return err } @@ -167,7 +166,7 @@ func resourceVideoAnalyzerRead(d *pluginsdk.ResourceData, meta interface{}) erro return fmt.Errorf("setting `identity`: %s", err) } - return tags.FlattenAndSet(d, flattenTags(model.Tags)) + return tags.FlattenAndSet(d, model.Tags) } return nil } @@ -177,7 +176,7 @@ func resourceVideoAnalyzerDelete(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := videoanalyzer.ParseVideoAnalyzerID(d.Id()) + id, err := videoanalyzers.ParseVideoAnalyzerID(d.Id()) if err != nil { return err } @@ -189,13 +188,13 @@ func resourceVideoAnalyzerDelete(d *pluginsdk.ResourceData, meta interface{}) er return nil } -func expandVideoAnalyzerStorageAccounts(d *pluginsdk.ResourceData) *[]videoanalyzer.StorageAccount { +func expandVideoAnalyzerStorageAccounts(d *pluginsdk.ResourceData) *[]videoanalyzers.StorageAccount { storageAccountRaw := d.Get("storage_account").([]interface{})[0].(map[string]interface{}) - results := []videoanalyzer.StorageAccount{ + results := []videoanalyzers.StorageAccount{ { Id: utils.String(storageAccountRaw["id"].(string)), - Identity: &videoanalyzer.ResourceIdentity{ + Identity: &videoanalyzers.ResourceIdentity{ UserAssignedIdentity: storageAccountRaw["user_assigned_identity_id"].(string), }, }, @@ -204,7 +203,7 @@ func expandVideoAnalyzerStorageAccounts(d *pluginsdk.ResourceData) *[]videoanaly return &results } -func flattenVideoAnalyzerStorageAccounts(input *[]videoanalyzer.StorageAccount) []interface{} { +func flattenVideoAnalyzerStorageAccounts(input *[]videoanalyzers.StorageAccount) []interface{} { if input == nil { return []interface{}{} } @@ -230,13 +229,13 @@ func flattenVideoAnalyzerStorageAccounts(input *[]videoanalyzer.StorageAccount) return results } -func expandAzureRmVideoAnalyzerIdentity(d *pluginsdk.ResourceData) (*videoanalyzer.VideoAnalyzerIdentity, error) { +func expandAzureRmVideoAnalyzerIdentity(d *pluginsdk.ResourceData) (*videoanalyzers.VideoAnalyzerIdentity, error) { identityRaw := d.Get("identity").([]interface{}) if identityRaw[0] == nil { return nil, fmt.Errorf("an `identity` block is required") } identity := identityRaw[0].(map[string]interface{}) - result := &videoanalyzer.VideoAnalyzerIdentity{ + result := &videoanalyzers.VideoAnalyzerIdentity{ Type: identity["type"].(string), } var identityIdSet []interface{} @@ -244,16 +243,16 @@ func expandAzureRmVideoAnalyzerIdentity(d *pluginsdk.ResourceData) (*videoanalyz identityIdSet = identityIds.(*pluginsdk.Set).List() } - userAssignedIdentities := make(map[string]videoanalyzer.UserAssignedManagedIdentity) + userAssignedIdentities := make(map[string]videoanalyzers.UserAssignedManagedIdentity) for _, id := range identityIdSet { - userAssignedIdentities[id.(string)] = videoanalyzer.UserAssignedManagedIdentity{} + userAssignedIdentities[id.(string)] = videoanalyzers.UserAssignedManagedIdentity{} } result.UserAssignedIdentities = &userAssignedIdentities return result, nil } -func flattenAzureRmVideoServiceIdentity(identity *videoanalyzer.VideoAnalyzerIdentity) ([]interface{}, error) { +func flattenAzureRmVideoServiceIdentity(identity *videoanalyzers.VideoAnalyzerIdentity) ([]interface{}, error) { if identity == nil { return make([]interface{}, 0), nil } @@ -269,7 +268,7 @@ func flattenAzureRmVideoServiceIdentity(identity *videoanalyzer.VideoAnalyzerIde } */ for key := range *identity.UserAssignedIdentities { - parsedId, err := msiparse.UserAssignedIdentityID(key) + parsedId, err := commonids.ParseUserAssignedIdentityIDInsensitively(key) if err != nil { return nil, err } diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/client/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/client/client.go index 30cc9fe2773..170c6a60af1 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/client/client.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/client/client.go @@ -1,10 +1,10 @@ package client import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/internal/common" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds" ) type Client struct { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/client.go deleted file mode 100644 index 248c6f51e88..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package authorizations - -import "github.com/Azure/go-autorest/autorest" - -type AuthorizationsClient struct { - Client autorest.Client - baseUri string -} - -func NewAuthorizationsClientWithBaseURI(endpoint string) AuthorizationsClient { - return AuthorizationsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/constants.go deleted file mode 100644 index e7202db9a38..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/constants.go +++ /dev/null @@ -1,34 +0,0 @@ -package authorizations - -import "strings" - -type ExpressRouteAuthorizationProvisioningState string - -const ( - ExpressRouteAuthorizationProvisioningStateFailed ExpressRouteAuthorizationProvisioningState = "Failed" - ExpressRouteAuthorizationProvisioningStateSucceeded ExpressRouteAuthorizationProvisioningState = "Succeeded" - ExpressRouteAuthorizationProvisioningStateUpdating ExpressRouteAuthorizationProvisioningState = "Updating" -) - -func PossibleValuesForExpressRouteAuthorizationProvisioningState() []string { - return []string{ - string(ExpressRouteAuthorizationProvisioningStateFailed), - string(ExpressRouteAuthorizationProvisioningStateSucceeded), - string(ExpressRouteAuthorizationProvisioningStateUpdating), - } -} - -func parseExpressRouteAuthorizationProvisioningState(input string) (*ExpressRouteAuthorizationProvisioningState, error) { - vals := map[string]ExpressRouteAuthorizationProvisioningState{ - "failed": ExpressRouteAuthorizationProvisioningStateFailed, - "succeeded": ExpressRouteAuthorizationProvisioningStateSucceeded, - "updating": ExpressRouteAuthorizationProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ExpressRouteAuthorizationProvisioningState(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/method_createorupdate_autorest.go deleted file mode 100644 index 08bbc7b509b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/method_createorupdate_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package authorizations - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateOrUpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c AuthorizationsClient) CreateOrUpdate(ctx context.Context, id AuthorizationId, input ExpressRouteAuthorization) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c AuthorizationsClient) CreateOrUpdateThenPoll(ctx context.Context, id AuthorizationId, input ExpressRouteAuthorization) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c AuthorizationsClient) preparerForCreateOrUpdate(ctx context.Context, id AuthorizationId, input ExpressRouteAuthorization) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c AuthorizationsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/method_delete_autorest.go deleted file mode 100644 index 477644dfd6b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/method_delete_autorest.go +++ /dev/null @@ -1,73 +0,0 @@ -package authorizations - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c AuthorizationsClient) Delete(ctx context.Context, id AuthorizationId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c AuthorizationsClient) DeleteThenPoll(ctx context.Context, id AuthorizationId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c AuthorizationsClient) preparerForDelete(ctx context.Context, id AuthorizationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c AuthorizationsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/method_get_autorest.go deleted file mode 100644 index 77991631579..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package authorizations - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *ExpressRouteAuthorization -} - -// Get ... -func (c AuthorizationsClient) Get(ctx context.Context, id AuthorizationId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c AuthorizationsClient) preparerForGet(ctx context.Context, id AuthorizationId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c AuthorizationsClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/method_list_autorest.go deleted file mode 100644 index a94c91a1daf..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/method_list_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package authorizations - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListResponse struct { - HttpResponse *http.Response - Model *[]ExpressRouteAuthorization - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListResponse, error) -} - -type ListCompleteResult struct { - Items []ExpressRouteAuthorization -} - -func (r ListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListResponse) LoadMore(ctx context.Context) (resp ListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c AuthorizationsClient) List(ctx context.Context, id PrivateCloudId) (resp ListResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c AuthorizationsClient) ListComplete(ctx context.Context, id PrivateCloudId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, ExpressRouteAuthorizationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c AuthorizationsClient) ListCompleteMatchingPredicate(ctx context.Context, id PrivateCloudId, predicate ExpressRouteAuthorizationPredicate) (resp ListCompleteResult, err error) { - items := make([]ExpressRouteAuthorization, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForList prepares the List request. -func (c AuthorizationsClient) preparerForList(ctx context.Context, id PrivateCloudId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/authorizations", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c AuthorizationsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c AuthorizationsClient) responderForList(resp *http.Response) (result ListResponse, err error) { - type page struct { - Values []ExpressRouteAuthorization `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "authorizations.AuthorizationsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/model_expressrouteauthorization.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/model_expressrouteauthorization.go deleted file mode 100644 index 9b6b8559479..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/model_expressrouteauthorization.go +++ /dev/null @@ -1,8 +0,0 @@ -package authorizations - -type ExpressRouteAuthorization struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *ExpressRouteAuthorizationProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/model_expressrouteauthorizationproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/model_expressrouteauthorizationproperties.go deleted file mode 100644 index 33abee839b8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/model_expressrouteauthorizationproperties.go +++ /dev/null @@ -1,7 +0,0 @@ -package authorizations - -type ExpressRouteAuthorizationProperties struct { - ExpressRouteAuthorizationId *string `json:"expressRouteAuthorizationId,omitempty"` - ExpressRouteAuthorizationKey *string `json:"expressRouteAuthorizationKey,omitempty"` - ProvisioningState *ExpressRouteAuthorizationProvisioningState `json:"provisioningState,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/predicates.go deleted file mode 100644 index c15ae892908..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/predicates.go +++ /dev/null @@ -1,24 +0,0 @@ -package authorizations - -type ExpressRouteAuthorizationPredicate struct { - Id *string - Name *string - Type *string -} - -func (p ExpressRouteAuthorizationPredicate) Matches(input ExpressRouteAuthorization) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/version.go deleted file mode 100644 index 10b72ecbf1e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package authorizations - -import "fmt" - -const defaultApiVersion = "2020-03-20" - -func userAgent() string { - return fmt.Sprintf("pandora/authorizations/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/client.go deleted file mode 100644 index bffcbaa761b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package clusters - -import "github.com/Azure/go-autorest/autorest" - -type ClustersClient struct { - Client autorest.Client - baseUri string -} - -func NewClustersClientWithBaseURI(endpoint string) ClustersClient { - return ClustersClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/constants.go deleted file mode 100644 index 6b09f491a56..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/constants.go +++ /dev/null @@ -1,40 +0,0 @@ -package clusters - -import "strings" - -type ClusterProvisioningState string - -const ( - ClusterProvisioningStateCancelled ClusterProvisioningState = "Cancelled" - ClusterProvisioningStateDeleting ClusterProvisioningState = "Deleting" - ClusterProvisioningStateFailed ClusterProvisioningState = "Failed" - ClusterProvisioningStateSucceeded ClusterProvisioningState = "Succeeded" - ClusterProvisioningStateUpdating ClusterProvisioningState = "Updating" -) - -func PossibleValuesForClusterProvisioningState() []string { - return []string{ - string(ClusterProvisioningStateCancelled), - string(ClusterProvisioningStateDeleting), - string(ClusterProvisioningStateFailed), - string(ClusterProvisioningStateSucceeded), - string(ClusterProvisioningStateUpdating), - } -} - -func parseClusterProvisioningState(input string) (*ClusterProvisioningState, error) { - vals := map[string]ClusterProvisioningState{ - "cancelled": ClusterProvisioningStateCancelled, - "deleting": ClusterProvisioningStateDeleting, - "failed": ClusterProvisioningStateFailed, - "succeeded": ClusterProvisioningStateSucceeded, - "updating": ClusterProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ClusterProvisioningState(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/method_createorupdate_autorest.go deleted file mode 100644 index c6e259ecc01..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/method_createorupdate_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package clusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateOrUpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c ClustersClient) CreateOrUpdate(ctx context.Context, id ClusterId, input Cluster) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c ClustersClient) CreateOrUpdateThenPoll(ctx context.Context, id ClusterId, input Cluster) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c ClustersClient) preparerForCreateOrUpdate(ctx context.Context, id ClusterId, input Cluster) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c ClustersClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/method_delete_autorest.go deleted file mode 100644 index a46806abefb..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/method_delete_autorest.go +++ /dev/null @@ -1,73 +0,0 @@ -package clusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c ClustersClient) Delete(ctx context.Context, id ClusterId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c ClustersClient) DeleteThenPoll(ctx context.Context, id ClusterId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c ClustersClient) preparerForDelete(ctx context.Context, id ClusterId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c ClustersClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/method_get_autorest.go deleted file mode 100644 index 4fec5b17832..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package clusters - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *Cluster -} - -// Get ... -func (c ClustersClient) Get(ctx context.Context, id ClusterId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ClustersClient) preparerForGet(ctx context.Context, id ClusterId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ClustersClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/method_list_autorest.go deleted file mode 100644 index fc22e028790..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/method_list_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package clusters - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListResponse struct { - HttpResponse *http.Response - Model *[]Cluster - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListResponse, error) -} - -type ListCompleteResult struct { - Items []Cluster -} - -func (r ListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListResponse) LoadMore(ctx context.Context) (resp ListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c ClustersClient) List(ctx context.Context, id PrivateCloudId) (resp ListResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c ClustersClient) ListComplete(ctx context.Context, id PrivateCloudId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, ClusterPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ClustersClient) ListCompleteMatchingPredicate(ctx context.Context, id PrivateCloudId, predicate ClusterPredicate) (resp ListCompleteResult, err error) { - items := make([]Cluster, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForList prepares the List request. -func (c ClustersClient) preparerForList(ctx context.Context, id PrivateCloudId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/clusters", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c ClustersClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c ClustersClient) responderForList(resp *http.Response) (result ListResponse, err error) { - type page struct { - Values []Cluster `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/method_update_autorest.go deleted file mode 100644 index 32c520f7c29..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/method_update_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package clusters - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type UpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c ClustersClient) Update(ctx context.Context, id ClusterId, input ClusterUpdate) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c ClustersClient) UpdateThenPoll(ctx context.Context, id ClusterId, input ClusterUpdate) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c ClustersClient) preparerForUpdate(ctx context.Context, id ClusterId, input ClusterUpdate) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c ClustersClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/model_cluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/model_cluster.go deleted file mode 100644 index 8da5844830c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/model_cluster.go +++ /dev/null @@ -1,9 +0,0 @@ -package clusters - -type Cluster struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties ClusterProperties `json:"properties"` - Sku Sku `json:"sku"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/model_clusterproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/model_clusterproperties.go deleted file mode 100644 index 8106a5ca72b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/model_clusterproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package clusters - -type ClusterProperties struct { - ClusterId *int64 `json:"clusterId,omitempty"` - ClusterSize int64 `json:"clusterSize"` - Hosts *[]string `json:"hosts,omitempty"` - ProvisioningState *ClusterProvisioningState `json:"provisioningState,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/model_clusterupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/model_clusterupdate.go deleted file mode 100644 index 98c3c77d64d..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/model_clusterupdate.go +++ /dev/null @@ -1,5 +0,0 @@ -package clusters - -type ClusterUpdate struct { - Properties *ClusterUpdateProperties `json:"properties,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/model_clusterupdateproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/model_clusterupdateproperties.go deleted file mode 100644 index c0c1b4d2844..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/model_clusterupdateproperties.go +++ /dev/null @@ -1,5 +0,0 @@ -package clusters - -type ClusterUpdateProperties struct { - ClusterSize *int64 `json:"clusterSize,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/model_sku.go deleted file mode 100644 index 73324668168..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/model_sku.go +++ /dev/null @@ -1,5 +0,0 @@ -package clusters - -type Sku struct { - Name string `json:"name"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/predicates.go deleted file mode 100644 index e542c0c7d56..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/predicates.go +++ /dev/null @@ -1,24 +0,0 @@ -package clusters - -type ClusterPredicate struct { - Id *string - Name *string - Type *string -} - -func (p ClusterPredicate) Matches(input Cluster) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/version.go deleted file mode 100644 index e198e307678..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package clusters - -import "fmt" - -const defaultApiVersion = "2020-03-20" - -func userAgent() string { - return fmt.Sprintf("pandora/clusters/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/client.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/client.go deleted file mode 100644 index 3cc08488596..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/client.go +++ /dev/null @@ -1,15 +0,0 @@ -package privateclouds - -import "github.com/Azure/go-autorest/autorest" - -type PrivateCloudsClient struct { - Client autorest.Client - baseUri string -} - -func NewPrivateCloudsClientWithBaseURI(endpoint string) PrivateCloudsClient { - return PrivateCloudsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, - } -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/constants.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/constants.go deleted file mode 100644 index 357739d656e..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/constants.go +++ /dev/null @@ -1,139 +0,0 @@ -package privateclouds - -import "strings" - -type ClusterProvisioningState string - -const ( - ClusterProvisioningStateCancelled ClusterProvisioningState = "Cancelled" - ClusterProvisioningStateDeleting ClusterProvisioningState = "Deleting" - ClusterProvisioningStateFailed ClusterProvisioningState = "Failed" - ClusterProvisioningStateSucceeded ClusterProvisioningState = "Succeeded" - ClusterProvisioningStateUpdating ClusterProvisioningState = "Updating" -) - -func PossibleValuesForClusterProvisioningState() []string { - return []string{ - string(ClusterProvisioningStateCancelled), - string(ClusterProvisioningStateDeleting), - string(ClusterProvisioningStateFailed), - string(ClusterProvisioningStateSucceeded), - string(ClusterProvisioningStateUpdating), - } -} - -func parseClusterProvisioningState(input string) (*ClusterProvisioningState, error) { - vals := map[string]ClusterProvisioningState{ - "cancelled": ClusterProvisioningStateCancelled, - "deleting": ClusterProvisioningStateDeleting, - "failed": ClusterProvisioningStateFailed, - "succeeded": ClusterProvisioningStateSucceeded, - "updating": ClusterProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ClusterProvisioningState(input) - return &out, nil -} - -type InternetEnum string - -const ( - InternetEnumDisabled InternetEnum = "Disabled" - InternetEnumEnabled InternetEnum = "Enabled" -) - -func PossibleValuesForInternetEnum() []string { - return []string{ - string(InternetEnumDisabled), - string(InternetEnumEnabled), - } -} - -func parseInternetEnum(input string) (*InternetEnum, error) { - vals := map[string]InternetEnum{ - "disabled": InternetEnumDisabled, - "enabled": InternetEnumEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := InternetEnum(input) - return &out, nil -} - -type PrivateCloudProvisioningState string - -const ( - PrivateCloudProvisioningStateBuilding PrivateCloudProvisioningState = "Building" - PrivateCloudProvisioningStateCancelled PrivateCloudProvisioningState = "Cancelled" - PrivateCloudProvisioningStateDeleting PrivateCloudProvisioningState = "Deleting" - PrivateCloudProvisioningStateFailed PrivateCloudProvisioningState = "Failed" - PrivateCloudProvisioningStatePending PrivateCloudProvisioningState = "Pending" - PrivateCloudProvisioningStateSucceeded PrivateCloudProvisioningState = "Succeeded" - PrivateCloudProvisioningStateUpdating PrivateCloudProvisioningState = "Updating" -) - -func PossibleValuesForPrivateCloudProvisioningState() []string { - return []string{ - string(PrivateCloudProvisioningStateBuilding), - string(PrivateCloudProvisioningStateCancelled), - string(PrivateCloudProvisioningStateDeleting), - string(PrivateCloudProvisioningStateFailed), - string(PrivateCloudProvisioningStatePending), - string(PrivateCloudProvisioningStateSucceeded), - string(PrivateCloudProvisioningStateUpdating), - } -} - -func parsePrivateCloudProvisioningState(input string) (*PrivateCloudProvisioningState, error) { - vals := map[string]PrivateCloudProvisioningState{ - "building": PrivateCloudProvisioningStateBuilding, - "cancelled": PrivateCloudProvisioningStateCancelled, - "deleting": PrivateCloudProvisioningStateDeleting, - "failed": PrivateCloudProvisioningStateFailed, - "pending": PrivateCloudProvisioningStatePending, - "succeeded": PrivateCloudProvisioningStateSucceeded, - "updating": PrivateCloudProvisioningStateUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := PrivateCloudProvisioningState(input) - return &out, nil -} - -type SslEnum string - -const ( - SslEnumDisabled SslEnum = "Disabled" - SslEnumEnabled SslEnum = "Enabled" -) - -func PossibleValuesForSslEnum() []string { - return []string{ - string(SslEnumDisabled), - string(SslEnumEnabled), - } -} - -func parseSslEnum(input string) (*SslEnum, error) { - vals := map[string]SslEnum{ - "disabled": SslEnumDisabled, - "enabled": SslEnumEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SslEnum(input) - return &out, nil -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/id_resourcegroup.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/id_resourcegroup.go deleted file mode 100644 index e77f90e6b46..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/id_resourcegroup.go +++ /dev/null @@ -1,109 +0,0 @@ -package privateclouds - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = ResourceGroupId{} - -// ResourceGroupId is a struct representing the Resource ID for a Resource Group -type ResourceGroupId struct { - SubscriptionId string - ResourceGroupName string -} - -// NewResourceGroupID returns a new ResourceGroupId struct -func NewResourceGroupID(subscriptionId string, resourceGroupName string) ResourceGroupId { - return ResourceGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - } -} - -// ParseResourceGroupID parses 'input' into a ResourceGroupId -func ParseResourceGroupID(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseResourceGroupIDInsensitively parses 'input' case-insensitively into a ResourceGroupId -// note: this method should only be used for API response data and not user input -func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(ResourceGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := ResourceGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID -func ValidateResourceGroupID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseResourceGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Resource Group ID -func (id ResourceGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Resource Group ID -func (id ResourceGroupId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - } -} - -// String returns a human-readable description of this Resource Group ID -func (id ResourceGroupId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - } - return fmt.Sprintf("Resource Group (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/id_subscription.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/id_subscription.go deleted file mode 100644 index 4b724a528c2..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/id_subscription.go +++ /dev/null @@ -1,96 +0,0 @@ -package privateclouds - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.ResourceId = SubscriptionId{} - -// SubscriptionId is a struct representing the Resource ID for a Subscription -type SubscriptionId struct { - SubscriptionId string -} - -// NewSubscriptionID returns a new SubscriptionId struct -func NewSubscriptionID(subscriptionId string) SubscriptionId { - return SubscriptionId{ - SubscriptionId: subscriptionId, - } -} - -// ParseSubscriptionID parses 'input' into a SubscriptionId -func ParseSubscriptionID(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ParseSubscriptionIDInsensitively parses 'input' case-insensitively into a SubscriptionId -// note: this method should only be used for API response data and not user input -func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { - parser := resourceids.NewParserFromResourceIdType(SubscriptionId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - var ok bool - id := SubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) - } - - return &id, nil -} - -// ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID -func ValidateSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSubscriptionID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Subscription ID -func (id SubscriptionId) ID() string { - fmtString := "/subscriptions/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId) -} - -// Segments returns a slice of Resource ID Segments which comprise this Subscription ID -func (id SubscriptionId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - } -} - -// String returns a human-readable description of this Subscription ID -func (id SubscriptionId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - } - return fmt.Sprintf("Subscription (%s)", strings.Join(components, "\n")) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_createorupdate_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_createorupdate_autorest.go deleted file mode 100644 index 6cfa82837c8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_createorupdate_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package privateclouds - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type CreateOrUpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// CreateOrUpdate ... -func (c PrivateCloudsClient) CreateOrUpdate(ctx context.Context, id PrivateCloudId, input PrivateCloud) (result CreateOrUpdateResponse, err error) { - req, err := c.preparerForCreateOrUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = c.senderForCreateOrUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c PrivateCloudsClient) CreateOrUpdateThenPoll(ctx context.Context, id PrivateCloudId, input PrivateCloud) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} - -// preparerForCreateOrUpdate prepares the CreateOrUpdate request. -func (c PrivateCloudsClient) preparerForCreateOrUpdate(ctx context.Context, id PrivateCloudId, input PrivateCloud) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (c PrivateCloudsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_delete_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_delete_autorest.go deleted file mode 100644 index 3a6931707ee..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_delete_autorest.go +++ /dev/null @@ -1,73 +0,0 @@ -package privateclouds - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type DeleteResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Delete ... -func (c PrivateCloudsClient) Delete(ctx context.Context, id PrivateCloudId) (result DeleteResponse, err error) { - req, err := c.preparerForDelete(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = c.senderForDelete(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Delete", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c PrivateCloudsClient) DeleteThenPoll(ctx context.Context, id PrivateCloudId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} - -// preparerForDelete prepares the Delete request. -func (c PrivateCloudsClient) preparerForDelete(ctx context.Context, id PrivateCloudId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForDelete sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (c PrivateCloudsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_get_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_get_autorest.go deleted file mode 100644 index db14aaf54b8..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_get_autorest.go +++ /dev/null @@ -1,64 +0,0 @@ -package privateclouds - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type GetResponse struct { - HttpResponse *http.Response - Model *PrivateCloud -} - -// Get ... -func (c PrivateCloudsClient) Get(ctx context.Context, id PrivateCloudId) (result GetResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c PrivateCloudsClient) preparerForGet(ctx context.Context, id PrivateCloudId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c PrivateCloudsClient) responderForGet(resp *http.Response) (result GetResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_list_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_list_autorest.go deleted file mode 100644 index 954a71bbe8b..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_list_autorest.go +++ /dev/null @@ -1,183 +0,0 @@ -package privateclouds - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -type ListResponse struct { - HttpResponse *http.Response - Model *[]PrivateCloud - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListResponse, error) -} - -type ListCompleteResult struct { - Items []PrivateCloud -} - -func (r ListResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListResponse) LoadMore(ctx context.Context) (resp ListResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -// List ... -func (c PrivateCloudsClient) List(ctx context.Context, id ResourceGroupId) (resp ListResponse, err error) { - req, err := c.preparerForList(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForList(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// ListComplete retrieves all of the results into a single object -func (c PrivateCloudsClient) ListComplete(ctx context.Context, id ResourceGroupId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, PrivateCloudPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c PrivateCloudsClient) ListCompleteMatchingPredicate(ctx context.Context, id ResourceGroupId, predicate PrivateCloudPredicate) (resp ListCompleteResult, err error) { - items := make([]PrivateCloud, 0) - - page, err := c.List(ctx, id) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListCompleteResult{ - Items: items, - } - return out, nil -} - -// preparerForList prepares the List request. -func (c PrivateCloudsClient) preparerForList(ctx context.Context, id ResourceGroupId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.AVS/privateClouds", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListWithNextLink prepares the List request with the given nextLink token. -func (c PrivateCloudsClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForList handles the response to the List request. The method always -// closes the http.Response Body. -func (c PrivateCloudsClient) responderForList(resp *http.Response) (result ListResponse, err error) { - type page struct { - Values []PrivateCloud `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListResponse, err error) { - req, err := c.preparerForListWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForList(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "List", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_update_autorest.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_update_autorest.go deleted file mode 100644 index 48a719bb86f..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/method_update_autorest.go +++ /dev/null @@ -1,75 +0,0 @@ -package privateclouds - -import ( - "context" - "fmt" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/hashicorp/go-azure-helpers/polling" -) - -type UpdateResponse struct { - Poller polling.LongRunningPoller - HttpResponse *http.Response -} - -// Update ... -func (c PrivateCloudsClient) Update(ctx context.Context, id PrivateCloudId, input PrivateCloudUpdate) (result UpdateResponse, err error) { - req, err := c.preparerForUpdate(ctx, id, input) - if err != nil { - err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = c.senderForUpdate(ctx, req) - if err != nil { - err = autorest.NewErrorWithError(err, "privateclouds.PrivateCloudsClient", "Update", result.HttpResponse, "Failure sending request") - return - } - - return -} - -// UpdateThenPoll performs Update then polls until it's completed -func (c PrivateCloudsClient) UpdateThenPoll(ctx context.Context, id PrivateCloudId, input PrivateCloudUpdate) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} - -// preparerForUpdate prepares the Update request. -func (c PrivateCloudsClient) preparerForUpdate(ctx context.Context, id PrivateCloudId, input PrivateCloudUpdate) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithJSON(input), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// senderForUpdate sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (c PrivateCloudsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateResponse, err error) { - var resp *http.Response - resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - return - } - future.Poller, err = polling.NewLongRunningPollerFromResponse(ctx, resp, c.Client) - return -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_admincredentials.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_admincredentials.go deleted file mode 100644 index 23e94e70b4c..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_admincredentials.go +++ /dev/null @@ -1,8 +0,0 @@ -package privateclouds - -type AdminCredentials struct { - NsxtPassword *string `json:"nsxtPassword,omitempty"` - NsxtUsername *string `json:"nsxtUsername,omitempty"` - VcenterPassword *string `json:"vcenterPassword,omitempty"` - VcenterUsername *string `json:"vcenterUsername,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_circuit.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_circuit.go deleted file mode 100644 index f7cf9cb4332..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_circuit.go +++ /dev/null @@ -1,8 +0,0 @@ -package privateclouds - -type Circuit struct { - ExpressRouteID *string `json:"expressRouteID,omitempty"` - ExpressRoutePrivatePeeringID *string `json:"expressRoutePrivatePeeringID,omitempty"` - PrimarySubnet *string `json:"primarySubnet,omitempty"` - SecondarySubnet *string `json:"secondarySubnet,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_endpoints.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_endpoints.go deleted file mode 100644 index 5dc872d28f4..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_endpoints.go +++ /dev/null @@ -1,7 +0,0 @@ -package privateclouds - -type Endpoints struct { - HcxCloudManager *string `json:"hcxCloudManager,omitempty"` - NsxtManager *string `json:"nsxtManager,omitempty"` - Vcsa *string `json:"vcsa,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_managementcluster.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_managementcluster.go deleted file mode 100644 index b88575596f3..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_managementcluster.go +++ /dev/null @@ -1,8 +0,0 @@ -package privateclouds - -type ManagementCluster struct { - ClusterId *int64 `json:"clusterId,omitempty"` - ClusterSize int64 `json:"clusterSize"` - Hosts *[]string `json:"hosts,omitempty"` - ProvisioningState *ClusterProvisioningState `json:"provisioningState,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_privatecloud.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_privatecloud.go deleted file mode 100644 index 9a8e2349bdc..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_privatecloud.go +++ /dev/null @@ -1,11 +0,0 @@ -package privateclouds - -type PrivateCloud struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties PrivateCloudProperties `json:"properties"` - Sku Sku `json:"sku"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_privatecloudupdate.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_privatecloudupdate.go deleted file mode 100644 index 9755b429e10..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_privatecloudupdate.go +++ /dev/null @@ -1,6 +0,0 @@ -package privateclouds - -type PrivateCloudUpdate struct { - Properties *PrivateCloudUpdateProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_privatecloudupdateproperties.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_privatecloudupdateproperties.go deleted file mode 100644 index b7db34cd0c1..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_privatecloudupdateproperties.go +++ /dev/null @@ -1,7 +0,0 @@ -package privateclouds - -type PrivateCloudUpdateProperties struct { - IdentitySources *[]IdentitySource `json:"identitySources,omitempty"` - Internet *InternetEnum `json:"internet,omitempty"` - ManagementCluster *ManagementCluster `json:"managementCluster,omitempty"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_sku.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_sku.go deleted file mode 100644 index 1a8e88fa775..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/model_sku.go +++ /dev/null @@ -1,5 +0,0 @@ -package privateclouds - -type Sku struct { - Name string `json:"name"` -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/predicates.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/predicates.go deleted file mode 100644 index e605fb11783..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/predicates.go +++ /dev/null @@ -1,29 +0,0 @@ -package privateclouds - -type PrivateCloudPredicate struct { - Id *string - Location *string - Name *string - Type *string -} - -func (p PrivateCloudPredicate) Matches(input PrivateCloud) bool { - - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/version.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/version.go deleted file mode 100644 index 8df2dfa07ef..00000000000 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds/version.go +++ /dev/null @@ -1,9 +0,0 @@ -package privateclouds - -import "fmt" - -const defaultApiVersion = "2020-03-20" - -func userAgent() string { - return fmt.Sprintf("pandora/privateclouds/%s", defaultApiVersion) -} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate/cluster_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate/cluster_id.go index 4c175df6c12..50b218278da 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate/cluster_id.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate/cluster_id.go @@ -3,7 +3,7 @@ package validate import ( "fmt" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters" ) func ClusterID(input interface{}, key string) (warnings []string, errors []error) { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate/express_route_authorization_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate/express_route_authorization_id.go index c4bd6c1bad0..227ae6f6f46 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate/express_route_authorization_id.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate/express_route_authorization_id.go @@ -3,7 +3,7 @@ package validate import ( "fmt" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations" ) func ExpressRouteAuthorizationID(input interface{}, key string) (warnings []string, errors []error) { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate/private_cloud_id.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate/private_cloud_id.go index 4059c1c00b8..d1a2032b1df 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate/private_cloud_id.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate/private_cloud_id.go @@ -3,7 +3,7 @@ package validate import ( "fmt" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" ) func PrivateCloudID(input interface{}, key string) (warnings []string, errors []error) { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_cluster_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_cluster_resource.go index 43826060965..f595a8d1c79 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_cluster_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_cluster_resource.go @@ -6,10 +6,10 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_express_route_authorization_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_express_route_authorization_resource.go index d1f2d985e98..a30ebc780f4 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_express_route_authorization_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_express_route_authorization_resource.go @@ -6,10 +6,10 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_private_cloud.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_private_cloud.go index 286b66656f8..0cafafd9086 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_private_cloud.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_private_cloud.go @@ -1,7 +1,7 @@ package vmware import ( - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/utils" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_private_cloud_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_private_cloud_data_source.go index 973da5fefc5..df843a30ccf 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_private_cloud_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_private_cloud_data_source.go @@ -8,8 +8,8 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" ) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_private_cloud_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_private_cloud_resource.go index 0a64fe96ecb..4b53dcc2cf0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_private_cloud_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/vmware_private_cloud_resource.go @@ -9,9 +9,9 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service.go index 4b36fa25de7..e27c3812282 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service.go @@ -5,9 +5,8 @@ import ( "log" "strings" - "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/utils" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_active_slot_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_active_slot_resource.go index 391d71b1ad7..ea6b21e8c87 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_active_slot_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_active_slot_resource.go @@ -8,7 +8,6 @@ import ( "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -26,7 +25,7 @@ func resourceAppServiceActiveSlot() *pluginsdk.Resource { return err }), - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_app_service_active_slot` resource has been superseded by the `azurerm_web_app_active_slot` and `azurerm_function_app_active_slot` resources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider."), + DeprecationMessage: "The `azurerm_app_service_active_slot` resource has been superseded by the `azurerm_web_app_active_slot` and `azurerm_function_app_active_slot` resources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider.", Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_data_source.go index 0f1d0e7fc18..8c05a885041 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_data_source.go @@ -8,7 +8,6 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -24,7 +23,7 @@ func dataSourceAppService() *pluginsdk.Resource { Read: pluginsdk.DefaultTimeout(5 * time.Minute), }, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_app_service` data source has been superseded by the `azurerm_linux_function_app` and `azurerm_windows_web_app` data sources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider."), + DeprecationMessage: "The `azurerm_app_service` data source has been superseded by the `azurerm_linux_function_app` and `azurerm_windows_web_app` data sources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider.", Schema: map[string]*pluginsdk.Schema{ "name": { diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_environment_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_environment_resource.go index 83318f0c77e..2625dbd0146 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_environment_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_environment_resource.go @@ -7,10 +7,9 @@ import ( "strings" "time" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" helpersValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_hybrid_connection_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_hybrid_connection_resource.go index fc8822e9256..5bf6f6d16b0 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_hybrid_connection_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_hybrid_connection_resource.go @@ -8,15 +8,13 @@ import ( "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections" + "github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" - relayParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces" - relayValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -37,7 +35,7 @@ func resourceAppServiceHybridConnection() *pluginsdk.Resource { return err }), - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_app_service_hybrid_connection` resource has been superseded by the `azurerm_function_app_hybrid_connection` and `azurerm_web_app_hybrid_connection` resources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider."), + DeprecationMessage: "The `azurerm_app_service_hybrid_connection` resource has been superseded by the `azurerm_function_app_hybrid_connection` and `azurerm_web_app_hybrid_connection` resources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider.", Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), @@ -60,7 +58,7 @@ func resourceAppServiceHybridConnection() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: relayValidate.HybridConnectionID, + ValidateFunc: hybridconnections.ValidateHybridConnectionID, }, "hostname": { @@ -118,7 +116,7 @@ func resourceAppServiceHybridConnectionCreateUpdate(d *pluginsdk.ResourceData, m defer cancel() relayArmURI := d.Get("relay_id").(string) - relayId, err := relayParse.HybridConnectionID(relayArmURI) + relayId, err := hybridconnections.ParseHybridConnectionID(relayArmURI) if err != nil { return fmt.Errorf("parsing relay ID %q: %s", relayArmURI, err) } @@ -241,7 +239,7 @@ func resourceAppServiceHybridConnectionDelete(d *pluginsdk.ResourceData, meta in } func findRelayNamespace(ctx context.Context, client *namespaces.NamespacesClient, subscriptionId, name string) (*string, error) { - subId := namespaces.NewSubscriptionID(subscriptionId) + subId := commonids.NewSubscriptionID(subscriptionId) relayNSIterator, err := client.ListComplete(ctx, subId) if err != nil { return nil, fmt.Errorf("listing Relay Namespaces: %+v", err) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_plan_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_plan_data_source.go index 45d0598ae49..98c9ecf40cf 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_plan_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_plan_data_source.go @@ -7,7 +7,6 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -19,7 +18,7 @@ func dataSourceAppServicePlan() *pluginsdk.Resource { return &pluginsdk.Resource{ Read: AppServicePlanDataSourceRead, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_app_service_plan` data source has been superseded by the `azurerm_service_plan` data source. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider."), + DeprecationMessage: "The `azurerm_app_service_plan` data source has been superseded by the `azurerm_service_plan` data source. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider.", Timeouts: &pluginsdk.ResourceTimeout{ Read: pluginsdk.DefaultTimeout(5 * time.Minute), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_plan_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_plan_resource.go index 1977cebb584..f1a70f4bf99 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_plan_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_plan_resource.go @@ -10,7 +10,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -32,7 +31,7 @@ func resourceAppServicePlan() *pluginsdk.Resource { return err }), - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_app_service_plan` resource has been superseded by the `azurerm_service_plan` resource. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider."), + DeprecationMessage: "The `azurerm_app_service_plan` resource has been superseded by the `azurerm_service_plan` resource. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider.", Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(60 * time.Minute), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_resource.go index 2496ee493a2..78443fbbfff 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_resource.go @@ -7,12 +7,11 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -30,7 +29,7 @@ func resourceAppService() *pluginsdk.Resource { Update: resourceAppServiceUpdate, Delete: resourceAppServiceDelete, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_app_service` resource has been superseded by the `azurerm_linux_web_app` and `azurerm_windows_web_app` resources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider."), + DeprecationMessage: "The `azurerm_app_service` resource has been superseded by the `azurerm_linux_web_app` and `azurerm_windows_web_app` resources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider.", Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.AppServiceID(id) @@ -154,7 +153,7 @@ func resourceAppService() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, "logs": schemaAppServiceLogsConfig(), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_slot_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_slot_resource.go index ffbcc1f9d96..fef388d249b 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_slot_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_slot_resource.go @@ -6,12 +6,11 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/parse" webValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -29,7 +28,7 @@ func resourceAppServiceSlot() *pluginsdk.Resource { Update: resourceAppServiceSlotCreateUpdate, Delete: resourceAppServiceSlotDelete, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_app_service_slot` resource has been superseded by the `azurerm_linux_web_app_slot` and `azurerm_windows_web_app_slot` resources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider."), + DeprecationMessage: "The `azurerm_app_service_slot` resource has been superseded by the `azurerm_linux_web_app_slot` and `azurerm_windows_web_app_slot` resources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider.", Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := parse.AppServiceSlotID(id) @@ -80,7 +79,7 @@ func resourceAppServiceSlot() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, "logs": schemaAppServiceLogsConfig(), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_source_control_token_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_source_control_token_resource.go index b799b90724f..ff81d1abbc6 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_source_control_token_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/app_service_source_control_token_resource.go @@ -7,7 +7,6 @@ import ( "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/validate" @@ -34,7 +33,7 @@ func resourceAppServiceSourceControlToken() *pluginsdk.Resource { return nil }), - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_app_service_source_control_token` resource has been superseded by the `azurerm_source_control_token` resource. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider."), + DeprecationMessage: "The `azurerm_app_service_source_control_token` resource has been superseded by the `azurerm_source_control_token` resource. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider.", Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/function_app_data_source.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/function_app_data_source.go index 23d6a9aa923..557b2e750c3 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/function_app_data_source.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/function_app_data_source.go @@ -10,7 +10,6 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/parse" webValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" @@ -23,7 +22,7 @@ func dataSourceFunctionApp() *pluginsdk.Resource { return &pluginsdk.Resource{ Read: dataSourceFunctionAppRead, - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_function_app` data source has been superseded by the `azurerm_linux_function_app` and `azurerm_windows_function_app` data sources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider."), + DeprecationMessage: "The `azurerm_function_app` data source has been superseded by the `azurerm_linux_function_app` and `azurerm_windows_function_app` data sources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider.", Timeouts: &pluginsdk.ResourceTimeout{ Read: pluginsdk.DefaultTimeout(5 * time.Minute), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/function_app_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/function_app_resource.go index bfc6c4093e2..7441120322f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/function_app_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/function_app_resource.go @@ -8,12 +8,11 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" - msivalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/parse" webValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/validate" @@ -38,7 +37,7 @@ func resourceFunctionApp() *pluginsdk.Resource { return err }), - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_function_app` resource has been superseded by the `azurerm_linux_function_app` and `azurerm_windows_function_app` resources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider."), + DeprecationMessage: "The `azurerm_function_app` resource has been superseded by the `azurerm_linux_function_app` and `azurerm_windows_function_app` resources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider.", Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), @@ -163,7 +162,7 @@ func resourceFunctionApp() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, Computed: true, - ValidateFunc: msivalidate.UserAssignedIdentityID, + ValidateFunc: commonids.ValidateUserAssignedIdentityID, }, "site_config": schemaAppServiceFunctionAppSiteConfig(), @@ -358,10 +357,13 @@ func resourceFunctionAppCreate(d *pluginsdk.ResourceData, meta interface{}) erro sourceControl := &web.SiteSourceControl{} sourceControl.SiteSourceControlProperties = sourceControlProperties // TODO - Do we need to lock the function app for updates? - _, err := client.CreateOrUpdateSourceControl(ctx, id.ResourceGroup, id.SiteName, *sourceControl) + future, err := client.CreateOrUpdateSourceControl(ctx, id.ResourceGroup, id.SiteName, *sourceControl) if err != nil { return fmt.Errorf("failed to create %s: %+v", id, err) } + if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { + return fmt.Errorf("waiting for creation of %q: %+v", id, err) + } } d.SetId(id.ID()) diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/function_app_slot_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/function_app_slot_resource.go index 8abf6b0d19b..6a1165f5b06 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/function_app_slot_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/function_app_slot_resource.go @@ -13,7 +13,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/validate" @@ -37,7 +36,7 @@ func resourceFunctionAppSlot() *pluginsdk.Resource { return err }), - DeprecationMessage: features.DeprecatedInThreePointOh("The `azurerm_function_app_slot` resource has been superseded by the `azurerm_linux_function_app_slot` and `azurerm_windows_function_app_slot` resources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider."), + DeprecationMessage: "The `azurerm_function_app_slot` resource has been superseded by the `azurerm_linux_function_app_slot` and `azurerm_windows_function_app_slot` resources. Whilst this resource will continue to be available in the 2.x and 3.x releases it is feature-frozen for compatibility purposes, will no longer receive any updates and will be removed in a future major release of the Azure Provider.", Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(30 * time.Minute), diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/static_site_custom_domain_resource.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/static_site_custom_domain_resource.go index 340b103528e..73c60aaf0c3 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/static_site_custom_domain_resource.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/web/static_site_custom_domain_resource.go @@ -55,7 +55,7 @@ func resourceStaticSiteCustomDomain() *pluginsdk.Resource { "validation_type": { Type: pluginsdk.TypeString, - Required: true, + Optional: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ txtValidationType, @@ -102,6 +102,9 @@ func resourceStaticSiteCustomDomainCreateOrUpdate(d *pluginsdk.ResourceData, met } validationMethod := d.Get("validation_type").(string) + if validationMethod == "" { + return fmt.Errorf("`validation_type` can't be empty string") + } siteEnvelope := web.StaticSiteCustomDomainRequestPropertiesARMResource{ StaticSiteCustomDomainRequestPropertiesARMResourceProperties: &web.StaticSiteCustomDomainRequestPropertiesARMResourceProperties{ diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk/explicitly_null_config.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk/explicitly_null_config.go new file mode 100644 index 00000000000..5425d4f2c3d --- /dev/null +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk/explicitly_null_config.go @@ -0,0 +1,18 @@ +package pluginsdk + +// IsExplicitlyNullInConfig determines whether the specified 'configFieldName' +// exists in the configuration file or not. +// +// Returns 'true' if the 'configFieldName' is not found in the configuration file or 'false' if +// the 'configFieldName' is found in the configuration file. +func IsExplicitlyNullInConfig(d *ResourceData, configFieldName string) bool { + var isNull bool + + v := d.GetRawConfig().AsValueMap()[configFieldName] + + if v.IsNull() { + isNull = true + } + + return isNull +} diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/README.md b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/README.md index 091ff7014be..27db81f7c1c 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/README.md +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/README.md @@ -1,48 +1,149 @@ # terraform-registry-address -This package helps with representation, comparison and parsing of -Terraform Registry addresses, such as -`registry.terraform.io/grafana/grafana` or `hashicorp/aws`. +This module enables parsing, comparison and canonical representation of +[Terraform Registry](https://registry.terraform.io/) **provider** addresses +(such as `registry.terraform.io/grafana/grafana` or `hashicorp/aws`) +and **module** addresses (such as `hashicorp/subnets/cidr`). -The most common source of these addresses outside of Terraform Core -is JSON representation of state, plan, or schemas as obtained -via [`hashicorp/terraform-exec`](https://github.com/hashicorp/terraform-exec). +**Provider** addresses can be found in -## Parsing Provider Addresses + - [`terraform show -json `](https://www.terraform.io/internals/json-format#configuration-representation) (`full_name`) + - [`terraform version -json`](https://www.terraform.io/cli/commands/version#example) (`provider_selections`) + - [`terraform providers schema -json`](https://www.terraform.io/cli/commands/providers/schema#providers-schema-representation) (keys of `provider_schemas`) + - within `required_providers` block in Terraform configuration (`*.tf`) + - Terraform [CLI configuration file](https://www.terraform.io/cli/config/config-file#provider-installation) + - Plugin [reattach configurations](https://www.terraform.io/plugin/debugging#running-terraform-with-a-provider-in-debug-mode) -### Example +**Module** addresses can be found within `source` argument +of `module` block in Terraform configuration (`*.tf`) +and parts of the address (namespace and name) in the Registry API. + +## Compatibility + +The module assumes compatibility with Terraform v0.12 and later, +which have the mentioned JSON output produced by corresponding CLI flags. + +We recommend carefully reading the [ambigouous provider addresses](#Ambiguous-Provider-Addresses) +section below which may impact versions `0.12` and `0.13`. + +## Related Libraries + +Other libraries which may help with consuming most of the above Terraform +outputs in automation: + + - [`hashicorp/terraform-exec`](https://github.com/hashicorp/terraform-exec) + - [`hashicorp/terraform-json`](https://github.com/hashicorp/terraform-json) + +## Usage + +### Provider ```go -p, err := ParseRawProviderSourceString("hashicorp/aws") +pAddr, err := ParseProviderSource("hashicorp/aws") if err != nil { // deal with error } -// p == Provider{ +// pAddr == Provider{ // Type: "aws", // Namespace: "hashicorp", -// Hostname: svchost.Hostname("registry.terraform.io"), +// Hostname: DefaultProviderRegistryHost, // } ``` -### Legacy address +### Module + +```go +mAddr, err := ParseModuleSource("hashicorp/consul/aws//modules/consul-cluster") +if err != nil { + // deal with error +} + +// mAddr == Module{ +// Package: ModulePackage{ +// Host: DefaultProviderRegistryHost, +// Namespace: "hashicorp", +// Name: "consul", +// TargetSystem: "aws", +// }, +// Subdir: "modules/consul-cluster", +// }, +``` + +## Other Module Address Formats + +Modules can also be sourced from [other sources](https://www.terraform.io/language/modules/sources) +and these other sources (outside of Terraform Registry) +have different address formats, such as `./local` or +`github.com/hashicorp/example`. + +This library does _not_ recognize such other address formats +and it will return error upon parsing these. + +## Ambiguous Provider Addresses + +Qualified addresses with namespace (such as `hashicorp/aws`) +are used exclusively in all recent versions (`0.14+`) of Terraform. +If you only work with Terraform `v0.14.0+` configuration/output, you may +safely ignore the rest of this section and related part of the API. + +There are a few types of ambiguous addresses you may comes accross: + + - Terraform `v0.12` uses "namespace-less address", such as `aws`. + - Terraform `v0.13` may use `-` as a placeholder for the unknown namespace, + resulting in address such as `-/aws`. + - Terraform `v0.14+` _configuration_ still allows ambiguous providers + through `provider "" {}` block _without_ corresponding + entry inside `required_providers`, but these providers are always + resolved as `hashicorp/` and all JSON outputs only use that + resolved address. + +Both ambiguous address formats are accepted by `ParseProviderSource()` + +```go +pAddr, err := ParseProviderSource("aws") +if err != nil { + // deal with error +} + +// pAddr == Provider{ +// Type: "aws", +// Namespace: UnknownProviderNamespace, // "?" +// Hostname: DefaultProviderRegistryHost, // "registry.terraform.io" +// } +pAddr.HasKnownNamespace() // == false +pAddr.IsLegacy() // == false +``` +```go +pAddr, err := ParseProviderSource("-/aws") +if err != nil { + // deal with error +} -A legacy address is by itself (without more context) ambiguous. -For example `aws` may represent either the official `hashicorp/aws` -or just any custom-built provider called `aws`. +// pAddr == Provider{ +// Type: "aws", +// Namespace: LegacyProviderNamespace, // "-" +// Hostname: DefaultProviderRegistryHost, // "registry.terraform.io" +// } +pAddr.HasKnownNamespace() // == true +pAddr.IsLegacy() // == true +``` -Such ambiguous address can be produced by Terraform `<=0.12`. You can -just use `ImpliedProviderForUnqualifiedType` if you know for sure -the address was produced by an affected version. +However `NewProvider()` will panic if you pass an empty namespace +or any placeholder indicating unknown namespace. -If you do not have that context you should parse the string via -`ParseRawProviderSourceString` and then check `addr.IsLegacy()`. +```go +NewProvider(DefaultProviderRegistryHost, "", "aws") // panic +NewProvider(DefaultProviderRegistryHost, "-", "aws") // panic +NewProvider(DefaultProviderRegistryHost, "?", "aws") // panic +``` -#### What to do with a legacy address? +If you come across an ambiguous address, you should resolve +it to a fully qualified one and use that one instead. -Ask the Registry API whether and where the provider was moved to +### Resolving Ambiguous Address -(`-` represents the legacy, basically unknown namespace) +The Registry API provides the safest way of resolving an ambiguous address. ```sh # grafana (redirected to its own namespace) @@ -56,28 +157,15 @@ $ curl -s https://registry.terraform.io/v1/providers/-/aws/versions | jq '(.id, null ``` -Then: - - - Reparse the _new_ address (`moved_to`) of any _moved_ provider (e.g. `grafana/grafana`) via `ParseRawProviderSourceString` - - Reparse the full address (`id`) of any other provider (e.g. `hashicorp/aws`) - -Depending on context (legacy) `terraform` may need to be parsed separately. -Read more about this provider below. - -If for some reason you cannot ask the Registry API you may also use -`ParseAndInferProviderSourceString` which assumes that any legacy address -(including `terraform`) belongs to the `hashicorp` namespace. - -If you cache results (which you should), ensure you have invalidation -mechanism in place because target (migrated) namespace may change. -Hard-coding migrations anywhere in code is strongly discouraged. +When you cache results, ensure you have invalidation +mechanism in place as target (migrated) namespace may change. #### `terraform` provider Like any other legacy address `terraform` is also ambiguous. Such address may (most unlikely) represent a custom-built provider called `terraform`, or the now archived [`hashicorp/terraform` provider in the registry](https://registry.terraform.io/providers/hashicorp/terraform/latest), -or (most likely) the `terraform` provider built into 0.12+, which is +or (most likely) the `terraform` provider built into 0.11+, which is represented via a dedicated FQN of `terraform.io/builtin/terraform` in 0.13+. You may be able to differentiate between these different providers if you @@ -87,25 +175,7 @@ Alternatively you may just treat the address as the builtin provider, i.e. assume all of its logic including schema is contained within Terraform Core. -In such case you should just use `NewBuiltInProvider("terraform")`. - -## Parsing Module Addresses - -### Example - +In such case you should construct the address in the following way ```go -registry, err := ParseRawModuleSourceRegistry("hashicorp/subnets/cidr") -if err != nil { - // deal with error -} - -// registry == ModuleSourceRegistry{ -// PackageAddr: ModuleRegistryPackage{ -// Host: svchost.Hostname("registry.terraform.io"), -// Namespace: "hashicorp", -// Name: "subnets", -// TargetSystem: "cidr", -// }, -// Subdir: "", -// }, +pAddr := NewProvider(BuiltInProviderHost, BuiltInProviderNamespace, "terraform") ``` diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/module.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/module.go index f90279ec24a..6af0c5976b5 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/module.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/module.go @@ -9,14 +9,14 @@ import ( svchost "github.com/hashicorp/terraform-svchost" ) -// ModuleSourceRegistry is representing a module listed in a Terraform module +// Module is representing a module listed in a Terraform module // registry. -type ModuleSourceRegistry struct { - // PackageAddr is the registry package that the target module belongs to. +type Module struct { + // Package is the registry package that the target module belongs to. // The module installer must translate this into a ModuleSourceRemote // using the registry API and then take that underlying address's - // PackageAddr in order to find the actual package location. - PackageAddr ModuleRegistryPackage + // Package in order to find the actual package location. + Package ModulePackage // If Subdir is non-empty then it represents a sub-directory within the // remote package that the registry address eventually resolves to. @@ -36,22 +36,22 @@ const DefaultModuleRegistryHost = svchost.Hostname("registry.terraform.io") var moduleRegistryNamePattern = regexp.MustCompile("^[0-9A-Za-z](?:[0-9A-Za-z-_]{0,62}[0-9A-Za-z])?$") var moduleRegistryTargetSystemPattern = regexp.MustCompile("^[0-9a-z]{1,64}$") -// ParseRawModuleSourceRegistry only accepts module registry addresses, and +// ParseModuleSource only accepts module registry addresses, and // will reject any other address type. -func ParseRawModuleSourceRegistry(raw string) (ModuleSourceRegistry, error) { +func ParseModuleSource(raw string) (Module, error) { var err error var subDir string raw, subDir = splitPackageSubdir(raw) if strings.HasPrefix(subDir, "../") { - return ModuleSourceRegistry{}, fmt.Errorf("subdirectory path %q leads outside of the module package", subDir) + return Module{}, fmt.Errorf("subdirectory path %q leads outside of the module package", subDir) } parts := strings.Split(raw, "/") // A valid registry address has either three or four parts, because the // leading hostname part is optional. if len(parts) != 3 && len(parts) != 4 { - return ModuleSourceRegistry{}, fmt.Errorf("a module registry source address must have either three or four slash-separated components") + return Module{}, fmt.Errorf("a module registry source address must have either three or four slash-separated components") } host := DefaultModuleRegistryHost @@ -64,20 +64,20 @@ func ParseRawModuleSourceRegistry(raw string) (ModuleSourceRegistry, error) { case strings.Contains(parts[0], "--"): // Looks like possibly punycode, which we don't allow here // to ensure that source addresses are written readably. - return ModuleSourceRegistry{}, fmt.Errorf("invalid module registry hostname %q; internationalized domain names must be given as direct unicode characters, not in punycode", parts[0]) + return Module{}, fmt.Errorf("invalid module registry hostname %q; internationalized domain names must be given as direct unicode characters, not in punycode", parts[0]) default: - return ModuleSourceRegistry{}, fmt.Errorf("invalid module registry hostname %q", parts[0]) + return Module{}, fmt.Errorf("invalid module registry hostname %q", parts[0]) } } if !strings.Contains(host.String(), ".") { - return ModuleSourceRegistry{}, fmt.Errorf("invalid module registry hostname: must contain at least one dot") + return Module{}, fmt.Errorf("invalid module registry hostname: must contain at least one dot") } // Discard the hostname prefix now that we've processed it parts = parts[1:] } - ret := ModuleSourceRegistry{ - PackageAddr: ModuleRegistryPackage{ + ret := Module{ + Package: ModulePackage{ Host: host, }, @@ -88,7 +88,7 @@ func ParseRawModuleSourceRegistry(raw string) (ModuleSourceRegistry, error) { return ret, fmt.Errorf("can't use %q as a module registry host, because it's reserved for installing directly from version control repositories", host) } - if ret.PackageAddr.Namespace, err = parseModuleRegistryName(parts[0]); err != nil { + if ret.Package.Namespace, err = parseModuleRegistryName(parts[0]); err != nil { if strings.Contains(parts[0], ".") { // Seems like the user omitted one of the latter components in // an address with an explicit hostname. @@ -96,10 +96,10 @@ func ParseRawModuleSourceRegistry(raw string) (ModuleSourceRegistry, error) { } return ret, fmt.Errorf("invalid namespace %q: %s", parts[0], err) } - if ret.PackageAddr.Name, err = parseModuleRegistryName(parts[1]); err != nil { + if ret.Package.Name, err = parseModuleRegistryName(parts[1]); err != nil { return ret, fmt.Errorf("invalid module name %q: %s", parts[1], err) } - if ret.PackageAddr.TargetSystem, err = parseModuleRegistryTargetSystem(parts[2]); err != nil { + if ret.Package.TargetSystem, err = parseModuleRegistryTargetSystem(parts[2]); err != nil { if strings.Contains(parts[2], "?") { // The user was trying to include a query string, probably? return ret, fmt.Errorf("module registry addresses may not include a query string portion") @@ -110,6 +110,16 @@ func ParseRawModuleSourceRegistry(raw string) (ModuleSourceRegistry, error) { return ret, nil } +// MustParseModuleSource is a wrapper around ParseModuleSource that panics if +// it returns an error. +func MustParseModuleSource(raw string) (Module) { + mod, err := ParseModuleSource(raw) + if err != nil { + panic(err) + } + return mod +} + // parseModuleRegistryName validates and normalizes a string in either the // "namespace" or "name" position of a module registry source address. func parseModuleRegistryName(given string) (string, error) { @@ -163,11 +173,11 @@ func parseModuleRegistryTargetSystem(given string) (string, error) { // We typically use this longer representation in error message, in case // the inclusion of normally-omitted components is helpful in debugging // unexpected behavior. -func (s ModuleSourceRegistry) String() string { +func (s Module) String() string { if s.Subdir != "" { - return s.PackageAddr.String() + "//" + s.Subdir + return s.Package.String() + "//" + s.Subdir } - return s.PackageAddr.String() + return s.Package.String() } // ForDisplay is similar to String but instead returns a representation of @@ -177,11 +187,11 @@ func (s ModuleSourceRegistry) String() string { // // We typically use this shorter representation in informational messages, // such as the note that we're about to start downloading a package. -func (s ModuleSourceRegistry) ForDisplay() string { +func (s Module) ForDisplay() string { if s.Subdir != "" { - return s.PackageAddr.ForDisplay() + "//" + s.Subdir + return s.Package.ForDisplay() + "//" + s.Subdir } - return s.PackageAddr.ForDisplay() + return s.Package.ForDisplay() } // splitPackageSubdir detects whether the given address string has a diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/module_package.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/module_package.go index cba03a7fd50..d8ad2534a09 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/module_package.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/module_package.go @@ -6,53 +6,24 @@ import ( svchost "github.com/hashicorp/terraform-svchost" ) -// A ModulePackage represents a physical location where Terraform can retrieve -// a module package, which is an archive, repository, or other similar -// container which delivers the source code for one or more Terraform modules. -// -// A ModulePackage is a string in go-getter's address syntax. By convention, -// we use ModulePackage-typed values only for the result of successfully -// running the go-getter "detectors", which produces an address string which -// includes an explicit installation method prefix along with an address -// string in the format expected by that installation method. -// -// Note that although the "detector" phase of go-getter does do some simple -// normalization in certain cases, it isn't generally possible to compare -// two ModulePackage values to decide if they refer to the same package. Two -// equal ModulePackage values represent the same package, but there might be -// other non-equal ModulePackage values that also refer to that package, and -// there is no reliable way to determine that. -// -// Don't convert a user-provided string directly to ModulePackage. Instead, -// use ParseModuleSource with a remote module address and then access the -// ModulePackage value from the result, making sure to also handle the -// selected subdirectory if any. You should convert directly to ModulePackage -// only for a string that is hard-coded into the program (e.g. in a unit test) -// where you've ensured that it's already in the expected syntax. -type ModulePackage string - -func (p ModulePackage) String() string { - return string(p) -} - -// A ModuleRegistryPackage is an extra indirection over a ModulePackage where +// A ModulePackage is an extra indirection over a ModulePackage where // we use a module registry to translate a more symbolic address (and // associated version constraint given out of band) into a physical source // location. // -// ModuleRegistryPackage is distinct from ModulePackage because they have +// ModulePackage is distinct from ModulePackage because they have // disjoint use-cases: registry package addresses are only used to query a // registry in order to find a real module package address. These being // distinct is intended to help future maintainers more easily follow the // series of steps in the module installer, with the help of the type checker. -type ModuleRegistryPackage struct { +type ModulePackage struct { Host svchost.Hostname Namespace string Name string TargetSystem string } -func (s ModuleRegistryPackage) String() string { +func (s ModulePackage) String() string { // Note: we're using the "display" form of the hostname here because // for our service hostnames "for display" means something different: // it means to render non-ASCII characters directly as Unicode @@ -62,7 +33,7 @@ func (s ModuleRegistryPackage) String() string { return s.Host.ForDisplay() + "/" + s.ForRegistryProtocol() } -func (s ModuleRegistryPackage) ForDisplay() string { +func (s ModulePackage) ForDisplay() string { if s.Host == DefaultModuleRegistryHost { return s.ForRegistryProtocol() } @@ -76,7 +47,7 @@ func (s ModuleRegistryPackage) ForDisplay() string { // This is primarily intended for generating addresses to send to the // registry in question via the registry protocol, since the protocol // skips sending the registry its own hostname as part of identifiers. -func (s ModuleRegistryPackage) ForRegistryProtocol() string { +func (s ModulePackage) ForRegistryProtocol() string { var buf strings.Builder buf.WriteString(s.Namespace) buf.WriteByte('/') diff --git a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/provider.go b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/provider.go index 4dd0a5b7813..23e1e221f2f 100644 --- a/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/provider.go +++ b/terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-registry-address/provider.go @@ -16,9 +16,9 @@ type Provider struct { Hostname svchost.Hostname } -// DefaultRegistryHost is the hostname used for provider addresses that do +// DefaultProviderRegistryHost is the hostname used for provider addresses that do // not have an explicit hostname. -const DefaultRegistryHost = svchost.Hostname("registry.terraform.io") +const DefaultProviderRegistryHost = svchost.Hostname("registry.terraform.io") // BuiltInProviderHost is the pseudo-hostname used for the "built-in" provider // namespace. Built-in provider addresses must also have their namespace set @@ -34,11 +34,18 @@ const BuiltInProviderHost = svchost.Hostname("terraform.io") // special, even if they haven't encountered the concept formally yet. const BuiltInProviderNamespace = "builtin" +// UnknownProviderNamespace is the special string used to indicate +// unknown namespace, e.g. in "aws". This is equivalent to +// LegacyProviderNamespace for <0.12 style address. This namespace +// would never be produced by Terraform itself explicitly, it is +// only an internal placeholder. +const UnknownProviderNamespace = "?" + // LegacyProviderNamespace is the special string used in the Namespace field // of type Provider to mark a legacy provider address. This special namespace // value would normally be invalid, and can be used only when the hostname is -// DefaultRegistryHost because that host owns the mapping from legacy name to -// FQN. +// DefaultProviderRegistryHost because that host owns the mapping from legacy name to +// FQN. This may be produced by Terraform 0.13. const LegacyProviderNamespace = "-" // String returns an FQN string, indended for use in machine-readable output. @@ -56,7 +63,7 @@ func (pt Provider) ForDisplay() string { panic("called ForDisplay on zero-value addrs.Provider") } - if pt.Hostname == DefaultRegistryHost { + if pt.Hostname == DefaultProviderRegistryHost { return pt.Namespace + "/" + pt.Type } return pt.Hostname.ForDisplay() + "/" + pt.Namespace + "/" + pt.Type @@ -75,10 +82,18 @@ func (pt Provider) ForDisplay() string { // ParseProviderPart first to check that the given value is valid. func NewProvider(hostname svchost.Hostname, namespace, typeName string) Provider { if namespace == LegacyProviderNamespace { - // Legacy provider addresses must always be created via - // NewLegacyProvider so that we can use static analysis to find - // codepaths still working with those. - panic("attempt to create legacy provider address using NewProvider; use NewLegacyProvider instead") + // Legacy provider addresses must always be created via struct + panic("attempt to create legacy provider address using NewProvider; use Provider{} instead") + } + if namespace == UnknownProviderNamespace { + // Provider addresses with unknown namespace must always + // be created via struct + panic("attempt to create provider address with unknown namespace using NewProvider; use Provider{} instead") + } + if namespace == "" { + // This case is already handled by MustParseProviderPart() below, + // but we catch it early to provide more helpful message. + panic("attempt to create provider address with empty namespace") } return Provider{ @@ -88,63 +103,6 @@ func NewProvider(hostname svchost.Hostname, namespace, typeName string) Provider } } -// ImpliedProviderForUnqualifiedType represents the rules for inferring what -// provider FQN a user intended when only a naked type name is available. -// -// For all except the type name "terraform" this returns a so-called "default" -// provider, which is under the registry.terraform.io/hashicorp/ namespace. -// -// As a special case, the string "terraform" maps to -// "terraform.io/builtin/terraform" because that is the more likely user -// intent than the now-unmaintained "registry.terraform.io/hashicorp/terraform" -// which remains only for compatibility with older Terraform versions. -func ImpliedProviderForUnqualifiedType(typeName string) Provider { - switch typeName { - case "terraform": - // Note for future maintainers: any additional strings we add here - // as implied to be builtin must never also be use as provider names - // in the registry.terraform.io/hashicorp/... namespace, because - // otherwise older versions of Terraform could implicitly select - // the registry name instead of the internal one. - return NewBuiltInProvider(typeName) - default: - return NewDefaultProvider(typeName) - } -} - -// NewDefaultProvider returns the default address of a HashiCorp-maintained, -// Registry-hosted provider. -func NewDefaultProvider(name string) Provider { - return Provider{ - Type: MustParseProviderPart(name), - Namespace: "hashicorp", - Hostname: DefaultRegistryHost, - } -} - -// NewBuiltInProvider returns the address of a "built-in" provider. See -// the docs for Provider.IsBuiltIn for more information. -func NewBuiltInProvider(name string) Provider { - return Provider{ - Type: MustParseProviderPart(name), - Namespace: BuiltInProviderNamespace, - Hostname: BuiltInProviderHost, - } -} - -// NewLegacyProvider returns a mock address for a provider. -// This will be removed when ProviderType is fully integrated. -func NewLegacyProvider(name string) Provider { - return Provider{ - // We intentionally don't normalize and validate the legacy names, - // because existing code expects legacy provider names to pass through - // verbatim, even if not compliant with our new naming rules. - Type: name, - Namespace: LegacyProviderNamespace, - Hostname: DefaultRegistryHost, - } -} - // LegacyString returns the provider type, which is frequently used // interchangeably with provider name. This function can and should be removed // when provider type is fully integrated. As a safeguard for future @@ -167,6 +125,12 @@ func (pt Provider) IsZero() bool { return pt == Provider{} } +// HasKnownNamespace returns true if the provider namespace is known +// (also if it is legacy namespace) +func (pt Provider) HasKnownNamespace() bool { + return pt.Namespace != UnknownProviderNamespace +} + // IsBuiltIn returns true if the receiver is the address of a "built-in" // provider. That is, a provider under terraform.io/builtin/ which is // included as part of the Terraform binary itself rather than one to be @@ -201,25 +165,16 @@ func (pt Provider) IsLegacy() bool { panic("called IsLegacy() on zero-value addrs.Provider") } - return pt.Hostname == DefaultRegistryHost && pt.Namespace == LegacyProviderNamespace + return pt.Hostname == DefaultProviderRegistryHost && pt.Namespace == LegacyProviderNamespace } -// IsDefault returns true if the provider is a default hashicorp provider -func (pt Provider) IsDefault() bool { - if pt.IsZero() { - panic("called IsDefault() on zero-value addrs.Provider") - } - - return pt.Hostname == DefaultRegistryHost && pt.Namespace == "hashicorp" -} - // Equals returns true if the receiver and other provider have the same attributes. func (pt Provider) Equals(other Provider) bool { return pt == other } -// ParseRawProviderSourceString parses the source attribute and returns a provider. +// ParseProviderSource parses the source attribute and returns a provider. // This is intended primarily to parse the FQN-like strings returned by // terraform-config-inspect. // @@ -230,7 +185,7 @@ func (pt Provider) Equals(other Provider) bool { // // "name"-only format is parsed as -/name (i.e. legacy namespace) // requiring further identification of the namespace via Registry API -func ParseRawProviderSourceString(str string) (Provider, error) { +func ParseProviderSource(str string) (Provider, error) { var ret Provider parts, err := parseSourceStringParts(str) if err != nil { @@ -239,10 +194,14 @@ func ParseRawProviderSourceString(str string) (Provider, error) { name := parts[len(parts)-1] ret.Type = name - ret.Hostname = DefaultRegistryHost + ret.Hostname = DefaultProviderRegistryHost if len(parts) == 1 { - return NewLegacyProvider(name), nil + return Provider{ + Hostname: DefaultProviderRegistryHost, + Namespace: UnknownProviderNamespace, + Type: name, + }, nil } if len(parts) >= 2 { @@ -278,13 +237,13 @@ func ParseRawProviderSourceString(str string) (Provider, error) { ret.Hostname = hn } - if ret.Namespace == LegacyProviderNamespace && ret.Hostname != DefaultRegistryHost { + if ret.Namespace == LegacyProviderNamespace && ret.Hostname != DefaultProviderRegistryHost { // Legacy provider addresses must always be on the default registry // host, because the default registry host decides what actual FQN // each one maps to. return Provider{}, &ParserError{ Summary: "Invalid provider namespace", - Detail: "The legacy provider namespace \"-\" can be used only with hostname " + DefaultRegistryHost.ForDisplay() + ".", + Detail: "The legacy provider namespace \"-\" can be used only with hostname " + DefaultProviderRegistryHost.ForDisplay() + ".", } } @@ -332,28 +291,52 @@ func ParseRawProviderSourceString(str string) (Provider, error) { return ret, nil } -// ParseAndInferProviderSourceString parses the source attribute and returns a provider. -// This is intended primarily to parse the FQN-like strings returned by -// terraform-config-inspect. -// -// The following are valid source string formats: -// name -// namespace/name -// hostname/namespace/name -// -// "name" format is assumed to be hashicorp/name -func ParseAndInferProviderSourceString(str string) (Provider, error) { - var ret Provider - parts, err := parseSourceStringParts(str) +// MustParseProviderSource is a wrapper around ParseProviderSource that panics if +// it returns an error. +func MustParseProviderSource(raw string) (Provider) { + p, err := ParseProviderSource(raw) if err != nil { - return ret, err + panic(err) } + return p +} - if len(parts) == 1 { - return NewDefaultProvider(parts[0]), nil +// ValidateProviderAddress returns error if the given address is not FQN, +// that is if it is missing any of the three components from +// hostname/namespace/name. +func ValidateProviderAddress(raw string) error { + parts, err := parseSourceStringParts(raw) + if err != nil { + return err + } + + if len(parts) != 3 { + return &ParserError{ + Summary: "Invalid provider address format", + Detail: `Expected FQN in the format "hostname/namespace/name"`, + } + } + + p, err := ParseProviderSource(raw) + if err != nil { + return err + } + + if !p.HasKnownNamespace() { + return &ParserError{ + Summary: "Unknown provider namespace", + Detail: `Expected FQN in the format "hostname/namespace/name"`, + } + } + + if !p.IsLegacy() { + return &ParserError{ + Summary: "Invalid legacy provider namespace", + Detail: `Expected FQN in the format "hostname/namespace/name"`, + } } - return ParseRawProviderSourceString(str) + return nil } func parseSourceStringParts(str string) ([]string, error) { @@ -390,16 +373,6 @@ func parseSourceStringParts(str string) ([]string, error) { return parts, nil } -// MustParseRawProviderSourceString is a wrapper around ParseRawProviderSourceString that panics if -// it returns an error. -func MustParseRawProviderSourceString(str string) Provider { - result, err := ParseRawProviderSourceString(str) - if err != nil { - panic(err) - } - return result -} - // ParseProviderPart processes an addrs.Provider namespace or type string // provided by an end-user, producing a normalized version if possible or // an error if the string contains invalid characters. @@ -468,15 +441,3 @@ func MustParseProviderPart(given string) string { } return result } - -// IsProviderPartNormalized compares a given string to the result of ParseProviderPart(string) -func IsProviderPartNormalized(str string) (bool, error) { - normalized, err := ParseProviderPart(str) - if err != nil { - return false, err - } - if str == normalized { - return true, nil - } - return false, nil -} diff --git a/terraform/providers/azurerm/vendor/modules.txt b/terraform/providers/azurerm/vendor/modules.txt index 1a23e4b6df0..4eab7fba9dc 100644 --- a/terraform/providers/azurerm/vendor/modules.txt +++ b/terraform/providers/azurerm/vendor/modules.txt @@ -5,26 +5,21 @@ github.com/Azure/azure-sdk-for-go/services/aad/mgmt/2017-04-01/aad github.com/Azure/azure-sdk-for-go/services/advisor/mgmt/2020-01-01/advisor github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights -github.com/Azure/azure-sdk-for-go/services/azurestackhci/mgmt/2020-10-01/azurestackhci github.com/Azure/azure-sdk-for-go/services/batch/2020-03-01.11.0/batch github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2022-01-01/batch github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2021-06-01/cdn -github.com/Azure/azure-sdk-for-go/services/communication/mgmt/2020-08-20/communication github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute github.com/Azure/azure-sdk-for-go/services/consumption/mgmt/2019-10-01/consumption -github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-03-01/containerinstance github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2019-08-01/containerservice github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2021-10-15/documentdb -github.com/Azure/azure-sdk-for-go/services/costmanagement/mgmt/2020-06-01/costmanagement github.com/Azure/azure-sdk-for-go/services/databoxedge/mgmt/2020-12-01/databoxedge +github.com/Azure/azure-sdk-for-go/services/datadog/mgmt/2021-03-01/datadog github.com/Azure/azure-sdk-for-go/services/datafactory/mgmt/2018-06-01/datafactory github.com/Azure/azure-sdk-for-go/services/datamigration/mgmt/2018-04-19/datamigration github.com/Azure/azure-sdk-for-go/services/datashare/mgmt/2019-11-01/datashare github.com/Azure/azure-sdk-for-go/services/devtestlabs/mgmt/2018-09-15/dtl github.com/Azure/azure-sdk-for-go/services/digitaltwins/mgmt/2020-12-01/digitaltwins -github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns -github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2020-01-01/aad github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2021-12-01/eventgrid github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac @@ -32,60 +27,43 @@ github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/gu github.com/Azure/azure-sdk-for-go/services/hdinsight/mgmt/2018-06-01/hdinsight github.com/Azure/azure-sdk-for-go/services/healthbot/mgmt/2020-12-08/healthbot github.com/Azure/azure-sdk-for-go/services/healthcareapis/mgmt/2021-11-01/healthcareapis -github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2021-07-02/devices github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2021-10-01/keyvault github.com/Azure/azure-sdk-for-go/services/keyvault/v7.1/keyvault -github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-08-27/kusto +github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic github.com/Azure/azure-sdk-for-go/services/logz/mgmt/2020-10-01/logz github.com/Azure/azure-sdk-for-go/services/machinelearningservices/mgmt/2021-07-01/machinelearningservices -github.com/Azure/azure-sdk-for-go/services/maintenance/mgmt/2021-05-01/maintenance -github.com/Azure/azure-sdk-for-go/services/managedservices/mgmt/2019-06-01/managedservices -github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2021-02-01/maps -github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb github.com/Azure/azure-sdk-for-go/services/marketplaceordering/mgmt/2015-06-01/marketplaceordering github.com/Azure/azure-sdk-for-go/services/mediaservices/mgmt/2021-05-01/media -github.com/Azure/azure-sdk-for-go/services/mixedreality/mgmt/2021-01-01/mixedreality github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2020-10-01/insights github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2021-05-01/mysqlflexibleservers -github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network -github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2020-08-01/operationalinsights -github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql -github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers github.com/Azure/azure-sdk-for-go/services/preview/alertsmanagement/mgmt/2019-06-01-preview/alertsmanagement -github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform +github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-04-01-preview/authorization github.com/Azure/azure-sdk-for-go/services/preview/automation/mgmt/2020-01-13-preview/automation github.com/Azure/azure-sdk-for-go/services/preview/blueprint/mgmt/2018-11-01-preview/blueprint github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2019-06-01-preview/containerregistry github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-08-01-preview/containerregistry -github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice +github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders -github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2021-09-03-preview/desktopvirtualization -github.com/Azure/azure-sdk-for-go/services/preview/hardwaresecuritymodules/mgmt/2018-10-31-preview/hardwaresecuritymodules github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-07-01-preview/insights github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-09-01-preview/insights github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement -github.com/Azure/azure-sdk-for-go/services/preview/policyinsights/mgmt/2019-10-01-preview/policyinsights -github.com/Azure/azure-sdk-for-go/services/preview/portal/mgmt/2019-01-01-preview/portal github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2019-06-01-preview/templatespecs github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2021-06-01-preview/policy github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v3.0/security github.com/Azure/azure-sdk-for-go/services/preview/securityinsight/mgmt/2021-09-01-preview/securityinsight -github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2017-03-01-preview/sql github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2018-06-01-preview/sql github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v5.0/sql -github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2021-11-01-preview/sqlvirtualmachine github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork github.com/Azure/azure-sdk-for-go/services/preview/synapse/2020-08-01-preview/accesscontrol github.com/Azure/azure-sdk-for-go/services/provisioningservices/mgmt/2021-10-15/iothub -github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2018-07-10/siterecovery github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-08-01/recoveryservices github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-12-01/backup @@ -99,7 +77,7 @@ github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2020-05-01/managementg github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2020-06-01/resources github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2021-01-01/subscriptions github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2021-06-01/servicefabric -github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-04-01/storage +github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2021-09-01/storagecache github.com/Azure/azure-sdk-for-go/services/storagesync/mgmt/2020-03-01/storagesync github.com/Azure/azure-sdk-for-go/services/streamanalytics/mgmt/2020-03-01/streamanalytics @@ -183,7 +161,7 @@ github.com/google/uuid # github.com/hashicorp/errwrap v1.1.0 ## explicit github.com/hashicorp/errwrap -# github.com/hashicorp/go-azure-helpers v0.33.0 +# github.com/hashicorp/go-azure-helpers v0.39.1 ## explicit; go 1.17 github.com/hashicorp/go-azure-helpers/authentication github.com/hashicorp/go-azure-helpers/lang/dates @@ -197,11 +175,145 @@ github.com/hashicorp/go-azure-helpers/resourcemanager/identity github.com/hashicorp/go-azure-helpers/resourcemanager/location github.com/hashicorp/go-azure-helpers/resourcemanager/resourcegroups github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids +github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata github.com/hashicorp/go-azure-helpers/resourcemanager/tags github.com/hashicorp/go-azure-helpers/resourcemanager/zones github.com/hashicorp/go-azure-helpers/resourceproviders github.com/hashicorp/go-azure-helpers/sender github.com/hashicorp/go-azure-helpers/storage +# github.com/hashicorp/go-azure-sdk v0.20220815.1092453 +## explicit; go 1.18 +github.com/hashicorp/go-azure-sdk/resource-manager/aad/2021-05-01/domainservices +github.com/hashicorp/go-azure-sdk/resource-manager/aadb2c/2021-04-01-preview/tenants +github.com/hashicorp/go-azure-sdk/resource-manager/analysisservices/2017-08-01/servers +github.com/hashicorp/go-azure-sdk/resource-manager/appconfiguration/2022-05-01/configurationstores +github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis +github.com/hashicorp/go-azure-sdk/resource-manager/applicationinsights/2022-04-01/workbooksapis +github.com/hashicorp/go-azure-sdk/resource-manager/attestation/2020-10-01/attestationproviders +github.com/hashicorp/go-azure-sdk/resource-manager/automation/2021-06-22/automationaccount +github.com/hashicorp/go-azure-sdk/resource-manager/azurestackhci/2020-10-01/clusters +github.com/hashicorp/go-azure-sdk/resource-manager/cognitive/2021-04-30/cognitiveservicesaccounts +github.com/hashicorp/go-azure-sdk/resource-manager/communication/2020-08-20/communicationservice +github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/availabilitysets +github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhostgroups +github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/dedicatedhosts +github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/proximityplacementgroups +github.com/hashicorp/go-azure-sdk/resource-manager/compute/2021-11-01/sshpublickeys +github.com/hashicorp/go-azure-sdk/resource-manager/confidentialledger/2022-05-13/confidentialledger +github.com/hashicorp/go-azure-sdk/resource-manager/containerinstance/2021-03-01/containerinstance +github.com/hashicorp/go-azure-sdk/resource-manager/costmanagement/2021-10-01/exports +github.com/hashicorp/go-azure-sdk/resource-manager/databricks/2021-04-01-preview/workspaces +github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupinstances +github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backuppolicies +github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/backupvaults +github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-04-01/resourceguards +github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application +github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup +github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop +github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool +github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan +github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost +github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace +github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01 +github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/dns +github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/recordsets +github.com/hashicorp/go-azure-sdk/resource-manager/dns/2018-05-01/zones +github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/monitorsresource +github.com/hashicorp/go-azure-sdk/resource-manager/elastic/2020-07-01/rules +github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs +github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces +github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs +github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/consumergroups +github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs +github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs +github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubsclusters +github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespaces +github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets +github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry +github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces +github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers +github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms +github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionendpoints +github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-04-01/datacollectionrules +github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps +github.com/hashicorp/go-azure-sdk/resource-manager/loadtestservice/2021-12-01-preview/loadtests +github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/configurationassignments +github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/maintenanceconfigurations +github.com/hashicorp/go-azure-sdk/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations +github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/managedidentities +github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationassignments +github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2019-06-01/registrationdefinitions +github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts +github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators +github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/configurations +github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/databases +github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/firewallrules +github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/servers +github.com/hashicorp/go-azure-sdk/resource-manager/mariadb/2018-06-01/virtualnetworkrules +github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication +github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces +github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs +github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2019-09-01/querypacks +github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces +github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations +github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard +github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/tenantconfiguration +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/configurations +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/databases +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/firewallrules +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/replicas +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serveradministrators +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/servers +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2017-12-01/virtualnetworkrules +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2020-01-01/serverkeys +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/configurations +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/databases +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/firewallrules +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/serverrestart +github.com/hashicorp/go-azure-sdk/resource-manager/postgresql/2021-06-01/servers +github.com/hashicorp/go-azure-sdk/resource-manager/powerbidedicated/2021-01-01/capacities +github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/privatezones +github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/recordsets +github.com/hashicorp/go-azure-sdk/resource-manager/privatedns/2018-09-01/virtualnetworklinks +github.com/hashicorp/go-azure-sdk/resource-manager/purview/2021-07-01/account +github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/databases +github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2022-01-01/redisenterprise +github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/hybridconnections +github.com/hashicorp/go-azure-sdk/resource-manager/relay/2017-04-01/namespaces +github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/adminkeys +github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/querykeys +github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services +github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs +github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespaces +github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule +github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queues +github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule +github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/rules +github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/subscriptions +github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topics +github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule +github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster +github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype +github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr +github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines +github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies +github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/endpoints +github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/geographichierarchies +github.com/hashicorp/go-azure-sdk/resource-manager/trafficmanager/2018-08-01/profiles +github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules +github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers +github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/authorizations +github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/clusters +github.com/hashicorp/go-azure-sdk/resource-manager/vmware/2020-03-20/privateclouds +github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/connections +github.com/hashicorp/go-azure-sdk/resource-manager/web/2016-06-01/managedapis # github.com/hashicorp/go-checkpoint v0.5.0 ## explicit github.com/hashicorp/go-checkpoint @@ -232,10 +344,10 @@ github.com/hashicorp/go-retryablehttp # github.com/hashicorp/go-uuid v1.0.3 ## explicit github.com/hashicorp/go-uuid -# github.com/hashicorp/go-version v1.5.0 +# github.com/hashicorp/go-version v1.6.0 ## explicit github.com/hashicorp/go-version -# github.com/hashicorp/hc-install v0.3.2 +# github.com/hashicorp/hc-install v0.4.0 ## explicit; go 1.16 github.com/hashicorp/hc-install github.com/hashicorp/hc-install/checkpoint @@ -251,31 +363,35 @@ github.com/hashicorp/hc-install/internal/version github.com/hashicorp/hc-install/product github.com/hashicorp/hc-install/releases github.com/hashicorp/hc-install/src -# github.com/hashicorp/hcl/v2 v2.12.0 -## explicit; go 1.12 +# github.com/hashicorp/hcl/v2 v2.13.0 +## explicit; go 1.18 github.com/hashicorp/hcl/v2 github.com/hashicorp/hcl/v2/ext/customdecode github.com/hashicorp/hcl/v2/hclsyntax # github.com/hashicorp/logutils v1.0.0 ## explicit github.com/hashicorp/logutils -# github.com/hashicorp/terraform-exec v0.16.1 +# github.com/hashicorp/terraform-exec v0.17.2 ## explicit; go 1.17 github.com/hashicorp/terraform-exec/internal/version github.com/hashicorp/terraform-exec/tfexec # github.com/hashicorp/terraform-json v0.14.0 ## explicit; go 1.13 github.com/hashicorp/terraform-json -# github.com/hashicorp/terraform-plugin-go v0.9.1 +# github.com/hashicorp/terraform-plugin-go v0.10.0 ## explicit; go 1.17 github.com/hashicorp/terraform-plugin-go/internal/logging github.com/hashicorp/terraform-plugin-go/tfprotov5 +github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/diag github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/fromproto +github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tf5serverlogging github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5 github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/toproto github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server github.com/hashicorp/terraform-plugin-go/tfprotov6 +github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/diag github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/fromproto +github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tf6serverlogging github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6 github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/toproto github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server @@ -286,7 +402,7 @@ github.com/hashicorp/terraform-plugin-log/internal/hclogutils github.com/hashicorp/terraform-plugin-log/internal/logging github.com/hashicorp/terraform-plugin-log/tflog github.com/hashicorp/terraform-plugin-log/tfsdklog -# github.com/hashicorp/terraform-plugin-sdk/v2 v2.17.0 +# github.com/hashicorp/terraform-plugin-sdk/v2 v2.18.0 ## explicit; go 1.17 github.com/hashicorp/terraform-plugin-sdk/v2/diag github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff @@ -307,7 +423,7 @@ github.com/hashicorp/terraform-plugin-sdk/v2/internal/tfdiags github.com/hashicorp/terraform-plugin-sdk/v2/meta github.com/hashicorp/terraform-plugin-sdk/v2/plugin github.com/hashicorp/terraform-plugin-sdk/v2/terraform -# github.com/hashicorp/terraform-provider-azurerm v1.44.1-0.20220614054854-771c254f3b8b +# github.com/hashicorp/terraform-provider-azurerm v1.44.1-0.20220819162217-6be27548882d ## explicit; go 1.18 github.com/hashicorp/terraform-provider-azurerm github.com/hashicorp/terraform-provider-azurerm/helpers/azure @@ -316,7 +432,6 @@ github.com/hashicorp/terraform-provider-azurerm/helpers/validate github.com/hashicorp/terraform-provider-azurerm/internal/clients github.com/hashicorp/terraform-provider-azurerm/internal/common github.com/hashicorp/terraform-provider-azurerm/internal/features -github.com/hashicorp/terraform-provider-azurerm/internal/identity github.com/hashicorp/terraform-provider-azurerm/internal/locks github.com/hashicorp/terraform-provider-azurerm/internal/provider github.com/hashicorp/terraform-provider-azurerm/internal/resourceid @@ -324,13 +439,10 @@ github.com/hashicorp/terraform-provider-azurerm/internal/resourceproviders github.com/hashicorp/terraform-provider-azurerm/internal/sdk github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants -github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/advisor github.com/hashicorp/terraform-provider-azurerm/internal/services/advisor/client github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/sdk/2017-08-01/servers github.com/hashicorp/terraform-provider-azurerm/internal/services/analysisservices/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/client @@ -342,7 +454,6 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfigurati github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/client github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/1.0/appconfiguration -github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/sdk/2020-06-01/configurationstores github.com/hashicorp/terraform-provider-azurerm/internal/services/appconfiguration/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/azuresdkhacks @@ -357,8 +468,6 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/par github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/parse -github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/sdk/2020-10-01/attestationproviders github.com/hashicorp/terraform-provider-azurerm/internal/services/attestation/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/authorization github.com/hashicorp/terraform-provider-azurerm/internal/services/authorization/azuresdkhacks @@ -372,7 +481,6 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/par github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/azurestackhci/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/batch github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/client @@ -393,17 +501,16 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/client github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/deliveryruleactions github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/deliveryruleconditions +github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/frontdoorsecurityparams github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/migration github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/client github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/parse -github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/sdk/2021-04-30/cognitiveservicesaccounts github.com/hashicorp/terraform-provider-azurerm/internal/services/cognitive/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/communication github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/compute github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/client @@ -412,12 +519,9 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/sdk/2021-05-13-preview/confidentialledger github.com/hashicorp/terraform-provider-azurerm/internal/services/confidentialledger/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/connections github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/connections -github.com/hashicorp/terraform-provider-azurerm/internal/services/connections/sdk/2016-06-01/managedapis github.com/hashicorp/terraform-provider-azurerm/internal/services/consumption github.com/hashicorp/terraform-provider-azurerm/internal/services/consumption/client github.com/hashicorp/terraform-provider-azurerm/internal/services/consumption/migration @@ -453,9 +557,12 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/pa github.com/hashicorp/terraform-provider-azurerm/internal/services/databoxedge/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/parse -github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/sdk/2021-04-01-preview/workspaces +github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/migration github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/validate +github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog +github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/client +github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/parse +github.com/hashicorp/terraform-provider-azurerm/internal/services/datadog/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/client github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/migration @@ -463,8 +570,6 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/pa github.com/hashicorp/terraform-provider-azurerm/internal/services/datafactory/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/legacysdk/dataprotection -github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/dataprotection/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare github.com/hashicorp/terraform-provider-azurerm/internal/services/datashare/client @@ -475,7 +580,6 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtual github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/client github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/migration github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/parse -github.com/hashicorp/terraform-provider-azurerm/internal/services/desktopvirtualization/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/client github.com/hashicorp/terraform-provider-azurerm/internal/services/devtestlabs/migration @@ -493,7 +597,6 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/disks/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/dns github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/client github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/migration -github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/dns/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/client @@ -501,8 +604,6 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices github.com/hashicorp/terraform-provider-azurerm/internal/services/domainservices/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/monitorsresource -github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/sdk/2020-07-01/rules github.com/hashicorp/terraform-provider-azurerm/internal/services/elastic/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid/client @@ -511,22 +612,16 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/eventgrid/vali github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/client github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/migration -github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/parse -github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationruleseventhubs -github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/authorizationrulesnamespaces -github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/checknameavailabilitydisasterrecoveryconfigs -github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/consumergroups -github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/disasterrecoveryconfigs -github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2017-04-01/eventhubs -github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/eventhubsclusters -github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2018-01-01-preview/networkrulesets -github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/sdk/2021-01-01-preview/namespaces github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/azuresdkhacks github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/client github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/firewall/validate +github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay +github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/client +github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/parse +github.com/hashicorp/terraform-provider-azurerm/internal/services/fluidrelay/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/client github.com/hashicorp/terraform-provider-azurerm/internal/services/frontdoor/migration @@ -548,12 +643,10 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/hpccache/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/hpccache/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/hsm/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/client github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/migration -github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/iotcentral/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/client @@ -578,15 +671,12 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/legacy github.com/hashicorp/terraform-provider-azurerm/internal/services/legacy/client github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/parse -github.com/hashicorp/terraform-provider-azurerm/internal/services/lighthouse/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/client github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/loadtest/sdk/2021-12-01-preview/loadtests github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/client github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/migration @@ -619,12 +709,9 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/managementgrou github.com/hashicorp/terraform-provider-azurerm/internal/services/managementgroup/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/maps github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/accounts -github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/sdk/2021-02-01/creators github.com/hashicorp/terraform-provider-azurerm/internal/services/maps/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/mariadb/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/media github.com/hashicorp/terraform-provider-azurerm/internal/services/media/client @@ -632,7 +719,6 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/media/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/media/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/mixedreality/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/client github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/migration @@ -641,9 +727,6 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor/valida github.com/hashicorp/terraform-provider-azurerm/internal/services/msi github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/client github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/migration -github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/parse -github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/sdk/2018-11-30/managedidentity -github.com/hashicorp/terraform-provider-azurerm/internal/services/msi/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/client github.com/hashicorp/terraform-provider-azurerm/internal/services/mssql/helper @@ -656,7 +739,6 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/mysql/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/network github.com/hashicorp/terraform-provider-azurerm/internal/services/network/azuresdkhacks @@ -667,7 +749,6 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/network/valida github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/client github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/migration -github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/policy github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/client github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/parse @@ -678,22 +759,17 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/portal/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/client +github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/migration github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/postgres/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/sdk/2021-01-01/capacities github.com/hashicorp/terraform-provider-azurerm/internal/services/powerbi/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/privatezones -github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/recordsets -github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/sdk/2018-09-01/virtualnetworklinks github.com/hashicorp/terraform-provider-azurerm/internal/services/privatedns/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/purview github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/parse -github.com/hashicorp/terraform-provider-azurerm/internal/services/purview/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/client github.com/hashicorp/terraform-provider-azurerm/internal/services/recoveryservices/parse @@ -705,15 +781,9 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/redis/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/client github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/parse -github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/databases -github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/sdk/2022-01-01/redisenterprise github.com/hashicorp/terraform-provider-azurerm/internal/services/redisenterprise/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/relay github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/parse -github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/hybridconnections -github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/sdk/2017-04-01/namespaces -github.com/hashicorp/terraform-provider-azurerm/internal/services/relay/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/resource github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/client github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/migration @@ -721,9 +791,6 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/search github.com/hashicorp/terraform-provider-azurerm/internal/services/search/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/adminkeys -github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/querykeys -github.com/hashicorp/terraform-provider-azurerm/internal/services/search/sdk/2020-03-13/services github.com/hashicorp/terraform-provider-azurerm/internal/services/securitycenter github.com/hashicorp/terraform-provider-azurerm/internal/services/securitycenter/azuresdkhacks github.com/hashicorp/terraform-provider-azurerm/internal/services/securitycenter/client @@ -737,7 +804,6 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/valid github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/client github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/migration -github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/parse github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric/client @@ -745,15 +811,10 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric/ github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/parse -github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/managedcluster -github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/sdk/2021-05-01/nodetype -github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/client github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/migration github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/parse -github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/sdk/2020-05-01/signalr github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/client @@ -767,7 +828,6 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/client github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/helpers github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/migration github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse -github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/sdk/2021-04-01/objectreplicationpolicies github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/shim github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics @@ -786,21 +846,12 @@ github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/sdk/20 github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/parse -github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/endpoints -github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/geographichierarchies -github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/sdk/2018-08-01/profiles github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/parse -github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/sdk/2021-05-01-preview/videoanalyzer github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/client -github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/authorizations -github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/clusters -github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/sdk/2020-03-20/privateclouds github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/validate github.com/hashicorp/terraform-provider-azurerm/internal/services/web github.com/hashicorp/terraform-provider-azurerm/internal/services/web/client @@ -817,7 +868,7 @@ github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation github.com/hashicorp/terraform-provider-azurerm/internal/timeouts github.com/hashicorp/terraform-provider-azurerm/utils github.com/hashicorp/terraform-provider-azurerm/version -# github.com/hashicorp/terraform-registry-address v0.0.0-20220510144317-d78f4a47ae27 +# github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c ## explicit; go 1.14 github.com/hashicorp/terraform-registry-address # github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734